@nocobase/app 2.1.0-beta.46 → 2.1.0-beta.48

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.
@@ -1,2 +1,2 @@
1
- /*! For license information please see vendor-diagram-bc0ac0e3.js.LICENSE.txt */
2
- (globalThis.webpackChunknocobase=globalThis.webpackChunknocobase||[]).push([["3338"],{43457(e,t,r){e.exports=function(e){var t=[function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(0).layoutBase.LayoutConstants,i=r(0).layoutBase.FDLayoutConstants,a=r(0).CoSEConstants,o=r(0).CoSELayout,s=r(0).CoSENode,l=r(0).layoutBase.PointD,u=r(0).layoutBase.DimensionD,c={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function h(e){this.options=function(e,t){var r={};for(var n in e)r[n]=e[n];for(var n in t)r[n]=t[n];return r}(c,e),d(this.options)}var d=function(e){null!=e.nodeRepulsion&&(a.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=e.nodeRepulsion),null!=e.idealEdgeLength&&(a.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=e.idealEdgeLength),null!=e.edgeElasticity&&(a.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=e.edgeElasticity),null!=e.nestingFactor&&(a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),null!=e.gravity&&(a.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=e.gravity),null!=e.numIter&&(a.MAX_ITERATIONS=i.MAX_ITERATIONS=e.numIter),null!=e.gravityRange&&(a.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),null!=e.gravityCompound&&(a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),null!=e.gravityRangeCompound&&(a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),null!=e.initialEnergyOnIncremental&&(a.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),"draft"==e.quality?n.QUALITY=0:"proof"==e.quality?n.QUALITY=2:n.QUALITY=1,a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=!e.randomize,a.ANIMATE=i.ANIMATE=n.ANIMATE=e.animate,a.TILE=e.tile,a.TILING_PADDING_VERTICAL="function"==typeof e.tilingPaddingVertical?e.tilingPaddingVertical.call():e.tilingPaddingVertical,a.TILING_PADDING_HORIZONTAL="function"==typeof e.tilingPaddingHorizontal?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal};h.prototype.run=function(){var e,t,r=this.options;this.idToLNode={};var n=this.layout=new o,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var a=n.newGraphManager();this.gm=a;var s=this.options.eles.nodes(),l=this.options.eles.edges();this.root=a.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(s),n);for(var u=0;u<l.length;u++){var c=l[u],h=this.idToLNode[c.data("source")],d=this.idToLNode[c.data("target")];h!==d&&0==h.getEdgesBetween(d).length&&(a.add(n.newEdge(),h,d).id=c.id())}var f=function(e,t){"number"==typeof e&&(e=t);var r=e.data("id"),n=i.idToLNode[r];return{x:n.getRect().getCenterX(),y:n.getRect().getCenterY()}},g=function a(){for(var o,s=function(){r.fit&&r.cy.fit(r.eles,r.padding),e||(e=!0,i.cy.one("layoutready",r.ready),i.cy.trigger({type:"layoutready",layout:i}))},l=i.options.refresh,u=0;u<l&&!o;u++)o=i.stopped||i.layout.tick();if(o){n.checkLayoutSuccess()&&!n.isSubLayout&&n.doPostLayout(),n.tilingPostLayout&&n.tilingPostLayout(),n.isLayoutFinished=!0,i.options.eles.nodes().positions(f),s(),i.cy.one("layoutstop",i.options.stop),i.cy.trigger({type:"layoutstop",layout:i}),t&&cancelAnimationFrame(t),e=!1;return}var c=i.layout.getPositionsData();r.eles.nodes().positions(function(e,t){if("number"==typeof e&&(e=t),!e.isParent()){for(var r=e.id(),n=c[r],i=e;null==n&&(n=c[i.data("parent")]||c["DummyCompound_"+i.data("parent")],c[r]=n,void 0!=(i=i.parent()[0])););return null!=n?{x:n.x,y:n.y}:{x:e.position("x"),y:e.position("y")}}}),s(),t=requestAnimationFrame(a)};return n.addListener("layoutstarted",function(){"during"===i.options.animate&&(t=requestAnimationFrame(g))}),n.runLayout(),"during"!==this.options.animate&&(i.options.eles.nodes().not(":parent").layoutPositions(i,i.options,f),e=!1),this},h.prototype.getTopMostNodes=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].id()]=!0;return e.filter(function(e,r){"number"==typeof e&&(e=r);for(var n=e.parent()[0];null!=n;){if(t[n.id()])return!1;n=n.parent()[0]}return!0})},h.prototype.processChildrenList=function(e,t,r){for(var n=t.length,i=0;i<n;i++){var a,o,c=t[i],h=c.children(),d=c.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if((a=null!=c.outerWidth()&&null!=c.outerHeight()?e.add(new s(r.graphManager,new l(c.position("x")-d.w/2,c.position("y")-d.h/2),new u(parseFloat(d.w),parseFloat(d.h)))):e.add(new s(this.graphManager))).id=c.data("id"),a.paddingLeft=parseInt(c.css("padding")),a.paddingTop=parseInt(c.css("padding")),a.paddingRight=parseInt(c.css("padding")),a.paddingBottom=parseInt(c.css("padding")),this.options.nodeDimensionsIncludeLabels&&c.isParent()){var f=c.boundingBox({includeLabels:!0,includeNodes:!1}).w,g=c.boundingBox({includeLabels:!0,includeNodes:!1}).h,p=c.css("text-halign");a.labelWidth=f,a.labelHeight=g,a.labelPos=p}this.idToLNode[c.data("id")]=a,isNaN(a.rect.x)&&(a.rect.x=0),isNaN(a.rect.y)&&(a.rect.y=0),null!=h&&h.length>0&&(o=r.getGraphManager().add(r.newGraph(),a),this.processChildrenList(o,h,r))}},h.prototype.stop=function(){return this.stopped=!0,this};var f=function(e){e("layout","cose-bilkent",h)};"u">typeof cytoscape&&f(cytoscape),e.exports=f}],r={};function n(e){if(r[e])return r[e].exports;var i=r[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=r,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}(r(87799))},93409(e,t,r){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a=[],o=!0,s=!1;try{for(i=i.call(e);!(o=(r=i.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,n=e}finally{try{o||null==i.return||i.return()}finally{if(s)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var l,u,c,h,d,f,g,p,v,y,w,E,b,A,C,_,S,I,T,x,D="u"<typeof window?null:window,N=D?D.navigator:null;D&&D.document;var M=e(""),R=e({}),O=e(function(){}),P="u"<typeof HTMLElement?"undefined":e(HTMLElement),B=function(e){return e&&e.instanceString&&k(e.instanceString)?e.instanceString():null},L=function(t){return null!=t&&e(t)==M},k=function(t){return null!=t&&e(t)===O},F=function(e){return!H(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},z=function(t){return null!=t&&e(t)===R&&!F(t)&&t.constructor===Object},U=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},V=function(e){if("undefined"!==P)return null!=e&&e instanceof HTMLElement},H=function(e){return j(e)||Y(e)},j=function(e){return"collection"===B(e)&&e._private.single},Y=function(e){return"collection"===B(e)&&!e._private.single},X=function(e){return"core"===B(e)},G=function(e){return"stylesheet"===B(e)},W=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},q=function(t){return null!=t&&e(t)===R&&k(t.then)},Z=function(e,t){t||(t=function(){if(1==arguments.length)return arguments[0];if(0==arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var r=function r(){var n,i=arguments,a=t.apply(this,i),o=r.cache;return(n=o[a])||(n=o[a]=e.apply(this,i)),n};return r.cache={},r},Q=Z(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),K=Z(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),$=Z(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),J=function(e){return W(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},ee="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",et="rgb[a]?\\(("+ee+"[%]?)\\s*,\\s*("+ee+"[%]?)\\s*,\\s*("+ee+"[%]?)(?:\\s*,\\s*("+ee+"))?\\)",er="rgb[a]?\\((?:"+ee+"[%]?)\\s*,\\s*(?:"+ee+"[%]?)\\s*,\\s*(?:"+ee+"[%]?)(?:\\s*,\\s*(?:"+ee+"))?\\)",en="hsl[a]?\\(("+ee+")\\s*,\\s*("+ee+"[%])\\s*,\\s*("+ee+"[%])(?:\\s*,\\s*("+ee+"))?\\)",ei="hsl[a]?\\((?:"+ee+")\\s*,\\s*(?:"+ee+"[%])\\s*,\\s*(?:"+ee+"[%])(?:\\s*,\\s*(?:"+ee+"))?\\)",ea=function(e,t){return e<t?-1:+(e>t)},eo=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,r=1;r<t.length;r++){var n=t[r];if(null!=n)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=i[a];e[o]=n[o]}}return e},es=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,r,n;return 4===e.length?(t=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),n=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),r=parseInt(e[3]+e[4],16),n=parseInt(e[5]+e[6],16)),[t,r,n]}},el=function(e){function t(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}var r,n,i,a,o,s,l,u,c=RegExp("^"+en+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(i=parseFloat(c[2]))<0||i>100||(i/=100,(a=parseFloat(c[3]))<0||a>100)||(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===i)s=l=u=Math.round(255*a);else{var h=a<.5?a*(1+i):a+i-a*i,d=2*a-h;s=Math.round(255*t(d,h,n+1/3)),l=Math.round(255*t(d,h,n)),u=Math.round(255*t(d,h,n-1/3))}r=[s,l,u,o]}return r},eu=function(e){var t,r=RegExp("^"+et+"$").exec(e);if(r){t=[];for(var n=[],i=1;i<=3;i++){var a=r[i];if("%"===a[a.length-1]&&(n[i]=!0),a=parseFloat(a),n[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=n[1]||n[2]||n[3],s=n[1]&&n[2]&&n[3];if(o&&!s)return;var l=r[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},ec={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},eh=function(e){for(var t=e.map,r=e.keys,n=r.length,i=0;i<n;i++){var a=r[i];if(z(a))throw Error("Tried to set map with object key");i<r.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},ed=function(e){for(var t=e.map,r=e.keys,n=r.length,i=0;i<n;i++){var a=r[i];if(z(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))break}return t},ef=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eg="u">typeof globalThis?globalThis:"u">typeof window?window:void 0!==r.g?r.g:"u">typeof self?self:{},ep="object"==typeof eg&&eg&&eg.Object===Object&&eg,em="object"==typeof self&&self&&self.Object===Object&&self,ev=ep||em||Function("return this")(),ey=function(){return ev.Date.now()},ew=/\s/,eE=function(e){for(var t=e.length;t--&&ew.test(e.charAt(t)););return t},eb=/^\s+/,eA=ev.Symbol,eC=Object.prototype,e_=eC.hasOwnProperty,eS=eC.toString,eI=eA?eA.toStringTag:void 0,eT=function(e){var t=e_.call(e,eI),r=e[eI];try{e[eI]=void 0;var n=!0}catch(e){}var i=eS.call(e);return n&&(t?e[eI]=r:delete e[eI]),i},ex=Object.prototype.toString,eD=eA?eA.toStringTag:void 0,eN=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":eD&&eD in Object(e)?eT(e):ex.call(e)},eM=function(e){return"symbol"==typeof e||null!=e&&"object"==typeof e&&"[object Symbol]"==eN(e)},eR=0/0,eO=/^[-+]0x[0-9a-f]+$/i,eP=/^0b[01]+$/i,eB=/^0o[0-7]+$/i,eL=parseInt,ek=function(e){if("number"==typeof e)return e;if(eM(e))return eR;if(ef(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=ef(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=(t=e)?t.slice(0,eE(t)+1).replace(eb,""):t;var n=eP.test(e);return n||eB.test(e)?eL(e.slice(2),n?2:8):eO.test(e)?eR:+e},eF=Math.max,ez=Math.min,eU=function(e,t,r){var n,i,a,o,s,l,u=0,c=!1,h=!1,d=!0;if("function"!=typeof e)throw TypeError("Expected a function");function f(t){var r=n,a=i;return n=i=void 0,u=t,o=e.apply(a,r)}function g(e){var r=e-l,n=e-u;return void 0===l||r>=t||r<0||h&&n>=a}function p(){var e,r,n,i=ey();if(g(i))return v(i);s=setTimeout(p,(e=i-l,r=i-u,n=t-e,h?ez(n,a-r):n))}function v(e){return(s=void 0,d&&n)?f(e):(n=i=void 0,o)}function y(){var e,r=ey(),a=g(r);if(n=arguments,i=this,l=r,a){if(void 0===s)return u=e=l,s=setTimeout(p,t),c?f(e):o;if(h)return clearTimeout(s),s=setTimeout(p,t),f(l)}return void 0===s&&(s=setTimeout(p,t)),o}return t=ek(t)||0,ef(r)&&(c=!!r.leading,a=(h="maxWait"in r)?eF(ek(r.maxWait)||0,t):a,d="trailing"in r?!!r.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),u=0,n=l=i=s=void 0},y.flush=function(){return void 0===s?o:v(ey())},y},eV=D?D.performance:null,eH=eV&&eV.now?function(){return eV.now()}:function(){return Date.now()},ej=function(){if(D){if(D.requestAnimationFrame)return function(e){D.requestAnimationFrame(e)};else if(D.mozRequestAnimationFrame)return function(e){D.mozRequestAnimationFrame(e)};else if(D.webkitRequestAnimationFrame)return function(e){D.webkitRequestAnimationFrame(e)};else if(D.msRequestAnimationFrame)return function(e){D.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(eH())},1e3/60)}}(),eY=function(e){return ej(e)},eX=function(e){for(var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,n=r;!(t=e.next()).done;)n=65599*n+t.value|0;return n},eG=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},eW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},eq=function(e){return 2097152*e[0]+e[1]},eZ=function(e,t){return[eG(e[0],t[0]),eW(e[1],t[1])]},eQ=function(e,t){var r={value:0,done:!1},n=0,i=e.length;return eX({next:function(){return n<i?r.value=e[n++]:r.done=!0,r}},t)},eK=function(e,t){var r={value:0,done:!1},n=0,i=e.length;return eX({next:function(){return n<i?r.value=e.charCodeAt(n++):r.done=!0,r}},t)},e$=function(){return eJ(arguments)},eJ=function(e){for(var t,r=0;r<e.length;r++){var n=e[r];t=0===r?eK(n):eK(n,t)}return t},e1=!0,e0=null!=console.warn,e2=null!=console.trace,e3=Number.MAX_SAFE_INTEGER||0x1fffffffffffff,e4=function(){return!0},e8=function(){return!1},e6=function(){return 0},e5=function(){},e7=function(e){throw Error(e)},e9=function(e){if(void 0===e)return e1;e1=!!e},te=function(e){e9()&&(e0?console.warn(e):(console.log(e),e2&&console.trace()))},tt=function(e){return null==e?e:F(e)?e.slice():z(e)?eo({},e):e},tr=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},tn={},ti=function(){return tn},ta=function(e){var t=Object.keys(e);return function(r){for(var n={},i=0;i<t.length;i++){var a=t[i],o=null==r?void 0:r[a];n[a]=void 0===o?e[a]:o}return n}},to=function(e,t,r){for(var n=e.length-1;n>=0&&(e[n]!==t||(e.splice(n,1),!r));n--);},ts=function(e){e.splice(0,e.length)},tl=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];e.push(n)}},tu=function(e,t,r){return r&&(t=$(r,t)),e[t]},tc=function(e,t,r,n){r&&(t=$(r,t)),e[t]=n},th=function(){function e(){t(this,e),this._obj={}}return i(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),td="u">typeof Map?Map:th,tf=function(){function e(r){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=r){var n;n=null!=r.instanceString&&r.instanceString()===this.instanceString()?r.toArray():r;for(var i=0;i<n.length;i++)this.add(n[i])}}return i(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e}(),tg=("u"<typeof Set?"undefined":e(Set))!=="undefined"?Set:tf,tp=function(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!X(e))return void e7("An element must have a core reference and parameters set");var n=t.group;if(null==n&&(n=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==n&&"edges"!==n)return void e7("An element must be of type `nodes` or `edges`; you specified `"+n+"`");this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===n:!!t.pannable,active:!1,classes:new tg,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];F(t.classes)?l=t.classes:L(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];h&&""!==h&&i.classes.add(h)}this.createEmitter();var d=t.style||t.css;d&&(te("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d)),(void 0===r||r)&&this.restore()},tm=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,r,n){z(t)&&!H(t)&&(t=(i=t).roots||i.root,r=i.visit,n=i.directed),n=2!=arguments.length||k(r)?n:r,r=k(r)?r:function(){};for(var i,a,o=this._private.cy,s=t=L(t)?this.filter(t):t,l=[],u=[],c={},h={},d={},f=0,g=this.byGroup(),p=g.nodes,v=g.edges,y=0;y<s.length;y++){var w=s[y],E=w.id();w.isNode()&&(l.unshift(w),e.bfs&&(d[E]=!0,u.push(w)),h[E]=0)}for(;0!==l.length;){var b=function(){var t=e.bfs?l.shift():l.pop(),i=t.id();if(e.dfs){if(d[i])return"continue";d[i]=!0,u.push(t)}var o=h[i],s=c[i],g=null!=s?s.source():null,y=null!=s?s.target():null,w=null==s?void 0:t.same(g)?y[0]:g[0],E=void 0;if(!0===(E=r(t,s,w,f++,o)))return a=t,"break";if(!1===E)return"break";for(var b=t.connectedEdges().filter(function(e){return(!n||e.source().same(t))&&v.has(e)}),A=0;A<b.length;A++){var C=b[A],_=C.connectedNodes().filter(function(e){return!e.same(t)&&p.has(e)}),S=_.id();0===_.length||d[S]||(_=_[0],l.push(_),e.bfs&&(d[S]=!0,u.push(_)),c[S]=C,h[S]=h[i]+1)}}();if("continue"!==b&&"break"===b)break}for(var A=o.collection(),C=0;C<u.length;C++){var _=u[C],S=c[_.id()];null!=S&&A.push(S),A.push(_)}return{path:o.collection(A),found:o.collection(a)}}},tv={breadthFirstSearch:tm({bfs:!0}),depthFirstSearch:tm({dfs:!0})};tv.bfs=tv.breadthFirstSearch,tv.dfs=tv.depthFirstSearch;var ty=(l=c={exports:{}},u=c.exports,(function(){var e,t,r,n,i,a,o,s,u,c,h,d,f,g;t=Math.floor,u=Math.min,e=function(e,t){return e<t?-1:+(e>t)},s=function(r,n,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=e),i<0)throw Error("lo must be non-negative");for(null==a&&(a=r.length);i<a;)0>o(n,r[s=t((i+a)/2)])?a=s:i=s+1;return[].splice.apply(r,[i,i-i].concat(n)),n},i=function(t,r,n){return null==n&&(n=e),t.push(r),f(t,0,t.length-1,n)},n=function(t,r){var n,i;return null==r&&(r=e),n=t.pop(),t.length?(i=t[0],t[0]=n,g(t,0,r)):i=n,i},o=function(t,r,n){var i;return null==n&&(n=e),i=t[0],t[0]=r,g(t,0,n),i},a=function(t,r,n){var i;return null==n&&(n=e),t.length&&0>n(t[0],r)&&(r=(i=[t[0],r])[0],t[0]=i[1],g(t,0,n)),r},r=function(r,n){var i,a,o,s,l,u;for(null==n&&(n=e),s=(function(){u=[];for(var e=0,n=t(r.length/2);0<=n?e<n:e>n;0<=n?e++:e--)u.push(e);return u}).apply(this).reverse(),l=[],a=0,o=s.length;a<o;a++)i=s[a],l.push(g(r,i,n));return l},d=function(t,r,n){var i;if(null==n&&(n=e),-1!==(i=t.indexOf(r)))return f(t,0,i,n),g(t,i,n)},c=function(t,n,i){var o,s,l,u;if(null==i&&(i=e),!(o=t.slice(0,n)).length)return o;for(r(o,i),s=0,l=(u=t.slice(n)).length;s<l;s++)a(o,u[s],i);return o.sort(i).reverse()},h=function(t,i,a){var o,l,c,h,d,f,g,p,v;if(null==a&&(a=e),10*i<=t.length){if(!(c=t.slice(0,i).sort(a)).length)return c;for(h=0,l=c[c.length-1],f=(g=t.slice(i)).length;h<f;h++)0>a(o=g[h],l)&&(s(c,o,0,null,a),c.pop(),l=c[c.length-1]);return c}for(r(t,a),v=[],d=0,p=u(i,t.length);0<=p?d<p:d>p;0<=p?++d:--d)v.push(n(t,a));return v},f=function(t,r,n,i){var a,o,s;for(null==i&&(i=e),a=t[n];n>r;){if(0>i(a,o=t[s=n-1>>1])){t[n]=o,n=s;continue}break}return t[n]=a},g=function(t,r,n){var i,a,o,s,l;for(null==n&&(n=e),a=t.length,l=r,o=t[r],i=2*r+1;i<a;)(s=i+1)<a&&!(0>n(t[i],t[s]))&&(i=s),t[r]=t[i],i=2*(r=i)+1;return t[r]=o,f(t,l,r,n)},l.exports=function(){function t(t){this.cmp=null!=t?t:e,this.nodes=[]}return t.push=i,t.pop=n,t.replace=o,t.pushpop=a,t.heapify=r,t.updateItem=d,t.nlargest=c,t.nsmallest=h,t.prototype.push=function(e){return i(this.nodes,e,this.cmp)},t.prototype.pop=function(){return n(this.nodes,this.cmp)},t.prototype.peek=function(){return this.nodes[0]},t.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},t.prototype.replace=function(e){return o(this.nodes,e,this.cmp)},t.prototype.pushpop=function(e){return a(this.nodes,e,this.cmp)},t.prototype.heapify=function(){return r(this.nodes,this.cmp)},t.prototype.updateItem=function(e){return d(this.nodes,e,this.cmp)},t.prototype.clear=function(){return this.nodes=[]},t.prototype.empty=function(){return 0===this.nodes.length},t.prototype.size=function(){return this.nodes.length},t.prototype.clone=function(){var e;return(e=new t).nodes=this.nodes.slice(0),e},t.prototype.toArray=function(){return this.nodes.slice(0)},t.prototype.insert=t.prototype.push,t.prototype.top=t.prototype.peek,t.prototype.front=t.prototype.peek,t.prototype.has=t.prototype.contains,t.prototype.copy=t.prototype.clone,t}()}).call(eg),c.exports),tw=ta({root:null,weight:function(e){return 1},directed:!1}),tE=ta({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),tb=ta({weight:function(e){return 1},directed:!1}),tA=ta({weight:function(e){return 1},directed:!1,root:null}),tC=Math.sqrt(2),t_=function(e,t,r){0===r.length&&e7("Karger-Stein must be run on a connected (sub)graph");for(var n=r[e],i=n[1],a=n[2],o=t[i],s=t[a],l=r.length-1;l>=0;l--){var u=r[l],c=u[1],h=u[2];(t[c]===o&&t[h]===s||t[c]===s&&t[h]===o)&&r.splice(l,1)}for(var d=0;d<r.length;d++){var f=r[d];f[1]===s?(r[d]=f.slice(),r[d][1]=o):f[2]===s&&(r[d]=f.slice(),r[d][2]=o)}for(var g=0;g<t.length;g++)t[g]===s&&(t[g]=o);return r},tS=function(e,t,r,n){for(;r>n;)t=t_(Math.floor(Math.random()*t.length),e,t),r--;return t},tI=function(e,t,r){return{x:e.x*t+r.x,y:e.y*t+r.y}},tT=function(e,t,r){return{x:(e.x-r.x)/t,y:(e.y-r.y)/t}},tx=function(e){return{x:e[0],y:e[1]}},tD=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=1/0,i=t;i<r;i++){var a=e[i];isFinite(a)&&(n=Math.min(a,n))}return n},tN=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=-1/0,i=t;i<r;i++){var a=e[i];isFinite(a)&&(n=Math.max(a,n))}return n},tM=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=0,i=0,a=t;a<r;a++){var o=e[a];isFinite(o)&&(n+=o,i++)}return n/i},tR=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=!(arguments.length>5)||void 0===arguments[5]||arguments[5];n?e=e.slice(t,r):(r<e.length&&e.splice(r,e.length-r),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?!isFinite(l)&&(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},tO=function(e,t){return Math.atan2(t,e)-Math.PI/2},tP=Math.log2||function(e){return Math.log(e)/Math.log(2)},tB=function(e){return e>0?1:e<0?-1:0},tL=function(e,t){return Math.sqrt(tk(e,t))},tk=function(e,t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},tF=function(e){for(var t=e.length,r=0,n=0;n<t;n++)r+=e[n];for(var i=0;i<t;i++)e[i]=e[i]/r;return e},tz=function(e,t,r,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*r},tU=function(e,t,r,n){return{x:tz(e.x,t.x,r.x,n),y:tz(e.y,t.y,r.y,n)}},tV=function(e,t,r,n){var i={x:t.x-e.x,y:t.y-e.y},a=tL(e,t),o={x:i.x/a,y:i.y/a};return r=null==r?0:r,n=null!=n?n:r*a,{x:e.x+o.x*n,y:e.y+o.y*n}},tH=function(e,t,r){return Math.max(e,Math.min(r,t))},tj=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};else if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},tY=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},tX=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},tG=function(e,t,r){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r),e.y2=Math.max(e.y2,r),e.h=e.y2-e.y1},tW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tq=function(e){var t,r,n,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=r=n=i=a[0];else if(2===a.length)t=n=a[0],i=r=a[1];else if(4===a.length){var s=o(a,4);t=s[0],r=s[1],n=s[2],i=s[3]}return e.x1-=i,e.x2+=r,e.y1-=t,e.y2+=n,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tZ=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},tQ=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2<t.x1)&&!(t.x2<e.x1)&&!(e.y2<t.y1)&&!(t.y2<e.y1)&&!(e.y1>t.y2)&&!(t.y1>e.y2)&&!0},tK=function(e,t,r){return e.x1<=t&&t<=e.x2&&e.y1<=r&&r<=e.y2},t$=function(e,t){return tK(e,t.x1,t.y1)&&tK(e,t.x2,t.y2)},tJ=function(e,t,r,n,i,a,o){var s,l,u=rd(i,a),c=i/2,h=a/2,d=r-c+u-o,f=n-h-o,g=r+c-u+o;if((s=ra(e,t,r,n,d,f,g,f,!1)).length>0)return s;var p=r+c+o,v=n-h+u-o,y=n+h-u+o;if((s=ra(e,t,r,n,p,v,p,y,!1)).length>0)return s;var w=r-c+u-o,E=n+h+o,b=r+c-u+o;if((s=ra(e,t,r,n,w,E,b,E,!1)).length>0)return s;var A=r-c-o,C=n-h+u-o,_=n+h-u+o;if((s=ra(e,t,r,n,A,C,A,_,!1)).length>0)return s;var S=r-c+u,I=n-h+u;if((l=rn(e,t,r,n,S,I,u+o)).length>0&&l[0]<=S&&l[1]<=I)return[l[0],l[1]];var T=r+c-u,x=n-h+u;if((l=rn(e,t,r,n,T,x,u+o)).length>0&&l[0]>=T&&l[1]<=x)return[l[0],l[1]];var D=r+c-u,N=n+h-u;if((l=rn(e,t,r,n,D,N,u+o)).length>0&&l[0]>=D&&l[1]>=N)return[l[0],l[1]];var M=r-c+u,R=n+h-u;return(l=rn(e,t,r,n,M,R,u+o)).length>0&&l[0]<=M&&l[1]>=R?[l[0],l[1]]:[]},t1=function(e,t,r,n,i,a,o){var s=Math.min(r,i),l=Math.max(r,i),u=Math.min(n,a),c=Math.max(n,a);return s-o<=e&&e<=l+o&&u-o<=t&&t<=c+o},t0=function(e,t,r,n,i,a,o,s,l){var u={x1:Math.min(r,o,i)-l,x2:Math.max(r,o,i)+l,y1:Math.min(n,s,a)-l,y2:Math.max(n,s,a)+l};return!(e<u.x1)&&!(e>u.x2)&&!(t<u.y1)&&!(t>u.y2)},t2=function(e,t,r,n){var i=t*t-4*e*(r-=n);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},t3=function(e,t,r,n,i){var a,o,s,l,u,c,h,d;if(0===e&&(e=1e-5),t/=e,r/=e,n/=e,a=(o=(3*r-t*t)/9)*o*o+(s=(-(27*n)+t*(9*r-t*t*2))/54)*s,i[1]=0,h=t/3,a>0){u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,0===a){d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),i[4]=-h+d*Math.cos((l+4*Math.PI)/3)},t4=function(e,t,r,n,i,a,o,s){var l,u=[];t3(r*r-4*r*i+2*r*o+4*i*i-4*i*o+o*o+n*n-4*n*a+2*n*s+4*a*a-4*a*s+s*s,9*r*i-3*r*r-3*r*o-6*i*i+3*i*o+9*n*a-3*n*n-3*n*s-6*a*a+3*a*s,3*r*r-6*r*i+r*o-r*e+2*i*i+2*i*e-o*e+3*n*n-6*n*a+n*s-n*t+2*a*a+2*a*t-s*t,r*i-r*r+r*e-i*e+n*a-n*n+n*t-a*t,u);for(var c=[],h=0;h<6;h+=2)1e-7>Math.abs(u[h+1])&&u[h]>=0&&u[h]<=1&&c.push(u[h]);c.push(1),c.push(0);for(var d=-1,f=0;f<c.length;f++)l=Math.pow(Math.pow(1-c[f],2)*r+2*(1-c[f])*c[f]*i+c[f]*c[f]*o-e,2)+Math.pow(Math.pow(1-c[f],2)*n+2*(1-c[f])*c[f]*a+c[f]*c[f]*s-t,2),d>=0?l<d&&(d=l):d=l;return d},t8=function(e,t,r,n,i,a){var o=[e-r,t-n],s=[i-r,a-n],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-a)*(t-a):u-h},t6=function(e,t,r){for(var n,i,a,o,s=0,l=0;l<r.length/2;l++)if(n=r[2*l],i=r[2*l+1],l+1<r.length/2?(a=r[(l+1)*2],o=r[(l+1)*2+1]):(a=r[(l+1-r.length/2)*2],o=r[(l+1-r.length/2)*2+1]),n==e&&a==e);else{if((!(n>=e)||!(e>=a))&&(!(n<=e)||!(e<=a)))continue;(e-n)/(a-n)*(o-i)+i>t&&s++}return s%2!=0},t5=function(e,t,r,n,i,a,o,s,l){var u,c=Array(r.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h=Math.cos(-u),d=Math.sin(-u),f=0;f<c.length/2;f++)c[2*f]=a/2*(r[2*f]*h-r[2*f+1]*d),c[2*f+1]=o/2*(r[2*f+1]*h+r[2*f]*d),c[2*f]+=n,c[2*f+1]+=i;return t6(e,t,l>0?t9(re(c,-l)):c)},t7=function(e,t,r,n,i,a,o){for(var s=Array(r.length),l=a/2,u=o/2,c=rf(a,o),h=c*c,d=0;d<r.length/4;d++){var f=void 0,g=void 0;f=0===d?r.length-2:4*d-2,g=4*d+2;var p=n+l*r[4*d],v=i+u*r[4*d+1],y=c/Math.tan(Math.acos(-r[f]*r[g]-r[f+1]*r[g+1])/2),w=p-y*r[f],E=v-y*r[f+1],b=p+y*r[g],A=v+y*r[g+1];s[4*d]=w,s[4*d+1]=E,s[4*d+2]=b,s[4*d+3]=A;var C=r[f+1],_=-r[f];if(C*r[g]+_*r[g+1]<0&&(C*=-1,_*=-1),Math.pow(w+C*c-e,2)+Math.pow(E+_*c-t,2)<=h)return!0}return t6(e,t,s)},t9=function(e){for(var t,r,n,i,a,o,s,l,u=Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],r=e[4*c+1],n=e[4*c+2],i=e[4*c+3],c<e.length/4-1?(a=e[(c+1)*4],o=e[(c+1)*4+1],s=e[(c+1)*4+2],l=e[(c+1)*4+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var h=ra(t,r,n,i,a,o,s,l,!0);u[2*c]=h[0],u[2*c+1]=h[1]}return u},re=function(e,t){for(var r,n,i,a,o=Array(2*e.length),s=0;s<e.length/2;s++){r=e[2*s],n=e[2*s+1],s<e.length/2-1?(i=e[(s+1)*2],a=e[(s+1)*2+1]):(i=e[0],a=e[1]);var l=a-n,u=-(i-r),c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;o[4*s]=r+h*t,o[4*s+1]=n+d*t,o[4*s+2]=i+h*t,o[4*s+3]=a+d*t}return o},rt=function(e,t,r,n,i,a){var o=r-e,s=n-t,l=Math.sqrt((o/=i)*o+(s/=a)*s),u=l-1;if(u<0)return[];var c=u/l;return[(r-e)*c+e,(n-t)*c+t]},rr=function(e,t,r,n,i,a,o){return e-=i,t-=a,(e/=r/2+o)*e+(t/=n/2+o)*t<=1},rn=function(e,t,r,n,i,a,o){var s=[r-e,n-t],l=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(h<0)return[];var d=(-c+Math.sqrt(h))/(2*u),f=(-c-Math.sqrt(h))/(2*u),g=Math.min(d,f),p=Math.max(d,f),v=[];if(g>=0&&g<=1&&v.push(g),p>=0&&p<=1&&v.push(p),0===v.length)return[];var y=v[0]*s[0]+e,w=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,w]:[y,w,v[1]*s[0]+e,v[1]*s[1]+t]:[y,w]},ri=function(e,t,r){return t<=e&&e<=r||r<=e&&e<=t?e:e<=t&&t<=r||r<=t&&t<=e?t:r},ra=function(e,t,r,n,i,a,o,s,l){var u=e-i,c=r-e,h=o-i,d=t-a,f=n-t,g=s-a,p=h*d-g*u,v=c*d-f*u,y=g*c-h*f;if(0!==y){var w=p/y,E=v/y;return -.001<=w&&w<=1.001&&-.001<=E&&E<=1.001||l?[e+w*c,t+w*f]:[]}return 0!==p&&0!==v?[]:ri(e,r,o)===o?[o,s]:ri(e,r,i)===i?[i,a]:ri(i,o,r)===r?[r,n]:[]},ro=function(e,t,r,n,i,a,o,s){var l,u,c,h,d,f,g=[],p=Array(r.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y<p.length/2;y++)p[2*y]=r[2*y]*a+n,p[2*y+1]=r[2*y+1]*o+i;u=s>0?t9(re(p,-s)):p}else u=r;for(var w=0;w<u.length/2;w++)c=u[2*w],h=u[2*w+1],w<u.length/2-1?(d=u[(w+1)*2],f=u[(w+1)*2+1]):(d=u[0],f=u[1]),0!==(l=ra(e,t,n,i,c,h,d,f)).length&&g.push(l[0],l[1]);return g},rs=function(e,t,r,n,i,a,o,s){for(var l,u=[],c=Array(r.length),h=a/2,d=o/2,f=rf(a,o),g=0;g<r.length/4;g++){var p=void 0,v=void 0;p=0===g?r.length-2:4*g-2,v=4*g+2;var y=n+h*r[4*g],w=i+d*r[4*g+1],E=f/Math.tan(Math.acos(-r[p]*r[v]-r[p+1]*r[v+1])/2),b=y-E*r[p],A=w-E*r[p+1],C=y+E*r[v],_=w+E*r[v+1];0===g?(c[r.length-2]=b,c[r.length-1]=A):(c[4*g-2]=b,c[4*g-1]=A),c[4*g]=C,c[4*g+1]=_;var S=r[p+1],I=-r[p];S*r[v]+I*r[v+1]<0&&(S*=-1,I*=-1),0!==(l=rn(e,t,n,i,b+S*f,A+I*f,f)).length&&u.push(l[0],l[1])}for(var T=0;T<c.length/4;T++)0!==(l=ra(e,t,n,i,c[4*T],c[4*T+1],c[4*T+2],c[4*T+3],!1)).length&&u.push(l[0],l[1]);if(u.length>2){for(var x=[u[0],u[1]],D=Math.pow(x[0]-e,2)+Math.pow(x[1]-t,2),N=1;N<u.length/2;N++){var M=Math.pow(u[2*N]-e,2)+Math.pow(u[2*N+1]-t,2);M<=D&&(x[0]=u[2*N],x[1]=u[2*N+1],D=M)}return x}return u},rl=function(e,t,r){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),a=(i-r)/i;return a<0&&(a=1e-5),[t[0]+a*n[0],t[1]+a*n[1]]},ru=function(e,t){var r=rh(e,t);return rc(r)},rc=function(e){for(var t,r,n=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<n;l++)t=e[2*l],r=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,r),s=Math.max(s,r);for(var u=2/(o-i),c=2/(s-a),h=0;h<n;h++)t=e[2*h]=e[2*h]*u,r=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,r),s=Math.max(s,r);if(a<-1)for(var d=0;d<n;d++)r=e[2*d+1]=e[2*d+1]+(-1-a);return e},rh=function(e,t){var r,n=1/e*2*Math.PI,i=e%2==0?Math.PI/2+n/2:Math.PI/2;i+=t;for(var a=Array(2*e),o=0;o<e;o++)r=o*n+i,a[2*o]=Math.cos(r),a[2*o+1]=Math.sin(-r);return a},rd=function(e,t){return Math.min(e/4,t/4,8)},rf=function(e,t){return Math.min(e/10,t/10,8)},rg=function(){return 8},rp=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},rm=ta({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),rv=ta({root:null,weight:function(e){return 1},directed:!1,alpha:0}),ry={degreeCentralityNormalized:function(e){e=rv(e);var t=this.cy(),r=this.nodes(),n=r.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<n;l++){var u=r[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(e){return 0==o?0:(L(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(L(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var d={},f=0,g=0;g<n;g++){var p=r[g];e.root=p;var v=this.degreeCentrality(e);f<v.degree&&(f=v.degree),d[p.id()]=v.degree}return{degree:function(e){return 0===f?0:(L(e)&&(e=t.filter(e)),d[e.id()]/f)}}},degreeCentrality:function(e){e=rv(e);var t=this.cy(),r=this,n=e,i=n.root,a=n.weight,o=n.directed,s=n.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),u=l.filter(function(e){return e.target().same(i)&&r.has(e)}),c=l.filter(function(e){return e.source().same(i)&&r.has(e)}),h=u.length,d=c.length,f=0,g=0,p=0;p<u.length;p++)f+=a(u[p]);for(var v=0;v<c.length;v++)g+=a(c[v]);return{indegree:Math.pow(h,1-s)*Math.pow(f,s),outdegree:Math.pow(d,1-s)*Math.pow(g,s)}}for(var y=i.connectedEdges().intersection(r),w=y.length,E=0,b=0;b<y.length;b++)E+=a(y[b]);return{degree:Math.pow(w,1-s)*Math.pow(E,s)}}};ry.dc=ry.degreeCentrality,ry.dcn=ry.degreeCentralityNormalised=ry.degreeCentralityNormalized;var rw=ta({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),rE={closenessCentralityNormalized:function(e){for(var t=rw(e),r=t.harmonic,n=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:n,directed:i}),c=0;c<l.length;c++){for(var h=0,d=l[c],f=0;f<l.length;f++)if(c!==f){var g=u.distance(d,l[f]);r?h+=1/g:h+=g}r||(h=1/h),s<h&&(s=h),o[d.id()]=h}return{closeness:function(e){return 0==s?0:o[e=L(e)?a.filter(e)[0].id():e.id()]/s}}},closenessCentrality:function(e){var t=rw(e),r=t.root,n=t.weight,i=t.directed,a=t.harmonic;r=this.filter(r)[0];for(var o=this.dijkstra({root:r,weight:n,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(r)){var h=o.distanceTo(c);a?s+=1/h:s+=h}}return a?s:1/s}};rE.cc=rE.closenessCentrality,rE.ccn=rE.closenessCentralityNormalised=rE.closenessCentralityNormalized;var rb=ta({weight:null,directed:!1}),rA={betweennessCentrality:function(e){for(var t=rb(e),r=t.directed,n=t.weight,i=null!=n,a=this.cy(),o=this.nodes(),s={},l={},u=0,c=function(e,t){l[e]=t,t>u&&(u=t)},h=function(e){return l[e]},d=0;d<o.length;d++){var f=o[d],g=f.id();r?s[g]=f.outgoers().nodes():s[g]=f.openNeighborhood().nodes(),c(g,0)}for(var p=0;p<o.length;p++)!function(e){for(var t=o[e].id(),r=[],l={},u={},d={},f=new ty(function(e,t){return d[e]-d[t]}),g=0;g<o.length;g++){var p=o[g].id();l[p]=[],u[p]=0,d[p]=1/0}for(u[t]=1,d[t]=0,f.push(t);!f.empty();){var v=f.pop();if(r.push(v),i)for(var y=0;y<s[v].length;y++){var w=s[v][y],E=a.getElementById(v),b=n(E.edgesTo(w).length>0?E.edgesTo(w)[0]:w.edgesTo(E)[0]);d[w=w.id()]>d[v]+b&&(d[w]=d[v]+b,0>f.nodes.indexOf(w)?f.push(w):f.updateItem(w),u[w]=0,l[w]=[]),d[w]==d[v]+b&&(u[w]=u[w]+u[v],l[w].push(v))}else for(var A=0;A<s[v].length;A++){var C=s[v][A].id();d[C]==1/0&&(f.push(C),d[C]=d[v]+1),d[C]==d[v]+1&&(u[C]=u[C]+u[v],l[C].push(v))}}for(var _={},S=0;S<o.length;S++)_[o[S].id()]=0;for(;r.length>0;){for(var I=r.pop(),T=0;T<l[I].length;T++){var x=l[I][T];_[x]=_[x]+u[x]/u[I]*(1+_[I])}I!=o[e].id()&&c(I,h(I)+_[I])}}(p);var v={betweenness:function(e){return h(a.collection(e).id())},betweennessNormalized:function(e){return 0==u?0:h(a.collection(e).id())/u}};return v.betweennessNormalised=v.betweennessNormalized,v}};rA.bc=rA.betweennessCentrality;var rC=ta({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),r_=function(e,t){for(var r=0,n=0;n<t.length;n++)r+=t[n](e);return r},rS=function(e,t,r){for(var n=0;n<t;n++)e[n*t+n]=r},rI=function(e,t){for(var r,n=0;n<t;n++){r=0;for(var i=0;i<t;i++)r+=e[i*t+n];for(var a=0;a<t;a++)e[a*t+n]=e[a*t+n]/r}},rT=function(e,t,r){for(var n=Array(r*r),i=0;i<r;i++){for(var a=0;a<r;a++)n[i*r+a]=0;for(var o=0;o<r;o++)for(var s=0;s<r;s++)n[i*r+s]+=e[i*r+o]*t[o*r+s]}return n},rx=function(e,t,r){for(var n=e.slice(0),i=1;i<r;i++)e=rT(e,n,t);return e},rD=function(e,t,r){for(var n=Array(t*t),i=0;i<t*t;i++)n[i]=Math.pow(e[i],r);return rI(n,t),n},rN=function(e,t,r,n){for(var i=0;i<r;i++)if(Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n)!=Math.round(t[i]*Math.pow(10,n))/Math.pow(10,n))return!1;return!0},rM=function(e,t,r,n){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(r[s]);0!==o.length&&i.push(n.collection(o))}return i},rR=function(e,t){for(var r=0;r<e.length;r++)if(!t[r]||e[r].id()!==t[r].id())return!1;return!0},rO=function(e){for(var t=0;t<e.length;t++)for(var r=0;r<e.length;r++)t!=r&&rR(e[t],e[r])&&e.splice(r,1);return e},rP=function(e){for(var t=this.nodes(),r=this.edges(),n=this.cy(),i=rC(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=Array(u),h=0;h<u;h++)c[h]=0;for(var d=0;d<r.length;d++){var f=r[d],g=a[f.source().id()],p=a[f.target().id()],v=r_(f,i.attributes);c[g*l+p]+=v,c[p*l+g]+=v}rS(c,l,i.multFactor),rI(c,l);for(var y=!0,w=0;y&&w<i.maxIterations;)y=!1,rN(c=rD(s=rx(c,l,i.expandFactor),l,i.inflateFactor),s,u,4)||(y=!0),w++;var E=rM(c,l,t,n);return rO(E)},rB=function(e){return e},rL=function(e,t){return Math.abs(t-e)},rk=function(e,t,r){return e+rL(t,r)},rF=function(e,t,r){return e+Math.pow(r-t,2)},rz=function(e){return Math.sqrt(e)},rU=function(e,t,r){return Math.max(e,rL(t,r))},rV=function(e,t,r,n,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:rB,o=n,s=0;s<e;s++)o=i(o,t(s),r(s));return a(o)},rH={euclidean:function(e,t,r){return e>=2?rV(e,t,r,0,rF,rz):rV(e,t,r,0,rk)},squaredEuclidean:function(e,t,r){return rV(e,t,r,0,rF)},manhattan:function(e,t,r){return rV(e,t,r,0,rk)},max:function(e,t,r){return rV(e,t,r,-1/0,rU)}};function rj(e,t,r,n,i,a){var o;return(o=k(e)?e:rH[e]||rH.euclidean,0===t&&k(e))?o(i,a):o(t,r,n,i,a)}rH["squared-euclidean"]=rH.squaredEuclidean,rH.squaredeuclidean=rH.squaredEuclidean;var rY=ta({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),rX=function(e){return rY(e)},rG=function(e,t,r,n,i){var a="kMedoids"!==i?function(e){return r[e]}:function(e){return n[e](r)};return rj(e,n.length,a,function(e){return n[e](t)},r,t)},rW=function(e,t,r){for(var n=r.length,i=Array(n),a=Array(n),o=Array(t),s=null,l=0;l<n;l++)i[l]=e.min(r[l]).value,a[l]=e.max(r[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<n;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[u]=s}return o},rq=function(e,t,r,n,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=rG(r,e,t[s],n,i);l<a&&(a=l,o=s)}return o},rZ=function(e,t,r){for(var n=[],i=null,a=0;a<t.length;a++)r[(i=t[a]).id()]===e&&n.push(i);return n},rQ=function(e,t,r){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)if(Math.abs(e[n][i]-t[n][i])>r)return!1;return!0},rK=function(e,t,r){for(var n=0;n<r;n++)if(e===t[n])return!0;return!1},r$=function(e,t){var r=Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var i=e[Math.floor(Math.random()*e.length)];rK(i,r,n);)i=e[Math.floor(Math.random()*e.length)];r[n]=i}else for(var a=0;a<t;a++)r[a]=e[Math.floor(Math.random()*e.length)];return r},rJ=function(e,t,r){for(var n=0,i=0;i<t.length;i++)n+=rG("manhattan",t[i],e,r,"kMedoids");return n},r1=function(e,t,r,n,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)n[s][l]=Math.pow(r[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=n[h][u]*i.attributes[c](t[h]),o+=n[h][u];e[u][c]=a/o}},r0=function(e,t,r,n,i){for(var a,o=0;o<e.length;o++)t[o]=e[o].slice();for(var s=2/(i.m-1),l=0;l<r.length;l++)for(var u=0;u<n.length;u++){a=0;for(var c=0;c<r.length;c++)a+=Math.pow(rG(i.distance,n[u],r[l],i.attributes,"cmeans")/rG(i.distance,n[u],r[c],i.attributes,"cmeans"),s);e[u][l]=1/a}},r2=function(e,t,r,n){for(var i,a,o=Array(r.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var u=0;u<t[0].length;u++)t[l][u]>i&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c<o.length;c++)o[c]=n.collection(o[c]);return o},r3=function(e){var t,r,n,i,a=this.cy(),o=this.nodes(),s=rX(e);n=Array(o.length);for(var l=0;l<o.length;l++)n[l]=Array(s.k);r=Array(o.length);for(var u=0;u<o.length;u++)r[u]=Array(s.k);for(var c=0;c<o.length;c++){for(var h=0,d=0;d<s.k;d++)r[c][d]=Math.random(),h+=r[c][d];for(var f=0;f<s.k;f++)r[c][f]=r[c][f]/h}t=Array(s.k);for(var g=0;g<s.k;g++)t[g]=Array(s.attributes.length);i=Array(o.length);for(var p=0;p<o.length;p++)i[p]=Array(s.k);for(var v=!0,y=0;v&&y<s.maxIterations;)v=!1,r1(t,o,r,i,s),r0(r,n,t,o,s),rQ(r,n,s.sensitivityThreshold)||(v=!0),y++;return{clusters:r2(o,r,s,a),degreeOfMembership:r}},r4=ta({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),r8={single:"min",complete:"max"},r6=function(e){var t=r4(e),r=r8[t.linkage];return null!=r&&(t.linkage=r),t},r5=function(e,t,r,n,i){for(var a,o,s=0,l=1/0,u=i.attributes,c=function(e,t){return rj(i.distance,u.length,function(t){return u[t](e)},function(e){return u[e](t)},e,t)},h=0;h<e.length;h++){var d=e[h].key,f=r[d][n[d]];f<l&&(s=d,l=f)}if("threshold"===i.mode&&l>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var g=t[s],p=t[n[s]];o="dendrogram"===i.mode?{left:g,right:p,key:g.key}:{value:g.value.concat(p.value),key:g.key},e[g.index]=o,e.splice(p.index,1),t[g.key]=o;for(var v=0;v<e.length;v++){var y=e[v];g.key===y.key?a=1/0:"min"===i.linkage?(a=r[g.key][y.key],r[g.key][y.key]>r[p.key][y.key]&&(a=r[p.key][y.key])):"max"===i.linkage?(a=r[g.key][y.key],r[g.key][y.key]<r[p.key][y.key]&&(a=r[p.key][y.key])):a="mean"===i.linkage?(r[g.key][y.key]*g.size+r[p.key][y.key]*p.size)/(g.size+p.size):"dendrogram"===i.mode?c(y.value,g.value):c(y.value[0],g.value[0]),r[g.key][y.key]=r[y.key][g.key]=a}for(var w=0;w<e.length;w++){var E=e[w].key;if(n[E]===g.key||n[E]===p.key){for(var b=E,A=0;A<e.length;A++){var C=e[A].key;r[E][C]<r[E][b]&&(b=C)}n[E]=b}e[w].index=w}return g.key=p.key=g.index=p.index=null,!0},r7=function e(t,r,n){t&&(t.value?r.push(t.value):(t.left&&e(t.left,r),t.right&&e(t.right,r)))},r9=function e(t,r){if(!t)return"";if(t.left&&t.right){var n=e(t.left,r),i=e(t.right,r),a=r.add({group:"nodes",data:{id:n+","+i}});return r.add({group:"edges",data:{source:n,target:a.id()}}),r.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}if(t.value)return t.value.id()},ne=function e(t,r,n){if(!t)return[];var i=[],a=[],o=[];if(0===r)return t.left&&r7(t.left,i),t.right&&r7(t.right,a),o=i.concat(a),[n.collection(o)];if(1===r)if(t.value)return[n.collection(t.value)];else return t.left&&r7(t.left,i),t.right&&r7(t.right,a),[n.collection(i),n.collection(a)];return t.value?[n.collection(t.value)]:(t.left&&(i=e(t.left,r-1,n)),t.right&&(a=e(t.right,r-1,n)),i.concat(a))},nt=function(e){for(var t,r=this.cy(),n=this.nodes(),i=r6(e),a=i.attributes,o=function(e,t){return rj(i.distance,a.length,function(t){return a[t](e)},function(e){return a[e](t)},e,t)},s=[],l=[],u=[],c=[],h=0;h<n.length;h++){var d={value:"dendrogram"===i.mode?n[h]:[n[h]],key:h,index:h};s[h]=d,c[h]=d,l[h]=[],u[h]=0}for(var f=0;f<s.length;f++)for(var g=0;g<=f;g++){var p=void 0;p="dendrogram"===i.mode?f===g?1/0:o(s[f].value,s[g].value):f===g?1/0:o(s[f].value[0],s[g].value[0]),l[f][g]=p,l[g][f]=p,p<l[f][u[f]]&&(u[f]=g)}for(var v=r5(s,c,l,u,i);v;)v=r5(s,c,l,u,i);return"dendrogram"===i.mode?(t=ne(s[0],i.dendrogramDepth,r),i.addDendrogram&&r9(s[0],r)):(t=Array(s.length),s.forEach(function(e,n){e.key=e.index=null,t[n]=r.collection(e.value)})),t},nr=ta({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),nn=function(e){var t=e.damping,r=e.preference;.5<=t&&t<1||e7("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(e){return e===r})||U(r)||e7("Preference must be one of [".concat(n.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number. Got: ").concat(r)),nr(e)},ni=function(e,t,r,n){var i=function(e,t){return n[t](e)};return-rj(e,n.length,function(e){return i(t,e)},function(e){return i(r,e)},t,r)},na=function(e,t){return"median"===t?tR(e):"mean"===t?tM(e):"min"===t?tD(e):"max"===t?tN(e):t},no=function(e,t,r){for(var n=[],i=0;i<e;i++)t[i*e+i]+r[i*e+i]>0&&n.push(i);return n},ns=function(e,t,r){for(var n=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<r.length;s++){var l=r[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&n.push(a)}for(var u=0;u<r.length;u++)n[r[u]]=r[u];return n},nl=function(e,t,r){for(var n=ns(e,t,r),i=0;i<r.length;i++){for(var a=[],o=0;o<n.length;o++)n[o]===r[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[u]];c>l&&(s=u,l=c)}r[i]=a[s]}return ns(e,t,r)},nu=function(e){for(var t,r,n,i,a,o,s,l=this.cy(),u=this.nodes(),c=nn(e),h={},d=0;d<u.length;d++)h[u[d].id()]=d;n=Array(r=(t=u.length)*t);for(var f=0;f<r;f++)n[f]=-1/0;for(var g=0;g<t;g++)for(var p=0;p<t;p++)g!==p&&(n[g*t+p]=ni(c.distance,u[g],u[p],c.attributes));i=na(n,c.preference);for(var v=0;v<t;v++)n[v*t+v]=i;a=Array(r);for(var y=0;y<r;y++)a[y]=0;o=Array(r);for(var w=0;w<r;w++)o[w]=0;for(var E=Array(t),b=Array(t),A=Array(t),C=0;C<t;C++)E[C]=0,b[C]=0,A[C]=0;for(var _=Array(t*c.minIterations),S=0;S<_.length;S++)_[S]=0;for(s=0;s<c.maxIterations;s++){for(var I=0;I<t;I++){for(var T=-1/0,x=-1/0,D=-1,N=0,M=0;M<t;M++)E[M]=a[I*t+M],(N=o[I*t+M]+n[I*t+M])>=T?(x=T,T=N,D=M):N>x&&(x=N);for(var R=0;R<t;R++)a[I*t+R]=(1-c.damping)*(n[I*t+R]-T)+c.damping*E[R];a[I*t+D]=(1-c.damping)*(n[I*t+D]-x)+c.damping*E[D]}for(var O=0;O<t;O++){for(var P=0,B=0;B<t;B++)E[B]=o[B*t+O],b[B]=Math.max(0,a[B*t+O]),P+=b[B];P-=b[O],b[O]=a[O*t+O],P+=b[O];for(var L=0;L<t;L++)o[L*t+O]=(1-c.damping)*Math.min(0,P-b[L])+c.damping*E[L];o[O*t+O]=(1-c.damping)*(P-b[O])+c.damping*E[O]}for(var k=0,F=0;F<t;F++){var z=+(o[F*t+F]+a[F*t+F]>0);_[s%c.minIterations*t+F]=z,k+=z}if(k>0&&(s>=c.minIterations-1||s==c.maxIterations-1)){for(var U=0,V=0;V<t;V++){A[V]=0;for(var H=0;H<c.minIterations;H++)A[V]+=_[H*t+V];(0===A[V]||A[V]===c.minIterations)&&U++}if(U===t)break}}for(var j=no(t,a,o),Y=nl(t,n,j),X={},G=0;G<j.length;G++)X[j[G]]=[];for(var W=0;W<u.length;W++){var q=Y[h[u[W].id()]];null!=q&&X[q].push(u[W])}for(var Z=Array(j.length),Q=0;Q<j.length;Q++)Z[Q]=l.collection(X[j[Q]]);return Z},nc=ta({root:void 0,directed:!1}),nh=function(){var e=this,t={},r=0,n=0,i=[],a=[],o={},s=function(r,n){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=r||a[o].y!=n;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(r){var n=r.connectedNodes().intersection(e);l.merge(r),n.forEach(function(r){var n=r.id(),i=r.connectedEdges().intersection(e);l.merge(r),t[n].cutVertex?l.merge(i.filter(function(e){return e.isLoop()})):l.merge(i)})}),i.push(l)},l=function l(u,c,h){u===h&&(n+=1),t[c]={id:r,low:r++,cutVertex:!1};var d,f,g,p,v=e.getElementById(c).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(c))):v.forEach(function(e){d=e.source().id(),f=e.target().id(),(g=d===c?f:d)!==h&&(o[p=e.id()]||(o[p]=!0,a.push({x:c,y:g,edge:e})),g in t?t[c].low=Math.min(t[c].low,t[g].id):(l(u,g,c),t[c].low=Math.min(t[c].low,t[g].low),t[c].id<=t[g].low&&(t[c].cutVertex=!0,s(c,g))))})};e.forEach(function(e){if(e.isNode()){var r=e.id();r in t||(n=0,l(r,r),t[r].cutVertex=n>1)}});var u=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(u),components:i}},nd=function(){var e=this,t={},r=0,n=[],i=[],a=e.spawn(e),o=function o(s){if(i.push(s),t[s]={index:r,low:r++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var r=e.target().id();r!==s&&(r in t||o(r),t[r].explored||(t[s].low=Math.min(t[s].low,t[r].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),h=l.merge(c);n.push(h),a=a.difference(h)}};return e.forEach(function(e){if(e.isNode()){var r=e.id();r in t||o(r)}}),{cut:a,components:n}},nf={};[tv,{dijkstra:function(e){if(!z(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var r=tw(e),n=r.root,i=r.weight,a=r.directed,o=this,s=L(n)?this.filter(n)[0]:n[0],l={},u={},c={},h=this.byGroup(),d=h.nodes,f=h.edges;f.unmergeBy(function(e){return e.isLoop()});for(var g=function(e){return l[e.id()]},p=new ty(function(e,t){return g(e)-g(t)}),v=0;v<d.length;v++){var y=d[v];l[y.id()]=y.same(s)?0:1/0,p.push(y)}for(;p.size()>0;){var w=p.pop(),E=g(w);if(c[w.id()]=E,E!==1/0)for(var b=w.neighborhood().intersect(d),A=0;A<b.length;A++){var C=b[A],_=C.id(),S=function(e,t){for(var r,n=(a?e.edgesTo(t):e.edgesWith(t)).intersect(f),o=1/0,s=0;s<n.length;s++){var l=n[s],u=i(l);(u<o||!r)&&(o=u,r=l)}return{edge:r,dist:o}}(w,C),I=E+S.dist;I<g(C)&&(l[C.id()]=I,p.updateItem(C),u[_]={node:w,edge:S.edge})}}return{distanceTo:function(e){return c[(L(e)?d.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=L(e)?d.filter(e)[0]:e[0],r=[],n=t,i=n.id();if(t.length>0)for(r.unshift(t);u[i];){var a=u[i];r.unshift(a.edge),r.unshift(a.node),i=(n=a.node).id()}return o.spawn(r)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),r=t.nodes,n=t.edges,i=r.length,a=Array(i),o=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},s=0;s<i;s++)a[s]=this.spawn(r[s]);for(var l=n.sort(function(t,r){return e(t)-e(r)}),u=0;u<l.length;u++){var c=l[u],h=c.source()[0],d=c.target()[0],f=o(h),g=o(d),p=a[f],v=a[g];f!==g&&(r.merge(c),p.merge(v),a.splice(g,1))}return r}},{aStar:function(e){var t,r,n=this.cy(),i=tE(e),a=i.root,o=i.goal,s=i.heuristic,l=i.directed,u=i.weight;a=n.collection(a)[0],o=n.collection(o)[0];var c=a.id(),h=o.id(),d={},f={},g={},p=new ty(function(e,t){return f[e.id()]-f[t.id()]}),v=new tg,y={},w={},E=function(e,t){p.push(e),v.add(t)};E(a,c),d[c]=0,f[c]=s(a);for(var b=0;p.size()>0;){if(r=(t=p.pop()).id(),v.delete(r),b++,r===h){for(var A=[],C=o,_=h,S=w[_];A.unshift(C),null!=S&&A.unshift(S),null!=(C=y[_]);)S=w[_=C.id()];return{found:!0,distance:d[r],path:this.spawn(A),steps:b}}g[r]=!0;for(var I=t._private.edges,T=0;T<I.length;T++){var x=I[T];if(this.hasElementWithId(x.id())&&(!l||x.data("source")===r)){var D=x.source(),N=x.target(),M=D.id()!==r?D:N,R=M.id();if(this.hasElementWithId(R)&&!g[R]){var O=d[r]+u(x);if(!v.has(R)){d[R]=O,f[R]=O+s(M),E(M,R),y[R]=t,w[R]=x;continue}O<d[R]&&(d[R]=O,f[R]=O+s(M),y[R]=t,w[R]=x)}}}}return{found:!1,distance:void 0,path:void 0,steps:b}}},{floydWarshall:function(e){for(var t=this.cy(),r=tb(e),n=r.weight,i=r.directed,a=this.byGroup(),o=a.nodes,s=a.edges,l=o.length,u=l*l,c=function(e){return o.indexOf(e)},h=function(e){return o[e]},d=Array(u),f=0;f<u;f++){var g=f%l;(f-g)/l===g?d[f]=0:d[f]=1/0}for(var p=Array(u),v=Array(u),y=0;y<s.length;y++){var w=s[y],E=w.source()[0],b=w.target()[0];if(E!==b){var A=c(E),C=c(b),_=A*l+C,S=n(w);if(d[_]>S&&(d[_]=S,p[_]=C,v[_]=w),!i){var I=C*l+A;!i&&d[I]>S&&(d[I]=S,p[I]=A,v[I]=w)}}}for(var T=0;T<l;T++)for(var x=0;x<l;x++)for(var D=x*l+T,N=0;N<l;N++){var M=x*l+N,R=T*l+N;d[D]+d[R]<d[M]&&(d[M]=d[D]+d[R],p[M]=p[D])}var O=function(e){return c((L(e)?t.filter(e):e)[0])};return{distance:function(e,t){return d[O(e)*l+O(t)]},path:function(e,r){var n,i=O(e),a=O(r),o=h(i);if(i===a)return o.collection();if(null==p[i*l+a])return t.collection();var s=t.collection(),u=i;for(s.merge(o);i!==a;)u=i,i=p[i*l+a],n=v[u*l+i],s.merge(n),s.merge(h(i));return s}}}},{bellmanFord:function(e){var t=this,r=tA(e),n=r.weight,i=r.directed,a=r.root,o=this,s=this.cy(),l=this.byGroup(),u=l.edges,c=l.nodes,h=c.length,d=new td,f=!1,g=[];a=s.collection(a)[0],u.unmergeBy(function(e){return e.isLoop()});for(var p=u.length,v=function(e){var t=d.get(e.id());return t||(t={},d.set(e.id(),t)),t},y=function(e){return(L(e)?s.$(e):e)[0]},w=0;w<h;w++){var E=c[w],b=v(E);E.same(a)?b.dist=0:b.dist=1/0,b.pred=null,b.edge=null}for(var A=!1,C=function(e,t,r,n,i,a){var o=n.dist+a;o<i.dist&&!r.same(n.edge)&&(i.dist=o,i.pred=e,i.edge=r,A=!0)},_=1;_<h;_++){A=!1;for(var S=0;S<p;S++){var I=u[S],T=I.source(),x=I.target(),D=n(I),N=v(T),M=v(x);C(T,x,I,N,M,D),i||C(x,T,I,M,N,D)}if(!A)break}if(A)for(var R=[],O=0;O<p;O++){var P=u[O],B=P.source(),k=P.target(),F=n(P),z=v(B).dist,U=v(k).dist;if(z+F<U||!i&&U+F<z)if(f||(te("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),!1!==e.findNegativeWeightCycles){var V=[];z+F<U&&V.push(B),!i&&U+F<z&&V.push(k);for(var H=V.length,j=0;j<H;j++){var Y=V[j],X=[Y];X.push(v(Y).edge);for(var G=v(Y).pred;-1===X.indexOf(G);)X.push(G),X.push(v(G).edge),G=v(G).pred;for(var W=(X=X.slice(X.indexOf(G)))[0].id(),q=0,Z=2;Z<X.length;Z+=2)X[Z].id()<W&&(W=X[Z].id(),q=Z);(X=X.slice(q).concat(X.slice(0,q))).push(X[0]);var Q=X.map(function(e){return e.id()}).join(",");-1===R.indexOf(Q)&&(g.push(o.spawn(X)),R.push(Q))}}else break}return{distanceTo:function(e){return v(y(e)).dist},pathTo:function(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,n=y(e),i=[],s=n;;){if(null==s)return t.spawn();var l=v(s),u=l.edge,c=l.pred;if(i.unshift(s[0]),s.same(r)&&i.length>0)break;null!=u&&i.unshift(u),s=c}return o.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},{kargerStein:function(){var e=this,t=this.byGroup(),r=t.nodes,n=t.edges;n.unmergeBy(function(e){return e.isLoop()});var i=r.length,a=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/tC);if(i<2)return void e7("At least 2 nodes are required for Karger-Stein algorithm");for(var l=[],u=0;u<a;u++){var c=n[u];l.push([u,r.indexOf(c.source()),r.indexOf(c.target())])}for(var h=1/0,d=[],f=Array(i),g=Array(i),p=Array(i),v=function(e,t){for(var r=0;r<i;r++)t[r]=e[r]},y=0;y<=o;y++){for(var w=0;w<i;w++)g[w]=w;var E=tS(g,l.slice(),i,s),b=E.slice();v(g,p);var A=tS(g,E,s,2),C=tS(p,b,s,2);A.length<=C.length&&A.length<h?(h=A.length,d=A,v(g,f)):C.length<=A.length&&C.length<h&&(h=C.length,d=C,v(p,f))}for(var _=this.spawn(d.map(function(e){return n[e[0]]})),S=this.spawn(),I=this.spawn(),T=f[0],x=0;x<f.length;x++){var D=f[x],N=r[x];D===T?S.merge(N):I.merge(N)}var M=function(t){var r=e.spawn();return t.forEach(function(t){r.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!_.contains(t)&&r.merge(t)})}),r};return{cut:_,components:[M(S),M(I)],partition1:S,partition2:I}}},{pageRank:function(e){for(var t,r=rm(e),n=r.dampingFactor,i=r.precision,a=r.iterations,o=r.weight,s=this._private.cy,l=this.byGroup(),u=l.nodes,c=l.edges,h=u.length,d=h*h,f=c.length,g=Array(d),p=Array(h),v=(1-n)/h,y=0;y<h;y++){for(var w=0;w<h;w++)g[y*h+w]=0;p[y]=0}for(var E=0;E<f;E++){var b=c[E],A=b.data("source"),C=b.data("target");if(A!==C){var _=u.indexOfId(A),S=u.indexOfId(C),I=o(b),T=S*h+_;g[T]+=I,p[_]+=I}}for(var x=1/h+v,D=0;D<h;D++)if(0===p[D])for(var N=0;N<h;N++)g[N*h+D]=x;else for(var M=0;M<h;M++){var R=M*h+D;g[R]=g[R]/p[D]+v}for(var O=Array(h),P=Array(h),B=0;B<h;B++)O[B]=1;for(var L=0;L<a;L++){for(var k=0;k<h;k++)P[k]=0;for(var F=0;F<h;F++)for(var z=0;z<h;z++){var U=F*h+z;P[F]+=g[U]*O[z]}tF(P),t=O,O=P,P=t;for(var V=0,H=0;H<h;H++){var j=t[H]-O[H];V+=j*j}if(V<i)break}return{rank:function(e){return e=s.collection(e)[0],O[u.indexOf(e)]}}}},ry,rE,rA,{markovClustering:rP,mcl:rP},{kMeans:function(t){var r,n=this.cy(),i=this.nodes(),a=null,o=rX(t),s=Array(o.k),l={};o.testMode?"number"==typeof o.testCentroids?(o.testCentroids,r=rW(i,o.k,o.attributes)):r="object"===e(o.testCentroids)?o.testCentroids:rW(i,o.k,o.attributes):r=rW(i,o.k,o.attributes);for(var u=!0,c=0;u&&c<o.maxIterations;){for(var h=0;h<i.length;h++)l[(a=i[h]).id()]=rq(a,r,o.distance,o.attributes,"kMeans");u=!1;for(var d=0;d<o.k;d++){var f=rZ(d,i,l);if(0!==f.length){for(var g=o.attributes.length,p=r[d],v=Array(g),y=Array(g),w=0;w<g;w++){y[w]=0;for(var E,b=0;b<f.length;b++)a=f[b],y[w]+=o.attributes[w](a);v[w]=y[w]/f.length,E=v[w],Math.abs(p[w]-E)<=o.sensitivityThreshold||(u=!0)}r[d]=v,s[d]=n.collection(f)}}c++}return s},kMedoids:function(t){var r,n,i=this.cy(),a=this.nodes(),o=null,s=rX(t),l=Array(s.k),u={},c=Array(s.k);s.testMode?"number"==typeof s.testCentroids||(r="object"===e(s.testCentroids)?s.testCentroids:r$(a,s.k)):r=r$(a,s.k);for(var h=!0,d=0;h&&d<s.maxIterations;){for(var f=0;f<a.length;f++)u[(o=a[f]).id()]=rq(o,r,s.distance,s.attributes,"kMedoids");h=!1;for(var g=0;g<r.length;g++){var p=rZ(g,a,u);if(0!==p.length){c[g]=rJ(r[g],p,s.attributes);for(var v=0;v<p.length;v++)(n=rJ(p[v],p,s.attributes))<c[g]&&(c[g]=n,r[g]=p[v],h=!0);l[g]=i.collection(p)}}d++}return l},fuzzyCMeans:r3,fcm:r3},{hierarchicalClustering:nt,hca:nt},{affinityPropagation:nu,ap:nu},{hierholzer:function(e){if(!z(e)){var t,r,n,i=arguments;e={root:i[0],directed:i[1]}}var a=nc(e),o=a.root,s=a.directed,l=!1;o&&(n=L(o)?this.filter(o)[0].id():o[0].id());var u={},c={};s?this.forEach(function(e){var n=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?t?l=!0:t=n:1==s?r?l=!0:r=n:(s>1||o>1)&&(l=!0),u[n]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[n].push(e.id())})}else c[n]=[void 0,e.target().id()]}):this.forEach(function(e){var n=e.id();e.isNode()?(e.degree(!0)%2&&(t?r?l=!0:r=n:t=n),u[n]=[],e.connectedEdges().forEach(function(e){return u[n].push(e.id())})):c[n]=[e.source().id(),e.target().id()]});var h={found:!1,trail:void 0};if(l)return h;if(r&&t)if(s){if(n&&r!=n)return h;n=r}else{if(n&&r!=n&&t!=n)return h;n||(n=r)}else n||(n=this[0].id());var d=function(e){for(var t,r,n,i=e,a=[e];u[i].length;)r=c[t=u[i].shift()][0],i!=(n=c[t][1])?(u[n]=u[n].filter(function(e){return e!=t}),i=n):s||i==r||(u[r]=u[r].filter(function(e){return e!=t}),i=r),a.unshift(t),a.unshift(i);return a},f=[],g=[];for(g=d(n);1!=g.length;)0==u[g[0]].length?(f.unshift(this.getElementById(g.shift())),f.unshift(this.getElementById(g.shift()))):g=d(g.shift()).concat(g);for(var p in f.unshift(this.getElementById(g.shift())),u)if(u[p].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:nh,htbc:nh,htb:nh,hopcroftTarjanBiconnectedComponents:nh},{tarjanStronglyConnected:nd,tsc:nd,tscc:nd,tarjanStronglyConnectedComponents:nd}].forEach(function(e){eo(nf,e)});var ng=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};ng.prototype={fulfill:function(e){return np(this,1,"fulfillValue",e)},reject:function(e){return np(this,2,"rejectReason",e)},then:function(e,t){var r=new ng;return this.onFulfilled.push(ny(e,r,"fulfill")),this.onRejected.push(ny(t,r,"reject")),nm(this),r.proxy}};var np=function(e,t,r,n){return 0===e.state&&(e.state=t,e[r]=n,nm(e)),e},nm=function(e){1===e.state?nv(e,"onFulfilled",e.fulfillValue):2===e.state&&nv(e,"onRejected",e.rejectReason)},nv=function(e,t,r){if(0!==e[t].length){var n=e[t];e[t]=[];var i=function(){for(var e=0;e<n.length;e++)n[e](r)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},ny=function(e,t,r){return function(n){if("function"!=typeof e)t[r].call(t,n);else{var i;try{i=e(n)}catch(e){t.reject(e);return}nw(t,i)}}},nw=function t(r,n){if(r===n||r.proxy===n)return void r.reject(TypeError("cannot resolve promise with itself"));if("object"===e(n)&&null!==n||"function"==typeof n)try{i=n.then}catch(e){r.reject(e);return}if("function"==typeof i){var i,a=!1;try{i.call(n,function(e){a||(a=!0,e===n?r.reject(TypeError("circular thenable chain")):t(r,e))},function(e){a||(a=!0,r.reject(e))})}catch(e){a||r.reject(e)}return}r.fulfill(n)};ng.all=function(e){return new ng(function(t,r){for(var n=Array(e.length),i=0,a=function(r,a){n[r]=a,++i===e.length&&t(n)},o=0;o<e.length;o++)!function(t){var n=e[t];null!=n&&null!=n.then?n.then(function(e){a(t,e)},function(e){r(e)}):a(t,n)}(o)})},ng.resolve=function(e){return new ng(function(t,r){t(e)})},ng.reject=function(e){return new ng(function(t,r){r(e)})};var nE="u">typeof Promise?Promise:ng,nb=function(e,t,r){var n=X(e),i=this._private=eo({duration:1e3},t,r);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&k(i.complete)&&i.completes.push(i.complete),!n){var a=e.position();i.startPosition=i.startPosition||{x:a.x,y:a.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(n){var o=e.pan();i.startPan={x:o.x,y:o.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},nA=nb.prototype;eo(nA,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),H(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,r=t.playing;return void 0===e?t.progress:(r&&this.pause(),t.progress=e,t.started=!1,r&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var r=function(t,r){var n=e[t];null!=n&&(e[t]=e[r],e[r]=n)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[n]=o}return t&&this.play(),this},promise:function(e){var t,r=this._private;return t="frame"===e?r.frames:r.completes,new nE(function(e,r){t.push(function(){e()})})}}),nA.complete=nA.completed,nA.run=nA.play,nA.running=nA.playing;var nC=Array.isArray,n_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nS=/^\w*$/,nI=function(e,t){if(nC(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||eM(e))||nS.test(e)||!n_.test(e)||null!=t&&e in Object(t)},nT=function(e){if(!ef(e))return!1;var t=eN(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},nx=ev["__core-js_shared__"],nD=(h=/[^.]+$/.exec(nx&&nx.keys&&nx.keys.IE_PROTO||""))?"Symbol(src)_1."+h:"",nN=Function.prototype.toString,nM=function(e){if(null!=e){try{return nN.call(e)}catch(e){}try{return e+""}catch(e){}}return""},nR=/^\[object .+?Constructor\]$/,nO=Object.prototype,nP=Function.prototype.toString,nB=nO.hasOwnProperty,nL=RegExp("^"+nP.call(nB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nk=function(e){return!!ef(e)&&(!nD||!(nD in e))&&(nT(e)?nL:nR).test(nM(e))},nF=function(e,t){var r=null==e?void 0:e[t];return nk(r)?r:void 0},nz=nF(Object,"create"),nU=Object.prototype.hasOwnProperty,nV=Object.prototype.hasOwnProperty;function nH(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}nH.prototype.clear=function(){this.__data__=nz?nz(null):{},this.size=0},nH.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},nH.prototype.get=function(e){var t=this.__data__;if(nz){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return nU.call(t,e)?t[e]:void 0},nH.prototype.has=function(e){var t=this.__data__;return nz?void 0!==t[e]:nV.call(t,e)},nH.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=nz&&void 0===t?"__lodash_hash_undefined__":t,this};var nj=function(e,t){return e===t||e!=e&&t!=t},nY=function(e,t){for(var r=e.length;r--;)if(nj(e[r][0],t))return r;return -1},nX=Array.prototype.splice;function nG(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}nG.prototype.clear=function(){this.__data__=[],this.size=0},nG.prototype.delete=function(e){var t=this.__data__,r=nY(t,e);return!(r<0)&&(r==t.length-1?t.pop():nX.call(t,r,1),--this.size,!0)},nG.prototype.get=function(e){var t=this.__data__,r=nY(t,e);return r<0?void 0:t[r][1]},nG.prototype.has=function(e){return nY(this.__data__,e)>-1},nG.prototype.set=function(e,t){var r=this.__data__,n=nY(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var nW=nF(ev,"Map"),nq=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},nZ=function(e,t){var r=e.__data__;return nq(t)?r["string"==typeof t?"string":"hash"]:r.map};function nQ(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function nK(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(nK.Cache||nQ),r}nQ.prototype.clear=function(){this.size=0,this.__data__={hash:new nH,map:new(nW||nG),string:new nH}},nQ.prototype.delete=function(e){var t=nZ(this,e).delete(e);return this.size-=!!t,t},nQ.prototype.get=function(e){return nZ(this,e).get(e)},nQ.prototype.has=function(e){return nZ(this,e).has(e)},nQ.prototype.set=function(e,t){var r=nZ(this,e),n=r.size;return r.set(e,t),this.size+=+(r.size!=n),this},nK.Cache=nQ;var n$=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nJ=/\\(\\)?/g,n1=(f=(d=nK(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(n$,function(e,r,n,i){t.push(n?i.replace(nJ,"$1"):r||e)}),t},function(e){return 500===f.size&&f.clear(),e})).cache,d),n0=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i},n2=1/0,n3=eA?eA.prototype:void 0,n4=n3?n3.toString:void 0,n8=function e(t){if("string"==typeof t)return t;if(nC(t))return n0(t,e)+"";if(eM(t))return n4?n4.call(t):"";var r=t+"";return"0"==r&&1/t==-n2?"-0":r},n6=function(e){return null==e?"":n8(e)},n5=function(e,t){return nC(e)?e:nI(e,t)?[e]:n1(n6(e))},n7=1/0,n9=function(e){if("string"==typeof e||eM(e))return e;var t=e+"";return"0"==t&&1/e==-n7?"-0":t},ie=function(e,t){t=n5(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[n9(t[r++])];return r&&r==n?e:void 0},it=function(e,t,r){var n=null==e?void 0:ie(e,t);return void 0===n?r:n},ir=function(){try{var e=nF(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ii=function(e,t,r){"__proto__"==t&&ir?ir(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},ia=Object.prototype.hasOwnProperty,io=function(e,t,r){var n=e[t];ia.call(e,t)&&nj(n,r)&&(void 0!==r||t in e)||ii(e,t,r)},is=/^(?:0|[1-9]\d*)$/,il=function(e,t){var r=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==r||"symbol"!=r&&is.test(e))&&e>-1&&e%1==0&&e<t},iu=function(e,t,r,n){if(!ef(e))return e;t=n5(t,e);for(var i=-1,a=t.length,o=a-1,s=e;null!=s&&++i<a;){var l=n9(t[i]),u=r;if("__proto__"===l||"constructor"===l||"prototype"===l)break;if(i!=o){var c=s[l];void 0===(u=n?n(c,l,s):void 0)&&(u=ef(c)?c:il(t[i+1])?[]:{})}io(s,l,u),s=s[l]}return e},ic=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t},ih={};[{animated:function(){return function(){var e=void 0!==this.length;if(!(this._private.cy||this).styleEnabled())return!1;var t=(e?this:[this])[0];if(t)return t._private.animation.current.length>0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++)e[t]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var r=void 0!==this.length,n=r?this:[this],i=this._private.cy||this,a=!r,o=!a;if(!i.styleEnabled())return this;var s=i.style();if(0===Object.keys(e=eo({},e,t)).length)return new nb(n[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(o&&(e.style=s.getPropsList(e.style||e.css),e.css=void 0),o&&null!=e.renderedPosition){var l=e.renderedPosition,u=i.pan(),c=i.zoom();e.position=tT(l,c,u)}if(a&&null!=e.panBy){var h=e.panBy,d=i.pan();e.pan={x:d.x+h.x,y:d.y+h.y}}var f=e.center||e.centre;if(a&&null!=f){var g=i.getCenterPan(f.eles,e.zoom);null!=g&&(e.pan=g)}if(a&&null!=e.fit){var p=e.fit,v=i.getFitViewport(p.eles||p.boundingBox,p.padding);null!=v&&(e.pan=v.pan,e.zoom=v.zoom)}if(a&&z(e.zoom)){var y=i.getZoomedViewport(e.zoom);null!=y?(y.zoomed&&(e.zoom=y.zoom),y.panned&&(e.pan=y.pan)):e.zoom=null}return new nb(n[0],e)}},animate:function(){return function(e,t){var r=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=eo({},e,t));for(var n=0;n<r.length;n++){var i=r[n],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var r=void 0!==this.length?this:[this],n=this._private.cy||this;if(!n.styleEnabled())return this;for(var i=0;i<r.length;i++){for(var a=r[i]._private,o=a.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}return n.notify("draw"),this}}},{data:function(e){return e=eo({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,r){var n,i=e,o=void 0!==this.length,s=o?this:[this],l=o?this[0]:this;if(L(t)){var u=-1!==t.indexOf(".")&&(nC(t)?n0(t,n9):eM(t)?[t]:ic(n1(n6(t))));if(i.allowGetting&&void 0===r)return l&&(i.beforeGet(l),f=u&&void 0===l._private[i.field][t]?it(l._private[i.field],u):l._private[i.field][t]),f;if(i.allowSetting&&void 0!==r&&!i.immutableKeys[t]){var c=a({},t,r);i.beforeSet(this,c);for(var h=0,d=s.length;h<d;h++){var f,g,p=s[h];i.canSet(p)&&(u&&void 0===l._private[i.field][t]?(g=p._private[i.field],null==g||iu(g,u,r)):p._private[i.field][t]=r)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}}else if(i.allowSetting&&z(t)){var v,y,w=Object.keys(t);i.beforeSet(this,t);for(var E=0;E<w.length;E++)if(y=t[v=w[E]],!i.immutableKeys[v])for(var b=0;b<s.length;b++){var A=s[b];i.canSet(A)&&(A._private[i.field][v]=y)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&k(t))this.on(i.bindingEvent,t);else if(i.allowGetting&&void 0===t)return l&&(i.beforeGet(l),n=l._private[i.field]),n;return this}},removeData:function(e){return e=eo({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var r=e,n=void 0!==this.length?this:[this];if(L(t)){for(var i=t.split(/\s+/),a=i.length,o=0;o<a;o++){var s=i[o];if(!W(s)&&!r.immutableKeys[s])for(var l=0,u=n.length;l<u;l++)n[l]._private[r.field][s]=void 0}r.triggerEvent&&this[r.triggerFnName](r.event)}else if(void 0===t){for(var c=0,h=n.length;c<h;c++)for(var d=n[c]._private[r.field],f=Object.keys(d),g=0;g<f.length;g++){var p=f[g];r.immutableKeys[p]||(d[p]=void 0)}r.triggerEvent&&this[r.triggerFnName](r.event)}return this}}},{eventAliasesOn:function(e){e.addListener=e.listen=e.bind=e.on,e.unlisten=e.unbind=e.off=e.removeListener,e.trigger=e.emit,e.pon=e.promiseOn=function(e,t){var r=this,n=Array.prototype.slice.call(arguments,0);return new nE(function(e,t){var i=n.concat([function(t){r.off.apply(r,a),e(t)}]),a=i.concat([]);r.on.apply(r,i)})}}}].forEach(function(e){eo(ih,e)});var id={animate:ih.animate(),animation:ih.animation(),animated:ih.animated(),clearQueue:ih.clearQueue(),delay:ih.delay(),delayAnimation:ih.delayAnimation(),stop:ih.stop()},ig={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach(function(e){return t.push(e)}),t}F(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],n=new tg(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,l=!1,u=0;u<e.length;u++){var c=e[u];if(!s.has(c)){l=!0;break}}l||(l=s.size!==e.length),l&&(o.classes=n,r.push(a))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){F(e)||(e=e.match(/\S+/g)||[]);for(var r=void 0===t,n=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,l=!1,u=0;u<e.length;u++){var c=e[u],h=s.has(c),d=!1;t||r&&!h?(s.add(c),d=!0):(!t||r&&h)&&(s.delete(c),d=!0),!l&&d&&(n.push(o),l=!0)}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var r=this;if(null==t)t=250;else if(0===t)return r;return r.addClass(e),setTimeout(function(){r.removeClass(e)},t),r}};ig.className=ig.classNames=ig.classes;var ip={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:ee,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};for(v=0,ip.variable="(?:[\\w-.]|(?:\\\\"+ip.metaChar+"))+",ip.className="(?:[\\w-]|(?:\\\\"+ip.metaChar+"))+",ip.value=ip.string+"|"+ip.number,ip.id=ip.variable,g=ip.comparatorOp.split("|");v<g.length;v++)p=g[v],ip.comparatorOp+="|@"+p;for(v=0,g=ip.comparatorOp.split("|");v<g.length;v++)(p=g[v]).indexOf("!")>=0||"="!==p&&(ip.comparatorOp+="|\\!"+p);var im=function(){return{checks:[]}},iv=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return -1*ea(e.selector,t.selector)}),iy=function(){for(var e,t={},r=0;r<iv.length;r++)t[(e=iv[r]).selector]=e.matches;return t}(),iw="("+iv.map(function(e){return e.selector}).join("|")+")",iE=function(e){return e.replace(RegExp("\\\\("+ip.metaChar+")","g"),function(e,t){return t})},ib=function(e,t,r){e[e.length-1]=r},iA=[{name:"group",query:!0,regex:"("+ip.group+")",populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:0,value:"*"===n?n:n+"s"})}},{name:"state",query:!0,regex:iw,populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:7,value:n})}},{name:"id",query:!0,regex:"\\#("+ip.id+")",populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:8,value:iE(n)})}},{name:"className",query:!0,regex:"\\.("+ip.className+")",populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:9,value:iE(n)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+ip.variable+")\\s*\\]",populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:4,field:iE(n)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+ip.variable+")\\s*("+ip.comparatorOp+")\\s*("+ip.value+")\\s*\\]",populate:function(e,t,r){var n=o(r,3),i=n[0],a=n[1],s=n[2];s=null!=RegExp("^"+ip.string+"$").exec(s)?s.substring(1,s.length-1):parseFloat(s),t.checks.push({type:3,field:iE(i),operator:a,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+ip.boolOp+")\\s*("+ip.variable+")\\s*\\]",populate:function(e,t,r){var n=o(r,2),i=n[0],a=n[1];t.checks.push({type:5,field:iE(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+ip.meta+")\\s*("+ip.comparatorOp+")\\s*("+ip.number+")\\s*\\]\\]",populate:function(e,t,r){var n=o(r,3),i=n[0],a=n[1],s=n[2];t.checks.push({type:6,field:iE(i),operator:a,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:ip.separator,populate:function(e,t){var r=e.currentSubject,n=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=r&&(a.subject=r,e.currentSubject=null),a.edgeCount=n,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=im()}},{name:"directedEdge",separator:!0,regex:ip.directedEdge,populate:function(e,t){if(null==e.currentSubject){var r=im(),n=im();return r.checks.push({type:11,source:t,target:n}),ib(e,t,r),e.edgeCount++,n}var i=im(),a=im();return i.checks.push({type:12,source:t,target:a}),ib(e,t,i),e.edgeCount++,a}},{name:"undirectedEdge",separator:!0,regex:ip.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var r=im(),n=im();return r.checks.push({type:10,nodes:[t,n]}),ib(e,t,r),e.edgeCount++,n}var i=im(),a=im();return i.checks.push({type:14,node:t,neighbor:a}),ib(e,t,i),a}},{name:"child",separator:!0,regex:ip.child,populate:function(e,t){if(null==e.currentSubject){var r=im(),n=im(),i=e[e.length-1];return r.checks.push({type:15,parent:i,child:n}),ib(e,t,r),e.compoundCount++,n}if(e.currentSubject===t){var a=im(),o=e[e.length-1],s=im(),l=im(),u=im(),c=im();return a.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],c.checks.push({type:20}),s.checks.push({type:17,parent:c,child:u}),ib(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=im(),d=im(),f=[{type:17,parent:h,child:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"descendant",separator:!0,regex:ip.descendant,populate:function(e,t){if(null==e.currentSubject){var r=im(),n=im(),i=e[e.length-1];return r.checks.push({type:16,ancestor:i,descendant:n}),ib(e,t,r),e.compoundCount++,n}if(e.currentSubject===t){var a=im(),o=e[e.length-1],s=im(),l=im(),u=im(),c=im();return a.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],c.checks.push({type:20}),s.checks.push({type:18,ancestor:c,descendant:u}),ib(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=im(),d=im(),f=[{type:18,ancestor:h,descendant:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"subject",modifier:!0,regex:ip.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return te("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var r=e[e.length-1].checks[0],n=null==r?null:r.type;11===n?r.type=13:10===n&&(r.type=14,r.node=r.nodes[1],r.neighbor=r.nodes[0],r.nodes=null)}}];iA.forEach(function(e){return e.regexObj=RegExp("^"+e.regex)});var iC=function(e){for(var t,r,n,i=0;i<iA.length;i++){var a=iA[i],o=a.name,s=e.match(a.regexObj);if(null!=s){r=s,t=a,n=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:r,name:n,remaining:e}},i_=function(e){var t=e.match(/^\s+/);if(t){var r=t[0];e=e.substring(r.length)}return e},iS=function(e,t,r){var n,i,a,o=L(e),s=U(e),l=L(r),u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+r),u&&(e=i=i.toLowerCase(),r=a=a.toLowerCase()),t){case"*=":n=i.indexOf(a)>=0;break;case"$=":n=i.indexOf(a,i.length-a.length)>=0;break;case"^=":n=0===i.indexOf(a);break;case"=":n=e===r;break;case">":h=!0,n=e>r;break;case">=":h=!0,n=e>=r;break;case"<":h=!0,n=e<r;break;case"<=":h=!0,n=e<=r;break;default:n=!1}return c&&(null!=e||!h)&&(n=!n),n},iI=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},iT=function(e,t){return e.data(t)},ix=[],iD=function(e,t){return e.checks.every(function(e){return ix[e.type](e,t)})};ix[0]=function(e,t){var r=e.value;return"*"===r||r===t.group()},ix[7]=function(e,t){var r;return r=e.value,iy[r](t)},ix[8]=function(e,t){var r=e.value;return t.id()===r},ix[9]=function(e,t){var r=e.value;return t.hasClass(r)},ix[6]=function(e,t){var r=e.field,n=e.operator,i=e.value;return iS(t[r](),n,i)},ix[3]=function(e,t){var r=e.field,n=e.operator,i=e.value;return iS(iT(t,r),n,i)},ix[5]=function(e,t){var r=e.field,n=e.operator;return iI(iT(t,r),n)},ix[4]=function(e,t){var r=e.field;return e.operator,void 0!==iT(t,r)},ix[10]=function(e,t){var r=e.nodes[0],n=e.nodes[1],i=t.source(),a=t.target();return iD(r,i)&&iD(n,a)||iD(n,i)&&iD(r,a)},ix[14]=function(e,t){return iD(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&iD(e.neighbor,t)})},ix[11]=function(e,t){return iD(e.source,t.source())&&iD(e.target,t.target())},ix[12]=function(e,t){return iD(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&iD(e.target,t)})},ix[13]=function(e,t){return iD(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&iD(e.source,t)})},ix[15]=function(e,t){return iD(e.child,t)&&iD(e.parent,t.parent())},ix[17]=function(e,t){return iD(e.parent,t)&&t.children().some(function(t){return iD(e.child,t)})},ix[16]=function(e,t){return iD(e.descendant,t)&&t.ancestors().some(function(t){return iD(e.ancestor,t)})},ix[18]=function(e,t){return iD(e.ancestor,t)&&t.descendants().some(function(t){return iD(e.descendant,t)})},ix[19]=function(e,t){return iD(e.subject,t)&&iD(e.left,t)&&iD(e.right,t)},ix[20]=function(){return!0},ix[1]=function(e,t){return e.value.has(t)},ix[2]=function(e,t){return(0,e.value)(t)};var iN=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||L(e)&&e.match(/^\s*$/)||(H(e)?this.addQuery({checks:[{type:1,value:e.collection()}]}):k(e)?this.addQuery({checks:[{type:2,value:e}]}):L(e)?this.parse(e)||(this.invalid=!0):e7("A selector must be created from a string; found "))},iM=iN.prototype;[{parse:function(e){var t=this.inputText=e,r=this[0]=im();for(this.length=1,t=i_(t);;){var n=iC(t);if(null==n.expr)return te("The selector `"+e+"`is invalid"),!1;var i=n.match.slice(1),a=n.expr.populate(this,r,i);if(!1===a)return!1;if(null!=a&&(r=a),(t=n.remaining).match(/^\s*$/))break}var o=this[this.length-1];null!=this.currentSubject&&(o.subject=this.currentSubject),o.edgeCount=this.edgeCount,o.compoundCount=this.compoundCount;for(var s=0;s<this.length;s++){var l=this[s];if(l.compoundCount>0&&l.edgeCount>0)return te("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return te("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&te("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return L(t)?'"'+t+'"':e(t)},r=function(e){return" "+e+" "},n=function(n,a){var o=n.type,s=n.value;switch(o){case 0:var l=e(s);return l.substring(0,l.length-1);case 3:return"["+n.field+r(e(n.operator))+t(s)+"]";case 5:var u=n.operator,c=n.field;return"["+e(u)+c+"]";case 4:return"["+n.field+"]";case 6:var h=n.operator;return"[["+n.field+r(e(h))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return i(n.parent,a)+r(">")+i(n.child,a);case 18:case 16:return i(n.ancestor,a)+" "+i(n.descendant,a);case 19:var d=i(n.left,a),f=i(n.subject,a),g=i(n.right,a);return d+(d.length>0?" ":"")+f+g;case 20:return""}},i=function(e,t){return e.checks.reduce(function(r,i,a){return r+(t===e&&0===a?"$":"")+n(i,t)},"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},{matches:function(e){for(var t=0;t<this.length;t++)if(iD(this[t],e))return!0;return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&8===t[0].checks[0].type)return e.getElementById(t[0].checks[0].value).collection();var r=function(e){for(var r=0;r<t.length;r++)if(iD(t[r],e))return!0;return!1};return null==t.text()&&(r=function(){return!0}),e.filter(r)}}].forEach(function(e){return eo(iM,e)}),iM.text=function(){return this.inputText},iM.size=function(){return this.length},iM.eq=function(e){return this[e]},iM.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},iM.addQuery=function(e){this[this.length++]=e},iM.selector=iM.toString;var iR={allAre:function(e){var t=new iN(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new iN(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var r=0;r<this.length;r++)if(t?e.apply(t,[this[r],r,this]):e(this[r],r,this))return!0;return!1},every:function(e,t){for(var r=0;r<this.length;r++)if(!(t?e.apply(t,[this[r],r,this]):e(this[r],r,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};iR.allAreNeighbours=iR.allAreNeighbors,iR.has=iR.contains,iR.equal=iR.equals=iR.same;var iO=function(e,t){return function(r,n,i,a){if(null==r?o="":H(r)&&1===r.length&&(o=r.id()),1!==this.length||!o)return e.call(this,r,n,i,a);var o,s=this[0]._private,l=s.traversalCache=s.traversalCache||{},u=l[t]=l[t]||[],c=eK(o),h=u[c];return h||(u[c]=e.call(this,r,n,i,a))}},iP={parent:function(e){var t=[];if(1===this.length){var r=this[0]._private.parent;if(r)return r}for(var n=0;n<this.length;n++){var i=this[n]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],r=this.parent();r.nonempty();){for(var n=0;n<r.length;n++){var i=r[n];t.push(i)}r=r.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,r=0;r<this.length;r++){var n=this[r].parents();t=(t=t||n).intersect(n)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:iO(function(e){for(var t=[],r=0;r<this.length;r++)for(var n=this[r]._private.children,i=0;i<n.length;i++)t.push(n[i]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return!function e(r){for(var n=0;n<r.length;n++){var i=r[n];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function iB(e,t,r,n){for(var i=[],a=new tg,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];r?i.push(l):o&&n(i,a,l)}for(;i.length>0;){var u=i.shift();t(u),a.add(u.id()),o&&n(i,a,u)}return e}function iL(e,t,r){if(r.isParent())for(var n=r._private.children,i=0;i<n.length;i++){var a=n[i];t.has(a.id())||e.push(a)}}function ik(e,t,r){if(r.isChild()){var n=r._private.parent;t.has(n.id())||e.push(n)}}function iF(e,t,r){ik(e,t,r),iL(e,t,r)}iP.forEachDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iB(this,e,t,iL)},iP.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iB(this,e,t,ik)},iP.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iB(this,e,t,iF)},iP.ancestors=iP.parents,(y=w={data:ih.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:ih.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ih.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ih.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ih.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ih.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=y.data,y.removeAttr=y.removeData;var iz={};function iU(e){return function(t){if(void 0===t&&(t=!0),0!==this.length)if(!this.isNode()||this.removed())return;else{for(var r=0,n=this[0],i=n._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(r+=e(n,o))}return r}}}function iV(e,t){return function(r){for(var n,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](r);void 0!==o&&(void 0===n||t(o,n))&&(n=o)}return n}}eo(iz,{degree:iU(function(e,t){return t.source().same(t.target())?2:1}),indegree:iU(function(e,t){return+!!t.target().same(e)}),outdegree:iU(function(e,t){return+!!t.source().same(e)})}),eo(iz,{minDegree:iV("degree",function(e,t){return e<t}),maxDegree:iV("degree",function(e,t){return e>t}),minIndegree:iV("indegree",function(e,t){return e<t}),maxIndegree:iV("indegree",function(e,t){return e>t}),minOutdegree:iV("outdegree",function(e,t){return e<t}),maxOutdegree:iV("outdegree",function(e,t){return e>t})}),eo(iz,{totalDegree:function(e){for(var t=0,r=this.nodes(),n=0;n<r.length;n++)t+=r[n].degree(e);return t}});var iH=function(e,t,r){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};i.isParent()&&(0!==o.x||0!==o.y)&&i.children().shift(o,r),i.dirtyBoundingBoxCache()}}},ij={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){iH(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(E=b={position:ih.data(ij),silentPosition:ih.data(eo({},ij,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){iH(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(z(e))t?this.silentPosition(e):this.position(e);else if(k(e)){var r=this.cy();r.startBatch();for(var n=0;n<this.length;n++){var i=this[n],a=void 0;(a=e(i,n))&&(t?i.silentPosition(a):i.position(a))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,r){var n;if(z(e)?(n={x:U(e.x)?e.x:0,y:U(e.y)?e.y:0},r=t):L(e)&&U(t)&&((n={x:0,y:0})[e]=t),null!=n){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+n.x,y:s.y+n.y};r?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return z(e)?this.shift(e,!0):L(e)&&U(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var r=this[0],n=this.cy(),i=n.zoom(),a=n.pan(),o=z(e)?e:void 0,s=void 0!==o||void 0!==t&&L(e);if(r&&r.isNode())if(!s)return(o=tI(r.position(),i,a),void 0===e)?o:o[e];else for(var l=0;l<this.length;l++){var u=this[l];void 0!==t?u.position(e,(t-a[e])/i):void 0!==o&&u.position(tT(o,i,a))}else if(!s)return;return this},relativePosition:function(e,t){var r=this[0],n=this.cy(),i=z(e)?e:void 0,a=void 0!==i||void 0!==t&&L(e),o=n.hasCompoundNodes();if(r&&r.isNode())if(a)for(var s=0;s<this.length;s++){var l=this[s],u=o?l.parent():null,c=u&&u.length>0;c&&(u=u[0]);var h=c?u.position():{x:0,y:0};void 0!==t?l.position(e,t+h[e]):void 0!==i&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=r.position(),f=o?r.parent():null,g=f&&f.length>0;g&&(f=f[0]);var p=g?f.position():{x:0,y:0};return(i={x:d.x-p.x,y:d.y-p.y},void 0===e)?i:i[e]}else if(!a)return;return this}}).modelPosition=E.point=E.position,E.modelPositions=E.points=E.positions,E.renderedPoint=E.renderedPosition,E.relativePoint=E.relativePosition,A=C={},C.renderedBoundingBox=function(e){var t=this.boundingBox(e),r=this.cy(),n=r.zoom(),i=r.pan(),a=t.x1*n+i.x,o=t.x2*n+i.x,s=t.y1*n+i.y,l=t.y2*n+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},C.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()&&this.forEachUp(function(t){if(t.isParent()){var r=t._private;r.compoundBoundsClean=!1,r.bbCache=null,e||t.emitAndNotify("bounds")}}),this},C.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;for(var r=0;r<this.length;r++){var n=this[r],i=n._private;(!i.compoundBoundsClean||e)&&(!function(e){if(e.isParent()){var t=e._private,r=e.children(),n="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=r.boundingBox({includeLabels:n,includeOverlays:!1,useCache:!1}),o=t.position;(0===a.w||0===a.h)&&((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,f=h.biasComplementDiff,g=y(i.height.val-a.h,u,c),p=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=function(e,t,r,n){if("%"===r.units)switch(n){case"width":return e>0?r.pfValue*e:0;case"height":return t>0?r.pfValue*t:0;case"average":return e>0&&t>0?r.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?r.pfValue*t:r.pfValue*e:0;case"max":return e>0&&t>0?e>t?r.pfValue*e:r.pfValue*t:0;default:return 0}return"px"===r.units?r.pfValue:0}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-p+a.y1+a.y2+v)/2}function y(e,t,r){var n=0,i=0,a=t+r;return e>0&&a>0&&(n=t/a*e,i=r/a*e),{biasDiff:n,biasComplementDiff:i}}}(n),t.batching()||(i.compoundBoundsClean=!0))}return this};var iY=function(e){return e===1/0||e===-1/0?0:e},iX=function(e,t,r,n,i){n-t==0||i-r==0||null!=t&&null!=r&&null!=n&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=r<e.y1?r:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},iG=function(e,t){return null==t?e:iX(e,t.x1,t.y1,t.x2,t.y2)},iW=function(e,t,r){return tu(e,t,r)},iq=function(e,t,r){if(!t.cy().headless()){var n,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(r+"-arrow-shape").value){"source"===r?(n=o.srcX,i=o.srcY):"target"===r?(n=o.tgtX,i=o.tgtY):(n=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[r]=l[r]||{};u.x1=n-s,u.y1=i-s,u.x2=n+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,tW(u,1),iX(e,u.x1,u.y1,u.x2,u.y2)}}},iZ=function(e,t,r){if(!t.cy().headless()){a=r?r+"-":"";var n=t._private,i=n.rstyle;if(t.pstyle(a+"label").strValue){var a,o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=iW(i,"labelWidth",r),f=iW(i,"labelHeight",r),g=iW(i,"labelX",r),p=iW(i,"labelY",r),v=t.pstyle(a+"text-margin-x").pfValue,y=t.pstyle(a+"text-margin-y").pfValue,w=t.isEdge(),E=t.pstyle(a+"text-rotation"),b=t.pstyle("text-outline-width").pfValue,A=t.pstyle("text-border-width").pfValue/2,C=t.pstyle("text-background-padding").pfValue,_=d/2,S=f/2;if(w)o=g-_,s=g+_,l=p-S,u=p+S;else{switch(c.value){case"left":o=g-d,s=g;break;case"center":o=g-_,s=g+_;break;case"right":o=g,s=g+d}switch(h.value){case"top":l=p-f,u=p;break;case"center":l=p-S,u=p+S;break;case"bottom":l=p,u=p+f}}o+=v-Math.max(b,A)-C-2,s+=v+Math.max(b,A)+C+2,l+=y-Math.max(b,A)-C-2,u+=y+Math.max(b,A)+C+2;var I=r||"main",T=n.labelBounds,x=T[I]=T[I]||{};x.x1=o,x.y1=l,x.x2=s,x.y2=u,x.w=s-o,x.h=u-l;var D=w&&"autorotate"===E.strValue,N=null!=E.pfValue&&0!==E.pfValue;if(D||N){var M=D?iW(n.rstyle,"labelAngle",r):E.pfValue,R=Math.cos(M),O=Math.sin(M),P=(o+s)/2,B=(l+u)/2;if(!w){switch(c.value){case"left":P=s;break;case"right":P=o}switch(h.value){case"top":B=u;break;case"bottom":B=l}}var L=function(e,t){return{x:(e-=P)*R-(t-=B)*O+P,y:e*O+t*R+B}},k=L(o,l),F=L(o,u),z=L(s,l),U=L(s,u);o=Math.min(k.x,F.x,z.x,U.x),s=Math.max(k.x,F.x,z.x,U.x),l=Math.min(k.y,F.y,z.y,U.y),u=Math.max(k.y,F.y,z.y,U.y)}var V=I+"Rot",H=T[V]=T[V]||{};H.x1=o,H.y1=l,H.x2=s,H.y2=u,H.w=s-o,H.h=u-l,iX(e,o,l,s,u),iX(n.labelBounds.all,o,l,s,u)}return e}},iQ=function(e,t){if(!t.cy().headless()){var r=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(r>0&&n>0){var i=t.pstyle("outline-offset").value,a=t.pstyle("shape").value,o=n+i,s=(e.w+2*o)/e.w,l=(e.h+2*o)/e.h,u=0;["diamond","pentagon","round-triangle"].includes(a)?(s=(e.w+2.4*o)/e.w,u=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(a)?s=(e.w+2.4*o)/e.w:"star"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.6*o)/e.h,u=-o/3.8):"triangle"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.4*o)/e.h,u=-o/1.4):"vee"===a&&(s=(e.w+4.4*o)/e.w,l=(e.h+3.8*o)/e.h,u=-(.5*o));var c=e.h*l-e.h,h=e.w*s-e.w;if(tq(e,[Math.ceil(c/2),Math.ceil(h/2)]),0!==u){var d,f=(d=u,{x1:e.x1+0,x2:e.x2+0,y1:e.y1+d,y2:e.y2+d,w:e.w,h:e.h});tX(e,f)}}}},iK=function(e,t){var r=e._private.cy,n=r.styleEnabled(),i=r.headless(),a=tj(),o=e._private,s=e.isNode(),l=e.isEdge(),u=o.rstyle,c=s&&n?e.pstyle("bounds-expansion").pfValue:[0],h=function(e){return"none"!==e.pstyle("display").value},d=!n||h(e)&&(!l||h(e.source())&&h(e.target()));if(d){var f=0;n&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(f=e.pstyle("overlay-padding").value);var g=0;n&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(g=e.pstyle("underlay-padding").value);var p=Math.max(f,g),v=0;if(n&&(v=e.pstyle("width").pfValue/2),s&&t.includeNodes){var y=e.position();S=y.x,I=y.y;var w=e.outerWidth()/2,E=e.outerHeight()/2;b=S-w,A=S+w,iX(a,b,C=I-E,A,_=I+E),n&&t.includeOutlines&&iQ(a,e)}else if(l&&t.includeEdges)if(n&&!i){var b,A,C,_,S,I,T,x=e.pstyle("curve-style").strValue;if(b=Math.min(u.srcX,u.midX,u.tgtX),A=Math.max(u.srcX,u.midX,u.tgtX),C=Math.min(u.srcY,u.midY,u.tgtY),_=Math.max(u.srcY,u.midY,u.tgtY),b-=v,A+=v,iX(a,b,C-=v,A,_+=v),"haystack"===x){var D=u.haystackPts;if(D&&2===D.length){if(b=D[0].x,C=D[0].y,A=D[1].x,_=D[1].y,b>A){var N=b;b=A,A=N}if(C>_){var M=C;C=_,_=M}iX(a,b-v,C-v,A+v,_+v)}}else if("bezier"===x||"unbundled-bezier"===x||"segments"===x||"taxi"===x){switch(x){case"bezier":case"unbundled-bezier":T=u.bezierPts;break;case"segments":case"taxi":T=u.linePts}if(null!=T)for(var R=0;R<T.length;R++){var O=T[R];b=O.x-v,A=O.x+v,iX(a,b,C=O.y-v,A,_=O.y+v)}}}else{var P=e.source().position(),B=e.target().position();if(b=P.x,A=B.x,C=P.y,_=B.y,b>A){var L=b;b=A,A=L}if(C>_){var k=C;C=_,_=k}b-=v,A+=v,iX(a,b,C-=v,A,_+=v)}if(n&&t.includeEdges&&l&&(iq(a,e,"mid-source"),iq(a,e,"mid-target"),iq(a,e,"source"),iq(a,e,"target")),n&&"yes"===e.pstyle("ghost").value){var F=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;iX(a,a.x1+F,a.y1+z,a.x2+F,a.y2+z)}var U=o.bodyBounds=o.bodyBounds||{};tZ(U,a),tq(U,c),tW(U,1),n&&(b=a.x1,A=a.x2,C=a.y1,_=a.y2,iX(a,b-p,C-p,A+p,_+p));var V=o.overlayBounds=o.overlayBounds||{};tZ(V,a),tq(V,c),tW(V,1);var H=o.labelBounds=o.labelBounds||{};null!=H.all?tY(H.all):H.all=tj(),n&&t.includeLabels&&(t.includeMainLabels&&iZ(a,e,null),l&&(t.includeSourceLabels&&iZ(a,e,"source"),t.includeTargetLabels&&iZ(a,e,"target")))}return a.x1=iY(a.x1),a.y1=iY(a.y1),a.x2=iY(a.x2),a.y2=iY(a.y2),a.w=iY(a.x2-a.x1),a.h=iY(a.y2-a.y1),a.w>0&&a.h>0&&d&&(tq(a,c),tW(a,1)),a},i$=function(e){var t=0,r=function(e){return!!e<<t++};return 0+r(e.incudeNodes)+r(e.includeEdges)+r(e.includeLabels)+r(e.includeMainLabels)+r(e.includeSourceLabels)+r(e.includeTargetLabels)+r(e.includeOverlays)+r(e.includeOutlines)},iJ=function(e){if(!e.isEdge())return 0;var t=e.source().position(),r=e.target().position(),n=function(e){return Math.round(e)};return eQ([n(t.x),n(t.y),n(r.x),n(r.y)])},i1=function(e,t){var r,n=e._private,i=e.isEdge(),a=null==t?i2:i$(t),o=iJ(e),s=n.bbCachePosKey===o,l=t.useCache&&s,u=function(e){return null==e._private.bbCache||e._private.styleDirty};if(!l||u(e)||i&&u(e.source())||u(e.target())?(s||e.recalculateRenderedStyle(l),n.bbCache=r=iK(e,i0),n.bbCachePosKey=o):r=n.bbCache,a!==i2){var c=e.isNode();r=tj(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?iG(r,n.overlayBounds):iG(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?iG(r,n.labelBounds.all):(t.includeMainLabels&&iG(r,n.labelBounds.mainRot),t.includeSourceLabels&&iG(r,n.labelBounds.sourceRot),t.includeTargetLabels&&iG(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},i0={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},i2=i$(i0),i3=ta(i0);C.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=tj();var r=i3(e=e||i0);if(this.cy().styleEnabled())for(var n=0;n<this.length;n++){var i=this[n],a=i._private,o=iJ(i),s=a.bbCachePosKey===o,l=r.useCache&&s&&!a.styleDirty;i.recalculateRenderedStyle(l)}this.updateCompoundBounds(!e.useCache);for(var u=0;u<this.length;u++)iG(t,i1(this[u],r))}else e=void 0===e?i0:i3(e),t=i1(this[0],e);return t.x1=iY(t.x1),t.y1=iY(t.y1),t.x2=iY(t.x2),t.y2=iY(t.y2),t.w=iY(t.x2-t.x1),t.h=iY(t.y2-t.y1),t},C.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},C.boundingBoxAt=function(e){var t,r=this.nodes(),n=this.cy(),i=n.hasCompoundNodes(),a=n.collection();if(i&&(a=r.filter(function(e){return e.isParent()}),r=r.not(a)),z(e)){var o=e;e=function(){return o}}n.startBatch(),r.forEach(function(t,r){return t._private.bbAtOldPos=e(t,r)}).silentPositions(e),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var s={x1:(t=this.boundingBox({useCache:!1})).x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h};return r.silentPositions(function(e){return e._private.bbAtOldPos}),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),s},A.boundingbox=A.bb=A.boundingBox,A.renderedBoundingbox=A.renderedBoundingBox,_=S={};var i4=function(e){e.uppercaseName=J(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=J(e.outerName),_[e.name]=function(){var t=this[0],r=t._private,n=r.cy._private.styleEnabled;if(t)if(!n)return 1;else{if(t.isParent())return t.updateCompoundBounds(),r[e.autoName]||0;var i=t.pstyle(e.name);return"label"===i.strValue?(t.recalculateRenderedStyle(),r.rstyle[e.labelName]||0):i.pfValue}},_["outer"+e.uppercaseName]=function(){var t=this[0],r=t._private.cy._private.styleEnabled;if(t)if(r)return t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding();else return 1},_["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},_["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};i4({name:"width"}),i4({name:"height"}),S.padding=function(){var e=this[0],t=e._private;return e.isParent()&&(e.updateCompoundBounds(),void 0!==t.autoPadding)?t.autoPadding:e.pstyle("padding").pfValue},S.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},S.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var i8=function(e,t){if(e.isEdge())return t(e)},i6=function(e,t){if(e.isEdge()){var r=e.cy();return tI(t(e),r.zoom(),r.pan())}},i5=function(e,t){if(e.isEdge()){var r=e.cy(),n=r.pan(),i=r.zoom();return t(e).map(function(e){return tI(e,i,n)})}},i7={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},i9=eo({},b,C,S,Object.keys(i7).reduce(function(e,t){var r=i7[t],n="rendered"+t[0].toUpperCase()+t.substr(1);return e[t]=function(){return i8(this,r.get)},r.mult?e[n]=function(){return i5(this,r.get)}:e[n]=function(){return i6(this,r.get)},e},{})),ae=function(e,t){this.recycle(e,t)};function at(){return!1}function ar(){return!0}ae.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=at,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ar:at):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var r=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:r.x*n+i.x,y:r.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ar;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ar;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ar,this.stopPropagation()},isDefaultPrevented:at,isPropagationStopped:at,isImmediatePropagationStopped:at};var an=/^([^.]+)(\.(?:[^.]+))?$/,ai={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},aa=Object.keys(ai),ao={};function as(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ao,t=arguments.length>1?arguments[1]:void 0,r=0;r<aa.length;r++){var n=aa[r];this[n]=e[n]||ai[n]}this.context=t||this.context,this.listeners=[],this.emitting=0}var al=as.prototype,au=function(e,t,r,n,i,a,o){k(n)&&(i=n,n=null),o&&(a=null==a?o:eo({},a,o));for(var s=F(r)?r:r.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!W(u)){var c=u.match(an);if(c&&!1===t(e,u,c[1],c[2]?c[2]:null,n,i,a))break}}},ac=function(e,t){return e.addEventFields(e.context,t),new ae(t.type,t)},ah=function(e,t,r){if("event"===B(r))return void t(e,r);if(z(r))return void t(e,ac(e,r));for(var n=F(r)?r:r.split(/\s+/),i=0;i<n.length;i++){var a=n[i];if(!W(a)){var o=a.match(an);if(o){var s=ac(e,{type:o[1],namespace:o[2]?o[2]:null,target:e.context});t(e,s)}}}};al.on=al.addListener=function(e,t,r,n,i){return au(this,function(e,t,r,n,i,a,o){k(a)&&e.listeners.push({event:t,callback:a,type:r,namespace:n,qualifier:i,conf:o})},e,t,r,n,i),this},al.one=function(e,t,r,n){return this.on(e,t,r,n,{one:!0})},al.removeListener=al.off=function(e,t,r,n){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];au(i,function(t,r,n,i,l,u){if((s.type===n||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1},e,t,r,n)},s=a.length-1;s>=0;s--)o(s);return this},al.removeAllListeners=function(){return this.removeListener("*")},al.emit=al.trigger=function(e,t,r){var n=this.listeners,i=n.length;return this.emitting++,F(t)||(t=[t]),ah(this,function(e,a){null!=r&&(i=(n=[{event:a.event,type:a.type,namespace:a.namespace,callback:r}]).length);for(var o=0;o<i;o++)!function(r){var i=n[r];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&tl(o,t),e.beforeEmit(e.context,i,a),i.conf&&i.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==i}));var s=e.callbackContext(e.context,i,a),l=i.callback.apply(s,o);e.afterEmit(e.context,i,a),!1===l&&(a.stopPropagation(),a.preventDefault())}}(o);e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var ad={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,r){var n=t.qualifier;return null==n||e!==r.target&&j(r.target)&&n.matches(r.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,r){return null!=t.qualifier?r.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},af=function(e){return L(e)?new iN(e):e},ag={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],r=t._private;r.emitter||(r.emitter=new as(ad,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,r){for(var n=af(t),i=0;i<this.length;i++)this[i].emitter().on(e,n,r);return this},removeListener:function(e,t,r){for(var n=af(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,n,r);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,r){for(var n=af(t),i=0;i<this.length;i++)this[i].emitter().one(e,n,r);return this},once:function(e,t,r){for(var n=af(t),i=0;i<this.length;i++)this[i].emitter().on(e,n,r,{once:!0,onceCollection:this})},emit:function(e,t){for(var r=0;r<this.length;r++)this[r].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};ih.eventAliasesOn(ag);var ap={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),r=0;r<this.length;r++){var n=this[r];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(L(e)||H(e))return new iN(e).filter(this);if(k(e)){for(var r=this.spawn(),n=0;n<this.length;n++){var i=this[n];(t?e.apply(t,[i,n,this]):e(i,n,this))&&r.push(i)}return r}return this.spawn()},not:function(e){if(!e)return this;L(e)&&(e=this.filter(e));for(var t=this.spawn(),r=0;r<this.length;r++){var n=this[r];e.has(n)||t.push(n)}return t},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(L(e))return this.filter(e);for(var t=this.spawn(),r=this.length<e.length,n=r?this:e,i=r?e:this,a=0;a<n.length;a++){var o=n[a];i.has(o)&&t.push(o)}return t},xor:function(e){var t=this._private.cy;L(e)&&(e=t.$(e));var r=this.spawn(),n=e,i=function(e,t){for(var n=0;n<e.length;n++){var i=e[n],a=i._private.data.id;t.hasElementWithId(a)||r.push(i)}};return i(this,n),i(n,this),r},diff:function(e){var t=this._private.cy;L(e)&&(e=t.$(e));var r=this.spawn(),n=this.spawn(),i=this.spawn(),a=e,o=function(e,t,r){for(var n=0;n<e.length;n++){var a=e[n],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):r.push(a)}};return o(this,a,r),o(a,this,n),{left:r,right:n,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(L(e)){var r=e;e=t.mutableElements().filter(r)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||n.push(a)}return n},merge:function(e){var t=this._private,r=t.cy;if(!e)return this;if(e&&L(e)){var n=e;e=r.mutableElements().filter(n)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),r=this._private.map;this[e]=void 0,r.delete(t);var n=e===this.length-1;if(this.length>1&&!n){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,r.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,r=e._private.data.id,n=t.map.get(r);if(!n)return this;var i=n.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&L(e)){var r=e;e=t.mutableElements().filter(r)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var r=[],n=0;n<this.length;n++){var i=this[n],a=t?e.apply(t,[i,n,this]):e(i,n,this);r.push(a)}return r},reduce:function(e,t){for(var r=t,n=0;n<this.length;n++)r=e(r,this[n],n,this);return r},max:function(e,t){for(var r,n=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o>n&&(n=o,r=a)}return{value:n,ele:r}},min:function(e,t){for(var r,n=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<n&&(n=o,r=a)}return{value:n,ele:r}}};ap.u=ap["|"]=ap["+"]=ap.union=ap.or=ap.add,ap["\\"]=ap["!"]=ap["-"]=ap.difference=ap.relativeComplement=ap.subtract=ap.not,ap.n=ap["&"]=ap["."]=ap.and=ap.intersection=ap.intersect,ap["^"]=ap["(+)"]=ap["(-)"]=ap.symmetricDifference=ap.symdiff=ap.xor,ap.fnFilter=ap.filterFn=ap.stdFilter=ap.filter,ap.complement=ap.abscomp=ap.absoluteComplement;var am=function(e,t){var r=e.cy().hasCompoundNodes();function n(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?r?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?e3:0}var i=n(e)-n(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value?+!!e.isNode():0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},av={forEach:function(e,t){if(k(e))for(var r=this.length,n=0;n<r;n++){var i=this[n];if(!1===(t?e.apply(t,[i,n,this]):e(i,n,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var r=[],n=this.length;null==t&&(t=n),null==e&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var i=e;i>=0&&i<t&&i<n;i++)r.push(this[i]);return this.spawn(r)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!k(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(am)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var r=t.data.parent?e.parents().size():0;return e.isParent()?r:e3-1}var n=t.source,i=t.target;return Math.max(n.zDepth(),i.zDepth(),0)}}};av.each=av.forEach,("u"<typeof Symbol?"undefined":e(Symbol))!="undefined"&&"undefined"!=e(Symbol.iterator)&&(av[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},r=0,n=this.length;return a({next:function(){return r<n?t.value=e[r++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var ay=ta({nodeDimensionsIncludeLabels:!1}),aw={layoutDimensions:function(e){if(e=ay(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var t,r=this.boundingBox();t={w:r.w,h:r.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return(0===t.w||0===t.h)&&(t.w=t.h=1),t},layoutPositions:function(e,t,r){var n=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=Z(r,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,r){var n={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(r.x-n.x)*e,y:(r.y-n.y)*e};return{x:n.x+i.x,y:n.y+i.y}},u=t.spacingFactor&&1!==t.spacingFactor,c=function(){if(!u)return null;for(var e=tj(),t=0;t<n.length;t++){var r=s(n[t],t);tG(e,r.x,r.y)}return e}(),h=Z(function(e,r){var n=s(e,r);return u&&(n=l(Math.abs(t.spacingFactor),c,n)),null!=t.transform&&(n=t.transform(e,n)),n},o);if(t.animate){for(var d=0;d<n.length;d++){var f=n[d],g=h(f,d);if(null==t.animateFilter||t.animateFilter(f,d)){var p=f.animation({position:g,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(p)}else f.position(g)}if(t.fit){var v=i.animation({fit:{boundingBox:a.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else if(void 0!==t.zoom&&void 0!==t.pan){var y=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}e.animations.forEach(function(e){return e.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),nE.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(h),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(eo({},e,{eles:this}))}};function aE(e,t,r){var n,i=r._private,a=i.styleCache=i.styleCache||[];return null!=(n=a[e])?n:n=a[e]=t(r)}function ab(e,t){return e=eK(e),function(r){return aE(e,t,r)}}function aA(e,t){e=eK(e);var r=function(e){return t.call(e)};return function(){var t=this[0];if(t)return aE(e,r,t)}}aw.createLayout=aw.makeLayout=aw.layout;var aC={recalculateRenderedStyle:function(e){var t=this.cy(),r=t.renderer(),n=t.styleEnabled();return r&&n&&r.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),r=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(r)):this.forEach(function(e){r(e),e.connectedEdges().forEach(r)}),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var r=t.hasCompoundNodes(),n=this;e=!!e||void 0===e,r&&(n=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=n;return e?i.emitAndNotify("style"):i.emit("style"),n.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var r=this[t];r._private.styleDirty&&(r._private.styleDirty=!1,e.style().apply(r))}},parsedStyle:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=this[0],n=r.cy();if(n.styleEnabled()&&r){this.cleanStyle();var i=r._private.style[e];return null!=i?i:t?n.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var r=t.pstyle(e);return void 0!==r.pfValue?r.pfValue:r.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var r=this[0];if(r)return t.style().getRenderedStyle(r,e)},style:function(e,t){var r=this.cy();if(!r.styleEnabled())return this;var n=r.style();if(z(e))n.applyBypass(this,e,!1),this.emitAndNotify("style");else if(L(e))if(void 0===t){var i=this[0];return i?n.getStylePropertyValue(i,e):void 0}else n.applyBypass(this,e,t,!1),this.emitAndNotify("style");else if(void 0===e){var a=this[0];return a?n.getRawStyle(a):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var r=t.style();if(void 0===e)for(var n=0;n<this.length;n++){var i=this[n];r.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];r.removeBypasses(o,e,!1)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),r=this[0];if(r){var n=r._private,i=r.pstyle("opacity").value;if(!t)return i;var a=n.data.parent?r.parents():null;if(a)for(var o=0;o<a.length;o++)i*=a[o].pstyle("opacity").value;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)if(!t)return 0===e.pstyle("opacity").value;else return 0===e.effectiveOpacity()},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function a_(e,t){var r=e._private.data.parent?e.parents():null;if(r){for(var n=0;n<r.length;n++)if(!t(r[n]))return!1}return!0}function aS(e){var t=e.ok,r=e.edgeOkViaNode||e.ok,n=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||a_(i,n);var s=o.source,l=o.target;return r(s)&&(!a||a_(s,r))&&(s===l||r(l)&&(!a||a_(l,r)))}}}var aI=ab("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});aC.takesUpSpace=aA("takesUpSpace",aS({ok:aI})),aC.interactive=aA("interactive",aS({ok:ab("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&aI(e)}),parentOk:ab("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&aI(e)}),edgeOkViaNode:aI})),aC.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},aC.visible=aA("visible",aS({ok:ab("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&aI(e)}),edgeOkViaNode:aI})),aC.hidden=function(){var e=this[0];if(e)return!e.visible()},aC.isBundledBezier=aA("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),aC.bypass=aC.css=aC.style,aC.renderedCss=aC.renderedStyle,aC.removeBypass=aC.removeCss=aC.removeStyle,aC.pstyle=aC.parsedStyle;var aT={};function ax(e){return function(){var t=arguments,r=[];if(2===t.length){var n=t[0],i=t[1];this.on(e.event,n,i)}else if(1===t.length&&k(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&F(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(l);if(void 0!==h&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&r.push(l))}var d=this.spawn(r);d.updateStyle(),d.emit(e.event),o&&d.emit(o)}return this}}function aD(e){aT[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var r=e.overrideField(t);if(void 0!==r)return r}return t._private[e.field]}},aT[e.on]=ax({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),aT[e.off]=ax({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}aD({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),aD({field:"grabbable",overrideField:function(e){return!(e.cy().autoungrabify()||e.pannable())&&void 0},on:"grabify",off:"ungrabify"}),aD({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),aD({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),aT.deselect=aT.unselect,aT.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},aD({field:"active",on:"activate",off:"unactivate"}),aD({field:"pannable",on:"panify",off:"unpanify"}),aT.inactive=function(){var e=this[0];if(e)return!e._private.active};var aN={},aM=function(e){return function(t){for(var r=[],n=0;n<this.length;n++){var i=this[n];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===i&&u!==i||e.noOutgoingEdges&&u===i&&c!==i){a=!0;break}}a||r.push(i)}}return this.spawn(r,!0).filter(t)}},aR=function(e){return function(t){for(var r=[],n=0;n<this.length;n++){var i=this[n];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target();e.outgoing&&l===i?(r.push(s),r.push(u)):e.incoming&&u===i&&(r.push(s),r.push(l))}}return this.spawn(r,!0).filter(t)}},aO=function(e){return function(t){for(var r=this,n=[],i={};;){var a=e.outgoing?r.outgoers():r.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,n.push(l),o=!0)}if(!o)break;r=a}return this.spawn(n,!0).filter(t)}};function aP(e){return function(t){for(var r=[],n=0;n<this.length;n++){var i=this[n]._private[e.attr];i&&r.push(i)}return this.spawn(r,!0).filter(t)}}function aB(e){return function(t){var r=[],n=this._private.cy,i=e||{};L(t)&&(t=n.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||h){if((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!c||i.thisIsTgt&&!h))continue;r.push(l)}}return this.spawn(r,!0)}}function aL(e){return e=eo({},{codirected:!1},e),function(t){for(var r=[],n=this.edges(),i=e,a=0;a<n.length;a++)for(var o=n[a]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,h=0;h<c.length;h++){var d=c[h],f=d._private.data,g=f.target,p=f.source,v=g===u&&p===l,y=l===g&&u===p;(i.codirected&&v||!i.codirected&&(v||y))&&r.push(d)}return this.spawn(r,!0).filter(t)}}aN.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},eo(aN,{roots:aM({noIncomingEdges:!0}),leaves:aM({noOutgoingEdges:!0}),outgoers:iO(aR({outgoing:!0}),"outgoers"),successors:aO({outgoing:!0}),incomers:iO(aR({incoming:!0}),"incomers"),predecessors:aO({incoming:!0})}),eo(aN,{neighborhood:iO(function(e){for(var t=[],r=this.nodes(),n=0;n<r.length;n++)for(var i=r[n],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target(),c=i===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),aN.neighbourhood=aN.neighborhood,aN.closedNeighbourhood=aN.closedNeighborhood,aN.openNeighbourhood=aN.openNeighborhood,eo(aN,{source:iO(function(e){var t,r=this[0];return r&&(t=r._private.source||r.cy().collection()),t&&e?t.filter(e):t},"source"),target:iO(function(e){var t,r=this[0];return r&&(t=r._private.target||r.cy().collection()),t&&e?t.filter(e):t},"target"),sources:aP({attr:"source"}),targets:aP({attr:"target"})}),eo(aN,{edgesWith:iO(aB(),"edgesWith"),edgesTo:iO(aB({thisIsSrc:!0}),"edgesTo")}),eo(aN,{connectedEdges:iO(function(e){for(var t=[],r=0;r<this.length;r++){var n=this[r];if(n.isNode())for(var i=n._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:iO(function(e){for(var t=[],r=0;r<this.length;r++){var n=this[r];n.isEdge()&&(t.push(n.source()[0]),t.push(n.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:iO(aL(),"parallelEdges"),codirectedEdges:iO(aL({codirected:!0}),"codirectedEdges")}),eo(aN,{components:function(e){var t=this,r=t.cy(),n=r.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){n.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();do!function(){var e=r.collection();a.push(e);var n=i[0];o(n,e),t.bfs({directed:!1,roots:n,visit:function(t){return o(t,e)}}),e.forEach(function(r){r.connectedEdges().forEach(function(r){t.has(r)&&e.has(r.source())&&e.has(r.target())&&e.merge(r)})})}();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),aN.componentsOf=aN.components;var ak=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e)return void e7("A collection must have a reference to the core");var i=new td,a=!1;if(t){if(t.length>0&&z(t[0])&&!j(t[0])){a=!0;for(var o=[],s=new tg,l=0,u=t.length;l<u;l++){var c=t[l];null==c.data&&(c.data={});var h=c.data;if(null==h.id)h.id=tr();else if(e.hasElementWithId(h.id)||s.has(h.id))continue;var d=new tp(e,c,!1);o.push(d),s.add(h.id)}t=o}}else t=[];this.length=0;for(var f=0,g=t.length;f<g;f++){var p=t[f][0];if(null!=p){var v=p._private.data.id;(!r||!i.has(v))&&(r&&i.set(v,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var e=this.lazyMap=new td,t=this.eles,r=0;r<t.length;r++){var n=t[r];e.set(n.id(),{index:r,ele:n})}}},r&&(this._private.map=i),a&&!n&&this.restore()},aF=tp.prototype=ak.prototype=Object.create(Array.prototype);aF.instanceString=function(){return"collection"},aF.spawn=function(e,t){return new ak(this.cy(),e,t)},aF.spawnSelf=function(){return this.spawn(this)},aF.cy=function(){return this._private.cy},aF.renderer=function(){return this._private.cy.renderer()},aF.element=function(){return this[0]},aF.collection=function(){return Y(this)?this:new ak(this._private.cy,[this])},aF.unique=function(){return new ak(this._private.cy,this,!0)},aF.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},aF.getElementById=function(e){e=""+e;var t=this._private.cy,r=this._private.map.get(e);return r?r.ele:new ak(t)},aF.$id=aF.getElementById,aF.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},aF.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},aF.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},aF.json=function(e){var t=this.element(),r=this.cy();if(null==t&&e)return this;if(null!=t){var n=t._private;if(z(e)){if(r.startBatch(),e.data){t.data(e.data);var i=n.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;u&&(null!=c||null!=i.parent)&&c!=i.parent&&(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(r,i,a){var o=e[r];null!=o&&o!==n[r]&&(o?t[i]():t[a]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),r.endBatch(),this}if(void 0===e){var d={data:tt(n.data),position:tt(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};d.classes="";var f=0;return n.classes.forEach(function(e){return d.classes+=0==f++?e:" "+e}),d}}},aF.jsons=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t].json();e.push(r)}return e},aF.clone=function(){for(var e=this.cy(),t=[],r=0;r<this.length;r++){var n=new tp(e,this[r].json(),!1);t.push(n)}return new ak(e,t)},aF.copy=aF.clone,aF.restore=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=this.cy(),n=r._private,i=[],a=[],o=0,s=this.length;o<s;o++){var l=this[o];(!t||l.removed())&&(l.isNode()?i.push(l):a.push(l))}M=i.concat(a);var u=function(){M.splice(R,1),R--};for(R=0;R<M.length;R++){var c=M[R],h=c._private,d=h.data;if(c.clearTraversalCache(),t||h.removed){if(void 0===d.id)d.id=tr();else if(U(d.id))d.id=""+d.id;else if(W(d.id)||!L(d.id)){e7("Can not create element with invalid string ID `"+d.id+"`"),u();continue}else if(r.hasElementWithId(d.id)){e7("Can not create second element with ID `"+d.id+"`"),u();continue}}var f=d.id;if(c.isNode()){var g=h.position;null==g.x&&(g.x=0),null==g.y&&(g.y=0)}if(c.isEdge()){for(var p=["source","target"],v=p.length,y=!1,w=0;w<v;w++){var E=p[w],b=d[E];U(b)&&(b=d[E]=""+d[E]),null==b||""===b?(e7("Can not create edge `"+f+"` with unspecified "+E),y=!0):r.hasElementWithId(b)||(e7("Can not create edge `"+f+"` with nonexistant "+E+" `"+b+"`"),y=!0)}if(y){u();continue}var A=r.getElementById(d.source),C=r.getElementById(d.target);A.same(C)?A._private.edges.push(c):(A._private.edges.push(c),C._private.edges.push(c)),c._private.source=A,c._private.target=C}h.map=new td,h.map.set(f,{ele:c,index:0}),h.removed=!1,t&&r.addToPool(c)}for(var _=0;_<i.length;_++){var S=i[_],I=S._private.data;U(I.parent)&&(I.parent=""+I.parent);var T=I.parent;if(null!=T||S._private.parent){var x=S._private.parent?r.collection().merge(S._private.parent):r.getElementById(T);if(x.empty())I.parent=void 0;else if(x[0].removed())te("Node added with missing parent, reference to parent removed"),I.parent=void 0,S._private.parent=null;else{for(var D=!1,N=x;!N.empty();){if(S.same(N)){D=!0,I.parent=void 0;break}N=N.parent()}D||(x[0]._private.children.push(S),S._private.parent=x[0],n.hasCompoundNodes=!0)}}}if(M.length>0){for(var M,R,O,P=M.length===this.length?this:new ak(r,M),B=0;B<P.length;B++){var k=P[B];k.isNode()||(k.parallelEdges().clearTraversalCache(),k.source().clearTraversalCache(),k.target().clearTraversalCache())}(n.hasCompoundNodes?r.collection().merge(P).merge(P.connectedNodes()).merge(P.parent()):P).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?P.emitAndNotify("add"):t&&P.emit("add")}return this},aF.removed=function(){var e=this[0];return e&&e._private.removed},aF.inside=function(){var e=this[0];return e&&!e._private.removed},aF.remove=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=[],n={},i=this._private.cy,a=0,o=this.length;a<o;a++)!function e(i){var a=n[i.id()];if(!(t&&i.removed())&&!a)if(n[i.id()]=!0,i.isNode()){r.push(i);for(var o=i._private.edges,s=0;s<o.length;s++)e(o[s]);for(var l=i._private.children,u=0;u<l.length;u++)e(l[u])}else r.unshift(i)}(this[a]);function s(e,t){to(e._private.edges,t),e.clearTraversalCache()}var l=[];l.ids={},this.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var u=0;u<r.length;u++){var c=r[u];if(c.isEdge()){var h=c.source()[0],d=c.target()[0];s(h,c),s(d,c);for(var f=c.parallelEdges(),g=0;g<f.length;g++){var p=f[g];p.clearTraversalCache(),p.isBundledBezier()&&p.dirtyBoundingBoxCache()}}else{var v=c.parent();0!==v.length&&function(e,t){t=t[0];var r=(e=e[0])._private.children,n=e.id();to(r,t),t._private.parent=null,l.ids[n]||(l.ids[n]=!0,l.push(e))}(v,c)}t&&(c._private.removed=!0)}var y=i._private.elements;i._private.hasCompoundNodes=!1;for(var w=0;w<y.length;w++)if(y[w].isParent()){i._private.hasCompoundNodes=!0;break}var E=new ak(this.cy(),r);E.size()>0&&(e?E.emitAndNotify("remove"):t&&E.emit("remove"));for(var b=0;b<l.length;b++){var A=l[b];t&&A.removed()||A.updateStyle()}return E},aF.move=function(e){var t=this._private.cy,r=this,n=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=n(e.source),a=n(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch(function(){r.remove(!1,!1),r.emitAndNotify("moveout");for(var e=0;e<r.length;e++){var t=r[e],n=t._private.data;t.isEdge()&&(o&&(n.source=i),s&&(n.target=a))}r.restore(!1,!1)}),r.emitAndNotify("move"))}else if(void 0!==e.parent){var l=n(e.parent);if(null===l||t.hasElementWithId(l)){var u=null===l?void 0:l;t.batch(function(){var e=r.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<r.length;t++){var n=r[t],i=n._private.data;n.isNode()&&(i.parent=u)}e.restore(!1,!1)}),r.emitAndNotify("move")}}return this},[nf,id,ig,iR,iP,w,iz,i9,ag,ap,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},av,aw,aC,aT,aN].forEach(function(e){eo(aF,e)});var az=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,r,n){var i={x:t.x+n.dx*r,v:t.v+n.dv*r,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}return function r(n,i,a){var o,s,l,u,c,h,d,f,g,p,v,y={x:-1,v:0,tension:null,friction:null},w=[0],E=0;for(n=parseFloat(n)||500,i=parseFloat(i)||20,a=a||null,y.tension=n,y.friction=i,p=(g=null!==a)?(E=r(n,i))/a*.016:.016;o=v||y,s=p,l={dx:o.v,dv:e(o)},u=t(o,.5*s,l),c=t(o,.5*s,u),h=t(o,s,c),d=1/6*(l.dx+2*(u.dx+c.dx)+h.dx),f=1/6*(l.dv+2*(u.dv+c.dv)+h.dv),o.x=o.x+d*s,o.v=o.v+f*s,v=o,w.push(1+v.x),E+=16,Math.abs(v.x)>1e-4&&Math.abs(v.v)>1e-4;);return g?function(e){return w[e*(w.length-1)|0]}:E}}(),aU=function(e,t,r,n){var i=function(e,t,r,n){var i="u">typeof Float32Array;if(4!=arguments.length)return!1;for(var a=0;a<4;++a)if("number"!=typeof arguments[a]||isNaN(arguments[a])||!isFinite(arguments[a]))return!1;e=Math.min(e,1),r=Math.min(r,1),e=Math.max(e,0),r=Math.max(r,0);var o=i?new Float32Array(11):Array(11);function s(e,t,r){return(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e}function l(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}var u=!1,c=function(i){return(u||(u=!0,(e!==t||r!==n)&&function(){for(var t=0;t<11;++t)o[t]=s(.1*t,e,r)}()),e===t&&r===n)?i:0===i?0:1===i?1:s(function(t){for(var n=0,i=1;10!==i&&o[i]<=t;++i)n+=.1;var a=n+(t-o[--i])/(o[i+1]-o[i])*.1,u=l(a,e,r);if(u>=.001){for(var c=a,h=0;h<4;++h){var d=l(c,e,r);if(0===d)break;var f=s(c,e,r)-t;c-=f/d}return c}return 0===u?a:function(t,n,i){var a,o,l=0;do(a=s(o=n+(i-n)/2,e,r)-t)>0?i=o:n=o;while(Math.abs(a)>1e-7&&++l<10);return o}(t,n,n+.1)}(i),t,n)};c.getControlPoints=function(){return[{x:e,y:t},{x:r,y:n}]};var h="generateBezier("+[e,t,r,n]+")";return c.toString=function(){return h},c}(e,t,r,n);return function(e,t,r){return e+(t-e)*i(r)}},aV={linear:function(e,t,r){return e+(t-e)*r},ease:aU(.25,.1,.25,1),"ease-in":aU(.42,0,1,1),"ease-out":aU(0,0,.58,1),"ease-in-out":aU(.42,0,.58,1),"ease-in-sine":aU(.47,0,.745,.715),"ease-out-sine":aU(.39,.575,.565,1),"ease-in-out-sine":aU(.445,.05,.55,.95),"ease-in-quad":aU(.55,.085,.68,.53),"ease-out-quad":aU(.25,.46,.45,.94),"ease-in-out-quad":aU(.455,.03,.515,.955),"ease-in-cubic":aU(.55,.055,.675,.19),"ease-out-cubic":aU(.215,.61,.355,1),"ease-in-out-cubic":aU(.645,.045,.355,1),"ease-in-quart":aU(.895,.03,.685,.22),"ease-out-quart":aU(.165,.84,.44,1),"ease-in-out-quart":aU(.77,0,.175,1),"ease-in-quint":aU(.755,.05,.855,.06),"ease-out-quint":aU(.23,1,.32,1),"ease-in-out-quint":aU(.86,0,.07,1),"ease-in-expo":aU(.95,.05,.795,.035),"ease-out-expo":aU(.19,1,.22,1),"ease-in-out-expo":aU(1,0,0,1),"ease-in-circ":aU(.6,.04,.98,.335),"ease-out-circ":aU(.075,.82,.165,1),"ease-in-out-circ":aU(.785,.135,.15,.86),spring:function(e,t,r){if(0===r)return aV.linear;var n=az(e,t,r);return function(e,t,r){return e+(t-e)*n(r)}},"cubic-bezier":aU};function aH(e,t,r,n,i){if(1===n||t===r)return r;var a=i(t,r,n);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function aj(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function aY(e,t,r,n,i){var a=null!=i?i.type:null;r<0?r=0:r>1&&(r=1);var o=aj(e,i),s=aj(t,i);if(U(o)&&U(s))return aH(a,o,s,r,n);if(F(o)&&F(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],h=s[u];if(null!=c&&null!=h){var d=aH(a,c,h,r,n);l.push(d)}else l.push(h)}return l}}function aX(e,t){return null!=e&&null!=t&&(!!(U(e)&&U(t))||!!e&&!!t)}function aG(e,t){var r=t._private.aniEles,n=[];function i(t,r){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var u=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;if(d.stopped){a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames);continue}(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||function(e,t){var r=e._private;r.started=!0,r.startTime=t-r.progress*r.duration}(h,e),function(e,t,r,n){var i,a,o,s,l=!n,u=e._private,c=t._private,h=c.easing,d=c.startTime,f=(n?e:e.cy()).style();c.easingImpl||(null==h?c.easingImpl=aV.linear:(i=L(h)?f.parse("transition-timing-function",h).value:h,L(i)?(a=i,o=[]):(a=i[1],o=i.slice(2).map(function(e){return+e})),o.length>0?("spring"===a&&o.push(c.duration),c.easingImpl=aV[a].apply(null,o)):c.easingImpl=aV[a]));var g=c.easingImpl;if(s=0===c.duration?1:(r-d)/c.duration,c.applying&&(s=c.progress),s<0?s=0:s>1&&(s=1),null==c.delay){var p=c.startPosition,v=c.position;if(v&&l&&!e.locked()){var y={};aX(p.x,v.x)&&(y.x=aY(p.x,v.x,s,g)),aX(p.y,v.y)&&(y.y=aY(p.y,v.y,s,g)),e.position(y)}var w=c.startPan,E=c.pan,b=u.pan,A=null!=E&&n;A&&(aX(w.x,E.x)&&(b.x=aY(w.x,E.x,s,g)),aX(w.y,E.y)&&(b.y=aY(w.y,E.y,s,g)),e.emit("pan"));var C=c.startZoom,_=c.zoom,S=null!=_&&n;S&&(aX(C,_)&&(u.zoom=tH(u.minZoom,aY(C,_,s,g),u.maxZoom)),e.emit("zoom")),(A||S)&&e.emit("viewport");var I=c.style;if(I&&I.length>0&&l){for(var T=0;T<I.length;T++){var x=I[T],D=x.name,N=c.startStyle[D],M=f.properties[N.name],R=aY(N,x,s,g,M);f.overrideBypass(e,D,R)}e.emit("style")}}c.progress=s}(t,h,e,r),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return r||0!==a.length||0!==o.length||n.push(t),s}for(var a=!1,o=0;o<r.length;o++){var s=i(r[o]);a=a||s}var l=i(t,!0);(a||l)&&(r.length>0?t.notify("draw",r):t.notify("draw")),r.unmerge(n),t.emit("step")}var aW={animate:ih.animate(),animation:ih.animation(),animated:ih.animated(),clearQueue:ih.clearQueue(),delay:ih.delay(),delayAnimation:ih.delayAnimation(),stop:ih.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,r){aG(r,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&eY(function(r){aG(r,e),t()})}()}}},aq={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,r){var n=t.qualifier;return null==n||e!==r.target&&j(r.target)&&n.matches(r.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,r){return null!=t.qualifier?r.target:e}},aZ=function(e){return L(e)?new iN(e):e},aQ={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new as(aq,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,r){return this.emitter().on(e,aZ(t),r),this},removeListener:function(e,t,r){return this.emitter().removeListener(e,aZ(t),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,r){return this.emitter().one(e,aZ(t),r),this},once:function(e,t,r){return this.emitter().one(e,aZ(t),r),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};ih.eventAliasesOn(aQ);var aK={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};aK.jpeg=aK.jpg;var a$={layout:function(e){if(null==e)return void e7("Layout options must be specified to make a layout");if(null==e.name)return void e7("A `name` must be specified to make a layout");var t,r=e.name,n=this.extension("layout",r);return null==n?void e7("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?"):(t=L(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new n(eo({},e,{cy:this,eles:t})))}};a$.createLayout=a$.makeLayout=a$.layout;var aJ=ta({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),a1={renderTo:function(e,t,r,n){return this._private.renderer.renderTo(e,t,r,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null==t)return void e7("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));void 0!==e.wheelSensitivity&&te("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var r=aJ(e);r.cy=this,this._private.renderer=new t(r),this.notify("init")},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};a1.invalidateDimensions=a1.resize;var a0={collection:function(e,t){return L(e)?this.$(e):H(e)?e.collection():F(e)?(t||(t={}),new ak(this,e,t.unique,t.removed)):new ak(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};a0.elements=a0.filter=a0.$;var a2={};a2.apply=function(e){for(var t=this._private.cy.collection(),r=0;r<e.length;r++){var n=e[r],i=this.getContextMeta(n);if(!i.empty){var a=this.getContextStyle(i),o=this.applyContextStyle(i,a,n);n._private.appliedInitStyle?this.updateTransitions(n,o.diffProps):n._private.appliedInitStyle=!0,this.updateStyleHints(n)&&t.push(n)}}return t},a2.getPropertiesDiff=function(e,t){var r=this._private.propDiffs=this._private.propDiffs||{},n=e+"-"+t,i=r[n];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var l=this[s],u="t"===e[s],c="t"===t[s],h=u!==c,d=l.mappedProperties.length>0;if(h||c&&d){var f=void 0;h&&d||h?f=l.properties:d&&(f=l.mappedProperties);for(var g=0;g<f.length;g++){for(var p=f[g],v=p.name,y=!1,w=s+1;w<this.length;w++){var E=this[w];if("t"===t[w]&&(y=null!=E.properties[p.name]))break}o[v]||y||(o[v]=!0,a.push(v))}}}return r[n]=a,a},a2.getContextMeta=function(e){for(var t,r="",n=e._private.styleCxtKey||"",i=0;i<this.length;i++){var a=this[i];a.selector&&a.selector.matches(e)?r+="t":r+="f"}return t=this.getPropertiesDiff(n,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:0===t.length}},a2.getContextStyle=function(e){var t=e.key,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var n={_private:{key:t}},i=0;i<this.length;i++){var a=this[i];if("t"===t[i])for(var o=0;o<a.properties.length;o++){var s=a.properties[o];n[s.name]=s}}return r[t]=n,n},a2.applyContextStyle=function(e,t,r){for(var n=e.diffPropNames,i={},a=this.types,o=0;o<n.length;o++){var s=n[o],l=t[s],u=r.pstyle(s);if(!l)if(!u)continue;else l=u.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0};if(u!==l){if(l.mapped===a.fn&&null!=u&&null!=u.mapping&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(r))===c.prevFnValue)continue}var h=i[s]={prev:u};this.applyParsedProperty(r,l),h.next=r.pstyle(s),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},a2.updateStyleHints=function(e){var t=e._private,r=this,n=r.propertyGroupNames,i=r.propertyGroupKeys,a=function(e,t,n){return r.getPropertiesHash(e,t,n)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;n=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];t.styleKeys[c]=[9261,5381]}for(var h=function(e,r){return t.styleKeys[r][0]=eG(e,t.styleKeys[r][0])},d=function(e,r){return t.styleKeys[r][1]=eW(e,t.styleKeys[r][1])},f=function(e,t){for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);h(n,t),d(n,t)}},g=0;g<n.length;g++){var p=n[g],v=l[p];if(null!=v){var y,w,E=this.properties[p],b=E.type,A=E.groupKey,C=void 0;null!=E.hashOverride?C=E.hashOverride(e,v):null!=v.pfValue&&(C=v.pfValue);var _=null==E.enums?v.value:null,S=null!=C,I=null!=_,T=S||I,x=v.units;b.number&&T&&!b.multiple?(h(w=-128<(y=S?C:_)&&y<128&&Math.floor(y)!==y?2e9-(1024*y|0):y,A),d(w,A),S||null==x||f(x,A)):f(v.strValue,A)}}for(var D=[9261,5381],N=0;N<i.length;N++){var M=i[N],R=t.styleKeys[M];D[0]=eG(R[0],D[0]),D[1]=eW(R[1],D[1])}t.styleKey=2097152*D[0]+D[1];var O=t.styleKeys;t.labelDimsKey=eq(O.labelDimensions);var P=a(e,["label"],O.labelDimensions);if(t.labelKey=eq(P),t.labelStyleKey=eq(eZ(O.commonLabel,P)),!s){var B=a(e,["source-label"],O.labelDimensions);t.sourceLabelKey=eq(B),t.sourceLabelStyleKey=eq(eZ(O.commonLabel,B));var L=a(e,["target-label"],O.labelDimensions);t.targetLabelKey=eq(L),t.targetLabelStyleKey=eq(eZ(O.commonLabel,L))}if(s){var k=t.styleKeys,F=k.nodeBody,z=k.nodeBorder,U=k.nodeOutline,V=k.backgroundImage,H=k.compound,j=k.pie;t.nodeKey=eq([F,z,U,V,H,j].filter(function(e){return null!=e}).reduce(eZ,[9261,5381])),t.hasPie=null!=j&&9261!==j[0]&&5381!==j[1]}return o!==t.styleKey},a2.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},a2.applyParsedProperty=function(e,t){var r=this,n=t,i=e._private.style,a=r.types,o=r.properties[n.name].type,s=n.bypass,l=i[n.name],u=l&&l.bypass,c=e._private,h="mapping",d=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=d(l),i=d(n);r.checkTriggers(e,n.name,t,i)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(n=t=this.parse(t.name,"bezier",s)),n.delete)return i[n.name]=void 0,f(),!0;if(n.deleteBypassed)if(!l)return f(),!0;else if(l.bypass)return l.bypassed=void 0,f(),!0;else return!1;if(n.deleteBypass)if(!l)return f(),!0;else if(l.bypass)return i[n.name]=l.bypassed,f(),!0;else return!1;var g=function(){te("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case a.mapData:for(var p,v,y=n.field.split("."),w=c.data,E=0;E<y.length&&w;E++)w=w[y[E]];if(null==w)return g(),!1;if(!U(w))return te("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+w+"` for `"+e.id()+"` is non-numeric)"),!1;var b=n.fieldMax-n.fieldMin;if((v=0===b?0:(w-n.fieldMin)/b)<0?v=0:v>1&&(v=1),o.color){var A=n.valueMin[0],C=n.valueMax[0],_=n.valueMin[1],S=n.valueMax[1],I=n.valueMin[2],T=n.valueMax[2],x=null==n.valueMin[3]?1:n.valueMin[3],D=[Math.round(A+(C-A)*v),Math.round(_+(S-_)*v),Math.round(I+(T-I)*v),Math.round(x+((null==n.valueMax[3]?1:n.valueMax[3])-x)*v)];p={bypass:n.bypass,name:n.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else{if(!o.number)return!1;var N=n.valueMin+(n.valueMax-n.valueMin)*v;p=this.parse(n.name,N,n.bypass,h)}if(!p)return g(),!1;p.mapping=n,n=p;break;case a.data:for(var M=n.field.split("."),R=c.data,O=0;O<M.length&&R;O++)R=R[M[O]];if(null!=R&&(p=this.parse(n.name,R,n.bypass,h)),!p)return g(),!1;p.mapping=n,n=p;break;case a.fn:var P=n.value,B=null!=n.fnValue?n.fnValue:P(e);if(n.prevFnValue=B,null==B)return te("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(p=this.parse(n.name,B,n.bypass,h)))return te("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+e.id()+"` is invalid)"),!1;p.mapping=tt(n),n=p;break;case void 0:break;default:return!1}return s?(u?n.bypassed=l.bypassed:n.bypassed=l,i[n.name]=n):u?l.bypassed=n:i[n.name]=n,f(),!0},a2.cleanElements=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),t)for(var i=n._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else n._private.style={}}},a2.update=function(){this._private.cy.mutableElements().updateStyle()},a2.updateTransitions=function(e,t){var r=this,n=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),d=t[c];if(d){var f=d.prev,g=null!=d.next?d.next:h,p=!1,v=void 0;f&&(U(f.pfValue)&&U(g.pfValue)?(p=g.pfValue-f.pfValue,v=f.pfValue+1e-6*p):U(f.value)&&U(g.value)?(p=g.value-f.value,v=f.value+1e-6*p):F(f.value)&&F(g.value)&&(p=f.value[0]!==g.value[0]||f.value[1]!==g.value[1]||f.value[2]!==g.value[2],v=f.strValue),p&&(s[c]=g.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;n.transitioning=!0,new nE(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1)},a2.checkTrigger=function(e,t,r,n,i,a){var o=this.properties[t],s=i(o);null!=s&&s(r,n)&&a(o)},a2.checkZOrderTrigger=function(e,t,r,n){var i=this;this.checkTrigger(e,t,r,n,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},a2.checkBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(e){return e.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),i.triggersBoundsOfParallelBeziers&&"curve-style"===t&&("bezier"===r||"bezier"===n)&&e.parallelEdges().forEach(function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}),i.triggersBoundsOfConnectedEdges&&"display"===t&&("none"===r||"none"===n)&&e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},a2.checkTriggers=function(e,t,r,n){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,r,n),this.checkBoundsTrigger(e,t,r,n)};var a3={};a3.applyBypass=function(e,t,r,n){var i=[];if("*"===t||"**"===t){if(void 0!==r)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,r,!0);s&&i.push(s)}}else if(L(t)){var l=this.parse(t,r,!0);l&&i.push(l)}else{if(!z(t))return!1;n=r;for(var u=Object.keys(t),c=0;c<u.length;c++){var h=u[c],d=t[h];if(void 0===d&&(d=t[K(h)]),void 0!==d){var f=this.parse(h,d,!0);f&&i.push(f)}}}if(0===i.length)return!1;for(var g=!1,p=0;p<e.length;p++){for(var v=e[p],y={},w=void 0,E=0;E<i.length;E++){var b=i[E];if(n){var A=v.pstyle(b.name);w=y[b.name]={prev:A}}g=this.applyParsedProperty(v,tt(b))||g,n&&(w.next=v.pstyle(b.name))}g&&this.updateStyleHints(v),n&&this.updateTransitions(v,y,!0)}return g},a3.overrideBypass=function(e,t,r){t=Q(t);for(var n=0;n<e.length;n++){var i=e[n],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=r,null!=a.pfValue&&(a.pfValue=r),s?a.strValue="rgb("+r.join(",")+")":l?a.strValue=r.join(" "):a.strValue=""+r,this.updateStyleHints(i)):this.applyBypass(i,t,r),this.checkTriggers(i,t,u,r)}},a3.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},a3.removeBypasses=function(e,t,r){for(var n=0;n<e.length;n++){for(var i=e[n],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=i.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),h=a[l.name]={prev:u};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,a,!0)}};var a4={};a4.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},a4.containerCss=function(e){var t=this._private.cy,r=t.container(),n=t.window();if(n&&r&&n.getComputedStyle)return n.getComputedStyle(r).getPropertyValue(e)};var a8={};a8.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},a8.getRawStyle=function(e,t){if(e=e[0]){for(var r={},n=0;n<this.properties.length;n++){var i=this.properties[n],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(r[i.name]=a,r[K(i.name)]=a)}return r}},a8.getIndexedStyle=function(e,t,r,n){var i=e.pstyle(t)[r][n];return null!=i?i:e.cy().style().getDefaultProperty(t)[r][0]},a8.getStylePropertyValue=function(e,t,r){if(e=e[0]){var n=this.properties[t];n.alias&&(n=n.pointsTo);var i=n.type,a=e.pstyle(n.name);if(a){var o=a.value,s=a.units,l=a.strValue;if(r&&i.number&&null!=o&&U(o)){var u=e.cy().zoom(),c=function(e){return e*u},h=function(e,t){return c(e)+t},d=F(o);if(d?s.every(function(e){return null!=e}):null!=s)if(d)return o.map(function(e,t){return h(e,s[t])}).join(" ");else return h(o,s);return d?o.map(function(e){return L(e)?e:""+c(e)}).join(" "):""+c(o)}if(null!=l)return l}return null}},a8.getAnimationStartStyle=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n].name,a=e.pstyle(i);void 0!==a&&(a=z(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(r[i]=a)}return r},a8.getPropsList=function(e){var t=[],r=this.properties;if(e)for(var n=Object.keys(e),i=0;i<n.length;i++){var a=n[i],o=e[a],s=r[a]||r[Q(a)],l=this.parse(s.name,o);l&&t.push(l)}return t},a8.getNonDefaultPropertiesHash=function(e,t,r){var n,i,a,o,s,l,u=r.slice();for(s=0;s<t.length;s++)if(n=t[s],null!=(i=e.pstyle(n,!1)))if(null!=i.pfValue)u[0]=eG(o,u[0]),u[1]=eW(o,u[1]);else for(l=0,a=i.strValue;l<a.length;l++)o=a.charCodeAt(l),u[0]=eG(o,u[0]),u[1]=eW(o,u[1]);return u},a8.getPropertiesHash=a8.getNonDefaultPropertiesHash;var a6={};a6.appendFromJson=function(e){for(var t=0;t<e.length;t++){var r=e[t],n=r.selector,i=r.style||r.css,a=Object.keys(i);this.selector(n);for(var o=0;o<a.length;o++){var s=a[o],l=i[s];this.css(s,l)}}return this},a6.fromJson=function(e){return this.resetToDefault(),this.appendFromJson(e),this},a6.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var r=this[t],n=r.selector,i=r.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:n?n.toString():"core",style:a})}return e};var a5={};a5.appendFromString=function(e){var t,r,n,i=""+e;function a(){i=i.length>t.length?i.substr(t.length):""}function o(){r=r.length>n.length?r.substr(n.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){te("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l&&new iN(l).invalid){te("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;r=u;for(var h=[];!r.match(/^\s*$/);){var d=r.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!d){te("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}n=d[0];var f=d[1],g=d[2];if(!this.properties[f]){te("Skipping property: Invalid property name in: "+n),o();continue}if(!this.parse(f,g)){te("Skipping property: Invalid property definition in: "+n),o();continue}h.push({name:f,val:g}),o()}if(c){a();break}this.selector(l);for(var p=0;p<h.length;p++){var v=h[p];this.css(v.name,v.val)}a()}return this},a5.fromString=function(e){return this.resetToDefault(),this.appendFromString(e),this};var a7={};!function(){var e=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},t=function(e){var t=ee+"|\\w+|"+er+"|"+ei+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+ee+")\\s*\\,\\s*("+ee+")\\s*,\\s*("+t+")\\s*\\,\\s*("+t+")\\)$"},r=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];a7.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi"]},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:e("data")},layoutData:{mapping:!0,regex:e("layoutData")},scratch:{mapping:!0,regex:e("scratch")},mapData:{mapping:!0,regex:t("mapData")},mapLayoutData:{mapping:!0,regex:t("mapLayoutData")},mapScratch:{mapping:!0,regex:t("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:r,singleRegexMatchValue:!0},urls:{regexes:r,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return L(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+ee+")\\s*,\\s*("+ee+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+ee+")\\s*,\\s*("+ee+")\\s*,\\s*("+ee+")\\s*,\\s*("+ee+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return 1===t||2===t||4===t}}};var n=function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},i=function(e,t){return e!=t},a=a7.types,o=[{name:"label",type:a.text,triggersBounds:i,triggersZOrder:function(e,t){var r=W(e),n=W(t);return r&&!n||!r&&n}},{name:"text-rotation",type:a.textRotation,triggersBounds:i},{name:"text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"text-margin-y",type:a.bidirectionalSize,triggersBounds:i}],s=[{name:"source-label",type:a.text,triggersBounds:i},{name:"source-text-rotation",type:a.textRotation,triggersBounds:i},{name:"source-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-offset",type:a.size,triggersBounds:i}],l=[{name:"target-label",type:a.text,triggersBounds:i},{name:"target-text-rotation",type:a.textRotation,triggersBounds:i},{name:"target-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-offset",type:a.size,triggersBounds:i}],u=[{name:"font-family",type:a.fontFamily,triggersBounds:i},{name:"font-style",type:a.fontStyle,triggersBounds:i},{name:"font-weight",type:a.fontWeight,triggersBounds:i},{name:"font-size",type:a.size,triggersBounds:i},{name:"text-transform",type:a.textTransform,triggersBounds:i},{name:"text-wrap",type:a.textWrap,triggersBounds:i},{name:"text-overflow-wrap",type:a.textOverflowWrap,triggersBounds:i},{name:"text-max-width",type:a.size,triggersBounds:i},{name:"text-outline-width",type:a.size,triggersBounds:i},{name:"line-height",type:a.positiveNumber,triggersBounds:i}],c=[{name:"text-valign",type:a.valign,triggersBounds:i},{name:"text-halign",type:a.halign,triggersBounds:i},{name:"color",type:a.color},{name:"text-outline-color",type:a.color},{name:"text-outline-opacity",type:a.zeroOneNumber},{name:"text-background-color",type:a.color},{name:"text-background-opacity",type:a.zeroOneNumber},{name:"text-background-padding",type:a.size,triggersBounds:i},{name:"text-border-opacity",type:a.zeroOneNumber},{name:"text-border-color",type:a.color},{name:"text-border-width",type:a.size,triggersBounds:i},{name:"text-border-style",type:a.borderStyle,triggersBounds:i},{name:"text-background-shape",type:a.textBackgroundShape,triggersBounds:i},{name:"text-justification",type:a.justification}],h=[{name:"events",type:a.bool,triggersZOrder:i},{name:"text-events",type:a.bool,triggersZOrder:i}],d=[{name:"display",type:a.display,triggersZOrder:i,triggersBounds:i,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:a.visibility,triggersZOrder:i},{name:"opacity",type:a.zeroOneNumber,triggersZOrder:n},{name:"text-opacity",type:a.zeroOneNumber},{name:"min-zoomed-font-size",type:a.size},{name:"z-compound-depth",type:a.zCompoundDepth,triggersZOrder:i},{name:"z-index-compare",type:a.zIndexCompare,triggersZOrder:i},{name:"z-index",type:a.number,triggersZOrder:i}],f=[{name:"overlay-padding",type:a.size,triggersBounds:i},{name:"overlay-color",type:a.color},{name:"overlay-opacity",type:a.zeroOneNumber,triggersBounds:n},{name:"overlay-shape",type:a.overlayShape,triggersBounds:i}],g=[{name:"underlay-padding",type:a.size,triggersBounds:i},{name:"underlay-color",type:a.color},{name:"underlay-opacity",type:a.zeroOneNumber,triggersBounds:n},{name:"underlay-shape",type:a.overlayShape,triggersBounds:i}],p=[{name:"transition-property",type:a.propList},{name:"transition-duration",type:a.time},{name:"transition-delay",type:a.time},{name:"transition-timing-function",type:a.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},y=[{name:"height",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"width",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"shape",type:a.nodeShape,triggersBounds:i},{name:"shape-polygon-points",type:a.polygonPointList,triggersBounds:i},{name:"background-color",type:a.color},{name:"background-fill",type:a.fill},{name:"background-opacity",type:a.zeroOneNumber},{name:"background-blacken",type:a.nOneOneNumber},{name:"background-gradient-stop-colors",type:a.colors},{name:"background-gradient-stop-positions",type:a.percentages},{name:"background-gradient-direction",type:a.gradientDirection},{name:"padding",type:a.sizeMaybePercent,triggersBounds:i},{name:"padding-relative-to",type:a.paddingRelativeTo,triggersBounds:i},{name:"bounds-expansion",type:a.boundsExpansion,triggersBounds:i}],w=[{name:"border-color",type:a.color},{name:"border-opacity",type:a.zeroOneNumber},{name:"border-width",type:a.size,triggersBounds:i},{name:"border-style",type:a.borderStyle}],E=[{name:"outline-color",type:a.color},{name:"outline-opacity",type:a.zeroOneNumber},{name:"outline-width",type:a.size,triggersBounds:i},{name:"outline-style",type:a.borderStyle},{name:"outline-offset",type:a.size,triggersBounds:i}],b=[{name:"background-image",type:a.urls},{name:"background-image-crossorigin",type:a.bgCrossOrigin},{name:"background-image-opacity",type:a.zeroOneNumbers},{name:"background-image-containment",type:a.bgContainment},{name:"background-image-smoothing",type:a.bools},{name:"background-position-x",type:a.bgPos},{name:"background-position-y",type:a.bgPos},{name:"background-width-relative-to",type:a.bgRelativeTo},{name:"background-height-relative-to",type:a.bgRelativeTo},{name:"background-repeat",type:a.bgRepeat},{name:"background-fit",type:a.bgFit},{name:"background-clip",type:a.bgClip},{name:"background-width",type:a.bgWH},{name:"background-height",type:a.bgWH},{name:"background-offset-x",type:a.bgPos},{name:"background-offset-y",type:a.bgPos}],A=[{name:"position",type:a.position,triggersBounds:i},{name:"compound-sizing-wrt-labels",type:a.compoundIncludeLabels,triggersBounds:i},{name:"min-width",type:a.size,triggersBounds:i},{name:"min-width-bias-left",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-width-bias-right",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height",type:a.size,triggersBounds:i},{name:"min-height-bias-top",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height-bias-bottom",type:a.sizeMaybePercent,triggersBounds:i}],C=[{name:"line-style",type:a.lineStyle},{name:"line-color",type:a.color},{name:"line-fill",type:a.fill},{name:"line-cap",type:a.lineCap},{name:"line-opacity",type:a.zeroOneNumber},{name:"line-dash-pattern",type:a.numbers},{name:"line-dash-offset",type:a.number},{name:"line-gradient-stop-colors",type:a.colors},{name:"line-gradient-stop-positions",type:a.percentages},{name:"curve-style",type:a.curveStyle,triggersBounds:i,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:a.zeroOneNumber,triggersBounds:i},{name:"source-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"target-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"control-point-step-size",type:a.size,triggersBounds:i},{name:"control-point-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"control-point-weights",type:a.numbers,triggersBounds:i},{name:"segment-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"segment-weights",type:a.numbers,triggersBounds:i},{name:"taxi-turn",type:a.bidirectionalSizeMaybePercent,triggersBounds:i},{name:"taxi-turn-min-distance",type:a.size,triggersBounds:i},{name:"taxi-direction",type:a.axisDirection,triggersBounds:i},{name:"edge-distances",type:a.edgeDistances,triggersBounds:i},{name:"arrow-scale",type:a.positiveNumber,triggersBounds:i},{name:"loop-direction",type:a.angle,triggersBounds:i},{name:"loop-sweep",type:a.angle,triggersBounds:i},{name:"source-distance-from-node",type:a.size,triggersBounds:i},{name:"target-distance-from-node",type:a.size,triggersBounds:i}],_=[{name:"ghost",type:a.bool,triggersBounds:i},{name:"ghost-offset-x",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-offset-y",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-opacity",type:a.zeroOneNumber}],S=[{name:"selection-box-color",type:a.color},{name:"selection-box-opacity",type:a.zeroOneNumber},{name:"selection-box-border-color",type:a.color},{name:"selection-box-border-width",type:a.size},{name:"active-bg-color",type:a.color},{name:"active-bg-opacity",type:a.zeroOneNumber},{name:"active-bg-size",type:a.size},{name:"outside-texture-bg-color",type:a.color},{name:"outside-texture-bg-opacity",type:a.zeroOneNumber}],I=[];a7.pieBackgroundN=16,I.push({name:"pie-size",type:a.sizeMaybePercent});for(var T=1;T<=a7.pieBackgroundN;T++)I.push({name:"pie-"+T+"-background-color",type:a.color}),I.push({name:"pie-"+T+"-background-size",type:a.percent}),I.push({name:"pie-"+T+"-background-opacity",type:a.zeroOneNumber});var x=[],D=a7.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:a.arrowShape,triggersBounds:i},{name:"arrow-color",type:a.color},{name:"arrow-fill",type:a.arrowFill},{name:"arrow-width",type:a.arrowWidth}].forEach(function(e){D.forEach(function(t){var r=t+"-"+e.name,n=e.type,i=e.triggersBounds;x.push({name:r,type:n,triggersBounds:i})})},{});var N=a7.properties=[].concat(h,p,d,f,g,_,c,u,o,s,l,y,w,E,b,I,A,C,x,S),M=a7.propertyGroups={behavior:h,transition:p,visibility:d,overlay:f,underlay:g,ghost:_,commonLabel:c,labelDimensions:u,mainLabel:o,sourceLabel:s,targetLabel:l,nodeBody:y,nodeBorder:w,nodeOutline:E,backgroundImage:b,pie:I,compound:A,edgeLine:C,edgeArrow:x,core:S},R=a7.propertyGroupNames={};(a7.propertyGroupKeys=Object.keys(M)).forEach(function(e){R[e]=M[e].map(function(e){return e.name}),M[e].forEach(function(t){return t.groupKey=e})});var O=a7.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];a7.propertyNames=N.map(function(e){return e.name});for(var P=0;P<N.length;P++){var B=N[P];N[B.name]=B}for(var k=0;k<O.length;k++){var F=O[k],z=N[F.pointsTo],U={name:F.name,alias:!0,pointsTo:z};N.push(U),N[F.name]=U}}(),a7.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},a7.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=eo({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(e,t){for(var r=1;r<=a7.pieBackgroundN;r++){var n=t.name.replace("{{i}}",r),i=t.value;e[n]=i}return e},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"taxi-turn":"50%","taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(e,t){return a7.arrowPrefixes.forEach(function(r){var n=r+"-"+t.name,i=t.value;e[n]=i}),e},{})),r={},n=0;n<this.properties.length;n++){var i=this.properties[n];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);r[a]=s}}return e.defaultProperties=r,e.defaultProperties},a7.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var a9={};a9.parse=function(e,t,r,n){if(k(t))return this.parseImplWarn(e,t,r,n);var i,a=e$(e,""+t,r?"t":"f","mapping"===n||!0===n||!1===n||null==n?"dontcare":n),o=this.propCache=this.propCache||[];return(i=o[a])||(i=o[a]=this.parseImplWarn(e,t,r,n)),(r||"mapping"===n)&&(i=tt(i))&&(i.value=tt(i.value)),i},a9.parseImplWarn=function(e,t,r,n){var i=this.parseImpl(e,t,r,n);return i||null==t||te("The style property `".concat(e,": ").concat(t,"` is invalid")),i&&("width"===i.name||"height"===i.name)&&"label"===t&&te("The style value of `label` is deprecated for `"+i.name+"`"),i},a9.parseImpl=function(e,t,r,n){e=Q(e);var i=this.properties[e],a=t,o=this.types;if(!i||void 0===t)return null;i.alias&&(e=(i=i.pointsTo).name);var s=L(t);s&&(t=t.trim());var l=i.type;if(!l)return null;if(r&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(k(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:r};if(!s||n||t.length<7||"a"!==t[1]);else if(t.length>=7&&"d"===t[0]&&(p=new RegExp(o.data.regex).exec(t))){if(r)return!1;var u=o.data;return{name:e,value:p,strValue:""+t,mapped:u,field:p[1],bypass:r}}else if(t.length>=10&&"m"===t[0]&&(v=new RegExp(o.mapData.regex).exec(t))){if(r||l.multiple)return!1;var c=o.mapData;if(!(l.color||l.number))return!1;var h=this.parse(e,v[4]);if(!h||h.mapped)return!1;var d=this.parse(e,v[5]);if(!d||d.mapped)return!1;if(h.pfValue===d.pfValue||h.strValue===d.strValue)return te("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+h.strValue+"`"),this.parse(e,h.strValue);if(l.color){var f=h.value,g=d.value;if(f[0]===g[0]&&f[1]===g[1]&&f[2]===g[2]&&(f[3]===g[3]||(null==f[3]||1===f[3])&&(null==g[3]||1===g[3])))return!1}return{name:e,value:v,strValue:""+t,mapped:c,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:h.value,valueMax:d.value,bypass:r}}if(l.multiple&&"multiple"!==n){if(y=s?t.split(/\s+/):F(t)?t:[t],l.evenMultiple&&y.length%2!=0)return null;for(var p,v,y,w=[],E=[],b=[],A="",C=!1,_=0;_<y.length;_++){var S=this.parse(e,y[_],r,"multiple");C=C||L(S.value),w.push(S.value),b.push(null!=S.pfValue?S.pfValue:S.value),E.push(S.units),A+=(_>0?" ":"")+S.strValue}if(l.validate&&!l.validate(w,E))return null;if(l.singleEnum&&C)if(1===w.length&&L(w[0]))return{name:e,value:w[0],strValue:w[0],bypass:r};else return null;return{name:e,value:w,pfValue:b,strValue:A,bypass:r,units:E}}var I=function(){for(var n=0;n<l.enums.length;n++)if(l.enums[n]===t)return{name:e,value:t,strValue:""+t,bypass:r};return null};if(l.number){var T,x,D="px";if(l.units&&(x=l.units),l.implicitUnits&&(D=l.implicitUnits),!l.unitless)if(s){var N="px|em"+(l.allowPercent?"|\\%":"");x&&(N=x);var M=t.match("^("+ee+")("+N+")?$");M&&(t=M[1],x=M[2]||D)}else(!x||l.implicitUnits)&&(x=D);if(isNaN(t=parseFloat(t))&&void 0===l.enums)return null;if(isNaN(t)&&void 0!==l.enums)return t=a,I();if(l.integer&&!(U(T=t)&&Math.floor(T)===T)||void 0!==l.min&&(t<l.min||l.strictMin&&t===l.min)||void 0!==l.max&&(t>l.max||l.strictMax&&t===l.max))return null;var R={name:e,value:t,strValue:""+t+(x||""),units:x,bypass:r};return l.unitless||"px"!==x&&"em"!==x?R.pfValue=t:R.pfValue="px"!==x&&x?this.getEmSizeInPixels()*t:t,("ms"===x||"s"===x)&&(R.pfValue="ms"===x?t:1e3*t),("deg"===x||"rad"===x)&&(R.pfValue="rad"===x?t:Math.PI*t/180),"%"===x&&(R.pfValue=t/100),R}if(l.propList){var O=[],P=""+t;if("none"===P);else{for(var B=P.split(/\s*,\s*|\s+/),z=0;z<B.length;z++){var V=B[z].trim();this.properties[V]?O.push(V):te("`"+V+"` is not a valid property name")}if(0===O.length)return null}return{name:e,value:O,strValue:0===O.length?"none":O.join(" "),bypass:r}}if(l.color){var H,j=(F(H=t)?H:null)||ec[H.toLowerCase()]||es(H)||eu(H)||el(H);return j?{name:e,value:j,pfValue:j,strValue:"rgb("+j[0]+","+j[1]+","+j[2]+")",bypass:r}:null}if(l.regex||l.regexes){if(l.enums){var Y=I();if(Y)return Y}for(var X=l.regexes?l.regexes:[l.regex],G=0;G<X.length;G++){var W=new RegExp(X[G]).exec(t);if(W)return{name:e,value:l.singleRegexMatchValue?W[1]:W,strValue:""+t,bypass:r}}return null}if(l.string)return{name:e,value:""+t,strValue:""+t,bypass:r};else if(l.enums)return I();else return null};var oe=function e(t){return this instanceof e?X(t)?void(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):void e7("A style must have a core reference"):new e(t)},ot=oe.prototype;ot.instanceString=function(){return"style"},ot.clear=function(){for(var e=this._private,t=e.cy.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},ot.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},ot.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},ot.selector=function(e){var t="core"===e?null:new iN(e),r=this.length++;return this[r]={selector:t,properties:[],mappedProperties:[],index:r},this},ot.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],r=0;r<this.properties.length;r++){var n=this.properties[r],i=t[n.name];void 0===i&&(i=t[K(n.name)]),void 0!==i&&this.cssRule(n.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},ot.style=ot.css,ot.cssRule=function(e,t){var r=this.parse(e,t);if(r){var n=this.length-1;this[n].properties.push(r),this[n].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.mapped&&this[n].mappedProperties.push(r),this[n].selector||(this._private.coreStyle[r.name]=r)}return this},ot.append=function(e){return G(e)?e.appendToStyle(this):F(e)?this.appendFromJson(e):L(e)&&this.appendFromString(e),this},oe.fromJson=function(e,t){var r=new oe(e);return r.fromJson(t),r},oe.fromString=function(e,t){return new oe(e).fromString(t)},[a2,a3,a4,a8,a6,a5,a7,a9].forEach(function(e){eo(ot,e)}),oe.types=ot.types,oe.properties=ot.properties,oe.propertyGroups=ot.propertyGroups,oe.propertyGroupNames=ot.propertyGroupNames,oe.propertyGroupKeys=ot.propertyGroupKeys;var or={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return(null==t.selectionType&&(t.selectionType="single"),void 0===e)?t.selectionType:(("additive"===e||"single"===e)&&(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,r,n,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(L(a[0]))return o[e=a[0]];if(z(a[0])){if(!this._private.panningEnabled)return this;n=(r=a[0]).x,i=r.y,U(n)&&(o.x=n),U(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],("x"===e||"y"===e)&&U(t)&&(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var r,n,i,a=arguments,o=this._private.pan;if(!this._private.panningEnabled)return this;switch(a.length){case 1:z(e)&&(n=(r=a[0]).x,i=r.y,U(n)&&(o.x+=n),U(i)&&(o.y+=i),this.emit("pan viewport"));break;case 2:("x"===e||"y"===e)&&U(t)&&(o[e]+=t),this.emit("pan viewport")}return this.notify("viewport"),this},fit:function(e,t){var r=this.getFitViewport(e,t);if(r){var n=this._private;n.zoom=r.zoom,n.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(U(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){if(L(e)){var r,n,i,a=e;e=this.$(a)}else if(z(r=e)&&U(r.x1)&&U(r.x2)&&U(r.y1)&&U(r.y2)){var o=e;(n={x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else H(e)||(e=this.mutableElements());if(!(H(e)&&e.empty())){n=n||e.boundingBox();var s=this.width(),l=this.height();if(t=U(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){i=(i=(i=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:i)<this._private.minZoom?this._private.minZoom:i;var u={x:(s-i*(n.x1+n.x2))/2,y:(l-i*(n.y1+n.y2))/2};return{zoom:i,pan:u}}}}},zoomRange:function(e,t){var r=this._private;if(null==t){var n=e;e=n.min,t=n.max}return U(e)&&U(t)&&e<=t?(r.minZoom=e,r.maxZoom=t):U(e)&&void 0===t&&e<=r.maxZoom?r.minZoom=e:U(t)&&void 0===e&&t>=r.minZoom&&(r.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,r,n=this._private,i=n.pan,a=n.zoom,o=!1;if(n.zoomingEnabled||(o=!0),U(e)?r=e:z(e)&&(r=e.level,null!=e.position?t=tI(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||n.panningEnabled||(o=!0)),r=(r=r>n.maxZoom?n.maxZoom:r)<n.minZoom?n.minZoom:r,o||!U(r)||r===a||null!=t&&(!U(t.x)||!U(t.y)))return null;if(null==t)return{zoomed:!0,panned:!1,zoom:r,pan:i};var s=r,l={x:-s/a*(t.x-i.x)+t.x,y:-s/a*(t.y-i.y)+t.y};return{zoomed:!0,panned:!0,zoom:s,pan:l}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),r=this._private;return null!=t&&t.zoomed&&(r.zoom=t.zoom,t.panned&&(r.pan.x=t.pan.x,r.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport")),this},viewport:function(e){var t=this._private,r=!0,n=!0,i=[],a=!1,o=!1;if(!e||(U(e.zoom)||(r=!1),z(e.pan)||(n=!1),!r&&!n))return this;if(r){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(n&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;U(l.x)&&(t.pan.x=l.x,o=!1),U(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(L(e)){var r=e;e=this.mutableElements().filter(r)}else H(e)||(e=this.mutableElements());if(0!==e.length){var n=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(n.x1+n.x2))/2,y:(a-t*(n.y1+n.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,r=this._private,n=r.container;return r.sizeCache=r.sizeCache||(n?(e=this.window().getComputedStyle(n),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:n.clientWidth-t("padding-left")-t("padding-right"),height:n.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,r=this.renderedExtent(),n={x1:(r.x1-e.x)/t,x2:(r.x2-e.x)/t,y1:(r.y1-e.y)/t,y2:(r.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};or.centre=or.center,or.autolockNodes=or.autolock,or.autoungrabifyNodes=or.autoungrabify;var on={data:ih.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ih.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ih.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ih.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};on.attr=on.data,on.removeAttr=on.removeData;var oi=function(e){var t=this,r=(e=eo({},e)).container;r&&!V(r)&&V(r[0])&&(r=r[0]);var n=r?r._cyreg:null;(n=n||{}).cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];r&&(r._cyreg=n),n.cy=t;var a=void 0!==D&&void 0!==r&&!e.headless,o=e;o.layout=eo({name:a?"grid":"null"},o.layout),o.renderer=eo({name:a?"canvas":"null"},o.renderer);var s=function(e,t,r){return void 0!==t?t:void 0!==r?r:e},l=this._private={container:r,ready:!1,options:o,elements:new ak(this),listeners:[],aniEles:new ak(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:U(o.zoom)?o.zoom:1,pan:{x:z(o.pan)&&U(o.pan.x)?o.pan.x:0,y:z(o.pan)&&U(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=eo({},o,o.renderer);t.initRenderer(u);var c=function(e,r,n){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(z(e)||F(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",r),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",n),t.emit("done")});var a=eo({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};!function(e,t){if(e.some(q))return nE.all(e).then(t);t(e)}([o.style,o.elements],function(e){var r=e[0],a=e[1];l.styleEnabled&&t.style().append(r),c(a,function(){t.startAnimationLoop(),l.ready=!0,k(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var r=i[e];t.on("ready",r)}n&&(n.readies=[]),t.emit("ready")},o.done)})},oa=oi.prototype;eo(oa,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){if(!this.destroyed())return this.stopAnimationLoop(),this.destroyRenderer(),this.emit("destroy"),this._private.destroyed=!0,this},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(null==this._private.container)return D;var e=this._private.container.ownerDocument;return void 0===e||null==e?D:e.defaultView||D},mount:function(e){if(null!=e){var t=this._private,r=t.options;return!V(e)&&V(e[0])&&(e=e[0]),this.stopAnimationLoop(),this.destroyRenderer(),t.container=e,t.styleEnabled=!0,this.invalidateSize(),this.initRenderer(eo({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),this.startAnimationLoop(),this.style(r.style),this.emit("mount"),this}},unmount:function(){return this.stopAnimationLoop(),this.destroyRenderer(),this.initRenderer({name:"null"}),this.emit("unmount"),this},options:function(){return tt(this._private.options)},json:function(e){var t=this,r=t._private,n=t.mutableElements();if(z(e)){if(t.startBatch(),e.elements){var i={},a=function(e,r){for(var n=[],a=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){te("cy.json() cannot handle elements without an ID attribute");continue}var l=""+s.data.id,u=t.getElementById(l);i[l]=!0,0!==u.length?a.push({ele:u,json:s}):(r&&(s.group=r),n.push(s))}t.add(n);for(var c=0;c<a.length;c++){var h=a[c],d=h.ele,f=h.json;d.json(f)}};if(F(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];F(u)&&a(u,l)}var c=t.collection();n.filter(function(e){return!i[e.id()]}).forEach(function(e){e.isParent()?c.merge(e):e.remove()}),c.forEach(function(e){return e.children().move({parent:null})}),c.forEach(function(e){return t.getElementById(e.id()).remove()})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==r.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==r.pan.x||e.pan.y!==r.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var f=h[d];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var g={};e?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},n.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=tt(t.data());var p=r.options;return g.zoomingEnabled=r.zoomingEnabled,g.userZoomingEnabled=r.userZoomingEnabled,g.zoom=r.zoom,g.minZoom=r.minZoom,g.maxZoom=r.maxZoom,g.panningEnabled=r.panningEnabled,g.userPanningEnabled=r.userPanningEnabled,g.pan=tt(r.pan),g.boxSelectionEnabled=r.boxSelectionEnabled,g.renderer=tt(p.renderer),g.hideEdgesOnViewport=p.hideEdgesOnViewport,g.textureOnViewport=p.textureOnViewport,g.wheelSensitivity=p.wheelSensitivity,g.motionBlur=p.motionBlur,g.multiClickDebounceTime=p.multiClickDebounceTime,g}}),oa.$id=oa.getElementById,[{add:function(e){var t;if(H(e))if(e._private.cy===this)t=e.restore();else{for(var r=[],n=0;n<e.length;n++){var i=e[n];r.push(i.json())}t=new ak(this,r)}else if(F(e))t=new ak(this,e);else if(z(e)&&(F(e.nodes)||F(e.edges))){for(var a=[],o=["nodes","edges"],s=0,l=o.length;s<l;s++){var u=o[s],c=e[u];if(F(c))for(var h=0,d=c.length;h<d;h++){var f=eo({group:u},c[h]);a.push(f)}}t=new ak(this,a)}else t=new tp(this,e).collection();return t},remove:function(e){if(H(e));else if(L(e)){var t=e;e=this.$(t)}return e.remove()}},aW,aQ,aK,a$,{notify:function(e,t){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var n=r.batchNotifications[e]=r.batchNotifications[e]||this.collection();null!=t&&n.merge(t);return}if(r.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(r){var n=e.batchNotifications[r];n.empty()?t.notify(r):t.notify(r,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var r=Object.keys(e),n=0;n<r.length;n++){var i=r[n],a=e[i];t.getElementById(i).data(a)}})}},a1,a0,{style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return G(e)?t.style=e.generateStyle(this):F(e)?t.style=oe.fromJson(this,e):L(e)?t.style=oe.fromString(this,e):t.style=oe(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},or,on].forEach(function(e){eo(oa,e)});var oo={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},os={maximal:!1,acyclic:!1},ol=function(e){return e.scratch("breadthfirst")},ou=function(e,t){return e.scratch("breadthfirst",t)};function oc(e){this.options=eo({},oo,os,e)}oc.prototype.run=function(){var e,t=this.options,r=t.cy,n=t.eles,i=n.nodes().filter(function(e){return!e.isParent()}),a=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=tj(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(H(t.roots))e=t.roots;else if(F(t.roots)){for(var l=[],u=0;u<t.roots.length;u++){var c=t.roots[u],h=r.getElementById(c);l.push(h)}e=r.collection(l)}else if(L(t.roots))e=r.$(t.roots);else if(a)e=i.roots();else{var d=n.components();e=r.collection();for(var f=0;f<d.length;f++)!function(t){var r=d[t],n=r.maxDegree(!1),i=r.filter(function(e){return e.degree(!1)===n});e=e.add(i)}(f)}var g=[],p={},v=function(e,t){null==g[t]&&(g[t]=[]);var r=g[t].length;g[t].push(e),ou(e,{index:r,depth:t})},y=function(e,t){var r=ol(e),n=r.depth,i=r.index;g[n][i]=null,v(e,t)};n.bfs({roots:e,directed:t.directed,visit:function(e,t,r,n,i){var a=e[0],o=a.id();v(a,i),p[o]=!0}});for(var w=[],E=0;E<i.length;E++){var b=i[E];p[b.id()]||w.push(b)}var A=function(e){for(var t=g[e],r=0;r<t.length;r++){var n=t[r];if(null==n){t.splice(r,1),r--;continue}ou(n,{depth:e,index:r})}},C=function(){for(var e=0;e<g.length;e++)A(e)};if(a&&o){var _=[],S={},I=function(e){return _.push(e)};for(i.forEach(function(e){return _.push(e)});_.length>0;){var T=_.shift(),x=function(e,r){for(var i=ol(e),a=e.incomers().filter(function(e){return e.isNode()&&n.has(e)}),o=-1,s=e.id(),l=0;l<a.length;l++)o=Math.max(o,ol(a[l]).depth);if(i.depth<=o){if(!t.acyclic&&r[s])return null;var u=o+1;return y(e,u),r[s]=u,!0}return!1}(T,S);if(x)T.outgoers().filter(function(e){return e.isNode()&&n.has(e)}).forEach(I);else if(null===x){te("Detected double maximal shift for node `"+T.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}C();var D=0;if(t.avoidOverlap)for(var N=0;N<i.length;N++){var M=i[N].layoutDimensions(t),R=M.w,O=M.h;D=Math.max(D,R,O)}var P={},B=function(e){if(P[e.id()])return P[e.id()];for(var t=ol(e).depth,r=e.neighborhood(),n=0,a=0,o=0;o<r.length;o++){var s=r[o];if(!(s.isEdge()||s.isParent())&&i.has(s)){var l=ol(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var h=g[c].length;c<t&&(n+=u/h,a++)}}}}return n/=a=Math.max(1,a),0===a&&(n=0),P[e.id()]=n,n},k=function(e,t){var r=B(e)-B(t);return 0===r?ea(e.id(),t.id()):r};void 0!==t.depthSort&&(k=t.depthSort);for(var z=0;z<g.length;z++)g[z].sort(k),A(z);for(var U=[],V=0;V<w.length;V++)U.push(w[V]);g.unshift(U),C();for(var j=0,Y=0;Y<g.length;Y++)j=Math.max(g[Y].length,j);var X={x:s.x1+s.w/2,y:s.x1+s.h/2},G=g.reduce(function(e,t){return Math.max(e,t.length)},0);return n.nodes().layoutPositions(this,t,function(e){var r=ol(e),n=r.depth,i=r.index,a=g[n].length,o=Math.max(s.w/((t.grid?G:a)+1),D),l=Math.max(s.h/(g.length+1),D),u=Math.min(s.w/2/g.length,s.h/2/g.length);if(u=Math.max(u,D),!t.circle)return{x:X.x+(i+1-(a+1)/2)*o,y:(n+1)*l};var c=u*n+u-(g.length>0&&g[0].length<=3?u/2:0),h=2*Math.PI/g[n].length*i;return 0===n&&1===g[0].length&&(c=1),{x:X.x+c*Math.cos(h),y:X.y+c*Math.sin(h)}}),this};var oh={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function od(e){this.options=eo({},oh,e)}od.prototype.run=function(){var e,t=this.options,r=t.cy,n=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=n.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o=tj(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),u=0,c=0;c<a.length;c++){var h=a[c].layoutDimensions(t);u=Math.max(u,h.w,h.h)}if(e=U(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-u,a.length>1&&t.avoidOverlap){var d=Math.cos(l)-1,f=Math.sin(l)-0;e=Math.max(Math.sqrt((u*=1.75)*u/(d*d+f*f)),e)}return n.nodes().layoutPositions(this,t,function(r,n){var a=t.startAngle+n*l*(i?1:-1),o=e*Math.cos(a),u=e*Math.sin(a);return{x:s.x+o,y:s.y+u}}),this};var of={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function og(e){this.options=eo({},of,e)}og.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,r=e.cy,n=e.eles,i=n.nodes().not(":parent"),a=tj(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:a.x1+a.w/2,y:a.y1+a.h/2},s=[],l=0,u=0;u<i.length;u++){var c=i[u],h=void 0;h=e.concentric(c),s.push({value:h,node:c}),c._private.scratch.concentric=h}i.updateStyle();for(var d=0;d<i.length;d++){var f=i[d].layoutDimensions(e);l=Math.max(l,f.w,f.h)}s.sort(function(e,t){return t.value-e.value});for(var g=e.levelWidth(i),p=[[]],v=p[0],y=0;y<s.length;y++){var w=s[y];v.length>0&&Math.abs(v[0].value-w.value)>=g&&(v=[],p.push(v)),v.push(w)}var E=l+e.minNodeSpacing;if(!e.avoidOverlap){var b=p.length>0&&p[0].length>1,A=(Math.min(a.w,a.h)/2-E)/(p.length+b?1:0);E=Math.min(E,A)}for(var C=0,_=0;_<p.length;_++){var S=p[_],I=void 0===e.sweep?2*Math.PI-2*Math.PI/S.length:e.sweep,T=S.dTheta=I/Math.max(1,S.length-1);if(S.length>1&&e.avoidOverlap){var x=Math.cos(T)-1,D=Math.sin(T)-0;C=Math.max(Math.sqrt(E*E/(x*x+D*D)),C)}S.r=C,C+=E}if(e.equidistant){for(var N=0,M=0,R=0;R<p.length;R++)N=Math.max(N,p[R].r-M);M=0;for(var O=0;O<p.length;O++){var P=p[O];0===O&&(M=P.r),P.r=M,M+=N}}for(var B={},L=0;L<p.length;L++)for(var k=p[L],F=k.dTheta,z=k.r,U=0;U<k.length;U++){var V=k[U],H=e.startAngle+(t?1:-1)*F*U,j={x:o.x+z*Math.cos(H),y:o.y+z*Math.sin(H)};B[V.node.id()]=j}return n.nodes().layoutPositions(this,e,function(e){return B[e.id()]}),this};var op={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function om(e){this.options=eo({},op,e),this.options.layout=this;var t=this.options.eles.nodes(),r=this.options.eles.edges().filter(function(e){var r=e.source().data("id"),n=e.target().data("id"),i=t.some(function(e){return e.data("id")===r}),a=t.some(function(e){return e.data("id")===n});return!i||!a});this.options.eles=this.options.eles.not(r)}om.prototype.run=function(){var e=this.options,t=e.cy,r=this;r.stopped=!1,(!0===e.animate||!1===e.animate)&&r.emit({type:"layoutstart",layout:r}),I=!0===e.debug;var n=ov(t,r,e);I&&T(n),e.randomize&&oE(n);var i=eH(),a=function(){oA(n,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!r.stopped&&!(t>=e.numIter)&&(oC(n,e),n.temperature=n.temperature*e.coolingFactor,!(n.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),r.one("layoutstop",e.stop),r.emit({type:"layoutstop",layout:r});else{var t=e.eles.nodes(),i=ob(n,e,t);t.layoutPositions(r,e,i)}},l=0,u=!0;if(!0===e.animate)!function t(){for(var r=0;u&&r<e.refresh;)u=o(l),l++,r++;u?(eH()-i>=e.animationThreshold&&a(),eY(t)):(oB(n,e),s())}();else{for(;u;)u=o(l),l++;oB(n,e),s()}return this},om.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},om.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ov=function(e,t,r){for(var n=r.eles.edges(),i=r.eles.nodes(),a=tj(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:r.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=r.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],h=0;h<c.length;h++){var d=c[h];l[d.id()]=u}for(var u=0;u<o.nodeSize;u++){var f=i[u],g=f.layoutDimensions(r),p={};p.isLocked=f.locked(),p.id=f.data("id"),p.parentId=f.data("parent"),p.cmptId=l[f.id()],p.children=[],p.positionX=f.position("x"),p.positionY=f.position("y"),p.offsetX=0,p.offsetY=0,p.height=g.w,p.width=g.h,p.maxX=p.positionX+p.width/2,p.minX=p.positionX-p.width/2,p.maxY=p.positionY+p.height/2,p.minY=p.positionY-p.height/2,p.padLeft=parseFloat(f.style("padding")),p.padRight=parseFloat(f.style("padding")),p.padTop=parseFloat(f.style("padding")),p.padBottom=parseFloat(f.style("padding")),p.nodeRepulsion=k(r.nodeRepulsion)?r.nodeRepulsion(f):r.nodeRepulsion,o.layoutNodes.push(p),o.idToIndex[p.id]=u}for(var v=[],y=0,w=-1,E=[],u=0;u<o.nodeSize;u++){var f=o.layoutNodes[u],b=f.parentId;null!=b?o.layoutNodes[o.idToIndex[b]].children.push(f.id):(v[++w]=f.id,E.push(f.id))}for(o.graphSet.push(E);y<=w;){var A=v[y++],C=o.idToIndex[A],d=o.layoutNodes[C],_=d.children;if(_.length>0){o.graphSet.push(_);for(var u=0;u<_.length;u++)v[++w]=_[u]}}for(var u=0;u<o.graphSet.length;u++)for(var S=o.graphSet[u],h=0;h<S.length;h++){var I=o.idToIndex[S[h]];o.indexToGraph[I]=u}for(var u=0;u<o.edgeSize;u++){var T=n[u],x={};x.id=T.data("id"),x.sourceId=T.data("source"),x.targetId=T.data("target");var D=k(r.idealEdgeLength)?r.idealEdgeLength(T):r.idealEdgeLength,N=k(r.edgeElasticity)?r.edgeElasticity(T):r.edgeElasticity,M=o.idToIndex[x.sourceId],R=o.idToIndex[x.targetId];if(o.indexToGraph[M]!=o.indexToGraph[R]){for(var O=oy(x.sourceId,x.targetId,o),P=o.graphSet[O],B=0,p=o.layoutNodes[M];-1===P.indexOf(p.id);)p=o.layoutNodes[o.idToIndex[p.parentId]],B++;for(p=o.layoutNodes[R];-1===P.indexOf(p.id);)p=o.layoutNodes[o.idToIndex[p.parentId]],B++;D*=B*r.nestingFactor}x.idealLength=D,x.elasticity=N,o.layoutEdges.push(x)}return o},oy=function(e,t,r){var n=ow(e,t,0,r);return 2>n.count?0:n.graph},ow=function e(t,r,n,i){var a=i.graphSet[n];if(-1<a.indexOf(t)&&-1<a.indexOf(r))return{count:2,graph:n};for(var o=0,s=0;s<a.length;s++){var l=a[s],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(0!==c.length){var h=e(t,r,i.indexToGraph[i.idToIndex[c[0]]],i);if(0===h.count)continue;if(1!==h.count)return h;if(2==++o)break}}return{count:o,graph:n}},oE=function(e,t){for(var r=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*r,a.positionY=Math.random()*n)}},ob=function(e,t,r){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(r.forEach(function(t){var r=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,r.positionX),i.x2=Math.max(i.x2,r.positionX),i.y1=Math.min(i.y1,r.positionY),i.y2=Math.max(i.y2,r.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(r,a){var o=e.layoutNodes[e.idToIndex[r.data("id")]];if(!t.boundingBox)return{x:o.positionX,y:o.positionY};var s=(o.positionX-i.x1)/i.w,l=(o.positionY-i.y1)/i.h;return{x:n.x1+s*n.w,y:n.y1+l*n.h}}},oA=function(e,t,r){var n=r.layout,i=r.eles.nodes(),a=ob(e,r,i);i.positions(a),!0!==e.ready&&(e.ready=!0,n.one("layoutready",r.ready),n.emit({type:"layoutready",layout:this}))},oC=function(e,t,r){o_(e,t),oD(e),oN(e,t),oM(e),oR(e)},o_=function(e,t){for(var r=0;r<e.graphSet.length;r++)for(var n=e.graphSet[r],i=n.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[n[a]]],s=a+1;s<i;s++)oI(o,e.layoutNodes[e.idToIndex[n[s]]],e,t)},oS=function(e){return-e+2*e*Math.random()},oI=function(e,t,r,n){if(e.cmptId===t.cmptId||r.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=oS(1),a=oS(1));var o=oT(e,t,i,a);if(o>0)var s=n.nodeOverlap*o,l=Math.sqrt(i*i+a*a),u=s*i/l,c=s*a/l;else var h=ox(e,i,a),d=ox(t,-1*i,-1*a),f=d.x-h.x,g=d.y-h.y,p=f*f+g*g,l=Math.sqrt(p),s=(e.nodeRepulsion+t.nodeRepulsion)/p,u=s*f/l,c=s*g/l;e.isLocked||(e.offsetX-=u,e.offsetY-=c),t.isLocked||(t.offsetX+=u,t.offsetY+=c)}},oT=function(e,t,r,n){if(r>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ox=function(e,t,r){var n=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=r/t,l=a/o,u={};return 0===t&&0<r||0===t&&0>r?(u.x=n,u.y=i+a/2):0<t&&-1*l<=s&&s<=l?(u.x=n+o/2,u.y=i+o*r/2/t):0>t&&-1*l<=s&&s<=l?(u.x=n-o/2,u.y=i-o*r/2/t):0<r&&(s<=-1*l||s>=l)?(u.x=n+a*t/2/r,u.y=i+a/2):0>r&&(s<=-1*l||s>=l)&&(u.x=n-a*t/2/r,u.y=i-a/2),u},oD=function(e,t){for(var r=0;r<e.edgeSize;r++){var n=e.layoutEdges[r],i=e.idToIndex[n.sourceId],a=e.layoutNodes[i],o=e.idToIndex[n.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,u=s.positionY-a.positionY;if(0!==l||0!==u){var c=ox(a,l,u),h=ox(s,-1*l,-1*u),d=h.x-c.x,f=h.y-c.y,g=Math.sqrt(d*d+f*f),p=Math.pow(n.idealLength-g,2)/n.elasticity;if(0!==g)var v=p*d/g,y=p*f/g;else var v=0,y=0;a.isLocked||(a.offsetX+=v,a.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},oN=function(e,t){if(0!==t.gravity)for(var r=0;r<e.graphSet.length;r++){var n=e.graphSet[r],i=n.length;if(0===r)var a=e.clientHeight/2,o=e.clientWidth/2;else var s=e.layoutNodes[e.idToIndex[n[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]],a=l.positionX,o=l.positionY;for(var u=0;u<i;u++){var c=e.layoutNodes[e.idToIndex[n[u]]];if(!c.isLocked){var h=a-c.positionX,d=o-c.positionY,f=Math.sqrt(h*h+d*d);if(f>1){var g=t.gravity*h/f,p=t.gravity*d/f;c.offsetX+=g,c.offsetY+=p}}}}},oM=function(e,t){var r=[],n=0,i=-1;for(r.push.apply(r,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var a=r[n++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var d=e.layoutNodes[e.idToIndex[l[h]]];d.offsetX+=u,d.offsetY+=c,r[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},oR=function(e,t){for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];if(!(0<n.children.length)&&!n.isLocked){var i=oO(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,oP(n,e)}}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},oO=function(e,t,r){var n=Math.sqrt(e*e+t*t);if(n>r)var i={x:r*e/n,y:r*t/n};else var i={x:e,y:t};return i},oP=function e(t,r){var n=t.parentId;if(null!=n){var i=r.layoutNodes[r.idToIndex[n]],a=!1;if((null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,a=!0),(null==i.maxY||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,a=!0),a)return e(i,r)}},oB=function(e,t){for(var r=e.layoutNodes,n=[],i=0;i<r.length;i++){var a=r[i],o=a.cmptId;(n[o]=n[o]||[]).push(a)}for(var s=0,i=0;i<n.length;i++){var l=n[i];if(l){l.x1=1/0,l.x2=-1/0,l.y1=1/0,l.y2=-1/0;for(var u=0;u<l.length;u++){var c=l[u];l.x1=Math.min(l.x1,c.positionX-c.width/2),l.x2=Math.max(l.x2,c.positionX+c.width/2),l.y1=Math.min(l.y1,c.positionY-c.height/2),l.y2=Math.max(l.y2,c.positionY+c.height/2)}l.w=l.x2-l.x1,l.h=l.y2-l.y1,s+=l.w*l.h}}n.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var h=0,d=0,f=0,g=0,p=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var l=n[i];if(l){for(var u=0;u<l.length;u++){var c=l[u];c.isLocked||(c.positionX+=h-l.x1,c.positionY+=d-l.y1)}h+=l.w+t.componentSpacing,f+=l.w+t.componentSpacing,g=Math.max(g,l.h),f>p&&(d+=g+t.componentSpacing,h=0,f=0,g=0)}}},oL={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ok(e){this.options=eo({},oL,e)}ok.prototype.run=function(){var e=this.options,t=e.cy,r=e.eles,n=r.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=tj(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)r.nodes().layoutPositions(this,e,function(e){return{x:i.x1,y:i.y1}});else{var a=n.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),u=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},c=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},h=e.rows,d=null!=e.cols?e.cols:e.columns;if(null!=h&&null!=d)s=h,l=d;else if(null!=h&&null==d)l=Math.ceil(a/(s=h));else if(null==h&&null!=d)s=Math.ceil(a/(l=d));else if(l*s>a){var f=u(),g=c();(f-1)*g>=a?u(f-1):(g-1)*f>=a&&c(g-1)}else for(;l*s<a;){var p=u(),v=c();(v+1)*p>=a?c(v+1):u(p+1)}var y=i.w/l,w=i.h/s;if(e.condense&&(y=0,w=0),e.avoidOverlap)for(var E=0;E<n.length;E++){var b=n[E],A=b._private.position;(null==A.x||null==A.y)&&(A.x=0,A.y=0);var C=b.layoutDimensions(e),_=e.avoidOverlapPadding,S=C.w+_,I=C.h+_;y=Math.max(y,S),w=Math.max(w,I)}for(var T={},x=function(e,t){return!!T["c-"+e+"-"+t]},D=function(e,t){T["c-"+e+"-"+t]=!0},N=0,M=0,R=function(){++M>=l&&(M=0,N++)},O={},P=0;P<n.length;P++){var B=n[P],L=e.position(B);if(L&&(void 0!==L.row||void 0!==L.col)){var k={row:L.row,col:L.col};if(void 0===k.col)for(k.col=0;x(k.row,k.col);)k.col++;else if(void 0===k.row)for(k.row=0;x(k.row,k.col);)k.row++;O[B.id()]=k,D(k.row,k.col)}}n.layoutPositions(this,e,function(e,t){if(e.locked()||e.isParent())return!1;var r,n,a=O[e.id()];if(a)r=a.col*y+y/2+i.x1,n=a.row*w+w/2+i.y1;else{for(;x(N,M);)R();r=M*y+y/2+i.x1,n=N*w+w/2+i.y1,D(N,M),R()}return{x:r,y:n}})}return this};var oF={ready:function(){},stop:function(){}};function oz(e){this.options=eo({},oF,e)}oz.prototype.run=function(){var e=this.options,t=e.eles;return e.cy,this.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},oz.prototype.stop=function(){return this};var oU={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oV(e){this.options=eo({},oU,e)}oV.prototype.run=function(){var e=this.options,t=e.eles.nodes(),r=k(e.positions);return t.layoutPositions(this,e,function(t,n){var i=function(t){if(null==e.positions){var n;return{x:(n=t.position()).x,y:n.y}}if(r)return e.positions(t);var i=e.positions[t._private.data.id];return null==i?null:i}(t);return!t.locked()&&null!=i&&i}),this};var oH={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oj(e){this.options=eo({},oH,e)}oj.prototype.run=function(){var e=this.options,t=e.cy,r=e.eles,n=tj(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return r.nodes().layoutPositions(this,e,function(e,t){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}}),this};var oY=[{name:"breadthfirst",impl:oc},{name:"circle",impl:od},{name:"concentric",impl:og},{name:"cose",impl:om},{name:"grid",impl:ok},{name:"null",impl:oz},{name:"preset",impl:oV},{name:"random",impl:oj}];function oX(e){this.options=e,this.notifications=0}var oG=function(){},oW=function(){throw Error("A headless instance can not render images")};oX.prototype={recalculateRenderedStyle:oG,notify:function(){this.notifications++},init:oG,isHeadless:function(){return!0},png:oW,jpg:oW};var oq={};oq.arrowShapeWidth=.3,oq.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,r=function(e,t,r,n,i,a,o){var s=i.x-r/2-o,l=i.x+r/2+o,u=i.y-r/2-o,c=i.y+r/2+o;return s<=e&&e<=l&&u<=t&&t<=c},n=function(e,t,r,n,i){var a=e*Math.cos(n)-t*Math.sin(n),o=e*Math.sin(n)+t*Math.cos(n);return{x:a*r+i.x,y:o*r+i.y}},i=function(e,t,r,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(n(s,l,t,r,i))}return a},a=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(n.x,n.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(n,s){L(s)&&(s=e[s]),e[n]=eo({name:n,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,r,n,o,s){return t6(e,t,a(i(this.points,r+2*s,n,o)))},roughCollide:r,draw:function(e,r,n,a){var o=i(this.points,r,n,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:e8,roughCollide:e8,draw:e5,spacing:e6,gap:e6}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(e,r,a,o,s){var l=i(this.points,r,a,o),u=this.controlPoint,c=n(u[0],u[1],r,a,o);t.arrowShapeImpl(this.name)(e,l,c)},gap:function(e){return .8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,r,n,o,s,l){var u=a(i(this.points,r+2*l,n,o)),c=a(i(this.pointsTee,r+2*l,n,o));return t6(e,t,u)||t6(e,t,c)},draw:function(e,r,n,a,o){var s=i(this.points,r,n,a),l=i(this.pointsTee,r,n,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,r,n,o,s,l){var u=Math.pow(o.x-e,2)+Math.pow(o.y-t,2)<=Math.pow((r+2*l)*this.radius,2);return t6(e,t,a(i(this.points,r+2*l,n,o)))||u},draw:function(e,r,n,a,o){var s=i(this.pointsTr,r,n,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*r)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var r=this.baseCrossLinePts.slice(),n=t/e;return r[3]=r[3]-n,r[5]=r[5]-n,r},collide:function(e,t,r,n,o,s,l){var u=a(i(this.points,r+2*l,n,o)),c=a(i(this.crossLinePts(r,s),r+2*l,n,o));return t6(e,t,u)||t6(e,t,c)},draw:function(e,r,n,a,o){var s=i(this.points,r,n,a),l=i(this.crossLinePts(r,o),r,n,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return .525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,r,n,i,a,o){return Math.pow(i.x-e,2)+Math.pow(i.y-t,2)<=Math.pow((r+2*o)*this.radius,2)},draw:function(e,r,n,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*r)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})};var oZ={};oZ.projectIntoViewport=function(e,t){var r=this.cy,n=this.findContainerClientCoords(),i=n[0],a=n[1],o=n[4],s=r.pan(),l=r.zoom();return[((e-i)/o-s.x)/l,((t-a)/o-s.y)/l]},oZ.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),r=this.cy.window().getComputedStyle(e),n=function(e){return parseFloat(r.getPropertyValue(e))},i={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},a={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=a.left+a.right,h=t.width/(o+c),d=t.left+i.left+a.left,f=t.top+i.top+a.top;return this.containerBB=[d,f,o-l,s-u,h]},oZ.invalidateContainerClientCoordsCache=function(){this.containerBB=null},oZ.findNearestElement=function(e,t,r,n){return this.findNearestElements(e,t,r,n)[0]},oZ.findNearestElements=function(e,t,r,n){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),h=s.cy.hasCompoundNodes(),d=(n?24:8)/c,f=(n?8:2)/c,g=(n?8:2)/c,p=1/0;function v(e,t){if(e.isNode())if(a)return;else a=e,u.push(e);if(e.isEdge()&&(null==t||t<p))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value){for(var r=0;r<u.length;r++)if(u[r].isEdge()){u[r]=e,i=e,p=null!=t?t:p;break}}}else u.push(e),i=e,p=null!=t?t:p}function y(r){var n=r.outerWidth()+2*f,i=r.outerHeight()+2*f,a=n/2,l=i/2,u=r.position();if(u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(r)].checkPoint(e,t,0,n,i,u.x,u.y))return v(r,0),!0}r&&(l=l.interactive);function w(r,n){var i,a=r._private;i=n?n+"-":"",r.boundingBox();var o=a.labelBounds[n||"main"],s=r.pstyle(i+"label").value;if("yes"===r.pstyle("text-events").strValue&&s){var l=tu(a.rscratch,"labelX",n),u=tu(a.rscratch,"labelY",n),c=tu(a.rscratch,"labelAngle",n),h=r.pstyle(i+"text-margin-x").pfValue,d=r.pstyle(i+"text-margin-y").pfValue,f=o.x1-g-h,p=o.x2+g-h,y=o.y1-g-d,w=o.y2+g-d;if(c){var E=Math.cos(c),b=Math.sin(c),A=function(e,t){return{x:(e-=l)*E-(t-=u)*b+l,y:e*b+t*E+u}},C=A(f,y),_=A(f,w),S=A(p,y),I=A(p,w);if(t6(e,t,[C.x+h,C.y+d,S.x+h,S.y+d,I.x+h,I.y+d,_.x+h,_.y+d]))return v(r),!0}else if(tK(o,e,t))return v(r),!0}}for(var E=l.length-1;E>=0;E--){var b=l[E];b.isNode()?y(b)||w(b):function(r){var n,i=r._private,a=i.rscratch,l=r.pstyle("width").pfValue,c=r.pstyle("arrow-scale").value,f=l/2+d,g=f*f,p=2*f,w=i.source,E=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var b=a.allpts,A=0;A+3<b.length;A+=2)if(t1(e,t,b[A],b[A+1],b[A+2],b[A+3],p)&&g>(n=t8(e,t,b[A],b[A+1],b[A+2],b[A+3])))return v(r,n),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType){for(var b=a.allpts,A=0;A+5<a.allpts.length;A+=4)if(t0(e,t,b[A],b[A+1],b[A+2],b[A+3],b[A+4],b[A+5],p)&&g>(n=t4(e,t,b[A],b[A+1],b[A+2],b[A+3],b[A+4],b[A+5])))return v(r,n),!0}for(var w=w||i.source,E=E||i.target,C=o.getArrowWidth(l,c),_=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}],A=0;A<_.length;A++){var S=_[A],I=s.arrowShapes[r.pstyle(S.name+"-arrow-shape").value],T=r.pstyle("width").pfValue;if(I.roughCollide(e,t,C,S.angle,{x:S.x,y:S.y},T,d)&&I.collide(e,t,C,S.angle,{x:S.x,y:S.y},T,d))return v(r),!0}h&&u.length>0&&(y(w),y(E))}(b)||w(b)||w(b,"source")||w(b,"target")}return u},oZ.getAllInBox=function(e,t,r,n){var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,r),s=Math.max(e,r),l=Math.min(t,n),u=Math.max(t,n);e=o,r=s;for(var c=tj({x1:e,y1:t=l,x2:r,y2:n=u}),h=0;h<i.length;h++){var d=i[h];if(d.isNode()){var f=d.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});tQ(c,f)&&!t$(f,c)&&a.push(d)}else{var g=d._private,p=g.rscratch;if(null!=p.startX&&null!=p.startY&&!tK(c,p.startX,p.startY)||null!=p.endX&&null!=p.endY&&!tK(c,p.endX,p.endY))continue;if("bezier"===p.edgeType||"multibezier"===p.edgeType||"self"===p.edgeType||"compound"===p.edgeType||"segments"===p.edgeType||"haystack"===p.edgeType){for(var v,y=g.rstyle.bezierPts||g.rstyle.linePts||g.rstyle.haystackPts,w=!0,E=0;E<y.length;E++)if(!tK(c,(v=y[E]).x,v.y)){w=!1;break}w&&a.push(d)}else("haystack"===p.edgeType||"straight"===p.edgeType)&&a.push(d)}}return a};var oQ={};oQ.calculateArrowAngles=function(e){var t=e._private.rscratch,r="haystack"===t.edgeType,n="bezier"===t.edgeType,i="multibezier"===t.edgeType,a="segments"===t.edgeType,o="compound"===t.edgeType,s="self"===t.edgeType;if(r?(w=t.haystackPts[0],E=t.haystackPts[1],b=t.haystackPts[2],A=t.haystackPts[3]):(w=t.arrowStartX,E=t.arrowStartY,b=t.arrowEndX,A=t.arrowEndY),h=t.midX,d=t.midY,a)v=w-t.segpts[0],y=E-t.segpts[1];else if(i||o||s||n){var l=t.allpts,u=tz(l[0],l[2],l[4],.1),c=tz(l[1],l[3],l[5],.1);v=w-u,y=E-c}else v=w-h,y=E-d;t.srcArrowAngle=tO(v,y);var h=t.midX,d=t.midY;if(r&&(h=(w+b)/2,d=(E+A)/2),v=b-w,y=A-E,a){var l=t.allpts;if(l.length/2%2==0){var f=l.length/2,g=f-2;v=l[f]-l[g],y=l[f+1]-l[g+1]}else{var f=l.length/2-1,g=f-2,p=f+2;v=l[f]-l[g],y=l[f+1]-l[g+1]}}else if(i||o||s){var v,y,w,E,b,A,h,d,C,_,S,I,l=t.allpts;if(t.ctrlpts.length/2%2==0){var T=l.length/2-1,x=T+2,D=x+2;C=tz(l[T],l[x],l[D],0),_=tz(l[T+1],l[x+1],l[D+1],0),S=tz(l[T],l[x],l[D],1e-4),I=tz(l[T+1],l[x+1],l[D+1],1e-4)}else{var x=l.length/2-1,T=x-2,D=x+2;C=tz(l[T],l[x],l[D],.4999),_=tz(l[T+1],l[x+1],l[D+1],.4999),S=tz(l[T],l[x],l[D],.5),I=tz(l[T+1],l[x+1],l[D+1],.5)}v=S-C,y=I-_}if(t.midtgtArrowAngle=tO(v,y),t.midDispX=v,t.midDispY=y,v*=-1,y*=-1,a){var l=t.allpts;if(l.length/2%2==0);else{var f=l.length/2-1,p=f+2;v=-(l[p]-l[f]),y=-(l[p+1]-l[f+1])}}if(t.midsrcArrowAngle=tO(v,y),a)v=b-t.segpts[t.segpts.length-2],y=A-t.segpts[t.segpts.length-1];else if(i||o||s||n){var l=t.allpts,N=l.length,u=tz(l[N-6],l[N-4],l[N-2],.9),c=tz(l[N-5],l[N-3],l[N-1],.9);v=b-u,y=A-c}else v=b-h,y=A-d;t.tgtArrowAngle=tO(v,y)},oQ.getArrowWidth=oQ.getArrowHeight=function(e,t){var r=this.arrowWidthCache=this.arrowWidthCache||{},n=r[e+", "+t];return n||(n=Math.max(Math.pow(13.37*e,.9),29)*t,r[e+", "+t]=n),n};var oK={};function o$(e){var t=[];if(null!=e){for(var r=0;r<e.length;r+=2){var n=e[r],i=e[r+1];t.push({x:n,y:i})}return t}}oK.findMidptPtsEtc=function(e,t){var r,n=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,s=e.pstyle("source-endpoint"),l=e.pstyle("target-endpoint"),u=null!=s.units&&null!=l.units;switch(e.pstyle("edge-distances").value){case"node-position":r=n;break;case"intersection":r=i;break;case"endpoints":if(u){var c,h,d,f=o(this.manualEndptToPx(e.source()[0],s),2),g=f[0],p=f[1],v=o(this.manualEndptToPx(e.target()[0],l),2),y=v[0],w=v[1];c=w-p,d=Math.sqrt((h=y-g)*h+c*c),a={x:-c/d,y:h/d},r={x1:g,y1:p,x2:y,y2:w}}else te("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),r=i}return{midptPts:r,vectorNormInverse:a}},oK.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var r=e[t],n=r._private,i=n.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},i.target={x:Math.cos(a=2*Math.random()*Math.PI),y:Math.sin(a)}}var o=n.source,s=n.target,l=o.position(),u=s.position(),c=o.width(),h=s.width(),d=o.height(),f=s.height(),g=r.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*c*g+l.x,i.source.y*d*g+l.y,i.target.x*h*g+u.x,i.target.y*f*g+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}},oK.findSegmentsPoints=function(e,t){var r=e._private.rscratch,n=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=Math.min(n.pfValue.length,i.pfValue.length);r.edgeType="segments",r.segpts=[];for(var o=0;o<a;o++){var s=n.pfValue[o],l=i.pfValue[o],u=1-s,c=this.findMidptPtsEtc(e,t),h=c.midptPts,d=c.vectorNormInverse,f={x:h.x1*u+h.x2*s,y:h.y1*u+h.y2*s};r.segpts.push(f.x+d.x*l,f.y+d.y*l)}},oK.findLoopPoints=function(e,t,r,n){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=r,f=h;n&&(d=0,f=l);var g=u-Math.PI/2,p=g-c/2,v=g+c/2,y=String(u+"_"+c);d=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(p)*f*(d/3+1),o.y+1.4*Math.sin(p)*f*(d/3+1),o.x+1.4*Math.cos(v)*f*(d/3+1),o.y+1.4*Math.sin(v)*f*(d/3+1)]},oK.findCompoundLoopPoints=function(e,t,r,n){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),f=d?d.pfValue[0]:void 0,g=r,p=h;n&&(g=0,p=f);var v={x:a.x-s/2,y:a.y-l/2},y={x:o.x-u/2,y:o.y-c/2},w={x:Math.min(v.x,y.x),y:Math.min(v.y,y.y)},E=Math.max(.5,Math.log(.01*s)),b=Math.max(.5,Math.log(.01*u));i.ctrlpts=[w.x,w.y-1.7995514309304248*p*(g/3+1)*E,w.x-1.7995514309304248*p*(g/3+1)*b,w.y]},oK.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},oK.findBezierPoints=function(e,t,r,n,i){var a=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,c=s?s.pfValue[0]:void 0,h=l.value[0];a.edgeType=n?"multibezier":"bezier",a.ctrlpts=[];for(var d=0;d<u;d++){var f=(.5-t.eles.length/2+r)*o*(i?-1:1),g=void 0,p=tB(f);n&&(c=s?s.pfValue[d]:o,h=l.value[d]);var v=void 0!==(g=n?c:void 0!==c?p*c:void 0)?g:f,y=1-h,w=h,E=this.findMidptPtsEtc(e,t),b=E.midptPts,A=E.vectorNormInverse,C={x:b.x1*y+b.x2*w,y:b.y1*y+b.y2*w};a.ctrlpts.push(C.x+A.x*v,C.y+A.y*v)}},oK.findTaxiPoints=function(e,t){var r,n=e._private.rscratch;n.edgeType="segments";var i="vertical",a="horizontal",o="leftward",s="rightward",l="downward",u="upward",c=t.posPts,h=t.srcW,d=t.srcH,f=t.tgtW,g=t.tgtH,p="node-position"!==e.pstyle("edge-distances").value,v=e.pstyle("taxi-direction").value,y=v,w=e.pstyle("taxi-turn"),E="%"===w.units,b=w.pfValue,A=e.pstyle("taxi-turn-min-distance").pfValue,C=c.x2-c.x1,_=c.y2-c.y1,S=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},I=S(C,p?(h+f)/2:0),T=S(_,p?(d+g)/2:0),x=!1;"auto"===y?v=Math.abs(I)>Math.abs(T)?a:i:y===u||y===l?(v=i,x=!0):(y===o||y===s)&&(v=a,x=!0);var D=v===i,N=D?T:I,M=D?_:C,R=tB(M),O=!1;!(x&&(E||b<0))&&(y===l&&M<0||y===u&&M>0||y===o&&M>0||y===s&&M<0)&&(R*=-1,N=R*Math.abs(N),O=!0);var P=function(e){return Math.abs(e)<A||Math.abs(e)>=Math.abs(N)},B=P(r=E?(b<0?1+b:b)*N:(b<0?N:0)+b*R),L=P(Math.abs(N)-Math.abs(r));if((B||L)&&!O)if(D){var k=Math.abs(C)<=f/2;if(Math.abs(M)<=d/2){var F=(c.x1+c.x2)/2;n.segpts=[F,c.y1,F,c.y2]}else if(k){var z=(c.y1+c.y2)/2;n.segpts=[c.x1,z,c.x2,z]}else n.segpts=[c.x1,c.y2]}else{var U=Math.abs(_)<=g/2;if(Math.abs(M)<=h/2){var V=(c.y1+c.y2)/2;n.segpts=[c.x1,V,c.x2,V]}else if(U){var H=(c.x1+c.x2)/2;n.segpts=[H,c.y1,H,c.y2]}else n.segpts=[c.x2,c.y1]}else if(D){var j=c.y1+r+(p?d/2*R:0);n.segpts=[c.x1,j,c.x2,j]}else{var Y=c.x1+r+(p?h/2*R:0);n.segpts=[Y,c.y1,Y,c.y2]}},oK.tryToCorrectInvalidPoints=function(e,t){var r=e._private.rscratch;if("bezier"===r.edgeType){var n=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=!U(r.startX)||!U(r.startY),d=!U(r.arrowStartX)||!U(r.arrowStartY),f=!U(r.endX)||!U(r.endY),g=!U(r.arrowEndX)||!U(r.arrowEndY),p=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),v=tL({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),y=v<p,w=tL({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),E=w<p,b=!1;if(h||d||y){b=!0;var A={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},C=Math.sqrt(A.x*A.x+A.y*A.y),_={x:A.x/C,y:A.y/C},S=Math.max(a,o),I={x:r.ctrlpts[0]+2*_.x*S,y:r.ctrlpts[1]+2*_.y*S},T=u.intersectLine(n.x,n.y,a,o,I.x,I.y,0);y?(r.ctrlpts[0]=r.ctrlpts[0]+_.x*(p-v),r.ctrlpts[1]=r.ctrlpts[1]+_.y*(p-v)):(r.ctrlpts[0]=T[0]+_.x*p,r.ctrlpts[1]=T[1]+_.y*p)}if(f||g||E){b=!0;var x={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},D=Math.sqrt(x.x*x.x+x.y*x.y),N={x:x.x/D,y:x.y/D},M=Math.max(a,o),R={x:r.ctrlpts[0]+2*N.x*M,y:r.ctrlpts[1]+2*N.y*M},O=c.intersectLine(i.x,i.y,s,l,R.x,R.y,0);E?(r.ctrlpts[0]=r.ctrlpts[0]+N.x*(p-w),r.ctrlpts[1]=r.ctrlpts[1]+N.y*(p-w)):(r.ctrlpts[0]=O[0]+N.x*p,r.ctrlpts[1]=O[1]+N.y*p)}b&&this.findEndpoints(e)}},oK.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var r,n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);(t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0)?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,t.midX=tz(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=tz(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType)if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.segpts.length%4==0){var i=t.segpts.length/2,a=i-2;t.midX=(t.segpts[a]+t.segpts[i])/2,t.midY=(t.segpts[a+1]+t.segpts[i+1])/2}else{var o=t.segpts.length/2-1;t.midX=t.segpts[o],t.midY=t.segpts[o+1]}},oK.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||U(t.startX)&&U(t.startY)&&U(t.endX)&&U(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,te("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},oK.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var r=this,n=r.cy.hasCompoundNodes(),i={map:new td,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var r=this.map.get(e[0]);null==r&&(r=new td,this.map.set(e[0],r)),r.set(e[1],t)}},a=[],o=[],s=0;s<e.length;s++){var l=e[s],u=l._private,c=l.pstyle("curve-style").value;if(!l.removed()&&l.takesUpSpace()){if("haystack"===c){o.push(l);continue}var h="unbundled-bezier"===c||"segments"===c||"straight"===c||"straight-triangle"===c||"taxi"===c,d="unbundled-bezier"===c||"bezier"===c,f=u.source,g=u.target,p=[f.poolIndex(),g.poolIndex()].sort(),v=i.get(p);null==v&&(v={eles:[]},i.set(p,v),a.push(p)),v.eles.push(l),h&&(v.hasUnbundled=!0),d&&(v.hasBezier=!0)}}for(var y=0;y<a.length;y++)!function(e){var o=a[e],s=i.get(o),l=void 0;if(!s.hasUnbundled){var u=s.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});ts(s.eles),u.forEach(function(e){return s.eles.push(e)}),s.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var c=s.eles[0],h=c.source(),d=c.target();if(h.poolIndex()>d.poolIndex()){var f=h;h=d,d=f}var g=s.srcPos=h.position(),p=s.tgtPos=d.position(),v=s.srcW=h.outerWidth(),y=s.srcH=h.outerHeight(),w=s.tgtW=d.outerWidth(),E=s.tgtH=d.outerHeight(),b=s.srcShape=r.nodeShapes[t.getNodeShape(h)],A=s.tgtShape=r.nodeShapes[t.getNodeShape(d)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var C=0;C<s.eles.length;C++){var _=s.eles[C],S=_[0]._private.rscratch,I=_.pstyle("curve-style").value,T="unbundled-bezier"===I||"segments"===I||"taxi"===I,x=!h.same(_.source());if(!s.calculatedIntersection&&h!==d&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var D=b.intersectLine(g.x,g.y,v,y,p.x,p.y,0),N=s.srcIntn=D,M=A.intersectLine(p.x,p.y,w,E,g.x,g.y,0),R=s.tgtIntn=M,O=s.intersectionPts={x1:D[0],x2:M[0],y1:D[1],y2:M[1]},P=s.posPts={x1:g.x,x2:p.x,y1:g.y,y2:p.y},B=M[1]-D[1],L=M[0]-D[0],k=Math.sqrt(L*L+B*B),F=s.vector={x:L,y:B},z=s.vectorNorm={x:F.x/k,y:F.y/k},V={x:-z.y,y:z.x};s.nodesOverlap=!U(k)||A.checkPoint(D[0],D[1],0,w,E,p.x,p.y)||b.checkPoint(M[0],M[1],0,v,y,g.x,g.y),s.vectorNormInverse=V,l={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:p,tgtPos:g,srcW:w,srcH:E,tgtW:v,tgtH:y,srcIntn:R,tgtIntn:N,srcShape:A,tgtShape:b,posPts:{x1:P.x2,y1:P.y2,x2:P.x1,y2:P.y1},intersectionPts:{x1:O.x2,y1:O.y2,x2:O.x1,y2:O.y1},vector:{x:-F.x,y:-F.y},vectorNorm:{x:-z.x,y:-z.y},vectorNormInverse:{x:-V.x,y:-V.y}}}var H=x?l:s;S.nodesOverlap=H.nodesOverlap,S.srcIntn=H.srcIntn,S.tgtIntn=H.tgtIntn,n&&(h.isParent()||h.isChild()||d.isParent()||d.isChild())&&(h.parents().anySame(d)||d.parents().anySame(h)||h.same(d)&&h.isParent())?t.findCompoundLoopPoints(_,H,C,T):h===d?t.findLoopPoints(_,H,C,T):"segments"===I?t.findSegmentsPoints(_,H):"taxi"===I?t.findTaxiPoints(_,H):"straight"!==I&&(T||s.eles.length%2!=1||C!==Math.floor(s.eles.length/2))?t.findBezierPoints(_,H,C,T,x):t.findStraightEdgePoints(_),t.findEndpoints(_),t.tryToCorrectInvalidPoints(_,H),t.checkForInvalidEdgeWarning(_),t.storeAllpts(_),t.storeEdgeProjections(_),t.calculateArrowAngles(_),t.recalculateEdgeLabelProjections(_),t.calculateLabelAngles(_)}}(y);this.findHaystackPoints(o)}},oK.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if("segments"===t.edgeType)return this.recalculateRenderedStyle(e),o$(t.segpts)},oK.getControlPoints=function(e){var t=e[0]._private.rscratch,r=t.edgeType;if("bezier"===r||"multibezier"===r||"self"===r||"compound"===r)return this.recalculateRenderedStyle(e),o$(t.ctrlpts)},oK.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var oJ={};oJ.manualEndptToPx=function(e,t){var r=e.position(),n=e.outerWidth(),i=e.outerHeight();if(2===t.value.length){var a=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(a[0]=a[0]*n),"%"===t.units[1]&&(a[1]=a[1]*i),a[0]+=r.x,a[1]+=r.y,a}var o=t.pfValue[0];o=-Math.PI/2+o;var s=2*Math.max(n,i),l=[r.x+Math.cos(o)*s,r.y+Math.sin(o)*s];return this.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,n,i,l[0],l[1],0)},oJ.findEndpoints=function(e){var t,r,n,i,a,o=e.source()[0],s=e.target()[0],l=o.position(),u=s.position(),c=e.pstyle("target-arrow-shape").value,h=e.pstyle("source-arrow-shape").value,d=e.pstyle("target-distance-from-node").pfValue,f=e.pstyle("source-distance-from-node").pfValue,g=e.pstyle("curve-style").value,p=e._private.rscratch,v=p.edgeType,y="self"===v||"compound"===v,w="bezier"===v||"multibezier"===v||y,E="bezier"!==v,b="straight"===v||"segments"===v,A="segments"===v,C=y||"taxi"===g,_=e.pstyle("source-endpoint"),S=C?"outside-to-node":_.value,I=e.pstyle("target-endpoint"),T=C?"outside-to-node":I.value;if(p.srcManEndpt=_,p.tgtManEndpt=I,w){var x=[p.ctrlpts[0],p.ctrlpts[1]];r=E?[p.ctrlpts[p.ctrlpts.length-2],p.ctrlpts[p.ctrlpts.length-1]]:x,n=x}else if(b){var D=A?p.segpts.slice(0,2):[u.x,u.y];r=A?p.segpts.slice(p.segpts.length-2):[l.x,l.y],n=D}if("inside-to-node"===T)t=[u.x,u.y];else if(I.units)t=this.manualEndptToPx(s,I);else if("outside-to-line"===T)t=p.tgtIntn;else if("outside-to-node"===T||"outside-to-node-or-label"===T?i=r:("outside-to-line"===T||"outside-to-line-or-label"===T)&&(i=[l.x,l.y]),t=this.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),i[0],i[1],0),"outside-to-node-or-label"===T||"outside-to-line-or-label"===T){var N=s._private.rscratch,M=N.labelWidth,R=N.labelHeight,O=N.labelX,P=N.labelY,B=M/2,L=R/2,k=s.pstyle("text-valign").value;"top"===k?P-=L:"bottom"===k&&(P+=L);var F=s.pstyle("text-halign").value;"left"===F?O-=B:"right"===F&&(O+=B);var z=ro(i[0],i[1],[O-B,P-L,O+B,P-L,O+B,P+L,O-B,P+L],u.x,u.y);if(z.length>0){var V=tk(l,tx(t)),H=tk(l,tx(z)),j=V;H<V&&(t=z,j=H),z.length>2&&tk(l,{x:z[2],y:z[3]})<j&&(t=[z[2],z[3]])}}var Y=rl(t,r,this.arrowShapes[c].spacing(e)+d),X=rl(t,r,this.arrowShapes[c].gap(e)+d);if(p.endX=X[0],p.endY=X[1],p.arrowEndX=Y[0],p.arrowEndY=Y[1],"inside-to-node"===S)t=[l.x,l.y];else if(_.units)t=this.manualEndptToPx(o,_);else if("outside-to-line"===S)t=p.srcIntn;else if("outside-to-node"===S||"outside-to-node-or-label"===S?a=n:("outside-to-line"===S||"outside-to-line-or-label"===S)&&(a=[u.x,u.y]),t=this.nodeShapes[this.getNodeShape(o)].intersectLine(l.x,l.y,o.outerWidth(),o.outerHeight(),a[0],a[1],0),"outside-to-node-or-label"===S||"outside-to-line-or-label"===S){var G=o._private.rscratch,W=G.labelWidth,q=G.labelHeight,Z=G.labelX,Q=G.labelY,K=W/2,$=q/2,J=o.pstyle("text-valign").value;"top"===J?Q-=$:"bottom"===J&&(Q+=$);var ee=o.pstyle("text-halign").value;"left"===ee?Z-=K:"right"===ee&&(Z+=K);var et=ro(a[0],a[1],[Z-K,Q-$,Z+K,Q-$,Z+K,Q+$,Z-K,Q+$],l.x,l.y);if(et.length>0){var er=tk(u,tx(t)),en=tk(u,tx(et)),ei=er;en<er&&(t=[et[0],et[1]],ei=en),et.length>2&&tk(u,{x:et[2],y:et[3]})<ei&&(t=[et[2],et[3]])}}var ea=rl(t,n,this.arrowShapes[h].spacing(e)+f),eo=rl(t,n,this.arrowShapes[h].gap(e)+f);p.startX=eo[0],p.startY=eo[1],p.arrowStartX=ea[0],p.arrowStartY=ea[1],(w||E||b)&&(U(p.startX)&&U(p.startY)&&U(p.endX)&&U(p.endY)?p.badLine=!1:p.badLine=!0)},oJ.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},oJ.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}};var o1={};o1.storeEdgeProjections=function(e){var t=e._private,r=t.rscratch,n=r.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===n||"bezier"===n||"self"===n||"compound"===n){t.rstyle.bezierPts=[];for(var i=0;i+5<r.allpts.length;i+=4)!function(e,t,r){for(var n=function(e,t,r,n){return tz(e,t,r,n)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:n(r[0],r[2],r[4],o),y:n(r[1],r[3],r[5],o)})}}(this,e,r.allpts.slice(i,i+6))}else if("segments"===n)for(var a=t.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)a.push({x:r.allpts[i],y:r.allpts[i+1]});else if("haystack"===n){var o=r.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},o1.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var o0={};o0.recalculateNodeLabelProjection=function(e){var t,r;if(!W(e.pstyle("label").strValue)){var n=e._private,i=e.width(),a=e.height(),o=e.padding(),s=e.position(),l=e.pstyle("text-halign").strValue,u=e.pstyle("text-valign").strValue,c=n.rscratch,h=n.rstyle;switch(l){case"left":t=s.x-i/2-o;break;case"right":t=s.x+i/2+o;break;default:t=s.x}switch(u){case"top":r=s.y-a/2-o;break;case"bottom":r=s.y+a/2+o;break;default:r=s.y}c.labelX=t,c.labelY=r,h.labelX=t,h.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var o2=function(e,t){var r=Math.atan(t/e);return 0===e&&r<0&&(r*=-1),r},o3=function(e,t){return o2(t.x-e.x,t.y-e.y)},o4=function(e,t,r,n){var i=tH(0,n-.001,1),a=tH(0,n+.001,1);return o3(tU(e,t,r,i),tU(e,t,r,a))};o0.recalculateEdgeLabelProjections=function(e){var t,r=e._private,n=r.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:n.midX,y:n.midY};var o=function(e,t,n){tc(r.rscratch,e,t,n),tc(r.rstyle,e,t,n)};o("labelX",null,t.x),o("labelY",null,t.y),o("labelAutoAngle",null,o2(n.midDispX,n.midDispY));var s=function e(){if(e.cache)return e.cache;for(var t=[],a=0;a+5<n.allpts.length;a+=4){var o={x:n.allpts[a],y:n.allpts[a+1]},s={x:n.allpts[a+2],y:n.allpts[a+3]},l={x:n.allpts[a+4],y:n.allpts[a+5]};t.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=r.rstyle.bezierPts,c=i.bezierProjPcts.length;function h(e,t,r,n,i){var a=tL(t,r),o=e.segments[e.segments.length-1],s={p0:t,p1:r,t0:n,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var d=0;d<t.length;d++){var f=t[d],g=t[d-1];g&&(f.startDist=g.startDist+g.length),h(f,f.p0,u[d*c],0,i.bezierProjPcts[0]);for(var p=0;p<c-1;p++)h(f,u[d*c+p],u[d*c+p+1],i.bezierProjPcts[p],i.bezierProjPcts[p+1]);h(f,u[d*c+c-1],f.p2,i.bezierProjPcts[c-1],1)}return e.cache=t},l=function(r){var i="source"===r;if(a[r]){var l=e.pstyle(r+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var u,c,h=s(),d=0,f=0,g=0;g<h.length;g++){for(var p=h[i?g:h.length-1-g],v=0;v<p.segments.length;v++){var y=p.segments[i?v:p.segments.length-1-v],w=g===h.length-1&&v===p.segments.length-1;if(d=f,(f+=y.length)>=l||w){c={cp:p,segment:y};break}}if(c)break}var E=c.cp,b=c.segment,A=(l-d)/b.length,C=b.t1-b.t0,_=i?b.t0+C*A:b.t1-C*A;_=tH(0,_,1),t=tU(E.p0,E.p1,E.p2,_),u=o4(E.p0,E.p1,E.p2,_);break;case"straight":case"segments":case"haystack":for(var S,I,T,x,D=0,N=n.allpts.length,M=0;M+3<N&&(i?(S={x:n.allpts[M],y:n.allpts[M+1]},I={x:n.allpts[M+2],y:n.allpts[M+3]}):(S={x:n.allpts[N-2-M],y:n.allpts[N-1-M]},I={x:n.allpts[N-4-M],y:n.allpts[N-3-M]}),T=tL(S,I),x=D,!((D+=T)>=l));M+=2);var R=(l-x)/T;t=tV(S,I,R=tH(0,R,1)),u=o3(S,I)}o("labelX",r,t.x),o("labelY",r,t.y),o("labelAutoAngle",r,u)}};l("source"),l("target"),this.applyLabelDimensions(e)}},o0.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},o0.applyPrefixedLabelDimensions=function(e,t){var r=e._private,n=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,n),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=tu(r.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=i.width,h=i.height+(l-1)*(a-1)*u;tc(r.rstyle,"labelWidth",t,c),tc(r.rscratch,"labelWidth",t,c),tc(r.rstyle,"labelHeight",t,h),tc(r.rscratch,"labelHeight",t,h),tc(r.rscratch,"labelLineHeight",t,u*a)},o0.getLabelText=function(e,t){var r=e._private,n=t?t+"-":"",i=e.pstyle(n+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,n){return n?(tc(r.rscratch,e,t,n),n):tu(r.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],f=/[\s\u200b]+/,g=h?"":" ",p=0;p<u.length;p++){var v=u[p],y=this.calculateLabelDimensions(e,v).width;if(h&&(v=v.split("").join("​")),y>c){for(var w=v.split(f),E="",b=0;b<w.length;b++){var A=w[b],C=0===E.length?A:E+g+A;this.calculateLabelDimensions(e,C).width<=c?E+=A+g:(E&&d.push(E),E=A+g)}E.match(/^[\s\u200b]+$/)||d.push(E)}else d.push(v)}o("labelWrapCachedLines",d),i=o("labelWrapCachedText",d.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var _=e.pstyle("text-max-width").pfValue,S="",I=!1;if(this.calculateLabelDimensions(e,i).width<_)return i;for(var T=0;T<i.length&&!(this.calculateLabelDimensions(e,S+i[T]+"…").width>_);T++)S+=i[T],T===i.length-1&&(I=!0);return I||(S+="…"),S}return i},o0.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,r=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(r){case"left":return"right";case"right":return"left";default:return"center"}},o0.calculateLabelDimensions=function(e,t){var r=eK(t,e._private.labelDimsKey),n=this.labelDimCache||(this.labelDimCache=[]),i=n[r];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!u){u=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=u.getContext("2d");var h=u.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}c.font="".concat(a," ").concat(l," ").concat(o,"px ").concat(s);for(var d=0,f=0,g=t.split("\n"),p=0;p<g.length;p++){var v=g[p];d=Math.max(Math.ceil(c.measureText(v).width),d),f+=o}return d+=0,f+=0,n[r]={width:d,height:f}},o0.calculateLabelAngle=function(e,t){var r=e._private.rscratch,n=e.isEdge(),i=e.pstyle((t?t+"-":"")+"text-rotation"),a=i.strValue;return"none"===a?0:n&&"autorotate"===a?r.labelAutoAngle:"autorotate"===a?0:i.pfValue},o0.calculateLabelAngles=function(e){var t=e.isEdge(),r=e._private.rscratch;r.labelAngle=this.calculateLabelAngle(e),t&&(r.sourceLabelAngle=this.calculateLabelAngle(e,"source"),r.targetLabelAngle=this.calculateLabelAngle(e,"target"))};var o8={},o6=!1;o8.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(28>e.width()||28>e.height()))return o6||(te("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),o6=!0),"rectangle";if(e.isParent())if("rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t)return t;else return"rectangle";if("polygon"===t){var r=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(r).name}return t};var o5={};o5.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),r=this,n=function(e){var r=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),r)for(var n=0;n<e.length;n++){var i=e[n]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};r.binder(e).on("bounds.* dirty.*",function(e){n(e.target)}).on("style.* background.*",function(e){n(e.target,!1)});var i=function(i){if(i){var a=r.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(n(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var u=0;u<a.length;u++)(0,a[u])(i,t);r.recalculateRenderedStyle(t),t=e.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)},o5.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},o5.recalculateRenderedStyle=function(e,t){var r=function(e){return e._private.rstyle.cleanConnected},n=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||r(o.source())&&r(o.target())||(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):n.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=d.x,h.nodeY=d.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var f=0;f<n.length;f++){var g=n[f]._private,p=g.rstyle,v=g.rscratch;p.srcX=v.arrowStartX,p.srcY=v.arrowStartY,p.tgtX=v.arrowEndX,p.tgtY=v.arrowEndY,p.midX=v.midX,p.midY=v.midY,p.labelAngle=v.labelAngle,p.sourceLabelAngle=v.sourceLabelAngle,p.targetLabelAngle=v.targetLabelAngle}}};var o7={};o7.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],r=0;r<e.length;r++){var n=e[r],i=n._private.rscratch;n.grabbed()&&!n.isParent()?t.push(n):i.inDragLayer?e.drag.push(n):e.nondrag.push(n)}for(var r=0;r<t.length;r++){var n=t[r];e.drag.push(n)}}},o7.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},o7.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(am),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var o9={};[oZ,oQ,oK,oJ,o1,o0,o8,o5,o7].forEach(function(e){eo(o9,e)});var se={};se.getCachedImage=function(e,t,r){var n=this.imageCache=this.imageCache||{},i=n[e];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;var a=(i=n[e]=n[e]||{}).image=new Image;a.addEventListener("load",r),a.addEventListener("error",function(){a.error=!0});var o="data:";return e.substring(0,o.length).toLowerCase()!==o&&(a.crossOrigin=t="null"===t?null:t),a.src=e,a};var st={};st.registerBinding=function(e,t,r,n){var i=Array.prototype.slice.apply(arguments,[1]),a=this.binder(e);return a.on.apply(a,i)},st.binder=function(e){var t=this,r=t.cy.window(),n=e===r||e===r.document||e===r.document.body||!("u"<typeof HTMLElement)&&e instanceof HTMLElement;if(null==t.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,a)}catch(e){}t.supportsPassiveEvents=i}var o=function(r,i,a){var o=Array.prototype.slice.call(arguments);return n&&t.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},st.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},st.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},st.load=function(){var e,t,r,n,i,a,o,s,l,u,c,h,d,f,g,p,v,y,w,E,b,A,C,_,S=this,I=S.cy.window(),T=function(e){return e.selected()},x=function(e,t,r,n){null==e&&(e=S.cy);for(var i=0;i<t.length;i++){var a=t[i];e.emit({originalEvent:r,type:a,position:n})}},D=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},N=function(e,t){var r=!0;if(S.cy.hasCompoundNodes()&&e&&e.pannable())for(var n=0;t&&n<t.length;n++){var e=t[n];if(e.isNode()&&e.isParent()&&!e.pannable()){r=!1;break}}else r=!0;return r},M=function(e){e[0]._private.grabbed=!0},R=function(e){e[0]._private.grabbed=!1},O=function(e){e[0]._private.rscratch.inDragLayer=!0},P=function(e){e[0]._private.rscratch.inDragLayer=!1},B=function(e){e[0]._private.rscratch.isGrabTarget=!0},L=function(e){e[0]._private.rscratch.isGrabTarget=!1},k=function(e,t){var r=t.addToList;!r.has(e)&&e.grabbable()&&!e.locked()&&(r.merge(e),M(e))},F=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var r=e.descendants();t.inDragLayer&&(r.forEach(O),r.connectedEdges().forEach(O)),t.addToList&&k(r,t)}},z=function(e,t){t=t||{};var r=e.cy().hasCompoundNodes();t.inDragLayer&&(e.forEach(O),e.neighborhood().stdFilter(function(e){return!r||e.isEdge()}).forEach(O)),t.addToList&&e.forEach(function(e){k(e,t)}),F(e,t),H(e,{inDragLayer:t.inDragLayer}),S.updateCachedGrabbedEles()},V=function(e){e&&(S.getCachedZSortedEles().forEach(function(e){R(e),P(e),L(e)}),S.updateCachedGrabbedEles())},H=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var r=e.ancestors().orphans();if(!r.same(e)){var n=r.descendants().spawnSelf().merge(r).unmerge(e).unmerge(e.descendants()),i=n.connectedEdges();t.inDragLayer&&(i.forEach(O),n.forEach(O)),t.addToList&&n.forEach(function(e){k(e,t)})}}},j=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},Y="u">typeof MutationObserver,X="u">typeof ResizeObserver;Y?(S.removeObserver=new MutationObserver(function(e){for(var t=0;t<e.length;t++){var r=e[t].removedNodes;if(r){for(var n=0;n<r.length;n++)if(r[n]===S.container){S.destroy();break}}}}),S.container.parentNode&&S.removeObserver.observe(S.container.parentNode,{childList:!0})):S.registerBinding(S.container,"DOMNodeRemoved",function(e){S.destroy()});var G=eU(function(){S.cy.resize()},100);Y&&(S.styleObserver=new MutationObserver(G),S.styleObserver.observe(S.container,{attributes:!0})),S.registerBinding(I,"resize",G),X&&(S.resizeObserver=new ResizeObserver(G),S.resizeObserver.observe(S.container));for(var W=function(){S.invalidateContainerClientCoordsCache()},q=S.container;null!=q;){e=q,S.registerBinding(e,"transitionend",W),S.registerBinding(e,"animationend",W),S.registerBinding(e,"scroll",W),q=q.parentNode}S.registerBinding(S.container,"contextmenu",function(e){e.preventDefault()});var Z=function(e){for(var t=S.findContainerClientCoords(),r=t[0],n=t[1],i=t[2],a=t[3],o=e.touches?e.touches:[e],s=!1,l=0;l<o.length;l++){var u=o[l];if(r<=u.clientX&&u.clientX<=r+i&&n<=u.clientY&&u.clientY<=n+a){s=!0;break}}if(!s)return!1;for(var c=S.container,h=e.target.parentNode,d=!1;h;){if(h===c){d=!0;break}h=h.parentNode}return!!d};S.registerBinding(S.container,"mousedown",function(e){if(Z(e)){e.preventDefault(),j(),S.hoverData.capture=!0,S.hoverData.which=e.which;var t=S.cy,r=[e.clientX,e.clientY],n=S.projectIntoViewport(r[0],r[1]),i=S.selection,a=S.findNearestElements(n[0],n[1],!0,!1),o=a[0],s=S.dragData.possibleDragElements;if(S.hoverData.mdownPos=n,S.hoverData.mdownGPos=r,3==e.which){S.hoverData.cxtStarted=!0;var l={originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}};o?(o.activate(),o.emit(l),S.hoverData.down=o):t.emit(l),S.hoverData.downTime=new Date().getTime(),S.hoverData.cxtDragged=!1}else if(1==e.which){if(o&&o.activate(),null!=o&&S.nodeIsGrabbable(o)){var u=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};if(B(o),o.selected()){s=S.dragData.possibleDragElements=t.collection();var c=t.$(function(e){return e.isNode()&&e.selected()&&S.nodeIsGrabbable(e)});z(c,{addToList:s}),o.emit(u("grabon")),c.forEach(function(e){e.emit(u("grab"))})}else z(o,{addToList:s=S.dragData.possibleDragElements=t.collection()}),o.emit(u("grabon")).emit(u("grab"));S.redrawHint("eles",!0),S.redrawHint("drag",!0)}S.hoverData.down=o,S.hoverData.downs=a,S.hoverData.downTime=new Date().getTime(),x(o,["mousedown","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==o?(i[4]=1,S.data.bgActivePosistion={x:n[0],y:n[1]},S.redrawHint("select",!0),S.redraw()):o.pannable()&&(i[4]=1),S.hoverData.tapholdCancelled=!1,clearTimeout(S.hoverData.tapholdTimeout),S.hoverData.tapholdTimeout=setTimeout(function(){if(!S.hoverData.tapholdCancelled){var r=S.hoverData.down;r?r.emit({originalEvent:e,type:"taphold",position:{x:n[0],y:n[1]}}):t.emit({originalEvent:e,type:"taphold",position:{x:n[0],y:n[1]}})}},S.tapholdDuration)}i[0]=i[2]=n[0],i[1]=i[3]=n[1]}},!1),S.registerBinding(I,"mousemove",function(e){var t,r;if(S.hoverData.capture||Z(e)){var n=!1,i=S.cy,a=i.zoom(),o=[e.clientX,e.clientY],s=S.projectIntoViewport(o[0],o[1]),l=S.hoverData.mdownPos,u=S.hoverData.mdownGPos,c=S.selection,h=null;S.hoverData.draggingEles||S.hoverData.dragging||S.hoverData.selecting||(h=S.findNearestElement(s[0],s[1],!0,!1));var d=S.hoverData.last,f=S.hoverData.down,g=[s[0]-c[2],s[1]-c[3]],p=S.dragData.possibleDragElements;if(u){var v=o[0]-u[0],y=o[1]-u[1];S.hoverData.isOverThresholdDrag=t=v*v+y*y>=S.desktopTapThreshold2}var w=D(e);t&&(S.hoverData.tapholdCancelled=!0),n=!0,x(h,["mousemove","vmousemove","tapdrag"],e,{x:s[0],y:s[1]});var E=function(){S.data.bgActivePosistion=void 0,S.hoverData.selecting||i.emit({originalEvent:e,type:"boxstart",position:{x:s[0],y:s[1]}}),c[4]=1,S.hoverData.selecting=!0,S.redrawHint("select",!0),S.redraw()};if(3===S.hoverData.which){if(t){var b={originalEvent:e,type:"cxtdrag",position:{x:s[0],y:s[1]}};f?f.emit(b):i.emit(b),S.hoverData.cxtDragged=!0,(!S.hoverData.cxtOver||h!==S.hoverData.cxtOver)&&(S.hoverData.cxtOver&&S.hoverData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:s[0],y:s[1]}}),S.hoverData.cxtOver=h,h&&h.emit({originalEvent:e,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}}else if(S.hoverData.dragging){if(n=!0,i.panningEnabled()&&i.userPanningEnabled()){if(S.hoverData.justStartedPan){var A=S.hoverData.mdownPos;r={x:(s[0]-A[0])*a,y:(s[1]-A[1])*a},S.hoverData.justStartedPan=!1}else r={x:g[0]*a,y:g[1]*a};i.panBy(r),i.emit("dragpan"),S.hoverData.dragged=!0}s=S.projectIntoViewport(e.clientX,e.clientY)}else if(1==c[4]&&(null==f||f.pannable()))t&&(!S.hoverData.dragging&&i.boxSelectionEnabled()&&(w||!i.panningEnabled()||!i.userPanningEnabled())?E():!S.hoverData.selecting&&i.panningEnabled()&&i.userPanningEnabled()&&N(f,S.hoverData.downs)&&(S.hoverData.dragging=!0,S.hoverData.justStartedPan=!0,c[4]=0,S.data.bgActivePosistion=tx(l),S.redrawHint("select",!0),S.redraw()),f&&f.pannable()&&f.active()&&f.unactivate());else{if(f&&f.pannable()&&f.active()&&f.unactivate(),f&&f.grabbed()||h==d||(d&&x(d,["mouseout","tapdragout"],e,{x:s[0],y:s[1]}),h&&x(h,["mouseover","tapdragover"],e,{x:s[0],y:s[1]}),S.hoverData.last=h),f)if(t){if(i.boxSelectionEnabled()&&w)f&&f.grabbed()&&(V(p),f.emit("freeon"),p.emit("free"),S.dragData.didDrag&&(f.emit("dragfreeon"),p.emit("dragfree"))),E();else if(f&&f.grabbed()&&S.nodeIsDraggable(f)){var C,_=!S.dragData.didDrag;_&&S.redrawHint("eles",!0),S.dragData.didDrag=!0,S.hoverData.draggingEles||z(p,{inDragLayer:!0});var I={x:0,y:0};if(U(g[0])&&U(g[1])&&(I.x+=g[0],I.y+=g[1],_)){var T=S.hoverData.dragDelta;T&&U(T[0])&&U(T[1])&&(I.x+=T[0],I.y+=T[1])}S.hoverData.draggingEles=!0,p.silentShift(I).emit("position drag"),S.redrawHint("drag",!0),S.redraw()}}else 0===(C=S.hoverData.dragDelta=S.hoverData.dragDelta||[]).length?(C.push(g[0]),C.push(g[1])):(C[0]+=g[0],C[1]+=g[1]);n=!0}if(c[2]=s[0],c[3]=s[1],n)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),S.registerBinding(I,"mouseup",function(e){if(S.hoverData.capture){S.hoverData.capture=!1;var i=S.cy,a=S.projectIntoViewport(e.clientX,e.clientY),o=S.selection,s=S.findNearestElement(a[0],a[1],!0,!1),l=S.dragData.possibleDragElements,u=S.hoverData.down,c=D(e);if(S.data.bgActivePosistion&&(S.redrawHint("select",!0),S.redraw()),S.hoverData.tapholdCancelled=!0,S.data.bgActivePosistion=void 0,u&&u.unactivate(),3===S.hoverData.which){var h={originalEvent:e,type:"cxttapend",position:{x:a[0],y:a[1]}};if(u?u.emit(h):i.emit(h),!S.hoverData.cxtDragged){var d={originalEvent:e,type:"cxttap",position:{x:a[0],y:a[1]}};u?u.emit(d):i.emit(d)}S.hoverData.cxtDragged=!1,S.hoverData.which=null}else if(1===S.hoverData.which){if(x(s,["mouseup","tapend","vmouseup"],e,{x:a[0],y:a[1]}),S.dragData.didDrag||S.hoverData.dragged||S.hoverData.selecting||S.hoverData.isOverThresholdDrag||(x(u,["click","tap","vclick"],e,{x:a[0],y:a[1]}),r=!1,e.timeStamp-n<=i.multiClickDebounceTime()?(t&&clearTimeout(t),r=!0,n=null,x(u,["dblclick","dbltap","vdblclick"],e,{x:a[0],y:a[1]})):(t=setTimeout(function(){r||x(u,["oneclick","onetap","voneclick"],e,{x:a[0],y:a[1]})},i.multiClickDebounceTime()),n=e.timeStamp)),null!=u||S.dragData.didDrag||S.hoverData.selecting||S.hoverData.dragged||D(e)||(i.$(T).unselect(["tapunselect"]),l.length>0&&S.redrawHint("eles",!0),S.dragData.possibleDragElements=l=i.collection()),s!=u||S.dragData.didDrag||S.hoverData.selecting||null==s||!s._private.selectable||(S.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):c||(i.$(T).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),S.redrawHint("eles",!0)),S.hoverData.selecting){var f=i.collection(S.getAllInBox(o[0],o[1],o[2],o[3]));S.redrawHint("select",!0),f.length>0&&S.redrawHint("eles",!0),i.emit({type:"boxend",originalEvent:e,position:{x:a[0],y:a[1]}});"additive"===i.selectionType()||c||i.$(T).unmerge(f).unselect(),f.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),S.redraw()}if(S.hoverData.dragging&&(S.hoverData.dragging=!1,S.redrawHint("select",!0),S.redrawHint("eles",!0),S.redraw()),!o[4]){S.redrawHint("drag",!0),S.redrawHint("eles",!0);var g=u&&u.grabbed();V(l),g&&(u.emit("freeon"),l.emit("free"),S.dragData.didDrag&&(u.emit("dragfreeon"),l.emit("dragfree")))}}o[4]=0,S.hoverData.down=null,S.hoverData.cxtStarted=!1,S.hoverData.draggingEles=!1,S.hoverData.selecting=!1,S.hoverData.isOverThresholdDrag=!1,S.dragData.didDrag=!1,S.hoverData.dragged=!1,S.hoverData.dragDelta=[],S.hoverData.mdownPos=null,S.hoverData.mdownGPos=null}},!1);var Q=function(e){if(!S.scrollingPage){var t=S.cy,r=t.zoom(),n=t.pan(),i=S.projectIntoViewport(e.clientX,e.clientY),a=[i[0]*r+n.x,i[1]*r+n.y];if(S.hoverData.draggingEles||S.hoverData.dragging||S.hoverData.cxtStarted||0!==S.selection[4])return void e.preventDefault();if(t.panningEnabled()&&t.userPanningEnabled()&&t.zoomingEnabled()&&t.userZoomingEnabled()){e.preventDefault(),S.data.wheelZooming=!0,clearTimeout(S.data.wheelTimeout),S.data.wheelTimeout=setTimeout(function(){S.data.wheelZooming=!1,S.redrawHint("eles",!0),S.redraw()},150);var o=(null!=e.deltaY?-(e.deltaY/250):null!=e.wheelDeltaY?e.wheelDeltaY/1e3:e.wheelDelta/1e3)*S.wheelSensitivity;1===e.deltaMode&&(o*=33);var s=t.zoom()*Math.pow(10,o);"gesturechange"===e.type&&(s=S.gestureStartZoom*e.scale),t.zoom({level:s,renderedPosition:{x:a[0],y:a[1]}}),t.emit("gesturechange"===e.type?"pinchzoom":"scrollzoom")}}};S.registerBinding(S.container,"wheel",Q,!0),S.registerBinding(I,"scroll",function(e){S.scrollingPage=!0,clearTimeout(S.scrollingPageTimeout),S.scrollingPageTimeout=setTimeout(function(){S.scrollingPage=!1},250)},!0),S.registerBinding(S.container,"gesturestart",function(e){S.gestureStartZoom=S.cy.zoom(),S.hasTouchStarted||e.preventDefault()},!0),S.registerBinding(S.container,"gesturechange",function(e){S.hasTouchStarted||Q(e)},!0),S.registerBinding(S.container,"mouseout",function(e){var t=S.projectIntoViewport(e.clientX,e.clientY);S.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),S.registerBinding(S.container,"mouseover",function(e){var t=S.projectIntoViewport(e.clientX,e.clientY);S.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var K=function(e,t,r,n){return Math.sqrt((r-e)*(r-e)+(n-t)*(n-t))},$=function(e,t,r,n){return(r-e)*(r-e)+(n-t)*(n-t)};if(S.registerBinding(S.container,"touchstart",y=function(e){if(S.hasTouchStarted=!0,Z(e)){j(),S.touchData.capture=!0,S.data.bgActivePosistion=void 0;var t=S.cy,r=S.touchData.now,n=S.touchData.earlier;if(e.touches[0]){var y=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);r[0]=y[0],r[1]=y[1]}if(e.touches[1]){var y=S.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);r[2]=y[0],r[3]=y[1]}if(e.touches[2]){var y=S.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);r[4]=y[0],r[5]=y[1]}if(e.touches[1]){S.touchData.singleTouchMoved=!0,V(S.dragData.touchDragEles);var w=S.findContainerClientCoords();d=w[0],f=w[1],g=w[2],p=w[3],i=e.touches[0].clientX-d,a=e.touches[0].clientY-f,o=e.touches[1].clientX-d,s=e.touches[1].clientY-f,v=0<=i&&i<=g&&0<=o&&o<=g&&0<=a&&a<=p&&0<=s&&s<=p;var E=t.pan(),b=t.zoom();if(l=K(i,a,o,s),u=$(i,a,o,s),h=[((c=[(i+o)/2,(a+s)/2])[0]-E.x)/b,(c[1]-E.y)/b],u<4e4&&!e.touches[2]){var A=S.findNearestElement(r[0],r[1],!0,!0),C=S.findNearestElement(r[2],r[3],!0,!0);A&&A.isNode()?(A.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}}),S.touchData.start=A):C&&C.isNode()?(C.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}}),S.touchData.start=C):t.emit({originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}}),S.touchData.start&&(S.touchData.start._private.grabbed=!1),S.touchData.cxt=!0,S.touchData.cxtDragged=!1,S.data.bgActivePosistion=void 0,S.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var _=S.findNearestElements(r[0],r[1],!0,!0),I=_[0];if(null!=I&&(I.activate(),S.touchData.start=I,S.touchData.starts=_,S.nodeIsGrabbable(I))){var T=S.dragData.touchDragEles=t.collection(),D=null;S.redrawHint("eles",!0),S.redrawHint("drag",!0),I.selected()?z(D=t.$(function(e){return e.selected()&&S.nodeIsGrabbable(e)}),{addToList:T}):z(I,{addToList:T}),B(I);var N=function(t){return{originalEvent:e,type:t,position:{x:r[0],y:r[1]}}};I.emit(N("grabon")),D?D.forEach(function(e){e.emit(N("grab"))}):I.emit(N("grab"))}x(I,["touchstart","tapstart","vmousedown"],e,{x:r[0],y:r[1]}),null==I&&(S.data.bgActivePosistion={x:y[0],y:y[1]},S.redrawHint("select",!0),S.redraw()),S.touchData.singleTouchMoved=!1,S.touchData.singleTouchStartTime=+new Date,clearTimeout(S.touchData.tapholdTimeout),S.touchData.tapholdTimeout=setTimeout(function(){!1!==S.touchData.singleTouchMoved||S.pinching||S.touchData.selecting||x(S.touchData.start,["taphold"],e,{x:r[0],y:r[1]})},S.tapholdDuration)}if(e.touches.length>=1){for(var M=S.touchData.startPosition=[null,null,null,null,null,null],R=0;R<r.length;R++)M[R]=n[R]=r[R];var O=e.touches[0];S.touchData.startGPosition=[O.clientX,O.clientY]}}},!1),S.registerBinding(window,"touchmove",w=function(e){var t=S.touchData.capture;if(t||Z(e)){var r=S.selection,n=S.cy,c=S.touchData.now,g=S.touchData.earlier,p=n.zoom();if(e.touches[0]){var y=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);c[0]=y[0],c[1]=y[1]}if(e.touches[1]){var y=S.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);c[2]=y[0],c[3]=y[1]}if(e.touches[2]){var y=S.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);c[4]=y[0],c[5]=y[1]}var w=S.touchData.startGPosition;if(t&&e.touches[0]&&w){for(var E=[],b=0;b<c.length;b++)E[b]=c[b]-g[b];var A=e.touches[0].clientX-w[0],C=A*A,_=e.touches[0].clientY-w[1];en=C+_*_>=S.touchTapThreshold2}if(t&&S.touchData.cxt){e.preventDefault();var I=e.touches[0].clientX-d,T=e.touches[0].clientY-f,D=e.touches[1].clientX-d,M=e.touches[1].clientY-f,R=$(I,T,D,M);if(R/u>=2.25||R>=22500){S.touchData.cxt=!1,S.data.bgActivePosistion=void 0,S.redrawHint("select",!0);var O={originalEvent:e,type:"cxttapend",position:{x:c[0],y:c[1]}};S.touchData.start?(S.touchData.start.unactivate().emit(O),S.touchData.start=null):n.emit(O)}}if(t&&S.touchData.cxt){var O={originalEvent:e,type:"cxtdrag",position:{x:c[0],y:c[1]}};S.data.bgActivePosistion=void 0,S.redrawHint("select",!0),S.touchData.start?S.touchData.start.emit(O):n.emit(O),S.touchData.start&&(S.touchData.start._private.grabbed=!1),S.touchData.cxtDragged=!0;var P=S.findNearestElement(c[0],c[1],!0,!0);(!S.touchData.cxtOver||P!==S.touchData.cxtOver)&&(S.touchData.cxtOver&&S.touchData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:c[0],y:c[1]}}),S.touchData.cxtOver=P,P&&P.emit({originalEvent:e,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}else if(t&&e.touches[2]&&n.boxSelectionEnabled())e.preventDefault(),S.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,S.touchData.selecting||n.emit({originalEvent:e,type:"boxstart",position:{x:c[0],y:c[1]}}),S.touchData.selecting=!0,S.touchData.didSelect=!0,r[4]=1,r&&0!==r.length&&void 0!==r[0]?(r[2]=(c[0]+c[2]+c[4])/3,r[3]=(c[1]+c[3]+c[5])/3):(r[0]=(c[0]+c[2]+c[4])/3,r[1]=(c[1]+c[3]+c[5])/3,r[2]=(c[0]+c[2]+c[4])/3+1,r[3]=(c[1]+c[3]+c[5])/3+1),S.redrawHint("select",!0),S.redraw();else if(t&&e.touches[1]&&!S.touchData.didSelect&&n.zoomingEnabled()&&n.panningEnabled()&&n.userZoomingEnabled()&&n.userPanningEnabled()){e.preventDefault(),S.data.bgActivePosistion=void 0,S.redrawHint("select",!0);var B=S.dragData.touchDragEles;if(B){S.redrawHint("drag",!0);for(var L=0;L<B.length;L++){var k=B[L]._private;k.grabbed=!1,k.rscratch.inDragLayer=!1}}var F=S.touchData.start,I=e.touches[0].clientX-d,T=e.touches[0].clientY-f,D=e.touches[1].clientX-d,M=e.touches[1].clientY-f,H=K(I,T,D,M),j=H/l;if(v){var Y=I-i,X=T-a,G=D-o,W=M-s,q=n.zoom(),Q=q*j,J=n.pan(),ee=h[0]*q+J.x,et=h[1]*q+J.y,er={x:-Q/q*(ee-J.x-(Y+G)/2)+ee,y:-Q/q*(et-J.y-(X+W)/2)+et};if(F&&F.active()){var B=S.dragData.touchDragEles;V(B),S.redrawHint("drag",!0),S.redrawHint("eles",!0),F.unactivate().emit("freeon"),B.emit("free"),S.dragData.didDrag&&(F.emit("dragfreeon"),B.emit("dragfree"))}n.viewport({zoom:Q,pan:er,cancelOnFailedZoom:!0}),n.emit("pinchzoom"),l=H,i=I,a=T,o=D,s=M,S.pinching=!0}if(e.touches[0]){var y=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);c[0]=y[0],c[1]=y[1]}if(e.touches[1]){var y=S.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);c[2]=y[0],c[3]=y[1]}if(e.touches[2]){var y=S.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);c[4]=y[0],c[5]=y[1]}}else if(e.touches[0]&&!S.touchData.didSelect){var en,P,ei=S.touchData.start,ea=S.touchData.last;if(S.hoverData.draggingEles||S.swipePanning||(P=S.findNearestElement(c[0],c[1],!0,!0)),t&&null!=ei&&e.preventDefault(),t&&null!=ei&&S.nodeIsDraggable(ei))if(en){var B=S.dragData.touchDragEles,eo=!S.dragData.didDrag;eo&&z(B,{inDragLayer:!0}),S.dragData.didDrag=!0;var es={x:0,y:0};if(U(E[0])&&U(E[1])&&(es.x+=E[0],es.y+=E[1],eo)){S.redrawHint("eles",!0);var el=S.touchData.dragDelta;el&&U(el[0])&&U(el[1])&&(es.x+=el[0],es.y+=el[1])}S.hoverData.draggingEles=!0,B.silentShift(es).emit("position drag"),S.redrawHint("drag",!0),S.touchData.startPosition[0]==g[0]&&S.touchData.startPosition[1]==g[1]&&S.redrawHint("eles",!0),S.redraw()}else{var el=S.touchData.dragDelta=S.touchData.dragDelta||[];0===el.length?(el.push(E[0]),el.push(E[1])):(el[0]+=E[0],el[1]+=E[1])}if(x(ei||P,["touchmove","tapdrag","vmousemove"],e,{x:c[0],y:c[1]}),ei&&ei.grabbed()||P==ea||(ea&&ea.emit({originalEvent:e,type:"tapdragout",position:{x:c[0],y:c[1]}}),P&&P.emit({originalEvent:e,type:"tapdragover",position:{x:c[0],y:c[1]}})),S.touchData.last=P,t)for(var L=0;L<c.length;L++)c[L]&&S.touchData.startPosition[L]&&en&&(S.touchData.singleTouchMoved=!0);if(t&&(null==ei||ei.pannable())&&n.panningEnabled()&&n.userPanningEnabled()){N(ei,S.touchData.starts)&&(e.preventDefault(),S.data.bgActivePosistion||(S.data.bgActivePosistion=tx(S.touchData.startPosition)),S.swipePanning?(n.panBy({x:E[0]*p,y:E[1]*p}),n.emit("dragpan")):en&&(S.swipePanning=!0,n.panBy({x:A*p,y:_*p}),n.emit("dragpan"),ei&&(ei.unactivate(),S.redrawHint("select",!0),S.touchData.start=null)));var y=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);c[0]=y[0],c[1]=y[1]}}for(var b=0;b<c.length;b++)g[b]=c[b];t&&e.touches.length>0&&!S.hoverData.draggingEles&&!S.swipePanning&&null!=S.data.bgActivePosistion&&(S.data.bgActivePosistion=void 0,S.redrawHint("select",!0),S.redraw())}},!1),S.registerBinding(I,"touchcancel",E=function(e){var t=S.touchData.start;S.touchData.capture=!1,t&&t.unactivate()}),S.registerBinding(I,"touchend",b=function(e){var t,r=S.touchData.start;if(S.touchData.capture){0===e.touches.length&&(S.touchData.capture=!1),e.preventDefault();var n=S.selection;S.swipePanning=!1,S.hoverData.draggingEles=!1;var i=S.cy,a=i.zoom(),o=S.touchData.now,s=S.touchData.earlier;if(e.touches[0]){var l=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);o[0]=l[0],o[1]=l[1]}if(e.touches[1]){var l=S.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);o[2]=l[0],o[3]=l[1]}if(e.touches[2]){var l=S.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);o[4]=l[0],o[5]=l[1]}if(r&&r.unactivate(),S.touchData.cxt){if(t={originalEvent:e,type:"cxttapend",position:{x:o[0],y:o[1]}},r?r.emit(t):i.emit(t),!S.touchData.cxtDragged){var u={originalEvent:e,type:"cxttap",position:{x:o[0],y:o[1]}};r?r.emit(u):i.emit(u)}S.touchData.start&&(S.touchData.start._private.grabbed=!1),S.touchData.cxt=!1,S.touchData.start=null,S.redraw();return}if(!e.touches[2]&&i.boxSelectionEnabled()&&S.touchData.selecting){S.touchData.selecting=!1;var c=i.collection(S.getAllInBox(n[0],n[1],n[2],n[3]));n[0]=void 0,n[1]=void 0,n[2]=void 0,n[3]=void 0,n[4]=0,S.redrawHint("select",!0),i.emit({type:"boxend",originalEvent:e,position:{x:o[0],y:o[1]}}),c.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),c.nonempty()&&S.redrawHint("eles",!0),S.redraw()}if(null!=r&&r.unactivate(),e.touches[2])S.data.bgActivePosistion=void 0,S.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){S.data.bgActivePosistion=void 0,S.redrawHint("select",!0);var h=S.dragData.touchDragEles;if(null!=r){var d=r._private.grabbed;V(h),S.redrawHint("drag",!0),S.redrawHint("eles",!0),d&&(r.emit("freeon"),h.emit("free"),S.dragData.didDrag&&(r.emit("dragfreeon"),h.emit("dragfree"))),x(r,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),r.unactivate(),S.touchData.start=null}else x(S.findNearestElement(o[0],o[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]});var f=S.touchData.startPosition[0]-o[0],g=S.touchData.startPosition[1]-o[1];S.touchData.singleTouchMoved||(r||i.$(":selected").unselect(["tapunselect"]),x(r,["tap","vclick"],e,{x:o[0],y:o[1]}),A=!1,e.timeStamp-_<=i.multiClickDebounceTime()?(C&&clearTimeout(C),A=!0,_=null,x(r,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(C=setTimeout(function(){A||x(r,["onetap","voneclick"],e,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),_=e.timeStamp)),null!=r&&!S.dragData.didDrag&&r._private.selectable&&(f*f+g*g)*a*a<S.touchTapThreshold2&&!S.pinching&&("single"===i.selectionType()?(i.$(T).unmerge(r).unselect(["tapunselect"]),r.select(["tapselect"])):r.selected()?r.unselect(["tapunselect"]):r.select(["tapselect"]),S.redrawHint("eles",!0)),S.touchData.singleTouchMoved=!0}for(var p=0;p<o.length;p++)s[p]=o[p];S.dragData.didDrag=!1,0===e.touches.length&&(S.touchData.dragDelta=[],S.touchData.startPosition=[null,null,null,null,null,null],S.touchData.startGPosition=null,S.touchData.didSelect=!1),e.touches.length<2&&(1===e.touches.length&&(S.touchData.startGPosition=[e.touches[0].clientX,e.touches[0].clientY]),S.pinching=!1,S.redrawHint("eles",!0),S.redraw())}},!1),"u"<typeof TouchEvent){var J=[],ee=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},et=function(e){J.push({event:e,touch:ee(e)})},er=function(e){for(var t=0;t<J.length;t++)if(J[t].event.pointerId===e.pointerId)return void J.splice(t,1)},en=function(e){var t=J.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=ee(e)},ei=function(e){e.touches=J.map(function(e){return e.touch})},ea=function(e){return"mouse"===e.pointerType||4===e.pointerType};S.registerBinding(S.container,"pointerdown",function(e){ea(e)||(e.preventDefault(),et(e),ei(e),y(e))}),S.registerBinding(S.container,"pointerup",function(e){ea(e)||(er(e),ei(e),b(e))}),S.registerBinding(S.container,"pointercancel",function(e){ea(e)||(er(e),ei(e),E(e))}),S.registerBinding(S.container,"pointermove",function(e){ea(e)||(e.preventDefault(),en(e),ei(e),w(e))})}};var sr={};sr.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl("polygon",e,t,r,n,i,this.points)},intersectLine:function(e,t,r,n,i,a,o){return ro(i,a,this.points,e,t,r/2,n/2,o)},checkPoint:function(e,t,r,n,i,a,o){return t5(e,t,this.points,a,o,n,i,[0,-1],r)}}},sr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o){return rt(i,a,e,t,r/2+o,n/2+o)},checkPoint:function(e,t,r,n,i,a,o){return rr(e,t,n,i,a,o,r)}}},sr.generateRoundPolygon=function(e,t){for(var r=Array(2*t.length),n=0;n<t.length/2;n++){var i=2*n,a=void 0;a=n<t.length/2-1?(n+1)*2:0,r[4*n]=t[i],r[4*n+1]=t[i+1];var o=t[a]-t[i],s=t[a+1]-t[i+1],l=Math.sqrt(o*o+s*s);r[4*n+2]=o/l,r[4*n+3]=s/l}return this.nodeShapes[e]={renderer:this,name:e,points:r,draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl("round-polygon",e,t,r,n,i,this.points)},intersectLine:function(e,t,r,n,i,a,o){return rs(i,a,this.points,e,t,r,n)},checkPoint:function(e,t,r,n,i,a,o){return t7(e,t,this.points,a,o,n,i)}}},sr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ru(4,0),draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o){return tJ(i,a,e,t,r,n,o)},checkPoint:function(e,t,r,n,i,a,o){var s=rd(n,i),l=2*s;return!!(t5(e,t,this.points,a,o,n,i-l,[0,-1],r)||t5(e,t,this.points,a,o,n-l,i,[0,-1],r)||rr(e,t,l,l,a-n/2+s,o-i/2+s,r)||rr(e,t,l,l,a+n/2-s,o-i/2+s,r)||rr(e,t,l,l,a+n/2-s,o+i/2-s,r)||rr(e,t,l,l,a-n/2+s,o+i/2-s,r))}}},sr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:rg(),points:ru(4,0),draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},generateCutTrianglePts:function(e,t,r,n){var i=this.cornerLength,a=t/2,o=e/2,s=r-o,l=r+o,u=n-a,c=n+a;return{topLeft:[s,u+i,s+i,u,s+i,u+i],topRight:[l-i,u,l,u+i,l-i,u+i],bottomRight:[l,c-i,l-i,c,l-i,c-i],bottomLeft:[s+i,c,s,c-i,s+i,c-i]}},intersectLine:function(e,t,r,n,i,a,o){var s=this.generateCutTrianglePts(r+2*o,n+2*o,e,t);return ro(i,a,[].concat.apply([],[s.topLeft.splice(0,4),s.topRight.splice(0,4),s.bottomRight.splice(0,4),s.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,r,n,i,a,o){if(t5(e,t,this.points,a,o,n,i-2*this.cornerLength,[0,-1],r)||t5(e,t,this.points,a,o,n-2*this.cornerLength,i,[0,-1],r))return!0;var s=this.generateCutTrianglePts(n,i,a,o);return t6(e,t,s.topLeft)||t6(e,t,s.topRight)||t6(e,t,s.bottomRight)||t6(e,t,s.bottomLeft)}}},sr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ru(4,0),draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o){var s=this.generateBarrelBezierPts(r+2*o,n+2*o,e,t),l=function(e){var t=tU({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),r=tU({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),n=tU({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,r.x,r.y,n.x,n.y,e[4],e[5]]};return ro(i,a,[].concat(l(s.topLeft),l(s.topRight),l(s.bottomRight),l(s.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,r,n){var i=t/2,a=e/2,o=r-a,s=r+a,l=n-i,u=n+i,c=rp(e,t),h=c.heightOffset,d=c.widthOffset,f=c.ctrlPtOffsetPct*e,g={topLeft:[o,l+h,o+f,l,o+d,l],topRight:[s-d,l,s-f,l,s,l+h],bottomRight:[s,u-h,s-f,u,s-d,u],bottomLeft:[o+d,u,o+f,u,o,u-h]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,t,r,n,i,a,o){var s=rp(n,i),l=s.heightOffset,u=s.widthOffset;if(t5(e,t,this.points,a,o,n,i-2*l,[0,-1],r)||t5(e,t,this.points,a,o,n-2*u,i,[0,-1],r))return!0;for(var c=this.generateBarrelBezierPts(n,i,a,o),h=Object.keys(c),d=0;d<h.length;d++){var f=c[h[d]],g=function(e,t,r){var n=r[4],i=r[2],a=r[0],o=r[5],s=r[1],l=Math.min(n,a),u=Math.max(n,a),c=Math.min(o,s),h=Math.max(o,s);if(l<=e&&e<=u&&c<=t&&t<=h){var d=[n-2*i+a,2*(i-n),n],f=t2(d[0],d[1],d[2],e).filter(function(e){return 0<=e&&e<=1});if(f.length>0)return f[0]}return null}(e,t,f);if(null!=g){var p=tz(f[5],f[3],f[1],g);if(f.isTop&&p<=t||f.isBottom&&t<=p)return!0}}return!1}}},sr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ru(4,0),draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o){var s=e-(r/2+o),l=t-(n/2+o),u=e+(r/2+o),c=ra(i,a,e,t,s,l,u,l,!1);return c.length>0?c:tJ(i,a,e,t,r,n,o)},checkPoint:function(e,t,r,n,i,a,o){var s=rd(n,i),l=2*s;if(t5(e,t,this.points,a,o,n,i-l,[0,-1],r)||t5(e,t,this.points,a,o,n-l,i,[0,-1],r))return!0;var u=n/2+2*r,c=i/2+2*r;return!!(t6(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||rr(e,t,l,l,a+n/2-s,o+i/2-s,r)||rr(e,t,l,l,a-n/2+s,o+i/2-s,r))}}},sr.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",ru(3,0)),this.generateRoundPolygon("round-triangle",ru(3,0)),this.generatePolygon("rectangle",ru(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r),this.generatePolygon("pentagon",ru(5,0)),this.generateRoundPolygon("round-pentagon",ru(5,0)),this.generatePolygon("hexagon",ru(6,0)),this.generateRoundPolygon("round-hexagon",ru(6,0)),this.generatePolygon("heptagon",ru(7,0)),this.generateRoundPolygon("round-heptagon",ru(7,0)),this.generatePolygon("octagon",ru(8,0)),this.generateRoundPolygon("round-octagon",ru(8,0));var n=Array(20),i=rh(5,0),a=rh(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(var s=0;s<5;s++)n[4*s]=i[2*s],n[4*s+1]=i[2*s+1],n[4*s+2]=a[2*s],n[4*s+3]=a[2*s+1];n=rc(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var r,n="polygon-"+e.join("$");return(r=this[n])?r:t.generatePolygon(n,e)}};var sn={};sn.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},sn.redraw=function(e){e=e||ti(),void 0===this.averageRedrawTime&&(this.averageRedrawTime=0),void 0===this.lastRedrawTime&&(this.lastRedrawTime=0),void 0===this.lastDrawTime&&(this.lastDrawTime=0),this.requestedFrame=!0,this.renderOptions=e},sn.beforeRender=function(e,t){if(!this.destroyed){null==t&&e7("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:e,priority:t}),r.sort(function(e,t){return t.priority-e.priority})}};var si=function(e,t,r){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(t,r)};sn.startRenderLoop=function(){var e=this,t=e.cy;e.renderLoopStarted||(e.renderLoopStarted=!0,eY(function r(n){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){si(e,!0,n);var i=eH();e.render(e.renderOptions);var a=e.lastDrawTime=eH();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else si(e,!1,n);e.skipFrame=!1,eY(r)}}))};var sa=function(e){this.init(e)},so=sa.prototype;so.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],so.init=function(e){this.options=e,this.cy=e.cy;var t=this.container=e.cy.container(),r=this.cy.window();if(r){var n=r.document,i=n.head,a="__________cytoscape_stylesheet",o="__________cytoscape_container",s=null!=n.getElementById(a);if(0>t.className.indexOf(o)&&(t.className=(t.className||"")+" "+o),!s){var l=n.createElement("style");l.id=a,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===r.getComputedStyle(t).getPropertyValue("position")&&te("A Cytoscape container has style position:static and so can not use UI extensions properly")}this.selection=[void 0,void 0,void 0,void 0,0],this.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.dragData={possibleDragElements:[]},this.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},this.redraws=0,this.showFps=e.showFps,this.debug=e.debug,this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.textureOnViewport=e.textureOnViewport,this.wheelSensitivity=e.wheelSensitivity,this.motionBlurEnabled=e.motionBlur,this.forcedPixelRatio=U(e.pixelRatio)?e.pixelRatio:null,this.motionBlur=e.motionBlur,this.motionBlurOpacity=e.motionBlurOpacity,this.motionBlurTransparency=1-this.motionBlurOpacity,this.motionBlurPxRatio=1,this.mbPxRBlurry=1,this.minMbLowQualFrames=4,this.fullQualityMb=!1,this.clearedForMotionBlur=[],this.desktopTapThreshold=e.desktopTapThreshold,this.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,this.touchTapThreshold=e.touchTapThreshold,this.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,this.tapholdDuration=500,this.bindings=[],this.beforeRenderCallbacks=[],this.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},this.registerNodeShapes(),this.registerArrowShapes(),this.registerCalculationListeners()},so.notify=function(e,t){var r=this.cy;if(!this.destroyed){if("init"===e)return void this.load();if("destroy"===e)return void this.destroy();("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),("load"===e||"resize"===e||"mount"===e)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.container)),this.redrawHint("eles",!0),this.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},so.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e<this.bindings.length;e++){var t=this.bindings[e],r=t.target;(r.off||r.removeEventListener).apply(r,t.args)}if(this.bindings=[],this.beforeRenderCallbacks=[],this.onUpdateEleCalcsFns=[],this.removeObserver&&this.removeObserver.disconnect(),this.styleObserver&&this.styleObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect(),this.labelCalcDiv)try{document.body.removeChild(this.labelCalcDiv)}catch(e){}},so.isHeadless=function(){return!1},[oq,o9,se,st,sr,sn].forEach(function(e){eo(so,e)});var ss=1e3/60,sl=function(e){return function(){var t=this,r=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var n=eU(function(){r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},e.deqRedrawThreshold),i=e.priority||e5;r.beforeRender(function(i,a){var o=eH(),s=r.averageRedrawTime,l=r.lastRedrawTime,u=[],c=r.cy.extent(),h=r.getPixelRatio();for(i||r.flushRenderedStyleQueue();;){var d=eH(),f=d-o,g=d-a;if(l<ss){var p=ss-(i?s:0);if(g>=e.deqFastCost*p)break}else if(i){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*ss)break;var v=e.deq(t,h,c);if(v.length>0)for(var y=0;y<v.length;y++)u.push(v[y]);else break}u.length>0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&n())},i(t))}}},su=function(){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e8;t(this,e),this.idsByKey=new td,this.keyForId=new td,this.cachesByLvl=new td,this.lvls=[],this.getKey=r,this.doesEleInvalidateKey=n}return i(e,[{key:"getIdsFor",value:function(e){null==e&&e7("Can not get id list for null key");var t=this.idsByKey,r=this.idsByKey.get(e);return r||(r=new tg,t.set(e,r)),r}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),r=this.keyForId.get(t),n=this.getKey(e);this.deleteIdForKey(r,t),this.addIdForKey(n,t),this.keyForId.set(t,n)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),r=this.keyForId.get(t);this.deleteIdForKey(r,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,r=this.lvls,n=t.get(e);return n||(n=new td,t.set(e,n),r.push(e)),n}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var r=this.getKey(e),n=this.getCache(r,t);return null!=n&&this.updateKeyMappingFor(e),n}},{key:"getForCachedKey",value:function(e,t){var r=this.keyForId.get(e.id());return this.getCache(r,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var r=this.getKey(e);return this.hasCache(r,t)}},{key:"setCache",value:function(e,t,r){r.key=e,this.getCachesAt(t).set(e,r)}},{key:"set",value:function(e,t,r){var n=this.getKey(e);this.setCache(n,t,r),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var r=this.getKey(e);this.deleteCache(r,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(r){return t.deleteCache(e,r)})}},{key:"invalidate",value:function(e){var t=e.id(),r=this.keyForId.get(t);this.deleteKeyMappingFor(e);var n=this.doesEleInvalidateKey(e);return n&&this.invalidateKey(r),n||0===this.getNumberOfIdsForKey(r)}}]),e}(),sc={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},sh=ta({getKey:null,doesEleInvalidateKey:e8,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:e4,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),sd=function(e,t){this.renderer=e,this.onDequeues=[];var r=sh(t);eo(this,r),this.lookup=new su(r.getKey,r.doesEleInvalidateKey),this.setupDequeueing()},sf=sd.prototype;sf.reasons=sc,sf.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},sf.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},sf.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new ty(function(e,t){return t.reqs-e.reqs})},sf.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},sf.getElement=function(e,t,r,n,i){var a,o,s,l=this,u=this.renderer,c=u.cy.zoom(),h=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!l.allowEdgeTxrCaching&&e.isEdge()||!l.allowParentTxrCaching&&e.isParent())return null;if(null==n&&(n=Math.ceil(tP(c*r))),n<-4)n=-4;else if(c>=7.99||n>3)return null;var d=Math.pow(2,n),f=t.h*d,g=t.w*d,p=u.eleTextBiggerThanMin(e,d);if(!this.isVisible(e,p))return null;var v=h.get(e,n);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(a=f<=25?25:f<=50?50:50*Math.ceil(f/50),f>1024||g>1024)return null;var y=l.getTextureQueue(a),w=y[y.length-2],E=function(){return l.recycleTexture(a,g)||l.addTexture(a,g)};w||(w=y[y.length-1]),w||(w=E()),w.width-w.usedWidth<g&&(w=E());for(var b=function(e){return e&&e.scaledLabelShown===p},A=i&&i===sc.dequeue,C=i&&i===sc.highQuality,_=i&&i===sc.downscale,S=n+1;S<=3;S++){var I=h.get(e,S);if(I){o=I;break}}var T=o&&o.level===n+1?o:null,x=function(){w.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,w.usedWidth,0,g,f)};if(w.context.setTransform(1,0,0,1,0,0),w.context.clearRect(w.usedWidth,0,g,a),b(T))x();else if(b(o))if(!C)return l.queueElement(e,o.level-1),o;else{for(var D=o.level;D>n;D--)T=l.getElement(e,t,r,D,sc.downscale);x()}else{if(!A&&!C&&!_)for(var N=n-1;N>=-4;N--){var M=h.get(e,N);if(M){s=M;break}}if(b(s))return l.queueElement(e,n),s;w.context.translate(w.usedWidth,0),w.context.scale(d,d),this.drawElement(w.context,e,t,p,!1),w.context.scale(1/d,1/d),w.context.translate(-w.usedWidth,0)}return v={x:w.usedWidth,texture:w,level:n,scale:d,width:g,height:f,scaledLabelShown:p},w.usedWidth+=Math.ceil(g+8),w.eleCaches.push(v),h.set(e,n,v),l.checkTextureFullness(w),v},sf.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},sf.invalidateElement=function(e){var t=this.lookup,r=[];if(t.isInvalid(e)){for(var n=-4;n<=3;n++){var i=t.getForCachedKey(e,n);i&&r.push(i)}if(t.invalidate(e))for(var a=0;a<r.length;a++){var o=r[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},sf.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},sf.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?to(t,e):e.fullnessChecks++},sf.retireTexture=function(e){var t=e.height,r=this.getTextureQueue(t),n=this.lookup;to(r,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];n.deleteCache(o.key,o.level)}ts(i),this.getRetiredTextureQueue(t).push(e)},sf.addTexture=function(e,t){var r=this.getTextureQueue(e),n={};return r.push(n),n.eleCaches=[],n.height=e,n.width=Math.max(1024,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},sf.recycleTexture=function(e,t){for(var r=this.getTextureQueue(e),n=this.getRetiredTextureQueue(e),i=0;i<n.length;i++){var a=n[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,ts(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),to(n,a),r.push(a),a}},sf.queueElement=function(e,t){var r=this.getElementQueue(),n=this.getElementKeyToQueue(),i=this.getKey(e),a=n[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,r.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};r.push(o),n[i]=o}},sf.dequeue=function(e){for(var t=this.getElementQueue(),r=this.getElementKeyToQueue(),n=[],i=this.lookup,a=0;a<1;a++)if(t.size()>0){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(r[s]=null,u)continue;n.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,sc.dequeue)}else break;return n},sf.removeFromQueue=function(e){var t=this.getElementQueue(),r=this.getElementKeyToQueue(),n=this.getKey(e),i=r[n];null!=i&&(1===i.eles.length?(i.reqs=e3,t.updateItem(i),t.pop(),r[n]=null):i.eles.unmerge(e))},sf.onDequeue=function(e){this.onDequeues.push(e)},sf.offDequeue=function(e){to(this.onDequeues,e)},sf.setupDequeueing=sl({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,r){return e.dequeue(t,r)},onDeqd:function(e,t){for(var r=0;r<e.onDequeues.length;r++)(0,e.onDequeues[r])(t)},shouldRedraw:function(e,t,r,n){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(tQ(a[o].boundingBox(),n))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var sg=function(e){var t=this,r=t.renderer=e,n=r.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=eH()-500,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=eU(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),r.beforeRender(function(e,r){r-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new ty(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},sp=sg.prototype,sm=0;sp.makeLayer=function(e,t){var r=Math.pow(2,t),n=Math.ceil(e.w*r),i=Math.ceil(e.h*r),a=this.renderer.makeOffscreenCanvas(n,i),o={id:sm=++sm%0x1fffffffffffff,bb:e,level:t,width:n,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(r,r),s.translate(l,u),o},sp.getLayers=function(e,t,r){var n,i,a=this,o=a.renderer.cy.zoom(),s=a.firstGet;if(a.firstGet=!1,null==r){if((r=Math.ceil(tP(o*t)))<-4)r=-4;else if(o>=3.99||r>2)return null}a.validateLayersElesOrdering(r,e);var l=a.layersByLevel,u=Math.pow(2,r),c=l[r]=l[r]||[];if(a.levelIsComplete(r,e))return c;var h=function(t){if(a.validateLayersElesOrdering(t,e),a.levelIsComplete(t,e))return i=l[t],!0},d=function(e){if(!i)for(var t=r+e;-4<=t&&t<=2&&!h(t);t+=e);};d(1),d(-1);for(var f=c.length-1;f>=0;f--){var g=c[f];g.invalid&&to(c,g)}var p=function(){if(!n){n=tj();for(var t=0;t<e.length;t++)tX(n,e[t].boundingBox())}return n};if(a.skipping&&!s)return null;for(var v=null,y=e.length/1,w=!s,E=0;E<e.length;E++){var b=e[E],A=b._private.rscratch,C=A.imgLayerCaches=A.imgLayerCaches||{},_=C[r];if(_){v=_;continue}if((!v||v.eles.length>=y||!t$(v.bb,b.boundingBox()))&&!(v=function(e){var t=(e=e||{}).after;if(p(),n.w*u*(n.h*u)>16e6)return null;var i=a.makeLayer(n,r);if(null!=t){var o=c.indexOf(t)+1;c.splice(o,0,i)}else(void 0===e.insert||e.insert)&&c.unshift(i);return i}({insert:!0,after:v})))return null;i||w?a.queueLayer(v,b):a.drawEleInLayer(v,b,r,t),v.eles.push(b),C[r]=v}return i||(w?null:c)},sp.getEleLevelForLayerLevel=function(e,t){return e},sp.drawEleInLayer=function(e,t,r,n){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(r=this.getEleLevelForLayerLevel(r,n),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,r,!0),i.setImgSmoothing(a,!0))},sp.levelIsComplete=function(e,t){var r=this.layersByLevel[e];if(!r||0===r.length)return!1;for(var n=0,i=0;i<r.length;i++){var a=r[i];if(a.reqs>0||a.invalid)return!1;n+=a.eles.length}return n===t.length},sp.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(r)for(var n=0;n<r.length;n++){for(var i=r[n],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},sp.updateElementsInLayers=function(e,t){for(var r=j(e[0]),n=0;n<e.length;n++)for(var i=r?null:e[n],a=r?e[n]:e[n].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(i&&this.getEleLevelForLayerLevel(u.level)!==i.level||t(u,a,i))}},sp.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var r=this.layersByLevel[t];if(r&&r.length>0){e=!0;break}}return e},sp.invalidateElements=function(e){var t=this;0===e.length||(t.lastInvalidationTime=eH(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,r,n){t.invalidateLayer(e)}))},sp.invalidateLayer=function(e){if(this.lastInvalidationTime=eH(),!e.invalid){var t=e.level,r=e.eles;to(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},sp.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,r,n){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},sp.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},sp.queueLayer=function(e,t){var r=this.layersQueue,n=e.elesQueue,i=n.hasId=n.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;n.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},sp.dequeue=function(e){for(var t=this.layersQueue,r=[],n=0;n<1&&0!==t.size();){var i=t.peek();if(i.replacement||i.replaces&&i!==i.replaces.replacement||i.invalid){t.pop();continue}var a=i.elesQueue.shift();a&&(this.drawEleInLayer(i,a,i.level,e),n++),0===r.length&&r.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&this.applyLayerReplacement(i),this.requestRedraw())}return r},sp.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],r=e.replaces,n=t.indexOf(r);if(!(n<0)&&!r.invalid){t[n]=e;for(var i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},sp.requestRedraw=eU(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),sp.setupDequeueing=sl({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:e5,shouldRedraw:e4,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var sv={};function sy(e,t){for(var r=0;r<t.length;r++){var n=t[r];e.lineTo(n.x,n.y)}}function sw(e,t,r){for(var n,i=0;i<t.length;i++){var a=t[i];0===i&&(n=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(r.x,r.y,n.x,n.y)}function sE(e,t,r){e.beginPath&&e.beginPath();for(var n=0;n<t.length;n++){var i=t[n];e.lineTo(i.x,i.y)}var a=r[0];e.moveTo(a.x,a.y);for(var n=1;n<r.length;n++){var i=r[n];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function sb(e,t,r,n,i){e.beginPath&&e.beginPath(),e.arc(r,n,i,0,2*Math.PI,!1);var a=t[0];e.moveTo(a.x,a.y);for(var o=0;o<t.length;o++){var s=t[o];e.lineTo(s.x,s.y)}e.closePath&&e.closePath()}function sA(e,t,r,n){e.arc(t,r,n,0,2*Math.PI,!1)}sv.arrowShapeImpl=function(e){return(x||(x={polygon:sy,"triangle-backcurve":sw,"triangle-tee":sE,"circle-triangle":sb,"triangle-cross":sE,circle:sA}))[e]};var sC={};sC.drawElement=function(e,t,r,n,i,a){t.isNode()?this.drawNode(e,t,r,n,i,a):this.drawEdge(e,t,r,n,i,a)},sC.drawElementOverlay=function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},sC.drawElementUnderlay=function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},sC.drawCachedElementPortion=function(e,t,r,n,i,a,o,s){var l=r.getBoundingBox(t);if(0!==l.w&&0!==l.h){var u=r.getElement(t,l,n,i,a);if(null!=u){var c,h,d,f,g,p,v=s(this,t);if(0===v)return;var y=o(this,t),w=l.x1,E=l.y1,b=l.w,A=l.h;if(0!==y){var C=r.getRotationPoint(t);d=C.x,f=C.y,e.translate(d,f),e.rotate(y),(g=this.getImgSmoothing(e))||this.setImgSmoothing(e,!0);var _=r.getRotationOffset(t);c=_.x,h=_.y}else c=w,h=E;1!==v&&(p=e.globalAlpha,e.globalAlpha=p*v),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,c,h,b,A),1!==v&&(e.globalAlpha=p),0!==y&&(e.rotate(-y),e.translate(-d,-f),g||this.setImgSmoothing(e,!1))}else r.drawElement(e,t)}};var s_=function(){return 0},sS=function(e,t){return e.getTextAngle(t,null)},sI=function(e,t){return e.getTextAngle(t,"source")},sT=function(e,t){return e.getTextAngle(t,"target")},sx=function(e,t){return t.effectiveOpacity()},sD=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};sC.drawCachedElement=function(e,t,r,n,i,a){var o=this.data,s=o.eleTxrCache,l=o.lblTxrCache,u=o.slbTxrCache,c=o.tlbTxrCache,h=t.boundingBox(),d=!0===a?s.reasons.highQuality:null;if(0!==h.w&&0!==h.h&&t.visible()&&(!n||tQ(h,n))){var f=t.isEdge(),g=t.element()._private.rscratch.badLine;this.drawElementUnderlay(e,t),this.drawCachedElementPortion(e,t,s,r,i,d,s_,sx),f&&g||this.drawCachedElementPortion(e,t,l,r,i,d,sS,sD),f&&!g&&(this.drawCachedElementPortion(e,t,u,r,i,d,sI,sD),this.drawCachedElementPortion(e,t,c,r,i,d,sT,sD)),this.drawElementOverlay(e,t)}},sC.drawElements=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];this.drawElement(e,n)}},sC.drawCachedElements=function(e,t,r,n){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,r,n)}},sC.drawCachedNodes=function(e,t,r,n){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,r,n)}},sC.drawLayeredElements=function(e,t,r,n){var i=this.data.lyrTxrCache.getLayers(t,r);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,r,n)};var sN={};sN.drawEdge=function(e,t,r){var n,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=!(arguments.length>5)||void 0===arguments[5]||arguments[5],s=this,l=t._private.rscratch;if((!o||t.visible())&&!(l.badLine||null==l.allpts||isNaN(l.allpts[0]))){r&&(n=r,e.translate(-n.x1,-n.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,p=u*c,v=u*c,y=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;"straight-triangle"===h?(s.eleStrokeStyle(e,t,r),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=f,e.lineCap=g,s.eleStrokeStyle(e,t,r),s.drawEdgePath(t,e,l.allpts,d),e.lineCap="butt")},w=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;s.drawArrowheads(e,t,r)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var E=t.pstyle("ghost-offset-x").pfValue,b=t.pstyle("ghost-offset-y").pfValue,A=p*t.pstyle("ghost-opacity").value;e.translate(E,b),y(A),w(A),e.translate(-E,-b)}a&&s.drawEdgeUnderlay(e,t),y(),w(),a&&s.drawEdgeOverlay(e,t),s.drawElementText(e,t,null,i),r&&e.translate(n.x1,n.y1)}};var sM=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,r){if(r.visible()){var n=r.pstyle("".concat(e,"-opacity")).value;if(0!==n){var i=this.usePaths(),a=r._private.rscratch,o=r.pstyle("".concat(e,"-padding")).pfValue,s=r.pstyle("".concat(e,"-color")).value;t.lineWidth=2*o,"self"!==a.edgeType||i?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],n),this.drawEdgePath(r,t,a.allpts,"solid")}}}};sN.drawEdgeOverlay=sM("overlay"),sN.drawEdgeUnderlay=sM("underlay"),sN.drawEdgePath=function(e,t,r,n){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=r.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(n){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(r[0],r[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<r.length;d+=4)t.quadraticCurveTo(r[d],r[d+1],r[d+2],r[d+3]);break;case"straight":case"segments":case"haystack":for(var f=2;f+1<r.length;f+=2)t.lineTo(r[f],r[f+1])}t=o,l?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},sN.drawEdgeTrianglePath=function(e,t,r){t.fillStyle=t.strokeStyle;for(var n=e.pstyle("width").pfValue,i=0;i+1<r.length;i+=2){var a=[r[i+2]-r[i],r[i+3]-r[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],l=[s[0]*n/2,s[1]*n/2];t.beginPath(),t.moveTo(r[i]-l[0],r[i+1]-l[1]),t.lineTo(r[i]+l[0],r[i+1]+l[1]),t.lineTo(r[i+2],r[i+3]),t.closePath(),t.fill()}},sN.drawArrowheads=function(e,t,r){var n=t._private.rscratch,i="haystack"===n.edgeType;i||this.drawArrowhead(e,t,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,r),this.drawArrowhead(e,t,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,r),this.drawArrowhead(e,t,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,r),i||this.drawArrowhead(e,t,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,r)},sN.drawArrowhead=function(e,t,r,n,i,a,o){if(!(isNaN(n)||null==n||isNaN(i)||null==i||isNaN(a))&&null!=a){var s=t.pstyle(r+"-arrow-shape").value;if("none"!==s){var l="hollow"===t.pstyle(r+"-arrow-fill").value?"both":"filled",u=t.pstyle(r+"-arrow-fill").value,c=t.pstyle("width").pfValue,h=t.pstyle(r+"-arrow-width"),d="match-line"===h.value?c:h.pfValue;"%"===h.units&&(d*=c);var f=t.pstyle("opacity").value;void 0===o&&(o=f);var g=e.globalCompositeOperation;(1!==o||"hollow"===u)&&(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,c,s,d,n,i,a),e.globalCompositeOperation=g);var p=t.pstyle(r+"-arrow-color").value;this.colorFillStyle(e,p[0],p[1],p[2],o),this.colorStrokeStyle(e,p[0],p[1],p[2],o),this.drawArrowShape(t,e,u,c,s,d,n,i,a)}}},sN.drawArrowShape=function(e,t,r,n,i,a,o,s,l){var u,c=this.usePaths()&&"triangle-cross"!==i,h=!1,d=t,f=e.pstyle("arrow-scale").value,g=this.getArrowWidth(n,f),p=this.arrowShapes[i];if(c){var v=this.arrowPathCache=this.arrowPathCache||[],y=eK(i),w=v[y];null!=w?(u=t=w,h=!0):(u=t=new Path2D,v[y]=u)}!h&&(t.beginPath&&t.beginPath(),c?p.draw(t,1,0,{x:0,y:0},1):p.draw(t,g,l,{x:o,y:s},n),t.closePath&&t.closePath()),t=d,c&&(t.translate(o,s),t.rotate(l),t.scale(g,g)),("filled"===r||"both"===r)&&(c?t.fill(u):t.fill()),("hollow"===r||"both"===r)&&(t.lineWidth=a/(c?g:1),t.lineJoin="miter",c?t.stroke(u):t.stroke()),c&&(t.scale(1/g,1/g),t.rotate(-l),t.translate(-o,-s))};var sR={};sR.safeDrawImage=function(e,t,r,n,i,a,o,s,l,u){if(!(i<=0)&&!(a<=0)&&!(l<=0)&&!(u<=0))try{e.drawImage(t,r,n,i,a,o,s,l,u)}catch(e){te(e)}},sR.drawInscribedImage=function(e,t,r,n,i){var a=r.position(),o=a.x,s=a.y,l=r.cy().style(),u=l.getIndexedStyle.bind(l),c=u(r,"background-fit","value",n),h=u(r,"background-repeat","value",n),d=r.width(),f=r.height(),g=2*r.padding(),p=d+("inner"===u(r,"background-width-relative-to","value",n)?0:g),v=f+("inner"===u(r,"background-height-relative-to","value",n)?0:g),y=r._private.rscratch,w="node"===u(r,"background-clip","value",n),E=u(r,"background-image-opacity","value",n)*i,b=u(r,"background-image-smoothing","value",n),A=t.width||t.cachedW,C=t.height||t.cachedH;(null==A||null==C)&&(document.body.appendChild(t),A=t.cachedW=t.width||t.offsetWidth,C=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var _=A,S=C;if("auto"!==u(r,"background-width","value",n)&&(_="%"===u(r,"background-width","units",n)?u(r,"background-width","pfValue",n)*p:u(r,"background-width","pfValue",n)),"auto"!==u(r,"background-height","value",n)&&(S="%"===u(r,"background-height","units",n)?u(r,"background-height","pfValue",n)*v:u(r,"background-height","pfValue",n)),0!==_&&0!==S){if("contain"===c){var I=Math.min(p/_,v/S);_*=I,S*=I}else if("cover"===c){var I=Math.max(p/_,v/S);_*=I,S*=I}var T=o-p/2,x=u(r,"background-position-x","units",n),D=u(r,"background-position-x","pfValue",n);"%"===x?T+=(p-_)*D:T+=D;var N=u(r,"background-offset-x","units",n),M=u(r,"background-offset-x","pfValue",n);"%"===N?T+=(p-_)*M:T+=M;var R=s-v/2,O=u(r,"background-position-y","units",n),P=u(r,"background-position-y","pfValue",n);"%"===O?R+=(v-S)*P:R+=P;var B=u(r,"background-offset-y","units",n),L=u(r,"background-offset-y","pfValue",n);"%"===B?R+=(v-S)*L:R+=L,y.pathCache&&(T-=o,R-=s,o=0,s=0);var k=e.globalAlpha;e.globalAlpha=E;var F=this.getImgSmoothing(e),z=!1;if("no"===b&&F?(this.setImgSmoothing(e,!1),z=!0):"yes"!==b||F||(this.setImgSmoothing(e,!0),z=!0),"no-repeat"===h)w&&(e.save(),y.pathCache?e.clip(y.pathCache):(this.nodeShapes[this.getNodeShape(r)].draw(e,o,s,p,v),e.clip())),this.safeDrawImage(e,t,0,0,A,C,T,R,_,S),w&&e.restore();else{var U=e.createPattern(t,h);e.fillStyle=U,this.nodeShapes[this.getNodeShape(r)].draw(e,o,s,p,v),e.translate(T,R),e.fill(),e.translate(-T,-R)}e.globalAlpha=k,z&&this.setImgSmoothing(e,F)}};var sO={};sO.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(tP(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},sO.drawElementText=function(e,t,r,n,i){var a,o=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(null==n){if(o&&!this.eleTextBiggerThanMin(t))return}else if(!1===n)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;e.textAlign=this.getLabelJustification(t),e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,u=t.pstyle("label"),c=t.pstyle("source-label"),h=t.pstyle("target-label");if(l||(!u||!u.value)&&(!c||!c.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var d=!r;r&&(a=r,e.translate(-a.x1,-a.y1)),null==i?(this.drawText(e,t,null,d,o),t.isEdge()&&(this.drawText(e,t,"source",d,o),this.drawText(e,t,"target",d,o))):this.drawText(e,t,i,d,o),r&&e.translate(a.x1,a.y1)},sO.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if((t=this.fontCaches[r]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},sO.setupTextStyle=function(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=n+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},sO.getTextAngle=function(e,t){var r=e._private.rscratch,n=t?t+"-":"",i=e.pstyle(n+"text-rotation"),a=tu(r,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},sO.drawText=function(e,t,r){var n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===r&&(r=null);var s=tu(a,"labelX",r),l=tu(a,"labelY",r),u=this.getLabelText(t,r);if(null!=u&&""!==u&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,i);var c,h,d,f=r?r+"-":"",g=tu(a,"labelWidth",r),p=tu(a,"labelHeight",r),v=t.pstyle(f+"text-margin-x").pfValue,y=t.pstyle(f+"text-margin-y").pfValue,w=t.isEdge(),E=t.pstyle("text-halign").value,b=t.pstyle("text-valign").value;switch(w&&(E="center",b="center"),s+=v,l+=y,0!==(d=n?this.getTextAngle(t,r):0)&&(c=s,h=l,e.translate(c,h),e.rotate(d),s=0,l=0),b){case"top":break;case"center":l+=p/2;break;case"bottom":l+=p}var A=t.pstyle("text-background-opacity").value,C=t.pstyle("text-border-opacity").value,_=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue;if(A>0||_>0&&C>0){var I=s-S;switch(E){case"left":I-=g;break;case"center":I-=g/2}var T=l-p-S,x=g+2*S,D=p+2*S;if(A>0){var N=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+A*o+")",0===t.pstyle("text-background-shape").strValue.indexOf("round")?function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,r),e.lineTo(t+n-a,r),e.quadraticCurveTo(t+n,r,t+n,r+a),e.lineTo(t+n,r+i-a),e.quadraticCurveTo(t+n,r+i,t+n-a,r+i),e.lineTo(t+a,r+i),e.quadraticCurveTo(t,r+i,t,r+i-a),e.lineTo(t,r+a),e.quadraticCurveTo(t,r,t+a,r),e.closePath(),e.fill()}(e,I,T,x,D,2):e.fillRect(I,T,x,D),e.fillStyle=N}if(_>0&&C>0){var R=e.strokeStyle,O=e.lineWidth,P=t.pstyle("text-border-color").value,B=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+C*o+")",e.lineWidth=_,e.setLineDash)switch(B){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=_/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(I,T,x,D),"double"===B){var L=_/2;e.strokeRect(I+L,T+L,x-2*L,D-2*L)}e.setLineDash&&e.setLineDash([]),e.lineWidth=O,e.strokeStyle=R}}var k=2*t.pstyle("text-outline-width").pfValue;if(k>0&&(e.lineWidth=k),"wrap"===t.pstyle("text-wrap").value){var F=tu(a,"labelWrapCachedLines",r),z=tu(a,"labelLineHeight",r),U=g/2,V=this.getLabelJustification(t);switch("auto"===V||("left"===E?"left"===V?s+=-g:"center"===V&&(s+=-U):"center"===E?"left"===V?s+=-U:"right"===V&&(s+=U):"right"===E&&("center"===V?s+=U:"right"===V&&(s+=g))),b){case"top":case"center":case"bottom":l-=(F.length-1)*z}for(var H=0;H<F.length;H++)k>0&&e.strokeText(F[H],s,l),e.fillText(F[H],s,l),l+=z}else k>0&&e.strokeText(u,s,l),e.fillText(u,s,l);0!==d&&(e.rotate(-d),e.translate(-c,-h))}}};var sP={};sP.drawNode=function(e,t,r){var n,i,a,o,s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],u=!(arguments.length>5)||void 0===arguments[5]||arguments[5],c=this,h=t._private,d=h.rscratch,f=t.position();if(U(f.x)&&U(f.y)&&(!u||t.visible())){var g=u?t.effectiveOpacity():1,p=c.usePaths(),v=!1,y=t.padding();n=t.width()+2*y,i=t.height()+2*y,r&&(o=r,e.translate(-o.x1,-o.y1));for(var w=t.pstyle("background-image").value,E=Array(w.length),b=Array(w.length),A=0,C=0;C<w.length;C++){var _=w[C];if(E[C]=null!=_&&"none"!==_){var S=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",C);A++,b[C]=c.getCachedImage(_,S,function(){h.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var I=t.pstyle("background-blacken").value,T=t.pstyle("border-width").pfValue,x=t.pstyle("background-opacity").value*g,D=t.pstyle("border-color").value,N=t.pstyle("border-style").value,M=t.pstyle("border-opacity").value*g,R=t.pstyle("outline-width").pfValue,O=t.pstyle("outline-color").value,P=t.pstyle("outline-style").value,B=t.pstyle("outline-opacity").value*g,L=t.pstyle("outline-offset").value;e.lineJoin="miter";var k=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;c.eleFillStyle(e,t,r)},F=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;c.colorStrokeStyle(e,D[0],D[1],D[2],t)},z=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B;c.colorStrokeStyle(e,O[0],O[1],O[2],t)},V=function(e,t,r,n){var i,a=c.nodePathCache=c.nodePathCache||[],o=e$("polygon"===r?r+","+n.join(","):r,""+t,""+e),s=a[o],l=!1;return null!=s?(l=!0,d.pathCache=i=s):(i=new Path2D,a[o]=d.pathCache=i),{path:i,cacheHit:l}},H=t.pstyle("shape").strValue,j=t.pstyle("shape-polygon-points").pfValue;if(p){e.translate(f.x,f.y);var Y=V(n,i,H,j);a=Y.path,v=Y.cacheHit}var X=function(){if(!v){var r=f;p&&(r={x:0,y:0}),c.nodeShapes[c.getNodeShape(t)].draw(a||e,r.x,r.y,n,i)}p?e.fill(a):e.fill()},G=function(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=h.backgrounding,a=0,o=0;o<b.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);if(n&&"over"===s||!n&&"inside"===s){a++;continue}E[o]&&b[o].complete&&!b[o].error&&(a++,c.drawInscribedImage(e,b[o],t,o,r))}h.backgrounding=a!==A,i!==h.backgrounding&&t.updateStyle(!1)},W=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;c.hasPie(t)&&(c.drawPie(e,t,a),r&&!p&&c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,n,i))},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=I>0?0:255;0!==I&&(c.colorFillStyle(e,r,r,r,(I>0?I:-I)*t),p?e.fill(a):e.fill())},Z=function(){if(T>0){if(e.lineWidth=T,e.lineCap="butt",e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(p?e.stroke(a):e.stroke(),"double"===N){e.lineWidth=T/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(a):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},Q=function(){if(R>0){if(e.lineWidth=R,e.lineCap="butt",e.setLineDash)switch(P){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var r,a=f;p&&(a={x:0,y:0});var o=c.getNodeShape(t),s=(n+T+(R+L))/n,l=(i+T+(R+L))/i,u=n*s,h=i*l,d=c.nodeShapes[o].points;if(p&&(r=V(u,h,o,d).path),"ellipse"===o)c.drawEllipsePath(r||e,a.x,a.y,u,h);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(o)){var g=0,v=0,y=0;"round-diamond"===o?g=(T+L+R)*1.4:"round-heptagon"===o?(g=(T+L+R)*1.075,y=-(T/2+L+R)/35):"round-hexagon"===o?g=(T+L+R)*1.12:"round-pentagon"===o?(g=(T+L+R)*1.13,y=-(T/2+L+R)/15):"round-tag"===o?(g=(T+L+R)*1.12,v=(T/2+R+L)*.07):"round-triangle"===o&&(g=Math.PI/2*(T+L+R),y=-(T+L/2+R)/Math.PI),0!==g&&(s=(n+g)/n,l=(i+g)/i),c.drawRoundPolygonPath(r||e,a.x+v,a.y+y,n*s,i*l,d)}else["roundrectangle","round-rectangle"].includes(o)?c.drawRoundRectanglePath(r||e,a.x,a.y,u,h):["cutrectangle","cut-rectangle"].includes(o)?c.drawCutRectanglePath(r||e,a.x,a.y,u,h):["bottomroundrectangle","bottom-round-rectangle"].includes(o)?c.drawBottomRoundRectanglePath(r||e,a.x,a.y,u,h):"barrel"===o?c.drawBarrelPath(r||e,a.x,a.y,u,h):(d=o.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(o)?t9(re(d,(T+R+L)/n)):t9(re(d,-((T+R+L)/n))),c.drawPolygonPath(r||e,a.x,a.y,n,i,d));if(p?e.stroke(r):e.stroke(),"double"===P){e.lineWidth=T/3;var w=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(r):e.stroke(),e.globalCompositeOperation=w}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var K=t.pstyle("ghost-offset-x").pfValue,$=t.pstyle("ghost-offset-y").pfValue,J=t.pstyle("ghost-opacity").value,ee=J*g;e.translate(K,$),z(),Q(),k(J*x),X(),G(ee,!0),F(J*M),Z(),W(0!==I||0!==T),G(ee,!1),q(ee),e.translate(-K,-$)}p&&e.translate(-f.x,-f.y),l&&c.drawNodeUnderlay(e,t,f,n,i),p&&e.translate(f.x,f.y),z(),Q(),k(),X(),G(g,!0),F(),Z(),W(0!==I||0!==T),G(g,!1),q(),p&&e.translate(-f.x,-f.y),c.drawElementText(e,t,null,s),l&&c.drawNodeOverlay(e,t,f,n,i),r&&e.translate(o.x1,o.y1)}};var sB=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,r,n,i,a){if(r.visible()){var o=r.pstyle("".concat(e,"-padding")).pfValue,s=r.pstyle("".concat(e,"-opacity")).value,l=r.pstyle("".concat(e,"-color")).value,u=r.pstyle("".concat(e,"-shape")).value;if(s>0){if(n=n||r.position(),null==i||null==a){var c=r.padding();i=r.width()+2*c,a=r.height()+2*c}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,n.x,n.y,i+2*o,a+2*o),t.fill()}}}};sP.drawNodeOverlay=sB("overlay"),sP.drawNodeUnderlay=sB("underlay"),sP.hasPie=function(e){return(e=e[0])._private.hasPie},sP.drawPie=function(e,t,r,n){t=t[0],n=n||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=n.x,s=n.y,l=Math.min(t.width(),t.height())/2,u=0;this.usePaths()&&(o=0,s=0),"%"===a.units?l*=a.pfValue:void 0!==a.pfValue&&(l=a.pfValue/2);for(var c=1;c<=i.pieBackgroundN;c++){var h=t.pstyle("pie-"+c+"-background-size").value,d=t.pstyle("pie-"+c+"-background-color").value,f=t.pstyle("pie-"+c+"-background-opacity").value*r,g=h/100;g+u>1&&(g=1-u);var p=1.5*Math.PI+2*Math.PI*u,v=p+2*Math.PI*g;0===h||u>=1||u+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,l,p,v),e.closePath(),this.colorFillStyle(e,d[0],d[1],d[2],f),e.fill(),u+=g)}};var sL={};sL.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},sL.paintCache=function(e){for(var t,r=this.paintCaches=this.paintCaches||[],n=!0,i=0;i<r.length;i++)if((t=r[i]).context===e){n=!1;break}return n&&(t={context:e},r.push(t)),t},sL.createGradientStyleFor=function(e,t,r,n,i){var a,o=this.usePaths(),s=r.pstyle(t+"-gradient-stop-colors").value,l=r.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===n)if(r.isEdge()){var u=r.sourceEndpoint(),c=r.targetEndpoint(),h=r.midpoint(),d=tL(u,h),f=tL(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(d,f))}else{var g=o?{x:0,y:0}:r.position(),p=r.paddedWidth(),v=r.paddedHeight();a=e.createRadialGradient(g.x,g.y,0,g.x,g.y,Math.max(p,v))}else if(r.isEdge()){var y=r.sourceEndpoint(),w=r.targetEndpoint();a=e.createLinearGradient(y.x,y.y,w.x,w.y)}else{var E=o?{x:0,y:0}:r.position(),b=r.paddedWidth(),A=r.paddedHeight(),C=b/2,_=A/2;switch(r.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(E.x,E.y-_,E.x,E.y+_);break;case"to-top":a=e.createLinearGradient(E.x,E.y+_,E.x,E.y-_);break;case"to-left":a=e.createLinearGradient(E.x+C,E.y,E.x-C,E.y);break;case"to-right":a=e.createLinearGradient(E.x-C,E.y,E.x+C,E.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(E.x-C,E.y-_,E.x+C,E.y+_);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(E.x-C,E.y+_,E.x+C,E.y-_);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(E.x+C,E.y-_,E.x-C,E.y+_);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(E.x+C,E.y+_,E.x-C,E.y-_)}}if(!a)return null;for(var S=l.length===s.length,I=s.length,T=0;T<I;T++)a.addColorStop(S?l[T]:T/(I-1),"rgba("+s[T][0]+","+s[T][1]+","+s[T][2]+","+i+")");return a},sL.gradientFillStyle=function(e,t,r,n){var i=this.createGradientStyleFor(e,"background",t,r,n);if(!i)return null;e.fillStyle=i},sL.colorFillStyle=function(e,t,r,n,i){e.fillStyle="rgba("+t+","+r+","+n+","+i+")"},sL.eleFillStyle=function(e,t,r){var n=t.pstyle("background-fill").value;if("linear-gradient"===n||"radial-gradient"===n)this.gradientFillStyle(e,t,n,r);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],r)}},sL.gradientStrokeStyle=function(e,t,r,n){var i=this.createGradientStyleFor(e,"line",t,r,n);if(!i)return null;e.strokeStyle=i},sL.colorStrokeStyle=function(e,t,r,n,i){e.strokeStyle="rgba("+t+","+r+","+n+","+i+")"},sL.eleStrokeStyle=function(e,t,r){var n=t.pstyle("line-fill").value;if("linear-gradient"===n||"radial-gradient"===n)this.gradientStrokeStyle(e,t,n,r);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],r)}},sL.matchCanvasSize=function(e){var t,r=this.data,n=this.findContainerClientCoords(),i=n[2],a=n[3],o=this.getPixelRatio(),s=this.motionBlurPxRatio;(e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_NODE]||e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var l=i*o,u=a*o;if(l!==this.canvasWidth||u!==this.canvasHeight){this.fontCaches=null;var c=r.canvasContainer;c.style.width=i+"px",c.style.height=a+"px";for(var h=0;h<this.CANVAS_LAYERS;h++)(t=r.canvases[h]).width=l,t.height=u,t.style.width=i+"px",t.style.height=a+"px";for(var h=0;h<this.BUFFER_COUNT;h++)(t=r.bufferCanvases[h]).width=l,t.height=u,t.style.width=i+"px",t.style.height=a+"px";this.textureMult=1,o<=1&&(t=r.bufferCanvases[this.TEXTURE_BUFFER],this.textureMult=2,t.width=l*this.textureMult,t.height=u*this.textureMult),this.canvasWidth=l,this.canvasHeight=u}},sL.renderTo=function(e,t,r,n){this.render({forcedContext:e,forcedZoom:t,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})},sL.render=function(e){var t=(e=e||ti()).forcedContext,r=e.drawAllLayers,n=e.drawOnlyNodeLayer,i=e.forcedZoom,a=e.forcedPan,o=this,s=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,l=o.cy,u=o.data,c=u.canvasNeedsRedraw,h=o.textureOnViewport&&!t&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),d=void 0!==e.motionBlur?e.motionBlur:o.motionBlur,f=o.motionBlurPxRatio,g=l.hasCompoundNodes(),p=o.hoverData.draggingEles,v=!!o.hoverData.selecting||!!o.touchData.selecting,y=d=d&&!t&&o.motionBlurEnabled&&!v;t||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!t&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),d&&(null==o.mbFrames&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(y=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!h&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var w=l.style(),E=l.zoom(),b=void 0!==i?i:E,A=l.pan(),C={x:A.x,y:A.y},_={zoom:E,pan:{x:A.x,y:A.y}},S=o.prevViewport;void 0===S||_.zoom!==S.zoom||_.pan.x!==S.pan.x||_.pan.y!==S.pan.y||p&&!g||(o.motionBlurPxRatio=1),a&&(C=a),b*=s,C.x*=s,C.y*=s;var I=o.getCachedZSortedEles();function T(e,t,r,n,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,r,n,i),e.globalCompositeOperation=a}function x(e,n){var s,l,c,h;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=C,l=b,c=o.canvasWidth,h=o.canvasHeight):(s={x:A.x*f,y:A.y*f},l=E*f,c=o.canvasWidth*f,h=o.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?T(e,0,0,c,h):!t&&(void 0===n||n)&&e.clearRect(0,0,c,h),r||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(h||(o.textureDrawLastFrame=!1),h){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var D=o.data.bufferContexts[o.TEXTURE_BUFFER];D.setTransform(1,0,0,1,0,0),D.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:D,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult});var _=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight};_.mpan={x:(0-_.pan.x)/_.zoom,y:(0-_.pan.y)/_.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var N=u.contexts[o.NODE],M=o.textureCache.texture,_=o.textureCache.viewport;N.setTransform(1,0,0,1,0,0),d?T(N,0,0,_.width,_.height):N.clearRect(0,0,_.width,_.height);var R=w.core("outside-texture-bg-color").value,O=w.core("outside-texture-bg-opacity").value;o.colorFillStyle(N,R[0],R[1],R[2],O),N.fillRect(0,0,_.width,_.height);var E=l.zoom();x(N,!1),N.clearRect(_.mpan.x,_.mpan.y,_.width/_.zoom/s,_.height/_.zoom/s),N.drawImage(M,_.mpan.x,_.mpan.y,_.width/_.zoom/s,_.height/_.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var P=l.extent(),B=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),L=o.hideEdgesOnViewport&&B,k=[];if(k[o.NODE]=!c[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,k[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),k[o.DRAG]=!c[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,k[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||r||n||k[o.NODE]){var F=d&&!k[o.NODE]&&1!==f,N=t||(F?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]);x(N,d&&!F?"motionBlur":void 0),L?o.drawCachedNodes(N,I.nondrag,s,P):o.drawLayeredElements(N,I.nondrag,s,P),o.debug&&o.drawDebugPoints(N,I.nondrag),r||d||(c[o.NODE]=!1)}if(!n&&(c[o.DRAG]||r||k[o.DRAG])){var F=d&&!k[o.DRAG]&&1!==f,N=t||(F?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]);x(N,d&&!F?"motionBlur":void 0),L?o.drawCachedNodes(N,I.drag,s,P):o.drawCachedElements(N,I.drag,s,P),o.debug&&o.drawDebugPoints(N,I.drag),r||d||(c[o.DRAG]=!1)}if(o.showFps||!n&&c[o.SELECT_BOX]&&!r){var N=t||u.contexts[o.SELECT_BOX];if(x(N),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){var E=o.cy.zoom(),z=w.core("selection-box-border-width").value/E;N.lineWidth=z,N.fillStyle="rgba("+w.core("selection-box-color").value[0]+","+w.core("selection-box-color").value[1]+","+w.core("selection-box-color").value[2]+","+w.core("selection-box-opacity").value+")",N.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),z>0&&(N.strokeStyle="rgba("+w.core("selection-box-border-color").value[0]+","+w.core("selection-box-border-color").value[1]+","+w.core("selection-box-border-color").value[2]+","+w.core("selection-box-opacity").value+")",N.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){var E=o.cy.zoom(),U=u.bgActivePosistion;N.fillStyle="rgba("+w.core("active-bg-color").value[0]+","+w.core("active-bg-color").value[1]+","+w.core("active-bg-color").value[2]+","+w.core("active-bg-opacity").value+")",N.beginPath(),N.arc(U.x,U.y,w.core("active-bg-size").pfValue/E,0,2*Math.PI),N.fill()}var V=o.lastRedrawTime;if(o.showFps&&V){var H=Math.round(1e3/(V=Math.round(V)));N.setTransform(1,0,0,1,0,0),N.fillStyle="rgba(255, 0, 0, 0.75)",N.strokeStyle="rgba(255, 0, 0, 0.75)",N.lineWidth=1,N.fillText("1 frame = "+V+" ms = "+H+" fps",0,20),N.strokeRect(0,30,250,20),N.fillRect(0,30,250*Math.min(H/60,1),20)}r||(c[o.SELECT_BOX]=!1)}if(d&&1!==f){var j=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],G=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],W=function(e,t,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):T(e,0,0,o.canvasWidth,o.canvasHeight),e.drawImage(t,0,0,o.canvasWidth*f,o.canvasHeight*f,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||k[o.NODE])&&(W(j,Y,k[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||k[o.DRAG])&&(W(X,G,k[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=_,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!h,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()},100)),t||l.emit("render")};var sk={};sk.drawPolygonPath=function(e,t,r,n,i,a){var o=n/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],r+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],r+s*a[2*l+1]);e.closePath()},sk.drawRoundPolygonPath=function(e,t,r,n,i,a){var o=n/2,s=i/2,l=rf(n,i);e.beginPath&&e.beginPath();for(var u=0;u<a.length/4;u++){var c=void 0,h=void 0;c=0===u?a.length-2:4*u-2,h=4*u+2;var d=t+o*a[4*u],f=r+s*a[4*u+1],g=l/Math.tan(Math.acos(-a[c]*a[h]-a[c+1]*a[h+1])/2),p=d-g*a[c],v=f-g*a[c+1],y=d+g*a[h],w=f+g*a[h+1];0===u?e.moveTo(p,v):e.lineTo(p,v),e.arcTo(d,f,y,w,l)}e.closePath()},sk.drawRoundRectanglePath=function(e,t,r,n,i){var a=n/2,o=i/2,s=rd(n,i);e.beginPath&&e.beginPath(),e.moveTo(t,r-o),e.arcTo(t+a,r-o,t+a,r,s),e.arcTo(t+a,r+o,t,r+o,s),e.arcTo(t-a,r+o,t-a,r,s),e.arcTo(t-a,r-o,t,r-o,s),e.lineTo(t,r-o),e.closePath()},sk.drawBottomRoundRectanglePath=function(e,t,r,n,i){var a=n/2,o=i/2,s=rd(n,i);e.beginPath&&e.beginPath(),e.moveTo(t,r-o),e.lineTo(t+a,r-o),e.lineTo(t+a,r),e.arcTo(t+a,r+o,t,r+o,s),e.arcTo(t-a,r+o,t-a,r,s),e.lineTo(t-a,r-o),e.lineTo(t,r-o),e.closePath()},sk.drawCutRectanglePath=function(e,t,r,n,i){var a=n/2,o=i/2,s=rg();e.beginPath&&e.beginPath(),e.moveTo(t-a+s,r-o),e.lineTo(t+a-s,r-o),e.lineTo(t+a,r-o+s),e.lineTo(t+a,r+o-s),e.lineTo(t+a-s,r+o),e.lineTo(t-a+s,r+o),e.lineTo(t-a,r+o-s),e.lineTo(t-a,r-o+s),e.closePath()},sk.drawBarrelPath=function(e,t,r,n,i){var a=n/2,o=i/2,s=t-a,l=t+a,u=r-o,c=r+o,h=rp(n,i),d=h.widthOffset,f=h.heightOffset,g=h.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(s,u+f),e.lineTo(s,c-f),e.quadraticCurveTo(s+g,c,s+d,c),e.lineTo(l-d,c),e.quadraticCurveTo(l-g,c,l,c-f),e.lineTo(l,u+f),e.quadraticCurveTo(l-g,u,l-d,u),e.lineTo(s+d,u),e.quadraticCurveTo(s+g,u,s,u+f),e.closePath()};for(var sF={},sz={},sU=Math.PI/40,sV=0*Math.PI;sV<2*Math.PI;sV+=sU)sF[sV]=Math.sin(sV),sz[sV]=Math.cos(sV);sk.drawEllipsePath=function(e,t,r,n,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,r,n/2,i/2,0,0,2*Math.PI);else for(var a,o,s=n/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=sU)a=t-s*sF[u]*0+s*sz[u]*1,o=r+l*sz[u]*0+l*sF[u]*1,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var sH={};function sj(e){var t=e.indexOf(",");return e.substr(t+1)}function sY(e,t,r){var n=function(){return t.toDataURL(r,e.quality)};switch(e.output){case"blob-promise":return new nE(function(n,i){try{t.toBlob(function(e){null!=e?n(e):i(Error("`canvas.toBlob()` sent a null value in its callback"))},r,e.quality)}catch(e){i(e)}});case"blob":return function(e,t){for(var r=atob(e),n=new ArrayBuffer(r.length),i=new Uint8Array(n),a=0;a<r.length;a++)i[a]=r.charCodeAt(a);return new Blob([n],{type:t})}(sj(n()),r);case"base64":return sj(n());default:return n()}}sH.createBuffer=function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,[r,r.getContext("2d")]},sH.bufferCanvasImage=function(e){var t=this.cy,r=t.mutableElements().boundingBox(),n=this.findContainerClientCoords(),i=e.full?Math.ceil(r.w):n[2],a=e.full?Math.ceil(r.h):n[3],o=U(e.maxWidth)||U(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;U(e.maxWidth)&&(u=l*e.maxWidth/i),U(e.maxHeight)&&(c=l*e.maxHeight/a),i*=l=Math.min(u,c),a*=l}o||(i*=s,a*=s,l*=s);var h=document.createElement("canvas");h.width=i,h.height=a,h.style.width=i+"px",h.style.height=a+"px";var d=h.getContext("2d");if(i>0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)d.translate(-r.x1*l,-r.y1*l),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(r.x1*l,r.y1*l);else{var g=t.pan(),p={x:g.x*l,y:g.y*l};l*=t.zoom(),d.translate(p.x,p.y),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(-p.x,-p.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},sH.png=function(e){return sY(e,this.bufferCanvasImage(e),"image/png")},sH.jpg=function(e){return sY(e,this.bufferCanvasImage(e),"image/jpeg")};var sX={};sX.nodeShapeImpl=function(e,t,r,n,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,r,n,i,a);case"polygon":return this.drawPolygonPath(t,r,n,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,r,n,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,r,n,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,r,n,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,r,n,i,a);case"barrel":return this.drawBarrelPath(t,r,n,i,a)}};var sG=sW.prototype;function sW(e){var t=this;t.data={canvases:Array(sG.CANVAS_LAYERS),contexts:Array(sG.CANVAS_LAYERS),canvasNeedsRedraw:Array(sG.CANVAS_LAYERS),bufferCanvases:Array(sG.BUFFER_COUNT),bufferContexts:Array(sG.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",n="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=n,i.position="relative",i.zIndex="0",i.overflow="hidden";var a=e.cy.container();a.appendChild(t.data.canvasContainer),a.style[r]=n;var o={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};N&&N.userAgent.match(/msie|trident|edge/i)&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var s=0;s<sG.CANVAS_LAYERS;s++){var l=t.data.canvases[s]=document.createElement("canvas");t.data.contexts[s]=l.getContext("2d"),Object.keys(o).forEach(function(e){l.style[e]=o[e]}),l.style.position="absolute",l.setAttribute("data-id","layer"+s),l.style.zIndex=String(sG.CANVAS_LAYERS-s),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[s]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[sG.NODE].setAttribute("data-id","layer"+sG.NODE+"-node"),t.data.canvases[sG.SELECT_BOX].setAttribute("data-id","layer"+sG.SELECT_BOX+"-selectbox"),t.data.canvases[sG.DRAG].setAttribute("data-id","layer"+sG.DRAG+"-drag");for(var s=0;s<sG.BUFFER_COUNT;s++)t.data.bufferCanvases[s]=document.createElement("canvas"),t.data.bufferContexts[s]=t.data.bufferCanvases[s].getContext("2d"),t.data.bufferCanvases[s].style.position="absolute",t.data.bufferCanvases[s].setAttribute("data-id","buffer"+s),t.data.bufferCanvases[s].style.zIndex=String(-s-1),t.data.bufferCanvases[s].style.visibility="hidden";t.pathsEnabled=!0;var u=tj(),c=function(e){return{x:-e.w/2,y:-e.h/2}},h=function(e){return e.boundingBox(),e[0]._private.bodyBounds},d=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||u},f=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||u},g=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||u},p=function(e,t){return t},v=function(e,t,r){var n=e?e+"-":"";return{x:t.x+r.pstyle(n+"text-margin-x").pfValue,y:t.y+r.pstyle(n+"text-margin-y").pfValue}},y=function(e,t,r){var n=e[0]._private.rscratch;return{x:n[t],y:n[r]}},w=t.data.eleTxrCache=new sd(t,{getKey:function(e){return e[0]._private.nodeKey},doesEleInvalidateKey:function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},drawElement:function(e,r,n,i,a){return t.drawElement(e,r,n,!1,!1,a)},getBoundingBox:h,getRotationPoint:function(e){var t;return{x:((t=h(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2}},getRotationOffset:function(e){return c(h(e))},allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),E=t.data.lblTxrCache=new sd(t,{getKey:function(e){return e[0]._private.labelStyleKey},drawElement:function(e,r,n,i,a){return t.drawElementText(e,r,n,i,"main",a)},getBoundingBox:d,getRotationPoint:function(e){return v("",y(e,"labelX","labelY"),e)},getRotationOffset:function(e){var t=d(e),r=c(d(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":r.x=-t.w;break;case"right":r.x=0}switch(e.pstyle("text-valign").value){case"top":r.y=-t.h;break;case"bottom":r.y=0}}return r},isVisible:p}),b=t.data.slbTxrCache=new sd(t,{getKey:function(e){return e[0]._private.sourceLabelStyleKey},drawElement:function(e,r,n,i,a){return t.drawElementText(e,r,n,i,"source",a)},getBoundingBox:f,getRotationPoint:function(e){return v("source",y(e,"sourceLabelX","sourceLabelY"),e)},getRotationOffset:function(e){return c(f(e))},isVisible:p}),A=t.data.tlbTxrCache=new sd(t,{getKey:function(e){return e[0]._private.targetLabelStyleKey},drawElement:function(e,r,n,i,a){return t.drawElementText(e,r,n,i,"target",a)},getBoundingBox:g,getRotationPoint:function(e){return v("target",y(e,"targetLabelX","targetLabelY"),e)},getRotationOffset:function(e){return c(g(e))},isVisible:p}),C=t.data.lyrTxrCache=new sg(t);t.onUpdateEleCalcs(function(e,t){w.invalidateElements(t),E.invalidateElements(t),b.invalidateElements(t),A.invalidateElements(t),C.invalidateElements(t);for(var r=0;r<t.length;r++){var n=t[r]._private;n.oldBackgroundTimestamp=n.backgroundTimestamp}});var _=function(e){for(var t=0;t<e.length;t++)C.enqueueElementRefinement(e[t].ele)};w.onDequeue(_),E.onDequeue(_),b.onDequeue(_),A.onDequeue(_)}sG.CANVAS_LAYERS=3,sG.SELECT_BOX=0,sG.DRAG=1,sG.NODE=2,sG.BUFFER_COUNT=3,sG.TEXTURE_BUFFER=0,sG.MOTIONBLUR_BUFFER_NODE=1,sG.MOTIONBLUR_BUFFER_DRAG=2,sG.redrawHint=function(e,t){switch(e){case"eles":this.data.canvasNeedsRedraw[sG.NODE]=t;break;case"drag":this.data.canvasNeedsRedraw[sG.DRAG]=t;break;case"select":this.data.canvasNeedsRedraw[sG.SELECT_BOX]=t}};var sq="u">typeof Path2D;sG.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},sG.usePaths=function(){return sq&&this.pathsEnabled},sG.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},sG.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},sG.makeOffscreenCanvas=function(t,r){var n;return("u"<typeof OffscreenCanvas?"undefined":e(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(t,r):((n=document.createElement("canvas")).width=t,n.height=r),n},[sv,sC,sN,sR,sO,sP,sL,sk,sH,sX].forEach(function(e){eo(sG,e)});var sZ=[{name:"null",impl:oX},{name:"base",impl:sa},{name:"canvas",impl:sW}],sQ={},sK={};function s$(e,t,r){var n=r,i=function(r){te("Can not register `"+t+"` for `"+e+"` since `"+r+"` already exists in the prototype and can not be overridden")};if("core"===e)if(oi.prototype[t])return i(t);else oi.prototype[t]=r;else if("collection"===e)if(ak.prototype[t])return i(t);else ak.prototype[t]=r;else if("layout"===e){for(var a=function(e){this.options=e,r.call(this,e),z(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(r.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=r.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var r=0;r<t.length;r++)t[r].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};eo(o,{createEmitter:function(){return this._private.emitter=new as(d,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),ih.eventAliasesOn(o),n=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=sJ("renderer","base"),g=f.prototype,p=r.prototype,v=function(){f.apply(this,arguments),r.apply(this,arguments)},y=v.prototype;for(var w in g){var E=g[w];if(null!=p[w])return i(w);y[w]=E}for(var b in p)y[b]=p[b];g.clientFunctions.forEach(function(e){y[e]=y[e]||function(){e7("Renderer does not implement `renderer."+e+"()` on its prototype")}}),n=v}else if("__proto__"===e||"constructor"===e||"prototype"===e)return e7(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return eh({map:sQ,keys:[e,t],value:n})}function sJ(e,t){return ed({map:sQ,keys:[e,t]})}function s1(e,t,r,n,i){return eh({map:sK,keys:[e,t,r,n],value:i})}function s0(e,t,r,n){return ed({map:sK,keys:[e,t,r,n]})}var s2=function(){return 2==arguments.length?sJ.apply(null,arguments):3==arguments.length?s$.apply(null,arguments):4==arguments.length?s0.apply(null,arguments):5==arguments.length?s1.apply(null,arguments):void e7("Invalid extension access syntax")};oi.prototype.extension=s2,[{type:"layout",extensions:oY},{type:"renderer",extensions:sZ}].forEach(function(e){e.extensions.forEach(function(t){s$(e.type,t.name,t.impl)})});var s3=function e(){if(!(this instanceof e))return new e;this.length=0},s4=s3.prototype;s4.instanceString=function(){return"stylesheet"},s4.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},s4.css=function(e,t){var r=this.length-1;if(L(e))this[r].properties.push({name:e,value:t});else if(z(e))for(var n=Object.keys(e),i=0;i<n.length;i++){var a=n[i],o=e[a];if(null!=o){var s=oe.properties[a]||oe.properties[K(a)];if(null!=s){var l=s.name;this[r].properties.push({name:l,value:o})}}}return this},s4.style=s4.css,s4.generateStyle=function(e){var t=new oe(e);return this.appendToStyle(t)},s4.appendToStyle=function(e){for(var t=0;t<this.length;t++){var r=this[t],n=r.selector,i=r.properties;e.selector(n);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var s8=function(e){return(void 0===e&&(e={}),z(e))?new oi(e):L(e)?s2.apply(s2,arguments):void 0};return s8.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(s8),e.apply(null,t),this},s8.warnings=function(e){return e9(e)},s8.version="3.28.0",s8.stylesheet=s8.Stylesheet=s3,s8}()},38362(e,t,r){var n=r(31166);e.exports={Graph:n.Graph,json:r(57494),alg:r(31667),version:n.version}},33619(e,t,r){var n=r(10117);e.exports=function(e){var t,r={},i=[];return n.each(e.nodes(),function(a){t=[],function i(a){n.has(r,a)||(r[a]=!0,t.push(a),n.each(e.successors(a),i),n.each(e.predecessors(a),i))}(a),t.length&&i.push(t)}),i}},29276(e,t,r){var n=r(10117);e.exports=function(e,t,r){n.isArray(t)||(t=[t]);var i=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],o={};return n.each(t,function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);!function e(t,r,i,a,o,s){!n.has(a,r)&&(a[r]=!0,i||s.push(r),n.each(o(r),function(r){e(t,r,i,a,o,s)}),i&&s.push(r))}(e,t,"post"===r,o,i,a)}),a}},34919(e,t,r){var n=r(28905),i=r(10117);e.exports=function(e,t,r){return i.transform(e.nodes(),function(i,a){i[a]=n(e,a,t,r)},{})}},28905(e,t,r){var n=r(10117),i=r(71737);e.exports=function(e,t,r,n){return function(e,t,r,n){var a,o,s={},l=new i,u=function(e){var t=e.v!==a?e.v:e.w,n=s[t],i=r(e),u=o.distance+i;if(i<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+i);u<n.distance&&(n.distance=u,n.predecessor=a,l.decrease(t,u))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;s[e]={distance:r},l.add(e,r)});l.size()>0&&(o=s[a=l.removeMin()]).distance!==1/0;)n(a).forEach(u);return s}(e,String(t),r||a,n||function(t){return e.outEdges(t)})};var a=n.constant(1)},16678(e,t,r){var n=r(10117),i=r(16291);e.exports=function(e){return n.filter(i(e),function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}},73590(e,t,r){var n=r(10117);e.exports=function(e,t,r){var n,a,o,s,l;return n=e,a=t||i,o=r||function(t){return e.outEdges(t)},s={},(l=n.nodes()).forEach(function(e){s[e]={},s[e][e]={distance:0},l.forEach(function(t){e!==t&&(s[e][t]={distance:1/0})}),o(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);s[e][r]={distance:n,predecessor:e}})}),l.forEach(function(e){var t=s[e];l.forEach(function(r){var n=s[r];l.forEach(function(r){var i=n[e],a=t[r],o=n[r],s=i.distance+a.distance;s<o.distance&&(o.distance=s,o.predecessor=a.predecessor)})})}),s};var i=n.constant(1)},31667(e,t,r){e.exports={components:r(33619),dijkstra:r(28905),dijkstraAll:r(34919),findCycles:r(16678),floydWarshall:r(73590),isAcyclic:r(60498),postorder:r(31045),preorder:r(46016),prim:r(24423),tarjan:r(16291),topsort:r(29888)}},60498(e,t,r){var n=r(29888);e.exports=function(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}},31045(e,t,r){var n=r(29276);e.exports=function(e,t){return n(e,t,"post")}},46016(e,t,r){var n=r(29276);e.exports=function(e,t){return n(e,t,"pre")}},24423(e,t,r){var n=r(10117),i=r(66454),a=r(71737);e.exports=function(e,t){var r,o=new i,s={},l=new a;function u(e){var n=e.v===r?e.w:e.v,i=l.priority(n);if(void 0!==i){var a=t(e);a<i&&(s[n]=r,l.decrease(n,a))}}if(0===e.nodeCount())return o;n.each(e.nodes(),function(e){l.add(e,1/0),o.setNode(e)}),l.decrease(e.nodes()[0],0);for(var c=!1;l.size()>0;){if(r=l.removeMin(),n.has(s,r))o.setEdge(r,s[r]);else if(c)throw Error("Input graph is not connected: "+e);else c=!0;e.nodeEdges(r).forEach(u)}return o}},16291(e,t,r){var n=r(10117);e.exports=function(e){var t=0,r=[],i={},a=[];return e.nodes().forEach(function(o){n.has(i,o)||function o(s){var l=i[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),e.successors(s).forEach(function(e){n.has(i,e)?i[e].onStack&&(l.lowlink=Math.min(l.lowlink,i[e].index)):(o(e),l.lowlink=Math.min(l.lowlink,i[e].lowlink))}),l.lowlink===l.index){var u,c=[];do i[u=r.pop()].onStack=!1,c.push(u);while(s!==u);a.push(c)}}(o)}),a}},29888(e,t,r){var n=r(10117);function i(e){var t={},r={},i=[];if(n.each(e.sinks(),function o(s){if(n.has(r,s))throw new a;n.has(t,s)||(r[s]=!0,t[s]=!0,n.each(e.predecessors(s),o),delete r[s],i.push(s))}),n.size(t)!==e.nodeCount())throw new a;return i}function a(){}e.exports=i,i.CycleException=a,a.prototype=Error()},71737(e,t,r){var n=r(10117);function i(){this._arr=[],this._keyIndices={}}e.exports=i,i.prototype.size=function(){return this._arr.length},i.prototype.keys=function(){return this._arr.map(function(e){return e.key})},i.prototype.has=function(e){return n.has(this._keyIndices,e)},i.prototype.priority=function(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority},i.prototype.min=function(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key},i.prototype.add=function(e,t){var r=this._keyIndices;if(e=String(e),!n.has(r,e)){var i=this._arr,a=i.length;return r[e]=a,i.push({key:e,priority:t}),this._decrease(a),!0}return!1},i.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},i.prototype.decrease=function(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)},i.prototype._heapify=function(e){var t=this._arr,r=2*e,n=r+1,i=e;r<t.length&&(i=t[r].priority<t[i].priority?r:i,n<t.length&&(i=t[n].priority<t[i].priority?n:i),i!==e&&(this._swap(e,i),this._heapify(i)))},i.prototype._decrease=function(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t},i.prototype._swap=function(e,t){var r=this._arr,n=this._keyIndices,i=r[e],a=r[t];r[e]=a,r[t]=i,n[a.key]=e,n[i.key]=t}},66454(e,t,r){"use strict";var n=r(10117);function i(e){this._isDirected=!n.has(e,"directed")||e.directed,this._isMultigraph=!!n.has(e,"multigraph")&&e.multigraph,this._isCompound=!!n.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function a(e,t){e[t]?e[t]++:e[t]=1}function o(e,t){--e[t]||delete e[t]}function s(e,t,r,i){var a=""+t,o=""+r;if(!e&&a>o){var s=a;a=o,o=s}return a+"\x01"+o+"\x01"+(n.isUndefined(i)?"\0":i)}function l(e,t){return s(e,t.v,t.w,t.name)}e.exports=i,i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(e){return this._label=e,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(e){return n.isFunction(e)||(e=n.constant(e)),this._defaultNodeLabelFn=e,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var e=this;return n.filter(this.nodes(),function(t){return n.isEmpty(e._in[t])})},i.prototype.sinks=function(){var e=this;return n.filter(this.nodes(),function(t){return n.isEmpty(e._out[t])})},i.prototype.setNodes=function(e,t){var r=arguments,i=this;return n.each(e,function(e){r.length>1?i.setNode(e,t):i.setNode(e)}),this},i.prototype.setNode=function(e,t){return n.has(this._nodes,e)?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this},i.prototype.node=function(e){return this._nodes[e]},i.prototype.hasNode=function(e){return n.has(this._nodes,e)},i.prototype.removeNode=function(e){var t=this;if(n.has(this._nodes,e)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],n.each(this.children(e),function(e){t.setParent(e)}),delete this._children[e]),n.each(n.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],n.each(n.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},i.prototype.setParent=function(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(n.isUndefined(t))t="\0";else{t+="";for(var r=t;!n.isUndefined(r);r=this.parent(r))if(r===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},i.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},i.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}},i.prototype.children=function(e){if(n.isUndefined(e)&&(e="\0"),this._isCompound){var t=this._children[e];if(t)return n.keys(t)}else if("\0"===e)return this.nodes();else if(this.hasNode(e))return[]},i.prototype.predecessors=function(e){var t=this._preds[e];if(t)return n.keys(t)},i.prototype.successors=function(e){var t=this._sucs[e];if(t)return n.keys(t)},i.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return n.union(t,this.successors(e))},i.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},i.prototype.filterNodes=function(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;n.each(this._nodes,function(r,n){e(n)&&t.setNode(n,r)}),n.each(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var i={};return this._isCompound&&n.each(t.nodes(),function(e){t.setParent(e,function e(n){var a=r.parent(n);return void 0===a||t.hasNode(a)?(i[n]=a,a):a in i?i[a]:e(a)}(e))}),t},i.prototype.setDefaultEdgeLabel=function(e){return n.isFunction(e)||(e=n.constant(e)),this._defaultEdgeLabelFn=e,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(e,t){var r=this,i=arguments;return n.reduce(e,function(e,n){return i.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n}),this},i.prototype.setEdge=function(){var e,t,r,i,o=!1,l=arguments[0];"object"==typeof l&&null!==l&&"v"in l?(e=l.v,t=l.w,r=l.name,2==arguments.length&&(i=arguments[1],o=!0)):(e=l,t=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),e=""+e,t=""+t,n.isUndefined(r)||(r=""+r);var u=s(this._isDirected,e,t,r);if(n.has(this._edgeLabels,u))return o&&(this._edgeLabels[u]=i),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[u]=o?i:this._defaultEdgeLabelFn(e,t,r);var c=function(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return n&&(s.name=n),s}(this._isDirected,e,t,r);return e=c.v,t=c.w,Object.freeze(c),this._edgeObjs[u]=c,a(this._preds[t],e),a(this._sucs[e],t),this._in[t][u]=c,this._out[e][u]=c,this._edgeCount++,this},i.prototype.edge=function(e,t,r){var n=1==arguments.length?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,r);return this._edgeLabels[n]},i.prototype.hasEdge=function(e,t,r){var i=1==arguments.length?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,r);return n.has(this._edgeLabels,i)},i.prototype.removeEdge=function(e,t,r){var n=1==arguments.length?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,r),i=this._edgeObjs[n];return i&&(e=i.v,t=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],o(this._preds[t],e),o(this._sucs[e],t),delete this._in[t][n],delete this._out[e][n],this._edgeCount--),this},i.prototype.inEdges=function(e,t){var r=this._in[e];if(r){var i=n.values(r);return t?n.filter(i,function(e){return e.v===t}):i}},i.prototype.outEdges=function(e,t){var r=this._out[e];if(r){var i=n.values(r);return t?n.filter(i,function(e){return e.w===t}):i}},i.prototype.nodeEdges=function(e,t){var r=this.inEdges(e,t);if(r)return r.concat(this.outEdges(e,t))}},31166(e,t,r){e.exports={Graph:r(66454),version:r(44458)}},57494(e,t,r){var n=r(10117),i=r(66454);e.exports={write:function(e){var t,r,i={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e,n.map(t.nodes(),function(e){var r=t.node(e),i=t.parent(e),a={v:e};return n.isUndefined(r)||(a.value=r),n.isUndefined(i)||(a.parent=i),a})),edges:(r=e,n.map(r.edges(),function(e){var t=r.edge(e),i={v:e.v,w:e.w};return n.isUndefined(e.name)||(i.name=e.name),n.isUndefined(t)||(i.value=t),i}))};return n.isUndefined(e.graph())||(i.value=n.clone(e.graph())),i},read:function(e){var t=new i(e.options).setGraph(e.value);return n.each(e.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),n.each(e.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}},10117(e,t,r){var n;try{n={clone:r(32629),constant:r(37334),each:r(76135),filter:r(87612),has:r(61448),isArray:r(56449),isEmpty:r(62193),isFunction:r(1882),isUndefined:r(62216),keys:r(95950),map:r(55378),reduce:r(18479),size:r(47091),transform:r(69752),union:r(80299),values:r(35880)}}catch(e){}n||(n=window._),e.exports=n},44458(e){e.exports="2.1.8"},3013(e,t,r){"use strict";r.d(t,{j9:()=>er,Qq:()=>p}),(c=h||(h={}))[c.QR_CODE=0]="QR_CODE",c[c.AZTEC=1]="AZTEC",c[c.CODABAR=2]="CODABAR",c[c.CODE_39=3]="CODE_39",c[c.CODE_93=4]="CODE_93",c[c.CODE_128=5]="CODE_128",c[c.DATA_MATRIX=6]="DATA_MATRIX",c[c.MAXICODE=7]="MAXICODE",c[c.ITF=8]="ITF",c[c.EAN_13=9]="EAN_13",c[c.EAN_8=10]="EAN_8",c[c.PDF_417=11]="PDF_417",c[c.RSS_14=12]="RSS_14",c[c.RSS_EXPANDED=13]="RSS_EXPANDED",c[c.UPC_A=14]="UPC_A",c[c.UPC_E=15]="UPC_E",c[c.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION";var n,i,a,o,s,l,u,c,h,d,f,g,p,v,y=new Map([[h.QR_CODE,"QR_CODE"],[h.AZTEC,"AZTEC"],[h.CODABAR,"CODABAR"],[h.CODE_39,"CODE_39"],[h.CODE_93,"CODE_93"],[h.CODE_128,"CODE_128"],[h.DATA_MATRIX,"DATA_MATRIX"],[h.MAXICODE,"MAXICODE"],[h.ITF,"ITF"],[h.EAN_13,"EAN_13"],[h.EAN_8,"EAN_8"],[h.PDF_417,"PDF_417"],[h.RSS_14,"RSS_14"],[h.RSS_EXPANDED,"RSS_EXPANDED"],[h.UPC_A,"UPC_A"],[h.UPC_E,"UPC_E"],[h.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);(n=d||(d={}))[n.UNKNOWN=0]="UNKNOWN",n[n.URL=1]="URL",(i=f||(f={}))[i.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",i[i.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE";var w=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[f.SCAN_TYPE_CAMERA,f.SCAN_TYPE_FILE],e}(),E=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!y.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,y.get(t))},e}(),b=function(){function e(){}return e.createFromText=function(e){return{decodedText:e,result:{text:e}}},e.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},e}();(a=g||(g={}))[a.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",a[a.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",a[a.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR";var A=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:g.UNKWOWN_ERROR}},e}(),C=function(){function e(e){this.verbose=e}return e.prototype.log=function(e){this.verbose&&console.log(e)},e.prototype.warn=function(e){this.verbose&&console.warn(e)},e.prototype.logError=function(e,t){(this.verbose||!0===t)&&console.error(e)},e.prototype.logErrors=function(e){if(0===e.length)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},e}();function _(e){return null==e}var S=function(){function e(){}return e.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},e.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),I=function(){function e(){}return e.scanningStatus=function(){return"Scanning"},e.idleStatus=function(){return"Idle"},e.errorStatus=function(){return"Error"},e.permissionStatus=function(){return"Permission"},e.noCameraFoundErrorStatus=function(){return"No Cameras"},e.lastMatch=function(e){return"Last Match: ".concat(e)},e.codeScannerTitle=function(){return"Code Scanner"},e.cameraPermissionTitle=function(){return"Request Camera Permissions"},e.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},e.noCameraFound=function(){return"No camera found"},e.scanButtonStopScanningText=function(){return"Stop Scanning"},e.scanButtonStartScanningText=function(){return"Start Scanning"},e.torchOnButton=function(){return"Switch On Torch"},e.torchOffButton=function(){return"Switch Off Torch"},e.torchOnFailedMessage=function(){return"Failed to turn on torch"},e.torchOffFailedMessage=function(){return"Failed to turn off torch"},e.scanButtonScanningStarting=function(){return"Launching Camera..."},e.textIfCameraScanSelected=function(){return"Scan an Image File"},e.textIfFileScanSelected=function(){return"Scan using camera directly"},e.selectCamera=function(){return"Select Camera"},e.fileSelectionChooseImage=function(){return"Choose Image"},e.fileSelectionChooseAnother=function(){return"Choose Another"},e.fileSelectionNoImageSelected=function(){return"No image choosen"},e.anonymousCameraPrefix=function(){return"Anonymous Camera"},e.dragAndDropMessage=function(){return"Or drop an image to scan"},e.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},e.zoom=function(){return"zoom"},e.loadingImage=function(){return"Loading image..."},e.cameraScanAltText=function(){return"Camera based scan"},e.fileScanAltText=function(){return"Fule based scan"},e}(),T=function(){function e(){}return e.poweredBy=function(){return"Powered by "},e.reportIssues=function(){return"Report issues"},e}(),x=function(){function e(){}return e.isMediaStreamConstraintsValid=function(e,t){if("object"!=typeof e){var r=typeof e;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(r,"."),!0),!1}for(var n=new Set(["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"]),i=Object.keys(e),a=0;a<i.length;a++){var o=i[a];if(n.has(o))return t.logError("".concat(o," is not supported videoConstaints."),!0),!1}return!0},e}(),D=r(49255),N=function(){function e(e,t,r){if(this.formatMap=new Map([[h.QR_CODE,D.BarcodeFormat.QR_CODE],[h.AZTEC,D.BarcodeFormat.AZTEC],[h.CODABAR,D.BarcodeFormat.CODABAR],[h.CODE_39,D.BarcodeFormat.CODE_39],[h.CODE_93,D.BarcodeFormat.CODE_93],[h.CODE_128,D.BarcodeFormat.CODE_128],[h.DATA_MATRIX,D.BarcodeFormat.DATA_MATRIX],[h.MAXICODE,D.BarcodeFormat.MAXICODE],[h.ITF,D.BarcodeFormat.ITF],[h.EAN_13,D.BarcodeFormat.EAN_13],[h.EAN_8,D.BarcodeFormat.EAN_8],[h.PDF_417,D.BarcodeFormat.PDF_417],[h.RSS_14,D.BarcodeFormat.RSS_14],[h.RSS_EXPANDED,D.BarcodeFormat.RSS_EXPANDED],[h.UPC_A,D.BarcodeFormat.UPC_A],[h.UPC_E,D.BarcodeFormat.UPC_E],[h.UPC_EAN_EXTENSION,D.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!D)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=r;var n=this.createZXingFormats(e),i=new Map;i.set(D.DecodeHintType.POSSIBLE_FORMATS,n),i.set(D.DecodeHintType.TRY_HARDER,!1),this.hints=i}return e.prototype.decodeAsync=function(e){var t=this;return new Promise(function(r,n){try{r(t.decode(e))}catch(e){n(e)}})},e.prototype.decode=function(e){var t=new D.MultiFormatReader(this.verbose,this.hints),r=new D.HTMLCanvasElementLuminanceSource(e),n=new D.BinaryBitmap(new D.HybridBinarizer(r)),i=t.decode(n);return{text:i.text,format:E.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,r,n){e.set(t,r)}),e},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createZXingFormats=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];this.formatMap.has(n)?t.push(this.formatMap.get(n)):this.logger.logError("".concat(n," is not supported by")+"ZXingHtml5QrcodeShim")}return t},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),M=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},R=function(){function e(t,r,n){if(this.formatMap=new Map([[h.QR_CODE,"qr_code"],[h.AZTEC,"aztec"],[h.CODABAR,"codabar"],[h.CODE_39,"code_39"],[h.CODE_93,"code_93"],[h.CODE_128,"code_128"],[h.DATA_MATRIX,"data_matrix"],[h.ITF,"itf"],[h.EAN_13,"ean_13"],[h.EAN_8,"ean_8"],[h.PDF_417,"pdf417"],[h.UPC_A,"upc_a"],[h.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=r,this.logger=n;var i=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(i),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){return"BarcodeDetector"in window&&(new BarcodeDetector({formats:["qr_code"]}),!0)},e.prototype.decodeAsync=function(e){var t,r,n,i;return t=this,r=void 0,n=void 0,i=function(){var t,r;return M(this,function(n){switch(n.label){case 0:return[4,this.detector.detect(e)];case 1:if(!(t=n.sent())||0===t.length)throw"No barcode or QR code detected.";return[2,{text:(r=this.selectLargestBarcode(t)).rawValue,format:E.create(this.toHtml5QrcodeSupportedFormats(r.format)),debugData:this.createDebugData()}]}})},new(n||(n=Promise))(function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(o,s)}l((i=i.apply(t,r||[])).next())})},e.prototype.selectLargestBarcode=function(e){for(var t=null,r=0,n=0;n<e.length;n++){var i=e[n],a=i.boundingBox.width*i.boundingBox.height;a>r&&(r=a,t=i)}if(!t)throw"No largest barcode found";return t},e.prototype.createBarcodeDetectorFormats=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];this.formatMap.has(n)?t.push(this.formatMap.get(n)):this.logger.warn("".concat(n," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,r,n){e.set(t,r)}),e},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),O=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},P=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},B=function(){function e(e,t,r,n){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=r,t&&R.isSupported()?(this.primaryDecoder=new R(e,r,n),this.secondaryDecoder=new N(e,r,n)):this.primaryDecoder=new N(e,r,n)}return e.prototype.decodeAsync=function(e){return O(this,void 0,void 0,function(){var t;return P(this,function(r){switch(r.label){case 0:t=performance.now(),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,r.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(e){return O(this,void 0,void 0,function(){var t,r;return P(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,n.sent()];case 3:if(r=n.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw r;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?!1===this.wasPrimaryDecoderUsedInLastDecode?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(e){if(this.verbose){var t=performance.now()-e;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,t=0,r=this.executionResults;t<r.length;t++)e+=r[t];var n=e/this.executionResults.length;console.log("".concat(n," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),L=(o=function(e,t){return(o=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),k=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},F=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},z=function(){function e(e,t){this.name=e,this.track=t}return e.prototype.isSupported=function(){return!!this.track.getCapabilities&&this.name in this.track.getCapabilities()},e.prototype.apply=function(e){var t={};return t[this.name]=e,this.track.applyConstraints({advanced:[t]})},e.prototype.value=function(){var e=this.track.getSettings();return this.name in e?e[this.name]:null},e}(),U=function(e){function t(t){return e.call(this,"zoom",t)||this}return L(t,e),t}(function(e){function t(t,r){return e.call(this,t,r)||this}return L(t,e),t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(e){var t={};return t[this.name]=e,this.track.applyConstraints({advanced:[t]})},t.prototype.getCapabilities=function(){this.failIfNotSupported();var e=this.track.getCapabilities()[this.name];return{min:e.min,max:e.max,step:e.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw Error("".concat(this.name," capability not supported"))},t}(z)),V=function(e){function t(t){return e.call(this,"torch",t)||this}return L(t,e),t}(z),H=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new U(this.track)},e.prototype.torchFeature=function(){return new V(this.track)},e}(),j=function(){function e(e,t,r){this.isClosed=!1,this.parentElement=e,this.mediaStream=t,this.callbacks=r,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return e.prototype.createVideoElement=function(e){var t=document.createElement("video");return t.style.width="".concat(e,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},e.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var r=e.surface.clientWidth,n=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(r,n),e.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,r,n,i){return k(this,void 0,void 0,function(){var a,o;return F(this,function(s){switch(s.label){case 0:if(a=new e(t,r,i),!n.aspectRatio)return[3,2];return o={aspectRatio:n.aspectRatio},[4,a.getFirstTrackOrFail().applyConstraints(o)];case 1:s.sent(),s.label=2;case 2:return a.setupSurface(),[2,a]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),0===this.mediaStream.getVideoTracks().length)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(e){this.failIfClosed();var t=this,r=function(){setTimeout(e,200),t.surface.removeEventListener("playing",r)};this.surface.addEventListener("playing",r),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(e){return k(this,void 0,void 0,function(){return F(this,function(t){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(t,r){var n=e.mediaStream.getVideoTracks().length,i=0;e.mediaStream.getVideoTracks().forEach(function(r){e.mediaStream.removeTrack(r),r.stop(),++i>=n&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),t())})})},e.prototype.getCapabilities=function(){return new H(this.getFirstTrackOrFail())},e}(),Y=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,r){return k(this,void 0,void 0,function(){return F(this,function(n){return[2,j.create(e,this.mediaStream,t,r)]})})},e.create=function(t){return k(this,void 0,void 0,function(){var r;return F(this,function(n){switch(n.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return r={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(r)];case 1:return[2,new e(n.sent())]}})})},e}(),X=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},G=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},W=function(){function e(){}return e.failIfNotSupported=function(){return X(this,void 0,void 0,function(){return G(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(e){return X(this,void 0,void 0,function(){return G(this,function(t){return[2,Y.create(e)]})})},e}(),q=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},Z=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=S.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=S.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if("https:"===location.protocol)return!0;var e=location.host.split(":")[0];return"127.0.0.1"===e||"localhost"===e},e.getCamerasFromMediaDevices=function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r,n,i,a,o;return q(this,function(s){switch(s.label){case 0:return e=function(e){for(var t=e.getVideoTracks(),r=0;r<t.length;r++){var n=t[r];n.enabled=!1,n.stop(),e.removeTrack(n)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=s.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(i=0,r=s.sent(),n=[],a=r;i<a.length;i++)"videoinput"===(o=a[i]).kind&&n.push({id:o.deviceId,label:o.label});return e(t),[2,n]}})},new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,t){MediaStreamTrack.getSources(function(t){for(var r=[],n=0;n<t.length;n++){var i=t[n];"video"===i.kind&&r.push({id:i.id,label:i.label})}e(r)})})},e}();(s=p||(p={}))[s.UNKNOWN=0]="UNKNOWN",s[s.NOT_STARTED=1]="NOT_STARTED",s[s.SCANNING=2]="SCANNING",s[s.PAUSED=3]="PAUSED";var Q=function(){function e(){this.state=p.NOT_STARTED,this.onGoingTransactionNewState=p.UNKNOWN}return e.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},e.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===p.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=p.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===p.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=p.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==p.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case p.UNKNOWN:throw"Transition from unknown is not allowed";case p.NOT_STARTED:this.failIfNewStateIs(e,[p.PAUSED]);case p.SCANNING:case p.PAUSED:}},e.prototype.failIfNewStateIs=function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])throw"Cannot transition from ".concat(this.state," to ").concat(e)},e}(),K=function(){function e(e){this.stateManager=e}return e.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},e.prototype.directTransition=function(e){this.stateManager.directTransition(e)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===p.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==p.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===p.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===p.PAUSED},e}(),$=function(){function e(){}return e.create=function(){return new K(new Q)},e}(),J=(l=function(e,t){return(l=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return J(t,e),t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(w),et=function(){function e(e,t){this.logger=t,this.fps=ee.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=!0===e.disableFlip,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=ee.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?x.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!_(this.qrbox)},e.create=function(t,r){return new e(t,r)},e}(),er=function(){function e(e,t){var r;if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.elementId=e,this.verbose=!1,"boolean"==typeof t?this.verbose=!0===t:t&&(r=t,this.verbose=!0===r.verbose,r.experimentalFeatures),this.logger=new C(this.verbose),this.qrcode=new B(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(r),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=$.create()}return e.prototype.start=function(e,t,r,n){var i,a=this;if(!e)throw"cameraIdOrConfig is required";if(!r||"function"!=typeof r)throw"qrCodeSuccessCallback is required and should be a function.";i=n||(this.verbose?this.logger.log:function(){});var o=et.create(t,this.logger);this.clearElement();var s=!1;o.videoConstraints&&(o.isMediaStreamConstraintsValid()?s=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var l=s,u=document.getElementById(this.elementId);u.clientWidth?u.clientWidth:ee.DEFAULT_WIDTH,u.style.position="relative",this.shouldScan=!0,this.element=u;var c=this,h=this.stateManagerProxy.startTransition(p.SCANNING);return new Promise(function(t,n){var s=l?o.videoConstraints:c.createVideoConstraints(e);if(!s){h.cancel(),n("videoConstraints should be defined");return}var u={};(!l||o.aspectRatio)&&(u.aspectRatio=o.aspectRatio);var d={onRenderSurfaceReady:function(e,t){c.setupUi(e,t,o),c.isScanning=!0,c.foreverScan(o,r,i)}};W.failIfNotSupported().then(function(e){e.create(s).then(function(e){return e.render(a.element,u,d).then(function(e){c.renderedCamera=e,h.execute(),t(null)}).catch(function(e){h.cancel(),n(e)})}).catch(function(e){h.cancel(),n(S.errorGettingUserMedia(e))})}).catch(function(e){h.cancel(),n(S.cameraStreamingNotSupported())})})},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(p.PAUSED),this.showPausedState(),(_(e)||!0!==e)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var e=this,t=function(){e.stateManagerProxy.directTransition(p.SCANNING),e.hidePausedState()};this.renderedCamera.isPaused()?this.renderedCamera.resume(function(){t()}):t()},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(p.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var r=function(){if(e.element){var t=document.getElementById(ee.SHADED_REGION_ELEMENT_ID);t&&e.element.removeChild(t)}},n=this;return this.renderedCamera.close().then(function(){return n.renderedCamera=null,n.element&&(n.element.removeChild(n.canvasElement),n.canvasElement=null),r(),n.qrRegion&&(n.qrRegion=null),n.context&&(n.context=null),t.execute(),n.hidePausedState(),n.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(e,t){return this.scanFileV2(e,t).then(function(e){return e.decodedText})},e.prototype.scanFileV2=function(e,t){var r=this;if(!e||!(e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(_(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(n,i){r.possiblyCloseLastScanImageFile(),r.clearElement(),r.lastScanImageFile=URL.createObjectURL(e);var a=new Image;a.onload=function(){var e=a.width,o=a.height,s=document.getElementById(r.elementId),l=s.clientWidth?s.clientWidth:ee.DEFAULT_WIDTH,u=Math.max(s.clientHeight?s.clientHeight:o,ee.FILE_SCAN_MIN_HEIGHT),c=r.computeCanvasDrawConfig(e,o,l,u);if(t){var h=r.createCanvasElement(l,u,"qr-canvas-visible");h.style.display="inline-block",s.appendChild(h);var d=h.getContext("2d");if(!d)throw"Unable to get 2d context from canvas";d.canvas.width=l,d.canvas.height=u,d.drawImage(a,0,0,e,o,c.x,c.y,c.width,c.height)}var f=ee.FILE_SCAN_HIDDEN_CANVAS_PADDING,g=Math.max(a.width,c.width),p=Math.max(a.height,c.height),v=g+2*f,y=p+2*f,w=r.createCanvasElement(v,y);s.appendChild(w);var E=w.getContext("2d");if(!E)throw"Unable to get 2d context from canvas";E.canvas.width=v,E.canvas.height=y,E.drawImage(a,0,0,e,o,f,f,g,p);try{r.qrcode.decodeRobustlyAsync(w).then(function(e){n(b.createFromQrcodeResult(e))}).catch(i)}catch(e){i("QR code parse error, error = ".concat(e))}},a.onerror=i,a.onabort=i,a.onstalled=i,a.onsuspend=i,a.src=URL.createObjectURL(e)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Z.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(e){if(e){if(!x.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},e.prototype.getRenderedCameraOrFail=function(){if(null==this.renderedCamera)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(e){var t=[h.QR_CODE,h.AZTEC,h.CODABAR,h.CODE_39,h.CODE_93,h.CODE_128,h.DATA_MATRIX,h.MAXICODE,h.ITF,h.EAN_13,h.EAN_8,h.PDF_417,h.RSS_14,h.RSS_EXPANDED,h.UPC_A,h.UPC_E,h.UPC_EAN_EXTENSION];if(!e||"boolean"==typeof e||!e.formatsToSupport)return t;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(0===e.formatsToSupport.length)throw"Atleast 1 formatsToSupport is needed.";for(var r=[],n=0,i=e.formatsToSupport;n<i.length;n++){var a=i[n];Object.values(h).includes(a)?r.push(a):this.logger.warn("Invalid format: ".concat(a," passed in config, ignoring."))}if(0===r.length)throw"None of formatsToSupport match supported values.";return r},e.prototype.getUseBarCodeDetectorIfSupported=function(e){if(_(e))return!0;if(!_(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(_(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!_(t.useBarCodeDetectorIfSupported)||!1!==t.useBarCodeDetectorIfSupported},e.prototype.validateQrboxSize=function(e,t,r){var n,i=r.qrbox;this.validateQrboxConfig(i);var a=this.toQrdimensions(e,t,i),o=function(e){if(e<ee.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(ee.MIN_QR_BOX_SIZE,"px.")};o(a.width),o(a.height),(n=a.width)>e&&(this.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),n=e),a.width=n},e.prototype.validateQrboxConfig=function(e){if("number"!=typeof e&&"function"!=typeof e&&(void 0===e.width||void 0===e.height))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(e,t,r){if("number"==typeof r)return{width:r,height:r};if("function"==typeof r)try{return r(e,t)}catch(e){throw Error("qrbox config was passed as a function but it failed with unknown error"+e)}return r},e.prototype.setupUi=function(e,t,r){r.isShadedBoxEnabled()&&this.validateQrboxSize(e,t,r);var n=_(r.qrbox)?{width:e,height:t}:r.qrbox;this.validateQrboxConfig(n);var i=this.toQrdimensions(e,t,n);i.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var a=r.isShadedBoxEnabled()&&i.height<=t,o=a?this.getShadedRegionBounds(e,t,i):{x:0,y:0,width:e,height:t},s=this.createCanvasElement(o.width,o.height),l=s.getContext("2d",{willReadFrequently:!0});l.canvas.width=o.width,l.canvas.height=o.height,this.element.append(s),a&&this.possiblyInsertShadingElement(this.element,e,t,i),this.createScannerPausedUiElement(this.element),this.qrRegion=o,this.context=l,this.canvasElement=s},e.prototype.createScannerPausedUiElement=function(e){var t=document.createElement("div");t.innerText=S.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",e.appendChild(t),this.scannerPausedUiElement=t},e.prototype.scanContext=function(e,t){var r=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(t){return e(t.text,b.createFromQrcodeResult(t)),r.possiblyUpdateShaders(!0),!0}).catch(function(e){r.possiblyUpdateShaders(!1);var n=S.codeParseError(e);return t(n,A.createFrom(n)),!1})},e.prototype.foreverScan=function(e,t,r){var n=this;if(this.shouldScan&&this.renderedCamera){var i=this.renderedCamera.getSurface(),a=i.videoWidth/i.clientWidth,o=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var s=this.qrRegion.width*a,l=this.qrRegion.height*o,u=this.qrRegion.x*a,c=this.qrRegion.y*o;this.context.drawImage(i,u,c,s,l,0,0,this.qrRegion.width,this.qrRegion.height);var h=function(){n.foreverScanTimeout=setTimeout(function(){n.foreverScan(e,t,r)},n.getTimeoutFps(e.fps))};this.scanContext(t,r).then(function(i){i||!0===e.disableFlip?h():(n.context.translate(n.context.canvas.width,0),n.context.scale(-1,1),n.scanContext(t,r).finally(function(){h()}))}).catch(function(e){n.logger.logError("Error happend while scanning context",e),h()})}},e.prototype.createVideoConstraints=function(e){if("string"==typeof e)return{deviceId:{exact:e}};if("object"==typeof e){var t="facingMode",r="deviceId",n={user:!0,environment:!0},i="exact",a=function(e){if(e in n)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(e,"'")},o=Object.keys(e);if(1!==o.length)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(o.length," keys");var s=Object.keys(e)[0];if(s!==t&&s!==r)throw"Only '".concat(t,"' and '").concat(r,"' ")+" are supported for 'cameraIdOrConfig'";if(s===t){var l=e.facingMode;if("string"==typeof l){if(a(l))return{facingMode:l}}else if("object"==typeof l)if(i in l){if(a(l["".concat(i)]))return{facingMode:{exact:l["".concat(i)]}}}else throw"'facingMode' should be string or object with"+" ".concat(i," as key.");else{var u=typeof l;throw"Invalid type of 'facingMode' = ".concat(u)}}else{var c=e.deviceId;if("string"==typeof c)return{deviceId:c};if("object"==typeof c)if(i in c)return{deviceId:{exact:c["".concat(i)]}};else throw"'deviceId' should be string or object with"+" ".concat(i," as key.");var h=typeof c;throw"Invalid type of 'deviceId' = ".concat(h)}}var d=typeof e;throw"Invalid type of 'cameraIdOrConfig' = ".concat(d)},e.prototype.computeCanvasDrawConfig=function(e,t,r,n){if(e<=r&&t<=n)return{x:(r-e)/2,y:(n-t)/2,width:e,height:t};var i=e,a=t;return e>r&&(t=r/e*t,e=r),t>n&&(e=n/t*e,t=n),this.logger.log("Image downsampled from "+"".concat(i,"X").concat(a)+" to ".concat(e,"X").concat(t,".")),this.computeCanvasDrawConfig(e,t,r,n)},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},e.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=e?ee.BORDER_SHADER_MATCH_COLOR:ee.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(e,t,r){var n=document.createElement("canvas");return n.style.width="".concat(e,"px"),n.style.height="".concat(t,"px"),n.style.display="none",n.id=_(r)?"qr-canvas":r,n},e.prototype.getShadedRegionBounds=function(e,t,r){if(r.width>e||r.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-r.width)/2,y:(t-r.height)/2,width:r.width,height:r.height}},e.prototype.possiblyInsertShadingElement=function(e,t,r,n){if(!(t-n.width<1)&&!(r-n.height<1)){var i=document.createElement("div");i.style.position="absolute";var a=(t-n.width)/2,o=(r-n.height)/2;i.style.borderLeft="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderRight="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderTop="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderBottom="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id="".concat(ee.SHADED_REGION_ELEMENT_ID),t-n.width<11||r-n.height<11?this.hasBorderShaders=!1:(this.insertShaderBorders(i,40,5,-5,null,0,!0),this.insertShaderBorders(i,40,5,-5,null,0,!1),this.insertShaderBorders(i,40,5,null,-5,0,!0),this.insertShaderBorders(i,40,5,null,-5,0,!1),this.insertShaderBorders(i,5,45,-5,null,-5,!0),this.insertShaderBorders(i,5,45,null,-5,-5,!0),this.insertShaderBorders(i,5,45,-5,null,-5,!1),this.insertShaderBorders(i,5,45,null,-5,-5,!1),this.hasBorderShaders=!0),e.append(i)}},e.prototype.insertShaderBorders=function(e,t,r,n,i,a,o){var s=document.createElement("div");s.style.position="absolute",s.style.backgroundColor=ee.BORDER_SHADER_DEFAULT_COLOR,s.style.width="".concat(t,"px"),s.style.height="".concat(r,"px"),null!==n&&(s.style.top="".concat(n,"px")),null!==i&&(s.style.bottom="".concat(i,"px")),o?s.style.left="".concat(a,"px"):s.style.right="".concat(a,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(s),e.appendChild(s)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(e){return 1e3/e},e}(),en="data:image/svg+xml;base64,",ei=en+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyLjEwMyAyNC4wNjJhMjkuODEgMjkuODEgMCAwIDAtNC42MDMgMTUuOTM4djEuMzMzYzAgMTYuNTQyIDEzLjQ1OCAzMCAzMCAzMGg4LjMyNGMuNDI3IDExLjYzMSA3LjUwMyAyMS41ODcgMTcuNTM0IDI2LjE3Ny45MzEgMTAuNTAzIDQuMDg0IDMwLjE4NyAxNC43NjggNDUuNTM3YTkuOTg4IDkuOTg4IDAgMCAwIDguMjE2IDQuMjg4IDkuOTU4IDkuOTU4IDAgMCAwIDUuNzA0LTEuNzkzYzQuNTMzLTMuMTU1IDUuNjUtOS4zODggMi40OTUtMTMuOTIxLTYuNzk4LTkuNzY3LTkuNjAyLTIyLjYwOC0xMC43Ni0zMS40aDgyLjY4NWMuMjcyLjQxNC41NDUuODE4LjgxNSAxLjIxIDMuMTQyIDQuNTQxIDkuMzcyIDUuNjc5IDEzLjkxMyAyLjUzNCA0LjU0Mi0zLjE0MiA1LjY3Ny05LjM3MSAyLjUzNS0xMy45MTMtMTEuOTE5LTE3LjIyOS04Ljc4Ny0zNS44ODQgOS41ODEtNTcuMDEyIDMuMDY3LTIuNjUyIDEyLjMwNy0xMS43MzIgMTEuMjE3LTI0LjAzMy0uODI4LTkuMzQzLTcuMTA5LTE3LjE5NC0xOC42NjktMjMuMzM3YTkuODU3IDkuODU3IDAgMCAwLTEuMDYxLS40ODZjLS40NjYtLjE4Mi0xMS40MDMtNC41NzktOS43NDEtMTUuNzA2IDEuMDA3LTYuNzM3IDE0Ljc2OC04LjI3MyAyMy43NjYtNy42NjYgMjMuMTU2IDEuNTY5IDM5LjY5OCA3LjgwMyA0Ny44MzYgMTguMDI2IDUuNzUyIDcuMjI1IDcuNjA3IDE2LjYyMyA1LjY3MyAyOC43MzMtLjQxMyAyLjU4NS0uODI0IDUuMjQxLTEuMjQ1IDcuOTU5LTUuNzU2IDM3LjE5NC0xMi45MTkgODMuNDgzLTQ5Ljg3IDExNC42NjEtNC4yMjEgMy41NjEtNC43NTYgOS44Ny0xLjE5NCAxNC4wOTJhOS45OCA5Ljk4IDAgMCAwIDcuNjQ4IDMuNTUxIDkuOTU1IDkuOTU1IDAgMCAwIDYuNDQ0LTIuMzU4YzQyLjY3Mi0zNi4wMDUgNTAuODAyLTg4LjUzMyA1Ni43MzctMTI2Ljg4OC40MTUtMi42ODQuODIxLTUuMzA5IDEuMjI5LTcuODYzIDIuODM0LTE3LjcyMS0uNDU1LTMyLjY0MS05Ljc3Mi00NC4zNDV6bS0yMzIuMzA4IDQyLjYyYy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM2MwLTUuNTE0IDQuNDg2LTEwIDEwLTEwaDE1djIxLjMzM2gtMTV6bS0yLjUtNTIuNjY2YzAtNS41MTQgNC40ODYtMTAgMTAtMTBoNy41djIxLjMzM2gtNy41Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM3ptMTcuNSA5My45OTloLTcuNWMtNS41MTQgMC0xMC00LjQ4Ni0xMC0xMHYtMS4zMzNjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGg3LjV2MjEuMzMzem0zMC43OTYgMjguODg3Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi04LjI3MWg5MS40NTdjLS44NTEgNi42NjgtLjQzNyAxMi43ODcuNzMxIDE4LjI3MWgtODIuMTg4em03OS40ODItMTEzLjY5OGMtMy4xMjQgMjAuOTA2IDEyLjQyNyAzMy4xODQgMjEuNjI1IDM3LjA0IDUuNDQxIDIuOTY4IDcuNTUxIDUuNjQ3IDcuNzAxIDcuMTg4LjIxIDIuMTUtMi41NTMgNS42ODQtNC40NzcgNy4yNTEtLjQ4Mi4zNzgtLjkyOS44LTEuMzM1IDEuMjYxLTYuOTg3IDcuOTM2LTExLjk4MiAxNS41Mi0xNS40MzIgMjIuNjg4aC05Ny41NjRWMzBjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGgxMjMuNzY5YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB2MTM1LjU3OWMtMy4wMzItLjM4MS02LjE1LS42OTQtOS4zODktLjkxNC0yNS4xNTktMS42OTQtNDIuMzcgNy43NDgtNDQuODk4IDI0LjY2NnoiLz48cGF0aCBkPSJNMTc5LjEyOSA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXpNMTcyLjYyOSAxNDIuODZoLTEyLjU2VjEzMC44YTUgNSAwIDEgMC0xMCAwdjE3LjA2MWE1IDUgMCAwIDAgNSA1aDE3LjU2YTUgNSAwIDEgMCAwLTEwLjAwMXpNMjE2LjU2OCA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXptLTUgMjQuMDYxaC0xNC4wNlY5My4xNjdoMTQuMDZ2MTQuMDYxek0yMTEuNjY5IDEyNS45MzZIMTk3LjQxYTUgNSAwIDAgMC01IDV2MTQuMjU3YTUgNSAwIDAgMCA1IDVoMTQuMjU5YTUgNSAwIDAgMCA1LTV2LTE0LjI1N2E1IDUgMCAwIDAtNS01eiIvPjwvc3ZnPg==",ea=en+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1OS4wMTggNTkuMDE4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1OS4wMTggNTkuMDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJtNTguNzQxIDU0LjgwOS01Ljk2OS02LjI0NGExMC43NCAxMC43NCAwIDAgMCAyLjgyLTcuMjVjMC01Ljk1My00Ljg0My0xMC43OTYtMTAuNzk2LTEwLjc5NlMzNCAzNS4zNjEgMzQgNDEuMzE0IDM4Ljg0MyA1Mi4xMSA0NC43OTYgNTIuMTFjMi40NDEgMCA0LjY4OC0uODI0IDYuNDk5LTIuMTk2bDYuMDAxIDYuMjc3YS45OTguOTk4IDAgMCAwIDEuNDE0LjAzMiAxIDEgMCAwIDAgLjAzMS0xLjQxNHpNMzYgNDEuMzE0YzAtNC44NSAzLjk0Ni04Ljc5NiA4Ljc5Ni04Ljc5NnM4Ljc5NiAzLjk0NiA4Ljc5NiA4Ljc5Ni0zLjk0NiA4Ljc5Ni04Ljc5NiA4Ljc5NlMzNiA0Ni4xNjQgMzYgNDEuMzE0ek0xMC40MzEgMTYuMDg4YzAgMy4wNyAyLjQ5OCA1LjU2OCA1LjU2OSA1LjU2OHM1LjU2OS0yLjQ5OCA1LjU2OS01LjU2OGMwLTMuMDcxLTIuNDk4LTUuNTY5LTUuNTY5LTUuNTY5cy01LjU2OSAyLjQ5OC01LjU2OSA1LjU2OXptOS4xMzggMGMwIDEuOTY4LTEuNjAyIDMuNTY4LTMuNTY5IDMuNTY4cy0zLjU2OS0xLjYwMS0zLjU2OS0zLjU2OCAxLjYwMi0zLjU2OSAzLjU2OS0zLjU2OSAzLjU2OSAxLjYwMSAzLjU2OSAzLjU2OXoiLz48cGF0aCBkPSJtMzAuODgyIDI4Ljk4NyA5LjE4LTEwLjA1NCAxMS4yNjIgMTAuMzIzYTEgMSAwIDAgMCAxLjM1MS0xLjQ3NWwtMTItMTFhMSAxIDAgMCAwLTEuNDE0LjA2M2wtOS43OTQgMTAuNzI3LTQuNzQzLTQuNzQzYTEuMDAzIDEuMDAzIDAgMCAwLTEuMzY4LS4wNDRMNi4zMzkgMzcuNzY4YTEgMSAwIDEgMCAxLjMyMiAxLjUwMWwxNi4zMTMtMTQuMzYyIDcuMzE5IDcuMzE4YS45OTkuOTk5IDAgMSAwIDEuNDE0LTEuNDE0bC0xLjgyNS0xLjgyNHoiLz48cGF0aCBkPSJNMzAgNDYuNTE4SDJ2LTQyaDU0djI4YTEgMSAwIDEgMCAyIDB2LTI5YTEgMSAwIDAgMC0xLTFIMWExIDEgMCAwIDAtMSAxdjQ0YTEgMSAwIDAgMCAxIDFoMjlhMSAxIDAgMSAwIDAtMnoiLz48L3N2Zz4=",eo=en+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NjAgNDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0NjAgNDYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNMjMwIDBDMTAyLjk3NSAwIDAgMTAyLjk3NSAwIDIzMHMxMDIuOTc1IDIzMCAyMzAgMjMwIDIzMC0xMDIuOTc0IDIzMC0yMzBTMzU3LjAyNSAwIDIzMCAwem0zOC4zMzMgMzc3LjM2YzAgOC42NzYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+",es=function(){function e(){}return e.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},e}(),el=function(){function e(){this.data=es.createDefault();var t=localStorage.getItem(e.LOCAL_STORAGE_KEY);t?this.data=JSON.parse(t):this.reset()}return e.prototype.hasCameraPermissions=function(){return this.data.hasPermission},e.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},e.prototype.setHasPermission=function(e){this.data.hasPermission=e,this.flush()},e.prototype.setLastUsedCameraId=function(e){this.data.lastUsedCameraId=e,this.flush()},e.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},e.prototype.reset=function(){this.data=es.createDefault(),this.flush()},e.prototype.flush=function(){localStorage.setItem(e.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},e.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",e}(),eu=function(){function e(){this.infoDiv=document.createElement("div")}return e.prototype.renderInto=function(e){this.infoDiv.style.position="absolute",this.infoDiv.style.top="10px",this.infoDiv.style.right="10px",this.infoDiv.style.zIndex="2",this.infoDiv.style.display="none",this.infoDiv.style.padding="5pt",this.infoDiv.style.border="1px solid #171717",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(0 0 0 / 69%)",this.infoDiv.style.borderRadius="5px",this.infoDiv.style.textAlign="center",this.infoDiv.style.fontWeight="400",this.infoDiv.style.color="white",this.infoDiv.innerText=T.poweredBy();var t=document.createElement("a");t.innerText="ScanApp",t.href="https://scanapp.org",t.target="new",t.style.color="white",this.infoDiv.appendChild(t);var r=document.createElement("br"),n=document.createElement("br");this.infoDiv.appendChild(r),this.infoDiv.appendChild(n);var i=document.createElement("a");i.innerText=T.reportIssues(),i.href="https://github.com/mebjas/html5-qrcode/issues",i.target="new",i.style.color="white",this.infoDiv.appendChild(i),e.appendChild(this.infoDiv)},e.prototype.show=function(){this.infoDiv.style.display="block"},e.prototype.hide=function(){this.infoDiv.style.display="none"},e}(),ec=function(){function e(e,t){this.isShowingInfoIcon=!0,this.onTapIn=e,this.onTapOut=t,this.infoIcon=document.createElement("img")}return e.prototype.renderInto=function(e){var t=this;this.infoIcon.alt="Info icon",this.infoIcon.src=eo,this.infoIcon.style.position="absolute",this.infoIcon.style.top="4px",this.infoIcon.style.right="4px",this.infoIcon.style.opacity="0.6",this.infoIcon.style.cursor="pointer",this.infoIcon.style.zIndex="2",this.infoIcon.style.width="16px",this.infoIcon.style.height="16px",this.infoIcon.onmouseover=function(e){return t.onHoverIn()},this.infoIcon.onmouseout=function(e){return t.onHoverOut()},this.infoIcon.onclick=function(e){return t.onClick()},e.appendChild(this.infoIcon)},e.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},e.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},e.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=eo,this.infoIcon.style.opacity="0.6")},e}(),eh=function(){function e(){var e=this;this.infoDiv=new eu,this.infoIcon=new ec(function(){e.infoDiv.show()},function(){e.infoDiv.hide()})}return e.prototype.renderInto=function(e){this.infoDiv.renderInto(e),this.infoIcon.renderInto(e)},e}(),ed=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},ef=function(){function e(){}return e.hasPermissions=function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r;return ed(this,function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:for(e=0,t=n.sent();e<t.length;e++)if("videoinput"===(r=t[e]).kind&&r.label)return[2,!0];return[2,!1]}})},new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},e}(),eg=function(){function e(e){this.supportedScanTypes=this.validateAndReturnScanTypes(e)}return e.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},e.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},e.prototype.isCameraScanRequired=function(){for(var t=0,r=this.supportedScanTypes;t<r.length;t++){var n=r[t];if(e.isCameraScanType(n))return!0}return!1},e.isCameraScanType=function(e){return e===f.SCAN_TYPE_CAMERA},e.isFileScanType=function(e){return e===f.SCAN_TYPE_FILE},e.prototype.validateAndReturnScanTypes=function(e){if(!e||0===e.length)return w.DEFAULT_SUPPORTED_SCAN_TYPE;var t=w.DEFAULT_SUPPORTED_SCAN_TYPE.length;if(e.length>t)throw"Max ".concat(t," values expected for ")+"supportedScanTypes";for(var r=0;r<e.length;r++){var n=e[r];if(!w.DEFAULT_SUPPORTED_SCAN_TYPE.includes(n))throw"Unsupported scan type ".concat(n)}return e},e}(),ep=function(){function e(){}return e.ALL_ELEMENT_CLASS="html5-qrcode-element",e.CAMERA_PERMISSION_BUTTON_ID="html5-qrcode-button-camera-permission",e.CAMERA_START_BUTTON_ID="html5-qrcode-button-camera-start",e.CAMERA_STOP_BUTTON_ID="html5-qrcode-button-camera-stop",e.TORCH_BUTTON_ID="html5-qrcode-button-torch",e.CAMERA_SELECTION_SELECT_ID="html5-qrcode-select-camera",e.FILE_SELECTION_BUTTON_ID="html5-qrcode-button-file-selection",e.ZOOM_SLIDER_ID="html5-qrcode-input-range-zoom",e.SCAN_TYPE_CHANGE_ANCHOR_ID="html5-qrcode-anchor-scan-type-change",e.TORCH_BUTTON_CLASS_TORCH_ON="html5-qrcode-button-torch-on",e.TORCH_BUTTON_CLASS_TORCH_OFF="html5-qrcode-button-torch-off",e}(),em=function(){function e(){}return e.createElement=function(e,t){var r=document.createElement(e);return r.id=t,r.classList.add(ep.ALL_ELEMENT_CLASS),"button"===e&&r.setAttribute("type","button"),r},e}(),ev=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},ey=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},ew=function(){function e(e,t,r){this.isTorchOn=!1,this.torchCapability=e,this.buttonController=t,this.onTorchActionFailureCallback=r}return e.prototype.isTorchEnabled=function(){return this.isTorchOn},e.prototype.flipState=function(){return ev(this,void 0,void 0,function(){var e,t;return ey(this,function(r){switch(r.label){case 0:this.buttonController.disable(),e=!this.isTorchOn,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.torchCapability.apply(e)];case 2:return r.sent(),this.updateUiBasedOnLatestSettings(this.torchCapability.value(),e),[3,4];case 3:return t=r.sent(),this.propagateFailure(e,t),this.buttonController.enable(),[3,4];case 4:return[2]}})})},e.prototype.updateUiBasedOnLatestSettings=function(e,t){e===t?(this.buttonController.setText(t?I.torchOffButton():I.torchOnButton()),this.isTorchOn=t):this.propagateFailure(t),this.buttonController.enable()},e.prototype.propagateFailure=function(e,t){var r=e?I.torchOnFailedMessage():I.torchOffFailedMessage();t&&(r+="; Error = "+t),this.onTorchActionFailureCallback(r)},e.prototype.reset=function(){this.isTorchOn=!1},e}(),eE=function(){function e(e,t){this.onTorchActionFailureCallback=t,this.torchButton=em.createElement("button",ep.TORCH_BUTTON_ID),this.torchController=new ew(e,this,t)}return e.prototype.render=function(e,t){var r=this;this.torchButton.innerText=I.torchOnButton(),this.torchButton.style.display=t.display,this.torchButton.style.marginLeft=t.marginLeft;var n=this;this.torchButton.addEventListener("click",function(e){return ev(r,void 0,void 0,function(){return ey(this,function(e){switch(e.label){case 0:return[4,n.torchController.flipState()];case 1:return e.sent(),n.torchController.isTorchEnabled()?(n.torchButton.classList.remove(ep.TORCH_BUTTON_CLASS_TORCH_OFF),n.torchButton.classList.add(ep.TORCH_BUTTON_CLASS_TORCH_ON)):(n.torchButton.classList.remove(ep.TORCH_BUTTON_CLASS_TORCH_ON),n.torchButton.classList.add(ep.TORCH_BUTTON_CLASS_TORCH_OFF)),[2]}})})}),e.appendChild(this.torchButton)},e.prototype.updateTorchCapability=function(e){this.torchController=new ew(e,this,this.onTorchActionFailureCallback)},e.prototype.getTorchButton=function(){return this.torchButton},e.prototype.hide=function(){this.torchButton.style.display="none"},e.prototype.show=function(){this.torchButton.style.display="inline-block"},e.prototype.disable=function(){this.torchButton.disabled=!0},e.prototype.enable=function(){this.torchButton.disabled=!1},e.prototype.setText=function(e){this.torchButton.innerText=e},e.prototype.reset=function(){this.torchButton.innerText=I.torchOnButton(),this.torchController.reset()},e.create=function(t,r,n,i){var a=new e(r,i);return a.render(t,n),a},e}(),eb=function(){function e(e,t,r){this.fileBasedScanRegion=this.createFileBasedScanRegion(),this.fileBasedScanRegion.style.display=t?"block":"none",e.appendChild(this.fileBasedScanRegion);var n=document.createElement("label");n.setAttribute("for",this.getFileScanInputId()),n.style.display="inline-block",this.fileBasedScanRegion.appendChild(n),this.fileSelectionButton=em.createElement("button",ep.FILE_SELECTION_BUTTON_ID),this.setInitialValueToButton(),this.fileSelectionButton.addEventListener("click",function(e){n.click()}),n.append(this.fileSelectionButton),this.fileScanInput=em.createElement("input",this.getFileScanInputId()),this.fileScanInput.type="file",this.fileScanInput.accept="image/*",this.fileScanInput.style.display="none",n.appendChild(this.fileScanInput);var i=this;this.fileScanInput.addEventListener("change",function(e){if(null!=e&&null!=e.target){var t=e.target;if(!t.files||0!==t.files.length){var n=t.files[0],a=n.name;i.setImageNameToButton(a),r(n)}}});var a=this.createDragAndDropMessage();this.fileBasedScanRegion.appendChild(a),this.fileBasedScanRegion.addEventListener("dragenter",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionActiveBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragleave",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionDefaultBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragover",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionActiveBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),i.fileBasedScanRegion.style.border=i.fileBasedScanRegionDefaultBorder();var t=e.dataTransfer;if(t){var n=t.files;if(!n||0===n.length)return;for(var o=!1,s=0;s<n.length;++s){var l=n.item(s);if(l){var u=/image.*/;if(l.type.match(u)){o=!0;var c=l.name;i.setImageNameToButton(c),r(l),a.innerText=I.dragAndDropMessage();break}}}o||(a.innerText=I.dragAndDropMessageOnlyImages())}})}return e.prototype.hide=function(){this.fileBasedScanRegion.style.display="none",this.fileScanInput.disabled=!0},e.prototype.show=function(){this.fileBasedScanRegion.style.display="block",this.fileScanInput.disabled=!1},e.prototype.isShowing=function(){return"block"===this.fileBasedScanRegion.style.display},e.prototype.resetValue=function(){this.fileScanInput.value="",this.setInitialValueToButton()},e.prototype.createFileBasedScanRegion=function(){var e=document.createElement("div");return e.style.textAlign="center",e.style.margin="auto",e.style.width="80%",e.style.maxWidth="600px",e.style.border=this.fileBasedScanRegionDefaultBorder(),e.style.padding="10px",e.style.marginBottom="10px",e},e.prototype.fileBasedScanRegionDefaultBorder=function(){return"6px dashed #ebebeb"},e.prototype.fileBasedScanRegionActiveBorder=function(){return"6px dashed rgb(153 151 151)"},e.prototype.createDragAndDropMessage=function(){var e=document.createElement("div");return e.innerText=I.dragAndDropMessage(),e.style.fontWeight="400",e},e.prototype.setImageNameToButton=function(e){if(e.length>20){var t=e.substring(0,8),r=e.length,n=e.substring(r-8,r);e="".concat(t,"....").concat(n)}var i=I.fileSelectionChooseAnother()+" - "+e;this.fileSelectionButton.innerText=i},e.prototype.setInitialValueToButton=function(){var e=I.fileSelectionChooseImage()+" - "+I.fileSelectionNoImageSelected();this.fileSelectionButton.innerText=e},e.prototype.getFileScanInputId=function(){return"html5-qrcode-private-filescan-input"},e.create=function(t,r,n){return new e(t,r,n)},e}(),eA=function(){function e(e){this.selectElement=em.createElement("select",ep.CAMERA_SELECTION_SELECT_ID),this.cameras=e,this.options=[]}return e.prototype.render=function(e){var t=document.createElement("span");t.style.marginRight="10px";var r=this.cameras.length;if(0===r)throw Error("No cameras found");if(1===r)t.style.display="none";else{var n=I.selectCamera();t.innerText="".concat(n," (").concat(this.cameras.length,") ")}for(var i=1,a=0,o=this.cameras;a<o.length;a++){var s=o[a],l=s.id,u=null==s.label?l:s.label;u&&""!==u||(u=[I.anonymousCameraPrefix(),i++].join(" "));var c=document.createElement("option");c.value=l,c.innerText=u,this.options.push(c),this.selectElement.appendChild(c)}t.appendChild(this.selectElement),e.appendChild(t)},e.prototype.disable=function(){this.selectElement.disabled=!0},e.prototype.isDisabled=function(){return!0===this.selectElement.disabled},e.prototype.enable=function(){this.selectElement.disabled=!1},e.prototype.getValue=function(){return this.selectElement.value},e.prototype.hasValue=function(e){for(var t=0,r=this.options;t<r.length;t++)if(r[t].value===e)return!0;return!1},e.prototype.setValue=function(e){if(!this.hasValue(e))throw Error("".concat(e," is not present in the camera list."));this.selectElement.value=e},e.prototype.hasSingleItem=function(){return 1===this.cameras.length},e.prototype.numCameras=function(){return this.cameras.length},e.create=function(t,r){var n=new e(r);return n.render(t),n},e}(),eC=function(){function e(){this.onChangeCallback=null,this.zoomElementContainer=document.createElement("div"),this.rangeInput=em.createElement("input",ep.ZOOM_SLIDER_ID),this.rangeInput.type="range",this.rangeText=document.createElement("span"),this.rangeInput.min="1",this.rangeInput.max="5",this.rangeInput.value="1",this.rangeInput.step="0.1"}return e.prototype.render=function(e,t){this.zoomElementContainer.style.display=t?"block":"none",this.zoomElementContainer.style.padding="5px 10px",this.zoomElementContainer.style.textAlign="center",e.appendChild(this.zoomElementContainer),this.rangeInput.style.display="inline-block",this.rangeInput.style.width="50%",this.rangeInput.style.height="5px",this.rangeInput.style.background="#d3d3d3",this.rangeInput.style.outline="none",this.rangeInput.style.opacity="0.7";var r=I.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(r),this.rangeText.style.marginRight="10px";var n=this;this.rangeInput.addEventListener("input",function(){return n.onValueChange()}),this.rangeInput.addEventListener("change",function(){return n.onValueChange()}),this.zoomElementContainer.appendChild(this.rangeInput),this.zoomElementContainer.appendChild(this.rangeText)},e.prototype.onValueChange=function(){var e=I.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(e),this.onChangeCallback&&this.onChangeCallback(parseFloat(this.rangeInput.value))},e.prototype.setValues=function(e,t,r,n){this.rangeInput.min=e.toString(),this.rangeInput.max=t.toString(),this.rangeInput.step=n.toString(),this.rangeInput.value=r.toString(),this.onValueChange()},e.prototype.show=function(){this.zoomElementContainer.style.display="block"},e.prototype.hide=function(){this.zoomElementContainer.style.display="none"},e.prototype.setOnCameraZoomValueChangeCallback=function(e){this.onChangeCallback=e},e.prototype.removeOnCameraZoomValueChangeCallback=function(){this.onChangeCallback=null},e.create=function(t,r){var n=new e;return n.render(t,r),n},e}();function e_(e,t,r){if(this.lastMatchFound=null,this.cameraScanImage=null,this.fileScanImage=null,this.fileSelectionUi=null,this.elementId=e,this.config=this.createConfig(t),this.verbose=!0===r,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.scanTypeSelector=new eg(this.config.supportedScanTypes),this.currentScanType=this.scanTypeSelector.getDefaultScanType(),this.sectionSwapAllowed=!0,this.logger=new C(this.verbose),this.persistedDataManager=new el,!0!==t.rememberLastUsedCamera&&this.persistedDataManager.reset()}(u=v||(v={}))[u.STATUS_DEFAULT=0]="STATUS_DEFAULT",u[u.STATUS_SUCCESS=1]="STATUS_SUCCESS",u[u.STATUS_WARNING=2]="STATUS_WARNING",u[u.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION",e_.prototype.render=function(e,t){var r,n,i=this;this.lastMatchFound=null,this.qrCodeSuccessCallback=function(t,r){if(e)e(t,r);else{if(i.lastMatchFound===t)return;i.lastMatchFound=t,i.setHeaderMessage(I.lastMatch(t),v.STATUS_SUCCESS)}},this.qrCodeErrorCallback=function(e,r){t&&t(e,r)};var a=document.getElementById(this.elementId);if(!a)throw"HTML Element with id=".concat(this.elementId," not found");a.innerHTML="",this.createBasicLayout(a),this.html5Qrcode=new er(this.getScanRegionId(),(r=this.config,n=this.verbose,{formatsToSupport:r.formatsToSupport,useBarCodeDetectorIfSupported:r.useBarCodeDetectorIfSupported,experimentalFeatures:r.experimentalFeatures,verbose:n}))},e_.prototype.pause=function(e){(_(e)||!0!==e)&&(e=!1),this.getHtml5QrcodeOrFail().pause(e)},e_.prototype.resume=function(){this.getHtml5QrcodeOrFail().resume()},e_.prototype.getState=function(){return this.getHtml5QrcodeOrFail().getState()},e_.prototype.clear=function(){var e=this,t=function(){var t=document.getElementById(e.elementId);t&&(t.innerHTML="",e.resetBasicLayout(t))};return this.html5Qrcode?new Promise(function(r,n){e.html5Qrcode?e.html5Qrcode.isScanning?e.html5Qrcode.stop().then(function(n){e.html5Qrcode&&(e.html5Qrcode.clear(),t()),r()}).catch(function(t){e.verbose&&e.logger.logError("Unable to stop qrcode scanner",t),n(t)}):(e.html5Qrcode.clear(),t(),r()):r()}):Promise.resolve()},e_.prototype.getRunningTrackCapabilities=function(){return this.getHtml5QrcodeOrFail().getRunningTrackCapabilities()},e_.prototype.getRunningTrackSettings=function(){return this.getHtml5QrcodeOrFail().getRunningTrackSettings()},e_.prototype.applyVideoConstraints=function(e){return this.getHtml5QrcodeOrFail().applyVideoConstraints(e)},e_.prototype.getHtml5QrcodeOrFail=function(){if(!this.html5Qrcode)throw"Code scanner not initialized.";return this.html5Qrcode},e_.prototype.createConfig=function(e){return e?(e.fps||(e.fps=w.SCAN_DEFAULT_FPS),!w.DEFAULT_REMEMBER_LAST_CAMERA_USED!==e.rememberLastUsedCamera&&(e.rememberLastUsedCamera=w.DEFAULT_REMEMBER_LAST_CAMERA_USED),e.supportedScanTypes||(e.supportedScanTypes=w.DEFAULT_SUPPORTED_SCAN_TYPE),e):{fps:w.SCAN_DEFAULT_FPS,rememberLastUsedCamera:w.DEFAULT_REMEMBER_LAST_CAMERA_USED,supportedScanTypes:w.DEFAULT_SUPPORTED_SCAN_TYPE}},e_.prototype.createBasicLayout=function(e){e.style.position="relative",e.style.padding="0px",e.style.border="1px solid silver",this.createHeader(e);var t=document.createElement("div");t.id=this.getScanRegionId(),t.style.width="100%",t.style.minHeight="100px",t.style.textAlign="center",e.appendChild(t),eg.isCameraScanType(this.currentScanType)?this.insertCameraScanImageToScanRegion():this.insertFileScanImageToScanRegion();var r=document.createElement("div");r.id=this.getDashboardId(),r.style.width="100%",e.appendChild(r),this.setupInitialDashboard(r)},e_.prototype.resetBasicLayout=function(e){e.style.border="none"},e_.prototype.setupInitialDashboard=function(e){this.createSection(e),this.createSectionControlPanel(),this.scanTypeSelector.hasMoreThanOneScanType()&&this.createSectionSwap()},e_.prototype.createHeader=function(e){var t=document.createElement("div");t.style.textAlign="left",t.style.margin="0px",e.appendChild(t),new eh().renderInto(t);var r=document.createElement("div");r.id=this.getHeaderMessageContainerId(),r.style.display="none",r.style.textAlign="center",r.style.fontSize="14px",r.style.padding="2px 10px",r.style.margin="4px",r.style.borderTop="1px solid #f6f6f6",t.appendChild(r)},e_.prototype.createSection=function(e){var t=document.createElement("div");t.id=this.getDashboardSectionId(),t.style.width="100%",t.style.padding="10px 0px 10px 0px",t.style.textAlign="left",e.appendChild(t)},e_.prototype.createCameraListUi=function(e,t,r){var n=this;n.showHideScanTypeSwapLink(!1),n.setHeaderMessage(I.cameraPermissionRequesting());var i=function(){r||n.createPermissionButton(e,t)};er.getCameras().then(function(r){n.persistedDataManager.setHasPermission(!0),n.showHideScanTypeSwapLink(!0),n.resetHeaderMessage(),r&&r.length>0?(e.removeChild(t),n.renderCameraSelection(r)):(n.setHeaderMessage(I.noCameraFound(),v.STATUS_WARNING),i())}).catch(function(e){n.persistedDataManager.setHasPermission(!1),r?r.disabled=!1:i(),n.setHeaderMessage(e,v.STATUS_WARNING),n.showHideScanTypeSwapLink(!0)})},e_.prototype.createPermissionButton=function(e,t){var r=this,n=em.createElement("button",this.getCameraPermissionButtonId());n.innerText=I.cameraPermissionTitle(),n.addEventListener("click",function(){n.disabled=!0,r.createCameraListUi(e,t,n)}),t.appendChild(n)},e_.prototype.createPermissionsUi=function(e,t){var r=this;eg.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()?ef.hasPermissions().then(function(n){n?r.createCameraListUi(e,t):(r.persistedDataManager.setHasPermission(!1),r.createPermissionButton(e,t))}).catch(function(n){r.persistedDataManager.setHasPermission(!1),r.createPermissionButton(e,t)}):this.createPermissionButton(e,t)},e_.prototype.createSectionControlPanel=function(){var e=document.getElementById(this.getDashboardSectionId()),t=document.createElement("div");e.appendChild(t);var r=document.createElement("div");r.id=this.getDashboardSectionCameraScanRegionId(),r.style.display=eg.isCameraScanType(this.currentScanType)?"block":"none",t.appendChild(r);var n=document.createElement("div");n.style.textAlign="center",r.appendChild(n),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(r,n),this.renderFileScanUi(t)},e_.prototype.renderFileScanUi=function(e){var t=eg.isFileScanType(this.currentScanType),r=this;this.fileSelectionUi=eb.create(e,t,function(e){if(!r.html5Qrcode)throw"html5Qrcode not defined";eg.isFileScanType(r.currentScanType)&&(r.setHeaderMessage(I.loadingImage()),r.html5Qrcode.scanFileV2(e,!0).then(function(e){r.resetHeaderMessage(),r.qrCodeSuccessCallback(e.decodedText,e)}).catch(function(e){r.setHeaderMessage(e,v.STATUS_WARNING),r.qrCodeErrorCallback(e,A.createFrom(e))}))})},e_.prototype.renderCameraSelection=function(e){var t,r=this,n=this,i=document.getElementById(this.getDashboardSectionCameraScanRegionId());i.style.textAlign="center";var a=eC.create(i,!1),o=function(e){var t=e.zoomFeature();if(t.isSupported()){a.setOnCameraZoomValueChangeCallback(function(e){t.apply(e)});var n,i,o,s=1;r.config.defaultZoomValueIfSupported&&(s=r.config.defaultZoomValueIfSupported),n=s,i=t.min(),s=n>(o=t.max())?o:n<i?i:n,a.setValues(t.min(),t.max(),s,t.step()),a.show()}},s=eA.create(i,e),l=document.createElement("span"),u=em.createElement("button",ep.CAMERA_START_BUTTON_ID);u.innerText=I.scanButtonStartScanningText(),l.appendChild(u);var c=em.createElement("button",ep.CAMERA_STOP_BUTTON_ID);c.innerText=I.scanButtonStopScanningText(),c.style.display="none",c.disabled=!0,l.appendChild(c);var h=function(e){if(!e.torchFeature().isSupported()){t&&t.hide();return}t?t.updateTorchCapability(e.torchFeature()):t=eE.create(l,e.torchFeature(),{display:"none",marginLeft:"5px"},function(e){n.setHeaderMessage(e,v.STATUS_WARNING)}),t.show()};i.appendChild(l);var d=function(e){e||(u.style.display="none"),u.innerText=I.scanButtonStartScanningText(),u.style.opacity="1",u.disabled=!1,e&&(u.style.display="inline-block")};if(u.addEventListener("click",function(e){u.innerText=I.scanButtonScanningStarting(),s.disable(),u.disabled=!0,u.style.opacity="0.5",r.scanTypeSelector.hasMoreThanOneScanType()&&n.showHideScanTypeSwapLink(!1),n.resetHeaderMessage();var t,i=s.getValue();n.persistedDataManager.setLastUsedCameraId(i),n.html5Qrcode.start(i,{fps:(t=n.config).fps,qrbox:t.qrbox,aspectRatio:t.aspectRatio,disableFlip:t.disableFlip,videoConstraints:t.videoConstraints},n.qrCodeSuccessCallback,n.qrCodeErrorCallback).then(function(e){c.disabled=!1,c.style.display="inline-block",d(!1);var t=n.html5Qrcode.getRunningTrackCameraCapabilities();!0===r.config.showTorchButtonIfSupported&&h(t),!0===r.config.showZoomSliderIfSupported&&o(t)}).catch(function(e){n.showHideScanTypeSwapLink(!0),s.enable(),d(!0),n.setHeaderMessage(e,v.STATUS_WARNING)})}),s.hasSingleItem()&&u.click(),c.addEventListener("click",function(e){if(!n.html5Qrcode)throw"html5Qrcode not defined";c.disabled=!0,n.html5Qrcode.stop().then(function(e){r.scanTypeSelector.hasMoreThanOneScanType()&&n.showHideScanTypeSwapLink(!0),s.enable(),u.disabled=!1,c.style.display="none",u.style.display="inline-block",t&&(t.reset(),t.hide()),a.removeOnCameraZoomValueChangeCallback(),a.hide(),n.insertCameraScanImageToScanRegion()}).catch(function(e){c.disabled=!1,n.setHeaderMessage(e,v.STATUS_WARNING)})}),n.persistedDataManager.getLastUsedCameraId()){var f=n.persistedDataManager.getLastUsedCameraId();s.hasValue(f)?(s.setValue(f),u.click()):n.persistedDataManager.resetLastUsedCameraId()}},e_.prototype.createSectionSwap=function(){var e=this,t=I.textIfCameraScanSelected(),r=I.textIfFileScanSelected(),n=document.getElementById(this.getDashboardSectionId()),i=document.createElement("div");i.style.textAlign="center";var a=em.createElement("span",this.getDashboardSectionSwapLinkId());a.style.textDecoration="underline",a.style.cursor="pointer",a.innerText=eg.isCameraScanType(this.currentScanType)?t:r,a.addEventListener("click",function(){if(!e.sectionSwapAllowed){e.verbose&&e.logger.logError("Section swap called when not allowed");return}e.resetHeaderMessage(),e.fileSelectionUi.resetValue(),e.sectionSwapAllowed=!1,eg.isCameraScanType(e.currentScanType)?(e.clearScanRegion(),e.getCameraScanRegion().style.display="none",e.fileSelectionUi.show(),a.innerText=r,e.currentScanType=f.SCAN_TYPE_FILE,e.insertFileScanImageToScanRegion()):(e.clearScanRegion(),e.getCameraScanRegion().style.display="block",e.fileSelectionUi.hide(),a.innerText=t,e.currentScanType=f.SCAN_TYPE_CAMERA,e.insertCameraScanImageToScanRegion(),e.startCameraScanIfPermissionExistsOnSwap()),e.sectionSwapAllowed=!0}),i.appendChild(a),n.appendChild(i)},e_.prototype.startCameraScanIfPermissionExistsOnSwap=function(){var e=this,t=this;if(this.persistedDataManager.hasCameraPermissions())return void ef.hasPermissions().then(function(r){if(r){var n=document.getElementById(t.getCameraPermissionButtonId());if(!n)throw e.logger.logError("Permission button not found, fail;"),"Permission button not found";n.click()}else t.persistedDataManager.setHasPermission(!1)}).catch(function(e){t.persistedDataManager.setHasPermission(!1)})},e_.prototype.resetHeaderMessage=function(){document.getElementById(this.getHeaderMessageContainerId()).style.display="none"},e_.prototype.setHeaderMessage=function(e,t){t||(t=v.STATUS_DEFAULT);var r=this.getHeaderMessageDiv();switch(r.innerText=e,r.style.display="block",t){case v.STATUS_SUCCESS:r.style.background="rgba(106, 175, 80, 0.26)",r.style.color="#477735";break;case v.STATUS_WARNING:r.style.background="rgba(203, 36, 49, 0.14)",r.style.color="#cb2431";break;case v.STATUS_DEFAULT:default:r.style.background="rgba(0, 0, 0, 0)",r.style.color="rgb(17, 17, 17)"}},e_.prototype.showHideScanTypeSwapLink=function(e){this.scanTypeSelector.hasMoreThanOneScanType()&&(!0!==e&&(e=!1),this.sectionSwapAllowed=e,this.getDashboardSectionSwapLink().style.display=e?"inline-block":"none")},e_.prototype.insertCameraScanImageToScanRegion=function(){var e=this,t=document.getElementById(this.getScanRegionId());if(this.cameraScanImage){t.innerHTML="<br>",t.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(r){t.innerHTML="<br>",t.appendChild(e.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=ei,this.cameraScanImage.alt=I.cameraScanAltText()},e_.prototype.insertFileScanImageToScanRegion=function(){var e=this,t=document.getElementById(this.getScanRegionId());if(this.fileScanImage){t.innerHTML="<br>",t.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(r){t.innerHTML="<br>",t.appendChild(e.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=ea,this.fileScanImage.alt=I.fileScanAltText()},e_.prototype.clearScanRegion=function(){document.getElementById(this.getScanRegionId()).innerHTML=""},e_.prototype.getDashboardSectionId=function(){return"".concat(this.elementId,"__dashboard_section")},e_.prototype.getDashboardSectionCameraScanRegionId=function(){return"".concat(this.elementId,"__dashboard_section_csr")},e_.prototype.getDashboardSectionSwapLinkId=function(){return ep.SCAN_TYPE_CHANGE_ANCHOR_ID},e_.prototype.getScanRegionId=function(){return"".concat(this.elementId,"__scan_region")},e_.prototype.getDashboardId=function(){return"".concat(this.elementId,"__dashboard")},e_.prototype.getHeaderMessageContainerId=function(){return"".concat(this.elementId,"__header_message")},e_.prototype.getCameraPermissionButtonId=function(){return ep.CAMERA_PERMISSION_BUTTON_ID},e_.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},e_.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},e_.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())}},49255(e,t,r){!function(e){"use strict";let t;var n,i,a,o,s,l,u,c,h,d,f,g,p,v,y,w,E,b,A,C,_,S,I=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},T=function(e){function t(){this.constructor=r}function r(t){var r,n,i,a,o=this.constructor,s=e.call(this,t)||this;return Object.defineProperty(s,"name",{value:o.name,enumerable:!1}),r=o.prototype,(n=Object.setPrototypeOf)?n(s,r):s.__proto__=r,void 0===i&&(i=s.constructor),(a=Error.captureStackTrace)&&a(s,i),s}return I(r,e),r.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),r}(Error);class x extends T{constructor(e){super(e),this.message=e}getKind(){return this.constructor.kind}}x.kind="Exception";class D extends x{}D.kind="ArgumentException";class N extends x{}N.kind="IllegalArgumentException";class M{constructor(e){if(this.binarizer=e,null===e)throw new N("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(null===this.matrix||void 0===this.matrix)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,r,n){let i=this.binarizer.getLuminanceSource().crop(e,t,r,n);return new M(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new M(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new M(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class R extends x{static getChecksumInstance(){return new R}}R.kind="ChecksumException";class O{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class P{static arraycopy(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}static currentTimeMillis(){return Date.now()}}class B extends x{}B.kind="IndexOutOfBoundsException";class L extends B{constructor(e,t){super(t),this.index=e,this.message=t}}L.kind="ArrayIndexOutOfBoundsException";class k{static fill(e,t){for(let r=0,n=e.length;r<n;r++)e[r]=t}static fillWithin(e,t,r,n){k.rangeCheck(e.length,t,r);for(let i=t;i<r;i++)e[i]=n}static rangeCheck(e,t,r){if(t>r)throw new N("fromIndex("+t+") > toIndex("+r+")");if(t<0)throw new L(t);if(r>e)throw new L(r)}static asList(...e){return e}static create(e,t,r){return Array.from({length:e}).map(e=>Array.from({length:t}).fill(r))}static createInt32Array(e,t,r){return Array.from({length:e}).map(e=>Int32Array.from({length:t}).fill(r))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}static hashCode(e){if(null===e)return 0;let t=1;for(let r of e)t=31*t+r;return t}static fillUint8Array(e,t){for(let r=0;r!==e.length;r++)e[r]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){let r=new Uint8Array(t);return r.set(e),r}return e.slice(0,t)}static copyOfRange(e,t,r){let n=r-t,i=new Int32Array(n);return P.arraycopy(e,t,i,0,n),i}static binarySearch(e,t,r){void 0===r&&(r=k.numberComparator);let n=0,i=e.length-1;for(;n<=i;){let a=i+n>>1,o=r(t,e[a]);if(o>0)n=a+1;else{if(!(o<0))return a;i=a-1}}return-n-1}static numberComparator(e,t){return e-t}}class F{static numberOfTrailingZeros(e){let t;if(0===e)return 32;let r=31;return 0!=(t=e<<16)&&(r-=16,e=t),0!=(t=e<<8)&&(r-=8,e=t),0!=(t=e<<4)&&(r-=4,e=t),0!=(t=e<<2)&&(r-=2,e=t),r-(e<<1>>>31)}static numberOfLeadingZeros(e){if(0===e)return 32;let t=1;return e>>>16==0&&(t+=16,e<<=16),e>>>24==0&&(t+=8,e<<=8),e>>>28==0&&(t+=4,e<<=4),e>>>30==0&&(t+=2,e<<=2),t-=e>>>31}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e-=e>>>1&0x55555555,e=(e=(0x33333333&e)+(e>>>2&0x33333333))+(e>>>4)&0xf0f0f0f,e+=e>>>8,63&(e+=e>>>16)}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t){return parseInt(e,t)}}F.MIN_VALUE_32_BITS=-0x80000000,F.MAX_VALUE=Number.MAX_SAFE_INTEGER;class z{constructor(e,t){void 0===e?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,null==t?this.bits=z.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>32*this.bits.length){let t=z.makeArray(e);P.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(31&e))!=0}set(e){this.bits[Math.floor(e/32)]|=1<<(31&e)}flip(e){this.bits[Math.floor(e/32)]^=1<<(31&e)}getNextSet(e){let t=this.size;if(e>=t)return t;let r=this.bits,n=Math.floor(e/32),i=r[n];i&=~((1<<(31&e))-1);let a=r.length;for(;0===i;){if(++n===a)return t;i=r[n]}let o=32*n+F.numberOfTrailingZeros(i);return o>t?t:o}getNextUnset(e){let t=this.size;if(e>=t)return t;let r=this.bits,n=Math.floor(e/32),i=~r[n];i&=~((1<<(31&e))-1);let a=r.length;for(;0===i;){if(++n===a)return t;i=~r[n]}let o=32*n+F.numberOfTrailingZeros(i);return o>t?t:o}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new N;if(t===e)return;let r=Math.floor(e/32),n=Math.floor(--t/32),i=this.bits;for(let a=r;a<=n;a++){let o=a>r?0:31&e,s=(2<<(a<n?31:31&t))-(1<<o);i[a]|=s}}clear(){let e=this.bits.length,t=this.bits;for(let r=0;r<e;r++)t[r]=0}isRange(e,t,r){if(t<e||e<0||t>this.size)throw new N;if(t===e)return!0;let n=Math.floor(e/32),i=Math.floor(--t/32),a=this.bits;for(let o=n;o<=i;o++){let s=o>n?0:31&e,l=(2<<(o<i?31:31&t))-(1<<s)|0;if((a[o]&l)!==(r?l:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(e,t){if(t<0||t>32)throw new N("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let r=t;r>0;r--)this.appendBit((e>>r-1&1)==1)}appendBitArray(e){let t=e.size;this.ensureCapacity(this.size+t);for(let r=0;r<t;r++)this.appendBit(e.get(r))}xor(e){if(this.size!==e.size)throw new N("Sizes don't match");let t=this.bits;for(let r=0,n=t.length;r<n;r++)t[r]^=e.bits[r]}toBytes(e,t,r,n){for(let i=0;i<n;i++){let n=0;for(let t=0;t<8;t++)this.get(e)&&(n|=1<<7-t),e++;t[r+i]=n}}getBitArray(){return this.bits}reverse(){let e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),r=t+1,n=this.bits;for(let i=0;i<r;i++){let r=n[i];r=(r=(r=(r=(r=r>>1&0x55555555|(0x55555555&r)<<1)>>2&0x33333333|(0x33333333&r)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&r)<<4)>>8&0xff00ff|(0xff00ff&r)<<8)>>16&65535|(65535&r)<<16,e[t-i]=r}if(this.size!==32*r){let t=32*r-this.size,n=e[0]>>>t;for(let i=1;i<r;i++){let r=e[i];n|=r<<32-t,e[i-1]=n,n=r>>>t}e[r-1]=n}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){return e instanceof z&&this.size===e.size&&k.equals(this.bits,e.bits)}hashCode(){return 31*this.size+k.hashCode(this.bits)}toString(){let e="";for(let t=0,r=this.size;t<r;t++)(7&t)==0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new z(this.size,this.bits.slice())}}(n=g||(g={}))[n.OTHER=0]="OTHER",n[n.PURE_BARCODE=1]="PURE_BARCODE",n[n.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",n[n.TRY_HARDER=3]="TRY_HARDER",n[n.CHARACTER_SET=4]="CHARACTER_SET",n[n.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",n[n.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",n[n.ASSUME_GS1=7]="ASSUME_GS1",n[n.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",n[n.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",n[n.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS";var U=g;class V extends x{static getFormatInstance(){return new V}}V.kind="FormatException",(i=p||(p={}))[i.Cp437=0]="Cp437",i[i.ISO8859_1=1]="ISO8859_1",i[i.ISO8859_2=2]="ISO8859_2",i[i.ISO8859_3=3]="ISO8859_3",i[i.ISO8859_4=4]="ISO8859_4",i[i.ISO8859_5=5]="ISO8859_5",i[i.ISO8859_6=6]="ISO8859_6",i[i.ISO8859_7=7]="ISO8859_7",i[i.ISO8859_8=8]="ISO8859_8",i[i.ISO8859_9=9]="ISO8859_9",i[i.ISO8859_10=10]="ISO8859_10",i[i.ISO8859_11=11]="ISO8859_11",i[i.ISO8859_13=12]="ISO8859_13",i[i.ISO8859_14=13]="ISO8859_14",i[i.ISO8859_15=14]="ISO8859_15",i[i.ISO8859_16=15]="ISO8859_16",i[i.SJIS=16]="SJIS",i[i.Cp1250=17]="Cp1250",i[i.Cp1251=18]="Cp1251",i[i.Cp1252=19]="Cp1252",i[i.Cp1256=20]="Cp1256",i[i.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",i[i.UTF8=22]="UTF8",i[i.ASCII=23]="ASCII",i[i.Big5=24]="Big5",i[i.GB18030=25]="GB18030",i[i.EUC_KR=26]="EUC_KR";class H{constructor(e,t,r,...n){this.valueIdentifier=e,this.name=r,"number"==typeof t?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=n,H.VALUE_IDENTIFIER_TO_ECI.set(e,this),H.NAME_TO_ECI.set(r,this);const i=this.values;for(let e=0,t=i.length;e!==t;e++){const t=i[e];H.VALUES_TO_ECI.set(t,this)}for(const e of n)H.NAME_TO_ECI.set(e,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new V("incorect value");let t=H.VALUES_TO_ECI.get(e);if(void 0===t)throw new V("incorect value");return t}static getCharacterSetECIByName(e){let t=H.NAME_TO_ECI.get(e);if(void 0===t)throw new V("incorect value");return t}equals(e){return e instanceof H&&this.getName()===e.getName()}}H.VALUE_IDENTIFIER_TO_ECI=new Map,H.VALUES_TO_ECI=new Map,H.NAME_TO_ECI=new Map,H.Cp437=new H(p.Cp437,Int32Array.from([0,2]),"Cp437"),H.ISO8859_1=new H(p.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),H.ISO8859_2=new H(p.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),H.ISO8859_3=new H(p.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),H.ISO8859_4=new H(p.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),H.ISO8859_5=new H(p.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),H.ISO8859_6=new H(p.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),H.ISO8859_7=new H(p.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),H.ISO8859_8=new H(p.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),H.ISO8859_9=new H(p.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),H.ISO8859_10=new H(p.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),H.ISO8859_11=new H(p.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),H.ISO8859_13=new H(p.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),H.ISO8859_14=new H(p.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),H.ISO8859_15=new H(p.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),H.ISO8859_16=new H(p.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),H.SJIS=new H(p.SJIS,20,"SJIS","Shift_JIS"),H.Cp1250=new H(p.Cp1250,21,"Cp1250","windows-1250"),H.Cp1251=new H(p.Cp1251,22,"Cp1251","windows-1251"),H.Cp1252=new H(p.Cp1252,23,"Cp1252","windows-1252"),H.Cp1256=new H(p.Cp1256,24,"Cp1256","windows-1256"),H.UnicodeBigUnmarked=new H(p.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),H.UTF8=new H(p.UTF8,26,"UTF8","UTF-8"),H.ASCII=new H(p.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),H.Big5=new H(p.Big5,28,"Big5"),H.GB18030=new H(p.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),H.EUC_KR=new H(p.EUC_KR,30,"EUC_KR","EUC-KR");class j extends x{}j.kind="UnsupportedOperationException";class Y{static decode(e,t){let r=this.encodingName(t);return this.customDecoder?this.customDecoder(e,r):"u"<typeof TextDecoder||this.shouldDecodeOnFallback(r)?this.decodeFallback(e,r):new TextDecoder(r).decode(e)}static shouldDecodeOnFallback(e){return!Y.isBrowser()&&"ISO-8859-1"===e}static encode(e,t){let r=this.encodingName(t);return this.customEncoder?this.customEncoder(e,r):"u"<typeof TextEncoder?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return"u">typeof window&&"[object Window]"===({}).toString.call(window)}static encodingName(e){return"string"==typeof e?e:e.getName()}static encodingCharacterSet(e){return e instanceof H?e:H.getCharacterSetECIByName(e)}static decodeFallback(e,t){let r=this.encodingCharacterSet(t);if(Y.isDecodeFallbackSupported(r)){let t="";for(let r=0,n=e.length;r<n;r++){let n=e[r].toString(16);n.length<2&&(n="0"+n),t+="%"+n}return decodeURIComponent(t)}if(r.equals(H.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new j(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(H.UTF8)||e.equals(H.ISO8859_1)||e.equals(H.ASCII)}static encodeFallback(e){let t=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let e=0;e<t.length;e++)r.push(t[e].charCodeAt(0));return new Uint8Array(r)}}class X{static castAsNonUtf8Char(e,t=null){let r=t?t.getName():this.ISO88591;return Y.decode(new Uint8Array([e]),r)}static guessEncoding(e,t){if(null!=t&&void 0!==t.get(U.CHARACTER_SET))return t.get(U.CHARACTER_SET).toString();let r=e.length,n=!0,i=!0,a=!0,o=0,s=0,l=0,u=0,c=0,h=0,d=0,f=0,g=0,p=0,v=0,y=e.length>3&&239===e[0]&&187===e[1]&&191===e[2];for(let t=0;t<r&&(n||i||a);t++){let r=255&e[t];a&&(o>0?(128&r)==0?a=!1:o--:(128&r)!=0&&((64&r)==0?a=!1:(o++,(32&r)==0?s++:(o++,(16&r)==0?l++:(o++,(8&r)==0?u++:a=!1))))),n&&(r>127&&r<160?n=!1:r>159&&(r<192||215===r||247===r)&&v++),i&&(c>0?r<64||127===r||r>252?i=!1:c--:128===r||160===r||r>239?i=!1:r>160&&r<224?(h++,f=0,++d>g&&(g=d)):r>127?(c++,d=0,++f>p&&(p=f)):(d=0,f=0))}return(a&&o>0&&(a=!1),i&&c>0&&(i=!1),a&&(y||s+l+u>0))?X.UTF8:i&&(X.ASSUME_SHIFT_JIS||g>=3||p>=3)?X.SHIFT_JIS:n&&i?2===g&&2===h||10*v>=r?X.SHIFT_JIS:X.ISO88591:n?X.ISO88591:i?X.SHIFT_JIS:a?X.UTF8:X.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let r=-1;return e.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,function(e,n,i,a,o,s){let l;if("%%"===e)return"%";if(void 0===t[++r])return;e=a?parseInt(a.substr(1)):void 0;let u=o?parseInt(o.substr(1)):void 0;switch(s){case"s":l=t[r];break;case"c":l=t[r][0];break;case"f":l=parseFloat(t[r]).toFixed(e);break;case"p":l=parseFloat(t[r]).toPrecision(e);break;case"e":l=parseFloat(t[r]).toExponential(e);break;case"x":l=parseInt(t[r]).toString(u||16);break;case"d":l=parseFloat(parseInt(t[r],u||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(u);let c=parseInt(i),h=i&&i[0]+""=="0"?"0":" ";for(;l.length<c;)l=void 0!==n?l+h:h+l;return l})}static getBytes(e,t){return Y.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}X.SHIFT_JIS=H.SJIS.getName(),X.GB2312="GB2312",X.ISO88591=H.ISO8859_1.getName(),X.EUC_JP="EUC_JP",X.UTF8=H.UTF8.getName(),X.PLATFORM_DEFAULT_ENCODING=X.UTF8,X.ASSUME_SHIFT_JIS=!1;class G{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return"string"==typeof e?this.value+=e.toString():this.encoding?this.value+=X.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,r){for(let n=t;t<t+r;n++)this.append(e[n]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class W{constructor(e,t,r,n){if(this.width=e,this.height=t,this.rowSize=r,this.bits=n,null==t&&(t=e),this.height=t,e<1||t<1)throw new N("Both dimensions must be greater than 0");null==r&&(r=Math.floor((e+31)/32)),this.rowSize=r,null==n&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){let t=e.length,r=e[0].length,n=new W(r,t);for(let i=0;i<t;i++){let t=e[i];for(let e=0;e<r;e++)t[e]&&n.set(e,i)}return n}static parseFromString(e,t,r){if(null===e)throw new N("stringRepresentation cannot be null");let n=Array(e.length),i=0,a=0,o=-1,s=0,l=0;for(;l<e.length;)if("\n"===e.charAt(l)||"\r"===e.charAt(l)){if(i>a){if(-1===o)o=i-a;else if(i-a!==o)throw new N("row lengths do not match");a=i,s++}l++}else if(e.substring(l,l+t.length)===t)l+=t.length,n[i]=!0,i++;else if(e.substring(l,l+r.length)===r)l+=r.length,n[i]=!1,i++;else throw new N("illegal character encountered: "+e.substring(l));if(i>a){if(-1===o)o=i-a;else if(i-a!==o)throw new N("row lengths do not match");s++}let u=new W(o,s);for(let e=0;e<i;e++)n[e]&&u.set(Math.floor(e%o),Math.floor(e/o));return u}get(e,t){let r=t*this.rowSize+Math.floor(e/32);return(this.bits[r]>>>(31&e)&1)!=0}set(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]|=1<<(31&e)}unset(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]&=~(1<<(31&e))}flip(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]^=1<<(31&e)}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new N("input matrix dimensions do not match");let t=new z(Math.floor(this.width/32)+1),r=this.rowSize,n=this.bits;for(let i=0,a=this.height;i<a;i++){let a=i*r,o=e.getRow(i,t).getBitArray();for(let e=0;e<r;e++)n[a+e]^=o[e]}}clear(){let e=this.bits,t=e.length;for(let r=0;r<t;r++)e[r]=0}setRegion(e,t,r,n){if(t<0||e<0)throw new N("Left and top must be nonnegative");if(n<1||r<1)throw new N("Height and width must be at least 1");let i=e+r,a=t+n;if(a>this.height||i>this.width)throw new N("The region must fit inside the matrix");let o=this.rowSize,s=this.bits;for(let r=t;r<a;r++){let t=r*o;for(let r=e;r<i;r++)s[t+Math.floor(r/32)]|=1<<(31&r)}}getRow(e,t){null==t||t.getSize()<this.width?t=new z(this.width):t.clear();let r=this.rowSize,n=this.bits,i=e*r;for(let e=0;e<r;e++)t.setBulk(32*e,n[i+e]);return t}setRow(e,t){P.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){let e=this.getWidth(),t=this.getHeight(),r=new z(e),n=new z(e);for(let e=0,i=Math.floor((t+1)/2);e<i;e++)r=this.getRow(e,r),n=this.getRow(t-1-e,n),r.reverse(),n.reverse(),this.setRow(e,n),this.setRow(t-1-e,r)}getEnclosingRectangle(){let e=this.width,t=this.height,r=this.rowSize,n=this.bits,i=e,a=t,o=-1,s=-1;for(let e=0;e<t;e++)for(let t=0;t<r;t++){let l=n[e*r+t];if(0!==l){if(e<a&&(a=e),e>s&&(s=e),32*t<i){let e=0;for(;l<<31-e==0;)e++;32*t+e<i&&(i=32*t+e)}if(32*t+31>o){let e=31;for(;l>>>e==0;)e--;32*t+e>o&&(o=32*t+e)}}}return o<i||s<a?null:Int32Array.from([i,a,o-i+1,s-a+1])}getTopLeftOnBit(){let e=this.rowSize,t=this.bits,r=0;for(;r<t.length&&0===t[r];)r++;if(r===t.length)return null;let n=r/e,i=r%e*32,a=t[r],o=0;for(;a<<31-o==0;)o++;return i+=o,Int32Array.from([i,n])}getBottomRightOnBit(){let e=this.rowSize,t=this.bits,r=t.length-1;for(;r>=0&&0===t[r];)r--;if(r<0)return null;let n=Math.floor(r/e),i=32*Math.floor(r%e),a=t[r],o=31;for(;a>>>o==0;)o--;return i+=o,Int32Array.from([i,n])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){return e instanceof W&&this.width===e.width&&this.height===e.height&&this.rowSize===e.rowSize&&k.equals(this.bits,e.bits)}hashCode(){let e=this.width;return 31*(e=31*(e=31*(e=31*e+this.width)+this.height)+this.rowSize)+k.hashCode(this.bits)}toString(e="X ",t=" ",r="\n"){return this.buildToString(e,t,r)}buildToString(e,t,r){let n=new G;for(let i=0,a=this.height;i<a;i++){for(let r=0,a=this.width;r<a;r++)n.append(this.get(r,i)?e:t);n.append(r)}return n.toString()}clone(){return new W(this.width,this.height,this.rowSize,this.bits.slice())}}class q extends x{static getNotFoundInstance(){return new q}}q.kind="NotFoundException";class Z extends O{constructor(e){super(e),this.luminances=Z.EMPTY,this.buckets=new Int32Array(Z.LUMINANCE_BUCKETS)}getBlackRow(e,t){let r=this.getLuminanceSource(),n=r.getWidth();null==t||t.getSize()<n?t=new z(n):t.clear(),this.initArrays(n);let i=r.getRow(e,this.luminances),a=this.buckets;for(let e=0;e<n;e++)a[(255&i[e])>>Z.LUMINANCE_SHIFT]++;let o=Z.estimateBlackPoint(a);if(n<3)for(let e=0;e<n;e++)(255&i[e])<o&&t.set(e);else{let e=255&i[0],r=255&i[1];for(let a=1;a<n-1;a++){let n=255&i[a+1];(4*r-e-n)/2<o&&t.set(a),e=r,r=n}}return t}getBlackMatrix(){let e=this.getLuminanceSource(),t=e.getWidth(),r=e.getHeight(),n=new W(t,r);this.initArrays(t);let i=this.buckets;for(let n=1;n<5;n++){let a=Math.floor(r*n/5),o=e.getRow(a,this.luminances),s=Math.floor(4*t/5);for(let e=Math.floor(t/5);e<s;e++){let t=255&o[e];i[t>>Z.LUMINANCE_SHIFT]++}}let a=Z.estimateBlackPoint(i),o=e.getMatrix();for(let e=0;e<r;e++){let r=e*t;for(let i=0;i<t;i++)(255&o[r+i])<a&&n.set(i,e)}return n}createBinarizer(e){return new Z(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));let t=this.buckets;for(let e=0;e<Z.LUMINANCE_BUCKETS;e++)t[e]=0}static estimateBlackPoint(e){let t=e.length,r=0,n=0,i=0;for(let a=0;a<t;a++)e[a]>i&&(n=a,i=e[a]),e[a]>r&&(r=e[a]);let a=0,o=0;for(let r=0;r<t;r++){let t=r-n,i=e[r]*t*t;i>o&&(a=r,o=i)}if(n>a){let e=n;n=a,a=e}if(a-n<=t/16)throw new q;let s=a-1,l=-1;for(let t=a-1;t>n;t--){let i=t-n,o=i*i*(a-t)*(r-e[t]);o>l&&(s=t,l=o)}return s<<Z.LUMINANCE_SHIFT}}Z.LUMINANCE_BITS=5,Z.LUMINANCE_SHIFT=8-Z.LUMINANCE_BITS,Z.LUMINANCE_BUCKETS=1<<Z.LUMINANCE_BITS,Z.EMPTY=Uint8ClampedArray.from([0]);class Q extends Z{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;let e=this.getLuminanceSource(),t=e.getWidth(),r=e.getHeight();if(t>=Q.MINIMUM_DIMENSION&&r>=Q.MINIMUM_DIMENSION){let n=e.getMatrix(),i=t>>Q.BLOCK_SIZE_POWER;(t&Q.BLOCK_SIZE_MASK)!=0&&i++;let a=r>>Q.BLOCK_SIZE_POWER;(r&Q.BLOCK_SIZE_MASK)!=0&&a++;let o=Q.calculateBlackPoints(n,i,a,t,r),s=new W(t,r);Q.calculateThresholdForBlock(n,i,a,t,r,o,s),this.matrix=s}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new Q(e)}static calculateThresholdForBlock(e,t,r,n,i,a,o){let s=i-Q.BLOCK_SIZE,l=n-Q.BLOCK_SIZE;for(let i=0;i<r;i++){let u=i<<Q.BLOCK_SIZE_POWER;u>s&&(u=s);let c=Q.cap(i,2,r-3);for(let r=0;r<t;r++){let i=r<<Q.BLOCK_SIZE_POWER;i>l&&(i=l);let s=Q.cap(r,2,t-3),h=0;for(let e=-2;e<=2;e++){let t=a[c+e];h+=t[s-2]+t[s-1]+t[s]+t[s+1]+t[s+2]}let d=h/25;Q.thresholdBlock(e,i,u,d,n,o)}}}static cap(e,t,r){return e<t?t:e>r?r:e}static thresholdBlock(e,t,r,n,i,a){for(let o=0,s=r*i+t;o<Q.BLOCK_SIZE;o++,s+=i)for(let i=0;i<Q.BLOCK_SIZE;i++)(255&e[s+i])<=n&&a.set(t+i,r+o)}static calculateBlackPoints(e,t,r,n,i){let a=i-Q.BLOCK_SIZE,o=n-Q.BLOCK_SIZE,s=Array(r);for(let i=0;i<r;i++){s[i]=new Int32Array(t);let r=i<<Q.BLOCK_SIZE_POWER;r>a&&(r=a);for(let a=0;a<t;a++){let t=a<<Q.BLOCK_SIZE_POWER;t>o&&(t=o);let l=0,u=255,c=0;for(let i=0,a=r*n+t;i<Q.BLOCK_SIZE;i++,a+=n){for(let t=0;t<Q.BLOCK_SIZE;t++){let r=255&e[a+t];l+=r,r<u&&(u=r),r>c&&(c=r)}if(c-u>Q.MIN_DYNAMIC_RANGE)for(i++,a+=n;i<Q.BLOCK_SIZE;i++,a+=n)for(let t=0;t<Q.BLOCK_SIZE;t++)l+=255&e[a+t]}let h=l>>2*Q.BLOCK_SIZE_POWER;if(c-u<=Q.MIN_DYNAMIC_RANGE&&(h=u/2,i>0&&a>0)){let e=(s[i-1][a]+2*s[i][a-1]+s[i-1][a-1])/4;u<e&&(h=e)}s[i][a]=h}}return s}}Q.BLOCK_SIZE_POWER=3,Q.BLOCK_SIZE=1<<Q.BLOCK_SIZE_POWER,Q.BLOCK_SIZE_MASK=Q.BLOCK_SIZE-1,Q.MINIMUM_DIMENSION=5*Q.BLOCK_SIZE,Q.MIN_DYNAMIC_RANGE=24;class K{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,r,n){throw new j("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new j("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new j("This luminance source does not support rotation by 45 degrees.")}toString(){let e=new Uint8ClampedArray(this.width),t=new G;for(let r=0;r<this.height;r++){let n=this.getRow(r,e);for(let e=0;e<this.width;e++){let r,i=255&n[e];r=i<64?"#":i<128?"+":i<192?".":" ",t.append(r)}t.append("\n")}return t.toString()}}class $ extends K{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){let r=this.delegate.getRow(e,t),n=this.getWidth();for(let e=0;e<n;e++)r[e]=255-(255&r[e]);return r}getMatrix(){let e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),r=new Uint8ClampedArray(t);for(let n=0;n<t;n++)r[n]=255-(255&e[n]);return r}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,r,n){return new $(this.delegate.crop(e,t,r,n))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new $(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new $(this.delegate.rotateCounterClockwise45())}}class J extends K{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=J.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){let t=e.getContext("2d").getImageData(0,0,e.width,e.height);return J.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,r){let n=new Uint8ClampedArray(t*r);for(let t=0,r=0,i=e.length;t<i;t+=4,r++){let i;i=0===e[t+3]?255:306*e[t]+601*e[t+1]+117*e[t+2]+512>>10,n[r]=i}return n}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);let r=this.getWidth(),n=e*r;return null===t?t=this.buffer.slice(n,n+r):(t.length<r&&(t=new Uint8ClampedArray(r)),t.set(this.buffer.slice(n,n+r))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,r,n){return super.crop(e,t,r,n),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(null===this.tempCanvasElement){let e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){let t=this.getTempCanvasElement(),r=t.getContext("2d"),n=e*J.DEGREE_TO_RADIANS,i=this.canvas.width,a=this.canvas.height,o=Math.ceil(Math.abs(Math.cos(n))*i+Math.abs(Math.sin(n))*a),s=Math.ceil(Math.abs(Math.sin(n))*i+Math.abs(Math.cos(n))*a);return t.width=o,t.height=s,r.translate(o/2,s/2),r.rotate(n),r.drawImage(this.canvas,-(i/2),-(a/2)),this.buffer=J.makeBufferFromCanvasImageData(t),this}invert(){return new $(this)}}J.DEGREE_TO_RADIANS=Math.PI/180;class ee{constructor(e,t,r){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=r||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var et=(globalThis||r.g||self||window||void 0)&&(globalThis||r.g||self||window||void 0).__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})};class er{constructor(e,t=500,r){this.reader=e,this.timeBetweenScansMillis=t,this._hints=r,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return"u">typeof navigator}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return et(this,void 0,void 0,function*(){if(!this.hasNavigator)throw Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw Error("Can't enumerate devices, method not supported.");let e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(let r of e){let e="video"===r.kind?"videoinput":r.kind;if("videoinput"!==e)continue;let n=r.deviceId||r.id,i={deviceId:n,label:r.label||`Video device ${t.length+1}`,kind:e,groupId:r.groupId};t.push(i)}return t})}getVideoInputDevices(){return et(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(e=>new ee(e.deviceId,e.label))})}findDeviceById(e){return et(this,void 0,void 0,function*(){let t=yield this.listVideoInputDevices();return t?t.find(t=>t.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return et(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return et(this,void 0,void 0,function*(){return this.reset(),yield this.decodeOnceFromConstraints({video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},t)})}decodeOnceFromConstraints(e,t){return et(this,void 0,void 0,function*(){let r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(r,t)})}decodeOnceFromStream(e,t){return et(this,void 0,void 0,function*(){this.reset();let r=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(r)})}decodeFromInputVideoDeviceContinuously(e,t,r){return et(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,r)})}decodeFromVideoDevice(e,t,r){return et(this,void 0,void 0,function*(){return yield this.decodeFromConstraints({video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},t,r)})}decodeFromConstraints(e,t,r){return et(this,void 0,void 0,function*(){let n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(n,t,r)})}decodeFromStream(e,t,r){return et(this,void 0,void 0,function*(){this.reset();let n=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(n,r)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return et(this,void 0,void 0,function*(){let r=this.prepareVideoElement(t);return this.addVideoSource(r,e),this.videoElement=r,this.stream=e,yield this.playVideoOnLoadAsync(r),r})}playVideoOnLoadAsync(e){return new Promise((t,r)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return et(this,void 0,void 0,function*(){if(this.isVideoPlaying(e))return void console.warn("Trying to play video that is already playing.");try{yield e.play()}catch(e){console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){let r=document.getElementById(e);if(!r)throw new D(`element with id '${e}' not found`);if(r.nodeName.toLowerCase()!==t.toLowerCase())throw new D(`element with id '${e}' must be an ${t} element`);return r}decodeFromImage(e,t){if(!e&&!t)throw new D("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new D("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,r){if(void 0===e&&void 0===t)throw new D("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,r):this.decodeFromVideoElementContinuously(e,r)}decodeFromImageElement(e){if(!e)throw new D("An image element must be provided.");this.reset();let t=this.prepareImageElement(e);return this.imageElement=t,this.isImageLoaded(t)?this.decodeOnce(t,!1,!0):this._decodeOnLoadImage(t)}decodeFromVideoElement(e){let t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){let r=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(r,t)}_decodeFromVideoElementSetup(e){if(!e)throw new D("A video element must be provided.");this.reset();let t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new D("An URL must be provided.");this.reset();let t=this.prepareImageElement();this.imageElement=t;let r=this._decodeOnLoadImage(t);return t.src=e,r}decodeFromVideoUrl(e){if(!e)throw new D("An URL must be provided.");this.reset();let t=this.prepareVideoElement(),r=this.decodeFromVideoElement(t);return t.src=e,r}decodeFromVideoUrlContinuously(e,t){if(!e)throw new D("An URL must be provided.");this.reset();let r=this.prepareVideoElement(),n=this.decodeFromVideoElementContinuously(r,t);return r.src=e,n}_decodeOnLoadImage(e){return new Promise((t,r)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,r),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return et(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return et(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!!e.complete&&0!==e.naturalWidth}prepareImageElement(e){let t;return void 0===e&&((t=document.createElement("img")).width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&"u">typeof document&&((t=document.createElement("video")).width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,r=!0){this._stopAsyncDecode=!1;let n=(i,a)=>{if(this._stopAsyncDecode){a(new q("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{let t=this.decode(e);i(t)}catch(s){let e=t&&s instanceof q,o=s instanceof R||s instanceof V;if(e||o&&r)return setTimeout(n,this._timeBetweenDecodingAttempts,i,a);a(s)}};return new Promise((e,t)=>n(e,t))}decodeContinuously(e,t){this._stopContinuousDecode=!1;let r=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{let n=this.decode(e);t(n,null),setTimeout(r,this.timeBetweenScansMillis)}catch(i){t(null,i);let e=i instanceof R||i instanceof V,n=i instanceof q;(e||n)&&setTimeout(r,this._timeBetweenDecodingAttempts)}};r()}decode(e){let t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return 0!==e.videoWidth}drawFrameOnCanvas(e,t,r){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),r||(r=this.captureCanvasContext),r.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,r=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),r||(r=this.captureCanvasContext),r.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){return this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e),new M(new Q(new J(this.getCaptureCanvas(e))))}getCaptureCanvasContext(e){if(!this.captureCanvasContext){let t=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=t}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){let t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){let t,r;if("u"<typeof document)return this._destroyCaptureCanvas(),null;let n=document.createElement("canvas");return void 0!==e&&(e instanceof HTMLVideoElement?(t=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(t=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),n.style.width=t+"px",n.style.height=r+"px",n.width=t,n.height=r,n}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch(r){e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}class en{constructor(e,t,r=null==t?0:8*t.length,n,i,a=P.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=r,this.resultPoints=n,this.format=i,this.timestamp=a,this.text=e,this.rawBytes=t,null==r?this.numBits=null==t?0:8*t.length:this.numBits=r,this.resultPoints=n,this.format=i,this.resultMetadata=null,null==a?this.timestamp=P.currentTimeMillis():this.timestamp=a}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){null!==e&&(null===this.resultMetadata?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){let t=this.resultPoints;if(null===t)this.resultPoints=e;else if(null!==e&&e.length>0){let r=Array(t.length+e.length);P.arraycopy(t,0,r,0,t.length),P.arraycopy(e,0,r,t.length,e.length),this.resultPoints=r}}getTimestamp(){return this.timestamp}toString(){return this.text}}(a=v||(v={}))[a.AZTEC=0]="AZTEC",a[a.CODABAR=1]="CODABAR",a[a.CODE_39=2]="CODE_39",a[a.CODE_93=3]="CODE_93",a[a.CODE_128=4]="CODE_128",a[a.DATA_MATRIX=5]="DATA_MATRIX",a[a.EAN_8=6]="EAN_8",a[a.EAN_13=7]="EAN_13",a[a.ITF=8]="ITF",a[a.MAXICODE=9]="MAXICODE",a[a.PDF_417=10]="PDF_417",a[a.QR_CODE=11]="QR_CODE",a[a.RSS_14=12]="RSS_14",a[a.RSS_EXPANDED=13]="RSS_EXPANDED",a[a.UPC_A=14]="UPC_A",a[a.UPC_E=15]="UPC_E",a[a.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION";var ei=v;(o=y||(y={}))[o.OTHER=0]="OTHER",o[o.ORIENTATION=1]="ORIENTATION",o[o.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",o[o.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",o[o.ISSUE_NUMBER=4]="ISSUE_NUMBER",o[o.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",o[o.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",o[o.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",o[o.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",o[o.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",o[o.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY";var ea=y;class eo{constructor(e,t,r,n,i=-1,a=-1){this.rawBytes=e,this.text=t,this.byteSegments=r,this.ecLevel=n,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=a,this.numBits=null==e?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class es{exp(e){return this.expTable[e]}log(e){if(0===e)throw new N;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class el{constructor(e,t){if(0===t.length)throw new N;this.field=e;const r=t.length;if(r>1&&0===t[0]){let e=1;for(;e<r&&0===t[e];)e++;e===r?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(r-e),P.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){let t;if(0===e)return this.getCoefficient(0);let r=this.coefficients;if(1===e){t=0;for(let e=0,n=r.length;e!==n;e++){let n=r[e];t=es.addOrSubtract(t,n)}return t}t=r[0];let n=r.length,i=this.field;for(let a=1;a<n;a++)t=es.addOrSubtract(i.multiply(e,t),r[a]);return t}addOrSubtract(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,r=e.coefficients;if(t.length>r.length){let e=t;t=r,r=e}let n=new Int32Array(r.length),i=r.length-t.length;P.arraycopy(r,0,n,0,i);for(let e=i;e<r.length;e++)n[e]=es.addOrSubtract(t[e-i],r[e]);return new el(this.field,n)}multiply(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();let t=this.coefficients,r=t.length,n=e.coefficients,i=n.length,a=new Int32Array(r+i-1),o=this.field;for(let e=0;e<r;e++){let r=t[e];for(let t=0;t<i;t++)a[e+t]=es.addOrSubtract(a[e+t],o.multiply(r,n[t]))}return new el(o,a)}multiplyScalar(e){if(0===e)return this.field.getZero();if(1===e)return this;let t=this.coefficients.length,r=this.field,n=new Int32Array(t),i=this.coefficients;for(let a=0;a<t;a++)n[a]=r.multiply(i[a],e);return new el(r,n)}multiplyByMonomial(e,t){if(e<0)throw new N;if(0===t)return this.field.getZero();let r=this.coefficients,n=r.length,i=new Int32Array(n+e),a=this.field;for(let e=0;e<n;e++)i[e]=a.multiply(r[e],t);return new el(a,i)}divide(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new N("Divide by 0");let t=this.field,r=t.getZero(),n=this,i=e.getCoefficient(e.getDegree()),a=t.inverse(i);for(;n.getDegree()>=e.getDegree()&&!n.isZero();){let i=n.getDegree()-e.getDegree(),o=t.multiply(n.getCoefficient(n.getDegree()),a),s=e.multiplyByMonomial(i,o),l=t.buildMonomial(i,o);r=r.addOrSubtract(l),n=n.addOrSubtract(s)}return[r,n]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let r=this.getCoefficient(t);if(0!==r){if(r<0?(e+=" - ",r=-r):e.length>0&&(e+=" + "),0===t||1!==r){let t=this.field.log(r);0===t?e+="1":1===t?e+="a":(e+="a^",e+=t)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e}}class eu extends x{}eu.kind="ArithmeticException";class ec extends es{constructor(e,t,r){super(),this.primitive=e,this.size=t,this.generatorBase=r;const n=new Int32Array(t);let i=1;for(let r=0;r<t;r++)n[r]=i,(i*=2)>=t&&(i^=e,i&=t-1);this.expTable=n;const a=new Int32Array(t);for(let e=0;e<t-1;e++)a[n[e]]=e;this.logTable=a,this.zero=new el(this,Int32Array.from([0])),this.one=new el(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new N;if(0===t)return this.zero;let r=new Int32Array(e+1);return r[0]=t,new el(this,r)}inverse(e){if(0===e)throw new eu;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+F.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}ec.AZTEC_DATA_12=new ec(4201,4096,1),ec.AZTEC_DATA_10=new ec(1033,1024,1),ec.AZTEC_DATA_6=new ec(67,64,1),ec.AZTEC_PARAM=new ec(19,16,1),ec.QR_CODE_FIELD_256=new ec(285,256,0),ec.DATA_MATRIX_FIELD_256=new ec(301,256,1),ec.AZTEC_DATA_8=ec.DATA_MATRIX_FIELD_256,ec.MAXICODE_FIELD_64=ec.AZTEC_DATA_6;class eh extends x{}eh.kind="ReedSolomonException";class ed extends x{}ed.kind="IllegalStateException";class ef{constructor(e){this.field=e}decode(e,t){let r=this.field,n=new el(r,e),i=new Int32Array(t),a=!0;for(let e=0;e<t;e++){let t=n.evaluateAt(r.exp(e+r.getGeneratorBase()));i[i.length-1-e]=t,0!==t&&(a=!1)}if(a)return;let o=new el(r,i),s=this.runEuclideanAlgorithm(r.buildMonomial(t,1),o,t),l=s[0],u=s[1],c=this.findErrorLocations(l),h=this.findErrorMagnitudes(u,c);for(let t=0;t<c.length;t++){let n=e.length-1-r.log(c[t]);if(n<0)throw new eh("Bad error location");e[n]=ec.addOrSubtract(e[n],h[t])}}runEuclideanAlgorithm(e,t,r){if(e.getDegree()<t.getDegree()){let r=e;e=t,t=r}let n=this.field,i=e,a=t,o=n.getZero(),s=n.getOne();for(;a.getDegree()>=(r/2|0);){let e=i,t=o;if(i=a,o=s,i.isZero())throw new eh("r_{i-1} was zero");a=e;let r=n.getZero(),l=i.getCoefficient(i.getDegree()),u=n.inverse(l);for(;a.getDegree()>=i.getDegree()&&!a.isZero();){let e=a.getDegree()-i.getDegree(),t=n.multiply(a.getCoefficient(a.getDegree()),u);r=r.addOrSubtract(n.buildMonomial(e,t)),a=a.addOrSubtract(i.multiplyByMonomial(e,t))}if(s=r.multiply(o).addOrSubtract(t),a.getDegree()>=i.getDegree())throw new ed("Division algorithm failed to reduce polynomial?")}let l=s.getCoefficient(0);if(0===l)throw new eh("sigmaTilde(0) was zero");let u=n.inverse(l);return[s.multiplyScalar(u),a.multiplyScalar(u)]}findErrorLocations(e){let t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);let r=new Int32Array(t),n=0,i=this.field;for(let a=1;a<i.getSize()&&n<t;a++)0===e.evaluateAt(a)&&(r[n]=i.inverse(a),n++);if(n!==t)throw new eh("Error locator degree does not match number of roots");return r}findErrorMagnitudes(e,t){let r=t.length,n=new Int32Array(r),i=this.field;for(let a=0;a<r;a++){let o=i.inverse(t[a]),s=1;for(let e=0;e<r;e++)if(a!==e){let r=i.multiply(t[e],o),n=(1&r)==0?1|r:-2&r;s=i.multiply(s,n)}n[a]=i.multiply(e.evaluateAt(o),i.inverse(s)),0!==i.getGeneratorBase()&&(n[a]=i.multiply(n[a],o))}return n}}(s=w||(w={}))[s.UPPER=0]="UPPER",s[s.LOWER=1]="LOWER",s[s.MIXED=2]="MIXED",s[s.DIGIT=3]="DIGIT",s[s.PUNCT=4]="PUNCT",s[s.BINARY=5]="BINARY";class eg{decode(e){this.ddata=e;let t=e.getBits(),r=this.extractBits(t),n=this.correctBits(r),i=new eo(eg.convertBoolArrayToByteArray(n),eg.getEncodedData(n),null,null);return i.setNumBits(n.length),i}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,r=w.UPPER,n=w.UPPER,i="",a=0;for(;a<t;)if(n===w.BINARY){if(t-a<5)break;let o=eg.readCode(e,a,5);if(a+=5,0===o){if(t-a<11)break;o=eg.readCode(e,a,11)+31,a+=11}for(let r=0;r<o;r++){if(t-a<8){a=t;break}let r=eg.readCode(e,a,8);i+=X.castAsNonUtf8Char(r),a+=8}n=r}else{let o=n===w.DIGIT?4:5;if(t-a<o)break;let s=eg.readCode(e,a,o);a+=o;let l=eg.getCharacter(n,s);l.startsWith("CTRL_")?(r=n,n=eg.getTable(l.charAt(5)),"L"===l.charAt(6)&&(r=n)):(i+=l,n=r)}return i}static getTable(e){switch(e){case"L":return w.LOWER;case"P":return w.PUNCT;case"M":return w.MIXED;case"D":return w.DIGIT;case"B":return w.BINARY;default:return w.UPPER}}static getCharacter(e,t){switch(e){case w.UPPER:return eg.UPPER_TABLE[t];case w.LOWER:return eg.LOWER_TABLE[t];case w.MIXED:return eg.MIXED_TABLE[t];case w.PUNCT:return eg.PUNCT_TABLE[t];case w.DIGIT:return eg.DIGIT_TABLE[t];default:throw new ed("Bad table")}}correctBits(e){let t,r;2>=this.ddata.getNbLayers()?(r=6,t=ec.AZTEC_DATA_6):8>=this.ddata.getNbLayers()?(r=8,t=ec.AZTEC_DATA_8):22>=this.ddata.getNbLayers()?(r=10,t=ec.AZTEC_DATA_10):(r=12,t=ec.AZTEC_DATA_12);let n=this.ddata.getNbDatablocks(),i=e.length/r;if(i<n)throw new V;let a=e.length%r,o=new Int32Array(i);for(let t=0;t<i;t++,a+=r)o[t]=eg.readCode(e,a,r);try{new ef(t).decode(o,i-n)}catch(e){throw new V(e)}let s=(1<<r)-1,l=0;for(let e=0;e<n;e++){let t=o[e];if(0===t||t===s)throw new V;(1===t||t===s-1)&&l++}let u=Array(n*r-l),c=0;for(let e=0;e<n;e++){let t=o[e];if(1===t||t===s-1)u.fill(t>1,c,c+r-1),c+=r-1;else for(let e=r-1;e>=0;--e)u[c++]=(t&1<<e)!=0}return u}extractBits(e){let t=this.ddata.isCompact(),r=this.ddata.getNbLayers(),n=(t?11:14)+4*r,i=new Int32Array(n),a=Array(this.totalBitsInLayer(r,t));if(t)for(let e=0;e<i.length;e++)i[e]=e;else{let e=n+1+2*F.truncDivision(F.truncDivision(n,2)-1,15),t=n/2,r=F.truncDivision(e,2);for(let e=0;e<t;e++){let n=e+F.truncDivision(e,15);i[t-e-1]=r-n-1,i[t+e]=r+n+1}}for(let o=0,s=0;o<r;o++){let l=(r-o)*4+(t?9:12),u=2*o,c=n-1-u;for(let t=0;t<l;t++){let r=2*t;for(let n=0;n<2;n++)a[s+r+n]=e.get(i[u+n],i[u+t]),a[s+2*l+r+n]=e.get(i[u+t],i[c-n]),a[s+4*l+r+n]=e.get(i[c-n],i[c-t]),a[s+6*l+r+n]=e.get(i[c-t],i[u+n])}s+=8*l}return a}static readCode(e,t,r){let n=0;for(let i=t;i<t+r;i++)n<<=1,e[i]&&(n|=1);return n}static readByte(e,t){let r=e.length-t;return r>=8?eg.readCode(e,t,8):eg.readCode(e,t,r)<<8-r}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let r=0;r<t.length;r++)t[r]=eg.readByte(e,8*r);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}eg.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],eg.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],eg.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ","\n","\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],eg.PUNCT_TABLE=["","\r","\r\n",". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],eg.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ep{static round(e){return e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,r,n){let i=e-r,a=t-n;return Math.sqrt(i*i+a*a)}static sum(e){let t=0;for(let r=0,n=e.length;r!==n;r++)t+=e[r];return t}}class em{static floatToIntBits(e){return e}}em.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ev{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){return e instanceof ev&&this.x===e.x&&this.y===e.y}hashCode(){return 31*em.floatToIntBits(this.x)+em.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){let t,r,n,i=this.distance(e[0],e[1]),a=this.distance(e[1],e[2]),o=this.distance(e[0],e[2]);if(a>=i&&a>=o?(r=e[0],t=e[1],n=e[2]):o>=a&&o>=i?(r=e[1],t=e[0],n=e[2]):(r=e[2],t=e[0],n=e[1]),0>this.crossProductZ(t,r,n)){let e=t;t=n,n=e}e[0]=t,e[1]=r,e[2]=n}static distance(e,t){return ep.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,r){let n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}}class ey{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class ew extends ey{constructor(e,t,r,n,i){super(e,t),this.compact=r,this.nbDatablocks=n,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class eE{constructor(e,t,r,n){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==t&&(t=eE.INIT_SIZE),null==r&&(r=e.getWidth()/2|0),null==n&&(n=e.getHeight()/2|0);const i=t/2|0;if(this.leftInit=r-i,this.rightInit=r+i,this.upInit=n-i,this.downInit=n+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new q}detect(){let e=this.leftInit,t=this.rightInit,r=this.upInit,n=this.downInit,i=!1,a=!0,o=!1,s=!1,l=!1,u=!1,c=!1,h=this.width,d=this.height;for(;a;){a=!1;let f=!0;for(;(f||!s)&&t<h;)(f=this.containsBlackPoint(r,n,t,!1))?(t++,a=!0,s=!0):!s&&t++;if(t>=h){i=!0;break}let g=!0;for(;(g||!l)&&n<d;)(g=this.containsBlackPoint(e,t,n,!0))?(n++,a=!0,l=!0):!l&&n++;if(n>=d){i=!0;break}let p=!0;for(;(p||!u)&&e>=0;)(p=this.containsBlackPoint(r,n,e,!1))?(e--,a=!0,u=!0):!u&&e--;if(e<0){i=!0;break}let v=!0;for(;(v||!c)&&r>=0;)(v=this.containsBlackPoint(e,t,r,!0))?(r--,a=!0,c=!0):!c&&r--;if(r<0){i=!0;break}a&&(o=!0)}if(!i&&o){let i=t-e,a=null;for(let t=1;null===a&&t<i;t++)a=this.getBlackPointOnSegment(e,n-t,e+t,n);if(null==a)throw new q;let o=null;for(let t=1;null===o&&t<i;t++)o=this.getBlackPointOnSegment(e,r+t,e+t,r);if(null==o)throw new q;let s=null;for(let e=1;null===s&&e<i;e++)s=this.getBlackPointOnSegment(t,r+e,t-e,r);if(null==s)throw new q;let l=null;for(let e=1;null===l&&e<i;e++)l=this.getBlackPointOnSegment(t,n-e,t-e,n);if(null==l)throw new q;return this.centerEdges(l,a,s,o)}throw new q}getBlackPointOnSegment(e,t,r,n){let i=ep.round(ep.distance(e,t,r,n)),a=(r-e)/i,o=(n-t)/i,s=this.image;for(let r=0;r<i;r++){let n=ep.round(e+r*a),i=ep.round(t+r*o);if(s.get(n,i))return new ev(n,i)}return null}centerEdges(e,t,r,n){let i=e.getX(),a=e.getY(),o=t.getX(),s=t.getY(),l=r.getX(),u=r.getY(),c=n.getX(),h=n.getY(),d=eE.CORR;return i<this.width/2?[new ev(c-d,h+d),new ev(o+d,s+d),new ev(l-d,u-d),new ev(i+d,a-d)]:[new ev(c+d,h+d),new ev(o+d,s-d),new ev(l-d,u+d),new ev(i-d,a-d)]}containsBlackPoint(e,t,r,n){let i=this.image;if(n){for(let n=e;n<=t;n++)if(i.get(n,r))return!0}else for(let n=e;n<=t;n++)if(i.get(r,n))return!0;return!1}}eE.INIT_SIZE=10,eE.CORR=1;class eb{static checkAndNudgePoints(e,t){let r=e.getWidth(),n=e.getHeight(),i=!0;for(let e=0;e<t.length&&i;e+=2){let a=Math.floor(t[e]),o=Math.floor(t[e+1]);if(a<-1||a>r||o<-1||o>n)throw new q;i=!1,-1===a?(t[e]=0,i=!0):a===r&&(t[e]=r-1,i=!0),-1===o?(t[e+1]=0,i=!0):o===n&&(t[e+1]=n-1,i=!0)}i=!0;for(let e=t.length-2;e>=0&&i;e-=2){let a=Math.floor(t[e]),o=Math.floor(t[e+1]);if(a<-1||a>r||o<-1||o>n)throw new q;i=!1,-1===a?(t[e]=0,i=!0):a===r&&(t[e]=r-1,i=!0),-1===o?(t[e+1]=0,i=!0):o===n&&(t[e+1]=n-1,i=!0)}}}class eA{constructor(e,t,r,n,i,a,o,s,l){this.a11=e,this.a21=t,this.a31=r,this.a12=n,this.a22=i,this.a32=a,this.a13=o,this.a23=s,this.a33=l}static quadrilateralToQuadrilateral(e,t,r,n,i,a,o,s,l,u,c,h,d,f,g,p){let v=eA.quadrilateralToSquare(e,t,r,n,i,a,o,s);return eA.squareToQuadrilateral(l,u,c,h,d,f,g,p).times(v)}transformPoints(e){let t=e.length,r=this.a11,n=this.a12,i=this.a13,a=this.a21,o=this.a22,s=this.a23,l=this.a31,u=this.a32,c=this.a33;for(let h=0;h<t;h+=2){let t=e[h],d=e[h+1],f=i*t+s*d+c;e[h]=(r*t+a*d+l)/f,e[h+1]=(n*t+o*d+u)/f}}transformPointsWithValues(e,t){let r=this.a11,n=this.a12,i=this.a13,a=this.a21,o=this.a22,s=this.a23,l=this.a31,u=this.a32,c=this.a33,h=e.length;for(let d=0;d<h;d++){let h=e[d],f=t[d],g=i*h+s*f+c;e[d]=(r*h+a*f+l)/g,t[d]=(n*h+o*f+u)/g}}static squareToQuadrilateral(e,t,r,n,i,a,o,s){let l=e-r+i-o,u=t-n+a-s;if(0===l&&0===u)return new eA(r-e,i-r,e,n-t,a-n,t,0,0,1);{let c=r-i,h=o-i,d=n-a,f=s-a,g=c*f-h*d,p=(l*f-h*u)/g,v=(c*u-l*d)/g;return new eA(r-e+p*r,o-e+v*o,e,n-t+p*n,s-t+v*s,t,p,v,1)}}static quadrilateralToSquare(e,t,r,n,i,a,o,s){return eA.squareToQuadrilateral(e,t,r,n,i,a,o,s).buildAdjoint()}buildAdjoint(){return new eA(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new eA(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class eC extends eb{sampleGrid(e,t,r,n,i,a,o,s,l,u,c,h,d,f,g,p,v,y,w){let E=eA.quadrilateralToQuadrilateral(n,i,a,o,s,l,u,c,h,d,f,g,p,v,y,w);return this.sampleGridWithTransform(e,t,r,E)}sampleGridWithTransform(e,t,r,n){if(t<=0||r<=0)throw new q;let i=new W(t,r),a=new Float32Array(2*t);for(let t=0;t<r;t++){let r=a.length,o=t+.5;for(let e=0;e<r;e+=2)a[e]=e/2+.5,a[e+1]=o;n.transformPoints(a),eb.checkAndNudgePoints(e,a);try{for(let n=0;n<r;n+=2)e.get(Math.floor(a[n]),Math.floor(a[n+1]))&&i.set(n/2,t)}catch(e){throw new q}}return i}}class e_{static setGridSampler(e){e_.gridSampler=e}static getInstance(){return e_.gridSampler}}e_.gridSampler=new eC;class eS{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new ev(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class eI{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),r=this.getBullsEyeCorners(t);if(e){let e=r[0];r[0]=r[2],r[2]=e}return this.extractParameters(r),new ew(this.sampleGrid(this.image,r[this.shift%4],r[(this.shift+1)%4],r[(this.shift+2)%4],r[(this.shift+3)%4]),this.getMatrixCornerPoints(r),this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new q;let t=2*this.nbCenterLayers,r=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(r,t);let n=0;for(let e=0;e<4;e++){let t=r[(this.shift+e)%4];this.compact?(n<<=7,n+=t>>1&127):(n<<=10,n+=(t>>2&992)+(t>>1&31))}let i=this.getCorrectedParameterData(n,this.compact);this.compact?(this.nbLayers=(i>>6)+1,this.nbDataBlocks=(63&i)+1):(this.nbLayers=(i>>11)+1,this.nbDataBlocks=(2047&i)+1)}getRotation(e,t){let r=0;e.forEach((e,n,i)=>{r=(r<<3)+((e>>t-2<<1)+(1&e))}),r=((1&r)<<11)+(r>>1);for(let e=0;e<4;e++)if(2>=F.bitCount(r^this.EXPECTED_CORNER_BITS[e]))return e;throw new q}getCorrectedParameterData(e,t){let r,n;t?(r=7,n=2):(r=10,n=4);let i=r-n,a=new Int32Array(r);for(let t=r-1;t>=0;--t)a[t]=15&e,e>>=4;try{new ef(ec.AZTEC_PARAM).decode(a,i)}catch(e){throw new q}let o=0;for(let e=0;e<n;e++)o=(o<<4)+a[e];return o}getBullsEyeCorners(e){let t=e,r=e,n=e,i=e,a=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let e=this.getFirstDifferent(t,a,1,-1),o=this.getFirstDifferent(r,a,1,1),s=this.getFirstDifferent(n,a,-1,1),l=this.getFirstDifferent(i,a,-1,-1);if(this.nbCenterLayers>2){let r=this.distancePoint(l,e)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(r<.75||r>1.25||!this.isWhiteOrBlackRectangle(e,o,s,l))break}t=e,r=o,n=s,i=l,a=!a}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new q;this.compact=5===this.nbCenterLayers;let o=new ev(t.getX()+.5,t.getY()-.5),s=new ev(r.getX()+.5,r.getY()+.5),l=new ev(n.getX()-.5,n.getY()+.5),u=new ev(i.getX()-.5,i.getY()-.5);return this.expandSquare([o,s,l,u],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,r,n;try{let i=new eE(this.image).detect();e=i[0],t=i[1],r=i[2],n=i[3]}catch(o){let i=this.image.getWidth()/2,a=this.image.getHeight()/2;e=this.getFirstDifferent(new eS(i+7,a-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new eS(i+7,a+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new eS(i-7,a+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new eS(i-7,a-7),!1,-1,-1).toResultPoint()}let i=ep.round((e.getX()+n.getX()+t.getX()+r.getX())/4),a=ep.round((e.getY()+n.getY()+t.getY()+r.getY())/4);try{let o=new eE(this.image,15,i,a).detect();e=o[0],t=o[1],r=o[2],n=o[3]}catch(o){e=this.getFirstDifferent(new eS(i+7,a-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new eS(i+7,a+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new eS(i-7,a+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new eS(i-7,a-7),!1,-1,-1).toResultPoint()}return new eS(i=ep.round((e.getX()+n.getX()+t.getX()+r.getX())/4),a=ep.round((e.getY()+n.getY()+t.getY()+r.getY())/4))}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,r,n,i){let a=e_.getInstance(),o=this.getDimension(),s=o/2-this.nbCenterLayers,l=o/2+this.nbCenterLayers;return a.sampleGrid(e,o,o,s,s,l,s,l,l,s,l,t.getX(),t.getY(),r.getX(),r.getY(),n.getX(),n.getY(),i.getX(),i.getY())}sampleLine(e,t,r){let n=0,i=this.distanceResultPoint(e,t),a=i/r,o=e.getX(),s=e.getY(),l=a*(t.getX()-e.getX())/i,u=a*(t.getY()-e.getY())/i;for(let e=0;e<r;e++)this.image.get(ep.round(o+e*l),ep.round(s+e*u))&&(n|=1<<r-e-1);return n}isWhiteOrBlackRectangle(e,t,r,n){e=new eS(e.getX()-3,e.getY()+3),t=new eS(t.getX()-3,t.getY()-3),r=new eS(r.getX()+3,r.getY()-3),n=new eS(n.getX()+3,n.getY()+3);let i=this.getColor(n,e);if(0===i)return!1;let a=this.getColor(e,t);return a===i&&(a=this.getColor(t,r))===i&&(a=this.getColor(r,n))===i}getColor(e,t){let r=this.distancePoint(e,t),n=(t.getX()-e.getX())/r,i=(t.getY()-e.getY())/r,a=0,o=e.getX(),s=e.getY(),l=this.image.get(e.getX(),e.getY()),u=Math.ceil(r);for(let e=0;e<u;e++)o+=n,s+=i,this.image.get(ep.round(o),ep.round(s))!==l&&a++;let c=a/r;return c>.1&&c<.9?0:c<=.1===l?1:-1}getFirstDifferent(e,t,r,n){let i=e.getX()+r,a=e.getY()+n;for(;this.isValid(i,a)&&this.image.get(i,a)===t;)i+=r,a+=n;for(i-=r,a-=n;this.isValid(i,a)&&this.image.get(i,a)===t;)i+=r;for(i-=r;this.isValid(i,a)&&this.image.get(i,a)===t;)a+=n;return new eS(i,a-=n)}expandSquare(e,t,r){let n=r/(2*t),i=e[0].getX()-e[2].getX(),a=e[0].getY()-e[2].getY(),o=(e[0].getX()+e[2].getX())/2,s=(e[0].getY()+e[2].getY())/2,l=new ev(o+n*i,s+n*a),u=new ev(o-n*i,s-n*a);return i=e[1].getX()-e[3].getX(),a=e[1].getY()-e[3].getY(),[l,new ev((o=(e[1].getX()+e[3].getX())/2)+n*i,(s=(e[1].getY()+e[3].getY())/2)+n*a),u,new ev(o-n*i,s-n*a)]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ep.round(e.getX()),r=ep.round(e.getY());return this.isValid(t,r)}distancePoint(e,t){return ep.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ep.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(F.truncDivision(this.nbLayers-4,8)+1)+15}}class eT{decode(e,t=null){let r=null,n=new eI(e.getBlackMatrix()),i=null,a=null;try{let e=n.detectMirror(!1);i=e.getPoints(),this.reportFoundResultPoints(t,i),a=new eg().decode(e)}catch(e){r=e}if(null==a)try{let e=n.detectMirror(!0);i=e.getPoints(),this.reportFoundResultPoints(t,i),a=new eg().decode(e)}catch(e){if(null!=r)throw r;throw e}let o=new en(a.getText(),a.getRawBytes(),a.getNumBits(),i,ei.AZTEC,P.currentTimeMillis()),s=a.getByteSegments();null!=s&&o.putMetadata(ea.BYTE_SEGMENTS,s);let l=a.getECLevel();return null!=l&&o.putMetadata(ea.ERROR_CORRECTION_LEVEL,l),o}reportFoundResultPoints(e,t){if(null!=e){let r=e.get(U.NEED_RESULT_POINT_CALLBACK);null!=r&&t.forEach((e,t,n)=>{r.foundPossibleResultPoint(e)})}}reset(){}}class ex{decode(e,t){try{return this.doDecode(e,t)}catch(r){if(t&&!0===t.get(U.TRY_HARDER)&&e.isRotateSupported()){let r=e.rotateCounterClockwise(),n=this.doDecode(r,t),i=n.getResultMetadata(),a=270;null!==i&&!0===i.get(ea.ORIENTATION)&&(a+=i.get(ea.ORIENTATION)%360),n.putMetadata(ea.ORIENTATION,a);let o=n.getResultPoints();if(null!==o){let e=r.getHeight();for(let t=0;t<o.length;t++)o[t]=new ev(e-o[t].getY()-1,o[t].getX())}return n}throw new q}}reset(){}doDecode(e,t){let r,n=e.getWidth(),i=e.getHeight(),a=new z(n),o=t&&!0===t.get(U.TRY_HARDER),s=Math.max(1,i>>(o?8:5));r=o?i:15;let l=Math.trunc(i/2);for(let o=0;o<r;o++){let r=Math.trunc((o+1)/2),u=l+s*((1&o)==0?r:-r);if(u<0||u>=i)break;try{a=e.getBlackRow(u,a)}catch(e){continue}for(let e=0;e<2;e++){if(1===e&&(a.reverse(),t&&!0===t.get(U.NEED_RESULT_POINT_CALLBACK))){let e=new Map;t.forEach((t,r)=>e.set(r,t)),e.delete(U.NEED_RESULT_POINT_CALLBACK),t=e}try{let r=this.decodeRow(u,a,t);if(1===e){r.putMetadata(ea.ORIENTATION,180);let e=r.getResultPoints();null!==e&&(e[0]=new ev(n-e[0].getX()-1,e[0].getY()),e[1]=new ev(n-e[1].getX()-1,e[1].getY()))}return r}catch(e){}}}throw new q}static recordPattern(e,t,r){let n=r.length;for(let e=0;e<n;e++)r[e]=0;let i=e.getSize();if(t>=i)throw new q;let a=!e.get(t),o=0,s=t;for(;s<i;){if(e.get(s)!==a)r[o]++;else if(++o===n)break;else r[o]=1,a=!a;s++}if(o!==n&&(o!==n-1||s!==i))throw new q}static recordPatternInReverse(e,t,r){let n=r.length,i=e.get(t);for(;t>0&&n>=0;)e.get(--t)!==i&&(n--,i=!i);if(n>=0)throw new q;ex.recordPattern(e,t+1,r)}static patternMatchVariance(e,t,r){let n=e.length,i=0,a=0;for(let r=0;r<n;r++)i+=e[r],a+=t[r];if(i<a)return 1/0;let o=i/a;r*=o;let s=0;for(let i=0;i<n;i++){let n=e[i],a=t[i]*o,l=n>a?n-a:a-n;if(l>r)return 1/0;s+=l}return s/i}}class eD extends ex{static findStartPattern(e){let t=e.getSize(),r=e.getNextSet(0),n=0,i=Int32Array.from([0,0,0,0,0,0]),a=r,o=!1;for(let s=r;s<t;s++)if(e.get(s)!==o)i[n]++;else{if(5===n){let t=eD.MAX_AVG_VARIANCE,r=-1;for(let e=eD.CODE_START_A;e<=eD.CODE_START_C;e++){let n=ex.patternMatchVariance(i,eD.CODE_PATTERNS[e],eD.MAX_INDIVIDUAL_VARIANCE);n<t&&(t=n,r=e)}if(r>=0&&e.isRange(Math.max(0,a-(s-a)/2),a,!1))return Int32Array.from([a,s,r]);a+=i[0]+i[1],(i=i.slice(2,i.length-1))[n-1]=0,i[n]=0,n--}else n++;i[n]=1,o=!o}throw new q}static decodeCode(e,t,r){ex.recordPattern(e,r,t);let n=eD.MAX_AVG_VARIANCE,i=-1;for(let e=0;e<eD.CODE_PATTERNS.length;e++){let r=eD.CODE_PATTERNS[e],a=this.patternMatchVariance(t,r,eD.MAX_INDIVIDUAL_VARIANCE);a<n&&(n=a,i=e)}if(i>=0)return i;throw new q}decodeRow(e,t,r){let n,i=r&&!0===r.get(U.ASSUME_GS1),a=eD.findStartPattern(t),o=a[2],s=0,l=new Uint8Array(20);switch(l[s++]=o,o){case eD.CODE_START_A:n=eD.CODE_CODE_A;break;case eD.CODE_START_B:n=eD.CODE_CODE_B;break;case eD.CODE_START_C:n=eD.CODE_CODE_C;break;default:throw new V}let u=!1,c=!1,h="",d=a[0],f=a[1],g=Int32Array.from([0,0,0,0,0,0]),p=0,v=0,y=o,w=0,E=!0,b=!1,A=!1;for(;!u;){let e=c;switch(c=!1,p=v,v=eD.decodeCode(t,g,f),l[s++]=v,v!==eD.CODE_STOP&&(E=!0),v!==eD.CODE_STOP&&(y+=++w*v),d=f,f+=g.reduce((e,t)=>e+t,0),v){case eD.CODE_START_A:case eD.CODE_START_B:case eD.CODE_START_C:throw new V}switch(n){case eD.CODE_CODE_A:if(v<64)A===b?h+=String.fromCharCode(32+v):h+=String.fromCharCode(32+v+128),A=!1;else if(v<96)A===b?h+=String.fromCharCode(v-64):h+=String.fromCharCode(v+64),A=!1;else switch(v!==eD.CODE_STOP&&(E=!1),v){case eD.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eD.CODE_FNC_2:case eD.CODE_FNC_3:break;case eD.CODE_FNC_4_A:!b&&A?(b=!0,A=!1):b&&A?(b=!1,A=!1):A=!0;break;case eD.CODE_SHIFT:c=!0,n=eD.CODE_CODE_B;break;case eD.CODE_CODE_B:n=eD.CODE_CODE_B;break;case eD.CODE_CODE_C:n=eD.CODE_CODE_C;break;case eD.CODE_STOP:u=!0}break;case eD.CODE_CODE_B:if(v<96)A===b?h+=String.fromCharCode(32+v):h+=String.fromCharCode(32+v+128),A=!1;else switch(v!==eD.CODE_STOP&&(E=!1),v){case eD.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eD.CODE_FNC_2:case eD.CODE_FNC_3:break;case eD.CODE_FNC_4_B:!b&&A?(b=!0,A=!1):b&&A?(b=!1,A=!1):A=!0;break;case eD.CODE_SHIFT:c=!0,n=eD.CODE_CODE_A;break;case eD.CODE_CODE_A:n=eD.CODE_CODE_A;break;case eD.CODE_CODE_C:n=eD.CODE_CODE_C;break;case eD.CODE_STOP:u=!0}break;case eD.CODE_CODE_C:if(v<100)v<10&&(h+="0"),h+=v;else switch(v!==eD.CODE_STOP&&(E=!1),v){case eD.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eD.CODE_CODE_A:n=eD.CODE_CODE_A;break;case eD.CODE_CODE_B:n=eD.CODE_CODE_B;break;case eD.CODE_STOP:u=!0}}e&&(n=n===eD.CODE_CODE_A?eD.CODE_CODE_B:eD.CODE_CODE_A)}let C=f-d;if(f=t.getNextUnset(f),!t.isRange(f,Math.min(t.getSize(),f+(f-d)/2),!1))throw new q;if((y-=w*p)%103!==p)throw new R;let _=h.length;if(0===_)throw new q;_>0&&E&&(h=n===eD.CODE_CODE_C?h.substring(0,_-2):h.substring(0,_-1));let S=(a[1]+a[0])/2,I=d+C/2,T=l.length,x=new Uint8Array(T);for(let e=0;e<T;e++)x[e]=l[e];return new en(h,x,0,[new ev(S,e),new ev(I,e)],ei.CODE_128,new Date().getTime())}}eD.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],eD.MAX_AVG_VARIANCE=.25,eD.MAX_INDIVIDUAL_VARIANCE=.7,eD.CODE_SHIFT=98,eD.CODE_CODE_C=99,eD.CODE_CODE_B=100,eD.CODE_CODE_A=101,eD.CODE_FNC_1=102,eD.CODE_FNC_2=97,eD.CODE_FNC_3=96,eD.CODE_FNC_4_A=101,eD.CODE_FNC_4_B=100,eD.CODE_START_A=103,eD.CODE_START_B=104,eD.CODE_START_C=105,eD.CODE_STOP=106;class eN extends ex{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,r){let n,i,a,o=this.counters;o.fill(0),this.decodeRowResult="";let s=eN.findAsteriskPattern(t,o),l=t.getNextSet(s[1]),u=t.getSize();do{eN.recordPattern(t,l,o);let e=eN.toNarrowWidePattern(o);if(e<0)throw new q;for(let t of(n=eN.patternToChar(e),this.decodeRowResult+=n,i=l,o))l+=t;l=t.getNextSet(l)}while("*"!==n);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let c=0;for(let e of o)c+=e;let h=l-i-c;if(l!==u&&2*h<c)throw new q;if(this.usingCheckDigit){let e=this.decodeRowResult.length-1,t=0;for(let r=0;r<e;r++)t+=eN.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(r));if(this.decodeRowResult.charAt(e)!==eN.ALPHABET_STRING.charAt(t%43))throw new R;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new q;a=this.extendedMode?eN.decodeExtended(this.decodeRowResult):this.decodeRowResult;let d=(s[1]+s[0])/2,f=i+c/2;return new en(a,null,0,[new ev(d,e),new ev(f,e)],ei.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let r=e.getSize(),n=e.getNextSet(0),i=0,a=n,o=!1,s=t.length;for(let l=n;l<r;l++)if(e.get(l)!==o)t[i]++;else{if(i===s-1){if(this.toNarrowWidePattern(t)===eN.ASTERISK_ENCODING&&e.isRange(Math.max(0,a-Math.floor((l-a)/2)),a,!1))return[a,l];a+=t[0]+t[1],t.copyWithin(0,2,2+i-1),t[i-1]=0,t[i]=0,i--}else i++;t[i]=1,o=!o}throw new q}static toNarrowWidePattern(e){let t,r=e.length,n=0;do{let i=0x7fffffff;for(let t of e)t<i&&t>n&&(i=t);n=i,t=0;let a=0,o=0;for(let i=0;i<r;i++){let s=e[i];s>n&&(o|=1<<r-1-i,t++,a+=s)}if(3===t){for(let i=0;i<r&&t>0;i++){let r=e[i];if(r>n&&(t--,2*r>=a))return -1}return o}}while(t>3);return -1}static patternToChar(e){for(let t=0;t<eN.CHARACTER_ENCODINGS.length;t++)if(eN.CHARACTER_ENCODINGS[t]===e)return eN.ALPHABET_STRING.charAt(t);if(e===eN.ASTERISK_ENCODING)return"*";throw new q}static decodeExtended(e){let t=e.length,r="";for(let n=0;n<t;n++){let t=e.charAt(n);if("+"===t||"$"===t||"%"===t||"/"===t){let i=e.charAt(n+1),a="\0";switch(t){case"+":if(i>="A"&&i<="Z")a=String.fromCharCode(i.charCodeAt(0)+32);else throw new V;break;case"$":if(i>="A"&&i<="Z")a=String.fromCharCode(i.charCodeAt(0)-64);else throw new V;break;case"%":if(i>="A"&&i<="E")a=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")a=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")a=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")a=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)a="\0";else if("V"===i)a="@";else if("W"===i)a="`";else if("X"===i||"Y"===i||"Z"===i)a="";else throw new V;break;case"/":if(i>="A"&&i<="O")a=String.fromCharCode(i.charCodeAt(0)-32);else if("Z"===i)a=":";else throw new V}r+=a,n++}else r+=t}return r}}eN.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",eN.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],eN.ASTERISK_ENCODING=148;class eM extends ex{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,r){let n=this.decodeStart(t),i=this.decodeEnd(t),a=new G;eM.decodeMiddle(t,n[1],i[0],a);let o=a.toString(),s=null;null!=r&&(s=r.get(U.ALLOWED_LENGTHS)),null==s&&(s=eM.DEFAULT_ALLOWED_LENGTHS);let l=o.length,u=!1,c=0;for(let e of s){if(l===e){u=!0;break}e>c&&(c=e)}if(!u&&l>c&&(u=!0),!u)throw new V;return new en(o,null,0,[new ev(n[1],e),new ev(i[0],e)],ei.ITF,new Date().getTime())}static decodeMiddle(e,t,r,n){let i=new Int32Array(10),a=new Int32Array(5),o=new Int32Array(5);for(i.fill(0),a.fill(0),o.fill(0);t<r;){ex.recordPattern(e,t,i);for(let e=0;e<5;e++){let t=2*e;a[e]=i[t],o[e]=i[t+1]}let r=eM.decodeDigit(a);n.append(r.toString()),r=this.decodeDigit(o),n.append(r.toString()),i.forEach(function(e){t+=e})}}decodeStart(e){let t=eM.skipWhiteSpace(e),r=eM.findGuardPattern(e,t,eM.START_PATTERN);return this.narrowLineWidth=(r[1]-r[0])/4,this.validateQuietZone(e,r[0]),r}validateQuietZone(e,t){let r=10*this.narrowLineWidth;r=r<t?r:t;for(let n=t-1;r>0&&n>=0&&!e.get(n);n--)r--;if(0!==r)throw new q}static skipWhiteSpace(e){let t=e.getSize(),r=e.getNextSet(0);if(r===t)throw new q;return r}decodeEnd(e){e.reverse();try{let t,r=eM.skipWhiteSpace(e);try{t=eM.findGuardPattern(e,r,eM.END_PATTERN_REVERSED[0])}catch(n){n instanceof q&&(t=eM.findGuardPattern(e,r,eM.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,t[0]);let n=t[0];return t[0]=e.getSize()-t[1],t[1]=e.getSize()-n,t}finally{e.reverse()}}static findGuardPattern(e,t,r){let n=r.length,i=new Int32Array(n),a=e.getSize(),o=!1,s=0,l=t;i.fill(0);for(let u=t;u<a;u++)if(e.get(u)!==o)i[s]++;else{if(s===n-1){if(ex.patternMatchVariance(i,r,eM.MAX_INDIVIDUAL_VARIANCE)<eM.MAX_AVG_VARIANCE)return[l,u];l+=i[0]+i[1],P.arraycopy(i,2,i,0,s-1),i[s-1]=0,i[s]=0,s--}else s++;i[s]=1,o=!o}throw new q}static decodeDigit(e){let t=eM.MAX_AVG_VARIANCE,r=-1,n=eM.PATTERNS.length;for(let i=0;i<n;i++){let n=eM.PATTERNS[i],a=ex.patternMatchVariance(e,n,eM.MAX_INDIVIDUAL_VARIANCE);a<t?(t=a,r=i):a===t&&(r=-1)}if(r>=0)return r%10;throw new q}}eM.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],eM.MAX_AVG_VARIANCE=.38,eM.MAX_INDIVIDUAL_VARIANCE=.5,eM.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],eM.START_PATTERN=Int32Array.from([1,1,1,1]),eM.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class eR extends ex{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t,r=!1,n=0,i=Int32Array.from([0,0,0]);for(;!r;){i=Int32Array.from([0,0,0]);let a=(t=eR.findGuardPattern(e,n,!1,this.START_END_PATTERN,i))[0],o=a-((n=t[1])-a);o>=0&&(r=e.isRange(o,a,!1))}return t}static checkChecksum(e){return eR.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let r=parseInt(e.charAt(t-1),10);return eR.getStandardUPCEANChecksum(e.substring(0,t-1))===r}static getStandardUPCEANChecksum(e){let t=e.length,r=0;for(let n=t-1;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new V;r+=t}r*=3;for(let n=t-2;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new V;r+=t}return(1e3-r)%10}static decodeEnd(e,t){return eR.findGuardPattern(e,t,!1,eR.START_END_PATTERN,new Int32Array(eR.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,r,n){return this.findGuardPattern(e,t,r,n,new Int32Array(n.length))}static findGuardPattern(e,t,r,n,i){let a=e.getSize();t=r?e.getNextUnset(t):e.getNextSet(t);let o=0,s=t,l=n.length,u=r;for(let r=t;r<a;r++)if(e.get(r)!==u)i[o]++;else{if(o===l-1){if(ex.patternMatchVariance(i,n,eR.MAX_INDIVIDUAL_VARIANCE)<eR.MAX_AVG_VARIANCE)return Int32Array.from([s,r]);s+=i[0]+i[1];let e=i.slice(2,i.length-1);for(let t=0;t<o-1;t++)i[t]=e[t];i[o-1]=0,i[o]=0,o--}else o++;i[o]=1,u=!u}throw new q}static decodeDigit(e,t,r,n){this.recordPattern(e,r,t);let i=this.MAX_AVG_VARIANCE,a=-1,o=n.length;for(let e=0;e<o;e++){let r=n[e],o=ex.patternMatchVariance(t,r,eR.MAX_INDIVIDUAL_VARIANCE);o<i&&(i=o,a=e)}if(a>=0)return a;throw new q}}eR.MAX_AVG_VARIANCE=.48,eR.MAX_INDIVIDUAL_VARIANCE=.7,eR.START_END_PATTERN=Int32Array.from([1,1,1]),eR.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),eR.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),eR.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class eO{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(t,r,n),a=n.toString(),o=eO.parseExtensionString(a),s=new en(a,null,0,[new ev((r[0]+r[1])/2,e),new ev(i,e)],ei.UPC_EAN_EXTENSION,new Date().getTime());return null!=o&&s.putAllMetadata(o),s}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1],o=0;for(let t=0;t<5&&a<i;t++){let i=eR.decodeDigit(e,n,a,eR.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))a+=e;i>=10&&(o|=1<<4-t),4!==t&&(a=e.getNextSet(a),a=e.getNextUnset(a))}if(5!==r.length)throw new q;let s=this.determineCheckDigit(o);if(eO.extensionChecksum(r.toString())!==s)throw new q;return a}static extensionChecksum(e){let t=e.length,r=0;for(let n=t-2;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-48;r*=3;for(let n=t-1;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-48;return(r*=3)%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new q}static parseExtensionString(e){if(5!==e.length)return null;let t=eO.parseExtension5String(e);return null==t?null:new Map([[ea.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="\xa3";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t=""}let r=parseInt(e.substring(1)),n=(r/100).toString(),i=r%100;return t+n+"."+(i<10?"0"+i:i.toString())}}class eP{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(t,r,n),a=n.toString(),o=eP.parseExtensionString(a),s=new en(a,null,0,[new ev((r[0]+r[1])/2,e),new ev(i,e)],ei.UPC_EAN_EXTENSION,new Date().getTime());return null!=o&&s.putAllMetadata(o),s}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1],o=0;for(let t=0;t<2&&a<i;t++){let i=eR.decodeDigit(e,n,a,eR.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))a+=e;i>=10&&(o|=1<<1-t),1!==t&&(a=e.getNextSet(a),a=e.getNextUnset(a))}if(2!==r.length||parseInt(r.toString())%4!==o)throw new q;return a}static parseExtensionString(e){return 2!==e.length?null:new Map([[ea.ISSUE_NUMBER,parseInt(e)]])}}class eB{static decodeRow(e,t,r){let n=eR.findGuardPattern(t,r,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new eO().decodeRow(e,t,n)}catch(r){return new eP().decodeRow(e,t,n)}}}eB.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class eL extends eR{constructor(){super(),this.decodeRowStringBuffer="",eL.L_AND_G_PATTERNS=eL.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=eL.L_PATTERNS[e-10],r=new Int32Array(t.length);for(let e=0;e<t.length;e++)r[e]=t[t.length-e-1];eL.L_AND_G_PATTERNS[e]=r}}decodeRow(e,t,r){let n=eL.findStartGuardPattern(t),i=null==r?null:r.get(U.NEED_RESULT_POINT_CALLBACK);if(null!=i){let t=new ev((n[0]+n[1])/2,e);i.foundPossibleResultPoint(t)}let a=this.decodeMiddle(t,n,this.decodeRowStringBuffer),o=a.rowOffset,s=a.resultString;if(null!=i){let t=new ev(o,e);i.foundPossibleResultPoint(t)}let l=this.decodeEnd(t,o);if(null!=i){let t=new ev((l[0]+l[1])/2,e);i.foundPossibleResultPoint(t)}let u=l[1],c=u+(u-l[0]);if(c>=t.getSize()||!t.isRange(u,c,!1))throw new q;let h=s.toString();if(h.length<8)throw new V;if(!eL.checkChecksum(h))throw new R;let d=(n[1]+n[0])/2,f=(l[1]+l[0])/2,g=this.getBarcodeFormat(),p=new en(h,null,0,[new ev(d,e),new ev(f,e)],g,new Date().getTime()),v=0;try{let r=eB.decodeRow(e,t,l[1]);p.putMetadata(ea.UPC_EAN_EXTENSION,r.getText()),p.putAllMetadata(r.getResultMetadata()),p.addResultPoints(r.getResultPoints()),v=r.getText().length}catch(e){}let y=null==r?null:r.get(U.ALLOWED_EAN_EXTENSIONS);if(null!=y){let e=!1;for(let t in y)if(v.toString()===t){e=!0;break}if(!e)throw new q}return p}decodeEnd(e,t){return eL.findGuardPattern(e,t,!1,eL.START_END_PATTERN,new Int32Array(eL.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return eL.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let r=parseInt(e.charAt(t-1),10);return eL.getStandardUPCEANChecksum(e.substring(0,t-1))===r}static getStandardUPCEANChecksum(e){let t=e.length,r=0;for(let n=t-1;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new V;r+=t}r*=3;for(let n=t-2;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new V;r+=t}return(1e3-r)%10}}class ek extends eL{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1],o=0;for(let t=0;t<6&&a<i;t++){let i=eL.decodeDigit(e,n,a,eL.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))a+=e;i>=10&&(o|=1<<5-t)}r=ek.determineFirstDigit(r,o),a=eL.findGuardPattern(e,a,!0,eL.MIDDLE_PATTERN,new Int32Array(eL.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<6&&a<i;t++){let t=eL.decodeDigit(e,n,a,eL.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))a+=e}return{rowOffset:a,resultString:r}}getBarcodeFormat(){return ei.EAN_13}static determineFirstDigit(e,t){for(let r=0;r<10;r++)if(t===this.FIRST_DIGIT_ENCODINGS[r])return e=String.fromCharCode(48+r)+e;throw new q}}ek.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class eF extends eL{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1];for(let t=0;t<4&&a<i;t++){let t=eL.decodeDigit(e,n,a,eL.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))a+=e}a=eL.findGuardPattern(e,a,!0,eL.MIDDLE_PATTERN,new Int32Array(eL.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<4&&a<i;t++){let t=eL.decodeDigit(e,n,a,eL.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))a+=e}return{rowOffset:a,resultString:r}}getBarcodeFormat(){return ei.EAN_8}}class ez extends eL{constructor(){super(...arguments),this.ean13Reader=new ek}getBarcodeFormat(){return ei.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,r){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,r))}decodeMiddle(e,t,r){return this.ean13Reader.decodeMiddle(e,t,r)}maybeReturnResult(e){let t=e.getText();if("0"===t.charAt(0)){let r=new en(t.substring(1),null,null,e.getResultPoints(),ei.UPC_A);return null!=e.getResultMetadata()&&r.putAllMetadata(e.getResultMetadata()),r}throw new q}reset(){this.ean13Reader.reset()}}class eU extends eL{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters.map(e=>e);n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1],o=0;for(let t=0;t<6&&a<i;t++){let i=eU.decodeDigit(e,n,a,eU.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))a+=e;i>=10&&(o|=1<<5-t)}return{rowOffset:a,resultString:eU.determineNumSysAndCheckDigit(r,o)}}decodeEnd(e,t){return eU.findGuardPatternWithoutCounters(e,t,!0,eU.MIDDLE_END_PATTERN)}checkChecksum(e){return eL.checkChecksum(eU.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let r=0;r<=1;r++)for(let n=0;n<10;n++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[r][n])return String.fromCharCode(48+r)+e+String.fromCharCode(48+n);throw q.getNotFoundInstance()}getBarcodeFormat(){return ei.UPC_E}static convertUPCEtoUPCA(e){let t=e.slice(1,7).split("").map(e=>e.charCodeAt(0)),r=new G;r.append(e.charAt(0));let n=t[5];switch(n){case 0:case 1:case 2:r.appendChars(t,0,2),r.append(n),r.append("0000"),r.appendChars(t,2,3);break;case 3:r.appendChars(t,0,3),r.append("00000"),r.appendChars(t,3,2);break;case 4:r.appendChars(t,0,4),r.append("00000"),r.append(t[4]);break;default:r.appendChars(t,0,5),r.append("0000"),r.append(n)}return e.length>=8&&r.append(e.charAt(7)),r.toString()}}eU.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),eU.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class eV extends ex{constructor(e){super();let t=null==e?null:e.get(U.POSSIBLE_FORMATS),r=[];null==t?(r.push(new ek),r.push(new ez),r.push(new eF),r.push(new eU)):(t.indexOf(ei.EAN_13)>-1&&r.push(new ek),t.indexOf(ei.UPC_A)>-1&&r.push(new ez),t.indexOf(ei.EAN_8)>-1&&r.push(new eF),t.indexOf(ei.UPC_E)>-1&&r.push(new eU)),this.readers=r}decodeRow(e,t,r){for(let n of this.readers)try{let i=n.decodeRow(e,t,r),a=i.getBarcodeFormat()===ei.EAN_13&&"0"===i.getText().charAt(0),o=null==r?null:r.get(U.POSSIBLE_FORMATS),s=null==o||o.includes(ei.UPC_A);if(a&&s){let e=i.getRawBytes(),t=new en(i.getText().substring(1),e,e?e.length:null,i.getResultPoints(),ei.UPC_A);return t.putAllMetadata(i.getResultMetadata()),t}return i}catch(e){}throw new q}reset(){for(let e of this.readers)e.reset()}}class eH extends ex{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=[,,,,],this.evenRoundingErrors=[,,,,],this.oddCounts=Array(this.dataCharacterCounters.length/2),this.evenCounts=Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let r=0;r<t.length;r++)if(ex.patternMatchVariance(e,t[r],eH.MAX_INDIVIDUAL_VARIANCE)<eH.MAX_AVG_VARIANCE)return r;throw new q}static count(e){return ep.sum(new Int32Array(e))}static increment(e,t){let r=0,n=t[0];for(let i=1;i<e.length;i++)t[i]>n&&(n=t[i],r=i);e[r]++}static decrement(e,t){let r=0,n=t[0];for(let i=1;i<e.length;i++)t[i]<n&&(n=t[i],r=i);e[r]--}static isFinderPattern(e){let t=e[0]+e[1],r=t+e[2]+e[3],n=t/r;if(n>=eH.MIN_FINDER_PATTERN_RATIO&&n<=eH.MAX_FINDER_PATTERN_RATIO){let t=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;for(let n of e)n>r&&(r=n),n<t&&(t=n);return r<10*t}return!1}}eH.MAX_AVG_VARIANCE=.2,eH.MAX_INDIVIDUAL_VARIANCE=.45,eH.MIN_FINDER_PATTERN_RATIO=9.5/12,eH.MAX_FINDER_PATTERN_RATIO=12.5/14;class ej{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){return e instanceof ej&&this.value===e.value&&this.checksumPortion===e.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class eY{constructor(e,t,r,n,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=[],this.resultPoints.push(new ev(r,i)),this.resultPoints.push(new ev(n,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){return e instanceof eY&&this.value===e.value}hashCode(){return this.value}}class eX{static getRSSvalue(e,t,r){let n=0;for(let t of e)n+=t;let i=0,a=0,o=e.length;for(let s=0;s<o-1;s++){let l;for(l=1,a|=1<<s;l<e[s];l++,a&=~(1<<s)){let e=eX.combins(n-l-1,o-s-2);if(r&&0===a&&n-l-(o-s-1)>=o-s-1&&(e-=eX.combins(n-l-(o-s),o-s-2)),o-s-1>1){let r=0;for(let e=n-l-(o-s-2);e>t;e--)r+=eX.combins(n-l-e-1,o-s-3);e-=r*(o-1-s)}else n-l>t&&e--;i+=e}n-=l}return i}static combins(e,t){let r,n;e-t>t?(n=t,r=e-t):(n=e-t,r=t);let i=1,a=1;for(let t=e;t>r;t--)i*=t,a<=n&&(i/=a,a++);for(;a<=n;)i/=a,a++;return i}}class eG{static buildBitArray(e){let t=2*e.length-1;null==e[e.length-1].getRightChar()&&(t-=1);let r=new z(12*t),n=0,i=e[0].getRightChar().getValue();for(let e=11;e>=0;--e)(i&1<<e)!=0&&r.set(n),n++;for(let t=1;t<e.length;++t){let i=e[t],a=i.getLeftChar().getValue();for(let e=11;e>=0;--e)(a&1<<e)!=0&&r.set(n),n++;if(null!=i.getRightChar()){let e=i.getRightChar().getValue();for(let t=11;t>=0;--t)(e&1<<t)!=0&&r.set(n),n++}}return r}}class eW{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class eq{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class eZ extends eq{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===eZ.FNC1}}eZ.FNC1="$";class eQ extends eq{constructor(e,t,r){super(e),r?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class eK extends eq{constructor(e,t,r){if(super(e),t<0||t>10||r<0||r>10)throw new V;this.firstDigit=t,this.secondDigit=r}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===eK.FNC1}isSecondDigitFNC1(){return this.secondDigit===eK.FNC1}isAnyFNC1(){return this.firstDigit===eK.FNC1||this.secondDigit===eK.FNC1}}eK.FNC1=10;class e${static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new q;let t=e.substring(0,2);for(let r of e$.TWO_DIGIT_DATA_LENGTH)if(r[0]===t){if(r[1]===e$.VARIABLE_LENGTH)return e$.processVariableAI(2,r[2],e);return e$.processFixedAI(2,r[1],e)}if(e.length<3)throw new q;let r=e.substring(0,3);for(let t of e$.THREE_DIGIT_DATA_LENGTH)if(t[0]===r){if(t[1]===e$.VARIABLE_LENGTH)return e$.processVariableAI(3,t[2],e);return e$.processFixedAI(3,t[1],e)}for(let t of e$.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===r){if(t[1]===e$.VARIABLE_LENGTH)return e$.processVariableAI(4,t[2],e);return e$.processFixedAI(4,t[1],e)}if(e.length<4)throw new q;let n=e.substring(0,4);for(let t of e$.FOUR_DIGIT_DATA_LENGTH)if(t[0]===n){if(t[1]===e$.VARIABLE_LENGTH)return e$.processVariableAI(4,t[2],e);return e$.processFixedAI(4,t[1],e)}throw new q}static processFixedAI(e,t,r){if(r.length<e)throw new q;let n=r.substring(0,e);if(r.length<e+t)throw new q;let i=r.substring(e,e+t),a=r.substring(e+t),o="("+n+")"+i,s=e$.parseFieldsInGeneralPurpose(a);return null==s?o:o+s}static processVariableAI(e,t,r){let n,i=r.substring(0,e);n=r.length<e+t?r.length:e+t;let a=r.substring(e,n),o=r.substring(n),s="("+i+")"+a,l=e$.parseFieldsInGeneralPurpose(o);return null==l?s:s+l}}e$.VARIABLE_LENGTH=[],e$.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",e$.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",e$.VARIABLE_LENGTH,20],["22",e$.VARIABLE_LENGTH,29],["30",e$.VARIABLE_LENGTH,8],["37",e$.VARIABLE_LENGTH,8],["90",e$.VARIABLE_LENGTH,30],["91",e$.VARIABLE_LENGTH,30],["92",e$.VARIABLE_LENGTH,30],["93",e$.VARIABLE_LENGTH,30],["94",e$.VARIABLE_LENGTH,30],["95",e$.VARIABLE_LENGTH,30],["96",e$.VARIABLE_LENGTH,30],["97",e$.VARIABLE_LENGTH,3],["98",e$.VARIABLE_LENGTH,30],["99",e$.VARIABLE_LENGTH,30]],e$.THREE_DIGIT_DATA_LENGTH=[["240",e$.VARIABLE_LENGTH,30],["241",e$.VARIABLE_LENGTH,30],["242",e$.VARIABLE_LENGTH,6],["250",e$.VARIABLE_LENGTH,30],["251",e$.VARIABLE_LENGTH,30],["253",e$.VARIABLE_LENGTH,17],["254",e$.VARIABLE_LENGTH,20],["400",e$.VARIABLE_LENGTH,30],["401",e$.VARIABLE_LENGTH,30],["402",17],["403",e$.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",e$.VARIABLE_LENGTH,20],["421",e$.VARIABLE_LENGTH,15],["422",3],["423",e$.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],e$.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",e$.VARIABLE_LENGTH,15],["391",e$.VARIABLE_LENGTH,18],["392",e$.VARIABLE_LENGTH,15],["393",e$.VARIABLE_LENGTH,18],["703",e$.VARIABLE_LENGTH,30]],e$.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",e$.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",e$.VARIABLE_LENGTH,20],["8003",e$.VARIABLE_LENGTH,30],["8004",e$.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",e$.VARIABLE_LENGTH,30],["8008",e$.VARIABLE_LENGTH,12],["8018",18],["8020",e$.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",e$.VARIABLE_LENGTH,70],["8200",e$.VARIABLE_LENGTH,70]];class eJ{constructor(e){this.buffer=new G,this.information=e}decodeAllCodes(e,t){let r=t,n=null;for(;;){let t=this.decodeGeneralPurposeField(r,n),i=e$.parseFieldsInGeneralPurpose(t.getNewString());if(null!=i&&e.append(i),n=t.isRemaining()?""+t.getRemainingValue():null,r===t.getNewPosition())break;r=t.getNewPosition()}return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let t=this.extractNumericValueFromBitArray(e,4);return 0===t?new eK(this.information.getSize(),eK.FNC1,eK.FNC1):new eK(this.information.getSize(),t-1,eK.FNC1)}let t=this.extractNumericValueFromBitArray(e,7);return new eK(e+7,(t-8)/11,(t-8)%11)}extractNumericValueFromBitArray(e,t){return eJ.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,r){let n=0;for(let i=0;i<r;++i)e.get(t+i)&&(n|=1<<r-i-1);return n}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),null!=t&&this.buffer.append(t),this.current.setPosition(e);let r=this.parseBlocks();return null!=r&&r.isRemaining()?new eQ(this.current.getPosition(),this.buffer.toString(),r.getRemainingValue()):new eQ(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let r=this.current.getPosition();if(e=this.current.isAlpha()?(t=this.parseAlphaBlock()).isFinished():this.current.isIsoIec646()?(t=this.parseIsoIec646Block()).isFinished():(t=this.parseNumericBlock()).isFinished(),r===this.current.getPosition()&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1())return new eW(!0,e.isSecondDigitFNC1()?new eQ(this.current.getPosition(),this.buffer.toString()):new eQ(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()));if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1())return new eW(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new eW(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1())return new eW(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new eW(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1())return new eW(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new eW(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,7);if(r>=64&&r<116)return!0;if(e+8>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,8);return n>=232&&n<253}decodeIsoIec646(e){let t,r=this.extractNumericValueFromBitArray(e,5);if(15===r)return new eZ(e+5,eZ.FNC1);if(r>=5&&r<15)return new eZ(e+5,"0"+(r-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new eZ(e+7,""+(n+1));if(n>=90&&n<116)return new eZ(e+7,""+(n+7));switch(this.extractNumericValueFromBitArray(e,8)){case 232:t="!";break;case 233:t='"';break;case 234:t="%";break;case 235:t="&";break;case 236:t="'";break;case 237:t="(";break;case 238:t=")";break;case 239:t="*";break;case 240:t="+";break;case 241:t=",";break;case 242:t="-";break;case 243:t=".";break;case 244:t="/";break;case 245:t=":";break;case 246:t=";";break;case 247:t="<";break;case 248:t="=";break;case 249:t=">";break;case 250:t="?";break;case 251:t="_";break;case 252:t=" ";break;default:throw new V}return new eZ(e+8,t)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,6);return r>=16&&r<63}decodeAlphanumeric(e){let t,r=this.extractNumericValueFromBitArray(e,5);if(15===r)return new eZ(e+5,eZ.FNC1);if(r>=5&&r<15)return new eZ(e+5,"0"+(r-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new eZ(e+6,""+(n+33));switch(n){case 58:t="*";break;case 59:t=",";break;case 60:t="-";break;case 61:t=".";break;case 62:t="/";break;default:throw new ed("Decoding invalid alphanumeric value: "+n)}return new eZ(e+6,t)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(2===t){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class e1{constructor(e){this.information=e,this.generalDecoder=new eJ(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class e0 extends e1{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let r=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,r)}encodeCompressedGtinWithoutAI(e,t,r){for(let r=0;r<4;++r){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*r,10);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n)}e0.appendCheckDigit(e,r)}static appendCheckDigit(e,t){let r=0;for(let n=0;n<13;n++){let i=e.charAt(n+t).charCodeAt(0)-48;r+=(1&n)==0?3*i:i}10==(r=10-r%10)&&(r=0),e.append(r)}}e0.GTIN_SIZE=40;class e2 extends e0{constructor(e){super(e)}parseInformation(){let e=new G;e.append("(01)");let t=e.length(),r=this.getGeneralDecoder().extractNumericValueFromBitArray(e2.HEADER_SIZE,4);return e.append(r),this.encodeCompressedGtinWithoutAI(e,e2.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,e2.HEADER_SIZE+44)}}e2.HEADER_SIZE=4;class e3 extends e1{constructor(e){super(e)}parseInformation(){let e=new G;return this.getGeneralDecoder().decodeAllCodes(e,e3.HEADER_SIZE)}}e3.HEADER_SIZE=5;class e4 extends e0{constructor(e){super(e)}encodeCompressedWeight(e,t,r){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,r);this.addWeightCode(e,n);let i=this.checkWeight(n),a=1e5;for(let t=0;t<5;++t)i/a==0&&e.append("0"),a/=10;e.append(i)}}class e8 extends e4{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=e8.HEADER_SIZE+e4.GTIN_SIZE+e8.WEIGHT_SIZE)throw new q;let e=new G;return this.encodeCompressedGtin(e,e8.HEADER_SIZE),this.encodeCompressedWeight(e,e8.HEADER_SIZE+e4.GTIN_SIZE,e8.WEIGHT_SIZE),e.toString()}}e8.HEADER_SIZE=5,e8.WEIGHT_SIZE=15;class e6 extends e8{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class e5 extends e8{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class e7 extends e0{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<e7.HEADER_SIZE+e0.GTIN_SIZE)throw new q;let e=new G;this.encodeCompressedGtin(e,e7.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(e7.HEADER_SIZE+e0.GTIN_SIZE,e7.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let r=this.getGeneralDecoder().decodeGeneralPurposeField(e7.HEADER_SIZE+e0.GTIN_SIZE+e7.LAST_DIGIT_SIZE,null);return e.append(r.getNewString()),e.toString()}}e7.HEADER_SIZE=8,e7.LAST_DIGIT_SIZE=2;class e9 extends e0{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<e9.HEADER_SIZE+e0.GTIN_SIZE)throw new q;let e=new G;this.encodeCompressedGtin(e,e9.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(e9.HEADER_SIZE+e0.GTIN_SIZE,e9.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let r=this.getGeneralDecoder().extractNumericValueFromBitArray(e9.HEADER_SIZE+e0.GTIN_SIZE+e9.LAST_DIGIT_SIZE,e9.FIRST_THREE_DIGITS_SIZE);r/100==0&&e.append("0"),r/10==0&&e.append("0"),e.append(r);let n=this.getGeneralDecoder().decodeGeneralPurposeField(e9.HEADER_SIZE+e0.GTIN_SIZE+e9.LAST_DIGIT_SIZE+e9.FIRST_THREE_DIGITS_SIZE,null);return e.append(n.getNewString()),e.toString()}}e9.HEADER_SIZE=8,e9.LAST_DIGIT_SIZE=2,e9.FIRST_THREE_DIGITS_SIZE=10;class te extends e4{constructor(e,t,r){super(e),this.dateCode=r,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=te.HEADER_SIZE+te.GTIN_SIZE+te.WEIGHT_SIZE+te.DATE_SIZE)throw new q;let e=new G;return this.encodeCompressedGtin(e,te.HEADER_SIZE),this.encodeCompressedWeight(e,te.HEADER_SIZE+te.GTIN_SIZE,te.WEIGHT_SIZE),this.encodeCompressedDate(e,te.HEADER_SIZE+te.GTIN_SIZE+te.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,te.DATE_SIZE);if(38400==r)return;e.append("("),e.append(this.dateCode),e.append(")");let n=r%32,i=(r/=32)%12+1,a=r/=12;a/10==0&&e.append("0"),e.append(a),i/10==0&&e.append("0"),e.append(i),n/10==0&&e.append("0"),e.append(n)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}function tt(e){try{if(e.get(1))return new e2(e);if(!e.get(2))return new e3(e);switch(eJ.extractNumericValueFromBitArray(e,1,4)){case 4:return new e6(e);case 5:return new e5(e)}switch(eJ.extractNumericValueFromBitArray(e,1,5)){case 12:return new e7(e);case 13:return new e9(e)}switch(eJ.extractNumericValueFromBitArray(e,1,7)){case 56:return new te(e,"310","11");case 57:return new te(e,"320","11");case 58:return new te(e,"310","13");case 59:return new te(e,"320","13");case 60:return new te(e,"310","15");case 61:return new te(e,"320","15");case 62:return new te(e,"310","17");case 63:return new te(e,"320","17")}}catch(t){throw console.log(t),new ed("unknown decoder: "+e)}}te.HEADER_SIZE=8,te.WEIGHT_SIZE=20,te.DATE_SIZE=16;class tr{constructor(e,t,r,n){this.leftchar=e,this.rightchar=t,this.finderpattern=r,this.maybeLast=n}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return null==this.rightchar}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(null==this.finderpattern?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof tr&&tr.equalsOrNull(e.leftchar,t.leftchar)&&tr.equalsOrNull(e.rightchar,t.rightchar)&&tr.equalsOrNull(e.finderpattern,t.finderpattern)}static equalsOrNull(e,t){return null===e?null===t:tr.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class tn{constructor(e,t,r){this.pairs=e,this.rowNumber=t,this.wasReversed=r}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof tn&&this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed}checkEqualitity(e,t){let r;if(e&&t)return e.forEach((e,n)=>{t.forEach(t=>{e.getLeftChar().getValue()===t.getLeftChar().getValue()&&e.getRightChar().getValue()===t.getRightChar().getValue()&&e.getFinderPatter().getValue()===t.getFinderPatter().getValue()&&(r=!0)})}),r}}class ti extends eH{constructor(e){super(...arguments),this.pairs=Array(ti.MAX_PAIRS),this.rows=[],this.startEnd=[2],this.verbose=!0===e}decodeRow(e,t,r){this.pairs.length=0,this.startFromEven=!1;try{return ti.constructResult(this.decodeRow2pairs(e,t))}catch(e){this.verbose&&console.log(e)}return this.pairs.length=0,this.startFromEven=!0,ti.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let r,n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(e){if(e instanceof q){if(!this.pairs.length)throw new q;n=!0}}if(this.checkChecksum())return this.pairs;if(r=!!this.rows.length,this.storeRow(e,!1),r){let e=this.checkRowsBoolean(!1);if(null!=e||null!=(e=this.checkRowsBoolean(!0)))return e}throw new q}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows([],0)}catch(e){this.verbose&&console.log(e)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let r=t;r<this.rows.length;r++){let t=this.rows[r];for(let t of(this.pairs.length=0,e))this.pairs.push(t.getPairs());if(this.pairs.push(t.getPairs()),!ti.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let n=Array(e);n.push(t);try{return this.checkRows(n,r+1)}catch(e){this.verbose&&console.log(e)}}throw new q}static isValidSequence(e){for(let t of ti.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let r=!0;for(let n=0;n<e.length;n++)if(e[n].getFinderPattern().getValue()!=t[n]){r=!1;break}if(r)return!0}return!1}storeRow(e,t){let r=0,n=!1,i=!1;for(;r<this.rows.length;){let t=this.rows[r];if(t.getRowNumber()>e){i=t.isEquivalent(this.pairs);break}n=t.isEquivalent(this.pairs),r++}i||n||ti.isPartialRow(this.pairs,this.rows)||(this.rows.push(r,new tn(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let r of t)if(r.getPairs().length!==e.length){for(let t of r.getPairs())for(let r of e)if(tr.equals(t,r))break}}static isPartialRow(e,t){for(let r of t){let t=!0;for(let n of e){let e=!1;for(let t of r.getPairs())if(n.equals(t)){e=!0;break}if(!e){t=!1;break}}if(t)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=tt(eG.buildBitArray(e)).parseInformation(),r=e[0].getFinderPattern().getResultPoints(),n=e[e.length-1].getFinderPattern().getResultPoints();return new en(t,null,null,[r[0],r[1],n[0],n[1]],ei.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),r=e.getRightChar();if(null==r)return!1;let n=r.getChecksumPortion(),i=2;for(let e=1;e<this.pairs.size();++e){let t=this.pairs.get(e);n+=t.getLeftChar().getChecksumPortion(),i++;let r=t.getRightChar();null!=r&&(n+=r.getChecksumPortion(),i++)}return 211*(i-4)+(n%=211)==t.getValue()}static getNextSecondBar(e,t){let r;return e.get(t)?(r=e.getNextUnset(t),r=e.getNextSet(r)):(r=e.getNextSet(t),r=e.getNextUnset(r)),r}retrieveNextPair(e,t,r){let n,i,a=t.length%2==0;this.startFromEven&&(a=!a);let o=!0,s=-1;do this.findNextPair(e,t,s),null==(n=this.parseFoundFinderPattern(e,r,a))?s=ti.getNextSecondBar(e,this.startEnd[0]):o=!1;while(o);let l=this.decodeDataCharacter(e,n,a,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new q;try{i=this.decodeDataCharacter(e,n,a,!1)}catch(e){i=null,this.verbose&&console.log(e)}return new tr(l,i,n,!0)}isEmptyPair(e){return 0===e.length}findNextPair(e,t,r){let n,i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;let a=e.getSize();n=r>=0?r:this.isEmptyPair(t)?0:t[t.length-1].getFinderPattern().getStartEnd()[1];let o=t.length%2!=0;this.startFromEven&&(o=!o);let s=!1;for(;n<a&&(s=!e.get(n));)n++;let l=0,u=n;for(let t=n;t<a;t++)if(e.get(t)!=s)i[l]++;else{if(3==l){if(o&&ti.reverseCounters(i),ti.isFinderPattern(i)){this.startEnd[0]=u,this.startEnd[1]=t;return}o&&ti.reverseCounters(i),u+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,l--}else l++;i[l]=1,s=!s}throw new q}static reverseCounters(e){let t=e.length;for(let r=0;r<t/2;++r){let n=e[r];e[r]=e[t-r-1],e[t-r-1]=n}}parseFoundFinderPattern(e,t,r){let n,i,a,o;if(r){let t=this.startEnd[0]-1;for(;t>=0&&!e.get(t);)t--;t++,n=this.startEnd[0]-t,i=t,a=this.startEnd[1]}else i=this.startEnd[0],n=(a=e.getNextUnset(this.startEnd[1]+1))-this.startEnd[1];let s=this.getDecodeFinderCounters();P.arraycopy(s,0,s,1,s.length-1),s[0]=n;try{o=this.parseFinderValue(s,ti.FINDER_PATTERNS)}catch(e){return null}return new eY(o,[i,a],i,a,t)}decodeDataCharacter(e,t,r,n){let i=this.getDataCharacterCounters();for(let e=0;e<i.length;e++)i[e]=0;if(n)ti.recordPatternInReverse(e,t.getStartEnd()[0],i);else{ti.recordPattern(e,t.getStartEnd()[1],i);for(let e=0,t=i.length-1;e<t;e++,t--){let r=i[e];i[e]=i[t],i[t]=r}}let a=ep.sum(new Int32Array(i))/17,o=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(a-o)/o>.3)throw new q;let s=this.getOddCounts(),l=this.getEvenCounts(),u=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let e=0;e<i.length;e++){let t=i[e]/a,r=t+.5;if(r<1){if(t<.3)throw new q;r=1}else if(r>8){if(t>8.7)throw new q;r=8}let n=e/2;(1&e)==0?(s[n]=r,u[n]=t-r):(l[n]=r,c[n]=t-r)}this.adjustOddEvenCounts(17);let h=4*t.getValue()+2*!r+ +!n-1,d=0,f=0;for(let e=s.length-1;e>=0;e--){if(ti.isNotA1left(t,r,n)){let t=ti.WEIGHTS[h][2*e];f+=s[e]*t}d+=s[e]}let g=0;for(let e=l.length-1;e>=0;e--)if(ti.isNotA1left(t,r,n)){let t=ti.WEIGHTS[h][2*e+1];g+=l[e]*t}let p=f+g;if((1&d)!=0||d>13||d<4)throw new q;let v=(13-d)/2,y=ti.SYMBOL_WIDEST[v],w=eX.getRSSvalue(s,y,!0),E=eX.getRSSvalue(l,9-y,!1);return new ej(w*ti.EVEN_TOTAL_SUBSET[v]+E+ti.GSUM[v],p)}static isNotA1left(e,t,r){return!(0==e.getValue()&&t&&r)}adjustOddEvenCounts(e){let t=ep.sum(new Int32Array(this.getOddCounts())),r=ep.sum(new Int32Array(this.getEvenCounts())),n=!1,i=!1;t>13?i=!0:t<4&&(n=!0);let a=!1,o=!1;r>13?o=!0:r<4&&(a=!0);let s=t+r-e,l=(1&t)==1,u=(1&r)==0;if(1==s)if(l){if(u)throw new q;i=!0}else{if(!u)throw new q;o=!0}else if(-1==s)if(l){if(u)throw new q;n=!0}else{if(!u)throw new q;a=!0}else if(0==s){if(l){if(!u)throw new q;t<r?(n=!0,o=!0):(i=!0,a=!0)}else if(u)throw new q}else throw new q;if(n){if(i)throw new q;ti.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&ti.decrement(this.getOddCounts(),this.getOddRoundingErrors()),a){if(o)throw new q;ti.increment(this.getEvenCounts(),this.getOddRoundingErrors())}o&&ti.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}ti.SYMBOL_WIDEST=[7,5,4,3,1],ti.EVEN_TOTAL_SUBSET=[4,20,52,104,204],ti.GSUM=[0,348,1388,2948,3988],ti.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],ti.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],ti.FINDER_PAT_A=0,ti.FINDER_PAT_B=1,ti.FINDER_PAT_C=2,ti.FINDER_PAT_D=3,ti.FINDER_PAT_E=4,ti.FINDER_PAT_F=5,ti.FINDER_PATTERN_SEQUENCES=[[ti.FINDER_PAT_A,ti.FINDER_PAT_A],[ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B],[ti.FINDER_PAT_A,ti.FINDER_PAT_C,ti.FINDER_PAT_B,ti.FINDER_PAT_D],[ti.FINDER_PAT_A,ti.FINDER_PAT_E,ti.FINDER_PAT_B,ti.FINDER_PAT_D,ti.FINDER_PAT_C],[ti.FINDER_PAT_A,ti.FINDER_PAT_E,ti.FINDER_PAT_B,ti.FINDER_PAT_D,ti.FINDER_PAT_D,ti.FINDER_PAT_F],[ti.FINDER_PAT_A,ti.FINDER_PAT_E,ti.FINDER_PAT_B,ti.FINDER_PAT_D,ti.FINDER_PAT_E,ti.FINDER_PAT_F,ti.FINDER_PAT_F],[ti.FINDER_PAT_A,ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B,ti.FINDER_PAT_C,ti.FINDER_PAT_C,ti.FINDER_PAT_D,ti.FINDER_PAT_D],[ti.FINDER_PAT_A,ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B,ti.FINDER_PAT_C,ti.FINDER_PAT_C,ti.FINDER_PAT_D,ti.FINDER_PAT_E,ti.FINDER_PAT_E],[ti.FINDER_PAT_A,ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B,ti.FINDER_PAT_C,ti.FINDER_PAT_C,ti.FINDER_PAT_D,ti.FINDER_PAT_E,ti.FINDER_PAT_F,ti.FINDER_PAT_F],[ti.FINDER_PAT_A,ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B,ti.FINDER_PAT_C,ti.FINDER_PAT_D,ti.FINDER_PAT_D,ti.FINDER_PAT_E,ti.FINDER_PAT_E,ti.FINDER_PAT_F,ti.FINDER_PAT_F]],ti.MAX_PAIRS=11;class ta extends ej{constructor(e,t,r){super(e,t),this.count=0,this.finderPattern=r}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class to extends eH{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,r){let n=this.decodePair(t,!1,e,r);to.addOrTally(this.possibleLeftPairs,n),t.reverse();let i=this.decodePair(t,!0,e,r);for(let e of(to.addOrTally(this.possibleRightPairs,i),t.reverse(),this.possibleLeftPairs))if(e.getCount()>1){for(let t of this.possibleRightPairs)if(t.getCount()>1&&to.checkChecksum(e,t))return to.constructResult(e,t)}throw new q}static addOrTally(e,t){if(null==t)return;let r=!1;for(let n of e)if(n.getValue()===t.getValue()){n.incrementCount(),r=!0;break}r||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let r=new String(4537077*e.getValue()+t.getValue()).toString(),n=new G;for(let e=13-r.length;e>0;e--)n.append("0");n.append(r);let i=0;for(let e=0;e<13;e++){let t=n.charAt(e).charCodeAt(0)-48;i+=(1&e)==0?3*t:t}10==(i=10-i%10)&&(i=0),n.append(i.toString());let a=e.getFinderPattern().getResultPoints(),o=t.getFinderPattern().getResultPoints();return new en(n.toString(),null,0,[a[0],a[1],o[0],o[1]],ei.RSS_14,new Date().getTime())}static checkChecksum(e,t){let r=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,n=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return n>72&&n--,n>8&&n--,r===n}decodePair(e,t,r,n){try{let i=this.findFinderPattern(e,t),a=this.parseFoundFinderPattern(e,r,t,i),o=null==n?null:n.get(U.NEED_RESULT_POINT_CALLBACK);if(null!=o){let n=(i[0]+i[1])/2;t&&(n=e.getSize()-1-n),o.foundPossibleResultPoint(new ev(n,r))}let s=this.decodeDataCharacter(e,a,!0),l=this.decodeDataCharacter(e,a,!1);return new ta(1597*s.getValue()+l.getValue(),s.getChecksumPortion()+4*l.getChecksumPortion(),a)}catch(e){return null}}decodeDataCharacter(e,t,r){let n=this.getDataCharacterCounters();for(let e=0;e<n.length;e++)n[e]=0;if(r)ex.recordPatternInReverse(e,t.getStartEnd()[0],n);else{ex.recordPattern(e,t.getStartEnd()[1]+1,n);for(let e=0,t=n.length-1;e<t;e++,t--){let r=n[e];n[e]=n[t],n[t]=r}}let i=r?16:15,a=ep.sum(new Int32Array(n))/i,o=this.getOddCounts(),s=this.getEvenCounts(),l=this.getOddRoundingErrors(),u=this.getEvenRoundingErrors();for(let e=0;e<n.length;e++){let t=n[e]/a,r=Math.floor(t+.5);r<1?r=1:r>8&&(r=8);let i=Math.floor(e/2);(1&e)==0?(o[i]=r,l[i]=t-r):(s[i]=r,u[i]=t-r)}this.adjustOddEvenCounts(r,i);let c=0,h=0;for(let e=o.length-1;e>=0;e--)h*=9,h+=o[e],c+=o[e];let d=0,f=0;for(let e=s.length-1;e>=0;e--)d*=9,d+=s[e],f+=s[e];let g=h+3*d;if(r){if((1&c)!=0||c>12||c<4)throw new q;let e=(12-c)/2,t=to.OUTSIDE_ODD_WIDEST[e],r=eX.getRSSvalue(o,t,!1),n=eX.getRSSvalue(s,9-t,!0);return new ej(r*to.OUTSIDE_EVEN_TOTAL_SUBSET[e]+n+to.OUTSIDE_GSUM[e],g)}{if((1&f)!=0||f>10||f<4)throw new q;let e=(10-f)/2,t=to.INSIDE_ODD_WIDEST[e],r=eX.getRSSvalue(o,t,!0);return new ej(eX.getRSSvalue(s,9-t,!1)*to.INSIDE_ODD_TOTAL_SUBSET[e]+r+to.INSIDE_GSUM[e],g)}}findFinderPattern(e,t){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let n=e.getSize(),i=!1,a=0;for(;a<n&&t!==(i=!e.get(a));)a++;let o=0,s=a;for(let t=a;t<n;t++)if(e.get(t)!==i)r[o]++;else{if(3===o){if(eH.isFinderPattern(r))return[s,t];s+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,o--}else o++;r[o]=1,i=!i}throw new q}parseFoundFinderPattern(e,t,r,n){let i=e.get(n[0]),a=n[0]-1;for(;a>=0&&i!==e.get(a);)a--;a++;let o=n[0]-a,s=this.getDecodeFinderCounters(),l=new Int32Array(s.length);P.arraycopy(s,0,l,1,s.length-1),l[0]=o;let u=this.parseFinderValue(l,to.FINDER_PATTERNS),c=a,h=n[1];return r&&(c=e.getSize()-1-c,h=e.getSize()-1-h),new eY(u,[a,n[1]],c,h,t)}adjustOddEvenCounts(e,t){let r=ep.sum(new Int32Array(this.getOddCounts())),n=ep.sum(new Int32Array(this.getEvenCounts())),i=!1,a=!1,o=!1,s=!1;e?(r>12?a=!0:r<4&&(i=!0),n>12?s=!0:n<4&&(o=!0)):(r>11?a=!0:r<5&&(i=!0),n>10?s=!0:n<4&&(o=!0));let l=r+n-t,u=(1&r)==+!!e,c=(1&n)==1;if(1===l)if(u){if(c)throw new q;a=!0}else{if(!c)throw new q;s=!0}else if(-1===l)if(u){if(c)throw new q;i=!0}else{if(!c)throw new q;o=!0}else if(0===l){if(u){if(!c)throw new q;r<n?(i=!0,s=!0):(a=!0,o=!0)}else if(c)throw new q}else throw new q;if(i){if(a)throw new q;eH.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&eH.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(s)throw new q;eH.increment(this.getEvenCounts(),this.getOddRoundingErrors())}s&&eH.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}to.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],to.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],to.OUTSIDE_GSUM=[0,161,961,2015,2715],to.INSIDE_GSUM=[0,336,1036,1516],to.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],to.INSIDE_ODD_WIDEST=[2,4,6,8],to.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class ts extends ex{constructor(e,t){super(),this.readers=[],this.verbose=!0===t;const r=e?e.get(U.POSSIBLE_FORMATS):null,n=e&&void 0!==e.get(U.ASSUME_CODE_39_CHECK_DIGIT);r?((r.includes(ei.EAN_13)||r.includes(ei.UPC_A)||r.includes(ei.EAN_8)||r.includes(ei.UPC_E))&&this.readers.push(new eV(e)),r.includes(ei.CODE_39)&&this.readers.push(new eN(n)),r.includes(ei.CODE_128)&&this.readers.push(new eD),r.includes(ei.ITF)&&this.readers.push(new eM),r.includes(ei.RSS_14)&&this.readers.push(new to),r.includes(ei.RSS_EXPANDED)&&this.readers.push(new ti(this.verbose))):(this.readers.push(new eV(e)),this.readers.push(new eN),this.readers.push(new eV(e)),this.readers.push(new eD),this.readers.push(new eM),this.readers.push(new to),this.readers.push(new ti(this.verbose)))}decodeRow(e,t,r){for(let n=0;n<this.readers.length;n++)try{return this.readers[n].decodeRow(e,t,r)}catch(e){}throw new q}reset(){this.readers.forEach(e=>e.reset())}}class tl{constructor(e,t,r){this.ecCodewords=e,this.ecBlocks=[t],r&&this.ecBlocks.push(r)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class tu{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class tc{constructor(e,t,r,n,i,a){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=r,this.dataRegionSizeRows=n,this.dataRegionSizeColumns=i,this.ecBlocks=a;let o=0;const s=a.getECCodewords();for(let e of a.getECBlocks())o+=e.getCount()*(e.getDataCodewords()+s);this.totalCodewords=o}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if((1&e)!=0||(1&t)!=0)throw new V;for(let r of tc.VERSIONS)if(r.symbolSizeRows===e&&r.symbolSizeColumns===t)return r;throw new V}toString(){return""+this.versionNumber}static buildVersions(){return[new tc(1,10,10,8,8,new tl(5,new tu(1,3))),new tc(2,12,12,10,10,new tl(7,new tu(1,5))),new tc(3,14,14,12,12,new tl(10,new tu(1,8))),new tc(4,16,16,14,14,new tl(12,new tu(1,12))),new tc(5,18,18,16,16,new tl(14,new tu(1,18))),new tc(6,20,20,18,18,new tl(18,new tu(1,22))),new tc(7,22,22,20,20,new tl(20,new tu(1,30))),new tc(8,24,24,22,22,new tl(24,new tu(1,36))),new tc(9,26,26,24,24,new tl(28,new tu(1,44))),new tc(10,32,32,14,14,new tl(36,new tu(1,62))),new tc(11,36,36,16,16,new tl(42,new tu(1,86))),new tc(12,40,40,18,18,new tl(48,new tu(1,114))),new tc(13,44,44,20,20,new tl(56,new tu(1,144))),new tc(14,48,48,22,22,new tl(68,new tu(1,174))),new tc(15,52,52,24,24,new tl(42,new tu(2,102))),new tc(16,64,64,14,14,new tl(56,new tu(2,140))),new tc(17,72,72,16,16,new tl(36,new tu(4,92))),new tc(18,80,80,18,18,new tl(48,new tu(4,114))),new tc(19,88,88,20,20,new tl(56,new tu(4,144))),new tc(20,96,96,22,22,new tl(68,new tu(4,174))),new tc(21,104,104,24,24,new tl(56,new tu(6,136))),new tc(22,120,120,18,18,new tl(68,new tu(6,175))),new tc(23,132,132,20,20,new tl(62,new tu(8,163))),new tc(24,144,144,22,22,new tl(62,new tu(8,156),new tu(2,155))),new tc(25,8,18,6,16,new tl(7,new tu(1,5))),new tc(26,8,32,6,14,new tl(11,new tu(1,10))),new tc(27,12,26,10,24,new tl(14,new tu(1,16))),new tc(28,12,36,10,16,new tl(18,new tu(1,22))),new tc(29,16,36,14,16,new tl(24,new tu(1,32))),new tc(30,16,48,14,22,new tl(28,new tu(1,49)))]}}tc.VERSIONS=tc.buildVersions();class th{constructor(e){const t=e.getHeight();if(t<8||t>144||(1&t)!=0)throw new V;this.version=th.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new W(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){let t=e.getHeight(),r=e.getWidth();return tc.getVersionForDimensions(t,r)}readCodewords(){let e=new Int8Array(this.version.getTotalCodewords()),t=0,r=4,n=0,i=this.mappingBitMatrix.getHeight(),a=this.mappingBitMatrix.getWidth(),o=!1,s=!1,l=!1,u=!1;do if(r!==i||0!==n||o)if(r!==i-2||0!==n||(3&a)==0||s)if(r!==i+4||2!==n||(7&a)!=0||l)if(r!==i-2||0!==n||(7&a)!=4||u){do r<i&&n>=0&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,a)),r-=2,n+=2;while(r>=0&&n<a);r+=1,n+=3;do r>=0&&n<a&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,a)),r+=2,n-=2;while(r<i&&n>=0);r+=3,n+=1}else e[t++]=255&this.readCorner4(i,a),r-=2,n+=2,u=!0;else e[t++]=255&this.readCorner3(i,a),r-=2,n+=2,l=!0;else e[t++]=255&this.readCorner2(i,a),r-=2,n+=2,s=!0;else e[t++]=255&this.readCorner1(i,a),r-=2,n+=2,o=!0;while(r<i||n<a);if(t!==this.version.getTotalCodewords())throw new V;return e}readModule(e,t,r,n){return e<0&&(e+=r,t+=4-(r+4&7)),t<0&&(t+=n,e+=4-(n+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,r,n){let i=0;return this.readModule(e-2,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e-2,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t,r,n)&&(i|=1),i<<=1,this.readModule(e,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e,t,r,n)&&(i|=1),i}readCorner1(e,t){let r=0;return this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,1,e,t)&&(r|=1),r<<=1,this.readModule(e-1,2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(2,t-1,e,t)&&(r|=1),r<<=1,this.readModule(3,t-1,e,t)&&(r|=1),r}readCorner2(e,t){let r=0;return this.readModule(e-3,0,e,t)&&(r|=1),r<<=1,this.readModule(e-2,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(0,t-4,e,t)&&(r|=1),r<<=1,this.readModule(0,t-3,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r}readCorner3(e,t){let r=0;return this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(0,t-3,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-3,e,t)&&(r|=1),r<<=1,this.readModule(1,t-2,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r}readCorner4(e,t){let r=0;return this.readModule(e-3,0,e,t)&&(r|=1),r<<=1,this.readModule(e-2,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(2,t-1,e,t)&&(r|=1),r<<=1,this.readModule(3,t-1,e,t)&&(r|=1),r}extractDataRegion(e){let t=this.version.getSymbolSizeRows(),r=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new N("Dimension of bitMatrix must match the version size");let n=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),a=t/n|0,o=r/i|0,s=new W(o*i,a*n);for(let t=0;t<a;++t){let r=t*n;for(let a=0;a<o;++a){let o=a*i;for(let l=0;l<n;++l){let u=t*(n+2)+1+l,c=r+l;for(let t=0;t<i;++t){let r=a*(i+2)+1+t;if(e.get(r,u)){let e=o+t;s.set(e,c)}}}}}return s}}class td{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){let r=t.getECBlocks(),n=0,i=r.getECBlocks();for(let e of i)n+=e.getCount();let a=Array(n),o=0;for(let e of i)for(let t=0;t<e.getCount();t++){let t=e.getDataCodewords(),n=r.getECCodewords()+t;a[o++]=new td(t,new Uint8Array(n))}let s=a[0].codewords.length-r.getECCodewords(),l=s-1,u=0;for(let t=0;t<l;t++)for(let r=0;r<o;r++)a[r].codewords[t]=e[u++];let c=24===t.getVersionNumber(),h=c?8:o;for(let t=0;t<h;t++)a[t].codewords[s-1]=e[u++];let d=a[0].codewords.length;for(let t=s;t<d;t++)for(let r=0;r<o;r++){let n=c?(r+8)%o:r,i=c&&n>7?t-1:t;a[n].codewords[i]=e[u++]}if(u!==e.length)throw new N;return a}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class tf{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new N(""+e);let t=0,r=this.bitOffset,n=this.byteOffset,i=this.bytes;if(r>0){let a=8-r,o=e<a?e:a,s=a-o;t=(i[n]&255>>8-o<<s)>>s,e-=o,8===(r+=o)&&(r=0,n++)}if(e>0){for(;e>=8;)t=t<<8|255&i[n],n++,e-=8;if(e>0){let a=8-e;t=t<<e|(i[n]&255>>a<<a)>>a,r+=e}}return this.bitOffset=r,this.byteOffset=n,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}(l=E||(E={}))[l.PAD_ENCODE=0]="PAD_ENCODE",l[l.ASCII_ENCODE=1]="ASCII_ENCODE",l[l.C40_ENCODE=2]="C40_ENCODE",l[l.TEXT_ENCODE=3]="TEXT_ENCODE",l[l.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",l[l.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",l[l.BASE256_ENCODE=6]="BASE256_ENCODE";class tg{static decode(e){let t=new tf(e),r=new G,n=new G,i=[],a=E.ASCII_ENCODE;do if(a===E.ASCII_ENCODE)a=this.decodeAsciiSegment(t,r,n);else{switch(a){case E.C40_ENCODE:this.decodeC40Segment(t,r);break;case E.TEXT_ENCODE:this.decodeTextSegment(t,r);break;case E.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,r);break;case E.EDIFACT_ENCODE:this.decodeEdifactSegment(t,r);break;case E.BASE256_ENCODE:this.decodeBase256Segment(t,r,i);break;default:throw new V}a=E.ASCII_ENCODE}while(a!==E.PAD_ENCODE&&t.available()>0);return n.length()>0&&r.append(n.toString()),new eo(e,r.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(e,t,r){let n=!1;do{let i=e.readBits(8);if(0===i)throw new V;if(i<=128){n&&(i+=128),t.append(String.fromCharCode(i-1));break}if(129===i)return E.PAD_ENCODE;else if(i<=229){let e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return E.C40_ENCODE;case 231:return E.BASE256_ENCODE;case 232:t.append("\x1d");break;case 233:case 234:case 241:break;case 235:n=!0;break;case 236:t.append("[)>\x1e05\x1d"),r.insert(0,"\x1e\x04");break;case 237:t.append("[)>\x1e06\x1d"),r.insert(0,"\x1e\x04");break;case 238:return E.ANSIX12_ENCODE;case 239:return E.TEXT_ENCODE;case 240:return E.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new V}}while(e.available()>0);return E.ASCII_ENCODE}static decodeC40Segment(e,t){let r=!1,n=[],i=0;do{if(8===e.available())return;let a=e.readBits(8);if(254===a)return;this.parseTwoBytes(a,e.readBits(8),n);for(let e=0;e<3;e++){let a=n[e];switch(i){case 0:if(a<3)i=a+1;else if(a<this.C40_BASIC_SET_CHARS.length){let e=this.C40_BASIC_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else throw new V;break;case 1:r?(t.append(String.fromCharCode(a+128)),r=!1):t.append(String.fromCharCode(a)),i=0;break;case 2:if(a<this.C40_SHIFT2_SET_CHARS.length){let e=this.C40_SHIFT2_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else switch(a){case 27:t.append("\x1d");break;case 30:r=!0;break;default:throw new V}i=0;break;case 3:r?(t.append(String.fromCharCode(a+224)),r=!1):t.append(String.fromCharCode(a+96)),i=0;break;default:throw new V}}}while(e.available()>0)}static decodeTextSegment(e,t){let r=!1,n=[],i=0;do{if(8===e.available())return;let a=e.readBits(8);if(254===a)return;this.parseTwoBytes(a,e.readBits(8),n);for(let e=0;e<3;e++){let a=n[e];switch(i){case 0:if(a<3)i=a+1;else if(a<this.TEXT_BASIC_SET_CHARS.length){let e=this.TEXT_BASIC_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else throw new V;break;case 1:r?(t.append(String.fromCharCode(a+128)),r=!1):t.append(String.fromCharCode(a)),i=0;break;case 2:if(a<this.TEXT_SHIFT2_SET_CHARS.length){let e=this.TEXT_SHIFT2_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else switch(a){case 27:t.append("\x1d");break;case 30:r=!0;break;default:throw new V}i=0;break;case 3:if(a<this.TEXT_SHIFT3_SET_CHARS.length){let e=this.TEXT_SHIFT3_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e),i=0}else throw new V;break;default:throw new V}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){let r=[];do{if(8===e.available())return;let n=e.readBits(8);if(254===n)return;this.parseTwoBytes(n,e.readBits(8),r);for(let e=0;e<3;e++){let n=r[e];switch(n){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(n<14)t.append(String.fromCharCode(n+44));else if(n<40)t.append(String.fromCharCode(n+51));else throw new V}}}while(e.available()>0)}static parseTwoBytes(e,t,r){let n=(e<<8)+t-1,i=Math.floor(n/1600);r[0]=i,n-=1600*i,i=Math.floor(n/40),r[1]=i,r[2]=n-40*i}static decodeEdifactSegment(e,t){do{if(16>=e.available())return;for(let r=0;r<4;r++){let r=e.readBits(6);if(31===r){let t=8-e.getBitOffset();8!==t&&e.readBits(t);return}(32&r)==0&&(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,r){let n,i=1+e.getByteOffset(),a=this.unrandomize255State(e.readBits(8),i++);if((n=0===a?e.available()/8|0:a<250?a:250*(a-249)+this.unrandomize255State(e.readBits(8),i++))<0)throw new V;let o=new Uint8Array(n);for(let t=0;t<n;t++){if(8>e.available())throw new V;o[t]=this.unrandomize255State(e.readBits(8),i++)}r.push(o);try{t.append(Y.decode(o,X.ISO88591))}catch(e){throw new ed("Platform does not support required encoding: "+e.message)}}static unrandomize255State(e,t){let r=e-(149*t%255+1);return r>=0?r:r+256}}tg.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],tg.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],tg.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],tg.TEXT_SHIFT2_SET_CHARS=tg.C40_SHIFT2_SET_CHARS,tg.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class tp{constructor(){this.rsDecoder=new ef(ec.DATA_MATRIX_FIELD_256)}decode(e){let t=new th(e),r=t.getVersion(),n=t.readCodewords(),i=td.getDataBlocks(n,r),a=0;for(let e of i)a+=e.getNumDataCodewords();let o=new Uint8Array(a),s=i.length;for(let e=0;e<s;e++){let t=i[e],r=t.getCodewords(),n=t.getNumDataCodewords();this.correctErrors(r,n);for(let t=0;t<n;t++)o[t*s+e]=r[t]}return tg.decode(o)}correctErrors(e,t){let r=new Int32Array(e);try{this.rsDecoder.decode(r,e.length-t)}catch(e){throw new R}for(let n=0;n<t;n++)e[n]=r[n]}}class tm{constructor(e){this.image=e,this.rectangleDetector=new eE(this.image)}detect(){let e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if((t=this.detectSolid2(t))[3]=this.correctTopRight(t),!t[3])throw new q;let r=(t=this.shiftToModuleCenter(t))[0],n=t[1],i=t[2],a=t[3],o=this.transitionsBetween(r,a)+1,s=this.transitionsBetween(i,a)+1;return(1&o)==1&&(o+=1),(1&s)==1&&(s+=1),4*o<7*s&&4*s<7*o&&(o=s=Math.max(o,s)),new ey(tm.sampleGrid(this.image,r,n,i,a,o,s),[r,n,i,a])}static shiftPoint(e,t,r){let n=(t.getX()-e.getX())/(r+1),i=(t.getY()-e.getY())/(r+1);return new ev(e.getX()+n,e.getY()+i)}static moveAway(e,t,r){let n=e.getX(),i=e.getY();return n<t?n-=1:n+=1,i<r?i-=1:i+=1,new ev(n,i)}detectSolid1(e){let t=e[0],r=e[1],n=e[3],i=e[2],a=this.transitionsBetween(t,r),o=this.transitionsBetween(r,n),s=this.transitionsBetween(n,i),l=this.transitionsBetween(i,t),u=a,c=[i,t,r,n];return u>o&&(u=o,c[0]=t,c[1]=r,c[2]=n,c[3]=i),u>s&&(u=s,c[0]=r,c[1]=n,c[2]=i,c[3]=t),u>l&&(c[0]=n,c[1]=i,c[2]=t,c[3]=r),c}detectSolid2(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=this.transitionsBetween(t,i),o=tm.shiftPoint(r,n,(a+1)*4),s=tm.shiftPoint(n,r,(a+1)*4);return this.transitionsBetween(o,t)<this.transitionsBetween(s,i)?(e[0]=t,e[1]=r,e[2]=n,e[3]=i):(e[0]=r,e[1]=n,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=this.transitionsBetween(t,i),o=this.transitionsBetween(r,i),s=tm.shiftPoint(t,r,(o+1)*4),l=tm.shiftPoint(n,r,(a+1)*4);a=this.transitionsBetween(s,i),o=this.transitionsBetween(l,i);let u=new ev(i.getX()+(n.getX()-r.getX())/(a+1),i.getY()+(n.getY()-r.getY())/(a+1)),c=new ev(i.getX()+(t.getX()-r.getX())/(o+1),i.getY()+(t.getY()-r.getY())/(o+1));return this.isValid(u)?this.isValid(c)?this.transitionsBetween(s,u)+this.transitionsBetween(l,u)>this.transitionsBetween(s,c)+this.transitionsBetween(l,c)?u:c:u:this.isValid(c)?c:null}shiftToModuleCenter(e){let t,r,n=e[0],i=e[1],a=e[2],o=e[3],s=this.transitionsBetween(n,o)+1,l=this.transitionsBetween(a,o)+1,u=tm.shiftPoint(n,i,4*l),c=tm.shiftPoint(a,i,4*s);s=this.transitionsBetween(u,o)+1,l=this.transitionsBetween(c,o)+1,(1&s)==1&&(s+=1),(1&l)==1&&(l+=1);let h=(n.getX()+i.getX()+a.getX()+o.getX())/4,d=(n.getY()+i.getY()+a.getY()+o.getY())/4;return n=tm.moveAway(n,h,d),i=tm.moveAway(i,h,d),a=tm.moveAway(a,h,d),o=tm.moveAway(o,h,d),u=tm.shiftPoint(n,i,4*l),u=tm.shiftPoint(u,o,4*s),t=tm.shiftPoint(i,n,4*l),t=tm.shiftPoint(t,a,4*s),c=tm.shiftPoint(a,o,4*l),c=tm.shiftPoint(c,i,4*s),r=tm.shiftPoint(o,a,4*l),[u,t,c,r=tm.shiftPoint(r,n,4*s)]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,r,n,i,a,o){return e_.getInstance().sampleGrid(e,a,o,.5,.5,a-.5,.5,a-.5,o-.5,.5,o-.5,t.getX(),t.getY(),i.getX(),i.getY(),n.getX(),n.getY(),r.getX(),r.getY())}transitionsBetween(e,t){let r=Math.trunc(e.getX()),n=Math.trunc(e.getY()),i=Math.trunc(t.getX()),a=Math.trunc(t.getY()),o=Math.abs(a-n)>Math.abs(i-r);if(o){let e=r;r=n,n=e,e=i,i=a,a=e}let s=Math.abs(i-r),l=Math.abs(a-n),u=-s/2,c=n<a?1:-1,h=r<i?1:-1,d=0,f=this.image.get(o?n:r,o?r:n);for(let e=r,t=n;e!==i;e+=h){let r=this.image.get(o?t:e,o?e:t);if(r!==f&&(d++,f=r),(u+=l)>0){if(t===a)break;t+=c,u-=s}}return d}}class tv{constructor(){this.decoder=new tp}decode(e,t=null){let r,n;if(null!=t&&t.has(U.PURE_BARCODE)){let t=tv.extractPureBits(e.getBlackMatrix());r=this.decoder.decode(t),n=tv.NO_POINTS}else{let t=new tm(e.getBlackMatrix()).detect();r=this.decoder.decode(t.getBits()),n=t.getPoints()}let i=r.getRawBytes(),a=new en(r.getText(),i,8*i.length,n,ei.DATA_MATRIX,P.currentTimeMillis()),o=r.getByteSegments();null!=o&&a.putMetadata(ea.BYTE_SEGMENTS,o);let s=r.getECLevel();return null!=s&&a.putMetadata(ea.ERROR_CORRECTION_LEVEL,s),a}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null==t||null==r)throw new q;let n=this.moduleSize(t,e),i=t[1],a=r[1],o=t[0],s=(r[0]-o+1)/n,l=(a-i+1)/n;if(s<=0||l<=0)throw new q;let u=n/2;i+=u,o+=u;let c=new W(s,l);for(let t=0;t<l;t++){let r=i+t*n;for(let i=0;i<s;i++)e.get(o+i*n,r)&&c.set(i,t)}return c}static moduleSize(e,t){let r=t.getWidth(),n=e[0],i=e[1];for(;n<r&&t.get(n,i);)n++;if(n===r)throw new q;let a=n-e[0];if(0===a)throw new q;return a}}tv.NO_POINTS=[],(u=b||(b={}))[u.L=0]="L",u[u.M=1]="M",u[u.Q=2]="Q",u[u.H=3]="H";class ty{constructor(e,t,r){this.value=e,this.stringValue=t,this.bits=r,ty.FOR_BITS.set(r,this),ty.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ty.L;case"M":return ty.M;case"Q":return ty.Q;case"H":return ty.H;default:throw new D(e+"not available")}}toString(){return this.stringValue}equals(e){return e instanceof ty&&this.value===e.value}static forBits(e){if(e<0||e>=ty.FOR_BITS.size)throw new N;return ty.FOR_BITS.get(e)}}ty.FOR_BITS=new Map,ty.FOR_VALUE=new Map,ty.L=new ty(b.L,"L",1),ty.M=new ty(b.M,"M",0),ty.Q=new ty(b.Q,"Q",3),ty.H=new ty(b.H,"H",2);class tw{constructor(e){this.errorCorrectionLevel=ty.forBits(e>>3&3),this.dataMask=7&e}static numBitsDiffering(e,t){return F.bitCount(e^t)}static decodeFormatInformation(e,t){let r=tw.doDecodeFormatInformation(e,t);return null!==r?r:tw.doDecodeFormatInformation(e^tw.FORMAT_INFO_MASK_QR,t^tw.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let r=Number.MAX_SAFE_INTEGER,n=0;for(let i of tw.FORMAT_INFO_DECODE_LOOKUP){let a=i[0];if(a===e||a===t)return new tw(i[1]);let o=tw.numBitsDiffering(e,a);o<r&&(n=i[1],r=o),e!==t&&(o=tw.numBitsDiffering(t,a))<r&&(n=i[1],r=o)}return r<=3?new tw(n):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){return e instanceof tw&&this.errorCorrectionLevel===e.errorCorrectionLevel&&this.dataMask===e.dataMask}}tw.FORMAT_INFO_MASK_QR=21522,tw.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class tE{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;for(let t of this.ecBlocks)e+=t.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class tb{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class tA{constructor(e,t,...r){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=r;let n=0;const i=r[0].getECCodewordsPerBlock();for(const e of r[0].getECBlocks())n+=e.getCount()*(e.getDataCodewords()+i);this.totalCodewords=n}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!=1)throw new V;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new V}}static getVersionForNumber(e){if(e<1||e>40)throw new N;return tA.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,r=0;for(let n=0;n<tA.VERSION_DECODE_INFO.length;n++){let i=tA.VERSION_DECODE_INFO[n];if(i===e)return tA.getVersionForNumber(n+7);let a=tw.numBitsDiffering(e,i);a<t&&(r=n+7,t=a)}return t<=3?tA.getVersionForNumber(r):null}buildFunctionPattern(){let e=this.getDimensionForVersion(),t=new W(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);let r=this.alignmentPatternCenters.length;for(let e=0;e<r;e++){let n=this.alignmentPatternCenters[e]-2;for(let i=0;i<r;i++)(0!==e||0!==i&&i!==r-1)&&(e!==r-1||0!==i)&&t.setRegion(this.alignmentPatternCenters[i]-2,n,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}tA.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),tA.VERSIONS=[new tA(1,new Int32Array(0),new tE(7,new tb(1,19)),new tE(10,new tb(1,16)),new tE(13,new tb(1,13)),new tE(17,new tb(1,9))),new tA(2,Int32Array.from([6,18]),new tE(10,new tb(1,34)),new tE(16,new tb(1,28)),new tE(22,new tb(1,22)),new tE(28,new tb(1,16))),new tA(3,Int32Array.from([6,22]),new tE(15,new tb(1,55)),new tE(26,new tb(1,44)),new tE(18,new tb(2,17)),new tE(22,new tb(2,13))),new tA(4,Int32Array.from([6,26]),new tE(20,new tb(1,80)),new tE(18,new tb(2,32)),new tE(26,new tb(2,24)),new tE(16,new tb(4,9))),new tA(5,Int32Array.from([6,30]),new tE(26,new tb(1,108)),new tE(24,new tb(2,43)),new tE(18,new tb(2,15),new tb(2,16)),new tE(22,new tb(2,11),new tb(2,12))),new tA(6,Int32Array.from([6,34]),new tE(18,new tb(2,68)),new tE(16,new tb(4,27)),new tE(24,new tb(4,19)),new tE(28,new tb(4,15))),new tA(7,Int32Array.from([6,22,38]),new tE(20,new tb(2,78)),new tE(18,new tb(4,31)),new tE(18,new tb(2,14),new tb(4,15)),new tE(26,new tb(4,13),new tb(1,14))),new tA(8,Int32Array.from([6,24,42]),new tE(24,new tb(2,97)),new tE(22,new tb(2,38),new tb(2,39)),new tE(22,new tb(4,18),new tb(2,19)),new tE(26,new tb(4,14),new tb(2,15))),new tA(9,Int32Array.from([6,26,46]),new tE(30,new tb(2,116)),new tE(22,new tb(3,36),new tb(2,37)),new tE(20,new tb(4,16),new tb(4,17)),new tE(24,new tb(4,12),new tb(4,13))),new tA(10,Int32Array.from([6,28,50]),new tE(18,new tb(2,68),new tb(2,69)),new tE(26,new tb(4,43),new tb(1,44)),new tE(24,new tb(6,19),new tb(2,20)),new tE(28,new tb(6,15),new tb(2,16))),new tA(11,Int32Array.from([6,30,54]),new tE(20,new tb(4,81)),new tE(30,new tb(1,50),new tb(4,51)),new tE(28,new tb(4,22),new tb(4,23)),new tE(24,new tb(3,12),new tb(8,13))),new tA(12,Int32Array.from([6,32,58]),new tE(24,new tb(2,92),new tb(2,93)),new tE(22,new tb(6,36),new tb(2,37)),new tE(26,new tb(4,20),new tb(6,21)),new tE(28,new tb(7,14),new tb(4,15))),new tA(13,Int32Array.from([6,34,62]),new tE(26,new tb(4,107)),new tE(22,new tb(8,37),new tb(1,38)),new tE(24,new tb(8,20),new tb(4,21)),new tE(22,new tb(12,11),new tb(4,12))),new tA(14,Int32Array.from([6,26,46,66]),new tE(30,new tb(3,115),new tb(1,116)),new tE(24,new tb(4,40),new tb(5,41)),new tE(20,new tb(11,16),new tb(5,17)),new tE(24,new tb(11,12),new tb(5,13))),new tA(15,Int32Array.from([6,26,48,70]),new tE(22,new tb(5,87),new tb(1,88)),new tE(24,new tb(5,41),new tb(5,42)),new tE(30,new tb(5,24),new tb(7,25)),new tE(24,new tb(11,12),new tb(7,13))),new tA(16,Int32Array.from([6,26,50,74]),new tE(24,new tb(5,98),new tb(1,99)),new tE(28,new tb(7,45),new tb(3,46)),new tE(24,new tb(15,19),new tb(2,20)),new tE(30,new tb(3,15),new tb(13,16))),new tA(17,Int32Array.from([6,30,54,78]),new tE(28,new tb(1,107),new tb(5,108)),new tE(28,new tb(10,46),new tb(1,47)),new tE(28,new tb(1,22),new tb(15,23)),new tE(28,new tb(2,14),new tb(17,15))),new tA(18,Int32Array.from([6,30,56,82]),new tE(30,new tb(5,120),new tb(1,121)),new tE(26,new tb(9,43),new tb(4,44)),new tE(28,new tb(17,22),new tb(1,23)),new tE(28,new tb(2,14),new tb(19,15))),new tA(19,Int32Array.from([6,30,58,86]),new tE(28,new tb(3,113),new tb(4,114)),new tE(26,new tb(3,44),new tb(11,45)),new tE(26,new tb(17,21),new tb(4,22)),new tE(26,new tb(9,13),new tb(16,14))),new tA(20,Int32Array.from([6,34,62,90]),new tE(28,new tb(3,107),new tb(5,108)),new tE(26,new tb(3,41),new tb(13,42)),new tE(30,new tb(15,24),new tb(5,25)),new tE(28,new tb(15,15),new tb(10,16))),new tA(21,Int32Array.from([6,28,50,72,94]),new tE(28,new tb(4,116),new tb(4,117)),new tE(26,new tb(17,42)),new tE(28,new tb(17,22),new tb(6,23)),new tE(30,new tb(19,16),new tb(6,17))),new tA(22,Int32Array.from([6,26,50,74,98]),new tE(28,new tb(2,111),new tb(7,112)),new tE(28,new tb(17,46)),new tE(30,new tb(7,24),new tb(16,25)),new tE(24,new tb(34,13))),new tA(23,Int32Array.from([6,30,54,78,102]),new tE(30,new tb(4,121),new tb(5,122)),new tE(28,new tb(4,47),new tb(14,48)),new tE(30,new tb(11,24),new tb(14,25)),new tE(30,new tb(16,15),new tb(14,16))),new tA(24,Int32Array.from([6,28,54,80,106]),new tE(30,new tb(6,117),new tb(4,118)),new tE(28,new tb(6,45),new tb(14,46)),new tE(30,new tb(11,24),new tb(16,25)),new tE(30,new tb(30,16),new tb(2,17))),new tA(25,Int32Array.from([6,32,58,84,110]),new tE(26,new tb(8,106),new tb(4,107)),new tE(28,new tb(8,47),new tb(13,48)),new tE(30,new tb(7,24),new tb(22,25)),new tE(30,new tb(22,15),new tb(13,16))),new tA(26,Int32Array.from([6,30,58,86,114]),new tE(28,new tb(10,114),new tb(2,115)),new tE(28,new tb(19,46),new tb(4,47)),new tE(28,new tb(28,22),new tb(6,23)),new tE(30,new tb(33,16),new tb(4,17))),new tA(27,Int32Array.from([6,34,62,90,118]),new tE(30,new tb(8,122),new tb(4,123)),new tE(28,new tb(22,45),new tb(3,46)),new tE(30,new tb(8,23),new tb(26,24)),new tE(30,new tb(12,15),new tb(28,16))),new tA(28,Int32Array.from([6,26,50,74,98,122]),new tE(30,new tb(3,117),new tb(10,118)),new tE(28,new tb(3,45),new tb(23,46)),new tE(30,new tb(4,24),new tb(31,25)),new tE(30,new tb(11,15),new tb(31,16))),new tA(29,Int32Array.from([6,30,54,78,102,126]),new tE(30,new tb(7,116),new tb(7,117)),new tE(28,new tb(21,45),new tb(7,46)),new tE(30,new tb(1,23),new tb(37,24)),new tE(30,new tb(19,15),new tb(26,16))),new tA(30,Int32Array.from([6,26,52,78,104,130]),new tE(30,new tb(5,115),new tb(10,116)),new tE(28,new tb(19,47),new tb(10,48)),new tE(30,new tb(15,24),new tb(25,25)),new tE(30,new tb(23,15),new tb(25,16))),new tA(31,Int32Array.from([6,30,56,82,108,134]),new tE(30,new tb(13,115),new tb(3,116)),new tE(28,new tb(2,46),new tb(29,47)),new tE(30,new tb(42,24),new tb(1,25)),new tE(30,new tb(23,15),new tb(28,16))),new tA(32,Int32Array.from([6,34,60,86,112,138]),new tE(30,new tb(17,115)),new tE(28,new tb(10,46),new tb(23,47)),new tE(30,new tb(10,24),new tb(35,25)),new tE(30,new tb(19,15),new tb(35,16))),new tA(33,Int32Array.from([6,30,58,86,114,142]),new tE(30,new tb(17,115),new tb(1,116)),new tE(28,new tb(14,46),new tb(21,47)),new tE(30,new tb(29,24),new tb(19,25)),new tE(30,new tb(11,15),new tb(46,16))),new tA(34,Int32Array.from([6,34,62,90,118,146]),new tE(30,new tb(13,115),new tb(6,116)),new tE(28,new tb(14,46),new tb(23,47)),new tE(30,new tb(44,24),new tb(7,25)),new tE(30,new tb(59,16),new tb(1,17))),new tA(35,Int32Array.from([6,30,54,78,102,126,150]),new tE(30,new tb(12,121),new tb(7,122)),new tE(28,new tb(12,47),new tb(26,48)),new tE(30,new tb(39,24),new tb(14,25)),new tE(30,new tb(22,15),new tb(41,16))),new tA(36,Int32Array.from([6,24,50,76,102,128,154]),new tE(30,new tb(6,121),new tb(14,122)),new tE(28,new tb(6,47),new tb(34,48)),new tE(30,new tb(46,24),new tb(10,25)),new tE(30,new tb(2,15),new tb(64,16))),new tA(37,Int32Array.from([6,28,54,80,106,132,158]),new tE(30,new tb(17,122),new tb(4,123)),new tE(28,new tb(29,46),new tb(14,47)),new tE(30,new tb(49,24),new tb(10,25)),new tE(30,new tb(24,15),new tb(46,16))),new tA(38,Int32Array.from([6,32,58,84,110,136,162]),new tE(30,new tb(4,122),new tb(18,123)),new tE(28,new tb(13,46),new tb(32,47)),new tE(30,new tb(48,24),new tb(14,25)),new tE(30,new tb(42,15),new tb(32,16))),new tA(39,Int32Array.from([6,26,54,82,110,138,166]),new tE(30,new tb(20,117),new tb(4,118)),new tE(28,new tb(40,47),new tb(7,48)),new tE(30,new tb(43,24),new tb(22,25)),new tE(30,new tb(10,15),new tb(67,16))),new tA(40,Int32Array.from([6,30,58,86,114,142,170]),new tE(30,new tb(19,118),new tb(6,119)),new tE(28,new tb(18,47),new tb(31,48)),new tE(30,new tb(34,24),new tb(34,25)),new tE(30,new tb(20,15),new tb(61,16)))],(c=A||(A={}))[c.DATA_MASK_000=0]="DATA_MASK_000",c[c.DATA_MASK_001=1]="DATA_MASK_001",c[c.DATA_MASK_010=2]="DATA_MASK_010",c[c.DATA_MASK_011=3]="DATA_MASK_011",c[c.DATA_MASK_100=4]="DATA_MASK_100",c[c.DATA_MASK_101=5]="DATA_MASK_101",c[c.DATA_MASK_110=6]="DATA_MASK_110",c[c.DATA_MASK_111=7]="DATA_MASK_111";class tC{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let r=0;r<t;r++)for(let n=0;n<t;n++)this.isMasked(r,n)&&e.flip(n,r)}}tC.values=new Map([[A.DATA_MASK_000,new tC(A.DATA_MASK_000,(e,t)=>(e+t&1)==0)],[A.DATA_MASK_001,new tC(A.DATA_MASK_001,(e,t)=>(1&e)==0)],[A.DATA_MASK_010,new tC(A.DATA_MASK_010,(e,t)=>t%3==0)],[A.DATA_MASK_011,new tC(A.DATA_MASK_011,(e,t)=>(e+t)%3==0)],[A.DATA_MASK_100,new tC(A.DATA_MASK_100,(e,t)=>(Math.floor(e/2)+Math.floor(t/3)&1)==0)],[A.DATA_MASK_101,new tC(A.DATA_MASK_101,(e,t)=>e*t%6==0)],[A.DATA_MASK_110,new tC(A.DATA_MASK_110,(e,t)=>e*t%6<3)],[A.DATA_MASK_111,new tC(A.DATA_MASK_111,(e,t)=>(e+t+e*t%3&1)==0)]]);class t_{constructor(e){const t=e.getHeight();if(t<21||(3&t)!=1)throw new V;this.bitMatrix=e}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let e=0;for(let t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let t=5;t>=0;t--)e=this.copyBit(8,t,e);let t=this.bitMatrix.getHeight(),r=0,n=t-7;for(let e=t-1;e>=n;e--)r=this.copyBit(8,e,r);for(let e=t-8;e<t;e++)r=this.copyBit(e,8,r);if(this.parsedFormatInfo=tw.decodeFormatInformation(e,r),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new V}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;let e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return tA.getVersionForNumber(t);let r=0,n=e-11;for(let t=5;t>=0;t--)for(let i=e-9;i>=n;i--)r=this.copyBit(i,t,r);let i=tA.decodeVersionInformation(r);if(null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;r=0;for(let t=5;t>=0;t--)for(let i=e-9;i>=n;i--)r=this.copyBit(t,i,r);if(null!==(i=tA.decodeVersionInformation(r))&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new V}copyBit(e,t,r){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?r<<1|1:r<<1}readCodewords(){let e=this.readFormatInformation(),t=this.readVersion(),r=tC.values.get(e.getDataMask()),n=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,n);let i=t.buildFunctionPattern(),a=!0,o=new Uint8Array(t.getTotalCodewords()),s=0,l=0,u=0;for(let e=n-1;e>0;e-=2){6===e&&e--;for(let t=0;t<n;t++){let r=a?n-1-t:t;for(let t=0;t<2;t++)i.get(e-t,r)||(u++,l<<=1,this.bitMatrix.get(e-t,r)&&(l|=1),8===u&&(o[s++]=l,u=0,l=0))}a=!a}if(s!==t.getTotalCodewords())throw new V;return o}remask(){if(null===this.parsedFormatInfo)return;let e=tC.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){let e=this.bitMatrix;for(let t=0,r=e.getWidth();t<r;t++)for(let r=t+1,n=e.getHeight();r<n;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class tS{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,r){if(e.length!==t.getTotalCodewords())throw new N;let n=t.getECBlocksForLevel(r),i=0,a=n.getECBlocks();for(let e of a)i+=e.getCount();let o=Array(i),s=0;for(let e of a)for(let t=0;t<e.getCount();t++){let t=e.getDataCodewords(),r=n.getECCodewordsPerBlock()+t;o[s++]=new tS(t,new Uint8Array(r))}let l=o[0].codewords.length,u=o.length-1;for(;u>=0&&o[u].codewords.length!==l;)u--;u++;let c=l-n.getECCodewordsPerBlock(),h=0;for(let t=0;t<c;t++)for(let r=0;r<s;r++)o[r].codewords[t]=e[h++];for(let t=u;t<s;t++)o[t].codewords[c]=e[h++];let d=o[0].codewords.length;for(let t=c;t<d;t++)for(let r=0;r<s;r++){let n=r<u?t:t+1;o[r].codewords[n]=e[h++]}return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}(h=C||(C={}))[h.TERMINATOR=0]="TERMINATOR",h[h.NUMERIC=1]="NUMERIC",h[h.ALPHANUMERIC=2]="ALPHANUMERIC",h[h.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",h[h.BYTE=4]="BYTE",h[h.ECI=5]="ECI",h[h.KANJI=6]="KANJI",h[h.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",h[h.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",h[h.HANZI=9]="HANZI";class tI{constructor(e,t,r,n){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=r,this.bits=n,tI.FOR_BITS.set(n,this),tI.FOR_VALUE.set(e,this)}static forBits(e){let t=tI.FOR_BITS.get(e);if(void 0===t)throw new N;return t}getCharacterCountBits(e){let t,r=e.getVersionNumber();return t=r<=9?0:r<=26?1:2,this.characterCountBitsForVersions[t]}getValue(){return this.value}getBits(){return this.bits}equals(e){return e instanceof tI&&this.value===e.value}toString(){return this.stringValue}}tI.FOR_BITS=new Map,tI.FOR_VALUE=new Map,tI.TERMINATOR=new tI(C.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),tI.NUMERIC=new tI(C.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),tI.ALPHANUMERIC=new tI(C.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),tI.STRUCTURED_APPEND=new tI(C.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),tI.BYTE=new tI(C.BYTE,"BYTE",Int32Array.from([8,16,16]),4),tI.ECI=new tI(C.ECI,"ECI",Int32Array.from([0,0,0]),7),tI.KANJI=new tI(C.KANJI,"KANJI",Int32Array.from([8,10,12]),8),tI.FNC1_FIRST_POSITION=new tI(C.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),tI.FNC1_SECOND_POSITION=new tI(C.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),tI.HANZI=new tI(C.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class tT{static decode(e,t,r,n){let i=new tf(e),a=new G,o=[],s=-1,l=-1;try{let e,r=null,u=!1;do{if(4>i.available())e=tI.TERMINATOR;else{let t=i.readBits(4);e=tI.forBits(t)}switch(e){case tI.TERMINATOR:break;case tI.FNC1_FIRST_POSITION:case tI.FNC1_SECOND_POSITION:u=!0;break;case tI.STRUCTURED_APPEND:if(16>i.available())throw new V;s=i.readBits(8),l=i.readBits(8);break;case tI.ECI:let c=tT.parseECIValue(i);if(r=H.getCharacterSetECIByValue(c),null===r)throw new V;break;case tI.HANZI:let h=i.readBits(4),d=i.readBits(e.getCharacterCountBits(t));h===tT.GB2312_SUBSET&&tT.decodeHanziSegment(i,a,d);break;default:let f=i.readBits(e.getCharacterCountBits(t));switch(e){case tI.NUMERIC:tT.decodeNumericSegment(i,a,f);break;case tI.ALPHANUMERIC:tT.decodeAlphanumericSegment(i,a,f,u);break;case tI.BYTE:tT.decodeByteSegment(i,a,f,r,o,n);break;case tI.KANJI:tT.decodeKanjiSegment(i,a,f);break;default:throw new V}}}while(e!==tI.TERMINATOR)}catch(e){throw new V}return new eo(e,a.toString(),0===o.length?null:o,null===r?null:r.toString(),s,l)}static decodeHanziSegment(e,t,r){if(13*r>e.available())throw new V;let n=new Uint8Array(2*r),i=0;for(;r>0;){let t=e.readBits(13),a=t/96<<8|t%96;a<959?a+=41377:a+=42657,n[i]=a>>8&255,n[i+1]=255&a,i+=2,r--}try{t.append(Y.decode(n,X.GB2312))}catch(e){throw new V(e)}}static decodeKanjiSegment(e,t,r){if(13*r>e.available())throw new V;let n=new Uint8Array(2*r),i=0;for(;r>0;){let t=e.readBits(13),a=t/192<<8|t%192;a<7936?a+=33088:a+=49472,n[i]=a>>8,n[i+1]=a,i+=2,r--}try{t.append(Y.decode(n,X.SHIFT_JIS))}catch(e){throw new V(e)}}static decodeByteSegment(e,t,r,n,i,a){let o;if(8*r>e.available())throw new V;let s=new Uint8Array(r);for(let t=0;t<r;t++)s[t]=e.readBits(8);o=null===n?X.guessEncoding(s,a):n.getName();try{t.append(Y.decode(s,o))}catch(e){throw new V(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=tT.ALPHANUMERIC_CHARS.length)throw new V;return tT.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,r,n){let i=t.length();for(;r>1;){if(11>e.available())throw new V;let n=e.readBits(11);t.append(tT.toAlphaNumericChar(Math.floor(n/45))),t.append(tT.toAlphaNumericChar(n%45)),r-=2}if(1===r){if(6>e.available())throw new V;t.append(tT.toAlphaNumericChar(e.readBits(6)))}if(n)for(let e=i;e<t.length();e++)"%"===t.charAt(e)&&(e<t.length()-1&&"%"===t.charAt(e+1)?t.deleteCharAt(e+1):t.setCharAt(e,"\x1d"))}static decodeNumericSegment(e,t,r){for(;r>=3;){if(10>e.available())throw new V;let n=e.readBits(10);if(n>=1e3)throw new V;t.append(tT.toAlphaNumericChar(Math.floor(n/100))),t.append(tT.toAlphaNumericChar(Math.floor(n/10)%10)),t.append(tT.toAlphaNumericChar(n%10)),r-=3}if(2===r){if(7>e.available())throw new V;let r=e.readBits(7);if(r>=100)throw new V;t.append(tT.toAlphaNumericChar(Math.floor(r/10))),t.append(tT.toAlphaNumericChar(r%10))}else if(1===r){if(4>e.available())throw new V;let r=e.readBits(4);if(r>=10)throw new V;t.append(tT.toAlphaNumericChar(r))}}static parseECIValue(e){let t=e.readBits(8);if((128&t)==0)return 127&t;if((192&t)==128)return(63&t)<<8|e.readBits(8);if((224&t)==192)return(31&t)<<16|e.readBits(16);throw new V}}tT.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",tT.GB2312_SUBSET=1;class tx{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||null===e||e.length<3)return;let t=e[0];e[0]=e[2],e[2]=t}}class tD{constructor(){this.rsDecoder=new ef(ec.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(W.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){let r=new t_(e),n=null;try{return this.decodeBitMatrixParser(r,t)}catch(e){n=e}try{r.remask(),r.setMirror(!0),r.readVersion(),r.readFormatInformation(),r.mirror();let e=this.decodeBitMatrixParser(r,t);return e.setOther(new tx(!0)),e}catch(e){if(null!==n)throw n;throw e}}decodeBitMatrixParser(e,t){let r=e.readVersion(),n=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),a=tS.getDataBlocks(i,r,n),o=0;for(let e of a)o+=e.getNumDataCodewords();let s=new Uint8Array(o),l=0;for(let e of a){let t=e.getCodewords(),r=e.getNumDataCodewords();this.correctErrors(t,r);for(let e=0;e<r;e++)s[l++]=t[e]}return tT.decode(s,r,n,t)}correctErrors(e,t){let r=new Int32Array(e);try{this.rsDecoder.decode(r,e.length-t)}catch(e){throw new R}for(let n=0;n<t;n++)e[n]=r[n]}}class tN extends ev{constructor(e,t,r){super(e,t),this.estimatedModuleSize=r}aboutEquals(e,t,r){if(Math.abs(t-this.getY())<=e&&Math.abs(r-this.getX())<=e){let t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,r){return new tN((this.getX()+t)/2,(this.getY()+e)/2,(this.estimatedModuleSize+r)/2)}}class tM{constructor(e,t,r,n,i,a,o){this.image=e,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=a,this.resultPointCallback=o,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){let e=this.startX,t=this.height,r=e+this.width,n=this.startY+t/2,i=new Int32Array(3),a=this.image;for(let o=0;o<t;o++){let t=n+((1&o)==0?Math.floor((o+1)/2):-Math.floor((o+1)/2));i[0]=0,i[1]=0,i[2]=0;let s=e;for(;s<r&&!a.get(s,t);)s++;let l=0;for(;s<r;){if(a.get(s,t))if(1===l)i[1]++;else if(2===l){if(this.foundPatternCross(i)){let e=this.handlePossibleCenter(i,t,s);if(null!==e)return e}i[0]=i[2],i[1]=1,i[2]=0,l=1}else i[++l]++;else 1===l&&l++,i[l]++;s++}if(this.foundPatternCross(i)){let e=this.handlePossibleCenter(i,t,r);if(null!==e)return e}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new q}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){let t=this.moduleSize,r=t/2;for(let n=0;n<3;n++)if(Math.abs(t-e[n])>=r)return!1;return!0}crossCheckVertical(e,t,r,n){let i=this.image,a=i.getHeight(),o=this.crossCheckStateCount;o[0]=0,o[1]=0,o[2]=0;let s=e;for(;s>=0&&i.get(t,s)&&o[1]<=r;)o[1]++,s--;if(s<0||o[1]>r)return NaN;for(;s>=0&&!i.get(t,s)&&o[0]<=r;)o[0]++,s--;if(o[0]>r)return NaN;for(s=e+1;s<a&&i.get(t,s)&&o[1]<=r;)o[1]++,s++;if(s===a||o[1]>r)return NaN;for(;s<a&&!i.get(t,s)&&o[2]<=r;)o[2]++,s++;return o[2]>r||5*Math.abs(o[0]+o[1]+o[2]-n)>=2*n?NaN:this.foundPatternCross(o)?tM.centerFromEnd(o,s):NaN}handlePossibleCenter(e,t,r){let n=e[0]+e[1]+e[2],i=tM.centerFromEnd(e,r),a=this.crossCheckVertical(t,i,2*e[1],n);if(!isNaN(a)){let t=(e[0]+e[1]+e[2])/3;for(let e of this.possibleCenters)if(e.aboutEquals(t,a,i))return e.combineEstimate(a,i,t);let r=new tN(i,a,t);this.possibleCenters.push(r),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(r)}return null}}class tR extends ev{constructor(e,t,r,n){super(e,t),this.estimatedModuleSize=r,this.count=n,void 0===n&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,r){if(Math.abs(t-this.getY())<=e&&Math.abs(r-this.getX())<=e){let t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,r){let n=this.count+1;return new tR((this.count*this.getX()+t)/n,(this.count*this.getY()+e)/n,(this.count*this.estimatedModuleSize+r)/n,n)}}class tO{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class tP{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){let t=null!=e&&void 0!==e.get(U.TRY_HARDER),r=null!=e&&void 0!==e.get(U.PURE_BARCODE),n=this.image,i=n.getHeight(),a=n.getWidth(),o=Math.floor(3*i/(4*tP.MAX_MODULES));(o<tP.MIN_SKIP||t)&&(o=tP.MIN_SKIP);let s=!1,l=new Int32Array(5);for(let e=o-1;e<i&&!s;e+=o){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let t=0;for(let i=0;i<a;i++)if(n.get(i,e))(1&t)==1&&t++,l[t]++;else if((1&t)==0)if(4===t)if(tP.foundPatternCross(l)){if(!0===this.handlePossibleCenter(l,e,i,r))if(o=2,!0===this.hasSkipped)s=this.haveMultiplyConfirmedCenters();else{let t=this.findRowSkip();t>l[2]&&(e+=t-l[2]-o,i=a-1)}else{l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;continue}t=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;else l[++t]++;else l[t]++;tP.foundPatternCross(l)&&!0===this.handlePossibleCenter(l,e,a,r)&&(o=l[0],this.hasSkipped&&(s=this.haveMultiplyConfirmedCenters()))}let u=this.selectBestPatterns();return ev.orderBestPatterns(u),new tO(u)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let r=0;r<5;r++){let n=e[r];if(0===n)return!1;t+=n}if(t<7)return!1;let r=t/7,n=r/2;return Math.abs(r-e[0])<n&&Math.abs(r-e[1])<n&&Math.abs(3*r-e[2])<3*n&&Math.abs(r-e[3])<n&&Math.abs(r-e[4])<n}getCrossCheckStateCount(){let e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,r,n){let i=this.getCrossCheckStateCount(),a=0,o=this.image;for(;e>=a&&t>=a&&o.get(t-a,e-a);)i[2]++,a++;if(e<a||t<a)return!1;for(;e>=a&&t>=a&&!o.get(t-a,e-a)&&i[1]<=r;)i[1]++,a++;if(e<a||t<a||i[1]>r)return!1;for(;e>=a&&t>=a&&o.get(t-a,e-a)&&i[0]<=r;)i[0]++,a++;if(i[0]>r)return!1;let s=o.getHeight(),l=o.getWidth();for(a=1;e+a<s&&t+a<l&&o.get(t+a,e+a);)i[2]++,a++;if(e+a>=s||t+a>=l)return!1;for(;e+a<s&&t+a<l&&!o.get(t+a,e+a)&&i[3]<r;)i[3]++,a++;if(e+a>=s||t+a>=l||i[3]>=r)return!1;for(;e+a<s&&t+a<l&&o.get(t+a,e+a)&&i[4]<r;)i[4]++,a++;return!(i[4]>=r)&&Math.abs(i[0]+i[1]+i[2]+i[3]+i[4]-n)<2*n&&tP.foundPatternCross(i)}crossCheckVertical(e,t,r,n){let i=this.image,a=i.getHeight(),o=this.getCrossCheckStateCount(),s=e;for(;s>=0&&i.get(t,s);)o[2]++,s--;if(s<0)return NaN;for(;s>=0&&!i.get(t,s)&&o[1]<=r;)o[1]++,s--;if(s<0||o[1]>r)return NaN;for(;s>=0&&i.get(t,s)&&o[0]<=r;)o[0]++,s--;if(o[0]>r)return NaN;for(s=e+1;s<a&&i.get(t,s);)o[2]++,s++;if(s===a)return NaN;for(;s<a&&!i.get(t,s)&&o[3]<r;)o[3]++,s++;if(s===a||o[3]>=r)return NaN;for(;s<a&&i.get(t,s)&&o[4]<r;)o[4]++,s++;return o[4]>=r||5*Math.abs(o[0]+o[1]+o[2]+o[3]+o[4]-n)>=2*n?NaN:tP.foundPatternCross(o)?tP.centerFromEnd(o,s):NaN}crossCheckHorizontal(e,t,r,n){let i=this.image,a=i.getWidth(),o=this.getCrossCheckStateCount(),s=e;for(;s>=0&&i.get(s,t);)o[2]++,s--;if(s<0)return NaN;for(;s>=0&&!i.get(s,t)&&o[1]<=r;)o[1]++,s--;if(s<0||o[1]>r)return NaN;for(;s>=0&&i.get(s,t)&&o[0]<=r;)o[0]++,s--;if(o[0]>r)return NaN;for(s=e+1;s<a&&i.get(s,t);)o[2]++,s++;if(s===a)return NaN;for(;s<a&&!i.get(s,t)&&o[3]<r;)o[3]++,s++;if(s===a||o[3]>=r)return NaN;for(;s<a&&i.get(s,t)&&o[4]<r;)o[4]++,s++;return o[4]>=r||5*Math.abs(o[0]+o[1]+o[2]+o[3]+o[4]-n)>=n?NaN:tP.foundPatternCross(o)?tP.centerFromEnd(o,s):NaN}handlePossibleCenter(e,t,r,n){let i=e[0]+e[1]+e[2]+e[3]+e[4],a=tP.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(a),e[2],i);if(!isNaN(o)&&!isNaN(a=this.crossCheckHorizontal(Math.floor(a),Math.floor(o),e[2],i))&&(!n||this.crossCheckDiagonal(Math.floor(o),Math.floor(a),e[2],i))){let e=i/7,t=!1,r=this.possibleCenters;for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.aboutEquals(e,o,a)){r[n]=i.combineEstimate(o,a,e),t=!0;break}}if(!t){let t=new tR(a,o,e);r.push(t),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(t)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let e=null;for(let t of this.possibleCenters)if(t.getCount()>=tP.CENTER_QUORUM)if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.getX()-t.getX())-Math.abs(e.getY()-t.getY()))/2);else e=t;return 0}haveMultiplyConfirmedCenters(){let e=0,t=0,r=this.possibleCenters.length;for(let r of this.possibleCenters)r.getCount()>=tP.CENTER_QUORUM&&(e++,t+=r.getEstimatedModuleSize());if(e<3)return!1;let n=t/r,i=0;for(let e of this.possibleCenters)i+=Math.abs(e.getEstimatedModuleSize()-n);return i<=.05*t}selectBestPatterns(){let e,t=this.possibleCenters.length;if(t<3)throw new q;let r=this.possibleCenters;if(t>3){let n=0,i=0;for(let e of this.possibleCenters){let t=e.getEstimatedModuleSize();n+=t,i+=t*t}e=n/t;let a=Math.sqrt(i/t-e*e);r.sort((t,r)=>{let n=Math.abs(r.getEstimatedModuleSize()-e),i=Math.abs(t.getEstimatedModuleSize()-e);return n<i?-1:+(n>i)});let o=Math.max(.2*e,a);for(let t=0;t<r.length&&r.length>3;t++)Math.abs(r[t].getEstimatedModuleSize()-e)>o&&(r.splice(t,1),t--)}if(r.length>3){let t=0;for(let e of r)t+=e.getEstimatedModuleSize();e=t/r.length,r.sort((t,r)=>{if(r.getCount()!==t.getCount())return r.getCount()-t.getCount();{let n=Math.abs(r.getEstimatedModuleSize()-e),i=Math.abs(t.getEstimatedModuleSize()-e);return n<i?1:n>i?-1:0}}),r.splice(3)}return[r[0],r[1],r[2]]}}tP.CENTER_QUORUM=2,tP.MIN_SKIP=3,tP.MAX_MODULES=57;class tB{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=null==e?null:e.get(U.NEED_RESULT_POINT_CALLBACK);let t=new tP(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(t)}processFinderPatternInfo(e){let t=e.getTopLeft(),r=e.getTopRight(),n=e.getBottomLeft(),i=this.calculateModuleSize(t,r,n);if(i<1)throw new q("No pattern found in proccess finder.");let a=tB.computeDimension(t,r,n,i),o=tA.getProvisionalVersionForDimension(a),s=o.getDimensionForVersion()-7,l=null;if(o.getAlignmentPatternCenters().length>0){let e=r.getX()-t.getX()+n.getX(),a=r.getY()-t.getY()+n.getY(),o=1-3/s,u=Math.floor(t.getX()+o*(e-t.getX())),c=Math.floor(t.getY()+o*(a-t.getY()));for(let e=4;e<=16;e<<=1)try{l=this.findAlignmentInRegion(i,u,c,e);break}catch(e){if(!(e instanceof q))throw e}}let u=tB.createTransform(t,r,n,l,a);return new ey(tB.sampleGrid(this.image,u,a),null===l?[n,t,r]:[n,t,r,l])}static createTransform(e,t,r,n,i){let a,o,s,l,u=i-3.5;return null!==n?(a=n.getX(),o=n.getY(),l=s=u-3):(a=t.getX()-e.getX()+r.getX(),o=t.getY()-e.getY()+r.getY(),s=u,l=u),eA.quadrilateralToQuadrilateral(3.5,3.5,u,3.5,s,l,3.5,u,e.getX(),e.getY(),t.getX(),t.getY(),a,o,r.getX(),r.getY())}static sampleGrid(e,t,r){return e_.getInstance().sampleGridWithTransform(e,r,r,t)}static computeDimension(e,t,r,n){let i=Math.floor((ep.round(ev.distance(e,t)/n)+ep.round(ev.distance(e,r)/n))/2)+7;switch(3&i){case 0:i++;break;case 2:i--;break;case 3:throw new q("Dimensions could be not found.")}return i}calculateModuleSize(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2}calculateModuleSizeOneWay(e,t){let r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,r,n){let i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),a=1,o=e-(r-e);o<0?(a=e/(e-o),o=0):o>=this.image.getWidth()&&(a=(this.image.getWidth()-1-e)/(o-e),o=this.image.getWidth()-1);let s=Math.floor(t-(n-t)*a);return a=1,s<0?(a=t/(t-s),s=0):s>=this.image.getHeight()&&(a=(this.image.getHeight()-1-t)/(s-t),s=this.image.getHeight()-1),o=Math.floor(e+(o-e)*a),(i+=this.sizeOfBlackWhiteBlackRun(e,t,o,s))-1}sizeOfBlackWhiteBlackRun(e,t,r,n){let i=Math.abs(n-t)>Math.abs(r-e);if(i){let i=e;e=t,t=i,i=r,r=n,n=i}let a=Math.abs(r-e),o=Math.abs(n-t),s=-a/2,l=e<r?1:-1,u=t<n?1:-1,c=0,h=r+l;for(let r=e,d=t;r!==h;r+=l){let l=i?d:r,h=i?r:d;if(1===c===this.image.get(l,h)){if(2===c)return ep.distance(r,d,e,t);c++}if((s+=o)>0){if(d===n)break;d+=u,s-=a}}return 2===c?ep.distance(r+l,n,e,t):NaN}findAlignmentInRegion(e,t,r,n){let i=Math.floor(n*e),a=Math.max(0,t-i),o=Math.min(this.image.getWidth()-1,t+i);if(o-a<3*e)throw new q("Alignment top exceeds estimated module size.");let s=Math.max(0,r-i),l=Math.min(this.image.getHeight()-1,r+i);if(l-s<3*e)throw new q("Alignment bottom exceeds estimated module size.");return new tM(this.image,a,s,o-a,l-s,e,this.resultPointCallback).find()}}class tL{constructor(){this.decoder=new tD}getDecoder(){return this.decoder}decode(e,t){let r,n;if(null!=t&&void 0!==t.get(U.PURE_BARCODE)){let i=tL.extractPureBits(e.getBlackMatrix());r=this.decoder.decodeBitMatrix(i,t),n=tL.NO_POINTS}else{let i=new tB(e.getBlackMatrix()).detect(t);r=this.decoder.decodeBitMatrix(i.getBits(),t),n=i.getPoints()}r.getOther()instanceof tx&&r.getOther().applyMirroredCorrection(n);let i=new en(r.getText(),r.getRawBytes(),void 0,n,ei.QR_CODE,void 0),a=r.getByteSegments();null!==a&&i.putMetadata(ea.BYTE_SEGMENTS,a);let o=r.getECLevel();return null!==o&&i.putMetadata(ea.ERROR_CORRECTION_LEVEL,o),r.hasStructuredAppend()&&(i.putMetadata(ea.STRUCTURED_APPEND_SEQUENCE,r.getStructuredAppendSequenceNumber()),i.putMetadata(ea.STRUCTURED_APPEND_PARITY,r.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null===t||null===r)throw new q;let n=this.moduleSize(t,e),i=t[1],a=r[1],o=t[0],s=r[0];if(o>=s||i>=a||a-i!=s-o&&(s=o+(a-i))>=e.getWidth())throw new q;let l=Math.round((s-o+1)/n),u=Math.round((a-i+1)/n);if(l<=0||u<=0||u!==l)throw new q;let c=Math.floor(n/2);i+=c;let h=(o+=c)+Math.floor((l-1)*n)-s;if(h>0){if(h>c)throw new q;o-=h}let d=i+Math.floor((u-1)*n)-a;if(d>0){if(d>c)throw new q;i-=d}let f=new W(l,u);for(let t=0;t<u;t++){let r=i+Math.floor(t*n);for(let i=0;i<l;i++)e.get(o+Math.floor(i*n),r)&&f.set(i,t)}return f}static moduleSize(e,t){let r=t.getHeight(),n=t.getWidth(),i=e[0],a=e[1],o=!0,s=0;for(;i<n&&a<r;){if(o!==t.get(i,a)){if(5==++s)break;o=!o}i++,a++}if(i===n||a===r)throw new q;return(i-e[0])/7}}tL.NO_POINTS=[];class tk{PDF417Common(){}static getBitCountSum(e){return ep.sum(e)}static toIntArray(e){if(null==e||!e.length)return tk.EMPTY_INT_ARRAY;let t=new Int32Array(e.length),r=0;for(let n of e)t[r++]=n;return t}static getCodeword(e){let t=k.binarySearch(tk.SYMBOL_TABLE,262143&e);return t<0?-1:(tk.CODEWORD_TABLE[t]-1)%tk.NUMBER_OF_CODEWORDS}}tk.NUMBER_OF_CODEWORDS=929,tk.MAX_CODEWORDS_IN_BARCODE=tk.NUMBER_OF_CODEWORDS-1,tk.MIN_ROWS_IN_BARCODE=3,tk.MAX_ROWS_IN_BARCODE=90,tk.MODULES_IN_CODEWORD=17,tk.MODULES_IN_STOP_PATTERN=18,tk.BARS_IN_MODULE=8,tk.EMPTY_INT_ARRAY=new Int32Array([]),tk.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),tk.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class tF{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class tz{static detectMultiple(e,t,r){let n=e.getBlackMatrix(),i=tz.detect(r,n);return i.length||((n=n.clone()).rotate180(),i=tz.detect(r,n)),new tF(n,i)}static detect(e,t){let r=[],n=0,i=0,a=!1;for(;n<t.getHeight();){let o=tz.findVertices(t,n,i);if(null==o[0]&&null==o[3]){if(!a)break;for(let e of(a=!1,i=0,r))null!=e[1]&&(n=Math.trunc(Math.max(n,e[1].getY()))),null!=e[3]&&(n=Math.max(n,Math.trunc(e[3].getY())));n+=tz.ROW_STEP;continue}if(a=!0,r.push(o),!e)break;null!=o[2]?(i=Math.trunc(o[2].getX()),n=Math.trunc(o[2].getY())):(i=Math.trunc(o[4].getX()),n=Math.trunc(o[4].getY()))}return r}static findVertices(e,t,r){let n=e.getHeight(),i=e.getWidth(),a=Array(8);return tz.copyToResult(a,tz.findRowsWithPattern(e,n,i,t,r,tz.START_PATTERN),tz.INDEXES_START_PATTERN),null!=a[4]&&(r=Math.trunc(a[4].getX()),t=Math.trunc(a[4].getY())),tz.copyToResult(a,tz.findRowsWithPattern(e,n,i,t,r,tz.STOP_PATTERN),tz.INDEXES_STOP_PATTERN),a}static copyToResult(e,t,r){for(let n=0;n<r.length;n++)e[r[n]]=t[n]}static findRowsWithPattern(e,t,r,n,i,a){let o=[,,,,],s=!1,l=new Int32Array(a.length);for(;n<t;n+=tz.ROW_STEP){let t=tz.findGuardPattern(e,i,n,r,!1,a,l);if(null!=t){for(;n>0;){let o=tz.findGuardPattern(e,i,--n,r,!1,a,l);if(null!=o)t=o;else{n++;break}}o[0]=new ev(t[0],n),o[1]=new ev(t[1],n),s=!0;break}}let u=n+1;if(s){let n=0,i=Int32Array.from([Math.trunc(o[0].getX()),Math.trunc(o[1].getX())]);for(;u<t;u++){let t=tz.findGuardPattern(e,i[0],u,r,!1,a,l);if(null!=t&&Math.abs(i[0]-t[0])<tz.MAX_PATTERN_DRIFT&&Math.abs(i[1]-t[1])<tz.MAX_PATTERN_DRIFT)i=t,n=0;else if(n>tz.SKIPPED_ROW_COUNT_MAX)break;else n++}u-=n+1,o[2]=new ev(i[0],u),o[3]=new ev(i[1],u)}return u-n<tz.BARCODE_MIN_HEIGHT&&k.fill(o,null),o}static findGuardPattern(e,t,r,n,i,a,o){k.fillWithin(o,0,o.length,0);let s=t,l=0;for(;e.get(s,r)&&s>0&&l++<tz.MAX_PIXEL_DRIFT;)s--;let u=s,c=0,h=a.length;for(let t=i;u<n;u++)if(e.get(u,r)!==t)o[c]++;else{if(c===h-1){if(tz.patternMatchVariance(o,a,tz.MAX_INDIVIDUAL_VARIANCE)<tz.MAX_AVG_VARIANCE)return new Int32Array([s,u]);s+=o[0]+o[1],P.arraycopy(o,2,o,0,c-1),o[c-1]=0,o[c]=0,c--}else c++;o[c]=1,t=!t}return c===h-1&&tz.patternMatchVariance(o,a,tz.MAX_INDIVIDUAL_VARIANCE)<tz.MAX_AVG_VARIANCE?new Int32Array([s,u-1]):null}static patternMatchVariance(e,t,r){let n=e.length,i=0,a=0;for(let r=0;r<n;r++)i+=e[r],a+=t[r];if(i<a)return 1/0;let o=i/a;r*=o;let s=0;for(let i=0;i<n;i++){let n=e[i],a=t[i]*o,l=n>a?n-a:a-n;if(l>r)return 1/0;s+=l}return s/i}}tz.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),tz.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),tz.MAX_AVG_VARIANCE=.42,tz.MAX_INDIVIDUAL_VARIANCE=.8,tz.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),tz.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),tz.MAX_PIXEL_DRIFT=3,tz.MAX_PATTERN_DRIFT=5,tz.SKIPPED_ROW_COUNT_MAX=25,tz.ROW_STEP=5,tz.BARCODE_MIN_HEIGHT=10;class tU{constructor(e,t){if(0===t.length)throw new N;this.field=e;let r=t.length;if(r>1&&0===t[0]){let e=1;for(;e<r&&0===t[e];)e++;e===r?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(r-e),P.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);if(1===e){let e=0;for(let t of this.coefficients)e=this.field.add(e,t);return e}let t=this.coefficients[0],r=this.coefficients.length;for(let n=1;n<r;n++)t=this.field.add(this.field.multiply(e,t),this.coefficients[n]);return t}add(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,r=e.coefficients;if(t.length>r.length){let e=t;t=r,r=e}let n=new Int32Array(r.length),i=r.length-t.length;P.arraycopy(r,0,n,0,i);for(let e=i;e<r.length;e++)n[e]=this.field.add(t[e-i],r[e]);return new tU(this.field,n)}subtract(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof tU?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new tU(this.field,new Int32Array([0]));let t=this.coefficients,r=t.length,n=e.coefficients,i=n.length,a=new Int32Array(r+i-1);for(let e=0;e<r;e++){let r=t[e];for(let t=0;t<i;t++)a[e+t]=this.field.add(a[e+t],this.field.multiply(r,n[t]))}return new tU(this.field,a)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let r=0;r<e;r++)t[r]=this.field.subtract(0,this.coefficients[r]);return new tU(this.field,t)}multiplyScalar(e){if(0===e)return new tU(this.field,new Int32Array([0]));if(1===e)return this;let t=this.coefficients.length,r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=this.field.multiply(this.coefficients[n],e);return new tU(this.field,r)}multiplyByMonomial(e,t){if(e<0)throw new N;if(0===t)return new tU(this.field,new Int32Array([0]));let r=this.coefficients.length,n=new Int32Array(r+e);for(let e=0;e<r;e++)n[e]=this.field.multiply(this.coefficients[e],t);return new tU(this.field,n)}toString(){let e=new G;for(let t=this.getDegree();t>=0;t--){let r=this.getCoefficient(t);0!==r&&(r<0?(e.append(" - "),r=-r):e.length()>0&&e.append(" + "),(0===t||1!==r)&&e.append(r),0!==t&&(1===t?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class tV{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(0===e)throw new N;return this.logTable[e]}inverse(e){if(0===e)throw new eu;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class tH extends tV{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let r=1;for(let n=0;n<e;n++)this.expTable[n]=r,r=r*t%e;for(let t=0;t<e-1;t++)this.logTable[this.expTable[t]]=t;this.zero=new tU(this,new Int32Array([0])),this.one=new tU(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new N;if(0===t)return this.zero;let r=new Int32Array(e+1);return r[0]=t,new tU(this,r)}}tH.PDF417_GF=new tH(tk.NUMBER_OF_CODEWORDS,3);class tj{constructor(){this.field=tH.PDF417_GF}decode(e,t,r){let n=new tU(this.field,e),i=new Int32Array(t),a=!1;for(let e=t;e>0;e--){let r=n.evaluateAt(this.field.exp(e));i[t-e]=r,0!==r&&(a=!0)}if(!a)return 0;let o=this.field.getOne();if(null!=r)for(let t of r){let r=this.field.exp(e.length-1-t),n=new tU(this.field,new Int32Array([this.field.subtract(0,r),1]));o=o.multiply(n)}let s=new tU(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),s,t),u=l[0],c=l[1],h=this.findErrorLocations(u),d=this.findErrorMagnitudes(c,u,h);for(let t=0;t<h.length;t++){let r=e.length-1-this.field.log(h[t]);if(r<0)throw R.getChecksumInstance();e[r]=this.field.subtract(e[r],d[t])}return h.length}runEuclideanAlgorithm(e,t,r){if(e.getDegree()<t.getDegree()){let r=e;e=t,t=r}let n=e,i=t,a=this.field.getZero(),o=this.field.getOne();for(;i.getDegree()>=Math.round(r/2);){let e=n,t=a;if(n=i,a=o,n.isZero())throw R.getChecksumInstance();i=e;let r=this.field.getZero(),s=n.getCoefficient(n.getDegree()),l=this.field.inverse(s);for(;i.getDegree()>=n.getDegree()&&!i.isZero();){let e=i.getDegree()-n.getDegree(),t=this.field.multiply(i.getCoefficient(i.getDegree()),l);r=r.add(this.field.buildMonomial(e,t)),i=i.subtract(n.multiplyByMonomial(e,t))}o=r.multiply(a).subtract(t).negative()}let s=o.getCoefficient(0);if(0===s)throw R.getChecksumInstance();let l=this.field.inverse(s);return[o.multiply(l),i.multiply(l)]}findErrorLocations(e){let t=e.getDegree(),r=new Int32Array(t),n=0;for(let i=1;i<this.field.getSize()&&n<t;i++)0===e.evaluateAt(i)&&(r[n]=this.field.inverse(i),n++);if(n!==t)throw R.getChecksumInstance();return r}findErrorMagnitudes(e,t,r){let n=t.getDegree(),i=new Int32Array(n);for(let e=1;e<=n;e++)i[n-e]=this.field.multiply(e,t.getCoefficient(e));let a=new tU(this.field,i),o=r.length,s=new Int32Array(o);for(let t=0;t<o;t++){let n=this.field.inverse(r[t]),i=this.field.subtract(0,e.evaluateAt(n)),o=this.field.inverse(a.evaluateAt(n));s[t]=this.field.multiply(i,o)}return s}}class tY{constructor(e,t,r,n,i){e instanceof tY?this.constructor_2(e):this.constructor_1(e,t,r,n,i)}constructor_1(e,t,r,n,i){let a=null==t||null==r,o=null==n||null==i;if(a&&o)throw new q;a?(t=new ev(0,n.getY()),r=new ev(0,i.getY())):o&&(n=new ev(e.getWidth()-1,t.getY()),i=new ev(e.getWidth()-1,r.getY())),this.image=e,this.topLeft=t,this.bottomLeft=r,this.topRight=n,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),r.getX())),this.maxX=Math.trunc(Math.max(n.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),n.getY())),this.maxY=Math.trunc(Math.max(r.getY(),i.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return null==e?t:null==t?e:new tY(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,r){let n=this.topLeft,i=this.bottomLeft,a=this.topRight,o=this.bottomRight;if(e>0){let t=r?this.topLeft:this.topRight,i=Math.trunc(t.getY()-e);i<0&&(i=0);let o=new ev(t.getX(),i);r?n=o:a=o}if(t>0){let e=r?this.bottomLeft:this.bottomRight,n=Math.trunc(e.getY()+t);n>=this.image.getHeight()&&(n=this.image.getHeight()-1);let a=new ev(e.getX(),n);r?i=a:o=a}return new tY(this.image,n,i,a,o)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class tX{constructor(e,t,r,n){this.columnCount=e,this.errorCorrectionLevel=n,this.rowCountUpperPart=t,this.rowCountLowerPart=r,this.rowCount=t+r}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class tG{constructor(){this.buffer=""}static form(e,t){let r=-1;return e.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,function(e,n,i,a,o,s){let l;if("%%"===e)return"%";if(void 0===t[++r])return;e=a?parseInt(a.substr(1)):void 0;let u=o?parseInt(o.substr(1)):void 0;switch(s){case"s":l=t[r];break;case"c":l=t[r][0];break;case"f":l=parseFloat(t[r]).toFixed(e);break;case"p":l=parseFloat(t[r]).toPrecision(e);break;case"e":l=parseFloat(t[r]).toExponential(e);break;case"x":l=parseInt(t[r]).toString(u||16);break;case"d":l=parseFloat(parseInt(t[r],u||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(u);let c=parseInt(i),h=i&&i[0]+""=="0"?"0":" ";for(;l.length<c;)l=void 0!==n?l+h:h+l;return l})}format(e,...t){this.buffer+=tG.form(e,t)}toString(){return this.buffer}}class tW{constructor(e){this.boundingBox=new tY(e),this.codewords=Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(null!=t)return t;for(let r=1;r<tW.MAX_NEARBY_DISTANCE;r++){let n=this.imageRowToCodewordIndex(e)-r;if(n>=0&&null!=(t=this.codewords[n])||(n=this.imageRowToCodewordIndex(e)+r)<this.codewords.length&&null!=(t=this.codewords[n]))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){let e=new tG,t=0;for(let r of this.codewords){if(null==r){e.format("%3d: | %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,r.getRowNumber(),r.getValue())}return e.toString()}}tW.MAX_NEARBY_DISTANCE=5;class tq{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);null==t&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=[];for(let[r,n]of this.values.entries()){let i=()=>r,a=()=>n;a()>e?(e=a(),(t=[]).push(i())):a()===e&&t.push(i())}return tk.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class tZ extends tW{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())null!=e&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let r=this.getBoundingBox(),n=this._isLeft?r.getTopLeft():r.getTopRight(),i=this._isLeft?r.getBottomLeft():r.getBottomRight(),a=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=-1,l=1,u=0;for(let r=a;r<o;r++){if(null==t[r])continue;let n=t[r],i=n.getRowNumber()-s;if(0===i)u++;else if(1===i)l=Math.max(l,u),u=1,s=n.getRowNumber();else if(i<0||n.getRowNumber()>=e.getRowCount()||i>r)t[r]=null;else{let e,a=(e=l>2?(l-2)*i:i)>=r;for(let n=1;n<=e&&!a;n++)a=null!=t[r-n];a?t[r]=null:(s=n.getRowNumber(),u=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(null==e)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let e of this.getCodewords())if(null!=e){let r=e.getRowNumber();if(r>=t.length)continue;t[r]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),r=this._isLeft?t.getTopLeft():t.getTopRight(),n=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(r.getY())),a=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.getCodewords(),s=-1;for(let t=i;t<a;t++){if(null==o[t])continue;let r=o[t];r.setRowNumberAsRowIndicatorColumn();let n=r.getRowNumber()-s;0===n||(1===n?s=r.getRowNumber():r.getRowNumber()>=e.getRowCount()?o[t]=null:s=r.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new tq,r=new tq,n=new tq,i=new tq;for(let a of e){if(null==a)continue;a.setRowNumberAsRowIndicatorColumn();let e=a.getValue()%30,o=a.getRowNumber();switch(!this._isLeft&&(o+=2),o%3){case 0:r.setValue(3*e+1);break;case 1:i.setValue(e/3),n.setValue(e%3);break;case 2:t.setValue(e+1)}}if(0===t.getValue().length||0===r.getValue().length||0===n.getValue().length||0===i.getValue().length||t.getValue()[0]<1||r.getValue()[0]+n.getValue()[0]<tk.MIN_ROWS_IN_BARCODE||r.getValue()[0]+n.getValue()[0]>tk.MAX_ROWS_IN_BARCODE)return null;let a=new tX(t.getValue()[0],r.getValue()[0],n.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,a),a}removeIncorrectCodewords(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(null==e[r])continue;let i=n.getValue()%30,a=n.getRowNumber();if(a>t.getRowCount()){e[r]=null;continue}switch(!this._isLeft&&(a+=2),a%3){case 0:3*i+1!==t.getRowCountUpperPart()&&(e[r]=null);break;case 1:(Math.trunc(i/3)!==t.getErrorCorrectionLevel()||i%3!==t.getRowCountLowerPart())&&(e[r]=null);break;case 2:i+1!==t.getColumnCount()&&(e[r]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class tQ{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){let e;this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let t=tk.MAX_CODEWORDS_IN_BARCODE;do e=t,t=this.adjustRowNumbersAndGetCount();while(t>0&&t<e);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){null!=e&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(0===e)return 0;for(let e=1;e<this.barcodeColumnCount+1;e++){let t=this.detectionResultColumns[e].getCodewords();for(let r=0;r<t.length;r++)null!=t[r]&&(t[r].hasValidRowNumber()||this.adjustRowNumbers(e,r,t))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(null==this.detectionResultColumns[0]||null==this.detectionResultColumns[this.barcodeColumnCount+1])return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let r=0;r<e.length;r++)if(null!=e[r]&&null!=t[r]&&e[r].getRowNumber()===t[r].getRowNumber())for(let t=1;t<=this.barcodeColumnCount;t++){let n=this.detectionResultColumns[t].getCodewords()[r];null!=n&&(n.setRowNumber(e[r].getRowNumber()),n.hasValidRowNumber()||(this.detectionResultColumns[t].getCodewords()[r]=null))}}adjustRowNumbersFromRRI(){if(null==this.detectionResultColumns[this.barcodeColumnCount+1])return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let r=0;r<t.length;r++){if(null==t[r])continue;let n=t[r].getRowNumber(),i=0;for(let t=this.barcodeColumnCount+1;t>0&&i<this.ADJUST_ROW_NUMBER_SKIP;t--){let a=this.detectionResultColumns[t].getCodewords()[r];null!=a&&(i=tQ.adjustRowNumberIfValid(n,i,a),!a.hasValidRowNumber()&&e++)}}return e}adjustRowNumbersFromLRI(){if(null==this.detectionResultColumns[0])return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let r=0;r<t.length;r++){if(null==t[r])continue;let n=t[r].getRowNumber(),i=0;for(let t=1;t<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;t++){let a=this.detectionResultColumns[t].getCodewords()[r];null!=a&&(i=tQ.adjustRowNumberIfValid(n,i,a),!a.hasValidRowNumber()&&e++)}}return e}static adjustRowNumberIfValid(e,t,r){return null==r||!r.hasValidRowNumber()&&(r.isValidRowNumber(e)?(r.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,r){if(!this.detectionResultColumns[e-1])return;let n=r[t],i=this.detectionResultColumns[e-1].getCodewords(),a=i;null!=this.detectionResultColumns[e+1]&&(a=this.detectionResultColumns[e+1].getCodewords());let o=Array(14);for(let e of(o[2]=i[t],o[3]=a[t],t>0&&(o[0]=r[t-1],o[4]=i[t-1],o[5]=a[t-1]),t>1&&(o[8]=r[t-2],o[10]=i[t-2],o[11]=a[t-2]),t<r.length-1&&(o[1]=r[t+1],o[6]=i[t+1],o[7]=a[t+1]),t<r.length-2&&(o[9]=r[t+2],o[12]=i[t+2],o[13]=a[t+2]),o))if(tQ.adjustRowNumber(n,e))return}static adjustRowNumber(e,t){return null!=t&&!!t.hasValidRowNumber()&&t.getBucket()===e.getBucket()&&(e.setRowNumber(t.getRowNumber()),!0)}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];null==e&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new tG;for(let r=0;r<e.getCodewords().length;r++){t.format("CW %3d:",r);for(let e=0;e<this.barcodeColumnCount+2;e++){if(null==this.detectionResultColumns[e]){t.format(" | ");continue}let n=this.detectionResultColumns[e].getCodewords()[r];if(null==n){t.format(" | ");continue}t.format(" %3d|%3d",n.getRowNumber(),n.getValue())}t.format("%n")}return t.toString()}}class tK{constructor(e,t,r,n){this.rowNumber=tK.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(r),this.value=Math.trunc(n)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==tK.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(3*Math.trunc(this.value/30)+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}tK.BARCODE_ROW_UNKNOWN=-1;class t${static initialize(){for(let e=0;e<tk.SYMBOL_TABLE.length;e++){let t=tk.SYMBOL_TABLE[e],r=1&t;for(let n=0;n<tk.BARS_IN_MODULE;n++){let i=0;for(;(1&t)===r;)i+=1,t>>=1;r=1&t,t$.RATIOS_TABLE[e]||(t$.RATIOS_TABLE[e]=Array(tk.BARS_IN_MODULE)),t$.RATIOS_TABLE[e][tk.BARS_IN_MODULE-n-1]=Math.fround(i/tk.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=t$.getDecodedCodewordValue(t$.sampleBitCounts(e));return -1!==t?t:t$.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ep.sum(e),r=new Int32Array(tk.BARS_IN_MODULE),n=0,i=0;for(let a=0;a<tk.MODULES_IN_CODEWORD;a++){let o=t/(2*tk.MODULES_IN_CODEWORD)+a*t/tk.MODULES_IN_CODEWORD;i+e[n]<=o&&(i+=e[n],n++),r[n]++}return r}static getDecodedCodewordValue(e){let t=t$.getBitValue(e);return -1===tk.getCodeword(t)?-1:t}static getBitValue(e){let t=0;for(let r=0;r<e.length;r++)for(let n=0;n<e[r];n++)t=t<<1|r%2==0;return Math.trunc(t)}static getClosestDecodedValue(e){let t=ep.sum(e),r=Array(tk.BARS_IN_MODULE);if(t>1)for(let n=0;n<r.length;n++)r[n]=Math.fround(e[n]/t);let n=em.MAX_VALUE,i=-1;this.bSymbolTableReady||t$.initialize();for(let e=0;e<t$.RATIOS_TABLE.length;e++){let t=0,a=t$.RATIOS_TABLE[e];for(let e=0;e<tk.BARS_IN_MODULE;e++){let i=Math.fround(a[e]-r[e]);if((t+=Math.fround(i*i))>=n)break}t<n&&(n=t,i=tk.SYMBOL_TABLE[e])}return i}}t$.bSymbolTableReady=!1,t$.RATIOS_TABLE=Array(tk.SYMBOL_TABLE.length).map(e=>Array(tk.BARS_IN_MODULE));class tJ{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(e){this.segmentIndex=e}getFileId(){return this.fileId}setFileId(e){this.fileId=e}getOptionalData(){return this.optionalData}setOptionalData(e){this.optionalData=e}isLastSegment(){return this.lastSegment}setLastSegment(e){this.lastSegment=e}getSegmentCount(){return this.segmentCount}setSegmentCount(e){this.segmentCount=e}getSender(){return this.sender||null}setSender(e){this.sender=e}getAddressee(){return this.addressee||null}setAddressee(e){this.addressee=e}getFileName(){return this.fileName}setFileName(e){this.fileName=e}getFileSize(){return this.fileSize}setFileSize(e){this.fileSize=e}getChecksum(){return this.checksum}setChecksum(e){this.checksum=e}getTimestamp(){return this.timestamp}setTimestamp(e){this.timestamp=e}}class t1{static parseLong(e,t){return parseInt(e,t)}}class t0 extends x{}t0.kind="NullPointerException";class t2{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,r){if(null==e)throw new t0;if(t<0||t>e.length||r<0||t+r>e.length||t+r<0)throw new B;if(0!==r)for(let n=0;n<r;n++)this.write(e[t+n])}flush(){}close(){}}class t3 extends x{}class t4 extends t2{constructor(e=32){if(super(),this.count=0,e<0)throw new N("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let t=this.buf.length<<1;if(t-e<0&&(t=e),t<0){if(e<0)throw new t3;t=F.MAX_VALUE}this.buf=k.copyOfUint8Array(this.buf,t)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,r){if(t<0||t>e.length||r<0||t+r-e.length>0)throw new B;this.ensureCapacity(this.count+r),P.arraycopy(e,t,this.buf,this.count,r),this.count+=r}writeTo(e){e.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return k.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?"string"==typeof e?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}function t8(){if("u">typeof window)return window.BigInt||null;if(void 0!==r.g)return r.g.BigInt||null;if("u">typeof self)return self.BigInt||null;throw Error("Can't search globals for BigInt!")}function t6(e){if(void 0===t&&(t=t8()),null===t)throw Error("BigInt is not supported!");return t(e)}(d=_||(_={}))[d.ALPHA=0]="ALPHA",d[d.LOWER=1]="LOWER",d[d.MIXED=2]="MIXED",d[d.PUNCT=3]="PUNCT",d[d.ALPHA_SHIFT=4]="ALPHA_SHIFT",d[d.PUNCT_SHIFT=5]="PUNCT_SHIFT";class t5{static decode(e,t){let r=new G(""),n=H.ISO8859_1;r.enableDecoding(n);let i=1,a=e[i++],o=new tJ;for(;i<e[0];){switch(a){case t5.TEXT_COMPACTION_MODE_LATCH:i=t5.textCompaction(e,i,r);break;case t5.BYTE_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:i=t5.byteCompaction(a,e,n,i,r);break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[i++]);break;case t5.NUMERIC_COMPACTION_MODE_LATCH:i=t5.numericCompaction(e,i,r);break;case t5.ECI_CHARSET:H.getCharacterSetECIByValue(e[i++]);break;case t5.ECI_GENERAL_PURPOSE:i+=2;break;case t5.ECI_USER_DEFINED:i++;break;case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=t5.decodeMacroBlock(e,i,o);break;case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:throw new V;default:i--,i=t5.textCompaction(e,i,r)}if(i<e.length)a=e[i++];else throw V.getFormatInstance()}if(0===r.length())throw V.getFormatInstance();let s=new eo(null,r.toString(),null,t);return s.setOther(o),s}static decodeMacroBlock(e,t,r){if(t+t5.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw V.getFormatInstance();let n=new Int32Array(t5.NUMBER_OF_SEQUENCE_CODEWORDS);for(let r=0;r<t5.NUMBER_OF_SEQUENCE_CODEWORDS;r++,t++)n[r]=e[t];r.setSegmentIndex(F.parseInt(t5.decodeBase900toBase10(n,t5.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new G;t=t5.textCompaction(e,t,i),r.setFileId(i.toString());let a=-1;for(e[t]===t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(a=t+1);t<e[0];)switch(e[t]){case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case t5.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let n=new G;t=t5.textCompaction(e,t+1,n),r.setFileName(n.toString());break;case t5.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new G;t=t5.textCompaction(e,t+1,i),r.setSender(i.toString());break;case t5.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let a=new G;t=t5.textCompaction(e,t+1,a),r.setAddressee(a.toString());break;case t5.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let o=new G;t=t5.numericCompaction(e,t+1,o),r.setSegmentCount(F.parseInt(o.toString()));break;case t5.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let s=new G;t=t5.numericCompaction(e,t+1,s),r.setTimestamp(t1.parseLong(s.toString()));break;case t5.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new G;t=t5.numericCompaction(e,t+1,l),r.setChecksum(F.parseInt(l.toString()));break;case t5.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let u=new G;t=t5.numericCompaction(e,t+1,u),r.setFileSize(t1.parseLong(u.toString()));break;default:throw V.getFormatInstance()}break;case t5.MACRO_PDF417_TERMINATOR:t++,r.setLastSegment(!0);break;default:throw V.getFormatInstance()}if(-1!==a){let n=t-a;r.isLastSegment()&&n--,r.setOptionalData(k.copyOfRange(e,a,a+n))}return t}static textCompaction(e,t,r){let n=new Int32Array((e[0]-t)*2),i=new Int32Array((e[0]-t)*2),a=0,o=!1;for(;t<e[0]&&!o;){let r=e[t++];if(r<t5.TEXT_COMPACTION_MODE_LATCH)n[a]=r/30,n[a+1]=r%30,a+=2;else switch(r){case t5.TEXT_COMPACTION_MODE_LATCH:n[a++]=t5.TEXT_COMPACTION_MODE_LATCH;break;case t5.BYTE_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:case t5.NUMERIC_COMPACTION_MODE_LATCH:case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:t--,o=!0;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n[a]=t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,r=e[t++],i[a]=r,a++}}return t5.decodeTextCompaction(n,i,a,r),t}static decodeTextCompaction(e,t,r,n){let i=_.ALPHA,a=_.ALPHA,o=0;for(;o<r;){let r=e[o],s="";switch(i){case _.ALPHA:if(r<26)s=String.fromCharCode(65+r);else switch(r){case 26:s=" ";break;case t5.LL:i=_.LOWER;break;case t5.ML:i=_.MIXED;break;case t5.PS:a=i,i=_.PUNCT_SHIFT;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.LOWER:if(r<26)s=String.fromCharCode(97+r);else switch(r){case 26:s=" ";break;case t5.AS:a=i,i=_.ALPHA_SHIFT;break;case t5.ML:i=_.MIXED;break;case t5.PS:a=i,i=_.PUNCT_SHIFT;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.MIXED:if(r<t5.PL)s=t5.MIXED_CHARS[r];else switch(r){case t5.PL:i=_.PUNCT;break;case 26:s=" ";break;case t5.LL:i=_.LOWER;break;case t5.AL:i=_.ALPHA;break;case t5.PS:a=i,i=_.PUNCT_SHIFT;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.PUNCT:if(r<t5.PAL)s=t5.PUNCT_CHARS[r];else switch(r){case t5.PAL:i=_.ALPHA;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.ALPHA_SHIFT:if(i=a,r<26)s=String.fromCharCode(65+r);else switch(r){case 26:s=" ";break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.PUNCT_SHIFT:if(i=a,r<t5.PAL)s=t5.PUNCT_CHARS[r];else switch(r){case t5.PAL:i=_.ALPHA;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}}""!==s&&n.append(s),o++}}static byteCompaction(e,t,r,n,i){let a=new t4,o=0,s=0,l=!1;switch(e){case t5.BYTE_COMPACTION_MODE_LATCH:let u=new Int32Array(6),c=t[n++];for(;n<t[0]&&!l;)switch(u[o++]=c,s=900*s+c,c=t[n++]){case t5.TEXT_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH:case t5.NUMERIC_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:n--,l=!0;break;default:if(o%5==0&&o>0){for(let e=0;e<6;++e)a.write(Number(t6(s)>>t6(8*(5-e))));s=0,o=0}}n===t[0]&&c<t5.TEXT_COMPACTION_MODE_LATCH&&(u[o++]=c);for(let e=0;e<o;e++)a.write(u[e]);break;case t5.BYTE_COMPACTION_MODE_LATCH_6:for(;n<t[0]&&!l;){let e=t[n++];if(e<t5.TEXT_COMPACTION_MODE_LATCH)o++,s=900*s+e;else switch(e){case t5.TEXT_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH:case t5.NUMERIC_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:n--,l=!0}if(o%5==0&&o>0){for(let e=0;e<6;++e)a.write(Number(t6(s)>>t6(8*(5-e))));s=0,o=0}}}return i.append(Y.decode(a.toByteArray(),r)),n}static numericCompaction(e,t,r){let n=0,i=!1,a=new Int32Array(t5.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let o=e[t++];if(t===e[0]&&(i=!0),o<t5.TEXT_COMPACTION_MODE_LATCH)a[n]=o,n++;else switch(o){case t5.TEXT_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:t--,i=!0}(n%t5.MAX_NUMERIC_CODEWORDS==0||o===t5.NUMERIC_COMPACTION_MODE_LATCH||i)&&n>0&&(r.append(t5.decodeBase900toBase10(a,n)),n=0)}return t}static decodeBase900toBase10(e,t){let r=t6(0);for(let n=0;n<t;n++)r+=t5.EXP900[t-n-1]*t6(e[n]);let n=r.toString();if("1"!==n.charAt(0))throw new V;return n.substring(1)}}t5.TEXT_COMPACTION_MODE_LATCH=900,t5.BYTE_COMPACTION_MODE_LATCH=901,t5.NUMERIC_COMPACTION_MODE_LATCH=902,t5.BYTE_COMPACTION_MODE_LATCH_6=924,t5.ECI_USER_DEFINED=925,t5.ECI_GENERAL_PURPOSE=926,t5.ECI_CHARSET=927,t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,t5.MACRO_PDF417_TERMINATOR=922,t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,t5.MAX_NUMERIC_CODEWORDS=15,t5.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,t5.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,t5.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,t5.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,t5.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,t5.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,t5.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,t5.PL=25,t5.LL=27,t5.AS=27,t5.ML=28,t5.AL=28,t5.PS=29,t5.PAL=29,t5.PUNCT_CHARS=";<>@[\\]_`~!\r ,:\n-.$/\"|*()?{}'",t5.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",t5.EXP900=t8()?function(){let e=[];e[0]=t6(1);let t=t6(900);e[1]=t;for(let r=2;r<16;r++)e[r]=e[r-1]*t;return e}():[],t5.NUMBER_OF_SEQUENCE_CODEWORDS=2;class t7{static decode(e,t,r,n,i,a,o){let s,l=new tY(e,t,r,n,i),u=null,c=null;for(let r=!0;;r=!1){if(null!=t&&(u=t7.getRowIndicatorColumn(e,l,t,!0,a,o)),null!=n&&(c=t7.getRowIndicatorColumn(e,l,n,!1,a,o)),null==(s=t7.merge(u,c)))throw q.getNotFoundInstance();let i=s.getBoundingBox();if(r&&null!=i&&(i.getMinY()<l.getMinY()||i.getMaxY()>l.getMaxY()))l=i;else break}s.setBoundingBox(l);let h=s.getBarcodeColumnCount()+1;s.setDetectionResultColumn(0,u),s.setDetectionResultColumn(h,c);let d=null!=u;for(let t=1;t<=h;t++){let r,n=d?t:h-t;if(void 0!==s.getDetectionResultColumn(n))continue;r=0===n||n===h?new tZ(l,0===n):new tW(l),s.setDetectionResultColumn(n,r);let i=-1,u=-1;for(let t=l.getMinY();t<=l.getMaxY();t++){if((i=t7.getStartColumn(s,n,t,d))<0||i>l.getMaxX()){if(-1===u)continue;i=u}let c=t7.detectCodeword(e,l.getMinX(),l.getMaxX(),d,i,t,a,o);null!=c&&(r.setCodeword(t,c),u=i,a=Math.min(a,c.getWidth()),o=Math.max(o,c.getWidth()))}}return t7.createDecoderResult(s)}static merge(e,t){if(null==e&&null==t)return null;let r=t7.getBarcodeMetadata(e,t);return null==r?null:new tQ(r,tY.merge(t7.adjustBoundingBox(e),t7.adjustBoundingBox(t)))}static adjustBoundingBox(e){if(null==e)return null;let t=e.getRowHeights();if(null==t)return null;let r=t7.getMax(t),n=0;for(let e of t)if(n+=r-e,e>0)break;let i=e.getCodewords();for(let e=0;n>0&&null==i[e];e++)n--;let a=0;for(let e=t.length-1;e>=0&&(a+=r-t[e],!(t[e]>0));e--);for(let e=i.length-1;a>0&&null==i[e];e--)a--;return e.getBoundingBox().addMissingRows(n,a,e.isLeft())}static getMax(e){let t=-1;for(let r of e)t=Math.max(t,r);return t}static getBarcodeMetadata(e,t){let r,n;return null==e||null==(r=e.getBarcodeMetadata())?null==t?null:t.getBarcodeMetadata():null==t||null==(n=t.getBarcodeMetadata())?r:r.getColumnCount()!==n.getColumnCount()&&r.getErrorCorrectionLevel()!==n.getErrorCorrectionLevel()&&r.getRowCount()!==n.getRowCount()?null:r}static getRowIndicatorColumn(e,t,r,n,i,a){let o=new tZ(t,n);for(let s=0;s<2;s++){let l=0===s?1:-1,u=Math.trunc(Math.trunc(r.getX()));for(let s=Math.trunc(Math.trunc(r.getY()));s<=t.getMaxY()&&s>=t.getMinY();s+=l){let t=t7.detectCodeword(e,0,e.getWidth(),n,u,s,i,a);null!=t&&(o.setCodeword(s,t),u=n?t.getStartX():t.getEndX())}}return o}static adjustCodewordCount(e,t){let r=t[0][1],n=r.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-t7.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===n.length){if(i<1||i>tk.MAX_CODEWORDS_IN_BARCODE)throw q.getNotFoundInstance();r.setValue(i)}else n[0]!==i&&r.setValue(i)}static createDecoderResult(e){let t=t7.createBarcodeMatrix(e);t7.adjustCodewordCount(e,t);let r=[],n=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],a=[];for(let o=0;o<e.getBarcodeRowCount();o++)for(let s=0;s<e.getBarcodeColumnCount();s++){let l=t[o][s+1].getValue(),u=o*e.getBarcodeColumnCount()+s;0===l.length?r.push(u):1===l.length?n[u]=l[0]:(a.push(u),i.push(l))}let o=Array(i.length);for(let e=0;e<o.length;e++)o[e]=i[e];return t7.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),n,tk.toIntArray(r),tk.toIntArray(a),o)}static createDecoderResultFromAmbiguousValues(e,t,r,n,i){let a=new Int32Array(n.length),o=100;for(;o-- >0;){for(let e=0;e<a.length;e++)t[n[e]]=i[e][a[e]];try{return t7.decodeCodewords(t,e,r)}catch(e){if(!(e instanceof R))throw e}if(0===a.length)break;for(let e=0;e<a.length;e++)if(a[e]<i[e].length-1){a[e]++;break}else if(a[e]=0,e===a.length-1)throw R.getChecksumInstance()}throw R.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>Array(e.getBarcodeColumnCount()+2));for(let e=0;e<t.length;e++)for(let r=0;r<t[e].length;r++)t[e][r]=new tq;let r=0;for(let n of e.getDetectionResultColumns()){if(null!=n){for(let e of n.getCodewords())if(null!=e){let n=e.getRowNumber();if(n>=0){if(n>=t.length)continue;t[n][r].setValue(e.getValue())}}}r++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,r,n){let i=n?1:-1,a=null;if(t7.isValidBarcodeColumn(e,t-i)&&(a=e.getDetectionResultColumn(t-i).getCodeword(r)),null!=a)return n?a.getEndX():a.getStartX();if(null!=(a=e.getDetectionResultColumn(t).getCodewordNearby(r)))return n?a.getStartX():a.getEndX();if(t7.isValidBarcodeColumn(e,t-i)&&(a=e.getDetectionResultColumn(t-i).getCodewordNearby(r)),null!=a)return n?a.getEndX():a.getStartX();let o=0;for(;t7.isValidBarcodeColumn(e,t-i);){for(let r of(t-=i,e.getDetectionResultColumn(t).getCodewords()))if(null!=r)return(n?r.getEndX():r.getStartX())+i*o*(r.getEndX()-r.getStartX());o++}return n?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,r,n,i,a,o,s){let l;i=t7.adjustCodewordStartColumn(e,t,r,n,i,a);let u=t7.getModuleBitCount(e,t,r,n,i,a);if(null==u)return null;let c=ep.sum(u);if(n)l=i+c;else{for(let e=0;e<u.length/2;e++){let t=u[e];u[e]=u[u.length-1-e],u[u.length-1-e]=t}i=(l=i)-c}if(!t7.checkCodewordSkew(c,o,s))return null;let h=t$.getDecodedValue(u),d=tk.getCodeword(h);return -1===d?null:new tK(i,l,t7.getCodewordBucketNumber(h),d)}static getModuleBitCount(e,t,r,n,i,a){let o=i,s=new Int32Array(8),l=0,u=n?1:-1,c=n;for(;(n?o<r:o>=t)&&l<s.length;)e.get(o,a)===c?(s[l]++,o+=u):(l++,c=!c);return l===s.length||o===(n?r:t)&&l===s.length-1?s:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,r,n,i,a){let o=i,s=n?-1:1;for(let l=0;l<2;l++){for(;(n?o>=t:o<r)&&n===e.get(o,a);){if(Math.abs(i-o)>t7.CODEWORD_SKEW_SIZE)return i;o+=s}s=-s,n=!n}return o}static checkCodewordSkew(e,t,r){return t-t7.CODEWORD_SKEW_SIZE<=e&&e<=r+t7.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,r){if(0===e.length)throw V.getFormatInstance();let n=1<<t+1,i=t7.correctErrors(e,r,n);t7.verifyCodewordCount(e,n);let a=t5.decode(e,""+t);return a.setErrorsCorrected(i),a.setErasures(r.length),a}static correctErrors(e,t,r){if(null!=t&&t.length>r/2+t7.MAX_ERRORS||r<0||r>t7.MAX_EC_CODEWORDS)throw R.getChecksumInstance();return t7.errorCorrection.decode(e,r,t)}static verifyCodewordCount(e,t){if(e.length<4)throw V.getFormatInstance();let r=e[0];if(r>e.length)throw V.getFormatInstance();if(0===r)if(t<e.length)e[0]=e.length-t;else throw V.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),r=0,n=t.length-1;for(;!((1&e)!==r&&(r=1&e,--n<0));)t[n]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return t7.getCodewordBucketNumber(t7.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new tG;for(let r=0;r<e.length;r++){t.format("Row %2d: ",r);for(let n=0;n<e[r].length;n++){let i=e[r][n];0===i.getValue().length?t.format(" ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}t7.CODEWORD_SKEW_SIZE=2,t7.MAX_ERRORS=3,t7.MAX_EC_CODEWORDS=512,t7.errorCorrection=new tj;class t9{decode(e,t=null){let r=t9.decode(e,t,!1);if(null==r||0===r.length||null==r[0])throw q.getNotFoundInstance();return r[0]}decodeMultiple(e,t=null){try{return t9.decode(e,t,!0)}catch(e){if(e instanceof V||e instanceof R)throw q.getNotFoundInstance();throw e}}static decode(e,t,r){let n=[],i=tz.detectMultiple(e,t,r);for(let e of i.getPoints()){let t=t7.decode(i.getBits(),e[4],e[5],e[6],e[7],t9.getMinCodewordWidth(e),t9.getMaxCodewordWidth(e)),r=new en(t.getText(),t.getRawBytes(),void 0,e,ei.PDF_417);r.putMetadata(ea.ERROR_CORRECTION_LEVEL,t.getECLevel());let a=t.getOther();null!=a&&r.putMetadata(ea.PDF417_EXTRA_METADATA,a),n.push(r)}return n.map(e=>e)}static getMaxWidth(e,t){return null==e||null==t?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return null==e||null==t?F.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(t9.getMaxWidth(e[0],e[4]),t9.getMaxWidth(e[6],e[2])*tk.MODULES_IN_CODEWORD/tk.MODULES_IN_STOP_PATTERN),Math.max(t9.getMaxWidth(e[1],e[5]),t9.getMaxWidth(e[7],e[3])*tk.MODULES_IN_CODEWORD/tk.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(t9.getMinWidth(e[0],e[4]),t9.getMinWidth(e[6],e[2])*tk.MODULES_IN_CODEWORD/tk.MODULES_IN_STOP_PATTERN),Math.min(t9.getMinWidth(e[1],e[5]),t9.getMinWidth(e[7],e[3])*tk.MODULES_IN_CODEWORD/tk.MODULES_IN_STOP_PATTERN)))}reset(){}}class re extends x{}re.kind="ReaderException";class rt{constructor(e,t){this.verbose=!0===e,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return(null===this.readers||void 0===this.readers)&&this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;let t=null!=e&&!0===e.get(U.TRY_HARDER),r=null==e?null:e.get(U.POSSIBLE_FORMATS),n=[];if(null!=r){let i=r.some(e=>e===ei.UPC_A||e===ei.UPC_E||e===ei.EAN_13||e===ei.EAN_8||e===ei.CODABAR||e===ei.CODE_39||e===ei.CODE_93||e===ei.CODE_128||e===ei.ITF||e===ei.RSS_14||e===ei.RSS_EXPANDED);i&&!t&&n.push(new ts(e,this.verbose)),r.includes(ei.QR_CODE)&&n.push(new tL),r.includes(ei.DATA_MATRIX)&&n.push(new tv),r.includes(ei.AZTEC)&&n.push(new eT),r.includes(ei.PDF_417)&&n.push(new t9),i&&t&&n.push(new ts(e,this.verbose))}0===n.length&&(t||n.push(new ts(e,this.verbose)),n.push(new tL),n.push(new tv),n.push(new eT),n.push(new t9),t&&n.push(new ts(e,this.verbose))),this.readers=n}reset(){if(null!==this.readers)for(let e of this.readers)e.reset()}decodeInternal(e){if(null===this.readers)throw new re("No readers where selected, nothing can be read.");for(let t of this.readers)try{return t.decode(e,this.hints)}catch(e){if(e instanceof re)continue}throw new q("No MultiFormat Readers were able to detect the code.")}}(f=S||(S={}))[f.ERROR_CORRECTION=0]="ERROR_CORRECTION",f[f.CHARACTER_SET=1]="CHARACTER_SET",f[f.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",f[f.MIN_SIZE=3]="MIN_SIZE",f[f.MAX_SIZE=4]="MAX_SIZE",f[f.MARGIN=5]="MARGIN",f[f.PDF417_COMPACT=6]="PDF417_COMPACT",f[f.PDF417_COMPACTION=7]="PDF417_COMPACTION",f[f.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",f[f.AZTEC_LAYERS=9]="AZTEC_LAYERS",f[f.QR_VERSION=10]="QR_VERSION";var rr=S;class rn{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new el(e,Int32Array.from([1])))}buildGenerator(e){let t=this.cachedGenerators;if(e>=t.length){let r=t[t.length-1],n=this.field;for(let i=t.length;i<=e;i++){let e=r.multiply(new el(n,Int32Array.from([1,n.exp(i-1+n.getGeneratorBase())])));t.push(e),r=e}}return t[e]}encode(e,t){if(0===t)throw new N("No error correction bytes");let r=e.length-t;if(r<=0)throw new N("No data bytes provided");let n=this.buildGenerator(t),i=new Int32Array(r);P.arraycopy(e,0,i,0,r);let a=new el(this.field,i),o=(a=a.multiplyByMonomial(t,1)).divide(n)[1].getCoefficients(),s=t-o.length;for(let t=0;t<s;t++)e[r+t]=0;P.arraycopy(o,0,e,r+s,o.length)}}class ri{static applyMaskPenaltyRule1(e){return ri.applyMaskPenaltyRule1Internal(e,!0)+ri.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i-1;e++){let i=r[e];for(let a=0;a<n-1;a++){let n=i[a];n===i[a+1]&&n===r[e+1][a]&&n===r[e+1][a+1]&&t++}}return ri.N2*t}static applyMaskPenaltyRule3(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++)for(let a=0;a<n;a++){let o=r[e];a+6<n&&1===o[a]&&0===o[a+1]&&1===o[a+2]&&1===o[a+3]&&1===o[a+4]&&0===o[a+5]&&1===o[a+6]&&(ri.isWhiteHorizontal(o,a-4,a)||ri.isWhiteHorizontal(o,a+7,a+11))&&t++,e+6<i&&1===r[e][a]&&0===r[e+1][a]&&1===r[e+2][a]&&1===r[e+3][a]&&1===r[e+4][a]&&0===r[e+5][a]&&1===r[e+6][a]&&(ri.isWhiteVertical(r,a,e-4,e)||ri.isWhiteVertical(r,a,e+7,e+11))&&t++}return t*ri.N3}static isWhiteHorizontal(e,t,r){t=Math.max(t,0),r=Math.min(r,e.length);for(let n=t;n<r;n++)if(1===e[n])return!1;return!0}static isWhiteVertical(e,t,r,n){r=Math.max(r,0),n=Math.min(n,e.length);for(let i=r;i<n;i++)if(1===e[i][t])return!1;return!0}static applyMaskPenaltyRule4(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++){let i=r[e];for(let e=0;e<n;e++)1===i[e]&&t++}let a=e.getHeight()*e.getWidth();return Math.floor(10*Math.abs(2*t-a)/a)*ri.N4}static getDataMaskBit(e,t,r){let n,i;switch(e){case 0:n=r+t&1;break;case 1:n=1&r;break;case 2:n=t%3;break;case 3:n=(r+t)%3;break;case 4:n=Math.floor(r/2)+Math.floor(t/3)&1;break;case 5:n=(1&(i=r*t))+i%3;break;case 6:n=(1&(i=r*t))+i%3&1;break;case 7:n=(i=r*t)%3+(r+t&1)&1;break;default:throw new N("Invalid mask pattern: "+e)}return 0===n}static applyMaskPenaltyRule1Internal(e,t){let r=0,n=t?e.getHeight():e.getWidth(),i=t?e.getWidth():e.getHeight(),a=e.getArray();for(let e=0;e<n;e++){let n=0,o=-1;for(let s=0;s<i;s++){let i=t?a[e][s]:a[s][e];i===o?n++:(n>=5&&(r+=ri.N1+(n-5)),n=1,o=i)}n>=5&&(r+=ri.N1+(n-5))}return r}}ri.N1=3,ri.N2=3,ri.N3=40,ri.N4=10;class ra{constructor(e,t){this.width=e,this.height=t;const r=Array(t);for(let n=0;n!==t;n++)r[n]=new Uint8Array(e);this.bytes=r}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,r){this.bytes[t][e]=r}setBoolean(e,t,r){this.bytes[t][e]=+!!r}clear(e){for(let t of this.bytes)k.fill(t,e)}equals(e){if(!(e instanceof ra)||this.width!==e.width||this.height!==e.height)return!1;for(let t=0,r=this.height;t<r;++t){let r=this.bytes[t],n=e.bytes[t];for(let e=0,t=this.width;e<t;++e)if(r[e]!==n[e])return!1}return!0}toString(){let e=new G;for(let t=0,r=this.height;t<r;++t){let r=this.bytes[t];for(let t=0,n=this.width;t<n;++t)switch(r[t]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ")}e.append("\n")}return e.toString()}}class ro{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){let e=new G;return e.append("<<\n"),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append("\n ecLevel: "),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append("\n version: "),e.append(this.version?this.version.toString():"null"),e.append("\n maskPattern: "),e.append(this.maskPattern.toString()),this.matrix?(e.append("\n matrix:\n"),e.append(this.matrix.toString())):e.append("\n matrix: null\n"),e.append(">>\n"),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<ro.NUM_MASK_PATTERNS}}ro.NUM_MASK_PATTERNS=8;class rs extends x{}rs.kind="WriterException";class rl{static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,r,n,i){rl.clearMatrix(i),rl.embedBasicPatterns(r,i),rl.embedTypeInfo(t,n,i),rl.maybeEmbedVersionInfo(r,i),rl.embedDataBits(e,n,i)}static embedBasicPatterns(e,t){rl.embedPositionDetectionPatternsAndSeparators(t),rl.embedDarkDotAtLeftBottomCorner(t),rl.maybeEmbedPositionAdjustmentPatterns(e,t),rl.embedTimingPatterns(t)}static embedTypeInfo(e,t,r){let n=new z;rl.makeTypeInfoBits(e,t,n);for(let e=0,t=n.getSize();e<t;++e){let t=n.get(n.getSize()-1-e),i=rl.TYPE_INFO_COORDINATES[e],a=i[0],o=i[1];if(r.setBoolean(a,o,t),e<8){let n=r.getWidth()-e-1;r.setBoolean(n,8,t)}else{let n=r.getHeight()-7+(e-8);r.setBoolean(8,n,t)}}}static maybeEmbedVersionInfo(e,t){if(7>e.getVersionNumber())return;let r=new z;rl.makeVersionInfoBits(e,r);let n=17;for(let e=0;e<6;++e)for(let i=0;i<3;++i){let a=r.get(n);n--,t.setBoolean(e,t.getHeight()-11+i,a),t.setBoolean(t.getHeight()-11+i,e,a)}}static embedDataBits(e,t,r){let n=0,i=-1,a=r.getWidth()-1,o=r.getHeight()-1;for(;a>0;){for(6===a&&(a-=1);o>=0&&o<r.getHeight();){for(let i=0;i<2;++i){let s,l=a-i;rl.isEmpty(r.get(l,o))&&(n<e.getSize()?(s=e.get(n),++n):s=!1,255!==t&&ri.getDataMaskBit(t,l,o)&&(s=!s),r.setBoolean(l,o,s))}o+=i}o+=i=-i,a-=2}if(n!==e.getSize())throw new rs("Not all bits consumed: "+n+"/"+e.getSize())}static findMSBSet(e){return 32-F.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(0===t)throw new N("0 polynomial");let r=rl.findMSBSet(t);for(e<<=r-1;rl.findMSBSet(e)>=r;)e^=t<<rl.findMSBSet(e)-r;return e}static makeTypeInfoBits(e,t,r){if(!ro.isValidMaskPattern(t))throw new rs("Invalid mask pattern");let n=e.getBits()<<3|t;r.appendBits(n,5);let i=rl.calculateBCHCode(n,rl.TYPE_INFO_POLY);r.appendBits(i,10);let a=new z;if(a.appendBits(rl.TYPE_INFO_MASK_PATTERN,15),r.xor(a),15!==r.getSize())throw new rs("should not happen but we got: "+r.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);let r=rl.calculateBCHCode(e.getVersionNumber(),rl.VERSION_INFO_POLY);if(t.appendBits(r,12),18!==t.getSize())throw new rs("should not happen but we got: "+t.getSize())}static isEmpty(e){return 255===e}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){let r=(t+1)%2;rl.isEmpty(e.get(t,6))&&e.setNumber(t,6,r),rl.isEmpty(e.get(6,t))&&e.setNumber(6,t,r)}}static embedDarkDotAtLeftBottomCorner(e){if(0===e.get(8,e.getHeight()-8))throw new rs;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,r){for(let n=0;n<8;++n){if(!rl.isEmpty(r.get(e+n,t)))throw new rs;r.setNumber(e+n,t,0)}}static embedVerticalSeparationPattern(e,t,r){for(let n=0;n<7;++n){if(!rl.isEmpty(r.get(e,t+n)))throw new rs;r.setNumber(e,t+n,0)}}static embedPositionAdjustmentPattern(e,t,r){for(let n=0;n<5;++n){let i=rl.POSITION_ADJUSTMENT_PATTERN[n];for(let a=0;a<5;++a)r.setNumber(e+a,t+n,i[a])}}static embedPositionDetectionPattern(e,t,r){for(let n=0;n<7;++n){let i=rl.POSITION_DETECTION_PATTERN[n];for(let a=0;a<7;++a)r.setNumber(e+a,t+n,i[a])}}static embedPositionDetectionPatternsAndSeparators(e){let t=rl.POSITION_DETECTION_PATTERN[0].length;rl.embedPositionDetectionPattern(0,0,e),rl.embedPositionDetectionPattern(e.getWidth()-t,0,e),rl.embedPositionDetectionPattern(0,e.getWidth()-t,e),rl.embedHorizontalSeparationPattern(0,7,e),rl.embedHorizontalSeparationPattern(e.getWidth()-8,7,e),rl.embedHorizontalSeparationPattern(0,e.getWidth()-8,e),rl.embedVerticalSeparationPattern(7,0,e),rl.embedVerticalSeparationPattern(e.getHeight()-7-1,0,e),rl.embedVerticalSeparationPattern(7,e.getHeight()-7,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(2>e.getVersionNumber())return;let r=e.getVersionNumber()-1,n=rl.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r];for(let e=0,r=n.length;e!==r;e++){let i=n[e];if(i>=0)for(let e=0;e!==r;e++){let r=n[e];r>=0&&rl.isEmpty(t.get(r,i))&&rl.embedPositionAdjustmentPattern(r-2,i-2,t)}}}}rl.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),rl.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),rl.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),rl.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),rl.VERSION_INFO_POLY=7973,rl.TYPE_INFO_POLY=1335,rl.TYPE_INFO_MASK_PATTERN=21522;class ru{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class rc{static calculateMaskPenalty(e){return ri.applyMaskPenaltyRule1(e)+ri.applyMaskPenaltyRule2(e)+ri.applyMaskPenaltyRule3(e)+ri.applyMaskPenaltyRule4(e)}static encode(e,t,r=null){let n,i=rc.DEFAULT_BYTE_MODE_ENCODING,a=null!==r&&void 0!==r.get(rr.CHARACTER_SET);a&&(i=r.get(rr.CHARACTER_SET).toString());let o=this.chooseMode(e,i),s=new z;if(o===tI.BYTE&&(a||rc.DEFAULT_BYTE_MODE_ENCODING!==i)){let e=H.getCharacterSetECIByName(i);void 0!==e&&this.appendECI(e,s)}this.appendModeInfo(o,s);let l=new z;if(this.appendBytes(e,o,l,i),null!==r&&void 0!==r.get(rr.QR_VERSION)){let e=Number.parseInt(r.get(rr.QR_VERSION).toString(),10);n=tA.getVersionForNumber(e);let i=this.calculateBitsNeeded(o,s,l,n);if(!this.willFit(i,n,t))throw new rs("Data too big for requested version")}else n=this.recommendVersion(t,o,s,l);let u=new z;u.appendBitArray(s);let c=o===tI.BYTE?l.getSizeInBytes():e.length;this.appendLengthInfo(c,n,o,u),u.appendBitArray(l);let h=n.getECBlocksForLevel(t),d=n.getTotalCodewords()-h.getTotalECCodewords();this.terminateBits(d,u);let f=this.interleaveWithECBytes(u,n.getTotalCodewords(),d,h.getNumBlocks()),g=new ro;g.setECLevel(t),g.setMode(o),g.setVersion(n);let p=n.getDimensionForVersion(),v=new ra(p,p),y=this.chooseMaskPattern(f,t,n,v);return g.setMaskPattern(y),rl.buildMatrix(f,t,n,y,v),g.setMatrix(v),g}static recommendVersion(e,t,r,n){let i=this.calculateBitsNeeded(t,r,n,tA.getVersionForNumber(1)),a=this.chooseVersion(i,e),o=this.calculateBitsNeeded(t,r,n,a);return this.chooseVersion(o,e)}static calculateBitsNeeded(e,t,r,n){return t.getSize()+e.getCharacterCountBits(n)+r.getSize()}static getAlphanumericCode(e){return e<rc.ALPHANUMERIC_TABLE.length?rc.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(H.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return tI.KANJI;let r=!1,n=!1;for(let t=0,i=e.length;t<i;++t){let i=e.charAt(t);if(rc.isDigit(i))r=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return tI.BYTE;n=!0}}return n?tI.ALPHANUMERIC:r?tI.NUMERIC:tI.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=Y.encode(e,H.SJIS)}catch(e){return!1}let r=t.length;if(r%2!=0)return!1;for(let e=0;e<r;e+=2){let r=255&t[e];if((r<129||r>159)&&(r<224||r>235))return!1}return!0}static chooseMaskPattern(e,t,r,n){let i=Number.MAX_SAFE_INTEGER,a=-1;for(let o=0;o<ro.NUM_MASK_PATTERNS;o++){rl.buildMatrix(e,t,r,o,n);let s=this.calculateMaskPenalty(n);s<i&&(i=s,a=o)}return a}static chooseVersion(e,t){for(let r=1;r<=40;r++){let n=tA.getVersionForNumber(r);if(rc.willFit(e,n,t))return n}throw new rs("Data too big")}static willFit(e,t,r){return t.getTotalCodewords()-t.getECBlocksForLevel(r).getTotalECCodewords()>=(e+7)/8}static terminateBits(e,t){let r=8*e;if(t.getSize()>r)throw new rs("data bits cannot fit in the QR Code"+t.getSize()+" > "+r);for(let e=0;e<4&&t.getSize()<r;++e)t.appendBit(!1);let n=7&t.getSize();if(n>0)for(let e=n;e<8;e++)t.appendBit(!1);let i=e-t.getSizeInBytes();for(let e=0;e<i;++e)t.appendBits((1&e)==0?236:17,8);if(t.getSize()!==r)throw new rs("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,r,n,i,a){if(n>=r)throw new rs("Block ID too large");let o=e%r,s=r-o,l=Math.floor(e/r),u=Math.floor(t/r),c=u+1,h=l-u,d=l+1-c;if(h!==d)throw new rs("EC bytes mismatch");if(r!==s+o)throw new rs("RS blocks mismatch");if(e!==(u+h)*s+(c+d)*o)throw new rs("Total bytes mismatch");n<s?(i[0]=u,a[0]=h):(i[0]=c,a[0]=d)}static interleaveWithECBytes(e,t,r,n){if(e.getSizeInBytes()!==r)throw new rs("Number of bits and data bytes does not match");let i=0,a=0,o=0,s=[];for(let l=0;l<n;++l){let u=new Int32Array(1),c=new Int32Array(1);rc.getNumDataBytesAndNumECBytesForBlockID(t,r,n,l,u,c);let h=u[0],d=new Uint8Array(h);e.toBytes(8*i,d,0,h);let f=rc.generateECBytes(d,c[0]);s.push(new ru(d,f)),a=Math.max(a,h),o=Math.max(o,f.length),i+=u[0]}if(r!==i)throw new rs("Data bytes does not match offset");let l=new z;for(let e=0;e<a;++e)for(let t of s){let r=t.getDataBytes();e<r.length&&l.appendBits(r[e],8)}for(let e=0;e<o;++e)for(let t of s){let r=t.getErrorCorrectionBytes();e<r.length&&l.appendBits(r[e],8)}if(t!==l.getSizeInBytes())throw new rs("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){let r=e.length,n=new Int32Array(r+t);for(let t=0;t<r;t++)n[t]=255&e[t];new rn(ec.QR_CODE_FIELD_256).encode(n,t);let i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=n[r+e];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,r,n){let i=r.getCharacterCountBits(t);if(e>=1<<i)throw new rs(e+" is bigger than "+((1<<i)-1));n.appendBits(e,i)}static appendBytes(e,t,r,n){switch(t){case tI.NUMERIC:rc.appendNumericBytes(e,r);break;case tI.ALPHANUMERIC:rc.appendAlphanumericBytes(e,r);break;case tI.BYTE:rc.append8BitBytes(e,r,n);break;case tI.KANJI:rc.appendKanjiBytes(e,r);break;default:throw new rs("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){let t=rc.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){let r=e.length,n=0;for(;n<r;){let i=rc.getDigit(e.charAt(n));if(n+2<r){let r=rc.getDigit(e.charAt(n+1)),a=rc.getDigit(e.charAt(n+2));t.appendBits(100*i+10*r+a,10),n+=3}else if(n+1<r){let r=rc.getDigit(e.charAt(n+1));t.appendBits(10*i+r,7),n+=2}else t.appendBits(i,4),n++}}static appendAlphanumericBytes(e,t){let r=e.length,n=0;for(;n<r;){let i=rc.getAlphanumericCode(e.charCodeAt(n));if(-1===i)throw new rs;if(n+1<r){let r=rc.getAlphanumericCode(e.charCodeAt(n+1));if(-1===r)throw new rs;t.appendBits(45*i+r,11),n+=2}else t.appendBits(i,6),n++}}static append8BitBytes(e,t,r){let n;try{n=Y.encode(e,r)}catch(e){throw new rs(e)}for(let e=0,r=n.length;e!==r;e++){let r=n[e];t.appendBits(r,8)}}static appendKanjiBytes(e,t){let r;try{r=Y.encode(e,H.SJIS)}catch(e){throw new rs(e)}let n=r.length;for(let e=0;e<n;e+=2){let n=(255&r[e])<<8|255&r[e+1],i=-1;if(n>=33088&&n<=40956?i=n-33088:n>=57408&&n<=60351&&(i=n-49472),-1===i)throw new rs("Invalid byte sequence");let a=(i>>8)*192+(255&i);t.appendBits(a,13)}}static appendECI(e,t){t.appendBits(tI.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}rc.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),rc.DEFAULT_BYTE_MODE_ENCODING=H.UTF8.getName();class rh{write(e,t,r,n=null){if(0===e.length)throw new N("Found empty contents");if(t<0||r<0)throw new N("Requested dimensions are too small: "+t+"x"+r);let i=ty.L,a=rh.QUIET_ZONE_SIZE;null!==n&&(void 0!==n.get(rr.ERROR_CORRECTION)&&(i=ty.fromString(n.get(rr.ERROR_CORRECTION).toString())),void 0!==n.get(rr.MARGIN)&&(a=Number.parseInt(n.get(rr.MARGIN).toString(),10)));let o=rc.encode(e,i,n);return this.renderResult(o,t,r,a)}writeToDom(e,t,r,n,i=null){"string"==typeof e&&(e=document.querySelector(e));let a=this.write(t,r,n,i);e&&e.appendChild(a)}renderResult(e,t,r,n){let i=e.getMatrix();if(null===i)throw new ed;let a=i.getWidth(),o=i.getHeight(),s=a+2*n,l=o+2*n,u=Math.max(t,s),c=Math.max(r,l),h=Math.min(Math.floor(u/s),Math.floor(c/l)),d=Math.floor((u-a*h)/2),f=Math.floor((c-o*h)/2),g=this.createSVGElement(u,c);for(let e=0,t=f;e<o;e++,t+=h)for(let r=0,n=d;r<a;r++,n+=h)if(1===i.get(r,e)){let e=this.createSvgRectElement(n,t,h,h);g.appendChild(e)}return g}createSVGElement(e,t){let r=document.createElementNS(rh.SVG_NS,"svg");return r.setAttributeNS(null,"height",e.toString()),r.setAttributeNS(null,"width",t.toString()),r}createSvgRectElement(e,t,r,n){let i=document.createElementNS(rh.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",r.toString()),i.setAttributeNS(null,"width",n.toString()),i.setAttributeNS(null,"fill","#000000"),i}}rh.QUIET_ZONE_SIZE=4,rh.SVG_NS="http://www.w3.org/2000/svg";class rd{encode(e,t,r,n,i){if(0===e.length)throw new N("Found empty contents");if(t!==ei.QR_CODE)throw new N("Can only encode QR_CODE, but got "+t);if(r<0||n<0)throw new N(`Requested dimensions are too small: ${r}x${n}`);let a=ty.L,o=rd.QUIET_ZONE_SIZE;null!==i&&(void 0!==i.get(rr.ERROR_CORRECTION)&&(a=ty.fromString(i.get(rr.ERROR_CORRECTION).toString())),void 0!==i.get(rr.MARGIN)&&(o=Number.parseInt(i.get(rr.MARGIN).toString(),10)));let s=rc.encode(e,a,i);return rd.renderResult(s,r,n,o)}static renderResult(e,t,r,n){let i=e.getMatrix();if(null===i)throw new ed;let a=i.getWidth(),o=i.getHeight(),s=a+2*n,l=o+2*n,u=Math.max(t,s),c=Math.max(r,l),h=Math.min(Math.floor(u/s),Math.floor(c/l)),d=Math.floor((u-a*h)/2),f=Math.floor((c-o*h)/2),g=new W(u,c);for(let e=0,t=f;e<o;e++,t+=h)for(let r=0,n=d;r<a;r++,n+=h)1===i.get(r,e)&&g.setRegion(n,t,h,h);return g}}rd.QUIET_ZONE_SIZE=4;class rf extends K{constructor(e,t,r,n,i,a,o,s){if(super(a,o),this.yuvData=e,this.dataWidth=t,this.dataHeight=r,this.left=n,this.top=i,n+a>t||i+o>r)throw new N("Crop rectangle does not fit within image data.");s&&this.reverseHorizontal(a,o)}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);let r=this.getWidth();(null==t||t.length<r)&&(t=new Uint8ClampedArray(r));let n=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.yuvData,n,t,0,r),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;let r=e*t,n=new Uint8ClampedArray(r),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.yuvData,i,n,0,r),n;for(let r=0;r<t;r++){let t=r*e;P.arraycopy(this.yuvData,i,n,t,e),i+=this.dataWidth}return n}isCropSupported(){return!0}crop(e,t,r,n){return new rf(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,r,n,!1)}renderThumbnail(){let e=this.getWidth()/rf.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/rf.THUMBNAIL_SCALE_FACTOR,r=new Int32Array(e*t),n=this.yuvData,i=this.top*this.dataWidth+this.left;for(let a=0;a<t;a++){let t=a*e;for(let a=0;a<e;a++){let e=255&n[i+a*rf.THUMBNAIL_SCALE_FACTOR];r[t+a]=0xff000000|65793*e}i+=this.dataWidth*rf.THUMBNAIL_SCALE_FACTOR}return r}getThumbnailWidth(){return this.getWidth()/rf.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/rf.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){let r=this.yuvData;for(let n=0,i=this.top*this.dataWidth+this.left;n<t;n++,i+=this.dataWidth){let t=i+e/2;for(let n=i,a=i+e-1;n<t;n++,a--){let e=r[n];r[n]=r[a],r[a]=e}}}invert(){return new $(this)}}rf.THUMBNAIL_SCALE_FACTOR=2;class rg extends K{constructor(e,t,r,n,i,a,o){if(super(t,r),this.dataWidth=n,this.dataHeight=i,this.left=a,this.top=o,4===e.BYTES_PER_ELEMENT){const n=t*r,i=new Uint8ClampedArray(n);for(let t=0;t<n;t++){const r=e[t],n=r>>16&255,a=r>>7&510,o=255&r;i[t]=(n+a+o)/4&255}this.luminances=i}else this.luminances=e;if(void 0===n&&(this.dataWidth=t),void 0===i&&(this.dataHeight=r),void 0===a&&(this.left=0),void 0===o&&(this.top=0),this.left+t>this.dataWidth||this.top+r>this.dataHeight)throw new N("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);let r=this.getWidth();(null==t||t.length<r)&&(t=new Uint8ClampedArray(r));let n=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.luminances,n,t,0,r),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;let r=e*t,n=new Uint8ClampedArray(r),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.luminances,i,n,0,r),n;for(let r=0;r<t;r++){let t=r*e;P.arraycopy(this.luminances,i,n,t,e),i+=this.dataWidth}return n}isCropSupported(){return!0}crop(e,t,r,n){return new rg(this.luminances,r,n,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new $(this)}}class rp extends H{static forName(e){return this.getCharacterSetECIByName(e)}}class rm{}rm.ISO_8859_1=H.ISO8859_1;class rv{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class ry{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class rw{constructor(e){this.previous=e}getPrevious(){return this.previous}}class rE extends rw{constructor(e,t,r){super(e),this.value=t,this.bitCount=r}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new rE(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new rE(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+F.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class rb extends rE{constructor(e,t,r){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=r}appendTo(e,t){for(let r=0;r<this.binaryShiftByteCount;r++)(0===r||31===r&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):0===r?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+r],8)}addBinaryShift(e,t){return new rb(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function rA(e,t,r){return new rE(e,t,r)}let rC=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],r_=new rE(null,0,0),rS=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])],rI=function(e){for(let t of e)k.fill(t,-1);return e[0][4]=0,e[1][4]=0,e[1][0]=28,e[3][4]=0,e[2][4]=0,e[2][0]=15,e}(k.createInt32Array(6,6));class rT{constructor(e,t,r,n){this.token=e,this.mode=t,this.binaryShiftByteCount=r,this.bitCount=n}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let r=this.bitCount,n=this.token;if(e!==this.mode){let t=rS[this.mode][e];n=rA(n,65535&t,t>>16),r+=t>>16}let i=2===e?4:5;return new rT(n=rA(n,t,i),e,0,r+i)}shiftAndAppend(e,t){let r=this.token,n=2===this.mode?4:5;return r=rA(r,rI[this.mode][e],n),new rT(r=rA(r,t,5),this.mode,0,this.bitCount+n+5)}addBinaryShiftChar(e){let t=this.token,r=this.mode,n=this.bitCount;if(4===this.mode||2===this.mode){let e=rS[r][0];t=rA(t,65535&e,e>>16),n+=e>>16,r=0}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,a=new rT(t,r,this.binaryShiftByteCount+1,n+i);return 2078===a.binaryShiftByteCount&&(a=a.endBinaryShift(e+1)),a}endBinaryShift(e){if(0===this.binaryShiftByteCount)return this;let t=this.token;return new rT(t=new rb(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(rS[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=rT.calculateBinaryShiftCost(e)-rT.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;null!==r;r=r.getPrevious())t.unshift(r);let r=new z;for(let n of t)n.appendTo(r,e);return r}toString(){return X.format("%s bits=%d bytes=%d",rC[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:10*(e.binaryShiftByteCount>0)}}rT.INITIAL_STATE=new rT(r_,0,0,0);let rx=function(e){let t=X.getCharCode(" "),r=X.getCharCode("."),n=X.getCharCode(",");e[0][t]=1;let i=X.getCharCode("Z"),a=X.getCharCode("A");for(let t=a;t<=i;t++)e[0][t]=t-a+2;e[1][t]=1;let o=X.getCharCode("z"),s=X.getCharCode("a");for(let t=s;t<=o;t++)e[1][t]=t-s+2;e[2][t]=1;let l=X.getCharCode("9"),u=X.getCharCode("0");for(let t=u;t<=l;t++)e[2][t]=t-u+2;e[2][n]=12,e[2][r]=13;let c=["\0"," ","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\b"," ","\n","\v","\f","\r","\x1b","\x1c","\x1d","\x1e","\x1f","@","\\","^","_","`","|","~",""];for(let t=0;t<c.length;t++)e[3][X.getCharCode(c[t])]=t;let h=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let t=0;t<h.length;t++)X.getCharCode(h[t])>0&&(e[4][X.getCharCode(h[t])]=t);return e}(k.createInt32Array(5,256));class rD{constructor(e){this.text=e}encode(){let e=X.getCharCode(" "),t=X.getCharCode("\n"),r=ry.singletonList(rT.INITIAL_STATE);for(let n=0;n<this.text.length;n++){let i,a=n+1<this.text.length?this.text[n+1]:0;switch(this.text[n]){case X.getCharCode("\r"):i=2*(a===t);break;case X.getCharCode("."):i=3*(a===e);break;case X.getCharCode(","):i=4*(a===e);break;case X.getCharCode(":"):i=5*(a===e);break;default:i=0}i>0?(r=rD.updateStateListForPair(r,n,i),n++):r=this.updateStateListForChar(r,n)}return ry.min(r,(e,t)=>e.getBitCount()-t.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){let r=[];for(let n of e)this.updateStateForChar(n,t,r);return rD.simplifyStates(r)}updateStateForChar(e,t,r){let n=255&this.text[t],i=rx[e.getMode()][n]>0,a=null;for(let o=0;o<=4;o++){let s=rx[o][n];if(s>0){if(null==a&&(a=e.endBinaryShift(t)),!i||o===e.getMode()||2===o){let e=a.latchAndAppend(o,s);r.push(e)}if(!i&&rI[e.getMode()][o]>=0){let e=a.shiftAndAppend(o,s);r.push(e)}}}if(e.getBinaryShiftByteCount()>0||0===rx[e.getMode()][n]){let n=e.addBinaryShiftChar(t);r.push(n)}}static updateStateListForPair(e,t,r){let n=[];for(let i of e)this.updateStateForPair(i,t,r,n);return this.simplifyStates(n)}static updateStateForPair(e,t,r,n){let i=e.endBinaryShift(t);if(n.push(i.latchAndAppend(4,r)),4!==e.getMode()&&n.push(i.shiftAndAppend(4,r)),3===r||4===r){let e=i.latchAndAppend(2,16-r).latchAndAppend(2,1);n.push(e)}if(e.getBinaryShiftByteCount()>0){let r=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);n.push(r)}}static simplifyStates(e){let t=[];for(let r of e){let e=!0;for(let n of t){if(n.isBetterThanOrEqualTo(r)){e=!1;break}r.isBetterThanOrEqualTo(n)&&(t=t.filter(e=>e!==n))}e&&t.push(r)}return t}}class rN{static encodeBytes(e){return rN.encode(e,rN.DEFAULT_EC_PERCENT,rN.DEFAULT_AZTEC_LAYERS)}static encode(e,t,r){let n,i,a,o,s,l,u=new rD(e).encode(),c=F.truncDivision(u.getSize()*t,100)+11,h=u.getSize()+c;if(r!==rN.DEFAULT_AZTEC_LAYERS){if(n=r<0,(i=Math.abs(r))>(n?rN.MAX_NB_BITS_COMPACT:rN.MAX_NB_BITS))throw new N(X.format("Illegal value %s for layers",r));let e=(a=rN.totalBitsInLayer(i,n))-a%(o=rN.WORD_SIZE[i]);if((s=rN.stuffBits(u,o)).getSize()+c>e||n&&s.getSize()>64*o)throw new N("Data to large for user specified layer")}else{o=0,s=null;for(let e=0;;e++){if(e>rN.MAX_NB_BITS)throw new N("Data too large for an Aztec code");if(i=(n=e<=3)?e+1:e,h>(a=rN.totalBitsInLayer(i,n)))continue;(null==s||o!==rN.WORD_SIZE[i])&&(o=rN.WORD_SIZE[i],s=rN.stuffBits(u,o));let t=a-a%o;if(!(n&&s.getSize()>64*o)&&s.getSize()+c<=t)break}}let d=rN.generateCheckWords(s,a,o),f=s.getSize()/o,g=rN.generateModeMessage(n,i,f),p=(n?11:14)+4*i,v=new Int32Array(p);if(n){l=p;for(let e=0;e<v.length;e++)v[e]=e}else{l=p+1+2*F.truncDivision(F.truncDivision(p,2)-1,15);let e=F.truncDivision(p,2),t=F.truncDivision(l,2);for(let r=0;r<e;r++){let n=r+F.truncDivision(r,15);v[e-r-1]=t-n-1,v[e+r]=t+n+1}}let y=new W(l);for(let e=0,t=0;e<i;e++){let r=(i-e)*4+(n?9:12);for(let n=0;n<r;n++){let i=2*n;for(let a=0;a<2;a++)d.get(t+i+a)&&y.set(v[2*e+a],v[2*e+n]),d.get(t+2*r+i+a)&&y.set(v[2*e+n],v[p-1-2*e-a]),d.get(t+4*r+i+a)&&y.set(v[p-1-2*e-a],v[p-1-2*e-n]),d.get(t+6*r+i+a)&&y.set(v[p-1-2*e-n],v[2*e+a])}t+=8*r}if(rN.drawModeMessage(y,n,l,g),n)rN.drawBullsEye(y,F.truncDivision(l,2),5);else{rN.drawBullsEye(y,F.truncDivision(l,2),7);for(let e=0,t=0;e<F.truncDivision(p,2)-1;e+=15,t+=16)for(let e=1&F.truncDivision(l,2);e<l;e+=2)y.set(F.truncDivision(l,2)-t,e),y.set(F.truncDivision(l,2)+t,e),y.set(e,F.truncDivision(l,2)-t),y.set(e,F.truncDivision(l,2)+t)}let w=new rv;return w.setCompact(n),w.setSize(l),w.setLayers(i),w.setCodeWords(f),w.setMatrix(y),w}static drawBullsEye(e,t,r){for(let n=0;n<r;n+=2)for(let r=t-n;r<=t+n;r++)e.set(r,t-n),e.set(r,t+n),e.set(t-n,r),e.set(t+n,r);e.set(t-r,t-r),e.set(t-r+1,t-r),e.set(t-r,t-r+1),e.set(t+r,t-r),e.set(t+r,t-r+1),e.set(t+r,t+r-1)}static generateModeMessage(e,t,r){let n=new z;return e?(n.appendBits(t-1,2),n.appendBits(r-1,6),n=rN.generateCheckWords(n,28,4)):(n.appendBits(t-1,5),n.appendBits(r-1,11),n=rN.generateCheckWords(n,40,4)),n}static drawModeMessage(e,t,r,n){let i=F.truncDivision(r,2);if(t)for(let t=0;t<7;t++){let r=i-3+t;n.get(t)&&e.set(r,i-5),n.get(t+7)&&e.set(i+5,r),n.get(20-t)&&e.set(r,i+5),n.get(27-t)&&e.set(i-5,r)}else for(let t=0;t<10;t++){let r=i-5+t+F.truncDivision(t,5);n.get(t)&&e.set(r,i-7),n.get(t+10)&&e.set(i+7,r),n.get(29-t)&&e.set(r,i+7),n.get(39-t)&&e.set(i-7,r)}}static generateCheckWords(e,t,r){let n=e.getSize()/r,i=new rn(rN.getGF(r)),a=F.truncDivision(t,r),o=rN.bitsToWords(e,r,a);i.encode(o,a-n);let s=t%r,l=new z;for(let e of(l.appendBits(0,s),Array.from(o)))l.appendBits(e,r);return l}static bitsToWords(e,t,r){let n,i,a=new Int32Array(r);for(n=0,i=e.getSize()/t;n<i;n++){let r=0;for(let i=0;i<t;i++)r|=e.get(n*t+i)?1<<t-i-1:0;a[n]=r}return a}static getGF(e){switch(e){case 4:return ec.AZTEC_PARAM;case 6:return ec.AZTEC_DATA_6;case 8:return ec.AZTEC_DATA_8;case 10:return ec.AZTEC_DATA_10;case 12:return ec.AZTEC_DATA_12;default:throw new N("Unsupported word size "+e)}}static stuffBits(e,t){let r=new z,n=e.getSize(),i=(1<<t)-2;for(let a=0;a<n;a+=t){let o=0;for(let r=0;r<t;r++)(a+r>=n||e.get(a+r))&&(o|=1<<t-1-r);(o&i)===i?(r.appendBits(o&i,t),a--):(o&i)==0?(r.appendBits(1|o,t),a--):r.appendBits(o,t)}return r}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}rN.DEFAULT_EC_PERCENT=33,rN.DEFAULT_AZTEC_LAYERS=0,rN.MAX_NB_BITS=32,rN.MAX_NB_BITS_COMPACT=4,rN.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class rM{encode(e,t,r,n){return this.encodeWithHints(e,t,r,n,null)}encodeWithHints(e,t,r,n,i){let a=rm.ISO_8859_1,o=rN.DEFAULT_EC_PERCENT,s=rN.DEFAULT_AZTEC_LAYERS;return null!=i&&(i.has(rr.CHARACTER_SET)&&(a=rp.forName(i.get(rr.CHARACTER_SET).toString())),i.has(rr.ERROR_CORRECTION)&&(o=F.parseInt(i.get(rr.ERROR_CORRECTION).toString())),i.has(rr.AZTEC_LAYERS)&&(s=F.parseInt(i.get(rr.AZTEC_LAYERS).toString()))),rM.encodeLayers(e,t,r,n,a,o,s)}static encodeLayers(e,t,r,n,i,a,o){if(t!==ei.AZTEC)throw new N("Can only encode AZTEC, but got "+t);let s=rN.encode(X.getBytes(e,i),a,o);return rM.renderResult(s,r,n)}static renderResult(e,t,r){let n=e.getMatrix();if(null==n)throw new ed;let i=n.getWidth(),a=n.getHeight(),o=Math.max(t,i),s=Math.max(r,a),l=Math.min(o/i,s/a),u=(o-i*l)/2,c=(s-a*l)/2,h=new W(o,s);for(let e=0,t=c;e<a;e++,t+=l)for(let r=0,a=u;r<i;r++,a+=l)n.get(r,e)&&h.setRegion(a,t,l,l);return h}}e.AbstractExpandedDecoder=e1,e.ArgumentException=D,e.ArithmeticException=eu,e.AztecCode=rv,e.AztecCodeReader=eT,e.AztecCodeWriter=rM,e.AztecDecoder=eg,e.AztecDetector=eI,e.AztecDetectorResult=ew,e.AztecEncoder=rN,e.AztecHighLevelEncoder=rD,e.AztecPoint=eS,e.BarcodeFormat=ei,e.Binarizer=O,e.BinaryBitmap=M,e.BitArray=z,e.BitMatrix=W,e.BitSource=tf,e.BrowserAztecCodeReader=class extends er{constructor(e=500){super(new eT,e)}},e.BrowserBarcodeReader=class extends er{constructor(e=500,t){super(new ts(t),e,t)}},e.BrowserCodeReader=er,e.BrowserDatamatrixCodeReader=class extends er{constructor(e=500){super(new tv,e)}},e.BrowserMultiFormatReader=class extends er{constructor(e=null,t=500){const r=new rt;r.setHints(e),super(r,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}},e.BrowserPDF417Reader=class extends er{constructor(e=500){super(new t9,e)}},e.BrowserQRCodeReader=class extends er{constructor(e=500){super(new tL,e)}},e.BrowserQRCodeSvgWriter=rh,e.CharacterSetECI=H,e.ChecksumException=R,e.Code128Reader=eD,e.Code39Reader=eN,e.DataMatrixDecodedBitStreamParser=tg,e.DataMatrixReader=tv,e.DecodeHintType=U,e.DecoderResult=eo,e.DefaultGridSampler=eC,e.DetectorResult=ey,e.EAN13Reader=ek,e.EncodeHintType=rr,e.Exception=x,e.FormatException=V,e.GenericGF=ec,e.GenericGFPoly=el,e.GlobalHistogramBinarizer=Z,e.GridSampler=eb,e.GridSamplerInstance=e_,e.HTMLCanvasElementLuminanceSource=J,e.HybridBinarizer=Q,e.ITFReader=eM,e.IllegalArgumentException=N,e.IllegalStateException=ed,e.InvertedLuminanceSource=$,e.LuminanceSource=K,e.MathUtils=ep,e.MultiFormatOneDReader=ts,e.MultiFormatReader=rt,e.MultiFormatWriter=class{encode(e,t,r,n,i){let a;if(t===ei.QR_CODE)a=new rd;else throw new N("No encoder available for format "+t);return a.encode(e,t,r,n,i)}},e.NotFoundException=q,e.OneDReader=ex,e.PDF417DecodedBitStreamParser=t5,e.PDF417DecoderErrorCorrection=tj,e.PDF417Reader=t9,e.PDF417ResultMetadata=tJ,e.PerspectiveTransform=eA,e.PlanarYUVLuminanceSource=rf,e.QRCodeByteMatrix=ra,e.QRCodeDataMask=tC,e.QRCodeDecodedBitStreamParser=tT,e.QRCodeDecoderErrorCorrectionLevel=ty,e.QRCodeDecoderFormatInformation=tw,e.QRCodeEncoder=rc,e.QRCodeEncoderQRCode=ro,e.QRCodeMaskUtil=ri,e.QRCodeMatrixUtil=rl,e.QRCodeMode=tI,e.QRCodeReader=tL,e.QRCodeVersion=tA,e.QRCodeWriter=rd,e.RGBLuminanceSource=rg,e.RSS14Reader=to,e.RSSExpandedReader=ti,e.ReaderException=re,e.ReedSolomonDecoder=ef,e.ReedSolomonEncoder=rn,e.ReedSolomonException=eh,e.Result=en,e.ResultMetadataType=ea,e.ResultPoint=ev,e.StringUtils=X,e.UnsupportedOperationException=j,e.VideoInputDevice=ee,e.WhiteRectangleDetector=eE,e.WriterException=rs,e.ZXingArrays=k,e.ZXingCharset=rp,e.ZXingInteger=F,e.ZXingStandardCharsets=rm,e.ZXingStringBuilder=G,e.ZXingStringEncoding=Y,e.ZXingSystem=P,e.createAbstractExpandedDecoder=tt,Object.defineProperty(e,"__esModule",{value:!0})}(t)},21194(e,t,r){"use strict";r.d(t,{k:()=>n});function n(e,t,r){var n=e.x,i=e.y,a=[],o=1/0,s=1/0;t.forEach(function(e){o=Math.min(o,e.x),s=Math.min(s,e.y)});for(var l=n-e.width/2-o,u=i-e.height/2-s,c=0;c<t.length;c++){var h=t[c],d=t[c<t.length-1?c+1:0],f=function(e,t,r,n){var i,a,o,s,l,u,c,h,d,f,g,p,v;if(i=t.y-e.y,o=e.x-t.x,l=t.x*e.y-e.x*t.y,d=i*r.x+o*r.y+l,f=i*n.x+o*n.y+l,0===d||0===f||!(d*f>0)){if((a=n.y-r.y,s=r.x-n.x,u=n.x*r.y-r.x*n.y,c=a*e.x+s*e.y+u,h=a*t.x+s*t.y+u,!(0!==c&&0!==h&&c*h>0))&&0!=(g=i*s-a*o))return p=Math.abs(g/2),{x:(v=o*u-s*l)<0?(v-p)/g:(v+p)/g,y:(v=a*l-i*u)<0?(v-p)/g:(v+p)/g}}}(e,r,{x:l+h.x,y:u+h.y},{x:l+d.x,y:u+d.y});f&&a.push(f)}return a.length?(a.length>1&&a.sort(function(e,t){var n=e.x-r.x,i=e.y-r.y,a=Math.sqrt(n*n+i*i),o=t.x-r.x,s=t.y-r.y,l=Math.sqrt(o*o+s*s);return a<l?-1:+(a!==l)}),a[0]):(console.log("NO INTERSECTION FOUND, RETURN NODE CENTER",e),e)}},84113(e,t,r){"use strict";function n(e,t){var r,n,i=e.x,a=e.y,o=t.x-i,s=t.y-a,l=e.width/2,u=e.height/2;return Math.abs(s)*l>Math.abs(o)*u?(s<0&&(u=-u),r=0===s?0:u*o/s,n=u):(o<0&&(l=-l),r=l,n=0===o?0:l*s/o),{x:i+r,y:a+n}}r.d(t,{C:()=>n})},10646(e,t,r){"use strict";r.d(t,{H:()=>i});var n=r(82933);function i(e,t){var r=e.append("foreignObject").attr("width","100000"),i=r.append("xhtml:div");i.attr("xmlns","http://www.w3.org/1999/xhtml");var a=t.label;switch(typeof a){case"function":i.insert(a);break;case"object":i.insert(function(){return a});break;default:i.html(a)}n.AV(i,t.labelStyle),i.style("display","inline-block"),i.style("white-space","nowrap");var o=i.node().getBoundingClientRect();return r.attr("width",o.width).attr("height",o.height),r}},82933(e,t,r){"use strict";r.d(t,{AV:()=>u,De:()=>a,c$:()=>h,gh:()=>o,nh:()=>c});var n=r(34963),i=r(89610);function a(e,t){return!!e.children(t).length}function o(e){return l(e.v)+":"+l(e.w)+":"+l(e.name)}var s=/:/g;function l(e){return e?String(e).replace(s,"\\:"):""}function u(e,t){t&&e.attr("style",t)}function c(e,t,r){t&&e.attr("class",t).attr("class",r+" "+e.attr("class"))}function h(e,t){var r=t.graph();if(n.A(r)){var a=r.transition;if(i.A(a))return a(e)}return e}},79552(e,t,r){"use strict";r.d(t,{Zp:()=>ef});var n=r(8058),i=r(5664),a=r(81349),o=r(39142),s=r(34098),l=r(74722),u=r(72897),c=r(697);class h{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return d(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&d(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,r=t._prev;r!==t;)e.push(JSON.stringify(r,f)),r=r._prev;return"["+e.join(", ")+"]"}}function d(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function f(e,t){if("_next"!==e&&"_prev"!==e)return t}var g=o.A(1);function p(e,t,r,i,a){var o=a?[]:void 0;return n.A(e.inEdges(i.v),function(n){var i=e.edge(n),s=e.node(n.v);a&&o.push({v:n.v,w:n.w}),s.out-=i,v(t,r,s)}),n.A(e.outEdges(i.v),function(n){var i=e.edge(n),a=n.w,o=e.node(a);o.in-=i,v(t,r,o)}),e.removeNode(i.v),o}function v(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var y=r(49304),w=r(13551),E=r(23068),b=r(34736),A=r(26666),C=r(36735),_=r(69592),S=r(86452),I=r(81052);function T(e,t,r,n){var a;do a=i.A(n);while(e.hasNode(a));return r.dummy=t,e.setNode(a,r),a}function x(e){var t=new c.T({multigraph:e.isMultigraph()}).setGraph(e.graph());return n.A(e.nodes(),function(r){e.children(r).length||t.setNode(r,e.node(r))}),n.A(e.edges(),function(r){t.setEdge(r,e.edge(r))}),t}function D(e,t){var r,n,i=e.x,a=e.y,o=t.x-i,s=t.y-a,l=e.width/2,u=e.height/2;if(!o&&!s)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*l>Math.abs(o)*u?(s<0&&(u=-u),r=u*o/s,n=u):(o<0&&(l=-l),r=l,n=l*s/o),{x:i+r,y:a+n}}function N(e){var t=l.A(u.A(R(e)+1),function(){return[]});return n.A(e.nodes(),function(r){var n=e.node(r),i=n.rank;_.A(i)||(t[i][n.order]=r)}),t}function M(e,t,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),T(e,"border",i,t)}function R(e){return b.A(l.A(e.nodes(),function(t){var r=e.node(t).rank;if(!_.A(r))return r}))}function O(e,t){var r=I.A();try{return t()}finally{console.log(e+" time: "+(I.A()-r)+"ms")}}function P(e,t){return t()}function B(e,t,r,n,i,a){var o=i[t][a-1],s=T(e,"border",{width:0,height:0,rank:a,borderType:t},r);i[t][a]=s,e.setParent(s,n),o&&e.setEdge(o,s,{weight:1})}function L(e){n.A(e.nodes(),function(t){k(e.node(t))}),n.A(e.edges(),function(t){k(e.edge(t))})}function k(e){var t=e.width;e.width=e.height,e.height=t}function F(e){e.y=-e.y}function z(e){var t=e.x;e.x=e.y,e.y=t}var U=r(88389);function V(e){var t={};n.A(e.sources(),function r(n){var i=e.node(n);if(a.A(t,n))return i.rank;t[n]=!0;var o=S.A(l.A(e.outEdges(n),function(t){return r(t.w)-e.edge(t).minlen}));return(o===1/0||null==o)&&(o=0),i.rank=o})}function H(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function j(e){var t,r,i,a,o=new c.T({directed:!1}),s=e.nodes()[0],l=e.nodeCount();for(o.setNode(s,{});t=o,r=e,n.A(t.nodes(),function e(i){n.A(r.nodeEdges(i),function(n){var a=n.v,o=i===a?n.w:a;t.hasNode(o)||H(r,n)||(t.setNode(o,{}),t.setEdge(i,o,{}),e(o))})}),t.nodeCount()<l;)i=function(e,t){return U.A(t.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return H(t,r)})}(o,e),a=o.hasNode(i.v)?H(e,i):-H(e,i),function(e,t,r){n.A(e.nodes(),function(e){t.node(e).rank+=r})}(o,e,a);return o}var Y=r(58334),X=r(96654);o.A(1),o.A(1);r(54110);function G(){}G.prototype=Error();var W=r(92049);function q(e,t,r){W.A(t)||(t=[t]);var i=(e.isDirected()?e.successors:e.neighbors).bind(e),o=[],s={};return n.A(t,function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);!function e(t,r,i,o,s,l){!a.A(o,r)&&(o[r]=!0,i||l.push(r),n.A(s(r),function(r){e(t,r,i,o,s,l)}),i&&l.push(r))}(e,t,"post"===r,s,i,o)}),o}function Z(e){t=e,r=new c.T().setGraph(t.graph()),n.A(t.nodes(),function(e){r.setNode(e,t.node(e))}),n.A(t.edges(),function(e){var n=r.edge(e.v,e.w)||{weight:0,minlen:1},i=t.edge(e);r.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),V(e=r);var t,r,i,a,o=j(e);for($(o),Q(o,e);i=J(o);)a=ee(o,e,i),et(o,e,i,a)}function Q(e,t){var r=q(e,e.nodes(),"post");r=r.slice(0,r.length-1),n.A(r,function(r){var n,i,a,o;n=e,i=t,a=r,o=n.node(a).parent,n.edge(a,o).cutvalue=K(n,i,a)})}function K(e,t,r){var i=e.node(r).parent,a=!0,o=t.edge(r,i),s=0;return o||(a=!1,o=t.edge(i,r)),s=o.weight,n.A(t.nodeEdges(r),function(n){var o=n.v===r,l=o?n.w:n.v;if(l!==i){var u,c,h,d=o===a,f=t.edge(n).weight;if(s+=d?f:-f,u=e,c=r,h=l,u.hasEdge(c,h)){var g=e.edge(r,l).cutvalue;s+=d?-g:g}}}),s}function $(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,i,o,s){var l=i,u=t.node(o);return r[o]=!0,n.A(t.neighbors(o),function(n){a.A(r,n)||(i=e(t,r,i,n,o))}),u.low=l,u.lim=i++,s?u.parent=s:delete u.parent,i}(e,{},1,t)}function J(e){return Y.A(e.edges(),function(t){return e.edge(t).cutvalue<0})}function ee(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var a=e.node(n),o=e.node(i),s=a,l=!1;a.lim>o.lim&&(s=o,l=!0);var u=X.A(t.edges(),function(t){return l===er(e,e.node(t.v),s)&&l!==er(e,e.node(t.w),s)});return U.A(u,function(e){return H(t,e)})}function et(e,t,r,i){var a,o,s,l,u=r.v,c=r.w;e.removeEdge(u,c),e.setEdge(i.v,i.w,{}),$(e),Q(e,t),a=e,o=t,s=Y.A(a.nodes(),function(e){return!o.node(e).parent}),l=(l=q(a,s,"pre")).slice(1),n.A(l,function(e){var t=a.node(e).parent,r=o.edge(e,t),n=!1;r||(r=o.edge(t,e),n=!0),o.node(e).rank=o.node(t).rank+(n?r.minlen:-r.minlen)})}function er(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}r(51365),Z.initLowLimValues=$,Z.initCutValues=Q,Z.calcCutValue=K,Z.leaveEdge=J,Z.enterEdge=ee,Z.exchangeEdges=et;var en=r(72888),ei=r(86420),ea=r(20903),eo=r(62013),es=r(66637);function el(e,t,r){for(var n;t.length&&(n=A.A(t)).i<=r;)t.pop(),e.push(n.vs),r++;return r}function eu(e,t,r){return l.A(t,function(t){var o,s;return o=function(e){for(var t;e.hasNode(t=i.A("_root")););return t}(e),s=new c.T({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(t){return e.node(t)}),n.A(e.nodes(),function(i){var l=e.node(i),u=e.parent(i);(l.rank===t||l.minRank<=t&&t<=l.maxRank)&&(s.setNode(i),s.setParent(i,u||o),n.A(e[r](i),function(t){var r=t.v===i?t.w:t.v,n=s.edge(r,i),a=_.A(n)?0:n.weight;s.setEdge(r,i,{weight:e.edge(t).weight+a})}),a.A(l,"minRank")&&s.setNode(i,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]}))}),s})}function ec(e,t){n.A(t,function(t){n.A(t,function(t,r){e.node(t).order=r})})}var eh=r(82932);function ed(e,t,r){if(t>r){var n=t;t=r,r=n}var i=e[t];i||(e[t]=i={}),i[r]=!0}function ef(e,t){var r=t&&t.debugTiming?O:P;r("layout",function(){var t=r(" buildLayoutGraph",function(){var t,r,i;return t=e,r=new c.T({multigraph:!0,compound:!0}),i=eC(t.graph()),r.setGraph(y.A({},ep,eA(i,eg),w.A(i,em))),n.A(t.nodes(),function(e){var n=eC(t.node(e));r.setNode(e,E.A(eA(n,ev),ey)),r.setParent(e,t.parent(e))}),n.A(t.edges(),function(e){var n=eC(t.edge(e));r.setEdge(e,y.A({},eE,eA(n,ew),w.A(n,eb)))}),r});r(" runLayout",function(){var e,o;e=t,(o=r)(" makeSpaceForEdgeLabels",function(){var t,r;r=(t=e).graph(),r.ranksep/=2,n.A(t.edges(),function(e){var n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)})}),o(" removeSelfEdges",function(){var t;t=e,n.A(t.edges(),function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),o(" acyclic",function(){var t,r,o,d,f,y;t="greedy"===e.graph().acyclicer?function(e,t){if(1>=e.nodeCount())return[];var r,i,a,o,d,f,y,w=(r=e,i=t||g,a=new c.T,o=0,d=0,n.A(r.nodes(),function(e){a.setNode(e,{v:e,in:0,out:0})}),n.A(r.edges(),function(e){var t=a.edge(e.v,e.w)||0,r=i(e);a.setEdge(e.v,e.w,t+r),d=Math.max(d,a.node(e.v).out+=r),o=Math.max(o,a.node(e.w).in+=r)}),f=u.A(d+o+3).map(function(){return new h}),y=o+1,n.A(a.nodes(),function(e){v(f,y,a.node(e))}),{graph:a,buckets:f,zeroIdx:y}),E=function(e,t,r){for(var n,i=[],a=t[t.length-1],o=t[0];e.nodeCount();){for(;n=o.dequeue();)p(e,t,r,n);for(;n=a.dequeue();)p(e,t,r,n);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(n=t[s].dequeue()){i=i.concat(p(e,t,r,n,!0));break}}}return i}(w.graph,w.buckets,w.zeroIdx);return s.A(l.A(E,function(t){return e.outEdges(t.v,t.w)}))}(e,(r=e,function(e){return r.edge(e).weight})):(o=e,d=[],f={},y={},n.A(o.nodes(),function e(t){a.A(y,t)||(y[t]=!0,f[t]=!0,n.A(o.outEdges(t),function(t){a.A(f,t.w)?d.push(t):e(t.w)}),delete f[t])}),d),n.A(t,function(t){var r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,i.A("rev"))})}),o(" nestingGraph.run",function(){var t,r,i,a,o,s,l;t=T(e,"root",{},"_root"),o=e,s={},n.A(o.children(),function(e){!function e(t,r){var i=o.children(t);i&&i.length&&n.A(i,function(t){e(t,r+1)}),s[t]=r}(e,1)}),i=2*(r=b.A(en.A(s))-1)+1,e.graph().nestingRoot=t,n.A(e.edges(),function(t){e.edge(t).minlen*=i}),a=(l=e,ei.A(l.edges(),function(e,t){return e+l.edge(t).weight},0)+1),n.A(e.children(),function(o){!function e(t,r,i,a,o,s,l){var u=t.children(l);if(!u.length){l!==r&&t.setEdge(r,l,{weight:0,minlen:i});return}var c=M(t,"_bt"),h=M(t,"_bb"),d=t.node(l);t.setParent(c,l),d.borderTop=c,t.setParent(h,l),d.borderBottom=h,n.A(u,function(n){e(t,r,i,a,o,s,n);var u=t.node(n),d=u.borderTop?u.borderTop:n,f=u.borderBottom?u.borderBottom:n,g=u.borderTop?a:2*a,p=d!==f?1:o-s[l]+1;t.setEdge(c,d,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,h,{weight:g,minlen:p,nestingEdge:!0})}),t.parent(l)||t.setEdge(r,c,{weight:0,minlen:o+s[l]})}(e,t,i,a,r,s,o)}),e.graph().nodeRankFactor=i}),o(" rank",function(){var t,r=x(e);switch(r.graph().ranker){case"network-simplex":default:Z(r);break;case"tight-tree":V(t=r),j(t);break;case"longest-path":V(r)}}),o(" injectEdgeLabelProxies",function(){var t;t=e,n.A(t.edges(),function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),i={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};T(t,"edge-proxy",i,"_ep")}})}),o(" removeEmptyRanks",function(){var t,r,i,a;t=S.A(l.A(e.nodes(),function(t){return e.node(t).rank})),r=[],n.A(e.nodes(),function(n){var i=e.node(n).rank-t;r[i]||(r[i]=[]),r[i].push(n)}),i=0,a=e.graph().nodeRankFactor,n.A(r,function(t,r){_.A(t)&&r%a!=0?--i:i&&n.A(t,function(t){e.node(t).rank+=i})})}),o(" nestingGraph.cleanup",function(){var t;t=e.graph(),e.removeNode(t.nestingRoot),delete t.nestingRoot,n.A(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}),o(" normalizeRanks",function(){var t;t=S.A(l.A(e.nodes(),function(t){return e.node(t).rank})),n.A(e.nodes(),function(r){var n=e.node(r);a.A(n,"rank")&&(n.rank-=t)})}),o(" assignRankMinMax",function(){var t,r;t=e,r=0,n.A(t.nodes(),function(e){var n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=b.A(r,n.maxRank))}),t.graph().maxRank=r}),o(" removeEdgeLabelProxies",function(){var t;t=e,n.A(t.nodes(),function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),o(" normalize.run",function(){e.graph().dummyChains=[],n.A(e.edges(),function(t){!function(e,t){var r,n,i,a=t.v,o=e.node(a).rank,s=t.w,l=e.node(s).rank,u=t.name,c=e.edge(t),h=c.labelRank;if(l!==o+1){for(e.removeEdge(t),i=0,++o;o<l;++i,++o)c.points=[],r=T(e,"edge",n={width:0,height:0,edgeLabel:c,edgeObj:t,rank:o},"_d"),o===h&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),e.setEdge(a,r,{weight:c.weight},u),0===i&&e.graph().dummyChains.push(r),a=r;e.setEdge(a,s,{weight:c.weight},u)}}(e,t)})}),o(" parentDummyChains",function(){var t,r,i;t=e,r={},i=0,n.A(t.children(),function e(a){var o=i;n.A(t.children(a),e),r[a]={low:o,lim:i++}}),n.A(e.graph().dummyChains,function(t){for(var n=e.node(t),i=n.edgeObj,a=function(e,t,r,n){var i,a,o=[],s=[],l=Math.min(t[r].low,t[n].low),u=Math.max(t[r].lim,t[n].lim);i=r;do o.push(i=e.parent(i));while(i&&(t[i].low>l||u>t[i].lim));for(a=i,i=n;(i=e.parent(i))!==a;)s.push(i);return{path:o.concat(s.reverse()),lca:a}}(e,r,i.v,i.w),o=a.path,s=a.lca,l=0,u=o[0],c=!0;t!==i.w;){if(n=e.node(t),c){for(;(u=o[l])!==s&&e.node(u).maxRank<n.rank;)l++;u===s&&(c=!1)}if(!c){for(;l<o.length-1&&e.node(u=o[l+1]).minRank<=n.rank;)l++;u=o[l]}e.setParent(t,u),t=e.successors(t)[0]}})}),o(" addBorderSegments",function(){n.A(e.children(),function t(r){var i=e.children(r),o=e.node(r);if(i.length&&n.A(i,t),a.A(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,l=o.maxRank+1;s<l;++s)B(e,"borderLeft","_bl",r,o,s),B(e,"borderRight","_br",r,o,s)}})}),o(" order",function(){!function(e){var t=R(e),r=eu(e,u.A(1,t+1),"inEdges"),i=eu(e,u.A(t-1,-1,-1),"outEdges"),o=(h={},d=X.A(e.nodes(),function(t){return!e.children(t).length}),f=b.A(l.A(d,function(t){return e.node(t).rank})),g=l.A(u.A(f+1),function(){return[]}),p=es.A(d,function(t){return e.node(t).rank}),n.A(p,function t(r){a.A(h,r)||(h[r]=!0,g[e.node(r).rank].push(r),n.A(e.successors(r),t))}),g);ec(e,o);for(var h,d,f,g,p,v,y=1/0,E=0,A=0;A<4;++E,++A){(function(e,t){var r=new c.T;n.A(e,function(e){var i,o,u,c=e.graph().root,h=function e(t,r,i,o){var u,c,h,d,f,g,p,v,y,E,b,A,C=t.children(r),S=t.node(r),I=S?S.borderLeft:void 0,T=S?S.borderRight:void 0,x={};I&&(C=X.A(C,function(e){return e!==I&&e!==T}));var D=(u=C,l.A(u,function(e){var r=t.inEdges(e);if(!r.length)return{v:e};var n=ei.A(r,function(e,r){var n=t.edge(r),i=t.node(r.v);return{sum:e.sum+n.weight*i.order,weight:e.weight+n.weight}},{sum:0,weight:0});return{v:e,barycenter:n.sum/n.weight,weight:n.weight}}));n.A(D,function(r){if(t.children(r.v).length){var n,s,l=e(t,r.v,i,o);x[r.v]=l,a.A(l,"barycenter")&&(n=r,s=l,_.A(n.barycenter)?(n.barycenter=s.barycenter,n.weight=s.weight):(n.barycenter=(n.barycenter*n.weight+s.barycenter*s.weight)/(n.weight+s.weight),n.weight+=s.weight))}});var N=(c={},n.A(D,function(e,t){var r=c[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};_.A(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),n.A(i.edges(),function(e){var t=c[e.v],r=c[e.w];_.A(t)||_.A(r)||(r.indegree++,t.out.push(c[e.w]))}),function(e){for(var t=[];e.length;){var r=e.pop();t.push(r),n.A(r.in.reverse(),function(e){return function(t){!t.merged&&(_.A(t.barycenter)||_.A(e.barycenter)||t.barycenter>=e.barycenter)&&function(e,t){var r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),n.A(r.out,function(t){return function(r){r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return l.A(X.A(t,function(e){return!e.merged}),function(e){return w.A(e,["vs","i","barycenter","weight"])})}(X.A(c,function(e){return!e.indegree})));!function(e,t){n.A(e,function(e){e.vs=s.A(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}(N,x);var M=(g=(h=function(e){return a.A(e,"barycenter")},d={lhs:[],rhs:[]},n.A(N,function(e){h(e)?d.lhs.push(e):d.rhs.push(e)}),f=d).lhs,p=es.A(f.rhs,function(e){return-e.i}),v=[],y=0,E=0,b=0,g.sort(function(e){return function(t,r){return t.barycenter<r.barycenter?-1:t.barycenter>r.barycenter?1:e?r.i-t.i:t.i-r.i}}(!!o)),b=el(v,p,b),n.A(g,function(e){b+=e.vs.length,v.push(e.vs),y+=e.barycenter*e.weight,E+=e.weight,b=el(v,p,b)}),A={vs:s.A(v)},E&&(A.barycenter=y/E,A.weight=E),A);if(I&&(M.vs=s.A([I,M.vs,T]),t.predecessors(I).length)){var R=t.node(t.predecessors(I)[0]),O=t.node(t.predecessors(T)[0]);a.A(M,"barycenter")||(M.barycenter=0,M.weight=0),M.barycenter=(M.barycenter*M.weight+R.order+O.order)/(M.weight+2),M.weight+=2}return M}(e,c,r,t);n.A(h.vs,function(t,r){e.node(t).order=r}),i=h.vs,u={},n.A(i,function(t){for(var n,i,a=e.parent(t);a;){if((n=e.parent(a))?(i=u[n],u[n]=a):(i=o,o=a),i&&i!==a)return void r.setEdge(i,a);a=n}})})})(E%2?r:i,E%4>=2),o=N(e);var C=function(e,t){for(var r=0,i=1;i<t.length;++i)r+=function(e,t,r){for(var i=eo.A(r,l.A(r,function(e,t){return t})),a=s.A(l.A(t,function(t){return es.A(l.A(e.outEdges(t),function(t){return{pos:i[t.w],weight:e.edge(t).weight}}),"pos")})),o=1;o<r.length;)o<<=1;var u=2*o-1;o-=1;var c=l.A(Array(u),function(){return 0}),h=0;return n.A(a.forEach(function(e){var t=e.pos+o;c[t]+=e.weight;for(var r=0;t>0;)t%2&&(r+=c[t+1]),t=t-1>>1,c[t]+=e.weight;h+=e.weight*r})),h}(e,t[i-1],t[i]);return r}(e,o);C<y&&(A=0,v=ea.A(o),y=C)}ec(e,v)}(e)}),o(" insertSelfEdges",function(){var t,r;r=N(t=e),n.A(r,function(e){var r=0;n.A(e,function(e,i){var a=t.node(e);a.order=i+r,n.A(a.selfEdges,function(e){T(t,"selfedge",{width:e.label.width,height:e.label.height,rank:a.rank,order:i+ ++r,e:e.e,label:e.label},"_se")}),delete a.selfEdges})})}),o(" adjustCoordinateSystem",function(){var t;("lr"===(t=e.graph().rankdir.toLowerCase())||"rl"===t)&&L(e)}),o(" position",function(){var t,r,i,o,s,h,d,f,g,p,v,w,E,_,I,T;_=N(E=t=x(t=e)),I=E.graph().ranksep,T=0,n.A(_,function(e){var t=b.A(l.A(e,function(e){return E.node(e).height}));n.A(e,function(e){E.node(e).y=T+t/2}),T+=t+I}),n.A((o=N(r=t),h=y.A((s={},ei.A(o,function(e,t){var i=0,a=0,o=e.length,l=A.A(t);return n.A(t,function(e,u){var c=function(e,t){if(e.node(t).dummy)return Y.A(e.predecessors(t),function(t){return e.node(t).dummy})}(r,e),h=c?r.node(c).order:o;(c||e===l)&&(n.A(t.slice(a,u+1),function(e){n.A(r.predecessors(e),function(t){var n=r.node(t),a=n.order;(a<i||h<a)&&!(n.dummy&&r.node(e).dummy)&&ed(s,t,e)})}),a=u+1,i=h)}),t}),s),function(e,t){var r={};function i(t,i,a,o,s){var l;n.A(u.A(i,a),function(i){l=t[i],e.node(l).dummy&&n.A(e.predecessors(l),function(t){var n=e.node(t);n.dummy&&(n.order<o||n.order>s)&&ed(r,t,l)})})}return ei.A(t,function(t,r){var a,o=-1,s=0;return n.A(r,function(n,l){if("border"===e.node(n).dummy){var u=e.predecessors(n);u.length&&(a=e.node(u[0]).order,i(r,s,l,o,a),s=l,o=a)}i(r,s,r.length,a,t.length)}),r}),r}(r,o)),d={},n.A(["u","d"],function(e){i="u"===e?o:en.A(o).reverse(),n.A(["l","r"],function(t){"r"===t&&(i=l.A(i,function(e){return en.A(e).reverse()}));var o,s,u,f,g=("u"===e?r.predecessors:r.successors).bind(r),p=(o=i,s={},u={},f={},n.A(o,function(e){n.A(e,function(e,t){s[e]=e,u[e]=e,f[e]=t})}),n.A(o,function(e){var t=-1;n.A(e,function(e){var r=g(e);if(r.length)for(var n=((r=es.A(r,function(e){return f[e]})).length-1)/2,i=Math.floor(n),o=Math.ceil(n);i<=o;++i){var l=r[i];u[e]===e&&t<f[l]&&!function(e,t,r){if(t>r){var n=t;t=r,r=n}return a.A(e[t],r)}(h,e,l)&&(u[l]=e,u[e]=s[e]=s[l],t=f[l])}})}),{root:s,align:u}),v=function(e,t,r,i,o){var s,l,u,h,d,f,g,p,v,y,w={},E=(s=e,l=t,u=r,h=o,p=new c.T,y=(d=(v=s.graph()).nodesep,f=v.edgesep,g=h,function(e,t,r){var n,i,o=e.node(t),s=e.node(r);if(n=0+o.width/2,a.A(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":i=-o.width/2;break;case"r":i=o.width/2}if(i&&(n+=g?i:-i),i=0,n+=(o.dummy?f:d)/2,n+=(s.dummy?f:d)/2,n+=s.width/2,a.A(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":i=s.width/2;break;case"r":i=-s.width/2}return i&&(n+=g?i:-i),i=0,n}),n.A(l,function(e){var t;n.A(e,function(e){var r=u[e];if(p.setNode(r),t){var n=u[t],i=p.edge(n,r);p.setEdge(n,r,Math.max(y(s,e,t),i||0))}t=e})}),p),b=o?"borderLeft":"borderRight";function A(e,t){for(var r=E.nodes(),n=r.pop(),i={};n;)i[n]?e(n):(i[n]=!0,r.push(n),r=r.concat(t(n))),n=r.pop()}return A(function(e){w[e]=E.inEdges(e).reduce(function(e,t){return Math.max(e,w[t.v]+E.edge(t))},0)},E.predecessors.bind(E)),A(function(t){var r=E.outEdges(t).reduce(function(e,t){return Math.min(e,w[t.w]-E.edge(t))},1/0),n=e.node(t);r!==1/0&&n.borderType!==b&&(w[t]=Math.max(w[t],r))},E.successors.bind(E)),n.A(i,function(e){w[e]=w[r[e]]}),w}(r,i,p.root,p.align,"r"===t);"r"===t&&(v=C.A(v,function(e){return-e})),d[e+t]=v})}),f=U.A(en.A(d),function(e){var t=-1/0,n=1/0;return eh.A(e,function(e,i){var a,o,s=(a=r,o=i,a.node(o).width/2);t=Math.max(e+s,t),n=Math.min(e-s,n)}),t-n}),g=en.A(f),p=S.A(g),v=b.A(g),n.A(["u","d"],function(e){n.A(["l","r"],function(t){var r,n=e+t,i=d[n];if(i!==f){var a=en.A(i);(r="l"===t?p-S.A(a):v-b.A(a))&&(d[n]=C.A(i,function(e){return e+r}))}})}),w=r.graph().align,C.A(d.ul,function(e,t){if(w)return d[w.toLowerCase()][t];var r=es.A(l.A(d,t));return(r[1]+r[2])/2})),function(e,r){t.node(r).x=e})}),o(" positionSelfEdges",function(){var t;t=e,n.A(t.nodes(),function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),i=n.x+n.width/2,a=n.y,o=r.x-i,s=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],r.label.x=r.x,r.label.y=r.y}})}),o(" removeBorderNodes",function(){var t;t=e,n.A(t.nodes(),function(e){if(t.children(e).length){var r=t.node(e),n=t.node(r.borderTop),i=t.node(r.borderBottom),a=t.node(A.A(r.borderLeft)),o=t.node(A.A(r.borderRight));r.width=Math.abs(o.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),n.A(t.nodes(),function(e){"border"===t.node(e).dummy&&t.removeNode(e)})}),o(" normalize.undo",function(){n.A(e.graph().dummyChains,function(t){var r,n=e.node(t),i=n.edgeLabel;for(e.setEdge(n.edgeObj,i);n.dummy;)r=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=r,n=e.node(t)})}),o(" fixupEdgeLabelCoords",function(){var t;t=e,n.A(t.edges(),function(e){var r=t.edge(e);if(a.A(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),o(" undoCoordinateSystem",function(){var t,r,i;("bt"===(t=e.graph().rankdir.toLowerCase())||"rl"===t)&&(r=e,n.A(r.nodes(),function(e){F(r.node(e))}),n.A(r.edges(),function(e){var t=r.edge(e);n.A(t.points,F),a.A(t,"y")&&F(t)})),("lr"===t||"rl"===t)&&(i=e,n.A(i.nodes(),function(e){z(i.node(e))}),n.A(i.edges(),function(e){var t=i.edge(e);n.A(t.points,z),a.A(t,"x")&&z(t)}),L(e))}),o(" translateGraph",function(){!function(e){var t=1/0,r=0,i=1/0,o=0,s=e.graph(),l=s.marginx||0,u=s.marginy||0;function c(e){var n=e.x,a=e.y,s=e.width,l=e.height;t=Math.min(t,n-s/2),r=Math.max(r,n+s/2),i=Math.min(i,a-l/2),o=Math.max(o,a+l/2)}n.A(e.nodes(),function(t){c(e.node(t))}),n.A(e.edges(),function(t){var r=e.edge(t);a.A(r,"x")&&c(r)}),t-=l,i-=u,n.A(e.nodes(),function(r){var n=e.node(r);n.x-=t,n.y-=i}),n.A(e.edges(),function(r){var o=e.edge(r);n.A(o.points,function(e){e.x-=t,e.y-=i}),a.A(o,"x")&&(o.x-=t),a.A(o,"y")&&(o.y-=i)}),s.width=r-t+l,s.height=o-i+u}(e)}),o(" assignNodeIntersects",function(){var t;t=e,n.A(t.edges(),function(e){var r,n,i=t.edge(e),a=t.node(e.v),o=t.node(e.w);i.points?(r=i.points[0],n=i.points[i.points.length-1]):(i.points=[],r=o,n=a),i.points.unshift(D(a,r)),i.points.push(D(o,n))})}),o(" reversePoints",function(){var t;t=e,n.A(t.edges(),function(e){var r=t.edge(e);r.reversed&&r.points.reverse()})}),o(" acyclic.undo",function(){n.A(e.edges(),function(t){var r=e.edge(t);if(r.reversed){e.removeEdge(t);var n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})})}),r(" updateInputGraph",function(){var r,i;r=e,i=t,n.A(r.nodes(),function(e){var t=r.node(e),n=i.node(e);t&&(t.x=n.x,t.y=n.y,i.children(e).length&&(t.width=n.width,t.height=n.height))}),n.A(r.edges(),function(e){var t=r.edge(e),n=i.edge(e);t.points=n.points,a.A(n,"x")&&(t.x=n.x,t.y=n.y)}),r.graph().width=i.graph().width,r.graph().height=i.graph().height})})}var eg=["nodesep","edgesep","ranksep","marginx","marginy"],ep={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},em=["acyclicer","ranker","rankdir","align"],ev=["width","height"],ey={width:0,height:0},ew=["minlen","weight","width","height","labeloffset"],eE={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},eb=["labelpos"];function eA(e,t){return C.A(w.A(e,t),Number)}function eC(e){var t={};return n.A(e,function(e,r){t[r.toLowerCase()]=e}),t}},51365(e,t,r){"use strict";r.d(t,{T:()=>g});var n=r(81349),i=r(39142),a=r(89610),o=r(27422),s=r(96654),l=r(66401),u=r(8058),c=r(69592),h=r(10491),d=r(72888),f=r(86420);class g{constructor(e={}){this._isDirected=!n.A(e,"directed")||e.directed,this._isMultigraph=!!n.A(e,"multigraph")&&e.multigraph,this._isCompound=!!n.A(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=i.A(void 0),this._defaultEdgeLabelFn=i.A(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return a.A(e)||(e=i.A(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return o.A(this._nodes)}sources(){var e=this;return s.A(this.nodes(),function(t){return l.A(e._in[t])})}sinks(){var e=this;return s.A(this.nodes(),function(t){return l.A(e._out[t])})}setNodes(e,t){var r=arguments,n=this;return u.A(e,function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return n.A(this._nodes,e)?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this}node(e){return this._nodes[e]}hasNode(e){return n.A(this._nodes,e)}removeNode(e){var t=this;if(n.A(this._nodes,e)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],u.A(this.children(e),function(e){t.setParent(e)}),delete this._children[e]),u.A(o.A(this._in[e]),r),delete this._in[e],delete this._preds[e],u.A(o.A(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(c.A(t))t="\0";else{t+="";for(var r=t;!c.A(r);r=this.parent(r))if(r===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e){if(c.A(e)&&(e="\0"),this._isCompound){var t=this._children[e];if(t)return o.A(t)}else if("\0"===e)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return o.A(t)}successors(e){var t=this._sucs[e];if(t)return o.A(t)}neighbors(e){var t=this.predecessors(e);if(t)return h.A(t,this.successors(e))}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;u.A(this._nodes,function(r,n){e(n)&&t.setNode(n,r)}),u.A(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&u.A(t.nodes(),function(e){t.setParent(e,function e(i){var a=r.parent(i);return void 0===a||t.hasNode(a)?(n[i]=a,a):a in n?n[a]:e(a)}(e))}),t}setDefaultEdgeLabel(e){return a.A(e)||(e=i.A(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return d.A(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return f.A(e,function(e,i){return n.length>1?r.setEdge(e,i,t):r.setEdge(e,i),i}),this}setEdge(){var e,t,r,i,a=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(e=o.v,t=o.w,r=o.name,2==arguments.length&&(i=arguments[1],a=!0)):(e=o,t=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,t=""+t,c.A(r)||(r=""+r);var s=y(this._isDirected,e,t,r);if(n.A(this._edgeLabels,s))return a&&(this._edgeLabels[s]=i),this;if(!c.A(r)&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[s]=a?i:this._defaultEdgeLabelFn(e,t,r);var l=function(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return n&&(s.name=n),s}(this._isDirected,e,t,r);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[s]=l,p(this._preds[t],e),p(this._sucs[e],t),this._in[t][s]=l,this._out[e][s]=l,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?w(this._isDirected,arguments[0]):y(this._isDirected,e,t,r);return this._edgeLabels[n]}hasEdge(e,t,r){var i=1==arguments.length?w(this._isDirected,arguments[0]):y(this._isDirected,e,t,r);return n.A(this._edgeLabels,i)}removeEdge(e,t,r){var n=1==arguments.length?w(this._isDirected,arguments[0]):y(this._isDirected,e,t,r),i=this._edgeObjs[n];return i&&(e=i.v,t=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],v(this._preds[t],e),v(this._sucs[e],t),delete this._in[t][n],delete this._out[e][n],this._edgeCount--),this}inEdges(e,t){var r=this._in[e];if(r){var n=d.A(r);return t?s.A(n,function(e){return e.v===t}):n}}outEdges(e,t){var r=this._out[e];if(r){var n=d.A(r);return t?s.A(n,function(e){return e.w===t}):n}}nodeEdges(e,t){var r=this.inEdges(e,t);if(r)return r.concat(this.outEdges(e,t))}}function p(e,t){e[t]?e[t]++:e[t]=1}function v(e,t){--e[t]||delete e[t]}function y(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var o=i;i=a,a=o}return i+"\x01"+a+"\x01"+(c.A(n)?"\0":n)}function w(e,t){return y(e,t.v,t.w,t.name)}g.prototype._nodeCount=0,g.prototype._edgeCount=0},697(e,t,r){"use strict";r.d(t,{T:()=>n.T});var n=r(51365)},14075(e,t,r){"use strict";r.d(t,{M:()=>o});var n=r(69592),i=r(50053),a=r(74722);function o(e){var t,r,o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e,a.A(t.nodes(),function(e){var r=t.node(e),i=t.parent(e),a={v:e};return n.A(r)||(a.value=r),n.A(i)||(a.parent=i),a})),edges:(r=e,a.A(r.edges(),function(e){var t=r.edge(e),i={v:e.v,w:e.w};return n.A(e.name)||(i.name=e.name),n.A(t)||(i.value=t),i}))};return n.A(e.graph())||(o.value=i.A(e.graph())),o}r(51365)},76916(e,t,r){"use strict";r.d(t,{XX:()=>I});var n=r(83341),i=r(81349),a=r(23068),o=r(8058),s=r(79552),l=r(82933),u={normal:function(e,t,r,n){var i=e.append("marker").attr("id",t).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.AV(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])},vee:function(e,t,r,n){var i=e.append("marker").attr("id",t).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.AV(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])},undirected:function(e,t,r,n){var i=e.append("marker").attr("id",t).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");l.AV(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])}},c=r(10646);function h(e,t,r){var n,i=t.label,a=e.append("g");"svg"===t.labelType?(a.node().appendChild(t.label),l.AV(a,t.labelStyle)):"string"!=typeof i||"html"===t.labelType?(0,c.H)(a,t):function(e,t){for(var r=e.append("text"),n=(function(e){for(var t,r="",n=!1,i=0;i<e.length;++i)t=e[i],n?("n"===t?r+="\n":r+=t,n=!1):"\\"===t?n=!0:r+=t;return r})(t.label).split("\n"),i=0;i<n.length;i++)r.append("tspan").attr("xml:space","preserve").attr("dy","1em").attr("x","1").text(n[i]);l.AV(r,t.labelStyle)}(a,t);var o=a.node().getBBox();switch(r){case"top":n=-t.height/2;break;case"bottom":n=t.height/2-o.height;break;default:n=-o.height/2}return a.attr("transform","translate("+-o.width/2+","+n+")"),a}var d=function(e,t){var r=t.nodes().filter(function(e){return l.De(t,e)}),i=e.selectAll("g.cluster").data(r,function(e){return e});l.c$(i.exit(),t).style("opacity",0).remove();var a=i.enter().append("g").attr("class","cluster").attr("id",function(e){return t.node(e).id}).style("opacity",0).each(function(e){var r=t.node(e),i=n.Ltv(this);n.Ltv(this).append("rect"),h(i.append("g").attr("class","label"),r,r.clusterLabelPos)});return i=i.merge(a),(i=l.c$(i,t).style("opacity",1)).selectAll("rect").each(function(e){var r=t.node(e),i=n.Ltv(this);l.AV(i,r.style)}),i};let f=function(e,t){var r,a=e.selectAll("g.edgeLabel").data(t.edges(),function(e){return l.gh(e)}).classed("update",!0);return a.exit().remove(),a.enter().append("g").classed("edgeLabel",!0).style("opacity",0),(a=e.selectAll("g.edgeLabel")).each(function(e){var r=n.Ltv(this);r.select(".label").remove();var a=t.edge(e),o=h(r,t.edge(e),0).classed("label",!0),s=o.node().getBBox();a.labelId&&o.attr("id",a.labelId),i.A(a,"width")||(a.width=s.width),i.A(a,"height")||(a.height=s.height)}),r=a.exit?a.exit():a.selectAll(null),l.c$(r,t).style("opacity",0).remove(),a};var g=r(5664),p=r(72897);function v(e,t){return e.intersect(t)}var y=function(e,t,r){var i,a,o,s,u,c,h=e.selectAll("g.edgePath").data(t.edges(),function(e){return l.gh(e)}).classed("update",!0),d=(i=h,a=t,(o=i.enter().append("g").attr("class","edgePath").style("opacity",0)).append("path").attr("class","path").attr("d",function(e){var t=a.edge(e),r=a.node(e.v).elem,n=p.A(t.points.length).map(function(){var e,t;return e=r.getBBox(),{x:(t=r.ownerSVGElement.getScreenCTM().inverse().multiply(r.getScreenCTM()).translate(e.width/2,e.height/2)).e,y:t.f}});return w(t,n)}),o.append("defs"),o);s=h,u=t,c=s.exit(),l.c$(c,u).style("opacity",0).remove();var f=void 0!==h.merge?h.merge(d):h;return l.c$(f,t).style("opacity",1),f.each(function(e){var r=n.Ltv(this),i=t.edge(e);i.elem=this,i.id&&r.attr("id",i.id),l.nh(r,i.class,(r.classed("update")?"update ":"")+"edgePath")}),f.selectAll("path.path").each(function(e){var r=t.edge(e);r.arrowheadId=g.A("arrowhead");var i=n.Ltv(this).attr("marker-end",function(){var e,t;return"url("+(e=location.href,t=r.arrowheadId,e.split("#")[0]+"#"+t)+")"}).style("fill","none");l.c$(i,t).attr("d",function(e){var r,n,i,a,o,s;return r=t,n=e,i=r.edge(n),a=r.node(n.v),o=r.node(n.w),(s=i.points.slice(1,i.points.length-1)).unshift(v(a,s[0])),s.push(v(o,s[s.length-1])),w(i,s)}),l.AV(i,r.style)}),f.selectAll("defs *").remove(),f.selectAll("defs").each(function(e){var i=t.edge(e);(0,r[i.arrowhead])(n.Ltv(this),i.arrowheadId,i,"arrowhead")}),f};function w(e,t){var r=(n.n8j||n.JWy.line)().x(function(e){return e.x}).y(function(e){return e.y});return(r.curve||r.interpolate)(e.curve),r(t)}var E=r(13551),b=function(e,t,r){var a,o=t.nodes().filter(function(e){return!l.De(t,e)}),s=e.selectAll("g.node").data(o,function(e){return e}).classed("update",!0);return s.exit().remove(),s.enter().append("g").attr("class","node").style("opacity",0),(s=e.selectAll("g.node")).each(function(e){var a=t.node(e),o=n.Ltv(this);l.nh(o,a.class,(o.classed("update")?"update ":"")+"node"),o.select("g.label").remove();var s=o.append("g").attr("class","label"),u=h(s,a),c=r[a.shape],d=E.A(u.node().getBBox(),"width","height");a.elem=this,a.id&&o.attr("id",a.id),a.labelId&&s.attr("id",a.labelId),i.A(a,"width")&&(d.width=a.width),i.A(a,"height")&&(d.height=a.height),d.width+=a.paddingLeft+a.paddingRight,d.height+=a.paddingTop+a.paddingBottom,s.attr("transform","translate("+(a.paddingLeft-a.paddingRight)/2+","+(a.paddingTop-a.paddingBottom)/2+")");var f=n.Ltv(this);f.select(".label-container").remove();var g=c(f,d,a).classed("label-container",!0);l.AV(g,a.style);var p=g.node().getBBox();a.width=p.width,a.height=p.height}),a=s.exit?s.exit():s.selectAll(null),l.c$(a,t).style("opacity",0).remove(),s};function A(e,t,r,n){var i=e.x,a=e.y,o=i-n.x,s=a-n.y,l=Math.sqrt(t*t*s*s+r*r*o*o),u=Math.abs(t*r*o/l);n.x<i&&(u=-u);var c=Math.abs(t*r*s/l);return n.y<a&&(c=-c),{x:i+u,y:a+c}}var C=r(21194),_=r(84113),S={rect:function(e,t,r){var n=e.insert("rect",":first-child").attr("rx",r.rx).attr("ry",r.ry).attr("x",-t.width/2).attr("y",-t.height/2).attr("width",t.width).attr("height",t.height);return r.intersect=function(e){return(0,_.C)(r,e)},n},ellipse:function(e,t,r){var n=t.width/2,i=t.height/2,a=e.insert("ellipse",":first-child").attr("x",-t.width/2).attr("y",-t.height/2).attr("rx",n).attr("ry",i);return r.intersect=function(e){return A(r,n,i,e)},a},circle:function(e,t,r){var n=Math.max(t.width,t.height)/2,i=e.insert("circle",":first-child").attr("x",-t.width/2).attr("y",-t.height/2).attr("r",n);return r.intersect=function(e){return A(r,n,n,e)},i},diamond:function(e,t,r){var n=t.width*Math.SQRT2/2,i=t.height*Math.SQRT2/2,a=[{x:0,y:-i},{x:-n,y:0},{x:0,y:i},{x:n,y:0}],o=e.insert("polygon",":first-child").attr("points",a.map(function(e){return e.x+","+e.y}).join(" "));return r.intersect=function(e){return(0,C.k)(r,a,e)},o}};function I(){var e=function(e,t){(r=t).nodes().forEach(function(e){var t=r.node(e);i.A(t,"label")||r.children(e).length||(t.label=e),i.A(t,"paddingX")&&a.A(t,{paddingLeft:t.paddingX,paddingRight:t.paddingX}),i.A(t,"paddingY")&&a.A(t,{paddingTop:t.paddingY,paddingBottom:t.paddingY}),i.A(t,"padding")&&a.A(t,{paddingLeft:t.padding,paddingRight:t.padding,paddingTop:t.padding,paddingBottom:t.padding}),a.A(t,T),o.A(["paddingLeft","paddingRight","paddingTop","paddingBottom"],function(e){t[e]=Number(t[e])}),i.A(t,"width")&&(t._prevWidth=t.width),i.A(t,"height")&&(t._prevHeight=t.height)}),r.edges().forEach(function(e){var t=r.edge(e);i.A(t,"label")||(t.label=""),a.A(t,x)});var r,c,h=D(e,"output"),g=D(h,"clusters"),p=D(h,"edgePaths"),v=f(D(h,"edgeLabels"),t),w=b(D(h,"nodes"),t,S);(0,s.Zp)(t);function E(e){var r=t.node(e);return"translate("+r.x+","+r.y+")"}w.filter(function(){return!n.Ltv(this).classed("update")}).attr("transform",E),l.c$(w,t).style("opacity",1).attr("transform",E);function A(e){var r=t.edge(e);return i.A(r,"x")?"translate("+r.x+","+r.y+")":""}v.filter(function(){return!n.Ltv(this).classed("update")}).attr("transform",A),l.c$(v,t).style("opacity",1).attr("transform",A),y(p,t,u);var C=d(g,t),_=C.filter(function(){return!n.Ltv(this).classed("update")});function I(e){var r=t.node(e);return"translate("+r.x+","+r.y+")"}_.attr("transform",I),l.c$(C,t).style("opacity",1).attr("transform",I),l.c$(_.selectAll("rect"),t).attr("width",function(e){return t.node(e).width}).attr("height",function(e){return t.node(e).height}).attr("x",function(e){return-t.node(e).width/2}).attr("y",function(e){return-t.node(e).height/2}),c=t,o.A(c.nodes(),function(e){var t=c.node(e);i.A(t,"_prevWidth")?t.width=t._prevWidth:delete t.width,i.A(t,"_prevHeight")?t.height=t._prevHeight:delete t.height,delete t._prevWidth,delete t._prevHeight})};return e.createNodes=function(t){return arguments.length?(b=t,e):b},e.createClusters=function(t){return arguments.length?(d=t,e):d},e.createEdgeLabels=function(t){return arguments.length?(f=t,e):f},e.createEdgePaths=function(t){return arguments.length?(y=t,e):y},e.shapes=function(t){return arguments.length?(S=t,e):S},e.arrows=function(t){return arguments.length?(u=t,e):u},e}var T={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},x={arrowhead:"normal",curve:n.lUB};function D(e,t){var r=e.select("g."+t);return r.empty()&&(r=e.append("g").attr("class",t)),r}r(697)}}]);
1
+ /*! For license information please see vendor-diagram-686f3f07.js.LICENSE.txt */
2
+ (globalThis.webpackChunknocobase=globalThis.webpackChunknocobase||[]).push([["3338"],{43457(e,t,r){e.exports=function(e){var t=[function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(0).layoutBase.LayoutConstants,i=r(0).layoutBase.FDLayoutConstants,a=r(0).CoSEConstants,o=r(0).CoSELayout,s=r(0).CoSENode,l=r(0).layoutBase.PointD,u=r(0).layoutBase.DimensionD,c={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function h(e){this.options=function(e,t){var r={};for(var n in e)r[n]=e[n];for(var n in t)r[n]=t[n];return r}(c,e),d(this.options)}var d=function(e){null!=e.nodeRepulsion&&(a.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=e.nodeRepulsion),null!=e.idealEdgeLength&&(a.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=e.idealEdgeLength),null!=e.edgeElasticity&&(a.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=e.edgeElasticity),null!=e.nestingFactor&&(a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),null!=e.gravity&&(a.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=e.gravity),null!=e.numIter&&(a.MAX_ITERATIONS=i.MAX_ITERATIONS=e.numIter),null!=e.gravityRange&&(a.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),null!=e.gravityCompound&&(a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),null!=e.gravityRangeCompound&&(a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),null!=e.initialEnergyOnIncremental&&(a.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),"draft"==e.quality?n.QUALITY=0:"proof"==e.quality?n.QUALITY=2:n.QUALITY=1,a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=!e.randomize,a.ANIMATE=i.ANIMATE=n.ANIMATE=e.animate,a.TILE=e.tile,a.TILING_PADDING_VERTICAL="function"==typeof e.tilingPaddingVertical?e.tilingPaddingVertical.call():e.tilingPaddingVertical,a.TILING_PADDING_HORIZONTAL="function"==typeof e.tilingPaddingHorizontal?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal};h.prototype.run=function(){var e,t,r=this.options;this.idToLNode={};var n=this.layout=new o,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var a=n.newGraphManager();this.gm=a;var s=this.options.eles.nodes(),l=this.options.eles.edges();this.root=a.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(s),n);for(var u=0;u<l.length;u++){var c=l[u],h=this.idToLNode[c.data("source")],d=this.idToLNode[c.data("target")];h!==d&&0==h.getEdgesBetween(d).length&&(a.add(n.newEdge(),h,d).id=c.id())}var f=function(e,t){"number"==typeof e&&(e=t);var r=e.data("id"),n=i.idToLNode[r];return{x:n.getRect().getCenterX(),y:n.getRect().getCenterY()}},g=function a(){for(var o,s=function(){r.fit&&r.cy.fit(r.eles,r.padding),e||(e=!0,i.cy.one("layoutready",r.ready),i.cy.trigger({type:"layoutready",layout:i}))},l=i.options.refresh,u=0;u<l&&!o;u++)o=i.stopped||i.layout.tick();if(o){n.checkLayoutSuccess()&&!n.isSubLayout&&n.doPostLayout(),n.tilingPostLayout&&n.tilingPostLayout(),n.isLayoutFinished=!0,i.options.eles.nodes().positions(f),s(),i.cy.one("layoutstop",i.options.stop),i.cy.trigger({type:"layoutstop",layout:i}),t&&cancelAnimationFrame(t),e=!1;return}var c=i.layout.getPositionsData();r.eles.nodes().positions(function(e,t){if("number"==typeof e&&(e=t),!e.isParent()){for(var r=e.id(),n=c[r],i=e;null==n&&(n=c[i.data("parent")]||c["DummyCompound_"+i.data("parent")],c[r]=n,void 0!=(i=i.parent()[0])););return null!=n?{x:n.x,y:n.y}:{x:e.position("x"),y:e.position("y")}}}),s(),t=requestAnimationFrame(a)};return n.addListener("layoutstarted",function(){"during"===i.options.animate&&(t=requestAnimationFrame(g))}),n.runLayout(),"during"!==this.options.animate&&(i.options.eles.nodes().not(":parent").layoutPositions(i,i.options,f),e=!1),this},h.prototype.getTopMostNodes=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].id()]=!0;return e.filter(function(e,r){"number"==typeof e&&(e=r);for(var n=e.parent()[0];null!=n;){if(t[n.id()])return!1;n=n.parent()[0]}return!0})},h.prototype.processChildrenList=function(e,t,r){for(var n=t.length,i=0;i<n;i++){var a,o,c=t[i],h=c.children(),d=c.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if((a=null!=c.outerWidth()&&null!=c.outerHeight()?e.add(new s(r.graphManager,new l(c.position("x")-d.w/2,c.position("y")-d.h/2),new u(parseFloat(d.w),parseFloat(d.h)))):e.add(new s(this.graphManager))).id=c.data("id"),a.paddingLeft=parseInt(c.css("padding")),a.paddingTop=parseInt(c.css("padding")),a.paddingRight=parseInt(c.css("padding")),a.paddingBottom=parseInt(c.css("padding")),this.options.nodeDimensionsIncludeLabels&&c.isParent()){var f=c.boundingBox({includeLabels:!0,includeNodes:!1}).w,g=c.boundingBox({includeLabels:!0,includeNodes:!1}).h,p=c.css("text-halign");a.labelWidth=f,a.labelHeight=g,a.labelPos=p}this.idToLNode[c.data("id")]=a,isNaN(a.rect.x)&&(a.rect.x=0),isNaN(a.rect.y)&&(a.rect.y=0),null!=h&&h.length>0&&(o=r.getGraphManager().add(r.newGraph(),a),this.processChildrenList(o,h,r))}},h.prototype.stop=function(){return this.stopped=!0,this};var f=function(e){e("layout","cose-bilkent",h)};"u">typeof cytoscape&&f(cytoscape),e.exports=f}],r={};function n(e){if(r[e])return r[e].exports;var i=r[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=r,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}(r(87799))},93409(e,t,r){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a=[],o=!0,s=!1;try{for(i=i.call(e);!(o=(r=i.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,n=e}finally{try{o||null==i.return||i.return()}finally{if(s)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var l,u,c,h,d,f,g,p,v,y,w,E,b,A,C,_,S,I,T,x,D="u"<typeof window?null:window,N=D?D.navigator:null;D&&D.document;var M=e(""),R=e({}),O=e(function(){}),P="u"<typeof HTMLElement?"undefined":e(HTMLElement),B=function(e){return e&&e.instanceString&&k(e.instanceString)?e.instanceString():null},L=function(t){return null!=t&&e(t)==M},k=function(t){return null!=t&&e(t)===O},F=function(e){return!H(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},z=function(t){return null!=t&&e(t)===R&&!F(t)&&t.constructor===Object},U=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},V=function(e){if("undefined"!==P)return null!=e&&e instanceof HTMLElement},H=function(e){return j(e)||Y(e)},j=function(e){return"collection"===B(e)&&e._private.single},Y=function(e){return"collection"===B(e)&&!e._private.single},X=function(e){return"core"===B(e)},G=function(e){return"stylesheet"===B(e)},W=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},q=function(t){return null!=t&&e(t)===R&&k(t.then)},Z=function(e,t){t||(t=function(){if(1==arguments.length)return arguments[0];if(0==arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var r=function r(){var n,i=arguments,a=t.apply(this,i),o=r.cache;return(n=o[a])||(n=o[a]=e.apply(this,i)),n};return r.cache={},r},Q=Z(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),K=Z(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),$=Z(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),J=function(e){return W(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},ee="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",et="rgb[a]?\\(("+ee+"[%]?)\\s*,\\s*("+ee+"[%]?)\\s*,\\s*("+ee+"[%]?)(?:\\s*,\\s*("+ee+"))?\\)",er="rgb[a]?\\((?:"+ee+"[%]?)\\s*,\\s*(?:"+ee+"[%]?)\\s*,\\s*(?:"+ee+"[%]?)(?:\\s*,\\s*(?:"+ee+"))?\\)",en="hsl[a]?\\(("+ee+")\\s*,\\s*("+ee+"[%])\\s*,\\s*("+ee+"[%])(?:\\s*,\\s*("+ee+"))?\\)",ei="hsl[a]?\\((?:"+ee+")\\s*,\\s*(?:"+ee+"[%])\\s*,\\s*(?:"+ee+"[%])(?:\\s*,\\s*(?:"+ee+"))?\\)",ea=function(e,t){return e<t?-1:+(e>t)},eo=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,r=1;r<t.length;r++){var n=t[r];if(null!=n)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=i[a];e[o]=n[o]}}return e},es=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,r,n;return 4===e.length?(t=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),n=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),r=parseInt(e[3]+e[4],16),n=parseInt(e[5]+e[6],16)),[t,r,n]}},el=function(e){function t(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}var r,n,i,a,o,s,l,u,c=RegExp("^"+en+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(i=parseFloat(c[2]))<0||i>100||(i/=100,(a=parseFloat(c[3]))<0||a>100)||(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===i)s=l=u=Math.round(255*a);else{var h=a<.5?a*(1+i):a+i-a*i,d=2*a-h;s=Math.round(255*t(d,h,n+1/3)),l=Math.round(255*t(d,h,n)),u=Math.round(255*t(d,h,n-1/3))}r=[s,l,u,o]}return r},eu=function(e){var t,r=RegExp("^"+et+"$").exec(e);if(r){t=[];for(var n=[],i=1;i<=3;i++){var a=r[i];if("%"===a[a.length-1]&&(n[i]=!0),a=parseFloat(a),n[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=n[1]||n[2]||n[3],s=n[1]&&n[2]&&n[3];if(o&&!s)return;var l=r[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},ec={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},eh=function(e){for(var t=e.map,r=e.keys,n=r.length,i=0;i<n;i++){var a=r[i];if(z(a))throw Error("Tried to set map with object key");i<r.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},ed=function(e){for(var t=e.map,r=e.keys,n=r.length,i=0;i<n;i++){var a=r[i];if(z(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))break}return t},ef=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eg="u">typeof globalThis?globalThis:"u">typeof window?window:void 0!==r.g?r.g:"u">typeof self?self:{},ep="object"==typeof eg&&eg&&eg.Object===Object&&eg,em="object"==typeof self&&self&&self.Object===Object&&self,ev=ep||em||Function("return this")(),ey=function(){return ev.Date.now()},ew=/\s/,eE=function(e){for(var t=e.length;t--&&ew.test(e.charAt(t)););return t},eb=/^\s+/,eA=ev.Symbol,eC=Object.prototype,e_=eC.hasOwnProperty,eS=eC.toString,eI=eA?eA.toStringTag:void 0,eT=function(e){var t=e_.call(e,eI),r=e[eI];try{e[eI]=void 0;var n=!0}catch(e){}var i=eS.call(e);return n&&(t?e[eI]=r:delete e[eI]),i},ex=Object.prototype.toString,eD=eA?eA.toStringTag:void 0,eN=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":eD&&eD in Object(e)?eT(e):ex.call(e)},eM=function(e){return"symbol"==typeof e||null!=e&&"object"==typeof e&&"[object Symbol]"==eN(e)},eR=0/0,eO=/^[-+]0x[0-9a-f]+$/i,eP=/^0b[01]+$/i,eB=/^0o[0-7]+$/i,eL=parseInt,ek=function(e){if("number"==typeof e)return e;if(eM(e))return eR;if(ef(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=ef(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=(t=e)?t.slice(0,eE(t)+1).replace(eb,""):t;var n=eP.test(e);return n||eB.test(e)?eL(e.slice(2),n?2:8):eO.test(e)?eR:+e},eF=Math.max,ez=Math.min,eU=function(e,t,r){var n,i,a,o,s,l,u=0,c=!1,h=!1,d=!0;if("function"!=typeof e)throw TypeError("Expected a function");function f(t){var r=n,a=i;return n=i=void 0,u=t,o=e.apply(a,r)}function g(e){var r=e-l,n=e-u;return void 0===l||r>=t||r<0||h&&n>=a}function p(){var e,r,n,i=ey();if(g(i))return v(i);s=setTimeout(p,(e=i-l,r=i-u,n=t-e,h?ez(n,a-r):n))}function v(e){return(s=void 0,d&&n)?f(e):(n=i=void 0,o)}function y(){var e,r=ey(),a=g(r);if(n=arguments,i=this,l=r,a){if(void 0===s)return u=e=l,s=setTimeout(p,t),c?f(e):o;if(h)return clearTimeout(s),s=setTimeout(p,t),f(l)}return void 0===s&&(s=setTimeout(p,t)),o}return t=ek(t)||0,ef(r)&&(c=!!r.leading,a=(h="maxWait"in r)?eF(ek(r.maxWait)||0,t):a,d="trailing"in r?!!r.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),u=0,n=l=i=s=void 0},y.flush=function(){return void 0===s?o:v(ey())},y},eV=D?D.performance:null,eH=eV&&eV.now?function(){return eV.now()}:function(){return Date.now()},ej=function(){if(D){if(D.requestAnimationFrame)return function(e){D.requestAnimationFrame(e)};else if(D.mozRequestAnimationFrame)return function(e){D.mozRequestAnimationFrame(e)};else if(D.webkitRequestAnimationFrame)return function(e){D.webkitRequestAnimationFrame(e)};else if(D.msRequestAnimationFrame)return function(e){D.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(eH())},1e3/60)}}(),eY=function(e){return ej(e)},eX=function(e){for(var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,n=r;!(t=e.next()).done;)n=65599*n+t.value|0;return n},eG=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},eW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},eq=function(e){return 2097152*e[0]+e[1]},eZ=function(e,t){return[eG(e[0],t[0]),eW(e[1],t[1])]},eQ=function(e,t){var r={value:0,done:!1},n=0,i=e.length;return eX({next:function(){return n<i?r.value=e[n++]:r.done=!0,r}},t)},eK=function(e,t){var r={value:0,done:!1},n=0,i=e.length;return eX({next:function(){return n<i?r.value=e.charCodeAt(n++):r.done=!0,r}},t)},e$=function(){return eJ(arguments)},eJ=function(e){for(var t,r=0;r<e.length;r++){var n=e[r];t=0===r?eK(n):eK(n,t)}return t},e1=!0,e0=null!=console.warn,e2=null!=console.trace,e3=Number.MAX_SAFE_INTEGER||0x1fffffffffffff,e4=function(){return!0},e8=function(){return!1},e6=function(){return 0},e5=function(){},e7=function(e){throw Error(e)},e9=function(e){if(void 0===e)return e1;e1=!!e},te=function(e){e9()&&(e0?console.warn(e):(console.log(e),e2&&console.trace()))},tt=function(e){return null==e?e:F(e)?e.slice():z(e)?eo({},e):e},tr=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},tn={},ti=function(){return tn},ta=function(e){var t=Object.keys(e);return function(r){for(var n={},i=0;i<t.length;i++){var a=t[i],o=null==r?void 0:r[a];n[a]=void 0===o?e[a]:o}return n}},to=function(e,t,r){for(var n=e.length-1;n>=0&&(e[n]!==t||(e.splice(n,1),!r));n--);},ts=function(e){e.splice(0,e.length)},tl=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];e.push(n)}},tu=function(e,t,r){return r&&(t=$(r,t)),e[t]},tc=function(e,t,r,n){r&&(t=$(r,t)),e[t]=n},th=function(){function e(){t(this,e),this._obj={}}return i(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),td="u">typeof Map?Map:th,tf=function(){function e(r){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=r){var n;n=null!=r.instanceString&&r.instanceString()===this.instanceString()?r.toArray():r;for(var i=0;i<n.length;i++)this.add(n[i])}}return i(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e}(),tg=("u"<typeof Set?"undefined":e(Set))!=="undefined"?Set:tf,tp=function(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!X(e))return void e7("An element must have a core reference and parameters set");var n=t.group;if(null==n&&(n=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==n&&"edges"!==n)return void e7("An element must be of type `nodes` or `edges`; you specified `"+n+"`");this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===n:!!t.pannable,active:!1,classes:new tg,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];F(t.classes)?l=t.classes:L(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];h&&""!==h&&i.classes.add(h)}this.createEmitter();var d=t.style||t.css;d&&(te("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d)),(void 0===r||r)&&this.restore()},tm=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,r,n){z(t)&&!H(t)&&(t=(i=t).roots||i.root,r=i.visit,n=i.directed),n=2!=arguments.length||k(r)?n:r,r=k(r)?r:function(){};for(var i,a,o=this._private.cy,s=t=L(t)?this.filter(t):t,l=[],u=[],c={},h={},d={},f=0,g=this.byGroup(),p=g.nodes,v=g.edges,y=0;y<s.length;y++){var w=s[y],E=w.id();w.isNode()&&(l.unshift(w),e.bfs&&(d[E]=!0,u.push(w)),h[E]=0)}for(;0!==l.length;){var b=function(){var t=e.bfs?l.shift():l.pop(),i=t.id();if(e.dfs){if(d[i])return"continue";d[i]=!0,u.push(t)}var o=h[i],s=c[i],g=null!=s?s.source():null,y=null!=s?s.target():null,w=null==s?void 0:t.same(g)?y[0]:g[0],E=void 0;if(!0===(E=r(t,s,w,f++,o)))return a=t,"break";if(!1===E)return"break";for(var b=t.connectedEdges().filter(function(e){return(!n||e.source().same(t))&&v.has(e)}),A=0;A<b.length;A++){var C=b[A],_=C.connectedNodes().filter(function(e){return!e.same(t)&&p.has(e)}),S=_.id();0===_.length||d[S]||(_=_[0],l.push(_),e.bfs&&(d[S]=!0,u.push(_)),c[S]=C,h[S]=h[i]+1)}}();if("continue"!==b&&"break"===b)break}for(var A=o.collection(),C=0;C<u.length;C++){var _=u[C],S=c[_.id()];null!=S&&A.push(S),A.push(_)}return{path:o.collection(A),found:o.collection(a)}}},tv={breadthFirstSearch:tm({bfs:!0}),depthFirstSearch:tm({dfs:!0})};tv.bfs=tv.breadthFirstSearch,tv.dfs=tv.depthFirstSearch;var ty=(l=c={exports:{}},u=c.exports,(function(){var e,t,r,n,i,a,o,s,u,c,h,d,f,g;t=Math.floor,u=Math.min,e=function(e,t){return e<t?-1:+(e>t)},s=function(r,n,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=e),i<0)throw Error("lo must be non-negative");for(null==a&&(a=r.length);i<a;)0>o(n,r[s=t((i+a)/2)])?a=s:i=s+1;return[].splice.apply(r,[i,i-i].concat(n)),n},i=function(t,r,n){return null==n&&(n=e),t.push(r),f(t,0,t.length-1,n)},n=function(t,r){var n,i;return null==r&&(r=e),n=t.pop(),t.length?(i=t[0],t[0]=n,g(t,0,r)):i=n,i},o=function(t,r,n){var i;return null==n&&(n=e),i=t[0],t[0]=r,g(t,0,n),i},a=function(t,r,n){var i;return null==n&&(n=e),t.length&&0>n(t[0],r)&&(r=(i=[t[0],r])[0],t[0]=i[1],g(t,0,n)),r},r=function(r,n){var i,a,o,s,l,u;for(null==n&&(n=e),s=(function(){u=[];for(var e=0,n=t(r.length/2);0<=n?e<n:e>n;0<=n?e++:e--)u.push(e);return u}).apply(this).reverse(),l=[],a=0,o=s.length;a<o;a++)i=s[a],l.push(g(r,i,n));return l},d=function(t,r,n){var i;if(null==n&&(n=e),-1!==(i=t.indexOf(r)))return f(t,0,i,n),g(t,i,n)},c=function(t,n,i){var o,s,l,u;if(null==i&&(i=e),!(o=t.slice(0,n)).length)return o;for(r(o,i),s=0,l=(u=t.slice(n)).length;s<l;s++)a(o,u[s],i);return o.sort(i).reverse()},h=function(t,i,a){var o,l,c,h,d,f,g,p,v;if(null==a&&(a=e),10*i<=t.length){if(!(c=t.slice(0,i).sort(a)).length)return c;for(h=0,l=c[c.length-1],f=(g=t.slice(i)).length;h<f;h++)0>a(o=g[h],l)&&(s(c,o,0,null,a),c.pop(),l=c[c.length-1]);return c}for(r(t,a),v=[],d=0,p=u(i,t.length);0<=p?d<p:d>p;0<=p?++d:--d)v.push(n(t,a));return v},f=function(t,r,n,i){var a,o,s;for(null==i&&(i=e),a=t[n];n>r;){if(0>i(a,o=t[s=n-1>>1])){t[n]=o,n=s;continue}break}return t[n]=a},g=function(t,r,n){var i,a,o,s,l;for(null==n&&(n=e),a=t.length,l=r,o=t[r],i=2*r+1;i<a;)(s=i+1)<a&&!(0>n(t[i],t[s]))&&(i=s),t[r]=t[i],i=2*(r=i)+1;return t[r]=o,f(t,l,r,n)},l.exports=function(){function t(t){this.cmp=null!=t?t:e,this.nodes=[]}return t.push=i,t.pop=n,t.replace=o,t.pushpop=a,t.heapify=r,t.updateItem=d,t.nlargest=c,t.nsmallest=h,t.prototype.push=function(e){return i(this.nodes,e,this.cmp)},t.prototype.pop=function(){return n(this.nodes,this.cmp)},t.prototype.peek=function(){return this.nodes[0]},t.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},t.prototype.replace=function(e){return o(this.nodes,e,this.cmp)},t.prototype.pushpop=function(e){return a(this.nodes,e,this.cmp)},t.prototype.heapify=function(){return r(this.nodes,this.cmp)},t.prototype.updateItem=function(e){return d(this.nodes,e,this.cmp)},t.prototype.clear=function(){return this.nodes=[]},t.prototype.empty=function(){return 0===this.nodes.length},t.prototype.size=function(){return this.nodes.length},t.prototype.clone=function(){var e;return(e=new t).nodes=this.nodes.slice(0),e},t.prototype.toArray=function(){return this.nodes.slice(0)},t.prototype.insert=t.prototype.push,t.prototype.top=t.prototype.peek,t.prototype.front=t.prototype.peek,t.prototype.has=t.prototype.contains,t.prototype.copy=t.prototype.clone,t}()}).call(eg),c.exports),tw=ta({root:null,weight:function(e){return 1},directed:!1}),tE=ta({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),tb=ta({weight:function(e){return 1},directed:!1}),tA=ta({weight:function(e){return 1},directed:!1,root:null}),tC=Math.sqrt(2),t_=function(e,t,r){0===r.length&&e7("Karger-Stein must be run on a connected (sub)graph");for(var n=r[e],i=n[1],a=n[2],o=t[i],s=t[a],l=r.length-1;l>=0;l--){var u=r[l],c=u[1],h=u[2];(t[c]===o&&t[h]===s||t[c]===s&&t[h]===o)&&r.splice(l,1)}for(var d=0;d<r.length;d++){var f=r[d];f[1]===s?(r[d]=f.slice(),r[d][1]=o):f[2]===s&&(r[d]=f.slice(),r[d][2]=o)}for(var g=0;g<t.length;g++)t[g]===s&&(t[g]=o);return r},tS=function(e,t,r,n){for(;r>n;)t=t_(Math.floor(Math.random()*t.length),e,t),r--;return t},tI=function(e,t,r){return{x:e.x*t+r.x,y:e.y*t+r.y}},tT=function(e,t,r){return{x:(e.x-r.x)/t,y:(e.y-r.y)/t}},tx=function(e){return{x:e[0],y:e[1]}},tD=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=1/0,i=t;i<r;i++){var a=e[i];isFinite(a)&&(n=Math.min(a,n))}return n},tN=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=-1/0,i=t;i<r;i++){var a=e[i];isFinite(a)&&(n=Math.max(a,n))}return n},tM=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=0,i=0,a=t;a<r;a++){var o=e[a];isFinite(o)&&(n+=o,i++)}return n/i},tR=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=!(arguments.length>5)||void 0===arguments[5]||arguments[5];n?e=e.slice(t,r):(r<e.length&&e.splice(r,e.length-r),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?!isFinite(l)&&(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},tO=function(e,t){return Math.atan2(t,e)-Math.PI/2},tP=Math.log2||function(e){return Math.log(e)/Math.log(2)},tB=function(e){return e>0?1:e<0?-1:0},tL=function(e,t){return Math.sqrt(tk(e,t))},tk=function(e,t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},tF=function(e){for(var t=e.length,r=0,n=0;n<t;n++)r+=e[n];for(var i=0;i<t;i++)e[i]=e[i]/r;return e},tz=function(e,t,r,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*r},tU=function(e,t,r,n){return{x:tz(e.x,t.x,r.x,n),y:tz(e.y,t.y,r.y,n)}},tV=function(e,t,r,n){var i={x:t.x-e.x,y:t.y-e.y},a=tL(e,t),o={x:i.x/a,y:i.y/a};return r=null==r?0:r,n=null!=n?n:r*a,{x:e.x+o.x*n,y:e.y+o.y*n}},tH=function(e,t,r){return Math.max(e,Math.min(r,t))},tj=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};else if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},tY=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},tX=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},tG=function(e,t,r){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r),e.y2=Math.max(e.y2,r),e.h=e.y2-e.y1},tW=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tq=function(e){var t,r,n,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=r=n=i=a[0];else if(2===a.length)t=n=a[0],i=r=a[1];else if(4===a.length){var s=o(a,4);t=s[0],r=s[1],n=s[2],i=s[3]}return e.x1-=i,e.x2+=r,e.y1-=t,e.y2+=n,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tZ=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},tQ=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2<t.x1)&&!(t.x2<e.x1)&&!(e.y2<t.y1)&&!(t.y2<e.y1)&&!(e.y1>t.y2)&&!(t.y1>e.y2)&&!0},tK=function(e,t,r){return e.x1<=t&&t<=e.x2&&e.y1<=r&&r<=e.y2},t$=function(e,t){return tK(e,t.x1,t.y1)&&tK(e,t.x2,t.y2)},tJ=function(e,t,r,n,i,a,o){var s,l,u=rd(i,a),c=i/2,h=a/2,d=r-c+u-o,f=n-h-o,g=r+c-u+o;if((s=ra(e,t,r,n,d,f,g,f,!1)).length>0)return s;var p=r+c+o,v=n-h+u-o,y=n+h-u+o;if((s=ra(e,t,r,n,p,v,p,y,!1)).length>0)return s;var w=r-c+u-o,E=n+h+o,b=r+c-u+o;if((s=ra(e,t,r,n,w,E,b,E,!1)).length>0)return s;var A=r-c-o,C=n-h+u-o,_=n+h-u+o;if((s=ra(e,t,r,n,A,C,A,_,!1)).length>0)return s;var S=r-c+u,I=n-h+u;if((l=rn(e,t,r,n,S,I,u+o)).length>0&&l[0]<=S&&l[1]<=I)return[l[0],l[1]];var T=r+c-u,x=n-h+u;if((l=rn(e,t,r,n,T,x,u+o)).length>0&&l[0]>=T&&l[1]<=x)return[l[0],l[1]];var D=r+c-u,N=n+h-u;if((l=rn(e,t,r,n,D,N,u+o)).length>0&&l[0]>=D&&l[1]>=N)return[l[0],l[1]];var M=r-c+u,R=n+h-u;return(l=rn(e,t,r,n,M,R,u+o)).length>0&&l[0]<=M&&l[1]>=R?[l[0],l[1]]:[]},t1=function(e,t,r,n,i,a,o){var s=Math.min(r,i),l=Math.max(r,i),u=Math.min(n,a),c=Math.max(n,a);return s-o<=e&&e<=l+o&&u-o<=t&&t<=c+o},t0=function(e,t,r,n,i,a,o,s,l){var u={x1:Math.min(r,o,i)-l,x2:Math.max(r,o,i)+l,y1:Math.min(n,s,a)-l,y2:Math.max(n,s,a)+l};return!(e<u.x1)&&!(e>u.x2)&&!(t<u.y1)&&!(t>u.y2)},t2=function(e,t,r,n){var i=t*t-4*e*(r-=n);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},t3=function(e,t,r,n,i){var a,o,s,l,u,c,h,d;if(0===e&&(e=1e-5),t/=e,r/=e,n/=e,a=(o=(3*r-t*t)/9)*o*o+(s=(-(27*n)+t*(9*r-t*t*2))/54)*s,i[1]=0,h=t/3,a>0){u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,0===a){d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),i[4]=-h+d*Math.cos((l+4*Math.PI)/3)},t4=function(e,t,r,n,i,a,o,s){var l,u=[];t3(r*r-4*r*i+2*r*o+4*i*i-4*i*o+o*o+n*n-4*n*a+2*n*s+4*a*a-4*a*s+s*s,9*r*i-3*r*r-3*r*o-6*i*i+3*i*o+9*n*a-3*n*n-3*n*s-6*a*a+3*a*s,3*r*r-6*r*i+r*o-r*e+2*i*i+2*i*e-o*e+3*n*n-6*n*a+n*s-n*t+2*a*a+2*a*t-s*t,r*i-r*r+r*e-i*e+n*a-n*n+n*t-a*t,u);for(var c=[],h=0;h<6;h+=2)1e-7>Math.abs(u[h+1])&&u[h]>=0&&u[h]<=1&&c.push(u[h]);c.push(1),c.push(0);for(var d=-1,f=0;f<c.length;f++)l=Math.pow(Math.pow(1-c[f],2)*r+2*(1-c[f])*c[f]*i+c[f]*c[f]*o-e,2)+Math.pow(Math.pow(1-c[f],2)*n+2*(1-c[f])*c[f]*a+c[f]*c[f]*s-t,2),d>=0?l<d&&(d=l):d=l;return d},t8=function(e,t,r,n,i,a){var o=[e-r,t-n],s=[i-r,a-n],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-a)*(t-a):u-h},t6=function(e,t,r){for(var n,i,a,o,s=0,l=0;l<r.length/2;l++)if(n=r[2*l],i=r[2*l+1],l+1<r.length/2?(a=r[(l+1)*2],o=r[(l+1)*2+1]):(a=r[(l+1-r.length/2)*2],o=r[(l+1-r.length/2)*2+1]),n==e&&a==e);else{if((!(n>=e)||!(e>=a))&&(!(n<=e)||!(e<=a)))continue;(e-n)/(a-n)*(o-i)+i>t&&s++}return s%2!=0},t5=function(e,t,r,n,i,a,o,s,l){var u,c=Array(r.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h=Math.cos(-u),d=Math.sin(-u),f=0;f<c.length/2;f++)c[2*f]=a/2*(r[2*f]*h-r[2*f+1]*d),c[2*f+1]=o/2*(r[2*f+1]*h+r[2*f]*d),c[2*f]+=n,c[2*f+1]+=i;return t6(e,t,l>0?t9(re(c,-l)):c)},t7=function(e,t,r,n,i,a,o){for(var s=Array(r.length),l=a/2,u=o/2,c=rf(a,o),h=c*c,d=0;d<r.length/4;d++){var f=void 0,g=void 0;f=0===d?r.length-2:4*d-2,g=4*d+2;var p=n+l*r[4*d],v=i+u*r[4*d+1],y=c/Math.tan(Math.acos(-r[f]*r[g]-r[f+1]*r[g+1])/2),w=p-y*r[f],E=v-y*r[f+1],b=p+y*r[g],A=v+y*r[g+1];s[4*d]=w,s[4*d+1]=E,s[4*d+2]=b,s[4*d+3]=A;var C=r[f+1],_=-r[f];if(C*r[g]+_*r[g+1]<0&&(C*=-1,_*=-1),Math.pow(w+C*c-e,2)+Math.pow(E+_*c-t,2)<=h)return!0}return t6(e,t,s)},t9=function(e){for(var t,r,n,i,a,o,s,l,u=Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],r=e[4*c+1],n=e[4*c+2],i=e[4*c+3],c<e.length/4-1?(a=e[(c+1)*4],o=e[(c+1)*4+1],s=e[(c+1)*4+2],l=e[(c+1)*4+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var h=ra(t,r,n,i,a,o,s,l,!0);u[2*c]=h[0],u[2*c+1]=h[1]}return u},re=function(e,t){for(var r,n,i,a,o=Array(2*e.length),s=0;s<e.length/2;s++){r=e[2*s],n=e[2*s+1],s<e.length/2-1?(i=e[(s+1)*2],a=e[(s+1)*2+1]):(i=e[0],a=e[1]);var l=a-n,u=-(i-r),c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;o[4*s]=r+h*t,o[4*s+1]=n+d*t,o[4*s+2]=i+h*t,o[4*s+3]=a+d*t}return o},rt=function(e,t,r,n,i,a){var o=r-e,s=n-t,l=Math.sqrt((o/=i)*o+(s/=a)*s),u=l-1;if(u<0)return[];var c=u/l;return[(r-e)*c+e,(n-t)*c+t]},rr=function(e,t,r,n,i,a,o){return e-=i,t-=a,(e/=r/2+o)*e+(t/=n/2+o)*t<=1},rn=function(e,t,r,n,i,a,o){var s=[r-e,n-t],l=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(h<0)return[];var d=(-c+Math.sqrt(h))/(2*u),f=(-c-Math.sqrt(h))/(2*u),g=Math.min(d,f),p=Math.max(d,f),v=[];if(g>=0&&g<=1&&v.push(g),p>=0&&p<=1&&v.push(p),0===v.length)return[];var y=v[0]*s[0]+e,w=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,w]:[y,w,v[1]*s[0]+e,v[1]*s[1]+t]:[y,w]},ri=function(e,t,r){return t<=e&&e<=r||r<=e&&e<=t?e:e<=t&&t<=r||r<=t&&t<=e?t:r},ra=function(e,t,r,n,i,a,o,s,l){var u=e-i,c=r-e,h=o-i,d=t-a,f=n-t,g=s-a,p=h*d-g*u,v=c*d-f*u,y=g*c-h*f;if(0!==y){var w=p/y,E=v/y;return -.001<=w&&w<=1.001&&-.001<=E&&E<=1.001||l?[e+w*c,t+w*f]:[]}return 0!==p&&0!==v?[]:ri(e,r,o)===o?[o,s]:ri(e,r,i)===i?[i,a]:ri(i,o,r)===r?[r,n]:[]},ro=function(e,t,r,n,i,a,o,s){var l,u,c,h,d,f,g=[],p=Array(r.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y<p.length/2;y++)p[2*y]=r[2*y]*a+n,p[2*y+1]=r[2*y+1]*o+i;u=s>0?t9(re(p,-s)):p}else u=r;for(var w=0;w<u.length/2;w++)c=u[2*w],h=u[2*w+1],w<u.length/2-1?(d=u[(w+1)*2],f=u[(w+1)*2+1]):(d=u[0],f=u[1]),0!==(l=ra(e,t,n,i,c,h,d,f)).length&&g.push(l[0],l[1]);return g},rs=function(e,t,r,n,i,a,o,s){for(var l,u=[],c=Array(r.length),h=a/2,d=o/2,f=rf(a,o),g=0;g<r.length/4;g++){var p=void 0,v=void 0;p=0===g?r.length-2:4*g-2,v=4*g+2;var y=n+h*r[4*g],w=i+d*r[4*g+1],E=f/Math.tan(Math.acos(-r[p]*r[v]-r[p+1]*r[v+1])/2),b=y-E*r[p],A=w-E*r[p+1],C=y+E*r[v],_=w+E*r[v+1];0===g?(c[r.length-2]=b,c[r.length-1]=A):(c[4*g-2]=b,c[4*g-1]=A),c[4*g]=C,c[4*g+1]=_;var S=r[p+1],I=-r[p];S*r[v]+I*r[v+1]<0&&(S*=-1,I*=-1),0!==(l=rn(e,t,n,i,b+S*f,A+I*f,f)).length&&u.push(l[0],l[1])}for(var T=0;T<c.length/4;T++)0!==(l=ra(e,t,n,i,c[4*T],c[4*T+1],c[4*T+2],c[4*T+3],!1)).length&&u.push(l[0],l[1]);if(u.length>2){for(var x=[u[0],u[1]],D=Math.pow(x[0]-e,2)+Math.pow(x[1]-t,2),N=1;N<u.length/2;N++){var M=Math.pow(u[2*N]-e,2)+Math.pow(u[2*N+1]-t,2);M<=D&&(x[0]=u[2*N],x[1]=u[2*N+1],D=M)}return x}return u},rl=function(e,t,r){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),a=(i-r)/i;return a<0&&(a=1e-5),[t[0]+a*n[0],t[1]+a*n[1]]},ru=function(e,t){var r=rh(e,t);return rc(r)},rc=function(e){for(var t,r,n=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<n;l++)t=e[2*l],r=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,r),s=Math.max(s,r);for(var u=2/(o-i),c=2/(s-a),h=0;h<n;h++)t=e[2*h]=e[2*h]*u,r=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,r),s=Math.max(s,r);if(a<-1)for(var d=0;d<n;d++)r=e[2*d+1]=e[2*d+1]+(-1-a);return e},rh=function(e,t){var r,n=1/e*2*Math.PI,i=e%2==0?Math.PI/2+n/2:Math.PI/2;i+=t;for(var a=Array(2*e),o=0;o<e;o++)r=o*n+i,a[2*o]=Math.cos(r),a[2*o+1]=Math.sin(-r);return a},rd=function(e,t){return Math.min(e/4,t/4,8)},rf=function(e,t){return Math.min(e/10,t/10,8)},rg=function(){return 8},rp=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},rm=ta({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),rv=ta({root:null,weight:function(e){return 1},directed:!1,alpha:0}),ry={degreeCentralityNormalized:function(e){e=rv(e);var t=this.cy(),r=this.nodes(),n=r.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<n;l++){var u=r[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(e){return 0==o?0:(L(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(L(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var d={},f=0,g=0;g<n;g++){var p=r[g];e.root=p;var v=this.degreeCentrality(e);f<v.degree&&(f=v.degree),d[p.id()]=v.degree}return{degree:function(e){return 0===f?0:(L(e)&&(e=t.filter(e)),d[e.id()]/f)}}},degreeCentrality:function(e){e=rv(e);var t=this.cy(),r=this,n=e,i=n.root,a=n.weight,o=n.directed,s=n.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),u=l.filter(function(e){return e.target().same(i)&&r.has(e)}),c=l.filter(function(e){return e.source().same(i)&&r.has(e)}),h=u.length,d=c.length,f=0,g=0,p=0;p<u.length;p++)f+=a(u[p]);for(var v=0;v<c.length;v++)g+=a(c[v]);return{indegree:Math.pow(h,1-s)*Math.pow(f,s),outdegree:Math.pow(d,1-s)*Math.pow(g,s)}}for(var y=i.connectedEdges().intersection(r),w=y.length,E=0,b=0;b<y.length;b++)E+=a(y[b]);return{degree:Math.pow(w,1-s)*Math.pow(E,s)}}};ry.dc=ry.degreeCentrality,ry.dcn=ry.degreeCentralityNormalised=ry.degreeCentralityNormalized;var rw=ta({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),rE={closenessCentralityNormalized:function(e){for(var t=rw(e),r=t.harmonic,n=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:n,directed:i}),c=0;c<l.length;c++){for(var h=0,d=l[c],f=0;f<l.length;f++)if(c!==f){var g=u.distance(d,l[f]);r?h+=1/g:h+=g}r||(h=1/h),s<h&&(s=h),o[d.id()]=h}return{closeness:function(e){return 0==s?0:o[e=L(e)?a.filter(e)[0].id():e.id()]/s}}},closenessCentrality:function(e){var t=rw(e),r=t.root,n=t.weight,i=t.directed,a=t.harmonic;r=this.filter(r)[0];for(var o=this.dijkstra({root:r,weight:n,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(r)){var h=o.distanceTo(c);a?s+=1/h:s+=h}}return a?s:1/s}};rE.cc=rE.closenessCentrality,rE.ccn=rE.closenessCentralityNormalised=rE.closenessCentralityNormalized;var rb=ta({weight:null,directed:!1}),rA={betweennessCentrality:function(e){for(var t=rb(e),r=t.directed,n=t.weight,i=null!=n,a=this.cy(),o=this.nodes(),s={},l={},u=0,c=function(e,t){l[e]=t,t>u&&(u=t)},h=function(e){return l[e]},d=0;d<o.length;d++){var f=o[d],g=f.id();r?s[g]=f.outgoers().nodes():s[g]=f.openNeighborhood().nodes(),c(g,0)}for(var p=0;p<o.length;p++)!function(e){for(var t=o[e].id(),r=[],l={},u={},d={},f=new ty(function(e,t){return d[e]-d[t]}),g=0;g<o.length;g++){var p=o[g].id();l[p]=[],u[p]=0,d[p]=1/0}for(u[t]=1,d[t]=0,f.push(t);!f.empty();){var v=f.pop();if(r.push(v),i)for(var y=0;y<s[v].length;y++){var w=s[v][y],E=a.getElementById(v),b=n(E.edgesTo(w).length>0?E.edgesTo(w)[0]:w.edgesTo(E)[0]);d[w=w.id()]>d[v]+b&&(d[w]=d[v]+b,0>f.nodes.indexOf(w)?f.push(w):f.updateItem(w),u[w]=0,l[w]=[]),d[w]==d[v]+b&&(u[w]=u[w]+u[v],l[w].push(v))}else for(var A=0;A<s[v].length;A++){var C=s[v][A].id();d[C]==1/0&&(f.push(C),d[C]=d[v]+1),d[C]==d[v]+1&&(u[C]=u[C]+u[v],l[C].push(v))}}for(var _={},S=0;S<o.length;S++)_[o[S].id()]=0;for(;r.length>0;){for(var I=r.pop(),T=0;T<l[I].length;T++){var x=l[I][T];_[x]=_[x]+u[x]/u[I]*(1+_[I])}I!=o[e].id()&&c(I,h(I)+_[I])}}(p);var v={betweenness:function(e){return h(a.collection(e).id())},betweennessNormalized:function(e){return 0==u?0:h(a.collection(e).id())/u}};return v.betweennessNormalised=v.betweennessNormalized,v}};rA.bc=rA.betweennessCentrality;var rC=ta({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),r_=function(e,t){for(var r=0,n=0;n<t.length;n++)r+=t[n](e);return r},rS=function(e,t,r){for(var n=0;n<t;n++)e[n*t+n]=r},rI=function(e,t){for(var r,n=0;n<t;n++){r=0;for(var i=0;i<t;i++)r+=e[i*t+n];for(var a=0;a<t;a++)e[a*t+n]=e[a*t+n]/r}},rT=function(e,t,r){for(var n=Array(r*r),i=0;i<r;i++){for(var a=0;a<r;a++)n[i*r+a]=0;for(var o=0;o<r;o++)for(var s=0;s<r;s++)n[i*r+s]+=e[i*r+o]*t[o*r+s]}return n},rx=function(e,t,r){for(var n=e.slice(0),i=1;i<r;i++)e=rT(e,n,t);return e},rD=function(e,t,r){for(var n=Array(t*t),i=0;i<t*t;i++)n[i]=Math.pow(e[i],r);return rI(n,t),n},rN=function(e,t,r,n){for(var i=0;i<r;i++)if(Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n)!=Math.round(t[i]*Math.pow(10,n))/Math.pow(10,n))return!1;return!0},rM=function(e,t,r,n){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(r[s]);0!==o.length&&i.push(n.collection(o))}return i},rR=function(e,t){for(var r=0;r<e.length;r++)if(!t[r]||e[r].id()!==t[r].id())return!1;return!0},rO=function(e){for(var t=0;t<e.length;t++)for(var r=0;r<e.length;r++)t!=r&&rR(e[t],e[r])&&e.splice(r,1);return e},rP=function(e){for(var t=this.nodes(),r=this.edges(),n=this.cy(),i=rC(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=Array(u),h=0;h<u;h++)c[h]=0;for(var d=0;d<r.length;d++){var f=r[d],g=a[f.source().id()],p=a[f.target().id()],v=r_(f,i.attributes);c[g*l+p]+=v,c[p*l+g]+=v}rS(c,l,i.multFactor),rI(c,l);for(var y=!0,w=0;y&&w<i.maxIterations;)y=!1,rN(c=rD(s=rx(c,l,i.expandFactor),l,i.inflateFactor),s,u,4)||(y=!0),w++;var E=rM(c,l,t,n);return rO(E)},rB=function(e){return e},rL=function(e,t){return Math.abs(t-e)},rk=function(e,t,r){return e+rL(t,r)},rF=function(e,t,r){return e+Math.pow(r-t,2)},rz=function(e){return Math.sqrt(e)},rU=function(e,t,r){return Math.max(e,rL(t,r))},rV=function(e,t,r,n,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:rB,o=n,s=0;s<e;s++)o=i(o,t(s),r(s));return a(o)},rH={euclidean:function(e,t,r){return e>=2?rV(e,t,r,0,rF,rz):rV(e,t,r,0,rk)},squaredEuclidean:function(e,t,r){return rV(e,t,r,0,rF)},manhattan:function(e,t,r){return rV(e,t,r,0,rk)},max:function(e,t,r){return rV(e,t,r,-1/0,rU)}};function rj(e,t,r,n,i,a){var o;return(o=k(e)?e:rH[e]||rH.euclidean,0===t&&k(e))?o(i,a):o(t,r,n,i,a)}rH["squared-euclidean"]=rH.squaredEuclidean,rH.squaredeuclidean=rH.squaredEuclidean;var rY=ta({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),rX=function(e){return rY(e)},rG=function(e,t,r,n,i){var a="kMedoids"!==i?function(e){return r[e]}:function(e){return n[e](r)};return rj(e,n.length,a,function(e){return n[e](t)},r,t)},rW=function(e,t,r){for(var n=r.length,i=Array(n),a=Array(n),o=Array(t),s=null,l=0;l<n;l++)i[l]=e.min(r[l]).value,a[l]=e.max(r[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<n;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[u]=s}return o},rq=function(e,t,r,n,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=rG(r,e,t[s],n,i);l<a&&(a=l,o=s)}return o},rZ=function(e,t,r){for(var n=[],i=null,a=0;a<t.length;a++)r[(i=t[a]).id()]===e&&n.push(i);return n},rQ=function(e,t,r){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)if(Math.abs(e[n][i]-t[n][i])>r)return!1;return!0},rK=function(e,t,r){for(var n=0;n<r;n++)if(e===t[n])return!0;return!1},r$=function(e,t){var r=Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var i=e[Math.floor(Math.random()*e.length)];rK(i,r,n);)i=e[Math.floor(Math.random()*e.length)];r[n]=i}else for(var a=0;a<t;a++)r[a]=e[Math.floor(Math.random()*e.length)];return r},rJ=function(e,t,r){for(var n=0,i=0;i<t.length;i++)n+=rG("manhattan",t[i],e,r,"kMedoids");return n},r1=function(e,t,r,n,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)n[s][l]=Math.pow(r[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=n[h][u]*i.attributes[c](t[h]),o+=n[h][u];e[u][c]=a/o}},r0=function(e,t,r,n,i){for(var a,o=0;o<e.length;o++)t[o]=e[o].slice();for(var s=2/(i.m-1),l=0;l<r.length;l++)for(var u=0;u<n.length;u++){a=0;for(var c=0;c<r.length;c++)a+=Math.pow(rG(i.distance,n[u],r[l],i.attributes,"cmeans")/rG(i.distance,n[u],r[c],i.attributes,"cmeans"),s);e[u][l]=1/a}},r2=function(e,t,r,n){for(var i,a,o=Array(r.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var u=0;u<t[0].length;u++)t[l][u]>i&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c<o.length;c++)o[c]=n.collection(o[c]);return o},r3=function(e){var t,r,n,i,a=this.cy(),o=this.nodes(),s=rX(e);n=Array(o.length);for(var l=0;l<o.length;l++)n[l]=Array(s.k);r=Array(o.length);for(var u=0;u<o.length;u++)r[u]=Array(s.k);for(var c=0;c<o.length;c++){for(var h=0,d=0;d<s.k;d++)r[c][d]=Math.random(),h+=r[c][d];for(var f=0;f<s.k;f++)r[c][f]=r[c][f]/h}t=Array(s.k);for(var g=0;g<s.k;g++)t[g]=Array(s.attributes.length);i=Array(o.length);for(var p=0;p<o.length;p++)i[p]=Array(s.k);for(var v=!0,y=0;v&&y<s.maxIterations;)v=!1,r1(t,o,r,i,s),r0(r,n,t,o,s),rQ(r,n,s.sensitivityThreshold)||(v=!0),y++;return{clusters:r2(o,r,s,a),degreeOfMembership:r}},r4=ta({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),r8={single:"min",complete:"max"},r6=function(e){var t=r4(e),r=r8[t.linkage];return null!=r&&(t.linkage=r),t},r5=function(e,t,r,n,i){for(var a,o,s=0,l=1/0,u=i.attributes,c=function(e,t){return rj(i.distance,u.length,function(t){return u[t](e)},function(e){return u[e](t)},e,t)},h=0;h<e.length;h++){var d=e[h].key,f=r[d][n[d]];f<l&&(s=d,l=f)}if("threshold"===i.mode&&l>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var g=t[s],p=t[n[s]];o="dendrogram"===i.mode?{left:g,right:p,key:g.key}:{value:g.value.concat(p.value),key:g.key},e[g.index]=o,e.splice(p.index,1),t[g.key]=o;for(var v=0;v<e.length;v++){var y=e[v];g.key===y.key?a=1/0:"min"===i.linkage?(a=r[g.key][y.key],r[g.key][y.key]>r[p.key][y.key]&&(a=r[p.key][y.key])):"max"===i.linkage?(a=r[g.key][y.key],r[g.key][y.key]<r[p.key][y.key]&&(a=r[p.key][y.key])):a="mean"===i.linkage?(r[g.key][y.key]*g.size+r[p.key][y.key]*p.size)/(g.size+p.size):"dendrogram"===i.mode?c(y.value,g.value):c(y.value[0],g.value[0]),r[g.key][y.key]=r[y.key][g.key]=a}for(var w=0;w<e.length;w++){var E=e[w].key;if(n[E]===g.key||n[E]===p.key){for(var b=E,A=0;A<e.length;A++){var C=e[A].key;r[E][C]<r[E][b]&&(b=C)}n[E]=b}e[w].index=w}return g.key=p.key=g.index=p.index=null,!0},r7=function e(t,r,n){t&&(t.value?r.push(t.value):(t.left&&e(t.left,r),t.right&&e(t.right,r)))},r9=function e(t,r){if(!t)return"";if(t.left&&t.right){var n=e(t.left,r),i=e(t.right,r),a=r.add({group:"nodes",data:{id:n+","+i}});return r.add({group:"edges",data:{source:n,target:a.id()}}),r.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}if(t.value)return t.value.id()},ne=function e(t,r,n){if(!t)return[];var i=[],a=[],o=[];if(0===r)return t.left&&r7(t.left,i),t.right&&r7(t.right,a),o=i.concat(a),[n.collection(o)];if(1===r)if(t.value)return[n.collection(t.value)];else return t.left&&r7(t.left,i),t.right&&r7(t.right,a),[n.collection(i),n.collection(a)];return t.value?[n.collection(t.value)]:(t.left&&(i=e(t.left,r-1,n)),t.right&&(a=e(t.right,r-1,n)),i.concat(a))},nt=function(e){for(var t,r=this.cy(),n=this.nodes(),i=r6(e),a=i.attributes,o=function(e,t){return rj(i.distance,a.length,function(t){return a[t](e)},function(e){return a[e](t)},e,t)},s=[],l=[],u=[],c=[],h=0;h<n.length;h++){var d={value:"dendrogram"===i.mode?n[h]:[n[h]],key:h,index:h};s[h]=d,c[h]=d,l[h]=[],u[h]=0}for(var f=0;f<s.length;f++)for(var g=0;g<=f;g++){var p=void 0;p="dendrogram"===i.mode?f===g?1/0:o(s[f].value,s[g].value):f===g?1/0:o(s[f].value[0],s[g].value[0]),l[f][g]=p,l[g][f]=p,p<l[f][u[f]]&&(u[f]=g)}for(var v=r5(s,c,l,u,i);v;)v=r5(s,c,l,u,i);return"dendrogram"===i.mode?(t=ne(s[0],i.dendrogramDepth,r),i.addDendrogram&&r9(s[0],r)):(t=Array(s.length),s.forEach(function(e,n){e.key=e.index=null,t[n]=r.collection(e.value)})),t},nr=ta({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),nn=function(e){var t=e.damping,r=e.preference;.5<=t&&t<1||e7("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(e){return e===r})||U(r)||e7("Preference must be one of [".concat(n.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number. Got: ").concat(r)),nr(e)},ni=function(e,t,r,n){var i=function(e,t){return n[t](e)};return-rj(e,n.length,function(e){return i(t,e)},function(e){return i(r,e)},t,r)},na=function(e,t){return"median"===t?tR(e):"mean"===t?tM(e):"min"===t?tD(e):"max"===t?tN(e):t},no=function(e,t,r){for(var n=[],i=0;i<e;i++)t[i*e+i]+r[i*e+i]>0&&n.push(i);return n},ns=function(e,t,r){for(var n=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<r.length;s++){var l=r[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&n.push(a)}for(var u=0;u<r.length;u++)n[r[u]]=r[u];return n},nl=function(e,t,r){for(var n=ns(e,t,r),i=0;i<r.length;i++){for(var a=[],o=0;o<n.length;o++)n[o]===r[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[u]];c>l&&(s=u,l=c)}r[i]=a[s]}return ns(e,t,r)},nu=function(e){for(var t,r,n,i,a,o,s,l=this.cy(),u=this.nodes(),c=nn(e),h={},d=0;d<u.length;d++)h[u[d].id()]=d;n=Array(r=(t=u.length)*t);for(var f=0;f<r;f++)n[f]=-1/0;for(var g=0;g<t;g++)for(var p=0;p<t;p++)g!==p&&(n[g*t+p]=ni(c.distance,u[g],u[p],c.attributes));i=na(n,c.preference);for(var v=0;v<t;v++)n[v*t+v]=i;a=Array(r);for(var y=0;y<r;y++)a[y]=0;o=Array(r);for(var w=0;w<r;w++)o[w]=0;for(var E=Array(t),b=Array(t),A=Array(t),C=0;C<t;C++)E[C]=0,b[C]=0,A[C]=0;for(var _=Array(t*c.minIterations),S=0;S<_.length;S++)_[S]=0;for(s=0;s<c.maxIterations;s++){for(var I=0;I<t;I++){for(var T=-1/0,x=-1/0,D=-1,N=0,M=0;M<t;M++)E[M]=a[I*t+M],(N=o[I*t+M]+n[I*t+M])>=T?(x=T,T=N,D=M):N>x&&(x=N);for(var R=0;R<t;R++)a[I*t+R]=(1-c.damping)*(n[I*t+R]-T)+c.damping*E[R];a[I*t+D]=(1-c.damping)*(n[I*t+D]-x)+c.damping*E[D]}for(var O=0;O<t;O++){for(var P=0,B=0;B<t;B++)E[B]=o[B*t+O],b[B]=Math.max(0,a[B*t+O]),P+=b[B];P-=b[O],b[O]=a[O*t+O],P+=b[O];for(var L=0;L<t;L++)o[L*t+O]=(1-c.damping)*Math.min(0,P-b[L])+c.damping*E[L];o[O*t+O]=(1-c.damping)*(P-b[O])+c.damping*E[O]}for(var k=0,F=0;F<t;F++){var z=+(o[F*t+F]+a[F*t+F]>0);_[s%c.minIterations*t+F]=z,k+=z}if(k>0&&(s>=c.minIterations-1||s==c.maxIterations-1)){for(var U=0,V=0;V<t;V++){A[V]=0;for(var H=0;H<c.minIterations;H++)A[V]+=_[H*t+V];(0===A[V]||A[V]===c.minIterations)&&U++}if(U===t)break}}for(var j=no(t,a,o),Y=nl(t,n,j),X={},G=0;G<j.length;G++)X[j[G]]=[];for(var W=0;W<u.length;W++){var q=Y[h[u[W].id()]];null!=q&&X[q].push(u[W])}for(var Z=Array(j.length),Q=0;Q<j.length;Q++)Z[Q]=l.collection(X[j[Q]]);return Z},nc=ta({root:void 0,directed:!1}),nh=function(){var e=this,t={},r=0,n=0,i=[],a=[],o={},s=function(r,n){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=r||a[o].y!=n;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(r){var n=r.connectedNodes().intersection(e);l.merge(r),n.forEach(function(r){var n=r.id(),i=r.connectedEdges().intersection(e);l.merge(r),t[n].cutVertex?l.merge(i.filter(function(e){return e.isLoop()})):l.merge(i)})}),i.push(l)},l=function l(u,c,h){u===h&&(n+=1),t[c]={id:r,low:r++,cutVertex:!1};var d,f,g,p,v=e.getElementById(c).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(c))):v.forEach(function(e){d=e.source().id(),f=e.target().id(),(g=d===c?f:d)!==h&&(o[p=e.id()]||(o[p]=!0,a.push({x:c,y:g,edge:e})),g in t?t[c].low=Math.min(t[c].low,t[g].id):(l(u,g,c),t[c].low=Math.min(t[c].low,t[g].low),t[c].id<=t[g].low&&(t[c].cutVertex=!0,s(c,g))))})};e.forEach(function(e){if(e.isNode()){var r=e.id();r in t||(n=0,l(r,r),t[r].cutVertex=n>1)}});var u=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(u),components:i}},nd=function(){var e=this,t={},r=0,n=[],i=[],a=e.spawn(e),o=function o(s){if(i.push(s),t[s]={index:r,low:r++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var r=e.target().id();r!==s&&(r in t||o(r),t[r].explored||(t[s].low=Math.min(t[s].low,t[r].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),h=l.merge(c);n.push(h),a=a.difference(h)}};return e.forEach(function(e){if(e.isNode()){var r=e.id();r in t||o(r)}}),{cut:a,components:n}},nf={};[tv,{dijkstra:function(e){if(!z(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var r=tw(e),n=r.root,i=r.weight,a=r.directed,o=this,s=L(n)?this.filter(n)[0]:n[0],l={},u={},c={},h=this.byGroup(),d=h.nodes,f=h.edges;f.unmergeBy(function(e){return e.isLoop()});for(var g=function(e){return l[e.id()]},p=new ty(function(e,t){return g(e)-g(t)}),v=0;v<d.length;v++){var y=d[v];l[y.id()]=y.same(s)?0:1/0,p.push(y)}for(;p.size()>0;){var w=p.pop(),E=g(w);if(c[w.id()]=E,E!==1/0)for(var b=w.neighborhood().intersect(d),A=0;A<b.length;A++){var C=b[A],_=C.id(),S=function(e,t){for(var r,n=(a?e.edgesTo(t):e.edgesWith(t)).intersect(f),o=1/0,s=0;s<n.length;s++){var l=n[s],u=i(l);(u<o||!r)&&(o=u,r=l)}return{edge:r,dist:o}}(w,C),I=E+S.dist;I<g(C)&&(l[C.id()]=I,p.updateItem(C),u[_]={node:w,edge:S.edge})}}return{distanceTo:function(e){return c[(L(e)?d.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=L(e)?d.filter(e)[0]:e[0],r=[],n=t,i=n.id();if(t.length>0)for(r.unshift(t);u[i];){var a=u[i];r.unshift(a.edge),r.unshift(a.node),i=(n=a.node).id()}return o.spawn(r)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),r=t.nodes,n=t.edges,i=r.length,a=Array(i),o=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},s=0;s<i;s++)a[s]=this.spawn(r[s]);for(var l=n.sort(function(t,r){return e(t)-e(r)}),u=0;u<l.length;u++){var c=l[u],h=c.source()[0],d=c.target()[0],f=o(h),g=o(d),p=a[f],v=a[g];f!==g&&(r.merge(c),p.merge(v),a.splice(g,1))}return r}},{aStar:function(e){var t,r,n=this.cy(),i=tE(e),a=i.root,o=i.goal,s=i.heuristic,l=i.directed,u=i.weight;a=n.collection(a)[0],o=n.collection(o)[0];var c=a.id(),h=o.id(),d={},f={},g={},p=new ty(function(e,t){return f[e.id()]-f[t.id()]}),v=new tg,y={},w={},E=function(e,t){p.push(e),v.add(t)};E(a,c),d[c]=0,f[c]=s(a);for(var b=0;p.size()>0;){if(r=(t=p.pop()).id(),v.delete(r),b++,r===h){for(var A=[],C=o,_=h,S=w[_];A.unshift(C),null!=S&&A.unshift(S),null!=(C=y[_]);)S=w[_=C.id()];return{found:!0,distance:d[r],path:this.spawn(A),steps:b}}g[r]=!0;for(var I=t._private.edges,T=0;T<I.length;T++){var x=I[T];if(this.hasElementWithId(x.id())&&(!l||x.data("source")===r)){var D=x.source(),N=x.target(),M=D.id()!==r?D:N,R=M.id();if(this.hasElementWithId(R)&&!g[R]){var O=d[r]+u(x);if(!v.has(R)){d[R]=O,f[R]=O+s(M),E(M,R),y[R]=t,w[R]=x;continue}O<d[R]&&(d[R]=O,f[R]=O+s(M),y[R]=t,w[R]=x)}}}}return{found:!1,distance:void 0,path:void 0,steps:b}}},{floydWarshall:function(e){for(var t=this.cy(),r=tb(e),n=r.weight,i=r.directed,a=this.byGroup(),o=a.nodes,s=a.edges,l=o.length,u=l*l,c=function(e){return o.indexOf(e)},h=function(e){return o[e]},d=Array(u),f=0;f<u;f++){var g=f%l;(f-g)/l===g?d[f]=0:d[f]=1/0}for(var p=Array(u),v=Array(u),y=0;y<s.length;y++){var w=s[y],E=w.source()[0],b=w.target()[0];if(E!==b){var A=c(E),C=c(b),_=A*l+C,S=n(w);if(d[_]>S&&(d[_]=S,p[_]=C,v[_]=w),!i){var I=C*l+A;!i&&d[I]>S&&(d[I]=S,p[I]=A,v[I]=w)}}}for(var T=0;T<l;T++)for(var x=0;x<l;x++)for(var D=x*l+T,N=0;N<l;N++){var M=x*l+N,R=T*l+N;d[D]+d[R]<d[M]&&(d[M]=d[D]+d[R],p[M]=p[D])}var O=function(e){return c((L(e)?t.filter(e):e)[0])};return{distance:function(e,t){return d[O(e)*l+O(t)]},path:function(e,r){var n,i=O(e),a=O(r),o=h(i);if(i===a)return o.collection();if(null==p[i*l+a])return t.collection();var s=t.collection(),u=i;for(s.merge(o);i!==a;)u=i,i=p[i*l+a],n=v[u*l+i],s.merge(n),s.merge(h(i));return s}}}},{bellmanFord:function(e){var t=this,r=tA(e),n=r.weight,i=r.directed,a=r.root,o=this,s=this.cy(),l=this.byGroup(),u=l.edges,c=l.nodes,h=c.length,d=new td,f=!1,g=[];a=s.collection(a)[0],u.unmergeBy(function(e){return e.isLoop()});for(var p=u.length,v=function(e){var t=d.get(e.id());return t||(t={},d.set(e.id(),t)),t},y=function(e){return(L(e)?s.$(e):e)[0]},w=0;w<h;w++){var E=c[w],b=v(E);E.same(a)?b.dist=0:b.dist=1/0,b.pred=null,b.edge=null}for(var A=!1,C=function(e,t,r,n,i,a){var o=n.dist+a;o<i.dist&&!r.same(n.edge)&&(i.dist=o,i.pred=e,i.edge=r,A=!0)},_=1;_<h;_++){A=!1;for(var S=0;S<p;S++){var I=u[S],T=I.source(),x=I.target(),D=n(I),N=v(T),M=v(x);C(T,x,I,N,M,D),i||C(x,T,I,M,N,D)}if(!A)break}if(A)for(var R=[],O=0;O<p;O++){var P=u[O],B=P.source(),k=P.target(),F=n(P),z=v(B).dist,U=v(k).dist;if(z+F<U||!i&&U+F<z)if(f||(te("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),!1!==e.findNegativeWeightCycles){var V=[];z+F<U&&V.push(B),!i&&U+F<z&&V.push(k);for(var H=V.length,j=0;j<H;j++){var Y=V[j],X=[Y];X.push(v(Y).edge);for(var G=v(Y).pred;-1===X.indexOf(G);)X.push(G),X.push(v(G).edge),G=v(G).pred;for(var W=(X=X.slice(X.indexOf(G)))[0].id(),q=0,Z=2;Z<X.length;Z+=2)X[Z].id()<W&&(W=X[Z].id(),q=Z);(X=X.slice(q).concat(X.slice(0,q))).push(X[0]);var Q=X.map(function(e){return e.id()}).join(",");-1===R.indexOf(Q)&&(g.push(o.spawn(X)),R.push(Q))}}else break}return{distanceTo:function(e){return v(y(e)).dist},pathTo:function(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,n=y(e),i=[],s=n;;){if(null==s)return t.spawn();var l=v(s),u=l.edge,c=l.pred;if(i.unshift(s[0]),s.same(r)&&i.length>0)break;null!=u&&i.unshift(u),s=c}return o.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},{kargerStein:function(){var e=this,t=this.byGroup(),r=t.nodes,n=t.edges;n.unmergeBy(function(e){return e.isLoop()});var i=r.length,a=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/tC);if(i<2)return void e7("At least 2 nodes are required for Karger-Stein algorithm");for(var l=[],u=0;u<a;u++){var c=n[u];l.push([u,r.indexOf(c.source()),r.indexOf(c.target())])}for(var h=1/0,d=[],f=Array(i),g=Array(i),p=Array(i),v=function(e,t){for(var r=0;r<i;r++)t[r]=e[r]},y=0;y<=o;y++){for(var w=0;w<i;w++)g[w]=w;var E=tS(g,l.slice(),i,s),b=E.slice();v(g,p);var A=tS(g,E,s,2),C=tS(p,b,s,2);A.length<=C.length&&A.length<h?(h=A.length,d=A,v(g,f)):C.length<=A.length&&C.length<h&&(h=C.length,d=C,v(p,f))}for(var _=this.spawn(d.map(function(e){return n[e[0]]})),S=this.spawn(),I=this.spawn(),T=f[0],x=0;x<f.length;x++){var D=f[x],N=r[x];D===T?S.merge(N):I.merge(N)}var M=function(t){var r=e.spawn();return t.forEach(function(t){r.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!_.contains(t)&&r.merge(t)})}),r};return{cut:_,components:[M(S),M(I)],partition1:S,partition2:I}}},{pageRank:function(e){for(var t,r=rm(e),n=r.dampingFactor,i=r.precision,a=r.iterations,o=r.weight,s=this._private.cy,l=this.byGroup(),u=l.nodes,c=l.edges,h=u.length,d=h*h,f=c.length,g=Array(d),p=Array(h),v=(1-n)/h,y=0;y<h;y++){for(var w=0;w<h;w++)g[y*h+w]=0;p[y]=0}for(var E=0;E<f;E++){var b=c[E],A=b.data("source"),C=b.data("target");if(A!==C){var _=u.indexOfId(A),S=u.indexOfId(C),I=o(b),T=S*h+_;g[T]+=I,p[_]+=I}}for(var x=1/h+v,D=0;D<h;D++)if(0===p[D])for(var N=0;N<h;N++)g[N*h+D]=x;else for(var M=0;M<h;M++){var R=M*h+D;g[R]=g[R]/p[D]+v}for(var O=Array(h),P=Array(h),B=0;B<h;B++)O[B]=1;for(var L=0;L<a;L++){for(var k=0;k<h;k++)P[k]=0;for(var F=0;F<h;F++)for(var z=0;z<h;z++){var U=F*h+z;P[F]+=g[U]*O[z]}tF(P),t=O,O=P,P=t;for(var V=0,H=0;H<h;H++){var j=t[H]-O[H];V+=j*j}if(V<i)break}return{rank:function(e){return e=s.collection(e)[0],O[u.indexOf(e)]}}}},ry,rE,rA,{markovClustering:rP,mcl:rP},{kMeans:function(t){var r,n=this.cy(),i=this.nodes(),a=null,o=rX(t),s=Array(o.k),l={};o.testMode?"number"==typeof o.testCentroids?(o.testCentroids,r=rW(i,o.k,o.attributes)):r="object"===e(o.testCentroids)?o.testCentroids:rW(i,o.k,o.attributes):r=rW(i,o.k,o.attributes);for(var u=!0,c=0;u&&c<o.maxIterations;){for(var h=0;h<i.length;h++)l[(a=i[h]).id()]=rq(a,r,o.distance,o.attributes,"kMeans");u=!1;for(var d=0;d<o.k;d++){var f=rZ(d,i,l);if(0!==f.length){for(var g=o.attributes.length,p=r[d],v=Array(g),y=Array(g),w=0;w<g;w++){y[w]=0;for(var E,b=0;b<f.length;b++)a=f[b],y[w]+=o.attributes[w](a);v[w]=y[w]/f.length,E=v[w],Math.abs(p[w]-E)<=o.sensitivityThreshold||(u=!0)}r[d]=v,s[d]=n.collection(f)}}c++}return s},kMedoids:function(t){var r,n,i=this.cy(),a=this.nodes(),o=null,s=rX(t),l=Array(s.k),u={},c=Array(s.k);s.testMode?"number"==typeof s.testCentroids||(r="object"===e(s.testCentroids)?s.testCentroids:r$(a,s.k)):r=r$(a,s.k);for(var h=!0,d=0;h&&d<s.maxIterations;){for(var f=0;f<a.length;f++)u[(o=a[f]).id()]=rq(o,r,s.distance,s.attributes,"kMedoids");h=!1;for(var g=0;g<r.length;g++){var p=rZ(g,a,u);if(0!==p.length){c[g]=rJ(r[g],p,s.attributes);for(var v=0;v<p.length;v++)(n=rJ(p[v],p,s.attributes))<c[g]&&(c[g]=n,r[g]=p[v],h=!0);l[g]=i.collection(p)}}d++}return l},fuzzyCMeans:r3,fcm:r3},{hierarchicalClustering:nt,hca:nt},{affinityPropagation:nu,ap:nu},{hierholzer:function(e){if(!z(e)){var t,r,n,i=arguments;e={root:i[0],directed:i[1]}}var a=nc(e),o=a.root,s=a.directed,l=!1;o&&(n=L(o)?this.filter(o)[0].id():o[0].id());var u={},c={};s?this.forEach(function(e){var n=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?t?l=!0:t=n:1==s?r?l=!0:r=n:(s>1||o>1)&&(l=!0),u[n]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[n].push(e.id())})}else c[n]=[void 0,e.target().id()]}):this.forEach(function(e){var n=e.id();e.isNode()?(e.degree(!0)%2&&(t?r?l=!0:r=n:t=n),u[n]=[],e.connectedEdges().forEach(function(e){return u[n].push(e.id())})):c[n]=[e.source().id(),e.target().id()]});var h={found:!1,trail:void 0};if(l)return h;if(r&&t)if(s){if(n&&r!=n)return h;n=r}else{if(n&&r!=n&&t!=n)return h;n||(n=r)}else n||(n=this[0].id());var d=function(e){for(var t,r,n,i=e,a=[e];u[i].length;)r=c[t=u[i].shift()][0],i!=(n=c[t][1])?(u[n]=u[n].filter(function(e){return e!=t}),i=n):s||i==r||(u[r]=u[r].filter(function(e){return e!=t}),i=r),a.unshift(t),a.unshift(i);return a},f=[],g=[];for(g=d(n);1!=g.length;)0==u[g[0]].length?(f.unshift(this.getElementById(g.shift())),f.unshift(this.getElementById(g.shift()))):g=d(g.shift()).concat(g);for(var p in f.unshift(this.getElementById(g.shift())),u)if(u[p].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:nh,htbc:nh,htb:nh,hopcroftTarjanBiconnectedComponents:nh},{tarjanStronglyConnected:nd,tsc:nd,tscc:nd,tarjanStronglyConnectedComponents:nd}].forEach(function(e){eo(nf,e)});var ng=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};ng.prototype={fulfill:function(e){return np(this,1,"fulfillValue",e)},reject:function(e){return np(this,2,"rejectReason",e)},then:function(e,t){var r=new ng;return this.onFulfilled.push(ny(e,r,"fulfill")),this.onRejected.push(ny(t,r,"reject")),nm(this),r.proxy}};var np=function(e,t,r,n){return 0===e.state&&(e.state=t,e[r]=n,nm(e)),e},nm=function(e){1===e.state?nv(e,"onFulfilled",e.fulfillValue):2===e.state&&nv(e,"onRejected",e.rejectReason)},nv=function(e,t,r){if(0!==e[t].length){var n=e[t];e[t]=[];var i=function(){for(var e=0;e<n.length;e++)n[e](r)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},ny=function(e,t,r){return function(n){if("function"!=typeof e)t[r].call(t,n);else{var i;try{i=e(n)}catch(e){t.reject(e);return}nw(t,i)}}},nw=function t(r,n){if(r===n||r.proxy===n)return void r.reject(TypeError("cannot resolve promise with itself"));if("object"===e(n)&&null!==n||"function"==typeof n)try{i=n.then}catch(e){r.reject(e);return}if("function"==typeof i){var i,a=!1;try{i.call(n,function(e){a||(a=!0,e===n?r.reject(TypeError("circular thenable chain")):t(r,e))},function(e){a||(a=!0,r.reject(e))})}catch(e){a||r.reject(e)}return}r.fulfill(n)};ng.all=function(e){return new ng(function(t,r){for(var n=Array(e.length),i=0,a=function(r,a){n[r]=a,++i===e.length&&t(n)},o=0;o<e.length;o++)!function(t){var n=e[t];null!=n&&null!=n.then?n.then(function(e){a(t,e)},function(e){r(e)}):a(t,n)}(o)})},ng.resolve=function(e){return new ng(function(t,r){t(e)})},ng.reject=function(e){return new ng(function(t,r){r(e)})};var nE="u">typeof Promise?Promise:ng,nb=function(e,t,r){var n=X(e),i=this._private=eo({duration:1e3},t,r);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&k(i.complete)&&i.completes.push(i.complete),!n){var a=e.position();i.startPosition=i.startPosition||{x:a.x,y:a.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(n){var o=e.pan();i.startPan={x:o.x,y:o.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},nA=nb.prototype;eo(nA,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),H(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,r=t.playing;return void 0===e?t.progress:(r&&this.pause(),t.progress=e,t.started=!1,r&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var r=function(t,r){var n=e[t];null!=n&&(e[t]=e[r],e[r]=n)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[n]=o}return t&&this.play(),this},promise:function(e){var t,r=this._private;return t="frame"===e?r.frames:r.completes,new nE(function(e,r){t.push(function(){e()})})}}),nA.complete=nA.completed,nA.run=nA.play,nA.running=nA.playing;var nC=Array.isArray,n_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nS=/^\w*$/,nI=function(e,t){if(nC(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||eM(e))||nS.test(e)||!n_.test(e)||null!=t&&e in Object(t)},nT=function(e){if(!ef(e))return!1;var t=eN(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},nx=ev["__core-js_shared__"],nD=(h=/[^.]+$/.exec(nx&&nx.keys&&nx.keys.IE_PROTO||""))?"Symbol(src)_1."+h:"",nN=Function.prototype.toString,nM=function(e){if(null!=e){try{return nN.call(e)}catch(e){}try{return e+""}catch(e){}}return""},nR=/^\[object .+?Constructor\]$/,nO=Object.prototype,nP=Function.prototype.toString,nB=nO.hasOwnProperty,nL=RegExp("^"+nP.call(nB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nk=function(e){return!!ef(e)&&(!nD||!(nD in e))&&(nT(e)?nL:nR).test(nM(e))},nF=function(e,t){var r=null==e?void 0:e[t];return nk(r)?r:void 0},nz=nF(Object,"create"),nU=Object.prototype.hasOwnProperty,nV=Object.prototype.hasOwnProperty;function nH(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}nH.prototype.clear=function(){this.__data__=nz?nz(null):{},this.size=0},nH.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},nH.prototype.get=function(e){var t=this.__data__;if(nz){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return nU.call(t,e)?t[e]:void 0},nH.prototype.has=function(e){var t=this.__data__;return nz?void 0!==t[e]:nV.call(t,e)},nH.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=nz&&void 0===t?"__lodash_hash_undefined__":t,this};var nj=function(e,t){return e===t||e!=e&&t!=t},nY=function(e,t){for(var r=e.length;r--;)if(nj(e[r][0],t))return r;return -1},nX=Array.prototype.splice;function nG(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}nG.prototype.clear=function(){this.__data__=[],this.size=0},nG.prototype.delete=function(e){var t=this.__data__,r=nY(t,e);return!(r<0)&&(r==t.length-1?t.pop():nX.call(t,r,1),--this.size,!0)},nG.prototype.get=function(e){var t=this.__data__,r=nY(t,e);return r<0?void 0:t[r][1]},nG.prototype.has=function(e){return nY(this.__data__,e)>-1},nG.prototype.set=function(e,t){var r=this.__data__,n=nY(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var nW=nF(ev,"Map"),nq=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},nZ=function(e,t){var r=e.__data__;return nq(t)?r["string"==typeof t?"string":"hash"]:r.map};function nQ(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function nK(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(nK.Cache||nQ),r}nQ.prototype.clear=function(){this.size=0,this.__data__={hash:new nH,map:new(nW||nG),string:new nH}},nQ.prototype.delete=function(e){var t=nZ(this,e).delete(e);return this.size-=!!t,t},nQ.prototype.get=function(e){return nZ(this,e).get(e)},nQ.prototype.has=function(e){return nZ(this,e).has(e)},nQ.prototype.set=function(e,t){var r=nZ(this,e),n=r.size;return r.set(e,t),this.size+=+(r.size!=n),this},nK.Cache=nQ;var n$=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nJ=/\\(\\)?/g,n1=(f=(d=nK(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(n$,function(e,r,n,i){t.push(n?i.replace(nJ,"$1"):r||e)}),t},function(e){return 500===f.size&&f.clear(),e})).cache,d),n0=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i},n2=1/0,n3=eA?eA.prototype:void 0,n4=n3?n3.toString:void 0,n8=function e(t){if("string"==typeof t)return t;if(nC(t))return n0(t,e)+"";if(eM(t))return n4?n4.call(t):"";var r=t+"";return"0"==r&&1/t==-n2?"-0":r},n6=function(e){return null==e?"":n8(e)},n5=function(e,t){return nC(e)?e:nI(e,t)?[e]:n1(n6(e))},n7=1/0,n9=function(e){if("string"==typeof e||eM(e))return e;var t=e+"";return"0"==t&&1/e==-n7?"-0":t},ie=function(e,t){t=n5(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[n9(t[r++])];return r&&r==n?e:void 0},it=function(e,t,r){var n=null==e?void 0:ie(e,t);return void 0===n?r:n},ir=function(){try{var e=nF(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ii=function(e,t,r){"__proto__"==t&&ir?ir(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},ia=Object.prototype.hasOwnProperty,io=function(e,t,r){var n=e[t];ia.call(e,t)&&nj(n,r)&&(void 0!==r||t in e)||ii(e,t,r)},is=/^(?:0|[1-9]\d*)$/,il=function(e,t){var r=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==r||"symbol"!=r&&is.test(e))&&e>-1&&e%1==0&&e<t},iu=function(e,t,r,n){if(!ef(e))return e;t=n5(t,e);for(var i=-1,a=t.length,o=a-1,s=e;null!=s&&++i<a;){var l=n9(t[i]),u=r;if("__proto__"===l||"constructor"===l||"prototype"===l)break;if(i!=o){var c=s[l];void 0===(u=n?n(c,l,s):void 0)&&(u=ef(c)?c:il(t[i+1])?[]:{})}io(s,l,u),s=s[l]}return e},ic=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t},ih={};[{animated:function(){return function(){var e=void 0!==this.length;if(!(this._private.cy||this).styleEnabled())return!1;var t=(e?this:[this])[0];if(t)return t._private.animation.current.length>0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++)e[t]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var r=void 0!==this.length,n=r?this:[this],i=this._private.cy||this,a=!r,o=!a;if(!i.styleEnabled())return this;var s=i.style();if(0===Object.keys(e=eo({},e,t)).length)return new nb(n[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(o&&(e.style=s.getPropsList(e.style||e.css),e.css=void 0),o&&null!=e.renderedPosition){var l=e.renderedPosition,u=i.pan(),c=i.zoom();e.position=tT(l,c,u)}if(a&&null!=e.panBy){var h=e.panBy,d=i.pan();e.pan={x:d.x+h.x,y:d.y+h.y}}var f=e.center||e.centre;if(a&&null!=f){var g=i.getCenterPan(f.eles,e.zoom);null!=g&&(e.pan=g)}if(a&&null!=e.fit){var p=e.fit,v=i.getFitViewport(p.eles||p.boundingBox,p.padding);null!=v&&(e.pan=v.pan,e.zoom=v.zoom)}if(a&&z(e.zoom)){var y=i.getZoomedViewport(e.zoom);null!=y?(y.zoomed&&(e.zoom=y.zoom),y.panned&&(e.pan=y.pan)):e.zoom=null}return new nb(n[0],e)}},animate:function(){return function(e,t){var r=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=eo({},e,t));for(var n=0;n<r.length;n++){var i=r[n],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var r=void 0!==this.length?this:[this],n=this._private.cy||this;if(!n.styleEnabled())return this;for(var i=0;i<r.length;i++){for(var a=r[i]._private,o=a.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}return n.notify("draw"),this}}},{data:function(e){return e=eo({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,r){var n,i=e,o=void 0!==this.length,s=o?this:[this],l=o?this[0]:this;if(L(t)){var u=-1!==t.indexOf(".")&&(nC(t)?n0(t,n9):eM(t)?[t]:ic(n1(n6(t))));if(i.allowGetting&&void 0===r)return l&&(i.beforeGet(l),f=u&&void 0===l._private[i.field][t]?it(l._private[i.field],u):l._private[i.field][t]),f;if(i.allowSetting&&void 0!==r&&!i.immutableKeys[t]){var c=a({},t,r);i.beforeSet(this,c);for(var h=0,d=s.length;h<d;h++){var f,g,p=s[h];i.canSet(p)&&(u&&void 0===l._private[i.field][t]?(g=p._private[i.field],null==g||iu(g,u,r)):p._private[i.field][t]=r)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}}else if(i.allowSetting&&z(t)){var v,y,w=Object.keys(t);i.beforeSet(this,t);for(var E=0;E<w.length;E++)if(y=t[v=w[E]],!i.immutableKeys[v])for(var b=0;b<s.length;b++){var A=s[b];i.canSet(A)&&(A._private[i.field][v]=y)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&k(t))this.on(i.bindingEvent,t);else if(i.allowGetting&&void 0===t)return l&&(i.beforeGet(l),n=l._private[i.field]),n;return this}},removeData:function(e){return e=eo({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var r=e,n=void 0!==this.length?this:[this];if(L(t)){for(var i=t.split(/\s+/),a=i.length,o=0;o<a;o++){var s=i[o];if(!W(s)&&!r.immutableKeys[s])for(var l=0,u=n.length;l<u;l++)n[l]._private[r.field][s]=void 0}r.triggerEvent&&this[r.triggerFnName](r.event)}else if(void 0===t){for(var c=0,h=n.length;c<h;c++)for(var d=n[c]._private[r.field],f=Object.keys(d),g=0;g<f.length;g++){var p=f[g];r.immutableKeys[p]||(d[p]=void 0)}r.triggerEvent&&this[r.triggerFnName](r.event)}return this}}},{eventAliasesOn:function(e){e.addListener=e.listen=e.bind=e.on,e.unlisten=e.unbind=e.off=e.removeListener,e.trigger=e.emit,e.pon=e.promiseOn=function(e,t){var r=this,n=Array.prototype.slice.call(arguments,0);return new nE(function(e,t){var i=n.concat([function(t){r.off.apply(r,a),e(t)}]),a=i.concat([]);r.on.apply(r,i)})}}}].forEach(function(e){eo(ih,e)});var id={animate:ih.animate(),animation:ih.animation(),animated:ih.animated(),clearQueue:ih.clearQueue(),delay:ih.delay(),delayAnimation:ih.delayAnimation(),stop:ih.stop()},ig={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach(function(e){return t.push(e)}),t}F(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],n=new tg(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,l=!1,u=0;u<e.length;u++){var c=e[u];if(!s.has(c)){l=!0;break}}l||(l=s.size!==e.length),l&&(o.classes=n,r.push(a))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){F(e)||(e=e.match(/\S+/g)||[]);for(var r=void 0===t,n=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,l=!1,u=0;u<e.length;u++){var c=e[u],h=s.has(c),d=!1;t||r&&!h?(s.add(c),d=!0):(!t||r&&h)&&(s.delete(c),d=!0),!l&&d&&(n.push(o),l=!0)}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var r=this;if(null==t)t=250;else if(0===t)return r;return r.addClass(e),setTimeout(function(){r.removeClass(e)},t),r}};ig.className=ig.classNames=ig.classes;var ip={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:ee,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};for(v=0,ip.variable="(?:[\\w-.]|(?:\\\\"+ip.metaChar+"))+",ip.className="(?:[\\w-]|(?:\\\\"+ip.metaChar+"))+",ip.value=ip.string+"|"+ip.number,ip.id=ip.variable,g=ip.comparatorOp.split("|");v<g.length;v++)p=g[v],ip.comparatorOp+="|@"+p;for(v=0,g=ip.comparatorOp.split("|");v<g.length;v++)(p=g[v]).indexOf("!")>=0||"="!==p&&(ip.comparatorOp+="|\\!"+p);var im=function(){return{checks:[]}},iv=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return -1*ea(e.selector,t.selector)}),iy=function(){for(var e,t={},r=0;r<iv.length;r++)t[(e=iv[r]).selector]=e.matches;return t}(),iw="("+iv.map(function(e){return e.selector}).join("|")+")",iE=function(e){return e.replace(RegExp("\\\\("+ip.metaChar+")","g"),function(e,t){return t})},ib=function(e,t,r){e[e.length-1]=r},iA=[{name:"group",query:!0,regex:"("+ip.group+")",populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:0,value:"*"===n?n:n+"s"})}},{name:"state",query:!0,regex:iw,populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:7,value:n})}},{name:"id",query:!0,regex:"\\#("+ip.id+")",populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:8,value:iE(n)})}},{name:"className",query:!0,regex:"\\.("+ip.className+")",populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:9,value:iE(n)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+ip.variable+")\\s*\\]",populate:function(e,t,r){var n=o(r,1)[0];t.checks.push({type:4,field:iE(n)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+ip.variable+")\\s*("+ip.comparatorOp+")\\s*("+ip.value+")\\s*\\]",populate:function(e,t,r){var n=o(r,3),i=n[0],a=n[1],s=n[2];s=null!=RegExp("^"+ip.string+"$").exec(s)?s.substring(1,s.length-1):parseFloat(s),t.checks.push({type:3,field:iE(i),operator:a,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+ip.boolOp+")\\s*("+ip.variable+")\\s*\\]",populate:function(e,t,r){var n=o(r,2),i=n[0],a=n[1];t.checks.push({type:5,field:iE(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+ip.meta+")\\s*("+ip.comparatorOp+")\\s*("+ip.number+")\\s*\\]\\]",populate:function(e,t,r){var n=o(r,3),i=n[0],a=n[1],s=n[2];t.checks.push({type:6,field:iE(i),operator:a,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:ip.separator,populate:function(e,t){var r=e.currentSubject,n=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=r&&(a.subject=r,e.currentSubject=null),a.edgeCount=n,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=im()}},{name:"directedEdge",separator:!0,regex:ip.directedEdge,populate:function(e,t){if(null==e.currentSubject){var r=im(),n=im();return r.checks.push({type:11,source:t,target:n}),ib(e,t,r),e.edgeCount++,n}var i=im(),a=im();return i.checks.push({type:12,source:t,target:a}),ib(e,t,i),e.edgeCount++,a}},{name:"undirectedEdge",separator:!0,regex:ip.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var r=im(),n=im();return r.checks.push({type:10,nodes:[t,n]}),ib(e,t,r),e.edgeCount++,n}var i=im(),a=im();return i.checks.push({type:14,node:t,neighbor:a}),ib(e,t,i),a}},{name:"child",separator:!0,regex:ip.child,populate:function(e,t){if(null==e.currentSubject){var r=im(),n=im(),i=e[e.length-1];return r.checks.push({type:15,parent:i,child:n}),ib(e,t,r),e.compoundCount++,n}if(e.currentSubject===t){var a=im(),o=e[e.length-1],s=im(),l=im(),u=im(),c=im();return a.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],c.checks.push({type:20}),s.checks.push({type:17,parent:c,child:u}),ib(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=im(),d=im(),f=[{type:17,parent:h,child:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"descendant",separator:!0,regex:ip.descendant,populate:function(e,t){if(null==e.currentSubject){var r=im(),n=im(),i=e[e.length-1];return r.checks.push({type:16,ancestor:i,descendant:n}),ib(e,t,r),e.compoundCount++,n}if(e.currentSubject===t){var a=im(),o=e[e.length-1],s=im(),l=im(),u=im(),c=im();return a.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],c.checks.push({type:20}),s.checks.push({type:18,ancestor:c,descendant:u}),ib(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=im(),d=im(),f=[{type:18,ancestor:h,descendant:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"subject",modifier:!0,regex:ip.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return te("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var r=e[e.length-1].checks[0],n=null==r?null:r.type;11===n?r.type=13:10===n&&(r.type=14,r.node=r.nodes[1],r.neighbor=r.nodes[0],r.nodes=null)}}];iA.forEach(function(e){return e.regexObj=RegExp("^"+e.regex)});var iC=function(e){for(var t,r,n,i=0;i<iA.length;i++){var a=iA[i],o=a.name,s=e.match(a.regexObj);if(null!=s){r=s,t=a,n=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:r,name:n,remaining:e}},i_=function(e){var t=e.match(/^\s+/);if(t){var r=t[0];e=e.substring(r.length)}return e},iS=function(e,t,r){var n,i,a,o=L(e),s=U(e),l=L(r),u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+r),u&&(e=i=i.toLowerCase(),r=a=a.toLowerCase()),t){case"*=":n=i.indexOf(a)>=0;break;case"$=":n=i.indexOf(a,i.length-a.length)>=0;break;case"^=":n=0===i.indexOf(a);break;case"=":n=e===r;break;case">":h=!0,n=e>r;break;case">=":h=!0,n=e>=r;break;case"<":h=!0,n=e<r;break;case"<=":h=!0,n=e<=r;break;default:n=!1}return c&&(null!=e||!h)&&(n=!n),n},iI=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},iT=function(e,t){return e.data(t)},ix=[],iD=function(e,t){return e.checks.every(function(e){return ix[e.type](e,t)})};ix[0]=function(e,t){var r=e.value;return"*"===r||r===t.group()},ix[7]=function(e,t){var r;return r=e.value,iy[r](t)},ix[8]=function(e,t){var r=e.value;return t.id()===r},ix[9]=function(e,t){var r=e.value;return t.hasClass(r)},ix[6]=function(e,t){var r=e.field,n=e.operator,i=e.value;return iS(t[r](),n,i)},ix[3]=function(e,t){var r=e.field,n=e.operator,i=e.value;return iS(iT(t,r),n,i)},ix[5]=function(e,t){var r=e.field,n=e.operator;return iI(iT(t,r),n)},ix[4]=function(e,t){var r=e.field;return e.operator,void 0!==iT(t,r)},ix[10]=function(e,t){var r=e.nodes[0],n=e.nodes[1],i=t.source(),a=t.target();return iD(r,i)&&iD(n,a)||iD(n,i)&&iD(r,a)},ix[14]=function(e,t){return iD(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&iD(e.neighbor,t)})},ix[11]=function(e,t){return iD(e.source,t.source())&&iD(e.target,t.target())},ix[12]=function(e,t){return iD(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&iD(e.target,t)})},ix[13]=function(e,t){return iD(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&iD(e.source,t)})},ix[15]=function(e,t){return iD(e.child,t)&&iD(e.parent,t.parent())},ix[17]=function(e,t){return iD(e.parent,t)&&t.children().some(function(t){return iD(e.child,t)})},ix[16]=function(e,t){return iD(e.descendant,t)&&t.ancestors().some(function(t){return iD(e.ancestor,t)})},ix[18]=function(e,t){return iD(e.ancestor,t)&&t.descendants().some(function(t){return iD(e.descendant,t)})},ix[19]=function(e,t){return iD(e.subject,t)&&iD(e.left,t)&&iD(e.right,t)},ix[20]=function(){return!0},ix[1]=function(e,t){return e.value.has(t)},ix[2]=function(e,t){return(0,e.value)(t)};var iN=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||L(e)&&e.match(/^\s*$/)||(H(e)?this.addQuery({checks:[{type:1,value:e.collection()}]}):k(e)?this.addQuery({checks:[{type:2,value:e}]}):L(e)?this.parse(e)||(this.invalid=!0):e7("A selector must be created from a string; found "))},iM=iN.prototype;[{parse:function(e){var t=this.inputText=e,r=this[0]=im();for(this.length=1,t=i_(t);;){var n=iC(t);if(null==n.expr)return te("The selector `"+e+"`is invalid"),!1;var i=n.match.slice(1),a=n.expr.populate(this,r,i);if(!1===a)return!1;if(null!=a&&(r=a),(t=n.remaining).match(/^\s*$/))break}var o=this[this.length-1];null!=this.currentSubject&&(o.subject=this.currentSubject),o.edgeCount=this.edgeCount,o.compoundCount=this.compoundCount;for(var s=0;s<this.length;s++){var l=this[s];if(l.compoundCount>0&&l.edgeCount>0)return te("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return te("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&te("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return L(t)?'"'+t+'"':e(t)},r=function(e){return" "+e+" "},n=function(n,a){var o=n.type,s=n.value;switch(o){case 0:var l=e(s);return l.substring(0,l.length-1);case 3:return"["+n.field+r(e(n.operator))+t(s)+"]";case 5:var u=n.operator,c=n.field;return"["+e(u)+c+"]";case 4:return"["+n.field+"]";case 6:var h=n.operator;return"[["+n.field+r(e(h))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return i(n.parent,a)+r(">")+i(n.child,a);case 18:case 16:return i(n.ancestor,a)+" "+i(n.descendant,a);case 19:var d=i(n.left,a),f=i(n.subject,a),g=i(n.right,a);return d+(d.length>0?" ":"")+f+g;case 20:return""}},i=function(e,t){return e.checks.reduce(function(r,i,a){return r+(t===e&&0===a?"$":"")+n(i,t)},"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},{matches:function(e){for(var t=0;t<this.length;t++)if(iD(this[t],e))return!0;return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&8===t[0].checks[0].type)return e.getElementById(t[0].checks[0].value).collection();var r=function(e){for(var r=0;r<t.length;r++)if(iD(t[r],e))return!0;return!1};return null==t.text()&&(r=function(){return!0}),e.filter(r)}}].forEach(function(e){return eo(iM,e)}),iM.text=function(){return this.inputText},iM.size=function(){return this.length},iM.eq=function(e){return this[e]},iM.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},iM.addQuery=function(e){this[this.length++]=e},iM.selector=iM.toString;var iR={allAre:function(e){var t=new iN(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new iN(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var r=0;r<this.length;r++)if(t?e.apply(t,[this[r],r,this]):e(this[r],r,this))return!0;return!1},every:function(e,t){for(var r=0;r<this.length;r++)if(!(t?e.apply(t,[this[r],r,this]):e(this[r],r,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};iR.allAreNeighbours=iR.allAreNeighbors,iR.has=iR.contains,iR.equal=iR.equals=iR.same;var iO=function(e,t){return function(r,n,i,a){if(null==r?o="":H(r)&&1===r.length&&(o=r.id()),1!==this.length||!o)return e.call(this,r,n,i,a);var o,s=this[0]._private,l=s.traversalCache=s.traversalCache||{},u=l[t]=l[t]||[],c=eK(o),h=u[c];return h||(u[c]=e.call(this,r,n,i,a))}},iP={parent:function(e){var t=[];if(1===this.length){var r=this[0]._private.parent;if(r)return r}for(var n=0;n<this.length;n++){var i=this[n]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],r=this.parent();r.nonempty();){for(var n=0;n<r.length;n++){var i=r[n];t.push(i)}r=r.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,r=0;r<this.length;r++){var n=this[r].parents();t=(t=t||n).intersect(n)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:iO(function(e){for(var t=[],r=0;r<this.length;r++)for(var n=this[r]._private.children,i=0;i<n.length;i++)t.push(n[i]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return!function e(r){for(var n=0;n<r.length;n++){var i=r[n];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function iB(e,t,r,n){for(var i=[],a=new tg,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];r?i.push(l):o&&n(i,a,l)}for(;i.length>0;){var u=i.shift();t(u),a.add(u.id()),o&&n(i,a,u)}return e}function iL(e,t,r){if(r.isParent())for(var n=r._private.children,i=0;i<n.length;i++){var a=n[i];t.has(a.id())||e.push(a)}}function ik(e,t,r){if(r.isChild()){var n=r._private.parent;t.has(n.id())||e.push(n)}}function iF(e,t,r){ik(e,t,r),iL(e,t,r)}iP.forEachDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iB(this,e,t,iL)},iP.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iB(this,e,t,ik)},iP.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iB(this,e,t,iF)},iP.ancestors=iP.parents,(y=w={data:ih.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:ih.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ih.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ih.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ih.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ih.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=y.data,y.removeAttr=y.removeData;var iz={};function iU(e){return function(t){if(void 0===t&&(t=!0),0!==this.length)if(!this.isNode()||this.removed())return;else{for(var r=0,n=this[0],i=n._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(r+=e(n,o))}return r}}}function iV(e,t){return function(r){for(var n,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](r);void 0!==o&&(void 0===n||t(o,n))&&(n=o)}return n}}eo(iz,{degree:iU(function(e,t){return t.source().same(t.target())?2:1}),indegree:iU(function(e,t){return+!!t.target().same(e)}),outdegree:iU(function(e,t){return+!!t.source().same(e)})}),eo(iz,{minDegree:iV("degree",function(e,t){return e<t}),maxDegree:iV("degree",function(e,t){return e>t}),minIndegree:iV("indegree",function(e,t){return e<t}),maxIndegree:iV("indegree",function(e,t){return e>t}),minOutdegree:iV("outdegree",function(e,t){return e<t}),maxOutdegree:iV("outdegree",function(e,t){return e>t})}),eo(iz,{totalDegree:function(e){for(var t=0,r=this.nodes(),n=0;n<r.length;n++)t+=r[n].degree(e);return t}});var iH=function(e,t,r){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};i.isParent()&&(0!==o.x||0!==o.y)&&i.children().shift(o,r),i.dirtyBoundingBoxCache()}}},ij={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){iH(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(E=b={position:ih.data(ij),silentPosition:ih.data(eo({},ij,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){iH(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(z(e))t?this.silentPosition(e):this.position(e);else if(k(e)){var r=this.cy();r.startBatch();for(var n=0;n<this.length;n++){var i=this[n],a=void 0;(a=e(i,n))&&(t?i.silentPosition(a):i.position(a))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,r){var n;if(z(e)?(n={x:U(e.x)?e.x:0,y:U(e.y)?e.y:0},r=t):L(e)&&U(t)&&((n={x:0,y:0})[e]=t),null!=n){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+n.x,y:s.y+n.y};r?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return z(e)?this.shift(e,!0):L(e)&&U(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var r=this[0],n=this.cy(),i=n.zoom(),a=n.pan(),o=z(e)?e:void 0,s=void 0!==o||void 0!==t&&L(e);if(r&&r.isNode())if(!s)return(o=tI(r.position(),i,a),void 0===e)?o:o[e];else for(var l=0;l<this.length;l++){var u=this[l];void 0!==t?u.position(e,(t-a[e])/i):void 0!==o&&u.position(tT(o,i,a))}else if(!s)return;return this},relativePosition:function(e,t){var r=this[0],n=this.cy(),i=z(e)?e:void 0,a=void 0!==i||void 0!==t&&L(e),o=n.hasCompoundNodes();if(r&&r.isNode())if(a)for(var s=0;s<this.length;s++){var l=this[s],u=o?l.parent():null,c=u&&u.length>0;c&&(u=u[0]);var h=c?u.position():{x:0,y:0};void 0!==t?l.position(e,t+h[e]):void 0!==i&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=r.position(),f=o?r.parent():null,g=f&&f.length>0;g&&(f=f[0]);var p=g?f.position():{x:0,y:0};return(i={x:d.x-p.x,y:d.y-p.y},void 0===e)?i:i[e]}else if(!a)return;return this}}).modelPosition=E.point=E.position,E.modelPositions=E.points=E.positions,E.renderedPoint=E.renderedPosition,E.relativePoint=E.relativePosition,A=C={},C.renderedBoundingBox=function(e){var t=this.boundingBox(e),r=this.cy(),n=r.zoom(),i=r.pan(),a=t.x1*n+i.x,o=t.x2*n+i.x,s=t.y1*n+i.y,l=t.y2*n+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},C.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()&&this.forEachUp(function(t){if(t.isParent()){var r=t._private;r.compoundBoundsClean=!1,r.bbCache=null,e||t.emitAndNotify("bounds")}}),this},C.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;for(var r=0;r<this.length;r++){var n=this[r],i=n._private;(!i.compoundBoundsClean||e)&&(!function(e){if(e.isParent()){var t=e._private,r=e.children(),n="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=r.boundingBox({includeLabels:n,includeOverlays:!1,useCache:!1}),o=t.position;(0===a.w||0===a.h)&&((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,f=h.biasComplementDiff,g=y(i.height.val-a.h,u,c),p=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=function(e,t,r,n){if("%"===r.units)switch(n){case"width":return e>0?r.pfValue*e:0;case"height":return t>0?r.pfValue*t:0;case"average":return e>0&&t>0?r.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?r.pfValue*t:r.pfValue*e:0;case"max":return e>0&&t>0?e>t?r.pfValue*e:r.pfValue*t:0;default:return 0}return"px"===r.units?r.pfValue:0}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-p+a.y1+a.y2+v)/2}function y(e,t,r){var n=0,i=0,a=t+r;return e>0&&a>0&&(n=t/a*e,i=r/a*e),{biasDiff:n,biasComplementDiff:i}}}(n),t.batching()||(i.compoundBoundsClean=!0))}return this};var iY=function(e){return e===1/0||e===-1/0?0:e},iX=function(e,t,r,n,i){n-t==0||i-r==0||null!=t&&null!=r&&null!=n&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=r<e.y1?r:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},iG=function(e,t){return null==t?e:iX(e,t.x1,t.y1,t.x2,t.y2)},iW=function(e,t,r){return tu(e,t,r)},iq=function(e,t,r){if(!t.cy().headless()){var n,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(r+"-arrow-shape").value){"source"===r?(n=o.srcX,i=o.srcY):"target"===r?(n=o.tgtX,i=o.tgtY):(n=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[r]=l[r]||{};u.x1=n-s,u.y1=i-s,u.x2=n+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,tW(u,1),iX(e,u.x1,u.y1,u.x2,u.y2)}}},iZ=function(e,t,r){if(!t.cy().headless()){a=r?r+"-":"";var n=t._private,i=n.rstyle;if(t.pstyle(a+"label").strValue){var a,o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=iW(i,"labelWidth",r),f=iW(i,"labelHeight",r),g=iW(i,"labelX",r),p=iW(i,"labelY",r),v=t.pstyle(a+"text-margin-x").pfValue,y=t.pstyle(a+"text-margin-y").pfValue,w=t.isEdge(),E=t.pstyle(a+"text-rotation"),b=t.pstyle("text-outline-width").pfValue,A=t.pstyle("text-border-width").pfValue/2,C=t.pstyle("text-background-padding").pfValue,_=d/2,S=f/2;if(w)o=g-_,s=g+_,l=p-S,u=p+S;else{switch(c.value){case"left":o=g-d,s=g;break;case"center":o=g-_,s=g+_;break;case"right":o=g,s=g+d}switch(h.value){case"top":l=p-f,u=p;break;case"center":l=p-S,u=p+S;break;case"bottom":l=p,u=p+f}}o+=v-Math.max(b,A)-C-2,s+=v+Math.max(b,A)+C+2,l+=y-Math.max(b,A)-C-2,u+=y+Math.max(b,A)+C+2;var I=r||"main",T=n.labelBounds,x=T[I]=T[I]||{};x.x1=o,x.y1=l,x.x2=s,x.y2=u,x.w=s-o,x.h=u-l;var D=w&&"autorotate"===E.strValue,N=null!=E.pfValue&&0!==E.pfValue;if(D||N){var M=D?iW(n.rstyle,"labelAngle",r):E.pfValue,R=Math.cos(M),O=Math.sin(M),P=(o+s)/2,B=(l+u)/2;if(!w){switch(c.value){case"left":P=s;break;case"right":P=o}switch(h.value){case"top":B=u;break;case"bottom":B=l}}var L=function(e,t){return{x:(e-=P)*R-(t-=B)*O+P,y:e*O+t*R+B}},k=L(o,l),F=L(o,u),z=L(s,l),U=L(s,u);o=Math.min(k.x,F.x,z.x,U.x),s=Math.max(k.x,F.x,z.x,U.x),l=Math.min(k.y,F.y,z.y,U.y),u=Math.max(k.y,F.y,z.y,U.y)}var V=I+"Rot",H=T[V]=T[V]||{};H.x1=o,H.y1=l,H.x2=s,H.y2=u,H.w=s-o,H.h=u-l,iX(e,o,l,s,u),iX(n.labelBounds.all,o,l,s,u)}return e}},iQ=function(e,t){if(!t.cy().headless()){var r=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(r>0&&n>0){var i=t.pstyle("outline-offset").value,a=t.pstyle("shape").value,o=n+i,s=(e.w+2*o)/e.w,l=(e.h+2*o)/e.h,u=0;["diamond","pentagon","round-triangle"].includes(a)?(s=(e.w+2.4*o)/e.w,u=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(a)?s=(e.w+2.4*o)/e.w:"star"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.6*o)/e.h,u=-o/3.8):"triangle"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.4*o)/e.h,u=-o/1.4):"vee"===a&&(s=(e.w+4.4*o)/e.w,l=(e.h+3.8*o)/e.h,u=-(.5*o));var c=e.h*l-e.h,h=e.w*s-e.w;if(tq(e,[Math.ceil(c/2),Math.ceil(h/2)]),0!==u){var d,f=(d=u,{x1:e.x1+0,x2:e.x2+0,y1:e.y1+d,y2:e.y2+d,w:e.w,h:e.h});tX(e,f)}}}},iK=function(e,t){var r=e._private.cy,n=r.styleEnabled(),i=r.headless(),a=tj(),o=e._private,s=e.isNode(),l=e.isEdge(),u=o.rstyle,c=s&&n?e.pstyle("bounds-expansion").pfValue:[0],h=function(e){return"none"!==e.pstyle("display").value},d=!n||h(e)&&(!l||h(e.source())&&h(e.target()));if(d){var f=0;n&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(f=e.pstyle("overlay-padding").value);var g=0;n&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(g=e.pstyle("underlay-padding").value);var p=Math.max(f,g),v=0;if(n&&(v=e.pstyle("width").pfValue/2),s&&t.includeNodes){var y=e.position();S=y.x,I=y.y;var w=e.outerWidth()/2,E=e.outerHeight()/2;b=S-w,A=S+w,iX(a,b,C=I-E,A,_=I+E),n&&t.includeOutlines&&iQ(a,e)}else if(l&&t.includeEdges)if(n&&!i){var b,A,C,_,S,I,T,x=e.pstyle("curve-style").strValue;if(b=Math.min(u.srcX,u.midX,u.tgtX),A=Math.max(u.srcX,u.midX,u.tgtX),C=Math.min(u.srcY,u.midY,u.tgtY),_=Math.max(u.srcY,u.midY,u.tgtY),b-=v,A+=v,iX(a,b,C-=v,A,_+=v),"haystack"===x){var D=u.haystackPts;if(D&&2===D.length){if(b=D[0].x,C=D[0].y,A=D[1].x,_=D[1].y,b>A){var N=b;b=A,A=N}if(C>_){var M=C;C=_,_=M}iX(a,b-v,C-v,A+v,_+v)}}else if("bezier"===x||"unbundled-bezier"===x||"segments"===x||"taxi"===x){switch(x){case"bezier":case"unbundled-bezier":T=u.bezierPts;break;case"segments":case"taxi":T=u.linePts}if(null!=T)for(var R=0;R<T.length;R++){var O=T[R];b=O.x-v,A=O.x+v,iX(a,b,C=O.y-v,A,_=O.y+v)}}}else{var P=e.source().position(),B=e.target().position();if(b=P.x,A=B.x,C=P.y,_=B.y,b>A){var L=b;b=A,A=L}if(C>_){var k=C;C=_,_=k}b-=v,A+=v,iX(a,b,C-=v,A,_+=v)}if(n&&t.includeEdges&&l&&(iq(a,e,"mid-source"),iq(a,e,"mid-target"),iq(a,e,"source"),iq(a,e,"target")),n&&"yes"===e.pstyle("ghost").value){var F=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;iX(a,a.x1+F,a.y1+z,a.x2+F,a.y2+z)}var U=o.bodyBounds=o.bodyBounds||{};tZ(U,a),tq(U,c),tW(U,1),n&&(b=a.x1,A=a.x2,C=a.y1,_=a.y2,iX(a,b-p,C-p,A+p,_+p));var V=o.overlayBounds=o.overlayBounds||{};tZ(V,a),tq(V,c),tW(V,1);var H=o.labelBounds=o.labelBounds||{};null!=H.all?tY(H.all):H.all=tj(),n&&t.includeLabels&&(t.includeMainLabels&&iZ(a,e,null),l&&(t.includeSourceLabels&&iZ(a,e,"source"),t.includeTargetLabels&&iZ(a,e,"target")))}return a.x1=iY(a.x1),a.y1=iY(a.y1),a.x2=iY(a.x2),a.y2=iY(a.y2),a.w=iY(a.x2-a.x1),a.h=iY(a.y2-a.y1),a.w>0&&a.h>0&&d&&(tq(a,c),tW(a,1)),a},i$=function(e){var t=0,r=function(e){return!!e<<t++};return 0+r(e.incudeNodes)+r(e.includeEdges)+r(e.includeLabels)+r(e.includeMainLabels)+r(e.includeSourceLabels)+r(e.includeTargetLabels)+r(e.includeOverlays)+r(e.includeOutlines)},iJ=function(e){if(!e.isEdge())return 0;var t=e.source().position(),r=e.target().position(),n=function(e){return Math.round(e)};return eQ([n(t.x),n(t.y),n(r.x),n(r.y)])},i1=function(e,t){var r,n=e._private,i=e.isEdge(),a=null==t?i2:i$(t),o=iJ(e),s=n.bbCachePosKey===o,l=t.useCache&&s,u=function(e){return null==e._private.bbCache||e._private.styleDirty};if(!l||u(e)||i&&u(e.source())||u(e.target())?(s||e.recalculateRenderedStyle(l),n.bbCache=r=iK(e,i0),n.bbCachePosKey=o):r=n.bbCache,a!==i2){var c=e.isNode();r=tj(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?iG(r,n.overlayBounds):iG(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?iG(r,n.labelBounds.all):(t.includeMainLabels&&iG(r,n.labelBounds.mainRot),t.includeSourceLabels&&iG(r,n.labelBounds.sourceRot),t.includeTargetLabels&&iG(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},i0={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},i2=i$(i0),i3=ta(i0);C.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=tj();var r=i3(e=e||i0);if(this.cy().styleEnabled())for(var n=0;n<this.length;n++){var i=this[n],a=i._private,o=iJ(i),s=a.bbCachePosKey===o,l=r.useCache&&s&&!a.styleDirty;i.recalculateRenderedStyle(l)}this.updateCompoundBounds(!e.useCache);for(var u=0;u<this.length;u++)iG(t,i1(this[u],r))}else e=void 0===e?i0:i3(e),t=i1(this[0],e);return t.x1=iY(t.x1),t.y1=iY(t.y1),t.x2=iY(t.x2),t.y2=iY(t.y2),t.w=iY(t.x2-t.x1),t.h=iY(t.y2-t.y1),t},C.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},C.boundingBoxAt=function(e){var t,r=this.nodes(),n=this.cy(),i=n.hasCompoundNodes(),a=n.collection();if(i&&(a=r.filter(function(e){return e.isParent()}),r=r.not(a)),z(e)){var o=e;e=function(){return o}}n.startBatch(),r.forEach(function(t,r){return t._private.bbAtOldPos=e(t,r)}).silentPositions(e),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var s={x1:(t=this.boundingBox({useCache:!1})).x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h};return r.silentPositions(function(e){return e._private.bbAtOldPos}),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),s},A.boundingbox=A.bb=A.boundingBox,A.renderedBoundingbox=A.renderedBoundingBox,_=S={};var i4=function(e){e.uppercaseName=J(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=J(e.outerName),_[e.name]=function(){var t=this[0],r=t._private,n=r.cy._private.styleEnabled;if(t)if(!n)return 1;else{if(t.isParent())return t.updateCompoundBounds(),r[e.autoName]||0;var i=t.pstyle(e.name);return"label"===i.strValue?(t.recalculateRenderedStyle(),r.rstyle[e.labelName]||0):i.pfValue}},_["outer"+e.uppercaseName]=function(){var t=this[0],r=t._private.cy._private.styleEnabled;if(t)if(r)return t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding();else return 1},_["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},_["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};i4({name:"width"}),i4({name:"height"}),S.padding=function(){var e=this[0],t=e._private;return e.isParent()&&(e.updateCompoundBounds(),void 0!==t.autoPadding)?t.autoPadding:e.pstyle("padding").pfValue},S.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},S.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var i8=function(e,t){if(e.isEdge())return t(e)},i6=function(e,t){if(e.isEdge()){var r=e.cy();return tI(t(e),r.zoom(),r.pan())}},i5=function(e,t){if(e.isEdge()){var r=e.cy(),n=r.pan(),i=r.zoom();return t(e).map(function(e){return tI(e,i,n)})}},i7={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},i9=eo({},b,C,S,Object.keys(i7).reduce(function(e,t){var r=i7[t],n="rendered"+t[0].toUpperCase()+t.substr(1);return e[t]=function(){return i8(this,r.get)},r.mult?e[n]=function(){return i5(this,r.get)}:e[n]=function(){return i6(this,r.get)},e},{})),ae=function(e,t){this.recycle(e,t)};function at(){return!1}function ar(){return!0}ae.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=at,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ar:at):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var r=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:r.x*n+i.x,y:r.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ar;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ar;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ar,this.stopPropagation()},isDefaultPrevented:at,isPropagationStopped:at,isImmediatePropagationStopped:at};var an=/^([^.]+)(\.(?:[^.]+))?$/,ai={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},aa=Object.keys(ai),ao={};function as(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ao,t=arguments.length>1?arguments[1]:void 0,r=0;r<aa.length;r++){var n=aa[r];this[n]=e[n]||ai[n]}this.context=t||this.context,this.listeners=[],this.emitting=0}var al=as.prototype,au=function(e,t,r,n,i,a,o){k(n)&&(i=n,n=null),o&&(a=null==a?o:eo({},a,o));for(var s=F(r)?r:r.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!W(u)){var c=u.match(an);if(c&&!1===t(e,u,c[1],c[2]?c[2]:null,n,i,a))break}}},ac=function(e,t){return e.addEventFields(e.context,t),new ae(t.type,t)},ah=function(e,t,r){if("event"===B(r))return void t(e,r);if(z(r))return void t(e,ac(e,r));for(var n=F(r)?r:r.split(/\s+/),i=0;i<n.length;i++){var a=n[i];if(!W(a)){var o=a.match(an);if(o){var s=ac(e,{type:o[1],namespace:o[2]?o[2]:null,target:e.context});t(e,s)}}}};al.on=al.addListener=function(e,t,r,n,i){return au(this,function(e,t,r,n,i,a,o){k(a)&&e.listeners.push({event:t,callback:a,type:r,namespace:n,qualifier:i,conf:o})},e,t,r,n,i),this},al.one=function(e,t,r,n){return this.on(e,t,r,n,{one:!0})},al.removeListener=al.off=function(e,t,r,n){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];au(i,function(t,r,n,i,l,u){if((s.type===n||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1},e,t,r,n)},s=a.length-1;s>=0;s--)o(s);return this},al.removeAllListeners=function(){return this.removeListener("*")},al.emit=al.trigger=function(e,t,r){var n=this.listeners,i=n.length;return this.emitting++,F(t)||(t=[t]),ah(this,function(e,a){null!=r&&(i=(n=[{event:a.event,type:a.type,namespace:a.namespace,callback:r}]).length);for(var o=0;o<i;o++)!function(r){var i=n[r];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&tl(o,t),e.beforeEmit(e.context,i,a),i.conf&&i.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==i}));var s=e.callbackContext(e.context,i,a),l=i.callback.apply(s,o);e.afterEmit(e.context,i,a),!1===l&&(a.stopPropagation(),a.preventDefault())}}(o);e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var ad={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,r){var n=t.qualifier;return null==n||e!==r.target&&j(r.target)&&n.matches(r.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,r){return null!=t.qualifier?r.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},af=function(e){return L(e)?new iN(e):e},ag={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],r=t._private;r.emitter||(r.emitter=new as(ad,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,r){for(var n=af(t),i=0;i<this.length;i++)this[i].emitter().on(e,n,r);return this},removeListener:function(e,t,r){for(var n=af(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,n,r);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,r){for(var n=af(t),i=0;i<this.length;i++)this[i].emitter().one(e,n,r);return this},once:function(e,t,r){for(var n=af(t),i=0;i<this.length;i++)this[i].emitter().on(e,n,r,{once:!0,onceCollection:this})},emit:function(e,t){for(var r=0;r<this.length;r++)this[r].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};ih.eventAliasesOn(ag);var ap={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),r=0;r<this.length;r++){var n=this[r];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(L(e)||H(e))return new iN(e).filter(this);if(k(e)){for(var r=this.spawn(),n=0;n<this.length;n++){var i=this[n];(t?e.apply(t,[i,n,this]):e(i,n,this))&&r.push(i)}return r}return this.spawn()},not:function(e){if(!e)return this;L(e)&&(e=this.filter(e));for(var t=this.spawn(),r=0;r<this.length;r++){var n=this[r];e.has(n)||t.push(n)}return t},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(L(e))return this.filter(e);for(var t=this.spawn(),r=this.length<e.length,n=r?this:e,i=r?e:this,a=0;a<n.length;a++){var o=n[a];i.has(o)&&t.push(o)}return t},xor:function(e){var t=this._private.cy;L(e)&&(e=t.$(e));var r=this.spawn(),n=e,i=function(e,t){for(var n=0;n<e.length;n++){var i=e[n],a=i._private.data.id;t.hasElementWithId(a)||r.push(i)}};return i(this,n),i(n,this),r},diff:function(e){var t=this._private.cy;L(e)&&(e=t.$(e));var r=this.spawn(),n=this.spawn(),i=this.spawn(),a=e,o=function(e,t,r){for(var n=0;n<e.length;n++){var a=e[n],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):r.push(a)}};return o(this,a,r),o(a,this,n),{left:r,right:n,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(L(e)){var r=e;e=t.mutableElements().filter(r)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||n.push(a)}return n},merge:function(e){var t=this._private,r=t.cy;if(!e)return this;if(e&&L(e)){var n=e;e=r.mutableElements().filter(n)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),r=this._private.map;this[e]=void 0,r.delete(t);var n=e===this.length-1;if(this.length>1&&!n){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,r.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,r=e._private.data.id,n=t.map.get(r);if(!n)return this;var i=n.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&L(e)){var r=e;e=t.mutableElements().filter(r)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var r=[],n=0;n<this.length;n++){var i=this[n],a=t?e.apply(t,[i,n,this]):e(i,n,this);r.push(a)}return r},reduce:function(e,t){for(var r=t,n=0;n<this.length;n++)r=e(r,this[n],n,this);return r},max:function(e,t){for(var r,n=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o>n&&(n=o,r=a)}return{value:n,ele:r}},min:function(e,t){for(var r,n=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<n&&(n=o,r=a)}return{value:n,ele:r}}};ap.u=ap["|"]=ap["+"]=ap.union=ap.or=ap.add,ap["\\"]=ap["!"]=ap["-"]=ap.difference=ap.relativeComplement=ap.subtract=ap.not,ap.n=ap["&"]=ap["."]=ap.and=ap.intersection=ap.intersect,ap["^"]=ap["(+)"]=ap["(-)"]=ap.symmetricDifference=ap.symdiff=ap.xor,ap.fnFilter=ap.filterFn=ap.stdFilter=ap.filter,ap.complement=ap.abscomp=ap.absoluteComplement;var am=function(e,t){var r=e.cy().hasCompoundNodes();function n(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?r?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?e3:0}var i=n(e)-n(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value?+!!e.isNode():0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},av={forEach:function(e,t){if(k(e))for(var r=this.length,n=0;n<r;n++){var i=this[n];if(!1===(t?e.apply(t,[i,n,this]):e(i,n,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var r=[],n=this.length;null==t&&(t=n),null==e&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var i=e;i>=0&&i<t&&i<n;i++)r.push(this[i]);return this.spawn(r)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!k(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(am)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var r=t.data.parent?e.parents().size():0;return e.isParent()?r:e3-1}var n=t.source,i=t.target;return Math.max(n.zDepth(),i.zDepth(),0)}}};av.each=av.forEach,("u"<typeof Symbol?"undefined":e(Symbol))!="undefined"&&"undefined"!=e(Symbol.iterator)&&(av[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},r=0,n=this.length;return a({next:function(){return r<n?t.value=e[r++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var ay=ta({nodeDimensionsIncludeLabels:!1}),aw={layoutDimensions:function(e){if(e=ay(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var t,r=this.boundingBox();t={w:r.w,h:r.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return(0===t.w||0===t.h)&&(t.w=t.h=1),t},layoutPositions:function(e,t,r){var n=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=Z(r,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,r){var n={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(r.x-n.x)*e,y:(r.y-n.y)*e};return{x:n.x+i.x,y:n.y+i.y}},u=t.spacingFactor&&1!==t.spacingFactor,c=function(){if(!u)return null;for(var e=tj(),t=0;t<n.length;t++){var r=s(n[t],t);tG(e,r.x,r.y)}return e}(),h=Z(function(e,r){var n=s(e,r);return u&&(n=l(Math.abs(t.spacingFactor),c,n)),null!=t.transform&&(n=t.transform(e,n)),n},o);if(t.animate){for(var d=0;d<n.length;d++){var f=n[d],g=h(f,d);if(null==t.animateFilter||t.animateFilter(f,d)){var p=f.animation({position:g,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(p)}else f.position(g)}if(t.fit){var v=i.animation({fit:{boundingBox:a.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else if(void 0!==t.zoom&&void 0!==t.pan){var y=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}e.animations.forEach(function(e){return e.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),nE.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(h),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(eo({},e,{eles:this}))}};function aE(e,t,r){var n,i=r._private,a=i.styleCache=i.styleCache||[];return null!=(n=a[e])?n:n=a[e]=t(r)}function ab(e,t){return e=eK(e),function(r){return aE(e,t,r)}}function aA(e,t){e=eK(e);var r=function(e){return t.call(e)};return function(){var t=this[0];if(t)return aE(e,r,t)}}aw.createLayout=aw.makeLayout=aw.layout;var aC={recalculateRenderedStyle:function(e){var t=this.cy(),r=t.renderer(),n=t.styleEnabled();return r&&n&&r.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),r=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(r)):this.forEach(function(e){r(e),e.connectedEdges().forEach(r)}),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var r=t.hasCompoundNodes(),n=this;e=!!e||void 0===e,r&&(n=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=n;return e?i.emitAndNotify("style"):i.emit("style"),n.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var r=this[t];r._private.styleDirty&&(r._private.styleDirty=!1,e.style().apply(r))}},parsedStyle:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=this[0],n=r.cy();if(n.styleEnabled()&&r){this.cleanStyle();var i=r._private.style[e];return null!=i?i:t?n.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var r=t.pstyle(e);return void 0!==r.pfValue?r.pfValue:r.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var r=this[0];if(r)return t.style().getRenderedStyle(r,e)},style:function(e,t){var r=this.cy();if(!r.styleEnabled())return this;var n=r.style();if(z(e))n.applyBypass(this,e,!1),this.emitAndNotify("style");else if(L(e))if(void 0===t){var i=this[0];return i?n.getStylePropertyValue(i,e):void 0}else n.applyBypass(this,e,t,!1),this.emitAndNotify("style");else if(void 0===e){var a=this[0];return a?n.getRawStyle(a):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var r=t.style();if(void 0===e)for(var n=0;n<this.length;n++){var i=this[n];r.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];r.removeBypasses(o,e,!1)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),r=this[0];if(r){var n=r._private,i=r.pstyle("opacity").value;if(!t)return i;var a=n.data.parent?r.parents():null;if(a)for(var o=0;o<a.length;o++)i*=a[o].pstyle("opacity").value;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)if(!t)return 0===e.pstyle("opacity").value;else return 0===e.effectiveOpacity()},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function a_(e,t){var r=e._private.data.parent?e.parents():null;if(r){for(var n=0;n<r.length;n++)if(!t(r[n]))return!1}return!0}function aS(e){var t=e.ok,r=e.edgeOkViaNode||e.ok,n=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||a_(i,n);var s=o.source,l=o.target;return r(s)&&(!a||a_(s,r))&&(s===l||r(l)&&(!a||a_(l,r)))}}}var aI=ab("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});aC.takesUpSpace=aA("takesUpSpace",aS({ok:aI})),aC.interactive=aA("interactive",aS({ok:ab("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&aI(e)}),parentOk:ab("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&aI(e)}),edgeOkViaNode:aI})),aC.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},aC.visible=aA("visible",aS({ok:ab("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&aI(e)}),edgeOkViaNode:aI})),aC.hidden=function(){var e=this[0];if(e)return!e.visible()},aC.isBundledBezier=aA("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),aC.bypass=aC.css=aC.style,aC.renderedCss=aC.renderedStyle,aC.removeBypass=aC.removeCss=aC.removeStyle,aC.pstyle=aC.parsedStyle;var aT={};function ax(e){return function(){var t=arguments,r=[];if(2===t.length){var n=t[0],i=t[1];this.on(e.event,n,i)}else if(1===t.length&&k(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&F(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(l);if(void 0!==h&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&r.push(l))}var d=this.spawn(r);d.updateStyle(),d.emit(e.event),o&&d.emit(o)}return this}}function aD(e){aT[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var r=e.overrideField(t);if(void 0!==r)return r}return t._private[e.field]}},aT[e.on]=ax({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),aT[e.off]=ax({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}aD({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),aD({field:"grabbable",overrideField:function(e){return!(e.cy().autoungrabify()||e.pannable())&&void 0},on:"grabify",off:"ungrabify"}),aD({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),aD({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),aT.deselect=aT.unselect,aT.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},aD({field:"active",on:"activate",off:"unactivate"}),aD({field:"pannable",on:"panify",off:"unpanify"}),aT.inactive=function(){var e=this[0];if(e)return!e._private.active};var aN={},aM=function(e){return function(t){for(var r=[],n=0;n<this.length;n++){var i=this[n];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===i&&u!==i||e.noOutgoingEdges&&u===i&&c!==i){a=!0;break}}a||r.push(i)}}return this.spawn(r,!0).filter(t)}},aR=function(e){return function(t){for(var r=[],n=0;n<this.length;n++){var i=this[n];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target();e.outgoing&&l===i?(r.push(s),r.push(u)):e.incoming&&u===i&&(r.push(s),r.push(l))}}return this.spawn(r,!0).filter(t)}},aO=function(e){return function(t){for(var r=this,n=[],i={};;){var a=e.outgoing?r.outgoers():r.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,n.push(l),o=!0)}if(!o)break;r=a}return this.spawn(n,!0).filter(t)}};function aP(e){return function(t){for(var r=[],n=0;n<this.length;n++){var i=this[n]._private[e.attr];i&&r.push(i)}return this.spawn(r,!0).filter(t)}}function aB(e){return function(t){var r=[],n=this._private.cy,i=e||{};L(t)&&(t=n.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||h){if((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!c||i.thisIsTgt&&!h))continue;r.push(l)}}return this.spawn(r,!0)}}function aL(e){return e=eo({},{codirected:!1},e),function(t){for(var r=[],n=this.edges(),i=e,a=0;a<n.length;a++)for(var o=n[a]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,h=0;h<c.length;h++){var d=c[h],f=d._private.data,g=f.target,p=f.source,v=g===u&&p===l,y=l===g&&u===p;(i.codirected&&v||!i.codirected&&(v||y))&&r.push(d)}return this.spawn(r,!0).filter(t)}}aN.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},eo(aN,{roots:aM({noIncomingEdges:!0}),leaves:aM({noOutgoingEdges:!0}),outgoers:iO(aR({outgoing:!0}),"outgoers"),successors:aO({outgoing:!0}),incomers:iO(aR({incoming:!0}),"incomers"),predecessors:aO({incoming:!0})}),eo(aN,{neighborhood:iO(function(e){for(var t=[],r=this.nodes(),n=0;n<r.length;n++)for(var i=r[n],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target(),c=i===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),aN.neighbourhood=aN.neighborhood,aN.closedNeighbourhood=aN.closedNeighborhood,aN.openNeighbourhood=aN.openNeighborhood,eo(aN,{source:iO(function(e){var t,r=this[0];return r&&(t=r._private.source||r.cy().collection()),t&&e?t.filter(e):t},"source"),target:iO(function(e){var t,r=this[0];return r&&(t=r._private.target||r.cy().collection()),t&&e?t.filter(e):t},"target"),sources:aP({attr:"source"}),targets:aP({attr:"target"})}),eo(aN,{edgesWith:iO(aB(),"edgesWith"),edgesTo:iO(aB({thisIsSrc:!0}),"edgesTo")}),eo(aN,{connectedEdges:iO(function(e){for(var t=[],r=0;r<this.length;r++){var n=this[r];if(n.isNode())for(var i=n._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:iO(function(e){for(var t=[],r=0;r<this.length;r++){var n=this[r];n.isEdge()&&(t.push(n.source()[0]),t.push(n.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:iO(aL(),"parallelEdges"),codirectedEdges:iO(aL({codirected:!0}),"codirectedEdges")}),eo(aN,{components:function(e){var t=this,r=t.cy(),n=r.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){n.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();do!function(){var e=r.collection();a.push(e);var n=i[0];o(n,e),t.bfs({directed:!1,roots:n,visit:function(t){return o(t,e)}}),e.forEach(function(r){r.connectedEdges().forEach(function(r){t.has(r)&&e.has(r.source())&&e.has(r.target())&&e.merge(r)})})}();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),aN.componentsOf=aN.components;var ak=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e)return void e7("A collection must have a reference to the core");var i=new td,a=!1;if(t){if(t.length>0&&z(t[0])&&!j(t[0])){a=!0;for(var o=[],s=new tg,l=0,u=t.length;l<u;l++){var c=t[l];null==c.data&&(c.data={});var h=c.data;if(null==h.id)h.id=tr();else if(e.hasElementWithId(h.id)||s.has(h.id))continue;var d=new tp(e,c,!1);o.push(d),s.add(h.id)}t=o}}else t=[];this.length=0;for(var f=0,g=t.length;f<g;f++){var p=t[f][0];if(null!=p){var v=p._private.data.id;(!r||!i.has(v))&&(r&&i.set(v,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var e=this.lazyMap=new td,t=this.eles,r=0;r<t.length;r++){var n=t[r];e.set(n.id(),{index:r,ele:n})}}},r&&(this._private.map=i),a&&!n&&this.restore()},aF=tp.prototype=ak.prototype=Object.create(Array.prototype);aF.instanceString=function(){return"collection"},aF.spawn=function(e,t){return new ak(this.cy(),e,t)},aF.spawnSelf=function(){return this.spawn(this)},aF.cy=function(){return this._private.cy},aF.renderer=function(){return this._private.cy.renderer()},aF.element=function(){return this[0]},aF.collection=function(){return Y(this)?this:new ak(this._private.cy,[this])},aF.unique=function(){return new ak(this._private.cy,this,!0)},aF.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},aF.getElementById=function(e){e=""+e;var t=this._private.cy,r=this._private.map.get(e);return r?r.ele:new ak(t)},aF.$id=aF.getElementById,aF.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},aF.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},aF.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},aF.json=function(e){var t=this.element(),r=this.cy();if(null==t&&e)return this;if(null!=t){var n=t._private;if(z(e)){if(r.startBatch(),e.data){t.data(e.data);var i=n.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;u&&(null!=c||null!=i.parent)&&c!=i.parent&&(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(r,i,a){var o=e[r];null!=o&&o!==n[r]&&(o?t[i]():t[a]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),r.endBatch(),this}if(void 0===e){var d={data:tt(n.data),position:tt(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};d.classes="";var f=0;return n.classes.forEach(function(e){return d.classes+=0==f++?e:" "+e}),d}}},aF.jsons=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t].json();e.push(r)}return e},aF.clone=function(){for(var e=this.cy(),t=[],r=0;r<this.length;r++){var n=new tp(e,this[r].json(),!1);t.push(n)}return new ak(e,t)},aF.copy=aF.clone,aF.restore=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=this.cy(),n=r._private,i=[],a=[],o=0,s=this.length;o<s;o++){var l=this[o];(!t||l.removed())&&(l.isNode()?i.push(l):a.push(l))}M=i.concat(a);var u=function(){M.splice(R,1),R--};for(R=0;R<M.length;R++){var c=M[R],h=c._private,d=h.data;if(c.clearTraversalCache(),t||h.removed){if(void 0===d.id)d.id=tr();else if(U(d.id))d.id=""+d.id;else if(W(d.id)||!L(d.id)){e7("Can not create element with invalid string ID `"+d.id+"`"),u();continue}else if(r.hasElementWithId(d.id)){e7("Can not create second element with ID `"+d.id+"`"),u();continue}}var f=d.id;if(c.isNode()){var g=h.position;null==g.x&&(g.x=0),null==g.y&&(g.y=0)}if(c.isEdge()){for(var p=["source","target"],v=p.length,y=!1,w=0;w<v;w++){var E=p[w],b=d[E];U(b)&&(b=d[E]=""+d[E]),null==b||""===b?(e7("Can not create edge `"+f+"` with unspecified "+E),y=!0):r.hasElementWithId(b)||(e7("Can not create edge `"+f+"` with nonexistant "+E+" `"+b+"`"),y=!0)}if(y){u();continue}var A=r.getElementById(d.source),C=r.getElementById(d.target);A.same(C)?A._private.edges.push(c):(A._private.edges.push(c),C._private.edges.push(c)),c._private.source=A,c._private.target=C}h.map=new td,h.map.set(f,{ele:c,index:0}),h.removed=!1,t&&r.addToPool(c)}for(var _=0;_<i.length;_++){var S=i[_],I=S._private.data;U(I.parent)&&(I.parent=""+I.parent);var T=I.parent;if(null!=T||S._private.parent){var x=S._private.parent?r.collection().merge(S._private.parent):r.getElementById(T);if(x.empty())I.parent=void 0;else if(x[0].removed())te("Node added with missing parent, reference to parent removed"),I.parent=void 0,S._private.parent=null;else{for(var D=!1,N=x;!N.empty();){if(S.same(N)){D=!0,I.parent=void 0;break}N=N.parent()}D||(x[0]._private.children.push(S),S._private.parent=x[0],n.hasCompoundNodes=!0)}}}if(M.length>0){for(var M,R,O,P=M.length===this.length?this:new ak(r,M),B=0;B<P.length;B++){var k=P[B];k.isNode()||(k.parallelEdges().clearTraversalCache(),k.source().clearTraversalCache(),k.target().clearTraversalCache())}(n.hasCompoundNodes?r.collection().merge(P).merge(P.connectedNodes()).merge(P.parent()):P).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?P.emitAndNotify("add"):t&&P.emit("add")}return this},aF.removed=function(){var e=this[0];return e&&e._private.removed},aF.inside=function(){var e=this[0];return e&&!e._private.removed},aF.remove=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=[],n={},i=this._private.cy,a=0,o=this.length;a<o;a++)!function e(i){var a=n[i.id()];if(!(t&&i.removed())&&!a)if(n[i.id()]=!0,i.isNode()){r.push(i);for(var o=i._private.edges,s=0;s<o.length;s++)e(o[s]);for(var l=i._private.children,u=0;u<l.length;u++)e(l[u])}else r.unshift(i)}(this[a]);function s(e,t){to(e._private.edges,t),e.clearTraversalCache()}var l=[];l.ids={},this.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var u=0;u<r.length;u++){var c=r[u];if(c.isEdge()){var h=c.source()[0],d=c.target()[0];s(h,c),s(d,c);for(var f=c.parallelEdges(),g=0;g<f.length;g++){var p=f[g];p.clearTraversalCache(),p.isBundledBezier()&&p.dirtyBoundingBoxCache()}}else{var v=c.parent();0!==v.length&&function(e,t){t=t[0];var r=(e=e[0])._private.children,n=e.id();to(r,t),t._private.parent=null,l.ids[n]||(l.ids[n]=!0,l.push(e))}(v,c)}t&&(c._private.removed=!0)}var y=i._private.elements;i._private.hasCompoundNodes=!1;for(var w=0;w<y.length;w++)if(y[w].isParent()){i._private.hasCompoundNodes=!0;break}var E=new ak(this.cy(),r);E.size()>0&&(e?E.emitAndNotify("remove"):t&&E.emit("remove"));for(var b=0;b<l.length;b++){var A=l[b];t&&A.removed()||A.updateStyle()}return E},aF.move=function(e){var t=this._private.cy,r=this,n=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=n(e.source),a=n(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch(function(){r.remove(!1,!1),r.emitAndNotify("moveout");for(var e=0;e<r.length;e++){var t=r[e],n=t._private.data;t.isEdge()&&(o&&(n.source=i),s&&(n.target=a))}r.restore(!1,!1)}),r.emitAndNotify("move"))}else if(void 0!==e.parent){var l=n(e.parent);if(null===l||t.hasElementWithId(l)){var u=null===l?void 0:l;t.batch(function(){var e=r.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<r.length;t++){var n=r[t],i=n._private.data;n.isNode()&&(i.parent=u)}e.restore(!1,!1)}),r.emitAndNotify("move")}}return this},[nf,id,ig,iR,iP,w,iz,i9,ag,ap,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},av,aw,aC,aT,aN].forEach(function(e){eo(aF,e)});var az=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,r,n){var i={x:t.x+n.dx*r,v:t.v+n.dv*r,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}return function r(n,i,a){var o,s,l,u,c,h,d,f,g,p,v,y={x:-1,v:0,tension:null,friction:null},w=[0],E=0;for(n=parseFloat(n)||500,i=parseFloat(i)||20,a=a||null,y.tension=n,y.friction=i,p=(g=null!==a)?(E=r(n,i))/a*.016:.016;o=v||y,s=p,l={dx:o.v,dv:e(o)},u=t(o,.5*s,l),c=t(o,.5*s,u),h=t(o,s,c),d=1/6*(l.dx+2*(u.dx+c.dx)+h.dx),f=1/6*(l.dv+2*(u.dv+c.dv)+h.dv),o.x=o.x+d*s,o.v=o.v+f*s,v=o,w.push(1+v.x),E+=16,Math.abs(v.x)>1e-4&&Math.abs(v.v)>1e-4;);return g?function(e){return w[e*(w.length-1)|0]}:E}}(),aU=function(e,t,r,n){var i=function(e,t,r,n){var i="u">typeof Float32Array;if(4!=arguments.length)return!1;for(var a=0;a<4;++a)if("number"!=typeof arguments[a]||isNaN(arguments[a])||!isFinite(arguments[a]))return!1;e=Math.min(e,1),r=Math.min(r,1),e=Math.max(e,0),r=Math.max(r,0);var o=i?new Float32Array(11):Array(11);function s(e,t,r){return(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e}function l(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}var u=!1,c=function(i){return(u||(u=!0,(e!==t||r!==n)&&function(){for(var t=0;t<11;++t)o[t]=s(.1*t,e,r)}()),e===t&&r===n)?i:0===i?0:1===i?1:s(function(t){for(var n=0,i=1;10!==i&&o[i]<=t;++i)n+=.1;var a=n+(t-o[--i])/(o[i+1]-o[i])*.1,u=l(a,e,r);if(u>=.001){for(var c=a,h=0;h<4;++h){var d=l(c,e,r);if(0===d)break;var f=s(c,e,r)-t;c-=f/d}return c}return 0===u?a:function(t,n,i){var a,o,l=0;do(a=s(o=n+(i-n)/2,e,r)-t)>0?i=o:n=o;while(Math.abs(a)>1e-7&&++l<10);return o}(t,n,n+.1)}(i),t,n)};c.getControlPoints=function(){return[{x:e,y:t},{x:r,y:n}]};var h="generateBezier("+[e,t,r,n]+")";return c.toString=function(){return h},c}(e,t,r,n);return function(e,t,r){return e+(t-e)*i(r)}},aV={linear:function(e,t,r){return e+(t-e)*r},ease:aU(.25,.1,.25,1),"ease-in":aU(.42,0,1,1),"ease-out":aU(0,0,.58,1),"ease-in-out":aU(.42,0,.58,1),"ease-in-sine":aU(.47,0,.745,.715),"ease-out-sine":aU(.39,.575,.565,1),"ease-in-out-sine":aU(.445,.05,.55,.95),"ease-in-quad":aU(.55,.085,.68,.53),"ease-out-quad":aU(.25,.46,.45,.94),"ease-in-out-quad":aU(.455,.03,.515,.955),"ease-in-cubic":aU(.55,.055,.675,.19),"ease-out-cubic":aU(.215,.61,.355,1),"ease-in-out-cubic":aU(.645,.045,.355,1),"ease-in-quart":aU(.895,.03,.685,.22),"ease-out-quart":aU(.165,.84,.44,1),"ease-in-out-quart":aU(.77,0,.175,1),"ease-in-quint":aU(.755,.05,.855,.06),"ease-out-quint":aU(.23,1,.32,1),"ease-in-out-quint":aU(.86,0,.07,1),"ease-in-expo":aU(.95,.05,.795,.035),"ease-out-expo":aU(.19,1,.22,1),"ease-in-out-expo":aU(1,0,0,1),"ease-in-circ":aU(.6,.04,.98,.335),"ease-out-circ":aU(.075,.82,.165,1),"ease-in-out-circ":aU(.785,.135,.15,.86),spring:function(e,t,r){if(0===r)return aV.linear;var n=az(e,t,r);return function(e,t,r){return e+(t-e)*n(r)}},"cubic-bezier":aU};function aH(e,t,r,n,i){if(1===n||t===r)return r;var a=i(t,r,n);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function aj(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function aY(e,t,r,n,i){var a=null!=i?i.type:null;r<0?r=0:r>1&&(r=1);var o=aj(e,i),s=aj(t,i);if(U(o)&&U(s))return aH(a,o,s,r,n);if(F(o)&&F(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],h=s[u];if(null!=c&&null!=h){var d=aH(a,c,h,r,n);l.push(d)}else l.push(h)}return l}}function aX(e,t){return null!=e&&null!=t&&(!!(U(e)&&U(t))||!!e&&!!t)}function aG(e,t){var r=t._private.aniEles,n=[];function i(t,r){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var u=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;if(d.stopped){a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames);continue}(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||function(e,t){var r=e._private;r.started=!0,r.startTime=t-r.progress*r.duration}(h,e),function(e,t,r,n){var i,a,o,s,l=!n,u=e._private,c=t._private,h=c.easing,d=c.startTime,f=(n?e:e.cy()).style();c.easingImpl||(null==h?c.easingImpl=aV.linear:(i=L(h)?f.parse("transition-timing-function",h).value:h,L(i)?(a=i,o=[]):(a=i[1],o=i.slice(2).map(function(e){return+e})),o.length>0?("spring"===a&&o.push(c.duration),c.easingImpl=aV[a].apply(null,o)):c.easingImpl=aV[a]));var g=c.easingImpl;if(s=0===c.duration?1:(r-d)/c.duration,c.applying&&(s=c.progress),s<0?s=0:s>1&&(s=1),null==c.delay){var p=c.startPosition,v=c.position;if(v&&l&&!e.locked()){var y={};aX(p.x,v.x)&&(y.x=aY(p.x,v.x,s,g)),aX(p.y,v.y)&&(y.y=aY(p.y,v.y,s,g)),e.position(y)}var w=c.startPan,E=c.pan,b=u.pan,A=null!=E&&n;A&&(aX(w.x,E.x)&&(b.x=aY(w.x,E.x,s,g)),aX(w.y,E.y)&&(b.y=aY(w.y,E.y,s,g)),e.emit("pan"));var C=c.startZoom,_=c.zoom,S=null!=_&&n;S&&(aX(C,_)&&(u.zoom=tH(u.minZoom,aY(C,_,s,g),u.maxZoom)),e.emit("zoom")),(A||S)&&e.emit("viewport");var I=c.style;if(I&&I.length>0&&l){for(var T=0;T<I.length;T++){var x=I[T],D=x.name,N=c.startStyle[D],M=f.properties[N.name],R=aY(N,x,s,g,M);f.overrideBypass(e,D,R)}e.emit("style")}}c.progress=s}(t,h,e,r),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return r||0!==a.length||0!==o.length||n.push(t),s}for(var a=!1,o=0;o<r.length;o++){var s=i(r[o]);a=a||s}var l=i(t,!0);(a||l)&&(r.length>0?t.notify("draw",r):t.notify("draw")),r.unmerge(n),t.emit("step")}var aW={animate:ih.animate(),animation:ih.animation(),animated:ih.animated(),clearQueue:ih.clearQueue(),delay:ih.delay(),delayAnimation:ih.delayAnimation(),stop:ih.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,r){aG(r,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&eY(function(r){aG(r,e),t()})}()}}},aq={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,r){var n=t.qualifier;return null==n||e!==r.target&&j(r.target)&&n.matches(r.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,r){return null!=t.qualifier?r.target:e}},aZ=function(e){return L(e)?new iN(e):e},aQ={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new as(aq,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,r){return this.emitter().on(e,aZ(t),r),this},removeListener:function(e,t,r){return this.emitter().removeListener(e,aZ(t),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,r){return this.emitter().one(e,aZ(t),r),this},once:function(e,t,r){return this.emitter().one(e,aZ(t),r),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};ih.eventAliasesOn(aQ);var aK={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};aK.jpeg=aK.jpg;var a$={layout:function(e){if(null==e)return void e7("Layout options must be specified to make a layout");if(null==e.name)return void e7("A `name` must be specified to make a layout");var t,r=e.name,n=this.extension("layout",r);return null==n?void e7("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?"):(t=L(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new n(eo({},e,{cy:this,eles:t})))}};a$.createLayout=a$.makeLayout=a$.layout;var aJ=ta({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),a1={renderTo:function(e,t,r,n){return this._private.renderer.renderTo(e,t,r,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null==t)return void e7("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));void 0!==e.wheelSensitivity&&te("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var r=aJ(e);r.cy=this,this._private.renderer=new t(r),this.notify("init")},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};a1.invalidateDimensions=a1.resize;var a0={collection:function(e,t){return L(e)?this.$(e):H(e)?e.collection():F(e)?(t||(t={}),new ak(this,e,t.unique,t.removed)):new ak(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};a0.elements=a0.filter=a0.$;var a2={};a2.apply=function(e){for(var t=this._private.cy.collection(),r=0;r<e.length;r++){var n=e[r],i=this.getContextMeta(n);if(!i.empty){var a=this.getContextStyle(i),o=this.applyContextStyle(i,a,n);n._private.appliedInitStyle?this.updateTransitions(n,o.diffProps):n._private.appliedInitStyle=!0,this.updateStyleHints(n)&&t.push(n)}}return t},a2.getPropertiesDiff=function(e,t){var r=this._private.propDiffs=this._private.propDiffs||{},n=e+"-"+t,i=r[n];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var l=this[s],u="t"===e[s],c="t"===t[s],h=u!==c,d=l.mappedProperties.length>0;if(h||c&&d){var f=void 0;h&&d||h?f=l.properties:d&&(f=l.mappedProperties);for(var g=0;g<f.length;g++){for(var p=f[g],v=p.name,y=!1,w=s+1;w<this.length;w++){var E=this[w];if("t"===t[w]&&(y=null!=E.properties[p.name]))break}o[v]||y||(o[v]=!0,a.push(v))}}}return r[n]=a,a},a2.getContextMeta=function(e){for(var t,r="",n=e._private.styleCxtKey||"",i=0;i<this.length;i++){var a=this[i];a.selector&&a.selector.matches(e)?r+="t":r+="f"}return t=this.getPropertiesDiff(n,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:0===t.length}},a2.getContextStyle=function(e){var t=e.key,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var n={_private:{key:t}},i=0;i<this.length;i++){var a=this[i];if("t"===t[i])for(var o=0;o<a.properties.length;o++){var s=a.properties[o];n[s.name]=s}}return r[t]=n,n},a2.applyContextStyle=function(e,t,r){for(var n=e.diffPropNames,i={},a=this.types,o=0;o<n.length;o++){var s=n[o],l=t[s],u=r.pstyle(s);if(!l)if(!u)continue;else l=u.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0};if(u!==l){if(l.mapped===a.fn&&null!=u&&null!=u.mapping&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(r))===c.prevFnValue)continue}var h=i[s]={prev:u};this.applyParsedProperty(r,l),h.next=r.pstyle(s),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},a2.updateStyleHints=function(e){var t=e._private,r=this,n=r.propertyGroupNames,i=r.propertyGroupKeys,a=function(e,t,n){return r.getPropertiesHash(e,t,n)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;n=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];t.styleKeys[c]=[9261,5381]}for(var h=function(e,r){return t.styleKeys[r][0]=eG(e,t.styleKeys[r][0])},d=function(e,r){return t.styleKeys[r][1]=eW(e,t.styleKeys[r][1])},f=function(e,t){for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);h(n,t),d(n,t)}},g=0;g<n.length;g++){var p=n[g],v=l[p];if(null!=v){var y,w,E=this.properties[p],b=E.type,A=E.groupKey,C=void 0;null!=E.hashOverride?C=E.hashOverride(e,v):null!=v.pfValue&&(C=v.pfValue);var _=null==E.enums?v.value:null,S=null!=C,I=null!=_,T=S||I,x=v.units;b.number&&T&&!b.multiple?(h(w=-128<(y=S?C:_)&&y<128&&Math.floor(y)!==y?2e9-(1024*y|0):y,A),d(w,A),S||null==x||f(x,A)):f(v.strValue,A)}}for(var D=[9261,5381],N=0;N<i.length;N++){var M=i[N],R=t.styleKeys[M];D[0]=eG(R[0],D[0]),D[1]=eW(R[1],D[1])}t.styleKey=2097152*D[0]+D[1];var O=t.styleKeys;t.labelDimsKey=eq(O.labelDimensions);var P=a(e,["label"],O.labelDimensions);if(t.labelKey=eq(P),t.labelStyleKey=eq(eZ(O.commonLabel,P)),!s){var B=a(e,["source-label"],O.labelDimensions);t.sourceLabelKey=eq(B),t.sourceLabelStyleKey=eq(eZ(O.commonLabel,B));var L=a(e,["target-label"],O.labelDimensions);t.targetLabelKey=eq(L),t.targetLabelStyleKey=eq(eZ(O.commonLabel,L))}if(s){var k=t.styleKeys,F=k.nodeBody,z=k.nodeBorder,U=k.nodeOutline,V=k.backgroundImage,H=k.compound,j=k.pie;t.nodeKey=eq([F,z,U,V,H,j].filter(function(e){return null!=e}).reduce(eZ,[9261,5381])),t.hasPie=null!=j&&9261!==j[0]&&5381!==j[1]}return o!==t.styleKey},a2.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},a2.applyParsedProperty=function(e,t){var r=this,n=t,i=e._private.style,a=r.types,o=r.properties[n.name].type,s=n.bypass,l=i[n.name],u=l&&l.bypass,c=e._private,h="mapping",d=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=d(l),i=d(n);r.checkTriggers(e,n.name,t,i)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(n=t=this.parse(t.name,"bezier",s)),n.delete)return i[n.name]=void 0,f(),!0;if(n.deleteBypassed)if(!l)return f(),!0;else if(l.bypass)return l.bypassed=void 0,f(),!0;else return!1;if(n.deleteBypass)if(!l)return f(),!0;else if(l.bypass)return i[n.name]=l.bypassed,f(),!0;else return!1;var g=function(){te("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case a.mapData:for(var p,v,y=n.field.split("."),w=c.data,E=0;E<y.length&&w;E++)w=w[y[E]];if(null==w)return g(),!1;if(!U(w))return te("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+w+"` for `"+e.id()+"` is non-numeric)"),!1;var b=n.fieldMax-n.fieldMin;if((v=0===b?0:(w-n.fieldMin)/b)<0?v=0:v>1&&(v=1),o.color){var A=n.valueMin[0],C=n.valueMax[0],_=n.valueMin[1],S=n.valueMax[1],I=n.valueMin[2],T=n.valueMax[2],x=null==n.valueMin[3]?1:n.valueMin[3],D=[Math.round(A+(C-A)*v),Math.round(_+(S-_)*v),Math.round(I+(T-I)*v),Math.round(x+((null==n.valueMax[3]?1:n.valueMax[3])-x)*v)];p={bypass:n.bypass,name:n.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else{if(!o.number)return!1;var N=n.valueMin+(n.valueMax-n.valueMin)*v;p=this.parse(n.name,N,n.bypass,h)}if(!p)return g(),!1;p.mapping=n,n=p;break;case a.data:for(var M=n.field.split("."),R=c.data,O=0;O<M.length&&R;O++)R=R[M[O]];if(null!=R&&(p=this.parse(n.name,R,n.bypass,h)),!p)return g(),!1;p.mapping=n,n=p;break;case a.fn:var P=n.value,B=null!=n.fnValue?n.fnValue:P(e);if(n.prevFnValue=B,null==B)return te("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(p=this.parse(n.name,B,n.bypass,h)))return te("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+e.id()+"` is invalid)"),!1;p.mapping=tt(n),n=p;break;case void 0:break;default:return!1}return s?(u?n.bypassed=l.bypassed:n.bypassed=l,i[n.name]=n):u?l.bypassed=n:i[n.name]=n,f(),!0},a2.cleanElements=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),t)for(var i=n._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else n._private.style={}}},a2.update=function(){this._private.cy.mutableElements().updateStyle()},a2.updateTransitions=function(e,t){var r=this,n=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),d=t[c];if(d){var f=d.prev,g=null!=d.next?d.next:h,p=!1,v=void 0;f&&(U(f.pfValue)&&U(g.pfValue)?(p=g.pfValue-f.pfValue,v=f.pfValue+1e-6*p):U(f.value)&&U(g.value)?(p=g.value-f.value,v=f.value+1e-6*p):F(f.value)&&F(g.value)&&(p=f.value[0]!==g.value[0]||f.value[1]!==g.value[1]||f.value[2]!==g.value[2],v=f.strValue),p&&(s[c]=g.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;n.transitioning=!0,new nE(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1)},a2.checkTrigger=function(e,t,r,n,i,a){var o=this.properties[t],s=i(o);null!=s&&s(r,n)&&a(o)},a2.checkZOrderTrigger=function(e,t,r,n){var i=this;this.checkTrigger(e,t,r,n,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},a2.checkBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(e){return e.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),i.triggersBoundsOfParallelBeziers&&"curve-style"===t&&("bezier"===r||"bezier"===n)&&e.parallelEdges().forEach(function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}),i.triggersBoundsOfConnectedEdges&&"display"===t&&("none"===r||"none"===n)&&e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},a2.checkTriggers=function(e,t,r,n){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,r,n),this.checkBoundsTrigger(e,t,r,n)};var a3={};a3.applyBypass=function(e,t,r,n){var i=[];if("*"===t||"**"===t){if(void 0!==r)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,r,!0);s&&i.push(s)}}else if(L(t)){var l=this.parse(t,r,!0);l&&i.push(l)}else{if(!z(t))return!1;n=r;for(var u=Object.keys(t),c=0;c<u.length;c++){var h=u[c],d=t[h];if(void 0===d&&(d=t[K(h)]),void 0!==d){var f=this.parse(h,d,!0);f&&i.push(f)}}}if(0===i.length)return!1;for(var g=!1,p=0;p<e.length;p++){for(var v=e[p],y={},w=void 0,E=0;E<i.length;E++){var b=i[E];if(n){var A=v.pstyle(b.name);w=y[b.name]={prev:A}}g=this.applyParsedProperty(v,tt(b))||g,n&&(w.next=v.pstyle(b.name))}g&&this.updateStyleHints(v),n&&this.updateTransitions(v,y,!0)}return g},a3.overrideBypass=function(e,t,r){t=Q(t);for(var n=0;n<e.length;n++){var i=e[n],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=r,null!=a.pfValue&&(a.pfValue=r),s?a.strValue="rgb("+r.join(",")+")":l?a.strValue=r.join(" "):a.strValue=""+r,this.updateStyleHints(i)):this.applyBypass(i,t,r),this.checkTriggers(i,t,u,r)}},a3.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},a3.removeBypasses=function(e,t,r){for(var n=0;n<e.length;n++){for(var i=e[n],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=i.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),h=a[l.name]={prev:u};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,a,!0)}};var a4={};a4.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},a4.containerCss=function(e){var t=this._private.cy,r=t.container(),n=t.window();if(n&&r&&n.getComputedStyle)return n.getComputedStyle(r).getPropertyValue(e)};var a8={};a8.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},a8.getRawStyle=function(e,t){if(e=e[0]){for(var r={},n=0;n<this.properties.length;n++){var i=this.properties[n],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(r[i.name]=a,r[K(i.name)]=a)}return r}},a8.getIndexedStyle=function(e,t,r,n){var i=e.pstyle(t)[r][n];return null!=i?i:e.cy().style().getDefaultProperty(t)[r][0]},a8.getStylePropertyValue=function(e,t,r){if(e=e[0]){var n=this.properties[t];n.alias&&(n=n.pointsTo);var i=n.type,a=e.pstyle(n.name);if(a){var o=a.value,s=a.units,l=a.strValue;if(r&&i.number&&null!=o&&U(o)){var u=e.cy().zoom(),c=function(e){return e*u},h=function(e,t){return c(e)+t},d=F(o);if(d?s.every(function(e){return null!=e}):null!=s)if(d)return o.map(function(e,t){return h(e,s[t])}).join(" ");else return h(o,s);return d?o.map(function(e){return L(e)?e:""+c(e)}).join(" "):""+c(o)}if(null!=l)return l}return null}},a8.getAnimationStartStyle=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n].name,a=e.pstyle(i);void 0!==a&&(a=z(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(r[i]=a)}return r},a8.getPropsList=function(e){var t=[],r=this.properties;if(e)for(var n=Object.keys(e),i=0;i<n.length;i++){var a=n[i],o=e[a],s=r[a]||r[Q(a)],l=this.parse(s.name,o);l&&t.push(l)}return t},a8.getNonDefaultPropertiesHash=function(e,t,r){var n,i,a,o,s,l,u=r.slice();for(s=0;s<t.length;s++)if(n=t[s],null!=(i=e.pstyle(n,!1)))if(null!=i.pfValue)u[0]=eG(o,u[0]),u[1]=eW(o,u[1]);else for(l=0,a=i.strValue;l<a.length;l++)o=a.charCodeAt(l),u[0]=eG(o,u[0]),u[1]=eW(o,u[1]);return u},a8.getPropertiesHash=a8.getNonDefaultPropertiesHash;var a6={};a6.appendFromJson=function(e){for(var t=0;t<e.length;t++){var r=e[t],n=r.selector,i=r.style||r.css,a=Object.keys(i);this.selector(n);for(var o=0;o<a.length;o++){var s=a[o],l=i[s];this.css(s,l)}}return this},a6.fromJson=function(e){return this.resetToDefault(),this.appendFromJson(e),this},a6.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var r=this[t],n=r.selector,i=r.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:n?n.toString():"core",style:a})}return e};var a5={};a5.appendFromString=function(e){var t,r,n,i=""+e;function a(){i=i.length>t.length?i.substr(t.length):""}function o(){r=r.length>n.length?r.substr(n.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){te("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l&&new iN(l).invalid){te("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;r=u;for(var h=[];!r.match(/^\s*$/);){var d=r.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!d){te("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}n=d[0];var f=d[1],g=d[2];if(!this.properties[f]){te("Skipping property: Invalid property name in: "+n),o();continue}if(!this.parse(f,g)){te("Skipping property: Invalid property definition in: "+n),o();continue}h.push({name:f,val:g}),o()}if(c){a();break}this.selector(l);for(var p=0;p<h.length;p++){var v=h[p];this.css(v.name,v.val)}a()}return this},a5.fromString=function(e){return this.resetToDefault(),this.appendFromString(e),this};var a7={};!function(){var e=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},t=function(e){var t=ee+"|\\w+|"+er+"|"+ei+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+ee+")\\s*\\,\\s*("+ee+")\\s*,\\s*("+t+")\\s*\\,\\s*("+t+")\\)$"},r=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];a7.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi"]},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:e("data")},layoutData:{mapping:!0,regex:e("layoutData")},scratch:{mapping:!0,regex:e("scratch")},mapData:{mapping:!0,regex:t("mapData")},mapLayoutData:{mapping:!0,regex:t("mapLayoutData")},mapScratch:{mapping:!0,regex:t("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:r,singleRegexMatchValue:!0},urls:{regexes:r,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return L(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+ee+")\\s*,\\s*("+ee+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+ee+")\\s*,\\s*("+ee+")\\s*,\\s*("+ee+")\\s*,\\s*("+ee+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return 1===t||2===t||4===t}}};var n=function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},i=function(e,t){return e!=t},a=a7.types,o=[{name:"label",type:a.text,triggersBounds:i,triggersZOrder:function(e,t){var r=W(e),n=W(t);return r&&!n||!r&&n}},{name:"text-rotation",type:a.textRotation,triggersBounds:i},{name:"text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"text-margin-y",type:a.bidirectionalSize,triggersBounds:i}],s=[{name:"source-label",type:a.text,triggersBounds:i},{name:"source-text-rotation",type:a.textRotation,triggersBounds:i},{name:"source-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-offset",type:a.size,triggersBounds:i}],l=[{name:"target-label",type:a.text,triggersBounds:i},{name:"target-text-rotation",type:a.textRotation,triggersBounds:i},{name:"target-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-offset",type:a.size,triggersBounds:i}],u=[{name:"font-family",type:a.fontFamily,triggersBounds:i},{name:"font-style",type:a.fontStyle,triggersBounds:i},{name:"font-weight",type:a.fontWeight,triggersBounds:i},{name:"font-size",type:a.size,triggersBounds:i},{name:"text-transform",type:a.textTransform,triggersBounds:i},{name:"text-wrap",type:a.textWrap,triggersBounds:i},{name:"text-overflow-wrap",type:a.textOverflowWrap,triggersBounds:i},{name:"text-max-width",type:a.size,triggersBounds:i},{name:"text-outline-width",type:a.size,triggersBounds:i},{name:"line-height",type:a.positiveNumber,triggersBounds:i}],c=[{name:"text-valign",type:a.valign,triggersBounds:i},{name:"text-halign",type:a.halign,triggersBounds:i},{name:"color",type:a.color},{name:"text-outline-color",type:a.color},{name:"text-outline-opacity",type:a.zeroOneNumber},{name:"text-background-color",type:a.color},{name:"text-background-opacity",type:a.zeroOneNumber},{name:"text-background-padding",type:a.size,triggersBounds:i},{name:"text-border-opacity",type:a.zeroOneNumber},{name:"text-border-color",type:a.color},{name:"text-border-width",type:a.size,triggersBounds:i},{name:"text-border-style",type:a.borderStyle,triggersBounds:i},{name:"text-background-shape",type:a.textBackgroundShape,triggersBounds:i},{name:"text-justification",type:a.justification}],h=[{name:"events",type:a.bool,triggersZOrder:i},{name:"text-events",type:a.bool,triggersZOrder:i}],d=[{name:"display",type:a.display,triggersZOrder:i,triggersBounds:i,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:a.visibility,triggersZOrder:i},{name:"opacity",type:a.zeroOneNumber,triggersZOrder:n},{name:"text-opacity",type:a.zeroOneNumber},{name:"min-zoomed-font-size",type:a.size},{name:"z-compound-depth",type:a.zCompoundDepth,triggersZOrder:i},{name:"z-index-compare",type:a.zIndexCompare,triggersZOrder:i},{name:"z-index",type:a.number,triggersZOrder:i}],f=[{name:"overlay-padding",type:a.size,triggersBounds:i},{name:"overlay-color",type:a.color},{name:"overlay-opacity",type:a.zeroOneNumber,triggersBounds:n},{name:"overlay-shape",type:a.overlayShape,triggersBounds:i}],g=[{name:"underlay-padding",type:a.size,triggersBounds:i},{name:"underlay-color",type:a.color},{name:"underlay-opacity",type:a.zeroOneNumber,triggersBounds:n},{name:"underlay-shape",type:a.overlayShape,triggersBounds:i}],p=[{name:"transition-property",type:a.propList},{name:"transition-duration",type:a.time},{name:"transition-delay",type:a.time},{name:"transition-timing-function",type:a.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},y=[{name:"height",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"width",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"shape",type:a.nodeShape,triggersBounds:i},{name:"shape-polygon-points",type:a.polygonPointList,triggersBounds:i},{name:"background-color",type:a.color},{name:"background-fill",type:a.fill},{name:"background-opacity",type:a.zeroOneNumber},{name:"background-blacken",type:a.nOneOneNumber},{name:"background-gradient-stop-colors",type:a.colors},{name:"background-gradient-stop-positions",type:a.percentages},{name:"background-gradient-direction",type:a.gradientDirection},{name:"padding",type:a.sizeMaybePercent,triggersBounds:i},{name:"padding-relative-to",type:a.paddingRelativeTo,triggersBounds:i},{name:"bounds-expansion",type:a.boundsExpansion,triggersBounds:i}],w=[{name:"border-color",type:a.color},{name:"border-opacity",type:a.zeroOneNumber},{name:"border-width",type:a.size,triggersBounds:i},{name:"border-style",type:a.borderStyle}],E=[{name:"outline-color",type:a.color},{name:"outline-opacity",type:a.zeroOneNumber},{name:"outline-width",type:a.size,triggersBounds:i},{name:"outline-style",type:a.borderStyle},{name:"outline-offset",type:a.size,triggersBounds:i}],b=[{name:"background-image",type:a.urls},{name:"background-image-crossorigin",type:a.bgCrossOrigin},{name:"background-image-opacity",type:a.zeroOneNumbers},{name:"background-image-containment",type:a.bgContainment},{name:"background-image-smoothing",type:a.bools},{name:"background-position-x",type:a.bgPos},{name:"background-position-y",type:a.bgPos},{name:"background-width-relative-to",type:a.bgRelativeTo},{name:"background-height-relative-to",type:a.bgRelativeTo},{name:"background-repeat",type:a.bgRepeat},{name:"background-fit",type:a.bgFit},{name:"background-clip",type:a.bgClip},{name:"background-width",type:a.bgWH},{name:"background-height",type:a.bgWH},{name:"background-offset-x",type:a.bgPos},{name:"background-offset-y",type:a.bgPos}],A=[{name:"position",type:a.position,triggersBounds:i},{name:"compound-sizing-wrt-labels",type:a.compoundIncludeLabels,triggersBounds:i},{name:"min-width",type:a.size,triggersBounds:i},{name:"min-width-bias-left",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-width-bias-right",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height",type:a.size,triggersBounds:i},{name:"min-height-bias-top",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height-bias-bottom",type:a.sizeMaybePercent,triggersBounds:i}],C=[{name:"line-style",type:a.lineStyle},{name:"line-color",type:a.color},{name:"line-fill",type:a.fill},{name:"line-cap",type:a.lineCap},{name:"line-opacity",type:a.zeroOneNumber},{name:"line-dash-pattern",type:a.numbers},{name:"line-dash-offset",type:a.number},{name:"line-gradient-stop-colors",type:a.colors},{name:"line-gradient-stop-positions",type:a.percentages},{name:"curve-style",type:a.curveStyle,triggersBounds:i,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:a.zeroOneNumber,triggersBounds:i},{name:"source-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"target-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"control-point-step-size",type:a.size,triggersBounds:i},{name:"control-point-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"control-point-weights",type:a.numbers,triggersBounds:i},{name:"segment-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"segment-weights",type:a.numbers,triggersBounds:i},{name:"taxi-turn",type:a.bidirectionalSizeMaybePercent,triggersBounds:i},{name:"taxi-turn-min-distance",type:a.size,triggersBounds:i},{name:"taxi-direction",type:a.axisDirection,triggersBounds:i},{name:"edge-distances",type:a.edgeDistances,triggersBounds:i},{name:"arrow-scale",type:a.positiveNumber,triggersBounds:i},{name:"loop-direction",type:a.angle,triggersBounds:i},{name:"loop-sweep",type:a.angle,triggersBounds:i},{name:"source-distance-from-node",type:a.size,triggersBounds:i},{name:"target-distance-from-node",type:a.size,triggersBounds:i}],_=[{name:"ghost",type:a.bool,triggersBounds:i},{name:"ghost-offset-x",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-offset-y",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-opacity",type:a.zeroOneNumber}],S=[{name:"selection-box-color",type:a.color},{name:"selection-box-opacity",type:a.zeroOneNumber},{name:"selection-box-border-color",type:a.color},{name:"selection-box-border-width",type:a.size},{name:"active-bg-color",type:a.color},{name:"active-bg-opacity",type:a.zeroOneNumber},{name:"active-bg-size",type:a.size},{name:"outside-texture-bg-color",type:a.color},{name:"outside-texture-bg-opacity",type:a.zeroOneNumber}],I=[];a7.pieBackgroundN=16,I.push({name:"pie-size",type:a.sizeMaybePercent});for(var T=1;T<=a7.pieBackgroundN;T++)I.push({name:"pie-"+T+"-background-color",type:a.color}),I.push({name:"pie-"+T+"-background-size",type:a.percent}),I.push({name:"pie-"+T+"-background-opacity",type:a.zeroOneNumber});var x=[],D=a7.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:a.arrowShape,triggersBounds:i},{name:"arrow-color",type:a.color},{name:"arrow-fill",type:a.arrowFill},{name:"arrow-width",type:a.arrowWidth}].forEach(function(e){D.forEach(function(t){var r=t+"-"+e.name,n=e.type,i=e.triggersBounds;x.push({name:r,type:n,triggersBounds:i})})},{});var N=a7.properties=[].concat(h,p,d,f,g,_,c,u,o,s,l,y,w,E,b,I,A,C,x,S),M=a7.propertyGroups={behavior:h,transition:p,visibility:d,overlay:f,underlay:g,ghost:_,commonLabel:c,labelDimensions:u,mainLabel:o,sourceLabel:s,targetLabel:l,nodeBody:y,nodeBorder:w,nodeOutline:E,backgroundImage:b,pie:I,compound:A,edgeLine:C,edgeArrow:x,core:S},R=a7.propertyGroupNames={};(a7.propertyGroupKeys=Object.keys(M)).forEach(function(e){R[e]=M[e].map(function(e){return e.name}),M[e].forEach(function(t){return t.groupKey=e})});var O=a7.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];a7.propertyNames=N.map(function(e){return e.name});for(var P=0;P<N.length;P++){var B=N[P];N[B.name]=B}for(var k=0;k<O.length;k++){var F=O[k],z=N[F.pointsTo],U={name:F.name,alias:!0,pointsTo:z};N.push(U),N[F.name]=U}}(),a7.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},a7.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=eo({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(e,t){for(var r=1;r<=a7.pieBackgroundN;r++){var n=t.name.replace("{{i}}",r),i=t.value;e[n]=i}return e},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"taxi-turn":"50%","taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(e,t){return a7.arrowPrefixes.forEach(function(r){var n=r+"-"+t.name,i=t.value;e[n]=i}),e},{})),r={},n=0;n<this.properties.length;n++){var i=this.properties[n];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);r[a]=s}}return e.defaultProperties=r,e.defaultProperties},a7.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var a9={};a9.parse=function(e,t,r,n){if(k(t))return this.parseImplWarn(e,t,r,n);var i,a=e$(e,""+t,r?"t":"f","mapping"===n||!0===n||!1===n||null==n?"dontcare":n),o=this.propCache=this.propCache||[];return(i=o[a])||(i=o[a]=this.parseImplWarn(e,t,r,n)),(r||"mapping"===n)&&(i=tt(i))&&(i.value=tt(i.value)),i},a9.parseImplWarn=function(e,t,r,n){var i=this.parseImpl(e,t,r,n);return i||null==t||te("The style property `".concat(e,": ").concat(t,"` is invalid")),i&&("width"===i.name||"height"===i.name)&&"label"===t&&te("The style value of `label` is deprecated for `"+i.name+"`"),i},a9.parseImpl=function(e,t,r,n){e=Q(e);var i=this.properties[e],a=t,o=this.types;if(!i||void 0===t)return null;i.alias&&(e=(i=i.pointsTo).name);var s=L(t);s&&(t=t.trim());var l=i.type;if(!l)return null;if(r&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(k(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:r};if(!s||n||t.length<7||"a"!==t[1]);else if(t.length>=7&&"d"===t[0]&&(p=new RegExp(o.data.regex).exec(t))){if(r)return!1;var u=o.data;return{name:e,value:p,strValue:""+t,mapped:u,field:p[1],bypass:r}}else if(t.length>=10&&"m"===t[0]&&(v=new RegExp(o.mapData.regex).exec(t))){if(r||l.multiple)return!1;var c=o.mapData;if(!(l.color||l.number))return!1;var h=this.parse(e,v[4]);if(!h||h.mapped)return!1;var d=this.parse(e,v[5]);if(!d||d.mapped)return!1;if(h.pfValue===d.pfValue||h.strValue===d.strValue)return te("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+h.strValue+"`"),this.parse(e,h.strValue);if(l.color){var f=h.value,g=d.value;if(f[0]===g[0]&&f[1]===g[1]&&f[2]===g[2]&&(f[3]===g[3]||(null==f[3]||1===f[3])&&(null==g[3]||1===g[3])))return!1}return{name:e,value:v,strValue:""+t,mapped:c,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:h.value,valueMax:d.value,bypass:r}}if(l.multiple&&"multiple"!==n){if(y=s?t.split(/\s+/):F(t)?t:[t],l.evenMultiple&&y.length%2!=0)return null;for(var p,v,y,w=[],E=[],b=[],A="",C=!1,_=0;_<y.length;_++){var S=this.parse(e,y[_],r,"multiple");C=C||L(S.value),w.push(S.value),b.push(null!=S.pfValue?S.pfValue:S.value),E.push(S.units),A+=(_>0?" ":"")+S.strValue}if(l.validate&&!l.validate(w,E))return null;if(l.singleEnum&&C)if(1===w.length&&L(w[0]))return{name:e,value:w[0],strValue:w[0],bypass:r};else return null;return{name:e,value:w,pfValue:b,strValue:A,bypass:r,units:E}}var I=function(){for(var n=0;n<l.enums.length;n++)if(l.enums[n]===t)return{name:e,value:t,strValue:""+t,bypass:r};return null};if(l.number){var T,x,D="px";if(l.units&&(x=l.units),l.implicitUnits&&(D=l.implicitUnits),!l.unitless)if(s){var N="px|em"+(l.allowPercent?"|\\%":"");x&&(N=x);var M=t.match("^("+ee+")("+N+")?$");M&&(t=M[1],x=M[2]||D)}else(!x||l.implicitUnits)&&(x=D);if(isNaN(t=parseFloat(t))&&void 0===l.enums)return null;if(isNaN(t)&&void 0!==l.enums)return t=a,I();if(l.integer&&!(U(T=t)&&Math.floor(T)===T)||void 0!==l.min&&(t<l.min||l.strictMin&&t===l.min)||void 0!==l.max&&(t>l.max||l.strictMax&&t===l.max))return null;var R={name:e,value:t,strValue:""+t+(x||""),units:x,bypass:r};return l.unitless||"px"!==x&&"em"!==x?R.pfValue=t:R.pfValue="px"!==x&&x?this.getEmSizeInPixels()*t:t,("ms"===x||"s"===x)&&(R.pfValue="ms"===x?t:1e3*t),("deg"===x||"rad"===x)&&(R.pfValue="rad"===x?t:Math.PI*t/180),"%"===x&&(R.pfValue=t/100),R}if(l.propList){var O=[],P=""+t;if("none"===P);else{for(var B=P.split(/\s*,\s*|\s+/),z=0;z<B.length;z++){var V=B[z].trim();this.properties[V]?O.push(V):te("`"+V+"` is not a valid property name")}if(0===O.length)return null}return{name:e,value:O,strValue:0===O.length?"none":O.join(" "),bypass:r}}if(l.color){var H,j=(F(H=t)?H:null)||ec[H.toLowerCase()]||es(H)||eu(H)||el(H);return j?{name:e,value:j,pfValue:j,strValue:"rgb("+j[0]+","+j[1]+","+j[2]+")",bypass:r}:null}if(l.regex||l.regexes){if(l.enums){var Y=I();if(Y)return Y}for(var X=l.regexes?l.regexes:[l.regex],G=0;G<X.length;G++){var W=new RegExp(X[G]).exec(t);if(W)return{name:e,value:l.singleRegexMatchValue?W[1]:W,strValue:""+t,bypass:r}}return null}if(l.string)return{name:e,value:""+t,strValue:""+t,bypass:r};else if(l.enums)return I();else return null};var oe=function e(t){return this instanceof e?X(t)?void(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):void e7("A style must have a core reference"):new e(t)},ot=oe.prototype;ot.instanceString=function(){return"style"},ot.clear=function(){for(var e=this._private,t=e.cy.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},ot.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},ot.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},ot.selector=function(e){var t="core"===e?null:new iN(e),r=this.length++;return this[r]={selector:t,properties:[],mappedProperties:[],index:r},this},ot.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],r=0;r<this.properties.length;r++){var n=this.properties[r],i=t[n.name];void 0===i&&(i=t[K(n.name)]),void 0!==i&&this.cssRule(n.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},ot.style=ot.css,ot.cssRule=function(e,t){var r=this.parse(e,t);if(r){var n=this.length-1;this[n].properties.push(r),this[n].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.mapped&&this[n].mappedProperties.push(r),this[n].selector||(this._private.coreStyle[r.name]=r)}return this},ot.append=function(e){return G(e)?e.appendToStyle(this):F(e)?this.appendFromJson(e):L(e)&&this.appendFromString(e),this},oe.fromJson=function(e,t){var r=new oe(e);return r.fromJson(t),r},oe.fromString=function(e,t){return new oe(e).fromString(t)},[a2,a3,a4,a8,a6,a5,a7,a9].forEach(function(e){eo(ot,e)}),oe.types=ot.types,oe.properties=ot.properties,oe.propertyGroups=ot.propertyGroups,oe.propertyGroupNames=ot.propertyGroupNames,oe.propertyGroupKeys=ot.propertyGroupKeys;var or={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return(null==t.selectionType&&(t.selectionType="single"),void 0===e)?t.selectionType:(("additive"===e||"single"===e)&&(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,r,n,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(L(a[0]))return o[e=a[0]];if(z(a[0])){if(!this._private.panningEnabled)return this;n=(r=a[0]).x,i=r.y,U(n)&&(o.x=n),U(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],("x"===e||"y"===e)&&U(t)&&(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var r,n,i,a=arguments,o=this._private.pan;if(!this._private.panningEnabled)return this;switch(a.length){case 1:z(e)&&(n=(r=a[0]).x,i=r.y,U(n)&&(o.x+=n),U(i)&&(o.y+=i),this.emit("pan viewport"));break;case 2:("x"===e||"y"===e)&&U(t)&&(o[e]+=t),this.emit("pan viewport")}return this.notify("viewport"),this},fit:function(e,t){var r=this.getFitViewport(e,t);if(r){var n=this._private;n.zoom=r.zoom,n.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(U(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){if(L(e)){var r,n,i,a=e;e=this.$(a)}else if(z(r=e)&&U(r.x1)&&U(r.x2)&&U(r.y1)&&U(r.y2)){var o=e;(n={x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else H(e)||(e=this.mutableElements());if(!(H(e)&&e.empty())){n=n||e.boundingBox();var s=this.width(),l=this.height();if(t=U(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){i=(i=(i=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:i)<this._private.minZoom?this._private.minZoom:i;var u={x:(s-i*(n.x1+n.x2))/2,y:(l-i*(n.y1+n.y2))/2};return{zoom:i,pan:u}}}}},zoomRange:function(e,t){var r=this._private;if(null==t){var n=e;e=n.min,t=n.max}return U(e)&&U(t)&&e<=t?(r.minZoom=e,r.maxZoom=t):U(e)&&void 0===t&&e<=r.maxZoom?r.minZoom=e:U(t)&&void 0===e&&t>=r.minZoom&&(r.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,r,n=this._private,i=n.pan,a=n.zoom,o=!1;if(n.zoomingEnabled||(o=!0),U(e)?r=e:z(e)&&(r=e.level,null!=e.position?t=tI(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||n.panningEnabled||(o=!0)),r=(r=r>n.maxZoom?n.maxZoom:r)<n.minZoom?n.minZoom:r,o||!U(r)||r===a||null!=t&&(!U(t.x)||!U(t.y)))return null;if(null==t)return{zoomed:!0,panned:!1,zoom:r,pan:i};var s=r,l={x:-s/a*(t.x-i.x)+t.x,y:-s/a*(t.y-i.y)+t.y};return{zoomed:!0,panned:!0,zoom:s,pan:l}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),r=this._private;return null!=t&&t.zoomed&&(r.zoom=t.zoom,t.panned&&(r.pan.x=t.pan.x,r.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport")),this},viewport:function(e){var t=this._private,r=!0,n=!0,i=[],a=!1,o=!1;if(!e||(U(e.zoom)||(r=!1),z(e.pan)||(n=!1),!r&&!n))return this;if(r){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(n&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;U(l.x)&&(t.pan.x=l.x,o=!1),U(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(L(e)){var r=e;e=this.mutableElements().filter(r)}else H(e)||(e=this.mutableElements());if(0!==e.length){var n=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(n.x1+n.x2))/2,y:(a-t*(n.y1+n.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,r=this._private,n=r.container;return r.sizeCache=r.sizeCache||(n?(e=this.window().getComputedStyle(n),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:n.clientWidth-t("padding-left")-t("padding-right"),height:n.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,r=this.renderedExtent(),n={x1:(r.x1-e.x)/t,x2:(r.x2-e.x)/t,y1:(r.y1-e.y)/t,y2:(r.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};or.centre=or.center,or.autolockNodes=or.autolock,or.autoungrabifyNodes=or.autoungrabify;var on={data:ih.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ih.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ih.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ih.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};on.attr=on.data,on.removeAttr=on.removeData;var oi=function(e){var t=this,r=(e=eo({},e)).container;r&&!V(r)&&V(r[0])&&(r=r[0]);var n=r?r._cyreg:null;(n=n||{}).cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];r&&(r._cyreg=n),n.cy=t;var a=void 0!==D&&void 0!==r&&!e.headless,o=e;o.layout=eo({name:a?"grid":"null"},o.layout),o.renderer=eo({name:a?"canvas":"null"},o.renderer);var s=function(e,t,r){return void 0!==t?t:void 0!==r?r:e},l=this._private={container:r,ready:!1,options:o,elements:new ak(this),listeners:[],aniEles:new ak(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:U(o.zoom)?o.zoom:1,pan:{x:z(o.pan)&&U(o.pan.x)?o.pan.x:0,y:z(o.pan)&&U(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=eo({},o,o.renderer);t.initRenderer(u);var c=function(e,r,n){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(z(e)||F(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",r),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",n),t.emit("done")});var a=eo({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};!function(e,t){if(e.some(q))return nE.all(e).then(t);t(e)}([o.style,o.elements],function(e){var r=e[0],a=e[1];l.styleEnabled&&t.style().append(r),c(a,function(){t.startAnimationLoop(),l.ready=!0,k(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var r=i[e];t.on("ready",r)}n&&(n.readies=[]),t.emit("ready")},o.done)})},oa=oi.prototype;eo(oa,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){if(!this.destroyed())return this.stopAnimationLoop(),this.destroyRenderer(),this.emit("destroy"),this._private.destroyed=!0,this},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(null==this._private.container)return D;var e=this._private.container.ownerDocument;return void 0===e||null==e?D:e.defaultView||D},mount:function(e){if(null!=e){var t=this._private,r=t.options;return!V(e)&&V(e[0])&&(e=e[0]),this.stopAnimationLoop(),this.destroyRenderer(),t.container=e,t.styleEnabled=!0,this.invalidateSize(),this.initRenderer(eo({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),this.startAnimationLoop(),this.style(r.style),this.emit("mount"),this}},unmount:function(){return this.stopAnimationLoop(),this.destroyRenderer(),this.initRenderer({name:"null"}),this.emit("unmount"),this},options:function(){return tt(this._private.options)},json:function(e){var t=this,r=t._private,n=t.mutableElements();if(z(e)){if(t.startBatch(),e.elements){var i={},a=function(e,r){for(var n=[],a=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){te("cy.json() cannot handle elements without an ID attribute");continue}var l=""+s.data.id,u=t.getElementById(l);i[l]=!0,0!==u.length?a.push({ele:u,json:s}):(r&&(s.group=r),n.push(s))}t.add(n);for(var c=0;c<a.length;c++){var h=a[c],d=h.ele,f=h.json;d.json(f)}};if(F(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];F(u)&&a(u,l)}var c=t.collection();n.filter(function(e){return!i[e.id()]}).forEach(function(e){e.isParent()?c.merge(e):e.remove()}),c.forEach(function(e){return e.children().move({parent:null})}),c.forEach(function(e){return t.getElementById(e.id()).remove()})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==r.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==r.pan.x||e.pan.y!==r.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var f=h[d];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var g={};e?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},n.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=tt(t.data());var p=r.options;return g.zoomingEnabled=r.zoomingEnabled,g.userZoomingEnabled=r.userZoomingEnabled,g.zoom=r.zoom,g.minZoom=r.minZoom,g.maxZoom=r.maxZoom,g.panningEnabled=r.panningEnabled,g.userPanningEnabled=r.userPanningEnabled,g.pan=tt(r.pan),g.boxSelectionEnabled=r.boxSelectionEnabled,g.renderer=tt(p.renderer),g.hideEdgesOnViewport=p.hideEdgesOnViewport,g.textureOnViewport=p.textureOnViewport,g.wheelSensitivity=p.wheelSensitivity,g.motionBlur=p.motionBlur,g.multiClickDebounceTime=p.multiClickDebounceTime,g}}),oa.$id=oa.getElementById,[{add:function(e){var t;if(H(e))if(e._private.cy===this)t=e.restore();else{for(var r=[],n=0;n<e.length;n++){var i=e[n];r.push(i.json())}t=new ak(this,r)}else if(F(e))t=new ak(this,e);else if(z(e)&&(F(e.nodes)||F(e.edges))){for(var a=[],o=["nodes","edges"],s=0,l=o.length;s<l;s++){var u=o[s],c=e[u];if(F(c))for(var h=0,d=c.length;h<d;h++){var f=eo({group:u},c[h]);a.push(f)}}t=new ak(this,a)}else t=new tp(this,e).collection();return t},remove:function(e){if(H(e));else if(L(e)){var t=e;e=this.$(t)}return e.remove()}},aW,aQ,aK,a$,{notify:function(e,t){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var n=r.batchNotifications[e]=r.batchNotifications[e]||this.collection();null!=t&&n.merge(t);return}if(r.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(r){var n=e.batchNotifications[r];n.empty()?t.notify(r):t.notify(r,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var r=Object.keys(e),n=0;n<r.length;n++){var i=r[n],a=e[i];t.getElementById(i).data(a)}})}},a1,a0,{style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return G(e)?t.style=e.generateStyle(this):F(e)?t.style=oe.fromJson(this,e):L(e)?t.style=oe.fromString(this,e):t.style=oe(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},or,on].forEach(function(e){eo(oa,e)});var oo={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},os={maximal:!1,acyclic:!1},ol=function(e){return e.scratch("breadthfirst")},ou=function(e,t){return e.scratch("breadthfirst",t)};function oc(e){this.options=eo({},oo,os,e)}oc.prototype.run=function(){var e,t=this.options,r=t.cy,n=t.eles,i=n.nodes().filter(function(e){return!e.isParent()}),a=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=tj(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(H(t.roots))e=t.roots;else if(F(t.roots)){for(var l=[],u=0;u<t.roots.length;u++){var c=t.roots[u],h=r.getElementById(c);l.push(h)}e=r.collection(l)}else if(L(t.roots))e=r.$(t.roots);else if(a)e=i.roots();else{var d=n.components();e=r.collection();for(var f=0;f<d.length;f++)!function(t){var r=d[t],n=r.maxDegree(!1),i=r.filter(function(e){return e.degree(!1)===n});e=e.add(i)}(f)}var g=[],p={},v=function(e,t){null==g[t]&&(g[t]=[]);var r=g[t].length;g[t].push(e),ou(e,{index:r,depth:t})},y=function(e,t){var r=ol(e),n=r.depth,i=r.index;g[n][i]=null,v(e,t)};n.bfs({roots:e,directed:t.directed,visit:function(e,t,r,n,i){var a=e[0],o=a.id();v(a,i),p[o]=!0}});for(var w=[],E=0;E<i.length;E++){var b=i[E];p[b.id()]||w.push(b)}var A=function(e){for(var t=g[e],r=0;r<t.length;r++){var n=t[r];if(null==n){t.splice(r,1),r--;continue}ou(n,{depth:e,index:r})}},C=function(){for(var e=0;e<g.length;e++)A(e)};if(a&&o){var _=[],S={},I=function(e){return _.push(e)};for(i.forEach(function(e){return _.push(e)});_.length>0;){var T=_.shift(),x=function(e,r){for(var i=ol(e),a=e.incomers().filter(function(e){return e.isNode()&&n.has(e)}),o=-1,s=e.id(),l=0;l<a.length;l++)o=Math.max(o,ol(a[l]).depth);if(i.depth<=o){if(!t.acyclic&&r[s])return null;var u=o+1;return y(e,u),r[s]=u,!0}return!1}(T,S);if(x)T.outgoers().filter(function(e){return e.isNode()&&n.has(e)}).forEach(I);else if(null===x){te("Detected double maximal shift for node `"+T.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}C();var D=0;if(t.avoidOverlap)for(var N=0;N<i.length;N++){var M=i[N].layoutDimensions(t),R=M.w,O=M.h;D=Math.max(D,R,O)}var P={},B=function(e){if(P[e.id()])return P[e.id()];for(var t=ol(e).depth,r=e.neighborhood(),n=0,a=0,o=0;o<r.length;o++){var s=r[o];if(!(s.isEdge()||s.isParent())&&i.has(s)){var l=ol(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var h=g[c].length;c<t&&(n+=u/h,a++)}}}}return n/=a=Math.max(1,a),0===a&&(n=0),P[e.id()]=n,n},k=function(e,t){var r=B(e)-B(t);return 0===r?ea(e.id(),t.id()):r};void 0!==t.depthSort&&(k=t.depthSort);for(var z=0;z<g.length;z++)g[z].sort(k),A(z);for(var U=[],V=0;V<w.length;V++)U.push(w[V]);g.unshift(U),C();for(var j=0,Y=0;Y<g.length;Y++)j=Math.max(g[Y].length,j);var X={x:s.x1+s.w/2,y:s.x1+s.h/2},G=g.reduce(function(e,t){return Math.max(e,t.length)},0);return n.nodes().layoutPositions(this,t,function(e){var r=ol(e),n=r.depth,i=r.index,a=g[n].length,o=Math.max(s.w/((t.grid?G:a)+1),D),l=Math.max(s.h/(g.length+1),D),u=Math.min(s.w/2/g.length,s.h/2/g.length);if(u=Math.max(u,D),!t.circle)return{x:X.x+(i+1-(a+1)/2)*o,y:(n+1)*l};var c=u*n+u-(g.length>0&&g[0].length<=3?u/2:0),h=2*Math.PI/g[n].length*i;return 0===n&&1===g[0].length&&(c=1),{x:X.x+c*Math.cos(h),y:X.y+c*Math.sin(h)}}),this};var oh={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function od(e){this.options=eo({},oh,e)}od.prototype.run=function(){var e,t=this.options,r=t.cy,n=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=n.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o=tj(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),u=0,c=0;c<a.length;c++){var h=a[c].layoutDimensions(t);u=Math.max(u,h.w,h.h)}if(e=U(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-u,a.length>1&&t.avoidOverlap){var d=Math.cos(l)-1,f=Math.sin(l)-0;e=Math.max(Math.sqrt((u*=1.75)*u/(d*d+f*f)),e)}return n.nodes().layoutPositions(this,t,function(r,n){var a=t.startAngle+n*l*(i?1:-1),o=e*Math.cos(a),u=e*Math.sin(a);return{x:s.x+o,y:s.y+u}}),this};var of={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function og(e){this.options=eo({},of,e)}og.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,r=e.cy,n=e.eles,i=n.nodes().not(":parent"),a=tj(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:a.x1+a.w/2,y:a.y1+a.h/2},s=[],l=0,u=0;u<i.length;u++){var c=i[u],h=void 0;h=e.concentric(c),s.push({value:h,node:c}),c._private.scratch.concentric=h}i.updateStyle();for(var d=0;d<i.length;d++){var f=i[d].layoutDimensions(e);l=Math.max(l,f.w,f.h)}s.sort(function(e,t){return t.value-e.value});for(var g=e.levelWidth(i),p=[[]],v=p[0],y=0;y<s.length;y++){var w=s[y];v.length>0&&Math.abs(v[0].value-w.value)>=g&&(v=[],p.push(v)),v.push(w)}var E=l+e.minNodeSpacing;if(!e.avoidOverlap){var b=p.length>0&&p[0].length>1,A=(Math.min(a.w,a.h)/2-E)/(p.length+b?1:0);E=Math.min(E,A)}for(var C=0,_=0;_<p.length;_++){var S=p[_],I=void 0===e.sweep?2*Math.PI-2*Math.PI/S.length:e.sweep,T=S.dTheta=I/Math.max(1,S.length-1);if(S.length>1&&e.avoidOverlap){var x=Math.cos(T)-1,D=Math.sin(T)-0;C=Math.max(Math.sqrt(E*E/(x*x+D*D)),C)}S.r=C,C+=E}if(e.equidistant){for(var N=0,M=0,R=0;R<p.length;R++)N=Math.max(N,p[R].r-M);M=0;for(var O=0;O<p.length;O++){var P=p[O];0===O&&(M=P.r),P.r=M,M+=N}}for(var B={},L=0;L<p.length;L++)for(var k=p[L],F=k.dTheta,z=k.r,U=0;U<k.length;U++){var V=k[U],H=e.startAngle+(t?1:-1)*F*U,j={x:o.x+z*Math.cos(H),y:o.y+z*Math.sin(H)};B[V.node.id()]=j}return n.nodes().layoutPositions(this,e,function(e){return B[e.id()]}),this};var op={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function om(e){this.options=eo({},op,e),this.options.layout=this;var t=this.options.eles.nodes(),r=this.options.eles.edges().filter(function(e){var r=e.source().data("id"),n=e.target().data("id"),i=t.some(function(e){return e.data("id")===r}),a=t.some(function(e){return e.data("id")===n});return!i||!a});this.options.eles=this.options.eles.not(r)}om.prototype.run=function(){var e=this.options,t=e.cy,r=this;r.stopped=!1,(!0===e.animate||!1===e.animate)&&r.emit({type:"layoutstart",layout:r}),I=!0===e.debug;var n=ov(t,r,e);I&&T(n),e.randomize&&oE(n);var i=eH(),a=function(){oA(n,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!r.stopped&&!(t>=e.numIter)&&(oC(n,e),n.temperature=n.temperature*e.coolingFactor,!(n.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),r.one("layoutstop",e.stop),r.emit({type:"layoutstop",layout:r});else{var t=e.eles.nodes(),i=ob(n,e,t);t.layoutPositions(r,e,i)}},l=0,u=!0;if(!0===e.animate)!function t(){for(var r=0;u&&r<e.refresh;)u=o(l),l++,r++;u?(eH()-i>=e.animationThreshold&&a(),eY(t)):(oB(n,e),s())}();else{for(;u;)u=o(l),l++;oB(n,e),s()}return this},om.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},om.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ov=function(e,t,r){for(var n=r.eles.edges(),i=r.eles.nodes(),a=tj(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:r.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=r.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],h=0;h<c.length;h++){var d=c[h];l[d.id()]=u}for(var u=0;u<o.nodeSize;u++){var f=i[u],g=f.layoutDimensions(r),p={};p.isLocked=f.locked(),p.id=f.data("id"),p.parentId=f.data("parent"),p.cmptId=l[f.id()],p.children=[],p.positionX=f.position("x"),p.positionY=f.position("y"),p.offsetX=0,p.offsetY=0,p.height=g.w,p.width=g.h,p.maxX=p.positionX+p.width/2,p.minX=p.positionX-p.width/2,p.maxY=p.positionY+p.height/2,p.minY=p.positionY-p.height/2,p.padLeft=parseFloat(f.style("padding")),p.padRight=parseFloat(f.style("padding")),p.padTop=parseFloat(f.style("padding")),p.padBottom=parseFloat(f.style("padding")),p.nodeRepulsion=k(r.nodeRepulsion)?r.nodeRepulsion(f):r.nodeRepulsion,o.layoutNodes.push(p),o.idToIndex[p.id]=u}for(var v=[],y=0,w=-1,E=[],u=0;u<o.nodeSize;u++){var f=o.layoutNodes[u],b=f.parentId;null!=b?o.layoutNodes[o.idToIndex[b]].children.push(f.id):(v[++w]=f.id,E.push(f.id))}for(o.graphSet.push(E);y<=w;){var A=v[y++],C=o.idToIndex[A],d=o.layoutNodes[C],_=d.children;if(_.length>0){o.graphSet.push(_);for(var u=0;u<_.length;u++)v[++w]=_[u]}}for(var u=0;u<o.graphSet.length;u++)for(var S=o.graphSet[u],h=0;h<S.length;h++){var I=o.idToIndex[S[h]];o.indexToGraph[I]=u}for(var u=0;u<o.edgeSize;u++){var T=n[u],x={};x.id=T.data("id"),x.sourceId=T.data("source"),x.targetId=T.data("target");var D=k(r.idealEdgeLength)?r.idealEdgeLength(T):r.idealEdgeLength,N=k(r.edgeElasticity)?r.edgeElasticity(T):r.edgeElasticity,M=o.idToIndex[x.sourceId],R=o.idToIndex[x.targetId];if(o.indexToGraph[M]!=o.indexToGraph[R]){for(var O=oy(x.sourceId,x.targetId,o),P=o.graphSet[O],B=0,p=o.layoutNodes[M];-1===P.indexOf(p.id);)p=o.layoutNodes[o.idToIndex[p.parentId]],B++;for(p=o.layoutNodes[R];-1===P.indexOf(p.id);)p=o.layoutNodes[o.idToIndex[p.parentId]],B++;D*=B*r.nestingFactor}x.idealLength=D,x.elasticity=N,o.layoutEdges.push(x)}return o},oy=function(e,t,r){var n=ow(e,t,0,r);return 2>n.count?0:n.graph},ow=function e(t,r,n,i){var a=i.graphSet[n];if(-1<a.indexOf(t)&&-1<a.indexOf(r))return{count:2,graph:n};for(var o=0,s=0;s<a.length;s++){var l=a[s],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(0!==c.length){var h=e(t,r,i.indexToGraph[i.idToIndex[c[0]]],i);if(0===h.count)continue;if(1!==h.count)return h;if(2==++o)break}}return{count:o,graph:n}},oE=function(e,t){for(var r=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*r,a.positionY=Math.random()*n)}},ob=function(e,t,r){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(r.forEach(function(t){var r=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,r.positionX),i.x2=Math.max(i.x2,r.positionX),i.y1=Math.min(i.y1,r.positionY),i.y2=Math.max(i.y2,r.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(r,a){var o=e.layoutNodes[e.idToIndex[r.data("id")]];if(!t.boundingBox)return{x:o.positionX,y:o.positionY};var s=(o.positionX-i.x1)/i.w,l=(o.positionY-i.y1)/i.h;return{x:n.x1+s*n.w,y:n.y1+l*n.h}}},oA=function(e,t,r){var n=r.layout,i=r.eles.nodes(),a=ob(e,r,i);i.positions(a),!0!==e.ready&&(e.ready=!0,n.one("layoutready",r.ready),n.emit({type:"layoutready",layout:this}))},oC=function(e,t,r){o_(e,t),oD(e),oN(e,t),oM(e),oR(e)},o_=function(e,t){for(var r=0;r<e.graphSet.length;r++)for(var n=e.graphSet[r],i=n.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[n[a]]],s=a+1;s<i;s++)oI(o,e.layoutNodes[e.idToIndex[n[s]]],e,t)},oS=function(e){return-e+2*e*Math.random()},oI=function(e,t,r,n){if(e.cmptId===t.cmptId||r.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=oS(1),a=oS(1));var o=oT(e,t,i,a);if(o>0)var s=n.nodeOverlap*o,l=Math.sqrt(i*i+a*a),u=s*i/l,c=s*a/l;else var h=ox(e,i,a),d=ox(t,-1*i,-1*a),f=d.x-h.x,g=d.y-h.y,p=f*f+g*g,l=Math.sqrt(p),s=(e.nodeRepulsion+t.nodeRepulsion)/p,u=s*f/l,c=s*g/l;e.isLocked||(e.offsetX-=u,e.offsetY-=c),t.isLocked||(t.offsetX+=u,t.offsetY+=c)}},oT=function(e,t,r,n){if(r>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ox=function(e,t,r){var n=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=r/t,l=a/o,u={};return 0===t&&0<r||0===t&&0>r?(u.x=n,u.y=i+a/2):0<t&&-1*l<=s&&s<=l?(u.x=n+o/2,u.y=i+o*r/2/t):0>t&&-1*l<=s&&s<=l?(u.x=n-o/2,u.y=i-o*r/2/t):0<r&&(s<=-1*l||s>=l)?(u.x=n+a*t/2/r,u.y=i+a/2):0>r&&(s<=-1*l||s>=l)&&(u.x=n-a*t/2/r,u.y=i-a/2),u},oD=function(e,t){for(var r=0;r<e.edgeSize;r++){var n=e.layoutEdges[r],i=e.idToIndex[n.sourceId],a=e.layoutNodes[i],o=e.idToIndex[n.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,u=s.positionY-a.positionY;if(0!==l||0!==u){var c=ox(a,l,u),h=ox(s,-1*l,-1*u),d=h.x-c.x,f=h.y-c.y,g=Math.sqrt(d*d+f*f),p=Math.pow(n.idealLength-g,2)/n.elasticity;if(0!==g)var v=p*d/g,y=p*f/g;else var v=0,y=0;a.isLocked||(a.offsetX+=v,a.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},oN=function(e,t){if(0!==t.gravity)for(var r=0;r<e.graphSet.length;r++){var n=e.graphSet[r],i=n.length;if(0===r)var a=e.clientHeight/2,o=e.clientWidth/2;else var s=e.layoutNodes[e.idToIndex[n[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]],a=l.positionX,o=l.positionY;for(var u=0;u<i;u++){var c=e.layoutNodes[e.idToIndex[n[u]]];if(!c.isLocked){var h=a-c.positionX,d=o-c.positionY,f=Math.sqrt(h*h+d*d);if(f>1){var g=t.gravity*h/f,p=t.gravity*d/f;c.offsetX+=g,c.offsetY+=p}}}}},oM=function(e,t){var r=[],n=0,i=-1;for(r.push.apply(r,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var a=r[n++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var d=e.layoutNodes[e.idToIndex[l[h]]];d.offsetX+=u,d.offsetY+=c,r[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},oR=function(e,t){for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];if(!(0<n.children.length)&&!n.isLocked){var i=oO(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,oP(n,e)}}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},oO=function(e,t,r){var n=Math.sqrt(e*e+t*t);if(n>r)var i={x:r*e/n,y:r*t/n};else var i={x:e,y:t};return i},oP=function e(t,r){var n=t.parentId;if(null!=n){var i=r.layoutNodes[r.idToIndex[n]],a=!1;if((null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,a=!0),(null==i.maxY||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,a=!0),a)return e(i,r)}},oB=function(e,t){for(var r=e.layoutNodes,n=[],i=0;i<r.length;i++){var a=r[i],o=a.cmptId;(n[o]=n[o]||[]).push(a)}for(var s=0,i=0;i<n.length;i++){var l=n[i];if(l){l.x1=1/0,l.x2=-1/0,l.y1=1/0,l.y2=-1/0;for(var u=0;u<l.length;u++){var c=l[u];l.x1=Math.min(l.x1,c.positionX-c.width/2),l.x2=Math.max(l.x2,c.positionX+c.width/2),l.y1=Math.min(l.y1,c.positionY-c.height/2),l.y2=Math.max(l.y2,c.positionY+c.height/2)}l.w=l.x2-l.x1,l.h=l.y2-l.y1,s+=l.w*l.h}}n.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var h=0,d=0,f=0,g=0,p=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var l=n[i];if(l){for(var u=0;u<l.length;u++){var c=l[u];c.isLocked||(c.positionX+=h-l.x1,c.positionY+=d-l.y1)}h+=l.w+t.componentSpacing,f+=l.w+t.componentSpacing,g=Math.max(g,l.h),f>p&&(d+=g+t.componentSpacing,h=0,f=0,g=0)}}},oL={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ok(e){this.options=eo({},oL,e)}ok.prototype.run=function(){var e=this.options,t=e.cy,r=e.eles,n=r.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=tj(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)r.nodes().layoutPositions(this,e,function(e){return{x:i.x1,y:i.y1}});else{var a=n.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),u=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},c=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},h=e.rows,d=null!=e.cols?e.cols:e.columns;if(null!=h&&null!=d)s=h,l=d;else if(null!=h&&null==d)l=Math.ceil(a/(s=h));else if(null==h&&null!=d)s=Math.ceil(a/(l=d));else if(l*s>a){var f=u(),g=c();(f-1)*g>=a?u(f-1):(g-1)*f>=a&&c(g-1)}else for(;l*s<a;){var p=u(),v=c();(v+1)*p>=a?c(v+1):u(p+1)}var y=i.w/l,w=i.h/s;if(e.condense&&(y=0,w=0),e.avoidOverlap)for(var E=0;E<n.length;E++){var b=n[E],A=b._private.position;(null==A.x||null==A.y)&&(A.x=0,A.y=0);var C=b.layoutDimensions(e),_=e.avoidOverlapPadding,S=C.w+_,I=C.h+_;y=Math.max(y,S),w=Math.max(w,I)}for(var T={},x=function(e,t){return!!T["c-"+e+"-"+t]},D=function(e,t){T["c-"+e+"-"+t]=!0},N=0,M=0,R=function(){++M>=l&&(M=0,N++)},O={},P=0;P<n.length;P++){var B=n[P],L=e.position(B);if(L&&(void 0!==L.row||void 0!==L.col)){var k={row:L.row,col:L.col};if(void 0===k.col)for(k.col=0;x(k.row,k.col);)k.col++;else if(void 0===k.row)for(k.row=0;x(k.row,k.col);)k.row++;O[B.id()]=k,D(k.row,k.col)}}n.layoutPositions(this,e,function(e,t){if(e.locked()||e.isParent())return!1;var r,n,a=O[e.id()];if(a)r=a.col*y+y/2+i.x1,n=a.row*w+w/2+i.y1;else{for(;x(N,M);)R();r=M*y+y/2+i.x1,n=N*w+w/2+i.y1,D(N,M),R()}return{x:r,y:n}})}return this};var oF={ready:function(){},stop:function(){}};function oz(e){this.options=eo({},oF,e)}oz.prototype.run=function(){var e=this.options,t=e.eles;return e.cy,this.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},oz.prototype.stop=function(){return this};var oU={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oV(e){this.options=eo({},oU,e)}oV.prototype.run=function(){var e=this.options,t=e.eles.nodes(),r=k(e.positions);return t.layoutPositions(this,e,function(t,n){var i=function(t){if(null==e.positions){var n;return{x:(n=t.position()).x,y:n.y}}if(r)return e.positions(t);var i=e.positions[t._private.data.id];return null==i?null:i}(t);return!t.locked()&&null!=i&&i}),this};var oH={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oj(e){this.options=eo({},oH,e)}oj.prototype.run=function(){var e=this.options,t=e.cy,r=e.eles,n=tj(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return r.nodes().layoutPositions(this,e,function(e,t){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}}),this};var oY=[{name:"breadthfirst",impl:oc},{name:"circle",impl:od},{name:"concentric",impl:og},{name:"cose",impl:om},{name:"grid",impl:ok},{name:"null",impl:oz},{name:"preset",impl:oV},{name:"random",impl:oj}];function oX(e){this.options=e,this.notifications=0}var oG=function(){},oW=function(){throw Error("A headless instance can not render images")};oX.prototype={recalculateRenderedStyle:oG,notify:function(){this.notifications++},init:oG,isHeadless:function(){return!0},png:oW,jpg:oW};var oq={};oq.arrowShapeWidth=.3,oq.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,r=function(e,t,r,n,i,a,o){var s=i.x-r/2-o,l=i.x+r/2+o,u=i.y-r/2-o,c=i.y+r/2+o;return s<=e&&e<=l&&u<=t&&t<=c},n=function(e,t,r,n,i){var a=e*Math.cos(n)-t*Math.sin(n),o=e*Math.sin(n)+t*Math.cos(n);return{x:a*r+i.x,y:o*r+i.y}},i=function(e,t,r,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(n(s,l,t,r,i))}return a},a=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(n.x,n.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(n,s){L(s)&&(s=e[s]),e[n]=eo({name:n,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,r,n,o,s){return t6(e,t,a(i(this.points,r+2*s,n,o)))},roughCollide:r,draw:function(e,r,n,a){var o=i(this.points,r,n,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:e8,roughCollide:e8,draw:e5,spacing:e6,gap:e6}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(e,r,a,o,s){var l=i(this.points,r,a,o),u=this.controlPoint,c=n(u[0],u[1],r,a,o);t.arrowShapeImpl(this.name)(e,l,c)},gap:function(e){return .8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,r,n,o,s,l){var u=a(i(this.points,r+2*l,n,o)),c=a(i(this.pointsTee,r+2*l,n,o));return t6(e,t,u)||t6(e,t,c)},draw:function(e,r,n,a,o){var s=i(this.points,r,n,a),l=i(this.pointsTee,r,n,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,r,n,o,s,l){var u=Math.pow(o.x-e,2)+Math.pow(o.y-t,2)<=Math.pow((r+2*l)*this.radius,2);return t6(e,t,a(i(this.points,r+2*l,n,o)))||u},draw:function(e,r,n,a,o){var s=i(this.pointsTr,r,n,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*r)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var r=this.baseCrossLinePts.slice(),n=t/e;return r[3]=r[3]-n,r[5]=r[5]-n,r},collide:function(e,t,r,n,o,s,l){var u=a(i(this.points,r+2*l,n,o)),c=a(i(this.crossLinePts(r,s),r+2*l,n,o));return t6(e,t,u)||t6(e,t,c)},draw:function(e,r,n,a,o){var s=i(this.points,r,n,a),l=i(this.crossLinePts(r,o),r,n,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return .525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,r,n,i,a,o){return Math.pow(i.x-e,2)+Math.pow(i.y-t,2)<=Math.pow((r+2*o)*this.radius,2)},draw:function(e,r,n,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*r)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})};var oZ={};oZ.projectIntoViewport=function(e,t){var r=this.cy,n=this.findContainerClientCoords(),i=n[0],a=n[1],o=n[4],s=r.pan(),l=r.zoom();return[((e-i)/o-s.x)/l,((t-a)/o-s.y)/l]},oZ.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),r=this.cy.window().getComputedStyle(e),n=function(e){return parseFloat(r.getPropertyValue(e))},i={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},a={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=a.left+a.right,h=t.width/(o+c),d=t.left+i.left+a.left,f=t.top+i.top+a.top;return this.containerBB=[d,f,o-l,s-u,h]},oZ.invalidateContainerClientCoordsCache=function(){this.containerBB=null},oZ.findNearestElement=function(e,t,r,n){return this.findNearestElements(e,t,r,n)[0]},oZ.findNearestElements=function(e,t,r,n){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),h=s.cy.hasCompoundNodes(),d=(n?24:8)/c,f=(n?8:2)/c,g=(n?8:2)/c,p=1/0;function v(e,t){if(e.isNode())if(a)return;else a=e,u.push(e);if(e.isEdge()&&(null==t||t<p))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value){for(var r=0;r<u.length;r++)if(u[r].isEdge()){u[r]=e,i=e,p=null!=t?t:p;break}}}else u.push(e),i=e,p=null!=t?t:p}function y(r){var n=r.outerWidth()+2*f,i=r.outerHeight()+2*f,a=n/2,l=i/2,u=r.position();if(u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(r)].checkPoint(e,t,0,n,i,u.x,u.y))return v(r,0),!0}r&&(l=l.interactive);function w(r,n){var i,a=r._private;i=n?n+"-":"",r.boundingBox();var o=a.labelBounds[n||"main"],s=r.pstyle(i+"label").value;if("yes"===r.pstyle("text-events").strValue&&s){var l=tu(a.rscratch,"labelX",n),u=tu(a.rscratch,"labelY",n),c=tu(a.rscratch,"labelAngle",n),h=r.pstyle(i+"text-margin-x").pfValue,d=r.pstyle(i+"text-margin-y").pfValue,f=o.x1-g-h,p=o.x2+g-h,y=o.y1-g-d,w=o.y2+g-d;if(c){var E=Math.cos(c),b=Math.sin(c),A=function(e,t){return{x:(e-=l)*E-(t-=u)*b+l,y:e*b+t*E+u}},C=A(f,y),_=A(f,w),S=A(p,y),I=A(p,w);if(t6(e,t,[C.x+h,C.y+d,S.x+h,S.y+d,I.x+h,I.y+d,_.x+h,_.y+d]))return v(r),!0}else if(tK(o,e,t))return v(r),!0}}for(var E=l.length-1;E>=0;E--){var b=l[E];b.isNode()?y(b)||w(b):function(r){var n,i=r._private,a=i.rscratch,l=r.pstyle("width").pfValue,c=r.pstyle("arrow-scale").value,f=l/2+d,g=f*f,p=2*f,w=i.source,E=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var b=a.allpts,A=0;A+3<b.length;A+=2)if(t1(e,t,b[A],b[A+1],b[A+2],b[A+3],p)&&g>(n=t8(e,t,b[A],b[A+1],b[A+2],b[A+3])))return v(r,n),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType){for(var b=a.allpts,A=0;A+5<a.allpts.length;A+=4)if(t0(e,t,b[A],b[A+1],b[A+2],b[A+3],b[A+4],b[A+5],p)&&g>(n=t4(e,t,b[A],b[A+1],b[A+2],b[A+3],b[A+4],b[A+5])))return v(r,n),!0}for(var w=w||i.source,E=E||i.target,C=o.getArrowWidth(l,c),_=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}],A=0;A<_.length;A++){var S=_[A],I=s.arrowShapes[r.pstyle(S.name+"-arrow-shape").value],T=r.pstyle("width").pfValue;if(I.roughCollide(e,t,C,S.angle,{x:S.x,y:S.y},T,d)&&I.collide(e,t,C,S.angle,{x:S.x,y:S.y},T,d))return v(r),!0}h&&u.length>0&&(y(w),y(E))}(b)||w(b)||w(b,"source")||w(b,"target")}return u},oZ.getAllInBox=function(e,t,r,n){var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,r),s=Math.max(e,r),l=Math.min(t,n),u=Math.max(t,n);e=o,r=s;for(var c=tj({x1:e,y1:t=l,x2:r,y2:n=u}),h=0;h<i.length;h++){var d=i[h];if(d.isNode()){var f=d.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});tQ(c,f)&&!t$(f,c)&&a.push(d)}else{var g=d._private,p=g.rscratch;if(null!=p.startX&&null!=p.startY&&!tK(c,p.startX,p.startY)||null!=p.endX&&null!=p.endY&&!tK(c,p.endX,p.endY))continue;if("bezier"===p.edgeType||"multibezier"===p.edgeType||"self"===p.edgeType||"compound"===p.edgeType||"segments"===p.edgeType||"haystack"===p.edgeType){for(var v,y=g.rstyle.bezierPts||g.rstyle.linePts||g.rstyle.haystackPts,w=!0,E=0;E<y.length;E++)if(!tK(c,(v=y[E]).x,v.y)){w=!1;break}w&&a.push(d)}else("haystack"===p.edgeType||"straight"===p.edgeType)&&a.push(d)}}return a};var oQ={};oQ.calculateArrowAngles=function(e){var t=e._private.rscratch,r="haystack"===t.edgeType,n="bezier"===t.edgeType,i="multibezier"===t.edgeType,a="segments"===t.edgeType,o="compound"===t.edgeType,s="self"===t.edgeType;if(r?(w=t.haystackPts[0],E=t.haystackPts[1],b=t.haystackPts[2],A=t.haystackPts[3]):(w=t.arrowStartX,E=t.arrowStartY,b=t.arrowEndX,A=t.arrowEndY),h=t.midX,d=t.midY,a)v=w-t.segpts[0],y=E-t.segpts[1];else if(i||o||s||n){var l=t.allpts,u=tz(l[0],l[2],l[4],.1),c=tz(l[1],l[3],l[5],.1);v=w-u,y=E-c}else v=w-h,y=E-d;t.srcArrowAngle=tO(v,y);var h=t.midX,d=t.midY;if(r&&(h=(w+b)/2,d=(E+A)/2),v=b-w,y=A-E,a){var l=t.allpts;if(l.length/2%2==0){var f=l.length/2,g=f-2;v=l[f]-l[g],y=l[f+1]-l[g+1]}else{var f=l.length/2-1,g=f-2,p=f+2;v=l[f]-l[g],y=l[f+1]-l[g+1]}}else if(i||o||s){var v,y,w,E,b,A,h,d,C,_,S,I,l=t.allpts;if(t.ctrlpts.length/2%2==0){var T=l.length/2-1,x=T+2,D=x+2;C=tz(l[T],l[x],l[D],0),_=tz(l[T+1],l[x+1],l[D+1],0),S=tz(l[T],l[x],l[D],1e-4),I=tz(l[T+1],l[x+1],l[D+1],1e-4)}else{var x=l.length/2-1,T=x-2,D=x+2;C=tz(l[T],l[x],l[D],.4999),_=tz(l[T+1],l[x+1],l[D+1],.4999),S=tz(l[T],l[x],l[D],.5),I=tz(l[T+1],l[x+1],l[D+1],.5)}v=S-C,y=I-_}if(t.midtgtArrowAngle=tO(v,y),t.midDispX=v,t.midDispY=y,v*=-1,y*=-1,a){var l=t.allpts;if(l.length/2%2==0);else{var f=l.length/2-1,p=f+2;v=-(l[p]-l[f]),y=-(l[p+1]-l[f+1])}}if(t.midsrcArrowAngle=tO(v,y),a)v=b-t.segpts[t.segpts.length-2],y=A-t.segpts[t.segpts.length-1];else if(i||o||s||n){var l=t.allpts,N=l.length,u=tz(l[N-6],l[N-4],l[N-2],.9),c=tz(l[N-5],l[N-3],l[N-1],.9);v=b-u,y=A-c}else v=b-h,y=A-d;t.tgtArrowAngle=tO(v,y)},oQ.getArrowWidth=oQ.getArrowHeight=function(e,t){var r=this.arrowWidthCache=this.arrowWidthCache||{},n=r[e+", "+t];return n||(n=Math.max(Math.pow(13.37*e,.9),29)*t,r[e+", "+t]=n),n};var oK={};function o$(e){var t=[];if(null!=e){for(var r=0;r<e.length;r+=2){var n=e[r],i=e[r+1];t.push({x:n,y:i})}return t}}oK.findMidptPtsEtc=function(e,t){var r,n=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,s=e.pstyle("source-endpoint"),l=e.pstyle("target-endpoint"),u=null!=s.units&&null!=l.units;switch(e.pstyle("edge-distances").value){case"node-position":r=n;break;case"intersection":r=i;break;case"endpoints":if(u){var c,h,d,f=o(this.manualEndptToPx(e.source()[0],s),2),g=f[0],p=f[1],v=o(this.manualEndptToPx(e.target()[0],l),2),y=v[0],w=v[1];c=w-p,d=Math.sqrt((h=y-g)*h+c*c),a={x:-c/d,y:h/d},r={x1:g,y1:p,x2:y,y2:w}}else te("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),r=i}return{midptPts:r,vectorNormInverse:a}},oK.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var r=e[t],n=r._private,i=n.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},i.target={x:Math.cos(a=2*Math.random()*Math.PI),y:Math.sin(a)}}var o=n.source,s=n.target,l=o.position(),u=s.position(),c=o.width(),h=s.width(),d=o.height(),f=s.height(),g=r.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*c*g+l.x,i.source.y*d*g+l.y,i.target.x*h*g+u.x,i.target.y*f*g+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}},oK.findSegmentsPoints=function(e,t){var r=e._private.rscratch,n=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=Math.min(n.pfValue.length,i.pfValue.length);r.edgeType="segments",r.segpts=[];for(var o=0;o<a;o++){var s=n.pfValue[o],l=i.pfValue[o],u=1-s,c=this.findMidptPtsEtc(e,t),h=c.midptPts,d=c.vectorNormInverse,f={x:h.x1*u+h.x2*s,y:h.y1*u+h.y2*s};r.segpts.push(f.x+d.x*l,f.y+d.y*l)}},oK.findLoopPoints=function(e,t,r,n){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=r,f=h;n&&(d=0,f=l);var g=u-Math.PI/2,p=g-c/2,v=g+c/2,y=String(u+"_"+c);d=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(p)*f*(d/3+1),o.y+1.4*Math.sin(p)*f*(d/3+1),o.x+1.4*Math.cos(v)*f*(d/3+1),o.y+1.4*Math.sin(v)*f*(d/3+1)]},oK.findCompoundLoopPoints=function(e,t,r,n){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),f=d?d.pfValue[0]:void 0,g=r,p=h;n&&(g=0,p=f);var v={x:a.x-s/2,y:a.y-l/2},y={x:o.x-u/2,y:o.y-c/2},w={x:Math.min(v.x,y.x),y:Math.min(v.y,y.y)},E=Math.max(.5,Math.log(.01*s)),b=Math.max(.5,Math.log(.01*u));i.ctrlpts=[w.x,w.y-1.7995514309304248*p*(g/3+1)*E,w.x-1.7995514309304248*p*(g/3+1)*b,w.y]},oK.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},oK.findBezierPoints=function(e,t,r,n,i){var a=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,c=s?s.pfValue[0]:void 0,h=l.value[0];a.edgeType=n?"multibezier":"bezier",a.ctrlpts=[];for(var d=0;d<u;d++){var f=(.5-t.eles.length/2+r)*o*(i?-1:1),g=void 0,p=tB(f);n&&(c=s?s.pfValue[d]:o,h=l.value[d]);var v=void 0!==(g=n?c:void 0!==c?p*c:void 0)?g:f,y=1-h,w=h,E=this.findMidptPtsEtc(e,t),b=E.midptPts,A=E.vectorNormInverse,C={x:b.x1*y+b.x2*w,y:b.y1*y+b.y2*w};a.ctrlpts.push(C.x+A.x*v,C.y+A.y*v)}},oK.findTaxiPoints=function(e,t){var r,n=e._private.rscratch;n.edgeType="segments";var i="vertical",a="horizontal",o="leftward",s="rightward",l="downward",u="upward",c=t.posPts,h=t.srcW,d=t.srcH,f=t.tgtW,g=t.tgtH,p="node-position"!==e.pstyle("edge-distances").value,v=e.pstyle("taxi-direction").value,y=v,w=e.pstyle("taxi-turn"),E="%"===w.units,b=w.pfValue,A=e.pstyle("taxi-turn-min-distance").pfValue,C=c.x2-c.x1,_=c.y2-c.y1,S=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},I=S(C,p?(h+f)/2:0),T=S(_,p?(d+g)/2:0),x=!1;"auto"===y?v=Math.abs(I)>Math.abs(T)?a:i:y===u||y===l?(v=i,x=!0):(y===o||y===s)&&(v=a,x=!0);var D=v===i,N=D?T:I,M=D?_:C,R=tB(M),O=!1;!(x&&(E||b<0))&&(y===l&&M<0||y===u&&M>0||y===o&&M>0||y===s&&M<0)&&(R*=-1,N=R*Math.abs(N),O=!0);var P=function(e){return Math.abs(e)<A||Math.abs(e)>=Math.abs(N)},B=P(r=E?(b<0?1+b:b)*N:(b<0?N:0)+b*R),L=P(Math.abs(N)-Math.abs(r));if((B||L)&&!O)if(D){var k=Math.abs(C)<=f/2;if(Math.abs(M)<=d/2){var F=(c.x1+c.x2)/2;n.segpts=[F,c.y1,F,c.y2]}else if(k){var z=(c.y1+c.y2)/2;n.segpts=[c.x1,z,c.x2,z]}else n.segpts=[c.x1,c.y2]}else{var U=Math.abs(_)<=g/2;if(Math.abs(M)<=h/2){var V=(c.y1+c.y2)/2;n.segpts=[c.x1,V,c.x2,V]}else if(U){var H=(c.x1+c.x2)/2;n.segpts=[H,c.y1,H,c.y2]}else n.segpts=[c.x2,c.y1]}else if(D){var j=c.y1+r+(p?d/2*R:0);n.segpts=[c.x1,j,c.x2,j]}else{var Y=c.x1+r+(p?h/2*R:0);n.segpts=[Y,c.y1,Y,c.y2]}},oK.tryToCorrectInvalidPoints=function(e,t){var r=e._private.rscratch;if("bezier"===r.edgeType){var n=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=!U(r.startX)||!U(r.startY),d=!U(r.arrowStartX)||!U(r.arrowStartY),f=!U(r.endX)||!U(r.endY),g=!U(r.arrowEndX)||!U(r.arrowEndY),p=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),v=tL({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),y=v<p,w=tL({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),E=w<p,b=!1;if(h||d||y){b=!0;var A={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},C=Math.sqrt(A.x*A.x+A.y*A.y),_={x:A.x/C,y:A.y/C},S=Math.max(a,o),I={x:r.ctrlpts[0]+2*_.x*S,y:r.ctrlpts[1]+2*_.y*S},T=u.intersectLine(n.x,n.y,a,o,I.x,I.y,0);y?(r.ctrlpts[0]=r.ctrlpts[0]+_.x*(p-v),r.ctrlpts[1]=r.ctrlpts[1]+_.y*(p-v)):(r.ctrlpts[0]=T[0]+_.x*p,r.ctrlpts[1]=T[1]+_.y*p)}if(f||g||E){b=!0;var x={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},D=Math.sqrt(x.x*x.x+x.y*x.y),N={x:x.x/D,y:x.y/D},M=Math.max(a,o),R={x:r.ctrlpts[0]+2*N.x*M,y:r.ctrlpts[1]+2*N.y*M},O=c.intersectLine(i.x,i.y,s,l,R.x,R.y,0);E?(r.ctrlpts[0]=r.ctrlpts[0]+N.x*(p-w),r.ctrlpts[1]=r.ctrlpts[1]+N.y*(p-w)):(r.ctrlpts[0]=O[0]+N.x*p,r.ctrlpts[1]=O[1]+N.y*p)}b&&this.findEndpoints(e)}},oK.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var r,n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);(t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0)?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,t.midX=tz(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=tz(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType)if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.segpts.length%4==0){var i=t.segpts.length/2,a=i-2;t.midX=(t.segpts[a]+t.segpts[i])/2,t.midY=(t.segpts[a+1]+t.segpts[i+1])/2}else{var o=t.segpts.length/2-1;t.midX=t.segpts[o],t.midY=t.segpts[o+1]}},oK.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||U(t.startX)&&U(t.startY)&&U(t.endX)&&U(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,te("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},oK.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var r=this,n=r.cy.hasCompoundNodes(),i={map:new td,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var r=this.map.get(e[0]);null==r&&(r=new td,this.map.set(e[0],r)),r.set(e[1],t)}},a=[],o=[],s=0;s<e.length;s++){var l=e[s],u=l._private,c=l.pstyle("curve-style").value;if(!l.removed()&&l.takesUpSpace()){if("haystack"===c){o.push(l);continue}var h="unbundled-bezier"===c||"segments"===c||"straight"===c||"straight-triangle"===c||"taxi"===c,d="unbundled-bezier"===c||"bezier"===c,f=u.source,g=u.target,p=[f.poolIndex(),g.poolIndex()].sort(),v=i.get(p);null==v&&(v={eles:[]},i.set(p,v),a.push(p)),v.eles.push(l),h&&(v.hasUnbundled=!0),d&&(v.hasBezier=!0)}}for(var y=0;y<a.length;y++)!function(e){var o=a[e],s=i.get(o),l=void 0;if(!s.hasUnbundled){var u=s.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});ts(s.eles),u.forEach(function(e){return s.eles.push(e)}),s.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var c=s.eles[0],h=c.source(),d=c.target();if(h.poolIndex()>d.poolIndex()){var f=h;h=d,d=f}var g=s.srcPos=h.position(),p=s.tgtPos=d.position(),v=s.srcW=h.outerWidth(),y=s.srcH=h.outerHeight(),w=s.tgtW=d.outerWidth(),E=s.tgtH=d.outerHeight(),b=s.srcShape=r.nodeShapes[t.getNodeShape(h)],A=s.tgtShape=r.nodeShapes[t.getNodeShape(d)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var C=0;C<s.eles.length;C++){var _=s.eles[C],S=_[0]._private.rscratch,I=_.pstyle("curve-style").value,T="unbundled-bezier"===I||"segments"===I||"taxi"===I,x=!h.same(_.source());if(!s.calculatedIntersection&&h!==d&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var D=b.intersectLine(g.x,g.y,v,y,p.x,p.y,0),N=s.srcIntn=D,M=A.intersectLine(p.x,p.y,w,E,g.x,g.y,0),R=s.tgtIntn=M,O=s.intersectionPts={x1:D[0],x2:M[0],y1:D[1],y2:M[1]},P=s.posPts={x1:g.x,x2:p.x,y1:g.y,y2:p.y},B=M[1]-D[1],L=M[0]-D[0],k=Math.sqrt(L*L+B*B),F=s.vector={x:L,y:B},z=s.vectorNorm={x:F.x/k,y:F.y/k},V={x:-z.y,y:z.x};s.nodesOverlap=!U(k)||A.checkPoint(D[0],D[1],0,w,E,p.x,p.y)||b.checkPoint(M[0],M[1],0,v,y,g.x,g.y),s.vectorNormInverse=V,l={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:p,tgtPos:g,srcW:w,srcH:E,tgtW:v,tgtH:y,srcIntn:R,tgtIntn:N,srcShape:A,tgtShape:b,posPts:{x1:P.x2,y1:P.y2,x2:P.x1,y2:P.y1},intersectionPts:{x1:O.x2,y1:O.y2,x2:O.x1,y2:O.y1},vector:{x:-F.x,y:-F.y},vectorNorm:{x:-z.x,y:-z.y},vectorNormInverse:{x:-V.x,y:-V.y}}}var H=x?l:s;S.nodesOverlap=H.nodesOverlap,S.srcIntn=H.srcIntn,S.tgtIntn=H.tgtIntn,n&&(h.isParent()||h.isChild()||d.isParent()||d.isChild())&&(h.parents().anySame(d)||d.parents().anySame(h)||h.same(d)&&h.isParent())?t.findCompoundLoopPoints(_,H,C,T):h===d?t.findLoopPoints(_,H,C,T):"segments"===I?t.findSegmentsPoints(_,H):"taxi"===I?t.findTaxiPoints(_,H):"straight"!==I&&(T||s.eles.length%2!=1||C!==Math.floor(s.eles.length/2))?t.findBezierPoints(_,H,C,T,x):t.findStraightEdgePoints(_),t.findEndpoints(_),t.tryToCorrectInvalidPoints(_,H),t.checkForInvalidEdgeWarning(_),t.storeAllpts(_),t.storeEdgeProjections(_),t.calculateArrowAngles(_),t.recalculateEdgeLabelProjections(_),t.calculateLabelAngles(_)}}(y);this.findHaystackPoints(o)}},oK.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if("segments"===t.edgeType)return this.recalculateRenderedStyle(e),o$(t.segpts)},oK.getControlPoints=function(e){var t=e[0]._private.rscratch,r=t.edgeType;if("bezier"===r||"multibezier"===r||"self"===r||"compound"===r)return this.recalculateRenderedStyle(e),o$(t.ctrlpts)},oK.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var oJ={};oJ.manualEndptToPx=function(e,t){var r=e.position(),n=e.outerWidth(),i=e.outerHeight();if(2===t.value.length){var a=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(a[0]=a[0]*n),"%"===t.units[1]&&(a[1]=a[1]*i),a[0]+=r.x,a[1]+=r.y,a}var o=t.pfValue[0];o=-Math.PI/2+o;var s=2*Math.max(n,i),l=[r.x+Math.cos(o)*s,r.y+Math.sin(o)*s];return this.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,n,i,l[0],l[1],0)},oJ.findEndpoints=function(e){var t,r,n,i,a,o=e.source()[0],s=e.target()[0],l=o.position(),u=s.position(),c=e.pstyle("target-arrow-shape").value,h=e.pstyle("source-arrow-shape").value,d=e.pstyle("target-distance-from-node").pfValue,f=e.pstyle("source-distance-from-node").pfValue,g=e.pstyle("curve-style").value,p=e._private.rscratch,v=p.edgeType,y="self"===v||"compound"===v,w="bezier"===v||"multibezier"===v||y,E="bezier"!==v,b="straight"===v||"segments"===v,A="segments"===v,C=y||"taxi"===g,_=e.pstyle("source-endpoint"),S=C?"outside-to-node":_.value,I=e.pstyle("target-endpoint"),T=C?"outside-to-node":I.value;if(p.srcManEndpt=_,p.tgtManEndpt=I,w){var x=[p.ctrlpts[0],p.ctrlpts[1]];r=E?[p.ctrlpts[p.ctrlpts.length-2],p.ctrlpts[p.ctrlpts.length-1]]:x,n=x}else if(b){var D=A?p.segpts.slice(0,2):[u.x,u.y];r=A?p.segpts.slice(p.segpts.length-2):[l.x,l.y],n=D}if("inside-to-node"===T)t=[u.x,u.y];else if(I.units)t=this.manualEndptToPx(s,I);else if("outside-to-line"===T)t=p.tgtIntn;else if("outside-to-node"===T||"outside-to-node-or-label"===T?i=r:("outside-to-line"===T||"outside-to-line-or-label"===T)&&(i=[l.x,l.y]),t=this.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),i[0],i[1],0),"outside-to-node-or-label"===T||"outside-to-line-or-label"===T){var N=s._private.rscratch,M=N.labelWidth,R=N.labelHeight,O=N.labelX,P=N.labelY,B=M/2,L=R/2,k=s.pstyle("text-valign").value;"top"===k?P-=L:"bottom"===k&&(P+=L);var F=s.pstyle("text-halign").value;"left"===F?O-=B:"right"===F&&(O+=B);var z=ro(i[0],i[1],[O-B,P-L,O+B,P-L,O+B,P+L,O-B,P+L],u.x,u.y);if(z.length>0){var V=tk(l,tx(t)),H=tk(l,tx(z)),j=V;H<V&&(t=z,j=H),z.length>2&&tk(l,{x:z[2],y:z[3]})<j&&(t=[z[2],z[3]])}}var Y=rl(t,r,this.arrowShapes[c].spacing(e)+d),X=rl(t,r,this.arrowShapes[c].gap(e)+d);if(p.endX=X[0],p.endY=X[1],p.arrowEndX=Y[0],p.arrowEndY=Y[1],"inside-to-node"===S)t=[l.x,l.y];else if(_.units)t=this.manualEndptToPx(o,_);else if("outside-to-line"===S)t=p.srcIntn;else if("outside-to-node"===S||"outside-to-node-or-label"===S?a=n:("outside-to-line"===S||"outside-to-line-or-label"===S)&&(a=[u.x,u.y]),t=this.nodeShapes[this.getNodeShape(o)].intersectLine(l.x,l.y,o.outerWidth(),o.outerHeight(),a[0],a[1],0),"outside-to-node-or-label"===S||"outside-to-line-or-label"===S){var G=o._private.rscratch,W=G.labelWidth,q=G.labelHeight,Z=G.labelX,Q=G.labelY,K=W/2,$=q/2,J=o.pstyle("text-valign").value;"top"===J?Q-=$:"bottom"===J&&(Q+=$);var ee=o.pstyle("text-halign").value;"left"===ee?Z-=K:"right"===ee&&(Z+=K);var et=ro(a[0],a[1],[Z-K,Q-$,Z+K,Q-$,Z+K,Q+$,Z-K,Q+$],l.x,l.y);if(et.length>0){var er=tk(u,tx(t)),en=tk(u,tx(et)),ei=er;en<er&&(t=[et[0],et[1]],ei=en),et.length>2&&tk(u,{x:et[2],y:et[3]})<ei&&(t=[et[2],et[3]])}}var ea=rl(t,n,this.arrowShapes[h].spacing(e)+f),eo=rl(t,n,this.arrowShapes[h].gap(e)+f);p.startX=eo[0],p.startY=eo[1],p.arrowStartX=ea[0],p.arrowStartY=ea[1],(w||E||b)&&(U(p.startX)&&U(p.startY)&&U(p.endX)&&U(p.endY)?p.badLine=!1:p.badLine=!0)},oJ.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},oJ.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}};var o1={};o1.storeEdgeProjections=function(e){var t=e._private,r=t.rscratch,n=r.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===n||"bezier"===n||"self"===n||"compound"===n){t.rstyle.bezierPts=[];for(var i=0;i+5<r.allpts.length;i+=4)!function(e,t,r){for(var n=function(e,t,r,n){return tz(e,t,r,n)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:n(r[0],r[2],r[4],o),y:n(r[1],r[3],r[5],o)})}}(this,e,r.allpts.slice(i,i+6))}else if("segments"===n)for(var a=t.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)a.push({x:r.allpts[i],y:r.allpts[i+1]});else if("haystack"===n){var o=r.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},o1.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var o0={};o0.recalculateNodeLabelProjection=function(e){var t,r;if(!W(e.pstyle("label").strValue)){var n=e._private,i=e.width(),a=e.height(),o=e.padding(),s=e.position(),l=e.pstyle("text-halign").strValue,u=e.pstyle("text-valign").strValue,c=n.rscratch,h=n.rstyle;switch(l){case"left":t=s.x-i/2-o;break;case"right":t=s.x+i/2+o;break;default:t=s.x}switch(u){case"top":r=s.y-a/2-o;break;case"bottom":r=s.y+a/2+o;break;default:r=s.y}c.labelX=t,c.labelY=r,h.labelX=t,h.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var o2=function(e,t){var r=Math.atan(t/e);return 0===e&&r<0&&(r*=-1),r},o3=function(e,t){return o2(t.x-e.x,t.y-e.y)},o4=function(e,t,r,n){var i=tH(0,n-.001,1),a=tH(0,n+.001,1);return o3(tU(e,t,r,i),tU(e,t,r,a))};o0.recalculateEdgeLabelProjections=function(e){var t,r=e._private,n=r.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:n.midX,y:n.midY};var o=function(e,t,n){tc(r.rscratch,e,t,n),tc(r.rstyle,e,t,n)};o("labelX",null,t.x),o("labelY",null,t.y),o("labelAutoAngle",null,o2(n.midDispX,n.midDispY));var s=function e(){if(e.cache)return e.cache;for(var t=[],a=0;a+5<n.allpts.length;a+=4){var o={x:n.allpts[a],y:n.allpts[a+1]},s={x:n.allpts[a+2],y:n.allpts[a+3]},l={x:n.allpts[a+4],y:n.allpts[a+5]};t.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=r.rstyle.bezierPts,c=i.bezierProjPcts.length;function h(e,t,r,n,i){var a=tL(t,r),o=e.segments[e.segments.length-1],s={p0:t,p1:r,t0:n,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var d=0;d<t.length;d++){var f=t[d],g=t[d-1];g&&(f.startDist=g.startDist+g.length),h(f,f.p0,u[d*c],0,i.bezierProjPcts[0]);for(var p=0;p<c-1;p++)h(f,u[d*c+p],u[d*c+p+1],i.bezierProjPcts[p],i.bezierProjPcts[p+1]);h(f,u[d*c+c-1],f.p2,i.bezierProjPcts[c-1],1)}return e.cache=t},l=function(r){var i="source"===r;if(a[r]){var l=e.pstyle(r+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var u,c,h=s(),d=0,f=0,g=0;g<h.length;g++){for(var p=h[i?g:h.length-1-g],v=0;v<p.segments.length;v++){var y=p.segments[i?v:p.segments.length-1-v],w=g===h.length-1&&v===p.segments.length-1;if(d=f,(f+=y.length)>=l||w){c={cp:p,segment:y};break}}if(c)break}var E=c.cp,b=c.segment,A=(l-d)/b.length,C=b.t1-b.t0,_=i?b.t0+C*A:b.t1-C*A;_=tH(0,_,1),t=tU(E.p0,E.p1,E.p2,_),u=o4(E.p0,E.p1,E.p2,_);break;case"straight":case"segments":case"haystack":for(var S,I,T,x,D=0,N=n.allpts.length,M=0;M+3<N&&(i?(S={x:n.allpts[M],y:n.allpts[M+1]},I={x:n.allpts[M+2],y:n.allpts[M+3]}):(S={x:n.allpts[N-2-M],y:n.allpts[N-1-M]},I={x:n.allpts[N-4-M],y:n.allpts[N-3-M]}),T=tL(S,I),x=D,!((D+=T)>=l));M+=2);var R=(l-x)/T;t=tV(S,I,R=tH(0,R,1)),u=o3(S,I)}o("labelX",r,t.x),o("labelY",r,t.y),o("labelAutoAngle",r,u)}};l("source"),l("target"),this.applyLabelDimensions(e)}},o0.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},o0.applyPrefixedLabelDimensions=function(e,t){var r=e._private,n=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,n),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=tu(r.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=i.width,h=i.height+(l-1)*(a-1)*u;tc(r.rstyle,"labelWidth",t,c),tc(r.rscratch,"labelWidth",t,c),tc(r.rstyle,"labelHeight",t,h),tc(r.rscratch,"labelHeight",t,h),tc(r.rscratch,"labelLineHeight",t,u*a)},o0.getLabelText=function(e,t){var r=e._private,n=t?t+"-":"",i=e.pstyle(n+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,n){return n?(tc(r.rscratch,e,t,n),n):tu(r.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],f=/[\s\u200b]+/,g=h?"":" ",p=0;p<u.length;p++){var v=u[p],y=this.calculateLabelDimensions(e,v).width;if(h&&(v=v.split("").join("​")),y>c){for(var w=v.split(f),E="",b=0;b<w.length;b++){var A=w[b],C=0===E.length?A:E+g+A;this.calculateLabelDimensions(e,C).width<=c?E+=A+g:(E&&d.push(E),E=A+g)}E.match(/^[\s\u200b]+$/)||d.push(E)}else d.push(v)}o("labelWrapCachedLines",d),i=o("labelWrapCachedText",d.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var _=e.pstyle("text-max-width").pfValue,S="",I=!1;if(this.calculateLabelDimensions(e,i).width<_)return i;for(var T=0;T<i.length&&!(this.calculateLabelDimensions(e,S+i[T]+"…").width>_);T++)S+=i[T],T===i.length-1&&(I=!0);return I||(S+="…"),S}return i},o0.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,r=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(r){case"left":return"right";case"right":return"left";default:return"center"}},o0.calculateLabelDimensions=function(e,t){var r=eK(t,e._private.labelDimsKey),n=this.labelDimCache||(this.labelDimCache=[]),i=n[r];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!u){u=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=u.getContext("2d");var h=u.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}c.font="".concat(a," ").concat(l," ").concat(o,"px ").concat(s);for(var d=0,f=0,g=t.split("\n"),p=0;p<g.length;p++){var v=g[p];d=Math.max(Math.ceil(c.measureText(v).width),d),f+=o}return d+=0,f+=0,n[r]={width:d,height:f}},o0.calculateLabelAngle=function(e,t){var r=e._private.rscratch,n=e.isEdge(),i=e.pstyle((t?t+"-":"")+"text-rotation"),a=i.strValue;return"none"===a?0:n&&"autorotate"===a?r.labelAutoAngle:"autorotate"===a?0:i.pfValue},o0.calculateLabelAngles=function(e){var t=e.isEdge(),r=e._private.rscratch;r.labelAngle=this.calculateLabelAngle(e),t&&(r.sourceLabelAngle=this.calculateLabelAngle(e,"source"),r.targetLabelAngle=this.calculateLabelAngle(e,"target"))};var o8={},o6=!1;o8.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(28>e.width()||28>e.height()))return o6||(te("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),o6=!0),"rectangle";if(e.isParent())if("rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t)return t;else return"rectangle";if("polygon"===t){var r=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(r).name}return t};var o5={};o5.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),r=this,n=function(e){var r=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),r)for(var n=0;n<e.length;n++){var i=e[n]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};r.binder(e).on("bounds.* dirty.*",function(e){n(e.target)}).on("style.* background.*",function(e){n(e.target,!1)});var i=function(i){if(i){var a=r.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(n(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var u=0;u<a.length;u++)(0,a[u])(i,t);r.recalculateRenderedStyle(t),t=e.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)},o5.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},o5.recalculateRenderedStyle=function(e,t){var r=function(e){return e._private.rstyle.cleanConnected},n=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||r(o.source())&&r(o.target())||(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):n.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=d.x,h.nodeY=d.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var f=0;f<n.length;f++){var g=n[f]._private,p=g.rstyle,v=g.rscratch;p.srcX=v.arrowStartX,p.srcY=v.arrowStartY,p.tgtX=v.arrowEndX,p.tgtY=v.arrowEndY,p.midX=v.midX,p.midY=v.midY,p.labelAngle=v.labelAngle,p.sourceLabelAngle=v.sourceLabelAngle,p.targetLabelAngle=v.targetLabelAngle}}};var o7={};o7.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],r=0;r<e.length;r++){var n=e[r],i=n._private.rscratch;n.grabbed()&&!n.isParent()?t.push(n):i.inDragLayer?e.drag.push(n):e.nondrag.push(n)}for(var r=0;r<t.length;r++){var n=t[r];e.drag.push(n)}}},o7.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},o7.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(am),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var o9={};[oZ,oQ,oK,oJ,o1,o0,o8,o5,o7].forEach(function(e){eo(o9,e)});var se={};se.getCachedImage=function(e,t,r){var n=this.imageCache=this.imageCache||{},i=n[e];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;var a=(i=n[e]=n[e]||{}).image=new Image;a.addEventListener("load",r),a.addEventListener("error",function(){a.error=!0});var o="data:";return e.substring(0,o.length).toLowerCase()!==o&&(a.crossOrigin=t="null"===t?null:t),a.src=e,a};var st={};st.registerBinding=function(e,t,r,n){var i=Array.prototype.slice.apply(arguments,[1]),a=this.binder(e);return a.on.apply(a,i)},st.binder=function(e){var t=this,r=t.cy.window(),n=e===r||e===r.document||e===r.document.body||!("u"<typeof HTMLElement)&&e instanceof HTMLElement;if(null==t.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,a)}catch(e){}t.supportsPassiveEvents=i}var o=function(r,i,a){var o=Array.prototype.slice.call(arguments);return n&&t.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},st.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},st.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},st.load=function(){var e,t,r,n,i,a,o,s,l,u,c,h,d,f,g,p,v,y,w,E,b,A,C,_,S=this,I=S.cy.window(),T=function(e){return e.selected()},x=function(e,t,r,n){null==e&&(e=S.cy);for(var i=0;i<t.length;i++){var a=t[i];e.emit({originalEvent:r,type:a,position:n})}},D=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},N=function(e,t){var r=!0;if(S.cy.hasCompoundNodes()&&e&&e.pannable())for(var n=0;t&&n<t.length;n++){var e=t[n];if(e.isNode()&&e.isParent()&&!e.pannable()){r=!1;break}}else r=!0;return r},M=function(e){e[0]._private.grabbed=!0},R=function(e){e[0]._private.grabbed=!1},O=function(e){e[0]._private.rscratch.inDragLayer=!0},P=function(e){e[0]._private.rscratch.inDragLayer=!1},B=function(e){e[0]._private.rscratch.isGrabTarget=!0},L=function(e){e[0]._private.rscratch.isGrabTarget=!1},k=function(e,t){var r=t.addToList;!r.has(e)&&e.grabbable()&&!e.locked()&&(r.merge(e),M(e))},F=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var r=e.descendants();t.inDragLayer&&(r.forEach(O),r.connectedEdges().forEach(O)),t.addToList&&k(r,t)}},z=function(e,t){t=t||{};var r=e.cy().hasCompoundNodes();t.inDragLayer&&(e.forEach(O),e.neighborhood().stdFilter(function(e){return!r||e.isEdge()}).forEach(O)),t.addToList&&e.forEach(function(e){k(e,t)}),F(e,t),H(e,{inDragLayer:t.inDragLayer}),S.updateCachedGrabbedEles()},V=function(e){e&&(S.getCachedZSortedEles().forEach(function(e){R(e),P(e),L(e)}),S.updateCachedGrabbedEles())},H=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var r=e.ancestors().orphans();if(!r.same(e)){var n=r.descendants().spawnSelf().merge(r).unmerge(e).unmerge(e.descendants()),i=n.connectedEdges();t.inDragLayer&&(i.forEach(O),n.forEach(O)),t.addToList&&n.forEach(function(e){k(e,t)})}}},j=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},Y="u">typeof MutationObserver,X="u">typeof ResizeObserver;Y?(S.removeObserver=new MutationObserver(function(e){for(var t=0;t<e.length;t++){var r=e[t].removedNodes;if(r){for(var n=0;n<r.length;n++)if(r[n]===S.container){S.destroy();break}}}}),S.container.parentNode&&S.removeObserver.observe(S.container.parentNode,{childList:!0})):S.registerBinding(S.container,"DOMNodeRemoved",function(e){S.destroy()});var G=eU(function(){S.cy.resize()},100);Y&&(S.styleObserver=new MutationObserver(G),S.styleObserver.observe(S.container,{attributes:!0})),S.registerBinding(I,"resize",G),X&&(S.resizeObserver=new ResizeObserver(G),S.resizeObserver.observe(S.container));for(var W=function(){S.invalidateContainerClientCoordsCache()},q=S.container;null!=q;){e=q,S.registerBinding(e,"transitionend",W),S.registerBinding(e,"animationend",W),S.registerBinding(e,"scroll",W),q=q.parentNode}S.registerBinding(S.container,"contextmenu",function(e){e.preventDefault()});var Z=function(e){for(var t=S.findContainerClientCoords(),r=t[0],n=t[1],i=t[2],a=t[3],o=e.touches?e.touches:[e],s=!1,l=0;l<o.length;l++){var u=o[l];if(r<=u.clientX&&u.clientX<=r+i&&n<=u.clientY&&u.clientY<=n+a){s=!0;break}}if(!s)return!1;for(var c=S.container,h=e.target.parentNode,d=!1;h;){if(h===c){d=!0;break}h=h.parentNode}return!!d};S.registerBinding(S.container,"mousedown",function(e){if(Z(e)){e.preventDefault(),j(),S.hoverData.capture=!0,S.hoverData.which=e.which;var t=S.cy,r=[e.clientX,e.clientY],n=S.projectIntoViewport(r[0],r[1]),i=S.selection,a=S.findNearestElements(n[0],n[1],!0,!1),o=a[0],s=S.dragData.possibleDragElements;if(S.hoverData.mdownPos=n,S.hoverData.mdownGPos=r,3==e.which){S.hoverData.cxtStarted=!0;var l={originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}};o?(o.activate(),o.emit(l),S.hoverData.down=o):t.emit(l),S.hoverData.downTime=new Date().getTime(),S.hoverData.cxtDragged=!1}else if(1==e.which){if(o&&o.activate(),null!=o&&S.nodeIsGrabbable(o)){var u=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};if(B(o),o.selected()){s=S.dragData.possibleDragElements=t.collection();var c=t.$(function(e){return e.isNode()&&e.selected()&&S.nodeIsGrabbable(e)});z(c,{addToList:s}),o.emit(u("grabon")),c.forEach(function(e){e.emit(u("grab"))})}else z(o,{addToList:s=S.dragData.possibleDragElements=t.collection()}),o.emit(u("grabon")).emit(u("grab"));S.redrawHint("eles",!0),S.redrawHint("drag",!0)}S.hoverData.down=o,S.hoverData.downs=a,S.hoverData.downTime=new Date().getTime(),x(o,["mousedown","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==o?(i[4]=1,S.data.bgActivePosistion={x:n[0],y:n[1]},S.redrawHint("select",!0),S.redraw()):o.pannable()&&(i[4]=1),S.hoverData.tapholdCancelled=!1,clearTimeout(S.hoverData.tapholdTimeout),S.hoverData.tapholdTimeout=setTimeout(function(){if(!S.hoverData.tapholdCancelled){var r=S.hoverData.down;r?r.emit({originalEvent:e,type:"taphold",position:{x:n[0],y:n[1]}}):t.emit({originalEvent:e,type:"taphold",position:{x:n[0],y:n[1]}})}},S.tapholdDuration)}i[0]=i[2]=n[0],i[1]=i[3]=n[1]}},!1),S.registerBinding(I,"mousemove",function(e){var t,r;if(S.hoverData.capture||Z(e)){var n=!1,i=S.cy,a=i.zoom(),o=[e.clientX,e.clientY],s=S.projectIntoViewport(o[0],o[1]),l=S.hoverData.mdownPos,u=S.hoverData.mdownGPos,c=S.selection,h=null;S.hoverData.draggingEles||S.hoverData.dragging||S.hoverData.selecting||(h=S.findNearestElement(s[0],s[1],!0,!1));var d=S.hoverData.last,f=S.hoverData.down,g=[s[0]-c[2],s[1]-c[3]],p=S.dragData.possibleDragElements;if(u){var v=o[0]-u[0],y=o[1]-u[1];S.hoverData.isOverThresholdDrag=t=v*v+y*y>=S.desktopTapThreshold2}var w=D(e);t&&(S.hoverData.tapholdCancelled=!0),n=!0,x(h,["mousemove","vmousemove","tapdrag"],e,{x:s[0],y:s[1]});var E=function(){S.data.bgActivePosistion=void 0,S.hoverData.selecting||i.emit({originalEvent:e,type:"boxstart",position:{x:s[0],y:s[1]}}),c[4]=1,S.hoverData.selecting=!0,S.redrawHint("select",!0),S.redraw()};if(3===S.hoverData.which){if(t){var b={originalEvent:e,type:"cxtdrag",position:{x:s[0],y:s[1]}};f?f.emit(b):i.emit(b),S.hoverData.cxtDragged=!0,(!S.hoverData.cxtOver||h!==S.hoverData.cxtOver)&&(S.hoverData.cxtOver&&S.hoverData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:s[0],y:s[1]}}),S.hoverData.cxtOver=h,h&&h.emit({originalEvent:e,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}}else if(S.hoverData.dragging){if(n=!0,i.panningEnabled()&&i.userPanningEnabled()){if(S.hoverData.justStartedPan){var A=S.hoverData.mdownPos;r={x:(s[0]-A[0])*a,y:(s[1]-A[1])*a},S.hoverData.justStartedPan=!1}else r={x:g[0]*a,y:g[1]*a};i.panBy(r),i.emit("dragpan"),S.hoverData.dragged=!0}s=S.projectIntoViewport(e.clientX,e.clientY)}else if(1==c[4]&&(null==f||f.pannable()))t&&(!S.hoverData.dragging&&i.boxSelectionEnabled()&&(w||!i.panningEnabled()||!i.userPanningEnabled())?E():!S.hoverData.selecting&&i.panningEnabled()&&i.userPanningEnabled()&&N(f,S.hoverData.downs)&&(S.hoverData.dragging=!0,S.hoverData.justStartedPan=!0,c[4]=0,S.data.bgActivePosistion=tx(l),S.redrawHint("select",!0),S.redraw()),f&&f.pannable()&&f.active()&&f.unactivate());else{if(f&&f.pannable()&&f.active()&&f.unactivate(),f&&f.grabbed()||h==d||(d&&x(d,["mouseout","tapdragout"],e,{x:s[0],y:s[1]}),h&&x(h,["mouseover","tapdragover"],e,{x:s[0],y:s[1]}),S.hoverData.last=h),f)if(t){if(i.boxSelectionEnabled()&&w)f&&f.grabbed()&&(V(p),f.emit("freeon"),p.emit("free"),S.dragData.didDrag&&(f.emit("dragfreeon"),p.emit("dragfree"))),E();else if(f&&f.grabbed()&&S.nodeIsDraggable(f)){var C,_=!S.dragData.didDrag;_&&S.redrawHint("eles",!0),S.dragData.didDrag=!0,S.hoverData.draggingEles||z(p,{inDragLayer:!0});var I={x:0,y:0};if(U(g[0])&&U(g[1])&&(I.x+=g[0],I.y+=g[1],_)){var T=S.hoverData.dragDelta;T&&U(T[0])&&U(T[1])&&(I.x+=T[0],I.y+=T[1])}S.hoverData.draggingEles=!0,p.silentShift(I).emit("position drag"),S.redrawHint("drag",!0),S.redraw()}}else 0===(C=S.hoverData.dragDelta=S.hoverData.dragDelta||[]).length?(C.push(g[0]),C.push(g[1])):(C[0]+=g[0],C[1]+=g[1]);n=!0}if(c[2]=s[0],c[3]=s[1],n)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),S.registerBinding(I,"mouseup",function(e){if(S.hoverData.capture){S.hoverData.capture=!1;var i=S.cy,a=S.projectIntoViewport(e.clientX,e.clientY),o=S.selection,s=S.findNearestElement(a[0],a[1],!0,!1),l=S.dragData.possibleDragElements,u=S.hoverData.down,c=D(e);if(S.data.bgActivePosistion&&(S.redrawHint("select",!0),S.redraw()),S.hoverData.tapholdCancelled=!0,S.data.bgActivePosistion=void 0,u&&u.unactivate(),3===S.hoverData.which){var h={originalEvent:e,type:"cxttapend",position:{x:a[0],y:a[1]}};if(u?u.emit(h):i.emit(h),!S.hoverData.cxtDragged){var d={originalEvent:e,type:"cxttap",position:{x:a[0],y:a[1]}};u?u.emit(d):i.emit(d)}S.hoverData.cxtDragged=!1,S.hoverData.which=null}else if(1===S.hoverData.which){if(x(s,["mouseup","tapend","vmouseup"],e,{x:a[0],y:a[1]}),S.dragData.didDrag||S.hoverData.dragged||S.hoverData.selecting||S.hoverData.isOverThresholdDrag||(x(u,["click","tap","vclick"],e,{x:a[0],y:a[1]}),r=!1,e.timeStamp-n<=i.multiClickDebounceTime()?(t&&clearTimeout(t),r=!0,n=null,x(u,["dblclick","dbltap","vdblclick"],e,{x:a[0],y:a[1]})):(t=setTimeout(function(){r||x(u,["oneclick","onetap","voneclick"],e,{x:a[0],y:a[1]})},i.multiClickDebounceTime()),n=e.timeStamp)),null!=u||S.dragData.didDrag||S.hoverData.selecting||S.hoverData.dragged||D(e)||(i.$(T).unselect(["tapunselect"]),l.length>0&&S.redrawHint("eles",!0),S.dragData.possibleDragElements=l=i.collection()),s!=u||S.dragData.didDrag||S.hoverData.selecting||null==s||!s._private.selectable||(S.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):c||(i.$(T).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),S.redrawHint("eles",!0)),S.hoverData.selecting){var f=i.collection(S.getAllInBox(o[0],o[1],o[2],o[3]));S.redrawHint("select",!0),f.length>0&&S.redrawHint("eles",!0),i.emit({type:"boxend",originalEvent:e,position:{x:a[0],y:a[1]}});"additive"===i.selectionType()||c||i.$(T).unmerge(f).unselect(),f.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),S.redraw()}if(S.hoverData.dragging&&(S.hoverData.dragging=!1,S.redrawHint("select",!0),S.redrawHint("eles",!0),S.redraw()),!o[4]){S.redrawHint("drag",!0),S.redrawHint("eles",!0);var g=u&&u.grabbed();V(l),g&&(u.emit("freeon"),l.emit("free"),S.dragData.didDrag&&(u.emit("dragfreeon"),l.emit("dragfree")))}}o[4]=0,S.hoverData.down=null,S.hoverData.cxtStarted=!1,S.hoverData.draggingEles=!1,S.hoverData.selecting=!1,S.hoverData.isOverThresholdDrag=!1,S.dragData.didDrag=!1,S.hoverData.dragged=!1,S.hoverData.dragDelta=[],S.hoverData.mdownPos=null,S.hoverData.mdownGPos=null}},!1);var Q=function(e){if(!S.scrollingPage){var t=S.cy,r=t.zoom(),n=t.pan(),i=S.projectIntoViewport(e.clientX,e.clientY),a=[i[0]*r+n.x,i[1]*r+n.y];if(S.hoverData.draggingEles||S.hoverData.dragging||S.hoverData.cxtStarted||0!==S.selection[4])return void e.preventDefault();if(t.panningEnabled()&&t.userPanningEnabled()&&t.zoomingEnabled()&&t.userZoomingEnabled()){e.preventDefault(),S.data.wheelZooming=!0,clearTimeout(S.data.wheelTimeout),S.data.wheelTimeout=setTimeout(function(){S.data.wheelZooming=!1,S.redrawHint("eles",!0),S.redraw()},150);var o=(null!=e.deltaY?-(e.deltaY/250):null!=e.wheelDeltaY?e.wheelDeltaY/1e3:e.wheelDelta/1e3)*S.wheelSensitivity;1===e.deltaMode&&(o*=33);var s=t.zoom()*Math.pow(10,o);"gesturechange"===e.type&&(s=S.gestureStartZoom*e.scale),t.zoom({level:s,renderedPosition:{x:a[0],y:a[1]}}),t.emit("gesturechange"===e.type?"pinchzoom":"scrollzoom")}}};S.registerBinding(S.container,"wheel",Q,!0),S.registerBinding(I,"scroll",function(e){S.scrollingPage=!0,clearTimeout(S.scrollingPageTimeout),S.scrollingPageTimeout=setTimeout(function(){S.scrollingPage=!1},250)},!0),S.registerBinding(S.container,"gesturestart",function(e){S.gestureStartZoom=S.cy.zoom(),S.hasTouchStarted||e.preventDefault()},!0),S.registerBinding(S.container,"gesturechange",function(e){S.hasTouchStarted||Q(e)},!0),S.registerBinding(S.container,"mouseout",function(e){var t=S.projectIntoViewport(e.clientX,e.clientY);S.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),S.registerBinding(S.container,"mouseover",function(e){var t=S.projectIntoViewport(e.clientX,e.clientY);S.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var K=function(e,t,r,n){return Math.sqrt((r-e)*(r-e)+(n-t)*(n-t))},$=function(e,t,r,n){return(r-e)*(r-e)+(n-t)*(n-t)};if(S.registerBinding(S.container,"touchstart",y=function(e){if(S.hasTouchStarted=!0,Z(e)){j(),S.touchData.capture=!0,S.data.bgActivePosistion=void 0;var t=S.cy,r=S.touchData.now,n=S.touchData.earlier;if(e.touches[0]){var y=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);r[0]=y[0],r[1]=y[1]}if(e.touches[1]){var y=S.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);r[2]=y[0],r[3]=y[1]}if(e.touches[2]){var y=S.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);r[4]=y[0],r[5]=y[1]}if(e.touches[1]){S.touchData.singleTouchMoved=!0,V(S.dragData.touchDragEles);var w=S.findContainerClientCoords();d=w[0],f=w[1],g=w[2],p=w[3],i=e.touches[0].clientX-d,a=e.touches[0].clientY-f,o=e.touches[1].clientX-d,s=e.touches[1].clientY-f,v=0<=i&&i<=g&&0<=o&&o<=g&&0<=a&&a<=p&&0<=s&&s<=p;var E=t.pan(),b=t.zoom();if(l=K(i,a,o,s),u=$(i,a,o,s),h=[((c=[(i+o)/2,(a+s)/2])[0]-E.x)/b,(c[1]-E.y)/b],u<4e4&&!e.touches[2]){var A=S.findNearestElement(r[0],r[1],!0,!0),C=S.findNearestElement(r[2],r[3],!0,!0);A&&A.isNode()?(A.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}}),S.touchData.start=A):C&&C.isNode()?(C.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}}),S.touchData.start=C):t.emit({originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}}),S.touchData.start&&(S.touchData.start._private.grabbed=!1),S.touchData.cxt=!0,S.touchData.cxtDragged=!1,S.data.bgActivePosistion=void 0,S.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var _=S.findNearestElements(r[0],r[1],!0,!0),I=_[0];if(null!=I&&(I.activate(),S.touchData.start=I,S.touchData.starts=_,S.nodeIsGrabbable(I))){var T=S.dragData.touchDragEles=t.collection(),D=null;S.redrawHint("eles",!0),S.redrawHint("drag",!0),I.selected()?z(D=t.$(function(e){return e.selected()&&S.nodeIsGrabbable(e)}),{addToList:T}):z(I,{addToList:T}),B(I);var N=function(t){return{originalEvent:e,type:t,position:{x:r[0],y:r[1]}}};I.emit(N("grabon")),D?D.forEach(function(e){e.emit(N("grab"))}):I.emit(N("grab"))}x(I,["touchstart","tapstart","vmousedown"],e,{x:r[0],y:r[1]}),null==I&&(S.data.bgActivePosistion={x:y[0],y:y[1]},S.redrawHint("select",!0),S.redraw()),S.touchData.singleTouchMoved=!1,S.touchData.singleTouchStartTime=+new Date,clearTimeout(S.touchData.tapholdTimeout),S.touchData.tapholdTimeout=setTimeout(function(){!1!==S.touchData.singleTouchMoved||S.pinching||S.touchData.selecting||x(S.touchData.start,["taphold"],e,{x:r[0],y:r[1]})},S.tapholdDuration)}if(e.touches.length>=1){for(var M=S.touchData.startPosition=[null,null,null,null,null,null],R=0;R<r.length;R++)M[R]=n[R]=r[R];var O=e.touches[0];S.touchData.startGPosition=[O.clientX,O.clientY]}}},!1),S.registerBinding(window,"touchmove",w=function(e){var t=S.touchData.capture;if(t||Z(e)){var r=S.selection,n=S.cy,c=S.touchData.now,g=S.touchData.earlier,p=n.zoom();if(e.touches[0]){var y=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);c[0]=y[0],c[1]=y[1]}if(e.touches[1]){var y=S.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);c[2]=y[0],c[3]=y[1]}if(e.touches[2]){var y=S.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);c[4]=y[0],c[5]=y[1]}var w=S.touchData.startGPosition;if(t&&e.touches[0]&&w){for(var E=[],b=0;b<c.length;b++)E[b]=c[b]-g[b];var A=e.touches[0].clientX-w[0],C=A*A,_=e.touches[0].clientY-w[1];en=C+_*_>=S.touchTapThreshold2}if(t&&S.touchData.cxt){e.preventDefault();var I=e.touches[0].clientX-d,T=e.touches[0].clientY-f,D=e.touches[1].clientX-d,M=e.touches[1].clientY-f,R=$(I,T,D,M);if(R/u>=2.25||R>=22500){S.touchData.cxt=!1,S.data.bgActivePosistion=void 0,S.redrawHint("select",!0);var O={originalEvent:e,type:"cxttapend",position:{x:c[0],y:c[1]}};S.touchData.start?(S.touchData.start.unactivate().emit(O),S.touchData.start=null):n.emit(O)}}if(t&&S.touchData.cxt){var O={originalEvent:e,type:"cxtdrag",position:{x:c[0],y:c[1]}};S.data.bgActivePosistion=void 0,S.redrawHint("select",!0),S.touchData.start?S.touchData.start.emit(O):n.emit(O),S.touchData.start&&(S.touchData.start._private.grabbed=!1),S.touchData.cxtDragged=!0;var P=S.findNearestElement(c[0],c[1],!0,!0);(!S.touchData.cxtOver||P!==S.touchData.cxtOver)&&(S.touchData.cxtOver&&S.touchData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:c[0],y:c[1]}}),S.touchData.cxtOver=P,P&&P.emit({originalEvent:e,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}else if(t&&e.touches[2]&&n.boxSelectionEnabled())e.preventDefault(),S.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,S.touchData.selecting||n.emit({originalEvent:e,type:"boxstart",position:{x:c[0],y:c[1]}}),S.touchData.selecting=!0,S.touchData.didSelect=!0,r[4]=1,r&&0!==r.length&&void 0!==r[0]?(r[2]=(c[0]+c[2]+c[4])/3,r[3]=(c[1]+c[3]+c[5])/3):(r[0]=(c[0]+c[2]+c[4])/3,r[1]=(c[1]+c[3]+c[5])/3,r[2]=(c[0]+c[2]+c[4])/3+1,r[3]=(c[1]+c[3]+c[5])/3+1),S.redrawHint("select",!0),S.redraw();else if(t&&e.touches[1]&&!S.touchData.didSelect&&n.zoomingEnabled()&&n.panningEnabled()&&n.userZoomingEnabled()&&n.userPanningEnabled()){e.preventDefault(),S.data.bgActivePosistion=void 0,S.redrawHint("select",!0);var B=S.dragData.touchDragEles;if(B){S.redrawHint("drag",!0);for(var L=0;L<B.length;L++){var k=B[L]._private;k.grabbed=!1,k.rscratch.inDragLayer=!1}}var F=S.touchData.start,I=e.touches[0].clientX-d,T=e.touches[0].clientY-f,D=e.touches[1].clientX-d,M=e.touches[1].clientY-f,H=K(I,T,D,M),j=H/l;if(v){var Y=I-i,X=T-a,G=D-o,W=M-s,q=n.zoom(),Q=q*j,J=n.pan(),ee=h[0]*q+J.x,et=h[1]*q+J.y,er={x:-Q/q*(ee-J.x-(Y+G)/2)+ee,y:-Q/q*(et-J.y-(X+W)/2)+et};if(F&&F.active()){var B=S.dragData.touchDragEles;V(B),S.redrawHint("drag",!0),S.redrawHint("eles",!0),F.unactivate().emit("freeon"),B.emit("free"),S.dragData.didDrag&&(F.emit("dragfreeon"),B.emit("dragfree"))}n.viewport({zoom:Q,pan:er,cancelOnFailedZoom:!0}),n.emit("pinchzoom"),l=H,i=I,a=T,o=D,s=M,S.pinching=!0}if(e.touches[0]){var y=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);c[0]=y[0],c[1]=y[1]}if(e.touches[1]){var y=S.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);c[2]=y[0],c[3]=y[1]}if(e.touches[2]){var y=S.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);c[4]=y[0],c[5]=y[1]}}else if(e.touches[0]&&!S.touchData.didSelect){var en,P,ei=S.touchData.start,ea=S.touchData.last;if(S.hoverData.draggingEles||S.swipePanning||(P=S.findNearestElement(c[0],c[1],!0,!0)),t&&null!=ei&&e.preventDefault(),t&&null!=ei&&S.nodeIsDraggable(ei))if(en){var B=S.dragData.touchDragEles,eo=!S.dragData.didDrag;eo&&z(B,{inDragLayer:!0}),S.dragData.didDrag=!0;var es={x:0,y:0};if(U(E[0])&&U(E[1])&&(es.x+=E[0],es.y+=E[1],eo)){S.redrawHint("eles",!0);var el=S.touchData.dragDelta;el&&U(el[0])&&U(el[1])&&(es.x+=el[0],es.y+=el[1])}S.hoverData.draggingEles=!0,B.silentShift(es).emit("position drag"),S.redrawHint("drag",!0),S.touchData.startPosition[0]==g[0]&&S.touchData.startPosition[1]==g[1]&&S.redrawHint("eles",!0),S.redraw()}else{var el=S.touchData.dragDelta=S.touchData.dragDelta||[];0===el.length?(el.push(E[0]),el.push(E[1])):(el[0]+=E[0],el[1]+=E[1])}if(x(ei||P,["touchmove","tapdrag","vmousemove"],e,{x:c[0],y:c[1]}),ei&&ei.grabbed()||P==ea||(ea&&ea.emit({originalEvent:e,type:"tapdragout",position:{x:c[0],y:c[1]}}),P&&P.emit({originalEvent:e,type:"tapdragover",position:{x:c[0],y:c[1]}})),S.touchData.last=P,t)for(var L=0;L<c.length;L++)c[L]&&S.touchData.startPosition[L]&&en&&(S.touchData.singleTouchMoved=!0);if(t&&(null==ei||ei.pannable())&&n.panningEnabled()&&n.userPanningEnabled()){N(ei,S.touchData.starts)&&(e.preventDefault(),S.data.bgActivePosistion||(S.data.bgActivePosistion=tx(S.touchData.startPosition)),S.swipePanning?(n.panBy({x:E[0]*p,y:E[1]*p}),n.emit("dragpan")):en&&(S.swipePanning=!0,n.panBy({x:A*p,y:_*p}),n.emit("dragpan"),ei&&(ei.unactivate(),S.redrawHint("select",!0),S.touchData.start=null)));var y=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);c[0]=y[0],c[1]=y[1]}}for(var b=0;b<c.length;b++)g[b]=c[b];t&&e.touches.length>0&&!S.hoverData.draggingEles&&!S.swipePanning&&null!=S.data.bgActivePosistion&&(S.data.bgActivePosistion=void 0,S.redrawHint("select",!0),S.redraw())}},!1),S.registerBinding(I,"touchcancel",E=function(e){var t=S.touchData.start;S.touchData.capture=!1,t&&t.unactivate()}),S.registerBinding(I,"touchend",b=function(e){var t,r=S.touchData.start;if(S.touchData.capture){0===e.touches.length&&(S.touchData.capture=!1),e.preventDefault();var n=S.selection;S.swipePanning=!1,S.hoverData.draggingEles=!1;var i=S.cy,a=i.zoom(),o=S.touchData.now,s=S.touchData.earlier;if(e.touches[0]){var l=S.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);o[0]=l[0],o[1]=l[1]}if(e.touches[1]){var l=S.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);o[2]=l[0],o[3]=l[1]}if(e.touches[2]){var l=S.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);o[4]=l[0],o[5]=l[1]}if(r&&r.unactivate(),S.touchData.cxt){if(t={originalEvent:e,type:"cxttapend",position:{x:o[0],y:o[1]}},r?r.emit(t):i.emit(t),!S.touchData.cxtDragged){var u={originalEvent:e,type:"cxttap",position:{x:o[0],y:o[1]}};r?r.emit(u):i.emit(u)}S.touchData.start&&(S.touchData.start._private.grabbed=!1),S.touchData.cxt=!1,S.touchData.start=null,S.redraw();return}if(!e.touches[2]&&i.boxSelectionEnabled()&&S.touchData.selecting){S.touchData.selecting=!1;var c=i.collection(S.getAllInBox(n[0],n[1],n[2],n[3]));n[0]=void 0,n[1]=void 0,n[2]=void 0,n[3]=void 0,n[4]=0,S.redrawHint("select",!0),i.emit({type:"boxend",originalEvent:e,position:{x:o[0],y:o[1]}}),c.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),c.nonempty()&&S.redrawHint("eles",!0),S.redraw()}if(null!=r&&r.unactivate(),e.touches[2])S.data.bgActivePosistion=void 0,S.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){S.data.bgActivePosistion=void 0,S.redrawHint("select",!0);var h=S.dragData.touchDragEles;if(null!=r){var d=r._private.grabbed;V(h),S.redrawHint("drag",!0),S.redrawHint("eles",!0),d&&(r.emit("freeon"),h.emit("free"),S.dragData.didDrag&&(r.emit("dragfreeon"),h.emit("dragfree"))),x(r,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),r.unactivate(),S.touchData.start=null}else x(S.findNearestElement(o[0],o[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]});var f=S.touchData.startPosition[0]-o[0],g=S.touchData.startPosition[1]-o[1];S.touchData.singleTouchMoved||(r||i.$(":selected").unselect(["tapunselect"]),x(r,["tap","vclick"],e,{x:o[0],y:o[1]}),A=!1,e.timeStamp-_<=i.multiClickDebounceTime()?(C&&clearTimeout(C),A=!0,_=null,x(r,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(C=setTimeout(function(){A||x(r,["onetap","voneclick"],e,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),_=e.timeStamp)),null!=r&&!S.dragData.didDrag&&r._private.selectable&&(f*f+g*g)*a*a<S.touchTapThreshold2&&!S.pinching&&("single"===i.selectionType()?(i.$(T).unmerge(r).unselect(["tapunselect"]),r.select(["tapselect"])):r.selected()?r.unselect(["tapunselect"]):r.select(["tapselect"]),S.redrawHint("eles",!0)),S.touchData.singleTouchMoved=!0}for(var p=0;p<o.length;p++)s[p]=o[p];S.dragData.didDrag=!1,0===e.touches.length&&(S.touchData.dragDelta=[],S.touchData.startPosition=[null,null,null,null,null,null],S.touchData.startGPosition=null,S.touchData.didSelect=!1),e.touches.length<2&&(1===e.touches.length&&(S.touchData.startGPosition=[e.touches[0].clientX,e.touches[0].clientY]),S.pinching=!1,S.redrawHint("eles",!0),S.redraw())}},!1),"u"<typeof TouchEvent){var J=[],ee=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},et=function(e){J.push({event:e,touch:ee(e)})},er=function(e){for(var t=0;t<J.length;t++)if(J[t].event.pointerId===e.pointerId)return void J.splice(t,1)},en=function(e){var t=J.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=ee(e)},ei=function(e){e.touches=J.map(function(e){return e.touch})},ea=function(e){return"mouse"===e.pointerType||4===e.pointerType};S.registerBinding(S.container,"pointerdown",function(e){ea(e)||(e.preventDefault(),et(e),ei(e),y(e))}),S.registerBinding(S.container,"pointerup",function(e){ea(e)||(er(e),ei(e),b(e))}),S.registerBinding(S.container,"pointercancel",function(e){ea(e)||(er(e),ei(e),E(e))}),S.registerBinding(S.container,"pointermove",function(e){ea(e)||(e.preventDefault(),en(e),ei(e),w(e))})}};var sr={};sr.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl("polygon",e,t,r,n,i,this.points)},intersectLine:function(e,t,r,n,i,a,o){return ro(i,a,this.points,e,t,r/2,n/2,o)},checkPoint:function(e,t,r,n,i,a,o){return t5(e,t,this.points,a,o,n,i,[0,-1],r)}}},sr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o){return rt(i,a,e,t,r/2+o,n/2+o)},checkPoint:function(e,t,r,n,i,a,o){return rr(e,t,n,i,a,o,r)}}},sr.generateRoundPolygon=function(e,t){for(var r=Array(2*t.length),n=0;n<t.length/2;n++){var i=2*n,a=void 0;a=n<t.length/2-1?(n+1)*2:0,r[4*n]=t[i],r[4*n+1]=t[i+1];var o=t[a]-t[i],s=t[a+1]-t[i+1],l=Math.sqrt(o*o+s*s);r[4*n+2]=o/l,r[4*n+3]=s/l}return this.nodeShapes[e]={renderer:this,name:e,points:r,draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl("round-polygon",e,t,r,n,i,this.points)},intersectLine:function(e,t,r,n,i,a,o){return rs(i,a,this.points,e,t,r,n)},checkPoint:function(e,t,r,n,i,a,o){return t7(e,t,this.points,a,o,n,i)}}},sr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ru(4,0),draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o){return tJ(i,a,e,t,r,n,o)},checkPoint:function(e,t,r,n,i,a,o){var s=rd(n,i),l=2*s;return!!(t5(e,t,this.points,a,o,n,i-l,[0,-1],r)||t5(e,t,this.points,a,o,n-l,i,[0,-1],r)||rr(e,t,l,l,a-n/2+s,o-i/2+s,r)||rr(e,t,l,l,a+n/2-s,o-i/2+s,r)||rr(e,t,l,l,a+n/2-s,o+i/2-s,r)||rr(e,t,l,l,a-n/2+s,o+i/2-s,r))}}},sr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:rg(),points:ru(4,0),draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},generateCutTrianglePts:function(e,t,r,n){var i=this.cornerLength,a=t/2,o=e/2,s=r-o,l=r+o,u=n-a,c=n+a;return{topLeft:[s,u+i,s+i,u,s+i,u+i],topRight:[l-i,u,l,u+i,l-i,u+i],bottomRight:[l,c-i,l-i,c,l-i,c-i],bottomLeft:[s+i,c,s,c-i,s+i,c-i]}},intersectLine:function(e,t,r,n,i,a,o){var s=this.generateCutTrianglePts(r+2*o,n+2*o,e,t);return ro(i,a,[].concat.apply([],[s.topLeft.splice(0,4),s.topRight.splice(0,4),s.bottomRight.splice(0,4),s.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,r,n,i,a,o){if(t5(e,t,this.points,a,o,n,i-2*this.cornerLength,[0,-1],r)||t5(e,t,this.points,a,o,n-2*this.cornerLength,i,[0,-1],r))return!0;var s=this.generateCutTrianglePts(n,i,a,o);return t6(e,t,s.topLeft)||t6(e,t,s.topRight)||t6(e,t,s.bottomRight)||t6(e,t,s.bottomLeft)}}},sr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ru(4,0),draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o){var s=this.generateBarrelBezierPts(r+2*o,n+2*o,e,t),l=function(e){var t=tU({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),r=tU({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),n=tU({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,r.x,r.y,n.x,n.y,e[4],e[5]]};return ro(i,a,[].concat(l(s.topLeft),l(s.topRight),l(s.bottomRight),l(s.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,r,n){var i=t/2,a=e/2,o=r-a,s=r+a,l=n-i,u=n+i,c=rp(e,t),h=c.heightOffset,d=c.widthOffset,f=c.ctrlPtOffsetPct*e,g={topLeft:[o,l+h,o+f,l,o+d,l],topRight:[s-d,l,s-f,l,s,l+h],bottomRight:[s,u-h,s-f,u,s-d,u],bottomLeft:[o+d,u,o+f,u,o,u-h]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,t,r,n,i,a,o){var s=rp(n,i),l=s.heightOffset,u=s.widthOffset;if(t5(e,t,this.points,a,o,n,i-2*l,[0,-1],r)||t5(e,t,this.points,a,o,n-2*u,i,[0,-1],r))return!0;for(var c=this.generateBarrelBezierPts(n,i,a,o),h=Object.keys(c),d=0;d<h.length;d++){var f=c[h[d]],g=function(e,t,r){var n=r[4],i=r[2],a=r[0],o=r[5],s=r[1],l=Math.min(n,a),u=Math.max(n,a),c=Math.min(o,s),h=Math.max(o,s);if(l<=e&&e<=u&&c<=t&&t<=h){var d=[n-2*i+a,2*(i-n),n],f=t2(d[0],d[1],d[2],e).filter(function(e){return 0<=e&&e<=1});if(f.length>0)return f[0]}return null}(e,t,f);if(null!=g){var p=tz(f[5],f[3],f[1],g);if(f.isTop&&p<=t||f.isBottom&&t<=p)return!0}}return!1}}},sr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ru(4,0),draw:function(e,t,r,n,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o){var s=e-(r/2+o),l=t-(n/2+o),u=e+(r/2+o),c=ra(i,a,e,t,s,l,u,l,!1);return c.length>0?c:tJ(i,a,e,t,r,n,o)},checkPoint:function(e,t,r,n,i,a,o){var s=rd(n,i),l=2*s;if(t5(e,t,this.points,a,o,n,i-l,[0,-1],r)||t5(e,t,this.points,a,o,n-l,i,[0,-1],r))return!0;var u=n/2+2*r,c=i/2+2*r;return!!(t6(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||rr(e,t,l,l,a+n/2-s,o+i/2-s,r)||rr(e,t,l,l,a-n/2+s,o+i/2-s,r))}}},sr.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",ru(3,0)),this.generateRoundPolygon("round-triangle",ru(3,0)),this.generatePolygon("rectangle",ru(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r),this.generatePolygon("pentagon",ru(5,0)),this.generateRoundPolygon("round-pentagon",ru(5,0)),this.generatePolygon("hexagon",ru(6,0)),this.generateRoundPolygon("round-hexagon",ru(6,0)),this.generatePolygon("heptagon",ru(7,0)),this.generateRoundPolygon("round-heptagon",ru(7,0)),this.generatePolygon("octagon",ru(8,0)),this.generateRoundPolygon("round-octagon",ru(8,0));var n=Array(20),i=rh(5,0),a=rh(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(var s=0;s<5;s++)n[4*s]=i[2*s],n[4*s+1]=i[2*s+1],n[4*s+2]=a[2*s],n[4*s+3]=a[2*s+1];n=rc(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var r,n="polygon-"+e.join("$");return(r=this[n])?r:t.generatePolygon(n,e)}};var sn={};sn.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},sn.redraw=function(e){e=e||ti(),void 0===this.averageRedrawTime&&(this.averageRedrawTime=0),void 0===this.lastRedrawTime&&(this.lastRedrawTime=0),void 0===this.lastDrawTime&&(this.lastDrawTime=0),this.requestedFrame=!0,this.renderOptions=e},sn.beforeRender=function(e,t){if(!this.destroyed){null==t&&e7("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:e,priority:t}),r.sort(function(e,t){return t.priority-e.priority})}};var si=function(e,t,r){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(t,r)};sn.startRenderLoop=function(){var e=this,t=e.cy;e.renderLoopStarted||(e.renderLoopStarted=!0,eY(function r(n){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){si(e,!0,n);var i=eH();e.render(e.renderOptions);var a=e.lastDrawTime=eH();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else si(e,!1,n);e.skipFrame=!1,eY(r)}}))};var sa=function(e){this.init(e)},so=sa.prototype;so.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],so.init=function(e){this.options=e,this.cy=e.cy;var t=this.container=e.cy.container(),r=this.cy.window();if(r){var n=r.document,i=n.head,a="__________cytoscape_stylesheet",o="__________cytoscape_container",s=null!=n.getElementById(a);if(0>t.className.indexOf(o)&&(t.className=(t.className||"")+" "+o),!s){var l=n.createElement("style");l.id=a,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===r.getComputedStyle(t).getPropertyValue("position")&&te("A Cytoscape container has style position:static and so can not use UI extensions properly")}this.selection=[void 0,void 0,void 0,void 0,0],this.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.dragData={possibleDragElements:[]},this.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},this.redraws=0,this.showFps=e.showFps,this.debug=e.debug,this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.textureOnViewport=e.textureOnViewport,this.wheelSensitivity=e.wheelSensitivity,this.motionBlurEnabled=e.motionBlur,this.forcedPixelRatio=U(e.pixelRatio)?e.pixelRatio:null,this.motionBlur=e.motionBlur,this.motionBlurOpacity=e.motionBlurOpacity,this.motionBlurTransparency=1-this.motionBlurOpacity,this.motionBlurPxRatio=1,this.mbPxRBlurry=1,this.minMbLowQualFrames=4,this.fullQualityMb=!1,this.clearedForMotionBlur=[],this.desktopTapThreshold=e.desktopTapThreshold,this.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,this.touchTapThreshold=e.touchTapThreshold,this.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,this.tapholdDuration=500,this.bindings=[],this.beforeRenderCallbacks=[],this.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},this.registerNodeShapes(),this.registerArrowShapes(),this.registerCalculationListeners()},so.notify=function(e,t){var r=this.cy;if(!this.destroyed){if("init"===e)return void this.load();if("destroy"===e)return void this.destroy();("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),("load"===e||"resize"===e||"mount"===e)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.container)),this.redrawHint("eles",!0),this.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},so.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e<this.bindings.length;e++){var t=this.bindings[e],r=t.target;(r.off||r.removeEventListener).apply(r,t.args)}if(this.bindings=[],this.beforeRenderCallbacks=[],this.onUpdateEleCalcsFns=[],this.removeObserver&&this.removeObserver.disconnect(),this.styleObserver&&this.styleObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect(),this.labelCalcDiv)try{document.body.removeChild(this.labelCalcDiv)}catch(e){}},so.isHeadless=function(){return!1},[oq,o9,se,st,sr,sn].forEach(function(e){eo(so,e)});var ss=1e3/60,sl=function(e){return function(){var t=this,r=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var n=eU(function(){r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},e.deqRedrawThreshold),i=e.priority||e5;r.beforeRender(function(i,a){var o=eH(),s=r.averageRedrawTime,l=r.lastRedrawTime,u=[],c=r.cy.extent(),h=r.getPixelRatio();for(i||r.flushRenderedStyleQueue();;){var d=eH(),f=d-o,g=d-a;if(l<ss){var p=ss-(i?s:0);if(g>=e.deqFastCost*p)break}else if(i){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*ss)break;var v=e.deq(t,h,c);if(v.length>0)for(var y=0;y<v.length;y++)u.push(v[y]);else break}u.length>0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&n())},i(t))}}},su=function(){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e8;t(this,e),this.idsByKey=new td,this.keyForId=new td,this.cachesByLvl=new td,this.lvls=[],this.getKey=r,this.doesEleInvalidateKey=n}return i(e,[{key:"getIdsFor",value:function(e){null==e&&e7("Can not get id list for null key");var t=this.idsByKey,r=this.idsByKey.get(e);return r||(r=new tg,t.set(e,r)),r}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),r=this.keyForId.get(t),n=this.getKey(e);this.deleteIdForKey(r,t),this.addIdForKey(n,t),this.keyForId.set(t,n)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),r=this.keyForId.get(t);this.deleteIdForKey(r,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,r=this.lvls,n=t.get(e);return n||(n=new td,t.set(e,n),r.push(e)),n}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var r=this.getKey(e),n=this.getCache(r,t);return null!=n&&this.updateKeyMappingFor(e),n}},{key:"getForCachedKey",value:function(e,t){var r=this.keyForId.get(e.id());return this.getCache(r,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var r=this.getKey(e);return this.hasCache(r,t)}},{key:"setCache",value:function(e,t,r){r.key=e,this.getCachesAt(t).set(e,r)}},{key:"set",value:function(e,t,r){var n=this.getKey(e);this.setCache(n,t,r),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var r=this.getKey(e);this.deleteCache(r,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(r){return t.deleteCache(e,r)})}},{key:"invalidate",value:function(e){var t=e.id(),r=this.keyForId.get(t);this.deleteKeyMappingFor(e);var n=this.doesEleInvalidateKey(e);return n&&this.invalidateKey(r),n||0===this.getNumberOfIdsForKey(r)}}]),e}(),sc={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},sh=ta({getKey:null,doesEleInvalidateKey:e8,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:e4,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),sd=function(e,t){this.renderer=e,this.onDequeues=[];var r=sh(t);eo(this,r),this.lookup=new su(r.getKey,r.doesEleInvalidateKey),this.setupDequeueing()},sf=sd.prototype;sf.reasons=sc,sf.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},sf.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},sf.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new ty(function(e,t){return t.reqs-e.reqs})},sf.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},sf.getElement=function(e,t,r,n,i){var a,o,s,l=this,u=this.renderer,c=u.cy.zoom(),h=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!l.allowEdgeTxrCaching&&e.isEdge()||!l.allowParentTxrCaching&&e.isParent())return null;if(null==n&&(n=Math.ceil(tP(c*r))),n<-4)n=-4;else if(c>=7.99||n>3)return null;var d=Math.pow(2,n),f=t.h*d,g=t.w*d,p=u.eleTextBiggerThanMin(e,d);if(!this.isVisible(e,p))return null;var v=h.get(e,n);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(a=f<=25?25:f<=50?50:50*Math.ceil(f/50),f>1024||g>1024)return null;var y=l.getTextureQueue(a),w=y[y.length-2],E=function(){return l.recycleTexture(a,g)||l.addTexture(a,g)};w||(w=y[y.length-1]),w||(w=E()),w.width-w.usedWidth<g&&(w=E());for(var b=function(e){return e&&e.scaledLabelShown===p},A=i&&i===sc.dequeue,C=i&&i===sc.highQuality,_=i&&i===sc.downscale,S=n+1;S<=3;S++){var I=h.get(e,S);if(I){o=I;break}}var T=o&&o.level===n+1?o:null,x=function(){w.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,w.usedWidth,0,g,f)};if(w.context.setTransform(1,0,0,1,0,0),w.context.clearRect(w.usedWidth,0,g,a),b(T))x();else if(b(o))if(!C)return l.queueElement(e,o.level-1),o;else{for(var D=o.level;D>n;D--)T=l.getElement(e,t,r,D,sc.downscale);x()}else{if(!A&&!C&&!_)for(var N=n-1;N>=-4;N--){var M=h.get(e,N);if(M){s=M;break}}if(b(s))return l.queueElement(e,n),s;w.context.translate(w.usedWidth,0),w.context.scale(d,d),this.drawElement(w.context,e,t,p,!1),w.context.scale(1/d,1/d),w.context.translate(-w.usedWidth,0)}return v={x:w.usedWidth,texture:w,level:n,scale:d,width:g,height:f,scaledLabelShown:p},w.usedWidth+=Math.ceil(g+8),w.eleCaches.push(v),h.set(e,n,v),l.checkTextureFullness(w),v},sf.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},sf.invalidateElement=function(e){var t=this.lookup,r=[];if(t.isInvalid(e)){for(var n=-4;n<=3;n++){var i=t.getForCachedKey(e,n);i&&r.push(i)}if(t.invalidate(e))for(var a=0;a<r.length;a++){var o=r[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},sf.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},sf.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?to(t,e):e.fullnessChecks++},sf.retireTexture=function(e){var t=e.height,r=this.getTextureQueue(t),n=this.lookup;to(r,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];n.deleteCache(o.key,o.level)}ts(i),this.getRetiredTextureQueue(t).push(e)},sf.addTexture=function(e,t){var r=this.getTextureQueue(e),n={};return r.push(n),n.eleCaches=[],n.height=e,n.width=Math.max(1024,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},sf.recycleTexture=function(e,t){for(var r=this.getTextureQueue(e),n=this.getRetiredTextureQueue(e),i=0;i<n.length;i++){var a=n[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,ts(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),to(n,a),r.push(a),a}},sf.queueElement=function(e,t){var r=this.getElementQueue(),n=this.getElementKeyToQueue(),i=this.getKey(e),a=n[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,r.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};r.push(o),n[i]=o}},sf.dequeue=function(e){for(var t=this.getElementQueue(),r=this.getElementKeyToQueue(),n=[],i=this.lookup,a=0;a<1;a++)if(t.size()>0){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(r[s]=null,u)continue;n.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,sc.dequeue)}else break;return n},sf.removeFromQueue=function(e){var t=this.getElementQueue(),r=this.getElementKeyToQueue(),n=this.getKey(e),i=r[n];null!=i&&(1===i.eles.length?(i.reqs=e3,t.updateItem(i),t.pop(),r[n]=null):i.eles.unmerge(e))},sf.onDequeue=function(e){this.onDequeues.push(e)},sf.offDequeue=function(e){to(this.onDequeues,e)},sf.setupDequeueing=sl({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,r){return e.dequeue(t,r)},onDeqd:function(e,t){for(var r=0;r<e.onDequeues.length;r++)(0,e.onDequeues[r])(t)},shouldRedraw:function(e,t,r,n){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(tQ(a[o].boundingBox(),n))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var sg=function(e){var t=this,r=t.renderer=e,n=r.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=eH()-500,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=eU(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),r.beforeRender(function(e,r){r-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new ty(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},sp=sg.prototype,sm=0;sp.makeLayer=function(e,t){var r=Math.pow(2,t),n=Math.ceil(e.w*r),i=Math.ceil(e.h*r),a=this.renderer.makeOffscreenCanvas(n,i),o={id:sm=++sm%0x1fffffffffffff,bb:e,level:t,width:n,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(r,r),s.translate(l,u),o},sp.getLayers=function(e,t,r){var n,i,a=this,o=a.renderer.cy.zoom(),s=a.firstGet;if(a.firstGet=!1,null==r){if((r=Math.ceil(tP(o*t)))<-4)r=-4;else if(o>=3.99||r>2)return null}a.validateLayersElesOrdering(r,e);var l=a.layersByLevel,u=Math.pow(2,r),c=l[r]=l[r]||[];if(a.levelIsComplete(r,e))return c;var h=function(t){if(a.validateLayersElesOrdering(t,e),a.levelIsComplete(t,e))return i=l[t],!0},d=function(e){if(!i)for(var t=r+e;-4<=t&&t<=2&&!h(t);t+=e);};d(1),d(-1);for(var f=c.length-1;f>=0;f--){var g=c[f];g.invalid&&to(c,g)}var p=function(){if(!n){n=tj();for(var t=0;t<e.length;t++)tX(n,e[t].boundingBox())}return n};if(a.skipping&&!s)return null;for(var v=null,y=e.length/1,w=!s,E=0;E<e.length;E++){var b=e[E],A=b._private.rscratch,C=A.imgLayerCaches=A.imgLayerCaches||{},_=C[r];if(_){v=_;continue}if((!v||v.eles.length>=y||!t$(v.bb,b.boundingBox()))&&!(v=function(e){var t=(e=e||{}).after;if(p(),n.w*u*(n.h*u)>16e6)return null;var i=a.makeLayer(n,r);if(null!=t){var o=c.indexOf(t)+1;c.splice(o,0,i)}else(void 0===e.insert||e.insert)&&c.unshift(i);return i}({insert:!0,after:v})))return null;i||w?a.queueLayer(v,b):a.drawEleInLayer(v,b,r,t),v.eles.push(b),C[r]=v}return i||(w?null:c)},sp.getEleLevelForLayerLevel=function(e,t){return e},sp.drawEleInLayer=function(e,t,r,n){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(r=this.getEleLevelForLayerLevel(r,n),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,r,!0),i.setImgSmoothing(a,!0))},sp.levelIsComplete=function(e,t){var r=this.layersByLevel[e];if(!r||0===r.length)return!1;for(var n=0,i=0;i<r.length;i++){var a=r[i];if(a.reqs>0||a.invalid)return!1;n+=a.eles.length}return n===t.length},sp.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(r)for(var n=0;n<r.length;n++){for(var i=r[n],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},sp.updateElementsInLayers=function(e,t){for(var r=j(e[0]),n=0;n<e.length;n++)for(var i=r?null:e[n],a=r?e[n]:e[n].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(i&&this.getEleLevelForLayerLevel(u.level)!==i.level||t(u,a,i))}},sp.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var r=this.layersByLevel[t];if(r&&r.length>0){e=!0;break}}return e},sp.invalidateElements=function(e){var t=this;0===e.length||(t.lastInvalidationTime=eH(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,r,n){t.invalidateLayer(e)}))},sp.invalidateLayer=function(e){if(this.lastInvalidationTime=eH(),!e.invalid){var t=e.level,r=e.eles;to(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},sp.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,r,n){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},sp.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},sp.queueLayer=function(e,t){var r=this.layersQueue,n=e.elesQueue,i=n.hasId=n.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;n.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},sp.dequeue=function(e){for(var t=this.layersQueue,r=[],n=0;n<1&&0!==t.size();){var i=t.peek();if(i.replacement||i.replaces&&i!==i.replaces.replacement||i.invalid){t.pop();continue}var a=i.elesQueue.shift();a&&(this.drawEleInLayer(i,a,i.level,e),n++),0===r.length&&r.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&this.applyLayerReplacement(i),this.requestRedraw())}return r},sp.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],r=e.replaces,n=t.indexOf(r);if(!(n<0)&&!r.invalid){t[n]=e;for(var i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},sp.requestRedraw=eU(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),sp.setupDequeueing=sl({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:e5,shouldRedraw:e4,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var sv={};function sy(e,t){for(var r=0;r<t.length;r++){var n=t[r];e.lineTo(n.x,n.y)}}function sw(e,t,r){for(var n,i=0;i<t.length;i++){var a=t[i];0===i&&(n=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(r.x,r.y,n.x,n.y)}function sE(e,t,r){e.beginPath&&e.beginPath();for(var n=0;n<t.length;n++){var i=t[n];e.lineTo(i.x,i.y)}var a=r[0];e.moveTo(a.x,a.y);for(var n=1;n<r.length;n++){var i=r[n];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function sb(e,t,r,n,i){e.beginPath&&e.beginPath(),e.arc(r,n,i,0,2*Math.PI,!1);var a=t[0];e.moveTo(a.x,a.y);for(var o=0;o<t.length;o++){var s=t[o];e.lineTo(s.x,s.y)}e.closePath&&e.closePath()}function sA(e,t,r,n){e.arc(t,r,n,0,2*Math.PI,!1)}sv.arrowShapeImpl=function(e){return(x||(x={polygon:sy,"triangle-backcurve":sw,"triangle-tee":sE,"circle-triangle":sb,"triangle-cross":sE,circle:sA}))[e]};var sC={};sC.drawElement=function(e,t,r,n,i,a){t.isNode()?this.drawNode(e,t,r,n,i,a):this.drawEdge(e,t,r,n,i,a)},sC.drawElementOverlay=function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},sC.drawElementUnderlay=function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},sC.drawCachedElementPortion=function(e,t,r,n,i,a,o,s){var l=r.getBoundingBox(t);if(0!==l.w&&0!==l.h){var u=r.getElement(t,l,n,i,a);if(null!=u){var c,h,d,f,g,p,v=s(this,t);if(0===v)return;var y=o(this,t),w=l.x1,E=l.y1,b=l.w,A=l.h;if(0!==y){var C=r.getRotationPoint(t);d=C.x,f=C.y,e.translate(d,f),e.rotate(y),(g=this.getImgSmoothing(e))||this.setImgSmoothing(e,!0);var _=r.getRotationOffset(t);c=_.x,h=_.y}else c=w,h=E;1!==v&&(p=e.globalAlpha,e.globalAlpha=p*v),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,c,h,b,A),1!==v&&(e.globalAlpha=p),0!==y&&(e.rotate(-y),e.translate(-d,-f),g||this.setImgSmoothing(e,!1))}else r.drawElement(e,t)}};var s_=function(){return 0},sS=function(e,t){return e.getTextAngle(t,null)},sI=function(e,t){return e.getTextAngle(t,"source")},sT=function(e,t){return e.getTextAngle(t,"target")},sx=function(e,t){return t.effectiveOpacity()},sD=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};sC.drawCachedElement=function(e,t,r,n,i,a){var o=this.data,s=o.eleTxrCache,l=o.lblTxrCache,u=o.slbTxrCache,c=o.tlbTxrCache,h=t.boundingBox(),d=!0===a?s.reasons.highQuality:null;if(0!==h.w&&0!==h.h&&t.visible()&&(!n||tQ(h,n))){var f=t.isEdge(),g=t.element()._private.rscratch.badLine;this.drawElementUnderlay(e,t),this.drawCachedElementPortion(e,t,s,r,i,d,s_,sx),f&&g||this.drawCachedElementPortion(e,t,l,r,i,d,sS,sD),f&&!g&&(this.drawCachedElementPortion(e,t,u,r,i,d,sI,sD),this.drawCachedElementPortion(e,t,c,r,i,d,sT,sD)),this.drawElementOverlay(e,t)}},sC.drawElements=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];this.drawElement(e,n)}},sC.drawCachedElements=function(e,t,r,n){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,r,n)}},sC.drawCachedNodes=function(e,t,r,n){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,r,n)}},sC.drawLayeredElements=function(e,t,r,n){var i=this.data.lyrTxrCache.getLayers(t,r);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,r,n)};var sN={};sN.drawEdge=function(e,t,r){var n,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=!(arguments.length>5)||void 0===arguments[5]||arguments[5],s=this,l=t._private.rscratch;if((!o||t.visible())&&!(l.badLine||null==l.allpts||isNaN(l.allpts[0]))){r&&(n=r,e.translate(-n.x1,-n.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,p=u*c,v=u*c,y=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;"straight-triangle"===h?(s.eleStrokeStyle(e,t,r),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=f,e.lineCap=g,s.eleStrokeStyle(e,t,r),s.drawEdgePath(t,e,l.allpts,d),e.lineCap="butt")},w=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;s.drawArrowheads(e,t,r)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var E=t.pstyle("ghost-offset-x").pfValue,b=t.pstyle("ghost-offset-y").pfValue,A=p*t.pstyle("ghost-opacity").value;e.translate(E,b),y(A),w(A),e.translate(-E,-b)}a&&s.drawEdgeUnderlay(e,t),y(),w(),a&&s.drawEdgeOverlay(e,t),s.drawElementText(e,t,null,i),r&&e.translate(n.x1,n.y1)}};var sM=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,r){if(r.visible()){var n=r.pstyle("".concat(e,"-opacity")).value;if(0!==n){var i=this.usePaths(),a=r._private.rscratch,o=r.pstyle("".concat(e,"-padding")).pfValue,s=r.pstyle("".concat(e,"-color")).value;t.lineWidth=2*o,"self"!==a.edgeType||i?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],n),this.drawEdgePath(r,t,a.allpts,"solid")}}}};sN.drawEdgeOverlay=sM("overlay"),sN.drawEdgeUnderlay=sM("underlay"),sN.drawEdgePath=function(e,t,r,n){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=r.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(n){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(r[0],r[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<r.length;d+=4)t.quadraticCurveTo(r[d],r[d+1],r[d+2],r[d+3]);break;case"straight":case"segments":case"haystack":for(var f=2;f+1<r.length;f+=2)t.lineTo(r[f],r[f+1])}t=o,l?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},sN.drawEdgeTrianglePath=function(e,t,r){t.fillStyle=t.strokeStyle;for(var n=e.pstyle("width").pfValue,i=0;i+1<r.length;i+=2){var a=[r[i+2]-r[i],r[i+3]-r[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],l=[s[0]*n/2,s[1]*n/2];t.beginPath(),t.moveTo(r[i]-l[0],r[i+1]-l[1]),t.lineTo(r[i]+l[0],r[i+1]+l[1]),t.lineTo(r[i+2],r[i+3]),t.closePath(),t.fill()}},sN.drawArrowheads=function(e,t,r){var n=t._private.rscratch,i="haystack"===n.edgeType;i||this.drawArrowhead(e,t,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,r),this.drawArrowhead(e,t,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,r),this.drawArrowhead(e,t,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,r),i||this.drawArrowhead(e,t,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,r)},sN.drawArrowhead=function(e,t,r,n,i,a,o){if(!(isNaN(n)||null==n||isNaN(i)||null==i||isNaN(a))&&null!=a){var s=t.pstyle(r+"-arrow-shape").value;if("none"!==s){var l="hollow"===t.pstyle(r+"-arrow-fill").value?"both":"filled",u=t.pstyle(r+"-arrow-fill").value,c=t.pstyle("width").pfValue,h=t.pstyle(r+"-arrow-width"),d="match-line"===h.value?c:h.pfValue;"%"===h.units&&(d*=c);var f=t.pstyle("opacity").value;void 0===o&&(o=f);var g=e.globalCompositeOperation;(1!==o||"hollow"===u)&&(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,c,s,d,n,i,a),e.globalCompositeOperation=g);var p=t.pstyle(r+"-arrow-color").value;this.colorFillStyle(e,p[0],p[1],p[2],o),this.colorStrokeStyle(e,p[0],p[1],p[2],o),this.drawArrowShape(t,e,u,c,s,d,n,i,a)}}},sN.drawArrowShape=function(e,t,r,n,i,a,o,s,l){var u,c=this.usePaths()&&"triangle-cross"!==i,h=!1,d=t,f=e.pstyle("arrow-scale").value,g=this.getArrowWidth(n,f),p=this.arrowShapes[i];if(c){var v=this.arrowPathCache=this.arrowPathCache||[],y=eK(i),w=v[y];null!=w?(u=t=w,h=!0):(u=t=new Path2D,v[y]=u)}!h&&(t.beginPath&&t.beginPath(),c?p.draw(t,1,0,{x:0,y:0},1):p.draw(t,g,l,{x:o,y:s},n),t.closePath&&t.closePath()),t=d,c&&(t.translate(o,s),t.rotate(l),t.scale(g,g)),("filled"===r||"both"===r)&&(c?t.fill(u):t.fill()),("hollow"===r||"both"===r)&&(t.lineWidth=a/(c?g:1),t.lineJoin="miter",c?t.stroke(u):t.stroke()),c&&(t.scale(1/g,1/g),t.rotate(-l),t.translate(-o,-s))};var sR={};sR.safeDrawImage=function(e,t,r,n,i,a,o,s,l,u){if(!(i<=0)&&!(a<=0)&&!(l<=0)&&!(u<=0))try{e.drawImage(t,r,n,i,a,o,s,l,u)}catch(e){te(e)}},sR.drawInscribedImage=function(e,t,r,n,i){var a=r.position(),o=a.x,s=a.y,l=r.cy().style(),u=l.getIndexedStyle.bind(l),c=u(r,"background-fit","value",n),h=u(r,"background-repeat","value",n),d=r.width(),f=r.height(),g=2*r.padding(),p=d+("inner"===u(r,"background-width-relative-to","value",n)?0:g),v=f+("inner"===u(r,"background-height-relative-to","value",n)?0:g),y=r._private.rscratch,w="node"===u(r,"background-clip","value",n),E=u(r,"background-image-opacity","value",n)*i,b=u(r,"background-image-smoothing","value",n),A=t.width||t.cachedW,C=t.height||t.cachedH;(null==A||null==C)&&(document.body.appendChild(t),A=t.cachedW=t.width||t.offsetWidth,C=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var _=A,S=C;if("auto"!==u(r,"background-width","value",n)&&(_="%"===u(r,"background-width","units",n)?u(r,"background-width","pfValue",n)*p:u(r,"background-width","pfValue",n)),"auto"!==u(r,"background-height","value",n)&&(S="%"===u(r,"background-height","units",n)?u(r,"background-height","pfValue",n)*v:u(r,"background-height","pfValue",n)),0!==_&&0!==S){if("contain"===c){var I=Math.min(p/_,v/S);_*=I,S*=I}else if("cover"===c){var I=Math.max(p/_,v/S);_*=I,S*=I}var T=o-p/2,x=u(r,"background-position-x","units",n),D=u(r,"background-position-x","pfValue",n);"%"===x?T+=(p-_)*D:T+=D;var N=u(r,"background-offset-x","units",n),M=u(r,"background-offset-x","pfValue",n);"%"===N?T+=(p-_)*M:T+=M;var R=s-v/2,O=u(r,"background-position-y","units",n),P=u(r,"background-position-y","pfValue",n);"%"===O?R+=(v-S)*P:R+=P;var B=u(r,"background-offset-y","units",n),L=u(r,"background-offset-y","pfValue",n);"%"===B?R+=(v-S)*L:R+=L,y.pathCache&&(T-=o,R-=s,o=0,s=0);var k=e.globalAlpha;e.globalAlpha=E;var F=this.getImgSmoothing(e),z=!1;if("no"===b&&F?(this.setImgSmoothing(e,!1),z=!0):"yes"!==b||F||(this.setImgSmoothing(e,!0),z=!0),"no-repeat"===h)w&&(e.save(),y.pathCache?e.clip(y.pathCache):(this.nodeShapes[this.getNodeShape(r)].draw(e,o,s,p,v),e.clip())),this.safeDrawImage(e,t,0,0,A,C,T,R,_,S),w&&e.restore();else{var U=e.createPattern(t,h);e.fillStyle=U,this.nodeShapes[this.getNodeShape(r)].draw(e,o,s,p,v),e.translate(T,R),e.fill(),e.translate(-T,-R)}e.globalAlpha=k,z&&this.setImgSmoothing(e,F)}};var sO={};sO.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(tP(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},sO.drawElementText=function(e,t,r,n,i){var a,o=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(null==n){if(o&&!this.eleTextBiggerThanMin(t))return}else if(!1===n)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;e.textAlign=this.getLabelJustification(t),e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,u=t.pstyle("label"),c=t.pstyle("source-label"),h=t.pstyle("target-label");if(l||(!u||!u.value)&&(!c||!c.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var d=!r;r&&(a=r,e.translate(-a.x1,-a.y1)),null==i?(this.drawText(e,t,null,d,o),t.isEdge()&&(this.drawText(e,t,"source",d,o),this.drawText(e,t,"target",d,o))):this.drawText(e,t,i,d,o),r&&e.translate(a.x1,a.y1)},sO.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if((t=this.fontCaches[r]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},sO.setupTextStyle=function(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=n+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},sO.getTextAngle=function(e,t){var r=e._private.rscratch,n=t?t+"-":"",i=e.pstyle(n+"text-rotation"),a=tu(r,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},sO.drawText=function(e,t,r){var n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===r&&(r=null);var s=tu(a,"labelX",r),l=tu(a,"labelY",r),u=this.getLabelText(t,r);if(null!=u&&""!==u&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,i);var c,h,d,f=r?r+"-":"",g=tu(a,"labelWidth",r),p=tu(a,"labelHeight",r),v=t.pstyle(f+"text-margin-x").pfValue,y=t.pstyle(f+"text-margin-y").pfValue,w=t.isEdge(),E=t.pstyle("text-halign").value,b=t.pstyle("text-valign").value;switch(w&&(E="center",b="center"),s+=v,l+=y,0!==(d=n?this.getTextAngle(t,r):0)&&(c=s,h=l,e.translate(c,h),e.rotate(d),s=0,l=0),b){case"top":break;case"center":l+=p/2;break;case"bottom":l+=p}var A=t.pstyle("text-background-opacity").value,C=t.pstyle("text-border-opacity").value,_=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue;if(A>0||_>0&&C>0){var I=s-S;switch(E){case"left":I-=g;break;case"center":I-=g/2}var T=l-p-S,x=g+2*S,D=p+2*S;if(A>0){var N=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+A*o+")",0===t.pstyle("text-background-shape").strValue.indexOf("round")?function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,r),e.lineTo(t+n-a,r),e.quadraticCurveTo(t+n,r,t+n,r+a),e.lineTo(t+n,r+i-a),e.quadraticCurveTo(t+n,r+i,t+n-a,r+i),e.lineTo(t+a,r+i),e.quadraticCurveTo(t,r+i,t,r+i-a),e.lineTo(t,r+a),e.quadraticCurveTo(t,r,t+a,r),e.closePath(),e.fill()}(e,I,T,x,D,2):e.fillRect(I,T,x,D),e.fillStyle=N}if(_>0&&C>0){var R=e.strokeStyle,O=e.lineWidth,P=t.pstyle("text-border-color").value,B=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+C*o+")",e.lineWidth=_,e.setLineDash)switch(B){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=_/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(I,T,x,D),"double"===B){var L=_/2;e.strokeRect(I+L,T+L,x-2*L,D-2*L)}e.setLineDash&&e.setLineDash([]),e.lineWidth=O,e.strokeStyle=R}}var k=2*t.pstyle("text-outline-width").pfValue;if(k>0&&(e.lineWidth=k),"wrap"===t.pstyle("text-wrap").value){var F=tu(a,"labelWrapCachedLines",r),z=tu(a,"labelLineHeight",r),U=g/2,V=this.getLabelJustification(t);switch("auto"===V||("left"===E?"left"===V?s+=-g:"center"===V&&(s+=-U):"center"===E?"left"===V?s+=-U:"right"===V&&(s+=U):"right"===E&&("center"===V?s+=U:"right"===V&&(s+=g))),b){case"top":case"center":case"bottom":l-=(F.length-1)*z}for(var H=0;H<F.length;H++)k>0&&e.strokeText(F[H],s,l),e.fillText(F[H],s,l),l+=z}else k>0&&e.strokeText(u,s,l),e.fillText(u,s,l);0!==d&&(e.rotate(-d),e.translate(-c,-h))}}};var sP={};sP.drawNode=function(e,t,r){var n,i,a,o,s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],u=!(arguments.length>5)||void 0===arguments[5]||arguments[5],c=this,h=t._private,d=h.rscratch,f=t.position();if(U(f.x)&&U(f.y)&&(!u||t.visible())){var g=u?t.effectiveOpacity():1,p=c.usePaths(),v=!1,y=t.padding();n=t.width()+2*y,i=t.height()+2*y,r&&(o=r,e.translate(-o.x1,-o.y1));for(var w=t.pstyle("background-image").value,E=Array(w.length),b=Array(w.length),A=0,C=0;C<w.length;C++){var _=w[C];if(E[C]=null!=_&&"none"!==_){var S=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",C);A++,b[C]=c.getCachedImage(_,S,function(){h.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var I=t.pstyle("background-blacken").value,T=t.pstyle("border-width").pfValue,x=t.pstyle("background-opacity").value*g,D=t.pstyle("border-color").value,N=t.pstyle("border-style").value,M=t.pstyle("border-opacity").value*g,R=t.pstyle("outline-width").pfValue,O=t.pstyle("outline-color").value,P=t.pstyle("outline-style").value,B=t.pstyle("outline-opacity").value*g,L=t.pstyle("outline-offset").value;e.lineJoin="miter";var k=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;c.eleFillStyle(e,t,r)},F=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;c.colorStrokeStyle(e,D[0],D[1],D[2],t)},z=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B;c.colorStrokeStyle(e,O[0],O[1],O[2],t)},V=function(e,t,r,n){var i,a=c.nodePathCache=c.nodePathCache||[],o=e$("polygon"===r?r+","+n.join(","):r,""+t,""+e),s=a[o],l=!1;return null!=s?(l=!0,d.pathCache=i=s):(i=new Path2D,a[o]=d.pathCache=i),{path:i,cacheHit:l}},H=t.pstyle("shape").strValue,j=t.pstyle("shape-polygon-points").pfValue;if(p){e.translate(f.x,f.y);var Y=V(n,i,H,j);a=Y.path,v=Y.cacheHit}var X=function(){if(!v){var r=f;p&&(r={x:0,y:0}),c.nodeShapes[c.getNodeShape(t)].draw(a||e,r.x,r.y,n,i)}p?e.fill(a):e.fill()},G=function(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=h.backgrounding,a=0,o=0;o<b.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);if(n&&"over"===s||!n&&"inside"===s){a++;continue}E[o]&&b[o].complete&&!b[o].error&&(a++,c.drawInscribedImage(e,b[o],t,o,r))}h.backgrounding=a!==A,i!==h.backgrounding&&t.updateStyle(!1)},W=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;c.hasPie(t)&&(c.drawPie(e,t,a),r&&!p&&c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,n,i))},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=I>0?0:255;0!==I&&(c.colorFillStyle(e,r,r,r,(I>0?I:-I)*t),p?e.fill(a):e.fill())},Z=function(){if(T>0){if(e.lineWidth=T,e.lineCap="butt",e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(p?e.stroke(a):e.stroke(),"double"===N){e.lineWidth=T/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(a):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},Q=function(){if(R>0){if(e.lineWidth=R,e.lineCap="butt",e.setLineDash)switch(P){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var r,a=f;p&&(a={x:0,y:0});var o=c.getNodeShape(t),s=(n+T+(R+L))/n,l=(i+T+(R+L))/i,u=n*s,h=i*l,d=c.nodeShapes[o].points;if(p&&(r=V(u,h,o,d).path),"ellipse"===o)c.drawEllipsePath(r||e,a.x,a.y,u,h);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(o)){var g=0,v=0,y=0;"round-diamond"===o?g=(T+L+R)*1.4:"round-heptagon"===o?(g=(T+L+R)*1.075,y=-(T/2+L+R)/35):"round-hexagon"===o?g=(T+L+R)*1.12:"round-pentagon"===o?(g=(T+L+R)*1.13,y=-(T/2+L+R)/15):"round-tag"===o?(g=(T+L+R)*1.12,v=(T/2+R+L)*.07):"round-triangle"===o&&(g=Math.PI/2*(T+L+R),y=-(T+L/2+R)/Math.PI),0!==g&&(s=(n+g)/n,l=(i+g)/i),c.drawRoundPolygonPath(r||e,a.x+v,a.y+y,n*s,i*l,d)}else["roundrectangle","round-rectangle"].includes(o)?c.drawRoundRectanglePath(r||e,a.x,a.y,u,h):["cutrectangle","cut-rectangle"].includes(o)?c.drawCutRectanglePath(r||e,a.x,a.y,u,h):["bottomroundrectangle","bottom-round-rectangle"].includes(o)?c.drawBottomRoundRectanglePath(r||e,a.x,a.y,u,h):"barrel"===o?c.drawBarrelPath(r||e,a.x,a.y,u,h):(d=o.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(o)?t9(re(d,(T+R+L)/n)):t9(re(d,-((T+R+L)/n))),c.drawPolygonPath(r||e,a.x,a.y,n,i,d));if(p?e.stroke(r):e.stroke(),"double"===P){e.lineWidth=T/3;var w=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(r):e.stroke(),e.globalCompositeOperation=w}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var K=t.pstyle("ghost-offset-x").pfValue,$=t.pstyle("ghost-offset-y").pfValue,J=t.pstyle("ghost-opacity").value,ee=J*g;e.translate(K,$),z(),Q(),k(J*x),X(),G(ee,!0),F(J*M),Z(),W(0!==I||0!==T),G(ee,!1),q(ee),e.translate(-K,-$)}p&&e.translate(-f.x,-f.y),l&&c.drawNodeUnderlay(e,t,f,n,i),p&&e.translate(f.x,f.y),z(),Q(),k(),X(),G(g,!0),F(),Z(),W(0!==I||0!==T),G(g,!1),q(),p&&e.translate(-f.x,-f.y),c.drawElementText(e,t,null,s),l&&c.drawNodeOverlay(e,t,f,n,i),r&&e.translate(o.x1,o.y1)}};var sB=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,r,n,i,a){if(r.visible()){var o=r.pstyle("".concat(e,"-padding")).pfValue,s=r.pstyle("".concat(e,"-opacity")).value,l=r.pstyle("".concat(e,"-color")).value,u=r.pstyle("".concat(e,"-shape")).value;if(s>0){if(n=n||r.position(),null==i||null==a){var c=r.padding();i=r.width()+2*c,a=r.height()+2*c}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,n.x,n.y,i+2*o,a+2*o),t.fill()}}}};sP.drawNodeOverlay=sB("overlay"),sP.drawNodeUnderlay=sB("underlay"),sP.hasPie=function(e){return(e=e[0])._private.hasPie},sP.drawPie=function(e,t,r,n){t=t[0],n=n||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=n.x,s=n.y,l=Math.min(t.width(),t.height())/2,u=0;this.usePaths()&&(o=0,s=0),"%"===a.units?l*=a.pfValue:void 0!==a.pfValue&&(l=a.pfValue/2);for(var c=1;c<=i.pieBackgroundN;c++){var h=t.pstyle("pie-"+c+"-background-size").value,d=t.pstyle("pie-"+c+"-background-color").value,f=t.pstyle("pie-"+c+"-background-opacity").value*r,g=h/100;g+u>1&&(g=1-u);var p=1.5*Math.PI+2*Math.PI*u,v=p+2*Math.PI*g;0===h||u>=1||u+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,l,p,v),e.closePath(),this.colorFillStyle(e,d[0],d[1],d[2],f),e.fill(),u+=g)}};var sL={};sL.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},sL.paintCache=function(e){for(var t,r=this.paintCaches=this.paintCaches||[],n=!0,i=0;i<r.length;i++)if((t=r[i]).context===e){n=!1;break}return n&&(t={context:e},r.push(t)),t},sL.createGradientStyleFor=function(e,t,r,n,i){var a,o=this.usePaths(),s=r.pstyle(t+"-gradient-stop-colors").value,l=r.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===n)if(r.isEdge()){var u=r.sourceEndpoint(),c=r.targetEndpoint(),h=r.midpoint(),d=tL(u,h),f=tL(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(d,f))}else{var g=o?{x:0,y:0}:r.position(),p=r.paddedWidth(),v=r.paddedHeight();a=e.createRadialGradient(g.x,g.y,0,g.x,g.y,Math.max(p,v))}else if(r.isEdge()){var y=r.sourceEndpoint(),w=r.targetEndpoint();a=e.createLinearGradient(y.x,y.y,w.x,w.y)}else{var E=o?{x:0,y:0}:r.position(),b=r.paddedWidth(),A=r.paddedHeight(),C=b/2,_=A/2;switch(r.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(E.x,E.y-_,E.x,E.y+_);break;case"to-top":a=e.createLinearGradient(E.x,E.y+_,E.x,E.y-_);break;case"to-left":a=e.createLinearGradient(E.x+C,E.y,E.x-C,E.y);break;case"to-right":a=e.createLinearGradient(E.x-C,E.y,E.x+C,E.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(E.x-C,E.y-_,E.x+C,E.y+_);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(E.x-C,E.y+_,E.x+C,E.y-_);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(E.x+C,E.y-_,E.x-C,E.y+_);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(E.x+C,E.y+_,E.x-C,E.y-_)}}if(!a)return null;for(var S=l.length===s.length,I=s.length,T=0;T<I;T++)a.addColorStop(S?l[T]:T/(I-1),"rgba("+s[T][0]+","+s[T][1]+","+s[T][2]+","+i+")");return a},sL.gradientFillStyle=function(e,t,r,n){var i=this.createGradientStyleFor(e,"background",t,r,n);if(!i)return null;e.fillStyle=i},sL.colorFillStyle=function(e,t,r,n,i){e.fillStyle="rgba("+t+","+r+","+n+","+i+")"},sL.eleFillStyle=function(e,t,r){var n=t.pstyle("background-fill").value;if("linear-gradient"===n||"radial-gradient"===n)this.gradientFillStyle(e,t,n,r);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],r)}},sL.gradientStrokeStyle=function(e,t,r,n){var i=this.createGradientStyleFor(e,"line",t,r,n);if(!i)return null;e.strokeStyle=i},sL.colorStrokeStyle=function(e,t,r,n,i){e.strokeStyle="rgba("+t+","+r+","+n+","+i+")"},sL.eleStrokeStyle=function(e,t,r){var n=t.pstyle("line-fill").value;if("linear-gradient"===n||"radial-gradient"===n)this.gradientStrokeStyle(e,t,n,r);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],r)}},sL.matchCanvasSize=function(e){var t,r=this.data,n=this.findContainerClientCoords(),i=n[2],a=n[3],o=this.getPixelRatio(),s=this.motionBlurPxRatio;(e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_NODE]||e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var l=i*o,u=a*o;if(l!==this.canvasWidth||u!==this.canvasHeight){this.fontCaches=null;var c=r.canvasContainer;c.style.width=i+"px",c.style.height=a+"px";for(var h=0;h<this.CANVAS_LAYERS;h++)(t=r.canvases[h]).width=l,t.height=u,t.style.width=i+"px",t.style.height=a+"px";for(var h=0;h<this.BUFFER_COUNT;h++)(t=r.bufferCanvases[h]).width=l,t.height=u,t.style.width=i+"px",t.style.height=a+"px";this.textureMult=1,o<=1&&(t=r.bufferCanvases[this.TEXTURE_BUFFER],this.textureMult=2,t.width=l*this.textureMult,t.height=u*this.textureMult),this.canvasWidth=l,this.canvasHeight=u}},sL.renderTo=function(e,t,r,n){this.render({forcedContext:e,forcedZoom:t,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})},sL.render=function(e){var t=(e=e||ti()).forcedContext,r=e.drawAllLayers,n=e.drawOnlyNodeLayer,i=e.forcedZoom,a=e.forcedPan,o=this,s=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,l=o.cy,u=o.data,c=u.canvasNeedsRedraw,h=o.textureOnViewport&&!t&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),d=void 0!==e.motionBlur?e.motionBlur:o.motionBlur,f=o.motionBlurPxRatio,g=l.hasCompoundNodes(),p=o.hoverData.draggingEles,v=!!o.hoverData.selecting||!!o.touchData.selecting,y=d=d&&!t&&o.motionBlurEnabled&&!v;t||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!t&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),d&&(null==o.mbFrames&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(y=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!h&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var w=l.style(),E=l.zoom(),b=void 0!==i?i:E,A=l.pan(),C={x:A.x,y:A.y},_={zoom:E,pan:{x:A.x,y:A.y}},S=o.prevViewport;void 0===S||_.zoom!==S.zoom||_.pan.x!==S.pan.x||_.pan.y!==S.pan.y||p&&!g||(o.motionBlurPxRatio=1),a&&(C=a),b*=s,C.x*=s,C.y*=s;var I=o.getCachedZSortedEles();function T(e,t,r,n,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,r,n,i),e.globalCompositeOperation=a}function x(e,n){var s,l,c,h;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=C,l=b,c=o.canvasWidth,h=o.canvasHeight):(s={x:A.x*f,y:A.y*f},l=E*f,c=o.canvasWidth*f,h=o.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?T(e,0,0,c,h):!t&&(void 0===n||n)&&e.clearRect(0,0,c,h),r||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(h||(o.textureDrawLastFrame=!1),h){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var D=o.data.bufferContexts[o.TEXTURE_BUFFER];D.setTransform(1,0,0,1,0,0),D.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:D,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult});var _=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight};_.mpan={x:(0-_.pan.x)/_.zoom,y:(0-_.pan.y)/_.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var N=u.contexts[o.NODE],M=o.textureCache.texture,_=o.textureCache.viewport;N.setTransform(1,0,0,1,0,0),d?T(N,0,0,_.width,_.height):N.clearRect(0,0,_.width,_.height);var R=w.core("outside-texture-bg-color").value,O=w.core("outside-texture-bg-opacity").value;o.colorFillStyle(N,R[0],R[1],R[2],O),N.fillRect(0,0,_.width,_.height);var E=l.zoom();x(N,!1),N.clearRect(_.mpan.x,_.mpan.y,_.width/_.zoom/s,_.height/_.zoom/s),N.drawImage(M,_.mpan.x,_.mpan.y,_.width/_.zoom/s,_.height/_.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var P=l.extent(),B=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),L=o.hideEdgesOnViewport&&B,k=[];if(k[o.NODE]=!c[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,k[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),k[o.DRAG]=!c[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,k[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||r||n||k[o.NODE]){var F=d&&!k[o.NODE]&&1!==f,N=t||(F?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]);x(N,d&&!F?"motionBlur":void 0),L?o.drawCachedNodes(N,I.nondrag,s,P):o.drawLayeredElements(N,I.nondrag,s,P),o.debug&&o.drawDebugPoints(N,I.nondrag),r||d||(c[o.NODE]=!1)}if(!n&&(c[o.DRAG]||r||k[o.DRAG])){var F=d&&!k[o.DRAG]&&1!==f,N=t||(F?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]);x(N,d&&!F?"motionBlur":void 0),L?o.drawCachedNodes(N,I.drag,s,P):o.drawCachedElements(N,I.drag,s,P),o.debug&&o.drawDebugPoints(N,I.drag),r||d||(c[o.DRAG]=!1)}if(o.showFps||!n&&c[o.SELECT_BOX]&&!r){var N=t||u.contexts[o.SELECT_BOX];if(x(N),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){var E=o.cy.zoom(),z=w.core("selection-box-border-width").value/E;N.lineWidth=z,N.fillStyle="rgba("+w.core("selection-box-color").value[0]+","+w.core("selection-box-color").value[1]+","+w.core("selection-box-color").value[2]+","+w.core("selection-box-opacity").value+")",N.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),z>0&&(N.strokeStyle="rgba("+w.core("selection-box-border-color").value[0]+","+w.core("selection-box-border-color").value[1]+","+w.core("selection-box-border-color").value[2]+","+w.core("selection-box-opacity").value+")",N.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){var E=o.cy.zoom(),U=u.bgActivePosistion;N.fillStyle="rgba("+w.core("active-bg-color").value[0]+","+w.core("active-bg-color").value[1]+","+w.core("active-bg-color").value[2]+","+w.core("active-bg-opacity").value+")",N.beginPath(),N.arc(U.x,U.y,w.core("active-bg-size").pfValue/E,0,2*Math.PI),N.fill()}var V=o.lastRedrawTime;if(o.showFps&&V){var H=Math.round(1e3/(V=Math.round(V)));N.setTransform(1,0,0,1,0,0),N.fillStyle="rgba(255, 0, 0, 0.75)",N.strokeStyle="rgba(255, 0, 0, 0.75)",N.lineWidth=1,N.fillText("1 frame = "+V+" ms = "+H+" fps",0,20),N.strokeRect(0,30,250,20),N.fillRect(0,30,250*Math.min(H/60,1),20)}r||(c[o.SELECT_BOX]=!1)}if(d&&1!==f){var j=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],G=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],W=function(e,t,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):T(e,0,0,o.canvasWidth,o.canvasHeight),e.drawImage(t,0,0,o.canvasWidth*f,o.canvasHeight*f,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||k[o.NODE])&&(W(j,Y,k[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||k[o.DRAG])&&(W(X,G,k[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=_,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!h,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()},100)),t||l.emit("render")};var sk={};sk.drawPolygonPath=function(e,t,r,n,i,a){var o=n/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],r+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],r+s*a[2*l+1]);e.closePath()},sk.drawRoundPolygonPath=function(e,t,r,n,i,a){var o=n/2,s=i/2,l=rf(n,i);e.beginPath&&e.beginPath();for(var u=0;u<a.length/4;u++){var c=void 0,h=void 0;c=0===u?a.length-2:4*u-2,h=4*u+2;var d=t+o*a[4*u],f=r+s*a[4*u+1],g=l/Math.tan(Math.acos(-a[c]*a[h]-a[c+1]*a[h+1])/2),p=d-g*a[c],v=f-g*a[c+1],y=d+g*a[h],w=f+g*a[h+1];0===u?e.moveTo(p,v):e.lineTo(p,v),e.arcTo(d,f,y,w,l)}e.closePath()},sk.drawRoundRectanglePath=function(e,t,r,n,i){var a=n/2,o=i/2,s=rd(n,i);e.beginPath&&e.beginPath(),e.moveTo(t,r-o),e.arcTo(t+a,r-o,t+a,r,s),e.arcTo(t+a,r+o,t,r+o,s),e.arcTo(t-a,r+o,t-a,r,s),e.arcTo(t-a,r-o,t,r-o,s),e.lineTo(t,r-o),e.closePath()},sk.drawBottomRoundRectanglePath=function(e,t,r,n,i){var a=n/2,o=i/2,s=rd(n,i);e.beginPath&&e.beginPath(),e.moveTo(t,r-o),e.lineTo(t+a,r-o),e.lineTo(t+a,r),e.arcTo(t+a,r+o,t,r+o,s),e.arcTo(t-a,r+o,t-a,r,s),e.lineTo(t-a,r-o),e.lineTo(t,r-o),e.closePath()},sk.drawCutRectanglePath=function(e,t,r,n,i){var a=n/2,o=i/2,s=rg();e.beginPath&&e.beginPath(),e.moveTo(t-a+s,r-o),e.lineTo(t+a-s,r-o),e.lineTo(t+a,r-o+s),e.lineTo(t+a,r+o-s),e.lineTo(t+a-s,r+o),e.lineTo(t-a+s,r+o),e.lineTo(t-a,r+o-s),e.lineTo(t-a,r-o+s),e.closePath()},sk.drawBarrelPath=function(e,t,r,n,i){var a=n/2,o=i/2,s=t-a,l=t+a,u=r-o,c=r+o,h=rp(n,i),d=h.widthOffset,f=h.heightOffset,g=h.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(s,u+f),e.lineTo(s,c-f),e.quadraticCurveTo(s+g,c,s+d,c),e.lineTo(l-d,c),e.quadraticCurveTo(l-g,c,l,c-f),e.lineTo(l,u+f),e.quadraticCurveTo(l-g,u,l-d,u),e.lineTo(s+d,u),e.quadraticCurveTo(s+g,u,s,u+f),e.closePath()};for(var sF={},sz={},sU=Math.PI/40,sV=0*Math.PI;sV<2*Math.PI;sV+=sU)sF[sV]=Math.sin(sV),sz[sV]=Math.cos(sV);sk.drawEllipsePath=function(e,t,r,n,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,r,n/2,i/2,0,0,2*Math.PI);else for(var a,o,s=n/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=sU)a=t-s*sF[u]*0+s*sz[u]*1,o=r+l*sz[u]*0+l*sF[u]*1,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var sH={};function sj(e){var t=e.indexOf(",");return e.substr(t+1)}function sY(e,t,r){var n=function(){return t.toDataURL(r,e.quality)};switch(e.output){case"blob-promise":return new nE(function(n,i){try{t.toBlob(function(e){null!=e?n(e):i(Error("`canvas.toBlob()` sent a null value in its callback"))},r,e.quality)}catch(e){i(e)}});case"blob":return function(e,t){for(var r=atob(e),n=new ArrayBuffer(r.length),i=new Uint8Array(n),a=0;a<r.length;a++)i[a]=r.charCodeAt(a);return new Blob([n],{type:t})}(sj(n()),r);case"base64":return sj(n());default:return n()}}sH.createBuffer=function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,[r,r.getContext("2d")]},sH.bufferCanvasImage=function(e){var t=this.cy,r=t.mutableElements().boundingBox(),n=this.findContainerClientCoords(),i=e.full?Math.ceil(r.w):n[2],a=e.full?Math.ceil(r.h):n[3],o=U(e.maxWidth)||U(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;U(e.maxWidth)&&(u=l*e.maxWidth/i),U(e.maxHeight)&&(c=l*e.maxHeight/a),i*=l=Math.min(u,c),a*=l}o||(i*=s,a*=s,l*=s);var h=document.createElement("canvas");h.width=i,h.height=a,h.style.width=i+"px",h.style.height=a+"px";var d=h.getContext("2d");if(i>0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)d.translate(-r.x1*l,-r.y1*l),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(r.x1*l,r.y1*l);else{var g=t.pan(),p={x:g.x*l,y:g.y*l};l*=t.zoom(),d.translate(p.x,p.y),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(-p.x,-p.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},sH.png=function(e){return sY(e,this.bufferCanvasImage(e),"image/png")},sH.jpg=function(e){return sY(e,this.bufferCanvasImage(e),"image/jpeg")};var sX={};sX.nodeShapeImpl=function(e,t,r,n,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,r,n,i,a);case"polygon":return this.drawPolygonPath(t,r,n,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,r,n,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,r,n,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,r,n,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,r,n,i,a);case"barrel":return this.drawBarrelPath(t,r,n,i,a)}};var sG=sW.prototype;function sW(e){var t=this;t.data={canvases:Array(sG.CANVAS_LAYERS),contexts:Array(sG.CANVAS_LAYERS),canvasNeedsRedraw:Array(sG.CANVAS_LAYERS),bufferCanvases:Array(sG.BUFFER_COUNT),bufferContexts:Array(sG.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",n="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=n,i.position="relative",i.zIndex="0",i.overflow="hidden";var a=e.cy.container();a.appendChild(t.data.canvasContainer),a.style[r]=n;var o={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};N&&N.userAgent.match(/msie|trident|edge/i)&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var s=0;s<sG.CANVAS_LAYERS;s++){var l=t.data.canvases[s]=document.createElement("canvas");t.data.contexts[s]=l.getContext("2d"),Object.keys(o).forEach(function(e){l.style[e]=o[e]}),l.style.position="absolute",l.setAttribute("data-id","layer"+s),l.style.zIndex=String(sG.CANVAS_LAYERS-s),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[s]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[sG.NODE].setAttribute("data-id","layer"+sG.NODE+"-node"),t.data.canvases[sG.SELECT_BOX].setAttribute("data-id","layer"+sG.SELECT_BOX+"-selectbox"),t.data.canvases[sG.DRAG].setAttribute("data-id","layer"+sG.DRAG+"-drag");for(var s=0;s<sG.BUFFER_COUNT;s++)t.data.bufferCanvases[s]=document.createElement("canvas"),t.data.bufferContexts[s]=t.data.bufferCanvases[s].getContext("2d"),t.data.bufferCanvases[s].style.position="absolute",t.data.bufferCanvases[s].setAttribute("data-id","buffer"+s),t.data.bufferCanvases[s].style.zIndex=String(-s-1),t.data.bufferCanvases[s].style.visibility="hidden";t.pathsEnabled=!0;var u=tj(),c=function(e){return{x:-e.w/2,y:-e.h/2}},h=function(e){return e.boundingBox(),e[0]._private.bodyBounds},d=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||u},f=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||u},g=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||u},p=function(e,t){return t},v=function(e,t,r){var n=e?e+"-":"";return{x:t.x+r.pstyle(n+"text-margin-x").pfValue,y:t.y+r.pstyle(n+"text-margin-y").pfValue}},y=function(e,t,r){var n=e[0]._private.rscratch;return{x:n[t],y:n[r]}},w=t.data.eleTxrCache=new sd(t,{getKey:function(e){return e[0]._private.nodeKey},doesEleInvalidateKey:function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},drawElement:function(e,r,n,i,a){return t.drawElement(e,r,n,!1,!1,a)},getBoundingBox:h,getRotationPoint:function(e){var t;return{x:((t=h(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2}},getRotationOffset:function(e){return c(h(e))},allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),E=t.data.lblTxrCache=new sd(t,{getKey:function(e){return e[0]._private.labelStyleKey},drawElement:function(e,r,n,i,a){return t.drawElementText(e,r,n,i,"main",a)},getBoundingBox:d,getRotationPoint:function(e){return v("",y(e,"labelX","labelY"),e)},getRotationOffset:function(e){var t=d(e),r=c(d(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":r.x=-t.w;break;case"right":r.x=0}switch(e.pstyle("text-valign").value){case"top":r.y=-t.h;break;case"bottom":r.y=0}}return r},isVisible:p}),b=t.data.slbTxrCache=new sd(t,{getKey:function(e){return e[0]._private.sourceLabelStyleKey},drawElement:function(e,r,n,i,a){return t.drawElementText(e,r,n,i,"source",a)},getBoundingBox:f,getRotationPoint:function(e){return v("source",y(e,"sourceLabelX","sourceLabelY"),e)},getRotationOffset:function(e){return c(f(e))},isVisible:p}),A=t.data.tlbTxrCache=new sd(t,{getKey:function(e){return e[0]._private.targetLabelStyleKey},drawElement:function(e,r,n,i,a){return t.drawElementText(e,r,n,i,"target",a)},getBoundingBox:g,getRotationPoint:function(e){return v("target",y(e,"targetLabelX","targetLabelY"),e)},getRotationOffset:function(e){return c(g(e))},isVisible:p}),C=t.data.lyrTxrCache=new sg(t);t.onUpdateEleCalcs(function(e,t){w.invalidateElements(t),E.invalidateElements(t),b.invalidateElements(t),A.invalidateElements(t),C.invalidateElements(t);for(var r=0;r<t.length;r++){var n=t[r]._private;n.oldBackgroundTimestamp=n.backgroundTimestamp}});var _=function(e){for(var t=0;t<e.length;t++)C.enqueueElementRefinement(e[t].ele)};w.onDequeue(_),E.onDequeue(_),b.onDequeue(_),A.onDequeue(_)}sG.CANVAS_LAYERS=3,sG.SELECT_BOX=0,sG.DRAG=1,sG.NODE=2,sG.BUFFER_COUNT=3,sG.TEXTURE_BUFFER=0,sG.MOTIONBLUR_BUFFER_NODE=1,sG.MOTIONBLUR_BUFFER_DRAG=2,sG.redrawHint=function(e,t){switch(e){case"eles":this.data.canvasNeedsRedraw[sG.NODE]=t;break;case"drag":this.data.canvasNeedsRedraw[sG.DRAG]=t;break;case"select":this.data.canvasNeedsRedraw[sG.SELECT_BOX]=t}};var sq="u">typeof Path2D;sG.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},sG.usePaths=function(){return sq&&this.pathsEnabled},sG.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},sG.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},sG.makeOffscreenCanvas=function(t,r){var n;return("u"<typeof OffscreenCanvas?"undefined":e(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(t,r):((n=document.createElement("canvas")).width=t,n.height=r),n},[sv,sC,sN,sR,sO,sP,sL,sk,sH,sX].forEach(function(e){eo(sG,e)});var sZ=[{name:"null",impl:oX},{name:"base",impl:sa},{name:"canvas",impl:sW}],sQ={},sK={};function s$(e,t,r){var n=r,i=function(r){te("Can not register `"+t+"` for `"+e+"` since `"+r+"` already exists in the prototype and can not be overridden")};if("core"===e)if(oi.prototype[t])return i(t);else oi.prototype[t]=r;else if("collection"===e)if(ak.prototype[t])return i(t);else ak.prototype[t]=r;else if("layout"===e){for(var a=function(e){this.options=e,r.call(this,e),z(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(r.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=r.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var r=0;r<t.length;r++)t[r].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};eo(o,{createEmitter:function(){return this._private.emitter=new as(d,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),ih.eventAliasesOn(o),n=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=sJ("renderer","base"),g=f.prototype,p=r.prototype,v=function(){f.apply(this,arguments),r.apply(this,arguments)},y=v.prototype;for(var w in g){var E=g[w];if(null!=p[w])return i(w);y[w]=E}for(var b in p)y[b]=p[b];g.clientFunctions.forEach(function(e){y[e]=y[e]||function(){e7("Renderer does not implement `renderer."+e+"()` on its prototype")}}),n=v}else if("__proto__"===e||"constructor"===e||"prototype"===e)return e7(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return eh({map:sQ,keys:[e,t],value:n})}function sJ(e,t){return ed({map:sQ,keys:[e,t]})}function s1(e,t,r,n,i){return eh({map:sK,keys:[e,t,r,n],value:i})}function s0(e,t,r,n){return ed({map:sK,keys:[e,t,r,n]})}var s2=function(){return 2==arguments.length?sJ.apply(null,arguments):3==arguments.length?s$.apply(null,arguments):4==arguments.length?s0.apply(null,arguments):5==arguments.length?s1.apply(null,arguments):void e7("Invalid extension access syntax")};oi.prototype.extension=s2,[{type:"layout",extensions:oY},{type:"renderer",extensions:sZ}].forEach(function(e){e.extensions.forEach(function(t){s$(e.type,t.name,t.impl)})});var s3=function e(){if(!(this instanceof e))return new e;this.length=0},s4=s3.prototype;s4.instanceString=function(){return"stylesheet"},s4.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},s4.css=function(e,t){var r=this.length-1;if(L(e))this[r].properties.push({name:e,value:t});else if(z(e))for(var n=Object.keys(e),i=0;i<n.length;i++){var a=n[i],o=e[a];if(null!=o){var s=oe.properties[a]||oe.properties[K(a)];if(null!=s){var l=s.name;this[r].properties.push({name:l,value:o})}}}return this},s4.style=s4.css,s4.generateStyle=function(e){var t=new oe(e);return this.appendToStyle(t)},s4.appendToStyle=function(e){for(var t=0;t<this.length;t++){var r=this[t],n=r.selector,i=r.properties;e.selector(n);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var s8=function(e){return(void 0===e&&(e={}),z(e))?new oi(e):L(e)?s2.apply(s2,arguments):void 0};return s8.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(s8),e.apply(null,t),this},s8.warnings=function(e){return e9(e)},s8.version="3.28.0",s8.stylesheet=s8.Stylesheet=s3,s8}()},38362(e,t,r){var n=r(31166);e.exports={Graph:n.Graph,json:r(57494),alg:r(31667),version:n.version}},33619(e,t,r){var n=r(10117);e.exports=function(e){var t,r={},i=[];return n.each(e.nodes(),function(a){t=[],function i(a){n.has(r,a)||(r[a]=!0,t.push(a),n.each(e.successors(a),i),n.each(e.predecessors(a),i))}(a),t.length&&i.push(t)}),i}},29276(e,t,r){var n=r(10117);e.exports=function(e,t,r){n.isArray(t)||(t=[t]);var i=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],o={};return n.each(t,function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);!function e(t,r,i,a,o,s){!n.has(a,r)&&(a[r]=!0,i||s.push(r),n.each(o(r),function(r){e(t,r,i,a,o,s)}),i&&s.push(r))}(e,t,"post"===r,o,i,a)}),a}},34919(e,t,r){var n=r(28905),i=r(10117);e.exports=function(e,t,r){return i.transform(e.nodes(),function(i,a){i[a]=n(e,a,t,r)},{})}},28905(e,t,r){var n=r(10117),i=r(71737);e.exports=function(e,t,r,n){return function(e,t,r,n){var a,o,s={},l=new i,u=function(e){var t=e.v!==a?e.v:e.w,n=s[t],i=r(e),u=o.distance+i;if(i<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+i);u<n.distance&&(n.distance=u,n.predecessor=a,l.decrease(t,u))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;s[e]={distance:r},l.add(e,r)});l.size()>0&&(o=s[a=l.removeMin()]).distance!==1/0;)n(a).forEach(u);return s}(e,String(t),r||a,n||function(t){return e.outEdges(t)})};var a=n.constant(1)},16678(e,t,r){var n=r(10117),i=r(16291);e.exports=function(e){return n.filter(i(e),function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}},73590(e,t,r){var n=r(10117);e.exports=function(e,t,r){var n,a,o,s,l;return n=e,a=t||i,o=r||function(t){return e.outEdges(t)},s={},(l=n.nodes()).forEach(function(e){s[e]={},s[e][e]={distance:0},l.forEach(function(t){e!==t&&(s[e][t]={distance:1/0})}),o(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);s[e][r]={distance:n,predecessor:e}})}),l.forEach(function(e){var t=s[e];l.forEach(function(r){var n=s[r];l.forEach(function(r){var i=n[e],a=t[r],o=n[r],s=i.distance+a.distance;s<o.distance&&(o.distance=s,o.predecessor=a.predecessor)})})}),s};var i=n.constant(1)},31667(e,t,r){e.exports={components:r(33619),dijkstra:r(28905),dijkstraAll:r(34919),findCycles:r(16678),floydWarshall:r(73590),isAcyclic:r(60498),postorder:r(31045),preorder:r(46016),prim:r(24423),tarjan:r(16291),topsort:r(29888)}},60498(e,t,r){var n=r(29888);e.exports=function(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}},31045(e,t,r){var n=r(29276);e.exports=function(e,t){return n(e,t,"post")}},46016(e,t,r){var n=r(29276);e.exports=function(e,t){return n(e,t,"pre")}},24423(e,t,r){var n=r(10117),i=r(66454),a=r(71737);e.exports=function(e,t){var r,o=new i,s={},l=new a;function u(e){var n=e.v===r?e.w:e.v,i=l.priority(n);if(void 0!==i){var a=t(e);a<i&&(s[n]=r,l.decrease(n,a))}}if(0===e.nodeCount())return o;n.each(e.nodes(),function(e){l.add(e,1/0),o.setNode(e)}),l.decrease(e.nodes()[0],0);for(var c=!1;l.size()>0;){if(r=l.removeMin(),n.has(s,r))o.setEdge(r,s[r]);else if(c)throw Error("Input graph is not connected: "+e);else c=!0;e.nodeEdges(r).forEach(u)}return o}},16291(e,t,r){var n=r(10117);e.exports=function(e){var t=0,r=[],i={},a=[];return e.nodes().forEach(function(o){n.has(i,o)||function o(s){var l=i[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),e.successors(s).forEach(function(e){n.has(i,e)?i[e].onStack&&(l.lowlink=Math.min(l.lowlink,i[e].index)):(o(e),l.lowlink=Math.min(l.lowlink,i[e].lowlink))}),l.lowlink===l.index){var u,c=[];do i[u=r.pop()].onStack=!1,c.push(u);while(s!==u);a.push(c)}}(o)}),a}},29888(e,t,r){var n=r(10117);function i(e){var t={},r={},i=[];if(n.each(e.sinks(),function o(s){if(n.has(r,s))throw new a;n.has(t,s)||(r[s]=!0,t[s]=!0,n.each(e.predecessors(s),o),delete r[s],i.push(s))}),n.size(t)!==e.nodeCount())throw new a;return i}function a(){}e.exports=i,i.CycleException=a,a.prototype=Error()},71737(e,t,r){var n=r(10117);function i(){this._arr=[],this._keyIndices={}}e.exports=i,i.prototype.size=function(){return this._arr.length},i.prototype.keys=function(){return this._arr.map(function(e){return e.key})},i.prototype.has=function(e){return n.has(this._keyIndices,e)},i.prototype.priority=function(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority},i.prototype.min=function(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key},i.prototype.add=function(e,t){var r=this._keyIndices;if(e=String(e),!n.has(r,e)){var i=this._arr,a=i.length;return r[e]=a,i.push({key:e,priority:t}),this._decrease(a),!0}return!1},i.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},i.prototype.decrease=function(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)},i.prototype._heapify=function(e){var t=this._arr,r=2*e,n=r+1,i=e;r<t.length&&(i=t[r].priority<t[i].priority?r:i,n<t.length&&(i=t[n].priority<t[i].priority?n:i),i!==e&&(this._swap(e,i),this._heapify(i)))},i.prototype._decrease=function(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t},i.prototype._swap=function(e,t){var r=this._arr,n=this._keyIndices,i=r[e],a=r[t];r[e]=a,r[t]=i,n[a.key]=e,n[i.key]=t}},66454(e,t,r){"use strict";var n=r(10117);function i(e){this._isDirected=!n.has(e,"directed")||e.directed,this._isMultigraph=!!n.has(e,"multigraph")&&e.multigraph,this._isCompound=!!n.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function a(e,t){e[t]?e[t]++:e[t]=1}function o(e,t){--e[t]||delete e[t]}function s(e,t,r,i){var a=""+t,o=""+r;if(!e&&a>o){var s=a;a=o,o=s}return a+"\x01"+o+"\x01"+(n.isUndefined(i)?"\0":i)}function l(e,t){return s(e,t.v,t.w,t.name)}e.exports=i,i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(e){return this._label=e,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(e){return n.isFunction(e)||(e=n.constant(e)),this._defaultNodeLabelFn=e,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var e=this;return n.filter(this.nodes(),function(t){return n.isEmpty(e._in[t])})},i.prototype.sinks=function(){var e=this;return n.filter(this.nodes(),function(t){return n.isEmpty(e._out[t])})},i.prototype.setNodes=function(e,t){var r=arguments,i=this;return n.each(e,function(e){r.length>1?i.setNode(e,t):i.setNode(e)}),this},i.prototype.setNode=function(e,t){return n.has(this._nodes,e)?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this},i.prototype.node=function(e){return this._nodes[e]},i.prototype.hasNode=function(e){return n.has(this._nodes,e)},i.prototype.removeNode=function(e){var t=this;if(n.has(this._nodes,e)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],n.each(this.children(e),function(e){t.setParent(e)}),delete this._children[e]),n.each(n.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],n.each(n.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},i.prototype.setParent=function(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(n.isUndefined(t))t="\0";else{t+="";for(var r=t;!n.isUndefined(r);r=this.parent(r))if(r===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},i.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},i.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}},i.prototype.children=function(e){if(n.isUndefined(e)&&(e="\0"),this._isCompound){var t=this._children[e];if(t)return n.keys(t)}else if("\0"===e)return this.nodes();else if(this.hasNode(e))return[]},i.prototype.predecessors=function(e){var t=this._preds[e];if(t)return n.keys(t)},i.prototype.successors=function(e){var t=this._sucs[e];if(t)return n.keys(t)},i.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return n.union(t,this.successors(e))},i.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},i.prototype.filterNodes=function(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;n.each(this._nodes,function(r,n){e(n)&&t.setNode(n,r)}),n.each(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var i={};return this._isCompound&&n.each(t.nodes(),function(e){t.setParent(e,function e(n){var a=r.parent(n);return void 0===a||t.hasNode(a)?(i[n]=a,a):a in i?i[a]:e(a)}(e))}),t},i.prototype.setDefaultEdgeLabel=function(e){return n.isFunction(e)||(e=n.constant(e)),this._defaultEdgeLabelFn=e,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(e,t){var r=this,i=arguments;return n.reduce(e,function(e,n){return i.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n}),this},i.prototype.setEdge=function(){var e,t,r,i,o=!1,l=arguments[0];"object"==typeof l&&null!==l&&"v"in l?(e=l.v,t=l.w,r=l.name,2==arguments.length&&(i=arguments[1],o=!0)):(e=l,t=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),e=""+e,t=""+t,n.isUndefined(r)||(r=""+r);var u=s(this._isDirected,e,t,r);if(n.has(this._edgeLabels,u))return o&&(this._edgeLabels[u]=i),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[u]=o?i:this._defaultEdgeLabelFn(e,t,r);var c=function(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return n&&(s.name=n),s}(this._isDirected,e,t,r);return e=c.v,t=c.w,Object.freeze(c),this._edgeObjs[u]=c,a(this._preds[t],e),a(this._sucs[e],t),this._in[t][u]=c,this._out[e][u]=c,this._edgeCount++,this},i.prototype.edge=function(e,t,r){var n=1==arguments.length?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,r);return this._edgeLabels[n]},i.prototype.hasEdge=function(e,t,r){var i=1==arguments.length?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,r);return n.has(this._edgeLabels,i)},i.prototype.removeEdge=function(e,t,r){var n=1==arguments.length?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,r),i=this._edgeObjs[n];return i&&(e=i.v,t=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],o(this._preds[t],e),o(this._sucs[e],t),delete this._in[t][n],delete this._out[e][n],this._edgeCount--),this},i.prototype.inEdges=function(e,t){var r=this._in[e];if(r){var i=n.values(r);return t?n.filter(i,function(e){return e.v===t}):i}},i.prototype.outEdges=function(e,t){var r=this._out[e];if(r){var i=n.values(r);return t?n.filter(i,function(e){return e.w===t}):i}},i.prototype.nodeEdges=function(e,t){var r=this.inEdges(e,t);if(r)return r.concat(this.outEdges(e,t))}},31166(e,t,r){e.exports={Graph:r(66454),version:r(44458)}},57494(e,t,r){var n=r(10117),i=r(66454);e.exports={write:function(e){var t,r,i={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e,n.map(t.nodes(),function(e){var r=t.node(e),i=t.parent(e),a={v:e};return n.isUndefined(r)||(a.value=r),n.isUndefined(i)||(a.parent=i),a})),edges:(r=e,n.map(r.edges(),function(e){var t=r.edge(e),i={v:e.v,w:e.w};return n.isUndefined(e.name)||(i.name=e.name),n.isUndefined(t)||(i.value=t),i}))};return n.isUndefined(e.graph())||(i.value=n.clone(e.graph())),i},read:function(e){var t=new i(e.options).setGraph(e.value);return n.each(e.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),n.each(e.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}},10117(e,t,r){var n;try{n={clone:r(32629),constant:r(37334),each:r(76135),filter:r(87612),has:r(61448),isArray:r(56449),isEmpty:r(62193),isFunction:r(1882),isUndefined:r(62216),keys:r(95950),map:r(55378),reduce:r(18479),size:r(47091),transform:r(69752),union:r(80299),values:r(35880)}}catch(e){}n||(n=window._),e.exports=n},44458(e){e.exports="2.1.8"},3013(e,t,r){"use strict";r.d(t,{Jl:()=>h,j9:()=>er,Qq:()=>p}),(c=h||(h={}))[c.QR_CODE=0]="QR_CODE",c[c.AZTEC=1]="AZTEC",c[c.CODABAR=2]="CODABAR",c[c.CODE_39=3]="CODE_39",c[c.CODE_93=4]="CODE_93",c[c.CODE_128=5]="CODE_128",c[c.DATA_MATRIX=6]="DATA_MATRIX",c[c.MAXICODE=7]="MAXICODE",c[c.ITF=8]="ITF",c[c.EAN_13=9]="EAN_13",c[c.EAN_8=10]="EAN_8",c[c.PDF_417=11]="PDF_417",c[c.RSS_14=12]="RSS_14",c[c.RSS_EXPANDED=13]="RSS_EXPANDED",c[c.UPC_A=14]="UPC_A",c[c.UPC_E=15]="UPC_E",c[c.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION";var n,i,a,o,s,l,u,c,h,d,f,g,p,v,y=new Map([[h.QR_CODE,"QR_CODE"],[h.AZTEC,"AZTEC"],[h.CODABAR,"CODABAR"],[h.CODE_39,"CODE_39"],[h.CODE_93,"CODE_93"],[h.CODE_128,"CODE_128"],[h.DATA_MATRIX,"DATA_MATRIX"],[h.MAXICODE,"MAXICODE"],[h.ITF,"ITF"],[h.EAN_13,"EAN_13"],[h.EAN_8,"EAN_8"],[h.PDF_417,"PDF_417"],[h.RSS_14,"RSS_14"],[h.RSS_EXPANDED,"RSS_EXPANDED"],[h.UPC_A,"UPC_A"],[h.UPC_E,"UPC_E"],[h.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);(n=d||(d={}))[n.UNKNOWN=0]="UNKNOWN",n[n.URL=1]="URL",(i=f||(f={}))[i.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",i[i.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE";var w=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[f.SCAN_TYPE_CAMERA,f.SCAN_TYPE_FILE],e}(),E=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!y.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,y.get(t))},e}(),b=function(){function e(){}return e.createFromText=function(e){return{decodedText:e,result:{text:e}}},e.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},e}();(a=g||(g={}))[a.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",a[a.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",a[a.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR";var A=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:g.UNKWOWN_ERROR}},e}(),C=function(){function e(e){this.verbose=e}return e.prototype.log=function(e){this.verbose&&console.log(e)},e.prototype.warn=function(e){this.verbose&&console.warn(e)},e.prototype.logError=function(e,t){(this.verbose||!0===t)&&console.error(e)},e.prototype.logErrors=function(e){if(0===e.length)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},e}();function _(e){return null==e}var S=function(){function e(){}return e.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},e.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),I=function(){function e(){}return e.scanningStatus=function(){return"Scanning"},e.idleStatus=function(){return"Idle"},e.errorStatus=function(){return"Error"},e.permissionStatus=function(){return"Permission"},e.noCameraFoundErrorStatus=function(){return"No Cameras"},e.lastMatch=function(e){return"Last Match: ".concat(e)},e.codeScannerTitle=function(){return"Code Scanner"},e.cameraPermissionTitle=function(){return"Request Camera Permissions"},e.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},e.noCameraFound=function(){return"No camera found"},e.scanButtonStopScanningText=function(){return"Stop Scanning"},e.scanButtonStartScanningText=function(){return"Start Scanning"},e.torchOnButton=function(){return"Switch On Torch"},e.torchOffButton=function(){return"Switch Off Torch"},e.torchOnFailedMessage=function(){return"Failed to turn on torch"},e.torchOffFailedMessage=function(){return"Failed to turn off torch"},e.scanButtonScanningStarting=function(){return"Launching Camera..."},e.textIfCameraScanSelected=function(){return"Scan an Image File"},e.textIfFileScanSelected=function(){return"Scan using camera directly"},e.selectCamera=function(){return"Select Camera"},e.fileSelectionChooseImage=function(){return"Choose Image"},e.fileSelectionChooseAnother=function(){return"Choose Another"},e.fileSelectionNoImageSelected=function(){return"No image choosen"},e.anonymousCameraPrefix=function(){return"Anonymous Camera"},e.dragAndDropMessage=function(){return"Or drop an image to scan"},e.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},e.zoom=function(){return"zoom"},e.loadingImage=function(){return"Loading image..."},e.cameraScanAltText=function(){return"Camera based scan"},e.fileScanAltText=function(){return"Fule based scan"},e}(),T=function(){function e(){}return e.poweredBy=function(){return"Powered by "},e.reportIssues=function(){return"Report issues"},e}(),x=function(){function e(){}return e.isMediaStreamConstraintsValid=function(e,t){if("object"!=typeof e){var r=typeof e;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(r,"."),!0),!1}for(var n=new Set(["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"]),i=Object.keys(e),a=0;a<i.length;a++){var o=i[a];if(n.has(o))return t.logError("".concat(o," is not supported videoConstaints."),!0),!1}return!0},e}(),D=r(49255),N=function(){function e(e,t,r){if(this.formatMap=new Map([[h.QR_CODE,D.BarcodeFormat.QR_CODE],[h.AZTEC,D.BarcodeFormat.AZTEC],[h.CODABAR,D.BarcodeFormat.CODABAR],[h.CODE_39,D.BarcodeFormat.CODE_39],[h.CODE_93,D.BarcodeFormat.CODE_93],[h.CODE_128,D.BarcodeFormat.CODE_128],[h.DATA_MATRIX,D.BarcodeFormat.DATA_MATRIX],[h.MAXICODE,D.BarcodeFormat.MAXICODE],[h.ITF,D.BarcodeFormat.ITF],[h.EAN_13,D.BarcodeFormat.EAN_13],[h.EAN_8,D.BarcodeFormat.EAN_8],[h.PDF_417,D.BarcodeFormat.PDF_417],[h.RSS_14,D.BarcodeFormat.RSS_14],[h.RSS_EXPANDED,D.BarcodeFormat.RSS_EXPANDED],[h.UPC_A,D.BarcodeFormat.UPC_A],[h.UPC_E,D.BarcodeFormat.UPC_E],[h.UPC_EAN_EXTENSION,D.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!D)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=r;var n=this.createZXingFormats(e),i=new Map;i.set(D.DecodeHintType.POSSIBLE_FORMATS,n),i.set(D.DecodeHintType.TRY_HARDER,!1),this.hints=i}return e.prototype.decodeAsync=function(e){var t=this;return new Promise(function(r,n){try{r(t.decode(e))}catch(e){n(e)}})},e.prototype.decode=function(e){var t=new D.MultiFormatReader(this.verbose,this.hints),r=new D.HTMLCanvasElementLuminanceSource(e),n=new D.BinaryBitmap(new D.HybridBinarizer(r)),i=t.decode(n);return{text:i.text,format:E.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,r,n){e.set(t,r)}),e},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createZXingFormats=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];this.formatMap.has(n)?t.push(this.formatMap.get(n)):this.logger.logError("".concat(n," is not supported by")+"ZXingHtml5QrcodeShim")}return t},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),M=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},R=function(){function e(t,r,n){if(this.formatMap=new Map([[h.QR_CODE,"qr_code"],[h.AZTEC,"aztec"],[h.CODABAR,"codabar"],[h.CODE_39,"code_39"],[h.CODE_93,"code_93"],[h.CODE_128,"code_128"],[h.DATA_MATRIX,"data_matrix"],[h.ITF,"itf"],[h.EAN_13,"ean_13"],[h.EAN_8,"ean_8"],[h.PDF_417,"pdf417"],[h.UPC_A,"upc_a"],[h.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=r,this.logger=n;var i=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(i),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){return"BarcodeDetector"in window&&(new BarcodeDetector({formats:["qr_code"]}),!0)},e.prototype.decodeAsync=function(e){var t,r,n,i;return t=this,r=void 0,n=void 0,i=function(){var t,r;return M(this,function(n){switch(n.label){case 0:return[4,this.detector.detect(e)];case 1:if(!(t=n.sent())||0===t.length)throw"No barcode or QR code detected.";return[2,{text:(r=this.selectLargestBarcode(t)).rawValue,format:E.create(this.toHtml5QrcodeSupportedFormats(r.format)),debugData:this.createDebugData()}]}})},new(n||(n=Promise))(function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(o,s)}l((i=i.apply(t,r||[])).next())})},e.prototype.selectLargestBarcode=function(e){for(var t=null,r=0,n=0;n<e.length;n++){var i=e[n],a=i.boundingBox.width*i.boundingBox.height;a>r&&(r=a,t=i)}if(!t)throw"No largest barcode found";return t},e.prototype.createBarcodeDetectorFormats=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];this.formatMap.has(n)?t.push(this.formatMap.get(n)):this.logger.warn("".concat(n," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,r,n){e.set(t,r)}),e},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),O=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},P=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},B=function(){function e(e,t,r,n){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=r,t&&R.isSupported()?(this.primaryDecoder=new R(e,r,n),this.secondaryDecoder=new N(e,r,n)):this.primaryDecoder=new N(e,r,n)}return e.prototype.decodeAsync=function(e){return O(this,void 0,void 0,function(){var t;return P(this,function(r){switch(r.label){case 0:t=performance.now(),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,r.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(e){return O(this,void 0,void 0,function(){var t,r;return P(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,n.sent()];case 3:if(r=n.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw r;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?!1===this.wasPrimaryDecoderUsedInLastDecode?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(e){if(this.verbose){var t=performance.now()-e;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,t=0,r=this.executionResults;t<r.length;t++)e+=r[t];var n=e/this.executionResults.length;console.log("".concat(n," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),L=(o=function(e,t){return(o=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),k=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},F=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},z=function(){function e(e,t){this.name=e,this.track=t}return e.prototype.isSupported=function(){return!!this.track.getCapabilities&&this.name in this.track.getCapabilities()},e.prototype.apply=function(e){var t={};return t[this.name]=e,this.track.applyConstraints({advanced:[t]})},e.prototype.value=function(){var e=this.track.getSettings();return this.name in e?e[this.name]:null},e}(),U=function(e){function t(t){return e.call(this,"zoom",t)||this}return L(t,e),t}(function(e){function t(t,r){return e.call(this,t,r)||this}return L(t,e),t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(e){var t={};return t[this.name]=e,this.track.applyConstraints({advanced:[t]})},t.prototype.getCapabilities=function(){this.failIfNotSupported();var e=this.track.getCapabilities()[this.name];return{min:e.min,max:e.max,step:e.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw Error("".concat(this.name," capability not supported"))},t}(z)),V=function(e){function t(t){return e.call(this,"torch",t)||this}return L(t,e),t}(z),H=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new U(this.track)},e.prototype.torchFeature=function(){return new V(this.track)},e}(),j=function(){function e(e,t,r){this.isClosed=!1,this.parentElement=e,this.mediaStream=t,this.callbacks=r,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return e.prototype.createVideoElement=function(e){var t=document.createElement("video");return t.style.width="".concat(e,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},e.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var r=e.surface.clientWidth,n=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(r,n),e.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,r,n,i){return k(this,void 0,void 0,function(){var a,o;return F(this,function(s){switch(s.label){case 0:if(a=new e(t,r,i),!n.aspectRatio)return[3,2];return o={aspectRatio:n.aspectRatio},[4,a.getFirstTrackOrFail().applyConstraints(o)];case 1:s.sent(),s.label=2;case 2:return a.setupSurface(),[2,a]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),0===this.mediaStream.getVideoTracks().length)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(e){this.failIfClosed();var t=this,r=function(){setTimeout(e,200),t.surface.removeEventListener("playing",r)};this.surface.addEventListener("playing",r),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(e){return k(this,void 0,void 0,function(){return F(this,function(t){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(t,r){var n=e.mediaStream.getVideoTracks().length,i=0;e.mediaStream.getVideoTracks().forEach(function(r){e.mediaStream.removeTrack(r),r.stop(),++i>=n&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),t())})})},e.prototype.getCapabilities=function(){return new H(this.getFirstTrackOrFail())},e}(),Y=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,r){return k(this,void 0,void 0,function(){return F(this,function(n){return[2,j.create(e,this.mediaStream,t,r)]})})},e.create=function(t){return k(this,void 0,void 0,function(){var r;return F(this,function(n){switch(n.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return r={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(r)];case 1:return[2,new e(n.sent())]}})})},e}(),X=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},G=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},W=function(){function e(){}return e.failIfNotSupported=function(){return X(this,void 0,void 0,function(){return G(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(e){return X(this,void 0,void 0,function(){return G(this,function(t){return[2,Y.create(e)]})})},e}(),q=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},Z=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=S.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=S.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if("https:"===location.protocol)return!0;var e=location.host.split(":")[0];return"127.0.0.1"===e||"localhost"===e},e.getCamerasFromMediaDevices=function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r,n,i,a,o;return q(this,function(s){switch(s.label){case 0:return e=function(e){for(var t=e.getVideoTracks(),r=0;r<t.length;r++){var n=t[r];n.enabled=!1,n.stop(),e.removeTrack(n)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=s.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(i=0,r=s.sent(),n=[],a=r;i<a.length;i++)"videoinput"===(o=a[i]).kind&&n.push({id:o.deviceId,label:o.label});return e(t),[2,n]}})},new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,t){MediaStreamTrack.getSources(function(t){for(var r=[],n=0;n<t.length;n++){var i=t[n];"video"===i.kind&&r.push({id:i.id,label:i.label})}e(r)})})},e}();(s=p||(p={}))[s.UNKNOWN=0]="UNKNOWN",s[s.NOT_STARTED=1]="NOT_STARTED",s[s.SCANNING=2]="SCANNING",s[s.PAUSED=3]="PAUSED";var Q=function(){function e(){this.state=p.NOT_STARTED,this.onGoingTransactionNewState=p.UNKNOWN}return e.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},e.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===p.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=p.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===p.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=p.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==p.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case p.UNKNOWN:throw"Transition from unknown is not allowed";case p.NOT_STARTED:this.failIfNewStateIs(e,[p.PAUSED]);case p.SCANNING:case p.PAUSED:}},e.prototype.failIfNewStateIs=function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])throw"Cannot transition from ".concat(this.state," to ").concat(e)},e}(),K=function(){function e(e){this.stateManager=e}return e.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},e.prototype.directTransition=function(e){this.stateManager.directTransition(e)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===p.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==p.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===p.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===p.PAUSED},e}(),$=function(){function e(){}return e.create=function(){return new K(new Q)},e}(),J=(l=function(e,t){return(l=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return J(t,e),t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(w),et=function(){function e(e,t){this.logger=t,this.fps=ee.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=!0===e.disableFlip,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=ee.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?x.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!_(this.qrbox)},e.create=function(t,r){return new e(t,r)},e}(),er=function(){function e(e,t){var r;if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.elementId=e,this.verbose=!1,"boolean"==typeof t?this.verbose=!0===t:t&&(r=t,this.verbose=!0===r.verbose,r.experimentalFeatures),this.logger=new C(this.verbose),this.qrcode=new B(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(r),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=$.create()}return e.prototype.start=function(e,t,r,n){var i,a=this;if(!e)throw"cameraIdOrConfig is required";if(!r||"function"!=typeof r)throw"qrCodeSuccessCallback is required and should be a function.";i=n||(this.verbose?this.logger.log:function(){});var o=et.create(t,this.logger);this.clearElement();var s=!1;o.videoConstraints&&(o.isMediaStreamConstraintsValid()?s=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var l=s,u=document.getElementById(this.elementId);u.clientWidth?u.clientWidth:ee.DEFAULT_WIDTH,u.style.position="relative",this.shouldScan=!0,this.element=u;var c=this,h=this.stateManagerProxy.startTransition(p.SCANNING);return new Promise(function(t,n){var s=l?o.videoConstraints:c.createVideoConstraints(e);if(!s){h.cancel(),n("videoConstraints should be defined");return}var u={};(!l||o.aspectRatio)&&(u.aspectRatio=o.aspectRatio);var d={onRenderSurfaceReady:function(e,t){c.setupUi(e,t,o),c.isScanning=!0,c.foreverScan(o,r,i)}};W.failIfNotSupported().then(function(e){e.create(s).then(function(e){return e.render(a.element,u,d).then(function(e){c.renderedCamera=e,h.execute(),t(null)}).catch(function(e){h.cancel(),n(e)})}).catch(function(e){h.cancel(),n(S.errorGettingUserMedia(e))})}).catch(function(e){h.cancel(),n(S.cameraStreamingNotSupported())})})},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(p.PAUSED),this.showPausedState(),(_(e)||!0!==e)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var e=this,t=function(){e.stateManagerProxy.directTransition(p.SCANNING),e.hidePausedState()};this.renderedCamera.isPaused()?this.renderedCamera.resume(function(){t()}):t()},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(p.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var r=function(){if(e.element){var t=document.getElementById(ee.SHADED_REGION_ELEMENT_ID);t&&e.element.removeChild(t)}},n=this;return this.renderedCamera.close().then(function(){return n.renderedCamera=null,n.element&&(n.element.removeChild(n.canvasElement),n.canvasElement=null),r(),n.qrRegion&&(n.qrRegion=null),n.context&&(n.context=null),t.execute(),n.hidePausedState(),n.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(e,t){return this.scanFileV2(e,t).then(function(e){return e.decodedText})},e.prototype.scanFileV2=function(e,t){var r=this;if(!e||!(e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(_(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(n,i){r.possiblyCloseLastScanImageFile(),r.clearElement(),r.lastScanImageFile=URL.createObjectURL(e);var a=new Image;a.onload=function(){var e=a.width,o=a.height,s=document.getElementById(r.elementId),l=s.clientWidth?s.clientWidth:ee.DEFAULT_WIDTH,u=Math.max(s.clientHeight?s.clientHeight:o,ee.FILE_SCAN_MIN_HEIGHT),c=r.computeCanvasDrawConfig(e,o,l,u);if(t){var h=r.createCanvasElement(l,u,"qr-canvas-visible");h.style.display="inline-block",s.appendChild(h);var d=h.getContext("2d");if(!d)throw"Unable to get 2d context from canvas";d.canvas.width=l,d.canvas.height=u,d.drawImage(a,0,0,e,o,c.x,c.y,c.width,c.height)}var f=ee.FILE_SCAN_HIDDEN_CANVAS_PADDING,g=Math.max(a.width,c.width),p=Math.max(a.height,c.height),v=g+2*f,y=p+2*f,w=r.createCanvasElement(v,y);s.appendChild(w);var E=w.getContext("2d");if(!E)throw"Unable to get 2d context from canvas";E.canvas.width=v,E.canvas.height=y,E.drawImage(a,0,0,e,o,f,f,g,p);try{r.qrcode.decodeRobustlyAsync(w).then(function(e){n(b.createFromQrcodeResult(e))}).catch(i)}catch(e){i("QR code parse error, error = ".concat(e))}},a.onerror=i,a.onabort=i,a.onstalled=i,a.onsuspend=i,a.src=URL.createObjectURL(e)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Z.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(e){if(e){if(!x.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},e.prototype.getRenderedCameraOrFail=function(){if(null==this.renderedCamera)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(e){var t=[h.QR_CODE,h.AZTEC,h.CODABAR,h.CODE_39,h.CODE_93,h.CODE_128,h.DATA_MATRIX,h.MAXICODE,h.ITF,h.EAN_13,h.EAN_8,h.PDF_417,h.RSS_14,h.RSS_EXPANDED,h.UPC_A,h.UPC_E,h.UPC_EAN_EXTENSION];if(!e||"boolean"==typeof e||!e.formatsToSupport)return t;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(0===e.formatsToSupport.length)throw"Atleast 1 formatsToSupport is needed.";for(var r=[],n=0,i=e.formatsToSupport;n<i.length;n++){var a=i[n];Object.values(h).includes(a)?r.push(a):this.logger.warn("Invalid format: ".concat(a," passed in config, ignoring."))}if(0===r.length)throw"None of formatsToSupport match supported values.";return r},e.prototype.getUseBarCodeDetectorIfSupported=function(e){if(_(e))return!0;if(!_(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(_(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!_(t.useBarCodeDetectorIfSupported)||!1!==t.useBarCodeDetectorIfSupported},e.prototype.validateQrboxSize=function(e,t,r){var n,i=r.qrbox;this.validateQrboxConfig(i);var a=this.toQrdimensions(e,t,i),o=function(e){if(e<ee.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(ee.MIN_QR_BOX_SIZE,"px.")};o(a.width),o(a.height),(n=a.width)>e&&(this.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),n=e),a.width=n},e.prototype.validateQrboxConfig=function(e){if("number"!=typeof e&&"function"!=typeof e&&(void 0===e.width||void 0===e.height))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(e,t,r){if("number"==typeof r)return{width:r,height:r};if("function"==typeof r)try{return r(e,t)}catch(e){throw Error("qrbox config was passed as a function but it failed with unknown error"+e)}return r},e.prototype.setupUi=function(e,t,r){r.isShadedBoxEnabled()&&this.validateQrboxSize(e,t,r);var n=_(r.qrbox)?{width:e,height:t}:r.qrbox;this.validateQrboxConfig(n);var i=this.toQrdimensions(e,t,n);i.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var a=r.isShadedBoxEnabled()&&i.height<=t,o=a?this.getShadedRegionBounds(e,t,i):{x:0,y:0,width:e,height:t},s=this.createCanvasElement(o.width,o.height),l=s.getContext("2d",{willReadFrequently:!0});l.canvas.width=o.width,l.canvas.height=o.height,this.element.append(s),a&&this.possiblyInsertShadingElement(this.element,e,t,i),this.createScannerPausedUiElement(this.element),this.qrRegion=o,this.context=l,this.canvasElement=s},e.prototype.createScannerPausedUiElement=function(e){var t=document.createElement("div");t.innerText=S.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",e.appendChild(t),this.scannerPausedUiElement=t},e.prototype.scanContext=function(e,t){var r=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(t){return e(t.text,b.createFromQrcodeResult(t)),r.possiblyUpdateShaders(!0),!0}).catch(function(e){r.possiblyUpdateShaders(!1);var n=S.codeParseError(e);return t(n,A.createFrom(n)),!1})},e.prototype.foreverScan=function(e,t,r){var n=this;if(this.shouldScan&&this.renderedCamera){var i=this.renderedCamera.getSurface(),a=i.videoWidth/i.clientWidth,o=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var s=this.qrRegion.width*a,l=this.qrRegion.height*o,u=this.qrRegion.x*a,c=this.qrRegion.y*o;this.context.drawImage(i,u,c,s,l,0,0,this.qrRegion.width,this.qrRegion.height);var h=function(){n.foreverScanTimeout=setTimeout(function(){n.foreverScan(e,t,r)},n.getTimeoutFps(e.fps))};this.scanContext(t,r).then(function(i){i||!0===e.disableFlip?h():(n.context.translate(n.context.canvas.width,0),n.context.scale(-1,1),n.scanContext(t,r).finally(function(){h()}))}).catch(function(e){n.logger.logError("Error happend while scanning context",e),h()})}},e.prototype.createVideoConstraints=function(e){if("string"==typeof e)return{deviceId:{exact:e}};if("object"==typeof e){var t="facingMode",r="deviceId",n={user:!0,environment:!0},i="exact",a=function(e){if(e in n)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(e,"'")},o=Object.keys(e);if(1!==o.length)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(o.length," keys");var s=Object.keys(e)[0];if(s!==t&&s!==r)throw"Only '".concat(t,"' and '").concat(r,"' ")+" are supported for 'cameraIdOrConfig'";if(s===t){var l=e.facingMode;if("string"==typeof l){if(a(l))return{facingMode:l}}else if("object"==typeof l)if(i in l){if(a(l["".concat(i)]))return{facingMode:{exact:l["".concat(i)]}}}else throw"'facingMode' should be string or object with"+" ".concat(i," as key.");else{var u=typeof l;throw"Invalid type of 'facingMode' = ".concat(u)}}else{var c=e.deviceId;if("string"==typeof c)return{deviceId:c};if("object"==typeof c)if(i in c)return{deviceId:{exact:c["".concat(i)]}};else throw"'deviceId' should be string or object with"+" ".concat(i," as key.");var h=typeof c;throw"Invalid type of 'deviceId' = ".concat(h)}}var d=typeof e;throw"Invalid type of 'cameraIdOrConfig' = ".concat(d)},e.prototype.computeCanvasDrawConfig=function(e,t,r,n){if(e<=r&&t<=n)return{x:(r-e)/2,y:(n-t)/2,width:e,height:t};var i=e,a=t;return e>r&&(t=r/e*t,e=r),t>n&&(e=n/t*e,t=n),this.logger.log("Image downsampled from "+"".concat(i,"X").concat(a)+" to ".concat(e,"X").concat(t,".")),this.computeCanvasDrawConfig(e,t,r,n)},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},e.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=e?ee.BORDER_SHADER_MATCH_COLOR:ee.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(e,t,r){var n=document.createElement("canvas");return n.style.width="".concat(e,"px"),n.style.height="".concat(t,"px"),n.style.display="none",n.id=_(r)?"qr-canvas":r,n},e.prototype.getShadedRegionBounds=function(e,t,r){if(r.width>e||r.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-r.width)/2,y:(t-r.height)/2,width:r.width,height:r.height}},e.prototype.possiblyInsertShadingElement=function(e,t,r,n){if(!(t-n.width<1)&&!(r-n.height<1)){var i=document.createElement("div");i.style.position="absolute";var a=(t-n.width)/2,o=(r-n.height)/2;i.style.borderLeft="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderRight="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderTop="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderBottom="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id="".concat(ee.SHADED_REGION_ELEMENT_ID),t-n.width<11||r-n.height<11?this.hasBorderShaders=!1:(this.insertShaderBorders(i,40,5,-5,null,0,!0),this.insertShaderBorders(i,40,5,-5,null,0,!1),this.insertShaderBorders(i,40,5,null,-5,0,!0),this.insertShaderBorders(i,40,5,null,-5,0,!1),this.insertShaderBorders(i,5,45,-5,null,-5,!0),this.insertShaderBorders(i,5,45,null,-5,-5,!0),this.insertShaderBorders(i,5,45,-5,null,-5,!1),this.insertShaderBorders(i,5,45,null,-5,-5,!1),this.hasBorderShaders=!0),e.append(i)}},e.prototype.insertShaderBorders=function(e,t,r,n,i,a,o){var s=document.createElement("div");s.style.position="absolute",s.style.backgroundColor=ee.BORDER_SHADER_DEFAULT_COLOR,s.style.width="".concat(t,"px"),s.style.height="".concat(r,"px"),null!==n&&(s.style.top="".concat(n,"px")),null!==i&&(s.style.bottom="".concat(i,"px")),o?s.style.left="".concat(a,"px"):s.style.right="".concat(a,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(s),e.appendChild(s)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(e){return 1e3/e},e}(),en="data:image/svg+xml;base64,",ei=en+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyLjEwMyAyNC4wNjJhMjkuODEgMjkuODEgMCAwIDAtNC42MDMgMTUuOTM4djEuMzMzYzAgMTYuNTQyIDEzLjQ1OCAzMCAzMCAzMGg4LjMyNGMuNDI3IDExLjYzMSA3LjUwMyAyMS41ODcgMTcuNTM0IDI2LjE3Ny45MzEgMTAuNTAzIDQuMDg0IDMwLjE4NyAxNC43NjggNDUuNTM3YTkuOTg4IDkuOTg4IDAgMCAwIDguMjE2IDQuMjg4IDkuOTU4IDkuOTU4IDAgMCAwIDUuNzA0LTEuNzkzYzQuNTMzLTMuMTU1IDUuNjUtOS4zODggMi40OTUtMTMuOTIxLTYuNzk4LTkuNzY3LTkuNjAyLTIyLjYwOC0xMC43Ni0zMS40aDgyLjY4NWMuMjcyLjQxNC41NDUuODE4LjgxNSAxLjIxIDMuMTQyIDQuNTQxIDkuMzcyIDUuNjc5IDEzLjkxMyAyLjUzNCA0LjU0Mi0zLjE0MiA1LjY3Ny05LjM3MSAyLjUzNS0xMy45MTMtMTEuOTE5LTE3LjIyOS04Ljc4Ny0zNS44ODQgOS41ODEtNTcuMDEyIDMuMDY3LTIuNjUyIDEyLjMwNy0xMS43MzIgMTEuMjE3LTI0LjAzMy0uODI4LTkuMzQzLTcuMTA5LTE3LjE5NC0xOC42NjktMjMuMzM3YTkuODU3IDkuODU3IDAgMCAwLTEuMDYxLS40ODZjLS40NjYtLjE4Mi0xMS40MDMtNC41NzktOS43NDEtMTUuNzA2IDEuMDA3LTYuNzM3IDE0Ljc2OC04LjI3MyAyMy43NjYtNy42NjYgMjMuMTU2IDEuNTY5IDM5LjY5OCA3LjgwMyA0Ny44MzYgMTguMDI2IDUuNzUyIDcuMjI1IDcuNjA3IDE2LjYyMyA1LjY3MyAyOC43MzMtLjQxMyAyLjU4NS0uODI0IDUuMjQxLTEuMjQ1IDcuOTU5LTUuNzU2IDM3LjE5NC0xMi45MTkgODMuNDgzLTQ5Ljg3IDExNC42NjEtNC4yMjEgMy41NjEtNC43NTYgOS44Ny0xLjE5NCAxNC4wOTJhOS45OCA5Ljk4IDAgMCAwIDcuNjQ4IDMuNTUxIDkuOTU1IDkuOTU1IDAgMCAwIDYuNDQ0LTIuMzU4YzQyLjY3Mi0zNi4wMDUgNTAuODAyLTg4LjUzMyA1Ni43MzctMTI2Ljg4OC40MTUtMi42ODQuODIxLTUuMzA5IDEuMjI5LTcuODYzIDIuODM0LTE3LjcyMS0uNDU1LTMyLjY0MS05Ljc3Mi00NC4zNDV6bS0yMzIuMzA4IDQyLjYyYy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM2MwLTUuNTE0IDQuNDg2LTEwIDEwLTEwaDE1djIxLjMzM2gtMTV6bS0yLjUtNTIuNjY2YzAtNS41MTQgNC40ODYtMTAgMTAtMTBoNy41djIxLjMzM2gtNy41Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM3ptMTcuNSA5My45OTloLTcuNWMtNS41MTQgMC0xMC00LjQ4Ni0xMC0xMHYtMS4zMzNjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGg3LjV2MjEuMzMzem0zMC43OTYgMjguODg3Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi04LjI3MWg5MS40NTdjLS44NTEgNi42NjgtLjQzNyAxMi43ODcuNzMxIDE4LjI3MWgtODIuMTg4em03OS40ODItMTEzLjY5OGMtMy4xMjQgMjAuOTA2IDEyLjQyNyAzMy4xODQgMjEuNjI1IDM3LjA0IDUuNDQxIDIuOTY4IDcuNTUxIDUuNjQ3IDcuNzAxIDcuMTg4LjIxIDIuMTUtMi41NTMgNS42ODQtNC40NzcgNy4yNTEtLjQ4Mi4zNzgtLjkyOS44LTEuMzM1IDEuMjYxLTYuOTg3IDcuOTM2LTExLjk4MiAxNS41Mi0xNS40MzIgMjIuNjg4aC05Ny41NjRWMzBjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGgxMjMuNzY5YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB2MTM1LjU3OWMtMy4wMzItLjM4MS02LjE1LS42OTQtOS4zODktLjkxNC0yNS4xNTktMS42OTQtNDIuMzcgNy43NDgtNDQuODk4IDI0LjY2NnoiLz48cGF0aCBkPSJNMTc5LjEyOSA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXpNMTcyLjYyOSAxNDIuODZoLTEyLjU2VjEzMC44YTUgNSAwIDEgMC0xMCAwdjE3LjA2MWE1IDUgMCAwIDAgNSA1aDE3LjU2YTUgNSAwIDEgMCAwLTEwLjAwMXpNMjE2LjU2OCA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXptLTUgMjQuMDYxaC0xNC4wNlY5My4xNjdoMTQuMDZ2MTQuMDYxek0yMTEuNjY5IDEyNS45MzZIMTk3LjQxYTUgNSAwIDAgMC01IDV2MTQuMjU3YTUgNSAwIDAgMCA1IDVoMTQuMjU5YTUgNSAwIDAgMCA1LTV2LTE0LjI1N2E1IDUgMCAwIDAtNS01eiIvPjwvc3ZnPg==",ea=en+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1OS4wMTggNTkuMDE4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1OS4wMTggNTkuMDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJtNTguNzQxIDU0LjgwOS01Ljk2OS02LjI0NGExMC43NCAxMC43NCAwIDAgMCAyLjgyLTcuMjVjMC01Ljk1My00Ljg0My0xMC43OTYtMTAuNzk2LTEwLjc5NlMzNCAzNS4zNjEgMzQgNDEuMzE0IDM4Ljg0MyA1Mi4xMSA0NC43OTYgNTIuMTFjMi40NDEgMCA0LjY4OC0uODI0IDYuNDk5LTIuMTk2bDYuMDAxIDYuMjc3YS45OTguOTk4IDAgMCAwIDEuNDE0LjAzMiAxIDEgMCAwIDAgLjAzMS0xLjQxNHpNMzYgNDEuMzE0YzAtNC44NSAzLjk0Ni04Ljc5NiA4Ljc5Ni04Ljc5NnM4Ljc5NiAzLjk0NiA4Ljc5NiA4Ljc5Ni0zLjk0NiA4Ljc5Ni04Ljc5NiA4Ljc5NlMzNiA0Ni4xNjQgMzYgNDEuMzE0ek0xMC40MzEgMTYuMDg4YzAgMy4wNyAyLjQ5OCA1LjU2OCA1LjU2OSA1LjU2OHM1LjU2OS0yLjQ5OCA1LjU2OS01LjU2OGMwLTMuMDcxLTIuNDk4LTUuNTY5LTUuNTY5LTUuNTY5cy01LjU2OSAyLjQ5OC01LjU2OSA1LjU2OXptOS4xMzggMGMwIDEuOTY4LTEuNjAyIDMuNTY4LTMuNTY5IDMuNTY4cy0zLjU2OS0xLjYwMS0zLjU2OS0zLjU2OCAxLjYwMi0zLjU2OSAzLjU2OS0zLjU2OSAzLjU2OSAxLjYwMSAzLjU2OSAzLjU2OXoiLz48cGF0aCBkPSJtMzAuODgyIDI4Ljk4NyA5LjE4LTEwLjA1NCAxMS4yNjIgMTAuMzIzYTEgMSAwIDAgMCAxLjM1MS0xLjQ3NWwtMTItMTFhMSAxIDAgMCAwLTEuNDE0LjA2M2wtOS43OTQgMTAuNzI3LTQuNzQzLTQuNzQzYTEuMDAzIDEuMDAzIDAgMCAwLTEuMzY4LS4wNDRMNi4zMzkgMzcuNzY4YTEgMSAwIDEgMCAxLjMyMiAxLjUwMWwxNi4zMTMtMTQuMzYyIDcuMzE5IDcuMzE4YS45OTkuOTk5IDAgMSAwIDEuNDE0LTEuNDE0bC0xLjgyNS0xLjgyNHoiLz48cGF0aCBkPSJNMzAgNDYuNTE4SDJ2LTQyaDU0djI4YTEgMSAwIDEgMCAyIDB2LTI5YTEgMSAwIDAgMC0xLTFIMWExIDEgMCAwIDAtMSAxdjQ0YTEgMSAwIDAgMCAxIDFoMjlhMSAxIDAgMSAwIDAtMnoiLz48L3N2Zz4=",eo=en+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NjAgNDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0NjAgNDYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNMjMwIDBDMTAyLjk3NSAwIDAgMTAyLjk3NSAwIDIzMHMxMDIuOTc1IDIzMCAyMzAgMjMwIDIzMC0xMDIuOTc0IDIzMC0yMzBTMzU3LjAyNSAwIDIzMCAwem0zOC4zMzMgMzc3LjM2YzAgOC42NzYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+",es=function(){function e(){}return e.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},e}(),el=function(){function e(){this.data=es.createDefault();var t=localStorage.getItem(e.LOCAL_STORAGE_KEY);t?this.data=JSON.parse(t):this.reset()}return e.prototype.hasCameraPermissions=function(){return this.data.hasPermission},e.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},e.prototype.setHasPermission=function(e){this.data.hasPermission=e,this.flush()},e.prototype.setLastUsedCameraId=function(e){this.data.lastUsedCameraId=e,this.flush()},e.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},e.prototype.reset=function(){this.data=es.createDefault(),this.flush()},e.prototype.flush=function(){localStorage.setItem(e.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},e.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",e}(),eu=function(){function e(){this.infoDiv=document.createElement("div")}return e.prototype.renderInto=function(e){this.infoDiv.style.position="absolute",this.infoDiv.style.top="10px",this.infoDiv.style.right="10px",this.infoDiv.style.zIndex="2",this.infoDiv.style.display="none",this.infoDiv.style.padding="5pt",this.infoDiv.style.border="1px solid #171717",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(0 0 0 / 69%)",this.infoDiv.style.borderRadius="5px",this.infoDiv.style.textAlign="center",this.infoDiv.style.fontWeight="400",this.infoDiv.style.color="white",this.infoDiv.innerText=T.poweredBy();var t=document.createElement("a");t.innerText="ScanApp",t.href="https://scanapp.org",t.target="new",t.style.color="white",this.infoDiv.appendChild(t);var r=document.createElement("br"),n=document.createElement("br");this.infoDiv.appendChild(r),this.infoDiv.appendChild(n);var i=document.createElement("a");i.innerText=T.reportIssues(),i.href="https://github.com/mebjas/html5-qrcode/issues",i.target="new",i.style.color="white",this.infoDiv.appendChild(i),e.appendChild(this.infoDiv)},e.prototype.show=function(){this.infoDiv.style.display="block"},e.prototype.hide=function(){this.infoDiv.style.display="none"},e}(),ec=function(){function e(e,t){this.isShowingInfoIcon=!0,this.onTapIn=e,this.onTapOut=t,this.infoIcon=document.createElement("img")}return e.prototype.renderInto=function(e){var t=this;this.infoIcon.alt="Info icon",this.infoIcon.src=eo,this.infoIcon.style.position="absolute",this.infoIcon.style.top="4px",this.infoIcon.style.right="4px",this.infoIcon.style.opacity="0.6",this.infoIcon.style.cursor="pointer",this.infoIcon.style.zIndex="2",this.infoIcon.style.width="16px",this.infoIcon.style.height="16px",this.infoIcon.onmouseover=function(e){return t.onHoverIn()},this.infoIcon.onmouseout=function(e){return t.onHoverOut()},this.infoIcon.onclick=function(e){return t.onClick()},e.appendChild(this.infoIcon)},e.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},e.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},e.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=eo,this.infoIcon.style.opacity="0.6")},e}(),eh=function(){function e(){var e=this;this.infoDiv=new eu,this.infoIcon=new ec(function(){e.infoDiv.show()},function(){e.infoDiv.hide()})}return e.prototype.renderInto=function(e){this.infoDiv.renderInto(e),this.infoIcon.renderInto(e)},e}(),ed=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},ef=function(){function e(){}return e.hasPermissions=function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r;return ed(this,function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:for(e=0,t=n.sent();e<t.length;e++)if("videoinput"===(r=t[e]).kind&&r.label)return[2,!0];return[2,!1]}})},new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},e}(),eg=function(){function e(e){this.supportedScanTypes=this.validateAndReturnScanTypes(e)}return e.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},e.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},e.prototype.isCameraScanRequired=function(){for(var t=0,r=this.supportedScanTypes;t<r.length;t++){var n=r[t];if(e.isCameraScanType(n))return!0}return!1},e.isCameraScanType=function(e){return e===f.SCAN_TYPE_CAMERA},e.isFileScanType=function(e){return e===f.SCAN_TYPE_FILE},e.prototype.validateAndReturnScanTypes=function(e){if(!e||0===e.length)return w.DEFAULT_SUPPORTED_SCAN_TYPE;var t=w.DEFAULT_SUPPORTED_SCAN_TYPE.length;if(e.length>t)throw"Max ".concat(t," values expected for ")+"supportedScanTypes";for(var r=0;r<e.length;r++){var n=e[r];if(!w.DEFAULT_SUPPORTED_SCAN_TYPE.includes(n))throw"Unsupported scan type ".concat(n)}return e},e}(),ep=function(){function e(){}return e.ALL_ELEMENT_CLASS="html5-qrcode-element",e.CAMERA_PERMISSION_BUTTON_ID="html5-qrcode-button-camera-permission",e.CAMERA_START_BUTTON_ID="html5-qrcode-button-camera-start",e.CAMERA_STOP_BUTTON_ID="html5-qrcode-button-camera-stop",e.TORCH_BUTTON_ID="html5-qrcode-button-torch",e.CAMERA_SELECTION_SELECT_ID="html5-qrcode-select-camera",e.FILE_SELECTION_BUTTON_ID="html5-qrcode-button-file-selection",e.ZOOM_SLIDER_ID="html5-qrcode-input-range-zoom",e.SCAN_TYPE_CHANGE_ANCHOR_ID="html5-qrcode-anchor-scan-type-change",e.TORCH_BUTTON_CLASS_TORCH_ON="html5-qrcode-button-torch-on",e.TORCH_BUTTON_CLASS_TORCH_OFF="html5-qrcode-button-torch-off",e}(),em=function(){function e(){}return e.createElement=function(e,t){var r=document.createElement(e);return r.id=t,r.classList.add(ep.ALL_ELEMENT_CLASS),"button"===e&&r.setAttribute("type","button"),r},e}(),ev=function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})},ey=function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){var u=[s,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}},ew=function(){function e(e,t,r){this.isTorchOn=!1,this.torchCapability=e,this.buttonController=t,this.onTorchActionFailureCallback=r}return e.prototype.isTorchEnabled=function(){return this.isTorchOn},e.prototype.flipState=function(){return ev(this,void 0,void 0,function(){var e,t;return ey(this,function(r){switch(r.label){case 0:this.buttonController.disable(),e=!this.isTorchOn,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.torchCapability.apply(e)];case 2:return r.sent(),this.updateUiBasedOnLatestSettings(this.torchCapability.value(),e),[3,4];case 3:return t=r.sent(),this.propagateFailure(e,t),this.buttonController.enable(),[3,4];case 4:return[2]}})})},e.prototype.updateUiBasedOnLatestSettings=function(e,t){e===t?(this.buttonController.setText(t?I.torchOffButton():I.torchOnButton()),this.isTorchOn=t):this.propagateFailure(t),this.buttonController.enable()},e.prototype.propagateFailure=function(e,t){var r=e?I.torchOnFailedMessage():I.torchOffFailedMessage();t&&(r+="; Error = "+t),this.onTorchActionFailureCallback(r)},e.prototype.reset=function(){this.isTorchOn=!1},e}(),eE=function(){function e(e,t){this.onTorchActionFailureCallback=t,this.torchButton=em.createElement("button",ep.TORCH_BUTTON_ID),this.torchController=new ew(e,this,t)}return e.prototype.render=function(e,t){var r=this;this.torchButton.innerText=I.torchOnButton(),this.torchButton.style.display=t.display,this.torchButton.style.marginLeft=t.marginLeft;var n=this;this.torchButton.addEventListener("click",function(e){return ev(r,void 0,void 0,function(){return ey(this,function(e){switch(e.label){case 0:return[4,n.torchController.flipState()];case 1:return e.sent(),n.torchController.isTorchEnabled()?(n.torchButton.classList.remove(ep.TORCH_BUTTON_CLASS_TORCH_OFF),n.torchButton.classList.add(ep.TORCH_BUTTON_CLASS_TORCH_ON)):(n.torchButton.classList.remove(ep.TORCH_BUTTON_CLASS_TORCH_ON),n.torchButton.classList.add(ep.TORCH_BUTTON_CLASS_TORCH_OFF)),[2]}})})}),e.appendChild(this.torchButton)},e.prototype.updateTorchCapability=function(e){this.torchController=new ew(e,this,this.onTorchActionFailureCallback)},e.prototype.getTorchButton=function(){return this.torchButton},e.prototype.hide=function(){this.torchButton.style.display="none"},e.prototype.show=function(){this.torchButton.style.display="inline-block"},e.prototype.disable=function(){this.torchButton.disabled=!0},e.prototype.enable=function(){this.torchButton.disabled=!1},e.prototype.setText=function(e){this.torchButton.innerText=e},e.prototype.reset=function(){this.torchButton.innerText=I.torchOnButton(),this.torchController.reset()},e.create=function(t,r,n,i){var a=new e(r,i);return a.render(t,n),a},e}(),eb=function(){function e(e,t,r){this.fileBasedScanRegion=this.createFileBasedScanRegion(),this.fileBasedScanRegion.style.display=t?"block":"none",e.appendChild(this.fileBasedScanRegion);var n=document.createElement("label");n.setAttribute("for",this.getFileScanInputId()),n.style.display="inline-block",this.fileBasedScanRegion.appendChild(n),this.fileSelectionButton=em.createElement("button",ep.FILE_SELECTION_BUTTON_ID),this.setInitialValueToButton(),this.fileSelectionButton.addEventListener("click",function(e){n.click()}),n.append(this.fileSelectionButton),this.fileScanInput=em.createElement("input",this.getFileScanInputId()),this.fileScanInput.type="file",this.fileScanInput.accept="image/*",this.fileScanInput.style.display="none",n.appendChild(this.fileScanInput);var i=this;this.fileScanInput.addEventListener("change",function(e){if(null!=e&&null!=e.target){var t=e.target;if(!t.files||0!==t.files.length){var n=t.files[0],a=n.name;i.setImageNameToButton(a),r(n)}}});var a=this.createDragAndDropMessage();this.fileBasedScanRegion.appendChild(a),this.fileBasedScanRegion.addEventListener("dragenter",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionActiveBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragleave",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionDefaultBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragover",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionActiveBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),i.fileBasedScanRegion.style.border=i.fileBasedScanRegionDefaultBorder();var t=e.dataTransfer;if(t){var n=t.files;if(!n||0===n.length)return;for(var o=!1,s=0;s<n.length;++s){var l=n.item(s);if(l){var u=/image.*/;if(l.type.match(u)){o=!0;var c=l.name;i.setImageNameToButton(c),r(l),a.innerText=I.dragAndDropMessage();break}}}o||(a.innerText=I.dragAndDropMessageOnlyImages())}})}return e.prototype.hide=function(){this.fileBasedScanRegion.style.display="none",this.fileScanInput.disabled=!0},e.prototype.show=function(){this.fileBasedScanRegion.style.display="block",this.fileScanInput.disabled=!1},e.prototype.isShowing=function(){return"block"===this.fileBasedScanRegion.style.display},e.prototype.resetValue=function(){this.fileScanInput.value="",this.setInitialValueToButton()},e.prototype.createFileBasedScanRegion=function(){var e=document.createElement("div");return e.style.textAlign="center",e.style.margin="auto",e.style.width="80%",e.style.maxWidth="600px",e.style.border=this.fileBasedScanRegionDefaultBorder(),e.style.padding="10px",e.style.marginBottom="10px",e},e.prototype.fileBasedScanRegionDefaultBorder=function(){return"6px dashed #ebebeb"},e.prototype.fileBasedScanRegionActiveBorder=function(){return"6px dashed rgb(153 151 151)"},e.prototype.createDragAndDropMessage=function(){var e=document.createElement("div");return e.innerText=I.dragAndDropMessage(),e.style.fontWeight="400",e},e.prototype.setImageNameToButton=function(e){if(e.length>20){var t=e.substring(0,8),r=e.length,n=e.substring(r-8,r);e="".concat(t,"....").concat(n)}var i=I.fileSelectionChooseAnother()+" - "+e;this.fileSelectionButton.innerText=i},e.prototype.setInitialValueToButton=function(){var e=I.fileSelectionChooseImage()+" - "+I.fileSelectionNoImageSelected();this.fileSelectionButton.innerText=e},e.prototype.getFileScanInputId=function(){return"html5-qrcode-private-filescan-input"},e.create=function(t,r,n){return new e(t,r,n)},e}(),eA=function(){function e(e){this.selectElement=em.createElement("select",ep.CAMERA_SELECTION_SELECT_ID),this.cameras=e,this.options=[]}return e.prototype.render=function(e){var t=document.createElement("span");t.style.marginRight="10px";var r=this.cameras.length;if(0===r)throw Error("No cameras found");if(1===r)t.style.display="none";else{var n=I.selectCamera();t.innerText="".concat(n," (").concat(this.cameras.length,") ")}for(var i=1,a=0,o=this.cameras;a<o.length;a++){var s=o[a],l=s.id,u=null==s.label?l:s.label;u&&""!==u||(u=[I.anonymousCameraPrefix(),i++].join(" "));var c=document.createElement("option");c.value=l,c.innerText=u,this.options.push(c),this.selectElement.appendChild(c)}t.appendChild(this.selectElement),e.appendChild(t)},e.prototype.disable=function(){this.selectElement.disabled=!0},e.prototype.isDisabled=function(){return!0===this.selectElement.disabled},e.prototype.enable=function(){this.selectElement.disabled=!1},e.prototype.getValue=function(){return this.selectElement.value},e.prototype.hasValue=function(e){for(var t=0,r=this.options;t<r.length;t++)if(r[t].value===e)return!0;return!1},e.prototype.setValue=function(e){if(!this.hasValue(e))throw Error("".concat(e," is not present in the camera list."));this.selectElement.value=e},e.prototype.hasSingleItem=function(){return 1===this.cameras.length},e.prototype.numCameras=function(){return this.cameras.length},e.create=function(t,r){var n=new e(r);return n.render(t),n},e}(),eC=function(){function e(){this.onChangeCallback=null,this.zoomElementContainer=document.createElement("div"),this.rangeInput=em.createElement("input",ep.ZOOM_SLIDER_ID),this.rangeInput.type="range",this.rangeText=document.createElement("span"),this.rangeInput.min="1",this.rangeInput.max="5",this.rangeInput.value="1",this.rangeInput.step="0.1"}return e.prototype.render=function(e,t){this.zoomElementContainer.style.display=t?"block":"none",this.zoomElementContainer.style.padding="5px 10px",this.zoomElementContainer.style.textAlign="center",e.appendChild(this.zoomElementContainer),this.rangeInput.style.display="inline-block",this.rangeInput.style.width="50%",this.rangeInput.style.height="5px",this.rangeInput.style.background="#d3d3d3",this.rangeInput.style.outline="none",this.rangeInput.style.opacity="0.7";var r=I.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(r),this.rangeText.style.marginRight="10px";var n=this;this.rangeInput.addEventListener("input",function(){return n.onValueChange()}),this.rangeInput.addEventListener("change",function(){return n.onValueChange()}),this.zoomElementContainer.appendChild(this.rangeInput),this.zoomElementContainer.appendChild(this.rangeText)},e.prototype.onValueChange=function(){var e=I.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(e),this.onChangeCallback&&this.onChangeCallback(parseFloat(this.rangeInput.value))},e.prototype.setValues=function(e,t,r,n){this.rangeInput.min=e.toString(),this.rangeInput.max=t.toString(),this.rangeInput.step=n.toString(),this.rangeInput.value=r.toString(),this.onValueChange()},e.prototype.show=function(){this.zoomElementContainer.style.display="block"},e.prototype.hide=function(){this.zoomElementContainer.style.display="none"},e.prototype.setOnCameraZoomValueChangeCallback=function(e){this.onChangeCallback=e},e.prototype.removeOnCameraZoomValueChangeCallback=function(){this.onChangeCallback=null},e.create=function(t,r){var n=new e;return n.render(t,r),n},e}();function e_(e,t,r){if(this.lastMatchFound=null,this.cameraScanImage=null,this.fileScanImage=null,this.fileSelectionUi=null,this.elementId=e,this.config=this.createConfig(t),this.verbose=!0===r,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.scanTypeSelector=new eg(this.config.supportedScanTypes),this.currentScanType=this.scanTypeSelector.getDefaultScanType(),this.sectionSwapAllowed=!0,this.logger=new C(this.verbose),this.persistedDataManager=new el,!0!==t.rememberLastUsedCamera&&this.persistedDataManager.reset()}(u=v||(v={}))[u.STATUS_DEFAULT=0]="STATUS_DEFAULT",u[u.STATUS_SUCCESS=1]="STATUS_SUCCESS",u[u.STATUS_WARNING=2]="STATUS_WARNING",u[u.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION",e_.prototype.render=function(e,t){var r,n,i=this;this.lastMatchFound=null,this.qrCodeSuccessCallback=function(t,r){if(e)e(t,r);else{if(i.lastMatchFound===t)return;i.lastMatchFound=t,i.setHeaderMessage(I.lastMatch(t),v.STATUS_SUCCESS)}},this.qrCodeErrorCallback=function(e,r){t&&t(e,r)};var a=document.getElementById(this.elementId);if(!a)throw"HTML Element with id=".concat(this.elementId," not found");a.innerHTML="",this.createBasicLayout(a),this.html5Qrcode=new er(this.getScanRegionId(),(r=this.config,n=this.verbose,{formatsToSupport:r.formatsToSupport,useBarCodeDetectorIfSupported:r.useBarCodeDetectorIfSupported,experimentalFeatures:r.experimentalFeatures,verbose:n}))},e_.prototype.pause=function(e){(_(e)||!0!==e)&&(e=!1),this.getHtml5QrcodeOrFail().pause(e)},e_.prototype.resume=function(){this.getHtml5QrcodeOrFail().resume()},e_.prototype.getState=function(){return this.getHtml5QrcodeOrFail().getState()},e_.prototype.clear=function(){var e=this,t=function(){var t=document.getElementById(e.elementId);t&&(t.innerHTML="",e.resetBasicLayout(t))};return this.html5Qrcode?new Promise(function(r,n){e.html5Qrcode?e.html5Qrcode.isScanning?e.html5Qrcode.stop().then(function(n){e.html5Qrcode&&(e.html5Qrcode.clear(),t()),r()}).catch(function(t){e.verbose&&e.logger.logError("Unable to stop qrcode scanner",t),n(t)}):(e.html5Qrcode.clear(),t(),r()):r()}):Promise.resolve()},e_.prototype.getRunningTrackCapabilities=function(){return this.getHtml5QrcodeOrFail().getRunningTrackCapabilities()},e_.prototype.getRunningTrackSettings=function(){return this.getHtml5QrcodeOrFail().getRunningTrackSettings()},e_.prototype.applyVideoConstraints=function(e){return this.getHtml5QrcodeOrFail().applyVideoConstraints(e)},e_.prototype.getHtml5QrcodeOrFail=function(){if(!this.html5Qrcode)throw"Code scanner not initialized.";return this.html5Qrcode},e_.prototype.createConfig=function(e){return e?(e.fps||(e.fps=w.SCAN_DEFAULT_FPS),!w.DEFAULT_REMEMBER_LAST_CAMERA_USED!==e.rememberLastUsedCamera&&(e.rememberLastUsedCamera=w.DEFAULT_REMEMBER_LAST_CAMERA_USED),e.supportedScanTypes||(e.supportedScanTypes=w.DEFAULT_SUPPORTED_SCAN_TYPE),e):{fps:w.SCAN_DEFAULT_FPS,rememberLastUsedCamera:w.DEFAULT_REMEMBER_LAST_CAMERA_USED,supportedScanTypes:w.DEFAULT_SUPPORTED_SCAN_TYPE}},e_.prototype.createBasicLayout=function(e){e.style.position="relative",e.style.padding="0px",e.style.border="1px solid silver",this.createHeader(e);var t=document.createElement("div");t.id=this.getScanRegionId(),t.style.width="100%",t.style.minHeight="100px",t.style.textAlign="center",e.appendChild(t),eg.isCameraScanType(this.currentScanType)?this.insertCameraScanImageToScanRegion():this.insertFileScanImageToScanRegion();var r=document.createElement("div");r.id=this.getDashboardId(),r.style.width="100%",e.appendChild(r),this.setupInitialDashboard(r)},e_.prototype.resetBasicLayout=function(e){e.style.border="none"},e_.prototype.setupInitialDashboard=function(e){this.createSection(e),this.createSectionControlPanel(),this.scanTypeSelector.hasMoreThanOneScanType()&&this.createSectionSwap()},e_.prototype.createHeader=function(e){var t=document.createElement("div");t.style.textAlign="left",t.style.margin="0px",e.appendChild(t),new eh().renderInto(t);var r=document.createElement("div");r.id=this.getHeaderMessageContainerId(),r.style.display="none",r.style.textAlign="center",r.style.fontSize="14px",r.style.padding="2px 10px",r.style.margin="4px",r.style.borderTop="1px solid #f6f6f6",t.appendChild(r)},e_.prototype.createSection=function(e){var t=document.createElement("div");t.id=this.getDashboardSectionId(),t.style.width="100%",t.style.padding="10px 0px 10px 0px",t.style.textAlign="left",e.appendChild(t)},e_.prototype.createCameraListUi=function(e,t,r){var n=this;n.showHideScanTypeSwapLink(!1),n.setHeaderMessage(I.cameraPermissionRequesting());var i=function(){r||n.createPermissionButton(e,t)};er.getCameras().then(function(r){n.persistedDataManager.setHasPermission(!0),n.showHideScanTypeSwapLink(!0),n.resetHeaderMessage(),r&&r.length>0?(e.removeChild(t),n.renderCameraSelection(r)):(n.setHeaderMessage(I.noCameraFound(),v.STATUS_WARNING),i())}).catch(function(e){n.persistedDataManager.setHasPermission(!1),r?r.disabled=!1:i(),n.setHeaderMessage(e,v.STATUS_WARNING),n.showHideScanTypeSwapLink(!0)})},e_.prototype.createPermissionButton=function(e,t){var r=this,n=em.createElement("button",this.getCameraPermissionButtonId());n.innerText=I.cameraPermissionTitle(),n.addEventListener("click",function(){n.disabled=!0,r.createCameraListUi(e,t,n)}),t.appendChild(n)},e_.prototype.createPermissionsUi=function(e,t){var r=this;eg.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()?ef.hasPermissions().then(function(n){n?r.createCameraListUi(e,t):(r.persistedDataManager.setHasPermission(!1),r.createPermissionButton(e,t))}).catch(function(n){r.persistedDataManager.setHasPermission(!1),r.createPermissionButton(e,t)}):this.createPermissionButton(e,t)},e_.prototype.createSectionControlPanel=function(){var e=document.getElementById(this.getDashboardSectionId()),t=document.createElement("div");e.appendChild(t);var r=document.createElement("div");r.id=this.getDashboardSectionCameraScanRegionId(),r.style.display=eg.isCameraScanType(this.currentScanType)?"block":"none",t.appendChild(r);var n=document.createElement("div");n.style.textAlign="center",r.appendChild(n),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(r,n),this.renderFileScanUi(t)},e_.prototype.renderFileScanUi=function(e){var t=eg.isFileScanType(this.currentScanType),r=this;this.fileSelectionUi=eb.create(e,t,function(e){if(!r.html5Qrcode)throw"html5Qrcode not defined";eg.isFileScanType(r.currentScanType)&&(r.setHeaderMessage(I.loadingImage()),r.html5Qrcode.scanFileV2(e,!0).then(function(e){r.resetHeaderMessage(),r.qrCodeSuccessCallback(e.decodedText,e)}).catch(function(e){r.setHeaderMessage(e,v.STATUS_WARNING),r.qrCodeErrorCallback(e,A.createFrom(e))}))})},e_.prototype.renderCameraSelection=function(e){var t,r=this,n=this,i=document.getElementById(this.getDashboardSectionCameraScanRegionId());i.style.textAlign="center";var a=eC.create(i,!1),o=function(e){var t=e.zoomFeature();if(t.isSupported()){a.setOnCameraZoomValueChangeCallback(function(e){t.apply(e)});var n,i,o,s=1;r.config.defaultZoomValueIfSupported&&(s=r.config.defaultZoomValueIfSupported),n=s,i=t.min(),s=n>(o=t.max())?o:n<i?i:n,a.setValues(t.min(),t.max(),s,t.step()),a.show()}},s=eA.create(i,e),l=document.createElement("span"),u=em.createElement("button",ep.CAMERA_START_BUTTON_ID);u.innerText=I.scanButtonStartScanningText(),l.appendChild(u);var c=em.createElement("button",ep.CAMERA_STOP_BUTTON_ID);c.innerText=I.scanButtonStopScanningText(),c.style.display="none",c.disabled=!0,l.appendChild(c);var h=function(e){if(!e.torchFeature().isSupported()){t&&t.hide();return}t?t.updateTorchCapability(e.torchFeature()):t=eE.create(l,e.torchFeature(),{display:"none",marginLeft:"5px"},function(e){n.setHeaderMessage(e,v.STATUS_WARNING)}),t.show()};i.appendChild(l);var d=function(e){e||(u.style.display="none"),u.innerText=I.scanButtonStartScanningText(),u.style.opacity="1",u.disabled=!1,e&&(u.style.display="inline-block")};if(u.addEventListener("click",function(e){u.innerText=I.scanButtonScanningStarting(),s.disable(),u.disabled=!0,u.style.opacity="0.5",r.scanTypeSelector.hasMoreThanOneScanType()&&n.showHideScanTypeSwapLink(!1),n.resetHeaderMessage();var t,i=s.getValue();n.persistedDataManager.setLastUsedCameraId(i),n.html5Qrcode.start(i,{fps:(t=n.config).fps,qrbox:t.qrbox,aspectRatio:t.aspectRatio,disableFlip:t.disableFlip,videoConstraints:t.videoConstraints},n.qrCodeSuccessCallback,n.qrCodeErrorCallback).then(function(e){c.disabled=!1,c.style.display="inline-block",d(!1);var t=n.html5Qrcode.getRunningTrackCameraCapabilities();!0===r.config.showTorchButtonIfSupported&&h(t),!0===r.config.showZoomSliderIfSupported&&o(t)}).catch(function(e){n.showHideScanTypeSwapLink(!0),s.enable(),d(!0),n.setHeaderMessage(e,v.STATUS_WARNING)})}),s.hasSingleItem()&&u.click(),c.addEventListener("click",function(e){if(!n.html5Qrcode)throw"html5Qrcode not defined";c.disabled=!0,n.html5Qrcode.stop().then(function(e){r.scanTypeSelector.hasMoreThanOneScanType()&&n.showHideScanTypeSwapLink(!0),s.enable(),u.disabled=!1,c.style.display="none",u.style.display="inline-block",t&&(t.reset(),t.hide()),a.removeOnCameraZoomValueChangeCallback(),a.hide(),n.insertCameraScanImageToScanRegion()}).catch(function(e){c.disabled=!1,n.setHeaderMessage(e,v.STATUS_WARNING)})}),n.persistedDataManager.getLastUsedCameraId()){var f=n.persistedDataManager.getLastUsedCameraId();s.hasValue(f)?(s.setValue(f),u.click()):n.persistedDataManager.resetLastUsedCameraId()}},e_.prototype.createSectionSwap=function(){var e=this,t=I.textIfCameraScanSelected(),r=I.textIfFileScanSelected(),n=document.getElementById(this.getDashboardSectionId()),i=document.createElement("div");i.style.textAlign="center";var a=em.createElement("span",this.getDashboardSectionSwapLinkId());a.style.textDecoration="underline",a.style.cursor="pointer",a.innerText=eg.isCameraScanType(this.currentScanType)?t:r,a.addEventListener("click",function(){if(!e.sectionSwapAllowed){e.verbose&&e.logger.logError("Section swap called when not allowed");return}e.resetHeaderMessage(),e.fileSelectionUi.resetValue(),e.sectionSwapAllowed=!1,eg.isCameraScanType(e.currentScanType)?(e.clearScanRegion(),e.getCameraScanRegion().style.display="none",e.fileSelectionUi.show(),a.innerText=r,e.currentScanType=f.SCAN_TYPE_FILE,e.insertFileScanImageToScanRegion()):(e.clearScanRegion(),e.getCameraScanRegion().style.display="block",e.fileSelectionUi.hide(),a.innerText=t,e.currentScanType=f.SCAN_TYPE_CAMERA,e.insertCameraScanImageToScanRegion(),e.startCameraScanIfPermissionExistsOnSwap()),e.sectionSwapAllowed=!0}),i.appendChild(a),n.appendChild(i)},e_.prototype.startCameraScanIfPermissionExistsOnSwap=function(){var e=this,t=this;if(this.persistedDataManager.hasCameraPermissions())return void ef.hasPermissions().then(function(r){if(r){var n=document.getElementById(t.getCameraPermissionButtonId());if(!n)throw e.logger.logError("Permission button not found, fail;"),"Permission button not found";n.click()}else t.persistedDataManager.setHasPermission(!1)}).catch(function(e){t.persistedDataManager.setHasPermission(!1)})},e_.prototype.resetHeaderMessage=function(){document.getElementById(this.getHeaderMessageContainerId()).style.display="none"},e_.prototype.setHeaderMessage=function(e,t){t||(t=v.STATUS_DEFAULT);var r=this.getHeaderMessageDiv();switch(r.innerText=e,r.style.display="block",t){case v.STATUS_SUCCESS:r.style.background="rgba(106, 175, 80, 0.26)",r.style.color="#477735";break;case v.STATUS_WARNING:r.style.background="rgba(203, 36, 49, 0.14)",r.style.color="#cb2431";break;case v.STATUS_DEFAULT:default:r.style.background="rgba(0, 0, 0, 0)",r.style.color="rgb(17, 17, 17)"}},e_.prototype.showHideScanTypeSwapLink=function(e){this.scanTypeSelector.hasMoreThanOneScanType()&&(!0!==e&&(e=!1),this.sectionSwapAllowed=e,this.getDashboardSectionSwapLink().style.display=e?"inline-block":"none")},e_.prototype.insertCameraScanImageToScanRegion=function(){var e=this,t=document.getElementById(this.getScanRegionId());if(this.cameraScanImage){t.innerHTML="<br>",t.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(r){t.innerHTML="<br>",t.appendChild(e.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=ei,this.cameraScanImage.alt=I.cameraScanAltText()},e_.prototype.insertFileScanImageToScanRegion=function(){var e=this,t=document.getElementById(this.getScanRegionId());if(this.fileScanImage){t.innerHTML="<br>",t.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(r){t.innerHTML="<br>",t.appendChild(e.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=ea,this.fileScanImage.alt=I.fileScanAltText()},e_.prototype.clearScanRegion=function(){document.getElementById(this.getScanRegionId()).innerHTML=""},e_.prototype.getDashboardSectionId=function(){return"".concat(this.elementId,"__dashboard_section")},e_.prototype.getDashboardSectionCameraScanRegionId=function(){return"".concat(this.elementId,"__dashboard_section_csr")},e_.prototype.getDashboardSectionSwapLinkId=function(){return ep.SCAN_TYPE_CHANGE_ANCHOR_ID},e_.prototype.getScanRegionId=function(){return"".concat(this.elementId,"__scan_region")},e_.prototype.getDashboardId=function(){return"".concat(this.elementId,"__dashboard")},e_.prototype.getHeaderMessageContainerId=function(){return"".concat(this.elementId,"__header_message")},e_.prototype.getCameraPermissionButtonId=function(){return ep.CAMERA_PERMISSION_BUTTON_ID},e_.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},e_.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},e_.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())}},49255(e,t,r){!function(e){"use strict";let t;var n,i,a,o,s,l,u,c,h,d,f,g,p,v,y,w,E,b,A,C,_,S,I=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},T=function(e){function t(){this.constructor=r}function r(t){var r,n,i,a,o=this.constructor,s=e.call(this,t)||this;return Object.defineProperty(s,"name",{value:o.name,enumerable:!1}),r=o.prototype,(n=Object.setPrototypeOf)?n(s,r):s.__proto__=r,void 0===i&&(i=s.constructor),(a=Error.captureStackTrace)&&a(s,i),s}return I(r,e),r.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),r}(Error);class x extends T{constructor(e){super(e),this.message=e}getKind(){return this.constructor.kind}}x.kind="Exception";class D extends x{}D.kind="ArgumentException";class N extends x{}N.kind="IllegalArgumentException";class M{constructor(e){if(this.binarizer=e,null===e)throw new N("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(null===this.matrix||void 0===this.matrix)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,r,n){let i=this.binarizer.getLuminanceSource().crop(e,t,r,n);return new M(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new M(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new M(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class R extends x{static getChecksumInstance(){return new R}}R.kind="ChecksumException";class O{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class P{static arraycopy(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}static currentTimeMillis(){return Date.now()}}class B extends x{}B.kind="IndexOutOfBoundsException";class L extends B{constructor(e,t){super(t),this.index=e,this.message=t}}L.kind="ArrayIndexOutOfBoundsException";class k{static fill(e,t){for(let r=0,n=e.length;r<n;r++)e[r]=t}static fillWithin(e,t,r,n){k.rangeCheck(e.length,t,r);for(let i=t;i<r;i++)e[i]=n}static rangeCheck(e,t,r){if(t>r)throw new N("fromIndex("+t+") > toIndex("+r+")");if(t<0)throw new L(t);if(r>e)throw new L(r)}static asList(...e){return e}static create(e,t,r){return Array.from({length:e}).map(e=>Array.from({length:t}).fill(r))}static createInt32Array(e,t,r){return Array.from({length:e}).map(e=>Int32Array.from({length:t}).fill(r))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}static hashCode(e){if(null===e)return 0;let t=1;for(let r of e)t=31*t+r;return t}static fillUint8Array(e,t){for(let r=0;r!==e.length;r++)e[r]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){let r=new Uint8Array(t);return r.set(e),r}return e.slice(0,t)}static copyOfRange(e,t,r){let n=r-t,i=new Int32Array(n);return P.arraycopy(e,t,i,0,n),i}static binarySearch(e,t,r){void 0===r&&(r=k.numberComparator);let n=0,i=e.length-1;for(;n<=i;){let a=i+n>>1,o=r(t,e[a]);if(o>0)n=a+1;else{if(!(o<0))return a;i=a-1}}return-n-1}static numberComparator(e,t){return e-t}}class F{static numberOfTrailingZeros(e){let t;if(0===e)return 32;let r=31;return 0!=(t=e<<16)&&(r-=16,e=t),0!=(t=e<<8)&&(r-=8,e=t),0!=(t=e<<4)&&(r-=4,e=t),0!=(t=e<<2)&&(r-=2,e=t),r-(e<<1>>>31)}static numberOfLeadingZeros(e){if(0===e)return 32;let t=1;return e>>>16==0&&(t+=16,e<<=16),e>>>24==0&&(t+=8,e<<=8),e>>>28==0&&(t+=4,e<<=4),e>>>30==0&&(t+=2,e<<=2),t-=e>>>31}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e-=e>>>1&0x55555555,e=(e=(0x33333333&e)+(e>>>2&0x33333333))+(e>>>4)&0xf0f0f0f,e+=e>>>8,63&(e+=e>>>16)}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t){return parseInt(e,t)}}F.MIN_VALUE_32_BITS=-0x80000000,F.MAX_VALUE=Number.MAX_SAFE_INTEGER;class z{constructor(e,t){void 0===e?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,null==t?this.bits=z.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>32*this.bits.length){let t=z.makeArray(e);P.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(31&e))!=0}set(e){this.bits[Math.floor(e/32)]|=1<<(31&e)}flip(e){this.bits[Math.floor(e/32)]^=1<<(31&e)}getNextSet(e){let t=this.size;if(e>=t)return t;let r=this.bits,n=Math.floor(e/32),i=r[n];i&=~((1<<(31&e))-1);let a=r.length;for(;0===i;){if(++n===a)return t;i=r[n]}let o=32*n+F.numberOfTrailingZeros(i);return o>t?t:o}getNextUnset(e){let t=this.size;if(e>=t)return t;let r=this.bits,n=Math.floor(e/32),i=~r[n];i&=~((1<<(31&e))-1);let a=r.length;for(;0===i;){if(++n===a)return t;i=~r[n]}let o=32*n+F.numberOfTrailingZeros(i);return o>t?t:o}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new N;if(t===e)return;let r=Math.floor(e/32),n=Math.floor(--t/32),i=this.bits;for(let a=r;a<=n;a++){let o=a>r?0:31&e,s=(2<<(a<n?31:31&t))-(1<<o);i[a]|=s}}clear(){let e=this.bits.length,t=this.bits;for(let r=0;r<e;r++)t[r]=0}isRange(e,t,r){if(t<e||e<0||t>this.size)throw new N;if(t===e)return!0;let n=Math.floor(e/32),i=Math.floor(--t/32),a=this.bits;for(let o=n;o<=i;o++){let s=o>n?0:31&e,l=(2<<(o<i?31:31&t))-(1<<s)|0;if((a[o]&l)!==(r?l:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(e,t){if(t<0||t>32)throw new N("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let r=t;r>0;r--)this.appendBit((e>>r-1&1)==1)}appendBitArray(e){let t=e.size;this.ensureCapacity(this.size+t);for(let r=0;r<t;r++)this.appendBit(e.get(r))}xor(e){if(this.size!==e.size)throw new N("Sizes don't match");let t=this.bits;for(let r=0,n=t.length;r<n;r++)t[r]^=e.bits[r]}toBytes(e,t,r,n){for(let i=0;i<n;i++){let n=0;for(let t=0;t<8;t++)this.get(e)&&(n|=1<<7-t),e++;t[r+i]=n}}getBitArray(){return this.bits}reverse(){let e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),r=t+1,n=this.bits;for(let i=0;i<r;i++){let r=n[i];r=(r=(r=(r=(r=r>>1&0x55555555|(0x55555555&r)<<1)>>2&0x33333333|(0x33333333&r)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&r)<<4)>>8&0xff00ff|(0xff00ff&r)<<8)>>16&65535|(65535&r)<<16,e[t-i]=r}if(this.size!==32*r){let t=32*r-this.size,n=e[0]>>>t;for(let i=1;i<r;i++){let r=e[i];n|=r<<32-t,e[i-1]=n,n=r>>>t}e[r-1]=n}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){return e instanceof z&&this.size===e.size&&k.equals(this.bits,e.bits)}hashCode(){return 31*this.size+k.hashCode(this.bits)}toString(){let e="";for(let t=0,r=this.size;t<r;t++)(7&t)==0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new z(this.size,this.bits.slice())}}(n=g||(g={}))[n.OTHER=0]="OTHER",n[n.PURE_BARCODE=1]="PURE_BARCODE",n[n.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",n[n.TRY_HARDER=3]="TRY_HARDER",n[n.CHARACTER_SET=4]="CHARACTER_SET",n[n.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",n[n.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",n[n.ASSUME_GS1=7]="ASSUME_GS1",n[n.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",n[n.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",n[n.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS";var U=g;class V extends x{static getFormatInstance(){return new V}}V.kind="FormatException",(i=p||(p={}))[i.Cp437=0]="Cp437",i[i.ISO8859_1=1]="ISO8859_1",i[i.ISO8859_2=2]="ISO8859_2",i[i.ISO8859_3=3]="ISO8859_3",i[i.ISO8859_4=4]="ISO8859_4",i[i.ISO8859_5=5]="ISO8859_5",i[i.ISO8859_6=6]="ISO8859_6",i[i.ISO8859_7=7]="ISO8859_7",i[i.ISO8859_8=8]="ISO8859_8",i[i.ISO8859_9=9]="ISO8859_9",i[i.ISO8859_10=10]="ISO8859_10",i[i.ISO8859_11=11]="ISO8859_11",i[i.ISO8859_13=12]="ISO8859_13",i[i.ISO8859_14=13]="ISO8859_14",i[i.ISO8859_15=14]="ISO8859_15",i[i.ISO8859_16=15]="ISO8859_16",i[i.SJIS=16]="SJIS",i[i.Cp1250=17]="Cp1250",i[i.Cp1251=18]="Cp1251",i[i.Cp1252=19]="Cp1252",i[i.Cp1256=20]="Cp1256",i[i.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",i[i.UTF8=22]="UTF8",i[i.ASCII=23]="ASCII",i[i.Big5=24]="Big5",i[i.GB18030=25]="GB18030",i[i.EUC_KR=26]="EUC_KR";class H{constructor(e,t,r,...n){this.valueIdentifier=e,this.name=r,"number"==typeof t?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=n,H.VALUE_IDENTIFIER_TO_ECI.set(e,this),H.NAME_TO_ECI.set(r,this);const i=this.values;for(let e=0,t=i.length;e!==t;e++){const t=i[e];H.VALUES_TO_ECI.set(t,this)}for(const e of n)H.NAME_TO_ECI.set(e,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new V("incorect value");let t=H.VALUES_TO_ECI.get(e);if(void 0===t)throw new V("incorect value");return t}static getCharacterSetECIByName(e){let t=H.NAME_TO_ECI.get(e);if(void 0===t)throw new V("incorect value");return t}equals(e){return e instanceof H&&this.getName()===e.getName()}}H.VALUE_IDENTIFIER_TO_ECI=new Map,H.VALUES_TO_ECI=new Map,H.NAME_TO_ECI=new Map,H.Cp437=new H(p.Cp437,Int32Array.from([0,2]),"Cp437"),H.ISO8859_1=new H(p.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),H.ISO8859_2=new H(p.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),H.ISO8859_3=new H(p.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),H.ISO8859_4=new H(p.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),H.ISO8859_5=new H(p.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),H.ISO8859_6=new H(p.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),H.ISO8859_7=new H(p.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),H.ISO8859_8=new H(p.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),H.ISO8859_9=new H(p.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),H.ISO8859_10=new H(p.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),H.ISO8859_11=new H(p.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),H.ISO8859_13=new H(p.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),H.ISO8859_14=new H(p.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),H.ISO8859_15=new H(p.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),H.ISO8859_16=new H(p.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),H.SJIS=new H(p.SJIS,20,"SJIS","Shift_JIS"),H.Cp1250=new H(p.Cp1250,21,"Cp1250","windows-1250"),H.Cp1251=new H(p.Cp1251,22,"Cp1251","windows-1251"),H.Cp1252=new H(p.Cp1252,23,"Cp1252","windows-1252"),H.Cp1256=new H(p.Cp1256,24,"Cp1256","windows-1256"),H.UnicodeBigUnmarked=new H(p.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),H.UTF8=new H(p.UTF8,26,"UTF8","UTF-8"),H.ASCII=new H(p.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),H.Big5=new H(p.Big5,28,"Big5"),H.GB18030=new H(p.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),H.EUC_KR=new H(p.EUC_KR,30,"EUC_KR","EUC-KR");class j extends x{}j.kind="UnsupportedOperationException";class Y{static decode(e,t){let r=this.encodingName(t);return this.customDecoder?this.customDecoder(e,r):"u"<typeof TextDecoder||this.shouldDecodeOnFallback(r)?this.decodeFallback(e,r):new TextDecoder(r).decode(e)}static shouldDecodeOnFallback(e){return!Y.isBrowser()&&"ISO-8859-1"===e}static encode(e,t){let r=this.encodingName(t);return this.customEncoder?this.customEncoder(e,r):"u"<typeof TextEncoder?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return"u">typeof window&&"[object Window]"===({}).toString.call(window)}static encodingName(e){return"string"==typeof e?e:e.getName()}static encodingCharacterSet(e){return e instanceof H?e:H.getCharacterSetECIByName(e)}static decodeFallback(e,t){let r=this.encodingCharacterSet(t);if(Y.isDecodeFallbackSupported(r)){let t="";for(let r=0,n=e.length;r<n;r++){let n=e[r].toString(16);n.length<2&&(n="0"+n),t+="%"+n}return decodeURIComponent(t)}if(r.equals(H.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new j(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(H.UTF8)||e.equals(H.ISO8859_1)||e.equals(H.ASCII)}static encodeFallback(e){let t=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let e=0;e<t.length;e++)r.push(t[e].charCodeAt(0));return new Uint8Array(r)}}class X{static castAsNonUtf8Char(e,t=null){let r=t?t.getName():this.ISO88591;return Y.decode(new Uint8Array([e]),r)}static guessEncoding(e,t){if(null!=t&&void 0!==t.get(U.CHARACTER_SET))return t.get(U.CHARACTER_SET).toString();let r=e.length,n=!0,i=!0,a=!0,o=0,s=0,l=0,u=0,c=0,h=0,d=0,f=0,g=0,p=0,v=0,y=e.length>3&&239===e[0]&&187===e[1]&&191===e[2];for(let t=0;t<r&&(n||i||a);t++){let r=255&e[t];a&&(o>0?(128&r)==0?a=!1:o--:(128&r)!=0&&((64&r)==0?a=!1:(o++,(32&r)==0?s++:(o++,(16&r)==0?l++:(o++,(8&r)==0?u++:a=!1))))),n&&(r>127&&r<160?n=!1:r>159&&(r<192||215===r||247===r)&&v++),i&&(c>0?r<64||127===r||r>252?i=!1:c--:128===r||160===r||r>239?i=!1:r>160&&r<224?(h++,f=0,++d>g&&(g=d)):r>127?(c++,d=0,++f>p&&(p=f)):(d=0,f=0))}return(a&&o>0&&(a=!1),i&&c>0&&(i=!1),a&&(y||s+l+u>0))?X.UTF8:i&&(X.ASSUME_SHIFT_JIS||g>=3||p>=3)?X.SHIFT_JIS:n&&i?2===g&&2===h||10*v>=r?X.SHIFT_JIS:X.ISO88591:n?X.ISO88591:i?X.SHIFT_JIS:a?X.UTF8:X.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let r=-1;return e.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,function(e,n,i,a,o,s){let l;if("%%"===e)return"%";if(void 0===t[++r])return;e=a?parseInt(a.substr(1)):void 0;let u=o?parseInt(o.substr(1)):void 0;switch(s){case"s":l=t[r];break;case"c":l=t[r][0];break;case"f":l=parseFloat(t[r]).toFixed(e);break;case"p":l=parseFloat(t[r]).toPrecision(e);break;case"e":l=parseFloat(t[r]).toExponential(e);break;case"x":l=parseInt(t[r]).toString(u||16);break;case"d":l=parseFloat(parseInt(t[r],u||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(u);let c=parseInt(i),h=i&&i[0]+""=="0"?"0":" ";for(;l.length<c;)l=void 0!==n?l+h:h+l;return l})}static getBytes(e,t){return Y.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}X.SHIFT_JIS=H.SJIS.getName(),X.GB2312="GB2312",X.ISO88591=H.ISO8859_1.getName(),X.EUC_JP="EUC_JP",X.UTF8=H.UTF8.getName(),X.PLATFORM_DEFAULT_ENCODING=X.UTF8,X.ASSUME_SHIFT_JIS=!1;class G{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return"string"==typeof e?this.value+=e.toString():this.encoding?this.value+=X.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,r){for(let n=t;t<t+r;n++)this.append(e[n]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class W{constructor(e,t,r,n){if(this.width=e,this.height=t,this.rowSize=r,this.bits=n,null==t&&(t=e),this.height=t,e<1||t<1)throw new N("Both dimensions must be greater than 0");null==r&&(r=Math.floor((e+31)/32)),this.rowSize=r,null==n&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){let t=e.length,r=e[0].length,n=new W(r,t);for(let i=0;i<t;i++){let t=e[i];for(let e=0;e<r;e++)t[e]&&n.set(e,i)}return n}static parseFromString(e,t,r){if(null===e)throw new N("stringRepresentation cannot be null");let n=Array(e.length),i=0,a=0,o=-1,s=0,l=0;for(;l<e.length;)if("\n"===e.charAt(l)||"\r"===e.charAt(l)){if(i>a){if(-1===o)o=i-a;else if(i-a!==o)throw new N("row lengths do not match");a=i,s++}l++}else if(e.substring(l,l+t.length)===t)l+=t.length,n[i]=!0,i++;else if(e.substring(l,l+r.length)===r)l+=r.length,n[i]=!1,i++;else throw new N("illegal character encountered: "+e.substring(l));if(i>a){if(-1===o)o=i-a;else if(i-a!==o)throw new N("row lengths do not match");s++}let u=new W(o,s);for(let e=0;e<i;e++)n[e]&&u.set(Math.floor(e%o),Math.floor(e/o));return u}get(e,t){let r=t*this.rowSize+Math.floor(e/32);return(this.bits[r]>>>(31&e)&1)!=0}set(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]|=1<<(31&e)}unset(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]&=~(1<<(31&e))}flip(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]^=1<<(31&e)}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new N("input matrix dimensions do not match");let t=new z(Math.floor(this.width/32)+1),r=this.rowSize,n=this.bits;for(let i=0,a=this.height;i<a;i++){let a=i*r,o=e.getRow(i,t).getBitArray();for(let e=0;e<r;e++)n[a+e]^=o[e]}}clear(){let e=this.bits,t=e.length;for(let r=0;r<t;r++)e[r]=0}setRegion(e,t,r,n){if(t<0||e<0)throw new N("Left and top must be nonnegative");if(n<1||r<1)throw new N("Height and width must be at least 1");let i=e+r,a=t+n;if(a>this.height||i>this.width)throw new N("The region must fit inside the matrix");let o=this.rowSize,s=this.bits;for(let r=t;r<a;r++){let t=r*o;for(let r=e;r<i;r++)s[t+Math.floor(r/32)]|=1<<(31&r)}}getRow(e,t){null==t||t.getSize()<this.width?t=new z(this.width):t.clear();let r=this.rowSize,n=this.bits,i=e*r;for(let e=0;e<r;e++)t.setBulk(32*e,n[i+e]);return t}setRow(e,t){P.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){let e=this.getWidth(),t=this.getHeight(),r=new z(e),n=new z(e);for(let e=0,i=Math.floor((t+1)/2);e<i;e++)r=this.getRow(e,r),n=this.getRow(t-1-e,n),r.reverse(),n.reverse(),this.setRow(e,n),this.setRow(t-1-e,r)}getEnclosingRectangle(){let e=this.width,t=this.height,r=this.rowSize,n=this.bits,i=e,a=t,o=-1,s=-1;for(let e=0;e<t;e++)for(let t=0;t<r;t++){let l=n[e*r+t];if(0!==l){if(e<a&&(a=e),e>s&&(s=e),32*t<i){let e=0;for(;l<<31-e==0;)e++;32*t+e<i&&(i=32*t+e)}if(32*t+31>o){let e=31;for(;l>>>e==0;)e--;32*t+e>o&&(o=32*t+e)}}}return o<i||s<a?null:Int32Array.from([i,a,o-i+1,s-a+1])}getTopLeftOnBit(){let e=this.rowSize,t=this.bits,r=0;for(;r<t.length&&0===t[r];)r++;if(r===t.length)return null;let n=r/e,i=r%e*32,a=t[r],o=0;for(;a<<31-o==0;)o++;return i+=o,Int32Array.from([i,n])}getBottomRightOnBit(){let e=this.rowSize,t=this.bits,r=t.length-1;for(;r>=0&&0===t[r];)r--;if(r<0)return null;let n=Math.floor(r/e),i=32*Math.floor(r%e),a=t[r],o=31;for(;a>>>o==0;)o--;return i+=o,Int32Array.from([i,n])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){return e instanceof W&&this.width===e.width&&this.height===e.height&&this.rowSize===e.rowSize&&k.equals(this.bits,e.bits)}hashCode(){let e=this.width;return 31*(e=31*(e=31*(e=31*e+this.width)+this.height)+this.rowSize)+k.hashCode(this.bits)}toString(e="X ",t=" ",r="\n"){return this.buildToString(e,t,r)}buildToString(e,t,r){let n=new G;for(let i=0,a=this.height;i<a;i++){for(let r=0,a=this.width;r<a;r++)n.append(this.get(r,i)?e:t);n.append(r)}return n.toString()}clone(){return new W(this.width,this.height,this.rowSize,this.bits.slice())}}class q extends x{static getNotFoundInstance(){return new q}}q.kind="NotFoundException";class Z extends O{constructor(e){super(e),this.luminances=Z.EMPTY,this.buckets=new Int32Array(Z.LUMINANCE_BUCKETS)}getBlackRow(e,t){let r=this.getLuminanceSource(),n=r.getWidth();null==t||t.getSize()<n?t=new z(n):t.clear(),this.initArrays(n);let i=r.getRow(e,this.luminances),a=this.buckets;for(let e=0;e<n;e++)a[(255&i[e])>>Z.LUMINANCE_SHIFT]++;let o=Z.estimateBlackPoint(a);if(n<3)for(let e=0;e<n;e++)(255&i[e])<o&&t.set(e);else{let e=255&i[0],r=255&i[1];for(let a=1;a<n-1;a++){let n=255&i[a+1];(4*r-e-n)/2<o&&t.set(a),e=r,r=n}}return t}getBlackMatrix(){let e=this.getLuminanceSource(),t=e.getWidth(),r=e.getHeight(),n=new W(t,r);this.initArrays(t);let i=this.buckets;for(let n=1;n<5;n++){let a=Math.floor(r*n/5),o=e.getRow(a,this.luminances),s=Math.floor(4*t/5);for(let e=Math.floor(t/5);e<s;e++){let t=255&o[e];i[t>>Z.LUMINANCE_SHIFT]++}}let a=Z.estimateBlackPoint(i),o=e.getMatrix();for(let e=0;e<r;e++){let r=e*t;for(let i=0;i<t;i++)(255&o[r+i])<a&&n.set(i,e)}return n}createBinarizer(e){return new Z(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));let t=this.buckets;for(let e=0;e<Z.LUMINANCE_BUCKETS;e++)t[e]=0}static estimateBlackPoint(e){let t=e.length,r=0,n=0,i=0;for(let a=0;a<t;a++)e[a]>i&&(n=a,i=e[a]),e[a]>r&&(r=e[a]);let a=0,o=0;for(let r=0;r<t;r++){let t=r-n,i=e[r]*t*t;i>o&&(a=r,o=i)}if(n>a){let e=n;n=a,a=e}if(a-n<=t/16)throw new q;let s=a-1,l=-1;for(let t=a-1;t>n;t--){let i=t-n,o=i*i*(a-t)*(r-e[t]);o>l&&(s=t,l=o)}return s<<Z.LUMINANCE_SHIFT}}Z.LUMINANCE_BITS=5,Z.LUMINANCE_SHIFT=8-Z.LUMINANCE_BITS,Z.LUMINANCE_BUCKETS=1<<Z.LUMINANCE_BITS,Z.EMPTY=Uint8ClampedArray.from([0]);class Q extends Z{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;let e=this.getLuminanceSource(),t=e.getWidth(),r=e.getHeight();if(t>=Q.MINIMUM_DIMENSION&&r>=Q.MINIMUM_DIMENSION){let n=e.getMatrix(),i=t>>Q.BLOCK_SIZE_POWER;(t&Q.BLOCK_SIZE_MASK)!=0&&i++;let a=r>>Q.BLOCK_SIZE_POWER;(r&Q.BLOCK_SIZE_MASK)!=0&&a++;let o=Q.calculateBlackPoints(n,i,a,t,r),s=new W(t,r);Q.calculateThresholdForBlock(n,i,a,t,r,o,s),this.matrix=s}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new Q(e)}static calculateThresholdForBlock(e,t,r,n,i,a,o){let s=i-Q.BLOCK_SIZE,l=n-Q.BLOCK_SIZE;for(let i=0;i<r;i++){let u=i<<Q.BLOCK_SIZE_POWER;u>s&&(u=s);let c=Q.cap(i,2,r-3);for(let r=0;r<t;r++){let i=r<<Q.BLOCK_SIZE_POWER;i>l&&(i=l);let s=Q.cap(r,2,t-3),h=0;for(let e=-2;e<=2;e++){let t=a[c+e];h+=t[s-2]+t[s-1]+t[s]+t[s+1]+t[s+2]}let d=h/25;Q.thresholdBlock(e,i,u,d,n,o)}}}static cap(e,t,r){return e<t?t:e>r?r:e}static thresholdBlock(e,t,r,n,i,a){for(let o=0,s=r*i+t;o<Q.BLOCK_SIZE;o++,s+=i)for(let i=0;i<Q.BLOCK_SIZE;i++)(255&e[s+i])<=n&&a.set(t+i,r+o)}static calculateBlackPoints(e,t,r,n,i){let a=i-Q.BLOCK_SIZE,o=n-Q.BLOCK_SIZE,s=Array(r);for(let i=0;i<r;i++){s[i]=new Int32Array(t);let r=i<<Q.BLOCK_SIZE_POWER;r>a&&(r=a);for(let a=0;a<t;a++){let t=a<<Q.BLOCK_SIZE_POWER;t>o&&(t=o);let l=0,u=255,c=0;for(let i=0,a=r*n+t;i<Q.BLOCK_SIZE;i++,a+=n){for(let t=0;t<Q.BLOCK_SIZE;t++){let r=255&e[a+t];l+=r,r<u&&(u=r),r>c&&(c=r)}if(c-u>Q.MIN_DYNAMIC_RANGE)for(i++,a+=n;i<Q.BLOCK_SIZE;i++,a+=n)for(let t=0;t<Q.BLOCK_SIZE;t++)l+=255&e[a+t]}let h=l>>2*Q.BLOCK_SIZE_POWER;if(c-u<=Q.MIN_DYNAMIC_RANGE&&(h=u/2,i>0&&a>0)){let e=(s[i-1][a]+2*s[i][a-1]+s[i-1][a-1])/4;u<e&&(h=e)}s[i][a]=h}}return s}}Q.BLOCK_SIZE_POWER=3,Q.BLOCK_SIZE=1<<Q.BLOCK_SIZE_POWER,Q.BLOCK_SIZE_MASK=Q.BLOCK_SIZE-1,Q.MINIMUM_DIMENSION=5*Q.BLOCK_SIZE,Q.MIN_DYNAMIC_RANGE=24;class K{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,r,n){throw new j("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new j("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new j("This luminance source does not support rotation by 45 degrees.")}toString(){let e=new Uint8ClampedArray(this.width),t=new G;for(let r=0;r<this.height;r++){let n=this.getRow(r,e);for(let e=0;e<this.width;e++){let r,i=255&n[e];r=i<64?"#":i<128?"+":i<192?".":" ",t.append(r)}t.append("\n")}return t.toString()}}class $ extends K{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){let r=this.delegate.getRow(e,t),n=this.getWidth();for(let e=0;e<n;e++)r[e]=255-(255&r[e]);return r}getMatrix(){let e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),r=new Uint8ClampedArray(t);for(let n=0;n<t;n++)r[n]=255-(255&e[n]);return r}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,r,n){return new $(this.delegate.crop(e,t,r,n))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new $(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new $(this.delegate.rotateCounterClockwise45())}}class J extends K{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=J.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){let t=e.getContext("2d").getImageData(0,0,e.width,e.height);return J.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,r){let n=new Uint8ClampedArray(t*r);for(let t=0,r=0,i=e.length;t<i;t+=4,r++){let i;i=0===e[t+3]?255:306*e[t]+601*e[t+1]+117*e[t+2]+512>>10,n[r]=i}return n}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);let r=this.getWidth(),n=e*r;return null===t?t=this.buffer.slice(n,n+r):(t.length<r&&(t=new Uint8ClampedArray(r)),t.set(this.buffer.slice(n,n+r))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,r,n){return super.crop(e,t,r,n),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(null===this.tempCanvasElement){let e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){let t=this.getTempCanvasElement(),r=t.getContext("2d"),n=e*J.DEGREE_TO_RADIANS,i=this.canvas.width,a=this.canvas.height,o=Math.ceil(Math.abs(Math.cos(n))*i+Math.abs(Math.sin(n))*a),s=Math.ceil(Math.abs(Math.sin(n))*i+Math.abs(Math.cos(n))*a);return t.width=o,t.height=s,r.translate(o/2,s/2),r.rotate(n),r.drawImage(this.canvas,-(i/2),-(a/2)),this.buffer=J.makeBufferFromCanvasImageData(t),this}invert(){return new $(this)}}J.DEGREE_TO_RADIANS=Math.PI/180;class ee{constructor(e,t,r){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=r||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var et=(globalThis||r.g||self||window||void 0)&&(globalThis||r.g||self||window||void 0).__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,s)}l((n=n.apply(e,t||[])).next())})};class er{constructor(e,t=500,r){this.reader=e,this.timeBetweenScansMillis=t,this._hints=r,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return"u">typeof navigator}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return et(this,void 0,void 0,function*(){if(!this.hasNavigator)throw Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw Error("Can't enumerate devices, method not supported.");let e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(let r of e){let e="video"===r.kind?"videoinput":r.kind;if("videoinput"!==e)continue;let n=r.deviceId||r.id,i={deviceId:n,label:r.label||`Video device ${t.length+1}`,kind:e,groupId:r.groupId};t.push(i)}return t})}getVideoInputDevices(){return et(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(e=>new ee(e.deviceId,e.label))})}findDeviceById(e){return et(this,void 0,void 0,function*(){let t=yield this.listVideoInputDevices();return t?t.find(t=>t.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return et(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return et(this,void 0,void 0,function*(){return this.reset(),yield this.decodeOnceFromConstraints({video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},t)})}decodeOnceFromConstraints(e,t){return et(this,void 0,void 0,function*(){let r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(r,t)})}decodeOnceFromStream(e,t){return et(this,void 0,void 0,function*(){this.reset();let r=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(r)})}decodeFromInputVideoDeviceContinuously(e,t,r){return et(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,r)})}decodeFromVideoDevice(e,t,r){return et(this,void 0,void 0,function*(){return yield this.decodeFromConstraints({video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},t,r)})}decodeFromConstraints(e,t,r){return et(this,void 0,void 0,function*(){let n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(n,t,r)})}decodeFromStream(e,t,r){return et(this,void 0,void 0,function*(){this.reset();let n=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(n,r)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return et(this,void 0,void 0,function*(){let r=this.prepareVideoElement(t);return this.addVideoSource(r,e),this.videoElement=r,this.stream=e,yield this.playVideoOnLoadAsync(r),r})}playVideoOnLoadAsync(e){return new Promise((t,r)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return et(this,void 0,void 0,function*(){if(this.isVideoPlaying(e))return void console.warn("Trying to play video that is already playing.");try{yield e.play()}catch(e){console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){let r=document.getElementById(e);if(!r)throw new D(`element with id '${e}' not found`);if(r.nodeName.toLowerCase()!==t.toLowerCase())throw new D(`element with id '${e}' must be an ${t} element`);return r}decodeFromImage(e,t){if(!e&&!t)throw new D("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new D("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,r){if(void 0===e&&void 0===t)throw new D("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,r):this.decodeFromVideoElementContinuously(e,r)}decodeFromImageElement(e){if(!e)throw new D("An image element must be provided.");this.reset();let t=this.prepareImageElement(e);return this.imageElement=t,this.isImageLoaded(t)?this.decodeOnce(t,!1,!0):this._decodeOnLoadImage(t)}decodeFromVideoElement(e){let t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){let r=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(r,t)}_decodeFromVideoElementSetup(e){if(!e)throw new D("A video element must be provided.");this.reset();let t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new D("An URL must be provided.");this.reset();let t=this.prepareImageElement();this.imageElement=t;let r=this._decodeOnLoadImage(t);return t.src=e,r}decodeFromVideoUrl(e){if(!e)throw new D("An URL must be provided.");this.reset();let t=this.prepareVideoElement(),r=this.decodeFromVideoElement(t);return t.src=e,r}decodeFromVideoUrlContinuously(e,t){if(!e)throw new D("An URL must be provided.");this.reset();let r=this.prepareVideoElement(),n=this.decodeFromVideoElementContinuously(r,t);return r.src=e,n}_decodeOnLoadImage(e){return new Promise((t,r)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,r),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return et(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return et(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!!e.complete&&0!==e.naturalWidth}prepareImageElement(e){let t;return void 0===e&&((t=document.createElement("img")).width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&"u">typeof document&&((t=document.createElement("video")).width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,r=!0){this._stopAsyncDecode=!1;let n=(i,a)=>{if(this._stopAsyncDecode){a(new q("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{let t=this.decode(e);i(t)}catch(s){let e=t&&s instanceof q,o=s instanceof R||s instanceof V;if(e||o&&r)return setTimeout(n,this._timeBetweenDecodingAttempts,i,a);a(s)}};return new Promise((e,t)=>n(e,t))}decodeContinuously(e,t){this._stopContinuousDecode=!1;let r=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{let n=this.decode(e);t(n,null),setTimeout(r,this.timeBetweenScansMillis)}catch(i){t(null,i);let e=i instanceof R||i instanceof V,n=i instanceof q;(e||n)&&setTimeout(r,this._timeBetweenDecodingAttempts)}};r()}decode(e){let t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return 0!==e.videoWidth}drawFrameOnCanvas(e,t,r){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),r||(r=this.captureCanvasContext),r.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,r=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),r||(r=this.captureCanvasContext),r.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){return this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e),new M(new Q(new J(this.getCaptureCanvas(e))))}getCaptureCanvasContext(e){if(!this.captureCanvasContext){let t=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=t}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){let t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){let t,r;if("u"<typeof document)return this._destroyCaptureCanvas(),null;let n=document.createElement("canvas");return void 0!==e&&(e instanceof HTMLVideoElement?(t=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(t=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),n.style.width=t+"px",n.style.height=r+"px",n.width=t,n.height=r,n}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch(r){e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}class en{constructor(e,t,r=null==t?0:8*t.length,n,i,a=P.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=r,this.resultPoints=n,this.format=i,this.timestamp=a,this.text=e,this.rawBytes=t,null==r?this.numBits=null==t?0:8*t.length:this.numBits=r,this.resultPoints=n,this.format=i,this.resultMetadata=null,null==a?this.timestamp=P.currentTimeMillis():this.timestamp=a}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){null!==e&&(null===this.resultMetadata?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){let t=this.resultPoints;if(null===t)this.resultPoints=e;else if(null!==e&&e.length>0){let r=Array(t.length+e.length);P.arraycopy(t,0,r,0,t.length),P.arraycopy(e,0,r,t.length,e.length),this.resultPoints=r}}getTimestamp(){return this.timestamp}toString(){return this.text}}(a=v||(v={}))[a.AZTEC=0]="AZTEC",a[a.CODABAR=1]="CODABAR",a[a.CODE_39=2]="CODE_39",a[a.CODE_93=3]="CODE_93",a[a.CODE_128=4]="CODE_128",a[a.DATA_MATRIX=5]="DATA_MATRIX",a[a.EAN_8=6]="EAN_8",a[a.EAN_13=7]="EAN_13",a[a.ITF=8]="ITF",a[a.MAXICODE=9]="MAXICODE",a[a.PDF_417=10]="PDF_417",a[a.QR_CODE=11]="QR_CODE",a[a.RSS_14=12]="RSS_14",a[a.RSS_EXPANDED=13]="RSS_EXPANDED",a[a.UPC_A=14]="UPC_A",a[a.UPC_E=15]="UPC_E",a[a.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION";var ei=v;(o=y||(y={}))[o.OTHER=0]="OTHER",o[o.ORIENTATION=1]="ORIENTATION",o[o.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",o[o.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",o[o.ISSUE_NUMBER=4]="ISSUE_NUMBER",o[o.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",o[o.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",o[o.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",o[o.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",o[o.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",o[o.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY";var ea=y;class eo{constructor(e,t,r,n,i=-1,a=-1){this.rawBytes=e,this.text=t,this.byteSegments=r,this.ecLevel=n,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=a,this.numBits=null==e?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class es{exp(e){return this.expTable[e]}log(e){if(0===e)throw new N;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class el{constructor(e,t){if(0===t.length)throw new N;this.field=e;const r=t.length;if(r>1&&0===t[0]){let e=1;for(;e<r&&0===t[e];)e++;e===r?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(r-e),P.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){let t;if(0===e)return this.getCoefficient(0);let r=this.coefficients;if(1===e){t=0;for(let e=0,n=r.length;e!==n;e++){let n=r[e];t=es.addOrSubtract(t,n)}return t}t=r[0];let n=r.length,i=this.field;for(let a=1;a<n;a++)t=es.addOrSubtract(i.multiply(e,t),r[a]);return t}addOrSubtract(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,r=e.coefficients;if(t.length>r.length){let e=t;t=r,r=e}let n=new Int32Array(r.length),i=r.length-t.length;P.arraycopy(r,0,n,0,i);for(let e=i;e<r.length;e++)n[e]=es.addOrSubtract(t[e-i],r[e]);return new el(this.field,n)}multiply(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();let t=this.coefficients,r=t.length,n=e.coefficients,i=n.length,a=new Int32Array(r+i-1),o=this.field;for(let e=0;e<r;e++){let r=t[e];for(let t=0;t<i;t++)a[e+t]=es.addOrSubtract(a[e+t],o.multiply(r,n[t]))}return new el(o,a)}multiplyScalar(e){if(0===e)return this.field.getZero();if(1===e)return this;let t=this.coefficients.length,r=this.field,n=new Int32Array(t),i=this.coefficients;for(let a=0;a<t;a++)n[a]=r.multiply(i[a],e);return new el(r,n)}multiplyByMonomial(e,t){if(e<0)throw new N;if(0===t)return this.field.getZero();let r=this.coefficients,n=r.length,i=new Int32Array(n+e),a=this.field;for(let e=0;e<n;e++)i[e]=a.multiply(r[e],t);return new el(a,i)}divide(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new N("Divide by 0");let t=this.field,r=t.getZero(),n=this,i=e.getCoefficient(e.getDegree()),a=t.inverse(i);for(;n.getDegree()>=e.getDegree()&&!n.isZero();){let i=n.getDegree()-e.getDegree(),o=t.multiply(n.getCoefficient(n.getDegree()),a),s=e.multiplyByMonomial(i,o),l=t.buildMonomial(i,o);r=r.addOrSubtract(l),n=n.addOrSubtract(s)}return[r,n]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let r=this.getCoefficient(t);if(0!==r){if(r<0?(e+=" - ",r=-r):e.length>0&&(e+=" + "),0===t||1!==r){let t=this.field.log(r);0===t?e+="1":1===t?e+="a":(e+="a^",e+=t)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e}}class eu extends x{}eu.kind="ArithmeticException";class ec extends es{constructor(e,t,r){super(),this.primitive=e,this.size=t,this.generatorBase=r;const n=new Int32Array(t);let i=1;for(let r=0;r<t;r++)n[r]=i,(i*=2)>=t&&(i^=e,i&=t-1);this.expTable=n;const a=new Int32Array(t);for(let e=0;e<t-1;e++)a[n[e]]=e;this.logTable=a,this.zero=new el(this,Int32Array.from([0])),this.one=new el(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new N;if(0===t)return this.zero;let r=new Int32Array(e+1);return r[0]=t,new el(this,r)}inverse(e){if(0===e)throw new eu;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+F.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}ec.AZTEC_DATA_12=new ec(4201,4096,1),ec.AZTEC_DATA_10=new ec(1033,1024,1),ec.AZTEC_DATA_6=new ec(67,64,1),ec.AZTEC_PARAM=new ec(19,16,1),ec.QR_CODE_FIELD_256=new ec(285,256,0),ec.DATA_MATRIX_FIELD_256=new ec(301,256,1),ec.AZTEC_DATA_8=ec.DATA_MATRIX_FIELD_256,ec.MAXICODE_FIELD_64=ec.AZTEC_DATA_6;class eh extends x{}eh.kind="ReedSolomonException";class ed extends x{}ed.kind="IllegalStateException";class ef{constructor(e){this.field=e}decode(e,t){let r=this.field,n=new el(r,e),i=new Int32Array(t),a=!0;for(let e=0;e<t;e++){let t=n.evaluateAt(r.exp(e+r.getGeneratorBase()));i[i.length-1-e]=t,0!==t&&(a=!1)}if(a)return;let o=new el(r,i),s=this.runEuclideanAlgorithm(r.buildMonomial(t,1),o,t),l=s[0],u=s[1],c=this.findErrorLocations(l),h=this.findErrorMagnitudes(u,c);for(let t=0;t<c.length;t++){let n=e.length-1-r.log(c[t]);if(n<0)throw new eh("Bad error location");e[n]=ec.addOrSubtract(e[n],h[t])}}runEuclideanAlgorithm(e,t,r){if(e.getDegree()<t.getDegree()){let r=e;e=t,t=r}let n=this.field,i=e,a=t,o=n.getZero(),s=n.getOne();for(;a.getDegree()>=(r/2|0);){let e=i,t=o;if(i=a,o=s,i.isZero())throw new eh("r_{i-1} was zero");a=e;let r=n.getZero(),l=i.getCoefficient(i.getDegree()),u=n.inverse(l);for(;a.getDegree()>=i.getDegree()&&!a.isZero();){let e=a.getDegree()-i.getDegree(),t=n.multiply(a.getCoefficient(a.getDegree()),u);r=r.addOrSubtract(n.buildMonomial(e,t)),a=a.addOrSubtract(i.multiplyByMonomial(e,t))}if(s=r.multiply(o).addOrSubtract(t),a.getDegree()>=i.getDegree())throw new ed("Division algorithm failed to reduce polynomial?")}let l=s.getCoefficient(0);if(0===l)throw new eh("sigmaTilde(0) was zero");let u=n.inverse(l);return[s.multiplyScalar(u),a.multiplyScalar(u)]}findErrorLocations(e){let t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);let r=new Int32Array(t),n=0,i=this.field;for(let a=1;a<i.getSize()&&n<t;a++)0===e.evaluateAt(a)&&(r[n]=i.inverse(a),n++);if(n!==t)throw new eh("Error locator degree does not match number of roots");return r}findErrorMagnitudes(e,t){let r=t.length,n=new Int32Array(r),i=this.field;for(let a=0;a<r;a++){let o=i.inverse(t[a]),s=1;for(let e=0;e<r;e++)if(a!==e){let r=i.multiply(t[e],o),n=(1&r)==0?1|r:-2&r;s=i.multiply(s,n)}n[a]=i.multiply(e.evaluateAt(o),i.inverse(s)),0!==i.getGeneratorBase()&&(n[a]=i.multiply(n[a],o))}return n}}(s=w||(w={}))[s.UPPER=0]="UPPER",s[s.LOWER=1]="LOWER",s[s.MIXED=2]="MIXED",s[s.DIGIT=3]="DIGIT",s[s.PUNCT=4]="PUNCT",s[s.BINARY=5]="BINARY";class eg{decode(e){this.ddata=e;let t=e.getBits(),r=this.extractBits(t),n=this.correctBits(r),i=new eo(eg.convertBoolArrayToByteArray(n),eg.getEncodedData(n),null,null);return i.setNumBits(n.length),i}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,r=w.UPPER,n=w.UPPER,i="",a=0;for(;a<t;)if(n===w.BINARY){if(t-a<5)break;let o=eg.readCode(e,a,5);if(a+=5,0===o){if(t-a<11)break;o=eg.readCode(e,a,11)+31,a+=11}for(let r=0;r<o;r++){if(t-a<8){a=t;break}let r=eg.readCode(e,a,8);i+=X.castAsNonUtf8Char(r),a+=8}n=r}else{let o=n===w.DIGIT?4:5;if(t-a<o)break;let s=eg.readCode(e,a,o);a+=o;let l=eg.getCharacter(n,s);l.startsWith("CTRL_")?(r=n,n=eg.getTable(l.charAt(5)),"L"===l.charAt(6)&&(r=n)):(i+=l,n=r)}return i}static getTable(e){switch(e){case"L":return w.LOWER;case"P":return w.PUNCT;case"M":return w.MIXED;case"D":return w.DIGIT;case"B":return w.BINARY;default:return w.UPPER}}static getCharacter(e,t){switch(e){case w.UPPER:return eg.UPPER_TABLE[t];case w.LOWER:return eg.LOWER_TABLE[t];case w.MIXED:return eg.MIXED_TABLE[t];case w.PUNCT:return eg.PUNCT_TABLE[t];case w.DIGIT:return eg.DIGIT_TABLE[t];default:throw new ed("Bad table")}}correctBits(e){let t,r;2>=this.ddata.getNbLayers()?(r=6,t=ec.AZTEC_DATA_6):8>=this.ddata.getNbLayers()?(r=8,t=ec.AZTEC_DATA_8):22>=this.ddata.getNbLayers()?(r=10,t=ec.AZTEC_DATA_10):(r=12,t=ec.AZTEC_DATA_12);let n=this.ddata.getNbDatablocks(),i=e.length/r;if(i<n)throw new V;let a=e.length%r,o=new Int32Array(i);for(let t=0;t<i;t++,a+=r)o[t]=eg.readCode(e,a,r);try{new ef(t).decode(o,i-n)}catch(e){throw new V(e)}let s=(1<<r)-1,l=0;for(let e=0;e<n;e++){let t=o[e];if(0===t||t===s)throw new V;(1===t||t===s-1)&&l++}let u=Array(n*r-l),c=0;for(let e=0;e<n;e++){let t=o[e];if(1===t||t===s-1)u.fill(t>1,c,c+r-1),c+=r-1;else for(let e=r-1;e>=0;--e)u[c++]=(t&1<<e)!=0}return u}extractBits(e){let t=this.ddata.isCompact(),r=this.ddata.getNbLayers(),n=(t?11:14)+4*r,i=new Int32Array(n),a=Array(this.totalBitsInLayer(r,t));if(t)for(let e=0;e<i.length;e++)i[e]=e;else{let e=n+1+2*F.truncDivision(F.truncDivision(n,2)-1,15),t=n/2,r=F.truncDivision(e,2);for(let e=0;e<t;e++){let n=e+F.truncDivision(e,15);i[t-e-1]=r-n-1,i[t+e]=r+n+1}}for(let o=0,s=0;o<r;o++){let l=(r-o)*4+(t?9:12),u=2*o,c=n-1-u;for(let t=0;t<l;t++){let r=2*t;for(let n=0;n<2;n++)a[s+r+n]=e.get(i[u+n],i[u+t]),a[s+2*l+r+n]=e.get(i[u+t],i[c-n]),a[s+4*l+r+n]=e.get(i[c-n],i[c-t]),a[s+6*l+r+n]=e.get(i[c-t],i[u+n])}s+=8*l}return a}static readCode(e,t,r){let n=0;for(let i=t;i<t+r;i++)n<<=1,e[i]&&(n|=1);return n}static readByte(e,t){let r=e.length-t;return r>=8?eg.readCode(e,t,8):eg.readCode(e,t,r)<<8-r}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let r=0;r<t.length;r++)t[r]=eg.readByte(e,8*r);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}eg.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],eg.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],eg.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ","\n","\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],eg.PUNCT_TABLE=["","\r","\r\n",". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],eg.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ep{static round(e){return e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,r,n){let i=e-r,a=t-n;return Math.sqrt(i*i+a*a)}static sum(e){let t=0;for(let r=0,n=e.length;r!==n;r++)t+=e[r];return t}}class em{static floatToIntBits(e){return e}}em.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ev{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){return e instanceof ev&&this.x===e.x&&this.y===e.y}hashCode(){return 31*em.floatToIntBits(this.x)+em.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){let t,r,n,i=this.distance(e[0],e[1]),a=this.distance(e[1],e[2]),o=this.distance(e[0],e[2]);if(a>=i&&a>=o?(r=e[0],t=e[1],n=e[2]):o>=a&&o>=i?(r=e[1],t=e[0],n=e[2]):(r=e[2],t=e[0],n=e[1]),0>this.crossProductZ(t,r,n)){let e=t;t=n,n=e}e[0]=t,e[1]=r,e[2]=n}static distance(e,t){return ep.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,r){let n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}}class ey{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class ew extends ey{constructor(e,t,r,n,i){super(e,t),this.compact=r,this.nbDatablocks=n,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class eE{constructor(e,t,r,n){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==t&&(t=eE.INIT_SIZE),null==r&&(r=e.getWidth()/2|0),null==n&&(n=e.getHeight()/2|0);const i=t/2|0;if(this.leftInit=r-i,this.rightInit=r+i,this.upInit=n-i,this.downInit=n+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new q}detect(){let e=this.leftInit,t=this.rightInit,r=this.upInit,n=this.downInit,i=!1,a=!0,o=!1,s=!1,l=!1,u=!1,c=!1,h=this.width,d=this.height;for(;a;){a=!1;let f=!0;for(;(f||!s)&&t<h;)(f=this.containsBlackPoint(r,n,t,!1))?(t++,a=!0,s=!0):!s&&t++;if(t>=h){i=!0;break}let g=!0;for(;(g||!l)&&n<d;)(g=this.containsBlackPoint(e,t,n,!0))?(n++,a=!0,l=!0):!l&&n++;if(n>=d){i=!0;break}let p=!0;for(;(p||!u)&&e>=0;)(p=this.containsBlackPoint(r,n,e,!1))?(e--,a=!0,u=!0):!u&&e--;if(e<0){i=!0;break}let v=!0;for(;(v||!c)&&r>=0;)(v=this.containsBlackPoint(e,t,r,!0))?(r--,a=!0,c=!0):!c&&r--;if(r<0){i=!0;break}a&&(o=!0)}if(!i&&o){let i=t-e,a=null;for(let t=1;null===a&&t<i;t++)a=this.getBlackPointOnSegment(e,n-t,e+t,n);if(null==a)throw new q;let o=null;for(let t=1;null===o&&t<i;t++)o=this.getBlackPointOnSegment(e,r+t,e+t,r);if(null==o)throw new q;let s=null;for(let e=1;null===s&&e<i;e++)s=this.getBlackPointOnSegment(t,r+e,t-e,r);if(null==s)throw new q;let l=null;for(let e=1;null===l&&e<i;e++)l=this.getBlackPointOnSegment(t,n-e,t-e,n);if(null==l)throw new q;return this.centerEdges(l,a,s,o)}throw new q}getBlackPointOnSegment(e,t,r,n){let i=ep.round(ep.distance(e,t,r,n)),a=(r-e)/i,o=(n-t)/i,s=this.image;for(let r=0;r<i;r++){let n=ep.round(e+r*a),i=ep.round(t+r*o);if(s.get(n,i))return new ev(n,i)}return null}centerEdges(e,t,r,n){let i=e.getX(),a=e.getY(),o=t.getX(),s=t.getY(),l=r.getX(),u=r.getY(),c=n.getX(),h=n.getY(),d=eE.CORR;return i<this.width/2?[new ev(c-d,h+d),new ev(o+d,s+d),new ev(l-d,u-d),new ev(i+d,a-d)]:[new ev(c+d,h+d),new ev(o+d,s-d),new ev(l-d,u+d),new ev(i-d,a-d)]}containsBlackPoint(e,t,r,n){let i=this.image;if(n){for(let n=e;n<=t;n++)if(i.get(n,r))return!0}else for(let n=e;n<=t;n++)if(i.get(r,n))return!0;return!1}}eE.INIT_SIZE=10,eE.CORR=1;class eb{static checkAndNudgePoints(e,t){let r=e.getWidth(),n=e.getHeight(),i=!0;for(let e=0;e<t.length&&i;e+=2){let a=Math.floor(t[e]),o=Math.floor(t[e+1]);if(a<-1||a>r||o<-1||o>n)throw new q;i=!1,-1===a?(t[e]=0,i=!0):a===r&&(t[e]=r-1,i=!0),-1===o?(t[e+1]=0,i=!0):o===n&&(t[e+1]=n-1,i=!0)}i=!0;for(let e=t.length-2;e>=0&&i;e-=2){let a=Math.floor(t[e]),o=Math.floor(t[e+1]);if(a<-1||a>r||o<-1||o>n)throw new q;i=!1,-1===a?(t[e]=0,i=!0):a===r&&(t[e]=r-1,i=!0),-1===o?(t[e+1]=0,i=!0):o===n&&(t[e+1]=n-1,i=!0)}}}class eA{constructor(e,t,r,n,i,a,o,s,l){this.a11=e,this.a21=t,this.a31=r,this.a12=n,this.a22=i,this.a32=a,this.a13=o,this.a23=s,this.a33=l}static quadrilateralToQuadrilateral(e,t,r,n,i,a,o,s,l,u,c,h,d,f,g,p){let v=eA.quadrilateralToSquare(e,t,r,n,i,a,o,s);return eA.squareToQuadrilateral(l,u,c,h,d,f,g,p).times(v)}transformPoints(e){let t=e.length,r=this.a11,n=this.a12,i=this.a13,a=this.a21,o=this.a22,s=this.a23,l=this.a31,u=this.a32,c=this.a33;for(let h=0;h<t;h+=2){let t=e[h],d=e[h+1],f=i*t+s*d+c;e[h]=(r*t+a*d+l)/f,e[h+1]=(n*t+o*d+u)/f}}transformPointsWithValues(e,t){let r=this.a11,n=this.a12,i=this.a13,a=this.a21,o=this.a22,s=this.a23,l=this.a31,u=this.a32,c=this.a33,h=e.length;for(let d=0;d<h;d++){let h=e[d],f=t[d],g=i*h+s*f+c;e[d]=(r*h+a*f+l)/g,t[d]=(n*h+o*f+u)/g}}static squareToQuadrilateral(e,t,r,n,i,a,o,s){let l=e-r+i-o,u=t-n+a-s;if(0===l&&0===u)return new eA(r-e,i-r,e,n-t,a-n,t,0,0,1);{let c=r-i,h=o-i,d=n-a,f=s-a,g=c*f-h*d,p=(l*f-h*u)/g,v=(c*u-l*d)/g;return new eA(r-e+p*r,o-e+v*o,e,n-t+p*n,s-t+v*s,t,p,v,1)}}static quadrilateralToSquare(e,t,r,n,i,a,o,s){return eA.squareToQuadrilateral(e,t,r,n,i,a,o,s).buildAdjoint()}buildAdjoint(){return new eA(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new eA(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class eC extends eb{sampleGrid(e,t,r,n,i,a,o,s,l,u,c,h,d,f,g,p,v,y,w){let E=eA.quadrilateralToQuadrilateral(n,i,a,o,s,l,u,c,h,d,f,g,p,v,y,w);return this.sampleGridWithTransform(e,t,r,E)}sampleGridWithTransform(e,t,r,n){if(t<=0||r<=0)throw new q;let i=new W(t,r),a=new Float32Array(2*t);for(let t=0;t<r;t++){let r=a.length,o=t+.5;for(let e=0;e<r;e+=2)a[e]=e/2+.5,a[e+1]=o;n.transformPoints(a),eb.checkAndNudgePoints(e,a);try{for(let n=0;n<r;n+=2)e.get(Math.floor(a[n]),Math.floor(a[n+1]))&&i.set(n/2,t)}catch(e){throw new q}}return i}}class e_{static setGridSampler(e){e_.gridSampler=e}static getInstance(){return e_.gridSampler}}e_.gridSampler=new eC;class eS{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new ev(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class eI{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),r=this.getBullsEyeCorners(t);if(e){let e=r[0];r[0]=r[2],r[2]=e}return this.extractParameters(r),new ew(this.sampleGrid(this.image,r[this.shift%4],r[(this.shift+1)%4],r[(this.shift+2)%4],r[(this.shift+3)%4]),this.getMatrixCornerPoints(r),this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new q;let t=2*this.nbCenterLayers,r=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(r,t);let n=0;for(let e=0;e<4;e++){let t=r[(this.shift+e)%4];this.compact?(n<<=7,n+=t>>1&127):(n<<=10,n+=(t>>2&992)+(t>>1&31))}let i=this.getCorrectedParameterData(n,this.compact);this.compact?(this.nbLayers=(i>>6)+1,this.nbDataBlocks=(63&i)+1):(this.nbLayers=(i>>11)+1,this.nbDataBlocks=(2047&i)+1)}getRotation(e,t){let r=0;e.forEach((e,n,i)=>{r=(r<<3)+((e>>t-2<<1)+(1&e))}),r=((1&r)<<11)+(r>>1);for(let e=0;e<4;e++)if(2>=F.bitCount(r^this.EXPECTED_CORNER_BITS[e]))return e;throw new q}getCorrectedParameterData(e,t){let r,n;t?(r=7,n=2):(r=10,n=4);let i=r-n,a=new Int32Array(r);for(let t=r-1;t>=0;--t)a[t]=15&e,e>>=4;try{new ef(ec.AZTEC_PARAM).decode(a,i)}catch(e){throw new q}let o=0;for(let e=0;e<n;e++)o=(o<<4)+a[e];return o}getBullsEyeCorners(e){let t=e,r=e,n=e,i=e,a=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let e=this.getFirstDifferent(t,a,1,-1),o=this.getFirstDifferent(r,a,1,1),s=this.getFirstDifferent(n,a,-1,1),l=this.getFirstDifferent(i,a,-1,-1);if(this.nbCenterLayers>2){let r=this.distancePoint(l,e)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(r<.75||r>1.25||!this.isWhiteOrBlackRectangle(e,o,s,l))break}t=e,r=o,n=s,i=l,a=!a}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new q;this.compact=5===this.nbCenterLayers;let o=new ev(t.getX()+.5,t.getY()-.5),s=new ev(r.getX()+.5,r.getY()+.5),l=new ev(n.getX()-.5,n.getY()+.5),u=new ev(i.getX()-.5,i.getY()-.5);return this.expandSquare([o,s,l,u],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,r,n;try{let i=new eE(this.image).detect();e=i[0],t=i[1],r=i[2],n=i[3]}catch(o){let i=this.image.getWidth()/2,a=this.image.getHeight()/2;e=this.getFirstDifferent(new eS(i+7,a-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new eS(i+7,a+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new eS(i-7,a+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new eS(i-7,a-7),!1,-1,-1).toResultPoint()}let i=ep.round((e.getX()+n.getX()+t.getX()+r.getX())/4),a=ep.round((e.getY()+n.getY()+t.getY()+r.getY())/4);try{let o=new eE(this.image,15,i,a).detect();e=o[0],t=o[1],r=o[2],n=o[3]}catch(o){e=this.getFirstDifferent(new eS(i+7,a-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new eS(i+7,a+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new eS(i-7,a+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new eS(i-7,a-7),!1,-1,-1).toResultPoint()}return new eS(i=ep.round((e.getX()+n.getX()+t.getX()+r.getX())/4),a=ep.round((e.getY()+n.getY()+t.getY()+r.getY())/4))}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,r,n,i){let a=e_.getInstance(),o=this.getDimension(),s=o/2-this.nbCenterLayers,l=o/2+this.nbCenterLayers;return a.sampleGrid(e,o,o,s,s,l,s,l,l,s,l,t.getX(),t.getY(),r.getX(),r.getY(),n.getX(),n.getY(),i.getX(),i.getY())}sampleLine(e,t,r){let n=0,i=this.distanceResultPoint(e,t),a=i/r,o=e.getX(),s=e.getY(),l=a*(t.getX()-e.getX())/i,u=a*(t.getY()-e.getY())/i;for(let e=0;e<r;e++)this.image.get(ep.round(o+e*l),ep.round(s+e*u))&&(n|=1<<r-e-1);return n}isWhiteOrBlackRectangle(e,t,r,n){e=new eS(e.getX()-3,e.getY()+3),t=new eS(t.getX()-3,t.getY()-3),r=new eS(r.getX()+3,r.getY()-3),n=new eS(n.getX()+3,n.getY()+3);let i=this.getColor(n,e);if(0===i)return!1;let a=this.getColor(e,t);return a===i&&(a=this.getColor(t,r))===i&&(a=this.getColor(r,n))===i}getColor(e,t){let r=this.distancePoint(e,t),n=(t.getX()-e.getX())/r,i=(t.getY()-e.getY())/r,a=0,o=e.getX(),s=e.getY(),l=this.image.get(e.getX(),e.getY()),u=Math.ceil(r);for(let e=0;e<u;e++)o+=n,s+=i,this.image.get(ep.round(o),ep.round(s))!==l&&a++;let c=a/r;return c>.1&&c<.9?0:c<=.1===l?1:-1}getFirstDifferent(e,t,r,n){let i=e.getX()+r,a=e.getY()+n;for(;this.isValid(i,a)&&this.image.get(i,a)===t;)i+=r,a+=n;for(i-=r,a-=n;this.isValid(i,a)&&this.image.get(i,a)===t;)i+=r;for(i-=r;this.isValid(i,a)&&this.image.get(i,a)===t;)a+=n;return new eS(i,a-=n)}expandSquare(e,t,r){let n=r/(2*t),i=e[0].getX()-e[2].getX(),a=e[0].getY()-e[2].getY(),o=(e[0].getX()+e[2].getX())/2,s=(e[0].getY()+e[2].getY())/2,l=new ev(o+n*i,s+n*a),u=new ev(o-n*i,s-n*a);return i=e[1].getX()-e[3].getX(),a=e[1].getY()-e[3].getY(),[l,new ev((o=(e[1].getX()+e[3].getX())/2)+n*i,(s=(e[1].getY()+e[3].getY())/2)+n*a),u,new ev(o-n*i,s-n*a)]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ep.round(e.getX()),r=ep.round(e.getY());return this.isValid(t,r)}distancePoint(e,t){return ep.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ep.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(F.truncDivision(this.nbLayers-4,8)+1)+15}}class eT{decode(e,t=null){let r=null,n=new eI(e.getBlackMatrix()),i=null,a=null;try{let e=n.detectMirror(!1);i=e.getPoints(),this.reportFoundResultPoints(t,i),a=new eg().decode(e)}catch(e){r=e}if(null==a)try{let e=n.detectMirror(!0);i=e.getPoints(),this.reportFoundResultPoints(t,i),a=new eg().decode(e)}catch(e){if(null!=r)throw r;throw e}let o=new en(a.getText(),a.getRawBytes(),a.getNumBits(),i,ei.AZTEC,P.currentTimeMillis()),s=a.getByteSegments();null!=s&&o.putMetadata(ea.BYTE_SEGMENTS,s);let l=a.getECLevel();return null!=l&&o.putMetadata(ea.ERROR_CORRECTION_LEVEL,l),o}reportFoundResultPoints(e,t){if(null!=e){let r=e.get(U.NEED_RESULT_POINT_CALLBACK);null!=r&&t.forEach((e,t,n)=>{r.foundPossibleResultPoint(e)})}}reset(){}}class ex{decode(e,t){try{return this.doDecode(e,t)}catch(r){if(t&&!0===t.get(U.TRY_HARDER)&&e.isRotateSupported()){let r=e.rotateCounterClockwise(),n=this.doDecode(r,t),i=n.getResultMetadata(),a=270;null!==i&&!0===i.get(ea.ORIENTATION)&&(a+=i.get(ea.ORIENTATION)%360),n.putMetadata(ea.ORIENTATION,a);let o=n.getResultPoints();if(null!==o){let e=r.getHeight();for(let t=0;t<o.length;t++)o[t]=new ev(e-o[t].getY()-1,o[t].getX())}return n}throw new q}}reset(){}doDecode(e,t){let r,n=e.getWidth(),i=e.getHeight(),a=new z(n),o=t&&!0===t.get(U.TRY_HARDER),s=Math.max(1,i>>(o?8:5));r=o?i:15;let l=Math.trunc(i/2);for(let o=0;o<r;o++){let r=Math.trunc((o+1)/2),u=l+s*((1&o)==0?r:-r);if(u<0||u>=i)break;try{a=e.getBlackRow(u,a)}catch(e){continue}for(let e=0;e<2;e++){if(1===e&&(a.reverse(),t&&!0===t.get(U.NEED_RESULT_POINT_CALLBACK))){let e=new Map;t.forEach((t,r)=>e.set(r,t)),e.delete(U.NEED_RESULT_POINT_CALLBACK),t=e}try{let r=this.decodeRow(u,a,t);if(1===e){r.putMetadata(ea.ORIENTATION,180);let e=r.getResultPoints();null!==e&&(e[0]=new ev(n-e[0].getX()-1,e[0].getY()),e[1]=new ev(n-e[1].getX()-1,e[1].getY()))}return r}catch(e){}}}throw new q}static recordPattern(e,t,r){let n=r.length;for(let e=0;e<n;e++)r[e]=0;let i=e.getSize();if(t>=i)throw new q;let a=!e.get(t),o=0,s=t;for(;s<i;){if(e.get(s)!==a)r[o]++;else if(++o===n)break;else r[o]=1,a=!a;s++}if(o!==n&&(o!==n-1||s!==i))throw new q}static recordPatternInReverse(e,t,r){let n=r.length,i=e.get(t);for(;t>0&&n>=0;)e.get(--t)!==i&&(n--,i=!i);if(n>=0)throw new q;ex.recordPattern(e,t+1,r)}static patternMatchVariance(e,t,r){let n=e.length,i=0,a=0;for(let r=0;r<n;r++)i+=e[r],a+=t[r];if(i<a)return 1/0;let o=i/a;r*=o;let s=0;for(let i=0;i<n;i++){let n=e[i],a=t[i]*o,l=n>a?n-a:a-n;if(l>r)return 1/0;s+=l}return s/i}}class eD extends ex{static findStartPattern(e){let t=e.getSize(),r=e.getNextSet(0),n=0,i=Int32Array.from([0,0,0,0,0,0]),a=r,o=!1;for(let s=r;s<t;s++)if(e.get(s)!==o)i[n]++;else{if(5===n){let t=eD.MAX_AVG_VARIANCE,r=-1;for(let e=eD.CODE_START_A;e<=eD.CODE_START_C;e++){let n=ex.patternMatchVariance(i,eD.CODE_PATTERNS[e],eD.MAX_INDIVIDUAL_VARIANCE);n<t&&(t=n,r=e)}if(r>=0&&e.isRange(Math.max(0,a-(s-a)/2),a,!1))return Int32Array.from([a,s,r]);a+=i[0]+i[1],(i=i.slice(2,i.length-1))[n-1]=0,i[n]=0,n--}else n++;i[n]=1,o=!o}throw new q}static decodeCode(e,t,r){ex.recordPattern(e,r,t);let n=eD.MAX_AVG_VARIANCE,i=-1;for(let e=0;e<eD.CODE_PATTERNS.length;e++){let r=eD.CODE_PATTERNS[e],a=this.patternMatchVariance(t,r,eD.MAX_INDIVIDUAL_VARIANCE);a<n&&(n=a,i=e)}if(i>=0)return i;throw new q}decodeRow(e,t,r){let n,i=r&&!0===r.get(U.ASSUME_GS1),a=eD.findStartPattern(t),o=a[2],s=0,l=new Uint8Array(20);switch(l[s++]=o,o){case eD.CODE_START_A:n=eD.CODE_CODE_A;break;case eD.CODE_START_B:n=eD.CODE_CODE_B;break;case eD.CODE_START_C:n=eD.CODE_CODE_C;break;default:throw new V}let u=!1,c=!1,h="",d=a[0],f=a[1],g=Int32Array.from([0,0,0,0,0,0]),p=0,v=0,y=o,w=0,E=!0,b=!1,A=!1;for(;!u;){let e=c;switch(c=!1,p=v,v=eD.decodeCode(t,g,f),l[s++]=v,v!==eD.CODE_STOP&&(E=!0),v!==eD.CODE_STOP&&(y+=++w*v),d=f,f+=g.reduce((e,t)=>e+t,0),v){case eD.CODE_START_A:case eD.CODE_START_B:case eD.CODE_START_C:throw new V}switch(n){case eD.CODE_CODE_A:if(v<64)A===b?h+=String.fromCharCode(32+v):h+=String.fromCharCode(32+v+128),A=!1;else if(v<96)A===b?h+=String.fromCharCode(v-64):h+=String.fromCharCode(v+64),A=!1;else switch(v!==eD.CODE_STOP&&(E=!1),v){case eD.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eD.CODE_FNC_2:case eD.CODE_FNC_3:break;case eD.CODE_FNC_4_A:!b&&A?(b=!0,A=!1):b&&A?(b=!1,A=!1):A=!0;break;case eD.CODE_SHIFT:c=!0,n=eD.CODE_CODE_B;break;case eD.CODE_CODE_B:n=eD.CODE_CODE_B;break;case eD.CODE_CODE_C:n=eD.CODE_CODE_C;break;case eD.CODE_STOP:u=!0}break;case eD.CODE_CODE_B:if(v<96)A===b?h+=String.fromCharCode(32+v):h+=String.fromCharCode(32+v+128),A=!1;else switch(v!==eD.CODE_STOP&&(E=!1),v){case eD.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eD.CODE_FNC_2:case eD.CODE_FNC_3:break;case eD.CODE_FNC_4_B:!b&&A?(b=!0,A=!1):b&&A?(b=!1,A=!1):A=!0;break;case eD.CODE_SHIFT:c=!0,n=eD.CODE_CODE_A;break;case eD.CODE_CODE_A:n=eD.CODE_CODE_A;break;case eD.CODE_CODE_C:n=eD.CODE_CODE_C;break;case eD.CODE_STOP:u=!0}break;case eD.CODE_CODE_C:if(v<100)v<10&&(h+="0"),h+=v;else switch(v!==eD.CODE_STOP&&(E=!1),v){case eD.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eD.CODE_CODE_A:n=eD.CODE_CODE_A;break;case eD.CODE_CODE_B:n=eD.CODE_CODE_B;break;case eD.CODE_STOP:u=!0}}e&&(n=n===eD.CODE_CODE_A?eD.CODE_CODE_B:eD.CODE_CODE_A)}let C=f-d;if(f=t.getNextUnset(f),!t.isRange(f,Math.min(t.getSize(),f+(f-d)/2),!1))throw new q;if((y-=w*p)%103!==p)throw new R;let _=h.length;if(0===_)throw new q;_>0&&E&&(h=n===eD.CODE_CODE_C?h.substring(0,_-2):h.substring(0,_-1));let S=(a[1]+a[0])/2,I=d+C/2,T=l.length,x=new Uint8Array(T);for(let e=0;e<T;e++)x[e]=l[e];return new en(h,x,0,[new ev(S,e),new ev(I,e)],ei.CODE_128,new Date().getTime())}}eD.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],eD.MAX_AVG_VARIANCE=.25,eD.MAX_INDIVIDUAL_VARIANCE=.7,eD.CODE_SHIFT=98,eD.CODE_CODE_C=99,eD.CODE_CODE_B=100,eD.CODE_CODE_A=101,eD.CODE_FNC_1=102,eD.CODE_FNC_2=97,eD.CODE_FNC_3=96,eD.CODE_FNC_4_A=101,eD.CODE_FNC_4_B=100,eD.CODE_START_A=103,eD.CODE_START_B=104,eD.CODE_START_C=105,eD.CODE_STOP=106;class eN extends ex{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,r){let n,i,a,o=this.counters;o.fill(0),this.decodeRowResult="";let s=eN.findAsteriskPattern(t,o),l=t.getNextSet(s[1]),u=t.getSize();do{eN.recordPattern(t,l,o);let e=eN.toNarrowWidePattern(o);if(e<0)throw new q;for(let t of(n=eN.patternToChar(e),this.decodeRowResult+=n,i=l,o))l+=t;l=t.getNextSet(l)}while("*"!==n);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let c=0;for(let e of o)c+=e;let h=l-i-c;if(l!==u&&2*h<c)throw new q;if(this.usingCheckDigit){let e=this.decodeRowResult.length-1,t=0;for(let r=0;r<e;r++)t+=eN.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(r));if(this.decodeRowResult.charAt(e)!==eN.ALPHABET_STRING.charAt(t%43))throw new R;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new q;a=this.extendedMode?eN.decodeExtended(this.decodeRowResult):this.decodeRowResult;let d=(s[1]+s[0])/2,f=i+c/2;return new en(a,null,0,[new ev(d,e),new ev(f,e)],ei.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let r=e.getSize(),n=e.getNextSet(0),i=0,a=n,o=!1,s=t.length;for(let l=n;l<r;l++)if(e.get(l)!==o)t[i]++;else{if(i===s-1){if(this.toNarrowWidePattern(t)===eN.ASTERISK_ENCODING&&e.isRange(Math.max(0,a-Math.floor((l-a)/2)),a,!1))return[a,l];a+=t[0]+t[1],t.copyWithin(0,2,2+i-1),t[i-1]=0,t[i]=0,i--}else i++;t[i]=1,o=!o}throw new q}static toNarrowWidePattern(e){let t,r=e.length,n=0;do{let i=0x7fffffff;for(let t of e)t<i&&t>n&&(i=t);n=i,t=0;let a=0,o=0;for(let i=0;i<r;i++){let s=e[i];s>n&&(o|=1<<r-1-i,t++,a+=s)}if(3===t){for(let i=0;i<r&&t>0;i++){let r=e[i];if(r>n&&(t--,2*r>=a))return -1}return o}}while(t>3);return -1}static patternToChar(e){for(let t=0;t<eN.CHARACTER_ENCODINGS.length;t++)if(eN.CHARACTER_ENCODINGS[t]===e)return eN.ALPHABET_STRING.charAt(t);if(e===eN.ASTERISK_ENCODING)return"*";throw new q}static decodeExtended(e){let t=e.length,r="";for(let n=0;n<t;n++){let t=e.charAt(n);if("+"===t||"$"===t||"%"===t||"/"===t){let i=e.charAt(n+1),a="\0";switch(t){case"+":if(i>="A"&&i<="Z")a=String.fromCharCode(i.charCodeAt(0)+32);else throw new V;break;case"$":if(i>="A"&&i<="Z")a=String.fromCharCode(i.charCodeAt(0)-64);else throw new V;break;case"%":if(i>="A"&&i<="E")a=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")a=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")a=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")a=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)a="\0";else if("V"===i)a="@";else if("W"===i)a="`";else if("X"===i||"Y"===i||"Z"===i)a="";else throw new V;break;case"/":if(i>="A"&&i<="O")a=String.fromCharCode(i.charCodeAt(0)-32);else if("Z"===i)a=":";else throw new V}r+=a,n++}else r+=t}return r}}eN.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",eN.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],eN.ASTERISK_ENCODING=148;class eM extends ex{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,r){let n=this.decodeStart(t),i=this.decodeEnd(t),a=new G;eM.decodeMiddle(t,n[1],i[0],a);let o=a.toString(),s=null;null!=r&&(s=r.get(U.ALLOWED_LENGTHS)),null==s&&(s=eM.DEFAULT_ALLOWED_LENGTHS);let l=o.length,u=!1,c=0;for(let e of s){if(l===e){u=!0;break}e>c&&(c=e)}if(!u&&l>c&&(u=!0),!u)throw new V;return new en(o,null,0,[new ev(n[1],e),new ev(i[0],e)],ei.ITF,new Date().getTime())}static decodeMiddle(e,t,r,n){let i=new Int32Array(10),a=new Int32Array(5),o=new Int32Array(5);for(i.fill(0),a.fill(0),o.fill(0);t<r;){ex.recordPattern(e,t,i);for(let e=0;e<5;e++){let t=2*e;a[e]=i[t],o[e]=i[t+1]}let r=eM.decodeDigit(a);n.append(r.toString()),r=this.decodeDigit(o),n.append(r.toString()),i.forEach(function(e){t+=e})}}decodeStart(e){let t=eM.skipWhiteSpace(e),r=eM.findGuardPattern(e,t,eM.START_PATTERN);return this.narrowLineWidth=(r[1]-r[0])/4,this.validateQuietZone(e,r[0]),r}validateQuietZone(e,t){let r=10*this.narrowLineWidth;r=r<t?r:t;for(let n=t-1;r>0&&n>=0&&!e.get(n);n--)r--;if(0!==r)throw new q}static skipWhiteSpace(e){let t=e.getSize(),r=e.getNextSet(0);if(r===t)throw new q;return r}decodeEnd(e){e.reverse();try{let t,r=eM.skipWhiteSpace(e);try{t=eM.findGuardPattern(e,r,eM.END_PATTERN_REVERSED[0])}catch(n){n instanceof q&&(t=eM.findGuardPattern(e,r,eM.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,t[0]);let n=t[0];return t[0]=e.getSize()-t[1],t[1]=e.getSize()-n,t}finally{e.reverse()}}static findGuardPattern(e,t,r){let n=r.length,i=new Int32Array(n),a=e.getSize(),o=!1,s=0,l=t;i.fill(0);for(let u=t;u<a;u++)if(e.get(u)!==o)i[s]++;else{if(s===n-1){if(ex.patternMatchVariance(i,r,eM.MAX_INDIVIDUAL_VARIANCE)<eM.MAX_AVG_VARIANCE)return[l,u];l+=i[0]+i[1],P.arraycopy(i,2,i,0,s-1),i[s-1]=0,i[s]=0,s--}else s++;i[s]=1,o=!o}throw new q}static decodeDigit(e){let t=eM.MAX_AVG_VARIANCE,r=-1,n=eM.PATTERNS.length;for(let i=0;i<n;i++){let n=eM.PATTERNS[i],a=ex.patternMatchVariance(e,n,eM.MAX_INDIVIDUAL_VARIANCE);a<t?(t=a,r=i):a===t&&(r=-1)}if(r>=0)return r%10;throw new q}}eM.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],eM.MAX_AVG_VARIANCE=.38,eM.MAX_INDIVIDUAL_VARIANCE=.5,eM.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],eM.START_PATTERN=Int32Array.from([1,1,1,1]),eM.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class eR extends ex{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t,r=!1,n=0,i=Int32Array.from([0,0,0]);for(;!r;){i=Int32Array.from([0,0,0]);let a=(t=eR.findGuardPattern(e,n,!1,this.START_END_PATTERN,i))[0],o=a-((n=t[1])-a);o>=0&&(r=e.isRange(o,a,!1))}return t}static checkChecksum(e){return eR.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let r=parseInt(e.charAt(t-1),10);return eR.getStandardUPCEANChecksum(e.substring(0,t-1))===r}static getStandardUPCEANChecksum(e){let t=e.length,r=0;for(let n=t-1;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new V;r+=t}r*=3;for(let n=t-2;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new V;r+=t}return(1e3-r)%10}static decodeEnd(e,t){return eR.findGuardPattern(e,t,!1,eR.START_END_PATTERN,new Int32Array(eR.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,r,n){return this.findGuardPattern(e,t,r,n,new Int32Array(n.length))}static findGuardPattern(e,t,r,n,i){let a=e.getSize();t=r?e.getNextUnset(t):e.getNextSet(t);let o=0,s=t,l=n.length,u=r;for(let r=t;r<a;r++)if(e.get(r)!==u)i[o]++;else{if(o===l-1){if(ex.patternMatchVariance(i,n,eR.MAX_INDIVIDUAL_VARIANCE)<eR.MAX_AVG_VARIANCE)return Int32Array.from([s,r]);s+=i[0]+i[1];let e=i.slice(2,i.length-1);for(let t=0;t<o-1;t++)i[t]=e[t];i[o-1]=0,i[o]=0,o--}else o++;i[o]=1,u=!u}throw new q}static decodeDigit(e,t,r,n){this.recordPattern(e,r,t);let i=this.MAX_AVG_VARIANCE,a=-1,o=n.length;for(let e=0;e<o;e++){let r=n[e],o=ex.patternMatchVariance(t,r,eR.MAX_INDIVIDUAL_VARIANCE);o<i&&(i=o,a=e)}if(a>=0)return a;throw new q}}eR.MAX_AVG_VARIANCE=.48,eR.MAX_INDIVIDUAL_VARIANCE=.7,eR.START_END_PATTERN=Int32Array.from([1,1,1]),eR.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),eR.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),eR.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class eO{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(t,r,n),a=n.toString(),o=eO.parseExtensionString(a),s=new en(a,null,0,[new ev((r[0]+r[1])/2,e),new ev(i,e)],ei.UPC_EAN_EXTENSION,new Date().getTime());return null!=o&&s.putAllMetadata(o),s}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1],o=0;for(let t=0;t<5&&a<i;t++){let i=eR.decodeDigit(e,n,a,eR.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))a+=e;i>=10&&(o|=1<<4-t),4!==t&&(a=e.getNextSet(a),a=e.getNextUnset(a))}if(5!==r.length)throw new q;let s=this.determineCheckDigit(o);if(eO.extensionChecksum(r.toString())!==s)throw new q;return a}static extensionChecksum(e){let t=e.length,r=0;for(let n=t-2;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-48;r*=3;for(let n=t-1;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-48;return(r*=3)%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new q}static parseExtensionString(e){if(5!==e.length)return null;let t=eO.parseExtension5String(e);return null==t?null:new Map([[ea.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="\xa3";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t=""}let r=parseInt(e.substring(1)),n=(r/100).toString(),i=r%100;return t+n+"."+(i<10?"0"+i:i.toString())}}class eP{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(t,r,n),a=n.toString(),o=eP.parseExtensionString(a),s=new en(a,null,0,[new ev((r[0]+r[1])/2,e),new ev(i,e)],ei.UPC_EAN_EXTENSION,new Date().getTime());return null!=o&&s.putAllMetadata(o),s}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1],o=0;for(let t=0;t<2&&a<i;t++){let i=eR.decodeDigit(e,n,a,eR.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))a+=e;i>=10&&(o|=1<<1-t),1!==t&&(a=e.getNextSet(a),a=e.getNextUnset(a))}if(2!==r.length||parseInt(r.toString())%4!==o)throw new q;return a}static parseExtensionString(e){return 2!==e.length?null:new Map([[ea.ISSUE_NUMBER,parseInt(e)]])}}class eB{static decodeRow(e,t,r){let n=eR.findGuardPattern(t,r,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new eO().decodeRow(e,t,n)}catch(r){return new eP().decodeRow(e,t,n)}}}eB.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class eL extends eR{constructor(){super(),this.decodeRowStringBuffer="",eL.L_AND_G_PATTERNS=eL.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=eL.L_PATTERNS[e-10],r=new Int32Array(t.length);for(let e=0;e<t.length;e++)r[e]=t[t.length-e-1];eL.L_AND_G_PATTERNS[e]=r}}decodeRow(e,t,r){let n=eL.findStartGuardPattern(t),i=null==r?null:r.get(U.NEED_RESULT_POINT_CALLBACK);if(null!=i){let t=new ev((n[0]+n[1])/2,e);i.foundPossibleResultPoint(t)}let a=this.decodeMiddle(t,n,this.decodeRowStringBuffer),o=a.rowOffset,s=a.resultString;if(null!=i){let t=new ev(o,e);i.foundPossibleResultPoint(t)}let l=this.decodeEnd(t,o);if(null!=i){let t=new ev((l[0]+l[1])/2,e);i.foundPossibleResultPoint(t)}let u=l[1],c=u+(u-l[0]);if(c>=t.getSize()||!t.isRange(u,c,!1))throw new q;let h=s.toString();if(h.length<8)throw new V;if(!eL.checkChecksum(h))throw new R;let d=(n[1]+n[0])/2,f=(l[1]+l[0])/2,g=this.getBarcodeFormat(),p=new en(h,null,0,[new ev(d,e),new ev(f,e)],g,new Date().getTime()),v=0;try{let r=eB.decodeRow(e,t,l[1]);p.putMetadata(ea.UPC_EAN_EXTENSION,r.getText()),p.putAllMetadata(r.getResultMetadata()),p.addResultPoints(r.getResultPoints()),v=r.getText().length}catch(e){}let y=null==r?null:r.get(U.ALLOWED_EAN_EXTENSIONS);if(null!=y){let e=!1;for(let t in y)if(v.toString()===t){e=!0;break}if(!e)throw new q}return p}decodeEnd(e,t){return eL.findGuardPattern(e,t,!1,eL.START_END_PATTERN,new Int32Array(eL.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return eL.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let r=parseInt(e.charAt(t-1),10);return eL.getStandardUPCEANChecksum(e.substring(0,t-1))===r}static getStandardUPCEANChecksum(e){let t=e.length,r=0;for(let n=t-1;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new V;r+=t}r*=3;for(let n=t-2;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new V;r+=t}return(1e3-r)%10}}class ek extends eL{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1],o=0;for(let t=0;t<6&&a<i;t++){let i=eL.decodeDigit(e,n,a,eL.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))a+=e;i>=10&&(o|=1<<5-t)}r=ek.determineFirstDigit(r,o),a=eL.findGuardPattern(e,a,!0,eL.MIDDLE_PATTERN,new Int32Array(eL.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<6&&a<i;t++){let t=eL.decodeDigit(e,n,a,eL.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))a+=e}return{rowOffset:a,resultString:r}}getBarcodeFormat(){return ei.EAN_13}static determineFirstDigit(e,t){for(let r=0;r<10;r++)if(t===this.FIRST_DIGIT_ENCODINGS[r])return e=String.fromCharCode(48+r)+e;throw new q}}ek.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class eF extends eL{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1];for(let t=0;t<4&&a<i;t++){let t=eL.decodeDigit(e,n,a,eL.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))a+=e}a=eL.findGuardPattern(e,a,!0,eL.MIDDLE_PATTERN,new Int32Array(eL.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<4&&a<i;t++){let t=eL.decodeDigit(e,n,a,eL.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))a+=e}return{rowOffset:a,resultString:r}}getBarcodeFormat(){return ei.EAN_8}}class ez extends eL{constructor(){super(...arguments),this.ean13Reader=new ek}getBarcodeFormat(){return ei.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,r){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,r))}decodeMiddle(e,t,r){return this.ean13Reader.decodeMiddle(e,t,r)}maybeReturnResult(e){let t=e.getText();if("0"===t.charAt(0)){let r=new en(t.substring(1),null,null,e.getResultPoints(),ei.UPC_A);return null!=e.getResultMetadata()&&r.putAllMetadata(e.getResultMetadata()),r}throw new q}reset(){this.ean13Reader.reset()}}class eU extends eL{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters.map(e=>e);n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),a=t[1],o=0;for(let t=0;t<6&&a<i;t++){let i=eU.decodeDigit(e,n,a,eU.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))a+=e;i>=10&&(o|=1<<5-t)}return{rowOffset:a,resultString:eU.determineNumSysAndCheckDigit(r,o)}}decodeEnd(e,t){return eU.findGuardPatternWithoutCounters(e,t,!0,eU.MIDDLE_END_PATTERN)}checkChecksum(e){return eL.checkChecksum(eU.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let r=0;r<=1;r++)for(let n=0;n<10;n++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[r][n])return String.fromCharCode(48+r)+e+String.fromCharCode(48+n);throw q.getNotFoundInstance()}getBarcodeFormat(){return ei.UPC_E}static convertUPCEtoUPCA(e){let t=e.slice(1,7).split("").map(e=>e.charCodeAt(0)),r=new G;r.append(e.charAt(0));let n=t[5];switch(n){case 0:case 1:case 2:r.appendChars(t,0,2),r.append(n),r.append("0000"),r.appendChars(t,2,3);break;case 3:r.appendChars(t,0,3),r.append("00000"),r.appendChars(t,3,2);break;case 4:r.appendChars(t,0,4),r.append("00000"),r.append(t[4]);break;default:r.appendChars(t,0,5),r.append("0000"),r.append(n)}return e.length>=8&&r.append(e.charAt(7)),r.toString()}}eU.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),eU.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class eV extends ex{constructor(e){super();let t=null==e?null:e.get(U.POSSIBLE_FORMATS),r=[];null==t?(r.push(new ek),r.push(new ez),r.push(new eF),r.push(new eU)):(t.indexOf(ei.EAN_13)>-1&&r.push(new ek),t.indexOf(ei.UPC_A)>-1&&r.push(new ez),t.indexOf(ei.EAN_8)>-1&&r.push(new eF),t.indexOf(ei.UPC_E)>-1&&r.push(new eU)),this.readers=r}decodeRow(e,t,r){for(let n of this.readers)try{let i=n.decodeRow(e,t,r),a=i.getBarcodeFormat()===ei.EAN_13&&"0"===i.getText().charAt(0),o=null==r?null:r.get(U.POSSIBLE_FORMATS),s=null==o||o.includes(ei.UPC_A);if(a&&s){let e=i.getRawBytes(),t=new en(i.getText().substring(1),e,e?e.length:null,i.getResultPoints(),ei.UPC_A);return t.putAllMetadata(i.getResultMetadata()),t}return i}catch(e){}throw new q}reset(){for(let e of this.readers)e.reset()}}class eH extends ex{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=[,,,,],this.evenRoundingErrors=[,,,,],this.oddCounts=Array(this.dataCharacterCounters.length/2),this.evenCounts=Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let r=0;r<t.length;r++)if(ex.patternMatchVariance(e,t[r],eH.MAX_INDIVIDUAL_VARIANCE)<eH.MAX_AVG_VARIANCE)return r;throw new q}static count(e){return ep.sum(new Int32Array(e))}static increment(e,t){let r=0,n=t[0];for(let i=1;i<e.length;i++)t[i]>n&&(n=t[i],r=i);e[r]++}static decrement(e,t){let r=0,n=t[0];for(let i=1;i<e.length;i++)t[i]<n&&(n=t[i],r=i);e[r]--}static isFinderPattern(e){let t=e[0]+e[1],r=t+e[2]+e[3],n=t/r;if(n>=eH.MIN_FINDER_PATTERN_RATIO&&n<=eH.MAX_FINDER_PATTERN_RATIO){let t=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;for(let n of e)n>r&&(r=n),n<t&&(t=n);return r<10*t}return!1}}eH.MAX_AVG_VARIANCE=.2,eH.MAX_INDIVIDUAL_VARIANCE=.45,eH.MIN_FINDER_PATTERN_RATIO=9.5/12,eH.MAX_FINDER_PATTERN_RATIO=12.5/14;class ej{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){return e instanceof ej&&this.value===e.value&&this.checksumPortion===e.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class eY{constructor(e,t,r,n,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=[],this.resultPoints.push(new ev(r,i)),this.resultPoints.push(new ev(n,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){return e instanceof eY&&this.value===e.value}hashCode(){return this.value}}class eX{static getRSSvalue(e,t,r){let n=0;for(let t of e)n+=t;let i=0,a=0,o=e.length;for(let s=0;s<o-1;s++){let l;for(l=1,a|=1<<s;l<e[s];l++,a&=~(1<<s)){let e=eX.combins(n-l-1,o-s-2);if(r&&0===a&&n-l-(o-s-1)>=o-s-1&&(e-=eX.combins(n-l-(o-s),o-s-2)),o-s-1>1){let r=0;for(let e=n-l-(o-s-2);e>t;e--)r+=eX.combins(n-l-e-1,o-s-3);e-=r*(o-1-s)}else n-l>t&&e--;i+=e}n-=l}return i}static combins(e,t){let r,n;e-t>t?(n=t,r=e-t):(n=e-t,r=t);let i=1,a=1;for(let t=e;t>r;t--)i*=t,a<=n&&(i/=a,a++);for(;a<=n;)i/=a,a++;return i}}class eG{static buildBitArray(e){let t=2*e.length-1;null==e[e.length-1].getRightChar()&&(t-=1);let r=new z(12*t),n=0,i=e[0].getRightChar().getValue();for(let e=11;e>=0;--e)(i&1<<e)!=0&&r.set(n),n++;for(let t=1;t<e.length;++t){let i=e[t],a=i.getLeftChar().getValue();for(let e=11;e>=0;--e)(a&1<<e)!=0&&r.set(n),n++;if(null!=i.getRightChar()){let e=i.getRightChar().getValue();for(let t=11;t>=0;--t)(e&1<<t)!=0&&r.set(n),n++}}return r}}class eW{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class eq{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class eZ extends eq{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===eZ.FNC1}}eZ.FNC1="$";class eQ extends eq{constructor(e,t,r){super(e),r?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class eK extends eq{constructor(e,t,r){if(super(e),t<0||t>10||r<0||r>10)throw new V;this.firstDigit=t,this.secondDigit=r}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===eK.FNC1}isSecondDigitFNC1(){return this.secondDigit===eK.FNC1}isAnyFNC1(){return this.firstDigit===eK.FNC1||this.secondDigit===eK.FNC1}}eK.FNC1=10;class e${static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new q;let t=e.substring(0,2);for(let r of e$.TWO_DIGIT_DATA_LENGTH)if(r[0]===t){if(r[1]===e$.VARIABLE_LENGTH)return e$.processVariableAI(2,r[2],e);return e$.processFixedAI(2,r[1],e)}if(e.length<3)throw new q;let r=e.substring(0,3);for(let t of e$.THREE_DIGIT_DATA_LENGTH)if(t[0]===r){if(t[1]===e$.VARIABLE_LENGTH)return e$.processVariableAI(3,t[2],e);return e$.processFixedAI(3,t[1],e)}for(let t of e$.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===r){if(t[1]===e$.VARIABLE_LENGTH)return e$.processVariableAI(4,t[2],e);return e$.processFixedAI(4,t[1],e)}if(e.length<4)throw new q;let n=e.substring(0,4);for(let t of e$.FOUR_DIGIT_DATA_LENGTH)if(t[0]===n){if(t[1]===e$.VARIABLE_LENGTH)return e$.processVariableAI(4,t[2],e);return e$.processFixedAI(4,t[1],e)}throw new q}static processFixedAI(e,t,r){if(r.length<e)throw new q;let n=r.substring(0,e);if(r.length<e+t)throw new q;let i=r.substring(e,e+t),a=r.substring(e+t),o="("+n+")"+i,s=e$.parseFieldsInGeneralPurpose(a);return null==s?o:o+s}static processVariableAI(e,t,r){let n,i=r.substring(0,e);n=r.length<e+t?r.length:e+t;let a=r.substring(e,n),o=r.substring(n),s="("+i+")"+a,l=e$.parseFieldsInGeneralPurpose(o);return null==l?s:s+l}}e$.VARIABLE_LENGTH=[],e$.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",e$.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",e$.VARIABLE_LENGTH,20],["22",e$.VARIABLE_LENGTH,29],["30",e$.VARIABLE_LENGTH,8],["37",e$.VARIABLE_LENGTH,8],["90",e$.VARIABLE_LENGTH,30],["91",e$.VARIABLE_LENGTH,30],["92",e$.VARIABLE_LENGTH,30],["93",e$.VARIABLE_LENGTH,30],["94",e$.VARIABLE_LENGTH,30],["95",e$.VARIABLE_LENGTH,30],["96",e$.VARIABLE_LENGTH,30],["97",e$.VARIABLE_LENGTH,3],["98",e$.VARIABLE_LENGTH,30],["99",e$.VARIABLE_LENGTH,30]],e$.THREE_DIGIT_DATA_LENGTH=[["240",e$.VARIABLE_LENGTH,30],["241",e$.VARIABLE_LENGTH,30],["242",e$.VARIABLE_LENGTH,6],["250",e$.VARIABLE_LENGTH,30],["251",e$.VARIABLE_LENGTH,30],["253",e$.VARIABLE_LENGTH,17],["254",e$.VARIABLE_LENGTH,20],["400",e$.VARIABLE_LENGTH,30],["401",e$.VARIABLE_LENGTH,30],["402",17],["403",e$.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",e$.VARIABLE_LENGTH,20],["421",e$.VARIABLE_LENGTH,15],["422",3],["423",e$.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],e$.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",e$.VARIABLE_LENGTH,15],["391",e$.VARIABLE_LENGTH,18],["392",e$.VARIABLE_LENGTH,15],["393",e$.VARIABLE_LENGTH,18],["703",e$.VARIABLE_LENGTH,30]],e$.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",e$.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",e$.VARIABLE_LENGTH,20],["8003",e$.VARIABLE_LENGTH,30],["8004",e$.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",e$.VARIABLE_LENGTH,30],["8008",e$.VARIABLE_LENGTH,12],["8018",18],["8020",e$.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",e$.VARIABLE_LENGTH,70],["8200",e$.VARIABLE_LENGTH,70]];class eJ{constructor(e){this.buffer=new G,this.information=e}decodeAllCodes(e,t){let r=t,n=null;for(;;){let t=this.decodeGeneralPurposeField(r,n),i=e$.parseFieldsInGeneralPurpose(t.getNewString());if(null!=i&&e.append(i),n=t.isRemaining()?""+t.getRemainingValue():null,r===t.getNewPosition())break;r=t.getNewPosition()}return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let t=this.extractNumericValueFromBitArray(e,4);return 0===t?new eK(this.information.getSize(),eK.FNC1,eK.FNC1):new eK(this.information.getSize(),t-1,eK.FNC1)}let t=this.extractNumericValueFromBitArray(e,7);return new eK(e+7,(t-8)/11,(t-8)%11)}extractNumericValueFromBitArray(e,t){return eJ.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,r){let n=0;for(let i=0;i<r;++i)e.get(t+i)&&(n|=1<<r-i-1);return n}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),null!=t&&this.buffer.append(t),this.current.setPosition(e);let r=this.parseBlocks();return null!=r&&r.isRemaining()?new eQ(this.current.getPosition(),this.buffer.toString(),r.getRemainingValue()):new eQ(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let r=this.current.getPosition();if(e=this.current.isAlpha()?(t=this.parseAlphaBlock()).isFinished():this.current.isIsoIec646()?(t=this.parseIsoIec646Block()).isFinished():(t=this.parseNumericBlock()).isFinished(),r===this.current.getPosition()&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1())return new eW(!0,e.isSecondDigitFNC1()?new eQ(this.current.getPosition(),this.buffer.toString()):new eQ(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()));if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1())return new eW(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new eW(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1())return new eW(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new eW(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1())return new eW(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new eW(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,7);if(r>=64&&r<116)return!0;if(e+8>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,8);return n>=232&&n<253}decodeIsoIec646(e){let t,r=this.extractNumericValueFromBitArray(e,5);if(15===r)return new eZ(e+5,eZ.FNC1);if(r>=5&&r<15)return new eZ(e+5,"0"+(r-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new eZ(e+7,""+(n+1));if(n>=90&&n<116)return new eZ(e+7,""+(n+7));switch(this.extractNumericValueFromBitArray(e,8)){case 232:t="!";break;case 233:t='"';break;case 234:t="%";break;case 235:t="&";break;case 236:t="'";break;case 237:t="(";break;case 238:t=")";break;case 239:t="*";break;case 240:t="+";break;case 241:t=",";break;case 242:t="-";break;case 243:t=".";break;case 244:t="/";break;case 245:t=":";break;case 246:t=";";break;case 247:t="<";break;case 248:t="=";break;case 249:t=">";break;case 250:t="?";break;case 251:t="_";break;case 252:t=" ";break;default:throw new V}return new eZ(e+8,t)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,6);return r>=16&&r<63}decodeAlphanumeric(e){let t,r=this.extractNumericValueFromBitArray(e,5);if(15===r)return new eZ(e+5,eZ.FNC1);if(r>=5&&r<15)return new eZ(e+5,"0"+(r-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new eZ(e+6,""+(n+33));switch(n){case 58:t="*";break;case 59:t=",";break;case 60:t="-";break;case 61:t=".";break;case 62:t="/";break;default:throw new ed("Decoding invalid alphanumeric value: "+n)}return new eZ(e+6,t)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(2===t){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class e1{constructor(e){this.information=e,this.generalDecoder=new eJ(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class e0 extends e1{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let r=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,r)}encodeCompressedGtinWithoutAI(e,t,r){for(let r=0;r<4;++r){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*r,10);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n)}e0.appendCheckDigit(e,r)}static appendCheckDigit(e,t){let r=0;for(let n=0;n<13;n++){let i=e.charAt(n+t).charCodeAt(0)-48;r+=(1&n)==0?3*i:i}10==(r=10-r%10)&&(r=0),e.append(r)}}e0.GTIN_SIZE=40;class e2 extends e0{constructor(e){super(e)}parseInformation(){let e=new G;e.append("(01)");let t=e.length(),r=this.getGeneralDecoder().extractNumericValueFromBitArray(e2.HEADER_SIZE,4);return e.append(r),this.encodeCompressedGtinWithoutAI(e,e2.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,e2.HEADER_SIZE+44)}}e2.HEADER_SIZE=4;class e3 extends e1{constructor(e){super(e)}parseInformation(){let e=new G;return this.getGeneralDecoder().decodeAllCodes(e,e3.HEADER_SIZE)}}e3.HEADER_SIZE=5;class e4 extends e0{constructor(e){super(e)}encodeCompressedWeight(e,t,r){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,r);this.addWeightCode(e,n);let i=this.checkWeight(n),a=1e5;for(let t=0;t<5;++t)i/a==0&&e.append("0"),a/=10;e.append(i)}}class e8 extends e4{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=e8.HEADER_SIZE+e4.GTIN_SIZE+e8.WEIGHT_SIZE)throw new q;let e=new G;return this.encodeCompressedGtin(e,e8.HEADER_SIZE),this.encodeCompressedWeight(e,e8.HEADER_SIZE+e4.GTIN_SIZE,e8.WEIGHT_SIZE),e.toString()}}e8.HEADER_SIZE=5,e8.WEIGHT_SIZE=15;class e6 extends e8{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class e5 extends e8{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class e7 extends e0{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<e7.HEADER_SIZE+e0.GTIN_SIZE)throw new q;let e=new G;this.encodeCompressedGtin(e,e7.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(e7.HEADER_SIZE+e0.GTIN_SIZE,e7.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let r=this.getGeneralDecoder().decodeGeneralPurposeField(e7.HEADER_SIZE+e0.GTIN_SIZE+e7.LAST_DIGIT_SIZE,null);return e.append(r.getNewString()),e.toString()}}e7.HEADER_SIZE=8,e7.LAST_DIGIT_SIZE=2;class e9 extends e0{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<e9.HEADER_SIZE+e0.GTIN_SIZE)throw new q;let e=new G;this.encodeCompressedGtin(e,e9.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(e9.HEADER_SIZE+e0.GTIN_SIZE,e9.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let r=this.getGeneralDecoder().extractNumericValueFromBitArray(e9.HEADER_SIZE+e0.GTIN_SIZE+e9.LAST_DIGIT_SIZE,e9.FIRST_THREE_DIGITS_SIZE);r/100==0&&e.append("0"),r/10==0&&e.append("0"),e.append(r);let n=this.getGeneralDecoder().decodeGeneralPurposeField(e9.HEADER_SIZE+e0.GTIN_SIZE+e9.LAST_DIGIT_SIZE+e9.FIRST_THREE_DIGITS_SIZE,null);return e.append(n.getNewString()),e.toString()}}e9.HEADER_SIZE=8,e9.LAST_DIGIT_SIZE=2,e9.FIRST_THREE_DIGITS_SIZE=10;class te extends e4{constructor(e,t,r){super(e),this.dateCode=r,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=te.HEADER_SIZE+te.GTIN_SIZE+te.WEIGHT_SIZE+te.DATE_SIZE)throw new q;let e=new G;return this.encodeCompressedGtin(e,te.HEADER_SIZE),this.encodeCompressedWeight(e,te.HEADER_SIZE+te.GTIN_SIZE,te.WEIGHT_SIZE),this.encodeCompressedDate(e,te.HEADER_SIZE+te.GTIN_SIZE+te.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,te.DATE_SIZE);if(38400==r)return;e.append("("),e.append(this.dateCode),e.append(")");let n=r%32,i=(r/=32)%12+1,a=r/=12;a/10==0&&e.append("0"),e.append(a),i/10==0&&e.append("0"),e.append(i),n/10==0&&e.append("0"),e.append(n)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}function tt(e){try{if(e.get(1))return new e2(e);if(!e.get(2))return new e3(e);switch(eJ.extractNumericValueFromBitArray(e,1,4)){case 4:return new e6(e);case 5:return new e5(e)}switch(eJ.extractNumericValueFromBitArray(e,1,5)){case 12:return new e7(e);case 13:return new e9(e)}switch(eJ.extractNumericValueFromBitArray(e,1,7)){case 56:return new te(e,"310","11");case 57:return new te(e,"320","11");case 58:return new te(e,"310","13");case 59:return new te(e,"320","13");case 60:return new te(e,"310","15");case 61:return new te(e,"320","15");case 62:return new te(e,"310","17");case 63:return new te(e,"320","17")}}catch(t){throw console.log(t),new ed("unknown decoder: "+e)}}te.HEADER_SIZE=8,te.WEIGHT_SIZE=20,te.DATE_SIZE=16;class tr{constructor(e,t,r,n){this.leftchar=e,this.rightchar=t,this.finderpattern=r,this.maybeLast=n}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return null==this.rightchar}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(null==this.finderpattern?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof tr&&tr.equalsOrNull(e.leftchar,t.leftchar)&&tr.equalsOrNull(e.rightchar,t.rightchar)&&tr.equalsOrNull(e.finderpattern,t.finderpattern)}static equalsOrNull(e,t){return null===e?null===t:tr.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class tn{constructor(e,t,r){this.pairs=e,this.rowNumber=t,this.wasReversed=r}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof tn&&this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed}checkEqualitity(e,t){let r;if(e&&t)return e.forEach((e,n)=>{t.forEach(t=>{e.getLeftChar().getValue()===t.getLeftChar().getValue()&&e.getRightChar().getValue()===t.getRightChar().getValue()&&e.getFinderPatter().getValue()===t.getFinderPatter().getValue()&&(r=!0)})}),r}}class ti extends eH{constructor(e){super(...arguments),this.pairs=Array(ti.MAX_PAIRS),this.rows=[],this.startEnd=[2],this.verbose=!0===e}decodeRow(e,t,r){this.pairs.length=0,this.startFromEven=!1;try{return ti.constructResult(this.decodeRow2pairs(e,t))}catch(e){this.verbose&&console.log(e)}return this.pairs.length=0,this.startFromEven=!0,ti.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let r,n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(e){if(e instanceof q){if(!this.pairs.length)throw new q;n=!0}}if(this.checkChecksum())return this.pairs;if(r=!!this.rows.length,this.storeRow(e,!1),r){let e=this.checkRowsBoolean(!1);if(null!=e||null!=(e=this.checkRowsBoolean(!0)))return e}throw new q}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows([],0)}catch(e){this.verbose&&console.log(e)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let r=t;r<this.rows.length;r++){let t=this.rows[r];for(let t of(this.pairs.length=0,e))this.pairs.push(t.getPairs());if(this.pairs.push(t.getPairs()),!ti.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let n=Array(e);n.push(t);try{return this.checkRows(n,r+1)}catch(e){this.verbose&&console.log(e)}}throw new q}static isValidSequence(e){for(let t of ti.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let r=!0;for(let n=0;n<e.length;n++)if(e[n].getFinderPattern().getValue()!=t[n]){r=!1;break}if(r)return!0}return!1}storeRow(e,t){let r=0,n=!1,i=!1;for(;r<this.rows.length;){let t=this.rows[r];if(t.getRowNumber()>e){i=t.isEquivalent(this.pairs);break}n=t.isEquivalent(this.pairs),r++}i||n||ti.isPartialRow(this.pairs,this.rows)||(this.rows.push(r,new tn(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let r of t)if(r.getPairs().length!==e.length){for(let t of r.getPairs())for(let r of e)if(tr.equals(t,r))break}}static isPartialRow(e,t){for(let r of t){let t=!0;for(let n of e){let e=!1;for(let t of r.getPairs())if(n.equals(t)){e=!0;break}if(!e){t=!1;break}}if(t)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=tt(eG.buildBitArray(e)).parseInformation(),r=e[0].getFinderPattern().getResultPoints(),n=e[e.length-1].getFinderPattern().getResultPoints();return new en(t,null,null,[r[0],r[1],n[0],n[1]],ei.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),r=e.getRightChar();if(null==r)return!1;let n=r.getChecksumPortion(),i=2;for(let e=1;e<this.pairs.size();++e){let t=this.pairs.get(e);n+=t.getLeftChar().getChecksumPortion(),i++;let r=t.getRightChar();null!=r&&(n+=r.getChecksumPortion(),i++)}return 211*(i-4)+(n%=211)==t.getValue()}static getNextSecondBar(e,t){let r;return e.get(t)?(r=e.getNextUnset(t),r=e.getNextSet(r)):(r=e.getNextSet(t),r=e.getNextUnset(r)),r}retrieveNextPair(e,t,r){let n,i,a=t.length%2==0;this.startFromEven&&(a=!a);let o=!0,s=-1;do this.findNextPair(e,t,s),null==(n=this.parseFoundFinderPattern(e,r,a))?s=ti.getNextSecondBar(e,this.startEnd[0]):o=!1;while(o);let l=this.decodeDataCharacter(e,n,a,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new q;try{i=this.decodeDataCharacter(e,n,a,!1)}catch(e){i=null,this.verbose&&console.log(e)}return new tr(l,i,n,!0)}isEmptyPair(e){return 0===e.length}findNextPair(e,t,r){let n,i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;let a=e.getSize();n=r>=0?r:this.isEmptyPair(t)?0:t[t.length-1].getFinderPattern().getStartEnd()[1];let o=t.length%2!=0;this.startFromEven&&(o=!o);let s=!1;for(;n<a&&(s=!e.get(n));)n++;let l=0,u=n;for(let t=n;t<a;t++)if(e.get(t)!=s)i[l]++;else{if(3==l){if(o&&ti.reverseCounters(i),ti.isFinderPattern(i)){this.startEnd[0]=u,this.startEnd[1]=t;return}o&&ti.reverseCounters(i),u+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,l--}else l++;i[l]=1,s=!s}throw new q}static reverseCounters(e){let t=e.length;for(let r=0;r<t/2;++r){let n=e[r];e[r]=e[t-r-1],e[t-r-1]=n}}parseFoundFinderPattern(e,t,r){let n,i,a,o;if(r){let t=this.startEnd[0]-1;for(;t>=0&&!e.get(t);)t--;t++,n=this.startEnd[0]-t,i=t,a=this.startEnd[1]}else i=this.startEnd[0],n=(a=e.getNextUnset(this.startEnd[1]+1))-this.startEnd[1];let s=this.getDecodeFinderCounters();P.arraycopy(s,0,s,1,s.length-1),s[0]=n;try{o=this.parseFinderValue(s,ti.FINDER_PATTERNS)}catch(e){return null}return new eY(o,[i,a],i,a,t)}decodeDataCharacter(e,t,r,n){let i=this.getDataCharacterCounters();for(let e=0;e<i.length;e++)i[e]=0;if(n)ti.recordPatternInReverse(e,t.getStartEnd()[0],i);else{ti.recordPattern(e,t.getStartEnd()[1],i);for(let e=0,t=i.length-1;e<t;e++,t--){let r=i[e];i[e]=i[t],i[t]=r}}let a=ep.sum(new Int32Array(i))/17,o=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(a-o)/o>.3)throw new q;let s=this.getOddCounts(),l=this.getEvenCounts(),u=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let e=0;e<i.length;e++){let t=i[e]/a,r=t+.5;if(r<1){if(t<.3)throw new q;r=1}else if(r>8){if(t>8.7)throw new q;r=8}let n=e/2;(1&e)==0?(s[n]=r,u[n]=t-r):(l[n]=r,c[n]=t-r)}this.adjustOddEvenCounts(17);let h=4*t.getValue()+2*!r+ +!n-1,d=0,f=0;for(let e=s.length-1;e>=0;e--){if(ti.isNotA1left(t,r,n)){let t=ti.WEIGHTS[h][2*e];f+=s[e]*t}d+=s[e]}let g=0;for(let e=l.length-1;e>=0;e--)if(ti.isNotA1left(t,r,n)){let t=ti.WEIGHTS[h][2*e+1];g+=l[e]*t}let p=f+g;if((1&d)!=0||d>13||d<4)throw new q;let v=(13-d)/2,y=ti.SYMBOL_WIDEST[v],w=eX.getRSSvalue(s,y,!0),E=eX.getRSSvalue(l,9-y,!1);return new ej(w*ti.EVEN_TOTAL_SUBSET[v]+E+ti.GSUM[v],p)}static isNotA1left(e,t,r){return!(0==e.getValue()&&t&&r)}adjustOddEvenCounts(e){let t=ep.sum(new Int32Array(this.getOddCounts())),r=ep.sum(new Int32Array(this.getEvenCounts())),n=!1,i=!1;t>13?i=!0:t<4&&(n=!0);let a=!1,o=!1;r>13?o=!0:r<4&&(a=!0);let s=t+r-e,l=(1&t)==1,u=(1&r)==0;if(1==s)if(l){if(u)throw new q;i=!0}else{if(!u)throw new q;o=!0}else if(-1==s)if(l){if(u)throw new q;n=!0}else{if(!u)throw new q;a=!0}else if(0==s){if(l){if(!u)throw new q;t<r?(n=!0,o=!0):(i=!0,a=!0)}else if(u)throw new q}else throw new q;if(n){if(i)throw new q;ti.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&ti.decrement(this.getOddCounts(),this.getOddRoundingErrors()),a){if(o)throw new q;ti.increment(this.getEvenCounts(),this.getOddRoundingErrors())}o&&ti.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}ti.SYMBOL_WIDEST=[7,5,4,3,1],ti.EVEN_TOTAL_SUBSET=[4,20,52,104,204],ti.GSUM=[0,348,1388,2948,3988],ti.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],ti.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],ti.FINDER_PAT_A=0,ti.FINDER_PAT_B=1,ti.FINDER_PAT_C=2,ti.FINDER_PAT_D=3,ti.FINDER_PAT_E=4,ti.FINDER_PAT_F=5,ti.FINDER_PATTERN_SEQUENCES=[[ti.FINDER_PAT_A,ti.FINDER_PAT_A],[ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B],[ti.FINDER_PAT_A,ti.FINDER_PAT_C,ti.FINDER_PAT_B,ti.FINDER_PAT_D],[ti.FINDER_PAT_A,ti.FINDER_PAT_E,ti.FINDER_PAT_B,ti.FINDER_PAT_D,ti.FINDER_PAT_C],[ti.FINDER_PAT_A,ti.FINDER_PAT_E,ti.FINDER_PAT_B,ti.FINDER_PAT_D,ti.FINDER_PAT_D,ti.FINDER_PAT_F],[ti.FINDER_PAT_A,ti.FINDER_PAT_E,ti.FINDER_PAT_B,ti.FINDER_PAT_D,ti.FINDER_PAT_E,ti.FINDER_PAT_F,ti.FINDER_PAT_F],[ti.FINDER_PAT_A,ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B,ti.FINDER_PAT_C,ti.FINDER_PAT_C,ti.FINDER_PAT_D,ti.FINDER_PAT_D],[ti.FINDER_PAT_A,ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B,ti.FINDER_PAT_C,ti.FINDER_PAT_C,ti.FINDER_PAT_D,ti.FINDER_PAT_E,ti.FINDER_PAT_E],[ti.FINDER_PAT_A,ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B,ti.FINDER_PAT_C,ti.FINDER_PAT_C,ti.FINDER_PAT_D,ti.FINDER_PAT_E,ti.FINDER_PAT_F,ti.FINDER_PAT_F],[ti.FINDER_PAT_A,ti.FINDER_PAT_A,ti.FINDER_PAT_B,ti.FINDER_PAT_B,ti.FINDER_PAT_C,ti.FINDER_PAT_D,ti.FINDER_PAT_D,ti.FINDER_PAT_E,ti.FINDER_PAT_E,ti.FINDER_PAT_F,ti.FINDER_PAT_F]],ti.MAX_PAIRS=11;class ta extends ej{constructor(e,t,r){super(e,t),this.count=0,this.finderPattern=r}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class to extends eH{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,r){let n=this.decodePair(t,!1,e,r);to.addOrTally(this.possibleLeftPairs,n),t.reverse();let i=this.decodePair(t,!0,e,r);for(let e of(to.addOrTally(this.possibleRightPairs,i),t.reverse(),this.possibleLeftPairs))if(e.getCount()>1){for(let t of this.possibleRightPairs)if(t.getCount()>1&&to.checkChecksum(e,t))return to.constructResult(e,t)}throw new q}static addOrTally(e,t){if(null==t)return;let r=!1;for(let n of e)if(n.getValue()===t.getValue()){n.incrementCount(),r=!0;break}r||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let r=new String(4537077*e.getValue()+t.getValue()).toString(),n=new G;for(let e=13-r.length;e>0;e--)n.append("0");n.append(r);let i=0;for(let e=0;e<13;e++){let t=n.charAt(e).charCodeAt(0)-48;i+=(1&e)==0?3*t:t}10==(i=10-i%10)&&(i=0),n.append(i.toString());let a=e.getFinderPattern().getResultPoints(),o=t.getFinderPattern().getResultPoints();return new en(n.toString(),null,0,[a[0],a[1],o[0],o[1]],ei.RSS_14,new Date().getTime())}static checkChecksum(e,t){let r=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,n=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return n>72&&n--,n>8&&n--,r===n}decodePair(e,t,r,n){try{let i=this.findFinderPattern(e,t),a=this.parseFoundFinderPattern(e,r,t,i),o=null==n?null:n.get(U.NEED_RESULT_POINT_CALLBACK);if(null!=o){let n=(i[0]+i[1])/2;t&&(n=e.getSize()-1-n),o.foundPossibleResultPoint(new ev(n,r))}let s=this.decodeDataCharacter(e,a,!0),l=this.decodeDataCharacter(e,a,!1);return new ta(1597*s.getValue()+l.getValue(),s.getChecksumPortion()+4*l.getChecksumPortion(),a)}catch(e){return null}}decodeDataCharacter(e,t,r){let n=this.getDataCharacterCounters();for(let e=0;e<n.length;e++)n[e]=0;if(r)ex.recordPatternInReverse(e,t.getStartEnd()[0],n);else{ex.recordPattern(e,t.getStartEnd()[1]+1,n);for(let e=0,t=n.length-1;e<t;e++,t--){let r=n[e];n[e]=n[t],n[t]=r}}let i=r?16:15,a=ep.sum(new Int32Array(n))/i,o=this.getOddCounts(),s=this.getEvenCounts(),l=this.getOddRoundingErrors(),u=this.getEvenRoundingErrors();for(let e=0;e<n.length;e++){let t=n[e]/a,r=Math.floor(t+.5);r<1?r=1:r>8&&(r=8);let i=Math.floor(e/2);(1&e)==0?(o[i]=r,l[i]=t-r):(s[i]=r,u[i]=t-r)}this.adjustOddEvenCounts(r,i);let c=0,h=0;for(let e=o.length-1;e>=0;e--)h*=9,h+=o[e],c+=o[e];let d=0,f=0;for(let e=s.length-1;e>=0;e--)d*=9,d+=s[e],f+=s[e];let g=h+3*d;if(r){if((1&c)!=0||c>12||c<4)throw new q;let e=(12-c)/2,t=to.OUTSIDE_ODD_WIDEST[e],r=eX.getRSSvalue(o,t,!1),n=eX.getRSSvalue(s,9-t,!0);return new ej(r*to.OUTSIDE_EVEN_TOTAL_SUBSET[e]+n+to.OUTSIDE_GSUM[e],g)}{if((1&f)!=0||f>10||f<4)throw new q;let e=(10-f)/2,t=to.INSIDE_ODD_WIDEST[e],r=eX.getRSSvalue(o,t,!0);return new ej(eX.getRSSvalue(s,9-t,!1)*to.INSIDE_ODD_TOTAL_SUBSET[e]+r+to.INSIDE_GSUM[e],g)}}findFinderPattern(e,t){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let n=e.getSize(),i=!1,a=0;for(;a<n&&t!==(i=!e.get(a));)a++;let o=0,s=a;for(let t=a;t<n;t++)if(e.get(t)!==i)r[o]++;else{if(3===o){if(eH.isFinderPattern(r))return[s,t];s+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,o--}else o++;r[o]=1,i=!i}throw new q}parseFoundFinderPattern(e,t,r,n){let i=e.get(n[0]),a=n[0]-1;for(;a>=0&&i!==e.get(a);)a--;a++;let o=n[0]-a,s=this.getDecodeFinderCounters(),l=new Int32Array(s.length);P.arraycopy(s,0,l,1,s.length-1),l[0]=o;let u=this.parseFinderValue(l,to.FINDER_PATTERNS),c=a,h=n[1];return r&&(c=e.getSize()-1-c,h=e.getSize()-1-h),new eY(u,[a,n[1]],c,h,t)}adjustOddEvenCounts(e,t){let r=ep.sum(new Int32Array(this.getOddCounts())),n=ep.sum(new Int32Array(this.getEvenCounts())),i=!1,a=!1,o=!1,s=!1;e?(r>12?a=!0:r<4&&(i=!0),n>12?s=!0:n<4&&(o=!0)):(r>11?a=!0:r<5&&(i=!0),n>10?s=!0:n<4&&(o=!0));let l=r+n-t,u=(1&r)==+!!e,c=(1&n)==1;if(1===l)if(u){if(c)throw new q;a=!0}else{if(!c)throw new q;s=!0}else if(-1===l)if(u){if(c)throw new q;i=!0}else{if(!c)throw new q;o=!0}else if(0===l){if(u){if(!c)throw new q;r<n?(i=!0,s=!0):(a=!0,o=!0)}else if(c)throw new q}else throw new q;if(i){if(a)throw new q;eH.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&eH.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(s)throw new q;eH.increment(this.getEvenCounts(),this.getOddRoundingErrors())}s&&eH.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}to.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],to.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],to.OUTSIDE_GSUM=[0,161,961,2015,2715],to.INSIDE_GSUM=[0,336,1036,1516],to.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],to.INSIDE_ODD_WIDEST=[2,4,6,8],to.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class ts extends ex{constructor(e,t){super(),this.readers=[],this.verbose=!0===t;const r=e?e.get(U.POSSIBLE_FORMATS):null,n=e&&void 0!==e.get(U.ASSUME_CODE_39_CHECK_DIGIT);r?((r.includes(ei.EAN_13)||r.includes(ei.UPC_A)||r.includes(ei.EAN_8)||r.includes(ei.UPC_E))&&this.readers.push(new eV(e)),r.includes(ei.CODE_39)&&this.readers.push(new eN(n)),r.includes(ei.CODE_128)&&this.readers.push(new eD),r.includes(ei.ITF)&&this.readers.push(new eM),r.includes(ei.RSS_14)&&this.readers.push(new to),r.includes(ei.RSS_EXPANDED)&&this.readers.push(new ti(this.verbose))):(this.readers.push(new eV(e)),this.readers.push(new eN),this.readers.push(new eV(e)),this.readers.push(new eD),this.readers.push(new eM),this.readers.push(new to),this.readers.push(new ti(this.verbose)))}decodeRow(e,t,r){for(let n=0;n<this.readers.length;n++)try{return this.readers[n].decodeRow(e,t,r)}catch(e){}throw new q}reset(){this.readers.forEach(e=>e.reset())}}class tl{constructor(e,t,r){this.ecCodewords=e,this.ecBlocks=[t],r&&this.ecBlocks.push(r)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class tu{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class tc{constructor(e,t,r,n,i,a){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=r,this.dataRegionSizeRows=n,this.dataRegionSizeColumns=i,this.ecBlocks=a;let o=0;const s=a.getECCodewords();for(let e of a.getECBlocks())o+=e.getCount()*(e.getDataCodewords()+s);this.totalCodewords=o}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if((1&e)!=0||(1&t)!=0)throw new V;for(let r of tc.VERSIONS)if(r.symbolSizeRows===e&&r.symbolSizeColumns===t)return r;throw new V}toString(){return""+this.versionNumber}static buildVersions(){return[new tc(1,10,10,8,8,new tl(5,new tu(1,3))),new tc(2,12,12,10,10,new tl(7,new tu(1,5))),new tc(3,14,14,12,12,new tl(10,new tu(1,8))),new tc(4,16,16,14,14,new tl(12,new tu(1,12))),new tc(5,18,18,16,16,new tl(14,new tu(1,18))),new tc(6,20,20,18,18,new tl(18,new tu(1,22))),new tc(7,22,22,20,20,new tl(20,new tu(1,30))),new tc(8,24,24,22,22,new tl(24,new tu(1,36))),new tc(9,26,26,24,24,new tl(28,new tu(1,44))),new tc(10,32,32,14,14,new tl(36,new tu(1,62))),new tc(11,36,36,16,16,new tl(42,new tu(1,86))),new tc(12,40,40,18,18,new tl(48,new tu(1,114))),new tc(13,44,44,20,20,new tl(56,new tu(1,144))),new tc(14,48,48,22,22,new tl(68,new tu(1,174))),new tc(15,52,52,24,24,new tl(42,new tu(2,102))),new tc(16,64,64,14,14,new tl(56,new tu(2,140))),new tc(17,72,72,16,16,new tl(36,new tu(4,92))),new tc(18,80,80,18,18,new tl(48,new tu(4,114))),new tc(19,88,88,20,20,new tl(56,new tu(4,144))),new tc(20,96,96,22,22,new tl(68,new tu(4,174))),new tc(21,104,104,24,24,new tl(56,new tu(6,136))),new tc(22,120,120,18,18,new tl(68,new tu(6,175))),new tc(23,132,132,20,20,new tl(62,new tu(8,163))),new tc(24,144,144,22,22,new tl(62,new tu(8,156),new tu(2,155))),new tc(25,8,18,6,16,new tl(7,new tu(1,5))),new tc(26,8,32,6,14,new tl(11,new tu(1,10))),new tc(27,12,26,10,24,new tl(14,new tu(1,16))),new tc(28,12,36,10,16,new tl(18,new tu(1,22))),new tc(29,16,36,14,16,new tl(24,new tu(1,32))),new tc(30,16,48,14,22,new tl(28,new tu(1,49)))]}}tc.VERSIONS=tc.buildVersions();class th{constructor(e){const t=e.getHeight();if(t<8||t>144||(1&t)!=0)throw new V;this.version=th.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new W(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){let t=e.getHeight(),r=e.getWidth();return tc.getVersionForDimensions(t,r)}readCodewords(){let e=new Int8Array(this.version.getTotalCodewords()),t=0,r=4,n=0,i=this.mappingBitMatrix.getHeight(),a=this.mappingBitMatrix.getWidth(),o=!1,s=!1,l=!1,u=!1;do if(r!==i||0!==n||o)if(r!==i-2||0!==n||(3&a)==0||s)if(r!==i+4||2!==n||(7&a)!=0||l)if(r!==i-2||0!==n||(7&a)!=4||u){do r<i&&n>=0&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,a)),r-=2,n+=2;while(r>=0&&n<a);r+=1,n+=3;do r>=0&&n<a&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,a)),r+=2,n-=2;while(r<i&&n>=0);r+=3,n+=1}else e[t++]=255&this.readCorner4(i,a),r-=2,n+=2,u=!0;else e[t++]=255&this.readCorner3(i,a),r-=2,n+=2,l=!0;else e[t++]=255&this.readCorner2(i,a),r-=2,n+=2,s=!0;else e[t++]=255&this.readCorner1(i,a),r-=2,n+=2,o=!0;while(r<i||n<a);if(t!==this.version.getTotalCodewords())throw new V;return e}readModule(e,t,r,n){return e<0&&(e+=r,t+=4-(r+4&7)),t<0&&(t+=n,e+=4-(n+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,r,n){let i=0;return this.readModule(e-2,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e-2,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t,r,n)&&(i|=1),i<<=1,this.readModule(e,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e,t,r,n)&&(i|=1),i}readCorner1(e,t){let r=0;return this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,1,e,t)&&(r|=1),r<<=1,this.readModule(e-1,2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(2,t-1,e,t)&&(r|=1),r<<=1,this.readModule(3,t-1,e,t)&&(r|=1),r}readCorner2(e,t){let r=0;return this.readModule(e-3,0,e,t)&&(r|=1),r<<=1,this.readModule(e-2,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(0,t-4,e,t)&&(r|=1),r<<=1,this.readModule(0,t-3,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r}readCorner3(e,t){let r=0;return this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(0,t-3,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-3,e,t)&&(r|=1),r<<=1,this.readModule(1,t-2,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r}readCorner4(e,t){let r=0;return this.readModule(e-3,0,e,t)&&(r|=1),r<<=1,this.readModule(e-2,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(2,t-1,e,t)&&(r|=1),r<<=1,this.readModule(3,t-1,e,t)&&(r|=1),r}extractDataRegion(e){let t=this.version.getSymbolSizeRows(),r=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new N("Dimension of bitMatrix must match the version size");let n=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),a=t/n|0,o=r/i|0,s=new W(o*i,a*n);for(let t=0;t<a;++t){let r=t*n;for(let a=0;a<o;++a){let o=a*i;for(let l=0;l<n;++l){let u=t*(n+2)+1+l,c=r+l;for(let t=0;t<i;++t){let r=a*(i+2)+1+t;if(e.get(r,u)){let e=o+t;s.set(e,c)}}}}}return s}}class td{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){let r=t.getECBlocks(),n=0,i=r.getECBlocks();for(let e of i)n+=e.getCount();let a=Array(n),o=0;for(let e of i)for(let t=0;t<e.getCount();t++){let t=e.getDataCodewords(),n=r.getECCodewords()+t;a[o++]=new td(t,new Uint8Array(n))}let s=a[0].codewords.length-r.getECCodewords(),l=s-1,u=0;for(let t=0;t<l;t++)for(let r=0;r<o;r++)a[r].codewords[t]=e[u++];let c=24===t.getVersionNumber(),h=c?8:o;for(let t=0;t<h;t++)a[t].codewords[s-1]=e[u++];let d=a[0].codewords.length;for(let t=s;t<d;t++)for(let r=0;r<o;r++){let n=c?(r+8)%o:r,i=c&&n>7?t-1:t;a[n].codewords[i]=e[u++]}if(u!==e.length)throw new N;return a}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class tf{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new N(""+e);let t=0,r=this.bitOffset,n=this.byteOffset,i=this.bytes;if(r>0){let a=8-r,o=e<a?e:a,s=a-o;t=(i[n]&255>>8-o<<s)>>s,e-=o,8===(r+=o)&&(r=0,n++)}if(e>0){for(;e>=8;)t=t<<8|255&i[n],n++,e-=8;if(e>0){let a=8-e;t=t<<e|(i[n]&255>>a<<a)>>a,r+=e}}return this.bitOffset=r,this.byteOffset=n,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}(l=E||(E={}))[l.PAD_ENCODE=0]="PAD_ENCODE",l[l.ASCII_ENCODE=1]="ASCII_ENCODE",l[l.C40_ENCODE=2]="C40_ENCODE",l[l.TEXT_ENCODE=3]="TEXT_ENCODE",l[l.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",l[l.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",l[l.BASE256_ENCODE=6]="BASE256_ENCODE";class tg{static decode(e){let t=new tf(e),r=new G,n=new G,i=[],a=E.ASCII_ENCODE;do if(a===E.ASCII_ENCODE)a=this.decodeAsciiSegment(t,r,n);else{switch(a){case E.C40_ENCODE:this.decodeC40Segment(t,r);break;case E.TEXT_ENCODE:this.decodeTextSegment(t,r);break;case E.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,r);break;case E.EDIFACT_ENCODE:this.decodeEdifactSegment(t,r);break;case E.BASE256_ENCODE:this.decodeBase256Segment(t,r,i);break;default:throw new V}a=E.ASCII_ENCODE}while(a!==E.PAD_ENCODE&&t.available()>0);return n.length()>0&&r.append(n.toString()),new eo(e,r.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(e,t,r){let n=!1;do{let i=e.readBits(8);if(0===i)throw new V;if(i<=128){n&&(i+=128),t.append(String.fromCharCode(i-1));break}if(129===i)return E.PAD_ENCODE;else if(i<=229){let e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return E.C40_ENCODE;case 231:return E.BASE256_ENCODE;case 232:t.append("\x1d");break;case 233:case 234:case 241:break;case 235:n=!0;break;case 236:t.append("[)>\x1e05\x1d"),r.insert(0,"\x1e\x04");break;case 237:t.append("[)>\x1e06\x1d"),r.insert(0,"\x1e\x04");break;case 238:return E.ANSIX12_ENCODE;case 239:return E.TEXT_ENCODE;case 240:return E.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new V}}while(e.available()>0);return E.ASCII_ENCODE}static decodeC40Segment(e,t){let r=!1,n=[],i=0;do{if(8===e.available())return;let a=e.readBits(8);if(254===a)return;this.parseTwoBytes(a,e.readBits(8),n);for(let e=0;e<3;e++){let a=n[e];switch(i){case 0:if(a<3)i=a+1;else if(a<this.C40_BASIC_SET_CHARS.length){let e=this.C40_BASIC_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else throw new V;break;case 1:r?(t.append(String.fromCharCode(a+128)),r=!1):t.append(String.fromCharCode(a)),i=0;break;case 2:if(a<this.C40_SHIFT2_SET_CHARS.length){let e=this.C40_SHIFT2_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else switch(a){case 27:t.append("\x1d");break;case 30:r=!0;break;default:throw new V}i=0;break;case 3:r?(t.append(String.fromCharCode(a+224)),r=!1):t.append(String.fromCharCode(a+96)),i=0;break;default:throw new V}}}while(e.available()>0)}static decodeTextSegment(e,t){let r=!1,n=[],i=0;do{if(8===e.available())return;let a=e.readBits(8);if(254===a)return;this.parseTwoBytes(a,e.readBits(8),n);for(let e=0;e<3;e++){let a=n[e];switch(i){case 0:if(a<3)i=a+1;else if(a<this.TEXT_BASIC_SET_CHARS.length){let e=this.TEXT_BASIC_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else throw new V;break;case 1:r?(t.append(String.fromCharCode(a+128)),r=!1):t.append(String.fromCharCode(a)),i=0;break;case 2:if(a<this.TEXT_SHIFT2_SET_CHARS.length){let e=this.TEXT_SHIFT2_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else switch(a){case 27:t.append("\x1d");break;case 30:r=!0;break;default:throw new V}i=0;break;case 3:if(a<this.TEXT_SHIFT3_SET_CHARS.length){let e=this.TEXT_SHIFT3_SET_CHARS[a];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e),i=0}else throw new V;break;default:throw new V}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){let r=[];do{if(8===e.available())return;let n=e.readBits(8);if(254===n)return;this.parseTwoBytes(n,e.readBits(8),r);for(let e=0;e<3;e++){let n=r[e];switch(n){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(n<14)t.append(String.fromCharCode(n+44));else if(n<40)t.append(String.fromCharCode(n+51));else throw new V}}}while(e.available()>0)}static parseTwoBytes(e,t,r){let n=(e<<8)+t-1,i=Math.floor(n/1600);r[0]=i,n-=1600*i,i=Math.floor(n/40),r[1]=i,r[2]=n-40*i}static decodeEdifactSegment(e,t){do{if(16>=e.available())return;for(let r=0;r<4;r++){let r=e.readBits(6);if(31===r){let t=8-e.getBitOffset();8!==t&&e.readBits(t);return}(32&r)==0&&(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,r){let n,i=1+e.getByteOffset(),a=this.unrandomize255State(e.readBits(8),i++);if((n=0===a?e.available()/8|0:a<250?a:250*(a-249)+this.unrandomize255State(e.readBits(8),i++))<0)throw new V;let o=new Uint8Array(n);for(let t=0;t<n;t++){if(8>e.available())throw new V;o[t]=this.unrandomize255State(e.readBits(8),i++)}r.push(o);try{t.append(Y.decode(o,X.ISO88591))}catch(e){throw new ed("Platform does not support required encoding: "+e.message)}}static unrandomize255State(e,t){let r=e-(149*t%255+1);return r>=0?r:r+256}}tg.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],tg.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],tg.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],tg.TEXT_SHIFT2_SET_CHARS=tg.C40_SHIFT2_SET_CHARS,tg.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class tp{constructor(){this.rsDecoder=new ef(ec.DATA_MATRIX_FIELD_256)}decode(e){let t=new th(e),r=t.getVersion(),n=t.readCodewords(),i=td.getDataBlocks(n,r),a=0;for(let e of i)a+=e.getNumDataCodewords();let o=new Uint8Array(a),s=i.length;for(let e=0;e<s;e++){let t=i[e],r=t.getCodewords(),n=t.getNumDataCodewords();this.correctErrors(r,n);for(let t=0;t<n;t++)o[t*s+e]=r[t]}return tg.decode(o)}correctErrors(e,t){let r=new Int32Array(e);try{this.rsDecoder.decode(r,e.length-t)}catch(e){throw new R}for(let n=0;n<t;n++)e[n]=r[n]}}class tm{constructor(e){this.image=e,this.rectangleDetector=new eE(this.image)}detect(){let e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if((t=this.detectSolid2(t))[3]=this.correctTopRight(t),!t[3])throw new q;let r=(t=this.shiftToModuleCenter(t))[0],n=t[1],i=t[2],a=t[3],o=this.transitionsBetween(r,a)+1,s=this.transitionsBetween(i,a)+1;return(1&o)==1&&(o+=1),(1&s)==1&&(s+=1),4*o<7*s&&4*s<7*o&&(o=s=Math.max(o,s)),new ey(tm.sampleGrid(this.image,r,n,i,a,o,s),[r,n,i,a])}static shiftPoint(e,t,r){let n=(t.getX()-e.getX())/(r+1),i=(t.getY()-e.getY())/(r+1);return new ev(e.getX()+n,e.getY()+i)}static moveAway(e,t,r){let n=e.getX(),i=e.getY();return n<t?n-=1:n+=1,i<r?i-=1:i+=1,new ev(n,i)}detectSolid1(e){let t=e[0],r=e[1],n=e[3],i=e[2],a=this.transitionsBetween(t,r),o=this.transitionsBetween(r,n),s=this.transitionsBetween(n,i),l=this.transitionsBetween(i,t),u=a,c=[i,t,r,n];return u>o&&(u=o,c[0]=t,c[1]=r,c[2]=n,c[3]=i),u>s&&(u=s,c[0]=r,c[1]=n,c[2]=i,c[3]=t),u>l&&(c[0]=n,c[1]=i,c[2]=t,c[3]=r),c}detectSolid2(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=this.transitionsBetween(t,i),o=tm.shiftPoint(r,n,(a+1)*4),s=tm.shiftPoint(n,r,(a+1)*4);return this.transitionsBetween(o,t)<this.transitionsBetween(s,i)?(e[0]=t,e[1]=r,e[2]=n,e[3]=i):(e[0]=r,e[1]=n,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=this.transitionsBetween(t,i),o=this.transitionsBetween(r,i),s=tm.shiftPoint(t,r,(o+1)*4),l=tm.shiftPoint(n,r,(a+1)*4);a=this.transitionsBetween(s,i),o=this.transitionsBetween(l,i);let u=new ev(i.getX()+(n.getX()-r.getX())/(a+1),i.getY()+(n.getY()-r.getY())/(a+1)),c=new ev(i.getX()+(t.getX()-r.getX())/(o+1),i.getY()+(t.getY()-r.getY())/(o+1));return this.isValid(u)?this.isValid(c)?this.transitionsBetween(s,u)+this.transitionsBetween(l,u)>this.transitionsBetween(s,c)+this.transitionsBetween(l,c)?u:c:u:this.isValid(c)?c:null}shiftToModuleCenter(e){let t,r,n=e[0],i=e[1],a=e[2],o=e[3],s=this.transitionsBetween(n,o)+1,l=this.transitionsBetween(a,o)+1,u=tm.shiftPoint(n,i,4*l),c=tm.shiftPoint(a,i,4*s);s=this.transitionsBetween(u,o)+1,l=this.transitionsBetween(c,o)+1,(1&s)==1&&(s+=1),(1&l)==1&&(l+=1);let h=(n.getX()+i.getX()+a.getX()+o.getX())/4,d=(n.getY()+i.getY()+a.getY()+o.getY())/4;return n=tm.moveAway(n,h,d),i=tm.moveAway(i,h,d),a=tm.moveAway(a,h,d),o=tm.moveAway(o,h,d),u=tm.shiftPoint(n,i,4*l),u=tm.shiftPoint(u,o,4*s),t=tm.shiftPoint(i,n,4*l),t=tm.shiftPoint(t,a,4*s),c=tm.shiftPoint(a,o,4*l),c=tm.shiftPoint(c,i,4*s),r=tm.shiftPoint(o,a,4*l),[u,t,c,r=tm.shiftPoint(r,n,4*s)]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,r,n,i,a,o){return e_.getInstance().sampleGrid(e,a,o,.5,.5,a-.5,.5,a-.5,o-.5,.5,o-.5,t.getX(),t.getY(),i.getX(),i.getY(),n.getX(),n.getY(),r.getX(),r.getY())}transitionsBetween(e,t){let r=Math.trunc(e.getX()),n=Math.trunc(e.getY()),i=Math.trunc(t.getX()),a=Math.trunc(t.getY()),o=Math.abs(a-n)>Math.abs(i-r);if(o){let e=r;r=n,n=e,e=i,i=a,a=e}let s=Math.abs(i-r),l=Math.abs(a-n),u=-s/2,c=n<a?1:-1,h=r<i?1:-1,d=0,f=this.image.get(o?n:r,o?r:n);for(let e=r,t=n;e!==i;e+=h){let r=this.image.get(o?t:e,o?e:t);if(r!==f&&(d++,f=r),(u+=l)>0){if(t===a)break;t+=c,u-=s}}return d}}class tv{constructor(){this.decoder=new tp}decode(e,t=null){let r,n;if(null!=t&&t.has(U.PURE_BARCODE)){let t=tv.extractPureBits(e.getBlackMatrix());r=this.decoder.decode(t),n=tv.NO_POINTS}else{let t=new tm(e.getBlackMatrix()).detect();r=this.decoder.decode(t.getBits()),n=t.getPoints()}let i=r.getRawBytes(),a=new en(r.getText(),i,8*i.length,n,ei.DATA_MATRIX,P.currentTimeMillis()),o=r.getByteSegments();null!=o&&a.putMetadata(ea.BYTE_SEGMENTS,o);let s=r.getECLevel();return null!=s&&a.putMetadata(ea.ERROR_CORRECTION_LEVEL,s),a}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null==t||null==r)throw new q;let n=this.moduleSize(t,e),i=t[1],a=r[1],o=t[0],s=(r[0]-o+1)/n,l=(a-i+1)/n;if(s<=0||l<=0)throw new q;let u=n/2;i+=u,o+=u;let c=new W(s,l);for(let t=0;t<l;t++){let r=i+t*n;for(let i=0;i<s;i++)e.get(o+i*n,r)&&c.set(i,t)}return c}static moduleSize(e,t){let r=t.getWidth(),n=e[0],i=e[1];for(;n<r&&t.get(n,i);)n++;if(n===r)throw new q;let a=n-e[0];if(0===a)throw new q;return a}}tv.NO_POINTS=[],(u=b||(b={}))[u.L=0]="L",u[u.M=1]="M",u[u.Q=2]="Q",u[u.H=3]="H";class ty{constructor(e,t,r){this.value=e,this.stringValue=t,this.bits=r,ty.FOR_BITS.set(r,this),ty.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ty.L;case"M":return ty.M;case"Q":return ty.Q;case"H":return ty.H;default:throw new D(e+"not available")}}toString(){return this.stringValue}equals(e){return e instanceof ty&&this.value===e.value}static forBits(e){if(e<0||e>=ty.FOR_BITS.size)throw new N;return ty.FOR_BITS.get(e)}}ty.FOR_BITS=new Map,ty.FOR_VALUE=new Map,ty.L=new ty(b.L,"L",1),ty.M=new ty(b.M,"M",0),ty.Q=new ty(b.Q,"Q",3),ty.H=new ty(b.H,"H",2);class tw{constructor(e){this.errorCorrectionLevel=ty.forBits(e>>3&3),this.dataMask=7&e}static numBitsDiffering(e,t){return F.bitCount(e^t)}static decodeFormatInformation(e,t){let r=tw.doDecodeFormatInformation(e,t);return null!==r?r:tw.doDecodeFormatInformation(e^tw.FORMAT_INFO_MASK_QR,t^tw.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let r=Number.MAX_SAFE_INTEGER,n=0;for(let i of tw.FORMAT_INFO_DECODE_LOOKUP){let a=i[0];if(a===e||a===t)return new tw(i[1]);let o=tw.numBitsDiffering(e,a);o<r&&(n=i[1],r=o),e!==t&&(o=tw.numBitsDiffering(t,a))<r&&(n=i[1],r=o)}return r<=3?new tw(n):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){return e instanceof tw&&this.errorCorrectionLevel===e.errorCorrectionLevel&&this.dataMask===e.dataMask}}tw.FORMAT_INFO_MASK_QR=21522,tw.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class tE{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;for(let t of this.ecBlocks)e+=t.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class tb{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class tA{constructor(e,t,...r){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=r;let n=0;const i=r[0].getECCodewordsPerBlock();for(const e of r[0].getECBlocks())n+=e.getCount()*(e.getDataCodewords()+i);this.totalCodewords=n}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!=1)throw new V;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new V}}static getVersionForNumber(e){if(e<1||e>40)throw new N;return tA.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,r=0;for(let n=0;n<tA.VERSION_DECODE_INFO.length;n++){let i=tA.VERSION_DECODE_INFO[n];if(i===e)return tA.getVersionForNumber(n+7);let a=tw.numBitsDiffering(e,i);a<t&&(r=n+7,t=a)}return t<=3?tA.getVersionForNumber(r):null}buildFunctionPattern(){let e=this.getDimensionForVersion(),t=new W(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);let r=this.alignmentPatternCenters.length;for(let e=0;e<r;e++){let n=this.alignmentPatternCenters[e]-2;for(let i=0;i<r;i++)(0!==e||0!==i&&i!==r-1)&&(e!==r-1||0!==i)&&t.setRegion(this.alignmentPatternCenters[i]-2,n,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}tA.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),tA.VERSIONS=[new tA(1,new Int32Array(0),new tE(7,new tb(1,19)),new tE(10,new tb(1,16)),new tE(13,new tb(1,13)),new tE(17,new tb(1,9))),new tA(2,Int32Array.from([6,18]),new tE(10,new tb(1,34)),new tE(16,new tb(1,28)),new tE(22,new tb(1,22)),new tE(28,new tb(1,16))),new tA(3,Int32Array.from([6,22]),new tE(15,new tb(1,55)),new tE(26,new tb(1,44)),new tE(18,new tb(2,17)),new tE(22,new tb(2,13))),new tA(4,Int32Array.from([6,26]),new tE(20,new tb(1,80)),new tE(18,new tb(2,32)),new tE(26,new tb(2,24)),new tE(16,new tb(4,9))),new tA(5,Int32Array.from([6,30]),new tE(26,new tb(1,108)),new tE(24,new tb(2,43)),new tE(18,new tb(2,15),new tb(2,16)),new tE(22,new tb(2,11),new tb(2,12))),new tA(6,Int32Array.from([6,34]),new tE(18,new tb(2,68)),new tE(16,new tb(4,27)),new tE(24,new tb(4,19)),new tE(28,new tb(4,15))),new tA(7,Int32Array.from([6,22,38]),new tE(20,new tb(2,78)),new tE(18,new tb(4,31)),new tE(18,new tb(2,14),new tb(4,15)),new tE(26,new tb(4,13),new tb(1,14))),new tA(8,Int32Array.from([6,24,42]),new tE(24,new tb(2,97)),new tE(22,new tb(2,38),new tb(2,39)),new tE(22,new tb(4,18),new tb(2,19)),new tE(26,new tb(4,14),new tb(2,15))),new tA(9,Int32Array.from([6,26,46]),new tE(30,new tb(2,116)),new tE(22,new tb(3,36),new tb(2,37)),new tE(20,new tb(4,16),new tb(4,17)),new tE(24,new tb(4,12),new tb(4,13))),new tA(10,Int32Array.from([6,28,50]),new tE(18,new tb(2,68),new tb(2,69)),new tE(26,new tb(4,43),new tb(1,44)),new tE(24,new tb(6,19),new tb(2,20)),new tE(28,new tb(6,15),new tb(2,16))),new tA(11,Int32Array.from([6,30,54]),new tE(20,new tb(4,81)),new tE(30,new tb(1,50),new tb(4,51)),new tE(28,new tb(4,22),new tb(4,23)),new tE(24,new tb(3,12),new tb(8,13))),new tA(12,Int32Array.from([6,32,58]),new tE(24,new tb(2,92),new tb(2,93)),new tE(22,new tb(6,36),new tb(2,37)),new tE(26,new tb(4,20),new tb(6,21)),new tE(28,new tb(7,14),new tb(4,15))),new tA(13,Int32Array.from([6,34,62]),new tE(26,new tb(4,107)),new tE(22,new tb(8,37),new tb(1,38)),new tE(24,new tb(8,20),new tb(4,21)),new tE(22,new tb(12,11),new tb(4,12))),new tA(14,Int32Array.from([6,26,46,66]),new tE(30,new tb(3,115),new tb(1,116)),new tE(24,new tb(4,40),new tb(5,41)),new tE(20,new tb(11,16),new tb(5,17)),new tE(24,new tb(11,12),new tb(5,13))),new tA(15,Int32Array.from([6,26,48,70]),new tE(22,new tb(5,87),new tb(1,88)),new tE(24,new tb(5,41),new tb(5,42)),new tE(30,new tb(5,24),new tb(7,25)),new tE(24,new tb(11,12),new tb(7,13))),new tA(16,Int32Array.from([6,26,50,74]),new tE(24,new tb(5,98),new tb(1,99)),new tE(28,new tb(7,45),new tb(3,46)),new tE(24,new tb(15,19),new tb(2,20)),new tE(30,new tb(3,15),new tb(13,16))),new tA(17,Int32Array.from([6,30,54,78]),new tE(28,new tb(1,107),new tb(5,108)),new tE(28,new tb(10,46),new tb(1,47)),new tE(28,new tb(1,22),new tb(15,23)),new tE(28,new tb(2,14),new tb(17,15))),new tA(18,Int32Array.from([6,30,56,82]),new tE(30,new tb(5,120),new tb(1,121)),new tE(26,new tb(9,43),new tb(4,44)),new tE(28,new tb(17,22),new tb(1,23)),new tE(28,new tb(2,14),new tb(19,15))),new tA(19,Int32Array.from([6,30,58,86]),new tE(28,new tb(3,113),new tb(4,114)),new tE(26,new tb(3,44),new tb(11,45)),new tE(26,new tb(17,21),new tb(4,22)),new tE(26,new tb(9,13),new tb(16,14))),new tA(20,Int32Array.from([6,34,62,90]),new tE(28,new tb(3,107),new tb(5,108)),new tE(26,new tb(3,41),new tb(13,42)),new tE(30,new tb(15,24),new tb(5,25)),new tE(28,new tb(15,15),new tb(10,16))),new tA(21,Int32Array.from([6,28,50,72,94]),new tE(28,new tb(4,116),new tb(4,117)),new tE(26,new tb(17,42)),new tE(28,new tb(17,22),new tb(6,23)),new tE(30,new tb(19,16),new tb(6,17))),new tA(22,Int32Array.from([6,26,50,74,98]),new tE(28,new tb(2,111),new tb(7,112)),new tE(28,new tb(17,46)),new tE(30,new tb(7,24),new tb(16,25)),new tE(24,new tb(34,13))),new tA(23,Int32Array.from([6,30,54,78,102]),new tE(30,new tb(4,121),new tb(5,122)),new tE(28,new tb(4,47),new tb(14,48)),new tE(30,new tb(11,24),new tb(14,25)),new tE(30,new tb(16,15),new tb(14,16))),new tA(24,Int32Array.from([6,28,54,80,106]),new tE(30,new tb(6,117),new tb(4,118)),new tE(28,new tb(6,45),new tb(14,46)),new tE(30,new tb(11,24),new tb(16,25)),new tE(30,new tb(30,16),new tb(2,17))),new tA(25,Int32Array.from([6,32,58,84,110]),new tE(26,new tb(8,106),new tb(4,107)),new tE(28,new tb(8,47),new tb(13,48)),new tE(30,new tb(7,24),new tb(22,25)),new tE(30,new tb(22,15),new tb(13,16))),new tA(26,Int32Array.from([6,30,58,86,114]),new tE(28,new tb(10,114),new tb(2,115)),new tE(28,new tb(19,46),new tb(4,47)),new tE(28,new tb(28,22),new tb(6,23)),new tE(30,new tb(33,16),new tb(4,17))),new tA(27,Int32Array.from([6,34,62,90,118]),new tE(30,new tb(8,122),new tb(4,123)),new tE(28,new tb(22,45),new tb(3,46)),new tE(30,new tb(8,23),new tb(26,24)),new tE(30,new tb(12,15),new tb(28,16))),new tA(28,Int32Array.from([6,26,50,74,98,122]),new tE(30,new tb(3,117),new tb(10,118)),new tE(28,new tb(3,45),new tb(23,46)),new tE(30,new tb(4,24),new tb(31,25)),new tE(30,new tb(11,15),new tb(31,16))),new tA(29,Int32Array.from([6,30,54,78,102,126]),new tE(30,new tb(7,116),new tb(7,117)),new tE(28,new tb(21,45),new tb(7,46)),new tE(30,new tb(1,23),new tb(37,24)),new tE(30,new tb(19,15),new tb(26,16))),new tA(30,Int32Array.from([6,26,52,78,104,130]),new tE(30,new tb(5,115),new tb(10,116)),new tE(28,new tb(19,47),new tb(10,48)),new tE(30,new tb(15,24),new tb(25,25)),new tE(30,new tb(23,15),new tb(25,16))),new tA(31,Int32Array.from([6,30,56,82,108,134]),new tE(30,new tb(13,115),new tb(3,116)),new tE(28,new tb(2,46),new tb(29,47)),new tE(30,new tb(42,24),new tb(1,25)),new tE(30,new tb(23,15),new tb(28,16))),new tA(32,Int32Array.from([6,34,60,86,112,138]),new tE(30,new tb(17,115)),new tE(28,new tb(10,46),new tb(23,47)),new tE(30,new tb(10,24),new tb(35,25)),new tE(30,new tb(19,15),new tb(35,16))),new tA(33,Int32Array.from([6,30,58,86,114,142]),new tE(30,new tb(17,115),new tb(1,116)),new tE(28,new tb(14,46),new tb(21,47)),new tE(30,new tb(29,24),new tb(19,25)),new tE(30,new tb(11,15),new tb(46,16))),new tA(34,Int32Array.from([6,34,62,90,118,146]),new tE(30,new tb(13,115),new tb(6,116)),new tE(28,new tb(14,46),new tb(23,47)),new tE(30,new tb(44,24),new tb(7,25)),new tE(30,new tb(59,16),new tb(1,17))),new tA(35,Int32Array.from([6,30,54,78,102,126,150]),new tE(30,new tb(12,121),new tb(7,122)),new tE(28,new tb(12,47),new tb(26,48)),new tE(30,new tb(39,24),new tb(14,25)),new tE(30,new tb(22,15),new tb(41,16))),new tA(36,Int32Array.from([6,24,50,76,102,128,154]),new tE(30,new tb(6,121),new tb(14,122)),new tE(28,new tb(6,47),new tb(34,48)),new tE(30,new tb(46,24),new tb(10,25)),new tE(30,new tb(2,15),new tb(64,16))),new tA(37,Int32Array.from([6,28,54,80,106,132,158]),new tE(30,new tb(17,122),new tb(4,123)),new tE(28,new tb(29,46),new tb(14,47)),new tE(30,new tb(49,24),new tb(10,25)),new tE(30,new tb(24,15),new tb(46,16))),new tA(38,Int32Array.from([6,32,58,84,110,136,162]),new tE(30,new tb(4,122),new tb(18,123)),new tE(28,new tb(13,46),new tb(32,47)),new tE(30,new tb(48,24),new tb(14,25)),new tE(30,new tb(42,15),new tb(32,16))),new tA(39,Int32Array.from([6,26,54,82,110,138,166]),new tE(30,new tb(20,117),new tb(4,118)),new tE(28,new tb(40,47),new tb(7,48)),new tE(30,new tb(43,24),new tb(22,25)),new tE(30,new tb(10,15),new tb(67,16))),new tA(40,Int32Array.from([6,30,58,86,114,142,170]),new tE(30,new tb(19,118),new tb(6,119)),new tE(28,new tb(18,47),new tb(31,48)),new tE(30,new tb(34,24),new tb(34,25)),new tE(30,new tb(20,15),new tb(61,16)))],(c=A||(A={}))[c.DATA_MASK_000=0]="DATA_MASK_000",c[c.DATA_MASK_001=1]="DATA_MASK_001",c[c.DATA_MASK_010=2]="DATA_MASK_010",c[c.DATA_MASK_011=3]="DATA_MASK_011",c[c.DATA_MASK_100=4]="DATA_MASK_100",c[c.DATA_MASK_101=5]="DATA_MASK_101",c[c.DATA_MASK_110=6]="DATA_MASK_110",c[c.DATA_MASK_111=7]="DATA_MASK_111";class tC{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let r=0;r<t;r++)for(let n=0;n<t;n++)this.isMasked(r,n)&&e.flip(n,r)}}tC.values=new Map([[A.DATA_MASK_000,new tC(A.DATA_MASK_000,(e,t)=>(e+t&1)==0)],[A.DATA_MASK_001,new tC(A.DATA_MASK_001,(e,t)=>(1&e)==0)],[A.DATA_MASK_010,new tC(A.DATA_MASK_010,(e,t)=>t%3==0)],[A.DATA_MASK_011,new tC(A.DATA_MASK_011,(e,t)=>(e+t)%3==0)],[A.DATA_MASK_100,new tC(A.DATA_MASK_100,(e,t)=>(Math.floor(e/2)+Math.floor(t/3)&1)==0)],[A.DATA_MASK_101,new tC(A.DATA_MASK_101,(e,t)=>e*t%6==0)],[A.DATA_MASK_110,new tC(A.DATA_MASK_110,(e,t)=>e*t%6<3)],[A.DATA_MASK_111,new tC(A.DATA_MASK_111,(e,t)=>(e+t+e*t%3&1)==0)]]);class t_{constructor(e){const t=e.getHeight();if(t<21||(3&t)!=1)throw new V;this.bitMatrix=e}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let e=0;for(let t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let t=5;t>=0;t--)e=this.copyBit(8,t,e);let t=this.bitMatrix.getHeight(),r=0,n=t-7;for(let e=t-1;e>=n;e--)r=this.copyBit(8,e,r);for(let e=t-8;e<t;e++)r=this.copyBit(e,8,r);if(this.parsedFormatInfo=tw.decodeFormatInformation(e,r),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new V}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;let e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return tA.getVersionForNumber(t);let r=0,n=e-11;for(let t=5;t>=0;t--)for(let i=e-9;i>=n;i--)r=this.copyBit(i,t,r);let i=tA.decodeVersionInformation(r);if(null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;r=0;for(let t=5;t>=0;t--)for(let i=e-9;i>=n;i--)r=this.copyBit(t,i,r);if(null!==(i=tA.decodeVersionInformation(r))&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new V}copyBit(e,t,r){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?r<<1|1:r<<1}readCodewords(){let e=this.readFormatInformation(),t=this.readVersion(),r=tC.values.get(e.getDataMask()),n=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,n);let i=t.buildFunctionPattern(),a=!0,o=new Uint8Array(t.getTotalCodewords()),s=0,l=0,u=0;for(let e=n-1;e>0;e-=2){6===e&&e--;for(let t=0;t<n;t++){let r=a?n-1-t:t;for(let t=0;t<2;t++)i.get(e-t,r)||(u++,l<<=1,this.bitMatrix.get(e-t,r)&&(l|=1),8===u&&(o[s++]=l,u=0,l=0))}a=!a}if(s!==t.getTotalCodewords())throw new V;return o}remask(){if(null===this.parsedFormatInfo)return;let e=tC.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){let e=this.bitMatrix;for(let t=0,r=e.getWidth();t<r;t++)for(let r=t+1,n=e.getHeight();r<n;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class tS{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,r){if(e.length!==t.getTotalCodewords())throw new N;let n=t.getECBlocksForLevel(r),i=0,a=n.getECBlocks();for(let e of a)i+=e.getCount();let o=Array(i),s=0;for(let e of a)for(let t=0;t<e.getCount();t++){let t=e.getDataCodewords(),r=n.getECCodewordsPerBlock()+t;o[s++]=new tS(t,new Uint8Array(r))}let l=o[0].codewords.length,u=o.length-1;for(;u>=0&&o[u].codewords.length!==l;)u--;u++;let c=l-n.getECCodewordsPerBlock(),h=0;for(let t=0;t<c;t++)for(let r=0;r<s;r++)o[r].codewords[t]=e[h++];for(let t=u;t<s;t++)o[t].codewords[c]=e[h++];let d=o[0].codewords.length;for(let t=c;t<d;t++)for(let r=0;r<s;r++){let n=r<u?t:t+1;o[r].codewords[n]=e[h++]}return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}(h=C||(C={}))[h.TERMINATOR=0]="TERMINATOR",h[h.NUMERIC=1]="NUMERIC",h[h.ALPHANUMERIC=2]="ALPHANUMERIC",h[h.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",h[h.BYTE=4]="BYTE",h[h.ECI=5]="ECI",h[h.KANJI=6]="KANJI",h[h.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",h[h.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",h[h.HANZI=9]="HANZI";class tI{constructor(e,t,r,n){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=r,this.bits=n,tI.FOR_BITS.set(n,this),tI.FOR_VALUE.set(e,this)}static forBits(e){let t=tI.FOR_BITS.get(e);if(void 0===t)throw new N;return t}getCharacterCountBits(e){let t,r=e.getVersionNumber();return t=r<=9?0:r<=26?1:2,this.characterCountBitsForVersions[t]}getValue(){return this.value}getBits(){return this.bits}equals(e){return e instanceof tI&&this.value===e.value}toString(){return this.stringValue}}tI.FOR_BITS=new Map,tI.FOR_VALUE=new Map,tI.TERMINATOR=new tI(C.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),tI.NUMERIC=new tI(C.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),tI.ALPHANUMERIC=new tI(C.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),tI.STRUCTURED_APPEND=new tI(C.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),tI.BYTE=new tI(C.BYTE,"BYTE",Int32Array.from([8,16,16]),4),tI.ECI=new tI(C.ECI,"ECI",Int32Array.from([0,0,0]),7),tI.KANJI=new tI(C.KANJI,"KANJI",Int32Array.from([8,10,12]),8),tI.FNC1_FIRST_POSITION=new tI(C.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),tI.FNC1_SECOND_POSITION=new tI(C.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),tI.HANZI=new tI(C.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class tT{static decode(e,t,r,n){let i=new tf(e),a=new G,o=[],s=-1,l=-1;try{let e,r=null,u=!1;do{if(4>i.available())e=tI.TERMINATOR;else{let t=i.readBits(4);e=tI.forBits(t)}switch(e){case tI.TERMINATOR:break;case tI.FNC1_FIRST_POSITION:case tI.FNC1_SECOND_POSITION:u=!0;break;case tI.STRUCTURED_APPEND:if(16>i.available())throw new V;s=i.readBits(8),l=i.readBits(8);break;case tI.ECI:let c=tT.parseECIValue(i);if(r=H.getCharacterSetECIByValue(c),null===r)throw new V;break;case tI.HANZI:let h=i.readBits(4),d=i.readBits(e.getCharacterCountBits(t));h===tT.GB2312_SUBSET&&tT.decodeHanziSegment(i,a,d);break;default:let f=i.readBits(e.getCharacterCountBits(t));switch(e){case tI.NUMERIC:tT.decodeNumericSegment(i,a,f);break;case tI.ALPHANUMERIC:tT.decodeAlphanumericSegment(i,a,f,u);break;case tI.BYTE:tT.decodeByteSegment(i,a,f,r,o,n);break;case tI.KANJI:tT.decodeKanjiSegment(i,a,f);break;default:throw new V}}}while(e!==tI.TERMINATOR)}catch(e){throw new V}return new eo(e,a.toString(),0===o.length?null:o,null===r?null:r.toString(),s,l)}static decodeHanziSegment(e,t,r){if(13*r>e.available())throw new V;let n=new Uint8Array(2*r),i=0;for(;r>0;){let t=e.readBits(13),a=t/96<<8|t%96;a<959?a+=41377:a+=42657,n[i]=a>>8&255,n[i+1]=255&a,i+=2,r--}try{t.append(Y.decode(n,X.GB2312))}catch(e){throw new V(e)}}static decodeKanjiSegment(e,t,r){if(13*r>e.available())throw new V;let n=new Uint8Array(2*r),i=0;for(;r>0;){let t=e.readBits(13),a=t/192<<8|t%192;a<7936?a+=33088:a+=49472,n[i]=a>>8,n[i+1]=a,i+=2,r--}try{t.append(Y.decode(n,X.SHIFT_JIS))}catch(e){throw new V(e)}}static decodeByteSegment(e,t,r,n,i,a){let o;if(8*r>e.available())throw new V;let s=new Uint8Array(r);for(let t=0;t<r;t++)s[t]=e.readBits(8);o=null===n?X.guessEncoding(s,a):n.getName();try{t.append(Y.decode(s,o))}catch(e){throw new V(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=tT.ALPHANUMERIC_CHARS.length)throw new V;return tT.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,r,n){let i=t.length();for(;r>1;){if(11>e.available())throw new V;let n=e.readBits(11);t.append(tT.toAlphaNumericChar(Math.floor(n/45))),t.append(tT.toAlphaNumericChar(n%45)),r-=2}if(1===r){if(6>e.available())throw new V;t.append(tT.toAlphaNumericChar(e.readBits(6)))}if(n)for(let e=i;e<t.length();e++)"%"===t.charAt(e)&&(e<t.length()-1&&"%"===t.charAt(e+1)?t.deleteCharAt(e+1):t.setCharAt(e,"\x1d"))}static decodeNumericSegment(e,t,r){for(;r>=3;){if(10>e.available())throw new V;let n=e.readBits(10);if(n>=1e3)throw new V;t.append(tT.toAlphaNumericChar(Math.floor(n/100))),t.append(tT.toAlphaNumericChar(Math.floor(n/10)%10)),t.append(tT.toAlphaNumericChar(n%10)),r-=3}if(2===r){if(7>e.available())throw new V;let r=e.readBits(7);if(r>=100)throw new V;t.append(tT.toAlphaNumericChar(Math.floor(r/10))),t.append(tT.toAlphaNumericChar(r%10))}else if(1===r){if(4>e.available())throw new V;let r=e.readBits(4);if(r>=10)throw new V;t.append(tT.toAlphaNumericChar(r))}}static parseECIValue(e){let t=e.readBits(8);if((128&t)==0)return 127&t;if((192&t)==128)return(63&t)<<8|e.readBits(8);if((224&t)==192)return(31&t)<<16|e.readBits(16);throw new V}}tT.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",tT.GB2312_SUBSET=1;class tx{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||null===e||e.length<3)return;let t=e[0];e[0]=e[2],e[2]=t}}class tD{constructor(){this.rsDecoder=new ef(ec.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(W.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){let r=new t_(e),n=null;try{return this.decodeBitMatrixParser(r,t)}catch(e){n=e}try{r.remask(),r.setMirror(!0),r.readVersion(),r.readFormatInformation(),r.mirror();let e=this.decodeBitMatrixParser(r,t);return e.setOther(new tx(!0)),e}catch(e){if(null!==n)throw n;throw e}}decodeBitMatrixParser(e,t){let r=e.readVersion(),n=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),a=tS.getDataBlocks(i,r,n),o=0;for(let e of a)o+=e.getNumDataCodewords();let s=new Uint8Array(o),l=0;for(let e of a){let t=e.getCodewords(),r=e.getNumDataCodewords();this.correctErrors(t,r);for(let e=0;e<r;e++)s[l++]=t[e]}return tT.decode(s,r,n,t)}correctErrors(e,t){let r=new Int32Array(e);try{this.rsDecoder.decode(r,e.length-t)}catch(e){throw new R}for(let n=0;n<t;n++)e[n]=r[n]}}class tN extends ev{constructor(e,t,r){super(e,t),this.estimatedModuleSize=r}aboutEquals(e,t,r){if(Math.abs(t-this.getY())<=e&&Math.abs(r-this.getX())<=e){let t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,r){return new tN((this.getX()+t)/2,(this.getY()+e)/2,(this.estimatedModuleSize+r)/2)}}class tM{constructor(e,t,r,n,i,a,o){this.image=e,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=a,this.resultPointCallback=o,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){let e=this.startX,t=this.height,r=e+this.width,n=this.startY+t/2,i=new Int32Array(3),a=this.image;for(let o=0;o<t;o++){let t=n+((1&o)==0?Math.floor((o+1)/2):-Math.floor((o+1)/2));i[0]=0,i[1]=0,i[2]=0;let s=e;for(;s<r&&!a.get(s,t);)s++;let l=0;for(;s<r;){if(a.get(s,t))if(1===l)i[1]++;else if(2===l){if(this.foundPatternCross(i)){let e=this.handlePossibleCenter(i,t,s);if(null!==e)return e}i[0]=i[2],i[1]=1,i[2]=0,l=1}else i[++l]++;else 1===l&&l++,i[l]++;s++}if(this.foundPatternCross(i)){let e=this.handlePossibleCenter(i,t,r);if(null!==e)return e}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new q}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){let t=this.moduleSize,r=t/2;for(let n=0;n<3;n++)if(Math.abs(t-e[n])>=r)return!1;return!0}crossCheckVertical(e,t,r,n){let i=this.image,a=i.getHeight(),o=this.crossCheckStateCount;o[0]=0,o[1]=0,o[2]=0;let s=e;for(;s>=0&&i.get(t,s)&&o[1]<=r;)o[1]++,s--;if(s<0||o[1]>r)return NaN;for(;s>=0&&!i.get(t,s)&&o[0]<=r;)o[0]++,s--;if(o[0]>r)return NaN;for(s=e+1;s<a&&i.get(t,s)&&o[1]<=r;)o[1]++,s++;if(s===a||o[1]>r)return NaN;for(;s<a&&!i.get(t,s)&&o[2]<=r;)o[2]++,s++;return o[2]>r||5*Math.abs(o[0]+o[1]+o[2]-n)>=2*n?NaN:this.foundPatternCross(o)?tM.centerFromEnd(o,s):NaN}handlePossibleCenter(e,t,r){let n=e[0]+e[1]+e[2],i=tM.centerFromEnd(e,r),a=this.crossCheckVertical(t,i,2*e[1],n);if(!isNaN(a)){let t=(e[0]+e[1]+e[2])/3;for(let e of this.possibleCenters)if(e.aboutEquals(t,a,i))return e.combineEstimate(a,i,t);let r=new tN(i,a,t);this.possibleCenters.push(r),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(r)}return null}}class tR extends ev{constructor(e,t,r,n){super(e,t),this.estimatedModuleSize=r,this.count=n,void 0===n&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,r){if(Math.abs(t-this.getY())<=e&&Math.abs(r-this.getX())<=e){let t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,r){let n=this.count+1;return new tR((this.count*this.getX()+t)/n,(this.count*this.getY()+e)/n,(this.count*this.estimatedModuleSize+r)/n,n)}}class tO{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class tP{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){let t=null!=e&&void 0!==e.get(U.TRY_HARDER),r=null!=e&&void 0!==e.get(U.PURE_BARCODE),n=this.image,i=n.getHeight(),a=n.getWidth(),o=Math.floor(3*i/(4*tP.MAX_MODULES));(o<tP.MIN_SKIP||t)&&(o=tP.MIN_SKIP);let s=!1,l=new Int32Array(5);for(let e=o-1;e<i&&!s;e+=o){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let t=0;for(let i=0;i<a;i++)if(n.get(i,e))(1&t)==1&&t++,l[t]++;else if((1&t)==0)if(4===t)if(tP.foundPatternCross(l)){if(!0===this.handlePossibleCenter(l,e,i,r))if(o=2,!0===this.hasSkipped)s=this.haveMultiplyConfirmedCenters();else{let t=this.findRowSkip();t>l[2]&&(e+=t-l[2]-o,i=a-1)}else{l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;continue}t=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;else l[++t]++;else l[t]++;tP.foundPatternCross(l)&&!0===this.handlePossibleCenter(l,e,a,r)&&(o=l[0],this.hasSkipped&&(s=this.haveMultiplyConfirmedCenters()))}let u=this.selectBestPatterns();return ev.orderBestPatterns(u),new tO(u)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let r=0;r<5;r++){let n=e[r];if(0===n)return!1;t+=n}if(t<7)return!1;let r=t/7,n=r/2;return Math.abs(r-e[0])<n&&Math.abs(r-e[1])<n&&Math.abs(3*r-e[2])<3*n&&Math.abs(r-e[3])<n&&Math.abs(r-e[4])<n}getCrossCheckStateCount(){let e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,r,n){let i=this.getCrossCheckStateCount(),a=0,o=this.image;for(;e>=a&&t>=a&&o.get(t-a,e-a);)i[2]++,a++;if(e<a||t<a)return!1;for(;e>=a&&t>=a&&!o.get(t-a,e-a)&&i[1]<=r;)i[1]++,a++;if(e<a||t<a||i[1]>r)return!1;for(;e>=a&&t>=a&&o.get(t-a,e-a)&&i[0]<=r;)i[0]++,a++;if(i[0]>r)return!1;let s=o.getHeight(),l=o.getWidth();for(a=1;e+a<s&&t+a<l&&o.get(t+a,e+a);)i[2]++,a++;if(e+a>=s||t+a>=l)return!1;for(;e+a<s&&t+a<l&&!o.get(t+a,e+a)&&i[3]<r;)i[3]++,a++;if(e+a>=s||t+a>=l||i[3]>=r)return!1;for(;e+a<s&&t+a<l&&o.get(t+a,e+a)&&i[4]<r;)i[4]++,a++;return!(i[4]>=r)&&Math.abs(i[0]+i[1]+i[2]+i[3]+i[4]-n)<2*n&&tP.foundPatternCross(i)}crossCheckVertical(e,t,r,n){let i=this.image,a=i.getHeight(),o=this.getCrossCheckStateCount(),s=e;for(;s>=0&&i.get(t,s);)o[2]++,s--;if(s<0)return NaN;for(;s>=0&&!i.get(t,s)&&o[1]<=r;)o[1]++,s--;if(s<0||o[1]>r)return NaN;for(;s>=0&&i.get(t,s)&&o[0]<=r;)o[0]++,s--;if(o[0]>r)return NaN;for(s=e+1;s<a&&i.get(t,s);)o[2]++,s++;if(s===a)return NaN;for(;s<a&&!i.get(t,s)&&o[3]<r;)o[3]++,s++;if(s===a||o[3]>=r)return NaN;for(;s<a&&i.get(t,s)&&o[4]<r;)o[4]++,s++;return o[4]>=r||5*Math.abs(o[0]+o[1]+o[2]+o[3]+o[4]-n)>=2*n?NaN:tP.foundPatternCross(o)?tP.centerFromEnd(o,s):NaN}crossCheckHorizontal(e,t,r,n){let i=this.image,a=i.getWidth(),o=this.getCrossCheckStateCount(),s=e;for(;s>=0&&i.get(s,t);)o[2]++,s--;if(s<0)return NaN;for(;s>=0&&!i.get(s,t)&&o[1]<=r;)o[1]++,s--;if(s<0||o[1]>r)return NaN;for(;s>=0&&i.get(s,t)&&o[0]<=r;)o[0]++,s--;if(o[0]>r)return NaN;for(s=e+1;s<a&&i.get(s,t);)o[2]++,s++;if(s===a)return NaN;for(;s<a&&!i.get(s,t)&&o[3]<r;)o[3]++,s++;if(s===a||o[3]>=r)return NaN;for(;s<a&&i.get(s,t)&&o[4]<r;)o[4]++,s++;return o[4]>=r||5*Math.abs(o[0]+o[1]+o[2]+o[3]+o[4]-n)>=n?NaN:tP.foundPatternCross(o)?tP.centerFromEnd(o,s):NaN}handlePossibleCenter(e,t,r,n){let i=e[0]+e[1]+e[2]+e[3]+e[4],a=tP.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(a),e[2],i);if(!isNaN(o)&&!isNaN(a=this.crossCheckHorizontal(Math.floor(a),Math.floor(o),e[2],i))&&(!n||this.crossCheckDiagonal(Math.floor(o),Math.floor(a),e[2],i))){let e=i/7,t=!1,r=this.possibleCenters;for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.aboutEquals(e,o,a)){r[n]=i.combineEstimate(o,a,e),t=!0;break}}if(!t){let t=new tR(a,o,e);r.push(t),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(t)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let e=null;for(let t of this.possibleCenters)if(t.getCount()>=tP.CENTER_QUORUM)if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.getX()-t.getX())-Math.abs(e.getY()-t.getY()))/2);else e=t;return 0}haveMultiplyConfirmedCenters(){let e=0,t=0,r=this.possibleCenters.length;for(let r of this.possibleCenters)r.getCount()>=tP.CENTER_QUORUM&&(e++,t+=r.getEstimatedModuleSize());if(e<3)return!1;let n=t/r,i=0;for(let e of this.possibleCenters)i+=Math.abs(e.getEstimatedModuleSize()-n);return i<=.05*t}selectBestPatterns(){let e,t=this.possibleCenters.length;if(t<3)throw new q;let r=this.possibleCenters;if(t>3){let n=0,i=0;for(let e of this.possibleCenters){let t=e.getEstimatedModuleSize();n+=t,i+=t*t}e=n/t;let a=Math.sqrt(i/t-e*e);r.sort((t,r)=>{let n=Math.abs(r.getEstimatedModuleSize()-e),i=Math.abs(t.getEstimatedModuleSize()-e);return n<i?-1:+(n>i)});let o=Math.max(.2*e,a);for(let t=0;t<r.length&&r.length>3;t++)Math.abs(r[t].getEstimatedModuleSize()-e)>o&&(r.splice(t,1),t--)}if(r.length>3){let t=0;for(let e of r)t+=e.getEstimatedModuleSize();e=t/r.length,r.sort((t,r)=>{if(r.getCount()!==t.getCount())return r.getCount()-t.getCount();{let n=Math.abs(r.getEstimatedModuleSize()-e),i=Math.abs(t.getEstimatedModuleSize()-e);return n<i?1:n>i?-1:0}}),r.splice(3)}return[r[0],r[1],r[2]]}}tP.CENTER_QUORUM=2,tP.MIN_SKIP=3,tP.MAX_MODULES=57;class tB{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=null==e?null:e.get(U.NEED_RESULT_POINT_CALLBACK);let t=new tP(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(t)}processFinderPatternInfo(e){let t=e.getTopLeft(),r=e.getTopRight(),n=e.getBottomLeft(),i=this.calculateModuleSize(t,r,n);if(i<1)throw new q("No pattern found in proccess finder.");let a=tB.computeDimension(t,r,n,i),o=tA.getProvisionalVersionForDimension(a),s=o.getDimensionForVersion()-7,l=null;if(o.getAlignmentPatternCenters().length>0){let e=r.getX()-t.getX()+n.getX(),a=r.getY()-t.getY()+n.getY(),o=1-3/s,u=Math.floor(t.getX()+o*(e-t.getX())),c=Math.floor(t.getY()+o*(a-t.getY()));for(let e=4;e<=16;e<<=1)try{l=this.findAlignmentInRegion(i,u,c,e);break}catch(e){if(!(e instanceof q))throw e}}let u=tB.createTransform(t,r,n,l,a);return new ey(tB.sampleGrid(this.image,u,a),null===l?[n,t,r]:[n,t,r,l])}static createTransform(e,t,r,n,i){let a,o,s,l,u=i-3.5;return null!==n?(a=n.getX(),o=n.getY(),l=s=u-3):(a=t.getX()-e.getX()+r.getX(),o=t.getY()-e.getY()+r.getY(),s=u,l=u),eA.quadrilateralToQuadrilateral(3.5,3.5,u,3.5,s,l,3.5,u,e.getX(),e.getY(),t.getX(),t.getY(),a,o,r.getX(),r.getY())}static sampleGrid(e,t,r){return e_.getInstance().sampleGridWithTransform(e,r,r,t)}static computeDimension(e,t,r,n){let i=Math.floor((ep.round(ev.distance(e,t)/n)+ep.round(ev.distance(e,r)/n))/2)+7;switch(3&i){case 0:i++;break;case 2:i--;break;case 3:throw new q("Dimensions could be not found.")}return i}calculateModuleSize(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2}calculateModuleSizeOneWay(e,t){let r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,r,n){let i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),a=1,o=e-(r-e);o<0?(a=e/(e-o),o=0):o>=this.image.getWidth()&&(a=(this.image.getWidth()-1-e)/(o-e),o=this.image.getWidth()-1);let s=Math.floor(t-(n-t)*a);return a=1,s<0?(a=t/(t-s),s=0):s>=this.image.getHeight()&&(a=(this.image.getHeight()-1-t)/(s-t),s=this.image.getHeight()-1),o=Math.floor(e+(o-e)*a),(i+=this.sizeOfBlackWhiteBlackRun(e,t,o,s))-1}sizeOfBlackWhiteBlackRun(e,t,r,n){let i=Math.abs(n-t)>Math.abs(r-e);if(i){let i=e;e=t,t=i,i=r,r=n,n=i}let a=Math.abs(r-e),o=Math.abs(n-t),s=-a/2,l=e<r?1:-1,u=t<n?1:-1,c=0,h=r+l;for(let r=e,d=t;r!==h;r+=l){let l=i?d:r,h=i?r:d;if(1===c===this.image.get(l,h)){if(2===c)return ep.distance(r,d,e,t);c++}if((s+=o)>0){if(d===n)break;d+=u,s-=a}}return 2===c?ep.distance(r+l,n,e,t):NaN}findAlignmentInRegion(e,t,r,n){let i=Math.floor(n*e),a=Math.max(0,t-i),o=Math.min(this.image.getWidth()-1,t+i);if(o-a<3*e)throw new q("Alignment top exceeds estimated module size.");let s=Math.max(0,r-i),l=Math.min(this.image.getHeight()-1,r+i);if(l-s<3*e)throw new q("Alignment bottom exceeds estimated module size.");return new tM(this.image,a,s,o-a,l-s,e,this.resultPointCallback).find()}}class tL{constructor(){this.decoder=new tD}getDecoder(){return this.decoder}decode(e,t){let r,n;if(null!=t&&void 0!==t.get(U.PURE_BARCODE)){let i=tL.extractPureBits(e.getBlackMatrix());r=this.decoder.decodeBitMatrix(i,t),n=tL.NO_POINTS}else{let i=new tB(e.getBlackMatrix()).detect(t);r=this.decoder.decodeBitMatrix(i.getBits(),t),n=i.getPoints()}r.getOther()instanceof tx&&r.getOther().applyMirroredCorrection(n);let i=new en(r.getText(),r.getRawBytes(),void 0,n,ei.QR_CODE,void 0),a=r.getByteSegments();null!==a&&i.putMetadata(ea.BYTE_SEGMENTS,a);let o=r.getECLevel();return null!==o&&i.putMetadata(ea.ERROR_CORRECTION_LEVEL,o),r.hasStructuredAppend()&&(i.putMetadata(ea.STRUCTURED_APPEND_SEQUENCE,r.getStructuredAppendSequenceNumber()),i.putMetadata(ea.STRUCTURED_APPEND_PARITY,r.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null===t||null===r)throw new q;let n=this.moduleSize(t,e),i=t[1],a=r[1],o=t[0],s=r[0];if(o>=s||i>=a||a-i!=s-o&&(s=o+(a-i))>=e.getWidth())throw new q;let l=Math.round((s-o+1)/n),u=Math.round((a-i+1)/n);if(l<=0||u<=0||u!==l)throw new q;let c=Math.floor(n/2);i+=c;let h=(o+=c)+Math.floor((l-1)*n)-s;if(h>0){if(h>c)throw new q;o-=h}let d=i+Math.floor((u-1)*n)-a;if(d>0){if(d>c)throw new q;i-=d}let f=new W(l,u);for(let t=0;t<u;t++){let r=i+Math.floor(t*n);for(let i=0;i<l;i++)e.get(o+Math.floor(i*n),r)&&f.set(i,t)}return f}static moduleSize(e,t){let r=t.getHeight(),n=t.getWidth(),i=e[0],a=e[1],o=!0,s=0;for(;i<n&&a<r;){if(o!==t.get(i,a)){if(5==++s)break;o=!o}i++,a++}if(i===n||a===r)throw new q;return(i-e[0])/7}}tL.NO_POINTS=[];class tk{PDF417Common(){}static getBitCountSum(e){return ep.sum(e)}static toIntArray(e){if(null==e||!e.length)return tk.EMPTY_INT_ARRAY;let t=new Int32Array(e.length),r=0;for(let n of e)t[r++]=n;return t}static getCodeword(e){let t=k.binarySearch(tk.SYMBOL_TABLE,262143&e);return t<0?-1:(tk.CODEWORD_TABLE[t]-1)%tk.NUMBER_OF_CODEWORDS}}tk.NUMBER_OF_CODEWORDS=929,tk.MAX_CODEWORDS_IN_BARCODE=tk.NUMBER_OF_CODEWORDS-1,tk.MIN_ROWS_IN_BARCODE=3,tk.MAX_ROWS_IN_BARCODE=90,tk.MODULES_IN_CODEWORD=17,tk.MODULES_IN_STOP_PATTERN=18,tk.BARS_IN_MODULE=8,tk.EMPTY_INT_ARRAY=new Int32Array([]),tk.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),tk.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class tF{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class tz{static detectMultiple(e,t,r){let n=e.getBlackMatrix(),i=tz.detect(r,n);return i.length||((n=n.clone()).rotate180(),i=tz.detect(r,n)),new tF(n,i)}static detect(e,t){let r=[],n=0,i=0,a=!1;for(;n<t.getHeight();){let o=tz.findVertices(t,n,i);if(null==o[0]&&null==o[3]){if(!a)break;for(let e of(a=!1,i=0,r))null!=e[1]&&(n=Math.trunc(Math.max(n,e[1].getY()))),null!=e[3]&&(n=Math.max(n,Math.trunc(e[3].getY())));n+=tz.ROW_STEP;continue}if(a=!0,r.push(o),!e)break;null!=o[2]?(i=Math.trunc(o[2].getX()),n=Math.trunc(o[2].getY())):(i=Math.trunc(o[4].getX()),n=Math.trunc(o[4].getY()))}return r}static findVertices(e,t,r){let n=e.getHeight(),i=e.getWidth(),a=Array(8);return tz.copyToResult(a,tz.findRowsWithPattern(e,n,i,t,r,tz.START_PATTERN),tz.INDEXES_START_PATTERN),null!=a[4]&&(r=Math.trunc(a[4].getX()),t=Math.trunc(a[4].getY())),tz.copyToResult(a,tz.findRowsWithPattern(e,n,i,t,r,tz.STOP_PATTERN),tz.INDEXES_STOP_PATTERN),a}static copyToResult(e,t,r){for(let n=0;n<r.length;n++)e[r[n]]=t[n]}static findRowsWithPattern(e,t,r,n,i,a){let o=[,,,,],s=!1,l=new Int32Array(a.length);for(;n<t;n+=tz.ROW_STEP){let t=tz.findGuardPattern(e,i,n,r,!1,a,l);if(null!=t){for(;n>0;){let o=tz.findGuardPattern(e,i,--n,r,!1,a,l);if(null!=o)t=o;else{n++;break}}o[0]=new ev(t[0],n),o[1]=new ev(t[1],n),s=!0;break}}let u=n+1;if(s){let n=0,i=Int32Array.from([Math.trunc(o[0].getX()),Math.trunc(o[1].getX())]);for(;u<t;u++){let t=tz.findGuardPattern(e,i[0],u,r,!1,a,l);if(null!=t&&Math.abs(i[0]-t[0])<tz.MAX_PATTERN_DRIFT&&Math.abs(i[1]-t[1])<tz.MAX_PATTERN_DRIFT)i=t,n=0;else if(n>tz.SKIPPED_ROW_COUNT_MAX)break;else n++}u-=n+1,o[2]=new ev(i[0],u),o[3]=new ev(i[1],u)}return u-n<tz.BARCODE_MIN_HEIGHT&&k.fill(o,null),o}static findGuardPattern(e,t,r,n,i,a,o){k.fillWithin(o,0,o.length,0);let s=t,l=0;for(;e.get(s,r)&&s>0&&l++<tz.MAX_PIXEL_DRIFT;)s--;let u=s,c=0,h=a.length;for(let t=i;u<n;u++)if(e.get(u,r)!==t)o[c]++;else{if(c===h-1){if(tz.patternMatchVariance(o,a,tz.MAX_INDIVIDUAL_VARIANCE)<tz.MAX_AVG_VARIANCE)return new Int32Array([s,u]);s+=o[0]+o[1],P.arraycopy(o,2,o,0,c-1),o[c-1]=0,o[c]=0,c--}else c++;o[c]=1,t=!t}return c===h-1&&tz.patternMatchVariance(o,a,tz.MAX_INDIVIDUAL_VARIANCE)<tz.MAX_AVG_VARIANCE?new Int32Array([s,u-1]):null}static patternMatchVariance(e,t,r){let n=e.length,i=0,a=0;for(let r=0;r<n;r++)i+=e[r],a+=t[r];if(i<a)return 1/0;let o=i/a;r*=o;let s=0;for(let i=0;i<n;i++){let n=e[i],a=t[i]*o,l=n>a?n-a:a-n;if(l>r)return 1/0;s+=l}return s/i}}tz.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),tz.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),tz.MAX_AVG_VARIANCE=.42,tz.MAX_INDIVIDUAL_VARIANCE=.8,tz.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),tz.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),tz.MAX_PIXEL_DRIFT=3,tz.MAX_PATTERN_DRIFT=5,tz.SKIPPED_ROW_COUNT_MAX=25,tz.ROW_STEP=5,tz.BARCODE_MIN_HEIGHT=10;class tU{constructor(e,t){if(0===t.length)throw new N;this.field=e;let r=t.length;if(r>1&&0===t[0]){let e=1;for(;e<r&&0===t[e];)e++;e===r?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(r-e),P.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);if(1===e){let e=0;for(let t of this.coefficients)e=this.field.add(e,t);return e}let t=this.coefficients[0],r=this.coefficients.length;for(let n=1;n<r;n++)t=this.field.add(this.field.multiply(e,t),this.coefficients[n]);return t}add(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,r=e.coefficients;if(t.length>r.length){let e=t;t=r,r=e}let n=new Int32Array(r.length),i=r.length-t.length;P.arraycopy(r,0,n,0,i);for(let e=i;e<r.length;e++)n[e]=this.field.add(t[e-i],r[e]);return new tU(this.field,n)}subtract(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof tU?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new N("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new tU(this.field,new Int32Array([0]));let t=this.coefficients,r=t.length,n=e.coefficients,i=n.length,a=new Int32Array(r+i-1);for(let e=0;e<r;e++){let r=t[e];for(let t=0;t<i;t++)a[e+t]=this.field.add(a[e+t],this.field.multiply(r,n[t]))}return new tU(this.field,a)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let r=0;r<e;r++)t[r]=this.field.subtract(0,this.coefficients[r]);return new tU(this.field,t)}multiplyScalar(e){if(0===e)return new tU(this.field,new Int32Array([0]));if(1===e)return this;let t=this.coefficients.length,r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=this.field.multiply(this.coefficients[n],e);return new tU(this.field,r)}multiplyByMonomial(e,t){if(e<0)throw new N;if(0===t)return new tU(this.field,new Int32Array([0]));let r=this.coefficients.length,n=new Int32Array(r+e);for(let e=0;e<r;e++)n[e]=this.field.multiply(this.coefficients[e],t);return new tU(this.field,n)}toString(){let e=new G;for(let t=this.getDegree();t>=0;t--){let r=this.getCoefficient(t);0!==r&&(r<0?(e.append(" - "),r=-r):e.length()>0&&e.append(" + "),(0===t||1!==r)&&e.append(r),0!==t&&(1===t?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class tV{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(0===e)throw new N;return this.logTable[e]}inverse(e){if(0===e)throw new eu;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class tH extends tV{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let r=1;for(let n=0;n<e;n++)this.expTable[n]=r,r=r*t%e;for(let t=0;t<e-1;t++)this.logTable[this.expTable[t]]=t;this.zero=new tU(this,new Int32Array([0])),this.one=new tU(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new N;if(0===t)return this.zero;let r=new Int32Array(e+1);return r[0]=t,new tU(this,r)}}tH.PDF417_GF=new tH(tk.NUMBER_OF_CODEWORDS,3);class tj{constructor(){this.field=tH.PDF417_GF}decode(e,t,r){let n=new tU(this.field,e),i=new Int32Array(t),a=!1;for(let e=t;e>0;e--){let r=n.evaluateAt(this.field.exp(e));i[t-e]=r,0!==r&&(a=!0)}if(!a)return 0;let o=this.field.getOne();if(null!=r)for(let t of r){let r=this.field.exp(e.length-1-t),n=new tU(this.field,new Int32Array([this.field.subtract(0,r),1]));o=o.multiply(n)}let s=new tU(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),s,t),u=l[0],c=l[1],h=this.findErrorLocations(u),d=this.findErrorMagnitudes(c,u,h);for(let t=0;t<h.length;t++){let r=e.length-1-this.field.log(h[t]);if(r<0)throw R.getChecksumInstance();e[r]=this.field.subtract(e[r],d[t])}return h.length}runEuclideanAlgorithm(e,t,r){if(e.getDegree()<t.getDegree()){let r=e;e=t,t=r}let n=e,i=t,a=this.field.getZero(),o=this.field.getOne();for(;i.getDegree()>=Math.round(r/2);){let e=n,t=a;if(n=i,a=o,n.isZero())throw R.getChecksumInstance();i=e;let r=this.field.getZero(),s=n.getCoefficient(n.getDegree()),l=this.field.inverse(s);for(;i.getDegree()>=n.getDegree()&&!i.isZero();){let e=i.getDegree()-n.getDegree(),t=this.field.multiply(i.getCoefficient(i.getDegree()),l);r=r.add(this.field.buildMonomial(e,t)),i=i.subtract(n.multiplyByMonomial(e,t))}o=r.multiply(a).subtract(t).negative()}let s=o.getCoefficient(0);if(0===s)throw R.getChecksumInstance();let l=this.field.inverse(s);return[o.multiply(l),i.multiply(l)]}findErrorLocations(e){let t=e.getDegree(),r=new Int32Array(t),n=0;for(let i=1;i<this.field.getSize()&&n<t;i++)0===e.evaluateAt(i)&&(r[n]=this.field.inverse(i),n++);if(n!==t)throw R.getChecksumInstance();return r}findErrorMagnitudes(e,t,r){let n=t.getDegree(),i=new Int32Array(n);for(let e=1;e<=n;e++)i[n-e]=this.field.multiply(e,t.getCoefficient(e));let a=new tU(this.field,i),o=r.length,s=new Int32Array(o);for(let t=0;t<o;t++){let n=this.field.inverse(r[t]),i=this.field.subtract(0,e.evaluateAt(n)),o=this.field.inverse(a.evaluateAt(n));s[t]=this.field.multiply(i,o)}return s}}class tY{constructor(e,t,r,n,i){e instanceof tY?this.constructor_2(e):this.constructor_1(e,t,r,n,i)}constructor_1(e,t,r,n,i){let a=null==t||null==r,o=null==n||null==i;if(a&&o)throw new q;a?(t=new ev(0,n.getY()),r=new ev(0,i.getY())):o&&(n=new ev(e.getWidth()-1,t.getY()),i=new ev(e.getWidth()-1,r.getY())),this.image=e,this.topLeft=t,this.bottomLeft=r,this.topRight=n,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),r.getX())),this.maxX=Math.trunc(Math.max(n.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),n.getY())),this.maxY=Math.trunc(Math.max(r.getY(),i.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return null==e?t:null==t?e:new tY(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,r){let n=this.topLeft,i=this.bottomLeft,a=this.topRight,o=this.bottomRight;if(e>0){let t=r?this.topLeft:this.topRight,i=Math.trunc(t.getY()-e);i<0&&(i=0);let o=new ev(t.getX(),i);r?n=o:a=o}if(t>0){let e=r?this.bottomLeft:this.bottomRight,n=Math.trunc(e.getY()+t);n>=this.image.getHeight()&&(n=this.image.getHeight()-1);let a=new ev(e.getX(),n);r?i=a:o=a}return new tY(this.image,n,i,a,o)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class tX{constructor(e,t,r,n){this.columnCount=e,this.errorCorrectionLevel=n,this.rowCountUpperPart=t,this.rowCountLowerPart=r,this.rowCount=t+r}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class tG{constructor(){this.buffer=""}static form(e,t){let r=-1;return e.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,function(e,n,i,a,o,s){let l;if("%%"===e)return"%";if(void 0===t[++r])return;e=a?parseInt(a.substr(1)):void 0;let u=o?parseInt(o.substr(1)):void 0;switch(s){case"s":l=t[r];break;case"c":l=t[r][0];break;case"f":l=parseFloat(t[r]).toFixed(e);break;case"p":l=parseFloat(t[r]).toPrecision(e);break;case"e":l=parseFloat(t[r]).toExponential(e);break;case"x":l=parseInt(t[r]).toString(u||16);break;case"d":l=parseFloat(parseInt(t[r],u||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(u);let c=parseInt(i),h=i&&i[0]+""=="0"?"0":" ";for(;l.length<c;)l=void 0!==n?l+h:h+l;return l})}format(e,...t){this.buffer+=tG.form(e,t)}toString(){return this.buffer}}class tW{constructor(e){this.boundingBox=new tY(e),this.codewords=Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(null!=t)return t;for(let r=1;r<tW.MAX_NEARBY_DISTANCE;r++){let n=this.imageRowToCodewordIndex(e)-r;if(n>=0&&null!=(t=this.codewords[n])||(n=this.imageRowToCodewordIndex(e)+r)<this.codewords.length&&null!=(t=this.codewords[n]))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){let e=new tG,t=0;for(let r of this.codewords){if(null==r){e.format("%3d: | %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,r.getRowNumber(),r.getValue())}return e.toString()}}tW.MAX_NEARBY_DISTANCE=5;class tq{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);null==t&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=[];for(let[r,n]of this.values.entries()){let i=()=>r,a=()=>n;a()>e?(e=a(),(t=[]).push(i())):a()===e&&t.push(i())}return tk.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class tZ extends tW{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())null!=e&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let r=this.getBoundingBox(),n=this._isLeft?r.getTopLeft():r.getTopRight(),i=this._isLeft?r.getBottomLeft():r.getBottomRight(),a=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=-1,l=1,u=0;for(let r=a;r<o;r++){if(null==t[r])continue;let n=t[r],i=n.getRowNumber()-s;if(0===i)u++;else if(1===i)l=Math.max(l,u),u=1,s=n.getRowNumber();else if(i<0||n.getRowNumber()>=e.getRowCount()||i>r)t[r]=null;else{let e,a=(e=l>2?(l-2)*i:i)>=r;for(let n=1;n<=e&&!a;n++)a=null!=t[r-n];a?t[r]=null:(s=n.getRowNumber(),u=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(null==e)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let e of this.getCodewords())if(null!=e){let r=e.getRowNumber();if(r>=t.length)continue;t[r]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),r=this._isLeft?t.getTopLeft():t.getTopRight(),n=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(r.getY())),a=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.getCodewords(),s=-1;for(let t=i;t<a;t++){if(null==o[t])continue;let r=o[t];r.setRowNumberAsRowIndicatorColumn();let n=r.getRowNumber()-s;0===n||(1===n?s=r.getRowNumber():r.getRowNumber()>=e.getRowCount()?o[t]=null:s=r.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new tq,r=new tq,n=new tq,i=new tq;for(let a of e){if(null==a)continue;a.setRowNumberAsRowIndicatorColumn();let e=a.getValue()%30,o=a.getRowNumber();switch(!this._isLeft&&(o+=2),o%3){case 0:r.setValue(3*e+1);break;case 1:i.setValue(e/3),n.setValue(e%3);break;case 2:t.setValue(e+1)}}if(0===t.getValue().length||0===r.getValue().length||0===n.getValue().length||0===i.getValue().length||t.getValue()[0]<1||r.getValue()[0]+n.getValue()[0]<tk.MIN_ROWS_IN_BARCODE||r.getValue()[0]+n.getValue()[0]>tk.MAX_ROWS_IN_BARCODE)return null;let a=new tX(t.getValue()[0],r.getValue()[0],n.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,a),a}removeIncorrectCodewords(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(null==e[r])continue;let i=n.getValue()%30,a=n.getRowNumber();if(a>t.getRowCount()){e[r]=null;continue}switch(!this._isLeft&&(a+=2),a%3){case 0:3*i+1!==t.getRowCountUpperPart()&&(e[r]=null);break;case 1:(Math.trunc(i/3)!==t.getErrorCorrectionLevel()||i%3!==t.getRowCountLowerPart())&&(e[r]=null);break;case 2:i+1!==t.getColumnCount()&&(e[r]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class tQ{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){let e;this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let t=tk.MAX_CODEWORDS_IN_BARCODE;do e=t,t=this.adjustRowNumbersAndGetCount();while(t>0&&t<e);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){null!=e&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(0===e)return 0;for(let e=1;e<this.barcodeColumnCount+1;e++){let t=this.detectionResultColumns[e].getCodewords();for(let r=0;r<t.length;r++)null!=t[r]&&(t[r].hasValidRowNumber()||this.adjustRowNumbers(e,r,t))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(null==this.detectionResultColumns[0]||null==this.detectionResultColumns[this.barcodeColumnCount+1])return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let r=0;r<e.length;r++)if(null!=e[r]&&null!=t[r]&&e[r].getRowNumber()===t[r].getRowNumber())for(let t=1;t<=this.barcodeColumnCount;t++){let n=this.detectionResultColumns[t].getCodewords()[r];null!=n&&(n.setRowNumber(e[r].getRowNumber()),n.hasValidRowNumber()||(this.detectionResultColumns[t].getCodewords()[r]=null))}}adjustRowNumbersFromRRI(){if(null==this.detectionResultColumns[this.barcodeColumnCount+1])return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let r=0;r<t.length;r++){if(null==t[r])continue;let n=t[r].getRowNumber(),i=0;for(let t=this.barcodeColumnCount+1;t>0&&i<this.ADJUST_ROW_NUMBER_SKIP;t--){let a=this.detectionResultColumns[t].getCodewords()[r];null!=a&&(i=tQ.adjustRowNumberIfValid(n,i,a),!a.hasValidRowNumber()&&e++)}}return e}adjustRowNumbersFromLRI(){if(null==this.detectionResultColumns[0])return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let r=0;r<t.length;r++){if(null==t[r])continue;let n=t[r].getRowNumber(),i=0;for(let t=1;t<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;t++){let a=this.detectionResultColumns[t].getCodewords()[r];null!=a&&(i=tQ.adjustRowNumberIfValid(n,i,a),!a.hasValidRowNumber()&&e++)}}return e}static adjustRowNumberIfValid(e,t,r){return null==r||!r.hasValidRowNumber()&&(r.isValidRowNumber(e)?(r.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,r){if(!this.detectionResultColumns[e-1])return;let n=r[t],i=this.detectionResultColumns[e-1].getCodewords(),a=i;null!=this.detectionResultColumns[e+1]&&(a=this.detectionResultColumns[e+1].getCodewords());let o=Array(14);for(let e of(o[2]=i[t],o[3]=a[t],t>0&&(o[0]=r[t-1],o[4]=i[t-1],o[5]=a[t-1]),t>1&&(o[8]=r[t-2],o[10]=i[t-2],o[11]=a[t-2]),t<r.length-1&&(o[1]=r[t+1],o[6]=i[t+1],o[7]=a[t+1]),t<r.length-2&&(o[9]=r[t+2],o[12]=i[t+2],o[13]=a[t+2]),o))if(tQ.adjustRowNumber(n,e))return}static adjustRowNumber(e,t){return null!=t&&!!t.hasValidRowNumber()&&t.getBucket()===e.getBucket()&&(e.setRowNumber(t.getRowNumber()),!0)}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];null==e&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new tG;for(let r=0;r<e.getCodewords().length;r++){t.format("CW %3d:",r);for(let e=0;e<this.barcodeColumnCount+2;e++){if(null==this.detectionResultColumns[e]){t.format(" | ");continue}let n=this.detectionResultColumns[e].getCodewords()[r];if(null==n){t.format(" | ");continue}t.format(" %3d|%3d",n.getRowNumber(),n.getValue())}t.format("%n")}return t.toString()}}class tK{constructor(e,t,r,n){this.rowNumber=tK.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(r),this.value=Math.trunc(n)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==tK.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(3*Math.trunc(this.value/30)+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}tK.BARCODE_ROW_UNKNOWN=-1;class t${static initialize(){for(let e=0;e<tk.SYMBOL_TABLE.length;e++){let t=tk.SYMBOL_TABLE[e],r=1&t;for(let n=0;n<tk.BARS_IN_MODULE;n++){let i=0;for(;(1&t)===r;)i+=1,t>>=1;r=1&t,t$.RATIOS_TABLE[e]||(t$.RATIOS_TABLE[e]=Array(tk.BARS_IN_MODULE)),t$.RATIOS_TABLE[e][tk.BARS_IN_MODULE-n-1]=Math.fround(i/tk.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=t$.getDecodedCodewordValue(t$.sampleBitCounts(e));return -1!==t?t:t$.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ep.sum(e),r=new Int32Array(tk.BARS_IN_MODULE),n=0,i=0;for(let a=0;a<tk.MODULES_IN_CODEWORD;a++){let o=t/(2*tk.MODULES_IN_CODEWORD)+a*t/tk.MODULES_IN_CODEWORD;i+e[n]<=o&&(i+=e[n],n++),r[n]++}return r}static getDecodedCodewordValue(e){let t=t$.getBitValue(e);return -1===tk.getCodeword(t)?-1:t}static getBitValue(e){let t=0;for(let r=0;r<e.length;r++)for(let n=0;n<e[r];n++)t=t<<1|r%2==0;return Math.trunc(t)}static getClosestDecodedValue(e){let t=ep.sum(e),r=Array(tk.BARS_IN_MODULE);if(t>1)for(let n=0;n<r.length;n++)r[n]=Math.fround(e[n]/t);let n=em.MAX_VALUE,i=-1;this.bSymbolTableReady||t$.initialize();for(let e=0;e<t$.RATIOS_TABLE.length;e++){let t=0,a=t$.RATIOS_TABLE[e];for(let e=0;e<tk.BARS_IN_MODULE;e++){let i=Math.fround(a[e]-r[e]);if((t+=Math.fround(i*i))>=n)break}t<n&&(n=t,i=tk.SYMBOL_TABLE[e])}return i}}t$.bSymbolTableReady=!1,t$.RATIOS_TABLE=Array(tk.SYMBOL_TABLE.length).map(e=>Array(tk.BARS_IN_MODULE));class tJ{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(e){this.segmentIndex=e}getFileId(){return this.fileId}setFileId(e){this.fileId=e}getOptionalData(){return this.optionalData}setOptionalData(e){this.optionalData=e}isLastSegment(){return this.lastSegment}setLastSegment(e){this.lastSegment=e}getSegmentCount(){return this.segmentCount}setSegmentCount(e){this.segmentCount=e}getSender(){return this.sender||null}setSender(e){this.sender=e}getAddressee(){return this.addressee||null}setAddressee(e){this.addressee=e}getFileName(){return this.fileName}setFileName(e){this.fileName=e}getFileSize(){return this.fileSize}setFileSize(e){this.fileSize=e}getChecksum(){return this.checksum}setChecksum(e){this.checksum=e}getTimestamp(){return this.timestamp}setTimestamp(e){this.timestamp=e}}class t1{static parseLong(e,t){return parseInt(e,t)}}class t0 extends x{}t0.kind="NullPointerException";class t2{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,r){if(null==e)throw new t0;if(t<0||t>e.length||r<0||t+r>e.length||t+r<0)throw new B;if(0!==r)for(let n=0;n<r;n++)this.write(e[t+n])}flush(){}close(){}}class t3 extends x{}class t4 extends t2{constructor(e=32){if(super(),this.count=0,e<0)throw new N("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let t=this.buf.length<<1;if(t-e<0&&(t=e),t<0){if(e<0)throw new t3;t=F.MAX_VALUE}this.buf=k.copyOfUint8Array(this.buf,t)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,r){if(t<0||t>e.length||r<0||t+r-e.length>0)throw new B;this.ensureCapacity(this.count+r),P.arraycopy(e,t,this.buf,this.count,r),this.count+=r}writeTo(e){e.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return k.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?"string"==typeof e?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}function t8(){if("u">typeof window)return window.BigInt||null;if(void 0!==r.g)return r.g.BigInt||null;if("u">typeof self)return self.BigInt||null;throw Error("Can't search globals for BigInt!")}function t6(e){if(void 0===t&&(t=t8()),null===t)throw Error("BigInt is not supported!");return t(e)}(d=_||(_={}))[d.ALPHA=0]="ALPHA",d[d.LOWER=1]="LOWER",d[d.MIXED=2]="MIXED",d[d.PUNCT=3]="PUNCT",d[d.ALPHA_SHIFT=4]="ALPHA_SHIFT",d[d.PUNCT_SHIFT=5]="PUNCT_SHIFT";class t5{static decode(e,t){let r=new G(""),n=H.ISO8859_1;r.enableDecoding(n);let i=1,a=e[i++],o=new tJ;for(;i<e[0];){switch(a){case t5.TEXT_COMPACTION_MODE_LATCH:i=t5.textCompaction(e,i,r);break;case t5.BYTE_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:i=t5.byteCompaction(a,e,n,i,r);break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[i++]);break;case t5.NUMERIC_COMPACTION_MODE_LATCH:i=t5.numericCompaction(e,i,r);break;case t5.ECI_CHARSET:H.getCharacterSetECIByValue(e[i++]);break;case t5.ECI_GENERAL_PURPOSE:i+=2;break;case t5.ECI_USER_DEFINED:i++;break;case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=t5.decodeMacroBlock(e,i,o);break;case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:throw new V;default:i--,i=t5.textCompaction(e,i,r)}if(i<e.length)a=e[i++];else throw V.getFormatInstance()}if(0===r.length())throw V.getFormatInstance();let s=new eo(null,r.toString(),null,t);return s.setOther(o),s}static decodeMacroBlock(e,t,r){if(t+t5.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw V.getFormatInstance();let n=new Int32Array(t5.NUMBER_OF_SEQUENCE_CODEWORDS);for(let r=0;r<t5.NUMBER_OF_SEQUENCE_CODEWORDS;r++,t++)n[r]=e[t];r.setSegmentIndex(F.parseInt(t5.decodeBase900toBase10(n,t5.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new G;t=t5.textCompaction(e,t,i),r.setFileId(i.toString());let a=-1;for(e[t]===t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(a=t+1);t<e[0];)switch(e[t]){case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case t5.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let n=new G;t=t5.textCompaction(e,t+1,n),r.setFileName(n.toString());break;case t5.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new G;t=t5.textCompaction(e,t+1,i),r.setSender(i.toString());break;case t5.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let a=new G;t=t5.textCompaction(e,t+1,a),r.setAddressee(a.toString());break;case t5.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let o=new G;t=t5.numericCompaction(e,t+1,o),r.setSegmentCount(F.parseInt(o.toString()));break;case t5.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let s=new G;t=t5.numericCompaction(e,t+1,s),r.setTimestamp(t1.parseLong(s.toString()));break;case t5.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new G;t=t5.numericCompaction(e,t+1,l),r.setChecksum(F.parseInt(l.toString()));break;case t5.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let u=new G;t=t5.numericCompaction(e,t+1,u),r.setFileSize(t1.parseLong(u.toString()));break;default:throw V.getFormatInstance()}break;case t5.MACRO_PDF417_TERMINATOR:t++,r.setLastSegment(!0);break;default:throw V.getFormatInstance()}if(-1!==a){let n=t-a;r.isLastSegment()&&n--,r.setOptionalData(k.copyOfRange(e,a,a+n))}return t}static textCompaction(e,t,r){let n=new Int32Array((e[0]-t)*2),i=new Int32Array((e[0]-t)*2),a=0,o=!1;for(;t<e[0]&&!o;){let r=e[t++];if(r<t5.TEXT_COMPACTION_MODE_LATCH)n[a]=r/30,n[a+1]=r%30,a+=2;else switch(r){case t5.TEXT_COMPACTION_MODE_LATCH:n[a++]=t5.TEXT_COMPACTION_MODE_LATCH;break;case t5.BYTE_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:case t5.NUMERIC_COMPACTION_MODE_LATCH:case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:t--,o=!0;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n[a]=t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,r=e[t++],i[a]=r,a++}}return t5.decodeTextCompaction(n,i,a,r),t}static decodeTextCompaction(e,t,r,n){let i=_.ALPHA,a=_.ALPHA,o=0;for(;o<r;){let r=e[o],s="";switch(i){case _.ALPHA:if(r<26)s=String.fromCharCode(65+r);else switch(r){case 26:s=" ";break;case t5.LL:i=_.LOWER;break;case t5.ML:i=_.MIXED;break;case t5.PS:a=i,i=_.PUNCT_SHIFT;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.LOWER:if(r<26)s=String.fromCharCode(97+r);else switch(r){case 26:s=" ";break;case t5.AS:a=i,i=_.ALPHA_SHIFT;break;case t5.ML:i=_.MIXED;break;case t5.PS:a=i,i=_.PUNCT_SHIFT;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.MIXED:if(r<t5.PL)s=t5.MIXED_CHARS[r];else switch(r){case t5.PL:i=_.PUNCT;break;case 26:s=" ";break;case t5.LL:i=_.LOWER;break;case t5.AL:i=_.ALPHA;break;case t5.PS:a=i,i=_.PUNCT_SHIFT;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.PUNCT:if(r<t5.PAL)s=t5.PUNCT_CHARS[r];else switch(r){case t5.PAL:i=_.ALPHA;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.ALPHA_SHIFT:if(i=a,r<26)s=String.fromCharCode(65+r);else switch(r){case 26:s=" ";break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}break;case _.PUNCT_SHIFT:if(i=a,r<t5.PAL)s=t5.PUNCT_CHARS[r];else switch(r){case t5.PAL:i=_.ALPHA;break;case t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o]);break;case t5.TEXT_COMPACTION_MODE_LATCH:i=_.ALPHA}}""!==s&&n.append(s),o++}}static byteCompaction(e,t,r,n,i){let a=new t4,o=0,s=0,l=!1;switch(e){case t5.BYTE_COMPACTION_MODE_LATCH:let u=new Int32Array(6),c=t[n++];for(;n<t[0]&&!l;)switch(u[o++]=c,s=900*s+c,c=t[n++]){case t5.TEXT_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH:case t5.NUMERIC_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:n--,l=!0;break;default:if(o%5==0&&o>0){for(let e=0;e<6;++e)a.write(Number(t6(s)>>t6(8*(5-e))));s=0,o=0}}n===t[0]&&c<t5.TEXT_COMPACTION_MODE_LATCH&&(u[o++]=c);for(let e=0;e<o;e++)a.write(u[e]);break;case t5.BYTE_COMPACTION_MODE_LATCH_6:for(;n<t[0]&&!l;){let e=t[n++];if(e<t5.TEXT_COMPACTION_MODE_LATCH)o++,s=900*s+e;else switch(e){case t5.TEXT_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH:case t5.NUMERIC_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:n--,l=!0}if(o%5==0&&o>0){for(let e=0;e<6;++e)a.write(Number(t6(s)>>t6(8*(5-e))));s=0,o=0}}}return i.append(Y.decode(a.toByteArray(),r)),n}static numericCompaction(e,t,r){let n=0,i=!1,a=new Int32Array(t5.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let o=e[t++];if(t===e[0]&&(i=!0),o<t5.TEXT_COMPACTION_MODE_LATCH)a[n]=o,n++;else switch(o){case t5.TEXT_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH:case t5.BYTE_COMPACTION_MODE_LATCH_6:case t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t5.MACRO_PDF417_TERMINATOR:t--,i=!0}(n%t5.MAX_NUMERIC_CODEWORDS==0||o===t5.NUMERIC_COMPACTION_MODE_LATCH||i)&&n>0&&(r.append(t5.decodeBase900toBase10(a,n)),n=0)}return t}static decodeBase900toBase10(e,t){let r=t6(0);for(let n=0;n<t;n++)r+=t5.EXP900[t-n-1]*t6(e[n]);let n=r.toString();if("1"!==n.charAt(0))throw new V;return n.substring(1)}}t5.TEXT_COMPACTION_MODE_LATCH=900,t5.BYTE_COMPACTION_MODE_LATCH=901,t5.NUMERIC_COMPACTION_MODE_LATCH=902,t5.BYTE_COMPACTION_MODE_LATCH_6=924,t5.ECI_USER_DEFINED=925,t5.ECI_GENERAL_PURPOSE=926,t5.ECI_CHARSET=927,t5.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,t5.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,t5.MACRO_PDF417_TERMINATOR=922,t5.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,t5.MAX_NUMERIC_CODEWORDS=15,t5.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,t5.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,t5.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,t5.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,t5.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,t5.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,t5.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,t5.PL=25,t5.LL=27,t5.AS=27,t5.ML=28,t5.AL=28,t5.PS=29,t5.PAL=29,t5.PUNCT_CHARS=";<>@[\\]_`~!\r ,:\n-.$/\"|*()?{}'",t5.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",t5.EXP900=t8()?function(){let e=[];e[0]=t6(1);let t=t6(900);e[1]=t;for(let r=2;r<16;r++)e[r]=e[r-1]*t;return e}():[],t5.NUMBER_OF_SEQUENCE_CODEWORDS=2;class t7{static decode(e,t,r,n,i,a,o){let s,l=new tY(e,t,r,n,i),u=null,c=null;for(let r=!0;;r=!1){if(null!=t&&(u=t7.getRowIndicatorColumn(e,l,t,!0,a,o)),null!=n&&(c=t7.getRowIndicatorColumn(e,l,n,!1,a,o)),null==(s=t7.merge(u,c)))throw q.getNotFoundInstance();let i=s.getBoundingBox();if(r&&null!=i&&(i.getMinY()<l.getMinY()||i.getMaxY()>l.getMaxY()))l=i;else break}s.setBoundingBox(l);let h=s.getBarcodeColumnCount()+1;s.setDetectionResultColumn(0,u),s.setDetectionResultColumn(h,c);let d=null!=u;for(let t=1;t<=h;t++){let r,n=d?t:h-t;if(void 0!==s.getDetectionResultColumn(n))continue;r=0===n||n===h?new tZ(l,0===n):new tW(l),s.setDetectionResultColumn(n,r);let i=-1,u=-1;for(let t=l.getMinY();t<=l.getMaxY();t++){if((i=t7.getStartColumn(s,n,t,d))<0||i>l.getMaxX()){if(-1===u)continue;i=u}let c=t7.detectCodeword(e,l.getMinX(),l.getMaxX(),d,i,t,a,o);null!=c&&(r.setCodeword(t,c),u=i,a=Math.min(a,c.getWidth()),o=Math.max(o,c.getWidth()))}}return t7.createDecoderResult(s)}static merge(e,t){if(null==e&&null==t)return null;let r=t7.getBarcodeMetadata(e,t);return null==r?null:new tQ(r,tY.merge(t7.adjustBoundingBox(e),t7.adjustBoundingBox(t)))}static adjustBoundingBox(e){if(null==e)return null;let t=e.getRowHeights();if(null==t)return null;let r=t7.getMax(t),n=0;for(let e of t)if(n+=r-e,e>0)break;let i=e.getCodewords();for(let e=0;n>0&&null==i[e];e++)n--;let a=0;for(let e=t.length-1;e>=0&&(a+=r-t[e],!(t[e]>0));e--);for(let e=i.length-1;a>0&&null==i[e];e--)a--;return e.getBoundingBox().addMissingRows(n,a,e.isLeft())}static getMax(e){let t=-1;for(let r of e)t=Math.max(t,r);return t}static getBarcodeMetadata(e,t){let r,n;return null==e||null==(r=e.getBarcodeMetadata())?null==t?null:t.getBarcodeMetadata():null==t||null==(n=t.getBarcodeMetadata())?r:r.getColumnCount()!==n.getColumnCount()&&r.getErrorCorrectionLevel()!==n.getErrorCorrectionLevel()&&r.getRowCount()!==n.getRowCount()?null:r}static getRowIndicatorColumn(e,t,r,n,i,a){let o=new tZ(t,n);for(let s=0;s<2;s++){let l=0===s?1:-1,u=Math.trunc(Math.trunc(r.getX()));for(let s=Math.trunc(Math.trunc(r.getY()));s<=t.getMaxY()&&s>=t.getMinY();s+=l){let t=t7.detectCodeword(e,0,e.getWidth(),n,u,s,i,a);null!=t&&(o.setCodeword(s,t),u=n?t.getStartX():t.getEndX())}}return o}static adjustCodewordCount(e,t){let r=t[0][1],n=r.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-t7.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===n.length){if(i<1||i>tk.MAX_CODEWORDS_IN_BARCODE)throw q.getNotFoundInstance();r.setValue(i)}else n[0]!==i&&r.setValue(i)}static createDecoderResult(e){let t=t7.createBarcodeMatrix(e);t7.adjustCodewordCount(e,t);let r=[],n=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],a=[];for(let o=0;o<e.getBarcodeRowCount();o++)for(let s=0;s<e.getBarcodeColumnCount();s++){let l=t[o][s+1].getValue(),u=o*e.getBarcodeColumnCount()+s;0===l.length?r.push(u):1===l.length?n[u]=l[0]:(a.push(u),i.push(l))}let o=Array(i.length);for(let e=0;e<o.length;e++)o[e]=i[e];return t7.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),n,tk.toIntArray(r),tk.toIntArray(a),o)}static createDecoderResultFromAmbiguousValues(e,t,r,n,i){let a=new Int32Array(n.length),o=100;for(;o-- >0;){for(let e=0;e<a.length;e++)t[n[e]]=i[e][a[e]];try{return t7.decodeCodewords(t,e,r)}catch(e){if(!(e instanceof R))throw e}if(0===a.length)break;for(let e=0;e<a.length;e++)if(a[e]<i[e].length-1){a[e]++;break}else if(a[e]=0,e===a.length-1)throw R.getChecksumInstance()}throw R.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>Array(e.getBarcodeColumnCount()+2));for(let e=0;e<t.length;e++)for(let r=0;r<t[e].length;r++)t[e][r]=new tq;let r=0;for(let n of e.getDetectionResultColumns()){if(null!=n){for(let e of n.getCodewords())if(null!=e){let n=e.getRowNumber();if(n>=0){if(n>=t.length)continue;t[n][r].setValue(e.getValue())}}}r++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,r,n){let i=n?1:-1,a=null;if(t7.isValidBarcodeColumn(e,t-i)&&(a=e.getDetectionResultColumn(t-i).getCodeword(r)),null!=a)return n?a.getEndX():a.getStartX();if(null!=(a=e.getDetectionResultColumn(t).getCodewordNearby(r)))return n?a.getStartX():a.getEndX();if(t7.isValidBarcodeColumn(e,t-i)&&(a=e.getDetectionResultColumn(t-i).getCodewordNearby(r)),null!=a)return n?a.getEndX():a.getStartX();let o=0;for(;t7.isValidBarcodeColumn(e,t-i);){for(let r of(t-=i,e.getDetectionResultColumn(t).getCodewords()))if(null!=r)return(n?r.getEndX():r.getStartX())+i*o*(r.getEndX()-r.getStartX());o++}return n?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,r,n,i,a,o,s){let l;i=t7.adjustCodewordStartColumn(e,t,r,n,i,a);let u=t7.getModuleBitCount(e,t,r,n,i,a);if(null==u)return null;let c=ep.sum(u);if(n)l=i+c;else{for(let e=0;e<u.length/2;e++){let t=u[e];u[e]=u[u.length-1-e],u[u.length-1-e]=t}i=(l=i)-c}if(!t7.checkCodewordSkew(c,o,s))return null;let h=t$.getDecodedValue(u),d=tk.getCodeword(h);return -1===d?null:new tK(i,l,t7.getCodewordBucketNumber(h),d)}static getModuleBitCount(e,t,r,n,i,a){let o=i,s=new Int32Array(8),l=0,u=n?1:-1,c=n;for(;(n?o<r:o>=t)&&l<s.length;)e.get(o,a)===c?(s[l]++,o+=u):(l++,c=!c);return l===s.length||o===(n?r:t)&&l===s.length-1?s:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,r,n,i,a){let o=i,s=n?-1:1;for(let l=0;l<2;l++){for(;(n?o>=t:o<r)&&n===e.get(o,a);){if(Math.abs(i-o)>t7.CODEWORD_SKEW_SIZE)return i;o+=s}s=-s,n=!n}return o}static checkCodewordSkew(e,t,r){return t-t7.CODEWORD_SKEW_SIZE<=e&&e<=r+t7.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,r){if(0===e.length)throw V.getFormatInstance();let n=1<<t+1,i=t7.correctErrors(e,r,n);t7.verifyCodewordCount(e,n);let a=t5.decode(e,""+t);return a.setErrorsCorrected(i),a.setErasures(r.length),a}static correctErrors(e,t,r){if(null!=t&&t.length>r/2+t7.MAX_ERRORS||r<0||r>t7.MAX_EC_CODEWORDS)throw R.getChecksumInstance();return t7.errorCorrection.decode(e,r,t)}static verifyCodewordCount(e,t){if(e.length<4)throw V.getFormatInstance();let r=e[0];if(r>e.length)throw V.getFormatInstance();if(0===r)if(t<e.length)e[0]=e.length-t;else throw V.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),r=0,n=t.length-1;for(;!((1&e)!==r&&(r=1&e,--n<0));)t[n]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return t7.getCodewordBucketNumber(t7.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new tG;for(let r=0;r<e.length;r++){t.format("Row %2d: ",r);for(let n=0;n<e[r].length;n++){let i=e[r][n];0===i.getValue().length?t.format(" ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}t7.CODEWORD_SKEW_SIZE=2,t7.MAX_ERRORS=3,t7.MAX_EC_CODEWORDS=512,t7.errorCorrection=new tj;class t9{decode(e,t=null){let r=t9.decode(e,t,!1);if(null==r||0===r.length||null==r[0])throw q.getNotFoundInstance();return r[0]}decodeMultiple(e,t=null){try{return t9.decode(e,t,!0)}catch(e){if(e instanceof V||e instanceof R)throw q.getNotFoundInstance();throw e}}static decode(e,t,r){let n=[],i=tz.detectMultiple(e,t,r);for(let e of i.getPoints()){let t=t7.decode(i.getBits(),e[4],e[5],e[6],e[7],t9.getMinCodewordWidth(e),t9.getMaxCodewordWidth(e)),r=new en(t.getText(),t.getRawBytes(),void 0,e,ei.PDF_417);r.putMetadata(ea.ERROR_CORRECTION_LEVEL,t.getECLevel());let a=t.getOther();null!=a&&r.putMetadata(ea.PDF417_EXTRA_METADATA,a),n.push(r)}return n.map(e=>e)}static getMaxWidth(e,t){return null==e||null==t?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return null==e||null==t?F.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(t9.getMaxWidth(e[0],e[4]),t9.getMaxWidth(e[6],e[2])*tk.MODULES_IN_CODEWORD/tk.MODULES_IN_STOP_PATTERN),Math.max(t9.getMaxWidth(e[1],e[5]),t9.getMaxWidth(e[7],e[3])*tk.MODULES_IN_CODEWORD/tk.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(t9.getMinWidth(e[0],e[4]),t9.getMinWidth(e[6],e[2])*tk.MODULES_IN_CODEWORD/tk.MODULES_IN_STOP_PATTERN),Math.min(t9.getMinWidth(e[1],e[5]),t9.getMinWidth(e[7],e[3])*tk.MODULES_IN_CODEWORD/tk.MODULES_IN_STOP_PATTERN)))}reset(){}}class re extends x{}re.kind="ReaderException";class rt{constructor(e,t){this.verbose=!0===e,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return(null===this.readers||void 0===this.readers)&&this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;let t=null!=e&&!0===e.get(U.TRY_HARDER),r=null==e?null:e.get(U.POSSIBLE_FORMATS),n=[];if(null!=r){let i=r.some(e=>e===ei.UPC_A||e===ei.UPC_E||e===ei.EAN_13||e===ei.EAN_8||e===ei.CODABAR||e===ei.CODE_39||e===ei.CODE_93||e===ei.CODE_128||e===ei.ITF||e===ei.RSS_14||e===ei.RSS_EXPANDED);i&&!t&&n.push(new ts(e,this.verbose)),r.includes(ei.QR_CODE)&&n.push(new tL),r.includes(ei.DATA_MATRIX)&&n.push(new tv),r.includes(ei.AZTEC)&&n.push(new eT),r.includes(ei.PDF_417)&&n.push(new t9),i&&t&&n.push(new ts(e,this.verbose))}0===n.length&&(t||n.push(new ts(e,this.verbose)),n.push(new tL),n.push(new tv),n.push(new eT),n.push(new t9),t&&n.push(new ts(e,this.verbose))),this.readers=n}reset(){if(null!==this.readers)for(let e of this.readers)e.reset()}decodeInternal(e){if(null===this.readers)throw new re("No readers where selected, nothing can be read.");for(let t of this.readers)try{return t.decode(e,this.hints)}catch(e){if(e instanceof re)continue}throw new q("No MultiFormat Readers were able to detect the code.")}}(f=S||(S={}))[f.ERROR_CORRECTION=0]="ERROR_CORRECTION",f[f.CHARACTER_SET=1]="CHARACTER_SET",f[f.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",f[f.MIN_SIZE=3]="MIN_SIZE",f[f.MAX_SIZE=4]="MAX_SIZE",f[f.MARGIN=5]="MARGIN",f[f.PDF417_COMPACT=6]="PDF417_COMPACT",f[f.PDF417_COMPACTION=7]="PDF417_COMPACTION",f[f.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",f[f.AZTEC_LAYERS=9]="AZTEC_LAYERS",f[f.QR_VERSION=10]="QR_VERSION";var rr=S;class rn{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new el(e,Int32Array.from([1])))}buildGenerator(e){let t=this.cachedGenerators;if(e>=t.length){let r=t[t.length-1],n=this.field;for(let i=t.length;i<=e;i++){let e=r.multiply(new el(n,Int32Array.from([1,n.exp(i-1+n.getGeneratorBase())])));t.push(e),r=e}}return t[e]}encode(e,t){if(0===t)throw new N("No error correction bytes");let r=e.length-t;if(r<=0)throw new N("No data bytes provided");let n=this.buildGenerator(t),i=new Int32Array(r);P.arraycopy(e,0,i,0,r);let a=new el(this.field,i),o=(a=a.multiplyByMonomial(t,1)).divide(n)[1].getCoefficients(),s=t-o.length;for(let t=0;t<s;t++)e[r+t]=0;P.arraycopy(o,0,e,r+s,o.length)}}class ri{static applyMaskPenaltyRule1(e){return ri.applyMaskPenaltyRule1Internal(e,!0)+ri.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i-1;e++){let i=r[e];for(let a=0;a<n-1;a++){let n=i[a];n===i[a+1]&&n===r[e+1][a]&&n===r[e+1][a+1]&&t++}}return ri.N2*t}static applyMaskPenaltyRule3(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++)for(let a=0;a<n;a++){let o=r[e];a+6<n&&1===o[a]&&0===o[a+1]&&1===o[a+2]&&1===o[a+3]&&1===o[a+4]&&0===o[a+5]&&1===o[a+6]&&(ri.isWhiteHorizontal(o,a-4,a)||ri.isWhiteHorizontal(o,a+7,a+11))&&t++,e+6<i&&1===r[e][a]&&0===r[e+1][a]&&1===r[e+2][a]&&1===r[e+3][a]&&1===r[e+4][a]&&0===r[e+5][a]&&1===r[e+6][a]&&(ri.isWhiteVertical(r,a,e-4,e)||ri.isWhiteVertical(r,a,e+7,e+11))&&t++}return t*ri.N3}static isWhiteHorizontal(e,t,r){t=Math.max(t,0),r=Math.min(r,e.length);for(let n=t;n<r;n++)if(1===e[n])return!1;return!0}static isWhiteVertical(e,t,r,n){r=Math.max(r,0),n=Math.min(n,e.length);for(let i=r;i<n;i++)if(1===e[i][t])return!1;return!0}static applyMaskPenaltyRule4(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++){let i=r[e];for(let e=0;e<n;e++)1===i[e]&&t++}let a=e.getHeight()*e.getWidth();return Math.floor(10*Math.abs(2*t-a)/a)*ri.N4}static getDataMaskBit(e,t,r){let n,i;switch(e){case 0:n=r+t&1;break;case 1:n=1&r;break;case 2:n=t%3;break;case 3:n=(r+t)%3;break;case 4:n=Math.floor(r/2)+Math.floor(t/3)&1;break;case 5:n=(1&(i=r*t))+i%3;break;case 6:n=(1&(i=r*t))+i%3&1;break;case 7:n=(i=r*t)%3+(r+t&1)&1;break;default:throw new N("Invalid mask pattern: "+e)}return 0===n}static applyMaskPenaltyRule1Internal(e,t){let r=0,n=t?e.getHeight():e.getWidth(),i=t?e.getWidth():e.getHeight(),a=e.getArray();for(let e=0;e<n;e++){let n=0,o=-1;for(let s=0;s<i;s++){let i=t?a[e][s]:a[s][e];i===o?n++:(n>=5&&(r+=ri.N1+(n-5)),n=1,o=i)}n>=5&&(r+=ri.N1+(n-5))}return r}}ri.N1=3,ri.N2=3,ri.N3=40,ri.N4=10;class ra{constructor(e,t){this.width=e,this.height=t;const r=Array(t);for(let n=0;n!==t;n++)r[n]=new Uint8Array(e);this.bytes=r}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,r){this.bytes[t][e]=r}setBoolean(e,t,r){this.bytes[t][e]=+!!r}clear(e){for(let t of this.bytes)k.fill(t,e)}equals(e){if(!(e instanceof ra)||this.width!==e.width||this.height!==e.height)return!1;for(let t=0,r=this.height;t<r;++t){let r=this.bytes[t],n=e.bytes[t];for(let e=0,t=this.width;e<t;++e)if(r[e]!==n[e])return!1}return!0}toString(){let e=new G;for(let t=0,r=this.height;t<r;++t){let r=this.bytes[t];for(let t=0,n=this.width;t<n;++t)switch(r[t]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ")}e.append("\n")}return e.toString()}}class ro{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){let e=new G;return e.append("<<\n"),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append("\n ecLevel: "),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append("\n version: "),e.append(this.version?this.version.toString():"null"),e.append("\n maskPattern: "),e.append(this.maskPattern.toString()),this.matrix?(e.append("\n matrix:\n"),e.append(this.matrix.toString())):e.append("\n matrix: null\n"),e.append(">>\n"),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<ro.NUM_MASK_PATTERNS}}ro.NUM_MASK_PATTERNS=8;class rs extends x{}rs.kind="WriterException";class rl{static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,r,n,i){rl.clearMatrix(i),rl.embedBasicPatterns(r,i),rl.embedTypeInfo(t,n,i),rl.maybeEmbedVersionInfo(r,i),rl.embedDataBits(e,n,i)}static embedBasicPatterns(e,t){rl.embedPositionDetectionPatternsAndSeparators(t),rl.embedDarkDotAtLeftBottomCorner(t),rl.maybeEmbedPositionAdjustmentPatterns(e,t),rl.embedTimingPatterns(t)}static embedTypeInfo(e,t,r){let n=new z;rl.makeTypeInfoBits(e,t,n);for(let e=0,t=n.getSize();e<t;++e){let t=n.get(n.getSize()-1-e),i=rl.TYPE_INFO_COORDINATES[e],a=i[0],o=i[1];if(r.setBoolean(a,o,t),e<8){let n=r.getWidth()-e-1;r.setBoolean(n,8,t)}else{let n=r.getHeight()-7+(e-8);r.setBoolean(8,n,t)}}}static maybeEmbedVersionInfo(e,t){if(7>e.getVersionNumber())return;let r=new z;rl.makeVersionInfoBits(e,r);let n=17;for(let e=0;e<6;++e)for(let i=0;i<3;++i){let a=r.get(n);n--,t.setBoolean(e,t.getHeight()-11+i,a),t.setBoolean(t.getHeight()-11+i,e,a)}}static embedDataBits(e,t,r){let n=0,i=-1,a=r.getWidth()-1,o=r.getHeight()-1;for(;a>0;){for(6===a&&(a-=1);o>=0&&o<r.getHeight();){for(let i=0;i<2;++i){let s,l=a-i;rl.isEmpty(r.get(l,o))&&(n<e.getSize()?(s=e.get(n),++n):s=!1,255!==t&&ri.getDataMaskBit(t,l,o)&&(s=!s),r.setBoolean(l,o,s))}o+=i}o+=i=-i,a-=2}if(n!==e.getSize())throw new rs("Not all bits consumed: "+n+"/"+e.getSize())}static findMSBSet(e){return 32-F.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(0===t)throw new N("0 polynomial");let r=rl.findMSBSet(t);for(e<<=r-1;rl.findMSBSet(e)>=r;)e^=t<<rl.findMSBSet(e)-r;return e}static makeTypeInfoBits(e,t,r){if(!ro.isValidMaskPattern(t))throw new rs("Invalid mask pattern");let n=e.getBits()<<3|t;r.appendBits(n,5);let i=rl.calculateBCHCode(n,rl.TYPE_INFO_POLY);r.appendBits(i,10);let a=new z;if(a.appendBits(rl.TYPE_INFO_MASK_PATTERN,15),r.xor(a),15!==r.getSize())throw new rs("should not happen but we got: "+r.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);let r=rl.calculateBCHCode(e.getVersionNumber(),rl.VERSION_INFO_POLY);if(t.appendBits(r,12),18!==t.getSize())throw new rs("should not happen but we got: "+t.getSize())}static isEmpty(e){return 255===e}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){let r=(t+1)%2;rl.isEmpty(e.get(t,6))&&e.setNumber(t,6,r),rl.isEmpty(e.get(6,t))&&e.setNumber(6,t,r)}}static embedDarkDotAtLeftBottomCorner(e){if(0===e.get(8,e.getHeight()-8))throw new rs;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,r){for(let n=0;n<8;++n){if(!rl.isEmpty(r.get(e+n,t)))throw new rs;r.setNumber(e+n,t,0)}}static embedVerticalSeparationPattern(e,t,r){for(let n=0;n<7;++n){if(!rl.isEmpty(r.get(e,t+n)))throw new rs;r.setNumber(e,t+n,0)}}static embedPositionAdjustmentPattern(e,t,r){for(let n=0;n<5;++n){let i=rl.POSITION_ADJUSTMENT_PATTERN[n];for(let a=0;a<5;++a)r.setNumber(e+a,t+n,i[a])}}static embedPositionDetectionPattern(e,t,r){for(let n=0;n<7;++n){let i=rl.POSITION_DETECTION_PATTERN[n];for(let a=0;a<7;++a)r.setNumber(e+a,t+n,i[a])}}static embedPositionDetectionPatternsAndSeparators(e){let t=rl.POSITION_DETECTION_PATTERN[0].length;rl.embedPositionDetectionPattern(0,0,e),rl.embedPositionDetectionPattern(e.getWidth()-t,0,e),rl.embedPositionDetectionPattern(0,e.getWidth()-t,e),rl.embedHorizontalSeparationPattern(0,7,e),rl.embedHorizontalSeparationPattern(e.getWidth()-8,7,e),rl.embedHorizontalSeparationPattern(0,e.getWidth()-8,e),rl.embedVerticalSeparationPattern(7,0,e),rl.embedVerticalSeparationPattern(e.getHeight()-7-1,0,e),rl.embedVerticalSeparationPattern(7,e.getHeight()-7,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(2>e.getVersionNumber())return;let r=e.getVersionNumber()-1,n=rl.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r];for(let e=0,r=n.length;e!==r;e++){let i=n[e];if(i>=0)for(let e=0;e!==r;e++){let r=n[e];r>=0&&rl.isEmpty(t.get(r,i))&&rl.embedPositionAdjustmentPattern(r-2,i-2,t)}}}}rl.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),rl.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),rl.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),rl.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),rl.VERSION_INFO_POLY=7973,rl.TYPE_INFO_POLY=1335,rl.TYPE_INFO_MASK_PATTERN=21522;class ru{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class rc{static calculateMaskPenalty(e){return ri.applyMaskPenaltyRule1(e)+ri.applyMaskPenaltyRule2(e)+ri.applyMaskPenaltyRule3(e)+ri.applyMaskPenaltyRule4(e)}static encode(e,t,r=null){let n,i=rc.DEFAULT_BYTE_MODE_ENCODING,a=null!==r&&void 0!==r.get(rr.CHARACTER_SET);a&&(i=r.get(rr.CHARACTER_SET).toString());let o=this.chooseMode(e,i),s=new z;if(o===tI.BYTE&&(a||rc.DEFAULT_BYTE_MODE_ENCODING!==i)){let e=H.getCharacterSetECIByName(i);void 0!==e&&this.appendECI(e,s)}this.appendModeInfo(o,s);let l=new z;if(this.appendBytes(e,o,l,i),null!==r&&void 0!==r.get(rr.QR_VERSION)){let e=Number.parseInt(r.get(rr.QR_VERSION).toString(),10);n=tA.getVersionForNumber(e);let i=this.calculateBitsNeeded(o,s,l,n);if(!this.willFit(i,n,t))throw new rs("Data too big for requested version")}else n=this.recommendVersion(t,o,s,l);let u=new z;u.appendBitArray(s);let c=o===tI.BYTE?l.getSizeInBytes():e.length;this.appendLengthInfo(c,n,o,u),u.appendBitArray(l);let h=n.getECBlocksForLevel(t),d=n.getTotalCodewords()-h.getTotalECCodewords();this.terminateBits(d,u);let f=this.interleaveWithECBytes(u,n.getTotalCodewords(),d,h.getNumBlocks()),g=new ro;g.setECLevel(t),g.setMode(o),g.setVersion(n);let p=n.getDimensionForVersion(),v=new ra(p,p),y=this.chooseMaskPattern(f,t,n,v);return g.setMaskPattern(y),rl.buildMatrix(f,t,n,y,v),g.setMatrix(v),g}static recommendVersion(e,t,r,n){let i=this.calculateBitsNeeded(t,r,n,tA.getVersionForNumber(1)),a=this.chooseVersion(i,e),o=this.calculateBitsNeeded(t,r,n,a);return this.chooseVersion(o,e)}static calculateBitsNeeded(e,t,r,n){return t.getSize()+e.getCharacterCountBits(n)+r.getSize()}static getAlphanumericCode(e){return e<rc.ALPHANUMERIC_TABLE.length?rc.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(H.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return tI.KANJI;let r=!1,n=!1;for(let t=0,i=e.length;t<i;++t){let i=e.charAt(t);if(rc.isDigit(i))r=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return tI.BYTE;n=!0}}return n?tI.ALPHANUMERIC:r?tI.NUMERIC:tI.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=Y.encode(e,H.SJIS)}catch(e){return!1}let r=t.length;if(r%2!=0)return!1;for(let e=0;e<r;e+=2){let r=255&t[e];if((r<129||r>159)&&(r<224||r>235))return!1}return!0}static chooseMaskPattern(e,t,r,n){let i=Number.MAX_SAFE_INTEGER,a=-1;for(let o=0;o<ro.NUM_MASK_PATTERNS;o++){rl.buildMatrix(e,t,r,o,n);let s=this.calculateMaskPenalty(n);s<i&&(i=s,a=o)}return a}static chooseVersion(e,t){for(let r=1;r<=40;r++){let n=tA.getVersionForNumber(r);if(rc.willFit(e,n,t))return n}throw new rs("Data too big")}static willFit(e,t,r){return t.getTotalCodewords()-t.getECBlocksForLevel(r).getTotalECCodewords()>=(e+7)/8}static terminateBits(e,t){let r=8*e;if(t.getSize()>r)throw new rs("data bits cannot fit in the QR Code"+t.getSize()+" > "+r);for(let e=0;e<4&&t.getSize()<r;++e)t.appendBit(!1);let n=7&t.getSize();if(n>0)for(let e=n;e<8;e++)t.appendBit(!1);let i=e-t.getSizeInBytes();for(let e=0;e<i;++e)t.appendBits((1&e)==0?236:17,8);if(t.getSize()!==r)throw new rs("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,r,n,i,a){if(n>=r)throw new rs("Block ID too large");let o=e%r,s=r-o,l=Math.floor(e/r),u=Math.floor(t/r),c=u+1,h=l-u,d=l+1-c;if(h!==d)throw new rs("EC bytes mismatch");if(r!==s+o)throw new rs("RS blocks mismatch");if(e!==(u+h)*s+(c+d)*o)throw new rs("Total bytes mismatch");n<s?(i[0]=u,a[0]=h):(i[0]=c,a[0]=d)}static interleaveWithECBytes(e,t,r,n){if(e.getSizeInBytes()!==r)throw new rs("Number of bits and data bytes does not match");let i=0,a=0,o=0,s=[];for(let l=0;l<n;++l){let u=new Int32Array(1),c=new Int32Array(1);rc.getNumDataBytesAndNumECBytesForBlockID(t,r,n,l,u,c);let h=u[0],d=new Uint8Array(h);e.toBytes(8*i,d,0,h);let f=rc.generateECBytes(d,c[0]);s.push(new ru(d,f)),a=Math.max(a,h),o=Math.max(o,f.length),i+=u[0]}if(r!==i)throw new rs("Data bytes does not match offset");let l=new z;for(let e=0;e<a;++e)for(let t of s){let r=t.getDataBytes();e<r.length&&l.appendBits(r[e],8)}for(let e=0;e<o;++e)for(let t of s){let r=t.getErrorCorrectionBytes();e<r.length&&l.appendBits(r[e],8)}if(t!==l.getSizeInBytes())throw new rs("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){let r=e.length,n=new Int32Array(r+t);for(let t=0;t<r;t++)n[t]=255&e[t];new rn(ec.QR_CODE_FIELD_256).encode(n,t);let i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=n[r+e];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,r,n){let i=r.getCharacterCountBits(t);if(e>=1<<i)throw new rs(e+" is bigger than "+((1<<i)-1));n.appendBits(e,i)}static appendBytes(e,t,r,n){switch(t){case tI.NUMERIC:rc.appendNumericBytes(e,r);break;case tI.ALPHANUMERIC:rc.appendAlphanumericBytes(e,r);break;case tI.BYTE:rc.append8BitBytes(e,r,n);break;case tI.KANJI:rc.appendKanjiBytes(e,r);break;default:throw new rs("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){let t=rc.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){let r=e.length,n=0;for(;n<r;){let i=rc.getDigit(e.charAt(n));if(n+2<r){let r=rc.getDigit(e.charAt(n+1)),a=rc.getDigit(e.charAt(n+2));t.appendBits(100*i+10*r+a,10),n+=3}else if(n+1<r){let r=rc.getDigit(e.charAt(n+1));t.appendBits(10*i+r,7),n+=2}else t.appendBits(i,4),n++}}static appendAlphanumericBytes(e,t){let r=e.length,n=0;for(;n<r;){let i=rc.getAlphanumericCode(e.charCodeAt(n));if(-1===i)throw new rs;if(n+1<r){let r=rc.getAlphanumericCode(e.charCodeAt(n+1));if(-1===r)throw new rs;t.appendBits(45*i+r,11),n+=2}else t.appendBits(i,6),n++}}static append8BitBytes(e,t,r){let n;try{n=Y.encode(e,r)}catch(e){throw new rs(e)}for(let e=0,r=n.length;e!==r;e++){let r=n[e];t.appendBits(r,8)}}static appendKanjiBytes(e,t){let r;try{r=Y.encode(e,H.SJIS)}catch(e){throw new rs(e)}let n=r.length;for(let e=0;e<n;e+=2){let n=(255&r[e])<<8|255&r[e+1],i=-1;if(n>=33088&&n<=40956?i=n-33088:n>=57408&&n<=60351&&(i=n-49472),-1===i)throw new rs("Invalid byte sequence");let a=(i>>8)*192+(255&i);t.appendBits(a,13)}}static appendECI(e,t){t.appendBits(tI.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}rc.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),rc.DEFAULT_BYTE_MODE_ENCODING=H.UTF8.getName();class rh{write(e,t,r,n=null){if(0===e.length)throw new N("Found empty contents");if(t<0||r<0)throw new N("Requested dimensions are too small: "+t+"x"+r);let i=ty.L,a=rh.QUIET_ZONE_SIZE;null!==n&&(void 0!==n.get(rr.ERROR_CORRECTION)&&(i=ty.fromString(n.get(rr.ERROR_CORRECTION).toString())),void 0!==n.get(rr.MARGIN)&&(a=Number.parseInt(n.get(rr.MARGIN).toString(),10)));let o=rc.encode(e,i,n);return this.renderResult(o,t,r,a)}writeToDom(e,t,r,n,i=null){"string"==typeof e&&(e=document.querySelector(e));let a=this.write(t,r,n,i);e&&e.appendChild(a)}renderResult(e,t,r,n){let i=e.getMatrix();if(null===i)throw new ed;let a=i.getWidth(),o=i.getHeight(),s=a+2*n,l=o+2*n,u=Math.max(t,s),c=Math.max(r,l),h=Math.min(Math.floor(u/s),Math.floor(c/l)),d=Math.floor((u-a*h)/2),f=Math.floor((c-o*h)/2),g=this.createSVGElement(u,c);for(let e=0,t=f;e<o;e++,t+=h)for(let r=0,n=d;r<a;r++,n+=h)if(1===i.get(r,e)){let e=this.createSvgRectElement(n,t,h,h);g.appendChild(e)}return g}createSVGElement(e,t){let r=document.createElementNS(rh.SVG_NS,"svg");return r.setAttributeNS(null,"height",e.toString()),r.setAttributeNS(null,"width",t.toString()),r}createSvgRectElement(e,t,r,n){let i=document.createElementNS(rh.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",r.toString()),i.setAttributeNS(null,"width",n.toString()),i.setAttributeNS(null,"fill","#000000"),i}}rh.QUIET_ZONE_SIZE=4,rh.SVG_NS="http://www.w3.org/2000/svg";class rd{encode(e,t,r,n,i){if(0===e.length)throw new N("Found empty contents");if(t!==ei.QR_CODE)throw new N("Can only encode QR_CODE, but got "+t);if(r<0||n<0)throw new N(`Requested dimensions are too small: ${r}x${n}`);let a=ty.L,o=rd.QUIET_ZONE_SIZE;null!==i&&(void 0!==i.get(rr.ERROR_CORRECTION)&&(a=ty.fromString(i.get(rr.ERROR_CORRECTION).toString())),void 0!==i.get(rr.MARGIN)&&(o=Number.parseInt(i.get(rr.MARGIN).toString(),10)));let s=rc.encode(e,a,i);return rd.renderResult(s,r,n,o)}static renderResult(e,t,r,n){let i=e.getMatrix();if(null===i)throw new ed;let a=i.getWidth(),o=i.getHeight(),s=a+2*n,l=o+2*n,u=Math.max(t,s),c=Math.max(r,l),h=Math.min(Math.floor(u/s),Math.floor(c/l)),d=Math.floor((u-a*h)/2),f=Math.floor((c-o*h)/2),g=new W(u,c);for(let e=0,t=f;e<o;e++,t+=h)for(let r=0,n=d;r<a;r++,n+=h)1===i.get(r,e)&&g.setRegion(n,t,h,h);return g}}rd.QUIET_ZONE_SIZE=4;class rf extends K{constructor(e,t,r,n,i,a,o,s){if(super(a,o),this.yuvData=e,this.dataWidth=t,this.dataHeight=r,this.left=n,this.top=i,n+a>t||i+o>r)throw new N("Crop rectangle does not fit within image data.");s&&this.reverseHorizontal(a,o)}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);let r=this.getWidth();(null==t||t.length<r)&&(t=new Uint8ClampedArray(r));let n=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.yuvData,n,t,0,r),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;let r=e*t,n=new Uint8ClampedArray(r),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.yuvData,i,n,0,r),n;for(let r=0;r<t;r++){let t=r*e;P.arraycopy(this.yuvData,i,n,t,e),i+=this.dataWidth}return n}isCropSupported(){return!0}crop(e,t,r,n){return new rf(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,r,n,!1)}renderThumbnail(){let e=this.getWidth()/rf.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/rf.THUMBNAIL_SCALE_FACTOR,r=new Int32Array(e*t),n=this.yuvData,i=this.top*this.dataWidth+this.left;for(let a=0;a<t;a++){let t=a*e;for(let a=0;a<e;a++){let e=255&n[i+a*rf.THUMBNAIL_SCALE_FACTOR];r[t+a]=0xff000000|65793*e}i+=this.dataWidth*rf.THUMBNAIL_SCALE_FACTOR}return r}getThumbnailWidth(){return this.getWidth()/rf.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/rf.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){let r=this.yuvData;for(let n=0,i=this.top*this.dataWidth+this.left;n<t;n++,i+=this.dataWidth){let t=i+e/2;for(let n=i,a=i+e-1;n<t;n++,a--){let e=r[n];r[n]=r[a],r[a]=e}}}invert(){return new $(this)}}rf.THUMBNAIL_SCALE_FACTOR=2;class rg extends K{constructor(e,t,r,n,i,a,o){if(super(t,r),this.dataWidth=n,this.dataHeight=i,this.left=a,this.top=o,4===e.BYTES_PER_ELEMENT){const n=t*r,i=new Uint8ClampedArray(n);for(let t=0;t<n;t++){const r=e[t],n=r>>16&255,a=r>>7&510,o=255&r;i[t]=(n+a+o)/4&255}this.luminances=i}else this.luminances=e;if(void 0===n&&(this.dataWidth=t),void 0===i&&(this.dataHeight=r),void 0===a&&(this.left=0),void 0===o&&(this.top=0),this.left+t>this.dataWidth||this.top+r>this.dataHeight)throw new N("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);let r=this.getWidth();(null==t||t.length<r)&&(t=new Uint8ClampedArray(r));let n=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.luminances,n,t,0,r),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;let r=e*t,n=new Uint8ClampedArray(r),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.luminances,i,n,0,r),n;for(let r=0;r<t;r++){let t=r*e;P.arraycopy(this.luminances,i,n,t,e),i+=this.dataWidth}return n}isCropSupported(){return!0}crop(e,t,r,n){return new rg(this.luminances,r,n,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new $(this)}}class rp extends H{static forName(e){return this.getCharacterSetECIByName(e)}}class rm{}rm.ISO_8859_1=H.ISO8859_1;class rv{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class ry{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class rw{constructor(e){this.previous=e}getPrevious(){return this.previous}}class rE extends rw{constructor(e,t,r){super(e),this.value=t,this.bitCount=r}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new rE(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new rE(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+F.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class rb extends rE{constructor(e,t,r){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=r}appendTo(e,t){for(let r=0;r<this.binaryShiftByteCount;r++)(0===r||31===r&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):0===r?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+r],8)}addBinaryShift(e,t){return new rb(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function rA(e,t,r){return new rE(e,t,r)}let rC=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],r_=new rE(null,0,0),rS=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])],rI=function(e){for(let t of e)k.fill(t,-1);return e[0][4]=0,e[1][4]=0,e[1][0]=28,e[3][4]=0,e[2][4]=0,e[2][0]=15,e}(k.createInt32Array(6,6));class rT{constructor(e,t,r,n){this.token=e,this.mode=t,this.binaryShiftByteCount=r,this.bitCount=n}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let r=this.bitCount,n=this.token;if(e!==this.mode){let t=rS[this.mode][e];n=rA(n,65535&t,t>>16),r+=t>>16}let i=2===e?4:5;return new rT(n=rA(n,t,i),e,0,r+i)}shiftAndAppend(e,t){let r=this.token,n=2===this.mode?4:5;return r=rA(r,rI[this.mode][e],n),new rT(r=rA(r,t,5),this.mode,0,this.bitCount+n+5)}addBinaryShiftChar(e){let t=this.token,r=this.mode,n=this.bitCount;if(4===this.mode||2===this.mode){let e=rS[r][0];t=rA(t,65535&e,e>>16),n+=e>>16,r=0}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,a=new rT(t,r,this.binaryShiftByteCount+1,n+i);return 2078===a.binaryShiftByteCount&&(a=a.endBinaryShift(e+1)),a}endBinaryShift(e){if(0===this.binaryShiftByteCount)return this;let t=this.token;return new rT(t=new rb(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(rS[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=rT.calculateBinaryShiftCost(e)-rT.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;null!==r;r=r.getPrevious())t.unshift(r);let r=new z;for(let n of t)n.appendTo(r,e);return r}toString(){return X.format("%s bits=%d bytes=%d",rC[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:10*(e.binaryShiftByteCount>0)}}rT.INITIAL_STATE=new rT(r_,0,0,0);let rx=function(e){let t=X.getCharCode(" "),r=X.getCharCode("."),n=X.getCharCode(",");e[0][t]=1;let i=X.getCharCode("Z"),a=X.getCharCode("A");for(let t=a;t<=i;t++)e[0][t]=t-a+2;e[1][t]=1;let o=X.getCharCode("z"),s=X.getCharCode("a");for(let t=s;t<=o;t++)e[1][t]=t-s+2;e[2][t]=1;let l=X.getCharCode("9"),u=X.getCharCode("0");for(let t=u;t<=l;t++)e[2][t]=t-u+2;e[2][n]=12,e[2][r]=13;let c=["\0"," ","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\b"," ","\n","\v","\f","\r","\x1b","\x1c","\x1d","\x1e","\x1f","@","\\","^","_","`","|","~",""];for(let t=0;t<c.length;t++)e[3][X.getCharCode(c[t])]=t;let h=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let t=0;t<h.length;t++)X.getCharCode(h[t])>0&&(e[4][X.getCharCode(h[t])]=t);return e}(k.createInt32Array(5,256));class rD{constructor(e){this.text=e}encode(){let e=X.getCharCode(" "),t=X.getCharCode("\n"),r=ry.singletonList(rT.INITIAL_STATE);for(let n=0;n<this.text.length;n++){let i,a=n+1<this.text.length?this.text[n+1]:0;switch(this.text[n]){case X.getCharCode("\r"):i=2*(a===t);break;case X.getCharCode("."):i=3*(a===e);break;case X.getCharCode(","):i=4*(a===e);break;case X.getCharCode(":"):i=5*(a===e);break;default:i=0}i>0?(r=rD.updateStateListForPair(r,n,i),n++):r=this.updateStateListForChar(r,n)}return ry.min(r,(e,t)=>e.getBitCount()-t.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){let r=[];for(let n of e)this.updateStateForChar(n,t,r);return rD.simplifyStates(r)}updateStateForChar(e,t,r){let n=255&this.text[t],i=rx[e.getMode()][n]>0,a=null;for(let o=0;o<=4;o++){let s=rx[o][n];if(s>0){if(null==a&&(a=e.endBinaryShift(t)),!i||o===e.getMode()||2===o){let e=a.latchAndAppend(o,s);r.push(e)}if(!i&&rI[e.getMode()][o]>=0){let e=a.shiftAndAppend(o,s);r.push(e)}}}if(e.getBinaryShiftByteCount()>0||0===rx[e.getMode()][n]){let n=e.addBinaryShiftChar(t);r.push(n)}}static updateStateListForPair(e,t,r){let n=[];for(let i of e)this.updateStateForPair(i,t,r,n);return this.simplifyStates(n)}static updateStateForPair(e,t,r,n){let i=e.endBinaryShift(t);if(n.push(i.latchAndAppend(4,r)),4!==e.getMode()&&n.push(i.shiftAndAppend(4,r)),3===r||4===r){let e=i.latchAndAppend(2,16-r).latchAndAppend(2,1);n.push(e)}if(e.getBinaryShiftByteCount()>0){let r=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);n.push(r)}}static simplifyStates(e){let t=[];for(let r of e){let e=!0;for(let n of t){if(n.isBetterThanOrEqualTo(r)){e=!1;break}r.isBetterThanOrEqualTo(n)&&(t=t.filter(e=>e!==n))}e&&t.push(r)}return t}}class rN{static encodeBytes(e){return rN.encode(e,rN.DEFAULT_EC_PERCENT,rN.DEFAULT_AZTEC_LAYERS)}static encode(e,t,r){let n,i,a,o,s,l,u=new rD(e).encode(),c=F.truncDivision(u.getSize()*t,100)+11,h=u.getSize()+c;if(r!==rN.DEFAULT_AZTEC_LAYERS){if(n=r<0,(i=Math.abs(r))>(n?rN.MAX_NB_BITS_COMPACT:rN.MAX_NB_BITS))throw new N(X.format("Illegal value %s for layers",r));let e=(a=rN.totalBitsInLayer(i,n))-a%(o=rN.WORD_SIZE[i]);if((s=rN.stuffBits(u,o)).getSize()+c>e||n&&s.getSize()>64*o)throw new N("Data to large for user specified layer")}else{o=0,s=null;for(let e=0;;e++){if(e>rN.MAX_NB_BITS)throw new N("Data too large for an Aztec code");if(i=(n=e<=3)?e+1:e,h>(a=rN.totalBitsInLayer(i,n)))continue;(null==s||o!==rN.WORD_SIZE[i])&&(o=rN.WORD_SIZE[i],s=rN.stuffBits(u,o));let t=a-a%o;if(!(n&&s.getSize()>64*o)&&s.getSize()+c<=t)break}}let d=rN.generateCheckWords(s,a,o),f=s.getSize()/o,g=rN.generateModeMessage(n,i,f),p=(n?11:14)+4*i,v=new Int32Array(p);if(n){l=p;for(let e=0;e<v.length;e++)v[e]=e}else{l=p+1+2*F.truncDivision(F.truncDivision(p,2)-1,15);let e=F.truncDivision(p,2),t=F.truncDivision(l,2);for(let r=0;r<e;r++){let n=r+F.truncDivision(r,15);v[e-r-1]=t-n-1,v[e+r]=t+n+1}}let y=new W(l);for(let e=0,t=0;e<i;e++){let r=(i-e)*4+(n?9:12);for(let n=0;n<r;n++){let i=2*n;for(let a=0;a<2;a++)d.get(t+i+a)&&y.set(v[2*e+a],v[2*e+n]),d.get(t+2*r+i+a)&&y.set(v[2*e+n],v[p-1-2*e-a]),d.get(t+4*r+i+a)&&y.set(v[p-1-2*e-a],v[p-1-2*e-n]),d.get(t+6*r+i+a)&&y.set(v[p-1-2*e-n],v[2*e+a])}t+=8*r}if(rN.drawModeMessage(y,n,l,g),n)rN.drawBullsEye(y,F.truncDivision(l,2),5);else{rN.drawBullsEye(y,F.truncDivision(l,2),7);for(let e=0,t=0;e<F.truncDivision(p,2)-1;e+=15,t+=16)for(let e=1&F.truncDivision(l,2);e<l;e+=2)y.set(F.truncDivision(l,2)-t,e),y.set(F.truncDivision(l,2)+t,e),y.set(e,F.truncDivision(l,2)-t),y.set(e,F.truncDivision(l,2)+t)}let w=new rv;return w.setCompact(n),w.setSize(l),w.setLayers(i),w.setCodeWords(f),w.setMatrix(y),w}static drawBullsEye(e,t,r){for(let n=0;n<r;n+=2)for(let r=t-n;r<=t+n;r++)e.set(r,t-n),e.set(r,t+n),e.set(t-n,r),e.set(t+n,r);e.set(t-r,t-r),e.set(t-r+1,t-r),e.set(t-r,t-r+1),e.set(t+r,t-r),e.set(t+r,t-r+1),e.set(t+r,t+r-1)}static generateModeMessage(e,t,r){let n=new z;return e?(n.appendBits(t-1,2),n.appendBits(r-1,6),n=rN.generateCheckWords(n,28,4)):(n.appendBits(t-1,5),n.appendBits(r-1,11),n=rN.generateCheckWords(n,40,4)),n}static drawModeMessage(e,t,r,n){let i=F.truncDivision(r,2);if(t)for(let t=0;t<7;t++){let r=i-3+t;n.get(t)&&e.set(r,i-5),n.get(t+7)&&e.set(i+5,r),n.get(20-t)&&e.set(r,i+5),n.get(27-t)&&e.set(i-5,r)}else for(let t=0;t<10;t++){let r=i-5+t+F.truncDivision(t,5);n.get(t)&&e.set(r,i-7),n.get(t+10)&&e.set(i+7,r),n.get(29-t)&&e.set(r,i+7),n.get(39-t)&&e.set(i-7,r)}}static generateCheckWords(e,t,r){let n=e.getSize()/r,i=new rn(rN.getGF(r)),a=F.truncDivision(t,r),o=rN.bitsToWords(e,r,a);i.encode(o,a-n);let s=t%r,l=new z;for(let e of(l.appendBits(0,s),Array.from(o)))l.appendBits(e,r);return l}static bitsToWords(e,t,r){let n,i,a=new Int32Array(r);for(n=0,i=e.getSize()/t;n<i;n++){let r=0;for(let i=0;i<t;i++)r|=e.get(n*t+i)?1<<t-i-1:0;a[n]=r}return a}static getGF(e){switch(e){case 4:return ec.AZTEC_PARAM;case 6:return ec.AZTEC_DATA_6;case 8:return ec.AZTEC_DATA_8;case 10:return ec.AZTEC_DATA_10;case 12:return ec.AZTEC_DATA_12;default:throw new N("Unsupported word size "+e)}}static stuffBits(e,t){let r=new z,n=e.getSize(),i=(1<<t)-2;for(let a=0;a<n;a+=t){let o=0;for(let r=0;r<t;r++)(a+r>=n||e.get(a+r))&&(o|=1<<t-1-r);(o&i)===i?(r.appendBits(o&i,t),a--):(o&i)==0?(r.appendBits(1|o,t),a--):r.appendBits(o,t)}return r}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}rN.DEFAULT_EC_PERCENT=33,rN.DEFAULT_AZTEC_LAYERS=0,rN.MAX_NB_BITS=32,rN.MAX_NB_BITS_COMPACT=4,rN.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class rM{encode(e,t,r,n){return this.encodeWithHints(e,t,r,n,null)}encodeWithHints(e,t,r,n,i){let a=rm.ISO_8859_1,o=rN.DEFAULT_EC_PERCENT,s=rN.DEFAULT_AZTEC_LAYERS;return null!=i&&(i.has(rr.CHARACTER_SET)&&(a=rp.forName(i.get(rr.CHARACTER_SET).toString())),i.has(rr.ERROR_CORRECTION)&&(o=F.parseInt(i.get(rr.ERROR_CORRECTION).toString())),i.has(rr.AZTEC_LAYERS)&&(s=F.parseInt(i.get(rr.AZTEC_LAYERS).toString()))),rM.encodeLayers(e,t,r,n,a,o,s)}static encodeLayers(e,t,r,n,i,a,o){if(t!==ei.AZTEC)throw new N("Can only encode AZTEC, but got "+t);let s=rN.encode(X.getBytes(e,i),a,o);return rM.renderResult(s,r,n)}static renderResult(e,t,r){let n=e.getMatrix();if(null==n)throw new ed;let i=n.getWidth(),a=n.getHeight(),o=Math.max(t,i),s=Math.max(r,a),l=Math.min(o/i,s/a),u=(o-i*l)/2,c=(s-a*l)/2,h=new W(o,s);for(let e=0,t=c;e<a;e++,t+=l)for(let r=0,a=u;r<i;r++,a+=l)n.get(r,e)&&h.setRegion(a,t,l,l);return h}}e.AbstractExpandedDecoder=e1,e.ArgumentException=D,e.ArithmeticException=eu,e.AztecCode=rv,e.AztecCodeReader=eT,e.AztecCodeWriter=rM,e.AztecDecoder=eg,e.AztecDetector=eI,e.AztecDetectorResult=ew,e.AztecEncoder=rN,e.AztecHighLevelEncoder=rD,e.AztecPoint=eS,e.BarcodeFormat=ei,e.Binarizer=O,e.BinaryBitmap=M,e.BitArray=z,e.BitMatrix=W,e.BitSource=tf,e.BrowserAztecCodeReader=class extends er{constructor(e=500){super(new eT,e)}},e.BrowserBarcodeReader=class extends er{constructor(e=500,t){super(new ts(t),e,t)}},e.BrowserCodeReader=er,e.BrowserDatamatrixCodeReader=class extends er{constructor(e=500){super(new tv,e)}},e.BrowserMultiFormatReader=class extends er{constructor(e=null,t=500){const r=new rt;r.setHints(e),super(r,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}},e.BrowserPDF417Reader=class extends er{constructor(e=500){super(new t9,e)}},e.BrowserQRCodeReader=class extends er{constructor(e=500){super(new tL,e)}},e.BrowserQRCodeSvgWriter=rh,e.CharacterSetECI=H,e.ChecksumException=R,e.Code128Reader=eD,e.Code39Reader=eN,e.DataMatrixDecodedBitStreamParser=tg,e.DataMatrixReader=tv,e.DecodeHintType=U,e.DecoderResult=eo,e.DefaultGridSampler=eC,e.DetectorResult=ey,e.EAN13Reader=ek,e.EncodeHintType=rr,e.Exception=x,e.FormatException=V,e.GenericGF=ec,e.GenericGFPoly=el,e.GlobalHistogramBinarizer=Z,e.GridSampler=eb,e.GridSamplerInstance=e_,e.HTMLCanvasElementLuminanceSource=J,e.HybridBinarizer=Q,e.ITFReader=eM,e.IllegalArgumentException=N,e.IllegalStateException=ed,e.InvertedLuminanceSource=$,e.LuminanceSource=K,e.MathUtils=ep,e.MultiFormatOneDReader=ts,e.MultiFormatReader=rt,e.MultiFormatWriter=class{encode(e,t,r,n,i){let a;if(t===ei.QR_CODE)a=new rd;else throw new N("No encoder available for format "+t);return a.encode(e,t,r,n,i)}},e.NotFoundException=q,e.OneDReader=ex,e.PDF417DecodedBitStreamParser=t5,e.PDF417DecoderErrorCorrection=tj,e.PDF417Reader=t9,e.PDF417ResultMetadata=tJ,e.PerspectiveTransform=eA,e.PlanarYUVLuminanceSource=rf,e.QRCodeByteMatrix=ra,e.QRCodeDataMask=tC,e.QRCodeDecodedBitStreamParser=tT,e.QRCodeDecoderErrorCorrectionLevel=ty,e.QRCodeDecoderFormatInformation=tw,e.QRCodeEncoder=rc,e.QRCodeEncoderQRCode=ro,e.QRCodeMaskUtil=ri,e.QRCodeMatrixUtil=rl,e.QRCodeMode=tI,e.QRCodeReader=tL,e.QRCodeVersion=tA,e.QRCodeWriter=rd,e.RGBLuminanceSource=rg,e.RSS14Reader=to,e.RSSExpandedReader=ti,e.ReaderException=re,e.ReedSolomonDecoder=ef,e.ReedSolomonEncoder=rn,e.ReedSolomonException=eh,e.Result=en,e.ResultMetadataType=ea,e.ResultPoint=ev,e.StringUtils=X,e.UnsupportedOperationException=j,e.VideoInputDevice=ee,e.WhiteRectangleDetector=eE,e.WriterException=rs,e.ZXingArrays=k,e.ZXingCharset=rp,e.ZXingInteger=F,e.ZXingStandardCharsets=rm,e.ZXingStringBuilder=G,e.ZXingStringEncoding=Y,e.ZXingSystem=P,e.createAbstractExpandedDecoder=tt,Object.defineProperty(e,"__esModule",{value:!0})}(t)},21194(e,t,r){"use strict";r.d(t,{k:()=>n});function n(e,t,r){var n=e.x,i=e.y,a=[],o=1/0,s=1/0;t.forEach(function(e){o=Math.min(o,e.x),s=Math.min(s,e.y)});for(var l=n-e.width/2-o,u=i-e.height/2-s,c=0;c<t.length;c++){var h=t[c],d=t[c<t.length-1?c+1:0],f=function(e,t,r,n){var i,a,o,s,l,u,c,h,d,f,g,p,v;if(i=t.y-e.y,o=e.x-t.x,l=t.x*e.y-e.x*t.y,d=i*r.x+o*r.y+l,f=i*n.x+o*n.y+l,0===d||0===f||!(d*f>0)){if((a=n.y-r.y,s=r.x-n.x,u=n.x*r.y-r.x*n.y,c=a*e.x+s*e.y+u,h=a*t.x+s*t.y+u,!(0!==c&&0!==h&&c*h>0))&&0!=(g=i*s-a*o))return p=Math.abs(g/2),{x:(v=o*u-s*l)<0?(v-p)/g:(v+p)/g,y:(v=a*l-i*u)<0?(v-p)/g:(v+p)/g}}}(e,r,{x:l+h.x,y:u+h.y},{x:l+d.x,y:u+d.y});f&&a.push(f)}return a.length?(a.length>1&&a.sort(function(e,t){var n=e.x-r.x,i=e.y-r.y,a=Math.sqrt(n*n+i*i),o=t.x-r.x,s=t.y-r.y,l=Math.sqrt(o*o+s*s);return a<l?-1:+(a!==l)}),a[0]):(console.log("NO INTERSECTION FOUND, RETURN NODE CENTER",e),e)}},84113(e,t,r){"use strict";function n(e,t){var r,n,i=e.x,a=e.y,o=t.x-i,s=t.y-a,l=e.width/2,u=e.height/2;return Math.abs(s)*l>Math.abs(o)*u?(s<0&&(u=-u),r=0===s?0:u*o/s,n=u):(o<0&&(l=-l),r=l,n=0===o?0:l*s/o),{x:i+r,y:a+n}}r.d(t,{C:()=>n})},10646(e,t,r){"use strict";r.d(t,{H:()=>i});var n=r(82933);function i(e,t){var r=e.append("foreignObject").attr("width","100000"),i=r.append("xhtml:div");i.attr("xmlns","http://www.w3.org/1999/xhtml");var a=t.label;switch(typeof a){case"function":i.insert(a);break;case"object":i.insert(function(){return a});break;default:i.html(a)}n.AV(i,t.labelStyle),i.style("display","inline-block"),i.style("white-space","nowrap");var o=i.node().getBoundingClientRect();return r.attr("width",o.width).attr("height",o.height),r}},82933(e,t,r){"use strict";r.d(t,{AV:()=>u,De:()=>a,c$:()=>h,gh:()=>o,nh:()=>c});var n=r(34963),i=r(89610);function a(e,t){return!!e.children(t).length}function o(e){return l(e.v)+":"+l(e.w)+":"+l(e.name)}var s=/:/g;function l(e){return e?String(e).replace(s,"\\:"):""}function u(e,t){t&&e.attr("style",t)}function c(e,t,r){t&&e.attr("class",t).attr("class",r+" "+e.attr("class"))}function h(e,t){var r=t.graph();if(n.A(r)){var a=r.transition;if(i.A(a))return a(e)}return e}},79552(e,t,r){"use strict";r.d(t,{Zp:()=>ef});var n=r(8058),i=r(5664),a=r(81349),o=r(39142),s=r(34098),l=r(74722),u=r(72897),c=r(697);class h{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return d(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&d(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,r=t._prev;r!==t;)e.push(JSON.stringify(r,f)),r=r._prev;return"["+e.join(", ")+"]"}}function d(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function f(e,t){if("_next"!==e&&"_prev"!==e)return t}var g=o.A(1);function p(e,t,r,i,a){var o=a?[]:void 0;return n.A(e.inEdges(i.v),function(n){var i=e.edge(n),s=e.node(n.v);a&&o.push({v:n.v,w:n.w}),s.out-=i,v(t,r,s)}),n.A(e.outEdges(i.v),function(n){var i=e.edge(n),a=n.w,o=e.node(a);o.in-=i,v(t,r,o)}),e.removeNode(i.v),o}function v(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var y=r(49304),w=r(13551),E=r(23068),b=r(34736),A=r(26666),C=r(36735),_=r(69592),S=r(86452),I=r(81052);function T(e,t,r,n){var a;do a=i.A(n);while(e.hasNode(a));return r.dummy=t,e.setNode(a,r),a}function x(e){var t=new c.T({multigraph:e.isMultigraph()}).setGraph(e.graph());return n.A(e.nodes(),function(r){e.children(r).length||t.setNode(r,e.node(r))}),n.A(e.edges(),function(r){t.setEdge(r,e.edge(r))}),t}function D(e,t){var r,n,i=e.x,a=e.y,o=t.x-i,s=t.y-a,l=e.width/2,u=e.height/2;if(!o&&!s)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*l>Math.abs(o)*u?(s<0&&(u=-u),r=u*o/s,n=u):(o<0&&(l=-l),r=l,n=l*s/o),{x:i+r,y:a+n}}function N(e){var t=l.A(u.A(R(e)+1),function(){return[]});return n.A(e.nodes(),function(r){var n=e.node(r),i=n.rank;_.A(i)||(t[i][n.order]=r)}),t}function M(e,t,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),T(e,"border",i,t)}function R(e){return b.A(l.A(e.nodes(),function(t){var r=e.node(t).rank;if(!_.A(r))return r}))}function O(e,t){var r=I.A();try{return t()}finally{console.log(e+" time: "+(I.A()-r)+"ms")}}function P(e,t){return t()}function B(e,t,r,n,i,a){var o=i[t][a-1],s=T(e,"border",{width:0,height:0,rank:a,borderType:t},r);i[t][a]=s,e.setParent(s,n),o&&e.setEdge(o,s,{weight:1})}function L(e){n.A(e.nodes(),function(t){k(e.node(t))}),n.A(e.edges(),function(t){k(e.edge(t))})}function k(e){var t=e.width;e.width=e.height,e.height=t}function F(e){e.y=-e.y}function z(e){var t=e.x;e.x=e.y,e.y=t}var U=r(88389);function V(e){var t={};n.A(e.sources(),function r(n){var i=e.node(n);if(a.A(t,n))return i.rank;t[n]=!0;var o=S.A(l.A(e.outEdges(n),function(t){return r(t.w)-e.edge(t).minlen}));return(o===1/0||null==o)&&(o=0),i.rank=o})}function H(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function j(e){var t,r,i,a,o=new c.T({directed:!1}),s=e.nodes()[0],l=e.nodeCount();for(o.setNode(s,{});t=o,r=e,n.A(t.nodes(),function e(i){n.A(r.nodeEdges(i),function(n){var a=n.v,o=i===a?n.w:a;t.hasNode(o)||H(r,n)||(t.setNode(o,{}),t.setEdge(i,o,{}),e(o))})}),t.nodeCount()<l;)i=function(e,t){return U.A(t.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return H(t,r)})}(o,e),a=o.hasNode(i.v)?H(e,i):-H(e,i),function(e,t,r){n.A(e.nodes(),function(e){t.node(e).rank+=r})}(o,e,a);return o}var Y=r(58334),X=r(96654);o.A(1),o.A(1);r(54110);function G(){}G.prototype=Error();var W=r(92049);function q(e,t,r){W.A(t)||(t=[t]);var i=(e.isDirected()?e.successors:e.neighbors).bind(e),o=[],s={};return n.A(t,function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);!function e(t,r,i,o,s,l){!a.A(o,r)&&(o[r]=!0,i||l.push(r),n.A(s(r),function(r){e(t,r,i,o,s,l)}),i&&l.push(r))}(e,t,"post"===r,s,i,o)}),o}function Z(e){t=e,r=new c.T().setGraph(t.graph()),n.A(t.nodes(),function(e){r.setNode(e,t.node(e))}),n.A(t.edges(),function(e){var n=r.edge(e.v,e.w)||{weight:0,minlen:1},i=t.edge(e);r.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),V(e=r);var t,r,i,a,o=j(e);for($(o),Q(o,e);i=J(o);)a=ee(o,e,i),et(o,e,i,a)}function Q(e,t){var r=q(e,e.nodes(),"post");r=r.slice(0,r.length-1),n.A(r,function(r){var n,i,a,o;n=e,i=t,a=r,o=n.node(a).parent,n.edge(a,o).cutvalue=K(n,i,a)})}function K(e,t,r){var i=e.node(r).parent,a=!0,o=t.edge(r,i),s=0;return o||(a=!1,o=t.edge(i,r)),s=o.weight,n.A(t.nodeEdges(r),function(n){var o=n.v===r,l=o?n.w:n.v;if(l!==i){var u,c,h,d=o===a,f=t.edge(n).weight;if(s+=d?f:-f,u=e,c=r,h=l,u.hasEdge(c,h)){var g=e.edge(r,l).cutvalue;s+=d?-g:g}}}),s}function $(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,i,o,s){var l=i,u=t.node(o);return r[o]=!0,n.A(t.neighbors(o),function(n){a.A(r,n)||(i=e(t,r,i,n,o))}),u.low=l,u.lim=i++,s?u.parent=s:delete u.parent,i}(e,{},1,t)}function J(e){return Y.A(e.edges(),function(t){return e.edge(t).cutvalue<0})}function ee(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var a=e.node(n),o=e.node(i),s=a,l=!1;a.lim>o.lim&&(s=o,l=!0);var u=X.A(t.edges(),function(t){return l===er(e,e.node(t.v),s)&&l!==er(e,e.node(t.w),s)});return U.A(u,function(e){return H(t,e)})}function et(e,t,r,i){var a,o,s,l,u=r.v,c=r.w;e.removeEdge(u,c),e.setEdge(i.v,i.w,{}),$(e),Q(e,t),a=e,o=t,s=Y.A(a.nodes(),function(e){return!o.node(e).parent}),l=(l=q(a,s,"pre")).slice(1),n.A(l,function(e){var t=a.node(e).parent,r=o.edge(e,t),n=!1;r||(r=o.edge(t,e),n=!0),o.node(e).rank=o.node(t).rank+(n?r.minlen:-r.minlen)})}function er(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}r(51365),Z.initLowLimValues=$,Z.initCutValues=Q,Z.calcCutValue=K,Z.leaveEdge=J,Z.enterEdge=ee,Z.exchangeEdges=et;var en=r(72888),ei=r(86420),ea=r(20903),eo=r(62013),es=r(66637);function el(e,t,r){for(var n;t.length&&(n=A.A(t)).i<=r;)t.pop(),e.push(n.vs),r++;return r}function eu(e,t,r){return l.A(t,function(t){var o,s;return o=function(e){for(var t;e.hasNode(t=i.A("_root")););return t}(e),s=new c.T({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(t){return e.node(t)}),n.A(e.nodes(),function(i){var l=e.node(i),u=e.parent(i);(l.rank===t||l.minRank<=t&&t<=l.maxRank)&&(s.setNode(i),s.setParent(i,u||o),n.A(e[r](i),function(t){var r=t.v===i?t.w:t.v,n=s.edge(r,i),a=_.A(n)?0:n.weight;s.setEdge(r,i,{weight:e.edge(t).weight+a})}),a.A(l,"minRank")&&s.setNode(i,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]}))}),s})}function ec(e,t){n.A(t,function(t){n.A(t,function(t,r){e.node(t).order=r})})}var eh=r(82932);function ed(e,t,r){if(t>r){var n=t;t=r,r=n}var i=e[t];i||(e[t]=i={}),i[r]=!0}function ef(e,t){var r=t&&t.debugTiming?O:P;r("layout",function(){var t=r(" buildLayoutGraph",function(){var t,r,i;return t=e,r=new c.T({multigraph:!0,compound:!0}),i=eC(t.graph()),r.setGraph(y.A({},ep,eA(i,eg),w.A(i,em))),n.A(t.nodes(),function(e){var n=eC(t.node(e));r.setNode(e,E.A(eA(n,ev),ey)),r.setParent(e,t.parent(e))}),n.A(t.edges(),function(e){var n=eC(t.edge(e));r.setEdge(e,y.A({},eE,eA(n,ew),w.A(n,eb)))}),r});r(" runLayout",function(){var e,o;e=t,(o=r)(" makeSpaceForEdgeLabels",function(){var t,r;r=(t=e).graph(),r.ranksep/=2,n.A(t.edges(),function(e){var n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)})}),o(" removeSelfEdges",function(){var t;t=e,n.A(t.edges(),function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),o(" acyclic",function(){var t,r,o,d,f,y;t="greedy"===e.graph().acyclicer?function(e,t){if(1>=e.nodeCount())return[];var r,i,a,o,d,f,y,w=(r=e,i=t||g,a=new c.T,o=0,d=0,n.A(r.nodes(),function(e){a.setNode(e,{v:e,in:0,out:0})}),n.A(r.edges(),function(e){var t=a.edge(e.v,e.w)||0,r=i(e);a.setEdge(e.v,e.w,t+r),d=Math.max(d,a.node(e.v).out+=r),o=Math.max(o,a.node(e.w).in+=r)}),f=u.A(d+o+3).map(function(){return new h}),y=o+1,n.A(a.nodes(),function(e){v(f,y,a.node(e))}),{graph:a,buckets:f,zeroIdx:y}),E=function(e,t,r){for(var n,i=[],a=t[t.length-1],o=t[0];e.nodeCount();){for(;n=o.dequeue();)p(e,t,r,n);for(;n=a.dequeue();)p(e,t,r,n);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(n=t[s].dequeue()){i=i.concat(p(e,t,r,n,!0));break}}}return i}(w.graph,w.buckets,w.zeroIdx);return s.A(l.A(E,function(t){return e.outEdges(t.v,t.w)}))}(e,(r=e,function(e){return r.edge(e).weight})):(o=e,d=[],f={},y={},n.A(o.nodes(),function e(t){a.A(y,t)||(y[t]=!0,f[t]=!0,n.A(o.outEdges(t),function(t){a.A(f,t.w)?d.push(t):e(t.w)}),delete f[t])}),d),n.A(t,function(t){var r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,i.A("rev"))})}),o(" nestingGraph.run",function(){var t,r,i,a,o,s,l;t=T(e,"root",{},"_root"),o=e,s={},n.A(o.children(),function(e){!function e(t,r){var i=o.children(t);i&&i.length&&n.A(i,function(t){e(t,r+1)}),s[t]=r}(e,1)}),i=2*(r=b.A(en.A(s))-1)+1,e.graph().nestingRoot=t,n.A(e.edges(),function(t){e.edge(t).minlen*=i}),a=(l=e,ei.A(l.edges(),function(e,t){return e+l.edge(t).weight},0)+1),n.A(e.children(),function(o){!function e(t,r,i,a,o,s,l){var u=t.children(l);if(!u.length){l!==r&&t.setEdge(r,l,{weight:0,minlen:i});return}var c=M(t,"_bt"),h=M(t,"_bb"),d=t.node(l);t.setParent(c,l),d.borderTop=c,t.setParent(h,l),d.borderBottom=h,n.A(u,function(n){e(t,r,i,a,o,s,n);var u=t.node(n),d=u.borderTop?u.borderTop:n,f=u.borderBottom?u.borderBottom:n,g=u.borderTop?a:2*a,p=d!==f?1:o-s[l]+1;t.setEdge(c,d,{weight:g,minlen:p,nestingEdge:!0}),t.setEdge(f,h,{weight:g,minlen:p,nestingEdge:!0})}),t.parent(l)||t.setEdge(r,c,{weight:0,minlen:o+s[l]})}(e,t,i,a,r,s,o)}),e.graph().nodeRankFactor=i}),o(" rank",function(){var t,r=x(e);switch(r.graph().ranker){case"network-simplex":default:Z(r);break;case"tight-tree":V(t=r),j(t);break;case"longest-path":V(r)}}),o(" injectEdgeLabelProxies",function(){var t;t=e,n.A(t.edges(),function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),i={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};T(t,"edge-proxy",i,"_ep")}})}),o(" removeEmptyRanks",function(){var t,r,i,a;t=S.A(l.A(e.nodes(),function(t){return e.node(t).rank})),r=[],n.A(e.nodes(),function(n){var i=e.node(n).rank-t;r[i]||(r[i]=[]),r[i].push(n)}),i=0,a=e.graph().nodeRankFactor,n.A(r,function(t,r){_.A(t)&&r%a!=0?--i:i&&n.A(t,function(t){e.node(t).rank+=i})})}),o(" nestingGraph.cleanup",function(){var t;t=e.graph(),e.removeNode(t.nestingRoot),delete t.nestingRoot,n.A(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}),o(" normalizeRanks",function(){var t;t=S.A(l.A(e.nodes(),function(t){return e.node(t).rank})),n.A(e.nodes(),function(r){var n=e.node(r);a.A(n,"rank")&&(n.rank-=t)})}),o(" assignRankMinMax",function(){var t,r;t=e,r=0,n.A(t.nodes(),function(e){var n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=b.A(r,n.maxRank))}),t.graph().maxRank=r}),o(" removeEdgeLabelProxies",function(){var t;t=e,n.A(t.nodes(),function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),o(" normalize.run",function(){e.graph().dummyChains=[],n.A(e.edges(),function(t){!function(e,t){var r,n,i,a=t.v,o=e.node(a).rank,s=t.w,l=e.node(s).rank,u=t.name,c=e.edge(t),h=c.labelRank;if(l!==o+1){for(e.removeEdge(t),i=0,++o;o<l;++i,++o)c.points=[],r=T(e,"edge",n={width:0,height:0,edgeLabel:c,edgeObj:t,rank:o},"_d"),o===h&&(n.width=c.width,n.height=c.height,n.dummy="edge-label",n.labelpos=c.labelpos),e.setEdge(a,r,{weight:c.weight},u),0===i&&e.graph().dummyChains.push(r),a=r;e.setEdge(a,s,{weight:c.weight},u)}}(e,t)})}),o(" parentDummyChains",function(){var t,r,i;t=e,r={},i=0,n.A(t.children(),function e(a){var o=i;n.A(t.children(a),e),r[a]={low:o,lim:i++}}),n.A(e.graph().dummyChains,function(t){for(var n=e.node(t),i=n.edgeObj,a=function(e,t,r,n){var i,a,o=[],s=[],l=Math.min(t[r].low,t[n].low),u=Math.max(t[r].lim,t[n].lim);i=r;do o.push(i=e.parent(i));while(i&&(t[i].low>l||u>t[i].lim));for(a=i,i=n;(i=e.parent(i))!==a;)s.push(i);return{path:o.concat(s.reverse()),lca:a}}(e,r,i.v,i.w),o=a.path,s=a.lca,l=0,u=o[0],c=!0;t!==i.w;){if(n=e.node(t),c){for(;(u=o[l])!==s&&e.node(u).maxRank<n.rank;)l++;u===s&&(c=!1)}if(!c){for(;l<o.length-1&&e.node(u=o[l+1]).minRank<=n.rank;)l++;u=o[l]}e.setParent(t,u),t=e.successors(t)[0]}})}),o(" addBorderSegments",function(){n.A(e.children(),function t(r){var i=e.children(r),o=e.node(r);if(i.length&&n.A(i,t),a.A(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,l=o.maxRank+1;s<l;++s)B(e,"borderLeft","_bl",r,o,s),B(e,"borderRight","_br",r,o,s)}})}),o(" order",function(){!function(e){var t=R(e),r=eu(e,u.A(1,t+1),"inEdges"),i=eu(e,u.A(t-1,-1,-1),"outEdges"),o=(h={},d=X.A(e.nodes(),function(t){return!e.children(t).length}),f=b.A(l.A(d,function(t){return e.node(t).rank})),g=l.A(u.A(f+1),function(){return[]}),p=es.A(d,function(t){return e.node(t).rank}),n.A(p,function t(r){a.A(h,r)||(h[r]=!0,g[e.node(r).rank].push(r),n.A(e.successors(r),t))}),g);ec(e,o);for(var h,d,f,g,p,v,y=1/0,E=0,A=0;A<4;++E,++A){(function(e,t){var r=new c.T;n.A(e,function(e){var i,o,u,c=e.graph().root,h=function e(t,r,i,o){var u,c,h,d,f,g,p,v,y,E,b,A,C=t.children(r),S=t.node(r),I=S?S.borderLeft:void 0,T=S?S.borderRight:void 0,x={};I&&(C=X.A(C,function(e){return e!==I&&e!==T}));var D=(u=C,l.A(u,function(e){var r=t.inEdges(e);if(!r.length)return{v:e};var n=ei.A(r,function(e,r){var n=t.edge(r),i=t.node(r.v);return{sum:e.sum+n.weight*i.order,weight:e.weight+n.weight}},{sum:0,weight:0});return{v:e,barycenter:n.sum/n.weight,weight:n.weight}}));n.A(D,function(r){if(t.children(r.v).length){var n,s,l=e(t,r.v,i,o);x[r.v]=l,a.A(l,"barycenter")&&(n=r,s=l,_.A(n.barycenter)?(n.barycenter=s.barycenter,n.weight=s.weight):(n.barycenter=(n.barycenter*n.weight+s.barycenter*s.weight)/(n.weight+s.weight),n.weight+=s.weight))}});var N=(c={},n.A(D,function(e,t){var r=c[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};_.A(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),n.A(i.edges(),function(e){var t=c[e.v],r=c[e.w];_.A(t)||_.A(r)||(r.indegree++,t.out.push(c[e.w]))}),function(e){for(var t=[];e.length;){var r=e.pop();t.push(r),n.A(r.in.reverse(),function(e){return function(t){!t.merged&&(_.A(t.barycenter)||_.A(e.barycenter)||t.barycenter>=e.barycenter)&&function(e,t){var r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),n.A(r.out,function(t){return function(r){r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return l.A(X.A(t,function(e){return!e.merged}),function(e){return w.A(e,["vs","i","barycenter","weight"])})}(X.A(c,function(e){return!e.indegree})));!function(e,t){n.A(e,function(e){e.vs=s.A(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}(N,x);var M=(g=(h=function(e){return a.A(e,"barycenter")},d={lhs:[],rhs:[]},n.A(N,function(e){h(e)?d.lhs.push(e):d.rhs.push(e)}),f=d).lhs,p=es.A(f.rhs,function(e){return-e.i}),v=[],y=0,E=0,b=0,g.sort(function(e){return function(t,r){return t.barycenter<r.barycenter?-1:t.barycenter>r.barycenter?1:e?r.i-t.i:t.i-r.i}}(!!o)),b=el(v,p,b),n.A(g,function(e){b+=e.vs.length,v.push(e.vs),y+=e.barycenter*e.weight,E+=e.weight,b=el(v,p,b)}),A={vs:s.A(v)},E&&(A.barycenter=y/E,A.weight=E),A);if(I&&(M.vs=s.A([I,M.vs,T]),t.predecessors(I).length)){var R=t.node(t.predecessors(I)[0]),O=t.node(t.predecessors(T)[0]);a.A(M,"barycenter")||(M.barycenter=0,M.weight=0),M.barycenter=(M.barycenter*M.weight+R.order+O.order)/(M.weight+2),M.weight+=2}return M}(e,c,r,t);n.A(h.vs,function(t,r){e.node(t).order=r}),i=h.vs,u={},n.A(i,function(t){for(var n,i,a=e.parent(t);a;){if((n=e.parent(a))?(i=u[n],u[n]=a):(i=o,o=a),i&&i!==a)return void r.setEdge(i,a);a=n}})})})(E%2?r:i,E%4>=2),o=N(e);var C=function(e,t){for(var r=0,i=1;i<t.length;++i)r+=function(e,t,r){for(var i=eo.A(r,l.A(r,function(e,t){return t})),a=s.A(l.A(t,function(t){return es.A(l.A(e.outEdges(t),function(t){return{pos:i[t.w],weight:e.edge(t).weight}}),"pos")})),o=1;o<r.length;)o<<=1;var u=2*o-1;o-=1;var c=l.A(Array(u),function(){return 0}),h=0;return n.A(a.forEach(function(e){var t=e.pos+o;c[t]+=e.weight;for(var r=0;t>0;)t%2&&(r+=c[t+1]),t=t-1>>1,c[t]+=e.weight;h+=e.weight*r})),h}(e,t[i-1],t[i]);return r}(e,o);C<y&&(A=0,v=ea.A(o),y=C)}ec(e,v)}(e)}),o(" insertSelfEdges",function(){var t,r;r=N(t=e),n.A(r,function(e){var r=0;n.A(e,function(e,i){var a=t.node(e);a.order=i+r,n.A(a.selfEdges,function(e){T(t,"selfedge",{width:e.label.width,height:e.label.height,rank:a.rank,order:i+ ++r,e:e.e,label:e.label},"_se")}),delete a.selfEdges})})}),o(" adjustCoordinateSystem",function(){var t;("lr"===(t=e.graph().rankdir.toLowerCase())||"rl"===t)&&L(e)}),o(" position",function(){var t,r,i,o,s,h,d,f,g,p,v,w,E,_,I,T;_=N(E=t=x(t=e)),I=E.graph().ranksep,T=0,n.A(_,function(e){var t=b.A(l.A(e,function(e){return E.node(e).height}));n.A(e,function(e){E.node(e).y=T+t/2}),T+=t+I}),n.A((o=N(r=t),h=y.A((s={},ei.A(o,function(e,t){var i=0,a=0,o=e.length,l=A.A(t);return n.A(t,function(e,u){var c=function(e,t){if(e.node(t).dummy)return Y.A(e.predecessors(t),function(t){return e.node(t).dummy})}(r,e),h=c?r.node(c).order:o;(c||e===l)&&(n.A(t.slice(a,u+1),function(e){n.A(r.predecessors(e),function(t){var n=r.node(t),a=n.order;(a<i||h<a)&&!(n.dummy&&r.node(e).dummy)&&ed(s,t,e)})}),a=u+1,i=h)}),t}),s),function(e,t){var r={};function i(t,i,a,o,s){var l;n.A(u.A(i,a),function(i){l=t[i],e.node(l).dummy&&n.A(e.predecessors(l),function(t){var n=e.node(t);n.dummy&&(n.order<o||n.order>s)&&ed(r,t,l)})})}return ei.A(t,function(t,r){var a,o=-1,s=0;return n.A(r,function(n,l){if("border"===e.node(n).dummy){var u=e.predecessors(n);u.length&&(a=e.node(u[0]).order,i(r,s,l,o,a),s=l,o=a)}i(r,s,r.length,a,t.length)}),r}),r}(r,o)),d={},n.A(["u","d"],function(e){i="u"===e?o:en.A(o).reverse(),n.A(["l","r"],function(t){"r"===t&&(i=l.A(i,function(e){return en.A(e).reverse()}));var o,s,u,f,g=("u"===e?r.predecessors:r.successors).bind(r),p=(o=i,s={},u={},f={},n.A(o,function(e){n.A(e,function(e,t){s[e]=e,u[e]=e,f[e]=t})}),n.A(o,function(e){var t=-1;n.A(e,function(e){var r=g(e);if(r.length)for(var n=((r=es.A(r,function(e){return f[e]})).length-1)/2,i=Math.floor(n),o=Math.ceil(n);i<=o;++i){var l=r[i];u[e]===e&&t<f[l]&&!function(e,t,r){if(t>r){var n=t;t=r,r=n}return a.A(e[t],r)}(h,e,l)&&(u[l]=e,u[e]=s[e]=s[l],t=f[l])}})}),{root:s,align:u}),v=function(e,t,r,i,o){var s,l,u,h,d,f,g,p,v,y,w={},E=(s=e,l=t,u=r,h=o,p=new c.T,y=(d=(v=s.graph()).nodesep,f=v.edgesep,g=h,function(e,t,r){var n,i,o=e.node(t),s=e.node(r);if(n=0+o.width/2,a.A(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":i=-o.width/2;break;case"r":i=o.width/2}if(i&&(n+=g?i:-i),i=0,n+=(o.dummy?f:d)/2,n+=(s.dummy?f:d)/2,n+=s.width/2,a.A(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":i=s.width/2;break;case"r":i=-s.width/2}return i&&(n+=g?i:-i),i=0,n}),n.A(l,function(e){var t;n.A(e,function(e){var r=u[e];if(p.setNode(r),t){var n=u[t],i=p.edge(n,r);p.setEdge(n,r,Math.max(y(s,e,t),i||0))}t=e})}),p),b=o?"borderLeft":"borderRight";function A(e,t){for(var r=E.nodes(),n=r.pop(),i={};n;)i[n]?e(n):(i[n]=!0,r.push(n),r=r.concat(t(n))),n=r.pop()}return A(function(e){w[e]=E.inEdges(e).reduce(function(e,t){return Math.max(e,w[t.v]+E.edge(t))},0)},E.predecessors.bind(E)),A(function(t){var r=E.outEdges(t).reduce(function(e,t){return Math.min(e,w[t.w]-E.edge(t))},1/0),n=e.node(t);r!==1/0&&n.borderType!==b&&(w[t]=Math.max(w[t],r))},E.successors.bind(E)),n.A(i,function(e){w[e]=w[r[e]]}),w}(r,i,p.root,p.align,"r"===t);"r"===t&&(v=C.A(v,function(e){return-e})),d[e+t]=v})}),f=U.A(en.A(d),function(e){var t=-1/0,n=1/0;return eh.A(e,function(e,i){var a,o,s=(a=r,o=i,a.node(o).width/2);t=Math.max(e+s,t),n=Math.min(e-s,n)}),t-n}),g=en.A(f),p=S.A(g),v=b.A(g),n.A(["u","d"],function(e){n.A(["l","r"],function(t){var r,n=e+t,i=d[n];if(i!==f){var a=en.A(i);(r="l"===t?p-S.A(a):v-b.A(a))&&(d[n]=C.A(i,function(e){return e+r}))}})}),w=r.graph().align,C.A(d.ul,function(e,t){if(w)return d[w.toLowerCase()][t];var r=es.A(l.A(d,t));return(r[1]+r[2])/2})),function(e,r){t.node(r).x=e})}),o(" positionSelfEdges",function(){var t;t=e,n.A(t.nodes(),function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),i=n.x+n.width/2,a=n.y,o=r.x-i,s=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],r.label.x=r.x,r.label.y=r.y}})}),o(" removeBorderNodes",function(){var t;t=e,n.A(t.nodes(),function(e){if(t.children(e).length){var r=t.node(e),n=t.node(r.borderTop),i=t.node(r.borderBottom),a=t.node(A.A(r.borderLeft)),o=t.node(A.A(r.borderRight));r.width=Math.abs(o.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),n.A(t.nodes(),function(e){"border"===t.node(e).dummy&&t.removeNode(e)})}),o(" normalize.undo",function(){n.A(e.graph().dummyChains,function(t){var r,n=e.node(t),i=n.edgeLabel;for(e.setEdge(n.edgeObj,i);n.dummy;)r=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=r,n=e.node(t)})}),o(" fixupEdgeLabelCoords",function(){var t;t=e,n.A(t.edges(),function(e){var r=t.edge(e);if(a.A(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),o(" undoCoordinateSystem",function(){var t,r,i;("bt"===(t=e.graph().rankdir.toLowerCase())||"rl"===t)&&(r=e,n.A(r.nodes(),function(e){F(r.node(e))}),n.A(r.edges(),function(e){var t=r.edge(e);n.A(t.points,F),a.A(t,"y")&&F(t)})),("lr"===t||"rl"===t)&&(i=e,n.A(i.nodes(),function(e){z(i.node(e))}),n.A(i.edges(),function(e){var t=i.edge(e);n.A(t.points,z),a.A(t,"x")&&z(t)}),L(e))}),o(" translateGraph",function(){!function(e){var t=1/0,r=0,i=1/0,o=0,s=e.graph(),l=s.marginx||0,u=s.marginy||0;function c(e){var n=e.x,a=e.y,s=e.width,l=e.height;t=Math.min(t,n-s/2),r=Math.max(r,n+s/2),i=Math.min(i,a-l/2),o=Math.max(o,a+l/2)}n.A(e.nodes(),function(t){c(e.node(t))}),n.A(e.edges(),function(t){var r=e.edge(t);a.A(r,"x")&&c(r)}),t-=l,i-=u,n.A(e.nodes(),function(r){var n=e.node(r);n.x-=t,n.y-=i}),n.A(e.edges(),function(r){var o=e.edge(r);n.A(o.points,function(e){e.x-=t,e.y-=i}),a.A(o,"x")&&(o.x-=t),a.A(o,"y")&&(o.y-=i)}),s.width=r-t+l,s.height=o-i+u}(e)}),o(" assignNodeIntersects",function(){var t;t=e,n.A(t.edges(),function(e){var r,n,i=t.edge(e),a=t.node(e.v),o=t.node(e.w);i.points?(r=i.points[0],n=i.points[i.points.length-1]):(i.points=[],r=o,n=a),i.points.unshift(D(a,r)),i.points.push(D(o,n))})}),o(" reversePoints",function(){var t;t=e,n.A(t.edges(),function(e){var r=t.edge(e);r.reversed&&r.points.reverse()})}),o(" acyclic.undo",function(){n.A(e.edges(),function(t){var r=e.edge(t);if(r.reversed){e.removeEdge(t);var n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})})}),r(" updateInputGraph",function(){var r,i;r=e,i=t,n.A(r.nodes(),function(e){var t=r.node(e),n=i.node(e);t&&(t.x=n.x,t.y=n.y,i.children(e).length&&(t.width=n.width,t.height=n.height))}),n.A(r.edges(),function(e){var t=r.edge(e),n=i.edge(e);t.points=n.points,a.A(n,"x")&&(t.x=n.x,t.y=n.y)}),r.graph().width=i.graph().width,r.graph().height=i.graph().height})})}var eg=["nodesep","edgesep","ranksep","marginx","marginy"],ep={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},em=["acyclicer","ranker","rankdir","align"],ev=["width","height"],ey={width:0,height:0},ew=["minlen","weight","width","height","labeloffset"],eE={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},eb=["labelpos"];function eA(e,t){return C.A(w.A(e,t),Number)}function eC(e){var t={};return n.A(e,function(e,r){t[r.toLowerCase()]=e}),t}},51365(e,t,r){"use strict";r.d(t,{T:()=>g});var n=r(81349),i=r(39142),a=r(89610),o=r(27422),s=r(96654),l=r(66401),u=r(8058),c=r(69592),h=r(10491),d=r(72888),f=r(86420);class g{constructor(e={}){this._isDirected=!n.A(e,"directed")||e.directed,this._isMultigraph=!!n.A(e,"multigraph")&&e.multigraph,this._isCompound=!!n.A(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=i.A(void 0),this._defaultEdgeLabelFn=i.A(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return a.A(e)||(e=i.A(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return o.A(this._nodes)}sources(){var e=this;return s.A(this.nodes(),function(t){return l.A(e._in[t])})}sinks(){var e=this;return s.A(this.nodes(),function(t){return l.A(e._out[t])})}setNodes(e,t){var r=arguments,n=this;return u.A(e,function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return n.A(this._nodes,e)?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this}node(e){return this._nodes[e]}hasNode(e){return n.A(this._nodes,e)}removeNode(e){var t=this;if(n.A(this._nodes,e)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],u.A(this.children(e),function(e){t.setParent(e)}),delete this._children[e]),u.A(o.A(this._in[e]),r),delete this._in[e],delete this._preds[e],u.A(o.A(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(c.A(t))t="\0";else{t+="";for(var r=t;!c.A(r);r=this.parent(r))if(r===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e){if(c.A(e)&&(e="\0"),this._isCompound){var t=this._children[e];if(t)return o.A(t)}else if("\0"===e)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return o.A(t)}successors(e){var t=this._sucs[e];if(t)return o.A(t)}neighbors(e){var t=this.predecessors(e);if(t)return h.A(t,this.successors(e))}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;u.A(this._nodes,function(r,n){e(n)&&t.setNode(n,r)}),u.A(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&u.A(t.nodes(),function(e){t.setParent(e,function e(i){var a=r.parent(i);return void 0===a||t.hasNode(a)?(n[i]=a,a):a in n?n[a]:e(a)}(e))}),t}setDefaultEdgeLabel(e){return a.A(e)||(e=i.A(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return d.A(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return f.A(e,function(e,i){return n.length>1?r.setEdge(e,i,t):r.setEdge(e,i),i}),this}setEdge(){var e,t,r,i,a=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(e=o.v,t=o.w,r=o.name,2==arguments.length&&(i=arguments[1],a=!0)):(e=o,t=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,t=""+t,c.A(r)||(r=""+r);var s=y(this._isDirected,e,t,r);if(n.A(this._edgeLabels,s))return a&&(this._edgeLabels[s]=i),this;if(!c.A(r)&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[s]=a?i:this._defaultEdgeLabelFn(e,t,r);var l=function(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return n&&(s.name=n),s}(this._isDirected,e,t,r);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[s]=l,p(this._preds[t],e),p(this._sucs[e],t),this._in[t][s]=l,this._out[e][s]=l,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?w(this._isDirected,arguments[0]):y(this._isDirected,e,t,r);return this._edgeLabels[n]}hasEdge(e,t,r){var i=1==arguments.length?w(this._isDirected,arguments[0]):y(this._isDirected,e,t,r);return n.A(this._edgeLabels,i)}removeEdge(e,t,r){var n=1==arguments.length?w(this._isDirected,arguments[0]):y(this._isDirected,e,t,r),i=this._edgeObjs[n];return i&&(e=i.v,t=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],v(this._preds[t],e),v(this._sucs[e],t),delete this._in[t][n],delete this._out[e][n],this._edgeCount--),this}inEdges(e,t){var r=this._in[e];if(r){var n=d.A(r);return t?s.A(n,function(e){return e.v===t}):n}}outEdges(e,t){var r=this._out[e];if(r){var n=d.A(r);return t?s.A(n,function(e){return e.w===t}):n}}nodeEdges(e,t){var r=this.inEdges(e,t);if(r)return r.concat(this.outEdges(e,t))}}function p(e,t){e[t]?e[t]++:e[t]=1}function v(e,t){--e[t]||delete e[t]}function y(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var o=i;i=a,a=o}return i+"\x01"+a+"\x01"+(c.A(n)?"\0":n)}function w(e,t){return y(e,t.v,t.w,t.name)}g.prototype._nodeCount=0,g.prototype._edgeCount=0},697(e,t,r){"use strict";r.d(t,{T:()=>n.T});var n=r(51365)},14075(e,t,r){"use strict";r.d(t,{M:()=>o});var n=r(69592),i=r(50053),a=r(74722);function o(e){var t,r,o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e,a.A(t.nodes(),function(e){var r=t.node(e),i=t.parent(e),a={v:e};return n.A(r)||(a.value=r),n.A(i)||(a.parent=i),a})),edges:(r=e,a.A(r.edges(),function(e){var t=r.edge(e),i={v:e.v,w:e.w};return n.A(e.name)||(i.name=e.name),n.A(t)||(i.value=t),i}))};return n.A(e.graph())||(o.value=i.A(e.graph())),o}r(51365)},76916(e,t,r){"use strict";r.d(t,{XX:()=>I});var n=r(83341),i=r(81349),a=r(23068),o=r(8058),s=r(79552),l=r(82933),u={normal:function(e,t,r,n){var i=e.append("marker").attr("id",t).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.AV(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])},vee:function(e,t,r,n){var i=e.append("marker").attr("id",t).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.AV(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])},undirected:function(e,t,r,n){var i=e.append("marker").attr("id",t).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");l.AV(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])}},c=r(10646);function h(e,t,r){var n,i=t.label,a=e.append("g");"svg"===t.labelType?(a.node().appendChild(t.label),l.AV(a,t.labelStyle)):"string"!=typeof i||"html"===t.labelType?(0,c.H)(a,t):function(e,t){for(var r=e.append("text"),n=(function(e){for(var t,r="",n=!1,i=0;i<e.length;++i)t=e[i],n?("n"===t?r+="\n":r+=t,n=!1):"\\"===t?n=!0:r+=t;return r})(t.label).split("\n"),i=0;i<n.length;i++)r.append("tspan").attr("xml:space","preserve").attr("dy","1em").attr("x","1").text(n[i]);l.AV(r,t.labelStyle)}(a,t);var o=a.node().getBBox();switch(r){case"top":n=-t.height/2;break;case"bottom":n=t.height/2-o.height;break;default:n=-o.height/2}return a.attr("transform","translate("+-o.width/2+","+n+")"),a}var d=function(e,t){var r=t.nodes().filter(function(e){return l.De(t,e)}),i=e.selectAll("g.cluster").data(r,function(e){return e});l.c$(i.exit(),t).style("opacity",0).remove();var a=i.enter().append("g").attr("class","cluster").attr("id",function(e){return t.node(e).id}).style("opacity",0).each(function(e){var r=t.node(e),i=n.Ltv(this);n.Ltv(this).append("rect"),h(i.append("g").attr("class","label"),r,r.clusterLabelPos)});return i=i.merge(a),(i=l.c$(i,t).style("opacity",1)).selectAll("rect").each(function(e){var r=t.node(e),i=n.Ltv(this);l.AV(i,r.style)}),i};let f=function(e,t){var r,a=e.selectAll("g.edgeLabel").data(t.edges(),function(e){return l.gh(e)}).classed("update",!0);return a.exit().remove(),a.enter().append("g").classed("edgeLabel",!0).style("opacity",0),(a=e.selectAll("g.edgeLabel")).each(function(e){var r=n.Ltv(this);r.select(".label").remove();var a=t.edge(e),o=h(r,t.edge(e),0).classed("label",!0),s=o.node().getBBox();a.labelId&&o.attr("id",a.labelId),i.A(a,"width")||(a.width=s.width),i.A(a,"height")||(a.height=s.height)}),r=a.exit?a.exit():a.selectAll(null),l.c$(r,t).style("opacity",0).remove(),a};var g=r(5664),p=r(72897);function v(e,t){return e.intersect(t)}var y=function(e,t,r){var i,a,o,s,u,c,h=e.selectAll("g.edgePath").data(t.edges(),function(e){return l.gh(e)}).classed("update",!0),d=(i=h,a=t,(o=i.enter().append("g").attr("class","edgePath").style("opacity",0)).append("path").attr("class","path").attr("d",function(e){var t=a.edge(e),r=a.node(e.v).elem,n=p.A(t.points.length).map(function(){var e,t;return e=r.getBBox(),{x:(t=r.ownerSVGElement.getScreenCTM().inverse().multiply(r.getScreenCTM()).translate(e.width/2,e.height/2)).e,y:t.f}});return w(t,n)}),o.append("defs"),o);s=h,u=t,c=s.exit(),l.c$(c,u).style("opacity",0).remove();var f=void 0!==h.merge?h.merge(d):h;return l.c$(f,t).style("opacity",1),f.each(function(e){var r=n.Ltv(this),i=t.edge(e);i.elem=this,i.id&&r.attr("id",i.id),l.nh(r,i.class,(r.classed("update")?"update ":"")+"edgePath")}),f.selectAll("path.path").each(function(e){var r=t.edge(e);r.arrowheadId=g.A("arrowhead");var i=n.Ltv(this).attr("marker-end",function(){var e,t;return"url("+(e=location.href,t=r.arrowheadId,e.split("#")[0]+"#"+t)+")"}).style("fill","none");l.c$(i,t).attr("d",function(e){var r,n,i,a,o,s;return r=t,n=e,i=r.edge(n),a=r.node(n.v),o=r.node(n.w),(s=i.points.slice(1,i.points.length-1)).unshift(v(a,s[0])),s.push(v(o,s[s.length-1])),w(i,s)}),l.AV(i,r.style)}),f.selectAll("defs *").remove(),f.selectAll("defs").each(function(e){var i=t.edge(e);(0,r[i.arrowhead])(n.Ltv(this),i.arrowheadId,i,"arrowhead")}),f};function w(e,t){var r=(n.n8j||n.JWy.line)().x(function(e){return e.x}).y(function(e){return e.y});return(r.curve||r.interpolate)(e.curve),r(t)}var E=r(13551),b=function(e,t,r){var a,o=t.nodes().filter(function(e){return!l.De(t,e)}),s=e.selectAll("g.node").data(o,function(e){return e}).classed("update",!0);return s.exit().remove(),s.enter().append("g").attr("class","node").style("opacity",0),(s=e.selectAll("g.node")).each(function(e){var a=t.node(e),o=n.Ltv(this);l.nh(o,a.class,(o.classed("update")?"update ":"")+"node"),o.select("g.label").remove();var s=o.append("g").attr("class","label"),u=h(s,a),c=r[a.shape],d=E.A(u.node().getBBox(),"width","height");a.elem=this,a.id&&o.attr("id",a.id),a.labelId&&s.attr("id",a.labelId),i.A(a,"width")&&(d.width=a.width),i.A(a,"height")&&(d.height=a.height),d.width+=a.paddingLeft+a.paddingRight,d.height+=a.paddingTop+a.paddingBottom,s.attr("transform","translate("+(a.paddingLeft-a.paddingRight)/2+","+(a.paddingTop-a.paddingBottom)/2+")");var f=n.Ltv(this);f.select(".label-container").remove();var g=c(f,d,a).classed("label-container",!0);l.AV(g,a.style);var p=g.node().getBBox();a.width=p.width,a.height=p.height}),a=s.exit?s.exit():s.selectAll(null),l.c$(a,t).style("opacity",0).remove(),s};function A(e,t,r,n){var i=e.x,a=e.y,o=i-n.x,s=a-n.y,l=Math.sqrt(t*t*s*s+r*r*o*o),u=Math.abs(t*r*o/l);n.x<i&&(u=-u);var c=Math.abs(t*r*s/l);return n.y<a&&(c=-c),{x:i+u,y:a+c}}var C=r(21194),_=r(84113),S={rect:function(e,t,r){var n=e.insert("rect",":first-child").attr("rx",r.rx).attr("ry",r.ry).attr("x",-t.width/2).attr("y",-t.height/2).attr("width",t.width).attr("height",t.height);return r.intersect=function(e){return(0,_.C)(r,e)},n},ellipse:function(e,t,r){var n=t.width/2,i=t.height/2,a=e.insert("ellipse",":first-child").attr("x",-t.width/2).attr("y",-t.height/2).attr("rx",n).attr("ry",i);return r.intersect=function(e){return A(r,n,i,e)},a},circle:function(e,t,r){var n=Math.max(t.width,t.height)/2,i=e.insert("circle",":first-child").attr("x",-t.width/2).attr("y",-t.height/2).attr("r",n);return r.intersect=function(e){return A(r,n,n,e)},i},diamond:function(e,t,r){var n=t.width*Math.SQRT2/2,i=t.height*Math.SQRT2/2,a=[{x:0,y:-i},{x:-n,y:0},{x:0,y:i},{x:n,y:0}],o=e.insert("polygon",":first-child").attr("points",a.map(function(e){return e.x+","+e.y}).join(" "));return r.intersect=function(e){return(0,C.k)(r,a,e)},o}};function I(){var e=function(e,t){(r=t).nodes().forEach(function(e){var t=r.node(e);i.A(t,"label")||r.children(e).length||(t.label=e),i.A(t,"paddingX")&&a.A(t,{paddingLeft:t.paddingX,paddingRight:t.paddingX}),i.A(t,"paddingY")&&a.A(t,{paddingTop:t.paddingY,paddingBottom:t.paddingY}),i.A(t,"padding")&&a.A(t,{paddingLeft:t.padding,paddingRight:t.padding,paddingTop:t.padding,paddingBottom:t.padding}),a.A(t,T),o.A(["paddingLeft","paddingRight","paddingTop","paddingBottom"],function(e){t[e]=Number(t[e])}),i.A(t,"width")&&(t._prevWidth=t.width),i.A(t,"height")&&(t._prevHeight=t.height)}),r.edges().forEach(function(e){var t=r.edge(e);i.A(t,"label")||(t.label=""),a.A(t,x)});var r,c,h=D(e,"output"),g=D(h,"clusters"),p=D(h,"edgePaths"),v=f(D(h,"edgeLabels"),t),w=b(D(h,"nodes"),t,S);(0,s.Zp)(t);function E(e){var r=t.node(e);return"translate("+r.x+","+r.y+")"}w.filter(function(){return!n.Ltv(this).classed("update")}).attr("transform",E),l.c$(w,t).style("opacity",1).attr("transform",E);function A(e){var r=t.edge(e);return i.A(r,"x")?"translate("+r.x+","+r.y+")":""}v.filter(function(){return!n.Ltv(this).classed("update")}).attr("transform",A),l.c$(v,t).style("opacity",1).attr("transform",A),y(p,t,u);var C=d(g,t),_=C.filter(function(){return!n.Ltv(this).classed("update")});function I(e){var r=t.node(e);return"translate("+r.x+","+r.y+")"}_.attr("transform",I),l.c$(C,t).style("opacity",1).attr("transform",I),l.c$(_.selectAll("rect"),t).attr("width",function(e){return t.node(e).width}).attr("height",function(e){return t.node(e).height}).attr("x",function(e){return-t.node(e).width/2}).attr("y",function(e){return-t.node(e).height/2}),c=t,o.A(c.nodes(),function(e){var t=c.node(e);i.A(t,"_prevWidth")?t.width=t._prevWidth:delete t.width,i.A(t,"_prevHeight")?t.height=t._prevHeight:delete t.height,delete t._prevWidth,delete t._prevHeight})};return e.createNodes=function(t){return arguments.length?(b=t,e):b},e.createClusters=function(t){return arguments.length?(d=t,e):d},e.createEdgeLabels=function(t){return arguments.length?(f=t,e):f},e.createEdgePaths=function(t){return arguments.length?(y=t,e):y},e.shapes=function(t){return arguments.length?(S=t,e):S},e.arrows=function(t){return arguments.length?(u=t,e):u},e}var T={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},x={arrowhead:"normal",curve:n.lUB};function D(e,t){var r=e.select("g."+t);return r.empty()&&(r=e.append("g").attr("class",t)),r}r(697)}}]);