@zyzgroup/core-web 0.0.57 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zyzgroup_core_web.iife.js +13 -13
- package/dist/zyzgroup_core_web.iife.js.map +1 -1
- package/dist/zyzgroup_core_web.js +9226 -9205
- package/dist/zyzgroup_core_web.js.map +1 -1
- package/dist/zyzgroup_core_web.umd.cjs +13 -13
- package/dist/zyzgroup_core_web.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/types/{shape → animate}/AnimateOperation.d.ts +1 -1
- package/types/animate/AnimateOperation.d.ts.map +1 -0
- package/types/animate/animateInWeb.d.ts +2 -0
- package/types/animate/animateInWeb.d.ts.map +1 -0
- package/types/animate/index.d.ts +4 -0
- package/types/animate/index.d.ts.map +1 -0
- package/types/animate/tween/Easing.d.ts.map +1 -0
- package/types/animate/tween/Group.d.ts.map +1 -0
- package/types/animate/tween/Interpolation.d.ts.map +1 -0
- package/types/animate/tween/Now.d.ts.map +1 -0
- package/types/animate/tween/Sequence.d.ts.map +1 -0
- package/types/animate/tween/Tween.d.ts.map +1 -0
- package/types/animate/tween/cubicBezierToEase.d.ts.map +1 -0
- package/types/{tween → animate/tween}/index.d.ts +1 -0
- package/types/animate/tween/index.d.ts.map +1 -0
- package/types/animate/tween/mainGroup.d.ts.map +1 -0
- package/types/{shape → canvas}/CanvasOperation.d.ts +2 -2
- package/types/canvas/CanvasOperation.d.ts.map +1 -0
- package/types/canvas/CustomCanvasContext.d.ts.map +1 -0
- package/types/canvas/index.d.ts +3 -0
- package/types/canvas/index.d.ts.map +1 -0
- package/types/dom/DOMCanvas/DOMCanvas.d.ts +1 -1
- package/types/dom/DOMCanvas/DOMCanvas.d.ts.map +1 -1
- package/types/index.d.ts +5 -3
- package/types/index.d.ts.map +1 -1
- package/types/math/Matrix.d.ts.map +1 -0
- package/types/math/Vector.d.ts.map +1 -0
- package/types/math/index.d.ts +4 -0
- package/types/math/index.d.ts.map +1 -0
- package/types/math/math.d.ts.map +1 -0
- package/types/shape/PathGroup.d.ts +2 -2
- package/types/shape/PathGroup.d.ts.map +1 -1
- package/types/shape/index.d.ts +0 -4
- package/types/shape/index.d.ts.map +1 -1
- package/types/shape/shapes/ShapeArmyAnts.d.ts +1 -1
- package/types/shape/shapes/ShapeArmyAnts.d.ts.map +1 -1
- package/types/shape/shapes/ShapeSegment.d.ts +1 -1
- package/types/shape/shapes/ShapeSegment.d.ts.map +1 -1
- package/types/shape/shapes/ShapeShip.d.ts +1 -1
- package/types/shape/shapes/ShapeShip.d.ts.map +1 -1
- package/types/shape/shapes/ShapeSlider.d.ts +1 -1
- package/types/shape/shapes/ShapeSlider.d.ts.map +1 -1
- package/types/shape/shapes/ShapeSmileFace.d.ts +1 -1
- package/types/shape/shapes/ShapeSmileFace.d.ts.map +1 -1
- package/types/shape/shapes/ShapeSpirograph.d.ts +1 -1
- package/types/shape/shapes/ShapeSpirograph.d.ts.map +1 -1
- package/types/shape/shapes/ShapeStar.d.ts +1 -1
- package/types/shape/shapes/ShapeStar.d.ts.map +1 -1
- package/types/shape/shapes/ShapeTiger.d.ts +1 -1
- package/types/shape/shapes/ShapeTiger.d.ts.map +1 -1
- package/types/shape/shapes/ShapeTree.d.ts +1 -1
- package/types/shape/shapes/ShapeTree.d.ts.map +1 -1
- package/types/shape/shapes/ShapeTriangle.d.ts +1 -1
- package/types/shape/shapes/ShapeTriangle.d.ts.map +1 -1
- package/types/shape/shapes/ShapeTriangleLight.d.ts +1 -1
- package/types/shape/shapes/ShapeTriangleLight.d.ts.map +1 -1
- package/types/{shape → svg}/SVGOperation.d.ts +2 -2
- package/types/{shape → svg}/SVGOperation.d.ts.map +1 -1
- package/types/{shape/lib → svg}/elemental.d.ts.map +1 -1
- package/types/svg/eve.d.ts.map +1 -0
- package/types/svg/index.d.ts +3 -0
- package/types/svg/index.d.ts.map +1 -0
- package/types/{shape → svg}/lib/a2c.d.ts.map +1 -1
- package/types/svg/lib/abs-svg-path.d.ts.map +1 -0
- package/types/{shape → svg}/lib/index.d.ts +1 -5
- package/types/svg/lib/index.d.ts.map +1 -0
- package/types/svg/lib/is-svg-path.d.ts.map +1 -0
- package/types/svg/lib/normalize-svg-path.d.ts.map +1 -0
- package/types/svg/lib/parse-svg-path.d.ts.map +1 -0
- package/types/svg/lib/point-at-length.d.ts.map +1 -0
- package/types/svg/lib/point-in-path.d.ts.map +1 -0
- package/types/svg/lib/point-svg-path.d.ts.map +1 -0
- package/types/svg/lib/rel-svg-path.d.ts.map +1 -0
- package/types/svg/rappar.d.ts.map +1 -0
- package/types/{shape → three}/three.d.ts.map +1 -1
- package/types/animate.d.ts +0 -2
- package/types/animate.d.ts.map +0 -1
- package/types/shape/AnimateOperation.d.ts.map +0 -1
- package/types/shape/CanvasOperation.d.ts.map +0 -1
- package/types/shape/lib/CustomCanvasContext.d.ts.map +0 -1
- package/types/shape/lib/Matrix.d.ts.map +0 -1
- package/types/shape/lib/Vector.d.ts.map +0 -1
- package/types/shape/lib/abs-svg-path.d.ts.map +0 -1
- package/types/shape/lib/eve.d.ts.map +0 -1
- package/types/shape/lib/index.d.ts.map +0 -1
- package/types/shape/lib/is-svg-path.d.ts.map +0 -1
- package/types/shape/lib/math.d.ts.map +0 -1
- package/types/shape/lib/normalize-svg-path.d.ts.map +0 -1
- package/types/shape/lib/parse-svg-path.d.ts.map +0 -1
- package/types/shape/lib/point-at-length.d.ts.map +0 -1
- package/types/shape/lib/point-in-path.d.ts.map +0 -1
- package/types/shape/lib/point-svg-path.d.ts.map +0 -1
- package/types/shape/lib/rappar.d.ts.map +0 -1
- package/types/shape/lib/rel-svg-path.d.ts.map +0 -1
- package/types/tween/Easing.d.ts.map +0 -1
- package/types/tween/Group.d.ts.map +0 -1
- package/types/tween/Interpolation.d.ts.map +0 -1
- package/types/tween/Now.d.ts.map +0 -1
- package/types/tween/Sequence.d.ts.map +0 -1
- package/types/tween/Tween.d.ts.map +0 -1
- package/types/tween/cubicBezierToEase.d.ts.map +0 -1
- package/types/tween/index.d.ts.map +0 -1
- package/types/tween/mainGroup.d.ts.map +0 -1
- /package/types/{tween → animate/tween}/Easing.d.ts +0 -0
- /package/types/{tween → animate/tween}/Group.d.ts +0 -0
- /package/types/{tween → animate/tween}/Interpolation.d.ts +0 -0
- /package/types/{tween → animate/tween}/Now.d.ts +0 -0
- /package/types/{tween → animate/tween}/Sequence.d.ts +0 -0
- /package/types/{tween → animate/tween}/Tween.d.ts +0 -0
- /package/types/{tween → animate/tween}/cubicBezierToEase.d.ts +0 -0
- /package/types/{tween → animate/tween}/mainGroup.d.ts +0 -0
- /package/types/{shape/lib → canvas}/CustomCanvasContext.d.ts +0 -0
- /package/types/{shape/lib → math}/Matrix.d.ts +0 -0
- /package/types/{shape/lib → math}/Vector.d.ts +0 -0
- /package/types/{shape/lib → math}/math.d.ts +0 -0
- /package/types/{shape/lib → svg}/elemental.d.ts +0 -0
- /package/types/{shape/lib → svg}/eve.d.ts +0 -0
- /package/types/{shape → svg}/lib/a2c.d.ts +0 -0
- /package/types/{shape → svg}/lib/abs-svg-path.d.ts +0 -0
- /package/types/{shape → svg}/lib/is-svg-path.d.ts +0 -0
- /package/types/{shape → svg}/lib/normalize-svg-path.d.ts +0 -0
- /package/types/{shape → svg}/lib/parse-svg-path.d.ts +0 -0
- /package/types/{shape → svg}/lib/point-at-length.d.ts +0 -0
- /package/types/{shape → svg}/lib/point-in-path.d.ts +0 -0
- /package/types/{shape → svg}/lib/point-svg-path.d.ts +0 -0
- /package/types/{shape → svg}/lib/rel-svg-path.d.ts +0 -0
- /package/types/{shape/lib → svg}/rappar.d.ts +0 -0
- /package/types/{shape → three}/three.d.ts +0 -0
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
|[\u{2B740}-\u{2B81D}]
|
|
8
8
|
|[\u{2B820}-\u{2CEAF}]
|
|
9
9
|
|[\u{2CEB0}-\u{2EBEF}]
|
|
10
|
-
`.replace(/\s+/g,""),"u");break;case"mime-image":t=/^image\//;break;case"mime-video":t=/^video\//;break;case"mime-audio":t=/^audio\//;break;case"mime-document-word":t=/^application\/(?:vnd\.openxmlformats-officedocument\.wordprocessingml\.document|msword|vnd\.ms-word\.document\.macroenabled\.12|vnd\.openxmlformats-officedocument\.wordprocessingml\.template|vnd\.ms-word\.template\.macroenabled\.12)$/;break;case"mime-document-excel":t=/^application\/(?:vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet|vnd\.ms-excel|vnd\.ms-excel\.sheet\.macroenabled\.12|vnd\.openxmlformats-officedocument\.spreadsheetml\.template|vnd\.ms-excel\.template\.macroenabled\.12)$/;break;case"mime-document-ppt":t=/^application\/(?:vnd\.ms-powerpoint|vnd\.openxmlformats-officedocument\.presentationml\.presentation|vnd\.ms-powerpoint\.presentation\.macroenabled\.12|vnd\.openxmlformats-officedocument\.presentationml\.template|vnd\.ms-powerpoint\.template\.macroenabled\.12)$/;break;case"mime-document-json":t=/^application\/json$/;break;case"mime-document-xml":t=/^(?:application|text)\/(?:xml|xhtml\+xml)$/;break}return t};function M1(n){const t={matchIndex:-1,fullMatch:null,groupMatchs:[]};if(n){t.matchIndex=typeof n.index=="number"?n.index:-1;for(let e=0,i=n.length;e<i;e++)e==0?t.fullMatch=n[e]:t.groupMatchs.push(n[e])}return t}const Dl=(n,t)=>{typeof n=="string"&&(n=A1(n)||new RegExp(n));const e=[],i=t.matchAll(n);for(const r of i)e.push(M1(r));return e},R1=(n=12)=>"x".repeat(n).replace(/[x]/g,t=>(Math.random()*16|0).toString(16));function Ll(n){return n.replace(/(^\w|[_-]\w)/g,function(t){return t.slice(-1).toUpperCase()})}function Il(n){let t="";for(let e=0,i=n.length;e<i;e++){const r=n.charCodeAt(e);r>=1&&r<=127?t+=n.charAt(e):r>2047?(t+=String.fromCharCode(224|r>>12&15),t+=String.fromCharCode(128|r>>6&63),t+=String.fromCharCode(128|r>>0&63)):(t+=String.fromCharCode(192|r>>6&31),t+=String.fromCharCode(128|r>>0&63))}return t}var mi=(n=>(n.UNKNOWN="",n.HTML="text/html",n.CSS="text/css",n.XML="text/xml",n.TEXT="text/plain",n.MD="text/plain",n.JPEG="image/jpeg",n.PNG="image/png",n.GIF="image/gif",n.WEBP="image/webp",n.SVG="image/svg+xml",n.ICO="image/x-icon",n.MPEG="audio/mpeg",n.MP3="audio/mpeg",n.OGG="audio/ogg",n.WAV="audio/wav",n.MP4="video/mp4",n.JSON="application/json",n.JAVASCRIPT="application/javascript",n.ECMASCRIPT="application/ecmascript",n.EXCEL="application/vnb.ms-excel",n.XWWW="application/x-www-form-urlencoded",n.DOC="application/msword",n.CSV="application/x-csv",n.PDF="application/pdf",n.ZIP="application/zip",n.TGZ="application/x-gtar",n.TAR_GZ="application/x-gzip",n.EOT="appliaction/vnd.ms-fontobject",n.TTF="aplication/font-sfnt",n))(mi||{});const $n=(n,t=16)=>(n=n.toLowerCase(),(n.indexOf("0b")==0||n.indexOf("0o")==0||n.indexOf("0x")==0)&&(n=n.slice(2)),parseInt(n,t));function D1(){const n=Uint32Array.of(305419896),t=new Uint8Array(n.buffer);switch(t[0]*16777216+t[1]*65536+t[2]*256+t[3]){case 305419896:return!1;case 2018915346:return!0}}const Ol=n=>{let t=mi.UNKNOWN;switch(new DataView(n).getUint32(0,D1()).toString(16).toUpperCase()){case"FFD8FFDB":t=mi.JPEG;break;case"FFD8FFE0":case"FFD8FFE1":case"FFD8FFE2":case"FFD8FFE3":t=mi.JPEG;break;case"89504E47":t=mi.PNG;break;case"47494638":t=mi.GIF;break;case"52494646":t=mi.WEBP;break;case"25504446":t=mi.PDF;break;case"504B0304":t=mi.ZIP;break}return t},Fl=function(){const n=[];return{writeByte(t){n.push(t&255)},writeShort(t){this.writeByte(t),this.writeByte(t>>>8)},writeBytes(t,e=0,i=t.length){for(let r=0;r<i;r++)this.writeByte(t[r+e])},writeString(t){for(let e=0,i=t.length;e<i;e++)this.writeByte(t.charCodeAt(e))},toByteArray(){return n},toString(){let t="[";for(let e=0,i=n.length;e<i;e++)e>0&&(t+=","),t+=n[e];return t+="]",t}}},L1=function(){let n=0,t=0,e=0,i="";const r=function(a){if(!(a<0)){if(a<26)return 65+a;if(a<52)return 97+(a-26);if(a<62)return 48+(a-52);if(a==62)return 43;if(a==63)return 47}throw new Error("n:"+a)},s=function(a){i+=String.fromCharCode(r(a&63))};return{writeByte(a){for(n=n<<8|a&255,t+=8,e+=1;t>=6;)s(n>>>t-6),t-=6},flush(){if(t>0&&(s(n<<6-t),n=0,t=0),e%3!=0){const a=3-e%3;for(let o=0;o<a;o++)i+="="}},toString(){return i}}};function I1(n){const t=typeof n;return t!=="object"?t:Object.prototype.toString.call(n).replace(/^\[object (\S+)\]$/,"$1").toLowerCase()}function na(n){return I1(n)==="object"}function Nl(n,t=new WeakMap){if(n==null)return n;if(n.constructor===Date)return new Date(n);if(n.constructor===RegExp)return new RegExp(n);if(typeof n!="object")return n;if(t.has(n))return t.get(n);const e=Object.getOwnPropertyDescriptors(n),i=Object.create(Object.getPrototypeOf(n),e);t.set(n,i);for(const r of Reflect.ownKeys(n))i[r]=na(n[r])?Nl(n[r],t):n[r];return i}function Gl(n,t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(na(t[e])?(typeof n[e]>"u"&&(n[e]={}),Gl(n[e],t[e])):typeof n[e]>"u"&&(n[e]=t[e]));return n}function Ul(n,t=12){return+n.toPrecision(t)}function O1(n,t){let e=+new Date,i;return function(...r){const s=+new Date;s-e<t?(clearTimeout(i),i=setTimeout(()=>{e=s,n.apply(this,r)},t)):(clearTimeout(i),e=s,n.apply(this,r))}}var xo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pe(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function St(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}),e}var Bl={exports:{}},Vn=typeof Reflect=="object"?Reflect:null,zl=Vn&&typeof Vn.apply=="function"?Vn.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},ra;Vn&&typeof Vn.ownKeys=="function"?ra=Vn.ownKeys:Object.getOwnPropertySymbols?ra=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:ra=function(t){return Object.getOwnPropertyNames(t)};function F1(n){console&&console.warn&&console.warn(n)}var $l=Number.isNaN||function(t){return t!==t};function qt(){qt.init.call(this)}Bl.exports=qt,Bl.exports.once=B1,qt.EventEmitter=qt,qt.prototype._events=void 0,qt.prototype._eventsCount=0,qt.prototype._maxListeners=void 0;var Vl=10;function sa(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(qt,"defaultMaxListeners",{enumerable:!0,get:function(){return Vl},set:function(n){if(typeof n!="number"||n<0||$l(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");Vl=n}}),qt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},qt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||$l(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Hl(n){return n._maxListeners===void 0?qt.defaultMaxListeners:n._maxListeners}qt.prototype.getMaxListeners=function(){return Hl(this)},qt.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var r=t==="error",s=this._events;if(s!==void 0)r=r&&s.error===void 0;else if(!r)return!1;if(r){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var h=s[t];if(h===void 0)return!1;if(typeof h=="function")zl(h,this,e);else for(var l=h.length,c=Wl(h,l),i=0;i<l;++i)zl(c[i],this,e);return!0};function jl(n,t,e,i){var r,s,a;if(sa(e),s=n._events,s===void 0?(s=n._events=Object.create(null),n._eventsCount=0):(s.newListener!==void 0&&(n.emit("newListener",t,e.listener?e.listener:e),s=n._events),a=s[t]),a===void 0)a=s[t]=e,++n._eventsCount;else if(typeof a=="function"?a=s[t]=i?[e,a]:[a,e]:i?a.unshift(e):a.push(e),r=Hl(n),r>0&&a.length>r&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=n,o.type=t,o.count=a.length,F1(o)}return n}qt.prototype.addListener=function(t,e){return jl(this,t,e,!1)},qt.prototype.on=qt.prototype.addListener,qt.prototype.prependListener=function(t,e){return jl(this,t,e,!0)};function N1(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Xl(n,t,e){var i={fired:!1,wrapFn:void 0,target:n,type:t,listener:e},r=N1.bind(i);return r.listener=e,i.wrapFn=r,r}qt.prototype.once=function(t,e){return sa(e),this.on(t,Xl(this,t,e)),this},qt.prototype.prependOnceListener=function(t,e){return sa(e),this.prependListener(t,Xl(this,t,e)),this},qt.prototype.removeListener=function(t,e){var i,r,s,a,o;if(sa(e),r=this._events,r===void 0)return this;if(i=r[t],i===void 0)return this;if(i===e||i.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,i.listener||e));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===e||i[a].listener===e){o=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():G1(i,s),i.length===1&&(r[t]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",t,o||e)}return this},qt.prototype.off=qt.prototype.removeListener,qt.prototype.removeAllListeners=function(t){var e,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var s=Object.keys(i),a;for(r=0;r<s.length;++r)a=s[r],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=i[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this};function Yl(n,t,e){var i=n._events;if(i===void 0)return[];var r=i[t];return r===void 0?[]:typeof r=="function"?e?[r.listener||r]:[r]:e?U1(r):Wl(r,r.length)}qt.prototype.listeners=function(t){return Yl(this,t,!0)},qt.prototype.rawListeners=function(t){return Yl(this,t,!1)},qt.listenerCount=function(n,t){return typeof n.listenerCount=="function"?n.listenerCount(t):ql.call(n,t)},qt.prototype.listenerCount=ql;function ql(n){var t=this._events;if(t!==void 0){var e=t[n];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}qt.prototype.eventNames=function(){return this._eventsCount>0?ra(this._events):[]};function Wl(n,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=n[i];return e}function G1(n,t){for(;t+1<n.length;t++)n[t]=n[t+1];n.pop()}function U1(n){for(var t=new Array(n.length),e=0;e<t.length;++e)t[e]=n[e].listener||n[e];return t}function B1(n,t){return new Promise(function(e,i){function r(a){n.removeListener(t,s),i(a)}function s(){typeof n.removeListener=="function"&&n.removeListener("error",r),e([].slice.call(arguments))}Kl(n,t,s,{once:!0}),t!=="error"&&z1(n,r,{once:!0})})}function z1(n,t,e){typeof n.on=="function"&&Kl(n,"error",t,e)}function Kl(n,t,e,i){if(typeof n.on=="function")i.once?n.once(t,e):n.on(t,e);else if(typeof n.addEventListener=="function")n.addEventListener(t,function r(s){i.once&&n.removeEventListener(t,r),e(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}class Zl{events;constructor(){this.events={}}on(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e)}addListener(t,e){this.on(t,e)}prependListener(t,e){this.events[t]||(this.events[t]=[]),this.events[t].unshift(e)}removeListener(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(i=>i!==e))}off(t,e){this.removeListener(t,e)}removeAllListeners(t){t?this.events[t]=[]:this.events={}}emit(t,...e){this.events[t]&&this.events[t].forEach(i=>{Reflect.apply(i,this,e)})}once(t,e){const r=(()=>{let s=!1;return(...a)=>{s||(s=!0,Reflect.apply(e,this,a),this.off(t,r))}})();this.on(t,r)}}var Jl=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function $1(n,t={}){var e=1,i=1;function r(nt){var J=nt.match(/\n/g);J&&(e+=J.length);var I=nt.lastIndexOf(`
|
|
11
|
-
`);i=~I?nt.length-I:i+nt.length}function s(){var nt={line:e,column:i};return function(J){return J.position=new a(nt),m(),J}}function a(nt){this.start=nt,this.end={line:e,column:i},this.source=t.source}a.prototype.content=n;var o=[];function h(nt){var J=new Error(t.source+":"+e+":"+i+": "+nt);if(J.reason=nt,J.filename=t.source,J.line=e,J.column=i,J.source=n,t.silent)o.push(J);else throw J}function l(){var nt=f();return{type:"stylesheet",stylesheet:{source:t.source,rules:nt,parsingErrors:o}}}function c(){return u(/^{\s*/)}function d(){return u(/^}/)}function f(){var nt,J=[];for(m(),v(J);n.length&&n.charAt(0)!="}"&&(nt=_t()||pt());)nt!==!1&&(J.push(nt),v(J));return J}function u(nt){var J=nt.exec(n);if(J){var I=J[0];return r(I),n=n.slice(I.length),J}}function m(){u(/^\s*/)}function v(nt){var J;for(nt=nt||[];J=b();)J!==!1&&nt.push(J);return nt}function b(){var nt=s();if(!(n.charAt(0)!="/"||n.charAt(1)!="*")){for(var J=2;n.charAt(J)!=""&&(n.charAt(J)!="*"||n.charAt(J+1)!="/");)++J;if(J+=2,n.charAt(J-1)==="")return h("End of comment missing");var I=n.slice(2,J-2);return i+=2,r(I),n=n.slice(J),i+=2,nt({type:"comment",comment:I})}}function S(){var nt=u(/^([^{]+)/);if(nt)return vi(nt[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(J){return J.replace(/,/g,"")}).split(/\s*(?![^(]*\)),\s*/).map(function(J){return J.replace(/\u200C/g,",")})}function E(){var nt=s(),J=u(/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(J){if(J=vi(J[0]),!u(/^:\s*/))return h("property missing ':'");var I=u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/),D=nt({type:"declaration",property:J.replace(Jl,""),value:I?vi(I[0]).replace(Jl,""):""});return u(/^[;\s]*/),D}}function _(){var nt=[];if(!c())return h("missing '{'");v(nt);for(var J;J=E();)J!==!1&&(nt.push(J),v(nt));return d()?nt:h("missing '}'")}function x(){for(var nt,J=[],I=s();nt=u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)J.push(nt[1]),u(/^,\s*/);if(J.length)return I({type:"keyframe",values:J,declarations:_()})}function P(){var nt=s(),J=u(/^@([-\w]+)?keyframes\s*/);if(J){var I=J[1];if(J=u(/^([-\w]+)\s*/),!J)return h("@keyframes missing name");var D=J[1];if(!c())return h("@keyframes missing '{'");for(var A,B=v();A=x();)B.push(A),B=B.concat(v());return d()?nt({type:"keyframes",name:D,vendor:I,keyframes:B}):h("@keyframes missing '}'")}}function R(){var nt=s(),J=u(/^@supports *([^{]+)/);if(J){var I=vi(J[1]);if(!c())return h("@supports missing '{'");var D=v().concat(f());return d()?nt({type:"supports",supports:I,rules:D}):h("@supports missing '}'")}}function F(){var nt=s(),J=u(/^@host\s*/);if(J){if(!c())return h("@host missing '{'");var I=v().concat(f());return d()?nt({type:"host",rules:I}):h("@host missing '}'")}}function L(){var nt=s(),J=u(/^@media *([^{]+)/);if(J){var I=vi(J[1]);if(!c())return h("@media missing '{'");var D=v().concat(f());return d()?nt({type:"media",media:I,rules:D}):h("@media missing '}'")}}function $(){var nt=s(),J=u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(J)return nt({type:"custom-media",name:vi(J[1]),media:vi(J[2])})}function U(){var nt=s(),J=u(/^@page */);if(J){var I=S()||[];if(!c())return h("@page missing '{'");for(var D=v(),A;A=E();)D.push(A),D=D.concat(v());return d()?nt({type:"page",selectors:I,declarations:D}):h("@page missing '}'")}}function z(){var nt=s(),J=u(/^@([-\w]+)?document *([^{]+)/);if(J){var I=vi(J[1]),D=vi(J[2]);if(!c())return h("@document missing '{'");var A=v().concat(f());return d()?nt({type:"document",document:D,vendor:I,rules:A}):h("@document missing '}'")}}function q(){var nt=s(),J=u(/^@font-face\s*/);if(J){if(!c())return h("@font-face missing '{'");for(var I=v(),D;D=E();)I.push(D),I=I.concat(v());return d()?nt({type:"font-face",declarations:I}):h("@font-face missing '}'")}}var K=vt("import"),Z=vt("charset"),at=vt("namespace");function vt(nt){var J=new RegExp("^@"+nt+"\\s*([^;]+);");return function(){var I=s(),D=u(J);if(D){var A={type:nt};return A[nt]=D[1].trim(),I(A)}}}function _t(){if(n[0]=="@")return P()||L()||$()||R()||K()||Z()||at()||z()||U()||F()||q()}function pt(){var nt=s(),J=S();return J?(v(),nt({type:"rule",selectors:J,declarations:_()})):h("selector missing")}return So(l())}function vi(n){return n?n.replace(/^\s+|\s+$/g,""):""}function So(n,t){var e=n&&typeof n.type=="string",i=e?n:t;for(var r in n){var s=n[r];Array.isArray(s)?s.forEach(function(a){So(a,i)}):s&&typeof s=="object"&&So(s,i)}return e&&Object.defineProperty(n,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),n}const Co=(n,t="image/svg+xml",e="utf-8")=>new Blob([n],{type:`${t};charset=${e}`}),Ql=n=>new XMLSerializer().serializeToString(n),V1=(n,t="text/html")=>new DOMParser().parseFromString(n,t),tc=(n,t="image/svg+xml",e="utf-8")=>Co(Ql(n),t,e),To=(n,t)=>{const e=document.createElement("a");e.style.visibility="hidden",document.body.appendChild(e),e.download=t,typeof n=="string"?e.href=n:e.href=window.URL.createObjectURL(n),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)};function ec(n=["*"],t){if(!globalThis.document||!(globalThis.document instanceof Document))throw new Error("This is not a browser environment");const e=globalThis.document.createElement("input");return e.setAttribute("type","file"),e.setAttribute("visibility","hidden"),Array.isArray(n)&&n.length>0&&e.setAttribute("accept",n.join(",")),t&&e.setAttribute("multiple","true"),e.click(),new Promise((i,r)=>{globalThis.addEventListener("focus",()=>{setTimeout(()=>{(!e.files||e.files?.length===0)&&r(new Error("Cancel select"))},1e3)},{once:!0}),e.addEventListener("change",()=>{if(!e.files||e.files?.length===0)r(new Error("Cancel select"));else{const s=Array.from(e.files);!n.includes("*")&&s.some(a=>!n.includes(`.${nc(a)}`))&&r(new Error(`Please select files in ${n} format`)),i(s)}})})}function ko(n,t="text",e){return new Promise((i,r)=>{const s=new FileReader;switch(s.addEventListener("progress",a=>{e?.(a.loaded,a.total)}),s.addEventListener("load",a=>{i(a.target?.result)}),s.addEventListener("error",a=>{r(a)}),t){case"dataURL":s.readAsDataURL(n);break;case"binaryString":s.readAsBinaryString(n);break;case"arrayBuffer":s.readAsArrayBuffer(n);break;default:s.readAsText(n)}})}function ic(n,t,e){return ko(n.slice(t,e),"arrayBuffer")}async function H1(n){const t=await ic(n,0,4);return Ol(t)}const nc=n=>{let t;return n instanceof File?t=n.name:t=n,t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i)?.[1]??""};function j1(n,t){n.addEventListener("change",function(){t(n.files)},!1)}function X1(n,t){n.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},!1),n.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&t(e.dataTransfer.files)},!1)}function Y1(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(t=>setTimeout(()=>{throw t}))}function q1(n,t={},e=[]){return{tag:n,props:t,children:e}}function kr(n,t){if(n.el)return;const e=n.el=document.createElement(n.tag);if(n.props)for(const i in n.props){const r=n.props[i];i.startsWith("on")?e.addEventListener(i.slice(2).toLowerCase(),r):e.setAttribute(i,r)}n.children&&(typeof n.children=="string"?e.textContent=n.children:n.children.forEach(i=>{kr(i,e)})),t.appendChild(e)}function rc(n,t){if(n.tag!==t.tag){if(!n.el)return;const e=n.el.parentElement||document.body;e.removeChild(n.el),kr(t,e)}else{const e=t.el=n.el;if(!e)return;const i=n.props,r=t.props;for(const o in i)o in r||(o.startsWith("on")?e.removeEventListener(o.slice(2).toLowerCase(),i[o]):e.removeAttribute(o));for(const o in r){const h=i[o],l=r[o];l!=h&&(o.startsWith("on")?e.addEventListener(o.slice(2).toLowerCase(),l):e.setAttribute(o,l))}const s=n.children||[],a=t.children||[];if(typeof a=="string")e.innerHTML=a;else if(typeof s=="string")e.innerHTML="",a.forEach(o=>{kr(o,e)});else{const o=Math.min(s.length,a.length);for(let h=0;h<o;h++)rc(s[h],a[h]);a.length>s.length&&a.slice(s.length).forEach(h=>{kr(h,e)}),a.length<s.length&&s.slice(a.length).forEach(h=>{h.el&&e.removeChild(h.el)})}}}function sc(n,t,e){if(!n){e&&t&&e.appendChild(t);return}if(!n.isEqualNode(t)){if(n.nodeName!==t.nodeName){e.replaceChild(t,n);return}if(n.nodeType===Node.TEXT_NODE){n.textContent!==t.textContent&&(n.textContent=t.textContent);return}for(let i=n.attributes.length-1;i>=0;i--){const r=n.attributes[i].name;!t.hasAttribute(r)&&r!=="open"&&n.removeAttribute(r)}for(let i=0;i<t.attributes.length;i++){const r=t.attributes[i].name,s=t.attributes[i].value;n.setAttribute(r,s)}for(let i=0;i<t.childNodes.length;i++)n.childNodes[i]?sc(n.childNodes[i],t.childNodes[i],n):n.appendChild(t.childNodes[i].cloneNode(!0));for(;n.childNodes.length>t.childNodes.length;)n.lastChild&&n.removeChild(n.lastChild)}}class W1{url;socket;waitingResponse={};sendMessageQueue=[];constructor(t){this.url=t,this.createSocket()}createSocket(){console.log("Socket Create Attempted"),this.socket=new WebSocket(this.url),this.socket.onopen=()=>{this.sendMessageQueue.forEach(t=>this.socket?.send(t)),this.sendMessageQueue=[]},this.socket.onclose=t=>{const{code:e,reason:i,wasClean:r}=t;console.log(`ws closed : ${e} ${i} ${r}`)},this.socket.onerror=t=>{console.log(`ws error : ${t.type}`)},this.socket.onmessage=t=>{this.processMessage(t)}}recreateSocket(t){console.log("Socket Recreate Attempted"),this.sendMessageQueue.push(t),this.createSocket()}closeSocket(){this.socket&&(this.socket.close(),console.log("Socket closed"))}openSocket(){this.createSocket(),console.log("Socket opened manually")}sendWithRetry(t){this.socket?.readyState===WebSocket.OPEN?this.socket.send(t):this.recreateSocket(t)}async processMessage(t){if(typeof t.data=="string")try{const e=JSON.parse(t.data);if(Object.prototype.hasOwnProperty.call(e,"requestid")){const i=this.waitingResponse[e.requestid];i?i.resolve?.(e):console.warn("Got data but found no associated request, already timed out?",e)}else console.warn("Got data without request id",e)}catch{console.log(`Received String : ${t.data}`)}else t.data instanceof ArrayBuffer?console.log(`Received ArrayBuffer : ${t.data}`):t.data instanceof Blob&&console.log(`Received Blob : ${t.data}`)}async sendPayload(t){const e=+new Date,i=this.waitingResponse[e]={requestid:e};try{let r;t instanceof Blob||t instanceof ArrayBuffer||typeof t=="string"?r=t:r=JSON.stringify({...i,...t});const s=await new Promise((a,o)=>{i.resolve=a,this.sendWithRetry(r),setTimeout(()=>{o("Timeout")},5e3)});return console.info("Time took",(+new Date-i.requestid)/1e3),s}catch(r){return Promise.reject(r)}finally{delete this.waitingResponse[e]}}async send(t,e,i=r=>{console.log(r)}){this.sendPayload(t).then(e,i)}}function Eo(){return document.compatMode=="BackCompat"?document.body:document.documentElement}function Hn(){const n=Eo();return{scrollTop:n.scrollTop,scrollLeft:n.scrollLeft,scrollWidth:n.scrollWidth,scrollHeight:n.scrollHeight}}function aa(){const n=Eo();return{clientTop:n.clientTop,clientLeft:n.clientLeft,clientWidth:n.clientWidth,clientHeight:n.clientHeight}}function oa(){const{clientWidth:n,clientHeight:t}=aa();return{width:n,height:t}}function K1(){const{scrollWidth:n,scrollHeight:t}=Hn(),{width:e,height:i}=oa();return{width:Math.max(n,e),height:Math.max(t,i)}}function Z1(n){const{width:t,height:e}=oa(),{top:i,left:r,right:s,bottom:a}=n.getBoundingClientRect();return(i>=0&&i<=e||a>=0&&a<=e)&&(r>=0&&r<=t||s>=0&&s<=t)}function J1(n,t,e){const i={threshold:1};new IntersectionObserver(function(s,a){let o=s[0];if(s.length>1){const l=s.find(c=>c.isIntersecting);l&&(o=l)}o.isIntersecting&&o.intersectionRatio>=i.threshold?t(o.target):e?.(o.target)},i).observe(n)}function ac(n){const{top:t,left:e}=n.getBoundingClientRect(),i=Hn();return{x:e+i.scrollLeft,y:t+i.scrollTop}}function Q1(n){return{x:oc(n),y:hc(n)}}function oc(n){let t=0;for(;n!==null;)t+=n.offsetLeft,n=n.offsetParent;return t}function hc(n){let t=0;for(;n!==null;)t+=n.offsetTop,n=n.offsetParent;return t}function tg(n){const t=n.getBoundingClientRect();return{x:t.left,y:t.top}}function eg(n,t){const e=n.getBoundingClientRect(),i=t.getBoundingClientRect();return{x:i.x-e.x,y:i.y-e.y,width:i.width,height:i.height}}function lc(n){if(n.pageX&&n.pageY)return{x:n.pageX,y:n.pageY};const t=Hn();return{x:n.clientX+t.scrollLeft,y:n.clientY+t.scrollTop}}function ig(n){return{x:n.clientX,y:n.clientY}}function ze(n,t){const e=lc(t),i=ac(n);return{x:e.x-i.x,y:e.y-i.y}}function Po(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}const ha=()=>{const n=navigator.userAgent.toLowerCase();let t="Unknown";return/mac/i.test(n)?t="macOS":/win/i.test(n)?t="Windows":/android/i.test(n)?t="Android":/iphone|ipad|ipod/i.test(n)?t="iOS":/linux/i.test(n)?t="Linux":/bsd/i.test(n)&&(t="BSD"),t.toLowerCase()},ng=()=>{const n=navigator.userAgent;let t="Unknown";if(/Windows NT/.test(n)){const e=n.match(/Windows NT (\d+\.\d+)/);e&&(t=e[1])}else if(/Mac OS X/.test(n)){const e=n.match(/Mac OS X (\d+_\d+)/);e&&(t=e[1].replace("_","."))}else if(/Android/.test(n)){const e=n.match(/Android (\d+\.\d+)/);e&&(t=e[1])}else if(/iPhone|iPad|iPod/.test(n)){const e=n.match(/OS (\d+_\d+)/);e&&(t=e[1].replace("_","."))}return t.toLowerCase()},Ao=()=>{const n=navigator.userAgent.toLowerCase();let t="Unknown";return/chrome/i.test(n)?t="Chrome":/firefox/i.test(n)?t="Firefox":/safari/i.test(n)?t="Safari":/edge/i.test(n)?t="Edge":/msie|trident/i.test(n)?t="IE":/MicroMessenger/i.test(n)?t="Wechat":/alipay/i.test(n)&&(t="Ali"),t.toLowerCase()},rg=()=>{const n=navigator.userAgent;let t="Unknown";if(/Chrome/.test(n)){const e=n.match(/Chrome\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Firefox/.test(n)){const e=n.match(/Firefox\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Safari/.test(n)){const e=n.match(/Version\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Edge/.test(n)){const e=n.match(/Edge\/(\d+\.\d+)/);e&&(t=e[1])}else if(/MSIE|Trident/.test(n)){const e=n.match(/(?:MSIE|rv:)(\d+\.\d+)/);e&&(t=e[1])}return t},sg=()=>"geolocation"in navigator?new Promise((n,t)=>{navigator.geolocation.getCurrentPosition(e=>{const i=e.coords.latitude,r=e.coords.longitude;n({latitude:i,longitude:r})},e=>{t(e)})}):Promise.reject("Geolocation is not available.");function ag(){return(navigator.browserLanguage||navigator.language).toLowerCase()}function og(){return Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase()}function Mo(){return ha()==="ios"}function Ro(){return ha()==="macos"}function hg(){return Mo()|Ro()}function cc(){return ha()==="android"}function lg(){return Mo()||cc()}function cg(){return typeof window=="object"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function uc(){const n=window.navigator.userAgent,t=n.indexOf("MSIE ");if(t>0)return parseInt(n.substring(t+5,n.indexOf(".",t)),10);if(n.indexOf("Trident/")>0){const r=n.indexOf("rv:");return parseInt(n.substring(r+3,n.indexOf(".",r)),10)}const i=n.indexOf("Edge/");return i>0?parseInt(n.substring(i+5,n.indexOf(".",i)),10):-1}function fc(){return Ao()==="wechat"}function dc(){return Ao()==="ali"}function ug(){return fc()&&navigator.userAgent.match(/miniprogram/i)||window.__wxjs_environment==="miniprogram"}function fg(){return dc()&&navigator.userAgent.match(/miniprogram/i)}const dg=uc()!==-1,gg=typeof document<"u",gc=typeof window<"u",pg=typeof history<"u",mg=gc&&window.File&&window.FileReader&&window.FileList&&window.Blob,pc=(()=>{const n=Po();return!!(n.Worker&&n.Blob&&n.Promise&&n.OffscreenCanvas&&n.OffscreenCanvasRenderingContext2D&&n.HTMLCanvasElement&&n.HTMLCanvasElement.prototype.transferControlToOffscreen&&n.URL&&n.URL.createObjectURL)})(),vg=typeof Path2D=="function"&&typeof DOMMatrix=="function",_g=function(){if(!Po().OffscreenCanvas)return!1;var t=new OffscreenCanvas(1,1),e=t.getContext("2d");e.fillRect(0,0,1,1);var i=t.transferToImageBitmap();try{e.createPattern(i,"no-repeat")}catch{return!1}return!0}();function yg(n,t){let e=n[t];Object.defineProperty(n,"prop",{get:()=>e,set:i=>{e=i;debugger}})}function wg(n){return new Proxy(n,{get(t,e,i){return Reflect.get(t,e,i)},set(t,e,i,r){debugger;return Reflect.set(t,e,i,r)}})}function bg(n){var t=document.documentElement,e=window.top===window.self?window.devicePixelRatio:1;t.dataset.dpr=e;var i=100,r=function(){var s=Math.min(t.clientWidth,n);t.dataset.width=s,t.dataset.rem=i=Math.round(100*(s/n)),t.style.fontSize=i+"px"};r(),window.rem2px=function(s){return s=parseFloat(s),s*i},window.px2rem=function(s){return s=parseFloat(s),s/i},window.addEventListener&&window.addEventListener("orientationchange"in window?"orientationchange":"resize",r,!1)}class It{static onDocumentReady(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}static getCSSVar(t){return getComputedStyle(document.documentElement).getPropertyValue(t)}static setCSSVar(t,e){document.documentElement.style.setProperty(t,e)}static safeExec(t){const e=new Proxy(window,{get(i,r,s){if(typeof r=="string"&&["open","location","document"].includes(r))throw new Error(`禁止访问 key: ${r}`);return r==="window"?e:Reflect.get(i,r,s)},set(i,r,s,a){return Reflect.set(i,r,s,a)}});new Function("window",`with(window) { ${t} }`)(e,null)}static dom=new Proxy({},{get(t,e){return function(i={},...r){const s=document.createElement(e);for(const a of Object.keys(i))s.setAttribute(a,i[a]);for(const a of r)typeof a=="string"?s.appendChild(document.createTextNode(a)):s.appendChild(a);return s}}});static compileTemplate(t){return t=t.replace(/<%=(.+?)%>/g,"`); \n echo( $1 ); \n echo(`").replace(/<%([\s\S]+?)%>/g,"`); \n $1 \n echo(`"),t="echo(`"+t+"`);",`(function parse(data){
|
|
10
|
+
`.replace(/\s+/g,""),"u");break;case"mime-image":t=/^image\//;break;case"mime-video":t=/^video\//;break;case"mime-audio":t=/^audio\//;break;case"mime-document-word":t=/^application\/(?:vnd\.openxmlformats-officedocument\.wordprocessingml\.document|msword|vnd\.ms-word\.document\.macroenabled\.12|vnd\.openxmlformats-officedocument\.wordprocessingml\.template|vnd\.ms-word\.template\.macroenabled\.12)$/;break;case"mime-document-excel":t=/^application\/(?:vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet|vnd\.ms-excel|vnd\.ms-excel\.sheet\.macroenabled\.12|vnd\.openxmlformats-officedocument\.spreadsheetml\.template|vnd\.ms-excel\.template\.macroenabled\.12)$/;break;case"mime-document-ppt":t=/^application\/(?:vnd\.ms-powerpoint|vnd\.openxmlformats-officedocument\.presentationml\.presentation|vnd\.ms-powerpoint\.presentation\.macroenabled\.12|vnd\.openxmlformats-officedocument\.presentationml\.template|vnd\.ms-powerpoint\.template\.macroenabled\.12)$/;break;case"mime-document-json":t=/^application\/json$/;break;case"mime-document-xml":t=/^(?:application|text)\/(?:xml|xhtml\+xml)$/;break}return t};function M1(n){const t={matchIndex:-1,fullMatch:null,groupMatchs:[]};if(n){t.matchIndex=typeof n.index=="number"?n.index:-1;for(let e=0,i=n.length;e<i;e++)e==0?t.fullMatch=n[e]:t.groupMatchs.push(n[e])}return t}const Dl=(n,t)=>{typeof n=="string"&&(n=A1(n)||new RegExp(n));const e=[],i=t.matchAll(n);for(const r of i)e.push(M1(r));return e},R1=(n=12)=>"x".repeat(n).replace(/[x]/g,t=>(Math.random()*16|0).toString(16));function Ll(n){return n.replace(/(^\w|[_-]\w)/g,function(t){return t.slice(-1).toUpperCase()})}function Il(n){let t="";for(let e=0,i=n.length;e<i;e++){const r=n.charCodeAt(e);r>=1&&r<=127?t+=n.charAt(e):r>2047?(t+=String.fromCharCode(224|r>>12&15),t+=String.fromCharCode(128|r>>6&63),t+=String.fromCharCode(128|r>>0&63)):(t+=String.fromCharCode(192|r>>6&31),t+=String.fromCharCode(128|r>>0&63))}return t}var mi=(n=>(n.UNKNOWN="",n.HTML="text/html",n.CSS="text/css",n.XML="text/xml",n.TEXT="text/plain",n.MD="text/plain",n.JPEG="image/jpeg",n.PNG="image/png",n.GIF="image/gif",n.WEBP="image/webp",n.SVG="image/svg+xml",n.ICO="image/x-icon",n.MPEG="audio/mpeg",n.MP3="audio/mpeg",n.OGG="audio/ogg",n.WAV="audio/wav",n.MP4="video/mp4",n.JSON="application/json",n.JAVASCRIPT="application/javascript",n.ECMASCRIPT="application/ecmascript",n.EXCEL="application/vnb.ms-excel",n.XWWW="application/x-www-form-urlencoded",n.DOC="application/msword",n.CSV="application/x-csv",n.PDF="application/pdf",n.ZIP="application/zip",n.TGZ="application/x-gtar",n.TAR_GZ="application/x-gzip",n.EOT="appliaction/vnd.ms-fontobject",n.TTF="aplication/font-sfnt",n))(mi||{});const $n=(n,t=16)=>(n=n.toLowerCase(),(n.indexOf("0b")==0||n.indexOf("0o")==0||n.indexOf("0x")==0)&&(n=n.slice(2)),parseInt(n,t));function D1(){const n=Uint32Array.of(305419896),t=new Uint8Array(n.buffer);switch(t[0]*16777216+t[1]*65536+t[2]*256+t[3]){case 305419896:return!1;case 2018915346:return!0}}const Fl=n=>{let t=mi.UNKNOWN;switch(new DataView(n).getUint32(0,D1()).toString(16).toUpperCase()){case"FFD8FFDB":t=mi.JPEG;break;case"FFD8FFE0":case"FFD8FFE1":case"FFD8FFE2":case"FFD8FFE3":t=mi.JPEG;break;case"89504E47":t=mi.PNG;break;case"47494638":t=mi.GIF;break;case"52494646":t=mi.WEBP;break;case"25504446":t=mi.PDF;break;case"504B0304":t=mi.ZIP;break}return t},Ol=function(){const n=[];return{writeByte(t){n.push(t&255)},writeShort(t){this.writeByte(t),this.writeByte(t>>>8)},writeBytes(t,e=0,i=t.length){for(let r=0;r<i;r++)this.writeByte(t[r+e])},writeString(t){for(let e=0,i=t.length;e<i;e++)this.writeByte(t.charCodeAt(e))},toByteArray(){return n},toString(){let t="[";for(let e=0,i=n.length;e<i;e++)e>0&&(t+=","),t+=n[e];return t+="]",t}}},L1=function(){let n=0,t=0,e=0,i="";const r=function(a){if(!(a<0)){if(a<26)return 65+a;if(a<52)return 97+(a-26);if(a<62)return 48+(a-52);if(a==62)return 43;if(a==63)return 47}throw new Error("n:"+a)},s=function(a){i+=String.fromCharCode(r(a&63))};return{writeByte(a){for(n=n<<8|a&255,t+=8,e+=1;t>=6;)s(n>>>t-6),t-=6},flush(){if(t>0&&(s(n<<6-t),n=0,t=0),e%3!=0){const a=3-e%3;for(let o=0;o<a;o++)i+="="}},toString(){return i}}};function I1(n){const t=typeof n;return t!=="object"?t:Object.prototype.toString.call(n).replace(/^\[object (\S+)\]$/,"$1").toLowerCase()}function na(n){return I1(n)==="object"}function Nl(n,t=new WeakMap){if(n==null)return n;if(n.constructor===Date)return new Date(n);if(n.constructor===RegExp)return new RegExp(n);if(typeof n!="object")return n;if(t.has(n))return t.get(n);const e=Object.getOwnPropertyDescriptors(n),i=Object.create(Object.getPrototypeOf(n),e);t.set(n,i);for(const r of Reflect.ownKeys(n))i[r]=na(n[r])?Nl(n[r],t):n[r];return i}function Gl(n,t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(na(t[e])?(typeof n[e]>"u"&&(n[e]={}),Gl(n[e],t[e])):typeof n[e]>"u"&&(n[e]=t[e]));return n}function Ul(n,t=12){return+n.toPrecision(t)}function F1(n,t){let e=+new Date,i;return function(...r){const s=+new Date;s-e<t?(clearTimeout(i),i=setTimeout(()=>{e=s,n.apply(this,r)},t)):(clearTimeout(i),e=s,n.apply(this,r))}}var xo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pe(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function St(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}),e}var Bl={exports:{}},Vn=typeof Reflect=="object"?Reflect:null,zl=Vn&&typeof Vn.apply=="function"?Vn.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},ra;Vn&&typeof Vn.ownKeys=="function"?ra=Vn.ownKeys:Object.getOwnPropertySymbols?ra=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:ra=function(t){return Object.getOwnPropertyNames(t)};function O1(n){console&&console.warn&&console.warn(n)}var $l=Number.isNaN||function(t){return t!==t};function qt(){qt.init.call(this)}Bl.exports=qt,Bl.exports.once=B1,qt.EventEmitter=qt,qt.prototype._events=void 0,qt.prototype._eventsCount=0,qt.prototype._maxListeners=void 0;var Vl=10;function sa(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(qt,"defaultMaxListeners",{enumerable:!0,get:function(){return Vl},set:function(n){if(typeof n!="number"||n<0||$l(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");Vl=n}}),qt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},qt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||$l(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Hl(n){return n._maxListeners===void 0?qt.defaultMaxListeners:n._maxListeners}qt.prototype.getMaxListeners=function(){return Hl(this)},qt.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var r=t==="error",s=this._events;if(s!==void 0)r=r&&s.error===void 0;else if(!r)return!1;if(r){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var h=s[t];if(h===void 0)return!1;if(typeof h=="function")zl(h,this,e);else for(var l=h.length,c=Wl(h,l),i=0;i<l;++i)zl(c[i],this,e);return!0};function jl(n,t,e,i){var r,s,a;if(sa(e),s=n._events,s===void 0?(s=n._events=Object.create(null),n._eventsCount=0):(s.newListener!==void 0&&(n.emit("newListener",t,e.listener?e.listener:e),s=n._events),a=s[t]),a===void 0)a=s[t]=e,++n._eventsCount;else if(typeof a=="function"?a=s[t]=i?[e,a]:[a,e]:i?a.unshift(e):a.push(e),r=Hl(n),r>0&&a.length>r&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=n,o.type=t,o.count=a.length,O1(o)}return n}qt.prototype.addListener=function(t,e){return jl(this,t,e,!1)},qt.prototype.on=qt.prototype.addListener,qt.prototype.prependListener=function(t,e){return jl(this,t,e,!0)};function N1(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Xl(n,t,e){var i={fired:!1,wrapFn:void 0,target:n,type:t,listener:e},r=N1.bind(i);return r.listener=e,i.wrapFn=r,r}qt.prototype.once=function(t,e){return sa(e),this.on(t,Xl(this,t,e)),this},qt.prototype.prependOnceListener=function(t,e){return sa(e),this.prependListener(t,Xl(this,t,e)),this},qt.prototype.removeListener=function(t,e){var i,r,s,a,o;if(sa(e),r=this._events,r===void 0)return this;if(i=r[t],i===void 0)return this;if(i===e||i.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,i.listener||e));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===e||i[a].listener===e){o=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():G1(i,s),i.length===1&&(r[t]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",t,o||e)}return this},qt.prototype.off=qt.prototype.removeListener,qt.prototype.removeAllListeners=function(t){var e,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var s=Object.keys(i),a;for(r=0;r<s.length;++r)a=s[r],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=i[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this};function Yl(n,t,e){var i=n._events;if(i===void 0)return[];var r=i[t];return r===void 0?[]:typeof r=="function"?e?[r.listener||r]:[r]:e?U1(r):Wl(r,r.length)}qt.prototype.listeners=function(t){return Yl(this,t,!0)},qt.prototype.rawListeners=function(t){return Yl(this,t,!1)},qt.listenerCount=function(n,t){return typeof n.listenerCount=="function"?n.listenerCount(t):ql.call(n,t)},qt.prototype.listenerCount=ql;function ql(n){var t=this._events;if(t!==void 0){var e=t[n];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}qt.prototype.eventNames=function(){return this._eventsCount>0?ra(this._events):[]};function Wl(n,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=n[i];return e}function G1(n,t){for(;t+1<n.length;t++)n[t]=n[t+1];n.pop()}function U1(n){for(var t=new Array(n.length),e=0;e<t.length;++e)t[e]=n[e].listener||n[e];return t}function B1(n,t){return new Promise(function(e,i){function r(a){n.removeListener(t,s),i(a)}function s(){typeof n.removeListener=="function"&&n.removeListener("error",r),e([].slice.call(arguments))}Kl(n,t,s,{once:!0}),t!=="error"&&z1(n,r,{once:!0})})}function z1(n,t,e){typeof n.on=="function"&&Kl(n,"error",t,e)}function Kl(n,t,e,i){if(typeof n.on=="function")i.once?n.once(t,e):n.on(t,e);else if(typeof n.addEventListener=="function")n.addEventListener(t,function r(s){i.once&&n.removeEventListener(t,r),e(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}class Zl{events;constructor(){this.events={}}on(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e)}addListener(t,e){this.on(t,e)}prependListener(t,e){this.events[t]||(this.events[t]=[]),this.events[t].unshift(e)}removeListener(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(i=>i!==e))}off(t,e){this.removeListener(t,e)}removeAllListeners(t){t?this.events[t]=[]:this.events={}}emit(t,...e){this.events[t]&&this.events[t].forEach(i=>{Reflect.apply(i,this,e)})}once(t,e){const r=(()=>{let s=!1;return(...a)=>{s||(s=!0,Reflect.apply(e,this,a),this.off(t,r))}})();this.on(t,r)}}var Jl=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function $1(n,t={}){var e=1,i=1;function r(nt){var J=nt.match(/\n/g);J&&(e+=J.length);var I=nt.lastIndexOf(`
|
|
11
|
+
`);i=~I?nt.length-I:i+nt.length}function s(){var nt={line:e,column:i};return function(J){return J.position=new a(nt),m(),J}}function a(nt){this.start=nt,this.end={line:e,column:i},this.source=t.source}a.prototype.content=n;var o=[];function h(nt){var J=new Error(t.source+":"+e+":"+i+": "+nt);if(J.reason=nt,J.filename=t.source,J.line=e,J.column=i,J.source=n,t.silent)o.push(J);else throw J}function l(){var nt=f();return{type:"stylesheet",stylesheet:{source:t.source,rules:nt,parsingErrors:o}}}function c(){return u(/^{\s*/)}function d(){return u(/^}/)}function f(){var nt,J=[];for(m(),v(J);n.length&&n.charAt(0)!="}"&&(nt=_t()||pt());)nt!==!1&&(J.push(nt),v(J));return J}function u(nt){var J=nt.exec(n);if(J){var I=J[0];return r(I),n=n.slice(I.length),J}}function m(){u(/^\s*/)}function v(nt){var J;for(nt=nt||[];J=b();)J!==!1&&nt.push(J);return nt}function b(){var nt=s();if(!(n.charAt(0)!="/"||n.charAt(1)!="*")){for(var J=2;n.charAt(J)!=""&&(n.charAt(J)!="*"||n.charAt(J+1)!="/");)++J;if(J+=2,n.charAt(J-1)==="")return h("End of comment missing");var I=n.slice(2,J-2);return i+=2,r(I),n=n.slice(J),i+=2,nt({type:"comment",comment:I})}}function S(){var nt=u(/^([^{]+)/);if(nt)return vi(nt[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(J){return J.replace(/,/g,"")}).split(/\s*(?![^(]*\)),\s*/).map(function(J){return J.replace(/\u200C/g,",")})}function E(){var nt=s(),J=u(/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(J){if(J=vi(J[0]),!u(/^:\s*/))return h("property missing ':'");var I=u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/),D=nt({type:"declaration",property:J.replace(Jl,""),value:I?vi(I[0]).replace(Jl,""):""});return u(/^[;\s]*/),D}}function _(){var nt=[];if(!c())return h("missing '{'");v(nt);for(var J;J=E();)J!==!1&&(nt.push(J),v(nt));return d()?nt:h("missing '}'")}function x(){for(var nt,J=[],I=s();nt=u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)J.push(nt[1]),u(/^,\s*/);if(J.length)return I({type:"keyframe",values:J,declarations:_()})}function P(){var nt=s(),J=u(/^@([-\w]+)?keyframes\s*/);if(J){var I=J[1];if(J=u(/^([-\w]+)\s*/),!J)return h("@keyframes missing name");var D=J[1];if(!c())return h("@keyframes missing '{'");for(var A,B=v();A=x();)B.push(A),B=B.concat(v());return d()?nt({type:"keyframes",name:D,vendor:I,keyframes:B}):h("@keyframes missing '}'")}}function R(){var nt=s(),J=u(/^@supports *([^{]+)/);if(J){var I=vi(J[1]);if(!c())return h("@supports missing '{'");var D=v().concat(f());return d()?nt({type:"supports",supports:I,rules:D}):h("@supports missing '}'")}}function O(){var nt=s(),J=u(/^@host\s*/);if(J){if(!c())return h("@host missing '{'");var I=v().concat(f());return d()?nt({type:"host",rules:I}):h("@host missing '}'")}}function L(){var nt=s(),J=u(/^@media *([^{]+)/);if(J){var I=vi(J[1]);if(!c())return h("@media missing '{'");var D=v().concat(f());return d()?nt({type:"media",media:I,rules:D}):h("@media missing '}'")}}function $(){var nt=s(),J=u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(J)return nt({type:"custom-media",name:vi(J[1]),media:vi(J[2])})}function U(){var nt=s(),J=u(/^@page */);if(J){var I=S()||[];if(!c())return h("@page missing '{'");for(var D=v(),A;A=E();)D.push(A),D=D.concat(v());return d()?nt({type:"page",selectors:I,declarations:D}):h("@page missing '}'")}}function z(){var nt=s(),J=u(/^@([-\w]+)?document *([^{]+)/);if(J){var I=vi(J[1]),D=vi(J[2]);if(!c())return h("@document missing '{'");var A=v().concat(f());return d()?nt({type:"document",document:D,vendor:I,rules:A}):h("@document missing '}'")}}function q(){var nt=s(),J=u(/^@font-face\s*/);if(J){if(!c())return h("@font-face missing '{'");for(var I=v(),D;D=E();)I.push(D),I=I.concat(v());return d()?nt({type:"font-face",declarations:I}):h("@font-face missing '}'")}}var K=vt("import"),Z=vt("charset"),at=vt("namespace");function vt(nt){var J=new RegExp("^@"+nt+"\\s*([^;]+);");return function(){var I=s(),D=u(J);if(D){var A={type:nt};return A[nt]=D[1].trim(),I(A)}}}function _t(){if(n[0]=="@")return P()||L()||$()||R()||K()||Z()||at()||z()||U()||O()||q()}function pt(){var nt=s(),J=S();return J?(v(),nt({type:"rule",selectors:J,declarations:_()})):h("selector missing")}return So(l())}function vi(n){return n?n.replace(/^\s+|\s+$/g,""):""}function So(n,t){var e=n&&typeof n.type=="string",i=e?n:t;for(var r in n){var s=n[r];Array.isArray(s)?s.forEach(function(a){So(a,i)}):s&&typeof s=="object"&&So(s,i)}return e&&Object.defineProperty(n,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),n}const Co=(n,t="image/svg+xml",e="utf-8")=>new Blob([n],{type:`${t};charset=${e}`}),Ql=n=>new XMLSerializer().serializeToString(n),V1=(n,t="text/html")=>new DOMParser().parseFromString(n,t),tc=(n,t="image/svg+xml",e="utf-8")=>Co(Ql(n),t,e),To=(n,t)=>{const e=document.createElement("a");e.style.visibility="hidden",document.body.appendChild(e),e.download=t,typeof n=="string"?e.href=n:e.href=window.URL.createObjectURL(n),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)};function ec(n=["*"],t){if(!globalThis.document||!(globalThis.document instanceof Document))throw new Error("This is not a browser environment");const e=globalThis.document.createElement("input");return e.setAttribute("type","file"),e.setAttribute("visibility","hidden"),Array.isArray(n)&&n.length>0&&e.setAttribute("accept",n.join(",")),t&&e.setAttribute("multiple","true"),e.click(),new Promise((i,r)=>{globalThis.addEventListener("focus",()=>{setTimeout(()=>{(!e.files||e.files?.length===0)&&r(new Error("Cancel select"))},1e3)},{once:!0}),e.addEventListener("change",()=>{if(!e.files||e.files?.length===0)r(new Error("Cancel select"));else{const s=Array.from(e.files);!n.includes("*")&&s.some(a=>!n.includes(`.${nc(a)}`))&&r(new Error(`Please select files in ${n} format`)),i(s)}})})}function ko(n,t="text",e){return new Promise((i,r)=>{const s=new FileReader;switch(s.addEventListener("progress",a=>{e?.(a.loaded,a.total)}),s.addEventListener("load",a=>{i(a.target?.result)}),s.addEventListener("error",a=>{r(a)}),t){case"dataURL":s.readAsDataURL(n);break;case"binaryString":s.readAsBinaryString(n);break;case"arrayBuffer":s.readAsArrayBuffer(n);break;default:s.readAsText(n)}})}function ic(n,t,e){return ko(n.slice(t,e),"arrayBuffer")}async function H1(n){const t=await ic(n,0,4);return Fl(t)}const nc=n=>{let t;return n instanceof File?t=n.name:t=n,t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i)?.[1]??""};function j1(n,t){n.addEventListener("change",function(){t(n.files)},!1)}function X1(n,t){n.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},!1),n.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&t(e.dataTransfer.files)},!1)}function Y1(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(t=>setTimeout(()=>{throw t}))}function q1(n,t={},e=[]){return{tag:n,props:t,children:e}}function kr(n,t){if(n.el)return;const e=n.el=document.createElement(n.tag);if(n.props)for(const i in n.props){const r=n.props[i];i.startsWith("on")?e.addEventListener(i.slice(2).toLowerCase(),r):e.setAttribute(i,r)}n.children&&(typeof n.children=="string"?e.textContent=n.children:n.children.forEach(i=>{kr(i,e)})),t.appendChild(e)}function rc(n,t){if(n.tag!==t.tag){if(!n.el)return;const e=n.el.parentElement||document.body;e.removeChild(n.el),kr(t,e)}else{const e=t.el=n.el;if(!e)return;const i=n.props,r=t.props;for(const o in i)o in r||(o.startsWith("on")?e.removeEventListener(o.slice(2).toLowerCase(),i[o]):e.removeAttribute(o));for(const o in r){const h=i[o],l=r[o];l!=h&&(o.startsWith("on")?e.addEventListener(o.slice(2).toLowerCase(),l):e.setAttribute(o,l))}const s=n.children||[],a=t.children||[];if(typeof a=="string")e.innerHTML=a;else if(typeof s=="string")e.innerHTML="",a.forEach(o=>{kr(o,e)});else{const o=Math.min(s.length,a.length);for(let h=0;h<o;h++)rc(s[h],a[h]);a.length>s.length&&a.slice(s.length).forEach(h=>{kr(h,e)}),a.length<s.length&&s.slice(a.length).forEach(h=>{h.el&&e.removeChild(h.el)})}}}function sc(n,t,e){if(!n){e&&t&&e.appendChild(t);return}if(!n.isEqualNode(t)){if(n.nodeName!==t.nodeName){e.replaceChild(t,n);return}if(n.nodeType===Node.TEXT_NODE){n.textContent!==t.textContent&&(n.textContent=t.textContent);return}for(let i=n.attributes.length-1;i>=0;i--){const r=n.attributes[i].name;!t.hasAttribute(r)&&r!=="open"&&n.removeAttribute(r)}for(let i=0;i<t.attributes.length;i++){const r=t.attributes[i].name,s=t.attributes[i].value;n.setAttribute(r,s)}for(let i=0;i<t.childNodes.length;i++)n.childNodes[i]?sc(n.childNodes[i],t.childNodes[i],n):n.appendChild(t.childNodes[i].cloneNode(!0));for(;n.childNodes.length>t.childNodes.length;)n.lastChild&&n.removeChild(n.lastChild)}}class W1{url;socket;waitingResponse={};sendMessageQueue=[];constructor(t){this.url=t,this.createSocket()}createSocket(){console.log("Socket Create Attempted"),this.socket=new WebSocket(this.url),this.socket.onopen=()=>{this.sendMessageQueue.forEach(t=>this.socket?.send(t)),this.sendMessageQueue=[]},this.socket.onclose=t=>{const{code:e,reason:i,wasClean:r}=t;console.log(`ws closed : ${e} ${i} ${r}`)},this.socket.onerror=t=>{console.log(`ws error : ${t.type}`)},this.socket.onmessage=t=>{this.processMessage(t)}}recreateSocket(t){console.log("Socket Recreate Attempted"),this.sendMessageQueue.push(t),this.createSocket()}closeSocket(){this.socket&&(this.socket.close(),console.log("Socket closed"))}openSocket(){this.createSocket(),console.log("Socket opened manually")}sendWithRetry(t){this.socket?.readyState===WebSocket.OPEN?this.socket.send(t):this.recreateSocket(t)}async processMessage(t){if(typeof t.data=="string")try{const e=JSON.parse(t.data);if(Object.prototype.hasOwnProperty.call(e,"requestid")){const i=this.waitingResponse[e.requestid];i?i.resolve?.(e):console.warn("Got data but found no associated request, already timed out?",e)}else console.warn("Got data without request id",e)}catch{console.log(`Received String : ${t.data}`)}else t.data instanceof ArrayBuffer?console.log(`Received ArrayBuffer : ${t.data}`):t.data instanceof Blob&&console.log(`Received Blob : ${t.data}`)}async sendPayload(t){const e=+new Date,i=this.waitingResponse[e]={requestid:e};try{let r;t instanceof Blob||t instanceof ArrayBuffer||typeof t=="string"?r=t:r=JSON.stringify({...i,...t});const s=await new Promise((a,o)=>{i.resolve=a,this.sendWithRetry(r),setTimeout(()=>{o("Timeout")},5e3)});return console.info("Time took",(+new Date-i.requestid)/1e3),s}catch(r){return Promise.reject(r)}finally{delete this.waitingResponse[e]}}async send(t,e,i=r=>{console.log(r)}){this.sendPayload(t).then(e,i)}}function Eo(){return document.compatMode=="BackCompat"?document.body:document.documentElement}function Hn(){const n=Eo();return{scrollTop:n.scrollTop,scrollLeft:n.scrollLeft,scrollWidth:n.scrollWidth,scrollHeight:n.scrollHeight}}function aa(){const n=Eo();return{clientTop:n.clientTop,clientLeft:n.clientLeft,clientWidth:n.clientWidth,clientHeight:n.clientHeight}}function oa(){const{clientWidth:n,clientHeight:t}=aa();return{width:n,height:t}}function K1(){const{scrollWidth:n,scrollHeight:t}=Hn(),{width:e,height:i}=oa();return{width:Math.max(n,e),height:Math.max(t,i)}}function Z1(n){const{width:t,height:e}=oa(),{top:i,left:r,right:s,bottom:a}=n.getBoundingClientRect();return(i>=0&&i<=e||a>=0&&a<=e)&&(r>=0&&r<=t||s>=0&&s<=t)}function J1(n,t,e){const i={threshold:1};new IntersectionObserver(function(s,a){let o=s[0];if(s.length>1){const l=s.find(c=>c.isIntersecting);l&&(o=l)}o.isIntersecting&&o.intersectionRatio>=i.threshold?t(o.target):e?.(o.target)},i).observe(n)}function ac(n){const{top:t,left:e}=n.getBoundingClientRect(),i=Hn();return{x:e+i.scrollLeft,y:t+i.scrollTop}}function Q1(n){return{x:oc(n),y:hc(n)}}function oc(n){let t=0;for(;n!==null;)t+=n.offsetLeft,n=n.offsetParent;return t}function hc(n){let t=0;for(;n!==null;)t+=n.offsetTop,n=n.offsetParent;return t}function tg(n){const t=n.getBoundingClientRect();return{x:t.left,y:t.top}}function eg(n,t){const e=n.getBoundingClientRect(),i=t.getBoundingClientRect();return{x:i.x-e.x,y:i.y-e.y,width:i.width,height:i.height}}function lc(n){if(n.pageX&&n.pageY)return{x:n.pageX,y:n.pageY};const t=Hn();return{x:n.clientX+t.scrollLeft,y:n.clientY+t.scrollTop}}function ig(n){return{x:n.clientX,y:n.clientY}}function ze(n,t){const e=lc(t),i=ac(n);return{x:e.x-i.x,y:e.y-i.y}}function Po(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}const ha=()=>{const n=navigator.userAgent.toLowerCase();let t="Unknown";return/mac/i.test(n)?t="macOS":/win/i.test(n)?t="Windows":/android/i.test(n)?t="Android":/iphone|ipad|ipod/i.test(n)?t="iOS":/linux/i.test(n)?t="Linux":/bsd/i.test(n)&&(t="BSD"),t.toLowerCase()},ng=()=>{const n=navigator.userAgent;let t="Unknown";if(/Windows NT/.test(n)){const e=n.match(/Windows NT (\d+\.\d+)/);e&&(t=e[1])}else if(/Mac OS X/.test(n)){const e=n.match(/Mac OS X (\d+_\d+)/);e&&(t=e[1].replace("_","."))}else if(/Android/.test(n)){const e=n.match(/Android (\d+\.\d+)/);e&&(t=e[1])}else if(/iPhone|iPad|iPod/.test(n)){const e=n.match(/OS (\d+_\d+)/);e&&(t=e[1].replace("_","."))}return t.toLowerCase()},Ao=()=>{const n=navigator.userAgent.toLowerCase();let t="Unknown";return/chrome/i.test(n)?t="Chrome":/firefox/i.test(n)?t="Firefox":/safari/i.test(n)?t="Safari":/edge/i.test(n)?t="Edge":/msie|trident/i.test(n)?t="IE":/MicroMessenger/i.test(n)?t="Wechat":/alipay/i.test(n)&&(t="Ali"),t.toLowerCase()},rg=()=>{const n=navigator.userAgent;let t="Unknown";if(/Chrome/.test(n)){const e=n.match(/Chrome\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Firefox/.test(n)){const e=n.match(/Firefox\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Safari/.test(n)){const e=n.match(/Version\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Edge/.test(n)){const e=n.match(/Edge\/(\d+\.\d+)/);e&&(t=e[1])}else if(/MSIE|Trident/.test(n)){const e=n.match(/(?:MSIE|rv:)(\d+\.\d+)/);e&&(t=e[1])}return t},sg=()=>"geolocation"in navigator?new Promise((n,t)=>{navigator.geolocation.getCurrentPosition(e=>{const i=e.coords.latitude,r=e.coords.longitude;n({latitude:i,longitude:r})},e=>{t(e)})}):Promise.reject("Geolocation is not available.");function ag(){return(navigator.browserLanguage||navigator.language).toLowerCase()}function og(){return Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase()}function Mo(){return ha()==="ios"}function Ro(){return ha()==="macos"}function hg(){return Mo()|Ro()}function cc(){return ha()==="android"}function lg(){return Mo()||cc()}function cg(){return typeof window=="object"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function uc(){const n=window.navigator.userAgent,t=n.indexOf("MSIE ");if(t>0)return parseInt(n.substring(t+5,n.indexOf(".",t)),10);if(n.indexOf("Trident/")>0){const r=n.indexOf("rv:");return parseInt(n.substring(r+3,n.indexOf(".",r)),10)}const i=n.indexOf("Edge/");return i>0?parseInt(n.substring(i+5,n.indexOf(".",i)),10):-1}function fc(){return Ao()==="wechat"}function dc(){return Ao()==="ali"}function ug(){return fc()&&navigator.userAgent.match(/miniprogram/i)||window.__wxjs_environment==="miniprogram"}function fg(){return dc()&&navigator.userAgent.match(/miniprogram/i)}const dg=uc()!==-1,gg=typeof document<"u",gc=typeof window<"u",pg=typeof history<"u",mg=gc&&window.File&&window.FileReader&&window.FileList&&window.Blob,pc=(()=>{const n=Po();return!!(n.Worker&&n.Blob&&n.Promise&&n.OffscreenCanvas&&n.OffscreenCanvasRenderingContext2D&&n.HTMLCanvasElement&&n.HTMLCanvasElement.prototype.transferControlToOffscreen&&n.URL&&n.URL.createObjectURL)})(),vg=typeof Path2D=="function"&&typeof DOMMatrix=="function",_g=function(){if(!Po().OffscreenCanvas)return!1;var t=new OffscreenCanvas(1,1),e=t.getContext("2d");e.fillRect(0,0,1,1);var i=t.transferToImageBitmap();try{e.createPattern(i,"no-repeat")}catch{return!1}return!0}();function yg(n,t){let e=n[t];Object.defineProperty(n,"prop",{get:()=>e,set:i=>{e=i;debugger}})}function wg(n){return new Proxy(n,{get(t,e,i){return Reflect.get(t,e,i)},set(t,e,i,r){debugger;return Reflect.set(t,e,i,r)}})}function bg(n){var t=document.documentElement,e=window.top===window.self?window.devicePixelRatio:1;t.dataset.dpr=e;var i=100,r=function(){var s=Math.min(t.clientWidth,n);t.dataset.width=s,t.dataset.rem=i=Math.round(100*(s/n)),t.style.fontSize=i+"px"};r(),window.rem2px=function(s){return s=parseFloat(s),s*i},window.px2rem=function(s){return s=parseFloat(s),s/i},window.addEventListener&&window.addEventListener("orientationchange"in window?"orientationchange":"resize",r,!1)}class It{static onDocumentReady(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}static getCSSVar(t){return getComputedStyle(document.documentElement).getPropertyValue(t)}static setCSSVar(t,e){document.documentElement.style.setProperty(t,e)}static safeExec(t){const e=new Proxy(window,{get(i,r,s){if(typeof r=="string"&&["open","location","document"].includes(r))throw new Error(`禁止访问 key: ${r}`);return r==="window"?e:Reflect.get(i,r,s)},set(i,r,s,a){return Reflect.set(i,r,s,a)}});new Function("window",`with(window) { ${t} }`)(e,null)}static dom=new Proxy({},{get(t,e){return function(i={},...r){const s=document.createElement(e);for(const a of Object.keys(i))s.setAttribute(a,i[a]);for(const a of r)typeof a=="string"?s.appendChild(document.createTextNode(a)):s.appendChild(a);return s}}});static compileTemplate(t){return t=t.replace(/<%=(.+?)%>/g,"`); \n echo( $1 ); \n echo(`").replace(/<%([\s\S]+?)%>/g,"`); \n $1 \n echo(`"),t="echo(`"+t+"`);",`(function parse(data){
|
|
12
12
|
let output = "";
|
|
13
13
|
function echo(html){
|
|
14
14
|
output += html;
|
|
15
15
|
}
|
|
16
16
|
${t}
|
|
17
17
|
return output;
|
|
18
|
-
})`}static safeHtml(t,e="encode"){const i={"&":"&","<":"<",">":">",""":'"',"'":"'"};for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t=t.replace(new RegExp(e=="decode"?r:i[r],"g"),e=="decode"?i[r]:r));return t}static loadScript(t,e=()=>{},i=(r,s,a,o,h)=>{}){const r=document.createElement("script");r.type="text/javascript",r.src=t,r.async=!1,document.body.appendChild(r),r.onload=e,r.onerror=i}static loadStyle(t){const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.insertBefore(e,document.head.childNodes[document.head.childNodes.length-1].nextSibling)}static waitForStyleSheetsLoaded=()=>new Promise(t=>{const e=Array.from(document.querySelectorAll("link[rel=stylesheet]"));let i=document.styleSheets.length??0;const r=()=>i>=e.length?(t(),!0):!1;r()||e.forEach(s=>{s.onload=()=>{i+=1,r()}})});static lazyloadImages(){const t=document.getElementsByTagName("img"),e=oa().height;let i=0;return()=>{for(let r=i;r<t.length;r++)t[r].getBoundingClientRect().top<e&&(t[r].src=t[r].getAttribute("data-src")??"",i=r+1)}}static iframePostMessage(t,e="http://test.com/localstorage.html"){const i=document.createElement("iframe");i.src=e,document.body.append(i),setTimeout(function(){i.contentWindow?.postMessage(t,e)},4e3),setTimeout(function(){i.remove()},6e3)}static getTextWidth=(t,e,i=400)=>{const r=document.createElement("span");r.style.visibility="hidden",r.style.padding="0",r.style.whiteSpace="nowrap",r.style.overflow="visible",r.style.fontSize=e>12?e+"px":"12px",r.style.fontWeight=i.toString(),r.innerText=t,document.body.appendChild(r);const s=r.offsetWidth;return document.body.removeChild(r),s};static getFixedWidthText=(t,e,i=12,r=400,s=!0)=>{let a="",o="",h="";if(!t||e<i||typeof t!="string")return a;const l=t.split(""),c=document.createElement("span");c.style.visibility="hidden",c.style.padding="0",c.style.whiteSpace="nowrap",c.style.overflow="visible",c.style.fontSize=i>12?i+"px":"12px",c.style.fontWeight=r.toString(),document.body.appendChild(c);for(let d=0,f=l.length;d<f;d++){const u=l[d];if(o=h,h+=u,a=h,c.innerText=h,c.offsetWidth>e){s?a=o+"...":a=o;break}}return document.body.removeChild(c),a};static getLocation(){return new Promise((t,e)=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(i=>{t(i.coords)}):e("Geolocation is not supported by this browser")})}static vibrate(t=200){"vibrate"in navigator?window.navigator.vibrate(t):console.error("Your device is not support vibrate on this browser.")}static copyToClipboard=t=>navigator.clipboard.writeText(t);static getSelectedText=()=>window.getSelection()?.toString();static siblings=t=>Array.prototype.slice.call(t.parentNode?.children).filter(e=>e!==t);static isElementFocus=t=>t===document.activeElement;static isTabInView=()=>!document.hidden;static navigateBack=()=>history.back();static navigateBack2=()=>history.go(-1);static addDebuggerOnBeforeUnload=()=>{window.addEventListener("beforeunload",()=>{debugger})}}function Do(n,t=document){return new oe(n,t)}class oe{context;nodes;prefixs=["moz","o","ms","webkit"];constructor(t,e=document){if(this.context=e,typeof t=="string"?this.nodes=Array.from(this.context.querySelectorAll(t)):t instanceof HTMLElement?this.nodes=[t]:this.nodes=t,this.nodes.length===0)throw new Error(`can not find ${t}`);this.each((i,r)=>{i instanceof HTMLInputElement&&i.addEventListener("change",s=>{this.changeRadioChecked(s.currentTarget.value)}),i instanceof HTMLSelectElement&&i.addEventListener("change",s=>{this.changeSelectSelected(s.currentTarget.value)})})}get(t){return t<0&&(t=this.nodes.length+t),this.nodes[t]}concat(t){return new oe(this.nodes.concat(t.nodes),this.context)}then(t){return t(this)??this}each(t){return this.nodes.forEach((e,i)=>{t(e,i)}),this}_save(t,e,i){t._mQuery||(t._mQuery={}),Array.isArray(i)?(t._mQuery[e]=t._mQuery[e]??[],t._mQuery[e].push(...i)):i!=null?t._mQuery[e]=i:delete t._mQuery[e]}on(t,e,i){return this.nodes.forEach(r=>{this._save(r,"events",[{event:t,callback:e,options:i}]),r.addEventListener(t,e,i)}),this}off(t,e,i){return this.nodes.forEach(r=>{r.removeEventListener(t,e,i)}),this}dispatchEvent(t,e){let i;const r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return typeof t=="string"?r.includes(t)?i=new MouseEvent(t,e):s.includes(t)?i=new KeyboardEvent(t,e):i=new Event(t,e):i=t,this.nodes.forEach(a=>{a.dispatchEvent(i)}),this}change(){return this.dispatchEvent("change")}click(){return this.dispatchEvent("click")}static hasEvent(t,e){return"on"+e in t}static _fragment(t){const e=document.createElement("template");return e.innerHTML=t,e.content.childNodes.forEach(i=>{const r=oe._scriptConvert(i);r!=i&&e.content.replaceChild(r,i)}),e.content}static _scriptConvert(t){const e=i=>{const s=i.ownerDocument.createElement("script");s.text=i.text;const a=i.attributes;for(let o=0;o<a.length;o++)s.setAttribute(a[o].name,a[o].value);return s};return t.tagName=="SCRIPT"&&(t=e(t)),t.querySelectorAll&&t.querySelectorAll("script").forEach(i=>{i.parentNode?.replaceChild(e(i),i)}),t}static _fixProp(t){const e={cellpadding:"cellPadding",cellspacing:"cellSpacing",class:"className",colspan:"colSpan",contenteditable:"contentEditable",for:"htmlFor",frameborder:"frameBorder",maxlength:"maxLength",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"};return e[t]?e[t]:t}static isSVG(t){return(t||document.documentElement).nodeName.toLowerCase()==="svg"}static createElement(t){return oe.isSVG()?document.createElementNS.call(document,"http://www.w3.org/2000/svg",t):document.createElement.call(document,t)}static createTextNode(t){return document.createTextNode.call(document,t)}static createDocumentFragment(){return document.createDocumentFragment.call(document)}_insert(t,e){const i=this.nodes.length;if(i<1)return this;const r=[];if(typeof e=="string")this.nodes.forEach(s=>{const a=oe._fragment(e);r.push(...a.children),s[t](a)});else if(e instanceof HTMLElement)this.each(s=>{const a=i===1?e:oe._fragment(e.outerHTML);r.push(...i===1?[e]:a.children),s[t](a)}),i>1&&e.remove();else if(e instanceof oe){const s=i==1;e.each(a=>{this.each(o=>{const h=s?a:a.cloneNode(!0);r.push(h),o[t](h),oe._scriptConvert(h)})}),s||e.remove()}return t=="replaceWith"&&(this.nodes=r),this}append(t){return this._insert("append",t)}prepend(t){return this._insert("prepend",t)}after(t){return this._insert("after",t)}before(t){return this._insert("before",t)}replace(t){return this._insert("replaceWith",t)}remove(){return this.nodes.forEach(t=>{t.remove()}),this}static removeChild(t){t.parentElement?.removeChild(t)}find(t){const e=[];return this.nodes.forEach(i=>{e.push(...Array.from(i.querySelectorAll(t)))}),new oe(e,this.context)}filter(t){const e=[];return this.nodes.forEach(i=>{(i===t||typeof t=="string"&&i.matches&&i.matches(t))&&e.push(i)}),new oe(e,this.context)}next(){const t=[];return this.nodes.forEach(e=>{const i=e.nextElementSibling;i&&t.push(i)}),new oe(t,this.context)}prev(){const t=[];return this.nodes.forEach(e=>{const i=e.previousElementSibling;i&&t.push(i)}),new oe(t,this.context)}closest(t){const e=[];return this.nodes.forEach(i=>{const r=i.closest(t);r&&e.push(r)}),new oe(e,this.context)}shadow(t){const e=[];this.nodes.forEach(r=>{r.shadowRoot&&e.push(r.shadowRoot)});const i=new oe(e,this.context);return t!==void 0?i.find(t):i}parent(t){return this.parents(t,!0)}parents(t,e=!1){const i=[],r=a=>{if(i.indexOf(a)==-1&&i.push(a),!e&&a.parentElement)return r(a.parentElement)};this.nodes.forEach(a=>{a.parentElement&&r(a.parentElement)});const s=new oe(i,this.context);return t!==void 0?s.filter(t):s}static getComputedStyle(t,e,i){let r;const s=t.style.getPropertyPriority(e);return"getComputedStyle"in window?(r=getComputedStyle.call(window,t,i),r=r.getPropertyValue(e)):r=t.style.getPropertyValue(e),r+(s?"!"+s:"")}css(t,e){if((t===void 0||typeof t=="string")&&e===void 0){const i=this.nodes[0].style;if(typeof t=="string"){const r=i.getPropertyPriority(t),s=i.getPropertyValue(t).trim();return s?s+(r?"!"+r:""):oe.getComputedStyle(this.nodes[0],t)}else{const r=Object.fromEntries(this.nodes[0].style.cssText.split(";").filter(s=>!!s).map(s=>s.split(":").map(a=>a.trim())));return Object.assign(r,getComputedStyle.call(window,this.nodes[0])),r}}else{let i={};return typeof t=="string"&&e!==void 0?i[t]=e:typeof t=="object"&&(i=t),this.nodes.forEach(r=>{Object.keys(i).forEach(s=>{const a=String(i[s]).toLowerCase().includes("!important")?"important":"";r.style.setProperty(s,String(i[s]).replace(/!important/i,""),a)})}),this}}addClass(t){return this.toggleClass(t,!0)}removeClass(t){return this.toggleClass(t,!1)}toggleClass(t,e){const i=t.split(/[,\s]+/);return this.nodes.forEach(r=>{i.forEach(s=>{if(s.trim()!==""){let a="toggle";e!==void 0&&(a=e?"add":"remove"),r.classList[a](s.trim())}})}),this}hasClass(t){const e=t.split(/[,\s]+/);let i=!1;return this.nodes.forEach(r=>{i=i||e.every(s=>Array.from(r.classList??[]).includes(s.trim()))}),i}attr(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0].getAttribute(t);let i={};return typeof t=="object"?i=t:e!==void 0&&(i[t]=e),this.nodes.forEach(r=>{Object.entries(i).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}removeAttr(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(i=>{e.forEach(r=>{i.removeAttribute(r)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0][t];{let i={};return typeof t=="object"?i=t:typeof t=="string"&&e!==void 0&&(i[t]=e),this.nodes.forEach(r=>{Object.entries(i).forEach(([s,a])=>{const o=oe._fixProp(s);r[o]=a,o=="innerHTML"&&oe._scriptConvert(r)})}),this}}removeProp(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(i=>{e.forEach(r=>{delete i[oe._fixProp(r)]})}),this}changeSelectSelected(t){this.nodes.forEach(e=>{if(e instanceof HTMLSelectElement){const i=e.options;for(let r=0,s=i.length;r<s;r++)i[r].value==t?i[r].selected=!0:i[r].selected=!1}})}changeRadioChecked(t){this.nodes.forEach(e=>{e instanceof HTMLInputElement&&(e.value==t?e.checked=!0:e.checked=!1)})}data(t,e){if(typeof t=="string"&&t.indexOf("-")!=-1)throw new Error(`Key "${t}" contains "-" (dash). Dashes are not allowed in property names. Use camelCase instead.`);if((typeof t=="string"||t===void 0)&&e===void 0){const i=Object.assign({},this.nodes[0].dataset);return Object.keys(i).forEach(r=>{if(i[r]?.startsWith("[")||i[r]?.startsWith("{"))try{i[r]=JSON.parse(i[r]??"")}catch{}}),typeof t=="string"?i[t]:i}else{let i={};return typeof t=="object"?i=t:typeof t=="string"&&(i[t]=e),this.nodes.forEach(r=>{Object.entries(i).forEach(([s,a])=>{a!=null?r.dataset[s]=a instanceof Object?JSON.stringify(a):a:delete r.dataset[s]})}),this}}removeData(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(i=>{e.forEach(r=>{delete i.dataset[r]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.nodes.forEach(e=>{const i=e.style.display,r=getComputedStyle(e).display,s=i=="none"||r=="none";if(s&&(t===void 0||t===!0)){const a=e instanceof HTMLTableRowElement?"table-row":e instanceof HTMLTableCellElement?"table-cell":"block";e.style.display=e._mQuery?.prevDisplay??(i==r&&r!="none"?"":a),this._save(e,"prevDisplay",null)}!s&&(t==null||t===!1)&&(r!="none"&&this._save(e,"prevDisplay",r),e.style.setProperty("display","none"))})}empty(){return this.html("")}html(t){return t instanceof HTMLElement?this.empty().append(t.innerHTML):this.prop("innerHTML",t)}text(t){return this.prop("textContent",t)}val(t){return this.prop("value",t)}}class Qt{constructor(){}static getFormatKeyNames(t){const e=Ro(),i=[];return t.ctrl&&i.push(e?"Cmd":"Ctrl"),t.shift&&i.push(e?"Option":"Shift"),t.alt&&i.push("Alt"),typeof t.key=="string"?i.push(Ll(t.key)):Array.isArray(t.key)&&(t.key.map(r=>Ll(r)),i.push(...t.key)),i}static matchKeyScheme(t,e){const i=t.ctrl??!1,r=t.shift??!1,s=t.alt??!1;if(t.exact)return(i===e.metaKey||i===e.ctrlKey)&&r===e.shiftKey&&s===e.altKey;const a=[];return i&&a.push(i===e.metaKey||i===e.ctrlKey),r&&a.push(r===e.shiftKey),s&&a.push(s===e.altKey),a.every(o=>o)}static on(t,e){if(t?.key===void 0||t?.key===null)return e;const i=t?.target??window;let r=!1;const s=this.getFormatKeyNames(t),a=o=>{if(o.stopPropagation(),!r&&o.key!=="Control"&&o.key!=="Meta"&&o.key!=="Shift"&&o.key!=="Option"&&o.key!=="Alt"&&s.find(h=>h.toLowerCase()===o.key.toLowerCase())&&this.matchKeyScheme(t,o)){o.preventDefault();const h=e(o);if(typeof h!="function")return;const l=c=>{c.preventDefault(),h(c),i.removeEventListener("keyup",l)};i.addEventListener("keyup",l)}};return i.addEventListener("keydown",a),e.title=t?.title??"",e.formatedKeyNames=s,e.pause=()=>r=!0,e.unpause=()=>r=!1,e.removeListener=()=>i.removeEventListener("keydown",a),e}}function la(n){return n*Math.PI/180}function Lo(n){return n*180/Math.PI}function mc(n,t,e,i){const r=n-e,s=t-i;return Math.sqrt(r*r+s*s)}function Io(n,t,e,i){const r=e-n,s=i-t;return Math.atan2(s,r)}function ca(n){return n[0]*n[0]+n[1]*n[1]}function Oo(n){const t=Math.sqrt(ca(n));n[0]&&(n[0]/=t),n[1]&&(n[1]/=t)}function vc(n,t,e,i,r=10){if(Math.abs(e-n)<r&&Math.abs(i-t)<r)return"no";const s=Lo(Io(n,t,e,i));return s>=-135&&s<=-45?"up":s>45&&s<135?"down":s>=135&&s<=180||s>=-180&&s<-135?"left":s>=-45&&s<=45?"right":"no"}class Er{x;y;vx;vy;ax;ay;mass;constructor(t){this.x=t.x,this.y=t.y,this.vx=t?.vx||0,this.vy=t?.vy||0,this.ax=t?.ax||0,this.ay=t?.ay||0,this.mass=t?.mass||0}fromAngleAndLength(t,e){return new Er({x:Math.cos(t)*e,y:Math.sin(t)*e})}distanceTo(t){return mc(this.x,this.y,t.x,t.y)}angleTo(t){return Io(this.x,this.y,t.x,t.y)}followTo(t,e=3){const i=this.angleTo(t),{x:r,y:s}=this.fromAngleAndLength(i,e);this.vx=r,this.vy=s,this.nextFrame()}followAccelerationTo(t,e=.05){const i=this.angleTo(t),{x:r,y:s}=this.fromAngleAndLength(i,e);this.ax=r,this.ay=s,this.nextFrame()}nextFrame(t){const e=t?.gravity??0,i=t?.friction??0;if(this.vx+=this.ax,this.vy+=this.ay,this.vy+=e,i>0){const r=Math.atan2(this.vy,this.vx);let s=Math.sqrt(this.vx*this.vx+this.vy*this.vy);s>i?s-=i:s=0,this.vx=Math.cos(r)*s,this.vy=Math.sin(r)*s}this.x+=this.vx,this.y+=this.vy}nextFrameEaseTo(t,e){const i=e?.gravity??0,r=e?.friction??1,s=e?.easing??.05,a=t.x-this.x,o=t.y-this.y;this.vx=a*s,this.vy=o*s,this.vy+=i,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy}nextFrameSpringTo(t,e){const i=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03;(Array.isArray(t)?t:[t]).forEach(o=>{const h=o.x-this.x,l=o.y-this.y,c=h*s,d=l*s;this.vx+=c,this.vy+=d}),this.vy+=i,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy}nextFrameSpringConnect(t,e){const i=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03,a=e?.springLength??100,o=this.angleTo(t);this.nextFrameSpringTo(new Er({x:t.x-Math.cos(o)*a,y:t.y-Math.sin(o)*a}),{spring:s,friction:r,gravity:i})}}let jn=class extends Er{width;height;constructor(t){super(t),this.width=t.width,this.height=t.height}eq(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}isIntersectRect(t){return!(this.x+this.width<t.x||t.x+t.width<this.x||this.y+this.height<t.y||t.y+t.height<this.y)}isContainPoint(t){return!(t.x<this.x||t.x>this.x+this.width||t.y<this.y||t.y>this.y+this.height)}toArray(){return[this.x,this.y,this.width,this.height]}clone(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}};class Wt extends Er{radius;constructor(t){super(t),this.radius=t?.radius??0}toSVGPathData(){return[this.x,this.y]}toSVGPathD(){return`${this.x},${this.y}`}setX(t){this.x=t}setY(t){this.y=t}setXY(t,e){this.x=t,this.y=e}eq(t){return this.x===t.x&&this.y===t.y}midPointBtw(t){return new Wt({x:this.x+(t.x-this.x)/2,y:this.y+(t.y-this.y)/2})}toArray(){return[this.x,this.y]}clone(t){this.setXY(t.x,t.y)}getBounds(){return new jn({x:this.x-this.radius,y:this.y-this.radius,width:this.radius*2,height:this.radius*2})}nextFrameCollisionTo(t){const e=t.x-this.x,i=t.y-this.y;if(Math.sqrt(e*e+i*i)<this.radius+t.radius){const a=Math.atan2(i,e),o=Math.sin(a),h=Math.cos(a),l={x:0,y:0},c=s(e,i,o,h,!0),d=s(this.vx,this.vy,o,h,!0),f=s(t.vx,t.vy,o,h,!0),u=d.x-f.x;d.x=((this.mass-t.mass)*d.x+2*t.mass*f.x)/(this.mass+t.mass),f.x=u+d.x;const m=Math.abs(d.x)+Math.abs(f.x),v=this.radius+t.radius-Math.abs(l.x-c.x);l.x+=d.x/m*v,c.x+=f.x/m*v;const b=s(l.x,l.y,o,h,!1),S=s(c.x,c.y,o,h,!1);t.x=this.x+S.x,t.y=this.y+S.y,this.x=this.x+b.x,this.y=this.y+b.y;const E=s(d.x,d.y,o,h,!1),_=s(f.x,f.y,o,h,!1);this.vx=E.x,this.vy=E.y,t.vx=_.x,t.vy=_.y}function s(a,o,h,l,c=!1){return{x:c?a*l+o*h:a*l-o*h,y:c?o*l-a*h:o*l+a*h}}}nextFrameBounce(t){const e=t.left,i=t.top,r=t.right,s=t.bottom,a=t?.bounce??-1;this.x+this.radius>r?(this.x=r-this.radius,this.vx*=a):this.x-this.radius<e&&(this.x=e+this.radius,this.vx*=a),this.y+this.radius>s?(this.y=s-this.radius,this.vy*=a):this.y-this.radius<i&&(this.y=i+this.radius,this.vy*=a)}}class Pr extends Wt{startPoint;startTime;slideDetectDuration=300;slideDetectDistance=10;directionDebounceDuration=100;getDirectionDebounce=t=>O1((e,i,r,s)=>t(vc(e,i,r,s)),this.directionDebounceDuration);constructor(t={x:0,y:0}){super(t),this.startPoint=new Wt({x:this.x,y:this.y}),this.startTime=new Date}static isTouchEnabled(){return"ontouchstart"in window||navigator.maxTouchPoints>0}capture(t,e={}){return Pr.isTouchEnabled()?this.capturePointer(t,e):this.captureMouse(t,e)}captureMouse(t,e={}){const i=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,document.addEventListener("mousemove",o,!1),document.addEventListener("mouseup",r,!1),t.style.userSelect="none",t.style.webkitUserSelect="",this.startPoint.x=this.x,this.startPoint.y=this.y,this.startTime=new Date,e.start?.(this)},r=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,document.removeEventListener("mouseup",r,!1),document.removeEventListener("mousemove",o,!1),t.style.userSelect="",t.style.webkitUserSelect="",e.end?.(this)},s=this.getDirectionDebounce(h=>{new Date().getTime()-this.startTime.getTime()>this.slideDetectDuration||(h=="left"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance?e.slideLeft?.(this.x-this.startPoint.x,this.y-this.startPoint.y):h=="right"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance&&e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y))}),a=h=>{!h.target||t==h.target||t.contains(h.target)||e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y)},o=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,s(this.startPoint.x,this.startPoint.y,this.x,this.y),e.move?.(this)};return t.addEventListener("mousedown",i,!1),document.addEventListener("mousedown",a,!1),()=>{t.removeEventListener("mousedown",i,!1),document.removeEventListener("mousedown",a,!1)}}captureTouch(t,e={}){const i=h=>{h.preventDefault();const l=h.changedTouches[0],c=ze(t,l);this.x=c.x,this.y=c.y,this.startPoint.x=this.x,this.startPoint.y=this.y,this.startTime=new Date,e.start?.(this)},r=h=>{const l=h.changedTouches[0],c=ze(t,l);this.x=c.x,this.y=c.y,e.end?.(this)},s=this.getDirectionDebounce(h=>{new Date().getTime()-this.startTime.getTime()>this.slideDetectDuration||(h=="left"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance?e.slideLeft?.(this.x-this.startPoint.x,this.y-this.startPoint.y):h=="right"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance&&e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y))}),a=h=>{!h.target||t==h.target||t.contains(h.target)||e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y)},o=h=>{const l=h.changedTouches[0],c=ze(t,l);this.x=c.x,this.y=c.y,s(this.startPoint.x,this.startPoint.y,this.x,this.y),e.move?.(this)};return t.addEventListener("touchstart",i,!1),t.addEventListener("touchend",r,!1),t.addEventListener("touchcancel",r,!1),t.addEventListener("touchmove",o,!1),document.addEventListener("touchstart",a,!1),()=>{t.removeEventListener("touchstart",i,!1),t.removeEventListener("touchend",r,!1),t.removeEventListener("touchcancel",r,!1),t.removeEventListener("touchmove",o,!1),document.removeEventListener("touchstart",a,!1)}}capturePointer(t,e={}){const i=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,t.setPointerCapture(h.pointerId),t.style.userSelect="none",t.style.webkitUserSelect="",this.startPoint.x=this.x,this.startPoint.y=this.y,this.startTime=new Date,e.start?.(this)},r=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,t.style.userSelect="",t.style.webkitUserSelect="",e.end?.(this)},s=this.getDirectionDebounce(h=>{new Date().getTime()-this.startTime.getTime()>this.slideDetectDuration||(h=="left"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance?e.slideLeft?.(this.x-this.startPoint.x,this.y-this.startPoint.y):h=="right"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance&&e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y))}),a=h=>{!h.target||t==h.target||t.contains(h.target)||e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y)},o=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,s(this.startPoint.x,this.startPoint.y,this.x,this.y),e.move?.(this)};return t.addEventListener("pointerdown",i,!1),t.addEventListener("pointerup",r,!1),t.addEventListener("pointercancel",r,!1),t.addEventListener("pointermove",o,!1),document.addEventListener("pointerdown",a,!1),()=>{t.removeEventListener("pointerdown",i,!1),t.removeEventListener("pointerup",r,!1),t.removeEventListener("pointercancel",r,!1),t.removeEventListener("pointermove",o,!1),document.removeEventListener("pointerdown",a,!1)}}static clickEvent=typeof document<"u"&&document.ontouchstart?"touchstart":"click";static getMouseButton(t){if(document.implementation.hasFeature("MouseEvents","2.0"))return t.button;switch(t.button){case 0:case 1:case 3:case 5:case 7:return 0;case 2:case 6:return 2;case 4:return 1}}}function Fo(n,t){if(typeof t<"u")window.localStorage.setItem(n,t);else return window.localStorage.getItem(n)??void 0}function xg(n,t,e){const i=new Date;i.setTime(i.getTime()+e*24*60*60*1e3);const r="expires="+i.toUTCString();document.cookie=n+"="+t+"; "+r}function Sg(n){const t=n+"=",e=document.cookie.split(";");for(let i=0,r=e.length;i<r;i++){const s=e[i].trim();if(s.indexOf(t)==0)return s.substring(t.length,s.length)}return""}const Cg=()=>document.cookie.split(";").map(n=>n.split("=")).reduce((n,[t,e])=>(n[t.trim().replace('"',"")]=e,n),{}),Tg=()=>document.cookie.split(";").forEach(n=>document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`));class kg{static theme(t){return t=t||Fo("theme"),typeof t>"u"&&(t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Fo("theme",t),document.documentElement.classList.toggle("dark",t==="dark"),t}static has(t){return window.matchMedia(t).matches||!1}static on(t,e){window.matchMedia(t).addEventListener("change",e)}static off(t,e){window.matchMedia(t).removeEventListener("change",e)}}class Eg{static addEventListener(t,e,i){t.addEventListener(e,i,!1)}static removeEventListener(t,e,i){t.removeEventListener(e,i,!1)}static getTarget(t){return t.target||t.srcElement}}class Pg{static setPageVerticalScrollPercent(t,e="width"){const i=Do(t);i.css("transition","all linear 30ms");const{clientHeight:r}=aa(),{scrollTop:s,scrollHeight:a}=Hn(),o=a-r,h=o<=0?0:s/o*100;i.css(e,h+"%")}static pullDownRefresh(t,e,i=50){let r=0,s=0;t.addEventListener("touchstart",function(a){r=a.touches[0].pageY,t.style.position="relative",t.style.transition="transform 0s"},!1),t.addEventListener("touchmove",function(a){s=a.touches[0].pageY-r,s>0&&s<i&&(t.style.transform="translateY("+s+"px)")},!1),t.addEventListener("touchend",function(a){t.style.transition="transform 0.5s ease 1s",t.style.transform="translateY(0px)",s>=i&&e()},!1)}static pullUpLoading(t,e=50){const{clientHeight:i}=aa(),{scrollTop:r,scrollHeight:s}=Hn();r+i>=s-e&&t()}static scrollTo=(t={x:0,y:0})=>window.scrollTo(t.x,t.y)}const Ag={width:500,height:500};class _c{app;constructor(t){this.app=t}}var yc={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
18
|
+
})`}static safeHtml(t,e="encode"){const i={"&":"&","<":"<",">":">",""":'"',"'":"'"};for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t=t.replace(new RegExp(e=="decode"?r:i[r],"g"),e=="decode"?i[r]:r));return t}static loadScript(t,e=()=>{},i=(r,s,a,o,h)=>{}){const r=document.createElement("script");r.type="text/javascript",r.src=t,r.async=!1,document.body.appendChild(r),r.onload=e,r.onerror=i}static loadStyle(t){const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.insertBefore(e,document.head.childNodes[document.head.childNodes.length-1].nextSibling)}static waitForStyleSheetsLoaded=()=>new Promise(t=>{const e=Array.from(document.querySelectorAll("link[rel=stylesheet]"));let i=document.styleSheets.length??0;const r=()=>i>=e.length?(t(),!0):!1;r()||e.forEach(s=>{s.onload=()=>{i+=1,r()}})});static lazyloadImages(){const t=document.getElementsByTagName("img"),e=oa().height;let i=0;return()=>{for(let r=i;r<t.length;r++)t[r].getBoundingClientRect().top<e&&(t[r].src=t[r].getAttribute("data-src")??"",i=r+1)}}static iframePostMessage(t,e="http://test.com/localstorage.html"){const i=document.createElement("iframe");i.src=e,document.body.append(i),setTimeout(function(){i.contentWindow?.postMessage(t,e)},4e3),setTimeout(function(){i.remove()},6e3)}static getTextWidth=(t,e,i=400)=>{const r=document.createElement("span");r.style.visibility="hidden",r.style.padding="0",r.style.whiteSpace="nowrap",r.style.overflow="visible",r.style.fontSize=e>12?e+"px":"12px",r.style.fontWeight=i.toString(),r.innerText=t,document.body.appendChild(r);const s=r.offsetWidth;return document.body.removeChild(r),s};static getFixedWidthText=(t,e,i=12,r=400,s=!0)=>{let a="",o="",h="";if(!t||e<i||typeof t!="string")return a;const l=t.split(""),c=document.createElement("span");c.style.visibility="hidden",c.style.padding="0",c.style.whiteSpace="nowrap",c.style.overflow="visible",c.style.fontSize=i>12?i+"px":"12px",c.style.fontWeight=r.toString(),document.body.appendChild(c);for(let d=0,f=l.length;d<f;d++){const u=l[d];if(o=h,h+=u,a=h,c.innerText=h,c.offsetWidth>e){s?a=o+"...":a=o;break}}return document.body.removeChild(c),a};static getLocation(){return new Promise((t,e)=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(i=>{t(i.coords)}):e("Geolocation is not supported by this browser")})}static vibrate(t=200){"vibrate"in navigator?window.navigator.vibrate(t):console.error("Your device is not support vibrate on this browser.")}static copyToClipboard=t=>navigator.clipboard.writeText(t);static getSelectedText=()=>window.getSelection()?.toString();static siblings=t=>Array.prototype.slice.call(t.parentNode?.children).filter(e=>e!==t);static isElementFocus=t=>t===document.activeElement;static isTabInView=()=>!document.hidden;static navigateBack=()=>history.back();static navigateBack2=()=>history.go(-1);static addDebuggerOnBeforeUnload=()=>{window.addEventListener("beforeunload",()=>{debugger})}}function Do(n,t=document){return new oe(n,t)}class oe{context;nodes;prefixs=["moz","o","ms","webkit"];constructor(t,e=document){if(this.context=e,typeof t=="string"?this.nodes=Array.from(this.context.querySelectorAll(t)):t instanceof HTMLElement?this.nodes=[t]:this.nodes=t,this.nodes.length===0)throw new Error(`can not find ${t}`);this.each((i,r)=>{i instanceof HTMLInputElement&&i.addEventListener("change",s=>{this.changeRadioChecked(s.currentTarget.value)}),i instanceof HTMLSelectElement&&i.addEventListener("change",s=>{this.changeSelectSelected(s.currentTarget.value)})})}get(t){return t<0&&(t=this.nodes.length+t),this.nodes[t]}concat(t){return new oe(this.nodes.concat(t.nodes),this.context)}then(t){return t(this)??this}each(t){return this.nodes.forEach((e,i)=>{t(e,i)}),this}_save(t,e,i){t._mQuery||(t._mQuery={}),Array.isArray(i)?(t._mQuery[e]=t._mQuery[e]??[],t._mQuery[e].push(...i)):i!=null?t._mQuery[e]=i:delete t._mQuery[e]}on(t,e,i){return this.nodes.forEach(r=>{this._save(r,"events",[{event:t,callback:e,options:i}]),r.addEventListener(t,e,i)}),this}off(t,e,i){return this.nodes.forEach(r=>{r.removeEventListener(t,e,i)}),this}dispatchEvent(t,e){let i;const r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return typeof t=="string"?r.includes(t)?i=new MouseEvent(t,e):s.includes(t)?i=new KeyboardEvent(t,e):i=new Event(t,e):i=t,this.nodes.forEach(a=>{a.dispatchEvent(i)}),this}change(){return this.dispatchEvent("change")}click(){return this.dispatchEvent("click")}static hasEvent(t,e){return"on"+e in t}static _fragment(t){const e=document.createElement("template");return e.innerHTML=t,e.content.childNodes.forEach(i=>{const r=oe._scriptConvert(i);r!=i&&e.content.replaceChild(r,i)}),e.content}static _scriptConvert(t){const e=i=>{const s=i.ownerDocument.createElement("script");s.text=i.text;const a=i.attributes;for(let o=0;o<a.length;o++)s.setAttribute(a[o].name,a[o].value);return s};return t.tagName=="SCRIPT"&&(t=e(t)),t.querySelectorAll&&t.querySelectorAll("script").forEach(i=>{i.parentNode?.replaceChild(e(i),i)}),t}static _fixProp(t){const e={cellpadding:"cellPadding",cellspacing:"cellSpacing",class:"className",colspan:"colSpan",contenteditable:"contentEditable",for:"htmlFor",frameborder:"frameBorder",maxlength:"maxLength",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"};return e[t]?e[t]:t}static isSVG(t){return(t||document.documentElement).nodeName.toLowerCase()==="svg"}static createElement(t){return oe.isSVG()?document.createElementNS.call(document,"http://www.w3.org/2000/svg",t):document.createElement.call(document,t)}static createTextNode(t){return document.createTextNode.call(document,t)}static createDocumentFragment(){return document.createDocumentFragment.call(document)}_insert(t,e){const i=this.nodes.length;if(i<1)return this;const r=[];if(typeof e=="string")this.nodes.forEach(s=>{const a=oe._fragment(e);r.push(...a.children),s[t](a)});else if(e instanceof HTMLElement)this.each(s=>{const a=i===1?e:oe._fragment(e.outerHTML);r.push(...i===1?[e]:a.children),s[t](a)}),i>1&&e.remove();else if(e instanceof oe){const s=i==1;e.each(a=>{this.each(o=>{const h=s?a:a.cloneNode(!0);r.push(h),o[t](h),oe._scriptConvert(h)})}),s||e.remove()}return t=="replaceWith"&&(this.nodes=r),this}append(t){return this._insert("append",t)}prepend(t){return this._insert("prepend",t)}after(t){return this._insert("after",t)}before(t){return this._insert("before",t)}replace(t){return this._insert("replaceWith",t)}remove(){return this.nodes.forEach(t=>{t.remove()}),this}static removeChild(t){t.parentElement?.removeChild(t)}find(t){const e=[];return this.nodes.forEach(i=>{e.push(...Array.from(i.querySelectorAll(t)))}),new oe(e,this.context)}filter(t){const e=[];return this.nodes.forEach(i=>{(i===t||typeof t=="string"&&i.matches&&i.matches(t))&&e.push(i)}),new oe(e,this.context)}next(){const t=[];return this.nodes.forEach(e=>{const i=e.nextElementSibling;i&&t.push(i)}),new oe(t,this.context)}prev(){const t=[];return this.nodes.forEach(e=>{const i=e.previousElementSibling;i&&t.push(i)}),new oe(t,this.context)}closest(t){const e=[];return this.nodes.forEach(i=>{const r=i.closest(t);r&&e.push(r)}),new oe(e,this.context)}shadow(t){const e=[];this.nodes.forEach(r=>{r.shadowRoot&&e.push(r.shadowRoot)});const i=new oe(e,this.context);return t!==void 0?i.find(t):i}parent(t){return this.parents(t,!0)}parents(t,e=!1){const i=[],r=a=>{if(i.indexOf(a)==-1&&i.push(a),!e&&a.parentElement)return r(a.parentElement)};this.nodes.forEach(a=>{a.parentElement&&r(a.parentElement)});const s=new oe(i,this.context);return t!==void 0?s.filter(t):s}static getComputedStyle(t,e,i){let r;const s=t.style.getPropertyPriority(e);return"getComputedStyle"in window?(r=getComputedStyle.call(window,t,i),r=r.getPropertyValue(e)):r=t.style.getPropertyValue(e),r+(s?"!"+s:"")}css(t,e){if((t===void 0||typeof t=="string")&&e===void 0){const i=this.nodes[0].style;if(typeof t=="string"){const r=i.getPropertyPriority(t),s=i.getPropertyValue(t).trim();return s?s+(r?"!"+r:""):oe.getComputedStyle(this.nodes[0],t)}else{const r=Object.fromEntries(this.nodes[0].style.cssText.split(";").filter(s=>!!s).map(s=>s.split(":").map(a=>a.trim())));return Object.assign(r,getComputedStyle.call(window,this.nodes[0])),r}}else{let i={};return typeof t=="string"&&e!==void 0?i[t]=e:typeof t=="object"&&(i=t),this.nodes.forEach(r=>{Object.keys(i).forEach(s=>{const a=String(i[s]).toLowerCase().includes("!important")?"important":"";r.style.setProperty(s,String(i[s]).replace(/!important/i,""),a)})}),this}}addClass(t){return this.toggleClass(t,!0)}removeClass(t){return this.toggleClass(t,!1)}toggleClass(t,e){const i=t.split(/[,\s]+/);return this.nodes.forEach(r=>{i.forEach(s=>{if(s.trim()!==""){let a="toggle";e!==void 0&&(a=e?"add":"remove"),r.classList[a](s.trim())}})}),this}hasClass(t){const e=t.split(/[,\s]+/);let i=!1;return this.nodes.forEach(r=>{i=i||e.every(s=>Array.from(r.classList??[]).includes(s.trim()))}),i}attr(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0].getAttribute(t);let i={};return typeof t=="object"?i=t:e!==void 0&&(i[t]=e),this.nodes.forEach(r=>{Object.entries(i).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}removeAttr(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(i=>{e.forEach(r=>{i.removeAttribute(r)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0][t];{let i={};return typeof t=="object"?i=t:typeof t=="string"&&e!==void 0&&(i[t]=e),this.nodes.forEach(r=>{Object.entries(i).forEach(([s,a])=>{const o=oe._fixProp(s);r[o]=a,o=="innerHTML"&&oe._scriptConvert(r)})}),this}}removeProp(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(i=>{e.forEach(r=>{delete i[oe._fixProp(r)]})}),this}changeSelectSelected(t){this.nodes.forEach(e=>{if(e instanceof HTMLSelectElement){const i=e.options;for(let r=0,s=i.length;r<s;r++)i[r].value==t?i[r].selected=!0:i[r].selected=!1}})}changeRadioChecked(t){this.nodes.forEach(e=>{e instanceof HTMLInputElement&&(e.value==t?e.checked=!0:e.checked=!1)})}data(t,e){if(typeof t=="string"&&t.indexOf("-")!=-1)throw new Error(`Key "${t}" contains "-" (dash). Dashes are not allowed in property names. Use camelCase instead.`);if((typeof t=="string"||t===void 0)&&e===void 0){const i=Object.assign({},this.nodes[0].dataset);return Object.keys(i).forEach(r=>{if(i[r]?.startsWith("[")||i[r]?.startsWith("{"))try{i[r]=JSON.parse(i[r]??"")}catch{}}),typeof t=="string"?i[t]:i}else{let i={};return typeof t=="object"?i=t:typeof t=="string"&&(i[t]=e),this.nodes.forEach(r=>{Object.entries(i).forEach(([s,a])=>{a!=null?r.dataset[s]=a instanceof Object?JSON.stringify(a):a:delete r.dataset[s]})}),this}}removeData(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(i=>{e.forEach(r=>{delete i.dataset[r]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.nodes.forEach(e=>{const i=e.style.display,r=getComputedStyle(e).display,s=i=="none"||r=="none";if(s&&(t===void 0||t===!0)){const a=e instanceof HTMLTableRowElement?"table-row":e instanceof HTMLTableCellElement?"table-cell":"block";e.style.display=e._mQuery?.prevDisplay??(i==r&&r!="none"?"":a),this._save(e,"prevDisplay",null)}!s&&(t==null||t===!1)&&(r!="none"&&this._save(e,"prevDisplay",r),e.style.setProperty("display","none"))})}empty(){return this.html("")}html(t){return t instanceof HTMLElement?this.empty().append(t.innerHTML):this.prop("innerHTML",t)}text(t){return this.prop("textContent",t)}val(t){return this.prop("value",t)}}class Qt{constructor(){}static getFormatKeyNames(t){const e=Ro(),i=[];return t.ctrl&&i.push(e?"Cmd":"Ctrl"),t.shift&&i.push(e?"Option":"Shift"),t.alt&&i.push("Alt"),typeof t.key=="string"?i.push(Ll(t.key)):Array.isArray(t.key)&&(t.key.map(r=>Ll(r)),i.push(...t.key)),i}static matchKeyScheme(t,e){const i=t.ctrl??!1,r=t.shift??!1,s=t.alt??!1;if(t.exact)return(i===e.metaKey||i===e.ctrlKey)&&r===e.shiftKey&&s===e.altKey;const a=[];return i&&a.push(i===e.metaKey||i===e.ctrlKey),r&&a.push(r===e.shiftKey),s&&a.push(s===e.altKey),a.every(o=>o)}static on(t,e){if(t?.key===void 0||t?.key===null)return e;const i=t?.target??window;let r=!1;const s=this.getFormatKeyNames(t),a=o=>{if(o.stopPropagation(),!r&&o.key!=="Control"&&o.key!=="Meta"&&o.key!=="Shift"&&o.key!=="Option"&&o.key!=="Alt"&&s.find(h=>h.toLowerCase()===o.key.toLowerCase())&&this.matchKeyScheme(t,o)){o.preventDefault();const h=e(o);if(typeof h!="function")return;const l=c=>{c.preventDefault(),h(c),i.removeEventListener("keyup",l)};i.addEventListener("keyup",l)}};return i.addEventListener("keydown",a),e.title=t?.title??"",e.formatedKeyNames=s,e.pause=()=>r=!0,e.unpause=()=>r=!1,e.removeListener=()=>i.removeEventListener("keydown",a),e}}function la(n){return n*Math.PI/180}function Lo(n){return n*180/Math.PI}function mc(n,t,e,i){const r=n-e,s=t-i;return Math.sqrt(r*r+s*s)}function Io(n,t,e,i){const r=e-n,s=i-t;return Math.atan2(s,r)}function ca(n){return n[0]*n[0]+n[1]*n[1]}function Fo(n){const t=Math.sqrt(ca(n));n[0]&&(n[0]/=t),n[1]&&(n[1]/=t)}function vc(n,t,e,i,r=10){if(Math.abs(e-n)<r&&Math.abs(i-t)<r)return"no";const s=Lo(Io(n,t,e,i));return s>=-135&&s<=-45?"up":s>45&&s<135?"down":s>=135&&s<=180||s>=-180&&s<-135?"left":s>=-45&&s<=45?"right":"no"}class Er{x;y;vx;vy;ax;ay;mass;constructor(t){this.x=t.x,this.y=t.y,this.vx=t?.vx||0,this.vy=t?.vy||0,this.ax=t?.ax||0,this.ay=t?.ay||0,this.mass=t?.mass||0}fromAngleAndLength(t,e){return new Er({x:Math.cos(t)*e,y:Math.sin(t)*e})}distanceTo(t){return mc(this.x,this.y,t.x,t.y)}angleTo(t){return Io(this.x,this.y,t.x,t.y)}followTo(t,e=3){const i=this.angleTo(t),{x:r,y:s}=this.fromAngleAndLength(i,e);this.vx=r,this.vy=s,this.nextFrame()}followAccelerationTo(t,e=.05){const i=this.angleTo(t),{x:r,y:s}=this.fromAngleAndLength(i,e);this.ax=r,this.ay=s,this.nextFrame()}nextFrame(t){const e=t?.gravity??0,i=t?.friction??0;if(this.vx+=this.ax,this.vy+=this.ay,this.vy+=e,i>0){const r=Math.atan2(this.vy,this.vx);let s=Math.sqrt(this.vx*this.vx+this.vy*this.vy);s>i?s-=i:s=0,this.vx=Math.cos(r)*s,this.vy=Math.sin(r)*s}this.x+=this.vx,this.y+=this.vy}nextFrameEaseTo(t,e){const i=e?.gravity??0,r=e?.friction??1,s=e?.easing??.05,a=t.x-this.x,o=t.y-this.y;this.vx=a*s,this.vy=o*s,this.vy+=i,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy}nextFrameSpringTo(t,e){const i=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03;(Array.isArray(t)?t:[t]).forEach(o=>{const h=o.x-this.x,l=o.y-this.y,c=h*s,d=l*s;this.vx+=c,this.vy+=d}),this.vy+=i,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy}nextFrameSpringConnect(t,e){const i=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03,a=e?.springLength??100,o=this.angleTo(t);this.nextFrameSpringTo(new Er({x:t.x-Math.cos(o)*a,y:t.y-Math.sin(o)*a}),{spring:s,friction:r,gravity:i})}}let jn=class extends Er{width;height;constructor(t){super(t),this.width=t.width,this.height=t.height}eq(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}isIntersectRect(t){return!(this.x+this.width<t.x||t.x+t.width<this.x||this.y+this.height<t.y||t.y+t.height<this.y)}isContainPoint(t){return!(t.x<this.x||t.x>this.x+this.width||t.y<this.y||t.y>this.y+this.height)}toArray(){return[this.x,this.y,this.width,this.height]}clone(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}};class Wt extends Er{radius;constructor(t){super(t),this.radius=t?.radius??0}toSVGPathData(){return[this.x,this.y]}toSVGPathD(){return`${this.x},${this.y}`}setX(t){this.x=t}setY(t){this.y=t}setXY(t,e){this.x=t,this.y=e}eq(t){return this.x===t.x&&this.y===t.y}midPointBtw(t){return new Wt({x:this.x+(t.x-this.x)/2,y:this.y+(t.y-this.y)/2})}toArray(){return[this.x,this.y]}clone(t){this.setXY(t.x,t.y)}getBounds(){return new jn({x:this.x-this.radius,y:this.y-this.radius,width:this.radius*2,height:this.radius*2})}nextFrameCollisionTo(t){const e=t.x-this.x,i=t.y-this.y;if(Math.sqrt(e*e+i*i)<this.radius+t.radius){const a=Math.atan2(i,e),o=Math.sin(a),h=Math.cos(a),l={x:0,y:0},c=s(e,i,o,h,!0),d=s(this.vx,this.vy,o,h,!0),f=s(t.vx,t.vy,o,h,!0),u=d.x-f.x;d.x=((this.mass-t.mass)*d.x+2*t.mass*f.x)/(this.mass+t.mass),f.x=u+d.x;const m=Math.abs(d.x)+Math.abs(f.x),v=this.radius+t.radius-Math.abs(l.x-c.x);l.x+=d.x/m*v,c.x+=f.x/m*v;const b=s(l.x,l.y,o,h,!1),S=s(c.x,c.y,o,h,!1);t.x=this.x+S.x,t.y=this.y+S.y,this.x=this.x+b.x,this.y=this.y+b.y;const E=s(d.x,d.y,o,h,!1),_=s(f.x,f.y,o,h,!1);this.vx=E.x,this.vy=E.y,t.vx=_.x,t.vy=_.y}function s(a,o,h,l,c=!1){return{x:c?a*l+o*h:a*l-o*h,y:c?o*l-a*h:o*l+a*h}}}nextFrameBounce(t){const e=t.left,i=t.top,r=t.right,s=t.bottom,a=t?.bounce??-1;this.x+this.radius>r?(this.x=r-this.radius,this.vx*=a):this.x-this.radius<e&&(this.x=e+this.radius,this.vx*=a),this.y+this.radius>s?(this.y=s-this.radius,this.vy*=a):this.y-this.radius<i&&(this.y=i+this.radius,this.vy*=a)}}class Pr extends Wt{startPoint;startTime;slideDetectDuration=300;slideDetectDistance=10;directionDebounceDuration=100;getDirectionDebounce=t=>F1((e,i,r,s)=>t(vc(e,i,r,s)),this.directionDebounceDuration);constructor(t={x:0,y:0}){super(t),this.startPoint=new Wt({x:this.x,y:this.y}),this.startTime=new Date}static isTouchEnabled(){return"ontouchstart"in window||navigator.maxTouchPoints>0}capture(t,e={}){return Pr.isTouchEnabled()?this.capturePointer(t,e):this.captureMouse(t,e)}captureMouse(t,e={}){const i=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,document.addEventListener("mousemove",o,!1),document.addEventListener("mouseup",r,!1),t.style.userSelect="none",t.style.webkitUserSelect="",this.startPoint.x=this.x,this.startPoint.y=this.y,this.startTime=new Date,e.start?.(this)},r=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,document.removeEventListener("mouseup",r,!1),document.removeEventListener("mousemove",o,!1),t.style.userSelect="",t.style.webkitUserSelect="",e.end?.(this)},s=this.getDirectionDebounce(h=>{new Date().getTime()-this.startTime.getTime()>this.slideDetectDuration||(h=="left"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance?e.slideLeft?.(this.x-this.startPoint.x,this.y-this.startPoint.y):h=="right"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance&&e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y))}),a=h=>{!h.target||t==h.target||t.contains(h.target)||e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y)},o=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,s(this.startPoint.x,this.startPoint.y,this.x,this.y),e.move?.(this)};return t.addEventListener("mousedown",i,!1),document.addEventListener("mousedown",a,!1),()=>{t.removeEventListener("mousedown",i,!1),document.removeEventListener("mousedown",a,!1)}}captureTouch(t,e={}){const i=h=>{h.preventDefault();const l=h.changedTouches[0],c=ze(t,l);this.x=c.x,this.y=c.y,this.startPoint.x=this.x,this.startPoint.y=this.y,this.startTime=new Date,e.start?.(this)},r=h=>{const l=h.changedTouches[0],c=ze(t,l);this.x=c.x,this.y=c.y,e.end?.(this)},s=this.getDirectionDebounce(h=>{new Date().getTime()-this.startTime.getTime()>this.slideDetectDuration||(h=="left"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance?e.slideLeft?.(this.x-this.startPoint.x,this.y-this.startPoint.y):h=="right"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance&&e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y))}),a=h=>{!h.target||t==h.target||t.contains(h.target)||e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y)},o=h=>{const l=h.changedTouches[0],c=ze(t,l);this.x=c.x,this.y=c.y,s(this.startPoint.x,this.startPoint.y,this.x,this.y),e.move?.(this)};return t.addEventListener("touchstart",i,!1),t.addEventListener("touchend",r,!1),t.addEventListener("touchcancel",r,!1),t.addEventListener("touchmove",o,!1),document.addEventListener("touchstart",a,!1),()=>{t.removeEventListener("touchstart",i,!1),t.removeEventListener("touchend",r,!1),t.removeEventListener("touchcancel",r,!1),t.removeEventListener("touchmove",o,!1),document.removeEventListener("touchstart",a,!1)}}capturePointer(t,e={}){const i=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,t.setPointerCapture(h.pointerId),t.style.userSelect="none",t.style.webkitUserSelect="",this.startPoint.x=this.x,this.startPoint.y=this.y,this.startTime=new Date,e.start?.(this)},r=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,t.style.userSelect="",t.style.webkitUserSelect="",e.end?.(this)},s=this.getDirectionDebounce(h=>{new Date().getTime()-this.startTime.getTime()>this.slideDetectDuration||(h=="left"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance?e.slideLeft?.(this.x-this.startPoint.x,this.y-this.startPoint.y):h=="right"&&Math.abs(this.x-this.startPoint.x)>=this.slideDetectDistance&&e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y))}),a=h=>{!h.target||t==h.target||t.contains(h.target)||e.slideRight?.(this.x-this.startPoint.x,this.y-this.startPoint.y)},o=h=>{const l=ze(t,h);this.x=l.x,this.y=l.y,s(this.startPoint.x,this.startPoint.y,this.x,this.y),e.move?.(this)};return t.addEventListener("pointerdown",i,!1),t.addEventListener("pointerup",r,!1),t.addEventListener("pointercancel",r,!1),t.addEventListener("pointermove",o,!1),document.addEventListener("pointerdown",a,!1),()=>{t.removeEventListener("pointerdown",i,!1),t.removeEventListener("pointerup",r,!1),t.removeEventListener("pointercancel",r,!1),t.removeEventListener("pointermove",o,!1),document.removeEventListener("pointerdown",a,!1)}}static clickEvent=typeof document<"u"&&document.ontouchstart?"touchstart":"click";static getMouseButton(t){if(document.implementation.hasFeature("MouseEvents","2.0"))return t.button;switch(t.button){case 0:case 1:case 3:case 5:case 7:return 0;case 2:case 6:return 2;case 4:return 1}}}function Oo(n,t){if(typeof t<"u")window.localStorage.setItem(n,t);else return window.localStorage.getItem(n)??void 0}function xg(n,t,e){const i=new Date;i.setTime(i.getTime()+e*24*60*60*1e3);const r="expires="+i.toUTCString();document.cookie=n+"="+t+"; "+r}function Sg(n){const t=n+"=",e=document.cookie.split(";");for(let i=0,r=e.length;i<r;i++){const s=e[i].trim();if(s.indexOf(t)==0)return s.substring(t.length,s.length)}return""}const Cg=()=>document.cookie.split(";").map(n=>n.split("=")).reduce((n,[t,e])=>(n[t.trim().replace('"',"")]=e,n),{}),Tg=()=>document.cookie.split(";").forEach(n=>document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`));class kg{static theme(t){return t=t||Oo("theme"),typeof t>"u"&&(t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Oo("theme",t),document.documentElement.classList.toggle("dark",t==="dark"),t}static has(t){return window.matchMedia(t).matches||!1}static on(t,e){window.matchMedia(t).addEventListener("change",e)}static off(t,e){window.matchMedia(t).removeEventListener("change",e)}}class Eg{static addEventListener(t,e,i){t.addEventListener(e,i,!1)}static removeEventListener(t,e,i){t.removeEventListener(e,i,!1)}static getTarget(t){return t.target||t.srcElement}}class Pg{static setPageVerticalScrollPercent(t,e="width"){const i=Do(t);i.css("transition","all linear 30ms");const{clientHeight:r}=aa(),{scrollTop:s,scrollHeight:a}=Hn(),o=a-r,h=o<=0?0:s/o*100;i.css(e,h+"%")}static pullDownRefresh(t,e,i=50){let r=0,s=0;t.addEventListener("touchstart",function(a){r=a.touches[0].pageY,t.style.position="relative",t.style.transition="transform 0s"},!1),t.addEventListener("touchmove",function(a){s=a.touches[0].pageY-r,s>0&&s<i&&(t.style.transform="translateY("+s+"px)")},!1),t.addEventListener("touchend",function(a){t.style.transition="transform 0.5s ease 1s",t.style.transform="translateY(0px)",s>=i&&e()},!1)}static pullUpLoading(t,e=50){const{clientHeight:i}=aa(),{scrollTop:r,scrollHeight:s}=Hn();r+i>=s-e&&t()}static scrollTo=(t={x:0,y:0})=>window.scrollTo(t.x,t.y)}const Ag={width:500,height:500};class _c{app;constructor(t){this.app=t}}var yc={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
19
19
|
* http://hammerjs.github.io/
|
|
20
20
|
*
|
|
21
21
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
22
22
|
* Licensed under the MIT license */(function(n){(function(t,e,i,r){var s=["","webkit","Moz","MS","ms","o"],a=e.createElement("div"),o="function",h=Math.round,l=Math.abs,c=Date.now;function d(g,y,k){return setTimeout(_(g,k),y)}function f(g,y,k){return Array.isArray(g)?(u(g,k[y],k),!0):!1}function u(g,y,k){var M;if(g)if(g.forEach)g.forEach(y,k);else if(g.length!==r)for(M=0;M<g.length;)y.call(k,g[M],M,g),M++;else for(M in g)g.hasOwnProperty(M)&&y.call(k,g[M],M,g)}function m(g,y,k){var M="DEPRECATED METHOD: "+y+`
|
|
23
23
|
`+k+` AT
|
|
24
|
-
`;return function(){var O=new Error("get-stack-trace"),G=O&&O.stack?O.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",H=t.console&&(t.console.warn||t.console.log);return H&&H.call(t.console,M,G),g.apply(this,arguments)}}var v;typeof Object.assign!="function"?v=function(y){if(y===r||y===null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(y),M=1;M<arguments.length;M++){var O=arguments[M];if(O!==r&&O!==null)for(var G in O)O.hasOwnProperty(G)&&(k[G]=O[G])}return k}:v=Object.assign;var b=m(function(y,k,M){for(var O=Object.keys(k),G=0;G<O.length;)(!M||M&&y[O[G]]===r)&&(y[O[G]]=k[O[G]]),G++;return y},"extend","Use `assign`."),S=m(function(y,k){return b(y,k,!0)},"merge","Use `assign`.");function E(g,y,k){var M=y.prototype,O;O=g.prototype=Object.create(M),O.constructor=g,O._super=M,k&&v(O,k)}function _(g,y){return function(){return g.apply(y,arguments)}}function x(g,y){return typeof g==o?g.apply(y&&y[0]||r,y):g}function P(g,y){return g===r?y:g}function R(g,y,k){u(U(y),function(M){g.addEventListener(M,k,!1)})}function F(g,y,k){u(U(y),function(M){g.removeEventListener(M,k,!1)})}function L(g,y){for(;g;){if(g==y)return!0;g=g.parentNode}return!1}function $(g,y){return g.indexOf(y)>-1}function U(g){return g.trim().split(/\s+/g)}function z(g,y,k){if(g.indexOf&&!k)return g.indexOf(y);for(var M=0;M<g.length;){if(k&&g[M][k]==y||!k&&g[M]===y)return M;M++}return-1}function q(g){return Array.prototype.slice.call(g,0)}function K(g,y,k){for(var M=[],O=[],G=0;G<g.length;){var H=y?g[G][y]:g[G];z(O,H)<0&&M.push(g[G]),O[G]=H,G++}return k&&(y?M=M.sort(function(st,it){return st[y]>it[y]}):M=M.sort()),M}function Z(g,y){for(var k,M,O=y[0].toUpperCase()+y.slice(1),G=0;G<s.length;){if(k=s[G],M=k?k+O:y,M in g)return M;G++}return r}var at=1;function vt(){return at++}function _t(g){var y=g.ownerDocument||g;return y.defaultView||y.parentWindow||t}var pt=/mobile|tablet|ip(ad|hone|od)|android/i,nt="ontouchstart"in t,J=Z(t,"PointerEvent")!==r,I=nt&&pt.test(navigator.userAgent),D="touch",A="pen",B="mouse",j="kinect",W=25,N=1,Y=2,X=4,et=8,ht=1,mt=2,bt=4,Tt=8,yt=16,Et=mt|bt,Pt=Tt|yt,Ot=Et|Pt,Ct=["x","y"],Jt=["clientX","clientY"];function zt(g,y){var k=this;this.manager=g,this.callback=y,this.element=g.element,this.target=g.options.inputTarget,this.domHandler=function(M){x(g.options.enable,[g])&&k.handler(M)},this.init()}zt.prototype={handler:function(){},init:function(){this.evEl&&R(this.element,this.evEl,this.domHandler),this.evTarget&&R(this.target,this.evTarget,this.domHandler),this.evWin&&R(_t(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&F(this.element,this.evEl,this.domHandler),this.evTarget&&F(this.target,this.evTarget,this.domHandler),this.evWin&&F(_t(this.element),this.evWin,this.domHandler)}};function ce(g){var y,k=g.options.inputClass;return k?y=k:J?y=Ye:I?y=Fi:nt?y=mr:y=ti,new y(g,Xt)}function Xt(g,y,k){var M=k.pointers.length,O=k.changedPointers.length,G=y&N&&M-O===0,H=y&(X|et)&&M-O===0;k.isFirst=!!G,k.isFinal=!!H,G&&(g.session={}),k.eventType=y,Ee(g,k),g.emit("hammer.input",k),g.recognize(k),g.session.prevInput=k}function Ee(g,y){var k=g.session,M=y.pointers,O=M.length;k.firstInput||(k.firstInput=on(y)),O>1&&!k.firstMultiple?k.firstMultiple=on(y):O===1&&(k.firstMultiple=!1);var G=k.firstInput,H=k.firstMultiple,Q=H?H.center:G.center,st=y.center=Qe(M);y.timeStamp=c(),y.deltaTime=y.timeStamp-G.timeStamp,y.angle=ui(Q,st),y.distance=ci(Q,st),ye(k,y),y.offsetDirection=Di(y.deltaX,y.deltaY);var it=Ri(y.deltaTime,y.deltaX,y.deltaY);y.overallVelocityX=it.x,y.overallVelocityY=it.y,y.overallVelocity=l(it.x)>l(it.y)?it.x:it.y,y.scale=H?ve(H.pointers,M):1,y.rotation=H?dr(H.pointers,M):0,y.maxPointers=k.prevInput?y.pointers.length>k.prevInput.maxPointers?y.pointers.length:k.prevInput.maxPointers:y.pointers.length,li(k,y);var tt=g.element;L(y.srcEvent.target,tt)&&(tt=y.srcEvent.target),y.target=tt}function ye(g,y){var k=y.center,M=g.offsetDelta||{},O=g.prevDelta||{},G=g.prevInput||{};(y.eventType===N||G.eventType===X)&&(O=g.prevDelta={x:G.deltaX||0,y:G.deltaY||0},M=g.offsetDelta={x:k.x,y:k.y}),y.deltaX=O.x+(k.x-M.x),y.deltaY=O.y+(k.y-M.y)}function li(g,y){var k=g.lastInterval||y,M=y.timeStamp-k.timeStamp,O,G,H,Q;if(y.eventType!=et&&(M>W||k.velocity===r)){var st=y.deltaX-k.deltaX,it=y.deltaY-k.deltaY,tt=Ri(M,st,it);G=tt.x,H=tt.y,O=l(tt.x)>l(tt.y)?tt.x:tt.y,Q=Di(st,it),g.lastInterval=y}else O=k.velocity,G=k.velocityX,H=k.velocityY,Q=k.direction;y.velocity=O,y.velocityX=G,y.velocityY=H,y.direction=Q}function on(g){for(var y=[],k=0;k<g.pointers.length;)y[k]={clientX:h(g.pointers[k].clientX),clientY:h(g.pointers[k].clientY)},k++;return{timeStamp:c(),pointers:y,center:Qe(y),deltaX:g.deltaX,deltaY:g.deltaY}}function Qe(g){var y=g.length;if(y===1)return{x:h(g[0].clientX),y:h(g[0].clientY)};for(var k=0,M=0,O=0;O<y;)k+=g[O].clientX,M+=g[O].clientY,O++;return{x:h(k/y),y:h(M/y)}}function Ri(g,y,k){return{x:y/g||0,y:k/g||0}}function Di(g,y){return g===y?ht:l(g)>=l(y)?g<0?mt:bt:y<0?Tt:yt}function ci(g,y,k){k||(k=Ct);var M=y[k[0]]-g[k[0]],O=y[k[1]]-g[k[1]];return Math.sqrt(M*M+O*O)}function ui(g,y,k){k||(k=Ct);var M=y[k[0]]-g[k[0]],O=y[k[1]]-g[k[1]];return Math.atan2(O,M)*180/Math.PI}function dr(g,y){return ui(y[1],y[0],Jt)+ui(g[1],g[0],Jt)}function ve(g,y){return ci(y[0],y[1],Jt)/ci(g[0],g[1],Jt)}var fi={mousedown:N,mousemove:Y,mouseup:X},hn="mousedown",Re="mousemove mouseup";function ti(){this.evEl=hn,this.evWin=Re,this.pressed=!1,zt.apply(this,arguments)}E(ti,zt,{handler:function(y){var k=fi[y.type];k&N&&y.button===0&&(this.pressed=!0),k&Y&&y.which!==1&&(k=X),this.pressed&&(k&X&&(this.pressed=!1),this.callback(this.manager,k,{pointers:[y],changedPointers:[y],pointerType:B,srcEvent:y}))}});var Ue={pointerdown:N,pointermove:Y,pointerup:X,pointercancel:et,pointerout:et},Fn={2:D,3:A,4:B,5:j},Li="pointerdown",ln="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(Li="MSPointerDown",ln="MSPointerMove MSPointerUp MSPointerCancel");function Ye(){this.evEl=Li,this.evWin=ln,zt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}E(Ye,zt,{handler:function(y){var k=this.store,M=!1,O=y.type.toLowerCase().replace("ms",""),G=Ue[O],H=Fn[y.pointerType]||y.pointerType,Q=H==D,st=z(k,y.pointerId,"pointerId");G&N&&(y.button===0||Q)?st<0&&(k.push(y),st=k.length-1):G&(X|et)&&(M=!0),!(st<0)&&(k[st]=y,this.callback(this.manager,G,{pointers:k,changedPointers:[y],pointerType:H,srcEvent:y}),M&&k.splice(st,1))}});var Se={touchstart:N,touchmove:Y,touchend:X,touchcancel:et},lo="touchstart",cn="touchstart touchmove touchend touchcancel";function Ii(){this.evTarget=lo,this.evWin=cn,this.started=!1,zt.apply(this,arguments)}E(Ii,zt,{handler:function(y){var k=Se[y.type];if(k===N&&(this.started=!0),!!this.started){var M=di.call(this,y,k);k&(X|et)&&M[0].length-M[1].length===0&&(this.started=!1),this.callback(this.manager,k,{pointers:M[0],changedPointers:M[1],pointerType:D,srcEvent:y})}}});function di(g,y){var k=q(g.touches),M=q(g.changedTouches);return y&(X|et)&&(k=K(k.concat(M),"identifier",!0)),[k,M]}var gr={touchstart:N,touchmove:Y,touchend:X,touchcancel:et},Oi="touchstart touchmove touchend touchcancel";function Fi(){this.evTarget=Oi,this.targetIds={},zt.apply(this,arguments)}E(Fi,zt,{handler:function(y){var k=gr[y.type],M=Nn.call(this,y,k);M&&this.callback(this.manager,k,{pointers:M[0],changedPointers:M[1],pointerType:D,srcEvent:y})}});function Nn(g,y){var k=q(g.touches),M=this.targetIds;if(y&(N|Y)&&k.length===1)return M[k[0].identifier]=!0,[k,k];var O,G,H=q(g.changedTouches),Q=[],st=this.target;if(G=k.filter(function(it){return L(it.target,st)}),y===N)for(O=0;O<G.length;)M[G[O].identifier]=!0,O++;for(O=0;O<H.length;)M[H[O].identifier]&&Q.push(H[O]),y&(X|et)&&delete M[H[O].identifier],O++;if(Q.length)return[K(G.concat(Q),"identifier",!0),Q]}var pr=2500,co=25;function mr(){zt.apply(this,arguments);var g=_(this.handler,this);this.touch=new Fi(this.manager,g),this.mouse=new ti(this.manager,g),this.primaryTouch=null,this.lastTouches=[]}E(mr,zt,{handler:function(y,k,M){var O=M.pointerType==D,G=M.pointerType==B;if(!(G&&M.sourceCapabilities&&M.sourceCapabilities.firesTouchEvents)){if(O)uo.call(this,k,M);else if(G&&Ni.call(this,M))return;this.callback(y,k,M)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function uo(g,y){g&N?(this.primaryTouch=y.changedPointers[0].identifier,fo.call(this,y)):g&(X|et)&&fo.call(this,y)}function fo(g){var y=g.changedPointers[0];if(y.identifier===this.primaryTouch){var k={x:y.clientX,y:y.clientY};this.lastTouches.push(k);var M=this.lastTouches,O=function(){var G=M.indexOf(k);G>-1&&M.splice(G,1)};setTimeout(O,pr)}}function Ni(g){for(var y=g.srcEvent.clientX,k=g.srcEvent.clientY,M=0;M<this.lastTouches.length;M++){var O=this.lastTouches[M],G=Math.abs(y-O.x),H=Math.abs(k-O.y);if(G<=co&&H<=co)return!0}return!1}var go=Z(a.style,"touchAction"),po=go!==r,mo="compute",vo="auto",vr="manipulation",Gi="none",De="pan-x",Ui="pan-y",un=fn();function $t(g,y){this.manager=g,this.set(y)}$t.prototype={set:function(g){g==mo&&(g=this.compute()),po&&this.manager.element.style&&un[g]&&(this.manager.element.style[go]=g),this.actions=g.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var g=[];return u(this.manager.recognizers,function(y){x(y.options.enable,[y])&&(g=g.concat(y.getTouchAction()))}),_o(g.join(" "))},preventDefaults:function(g){var y=g.srcEvent,k=g.offsetDirection;if(this.manager.session.prevented){y.preventDefault();return}var M=this.actions,O=$(M,Gi)&&!un[Gi],G=$(M,Ui)&&!un[Ui],H=$(M,De)&&!un[De];if(O){var Q=g.pointers.length===1,st=g.distance<2,it=g.deltaTime<250;if(Q&&st&&it)return}if(!(H&&G)&&(O||G&&k&Et||H&&k&Pt))return this.preventSrc(y)},preventSrc:function(g){this.manager.session.prevented=!0,g.preventDefault()}};function _o(g){if($(g,Gi))return Gi;var y=$(g,De),k=$(g,Ui);return y&&k?Gi:y||k?y?De:Ui:$(g,vr)?vr:vo}function fn(){if(!po)return!1;var g={},y=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(k){g[k]=y?t.CSS.supports("touch-action",k):!0}),g}var Gn=1,Ce=2,gi=4,ei=8,qe=ei,Bi=16,ne=32;function At(g){this.options=v({},this.defaults,g||{}),this.id=vt(),this.manager=null,this.options.enable=P(this.options.enable,!0),this.state=Gn,this.simultaneous={},this.requireFail=[]}At.prototype={defaults:{},set:function(g){return v(this.options,g),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(g){if(f(g,"recognizeWith",this))return this;var y=this.simultaneous;return g=dn(g,this),y[g.id]||(y[g.id]=g,g.recognizeWith(this)),this},dropRecognizeWith:function(g){return f(g,"dropRecognizeWith",this)?this:(g=dn(g,this),delete this.simultaneous[g.id],this)},requireFailure:function(g){if(f(g,"requireFailure",this))return this;var y=this.requireFail;return g=dn(g,this),z(y,g)===-1&&(y.push(g),g.requireFailure(this)),this},dropRequireFailure:function(g){if(f(g,"dropRequireFailure",this))return this;g=dn(g,this);var y=z(this.requireFail,g);return y>-1&&this.requireFail.splice(y,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(g){return!!this.simultaneous[g.id]},emit:function(g){var y=this,k=this.state;function M(O){y.manager.emit(O,g)}k<ei&&M(y.options.event+ta(k)),M(y.options.event),g.additionalEvent&&M(g.additionalEvent),k>=ei&&M(y.options.event+ta(k))},tryEmit:function(g){if(this.canEmit())return this.emit(g);this.state=ne},canEmit:function(){for(var g=0;g<this.requireFail.length;){if(!(this.requireFail[g].state&(ne|Gn)))return!1;g++}return!0},recognize:function(g){var y=v({},g);if(!x(this.options.enable,[this,y])){this.reset(),this.state=ne;return}this.state&(qe|Bi|ne)&&(this.state=Gn),this.state=this.process(y),this.state&(Ce|gi|ei|Bi)&&this.tryEmit(y)},process:function(g){},getTouchAction:function(){},reset:function(){}};function ta(g){return g&Bi?"cancel":g&ei?"end":g&gi?"move":g&Ce?"start":""}function _r(g){return g==yt?"down":g==Tt?"up":g==mt?"left":g==bt?"right":""}function dn(g,y){var k=y.manager;return k?k.get(g):g}function Be(){At.apply(this,arguments)}E(Be,At,{defaults:{pointers:1},attrTest:function(g){var y=this.options.pointers;return y===0||g.pointers.length===y},process:function(g){var y=this.state,k=g.eventType,M=y&(Ce|gi),O=this.attrTest(g);return M&&(k&et||!O)?y|Bi:M||O?k&X?y|ei:y&Ce?y|gi:Ce:ne}});function Le(){Be.apply(this,arguments),this.pX=null,this.pY=null}E(Le,Be,{defaults:{event:"pan",threshold:10,pointers:1,direction:Ot},getTouchAction:function(){var g=this.options.direction,y=[];return g&Et&&y.push(Ui),g&Pt&&y.push(De),y},directionTest:function(g){var y=this.options,k=!0,M=g.distance,O=g.direction,G=g.deltaX,H=g.deltaY;return O&y.direction||(y.direction&Et?(O=G===0?ht:G<0?mt:bt,k=G!=this.pX,M=Math.abs(g.deltaX)):(O=H===0?ht:H<0?Tt:yt,k=H!=this.pY,M=Math.abs(g.deltaY))),g.direction=O,k&&M>y.threshold&&O&y.direction},attrTest:function(g){return Be.prototype.attrTest.call(this,g)&&(this.state&Ce||!(this.state&Ce)&&this.directionTest(g))},emit:function(g){this.pX=g.deltaX,this.pY=g.deltaY;var y=_r(g.direction);y&&(g.additionalEvent=this.options.event+y),this._super.emit.call(this,g)}});function zi(){Be.apply(this,arguments)}E(zi,Be,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Gi]},attrTest:function(g){return this._super.attrTest.call(this,g)&&(Math.abs(g.scale-1)>this.options.threshold||this.state&Ce)},emit:function(g){if(g.scale!==1){var y=g.scale<1?"in":"out";g.additionalEvent=this.options.event+y}this._super.emit.call(this,g)}});function yr(){At.apply(this,arguments),this._timer=null,this._input=null}E(yr,At,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[vo]},process:function(g){var y=this.options,k=g.pointers.length===y.pointers,M=g.distance<y.threshold,O=g.deltaTime>y.time;if(this._input=g,!M||!k||g.eventType&(X|et)&&!O)this.reset();else if(g.eventType&N)this.reset(),this._timer=d(function(){this.state=qe,this.tryEmit()},y.time,this);else if(g.eventType&X)return qe;return ne},reset:function(){clearTimeout(this._timer)},emit:function(g){this.state===qe&&(g&&g.eventType&X?this.manager.emit(this.options.event+"up",g):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}});function wr(){Be.apply(this,arguments)}E(wr,Be,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Gi]},attrTest:function(g){return this._super.attrTest.call(this,g)&&(Math.abs(g.rotation)>this.options.threshold||this.state&Ce)}});function br(){Be.apply(this,arguments)}E(br,Be,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|Pt,pointers:1},getTouchAction:function(){return Le.prototype.getTouchAction.call(this)},attrTest:function(g){var y=this.options.direction,k;return y&(Et|Pt)?k=g.overallVelocity:y&Et?k=g.overallVelocityX:y&Pt&&(k=g.overallVelocityY),this._super.attrTest.call(this,g)&&y&g.offsetDirection&&g.distance>this.options.threshold&&g.maxPointers==this.options.pointers&&l(k)>this.options.velocity&&g.eventType&X},emit:function(g){var y=_r(g.offsetDirection);y&&this.manager.emit(this.options.event+y,g),this.manager.emit(this.options.event,g)}});function We(){At.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}E(We,At,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[vr]},process:function(g){var y=this.options,k=g.pointers.length===y.pointers,M=g.distance<y.threshold,O=g.deltaTime<y.time;if(this.reset(),g.eventType&N&&this.count===0)return this.failTimeout();if(M&&O&&k){if(g.eventType!=X)return this.failTimeout();var G=this.pTime?g.timeStamp-this.pTime<y.interval:!0,H=!this.pCenter||ci(this.pCenter,g.center)<y.posThreshold;this.pTime=g.timeStamp,this.pCenter=g.center,!H||!G?this.count=1:this.count+=1,this._input=g;var Q=this.count%y.taps;if(Q===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=qe,this.tryEmit()},y.interval,this),Ce):qe}return ne},failTimeout:function(){return this._timer=d(function(){this.state=ne},this.options.interval,this),ne},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==qe&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ke(g,y){return y=y||{},y.recognizers=P(y.recognizers,Ke.defaults.preset),new Bn(g,y)}Ke.VERSION="2.0.7",Ke.defaults={domEvents:!1,touchAction:mo,enable:!0,inputTarget:null,inputClass:null,preset:[[wr,{enable:!1}],[zi,{enable:!1},["rotate"]],[br,{direction:Et}],[Le,{direction:Et},["swipe"]],[We],[We,{event:"doubletap",taps:2},["tap"]],[yr]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Un=1,de=2;function Bn(g,y){this.options=v({},Ke.defaults,y||{}),this.options.inputTarget=this.options.inputTarget||g,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=g,this.input=ce(this),this.touchAction=new $t(this,this.options.touchAction),p(this,!0),u(this.options.recognizers,function(k){var M=this.add(new k[0](k[1]));k[2]&&M.recognizeWith(k[2]),k[3]&&M.requireFailure(k[3])},this)}Bn.prototype={set:function(g){return v(this.options,g),g.touchAction&&this.touchAction.update(),g.inputTarget&&(this.input.destroy(),this.input.target=g.inputTarget,this.input.init()),this},stop:function(g){this.session.stopped=g?de:Un},recognize:function(g){var y=this.session;if(!y.stopped){this.touchAction.preventDefaults(g);var k,M=this.recognizers,O=y.curRecognizer;(!O||O&&O.state&qe)&&(O=y.curRecognizer=null);for(var G=0;G<M.length;)k=M[G],y.stopped!==de&&(!O||k==O||k.canRecognizeWith(O))?k.recognize(g):k.reset(),!O&&k.state&(Ce|gi|ei)&&(O=y.curRecognizer=k),G++}},get:function(g){if(g instanceof At)return g;for(var y=this.recognizers,k=0;k<y.length;k++)if(y[k].options.event==g)return y[k];return null},add:function(g){if(f(g,"add",this))return this;var y=this.get(g.options.event);return y&&this.remove(y),this.recognizers.push(g),g.manager=this,this.touchAction.update(),g},remove:function(g){if(f(g,"remove",this))return this;if(g=this.get(g),g){var y=this.recognizers,k=z(y,g);k!==-1&&(y.splice(k,1),this.touchAction.update())}return this},on:function(g,y){if(g!==r&&y!==r){var k=this.handlers;return u(U(g),function(M){k[M]=k[M]||[],k[M].push(y)}),this}},off:function(g,y){if(g!==r){var k=this.handlers;return u(U(g),function(M){y?k[M]&&k[M].splice(z(k[M],y),1):delete k[M]}),this}},emit:function(g,y){this.options.domEvents&&w(g,y);var k=this.handlers[g]&&this.handlers[g].slice();if(!(!k||!k.length)){y.type=g,y.preventDefault=function(){y.srcEvent.preventDefault()};for(var M=0;M<k.length;)k[M](y),M++}},destroy:function(){this.element&&p(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function p(g,y){var k=g.element;if(k.style){var M;u(g.options.cssProps,function(O,G){M=Z(k.style,G),y?(g.oldCssProps[M]=k.style[M],k.style[M]=O):k.style[M]=g.oldCssProps[M]||""}),y||(g.oldCssProps={})}}function w(g,y){var k=e.createEvent("Event");k.initEvent(g,!0,!0),k.gesture=y,y.target.dispatchEvent(k)}v(Ke,{INPUT_START:N,INPUT_MOVE:Y,INPUT_END:X,INPUT_CANCEL:et,STATE_POSSIBLE:Gn,STATE_BEGAN:Ce,STATE_CHANGED:gi,STATE_ENDED:ei,STATE_RECOGNIZED:qe,STATE_CANCELLED:Bi,STATE_FAILED:ne,DIRECTION_NONE:ht,DIRECTION_LEFT:mt,DIRECTION_RIGHT:bt,DIRECTION_UP:Tt,DIRECTION_DOWN:yt,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:Pt,DIRECTION_ALL:Ot,Manager:Bn,Input:zt,TouchAction:$t,TouchInput:Fi,MouseInput:ti,PointerEventInput:Ye,TouchMouseInput:mr,SingleTouchInput:Ii,Recognizer:At,AttrRecognizer:Be,Tap:We,Pan:Le,Swipe:br,Pinch:zi,Rotate:wr,Press:yr,on:R,off:F,each:u,merge:S,extend:b,assign:v,inherit:E,bindFn:_,prefixed:Z});var C=typeof t<"u"?t:typeof self<"u"?self:{};C.Hammer=Ke,typeof r=="function"&&r.amd?r(function(){return Ke}):n.exports?n.exports=Ke:t[i]=Ke})(window,document,"Hammer")})(yc);var Mg=yc.exports;const Rg=Pe(Mg);let Dg=class extends _c{point;removeEventListeners=[];hammer;constructor(t){super(t),this.point=new Pr,this.hammer=new Rg(t.container),this.removeEventListeners.push(this.point.captureMouse(this.app.container)),this.removeEventListeners.push(this.addEventListeners())}destroy(){this.removeEventListeners.forEach(t=>t())}addEventListeners(){const t=b=>{this.app.emit("mouseDown",b)},e=b=>{this.app.emit("mouseUp",b)},i=b=>{this.app.emit("mouseMove",b)},r=b=>{this.app.emit("mouseOver",b)},s=b=>{this.app.emit("mouseOut",b)},a=b=>{this.app.emit("mouseClick",b)},o=b=>{this.app.emit("mouseDoubleClick",b)},h=b=>{this.app.emit("mouseWheel",b)},l=b=>{this.app.emit("mouseContextMenu",b)},c=b=>{this.app.emit("pan",b)},d=b=>{this.app.emit("pinch",b)},f=b=>{this.app.emit("press",b)},u=b=>{this.app.emit("rotate",b)},m=b=>{this.app.emit("swipe",b)},v=b=>{this.app.emit("tap",b)};return this.app.container?.addEventListener("mousedown",t),this.app.container?.addEventListener("mouseup",e),this.app.container?.addEventListener("mousemove",i),this.app.container?.addEventListener("mouseover",r),this.app.container?.addEventListener("mouseout",s),this.app.container?.addEventListener("click",a),this.app.container?.addEventListener("dblclick",o),this.app.container?.addEventListener("wheel",h),this.app.container?.addEventListener("contextmenu",l),this.hammer.on("pan",c),this.hammer.on("pinch",d),this.hammer.on("press",f),this.hammer.on("rotate",u),this.hammer.on("swipe",m),this.hammer.on("tap",v),()=>{this.app.container?.removeEventListener("mousedown",t),this.app.container?.removeEventListener("mouseup",e),this.app.container?.removeEventListener("mousemove",i),this.app.container?.removeEventListener("mouseover",r),this.app.container?.removeEventListener("mouseout",s),this.app.container?.removeEventListener("click",a),this.app.container?.removeEventListener("dblclick",o),this.app.container?.removeEventListener("wheel",h),this.app.container?.removeEventListener("contextmenu",l),this.hammer.off("pan",c),this.hammer.off("pinch",d),this.hammer.off("press",f),this.hammer.off("rotate",u),this.hammer.off("swipe",m),this.hammer.off("tap",v)}}};class Lg extends _c{removeEventListeners=[];constructor(t){super(t)}destroy(){this.removeEventListeners.forEach(t=>t())}on(t,e){const i=Qt.on(t,s=>(this.app.emit("keyDown",s,i),e)),r=()=>{i.removeListener?.()};return this.removeEventListeners.push(r),r}}const wc=[1,0,0,1,0,0],bc=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];class we{value;matrix3d;isEverTo3d=!1;_prev_rotatex=0;_prev_rotatey=0;constructor(t=wc){this.value=Array.from(t),this.matrix3d=this.toMatrix3D()}unit(){return this.value=Array.from(wc),this.matrix3d=this.toMatrix3D(),this}transformPoint(t,e,i=0,r=0){const s=t-i,a=e-r;return t=s*this.value[0]+a*this.value[2]+this.value[4],e=s*this.value[1]+a*this.value[3]+this.value[5],[t+i,e+r]}fromString(t){const e=Dl("number",t);return e.length===6?e.forEach((i,r)=>{i.fullMatch&&(this.value[r]=parseFloat(i.fullMatch))}):this.unit(),this}toMatrix3D(t=this.matrix3d){const e=[this.value[0],this.value[1],0,0,this.value[2],this.value[3],0,0,0,0,1,0,this.value[4],this.value[5],0,1];return t?(t.value=e,t):new pn(e)}offset(t=0,e=0){return[t-this.value[4],e-this.value[5]]}clone(){return new we(this.value)}multiply(t){const e=this.value;let i;t instanceof we?i=t.value:i=t;const r=e[0]*i[0]+e[2]*i[1],s=e[1]*i[0]+e[3]*i[1],a=e[0]*i[2]+e[2]*i[3],o=e[1]*i[2]+e[3]*i[3],h=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=h,e[5]=l,this}inverse(){const t=new we(this.value),e=t.value,i=1/(e[0]*e[3]-e[1]*e[2]),r=e[3]*i,s=-e[1]*i,a=-e[2]*i,o=e[0]*i,h=i*(e[2]*e[5]-e[3]*e[4]),l=i*(e[1]*e[4]-e[0]*e[5]);return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=h,e[5]=l,t}translate(t,e){return this.matrix3d.translate(t,e,0),this.multiply([1,0,0,1,t,e])}translateTo(t,e){const i=this.offset(t,e);return this.translate(i[0],i[1])}translateX(t){return this.translate(t,0)}translateY(t){return this.translate(0,t)}translateZ(t){return this.isEverTo3d=!0,this.matrix3d.translate(0,0,t)}translate3d(t,e,i){return this.isEverTo3d=!0,this.matrix3d.translate(t,e,i)}rotate(t,e=0,i=0){const r=la(t),s=+Math.cos(r).toFixed(9),a=+Math.sin(r).toFixed(9);return this.multiply([s,a,-a,s,e,i]),this.translate(-e,-i),this}rotateX(t){return this._prev_rotatex=t,this.isEverTo3d=!0,this.matrix3d.rotate("x",t)}rotateXTo(t){return this.rotateX(t-this._prev_rotatex)}rotateY(t){return this._prev_rotatey=t,this.isEverTo3d=!0,this.matrix3d.rotate("y",t)}rotateYTo(t){return this.rotateY(t-this._prev_rotatey)}rotateZ(t){return this.isEverTo3d=!0,this.matrix3d.rotate("z",t)}rotate3d(t,e,i){return this.isEverTo3d=!0,this.matrix3d.rotate("x",t).rotate("y",e).rotate("z",i)}scale(t,e=t,i=0,r=0){return this.matrix3d.scale(t,e,1),this.translate(i,r),this.multiply([t,0,0,e,0,0]),this.translate(-i,-r),this}scaleTo(t,e=t){return this.scale(t/this.value[0],e/this.value[3]),this}scaleX(t){return this.scale(t,1)}scaleY(t){return this.scale(1,t)}scaleZ(t){return this.isEverTo3d=!0,this.matrix3d.scale(1,1,t)}scale3d(t,e,i){return this.isEverTo3d=!0,this.matrix3d.scale(t,e,i)}skew(t,e=0){const i=t*Math.PI/180,r=e*Math.PI/180,s=Math.tan(i),a=Math.tan(r);return this.multiply([1,a,s,1,0,0])}skewX(t){return this.skew(t,0)}skewY(t){return this.skew(0,t)}skewZ(t){return this}skew3d(t,e,i){return this}split(){const t={dx:0,dy:0,scalex:1,scaley:1,shear:1,rotate:0,isSimple:!0,isSuperSimple:!0,noRotation:!1};t.dx=this.value[4],t.dy=this.value[5];const e=[[this.value[0],this.value[2]],[this.value[1],this.value[3]]];t.scalex=Math.sqrt(ca(e[0])),Oo(e[0]),t.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*t.shear,e[1][1]-e[0][1]*t.shear],t.scaley=Math.sqrt(ca(e[1])),Oo(e[1]),t.shear/=t.scaley;const i=-e[0][1],r=e[1][1];return r<0?(t.rotate=Lo(Math.acos(r)),i<0&&(t.rotate=360-t.rotate)):t.rotate=la(Math.asin(i)),t.isSimple=!+t.shear.toFixed(9)&&(t.scalex.toFixed(9)==t.scaley.toFixed(9)||!t.rotate),t.isSuperSimple=!+t.shear.toFixed(9)&&t.scalex.toFixed(9)==t.scaley.toFixed(9)&&!t.rotate,t.noRotation=!+t.shear.toFixed(9)&&!t.rotate,t}toTransformString(){const t=this.split();return t.isSimple?(t.scalex=+t.scalex.toFixed(4),t.scaley=+t.scaley.toFixed(4),t.rotate=+t.rotate.toFixed(4),(t.dx&&t.dy?"t"+[t.dx,t.dy]:"")+(t.scalex!=1||t.scaley!=1?"s"+[t.scalex,t.scaley,0,0]:"")+(t.rotate?"r"+[t.rotate,0,0]:"")):"matrix"+[this.value[0],this.value[1],this.value[2],this.value[3],this.value[4],this.value[5]]}toString(){return this.isEverTo3d?this.toMatrix3DString():`matrix(${this.value.map(t=>Ul(t,6)).join(",")})`}toMatrix3DString(){return this.matrix3d.toString()}toFilter(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.value[0]+", M12="+this.value[2]+", M21="+this.value[1]+", M22="+this.value[3]+", Dx="+this.value[4]+", Dy="+this.value[5]+", sizingmethod='auto expand')"}}class pn{value;constructor(t=bc){this.value=Array.from(t)}unit(){return this.value=Array.from(bc),this}fromString(t){const e=Dl("number",t);return e.length===16?e.forEach((i,r)=>{i.fullMatch&&(this.value[r]=parseFloat(i.fullMatch))}):this.unit(),this}toMatrix(t){const e=[this.value[0],this.value[1],this.value[4],this.value[5],this.value[12],this.value[13]];return t?(t.value=e,t):new we(e)}multiplyMatrix(t){const e=this.value[0],i=this.value[1],r=this.value[2],s=this.value[3],a=this.value[4],o=this.value[5],h=this.value[6],l=this.value[7],c=this.value[8],d=this.value[9],f=this.value[10],u=this.value[11],m=this.value[12],v=this.value[13],b=this.value[14],S=this.value[15],E=t.value[0],_=t.value[1],x=t.value[2],P=t.value[3],R=E*e+_*a+x*c+P*m,F=E*i+_*o+x*d+P*v,L=E*r+_*h+x*f+P*b,$=E*s+_*l+x*u+P*S;return new we([R,F,L,$,0,0])}multiply(t){const e=new we([t.value[0],t.value[1],t.value[2],t.value[3],0,0]),i=new we([t.value[4],t.value[5],t.value[6],t.value[7],0,0]),r=new we([t.value[8],t.value[9],t.value[10],t.value[11],0,0]),s=new we([t.value[12],t.value[13],t.value[14],t.value[15],0,0]),a=this.multiplyMatrix(e),o=this.multiplyMatrix(i),h=this.multiplyMatrix(r),l=this.multiplyMatrix(s);return this.value[0]=a.value[0],this.value[1]=a.value[1],this.value[2]=a.value[2],this.value[3]=a.value[3],this.value[4]=o.value[0],this.value[5]=o.value[1],this.value[6]=o.value[2],this.value[7]=o.value[3],this.value[8]=h.value[0],this.value[9]=h.value[1],this.value[10]=h.value[2],this.value[11]=h.value[3],this.value[12]=l.value[0],this.value[13]=l.value[1],this.value[14]=l.value[2],this.value[15]=l.value[3],this}translate(t=0,e=0,i=0){return this.multiply(new pn([1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1]))}scale(t=1,e=1,i=1){return this.multiply(new pn([t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1]))}rotate(t,e){const i=la(e),r=Math.sin,s=Math.cos;let a;switch(t){case"x":a=[1,0,0,0,0,s(i),r(i),0,0,-r(i),s(i),0,0,0,0,1];break;case"y":a=[s(i),0,-r(i),0,0,1,0,0,r(i),0,s(i),0,0,0,0,1];break;case"z":a=[s(i),r(i),0,0,-r(i),s(i),0,0,0,0,1,0,0,0,0,1];break}return this.multiply(new pn(a))}toString(){return`matrix3d(${this.value.map(t=>Ul(t,6)).join(",")})`}}function Ar(n){const t=new we;return n.replace(/([a-z0-9]+)\s*\(?\s*((-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)*[a-z%]*\s*,?\s*)+)\)?/gi,function(e,i,r){r.indexOf(",")>=0?r=r.split(/\s*,\s*/):r=r.split(/\s+/);const s=[];for(let a=0,o=r.length;a<o;a++)r[a].trim()&&s.push(parseFloat(""+r[a]));switch(i.toLowerCase()){case"t":case"translate":t.translate(s[0],s[1]);break;case"translatex":t.translateX(s[0]);break;case"translatey":t.translateY(s[0]);break;case"translatez":t.translateZ(s[0]);break;case"translate3d":t.translate3d(s[0],s[1],s[2]);break;case"r":case"rotate":t.rotate(s[0],s[1]??0,s[2]??0);break;case"rotatex":t.rotateX(s[0]);break;case"rotatey":t.rotateY(s[0]);break;case"rotatez":t.rotateZ(s[0]);break;case"rotate3d":t.rotate3d(s[0],s[1],s[2]);break;case"s":case"scale":t.scale(s[0],s[1]??s[0]);break;case"scalex":t.scaleX(s[0]);break;case"scaley":t.scaleY(s[0]);break;case"scalez":t.scaleZ(s[0]);break;case"scale3d":t.scale3d(s[0],s[1],s[2]);break;case"skew":t.skew(s[0],s[1]??0);break;case"skewx":t.skewX(s[0]);break;case"skewy":t.skewY(s[0]);break;case"skewz":t.skewZ(s[0]);break;case"skew3d":t.skew3d(s[0],s[1],s[2]);break;case"m":case"matrix":t.multiply([s[0],s[1],s[2],s[3],s[4],s[5]]);break;case"matrix3d":t.matrix3d.multiply(new pn(s));break}return""}),t}class ua{x;y;z;constructor(t=[0,0,0],e=[0,0,0]){const[i,r,s]=t,[a,o,h]=e;this.x=i-a,this.y=r-o,this.z=s-h}get length(){const{x:t,y:e,z:i}=this;return Math.sqrt(t*t+e*e+i*i)}unit(){const t=this.length;return new ua([this.x/t,this.y/t,this.z/t])}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){const e=this.x,i=this.y,r=this.z,s=t.x,a=t.y,o=t.z;return new ua([i*o-r*a,r*s-e*o,e*a-s*i])}}function xc(n){return typeof n!="string"?!1:(n=n.trim(),/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(n)&&/[\dz]$/i.test(n)&&n.length>4)}const No={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Ig=/([astvzqmhlc])([^astvzqmhlc]*)/gi,Og=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function Fg(n){const t=n.match(Og);return t?t.map(Number):[]}function fa(n){const t=[];return n.replace(Ig,function(e,i,r){let s=i.toLowerCase();for(r=Fg(r),s=="m"&&r.length>2&&(t.push([i].concat(r.splice(0,2))),s="l",i=i=="m"?"l":"L");;){if(r.length==No[s])return r.unshift(i),t.push(r);if(r.length<No[s])throw new Error("malformed path data");t.push([i].concat(r.splice(0,No[s])))}}),t}function da(n){var t=0,e=0,i=0,r=0;return n.map(function(s){s=s.slice();var a=s[0],o=a.toUpperCase();if(a!=o)switch(s[0]=o,a){case"a":s[6]+=i,s[7]+=r;break;case"v":s[1]+=r;break;case"h":s[1]+=i;break;default:for(var h=1;h<s.length;)s[h++]+=i,s[h++]+=r}switch(o){case"Z":i=t,r=e;break;case"H":i=s[1];break;case"V":r=s[1];break;case"M":i=t=s[1],r=e=s[2];break;default:i=s[s.length-2],r=s[s.length-1]}return s})}function Ng(n){var t=0,e=0,i=0,r=0;return n.map(function(s){s=s.slice();var a=s[0],o=a.toLowerCase();if(a!=o)switch(s[0]=o,a){case"A":s[6]-=i,s[7]-=r;break;case"V":s[1]-=r;break;case"H":s[1]-=i;break;default:for(var h=1;h<s.length;)s[h++]-=i,s[h++]-=r}switch(o){case"z":i=t,r=e;break;case"h":i+=s[1];break;case"v":r+=s[1];break;case"m":i+=s[1],r+=s[2],t+=s[1],e+=s[2];break;default:i+=s[s.length-2],r+=s[s.length-1]}return s})}const Mr=Math.PI*2;function Sc(n,t,e,i){const r=n*i-t*e<0?-1:1;let s=n*e+t*i;return s>1&&(s=1),s<-1&&(s=-1),r*Math.acos(s)}function Gg(n,t,e,i,r,s,a,o,h,l){const c=l*(n-e)/2+h*(t-i)/2,d=-h*(n-e)/2+l*(t-i)/2,f=a*a,u=o*o,m=c*c,v=d*d;let b=f*u-f*v-u*m;b<0&&(b=0),b/=f*v+u*m,b=Math.sqrt(b)*(r===s?-1:1);const S=b*a/o*d,E=b*-o/a*c,_=l*S-h*E+(n+e)/2,x=h*S+l*E+(t+i)/2,P=(c-S)/a,R=(d-E)/o,F=(-c-S)/a,L=(-d-E)/o,$=Sc(1,0,P,R);let U=Sc(P,R,F,L);return s===0&&U>0&&(U-=Mr),s===1&&U<0&&(U+=Mr),[_,x,$,U]}function Ug(n,t){const e=1.3333333333333333*Math.tan(t/4),i=Math.cos(n),r=Math.sin(n),s=Math.cos(n+t),a=Math.sin(n+t);return[i,r,i-r*e,r+i*e,s+a*e,a-s*e,s,a]}function Bg(n,t,e,i,r,s,a,o,h){const l=Math.sin(h*Mr/360),c=Math.cos(h*Mr/360),d=c*(n-e)/2+l*(t-i)/2,f=-l*(n-e)/2+c*(t-i)/2;if(d===0&&f===0)return[];if(a===0||o===0)return[];a=Math.abs(a),o=Math.abs(o);const u=d*d/(a*a)+f*f/(o*o);u>1&&(a*=Math.sqrt(u),o*=Math.sqrt(u));const m=Gg(n,t,e,i,r,s,a,o,l,c),v=[];let b=m[2],S=m[3];const E=Math.max(Math.ceil(Math.abs(S)/(Mr/4)),1);S/=E;for(let _=0;_<E;_++)v.push(Ug(b,S)),b+=S;return v.map(_=>{for(let x=0;x<_.length;x+=2){let P=_[x+0],R=_[x+1];P*=a,R*=o;const F=c*P-l*R,L=l*P+c*R;_[x+0]=F+m[0],_[x+1]=L+m[1]}return _})}function ga(n){for(var t,e=[],i=0,r=0,s=0,a=0,o=null,h=null,l=0,c=0,d=0,f=n.length;d<f;d++){var u=n[d],m=u[0];switch(m){case"M":s=u[1],a=u[2];break;case"A":var v=Bg(l,c,u[6],u[7],u[4],u[5],u[1],u[2],u[3]);if(!v.length)continue;v=v.map(x=>{const[P,R,F,L,$,U,z,q]=x;return{x1:F,y1:L,x2:$,y2:U,x:z,y:q}});for(var b=0,S;b<v.length;b++)S=v[b],u=["C",S.x1,S.y1,S.x2,S.y2,S.x,S.y],b<v.length-1&&e.push(u);break;case"S":var E=l,_=c;(t=="C"||t=="S")&&(E+=E-i,_+=_-r),u=["C",E,_,u[1],u[2],u[3],u[4]];break;case"T":t=="Q"||t=="T"?(o=l*2-o,h=c*2-h):(o=l,h=c),u=Cc(l,c,o,h,u[1],u[2]);break;case"Q":o=u[1],h=u[2],u=Cc(l,c,u[1],u[2],u[3],u[4]);break;case"L":u=pa(l,c,u[1],u[2]);break;case"H":u=pa(l,c,u[1],c);break;case"V":u=pa(l,c,l,u[1]);break;case"Z":u=pa(l,c,s,a);break}t=m,l=u[u.length-2],c=u[u.length-1],u.length>4?(i=u[u.length-4],r=u[u.length-3]):(i=l,r=c),e.push(u)}return e}function pa(n,t,e,i){return["C",n,t,e,i,e,i]}function Cc(n,t,e,i,r,s){return["C",n/3+2/3*e,t/3+2/3*i,r/3+2/3*e,s/3+2/3*i,r,s]}const zg=n=>Array.isArray(n);function Xn(n){if(!(this instanceof Xn))return new Xn(n);this._path=zg(n)?n:fa(n),this._path=da(this._path),this._path=Vg(this._path),this._path=$g(this._path)}Xn.prototype.at=function(n,t){return this._walk(n,t).pos},Xn.prototype.length=function(){return this._walk(null).length},Xn.prototype._walk=function(n,t){let e=[0,0],i=[0,0,0],r=[0,0],s=0;for(let c=0;c<this._path.length;c++){let d=this._path[c];if(d[0]==="M"){if(e[0]=d[1],e[1]=d[2],n===0)return{length:s,pos:e}}else if(d[0]==="C"){i[0]=r[0]=e[0],i[1]=r[1]=e[1],i[2]=s;let f=100;for(let u=0;u<=f;u++){let m=u/f,v=a(d,m),b=o(d,m);if(s+=Go(e[0],e[1],v,b),e[0]=v,e[1]=b,typeof n=="number"&&s>=n){let S=(s-n)/(s-i[2]),E=[e[0]*(1-S)+i[0]*S,e[1]*(1-S)+i[1]*S];return{length:s,pos:E}}i[0]=e[0],i[1]=e[1],i[2]=s}}else if(d[0]==="Q"){i[0]=r[0]=e[0],i[1]=r[1]=e[1],i[2]=s;let f=100;for(let u=0;u<=f;u++){let m=u/f,v=h(d,m),b=l(d,m);if(s+=Go(e[0],e[1],v,b),e[0]=v,e[1]=b,typeof n=="number"&&s>=n){let S=(s-n)/(s-i[2]),E=[e[0]*(1-S)+i[0]*S,e[1]*(1-S)+i[1]*S];return{length:s,pos:E}}i[0]=e[0],i[1]=e[1],i[2]=s}}else if(d[0]==="L"){if(i[0]=e[0],i[1]=e[1],i[2]=s,s+=Go(e[0],e[1],d[1],d[2]),e[0]=d[1],e[1]=d[2],typeof n=="number"&&s>=n){let f=(s-n)/(s-i[2]),u=[e[0]*(1-f)+i[0]*f,e[1]*(1-f)+i[1]*f];return{length:s,pos:u}}i[0]=e[0],i[1]=e[1],i[2]=s}}return{length:s,pos:e};function a(c,d){return Math.pow(1-d,3)*r[0]+3*Math.pow(1-d,2)*d*c[1]+3*(1-d)*Math.pow(d,2)*c[3]+Math.pow(d,3)*c[5]}function o(c,d){return Math.pow(1-d,3)*r[1]+3*Math.pow(1-d,2)*d*c[2]+3*(1-d)*Math.pow(d,2)*c[4]+Math.pow(d,3)*c[6]}function h(c,d){return Math.pow(1-d,2)*r[0]+2*(1-d)*d*c[1]+Math.pow(d,2)*c[3]}function l(c,d){return Math.pow(1-d,2)*r[1]+2*(1-d)*d*c[2]+Math.pow(d,2)*c[4]}};function Go(n,t,e,i){let r=n-e,s=t-i;return Math.sqrt(r*r+s*s)}function $g(n){let t,e=0,i=0,r={S:{to:"C",x:3},T:{to:"Q",x:1}};for(let s=0,a=n.length;s<a;s++){let o=n[s],h=r[o[0]];h&&(o[0]=h.to,t&&(t[0]===h.to?(e=2*t[h.x+2]-t[h.x],i=2*t[h.x+3]-t[h.x+1]):(e=t[t.length-2],i=t[t.length-1])),o.splice(1,0,e,i)),t=o}return n}function Vg(n){let t=[],e=["L",0,0],i;for(let r=0,s=n.length;r<s;r++){let a=n[r];switch(a[0]){case"M":e=["L",a[1],a[2]],t.push(a);break;case"Z":t.push(e);break;case"H":i=t[t.length-1]||["L",0,0],t.push(["L",a[1],i[i.length-1]]);break;case"V":i=t[t.length-1]||["L",0,0],t.push(["L",i[i.length-2],a[1]]);break;default:t.push(a)}}return t}const Uo=n=>{if(typeof n=="function"||Object(n)!==n)return n;const t=new n.constructor;for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=Uo(n[e]));return t};function Bo(n){const t=Bo.ps=Bo.ps||{};return t[n]?t[n].sleep=100:t[n]={sleep:100},setTimeout(()=>{for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e!==n&&(t[e].sleep--,t[e].sleep||delete t[e])}),t[n]}function Rr(n,t,e,i){return n==null&&(n=t=e=i=0),t==null&&(t=n.y,e=n.width,i=n.height,n=n.x),{x:n,y:t,width:e,w:e,height:i,h:i,x2:n+e,y2:t+i,cx:n+e/2,cy:t+i/2,r1:Math.min(e,i)/2,r2:Math.max(e,i)/2,r0:Math.sqrt(e*e+i*i)/2,path:Kg(n,t,e,i),vb:[n,t,e,i].join(" ")}}function Tc(n,t,e,i,r,s,a,o,h){const l=1-h,c=l**3,d=l**2,f=h*h,u=f*h,m=c*n+d*3*h*e+l*3*h*h*r+u*a,v=c*t+d*3*h*i+l*3*h*h*s+u*o,b=n+2*h*(e-n)+f*(r-2*e+n),S=t+2*h*(i-t)+f*(s-2*i+t),E=e+2*h*(r-e)+f*(a-2*r+e),_=i+2*h*(s-i)+f*(o-2*s+i),x=l*n+h*e,P=l*t+h*i,R=l*r+h*a,F=l*s+h*o,L=90-Math.atan2(b-E,S-_)*180/Math.PI;return{x:m,y:v,m:{x:b,y:S},n:{x:E,y:_},start:{x,y:P},end:{x:R,y:F},alpha:L}}function kc(n,t,e,i,r,s,a,o){Array.isArray(n)||(n=[n,t,e,i,r,s,a,o]);const h=Ac(...n);return Rr(h.min.x,h.min.y,h.max.x-h.min.x,h.max.y-h.min.y)}function Hg(n,t,e){return t>=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height}function jg(n,t){n=Rr(n),t=Rr(t);const{x:e,y:i,width:r,height:s}=n,{x:a,y:o,width:h,height:l}=t,c=e+r/2,d=i+s/2,f=a+h/2,u=o+l/2;return Math.abs(c-f)<=(r+h)/2||Math.abs(d-u)<=(s+l)/2}function Ec(n,t,e,i,r){const s=-3*t+9*e-9*i+3*r,a=n*s+6*t-12*e+6*i;return n*a-3*t+3*e}function Pc(n,t,e,i,r,s,a,o,h){h==null&&(h=1),h=Math.max(0,Math.min(h,1));const l=h/2,c=12,d=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472];let u=0;for(let m=0;m<c;m++){const v=l*d[m]+l,b=Ec(v,n,e,r,a),S=Ec(v,t,i,s,o),E=b*b+S*S;u+=f[m]*Math.sqrt(E)}return l*u}function Xg(n,t,e,i,r,s,a,o){if(Math.max(n,e)<Math.min(r,a)||Math.min(n,e)>Math.max(r,a)||Math.max(t,i)<Math.min(s,o)||Math.min(t,i)>Math.max(s,o))return;const h=(n*i-t*e)*(r-a)-(n-e)*(r*o-s*a),l=(n*i-t*e)*(s-o)-(t-i)*(r*o-s*a),c=(n-e)*(s-o)-(t-i)*(r-a);if(!c)return;const d=h/c,f=l/c,u=Number(d.toFixed(2)),m=Number(f.toFixed(2));if(!(u<Number(Math.min(n,e).toFixed(2))||u>Number(Math.max(n,e).toFixed(2))||u<Number(Math.min(r,a).toFixed(2))||u>Number(Math.max(r,a).toFixed(2))||m<Number(Math.min(t,i).toFixed(2))||m>Number(Math.max(t,i).toFixed(2))||m<Number(Math.min(s,o).toFixed(2))||m>Number(Math.max(s,o).toFixed(2))))return{x:d,y:f}}function Yg(n,t,e){const i=kc(n),r=kc(t);if(!jg(i,r))return e?0:[];const s=Pc.apply(0,n),a=Pc.apply(0,t),o=Math.ceil(s/8),h=Math.ceil(a/8),l=[],c=[],d={};let f=e?0:[];for(let u=0;u<o+1;u++){const m=Tc.apply(0,n.concat(u/o));l.push({x:m.x,y:m.y,t:u/o})}for(let u=0;u<h+1;u++){const m=Tc.apply(0,t.concat(u/h));c.push({x:m.x,y:m.y,t:u/h})}for(let u=0;u<o;u++)for(let m=0;m<h;m++){const v=l[u],b=l[u+1],S=c[m],E=c[m+1],_=Math.abs(b.x-v.x)<.001?"y":"x",x=Math.abs(E.x-S.x)<.001?"y":"x",P=Xg(v.x,v.y,b.x,b.y,S.x,S.y,E.x,E.y);if(P&&d[P.x.toFixed(4)]!==P.y.toFixed(4)){d[P.x.toFixed(4)]=P.y.toFixed(4);const R=v.t+Math.abs((P[_]-v[_])/(b[_]-v[_]))*(b.t-v.t),F=S.t+Math.abs((P[x]-S[x])/(E[x]-S[x]))*(E.t-S.t);R>=0&&R<=1&&F>=0&&F<=1&&(e?f++:f.push({x:P.x,y:P.y,t1:R,t2:F}))}}return f}function qg(n,t,e){let i,r,s,a,o,h,l,c,d,f,u=e?0:[];for(let m=0,v=n.length;m<v;m++){const b=n[m];if(b[0]==="M")i=o=b[1],r=h=b[2];else{b[0]==="C"?(d=[i,r].concat(b.slice(1)),i=d[6],r=d[7]):(d=[i,r,i,r,o,h,o,h],i=o,r=h);for(let S=0,E=t.length;S<E;S++){const _=t[S];if(_[0]==="M")s=l=_[1],a=c=_[2];else{_[0]==="C"?(f=[s,a].concat(_.slice(1)),s=f[6],a=f[7]):(f=[s,a,s,a,l,c,l,c],s=l,a=c);const x=Yg(d,f,e);if(e)u+=x;else{for(let P=0,R=x.length;P<R;P++)x[P].segment1=m,x[P].segment2=S,x[P].bez1=d,x[P].bez2=f;u=u.concat(x)}}}}}return u}function Wg(n){const t=Bo(n);if(t.bbox)return Uo(t.bbox);if(!n)return Rr();let e=0,i=0,r=[],s=[],a=[];for(let f=0,u=n.length;f<u;f++)if(a=n[f],a[0]==="M")e=a[1],i=a[2],r.push(e),s.push(i);else{const m=Ac(e,i,a[1],a[2],a[3],a[4],a[5],a[6]);r=r.concat(m.min.x,m.max.x),s=s.concat(m.min.y,m.max.y),e=a[5],i=a[6]}const o=Math.min.apply(0,r),h=Math.min.apply(0,s),l=Math.max.apply(0,r),c=Math.max.apply(0,s),d=Rr(o,h,l-o,c-h);return t.bbox=Uo(d),d}function Kg(n,t,e,i,r){return r?[["M",Number(n)+Number(r),t],["l",e-r*2,0],["a",r,r,0,0,1,r,r],["l",0,i-r*2],["a",r,r,0,0,1,-r,r],["l",r*2-e,0],["a",r,r,0,0,1,-r,-r],["l",0,r*2-i],["a",r,r,0,0,1,r,-r],["z"]]:[["M",n,t],["l",e,0],["l",0,i],["l",-e,0],["z"]]}function Ac(n,t,e,i,r,s,a,o){const h=[],l=[[],[]];let c,d,f,u,m,v,b,S;for(let P=0;P<2;++P){if(P===0?(d=6*n-12*e+6*r,c=-3*n+9*e-9*r+3*a,f=3*e-3*n):(d=6*t-12*i+6*s,c=-3*t+9*i-9*s+3*o,f=3*i-3*t),Math.abs(c)<1e-12){if(Math.abs(d)<1e-12)continue;u=-f/d,u>0&&u<1&&h.push(u);continue}b=d*d-4*f*c,S=Math.sqrt(b),!(b<0)&&(m=(-d+S)/(2*c),m>0&&m<1&&h.push(m),v=(-d-S)/(2*c),v>0&&v<1&&h.push(v))}let E=h.length,_;const x=E;for(;E--;)u=h[E],_=1-u,l[0][E]=_*_*_*n+3*_*_*u*e+3*_*u*u*r+u*u*u*a,l[1][E]=_*_*_*t+3*_*_*u*i+3*_*u*u*s+u*u*u*o;return l[0][x]=n,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=o,l[0].length=l[1].length=x+2,{min:{x:Math.min.apply(0,l[0]),y:Math.min.apply(0,l[1])},max:{x:Math.max.apply(0,l[0]),y:Math.max.apply(0,l[1])}}}function Zg(n,t,e){const i=Wg(n);return!(!Hg(i,t,e)||qg(n,ga([["M",t,e],["H",i.x2+10]]),1)%2!==1)}const zo=new Map;function Mc(n){if(zo.has(n))return zo.get(n);const t=Xn(n);return zo.set(n,t),t}function Rc(n){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",n),t}function Dc(n,t){return ia?Rc(n).getTotalLength(t):Mc(n).length()}function Lc(n,t){if(ia)return Rc(n).getPointAtLength(t);{const e=Mc(n),[i,r]=e.at(t);return{x:i,y:r}}}let $e=null;function Ic(n,t,e){if(ia){$e||($e=document.createElement("canvas").getContext("2d"));const i=new Path2D(n);return $e.isPointInPath(i,t,e)}else return Zg(n,t,e)}function Oc(n,t,e,{lineWidth:i=1,lineCap:r="butt",lineJoin:s="miter"}){if(ia){if($e||($e=document.createElement("canvas").getContext("2d")),$e.isPointInStroke){$e.save(),$e.lineWidth=i,$e.lineCap=r,$e.lineJoin=s;const a=new Path2D(n),o=$e.isPointInStroke(a,t,e);return $e.restore(),o}}else return null}function Jg(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Fc={},$o={exports:{}},Nc;function Qg(){return Nc||(Nc=1,function(n){(function(t){var e="0.4.0",i="hasOwnProperty",r=/[\.\/]/,s="*",a=function(){},o=function(f,u){return f-u},h,l,c={n:{}},d=function(f,u){var m=l,v=Array.prototype.slice.call(arguments,2),b=d.listeners(f),S=0,E,_=[],x={},P=[];h=f,l=0;for(var R=0,F=b.length;R<F;R++)"zIndex"in b[R]&&(_.push(b[R].zIndex),b[R].zIndex<0&&(x[b[R].zIndex]=b[R]));for(_.sort(o);_[S]<0;)if(E=x[_[S++]],P.push(E.apply(u,v)),l)return l=m,P;for(R=0;R<F;R++)if(E=b[R],"zIndex"in E)if(E.zIndex==_[S]){if(P.push(E.apply(u,v)),l)return l=m,P;do if(S++,E=x[_[S]],E&&P.push(E.apply(u,v)),l)return l=m,P;while(E)}else x[E.zIndex]=E;else if(P.push(E.apply(u,v)),l)return l=m,P;return l=m,P.length?P:null};d.listeners=function(f){var u=f.split(r),m=c,v,b,S,E,_,x,P,R,F=[m],L=[];for(E=0,_=u.length;E<_;E++){for(R=[],x=0,P=F.length;x<P;x++)for(m=F[x].n,b=[m[u[E]],m[s]],S=2;S--;)v=b[S],v&&(R.push(v),L=L.concat(v.f||[]));F=R}return L},d.on=function(f,u){for(var m=f.split(r),v=c,b=0,S=m.length;b<S;b++)v=v.n,!v[m[b]]&&(v[m[b]]={n:{}}),v=v[m[b]];for(v.f=v.f||[],b=0,S=v.f.length;b<S;b++)if(v.f[b]==u)return a;return v.f.push(u),function(E){+E==+E&&(u.zIndex=+E)}},d.stop=function(){l=1},d.nt=function(f){return f?new RegExp("(?:\\.|\\/|^)"+f+"(?:\\.|\\/|$)").test(h):h},d.unbind=function(f,u){var m=f.split(r),v,b,S,E,_,x,P,R=[c];for(E=0,_=m.length;E<_;E++)for(x=0;x<R.length;x+=S.length-2){if(S=[x,1],v=R[x].n,m[E]!=s)v[m[E]]&&S.push(v[m[E]]);else for(b in v)v[i](b)&&S.push(v[b]);R.splice.apply(R,S)}for(E=0,_=R.length;E<_;E++)for(v=R[E];v.n;){if(u){if(v.f){for(x=0,P=v.f.length;x<P;x++)if(v.f[x]==u){v.f.splice(x,1);break}!v.f.length&&delete v.f}for(b in v.n)if(v.n[i](b)&&v.n[b].f){var F=v.n[b].f;for(x=0,P=F.length;x<P;x++)if(F[x]==u){F.splice(x,1);break}!F.length&&delete v.n[b].f}}else{delete v.f;for(b in v.n)v.n[i](b)&&v.n[b].f&&delete v.n[b].f}v=v.n}},d.once=function(f,u){var m=function(){u.apply(this,arguments),d.unbind(f,m)};return d.on(f,m)},d.version=e,d.toString=function(){return"You are running Eve "+e},n.exports?n.exports=d:t.eve=d})(xo)}($o)),$o.exports}(function(n){if(typeof Jg=="function")var t=Qg();(function(){function e(f){var u=function(m){u.parse(m)};return u.mode="text",u.type=String(f||"html").toLowerCase(),u.textchunk="",u.raw="",u.parse=h,u.on=a,u.event=s,u.end=r,u}function i(f,u,m){f==`
|
|
25
|
-
`&&this.event("newline"),d[this.mode].call(this,f,u,m)}function r(){i.call(this,"eof"),this.event("eof")}function s(f,u,m){typeof t=="function"&&t("elemental."+f+"."+u,null,u,m||"",this.raw);for(var v=this.events&&this.events[f],b=v&&v.length;b--;)try{this.events[f][b](u,m||"",this.raw)}catch{}this.raw=""}function a(f,u){this.events=this.events||{},this.events[f]=this.events[f]||[],this.events[f].push(u)}function o(f,u){return f&&(f.charAt?f.charAt(u):f[u])}function h(f){f=f||Object(f);for(var u=1,m=f.length+1,v,b,S=o(f,0);u<m;u++)v=b,b=S,S=o(f,u),this.raw+=b,i.call(this,b,S,v);this._beforeEnd=function(){i.call(this,"","",b)}}var l=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]/,c=function(){for(var f in this.attr)this.attr.hasOwnProperty(f)&&this.event("attr",f,{value:this.attr[f],tagname:this.tagname,attr:this.attr})},d={text:function(f,u,m){switch(f){case"<":case"eof":this.nodename="",this.attr={},this.mode="tag name start",this.raw=this.raw.slice(0,-1),this.textchunk&&this.event("text",this.textchunk),this.raw+=f,this.textchunk="";break;default:this.textchunk+=f}},special:function(f,u,m){if(m=="!"&&f=="-"&&u=="-")this.mode="comment start";else{if(this.textchunk=="[CDATA"&&f=="["){this.mode="cdata",this.textchunk="";return}if(f==">"||f=="eof"){this.event("special",this.textchunk),this.mode="text",this.textchunk="";return}this.textchunk+=f}},cdata:function(f,u,m){m=="]"&&f=="]"&&u==">"?(this.mode="cdata end",this.textchunk=this.textchunk.slice(0,-1)):(f=="eof"&&d["cdata end"].call(this),this.textchunk+=f)},"cdata end":function(f,u,m){this.event("cdata",this.textchunk),this.textchunk="",this.mode="text"},"comment start":function(f,u,m){u==">"||f=="eof"?(this.event("comment",""),this.mode="comment instant end"):this.mode="comment"},"comment instant end":function(f,u,m){this.mode="text"},comment:function(f,u,m){f=="-"&&m=="-"&&u==">"?(this.mode="comment end",this.textchunk=this.textchunk.slice(0,-1)):f=="eof"?this.event("comment",this.textchunk):this.textchunk+=f},"comment end":function(f,u,m){this.event("comment",this.textchunk),this.textchunk="",this.mode="text"},declaration:function(f,u,m){f=="?"&&u==">"?this.mode="declaration end":(f=="eof"&&this.event("comment",this.textchunk),this.textchunk+=f)},"declaration end":function(f,u,m){this.event("comment",this.textchunk),this.textchunk="",this.mode="text"},"tag name start":function(f,u,m){if(f=="eof")this.event("text","<");else if(!l.test(f)){if(this.mode="tag name",f=="/"){this.mode="close tag name start";return}if(f=="!"){this.mode="special",this.textchunk="";return}if(f=="?"){this.mode="declaration";return}d[this.mode].call(this,f,u,m)}},"close tag name start":function(f,u,m){l.test(f)||(this.mode="close tag name",this.tagname="",this.nodename="",d[this.mode].call(this,f,u,m))},"close tag name":function(f,u,m){if(l.test(f))this.tagname=this.nodename;else switch(f){case">":this.event("/tag",this.tagname||this.nodename),this.mode="text";break;default:!this.tagname&&(this.nodename+=f)}},"tag name":function(f,u,m){if(l.test(f))this.tagname=this.nodename,this.nodename="",this.mode="attr start";else switch(f){case">":this.event("tag",this.nodename),this.mode="text";break;default:this.nodename+=f}},"attr start":function(f,u,m){l.test(f)||(this.mode="attr",this.nodename="",d[this.mode].call(this,f,u,m))},attr:function(f,u,m){if(l.test(f)||f=="=")this.attr[this.nodename]="",this.mode="attr value start";else switch(f){case">":this.nodename=="/"?(delete this.attr["/"],this.event("tag",this.tagname,this.attr),c.call(this),this.event("/tag",this.tagname,!0)):(this.nodename&&(this.attr[this.nodename]=""),this.event("tag",this.tagname,this.attr),c.call(this)),this.mode="text";break;default:this.nodename+=f}},"attr value start":function(f,u,m){if(!l.test(f)){if(this.mode="attr value",this.quote=!1,f=="'"||f=='"'){this.quote=f;return}d[this.mode].call(this,f,u,m)}},"attr value":function(f,u,m){if(l.test(f)&&!this.quote)this.mode="attr start";else if(f==">"&&!this.quote)this.event("tag",this.tagname,this.attr),this.mode="text";else switch(f){case'"':case"'":this.quote==f&&m!="\\"&&(this.mode="attr start");break;default:this.attr[this.nodename]+=f}}};e.version="0.2.1",n.elemental=e,n.eve=t})()})(Fc);const Gc=Pe(Fc);function Vo(n,t,e,i,r,s){if(typeof r>"u"||typeof s>"u"){const a=n-e,o=t-i;return!a&&!o?0:(180+Math.atan2(-o,-a)*180/Math.PI+360)%360}else return Vo(n,t,r,s)-Vo(e,i,r,s)}const Dt=Gc.eve,tp=Gc.elemental,ma={cursor:1,cx:0,cy:0,fill:1,"fill-opacity":0,font:1,"font-family":1,"font-size":0,"font-style":1,"font-weight":1,height:0,"letter-spacing":0,opacity:0,r:0,rx:0,ry:0,src:1,stroke:1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":0,"stroke-opacity":0,"stroke-width":0,"text-anchor":1,width:0,x:0,y:0};function Ho(n,t,e){for(var i=(n+"").split(";"),r=/^\s+|\s+$/g,s,a=0,o=i.length;a<o;a++){var h=i[a].split(":");s=h[0].replace(r,"").replace(/[A-Z]/g,function(l){return"-"+l.toLowerCase()}),(!e||s in e)&&(t[s]=h[1].replace(r,""),e&&!e[s]&&(t[s]=parseFloat(t[s])))}}function Uc(n){const t=tp(),e=[],i=[],r={};let s,a,o;const h={};function l(c,d){return function(f,u){const m={type:d||c};e.push(m);for(let v in u)Object.prototype.hasOwnProperty.call(u,v)&&Dt("rappar."+c+".attr."+v,m,u[v],v);Dt("rappar."+c+".attrend",m,u)}}return Dt.on("rappar.polygon.attr.points",function(c){this.path="M"+c+"z",Dt.stop()}),Dt.on("rappar.image.attr.xlink:href",function(c){this.src=c,Dt.stop()}),Dt.on("rappar.path.attr.d",function(c){this.path=c,Dt.stop()}),Dt.on("rappar.*.attr.transform",function(c){this.transform=Ar(c).toTransformString(),Dt.stop()}),Dt.on("rappar.*.attr.fill",function(c){var d=c.match(/url\(#([^)]+)\)/),f=this;d&&(d=d[1],r[d]?this.fill=r[d]:Dt.on("rappar.found."+d,function(u){f.fill=u}),Dt.stop())}),Dt.on("rappar.line.attrend",function(c){this.path="M"+[c.x1,c.y1,c.x2,c.y2]}),Dt.on("rappar.*.attrend",function(){for(var c=i.length;c--;)if(i[c]!=this){let f="",u="";for(var d in i[c])d=="transform"?f=i[c].transform:d=="class"&&h["."+i[c][d]]?u=h["."+i[c][d]].join(";")+";"+u:d=="id"&&h["#"+i[c][d]]?u=h["#"+i[c][d]].join(";")+";"+u:typeof this[d]>"u"&&(this[d]=i[c][d]);this.type&&(typeof this.transform>"u"?this.transform=f:this.transform+=f,typeof this.style>"u"?this.style=u:this.style=u+this.style,Ho(this.style,this,ma))}}),Dt.on("rappar.*.attr.style",function(c){var d=function(){Ho(c,this,ma),Dt.unbind("rappar.*.attrend",d)};Dt.on("rappar.*.attrend",d),Dt.stop()}),Dt.on("rappar.*.attr.*",function(c,d){d in ma&&(this[d]=ma[d]?c:parseFloat(c))}),Dt.on("elemental.tag.circle",l("circle")),Dt.on("elemental.tag.ellipse",l("ellipse")),Dt.on("elemental.tag.polygon",l("polygon","path")),Dt.on("elemental.tag.path",l("path")),Dt.on("elemental.tag.line",l("line","path")),Dt.on("elemental.tag.rect",l("rect")),Dt.on("elemental.tag.image",l("image")),Dt.on("elemental.tag.text",l("text")),Dt.on("elemental.text",function(c){try{const d=$1(c);for(let f of d.stylesheet.rules){for(let u of f.selectors)h[u]=[];for(let u of f.declarations)for(let m of f.selectors)h[m].push(`${u.property}:${u.value}`)}}catch{}}),Dt.on("elemental.tag.svg",function(c,d){let f=d.width||0,u=d.height||0;if(!f||!u){const m=d.viewBox.split(/\s+/gi);f=parseFloat(m[2])-parseFloat(m[0]),u=parseFloat(m[3])-parseFloat(m[1])}e.push({type:"viewbox",width:f,height:u})}),Dt.on("rappar.text.attrend",function(){s="",a=this,this["text-anchor"]=this["text-anchor"]||"start"}),Dt.on("elemental.text",function(c,d,f){a&&(s+=f)}),Dt.on("elemental./tag.text",function(){a.text=s,a=null}),Dt.on("elemental.tag.g",function(c,d){var f={};i.push(f);for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(f[u]=d[u],Dt("rappar.g.attr."+u,f,d[u],u));Dt("rappar.g.attrend",f)}),Dt.on("elemental./tag.g",function(c,d){i.pop()}),Dt.on("elemental.tag.linearGradient",function(c,d){o={id:d.id,angle:+(360+Vo(d.x1,d.y1,d.x2,d.y2,d.x1+100,d.y1)).toFixed(2),stops:[]}}),Dt.on("elemental./tag.linearGradient",function(){for(var c=[o.angle],d,f=0,u=o.stops.length;f<u;f++)d=o.stops[f],f&&f!=u-1?c.push(d.color+":"+d.offset):c.push(d.color);r[o.id]=c.join("-"),Dt("rappar.found."+o.id,null,r[o.id])}),Dt.on("elemental.tag.radialGradient",function(c,d){o={id:d.id,stops:[]}}),Dt.on("elemental./tag.radialGradient",function(){for(var c=[],d,f=0,u=o.stops.length;f<u;f++)d=o.stops[f],f&&f!=u-1?c.push(d.color+":"+d.offset):c.push(d.color);r[o.id]="r"+c.join("-"),Dt("rappar.found."+o.id,null,r[o.id])}),Dt.on("elemental.tag.stop",function(c,d){var f={};d.style&&Ho(d.style,f),f.offset=f.offset||d.offset,f.color=f["stop-color"]||d["stop-color"],f.opacity=f["stop-opacity"]||d["stop-opacity"],~(f.offset+"").indexOf("%")?f.offset=parseFloat(f.offset):f.offset=parseFloat(f.offset)*100,f.offset=+f.offset.toFixed(2),o.stops.push(f)}),t(n),t.end(),e}const Bc=ep("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);function ep(n,t=10){const e={},i=n.split(",");for(let r=0;r<i.length;r+=2){const s="&"+i[r+1]+";",a=parseInt(i[r],t);e[s]="&#"+a+";"}return e["\\xa0"]=" ",e}function Te(n,t){const e=Object.keys(t);for(let i=0;i<e.length;i++)n=n.replace(new RegExp("{"+e[i]+"}","gi"),""+t[e[i]]);return n}function va(n){let t,e;if(!n)throw new Error("cannot create a random attribute name for an undefined object");const i="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";t="";do for(t="",e=0;e<12;e++)t+=i[Math.floor(Math.random()*i.length)];while(n[t]);return t}function ip(n){const t={left:"start",right:"end",center:"middle",start:"start",end:"end"};return t[n]||t.start}function np(n){const t={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return t[n]||t.alphabetic}const Dr={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}};class _a{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}addColorStop(t,e){const i=this.__ctx.__createElement("stop");if(i.setAttribute("offset",""+t),e.indexOf("rgba")!==-1){const s=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(e);s&&(i.setAttribute("stop-color",Te("rgb({r},{g},{b})",{r:s[1],g:s[2],b:s[3]})),i.setAttribute("stop-opacity",s[4]))}else i.setAttribute("stop-color",e);this.__root.appendChild(i)}}class jo{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}}class Lr{__document=document;__canvas;__ctx;width;height;__styleStack;__groupStack;__rootSVG;__ids;__SVGdefs;__currentElement;__currentElementsToStyle=null;constructor({canvas:t,width:e=500,height:i=500,enableMirroring:r=!1}){this.enableMirroring=r,t?(this.__canvas=t,this.__ctx=t.getContext("2d"),this.width=t.width,this.height=t.height):(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d"),this.width=e,this.height=i),this.__setDefaultStyles(),this.__styleStack=[this.__getStyleState()],this.__groupStack=[],this.__rootSVG=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__rootSVG.setAttribute("version","1.1"),this.__rootSVG.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__rootSVG.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__rootSVG.setAttribute("width",""+this.width),this.__rootSVG.setAttribute("height",""+this.height),this.__ids={},this.__SVGdefs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__rootSVG.appendChild(this.__SVGdefs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__rootSVG.appendChild(this.__currentElement)}__setDefaultStyles(){const t=Object.keys(Dr);for(let e=0,i=t.length;e<i;e++){const r=t[e];this[r]=Dr[r].canvas}}__getStyleState(){const t={},e=Object.keys(Dr);for(let i=0,r=e.length;i<r;i++){const s=e[i];t[s]=this[s]}return t}__applyStyleState(t){const e=Object.keys(t);for(let i=0,r=e.length;i<r;i++){const s=e[i];this[s]=t[s]}}__createElement(t,e={},i=!1){const r=this.__document.createElementNS("http://www.w3.org/2000/svg",t),s=Object.keys(e);i&&(r.setAttribute("fill","none"),r.setAttribute("stroke","none"));for(let a=0;a<s.length;a++){const o=s[a];r.setAttribute(o,e[o])}return r}__applyStyleToCurrentElement(t){let e=this.__currentElement;const i=this.__currentElementsToStyle;i&&(e.setAttribute(t,""),e=i.element,i.children.forEach(s=>{s.setAttribute(t,"")}));const r=Object.keys(Dr);for(let s=0;s<r.length;s++){const a=Dr[r[s]],o=this[r[s]];if(a.apply){if(o instanceof jo){if(o.__ctx)for(;o.__ctx.__SVGdefs.childNodes.length;){const h=o.__ctx.__SVGdefs.childNodes[0].getAttribute("id");this.__ids[h]=h,this.__SVGdefs.appendChild(o.__ctx.__SVGdefs.childNodes[0])}e.setAttribute(a.apply,Te("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof _a)e.setAttribute(a.apply,Te("url(#{id})",{id:o.__root.getAttribute("id")}));else if(a.apply.indexOf(t)!==-1&&a.svg!==o)if((a.svgAttr==="stroke"||a.svgAttr==="fill")&&o.indexOf("rgba")!==-1){const l=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o);e.setAttribute(a.svgAttr,Te("rgb({r},{g},{b})",{r:l[1],g:l[2],b:l[3]}));let c=parseFloat(l[4]);const d=this.globalAlpha;d!=null&&(c*=d),e.setAttribute(a.svgAttr+"-opacity",""+c)}else{let h=a.svgAttr;if(r[s]==="globalAlpha"&&(h=t+"-"+a.svgAttr,e.getAttribute(h)))continue;h&&e.setAttribute(h,o)}}}}__closestGroupOrSvg(t){return t=t||this.__currentElement,t.nodeName==="g"||t.nodeName==="svg"?t:this.__closestGroupOrSvg(t.parentNode)}getSerializedSvg(t){let e=new XMLSerializer().serializeToString(this.__rootSVG);if(/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi.test(e)&&(e=e.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),t){const r=Object.keys(Bc);for(let s=0,a=r.length;s<a;s++){const o=r[s],h=Bc[o],l=new RegExp(o,"gi");l.test(e)&&(e=e.replace(l,h))}}return e}getSvg(){return this.__rootSVG}save(){const t=this.__createElement("g"),e=this.__closestGroupOrSvg();this.__groupStack.push(e),e.appendChild(t),this.__currentElement=t,this.__styleStack.push(this.__getStyleState())}restore(){this.__currentElementsToStyle=null;const t=this.__groupStack.pop();t?this.__currentElement=t:this.__currentElement=this.__rootSVG.childNodes[1];const e=this.__styleStack.pop();e&&this.__applyStyleState(e)}__addTransform(t){const e=this.__closestGroupOrSvg();if(e.childNodes.length>0){this.__currentElement.nodeName==="path"&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());const r=this.__createElement("g");e.appendChild(r),this.__currentElement=r}let i=this.__currentElement.getAttribute("transform");i?i+=" ":i="",i+=t,this.__currentElement.setAttribute("transform",i)}scale(t,e){e===void 0&&(e=t),this.__addTransform(Te("scale({x},{y})",{x:t,y:e}))}rotate(t){const e=t*180/Math.PI;this.__addTransform(Te("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))}translate(t,e){this.__addTransform(Te("translate({x},{y})",{x:t,y:e}))}transform(t,e,i,r,s,a){this.__addTransform(Te("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:i,d:r,e:s,f:a}))}beginPath(){this.__currentDefaultPath="",this.__currentPosition={};const t=this.__createElement("path",{},!0);this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t}__applyCurrentDefaultPath(){const t=this.__currentElement;t.nodeName==="path"?t.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",t.nodeName)}__addPathCommand(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t}moveTo(t,e){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(Te("M {x} {y}",this.__currentPosition))}closePath(){this.__currentDefaultPath&&this.__addPathCommand("Z")}lineTo(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(Te("L {x} {y}",this.__currentPosition)):this.__addPathCommand(Te("M {x} {y}",this.__currentPosition))}bezierCurveTo(t,e,i,r,s,a){this.__currentPosition={x:s,y:a},this.__addPathCommand(Te("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:i,cp2y:r,x:s,y:a}))}quadraticCurveTo(t,e,i,r){this.__currentPosition={x:i,y:r},this.__addPathCommand(Te("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:i,y:r}))}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}arcTo(t,e,i,r,s){const a=this.__currentPosition&&this.__currentPosition.x,o=this.__currentPosition&&this.__currentPosition.y;if(typeof a>"u"||typeof o>"u")return;if(s<0)throw new Error("IndexSizeError: The radius provided ("+s+") is negative.");if(a===t&&o===e||t===i&&e===r||s===0){this.lineTo(t,e);return}const h=this.normalize([a-t,o-e]),l=this.normalize([i-t,r-e]);if(h[0]*l[1]===h[1]*l[0]){this.lineTo(t,e);return}const c=h[0]*l[0]+h[1]*l[1],d=Math.acos(Math.abs(c)),f=this.normalize([h[0]+l[0],h[1]+l[1]]),u=s/Math.sin(d/2),m=t+u*f[0],v=e+u*f[1],b=[-h[1],h[0]],S=[l[1],-l[0]],E=function(P){const R=P[0];return P[1]>=0?Math.acos(R):-Math.acos(R)},_=E(b),x=E(S);this.lineTo(m+b[0]*s,v+b[1]*s),this.arc(m,v,s,_,x)}stroke(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")}fill(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")}rect(t,e,i,r){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.closePath()}fillRect(t,e,i,r){const s=this.__createElement("rect",{x:t,y:e,width:i,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("fill")}strokeRect(t,e,i,r){const s=this.__createElement("rect",{x:t,y:e,width:i,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("stroke")}__clearCanvas(){const e=this.__closestGroupOrSvg().getAttribute("transform"),i=this.__rootSVG.childNodes[1],r=i.childNodes;for(let s=r.length-1;s>=0;s--)r[s]&&i.removeChild(r[s]);this.__currentElement=i,this.__groupStack=[],e&&this.__addTransform(e)}clearRect(t,e,i,r){if(t===0&&e===0&&i===this.width&&r===this.height){this.__clearCanvas();return}const s=this.__closestGroupOrSvg(),a=this.__createElement("rect",{x:t,y:e,width:i,height:r,fill:"#FFFFFF"},!0);s.appendChild(a)}createLinearGradient(t,e,i,r){const s=this.__createElement("linearGradient",{id:va(this.__ids),x1:t+"px",x2:i+"px",y1:e+"px",y2:r+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(s),new _a(s,this)}createRadialGradient(t,e,i,r,s,a){const o=this.__createElement("radialGradient",{id:va(this.__ids),cx:r+"px",cy:s+"px",r:a+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(o),new _a(o,this)}__parseFont(){const e=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:%|in|[cem]m|ex|p[CustomCanvasContext]))(?:\s*\/\s*(normal|[.\d]+(?:%|in|[cem]m|ex|p[CustomCanvasContext])))?\s*([-,'"\sa-z0-9]+?)\s*$/i.exec(this.font),i={style:e[1]||"normal",size:e[4]||"10px",family:e[6]||"sans-serif",weight:e[3]||"normal",decoration:e[2]||"normal",href:null};return this.__fontUnderline==="underline"&&(i.decoration="underline"),this.__fontHref&&(i.href=this.__fontHref),i}__wrapTextLink(t,e){if(t.href){const i=this.__createElement("a");return i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),i.appendChild(e),i}return e}__applyText(t,e,i,r){const s=this.__parseFont(),a=this.__closestGroupOrSvg(),o=this.__createElement("text",{"font-family":s.family,"font-size":s.size,"font-style":s.style,"font-weight":s.weight,"text-decoration":s.decoration,x:e,y:i,"text-anchor":ip(this.textAlign),"dominant-baseline":np(this.textBaseline)},!0);o.appendChild(this.__document.createTextNode(t)),this.__currentElement=o,this.__applyStyleToCurrentElement(r),a.appendChild(this.__wrapTextLink(s,o))}fillText(t,e,i){this.__applyText(t,e,i,"fill")}strokeText(t,e,i){this.__applyText(t,e,i,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,i,r,s,a){if(r===s)return;r=r%(2*Math.PI),s=s%(2*Math.PI),r===s&&(s=(s+2*Math.PI-.001*(a?-1:1))%(2*Math.PI));const o=t+i*Math.cos(s),h=e+i*Math.sin(s),l=t+i*Math.cos(r),c=e+i*Math.sin(r),d=a?0:1;let f=0,u=s-r;u<0&&(u+=2*Math.PI),a?f=u>Math.PI?0:1:f=u>Math.PI?1:0,this.lineTo(l,c),this.__addPathCommand(Te("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:i,ry:i,xAxisRotation:0,largeArcFlag:f,sweepFlag:d,endX:o,endY:h})),this.__currentPosition={x:o,y:h}}clip(){const t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),i=va(this.__ids),r=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",i),e.appendChild(this.__currentElement),this.__SVGdefs.appendChild(e),t.setAttribute("clip-path",Te("url(#{id})",{id:i})),t.appendChild(r),this.__currentElement=r}drawImage(...t){let e=t[0],i,r,s,a,o=0,h=0,l,c,d,f,u,m,v,b;if(t.length===3)i=t[1],r=t[2],l=e.width,c=e.height,s=l,a=c;else if(t.length===5)i=t[1],r=t[2],s=t[3],a=t[4],l=e.width,c=e.height;else if(t.length===9)o=t[1],h=t[2],l=t[3],c=t[4],i=t[5],r=t[6],s=t[7],a=t[8];else throw new Error("Invalid number of arguments passed to drawImage: "+arguments.length);const S=this.__closestGroupOrSvg();this.__currentElement;const E="translate("+i+", "+r+")";if(e instanceof Lr){if(d=e.getSvg().cloneNode(!0),d.childNodes&&d.childNodes.length>1){for(f=d.childNodes[0];f.childNodes.length;)b=f.childNodes[0].getAttribute("id"),this.__ids[b]=b,this.__SVGdefs.appendChild(f.childNodes[0]);if(u=d.childNodes[1],u){const _=u.getAttribute("transform");let x;_?x=_+" "+E:x=E,u.setAttribute("transform",x),S.appendChild(u)}}}else(e.nodeName==="CANVAS"||e.nodeName==="IMG")&&(m=this.__createElement("image"),m.setAttribute("width",s),m.setAttribute("height",a),m.setAttribute("preserveAspectRatio","none"),(o||h||l!==e.width||c!==e.height)&&(v=this.__document.createElement("canvas"),v.width=s,v.height=a,v.getContext("2d")?.drawImage(e,o,h,l,c,0,0,s,a),e=v),m.setAttribute("transform",E),m.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.nodeName==="CANVAS"?e.toDataURL():e.getAttribute("src")),S.appendChild(m))}createPattern(t,e){const i=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),r=va(this.__ids);let s;return i.setAttribute("id",r),t.nodeName==="CANVAS"||t.nodeName==="IMG"?(s=this.__document.createElementNS("http://www.w3.org/2000/svg","image"),s.setAttribute("width",""+t.width),s.setAttribute("height",""+t.height),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.nodeName==="CANVAS"?t.toDataURL():t.getAttribute("src")),i.appendChild(s),this.__SVGdefs.appendChild(i)):t instanceof Lr&&(i.setAttribute("width",""+t.width),i.setAttribute("height",""+t.height),i.appendChild(t.__rootSVG.childNodes[1]),this.__SVGdefs.appendChild(i)),new jo(i,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}drawFocusRing(){}createImageData(){}getImageData(){}putImageData(){}globalCompositeOperation(){}setTransform(){}}const zc=class k1{point;constructor(t){this.point=new Wt(t)}static fromSVGPathData(t){if(t.length<3)throw new Error("Line 参数个数错误");if(t[0].toUpperCase()!=="L")throw new Error("Line command 错误");return new k1({x:t[1],y:t[2]})}toSVGPathData(){return["L",this.point.x,this.point.y]}toSVGPathD(){return"L "+this.point.toSVGPathD()}},$c=class E1 extends zc{rx;ry;xAxisRotate;largeArcFlag;sweepFlag;constructor(t){super(t),this.rx=t.rx,this.ry=t.ry,this.xAxisRotate=t?.xAxisRotate??0,this.largeArcFlag=t?.largeArcFlag??1,this.sweepFlag=t?.sweepFlag??1}static fromSVGPathData(t){if(t.length<8)throw new Error("Arc 参数个数错误");if(t[0].toUpperCase()!=="A")throw new Error("Arc command 错误");return new E1({x:t[6],y:t[7],rx:t[1],ry:t[2],xAxisRotate:t[3],largeArcFlag:t[4],sweepFlag:t[5]})}toSVGPathData(){return["A",this.rx,this.ry,this.xAxisRotate,this.largeArcFlag,this.sweepFlag,this.point.x,this.point.y]}toSVGPathD(){return`A ${this.rx},${this.ry} ${this.xAxisRotate} ${this.largeArcFlag},${this.sweepFlag} ${this.point.toSVGPathD()}`}};class Xo extends zc{ctrlPoints=[];constructor(t){super(t),this.ctrlPoints.push(new Wt({x:t.c1x,y:t.c1y})),this.ctrlPoints.push(new Wt({x:t.c2x,y:t.c2y}))}static fromSVGPathData(t){if(t.length<7)throw new Error("CubicBezier 参数个数错误");if(t[0].toUpperCase()!=="C")throw new Error("CubicBezier command 错误");return new Xo({c1x:t[1],c1y:t[2],c2x:t[3],c2y:t[4],x:t[5],y:t[6]})}toSVGPathData(){return["C",this.ctrlPoints[0].x,this.ctrlPoints[0].y,this.ctrlPoints[1].x,this.ctrlPoints[1].y,this.point.x,this.point.y]}toSVGPathD(){return`C ${this.ctrlPoints.map(t=>t.toSVGPathD()).join(" ")} ${this.point.toSVGPathD()}`}}const Yo=Xo;class mn{startPoint;isClosed=!1;lines=[];normalizedLines=[];constructor(t){this.startPoint=t?.startPoint??null,this.isClosed=t?.isClosed??!1,t?.lines?.forEach(this.addLine),this.normalize()}setStartPoint(t,e){return this.startPoint=new Wt({x:t,y:e}),this}addLine(t){return this.lines.push(t),this}normalize(){let t=this.lines.reduce((i,r)=>(i+=r.toSVGPathD(),i),"");this.startPoint&&(t="M "+this.startPoint.toSVGPathD()+t),this.isClosed&&(t+="Z"),this.normalizedLines=[];const e=ga(da(fa(t)));for(let i=0,r=e.length;i<r;i++){const s=e[i];if(i==0&&s[0]=="M"){this.setStartPoint(s[1],s[2]);continue}if(i==r-1&&s[0]=="Z"){this.isClosed=!0;continue}this.normalizedLines.push(Yo.fromSVGPathData(s))}return this}static fromSVGPathD(t,e){if(!xc(t))throw new Error("Not an SVG path!");const i=ga(da(fa(t)));return mn.fromSVGPathData(i,e)}static fromSVGPathData(t,e){const i=new mn;for(let s=0,a=t.length;s<a;s++){const o=t[s],h=o[0];if(s==0&&h=="M"){i.setStartPoint(o[1],o[2]);continue}if(s==a-1&&h=="Z"){i.isClosed=!0;continue}i.addLine(new Yo({c1x:o[1],c1y:o[2],c2x:o[3],c2y:o[4],x:o[5],y:o[6]}))}i.normalize();const r=Ar(e??"");return i.transform(r)}toSVGPathD(){let t="";this.startPoint&&(t+="M "+this.startPoint.toSVGPathD());for(let e=0,i=this.normalizedLines.length;e<i;e++)t+=this.normalizedLines[e].toSVGPathD();return this.isClosed&&(t+="Z"),t}toSVGPathData(){const t=[];this.startPoint&&t.push(["M",...this.startPoint.toSVGPathData()]);for(let e=0,i=this.normalizedLines.length;e<i;e++)t.push(this.normalizedLines[e].toSVGPathData());return this.isClosed&&t.push(["Z"]),t}toCanvas(t){const e=this.normalizedLines;e.length&&(this.startPoint&&(t.beginPath(),t.moveTo(this.startPoint.x,this.startPoint.y)),e.forEach(i=>{const[r,...s]=i.toSVGPathData();r==="M"?t.moveTo(s[0],s[1]):r==="Z"?t.closePath():t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}),this.isClosed&&t.closePath())}get bounds(){let t=[0,0,0,0];if(this.normalizedLines.length){t=[1/0,1/0,-1/0,-1/0];for(let e=0,i=this.normalizedLines.length;e<i;e++){const r=this.normalizedLines[e],s=[...r.ctrlPoints,r.point];for(let a=0;a<s.length;a++){const o=s[a].x,h=s[a].y;o<t[0]&&(t[0]=o),h<t[1]&&(t[1]=h),o>t[2]&&(t[2]=o),h>t[3]&&(t[3]=h)}}}return t}get size(){const t=this.bounds;return[t[2]-t[0],t[3]-t[1]]}get center(){const[t,e,i,r]=this.bounds;return[(t+i)/2,(e+r)/2]}getTotalLength(){return Dc(this.toSVGPathD())}getPointAtLength(t){return Lc(this.toSVGPathD(),t)}isPointInPath(t,e){return Ic(this.toSVGPathD(),t,e)}isPointInStroke(t,e,i={lineWidth:1,lineCap:"butt",lineJoin:"miter"}){return Oc(this.toSVGPathD(),t,e,i)}transform(t){if(this.startPoint){const[e,i]=t.transformPoint(this.startPoint.x,this.startPoint.y);this.setStartPoint(e,i)}return this.normalizedLines=this.normalizedLines.map(e=>{const[i,...r]=e.toSVGPathData(),s=[i];for(let a=0,o=r.length;a<o;a+=2){const h=r[a],l=r[a+1],[c,d]=t.transformPoint(h,l);s.push(c,d)}return Yo.fromSVGPathData(s)}),this}translate(t,e){const i=new we().translate(t,e);return this.transform(i)}rotate(t,e=0,i=0){const r=new we().rotate(t,e,i);return this.transform(r)}scale(t,e=t,i=0,r=0){const s=new we().scale(t,e,i,r);return this.transform(s)}skew(t,e=0){const i=new we().skew(t,e);return this.transform(i)}trim(){const[t,e]=this.bounds;return this.translate(-t,-e),this}static generateRosetta(t,e,i,r,s){if(s==0)throw new Error("no dividing by zero, please");const a=new mn;a.setStartPoint(t,e);const o=360/s;for(let h=0;h<s;h+=1){const l=o*h*Math.PI/180,c=t+2*i*Math.cos(l),d=e+2*i*Math.sin(l);a.addLine(new $c({x:c,y:d,rx:i,ry:r,xAxisRotate:o*h,largeArcFlag:1,sweepFlag:1})),a.addLine(new $c({x:t,y:e,rx:i,ry:r,xAxisRotate:o*h,largeArcFlag:1,sweepFlag:1}))}return a.normalize(),a}}var Vc={exports:{}};(function(n,t){(function(e,i){n.exports=i()})(window,function(){return function(e){var i={};function r(s){if(i[s])return i[s].exports;var a=i[s]={i:s,l:!1,exports:{}};return e[s].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=i,r.d=function(s,a,o){r.o(s,a)||Object.defineProperty(s,a,{enumerable:!0,get:o})},r.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},r.t=function(s,a){if(1&a&&(s=r(s)),8&a||4&a&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),2&a&&typeof s!="string")for(var h in s)r.d(o,h,function(l){return s[l]}.bind(null,h));return o},r.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return r.d(a,"a",a),a},r.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},r.p="",r(r.s=1)}([function(e,i,r){var s,a;s=[r(2)],(a=function(o){function h(p){if(h.is(p,"function"))return l?p():o.on("raphael.DOMload",p);if(h.is(p,nt))return h._engine.create[E](h,p.splice(0,3+h.is(p[0],pt))).add(p);var w=Array.prototype.slice.call(arguments,0);if(h.is(w[w.length-1],"function")){var C=w.pop();return l?C.call(h._engine.create[E](h,w)):o.on("raphael.DOMload",function(){C.call(h._engine.create[E](h,w))})}return h._engine.create[E](h,arguments)}h.version="2.3.0",h.eve=o;var l,c,d=/[, ]+/,f={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},u=/\{(\d+)\}/g,m="hasOwnProperty",v={doc:document,win:window},b={was:Object.prototype[m].call(v.win,"Raphael"),is:v.win.Raphael},S=function(){this.ca=this.customAttributes={}},E="apply",_="concat",x="ontouchstart"in window||window.TouchEvent||window.DocumentTouch&&document instanceof DocumentTouch,P="",R=" ",F=String,L="split",$="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[L](R),U={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},z=F.prototype.toLowerCase,q=Math,K=q.max,Z=q.min,at=q.abs,vt=q.pow,_t=q.PI,pt="number",nt="array",J=Object.prototype.toString,I=(h._ISURL=/^url\(['"]?(.+?)['"]?\)$/i,/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i),D={NaN:1,Infinity:1,"-Infinity":1},A=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,B=q.round,j=parseFloat,W=parseInt,N=F.prototype.toUpperCase,Y=h._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0,class:""},X=h._availableAnimAttrs={blur:pt,"clip-rect":"csv",cx:pt,cy:pt,fill:"colour","fill-opacity":pt,"font-size":pt,height:pt,opacity:pt,path:"path",r:pt,rx:pt,ry:pt,stroke:"colour","stroke-opacity":pt,"stroke-width":pt,transform:"transform",width:pt,x:pt,y:pt},et=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,ht={hs:1,rg:1},mt=/,?([achlmqrstvxz]),?/gi,bt=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,Tt=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,yt=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi,Et=(h._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,{}),Pt=function(p,w){return j(p)-j(w)},Ot=function(p){return p},Ct=h._rectPath=function(p,w,C,g,y){return y?[["M",p+y,w],["l",C-2*y,0],["a",y,y,0,0,1,y,y],["l",0,g-2*y],["a",y,y,0,0,1,-y,y],["l",2*y-C,0],["a",y,y,0,0,1,-y,-y],["l",0,2*y-g],["a",y,y,0,0,1,y,-y],["z"]]:[["M",p,w],["l",C,0],["l",0,g],["l",-C,0],["z"]]},Jt=function(p,w,C,g){return g==null&&(g=C),[["M",p,w],["m",0,-g],["a",C,g,0,1,1,0,2*g],["a",C,g,0,1,1,0,-2*g],["z"]]},zt=h._getPath={path:function(p){return p.attr("path")},circle:function(p){var w=p.attrs;return Jt(w.cx,w.cy,w.r)},ellipse:function(p){var w=p.attrs;return Jt(w.cx,w.cy,w.rx,w.ry)},rect:function(p){var w=p.attrs;return Ct(w.x,w.y,w.width,w.height,w.r)},image:function(p){var w=p.attrs;return Ct(w.x,w.y,w.width,w.height)},text:function(p){var w=p._getBBox();return Ct(w.x,w.y,w.width,w.height)},set:function(p){var w=p._getBBox();return Ct(w.x,w.y,w.width,w.height)}},ce=h.mapPath=function(p,w){if(!w)return p;var C,g,y,k,M,O,G;for(y=0,M=(p=Nn(p)).length;y<M;y++)for(k=1,O=(G=p[y]).length;k<O;k+=2)C=w.x(G[k],G[k+1]),g=w.y(G[k],G[k+1]),G[k]=C,G[k+1]=g;return p};if(h._g=v,h.type=v.win.SVGAngle||v.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML",h.type=="VML"){var Xt,Ee=v.doc.createElement("div");if(Ee.innerHTML='<v:shape adj="1"/>',(Xt=Ee.firstChild).style.behavior="url(#default#VML)",!Xt||typeof Xt.adj!="object")return h.type=P;Ee=null}function ye(p){if(typeof p=="function"||Object(p)!==p)return p;var w=new p.constructor;for(var C in p)p[m](C)&&(w[C]=ye(p[C]));return w}h.svg=!(h.vml=h.type=="VML"),h._Paper=S,h.fn=c=S.prototype=h.prototype,h._id=0,h.is=function(p,w){return(w=z.call(w))=="finite"?!D[m](+p):w=="array"?p instanceof Array:w=="null"&&p===null||w==typeof p&&p!==null||w=="object"&&p===Object(p)||w=="array"&&Array.isArray&&Array.isArray(p)||J.call(p).slice(8,-1).toLowerCase()==w},h.angle=function(p,w,C,g,y,k){if(y==null){var M=p-C,O=w-g;return M||O?(180+180*q.atan2(-O,-M)/_t+360)%360:0}return h.angle(p,w,y,k)-h.angle(C,g,y,k)},h.rad=function(p){return p%360*_t/180},h.deg=function(p){return Math.round(180*p/_t%360*1e3)/1e3},h.snapTo=function(p,w,C){if(C=h.is(C,"finite")?C:10,h.is(p,nt)){for(var g=p.length;g--;)if(at(p[g]-w)<=C)return p[g]}else{var y=w%(p=+p);if(y<C)return w-y;if(y>p-C)return w-y+p}return w};var li,on;h.createUUID=(li=/[xy]/g,on=function(p){var w=16*q.random()|0;return(p=="x"?w:3&w|8).toString(16)},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(li,on).toUpperCase()}),h.setWindow=function(p){o("raphael.setWindow",h,v.win,p),v.win=p,v.doc=v.win.document,h._engine.initWin&&h._engine.initWin(v.win)};var Qe=function(p){if(h.vml){var w,C=/^\s+|\s+$/g;try{var g=new ActiveXObject("htmlfile");g.write("<body>"),g.close(),w=g.body}catch{w=createPopup().document.body}var y=w.createTextRange();Qe=ve(function(M){try{w.style.color=F(M).replace(C,P);var O=y.queryCommandValue("ForeColor");return"#"+("000000"+(O=(255&O)<<16|65280&O|(16711680&O)>>>16).toString(16)).slice(-6)}catch{return"none"}})}else{var k=v.doc.createElement("i");k.title="Raphaël Colour Picker",k.style.display="none",v.doc.body.appendChild(k),Qe=ve(function(M){return k.style.color=M,v.doc.defaultView.getComputedStyle(k,P).getPropertyValue("color")})}return Qe(p)},Ri=function(){return"hsb("+[this.h,this.s,this.b]+")"},Di=function(){return"hsl("+[this.h,this.s,this.l]+")"},ci=function(){return this.hex},ui=function(p,w,C){if(w==null&&h.is(p,"object")&&"r"in p&&"g"in p&&"b"in p&&(C=p.b,w=p.g,p=p.r),w==null&&h.is(p,"string")){var g=h.getRGB(p);p=g.r,w=g.g,C=g.b}return(p>1||w>1||C>1)&&(p/=255,w/=255,C/=255),[p,w,C]},dr=function(p,w,C,g){var y={r:p*=255,g:w*=255,b:C*=255,hex:h.rgb(p,w,C),toString:ci};return h.is(g,"finite")&&(y.opacity=g),y};function ve(p,w,C){return function g(){var y=Array.prototype.slice.call(arguments,0),k=y.join("␀"),M=g.cache=g.cache||{},O=g.count=g.count||[];return M[m](k)?(function(G,H){for(var Q=0,st=G.length;Q<st;Q++)if(G[Q]===H)return G.push(G.splice(Q,1)[0])}(O,k),C?C(M[k]):M[k]):(O.length>=1e3&&delete M[O.shift()],O.push(k),M[k]=p[E](w,y),C?C(M[k]):M[k])}}h.color=function(p){var w;return h.is(p,"object")&&"h"in p&&"s"in p&&"b"in p?(w=h.hsb2rgb(p),p.r=w.r,p.g=w.g,p.b=w.b,p.hex=w.hex):h.is(p,"object")&&"h"in p&&"s"in p&&"l"in p?(w=h.hsl2rgb(p),p.r=w.r,p.g=w.g,p.b=w.b,p.hex=w.hex):(h.is(p,"string")&&(p=h.getRGB(p)),h.is(p,"object")&&"r"in p&&"g"in p&&"b"in p?(w=h.rgb2hsl(p),p.h=w.h,p.s=w.s,p.l=w.l,w=h.rgb2hsb(p),p.v=w.b):(p={hex:"none"}).r=p.g=p.b=p.h=p.s=p.v=p.l=-1),p.toString=ci,p},h.hsb2rgb=function(p,w,C,g){var y,k,M,O,G;return this.is(p,"object")&&"h"in p&&"s"in p&&"b"in p&&(C=p.b,w=p.s,g=p.o,p=p.h),O=(G=C*w)*(1-at((p=(p*=360)%360/60)%2-1)),y=k=M=C-G,dr(y+=[G,O,0,0,O,G][p=~~p],k+=[O,G,G,O,0,0][p],M+=[0,0,O,G,G,O][p],g)},h.hsl2rgb=function(p,w,C,g){var y,k,M,O,G;return this.is(p,"object")&&"h"in p&&"s"in p&&"l"in p&&(C=p.l,w=p.s,p=p.h),(p>1||w>1||C>1)&&(p/=360,w/=100,C/=100),O=(G=2*w*(C<.5?C:1-C))*(1-at((p=(p*=360)%360/60)%2-1)),y=k=M=C-G/2,dr(y+=[G,O,0,0,O,G][p=~~p],k+=[O,G,G,O,0,0][p],M+=[0,0,O,G,G,O][p],g)},h.rgb2hsb=function(p,w,C){var g,y;return p=(C=ui(p,w,C))[0],w=C[1],C=C[2],{h:(((y=(g=K(p,w,C))-Z(p,w,C))==0?null:g==p?(w-C)/y:g==w?(C-p)/y+2:(p-w)/y+4)+360)%6*60/360,s:y==0?0:y/g,b:g,toString:Ri}},h.rgb2hsl=function(p,w,C){var g,y,k,M;return p=(C=ui(p,w,C))[0],w=C[1],C=C[2],g=((y=K(p,w,C))+(k=Z(p,w,C)))/2,{h:(((M=y-k)==0?null:y==p?(w-C)/M:y==w?(C-p)/M+2:(p-w)/M+4)+360)%6*60/360,s:M==0?0:g<.5?M/(2*g):M/(2-2*g),l:g,toString:Di}},h._path2string=function(){return this.join(",").replace(mt,"$1")},h._preload=function(p,w){var C=v.doc.createElement("img");C.style.cssText="position:absolute;left:-9999em;top:-9999em",C.onload=function(){w.call(this),this.onload=null,v.doc.body.removeChild(this)},C.onerror=function(){v.doc.body.removeChild(this)},v.doc.body.appendChild(C),C.src=p};function fi(){return this.hex}function hn(p,w){for(var C=[],g=0,y=p.length;y-2*!w>g;g+=2){var k=[{x:+p[g-2],y:+p[g-1]},{x:+p[g],y:+p[g+1]},{x:+p[g+2],y:+p[g+3]},{x:+p[g+4],y:+p[g+5]}];w?g?y-4==g?k[3]={x:+p[0],y:+p[1]}:y-2==g&&(k[2]={x:+p[0],y:+p[1]},k[3]={x:+p[2],y:+p[3]}):k[0]={x:+p[y-2],y:+p[y-1]}:y-4==g?k[3]=k[2]:g||(k[0]={x:+p[g],y:+p[g+1]}),C.push(["C",(-k[0].x+6*k[1].x+k[2].x)/6,(-k[0].y+6*k[1].y+k[2].y)/6,(k[1].x+6*k[2].x-k[3].x)/6,(k[1].y+6*k[2].y-k[3].y)/6,k[2].x,k[2].y])}return C}h.getRGB=ve(function(p){if(!p||(p=F(p)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:fi};if(p=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:fi};!ht[m](p.toLowerCase().substring(0,2))&&p.charAt()!="#"&&(p=Qe(p));var w,C,g,y,k,M,O=p.match(I);return O?(O[2]&&(g=W(O[2].substring(5),16),C=W(O[2].substring(3,5),16),w=W(O[2].substring(1,3),16)),O[3]&&(g=W((k=O[3].charAt(3))+k,16),C=W((k=O[3].charAt(2))+k,16),w=W((k=O[3].charAt(1))+k,16)),O[4]&&(M=O[4][L](et),w=j(M[0]),M[0].slice(-1)=="%"&&(w*=2.55),C=j(M[1]),M[1].slice(-1)=="%"&&(C*=2.55),g=j(M[2]),M[2].slice(-1)=="%"&&(g*=2.55),O[1].toLowerCase().slice(0,4)=="rgba"&&(y=j(M[3])),M[3]&&M[3].slice(-1)=="%"&&(y/=100)),O[5]?(M=O[5][L](et),w=j(M[0]),M[0].slice(-1)=="%"&&(w*=2.55),C=j(M[1]),M[1].slice(-1)=="%"&&(C*=2.55),g=j(M[2]),M[2].slice(-1)=="%"&&(g*=2.55),(M[0].slice(-3)=="deg"||M[0].slice(-1)=="°")&&(w/=360),O[1].toLowerCase().slice(0,4)=="hsba"&&(y=j(M[3])),M[3]&&M[3].slice(-1)=="%"&&(y/=100),h.hsb2rgb(w,C,g,y)):O[6]?(M=O[6][L](et),w=j(M[0]),M[0].slice(-1)=="%"&&(w*=2.55),C=j(M[1]),M[1].slice(-1)=="%"&&(C*=2.55),g=j(M[2]),M[2].slice(-1)=="%"&&(g*=2.55),(M[0].slice(-3)=="deg"||M[0].slice(-1)=="°")&&(w/=360),O[1].toLowerCase().slice(0,4)=="hsla"&&(y=j(M[3])),M[3]&&M[3].slice(-1)=="%"&&(y/=100),h.hsl2rgb(w,C,g,y)):((O={r:w,g:C,b:g,toString:fi}).hex="#"+(16777216|g|C<<8|w<<16).toString(16).slice(1),h.is(y,"finite")&&(O.opacity=y),O)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:fi}},h),h.hsb=ve(function(p,w,C){return h.hsb2rgb(p,w,C).hex}),h.hsl=ve(function(p,w,C){return h.hsl2rgb(p,w,C).hex}),h.rgb=ve(function(p,w,C){function g(y){return y+.5|0}return"#"+(16777216|g(C)|g(w)<<8|g(p)<<16).toString(16).slice(1)}),h.getColor=function(p){var w=this.getColor.start=this.getColor.start||{h:0,s:1,b:p||.75},C=this.hsb2rgb(w.h,w.s,w.b);return w.h+=.075,w.h>1&&(w.h=0,w.s-=.2,w.s<=0&&(this.getColor.start={h:0,s:1,b:w.b})),C.hex},h.getColor.reset=function(){delete this.start},h.parsePathString=function(p){if(!p)return null;var w=Re(p);if(w.arr)return Se(w.arr);var C={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},g=[];return h.is(p,nt)&&h.is(p[0],nt)&&(g=Se(p)),g.length||F(p).replace(bt,function(y,k,M){var O=[],G=k.toLowerCase();if(M.replace(yt,function(H,Q){Q&&O.push(+Q)}),G=="m"&&O.length>2&&(g.push([k][_](O.splice(0,2))),G="l",k=k=="m"?"l":"L"),G=="r")g.push([k][_](O));else for(;O.length>=C[G]&&(g.push([k][_](O.splice(0,C[G]))),C[G]););}),g.toString=h._path2string,w.arr=Se(g),g},h.parseTransformString=ve(function(p){if(!p)return null;var w=[];return h.is(p,nt)&&h.is(p[0],nt)&&(w=Se(p)),w.length||F(p).replace(Tt,function(C,g,y){var k=[];z.call(g),y.replace(yt,function(M,O){O&&k.push(+O)}),w.push([g][_](k))}),w.toString=h._path2string,w},this,function(p){if(!p)return p;for(var w=[],C=0;C<p.length;C++){for(var g=[],y=0;y<p[C].length;y++)g.push(p[C][y]);w.push(g)}return w});var Re=function(p){var w=Re.ps=Re.ps||{};return w[p]?w[p].sleep=100:w[p]={sleep:100},setTimeout(function(){for(var C in w)w[m](C)&&C!=p&&(w[C].sleep--,!w[C].sleep&&delete w[C])}),w[p]};function ti(p,w,C,g,y){return p*(p*(-3*w+9*C-9*g+3*y)+6*w-12*C+6*g)-3*w+3*C}function Ue(p,w,C,g,y,k,M,O,G){G==null&&(G=1);for(var H=(G=G>1?1:G<0?0:G)/2,Q=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],st=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],it=0,tt=0;tt<12;tt++){var ot=H*Q[tt]+H,ct=ti(ot,p,C,y,M),lt=ti(ot,w,g,k,O),rt=ct*ct+lt*lt;it+=st[tt]*q.sqrt(rt)}return H*it}function Fn(p,w,C,g,y,k,M,O){if(!(K(p,C)<Z(y,M)||Z(p,C)>K(y,M)||K(w,g)<Z(k,O)||Z(w,g)>K(k,O))){var G=(p-C)*(k-O)-(w-g)*(y-M);if(G){var H=((p*g-w*C)*(y-M)-(p-C)*(y*O-k*M))/G,Q=((p*g-w*C)*(k-O)-(w-g)*(y*O-k*M))/G,st=+H.toFixed(2),it=+Q.toFixed(2);if(!(st<+Z(p,C).toFixed(2)||st>+K(p,C).toFixed(2)||st<+Z(y,M).toFixed(2)||st>+K(y,M).toFixed(2)||it<+Z(w,g).toFixed(2)||it>+K(w,g).toFixed(2)||it<+Z(k,O).toFixed(2)||it>+K(k,O).toFixed(2)))return{x:H,y:Q}}}}function Li(p,w,C){var g=h.bezierBBox(p),y=h.bezierBBox(w);if(!h.isBBoxIntersect(g,y))return C?0:[];for(var k=Ue.apply(0,p),M=Ue.apply(0,w),O=K(~~(k/5),1),G=K(~~(M/5),1),H=[],Q=[],st={},it=C?0:[],tt=0;tt<O+1;tt++){var ot=h.findDotsAtSegment.apply(h,p.concat(tt/O));H.push({x:ot.x,y:ot.y,t:tt/O})}for(tt=0;tt<G+1;tt++)ot=h.findDotsAtSegment.apply(h,w.concat(tt/G)),Q.push({x:ot.x,y:ot.y,t:tt/G});for(tt=0;tt<O;tt++)for(var ct=0;ct<G;ct++){var lt=H[tt],rt=H[tt+1],wt=Q[ct],ut=Q[ct+1],gt=at(rt.x-lt.x)<.001?"y":"x",ft=at(ut.x-wt.x)<.001?"y":"x",Mt=Fn(lt.x,lt.y,rt.x,rt.y,wt.x,wt.y,ut.x,ut.y);if(Mt){if(st[Mt.x.toFixed(4)]==Mt.y.toFixed(4))continue;st[Mt.x.toFixed(4)]=Mt.y.toFixed(4);var kt=lt.t+at((Mt[gt]-lt[gt])/(rt[gt]-lt[gt]))*(rt.t-lt.t),Rt=wt.t+at((Mt[ft]-wt[ft])/(ut[ft]-wt[ft]))*(ut.t-wt.t);kt>=0&&kt<=1.001&&Rt>=0&&Rt<=1.001&&(C?it++:it.push({x:Mt.x,y:Mt.y,t1:Z(kt,1),t2:Z(Rt,1)}))}}return it}function ln(p,w,C){p=h._path2curve(p),w=h._path2curve(w);for(var g,y,k,M,O,G,H,Q,st,it,tt=C?0:[],ot=0,ct=p.length;ot<ct;ot++){var lt=p[ot];if(lt[0]=="M")g=O=lt[1],y=G=lt[2];else{lt[0]=="C"?(st=[g,y].concat(lt.slice(1)),g=st[6],y=st[7]):(st=[g,y,g,y,O,G,O,G],g=O,y=G);for(var rt=0,wt=w.length;rt<wt;rt++){var ut=w[rt];if(ut[0]=="M")k=H=ut[1],M=Q=ut[2];else{ut[0]=="C"?(it=[k,M].concat(ut.slice(1)),k=it[6],M=it[7]):(it=[k,M,k,M,H,Q,H,Q],k=H,M=Q);var gt=Li(st,it,C);if(C)tt+=gt;else{for(var ft=0,Mt=gt.length;ft<Mt;ft++)gt[ft].segment1=ot,gt[ft].segment2=rt,gt[ft].bez1=st,gt[ft].bez2=it;tt=tt.concat(gt)}}}}}return tt}h.findDotsAtSegment=function(p,w,C,g,y,k,M,O,G){var H=1-G,Q=vt(H,3),st=vt(H,2),it=G*G,tt=it*G,ot=Q*p+3*st*G*C+3*H*G*G*y+tt*M,ct=Q*w+3*st*G*g+3*H*G*G*k+tt*O,lt=p+2*G*(C-p)+it*(y-2*C+p),rt=w+2*G*(g-w)+it*(k-2*g+w),wt=C+2*G*(y-C)+it*(M-2*y+C),ut=g+2*G*(k-g)+it*(O-2*k+g),gt=H*p+G*C,ft=H*w+G*g,Mt=H*y+G*M,kt=H*k+G*O,Rt=90-180*q.atan2(lt-wt,rt-ut)/_t;return(lt>wt||rt<ut)&&(Rt+=180),{x:ot,y:ct,m:{x:lt,y:rt},n:{x:wt,y:ut},start:{x:gt,y:ft},end:{x:Mt,y:kt},alpha:Rt}},h.bezierBBox=function(p,w,C,g,y,k,M,O){h.is(p,"array")||(p=[p,w,C,g,y,k,M,O]);var G=Fi.apply(null,p);return{x:G.min.x,y:G.min.y,x2:G.max.x,y2:G.max.y,width:G.max.x-G.min.x,height:G.max.y-G.min.y}},h.isPointInsideBBox=function(p,w,C){return w>=p.x&&w<=p.x2&&C>=p.y&&C<=p.y2},h.isBBoxIntersect=function(p,w){var C=h.isPointInsideBBox;return C(w,p.x,p.y)||C(w,p.x2,p.y)||C(w,p.x,p.y2)||C(w,p.x2,p.y2)||C(p,w.x,w.y)||C(p,w.x2,w.y)||C(p,w.x,w.y2)||C(p,w.x2,w.y2)||(p.x<w.x2&&p.x>w.x||w.x<p.x2&&w.x>p.x)&&(p.y<w.y2&&p.y>w.y||w.y<p.y2&&w.y>p.y)},h.pathIntersection=function(p,w){return ln(p,w)},h.pathIntersectionNumber=function(p,w){return ln(p,w,1)},h.isPointInsidePath=function(p,w,C){var g=h.pathBBox(p);return h.isPointInsideBBox(g,w,C)&&ln(p,[["M",w,C],["H",g.x2+10]],1)%2==1},h._removedFactory=function(p){return function(){o("raphael.log",null,"Raphaël: you are calling to method “"+p+"” of removed object",p)}};var Ye=h.pathBBox=function(p){var w=Re(p);if(w.bbox)return ye(w.bbox);if(!p)return{x:0,y:0,width:0,height:0,x2:0,y2:0};for(var C,g=0,y=0,k=[],M=[],O=0,G=(p=Nn(p)).length;O<G;O++)if((C=p[O])[0]=="M")g=C[1],y=C[2],k.push(g),M.push(y);else{var H=Fi(g,y,C[1],C[2],C[3],C[4],C[5],C[6]);k=k[_](H.min.x,H.max.x),M=M[_](H.min.y,H.max.y),g=C[5],y=C[6]}var Q=Z[E](0,k),st=Z[E](0,M),it=K[E](0,k),tt=K[E](0,M),ot=it-Q,ct=tt-st,lt={x:Q,y:st,x2:it,y2:tt,width:ot,height:ct,cx:Q+ot/2,cy:st+ct/2};return w.bbox=ye(lt),lt},Se=function(p){var w=ye(p);return w.toString=h._path2string,w},lo=h._pathToRelative=function(p){var w=Re(p);if(w.rel)return Se(w.rel);h.is(p,nt)&&h.is(p&&p[0],nt)||(p=h.parsePathString(p));var C=[],g=0,y=0,k=0,M=0,O=0;p[0][0]=="M"&&(k=g=p[0][1],M=y=p[0][2],O++,C.push(["M",g,y]));for(var G=O,H=p.length;G<H;G++){var Q=C[G]=[],st=p[G];if(st[0]!=z.call(st[0]))switch(Q[0]=z.call(st[0]),Q[0]){case"a":Q[1]=st[1],Q[2]=st[2],Q[3]=st[3],Q[4]=st[4],Q[5]=st[5],Q[6]=+(st[6]-g).toFixed(3),Q[7]=+(st[7]-y).toFixed(3);break;case"v":Q[1]=+(st[1]-y).toFixed(3);break;case"m":k=st[1],M=st[2];default:for(var it=1,tt=st.length;it<tt;it++)Q[it]=+(st[it]-(it%2?g:y)).toFixed(3)}else{Q=C[G]=[],st[0]=="m"&&(k=st[1]+g,M=st[2]+y);for(var ot=0,ct=st.length;ot<ct;ot++)C[G][ot]=st[ot]}var lt=C[G].length;switch(C[G][0]){case"z":g=k,y=M;break;case"h":g+=+C[G][lt-1];break;case"v":y+=+C[G][lt-1];break;default:g+=+C[G][lt-2],y+=+C[G][lt-1]}}return C.toString=h._path2string,w.rel=Se(C),C},cn=h._pathToAbsolute=function(p){var w=Re(p);if(w.abs)return Se(w.abs);if(h.is(p,nt)&&h.is(p&&p[0],nt)||(p=h.parsePathString(p)),!p||!p.length)return[["M",0,0]];var C=[],g=0,y=0,k=0,M=0,O=0;p[0][0]=="M"&&(k=g=+p[0][1],M=y=+p[0][2],O++,C[0]=["M",g,y]);for(var G,H,Q=p.length==3&&p[0][0]=="M"&&p[1][0].toUpperCase()=="R"&&p[2][0].toUpperCase()=="Z",st=O,it=p.length;st<it;st++){if(C.push(G=[]),(H=p[st])[0]!=N.call(H[0]))switch(G[0]=N.call(H[0]),G[0]){case"A":G[1]=H[1],G[2]=H[2],G[3]=H[3],G[4]=H[4],G[5]=H[5],G[6]=+(H[6]+g),G[7]=+(H[7]+y);break;case"V":G[1]=+H[1]+y;break;case"H":G[1]=+H[1]+g;break;case"R":for(var tt=[g,y][_](H.slice(1)),ot=2,ct=tt.length;ot<ct;ot++)tt[ot]=+tt[ot]+g,tt[++ot]=+tt[ot]+y;C.pop(),C=C[_](hn(tt,Q));break;case"M":k=+H[1]+g,M=+H[2]+y;default:for(ot=1,ct=H.length;ot<ct;ot++)G[ot]=+H[ot]+(ot%2?g:y)}else if(H[0]=="R")tt=[g,y][_](H.slice(1)),C.pop(),C=C[_](hn(tt,Q)),G=["R"][_](H.slice(-2));else for(var lt=0,rt=H.length;lt<rt;lt++)G[lt]=H[lt];switch(G[0]){case"Z":g=k,y=M;break;case"H":g=G[1];break;case"V":y=G[1];break;case"M":k=G[G.length-2],M=G[G.length-1];default:g=G[G.length-2],y=G[G.length-1]}}return C.toString=h._path2string,w.abs=Se(C),C},Ii=function(p,w,C,g){return[p,w,C,g,C,g]},di=function(p,w,C,g,y,k){return[1/3*p+2/3*C,1/3*w+2/3*g,1/3*y+2/3*C,1/3*k+2/3*g,y,k]},gr=function(p,w,C,g,y,k,M,O,G,H){var Q,st=120*_t/180,it=_t/180*(+y||0),tt=[],ot=ve(function(C1,T1,bo){return{x:C1*q.cos(bo)-T1*q.sin(bo),y:C1*q.sin(bo)+T1*q.cos(bo)}});if(H)kt=H[0],Rt=H[1],ft=H[2],Mt=H[3];else{p=(Q=ot(p,w,-it)).x,w=Q.y,O=(Q=ot(O,G,-it)).x,G=Q.y;var ct=(p-O)/2,lt=(w-G)/2,rt=ct*ct/(C*C)+lt*lt/(g*g);rt>1&&(C*=rt=q.sqrt(rt),g*=rt);var wt=C*C,ut=g*g,gt=(k==M?-1:1)*q.sqrt(at((wt*ut-wt*lt*lt-ut*ct*ct)/(wt*lt*lt+ut*ct*ct))),ft=gt*C*lt/g+(p+O)/2,Mt=gt*-g*ct/C+(w+G)/2,kt=q.asin(((w-Mt)/g).toFixed(9)),Rt=q.asin(((G-Mt)/g).toFixed(9));(kt=p<ft?_t-kt:kt)<0&&(kt=2*_t+kt),(Rt=O<ft?_t-Rt:Rt)<0&&(Rt=2*_t+Rt),M&&kt>Rt&&(kt-=2*_t),!M&&Rt>kt&&(Rt-=2*_t)}var xr=Rt-kt;if(at(xr)>st){var ea=Rt,Ie=O,pi=G;Rt=kt+st*(M&&Rt>kt?1:-1),O=ft+C*q.cos(Rt),G=Mt+g*q.sin(Rt),tt=gr(O,G,C,g,y,0,M,Ie,pi,[Rt,ea,ft,Mt])}xr=Rt-kt;var Sr=q.cos(kt),Cr=q.sin(kt),yo=q.cos(Rt),$i=q.sin(Rt),zn=q.tan(xr/4),wo=4/3*C*zn,y1=4/3*g*zn,w1=[p,w],Tr=[p+wo*Cr,w-y1*Sr],b1=[O+wo*$i,G-y1*yo],x1=[O,G];if(Tr[0]=2*w1[0]-Tr[0],Tr[1]=2*w1[1]-Tr[1],H)return[Tr,b1,x1][_](tt);for(var S1=[],gn=0,D8=(tt=[Tr,b1,x1][_](tt).join()[L](",")).length;gn<D8;gn++)S1[gn]=gn%2?ot(tt[gn-1],tt[gn],it).y:ot(tt[gn],tt[gn+1],it).x;return S1},Oi=function(p,w,C,g,y,k,M,O,G){var H=1-G;return{x:vt(H,3)*p+3*vt(H,2)*G*C+3*H*G*G*y+vt(G,3)*M,y:vt(H,3)*w+3*vt(H,2)*G*g+3*H*G*G*k+vt(G,3)*O}},Fi=ve(function(p,w,C,g,y,k,M,O){var G,H=y-2*C+p-(M-2*y+C),Q=2*(C-p)-2*(y-C),st=p-C,it=(-Q+q.sqrt(Q*Q-4*H*st))/2/H,tt=(-Q-q.sqrt(Q*Q-4*H*st))/2/H,ot=[w,O],ct=[p,M];return at(it)>"1e12"&&(it=.5),at(tt)>"1e12"&&(tt=.5),it>0&&it<1&&(G=Oi(p,w,C,g,y,k,M,O,it),ct.push(G.x),ot.push(G.y)),tt>0&&tt<1&&(G=Oi(p,w,C,g,y,k,M,O,tt),ct.push(G.x),ot.push(G.y)),H=k-2*g+w-(O-2*k+g),st=w-g,it=(-(Q=2*(g-w)-2*(k-g))+q.sqrt(Q*Q-4*H*st))/2/H,tt=(-Q-q.sqrt(Q*Q-4*H*st))/2/H,at(it)>"1e12"&&(it=.5),at(tt)>"1e12"&&(tt=.5),it>0&&it<1&&(G=Oi(p,w,C,g,y,k,M,O,it),ct.push(G.x),ot.push(G.y)),tt>0&&tt<1&&(G=Oi(p,w,C,g,y,k,M,O,tt),ct.push(G.x),ot.push(G.y)),{min:{x:Z[E](0,ct),y:Z[E](0,ot)},max:{x:K[E](0,ct),y:K[E](0,ot)}}}),Nn=h._path2curve=ve(function(p,w){var C=!w&&Re(p);if(!w&&C.curve)return Se(C.curve);for(var g=cn(p),y=w&&cn(w),k={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},M={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},O=function(gt,ft,Mt){var kt,Rt;if(!gt)return["C",ft.x,ft.y,ft.x,ft.y,ft.x,ft.y];switch(!(gt[0]in{T:1,Q:1})&&(ft.qx=ft.qy=null),gt[0]){case"M":ft.X=gt[1],ft.Y=gt[2];break;case"A":gt=["C"][_](gr[E](0,[ft.x,ft.y][_](gt.slice(1))));break;case"S":Mt=="C"||Mt=="S"?(kt=2*ft.x-ft.bx,Rt=2*ft.y-ft.by):(kt=ft.x,Rt=ft.y),gt=["C",kt,Rt][_](gt.slice(1));break;case"T":Mt=="Q"||Mt=="T"?(ft.qx=2*ft.x-ft.qx,ft.qy=2*ft.y-ft.qy):(ft.qx=ft.x,ft.qy=ft.y),gt=["C"][_](di(ft.x,ft.y,ft.qx,ft.qy,gt[1],gt[2]));break;case"Q":ft.qx=gt[1],ft.qy=gt[2],gt=["C"][_](di(ft.x,ft.y,gt[1],gt[2],gt[3],gt[4]));break;case"L":gt=["C"][_](Ii(ft.x,ft.y,gt[1],gt[2]));break;case"H":gt=["C"][_](Ii(ft.x,ft.y,gt[1],ft.y));break;case"V":gt=["C"][_](Ii(ft.x,ft.y,ft.x,gt[1]));break;case"Z":gt=["C"][_](Ii(ft.x,ft.y,ft.X,ft.Y))}return gt},G=function(gt,ft){if(gt[ft].length>7){gt[ft].shift();for(var Mt=gt[ft];Mt.length;)Q[ft]="A",y&&(st[ft]="A"),gt.splice(ft++,0,["C"][_](Mt.splice(0,6)));gt.splice(ft,1),ct=K(g.length,y&&y.length||0)}},H=function(gt,ft,Mt,kt,Rt){gt&&ft&>[Rt][0]=="M"&&ft[Rt][0]!="M"&&(ft.splice(Rt,0,["M",kt.x,kt.y]),Mt.bx=0,Mt.by=0,Mt.x=gt[Rt][1],Mt.y=gt[Rt][2],ct=K(g.length,y&&y.length||0))},Q=[],st=[],it="",tt="",ot=0,ct=K(g.length,y&&y.length||0);ot<ct;ot++){g[ot]&&(it=g[ot][0]),it!="C"&&(Q[ot]=it,ot&&(tt=Q[ot-1])),g[ot]=O(g[ot],k,tt),Q[ot]!="A"&&it=="C"&&(Q[ot]="C"),G(g,ot),y&&(y[ot]&&(it=y[ot][0]),it!="C"&&(st[ot]=it,ot&&(tt=st[ot-1])),y[ot]=O(y[ot],M,tt),st[ot]!="A"&&it=="C"&&(st[ot]="C"),G(y,ot)),H(g,y,k,M,ot),H(y,g,M,k,ot);var lt=g[ot],rt=y&&y[ot],wt=lt.length,ut=y&&rt.length;k.x=lt[wt-2],k.y=lt[wt-1],k.bx=j(lt[wt-4])||k.x,k.by=j(lt[wt-3])||k.y,M.bx=y&&(j(rt[ut-4])||M.x),M.by=y&&(j(rt[ut-3])||M.y),M.x=y&&rt[ut-2],M.y=y&&rt[ut-1]}return y||(C.curve=Se(g)),y?[g,y]:g},null,Se),pr=(h._parseDots=ve(function(p){for(var w=[],C=0,g=p.length;C<g;C++){var y={},k=p[C].match(/^([^:]*):?([\d\.]*)/);if(y.color=h.getRGB(k[1]),y.color.error)return null;y.opacity=y.color.opacity,y.color=y.color.hex,k[2]&&(y.offset=k[2]+"%"),w.push(y)}for(C=1,g=w.length-1;C<g;C++)if(!w[C].offset){for(var M=j(w[C-1].offset||0),O=0,G=C+1;G<g;G++)if(w[G].offset){O=w[G].offset;break}O||(O=100,G=g);for(var H=((O=j(O))-M)/(G-C+1);C<G;C++)M+=H,w[C].offset=M+"%"}return w}),h._tear=function(p,w){p==w.top&&(w.top=p.prev),p==w.bottom&&(w.bottom=p.next),p.next&&(p.next.prev=p.prev),p.prev&&(p.prev.next=p.next)}),co=(h._tofront=function(p,w){w.top!==p&&(pr(p,w),p.next=null,p.prev=w.top,w.top.next=p,w.top=p)},h._toback=function(p,w){w.bottom!==p&&(pr(p,w),p.next=w.bottom,p.prev=null,w.bottom.prev=p,w.bottom=p)},h._insertafter=function(p,w,C){pr(p,C),w==C.top&&(C.top=p),w.next&&(w.next.prev=p),p.next=w.next,p.prev=w,w.next=p},h._insertbefore=function(p,w,C){pr(p,C),w==C.bottom&&(C.bottom=p),w.prev&&(w.prev.next=p),p.prev=w.prev,w.prev=p,p.next=w},h.toMatrix=function(p,w){var C=Ye(p),g={_:{transform:P},getBBox:function(){return C}};return mr(g,w),g.matrix}),mr=(h.transformPath=function(p,w){return ce(p,co(p,w))},h._extractTransform=function(p,w){if(w==null)return p._.transform;w=F(w).replace(/\.{3}|\u2026/g,p._.transform||P);var C,g,y=h.parseTransformString(w),k=0,M=1,O=1,G=p._,H=new Ni;if(G.transform=y||[],y)for(var Q=0,st=y.length;Q<st;Q++){var it,tt,ot,ct,lt,rt=y[Q],wt=rt.length,ut=F(rt[0]).toLowerCase(),gt=rt[0]!=ut,ft=gt?H.invert():0;ut=="t"&&wt==3?gt?(it=ft.x(0,0),tt=ft.y(0,0),ot=ft.x(rt[1],rt[2]),ct=ft.y(rt[1],rt[2]),H.translate(ot-it,ct-tt)):H.translate(rt[1],rt[2]):ut=="r"?wt==2?(lt=lt||p.getBBox(1),H.rotate(rt[1],lt.x+lt.width/2,lt.y+lt.height/2),k+=rt[1]):wt==4&&(gt?(ot=ft.x(rt[2],rt[3]),ct=ft.y(rt[2],rt[3]),H.rotate(rt[1],ot,ct)):H.rotate(rt[1],rt[2],rt[3]),k+=rt[1]):ut=="s"?wt==2||wt==3?(lt=lt||p.getBBox(1),H.scale(rt[1],rt[wt-1],lt.x+lt.width/2,lt.y+lt.height/2),M*=rt[1],O*=rt[wt-1]):wt==5&&(gt?(ot=ft.x(rt[3],rt[4]),ct=ft.y(rt[3],rt[4]),H.scale(rt[1],rt[2],ot,ct)):H.scale(rt[1],rt[2],rt[3],rt[4]),M*=rt[1],O*=rt[2]):ut=="m"&&wt==7&&H.add(rt[1],rt[2],rt[3],rt[4],rt[5],rt[6]),G.dirtyT=1,p.matrix=H}p.matrix=H,G.sx=M,G.sy=O,G.deg=k,G.dx=C=H.e,G.dy=g=H.f,M==1&&O==1&&!k&&G.bbox?(G.bbox.x+=+C,G.bbox.y+=+g):G.dirtyT=1}),uo=function(p){var w=p[0];switch(w.toLowerCase()){case"t":return[w,0,0];case"m":return[w,1,0,0,1,0,0];case"r":return p.length==4?[w,0,p[2],p[3]]:[w,0];case"s":return p.length==5?[w,1,1,p[3],p[4]]:p.length==3?[w,1,1]:[w,1]}},fo=h._equaliseTransform=function(p,w){w=F(w).replace(/\.{3}|\u2026/g,p),p=h.parseTransformString(p)||[],w=h.parseTransformString(w)||[];for(var C,g,y,k,M=K(p.length,w.length),O=[],G=[],H=0;H<M;H++){if(y=p[H]||uo(w[H]),k=w[H]||uo(y),y[0]!=k[0]||y[0].toLowerCase()=="r"&&(y[2]!=k[2]||y[3]!=k[3])||y[0].toLowerCase()=="s"&&(y[3]!=k[3]||y[4]!=k[4]))return;for(O[H]=[],G[H]=[],C=0,g=K(y.length,k.length);C<g;C++)C in y&&(O[H][C]=y[C]),C in k&&(G[H][C]=k[C])}return{from:O,to:G}};function Ni(p,w,C,g,y,k){p!=null?(this.a=+p,this.b=+w,this.c=+C,this.d=+g,this.e=+y,this.f=+k):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}h._getContainer=function(p,w,C,g){var y;if((y=g!=null||h.is(p,"object")?p:v.doc.getElementById(p))!=null)return y.tagName?w==null?{container:y,width:y.style.pixelWidth||y.offsetWidth,height:y.style.pixelHeight||y.offsetHeight}:{container:y,width:w,height:C}:{container:1,x:p,y:w,width:C,height:g}},h.pathToRelative=lo,h._engine={},h.path2curve=Nn,h.matrix=function(p,w,C,g,y,k){return new Ni(p,w,C,g,y,k)},function(p){function w(g){return g[0]*g[0]+g[1]*g[1]}function C(g){var y=q.sqrt(w(g));g[0]&&(g[0]/=y),g[1]&&(g[1]/=y)}p.add=function(g,y,k,M,O,G){var H,Q,st,it,tt=[[],[],[]],ot=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],ct=[[g,k,O],[y,M,G],[0,0,1]];for(g&&g instanceof Ni&&(ct=[[g.a,g.c,g.e],[g.b,g.d,g.f],[0,0,1]]),H=0;H<3;H++)for(Q=0;Q<3;Q++){for(it=0,st=0;st<3;st++)it+=ot[H][st]*ct[st][Q];tt[H][Q]=it}this.a=tt[0][0],this.b=tt[1][0],this.c=tt[0][1],this.d=tt[1][1],this.e=tt[0][2],this.f=tt[1][2]},p.invert=function(){var g=this,y=g.a*g.d-g.b*g.c;return new Ni(g.d/y,-g.b/y,-g.c/y,g.a/y,(g.c*g.f-g.d*g.e)/y,(g.b*g.e-g.a*g.f)/y)},p.clone=function(){return new Ni(this.a,this.b,this.c,this.d,this.e,this.f)},p.translate=function(g,y){this.add(1,0,0,1,g,y)},p.scale=function(g,y,k,M){y==null&&(y=g),(k||M)&&this.add(1,0,0,1,k,M),this.add(g,0,0,y,0,0),(k||M)&&this.add(1,0,0,1,-k,-M)},p.rotate=function(g,y,k){g=h.rad(g),y=y||0,k=k||0;var M=+q.cos(g).toFixed(9),O=+q.sin(g).toFixed(9);this.add(M,O,-O,M,y,k),this.add(1,0,0,1,-y,-k)},p.x=function(g,y){return g*this.a+y*this.c+this.e},p.y=function(g,y){return g*this.b+y*this.d+this.f},p.get=function(g){return+this[F.fromCharCode(97+g)].toFixed(4)},p.toString=function(){return h.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},p.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},p.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},p.split=function(){var g={};g.dx=this.e,g.dy=this.f;var y=[[this.a,this.c],[this.b,this.d]];g.scalex=q.sqrt(w(y[0])),C(y[0]),g.shear=y[0][0]*y[1][0]+y[0][1]*y[1][1],y[1]=[y[1][0]-y[0][0]*g.shear,y[1][1]-y[0][1]*g.shear],g.scaley=q.sqrt(w(y[1])),C(y[1]),g.shear/=g.scaley;var k=-y[0][1],M=y[1][1];return M<0?(g.rotate=h.deg(q.acos(M)),k<0&&(g.rotate=360-g.rotate)):g.rotate=h.deg(q.asin(k)),g.isSimple=!(+g.shear.toFixed(9)||g.scalex.toFixed(9)!=g.scaley.toFixed(9)&&g.rotate),g.isSuperSimple=!+g.shear.toFixed(9)&&g.scalex.toFixed(9)==g.scaley.toFixed(9)&&!g.rotate,g.noRotation=!+g.shear.toFixed(9)&&!g.rotate,g},p.toTransformString=function(g){var y=g||this[L]();return y.isSimple?(y.scalex=+y.scalex.toFixed(4),y.scaley=+y.scaley.toFixed(4),y.rotate=+y.rotate.toFixed(4),(y.dx||y.dy?"t"+[y.dx,y.dy]:P)+(y.scalex!=1||y.scaley!=1?"s"+[y.scalex,y.scaley,0,0]:P)+(y.rotate?"r"+[y.rotate,0,0]:P)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(Ni.prototype);for(var go=function(){this.returnValue=!1},po=function(){return this.originalEvent.preventDefault()},mo=function(){this.cancelBubble=!0},vo=function(){return this.originalEvent.stopPropagation()},vr=function(p){var w=v.doc.documentElement.scrollTop||v.doc.body.scrollTop,C=v.doc.documentElement.scrollLeft||v.doc.body.scrollLeft;return{x:p.clientX+C,y:p.clientY+w}},Gi=v.doc.addEventListener?function(p,w,C,g){var y=function(M){var O=vr(M);return C.call(g,M,O.x,O.y)};if(p.addEventListener(w,y,!1),x&&U[w]){var k=function(M){for(var O=vr(M),G=M,H=0,Q=M.targetTouches&&M.targetTouches.length;H<Q;H++)if(M.targetTouches[H].target==p){(M=M.targetTouches[H]).originalEvent=G,M.preventDefault=po,M.stopPropagation=vo;break}return C.call(g,M,O.x,O.y)};p.addEventListener(U[w],k,!1)}return function(){return p.removeEventListener(w,y,!1),x&&U[w]&&p.removeEventListener(U[w],k,!1),!0}}:v.doc.attachEvent?function(p,w,C,g){var y=function(k){k=k||v.win.event;var M=v.doc.documentElement.scrollTop||v.doc.body.scrollTop,O=v.doc.documentElement.scrollLeft||v.doc.body.scrollLeft,G=k.clientX+O,H=k.clientY+M;return k.preventDefault=k.preventDefault||go,k.stopPropagation=k.stopPropagation||mo,C.call(g,k,G,H)};return p.attachEvent("on"+w,y),function(){return p.detachEvent("on"+w,y),!0}}:void 0,De=[],Ui=function(p){for(var w,C=p.clientX,g=p.clientY,y=v.doc.documentElement.scrollTop||v.doc.body.scrollTop,k=v.doc.documentElement.scrollLeft||v.doc.body.scrollLeft,M=De.length;M--;){if(w=De[M],x&&p.touches){for(var O,G=p.touches.length;G--;)if((O=p.touches[G]).identifier==w.el._drag.id){C=O.clientX,g=O.clientY,(p.originalEvent?p.originalEvent:p).preventDefault();break}}else p.preventDefault();var H,Q=w.el.node,st=Q.nextSibling,it=Q.parentNode,tt=Q.style.display;v.win.opera&&it.removeChild(Q),Q.style.display="none",H=w.el.paper.getElementByPoint(C,g),Q.style.display=tt,v.win.opera&&(st?it.insertBefore(Q,st):it.appendChild(Q)),H&&o("raphael.drag.over."+w.el.id,w.el,H),C+=k,g+=y,o("raphael.drag.move."+w.el.id,w.move_scope||w.el,C-w.el._drag.x,g-w.el._drag.y,C,g,p)}},un=function(p){h.unmousemove(Ui).unmouseup(un);for(var w,C=De.length;C--;)(w=De[C]).el._drag={},o("raphael.drag.end."+w.el.id,w.end_scope||w.start_scope||w.move_scope||w.el,p);De=[]},$t=h.el={},_o=$.length;_o--;)(function(p){h[p]=$t[p]=function(w,C){return h.is(w,"function")&&(this.events=this.events||[],this.events.push({name:p,f:w,unbind:Gi(this.shape||this.node||v.doc,p,w,C||this)})),this},h["un"+p]=$t["un"+p]=function(w){for(var C=this.events||[],g=C.length;g--;)C[g].name!=p||!h.is(w,"undefined")&&C[g].f!=w||(C[g].unbind(),C.splice(g,1),!C.length&&delete this.events);return this}})($[_o]);$t.data=function(p,w){var C=Et[this.id]=Et[this.id]||{};if(arguments.length==0)return C;if(arguments.length==1){if(h.is(p,"object")){for(var g in p)p[m](g)&&this.data(g,p[g]);return this}return o("raphael.data.get."+this.id,this,C[p],p),C[p]}return C[p]=w,o("raphael.data.set."+this.id,this,w,p),this},$t.removeData=function(p){return p==null?delete Et[this.id]:Et[this.id]&&delete Et[this.id][p],this},$t.getData=function(){return ye(Et[this.id]||{})},$t.hover=function(p,w,C,g){return this.mouseover(p,C).mouseout(w,g||C)},$t.unhover=function(p,w){return this.unmouseover(p).unmouseout(w)};var fn=[];$t.drag=function(p,w,C,g,y,k){function M(O){(O.originalEvent||O).preventDefault();var G=O.clientX,H=O.clientY,Q=v.doc.documentElement.scrollTop||v.doc.body.scrollTop,st=v.doc.documentElement.scrollLeft||v.doc.body.scrollLeft;if(this._drag.id=O.identifier,x&&O.touches){for(var it,tt=O.touches.length;tt--;)if(it=O.touches[tt],this._drag.id=it.identifier,it.identifier==this._drag.id){G=it.clientX,H=it.clientY;break}}this._drag.x=G+st,this._drag.y=H+Q,!De.length&&h.mousemove(Ui).mouseup(un),De.push({el:this,move_scope:g,start_scope:y,end_scope:k}),w&&o.on("raphael.drag.start."+this.id,w),p&&o.on("raphael.drag.move."+this.id,p),C&&o.on("raphael.drag.end."+this.id,C),o("raphael.drag.start."+this.id,y||g||this,this._drag.x,this._drag.y,O)}return this._drag={},fn.push({el:this,start:M}),this.mousedown(M),this},$t.onDragOver=function(p){p?o.on("raphael.drag.over."+this.id,p):o.unbind("raphael.drag.over."+this.id)},$t.undrag=function(){for(var p=fn.length;p--;)fn[p].el==this&&(this.unmousedown(fn[p].start),fn.splice(p,1),o.unbind("raphael.drag.*."+this.id));!fn.length&&h.unmousemove(Ui).unmouseup(un),De=[]},c.circle=function(p,w,C){var g=h._engine.circle(this,p||0,w||0,C||0);return this.__set__&&this.__set__.push(g),g},c.rect=function(p,w,C,g,y){var k=h._engine.rect(this,p||0,w||0,C||0,g||0,y||0);return this.__set__&&this.__set__.push(k),k},c.ellipse=function(p,w,C,g){var y=h._engine.ellipse(this,p||0,w||0,C||0,g||0);return this.__set__&&this.__set__.push(y),y},c.path=function(p){p&&!h.is(p,"string")&&!h.is(p[0],nt)&&(p+=P);var w=h._engine.path(h.format[E](h,arguments),this);return this.__set__&&this.__set__.push(w),w},c.image=function(p,w,C,g,y){var k=h._engine.image(this,p||"about:blank",w||0,C||0,g||0,y||0);return this.__set__&&this.__set__.push(k),k},c.text=function(p,w,C){var g=h._engine.text(this,p||0,w||0,F(C));return this.__set__&&this.__set__.push(g),g},c.set=function(p){!h.is(p,"array")&&(p=Array.prototype.splice.call(arguments,0,arguments.length));var w=new Un(p);return this.__set__&&this.__set__.push(w),w.paper=this,w.type="set",w},c.setStart=function(p){this.__set__=p||this.set()},c.setFinish=function(p){var w=this.__set__;return delete this.__set__,w},c.getSize=function(){var p=this.canvas.parentNode;return{width:p.offsetWidth,height:p.offsetHeight}},c.setSize=function(p,w){return h._engine.setSize.call(this,p,w)},c.setViewBox=function(p,w,C,g,y){return h._engine.setViewBox.call(this,p,w,C,g,y)},c.top=c.bottom=null,c.raphael=h;function Gn(){return this.x+R+this.y+R+this.width+" × "+this.height}c.getElementByPoint=function(p,w){var C,g,y,k,M,O,G,H=this.canvas,Q=v.doc.elementFromPoint(p,w);if(v.win.opera&&Q.tagName=="svg"){var st=(g=(C=H).getBoundingClientRect(),y=C.ownerDocument,k=y.body,M=y.documentElement,O=M.clientTop||k.clientTop||0,G=M.clientLeft||k.clientLeft||0,{y:g.top+(v.win.pageYOffset||M.scrollTop||k.scrollTop)-O,x:g.left+(v.win.pageXOffset||M.scrollLeft||k.scrollLeft)-G}),it=H.createSVGRect();it.x=p-st.x,it.y=w-st.y,it.width=it.height=1;var tt=H.getIntersectionList(it,null);tt.length&&(Q=tt[tt.length-1])}if(!Q)return null;for(;Q.parentNode&&Q!=H.parentNode&&!Q.raphael;)Q=Q.parentNode;return Q==this.canvas.parentNode&&(Q=H),Q=Q&&Q.raphael?this.getById(Q.raphaelid):null},c.getElementsByBBox=function(p){var w=this.set();return this.forEach(function(C){h.isBBoxIntersect(C.getBBox(),p)&&w.push(C)}),w},c.getById=function(p){for(var w=this.bottom;w;){if(w.id==p)return w;w=w.next}return null},c.forEach=function(p,w){for(var C=this.bottom;C;){if(p.call(w,C)===!1)return this;C=C.next}return this},c.getElementsByPoint=function(p,w){var C=this.set();return this.forEach(function(g){g.isPointInside(p,w)&&C.push(g)}),C},$t.isPointInside=function(p,w){var C=this.realPath=zt[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(C=h.transformPath(C,this.attr("transform"))),h.isPointInsidePath(C,p,w)},$t.getBBox=function(p){if(this.removed)return{};var w=this._;return p?(!w.dirty&&w.bboxwt||(this.realPath=zt[this.type](this),w.bboxwt=Ye(this.realPath),w.bboxwt.toString=Gn,w.dirty=0),w.bboxwt):((w.dirty||w.dirtyT||!w.bbox)&&(!w.dirty&&this.realPath||(w.bboxwt=0,this.realPath=zt[this.type](this)),w.bbox=Ye(ce(this.realPath,this.matrix)),w.bbox.toString=Gn,w.dirty=w.dirtyT=0),w.bbox)},$t.clone=function(){if(this.removed)return null;var p=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(p),p},$t.glow=function(p){if(this.type=="text")return null;var w={width:((p=p||{}).width||10)+(+this.attr("stroke-width")||1),fill:p.fill||!1,opacity:p.opacity==null?.5:p.opacity,offsetx:p.offsetx||0,offsety:p.offsety||0,color:p.color||"#000"},C=w.width/2,g=this.paper,y=g.set(),k=this.realPath||zt[this.type](this);k=this.matrix?ce(k,this.matrix):k;for(var M=1;M<C+1;M++)y.push(g.path(k).attr({stroke:w.color,fill:w.fill?w.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(w.width/C*M).toFixed(3),opacity:+(w.opacity/C).toFixed(3)}));return y.insertBefore(this).translate(w.offsetx,w.offsety)};var Ce=function(p,w,C,g,y,k,M,O,G){return G==null?Ue(p,w,C,g,y,k,M,O):h.findDotsAtSegment(p,w,C,g,y,k,M,O,function(H,Q,st,it,tt,ot,ct,lt,rt){if(!(rt<0||Ue(H,Q,st,it,tt,ot,ct,lt)<rt)){var wt,ut=.5,gt=1-ut;for(wt=Ue(H,Q,st,it,tt,ot,ct,lt,gt);at(wt-rt)>.01;)wt=Ue(H,Q,st,it,tt,ot,ct,lt,gt+=(wt<rt?1:-1)*(ut/=2));return gt}}(p,w,C,g,y,k,M,O,G))},gi=function(p,w){return function(C,g,y){for(var k,M,O,G,H,Q="",st={},it=0,tt=0,ot=(C=Nn(C)).length;tt<ot;tt++){if((O=C[tt])[0]=="M")k=+O[1],M=+O[2];else{if(it+(G=Ce(k,M,O[1],O[2],O[3],O[4],O[5],O[6]))>g){if(w&&!st.start){if(Q+=["C"+(H=Ce(k,M,O[1],O[2],O[3],O[4],O[5],O[6],g-it)).start.x,H.start.y,H.m.x,H.m.y,H.x,H.y],y)return Q;st.start=Q,Q=["M"+H.x,H.y+"C"+H.n.x,H.n.y,H.end.x,H.end.y,O[5],O[6]].join(),it+=G,k=+O[5],M=+O[6];continue}if(!p&&!w)return{x:(H=Ce(k,M,O[1],O[2],O[3],O[4],O[5],O[6],g-it)).x,y:H.y,alpha:H.alpha}}it+=G,k=+O[5],M=+O[6]}Q+=O.shift()+O}return st.end=Q,(H=p?it:w?st:h.findDotsAtSegment(k,M,O[0],O[1],O[2],O[3],O[4],O[5],1)).alpha&&(H={x:H.x,y:H.y,alpha:H.alpha}),H}},ei=gi(1),qe=gi(),Bi=gi(0,1);h.getTotalLength=ei,h.getPointAtLength=qe,h.getSubpath=function(p,w,C){if(this.getTotalLength(p)-C<1e-6)return Bi(p,w).end;var g=Bi(p,C,1);return w?Bi(g,w).end:g},$t.getTotalLength=function(){var p=this.getPath();if(p)return this.node.getTotalLength?this.node.getTotalLength():ei(p)},$t.getPointAtLength=function(p){var w=this.getPath();if(w)return qe(w,p)},$t.getPath=function(){var p,w=h._getPath[this.type];if(this.type!="text"&&this.type!="set")return w&&(p=w(this)),p},$t.getSubpath=function(p,w){var C=this.getPath();if(C)return h.getSubpath(C,p,w)};var ne=h.easing_formulas={linear:function(p){return p},"<":function(p){return vt(p,1.7)},">":function(p){return vt(p,.48)},"<>":function(p){var w=.48-p/1.04,C=q.sqrt(.1734+w*w),g=C-w,y=-C-w,k=vt(at(g),1/3)*(g<0?-1:1)+vt(at(y),1/3)*(y<0?-1:1)+.5;return 3*(1-k)*k*k+k*k*k},backIn:function(p){var w=1.70158;return p*p*((w+1)*p-w)},backOut:function(p){var w=1.70158;return(p-=1)*p*((w+1)*p+w)+1},elastic:function(p){return p==!!p?p:vt(2,-10*p)*q.sin(2*_t*(p-.075)/.3)+1},bounce:function(p){var w=7.5625,C=2.75;return p<1/C?w*p*p:p<2/C?w*(p-=1.5/C)*p+.75:p<2.5/C?w*(p-=2.25/C)*p+.9375:w*(p-=2.625/C)*p+.984375}};ne.easeIn=ne["ease-in"]=ne["<"],ne.easeOut=ne["ease-out"]=ne[">"],ne.easeInOut=ne["ease-in-out"]=ne["<>"],ne["back-in"]=ne.backIn,ne["back-out"]=ne.backOut;var At=[],ta=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(p){setTimeout(p,16)},_r=function(){for(var p=+new Date,w=0;w<At.length;w++){var C=At[w];if(!C.el.removed&&!C.paused){var g,y,k=p-C.start,M=C.ms,O=C.easing,G=C.from,H=C.diff,Q=C.to,st=(C.t,C.el),it={},tt={};if(C.initstatus?(k=(C.initstatus*C.anim.top-C.prev)/(C.percent-C.prev)*M,C.status=C.initstatus,delete C.initstatus,C.stop&&At.splice(w--,1)):C.status=(C.prev+(C.percent-C.prev)*(k/M))/C.anim.top,!(k<0))if(k<M){var ot=O(k/M);for(var ct in G)if(G[m](ct)){switch(X[ct]){case pt:g=+G[ct]+ot*M*H[ct];break;case"colour":g="rgb("+[dn(B(G[ct].r+ot*M*H[ct].r)),dn(B(G[ct].g+ot*M*H[ct].g)),dn(B(G[ct].b+ot*M*H[ct].b))].join(",")+")";break;case"path":g=[];for(var lt=0,rt=G[ct].length;lt<rt;lt++){g[lt]=[G[ct][lt][0]];for(var wt=1,ut=G[ct][lt].length;wt<ut;wt++)g[lt][wt]=+G[ct][lt][wt]+ot*M*H[ct][lt][wt];g[lt]=g[lt].join(R)}g=g.join(R);break;case"transform":if(H[ct].real)for(g=[],lt=0,rt=G[ct].length;lt<rt;lt++)for(g[lt]=[G[ct][lt][0]],wt=1,ut=G[ct][lt].length;wt<ut;wt++)g[lt][wt]=G[ct][lt][wt]+ot*M*H[ct][lt][wt];else{var gt=function(Mt){return+G[ct][Mt]+ot*M*H[ct][Mt]};g=[["m",gt(0),gt(1),gt(2),gt(3),gt(4),gt(5)]]}break;case"csv":if(ct=="clip-rect")for(g=[],lt=4;lt--;)g[lt]=+G[ct][lt]+ot*M*H[ct][lt];break;default:var ft=[][_](G[ct]);for(g=[],lt=st.paper.customAttributes[ct].length;lt--;)g[lt]=+ft[lt]+ot*M*H[ct][lt]}it[ct]=g}st.attr(it),function(Mt,kt,Rt){setTimeout(function(){o("raphael.anim.frame."+Mt,kt,Rt)})}(st.id,st,C.anim)}else{if(function(Mt,kt,Rt){setTimeout(function(){o("raphael.anim.frame."+kt.id,kt,Rt),o("raphael.anim.finish."+kt.id,kt,Rt),h.is(Mt,"function")&&Mt.call(kt)})}(C.callback,st,C.anim),st.attr(Q),At.splice(w--,1),C.repeat>1&&!C.next){for(y in Q)Q[m](y)&&(tt[y]=C.totalOrigin[y]);C.el.attr(tt),zi(C.anim,C.el,C.anim.percents[0],null,C.totalOrigin,C.repeat-1)}C.next&&!C.stop&&zi(C.anim,C.el,C.next,null,C.totalOrigin,C.repeat)}}}At.length&&ta(_r)},dn=function(p){return p>255?255:p<0?0:p};function Be(p,w,C,g,y,k){var M=3*w,O=3*(g-w)-M,G=1-M-O,H=3*C,Q=3*(y-C)-H,st=1-H-Q;function it(tt){return((G*tt+O)*tt+M)*tt}return function(tt,ot){var ct=function(lt,rt){var wt,ut,gt,ft,Mt,kt;for(gt=lt,kt=0;kt<8;kt++){if(ft=it(gt)-lt,at(ft)<rt)return gt;if(at(Mt=(3*G*gt+2*O)*gt+M)<1e-6)break;gt-=ft/Mt}if(ut=1,(gt=lt)<(wt=0))return wt;if(gt>ut)return ut;for(;wt<ut;){if(ft=it(gt),at(ft-lt)<rt)return gt;lt>ft?wt=gt:ut=gt,gt=(ut-wt)/2+wt}return gt}(tt,ot);return((st*ct+Q)*ct+H)*ct}(p,1/(200*k))}function Le(p,w){var C=[],g={};if(this.ms=w,this.times=1,p){for(var y in p)p[m](y)&&(g[j(y)]=p[y],C.push(j(y)));C.sort(Pt)}this.anim=g,this.top=C[C.length-1],this.percents=C}function zi(p,w,C,g,y,k){C=j(C);var M,O,G,H,Q,st,it=p.ms,tt={},ot={},ct={};if(g)for(rt=0,wt=At.length;rt<wt;rt++){var lt=At[rt];if(lt.el.id==w.id&<.anim==p){lt.percent!=C?(At.splice(rt,1),G=1):O=lt,w.attr(lt.totalOrigin);break}}else g=+ot;for(var rt=0,wt=p.percents.length;rt<wt;rt++){if(p.percents[rt]==C||p.percents[rt]>g*p.top){C=p.percents[rt],Q=p.percents[rt-1]||0,it=it/p.top*(C-Q),H=p.percents[rt+1],M=p.anim[C];break}g&&w.attr(p.anim[p.percents[rt]])}if(M){if(O)O.initstatus=g,O.start=new Date-O.ms*g;else{for(var ut in M)if(M[m](ut)&&(X[m](ut)||w.paper.customAttributes[m](ut)))switch(tt[ut]=w.attr(ut),tt[ut]==null&&(tt[ut]=Y[ut]),ot[ut]=M[ut],X[ut]){case pt:ct[ut]=(ot[ut]-tt[ut])/it;break;case"colour":tt[ut]=h.getRGB(tt[ut]);var gt=h.getRGB(ot[ut]);ct[ut]={r:(gt.r-tt[ut].r)/it,g:(gt.g-tt[ut].g)/it,b:(gt.b-tt[ut].b)/it};break;case"path":var ft=Nn(tt[ut],ot[ut]),Mt=ft[1];for(tt[ut]=ft[0],ct[ut]=[],rt=0,wt=tt[ut].length;rt<wt;rt++){ct[ut][rt]=[0];for(var kt=1,Rt=tt[ut][rt].length;kt<Rt;kt++)ct[ut][rt][kt]=(Mt[rt][kt]-tt[ut][rt][kt])/it}break;case"transform":var xr=w._,ea=fo(xr[ut],ot[ut]);if(ea)for(tt[ut]=ea.from,ot[ut]=ea.to,ct[ut]=[],ct[ut].real=!0,rt=0,wt=tt[ut].length;rt<wt;rt++)for(ct[ut][rt]=[tt[ut][rt][0]],kt=1,Rt=tt[ut][rt].length;kt<Rt;kt++)ct[ut][rt][kt]=(ot[ut][rt][kt]-tt[ut][rt][kt])/it;else{var Ie=w.matrix||new Ni,pi={_:{transform:xr.transform},getBBox:function(){return w.getBBox(1)}};tt[ut]=[Ie.a,Ie.b,Ie.c,Ie.d,Ie.e,Ie.f],mr(pi,ot[ut]),ot[ut]=pi._.transform,ct[ut]=[(pi.matrix.a-Ie.a)/it,(pi.matrix.b-Ie.b)/it,(pi.matrix.c-Ie.c)/it,(pi.matrix.d-Ie.d)/it,(pi.matrix.e-Ie.e)/it,(pi.matrix.f-Ie.f)/it]}break;case"csv":var Sr=F(M[ut])[L](d),Cr=F(tt[ut])[L](d);if(ut=="clip-rect")for(tt[ut]=Cr,ct[ut]=[],rt=Cr.length;rt--;)ct[ut][rt]=(Sr[rt]-tt[ut][rt])/it;ot[ut]=Sr;break;default:for(Sr=[][_](M[ut]),Cr=[][_](tt[ut]),ct[ut]=[],rt=w.paper.customAttributes[ut].length;rt--;)ct[ut][rt]=((Sr[rt]||0)-(Cr[rt]||0))/it}var yo=M.easing,$i=h.easing_formulas[yo];if(!$i)if(($i=F(yo).match(A))&&$i.length==5){var zn=$i;$i=function(wo){return Be(wo,+zn[1],+zn[2],+zn[3],+zn[4],it)}}else $i=Ot;if(lt={anim:p,percent:C,timestamp:st=M.start||p.start||+new Date,start:st+(p.del||0),status:0,initstatus:g||0,stop:!1,ms:it,easing:$i,from:tt,diff:ct,to:ot,el:w,callback:M.callback,prev:Q,next:H,repeat:k||p.times,origin:w.attr(),totalOrigin:y},At.push(lt),g&&!O&&!G&&(lt.stop=!0,lt.start=new Date-it*g,At.length==1))return _r();G&&(lt.start=new Date-lt.ms*g),At.length==1&&ta(_r)}o("raphael.anim.start."+w.id,w,p)}}function yr(p){for(var w=0;w<At.length;w++)At[w].el.paper==p&&At.splice(w--,1)}$t.animateWith=function(p,w,C,g,y,k){if(this.removed)return k&&k.call(this),this;var M=C instanceof Le?C:h.animation(C,g,y,k);zi(M,this,M.percents[0],null,this.attr());for(var O=0,G=At.length;O<G;O++)if(At[O].anim==w&&At[O].el==p){At[G-1].start=At[O].start;break}return this},$t.onAnimation=function(p){return p?o.on("raphael.anim.frame."+this.id,p):o.unbind("raphael.anim.frame."+this.id),this},Le.prototype.delay=function(p){var w=new Le(this.anim,this.ms);return w.times=this.times,w.del=+p||0,w},Le.prototype.repeat=function(p){var w=new Le(this.anim,this.ms);return w.del=this.del,w.times=q.floor(K(p,0))||1,w},h.animation=function(p,w,C,g){if(p instanceof Le)return p;!h.is(C,"function")&&C||(g=g||C||null,C=null),p=Object(p),w=+w||0;var y,k,M={};for(k in p)p[m](k)&&j(k)!=k&&j(k)+"%"!=k&&(y=!0,M[k]=p[k]);if(y)return C&&(M.easing=C),g&&(M.callback=g),new Le({100:M},w);if(g){var O=0;for(var G in p){var H=W(G);p[m](G)&&H>O&&(O=H)}!p[O+="%"].callback&&(p[O].callback=g)}return new Le(p,w)},$t.animate=function(p,w,C,g){if(this.removed)return g&&g.call(this),this;var y=p instanceof Le?p:h.animation(p,w,C,g);return zi(y,this,y.percents[0],null,this.attr()),this},$t.setTime=function(p,w){return p&&w!=null&&this.status(p,Z(w,p.ms)/p.ms),this},$t.status=function(p,w){var C,g,y=[],k=0;if(w!=null)return zi(p,this,-1,Z(w,1)),this;for(C=At.length;k<C;k++)if((g=At[k]).el.id==this.id&&(!p||g.anim==p)){if(p)return g.status;y.push({anim:g.anim,status:g.status})}return p?0:y},$t.pause=function(p){for(var w=0;w<At.length;w++)At[w].el.id!=this.id||p&&At[w].anim!=p||o("raphael.anim.pause."+this.id,this,At[w].anim)!==!1&&(At[w].paused=!0);return this},$t.resume=function(p){for(var w=0;w<At.length;w++)if(At[w].el.id==this.id&&(!p||At[w].anim==p)){var C=At[w];o("raphael.anim.resume."+this.id,this,C.anim)!==!1&&(delete C.paused,this.status(C.anim,C.status))}return this},$t.stop=function(p){for(var w=0;w<At.length;w++)At[w].el.id!=this.id||p&&At[w].anim!=p||o("raphael.anim.stop."+this.id,this,At[w].anim)!==!1&&At.splice(w--,1);return this},o.on("raphael.remove",yr),o.on("raphael.clear",yr),$t.toString=function(){return"Raphaël’s object"};var wr,br,We,Ke,Un=function(p){if(this.items=[],this.length=0,this.type="set",p)for(var w=0,C=p.length;w<C;w++)!p[w]||p[w].constructor!=$t.constructor&&p[w].constructor!=Un||(this[this.items.length]=this.items[this.items.length]=p[w],this.length++)},de=Un.prototype;for(var Bn in de.push=function(){for(var p,w,C=0,g=arguments.length;C<g;C++)!(p=arguments[C])||p.constructor!=$t.constructor&&p.constructor!=Un||(this[w=this.items.length]=this.items[w]=p,this.length++);return this},de.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},de.forEach=function(p,w){for(var C=0,g=this.items.length;C<g;C++)if(p.call(w,this.items[C],C)===!1)return this;return this},$t)$t[m](Bn)&&(de[Bn]=function(p){return function(){var w=arguments;return this.forEach(function(C){C[p][E](C,w)})}}(Bn));return de.attr=function(p,w){if(p&&h.is(p,nt)&&h.is(p[0],"object"))for(var C=0,g=p.length;C<g;C++)this.items[C].attr(p[C]);else for(var y=0,k=this.items.length;y<k;y++)this.items[y].attr(p,w);return this},de.clear=function(){for(;this.length;)this.pop()},de.splice=function(p,w,C){p=p<0?K(this.length+p,0):p,w=K(0,Z(this.length-p,w));var g,y=[],k=[],M=[];for(g=2;g<arguments.length;g++)M.push(arguments[g]);for(g=0;g<w;g++)k.push(this[p+g]);for(;g<this.length-p;g++)y.push(this[p+g]);var O=M.length;for(g=0;g<O+y.length;g++)this.items[p+g]=this[p+g]=g<O?M[g]:y[g-O];for(g=this.items.length=this.length-=w-O;this[g];)delete this[g++];return new Un(k)},de.exclude=function(p){for(var w=0,C=this.length;w<C;w++)if(this[w]==p)return this.splice(w,1),!0},de.animate=function(p,w,C,g){(h.is(C,"function")||!C)&&(g=C||null);var y,k,M=this.items.length,O=M,G=this;if(!M)return this;g&&(k=function(){!--M&&g.call(G)}),C=h.is(C,"string")?C:k;var H=h.animation(p,w,C,k);for(y=this.items[--O].animate(H);O--;)this.items[O]&&!this.items[O].removed&&this.items[O].animateWith(y,H,H),this.items[O]&&!this.items[O].removed||M--;return this},de.insertAfter=function(p){for(var w=this.items.length;w--;)this.items[w].insertAfter(p);return this},de.getBBox=function(){for(var p=[],w=[],C=[],g=[],y=this.items.length;y--;)if(!this.items[y].removed){var k=this.items[y].getBBox();p.push(k.x),w.push(k.y),C.push(k.x+k.width),g.push(k.y+k.height)}return{x:p=Z[E](0,p),y:w=Z[E](0,w),x2:C=K[E](0,C),y2:g=K[E](0,g),width:C-p,height:g-w}},de.clone=function(p){p=this.paper.set();for(var w=0,C=this.items.length;w<C;w++)p.push(this.items[w].clone());return p},de.toString=function(){return"Raphaël‘s set"},de.glow=function(p){var w=this.paper.set();return this.forEach(function(C,g){var y=C.glow(p);y?.forEach(function(k,M){w.push(k)})}),w},de.isPointInside=function(p,w){var C=!1;return this.forEach(function(g){if(g.isPointInside(p,w))return C=!0,!1}),C},h.registerFont=function(p){if(!p.face)return p;this.fonts=this.fonts||{};var w={w:p.w,face:{},glyphs:{}},C=p.face["font-family"];for(var g in p.face)p.face[m](g)&&(w.face[g]=p.face[g]);if(this.fonts[C]?this.fonts[C].push(w):this.fonts[C]=[w],!p.svg){for(var y in w.face["units-per-em"]=W(p.face["units-per-em"],10),p.glyphs)if(p.glyphs[m](y)){var k=p.glyphs[y];if(w.glyphs[y]={w:k.w,k:{},d:k.d&&"M"+k.d.replace(/[mlcxtrv]/g,function(O){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[O]||"M"})+"z"},k.k)for(var M in k.k)k[m](M)&&(w.glyphs[y].k[M]=k.k[M])}}return p},c.getFont=function(p,w,C,g){if(g=g||"normal",C=C||"normal",w=+w||{normal:400,bold:700,lighter:300,bolder:800}[w]||400,h.fonts){var y,k=h.fonts[p];if(!k){var M=new RegExp("(^|\\s)"+p.replace(/[^\w\d\s+!~.:_-]/g,P)+"(\\s|$)","i");for(var O in h.fonts)if(h.fonts[m](O)&&M.test(O)){k=h.fonts[O];break}}if(k)for(var G=0,H=k.length;G<H&&((y=k[G]).face["font-weight"]!=w||y.face["font-style"]!=C&&y.face["font-style"]||y.face["font-stretch"]!=g);G++);return y}},c.print=function(p,w,C,g,y,k,M,O){k=k||"middle",M=K(Z(M||0,1),-1),O=K(Z(O||1,3),1);var G,H=F(C)[L](P),Q=0,st=0,it=P;if(h.is(g,"string")&&(g=this.getFont(g)),g){G=(y||16)/g.face["units-per-em"];for(var tt=g.face.bbox[L](d),ot=+tt[0],ct=tt[3]-tt[1],lt=0,rt=+tt[1]+(k=="baseline"?ct+ +g.face.descent:ct/2),wt=0,ut=H.length;wt<ut;wt++){if(H[wt]==`
|
|
26
|
-
`)Q=0,ft=0,st=0,lt+=ct*
|
|
27
|
-
You are running Raphaël `+this.version};var
|
|
28
|
-
`),Y=[],X=0,et=N.length;X<et;X++)W=F("tspan"),X&&F(W,{dy:1.2*j,x:A.x}),W.appendChild(o._g.doc.createTextNode(N[X])),B.appendChild(W),Y[X]=W}else for(X=0,et=(Y=B.getElementsByTagName("tspan")).length;X<et;X++)X?F(Y[X],{dy:1.2*j,x:A.x}):F(Y[0],{dy:0});F(B,{x:A.x,y:A.y}),I._.dirty=1;var ht=I._getBBox(),mt=A.y-(ht.y+ht.height/2);mt&&o.is(mt,"finite")&&F(Y[0],{dy:mt})}},vt=function(I){return I.parentNode&&I.parentNode.tagName.toLowerCase()==="a"?I.parentNode:I},_t=function(I,D){this[0]=this.node=I,I.raphael=!0,this.id=("0000"+(Math.random()*Math.pow(36,5)<<0).toString(36)).slice(-5),I.raphaelid=this.id,this.matrix=o.matrix(),this.realPath=null,this.paper=D,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!D.bottom&&(D.bottom=this),this.prev=D.top,D.top&&(D.top.next=this),D.top=this,this.next=null},pt=o.el;_t.prototype=pt,pt.constructor=_t,o._engine.path=function(I,D){var A=F("path");D.canvas&&D.canvas.appendChild(A);var B=new _t(A,D);return B.type="path",Z(B,{fill:"none",stroke:"#000",path:I}),B},pt.rotate=function(I,D,A){if(this.removed)return this;if((I=l(I).split(b)).length-1&&(D=c(I[1]),A=c(I[2])),I=c(I[0]),A==null&&(D=A),D==null||A==null){var B=this.getBBox(1);D=B.x+B.width/2,A=B.y+B.height/2}return this.transform(this._.transform.concat([["r",I,D,A]])),this},pt.scale=function(I,D,A,B){if(this.removed)return this;if((I=l(I).split(b)).length-1&&(D=c(I[1]),A=c(I[2]),B=c(I[3])),I=c(I[0]),D==null&&(D=I),B==null&&(A=B),A==null||B==null)var j=this.getBBox(1);return A=A??j.x+j.width/2,B=B??j.y+j.height/2,this.transform(this._.transform.concat([["s",I,D,A,B]])),this},pt.translate=function(I,D){return this.removed?this:((I=l(I).split(b)).length-1&&(D=c(I[1])),I=c(I[0])||0,D=+D||0,this.transform(this._.transform.concat([["t",I,D]])),this)},pt.transform=function(I){var D=this._;if(I==null)return D.transform;if(o._extractTransform(this,I),this.clip&&F(this.clip,{transform:this.matrix.invert()}),this.pattern&&U(this),this.node&&F(this.node,{transform:this.matrix}),D.sx!=1||D.sy!=1){var A=this.attrs[h]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":A})}return this},pt.hide=function(){return this.removed||(this.node.style.display="none"),this},pt.show=function(){return this.removed||(this.node.style.display=""),this},pt.remove=function(){var I=vt(this.node);if(!this.removed&&I.parentNode){var D=this.paper;for(var A in D.__set__&&D.__set__.exclude(this),S.unbind("raphael.*.*."+this.id),this.gradient&&D.defs.removeChild(this.gradient),o._tear(this,D),I.parentNode.removeChild(I),this.removeData(),this)this[A]=typeof this[A]=="function"?o._removedFactory(A):null;this.removed=!0}},pt._getBBox=function(){if(this.node.style.display=="none"){this.show();var I=!0}var D,A=!1;this.paper.canvas.parentElement?D=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(D=this.paper.canvas.parentNode.style),D&&D.display=="none"&&(A=!0,D.display="");var B={};try{B=this.node.getBBox()}catch{B={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{B=B||{},A&&(D.display="none")}return I&&this.hide(),B},pt.attr=function(I,D){if(this.removed)return this;if(I==null){var A={};for(var B in this.attrs)this.attrs[h](B)&&(A[B]=this.attrs[B]);return A.gradient&&A.fill=="none"&&(A.fill=A.gradient)&&delete A.gradient,A.transform=this._.transform,A}if(D==null&&o.is(I,"string")){if(I=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(I=="transform")return this._.transform;for(var j=I.split(b),W={},N=0,Y=j.length;N<Y;N++)(I=j[N])in this.attrs?W[I]=this.attrs[I]:o.is(this.paper.customAttributes[I],"function")?W[I]=this.paper.customAttributes[I].def:W[I]=o._availableAttrs[I];return Y-1?W:W[j[0]]}if(D==null&&o.is(I,"array")){for(W={},N=0,Y=I.length;N<Y;N++)W[I[N]]=this.attr(I[N]);return W}if(D!=null){var X={};X[I]=D}else I!=null&&o.is(I,"object")&&(X=I);for(var et in X)S("raphael.attr."+et+"."+this.id,this,X[et]);for(et in this.paper.customAttributes)if(this.paper.customAttributes[h](et)&&X[h](et)&&o.is(this.paper.customAttributes[et],"function")){var ht=this.paper.customAttributes[et].apply(this,[].concat(X[et]));for(var mt in this.attrs[et]=X[et],ht)ht[h](mt)&&(X[mt]=ht[mt])}return Z(this,X),this},pt.toFront=function(){if(this.removed)return this;var I=vt(this.node);I.parentNode.appendChild(I);var D=this.paper;return D.top!=this&&o._tofront(this,D),this},pt.toBack=function(){if(this.removed)return this;var I=vt(this.node),D=I.parentNode;return D.insertBefore(I,D.firstChild),o._toback(this,this.paper),this.paper,this},pt.insertAfter=function(I){if(this.removed||!I)return this;var D=vt(this.node),A=vt(I.node||I[I.length-1].node);return A.nextSibling?A.parentNode.insertBefore(D,A.nextSibling):A.parentNode.appendChild(D),o._insertafter(this,I,this.paper),this},pt.insertBefore=function(I){if(this.removed||!I)return this;var D=vt(this.node),A=vt(I.node||I[0].node);return A.parentNode.insertBefore(D,A),o._insertbefore(this,I,this.paper),this},pt.blur=function(I){var D=this;if(+I!=0){var A=F("filter"),B=F("feGaussianBlur");D.attrs.blur=I,A.id=o.createUUID(),F(B,{stdDeviation:+I||1.5}),A.appendChild(B),D.paper.defs.appendChild(A),D._blur=A,F(D.node,{filter:"url(#"+A.id+")"})}else D._blur&&(D._blur.parentNode.removeChild(D._blur),delete D._blur,delete D.attrs.blur),D.node.removeAttribute("filter");return D},o._engine.circle=function(I,D,A,B){var j=F("circle");I.canvas&&I.canvas.appendChild(j);var W=new _t(j,I);return W.attrs={cx:D,cy:A,r:B,fill:"none",stroke:"#000"},W.type="circle",F(j,W.attrs),W},o._engine.rect=function(I,D,A,B,j,W){var N=F("rect");I.canvas&&I.canvas.appendChild(N);var Y=new _t(N,I);return Y.attrs={x:D,y:A,width:B,height:j,rx:W||0,ry:W||0,fill:"none",stroke:"#000"},Y.type="rect",F(N,Y.attrs),Y},o._engine.ellipse=function(I,D,A,B,j){var W=F("ellipse");I.canvas&&I.canvas.appendChild(W);var N=new _t(W,I);return N.attrs={cx:D,cy:A,rx:B,ry:j,fill:"none",stroke:"#000"},N.type="ellipse",F(W,N.attrs),N},o._engine.image=function(I,D,A,B,j,W){var N=F("image");F(N,{x:A,y:B,width:j,height:W,preserveAspectRatio:"none"}),N.setAttributeNS(x,"href",D),I.canvas&&I.canvas.appendChild(N);var Y=new _t(N,I);return Y.attrs={x:A,y:B,width:j,height:W,src:D},Y.type="image",Y},o._engine.text=function(I,D,A,B){var j=F("text");I.canvas&&I.canvas.appendChild(j);var W=new _t(j,I);return W.attrs={x:D,y:A,"text-anchor":"middle",text:B,"font-family":o._availableAttrs["font-family"],"font-size":o._availableAttrs["font-size"],stroke:"none",fill:"#000"},W.type="text",Z(W,W.attrs),W},o._engine.setSize=function(I,D){return this.width=I||this.width,this.height=D||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},o._engine.create=function(){var I=o._getContainer.apply(0,arguments),D=I&&I.container;if(!D)throw new Error("SVG container not found.");var A,B=I.x,j=I.y,W=I.width,N=I.height,Y=F("svg"),X="overflow:hidden;";return B=B||0,j=j||0,F(Y,{height:N=N||342,version:1.1,width:W=W||512,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),D==1?(Y.style.cssText=X+"position:absolute;left:"+B+"px;top:"+j+"px",o._g.doc.body.appendChild(Y),A=1):(Y.style.cssText=X+"position:relative",D.firstChild?D.insertBefore(Y,D.firstChild):D.appendChild(Y)),(D=new o._Paper).width=W,D.height=N,D.canvas=Y,D.clear(),D._left=D._top=0,A&&(D.renderfix=function(){}),D.renderfix(),D},o._engine.setViewBox=function(I,D,A,B,j){S("raphael.setViewBox",this,this._viewBox,[I,D,A,B,j]);var W,N,Y=this.getSize(),X=u(A/Y.width,B/Y.height),et=this.top,ht=j?"xMidYMid meet":"xMinYMin";for(I==null?(this._vbSize&&(X=1),delete this._vbSize,W="0 0 "+this.width+_+this.height):(this._vbSize=X,W=I+_+D+_+A+_+B),F(this.canvas,{viewBox:W,preserveAspectRatio:ht});X&&et;)N="stroke-width"in et.attrs?et.attrs["stroke-width"]:1,et.attr({"stroke-width":N}),et._.dirty=1,et._.dirtyT=1,et=et.prev;return this._viewBox=[I,D,A,B,!!j],this},o.prototype.renderfix=function(){var I,D=this.canvas,A=D.style;try{I=D.getScreenCTM()||D.createSVGMatrix()}catch{I=D.createSVGMatrix()}var B=-I.e%1,j=-I.f%1;(B||j)&&(B&&(this._left=(this._left+B)%1,A.left=this._left+"px"),j&&(this._top=(this._top+j)%1,A.top=this._top+"px"))},o.prototype.clear=function(){o.eve("raphael.clear",this);for(var I=this.canvas;I.firstChild;)I.removeChild(I.firstChild);this.bottom=this.top=null,(this.desc=F("desc")).appendChild(o._g.doc.createTextNode("Created with Raphaël "+o.version)),I.appendChild(this.desc),I.appendChild(this.defs=F("defs"))},o.prototype.remove=function(){for(var I in S("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this)this[I]=typeof this[I]=="function"?o._removedFactory(I):null};var nt=o.st;for(var J in pt)pt[h](J)&&!nt[h](J)&&(nt[J]=function(I){return function(){var D=arguments;return this.forEach(function(A){A[I].apply(A,D)})}}(J))}}.apply(i,s))===void 0||(e.exports=a)},function(e,i,r){var s,a;s=[r(0)],(a=function(o){if(!o||o.vml){var h="hasOwnProperty",l=String,c=parseFloat,d=Math,f=d.round,u=d.max,m=d.min,v=d.abs,b=/[, ]+/,S=o.eve,E=" ",_="",x={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},P=/([clmz]),?([^clmz]*)/gi,R=/ progid:\S+Blur\([^\)]+\)/g,F=/-?[^,\s-]+/g,L="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",$=21600,U={path:1,rect:1,image:1},z={circle:1,ellipse:1},q=function(D,A,B){var j=o.matrix();return j.rotate(-D,.5,.5),{dx:j.x(A,B),dy:j.y(A,B)}},K=function(D,A,B,j,W,N){var Y=D._,X=D.matrix,et=Y.fillpos,ht=D.node,mt=ht.style,bt=1,Tt="",yt=$/A,Et=$/B;if(mt.visibility="hidden",A&&B){if(ht.coordsize=v(yt)+E+v(Et),mt.rotation=N*(A*B<0?-1:1),N){var Pt=q(N,j,W);j=Pt.dx,W=Pt.dy}if(A<0&&(Tt+="x"),B<0&&(Tt+=" y")&&(bt=-1),mt.flip=Tt,ht.coordorigin=j*-yt+E+W*-Et,et||Y.fillsize){var Ot=ht.getElementsByTagName("fill");Ot=Ot&&Ot[0],ht.removeChild(Ot),et&&(Pt=q(N,X.x(et[0],et[1]),X.y(et[0],et[1])),Ot.position=Pt.dx*bt+E+Pt.dy*bt),Y.fillsize&&(Ot.size=Y.fillsize[0]*v(A)+E+Y.fillsize[1]*v(B)),ht.appendChild(Ot)}mt.visibility="visible"}};o.toString=function(){return`Your browser doesn’t support SVG. Falling down to VML.
|
|
29
|
-
You are running Raphaël `+this.version};var Z,at=function(D,A,B){for(var j=l(A).toLowerCase().split("-"),W=B?"end":"start",N=j.length,Y="classic",X="medium",et="medium";N--;)switch(j[N]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":Y=j[N];break;case"wide":case"narrow":et=j[N];break;case"long":case"short":X=j[N]}var ht=D.node.getElementsByTagName("stroke")[0];ht[W+"arrow"]=Y,ht[W+"arrowlength"]=X,ht[W+"arrowwidth"]=et},vt=function(D,A){D.attrs=D.attrs||{};var B=D.node,j=D.attrs,W=B.style,N=U[D.type]&&(A.x!=j.x||A.y!=j.y||A.width!=j.width||A.height!=j.height||A.cx!=j.cx||A.cy!=j.cy||A.rx!=j.rx||A.ry!=j.ry||A.r!=j.r),Y=z[D.type]&&(j.cx!=A.cx||j.cy!=A.cy||j.r!=A.r||j.rx!=A.rx||j.ry!=A.ry),X=D;for(var et in A)A[h](et)&&(j[et]=A[et]);if(N&&(j.path=o._getPath[D.type](D),D._.dirty=1),A.href&&(B.href=A.href),A.title&&(B.title=A.title),A.target&&(B.target=A.target),A.cursor&&(W.cursor=A.cursor),"blur"in A&&D.blur(A.blur),(A.path&&D.type=="path"||N)&&(B.path=function(ve){var fi=/[ahqstv]/gi,hn=o._pathToAbsolute;if(l(ve).match(fi)&&(hn=o._path2curve),fi=/[clmz]/g,hn==o._pathToAbsolute&&!l(ve).match(fi)){var Re=l(ve).replace(P,function(lo,cn,Ii){var di=[],gr=cn.toLowerCase()=="m",Oi=x[cn];return Ii.replace(F,function(Fi){gr&&di.length==2&&(Oi+=di+x[cn=="m"?"l":"L"],di=[]),di.push(f(Fi*$))}),Oi+di});return Re}var ti,Ue,Fn=hn(ve);Re=[];for(var Li=0,ln=Fn.length;Li<ln;Li++){ti=Fn[Li],(Ue=Fn[Li][0].toLowerCase())=="z"&&(Ue="x");for(var Ye=1,Se=ti.length;Ye<Se;Ye++)Ue+=f(ti[Ye]*$)+(Ye!=Se-1?",":_);Re.push(Ue)}return Re.join(E)}(~l(j.path).toLowerCase().indexOf("r")?o._pathToAbsolute(j.path):j.path),D._.dirty=1,D.type=="image"&&(D._.fillpos=[j.x,j.y],D._.fillsize=[j.width,j.height],K(D,1,1,0,0,0))),"transform"in A&&D.transform(A.transform),Y){var ht=+j.cx,mt=+j.cy,bt=+j.rx||+j.r||0,Tt=+j.ry||+j.r||0;B.path=o.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((ht-bt)*$),f((mt-Tt)*$),f((ht+bt)*$),f((mt+Tt)*$),f(ht*$)),D._.dirty=1}if("clip-rect"in A){var yt=l(A["clip-rect"]).split(b);if(yt.length==4){yt[2]=+yt[2]+ +yt[0],yt[3]=+yt[3]+ +yt[1];var Et=B.clipRect||o._g.doc.createElement("div"),Pt=Et.style;Pt.clip=o.format("rect({1}px {2}px {3}px {0}px)",yt),B.clipRect||(Pt.position="absolute",Pt.top=0,Pt.left=0,Pt.width=D.paper.width+"px",Pt.height=D.paper.height+"px",B.parentNode.insertBefore(Et,B),Et.appendChild(B),B.clipRect=Et)}A["clip-rect"]||B.clipRect&&(B.clipRect.style.clip="auto")}if(D.textpath){var Ot=D.textpath.style;A.font&&(Ot.font=A.font),A["font-family"]&&(Ot.fontFamily='"'+A["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,_)+'"'),A["font-size"]&&(Ot.fontSize=A["font-size"]),A["font-weight"]&&(Ot.fontWeight=A["font-weight"]),A["font-style"]&&(Ot.fontStyle=A["font-style"])}if("arrow-start"in A&&at(X,A["arrow-start"]),"arrow-end"in A&&at(X,A["arrow-end"],1),A.opacity!=null||A.fill!=null||A.src!=null||A.stroke!=null||A["stroke-width"]!=null||A["stroke-opacity"]!=null||A["fill-opacity"]!=null||A["stroke-dasharray"]!=null||A["stroke-miterlimit"]!=null||A["stroke-linejoin"]!=null||A["stroke-linecap"]!=null){var Ct=B.getElementsByTagName("fill");if(!(Ct=Ct&&Ct[0])&&(Ct=Z("fill")),D.type=="image"&&A.src&&(Ct.src=A.src),A.fill&&(Ct.on=!0),Ct.on!=null&&A.fill!="none"&&A.fill!==null||(Ct.on=!1),Ct.on&&A.fill){var Jt=l(A.fill).match(o._ISURL);if(Jt){Ct.parentNode==B&&B.removeChild(Ct),Ct.rotate=!0,Ct.src=Jt[1],Ct.type="tile";var zt=D.getBBox(1);Ct.position=zt.x+E+zt.y,D._.fillpos=[zt.x,zt.y],o._preload(Jt[1],function(){D._.fillsize=[this.offsetWidth,this.offsetHeight]})}else Ct.color=o.getRGB(A.fill).hex,Ct.src=_,Ct.type="solid",o.getRGB(A.fill).error&&(X.type in{circle:1,ellipse:1}||l(A.fill).charAt()!="r")&&_t(X,A.fill,Ct)&&(j.fill="none",j.gradient=A.fill,Ct.rotate=!1)}if("fill-opacity"in A||"opacity"in A){var ce=((+j["fill-opacity"]+1||2)-1)*((+j.opacity+1||2)-1)*((+o.getRGB(A.fill).o+1||2)-1);ce=m(u(ce,0),1),Ct.opacity=ce,Ct.src&&(Ct.color="none")}B.appendChild(Ct);var Xt=B.getElementsByTagName("stroke")&&B.getElementsByTagName("stroke")[0],Ee=!1;!Xt&&(Ee=Xt=Z("stroke")),(A.stroke&&A.stroke!="none"||A["stroke-width"]||A["stroke-opacity"]!=null||A["stroke-dasharray"]||A["stroke-miterlimit"]||A["stroke-linejoin"]||A["stroke-linecap"])&&(Xt.on=!0),(A.stroke=="none"||A.stroke===null||Xt.on==null||A.stroke==0||A["stroke-width"]==0)&&(Xt.on=!1);var ye=o.getRGB(A.stroke);Xt.on&&A.stroke&&(Xt.color=ye.hex),ce=((+j["stroke-opacity"]+1||2)-1)*((+j.opacity+1||2)-1)*((+ye.o+1||2)-1);var li=.75*(c(A["stroke-width"])||1);if(ce=m(u(ce,0),1),A["stroke-width"]==null&&(li=j["stroke-width"]),A["stroke-width"]&&(Xt.weight=li),li&&li<1&&(ce*=li)&&(Xt.weight=1),Xt.opacity=ce,A["stroke-linejoin"]&&(Xt.joinstyle=A["stroke-linejoin"]||"miter"),Xt.miterlimit=A["stroke-miterlimit"]||8,A["stroke-linecap"]&&(Xt.endcap=A["stroke-linecap"]=="butt"?"flat":A["stroke-linecap"]=="square"?"square":"round"),"stroke-dasharray"in A){var on={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};Xt.dashstyle=on[h](A["stroke-dasharray"])?on[A["stroke-dasharray"]]:_}Ee&&B.appendChild(Xt)}if(X.type=="text"){X.paper.canvas.style.display=_;var Qe=X.paper.span,Ri=j.font&&j.font.match(/\d+(?:\.\d*)?(?=px)/);W=Qe.style,j.font&&(W.font=j.font),j["font-family"]&&(W.fontFamily=j["font-family"]),j["font-weight"]&&(W.fontWeight=j["font-weight"]),j["font-style"]&&(W.fontStyle=j["font-style"]),Ri=c(j["font-size"]||Ri&&Ri[0])||10,W.fontSize=100*Ri+"px",X.textpath.string&&(Qe.innerHTML=l(X.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\n/g,"<br>"));var Di=Qe.getBoundingClientRect();X.W=j.w=(Di.right-Di.left)/100,X.H=j.h=(Di.bottom-Di.top)/100,X.X=j.x,X.Y=j.y+X.H/2,("x"in A||"y"in A)&&(X.path.v=o.format("m{0},{1}l{2},{1}",f(j.x*$),f(j.y*$),f(j.x*$)+1));for(var ci=["x","y","text","font","font-family","font-weight","font-style","font-size"],ui=0,dr=ci.length;ui<dr;ui++)if(ci[ui]in A){X._.dirty=1;break}switch(j["text-anchor"]){case"start":X.textpath.style["v-text-align"]="left",X.bbx=X.W/2;break;case"end":X.textpath.style["v-text-align"]="right",X.bbx=-X.W/2;break;default:X.textpath.style["v-text-align"]="center",X.bbx=0}X.textpath.style["v-text-kern"]=!0}},_t=function(D,A,B){D.attrs=D.attrs||{},D.attrs;var j=Math.pow,W="linear",N=".5 .5";if(D.attrs.gradient=A,A=(A=l(A).replace(o._radial_gradient,function(bt,Tt,yt){return W="radial",Tt&&yt&&(Tt=c(Tt),yt=c(yt),j(Tt-.5,2)+j(yt-.5,2)>.25&&(yt=d.sqrt(.25-j(Tt-.5,2))*(2*(yt>.5)-1)+.5),N=Tt+E+yt),_})).split(/\s*\-\s*/),W=="linear"){var Y=A.shift();if(Y=-c(Y),isNaN(Y))return null}var X=o._parseDots(A);if(!X)return null;if(D=D.shape||D.node,X.length){D.removeChild(B),B.on=!0,B.method="none",B.color=X[0].color,B.color2=X[X.length-1].color;for(var et=[],ht=0,mt=X.length;ht<mt;ht++)X[ht].offset&&et.push(X[ht].offset+E+X[ht].color);B.colors=et.length?et.join():"0% "+B.color,W=="radial"?(B.type="gradientTitle",B.focus="100%",B.focussize="0 0",B.focusposition=N,B.angle=0):(B.type="gradient",B.angle=(270-Y)%360),D.appendChild(B)}return 1},pt=function(D,A){this[0]=this.node=D,D.raphael=!0,this.id=o._oid++,D.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=A,this.matrix=o.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!A.bottom&&(A.bottom=this),this.prev=A.top,A.top&&(A.top.next=this),A.top=this,this.next=null},nt=o.el;pt.prototype=nt,nt.constructor=pt,nt.transform=function(D){if(D==null)return this._.transform;var A,B=this.paper._viewBoxShift,j=B?"s"+[B.scale,B.scale]+"-1-1t"+[B.dx,B.dy]:_;B&&(A=D=l(D).replace(/\.{3}|\u2026/g,this._.transform||_)),o._extractTransform(this,j+D);var W,N=this.matrix.clone(),Y=this.skew,X=this.node,et=~l(this.attrs.fill).indexOf("-"),ht=!l(this.attrs.fill).indexOf("url(");if(N.translate(1,1),ht||et||this.type=="image")if(Y.matrix="1 0 0 1",Y.offset="0 0",W=N.split(),et&&W.noRotation||!W.isSimple){X.style.filter=N.toFilter();var mt=this.getBBox(),bt=this.getBBox(1),Tt=mt.x-bt.x,yt=mt.y-bt.y;X.coordorigin=Tt*-$+E+yt*-$,K(this,1,1,Tt,yt,0)}else X.style.filter=_,K(this,W.scalex,W.scaley,W.dx,W.dy,W.rotate);else X.style.filter=_,Y.matrix=l(N),Y.offset=N.offset();return A!==null&&(this._.transform=A,o._extractTransform(this,A)),this},nt.rotate=function(D,A,B){if(this.removed)return this;if(D!=null){if((D=l(D).split(b)).length-1&&(A=c(D[1]),B=c(D[2])),D=c(D[0]),B==null&&(A=B),A==null||B==null){var j=this.getBBox(1);A=j.x+j.width/2,B=j.y+j.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",D,A,B]])),this}},nt.translate=function(D,A){return this.removed?this:((D=l(D).split(b)).length-1&&(A=c(D[1])),D=c(D[0])||0,A=+A||0,this._.bbox&&(this._.bbox.x+=D,this._.bbox.y+=A),this.transform(this._.transform.concat([["t",D,A]])),this)},nt.scale=function(D,A,B,j){if(this.removed)return this;if((D=l(D).split(b)).length-1&&(A=c(D[1]),B=c(D[2]),j=c(D[3]),isNaN(B)&&(B=null),isNaN(j)&&(j=null)),D=c(D[0]),A==null&&(A=D),j==null&&(B=j),B==null||j==null)var W=this.getBBox(1);return B=B??W.x+W.width/2,j=j??W.y+W.height/2,this.transform(this._.transform.concat([["s",D,A,B,j]])),this._.dirtyT=1,this},nt.hide=function(){return!this.removed&&(this.node.style.display="none"),this},nt.show=function(){return!this.removed&&(this.node.style.display=_),this},nt.auxGetBBox=o.el.getBBox,nt.getBBox=function(){var D=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var A={},B=1/this.paper._viewBoxShift.scale;return A.x=D.x-this.paper._viewBoxShift.dx,A.x*=B,A.y=D.y-this.paper._viewBoxShift.dy,A.y*=B,A.width=D.width*B,A.height=D.height*B,A.x2=A.x+A.width,A.y2=A.y+A.height,A}return D},nt._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},nt.remove=function(){if(!this.removed&&this.node.parentNode){for(var D in this.paper.__set__&&this.paper.__set__.exclude(this),o.eve.unbind("raphael.*.*."+this.id),o._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape),this)this[D]=typeof this[D]=="function"?o._removedFactory(D):null;this.removed=!0}},nt.attr=function(D,A){if(this.removed)return this;if(D==null){var B={};for(var j in this.attrs)this.attrs[h](j)&&(B[j]=this.attrs[j]);return B.gradient&&B.fill=="none"&&(B.fill=B.gradient)&&delete B.gradient,B.transform=this._.transform,B}if(A==null&&o.is(D,"string")){if(D=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;for(var W=D.split(b),N={},Y=0,X=W.length;Y<X;Y++)(D=W[Y])in this.attrs?N[D]=this.attrs[D]:o.is(this.paper.customAttributes[D],"function")?N[D]=this.paper.customAttributes[D].def:N[D]=o._availableAttrs[D];return X-1?N:N[W[0]]}if(this.attrs&&A==null&&o.is(D,"array")){for(N={},Y=0,X=D.length;Y<X;Y++)N[D[Y]]=this.attr(D[Y]);return N}var et;for(var ht in A!=null&&((et={})[D]=A),A==null&&o.is(D,"object")&&(et=D),et)S("raphael.attr."+ht+"."+this.id,this,et[ht]);if(et){for(ht in this.paper.customAttributes)if(this.paper.customAttributes[h](ht)&&et[h](ht)&&o.is(this.paper.customAttributes[ht],"function")){var mt=this.paper.customAttributes[ht].apply(this,[].concat(et[ht]));for(var bt in this.attrs[ht]=et[ht],mt)mt[h](bt)&&(et[bt]=mt[bt])}et.text&&this.type=="text"&&(this.textpath.string=et.text),vt(this,et)}return this},nt.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&o._tofront(this,this.paper),this},nt.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),o._toback(this,this.paper)),this)},nt.insertAfter=function(D){return this.removed?this:(D.constructor==o.st.constructor&&(D=D[D.length-1]),D.node.nextSibling?D.node.parentNode.insertBefore(this.node,D.node.nextSibling):D.node.parentNode.appendChild(this.node),o._insertafter(this,D,this.paper),this)},nt.insertBefore=function(D){return this.removed?this:(D.constructor==o.st.constructor&&(D=D[0]),D.node.parentNode.insertBefore(this.node,D.node),o._insertbefore(this,D,this.paper),this)},nt.blur=function(D){var A=this.node.runtimeStyle,B=A.filter;return B=B.replace(R,_),+D!=0?(this.attrs.blur=D,A.filter=B+E+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+D||1.5)+")",A.margin=o.format("-{0}px 0 0 -{0}px",f(+D||1.5))):(A.filter=B,A.margin=0,delete this.attrs.blur),this},o._engine.path=function(D,A){var B=Z("shape");B.style.cssText=L,B.coordsize=$+E+$,B.coordorigin=A.coordorigin;var j=new pt(B,A),W={fill:"none",stroke:"#000"};D&&(W.path=D),j.type="path",j.path=[],j.Path=_,vt(j,W),A.canvas&&A.canvas.appendChild(B);var N=Z("skew");return N.on=!0,B.appendChild(N),j.skew=N,j.transform(_),j},o._engine.rect=function(D,A,B,j,W,N){var Y=o._rectPath(A,B,j,W,N),X=D.path(Y),et=X.attrs;return X.X=et.x=A,X.Y=et.y=B,X.W=et.width=j,X.H=et.height=W,et.r=N,et.path=Y,X.type="rect",X},o._engine.ellipse=function(D,A,B,j,W){var N=D.path();return N.attrs,N.X=A-j,N.Y=B-W,N.W=2*j,N.H=2*W,N.type="ellipse",vt(N,{cx:A,cy:B,rx:j,ry:W}),N},o._engine.circle=function(D,A,B,j){var W=D.path();return W.attrs,W.X=A-j,W.Y=B-j,W.W=W.H=2*j,W.type="circle",vt(W,{cx:A,cy:B,r:j}),W},o._engine.image=function(D,A,B,j,W,N){var Y=o._rectPath(B,j,W,N),X=D.path(Y).attr({stroke:"none"}),et=X.attrs,ht=X.node,mt=ht.getElementsByTagName("fill")[0];return et.src=A,X.X=et.x=B,X.Y=et.y=j,X.W=et.width=W,X.H=et.height=N,et.path=Y,X.type="image",mt.parentNode==ht&&ht.removeChild(mt),mt.rotate=!0,mt.src=A,mt.type="tile",X._.fillpos=[B,j],X._.fillsize=[W,N],ht.appendChild(mt),K(X,1,1,0,0,0),X},o._engine.text=function(D,A,B,j){var W=Z("shape"),N=Z("path"),Y=Z("textpath");A=A||0,B=B||0,j=j||"",N.v=o.format("m{0},{1}l{2},{1}",f(A*$),f(B*$),f(A*$)+1),N.textpathok=!0,Y.string=l(j),Y.on=!0,W.style.cssText=L,W.coordsize=$+E+$,W.coordorigin="0 0";var X=new pt(W,D),et={fill:"#000",stroke:"none",font:o._availableAttrs.font,text:j};X.shape=W,X.path=N,X.textpath=Y,X.type="text",X.attrs.text=l(j),X.attrs.x=A,X.attrs.y=B,X.attrs.w=1,X.attrs.h=1,vt(X,et),W.appendChild(Y),W.appendChild(N),D.canvas.appendChild(W);var ht=Z("skew");return ht.on=!0,W.appendChild(ht),X.skew=ht,X.transform(_),X},o._engine.setSize=function(D,A){var B=this.canvas.style;return this.width=D,this.height=A,D==+D&&(D+="px"),A==+A&&(A+="px"),B.width=D,B.height=A,B.clip="rect(0 "+D+" "+A+" 0)",this._viewBox&&o._engine.setViewBox.apply(this,this._viewBox),this},o._engine.setViewBox=function(D,A,B,j,W){o.eve("raphael.setViewBox",this,this._viewBox,[D,A,B,j,W]);var N,Y,X=this.getSize(),et=X.width,ht=X.height;return W&&(B*(N=ht/j)<et&&(D-=(et-B*N)/2/N),j*(Y=et/B)<ht&&(A-=(ht-j*Y)/2/Y)),this._viewBox=[D,A,B,j,!!W],this._viewBoxShift={dx:-D,dy:-A,scale:X},this.forEach(function(mt){mt.transform("...")}),this},o._engine.initWin=function(D){var A=D.document;A.styleSheets.length<31?A.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):A.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!A.namespaces.rvml&&A.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),Z=function(B){return A.createElement("<rvml:"+B+' class="rvml">')}}catch{Z=function(j){return A.createElement("<"+j+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},o._engine.initWin(o._g.win),o._engine.create=function(){var D=o._getContainer.apply(0,arguments),A=D.container,B=D.height,j=D.width,W=D.x,N=D.y;if(!A)throw new Error("VML container not found.");var Y=new o._Paper,X=Y.canvas=o._g.doc.createElement("div"),et=X.style;return W=W||0,N=N||0,j=j||512,B=B||342,Y.width=j,Y.height=B,j==+j&&(j+="px"),B==+B&&(B+="px"),Y.coordsize=216e5+E+216e5,Y.coordorigin="0 0",Y.span=o._g.doc.createElement("span"),Y.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",X.appendChild(Y.span),et.cssText=o.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",j,B),A==1?(o._g.doc.body.appendChild(X),et.left=W+"px",et.top=N+"px",et.position="absolute"):A.firstChild?A.insertBefore(X,A.firstChild):A.appendChild(X),Y.renderfix=function(){},Y},o.prototype.clear=function(){o.eve("raphael.clear",this),this.canvas.innerHTML=_,this.span=o._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},o.prototype.remove=function(){for(var D in o.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas),this)this[D]=typeof this[D]=="function"?o._removedFactory(D):null;return!0};var J=o.st;for(var I in nt)nt[h](I)&&!J[h](I)&&(J[I]=function(D){return function(){var A=arguments;return this.forEach(function(B){B[D].apply(B,A)})}}(I))}}.apply(i,s))===void 0||(e.exports=a)}])})})(Vc);var rp=Vc.exports;const be=Pe(rp);class Ir{points;constructor(t=[]){this.points=t}toSVGPathData(){const t=[];for(let e=0,i=this.length;e<i;e++)t.push([e===0?"M":"L",this.points[e].x,this.points[e].y]);return t}toSVGPathD(){let t="";for(let e=0,i=this.length;e<i;e++)t+=(e===0?"M":"L")+this.points[e].x+","+this.points[e].y;return t}get length(){return this.points.length}addPoint(t){this.points.push(t)}getPoint(t){return this.points[t]}isContainPoint(t){const e=t.x,i=t.y,r=this.length;let s=!1;const a=2e-10;for(let o=0,h=r-1;o<r;h=o,o++){const l=this.points[o].x,c=this.points[o].y,d=this.points[h].x,f=this.points[h].y;if(l===e&&c===i||d===e&&f===i||i===c&&i===f)return!0;if(i>=c&&i<f||i<c&&i>=f){const u=(d-l)/(f-c),m=l+u*(i-c);if(m===e||Math.abs(m-e)<a)return!0;m>e&&(s=!s)}}return s}[Symbol.iterator](){let t=0;return{next:()=>({value:t>=this.length-1?this.points[++t]:void 0,done:t>=this.length})}}static generateInMultiplePoint(t,e,i,r,s=1){const a=new Ir;for(let o=0;o<=s*i;o+=1){const h=Math.floor(o/s)/i*2*Math.PI,l=t+Math.cos(h)*r,c=e+Math.sin(h)*r;a.addPoint(new Wt({x:l,y:c}))}return a}}be.easing_formulas.swing=function(n){return n+Math.sin(n*Math.PI*2)/2},be.easing_formulas.may_cause_seizures=function(n){return n+.2*Math.random()-.1};function sp(n,t,e){let i;return n&&typeof n=="object"&&n.canvas?i=n:n&&(typeof n=="string"||n instanceof HTMLElement)?i=be(n,t,e):i=be(0,0,t,e),i}be.fn.importSVG=function(n,t){const e=op.fromRawSVG(n);return e.toRaphael(this,(i,r)=>{e.save(),t&&t(i),r(),e.restore()}),this},be.fn.NPolygonPath=function(n,t,e,i,r=2){return{shape:this.path(Ir.generateInMultiplePoint(n,t,e,i,r).toSVGPathD()),afterPath:Ir.generateInMultiplePoint(n,t,e*r,i,1).toSVGPathD()}},be.fn.zoom=function(n=1){return this.setViewBox(0,0,this.width/n,this.height/n),this},be.fn.brickwall=function(n,t,e,i,r){for(var s=i/r,a=e/3,o={fill:"firebrick",stroke:"#CCC"},h=0;h<r;h+=1){var l=this.rect(0,0,a,s).attr(o),c=this.rect(0,0,2*a,s).attr(o);h%2?(l.transform("T"+n+","+(t+h*s)),c.transform("T"+(n+a)+","+(t+h*s))):(c.transform("T"+n+","+(t+h*s)),l.transform("T"+(n+2*a)+","+(t+h*s)))}},be.fn.rosetta=function(n,t,e,i,r){const s=mn.generateRosetta(n,t,e,i,r);return s.center,this.path(s.toSVGPathD())},be.fn.moon=function(n){n=n||{},n.r=typeof n.r=="number"?n.r:100,n.phase=typeof n.phase=="number"?n.phase:.25,n.x=typeof n.x=="number"?n.x:0,n.y=typeof n.y=="number"?n.y:0,this.circle(n.r+n.x,n.r+n.y,n.r).attr({"stroke-width":0,fill:"#999"});function t(i){i=typeof i=="number"?i:.25,i=Math.max(0,Math.min(1,i)),i=(i-.5)*2;let r="M"+n.r+",0";r+="a"+n.r+","+n.r+" 0 0,0 0,"+n.r*2;let s=i>0?0:1;return i=Math.abs(i),i=i||1e-4,n.inner_r=n.r/Math.pow(i,.5),r+="M"+n.r+","+n.r*2,r+="a"+n.inner_r+","+n.inner_r+" 0 0,"+s+" 0,"+n.r*-2,r}var e=this.path(t(n.phase)).attr({"stroke-width":0,stroke:"#999",fill:"#FF9"}).transform("T"+n.x+","+n.y);return{setPhase:function(i){e.attr("path",t(i))}}},be.fn.star=function(n,t,e){let i="M"+n+","+(t-e);for(var r=0;r<6;r+=1){const s=270+r*144,a=n+e*Math.cos(s*Math.PI/180),o=t+e*Math.sin(s*Math.PI/180);i+="L"+a+","+o}return this.path(i).attr("stroke-width",0).attr("fill","red")},be.fn.heart=function(n=150,t=300){let e="M"+n+","+t;return e+="l120,-175a50,50 0 0,0 -120,-75a50,50 0 0,0 -120,75l120,175",this.path(e).attr("stroke","red").attr("fill","pink")},be.el.redder=function(){const n=be.getRGB(this.attr("fill"));n.r+=51,this.attr("fill","rgb("+n.r+","+n.g+","+n.b+")")},be.installCustomAttributes=function(n){n.customAttributes.redness=function(t){const e=255*(1-t/100);return{fill:"rgb(255,"+e+", "+e+")"}},n.customAttributes.progress=function(t){const e=this.data("progresspath"),i=this.attr(),r={x:0,y:0},s=this.data("progresstrail");if(!e)return{transform:"t0,0"};Object.prototype.hasOwnProperty.call(i,"width")&&(r.x=-this.attr("width")/2,r.y=-this.attr("height")/2);const a=e.getTotalLength(),o=e.getPointAtLength(t*a);return s&&s.attr("path",e.getSubpath(0,t*a)),{transform:"t"+(o.x+r.x)+","+(o.y+r.y)+"r"+o.alpha}}};const qo=be;class Vi{pgs=[];history=[];save(){this.history.push(Nl(this.pgs))}restore(){const t=this.history.pop();t&&(this.pgs=t)}get size(){let t=0,e=0;return this.pgs.forEach(i=>{const r=i.pg;if(r){const[s,a,o,h]=r.bounds,[l,c]=r.size;t=Math.max(t,s,s+l,o),e=Math.max(e,a,a+c,h)}}),[Math.ceil(t),Math.ceil(e)]}static fromRawSVG(t){return Vi.fromRawSVGUseRappar(t)}static fromRawSVGUseRappar(t){const e=new Vi,i=Uc(t);for(let r=0,s=i.length;r<s;r++){const a=i[r];if(a.type=="viewbox"&&a.width&&a.height)continue;const o={attrs:{}};for(const h in a)h==="type"||h==="path"||h==="transform"||(o.attrs[h]=a[h]);switch(a.type){case"path":o.d=a.path,o.pg=mn.fromSVGPathD(a.path,a.transform);break}e.pgs.push(o)}return e}toRaphael(t,e){let i;t instanceof HTMLElement?i=qo(HTMLElement):typeof t=="string"?i=qo(document.getElementById(t)):i=t;const[r,s]=this.size;i.setSize(r,s);const a=(o=!1)=>{for(let h=0,l=this.pgs.length;h<l;h++){const c=this.pgs[h];if(c.pg&&(c.raphaelPath?c.raphaelPath.attr("path",c.pg.toSVGPathD()):c.raphaelPath=i.path(c.pg.toSVGPathD()),c.raphaelPath.attr(c.attrs)),o&&e){const d=f=>{const{x:u,y:m}=ze(i.canvas,f),v=this.pgs.find(b=>b.raphaelPath?.isPointInside(u,m));v&&e?.(v,a)};c.raphaelPath?.unclick(d),c.raphaelPath?.click(d)}}};return a(!0),i}toCanvasOperation(t,e){let i;typeof t=="string"?i=document.getElementById(t):i=t;const[r,s]=this.size;i.width=r,i.height=s;const a=new Wo(i),o=()=>{a.clearRect(0,0,r,s);for(let l=0,c=this.pgs.length;l<c;l++){const d=this.pgs[l];d.pg&&(a.save(),this.toCanvasAttrs(a,d.attrs),d.pg.toCanvas(a),d.attrs.stroke!=="none"&&a.stroke(),d.attrs.fill!=="none"&&a.fill(),a.restore())}};o();const h=l=>{const{x:c,y:d}=ze(a.canvas,l),f=this.pgs.find(u=>u.pg?.isPointInPath(c,d));f&&e?.(f,o)};return i.removeEventListener("click",h),i.addEventListener("click",h),a}toCanvasAttrs(t,e){for(const i in e){const r=e[i];switch(i){case"fill":t.fillStyle=String(r);break;case"stroke":t.strokeStyle=String(r);break;case"stroke-width":t.lineWidth=Number(r);break;case"stroke-linecap":t.lineCap=r;break;case"stroke-linejoin":t.lineJoin=r;break}}}static toDownloadSVGElement(t,e="shape"){To(tc(t),`${e}.svg`)}toDownloadSVGElement(t,e="shape"){return Vi.toDownloadSVGElement(t,e),this}static toDownloadSVGString(t,e="shape"){To(Co(t),`${e}.svg`)}toDownloadSVGString(t,e="shape"){return Vi.toDownloadSVGString(t,e),this}static getSVGDOM(t){if(t instanceof HTMLObjectElement||t instanceof HTMLIFrameElement)return t.contentDocument;if(t instanceof HTMLEmbedElement)return t.getSVGDocument()}}const op=Vi;class Wo{canvas;context;customContext;constructor(t){this.canvas=t,this.context=t.getContext("2d",{willReadFrequently:!0}),this.customContext=new Lr({canvas:this.canvas,width:this.canvas.width,height:this.canvas.height})}set lineWidth(t){this.context.lineWidth=t,this.customContext.lineWidth=t}get lineWidth(){return this.context.lineWidth}set lineCap(t){this.context.lineCap=t,this.customContext.lineCap=t}get lineCap(){return this.context.lineCap}set lineJoin(t){this.context.lineJoin=t,this.customContext.lineCap=t}get lineJoin(){return this.context.lineJoin}set lineDashOffset(t){this.context.lineDashOffset=t,this.customContext.lineDashOffset=t}get lineDashOffset(){return this.context.lineDashOffset}set miterLimit(t){this.context.miterLimit=t,this.customContext.miterLimit=t}get miterLimit(){return this.context.miterLimit}set globalAlpha(t){this.context.globalAlpha=t,this.customContext.globalAlpha=t}get globalAlpha(){return this.context.globalAlpha}set fillStyle(t){typeof t=="string"||t instanceof CanvasGradient||t instanceof CanvasPattern?(this.context.fillStyle=t,this.customContext.fillStyle=t):(this.context.fillStyle=t.gradient,this.customContext.fillStyle=t.gradientCustom)}get fillStyle(){return this.context.fillStyle}set strokeStyle(t){typeof t=="string"||t instanceof CanvasGradient||t instanceof CanvasPattern?(this.context.strokeStyle=t,this.customContext.strokeStyle=t):(this.context.strokeStyle=t.gradient,this.customContext.strokeStyle=t.gradientCustom)}get strokeStyle(){return this.context.strokeStyle}set font(t){this.context.font=t,this.customContext.font=t}get font(){return this.context.font}fill(){return this.context.fill(),this.customContext.fill(),this}fillRect(t,e,i,r){return this.context.fillRect(t,e,i,r),this.customContext.fillRect(t,e,i,r),this}fillText(t,e,i,r){return this.context.fillText(t,e,i,r),this.customContext.fillText(t,e,i),this}setLineDash(t){return this.context.setLineDash(t),this.customContext.setLineDash(t),this}stroke(){return this.context.stroke(),this.customContext.stroke(),this}strokeText(t,e,i,r){return this.context.strokeText(t,e,i,r),this.customContext.strokeText(t,e,i),this}strokeRect(t,e,i,r){return this.context.strokeRect(t,e,i,r),this.customContext.strokeRect(t,e,i,r),this}clearRect(t=0,e=0,i=this.canvas.width,r=this.canvas.height){return this.context.clearRect(t,e,i,r),this.customContext.clearRect(t,e,i,r),this}save(){return this.context.save(),this.customContext.save(),this}restore(){return this.context.restore(),this.customContext.restore(),this}beginPath(){return this.context.beginPath(),this.customContext.beginPath(),this}closePath(){return this.context.closePath(),this.customContext.closePath(),this}moveTo(t,e){return this.context.moveTo(t,e),this.customContext.moveTo(t,e),this}lineTo(t,e){return this.context.lineTo(t,e),this.customContext.lineTo(t,e),this}arc(t,e,i,r,s,a){return this.context.arc(t,e,i,r,s,a),this.customContext.arc(t,e,i,r,s,a?-1:1),this}arcTo(t,e,i,r,s){return this.context.arcTo(t,e,i,r,s),this.customContext.arcTo(t,e,i,r,s),this}quadraticCurveTo(t,e,i,r){return this.context.quadraticCurveTo(t,e,i,r),this.customContext.quadraticCurveTo(t,e,i,r),this}bezierCurveTo(t,e,i,r,s,a){return this.context.bezierCurveTo(t,e,i,r,s,a),this.customContext.bezierCurveTo(t,e,i,r,s,a),this}rect(t,e,i,r){return this.context.rect(t,e,i,r),this.customContext.rect(t,e,i,r),this}translate(t,e){return this.context.translate(t,e),this.customContext.translate(t,e),this}rotate(t){return this.context.rotate(t),this.customContext.rotate(t),this}scale(t,e){return this.context.scale(t,e),this.customContext.scale(t,e),this}createLinearGradient(t,e,i,r,s){const a=this.context.createLinearGradient(t,e,i,r),o=this.customContext.createLinearGradient(t,e,i,r);return s&&Object.keys(s).forEach(h=>{const l=parseFloat(h);a.addColorStop(l,s[l]),o.addColorStop(l,s[l])}),{gradient:a,gradientCustom:o}}createRadialGradient(t,e,i,r,s,a,o){const h=this.context.createRadialGradient(t,e,i,r,s,a),l=this.customContext.createRadialGradient(t,e,i,r,s,a);return o&&Object.keys(o).forEach(c=>{const d=parseFloat(c);h.addColorStop(d,o[d]),l.addColorStop(d,o[d])}),{gradient:h,gradientCustom:l}}drawImage(t,e=0,i=0){return this.context.drawImage(t,e,i),this.customContext.drawImage(t,e,i),this}getImageData(t,e,i,r,s){return this.context.getImageData(t,e,i,r,s)}putImageData(t,e=0,i=0){return this.context.putImageData(t,e,i)}toRawSVG(){const t=this.customContext.getSerializedSvg(!0),e=this.customContext.getSvg();return{raw:t,element:e}}toSVGOperation(){const{raw:t}=this.toRawSVG();return Vi.fromRawSVG(t)}}(function(){let n=0;window.requestAnimationFrame||(window.requestAnimationFrame=function(t){const e=new Date().getTime(),i=Math.max(0,16-(e-n)),r=window.setTimeout(function(){t(e+i)},i);return n=e+i,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})})();const Ko=n=>{window.requestAnimationFrame(function t(e){const i=window.requestAnimationFrame(t);n(e,i)})};class hp extends Zl{container;ctx;config;mouse;keyboard;resizeObserver;installedPlugins=new Map;animateFrameID;constructor(t,e={}){super(),this.container=t,this.ctx=new Wo(this.container),this.config=Gl(e,Ag),t instanceof HTMLCanvasElement&&(this.config.width=t.width,this.config.height=t.height),this.resizeObserver=new ResizeObserver(i=>{const{width:r,height:s}=i[0].contentRect;this.emit("resizeRoot",r,s)}),this.resizeObserver.observe(this.container),this.mouse=new Dg(this),this.keyboard=new Lg(this)}renderFrame(t){Ko((e,i)=>{this.animateFrameID=i,t(this)})}destroyFrame(){typeof this.animateFrameID<"u"&&window.cancelAnimationFrame(this.animateFrameID)}destroy(){this.removeAllListeners(),this.destroyPlugin(Array.from(this.installedPlugins.keys())),this.resizeObserver.disconnect(),this.mouse?.destroy(),this.keyboard?.destroy(),this.destroyFrame()}drawMouseMoveLine(t={}){switch(t.type){case"brush":t.typeOptions=t.typeOptions||{brush_size:10,brush_density:50,brush_color:"#000000"};const e=this.ctx.getImageData(0,0,this.config.width,this.config.height),i=e.data,r=ya(t.typeOptions.brush_color);let s=!1;this.on("mouseDown",()=>{s=!0}),this.on("mouseUp",()=>{s=!1}),this.on("mouseMove",()=>{if(s){for(let a=0;a<t.typeOptions.brush_density;a++){const o=Math.random()*Math.PI*2,h=Math.random()*t.typeOptions.brush_size,l=this.mouse.point.x+Math.cos(o)*h|0,c=this.mouse.point.y+Math.sin(o)*h|0,d=(l+c*e.width)*4;i[d]=r>>16&255,i[d+1]=r>>8&255,i[d+2]=r&255,i[d+3]=255}this.ctx.putImageData(e)}});break;case"line":default:this.on("mouseDown",()=>{this.ctx.beginPath(),this.ctx.moveTo(this.mouse.point.x,this.mouse.point.y)}),this.on("mouseMove",()=>{this.ctx.lineTo(this.mouse.point.x,this.mouse.point.y),t.extra?.(this),this.ctx.stroke()}),this.on("mouseUp",()=>{this.ctx.closePath()})}}use(t,...e){return this.installedPlugins.has(t.name)||(this.installedPlugins.set(t.name,t),t.install(this,...e)),this}getPlugin(t){return this.installedPlugins.get(t)}getPlugins(t){return t.map(e=>this.getPlugin(e))}enablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.enable?.()),this}disablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.disable?.()),this}destroyPlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.destroy()),this}isPluginEnable(t){return this.getPlugin(t)?.isEnabled?.()??!1}}const lp={safeAreaTop:It.getCSSVar("--safe-area-inset-top"),safeAreaRight:It.getCSSVar("--safe-area-inset-right"),safeAreaBottom:It.getCSSVar("--safe-area-inset-bottom"),safeAreaLeft:It.getCSSVar("--safe-area-inset-left"),colorPrimary:It.getCSSVar("--color-primary"),colorRed:It.getCSSVar("--color-red"),colorOrange:It.getCSSVar("--color-orange"),colorYellow:It.getCSSVar("--color-yellow"),colorGreen:It.getCSSVar("--color-green"),colorBlue:It.getCSSVar("--color-blue"),colorPurple:It.getCSSVar("--color-purple"),colorBlack:It.getCSSVar("--color-black"),colorGray0:It.getCSSVar("--color-gray-0"),colorGray3:It.getCSSVar("--color-gray-3"),colorGray6:It.getCSSVar("--color-gray-6"),colorGray9:It.getCSSVar("--color-gray-9"),colorGrayCC:It.getCSSVar("--color-gray-cc"),colorGrayDD:It.getCSSVar("--color-gray-dd"),colorGrayE6:It.getCSSVar("--color-gray-e6"),colorGrayEE:It.getCSSVar("--color-gray-ee"),colorGrayEF:It.getCSSVar("--color-gray-ef"),colorGrayF5:It.getCSSVar("--color-gray-f5"),colorGrayFF:It.getCSSVar("--color-gray-ff"),fontLineHeight:It.getCSSVar("--font-line-height"),fontSize32:It.getCSSVar("--font-size-32"),fontSize24:It.getCSSVar("--font-size-24"),fontSize20:It.getCSSVar("--font-size-20"),fontSize18:It.getCSSVar("--font-size-18"),fontSize16:It.getCSSVar("--font-size-16"),fontSize14:It.getCSSVar("--font-size-14"),fontSize12:It.getCSSVar("--font-size-12"),fontSize11:It.getCSSVar("--font-size-11"),gap4:It.getCSSVar("--gap-4"),gap8:It.getCSSVar("--gap-8"),gap12:It.getCSSVar("--gap-12"),gap16:It.getCSSVar("--gap-16"),gap20:It.getCSSVar("--gap-20"),gap40:It.getCSSVar("--gap-40"),height44:It.getCSSVar("--height-44"),height32:It.getCSSVar("--height-32"),borderRadius:It.getCSSVar("--border-radius")},cp=()=>Math.random()*16777215,up=()=>`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`,fp=()=>`#${(~~(Math.random()*(1<<24))).toString(16)}`,ya=function(n){return n[0]==="#"&&(n=n.slice(1)),parseInt(n,16)},Hc=function(n){let t="00000"+(n|0).toString(16);return t="#"+t.substring(t.length-6),t},jc=function(n,t=1){const e=n>>16&255,i=n>>8&255,r=n&255,s=t<0?0:t>1?1:t;return s===1?"rgb("+e+","+i+","+r+")":"rgba("+e+","+i+","+r+","+s+")"},Zo=function(n,t=1){const e=ya(n);return jc(e,t)},dp=n=>{const e=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(n);return e?"#"+((1<<24)+(parseInt(e[1])<<16)+(parseInt(e[2])<<8)+parseInt(e[3])).toString(16).slice(1):""};function gp(n,t){let e=parseInt(n.substring(1,3),16),i=parseInt(n.substring(3,5),16),r=parseInt(n.substring(5,7),16);e==0&&(e=32),i==0&&(i=32),r==0&&(r=32),e=e*(100+t)/100,i=i*(100+t)/100,r=r*(100+t)/100,e=e<255?e:255,i=i<255?i:255,r=r<255?r:255,e=Math.round(e),i=Math.round(i),r=Math.round(r);const s=e.toString(16).length==1?"0"+e.toString(16):e.toString(16),a=i.toString(16).length==1?"0"+i.toString(16):i.toString(16),o=r.toString(16).length==1?"0"+r.toString(16):r.toString(16);return"#"+s+a+o}function pp(n,t,e,i){let r,s,a;n=n/360,t=t/100,e=e/100;const o=Math.floor(n*6),h=n*6-o,l=e*(1-t),c=e*(1-h*t),d=e*(1-(1-h)*t);switch(o%6){case 0:r=e,s=d,a=l;break;case 1:r=c,s=e,a=l;break;case 2:r=l,s=e,a=d;break;case 3:r=l,s=c,a=e;break;case 4:r=d,s=l,a=e;break;case 5:default:r=e,s=l,a=c;break}return{r:Math.round(r*255),g:Math.round(s*255),b:Math.round(a*255),a:i??1}}function mp(n,t,e,i){const r=Math.max(n,t,e),s=Math.min(n,t,e),a=r-s,o=r===0?0:a/r,h=r/255;let l;switch(r){case s:l=0;break;case n:l=t-e+a*(t<e?6:0),l/=6*a;break;case t:l=e-n+a*2,l/=6*a;break;case e:default:l=n-t+a*4,l/=6*a;break}return{h:Math.round(l*360),s:Math.round(o*100),v:Math.round(h*100),a:i??1}}function vp(n){return btoa(encodeURIComponent(n)).replaceAll("+","*").replaceAll("/","-").replaceAll("=","")}function _p(n){let t=n.replaceAll("*","+").replaceAll("-","/");const e=t.length%4;return e&&(t=t.padEnd(t.length+(4-e),"=")),decodeURIComponent(atob(t))}function Jo(n=window.location.href){return na(URL)?new URL(n):Xc(n)}function Xc(n=window.location.href){const t="(?<protocol>https?:)",e="(?<host>(?<hostname>[^/#?:]+)(?::(?<port>\\d+))?)",i="(?<pathname>(?:\\/[^/#?]+)*\\/?)",r="(?<search>(?:\\?[^#]*)?)",s="(?<hash>(?:#.*)?)",o=new RegExp(`^${t}//${e}${i}${r}${s}$`).exec(n);return{href:n,protocol:o?.groups?.protocol??"",host:o?.groups?.host??"",hostname:o?.groups?.hostname??"",port:o?.groups?.port??"",pathname:o?.groups?.pathname??"",search:o?.groups?.search??"",hash:o?.groups?.hash??""}}function yp(n){const t=Jo(n);return t.protocol==="http:"||t.protocol==="https:"}function Yc(n=window.location.href){const t=Jo(n),e=t.href.indexOf(t.hash);return t.hash&&e>=0?t.href.substring(0,e):t.href}function wp(n=location.search){n=decodeURIComponent(n).replace(/^[#?&]/,"");const t={};if(!n)return t;const e=/(?:^|&)([^&=]*)=?([^&]*?)(?=&|$)/y;let i=e.exec(n);for(;i;)t[i[1]]=i[2],i=e.exec(n);return t}function bp(n){return Array.from(new URLSearchParams(n)).reduce((t,[e,i])=>Object.assign({},t,{[e]:t[e]?(Array.isArray(t[e])?t[e]:[t[e]]).concat(i):i}),{})}function qc(n){let t="";for(const e in n)t&&(t+="&"),t+=`${e}=${n[e]}`;return t}function xp(n){return new URLSearchParams(n).toString()}function Qo(n){return"?"+[...n.entries()].map(t=>encodeURIComponent(t[0])+"="+encodeURIComponent(t[1]instanceof File?t[1].name:t[1])).join("&")}function wa(n,t){return n.indexOf("?")>=0?n+t.replace(/^\?/,"&"):n.replace(/(?:\?.*)?$/,t.replace(/^[&?]/,"?"))}function Sp(n){let t="";new MutationObserver(function(i){window.location.href!==t&&(t=window.location.href,n&&n(location.href))}).observe(document,{attributes:!0,childList:!0,subtree:!0})}function Cp(n){window.addEventListener("hashchange",()=>{n(location.hash)})}function Tp(n){window.addEventListener("popstate",n,!1)}function kp(n){let t=null;if(pc)try{t=new Worker(URL.createObjectURL(new Blob([n])))}catch(e){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",e),null}return t}var Wc={exports:{}};(function(n){var t={};n.exports=t,t.parse=function(e,i){for(var r=t.bin.readUshort,s=t.bin.readUint,l=0,a={},o=new Uint8Array(e),h=o.length-4;s(o,h)!=101010256;)h--;var l=h;l+=4,l+=4;var c=r(o,l);l+=2,r(o,l),l+=2;var d=s(o,l);l+=4;var f=s(o,l);l+=4,l=f;for(var u=0;u<c;u++){s(o,l),l+=4,l+=4,l+=4,l+=4,s(o,l),l+=4;var d=s(o,l);l+=4;var m=s(o,l);l+=4;var v=r(o,l),b=r(o,l+2),S=r(o,l+4);l+=6,l+=8;var E=s(o,l);l+=4,l+=v+b+S,t._readLocal(o,E,a,d,m,i)}return a},t._readLocal=function(e,i,r,s,a,o){var h=t.bin.readUshort,l=t.bin.readUint;l(e,i),i+=4,h(e,i),i+=2,h(e,i),i+=2;var c=h(e,i);i+=2,l(e,i),i+=4,l(e,i),i+=4,i+=8;var d=h(e,i);i+=2;var f=h(e,i);i+=2;var u=t.bin.readUTF8(e,i,d);if(i+=d,i+=f,o){r[u]={size:a,csize:s};return}var m=new Uint8Array(e.buffer,i);if(c==0)r[u]=new Uint8Array(m.buffer.slice(i,i+s));else if(c==8){var v=new Uint8Array(a);t.inflateRaw(m,v),r[u]=v}else throw"unknown compression method: "+c},t.inflateRaw=function(e,i){return t.F.inflate(e,i)},t.inflate=function(e,i){return e[0],e[1],t.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),i)},t.deflate=function(e,i){i==null&&(i={level:6});var r=0,s=new Uint8Array(50+Math.floor(e.length*1.1));s[r]=120,s[r+1]=156,r+=2,r=t.F.deflateRaw(e,s,r,i.level);var a=t.adler(e,0,e.length);return s[r+0]=a>>>24&255,s[r+1]=a>>>16&255,s[r+2]=a>>>8&255,s[r+3]=a>>>0&255,new Uint8Array(s.buffer,0,r+4)},t.deflateRaw=function(e,i){i==null&&(i={level:6});var r=new Uint8Array(50+Math.floor(e.length*1.1)),s=t.F.deflateRaw(e,r,s,i.level);return new Uint8Array(r.buffer,0,s)},t.encode=function(e,i){i==null&&(i=!1);var r=0,s=t.bin.writeUint,a=t.bin.writeUshort,o={};for(var h in e){var l=!t._noNeed(h)&&!i,c=e[h],d=t.crc.crc(c,0,c.length);o[h]={cpr:l,usize:c.length,crc:d,file:l?t.deflateRaw(c):c}}for(var h in o)r+=o[h].file.length+30+46+2*t.bin.sizeUTF8(h);r+=22;var f=new Uint8Array(r),u=0,m=[];for(var h in o){var v=o[h];m.push(u),u=t._writeHeader(f,u,h,v,0)}var b=0,S=u;for(var h in o){var v=o[h];m.push(u),u=t._writeHeader(f,u,h,v,1,m[b++])}var E=u-S;return s(f,u,101010256),u+=4,u+=4,a(f,u,b),u+=2,a(f,u,b),u+=2,s(f,u,E),u+=4,s(f,u,S),u+=4,u+=2,f.buffer},t._noNeed=function(e){var i=e.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(i)!=-1},t._writeHeader=function(e,i,r,s,a,o){var h=t.bin.writeUint,l=t.bin.writeUshort,c=s.file;h(e,i,a==0?67324752:33639248),i+=4,a==1&&(i+=2),l(e,i,20),i+=2,l(e,i,0),i+=2,l(e,i,s.cpr?8:0),i+=2,h(e,i,0),i+=4,h(e,i,s.crc),i+=4,h(e,i,c.length),i+=4,h(e,i,s.usize),i+=4,l(e,i,t.bin.sizeUTF8(r)),i+=2,l(e,i,0),i+=2,a==1&&(i+=2,i+=2,i+=6,h(e,i,o),i+=4);var d=t.bin.writeUTF8(e,i,r);return i+=d,a==0&&(e.set(c,i),i+=c.length),i},t.crc={table:function(){for(var e=new Uint32Array(256),i=0;i<256;i++){for(var r=i,s=0;s<8;s++)r&1?r=3988292384^r>>>1:r=r>>>1;e[i]=r}return e}(),update:function(e,i,r,s){for(var a=0;a<s;a++)e=t.crc.table[(e^i[r+a])&255]^e>>>8;return e},crc:function(e,i,r){return t.crc.update(4294967295,e,i,r)^4294967295}},t.adler=function(e,i,r){for(var s=1,a=0,o=i,h=i+r;o<h;){for(var l=Math.min(o+5552,h);o<l;)s+=e[o++],a+=s;s=s%65521,a=a%65521}return a<<16|s},t.bin={readUshort:function(e,i){return e[i]|e[i+1]<<8},writeUshort:function(e,i,r){e[i]=r&255,e[i+1]=r>>8&255},readUint:function(e,i){return e[i+3]*(256*256*256)+(e[i+2]<<16|e[i+1]<<8|e[i])},writeUint:function(e,i,r){e[i]=r&255,e[i+1]=r>>8&255,e[i+2]=r>>16&255,e[i+3]=r>>24&255},readASCII:function(e,i,r){for(var s="",a=0;a<r;a++)s+=String.fromCharCode(e[i+a]);return s},writeASCII:function(e,i,r){for(var s=0;s<r.length;s++)e[i+s]=r.charCodeAt(s)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,i,r){for(var s="",a,o=0;o<r;o++)s+="%"+t.bin.pad(e[i+o].toString(16));try{a=decodeURIComponent(s)}catch{return t.bin.readASCII(e,i,r)}return a},writeUTF8:function(e,i,r){for(var s=r.length,a=0,o=0;o<s;o++){var h=r.charCodeAt(o);if(!(h&4294967295-128+1))e[i+a]=h,a++;else if(!(h&4294967295-2048+1))e[i+a]=192|h>>6,e[i+a+1]=128|h>>0&63,a+=2;else if(!(h&4294967295-65536+1))e[i+a]=224|h>>12,e[i+a+1]=128|h>>6&63,e[i+a+2]=128|h>>0&63,a+=3;else if(!(h&4294967295-(1<<21)+1))e[i+a]=240|h>>18,e[i+a+1]=128|h>>12&63,e[i+a+2]=128|h>>6&63,e[i+a+3]=128|h>>0&63,a+=4;else throw"e"}return a},sizeUTF8:function(e){for(var i=e.length,r=0,s=0;s<i;s++){var a=e.charCodeAt(s);if(!(a&4294967295-128+1))r++;else if(!(a&4294967295-2048+1))r+=2;else if(!(a&4294967295-65536+1))r+=3;else if(!(a&4294967295-(1<<21)+1))r+=4;else throw"e"}return r}},t.F={},t.F.deflateRaw=function(e,i,r,s){var a=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]],o=a[s],h=t.F.U,l=t.F._goodIndex;t.F._hash;var c=t.F._putsE,d=0,f=r<<3,u=0,m=e.length;if(s==0){for(;d<m;){var v=Math.min(65535,m-d);c(i,f,d+v==m?1:0),f=t.F._copyExact(e,d,v,i,f+8),d+=v}return f>>>3}var b=h.lits,S=h.strt,E=h.prev,_=0,x=0,P=0,R=0,F=0,L=0;for(m>2&&(L=t.F._hash(e,0),S[L]=0),d=0;d<m;d++){if(F=L,d+1<m-2){L=t.F._hash(e,d+1);var $=d+1&32767;E[$]=S[L],S[L]=$}if(u<=d){(_>14e3||x>26697)&&m-d>100&&(u<d&&(b[_]=d-u,_+=2,u=d),f=t.F._writeBlock(d==m-1||u==m?1:0,b,_,R,e,P,d-P,i,f),_=x=R=0,P=d);var U=0;d<m-2&&(U=t.F._bestMatch(e,d,E,F,Math.min(o[2],m-d),o[3]));var v=U>>>16,z=U&65535;if(U!=0){var v=U>>>16,z=U&65535,q=l(v,h.of0);h.lhst[257+q]++;var K=l(z,h.df0);h.dhst[K]++,R+=h.exb[q]+h.dxb[K],b[_]=v<<23|d-u,b[_+1]=z<<16|q<<8|K,_+=2,u=d+v}else h.lhst[e[d]]++;x++}}for((P!=d||e.length==0)&&(u<d&&(b[_]=d-u,_+=2,u=d),f=t.F._writeBlock(1,b,_,R,e,P,d-P,i,f),_=0,x=0,_=x=R=0,P=d);f&7;)f++;return f>>>3},t.F._bestMatch=function(e,i,r,s,a,o){var h=i&32767,l=r[h],c=h-l+32768&32767;if(l==h||s!=t.F._hash(e,i-c))return 0;for(var d=0,f=0,u=Math.min(32767,i);c<=u&&--o!=0&&l!=h;){if(d==0||e[i+d]==e[i+d-c]){var m=t.F._howLong(e,i,c);if(m>d){if(d=m,f=c,d>=a)break;c+2<m&&(m=c+2);for(var v=0,b=0;b<m-2;b++){var S=i-c+b+32768&32767,E=r[S],_=S-E+32768&32767;_>v&&(v=_,l=S)}}}h=l,l=r[h],c+=h-l+32768&32767}return d<<16|f},t.F._howLong=function(e,i,r){if(e[i]!=e[i-r]||e[i+1]!=e[i+1-r]||e[i+2]!=e[i+2-r])return 0;var s=i,a=Math.min(e.length,i+258);for(i+=3;i<a&&e[i]==e[i-r];)i++;return i-s},t.F._hash=function(e,i){return(e[i]<<8|e[i+1])+(e[i+2]<<4)&65535},t.saved=0,t.F._writeBlock=function(e,i,r,s,a,o,h,l,c){var d=t.F.U,f=t.F._putsF,u=t.F._putsE,m,v,b,S,E,_,x,P,R;d.lhst[256]++,m=t.F.getTrees(),v=m[0],b=m[1],S=m[2],E=m[3],_=m[4],x=m[5],P=m[6],R=m[7];var F=(c+3&7?8-(c+3&7):0)+32+(h<<3),L=s+t.F.contSize(d.fltree,d.lhst)+t.F.contSize(d.fdtree,d.dhst),$=s+t.F.contSize(d.ltree,d.lhst)+t.F.contSize(d.dtree,d.dhst);$+=14+3*x+t.F.contSize(d.itree,d.ihst)+(d.ihst[16]*2+d.ihst[17]*3+d.ihst[18]*7);for(var U=0;U<286;U++)d.lhst[U]=0;for(var U=0;U<30;U++)d.dhst[U]=0;for(var U=0;U<19;U++)d.ihst[U]=0;var z=F<L&&F<$?0:L<$?1:2;if(f(l,c,e),f(l,c+1,z),c+=3,z==0){for(;c&7;)c++;c=t.F._copyExact(a,o,h,l,c)}else{var q,K;if(z==1&&(q=d.fltree,K=d.fdtree),z==2){t.F.makeCodes(d.ltree,v),t.F.revCodes(d.ltree,v),t.F.makeCodes(d.dtree,b),t.F.revCodes(d.dtree,b),t.F.makeCodes(d.itree,S),t.F.revCodes(d.itree,S),q=d.ltree,K=d.dtree,u(l,c,E-257),c+=5,u(l,c,_-1),c+=5,u(l,c,x-4),c+=4;for(var Z=0;Z<x;Z++)u(l,c+Z*3,d.itree[(d.ordr[Z]<<1)+1]);c+=3*x,c=t.F._codeTiny(P,d.itree,l,c),c=t.F._codeTiny(R,d.itree,l,c)}for(var at=o,vt=0;vt<r;vt+=2){for(var _t=i[vt],pt=_t>>>23,nt=at+(_t&(1<<23)-1);at<nt;)c=t.F._writeLit(a[at++],q,l,c);if(pt!=0){var J=i[vt+1],I=J>>16,D=J>>8&255,A=J&255;c=t.F._writeLit(257+D,q,l,c),u(l,c,pt-d.of0[D]),c+=d.exb[D],c=t.F._writeLit(A,K,l,c),f(l,c,I-d.df0[A]),c+=d.dxb[A],at+=pt}}c=t.F._writeLit(256,q,l,c)}return c},t.F._copyExact=function(e,i,r,s,a){var o=a>>>3;return s[o]=r,s[o+1]=r>>>8,s[o+2]=255-s[o],s[o+3]=255-s[o+1],o+=4,s.set(new Uint8Array(e.buffer,i,r),o),a+(r+4<<3)},t.F.getTrees=function(){for(var e=t.F.U,i=t.F._hufTree(e.lhst,e.ltree,15),r=t.F._hufTree(e.dhst,e.dtree,15),s=[],a=t.F._lenCodes(e.ltree,s),o=[],h=t.F._lenCodes(e.dtree,o),l=0;l<s.length;l+=2)e.ihst[s[l]]++;for(var l=0;l<o.length;l+=2)e.ihst[o[l]]++;for(var c=t.F._hufTree(e.ihst,e.itree,7),d=19;d>4&&e.itree[(e.ordr[d-1]<<1)+1]==0;)d--;return[i,r,c,a,h,d,s,o]},t.F.getSecond=function(e){for(var i=[],r=0;r<e.length;r+=2)i.push(e[r+1]);return i},t.F.nonZero=function(e){for(var i="",r=0;r<e.length;r+=2)e[r+1]!=0&&(i+=(r>>1)+",");return i},t.F.contSize=function(e,i){for(var r=0,s=0;s<i.length;s++)r+=i[s]*e[(s<<1)+1];return r},t.F._codeTiny=function(e,i,r,s){for(var a=0;a<e.length;a+=2){var o=e[a],h=e[a+1];s=t.F._writeLit(o,i,r,s);var l=o==16?2:o==17?3:7;o>15&&(t.F._putsE(r,s,h,l),s+=l)}return s},t.F._lenCodes=function(e,i){for(var r=e.length;r!=2&&e[r-1]==0;)r-=2;for(var s=0;s<r;s+=2){var a=e[s+1],o=s+3<r?e[s+3]:-1,h=s+5<r?e[s+5]:-1,l=s==0?-1:e[s-1];if(a==0&&o==a&&h==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,138);d<11?i.push(17,d-3):i.push(18,d-11),s+=d*2-2}else if(a==l&&o==a&&h==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,6);i.push(16,d-3),s+=d*2-2}else i.push(a,0)}return r>>>1},t.F._hufTree=function(e,i,r){var s=[],a=e.length,o=i.length,h=0;for(h=0;h<o;h+=2)i[h]=0,i[h+1]=0;for(h=0;h<a;h++)e[h]!=0&&s.push({lit:h,f:e[h]});var l=s.length,c=s.slice(0);if(l==0)return 0;if(l==1){var d=s[0].lit,c=d==0?1:0;return i[(d<<1)+1]=1,i[(c<<1)+1]=1,1}s.sort(function(E,_){return E.f-_.f});var f=s[0],u=s[1],m=0,v=1,b=2;for(s[0]={lit:-1,f:f.f+u.f,l:f,r:u,d:0};v!=l-1;)m!=v&&(b==l||s[m].f<s[b].f)?f=s[m++]:f=s[b++],m!=v&&(b==l||s[m].f<s[b].f)?u=s[m++]:u=s[b++],s[v++]={lit:-1,f:f.f+u.f,l:f,r:u};var S=t.F.setDepth(s[v-1],0);for(S>r&&(t.F.restrictDepth(c,r,S),S=r),h=0;h<l;h++)i[(c[h].lit<<1)+1]=c[h].d;return S},t.F.setDepth=function(e,i){return e.lit!=-1?(e.d=i,i):Math.max(t.F.setDepth(e.l,i+1),t.F.setDepth(e.r,i+1))},t.F.restrictDepth=function(e,i,r){var s=0,a=1<<r-i,o=0;for(e.sort(function(l,c){return c.d==l.d?l.f-c.f:c.d-l.d}),s=0;s<e.length&&e[s].d>i;s++){var h=e[s].d;e[s].d=i,o+=a-(1<<r-h)}for(o=o>>>r-i;o>0;){var h=e[s].d;h<i?(e[s].d++,o-=1<<i-h-1):s++}for(;s>=0;s--)e[s].d==i&&o<0&&(e[s].d--,o++);o!=0&&console.log("debt left")},t.F._goodIndex=function(e,i){var r=0;return i[r|16]<=e&&(r|=16),i[r|8]<=e&&(r|=8),i[r|4]<=e&&(r|=4),i[r|2]<=e&&(r|=2),i[r|1]<=e&&(r|=1),r},t.F._writeLit=function(e,i,r,s){return t.F._putsF(r,s,i[e<<1]),s+i[(e<<1)+1]},t.F.inflate=function(e,i){var r=Uint8Array;if(e[0]==3&&e[1]==0)return i||new r(0);var s=t.F,a=s._bitsF,o=s._bitsE,h=s._decodeTiny,l=s.makeCodes,c=s.codes2map,d=s._get17,f=s.U,u=i==null;u&&(i=new r(e.length>>>2<<3));for(var m=0,v=0,b=0,S=0,E=0,_=0,x=0,P=0,R=0,F,L;m==0;){if(m=a(e,R,1),v=a(e,R+1,2),R+=3,v==0){R&7&&(R+=8-(R&7));var $=(R>>>3)+4,U=e[$-4]|e[$-3]<<8;u&&(i=t.F._check(i,P+U)),i.set(new r(e.buffer,e.byteOffset+$,U),P),R=$+U<<3,P+=U;continue}if(u&&(i=t.F._check(i,P+(1<<17))),v==1&&(F=f.flmap,L=f.fdmap,_=512-1,x=32-1),v==2){b=o(e,R,5)+257,S=o(e,R+5,5)+1,E=o(e,R+10,4)+4,R+=14;for(var z=0;z<38;z+=2)f.itree[z]=0,f.itree[z+1]=0;for(var q=1,z=0;z<E;z++){var K=o(e,R+z*3,3);f.itree[(f.ordr[z]<<1)+1]=K,K>q&&(q=K)}R+=3*E,l(f.itree,q),c(f.itree,q,f.imap),F=f.lmap,L=f.dmap,R=h(f.imap,(1<<q)-1,b+S,e,R,f.ttree);var Z=s._copyOut(f.ttree,0,b,f.ltree);_=(1<<Z)-1;var at=s._copyOut(f.ttree,b,S,f.dtree);x=(1<<at)-1,l(f.ltree,Z),c(f.ltree,Z,F),l(f.dtree,at),c(f.dtree,at,L)}for(;;){var vt=F[d(e,R)&_];R+=vt&15;var _t=vt>>>4;if(!(_t>>>8))i[P++]=_t;else{if(_t==256)break;var pt=P+_t-254;if(_t>264){var nt=f.ldef[_t-257];pt=P+(nt>>>3)+o(e,R,nt&7),R+=nt&7}var J=L[d(e,R)&x];R+=J&15;var I=J>>>4,D=f.ddef[I],A=(D>>>4)+a(e,R,D&15);for(R+=D&15,u&&(i=t.F._check(i,P+(1<<17)));P<pt;)i[P]=i[P++-A],i[P]=i[P++-A],i[P]=i[P++-A],i[P]=i[P++-A];P=pt}}}return i.length==P?i:i.slice(0,P)},t.F._check=function(e,i){var r=e.length;if(i<=r)return e;var s=new Uint8Array(Math.max(r<<1,i));return s.set(e,0),s},t.F._decodeTiny=function(e,i,r,s,a,o){for(var h=t.F._bitsE,l=t.F._get17,c=0;c<r;){var d=e[l(s,a)&i];a+=d&15;var f=d>>>4;if(f<=15)o[c]=f,c++;else{var u=0,m=0;f==16?(m=3+h(s,a,2),a+=2,u=o[c-1]):f==17?(m=3+h(s,a,3),a+=3):f==18&&(m=11+h(s,a,7),a+=7);for(var v=c+m;c<v;)o[c]=u,c++}}return a},t.F._copyOut=function(e,i,r,s){for(var a=0,o=0,h=s.length>>>1;o<r;){var l=e[o+i];s[o<<1]=0,s[(o<<1)+1]=l,l>a&&(a=l),o++}for(;o<h;)s[o<<1]=0,s[(o<<1)+1]=0,o++;return a},t.F.makeCodes=function(e,i){for(var r=t.F.U,s=e.length,a,o,h,l,c,d=r.bl_count,l=0;l<=i;l++)d[l]=0;for(l=1;l<s;l+=2)d[e[l]]++;var f=r.next_code;for(a=0,d[0]=0,o=1;o<=i;o++)a=a+d[o-1]<<1,f[o]=a;for(h=0;h<s;h+=2)c=e[h+1],c!=0&&(e[h]=f[c],f[c]++)},t.F.codes2map=function(e,i,r){for(var s=e.length,a=t.F.U,o=a.rev15,h=0;h<s;h+=2)if(e[h+1]!=0)for(var l=h>>1,c=e[h+1],d=l<<4|c,f=i-c,u=e[h]<<f,m=u+(1<<f);u!=m;){var v=o[u]>>>15-i;r[v]=d,u++}},t.F.revCodes=function(e,i){for(var r=t.F.U.rev15,s=15-i,a=0;a<e.length;a+=2){var o=e[a]<<i-e[a+1];e[a]=r[o]>>>s}},t.F._putsE=function(e,i,r){r=r<<(i&7);var s=i>>>3;e[s]|=r,e[s+1]|=r>>>8},t.F._putsF=function(e,i,r){r=r<<(i&7);var s=i>>>3;e[s]|=r,e[s+1]|=r>>>8,e[s+2]|=r>>>16},t.F._bitsE=function(e,i,r){return(e[i>>>3]|e[(i>>>3)+1]<<8)>>>(i&7)&(1<<r)-1},t.F._bitsF=function(e,i,r){return(e[i>>>3]|e[(i>>>3)+1]<<8|e[(i>>>3)+2]<<16)>>>(i&7)&(1<<r)-1},t.F._get17=function(e,i){return(e[i>>>3]|e[(i>>>3)+1]<<8|e[(i>>>3)+2]<<16)>>>(i&7)},t.F._get25=function(e,i){return(e[i>>>3]|e[(i>>>3)+1]<<8|e[(i>>>3)+2]<<16|e[(i>>>3)+3]<<24)>>>(i&7)},t.F.U=function(){var e=Uint16Array,i=Uint32Array;return{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new i(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new i(286),dhst:new i(30),ihst:new i(19),lits:new i(15e3),strt:new e(65536),prev:new e(32768)}}(),function(){for(var e=t.F.U,i=32768,r=0;r<i;r++){var s=r;s=(s&2863311530)>>>1|(s&1431655765)<<1,s=(s&3435973836)>>>2|(s&858993459)<<2,s=(s&4042322160)>>>4|(s&252645135)<<4,s=(s&4278255360)>>>8|(s&16711935)<<8,e.rev15[r]=(s>>>16|s<<16)>>>17}function a(o,h,l){for(;h--!=0;)o.push(0,l)}for(var r=0;r<32;r++)e.ldef[r]=e.of0[r]<<3|e.exb[r],e.ddef[r]=e.df0[r]<<4|e.dxb[r];a(e.fltree,144,8),a(e.fltree,255-143,9),a(e.fltree,279-255,7),a(e.fltree,287-279,8),t.F.makeCodes(e.fltree,9),t.F.codes2map(e.fltree,9,e.flmap),t.F.revCodes(e.fltree,9),a(e.fdtree,32,5),t.F.makeCodes(e.fdtree,5),t.F.codes2map(e.fdtree,5,e.fdmap),t.F.revCodes(e.fdtree,5),a(e.itree,19,0),a(e.ltree,286,0),a(e.dtree,30,0),a(e.ttree,320,0)}()})(Wc);var Ep=Wc.exports;const Kc=Pe(Ep);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Pp=4,Zc=0,Jc=1,Ap=2;function Yn(n){let t=n.length;for(;--t>=0;)n[t]=0}const Mp=0,Qc=1,Rp=2,Dp=3,Lp=258,th=29,Or=256,Fr=Or+1+th,qn=30,eh=19,tu=2*Fr+1,vn=15,ih=16,Ip=7,nh=256,eu=16,iu=17,nu=18,rh=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ba=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Op=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ru=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fp=512,_i=new Array((Fr+2)*2);Yn(_i);const Nr=new Array(qn*2);Yn(Nr);const Gr=new Array(Fp);Yn(Gr);const Ur=new Array(Lp-Dp+1);Yn(Ur);const sh=new Array(th);Yn(sh);const xa=new Array(qn);Yn(xa);function ah(n,t,e,i,r){this.static_tree=n,this.extra_bits=t,this.extra_base=e,this.elems=i,this.max_length=r,this.has_stree=n&&n.length}let su,au,ou;function oh(n,t){this.dyn_tree=n,this.max_code=0,this.stat_desc=t}const hu=n=>n<256?Gr[n]:Gr[256+(n>>>7)],Br=(n,t)=>{n.pending_buf[n.pending++]=t&255,n.pending_buf[n.pending++]=t>>>8&255},Ae=(n,t,e)=>{n.bi_valid>ih-e?(n.bi_buf|=t<<n.bi_valid&65535,Br(n,n.bi_buf),n.bi_buf=t>>ih-n.bi_valid,n.bi_valid+=e-ih):(n.bi_buf|=t<<n.bi_valid&65535,n.bi_valid+=e)},ii=(n,t,e)=>{Ae(n,e[t*2],e[t*2+1])},lu=(n,t)=>{let e=0;do e|=n&1,n>>>=1,e<<=1;while(--t>0);return e>>>1},Np=n=>{n.bi_valid===16?(Br(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=n.bi_buf&255,n.bi_buf>>=8,n.bi_valid-=8)},Gp=(n,t)=>{const e=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,h=t.stat_desc.max_length;let l,c,d,f,u,m,v=0;for(f=0;f<=vn;f++)n.bl_count[f]=0;for(e[n.heap[n.heap_max]*2+1]=0,l=n.heap_max+1;l<tu;l++)c=n.heap[l],f=e[e[c*2+1]*2+1]+1,f>h&&(f=h,v++),e[c*2+1]=f,!(c>i)&&(n.bl_count[f]++,u=0,c>=o&&(u=a[c-o]),m=e[c*2],n.opt_len+=m*(f+u),s&&(n.static_len+=m*(r[c*2+1]+u)));if(v!==0){do{for(f=h-1;n.bl_count[f]===0;)f--;n.bl_count[f]--,n.bl_count[f+1]+=2,n.bl_count[h]--,v-=2}while(v>0);for(f=h;f!==0;f--)for(c=n.bl_count[f];c!==0;)d=n.heap[--l],!(d>i)&&(e[d*2+1]!==f&&(n.opt_len+=(f-e[d*2+1])*e[d*2],e[d*2+1]=f),c--)}},cu=(n,t,e)=>{const i=new Array(vn+1);let r=0,s,a;for(s=1;s<=vn;s++)r=r+e[s-1]<<1,i[s]=r;for(a=0;a<=t;a++){let o=n[a*2+1];o!==0&&(n[a*2]=lu(i[o]++,o))}},Up=()=>{let n,t,e,i,r;const s=new Array(vn+1);for(e=0,i=0;i<th-1;i++)for(sh[i]=e,n=0;n<1<<rh[i];n++)Ur[e++]=i;for(Ur[e-1]=i,r=0,i=0;i<16;i++)for(xa[i]=r,n=0;n<1<<ba[i];n++)Gr[r++]=i;for(r>>=7;i<qn;i++)for(xa[i]=r<<7,n=0;n<1<<ba[i]-7;n++)Gr[256+r++]=i;for(t=0;t<=vn;t++)s[t]=0;for(n=0;n<=143;)_i[n*2+1]=8,n++,s[8]++;for(;n<=255;)_i[n*2+1]=9,n++,s[9]++;for(;n<=279;)_i[n*2+1]=7,n++,s[7]++;for(;n<=287;)_i[n*2+1]=8,n++,s[8]++;for(cu(_i,Fr+1,s),n=0;n<qn;n++)Nr[n*2+1]=5,Nr[n*2]=lu(n,5);su=new ah(_i,rh,Or+1,Fr,vn),au=new ah(Nr,ba,0,qn,vn),ou=new ah(new Array(0),Op,0,eh,Ip)},uu=n=>{let t;for(t=0;t<Fr;t++)n.dyn_ltree[t*2]=0;for(t=0;t<qn;t++)n.dyn_dtree[t*2]=0;for(t=0;t<eh;t++)n.bl_tree[t*2]=0;n.dyn_ltree[nh*2]=1,n.opt_len=n.static_len=0,n.sym_next=n.matches=0},fu=n=>{n.bi_valid>8?Br(n,n.bi_buf):n.bi_valid>0&&(n.pending_buf[n.pending++]=n.bi_buf),n.bi_buf=0,n.bi_valid=0},du=(n,t,e,i)=>{const r=t*2,s=e*2;return n[r]<n[s]||n[r]===n[s]&&i[t]<=i[e]},hh=(n,t,e)=>{const i=n.heap[e];let r=e<<1;for(;r<=n.heap_len&&(r<n.heap_len&&du(t,n.heap[r+1],n.heap[r],n.depth)&&r++,!du(t,i,n.heap[r],n.depth));)n.heap[e]=n.heap[r],e=r,r<<=1;n.heap[e]=i},gu=(n,t,e)=>{let i,r,s=0,a,o;if(n.sym_next!==0)do i=n.pending_buf[n.sym_buf+s++]&255,i+=(n.pending_buf[n.sym_buf+s++]&255)<<8,r=n.pending_buf[n.sym_buf+s++],i===0?ii(n,r,t):(a=Ur[r],ii(n,a+Or+1,t),o=rh[a],o!==0&&(r-=sh[a],Ae(n,r,o)),i--,a=hu(i),ii(n,a,e),o=ba[a],o!==0&&(i-=xa[a],Ae(n,i,o)));while(s<n.sym_next);ii(n,nh,t)},lh=(n,t)=>{const e=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,h=-1,l;for(n.heap_len=0,n.heap_max=tu,a=0;a<s;a++)e[a*2]!==0?(n.heap[++n.heap_len]=h=a,n.depth[a]=0):e[a*2+1]=0;for(;n.heap_len<2;)l=n.heap[++n.heap_len]=h<2?++h:0,e[l*2]=1,n.depth[l]=0,n.opt_len--,r&&(n.static_len-=i[l*2+1]);for(t.max_code=h,a=n.heap_len>>1;a>=1;a--)hh(n,e,a);l=s;do a=n.heap[1],n.heap[1]=n.heap[n.heap_len--],hh(n,e,1),o=n.heap[1],n.heap[--n.heap_max]=a,n.heap[--n.heap_max]=o,e[l*2]=e[a*2]+e[o*2],n.depth[l]=(n.depth[a]>=n.depth[o]?n.depth[a]:n.depth[o])+1,e[a*2+1]=e[o*2+1]=l,n.heap[1]=l++,hh(n,e,1);while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],Gp(n,t),cu(e,h,n.bl_count)},pu=(n,t,e)=>{let i,r=-1,s,a=t[0*2+1],o=0,h=7,l=4;for(a===0&&(h=138,l=3),t[(e+1)*2+1]=65535,i=0;i<=e;i++)s=a,a=t[(i+1)*2+1],!(++o<h&&s===a)&&(o<l?n.bl_tree[s*2]+=o:s!==0?(s!==r&&n.bl_tree[s*2]++,n.bl_tree[eu*2]++):o<=10?n.bl_tree[iu*2]++:n.bl_tree[nu*2]++,o=0,r=s,a===0?(h=138,l=3):s===a?(h=6,l=3):(h=7,l=4))},mu=(n,t,e)=>{let i,r=-1,s,a=t[0*2+1],o=0,h=7,l=4;for(a===0&&(h=138,l=3),i=0;i<=e;i++)if(s=a,a=t[(i+1)*2+1],!(++o<h&&s===a)){if(o<l)do ii(n,s,n.bl_tree);while(--o!==0);else s!==0?(s!==r&&(ii(n,s,n.bl_tree),o--),ii(n,eu,n.bl_tree),Ae(n,o-3,2)):o<=10?(ii(n,iu,n.bl_tree),Ae(n,o-3,3)):(ii(n,nu,n.bl_tree),Ae(n,o-11,7));o=0,r=s,a===0?(h=138,l=3):s===a?(h=6,l=3):(h=7,l=4)}},Bp=n=>{let t;for(pu(n,n.dyn_ltree,n.l_desc.max_code),pu(n,n.dyn_dtree,n.d_desc.max_code),lh(n,n.bl_desc),t=eh-1;t>=3&&n.bl_tree[ru[t]*2+1]===0;t--);return n.opt_len+=3*(t+1)+5+5+4,t},zp=(n,t,e,i)=>{let r;for(Ae(n,t-257,5),Ae(n,e-1,5),Ae(n,i-4,4),r=0;r<i;r++)Ae(n,n.bl_tree[ru[r]*2+1],3);mu(n,n.dyn_ltree,t-1),mu(n,n.dyn_dtree,e-1)},$p=n=>{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&n.dyn_ltree[e*2]!==0)return Zc;if(n.dyn_ltree[9*2]!==0||n.dyn_ltree[10*2]!==0||n.dyn_ltree[13*2]!==0)return Jc;for(e=32;e<Or;e++)if(n.dyn_ltree[e*2]!==0)return Jc;return Zc};let vu=!1;const Vp=n=>{vu||(Up(),vu=!0),n.l_desc=new oh(n.dyn_ltree,su),n.d_desc=new oh(n.dyn_dtree,au),n.bl_desc=new oh(n.bl_tree,ou),n.bi_buf=0,n.bi_valid=0,uu(n)},_u=(n,t,e,i)=>{Ae(n,(Mp<<1)+(i?1:0),3),fu(n),Br(n,e),Br(n,~e),e&&n.pending_buf.set(n.window.subarray(t,t+e),n.pending),n.pending+=e},Hp=n=>{Ae(n,Qc<<1,3),ii(n,nh,_i),Np(n)},jp=(n,t,e,i)=>{let r,s,a=0;n.level>0?(n.strm.data_type===Ap&&(n.strm.data_type=$p(n)),lh(n,n.l_desc),lh(n,n.d_desc),a=Bp(n),r=n.opt_len+3+7>>>3,s=n.static_len+3+7>>>3,s<=r&&(r=s)):r=s=e+5,e+4<=r&&t!==-1?_u(n,t,e,i):n.strategy===Pp||s===r?(Ae(n,(Qc<<1)+(i?1:0),3),gu(n,_i,Nr)):(Ae(n,(Rp<<1)+(i?1:0),3),zp(n,n.l_desc.max_code+1,n.d_desc.max_code+1,a+1),gu(n,n.dyn_ltree,n.dyn_dtree)),uu(n),i&&fu(n)},Xp=(n,t,e)=>(n.pending_buf[n.sym_buf+n.sym_next++]=t,n.pending_buf[n.sym_buf+n.sym_next++]=t>>8,n.pending_buf[n.sym_buf+n.sym_next++]=e,t===0?n.dyn_ltree[e*2]++:(n.matches++,t--,n.dyn_ltree[(Ur[e]+Or+1)*2]++,n.dyn_dtree[hu(t)*2]++),n.sym_next===n.sym_end);var Yp=Vp,qp=_u,Wp=jp,Kp=Xp,Zp=Hp,Jp={_tr_init:Yp,_tr_stored_block:qp,_tr_flush_block:Wp,_tr_tally:Kp,_tr_align:Zp},zr=(n,t,e,i)=>{let r=n&65535|0,s=n>>>16&65535|0,a=0;for(;e!==0;){a=e>2e3?2e3:e,e-=a;do r=r+t[i++]|0,s=s+r|0;while(--a);r%=65521,s%=65521}return r|s<<16|0};const Qp=()=>{let n,t=[];for(var e=0;e<256;e++){n=e;for(var i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;t[e]=n}return t},t2=new Uint32Array(Qp());var ge=(n,t,e,i)=>{const r=t2,s=i+e;n^=-1;for(let a=i;a<s;a++)n=n>>>8^r[(n^t[a])&255];return n^-1},_n={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},yn={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:e2,_tr_stored_block:ch,_tr_flush_block:i2,_tr_tally:Hi,_tr_align:n2}=Jp,{Z_NO_FLUSH:ji,Z_PARTIAL_FLUSH:r2,Z_FULL_FLUSH:s2,Z_FINISH:Ve,Z_BLOCK:yu,Z_OK:_e,Z_STREAM_END:wu,Z_STREAM_ERROR:ni,Z_DATA_ERROR:a2,Z_BUF_ERROR:uh,Z_DEFAULT_COMPRESSION:o2,Z_FILTERED:h2,Z_HUFFMAN_ONLY:Sa,Z_RLE:l2,Z_FIXED:c2,Z_DEFAULT_STRATEGY:u2,Z_UNKNOWN:f2,Z_DEFLATED:Ca}=yn,d2=9,g2=15,p2=8,m2=29,fh=256+1+m2,v2=30,_2=19,y2=2*fh+1,w2=15,Bt=3,Xi=258,ri=Xi+Bt+1,b2=32,Wn=42,dh=57,gh=69,ph=73,mh=91,vh=103,wn=113,$r=666,ke=1,Kn=2,bn=3,Zn=4,x2=3,xn=(n,t)=>(n.msg=_n[t],t),bu=n=>n*2-(n>4?9:0),Yi=n=>{let t=n.length;for(;--t>=0;)n[t]=0},S2=n=>{let t,e,i,r=n.w_size;t=n.hash_size,i=t;do e=n.head[--i],n.head[i]=e>=r?e-r:0;while(--t);t=r,i=t;do e=n.prev[--i],n.prev[i]=e>=r?e-r:0;while(--t)};let qi=(n,t,e)=>(t<<n.hash_shift^e)&n.hash_mask;const Oe=n=>{const t=n.state;let e=t.pending;e>n.avail_out&&(e=n.avail_out),e!==0&&(n.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),n.next_out),n.next_out+=e,t.pending_out+=e,n.total_out+=e,n.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Fe=(n,t)=>{i2(n,n.block_start>=0?n.block_start:-1,n.strstart-n.block_start,t),n.block_start=n.strstart,Oe(n.strm)},jt=(n,t)=>{n.pending_buf[n.pending++]=t},Vr=(n,t)=>{n.pending_buf[n.pending++]=t>>>8&255,n.pending_buf[n.pending++]=t&255},_h=(n,t,e,i)=>{let r=n.avail_in;return r>i&&(r=i),r===0?0:(n.avail_in-=r,t.set(n.input.subarray(n.next_in,n.next_in+r),e),n.state.wrap===1?n.adler=zr(n.adler,t,r,e):n.state.wrap===2&&(n.adler=ge(n.adler,t,r,e)),n.next_in+=r,n.total_in+=r,r)},xu=(n,t)=>{let e=n.max_chain_length,i=n.strstart,r,s,a=n.prev_length,o=n.nice_match;const h=n.strstart>n.w_size-ri?n.strstart-(n.w_size-ri):0,l=n.window,c=n.w_mask,d=n.prev,f=n.strstart+Xi;let u=l[i+a-1],m=l[i+a];n.prev_length>=n.good_match&&(e>>=2),o>n.lookahead&&(o=n.lookahead);do if(r=t,!(l[r+a]!==m||l[r+a-1]!==u||l[r]!==l[i]||l[++r]!==l[i+1])){i+=2,r++;do;while(l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&i<f);if(s=Xi-(f-i),i=f-Xi,s>a){if(n.match_start=t,a=s,s>=o)break;u=l[i+a-1],m=l[i+a]}}while((t=d[t&c])>h&&--e!==0);return a<=n.lookahead?a:n.lookahead},Jn=n=>{const t=n.w_size;let e,i,r;do{if(i=n.window_size-n.lookahead-n.strstart,n.strstart>=t+(t-ri)&&(n.window.set(n.window.subarray(t,t+t-i),0),n.match_start-=t,n.strstart-=t,n.block_start-=t,n.insert>n.strstart&&(n.insert=n.strstart),S2(n),i+=t),n.strm.avail_in===0)break;if(e=_h(n.strm,n.window,n.strstart+n.lookahead,i),n.lookahead+=e,n.lookahead+n.insert>=Bt)for(r=n.strstart-n.insert,n.ins_h=n.window[r],n.ins_h=qi(n,n.ins_h,n.window[r+1]);n.insert&&(n.ins_h=qi(n,n.ins_h,n.window[r+Bt-1]),n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,n.insert--,!(n.lookahead+n.insert<Bt)););}while(n.lookahead<ri&&n.strm.avail_in!==0)},Su=(n,t)=>{let e=n.pending_buf_size-5>n.w_size?n.w_size:n.pending_buf_size-5,i,r,s,a=0,o=n.strm.avail_in;do{if(i=65535,s=n.bi_valid+42>>3,n.strm.avail_out<s||(s=n.strm.avail_out-s,r=n.strstart-n.block_start,i>r+n.strm.avail_in&&(i=r+n.strm.avail_in),i>s&&(i=s),i<e&&(i===0&&t!==Ve||t===ji||i!==r+n.strm.avail_in)))break;a=t===Ve&&i===r+n.strm.avail_in?1:0,ch(n,0,0,a),n.pending_buf[n.pending-4]=i,n.pending_buf[n.pending-3]=i>>8,n.pending_buf[n.pending-2]=~i,n.pending_buf[n.pending-1]=~i>>8,Oe(n.strm),r&&(r>i&&(r=i),n.strm.output.set(n.window.subarray(n.block_start,n.block_start+r),n.strm.next_out),n.strm.next_out+=r,n.strm.avail_out-=r,n.strm.total_out+=r,n.block_start+=r,i-=r),i&&(_h(n.strm,n.strm.output,n.strm.next_out,i),n.strm.next_out+=i,n.strm.avail_out-=i,n.strm.total_out+=i)}while(a===0);return o-=n.strm.avail_in,o&&(o>=n.w_size?(n.matches=2,n.window.set(n.strm.input.subarray(n.strm.next_in-n.w_size,n.strm.next_in),0),n.strstart=n.w_size,n.insert=n.strstart):(n.window_size-n.strstart<=o&&(n.strstart-=n.w_size,n.window.set(n.window.subarray(n.w_size,n.w_size+n.strstart),0),n.matches<2&&n.matches++,n.insert>n.strstart&&(n.insert=n.strstart)),n.window.set(n.strm.input.subarray(n.strm.next_in-o,n.strm.next_in),n.strstart),n.strstart+=o,n.insert+=o>n.w_size-n.insert?n.w_size-n.insert:o),n.block_start=n.strstart),n.high_water<n.strstart&&(n.high_water=n.strstart),a?Zn:t!==ji&&t!==Ve&&n.strm.avail_in===0&&n.strstart===n.block_start?Kn:(s=n.window_size-n.strstart,n.strm.avail_in>s&&n.block_start>=n.w_size&&(n.block_start-=n.w_size,n.strstart-=n.w_size,n.window.set(n.window.subarray(n.w_size,n.w_size+n.strstart),0),n.matches<2&&n.matches++,s+=n.w_size,n.insert>n.strstart&&(n.insert=n.strstart)),s>n.strm.avail_in&&(s=n.strm.avail_in),s&&(_h(n.strm,n.window,n.strstart,s),n.strstart+=s,n.insert+=s>n.w_size-n.insert?n.w_size-n.insert:s),n.high_water<n.strstart&&(n.high_water=n.strstart),s=n.bi_valid+42>>3,s=n.pending_buf_size-s>65535?65535:n.pending_buf_size-s,e=s>n.w_size?n.w_size:s,r=n.strstart-n.block_start,(r>=e||(r||t===Ve)&&t!==ji&&n.strm.avail_in===0&&r<=s)&&(i=r>s?s:r,a=t===Ve&&n.strm.avail_in===0&&i===r?1:0,ch(n,n.block_start,i,a),n.block_start+=i,Oe(n.strm)),a?bn:ke)},yh=(n,t)=>{let e,i;for(;;){if(n.lookahead<ri){if(Jn(n),n.lookahead<ri&&t===ji)return ke;if(n.lookahead===0)break}if(e=0,n.lookahead>=Bt&&(n.ins_h=qi(n,n.ins_h,n.window[n.strstart+Bt-1]),e=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),e!==0&&n.strstart-e<=n.w_size-ri&&(n.match_length=xu(n,e)),n.match_length>=Bt)if(i=Hi(n,n.strstart-n.match_start,n.match_length-Bt),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=Bt){n.match_length--;do n.strstart++,n.ins_h=qi(n,n.ins_h,n.window[n.strstart+Bt-1]),e=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart;while(--n.match_length!==0);n.strstart++}else n.strstart+=n.match_length,n.match_length=0,n.ins_h=n.window[n.strstart],n.ins_h=qi(n,n.ins_h,n.window[n.strstart+1]);else i=Hi(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++;if(i&&(Fe(n,!1),n.strm.avail_out===0))return ke}return n.insert=n.strstart<Bt-1?n.strstart:Bt-1,t===Ve?(Fe(n,!0),n.strm.avail_out===0?bn:Zn):n.sym_next&&(Fe(n,!1),n.strm.avail_out===0)?ke:Kn},Qn=(n,t)=>{let e,i,r;for(;;){if(n.lookahead<ri){if(Jn(n),n.lookahead<ri&&t===ji)return ke;if(n.lookahead===0)break}if(e=0,n.lookahead>=Bt&&(n.ins_h=qi(n,n.ins_h,n.window[n.strstart+Bt-1]),e=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),n.prev_length=n.match_length,n.prev_match=n.match_start,n.match_length=Bt-1,e!==0&&n.prev_length<n.max_lazy_match&&n.strstart-e<=n.w_size-ri&&(n.match_length=xu(n,e),n.match_length<=5&&(n.strategy===h2||n.match_length===Bt&&n.strstart-n.match_start>4096)&&(n.match_length=Bt-1)),n.prev_length>=Bt&&n.match_length<=n.prev_length){r=n.strstart+n.lookahead-Bt,i=Hi(n,n.strstart-1-n.prev_match,n.prev_length-Bt),n.lookahead-=n.prev_length-1,n.prev_length-=2;do++n.strstart<=r&&(n.ins_h=qi(n,n.ins_h,n.window[n.strstart+Bt-1]),e=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart);while(--n.prev_length!==0);if(n.match_available=0,n.match_length=Bt-1,n.strstart++,i&&(Fe(n,!1),n.strm.avail_out===0))return ke}else if(n.match_available){if(i=Hi(n,0,n.window[n.strstart-1]),i&&Fe(n,!1),n.strstart++,n.lookahead--,n.strm.avail_out===0)return ke}else n.match_available=1,n.strstart++,n.lookahead--}return n.match_available&&(i=Hi(n,0,n.window[n.strstart-1]),n.match_available=0),n.insert=n.strstart<Bt-1?n.strstart:Bt-1,t===Ve?(Fe(n,!0),n.strm.avail_out===0?bn:Zn):n.sym_next&&(Fe(n,!1),n.strm.avail_out===0)?ke:Kn},C2=(n,t)=>{let e,i,r,s;const a=n.window;for(;;){if(n.lookahead<=Xi){if(Jn(n),n.lookahead<=Xi&&t===ji)return ke;if(n.lookahead===0)break}if(n.match_length=0,n.lookahead>=Bt&&n.strstart>0&&(r=n.strstart-1,i=a[r],i===a[++r]&&i===a[++r]&&i===a[++r])){s=n.strstart+Xi;do;while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<s);n.match_length=Xi-(s-r),n.match_length>n.lookahead&&(n.match_length=n.lookahead)}if(n.match_length>=Bt?(e=Hi(n,1,n.match_length-Bt),n.lookahead-=n.match_length,n.strstart+=n.match_length,n.match_length=0):(e=Hi(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++),e&&(Fe(n,!1),n.strm.avail_out===0))return ke}return n.insert=0,t===Ve?(Fe(n,!0),n.strm.avail_out===0?bn:Zn):n.sym_next&&(Fe(n,!1),n.strm.avail_out===0)?ke:Kn},T2=(n,t)=>{let e;for(;;){if(n.lookahead===0&&(Jn(n),n.lookahead===0)){if(t===ji)return ke;break}if(n.match_length=0,e=Hi(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++,e&&(Fe(n,!1),n.strm.avail_out===0))return ke}return n.insert=0,t===Ve?(Fe(n,!0),n.strm.avail_out===0?bn:Zn):n.sym_next&&(Fe(n,!1),n.strm.avail_out===0)?ke:Kn};function si(n,t,e,i,r){this.good_length=n,this.max_lazy=t,this.nice_length=e,this.max_chain=i,this.func=r}const Hr=[new si(0,0,0,0,Su),new si(4,4,8,4,yh),new si(4,5,16,8,yh),new si(4,6,32,32,yh),new si(4,4,16,16,Qn),new si(8,16,32,32,Qn),new si(8,16,128,128,Qn),new si(8,32,128,256,Qn),new si(32,128,258,1024,Qn),new si(32,258,258,4096,Qn)],k2=n=>{n.window_size=2*n.w_size,Yi(n.head),n.max_lazy_match=Hr[n.level].max_lazy,n.good_match=Hr[n.level].good_length,n.nice_match=Hr[n.level].nice_length,n.max_chain_length=Hr[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=Bt-1,n.match_available=0,n.ins_h=0};function E2(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ca,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(y2*2),this.dyn_dtree=new Uint16Array((2*v2+1)*2),this.bl_tree=new Uint16Array((2*_2+1)*2),Yi(this.dyn_ltree),Yi(this.dyn_dtree),Yi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(w2+1),this.heap=new Uint16Array(2*fh+1),Yi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*fh+1),Yi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const jr=n=>{if(!n)return 1;const t=n.state;return!t||t.strm!==n||t.status!==Wn&&t.status!==dh&&t.status!==gh&&t.status!==ph&&t.status!==mh&&t.status!==vh&&t.status!==wn&&t.status!==$r?1:0},Cu=n=>{if(jr(n))return xn(n,ni);n.total_in=n.total_out=0,n.data_type=f2;const t=n.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?dh:t.wrap?Wn:wn,n.adler=t.wrap===2?0:1,t.last_flush=-2,e2(t),_e},Tu=n=>{const t=Cu(n);return t===_e&&k2(n.state),t},P2=(n,t)=>jr(n)||n.state.wrap!==2?ni:(n.state.gzhead=t,_e),ku=(n,t,e,i,r,s)=>{if(!n)return ni;let a=1;if(t===o2&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),r<1||r>d2||e!==Ca||i<8||i>15||t<0||t>9||s<0||s>c2||i===8&&a!==1)return xn(n,ni);i===8&&(i=9);const o=new E2;return n.state=o,o.strm=n,o.status=Wn,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Bt-1)/Bt),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=t,o.strategy=s,o.method=e,Tu(n)},A2=(n,t)=>ku(n,t,Ca,g2,p2,u2),M2=(n,t)=>{if(jr(n)||t>yu||t<0)return n?xn(n,ni):ni;const e=n.state;if(!n.output||n.avail_in!==0&&!n.input||e.status===$r&&t!==Ve)return xn(n,n.avail_out===0?uh:ni);const i=e.last_flush;if(e.last_flush=t,e.pending!==0){if(Oe(n),n.avail_out===0)return e.last_flush=-1,_e}else if(n.avail_in===0&&bu(t)<=bu(i)&&t!==Ve)return xn(n,uh);if(e.status===$r&&n.avail_in!==0)return xn(n,uh);if(e.status===Wn&&e.wrap===0&&(e.status=wn),e.status===Wn){let r=Ca+(e.w_bits-8<<4)<<8,s=-1;if(e.strategy>=Sa||e.level<2?s=0:e.level<6?s=1:e.level===6?s=2:s=3,r|=s<<6,e.strstart!==0&&(r|=b2),r+=31-r%31,Vr(e,r),e.strstart!==0&&(Vr(e,n.adler>>>16),Vr(e,n.adler&65535)),n.adler=1,e.status=wn,Oe(n),e.pending!==0)return e.last_flush=-1,_e}if(e.status===dh){if(n.adler=0,jt(e,31),jt(e,139),jt(e,8),e.gzhead)jt(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),jt(e,e.gzhead.time&255),jt(e,e.gzhead.time>>8&255),jt(e,e.gzhead.time>>16&255),jt(e,e.gzhead.time>>24&255),jt(e,e.level===9?2:e.strategy>=Sa||e.level<2?4:0),jt(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(jt(e,e.gzhead.extra.length&255),jt(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(n.adler=ge(n.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=gh;else if(jt(e,0),jt(e,0),jt(e,0),jt(e,0),jt(e,0),jt(e,e.level===9?2:e.strategy>=Sa||e.level<2?4:0),jt(e,x2),e.status=wn,Oe(n),e.pending!==0)return e.last_flush=-1,_e}if(e.status===gh){if(e.gzhead.extra){let r=e.pending,s=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+s>e.pending_buf_size;){let o=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+o),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),e.gzindex+=o,Oe(n),e.pending!==0)return e.last_flush=-1,_e;r=0,s-=o}let a=new Uint8Array(e.gzhead.extra);e.pending_buf.set(a.subarray(e.gzindex,e.gzindex+s),e.pending),e.pending+=s,e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=ph}if(e.status===ph){if(e.gzhead.name){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),Oe(n),e.pending!==0)return e.last_flush=-1,_e;r=0}e.gzindex<e.gzhead.name.length?s=e.gzhead.name.charCodeAt(e.gzindex++)&255:s=0,jt(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=mh}if(e.status===mh){if(e.gzhead.comment){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),Oe(n),e.pending!==0)return e.last_flush=-1,_e;r=0}e.gzindex<e.gzhead.comment.length?s=e.gzhead.comment.charCodeAt(e.gzindex++)&255:s=0,jt(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r))}e.status=vh}if(e.status===vh){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(Oe(n),e.pending!==0))return e.last_flush=-1,_e;jt(e,n.adler&255),jt(e,n.adler>>8&255),n.adler=0}if(e.status=wn,Oe(n),e.pending!==0)return e.last_flush=-1,_e}if(n.avail_in!==0||e.lookahead!==0||t!==ji&&e.status!==$r){let r=e.level===0?Su(e,t):e.strategy===Sa?T2(e,t):e.strategy===l2?C2(e,t):Hr[e.level].func(e,t);if((r===bn||r===Zn)&&(e.status=$r),r===ke||r===bn)return n.avail_out===0&&(e.last_flush=-1),_e;if(r===Kn&&(t===r2?n2(e):t!==yu&&(ch(e,0,0,!1),t===s2&&(Yi(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),Oe(n),n.avail_out===0))return e.last_flush=-1,_e}return t!==Ve?_e:e.wrap<=0?wu:(e.wrap===2?(jt(e,n.adler&255),jt(e,n.adler>>8&255),jt(e,n.adler>>16&255),jt(e,n.adler>>24&255),jt(e,n.total_in&255),jt(e,n.total_in>>8&255),jt(e,n.total_in>>16&255),jt(e,n.total_in>>24&255)):(Vr(e,n.adler>>>16),Vr(e,n.adler&65535)),Oe(n),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?_e:wu)},R2=n=>{if(jr(n))return ni;const t=n.state.status;return n.state=null,t===wn?xn(n,a2):_e},D2=(n,t)=>{let e=t.length;if(jr(n))return ni;const i=n.state,r=i.wrap;if(r===2||r===1&&i.status!==Wn||i.lookahead)return ni;if(r===1&&(n.adler=zr(n.adler,t,e,0)),i.wrap=0,e>=i.w_size){r===0&&(Yi(i.head),i.strstart=0,i.block_start=0,i.insert=0);let h=new Uint8Array(i.w_size);h.set(t.subarray(e-i.w_size,e),0),t=h,e=i.w_size}const s=n.avail_in,a=n.next_in,o=n.input;for(n.avail_in=e,n.next_in=0,n.input=t,Jn(i);i.lookahead>=Bt;){let h=i.strstart,l=i.lookahead-(Bt-1);do i.ins_h=qi(i,i.ins_h,i.window[h+Bt-1]),i.prev[h&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=h,h++;while(--l);i.strstart=h,i.lookahead=Bt-1,Jn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Bt-1,i.match_available=0,n.next_in=a,n.input=o,n.avail_in=s,i.wrap=r,_e};var L2=A2,I2=ku,O2=Tu,F2=Cu,N2=P2,G2=M2,U2=R2,B2=D2,z2="pako deflate (from Nodeca project)",Xr={deflateInit:L2,deflateInit2:I2,deflateReset:O2,deflateResetKeep:F2,deflateSetHeader:N2,deflate:G2,deflateEnd:U2,deflateSetDictionary:B2,deflateInfo:z2};const $2=(n,t)=>Object.prototype.hasOwnProperty.call(n,t);var V2=function(n){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const i in e)$2(e,i)&&(n[i]=e[i])}}return n},H2=n=>{let t=0;for(let i=0,r=n.length;i<r;i++)t+=n[i].length;const e=new Uint8Array(t);for(let i=0,r=0,s=n.length;i<s;i++){let a=n[i];e.set(a,r),r+=a.length}return e},Ta={assign:V2,flattenChunks:H2};let Eu=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Eu=!1}const Yr=new Uint8Array(256);for(let n=0;n<256;n++)Yr[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;Yr[254]=Yr[254]=1;var j2=n=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(n);let t,e,i,r,s,a=n.length,o=0;for(r=0;r<a;r++)e=n.charCodeAt(r),(e&64512)===55296&&r+1<a&&(i=n.charCodeAt(r+1),(i&64512)===56320&&(e=65536+(e-55296<<10)+(i-56320),r++)),o+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(o),s=0,r=0;s<o;r++)e=n.charCodeAt(r),(e&64512)===55296&&r+1<a&&(i=n.charCodeAt(r+1),(i&64512)===56320&&(e=65536+(e-55296<<10)+(i-56320),r++)),e<128?t[s++]=e:e<2048?(t[s++]=192|e>>>6,t[s++]=128|e&63):e<65536?(t[s++]=224|e>>>12,t[s++]=128|e>>>6&63,t[s++]=128|e&63):(t[s++]=240|e>>>18,t[s++]=128|e>>>12&63,t[s++]=128|e>>>6&63,t[s++]=128|e&63);return t};const X2=(n,t)=>{if(t<65534&&n.subarray&&Eu)return String.fromCharCode.apply(null,n.length===t?n:n.subarray(0,t));let e="";for(let i=0;i<t;i++)e+=String.fromCharCode(n[i]);return e};var Y2=(n,t)=>{const e=t||n.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(n.subarray(0,t));let i,r;const s=new Array(e*2);for(r=0,i=0;i<e;){let a=n[i++];if(a<128){s[r++]=a;continue}let o=Yr[a];if(o>4){s[r++]=65533,i+=o-1;continue}for(a&=o===2?31:o===3?15:7;o>1&&i<e;)a=a<<6|n[i++]&63,o--;if(o>1){s[r++]=65533;continue}a<65536?s[r++]=a:(a-=65536,s[r++]=55296|a>>10&1023,s[r++]=56320|a&1023)}return X2(s,r)},q2=(n,t)=>{t=t||n.length,t>n.length&&(t=n.length);let e=t-1;for(;e>=0&&(n[e]&192)===128;)e--;return e<0||e===0?t:e+Yr[n[e]]>t?e:t},qr={string2buf:j2,buf2string:Y2,utf8border:q2};function W2(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Pu=W2;const Au=Object.prototype.toString,{Z_NO_FLUSH:K2,Z_SYNC_FLUSH:Z2,Z_FULL_FLUSH:J2,Z_FINISH:Q2,Z_OK:ka,Z_STREAM_END:tm,Z_DEFAULT_COMPRESSION:em,Z_DEFAULT_STRATEGY:im,Z_DEFLATED:nm}=yn;function Wr(n){this.options=Ta.assign({level:em,method:nm,chunkSize:16384,windowBits:15,memLevel:8,strategy:im},n||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Pu,this.strm.avail_out=0;let e=Xr.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==ka)throw new Error(_n[e]);if(t.header&&Xr.deflateSetHeader(this.strm,t.header),t.dictionary){let i;if(typeof t.dictionary=="string"?i=qr.string2buf(t.dictionary):Au.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,e=Xr.deflateSetDictionary(this.strm,i),e!==ka)throw new Error(_n[e]);this._dict_set=!0}}Wr.prototype.push=function(n,t){const e=this.strm,i=this.options.chunkSize;let r,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Q2:K2,typeof n=="string"?e.input=qr.string2buf(n):Au.call(n)==="[object ArrayBuffer]"?e.input=new Uint8Array(n):e.input=n,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(i),e.next_out=0,e.avail_out=i),(s===Z2||s===J2)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(r=Xr.deflate(e,s),r===tm)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),r=Xr.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ka;if(e.avail_out===0){this.onData(e.output);continue}if(s>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0},Wr.prototype.onData=function(n){this.chunks.push(n)},Wr.prototype.onEnd=function(n){n===ka&&(this.result=Ta.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function wh(n,t){const e=new Wr(t);if(e.push(n,!0),e.err)throw e.msg||_n[e.err];return e.result}function rm(n,t){return t=t||{},t.raw=!0,wh(n,t)}function sm(n,t){return t=t||{},t.gzip=!0,wh(n,t)}var am=Wr,om=wh,hm=rm,lm=sm,cm=yn,um={Deflate:am,deflate:om,deflateRaw:hm,gzip:lm,constants:cm};const Ea=16209,fm=16191;var dm=function(t,e){let i,r,s,a,o,h,l,c,d,f,u,m,v,b,S,E,_,x,P,R,F,L,$,U;const z=t.state;i=t.next_in,$=t.input,r=i+(t.avail_in-5),s=t.next_out,U=t.output,a=s-(e-t.avail_out),o=s+(t.avail_out-257),h=z.dmax,l=z.wsize,c=z.whave,d=z.wnext,f=z.window,u=z.hold,m=z.bits,v=z.lencode,b=z.distcode,S=(1<<z.lenbits)-1,E=(1<<z.distbits)-1;t:do{m<15&&(u+=$[i++]<<m,m+=8,u+=$[i++]<<m,m+=8),_=v[u&S];e:for(;;){if(x=_>>>24,u>>>=x,m-=x,x=_>>>16&255,x===0)U[s++]=_&65535;else if(x&16){P=_&65535,x&=15,x&&(m<x&&(u+=$[i++]<<m,m+=8),P+=u&(1<<x)-1,u>>>=x,m-=x),m<15&&(u+=$[i++]<<m,m+=8,u+=$[i++]<<m,m+=8),_=b[u&E];i:for(;;){if(x=_>>>24,u>>>=x,m-=x,x=_>>>16&255,x&16){if(R=_&65535,x&=15,m<x&&(u+=$[i++]<<m,m+=8,m<x&&(u+=$[i++]<<m,m+=8)),R+=u&(1<<x)-1,R>h){t.msg="invalid distance too far back",z.mode=Ea;break t}if(u>>>=x,m-=x,x=s-a,R>x){if(x=R-x,x>c&&z.sane){t.msg="invalid distance too far back",z.mode=Ea;break t}if(F=0,L=f,d===0){if(F+=l-x,x<P){P-=x;do U[s++]=f[F++];while(--x);F=s-R,L=U}}else if(d<x){if(F+=l+d-x,x-=d,x<P){P-=x;do U[s++]=f[F++];while(--x);if(F=0,d<P){x=d,P-=x;do U[s++]=f[F++];while(--x);F=s-R,L=U}}}else if(F+=d-x,x<P){P-=x;do U[s++]=f[F++];while(--x);F=s-R,L=U}for(;P>2;)U[s++]=L[F++],U[s++]=L[F++],U[s++]=L[F++],P-=3;P&&(U[s++]=L[F++],P>1&&(U[s++]=L[F++]))}else{F=s-R;do U[s++]=U[F++],U[s++]=U[F++],U[s++]=U[F++],P-=3;while(P>2);P&&(U[s++]=U[F++],P>1&&(U[s++]=U[F++]))}}else if(x&64){t.msg="invalid distance code",z.mode=Ea;break t}else{_=b[(_&65535)+(u&(1<<x)-1)];continue i}break}}else if(x&64)if(x&32){z.mode=fm;break t}else{t.msg="invalid literal/length code",z.mode=Ea;break t}else{_=v[(_&65535)+(u&(1<<x)-1)];continue e}break}}while(i<r&&s<o);P=m>>3,i-=P,m-=P<<3,u&=(1<<m)-1,t.next_in=i,t.next_out=s,t.avail_in=i<r?5+(r-i):5-(i-r),t.avail_out=s<o?257+(o-s):257-(s-o),z.hold=u,z.bits=m};const tr=15,Mu=852,Ru=592,Du=0,bh=1,Lu=2,gm=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),pm=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),mm=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),vm=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Kr=(n,t,e,i,r,s,a,o)=>{const h=o.bits;let l=0,c=0,d=0,f=0,u=0,m=0,v=0,b=0,S=0,E=0,_,x,P,R,F,L=null,$;const U=new Uint16Array(tr+1),z=new Uint16Array(tr+1);let q=null,K,Z,at;for(l=0;l<=tr;l++)U[l]=0;for(c=0;c<i;c++)U[t[e+c]]++;for(u=h,f=tr;f>=1&&U[f]===0;f--);if(u>f&&(u=f),f===0)return r[s++]=1<<24|64<<16|0,r[s++]=1<<24|64<<16|0,o.bits=1,0;for(d=1;d<f&&U[d]===0;d++);for(u<d&&(u=d),b=1,l=1;l<=tr;l++)if(b<<=1,b-=U[l],b<0)return-1;if(b>0&&(n===Du||f!==1))return-1;for(z[1]=0,l=1;l<tr;l++)z[l+1]=z[l]+U[l];for(c=0;c<i;c++)t[e+c]!==0&&(a[z[t[e+c]]++]=c);if(n===Du?(L=q=a,$=20):n===bh?(L=gm,q=pm,$=257):(L=mm,q=vm,$=0),E=0,c=0,l=d,F=s,m=u,v=0,P=-1,S=1<<u,R=S-1,n===bh&&S>Mu||n===Lu&&S>Ru)return 1;for(;;){K=l-v,a[c]+1<$?(Z=0,at=a[c]):a[c]>=$?(Z=q[a[c]-$],at=L[a[c]-$]):(Z=32+64,at=0),_=1<<l-v,x=1<<m,d=x;do x-=_,r[F+(E>>v)+x]=K<<24|Z<<16|at|0;while(x!==0);for(_=1<<l-1;E&_;)_>>=1;if(_!==0?(E&=_-1,E+=_):E=0,c++,--U[l]===0){if(l===f)break;l=t[e+a[c]]}if(l>u&&(E&R)!==P){for(v===0&&(v=u),F+=d,m=l-v,b=1<<m;m+v<f&&(b-=U[m+v],!(b<=0));)m++,b<<=1;if(S+=1<<m,n===bh&&S>Mu||n===Lu&&S>Ru)return 1;P=E&R,r[P]=u<<24|m<<16|F-s|0}}return E!==0&&(r[F+E]=l-v<<24|64<<16|0),o.bits=u,0};const _m=0,Iu=1,Ou=2,{Z_FINISH:Fu,Z_BLOCK:ym,Z_TREES:Pa,Z_OK:Sn,Z_STREAM_END:wm,Z_NEED_DICT:bm,Z_STREAM_ERROR:He,Z_DATA_ERROR:Nu,Z_MEM_ERROR:Gu,Z_BUF_ERROR:xm,Z_DEFLATED:Uu}=yn,Aa=16180,Bu=16181,zu=16182,$u=16183,Vu=16184,Hu=16185,ju=16186,Xu=16187,Yu=16188,qu=16189,Ma=16190,yi=16191,xh=16192,Wu=16193,Sh=16194,Ku=16195,Zu=16196,Ju=16197,Qu=16198,Ra=16199,Da=16200,tf=16201,ef=16202,nf=16203,rf=16204,sf=16205,Ch=16206,af=16207,of=16208,ee=16209,hf=16210,lf=16211,Sm=852,Cm=592,Tm=15,cf=n=>(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24);function km(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Cn=n=>{if(!n)return 1;const t=n.state;return!t||t.strm!==n||t.mode<Aa||t.mode>lf?1:0},uf=n=>{if(Cn(n))return He;const t=n.state;return n.total_in=n.total_out=t.total=0,n.msg="",t.wrap&&(n.adler=t.wrap&1),t.mode=Aa,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Sm),t.distcode=t.distdyn=new Int32Array(Cm),t.sane=1,t.back=-1,Sn},ff=n=>{if(Cn(n))return He;const t=n.state;return t.wsize=0,t.whave=0,t.wnext=0,uf(n)},df=(n,t)=>{let e;if(Cn(n))return He;const i=n.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?He:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=e,i.wbits=t,ff(n))},gf=(n,t)=>{if(!n)return He;const e=new km;n.state=e,e.strm=n,e.window=null,e.mode=Aa;const i=df(n,t);return i!==Sn&&(n.state=null),i},Em=n=>gf(n,Tm);let pf=!0,Th,kh;const Pm=n=>{if(pf){Th=new Int32Array(512),kh=new Int32Array(32);let t=0;for(;t<144;)n.lens[t++]=8;for(;t<256;)n.lens[t++]=9;for(;t<280;)n.lens[t++]=7;for(;t<288;)n.lens[t++]=8;for(Kr(Iu,n.lens,0,288,Th,0,n.work,{bits:9}),t=0;t<32;)n.lens[t++]=5;Kr(Ou,n.lens,0,32,kh,0,n.work,{bits:5}),pf=!1}n.lencode=Th,n.lenbits=9,n.distcode=kh,n.distbits=5},mf=(n,t,e,i)=>{let r;const s=n.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(t.subarray(e-s.wsize,e),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>i&&(r=i),s.window.set(t.subarray(e-i,e-i+r),s.wnext),i-=r,i?(s.window.set(t.subarray(e-i,e),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},Am=(n,t)=>{let e,i,r,s,a,o,h,l,c,d,f,u,m,v,b=0,S,E,_,x,P,R,F,L;const $=new Uint8Array(4);let U,z;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Cn(n)||!n.output||!n.input&&n.avail_in!==0)return He;e=n.state,e.mode===yi&&(e.mode=xh),a=n.next_out,r=n.output,h=n.avail_out,s=n.next_in,i=n.input,o=n.avail_in,l=e.hold,c=e.bits,d=o,f=h,L=Sn;t:for(;;)switch(e.mode){case Aa:if(e.wrap===0){e.mode=xh;break}for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.wrap&2&&l===35615){e.wbits===0&&(e.wbits=15),e.check=0,$[0]=l&255,$[1]=l>>>8&255,e.check=ge(e.check,$,2,0),l=0,c=0,e.mode=Bu;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){n.msg="incorrect header check",e.mode=ee;break}if((l&15)!==Uu){n.msg="unknown compression method",e.mode=ee;break}if(l>>>=4,c-=4,F=(l&15)+8,e.wbits===0&&(e.wbits=F),F>15||F>e.wbits){n.msg="invalid window size",e.mode=ee;break}e.dmax=1<<e.wbits,e.flags=0,n.adler=e.check=1,e.mode=l&512?qu:yi,l=0,c=0;break;case Bu:for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.flags=l,(e.flags&255)!==Uu){n.msg="unknown compression method",e.mode=ee;break}if(e.flags&57344){n.msg="unknown header flags set",e.mode=ee;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ge(e.check,$,2,0)),l=0,c=0,e.mode=zu;case zu:for(;c<32;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.head&&(e.head.time=l),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,$[2]=l>>>16&255,$[3]=l>>>24&255,e.check=ge(e.check,$,4,0)),l=0,c=0,e.mode=$u;case $u:for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.head&&(e.head.xflags=l&255,e.head.os=l>>8),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ge(e.check,$,2,0)),l=0,c=0,e.mode=Vu;case Vu:if(e.flags&1024){for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.length=l,e.head&&(e.head.extra_len=l),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ge(e.check,$,2,0)),l=0,c=0}else e.head&&(e.head.extra=null);e.mode=Hu;case Hu:if(e.flags&1024&&(u=e.length,u>o&&(u=o),u&&(e.head&&(F=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(i.subarray(s,s+u),F)),e.flags&512&&e.wrap&4&&(e.check=ge(e.check,i,u,s)),o-=u,s+=u,e.length-=u),e.length))break t;e.length=0,e.mode=ju;case ju:if(e.flags&2048){if(o===0)break t;u=0;do F=i[s+u++],e.head&&F&&e.length<65536&&(e.head.name+=String.fromCharCode(F));while(F&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=ge(e.check,i,u,s)),o-=u,s+=u,F)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=Xu;case Xu:if(e.flags&4096){if(o===0)break t;u=0;do F=i[s+u++],e.head&&F&&e.length<65536&&(e.head.comment+=String.fromCharCode(F));while(F&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=ge(e.check,i,u,s)),o-=u,s+=u,F)break t}else e.head&&(e.head.comment=null);e.mode=Yu;case Yu:if(e.flags&512){for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.wrap&4&&l!==(e.check&65535)){n.msg="header crc mismatch",e.mode=ee;break}l=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),n.adler=e.check=0,e.mode=yi;break;case qu:for(;c<32;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}n.adler=e.check=cf(l),l=0,c=0,e.mode=Ma;case Ma:if(e.havedict===0)return n.next_out=a,n.avail_out=h,n.next_in=s,n.avail_in=o,e.hold=l,e.bits=c,bm;n.adler=e.check=1,e.mode=yi;case yi:if(t===ym||t===Pa)break t;case xh:if(e.last){l>>>=c&7,c-=c&7,e.mode=Ch;break}for(;c<3;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}switch(e.last=l&1,l>>>=1,c-=1,l&3){case 0:e.mode=Wu;break;case 1:if(Pm(e),e.mode=Ra,t===Pa){l>>>=2,c-=2;break t}break;case 2:e.mode=Zu;break;case 3:n.msg="invalid block type",e.mode=ee}l>>>=2,c-=2;break;case Wu:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){n.msg="invalid stored block lengths",e.mode=ee;break}if(e.length=l&65535,l=0,c=0,e.mode=Sh,t===Pa)break t;case Sh:e.mode=Ku;case Ku:if(u=e.length,u){if(u>o&&(u=o),u>h&&(u=h),u===0)break t;r.set(i.subarray(s,s+u),a),o-=u,s+=u,h-=u,a+=u,e.length-=u;break}e.mode=yi;break;case Zu:for(;c<14;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.nlen=(l&31)+257,l>>>=5,c-=5,e.ndist=(l&31)+1,l>>>=5,c-=5,e.ncode=(l&15)+4,l>>>=4,c-=4,e.nlen>286||e.ndist>30){n.msg="too many length or distance symbols",e.mode=ee;break}e.have=0,e.mode=Ju;case Ju:for(;e.have<e.ncode;){for(;c<3;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.lens[q[e.have++]]=l&7,l>>>=3,c-=3}for(;e.have<19;)e.lens[q[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,U={bits:e.lenbits},L=Kr(_m,e.lens,0,19,e.lencode,0,e.work,U),e.lenbits=U.bits,L){n.msg="invalid code lengths set",e.mode=ee;break}e.have=0,e.mode=Qu;case Qu:for(;e.have<e.nlen+e.ndist;){for(;b=e.lencode[l&(1<<e.lenbits)-1],S=b>>>24,E=b>>>16&255,_=b&65535,!(S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(_<16)l>>>=S,c-=S,e.lens[e.have++]=_;else{if(_===16){for(z=S+2;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(l>>>=S,c-=S,e.have===0){n.msg="invalid bit length repeat",e.mode=ee;break}F=e.lens[e.have-1],u=3+(l&3),l>>>=2,c-=2}else if(_===17){for(z=S+3;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}l>>>=S,c-=S,F=0,u=3+(l&7),l>>>=3,c-=3}else{for(z=S+7;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}l>>>=S,c-=S,F=0,u=11+(l&127),l>>>=7,c-=7}if(e.have+u>e.nlen+e.ndist){n.msg="invalid bit length repeat",e.mode=ee;break}for(;u--;)e.lens[e.have++]=F}}if(e.mode===ee)break;if(e.lens[256]===0){n.msg="invalid code -- missing end-of-block",e.mode=ee;break}if(e.lenbits=9,U={bits:e.lenbits},L=Kr(Iu,e.lens,0,e.nlen,e.lencode,0,e.work,U),e.lenbits=U.bits,L){n.msg="invalid literal/lengths set",e.mode=ee;break}if(e.distbits=6,e.distcode=e.distdyn,U={bits:e.distbits},L=Kr(Ou,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,U),e.distbits=U.bits,L){n.msg="invalid distances set",e.mode=ee;break}if(e.mode=Ra,t===Pa)break t;case Ra:e.mode=Da;case Da:if(o>=6&&h>=258){n.next_out=a,n.avail_out=h,n.next_in=s,n.avail_in=o,e.hold=l,e.bits=c,dm(n,f),a=n.next_out,r=n.output,h=n.avail_out,s=n.next_in,i=n.input,o=n.avail_in,l=e.hold,c=e.bits,e.mode===yi&&(e.back=-1);break}for(e.back=0;b=e.lencode[l&(1<<e.lenbits)-1],S=b>>>24,E=b>>>16&255,_=b&65535,!(S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(E&&!(E&240)){for(x=S,P=E,R=_;b=e.lencode[R+((l&(1<<x+P)-1)>>x)],S=b>>>24,E=b>>>16&255,_=b&65535,!(x+S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}l>>>=x,c-=x,e.back+=x}if(l>>>=S,c-=S,e.back+=S,e.length=_,E===0){e.mode=sf;break}if(E&32){e.back=-1,e.mode=yi;break}if(E&64){n.msg="invalid literal/length code",e.mode=ee;break}e.extra=E&15,e.mode=tf;case tf:if(e.extra){for(z=e.extra;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.length+=l&(1<<e.extra)-1,l>>>=e.extra,c-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=ef;case ef:for(;b=e.distcode[l&(1<<e.distbits)-1],S=b>>>24,E=b>>>16&255,_=b&65535,!(S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(!(E&240)){for(x=S,P=E,R=_;b=e.distcode[R+((l&(1<<x+P)-1)>>x)],S=b>>>24,E=b>>>16&255,_=b&65535,!(x+S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}l>>>=x,c-=x,e.back+=x}if(l>>>=S,c-=S,e.back+=S,E&64){n.msg="invalid distance code",e.mode=ee;break}e.offset=_,e.extra=E&15,e.mode=nf;case nf:if(e.extra){for(z=e.extra;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.offset+=l&(1<<e.extra)-1,l>>>=e.extra,c-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){n.msg="invalid distance too far back",e.mode=ee;break}e.mode=rf;case rf:if(h===0)break t;if(u=f-h,e.offset>u){if(u=e.offset-u,u>e.whave&&e.sane){n.msg="invalid distance too far back",e.mode=ee;break}u>e.wnext?(u-=e.wnext,m=e.wsize-u):m=e.wnext-u,u>e.length&&(u=e.length),v=e.window}else v=r,m=a-e.offset,u=e.length;u>h&&(u=h),h-=u,e.length-=u;do r[a++]=v[m++];while(--u);e.length===0&&(e.mode=Da);break;case sf:if(h===0)break t;r[a++]=e.length,h--,e.mode=Da;break;case Ch:if(e.wrap){for(;c<32;){if(o===0)break t;o--,l|=i[s++]<<c,c+=8}if(f-=h,n.total_out+=f,e.total+=f,e.wrap&4&&f&&(n.adler=e.check=e.flags?ge(e.check,r,f,a-f):zr(e.check,r,f,a-f)),f=h,e.wrap&4&&(e.flags?l:cf(l))!==e.check){n.msg="incorrect data check",e.mode=ee;break}l=0,c=0}e.mode=af;case af:if(e.wrap&&e.flags){for(;c<32;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.wrap&4&&l!==(e.total&4294967295)){n.msg="incorrect length check",e.mode=ee;break}l=0,c=0}e.mode=of;case of:L=wm;break t;case ee:L=Nu;break t;case hf:return Gu;case lf:default:return He}return n.next_out=a,n.avail_out=h,n.next_in=s,n.avail_in=o,e.hold=l,e.bits=c,(e.wsize||f!==n.avail_out&&e.mode<ee&&(e.mode<Ch||t!==Fu))&&mf(n,n.output,n.next_out,f-n.avail_out),d-=n.avail_in,f-=n.avail_out,n.total_in+=d,n.total_out+=f,e.total+=f,e.wrap&4&&f&&(n.adler=e.check=e.flags?ge(e.check,r,f,n.next_out-f):zr(e.check,r,f,n.next_out-f)),n.data_type=e.bits+(e.last?64:0)+(e.mode===yi?128:0)+(e.mode===Ra||e.mode===Sh?256:0),(d===0&&f===0||t===Fu)&&L===Sn&&(L=xm),L},Mm=n=>{if(Cn(n))return He;let t=n.state;return t.window&&(t.window=null),n.state=null,Sn},Rm=(n,t)=>{if(Cn(n))return He;const e=n.state;return e.wrap&2?(e.head=t,t.done=!1,Sn):He},Dm=(n,t)=>{const e=t.length;let i,r,s;return Cn(n)||(i=n.state,i.wrap!==0&&i.mode!==Ma)?He:i.mode===Ma&&(r=1,r=zr(r,t,e,0),r!==i.check)?Nu:(s=mf(n,t,e,e),s?(i.mode=hf,Gu):(i.havedict=1,Sn))};var Lm=ff,Im=df,Om=uf,Fm=Em,Nm=gf,Gm=Am,Um=Mm,Bm=Rm,zm=Dm,$m="pako inflate (from Nodeca project)",wi={inflateReset:Lm,inflateReset2:Im,inflateResetKeep:Om,inflateInit:Fm,inflateInit2:Nm,inflate:Gm,inflateEnd:Um,inflateGetHeader:Bm,inflateSetDictionary:zm,inflateInfo:$m};function Vm(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Hm=Vm;const vf=Object.prototype.toString,{Z_NO_FLUSH:jm,Z_FINISH:Xm,Z_OK:Zr,Z_STREAM_END:Eh,Z_NEED_DICT:Ph,Z_STREAM_ERROR:Ym,Z_DATA_ERROR:_f,Z_MEM_ERROR:qm}=yn;function Jr(n){this.options=Ta.assign({chunkSize:1024*64,windowBits:15,to:""},n||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(n&&n.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Pu,this.strm.avail_out=0;let e=wi.inflateInit2(this.strm,t.windowBits);if(e!==Zr)throw new Error(_n[e]);if(this.header=new Hm,wi.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=qr.string2buf(t.dictionary):vf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=wi.inflateSetDictionary(this.strm,t.dictionary),e!==Zr)))throw new Error(_n[e])}Jr.prototype.push=function(n,t){const e=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?Xm:jm,vf.call(n)==="[object ArrayBuffer]"?e.input=new Uint8Array(n):e.input=n,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(i),e.next_out=0,e.avail_out=i),s=wi.inflate(e,a),s===Ph&&r&&(s=wi.inflateSetDictionary(e,r),s===Zr?s=wi.inflate(e,a):s===_f&&(s=Ph));e.avail_in>0&&s===Eh&&e.state.wrap>0&&n[e.next_in]!==0;)wi.inflateReset(e),s=wi.inflate(e,a);switch(s){case Ym:case _f:case Ph:case qm:return this.onEnd(s),this.ended=!0,!1}if(o=e.avail_out,e.next_out&&(e.avail_out===0||s===Eh))if(this.options.to==="string"){let h=qr.utf8border(e.output,e.next_out),l=e.next_out-h,c=qr.buf2string(e.output,h);e.next_out=l,e.avail_out=i-l,l&&e.output.set(e.output.subarray(h,h+l),0),this.onData(c)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(s===Zr&&o===0)){if(s===Eh)return s=wi.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},Jr.prototype.onData=function(n){this.chunks.push(n)},Jr.prototype.onEnd=function(n){n===Zr&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ta.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function Ah(n,t){const e=new Jr(t);if(e.push(n),e.err)throw e.msg||_n[e.err];return e.result}function Wm(n,t){return t=t||{},t.raw=!0,Ah(n,t)}var Km=Jr,Zm=Ah,Jm=Wm,Qm=Ah,tv=yn,ev={Inflate:Km,inflate:Zm,inflateRaw:Jm,ungzip:Qm,constants:tv};const{Deflate:iv,deflate:nv,deflateRaw:rv,gzip:sv}=um,{Inflate:av,inflate:ov,inflateRaw:hv,ungzip:lv}=ev;var cv=iv,uv=nv,fv=rv,dv=sv,gv=av,pv=ov,mv=hv,vv=lv,_v=yn,yv={Deflate:cv,deflate:uv,deflateRaw:fv,gzip:dv,Inflate:gv,inflate:pv,inflateRaw:mv,ungzip:vv,constants:_v};const dt={};dt.toRGBA8=function(n){const t=n.width,e=n.height;if(n.tabs.acTL===null)return[dt.toRGBA8.decodeImage(n.data,t,e,n).buffer];const i=[];n.frames[0].data===null&&(n.frames[0].data=n.data);const r=t*e*4,s=new Uint8Array(r),a=new Uint8Array(r),o=new Uint8Array(r);for(let h=0;h<n.frames.length;h++){const l=n.frames[h],c=l.rect.x,d=l.rect.y,f=l.rect.width,u=l.rect.height,m=dt.toRGBA8.decodeImage(l.data,f,u,n);if(h!==0)for(let v=0;v<r;v++)o[v]=s[v];if(l.blend===0?dt._copyTile(m,f,u,s,t,e,c,d,0):l.blend===1&&dt._copyTile(m,f,u,s,t,e,c,d,1),i.push(s.buffer.slice(0)),l.dispose===1)dt._copyTile(a,f,u,s,t,e,c,d,0);else if(l.dispose===2)for(let v=0;v<r;v++)s[v]=o[v]}return i},dt.toRGBA8.decodeImage=function(n,t,e,i){const r=t*e,s=dt.decode._getBPP(i),a=Math.ceil(t*s/8),o=new Uint8Array(r*4),h=new Uint32Array(o.buffer),l=i.ctype,c=i.depth,d=dt._bin.readUshort;if(l===6){const f=r<<2;if(c===8)for(let u=0;u<f;u+=4)o[u]=n[u],o[u+1]=n[u+1],o[u+2]=n[u+2],o[u+3]=n[u+3];if(c===16)for(let u=0;u<f;u++)o[u]=n[u<<1]}else if(l===2){const f=i.tabs.tRNS;if(f===null){if(c===8)for(let u=0;u<r;u++){const m=u*3;h[u]=255<<24|n[m+2]<<16|n[m+1]<<8|n[m]}if(c===16)for(let u=0;u<r;u++){const m=u*6;h[u]=255<<24|n[m+4]<<16|n[m+2]<<8|n[m]}}else{const u=f[0],m=f[1],v=f[2];if(c===8)for(let b=0;b<r;b++){const S=b<<2,E=b*3;h[b]=255<<24|n[E+2]<<16|n[E+1]<<8|n[E],n[E]===u&&n[E+1]===m&&n[E+2]===v&&(o[S+3]=0)}if(c===16)for(let b=0;b<r;b++){const S=b<<2,E=b*6;h[b]=255<<24|n[E+4]<<16|n[E+2]<<8|n[E],d(n,E)===u&&d(n,E+2)===m&&d(n,E+4)===v&&(o[S+3]=0)}}}else if(l===3){const f=i.tabs.PLTE,u=i.tabs.tRNS,m=u?u.length:0;if(c===1)for(let v=0;v<e;v++){const b=v*a,S=v*t;for(let E=0;E<t;E++){const _=S+E<<2,x=n[b+(E>>3)]>>7-((E&7)<<0)&1,P=3*x;o[_]=f[P],o[_+1]=f[P+1],o[_+2]=f[P+2],o[_+3]=x<m?u[x]:255}}if(c===2)for(let v=0;v<e;v++){const b=v*a,S=v*t;for(let E=0;E<t;E++){const _=S+E<<2,x=n[b+(E>>2)]>>6-((E&3)<<1)&3,P=3*x;o[_]=f[P],o[_+1]=f[P+1],o[_+2]=f[P+2],o[_+3]=x<m?u[x]:255}}if(c===4)for(let v=0;v<e;v++){const b=v*a,S=v*t;for(let E=0;E<t;E++){const _=S+E<<2,x=n[b+(E>>1)]>>4-((E&1)<<2)&15,P=3*x;o[_]=f[P],o[_+1]=f[P+1],o[_+2]=f[P+2],o[_+3]=x<m?u[x]:255}}if(c===8)for(let v=0;v<r;v++){const b=v<<2,S=n[v],E=3*S;o[b]=f[E],o[b+1]=f[E+1],o[b+2]=f[E+2],o[b+3]=S<m?u[S]:255}}else if(l===4){if(c===8)for(let f=0;f<r;f++){const u=f<<2,m=f<<1,v=n[m];o[u]=v,o[u+1]=v,o[u+2]=v,o[u+3]=n[m+1]}if(c===16)for(let f=0;f<r;f++){const u=f<<2,m=f<<2,v=n[m];o[u]=v,o[u+1]=v,o[u+2]=v,o[u+3]=n[m+2]}}else if(l===0){const f=i.tabs.tRNS?i.tabs.tRNS:-1;for(let u=0;u<e;u++){const m=u*a,v=u*t;if(c===1)for(let b=0;b<t;b++){const S=255*(n[m+(b>>>3)]>>>7-(b&7)&1),E=S===f*255?0:255;h[v+b]=E<<24|S<<16|S<<8|S}else if(c===2)for(let b=0;b<t;b++){const S=85*(n[m+(b>>>2)]>>>6-((b&3)<<1)&3),E=S===f*85?0:255;h[v+b]=E<<24|S<<16|S<<8|S}else if(c===4)for(let b=0;b<t;b++){const S=17*(n[m+(b>>>1)]>>>4-((b&1)<<2)&15),E=S===f*17?0:255;h[v+b]=E<<24|S<<16|S<<8|S}else if(c===8)for(let b=0;b<t;b++){const S=n[m+b],E=S===f?0:255;h[v+b]=E<<24|S<<16|S<<8|S}else if(c===16)for(let b=0;b<t;b++){const S=n[m+(b<<1)],E=d(n,m+(b<<1))===f?0:255;h[v+b]=E<<24|S<<16|S<<8|S}}}return o},dt.decode=function(n){const t=new Uint8Array(n);let e=8;const i=dt._bin,r=i.readUshort,s=i.readUint,a={tabs:{},frames:[]},o=new Uint8Array(t.length);let h=0,l,c=0;const d=[137,80,78,71,13,10,26,10];for(let f=0;f<8;f++)if(t[f]!==d[f])throw"The input is not a PNG file!";for(;e<t.length;){const f=i.readUint(t,e);e+=4;const u=i.readASCII(t,e,4);if(e+=4,u==="IHDR")dt.decode._IHDR(t,e,a);else if(u==="CgBI")a.tabs[u]=t.slice(e,e+4);else if(u==="IDAT"){for(let m=0;m<f;m++)o[h+m]=t[e+m];h+=f}else if(u==="acTL")a.tabs[u]={num_frames:s(t,e),num_plays:s(t,e+4)},l=new Uint8Array(t.length);else if(u==="fcTL"){if(c!==0){const S=a.frames[a.frames.length-1];S.data=dt.decode._decompress(a,l.slice(0,c),S.rect.width,S.rect.height),c=0}const m={x:s(t,e+12),y:s(t,e+16),width:s(t,e+4),height:s(t,e+8)};let v=r(t,e+22);v=r(t,e+20)/(v===0?100:v);const b={rect:m,delay:Math.round(v*1e3),dispose:t[e+24],blend:t[e+25]};a.frames.push(b)}else if(u==="fdAT"){for(let m=0;m<f-4;m++)l[c+m]=t[e+m+4];c+=f-4}else if(u==="pHYs")a.tabs[u]=[i.readUint(t,e),i.readUint(t,e+4),t[e+8]];else if(u==="cHRM"){a.tabs[u]=[];for(let m=0;m<8;m++)a.tabs[u].push(i.readUint(t,e+m*4))}else if(u==="tEXt"||u==="zTXt"){a.tabs[u]===null&&(a.tabs[u]={});const m=i.nextZero(t,e),v=i.readASCII(t,e,m-e);let b;const S=e+f-m-1;if(u==="tEXt")b=i.readASCII(t,m+1,S);else{const E=dt.decode._inflate(t.slice(m+2,m+2+S));b=i.readUTF8(E,0,E.length)}a.tabs[u][v]=b}else if(u==="iTXt"){a.tabs[u]==null&&(a.tabs[u]={});let m=0,v=e;m=i.nextZero(t,v);const b=i.readASCII(t,v,m-v);v=m+1;const S=t[v];v+=2,m=i.nextZero(t,v),v=m+1,m=i.nextZero(t,v),v=m+1;let E;const _=f-(v-e);if(S===0)E=i.readUTF8(t,v,_);else{const x=dt.decode._inflate(t.slice(v,v+_));E=i.readUTF8(x,0,x.length)}a.tabs[u][b]=E}else if(u==="PLTE")a.tabs[u]=i.readBytes(t,e,f);else if(u==="hIST"){const m=a.tabs.PLTE.length/3;a.tabs[u]=[];for(let v=0;v<m;v++)a.tabs[u].push(r(t,e+v*2))}else if(u==="tRNS")a.ctype===3?a.tabs[u]=i.readBytes(t,e,f):a.ctype===0?a.tabs[u]=r(t,e):a.ctype===2&&(a.tabs[u]=[r(t,e),r(t,e+2),r(t,e+4)]);else if(u==="gAMA")a.tabs[u]=i.readUint(t,e)/1e5;else if(u==="sRGB")a.tabs[u]=t[e];else if(u==="bKGD")a.ctype===0||a.ctype===4?a.tabs[u]=[r(t,e)]:a.ctype===2||a.ctype===6?a.tabs[u]=[r(t,e),r(t,e+2),r(t,e+4)]:a.ctype===3&&(a.tabs[u]=t[e]);else if(u==="IEND")break;e+=f,e+=4}if(c!==0){const f=a.frames[a.frames.length-1];f.data=dt.decode._decompress(a,l.slice(0,c),f.rect.width,f.rect.height),c=0}return a.data=dt.decode._decompress(a,o,a.width,a.height),delete a.compress,delete a.interlace,delete a.filter,a},dt.decode._decompress=function(n,t,e,i){const r=dt.decode._getBPP(n),s=Math.ceil(e*r/8),a=new Uint8Array((s+1+n.interlace)*i);return n.tabs.CgBI?t=dt.inflateRaw(t,a):t=dt.decode._inflate(t,a),n.interlace===0?t=dt.decode._filterZero(t,n,0,e,i):n.interlace===1&&(t=dt.decode._readInterlace(t,n)),t},dt.decode._inflate=function(n,t){return dt.inflateRaw(new Uint8Array(n.buffer,2,n.length-6),t)},dt.inflateRaw=function(){const n={};return n.H={},n.H.N=function(t,e){const i=Uint8Array;let r=0,s=0,a=0,o=0,h=0,l=0,c=0,d=0,f=0,u,m;if(t[0]===3&&t[1]===0)return e||new i(0);const v=n.H,b=v.b,S=v.e,E=v.R,_=v.n,x=v.A,P=v.Z,R=v.m,F=e===null;for(F&&(e=new i(t.length>>>2<<3));r===0;){if(r=b(t,f,1),s=b(t,f+1,2),f+=3,s===0){f&7&&(f+=8-(f&7));const L=(f>>>3)+4,$=t[L-4]|t[L-3]<<8;F&&(e=n.H.W(e,d+$)),e.set(new i(t.buffer,t.byteOffset+L,$),d),f=L+$<<3,d+=$;continue}if(F&&(e=n.H.W(e,d+(1<<17))),s===1&&(u=R.J,m=R.h,l=512-1,c=32-1),s===2){a=S(t,f,5)+257,o=S(t,f+5,5)+1,h=S(t,f+10,4)+4,f+=14;let L=1;for(let z=0;z<38;z+=2)R.Q[z]=0,R.Q[z+1]=0;for(let z=0;z<h;z++){const q=S(t,f+z*3,3);R.Q[(R.X[z]<<1)+1]=q,q>L&&(L=q)}f+=3*h,_(R.Q,L),x(R.Q,L,R.u),u=R.w,m=R.d,f=E(R.u,(1<<L)-1,a+o,t,f,R.v);const $=v.V(R.v,0,a,R.C);l=(1<<$)-1;const U=v.V(R.v,a,o,R.D);c=(1<<U)-1,_(R.C,$),x(R.C,$,u),_(R.D,U),x(R.D,U,m)}for(;;){const L=u[P(t,f)&l];f+=L&15;const $=L>>>4;if(!($>>>8))e[d++]=$;else{if($===256)break;{let U=d+$-254;if($>264){const at=R.q[$-257];U=d+(at>>>3)+S(t,f,at&7),f+=at&7}const z=m[P(t,f)&c];f+=z&15;const q=z>>>4,K=R.c[q],Z=(K>>>4)+b(t,f,K&15);for(f+=K&15;d<U;)e[d]=e[d++-Z],e[d]=e[d++-Z],e[d]=e[d++-Z],e[d]=e[d++-Z];d=U}}}}return e.length===d?e:e.slice(0,d)},n.H.W=function(t,e){const i=t.length;if(e<=i)return t;const r=new Uint8Array(i<<1);return r.set(t,0),r},n.H.R=function(t,e,i,r,s,a){const o=n.H.e,h=n.H.Z;let l=0;for(;l<i;){const c=t[h(r,s)&e];s+=c&15;const d=c>>>4;if(d<=15)a[l]=d,l++;else{let f=0,u=0;d===16?(u=3+o(r,s,2),s+=2,f=a[l-1]):d===17?(u=3+o(r,s,3),s+=3):d===18&&(u=11+o(r,s,7),s+=7);const m=l+u;for(;l<m;)a[l]=f,l++}}return s},n.H.V=function(t,e,i,r){let s=0,a=0;const o=r.length>>>1;for(;a<i;){const h=t[a+e];r[a<<1]=0,r[(a<<1)+1]=h,h>s&&(s=h),a++}for(;a<o;)r[a<<1]=0,r[(a<<1)+1]=0,a++;return s},n.H.n=function(t,e){const i=n.H.m,r=t.length;let s,a,o,h,l;const c=i.j;for(let f=0;f<=e;f++)c[f]=0;for(h=1;h<r;h+=2)c[t[h]]++;const d=i.K;for(s=0,c[0]=0,a=1;a<=e;a++)s=s+c[a-1]<<1,d[a]=s;for(o=0;o<r;o+=2)l=t[o+1],l!==0&&(t[o]=d[l],d[l]++)},n.H.A=function(t,e,i){const r=t.length,a=n.H.m.r;for(let o=0;o<r;o+=2)if(t[o+1]!==0){const h=o>>1,l=t[o+1],c=h<<4|l,d=e-l;let f=t[o]<<d;const u=f+(1<<d);for(;f!==u;){const m=a[f]>>>15-e;i[m]=c,f++}}},n.H.l=function(t,e){const i=n.H.m.r,r=15-e;for(let s=0;s<t.length;s+=2){const a=t[s]<<e-t[s+1];t[s]=i[a]>>>r}},n.H.M=function(t,e,i){i=i<<(e&7);const r=e>>>3;t[r]|=i,t[r+1]|=i>>>8},n.H.I=function(t,e,i){i=i<<(e&7);const r=e>>>3;t[r]|=i,t[r+1]|=i>>>8,t[r+2]|=i>>>16},n.H.e=function(t,e,i){return(t[e>>>3]|t[(e>>>3)+1]<<8)>>>(e&7)&(1<<i)-1},n.H.b=function(t,e,i){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)&(1<<i)-1},n.H.Z=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)},n.H.i=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16|t[(e>>>3)+3]<<24)>>>(e&7)},n.H.m=function(){const t=Uint16Array,e=Uint32Array;return{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new e(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(32768),s:new e(286),Y:new e(30),a:new e(19),t:new e(15e3),k:new t(65536),g:new t(32768)}}(),function(){const t=n.H.m,e=32768;for(let r=0;r<e;r++){let s=r;s=(s&2863311530)>>>1|(s&1431655765)<<1,s=(s&3435973836)>>>2|(s&858993459)<<2,s=(s&4042322160)>>>4|(s&252645135)<<4,s=(s&4278255360)>>>8|(s&16711935)<<8,t.r[r]=(s>>>16|s<<16)>>>17}function i(r,s,a){for(;s--!==0;)r.push(0,a)}for(let r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];i(t._,144,8),i(t._,255-143,9),i(t._,279-255,7),i(t._,287-279,8),n.H.n(t._,9),n.H.A(t._,9,t.J),n.H.l(t._,9),i(t.$,32,5),n.H.n(t.$,5),n.H.A(t.$,5,t.h),n.H.l(t.$,5),i(t.Q,19,0),i(t.C,286,0),i(t.D,30,0),i(t.v,320,0)}(),n.H.N}(),dt.decode._readInterlace=function(n,t){const e=t.width,i=t.height,r=dt.decode._getBPP(t),s=r>>3,a=Math.ceil(e*r/8),o=new Uint8Array(i*a);let h=0;const l=[0,0,4,0,2,0,1],c=[0,4,0,2,0,1,0],d=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1];let u=0;for(;u<7;){const m=d[u],v=f[u];let b=0,S=0,E=l[u];for(;E<i;)E+=m,S++;let _=c[u];for(;_<e;)_+=v,b++;const x=Math.ceil(b*r/8);dt.decode._filterZero(n,t,h,b,S);let P=0,R=l[u];for(;R<i;){let F=c[u],L=h+P*x<<3;for(;F<e;){if(r===1){let $=n[L>>3];$=$>>7-(L&7)&1,o[R*a+(F>>3)]|=$<<7-((F&7)<<0)}if(r===2){let $=n[L>>3];$=$>>6-(L&7)&3,o[R*a+(F>>2)]|=$<<6-((F&3)<<1)}if(r===4){let $=n[L>>3];$=$>>4-(L&7)&15,o[R*a+(F>>1)]|=$<<4-((F&1)<<2)}if(r>=8){const $=R*a+F*s;for(let U=0;U<s;U++)o[$+U]=n[(L>>3)+U]}L+=r,F+=v}P++,R+=m}b*S!==0&&(h+=S*(1+x)),u=u+1}return o},dt.decode._getBPP=function(n){return[1,null,3,1,2,null,4][n.ctype]*n.depth},dt.decode._filterZero=function(n,t,e,i,r){let s=dt.decode._getBPP(t);const a=Math.ceil(i*s/8),o=dt.decode._paeth;s=Math.ceil(s/8);let h=0,l=1,c=n[e],d=0;if(c>1&&(n[e]=[0,0,1][c-2]),c===3)for(d=s;d<a;d++)n[d+1]=n[d+1]+(n[d+1-s]>>>1)&255;for(let f=0;f<r;f++)if(h=e+f*a,l=h+f+1,c=n[l-1],d=0,c===0)for(;d<a;d++)n[h+d]=n[l+d];else if(c===1){for(;d<s;d++)n[h+d]=n[l+d];for(;d<a;d++)n[h+d]=n[l+d]+n[h+d-s]}else if(c===2)for(;d<a;d++)n[h+d]=n[l+d]+n[h+d-a];else if(c===3){for(;d<s;d++)n[h+d]=n[l+d]+(n[h+d-a]>>>1);for(;d<a;d++)n[h+d]=n[l+d]+(n[h+d-a]+n[h+d-s]>>>1)}else{for(;d<s;d++)n[h+d]=n[l+d]+o(0,n[h+d-a],0);for(;d<a;d++)n[h+d]=n[l+d]+o(n[h+d-s],n[h+d-a],n[h+d-s-a])}return n},dt.decode._paeth=function(n,t,e){const i=n+t-e,r=i-n,s=i-t,a=i-e;return r*r<=s*s&&r*r<=a*a?n:s*s<=a*a?t:e},dt.decode._IHDR=function(n,t,e){const i=dt._bin;e.width=i.readUint(n,t),t+=4,e.height=i.readUint(n,t),t+=4,e.depth=n[t],t++,e.ctype=n[t],t++,e.compress=n[t],t++,e.filter=n[t],t++,e.interlace=n[t],t++},dt._bin={nextZero:function(n,t){for(;n[t]!==0;)t++;return t},readUshort:function(n,t){return n[t]<<8|n[t+1]},writeUshort:function(n,t,e){n[t]=e>>8&255,n[t+1]=e&255},readUint:function(n,t){return n[t]*(256*256*256)+(n[t+1]<<16|n[t+2]<<8|n[t+3])},writeUint:function(n,t,e){n[t]=e>>24&255,n[t+1]=e>>16&255,n[t+2]=e>>8&255,n[t+3]=e&255},readASCII:function(n,t,e){let i="";for(let r=0;r<e;r++)i+=String.fromCharCode(n[t+r]);return i},writeASCII:function(n,t,e){for(let i=0;i<e.length;i++)n[t+i]=e.charCodeAt(i)},readBytes:function(n,t,e){const i=[];for(let r=0;r<e;r++)i.push(n[t+r]);return i},pad:function(n){return n.length<2?"0"+n:n},readUTF8:function(n,t,e){let i="",r;for(let s=0;s<e;s++)i+="%"+dt._bin.pad(n[t+s].toString(16));try{r=decodeURIComponent(i)}catch{return dt._bin.readASCII(n,t,e)}return r}},dt._copyTile=function(n,t,e,i,r,s,a,o,h){const l=Math.min(t,r),c=Math.min(e,s);let d=0,f=0;for(let u=0;u<c;u++)for(let m=0;m<l;m++)if(a>=0&&o>=0?(d=u*t+m<<2,f=(o+u)*r+a+m<<2):(d=(-o+u)*t-a+m<<2,f=u*r+m<<2),h===0)i[f]=n[d],i[f+1]=n[d+1],i[f+2]=n[d+2],i[f+3]=n[d+3];else if(h===1){const v=n[d+3]*.00392156862745098,b=n[d]*v,S=n[d+1]*v,E=n[d+2]*v,_=i[f+3]*(1/255),x=i[f]*_,P=i[f+1]*_,R=i[f+2]*_,F=1-v,L=v+_*F,$=L===0?0:1/L;i[f+3]=255*L,i[f+0]=(b+x*F)*$,i[f+1]=(S+P*F)*$,i[f+2]=(E+R*F)*$}else if(h===2){const v=n[d+3],b=n[d],S=n[d+1],E=n[d+2],_=i[f+3],x=i[f],P=i[f+1],R=i[f+2];v===_&&b===x&&S===P&&E===R?(i[f]=0,i[f+1]=0,i[f+2]=0,i[f+3]=0):(i[f]=b,i[f+1]=S,i[f+2]=E,i[f+3]=v)}else if(h===3){const v=n[d+3],b=n[d],S=n[d+1],E=n[d+2],_=i[f+3],x=i[f],P=i[f+1],R=i[f+2];if(v===_&&b===x&&S===P&&E===R)continue;if(v<220&&_>20)return!1}return!0},dt.encode=function(n,t,e,i,r,s,a){i===null&&(i=0),a===null&&(a=!1);const o=dt.encode.compress(n,t,e,i,[!1,!1,!1,0,a]);return dt.encode.compressPNG(o,-1),dt.encode._main(o,t,e,r,s)},dt.encodeLL=function(n,t,e,i,r,s,a,o){const h={ctype:0+(i===1?0:2)+(r===0?0:4),depth:s,frames:[]},l=(i+r)*s,c=l*t;for(let f=0;f<n.length;f++)h.frames.push({rect:{x:0,y:0,width:t,height:e},img:new Uint8Array(n[f]),blend:0,dispose:1,bpp:Math.ceil(l/8),bpl:Math.ceil(c/8)});return dt.encode.compressPNG(h,0,!0),dt.encode._main(h,t,e,a,o)},dt.encode._main=function(n,t,e,i,r){r||(r={});const s=dt.crc.crc,a=dt._bin.writeUint,o=dt._bin.writeUshort,h=dt._bin.writeASCII;let l=8;const c=n.frames.length>1;let d=!1,f=8+(16+5+4)+(c?20:0);if(r.sRGB!==null&&r.sRGB!==void 0&&(f+=8+1+4),r.pHYs!==null&&r.pHYs!==void 0&&(f+=8+9+4),n.ctype===3){const b=n.plte.length;for(let S=0;S<b;S++)n.plte[S]>>>24!==255&&(d=!0);f+=8+b*3+4+(d?8+b*1+4:0)}for(let b=0;b<n.frames.length;b++){const S=n.frames[b];c&&(f+=38),f+=S.cimg.length+12,b!==0&&(f+=4)}f+=12;const u=new Uint8Array(f),m=[137,80,78,71,13,10,26,10];for(let b=0;b<8;b++)u[b]=m[b];if(a(u,l,13),l+=4,h(u,l,"IHDR"),l+=4,a(u,l,t),l+=4,a(u,l,e),l+=4,u[l]=n.depth,l++,u[l]=n.ctype,l++,u[l]=0,l++,u[l]=0,l++,u[l]=0,l++,a(u,l,s(u,l-17,17)),l+=4,r.sRGB!==null&&r.sRGB!==void 0&&(a(u,l,1),l+=4,h(u,l,"sRGB"),l+=4,u[l]=r.sRGB,l++,a(u,l,s(u,l-5,5)),l+=4),r.pHYs!==null&&r.pHYs!==void 0&&(a(u,l,9),l+=4,h(u,l,"pHYs"),l+=4,a(u,l,r.pHYs[0]),l+=4,a(u,l,r.pHYs[1]),l+=4,u[l]=r.pHYs[2],l++,a(u,l,s(u,l-13,13)),l+=4),c&&(a(u,l,8),l+=4,h(u,l,"acTL"),l+=4,a(u,l,n.frames.length),l+=4,a(u,l,r.loop!=null?r.loop:0),l+=4,a(u,l,s(u,l-12,12)),l+=4),n.ctype===3){const b=n.plte.length;a(u,l,b*3),l+=4,h(u,l,"PLTE"),l+=4;for(let S=0;S<b;S++){const E=S*3,_=n.plte[S],x=_&255,P=_>>>8&255,R=_>>>16&255;u[l+E+0]=x,u[l+E+1]=P,u[l+E+2]=R}if(l+=b*3,a(u,l,s(u,l-b*3-4,b*3+4)),l+=4,d){a(u,l,b),l+=4,h(u,l,"tRNS"),l+=4;for(let S=0;S<b;S++)u[l+S]=n.plte[S]>>>24&255;l+=b,a(u,l,s(u,l-b-4,b+4)),l+=4}}let v=0;for(let b=0;b<n.frames.length;b++){const S=n.frames[b];c&&(a(u,l,26),l+=4,h(u,l,"fcTL"),l+=4,a(u,l,v++),l+=4,a(u,l,S.rect.width),l+=4,a(u,l,S.rect.height),l+=4,a(u,l,S.rect.x),l+=4,a(u,l,S.rect.y),l+=4,o(u,l,i[b]),l+=2,o(u,l,1e3),l+=2,u[l]=S.dispose,l++,u[l]=S.blend,l++,a(u,l,s(u,l-30,30)),l+=4);const E=S.cimg,_=E.length;a(u,l,_+(b===0?0:4)),l+=4;const x=l;h(u,l,b===0?"IDAT":"fdAT"),l+=4,b!==0&&(a(u,l,v++),l+=4),u.set(E,l),l+=_,a(u,l,s(u,x,l-x)),l+=4}return a(u,l,0),l+=4,h(u,l,"IEND"),l+=4,a(u,l,s(u,l-4,4)),l+=4,u.buffer},dt.encode.compressPNG=function(n,t,e){for(let i=0;i<n.frames.length;i++){const r=n.frames[i],s=r.rect.height,a=new Uint8Array(s*r.bpl+s);r.cimg=dt.encode._filterZero(r.img,s,r.bpp,r.bpl,a,t,e)}},dt.encode.compress=function(n,t,e,i,r){const s=r[0],a=r[1],o=r[2],h=r[3],l=r[4];let c=6,d=8,f=255;for(let _=0;_<n.length;_++){const x=new Uint8Array(n[_]),P=x.length;for(let R=0;R<P;R+=4)f&=x[R+3]}const u=f!==255,m=dt.encode.framize(n,t,e,s,a,o),v={},b=[],S=[];if(i!==0){const _=[];for(let L=0;L<m.length;L++)_.push(m[L].img.buffer);const x=dt.encode.concatRGBA(_),P=dt.quantize(x,i);let R=0;const F=new Uint8Array(P.abuf);for(let L=0;L<m.length;L++){const $=m[L].img,U=$.length;S.push(new Uint8Array(P.inds.buffer,R>>2,U>>2));for(let z=0;z<U;z+=4)$[z]=F[R+z],$[z+1]=F[R+z+1],$[z+2]=F[R+z+2],$[z+3]=F[R+z+3];R+=U}for(let L=0;L<P.plte.length;L++)b.push(P.plte[L].est.rgba)}else for(let _=0;_<m.length;_++){const x=m[_],P=new Uint32Array(x.img.buffer),R=x.rect.width,F=P.length,L=new Uint8Array(F);S.push(L);for(let $=0;$<F;$++){const U=P[$];if($!==0&&U===P[$-1])L[$]=L[$-1];else if($>R&&U===P[$-R])L[$]=L[$-R];else{let z=v[U];if(z===null&&(v[U]=z=b.length,b.push(U),b.length>=300))break;L[$]=z}}}const E=b.length;E<=256&&l===!1&&(E<=2?d=1:E<=4?d=2:E<=16?d=4:d=8,d=Math.max(d,h));for(let _=0;_<m.length;_++){const x=m[_],P=x.rect.width,R=x.rect.height;let F=x.img,L=4*P,$=4;if(E<=256&&l===!1){L=Math.ceil(d*P/8);const U=new Uint8Array(L*R),z=S[_];for(let q=0;q<R;q++){const K=q*L,Z=q*P;if(d===8)for(let at=0;at<P;at++)U[K+at]=z[Z+at];else if(d===4)for(let at=0;at<P;at++)U[K+(at>>1)]|=z[Z+at]<<4-(at&1)*4;else if(d===2)for(let at=0;at<P;at++)U[K+(at>>2)]|=z[Z+at]<<6-(at&3)*2;else if(d===1)for(let at=0;at<P;at++)U[K+(at>>3)]|=z[Z+at]<<7-(at&7)*1}F=U,c=3,$=1}else if(u===!1&&m.length===1){const U=new Uint8Array(P*R*3),z=P*R;for(let q=0;q<z;q++){const K=q*3,Z=q*4;U[K]=F[Z],U[K+1]=F[Z+1],U[K+2]=F[Z+2]}F=U,c=2,$=3,L=3*P}x.img=F,x.bpl=L,x.bpp=$}return{ctype:c,depth:d,plte:b,frames:m}},dt.encode.framize=function(n,t,e,i,r,s){const a=[];for(let o=0;o<n.length;o++){const h=new Uint8Array(n[o]),l=new Uint32Array(h.buffer);let c,d=0,f=0,u=t,m=e,v=i?1:0;if(o!==0){const b=s||i||o===1||a[o-2].dispose!==0?1:2;let S=0,E=1e9;for(let x=0;x<b;x++){const P=new Uint32Array(n[o-1-x]);let R=t,F=e,L=-1,$=-1;for(let z=0;z<e;z++)for(let q=0;q<t;q++){const K=z*t+q;l[K]!==P[K]&&(q<R&&(R=q),q>L&&(L=q),z<F&&(F=z),z>$&&($=z))}L===-1&&(R=F=L=$=0),r&&((R&1)===1&&R--,(F&1)===1&&F--);const U=(L-R+1)*($-F+1);U<E&&(E=U,S=x,d=R,f=F,u=L-R+1,m=$-F+1)}const _=new Uint8Array(n[o-1-S]);S===1&&(a[o-1].dispose=2),c=new Uint8Array(u*m*4),dt._copyTile(_,t,e,c,u,m,-d,-f,0),v=dt._copyTile(h,t,e,c,u,m,-d,-f,3)?1:0,v===1?dt.encode._prepareDiff(h,t,e,c,{x:d,y:f,width:u,height:m}):dt._copyTile(h,t,e,c,u,m,-d,-f,0)}else c=h.slice(0);a.push({rect:{x:d,y:f,width:u,height:m},img:c,blend:v,dispose:0})}if(i)for(let o=0;o<a.length;o++){const h=a[o];if(h.blend===1)continue;const l=h.rect,c=a[o-1].rect,d=Math.min(l.x,c.x),f=Math.min(l.y,c.y),u=Math.max(l.x+l.width,c.x+c.width),m=Math.max(l.y+l.height,c.y+c.height),v={x:d,y:f,width:u-d,height:m-f};a[o-1].dispose=1,o-1!==0&&dt.encode._updateFrame(n,t,e,a,o-1,v,r),dt.encode._updateFrame(n,t,e,a,o,v,r)}return a},dt.encode._updateFrame=function(n,t,e,i,r,s,a){const o=Uint8Array,h=Uint32Array,l=new o(n[r-1]),c=new h(n[r-1]),d=r+1<n.length?new o(n[r+1]):null,f=new o(n[r]),u=new h(f.buffer);let m=t,v=e,b=-1,S=-1;for(let _=0;_<s.height;_++)for(let x=0;x<s.width;x++){const P=s.x+x,R=s.y+_,F=R*t+P,L=u[F];L===0||i[r-1].dispose===0&&c[F]===L&&(d===null||d[F*4+3]!==0)||(P<m&&(m=P),P>b&&(b=P),R<v&&(v=R),R>S&&(S=R))}b===-1&&(m=v=b=S=0),a&&((m&1)===1&&m--,(v&1)===1&&v--),s={x:m,y:v,width:b-m+1,height:S-v+1};const E=i[r];E.rect=s,E.blend=1,E.img=new Uint8Array(s.width*s.height*4),i[r-1].dispose===0?(dt._copyTile(l,t,e,E.img,s.width,s.height,-s.x,-s.y,0),dt.encode._prepareDiff(f,t,e,E.img,s)):dt._copyTile(f,t,e,E.img,s.width,s.height,-s.x,-s.y,0)},dt.encode._prepareDiff=function(n,t,e,i,r){dt._copyTile(n,t,e,i,r.width,r.height,-r.x,-r.y,2)},dt.encode._filterZero=function(n,t,e,i,r,s,a){const o=[];let h=[0,1,2,3,4];s!==-1?h=[s]:(t*i>5e5||e===1)&&(h=[0]);let l;a&&(l={level:0});const c=r.length>1e7&&Kc!=null?Kc:yv;for(let u=0;u<h.length;u++){for(let m=0;m<t;m++)dt.encode._filterLine(r,n,m,i,e,h[u]);o.push(c.deflate(r,l))}let d,f=1e9;for(let u=0;u<o.length;u++)o[u].length<f&&(d=u,f=o[u].length);return o[d]},dt.encode._filterLine=function(n,t,e,i,r,s){const a=e*i;let o=a+e;const h=dt.decode._paeth;if(n[o]=s,o++,s===0)if(i<500)for(let l=0;l<i;l++)n[o+l]=t[a+l];else n.set(new Uint8Array(t.buffer,a,i),o);else if(s===1){for(let l=0;l<r;l++)n[o+l]=t[a+l];for(let l=r;l<i;l++)n[o+l]=t[a+l]-t[a+l-r]+256&255}else if(e===0){for(let l=0;l<r;l++)n[o+l]=t[a+l];if(s===2)for(let l=r;l<i;l++)n[o+l]=t[a+l];if(s===3)for(let l=r;l<i;l++)n[o+l]=t[a+l]-(t[a+l-r]>>1)+256&255;if(s===4)for(let l=r;l<i;l++)n[o+l]=t[a+l]-h(t[a+l-r],0,0)+256&255}else{if(s===2)for(let l=0;l<i;l++)n[o+l]=t[a+l]+256-t[a+l-i]&255;if(s===3){for(let l=0;l<r;l++)n[o+l]=t[a+l]+256-(t[a+l-i]>>1)&255;for(let l=r;l<i;l++)n[o+l]=t[a+l]+256-(t[a+l-i]+t[a+l-r]>>1)&255}if(s===4){for(let l=0;l<r;l++)n[o+l]=t[a+l]+256-h(0,t[a+l-i],0)&255;for(let l=r;l<i;l++)n[o+l]=t[a+l]+256-h(t[a+l-r],t[a+l-i],t[a+l-r-i])&255}}},dt.crc={table:function(){const n=new Uint32Array(256);for(let t=0;t<256;t++){let e=t;for(let i=0;i<8;i++)e&1?e=3988292384^e>>>1:e=e>>>1;n[t]=e}return n}(),update:function(n,t,e,i){for(let r=0;r<i;r++)n=dt.crc.table[(n^t[e+r])&255]^n>>>8;return n},crc:function(n,t,e){return dt.crc.update(4294967295,n,t,e)^4294967295}},dt.quantize=function(n,t){const e=new Uint8Array(n),i=e.slice(0),r=new Uint32Array(i.buffer),s=dt.quantize.getKDtree(i,t),a=s[0],o=s[1],h=dt.quantize.planeDst,l=e,c=r,d=l.length,f=new Uint8Array(e.length>>2);let u;if(e.length<2e7)for(let m=0;m<d;m+=4){const v=l[m]*.00392156862745098,b=l[m+1]*(1/255),S=l[m+2]*(1/255),E=l[m+3]*(1/255);u=dt.quantize.getNearest(a,v,b,S,E),f[m>>2]=u.ind,c[m>>2]=u.est.rgba}else for(let m=0;m<d;m+=4){const v=l[m]*.00392156862745098,b=l[m+1]*(1/255),S=l[m+2]*(1/255),E=l[m+3]*(1/255);for(u=a;u.left;)u=h(u.est,v,b,S,E)<=0?u.left:u.right;f[m>>2]=u.ind,c[m>>2]=u.est.rgba}return{abuf:i.buffer,inds:f,plte:o}},dt.quantize.getKDtree=function(n,t,e){e===null&&(e=1e-4);const i=new Uint32Array(n.buffer),r={i0:0,i1:n.length,bst:null,est:null,tdst:0,left:null,right:null};r.bst=dt.quantize.stats(n,r.i0,r.i1),r.est=dt.quantize.estats(r.bst);const s=[r];for(;s.length<t;){let a=0,o=0;for(let u=0;u<s.length;u++)s[u].est.L>a&&(a=s[u].est.L,o=u);if(a<e)break;const h=s[o],l=dt.quantize.splitPixels(n,i,h.i0,h.i1,h.est.e,h.est.eMq255);if(h.i0>=l||h.i1<=l){h.est.L=0;continue}const d={i0:h.i0,i1:l,bst:null,est:null,tdst:0,left:null,right:null};d.bst=dt.quantize.stats(n,d.i0,d.i1),d.est=dt.quantize.estats(d.bst);const f={i0:l,i1:h.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:h.bst.N-d.bst.N};for(let u=0;u<16;u++)f.bst.R[u]=h.bst.R[u]-d.bst.R[u];for(let u=0;u<4;u++)f.bst.m[u]=h.bst.m[u]-d.bst.m[u];f.est=dt.quantize.estats(f.bst),h.left=d,h.right=f,s[o]=d,s.push(f)}s.sort(function(a,o){return o.bst.N-a.bst.N});for(let a=0;a<s.length;a++)s[a].ind=a;return[r,s]},dt.quantize.getNearest=function(n,t,e,i,r){if(n.left==null)return n.tdst=dt.quantize.dist(n.est.q,t,e,i,r),n;const s=dt.quantize.planeDst(n.est,t,e,i,r);let a=n.left,o=n.right;s>0&&(a=n.right,o=n.left);const h=dt.quantize.getNearest(a,t,e,i,r);if(h.tdst<=s*s)return h;const l=dt.quantize.getNearest(o,t,e,i,r);return l.tdst<h.tdst?l:h},dt.quantize.planeDst=function(n,t,e,i,r){const s=n.e;return s[0]*t+s[1]*e+s[2]*i+s[3]*r-n.eMq},dt.quantize.dist=function(n,t,e,i,r){const s=t-n[0],a=e-n[1],o=i-n[2],h=r-n[3];return s*s+a*a+o*o+h*h},dt.quantize.splitPixels=function(n,t,e,i,r,s){const a=dt.quantize.vecDot;for(i-=4;e<i;){for(;a(n,e,r)<=s;)e+=4;for(;a(n,i,r)>s;)i-=4;if(e>=i)break;const o=t[e>>2];t[e>>2]=t[i>>2],t[i>>2]=o,e+=4,i-=4}for(;a(n,e,r)>s;)e-=4;return e+4},dt.quantize.vecDot=function(n,t,e){return n[t]*e[0]+n[t+1]*e[1]+n[t+2]*e[2]+n[t+3]*e[3]},dt.quantize.stats=function(n,t,e){const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=[0,0,0,0],s=e-t>>2;for(let a=t;a<e;a+=4){const o=n[a]*.00392156862745098,h=n[a+1]*(1/255),l=n[a+2]*(1/255),c=n[a+3]*(1/255);r[0]+=o,r[1]+=h,r[2]+=l,r[3]+=c,i[0]+=o*o,i[1]+=o*h,i[2]+=o*l,i[3]+=o*c,i[5]+=h*h,i[6]+=h*l,i[7]+=h*c,i[10]+=l*l,i[11]+=l*c,i[15]+=c*c}return i[4]=i[1],i[8]=i[2],i[9]=i[6],i[12]=i[3],i[13]=i[7],i[14]=i[11],{R:i,m:r,N:s}},dt.quantize.estats=function(n){const t=n.R,e=n.m,i=n.N,r=e[0],s=e[1],a=e[2],o=e[3],h=i===0?0:1/i,l=[t[0]-r*r*h,t[1]-r*s*h,t[2]-r*a*h,t[3]-r*o*h,t[4]-s*r*h,t[5]-s*s*h,t[6]-s*a*h,t[7]-s*o*h,t[8]-a*r*h,t[9]-a*s*h,t[10]-a*a*h,t[11]-a*o*h,t[12]-o*r*h,t[13]-o*s*h,t[14]-o*a*h,t[15]-o*o*h],c=l,d=dt.M4;let f=[Math.random(),Math.random(),Math.random(),Math.random()],u=0,m=0;if(i!==0)for(let S=0;S<16&&(f=d.multVec(c,f),m=Math.sqrt(d.dot(f,f)),f=d.sml(1/m,f),!(S!==0&&Math.abs(m-u)<1e-9));S++)u=m;const v=[r*h,s*h,a*h,o*h],b=d.dot(d.sml(255,v),f);return{Cov:l,q:v,e:f,L:u,eMq255:b,eMq:d.dot(f,v),rgba:(Math.round(255*v[3])<<24|Math.round(255*v[2])<<16|Math.round(255*v[1])<<8|Math.round(255*v[0])<<0)>>>0}},dt.M4={multVec:function(n,t){return[n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3],n[4]*t[0]+n[5]*t[1]+n[6]*t[2]+n[7]*t[3],n[8]*t[0]+n[9]*t[1]+n[10]*t[2]+n[11]*t[3],n[12]*t[0]+n[13]*t[1]+n[14]*t[2]+n[15]*t[3]]},dot:function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]},sml:function(n,t){return[n*t[0],n*t[1],n*t[2],n*t[3]]}},dt.encode.concatRGBA=function(n){let t=0;for(let r=0;r<n.length;r++)t+=n[r].byteLength;const e=new Uint8Array(t);let i=0;for(let r=0;r<n.length;r++){const s=new Uint8Array(n[r]),a=s.length;for(let o=0;o<a;o+=4){let h=s[o],l=s[o+1],c=s[o+2];const d=s[o+3];d===0&&(h=l=c=0),e[i+o]=h,e[i+o+1]=l,e[i+o+2]=c,e[i+o+3]=d}i+=a}return e.buffer};const wv=dt,La=new Map,Mh=(n,t)=>{if(La.has(n))return t(null,La.get(n));const e=new Image;e.onload=function(){La.set(n,{width:e.width,height:e.height,element:e}),t(null,La.get(n))},e.onerror=function(i){t(i,null)},e.src=n},bv=(n,t)=>{for(let e=0,i=n.length;e<i;e++){const r=n[e],{type:s}=r;if(s.split("/")[0]!=="image")return;const o=new FileReader;o.onload=function(h){if(!h.target)return t("no reader target",null);const l=h.target.result,c=Ol(l),d=new Blob([l]);Rh(d,(f,u)=>{if(!u)return t(f,null);Mh(u,(m,v)=>{if(!v)return t(m,null);yf(u,(b,S)=>{if(!S)return t(b,null);const E={name:r.name,fileType:c,size:r.size,width:v.width,height:v.height,imgUrl:u,imageData:S,blob:d};return t(null,E)})})})},o.readAsArrayBuffer(r)}},yf=(n,t)=>{Mh(n,(e,i)=>{if(!i)return t(e,null);const r=document.createElement("canvas"),s=r.getContext("2d");r.width=i.width,r.height=i.height,s.drawImage(i.element,0,0,r.width,r.height);const a=s.getImageData(0,0,r.width,r.height);return t(null,a)})},xv=(n,t=0,e=0)=>{const i=document.createElement("canvas"),r=i.getContext("2d");return i.width=t,i.height=e,r.drawImage(n,0,0,t,e),r.getImageData(0,0,t,e)},Sv=(n,t=0,e=0)=>{const i=document.createElement("canvas"),r=i.getContext("2d");return i.width=t,i.height=e,r.drawImage(n,0,0,t,e),r.getImageData(0,0,t,e)},Cv=n=>{const t=n.width,e=n.height,i=t*e*3,r=i+54,s=[66,77,r&255,r>>8&255,r>>16&255,r>>24&255,0,0,0,0,54,0,0,0],a=[40,0,0,0,t&255,t>>8&255,t>>16&255,t>>24&255,e&255,e>>8&255,e>>16&255,e>>24&255,1,0,24,0,0,0,0,0,i&255,i>>8&255,i>>16&255,i>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=(4-t*3%4)%4,h=n.data;let l="";const c=t<<2;let d=e;const f=String.fromCharCode;do{const m=c*(d-1);let v="";for(let b=0;b<t;b++){const S=b<<2;v+=f(h[m+S+2])+f(h[m+S+1])+f(h[m+S])}for(let b=0;b<o;b++)v+=String.fromCharCode(0);l+=v}while(--d);function u(m){if(!window.btoa)throw"btoa undefined";let v="";if(typeof m=="string")v=m;else for(let b=0;b<m.length;b++)v+=String.fromCharCode(m[b]);return btoa(v)}return u(s.concat(a))+u(l)},Tv=n=>{const{width:t,height:e}=n,i=document.createElement("canvas"),r=i.getContext("2d");return i.width=t,i.height=e,r.putImageData(n,0,0,0,0,t,e),i.toDataURL("image/png")},kv=(n,t,e)=>{const{width:i,height:r}=n,s=document.createElement("canvas"),a=s.getContext("2d");s.width=i,s.height=r,a.putImageData(n,0,0,0,0,i,r);const o=`image/${t?t.toLowerCase():"png"}`;s.toBlob(h=>{e?.(null,h)},o,1)},Rh=(n,t)=>{const e=new FileReader;e.onload=function(i){i.target?t(null,i.target.result):t("can't readAsDataURL",null)},e.readAsDataURL(n)},Ev=(n,t)=>{Rh(n,function(e,i){if(i){const r=new Image;r.src=i}else t(e)})};function Pv(n){const t=[],e=[],i=[];let r=0;for(let h=0,l=n.data.length;h<l;h+=4)t[r]=n.data[h],e[r]=n.data[h+1],i[r]=n.data[h+2],r+=1;const s=Dh(t),a=Dh(e),o=Dh(i);return"rgb("+s+","+a+","+o+")"}function Dh(n){const t={},e=[],i=[];for(let o=0;o<n.length;o++)t[n[o]]?e.push(n[o]):t[n[o]]=1;let r=0;for(let o=0;o<e.length;o++){r=0;for(let h=0;h<e.length;h++)e[o]===e[h]&&(r+=1),i[o]=r}const s=Math.max.apply(null,i);let a=0;for(;a<i.length;a++)if(i[a]===s)return;return e[a]}const Av=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[(a*e+e-o-1)*4],r[h+1]=t[(a*e+e-o-1)*4+1],r[h+2]=t[(a*e+e-o-1)*4+2],r[h+3]=t[(a*e+e-o-1)*4+3]}return new ImageData(r,e,i)},Mv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[((i-a-1)*e+o)*4],r[h+1]=t[((i-a-1)*e+o)*4+1],r[h+2]=t[((i-a-1)*e+o)*4+2],r[h+3]=t[((i-a-1)*e+o)*4+3]}return new ImageData(r,e,i)},Rv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<i;o++){const h=(a*i+o)*4;r[h]=t[(o*e+e-a-1)*4],r[h+1]=t[(o*e+e-a-1)*4+1],r[h+2]=t[(o*e+e-a-1)*4+2],r[h+3]=t[(o*e+e-a-1)*4+3]}return new ImageData(r,i,e)},Dv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<i;o++){const h=(a*i+o)*4;r[h]=t[((i-o-1)*e+a)*4],r[h+1]=t[((i-o-1)*e+a)*4+1],r[h+2]=t[((i-o-1)*e+a)*4+2],r[h+3]=t[((i-o-1)*e+a)*4+3]}return new ImageData(r,i,e)},Lv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+1]+t[h+2])/3;r[h]=l,r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Iv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=.2126*t[h]+.7152*t[h+1]+.0722*t[h+2];r[h]=l,r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Ov=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+1]+t[h+2])/3>127?255:0;r[h]=c,r[h+1]=c,r[h+2]=c,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Fv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=255-t[h],r[h+1]=255-t[h+1],r[h+2]=255-t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,i)},Nv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=0,r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Gv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=t[h+1],r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Uv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=0,r[h+2]=t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,i)},Bv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=t[h+1],r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,i)},zv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=0,r[h+2]=t[h+1],r[h+3]=t[h+3]}return new ImageData(r,e,i)},$v=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=t[h+1],r[h+2]=t[h+1],r[h+3]=t[h+3]}return new ImageData(r,e,i)},Vv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h+1]+t[h+2])/2;r[h]=t[h],r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Hv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+2])/2;r[h]=l,r[h+1]=t[h+1],r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,i)},jv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+1])/2;r[h]=l,r[h+1]=l,r[h+2]=t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,i)},Xv=n=>wf(n,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Yv=n=>wf(n,[-1,-1,-1,-1,8,-1,-1,-1,-1]),qv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=t[h+1],r[h+2]=t[h+2],r[h+3]=255}return new ImageData(r,e,i)},Wv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;if(t[h+3]===0)r[h]=255,r[h+1]=255,r[h+2]=255,r[h+3]=255;else{const l=bf([t[h],t[h+1],t[h+2],t[h+3]],[255,255,255,255]);r[h]=l[0],r[h+1]=l[1],r[h+2]=l[2],r[h+3]=l[3]}}return new ImageData(r,e,i)},Kv=(n,t,e,i,r,s=!1,a)=>{const{data:o,width:h,height:l}=n;let c=r,d=i,f=t,u=e;if(c<0?c=0:c>h&&(c=h),d<0?d=0:d>l&&(d=l),f<1?f=1:f>h&&(f=h),u<1?u=1:u>l&&(u=l),c+f>h&&(f=h-c),d+u>l&&(u=l-d),s){const m=new Uint8ClampedArray(o.length);for(let b=0;b<l;b++)for(let S=0;S<h;S++){const E=(b*h+S)*4;S>=c&&S<=c+f&&b>=d&&b<=d+u?(m[E]=o[E],m[E+1]=o[E+1],m[E+2]=o[E+2],m[E+3]=o[E+3]):(m[E]=255,m[E+1]=255,m[E+2]=255,m[E+3]=a&&["JPG","JPEG"].includes(a.toUpperCase())?255:0)}return new ImageData(m,h,l)}else{const m=new Uint8ClampedArray(f*u*4);for(let b=d;b<=d+u;b++)for(let S=c;S<=c+f;S++){const E=((b-d)*f+S-c)*4,_=(b*h+S)*4;m[E]=o[_],m[E+1]=o[_+1],m[E+2]=o[_+2],m[E+3]=o[_+3]}return new ImageData(m,f,u)}},Zv=(n,t,e,i)=>{const{data:r,width:s,height:a}=n;let o=t;o>Math.floor(s/2)&&(o=Math.floor(s/2)),o>Math.floor(a/2)&&(o=Math.floor(a/2)),o<0&&(o=0);const h=new Uint8ClampedArray(r.length);for(let c=0;c<a;c++)for(let d=0;d<s;d++){const f=(c*s+d)*4;let u=-1;d<o?c<o?u=Math.sqrt(Math.pow(o-d-1,2)+Math.pow(o-c-1,2)):c>a-o-1&&(u=Math.sqrt(Math.pow(o-d-1,2)+Math.pow(c-(a-o),2))):d>s-o-1&&(c<o?u=Math.sqrt(Math.pow(d-(s-o),2)+Math.pow(o-c-1,2)):c>a-o-1&&(u=Math.sqrt(Math.pow(d-(s-o),2)+Math.pow(c-(a-o),2)))),Math.round(u)>o?(h[f]=255,h[f+1]=255,h[f+2]=255,h[f+3]=i||e.toUpperCase()==="PNG"?0:255):(h[f]=r[f],h[f+1]=r[f+1],h[f+2]=r[f+2],h[f+3]=i||e.toUpperCase()==="PNG"?r[f+3]:255)}return new ImageData(h,s,a)},Jv=(n,t,e,i,r,s=1e4)=>{const a=new Image;a.src=n;const o=document.createElement("canvas"),h=o.getContext("2d");return o.width=s,o.height=s,h.drawImage(a,0,0,t,e,0,0,i,r),h.getImageData(0,0,i,r)},Qv=(n,t)=>{const{data:e,width:i,height:r}=n,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let h=0;h<i;h++){const l=(o*i+h)*4;s[l]=Math.max(Math.min(e[l]+t,255),0),s[l+1]=Math.max(Math.min(e[l+1]+t,255),0),s[l+2]=Math.max(Math.min(e[l+2]+t,255),0),s[l+3]=e[l+3]}return new ImageData(s,i,r)},t_=(n,t,e=!1)=>{const{data:i,width:r,height:s}=n,a=new Uint8ClampedArray(i.length);for(let h=0;h<s;h++)for(let l=0;l<r;l++){const c=(h*r+l)*4;i[c+3]===0?(a[c]=255,a[c+1]=255,a[c+2]=255):(a[c]=i[c],a[c+1]=i[c+1],a[c+2]=i[c+2]);let d=i[c+3];e?d=Math.max(Math.min(Math.floor(255*t),255),0):d=Math.max(Math.min(Math.floor(d+255*t),255),0),a[c+3]=d}return new ImageData(a,r,s)},e_=(n,t,e,i)=>{const{data:r,width:s,height:a}=n,{data:o,width:h,height:l}=t;let c=e,d=i;e+l>a&&(c=a-l),i+h>s&&(d=s-h);const f=new Uint8ClampedArray(r.length);for(let m=0;m<a;m++)for(let v=0;v<s;v++){const b=(m*s+v)*4;if(v<d||v>d+h||m<=c||m>=c+l)f[b]=r[b],f[b+1]=r[b+1],f[b+2]=r[b+2],f[b+3]=r[b+3];else{const S=(m*s+v-((c+1)*s+(m-(c+1))*(s-h))+h-d-1)*4,E=[o[S],o[S+1],o[S+2],o[S+3]],_=[r[b],r[b+1],r[b+2],r[b+3]],x=bf(E,_);f[b]=x[0],f[b+1]=x[1],f[b+2]=x[2],f[b+3]=x[3]}}return new ImageData(f,s,a)},i_=(n,t,e,i,r,s=10)=>{const{data:a,width:o,height:h}=n;let l=r,c=i,d=t,f=e;l<0?l=0:l>o&&(l=o),c<0?c=0:c>h&&(c=h),d<1?d=1:d>o&&(d=o),f<1?f=1:f>h&&(f=h),l+d>o&&(d=o-l),c+f>h&&(f=h-c);const u=new Uint8ClampedArray(a.length);for(let v=0;v<h;v++)for(let b=0;b<o;b++){const S=(v*o+b)*4;if(b>=l&&b<=l+d&&v>=c&&v<=c+f){const E=Math.floor((b-l)/s),_=Math.floor((v-c)/s);let x=Math.floor(s*(E+1)-s/2+l),P=Math.floor(s*(_+1)-s/2+c);x>o-1&&(x=o-1),P>h-1&&(P=h-1);const R=(P*o+x)*4;u[S]=a[R],u[S+1]=a[R+1],u[S+2]=a[R+2],u[S+3]=a[R+3]}else u[S]=a[S],u[S+1]=a[S+1],u[S+2]=a[S+2],u[S+3]=a[S+3]}return new ImageData(u,o,h)},n_=async(n,t,e,i,r,s)=>{const a=r/100;if(["JPG","JPEG"].includes(i.toUpperCase())){const o=new Image;o.src=n;const h=document.createElement("canvas"),l=h.getContext("2d");h.width=t,h.height=e,l.drawImage(o,0,0,t,e),h.toBlob(c=>{s(c)},`image/${i.toLowerCase()}`,a)}else{const o=Math.floor(a*256),h=wv.encode([n.data.buffer],t,e,o),l=new Blob([h]);s&&s(l)}},r_=(n,t,e={backgroundColor:{r:0,g:0,b:0,a:255},changeIntoColor:{r:0,g:0,b:0,a:0}})=>{if(t&&e){const{data:i,width:r,height:s}=n,{data:a}=t,o=new Uint8ClampedArray(i.length),{backgroundColor:h,changeIntoColor:l}=e;for(let d=0;d<s;d++)for(let f=0;f<r;f++){const u=(d*r+f)*4,m=a[u],v=a[u+1],b=a[u+2],S=a[u+3];m===h.r&&v===h.g&&b===h.b&&S===h.a&&l.a!==0?(o[u]=l.r,o[u+1]=l.g,o[u+2]=l.b,o[u+3]=l.a):(o[u]=i[u],o[u+1]=i[u+1],o[u+2]=i[u+2],o[u+3]=i[u+3])}return new ImageData(o,r,s)}return n},wf=(n,t)=>{const{data:e,width:i,height:r}=n,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let h=0;h<i;h++){const l=(o*i+h)*4;for(let c=0;c<3;c++){const d=l+c;h===0||h===i-1||o===0||o===r-1?s[d]=e[d]:s[d]=t[0]*e[d-i*4-4]+t[1]*e[d-i*4]+t[2]*e[d-i*4+4]+t[3]*e[d-4]+t[4]*e[d]+t[5]*e[d+4]+t[6]*e[d+i*4-4]+t[7]*e[d+i*4]+t[8]*e[d+i*4+4]}s[l+3]=e[l+3]}return new ImageData(s,i,r)},bf=(n,t)=>{if(n&&n.length===4&&t&&t.length===4){const e=n[3],i=t[3];if(e===255||i===0)return n;if(e===0)return t;{const r=e/255,s=i/255,a=Math.max(Math.min(Math.floor(n[0]*r+t[0]*s*(1-r)),255),0),o=Math.max(Math.min(Math.floor(n[1]*r+t[1]*s*(1-r)),255),0),h=Math.max(Math.min(Math.floor(n[2]*r+t[2]*s*(1-r)),255),0),l=Math.max(Math.min(Math.floor((r+s*(1-r))*255),255),0);return[a,o,h,l]}}return[255,255,255,255]},xf=function(n,t,e){const i=new Array(n*n),r=function(o){const h=o;let l=0,c=0;return{write(d,f){if(d>>>f)throw new Error("length over");for(;l+f>=8;)h.writeByte(255&(d<<l|c)),f-=8-l,d>>>=8-l,c=0,l=0;c=d<<l|c,l=l+f},flush(){l>0&&h.writeByte(c)}}},s=function(o){const h=1<<o,l=(1<<o)+1;let c=o+1;const d=a();for(let b=0;b<h;b++)d.add(String.fromCharCode(b));d.add(String.fromCharCode(h)),d.add(String.fromCharCode(l));const f=Fl(),u=r(f);u.write(h,c);let m=0,v=String.fromCharCode(i[m]);for(m+=1;m<i.length;){const b=String.fromCharCode(i[m]);m+=1,d.contains(v+b)?v=v+b:(u.write(d.indexOf(v),c),d.size()<4095&&(d.size()==1<<c&&(c+=1),d.add(v+b)),v=b)}return u.write(d.indexOf(v),c),u.write(l,c),u.flush(),f.toByteArray()},a=function(){const o={};let h=0;return{add(l){if(this.contains(l))throw new Error("dup key:"+l);o[l]=h,h+=1},size(){return h},indexOf(l){return o[l]},contains(l){return typeof o[l]<"u"}}};return{setPixel(o,h,l){i[h*n+o]=l},write(o){o.writeString("GIF87a"),o.writeShort(n),o.writeShort(n),o.writeByte(128),o.writeByte(0),o.writeByte(0),o.writeByte($n("0x"+t[1]+t[2])),o.writeByte($n("0x"+t[3]+t[4])),o.writeByte($n("0x"+t[5]+t[6])),o.writeByte($n("0x"+e[1]+e[2])),o.writeByte($n("0x"+e[3]+e[4])),o.writeByte($n("0x"+e[5]+e[6])),o.writeString(","),o.writeShort(0),o.writeShort(0),o.writeShort(n),o.writeShort(n),o.writeByte(0);const h=2,l=s(h);o.writeByte(h);let c=0;for(;l.length-c>255;)o.writeByte(255),o.writeBytes(l,c,255),c+=255;o.writeByte(l.length-c),o.writeBytes(l,c,l.length-c),o.writeByte(0),o.writeString(";")}}},Sf=function(n,t,e,i){const r=xf(n,t,e);for(let l=0;l<n;l++)for(let c=0;c<n;c++)r.setPixel(c,l,i(c,l));const s=Fl();r.write(s);const a=L1(),o=s.toByteArray();for(let l=0,c=o.length;l<c;l++)a.writeByte(o[l]);a.flush();let h="";return h+="data:image/gif;base64,",h+=a,h},Ne={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Qr={M:0,L:1,H:2,Q:3},Wi={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},pe={glog:function(n){if(n<1)throw new Error("glog("+n+")");return pe.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return pe.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(let n=0;n<8;n++)pe.EXP_TABLE[n]=1<<n;for(let n=8;n<256;n++)pe.EXP_TABLE[n]=pe.EXP_TABLE[n-4]^pe.EXP_TABLE[n-5]^pe.EXP_TABLE[n-6]^pe.EXP_TABLE[n-8];for(let n=0;n<255;n++)pe.LOG_TABLE[pe.EXP_TABLE[n]]=n;const ie={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(n){let t=n<<10;for(;ie.getBCHDigit(t)-ie.getBCHDigit(ie.G15)>=0;)t^=ie.G15<<ie.getBCHDigit(t)-ie.getBCHDigit(ie.G15);return(n<<10|t)^ie.G15_MASK},getBCHTypeNumber:function(n){let t=n<<12;for(;ie.getBCHDigit(t)-ie.getBCHDigit(ie.G18)>=0;)t^=ie.G18<<ie.getBCHDigit(t)-ie.getBCHDigit(ie.G18);return n<<12|t},getBCHDigit:function(n){let t=0;for(;n!=0;)t++,n>>>=1;return t},getPatternPosition:function(n){return ie.PATTERN_POSITION_TABLE[n-1]},getMask:function(n,t,e){switch(n){case Wi.PATTERN000:return(t+e)%2==0;case Wi.PATTERN001:return t%2==0;case Wi.PATTERN010:return e%3==0;case Wi.PATTERN011:return(t+e)%3==0;case Wi.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2==0;case Wi.PATTERN101:return t*e%2+t*e%3==0;case Wi.PATTERN110:return(t*e%2+t*e%3)%2==0;case Wi.PATTERN111:return(t*e%3+(t+e)%2)%2==0;default:throw new Error("bad maskPattern:"+n)}},getErrorCorrectPolynomial:function(n){let t=new er([1],0);for(let e=0;e<n;e++)t=t.multiply(new er([1,pe.gexp(e)],0));return t},getLengthInBits:function(n,t){if(1<=t&&t<10)switch(n){case Ne.MODE_NUMBER:return 10;case Ne.MODE_ALPHA_NUM:return 9;case Ne.MODE_8BIT_BYTE:return 8;case Ne.MODE_KANJI:return 8;default:throw new Error("mode:"+n)}else if(t<27)switch(n){case Ne.MODE_NUMBER:return 12;case Ne.MODE_ALPHA_NUM:return 11;case Ne.MODE_8BIT_BYTE:return 16;case Ne.MODE_KANJI:return 10;default:throw new Error("mode:"+n)}else if(t<41)switch(n){case Ne.MODE_NUMBER:return 14;case Ne.MODE_ALPHA_NUM:return 13;case Ne.MODE_8BIT_BYTE:return 16;case Ne.MODE_KANJI:return 12;default:throw new Error("mode:"+n)}else throw new Error("type:"+t)},getLostPoint:function(n){const t=n.getModuleCount();let e=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++){let o=0;const h=n.isDark(s,a);for(let l=-1;l<=1;l++)if(!(s+l<0||t<=s+l))for(let c=-1;c<=1;c++)a+c<0||t<=a+c||l==0&&c==0||h==n.isDark(s+l,a+c)&&o++;o>5&&(e+=3+o-5)}for(let s=0;s<t-1;s++)for(let a=0;a<t-1;a++){let o=0;n.isDark(s,a)&&o++,n.isDark(s+1,a)&&o++,n.isDark(s,a+1)&&o++,n.isDark(s+1,a+1)&&o++,(o==0||o==4)&&(e+=3)}for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)n.isDark(s,a)&&!n.isDark(s,a+1)&&n.isDark(s,a+2)&&n.isDark(s,a+3)&&n.isDark(s,a+4)&&!n.isDark(s,a+5)&&n.isDark(s,a+6)&&(e+=40);for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)n.isDark(a,s)&&!n.isDark(a+1,s)&&n.isDark(a+2,s)&&n.isDark(a+3,s)&&n.isDark(a+4,s)&&!n.isDark(a+5,s)&&n.isDark(a+6,s)&&(e+=40);let i=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++)n.isDark(a,s)&&i++;const r=Math.abs(100*i/t/t-50)/5;return e+=r*10,e}};class er{num;constructor(t,e){if(t.length==null)throw new Error(t.length+"/"+e);let i=0;for(;i<t.length&&t[i]==0;)i++;this.num=new Array(t.length-i+e);for(let r=0;r<t.length-i;r++)this.num[r]=t[r+i]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let i=0;i<this.getLength();i++)for(let r=0;r<t.getLength();r++)e[i+r]^=pe.gexp(pe.glog(this.get(i))+pe.glog(t.get(r)));return new er(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=pe.glog(this.get(0))-pe.glog(t.get(0)),i=new Array(this.getLength());for(let r=0;r<this.getLength();r++)i[r]=this.get(r);for(let r=0;r<t.getLength();r++)i[r]^=pe.gexp(pe.glog(t.get(r))+e);return new er(i,0).mod(t)}}class bi{totalCount;dataCount;constructor(t,e){this.totalCount=t,this.dataCount=e}static RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];static getRSBlocks(t,e){const i=bi.getRsBlockTable(t,e);if(i==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);const r=i.length/3,s=[];for(let a=0;a<r;a++){const o=i[a*3+0],h=i[a*3+1],l=i[a*3+2];for(let c=0;c<o;c++)s.push(new bi(h,l))}return s}static getRsBlockTable(t,e){switch(e){case Qr.L:return bi.RS_BLOCK_TABLE[(t-1)*4+0];case Qr.M:return bi.RS_BLOCK_TABLE[(t-1)*4+1];case Qr.Q:return bi.RS_BLOCK_TABLE[(t-1)*4+2];case Qr.H:return bi.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}class Cf{buffer;length;constructor(){this.buffer=[],this.length=0}get(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1}put(t,e){for(let i=0;i<e;i++)this.putBit((t>>>e-i-1&1)==1)}getLengthInBits(){return this.length}putBit(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}class s_{mode;data;constructor(t){this.mode=Ne.MODE_8BIT_BYTE,this.data=t}getLength(){return this.data.length}write(t){for(let e=0,i=this.data.length;e<i;e++)t.put(this.data.charCodeAt(e),8)}}class Ki{static PAD0=236;static PAD1=17;typeNumber;errorCorrectLevel;modules;moduleCount;dataCache;dataList;constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=Qr[e],this.modules=[],this.moduleCount=0,this.dataCache=null,this.dataList=[]}addData(t){const e=new s_(t);this.dataList.push(e),this.dataCache=null}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){if(this.typeNumber<1){let t=1;for(t=1;t<40;t++){const e=bi.getRSBlocks(t,this.errorCorrectLevel),i=new Cf;let r=0;for(let s=0;s<e.length;s++)r+=e[s].dataCount;for(let s=0;s<this.dataList.length;s++){const a=this.dataList[s];i.put(a.mode,4),i.put(a.getLength(),ie.getLengthInBits(a.mode,t)),a.write(i)}if(i.getLengthInBits()<=r*8)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let i=0;i<this.moduleCount;i++){this.modules[i]=new Array(this.moduleCount);for(let r=0;r<this.moduleCount;r++)this.modules[i][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Ki.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let i=-1;i<=7;i++)if(!(t+i<=-1||this.moduleCount<=t+i))for(let r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(0<=i&&i<=6&&(r==0||r==6)||0<=r&&r<=6&&(i==0||i==6)||2<=i&&i<=4&&2<=r&&r<=4?this.modules[t+i][e+r]=!0:this.modules[t+i][e+r]=!1)}getBestMaskPattern(){let t=0,e=0;for(let i=0;i<8;i++){this.makeImpl(!0,i);const r=ie.getLostPoint(this);(i==0||t>r)&&(t=r,e=i)}return e}createMovieClip(t,e,i){const r=t.createEmptyMovieClip(e,i),s=1;this.make();for(let a=0;a<this.modules.length;a++){const o=a*s;for(let h=0;h<this.modules[a].length;h++){const l=h*s;this.modules[a][h]&&(r.beginFill(0,100),r.moveTo(l,o),r.lineTo(l+s,o),r.lineTo(l+s,o+s),r.lineTo(l,o+s),r.endFill())}}return r}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)this.modules[t][6]==null&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=ie.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let i=0;i<t.length;i++){const r=t[e],s=t[i];if(this.modules[r][s]==null)for(let a=-2;a<=2;a++)for(let o=-2;o<=2;o++)a==-2||a==2||o==-2||o==2||a==0&&o==0?this.modules[r+a][s+o]=!0:this.modules[r+a][s+o]=!1}}setupTypeNumber(t){const e=ie.getBCHTypeNumber(this.typeNumber);for(let i=0;i<18;i++){const r=!t&&(e>>i&1)==1;this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=r}for(let i=0;i<18;i++){const r=!t&&(e>>i&1)==1;this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r}}setupTypeInfo(t,e){const i=this.errorCorrectLevel<<3|e,r=ie.getBCHTypeInfo(i);for(let s=0;s<15;s++){const a=!t&&(r>>s&1)==1;s<6?this.modules[s][8]=a:s<8?this.modules[s+1][8]=a:this.modules[this.moduleCount-15+s][8]=a}for(let s=0;s<15;s++){const a=!t&&(r>>s&1)==1;s<8?this.modules[8][this.moduleCount-s-1]=a:s<9?this.modules[8][15-s-1+1]=a:this.modules[8][15-s-1]=a}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let i=-1,r=this.moduleCount-1,s=7,a=0;for(let o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(let h=0;h<2;h++)if(this.modules[r][o-h]==null){let l=!1;a<t.length&&(l=(t[a]>>>s&1)==1),ie.getMask(e,r,o-h)&&(l=!l),this.modules[r][o-h]=l,s--,s==-1&&(a++,s=7)}if(r+=i,r<0||this.moduleCount<=r){r-=i,i=-i;break}}}static createData(t,e,i){const r=bi.getRSBlocks(t,e),s=new Cf;for(let o=0;o<i.length;o++){const h=i[o];s.put(h.mode,4),s.put(h.getLength(),ie.getLengthInBits(h.mode,t)),h.write(s)}let a=0;for(let o=0;o<r.length;o++)a+=r[o].dataCount;if(s.getLengthInBits()>a*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put(Ki.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Ki.PAD1,8);return Ki.createBytes(s,r)}static createBytes(t,e){let i=0,r=0,s=0;const a=new Array(e.length),o=new Array(e.length);for(let d=0;d<e.length;d++){const f=e[d].dataCount,u=e[d].totalCount-f;r=Math.max(r,f),s=Math.max(s,u),a[d]=new Array(f);for(let S=0;S<a[d].length;S++)a[d][S]=255&t.buffer[S+i];i+=f;const m=ie.getErrorCorrectPolynomial(u),b=new er(a[d],m.getLength()-1).mod(m);o[d]=new Array(m.getLength()-1);for(let S=0;S<o[d].length;S++){const E=S+b.getLength()-o[d].length;o[d][S]=E>=0?b.get(E):0}}let h=0;for(let d=0;d<e.length;d++)h+=e[d].totalCount;const l=new Array(h);let c=0;for(let d=0;d<r;d++)for(let f=0;f<e.length;f++)d<a[f].length&&(l[c++]=a[f][d]);for(let d=0;d<s;d++)for(let f=0;f<e.length;f++)d<o[f].length&&(l[c++]=o[f][d]);return l}}const Tf=Math.ceil,ts=Math.floor,kf=Math.round;function a_(n,t){const e=Il(n),i=t?.ecc||"H",r=t?.size||256,s=-1,a=t?.padding||0,o=t?.color||"#000000",h=t?.background||"#ffffff",l=new Ki(s,i);l.addData(e),l.make();const c=l.getModuleCount(),d=(r-a*2)/c,f=a,u=r-a;return Sf(r,o,h,function(m,v){if(f<=m&&m<u&&f<=v&&v<u){const b=ts((m-f)/d),S=ts((v-f)/d);return l.isDark(S,b)?0:1}else return 1})}function o_(n,t){const e=t.x||0,i=t.y||0,r=Il(n),s=t.ctx,a=t.ecc||"H",o=typeof t.size=="number"?ts(t.size):256,h=t.padding||0,l=-1,c=t.color||"#000000",d=t.background||"#ffffff",f=new Ki(l,a);f.addData(r),f.make();const u=f.getModuleCount(),m=(o-h*2)/u;s.fillStyle=d,s.fillRect(e,i,o,o);for(let v=0;v<u;v++)for(let b=0;b<u;b++){const S=Tf((b+1)*m)-ts(b*m),E=Tf((v+1)*m)-ts(v*m);s.fillStyle=f.isDark(v,b)?c:d,s.fillRect(e+kf(b*m)+h,i+kf(v*m)+h,S,E)}}function Lh(){let n=null;if(window.ActiveXObject){const t=["Microsoft.XMLHTTP","MSXML6.XMLHTTP","MSXML5.XMLHTTP","MSXML4.XMLHTTP","MSXML3.XMLHTTP","MSXML2.XMLHTTP","MSXML.XMLHTTP"];for(let e=0;e<t.length;e++)try{n=new window.ActiveXObject(t[e]);break}catch{continue}}else n=new XMLHttpRequest;return n}function h_(n){if(!n.action)return{url:"",data:"",boundary:""};const t=n.method.toLowerCase()==="get",e=n.method.toLowerCase()==="post";let i=n.action,r="";const s="---------------------------"+Date.now().toString(16);if(window.FormData)r=new FormData(n),t&&(i=wa(i,Qo(r)));else if(t){let a="";for(let o=0;o<n.elements.length;o++){const h=n.elements[o];if(!h.hasAttribute("name"))continue;const l=h.nodeName.toUpperCase()==="INPUT"?h.getAttribute("type")?.toUpperCase():"TEXT";if(l==="FILE")for(let c=0,d=h.files?.length??0;c<d;a+="&"+encodeURIComponent(h.name)+"="+encodeURIComponent(h.files?.[c++].name??""));else(l!=="RADIO"&&l!=="CHECKBOX"||h.checked)&&(a+="&"+encodeURIComponent(h.name)+"="+encodeURIComponent(h.value))}i=wa(i,a)}else if(e){const a=[];if(n.enctype==="application/x-www-form-urlencoded"){for(let o=0;o<n.elements.length;o++){const h=n.elements[o];h.hasAttribute("name")&&a.push(encodeURIComponent(h.name)+"="+encodeURIComponent(h.value))}r=a.join("&")}else if(n.enctype==="text/plain"){for(let o=0;o<n.elements.length;o++){const h=n.elements[o];h.hasAttribute("name")&&a.push(h.name+"="+h.value)}r=a.join(`\r
|
|
24
|
+
`;return function(){var F=new Error("get-stack-trace"),G=F&&F.stack?F.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",H=t.console&&(t.console.warn||t.console.log);return H&&H.call(t.console,M,G),g.apply(this,arguments)}}var v;typeof Object.assign!="function"?v=function(y){if(y===r||y===null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(y),M=1;M<arguments.length;M++){var F=arguments[M];if(F!==r&&F!==null)for(var G in F)F.hasOwnProperty(G)&&(k[G]=F[G])}return k}:v=Object.assign;var b=m(function(y,k,M){for(var F=Object.keys(k),G=0;G<F.length;)(!M||M&&y[F[G]]===r)&&(y[F[G]]=k[F[G]]),G++;return y},"extend","Use `assign`."),S=m(function(y,k){return b(y,k,!0)},"merge","Use `assign`.");function E(g,y,k){var M=y.prototype,F;F=g.prototype=Object.create(M),F.constructor=g,F._super=M,k&&v(F,k)}function _(g,y){return function(){return g.apply(y,arguments)}}function x(g,y){return typeof g==o?g.apply(y&&y[0]||r,y):g}function P(g,y){return g===r?y:g}function R(g,y,k){u(U(y),function(M){g.addEventListener(M,k,!1)})}function O(g,y,k){u(U(y),function(M){g.removeEventListener(M,k,!1)})}function L(g,y){for(;g;){if(g==y)return!0;g=g.parentNode}return!1}function $(g,y){return g.indexOf(y)>-1}function U(g){return g.trim().split(/\s+/g)}function z(g,y,k){if(g.indexOf&&!k)return g.indexOf(y);for(var M=0;M<g.length;){if(k&&g[M][k]==y||!k&&g[M]===y)return M;M++}return-1}function q(g){return Array.prototype.slice.call(g,0)}function K(g,y,k){for(var M=[],F=[],G=0;G<g.length;){var H=y?g[G][y]:g[G];z(F,H)<0&&M.push(g[G]),F[G]=H,G++}return k&&(y?M=M.sort(function(st,it){return st[y]>it[y]}):M=M.sort()),M}function Z(g,y){for(var k,M,F=y[0].toUpperCase()+y.slice(1),G=0;G<s.length;){if(k=s[G],M=k?k+F:y,M in g)return M;G++}return r}var at=1;function vt(){return at++}function _t(g){var y=g.ownerDocument||g;return y.defaultView||y.parentWindow||t}var pt=/mobile|tablet|ip(ad|hone|od)|android/i,nt="ontouchstart"in t,J=Z(t,"PointerEvent")!==r,I=nt&&pt.test(navigator.userAgent),D="touch",A="pen",B="mouse",j="kinect",W=25,N=1,Y=2,X=4,et=8,ht=1,mt=2,bt=4,Tt=8,yt=16,Et=mt|bt,Pt=Tt|yt,Ft=Et|Pt,Ct=["x","y"],Jt=["clientX","clientY"];function zt(g,y){var k=this;this.manager=g,this.callback=y,this.element=g.element,this.target=g.options.inputTarget,this.domHandler=function(M){x(g.options.enable,[g])&&k.handler(M)},this.init()}zt.prototype={handler:function(){},init:function(){this.evEl&&R(this.element,this.evEl,this.domHandler),this.evTarget&&R(this.target,this.evTarget,this.domHandler),this.evWin&&R(_t(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&O(this.element,this.evEl,this.domHandler),this.evTarget&&O(this.target,this.evTarget,this.domHandler),this.evWin&&O(_t(this.element),this.evWin,this.domHandler)}};function ce(g){var y,k=g.options.inputClass;return k?y=k:J?y=Ye:I?y=Oi:nt?y=mr:y=ti,new y(g,Xt)}function Xt(g,y,k){var M=k.pointers.length,F=k.changedPointers.length,G=y&N&&M-F===0,H=y&(X|et)&&M-F===0;k.isFirst=!!G,k.isFinal=!!H,G&&(g.session={}),k.eventType=y,Ee(g,k),g.emit("hammer.input",k),g.recognize(k),g.session.prevInput=k}function Ee(g,y){var k=g.session,M=y.pointers,F=M.length;k.firstInput||(k.firstInput=on(y)),F>1&&!k.firstMultiple?k.firstMultiple=on(y):F===1&&(k.firstMultiple=!1);var G=k.firstInput,H=k.firstMultiple,Q=H?H.center:G.center,st=y.center=Qe(M);y.timeStamp=c(),y.deltaTime=y.timeStamp-G.timeStamp,y.angle=ui(Q,st),y.distance=ci(Q,st),ye(k,y),y.offsetDirection=Di(y.deltaX,y.deltaY);var it=Ri(y.deltaTime,y.deltaX,y.deltaY);y.overallVelocityX=it.x,y.overallVelocityY=it.y,y.overallVelocity=l(it.x)>l(it.y)?it.x:it.y,y.scale=H?ve(H.pointers,M):1,y.rotation=H?dr(H.pointers,M):0,y.maxPointers=k.prevInput?y.pointers.length>k.prevInput.maxPointers?y.pointers.length:k.prevInput.maxPointers:y.pointers.length,li(k,y);var tt=g.element;L(y.srcEvent.target,tt)&&(tt=y.srcEvent.target),y.target=tt}function ye(g,y){var k=y.center,M=g.offsetDelta||{},F=g.prevDelta||{},G=g.prevInput||{};(y.eventType===N||G.eventType===X)&&(F=g.prevDelta={x:G.deltaX||0,y:G.deltaY||0},M=g.offsetDelta={x:k.x,y:k.y}),y.deltaX=F.x+(k.x-M.x),y.deltaY=F.y+(k.y-M.y)}function li(g,y){var k=g.lastInterval||y,M=y.timeStamp-k.timeStamp,F,G,H,Q;if(y.eventType!=et&&(M>W||k.velocity===r)){var st=y.deltaX-k.deltaX,it=y.deltaY-k.deltaY,tt=Ri(M,st,it);G=tt.x,H=tt.y,F=l(tt.x)>l(tt.y)?tt.x:tt.y,Q=Di(st,it),g.lastInterval=y}else F=k.velocity,G=k.velocityX,H=k.velocityY,Q=k.direction;y.velocity=F,y.velocityX=G,y.velocityY=H,y.direction=Q}function on(g){for(var y=[],k=0;k<g.pointers.length;)y[k]={clientX:h(g.pointers[k].clientX),clientY:h(g.pointers[k].clientY)},k++;return{timeStamp:c(),pointers:y,center:Qe(y),deltaX:g.deltaX,deltaY:g.deltaY}}function Qe(g){var y=g.length;if(y===1)return{x:h(g[0].clientX),y:h(g[0].clientY)};for(var k=0,M=0,F=0;F<y;)k+=g[F].clientX,M+=g[F].clientY,F++;return{x:h(k/y),y:h(M/y)}}function Ri(g,y,k){return{x:y/g||0,y:k/g||0}}function Di(g,y){return g===y?ht:l(g)>=l(y)?g<0?mt:bt:y<0?Tt:yt}function ci(g,y,k){k||(k=Ct);var M=y[k[0]]-g[k[0]],F=y[k[1]]-g[k[1]];return Math.sqrt(M*M+F*F)}function ui(g,y,k){k||(k=Ct);var M=y[k[0]]-g[k[0]],F=y[k[1]]-g[k[1]];return Math.atan2(F,M)*180/Math.PI}function dr(g,y){return ui(y[1],y[0],Jt)+ui(g[1],g[0],Jt)}function ve(g,y){return ci(y[0],y[1],Jt)/ci(g[0],g[1],Jt)}var fi={mousedown:N,mousemove:Y,mouseup:X},hn="mousedown",Re="mousemove mouseup";function ti(){this.evEl=hn,this.evWin=Re,this.pressed=!1,zt.apply(this,arguments)}E(ti,zt,{handler:function(y){var k=fi[y.type];k&N&&y.button===0&&(this.pressed=!0),k&Y&&y.which!==1&&(k=X),this.pressed&&(k&X&&(this.pressed=!1),this.callback(this.manager,k,{pointers:[y],changedPointers:[y],pointerType:B,srcEvent:y}))}});var Ue={pointerdown:N,pointermove:Y,pointerup:X,pointercancel:et,pointerout:et},On={2:D,3:A,4:B,5:j},Li="pointerdown",ln="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(Li="MSPointerDown",ln="MSPointerMove MSPointerUp MSPointerCancel");function Ye(){this.evEl=Li,this.evWin=ln,zt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}E(Ye,zt,{handler:function(y){var k=this.store,M=!1,F=y.type.toLowerCase().replace("ms",""),G=Ue[F],H=On[y.pointerType]||y.pointerType,Q=H==D,st=z(k,y.pointerId,"pointerId");G&N&&(y.button===0||Q)?st<0&&(k.push(y),st=k.length-1):G&(X|et)&&(M=!0),!(st<0)&&(k[st]=y,this.callback(this.manager,G,{pointers:k,changedPointers:[y],pointerType:H,srcEvent:y}),M&&k.splice(st,1))}});var Se={touchstart:N,touchmove:Y,touchend:X,touchcancel:et},lo="touchstart",cn="touchstart touchmove touchend touchcancel";function Ii(){this.evTarget=lo,this.evWin=cn,this.started=!1,zt.apply(this,arguments)}E(Ii,zt,{handler:function(y){var k=Se[y.type];if(k===N&&(this.started=!0),!!this.started){var M=di.call(this,y,k);k&(X|et)&&M[0].length-M[1].length===0&&(this.started=!1),this.callback(this.manager,k,{pointers:M[0],changedPointers:M[1],pointerType:D,srcEvent:y})}}});function di(g,y){var k=q(g.touches),M=q(g.changedTouches);return y&(X|et)&&(k=K(k.concat(M),"identifier",!0)),[k,M]}var gr={touchstart:N,touchmove:Y,touchend:X,touchcancel:et},Fi="touchstart touchmove touchend touchcancel";function Oi(){this.evTarget=Fi,this.targetIds={},zt.apply(this,arguments)}E(Oi,zt,{handler:function(y){var k=gr[y.type],M=Nn.call(this,y,k);M&&this.callback(this.manager,k,{pointers:M[0],changedPointers:M[1],pointerType:D,srcEvent:y})}});function Nn(g,y){var k=q(g.touches),M=this.targetIds;if(y&(N|Y)&&k.length===1)return M[k[0].identifier]=!0,[k,k];var F,G,H=q(g.changedTouches),Q=[],st=this.target;if(G=k.filter(function(it){return L(it.target,st)}),y===N)for(F=0;F<G.length;)M[G[F].identifier]=!0,F++;for(F=0;F<H.length;)M[H[F].identifier]&&Q.push(H[F]),y&(X|et)&&delete M[H[F].identifier],F++;if(Q.length)return[K(G.concat(Q),"identifier",!0),Q]}var pr=2500,co=25;function mr(){zt.apply(this,arguments);var g=_(this.handler,this);this.touch=new Oi(this.manager,g),this.mouse=new ti(this.manager,g),this.primaryTouch=null,this.lastTouches=[]}E(mr,zt,{handler:function(y,k,M){var F=M.pointerType==D,G=M.pointerType==B;if(!(G&&M.sourceCapabilities&&M.sourceCapabilities.firesTouchEvents)){if(F)uo.call(this,k,M);else if(G&&Ni.call(this,M))return;this.callback(y,k,M)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function uo(g,y){g&N?(this.primaryTouch=y.changedPointers[0].identifier,fo.call(this,y)):g&(X|et)&&fo.call(this,y)}function fo(g){var y=g.changedPointers[0];if(y.identifier===this.primaryTouch){var k={x:y.clientX,y:y.clientY};this.lastTouches.push(k);var M=this.lastTouches,F=function(){var G=M.indexOf(k);G>-1&&M.splice(G,1)};setTimeout(F,pr)}}function Ni(g){for(var y=g.srcEvent.clientX,k=g.srcEvent.clientY,M=0;M<this.lastTouches.length;M++){var F=this.lastTouches[M],G=Math.abs(y-F.x),H=Math.abs(k-F.y);if(G<=co&&H<=co)return!0}return!1}var go=Z(a.style,"touchAction"),po=go!==r,mo="compute",vo="auto",vr="manipulation",Gi="none",De="pan-x",Ui="pan-y",un=fn();function $t(g,y){this.manager=g,this.set(y)}$t.prototype={set:function(g){g==mo&&(g=this.compute()),po&&this.manager.element.style&&un[g]&&(this.manager.element.style[go]=g),this.actions=g.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var g=[];return u(this.manager.recognizers,function(y){x(y.options.enable,[y])&&(g=g.concat(y.getTouchAction()))}),_o(g.join(" "))},preventDefaults:function(g){var y=g.srcEvent,k=g.offsetDirection;if(this.manager.session.prevented){y.preventDefault();return}var M=this.actions,F=$(M,Gi)&&!un[Gi],G=$(M,Ui)&&!un[Ui],H=$(M,De)&&!un[De];if(F){var Q=g.pointers.length===1,st=g.distance<2,it=g.deltaTime<250;if(Q&&st&&it)return}if(!(H&&G)&&(F||G&&k&Et||H&&k&Pt))return this.preventSrc(y)},preventSrc:function(g){this.manager.session.prevented=!0,g.preventDefault()}};function _o(g){if($(g,Gi))return Gi;var y=$(g,De),k=$(g,Ui);return y&&k?Gi:y||k?y?De:Ui:$(g,vr)?vr:vo}function fn(){if(!po)return!1;var g={},y=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(k){g[k]=y?t.CSS.supports("touch-action",k):!0}),g}var Gn=1,Ce=2,gi=4,ei=8,qe=ei,Bi=16,ne=32;function At(g){this.options=v({},this.defaults,g||{}),this.id=vt(),this.manager=null,this.options.enable=P(this.options.enable,!0),this.state=Gn,this.simultaneous={},this.requireFail=[]}At.prototype={defaults:{},set:function(g){return v(this.options,g),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(g){if(f(g,"recognizeWith",this))return this;var y=this.simultaneous;return g=dn(g,this),y[g.id]||(y[g.id]=g,g.recognizeWith(this)),this},dropRecognizeWith:function(g){return f(g,"dropRecognizeWith",this)?this:(g=dn(g,this),delete this.simultaneous[g.id],this)},requireFailure:function(g){if(f(g,"requireFailure",this))return this;var y=this.requireFail;return g=dn(g,this),z(y,g)===-1&&(y.push(g),g.requireFailure(this)),this},dropRequireFailure:function(g){if(f(g,"dropRequireFailure",this))return this;g=dn(g,this);var y=z(this.requireFail,g);return y>-1&&this.requireFail.splice(y,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(g){return!!this.simultaneous[g.id]},emit:function(g){var y=this,k=this.state;function M(F){y.manager.emit(F,g)}k<ei&&M(y.options.event+ta(k)),M(y.options.event),g.additionalEvent&&M(g.additionalEvent),k>=ei&&M(y.options.event+ta(k))},tryEmit:function(g){if(this.canEmit())return this.emit(g);this.state=ne},canEmit:function(){for(var g=0;g<this.requireFail.length;){if(!(this.requireFail[g].state&(ne|Gn)))return!1;g++}return!0},recognize:function(g){var y=v({},g);if(!x(this.options.enable,[this,y])){this.reset(),this.state=ne;return}this.state&(qe|Bi|ne)&&(this.state=Gn),this.state=this.process(y),this.state&(Ce|gi|ei|Bi)&&this.tryEmit(y)},process:function(g){},getTouchAction:function(){},reset:function(){}};function ta(g){return g&Bi?"cancel":g&ei?"end":g&gi?"move":g&Ce?"start":""}function _r(g){return g==yt?"down":g==Tt?"up":g==mt?"left":g==bt?"right":""}function dn(g,y){var k=y.manager;return k?k.get(g):g}function Be(){At.apply(this,arguments)}E(Be,At,{defaults:{pointers:1},attrTest:function(g){var y=this.options.pointers;return y===0||g.pointers.length===y},process:function(g){var y=this.state,k=g.eventType,M=y&(Ce|gi),F=this.attrTest(g);return M&&(k&et||!F)?y|Bi:M||F?k&X?y|ei:y&Ce?y|gi:Ce:ne}});function Le(){Be.apply(this,arguments),this.pX=null,this.pY=null}E(Le,Be,{defaults:{event:"pan",threshold:10,pointers:1,direction:Ft},getTouchAction:function(){var g=this.options.direction,y=[];return g&Et&&y.push(Ui),g&Pt&&y.push(De),y},directionTest:function(g){var y=this.options,k=!0,M=g.distance,F=g.direction,G=g.deltaX,H=g.deltaY;return F&y.direction||(y.direction&Et?(F=G===0?ht:G<0?mt:bt,k=G!=this.pX,M=Math.abs(g.deltaX)):(F=H===0?ht:H<0?Tt:yt,k=H!=this.pY,M=Math.abs(g.deltaY))),g.direction=F,k&&M>y.threshold&&F&y.direction},attrTest:function(g){return Be.prototype.attrTest.call(this,g)&&(this.state&Ce||!(this.state&Ce)&&this.directionTest(g))},emit:function(g){this.pX=g.deltaX,this.pY=g.deltaY;var y=_r(g.direction);y&&(g.additionalEvent=this.options.event+y),this._super.emit.call(this,g)}});function zi(){Be.apply(this,arguments)}E(zi,Be,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Gi]},attrTest:function(g){return this._super.attrTest.call(this,g)&&(Math.abs(g.scale-1)>this.options.threshold||this.state&Ce)},emit:function(g){if(g.scale!==1){var y=g.scale<1?"in":"out";g.additionalEvent=this.options.event+y}this._super.emit.call(this,g)}});function yr(){At.apply(this,arguments),this._timer=null,this._input=null}E(yr,At,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[vo]},process:function(g){var y=this.options,k=g.pointers.length===y.pointers,M=g.distance<y.threshold,F=g.deltaTime>y.time;if(this._input=g,!M||!k||g.eventType&(X|et)&&!F)this.reset();else if(g.eventType&N)this.reset(),this._timer=d(function(){this.state=qe,this.tryEmit()},y.time,this);else if(g.eventType&X)return qe;return ne},reset:function(){clearTimeout(this._timer)},emit:function(g){this.state===qe&&(g&&g.eventType&X?this.manager.emit(this.options.event+"up",g):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}});function wr(){Be.apply(this,arguments)}E(wr,Be,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Gi]},attrTest:function(g){return this._super.attrTest.call(this,g)&&(Math.abs(g.rotation)>this.options.threshold||this.state&Ce)}});function br(){Be.apply(this,arguments)}E(br,Be,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|Pt,pointers:1},getTouchAction:function(){return Le.prototype.getTouchAction.call(this)},attrTest:function(g){var y=this.options.direction,k;return y&(Et|Pt)?k=g.overallVelocity:y&Et?k=g.overallVelocityX:y&Pt&&(k=g.overallVelocityY),this._super.attrTest.call(this,g)&&y&g.offsetDirection&&g.distance>this.options.threshold&&g.maxPointers==this.options.pointers&&l(k)>this.options.velocity&&g.eventType&X},emit:function(g){var y=_r(g.offsetDirection);y&&this.manager.emit(this.options.event+y,g),this.manager.emit(this.options.event,g)}});function We(){At.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}E(We,At,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[vr]},process:function(g){var y=this.options,k=g.pointers.length===y.pointers,M=g.distance<y.threshold,F=g.deltaTime<y.time;if(this.reset(),g.eventType&N&&this.count===0)return this.failTimeout();if(M&&F&&k){if(g.eventType!=X)return this.failTimeout();var G=this.pTime?g.timeStamp-this.pTime<y.interval:!0,H=!this.pCenter||ci(this.pCenter,g.center)<y.posThreshold;this.pTime=g.timeStamp,this.pCenter=g.center,!H||!G?this.count=1:this.count+=1,this._input=g;var Q=this.count%y.taps;if(Q===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=qe,this.tryEmit()},y.interval,this),Ce):qe}return ne},failTimeout:function(){return this._timer=d(function(){this.state=ne},this.options.interval,this),ne},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==qe&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ke(g,y){return y=y||{},y.recognizers=P(y.recognizers,Ke.defaults.preset),new Bn(g,y)}Ke.VERSION="2.0.7",Ke.defaults={domEvents:!1,touchAction:mo,enable:!0,inputTarget:null,inputClass:null,preset:[[wr,{enable:!1}],[zi,{enable:!1},["rotate"]],[br,{direction:Et}],[Le,{direction:Et},["swipe"]],[We],[We,{event:"doubletap",taps:2},["tap"]],[yr]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Un=1,de=2;function Bn(g,y){this.options=v({},Ke.defaults,y||{}),this.options.inputTarget=this.options.inputTarget||g,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=g,this.input=ce(this),this.touchAction=new $t(this,this.options.touchAction),p(this,!0),u(this.options.recognizers,function(k){var M=this.add(new k[0](k[1]));k[2]&&M.recognizeWith(k[2]),k[3]&&M.requireFailure(k[3])},this)}Bn.prototype={set:function(g){return v(this.options,g),g.touchAction&&this.touchAction.update(),g.inputTarget&&(this.input.destroy(),this.input.target=g.inputTarget,this.input.init()),this},stop:function(g){this.session.stopped=g?de:Un},recognize:function(g){var y=this.session;if(!y.stopped){this.touchAction.preventDefaults(g);var k,M=this.recognizers,F=y.curRecognizer;(!F||F&&F.state&qe)&&(F=y.curRecognizer=null);for(var G=0;G<M.length;)k=M[G],y.stopped!==de&&(!F||k==F||k.canRecognizeWith(F))?k.recognize(g):k.reset(),!F&&k.state&(Ce|gi|ei)&&(F=y.curRecognizer=k),G++}},get:function(g){if(g instanceof At)return g;for(var y=this.recognizers,k=0;k<y.length;k++)if(y[k].options.event==g)return y[k];return null},add:function(g){if(f(g,"add",this))return this;var y=this.get(g.options.event);return y&&this.remove(y),this.recognizers.push(g),g.manager=this,this.touchAction.update(),g},remove:function(g){if(f(g,"remove",this))return this;if(g=this.get(g),g){var y=this.recognizers,k=z(y,g);k!==-1&&(y.splice(k,1),this.touchAction.update())}return this},on:function(g,y){if(g!==r&&y!==r){var k=this.handlers;return u(U(g),function(M){k[M]=k[M]||[],k[M].push(y)}),this}},off:function(g,y){if(g!==r){var k=this.handlers;return u(U(g),function(M){y?k[M]&&k[M].splice(z(k[M],y),1):delete k[M]}),this}},emit:function(g,y){this.options.domEvents&&w(g,y);var k=this.handlers[g]&&this.handlers[g].slice();if(!(!k||!k.length)){y.type=g,y.preventDefault=function(){y.srcEvent.preventDefault()};for(var M=0;M<k.length;)k[M](y),M++}},destroy:function(){this.element&&p(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function p(g,y){var k=g.element;if(k.style){var M;u(g.options.cssProps,function(F,G){M=Z(k.style,G),y?(g.oldCssProps[M]=k.style[M],k.style[M]=F):k.style[M]=g.oldCssProps[M]||""}),y||(g.oldCssProps={})}}function w(g,y){var k=e.createEvent("Event");k.initEvent(g,!0,!0),k.gesture=y,y.target.dispatchEvent(k)}v(Ke,{INPUT_START:N,INPUT_MOVE:Y,INPUT_END:X,INPUT_CANCEL:et,STATE_POSSIBLE:Gn,STATE_BEGAN:Ce,STATE_CHANGED:gi,STATE_ENDED:ei,STATE_RECOGNIZED:qe,STATE_CANCELLED:Bi,STATE_FAILED:ne,DIRECTION_NONE:ht,DIRECTION_LEFT:mt,DIRECTION_RIGHT:bt,DIRECTION_UP:Tt,DIRECTION_DOWN:yt,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:Pt,DIRECTION_ALL:Ft,Manager:Bn,Input:zt,TouchAction:$t,TouchInput:Oi,MouseInput:ti,PointerEventInput:Ye,TouchMouseInput:mr,SingleTouchInput:Ii,Recognizer:At,AttrRecognizer:Be,Tap:We,Pan:Le,Swipe:br,Pinch:zi,Rotate:wr,Press:yr,on:R,off:O,each:u,merge:S,extend:b,assign:v,inherit:E,bindFn:_,prefixed:Z});var C=typeof t<"u"?t:typeof self<"u"?self:{};C.Hammer=Ke,typeof r=="function"&&r.amd?r(function(){return Ke}):n.exports?n.exports=Ke:t[i]=Ke})(window,document,"Hammer")})(yc);var Mg=yc.exports;const Rg=Pe(Mg);let Dg=class extends _c{point;removeEventListeners=[];hammer;constructor(t){super(t),this.point=new Pr,this.hammer=new Rg(t.container),this.removeEventListeners.push(this.point.captureMouse(this.app.container)),this.removeEventListeners.push(this.addEventListeners())}destroy(){this.removeEventListeners.forEach(t=>t())}addEventListeners(){const t=b=>{this.app.emit("mouseDown",b)},e=b=>{this.app.emit("mouseUp",b)},i=b=>{this.app.emit("mouseMove",b)},r=b=>{this.app.emit("mouseOver",b)},s=b=>{this.app.emit("mouseOut",b)},a=b=>{this.app.emit("mouseClick",b)},o=b=>{this.app.emit("mouseDoubleClick",b)},h=b=>{this.app.emit("mouseWheel",b)},l=b=>{this.app.emit("mouseContextMenu",b)},c=b=>{this.app.emit("pan",b)},d=b=>{this.app.emit("pinch",b)},f=b=>{this.app.emit("press",b)},u=b=>{this.app.emit("rotate",b)},m=b=>{this.app.emit("swipe",b)},v=b=>{this.app.emit("tap",b)};return this.app.container?.addEventListener("mousedown",t),this.app.container?.addEventListener("mouseup",e),this.app.container?.addEventListener("mousemove",i),this.app.container?.addEventListener("mouseover",r),this.app.container?.addEventListener("mouseout",s),this.app.container?.addEventListener("click",a),this.app.container?.addEventListener("dblclick",o),this.app.container?.addEventListener("wheel",h),this.app.container?.addEventListener("contextmenu",l),this.hammer.on("pan",c),this.hammer.on("pinch",d),this.hammer.on("press",f),this.hammer.on("rotate",u),this.hammer.on("swipe",m),this.hammer.on("tap",v),()=>{this.app.container?.removeEventListener("mousedown",t),this.app.container?.removeEventListener("mouseup",e),this.app.container?.removeEventListener("mousemove",i),this.app.container?.removeEventListener("mouseover",r),this.app.container?.removeEventListener("mouseout",s),this.app.container?.removeEventListener("click",a),this.app.container?.removeEventListener("dblclick",o),this.app.container?.removeEventListener("wheel",h),this.app.container?.removeEventListener("contextmenu",l),this.hammer.off("pan",c),this.hammer.off("pinch",d),this.hammer.off("press",f),this.hammer.off("rotate",u),this.hammer.off("swipe",m),this.hammer.off("tap",v)}}};class Lg extends _c{removeEventListeners=[];constructor(t){super(t)}destroy(){this.removeEventListeners.forEach(t=>t())}on(t,e){const i=Qt.on(t,s=>(this.app.emit("keyDown",s,i),e)),r=()=>{i.removeListener?.()};return this.removeEventListeners.push(r),r}}const wc=Ig("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);function Ig(n,t=10){const e={},i=n.split(",");for(let r=0;r<i.length;r+=2){const s="&"+i[r+1]+";",a=parseInt(i[r],t);e[s]="&#"+a+";"}return e["\\xa0"]=" ",e}function Te(n,t){const e=Object.keys(t);for(let i=0;i<e.length;i++)n=n.replace(new RegExp("{"+e[i]+"}","gi"),""+t[e[i]]);return n}function ua(n){let t,e;if(!n)throw new Error("cannot create a random attribute name for an undefined object");const i="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";t="";do for(t="",e=0;e<12;e++)t+=i[Math.floor(Math.random()*i.length)];while(n[t]);return t}function Fg(n){const t={left:"start",right:"end",center:"middle",start:"start",end:"end"};return t[n]||t.start}function Og(n){const t={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return t[n]||t.alphabetic}const Ar={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}};class fa{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}addColorStop(t,e){const i=this.__ctx.__createElement("stop");if(i.setAttribute("offset",""+t),e.indexOf("rgba")!==-1){const s=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(e);s&&(i.setAttribute("stop-color",Te("rgb({r},{g},{b})",{r:s[1],g:s[2],b:s[3]})),i.setAttribute("stop-opacity",s[4]))}else i.setAttribute("stop-color",e);this.__root.appendChild(i)}}class No{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}}class Mr{__document=document;__canvas;__ctx;width;height;__styleStack;__groupStack;__rootSVG;__ids;__SVGdefs;__currentElement;__currentElementsToStyle=null;constructor({canvas:t,width:e=500,height:i=500,enableMirroring:r=!1}){this.enableMirroring=r,t?(this.__canvas=t,this.__ctx=t.getContext("2d"),this.width=t.width,this.height=t.height):(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d"),this.width=e,this.height=i),this.__setDefaultStyles(),this.__styleStack=[this.__getStyleState()],this.__groupStack=[],this.__rootSVG=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__rootSVG.setAttribute("version","1.1"),this.__rootSVG.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__rootSVG.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__rootSVG.setAttribute("width",""+this.width),this.__rootSVG.setAttribute("height",""+this.height),this.__ids={},this.__SVGdefs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__rootSVG.appendChild(this.__SVGdefs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__rootSVG.appendChild(this.__currentElement)}__setDefaultStyles(){const t=Object.keys(Ar);for(let e=0,i=t.length;e<i;e++){const r=t[e];this[r]=Ar[r].canvas}}__getStyleState(){const t={},e=Object.keys(Ar);for(let i=0,r=e.length;i<r;i++){const s=e[i];t[s]=this[s]}return t}__applyStyleState(t){const e=Object.keys(t);for(let i=0,r=e.length;i<r;i++){const s=e[i];this[s]=t[s]}}__createElement(t,e={},i=!1){const r=this.__document.createElementNS("http://www.w3.org/2000/svg",t),s=Object.keys(e);i&&(r.setAttribute("fill","none"),r.setAttribute("stroke","none"));for(let a=0;a<s.length;a++){const o=s[a];r.setAttribute(o,e[o])}return r}__applyStyleToCurrentElement(t){let e=this.__currentElement;const i=this.__currentElementsToStyle;i&&(e.setAttribute(t,""),e=i.element,i.children.forEach(s=>{s.setAttribute(t,"")}));const r=Object.keys(Ar);for(let s=0;s<r.length;s++){const a=Ar[r[s]],o=this[r[s]];if(a.apply){if(o instanceof No){if(o.__ctx)for(;o.__ctx.__SVGdefs.childNodes.length;){const h=o.__ctx.__SVGdefs.childNodes[0].getAttribute("id");this.__ids[h]=h,this.__SVGdefs.appendChild(o.__ctx.__SVGdefs.childNodes[0])}e.setAttribute(a.apply,Te("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof fa)e.setAttribute(a.apply,Te("url(#{id})",{id:o.__root.getAttribute("id")}));else if(a.apply.indexOf(t)!==-1&&a.svg!==o)if((a.svgAttr==="stroke"||a.svgAttr==="fill")&&o.indexOf("rgba")!==-1){const l=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o);e.setAttribute(a.svgAttr,Te("rgb({r},{g},{b})",{r:l[1],g:l[2],b:l[3]}));let c=parseFloat(l[4]);const d=this.globalAlpha;d!=null&&(c*=d),e.setAttribute(a.svgAttr+"-opacity",""+c)}else{let h=a.svgAttr;if(r[s]==="globalAlpha"&&(h=t+"-"+a.svgAttr,e.getAttribute(h)))continue;h&&e.setAttribute(h,o)}}}}__closestGroupOrSvg(t){return t=t||this.__currentElement,t.nodeName==="g"||t.nodeName==="svg"?t:this.__closestGroupOrSvg(t.parentNode)}getSerializedSvg(t){let e=new XMLSerializer().serializeToString(this.__rootSVG);if(/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi.test(e)&&(e=e.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),t){const r=Object.keys(wc);for(let s=0,a=r.length;s<a;s++){const o=r[s],h=wc[o],l=new RegExp(o,"gi");l.test(e)&&(e=e.replace(l,h))}}return e}getSvg(){return this.__rootSVG}save(){const t=this.__createElement("g"),e=this.__closestGroupOrSvg();this.__groupStack.push(e),e.appendChild(t),this.__currentElement=t,this.__styleStack.push(this.__getStyleState())}restore(){this.__currentElementsToStyle=null;const t=this.__groupStack.pop();t?this.__currentElement=t:this.__currentElement=this.__rootSVG.childNodes[1];const e=this.__styleStack.pop();e&&this.__applyStyleState(e)}__addTransform(t){const e=this.__closestGroupOrSvg();if(e.childNodes.length>0){this.__currentElement.nodeName==="path"&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());const r=this.__createElement("g");e.appendChild(r),this.__currentElement=r}let i=this.__currentElement.getAttribute("transform");i?i+=" ":i="",i+=t,this.__currentElement.setAttribute("transform",i)}scale(t,e){e===void 0&&(e=t),this.__addTransform(Te("scale({x},{y})",{x:t,y:e}))}rotate(t){const e=t*180/Math.PI;this.__addTransform(Te("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))}translate(t,e){this.__addTransform(Te("translate({x},{y})",{x:t,y:e}))}transform(t,e,i,r,s,a){this.__addTransform(Te("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:i,d:r,e:s,f:a}))}beginPath(){this.__currentDefaultPath="",this.__currentPosition={};const t=this.__createElement("path",{},!0);this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t}__applyCurrentDefaultPath(){const t=this.__currentElement;t.nodeName==="path"?t.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",t.nodeName)}__addPathCommand(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t}moveTo(t,e){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(Te("M {x} {y}",this.__currentPosition))}closePath(){this.__currentDefaultPath&&this.__addPathCommand("Z")}lineTo(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(Te("L {x} {y}",this.__currentPosition)):this.__addPathCommand(Te("M {x} {y}",this.__currentPosition))}bezierCurveTo(t,e,i,r,s,a){this.__currentPosition={x:s,y:a},this.__addPathCommand(Te("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:i,cp2y:r,x:s,y:a}))}quadraticCurveTo(t,e,i,r){this.__currentPosition={x:i,y:r},this.__addPathCommand(Te("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:i,y:r}))}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}arcTo(t,e,i,r,s){const a=this.__currentPosition&&this.__currentPosition.x,o=this.__currentPosition&&this.__currentPosition.y;if(typeof a>"u"||typeof o>"u")return;if(s<0)throw new Error("IndexSizeError: The radius provided ("+s+") is negative.");if(a===t&&o===e||t===i&&e===r||s===0){this.lineTo(t,e);return}const h=this.normalize([a-t,o-e]),l=this.normalize([i-t,r-e]);if(h[0]*l[1]===h[1]*l[0]){this.lineTo(t,e);return}const c=h[0]*l[0]+h[1]*l[1],d=Math.acos(Math.abs(c)),f=this.normalize([h[0]+l[0],h[1]+l[1]]),u=s/Math.sin(d/2),m=t+u*f[0],v=e+u*f[1],b=[-h[1],h[0]],S=[l[1],-l[0]],E=function(P){const R=P[0];return P[1]>=0?Math.acos(R):-Math.acos(R)},_=E(b),x=E(S);this.lineTo(m+b[0]*s,v+b[1]*s),this.arc(m,v,s,_,x)}stroke(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")}fill(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")}rect(t,e,i,r){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.closePath()}fillRect(t,e,i,r){const s=this.__createElement("rect",{x:t,y:e,width:i,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("fill")}strokeRect(t,e,i,r){const s=this.__createElement("rect",{x:t,y:e,width:i,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("stroke")}__clearCanvas(){const e=this.__closestGroupOrSvg().getAttribute("transform"),i=this.__rootSVG.childNodes[1],r=i.childNodes;for(let s=r.length-1;s>=0;s--)r[s]&&i.removeChild(r[s]);this.__currentElement=i,this.__groupStack=[],e&&this.__addTransform(e)}clearRect(t,e,i,r){if(t===0&&e===0&&i===this.width&&r===this.height){this.__clearCanvas();return}const s=this.__closestGroupOrSvg(),a=this.__createElement("rect",{x:t,y:e,width:i,height:r,fill:"#FFFFFF"},!0);s.appendChild(a)}createLinearGradient(t,e,i,r){const s=this.__createElement("linearGradient",{id:ua(this.__ids),x1:t+"px",x2:i+"px",y1:e+"px",y2:r+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(s),new fa(s,this)}createRadialGradient(t,e,i,r,s,a){const o=this.__createElement("radialGradient",{id:ua(this.__ids),cx:r+"px",cy:s+"px",r:a+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(o),new fa(o,this)}__parseFont(){const e=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:%|in|[cem]m|ex|p[CustomCanvasContext]))(?:\s*\/\s*(normal|[.\d]+(?:%|in|[cem]m|ex|p[CustomCanvasContext])))?\s*([-,'"\sa-z0-9]+?)\s*$/i.exec(this.font),i={style:e[1]||"normal",size:e[4]||"10px",family:e[6]||"sans-serif",weight:e[3]||"normal",decoration:e[2]||"normal",href:null};return this.__fontUnderline==="underline"&&(i.decoration="underline"),this.__fontHref&&(i.href=this.__fontHref),i}__wrapTextLink(t,e){if(t.href){const i=this.__createElement("a");return i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),i.appendChild(e),i}return e}__applyText(t,e,i,r){const s=this.__parseFont(),a=this.__closestGroupOrSvg(),o=this.__createElement("text",{"font-family":s.family,"font-size":s.size,"font-style":s.style,"font-weight":s.weight,"text-decoration":s.decoration,x:e,y:i,"text-anchor":Fg(this.textAlign),"dominant-baseline":Og(this.textBaseline)},!0);o.appendChild(this.__document.createTextNode(t)),this.__currentElement=o,this.__applyStyleToCurrentElement(r),a.appendChild(this.__wrapTextLink(s,o))}fillText(t,e,i){this.__applyText(t,e,i,"fill")}strokeText(t,e,i){this.__applyText(t,e,i,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,i,r,s,a){if(r===s)return;r=r%(2*Math.PI),s=s%(2*Math.PI),r===s&&(s=(s+2*Math.PI-.001*(a?-1:1))%(2*Math.PI));const o=t+i*Math.cos(s),h=e+i*Math.sin(s),l=t+i*Math.cos(r),c=e+i*Math.sin(r),d=a?0:1;let f=0,u=s-r;u<0&&(u+=2*Math.PI),a?f=u>Math.PI?0:1:f=u>Math.PI?1:0,this.lineTo(l,c),this.__addPathCommand(Te("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:i,ry:i,xAxisRotation:0,largeArcFlag:f,sweepFlag:d,endX:o,endY:h})),this.__currentPosition={x:o,y:h}}clip(){const t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),i=ua(this.__ids),r=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",i),e.appendChild(this.__currentElement),this.__SVGdefs.appendChild(e),t.setAttribute("clip-path",Te("url(#{id})",{id:i})),t.appendChild(r),this.__currentElement=r}drawImage(...t){let e=t[0],i,r,s,a,o=0,h=0,l,c,d,f,u,m,v,b;if(t.length===3)i=t[1],r=t[2],l=e.width,c=e.height,s=l,a=c;else if(t.length===5)i=t[1],r=t[2],s=t[3],a=t[4],l=e.width,c=e.height;else if(t.length===9)o=t[1],h=t[2],l=t[3],c=t[4],i=t[5],r=t[6],s=t[7],a=t[8];else throw new Error("Invalid number of arguments passed to drawImage: "+arguments.length);const S=this.__closestGroupOrSvg();this.__currentElement;const E="translate("+i+", "+r+")";if(e instanceof Mr){if(d=e.getSvg().cloneNode(!0),d.childNodes&&d.childNodes.length>1){for(f=d.childNodes[0];f.childNodes.length;)b=f.childNodes[0].getAttribute("id"),this.__ids[b]=b,this.__SVGdefs.appendChild(f.childNodes[0]);if(u=d.childNodes[1],u){const _=u.getAttribute("transform");let x;_?x=_+" "+E:x=E,u.setAttribute("transform",x),S.appendChild(u)}}}else(e.nodeName==="CANVAS"||e.nodeName==="IMG")&&(m=this.__createElement("image"),m.setAttribute("width",s),m.setAttribute("height",a),m.setAttribute("preserveAspectRatio","none"),(o||h||l!==e.width||c!==e.height)&&(v=this.__document.createElement("canvas"),v.width=s,v.height=a,v.getContext("2d")?.drawImage(e,o,h,l,c,0,0,s,a),e=v),m.setAttribute("transform",E),m.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.nodeName==="CANVAS"?e.toDataURL():e.getAttribute("src")),S.appendChild(m))}createPattern(t,e){const i=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),r=ua(this.__ids);let s;return i.setAttribute("id",r),t.nodeName==="CANVAS"||t.nodeName==="IMG"?(s=this.__document.createElementNS("http://www.w3.org/2000/svg","image"),s.setAttribute("width",""+t.width),s.setAttribute("height",""+t.height),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.nodeName==="CANVAS"?t.toDataURL():t.getAttribute("src")),i.appendChild(s),this.__SVGdefs.appendChild(i)):t instanceof Mr&&(i.setAttribute("width",""+t.width),i.setAttribute("height",""+t.height),i.appendChild(t.__rootSVG.childNodes[1]),this.__SVGdefs.appendChild(i)),new No(i,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}drawFocusRing(){}createImageData(){}getImageData(){}putImageData(){}globalCompositeOperation(){}setTransform(){}}function Ng(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bc={},Go={exports:{}},xc;function Gg(){return xc||(xc=1,function(n){(function(t){var e="0.4.0",i="hasOwnProperty",r=/[\.\/]/,s="*",a=function(){},o=function(f,u){return f-u},h,l,c={n:{}},d=function(f,u){var m=l,v=Array.prototype.slice.call(arguments,2),b=d.listeners(f),S=0,E,_=[],x={},P=[];h=f,l=0;for(var R=0,O=b.length;R<O;R++)"zIndex"in b[R]&&(_.push(b[R].zIndex),b[R].zIndex<0&&(x[b[R].zIndex]=b[R]));for(_.sort(o);_[S]<0;)if(E=x[_[S++]],P.push(E.apply(u,v)),l)return l=m,P;for(R=0;R<O;R++)if(E=b[R],"zIndex"in E)if(E.zIndex==_[S]){if(P.push(E.apply(u,v)),l)return l=m,P;do if(S++,E=x[_[S]],E&&P.push(E.apply(u,v)),l)return l=m,P;while(E)}else x[E.zIndex]=E;else if(P.push(E.apply(u,v)),l)return l=m,P;return l=m,P.length?P:null};d.listeners=function(f){var u=f.split(r),m=c,v,b,S,E,_,x,P,R,O=[m],L=[];for(E=0,_=u.length;E<_;E++){for(R=[],x=0,P=O.length;x<P;x++)for(m=O[x].n,b=[m[u[E]],m[s]],S=2;S--;)v=b[S],v&&(R.push(v),L=L.concat(v.f||[]));O=R}return L},d.on=function(f,u){for(var m=f.split(r),v=c,b=0,S=m.length;b<S;b++)v=v.n,!v[m[b]]&&(v[m[b]]={n:{}}),v=v[m[b]];for(v.f=v.f||[],b=0,S=v.f.length;b<S;b++)if(v.f[b]==u)return a;return v.f.push(u),function(E){+E==+E&&(u.zIndex=+E)}},d.stop=function(){l=1},d.nt=function(f){return f?new RegExp("(?:\\.|\\/|^)"+f+"(?:\\.|\\/|$)").test(h):h},d.unbind=function(f,u){var m=f.split(r),v,b,S,E,_,x,P,R=[c];for(E=0,_=m.length;E<_;E++)for(x=0;x<R.length;x+=S.length-2){if(S=[x,1],v=R[x].n,m[E]!=s)v[m[E]]&&S.push(v[m[E]]);else for(b in v)v[i](b)&&S.push(v[b]);R.splice.apply(R,S)}for(E=0,_=R.length;E<_;E++)for(v=R[E];v.n;){if(u){if(v.f){for(x=0,P=v.f.length;x<P;x++)if(v.f[x]==u){v.f.splice(x,1);break}!v.f.length&&delete v.f}for(b in v.n)if(v.n[i](b)&&v.n[b].f){var O=v.n[b].f;for(x=0,P=O.length;x<P;x++)if(O[x]==u){O.splice(x,1);break}!O.length&&delete v.n[b].f}}else{delete v.f;for(b in v.n)v.n[i](b)&&v.n[b].f&&delete v.n[b].f}v=v.n}},d.once=function(f,u){var m=function(){u.apply(this,arguments),d.unbind(f,m)};return d.on(f,m)},d.version=e,d.toString=function(){return"You are running Eve "+e},n.exports?n.exports=d:t.eve=d})(xo)}(Go)),Go.exports}(function(n){if(typeof Ng=="function")var t=Gg();(function(){function e(f){var u=function(m){u.parse(m)};return u.mode="text",u.type=String(f||"html").toLowerCase(),u.textchunk="",u.raw="",u.parse=h,u.on=a,u.event=s,u.end=r,u}function i(f,u,m){f==`
|
|
25
|
+
`&&this.event("newline"),d[this.mode].call(this,f,u,m)}function r(){i.call(this,"eof"),this.event("eof")}function s(f,u,m){typeof t=="function"&&t("elemental."+f+"."+u,null,u,m||"",this.raw);for(var v=this.events&&this.events[f],b=v&&v.length;b--;)try{this.events[f][b](u,m||"",this.raw)}catch{}this.raw=""}function a(f,u){this.events=this.events||{},this.events[f]=this.events[f]||[],this.events[f].push(u)}function o(f,u){return f&&(f.charAt?f.charAt(u):f[u])}function h(f){f=f||Object(f);for(var u=1,m=f.length+1,v,b,S=o(f,0);u<m;u++)v=b,b=S,S=o(f,u),this.raw+=b,i.call(this,b,S,v);this._beforeEnd=function(){i.call(this,"","",b)}}var l=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]/,c=function(){for(var f in this.attr)this.attr.hasOwnProperty(f)&&this.event("attr",f,{value:this.attr[f],tagname:this.tagname,attr:this.attr})},d={text:function(f,u,m){switch(f){case"<":case"eof":this.nodename="",this.attr={},this.mode="tag name start",this.raw=this.raw.slice(0,-1),this.textchunk&&this.event("text",this.textchunk),this.raw+=f,this.textchunk="";break;default:this.textchunk+=f}},special:function(f,u,m){if(m=="!"&&f=="-"&&u=="-")this.mode="comment start";else{if(this.textchunk=="[CDATA"&&f=="["){this.mode="cdata",this.textchunk="";return}if(f==">"||f=="eof"){this.event("special",this.textchunk),this.mode="text",this.textchunk="";return}this.textchunk+=f}},cdata:function(f,u,m){m=="]"&&f=="]"&&u==">"?(this.mode="cdata end",this.textchunk=this.textchunk.slice(0,-1)):(f=="eof"&&d["cdata end"].call(this),this.textchunk+=f)},"cdata end":function(f,u,m){this.event("cdata",this.textchunk),this.textchunk="",this.mode="text"},"comment start":function(f,u,m){u==">"||f=="eof"?(this.event("comment",""),this.mode="comment instant end"):this.mode="comment"},"comment instant end":function(f,u,m){this.mode="text"},comment:function(f,u,m){f=="-"&&m=="-"&&u==">"?(this.mode="comment end",this.textchunk=this.textchunk.slice(0,-1)):f=="eof"?this.event("comment",this.textchunk):this.textchunk+=f},"comment end":function(f,u,m){this.event("comment",this.textchunk),this.textchunk="",this.mode="text"},declaration:function(f,u,m){f=="?"&&u==">"?this.mode="declaration end":(f=="eof"&&this.event("comment",this.textchunk),this.textchunk+=f)},"declaration end":function(f,u,m){this.event("comment",this.textchunk),this.textchunk="",this.mode="text"},"tag name start":function(f,u,m){if(f=="eof")this.event("text","<");else if(!l.test(f)){if(this.mode="tag name",f=="/"){this.mode="close tag name start";return}if(f=="!"){this.mode="special",this.textchunk="";return}if(f=="?"){this.mode="declaration";return}d[this.mode].call(this,f,u,m)}},"close tag name start":function(f,u,m){l.test(f)||(this.mode="close tag name",this.tagname="",this.nodename="",d[this.mode].call(this,f,u,m))},"close tag name":function(f,u,m){if(l.test(f))this.tagname=this.nodename;else switch(f){case">":this.event("/tag",this.tagname||this.nodename),this.mode="text";break;default:!this.tagname&&(this.nodename+=f)}},"tag name":function(f,u,m){if(l.test(f))this.tagname=this.nodename,this.nodename="",this.mode="attr start";else switch(f){case">":this.event("tag",this.nodename),this.mode="text";break;default:this.nodename+=f}},"attr start":function(f,u,m){l.test(f)||(this.mode="attr",this.nodename="",d[this.mode].call(this,f,u,m))},attr:function(f,u,m){if(l.test(f)||f=="=")this.attr[this.nodename]="",this.mode="attr value start";else switch(f){case">":this.nodename=="/"?(delete this.attr["/"],this.event("tag",this.tagname,this.attr),c.call(this),this.event("/tag",this.tagname,!0)):(this.nodename&&(this.attr[this.nodename]=""),this.event("tag",this.tagname,this.attr),c.call(this)),this.mode="text";break;default:this.nodename+=f}},"attr value start":function(f,u,m){if(!l.test(f)){if(this.mode="attr value",this.quote=!1,f=="'"||f=='"'){this.quote=f;return}d[this.mode].call(this,f,u,m)}},"attr value":function(f,u,m){if(l.test(f)&&!this.quote)this.mode="attr start";else if(f==">"&&!this.quote)this.event("tag",this.tagname,this.attr),this.mode="text";else switch(f){case'"':case"'":this.quote==f&&m!="\\"&&(this.mode="attr start");break;default:this.attr[this.nodename]+=f}}};e.version="0.2.1",n.elemental=e,n.eve=t})()})(bc);const Sc=Pe(bc),Cc=[1,0,0,1,0,0],Tc=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];class we{value;matrix3d;isEverTo3d=!1;_prev_rotatex=0;_prev_rotatey=0;constructor(t=Cc){this.value=Array.from(t),this.matrix3d=this.toMatrix3D()}unit(){return this.value=Array.from(Cc),this.matrix3d=this.toMatrix3D(),this}transformPoint(t,e,i=0,r=0){const s=t-i,a=e-r;return t=s*this.value[0]+a*this.value[2]+this.value[4],e=s*this.value[1]+a*this.value[3]+this.value[5],[t+i,e+r]}fromString(t){const e=Dl("number",t);return e.length===6?e.forEach((i,r)=>{i.fullMatch&&(this.value[r]=parseFloat(i.fullMatch))}):this.unit(),this}toMatrix3D(t=this.matrix3d){const e=[this.value[0],this.value[1],0,0,this.value[2],this.value[3],0,0,0,0,1,0,this.value[4],this.value[5],0,1];return t?(t.value=e,t):new pn(e)}offset(t=0,e=0){return[t-this.value[4],e-this.value[5]]}clone(){return new we(this.value)}multiply(t){const e=this.value;let i;t instanceof we?i=t.value:i=t;const r=e[0]*i[0]+e[2]*i[1],s=e[1]*i[0]+e[3]*i[1],a=e[0]*i[2]+e[2]*i[3],o=e[1]*i[2]+e[3]*i[3],h=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=h,e[5]=l,this}inverse(){const t=new we(this.value),e=t.value,i=1/(e[0]*e[3]-e[1]*e[2]),r=e[3]*i,s=-e[1]*i,a=-e[2]*i,o=e[0]*i,h=i*(e[2]*e[5]-e[3]*e[4]),l=i*(e[1]*e[4]-e[0]*e[5]);return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=h,e[5]=l,t}translate(t,e){return this.matrix3d.translate(t,e,0),this.multiply([1,0,0,1,t,e])}translateTo(t,e){const i=this.offset(t,e);return this.translate(i[0],i[1])}translateX(t){return this.translate(t,0)}translateY(t){return this.translate(0,t)}translateZ(t){return this.isEverTo3d=!0,this.matrix3d.translate(0,0,t)}translate3d(t,e,i){return this.isEverTo3d=!0,this.matrix3d.translate(t,e,i)}rotate(t,e=0,i=0){const r=la(t),s=+Math.cos(r).toFixed(9),a=+Math.sin(r).toFixed(9);return this.multiply([s,a,-a,s,e,i]),this.translate(-e,-i),this}rotateX(t){return this._prev_rotatex=t,this.isEverTo3d=!0,this.matrix3d.rotate("x",t)}rotateXTo(t){return this.rotateX(t-this._prev_rotatex)}rotateY(t){return this._prev_rotatey=t,this.isEverTo3d=!0,this.matrix3d.rotate("y",t)}rotateYTo(t){return this.rotateY(t-this._prev_rotatey)}rotateZ(t){return this.isEverTo3d=!0,this.matrix3d.rotate("z",t)}rotate3d(t,e,i){return this.isEverTo3d=!0,this.matrix3d.rotate("x",t).rotate("y",e).rotate("z",i)}scale(t,e=t,i=0,r=0){return this.matrix3d.scale(t,e,1),this.translate(i,r),this.multiply([t,0,0,e,0,0]),this.translate(-i,-r),this}scaleTo(t,e=t){return this.scale(t/this.value[0],e/this.value[3]),this}scaleX(t){return this.scale(t,1)}scaleY(t){return this.scale(1,t)}scaleZ(t){return this.isEverTo3d=!0,this.matrix3d.scale(1,1,t)}scale3d(t,e,i){return this.isEverTo3d=!0,this.matrix3d.scale(t,e,i)}skew(t,e=0){const i=t*Math.PI/180,r=e*Math.PI/180,s=Math.tan(i),a=Math.tan(r);return this.multiply([1,a,s,1,0,0])}skewX(t){return this.skew(t,0)}skewY(t){return this.skew(0,t)}skewZ(t){return this}skew3d(t,e,i){return this}split(){const t={dx:0,dy:0,scalex:1,scaley:1,shear:1,rotate:0,isSimple:!0,isSuperSimple:!0,noRotation:!1};t.dx=this.value[4],t.dy=this.value[5];const e=[[this.value[0],this.value[2]],[this.value[1],this.value[3]]];t.scalex=Math.sqrt(ca(e[0])),Fo(e[0]),t.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*t.shear,e[1][1]-e[0][1]*t.shear],t.scaley=Math.sqrt(ca(e[1])),Fo(e[1]),t.shear/=t.scaley;const i=-e[0][1],r=e[1][1];return r<0?(t.rotate=Lo(Math.acos(r)),i<0&&(t.rotate=360-t.rotate)):t.rotate=la(Math.asin(i)),t.isSimple=!+t.shear.toFixed(9)&&(t.scalex.toFixed(9)==t.scaley.toFixed(9)||!t.rotate),t.isSuperSimple=!+t.shear.toFixed(9)&&t.scalex.toFixed(9)==t.scaley.toFixed(9)&&!t.rotate,t.noRotation=!+t.shear.toFixed(9)&&!t.rotate,t}toTransformString(){const t=this.split();return t.isSimple?(t.scalex=+t.scalex.toFixed(4),t.scaley=+t.scaley.toFixed(4),t.rotate=+t.rotate.toFixed(4),(t.dx&&t.dy?"t"+[t.dx,t.dy]:"")+(t.scalex!=1||t.scaley!=1?"s"+[t.scalex,t.scaley,0,0]:"")+(t.rotate?"r"+[t.rotate,0,0]:"")):"matrix"+[this.value[0],this.value[1],this.value[2],this.value[3],this.value[4],this.value[5]]}toString(){return this.isEverTo3d?this.toMatrix3DString():`matrix(${this.value.map(t=>Ul(t,6)).join(",")})`}toMatrix3DString(){return this.matrix3d.toString()}toFilter(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.value[0]+", M12="+this.value[2]+", M21="+this.value[1]+", M22="+this.value[3]+", Dx="+this.value[4]+", Dy="+this.value[5]+", sizingmethod='auto expand')"}}class pn{value;constructor(t=Tc){this.value=Array.from(t)}unit(){return this.value=Array.from(Tc),this}fromString(t){const e=Dl("number",t);return e.length===16?e.forEach((i,r)=>{i.fullMatch&&(this.value[r]=parseFloat(i.fullMatch))}):this.unit(),this}toMatrix(t){const e=[this.value[0],this.value[1],this.value[4],this.value[5],this.value[12],this.value[13]];return t?(t.value=e,t):new we(e)}multiplyMatrix(t){const e=this.value[0],i=this.value[1],r=this.value[2],s=this.value[3],a=this.value[4],o=this.value[5],h=this.value[6],l=this.value[7],c=this.value[8],d=this.value[9],f=this.value[10],u=this.value[11],m=this.value[12],v=this.value[13],b=this.value[14],S=this.value[15],E=t.value[0],_=t.value[1],x=t.value[2],P=t.value[3],R=E*e+_*a+x*c+P*m,O=E*i+_*o+x*d+P*v,L=E*r+_*h+x*f+P*b,$=E*s+_*l+x*u+P*S;return new we([R,O,L,$,0,0])}multiply(t){const e=new we([t.value[0],t.value[1],t.value[2],t.value[3],0,0]),i=new we([t.value[4],t.value[5],t.value[6],t.value[7],0,0]),r=new we([t.value[8],t.value[9],t.value[10],t.value[11],0,0]),s=new we([t.value[12],t.value[13],t.value[14],t.value[15],0,0]),a=this.multiplyMatrix(e),o=this.multiplyMatrix(i),h=this.multiplyMatrix(r),l=this.multiplyMatrix(s);return this.value[0]=a.value[0],this.value[1]=a.value[1],this.value[2]=a.value[2],this.value[3]=a.value[3],this.value[4]=o.value[0],this.value[5]=o.value[1],this.value[6]=o.value[2],this.value[7]=o.value[3],this.value[8]=h.value[0],this.value[9]=h.value[1],this.value[10]=h.value[2],this.value[11]=h.value[3],this.value[12]=l.value[0],this.value[13]=l.value[1],this.value[14]=l.value[2],this.value[15]=l.value[3],this}translate(t=0,e=0,i=0){return this.multiply(new pn([1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1]))}scale(t=1,e=1,i=1){return this.multiply(new pn([t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1]))}rotate(t,e){const i=la(e),r=Math.sin,s=Math.cos;let a;switch(t){case"x":a=[1,0,0,0,0,s(i),r(i),0,0,-r(i),s(i),0,0,0,0,1];break;case"y":a=[s(i),0,-r(i),0,0,1,0,0,r(i),0,s(i),0,0,0,0,1];break;case"z":a=[s(i),r(i),0,0,-r(i),s(i),0,0,0,0,1,0,0,0,0,1];break}return this.multiply(new pn(a))}toString(){return`matrix3d(${this.value.map(t=>Ul(t,6)).join(",")})`}}function Rr(n){const t=new we;return n.replace(/([a-z0-9]+)\s*\(?\s*((-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)*[a-z%]*\s*,?\s*)+)\)?/gi,function(e,i,r){r.indexOf(",")>=0?r=r.split(/\s*,\s*/):r=r.split(/\s+/);const s=[];for(let a=0,o=r.length;a<o;a++)r[a].trim()&&s.push(parseFloat(""+r[a]));switch(i.toLowerCase()){case"t":case"translate":t.translate(s[0],s[1]);break;case"translatex":t.translateX(s[0]);break;case"translatey":t.translateY(s[0]);break;case"translatez":t.translateZ(s[0]);break;case"translate3d":t.translate3d(s[0],s[1],s[2]);break;case"r":case"rotate":t.rotate(s[0],s[1]??0,s[2]??0);break;case"rotatex":t.rotateX(s[0]);break;case"rotatey":t.rotateY(s[0]);break;case"rotatez":t.rotateZ(s[0]);break;case"rotate3d":t.rotate3d(s[0],s[1],s[2]);break;case"s":case"scale":t.scale(s[0],s[1]??s[0]);break;case"scalex":t.scaleX(s[0]);break;case"scaley":t.scaleY(s[0]);break;case"scalez":t.scaleZ(s[0]);break;case"scale3d":t.scale3d(s[0],s[1],s[2]);break;case"skew":t.skew(s[0],s[1]??0);break;case"skewx":t.skewX(s[0]);break;case"skewy":t.skewY(s[0]);break;case"skewz":t.skewZ(s[0]);break;case"skew3d":t.skew3d(s[0],s[1],s[2]);break;case"m":case"matrix":t.multiply([s[0],s[1],s[2],s[3],s[4],s[5]]);break;case"matrix3d":t.matrix3d.multiply(new pn(s));break}return""}),t}function Uo(n,t,e,i,r,s){if(typeof r>"u"||typeof s>"u"){const a=n-e,o=t-i;return!a&&!o?0:(180+Math.atan2(-o,-a)*180/Math.PI+360)%360}else return Uo(n,t,r,s)-Uo(e,i,r,s)}const Dt=Sc.eve,Ug=Sc.elemental,da={cursor:1,cx:0,cy:0,fill:1,"fill-opacity":0,font:1,"font-family":1,"font-size":0,"font-style":1,"font-weight":1,height:0,"letter-spacing":0,opacity:0,r:0,rx:0,ry:0,src:1,stroke:1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":0,"stroke-opacity":0,"stroke-width":0,"text-anchor":1,width:0,x:0,y:0};function Bo(n,t,e){for(var i=(n+"").split(";"),r=/^\s+|\s+$/g,s,a=0,o=i.length;a<o;a++){var h=i[a].split(":");s=h[0].replace(r,"").replace(/[A-Z]/g,function(l){return"-"+l.toLowerCase()}),(!e||s in e)&&(t[s]=h[1].replace(r,""),e&&!e[s]&&(t[s]=parseFloat(t[s])))}}function kc(n){const t=Ug(),e=[],i=[],r={};let s,a,o;const h={};function l(c,d){return function(f,u){const m={type:d||c};e.push(m);for(let v in u)Object.prototype.hasOwnProperty.call(u,v)&&Dt("rappar."+c+".attr."+v,m,u[v],v);Dt("rappar."+c+".attrend",m,u)}}return Dt.on("rappar.polygon.attr.points",function(c){this.path="M"+c+"z",Dt.stop()}),Dt.on("rappar.image.attr.xlink:href",function(c){this.src=c,Dt.stop()}),Dt.on("rappar.path.attr.d",function(c){this.path=c,Dt.stop()}),Dt.on("rappar.*.attr.transform",function(c){this.transform=Rr(c).toTransformString(),Dt.stop()}),Dt.on("rappar.*.attr.fill",function(c){var d=c.match(/url\(#([^)]+)\)/),f=this;d&&(d=d[1],r[d]?this.fill=r[d]:Dt.on("rappar.found."+d,function(u){f.fill=u}),Dt.stop())}),Dt.on("rappar.line.attrend",function(c){this.path="M"+[c.x1,c.y1,c.x2,c.y2]}),Dt.on("rappar.*.attrend",function(){for(var c=i.length;c--;)if(i[c]!=this){let f="",u="";for(var d in i[c])d=="transform"?f=i[c].transform:d=="class"&&h["."+i[c][d]]?u=h["."+i[c][d]].join(";")+";"+u:d=="id"&&h["#"+i[c][d]]?u=h["#"+i[c][d]].join(";")+";"+u:typeof this[d]>"u"&&(this[d]=i[c][d]);this.type&&(typeof this.transform>"u"?this.transform=f:this.transform+=f,typeof this.style>"u"?this.style=u:this.style=u+this.style,Bo(this.style,this,da))}}),Dt.on("rappar.*.attr.style",function(c){var d=function(){Bo(c,this,da),Dt.unbind("rappar.*.attrend",d)};Dt.on("rappar.*.attrend",d),Dt.stop()}),Dt.on("rappar.*.attr.*",function(c,d){d in da&&(this[d]=da[d]?c:parseFloat(c))}),Dt.on("elemental.tag.circle",l("circle")),Dt.on("elemental.tag.ellipse",l("ellipse")),Dt.on("elemental.tag.polygon",l("polygon","path")),Dt.on("elemental.tag.path",l("path")),Dt.on("elemental.tag.line",l("line","path")),Dt.on("elemental.tag.rect",l("rect")),Dt.on("elemental.tag.image",l("image")),Dt.on("elemental.tag.text",l("text")),Dt.on("elemental.text",function(c){try{const d=$1(c);for(let f of d.stylesheet.rules){for(let u of f.selectors)h[u]=[];for(let u of f.declarations)for(let m of f.selectors)h[m].push(`${u.property}:${u.value}`)}}catch{}}),Dt.on("elemental.tag.svg",function(c,d){let f=d.width||0,u=d.height||0;if(!f||!u){const m=d.viewBox.split(/\s+/gi);f=parseFloat(m[2])-parseFloat(m[0]),u=parseFloat(m[3])-parseFloat(m[1])}e.push({type:"viewbox",width:f,height:u})}),Dt.on("rappar.text.attrend",function(){s="",a=this,this["text-anchor"]=this["text-anchor"]||"start"}),Dt.on("elemental.text",function(c,d,f){a&&(s+=f)}),Dt.on("elemental./tag.text",function(){a.text=s,a=null}),Dt.on("elemental.tag.g",function(c,d){var f={};i.push(f);for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(f[u]=d[u],Dt("rappar.g.attr."+u,f,d[u],u));Dt("rappar.g.attrend",f)}),Dt.on("elemental./tag.g",function(c,d){i.pop()}),Dt.on("elemental.tag.linearGradient",function(c,d){o={id:d.id,angle:+(360+Uo(d.x1,d.y1,d.x2,d.y2,d.x1+100,d.y1)).toFixed(2),stops:[]}}),Dt.on("elemental./tag.linearGradient",function(){for(var c=[o.angle],d,f=0,u=o.stops.length;f<u;f++)d=o.stops[f],f&&f!=u-1?c.push(d.color+":"+d.offset):c.push(d.color);r[o.id]=c.join("-"),Dt("rappar.found."+o.id,null,r[o.id])}),Dt.on("elemental.tag.radialGradient",function(c,d){o={id:d.id,stops:[]}}),Dt.on("elemental./tag.radialGradient",function(){for(var c=[],d,f=0,u=o.stops.length;f<u;f++)d=o.stops[f],f&&f!=u-1?c.push(d.color+":"+d.offset):c.push(d.color);r[o.id]="r"+c.join("-"),Dt("rappar.found."+o.id,null,r[o.id])}),Dt.on("elemental.tag.stop",function(c,d){var f={};d.style&&Bo(d.style,f),f.offset=f.offset||d.offset,f.color=f["stop-color"]||d["stop-color"],f.opacity=f["stop-opacity"]||d["stop-opacity"],~(f.offset+"").indexOf("%")?f.offset=parseFloat(f.offset):f.offset=parseFloat(f.offset)*100,f.offset=+f.offset.toFixed(2),o.stops.push(f)}),t(n),t.end(),e}function Ec(n){return typeof n!="string"?!1:(n=n.trim(),/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(n)&&/[\dz]$/i.test(n)&&n.length>4)}const zo={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Bg=/([astvzqmhlc])([^astvzqmhlc]*)/gi,zg=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function $g(n){const t=n.match(zg);return t?t.map(Number):[]}function ga(n){const t=[];return n.replace(Bg,function(e,i,r){let s=i.toLowerCase();for(r=$g(r),s=="m"&&r.length>2&&(t.push([i].concat(r.splice(0,2))),s="l",i=i=="m"?"l":"L");;){if(r.length==zo[s])return r.unshift(i),t.push(r);if(r.length<zo[s])throw new Error("malformed path data");t.push([i].concat(r.splice(0,zo[s])))}}),t}function pa(n){var t=0,e=0,i=0,r=0;return n.map(function(s){s=s.slice();var a=s[0],o=a.toUpperCase();if(a!=o)switch(s[0]=o,a){case"a":s[6]+=i,s[7]+=r;break;case"v":s[1]+=r;break;case"h":s[1]+=i;break;default:for(var h=1;h<s.length;)s[h++]+=i,s[h++]+=r}switch(o){case"Z":i=t,r=e;break;case"H":i=s[1];break;case"V":r=s[1];break;case"M":i=t=s[1],r=e=s[2];break;default:i=s[s.length-2],r=s[s.length-1]}return s})}function Vg(n){var t=0,e=0,i=0,r=0;return n.map(function(s){s=s.slice();var a=s[0],o=a.toLowerCase();if(a!=o)switch(s[0]=o,a){case"A":s[6]-=i,s[7]-=r;break;case"V":s[1]-=r;break;case"H":s[1]-=i;break;default:for(var h=1;h<s.length;)s[h++]-=i,s[h++]-=r}switch(o){case"z":i=t,r=e;break;case"h":i+=s[1];break;case"v":r+=s[1];break;case"m":i+=s[1],r+=s[2],t+=s[1],e+=s[2];break;default:i+=s[s.length-2],r+=s[s.length-1]}return s})}const Dr=Math.PI*2;function Pc(n,t,e,i){const r=n*i-t*e<0?-1:1;let s=n*e+t*i;return s>1&&(s=1),s<-1&&(s=-1),r*Math.acos(s)}function Hg(n,t,e,i,r,s,a,o,h,l){const c=l*(n-e)/2+h*(t-i)/2,d=-h*(n-e)/2+l*(t-i)/2,f=a*a,u=o*o,m=c*c,v=d*d;let b=f*u-f*v-u*m;b<0&&(b=0),b/=f*v+u*m,b=Math.sqrt(b)*(r===s?-1:1);const S=b*a/o*d,E=b*-o/a*c,_=l*S-h*E+(n+e)/2,x=h*S+l*E+(t+i)/2,P=(c-S)/a,R=(d-E)/o,O=(-c-S)/a,L=(-d-E)/o,$=Pc(1,0,P,R);let U=Pc(P,R,O,L);return s===0&&U>0&&(U-=Dr),s===1&&U<0&&(U+=Dr),[_,x,$,U]}function jg(n,t){const e=1.3333333333333333*Math.tan(t/4),i=Math.cos(n),r=Math.sin(n),s=Math.cos(n+t),a=Math.sin(n+t);return[i,r,i-r*e,r+i*e,s+a*e,a-s*e,s,a]}function Xg(n,t,e,i,r,s,a,o,h){const l=Math.sin(h*Dr/360),c=Math.cos(h*Dr/360),d=c*(n-e)/2+l*(t-i)/2,f=-l*(n-e)/2+c*(t-i)/2;if(d===0&&f===0)return[];if(a===0||o===0)return[];a=Math.abs(a),o=Math.abs(o);const u=d*d/(a*a)+f*f/(o*o);u>1&&(a*=Math.sqrt(u),o*=Math.sqrt(u));const m=Hg(n,t,e,i,r,s,a,o,l,c),v=[];let b=m[2],S=m[3];const E=Math.max(Math.ceil(Math.abs(S)/(Dr/4)),1);S/=E;for(let _=0;_<E;_++)v.push(jg(b,S)),b+=S;return v.map(_=>{for(let x=0;x<_.length;x+=2){let P=_[x+0],R=_[x+1];P*=a,R*=o;const O=c*P-l*R,L=l*P+c*R;_[x+0]=O+m[0],_[x+1]=L+m[1]}return _})}function ma(n){for(var t,e=[],i=0,r=0,s=0,a=0,o=null,h=null,l=0,c=0,d=0,f=n.length;d<f;d++){var u=n[d],m=u[0];switch(m){case"M":s=u[1],a=u[2];break;case"A":var v=Xg(l,c,u[6],u[7],u[4],u[5],u[1],u[2],u[3]);if(!v.length)continue;v=v.map(x=>{const[P,R,O,L,$,U,z,q]=x;return{x1:O,y1:L,x2:$,y2:U,x:z,y:q}});for(var b=0,S;b<v.length;b++)S=v[b],u=["C",S.x1,S.y1,S.x2,S.y2,S.x,S.y],b<v.length-1&&e.push(u);break;case"S":var E=l,_=c;(t=="C"||t=="S")&&(E+=E-i,_+=_-r),u=["C",E,_,u[1],u[2],u[3],u[4]];break;case"T":t=="Q"||t=="T"?(o=l*2-o,h=c*2-h):(o=l,h=c),u=Ac(l,c,o,h,u[1],u[2]);break;case"Q":o=u[1],h=u[2],u=Ac(l,c,u[1],u[2],u[3],u[4]);break;case"L":u=va(l,c,u[1],u[2]);break;case"H":u=va(l,c,u[1],c);break;case"V":u=va(l,c,l,u[1]);break;case"Z":u=va(l,c,s,a);break}t=m,l=u[u.length-2],c=u[u.length-1],u.length>4?(i=u[u.length-4],r=u[u.length-3]):(i=l,r=c),e.push(u)}return e}function va(n,t,e,i){return["C",n,t,e,i,e,i]}function Ac(n,t,e,i,r,s){return["C",n/3+2/3*e,t/3+2/3*i,r/3+2/3*e,s/3+2/3*i,r,s]}const Yg=n=>Array.isArray(n);function Xn(n){if(!(this instanceof Xn))return new Xn(n);this._path=Yg(n)?n:ga(n),this._path=pa(this._path),this._path=Wg(this._path),this._path=qg(this._path)}Xn.prototype.at=function(n,t){return this._walk(n,t).pos},Xn.prototype.length=function(){return this._walk(null).length},Xn.prototype._walk=function(n,t){let e=[0,0],i=[0,0,0],r=[0,0],s=0;for(let c=0;c<this._path.length;c++){let d=this._path[c];if(d[0]==="M"){if(e[0]=d[1],e[1]=d[2],n===0)return{length:s,pos:e}}else if(d[0]==="C"){i[0]=r[0]=e[0],i[1]=r[1]=e[1],i[2]=s;let f=100;for(let u=0;u<=f;u++){let m=u/f,v=a(d,m),b=o(d,m);if(s+=$o(e[0],e[1],v,b),e[0]=v,e[1]=b,typeof n=="number"&&s>=n){let S=(s-n)/(s-i[2]),E=[e[0]*(1-S)+i[0]*S,e[1]*(1-S)+i[1]*S];return{length:s,pos:E}}i[0]=e[0],i[1]=e[1],i[2]=s}}else if(d[0]==="Q"){i[0]=r[0]=e[0],i[1]=r[1]=e[1],i[2]=s;let f=100;for(let u=0;u<=f;u++){let m=u/f,v=h(d,m),b=l(d,m);if(s+=$o(e[0],e[1],v,b),e[0]=v,e[1]=b,typeof n=="number"&&s>=n){let S=(s-n)/(s-i[2]),E=[e[0]*(1-S)+i[0]*S,e[1]*(1-S)+i[1]*S];return{length:s,pos:E}}i[0]=e[0],i[1]=e[1],i[2]=s}}else if(d[0]==="L"){if(i[0]=e[0],i[1]=e[1],i[2]=s,s+=$o(e[0],e[1],d[1],d[2]),e[0]=d[1],e[1]=d[2],typeof n=="number"&&s>=n){let f=(s-n)/(s-i[2]),u=[e[0]*(1-f)+i[0]*f,e[1]*(1-f)+i[1]*f];return{length:s,pos:u}}i[0]=e[0],i[1]=e[1],i[2]=s}}return{length:s,pos:e};function a(c,d){return Math.pow(1-d,3)*r[0]+3*Math.pow(1-d,2)*d*c[1]+3*(1-d)*Math.pow(d,2)*c[3]+Math.pow(d,3)*c[5]}function o(c,d){return Math.pow(1-d,3)*r[1]+3*Math.pow(1-d,2)*d*c[2]+3*(1-d)*Math.pow(d,2)*c[4]+Math.pow(d,3)*c[6]}function h(c,d){return Math.pow(1-d,2)*r[0]+2*(1-d)*d*c[1]+Math.pow(d,2)*c[3]}function l(c,d){return Math.pow(1-d,2)*r[1]+2*(1-d)*d*c[2]+Math.pow(d,2)*c[4]}};function $o(n,t,e,i){let r=n-e,s=t-i;return Math.sqrt(r*r+s*s)}function qg(n){let t,e=0,i=0,r={S:{to:"C",x:3},T:{to:"Q",x:1}};for(let s=0,a=n.length;s<a;s++){let o=n[s],h=r[o[0]];h&&(o[0]=h.to,t&&(t[0]===h.to?(e=2*t[h.x+2]-t[h.x],i=2*t[h.x+3]-t[h.x+1]):(e=t[t.length-2],i=t[t.length-1])),o.splice(1,0,e,i)),t=o}return n}function Wg(n){let t=[],e=["L",0,0],i;for(let r=0,s=n.length;r<s;r++){let a=n[r];switch(a[0]){case"M":e=["L",a[1],a[2]],t.push(a);break;case"Z":t.push(e);break;case"H":i=t[t.length-1]||["L",0,0],t.push(["L",a[1],i[i.length-1]]);break;case"V":i=t[t.length-1]||["L",0,0],t.push(["L",i[i.length-2],a[1]]);break;default:t.push(a)}}return t}const Vo=n=>{if(typeof n=="function"||Object(n)!==n)return n;const t=new n.constructor;for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=Vo(n[e]));return t};function Ho(n){const t=Ho.ps=Ho.ps||{};return t[n]?t[n].sleep=100:t[n]={sleep:100},setTimeout(()=>{for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e!==n&&(t[e].sleep--,t[e].sleep||delete t[e])}),t[n]}function Lr(n,t,e,i){return n==null&&(n=t=e=i=0),t==null&&(t=n.y,e=n.width,i=n.height,n=n.x),{x:n,y:t,width:e,w:e,height:i,h:i,x2:n+e,y2:t+i,cx:n+e/2,cy:t+i/2,r1:Math.min(e,i)/2,r2:Math.max(e,i)/2,r0:Math.sqrt(e*e+i*i)/2,path:ip(n,t,e,i),vb:[n,t,e,i].join(" ")}}function Mc(n,t,e,i,r,s,a,o,h){const l=1-h,c=l**3,d=l**2,f=h*h,u=f*h,m=c*n+d*3*h*e+l*3*h*h*r+u*a,v=c*t+d*3*h*i+l*3*h*h*s+u*o,b=n+2*h*(e-n)+f*(r-2*e+n),S=t+2*h*(i-t)+f*(s-2*i+t),E=e+2*h*(r-e)+f*(a-2*r+e),_=i+2*h*(s-i)+f*(o-2*s+i),x=l*n+h*e,P=l*t+h*i,R=l*r+h*a,O=l*s+h*o,L=90-Math.atan2(b-E,S-_)*180/Math.PI;return{x:m,y:v,m:{x:b,y:S},n:{x:E,y:_},start:{x,y:P},end:{x:R,y:O},alpha:L}}function Rc(n,t,e,i,r,s,a,o){Array.isArray(n)||(n=[n,t,e,i,r,s,a,o]);const h=Ic(...n);return Lr(h.min.x,h.min.y,h.max.x-h.min.x,h.max.y-h.min.y)}function Kg(n,t,e){return t>=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height}function Zg(n,t){n=Lr(n),t=Lr(t);const{x:e,y:i,width:r,height:s}=n,{x:a,y:o,width:h,height:l}=t,c=e+r/2,d=i+s/2,f=a+h/2,u=o+l/2;return Math.abs(c-f)<=(r+h)/2||Math.abs(d-u)<=(s+l)/2}function Dc(n,t,e,i,r){const s=-3*t+9*e-9*i+3*r,a=n*s+6*t-12*e+6*i;return n*a-3*t+3*e}function Lc(n,t,e,i,r,s,a,o,h){h==null&&(h=1),h=Math.max(0,Math.min(h,1));const l=h/2,c=12,d=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472];let u=0;for(let m=0;m<c;m++){const v=l*d[m]+l,b=Dc(v,n,e,r,a),S=Dc(v,t,i,s,o),E=b*b+S*S;u+=f[m]*Math.sqrt(E)}return l*u}function Jg(n,t,e,i,r,s,a,o){if(Math.max(n,e)<Math.min(r,a)||Math.min(n,e)>Math.max(r,a)||Math.max(t,i)<Math.min(s,o)||Math.min(t,i)>Math.max(s,o))return;const h=(n*i-t*e)*(r-a)-(n-e)*(r*o-s*a),l=(n*i-t*e)*(s-o)-(t-i)*(r*o-s*a),c=(n-e)*(s-o)-(t-i)*(r-a);if(!c)return;const d=h/c,f=l/c,u=Number(d.toFixed(2)),m=Number(f.toFixed(2));if(!(u<Number(Math.min(n,e).toFixed(2))||u>Number(Math.max(n,e).toFixed(2))||u<Number(Math.min(r,a).toFixed(2))||u>Number(Math.max(r,a).toFixed(2))||m<Number(Math.min(t,i).toFixed(2))||m>Number(Math.max(t,i).toFixed(2))||m<Number(Math.min(s,o).toFixed(2))||m>Number(Math.max(s,o).toFixed(2))))return{x:d,y:f}}function Qg(n,t,e){const i=Rc(n),r=Rc(t);if(!Zg(i,r))return e?0:[];const s=Lc.apply(0,n),a=Lc.apply(0,t),o=Math.ceil(s/8),h=Math.ceil(a/8),l=[],c=[],d={};let f=e?0:[];for(let u=0;u<o+1;u++){const m=Mc.apply(0,n.concat(u/o));l.push({x:m.x,y:m.y,t:u/o})}for(let u=0;u<h+1;u++){const m=Mc.apply(0,t.concat(u/h));c.push({x:m.x,y:m.y,t:u/h})}for(let u=0;u<o;u++)for(let m=0;m<h;m++){const v=l[u],b=l[u+1],S=c[m],E=c[m+1],_=Math.abs(b.x-v.x)<.001?"y":"x",x=Math.abs(E.x-S.x)<.001?"y":"x",P=Jg(v.x,v.y,b.x,b.y,S.x,S.y,E.x,E.y);if(P&&d[P.x.toFixed(4)]!==P.y.toFixed(4)){d[P.x.toFixed(4)]=P.y.toFixed(4);const R=v.t+Math.abs((P[_]-v[_])/(b[_]-v[_]))*(b.t-v.t),O=S.t+Math.abs((P[x]-S[x])/(E[x]-S[x]))*(E.t-S.t);R>=0&&R<=1&&O>=0&&O<=1&&(e?f++:f.push({x:P.x,y:P.y,t1:R,t2:O}))}}return f}function tp(n,t,e){let i,r,s,a,o,h,l,c,d,f,u=e?0:[];for(let m=0,v=n.length;m<v;m++){const b=n[m];if(b[0]==="M")i=o=b[1],r=h=b[2];else{b[0]==="C"?(d=[i,r].concat(b.slice(1)),i=d[6],r=d[7]):(d=[i,r,i,r,o,h,o,h],i=o,r=h);for(let S=0,E=t.length;S<E;S++){const _=t[S];if(_[0]==="M")s=l=_[1],a=c=_[2];else{_[0]==="C"?(f=[s,a].concat(_.slice(1)),s=f[6],a=f[7]):(f=[s,a,s,a,l,c,l,c],s=l,a=c);const x=Qg(d,f,e);if(e)u+=x;else{for(let P=0,R=x.length;P<R;P++)x[P].segment1=m,x[P].segment2=S,x[P].bez1=d,x[P].bez2=f;u=u.concat(x)}}}}}return u}function ep(n){const t=Ho(n);if(t.bbox)return Vo(t.bbox);if(!n)return Lr();let e=0,i=0,r=[],s=[],a=[];for(let f=0,u=n.length;f<u;f++)if(a=n[f],a[0]==="M")e=a[1],i=a[2],r.push(e),s.push(i);else{const m=Ic(e,i,a[1],a[2],a[3],a[4],a[5],a[6]);r=r.concat(m.min.x,m.max.x),s=s.concat(m.min.y,m.max.y),e=a[5],i=a[6]}const o=Math.min.apply(0,r),h=Math.min.apply(0,s),l=Math.max.apply(0,r),c=Math.max.apply(0,s),d=Lr(o,h,l-o,c-h);return t.bbox=Vo(d),d}function ip(n,t,e,i,r){return r?[["M",Number(n)+Number(r),t],["l",e-r*2,0],["a",r,r,0,0,1,r,r],["l",0,i-r*2],["a",r,r,0,0,1,-r,r],["l",r*2-e,0],["a",r,r,0,0,1,-r,-r],["l",0,r*2-i],["a",r,r,0,0,1,r,-r],["z"]]:[["M",n,t],["l",e,0],["l",0,i],["l",-e,0],["z"]]}function Ic(n,t,e,i,r,s,a,o){const h=[],l=[[],[]];let c,d,f,u,m,v,b,S;for(let P=0;P<2;++P){if(P===0?(d=6*n-12*e+6*r,c=-3*n+9*e-9*r+3*a,f=3*e-3*n):(d=6*t-12*i+6*s,c=-3*t+9*i-9*s+3*o,f=3*i-3*t),Math.abs(c)<1e-12){if(Math.abs(d)<1e-12)continue;u=-f/d,u>0&&u<1&&h.push(u);continue}b=d*d-4*f*c,S=Math.sqrt(b),!(b<0)&&(m=(-d+S)/(2*c),m>0&&m<1&&h.push(m),v=(-d-S)/(2*c),v>0&&v<1&&h.push(v))}let E=h.length,_;const x=E;for(;E--;)u=h[E],_=1-u,l[0][E]=_*_*_*n+3*_*_*u*e+3*_*u*u*r+u*u*u*a,l[1][E]=_*_*_*t+3*_*_*u*i+3*_*u*u*s+u*u*u*o;return l[0][x]=n,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=o,l[0].length=l[1].length=x+2,{min:{x:Math.min.apply(0,l[0]),y:Math.min.apply(0,l[1])},max:{x:Math.max.apply(0,l[0]),y:Math.max.apply(0,l[1])}}}function np(n,t,e){const i=ep(n);return!(!Kg(i,t,e)||tp(n,ma([["M",t,e],["H",i.x2+10]]),1)%2!==1)}const jo=new Map;function Fc(n){if(jo.has(n))return jo.get(n);const t=Xn(n);return jo.set(n,t),t}function Oc(n){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",n),t}function Nc(n,t){return ia?Oc(n).getTotalLength(t):Fc(n).length()}function Gc(n,t){if(ia)return Oc(n).getPointAtLength(t);{const e=Fc(n),[i,r]=e.at(t);return{x:i,y:r}}}let $e=null;function Uc(n,t,e){if(ia){$e||($e=document.createElement("canvas").getContext("2d"));const i=new Path2D(n);return $e.isPointInPath(i,t,e)}else return np(n,t,e)}function Bc(n,t,e,{lineWidth:i=1,lineCap:r="butt",lineJoin:s="miter"}){if(ia){if($e||($e=document.createElement("canvas").getContext("2d")),$e.isPointInStroke){$e.save(),$e.lineWidth=i,$e.lineCap=r,$e.lineJoin=s;const a=new Path2D(n),o=$e.isPointInStroke(a,t,e);return $e.restore(),o}}else return null}const zc=class k1{point;constructor(t){this.point=new Wt(t)}static fromSVGPathData(t){if(t.length<3)throw new Error("Line 参数个数错误");if(t[0].toUpperCase()!=="L")throw new Error("Line command 错误");return new k1({x:t[1],y:t[2]})}toSVGPathData(){return["L",this.point.x,this.point.y]}toSVGPathD(){return"L "+this.point.toSVGPathD()}},$c=class E1 extends zc{rx;ry;xAxisRotate;largeArcFlag;sweepFlag;constructor(t){super(t),this.rx=t.rx,this.ry=t.ry,this.xAxisRotate=t?.xAxisRotate??0,this.largeArcFlag=t?.largeArcFlag??1,this.sweepFlag=t?.sweepFlag??1}static fromSVGPathData(t){if(t.length<8)throw new Error("Arc 参数个数错误");if(t[0].toUpperCase()!=="A")throw new Error("Arc command 错误");return new E1({x:t[6],y:t[7],rx:t[1],ry:t[2],xAxisRotate:t[3],largeArcFlag:t[4],sweepFlag:t[5]})}toSVGPathData(){return["A",this.rx,this.ry,this.xAxisRotate,this.largeArcFlag,this.sweepFlag,this.point.x,this.point.y]}toSVGPathD(){return`A ${this.rx},${this.ry} ${this.xAxisRotate} ${this.largeArcFlag},${this.sweepFlag} ${this.point.toSVGPathD()}`}};class Xo extends zc{ctrlPoints=[];constructor(t){super(t),this.ctrlPoints.push(new Wt({x:t.c1x,y:t.c1y})),this.ctrlPoints.push(new Wt({x:t.c2x,y:t.c2y}))}static fromSVGPathData(t){if(t.length<7)throw new Error("CubicBezier 参数个数错误");if(t[0].toUpperCase()!=="C")throw new Error("CubicBezier command 错误");return new Xo({c1x:t[1],c1y:t[2],c2x:t[3],c2y:t[4],x:t[5],y:t[6]})}toSVGPathData(){return["C",this.ctrlPoints[0].x,this.ctrlPoints[0].y,this.ctrlPoints[1].x,this.ctrlPoints[1].y,this.point.x,this.point.y]}toSVGPathD(){return`C ${this.ctrlPoints.map(t=>t.toSVGPathD()).join(" ")} ${this.point.toSVGPathD()}`}}const Yo=Xo;class mn{startPoint;isClosed=!1;lines=[];normalizedLines=[];constructor(t){this.startPoint=t?.startPoint??null,this.isClosed=t?.isClosed??!1,t?.lines?.forEach(this.addLine),this.normalize()}setStartPoint(t,e){return this.startPoint=new Wt({x:t,y:e}),this}addLine(t){return this.lines.push(t),this}normalize(){let t=this.lines.reduce((i,r)=>(i+=r.toSVGPathD(),i),"");this.startPoint&&(t="M "+this.startPoint.toSVGPathD()+t),this.isClosed&&(t+="Z"),this.normalizedLines=[];const e=ma(pa(ga(t)));for(let i=0,r=e.length;i<r;i++){const s=e[i];if(i==0&&s[0]=="M"){this.setStartPoint(s[1],s[2]);continue}if(i==r-1&&s[0]=="Z"){this.isClosed=!0;continue}this.normalizedLines.push(Yo.fromSVGPathData(s))}return this}static fromSVGPathD(t,e){if(!Ec(t))throw new Error("Not an SVG path!");const i=ma(pa(ga(t)));return mn.fromSVGPathData(i,e)}static fromSVGPathData(t,e){const i=new mn;for(let s=0,a=t.length;s<a;s++){const o=t[s],h=o[0];if(s==0&&h=="M"){i.setStartPoint(o[1],o[2]);continue}if(s==a-1&&h=="Z"){i.isClosed=!0;continue}i.addLine(new Yo({c1x:o[1],c1y:o[2],c2x:o[3],c2y:o[4],x:o[5],y:o[6]}))}i.normalize();const r=Rr(e??"");return i.transform(r)}toSVGPathD(){let t="";this.startPoint&&(t+="M "+this.startPoint.toSVGPathD());for(let e=0,i=this.normalizedLines.length;e<i;e++)t+=this.normalizedLines[e].toSVGPathD();return this.isClosed&&(t+="Z"),t}toSVGPathData(){const t=[];this.startPoint&&t.push(["M",...this.startPoint.toSVGPathData()]);for(let e=0,i=this.normalizedLines.length;e<i;e++)t.push(this.normalizedLines[e].toSVGPathData());return this.isClosed&&t.push(["Z"]),t}toCanvas(t){const e=this.normalizedLines;e.length&&(this.startPoint&&(t.beginPath(),t.moveTo(this.startPoint.x,this.startPoint.y)),e.forEach(i=>{const[r,...s]=i.toSVGPathData();r==="M"?t.moveTo(s[0],s[1]):r==="Z"?t.closePath():t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}),this.isClosed&&t.closePath())}get bounds(){let t=[0,0,0,0];if(this.normalizedLines.length){t=[1/0,1/0,-1/0,-1/0];for(let e=0,i=this.normalizedLines.length;e<i;e++){const r=this.normalizedLines[e],s=[...r.ctrlPoints,r.point];for(let a=0;a<s.length;a++){const o=s[a].x,h=s[a].y;o<t[0]&&(t[0]=o),h<t[1]&&(t[1]=h),o>t[2]&&(t[2]=o),h>t[3]&&(t[3]=h)}}}return t}get size(){const t=this.bounds;return[t[2]-t[0],t[3]-t[1]]}get center(){const[t,e,i,r]=this.bounds;return[(t+i)/2,(e+r)/2]}getTotalLength(){return Nc(this.toSVGPathD())}getPointAtLength(t){return Gc(this.toSVGPathD(),t)}isPointInPath(t,e){return Uc(this.toSVGPathD(),t,e)}isPointInStroke(t,e,i={lineWidth:1,lineCap:"butt",lineJoin:"miter"}){return Bc(this.toSVGPathD(),t,e,i)}transform(t){if(this.startPoint){const[e,i]=t.transformPoint(this.startPoint.x,this.startPoint.y);this.setStartPoint(e,i)}return this.normalizedLines=this.normalizedLines.map(e=>{const[i,...r]=e.toSVGPathData(),s=[i];for(let a=0,o=r.length;a<o;a+=2){const h=r[a],l=r[a+1],[c,d]=t.transformPoint(h,l);s.push(c,d)}return Yo.fromSVGPathData(s)}),this}translate(t,e){const i=new we().translate(t,e);return this.transform(i)}rotate(t,e=0,i=0){const r=new we().rotate(t,e,i);return this.transform(r)}scale(t,e=t,i=0,r=0){const s=new we().scale(t,e,i,r);return this.transform(s)}skew(t,e=0){const i=new we().skew(t,e);return this.transform(i)}trim(){const[t,e]=this.bounds;return this.translate(-t,-e),this}static generateRosetta(t,e,i,r,s){if(s==0)throw new Error("no dividing by zero, please");const a=new mn;a.setStartPoint(t,e);const o=360/s;for(let h=0;h<s;h+=1){const l=o*h*Math.PI/180,c=t+2*i*Math.cos(l),d=e+2*i*Math.sin(l);a.addLine(new $c({x:c,y:d,rx:i,ry:r,xAxisRotate:o*h,largeArcFlag:1,sweepFlag:1})),a.addLine(new $c({x:t,y:e,rx:i,ry:r,xAxisRotate:o*h,largeArcFlag:1,sweepFlag:1}))}return a.normalize(),a}}var Vc={exports:{}};(function(n,t){(function(e,i){n.exports=i()})(window,function(){return function(e){var i={};function r(s){if(i[s])return i[s].exports;var a=i[s]={i:s,l:!1,exports:{}};return e[s].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=i,r.d=function(s,a,o){r.o(s,a)||Object.defineProperty(s,a,{enumerable:!0,get:o})},r.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},r.t=function(s,a){if(1&a&&(s=r(s)),8&a||4&a&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),2&a&&typeof s!="string")for(var h in s)r.d(o,h,function(l){return s[l]}.bind(null,h));return o},r.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return r.d(a,"a",a),a},r.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},r.p="",r(r.s=1)}([function(e,i,r){var s,a;s=[r(2)],(a=function(o){function h(p){if(h.is(p,"function"))return l?p():o.on("raphael.DOMload",p);if(h.is(p,nt))return h._engine.create[E](h,p.splice(0,3+h.is(p[0],pt))).add(p);var w=Array.prototype.slice.call(arguments,0);if(h.is(w[w.length-1],"function")){var C=w.pop();return l?C.call(h._engine.create[E](h,w)):o.on("raphael.DOMload",function(){C.call(h._engine.create[E](h,w))})}return h._engine.create[E](h,arguments)}h.version="2.3.0",h.eve=o;var l,c,d=/[, ]+/,f={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},u=/\{(\d+)\}/g,m="hasOwnProperty",v={doc:document,win:window},b={was:Object.prototype[m].call(v.win,"Raphael"),is:v.win.Raphael},S=function(){this.ca=this.customAttributes={}},E="apply",_="concat",x="ontouchstart"in window||window.TouchEvent||window.DocumentTouch&&document instanceof DocumentTouch,P="",R=" ",O=String,L="split",$="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[L](R),U={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},z=O.prototype.toLowerCase,q=Math,K=q.max,Z=q.min,at=q.abs,vt=q.pow,_t=q.PI,pt="number",nt="array",J=Object.prototype.toString,I=(h._ISURL=/^url\(['"]?(.+?)['"]?\)$/i,/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i),D={NaN:1,Infinity:1,"-Infinity":1},A=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,B=q.round,j=parseFloat,W=parseInt,N=O.prototype.toUpperCase,Y=h._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0,class:""},X=h._availableAnimAttrs={blur:pt,"clip-rect":"csv",cx:pt,cy:pt,fill:"colour","fill-opacity":pt,"font-size":pt,height:pt,opacity:pt,path:"path",r:pt,rx:pt,ry:pt,stroke:"colour","stroke-opacity":pt,"stroke-width":pt,transform:"transform",width:pt,x:pt,y:pt},et=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,ht={hs:1,rg:1},mt=/,?([achlmqrstvxz]),?/gi,bt=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,Tt=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,yt=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi,Et=(h._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,{}),Pt=function(p,w){return j(p)-j(w)},Ft=function(p){return p},Ct=h._rectPath=function(p,w,C,g,y){return y?[["M",p+y,w],["l",C-2*y,0],["a",y,y,0,0,1,y,y],["l",0,g-2*y],["a",y,y,0,0,1,-y,y],["l",2*y-C,0],["a",y,y,0,0,1,-y,-y],["l",0,2*y-g],["a",y,y,0,0,1,y,-y],["z"]]:[["M",p,w],["l",C,0],["l",0,g],["l",-C,0],["z"]]},Jt=function(p,w,C,g){return g==null&&(g=C),[["M",p,w],["m",0,-g],["a",C,g,0,1,1,0,2*g],["a",C,g,0,1,1,0,-2*g],["z"]]},zt=h._getPath={path:function(p){return p.attr("path")},circle:function(p){var w=p.attrs;return Jt(w.cx,w.cy,w.r)},ellipse:function(p){var w=p.attrs;return Jt(w.cx,w.cy,w.rx,w.ry)},rect:function(p){var w=p.attrs;return Ct(w.x,w.y,w.width,w.height,w.r)},image:function(p){var w=p.attrs;return Ct(w.x,w.y,w.width,w.height)},text:function(p){var w=p._getBBox();return Ct(w.x,w.y,w.width,w.height)},set:function(p){var w=p._getBBox();return Ct(w.x,w.y,w.width,w.height)}},ce=h.mapPath=function(p,w){if(!w)return p;var C,g,y,k,M,F,G;for(y=0,M=(p=Nn(p)).length;y<M;y++)for(k=1,F=(G=p[y]).length;k<F;k+=2)C=w.x(G[k],G[k+1]),g=w.y(G[k],G[k+1]),G[k]=C,G[k+1]=g;return p};if(h._g=v,h.type=v.win.SVGAngle||v.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML",h.type=="VML"){var Xt,Ee=v.doc.createElement("div");if(Ee.innerHTML='<v:shape adj="1"/>',(Xt=Ee.firstChild).style.behavior="url(#default#VML)",!Xt||typeof Xt.adj!="object")return h.type=P;Ee=null}function ye(p){if(typeof p=="function"||Object(p)!==p)return p;var w=new p.constructor;for(var C in p)p[m](C)&&(w[C]=ye(p[C]));return w}h.svg=!(h.vml=h.type=="VML"),h._Paper=S,h.fn=c=S.prototype=h.prototype,h._id=0,h.is=function(p,w){return(w=z.call(w))=="finite"?!D[m](+p):w=="array"?p instanceof Array:w=="null"&&p===null||w==typeof p&&p!==null||w=="object"&&p===Object(p)||w=="array"&&Array.isArray&&Array.isArray(p)||J.call(p).slice(8,-1).toLowerCase()==w},h.angle=function(p,w,C,g,y,k){if(y==null){var M=p-C,F=w-g;return M||F?(180+180*q.atan2(-F,-M)/_t+360)%360:0}return h.angle(p,w,y,k)-h.angle(C,g,y,k)},h.rad=function(p){return p%360*_t/180},h.deg=function(p){return Math.round(180*p/_t%360*1e3)/1e3},h.snapTo=function(p,w,C){if(C=h.is(C,"finite")?C:10,h.is(p,nt)){for(var g=p.length;g--;)if(at(p[g]-w)<=C)return p[g]}else{var y=w%(p=+p);if(y<C)return w-y;if(y>p-C)return w-y+p}return w};var li,on;h.createUUID=(li=/[xy]/g,on=function(p){var w=16*q.random()|0;return(p=="x"?w:3&w|8).toString(16)},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(li,on).toUpperCase()}),h.setWindow=function(p){o("raphael.setWindow",h,v.win,p),v.win=p,v.doc=v.win.document,h._engine.initWin&&h._engine.initWin(v.win)};var Qe=function(p){if(h.vml){var w,C=/^\s+|\s+$/g;try{var g=new ActiveXObject("htmlfile");g.write("<body>"),g.close(),w=g.body}catch{w=createPopup().document.body}var y=w.createTextRange();Qe=ve(function(M){try{w.style.color=O(M).replace(C,P);var F=y.queryCommandValue("ForeColor");return"#"+("000000"+(F=(255&F)<<16|65280&F|(16711680&F)>>>16).toString(16)).slice(-6)}catch{return"none"}})}else{var k=v.doc.createElement("i");k.title="Raphaël Colour Picker",k.style.display="none",v.doc.body.appendChild(k),Qe=ve(function(M){return k.style.color=M,v.doc.defaultView.getComputedStyle(k,P).getPropertyValue("color")})}return Qe(p)},Ri=function(){return"hsb("+[this.h,this.s,this.b]+")"},Di=function(){return"hsl("+[this.h,this.s,this.l]+")"},ci=function(){return this.hex},ui=function(p,w,C){if(w==null&&h.is(p,"object")&&"r"in p&&"g"in p&&"b"in p&&(C=p.b,w=p.g,p=p.r),w==null&&h.is(p,"string")){var g=h.getRGB(p);p=g.r,w=g.g,C=g.b}return(p>1||w>1||C>1)&&(p/=255,w/=255,C/=255),[p,w,C]},dr=function(p,w,C,g){var y={r:p*=255,g:w*=255,b:C*=255,hex:h.rgb(p,w,C),toString:ci};return h.is(g,"finite")&&(y.opacity=g),y};function ve(p,w,C){return function g(){var y=Array.prototype.slice.call(arguments,0),k=y.join("␀"),M=g.cache=g.cache||{},F=g.count=g.count||[];return M[m](k)?(function(G,H){for(var Q=0,st=G.length;Q<st;Q++)if(G[Q]===H)return G.push(G.splice(Q,1)[0])}(F,k),C?C(M[k]):M[k]):(F.length>=1e3&&delete M[F.shift()],F.push(k),M[k]=p[E](w,y),C?C(M[k]):M[k])}}h.color=function(p){var w;return h.is(p,"object")&&"h"in p&&"s"in p&&"b"in p?(w=h.hsb2rgb(p),p.r=w.r,p.g=w.g,p.b=w.b,p.hex=w.hex):h.is(p,"object")&&"h"in p&&"s"in p&&"l"in p?(w=h.hsl2rgb(p),p.r=w.r,p.g=w.g,p.b=w.b,p.hex=w.hex):(h.is(p,"string")&&(p=h.getRGB(p)),h.is(p,"object")&&"r"in p&&"g"in p&&"b"in p?(w=h.rgb2hsl(p),p.h=w.h,p.s=w.s,p.l=w.l,w=h.rgb2hsb(p),p.v=w.b):(p={hex:"none"}).r=p.g=p.b=p.h=p.s=p.v=p.l=-1),p.toString=ci,p},h.hsb2rgb=function(p,w,C,g){var y,k,M,F,G;return this.is(p,"object")&&"h"in p&&"s"in p&&"b"in p&&(C=p.b,w=p.s,g=p.o,p=p.h),F=(G=C*w)*(1-at((p=(p*=360)%360/60)%2-1)),y=k=M=C-G,dr(y+=[G,F,0,0,F,G][p=~~p],k+=[F,G,G,F,0,0][p],M+=[0,0,F,G,G,F][p],g)},h.hsl2rgb=function(p,w,C,g){var y,k,M,F,G;return this.is(p,"object")&&"h"in p&&"s"in p&&"l"in p&&(C=p.l,w=p.s,p=p.h),(p>1||w>1||C>1)&&(p/=360,w/=100,C/=100),F=(G=2*w*(C<.5?C:1-C))*(1-at((p=(p*=360)%360/60)%2-1)),y=k=M=C-G/2,dr(y+=[G,F,0,0,F,G][p=~~p],k+=[F,G,G,F,0,0][p],M+=[0,0,F,G,G,F][p],g)},h.rgb2hsb=function(p,w,C){var g,y;return p=(C=ui(p,w,C))[0],w=C[1],C=C[2],{h:(((y=(g=K(p,w,C))-Z(p,w,C))==0?null:g==p?(w-C)/y:g==w?(C-p)/y+2:(p-w)/y+4)+360)%6*60/360,s:y==0?0:y/g,b:g,toString:Ri}},h.rgb2hsl=function(p,w,C){var g,y,k,M;return p=(C=ui(p,w,C))[0],w=C[1],C=C[2],g=((y=K(p,w,C))+(k=Z(p,w,C)))/2,{h:(((M=y-k)==0?null:y==p?(w-C)/M:y==w?(C-p)/M+2:(p-w)/M+4)+360)%6*60/360,s:M==0?0:g<.5?M/(2*g):M/(2-2*g),l:g,toString:Di}},h._path2string=function(){return this.join(",").replace(mt,"$1")},h._preload=function(p,w){var C=v.doc.createElement("img");C.style.cssText="position:absolute;left:-9999em;top:-9999em",C.onload=function(){w.call(this),this.onload=null,v.doc.body.removeChild(this)},C.onerror=function(){v.doc.body.removeChild(this)},v.doc.body.appendChild(C),C.src=p};function fi(){return this.hex}function hn(p,w){for(var C=[],g=0,y=p.length;y-2*!w>g;g+=2){var k=[{x:+p[g-2],y:+p[g-1]},{x:+p[g],y:+p[g+1]},{x:+p[g+2],y:+p[g+3]},{x:+p[g+4],y:+p[g+5]}];w?g?y-4==g?k[3]={x:+p[0],y:+p[1]}:y-2==g&&(k[2]={x:+p[0],y:+p[1]},k[3]={x:+p[2],y:+p[3]}):k[0]={x:+p[y-2],y:+p[y-1]}:y-4==g?k[3]=k[2]:g||(k[0]={x:+p[g],y:+p[g+1]}),C.push(["C",(-k[0].x+6*k[1].x+k[2].x)/6,(-k[0].y+6*k[1].y+k[2].y)/6,(k[1].x+6*k[2].x-k[3].x)/6,(k[1].y+6*k[2].y-k[3].y)/6,k[2].x,k[2].y])}return C}h.getRGB=ve(function(p){if(!p||(p=O(p)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:fi};if(p=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:fi};!ht[m](p.toLowerCase().substring(0,2))&&p.charAt()!="#"&&(p=Qe(p));var w,C,g,y,k,M,F=p.match(I);return F?(F[2]&&(g=W(F[2].substring(5),16),C=W(F[2].substring(3,5),16),w=W(F[2].substring(1,3),16)),F[3]&&(g=W((k=F[3].charAt(3))+k,16),C=W((k=F[3].charAt(2))+k,16),w=W((k=F[3].charAt(1))+k,16)),F[4]&&(M=F[4][L](et),w=j(M[0]),M[0].slice(-1)=="%"&&(w*=2.55),C=j(M[1]),M[1].slice(-1)=="%"&&(C*=2.55),g=j(M[2]),M[2].slice(-1)=="%"&&(g*=2.55),F[1].toLowerCase().slice(0,4)=="rgba"&&(y=j(M[3])),M[3]&&M[3].slice(-1)=="%"&&(y/=100)),F[5]?(M=F[5][L](et),w=j(M[0]),M[0].slice(-1)=="%"&&(w*=2.55),C=j(M[1]),M[1].slice(-1)=="%"&&(C*=2.55),g=j(M[2]),M[2].slice(-1)=="%"&&(g*=2.55),(M[0].slice(-3)=="deg"||M[0].slice(-1)=="°")&&(w/=360),F[1].toLowerCase().slice(0,4)=="hsba"&&(y=j(M[3])),M[3]&&M[3].slice(-1)=="%"&&(y/=100),h.hsb2rgb(w,C,g,y)):F[6]?(M=F[6][L](et),w=j(M[0]),M[0].slice(-1)=="%"&&(w*=2.55),C=j(M[1]),M[1].slice(-1)=="%"&&(C*=2.55),g=j(M[2]),M[2].slice(-1)=="%"&&(g*=2.55),(M[0].slice(-3)=="deg"||M[0].slice(-1)=="°")&&(w/=360),F[1].toLowerCase().slice(0,4)=="hsla"&&(y=j(M[3])),M[3]&&M[3].slice(-1)=="%"&&(y/=100),h.hsl2rgb(w,C,g,y)):((F={r:w,g:C,b:g,toString:fi}).hex="#"+(16777216|g|C<<8|w<<16).toString(16).slice(1),h.is(y,"finite")&&(F.opacity=y),F)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:fi}},h),h.hsb=ve(function(p,w,C){return h.hsb2rgb(p,w,C).hex}),h.hsl=ve(function(p,w,C){return h.hsl2rgb(p,w,C).hex}),h.rgb=ve(function(p,w,C){function g(y){return y+.5|0}return"#"+(16777216|g(C)|g(w)<<8|g(p)<<16).toString(16).slice(1)}),h.getColor=function(p){var w=this.getColor.start=this.getColor.start||{h:0,s:1,b:p||.75},C=this.hsb2rgb(w.h,w.s,w.b);return w.h+=.075,w.h>1&&(w.h=0,w.s-=.2,w.s<=0&&(this.getColor.start={h:0,s:1,b:w.b})),C.hex},h.getColor.reset=function(){delete this.start},h.parsePathString=function(p){if(!p)return null;var w=Re(p);if(w.arr)return Se(w.arr);var C={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},g=[];return h.is(p,nt)&&h.is(p[0],nt)&&(g=Se(p)),g.length||O(p).replace(bt,function(y,k,M){var F=[],G=k.toLowerCase();if(M.replace(yt,function(H,Q){Q&&F.push(+Q)}),G=="m"&&F.length>2&&(g.push([k][_](F.splice(0,2))),G="l",k=k=="m"?"l":"L"),G=="r")g.push([k][_](F));else for(;F.length>=C[G]&&(g.push([k][_](F.splice(0,C[G]))),C[G]););}),g.toString=h._path2string,w.arr=Se(g),g},h.parseTransformString=ve(function(p){if(!p)return null;var w=[];return h.is(p,nt)&&h.is(p[0],nt)&&(w=Se(p)),w.length||O(p).replace(Tt,function(C,g,y){var k=[];z.call(g),y.replace(yt,function(M,F){F&&k.push(+F)}),w.push([g][_](k))}),w.toString=h._path2string,w},this,function(p){if(!p)return p;for(var w=[],C=0;C<p.length;C++){for(var g=[],y=0;y<p[C].length;y++)g.push(p[C][y]);w.push(g)}return w});var Re=function(p){var w=Re.ps=Re.ps||{};return w[p]?w[p].sleep=100:w[p]={sleep:100},setTimeout(function(){for(var C in w)w[m](C)&&C!=p&&(w[C].sleep--,!w[C].sleep&&delete w[C])}),w[p]};function ti(p,w,C,g,y){return p*(p*(-3*w+9*C-9*g+3*y)+6*w-12*C+6*g)-3*w+3*C}function Ue(p,w,C,g,y,k,M,F,G){G==null&&(G=1);for(var H=(G=G>1?1:G<0?0:G)/2,Q=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],st=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],it=0,tt=0;tt<12;tt++){var ot=H*Q[tt]+H,ct=ti(ot,p,C,y,M),lt=ti(ot,w,g,k,F),rt=ct*ct+lt*lt;it+=st[tt]*q.sqrt(rt)}return H*it}function On(p,w,C,g,y,k,M,F){if(!(K(p,C)<Z(y,M)||Z(p,C)>K(y,M)||K(w,g)<Z(k,F)||Z(w,g)>K(k,F))){var G=(p-C)*(k-F)-(w-g)*(y-M);if(G){var H=((p*g-w*C)*(y-M)-(p-C)*(y*F-k*M))/G,Q=((p*g-w*C)*(k-F)-(w-g)*(y*F-k*M))/G,st=+H.toFixed(2),it=+Q.toFixed(2);if(!(st<+Z(p,C).toFixed(2)||st>+K(p,C).toFixed(2)||st<+Z(y,M).toFixed(2)||st>+K(y,M).toFixed(2)||it<+Z(w,g).toFixed(2)||it>+K(w,g).toFixed(2)||it<+Z(k,F).toFixed(2)||it>+K(k,F).toFixed(2)))return{x:H,y:Q}}}}function Li(p,w,C){var g=h.bezierBBox(p),y=h.bezierBBox(w);if(!h.isBBoxIntersect(g,y))return C?0:[];for(var k=Ue.apply(0,p),M=Ue.apply(0,w),F=K(~~(k/5),1),G=K(~~(M/5),1),H=[],Q=[],st={},it=C?0:[],tt=0;tt<F+1;tt++){var ot=h.findDotsAtSegment.apply(h,p.concat(tt/F));H.push({x:ot.x,y:ot.y,t:tt/F})}for(tt=0;tt<G+1;tt++)ot=h.findDotsAtSegment.apply(h,w.concat(tt/G)),Q.push({x:ot.x,y:ot.y,t:tt/G});for(tt=0;tt<F;tt++)for(var ct=0;ct<G;ct++){var lt=H[tt],rt=H[tt+1],wt=Q[ct],ut=Q[ct+1],gt=at(rt.x-lt.x)<.001?"y":"x",ft=at(ut.x-wt.x)<.001?"y":"x",Mt=On(lt.x,lt.y,rt.x,rt.y,wt.x,wt.y,ut.x,ut.y);if(Mt){if(st[Mt.x.toFixed(4)]==Mt.y.toFixed(4))continue;st[Mt.x.toFixed(4)]=Mt.y.toFixed(4);var kt=lt.t+at((Mt[gt]-lt[gt])/(rt[gt]-lt[gt]))*(rt.t-lt.t),Rt=wt.t+at((Mt[ft]-wt[ft])/(ut[ft]-wt[ft]))*(ut.t-wt.t);kt>=0&&kt<=1.001&&Rt>=0&&Rt<=1.001&&(C?it++:it.push({x:Mt.x,y:Mt.y,t1:Z(kt,1),t2:Z(Rt,1)}))}}return it}function ln(p,w,C){p=h._path2curve(p),w=h._path2curve(w);for(var g,y,k,M,F,G,H,Q,st,it,tt=C?0:[],ot=0,ct=p.length;ot<ct;ot++){var lt=p[ot];if(lt[0]=="M")g=F=lt[1],y=G=lt[2];else{lt[0]=="C"?(st=[g,y].concat(lt.slice(1)),g=st[6],y=st[7]):(st=[g,y,g,y,F,G,F,G],g=F,y=G);for(var rt=0,wt=w.length;rt<wt;rt++){var ut=w[rt];if(ut[0]=="M")k=H=ut[1],M=Q=ut[2];else{ut[0]=="C"?(it=[k,M].concat(ut.slice(1)),k=it[6],M=it[7]):(it=[k,M,k,M,H,Q,H,Q],k=H,M=Q);var gt=Li(st,it,C);if(C)tt+=gt;else{for(var ft=0,Mt=gt.length;ft<Mt;ft++)gt[ft].segment1=ot,gt[ft].segment2=rt,gt[ft].bez1=st,gt[ft].bez2=it;tt=tt.concat(gt)}}}}}return tt}h.findDotsAtSegment=function(p,w,C,g,y,k,M,F,G){var H=1-G,Q=vt(H,3),st=vt(H,2),it=G*G,tt=it*G,ot=Q*p+3*st*G*C+3*H*G*G*y+tt*M,ct=Q*w+3*st*G*g+3*H*G*G*k+tt*F,lt=p+2*G*(C-p)+it*(y-2*C+p),rt=w+2*G*(g-w)+it*(k-2*g+w),wt=C+2*G*(y-C)+it*(M-2*y+C),ut=g+2*G*(k-g)+it*(F-2*k+g),gt=H*p+G*C,ft=H*w+G*g,Mt=H*y+G*M,kt=H*k+G*F,Rt=90-180*q.atan2(lt-wt,rt-ut)/_t;return(lt>wt||rt<ut)&&(Rt+=180),{x:ot,y:ct,m:{x:lt,y:rt},n:{x:wt,y:ut},start:{x:gt,y:ft},end:{x:Mt,y:kt},alpha:Rt}},h.bezierBBox=function(p,w,C,g,y,k,M,F){h.is(p,"array")||(p=[p,w,C,g,y,k,M,F]);var G=Oi.apply(null,p);return{x:G.min.x,y:G.min.y,x2:G.max.x,y2:G.max.y,width:G.max.x-G.min.x,height:G.max.y-G.min.y}},h.isPointInsideBBox=function(p,w,C){return w>=p.x&&w<=p.x2&&C>=p.y&&C<=p.y2},h.isBBoxIntersect=function(p,w){var C=h.isPointInsideBBox;return C(w,p.x,p.y)||C(w,p.x2,p.y)||C(w,p.x,p.y2)||C(w,p.x2,p.y2)||C(p,w.x,w.y)||C(p,w.x2,w.y)||C(p,w.x,w.y2)||C(p,w.x2,w.y2)||(p.x<w.x2&&p.x>w.x||w.x<p.x2&&w.x>p.x)&&(p.y<w.y2&&p.y>w.y||w.y<p.y2&&w.y>p.y)},h.pathIntersection=function(p,w){return ln(p,w)},h.pathIntersectionNumber=function(p,w){return ln(p,w,1)},h.isPointInsidePath=function(p,w,C){var g=h.pathBBox(p);return h.isPointInsideBBox(g,w,C)&&ln(p,[["M",w,C],["H",g.x2+10]],1)%2==1},h._removedFactory=function(p){return function(){o("raphael.log",null,"Raphaël: you are calling to method “"+p+"” of removed object",p)}};var Ye=h.pathBBox=function(p){var w=Re(p);if(w.bbox)return ye(w.bbox);if(!p)return{x:0,y:0,width:0,height:0,x2:0,y2:0};for(var C,g=0,y=0,k=[],M=[],F=0,G=(p=Nn(p)).length;F<G;F++)if((C=p[F])[0]=="M")g=C[1],y=C[2],k.push(g),M.push(y);else{var H=Oi(g,y,C[1],C[2],C[3],C[4],C[5],C[6]);k=k[_](H.min.x,H.max.x),M=M[_](H.min.y,H.max.y),g=C[5],y=C[6]}var Q=Z[E](0,k),st=Z[E](0,M),it=K[E](0,k),tt=K[E](0,M),ot=it-Q,ct=tt-st,lt={x:Q,y:st,x2:it,y2:tt,width:ot,height:ct,cx:Q+ot/2,cy:st+ct/2};return w.bbox=ye(lt),lt},Se=function(p){var w=ye(p);return w.toString=h._path2string,w},lo=h._pathToRelative=function(p){var w=Re(p);if(w.rel)return Se(w.rel);h.is(p,nt)&&h.is(p&&p[0],nt)||(p=h.parsePathString(p));var C=[],g=0,y=0,k=0,M=0,F=0;p[0][0]=="M"&&(k=g=p[0][1],M=y=p[0][2],F++,C.push(["M",g,y]));for(var G=F,H=p.length;G<H;G++){var Q=C[G]=[],st=p[G];if(st[0]!=z.call(st[0]))switch(Q[0]=z.call(st[0]),Q[0]){case"a":Q[1]=st[1],Q[2]=st[2],Q[3]=st[3],Q[4]=st[4],Q[5]=st[5],Q[6]=+(st[6]-g).toFixed(3),Q[7]=+(st[7]-y).toFixed(3);break;case"v":Q[1]=+(st[1]-y).toFixed(3);break;case"m":k=st[1],M=st[2];default:for(var it=1,tt=st.length;it<tt;it++)Q[it]=+(st[it]-(it%2?g:y)).toFixed(3)}else{Q=C[G]=[],st[0]=="m"&&(k=st[1]+g,M=st[2]+y);for(var ot=0,ct=st.length;ot<ct;ot++)C[G][ot]=st[ot]}var lt=C[G].length;switch(C[G][0]){case"z":g=k,y=M;break;case"h":g+=+C[G][lt-1];break;case"v":y+=+C[G][lt-1];break;default:g+=+C[G][lt-2],y+=+C[G][lt-1]}}return C.toString=h._path2string,w.rel=Se(C),C},cn=h._pathToAbsolute=function(p){var w=Re(p);if(w.abs)return Se(w.abs);if(h.is(p,nt)&&h.is(p&&p[0],nt)||(p=h.parsePathString(p)),!p||!p.length)return[["M",0,0]];var C=[],g=0,y=0,k=0,M=0,F=0;p[0][0]=="M"&&(k=g=+p[0][1],M=y=+p[0][2],F++,C[0]=["M",g,y]);for(var G,H,Q=p.length==3&&p[0][0]=="M"&&p[1][0].toUpperCase()=="R"&&p[2][0].toUpperCase()=="Z",st=F,it=p.length;st<it;st++){if(C.push(G=[]),(H=p[st])[0]!=N.call(H[0]))switch(G[0]=N.call(H[0]),G[0]){case"A":G[1]=H[1],G[2]=H[2],G[3]=H[3],G[4]=H[4],G[5]=H[5],G[6]=+(H[6]+g),G[7]=+(H[7]+y);break;case"V":G[1]=+H[1]+y;break;case"H":G[1]=+H[1]+g;break;case"R":for(var tt=[g,y][_](H.slice(1)),ot=2,ct=tt.length;ot<ct;ot++)tt[ot]=+tt[ot]+g,tt[++ot]=+tt[ot]+y;C.pop(),C=C[_](hn(tt,Q));break;case"M":k=+H[1]+g,M=+H[2]+y;default:for(ot=1,ct=H.length;ot<ct;ot++)G[ot]=+H[ot]+(ot%2?g:y)}else if(H[0]=="R")tt=[g,y][_](H.slice(1)),C.pop(),C=C[_](hn(tt,Q)),G=["R"][_](H.slice(-2));else for(var lt=0,rt=H.length;lt<rt;lt++)G[lt]=H[lt];switch(G[0]){case"Z":g=k,y=M;break;case"H":g=G[1];break;case"V":y=G[1];break;case"M":k=G[G.length-2],M=G[G.length-1];default:g=G[G.length-2],y=G[G.length-1]}}return C.toString=h._path2string,w.abs=Se(C),C},Ii=function(p,w,C,g){return[p,w,C,g,C,g]},di=function(p,w,C,g,y,k){return[1/3*p+2/3*C,1/3*w+2/3*g,1/3*y+2/3*C,1/3*k+2/3*g,y,k]},gr=function(p,w,C,g,y,k,M,F,G,H){var Q,st=120*_t/180,it=_t/180*(+y||0),tt=[],ot=ve(function(C1,T1,bo){return{x:C1*q.cos(bo)-T1*q.sin(bo),y:C1*q.sin(bo)+T1*q.cos(bo)}});if(H)kt=H[0],Rt=H[1],ft=H[2],Mt=H[3];else{p=(Q=ot(p,w,-it)).x,w=Q.y,F=(Q=ot(F,G,-it)).x,G=Q.y;var ct=(p-F)/2,lt=(w-G)/2,rt=ct*ct/(C*C)+lt*lt/(g*g);rt>1&&(C*=rt=q.sqrt(rt),g*=rt);var wt=C*C,ut=g*g,gt=(k==M?-1:1)*q.sqrt(at((wt*ut-wt*lt*lt-ut*ct*ct)/(wt*lt*lt+ut*ct*ct))),ft=gt*C*lt/g+(p+F)/2,Mt=gt*-g*ct/C+(w+G)/2,kt=q.asin(((w-Mt)/g).toFixed(9)),Rt=q.asin(((G-Mt)/g).toFixed(9));(kt=p<ft?_t-kt:kt)<0&&(kt=2*_t+kt),(Rt=F<ft?_t-Rt:Rt)<0&&(Rt=2*_t+Rt),M&&kt>Rt&&(kt-=2*_t),!M&&Rt>kt&&(Rt-=2*_t)}var xr=Rt-kt;if(at(xr)>st){var ea=Rt,Ie=F,pi=G;Rt=kt+st*(M&&Rt>kt?1:-1),F=ft+C*q.cos(Rt),G=Mt+g*q.sin(Rt),tt=gr(F,G,C,g,y,0,M,Ie,pi,[Rt,ea,ft,Mt])}xr=Rt-kt;var Sr=q.cos(kt),Cr=q.sin(kt),yo=q.cos(Rt),$i=q.sin(Rt),zn=q.tan(xr/4),wo=4/3*C*zn,y1=4/3*g*zn,w1=[p,w],Tr=[p+wo*Cr,w-y1*Sr],b1=[F+wo*$i,G-y1*yo],x1=[F,G];if(Tr[0]=2*w1[0]-Tr[0],Tr[1]=2*w1[1]-Tr[1],H)return[Tr,b1,x1][_](tt);for(var S1=[],gn=0,D8=(tt=[Tr,b1,x1][_](tt).join()[L](",")).length;gn<D8;gn++)S1[gn]=gn%2?ot(tt[gn-1],tt[gn],it).y:ot(tt[gn],tt[gn+1],it).x;return S1},Fi=function(p,w,C,g,y,k,M,F,G){var H=1-G;return{x:vt(H,3)*p+3*vt(H,2)*G*C+3*H*G*G*y+vt(G,3)*M,y:vt(H,3)*w+3*vt(H,2)*G*g+3*H*G*G*k+vt(G,3)*F}},Oi=ve(function(p,w,C,g,y,k,M,F){var G,H=y-2*C+p-(M-2*y+C),Q=2*(C-p)-2*(y-C),st=p-C,it=(-Q+q.sqrt(Q*Q-4*H*st))/2/H,tt=(-Q-q.sqrt(Q*Q-4*H*st))/2/H,ot=[w,F],ct=[p,M];return at(it)>"1e12"&&(it=.5),at(tt)>"1e12"&&(tt=.5),it>0&&it<1&&(G=Fi(p,w,C,g,y,k,M,F,it),ct.push(G.x),ot.push(G.y)),tt>0&&tt<1&&(G=Fi(p,w,C,g,y,k,M,F,tt),ct.push(G.x),ot.push(G.y)),H=k-2*g+w-(F-2*k+g),st=w-g,it=(-(Q=2*(g-w)-2*(k-g))+q.sqrt(Q*Q-4*H*st))/2/H,tt=(-Q-q.sqrt(Q*Q-4*H*st))/2/H,at(it)>"1e12"&&(it=.5),at(tt)>"1e12"&&(tt=.5),it>0&&it<1&&(G=Fi(p,w,C,g,y,k,M,F,it),ct.push(G.x),ot.push(G.y)),tt>0&&tt<1&&(G=Fi(p,w,C,g,y,k,M,F,tt),ct.push(G.x),ot.push(G.y)),{min:{x:Z[E](0,ct),y:Z[E](0,ot)},max:{x:K[E](0,ct),y:K[E](0,ot)}}}),Nn=h._path2curve=ve(function(p,w){var C=!w&&Re(p);if(!w&&C.curve)return Se(C.curve);for(var g=cn(p),y=w&&cn(w),k={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},M={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},F=function(gt,ft,Mt){var kt,Rt;if(!gt)return["C",ft.x,ft.y,ft.x,ft.y,ft.x,ft.y];switch(!(gt[0]in{T:1,Q:1})&&(ft.qx=ft.qy=null),gt[0]){case"M":ft.X=gt[1],ft.Y=gt[2];break;case"A":gt=["C"][_](gr[E](0,[ft.x,ft.y][_](gt.slice(1))));break;case"S":Mt=="C"||Mt=="S"?(kt=2*ft.x-ft.bx,Rt=2*ft.y-ft.by):(kt=ft.x,Rt=ft.y),gt=["C",kt,Rt][_](gt.slice(1));break;case"T":Mt=="Q"||Mt=="T"?(ft.qx=2*ft.x-ft.qx,ft.qy=2*ft.y-ft.qy):(ft.qx=ft.x,ft.qy=ft.y),gt=["C"][_](di(ft.x,ft.y,ft.qx,ft.qy,gt[1],gt[2]));break;case"Q":ft.qx=gt[1],ft.qy=gt[2],gt=["C"][_](di(ft.x,ft.y,gt[1],gt[2],gt[3],gt[4]));break;case"L":gt=["C"][_](Ii(ft.x,ft.y,gt[1],gt[2]));break;case"H":gt=["C"][_](Ii(ft.x,ft.y,gt[1],ft.y));break;case"V":gt=["C"][_](Ii(ft.x,ft.y,ft.x,gt[1]));break;case"Z":gt=["C"][_](Ii(ft.x,ft.y,ft.X,ft.Y))}return gt},G=function(gt,ft){if(gt[ft].length>7){gt[ft].shift();for(var Mt=gt[ft];Mt.length;)Q[ft]="A",y&&(st[ft]="A"),gt.splice(ft++,0,["C"][_](Mt.splice(0,6)));gt.splice(ft,1),ct=K(g.length,y&&y.length||0)}},H=function(gt,ft,Mt,kt,Rt){gt&&ft&>[Rt][0]=="M"&&ft[Rt][0]!="M"&&(ft.splice(Rt,0,["M",kt.x,kt.y]),Mt.bx=0,Mt.by=0,Mt.x=gt[Rt][1],Mt.y=gt[Rt][2],ct=K(g.length,y&&y.length||0))},Q=[],st=[],it="",tt="",ot=0,ct=K(g.length,y&&y.length||0);ot<ct;ot++){g[ot]&&(it=g[ot][0]),it!="C"&&(Q[ot]=it,ot&&(tt=Q[ot-1])),g[ot]=F(g[ot],k,tt),Q[ot]!="A"&&it=="C"&&(Q[ot]="C"),G(g,ot),y&&(y[ot]&&(it=y[ot][0]),it!="C"&&(st[ot]=it,ot&&(tt=st[ot-1])),y[ot]=F(y[ot],M,tt),st[ot]!="A"&&it=="C"&&(st[ot]="C"),G(y,ot)),H(g,y,k,M,ot),H(y,g,M,k,ot);var lt=g[ot],rt=y&&y[ot],wt=lt.length,ut=y&&rt.length;k.x=lt[wt-2],k.y=lt[wt-1],k.bx=j(lt[wt-4])||k.x,k.by=j(lt[wt-3])||k.y,M.bx=y&&(j(rt[ut-4])||M.x),M.by=y&&(j(rt[ut-3])||M.y),M.x=y&&rt[ut-2],M.y=y&&rt[ut-1]}return y||(C.curve=Se(g)),y?[g,y]:g},null,Se),pr=(h._parseDots=ve(function(p){for(var w=[],C=0,g=p.length;C<g;C++){var y={},k=p[C].match(/^([^:]*):?([\d\.]*)/);if(y.color=h.getRGB(k[1]),y.color.error)return null;y.opacity=y.color.opacity,y.color=y.color.hex,k[2]&&(y.offset=k[2]+"%"),w.push(y)}for(C=1,g=w.length-1;C<g;C++)if(!w[C].offset){for(var M=j(w[C-1].offset||0),F=0,G=C+1;G<g;G++)if(w[G].offset){F=w[G].offset;break}F||(F=100,G=g);for(var H=((F=j(F))-M)/(G-C+1);C<G;C++)M+=H,w[C].offset=M+"%"}return w}),h._tear=function(p,w){p==w.top&&(w.top=p.prev),p==w.bottom&&(w.bottom=p.next),p.next&&(p.next.prev=p.prev),p.prev&&(p.prev.next=p.next)}),co=(h._tofront=function(p,w){w.top!==p&&(pr(p,w),p.next=null,p.prev=w.top,w.top.next=p,w.top=p)},h._toback=function(p,w){w.bottom!==p&&(pr(p,w),p.next=w.bottom,p.prev=null,w.bottom.prev=p,w.bottom=p)},h._insertafter=function(p,w,C){pr(p,C),w==C.top&&(C.top=p),w.next&&(w.next.prev=p),p.next=w.next,p.prev=w,w.next=p},h._insertbefore=function(p,w,C){pr(p,C),w==C.bottom&&(C.bottom=p),w.prev&&(w.prev.next=p),p.prev=w.prev,w.prev=p,p.next=w},h.toMatrix=function(p,w){var C=Ye(p),g={_:{transform:P},getBBox:function(){return C}};return mr(g,w),g.matrix}),mr=(h.transformPath=function(p,w){return ce(p,co(p,w))},h._extractTransform=function(p,w){if(w==null)return p._.transform;w=O(w).replace(/\.{3}|\u2026/g,p._.transform||P);var C,g,y=h.parseTransformString(w),k=0,M=1,F=1,G=p._,H=new Ni;if(G.transform=y||[],y)for(var Q=0,st=y.length;Q<st;Q++){var it,tt,ot,ct,lt,rt=y[Q],wt=rt.length,ut=O(rt[0]).toLowerCase(),gt=rt[0]!=ut,ft=gt?H.invert():0;ut=="t"&&wt==3?gt?(it=ft.x(0,0),tt=ft.y(0,0),ot=ft.x(rt[1],rt[2]),ct=ft.y(rt[1],rt[2]),H.translate(ot-it,ct-tt)):H.translate(rt[1],rt[2]):ut=="r"?wt==2?(lt=lt||p.getBBox(1),H.rotate(rt[1],lt.x+lt.width/2,lt.y+lt.height/2),k+=rt[1]):wt==4&&(gt?(ot=ft.x(rt[2],rt[3]),ct=ft.y(rt[2],rt[3]),H.rotate(rt[1],ot,ct)):H.rotate(rt[1],rt[2],rt[3]),k+=rt[1]):ut=="s"?wt==2||wt==3?(lt=lt||p.getBBox(1),H.scale(rt[1],rt[wt-1],lt.x+lt.width/2,lt.y+lt.height/2),M*=rt[1],F*=rt[wt-1]):wt==5&&(gt?(ot=ft.x(rt[3],rt[4]),ct=ft.y(rt[3],rt[4]),H.scale(rt[1],rt[2],ot,ct)):H.scale(rt[1],rt[2],rt[3],rt[4]),M*=rt[1],F*=rt[2]):ut=="m"&&wt==7&&H.add(rt[1],rt[2],rt[3],rt[4],rt[5],rt[6]),G.dirtyT=1,p.matrix=H}p.matrix=H,G.sx=M,G.sy=F,G.deg=k,G.dx=C=H.e,G.dy=g=H.f,M==1&&F==1&&!k&&G.bbox?(G.bbox.x+=+C,G.bbox.y+=+g):G.dirtyT=1}),uo=function(p){var w=p[0];switch(w.toLowerCase()){case"t":return[w,0,0];case"m":return[w,1,0,0,1,0,0];case"r":return p.length==4?[w,0,p[2],p[3]]:[w,0];case"s":return p.length==5?[w,1,1,p[3],p[4]]:p.length==3?[w,1,1]:[w,1]}},fo=h._equaliseTransform=function(p,w){w=O(w).replace(/\.{3}|\u2026/g,p),p=h.parseTransformString(p)||[],w=h.parseTransformString(w)||[];for(var C,g,y,k,M=K(p.length,w.length),F=[],G=[],H=0;H<M;H++){if(y=p[H]||uo(w[H]),k=w[H]||uo(y),y[0]!=k[0]||y[0].toLowerCase()=="r"&&(y[2]!=k[2]||y[3]!=k[3])||y[0].toLowerCase()=="s"&&(y[3]!=k[3]||y[4]!=k[4]))return;for(F[H]=[],G[H]=[],C=0,g=K(y.length,k.length);C<g;C++)C in y&&(F[H][C]=y[C]),C in k&&(G[H][C]=k[C])}return{from:F,to:G}};function Ni(p,w,C,g,y,k){p!=null?(this.a=+p,this.b=+w,this.c=+C,this.d=+g,this.e=+y,this.f=+k):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}h._getContainer=function(p,w,C,g){var y;if((y=g!=null||h.is(p,"object")?p:v.doc.getElementById(p))!=null)return y.tagName?w==null?{container:y,width:y.style.pixelWidth||y.offsetWidth,height:y.style.pixelHeight||y.offsetHeight}:{container:y,width:w,height:C}:{container:1,x:p,y:w,width:C,height:g}},h.pathToRelative=lo,h._engine={},h.path2curve=Nn,h.matrix=function(p,w,C,g,y,k){return new Ni(p,w,C,g,y,k)},function(p){function w(g){return g[0]*g[0]+g[1]*g[1]}function C(g){var y=q.sqrt(w(g));g[0]&&(g[0]/=y),g[1]&&(g[1]/=y)}p.add=function(g,y,k,M,F,G){var H,Q,st,it,tt=[[],[],[]],ot=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],ct=[[g,k,F],[y,M,G],[0,0,1]];for(g&&g instanceof Ni&&(ct=[[g.a,g.c,g.e],[g.b,g.d,g.f],[0,0,1]]),H=0;H<3;H++)for(Q=0;Q<3;Q++){for(it=0,st=0;st<3;st++)it+=ot[H][st]*ct[st][Q];tt[H][Q]=it}this.a=tt[0][0],this.b=tt[1][0],this.c=tt[0][1],this.d=tt[1][1],this.e=tt[0][2],this.f=tt[1][2]},p.invert=function(){var g=this,y=g.a*g.d-g.b*g.c;return new Ni(g.d/y,-g.b/y,-g.c/y,g.a/y,(g.c*g.f-g.d*g.e)/y,(g.b*g.e-g.a*g.f)/y)},p.clone=function(){return new Ni(this.a,this.b,this.c,this.d,this.e,this.f)},p.translate=function(g,y){this.add(1,0,0,1,g,y)},p.scale=function(g,y,k,M){y==null&&(y=g),(k||M)&&this.add(1,0,0,1,k,M),this.add(g,0,0,y,0,0),(k||M)&&this.add(1,0,0,1,-k,-M)},p.rotate=function(g,y,k){g=h.rad(g),y=y||0,k=k||0;var M=+q.cos(g).toFixed(9),F=+q.sin(g).toFixed(9);this.add(M,F,-F,M,y,k),this.add(1,0,0,1,-y,-k)},p.x=function(g,y){return g*this.a+y*this.c+this.e},p.y=function(g,y){return g*this.b+y*this.d+this.f},p.get=function(g){return+this[O.fromCharCode(97+g)].toFixed(4)},p.toString=function(){return h.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},p.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},p.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},p.split=function(){var g={};g.dx=this.e,g.dy=this.f;var y=[[this.a,this.c],[this.b,this.d]];g.scalex=q.sqrt(w(y[0])),C(y[0]),g.shear=y[0][0]*y[1][0]+y[0][1]*y[1][1],y[1]=[y[1][0]-y[0][0]*g.shear,y[1][1]-y[0][1]*g.shear],g.scaley=q.sqrt(w(y[1])),C(y[1]),g.shear/=g.scaley;var k=-y[0][1],M=y[1][1];return M<0?(g.rotate=h.deg(q.acos(M)),k<0&&(g.rotate=360-g.rotate)):g.rotate=h.deg(q.asin(k)),g.isSimple=!(+g.shear.toFixed(9)||g.scalex.toFixed(9)!=g.scaley.toFixed(9)&&g.rotate),g.isSuperSimple=!+g.shear.toFixed(9)&&g.scalex.toFixed(9)==g.scaley.toFixed(9)&&!g.rotate,g.noRotation=!+g.shear.toFixed(9)&&!g.rotate,g},p.toTransformString=function(g){var y=g||this[L]();return y.isSimple?(y.scalex=+y.scalex.toFixed(4),y.scaley=+y.scaley.toFixed(4),y.rotate=+y.rotate.toFixed(4),(y.dx||y.dy?"t"+[y.dx,y.dy]:P)+(y.scalex!=1||y.scaley!=1?"s"+[y.scalex,y.scaley,0,0]:P)+(y.rotate?"r"+[y.rotate,0,0]:P)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(Ni.prototype);for(var go=function(){this.returnValue=!1},po=function(){return this.originalEvent.preventDefault()},mo=function(){this.cancelBubble=!0},vo=function(){return this.originalEvent.stopPropagation()},vr=function(p){var w=v.doc.documentElement.scrollTop||v.doc.body.scrollTop,C=v.doc.documentElement.scrollLeft||v.doc.body.scrollLeft;return{x:p.clientX+C,y:p.clientY+w}},Gi=v.doc.addEventListener?function(p,w,C,g){var y=function(M){var F=vr(M);return C.call(g,M,F.x,F.y)};if(p.addEventListener(w,y,!1),x&&U[w]){var k=function(M){for(var F=vr(M),G=M,H=0,Q=M.targetTouches&&M.targetTouches.length;H<Q;H++)if(M.targetTouches[H].target==p){(M=M.targetTouches[H]).originalEvent=G,M.preventDefault=po,M.stopPropagation=vo;break}return C.call(g,M,F.x,F.y)};p.addEventListener(U[w],k,!1)}return function(){return p.removeEventListener(w,y,!1),x&&U[w]&&p.removeEventListener(U[w],k,!1),!0}}:v.doc.attachEvent?function(p,w,C,g){var y=function(k){k=k||v.win.event;var M=v.doc.documentElement.scrollTop||v.doc.body.scrollTop,F=v.doc.documentElement.scrollLeft||v.doc.body.scrollLeft,G=k.clientX+F,H=k.clientY+M;return k.preventDefault=k.preventDefault||go,k.stopPropagation=k.stopPropagation||mo,C.call(g,k,G,H)};return p.attachEvent("on"+w,y),function(){return p.detachEvent("on"+w,y),!0}}:void 0,De=[],Ui=function(p){for(var w,C=p.clientX,g=p.clientY,y=v.doc.documentElement.scrollTop||v.doc.body.scrollTop,k=v.doc.documentElement.scrollLeft||v.doc.body.scrollLeft,M=De.length;M--;){if(w=De[M],x&&p.touches){for(var F,G=p.touches.length;G--;)if((F=p.touches[G]).identifier==w.el._drag.id){C=F.clientX,g=F.clientY,(p.originalEvent?p.originalEvent:p).preventDefault();break}}else p.preventDefault();var H,Q=w.el.node,st=Q.nextSibling,it=Q.parentNode,tt=Q.style.display;v.win.opera&&it.removeChild(Q),Q.style.display="none",H=w.el.paper.getElementByPoint(C,g),Q.style.display=tt,v.win.opera&&(st?it.insertBefore(Q,st):it.appendChild(Q)),H&&o("raphael.drag.over."+w.el.id,w.el,H),C+=k,g+=y,o("raphael.drag.move."+w.el.id,w.move_scope||w.el,C-w.el._drag.x,g-w.el._drag.y,C,g,p)}},un=function(p){h.unmousemove(Ui).unmouseup(un);for(var w,C=De.length;C--;)(w=De[C]).el._drag={},o("raphael.drag.end."+w.el.id,w.end_scope||w.start_scope||w.move_scope||w.el,p);De=[]},$t=h.el={},_o=$.length;_o--;)(function(p){h[p]=$t[p]=function(w,C){return h.is(w,"function")&&(this.events=this.events||[],this.events.push({name:p,f:w,unbind:Gi(this.shape||this.node||v.doc,p,w,C||this)})),this},h["un"+p]=$t["un"+p]=function(w){for(var C=this.events||[],g=C.length;g--;)C[g].name!=p||!h.is(w,"undefined")&&C[g].f!=w||(C[g].unbind(),C.splice(g,1),!C.length&&delete this.events);return this}})($[_o]);$t.data=function(p,w){var C=Et[this.id]=Et[this.id]||{};if(arguments.length==0)return C;if(arguments.length==1){if(h.is(p,"object")){for(var g in p)p[m](g)&&this.data(g,p[g]);return this}return o("raphael.data.get."+this.id,this,C[p],p),C[p]}return C[p]=w,o("raphael.data.set."+this.id,this,w,p),this},$t.removeData=function(p){return p==null?delete Et[this.id]:Et[this.id]&&delete Et[this.id][p],this},$t.getData=function(){return ye(Et[this.id]||{})},$t.hover=function(p,w,C,g){return this.mouseover(p,C).mouseout(w,g||C)},$t.unhover=function(p,w){return this.unmouseover(p).unmouseout(w)};var fn=[];$t.drag=function(p,w,C,g,y,k){function M(F){(F.originalEvent||F).preventDefault();var G=F.clientX,H=F.clientY,Q=v.doc.documentElement.scrollTop||v.doc.body.scrollTop,st=v.doc.documentElement.scrollLeft||v.doc.body.scrollLeft;if(this._drag.id=F.identifier,x&&F.touches){for(var it,tt=F.touches.length;tt--;)if(it=F.touches[tt],this._drag.id=it.identifier,it.identifier==this._drag.id){G=it.clientX,H=it.clientY;break}}this._drag.x=G+st,this._drag.y=H+Q,!De.length&&h.mousemove(Ui).mouseup(un),De.push({el:this,move_scope:g,start_scope:y,end_scope:k}),w&&o.on("raphael.drag.start."+this.id,w),p&&o.on("raphael.drag.move."+this.id,p),C&&o.on("raphael.drag.end."+this.id,C),o("raphael.drag.start."+this.id,y||g||this,this._drag.x,this._drag.y,F)}return this._drag={},fn.push({el:this,start:M}),this.mousedown(M),this},$t.onDragOver=function(p){p?o.on("raphael.drag.over."+this.id,p):o.unbind("raphael.drag.over."+this.id)},$t.undrag=function(){for(var p=fn.length;p--;)fn[p].el==this&&(this.unmousedown(fn[p].start),fn.splice(p,1),o.unbind("raphael.drag.*."+this.id));!fn.length&&h.unmousemove(Ui).unmouseup(un),De=[]},c.circle=function(p,w,C){var g=h._engine.circle(this,p||0,w||0,C||0);return this.__set__&&this.__set__.push(g),g},c.rect=function(p,w,C,g,y){var k=h._engine.rect(this,p||0,w||0,C||0,g||0,y||0);return this.__set__&&this.__set__.push(k),k},c.ellipse=function(p,w,C,g){var y=h._engine.ellipse(this,p||0,w||0,C||0,g||0);return this.__set__&&this.__set__.push(y),y},c.path=function(p){p&&!h.is(p,"string")&&!h.is(p[0],nt)&&(p+=P);var w=h._engine.path(h.format[E](h,arguments),this);return this.__set__&&this.__set__.push(w),w},c.image=function(p,w,C,g,y){var k=h._engine.image(this,p||"about:blank",w||0,C||0,g||0,y||0);return this.__set__&&this.__set__.push(k),k},c.text=function(p,w,C){var g=h._engine.text(this,p||0,w||0,O(C));return this.__set__&&this.__set__.push(g),g},c.set=function(p){!h.is(p,"array")&&(p=Array.prototype.splice.call(arguments,0,arguments.length));var w=new Un(p);return this.__set__&&this.__set__.push(w),w.paper=this,w.type="set",w},c.setStart=function(p){this.__set__=p||this.set()},c.setFinish=function(p){var w=this.__set__;return delete this.__set__,w},c.getSize=function(){var p=this.canvas.parentNode;return{width:p.offsetWidth,height:p.offsetHeight}},c.setSize=function(p,w){return h._engine.setSize.call(this,p,w)},c.setViewBox=function(p,w,C,g,y){return h._engine.setViewBox.call(this,p,w,C,g,y)},c.top=c.bottom=null,c.raphael=h;function Gn(){return this.x+R+this.y+R+this.width+" × "+this.height}c.getElementByPoint=function(p,w){var C,g,y,k,M,F,G,H=this.canvas,Q=v.doc.elementFromPoint(p,w);if(v.win.opera&&Q.tagName=="svg"){var st=(g=(C=H).getBoundingClientRect(),y=C.ownerDocument,k=y.body,M=y.documentElement,F=M.clientTop||k.clientTop||0,G=M.clientLeft||k.clientLeft||0,{y:g.top+(v.win.pageYOffset||M.scrollTop||k.scrollTop)-F,x:g.left+(v.win.pageXOffset||M.scrollLeft||k.scrollLeft)-G}),it=H.createSVGRect();it.x=p-st.x,it.y=w-st.y,it.width=it.height=1;var tt=H.getIntersectionList(it,null);tt.length&&(Q=tt[tt.length-1])}if(!Q)return null;for(;Q.parentNode&&Q!=H.parentNode&&!Q.raphael;)Q=Q.parentNode;return Q==this.canvas.parentNode&&(Q=H),Q=Q&&Q.raphael?this.getById(Q.raphaelid):null},c.getElementsByBBox=function(p){var w=this.set();return this.forEach(function(C){h.isBBoxIntersect(C.getBBox(),p)&&w.push(C)}),w},c.getById=function(p){for(var w=this.bottom;w;){if(w.id==p)return w;w=w.next}return null},c.forEach=function(p,w){for(var C=this.bottom;C;){if(p.call(w,C)===!1)return this;C=C.next}return this},c.getElementsByPoint=function(p,w){var C=this.set();return this.forEach(function(g){g.isPointInside(p,w)&&C.push(g)}),C},$t.isPointInside=function(p,w){var C=this.realPath=zt[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(C=h.transformPath(C,this.attr("transform"))),h.isPointInsidePath(C,p,w)},$t.getBBox=function(p){if(this.removed)return{};var w=this._;return p?(!w.dirty&&w.bboxwt||(this.realPath=zt[this.type](this),w.bboxwt=Ye(this.realPath),w.bboxwt.toString=Gn,w.dirty=0),w.bboxwt):((w.dirty||w.dirtyT||!w.bbox)&&(!w.dirty&&this.realPath||(w.bboxwt=0,this.realPath=zt[this.type](this)),w.bbox=Ye(ce(this.realPath,this.matrix)),w.bbox.toString=Gn,w.dirty=w.dirtyT=0),w.bbox)},$t.clone=function(){if(this.removed)return null;var p=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(p),p},$t.glow=function(p){if(this.type=="text")return null;var w={width:((p=p||{}).width||10)+(+this.attr("stroke-width")||1),fill:p.fill||!1,opacity:p.opacity==null?.5:p.opacity,offsetx:p.offsetx||0,offsety:p.offsety||0,color:p.color||"#000"},C=w.width/2,g=this.paper,y=g.set(),k=this.realPath||zt[this.type](this);k=this.matrix?ce(k,this.matrix):k;for(var M=1;M<C+1;M++)y.push(g.path(k).attr({stroke:w.color,fill:w.fill?w.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(w.width/C*M).toFixed(3),opacity:+(w.opacity/C).toFixed(3)}));return y.insertBefore(this).translate(w.offsetx,w.offsety)};var Ce=function(p,w,C,g,y,k,M,F,G){return G==null?Ue(p,w,C,g,y,k,M,F):h.findDotsAtSegment(p,w,C,g,y,k,M,F,function(H,Q,st,it,tt,ot,ct,lt,rt){if(!(rt<0||Ue(H,Q,st,it,tt,ot,ct,lt)<rt)){var wt,ut=.5,gt=1-ut;for(wt=Ue(H,Q,st,it,tt,ot,ct,lt,gt);at(wt-rt)>.01;)wt=Ue(H,Q,st,it,tt,ot,ct,lt,gt+=(wt<rt?1:-1)*(ut/=2));return gt}}(p,w,C,g,y,k,M,F,G))},gi=function(p,w){return function(C,g,y){for(var k,M,F,G,H,Q="",st={},it=0,tt=0,ot=(C=Nn(C)).length;tt<ot;tt++){if((F=C[tt])[0]=="M")k=+F[1],M=+F[2];else{if(it+(G=Ce(k,M,F[1],F[2],F[3],F[4],F[5],F[6]))>g){if(w&&!st.start){if(Q+=["C"+(H=Ce(k,M,F[1],F[2],F[3],F[4],F[5],F[6],g-it)).start.x,H.start.y,H.m.x,H.m.y,H.x,H.y],y)return Q;st.start=Q,Q=["M"+H.x,H.y+"C"+H.n.x,H.n.y,H.end.x,H.end.y,F[5],F[6]].join(),it+=G,k=+F[5],M=+F[6];continue}if(!p&&!w)return{x:(H=Ce(k,M,F[1],F[2],F[3],F[4],F[5],F[6],g-it)).x,y:H.y,alpha:H.alpha}}it+=G,k=+F[5],M=+F[6]}Q+=F.shift()+F}return st.end=Q,(H=p?it:w?st:h.findDotsAtSegment(k,M,F[0],F[1],F[2],F[3],F[4],F[5],1)).alpha&&(H={x:H.x,y:H.y,alpha:H.alpha}),H}},ei=gi(1),qe=gi(),Bi=gi(0,1);h.getTotalLength=ei,h.getPointAtLength=qe,h.getSubpath=function(p,w,C){if(this.getTotalLength(p)-C<1e-6)return Bi(p,w).end;var g=Bi(p,C,1);return w?Bi(g,w).end:g},$t.getTotalLength=function(){var p=this.getPath();if(p)return this.node.getTotalLength?this.node.getTotalLength():ei(p)},$t.getPointAtLength=function(p){var w=this.getPath();if(w)return qe(w,p)},$t.getPath=function(){var p,w=h._getPath[this.type];if(this.type!="text"&&this.type!="set")return w&&(p=w(this)),p},$t.getSubpath=function(p,w){var C=this.getPath();if(C)return h.getSubpath(C,p,w)};var ne=h.easing_formulas={linear:function(p){return p},"<":function(p){return vt(p,1.7)},">":function(p){return vt(p,.48)},"<>":function(p){var w=.48-p/1.04,C=q.sqrt(.1734+w*w),g=C-w,y=-C-w,k=vt(at(g),1/3)*(g<0?-1:1)+vt(at(y),1/3)*(y<0?-1:1)+.5;return 3*(1-k)*k*k+k*k*k},backIn:function(p){var w=1.70158;return p*p*((w+1)*p-w)},backOut:function(p){var w=1.70158;return(p-=1)*p*((w+1)*p+w)+1},elastic:function(p){return p==!!p?p:vt(2,-10*p)*q.sin(2*_t*(p-.075)/.3)+1},bounce:function(p){var w=7.5625,C=2.75;return p<1/C?w*p*p:p<2/C?w*(p-=1.5/C)*p+.75:p<2.5/C?w*(p-=2.25/C)*p+.9375:w*(p-=2.625/C)*p+.984375}};ne.easeIn=ne["ease-in"]=ne["<"],ne.easeOut=ne["ease-out"]=ne[">"],ne.easeInOut=ne["ease-in-out"]=ne["<>"],ne["back-in"]=ne.backIn,ne["back-out"]=ne.backOut;var At=[],ta=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(p){setTimeout(p,16)},_r=function(){for(var p=+new Date,w=0;w<At.length;w++){var C=At[w];if(!C.el.removed&&!C.paused){var g,y,k=p-C.start,M=C.ms,F=C.easing,G=C.from,H=C.diff,Q=C.to,st=(C.t,C.el),it={},tt={};if(C.initstatus?(k=(C.initstatus*C.anim.top-C.prev)/(C.percent-C.prev)*M,C.status=C.initstatus,delete C.initstatus,C.stop&&At.splice(w--,1)):C.status=(C.prev+(C.percent-C.prev)*(k/M))/C.anim.top,!(k<0))if(k<M){var ot=F(k/M);for(var ct in G)if(G[m](ct)){switch(X[ct]){case pt:g=+G[ct]+ot*M*H[ct];break;case"colour":g="rgb("+[dn(B(G[ct].r+ot*M*H[ct].r)),dn(B(G[ct].g+ot*M*H[ct].g)),dn(B(G[ct].b+ot*M*H[ct].b))].join(",")+")";break;case"path":g=[];for(var lt=0,rt=G[ct].length;lt<rt;lt++){g[lt]=[G[ct][lt][0]];for(var wt=1,ut=G[ct][lt].length;wt<ut;wt++)g[lt][wt]=+G[ct][lt][wt]+ot*M*H[ct][lt][wt];g[lt]=g[lt].join(R)}g=g.join(R);break;case"transform":if(H[ct].real)for(g=[],lt=0,rt=G[ct].length;lt<rt;lt++)for(g[lt]=[G[ct][lt][0]],wt=1,ut=G[ct][lt].length;wt<ut;wt++)g[lt][wt]=G[ct][lt][wt]+ot*M*H[ct][lt][wt];else{var gt=function(Mt){return+G[ct][Mt]+ot*M*H[ct][Mt]};g=[["m",gt(0),gt(1),gt(2),gt(3),gt(4),gt(5)]]}break;case"csv":if(ct=="clip-rect")for(g=[],lt=4;lt--;)g[lt]=+G[ct][lt]+ot*M*H[ct][lt];break;default:var ft=[][_](G[ct]);for(g=[],lt=st.paper.customAttributes[ct].length;lt--;)g[lt]=+ft[lt]+ot*M*H[ct][lt]}it[ct]=g}st.attr(it),function(Mt,kt,Rt){setTimeout(function(){o("raphael.anim.frame."+Mt,kt,Rt)})}(st.id,st,C.anim)}else{if(function(Mt,kt,Rt){setTimeout(function(){o("raphael.anim.frame."+kt.id,kt,Rt),o("raphael.anim.finish."+kt.id,kt,Rt),h.is(Mt,"function")&&Mt.call(kt)})}(C.callback,st,C.anim),st.attr(Q),At.splice(w--,1),C.repeat>1&&!C.next){for(y in Q)Q[m](y)&&(tt[y]=C.totalOrigin[y]);C.el.attr(tt),zi(C.anim,C.el,C.anim.percents[0],null,C.totalOrigin,C.repeat-1)}C.next&&!C.stop&&zi(C.anim,C.el,C.next,null,C.totalOrigin,C.repeat)}}}At.length&&ta(_r)},dn=function(p){return p>255?255:p<0?0:p};function Be(p,w,C,g,y,k){var M=3*w,F=3*(g-w)-M,G=1-M-F,H=3*C,Q=3*(y-C)-H,st=1-H-Q;function it(tt){return((G*tt+F)*tt+M)*tt}return function(tt,ot){var ct=function(lt,rt){var wt,ut,gt,ft,Mt,kt;for(gt=lt,kt=0;kt<8;kt++){if(ft=it(gt)-lt,at(ft)<rt)return gt;if(at(Mt=(3*G*gt+2*F)*gt+M)<1e-6)break;gt-=ft/Mt}if(ut=1,(gt=lt)<(wt=0))return wt;if(gt>ut)return ut;for(;wt<ut;){if(ft=it(gt),at(ft-lt)<rt)return gt;lt>ft?wt=gt:ut=gt,gt=(ut-wt)/2+wt}return gt}(tt,ot);return((st*ct+Q)*ct+H)*ct}(p,1/(200*k))}function Le(p,w){var C=[],g={};if(this.ms=w,this.times=1,p){for(var y in p)p[m](y)&&(g[j(y)]=p[y],C.push(j(y)));C.sort(Pt)}this.anim=g,this.top=C[C.length-1],this.percents=C}function zi(p,w,C,g,y,k){C=j(C);var M,F,G,H,Q,st,it=p.ms,tt={},ot={},ct={};if(g)for(rt=0,wt=At.length;rt<wt;rt++){var lt=At[rt];if(lt.el.id==w.id&<.anim==p){lt.percent!=C?(At.splice(rt,1),G=1):F=lt,w.attr(lt.totalOrigin);break}}else g=+ot;for(var rt=0,wt=p.percents.length;rt<wt;rt++){if(p.percents[rt]==C||p.percents[rt]>g*p.top){C=p.percents[rt],Q=p.percents[rt-1]||0,it=it/p.top*(C-Q),H=p.percents[rt+1],M=p.anim[C];break}g&&w.attr(p.anim[p.percents[rt]])}if(M){if(F)F.initstatus=g,F.start=new Date-F.ms*g;else{for(var ut in M)if(M[m](ut)&&(X[m](ut)||w.paper.customAttributes[m](ut)))switch(tt[ut]=w.attr(ut),tt[ut]==null&&(tt[ut]=Y[ut]),ot[ut]=M[ut],X[ut]){case pt:ct[ut]=(ot[ut]-tt[ut])/it;break;case"colour":tt[ut]=h.getRGB(tt[ut]);var gt=h.getRGB(ot[ut]);ct[ut]={r:(gt.r-tt[ut].r)/it,g:(gt.g-tt[ut].g)/it,b:(gt.b-tt[ut].b)/it};break;case"path":var ft=Nn(tt[ut],ot[ut]),Mt=ft[1];for(tt[ut]=ft[0],ct[ut]=[],rt=0,wt=tt[ut].length;rt<wt;rt++){ct[ut][rt]=[0];for(var kt=1,Rt=tt[ut][rt].length;kt<Rt;kt++)ct[ut][rt][kt]=(Mt[rt][kt]-tt[ut][rt][kt])/it}break;case"transform":var xr=w._,ea=fo(xr[ut],ot[ut]);if(ea)for(tt[ut]=ea.from,ot[ut]=ea.to,ct[ut]=[],ct[ut].real=!0,rt=0,wt=tt[ut].length;rt<wt;rt++)for(ct[ut][rt]=[tt[ut][rt][0]],kt=1,Rt=tt[ut][rt].length;kt<Rt;kt++)ct[ut][rt][kt]=(ot[ut][rt][kt]-tt[ut][rt][kt])/it;else{var Ie=w.matrix||new Ni,pi={_:{transform:xr.transform},getBBox:function(){return w.getBBox(1)}};tt[ut]=[Ie.a,Ie.b,Ie.c,Ie.d,Ie.e,Ie.f],mr(pi,ot[ut]),ot[ut]=pi._.transform,ct[ut]=[(pi.matrix.a-Ie.a)/it,(pi.matrix.b-Ie.b)/it,(pi.matrix.c-Ie.c)/it,(pi.matrix.d-Ie.d)/it,(pi.matrix.e-Ie.e)/it,(pi.matrix.f-Ie.f)/it]}break;case"csv":var Sr=O(M[ut])[L](d),Cr=O(tt[ut])[L](d);if(ut=="clip-rect")for(tt[ut]=Cr,ct[ut]=[],rt=Cr.length;rt--;)ct[ut][rt]=(Sr[rt]-tt[ut][rt])/it;ot[ut]=Sr;break;default:for(Sr=[][_](M[ut]),Cr=[][_](tt[ut]),ct[ut]=[],rt=w.paper.customAttributes[ut].length;rt--;)ct[ut][rt]=((Sr[rt]||0)-(Cr[rt]||0))/it}var yo=M.easing,$i=h.easing_formulas[yo];if(!$i)if(($i=O(yo).match(A))&&$i.length==5){var zn=$i;$i=function(wo){return Be(wo,+zn[1],+zn[2],+zn[3],+zn[4],it)}}else $i=Ft;if(lt={anim:p,percent:C,timestamp:st=M.start||p.start||+new Date,start:st+(p.del||0),status:0,initstatus:g||0,stop:!1,ms:it,easing:$i,from:tt,diff:ct,to:ot,el:w,callback:M.callback,prev:Q,next:H,repeat:k||p.times,origin:w.attr(),totalOrigin:y},At.push(lt),g&&!F&&!G&&(lt.stop=!0,lt.start=new Date-it*g,At.length==1))return _r();G&&(lt.start=new Date-lt.ms*g),At.length==1&&ta(_r)}o("raphael.anim.start."+w.id,w,p)}}function yr(p){for(var w=0;w<At.length;w++)At[w].el.paper==p&&At.splice(w--,1)}$t.animateWith=function(p,w,C,g,y,k){if(this.removed)return k&&k.call(this),this;var M=C instanceof Le?C:h.animation(C,g,y,k);zi(M,this,M.percents[0],null,this.attr());for(var F=0,G=At.length;F<G;F++)if(At[F].anim==w&&At[F].el==p){At[G-1].start=At[F].start;break}return this},$t.onAnimation=function(p){return p?o.on("raphael.anim.frame."+this.id,p):o.unbind("raphael.anim.frame."+this.id),this},Le.prototype.delay=function(p){var w=new Le(this.anim,this.ms);return w.times=this.times,w.del=+p||0,w},Le.prototype.repeat=function(p){var w=new Le(this.anim,this.ms);return w.del=this.del,w.times=q.floor(K(p,0))||1,w},h.animation=function(p,w,C,g){if(p instanceof Le)return p;!h.is(C,"function")&&C||(g=g||C||null,C=null),p=Object(p),w=+w||0;var y,k,M={};for(k in p)p[m](k)&&j(k)!=k&&j(k)+"%"!=k&&(y=!0,M[k]=p[k]);if(y)return C&&(M.easing=C),g&&(M.callback=g),new Le({100:M},w);if(g){var F=0;for(var G in p){var H=W(G);p[m](G)&&H>F&&(F=H)}!p[F+="%"].callback&&(p[F].callback=g)}return new Le(p,w)},$t.animate=function(p,w,C,g){if(this.removed)return g&&g.call(this),this;var y=p instanceof Le?p:h.animation(p,w,C,g);return zi(y,this,y.percents[0],null,this.attr()),this},$t.setTime=function(p,w){return p&&w!=null&&this.status(p,Z(w,p.ms)/p.ms),this},$t.status=function(p,w){var C,g,y=[],k=0;if(w!=null)return zi(p,this,-1,Z(w,1)),this;for(C=At.length;k<C;k++)if((g=At[k]).el.id==this.id&&(!p||g.anim==p)){if(p)return g.status;y.push({anim:g.anim,status:g.status})}return p?0:y},$t.pause=function(p){for(var w=0;w<At.length;w++)At[w].el.id!=this.id||p&&At[w].anim!=p||o("raphael.anim.pause."+this.id,this,At[w].anim)!==!1&&(At[w].paused=!0);return this},$t.resume=function(p){for(var w=0;w<At.length;w++)if(At[w].el.id==this.id&&(!p||At[w].anim==p)){var C=At[w];o("raphael.anim.resume."+this.id,this,C.anim)!==!1&&(delete C.paused,this.status(C.anim,C.status))}return this},$t.stop=function(p){for(var w=0;w<At.length;w++)At[w].el.id!=this.id||p&&At[w].anim!=p||o("raphael.anim.stop."+this.id,this,At[w].anim)!==!1&&At.splice(w--,1);return this},o.on("raphael.remove",yr),o.on("raphael.clear",yr),$t.toString=function(){return"Raphaël’s object"};var wr,br,We,Ke,Un=function(p){if(this.items=[],this.length=0,this.type="set",p)for(var w=0,C=p.length;w<C;w++)!p[w]||p[w].constructor!=$t.constructor&&p[w].constructor!=Un||(this[this.items.length]=this.items[this.items.length]=p[w],this.length++)},de=Un.prototype;for(var Bn in de.push=function(){for(var p,w,C=0,g=arguments.length;C<g;C++)!(p=arguments[C])||p.constructor!=$t.constructor&&p.constructor!=Un||(this[w=this.items.length]=this.items[w]=p,this.length++);return this},de.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},de.forEach=function(p,w){for(var C=0,g=this.items.length;C<g;C++)if(p.call(w,this.items[C],C)===!1)return this;return this},$t)$t[m](Bn)&&(de[Bn]=function(p){return function(){var w=arguments;return this.forEach(function(C){C[p][E](C,w)})}}(Bn));return de.attr=function(p,w){if(p&&h.is(p,nt)&&h.is(p[0],"object"))for(var C=0,g=p.length;C<g;C++)this.items[C].attr(p[C]);else for(var y=0,k=this.items.length;y<k;y++)this.items[y].attr(p,w);return this},de.clear=function(){for(;this.length;)this.pop()},de.splice=function(p,w,C){p=p<0?K(this.length+p,0):p,w=K(0,Z(this.length-p,w));var g,y=[],k=[],M=[];for(g=2;g<arguments.length;g++)M.push(arguments[g]);for(g=0;g<w;g++)k.push(this[p+g]);for(;g<this.length-p;g++)y.push(this[p+g]);var F=M.length;for(g=0;g<F+y.length;g++)this.items[p+g]=this[p+g]=g<F?M[g]:y[g-F];for(g=this.items.length=this.length-=w-F;this[g];)delete this[g++];return new Un(k)},de.exclude=function(p){for(var w=0,C=this.length;w<C;w++)if(this[w]==p)return this.splice(w,1),!0},de.animate=function(p,w,C,g){(h.is(C,"function")||!C)&&(g=C||null);var y,k,M=this.items.length,F=M,G=this;if(!M)return this;g&&(k=function(){!--M&&g.call(G)}),C=h.is(C,"string")?C:k;var H=h.animation(p,w,C,k);for(y=this.items[--F].animate(H);F--;)this.items[F]&&!this.items[F].removed&&this.items[F].animateWith(y,H,H),this.items[F]&&!this.items[F].removed||M--;return this},de.insertAfter=function(p){for(var w=this.items.length;w--;)this.items[w].insertAfter(p);return this},de.getBBox=function(){for(var p=[],w=[],C=[],g=[],y=this.items.length;y--;)if(!this.items[y].removed){var k=this.items[y].getBBox();p.push(k.x),w.push(k.y),C.push(k.x+k.width),g.push(k.y+k.height)}return{x:p=Z[E](0,p),y:w=Z[E](0,w),x2:C=K[E](0,C),y2:g=K[E](0,g),width:C-p,height:g-w}},de.clone=function(p){p=this.paper.set();for(var w=0,C=this.items.length;w<C;w++)p.push(this.items[w].clone());return p},de.toString=function(){return"Raphaël‘s set"},de.glow=function(p){var w=this.paper.set();return this.forEach(function(C,g){var y=C.glow(p);y?.forEach(function(k,M){w.push(k)})}),w},de.isPointInside=function(p,w){var C=!1;return this.forEach(function(g){if(g.isPointInside(p,w))return C=!0,!1}),C},h.registerFont=function(p){if(!p.face)return p;this.fonts=this.fonts||{};var w={w:p.w,face:{},glyphs:{}},C=p.face["font-family"];for(var g in p.face)p.face[m](g)&&(w.face[g]=p.face[g]);if(this.fonts[C]?this.fonts[C].push(w):this.fonts[C]=[w],!p.svg){for(var y in w.face["units-per-em"]=W(p.face["units-per-em"],10),p.glyphs)if(p.glyphs[m](y)){var k=p.glyphs[y];if(w.glyphs[y]={w:k.w,k:{},d:k.d&&"M"+k.d.replace(/[mlcxtrv]/g,function(F){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[F]||"M"})+"z"},k.k)for(var M in k.k)k[m](M)&&(w.glyphs[y].k[M]=k.k[M])}}return p},c.getFont=function(p,w,C,g){if(g=g||"normal",C=C||"normal",w=+w||{normal:400,bold:700,lighter:300,bolder:800}[w]||400,h.fonts){var y,k=h.fonts[p];if(!k){var M=new RegExp("(^|\\s)"+p.replace(/[^\w\d\s+!~.:_-]/g,P)+"(\\s|$)","i");for(var F in h.fonts)if(h.fonts[m](F)&&M.test(F)){k=h.fonts[F];break}}if(k)for(var G=0,H=k.length;G<H&&((y=k[G]).face["font-weight"]!=w||y.face["font-style"]!=C&&y.face["font-style"]||y.face["font-stretch"]!=g);G++);return y}},c.print=function(p,w,C,g,y,k,M,F){k=k||"middle",M=K(Z(M||0,1),-1),F=K(Z(F||1,3),1);var G,H=O(C)[L](P),Q=0,st=0,it=P;if(h.is(g,"string")&&(g=this.getFont(g)),g){G=(y||16)/g.face["units-per-em"];for(var tt=g.face.bbox[L](d),ot=+tt[0],ct=tt[3]-tt[1],lt=0,rt=+tt[1]+(k=="baseline"?ct+ +g.face.descent:ct/2),wt=0,ut=H.length;wt<ut;wt++){if(H[wt]==`
|
|
26
|
+
`)Q=0,ft=0,st=0,lt+=ct*F;else{var gt=st&&g.glyphs[H[wt-1]]||{},ft=g.glyphs[H[wt]];Q+=st?(gt.w||g.w)+(gt.k&>.k[H[wt]]||0)+g.w*M:0,st=1}ft&&ft.d&&(it+=h.transformPath(ft.d,["t",Q*G,lt*G,"s",G,G,ot,rt,"t",(p-ot)/G,(w-rt)/G]))}}return this.path(it).attr({fill:"#000",stroke:"none"})},c.add=function(p){if(h.is(p,"array"))for(var w,C=this.set(),g=0,y=p.length;g<y;g++)w=p[g]||{},f[m](w.type)&&C.push(this[w.type]().attr(w));return C},h.format=function(p,w){var C=h.is(w,nt)?[0][_](w):arguments;return p&&h.is(p,"string")&&C.length-1&&(p=p.replace(u,function(g,y){return C[++y]==null?P:C[y]})),p||P},h.fullfill=(wr=/\{([^\}]+)\}/g,br=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,function(p,w){return String(p).replace(wr,function(C,g){return function(y,k,M){var F=M;return k.replace(br,function(G,H,Q,st,it){H=H||st,F&&(H in F&&(F=F[H]),typeof F=="function"&&it&&(F=F()))}),F=(F==null||F==M?y:F)+""}(C,g,w)})}),h.ninja=function(){if(b.was)v.win.Raphael=b.is;else{window.Raphael=void 0;try{delete window.Raphael}catch{}}return h},h.st=de,o.on("raphael.DOMload",function(){l=!0}),(We=document).readyState==null&&We.addEventListener&&(We.addEventListener("DOMContentLoaded",Ke=function(){We.removeEventListener("DOMContentLoaded",Ke,!1),We.readyState="complete"},!1),We.readyState="loading"),function p(){/in/.test(We.readyState)?setTimeout(p,9):h.eve("raphael.DOMload")}(),h}.apply(i,s))===void 0||(e.exports=a)},function(e,i,r){var s,a;s=[r(0),r(3),r(4)],(a=function(o){return o}.apply(i,s))===void 0||(e.exports=a)},function(e,i,r){var s,a,o,h,l,c,d,f,u,m,v,b,S,E;h="hasOwnProperty",l=/[\.\/]/,c=/\s*,\s*/,d=function(_,x){return _-x},f={n:{}},u=function(){for(var _=0,x=this.length;_<x;_++)if(this[_]!==void 0)return this[_]},m=function(){for(var _=this.length;--_;)if(this[_]!==void 0)return this[_]},v=Object.prototype.toString,b=String,S=Array.isArray||function(_){return _ instanceof Array||v.call(_)=="[object Array]"},(E=function(_,x){var P,R=o,O=Array.prototype.slice.call(arguments,2),L=E.listeners(_),$=0,U=[],z={},q=[],K=a;q.firstDefined=u,q.lastDefined=m,a=_,o=0;for(var Z=0,at=L.length;Z<at;Z++)"zIndex"in L[Z]&&(U.push(L[Z].zIndex),L[Z].zIndex<0&&(z[L[Z].zIndex]=L[Z]));for(U.sort(d);U[$]<0;)if(P=z[U[$++]],q.push(P.apply(x,O)),o)return o=R,q;for(Z=0;Z<at;Z++)if("zIndex"in(P=L[Z]))if(P.zIndex==U[$]){if(q.push(P.apply(x,O)),o)break;do if((P=z[U[++$]])&&q.push(P.apply(x,O)),o)break;while(P)}else z[P.zIndex]=P;else if(q.push(P.apply(x,O)),o)break;return o=R,a=K,q})._events=f,E.listeners=function(_){var x,P,R,O,L,$,U,z,q=S(_)?_:_.split(l),K=f,Z=[K],at=[];for(O=0,L=q.length;O<L;O++){for(z=[],$=0,U=Z.length;$<U;$++)for(P=[(K=Z[$].n)[q[O]],K["*"]],R=2;R--;)(x=P[R])&&(z.push(x),at=at.concat(x.f||[]));Z=z}return at},E.separator=function(_){_?(_="["+(_=b(_).replace(/(?=[\.\^\]\[\-])/g,"\\"))+"]",l=new RegExp(_)):l=/[\.\/]/},E.on=function(_,x){if(typeof x!="function")return function(){};for(var P=S(_)?S(_[0])?_:[_]:b(_).split(c),R=0,O=P.length;R<O;R++)(function(L){for(var $,U=S(L)?L:b(L).split(l),z=f,q=0,K=U.length;q<K;q++)z=(z=z.n).hasOwnProperty(U[q])&&z[U[q]]||(z[U[q]]={n:{}});for(z.f=z.f||[],q=0,K=z.f.length;q<K;q++)if(z.f[q]==x){$=!0;break}!$&&z.f.push(x)})(P[R]);return function(L){+L==+L&&(x.zIndex=+L)}},E.f=function(_){var x=[].slice.call(arguments,1);return function(){E.apply(null,[_,null].concat(x).concat([].slice.call(arguments,0)))}},E.stop=function(){o=1},E.nt=function(_){var x=S(a)?a.join("."):a;return _?new RegExp("(?:\\.|\\/|^)"+_+"(?:\\.|\\/|$)").test(x):x},E.nts=function(){return S(a)?a:a.split(l)},E.off=E.unbind=function(_,x){if(_){var P=S(_)?S(_[0])?_:[_]:b(_).split(c);if(P.length>1)for(var R=0,O=P.length;R<O;R++)E.off(P[R],x);else{P=S(_)?_:b(_).split(l);var L,$,U,z,q,K=[f];for(R=0,O=P.length;R<O;R++)for(z=0;z<K.length;z+=U.length-2){if(U=[z,1],L=K[z].n,P[R]!="*")L[P[R]]&&U.push(L[P[R]]);else for($ in L)L[h]($)&&U.push(L[$]);K.splice.apply(K,U)}for(R=0,O=K.length;R<O;R++)for(L=K[R];L.n;){if(x){if(L.f){for(z=0,q=L.f.length;z<q;z++)if(L.f[z]==x){L.f.splice(z,1);break}!L.f.length&&delete L.f}for($ in L.n)if(L.n[h]($)&&L.n[$].f){var Z=L.n[$].f;for(z=0,q=Z.length;z<q;z++)if(Z[z]==x){Z.splice(z,1);break}!Z.length&&delete L.n[$].f}}else for($ in delete L.f,L.n)L.n[h]($)&&L.n[$].f&&delete L.n[$].f;L=L.n}}}else E._events=f={n:{}}},E.once=function(_,x){var P=function(){return E.off(_,P),x.apply(this,arguments)};return E.on(_,P)},E.version="0.5.0",E.toString=function(){return"You are running Eve 0.5.0"},e.exports?e.exports=E:(s=function(){return E}.apply(i,[]))===void 0||(e.exports=s)},function(e,i,r){var s,a;s=[r(0)],(a=function(o){if(!o||o.svg){var h="hasOwnProperty",l=String,c=parseFloat,d=parseInt,f=Math,u=f.max,m=f.abs,v=f.pow,b=/[, ]+/,S=o.eve,E="",_=" ",x="http://www.w3.org/1999/xlink",P={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},R={};o.toString=function(){return`Your browser supports SVG.
|
|
27
|
+
You are running Raphaël `+this.version};var O=function(I,D){if(D)for(var A in typeof I=="string"&&(I=O(I)),D)D[h](A)&&(A.substring(0,6)=="xlink:"?I.setAttributeNS(x,A.substring(6),l(D[A])):I.setAttribute(A,l(D[A])));else(I=o._g.doc.createElementNS("http://www.w3.org/2000/svg",I)).style&&(I.style.webkitTapHighlightColor="rgba(0,0,0,0)");return I},L=function(I,D){var A="linear",B=I.id+D,j=.5,W=.5,N=I.node,Y=I.paper,X=N.style,et=o._g.doc.getElementById(B);if(!et){if(D=(D=l(D).replace(o._radial_gradient,function(Pt,Ft,Ct){if(A="radial",Ft&&Ct){j=c(Ft);var Jt=2*((W=c(Ct))>.5)-1;v(j-.5,2)+v(W-.5,2)>.25&&(W=f.sqrt(.25-v(j-.5,2))*Jt+.5)&&W!=.5&&(W=W.toFixed(5)-1e-5*Jt)}return E})).split(/\s*\-\s*/),A=="linear"){var ht=D.shift();if(ht=-c(ht),isNaN(ht))return null;var mt=[0,0,f.cos(o.rad(ht)),f.sin(o.rad(ht))],bt=1/(u(m(mt[2]),m(mt[3]))||1);mt[2]*=bt,mt[3]*=bt,mt[2]<0&&(mt[0]=-mt[2],mt[2]=0),mt[3]<0&&(mt[1]=-mt[3],mt[3]=0)}var Tt=o._parseDots(D);if(!Tt)return null;if(B=B.replace(/[\(\)\s,\xb0#]/g,"_"),I.gradient&&B!=I.gradient.id&&(Y.defs.removeChild(I.gradient),delete I.gradient),!I.gradient){et=O(A+"Gradient",{id:B}),I.gradient=et,O(et,A=="radial"?{fx:j,fy:W}:{x1:mt[0],y1:mt[1],x2:mt[2],y2:mt[3],gradientTransform:I.matrix.invert()}),Y.defs.appendChild(et);for(var yt=0,Et=Tt.length;yt<Et;yt++)et.appendChild(O("stop",{offset:Tt[yt].offset?Tt[yt].offset:yt?"100%":"0%","stop-color":Tt[yt].color||"#fff","stop-opacity":isFinite(Tt[yt].opacity)?Tt[yt].opacity:1}))}}return O(N,{fill:$(B),opacity:1,"fill-opacity":1}),X.fill=E,X.opacity=1,X.fillOpacity=1,1},$=function(I){if((D=document.documentMode)&&(D===9||D===10))return"url('#"+I+"')";var D,A=document.location;return"url('"+(A.protocol+"//"+A.host+A.pathname+A.search)+"#"+I+"')"},U=function(I){var D=I.getBBox(1);O(I.pattern,{patternTransform:I.matrix.invert()+" translate("+D.x+","+D.y+")"})},z=function(I,D,A){if(I.type=="path"){for(var B,j,W,N,Y,X=l(D).toLowerCase().split("-"),et=I.paper,ht=A?"end":"start",mt=I.node,bt=I.attrs,Tt=bt["stroke-width"],yt=X.length,Et="classic",Pt=3,Ft=3,Ct=5;yt--;)switch(X[yt]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":Et=X[yt];break;case"wide":Ft=5;break;case"narrow":Ft=2;break;case"long":Pt=5;break;case"short":Pt=2}if(Et=="open"?(Pt+=2,Ft+=2,Ct+=2,W=1,N=A?4:1,Y={fill:"none",stroke:bt.stroke}):(N=W=Pt/2,Y={fill:bt.stroke,stroke:"none"}),I._.arrows?A?(I._.arrows.endPath&&R[I._.arrows.endPath]--,I._.arrows.endMarker&&R[I._.arrows.endMarker]--):(I._.arrows.startPath&&R[I._.arrows.startPath]--,I._.arrows.startMarker&&R[I._.arrows.startMarker]--):I._.arrows={},Et!="none"){var Jt="raphael-marker-"+Et,zt="raphael-marker-"+ht+Et+Pt+Ft+"-obj"+I.id;o._g.doc.getElementById(Jt)?R[Jt]++:(et.defs.appendChild(O(O("path"),{"stroke-linecap":"round",d:P[Et],id:Jt})),R[Jt]=1);var ce,Xt=o._g.doc.getElementById(zt);Xt?(R[zt]++,ce=Xt.getElementsByTagName("use")[0]):(Xt=O(O("marker"),{id:zt,markerHeight:Ft,markerWidth:Pt,orient:"auto",refX:N,refY:Ft/2}),ce=O(O("use"),{"xlink:href":"#"+Jt,transform:(A?"rotate(180 "+Pt/2+" "+Ft/2+") ":E)+"scale("+Pt/Ct+","+Ft/Ct+")","stroke-width":(1/((Pt/Ct+Ft/Ct)/2)).toFixed(4)}),Xt.appendChild(ce),et.defs.appendChild(Xt),R[zt]=1),O(ce,Y);var Ee=W*(Et!="diamond"&&Et!="oval");A?(B=I._.arrows.startdx*Tt||0,j=o.getTotalLength(bt.path)-Ee*Tt):(B=Ee*Tt,j=o.getTotalLength(bt.path)-(I._.arrows.enddx*Tt||0)),(Y={})["marker-"+ht]="url(#"+zt+")",(j||B)&&(Y.d=o.getSubpath(bt.path,B,j)),O(mt,Y),I._.arrows[ht+"Path"]=Jt,I._.arrows[ht+"Marker"]=zt,I._.arrows[ht+"dx"]=Ee,I._.arrows[ht+"Type"]=Et,I._.arrows[ht+"String"]=D}else A?(B=I._.arrows.startdx*Tt||0,j=o.getTotalLength(bt.path)-B):(B=0,j=o.getTotalLength(bt.path)-(I._.arrows.enddx*Tt||0)),I._.arrows[ht+"Path"]&&O(mt,{d:o.getSubpath(bt.path,B,j)}),delete I._.arrows[ht+"Path"],delete I._.arrows[ht+"Marker"],delete I._.arrows[ht+"dx"],delete I._.arrows[ht+"Type"],delete I._.arrows[ht+"String"];for(Y in R)if(R[h](Y)&&!R[Y]){var ye=o._g.doc.getElementById(Y);ye&&ye.parentNode.removeChild(ye)}}},q={"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},K=function(I,D,A){if(D=q[l(D).toLowerCase()]){for(var B=I.attrs["stroke-width"]||"1",j={round:B,square:B,butt:0}[I.attrs["stroke-linecap"]||A["stroke-linecap"]]||0,W=[],N=D.length;N--;)W[N]=D[N]*B+(N%2?1:-1)*j;O(I.node,{"stroke-dasharray":W.join(",")})}else O(I.node,{"stroke-dasharray":"none"})},Z=function(I,D){var A=I.node,B=I.attrs,j=A.style.visibility;for(var W in A.style.visibility="hidden",D)if(D[h](W)){if(!o._availableAttrs[h](W))continue;var N=D[W];switch(B[W]=N,W){case"blur":I.blur(N);break;case"title":var Y=A.getElementsByTagName("title");if(Y.length&&(Y=Y[0]))Y.firstChild.nodeValue=N;else{Y=O("title");var X=o._g.doc.createTextNode(N);Y.appendChild(X),A.appendChild(Y)}break;case"href":case"target":var et=A.parentNode;if(et.tagName.toLowerCase()!="a"){var ht=O("a");et.insertBefore(ht,A),ht.appendChild(A),et=ht}W=="target"?et.setAttributeNS(x,"show",N=="blank"?"new":N):et.setAttributeNS(x,W,N);break;case"cursor":A.style.cursor=N;break;case"transform":I.transform(N);break;case"arrow-start":z(I,N);break;case"arrow-end":z(I,N,1);break;case"clip-rect":var mt=l(N).split(b);if(mt.length==4){I.clip&&I.clip.parentNode.parentNode.removeChild(I.clip.parentNode);var bt=O("clipPath"),Tt=O("rect");bt.id=o.createUUID(),O(Tt,{x:mt[0],y:mt[1],width:mt[2],height:mt[3]}),bt.appendChild(Tt),I.paper.defs.appendChild(bt),O(A,{"clip-path":"url(#"+bt.id+")"}),I.clip=Tt}if(!N){var yt=A.getAttribute("clip-path");if(yt){var Et=o._g.doc.getElementById(yt.replace(/(^url\(#|\)$)/g,E));Et&&Et.parentNode.removeChild(Et),O(A,{"clip-path":E}),delete I.clip}}break;case"path":I.type=="path"&&(O(A,{d:N?B.path=o._pathToAbsolute(N):"M0,0"}),I._.dirty=1,I._.arrows&&("startString"in I._.arrows&&z(I,I._.arrows.startString),"endString"in I._.arrows&&z(I,I._.arrows.endString,1)));break;case"width":if(A.setAttribute(W,N),I._.dirty=1,!B.fx)break;W="x",N=B.x;case"x":B.fx&&(N=-B.x-(B.width||0));case"rx":if(W=="rx"&&I.type=="rect")break;case"cx":A.setAttribute(W,N),I.pattern&&U(I),I._.dirty=1;break;case"height":if(A.setAttribute(W,N),I._.dirty=1,!B.fy)break;W="y",N=B.y;case"y":B.fy&&(N=-B.y-(B.height||0));case"ry":if(W=="ry"&&I.type=="rect")break;case"cy":A.setAttribute(W,N),I.pattern&&U(I),I._.dirty=1;break;case"r":I.type=="rect"?O(A,{rx:N,ry:N}):A.setAttribute(W,N),I._.dirty=1;break;case"src":I.type=="image"&&A.setAttributeNS(x,"href",N);break;case"stroke-width":I._.sx==1&&I._.sy==1||(N/=u(m(I._.sx),m(I._.sy))||1),A.setAttribute(W,N),B["stroke-dasharray"]&&K(I,B["stroke-dasharray"],D),I._.arrows&&("startString"in I._.arrows&&z(I,I._.arrows.startString),"endString"in I._.arrows&&z(I,I._.arrows.endString,1));break;case"stroke-dasharray":K(I,N,D);break;case"fill":var Pt=l(N).match(o._ISURL);if(Pt){bt=O("pattern");var Ft=O("image");bt.id=o.createUUID(),O(bt,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),O(Ft,{x:0,y:0,"xlink:href":Pt[1]}),bt.appendChild(Ft),function(Xt){o._preload(Pt[1],function(){var Ee=this.offsetWidth,ye=this.offsetHeight;O(Xt,{width:Ee,height:ye}),O(Ft,{width:Ee,height:ye})})}(bt),I.paper.defs.appendChild(bt),O(A,{fill:"url(#"+bt.id+")"}),I.pattern=bt,I.pattern&&U(I);break}var Ct=o.getRGB(N);if(Ct.error){if((I.type=="circle"||I.type=="ellipse"||l(N).charAt()!="r")&&L(I,N)){if("opacity"in B||"fill-opacity"in B){var Jt=o._g.doc.getElementById(A.getAttribute("fill").replace(/^url\(#|\)$/g,E));if(Jt){var zt=Jt.getElementsByTagName("stop");O(zt[zt.length-1],{"stop-opacity":("opacity"in B?B.opacity:1)*("fill-opacity"in B?B["fill-opacity"]:1)})}}B.gradient=N,B.fill="none";break}}else delete D.gradient,delete B.gradient,!o.is(B.opacity,"undefined")&&o.is(D.opacity,"undefined")&&O(A,{opacity:B.opacity}),!o.is(B["fill-opacity"],"undefined")&&o.is(D["fill-opacity"],"undefined")&&O(A,{"fill-opacity":B["fill-opacity"]});Ct[h]("opacity")&&O(A,{"fill-opacity":Ct.opacity>1?Ct.opacity/100:Ct.opacity});case"stroke":Ct=o.getRGB(N),A.setAttribute(W,Ct.hex),W=="stroke"&&Ct[h]("opacity")&&O(A,{"stroke-opacity":Ct.opacity>1?Ct.opacity/100:Ct.opacity}),W=="stroke"&&I._.arrows&&("startString"in I._.arrows&&z(I,I._.arrows.startString),"endString"in I._.arrows&&z(I,I._.arrows.endString,1));break;case"gradient":(I.type=="circle"||I.type=="ellipse"||l(N).charAt()!="r")&&L(I,N);break;case"opacity":B.gradient&&!B[h]("stroke-opacity")&&O(A,{"stroke-opacity":N>1?N/100:N});case"fill-opacity":if(B.gradient){(Jt=o._g.doc.getElementById(A.getAttribute("fill").replace(/^url\(#|\)$/g,E)))&&(zt=Jt.getElementsByTagName("stop"),O(zt[zt.length-1],{"stop-opacity":N}));break}default:W=="font-size"&&(N=d(N,10)+"px");var ce=W.replace(/(\-.)/g,function(Xt){return Xt.substring(1).toUpperCase()});A.style[ce]=N,I._.dirty=1,A.setAttribute(W,N)}}at(I,D),A.style.visibility=j},at=function(I,D){if(I.type=="text"&&(D[h]("text")||D[h]("font")||D[h]("font-size")||D[h]("x")||D[h]("y"))){var A=I.attrs,B=I.node,j=B.firstChild?d(o._g.doc.defaultView.getComputedStyle(B.firstChild,E).getPropertyValue("font-size"),10):10;if(D[h]("text")){for(A.text=D.text;B.firstChild;)B.removeChild(B.firstChild);for(var W,N=l(D.text).split(`
|
|
28
|
+
`),Y=[],X=0,et=N.length;X<et;X++)W=O("tspan"),X&&O(W,{dy:1.2*j,x:A.x}),W.appendChild(o._g.doc.createTextNode(N[X])),B.appendChild(W),Y[X]=W}else for(X=0,et=(Y=B.getElementsByTagName("tspan")).length;X<et;X++)X?O(Y[X],{dy:1.2*j,x:A.x}):O(Y[0],{dy:0});O(B,{x:A.x,y:A.y}),I._.dirty=1;var ht=I._getBBox(),mt=A.y-(ht.y+ht.height/2);mt&&o.is(mt,"finite")&&O(Y[0],{dy:mt})}},vt=function(I){return I.parentNode&&I.parentNode.tagName.toLowerCase()==="a"?I.parentNode:I},_t=function(I,D){this[0]=this.node=I,I.raphael=!0,this.id=("0000"+(Math.random()*Math.pow(36,5)<<0).toString(36)).slice(-5),I.raphaelid=this.id,this.matrix=o.matrix(),this.realPath=null,this.paper=D,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!D.bottom&&(D.bottom=this),this.prev=D.top,D.top&&(D.top.next=this),D.top=this,this.next=null},pt=o.el;_t.prototype=pt,pt.constructor=_t,o._engine.path=function(I,D){var A=O("path");D.canvas&&D.canvas.appendChild(A);var B=new _t(A,D);return B.type="path",Z(B,{fill:"none",stroke:"#000",path:I}),B},pt.rotate=function(I,D,A){if(this.removed)return this;if((I=l(I).split(b)).length-1&&(D=c(I[1]),A=c(I[2])),I=c(I[0]),A==null&&(D=A),D==null||A==null){var B=this.getBBox(1);D=B.x+B.width/2,A=B.y+B.height/2}return this.transform(this._.transform.concat([["r",I,D,A]])),this},pt.scale=function(I,D,A,B){if(this.removed)return this;if((I=l(I).split(b)).length-1&&(D=c(I[1]),A=c(I[2]),B=c(I[3])),I=c(I[0]),D==null&&(D=I),B==null&&(A=B),A==null||B==null)var j=this.getBBox(1);return A=A??j.x+j.width/2,B=B??j.y+j.height/2,this.transform(this._.transform.concat([["s",I,D,A,B]])),this},pt.translate=function(I,D){return this.removed?this:((I=l(I).split(b)).length-1&&(D=c(I[1])),I=c(I[0])||0,D=+D||0,this.transform(this._.transform.concat([["t",I,D]])),this)},pt.transform=function(I){var D=this._;if(I==null)return D.transform;if(o._extractTransform(this,I),this.clip&&O(this.clip,{transform:this.matrix.invert()}),this.pattern&&U(this),this.node&&O(this.node,{transform:this.matrix}),D.sx!=1||D.sy!=1){var A=this.attrs[h]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":A})}return this},pt.hide=function(){return this.removed||(this.node.style.display="none"),this},pt.show=function(){return this.removed||(this.node.style.display=""),this},pt.remove=function(){var I=vt(this.node);if(!this.removed&&I.parentNode){var D=this.paper;for(var A in D.__set__&&D.__set__.exclude(this),S.unbind("raphael.*.*."+this.id),this.gradient&&D.defs.removeChild(this.gradient),o._tear(this,D),I.parentNode.removeChild(I),this.removeData(),this)this[A]=typeof this[A]=="function"?o._removedFactory(A):null;this.removed=!0}},pt._getBBox=function(){if(this.node.style.display=="none"){this.show();var I=!0}var D,A=!1;this.paper.canvas.parentElement?D=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(D=this.paper.canvas.parentNode.style),D&&D.display=="none"&&(A=!0,D.display="");var B={};try{B=this.node.getBBox()}catch{B={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{B=B||{},A&&(D.display="none")}return I&&this.hide(),B},pt.attr=function(I,D){if(this.removed)return this;if(I==null){var A={};for(var B in this.attrs)this.attrs[h](B)&&(A[B]=this.attrs[B]);return A.gradient&&A.fill=="none"&&(A.fill=A.gradient)&&delete A.gradient,A.transform=this._.transform,A}if(D==null&&o.is(I,"string")){if(I=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(I=="transform")return this._.transform;for(var j=I.split(b),W={},N=0,Y=j.length;N<Y;N++)(I=j[N])in this.attrs?W[I]=this.attrs[I]:o.is(this.paper.customAttributes[I],"function")?W[I]=this.paper.customAttributes[I].def:W[I]=o._availableAttrs[I];return Y-1?W:W[j[0]]}if(D==null&&o.is(I,"array")){for(W={},N=0,Y=I.length;N<Y;N++)W[I[N]]=this.attr(I[N]);return W}if(D!=null){var X={};X[I]=D}else I!=null&&o.is(I,"object")&&(X=I);for(var et in X)S("raphael.attr."+et+"."+this.id,this,X[et]);for(et in this.paper.customAttributes)if(this.paper.customAttributes[h](et)&&X[h](et)&&o.is(this.paper.customAttributes[et],"function")){var ht=this.paper.customAttributes[et].apply(this,[].concat(X[et]));for(var mt in this.attrs[et]=X[et],ht)ht[h](mt)&&(X[mt]=ht[mt])}return Z(this,X),this},pt.toFront=function(){if(this.removed)return this;var I=vt(this.node);I.parentNode.appendChild(I);var D=this.paper;return D.top!=this&&o._tofront(this,D),this},pt.toBack=function(){if(this.removed)return this;var I=vt(this.node),D=I.parentNode;return D.insertBefore(I,D.firstChild),o._toback(this,this.paper),this.paper,this},pt.insertAfter=function(I){if(this.removed||!I)return this;var D=vt(this.node),A=vt(I.node||I[I.length-1].node);return A.nextSibling?A.parentNode.insertBefore(D,A.nextSibling):A.parentNode.appendChild(D),o._insertafter(this,I,this.paper),this},pt.insertBefore=function(I){if(this.removed||!I)return this;var D=vt(this.node),A=vt(I.node||I[0].node);return A.parentNode.insertBefore(D,A),o._insertbefore(this,I,this.paper),this},pt.blur=function(I){var D=this;if(+I!=0){var A=O("filter"),B=O("feGaussianBlur");D.attrs.blur=I,A.id=o.createUUID(),O(B,{stdDeviation:+I||1.5}),A.appendChild(B),D.paper.defs.appendChild(A),D._blur=A,O(D.node,{filter:"url(#"+A.id+")"})}else D._blur&&(D._blur.parentNode.removeChild(D._blur),delete D._blur,delete D.attrs.blur),D.node.removeAttribute("filter");return D},o._engine.circle=function(I,D,A,B){var j=O("circle");I.canvas&&I.canvas.appendChild(j);var W=new _t(j,I);return W.attrs={cx:D,cy:A,r:B,fill:"none",stroke:"#000"},W.type="circle",O(j,W.attrs),W},o._engine.rect=function(I,D,A,B,j,W){var N=O("rect");I.canvas&&I.canvas.appendChild(N);var Y=new _t(N,I);return Y.attrs={x:D,y:A,width:B,height:j,rx:W||0,ry:W||0,fill:"none",stroke:"#000"},Y.type="rect",O(N,Y.attrs),Y},o._engine.ellipse=function(I,D,A,B,j){var W=O("ellipse");I.canvas&&I.canvas.appendChild(W);var N=new _t(W,I);return N.attrs={cx:D,cy:A,rx:B,ry:j,fill:"none",stroke:"#000"},N.type="ellipse",O(W,N.attrs),N},o._engine.image=function(I,D,A,B,j,W){var N=O("image");O(N,{x:A,y:B,width:j,height:W,preserveAspectRatio:"none"}),N.setAttributeNS(x,"href",D),I.canvas&&I.canvas.appendChild(N);var Y=new _t(N,I);return Y.attrs={x:A,y:B,width:j,height:W,src:D},Y.type="image",Y},o._engine.text=function(I,D,A,B){var j=O("text");I.canvas&&I.canvas.appendChild(j);var W=new _t(j,I);return W.attrs={x:D,y:A,"text-anchor":"middle",text:B,"font-family":o._availableAttrs["font-family"],"font-size":o._availableAttrs["font-size"],stroke:"none",fill:"#000"},W.type="text",Z(W,W.attrs),W},o._engine.setSize=function(I,D){return this.width=I||this.width,this.height=D||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},o._engine.create=function(){var I=o._getContainer.apply(0,arguments),D=I&&I.container;if(!D)throw new Error("SVG container not found.");var A,B=I.x,j=I.y,W=I.width,N=I.height,Y=O("svg"),X="overflow:hidden;";return B=B||0,j=j||0,O(Y,{height:N=N||342,version:1.1,width:W=W||512,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),D==1?(Y.style.cssText=X+"position:absolute;left:"+B+"px;top:"+j+"px",o._g.doc.body.appendChild(Y),A=1):(Y.style.cssText=X+"position:relative",D.firstChild?D.insertBefore(Y,D.firstChild):D.appendChild(Y)),(D=new o._Paper).width=W,D.height=N,D.canvas=Y,D.clear(),D._left=D._top=0,A&&(D.renderfix=function(){}),D.renderfix(),D},o._engine.setViewBox=function(I,D,A,B,j){S("raphael.setViewBox",this,this._viewBox,[I,D,A,B,j]);var W,N,Y=this.getSize(),X=u(A/Y.width,B/Y.height),et=this.top,ht=j?"xMidYMid meet":"xMinYMin";for(I==null?(this._vbSize&&(X=1),delete this._vbSize,W="0 0 "+this.width+_+this.height):(this._vbSize=X,W=I+_+D+_+A+_+B),O(this.canvas,{viewBox:W,preserveAspectRatio:ht});X&&et;)N="stroke-width"in et.attrs?et.attrs["stroke-width"]:1,et.attr({"stroke-width":N}),et._.dirty=1,et._.dirtyT=1,et=et.prev;return this._viewBox=[I,D,A,B,!!j],this},o.prototype.renderfix=function(){var I,D=this.canvas,A=D.style;try{I=D.getScreenCTM()||D.createSVGMatrix()}catch{I=D.createSVGMatrix()}var B=-I.e%1,j=-I.f%1;(B||j)&&(B&&(this._left=(this._left+B)%1,A.left=this._left+"px"),j&&(this._top=(this._top+j)%1,A.top=this._top+"px"))},o.prototype.clear=function(){o.eve("raphael.clear",this);for(var I=this.canvas;I.firstChild;)I.removeChild(I.firstChild);this.bottom=this.top=null,(this.desc=O("desc")).appendChild(o._g.doc.createTextNode("Created with Raphaël "+o.version)),I.appendChild(this.desc),I.appendChild(this.defs=O("defs"))},o.prototype.remove=function(){for(var I in S("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this)this[I]=typeof this[I]=="function"?o._removedFactory(I):null};var nt=o.st;for(var J in pt)pt[h](J)&&!nt[h](J)&&(nt[J]=function(I){return function(){var D=arguments;return this.forEach(function(A){A[I].apply(A,D)})}}(J))}}.apply(i,s))===void 0||(e.exports=a)},function(e,i,r){var s,a;s=[r(0)],(a=function(o){if(!o||o.vml){var h="hasOwnProperty",l=String,c=parseFloat,d=Math,f=d.round,u=d.max,m=d.min,v=d.abs,b=/[, ]+/,S=o.eve,E=" ",_="",x={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},P=/([clmz]),?([^clmz]*)/gi,R=/ progid:\S+Blur\([^\)]+\)/g,O=/-?[^,\s-]+/g,L="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",$=21600,U={path:1,rect:1,image:1},z={circle:1,ellipse:1},q=function(D,A,B){var j=o.matrix();return j.rotate(-D,.5,.5),{dx:j.x(A,B),dy:j.y(A,B)}},K=function(D,A,B,j,W,N){var Y=D._,X=D.matrix,et=Y.fillpos,ht=D.node,mt=ht.style,bt=1,Tt="",yt=$/A,Et=$/B;if(mt.visibility="hidden",A&&B){if(ht.coordsize=v(yt)+E+v(Et),mt.rotation=N*(A*B<0?-1:1),N){var Pt=q(N,j,W);j=Pt.dx,W=Pt.dy}if(A<0&&(Tt+="x"),B<0&&(Tt+=" y")&&(bt=-1),mt.flip=Tt,ht.coordorigin=j*-yt+E+W*-Et,et||Y.fillsize){var Ft=ht.getElementsByTagName("fill");Ft=Ft&&Ft[0],ht.removeChild(Ft),et&&(Pt=q(N,X.x(et[0],et[1]),X.y(et[0],et[1])),Ft.position=Pt.dx*bt+E+Pt.dy*bt),Y.fillsize&&(Ft.size=Y.fillsize[0]*v(A)+E+Y.fillsize[1]*v(B)),ht.appendChild(Ft)}mt.visibility="visible"}};o.toString=function(){return`Your browser doesn’t support SVG. Falling down to VML.
|
|
29
|
+
You are running Raphaël `+this.version};var Z,at=function(D,A,B){for(var j=l(A).toLowerCase().split("-"),W=B?"end":"start",N=j.length,Y="classic",X="medium",et="medium";N--;)switch(j[N]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":Y=j[N];break;case"wide":case"narrow":et=j[N];break;case"long":case"short":X=j[N]}var ht=D.node.getElementsByTagName("stroke")[0];ht[W+"arrow"]=Y,ht[W+"arrowlength"]=X,ht[W+"arrowwidth"]=et},vt=function(D,A){D.attrs=D.attrs||{};var B=D.node,j=D.attrs,W=B.style,N=U[D.type]&&(A.x!=j.x||A.y!=j.y||A.width!=j.width||A.height!=j.height||A.cx!=j.cx||A.cy!=j.cy||A.rx!=j.rx||A.ry!=j.ry||A.r!=j.r),Y=z[D.type]&&(j.cx!=A.cx||j.cy!=A.cy||j.r!=A.r||j.rx!=A.rx||j.ry!=A.ry),X=D;for(var et in A)A[h](et)&&(j[et]=A[et]);if(N&&(j.path=o._getPath[D.type](D),D._.dirty=1),A.href&&(B.href=A.href),A.title&&(B.title=A.title),A.target&&(B.target=A.target),A.cursor&&(W.cursor=A.cursor),"blur"in A&&D.blur(A.blur),(A.path&&D.type=="path"||N)&&(B.path=function(ve){var fi=/[ahqstv]/gi,hn=o._pathToAbsolute;if(l(ve).match(fi)&&(hn=o._path2curve),fi=/[clmz]/g,hn==o._pathToAbsolute&&!l(ve).match(fi)){var Re=l(ve).replace(P,function(lo,cn,Ii){var di=[],gr=cn.toLowerCase()=="m",Fi=x[cn];return Ii.replace(O,function(Oi){gr&&di.length==2&&(Fi+=di+x[cn=="m"?"l":"L"],di=[]),di.push(f(Oi*$))}),Fi+di});return Re}var ti,Ue,On=hn(ve);Re=[];for(var Li=0,ln=On.length;Li<ln;Li++){ti=On[Li],(Ue=On[Li][0].toLowerCase())=="z"&&(Ue="x");for(var Ye=1,Se=ti.length;Ye<Se;Ye++)Ue+=f(ti[Ye]*$)+(Ye!=Se-1?",":_);Re.push(Ue)}return Re.join(E)}(~l(j.path).toLowerCase().indexOf("r")?o._pathToAbsolute(j.path):j.path),D._.dirty=1,D.type=="image"&&(D._.fillpos=[j.x,j.y],D._.fillsize=[j.width,j.height],K(D,1,1,0,0,0))),"transform"in A&&D.transform(A.transform),Y){var ht=+j.cx,mt=+j.cy,bt=+j.rx||+j.r||0,Tt=+j.ry||+j.r||0;B.path=o.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((ht-bt)*$),f((mt-Tt)*$),f((ht+bt)*$),f((mt+Tt)*$),f(ht*$)),D._.dirty=1}if("clip-rect"in A){var yt=l(A["clip-rect"]).split(b);if(yt.length==4){yt[2]=+yt[2]+ +yt[0],yt[3]=+yt[3]+ +yt[1];var Et=B.clipRect||o._g.doc.createElement("div"),Pt=Et.style;Pt.clip=o.format("rect({1}px {2}px {3}px {0}px)",yt),B.clipRect||(Pt.position="absolute",Pt.top=0,Pt.left=0,Pt.width=D.paper.width+"px",Pt.height=D.paper.height+"px",B.parentNode.insertBefore(Et,B),Et.appendChild(B),B.clipRect=Et)}A["clip-rect"]||B.clipRect&&(B.clipRect.style.clip="auto")}if(D.textpath){var Ft=D.textpath.style;A.font&&(Ft.font=A.font),A["font-family"]&&(Ft.fontFamily='"'+A["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,_)+'"'),A["font-size"]&&(Ft.fontSize=A["font-size"]),A["font-weight"]&&(Ft.fontWeight=A["font-weight"]),A["font-style"]&&(Ft.fontStyle=A["font-style"])}if("arrow-start"in A&&at(X,A["arrow-start"]),"arrow-end"in A&&at(X,A["arrow-end"],1),A.opacity!=null||A.fill!=null||A.src!=null||A.stroke!=null||A["stroke-width"]!=null||A["stroke-opacity"]!=null||A["fill-opacity"]!=null||A["stroke-dasharray"]!=null||A["stroke-miterlimit"]!=null||A["stroke-linejoin"]!=null||A["stroke-linecap"]!=null){var Ct=B.getElementsByTagName("fill");if(!(Ct=Ct&&Ct[0])&&(Ct=Z("fill")),D.type=="image"&&A.src&&(Ct.src=A.src),A.fill&&(Ct.on=!0),Ct.on!=null&&A.fill!="none"&&A.fill!==null||(Ct.on=!1),Ct.on&&A.fill){var Jt=l(A.fill).match(o._ISURL);if(Jt){Ct.parentNode==B&&B.removeChild(Ct),Ct.rotate=!0,Ct.src=Jt[1],Ct.type="tile";var zt=D.getBBox(1);Ct.position=zt.x+E+zt.y,D._.fillpos=[zt.x,zt.y],o._preload(Jt[1],function(){D._.fillsize=[this.offsetWidth,this.offsetHeight]})}else Ct.color=o.getRGB(A.fill).hex,Ct.src=_,Ct.type="solid",o.getRGB(A.fill).error&&(X.type in{circle:1,ellipse:1}||l(A.fill).charAt()!="r")&&_t(X,A.fill,Ct)&&(j.fill="none",j.gradient=A.fill,Ct.rotate=!1)}if("fill-opacity"in A||"opacity"in A){var ce=((+j["fill-opacity"]+1||2)-1)*((+j.opacity+1||2)-1)*((+o.getRGB(A.fill).o+1||2)-1);ce=m(u(ce,0),1),Ct.opacity=ce,Ct.src&&(Ct.color="none")}B.appendChild(Ct);var Xt=B.getElementsByTagName("stroke")&&B.getElementsByTagName("stroke")[0],Ee=!1;!Xt&&(Ee=Xt=Z("stroke")),(A.stroke&&A.stroke!="none"||A["stroke-width"]||A["stroke-opacity"]!=null||A["stroke-dasharray"]||A["stroke-miterlimit"]||A["stroke-linejoin"]||A["stroke-linecap"])&&(Xt.on=!0),(A.stroke=="none"||A.stroke===null||Xt.on==null||A.stroke==0||A["stroke-width"]==0)&&(Xt.on=!1);var ye=o.getRGB(A.stroke);Xt.on&&A.stroke&&(Xt.color=ye.hex),ce=((+j["stroke-opacity"]+1||2)-1)*((+j.opacity+1||2)-1)*((+ye.o+1||2)-1);var li=.75*(c(A["stroke-width"])||1);if(ce=m(u(ce,0),1),A["stroke-width"]==null&&(li=j["stroke-width"]),A["stroke-width"]&&(Xt.weight=li),li&&li<1&&(ce*=li)&&(Xt.weight=1),Xt.opacity=ce,A["stroke-linejoin"]&&(Xt.joinstyle=A["stroke-linejoin"]||"miter"),Xt.miterlimit=A["stroke-miterlimit"]||8,A["stroke-linecap"]&&(Xt.endcap=A["stroke-linecap"]=="butt"?"flat":A["stroke-linecap"]=="square"?"square":"round"),"stroke-dasharray"in A){var on={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};Xt.dashstyle=on[h](A["stroke-dasharray"])?on[A["stroke-dasharray"]]:_}Ee&&B.appendChild(Xt)}if(X.type=="text"){X.paper.canvas.style.display=_;var Qe=X.paper.span,Ri=j.font&&j.font.match(/\d+(?:\.\d*)?(?=px)/);W=Qe.style,j.font&&(W.font=j.font),j["font-family"]&&(W.fontFamily=j["font-family"]),j["font-weight"]&&(W.fontWeight=j["font-weight"]),j["font-style"]&&(W.fontStyle=j["font-style"]),Ri=c(j["font-size"]||Ri&&Ri[0])||10,W.fontSize=100*Ri+"px",X.textpath.string&&(Qe.innerHTML=l(X.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\n/g,"<br>"));var Di=Qe.getBoundingClientRect();X.W=j.w=(Di.right-Di.left)/100,X.H=j.h=(Di.bottom-Di.top)/100,X.X=j.x,X.Y=j.y+X.H/2,("x"in A||"y"in A)&&(X.path.v=o.format("m{0},{1}l{2},{1}",f(j.x*$),f(j.y*$),f(j.x*$)+1));for(var ci=["x","y","text","font","font-family","font-weight","font-style","font-size"],ui=0,dr=ci.length;ui<dr;ui++)if(ci[ui]in A){X._.dirty=1;break}switch(j["text-anchor"]){case"start":X.textpath.style["v-text-align"]="left",X.bbx=X.W/2;break;case"end":X.textpath.style["v-text-align"]="right",X.bbx=-X.W/2;break;default:X.textpath.style["v-text-align"]="center",X.bbx=0}X.textpath.style["v-text-kern"]=!0}},_t=function(D,A,B){D.attrs=D.attrs||{},D.attrs;var j=Math.pow,W="linear",N=".5 .5";if(D.attrs.gradient=A,A=(A=l(A).replace(o._radial_gradient,function(bt,Tt,yt){return W="radial",Tt&&yt&&(Tt=c(Tt),yt=c(yt),j(Tt-.5,2)+j(yt-.5,2)>.25&&(yt=d.sqrt(.25-j(Tt-.5,2))*(2*(yt>.5)-1)+.5),N=Tt+E+yt),_})).split(/\s*\-\s*/),W=="linear"){var Y=A.shift();if(Y=-c(Y),isNaN(Y))return null}var X=o._parseDots(A);if(!X)return null;if(D=D.shape||D.node,X.length){D.removeChild(B),B.on=!0,B.method="none",B.color=X[0].color,B.color2=X[X.length-1].color;for(var et=[],ht=0,mt=X.length;ht<mt;ht++)X[ht].offset&&et.push(X[ht].offset+E+X[ht].color);B.colors=et.length?et.join():"0% "+B.color,W=="radial"?(B.type="gradientTitle",B.focus="100%",B.focussize="0 0",B.focusposition=N,B.angle=0):(B.type="gradient",B.angle=(270-Y)%360),D.appendChild(B)}return 1},pt=function(D,A){this[0]=this.node=D,D.raphael=!0,this.id=o._oid++,D.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=A,this.matrix=o.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!A.bottom&&(A.bottom=this),this.prev=A.top,A.top&&(A.top.next=this),A.top=this,this.next=null},nt=o.el;pt.prototype=nt,nt.constructor=pt,nt.transform=function(D){if(D==null)return this._.transform;var A,B=this.paper._viewBoxShift,j=B?"s"+[B.scale,B.scale]+"-1-1t"+[B.dx,B.dy]:_;B&&(A=D=l(D).replace(/\.{3}|\u2026/g,this._.transform||_)),o._extractTransform(this,j+D);var W,N=this.matrix.clone(),Y=this.skew,X=this.node,et=~l(this.attrs.fill).indexOf("-"),ht=!l(this.attrs.fill).indexOf("url(");if(N.translate(1,1),ht||et||this.type=="image")if(Y.matrix="1 0 0 1",Y.offset="0 0",W=N.split(),et&&W.noRotation||!W.isSimple){X.style.filter=N.toFilter();var mt=this.getBBox(),bt=this.getBBox(1),Tt=mt.x-bt.x,yt=mt.y-bt.y;X.coordorigin=Tt*-$+E+yt*-$,K(this,1,1,Tt,yt,0)}else X.style.filter=_,K(this,W.scalex,W.scaley,W.dx,W.dy,W.rotate);else X.style.filter=_,Y.matrix=l(N),Y.offset=N.offset();return A!==null&&(this._.transform=A,o._extractTransform(this,A)),this},nt.rotate=function(D,A,B){if(this.removed)return this;if(D!=null){if((D=l(D).split(b)).length-1&&(A=c(D[1]),B=c(D[2])),D=c(D[0]),B==null&&(A=B),A==null||B==null){var j=this.getBBox(1);A=j.x+j.width/2,B=j.y+j.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",D,A,B]])),this}},nt.translate=function(D,A){return this.removed?this:((D=l(D).split(b)).length-1&&(A=c(D[1])),D=c(D[0])||0,A=+A||0,this._.bbox&&(this._.bbox.x+=D,this._.bbox.y+=A),this.transform(this._.transform.concat([["t",D,A]])),this)},nt.scale=function(D,A,B,j){if(this.removed)return this;if((D=l(D).split(b)).length-1&&(A=c(D[1]),B=c(D[2]),j=c(D[3]),isNaN(B)&&(B=null),isNaN(j)&&(j=null)),D=c(D[0]),A==null&&(A=D),j==null&&(B=j),B==null||j==null)var W=this.getBBox(1);return B=B??W.x+W.width/2,j=j??W.y+W.height/2,this.transform(this._.transform.concat([["s",D,A,B,j]])),this._.dirtyT=1,this},nt.hide=function(){return!this.removed&&(this.node.style.display="none"),this},nt.show=function(){return!this.removed&&(this.node.style.display=_),this},nt.auxGetBBox=o.el.getBBox,nt.getBBox=function(){var D=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var A={},B=1/this.paper._viewBoxShift.scale;return A.x=D.x-this.paper._viewBoxShift.dx,A.x*=B,A.y=D.y-this.paper._viewBoxShift.dy,A.y*=B,A.width=D.width*B,A.height=D.height*B,A.x2=A.x+A.width,A.y2=A.y+A.height,A}return D},nt._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},nt.remove=function(){if(!this.removed&&this.node.parentNode){for(var D in this.paper.__set__&&this.paper.__set__.exclude(this),o.eve.unbind("raphael.*.*."+this.id),o._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape),this)this[D]=typeof this[D]=="function"?o._removedFactory(D):null;this.removed=!0}},nt.attr=function(D,A){if(this.removed)return this;if(D==null){var B={};for(var j in this.attrs)this.attrs[h](j)&&(B[j]=this.attrs[j]);return B.gradient&&B.fill=="none"&&(B.fill=B.gradient)&&delete B.gradient,B.transform=this._.transform,B}if(A==null&&o.is(D,"string")){if(D=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;for(var W=D.split(b),N={},Y=0,X=W.length;Y<X;Y++)(D=W[Y])in this.attrs?N[D]=this.attrs[D]:o.is(this.paper.customAttributes[D],"function")?N[D]=this.paper.customAttributes[D].def:N[D]=o._availableAttrs[D];return X-1?N:N[W[0]]}if(this.attrs&&A==null&&o.is(D,"array")){for(N={},Y=0,X=D.length;Y<X;Y++)N[D[Y]]=this.attr(D[Y]);return N}var et;for(var ht in A!=null&&((et={})[D]=A),A==null&&o.is(D,"object")&&(et=D),et)S("raphael.attr."+ht+"."+this.id,this,et[ht]);if(et){for(ht in this.paper.customAttributes)if(this.paper.customAttributes[h](ht)&&et[h](ht)&&o.is(this.paper.customAttributes[ht],"function")){var mt=this.paper.customAttributes[ht].apply(this,[].concat(et[ht]));for(var bt in this.attrs[ht]=et[ht],mt)mt[h](bt)&&(et[bt]=mt[bt])}et.text&&this.type=="text"&&(this.textpath.string=et.text),vt(this,et)}return this},nt.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&o._tofront(this,this.paper),this},nt.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),o._toback(this,this.paper)),this)},nt.insertAfter=function(D){return this.removed?this:(D.constructor==o.st.constructor&&(D=D[D.length-1]),D.node.nextSibling?D.node.parentNode.insertBefore(this.node,D.node.nextSibling):D.node.parentNode.appendChild(this.node),o._insertafter(this,D,this.paper),this)},nt.insertBefore=function(D){return this.removed?this:(D.constructor==o.st.constructor&&(D=D[0]),D.node.parentNode.insertBefore(this.node,D.node),o._insertbefore(this,D,this.paper),this)},nt.blur=function(D){var A=this.node.runtimeStyle,B=A.filter;return B=B.replace(R,_),+D!=0?(this.attrs.blur=D,A.filter=B+E+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+D||1.5)+")",A.margin=o.format("-{0}px 0 0 -{0}px",f(+D||1.5))):(A.filter=B,A.margin=0,delete this.attrs.blur),this},o._engine.path=function(D,A){var B=Z("shape");B.style.cssText=L,B.coordsize=$+E+$,B.coordorigin=A.coordorigin;var j=new pt(B,A),W={fill:"none",stroke:"#000"};D&&(W.path=D),j.type="path",j.path=[],j.Path=_,vt(j,W),A.canvas&&A.canvas.appendChild(B);var N=Z("skew");return N.on=!0,B.appendChild(N),j.skew=N,j.transform(_),j},o._engine.rect=function(D,A,B,j,W,N){var Y=o._rectPath(A,B,j,W,N),X=D.path(Y),et=X.attrs;return X.X=et.x=A,X.Y=et.y=B,X.W=et.width=j,X.H=et.height=W,et.r=N,et.path=Y,X.type="rect",X},o._engine.ellipse=function(D,A,B,j,W){var N=D.path();return N.attrs,N.X=A-j,N.Y=B-W,N.W=2*j,N.H=2*W,N.type="ellipse",vt(N,{cx:A,cy:B,rx:j,ry:W}),N},o._engine.circle=function(D,A,B,j){var W=D.path();return W.attrs,W.X=A-j,W.Y=B-j,W.W=W.H=2*j,W.type="circle",vt(W,{cx:A,cy:B,r:j}),W},o._engine.image=function(D,A,B,j,W,N){var Y=o._rectPath(B,j,W,N),X=D.path(Y).attr({stroke:"none"}),et=X.attrs,ht=X.node,mt=ht.getElementsByTagName("fill")[0];return et.src=A,X.X=et.x=B,X.Y=et.y=j,X.W=et.width=W,X.H=et.height=N,et.path=Y,X.type="image",mt.parentNode==ht&&ht.removeChild(mt),mt.rotate=!0,mt.src=A,mt.type="tile",X._.fillpos=[B,j],X._.fillsize=[W,N],ht.appendChild(mt),K(X,1,1,0,0,0),X},o._engine.text=function(D,A,B,j){var W=Z("shape"),N=Z("path"),Y=Z("textpath");A=A||0,B=B||0,j=j||"",N.v=o.format("m{0},{1}l{2},{1}",f(A*$),f(B*$),f(A*$)+1),N.textpathok=!0,Y.string=l(j),Y.on=!0,W.style.cssText=L,W.coordsize=$+E+$,W.coordorigin="0 0";var X=new pt(W,D),et={fill:"#000",stroke:"none",font:o._availableAttrs.font,text:j};X.shape=W,X.path=N,X.textpath=Y,X.type="text",X.attrs.text=l(j),X.attrs.x=A,X.attrs.y=B,X.attrs.w=1,X.attrs.h=1,vt(X,et),W.appendChild(Y),W.appendChild(N),D.canvas.appendChild(W);var ht=Z("skew");return ht.on=!0,W.appendChild(ht),X.skew=ht,X.transform(_),X},o._engine.setSize=function(D,A){var B=this.canvas.style;return this.width=D,this.height=A,D==+D&&(D+="px"),A==+A&&(A+="px"),B.width=D,B.height=A,B.clip="rect(0 "+D+" "+A+" 0)",this._viewBox&&o._engine.setViewBox.apply(this,this._viewBox),this},o._engine.setViewBox=function(D,A,B,j,W){o.eve("raphael.setViewBox",this,this._viewBox,[D,A,B,j,W]);var N,Y,X=this.getSize(),et=X.width,ht=X.height;return W&&(B*(N=ht/j)<et&&(D-=(et-B*N)/2/N),j*(Y=et/B)<ht&&(A-=(ht-j*Y)/2/Y)),this._viewBox=[D,A,B,j,!!W],this._viewBoxShift={dx:-D,dy:-A,scale:X},this.forEach(function(mt){mt.transform("...")}),this},o._engine.initWin=function(D){var A=D.document;A.styleSheets.length<31?A.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):A.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!A.namespaces.rvml&&A.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),Z=function(B){return A.createElement("<rvml:"+B+' class="rvml">')}}catch{Z=function(j){return A.createElement("<"+j+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},o._engine.initWin(o._g.win),o._engine.create=function(){var D=o._getContainer.apply(0,arguments),A=D.container,B=D.height,j=D.width,W=D.x,N=D.y;if(!A)throw new Error("VML container not found.");var Y=new o._Paper,X=Y.canvas=o._g.doc.createElement("div"),et=X.style;return W=W||0,N=N||0,j=j||512,B=B||342,Y.width=j,Y.height=B,j==+j&&(j+="px"),B==+B&&(B+="px"),Y.coordsize=216e5+E+216e5,Y.coordorigin="0 0",Y.span=o._g.doc.createElement("span"),Y.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",X.appendChild(Y.span),et.cssText=o.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",j,B),A==1?(o._g.doc.body.appendChild(X),et.left=W+"px",et.top=N+"px",et.position="absolute"):A.firstChild?A.insertBefore(X,A.firstChild):A.appendChild(X),Y.renderfix=function(){},Y},o.prototype.clear=function(){o.eve("raphael.clear",this),this.canvas.innerHTML=_,this.span=o._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},o.prototype.remove=function(){for(var D in o.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas),this)this[D]=typeof this[D]=="function"?o._removedFactory(D):null;return!0};var J=o.st;for(var I in nt)nt[h](I)&&!J[h](I)&&(J[I]=function(D){return function(){var A=arguments;return this.forEach(function(B){B[D].apply(B,A)})}}(I))}}.apply(i,s))===void 0||(e.exports=a)}])})})(Vc);var rp=Vc.exports;const be=Pe(rp);class Ir{points;constructor(t=[]){this.points=t}toSVGPathData(){const t=[];for(let e=0,i=this.length;e<i;e++)t.push([e===0?"M":"L",this.points[e].x,this.points[e].y]);return t}toSVGPathD(){let t="";for(let e=0,i=this.length;e<i;e++)t+=(e===0?"M":"L")+this.points[e].x+","+this.points[e].y;return t}get length(){return this.points.length}addPoint(t){this.points.push(t)}getPoint(t){return this.points[t]}isContainPoint(t){const e=t.x,i=t.y,r=this.length;let s=!1;const a=2e-10;for(let o=0,h=r-1;o<r;h=o,o++){const l=this.points[o].x,c=this.points[o].y,d=this.points[h].x,f=this.points[h].y;if(l===e&&c===i||d===e&&f===i||i===c&&i===f)return!0;if(i>=c&&i<f||i<c&&i>=f){const u=(d-l)/(f-c),m=l+u*(i-c);if(m===e||Math.abs(m-e)<a)return!0;m>e&&(s=!s)}}return s}[Symbol.iterator](){let t=0;return{next:()=>({value:t>=this.length-1?this.points[++t]:void 0,done:t>=this.length})}}static generateInMultiplePoint(t,e,i,r,s=1){const a=new Ir;for(let o=0;o<=s*i;o+=1){const h=Math.floor(o/s)/i*2*Math.PI,l=t+Math.cos(h)*r,c=e+Math.sin(h)*r;a.addPoint(new Wt({x:l,y:c}))}return a}}be.easing_formulas.swing=function(n){return n+Math.sin(n*Math.PI*2)/2},be.easing_formulas.may_cause_seizures=function(n){return n+.2*Math.random()-.1};function sp(n,t,e){let i;return n&&typeof n=="object"&&n.canvas?i=n:n&&(typeof n=="string"||n instanceof HTMLElement)?i=be(n,t,e):i=be(0,0,t,e),i}be.fn.importSVG=function(n,t){const e=op.fromRawSVG(n);return e.toRaphael(this,(i,r)=>{e.save(),t&&t(i),r(),e.restore()}),this},be.fn.NPolygonPath=function(n,t,e,i,r=2){return{shape:this.path(Ir.generateInMultiplePoint(n,t,e,i,r).toSVGPathD()),afterPath:Ir.generateInMultiplePoint(n,t,e*r,i,1).toSVGPathD()}},be.fn.zoom=function(n=1){return this.setViewBox(0,0,this.width/n,this.height/n),this},be.fn.brickwall=function(n,t,e,i,r){for(var s=i/r,a=e/3,o={fill:"firebrick",stroke:"#CCC"},h=0;h<r;h+=1){var l=this.rect(0,0,a,s).attr(o),c=this.rect(0,0,2*a,s).attr(o);h%2?(l.transform("T"+n+","+(t+h*s)),c.transform("T"+(n+a)+","+(t+h*s))):(c.transform("T"+n+","+(t+h*s)),l.transform("T"+(n+2*a)+","+(t+h*s)))}},be.fn.rosetta=function(n,t,e,i,r){const s=mn.generateRosetta(n,t,e,i,r);return s.center,this.path(s.toSVGPathD())},be.fn.moon=function(n){n=n||{},n.r=typeof n.r=="number"?n.r:100,n.phase=typeof n.phase=="number"?n.phase:.25,n.x=typeof n.x=="number"?n.x:0,n.y=typeof n.y=="number"?n.y:0,this.circle(n.r+n.x,n.r+n.y,n.r).attr({"stroke-width":0,fill:"#999"});function t(i){i=typeof i=="number"?i:.25,i=Math.max(0,Math.min(1,i)),i=(i-.5)*2;let r="M"+n.r+",0";r+="a"+n.r+","+n.r+" 0 0,0 0,"+n.r*2;let s=i>0?0:1;return i=Math.abs(i),i=i||1e-4,n.inner_r=n.r/Math.pow(i,.5),r+="M"+n.r+","+n.r*2,r+="a"+n.inner_r+","+n.inner_r+" 0 0,"+s+" 0,"+n.r*-2,r}var e=this.path(t(n.phase)).attr({"stroke-width":0,stroke:"#999",fill:"#FF9"}).transform("T"+n.x+","+n.y);return{setPhase:function(i){e.attr("path",t(i))}}},be.fn.star=function(n,t,e){let i="M"+n+","+(t-e);for(var r=0;r<6;r+=1){const s=270+r*144,a=n+e*Math.cos(s*Math.PI/180),o=t+e*Math.sin(s*Math.PI/180);i+="L"+a+","+o}return this.path(i).attr("stroke-width",0).attr("fill","red")},be.fn.heart=function(n=150,t=300){let e="M"+n+","+t;return e+="l120,-175a50,50 0 0,0 -120,-75a50,50 0 0,0 -120,75l120,175",this.path(e).attr("stroke","red").attr("fill","pink")},be.el.redder=function(){const n=be.getRGB(this.attr("fill"));n.r+=51,this.attr("fill","rgb("+n.r+","+n.g+","+n.b+")")},be.installCustomAttributes=function(n){n.customAttributes.redness=function(t){const e=255*(1-t/100);return{fill:"rgb(255,"+e+", "+e+")"}},n.customAttributes.progress=function(t){const e=this.data("progresspath"),i=this.attr(),r={x:0,y:0},s=this.data("progresstrail");if(!e)return{transform:"t0,0"};Object.prototype.hasOwnProperty.call(i,"width")&&(r.x=-this.attr("width")/2,r.y=-this.attr("height")/2);const a=e.getTotalLength(),o=e.getPointAtLength(t*a);return s&&s.attr("path",e.getSubpath(0,t*a)),{transform:"t"+(o.x+r.x)+","+(o.y+r.y)+"r"+o.alpha}}};const qo=be;class Vi{pgs=[];history=[];save(){this.history.push(Nl(this.pgs))}restore(){const t=this.history.pop();t&&(this.pgs=t)}get size(){let t=0,e=0;return this.pgs.forEach(i=>{const r=i.pg;if(r){const[s,a,o,h]=r.bounds,[l,c]=r.size;t=Math.max(t,s,s+l,o),e=Math.max(e,a,a+c,h)}}),[Math.ceil(t),Math.ceil(e)]}static fromRawSVG(t){return Vi.fromRawSVGUseRappar(t)}static fromRawSVGUseRappar(t){const e=new Vi,i=kc(t);for(let r=0,s=i.length;r<s;r++){const a=i[r];if(a.type=="viewbox"&&a.width&&a.height)continue;const o={attrs:{}};for(const h in a)h==="type"||h==="path"||h==="transform"||(o.attrs[h]=a[h]);switch(a.type){case"path":o.d=a.path,o.pg=mn.fromSVGPathD(a.path,a.transform);break}e.pgs.push(o)}return e}toRaphael(t,e){let i;t instanceof HTMLElement?i=qo(HTMLElement):typeof t=="string"?i=qo(document.getElementById(t)):i=t;const[r,s]=this.size;i.setSize(r,s);const a=(o=!1)=>{for(let h=0,l=this.pgs.length;h<l;h++){const c=this.pgs[h];if(c.pg&&(c.raphaelPath?c.raphaelPath.attr("path",c.pg.toSVGPathD()):c.raphaelPath=i.path(c.pg.toSVGPathD()),c.raphaelPath.attr(c.attrs)),o&&e){const d=f=>{const{x:u,y:m}=ze(i.canvas,f),v=this.pgs.find(b=>b.raphaelPath?.isPointInside(u,m));v&&e?.(v,a)};c.raphaelPath?.unclick(d),c.raphaelPath?.click(d)}}};return a(!0),i}toCanvasOperation(t,e){let i;typeof t=="string"?i=document.getElementById(t):i=t;const[r,s]=this.size;i.width=r,i.height=s;const a=new Wo(i),o=()=>{a.clearRect(0,0,r,s);for(let l=0,c=this.pgs.length;l<c;l++){const d=this.pgs[l];d.pg&&(a.save(),this.toCanvasAttrs(a,d.attrs),d.pg.toCanvas(a),d.attrs.stroke!=="none"&&a.stroke(),d.attrs.fill!=="none"&&a.fill(),a.restore())}};o();const h=l=>{const{x:c,y:d}=ze(a.canvas,l),f=this.pgs.find(u=>u.pg?.isPointInPath(c,d));f&&e?.(f,o)};return i.removeEventListener("click",h),i.addEventListener("click",h),a}toCanvasAttrs(t,e){for(const i in e){const r=e[i];switch(i){case"fill":t.fillStyle=String(r);break;case"stroke":t.strokeStyle=String(r);break;case"stroke-width":t.lineWidth=Number(r);break;case"stroke-linecap":t.lineCap=r;break;case"stroke-linejoin":t.lineJoin=r;break}}}static toDownloadSVGElement(t,e="shape"){To(tc(t),`${e}.svg`)}toDownloadSVGElement(t,e="shape"){return Vi.toDownloadSVGElement(t,e),this}static toDownloadSVGString(t,e="shape"){To(Co(t),`${e}.svg`)}toDownloadSVGString(t,e="shape"){return Vi.toDownloadSVGString(t,e),this}static getSVGDOM(t){if(t instanceof HTMLObjectElement||t instanceof HTMLIFrameElement)return t.contentDocument;if(t instanceof HTMLEmbedElement)return t.getSVGDocument()}}const op=Vi;class Wo{canvas;context;customContext;constructor(t){this.canvas=t,this.context=t.getContext("2d",{willReadFrequently:!0}),this.customContext=new Mr({canvas:this.canvas,width:this.canvas.width,height:this.canvas.height})}set lineWidth(t){this.context.lineWidth=t,this.customContext.lineWidth=t}get lineWidth(){return this.context.lineWidth}set lineCap(t){this.context.lineCap=t,this.customContext.lineCap=t}get lineCap(){return this.context.lineCap}set lineJoin(t){this.context.lineJoin=t,this.customContext.lineCap=t}get lineJoin(){return this.context.lineJoin}set lineDashOffset(t){this.context.lineDashOffset=t,this.customContext.lineDashOffset=t}get lineDashOffset(){return this.context.lineDashOffset}set miterLimit(t){this.context.miterLimit=t,this.customContext.miterLimit=t}get miterLimit(){return this.context.miterLimit}set globalAlpha(t){this.context.globalAlpha=t,this.customContext.globalAlpha=t}get globalAlpha(){return this.context.globalAlpha}set fillStyle(t){typeof t=="string"||t instanceof CanvasGradient||t instanceof CanvasPattern?(this.context.fillStyle=t,this.customContext.fillStyle=t):(this.context.fillStyle=t.gradient,this.customContext.fillStyle=t.gradientCustom)}get fillStyle(){return this.context.fillStyle}set strokeStyle(t){typeof t=="string"||t instanceof CanvasGradient||t instanceof CanvasPattern?(this.context.strokeStyle=t,this.customContext.strokeStyle=t):(this.context.strokeStyle=t.gradient,this.customContext.strokeStyle=t.gradientCustom)}get strokeStyle(){return this.context.strokeStyle}set font(t){this.context.font=t,this.customContext.font=t}get font(){return this.context.font}fill(){return this.context.fill(),this.customContext.fill(),this}fillRect(t,e,i,r){return this.context.fillRect(t,e,i,r),this.customContext.fillRect(t,e,i,r),this}fillText(t,e,i,r){return this.context.fillText(t,e,i,r),this.customContext.fillText(t,e,i),this}setLineDash(t){return this.context.setLineDash(t),this.customContext.setLineDash(t),this}stroke(){return this.context.stroke(),this.customContext.stroke(),this}strokeText(t,e,i,r){return this.context.strokeText(t,e,i,r),this.customContext.strokeText(t,e,i),this}strokeRect(t,e,i,r){return this.context.strokeRect(t,e,i,r),this.customContext.strokeRect(t,e,i,r),this}clearRect(t=0,e=0,i=this.canvas.width,r=this.canvas.height){return this.context.clearRect(t,e,i,r),this.customContext.clearRect(t,e,i,r),this}save(){return this.context.save(),this.customContext.save(),this}restore(){return this.context.restore(),this.customContext.restore(),this}beginPath(){return this.context.beginPath(),this.customContext.beginPath(),this}closePath(){return this.context.closePath(),this.customContext.closePath(),this}moveTo(t,e){return this.context.moveTo(t,e),this.customContext.moveTo(t,e),this}lineTo(t,e){return this.context.lineTo(t,e),this.customContext.lineTo(t,e),this}arc(t,e,i,r,s,a){return this.context.arc(t,e,i,r,s,a),this.customContext.arc(t,e,i,r,s,a?-1:1),this}arcTo(t,e,i,r,s){return this.context.arcTo(t,e,i,r,s),this.customContext.arcTo(t,e,i,r,s),this}quadraticCurveTo(t,e,i,r){return this.context.quadraticCurveTo(t,e,i,r),this.customContext.quadraticCurveTo(t,e,i,r),this}bezierCurveTo(t,e,i,r,s,a){return this.context.bezierCurveTo(t,e,i,r,s,a),this.customContext.bezierCurveTo(t,e,i,r,s,a),this}rect(t,e,i,r){return this.context.rect(t,e,i,r),this.customContext.rect(t,e,i,r),this}translate(t,e){return this.context.translate(t,e),this.customContext.translate(t,e),this}rotate(t){return this.context.rotate(t),this.customContext.rotate(t),this}scale(t,e){return this.context.scale(t,e),this.customContext.scale(t,e),this}createLinearGradient(t,e,i,r,s){const a=this.context.createLinearGradient(t,e,i,r),o=this.customContext.createLinearGradient(t,e,i,r);return s&&Object.keys(s).forEach(h=>{const l=parseFloat(h);a.addColorStop(l,s[l]),o.addColorStop(l,s[l])}),{gradient:a,gradientCustom:o}}createRadialGradient(t,e,i,r,s,a,o){const h=this.context.createRadialGradient(t,e,i,r,s,a),l=this.customContext.createRadialGradient(t,e,i,r,s,a);return o&&Object.keys(o).forEach(c=>{const d=parseFloat(c);h.addColorStop(d,o[d]),l.addColorStop(d,o[d])}),{gradient:h,gradientCustom:l}}drawImage(t,e=0,i=0){return this.context.drawImage(t,e,i),this.customContext.drawImage(t,e,i),this}getImageData(t,e,i,r,s){return this.context.getImageData(t,e,i,r,s)}putImageData(t,e=0,i=0){return this.context.putImageData(t,e,i)}toRawSVG(){const t=this.customContext.getSerializedSvg(!0),e=this.customContext.getSvg();return{raw:t,element:e}}toSVGOperation(){const{raw:t}=this.toRawSVG();return Vi.fromRawSVG(t)}}(function(){let n=0;window.requestAnimationFrame||(window.requestAnimationFrame=function(t){const e=new Date().getTime(),i=Math.max(0,16-(e-n)),r=window.setTimeout(function(){t(e+i)},i);return n=e+i,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})})();const Ko=n=>{let t=window.requestAnimationFrame(function e(i){t=window.requestAnimationFrame(e),n(i,t)});return()=>window.cancelAnimationFrame(t)};function Hc(n){switch(n){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-in-out":return[.42,0,.58,1];case"ease-out":return[0,0,.58,1]}}const hp={attributeName:["display"],values:[["block","block"]]},Ae={easeName:"linear",begin:0,dur:300,repeatCount:1,direction:"normal",fill:"freeze",keyTimes:[0,1]};class lp{currentAnimateName;objects=[];actions=[];constructor(){}hasObjects(){return this.objects.length>0}fromDOM(t){return Array.isArray(t)||(t=[t]),this.objects=[],t.forEach(e=>{const i=Do(e);this.objects.push({width:parseFloat(i.css("width")),height:parseFloat(i.css("height")),dom:i,el:e,originCSSObject:i.css()})}),this}toCSS(t,...e){if(!this.hasObjects())return;switch(this.currentAnimateName=t,this[t](...e),this.objects[0].dom?.parent().css({position:"relative",perspective:"1000px",overflow:"hidden"}),t){default:this.objects.forEach((s,a)=>{s.dom?.css({position:"absolute","z-index":String(1e3+a),"transform-style":"preserve-3d","backface-visibility":"hidden"})});break}let i=0;const r=()=>{this.actions.forEach((s,a)=>{const o=this.objects[s.objectIndex];let h=[],l=[];Array.isArray(s.attributeName)?(h=s.attributeName,l=s.values):s.attributeName&&(h=[s.attributeName],l=[s.values]);const c=s.keyTimes.length,d=Rr(o.dom?.css("transform")??"");let f=s.begin;s.keyTimes.forEach((u,m)=>{const v={_matrix:d};h.forEach((b,S)=>{const E=l[S][s.direction=="reverse"?c-m-1:m];this._transformAttributeToCSSObjectUseMatrix(b,E,v)}),m==0?o.dom?.css(Object.assign(v,{transition:""})):(setTimeout(()=>{o.dom?.css(Object.assign(v,{transition:`all ${s.realKeyTimes[m]}ms cubic-bezier(${s.keySplines[m-1].join(",")})`}))},f),f+=s.realKeyTimes[m])}),setTimeout(()=>{s.fill==="remove"&&o.dom?.css(o.originCSSObject??{}),a==this.actions.length-1&&(typeof s.repeatCount=="number"&&++i<s.repeatCount||s.repeatCount=="infinite")&&requestAnimationFrame(()=>{this.currentAnimateName===t&&r()})},s.begin+s.dur)})};r()}_transformAttributeToCSSObjectUseMatrix(t,e,i={}){switch(t){case"translateTo":i._matrix.translateTo(e[0]??0,e[1]??0);break;case"translate":i._matrix.translate(e[0]??0,e[1]??0);break;case"rotate":i._matrix.rotate(e??0);break;case"rotateXTo":i._matrix.rotateXTo(e??0);break;case"rotateYTo":i._matrix.rotateYTo(e??0);break;case"scaleTo":typeof e=="number"?i._matrix.scaleTo(e??1):i._matrix.scaleTo(e[0]??1,e[1]??1);break;case"scale":typeof e=="number"?i._matrix.scale(e??1):i._matrix.scale(e[0]??1,e[1]??1);break;case"scaleX":i._matrix.scale(e??1,1);break;case"scaleY":i._matrix.scale(1,e??1);break;default:Object.assign(i,{[t]:`${e??""}`});break}return Object.assign(i,{transform:i._matrix.toString()}),i}_addAction(t,e=!1){return this.actions=e?[]:this.actions,Array.isArray(t)||(t=[t]),t.forEach(i=>{this.actions.push(Object.assign(i,{realKeyTimes:i.keyTimes.map(r=>i.dur*r)}))}),this}_addAnimate(t=hp,e=Ae,i=0,r=!1){const s=e.keyTimes??[0,1],a=[];return s.forEach((o,h)=>{h>0&&a.push(Hc(e.easeName??"linear"))}),this._addAction({objectIndex:i,attributeName:t.attributeName,values:t.values,begin:e.begin??0,dur:e.dur??300,keyTimes:s,keySplines:a,repeatCount:e.repeatCount??1,direction:e.direction??"normal",fill:e.fill??"freeze"},r),this}_predefinedAnimate(t,e,i,r,s=Ae,a=this.objects.length-1){let o=!0,h=!1,l=!1,c=!1;const d=this.objects.length;a=(a+d)%d;const f=(a-1+d)%d,u=(a+1+d)%d,m=this.objects[a],v=this.objects[f],b=this.objects[u];if(v&&f!==a){const S=t(v);S&&(this._addAnimate(S,s,f,o),o=!1,h=!0)}if(m){const S=e(m);S&&(this._addAnimate(S,s,a,o),o=!1,l=!0)}if(b&&u!==a){const S=i(b);S&&(this._addAnimate(S,s,u,o),o=!1,c=!0)}this.objects.forEach((S,E)=>{if(!(E==f&&h||E==a&&l||E==u&&c)){const _=r(S);_&&(this._addAnimate(_,s,E,o),o=!1)}})}flip(t=Ae,e=this.objects.length-1){const i=e-1,r=this.objects[i],s=this.objects[e],a=Rr(s.dom?.css("transform")??""),o=a.clone();r.dom?.show(),r.dom?.css("opacity","1");const h=r.el?.getBoundingClientRect();r.dom?.css("opacity","0"),s.dom?.show(),s.dom?.css("opacity","1");const l=s.el?.getBoundingClientRect(),c=r.dom?.css("background-color"),d=s.dom?.css("background-color");o.translate((h?.left??0)-(l?.left??0),(h?.top??0)-(l?.top??0)),o.scale((h?.width??1)/(l?.width??1),(h?.height??1)/(l?.height??1));const f={transform:o.toString(),transition:""};c&&Object.assign(f,{"background-color":c}),s.dom?.css(f);const u={transform:a.toString(),transition:`all ${t.dur}ms cubic-bezier(${Hc(t.easeName??"linear").join(",")})`};d&&Object.assign(u,{"background-color":d}),setTimeout(()=>{s.dom?.css(u)},t.begin)}slideLeft(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["translateTo"],values:[[[0,0],[-i.width,0]]]}),i=>({attributeName:["opacity","translateTo"],values:[[1,1],[[i.width,0],[0,0]]]}),i=>{},i=>({attributeName:["translateTo"],values:[[[-i.width,0],[-i.width,0]]]}),t,e)}slideRight(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>{},i=>({attributeName:["opacity","translateTo"],values:[[1,1],[[-i.width,0],[0,0]]]}),i=>({attributeName:["translateTo"],values:[[[0,0],[i.width,0]]]}),i=>({attributeName:["translateTo"],values:[[[i.width,0],[i.width,0]]]}),t,e)}slideDown(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["translateTo"],values:[[[0,0],[0,i.height]]]}),i=>({attributeName:["opacity","translateTo"],values:[[1,1],[[0,-i.height],[0,0]]]}),i=>{},i=>({attributeName:["translateTo"],values:[[[0,i.height],[0,i.height]]]}),t,e)}slideUp(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["translateTo"],values:[[[0,0],[0,-i.height]]]}),i=>({attributeName:["opacity","translateTo"],values:[[1,1],[[0,i.height],[0,0]]]}),i=>{},i=>({attributeName:["translateTo"],values:[[[0,-i.height],[0,-i.height]]]}),t,e)}flipLeft(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["opacity","rotateYTo"],values:[[1,1],[0,180]]}),i=>({attributeName:["opacity","rotateYTo"],values:[[1,1],[-180,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}flipRight(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["opacity","rotateYTo"],values:[[1,1],[0,-180]]}),i=>({attributeName:["opacity","rotateYTo"],values:[[1,1],[180,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}flipDown(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["opacity","rotateXTo"],values:[[1,1],[0,-180]]}),i=>({attributeName:["opacity","rotateXTo"],values:[[1,1],[180,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}flipUp(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["opacity","rotateXTo"],values:[[1,1],[0,180]]}),i=>({attributeName:["opacity","rotateXTo"],values:[[1,1],[-180,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}popIn(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>{},i=>({attributeName:["translateTo","scaleTo","opacity"],values:[[[0,0],[0,0]],[.8,1],[0,1]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}popOut(t=Ae,e=this.objects.length-1){this._predefinedAnimate(i=>{},i=>({attributeName:["translateTo","scaleTo","opacity"],values:[[[0,0],[0,0]],[1,1.2],[1,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}rotate(t=Ae,e=this.objects.length-1){Object.assign(t,{keyTimes:[0,1]});const i=t.degree??360;this._predefinedAnimate(r=>{},r=>({attributeName:["opacity","rotate"],values:[[1,1],[0,i]]}),r=>{},r=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}}let Fr;typeof self>"u"&&typeof process<"u"&&process.hrtime?Fr=function(){const n=process.hrtime();return n[0]*1e3+n[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?Fr=self.performance.now.bind(self.performance):Date.now!==void 0?Fr=Date.now:Fr=function(){return new Date().getTime()};const Yn=Fr;class Or{static _nextId=0;static nextId(){return Or._nextId++}}const _a={Linear:{None:function(n){return n}},Ease:{In:function(n){return Math.pow(n,1.7)}},Quadratic:{In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}},Cubic:{In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}},Quartic:{In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}},Quintic:{In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}},Sinusoidal:{In:function(n){return 1-Math.sin((1-n)*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}},Exponential:{In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}},Circular:{In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}},Elastic:{In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}},Back:{In:function(n){return n===1?1:n*n*((1.70158+1)*n-1.70158)},Out:function(n){return n===0?0:--n*n*((1.70158+1)*n+1.70158)+1},InOut:function(n){const t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}},Bounce:{In:function(n){return 1-_a.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?_a.Bounce.In(n*2)*.5:_a.Bounce.Out(n*2-1)*.5+.5}},generatePow:function(n=4){return n=n<Number.EPSILON?Number.EPSILON:n,n=n>1e4?1e4:n,{In:function(t){return t**n},Out:function(t){return 1-(1-t)**n},InOut:function(t){return t<.5?(t*2)**n/2:(1-(2-t*2)**n)/2+.5}}},random:function(n){return Math.random()},createStep:function(n){return function(t){return Math.floor(t*n)/n}},createNoisyEasing:function(n,t=.1){const e=1-t;return function(i){return t*Math.random()+e*n(i)}}},Zo=_a,Nr={Utils:{Linear:function(n,t,e){return(t-n)*e+n},Factorial:function(){const n=[1];return function(t){let e=1;if(n[t])return n[t];for(let i=t;i>1;i--)e*=i;return n[t]=e,e}}(),Bernstein:function(n,t){const e=Nr.Utils.Factorial;return e(n)/e(t)/e(n-t)},CatmullRom:function(n,t,e,i,r){const s=(e-n)*.5,a=(i-t)*.5,o=r*r,h=r*o;return(2*t-2*e+s+a)*h+(-3*t+3*e-2*s-a)*o+s*r+t}},Linear:function(n,t){const e=n.length-1,i=e*t,r=Math.floor(i),s=Nr.Utils.Linear;return t<0?s(n[0],n[1],i):t>1?s(n[e],n[e-1],e-i):s(n[r],n[r+1>e?e:r+1],i-r)},Bezier:function(n,t){let e=0;const i=n.length-1,r=Math.pow,s=Nr.Utils.Bernstein;for(let a=0;a<=i;a++)e+=r(1-t,i-a)*r(t,a)*n[a]*s(i,a);return e},CatmullRom:function(n,t){const e=n.length-1;let i=e*t,r=Math.floor(i);const s=Nr.Utils.CatmullRom;return n[0]===n[e]?(t<0&&(r=Math.floor(i=e*(1+t))),s(n[(r-1+e)%e],n[r],n[(r+1)%e],n[(r+2)%e],i-r)):t<0?n[0]-(s(n[0],n[0],n[1],n[1],-i)-n[0]):t>1?n[e]-(s(n[e],n[e],n[e-1],n[e-1],i-e)-n[e]):s(n[r?r-1:0],n[r],n[e<r+1?e:r+1],n[e<r+2?e:r+2],i-r)}},Jo=Nr;let jc=class{_tweens={};_tweensAddedDuringUpdate={};getAll(){return Object.keys(this._tweens).map(t=>this._tweens[t])}removeAll(){this._tweens={}}add(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t}remove(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]}update(t=Yn(),e=!1){let i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(let r=0;r<i.length;r++){const s=this._tweens[i[r]],a=!e;s&&s.update(t,a)===!1&&!e&&delete this._tweens[i[r]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0}};const Ve=new jc,cp=class{constructor(t,e=Ve){this._object=t,this._group=e}_id=Or.nextId();_isPlaying=!1;_startTime=0;_delayTime=0;_durationTime=1e3;_isPaused=!1;_pauseStartTime=0;_initialRepeat=0;_repeat=0;_repeatDelayTime;_yoyo=!1;_reversed=!1;_valuesStart={};_valuesEnd={};_valuesStartRepeat={};_easingFunction=Zo.Linear.None;_interpolationFunction=Jo.Linear;_chainedTweens=[];_isChainStopped=!1;_onStartCallback;_onStartCallbackFired=!1;_onEveryStartCallback;_onEveryStartCallbackFired=!1;_onUpdateCallback;_onRepeatCallback;_onCompleteCallback;_onStopCallback;_goToEnd=!1;getId(){return this._id}isPlaying(){return this._isPlaying}isPaused(){return this._isPaused}to(t,e){return this._valuesEnd=Object.create(t),e!==void 0&&(this._durationTime=e),this}duration(t=1e3){return this._durationTime=t,this}start(t=Yn()){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(const e in this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this}_setupProperties(t,e,i,r){for(const s in i){const a=t[s],o=Array.isArray(a),h=o?"array":typeof a,l=!o&&Array.isArray(i[s]);if(!(h==="undefined"||h==="function")){if(l){let c=i[s];if(c.length===0)continue;c=c.map(this._handleRelativeValue.bind(this,a)),i[s]=[a].concat(c)}if((h==="object"||o)&&a&&!l){e[s]=o?[]:{};for(const c in a)e[s][c]=a[c];r[s]=o?[]:{},this._setupProperties(a,e[s],i[s],r[s])}else typeof e[s]>"u"&&(e[s]=a),o||(e[s]*=1),l?r[s]=i[s].slice().reverse():r[s]=e[s]||0}}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this}end(){return this._goToEnd=!0,this.update(1/0),this}pause(t=Yn()){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStartTime=t,this._group&&this._group.remove(this),this)}resume(t=Yn()){return!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStartTime,this._pauseStartTime=0,this._group&&this._group.add(this),this)}stopChainedTweens(){for(let t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this}group(t=Ve){return this._group=t,this}delay(t=0){return this._delayTime=t,this}repeat(t=0){return this._initialRepeat=t,this._repeat=t,this}repeatDelay(t){return this._repeatDelayTime=t,this}yoyo(t=!1){return this._yoyo=t,this}easing(t=Zo.Linear.None){return this._easingFunction=t,this}interpolation(t=Jo.Linear){return this._interpolationFunction=t,this}chain(...t){return this._chainedTweens=t,this}onStart(t){return this._onStartCallback=t,this}onEveryStart(t){return this._onEveryStartCallback=t,this}onUpdate(t){return this._onUpdateCallback=t,this}onRepeat(t){return this._onRepeatCallback=t,this}onComplete(t){return this._onCompleteCallback=t,this}onStop(t){return this._onStopCallback=t,this}update(t=Yn(),e=!0){if(this._isPaused)return!0;let i,r;const s=this._startTime+this._durationTime;if(!this._goToEnd&&!this._isPlaying){if(t>s)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),r=(t-this._startTime)/this._durationTime,r=this._durationTime===0||r>1?1:r;const a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(let o=0,h=this._chainedTweens.length;o<h;o++)this._chainedTweens[o].start(this._startTime+this._durationTime);return this._isPlaying=!1,!1}return!0}_updateProperties(t,e,i,r){for(const s in i){if(e[s]===void 0)continue;const a=e[s]||0;let o=i[s];const h=Array.isArray(t[s]),l=Array.isArray(o);!h&&l?t[s]=this._interpolationFunction(o,r):typeof o=="object"&&o?this._updateProperties(t[s],a,o,r):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(t[s]=a+(o-a)*r))}}_handleRelativeValue(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)}_swapEndStartRepeatValues(t){const e=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=i,this._valuesEnd[t]=e}},up=Or.nextId,fp=Ve.getAll.bind(Ve),dp=Ve.removeAll.bind(Ve),gp=Ve.add.bind(Ve),pp=Ve.remove.bind(Ve),mp=Ve.update.bind(Ve),vp={now:Yn,Sequence:Or,Easing:Zo,Interpolation:Jo,Group:jc,Tween:cp,nextId:up,getAll:fp,removeAll:dp,add:gp,remove:pp,update:mp};class _p extends Zl{container;ctx;config;mouse;keyboard;resizeObserver;installedPlugins=new Map;animateFrameID;constructor(t,e={}){super(),this.container=t,this.ctx=new Wo(this.container),this.config=Gl(e,Ag),t instanceof HTMLCanvasElement&&(this.config.width=t.width,this.config.height=t.height),this.resizeObserver=new ResizeObserver(i=>{const{width:r,height:s}=i[0].contentRect;this.emit("resizeRoot",r,s)}),this.resizeObserver.observe(this.container),this.mouse=new Dg(this),this.keyboard=new Lg(this)}renderFrame(t){Ko((e,i)=>{this.animateFrameID=i,t(this)})}destroyFrame(){typeof this.animateFrameID<"u"&&window.cancelAnimationFrame(this.animateFrameID)}destroy(){this.removeAllListeners(),this.destroyPlugin(Array.from(this.installedPlugins.keys())),this.resizeObserver.disconnect(),this.mouse?.destroy(),this.keyboard?.destroy(),this.destroyFrame()}drawMouseMoveLine(t={}){switch(t.type){case"brush":t.typeOptions=t.typeOptions||{brush_size:10,brush_density:50,brush_color:"#000000"};const e=this.ctx.getImageData(0,0,this.config.width,this.config.height),i=e.data,r=ya(t.typeOptions.brush_color);let s=!1;this.on("mouseDown",()=>{s=!0}),this.on("mouseUp",()=>{s=!1}),this.on("mouseMove",()=>{if(s){for(let a=0;a<t.typeOptions.brush_density;a++){const o=Math.random()*Math.PI*2,h=Math.random()*t.typeOptions.brush_size,l=this.mouse.point.x+Math.cos(o)*h|0,c=this.mouse.point.y+Math.sin(o)*h|0,d=(l+c*e.width)*4;i[d]=r>>16&255,i[d+1]=r>>8&255,i[d+2]=r&255,i[d+3]=255}this.ctx.putImageData(e)}});break;case"line":default:this.on("mouseDown",()=>{this.ctx.beginPath(),this.ctx.moveTo(this.mouse.point.x,this.mouse.point.y)}),this.on("mouseMove",()=>{this.ctx.lineTo(this.mouse.point.x,this.mouse.point.y),t.extra?.(this),this.ctx.stroke()}),this.on("mouseUp",()=>{this.ctx.closePath()})}}use(t,...e){return this.installedPlugins.has(t.name)||(this.installedPlugins.set(t.name,t),t.install(this,...e)),this}getPlugin(t){return this.installedPlugins.get(t)}getPlugins(t){return t.map(e=>this.getPlugin(e))}enablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.enable?.()),this}disablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.disable?.()),this}destroyPlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.destroy()),this}isPluginEnable(t){return this.getPlugin(t)?.isEnabled?.()??!1}}const yp={safeAreaTop:It.getCSSVar("--safe-area-inset-top"),safeAreaRight:It.getCSSVar("--safe-area-inset-right"),safeAreaBottom:It.getCSSVar("--safe-area-inset-bottom"),safeAreaLeft:It.getCSSVar("--safe-area-inset-left"),colorPrimary:It.getCSSVar("--color-primary"),colorRed:It.getCSSVar("--color-red"),colorOrange:It.getCSSVar("--color-orange"),colorYellow:It.getCSSVar("--color-yellow"),colorGreen:It.getCSSVar("--color-green"),colorBlue:It.getCSSVar("--color-blue"),colorPurple:It.getCSSVar("--color-purple"),colorBlack:It.getCSSVar("--color-black"),colorGray0:It.getCSSVar("--color-gray-0"),colorGray3:It.getCSSVar("--color-gray-3"),colorGray6:It.getCSSVar("--color-gray-6"),colorGray9:It.getCSSVar("--color-gray-9"),colorGrayCC:It.getCSSVar("--color-gray-cc"),colorGrayDD:It.getCSSVar("--color-gray-dd"),colorGrayE6:It.getCSSVar("--color-gray-e6"),colorGrayEE:It.getCSSVar("--color-gray-ee"),colorGrayEF:It.getCSSVar("--color-gray-ef"),colorGrayF5:It.getCSSVar("--color-gray-f5"),colorGrayFF:It.getCSSVar("--color-gray-ff"),fontLineHeight:It.getCSSVar("--font-line-height"),fontSize32:It.getCSSVar("--font-size-32"),fontSize24:It.getCSSVar("--font-size-24"),fontSize20:It.getCSSVar("--font-size-20"),fontSize18:It.getCSSVar("--font-size-18"),fontSize16:It.getCSSVar("--font-size-16"),fontSize14:It.getCSSVar("--font-size-14"),fontSize12:It.getCSSVar("--font-size-12"),fontSize11:It.getCSSVar("--font-size-11"),gap4:It.getCSSVar("--gap-4"),gap8:It.getCSSVar("--gap-8"),gap12:It.getCSSVar("--gap-12"),gap16:It.getCSSVar("--gap-16"),gap20:It.getCSSVar("--gap-20"),gap40:It.getCSSVar("--gap-40"),height44:It.getCSSVar("--height-44"),height32:It.getCSSVar("--height-32"),borderRadius:It.getCSSVar("--border-radius")},wp=()=>Math.random()*16777215,bp=()=>`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`,xp=()=>`#${(~~(Math.random()*(1<<24))).toString(16)}`,ya=function(n){return n[0]==="#"&&(n=n.slice(1)),parseInt(n,16)},Xc=function(n){let t="00000"+(n|0).toString(16);return t="#"+t.substring(t.length-6),t},Yc=function(n,t=1){const e=n>>16&255,i=n>>8&255,r=n&255,s=t<0?0:t>1?1:t;return s===1?"rgb("+e+","+i+","+r+")":"rgba("+e+","+i+","+r+","+s+")"},Qo=function(n,t=1){const e=ya(n);return Yc(e,t)},Sp=n=>{const e=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(n);return e?"#"+((1<<24)+(parseInt(e[1])<<16)+(parseInt(e[2])<<8)+parseInt(e[3])).toString(16).slice(1):""};function Cp(n,t){let e=parseInt(n.substring(1,3),16),i=parseInt(n.substring(3,5),16),r=parseInt(n.substring(5,7),16);e==0&&(e=32),i==0&&(i=32),r==0&&(r=32),e=e*(100+t)/100,i=i*(100+t)/100,r=r*(100+t)/100,e=e<255?e:255,i=i<255?i:255,r=r<255?r:255,e=Math.round(e),i=Math.round(i),r=Math.round(r);const s=e.toString(16).length==1?"0"+e.toString(16):e.toString(16),a=i.toString(16).length==1?"0"+i.toString(16):i.toString(16),o=r.toString(16).length==1?"0"+r.toString(16):r.toString(16);return"#"+s+a+o}function Tp(n,t,e,i){let r,s,a;n=n/360,t=t/100,e=e/100;const o=Math.floor(n*6),h=n*6-o,l=e*(1-t),c=e*(1-h*t),d=e*(1-(1-h)*t);switch(o%6){case 0:r=e,s=d,a=l;break;case 1:r=c,s=e,a=l;break;case 2:r=l,s=e,a=d;break;case 3:r=l,s=c,a=e;break;case 4:r=d,s=l,a=e;break;case 5:default:r=e,s=l,a=c;break}return{r:Math.round(r*255),g:Math.round(s*255),b:Math.round(a*255),a:i??1}}function kp(n,t,e,i){const r=Math.max(n,t,e),s=Math.min(n,t,e),a=r-s,o=r===0?0:a/r,h=r/255;let l;switch(r){case s:l=0;break;case n:l=t-e+a*(t<e?6:0),l/=6*a;break;case t:l=e-n+a*2,l/=6*a;break;case e:default:l=n-t+a*4,l/=6*a;break}return{h:Math.round(l*360),s:Math.round(o*100),v:Math.round(h*100),a:i??1}}function Ep(n){return btoa(encodeURIComponent(n)).replaceAll("+","*").replaceAll("/","-").replaceAll("=","")}function Pp(n){let t=n.replaceAll("*","+").replaceAll("-","/");const e=t.length%4;return e&&(t=t.padEnd(t.length+(4-e),"=")),decodeURIComponent(atob(t))}function th(n=window.location.href){return na(URL)?new URL(n):qc(n)}function qc(n=window.location.href){const t="(?<protocol>https?:)",e="(?<host>(?<hostname>[^/#?:]+)(?::(?<port>\\d+))?)",i="(?<pathname>(?:\\/[^/#?]+)*\\/?)",r="(?<search>(?:\\?[^#]*)?)",s="(?<hash>(?:#.*)?)",o=new RegExp(`^${t}//${e}${i}${r}${s}$`).exec(n);return{href:n,protocol:o?.groups?.protocol??"",host:o?.groups?.host??"",hostname:o?.groups?.hostname??"",port:o?.groups?.port??"",pathname:o?.groups?.pathname??"",search:o?.groups?.search??"",hash:o?.groups?.hash??""}}function Ap(n){const t=th(n);return t.protocol==="http:"||t.protocol==="https:"}function Wc(n=window.location.href){const t=th(n),e=t.href.indexOf(t.hash);return t.hash&&e>=0?t.href.substring(0,e):t.href}function Mp(n=location.search){n=decodeURIComponent(n).replace(/^[#?&]/,"");const t={};if(!n)return t;const e=/(?:^|&)([^&=]*)=?([^&]*?)(?=&|$)/y;let i=e.exec(n);for(;i;)t[i[1]]=i[2],i=e.exec(n);return t}function Rp(n){return Array.from(new URLSearchParams(n)).reduce((t,[e,i])=>Object.assign({},t,{[e]:t[e]?(Array.isArray(t[e])?t[e]:[t[e]]).concat(i):i}),{})}function Kc(n){let t="";for(const e in n)t&&(t+="&"),t+=`${e}=${n[e]}`;return t}function Dp(n){return new URLSearchParams(n).toString()}function eh(n){return"?"+[...n.entries()].map(t=>encodeURIComponent(t[0])+"="+encodeURIComponent(t[1]instanceof File?t[1].name:t[1])).join("&")}function wa(n,t){return n.indexOf("?")>=0?n+t.replace(/^\?/,"&"):n.replace(/(?:\?.*)?$/,t.replace(/^[&?]/,"?"))}function Lp(n){let t="";new MutationObserver(function(i){window.location.href!==t&&(t=window.location.href,n&&n(location.href))}).observe(document,{attributes:!0,childList:!0,subtree:!0})}function Ip(n){window.addEventListener("hashchange",()=>{n(location.hash)})}function Fp(n){window.addEventListener("popstate",n,!1)}function Op(n){let t=null;if(pc)try{t=new Worker(URL.createObjectURL(new Blob([n])))}catch(e){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",e),null}return t}var Zc={exports:{}};(function(n){var t={};n.exports=t,t.parse=function(e,i){for(var r=t.bin.readUshort,s=t.bin.readUint,l=0,a={},o=new Uint8Array(e),h=o.length-4;s(o,h)!=101010256;)h--;var l=h;l+=4,l+=4;var c=r(o,l);l+=2,r(o,l),l+=2;var d=s(o,l);l+=4;var f=s(o,l);l+=4,l=f;for(var u=0;u<c;u++){s(o,l),l+=4,l+=4,l+=4,l+=4,s(o,l),l+=4;var d=s(o,l);l+=4;var m=s(o,l);l+=4;var v=r(o,l),b=r(o,l+2),S=r(o,l+4);l+=6,l+=8;var E=s(o,l);l+=4,l+=v+b+S,t._readLocal(o,E,a,d,m,i)}return a},t._readLocal=function(e,i,r,s,a,o){var h=t.bin.readUshort,l=t.bin.readUint;l(e,i),i+=4,h(e,i),i+=2,h(e,i),i+=2;var c=h(e,i);i+=2,l(e,i),i+=4,l(e,i),i+=4,i+=8;var d=h(e,i);i+=2;var f=h(e,i);i+=2;var u=t.bin.readUTF8(e,i,d);if(i+=d,i+=f,o){r[u]={size:a,csize:s};return}var m=new Uint8Array(e.buffer,i);if(c==0)r[u]=new Uint8Array(m.buffer.slice(i,i+s));else if(c==8){var v=new Uint8Array(a);t.inflateRaw(m,v),r[u]=v}else throw"unknown compression method: "+c},t.inflateRaw=function(e,i){return t.F.inflate(e,i)},t.inflate=function(e,i){return e[0],e[1],t.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),i)},t.deflate=function(e,i){i==null&&(i={level:6});var r=0,s=new Uint8Array(50+Math.floor(e.length*1.1));s[r]=120,s[r+1]=156,r+=2,r=t.F.deflateRaw(e,s,r,i.level);var a=t.adler(e,0,e.length);return s[r+0]=a>>>24&255,s[r+1]=a>>>16&255,s[r+2]=a>>>8&255,s[r+3]=a>>>0&255,new Uint8Array(s.buffer,0,r+4)},t.deflateRaw=function(e,i){i==null&&(i={level:6});var r=new Uint8Array(50+Math.floor(e.length*1.1)),s=t.F.deflateRaw(e,r,s,i.level);return new Uint8Array(r.buffer,0,s)},t.encode=function(e,i){i==null&&(i=!1);var r=0,s=t.bin.writeUint,a=t.bin.writeUshort,o={};for(var h in e){var l=!t._noNeed(h)&&!i,c=e[h],d=t.crc.crc(c,0,c.length);o[h]={cpr:l,usize:c.length,crc:d,file:l?t.deflateRaw(c):c}}for(var h in o)r+=o[h].file.length+30+46+2*t.bin.sizeUTF8(h);r+=22;var f=new Uint8Array(r),u=0,m=[];for(var h in o){var v=o[h];m.push(u),u=t._writeHeader(f,u,h,v,0)}var b=0,S=u;for(var h in o){var v=o[h];m.push(u),u=t._writeHeader(f,u,h,v,1,m[b++])}var E=u-S;return s(f,u,101010256),u+=4,u+=4,a(f,u,b),u+=2,a(f,u,b),u+=2,s(f,u,E),u+=4,s(f,u,S),u+=4,u+=2,f.buffer},t._noNeed=function(e){var i=e.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(i)!=-1},t._writeHeader=function(e,i,r,s,a,o){var h=t.bin.writeUint,l=t.bin.writeUshort,c=s.file;h(e,i,a==0?67324752:33639248),i+=4,a==1&&(i+=2),l(e,i,20),i+=2,l(e,i,0),i+=2,l(e,i,s.cpr?8:0),i+=2,h(e,i,0),i+=4,h(e,i,s.crc),i+=4,h(e,i,c.length),i+=4,h(e,i,s.usize),i+=4,l(e,i,t.bin.sizeUTF8(r)),i+=2,l(e,i,0),i+=2,a==1&&(i+=2,i+=2,i+=6,h(e,i,o),i+=4);var d=t.bin.writeUTF8(e,i,r);return i+=d,a==0&&(e.set(c,i),i+=c.length),i},t.crc={table:function(){for(var e=new Uint32Array(256),i=0;i<256;i++){for(var r=i,s=0;s<8;s++)r&1?r=3988292384^r>>>1:r=r>>>1;e[i]=r}return e}(),update:function(e,i,r,s){for(var a=0;a<s;a++)e=t.crc.table[(e^i[r+a])&255]^e>>>8;return e},crc:function(e,i,r){return t.crc.update(4294967295,e,i,r)^4294967295}},t.adler=function(e,i,r){for(var s=1,a=0,o=i,h=i+r;o<h;){for(var l=Math.min(o+5552,h);o<l;)s+=e[o++],a+=s;s=s%65521,a=a%65521}return a<<16|s},t.bin={readUshort:function(e,i){return e[i]|e[i+1]<<8},writeUshort:function(e,i,r){e[i]=r&255,e[i+1]=r>>8&255},readUint:function(e,i){return e[i+3]*(256*256*256)+(e[i+2]<<16|e[i+1]<<8|e[i])},writeUint:function(e,i,r){e[i]=r&255,e[i+1]=r>>8&255,e[i+2]=r>>16&255,e[i+3]=r>>24&255},readASCII:function(e,i,r){for(var s="",a=0;a<r;a++)s+=String.fromCharCode(e[i+a]);return s},writeASCII:function(e,i,r){for(var s=0;s<r.length;s++)e[i+s]=r.charCodeAt(s)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,i,r){for(var s="",a,o=0;o<r;o++)s+="%"+t.bin.pad(e[i+o].toString(16));try{a=decodeURIComponent(s)}catch{return t.bin.readASCII(e,i,r)}return a},writeUTF8:function(e,i,r){for(var s=r.length,a=0,o=0;o<s;o++){var h=r.charCodeAt(o);if(!(h&4294967295-128+1))e[i+a]=h,a++;else if(!(h&4294967295-2048+1))e[i+a]=192|h>>6,e[i+a+1]=128|h>>0&63,a+=2;else if(!(h&4294967295-65536+1))e[i+a]=224|h>>12,e[i+a+1]=128|h>>6&63,e[i+a+2]=128|h>>0&63,a+=3;else if(!(h&4294967295-(1<<21)+1))e[i+a]=240|h>>18,e[i+a+1]=128|h>>12&63,e[i+a+2]=128|h>>6&63,e[i+a+3]=128|h>>0&63,a+=4;else throw"e"}return a},sizeUTF8:function(e){for(var i=e.length,r=0,s=0;s<i;s++){var a=e.charCodeAt(s);if(!(a&4294967295-128+1))r++;else if(!(a&4294967295-2048+1))r+=2;else if(!(a&4294967295-65536+1))r+=3;else if(!(a&4294967295-(1<<21)+1))r+=4;else throw"e"}return r}},t.F={},t.F.deflateRaw=function(e,i,r,s){var a=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]],o=a[s],h=t.F.U,l=t.F._goodIndex;t.F._hash;var c=t.F._putsE,d=0,f=r<<3,u=0,m=e.length;if(s==0){for(;d<m;){var v=Math.min(65535,m-d);c(i,f,d+v==m?1:0),f=t.F._copyExact(e,d,v,i,f+8),d+=v}return f>>>3}var b=h.lits,S=h.strt,E=h.prev,_=0,x=0,P=0,R=0,O=0,L=0;for(m>2&&(L=t.F._hash(e,0),S[L]=0),d=0;d<m;d++){if(O=L,d+1<m-2){L=t.F._hash(e,d+1);var $=d+1&32767;E[$]=S[L],S[L]=$}if(u<=d){(_>14e3||x>26697)&&m-d>100&&(u<d&&(b[_]=d-u,_+=2,u=d),f=t.F._writeBlock(d==m-1||u==m?1:0,b,_,R,e,P,d-P,i,f),_=x=R=0,P=d);var U=0;d<m-2&&(U=t.F._bestMatch(e,d,E,O,Math.min(o[2],m-d),o[3]));var v=U>>>16,z=U&65535;if(U!=0){var v=U>>>16,z=U&65535,q=l(v,h.of0);h.lhst[257+q]++;var K=l(z,h.df0);h.dhst[K]++,R+=h.exb[q]+h.dxb[K],b[_]=v<<23|d-u,b[_+1]=z<<16|q<<8|K,_+=2,u=d+v}else h.lhst[e[d]]++;x++}}for((P!=d||e.length==0)&&(u<d&&(b[_]=d-u,_+=2,u=d),f=t.F._writeBlock(1,b,_,R,e,P,d-P,i,f),_=0,x=0,_=x=R=0,P=d);f&7;)f++;return f>>>3},t.F._bestMatch=function(e,i,r,s,a,o){var h=i&32767,l=r[h],c=h-l+32768&32767;if(l==h||s!=t.F._hash(e,i-c))return 0;for(var d=0,f=0,u=Math.min(32767,i);c<=u&&--o!=0&&l!=h;){if(d==0||e[i+d]==e[i+d-c]){var m=t.F._howLong(e,i,c);if(m>d){if(d=m,f=c,d>=a)break;c+2<m&&(m=c+2);for(var v=0,b=0;b<m-2;b++){var S=i-c+b+32768&32767,E=r[S],_=S-E+32768&32767;_>v&&(v=_,l=S)}}}h=l,l=r[h],c+=h-l+32768&32767}return d<<16|f},t.F._howLong=function(e,i,r){if(e[i]!=e[i-r]||e[i+1]!=e[i+1-r]||e[i+2]!=e[i+2-r])return 0;var s=i,a=Math.min(e.length,i+258);for(i+=3;i<a&&e[i]==e[i-r];)i++;return i-s},t.F._hash=function(e,i){return(e[i]<<8|e[i+1])+(e[i+2]<<4)&65535},t.saved=0,t.F._writeBlock=function(e,i,r,s,a,o,h,l,c){var d=t.F.U,f=t.F._putsF,u=t.F._putsE,m,v,b,S,E,_,x,P,R;d.lhst[256]++,m=t.F.getTrees(),v=m[0],b=m[1],S=m[2],E=m[3],_=m[4],x=m[5],P=m[6],R=m[7];var O=(c+3&7?8-(c+3&7):0)+32+(h<<3),L=s+t.F.contSize(d.fltree,d.lhst)+t.F.contSize(d.fdtree,d.dhst),$=s+t.F.contSize(d.ltree,d.lhst)+t.F.contSize(d.dtree,d.dhst);$+=14+3*x+t.F.contSize(d.itree,d.ihst)+(d.ihst[16]*2+d.ihst[17]*3+d.ihst[18]*7);for(var U=0;U<286;U++)d.lhst[U]=0;for(var U=0;U<30;U++)d.dhst[U]=0;for(var U=0;U<19;U++)d.ihst[U]=0;var z=O<L&&O<$?0:L<$?1:2;if(f(l,c,e),f(l,c+1,z),c+=3,z==0){for(;c&7;)c++;c=t.F._copyExact(a,o,h,l,c)}else{var q,K;if(z==1&&(q=d.fltree,K=d.fdtree),z==2){t.F.makeCodes(d.ltree,v),t.F.revCodes(d.ltree,v),t.F.makeCodes(d.dtree,b),t.F.revCodes(d.dtree,b),t.F.makeCodes(d.itree,S),t.F.revCodes(d.itree,S),q=d.ltree,K=d.dtree,u(l,c,E-257),c+=5,u(l,c,_-1),c+=5,u(l,c,x-4),c+=4;for(var Z=0;Z<x;Z++)u(l,c+Z*3,d.itree[(d.ordr[Z]<<1)+1]);c+=3*x,c=t.F._codeTiny(P,d.itree,l,c),c=t.F._codeTiny(R,d.itree,l,c)}for(var at=o,vt=0;vt<r;vt+=2){for(var _t=i[vt],pt=_t>>>23,nt=at+(_t&(1<<23)-1);at<nt;)c=t.F._writeLit(a[at++],q,l,c);if(pt!=0){var J=i[vt+1],I=J>>16,D=J>>8&255,A=J&255;c=t.F._writeLit(257+D,q,l,c),u(l,c,pt-d.of0[D]),c+=d.exb[D],c=t.F._writeLit(A,K,l,c),f(l,c,I-d.df0[A]),c+=d.dxb[A],at+=pt}}c=t.F._writeLit(256,q,l,c)}return c},t.F._copyExact=function(e,i,r,s,a){var o=a>>>3;return s[o]=r,s[o+1]=r>>>8,s[o+2]=255-s[o],s[o+3]=255-s[o+1],o+=4,s.set(new Uint8Array(e.buffer,i,r),o),a+(r+4<<3)},t.F.getTrees=function(){for(var e=t.F.U,i=t.F._hufTree(e.lhst,e.ltree,15),r=t.F._hufTree(e.dhst,e.dtree,15),s=[],a=t.F._lenCodes(e.ltree,s),o=[],h=t.F._lenCodes(e.dtree,o),l=0;l<s.length;l+=2)e.ihst[s[l]]++;for(var l=0;l<o.length;l+=2)e.ihst[o[l]]++;for(var c=t.F._hufTree(e.ihst,e.itree,7),d=19;d>4&&e.itree[(e.ordr[d-1]<<1)+1]==0;)d--;return[i,r,c,a,h,d,s,o]},t.F.getSecond=function(e){for(var i=[],r=0;r<e.length;r+=2)i.push(e[r+1]);return i},t.F.nonZero=function(e){for(var i="",r=0;r<e.length;r+=2)e[r+1]!=0&&(i+=(r>>1)+",");return i},t.F.contSize=function(e,i){for(var r=0,s=0;s<i.length;s++)r+=i[s]*e[(s<<1)+1];return r},t.F._codeTiny=function(e,i,r,s){for(var a=0;a<e.length;a+=2){var o=e[a],h=e[a+1];s=t.F._writeLit(o,i,r,s);var l=o==16?2:o==17?3:7;o>15&&(t.F._putsE(r,s,h,l),s+=l)}return s},t.F._lenCodes=function(e,i){for(var r=e.length;r!=2&&e[r-1]==0;)r-=2;for(var s=0;s<r;s+=2){var a=e[s+1],o=s+3<r?e[s+3]:-1,h=s+5<r?e[s+5]:-1,l=s==0?-1:e[s-1];if(a==0&&o==a&&h==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,138);d<11?i.push(17,d-3):i.push(18,d-11),s+=d*2-2}else if(a==l&&o==a&&h==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,6);i.push(16,d-3),s+=d*2-2}else i.push(a,0)}return r>>>1},t.F._hufTree=function(e,i,r){var s=[],a=e.length,o=i.length,h=0;for(h=0;h<o;h+=2)i[h]=0,i[h+1]=0;for(h=0;h<a;h++)e[h]!=0&&s.push({lit:h,f:e[h]});var l=s.length,c=s.slice(0);if(l==0)return 0;if(l==1){var d=s[0].lit,c=d==0?1:0;return i[(d<<1)+1]=1,i[(c<<1)+1]=1,1}s.sort(function(E,_){return E.f-_.f});var f=s[0],u=s[1],m=0,v=1,b=2;for(s[0]={lit:-1,f:f.f+u.f,l:f,r:u,d:0};v!=l-1;)m!=v&&(b==l||s[m].f<s[b].f)?f=s[m++]:f=s[b++],m!=v&&(b==l||s[m].f<s[b].f)?u=s[m++]:u=s[b++],s[v++]={lit:-1,f:f.f+u.f,l:f,r:u};var S=t.F.setDepth(s[v-1],0);for(S>r&&(t.F.restrictDepth(c,r,S),S=r),h=0;h<l;h++)i[(c[h].lit<<1)+1]=c[h].d;return S},t.F.setDepth=function(e,i){return e.lit!=-1?(e.d=i,i):Math.max(t.F.setDepth(e.l,i+1),t.F.setDepth(e.r,i+1))},t.F.restrictDepth=function(e,i,r){var s=0,a=1<<r-i,o=0;for(e.sort(function(l,c){return c.d==l.d?l.f-c.f:c.d-l.d}),s=0;s<e.length&&e[s].d>i;s++){var h=e[s].d;e[s].d=i,o+=a-(1<<r-h)}for(o=o>>>r-i;o>0;){var h=e[s].d;h<i?(e[s].d++,o-=1<<i-h-1):s++}for(;s>=0;s--)e[s].d==i&&o<0&&(e[s].d--,o++);o!=0&&console.log("debt left")},t.F._goodIndex=function(e,i){var r=0;return i[r|16]<=e&&(r|=16),i[r|8]<=e&&(r|=8),i[r|4]<=e&&(r|=4),i[r|2]<=e&&(r|=2),i[r|1]<=e&&(r|=1),r},t.F._writeLit=function(e,i,r,s){return t.F._putsF(r,s,i[e<<1]),s+i[(e<<1)+1]},t.F.inflate=function(e,i){var r=Uint8Array;if(e[0]==3&&e[1]==0)return i||new r(0);var s=t.F,a=s._bitsF,o=s._bitsE,h=s._decodeTiny,l=s.makeCodes,c=s.codes2map,d=s._get17,f=s.U,u=i==null;u&&(i=new r(e.length>>>2<<3));for(var m=0,v=0,b=0,S=0,E=0,_=0,x=0,P=0,R=0,O,L;m==0;){if(m=a(e,R,1),v=a(e,R+1,2),R+=3,v==0){R&7&&(R+=8-(R&7));var $=(R>>>3)+4,U=e[$-4]|e[$-3]<<8;u&&(i=t.F._check(i,P+U)),i.set(new r(e.buffer,e.byteOffset+$,U),P),R=$+U<<3,P+=U;continue}if(u&&(i=t.F._check(i,P+(1<<17))),v==1&&(O=f.flmap,L=f.fdmap,_=512-1,x=32-1),v==2){b=o(e,R,5)+257,S=o(e,R+5,5)+1,E=o(e,R+10,4)+4,R+=14;for(var z=0;z<38;z+=2)f.itree[z]=0,f.itree[z+1]=0;for(var q=1,z=0;z<E;z++){var K=o(e,R+z*3,3);f.itree[(f.ordr[z]<<1)+1]=K,K>q&&(q=K)}R+=3*E,l(f.itree,q),c(f.itree,q,f.imap),O=f.lmap,L=f.dmap,R=h(f.imap,(1<<q)-1,b+S,e,R,f.ttree);var Z=s._copyOut(f.ttree,0,b,f.ltree);_=(1<<Z)-1;var at=s._copyOut(f.ttree,b,S,f.dtree);x=(1<<at)-1,l(f.ltree,Z),c(f.ltree,Z,O),l(f.dtree,at),c(f.dtree,at,L)}for(;;){var vt=O[d(e,R)&_];R+=vt&15;var _t=vt>>>4;if(!(_t>>>8))i[P++]=_t;else{if(_t==256)break;var pt=P+_t-254;if(_t>264){var nt=f.ldef[_t-257];pt=P+(nt>>>3)+o(e,R,nt&7),R+=nt&7}var J=L[d(e,R)&x];R+=J&15;var I=J>>>4,D=f.ddef[I],A=(D>>>4)+a(e,R,D&15);for(R+=D&15,u&&(i=t.F._check(i,P+(1<<17)));P<pt;)i[P]=i[P++-A],i[P]=i[P++-A],i[P]=i[P++-A],i[P]=i[P++-A];P=pt}}}return i.length==P?i:i.slice(0,P)},t.F._check=function(e,i){var r=e.length;if(i<=r)return e;var s=new Uint8Array(Math.max(r<<1,i));return s.set(e,0),s},t.F._decodeTiny=function(e,i,r,s,a,o){for(var h=t.F._bitsE,l=t.F._get17,c=0;c<r;){var d=e[l(s,a)&i];a+=d&15;var f=d>>>4;if(f<=15)o[c]=f,c++;else{var u=0,m=0;f==16?(m=3+h(s,a,2),a+=2,u=o[c-1]):f==17?(m=3+h(s,a,3),a+=3):f==18&&(m=11+h(s,a,7),a+=7);for(var v=c+m;c<v;)o[c]=u,c++}}return a},t.F._copyOut=function(e,i,r,s){for(var a=0,o=0,h=s.length>>>1;o<r;){var l=e[o+i];s[o<<1]=0,s[(o<<1)+1]=l,l>a&&(a=l),o++}for(;o<h;)s[o<<1]=0,s[(o<<1)+1]=0,o++;return a},t.F.makeCodes=function(e,i){for(var r=t.F.U,s=e.length,a,o,h,l,c,d=r.bl_count,l=0;l<=i;l++)d[l]=0;for(l=1;l<s;l+=2)d[e[l]]++;var f=r.next_code;for(a=0,d[0]=0,o=1;o<=i;o++)a=a+d[o-1]<<1,f[o]=a;for(h=0;h<s;h+=2)c=e[h+1],c!=0&&(e[h]=f[c],f[c]++)},t.F.codes2map=function(e,i,r){for(var s=e.length,a=t.F.U,o=a.rev15,h=0;h<s;h+=2)if(e[h+1]!=0)for(var l=h>>1,c=e[h+1],d=l<<4|c,f=i-c,u=e[h]<<f,m=u+(1<<f);u!=m;){var v=o[u]>>>15-i;r[v]=d,u++}},t.F.revCodes=function(e,i){for(var r=t.F.U.rev15,s=15-i,a=0;a<e.length;a+=2){var o=e[a]<<i-e[a+1];e[a]=r[o]>>>s}},t.F._putsE=function(e,i,r){r=r<<(i&7);var s=i>>>3;e[s]|=r,e[s+1]|=r>>>8},t.F._putsF=function(e,i,r){r=r<<(i&7);var s=i>>>3;e[s]|=r,e[s+1]|=r>>>8,e[s+2]|=r>>>16},t.F._bitsE=function(e,i,r){return(e[i>>>3]|e[(i>>>3)+1]<<8)>>>(i&7)&(1<<r)-1},t.F._bitsF=function(e,i,r){return(e[i>>>3]|e[(i>>>3)+1]<<8|e[(i>>>3)+2]<<16)>>>(i&7)&(1<<r)-1},t.F._get17=function(e,i){return(e[i>>>3]|e[(i>>>3)+1]<<8|e[(i>>>3)+2]<<16)>>>(i&7)},t.F._get25=function(e,i){return(e[i>>>3]|e[(i>>>3)+1]<<8|e[(i>>>3)+2]<<16|e[(i>>>3)+3]<<24)>>>(i&7)},t.F.U=function(){var e=Uint16Array,i=Uint32Array;return{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new i(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new i(286),dhst:new i(30),ihst:new i(19),lits:new i(15e3),strt:new e(65536),prev:new e(32768)}}(),function(){for(var e=t.F.U,i=32768,r=0;r<i;r++){var s=r;s=(s&2863311530)>>>1|(s&1431655765)<<1,s=(s&3435973836)>>>2|(s&858993459)<<2,s=(s&4042322160)>>>4|(s&252645135)<<4,s=(s&4278255360)>>>8|(s&16711935)<<8,e.rev15[r]=(s>>>16|s<<16)>>>17}function a(o,h,l){for(;h--!=0;)o.push(0,l)}for(var r=0;r<32;r++)e.ldef[r]=e.of0[r]<<3|e.exb[r],e.ddef[r]=e.df0[r]<<4|e.dxb[r];a(e.fltree,144,8),a(e.fltree,255-143,9),a(e.fltree,279-255,7),a(e.fltree,287-279,8),t.F.makeCodes(e.fltree,9),t.F.codes2map(e.fltree,9,e.flmap),t.F.revCodes(e.fltree,9),a(e.fdtree,32,5),t.F.makeCodes(e.fdtree,5),t.F.codes2map(e.fdtree,5,e.fdmap),t.F.revCodes(e.fdtree,5),a(e.itree,19,0),a(e.ltree,286,0),a(e.dtree,30,0),a(e.ttree,320,0)}()})(Zc);var Np=Zc.exports;const Jc=Pe(Np);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Gp=4,Qc=0,tu=1,Up=2;function qn(n){let t=n.length;for(;--t>=0;)n[t]=0}const Bp=0,eu=1,zp=2,$p=3,Vp=258,ih=29,Gr=256,Ur=Gr+1+ih,Wn=30,nh=19,iu=2*Ur+1,vn=15,rh=16,Hp=7,sh=256,nu=16,ru=17,su=18,ah=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ba=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),jp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),au=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xp=512,_i=new Array((Ur+2)*2);qn(_i);const Br=new Array(Wn*2);qn(Br);const zr=new Array(Xp);qn(zr);const $r=new Array(Vp-$p+1);qn($r);const oh=new Array(ih);qn(oh);const xa=new Array(Wn);qn(xa);function hh(n,t,e,i,r){this.static_tree=n,this.extra_bits=t,this.extra_base=e,this.elems=i,this.max_length=r,this.has_stree=n&&n.length}let ou,hu,lu;function lh(n,t){this.dyn_tree=n,this.max_code=0,this.stat_desc=t}const cu=n=>n<256?zr[n]:zr[256+(n>>>7)],Vr=(n,t)=>{n.pending_buf[n.pending++]=t&255,n.pending_buf[n.pending++]=t>>>8&255},Me=(n,t,e)=>{n.bi_valid>rh-e?(n.bi_buf|=t<<n.bi_valid&65535,Vr(n,n.bi_buf),n.bi_buf=t>>rh-n.bi_valid,n.bi_valid+=e-rh):(n.bi_buf|=t<<n.bi_valid&65535,n.bi_valid+=e)},ii=(n,t,e)=>{Me(n,e[t*2],e[t*2+1])},uu=(n,t)=>{let e=0;do e|=n&1,n>>>=1,e<<=1;while(--t>0);return e>>>1},Yp=n=>{n.bi_valid===16?(Vr(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=n.bi_buf&255,n.bi_buf>>=8,n.bi_valid-=8)},qp=(n,t)=>{const e=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,h=t.stat_desc.max_length;let l,c,d,f,u,m,v=0;for(f=0;f<=vn;f++)n.bl_count[f]=0;for(e[n.heap[n.heap_max]*2+1]=0,l=n.heap_max+1;l<iu;l++)c=n.heap[l],f=e[e[c*2+1]*2+1]+1,f>h&&(f=h,v++),e[c*2+1]=f,!(c>i)&&(n.bl_count[f]++,u=0,c>=o&&(u=a[c-o]),m=e[c*2],n.opt_len+=m*(f+u),s&&(n.static_len+=m*(r[c*2+1]+u)));if(v!==0){do{for(f=h-1;n.bl_count[f]===0;)f--;n.bl_count[f]--,n.bl_count[f+1]+=2,n.bl_count[h]--,v-=2}while(v>0);for(f=h;f!==0;f--)for(c=n.bl_count[f];c!==0;)d=n.heap[--l],!(d>i)&&(e[d*2+1]!==f&&(n.opt_len+=(f-e[d*2+1])*e[d*2],e[d*2+1]=f),c--)}},fu=(n,t,e)=>{const i=new Array(vn+1);let r=0,s,a;for(s=1;s<=vn;s++)r=r+e[s-1]<<1,i[s]=r;for(a=0;a<=t;a++){let o=n[a*2+1];o!==0&&(n[a*2]=uu(i[o]++,o))}},Wp=()=>{let n,t,e,i,r;const s=new Array(vn+1);for(e=0,i=0;i<ih-1;i++)for(oh[i]=e,n=0;n<1<<ah[i];n++)$r[e++]=i;for($r[e-1]=i,r=0,i=0;i<16;i++)for(xa[i]=r,n=0;n<1<<ba[i];n++)zr[r++]=i;for(r>>=7;i<Wn;i++)for(xa[i]=r<<7,n=0;n<1<<ba[i]-7;n++)zr[256+r++]=i;for(t=0;t<=vn;t++)s[t]=0;for(n=0;n<=143;)_i[n*2+1]=8,n++,s[8]++;for(;n<=255;)_i[n*2+1]=9,n++,s[9]++;for(;n<=279;)_i[n*2+1]=7,n++,s[7]++;for(;n<=287;)_i[n*2+1]=8,n++,s[8]++;for(fu(_i,Ur+1,s),n=0;n<Wn;n++)Br[n*2+1]=5,Br[n*2]=uu(n,5);ou=new hh(_i,ah,Gr+1,Ur,vn),hu=new hh(Br,ba,0,Wn,vn),lu=new hh(new Array(0),jp,0,nh,Hp)},du=n=>{let t;for(t=0;t<Ur;t++)n.dyn_ltree[t*2]=0;for(t=0;t<Wn;t++)n.dyn_dtree[t*2]=0;for(t=0;t<nh;t++)n.bl_tree[t*2]=0;n.dyn_ltree[sh*2]=1,n.opt_len=n.static_len=0,n.sym_next=n.matches=0},gu=n=>{n.bi_valid>8?Vr(n,n.bi_buf):n.bi_valid>0&&(n.pending_buf[n.pending++]=n.bi_buf),n.bi_buf=0,n.bi_valid=0},pu=(n,t,e,i)=>{const r=t*2,s=e*2;return n[r]<n[s]||n[r]===n[s]&&i[t]<=i[e]},ch=(n,t,e)=>{const i=n.heap[e];let r=e<<1;for(;r<=n.heap_len&&(r<n.heap_len&&pu(t,n.heap[r+1],n.heap[r],n.depth)&&r++,!pu(t,i,n.heap[r],n.depth));)n.heap[e]=n.heap[r],e=r,r<<=1;n.heap[e]=i},mu=(n,t,e)=>{let i,r,s=0,a,o;if(n.sym_next!==0)do i=n.pending_buf[n.sym_buf+s++]&255,i+=(n.pending_buf[n.sym_buf+s++]&255)<<8,r=n.pending_buf[n.sym_buf+s++],i===0?ii(n,r,t):(a=$r[r],ii(n,a+Gr+1,t),o=ah[a],o!==0&&(r-=oh[a],Me(n,r,o)),i--,a=cu(i),ii(n,a,e),o=ba[a],o!==0&&(i-=xa[a],Me(n,i,o)));while(s<n.sym_next);ii(n,sh,t)},uh=(n,t)=>{const e=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,h=-1,l;for(n.heap_len=0,n.heap_max=iu,a=0;a<s;a++)e[a*2]!==0?(n.heap[++n.heap_len]=h=a,n.depth[a]=0):e[a*2+1]=0;for(;n.heap_len<2;)l=n.heap[++n.heap_len]=h<2?++h:0,e[l*2]=1,n.depth[l]=0,n.opt_len--,r&&(n.static_len-=i[l*2+1]);for(t.max_code=h,a=n.heap_len>>1;a>=1;a--)ch(n,e,a);l=s;do a=n.heap[1],n.heap[1]=n.heap[n.heap_len--],ch(n,e,1),o=n.heap[1],n.heap[--n.heap_max]=a,n.heap[--n.heap_max]=o,e[l*2]=e[a*2]+e[o*2],n.depth[l]=(n.depth[a]>=n.depth[o]?n.depth[a]:n.depth[o])+1,e[a*2+1]=e[o*2+1]=l,n.heap[1]=l++,ch(n,e,1);while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],qp(n,t),fu(e,h,n.bl_count)},vu=(n,t,e)=>{let i,r=-1,s,a=t[0*2+1],o=0,h=7,l=4;for(a===0&&(h=138,l=3),t[(e+1)*2+1]=65535,i=0;i<=e;i++)s=a,a=t[(i+1)*2+1],!(++o<h&&s===a)&&(o<l?n.bl_tree[s*2]+=o:s!==0?(s!==r&&n.bl_tree[s*2]++,n.bl_tree[nu*2]++):o<=10?n.bl_tree[ru*2]++:n.bl_tree[su*2]++,o=0,r=s,a===0?(h=138,l=3):s===a?(h=6,l=3):(h=7,l=4))},_u=(n,t,e)=>{let i,r=-1,s,a=t[0*2+1],o=0,h=7,l=4;for(a===0&&(h=138,l=3),i=0;i<=e;i++)if(s=a,a=t[(i+1)*2+1],!(++o<h&&s===a)){if(o<l)do ii(n,s,n.bl_tree);while(--o!==0);else s!==0?(s!==r&&(ii(n,s,n.bl_tree),o--),ii(n,nu,n.bl_tree),Me(n,o-3,2)):o<=10?(ii(n,ru,n.bl_tree),Me(n,o-3,3)):(ii(n,su,n.bl_tree),Me(n,o-11,7));o=0,r=s,a===0?(h=138,l=3):s===a?(h=6,l=3):(h=7,l=4)}},Kp=n=>{let t;for(vu(n,n.dyn_ltree,n.l_desc.max_code),vu(n,n.dyn_dtree,n.d_desc.max_code),uh(n,n.bl_desc),t=nh-1;t>=3&&n.bl_tree[au[t]*2+1]===0;t--);return n.opt_len+=3*(t+1)+5+5+4,t},Zp=(n,t,e,i)=>{let r;for(Me(n,t-257,5),Me(n,e-1,5),Me(n,i-4,4),r=0;r<i;r++)Me(n,n.bl_tree[au[r]*2+1],3);_u(n,n.dyn_ltree,t-1),_u(n,n.dyn_dtree,e-1)},Jp=n=>{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&n.dyn_ltree[e*2]!==0)return Qc;if(n.dyn_ltree[9*2]!==0||n.dyn_ltree[10*2]!==0||n.dyn_ltree[13*2]!==0)return tu;for(e=32;e<Gr;e++)if(n.dyn_ltree[e*2]!==0)return tu;return Qc};let yu=!1;const Qp=n=>{yu||(Wp(),yu=!0),n.l_desc=new lh(n.dyn_ltree,ou),n.d_desc=new lh(n.dyn_dtree,hu),n.bl_desc=new lh(n.bl_tree,lu),n.bi_buf=0,n.bi_valid=0,du(n)},wu=(n,t,e,i)=>{Me(n,(Bp<<1)+(i?1:0),3),gu(n),Vr(n,e),Vr(n,~e),e&&n.pending_buf.set(n.window.subarray(t,t+e),n.pending),n.pending+=e},t2=n=>{Me(n,eu<<1,3),ii(n,sh,_i),Yp(n)},e2=(n,t,e,i)=>{let r,s,a=0;n.level>0?(n.strm.data_type===Up&&(n.strm.data_type=Jp(n)),uh(n,n.l_desc),uh(n,n.d_desc),a=Kp(n),r=n.opt_len+3+7>>>3,s=n.static_len+3+7>>>3,s<=r&&(r=s)):r=s=e+5,e+4<=r&&t!==-1?wu(n,t,e,i):n.strategy===Gp||s===r?(Me(n,(eu<<1)+(i?1:0),3),mu(n,_i,Br)):(Me(n,(zp<<1)+(i?1:0),3),Zp(n,n.l_desc.max_code+1,n.d_desc.max_code+1,a+1),mu(n,n.dyn_ltree,n.dyn_dtree)),du(n),i&&gu(n)},i2=(n,t,e)=>(n.pending_buf[n.sym_buf+n.sym_next++]=t,n.pending_buf[n.sym_buf+n.sym_next++]=t>>8,n.pending_buf[n.sym_buf+n.sym_next++]=e,t===0?n.dyn_ltree[e*2]++:(n.matches++,t--,n.dyn_ltree[($r[e]+Gr+1)*2]++,n.dyn_dtree[cu(t)*2]++),n.sym_next===n.sym_end);var n2=Qp,r2=wu,s2=e2,a2=i2,o2=t2,h2={_tr_init:n2,_tr_stored_block:r2,_tr_flush_block:s2,_tr_tally:a2,_tr_align:o2},Hr=(n,t,e,i)=>{let r=n&65535|0,s=n>>>16&65535|0,a=0;for(;e!==0;){a=e>2e3?2e3:e,e-=a;do r=r+t[i++]|0,s=s+r|0;while(--a);r%=65521,s%=65521}return r|s<<16|0};const l2=()=>{let n,t=[];for(var e=0;e<256;e++){n=e;for(var i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;t[e]=n}return t},c2=new Uint32Array(l2());var ge=(n,t,e,i)=>{const r=c2,s=i+e;n^=-1;for(let a=i;a<s;a++)n=n>>>8^r[(n^t[a])&255];return n^-1},_n={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},yn={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:u2,_tr_stored_block:fh,_tr_flush_block:f2,_tr_tally:Hi,_tr_align:d2}=h2,{Z_NO_FLUSH:ji,Z_PARTIAL_FLUSH:g2,Z_FULL_FLUSH:p2,Z_FINISH:He,Z_BLOCK:bu,Z_OK:_e,Z_STREAM_END:xu,Z_STREAM_ERROR:ni,Z_DATA_ERROR:m2,Z_BUF_ERROR:dh,Z_DEFAULT_COMPRESSION:v2,Z_FILTERED:_2,Z_HUFFMAN_ONLY:Sa,Z_RLE:y2,Z_FIXED:w2,Z_DEFAULT_STRATEGY:b2,Z_UNKNOWN:x2,Z_DEFLATED:Ca}=yn,S2=9,C2=15,T2=8,k2=29,gh=256+1+k2,E2=30,P2=19,A2=2*gh+1,M2=15,Bt=3,Xi=258,ri=Xi+Bt+1,R2=32,Kn=42,ph=57,mh=69,vh=73,_h=91,yh=103,wn=113,jr=666,ke=1,Zn=2,bn=3,Jn=4,D2=3,xn=(n,t)=>(n.msg=_n[t],t),Su=n=>n*2-(n>4?9:0),Yi=n=>{let t=n.length;for(;--t>=0;)n[t]=0},L2=n=>{let t,e,i,r=n.w_size;t=n.hash_size,i=t;do e=n.head[--i],n.head[i]=e>=r?e-r:0;while(--t);t=r,i=t;do e=n.prev[--i],n.prev[i]=e>=r?e-r:0;while(--t)};let qi=(n,t,e)=>(t<<n.hash_shift^e)&n.hash_mask;const Fe=n=>{const t=n.state;let e=t.pending;e>n.avail_out&&(e=n.avail_out),e!==0&&(n.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),n.next_out),n.next_out+=e,t.pending_out+=e,n.total_out+=e,n.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Oe=(n,t)=>{f2(n,n.block_start>=0?n.block_start:-1,n.strstart-n.block_start,t),n.block_start=n.strstart,Fe(n.strm)},jt=(n,t)=>{n.pending_buf[n.pending++]=t},Xr=(n,t)=>{n.pending_buf[n.pending++]=t>>>8&255,n.pending_buf[n.pending++]=t&255},wh=(n,t,e,i)=>{let r=n.avail_in;return r>i&&(r=i),r===0?0:(n.avail_in-=r,t.set(n.input.subarray(n.next_in,n.next_in+r),e),n.state.wrap===1?n.adler=Hr(n.adler,t,r,e):n.state.wrap===2&&(n.adler=ge(n.adler,t,r,e)),n.next_in+=r,n.total_in+=r,r)},Cu=(n,t)=>{let e=n.max_chain_length,i=n.strstart,r,s,a=n.prev_length,o=n.nice_match;const h=n.strstart>n.w_size-ri?n.strstart-(n.w_size-ri):0,l=n.window,c=n.w_mask,d=n.prev,f=n.strstart+Xi;let u=l[i+a-1],m=l[i+a];n.prev_length>=n.good_match&&(e>>=2),o>n.lookahead&&(o=n.lookahead);do if(r=t,!(l[r+a]!==m||l[r+a-1]!==u||l[r]!==l[i]||l[++r]!==l[i+1])){i+=2,r++;do;while(l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&l[++i]===l[++r]&&i<f);if(s=Xi-(f-i),i=f-Xi,s>a){if(n.match_start=t,a=s,s>=o)break;u=l[i+a-1],m=l[i+a]}}while((t=d[t&c])>h&&--e!==0);return a<=n.lookahead?a:n.lookahead},Qn=n=>{const t=n.w_size;let e,i,r;do{if(i=n.window_size-n.lookahead-n.strstart,n.strstart>=t+(t-ri)&&(n.window.set(n.window.subarray(t,t+t-i),0),n.match_start-=t,n.strstart-=t,n.block_start-=t,n.insert>n.strstart&&(n.insert=n.strstart),L2(n),i+=t),n.strm.avail_in===0)break;if(e=wh(n.strm,n.window,n.strstart+n.lookahead,i),n.lookahead+=e,n.lookahead+n.insert>=Bt)for(r=n.strstart-n.insert,n.ins_h=n.window[r],n.ins_h=qi(n,n.ins_h,n.window[r+1]);n.insert&&(n.ins_h=qi(n,n.ins_h,n.window[r+Bt-1]),n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,n.insert--,!(n.lookahead+n.insert<Bt)););}while(n.lookahead<ri&&n.strm.avail_in!==0)},Tu=(n,t)=>{let e=n.pending_buf_size-5>n.w_size?n.w_size:n.pending_buf_size-5,i,r,s,a=0,o=n.strm.avail_in;do{if(i=65535,s=n.bi_valid+42>>3,n.strm.avail_out<s||(s=n.strm.avail_out-s,r=n.strstart-n.block_start,i>r+n.strm.avail_in&&(i=r+n.strm.avail_in),i>s&&(i=s),i<e&&(i===0&&t!==He||t===ji||i!==r+n.strm.avail_in)))break;a=t===He&&i===r+n.strm.avail_in?1:0,fh(n,0,0,a),n.pending_buf[n.pending-4]=i,n.pending_buf[n.pending-3]=i>>8,n.pending_buf[n.pending-2]=~i,n.pending_buf[n.pending-1]=~i>>8,Fe(n.strm),r&&(r>i&&(r=i),n.strm.output.set(n.window.subarray(n.block_start,n.block_start+r),n.strm.next_out),n.strm.next_out+=r,n.strm.avail_out-=r,n.strm.total_out+=r,n.block_start+=r,i-=r),i&&(wh(n.strm,n.strm.output,n.strm.next_out,i),n.strm.next_out+=i,n.strm.avail_out-=i,n.strm.total_out+=i)}while(a===0);return o-=n.strm.avail_in,o&&(o>=n.w_size?(n.matches=2,n.window.set(n.strm.input.subarray(n.strm.next_in-n.w_size,n.strm.next_in),0),n.strstart=n.w_size,n.insert=n.strstart):(n.window_size-n.strstart<=o&&(n.strstart-=n.w_size,n.window.set(n.window.subarray(n.w_size,n.w_size+n.strstart),0),n.matches<2&&n.matches++,n.insert>n.strstart&&(n.insert=n.strstart)),n.window.set(n.strm.input.subarray(n.strm.next_in-o,n.strm.next_in),n.strstart),n.strstart+=o,n.insert+=o>n.w_size-n.insert?n.w_size-n.insert:o),n.block_start=n.strstart),n.high_water<n.strstart&&(n.high_water=n.strstart),a?Jn:t!==ji&&t!==He&&n.strm.avail_in===0&&n.strstart===n.block_start?Zn:(s=n.window_size-n.strstart,n.strm.avail_in>s&&n.block_start>=n.w_size&&(n.block_start-=n.w_size,n.strstart-=n.w_size,n.window.set(n.window.subarray(n.w_size,n.w_size+n.strstart),0),n.matches<2&&n.matches++,s+=n.w_size,n.insert>n.strstart&&(n.insert=n.strstart)),s>n.strm.avail_in&&(s=n.strm.avail_in),s&&(wh(n.strm,n.window,n.strstart,s),n.strstart+=s,n.insert+=s>n.w_size-n.insert?n.w_size-n.insert:s),n.high_water<n.strstart&&(n.high_water=n.strstart),s=n.bi_valid+42>>3,s=n.pending_buf_size-s>65535?65535:n.pending_buf_size-s,e=s>n.w_size?n.w_size:s,r=n.strstart-n.block_start,(r>=e||(r||t===He)&&t!==ji&&n.strm.avail_in===0&&r<=s)&&(i=r>s?s:r,a=t===He&&n.strm.avail_in===0&&i===r?1:0,fh(n,n.block_start,i,a),n.block_start+=i,Fe(n.strm)),a?bn:ke)},bh=(n,t)=>{let e,i;for(;;){if(n.lookahead<ri){if(Qn(n),n.lookahead<ri&&t===ji)return ke;if(n.lookahead===0)break}if(e=0,n.lookahead>=Bt&&(n.ins_h=qi(n,n.ins_h,n.window[n.strstart+Bt-1]),e=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),e!==0&&n.strstart-e<=n.w_size-ri&&(n.match_length=Cu(n,e)),n.match_length>=Bt)if(i=Hi(n,n.strstart-n.match_start,n.match_length-Bt),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=Bt){n.match_length--;do n.strstart++,n.ins_h=qi(n,n.ins_h,n.window[n.strstart+Bt-1]),e=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart;while(--n.match_length!==0);n.strstart++}else n.strstart+=n.match_length,n.match_length=0,n.ins_h=n.window[n.strstart],n.ins_h=qi(n,n.ins_h,n.window[n.strstart+1]);else i=Hi(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++;if(i&&(Oe(n,!1),n.strm.avail_out===0))return ke}return n.insert=n.strstart<Bt-1?n.strstart:Bt-1,t===He?(Oe(n,!0),n.strm.avail_out===0?bn:Jn):n.sym_next&&(Oe(n,!1),n.strm.avail_out===0)?ke:Zn},tr=(n,t)=>{let e,i,r;for(;;){if(n.lookahead<ri){if(Qn(n),n.lookahead<ri&&t===ji)return ke;if(n.lookahead===0)break}if(e=0,n.lookahead>=Bt&&(n.ins_h=qi(n,n.ins_h,n.window[n.strstart+Bt-1]),e=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),n.prev_length=n.match_length,n.prev_match=n.match_start,n.match_length=Bt-1,e!==0&&n.prev_length<n.max_lazy_match&&n.strstart-e<=n.w_size-ri&&(n.match_length=Cu(n,e),n.match_length<=5&&(n.strategy===_2||n.match_length===Bt&&n.strstart-n.match_start>4096)&&(n.match_length=Bt-1)),n.prev_length>=Bt&&n.match_length<=n.prev_length){r=n.strstart+n.lookahead-Bt,i=Hi(n,n.strstart-1-n.prev_match,n.prev_length-Bt),n.lookahead-=n.prev_length-1,n.prev_length-=2;do++n.strstart<=r&&(n.ins_h=qi(n,n.ins_h,n.window[n.strstart+Bt-1]),e=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart);while(--n.prev_length!==0);if(n.match_available=0,n.match_length=Bt-1,n.strstart++,i&&(Oe(n,!1),n.strm.avail_out===0))return ke}else if(n.match_available){if(i=Hi(n,0,n.window[n.strstart-1]),i&&Oe(n,!1),n.strstart++,n.lookahead--,n.strm.avail_out===0)return ke}else n.match_available=1,n.strstart++,n.lookahead--}return n.match_available&&(i=Hi(n,0,n.window[n.strstart-1]),n.match_available=0),n.insert=n.strstart<Bt-1?n.strstart:Bt-1,t===He?(Oe(n,!0),n.strm.avail_out===0?bn:Jn):n.sym_next&&(Oe(n,!1),n.strm.avail_out===0)?ke:Zn},I2=(n,t)=>{let e,i,r,s;const a=n.window;for(;;){if(n.lookahead<=Xi){if(Qn(n),n.lookahead<=Xi&&t===ji)return ke;if(n.lookahead===0)break}if(n.match_length=0,n.lookahead>=Bt&&n.strstart>0&&(r=n.strstart-1,i=a[r],i===a[++r]&&i===a[++r]&&i===a[++r])){s=n.strstart+Xi;do;while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<s);n.match_length=Xi-(s-r),n.match_length>n.lookahead&&(n.match_length=n.lookahead)}if(n.match_length>=Bt?(e=Hi(n,1,n.match_length-Bt),n.lookahead-=n.match_length,n.strstart+=n.match_length,n.match_length=0):(e=Hi(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++),e&&(Oe(n,!1),n.strm.avail_out===0))return ke}return n.insert=0,t===He?(Oe(n,!0),n.strm.avail_out===0?bn:Jn):n.sym_next&&(Oe(n,!1),n.strm.avail_out===0)?ke:Zn},F2=(n,t)=>{let e;for(;;){if(n.lookahead===0&&(Qn(n),n.lookahead===0)){if(t===ji)return ke;break}if(n.match_length=0,e=Hi(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++,e&&(Oe(n,!1),n.strm.avail_out===0))return ke}return n.insert=0,t===He?(Oe(n,!0),n.strm.avail_out===0?bn:Jn):n.sym_next&&(Oe(n,!1),n.strm.avail_out===0)?ke:Zn};function si(n,t,e,i,r){this.good_length=n,this.max_lazy=t,this.nice_length=e,this.max_chain=i,this.func=r}const Yr=[new si(0,0,0,0,Tu),new si(4,4,8,4,bh),new si(4,5,16,8,bh),new si(4,6,32,32,bh),new si(4,4,16,16,tr),new si(8,16,32,32,tr),new si(8,16,128,128,tr),new si(8,32,128,256,tr),new si(32,128,258,1024,tr),new si(32,258,258,4096,tr)],O2=n=>{n.window_size=2*n.w_size,Yi(n.head),n.max_lazy_match=Yr[n.level].max_lazy,n.good_match=Yr[n.level].good_length,n.nice_match=Yr[n.level].nice_length,n.max_chain_length=Yr[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=Bt-1,n.match_available=0,n.ins_h=0};function N2(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ca,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(A2*2),this.dyn_dtree=new Uint16Array((2*E2+1)*2),this.bl_tree=new Uint16Array((2*P2+1)*2),Yi(this.dyn_ltree),Yi(this.dyn_dtree),Yi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(M2+1),this.heap=new Uint16Array(2*gh+1),Yi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*gh+1),Yi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const qr=n=>{if(!n)return 1;const t=n.state;return!t||t.strm!==n||t.status!==Kn&&t.status!==ph&&t.status!==mh&&t.status!==vh&&t.status!==_h&&t.status!==yh&&t.status!==wn&&t.status!==jr?1:0},ku=n=>{if(qr(n))return xn(n,ni);n.total_in=n.total_out=0,n.data_type=x2;const t=n.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?ph:t.wrap?Kn:wn,n.adler=t.wrap===2?0:1,t.last_flush=-2,u2(t),_e},Eu=n=>{const t=ku(n);return t===_e&&O2(n.state),t},G2=(n,t)=>qr(n)||n.state.wrap!==2?ni:(n.state.gzhead=t,_e),Pu=(n,t,e,i,r,s)=>{if(!n)return ni;let a=1;if(t===v2&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),r<1||r>S2||e!==Ca||i<8||i>15||t<0||t>9||s<0||s>w2||i===8&&a!==1)return xn(n,ni);i===8&&(i=9);const o=new N2;return n.state=o,o.strm=n,o.status=Kn,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=r+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Bt-1)/Bt),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<r+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=t,o.strategy=s,o.method=e,Eu(n)},U2=(n,t)=>Pu(n,t,Ca,C2,T2,b2),B2=(n,t)=>{if(qr(n)||t>bu||t<0)return n?xn(n,ni):ni;const e=n.state;if(!n.output||n.avail_in!==0&&!n.input||e.status===jr&&t!==He)return xn(n,n.avail_out===0?dh:ni);const i=e.last_flush;if(e.last_flush=t,e.pending!==0){if(Fe(n),n.avail_out===0)return e.last_flush=-1,_e}else if(n.avail_in===0&&Su(t)<=Su(i)&&t!==He)return xn(n,dh);if(e.status===jr&&n.avail_in!==0)return xn(n,dh);if(e.status===Kn&&e.wrap===0&&(e.status=wn),e.status===Kn){let r=Ca+(e.w_bits-8<<4)<<8,s=-1;if(e.strategy>=Sa||e.level<2?s=0:e.level<6?s=1:e.level===6?s=2:s=3,r|=s<<6,e.strstart!==0&&(r|=R2),r+=31-r%31,Xr(e,r),e.strstart!==0&&(Xr(e,n.adler>>>16),Xr(e,n.adler&65535)),n.adler=1,e.status=wn,Fe(n),e.pending!==0)return e.last_flush=-1,_e}if(e.status===ph){if(n.adler=0,jt(e,31),jt(e,139),jt(e,8),e.gzhead)jt(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),jt(e,e.gzhead.time&255),jt(e,e.gzhead.time>>8&255),jt(e,e.gzhead.time>>16&255),jt(e,e.gzhead.time>>24&255),jt(e,e.level===9?2:e.strategy>=Sa||e.level<2?4:0),jt(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(jt(e,e.gzhead.extra.length&255),jt(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(n.adler=ge(n.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=mh;else if(jt(e,0),jt(e,0),jt(e,0),jt(e,0),jt(e,0),jt(e,e.level===9?2:e.strategy>=Sa||e.level<2?4:0),jt(e,D2),e.status=wn,Fe(n),e.pending!==0)return e.last_flush=-1,_e}if(e.status===mh){if(e.gzhead.extra){let r=e.pending,s=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+s>e.pending_buf_size;){let o=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+o),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),e.gzindex+=o,Fe(n),e.pending!==0)return e.last_flush=-1,_e;r=0,s-=o}let a=new Uint8Array(e.gzhead.extra);e.pending_buf.set(a.subarray(e.gzindex,e.gzindex+s),e.pending),e.pending+=s,e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=vh}if(e.status===vh){if(e.gzhead.name){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),Fe(n),e.pending!==0)return e.last_flush=-1,_e;r=0}e.gzindex<e.gzhead.name.length?s=e.gzhead.name.charCodeAt(e.gzindex++)&255:s=0,jt(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=_h}if(e.status===_h){if(e.gzhead.comment){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r)),Fe(n),e.pending!==0)return e.last_flush=-1,_e;r=0}e.gzindex<e.gzhead.comment.length?s=e.gzhead.comment.charCodeAt(e.gzindex++)&255:s=0,jt(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(n.adler=ge(n.adler,e.pending_buf,e.pending-r,r))}e.status=yh}if(e.status===yh){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(Fe(n),e.pending!==0))return e.last_flush=-1,_e;jt(e,n.adler&255),jt(e,n.adler>>8&255),n.adler=0}if(e.status=wn,Fe(n),e.pending!==0)return e.last_flush=-1,_e}if(n.avail_in!==0||e.lookahead!==0||t!==ji&&e.status!==jr){let r=e.level===0?Tu(e,t):e.strategy===Sa?F2(e,t):e.strategy===y2?I2(e,t):Yr[e.level].func(e,t);if((r===bn||r===Jn)&&(e.status=jr),r===ke||r===bn)return n.avail_out===0&&(e.last_flush=-1),_e;if(r===Zn&&(t===g2?d2(e):t!==bu&&(fh(e,0,0,!1),t===p2&&(Yi(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),Fe(n),n.avail_out===0))return e.last_flush=-1,_e}return t!==He?_e:e.wrap<=0?xu:(e.wrap===2?(jt(e,n.adler&255),jt(e,n.adler>>8&255),jt(e,n.adler>>16&255),jt(e,n.adler>>24&255),jt(e,n.total_in&255),jt(e,n.total_in>>8&255),jt(e,n.total_in>>16&255),jt(e,n.total_in>>24&255)):(Xr(e,n.adler>>>16),Xr(e,n.adler&65535)),Fe(n),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?_e:xu)},z2=n=>{if(qr(n))return ni;const t=n.state.status;return n.state=null,t===wn?xn(n,m2):_e},$2=(n,t)=>{let e=t.length;if(qr(n))return ni;const i=n.state,r=i.wrap;if(r===2||r===1&&i.status!==Kn||i.lookahead)return ni;if(r===1&&(n.adler=Hr(n.adler,t,e,0)),i.wrap=0,e>=i.w_size){r===0&&(Yi(i.head),i.strstart=0,i.block_start=0,i.insert=0);let h=new Uint8Array(i.w_size);h.set(t.subarray(e-i.w_size,e),0),t=h,e=i.w_size}const s=n.avail_in,a=n.next_in,o=n.input;for(n.avail_in=e,n.next_in=0,n.input=t,Qn(i);i.lookahead>=Bt;){let h=i.strstart,l=i.lookahead-(Bt-1);do i.ins_h=qi(i,i.ins_h,i.window[h+Bt-1]),i.prev[h&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=h,h++;while(--l);i.strstart=h,i.lookahead=Bt-1,Qn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Bt-1,i.match_available=0,n.next_in=a,n.input=o,n.avail_in=s,i.wrap=r,_e};var V2=U2,H2=Pu,j2=Eu,X2=ku,Y2=G2,q2=B2,W2=z2,K2=$2,Z2="pako deflate (from Nodeca project)",Wr={deflateInit:V2,deflateInit2:H2,deflateReset:j2,deflateResetKeep:X2,deflateSetHeader:Y2,deflate:q2,deflateEnd:W2,deflateSetDictionary:K2,deflateInfo:Z2};const J2=(n,t)=>Object.prototype.hasOwnProperty.call(n,t);var Q2=function(n){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const i in e)J2(e,i)&&(n[i]=e[i])}}return n},tm=n=>{let t=0;for(let i=0,r=n.length;i<r;i++)t+=n[i].length;const e=new Uint8Array(t);for(let i=0,r=0,s=n.length;i<s;i++){let a=n[i];e.set(a,r),r+=a.length}return e},Ta={assign:Q2,flattenChunks:tm};let Au=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Au=!1}const Kr=new Uint8Array(256);for(let n=0;n<256;n++)Kr[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;Kr[254]=Kr[254]=1;var em=n=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(n);let t,e,i,r,s,a=n.length,o=0;for(r=0;r<a;r++)e=n.charCodeAt(r),(e&64512)===55296&&r+1<a&&(i=n.charCodeAt(r+1),(i&64512)===56320&&(e=65536+(e-55296<<10)+(i-56320),r++)),o+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(o),s=0,r=0;s<o;r++)e=n.charCodeAt(r),(e&64512)===55296&&r+1<a&&(i=n.charCodeAt(r+1),(i&64512)===56320&&(e=65536+(e-55296<<10)+(i-56320),r++)),e<128?t[s++]=e:e<2048?(t[s++]=192|e>>>6,t[s++]=128|e&63):e<65536?(t[s++]=224|e>>>12,t[s++]=128|e>>>6&63,t[s++]=128|e&63):(t[s++]=240|e>>>18,t[s++]=128|e>>>12&63,t[s++]=128|e>>>6&63,t[s++]=128|e&63);return t};const im=(n,t)=>{if(t<65534&&n.subarray&&Au)return String.fromCharCode.apply(null,n.length===t?n:n.subarray(0,t));let e="";for(let i=0;i<t;i++)e+=String.fromCharCode(n[i]);return e};var nm=(n,t)=>{const e=t||n.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(n.subarray(0,t));let i,r;const s=new Array(e*2);for(r=0,i=0;i<e;){let a=n[i++];if(a<128){s[r++]=a;continue}let o=Kr[a];if(o>4){s[r++]=65533,i+=o-1;continue}for(a&=o===2?31:o===3?15:7;o>1&&i<e;)a=a<<6|n[i++]&63,o--;if(o>1){s[r++]=65533;continue}a<65536?s[r++]=a:(a-=65536,s[r++]=55296|a>>10&1023,s[r++]=56320|a&1023)}return im(s,r)},rm=(n,t)=>{t=t||n.length,t>n.length&&(t=n.length);let e=t-1;for(;e>=0&&(n[e]&192)===128;)e--;return e<0||e===0?t:e+Kr[n[e]]>t?e:t},Zr={string2buf:em,buf2string:nm,utf8border:rm};function sm(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Mu=sm;const Ru=Object.prototype.toString,{Z_NO_FLUSH:am,Z_SYNC_FLUSH:om,Z_FULL_FLUSH:hm,Z_FINISH:lm,Z_OK:ka,Z_STREAM_END:cm,Z_DEFAULT_COMPRESSION:um,Z_DEFAULT_STRATEGY:fm,Z_DEFLATED:dm}=yn;function Jr(n){this.options=Ta.assign({level:um,method:dm,chunkSize:16384,windowBits:15,memLevel:8,strategy:fm},n||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mu,this.strm.avail_out=0;let e=Wr.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==ka)throw new Error(_n[e]);if(t.header&&Wr.deflateSetHeader(this.strm,t.header),t.dictionary){let i;if(typeof t.dictionary=="string"?i=Zr.string2buf(t.dictionary):Ru.call(t.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(t.dictionary):i=t.dictionary,e=Wr.deflateSetDictionary(this.strm,i),e!==ka)throw new Error(_n[e]);this._dict_set=!0}}Jr.prototype.push=function(n,t){const e=this.strm,i=this.options.chunkSize;let r,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?lm:am,typeof n=="string"?e.input=Zr.string2buf(n):Ru.call(n)==="[object ArrayBuffer]"?e.input=new Uint8Array(n):e.input=n,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(i),e.next_out=0,e.avail_out=i),(s===om||s===hm)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(r=Wr.deflate(e,s),r===cm)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),r=Wr.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ka;if(e.avail_out===0){this.onData(e.output);continue}if(s>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0},Jr.prototype.onData=function(n){this.chunks.push(n)},Jr.prototype.onEnd=function(n){n===ka&&(this.result=Ta.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function xh(n,t){const e=new Jr(t);if(e.push(n,!0),e.err)throw e.msg||_n[e.err];return e.result}function gm(n,t){return t=t||{},t.raw=!0,xh(n,t)}function pm(n,t){return t=t||{},t.gzip=!0,xh(n,t)}var mm=Jr,vm=xh,_m=gm,ym=pm,wm=yn,bm={Deflate:mm,deflate:vm,deflateRaw:_m,gzip:ym,constants:wm};const Ea=16209,xm=16191;var Sm=function(t,e){let i,r,s,a,o,h,l,c,d,f,u,m,v,b,S,E,_,x,P,R,O,L,$,U;const z=t.state;i=t.next_in,$=t.input,r=i+(t.avail_in-5),s=t.next_out,U=t.output,a=s-(e-t.avail_out),o=s+(t.avail_out-257),h=z.dmax,l=z.wsize,c=z.whave,d=z.wnext,f=z.window,u=z.hold,m=z.bits,v=z.lencode,b=z.distcode,S=(1<<z.lenbits)-1,E=(1<<z.distbits)-1;t:do{m<15&&(u+=$[i++]<<m,m+=8,u+=$[i++]<<m,m+=8),_=v[u&S];e:for(;;){if(x=_>>>24,u>>>=x,m-=x,x=_>>>16&255,x===0)U[s++]=_&65535;else if(x&16){P=_&65535,x&=15,x&&(m<x&&(u+=$[i++]<<m,m+=8),P+=u&(1<<x)-1,u>>>=x,m-=x),m<15&&(u+=$[i++]<<m,m+=8,u+=$[i++]<<m,m+=8),_=b[u&E];i:for(;;){if(x=_>>>24,u>>>=x,m-=x,x=_>>>16&255,x&16){if(R=_&65535,x&=15,m<x&&(u+=$[i++]<<m,m+=8,m<x&&(u+=$[i++]<<m,m+=8)),R+=u&(1<<x)-1,R>h){t.msg="invalid distance too far back",z.mode=Ea;break t}if(u>>>=x,m-=x,x=s-a,R>x){if(x=R-x,x>c&&z.sane){t.msg="invalid distance too far back",z.mode=Ea;break t}if(O=0,L=f,d===0){if(O+=l-x,x<P){P-=x;do U[s++]=f[O++];while(--x);O=s-R,L=U}}else if(d<x){if(O+=l+d-x,x-=d,x<P){P-=x;do U[s++]=f[O++];while(--x);if(O=0,d<P){x=d,P-=x;do U[s++]=f[O++];while(--x);O=s-R,L=U}}}else if(O+=d-x,x<P){P-=x;do U[s++]=f[O++];while(--x);O=s-R,L=U}for(;P>2;)U[s++]=L[O++],U[s++]=L[O++],U[s++]=L[O++],P-=3;P&&(U[s++]=L[O++],P>1&&(U[s++]=L[O++]))}else{O=s-R;do U[s++]=U[O++],U[s++]=U[O++],U[s++]=U[O++],P-=3;while(P>2);P&&(U[s++]=U[O++],P>1&&(U[s++]=U[O++]))}}else if(x&64){t.msg="invalid distance code",z.mode=Ea;break t}else{_=b[(_&65535)+(u&(1<<x)-1)];continue i}break}}else if(x&64)if(x&32){z.mode=xm;break t}else{t.msg="invalid literal/length code",z.mode=Ea;break t}else{_=v[(_&65535)+(u&(1<<x)-1)];continue e}break}}while(i<r&&s<o);P=m>>3,i-=P,m-=P<<3,u&=(1<<m)-1,t.next_in=i,t.next_out=s,t.avail_in=i<r?5+(r-i):5-(i-r),t.avail_out=s<o?257+(o-s):257-(s-o),z.hold=u,z.bits=m};const er=15,Du=852,Lu=592,Iu=0,Sh=1,Fu=2,Cm=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Tm=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),km=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Em=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Qr=(n,t,e,i,r,s,a,o)=>{const h=o.bits;let l=0,c=0,d=0,f=0,u=0,m=0,v=0,b=0,S=0,E=0,_,x,P,R,O,L=null,$;const U=new Uint16Array(er+1),z=new Uint16Array(er+1);let q=null,K,Z,at;for(l=0;l<=er;l++)U[l]=0;for(c=0;c<i;c++)U[t[e+c]]++;for(u=h,f=er;f>=1&&U[f]===0;f--);if(u>f&&(u=f),f===0)return r[s++]=1<<24|64<<16|0,r[s++]=1<<24|64<<16|0,o.bits=1,0;for(d=1;d<f&&U[d]===0;d++);for(u<d&&(u=d),b=1,l=1;l<=er;l++)if(b<<=1,b-=U[l],b<0)return-1;if(b>0&&(n===Iu||f!==1))return-1;for(z[1]=0,l=1;l<er;l++)z[l+1]=z[l]+U[l];for(c=0;c<i;c++)t[e+c]!==0&&(a[z[t[e+c]]++]=c);if(n===Iu?(L=q=a,$=20):n===Sh?(L=Cm,q=Tm,$=257):(L=km,q=Em,$=0),E=0,c=0,l=d,O=s,m=u,v=0,P=-1,S=1<<u,R=S-1,n===Sh&&S>Du||n===Fu&&S>Lu)return 1;for(;;){K=l-v,a[c]+1<$?(Z=0,at=a[c]):a[c]>=$?(Z=q[a[c]-$],at=L[a[c]-$]):(Z=32+64,at=0),_=1<<l-v,x=1<<m,d=x;do x-=_,r[O+(E>>v)+x]=K<<24|Z<<16|at|0;while(x!==0);for(_=1<<l-1;E&_;)_>>=1;if(_!==0?(E&=_-1,E+=_):E=0,c++,--U[l]===0){if(l===f)break;l=t[e+a[c]]}if(l>u&&(E&R)!==P){for(v===0&&(v=u),O+=d,m=l-v,b=1<<m;m+v<f&&(b-=U[m+v],!(b<=0));)m++,b<<=1;if(S+=1<<m,n===Sh&&S>Du||n===Fu&&S>Lu)return 1;P=E&R,r[P]=u<<24|m<<16|O-s|0}}return E!==0&&(r[O+E]=l-v<<24|64<<16|0),o.bits=u,0};const Pm=0,Ou=1,Nu=2,{Z_FINISH:Gu,Z_BLOCK:Am,Z_TREES:Pa,Z_OK:Sn,Z_STREAM_END:Mm,Z_NEED_DICT:Rm,Z_STREAM_ERROR:je,Z_DATA_ERROR:Uu,Z_MEM_ERROR:Bu,Z_BUF_ERROR:Dm,Z_DEFLATED:zu}=yn,Aa=16180,$u=16181,Vu=16182,Hu=16183,ju=16184,Xu=16185,Yu=16186,qu=16187,Wu=16188,Ku=16189,Ma=16190,yi=16191,Ch=16192,Zu=16193,Th=16194,Ju=16195,Qu=16196,tf=16197,ef=16198,Ra=16199,Da=16200,nf=16201,rf=16202,sf=16203,af=16204,of=16205,kh=16206,hf=16207,lf=16208,ee=16209,cf=16210,uf=16211,Lm=852,Im=592,Fm=15,ff=n=>(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24);function Om(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Cn=n=>{if(!n)return 1;const t=n.state;return!t||t.strm!==n||t.mode<Aa||t.mode>uf?1:0},df=n=>{if(Cn(n))return je;const t=n.state;return n.total_in=n.total_out=t.total=0,n.msg="",t.wrap&&(n.adler=t.wrap&1),t.mode=Aa,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Lm),t.distcode=t.distdyn=new Int32Array(Im),t.sane=1,t.back=-1,Sn},gf=n=>{if(Cn(n))return je;const t=n.state;return t.wsize=0,t.whave=0,t.wnext=0,df(n)},pf=(n,t)=>{let e;if(Cn(n))return je;const i=n.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?je:(i.window!==null&&i.wbits!==t&&(i.window=null),i.wrap=e,i.wbits=t,gf(n))},mf=(n,t)=>{if(!n)return je;const e=new Om;n.state=e,e.strm=n,e.window=null,e.mode=Aa;const i=pf(n,t);return i!==Sn&&(n.state=null),i},Nm=n=>mf(n,Fm);let vf=!0,Eh,Ph;const Gm=n=>{if(vf){Eh=new Int32Array(512),Ph=new Int32Array(32);let t=0;for(;t<144;)n.lens[t++]=8;for(;t<256;)n.lens[t++]=9;for(;t<280;)n.lens[t++]=7;for(;t<288;)n.lens[t++]=8;for(Qr(Ou,n.lens,0,288,Eh,0,n.work,{bits:9}),t=0;t<32;)n.lens[t++]=5;Qr(Nu,n.lens,0,32,Ph,0,n.work,{bits:5}),vf=!1}n.lencode=Eh,n.lenbits=9,n.distcode=Ph,n.distbits=5},_f=(n,t,e,i)=>{let r;const s=n.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(t.subarray(e-s.wsize,e),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>i&&(r=i),s.window.set(t.subarray(e-i,e-i+r),s.wnext),i-=r,i?(s.window.set(t.subarray(e-i,e),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},Um=(n,t)=>{let e,i,r,s,a,o,h,l,c,d,f,u,m,v,b=0,S,E,_,x,P,R,O,L;const $=new Uint8Array(4);let U,z;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Cn(n)||!n.output||!n.input&&n.avail_in!==0)return je;e=n.state,e.mode===yi&&(e.mode=Ch),a=n.next_out,r=n.output,h=n.avail_out,s=n.next_in,i=n.input,o=n.avail_in,l=e.hold,c=e.bits,d=o,f=h,L=Sn;t:for(;;)switch(e.mode){case Aa:if(e.wrap===0){e.mode=Ch;break}for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.wrap&2&&l===35615){e.wbits===0&&(e.wbits=15),e.check=0,$[0]=l&255,$[1]=l>>>8&255,e.check=ge(e.check,$,2,0),l=0,c=0,e.mode=$u;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){n.msg="incorrect header check",e.mode=ee;break}if((l&15)!==zu){n.msg="unknown compression method",e.mode=ee;break}if(l>>>=4,c-=4,O=(l&15)+8,e.wbits===0&&(e.wbits=O),O>15||O>e.wbits){n.msg="invalid window size",e.mode=ee;break}e.dmax=1<<e.wbits,e.flags=0,n.adler=e.check=1,e.mode=l&512?Ku:yi,l=0,c=0;break;case $u:for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.flags=l,(e.flags&255)!==zu){n.msg="unknown compression method",e.mode=ee;break}if(e.flags&57344){n.msg="unknown header flags set",e.mode=ee;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ge(e.check,$,2,0)),l=0,c=0,e.mode=Vu;case Vu:for(;c<32;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.head&&(e.head.time=l),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,$[2]=l>>>16&255,$[3]=l>>>24&255,e.check=ge(e.check,$,4,0)),l=0,c=0,e.mode=Hu;case Hu:for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.head&&(e.head.xflags=l&255,e.head.os=l>>8),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ge(e.check,$,2,0)),l=0,c=0,e.mode=ju;case ju:if(e.flags&1024){for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.length=l,e.head&&(e.head.extra_len=l),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ge(e.check,$,2,0)),l=0,c=0}else e.head&&(e.head.extra=null);e.mode=Xu;case Xu:if(e.flags&1024&&(u=e.length,u>o&&(u=o),u&&(e.head&&(O=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(i.subarray(s,s+u),O)),e.flags&512&&e.wrap&4&&(e.check=ge(e.check,i,u,s)),o-=u,s+=u,e.length-=u),e.length))break t;e.length=0,e.mode=Yu;case Yu:if(e.flags&2048){if(o===0)break t;u=0;do O=i[s+u++],e.head&&O&&e.length<65536&&(e.head.name+=String.fromCharCode(O));while(O&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=ge(e.check,i,u,s)),o-=u,s+=u,O)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=qu;case qu:if(e.flags&4096){if(o===0)break t;u=0;do O=i[s+u++],e.head&&O&&e.length<65536&&(e.head.comment+=String.fromCharCode(O));while(O&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=ge(e.check,i,u,s)),o-=u,s+=u,O)break t}else e.head&&(e.head.comment=null);e.mode=Wu;case Wu:if(e.flags&512){for(;c<16;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.wrap&4&&l!==(e.check&65535)){n.msg="header crc mismatch",e.mode=ee;break}l=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),n.adler=e.check=0,e.mode=yi;break;case Ku:for(;c<32;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}n.adler=e.check=ff(l),l=0,c=0,e.mode=Ma;case Ma:if(e.havedict===0)return n.next_out=a,n.avail_out=h,n.next_in=s,n.avail_in=o,e.hold=l,e.bits=c,Rm;n.adler=e.check=1,e.mode=yi;case yi:if(t===Am||t===Pa)break t;case Ch:if(e.last){l>>>=c&7,c-=c&7,e.mode=kh;break}for(;c<3;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}switch(e.last=l&1,l>>>=1,c-=1,l&3){case 0:e.mode=Zu;break;case 1:if(Gm(e),e.mode=Ra,t===Pa){l>>>=2,c-=2;break t}break;case 2:e.mode=Qu;break;case 3:n.msg="invalid block type",e.mode=ee}l>>>=2,c-=2;break;case Zu:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){n.msg="invalid stored block lengths",e.mode=ee;break}if(e.length=l&65535,l=0,c=0,e.mode=Th,t===Pa)break t;case Th:e.mode=Ju;case Ju:if(u=e.length,u){if(u>o&&(u=o),u>h&&(u=h),u===0)break t;r.set(i.subarray(s,s+u),a),o-=u,s+=u,h-=u,a+=u,e.length-=u;break}e.mode=yi;break;case Qu:for(;c<14;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.nlen=(l&31)+257,l>>>=5,c-=5,e.ndist=(l&31)+1,l>>>=5,c-=5,e.ncode=(l&15)+4,l>>>=4,c-=4,e.nlen>286||e.ndist>30){n.msg="too many length or distance symbols",e.mode=ee;break}e.have=0,e.mode=tf;case tf:for(;e.have<e.ncode;){for(;c<3;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.lens[q[e.have++]]=l&7,l>>>=3,c-=3}for(;e.have<19;)e.lens[q[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,U={bits:e.lenbits},L=Qr(Pm,e.lens,0,19,e.lencode,0,e.work,U),e.lenbits=U.bits,L){n.msg="invalid code lengths set",e.mode=ee;break}e.have=0,e.mode=ef;case ef:for(;e.have<e.nlen+e.ndist;){for(;b=e.lencode[l&(1<<e.lenbits)-1],S=b>>>24,E=b>>>16&255,_=b&65535,!(S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(_<16)l>>>=S,c-=S,e.lens[e.have++]=_;else{if(_===16){for(z=S+2;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(l>>>=S,c-=S,e.have===0){n.msg="invalid bit length repeat",e.mode=ee;break}O=e.lens[e.have-1],u=3+(l&3),l>>>=2,c-=2}else if(_===17){for(z=S+3;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}l>>>=S,c-=S,O=0,u=3+(l&7),l>>>=3,c-=3}else{for(z=S+7;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}l>>>=S,c-=S,O=0,u=11+(l&127),l>>>=7,c-=7}if(e.have+u>e.nlen+e.ndist){n.msg="invalid bit length repeat",e.mode=ee;break}for(;u--;)e.lens[e.have++]=O}}if(e.mode===ee)break;if(e.lens[256]===0){n.msg="invalid code -- missing end-of-block",e.mode=ee;break}if(e.lenbits=9,U={bits:e.lenbits},L=Qr(Ou,e.lens,0,e.nlen,e.lencode,0,e.work,U),e.lenbits=U.bits,L){n.msg="invalid literal/lengths set",e.mode=ee;break}if(e.distbits=6,e.distcode=e.distdyn,U={bits:e.distbits},L=Qr(Nu,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,U),e.distbits=U.bits,L){n.msg="invalid distances set",e.mode=ee;break}if(e.mode=Ra,t===Pa)break t;case Ra:e.mode=Da;case Da:if(o>=6&&h>=258){n.next_out=a,n.avail_out=h,n.next_in=s,n.avail_in=o,e.hold=l,e.bits=c,Sm(n,f),a=n.next_out,r=n.output,h=n.avail_out,s=n.next_in,i=n.input,o=n.avail_in,l=e.hold,c=e.bits,e.mode===yi&&(e.back=-1);break}for(e.back=0;b=e.lencode[l&(1<<e.lenbits)-1],S=b>>>24,E=b>>>16&255,_=b&65535,!(S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(E&&!(E&240)){for(x=S,P=E,R=_;b=e.lencode[R+((l&(1<<x+P)-1)>>x)],S=b>>>24,E=b>>>16&255,_=b&65535,!(x+S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}l>>>=x,c-=x,e.back+=x}if(l>>>=S,c-=S,e.back+=S,e.length=_,E===0){e.mode=of;break}if(E&32){e.back=-1,e.mode=yi;break}if(E&64){n.msg="invalid literal/length code",e.mode=ee;break}e.extra=E&15,e.mode=nf;case nf:if(e.extra){for(z=e.extra;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.length+=l&(1<<e.extra)-1,l>>>=e.extra,c-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=rf;case rf:for(;b=e.distcode[l&(1<<e.distbits)-1],S=b>>>24,E=b>>>16&255,_=b&65535,!(S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(!(E&240)){for(x=S,P=E,R=_;b=e.distcode[R+((l&(1<<x+P)-1)>>x)],S=b>>>24,E=b>>>16&255,_=b&65535,!(x+S<=c);){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}l>>>=x,c-=x,e.back+=x}if(l>>>=S,c-=S,e.back+=S,E&64){n.msg="invalid distance code",e.mode=ee;break}e.offset=_,e.extra=E&15,e.mode=sf;case sf:if(e.extra){for(z=e.extra;c<z;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}e.offset+=l&(1<<e.extra)-1,l>>>=e.extra,c-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){n.msg="invalid distance too far back",e.mode=ee;break}e.mode=af;case af:if(h===0)break t;if(u=f-h,e.offset>u){if(u=e.offset-u,u>e.whave&&e.sane){n.msg="invalid distance too far back",e.mode=ee;break}u>e.wnext?(u-=e.wnext,m=e.wsize-u):m=e.wnext-u,u>e.length&&(u=e.length),v=e.window}else v=r,m=a-e.offset,u=e.length;u>h&&(u=h),h-=u,e.length-=u;do r[a++]=v[m++];while(--u);e.length===0&&(e.mode=Da);break;case of:if(h===0)break t;r[a++]=e.length,h--,e.mode=Da;break;case kh:if(e.wrap){for(;c<32;){if(o===0)break t;o--,l|=i[s++]<<c,c+=8}if(f-=h,n.total_out+=f,e.total+=f,e.wrap&4&&f&&(n.adler=e.check=e.flags?ge(e.check,r,f,a-f):Hr(e.check,r,f,a-f)),f=h,e.wrap&4&&(e.flags?l:ff(l))!==e.check){n.msg="incorrect data check",e.mode=ee;break}l=0,c=0}e.mode=hf;case hf:if(e.wrap&&e.flags){for(;c<32;){if(o===0)break t;o--,l+=i[s++]<<c,c+=8}if(e.wrap&4&&l!==(e.total&4294967295)){n.msg="incorrect length check",e.mode=ee;break}l=0,c=0}e.mode=lf;case lf:L=Mm;break t;case ee:L=Uu;break t;case cf:return Bu;case uf:default:return je}return n.next_out=a,n.avail_out=h,n.next_in=s,n.avail_in=o,e.hold=l,e.bits=c,(e.wsize||f!==n.avail_out&&e.mode<ee&&(e.mode<kh||t!==Gu))&&_f(n,n.output,n.next_out,f-n.avail_out),d-=n.avail_in,f-=n.avail_out,n.total_in+=d,n.total_out+=f,e.total+=f,e.wrap&4&&f&&(n.adler=e.check=e.flags?ge(e.check,r,f,n.next_out-f):Hr(e.check,r,f,n.next_out-f)),n.data_type=e.bits+(e.last?64:0)+(e.mode===yi?128:0)+(e.mode===Ra||e.mode===Th?256:0),(d===0&&f===0||t===Gu)&&L===Sn&&(L=Dm),L},Bm=n=>{if(Cn(n))return je;let t=n.state;return t.window&&(t.window=null),n.state=null,Sn},zm=(n,t)=>{if(Cn(n))return je;const e=n.state;return e.wrap&2?(e.head=t,t.done=!1,Sn):je},$m=(n,t)=>{const e=t.length;let i,r,s;return Cn(n)||(i=n.state,i.wrap!==0&&i.mode!==Ma)?je:i.mode===Ma&&(r=1,r=Hr(r,t,e,0),r!==i.check)?Uu:(s=_f(n,t,e,e),s?(i.mode=cf,Bu):(i.havedict=1,Sn))};var Vm=gf,Hm=pf,jm=df,Xm=Nm,Ym=mf,qm=Um,Wm=Bm,Km=zm,Zm=$m,Jm="pako inflate (from Nodeca project)",wi={inflateReset:Vm,inflateReset2:Hm,inflateResetKeep:jm,inflateInit:Xm,inflateInit2:Ym,inflate:qm,inflateEnd:Wm,inflateGetHeader:Km,inflateSetDictionary:Zm,inflateInfo:Jm};function Qm(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var tv=Qm;const yf=Object.prototype.toString,{Z_NO_FLUSH:ev,Z_FINISH:iv,Z_OK:ts,Z_STREAM_END:Ah,Z_NEED_DICT:Mh,Z_STREAM_ERROR:nv,Z_DATA_ERROR:wf,Z_MEM_ERROR:rv}=yn;function es(n){this.options=Ta.assign({chunkSize:1024*64,windowBits:15,to:""},n||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(n&&n.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mu,this.strm.avail_out=0;let e=wi.inflateInit2(this.strm,t.windowBits);if(e!==ts)throw new Error(_n[e]);if(this.header=new tv,wi.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Zr.string2buf(t.dictionary):yf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=wi.inflateSetDictionary(this.strm,t.dictionary),e!==ts)))throw new Error(_n[e])}es.prototype.push=function(n,t){const e=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?iv:ev,yf.call(n)==="[object ArrayBuffer]"?e.input=new Uint8Array(n):e.input=n,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(i),e.next_out=0,e.avail_out=i),s=wi.inflate(e,a),s===Mh&&r&&(s=wi.inflateSetDictionary(e,r),s===ts?s=wi.inflate(e,a):s===wf&&(s=Mh));e.avail_in>0&&s===Ah&&e.state.wrap>0&&n[e.next_in]!==0;)wi.inflateReset(e),s=wi.inflate(e,a);switch(s){case nv:case wf:case Mh:case rv:return this.onEnd(s),this.ended=!0,!1}if(o=e.avail_out,e.next_out&&(e.avail_out===0||s===Ah))if(this.options.to==="string"){let h=Zr.utf8border(e.output,e.next_out),l=e.next_out-h,c=Zr.buf2string(e.output,h);e.next_out=l,e.avail_out=i-l,l&&e.output.set(e.output.subarray(h,h+l),0),this.onData(c)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(s===ts&&o===0)){if(s===Ah)return s=wi.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},es.prototype.onData=function(n){this.chunks.push(n)},es.prototype.onEnd=function(n){n===ts&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ta.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function Rh(n,t){const e=new es(t);if(e.push(n),e.err)throw e.msg||_n[e.err];return e.result}function sv(n,t){return t=t||{},t.raw=!0,Rh(n,t)}var av=es,ov=Rh,hv=sv,lv=Rh,cv=yn,uv={Inflate:av,inflate:ov,inflateRaw:hv,ungzip:lv,constants:cv};const{Deflate:fv,deflate:dv,deflateRaw:gv,gzip:pv}=bm,{Inflate:mv,inflate:vv,inflateRaw:_v,ungzip:yv}=uv;var wv=fv,bv=dv,xv=gv,Sv=pv,Cv=mv,Tv=vv,kv=_v,Ev=yv,Pv=yn,Av={Deflate:wv,deflate:bv,deflateRaw:xv,gzip:Sv,Inflate:Cv,inflate:Tv,inflateRaw:kv,ungzip:Ev,constants:Pv};const dt={};dt.toRGBA8=function(n){const t=n.width,e=n.height;if(n.tabs.acTL===null)return[dt.toRGBA8.decodeImage(n.data,t,e,n).buffer];const i=[];n.frames[0].data===null&&(n.frames[0].data=n.data);const r=t*e*4,s=new Uint8Array(r),a=new Uint8Array(r),o=new Uint8Array(r);for(let h=0;h<n.frames.length;h++){const l=n.frames[h],c=l.rect.x,d=l.rect.y,f=l.rect.width,u=l.rect.height,m=dt.toRGBA8.decodeImage(l.data,f,u,n);if(h!==0)for(let v=0;v<r;v++)o[v]=s[v];if(l.blend===0?dt._copyTile(m,f,u,s,t,e,c,d,0):l.blend===1&&dt._copyTile(m,f,u,s,t,e,c,d,1),i.push(s.buffer.slice(0)),l.dispose===1)dt._copyTile(a,f,u,s,t,e,c,d,0);else if(l.dispose===2)for(let v=0;v<r;v++)s[v]=o[v]}return i},dt.toRGBA8.decodeImage=function(n,t,e,i){const r=t*e,s=dt.decode._getBPP(i),a=Math.ceil(t*s/8),o=new Uint8Array(r*4),h=new Uint32Array(o.buffer),l=i.ctype,c=i.depth,d=dt._bin.readUshort;if(l===6){const f=r<<2;if(c===8)for(let u=0;u<f;u+=4)o[u]=n[u],o[u+1]=n[u+1],o[u+2]=n[u+2],o[u+3]=n[u+3];if(c===16)for(let u=0;u<f;u++)o[u]=n[u<<1]}else if(l===2){const f=i.tabs.tRNS;if(f===null){if(c===8)for(let u=0;u<r;u++){const m=u*3;h[u]=255<<24|n[m+2]<<16|n[m+1]<<8|n[m]}if(c===16)for(let u=0;u<r;u++){const m=u*6;h[u]=255<<24|n[m+4]<<16|n[m+2]<<8|n[m]}}else{const u=f[0],m=f[1],v=f[2];if(c===8)for(let b=0;b<r;b++){const S=b<<2,E=b*3;h[b]=255<<24|n[E+2]<<16|n[E+1]<<8|n[E],n[E]===u&&n[E+1]===m&&n[E+2]===v&&(o[S+3]=0)}if(c===16)for(let b=0;b<r;b++){const S=b<<2,E=b*6;h[b]=255<<24|n[E+4]<<16|n[E+2]<<8|n[E],d(n,E)===u&&d(n,E+2)===m&&d(n,E+4)===v&&(o[S+3]=0)}}}else if(l===3){const f=i.tabs.PLTE,u=i.tabs.tRNS,m=u?u.length:0;if(c===1)for(let v=0;v<e;v++){const b=v*a,S=v*t;for(let E=0;E<t;E++){const _=S+E<<2,x=n[b+(E>>3)]>>7-((E&7)<<0)&1,P=3*x;o[_]=f[P],o[_+1]=f[P+1],o[_+2]=f[P+2],o[_+3]=x<m?u[x]:255}}if(c===2)for(let v=0;v<e;v++){const b=v*a,S=v*t;for(let E=0;E<t;E++){const _=S+E<<2,x=n[b+(E>>2)]>>6-((E&3)<<1)&3,P=3*x;o[_]=f[P],o[_+1]=f[P+1],o[_+2]=f[P+2],o[_+3]=x<m?u[x]:255}}if(c===4)for(let v=0;v<e;v++){const b=v*a,S=v*t;for(let E=0;E<t;E++){const _=S+E<<2,x=n[b+(E>>1)]>>4-((E&1)<<2)&15,P=3*x;o[_]=f[P],o[_+1]=f[P+1],o[_+2]=f[P+2],o[_+3]=x<m?u[x]:255}}if(c===8)for(let v=0;v<r;v++){const b=v<<2,S=n[v],E=3*S;o[b]=f[E],o[b+1]=f[E+1],o[b+2]=f[E+2],o[b+3]=S<m?u[S]:255}}else if(l===4){if(c===8)for(let f=0;f<r;f++){const u=f<<2,m=f<<1,v=n[m];o[u]=v,o[u+1]=v,o[u+2]=v,o[u+3]=n[m+1]}if(c===16)for(let f=0;f<r;f++){const u=f<<2,m=f<<2,v=n[m];o[u]=v,o[u+1]=v,o[u+2]=v,o[u+3]=n[m+2]}}else if(l===0){const f=i.tabs.tRNS?i.tabs.tRNS:-1;for(let u=0;u<e;u++){const m=u*a,v=u*t;if(c===1)for(let b=0;b<t;b++){const S=255*(n[m+(b>>>3)]>>>7-(b&7)&1),E=S===f*255?0:255;h[v+b]=E<<24|S<<16|S<<8|S}else if(c===2)for(let b=0;b<t;b++){const S=85*(n[m+(b>>>2)]>>>6-((b&3)<<1)&3),E=S===f*85?0:255;h[v+b]=E<<24|S<<16|S<<8|S}else if(c===4)for(let b=0;b<t;b++){const S=17*(n[m+(b>>>1)]>>>4-((b&1)<<2)&15),E=S===f*17?0:255;h[v+b]=E<<24|S<<16|S<<8|S}else if(c===8)for(let b=0;b<t;b++){const S=n[m+b],E=S===f?0:255;h[v+b]=E<<24|S<<16|S<<8|S}else if(c===16)for(let b=0;b<t;b++){const S=n[m+(b<<1)],E=d(n,m+(b<<1))===f?0:255;h[v+b]=E<<24|S<<16|S<<8|S}}}return o},dt.decode=function(n){const t=new Uint8Array(n);let e=8;const i=dt._bin,r=i.readUshort,s=i.readUint,a={tabs:{},frames:[]},o=new Uint8Array(t.length);let h=0,l,c=0;const d=[137,80,78,71,13,10,26,10];for(let f=0;f<8;f++)if(t[f]!==d[f])throw"The input is not a PNG file!";for(;e<t.length;){const f=i.readUint(t,e);e+=4;const u=i.readASCII(t,e,4);if(e+=4,u==="IHDR")dt.decode._IHDR(t,e,a);else if(u==="CgBI")a.tabs[u]=t.slice(e,e+4);else if(u==="IDAT"){for(let m=0;m<f;m++)o[h+m]=t[e+m];h+=f}else if(u==="acTL")a.tabs[u]={num_frames:s(t,e),num_plays:s(t,e+4)},l=new Uint8Array(t.length);else if(u==="fcTL"){if(c!==0){const S=a.frames[a.frames.length-1];S.data=dt.decode._decompress(a,l.slice(0,c),S.rect.width,S.rect.height),c=0}const m={x:s(t,e+12),y:s(t,e+16),width:s(t,e+4),height:s(t,e+8)};let v=r(t,e+22);v=r(t,e+20)/(v===0?100:v);const b={rect:m,delay:Math.round(v*1e3),dispose:t[e+24],blend:t[e+25]};a.frames.push(b)}else if(u==="fdAT"){for(let m=0;m<f-4;m++)l[c+m]=t[e+m+4];c+=f-4}else if(u==="pHYs")a.tabs[u]=[i.readUint(t,e),i.readUint(t,e+4),t[e+8]];else if(u==="cHRM"){a.tabs[u]=[];for(let m=0;m<8;m++)a.tabs[u].push(i.readUint(t,e+m*4))}else if(u==="tEXt"||u==="zTXt"){a.tabs[u]===null&&(a.tabs[u]={});const m=i.nextZero(t,e),v=i.readASCII(t,e,m-e);let b;const S=e+f-m-1;if(u==="tEXt")b=i.readASCII(t,m+1,S);else{const E=dt.decode._inflate(t.slice(m+2,m+2+S));b=i.readUTF8(E,0,E.length)}a.tabs[u][v]=b}else if(u==="iTXt"){a.tabs[u]==null&&(a.tabs[u]={});let m=0,v=e;m=i.nextZero(t,v);const b=i.readASCII(t,v,m-v);v=m+1;const S=t[v];v+=2,m=i.nextZero(t,v),v=m+1,m=i.nextZero(t,v),v=m+1;let E;const _=f-(v-e);if(S===0)E=i.readUTF8(t,v,_);else{const x=dt.decode._inflate(t.slice(v,v+_));E=i.readUTF8(x,0,x.length)}a.tabs[u][b]=E}else if(u==="PLTE")a.tabs[u]=i.readBytes(t,e,f);else if(u==="hIST"){const m=a.tabs.PLTE.length/3;a.tabs[u]=[];for(let v=0;v<m;v++)a.tabs[u].push(r(t,e+v*2))}else if(u==="tRNS")a.ctype===3?a.tabs[u]=i.readBytes(t,e,f):a.ctype===0?a.tabs[u]=r(t,e):a.ctype===2&&(a.tabs[u]=[r(t,e),r(t,e+2),r(t,e+4)]);else if(u==="gAMA")a.tabs[u]=i.readUint(t,e)/1e5;else if(u==="sRGB")a.tabs[u]=t[e];else if(u==="bKGD")a.ctype===0||a.ctype===4?a.tabs[u]=[r(t,e)]:a.ctype===2||a.ctype===6?a.tabs[u]=[r(t,e),r(t,e+2),r(t,e+4)]:a.ctype===3&&(a.tabs[u]=t[e]);else if(u==="IEND")break;e+=f,e+=4}if(c!==0){const f=a.frames[a.frames.length-1];f.data=dt.decode._decompress(a,l.slice(0,c),f.rect.width,f.rect.height),c=0}return a.data=dt.decode._decompress(a,o,a.width,a.height),delete a.compress,delete a.interlace,delete a.filter,a},dt.decode._decompress=function(n,t,e,i){const r=dt.decode._getBPP(n),s=Math.ceil(e*r/8),a=new Uint8Array((s+1+n.interlace)*i);return n.tabs.CgBI?t=dt.inflateRaw(t,a):t=dt.decode._inflate(t,a),n.interlace===0?t=dt.decode._filterZero(t,n,0,e,i):n.interlace===1&&(t=dt.decode._readInterlace(t,n)),t},dt.decode._inflate=function(n,t){return dt.inflateRaw(new Uint8Array(n.buffer,2,n.length-6),t)},dt.inflateRaw=function(){const n={};return n.H={},n.H.N=function(t,e){const i=Uint8Array;let r=0,s=0,a=0,o=0,h=0,l=0,c=0,d=0,f=0,u,m;if(t[0]===3&&t[1]===0)return e||new i(0);const v=n.H,b=v.b,S=v.e,E=v.R,_=v.n,x=v.A,P=v.Z,R=v.m,O=e===null;for(O&&(e=new i(t.length>>>2<<3));r===0;){if(r=b(t,f,1),s=b(t,f+1,2),f+=3,s===0){f&7&&(f+=8-(f&7));const L=(f>>>3)+4,$=t[L-4]|t[L-3]<<8;O&&(e=n.H.W(e,d+$)),e.set(new i(t.buffer,t.byteOffset+L,$),d),f=L+$<<3,d+=$;continue}if(O&&(e=n.H.W(e,d+(1<<17))),s===1&&(u=R.J,m=R.h,l=512-1,c=32-1),s===2){a=S(t,f,5)+257,o=S(t,f+5,5)+1,h=S(t,f+10,4)+4,f+=14;let L=1;for(let z=0;z<38;z+=2)R.Q[z]=0,R.Q[z+1]=0;for(let z=0;z<h;z++){const q=S(t,f+z*3,3);R.Q[(R.X[z]<<1)+1]=q,q>L&&(L=q)}f+=3*h,_(R.Q,L),x(R.Q,L,R.u),u=R.w,m=R.d,f=E(R.u,(1<<L)-1,a+o,t,f,R.v);const $=v.V(R.v,0,a,R.C);l=(1<<$)-1;const U=v.V(R.v,a,o,R.D);c=(1<<U)-1,_(R.C,$),x(R.C,$,u),_(R.D,U),x(R.D,U,m)}for(;;){const L=u[P(t,f)&l];f+=L&15;const $=L>>>4;if(!($>>>8))e[d++]=$;else{if($===256)break;{let U=d+$-254;if($>264){const at=R.q[$-257];U=d+(at>>>3)+S(t,f,at&7),f+=at&7}const z=m[P(t,f)&c];f+=z&15;const q=z>>>4,K=R.c[q],Z=(K>>>4)+b(t,f,K&15);for(f+=K&15;d<U;)e[d]=e[d++-Z],e[d]=e[d++-Z],e[d]=e[d++-Z],e[d]=e[d++-Z];d=U}}}}return e.length===d?e:e.slice(0,d)},n.H.W=function(t,e){const i=t.length;if(e<=i)return t;const r=new Uint8Array(i<<1);return r.set(t,0),r},n.H.R=function(t,e,i,r,s,a){const o=n.H.e,h=n.H.Z;let l=0;for(;l<i;){const c=t[h(r,s)&e];s+=c&15;const d=c>>>4;if(d<=15)a[l]=d,l++;else{let f=0,u=0;d===16?(u=3+o(r,s,2),s+=2,f=a[l-1]):d===17?(u=3+o(r,s,3),s+=3):d===18&&(u=11+o(r,s,7),s+=7);const m=l+u;for(;l<m;)a[l]=f,l++}}return s},n.H.V=function(t,e,i,r){let s=0,a=0;const o=r.length>>>1;for(;a<i;){const h=t[a+e];r[a<<1]=0,r[(a<<1)+1]=h,h>s&&(s=h),a++}for(;a<o;)r[a<<1]=0,r[(a<<1)+1]=0,a++;return s},n.H.n=function(t,e){const i=n.H.m,r=t.length;let s,a,o,h,l;const c=i.j;for(let f=0;f<=e;f++)c[f]=0;for(h=1;h<r;h+=2)c[t[h]]++;const d=i.K;for(s=0,c[0]=0,a=1;a<=e;a++)s=s+c[a-1]<<1,d[a]=s;for(o=0;o<r;o+=2)l=t[o+1],l!==0&&(t[o]=d[l],d[l]++)},n.H.A=function(t,e,i){const r=t.length,a=n.H.m.r;for(let o=0;o<r;o+=2)if(t[o+1]!==0){const h=o>>1,l=t[o+1],c=h<<4|l,d=e-l;let f=t[o]<<d;const u=f+(1<<d);for(;f!==u;){const m=a[f]>>>15-e;i[m]=c,f++}}},n.H.l=function(t,e){const i=n.H.m.r,r=15-e;for(let s=0;s<t.length;s+=2){const a=t[s]<<e-t[s+1];t[s]=i[a]>>>r}},n.H.M=function(t,e,i){i=i<<(e&7);const r=e>>>3;t[r]|=i,t[r+1]|=i>>>8},n.H.I=function(t,e,i){i=i<<(e&7);const r=e>>>3;t[r]|=i,t[r+1]|=i>>>8,t[r+2]|=i>>>16},n.H.e=function(t,e,i){return(t[e>>>3]|t[(e>>>3)+1]<<8)>>>(e&7)&(1<<i)-1},n.H.b=function(t,e,i){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)&(1<<i)-1},n.H.Z=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)},n.H.i=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16|t[(e>>>3)+3]<<24)>>>(e&7)},n.H.m=function(){const t=Uint16Array,e=Uint32Array;return{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new e(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(32768),s:new e(286),Y:new e(30),a:new e(19),t:new e(15e3),k:new t(65536),g:new t(32768)}}(),function(){const t=n.H.m,e=32768;for(let r=0;r<e;r++){let s=r;s=(s&2863311530)>>>1|(s&1431655765)<<1,s=(s&3435973836)>>>2|(s&858993459)<<2,s=(s&4042322160)>>>4|(s&252645135)<<4,s=(s&4278255360)>>>8|(s&16711935)<<8,t.r[r]=(s>>>16|s<<16)>>>17}function i(r,s,a){for(;s--!==0;)r.push(0,a)}for(let r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];i(t._,144,8),i(t._,255-143,9),i(t._,279-255,7),i(t._,287-279,8),n.H.n(t._,9),n.H.A(t._,9,t.J),n.H.l(t._,9),i(t.$,32,5),n.H.n(t.$,5),n.H.A(t.$,5,t.h),n.H.l(t.$,5),i(t.Q,19,0),i(t.C,286,0),i(t.D,30,0),i(t.v,320,0)}(),n.H.N}(),dt.decode._readInterlace=function(n,t){const e=t.width,i=t.height,r=dt.decode._getBPP(t),s=r>>3,a=Math.ceil(e*r/8),o=new Uint8Array(i*a);let h=0;const l=[0,0,4,0,2,0,1],c=[0,4,0,2,0,1,0],d=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1];let u=0;for(;u<7;){const m=d[u],v=f[u];let b=0,S=0,E=l[u];for(;E<i;)E+=m,S++;let _=c[u];for(;_<e;)_+=v,b++;const x=Math.ceil(b*r/8);dt.decode._filterZero(n,t,h,b,S);let P=0,R=l[u];for(;R<i;){let O=c[u],L=h+P*x<<3;for(;O<e;){if(r===1){let $=n[L>>3];$=$>>7-(L&7)&1,o[R*a+(O>>3)]|=$<<7-((O&7)<<0)}if(r===2){let $=n[L>>3];$=$>>6-(L&7)&3,o[R*a+(O>>2)]|=$<<6-((O&3)<<1)}if(r===4){let $=n[L>>3];$=$>>4-(L&7)&15,o[R*a+(O>>1)]|=$<<4-((O&1)<<2)}if(r>=8){const $=R*a+O*s;for(let U=0;U<s;U++)o[$+U]=n[(L>>3)+U]}L+=r,O+=v}P++,R+=m}b*S!==0&&(h+=S*(1+x)),u=u+1}return o},dt.decode._getBPP=function(n){return[1,null,3,1,2,null,4][n.ctype]*n.depth},dt.decode._filterZero=function(n,t,e,i,r){let s=dt.decode._getBPP(t);const a=Math.ceil(i*s/8),o=dt.decode._paeth;s=Math.ceil(s/8);let h=0,l=1,c=n[e],d=0;if(c>1&&(n[e]=[0,0,1][c-2]),c===3)for(d=s;d<a;d++)n[d+1]=n[d+1]+(n[d+1-s]>>>1)&255;for(let f=0;f<r;f++)if(h=e+f*a,l=h+f+1,c=n[l-1],d=0,c===0)for(;d<a;d++)n[h+d]=n[l+d];else if(c===1){for(;d<s;d++)n[h+d]=n[l+d];for(;d<a;d++)n[h+d]=n[l+d]+n[h+d-s]}else if(c===2)for(;d<a;d++)n[h+d]=n[l+d]+n[h+d-a];else if(c===3){for(;d<s;d++)n[h+d]=n[l+d]+(n[h+d-a]>>>1);for(;d<a;d++)n[h+d]=n[l+d]+(n[h+d-a]+n[h+d-s]>>>1)}else{for(;d<s;d++)n[h+d]=n[l+d]+o(0,n[h+d-a],0);for(;d<a;d++)n[h+d]=n[l+d]+o(n[h+d-s],n[h+d-a],n[h+d-s-a])}return n},dt.decode._paeth=function(n,t,e){const i=n+t-e,r=i-n,s=i-t,a=i-e;return r*r<=s*s&&r*r<=a*a?n:s*s<=a*a?t:e},dt.decode._IHDR=function(n,t,e){const i=dt._bin;e.width=i.readUint(n,t),t+=4,e.height=i.readUint(n,t),t+=4,e.depth=n[t],t++,e.ctype=n[t],t++,e.compress=n[t],t++,e.filter=n[t],t++,e.interlace=n[t],t++},dt._bin={nextZero:function(n,t){for(;n[t]!==0;)t++;return t},readUshort:function(n,t){return n[t]<<8|n[t+1]},writeUshort:function(n,t,e){n[t]=e>>8&255,n[t+1]=e&255},readUint:function(n,t){return n[t]*(256*256*256)+(n[t+1]<<16|n[t+2]<<8|n[t+3])},writeUint:function(n,t,e){n[t]=e>>24&255,n[t+1]=e>>16&255,n[t+2]=e>>8&255,n[t+3]=e&255},readASCII:function(n,t,e){let i="";for(let r=0;r<e;r++)i+=String.fromCharCode(n[t+r]);return i},writeASCII:function(n,t,e){for(let i=0;i<e.length;i++)n[t+i]=e.charCodeAt(i)},readBytes:function(n,t,e){const i=[];for(let r=0;r<e;r++)i.push(n[t+r]);return i},pad:function(n){return n.length<2?"0"+n:n},readUTF8:function(n,t,e){let i="",r;for(let s=0;s<e;s++)i+="%"+dt._bin.pad(n[t+s].toString(16));try{r=decodeURIComponent(i)}catch{return dt._bin.readASCII(n,t,e)}return r}},dt._copyTile=function(n,t,e,i,r,s,a,o,h){const l=Math.min(t,r),c=Math.min(e,s);let d=0,f=0;for(let u=0;u<c;u++)for(let m=0;m<l;m++)if(a>=0&&o>=0?(d=u*t+m<<2,f=(o+u)*r+a+m<<2):(d=(-o+u)*t-a+m<<2,f=u*r+m<<2),h===0)i[f]=n[d],i[f+1]=n[d+1],i[f+2]=n[d+2],i[f+3]=n[d+3];else if(h===1){const v=n[d+3]*.00392156862745098,b=n[d]*v,S=n[d+1]*v,E=n[d+2]*v,_=i[f+3]*(1/255),x=i[f]*_,P=i[f+1]*_,R=i[f+2]*_,O=1-v,L=v+_*O,$=L===0?0:1/L;i[f+3]=255*L,i[f+0]=(b+x*O)*$,i[f+1]=(S+P*O)*$,i[f+2]=(E+R*O)*$}else if(h===2){const v=n[d+3],b=n[d],S=n[d+1],E=n[d+2],_=i[f+3],x=i[f],P=i[f+1],R=i[f+2];v===_&&b===x&&S===P&&E===R?(i[f]=0,i[f+1]=0,i[f+2]=0,i[f+3]=0):(i[f]=b,i[f+1]=S,i[f+2]=E,i[f+3]=v)}else if(h===3){const v=n[d+3],b=n[d],S=n[d+1],E=n[d+2],_=i[f+3],x=i[f],P=i[f+1],R=i[f+2];if(v===_&&b===x&&S===P&&E===R)continue;if(v<220&&_>20)return!1}return!0},dt.encode=function(n,t,e,i,r,s,a){i===null&&(i=0),a===null&&(a=!1);const o=dt.encode.compress(n,t,e,i,[!1,!1,!1,0,a]);return dt.encode.compressPNG(o,-1),dt.encode._main(o,t,e,r,s)},dt.encodeLL=function(n,t,e,i,r,s,a,o){const h={ctype:0+(i===1?0:2)+(r===0?0:4),depth:s,frames:[]},l=(i+r)*s,c=l*t;for(let f=0;f<n.length;f++)h.frames.push({rect:{x:0,y:0,width:t,height:e},img:new Uint8Array(n[f]),blend:0,dispose:1,bpp:Math.ceil(l/8),bpl:Math.ceil(c/8)});return dt.encode.compressPNG(h,0,!0),dt.encode._main(h,t,e,a,o)},dt.encode._main=function(n,t,e,i,r){r||(r={});const s=dt.crc.crc,a=dt._bin.writeUint,o=dt._bin.writeUshort,h=dt._bin.writeASCII;let l=8;const c=n.frames.length>1;let d=!1,f=8+(16+5+4)+(c?20:0);if(r.sRGB!==null&&r.sRGB!==void 0&&(f+=8+1+4),r.pHYs!==null&&r.pHYs!==void 0&&(f+=8+9+4),n.ctype===3){const b=n.plte.length;for(let S=0;S<b;S++)n.plte[S]>>>24!==255&&(d=!0);f+=8+b*3+4+(d?8+b*1+4:0)}for(let b=0;b<n.frames.length;b++){const S=n.frames[b];c&&(f+=38),f+=S.cimg.length+12,b!==0&&(f+=4)}f+=12;const u=new Uint8Array(f),m=[137,80,78,71,13,10,26,10];for(let b=0;b<8;b++)u[b]=m[b];if(a(u,l,13),l+=4,h(u,l,"IHDR"),l+=4,a(u,l,t),l+=4,a(u,l,e),l+=4,u[l]=n.depth,l++,u[l]=n.ctype,l++,u[l]=0,l++,u[l]=0,l++,u[l]=0,l++,a(u,l,s(u,l-17,17)),l+=4,r.sRGB!==null&&r.sRGB!==void 0&&(a(u,l,1),l+=4,h(u,l,"sRGB"),l+=4,u[l]=r.sRGB,l++,a(u,l,s(u,l-5,5)),l+=4),r.pHYs!==null&&r.pHYs!==void 0&&(a(u,l,9),l+=4,h(u,l,"pHYs"),l+=4,a(u,l,r.pHYs[0]),l+=4,a(u,l,r.pHYs[1]),l+=4,u[l]=r.pHYs[2],l++,a(u,l,s(u,l-13,13)),l+=4),c&&(a(u,l,8),l+=4,h(u,l,"acTL"),l+=4,a(u,l,n.frames.length),l+=4,a(u,l,r.loop!=null?r.loop:0),l+=4,a(u,l,s(u,l-12,12)),l+=4),n.ctype===3){const b=n.plte.length;a(u,l,b*3),l+=4,h(u,l,"PLTE"),l+=4;for(let S=0;S<b;S++){const E=S*3,_=n.plte[S],x=_&255,P=_>>>8&255,R=_>>>16&255;u[l+E+0]=x,u[l+E+1]=P,u[l+E+2]=R}if(l+=b*3,a(u,l,s(u,l-b*3-4,b*3+4)),l+=4,d){a(u,l,b),l+=4,h(u,l,"tRNS"),l+=4;for(let S=0;S<b;S++)u[l+S]=n.plte[S]>>>24&255;l+=b,a(u,l,s(u,l-b-4,b+4)),l+=4}}let v=0;for(let b=0;b<n.frames.length;b++){const S=n.frames[b];c&&(a(u,l,26),l+=4,h(u,l,"fcTL"),l+=4,a(u,l,v++),l+=4,a(u,l,S.rect.width),l+=4,a(u,l,S.rect.height),l+=4,a(u,l,S.rect.x),l+=4,a(u,l,S.rect.y),l+=4,o(u,l,i[b]),l+=2,o(u,l,1e3),l+=2,u[l]=S.dispose,l++,u[l]=S.blend,l++,a(u,l,s(u,l-30,30)),l+=4);const E=S.cimg,_=E.length;a(u,l,_+(b===0?0:4)),l+=4;const x=l;h(u,l,b===0?"IDAT":"fdAT"),l+=4,b!==0&&(a(u,l,v++),l+=4),u.set(E,l),l+=_,a(u,l,s(u,x,l-x)),l+=4}return a(u,l,0),l+=4,h(u,l,"IEND"),l+=4,a(u,l,s(u,l-4,4)),l+=4,u.buffer},dt.encode.compressPNG=function(n,t,e){for(let i=0;i<n.frames.length;i++){const r=n.frames[i],s=r.rect.height,a=new Uint8Array(s*r.bpl+s);r.cimg=dt.encode._filterZero(r.img,s,r.bpp,r.bpl,a,t,e)}},dt.encode.compress=function(n,t,e,i,r){const s=r[0],a=r[1],o=r[2],h=r[3],l=r[4];let c=6,d=8,f=255;for(let _=0;_<n.length;_++){const x=new Uint8Array(n[_]),P=x.length;for(let R=0;R<P;R+=4)f&=x[R+3]}const u=f!==255,m=dt.encode.framize(n,t,e,s,a,o),v={},b=[],S=[];if(i!==0){const _=[];for(let L=0;L<m.length;L++)_.push(m[L].img.buffer);const x=dt.encode.concatRGBA(_),P=dt.quantize(x,i);let R=0;const O=new Uint8Array(P.abuf);for(let L=0;L<m.length;L++){const $=m[L].img,U=$.length;S.push(new Uint8Array(P.inds.buffer,R>>2,U>>2));for(let z=0;z<U;z+=4)$[z]=O[R+z],$[z+1]=O[R+z+1],$[z+2]=O[R+z+2],$[z+3]=O[R+z+3];R+=U}for(let L=0;L<P.plte.length;L++)b.push(P.plte[L].est.rgba)}else for(let _=0;_<m.length;_++){const x=m[_],P=new Uint32Array(x.img.buffer),R=x.rect.width,O=P.length,L=new Uint8Array(O);S.push(L);for(let $=0;$<O;$++){const U=P[$];if($!==0&&U===P[$-1])L[$]=L[$-1];else if($>R&&U===P[$-R])L[$]=L[$-R];else{let z=v[U];if(z===null&&(v[U]=z=b.length,b.push(U),b.length>=300))break;L[$]=z}}}const E=b.length;E<=256&&l===!1&&(E<=2?d=1:E<=4?d=2:E<=16?d=4:d=8,d=Math.max(d,h));for(let _=0;_<m.length;_++){const x=m[_],P=x.rect.width,R=x.rect.height;let O=x.img,L=4*P,$=4;if(E<=256&&l===!1){L=Math.ceil(d*P/8);const U=new Uint8Array(L*R),z=S[_];for(let q=0;q<R;q++){const K=q*L,Z=q*P;if(d===8)for(let at=0;at<P;at++)U[K+at]=z[Z+at];else if(d===4)for(let at=0;at<P;at++)U[K+(at>>1)]|=z[Z+at]<<4-(at&1)*4;else if(d===2)for(let at=0;at<P;at++)U[K+(at>>2)]|=z[Z+at]<<6-(at&3)*2;else if(d===1)for(let at=0;at<P;at++)U[K+(at>>3)]|=z[Z+at]<<7-(at&7)*1}O=U,c=3,$=1}else if(u===!1&&m.length===1){const U=new Uint8Array(P*R*3),z=P*R;for(let q=0;q<z;q++){const K=q*3,Z=q*4;U[K]=O[Z],U[K+1]=O[Z+1],U[K+2]=O[Z+2]}O=U,c=2,$=3,L=3*P}x.img=O,x.bpl=L,x.bpp=$}return{ctype:c,depth:d,plte:b,frames:m}},dt.encode.framize=function(n,t,e,i,r,s){const a=[];for(let o=0;o<n.length;o++){const h=new Uint8Array(n[o]),l=new Uint32Array(h.buffer);let c,d=0,f=0,u=t,m=e,v=i?1:0;if(o!==0){const b=s||i||o===1||a[o-2].dispose!==0?1:2;let S=0,E=1e9;for(let x=0;x<b;x++){const P=new Uint32Array(n[o-1-x]);let R=t,O=e,L=-1,$=-1;for(let z=0;z<e;z++)for(let q=0;q<t;q++){const K=z*t+q;l[K]!==P[K]&&(q<R&&(R=q),q>L&&(L=q),z<O&&(O=z),z>$&&($=z))}L===-1&&(R=O=L=$=0),r&&((R&1)===1&&R--,(O&1)===1&&O--);const U=(L-R+1)*($-O+1);U<E&&(E=U,S=x,d=R,f=O,u=L-R+1,m=$-O+1)}const _=new Uint8Array(n[o-1-S]);S===1&&(a[o-1].dispose=2),c=new Uint8Array(u*m*4),dt._copyTile(_,t,e,c,u,m,-d,-f,0),v=dt._copyTile(h,t,e,c,u,m,-d,-f,3)?1:0,v===1?dt.encode._prepareDiff(h,t,e,c,{x:d,y:f,width:u,height:m}):dt._copyTile(h,t,e,c,u,m,-d,-f,0)}else c=h.slice(0);a.push({rect:{x:d,y:f,width:u,height:m},img:c,blend:v,dispose:0})}if(i)for(let o=0;o<a.length;o++){const h=a[o];if(h.blend===1)continue;const l=h.rect,c=a[o-1].rect,d=Math.min(l.x,c.x),f=Math.min(l.y,c.y),u=Math.max(l.x+l.width,c.x+c.width),m=Math.max(l.y+l.height,c.y+c.height),v={x:d,y:f,width:u-d,height:m-f};a[o-1].dispose=1,o-1!==0&&dt.encode._updateFrame(n,t,e,a,o-1,v,r),dt.encode._updateFrame(n,t,e,a,o,v,r)}return a},dt.encode._updateFrame=function(n,t,e,i,r,s,a){const o=Uint8Array,h=Uint32Array,l=new o(n[r-1]),c=new h(n[r-1]),d=r+1<n.length?new o(n[r+1]):null,f=new o(n[r]),u=new h(f.buffer);let m=t,v=e,b=-1,S=-1;for(let _=0;_<s.height;_++)for(let x=0;x<s.width;x++){const P=s.x+x,R=s.y+_,O=R*t+P,L=u[O];L===0||i[r-1].dispose===0&&c[O]===L&&(d===null||d[O*4+3]!==0)||(P<m&&(m=P),P>b&&(b=P),R<v&&(v=R),R>S&&(S=R))}b===-1&&(m=v=b=S=0),a&&((m&1)===1&&m--,(v&1)===1&&v--),s={x:m,y:v,width:b-m+1,height:S-v+1};const E=i[r];E.rect=s,E.blend=1,E.img=new Uint8Array(s.width*s.height*4),i[r-1].dispose===0?(dt._copyTile(l,t,e,E.img,s.width,s.height,-s.x,-s.y,0),dt.encode._prepareDiff(f,t,e,E.img,s)):dt._copyTile(f,t,e,E.img,s.width,s.height,-s.x,-s.y,0)},dt.encode._prepareDiff=function(n,t,e,i,r){dt._copyTile(n,t,e,i,r.width,r.height,-r.x,-r.y,2)},dt.encode._filterZero=function(n,t,e,i,r,s,a){const o=[];let h=[0,1,2,3,4];s!==-1?h=[s]:(t*i>5e5||e===1)&&(h=[0]);let l;a&&(l={level:0});const c=r.length>1e7&&Jc!=null?Jc:Av;for(let u=0;u<h.length;u++){for(let m=0;m<t;m++)dt.encode._filterLine(r,n,m,i,e,h[u]);o.push(c.deflate(r,l))}let d,f=1e9;for(let u=0;u<o.length;u++)o[u].length<f&&(d=u,f=o[u].length);return o[d]},dt.encode._filterLine=function(n,t,e,i,r,s){const a=e*i;let o=a+e;const h=dt.decode._paeth;if(n[o]=s,o++,s===0)if(i<500)for(let l=0;l<i;l++)n[o+l]=t[a+l];else n.set(new Uint8Array(t.buffer,a,i),o);else if(s===1){for(let l=0;l<r;l++)n[o+l]=t[a+l];for(let l=r;l<i;l++)n[o+l]=t[a+l]-t[a+l-r]+256&255}else if(e===0){for(let l=0;l<r;l++)n[o+l]=t[a+l];if(s===2)for(let l=r;l<i;l++)n[o+l]=t[a+l];if(s===3)for(let l=r;l<i;l++)n[o+l]=t[a+l]-(t[a+l-r]>>1)+256&255;if(s===4)for(let l=r;l<i;l++)n[o+l]=t[a+l]-h(t[a+l-r],0,0)+256&255}else{if(s===2)for(let l=0;l<i;l++)n[o+l]=t[a+l]+256-t[a+l-i]&255;if(s===3){for(let l=0;l<r;l++)n[o+l]=t[a+l]+256-(t[a+l-i]>>1)&255;for(let l=r;l<i;l++)n[o+l]=t[a+l]+256-(t[a+l-i]+t[a+l-r]>>1)&255}if(s===4){for(let l=0;l<r;l++)n[o+l]=t[a+l]+256-h(0,t[a+l-i],0)&255;for(let l=r;l<i;l++)n[o+l]=t[a+l]+256-h(t[a+l-r],t[a+l-i],t[a+l-r-i])&255}}},dt.crc={table:function(){const n=new Uint32Array(256);for(let t=0;t<256;t++){let e=t;for(let i=0;i<8;i++)e&1?e=3988292384^e>>>1:e=e>>>1;n[t]=e}return n}(),update:function(n,t,e,i){for(let r=0;r<i;r++)n=dt.crc.table[(n^t[e+r])&255]^n>>>8;return n},crc:function(n,t,e){return dt.crc.update(4294967295,n,t,e)^4294967295}},dt.quantize=function(n,t){const e=new Uint8Array(n),i=e.slice(0),r=new Uint32Array(i.buffer),s=dt.quantize.getKDtree(i,t),a=s[0],o=s[1],h=dt.quantize.planeDst,l=e,c=r,d=l.length,f=new Uint8Array(e.length>>2);let u;if(e.length<2e7)for(let m=0;m<d;m+=4){const v=l[m]*.00392156862745098,b=l[m+1]*(1/255),S=l[m+2]*(1/255),E=l[m+3]*(1/255);u=dt.quantize.getNearest(a,v,b,S,E),f[m>>2]=u.ind,c[m>>2]=u.est.rgba}else for(let m=0;m<d;m+=4){const v=l[m]*.00392156862745098,b=l[m+1]*(1/255),S=l[m+2]*(1/255),E=l[m+3]*(1/255);for(u=a;u.left;)u=h(u.est,v,b,S,E)<=0?u.left:u.right;f[m>>2]=u.ind,c[m>>2]=u.est.rgba}return{abuf:i.buffer,inds:f,plte:o}},dt.quantize.getKDtree=function(n,t,e){e===null&&(e=1e-4);const i=new Uint32Array(n.buffer),r={i0:0,i1:n.length,bst:null,est:null,tdst:0,left:null,right:null};r.bst=dt.quantize.stats(n,r.i0,r.i1),r.est=dt.quantize.estats(r.bst);const s=[r];for(;s.length<t;){let a=0,o=0;for(let u=0;u<s.length;u++)s[u].est.L>a&&(a=s[u].est.L,o=u);if(a<e)break;const h=s[o],l=dt.quantize.splitPixels(n,i,h.i0,h.i1,h.est.e,h.est.eMq255);if(h.i0>=l||h.i1<=l){h.est.L=0;continue}const d={i0:h.i0,i1:l,bst:null,est:null,tdst:0,left:null,right:null};d.bst=dt.quantize.stats(n,d.i0,d.i1),d.est=dt.quantize.estats(d.bst);const f={i0:l,i1:h.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:h.bst.N-d.bst.N};for(let u=0;u<16;u++)f.bst.R[u]=h.bst.R[u]-d.bst.R[u];for(let u=0;u<4;u++)f.bst.m[u]=h.bst.m[u]-d.bst.m[u];f.est=dt.quantize.estats(f.bst),h.left=d,h.right=f,s[o]=d,s.push(f)}s.sort(function(a,o){return o.bst.N-a.bst.N});for(let a=0;a<s.length;a++)s[a].ind=a;return[r,s]},dt.quantize.getNearest=function(n,t,e,i,r){if(n.left==null)return n.tdst=dt.quantize.dist(n.est.q,t,e,i,r),n;const s=dt.quantize.planeDst(n.est,t,e,i,r);let a=n.left,o=n.right;s>0&&(a=n.right,o=n.left);const h=dt.quantize.getNearest(a,t,e,i,r);if(h.tdst<=s*s)return h;const l=dt.quantize.getNearest(o,t,e,i,r);return l.tdst<h.tdst?l:h},dt.quantize.planeDst=function(n,t,e,i,r){const s=n.e;return s[0]*t+s[1]*e+s[2]*i+s[3]*r-n.eMq},dt.quantize.dist=function(n,t,e,i,r){const s=t-n[0],a=e-n[1],o=i-n[2],h=r-n[3];return s*s+a*a+o*o+h*h},dt.quantize.splitPixels=function(n,t,e,i,r,s){const a=dt.quantize.vecDot;for(i-=4;e<i;){for(;a(n,e,r)<=s;)e+=4;for(;a(n,i,r)>s;)i-=4;if(e>=i)break;const o=t[e>>2];t[e>>2]=t[i>>2],t[i>>2]=o,e+=4,i-=4}for(;a(n,e,r)>s;)e-=4;return e+4},dt.quantize.vecDot=function(n,t,e){return n[t]*e[0]+n[t+1]*e[1]+n[t+2]*e[2]+n[t+3]*e[3]},dt.quantize.stats=function(n,t,e){const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=[0,0,0,0],s=e-t>>2;for(let a=t;a<e;a+=4){const o=n[a]*.00392156862745098,h=n[a+1]*(1/255),l=n[a+2]*(1/255),c=n[a+3]*(1/255);r[0]+=o,r[1]+=h,r[2]+=l,r[3]+=c,i[0]+=o*o,i[1]+=o*h,i[2]+=o*l,i[3]+=o*c,i[5]+=h*h,i[6]+=h*l,i[7]+=h*c,i[10]+=l*l,i[11]+=l*c,i[15]+=c*c}return i[4]=i[1],i[8]=i[2],i[9]=i[6],i[12]=i[3],i[13]=i[7],i[14]=i[11],{R:i,m:r,N:s}},dt.quantize.estats=function(n){const t=n.R,e=n.m,i=n.N,r=e[0],s=e[1],a=e[2],o=e[3],h=i===0?0:1/i,l=[t[0]-r*r*h,t[1]-r*s*h,t[2]-r*a*h,t[3]-r*o*h,t[4]-s*r*h,t[5]-s*s*h,t[6]-s*a*h,t[7]-s*o*h,t[8]-a*r*h,t[9]-a*s*h,t[10]-a*a*h,t[11]-a*o*h,t[12]-o*r*h,t[13]-o*s*h,t[14]-o*a*h,t[15]-o*o*h],c=l,d=dt.M4;let f=[Math.random(),Math.random(),Math.random(),Math.random()],u=0,m=0;if(i!==0)for(let S=0;S<16&&(f=d.multVec(c,f),m=Math.sqrt(d.dot(f,f)),f=d.sml(1/m,f),!(S!==0&&Math.abs(m-u)<1e-9));S++)u=m;const v=[r*h,s*h,a*h,o*h],b=d.dot(d.sml(255,v),f);return{Cov:l,q:v,e:f,L:u,eMq255:b,eMq:d.dot(f,v),rgba:(Math.round(255*v[3])<<24|Math.round(255*v[2])<<16|Math.round(255*v[1])<<8|Math.round(255*v[0])<<0)>>>0}},dt.M4={multVec:function(n,t){return[n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3],n[4]*t[0]+n[5]*t[1]+n[6]*t[2]+n[7]*t[3],n[8]*t[0]+n[9]*t[1]+n[10]*t[2]+n[11]*t[3],n[12]*t[0]+n[13]*t[1]+n[14]*t[2]+n[15]*t[3]]},dot:function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]},sml:function(n,t){return[n*t[0],n*t[1],n*t[2],n*t[3]]}},dt.encode.concatRGBA=function(n){let t=0;for(let r=0;r<n.length;r++)t+=n[r].byteLength;const e=new Uint8Array(t);let i=0;for(let r=0;r<n.length;r++){const s=new Uint8Array(n[r]),a=s.length;for(let o=0;o<a;o+=4){let h=s[o],l=s[o+1],c=s[o+2];const d=s[o+3];d===0&&(h=l=c=0),e[i+o]=h,e[i+o+1]=l,e[i+o+2]=c,e[i+o+3]=d}i+=a}return e.buffer};const Mv=dt,La=new Map,Dh=(n,t)=>{if(La.has(n))return t(null,La.get(n));const e=new Image;e.onload=function(){La.set(n,{width:e.width,height:e.height,element:e}),t(null,La.get(n))},e.onerror=function(i){t(i,null)},e.src=n},Rv=(n,t)=>{for(let e=0,i=n.length;e<i;e++){const r=n[e],{type:s}=r;if(s.split("/")[0]!=="image")return;const o=new FileReader;o.onload=function(h){if(!h.target)return t("no reader target",null);const l=h.target.result,c=Fl(l),d=new Blob([l]);Lh(d,(f,u)=>{if(!u)return t(f,null);Dh(u,(m,v)=>{if(!v)return t(m,null);bf(u,(b,S)=>{if(!S)return t(b,null);const E={name:r.name,fileType:c,size:r.size,width:v.width,height:v.height,imgUrl:u,imageData:S,blob:d};return t(null,E)})})})},o.readAsArrayBuffer(r)}},bf=(n,t)=>{Dh(n,(e,i)=>{if(!i)return t(e,null);const r=document.createElement("canvas"),s=r.getContext("2d");r.width=i.width,r.height=i.height,s.drawImage(i.element,0,0,r.width,r.height);const a=s.getImageData(0,0,r.width,r.height);return t(null,a)})},Dv=(n,t=0,e=0)=>{const i=document.createElement("canvas"),r=i.getContext("2d");return i.width=t,i.height=e,r.drawImage(n,0,0,t,e),r.getImageData(0,0,t,e)},Lv=(n,t=0,e=0)=>{const i=document.createElement("canvas"),r=i.getContext("2d");return i.width=t,i.height=e,r.drawImage(n,0,0,t,e),r.getImageData(0,0,t,e)},Iv=n=>{const t=n.width,e=n.height,i=t*e*3,r=i+54,s=[66,77,r&255,r>>8&255,r>>16&255,r>>24&255,0,0,0,0,54,0,0,0],a=[40,0,0,0,t&255,t>>8&255,t>>16&255,t>>24&255,e&255,e>>8&255,e>>16&255,e>>24&255,1,0,24,0,0,0,0,0,i&255,i>>8&255,i>>16&255,i>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=(4-t*3%4)%4,h=n.data;let l="";const c=t<<2;let d=e;const f=String.fromCharCode;do{const m=c*(d-1);let v="";for(let b=0;b<t;b++){const S=b<<2;v+=f(h[m+S+2])+f(h[m+S+1])+f(h[m+S])}for(let b=0;b<o;b++)v+=String.fromCharCode(0);l+=v}while(--d);function u(m){if(!window.btoa)throw"btoa undefined";let v="";if(typeof m=="string")v=m;else for(let b=0;b<m.length;b++)v+=String.fromCharCode(m[b]);return btoa(v)}return u(s.concat(a))+u(l)},Fv=n=>{const{width:t,height:e}=n,i=document.createElement("canvas"),r=i.getContext("2d");return i.width=t,i.height=e,r.putImageData(n,0,0,0,0,t,e),i.toDataURL("image/png")},Ov=(n,t,e)=>{const{width:i,height:r}=n,s=document.createElement("canvas"),a=s.getContext("2d");s.width=i,s.height=r,a.putImageData(n,0,0,0,0,i,r);const o=`image/${t?t.toLowerCase():"png"}`;s.toBlob(h=>{e?.(null,h)},o,1)},Lh=(n,t)=>{const e=new FileReader;e.onload=function(i){i.target?t(null,i.target.result):t("can't readAsDataURL",null)},e.readAsDataURL(n)},Nv=(n,t)=>{Lh(n,function(e,i){if(i){const r=new Image;r.src=i}else t(e)})};function Gv(n){const t=[],e=[],i=[];let r=0;for(let h=0,l=n.data.length;h<l;h+=4)t[r]=n.data[h],e[r]=n.data[h+1],i[r]=n.data[h+2],r+=1;const s=Ih(t),a=Ih(e),o=Ih(i);return"rgb("+s+","+a+","+o+")"}function Ih(n){const t={},e=[],i=[];for(let o=0;o<n.length;o++)t[n[o]]?e.push(n[o]):t[n[o]]=1;let r=0;for(let o=0;o<e.length;o++){r=0;for(let h=0;h<e.length;h++)e[o]===e[h]&&(r+=1),i[o]=r}const s=Math.max.apply(null,i);let a=0;for(;a<i.length;a++)if(i[a]===s)return;return e[a]}const Uv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[(a*e+e-o-1)*4],r[h+1]=t[(a*e+e-o-1)*4+1],r[h+2]=t[(a*e+e-o-1)*4+2],r[h+3]=t[(a*e+e-o-1)*4+3]}return new ImageData(r,e,i)},Bv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[((i-a-1)*e+o)*4],r[h+1]=t[((i-a-1)*e+o)*4+1],r[h+2]=t[((i-a-1)*e+o)*4+2],r[h+3]=t[((i-a-1)*e+o)*4+3]}return new ImageData(r,e,i)},zv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<i;o++){const h=(a*i+o)*4;r[h]=t[(o*e+e-a-1)*4],r[h+1]=t[(o*e+e-a-1)*4+1],r[h+2]=t[(o*e+e-a-1)*4+2],r[h+3]=t[(o*e+e-a-1)*4+3]}return new ImageData(r,i,e)},$v=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<i;o++){const h=(a*i+o)*4;r[h]=t[((i-o-1)*e+a)*4],r[h+1]=t[((i-o-1)*e+a)*4+1],r[h+2]=t[((i-o-1)*e+a)*4+2],r[h+3]=t[((i-o-1)*e+a)*4+3]}return new ImageData(r,i,e)},Vv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+1]+t[h+2])/3;r[h]=l,r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Hv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=.2126*t[h]+.7152*t[h+1]+.0722*t[h+2];r[h]=l,r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,i)},jv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+1]+t[h+2])/3>127?255:0;r[h]=c,r[h+1]=c,r[h+2]=c,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Xv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=255-t[h],r[h+1]=255-t[h+1],r[h+2]=255-t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,i)},Yv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=0,r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,i)},qv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=t[h+1],r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Wv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=0,r[h+2]=t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,i)},Kv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=t[h+1],r[h+2]=0,r[h+3]=t[h+3]}return new ImageData(r,e,i)},Zv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=0,r[h+2]=t[h+1],r[h+3]=t[h+3]}return new ImageData(r,e,i)},Jv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=0,r[h+1]=t[h+1],r[h+2]=t[h+1],r[h+3]=t[h+3]}return new ImageData(r,e,i)},Qv=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h+1]+t[h+2])/2;r[h]=t[h],r[h+1]=l,r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,i)},t_=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+2])/2;r[h]=l,r[h+1]=t[h+1],r[h+2]=l,r[h+3]=t[h+3]}return new ImageData(r,e,i)},e_=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+1])/2;r[h]=l,r[h+1]=l,r[h+2]=t[h+2],r[h+3]=t[h+3]}return new ImageData(r,e,i)},i_=n=>xf(n,[-1,-1,-1,-1,9,-1,-1,-1,-1]),n_=n=>xf(n,[-1,-1,-1,-1,8,-1,-1,-1,-1]),r_=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[h],r[h+1]=t[h+1],r[h+2]=t[h+2],r[h+3]=255}return new ImageData(r,e,i)},s_=n=>{const{data:t,width:e,height:i}=n,r=new Uint8ClampedArray(t.length);for(let a=0;a<i;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;if(t[h+3]===0)r[h]=255,r[h+1]=255,r[h+2]=255,r[h+3]=255;else{const l=Sf([t[h],t[h+1],t[h+2],t[h+3]],[255,255,255,255]);r[h]=l[0],r[h+1]=l[1],r[h+2]=l[2],r[h+3]=l[3]}}return new ImageData(r,e,i)},a_=(n,t,e,i,r,s=!1,a)=>{const{data:o,width:h,height:l}=n;let c=r,d=i,f=t,u=e;if(c<0?c=0:c>h&&(c=h),d<0?d=0:d>l&&(d=l),f<1?f=1:f>h&&(f=h),u<1?u=1:u>l&&(u=l),c+f>h&&(f=h-c),d+u>l&&(u=l-d),s){const m=new Uint8ClampedArray(o.length);for(let b=0;b<l;b++)for(let S=0;S<h;S++){const E=(b*h+S)*4;S>=c&&S<=c+f&&b>=d&&b<=d+u?(m[E]=o[E],m[E+1]=o[E+1],m[E+2]=o[E+2],m[E+3]=o[E+3]):(m[E]=255,m[E+1]=255,m[E+2]=255,m[E+3]=a&&["JPG","JPEG"].includes(a.toUpperCase())?255:0)}return new ImageData(m,h,l)}else{const m=new Uint8ClampedArray(f*u*4);for(let b=d;b<=d+u;b++)for(let S=c;S<=c+f;S++){const E=((b-d)*f+S-c)*4,_=(b*h+S)*4;m[E]=o[_],m[E+1]=o[_+1],m[E+2]=o[_+2],m[E+3]=o[_+3]}return new ImageData(m,f,u)}},o_=(n,t,e,i)=>{const{data:r,width:s,height:a}=n;let o=t;o>Math.floor(s/2)&&(o=Math.floor(s/2)),o>Math.floor(a/2)&&(o=Math.floor(a/2)),o<0&&(o=0);const h=new Uint8ClampedArray(r.length);for(let c=0;c<a;c++)for(let d=0;d<s;d++){const f=(c*s+d)*4;let u=-1;d<o?c<o?u=Math.sqrt(Math.pow(o-d-1,2)+Math.pow(o-c-1,2)):c>a-o-1&&(u=Math.sqrt(Math.pow(o-d-1,2)+Math.pow(c-(a-o),2))):d>s-o-1&&(c<o?u=Math.sqrt(Math.pow(d-(s-o),2)+Math.pow(o-c-1,2)):c>a-o-1&&(u=Math.sqrt(Math.pow(d-(s-o),2)+Math.pow(c-(a-o),2)))),Math.round(u)>o?(h[f]=255,h[f+1]=255,h[f+2]=255,h[f+3]=i||e.toUpperCase()==="PNG"?0:255):(h[f]=r[f],h[f+1]=r[f+1],h[f+2]=r[f+2],h[f+3]=i||e.toUpperCase()==="PNG"?r[f+3]:255)}return new ImageData(h,s,a)},h_=(n,t,e,i,r,s=1e4)=>{const a=new Image;a.src=n;const o=document.createElement("canvas"),h=o.getContext("2d");return o.width=s,o.height=s,h.drawImage(a,0,0,t,e,0,0,i,r),h.getImageData(0,0,i,r)},l_=(n,t)=>{const{data:e,width:i,height:r}=n,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let h=0;h<i;h++){const l=(o*i+h)*4;s[l]=Math.max(Math.min(e[l]+t,255),0),s[l+1]=Math.max(Math.min(e[l+1]+t,255),0),s[l+2]=Math.max(Math.min(e[l+2]+t,255),0),s[l+3]=e[l+3]}return new ImageData(s,i,r)},c_=(n,t,e=!1)=>{const{data:i,width:r,height:s}=n,a=new Uint8ClampedArray(i.length);for(let h=0;h<s;h++)for(let l=0;l<r;l++){const c=(h*r+l)*4;i[c+3]===0?(a[c]=255,a[c+1]=255,a[c+2]=255):(a[c]=i[c],a[c+1]=i[c+1],a[c+2]=i[c+2]);let d=i[c+3];e?d=Math.max(Math.min(Math.floor(255*t),255),0):d=Math.max(Math.min(Math.floor(d+255*t),255),0),a[c+3]=d}return new ImageData(a,r,s)},u_=(n,t,e,i)=>{const{data:r,width:s,height:a}=n,{data:o,width:h,height:l}=t;let c=e,d=i;e+l>a&&(c=a-l),i+h>s&&(d=s-h);const f=new Uint8ClampedArray(r.length);for(let m=0;m<a;m++)for(let v=0;v<s;v++){const b=(m*s+v)*4;if(v<d||v>d+h||m<=c||m>=c+l)f[b]=r[b],f[b+1]=r[b+1],f[b+2]=r[b+2],f[b+3]=r[b+3];else{const S=(m*s+v-((c+1)*s+(m-(c+1))*(s-h))+h-d-1)*4,E=[o[S],o[S+1],o[S+2],o[S+3]],_=[r[b],r[b+1],r[b+2],r[b+3]],x=Sf(E,_);f[b]=x[0],f[b+1]=x[1],f[b+2]=x[2],f[b+3]=x[3]}}return new ImageData(f,s,a)},f_=(n,t,e,i,r,s=10)=>{const{data:a,width:o,height:h}=n;let l=r,c=i,d=t,f=e;l<0?l=0:l>o&&(l=o),c<0?c=0:c>h&&(c=h),d<1?d=1:d>o&&(d=o),f<1?f=1:f>h&&(f=h),l+d>o&&(d=o-l),c+f>h&&(f=h-c);const u=new Uint8ClampedArray(a.length);for(let v=0;v<h;v++)for(let b=0;b<o;b++){const S=(v*o+b)*4;if(b>=l&&b<=l+d&&v>=c&&v<=c+f){const E=Math.floor((b-l)/s),_=Math.floor((v-c)/s);let x=Math.floor(s*(E+1)-s/2+l),P=Math.floor(s*(_+1)-s/2+c);x>o-1&&(x=o-1),P>h-1&&(P=h-1);const R=(P*o+x)*4;u[S]=a[R],u[S+1]=a[R+1],u[S+2]=a[R+2],u[S+3]=a[R+3]}else u[S]=a[S],u[S+1]=a[S+1],u[S+2]=a[S+2],u[S+3]=a[S+3]}return new ImageData(u,o,h)},d_=async(n,t,e,i,r,s)=>{const a=r/100;if(["JPG","JPEG"].includes(i.toUpperCase())){const o=new Image;o.src=n;const h=document.createElement("canvas"),l=h.getContext("2d");h.width=t,h.height=e,l.drawImage(o,0,0,t,e),h.toBlob(c=>{s(c)},`image/${i.toLowerCase()}`,a)}else{const o=Math.floor(a*256),h=Mv.encode([n.data.buffer],t,e,o),l=new Blob([h]);s&&s(l)}},g_=(n,t,e={backgroundColor:{r:0,g:0,b:0,a:255},changeIntoColor:{r:0,g:0,b:0,a:0}})=>{if(t&&e){const{data:i,width:r,height:s}=n,{data:a}=t,o=new Uint8ClampedArray(i.length),{backgroundColor:h,changeIntoColor:l}=e;for(let d=0;d<s;d++)for(let f=0;f<r;f++){const u=(d*r+f)*4,m=a[u],v=a[u+1],b=a[u+2],S=a[u+3];m===h.r&&v===h.g&&b===h.b&&S===h.a&&l.a!==0?(o[u]=l.r,o[u+1]=l.g,o[u+2]=l.b,o[u+3]=l.a):(o[u]=i[u],o[u+1]=i[u+1],o[u+2]=i[u+2],o[u+3]=i[u+3])}return new ImageData(o,r,s)}return n},xf=(n,t)=>{const{data:e,width:i,height:r}=n,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let h=0;h<i;h++){const l=(o*i+h)*4;for(let c=0;c<3;c++){const d=l+c;h===0||h===i-1||o===0||o===r-1?s[d]=e[d]:s[d]=t[0]*e[d-i*4-4]+t[1]*e[d-i*4]+t[2]*e[d-i*4+4]+t[3]*e[d-4]+t[4]*e[d]+t[5]*e[d+4]+t[6]*e[d+i*4-4]+t[7]*e[d+i*4]+t[8]*e[d+i*4+4]}s[l+3]=e[l+3]}return new ImageData(s,i,r)},Sf=(n,t)=>{if(n&&n.length===4&&t&&t.length===4){const e=n[3],i=t[3];if(e===255||i===0)return n;if(e===0)return t;{const r=e/255,s=i/255,a=Math.max(Math.min(Math.floor(n[0]*r+t[0]*s*(1-r)),255),0),o=Math.max(Math.min(Math.floor(n[1]*r+t[1]*s*(1-r)),255),0),h=Math.max(Math.min(Math.floor(n[2]*r+t[2]*s*(1-r)),255),0),l=Math.max(Math.min(Math.floor((r+s*(1-r))*255),255),0);return[a,o,h,l]}}return[255,255,255,255]},Cf=function(n,t,e){const i=new Array(n*n),r=function(o){const h=o;let l=0,c=0;return{write(d,f){if(d>>>f)throw new Error("length over");for(;l+f>=8;)h.writeByte(255&(d<<l|c)),f-=8-l,d>>>=8-l,c=0,l=0;c=d<<l|c,l=l+f},flush(){l>0&&h.writeByte(c)}}},s=function(o){const h=1<<o,l=(1<<o)+1;let c=o+1;const d=a();for(let b=0;b<h;b++)d.add(String.fromCharCode(b));d.add(String.fromCharCode(h)),d.add(String.fromCharCode(l));const f=Ol(),u=r(f);u.write(h,c);let m=0,v=String.fromCharCode(i[m]);for(m+=1;m<i.length;){const b=String.fromCharCode(i[m]);m+=1,d.contains(v+b)?v=v+b:(u.write(d.indexOf(v),c),d.size()<4095&&(d.size()==1<<c&&(c+=1),d.add(v+b)),v=b)}return u.write(d.indexOf(v),c),u.write(l,c),u.flush(),f.toByteArray()},a=function(){const o={};let h=0;return{add(l){if(this.contains(l))throw new Error("dup key:"+l);o[l]=h,h+=1},size(){return h},indexOf(l){return o[l]},contains(l){return typeof o[l]<"u"}}};return{setPixel(o,h,l){i[h*n+o]=l},write(o){o.writeString("GIF87a"),o.writeShort(n),o.writeShort(n),o.writeByte(128),o.writeByte(0),o.writeByte(0),o.writeByte($n("0x"+t[1]+t[2])),o.writeByte($n("0x"+t[3]+t[4])),o.writeByte($n("0x"+t[5]+t[6])),o.writeByte($n("0x"+e[1]+e[2])),o.writeByte($n("0x"+e[3]+e[4])),o.writeByte($n("0x"+e[5]+e[6])),o.writeString(","),o.writeShort(0),o.writeShort(0),o.writeShort(n),o.writeShort(n),o.writeByte(0);const h=2,l=s(h);o.writeByte(h);let c=0;for(;l.length-c>255;)o.writeByte(255),o.writeBytes(l,c,255),c+=255;o.writeByte(l.length-c),o.writeBytes(l,c,l.length-c),o.writeByte(0),o.writeString(";")}}},Tf=function(n,t,e,i){const r=Cf(n,t,e);for(let l=0;l<n;l++)for(let c=0;c<n;c++)r.setPixel(c,l,i(c,l));const s=Ol();r.write(s);const a=L1(),o=s.toByteArray();for(let l=0,c=o.length;l<c;l++)a.writeByte(o[l]);a.flush();let h="";return h+="data:image/gif;base64,",h+=a,h},Ne={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},is={M:0,L:1,H:2,Q:3},Wi={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},pe={glog:function(n){if(n<1)throw new Error("glog("+n+")");return pe.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return pe.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(let n=0;n<8;n++)pe.EXP_TABLE[n]=1<<n;for(let n=8;n<256;n++)pe.EXP_TABLE[n]=pe.EXP_TABLE[n-4]^pe.EXP_TABLE[n-5]^pe.EXP_TABLE[n-6]^pe.EXP_TABLE[n-8];for(let n=0;n<255;n++)pe.LOG_TABLE[pe.EXP_TABLE[n]]=n;const ie={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(n){let t=n<<10;for(;ie.getBCHDigit(t)-ie.getBCHDigit(ie.G15)>=0;)t^=ie.G15<<ie.getBCHDigit(t)-ie.getBCHDigit(ie.G15);return(n<<10|t)^ie.G15_MASK},getBCHTypeNumber:function(n){let t=n<<12;for(;ie.getBCHDigit(t)-ie.getBCHDigit(ie.G18)>=0;)t^=ie.G18<<ie.getBCHDigit(t)-ie.getBCHDigit(ie.G18);return n<<12|t},getBCHDigit:function(n){let t=0;for(;n!=0;)t++,n>>>=1;return t},getPatternPosition:function(n){return ie.PATTERN_POSITION_TABLE[n-1]},getMask:function(n,t,e){switch(n){case Wi.PATTERN000:return(t+e)%2==0;case Wi.PATTERN001:return t%2==0;case Wi.PATTERN010:return e%3==0;case Wi.PATTERN011:return(t+e)%3==0;case Wi.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2==0;case Wi.PATTERN101:return t*e%2+t*e%3==0;case Wi.PATTERN110:return(t*e%2+t*e%3)%2==0;case Wi.PATTERN111:return(t*e%3+(t+e)%2)%2==0;default:throw new Error("bad maskPattern:"+n)}},getErrorCorrectPolynomial:function(n){let t=new ir([1],0);for(let e=0;e<n;e++)t=t.multiply(new ir([1,pe.gexp(e)],0));return t},getLengthInBits:function(n,t){if(1<=t&&t<10)switch(n){case Ne.MODE_NUMBER:return 10;case Ne.MODE_ALPHA_NUM:return 9;case Ne.MODE_8BIT_BYTE:return 8;case Ne.MODE_KANJI:return 8;default:throw new Error("mode:"+n)}else if(t<27)switch(n){case Ne.MODE_NUMBER:return 12;case Ne.MODE_ALPHA_NUM:return 11;case Ne.MODE_8BIT_BYTE:return 16;case Ne.MODE_KANJI:return 10;default:throw new Error("mode:"+n)}else if(t<41)switch(n){case Ne.MODE_NUMBER:return 14;case Ne.MODE_ALPHA_NUM:return 13;case Ne.MODE_8BIT_BYTE:return 16;case Ne.MODE_KANJI:return 12;default:throw new Error("mode:"+n)}else throw new Error("type:"+t)},getLostPoint:function(n){const t=n.getModuleCount();let e=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++){let o=0;const h=n.isDark(s,a);for(let l=-1;l<=1;l++)if(!(s+l<0||t<=s+l))for(let c=-1;c<=1;c++)a+c<0||t<=a+c||l==0&&c==0||h==n.isDark(s+l,a+c)&&o++;o>5&&(e+=3+o-5)}for(let s=0;s<t-1;s++)for(let a=0;a<t-1;a++){let o=0;n.isDark(s,a)&&o++,n.isDark(s+1,a)&&o++,n.isDark(s,a+1)&&o++,n.isDark(s+1,a+1)&&o++,(o==0||o==4)&&(e+=3)}for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)n.isDark(s,a)&&!n.isDark(s,a+1)&&n.isDark(s,a+2)&&n.isDark(s,a+3)&&n.isDark(s,a+4)&&!n.isDark(s,a+5)&&n.isDark(s,a+6)&&(e+=40);for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)n.isDark(a,s)&&!n.isDark(a+1,s)&&n.isDark(a+2,s)&&n.isDark(a+3,s)&&n.isDark(a+4,s)&&!n.isDark(a+5,s)&&n.isDark(a+6,s)&&(e+=40);let i=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++)n.isDark(a,s)&&i++;const r=Math.abs(100*i/t/t-50)/5;return e+=r*10,e}};class ir{num;constructor(t,e){if(t.length==null)throw new Error(t.length+"/"+e);let i=0;for(;i<t.length&&t[i]==0;)i++;this.num=new Array(t.length-i+e);for(let r=0;r<t.length-i;r++)this.num[r]=t[r+i]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let i=0;i<this.getLength();i++)for(let r=0;r<t.getLength();r++)e[i+r]^=pe.gexp(pe.glog(this.get(i))+pe.glog(t.get(r)));return new ir(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=pe.glog(this.get(0))-pe.glog(t.get(0)),i=new Array(this.getLength());for(let r=0;r<this.getLength();r++)i[r]=this.get(r);for(let r=0;r<t.getLength();r++)i[r]^=pe.gexp(pe.glog(t.get(r))+e);return new ir(i,0).mod(t)}}class bi{totalCount;dataCount;constructor(t,e){this.totalCount=t,this.dataCount=e}static RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];static getRSBlocks(t,e){const i=bi.getRsBlockTable(t,e);if(i==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);const r=i.length/3,s=[];for(let a=0;a<r;a++){const o=i[a*3+0],h=i[a*3+1],l=i[a*3+2];for(let c=0;c<o;c++)s.push(new bi(h,l))}return s}static getRsBlockTable(t,e){switch(e){case is.L:return bi.RS_BLOCK_TABLE[(t-1)*4+0];case is.M:return bi.RS_BLOCK_TABLE[(t-1)*4+1];case is.Q:return bi.RS_BLOCK_TABLE[(t-1)*4+2];case is.H:return bi.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}class kf{buffer;length;constructor(){this.buffer=[],this.length=0}get(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1}put(t,e){for(let i=0;i<e;i++)this.putBit((t>>>e-i-1&1)==1)}getLengthInBits(){return this.length}putBit(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}class p_{mode;data;constructor(t){this.mode=Ne.MODE_8BIT_BYTE,this.data=t}getLength(){return this.data.length}write(t){for(let e=0,i=this.data.length;e<i;e++)t.put(this.data.charCodeAt(e),8)}}class Ki{static PAD0=236;static PAD1=17;typeNumber;errorCorrectLevel;modules;moduleCount;dataCache;dataList;constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=is[e],this.modules=[],this.moduleCount=0,this.dataCache=null,this.dataList=[]}addData(t){const e=new p_(t);this.dataList.push(e),this.dataCache=null}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){if(this.typeNumber<1){let t=1;for(t=1;t<40;t++){const e=bi.getRSBlocks(t,this.errorCorrectLevel),i=new kf;let r=0;for(let s=0;s<e.length;s++)r+=e[s].dataCount;for(let s=0;s<this.dataList.length;s++){const a=this.dataList[s];i.put(a.mode,4),i.put(a.getLength(),ie.getLengthInBits(a.mode,t)),a.write(i)}if(i.getLengthInBits()<=r*8)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let i=0;i<this.moduleCount;i++){this.modules[i]=new Array(this.moduleCount);for(let r=0;r<this.moduleCount;r++)this.modules[i][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Ki.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let i=-1;i<=7;i++)if(!(t+i<=-1||this.moduleCount<=t+i))for(let r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(0<=i&&i<=6&&(r==0||r==6)||0<=r&&r<=6&&(i==0||i==6)||2<=i&&i<=4&&2<=r&&r<=4?this.modules[t+i][e+r]=!0:this.modules[t+i][e+r]=!1)}getBestMaskPattern(){let t=0,e=0;for(let i=0;i<8;i++){this.makeImpl(!0,i);const r=ie.getLostPoint(this);(i==0||t>r)&&(t=r,e=i)}return e}createMovieClip(t,e,i){const r=t.createEmptyMovieClip(e,i),s=1;this.make();for(let a=0;a<this.modules.length;a++){const o=a*s;for(let h=0;h<this.modules[a].length;h++){const l=h*s;this.modules[a][h]&&(r.beginFill(0,100),r.moveTo(l,o),r.lineTo(l+s,o),r.lineTo(l+s,o+s),r.lineTo(l,o+s),r.endFill())}}return r}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)this.modules[t][6]==null&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=ie.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let i=0;i<t.length;i++){const r=t[e],s=t[i];if(this.modules[r][s]==null)for(let a=-2;a<=2;a++)for(let o=-2;o<=2;o++)a==-2||a==2||o==-2||o==2||a==0&&o==0?this.modules[r+a][s+o]=!0:this.modules[r+a][s+o]=!1}}setupTypeNumber(t){const e=ie.getBCHTypeNumber(this.typeNumber);for(let i=0;i<18;i++){const r=!t&&(e>>i&1)==1;this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=r}for(let i=0;i<18;i++){const r=!t&&(e>>i&1)==1;this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r}}setupTypeInfo(t,e){const i=this.errorCorrectLevel<<3|e,r=ie.getBCHTypeInfo(i);for(let s=0;s<15;s++){const a=!t&&(r>>s&1)==1;s<6?this.modules[s][8]=a:s<8?this.modules[s+1][8]=a:this.modules[this.moduleCount-15+s][8]=a}for(let s=0;s<15;s++){const a=!t&&(r>>s&1)==1;s<8?this.modules[8][this.moduleCount-s-1]=a:s<9?this.modules[8][15-s-1+1]=a:this.modules[8][15-s-1]=a}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let i=-1,r=this.moduleCount-1,s=7,a=0;for(let o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(let h=0;h<2;h++)if(this.modules[r][o-h]==null){let l=!1;a<t.length&&(l=(t[a]>>>s&1)==1),ie.getMask(e,r,o-h)&&(l=!l),this.modules[r][o-h]=l,s--,s==-1&&(a++,s=7)}if(r+=i,r<0||this.moduleCount<=r){r-=i,i=-i;break}}}static createData(t,e,i){const r=bi.getRSBlocks(t,e),s=new kf;for(let o=0;o<i.length;o++){const h=i[o];s.put(h.mode,4),s.put(h.getLength(),ie.getLengthInBits(h.mode,t)),h.write(s)}let a=0;for(let o=0;o<r.length;o++)a+=r[o].dataCount;if(s.getLengthInBits()>a*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put(Ki.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Ki.PAD1,8);return Ki.createBytes(s,r)}static createBytes(t,e){let i=0,r=0,s=0;const a=new Array(e.length),o=new Array(e.length);for(let d=0;d<e.length;d++){const f=e[d].dataCount,u=e[d].totalCount-f;r=Math.max(r,f),s=Math.max(s,u),a[d]=new Array(f);for(let S=0;S<a[d].length;S++)a[d][S]=255&t.buffer[S+i];i+=f;const m=ie.getErrorCorrectPolynomial(u),b=new ir(a[d],m.getLength()-1).mod(m);o[d]=new Array(m.getLength()-1);for(let S=0;S<o[d].length;S++){const E=S+b.getLength()-o[d].length;o[d][S]=E>=0?b.get(E):0}}let h=0;for(let d=0;d<e.length;d++)h+=e[d].totalCount;const l=new Array(h);let c=0;for(let d=0;d<r;d++)for(let f=0;f<e.length;f++)d<a[f].length&&(l[c++]=a[f][d]);for(let d=0;d<s;d++)for(let f=0;f<e.length;f++)d<o[f].length&&(l[c++]=o[f][d]);return l}}const Ef=Math.ceil,ns=Math.floor,Pf=Math.round;function m_(n,t){const e=Il(n),i=t?.ecc||"H",r=t?.size||256,s=-1,a=t?.padding||0,o=t?.color||"#000000",h=t?.background||"#ffffff",l=new Ki(s,i);l.addData(e),l.make();const c=l.getModuleCount(),d=(r-a*2)/c,f=a,u=r-a;return Tf(r,o,h,function(m,v){if(f<=m&&m<u&&f<=v&&v<u){const b=ns((m-f)/d),S=ns((v-f)/d);return l.isDark(S,b)?0:1}else return 1})}function v_(n,t){const e=t.x||0,i=t.y||0,r=Il(n),s=t.ctx,a=t.ecc||"H",o=typeof t.size=="number"?ns(t.size):256,h=t.padding||0,l=-1,c=t.color||"#000000",d=t.background||"#ffffff",f=new Ki(l,a);f.addData(r),f.make();const u=f.getModuleCount(),m=(o-h*2)/u;s.fillStyle=d,s.fillRect(e,i,o,o);for(let v=0;v<u;v++)for(let b=0;b<u;b++){const S=Ef((b+1)*m)-ns(b*m),E=Ef((v+1)*m)-ns(v*m);s.fillStyle=f.isDark(v,b)?c:d,s.fillRect(e+Pf(b*m)+h,i+Pf(v*m)+h,S,E)}}function Fh(){let n=null;if(window.ActiveXObject){const t=["Microsoft.XMLHTTP","MSXML6.XMLHTTP","MSXML5.XMLHTTP","MSXML4.XMLHTTP","MSXML3.XMLHTTP","MSXML2.XMLHTTP","MSXML.XMLHTTP"];for(let e=0;e<t.length;e++)try{n=new window.ActiveXObject(t[e]);break}catch{continue}}else n=new XMLHttpRequest;return n}function __(n){if(!n.action)return{url:"",data:"",boundary:""};const t=n.method.toLowerCase()==="get",e=n.method.toLowerCase()==="post";let i=n.action,r="";const s="---------------------------"+Date.now().toString(16);if(window.FormData)r=new FormData(n),t&&(i=wa(i,eh(r)));else if(t){let a="";for(let o=0;o<n.elements.length;o++){const h=n.elements[o];if(!h.hasAttribute("name"))continue;const l=h.nodeName.toUpperCase()==="INPUT"?h.getAttribute("type")?.toUpperCase():"TEXT";if(l==="FILE")for(let c=0,d=h.files?.length??0;c<d;a+="&"+encodeURIComponent(h.name)+"="+encodeURIComponent(h.files?.[c++].name??""));else(l!=="RADIO"&&l!=="CHECKBOX"||h.checked)&&(a+="&"+encodeURIComponent(h.name)+"="+encodeURIComponent(h.value))}i=wa(i,a)}else if(e){const a=[];if(n.enctype==="application/x-www-form-urlencoded"){for(let o=0;o<n.elements.length;o++){const h=n.elements[o];h.hasAttribute("name")&&a.push(encodeURIComponent(h.name)+"="+encodeURIComponent(h.value))}r=a.join("&")}else if(n.enctype==="text/plain"){for(let o=0;o<n.elements.length;o++){const h=n.elements[o];h.hasAttribute("name")&&a.push(h.name+"="+h.value)}r=a.join(`\r
|
|
30
30
|
`)}else if(n.enctype==="multipart/form-data"){for(let o=0;o<n.elements.length;o++){const h=n.elements[o];if(!h.hasAttribute("name"))continue;if((h.nodeName.toUpperCase()==="INPUT"?h.getAttribute("type")?.toUpperCase():"TEXT")==="FILE")for(let c=0,d=h.files?.length??0;c<d;c++){const f=h.files?.[c];a.push('Content-Disposition: form-data; name="'+h.name+'"; filename="'+f?.name+`"\r
|
|
31
31
|
Content-Type: `+f?.type+`\r
|
|
32
32
|
\r
|
|
@@ -34,12 +34,12 @@ Content-Type: `+f?.type+`\r
|
|
|
34
34
|
\r
|
|
35
35
|
`+h.value+`\r
|
|
36
36
|
`)}r=a.join(s+`\r
|
|
37
|
-
`)}}return{url:i,data:r,boundary:s}}function
|
|
37
|
+
`)}}return{url:i,data:r,boundary:s}}function y_(n){return new Promise((t,e)=>{const{method:i="GET",url:r="",data:s="",headers:a={},responseType:o="json",timeout:h=3e4,boundary:l=""}=n;Object.assign(a,{Accept:"*/*"});const c=Fh();c.onreadystatechange=function(u){c.readyState===4&&(c.status===200?t(c.response):e(c.statusText))},c.ontimeout=function(){e(`${r} is timed out for ${h}ms.`)},c.addEventListener("error",function(u){e(u)},!1),c.addEventListener("progress",function(u){if(u.lengthComputable){const m=Math.round(u.loaded*100/u.total);n.progress?.(m)}},!1),c.addEventListener("load",function(u){n.load?.(u)},!1),c.addEventListener("loadstart",function(u){n.loadstart?.(u)},!1),c.addEventListener("loadend",function(u){n.loadend?.(u)},!1),c.addEventListener("abort",function(u){n.abort?.(u)},!1),c.timeout=h,c.responseType=o;const d=i.toUpperCase();function f(){for(const u in a)c.setRequestHeader(u,a[u]);l&&c.setRequestHeader("Content-Type","multipart/form-data; boundary="+l)}if(d==="GET"){let u="";typeof s=="string"?u=s:s instanceof FormData?u=eh(s):na(s)&&(u=Kc(s)),c.open("GET",wa(r,u),!0),f(),c.send(null)}else d==="POST"?(c.open("POST",r,!0),f(),l?c.sendAsBinary(l+`\r
|
|
38
38
|
`+s+l+`--\r
|
|
39
|
-
`):c.send(JSON.stringify(s))):(c.open(d,r,!0),f(),c.send(JSON.stringify(s)))})}function c_(n,t){const e=Lh();e.open("HEAD",n),e.filepath=n,e.callback=t,e.onload=function(){const i=parseFloat(window.localStorage.getItem("lm_"+this.filepath)??""),r=Date.parse(this.getResponseHeader("Last-Modified"));(isNaN(i)||r>i)&&(window.localStorage.setItem("lm_"+this.filepath,String(Date.now())),isFinite(i)&&this.callback(r,i))},e.send()}let Ia;const Ef=new WeakMap;function Ih(n,t){let e=Ef.get(n);e||(e=new Map,Ef.set(n,e));let i=e.get(t);return i||(i=new Pf,e.set(t,i)),i}class Pf{subscribers;constructor(){this.subscribers=new Set}depend(){Ia&&this.subscribers.add(Ia)}notify(){this.subscribers.forEach(t=>t())}}function u_(n){Ia=n,n(),Ia=null}function f_(n){return Object.keys(n).forEach(t=>{let e=n[t];const i=Ih(n,t);Object.defineProperty(n,t,{get(){return i.depend(),e},set(r){r!=e&&(e=r,i.notify())}})}),n}function d_(n){return new Proxy(n,{get(t,e,i){return Ih(n,e).depend(),Reflect.get(t,e,i)},set(t,e,i,r){const s=Ih(n,e);return n[e]!=i&&(n[e]=i,s.notify()),Reflect.set(t,e,i,r)}})}let es;typeof self>"u"&&typeof process<"u"&&process.hrtime?es=function(){const n=process.hrtime();return n[0]*1e3+n[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?es=self.performance.now.bind(self.performance):Date.now!==void 0?es=Date.now:es=function(){return new Date().getTime()};const ir=es;class is{static _nextId=0;static nextId(){return is._nextId++}}const Oa={Linear:{None:function(n){return n}},Ease:{In:function(n){return Math.pow(n,1.7)}},Quadratic:{In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}},Cubic:{In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}},Quartic:{In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}},Quintic:{In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}},Sinusoidal:{In:function(n){return 1-Math.sin((1-n)*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}},Exponential:{In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}},Circular:{In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}},Elastic:{In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}},Back:{In:function(n){return n===1?1:n*n*((1.70158+1)*n-1.70158)},Out:function(n){return n===0?0:--n*n*((1.70158+1)*n+1.70158)+1},InOut:function(n){const t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}},Bounce:{In:function(n){return 1-Oa.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?Oa.Bounce.In(n*2)*.5:Oa.Bounce.Out(n*2-1)*.5+.5}},generatePow:function(n=4){return n=n<Number.EPSILON?Number.EPSILON:n,n=n>1e4?1e4:n,{In:function(t){return t**n},Out:function(t){return 1-(1-t)**n},InOut:function(t){return t<.5?(t*2)**n/2:(1-(2-t*2)**n)/2+.5}}},random:function(n){return Math.random()},createStep:function(n){return function(t){return Math.floor(t*n)/n}},createNoisyEasing:function(n,t=.1){const e=1-t;return function(i){return t*Math.random()+e*n(i)}}},Oh=Oa,ns={Utils:{Linear:function(n,t,e){return(t-n)*e+n},Factorial:function(){const n=[1];return function(t){let e=1;if(n[t])return n[t];for(let i=t;i>1;i--)e*=i;return n[t]=e,e}}(),Bernstein:function(n,t){const e=ns.Utils.Factorial;return e(n)/e(t)/e(n-t)},CatmullRom:function(n,t,e,i,r){const s=(e-n)*.5,a=(i-t)*.5,o=r*r,h=r*o;return(2*t-2*e+s+a)*h+(-3*t+3*e-2*s-a)*o+s*r+t}},Linear:function(n,t){const e=n.length-1,i=e*t,r=Math.floor(i),s=ns.Utils.Linear;return t<0?s(n[0],n[1],i):t>1?s(n[e],n[e-1],e-i):s(n[r],n[r+1>e?e:r+1],i-r)},Bezier:function(n,t){let e=0;const i=n.length-1,r=Math.pow,s=ns.Utils.Bernstein;for(let a=0;a<=i;a++)e+=r(1-t,i-a)*r(t,a)*n[a]*s(i,a);return e},CatmullRom:function(n,t){const e=n.length-1;let i=e*t,r=Math.floor(i);const s=ns.Utils.CatmullRom;return n[0]===n[e]?(t<0&&(r=Math.floor(i=e*(1+t))),s(n[(r-1+e)%e],n[r],n[(r+1)%e],n[(r+2)%e],i-r)):t<0?n[0]-(s(n[0],n[0],n[1],n[1],-i)-n[0]):t>1?n[e]-(s(n[e],n[e],n[e-1],n[e-1],i-e)-n[e]):s(n[r?r-1:0],n[r],n[e<r+1?e:r+1],n[e<r+2?e:r+2],i-r)}},Fh=ns;let Af=class{_tweens={};_tweensAddedDuringUpdate={};getAll(){return Object.keys(this._tweens).map(t=>this._tweens[t])}removeAll(){this._tweens={}}add(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t}remove(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]}update(t=ir(),e=!1){let i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(let r=0;r<i.length;r++){const s=this._tweens[i[r]],a=!e;s&&s.update(t,a)===!1&&!e&&delete this._tweens[i[r]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0}};const je=new Af,g_=class{constructor(t,e=je){this._object=t,this._group=e}_id=is.nextId();_isPlaying=!1;_startTime=0;_delayTime=0;_durationTime=1e3;_isPaused=!1;_pauseStartTime=0;_initialRepeat=0;_repeat=0;_repeatDelayTime;_yoyo=!1;_reversed=!1;_valuesStart={};_valuesEnd={};_valuesStartRepeat={};_easingFunction=Oh.Linear.None;_interpolationFunction=Fh.Linear;_chainedTweens=[];_isChainStopped=!1;_onStartCallback;_onStartCallbackFired=!1;_onEveryStartCallback;_onEveryStartCallbackFired=!1;_onUpdateCallback;_onRepeatCallback;_onCompleteCallback;_onStopCallback;_goToEnd=!1;getId(){return this._id}isPlaying(){return this._isPlaying}isPaused(){return this._isPaused}to(t,e){return this._valuesEnd=Object.create(t),e!==void 0&&(this._durationTime=e),this}duration(t=1e3){return this._durationTime=t,this}start(t=ir()){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(const e in this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this}_setupProperties(t,e,i,r){for(const s in i){const a=t[s],o=Array.isArray(a),h=o?"array":typeof a,l=!o&&Array.isArray(i[s]);if(!(h==="undefined"||h==="function")){if(l){let c=i[s];if(c.length===0)continue;c=c.map(this._handleRelativeValue.bind(this,a)),i[s]=[a].concat(c)}if((h==="object"||o)&&a&&!l){e[s]=o?[]:{};for(const c in a)e[s][c]=a[c];r[s]=o?[]:{},this._setupProperties(a,e[s],i[s],r[s])}else typeof e[s]>"u"&&(e[s]=a),o||(e[s]*=1),l?r[s]=i[s].slice().reverse():r[s]=e[s]||0}}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this}end(){return this._goToEnd=!0,this.update(1/0),this}pause(t=ir()){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStartTime=t,this._group&&this._group.remove(this),this)}resume(t=ir()){return!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStartTime,this._pauseStartTime=0,this._group&&this._group.add(this),this)}stopChainedTweens(){for(let t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this}group(t=je){return this._group=t,this}delay(t=0){return this._delayTime=t,this}repeat(t=0){return this._initialRepeat=t,this._repeat=t,this}repeatDelay(t){return this._repeatDelayTime=t,this}yoyo(t=!1){return this._yoyo=t,this}easing(t=Oh.Linear.None){return this._easingFunction=t,this}interpolation(t=Fh.Linear){return this._interpolationFunction=t,this}chain(...t){return this._chainedTweens=t,this}onStart(t){return this._onStartCallback=t,this}onEveryStart(t){return this._onEveryStartCallback=t,this}onUpdate(t){return this._onUpdateCallback=t,this}onRepeat(t){return this._onRepeatCallback=t,this}onComplete(t){return this._onCompleteCallback=t,this}onStop(t){return this._onStopCallback=t,this}update(t=ir(),e=!0){if(this._isPaused)return!0;let i,r;const s=this._startTime+this._durationTime;if(!this._goToEnd&&!this._isPlaying){if(t>s)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),r=(t-this._startTime)/this._durationTime,r=this._durationTime===0||r>1?1:r;const a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(let o=0,h=this._chainedTweens.length;o<h;o++)this._chainedTweens[o].start(this._startTime+this._durationTime);return this._isPlaying=!1,!1}return!0}_updateProperties(t,e,i,r){for(const s in i){if(e[s]===void 0)continue;const a=e[s]||0;let o=i[s];const h=Array.isArray(t[s]),l=Array.isArray(o);!h&&l?t[s]=this._interpolationFunction(o,r):typeof o=="object"&&o?this._updateProperties(t[s],a,o,r):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(t[s]=a+(o-a)*r))}}_handleRelativeValue(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)}_swapEndStartRepeatValues(t){const e=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=i,this._valuesEnd[t]=e}},p_=is.nextId,m_=je.getAll.bind(je),v_=je.removeAll.bind(je),__=je.add.bind(je),y_=je.remove.bind(je),w_=je.update.bind(je),b_={now:ir,Sequence:is,Easing:Oh,Interpolation:Fh,Group:Af,Tween:g_,nextId:p_,getAll:m_,removeAll:v_,add:__,remove:y_,update:w_};class Fa extends Wt{app;rotate;scale;isMouseDownInBounds=!1;constructor(t,e={x:0,y:0}){super(e),this.rotate=e.rotate??0,this.scale=e.scale??1,this.app=t,this.app.on("mouseDown",i=>{this.isMouseDownInBounds=this.getBounds().isContainPoint(this.app.mouse.point)}),this.app.on("mouseUp",i=>{this.isMouseDownInBounds=!1}),this.app.on("mouseMove",i=>{this.isMouseDownInBounds&&(this.x=this.app.mouse.point.x,this.y=this.app.mouse.point.y)})}draw(t){this._draw({extra:t,init:()=>{},shape:()=>{}})}_draw({init:t,extra:e,shape:i}){this.app.ctx.save(),t?.(this.app),e?.(this.app),this.app.ctx.translate(this.x,this.y),this.app.ctx.rotate(this.rotate),this.app.ctx.scale(this.scale,this.scale),i(this.app),this.app.ctx.restore()}}class x_ extends Fa{constructor(t,e={x:0,y:0}){super(t,e)}draw(t){super._draw({extra:t,init:e=>{e.ctx.lineWidth=2,e.ctx.fillStyle="#ffff00"},shape:e=>{e.ctx.beginPath(),e.ctx.moveTo(-50,-25),e.ctx.lineTo(0,-25),e.ctx.lineTo(0,-50),e.ctx.lineTo(50,0),e.ctx.lineTo(0,50),e.ctx.lineTo(0,25),e.ctx.lineTo(-50,25),e.ctx.lineTo(-50,-25),e.ctx.closePath(),e.ctx.fill(),e.ctx.lineWidth>0&&e.ctx.stroke()}})}}class S_ extends Fa{radius;constructor(t,e={x:0,y:0,radius:40}){super(t,e),this.radius=e.radius}draw(t){super._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.fillStyle="#ff0000"},shape:e=>{e.ctx.beginPath(),e.ctx.arc(0,0,this.radius,0,Math.PI*2,!0),e.ctx.closePath(),e.ctx.fill(),e.ctx.lineWidth>0&&e.ctx.stroke()}})}}class C_ extends Fa{toX;toY;c1x;c1y;c2x;c2y;constructor(t,e={x:0,y:0,toX:0,toY:0}){super(t,e),this.toX=e.toX,this.toY=e.toY,this.c1x=e.c1x??0,this.c1y=e.c1y??0,this.c2x=e.c2x??0,this.c2y=e.c2y??0}draw(t){this._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.strokeStyle="#eeeeee"},shape:e=>{e.ctx.beginPath(),e.ctx.moveTo(0,0),e.ctx.lineTo(this.toX-this.x,this.toY-this.y),e.ctx.lineWidth>0&&e.ctx.stroke()}})}drawQuadratic(t){this._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.strokeStyle="#eeeeee"},shape:e=>{e.ctx.beginPath(),e.ctx.moveTo(0,0),e.ctx.quadraticCurveTo(this.c1x-this.x,this.c1y-this.y,this.toX-this.x,this.toY-this.y),e.ctx.lineWidth>0&&e.ctx.stroke()}})}drawQuadraticThrough(t){this._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.strokeStyle="#eeeeee"},shape:e=>{e.ctx.beginPath(),e.ctx.moveTo(0,0);const i=this.c1x*2-(this.x+this.toX)/2,r=this.c1y*2-(this.y+this.toY)/2;e.ctx.quadraticCurveTo(i-this.x,r-this.y,this.toX-this.x,this.toY-this.y),e.ctx.lineWidth>0&&e.ctx.stroke()}})}drawQuadraticThroughCurve(t,e){this._draw({extra:e,init:i=>{i.ctx.lineWidth=1,i.ctx.strokeStyle="#eeeeee"},shape:i=>{const r=t.length;if(r<3)return new Error("points length must >= 3");const s=(t[0].x+t[r-1].x)/2,a=(t[0].y+t[r-1].y)/2;i.ctx.beginPath(),i.ctx.moveTo(s,a);let o=0;for(;o<r-1;o++){const h=(t[o].x+t[o+1].x)/2,l=(t[o].y+t[o+1].y)/2;i.ctx.quadraticCurveTo(t[o].x-this.x,t[o].y-this.y,h-this.x,l-this.y)}i.ctx.quadraticCurveTo(t[o].x-this.x,t[o].y-this.y,s-this.x,a-this.y),i.ctx.lineWidth>0&&i.ctx.stroke()}})}drawQuadraticThroughCurveNotGood(t,e){this._draw({extra:e,init:i=>{i.ctx.lineWidth=1,i.ctx.strokeStyle="#eeeeee"},shape:i=>{const r=t.length;if(r<3)return new Error("points length must >= 3");i.ctx.beginPath(),i.ctx.moveTo(t[0].x,t[0].y);let s=1;for(;s<r-2;s++){const a=(t[s].x+t[s+1].x)/2,o=(t[s].y+t[s+1].y)/2;i.ctx.quadraticCurveTo(t[s].x-this.x,t[s].y-this.y,a-this.x,o-this.y)}i.ctx.quadraticCurveTo(t[s].x-this.x,t[s].y-this.y,t[s+1].x-this.x,t[s+1].y-this.y),i.ctx.lineWidth>0&&i.ctx.stroke()}})}getBounds(){if(this.rotate===0){const t=Math.min(this.x,this.toX),e=Math.min(this.y,this.toY),i=Math.max(this.x,this.toX),r=Math.max(this.y,this.toY);return new jn({x:t,y:e,width:i-t,height:r-e})}else{const t=Math.sin(this.rotate),e=Math.cos(this.rotate),i=e*this.x-t*this.y,r=e*this.toX-t*this.toY,s=e*this.y+t*this.x,a=e*this.toY+t*this.toX;return new jn({x:Math.min(i,r),y:Math.min(s,a),width:Math.max(i,r)-Math.min(i,r),height:Math.max(s,a)-Math.min(s,a)})}}}class T_ extends Fa{width;height;borderRadius;rect;constructor(t,e={x:0,y:0,width:50,height:50}){return super(t,e),this.width=e.width,this.height=e.height,this.borderRadius=e.borderRadius??0,this.rect=new jn({x:this.x,y:this.y,width:this.width,height:this.height}),new Proxy(this,{get:(r,s,a)=>Reflect.get(r,s,a),set:(r,s,a,o)=>{switch(s){case"x":case"y":case"width":case"height":this.rect[s]=a;break}return Reflect.set(r,s,a,o)}})}draw(t){this._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.fillStyle="#ff0000"},shape:e=>{e.ctx.beginPath(),this.borderRadius<=0?e.ctx.rect(0,0,this.width,this.height):(e.ctx.moveTo(0,0+this.borderRadius),e.ctx.lineTo(0,0+this.height-this.borderRadius),e.ctx.quadraticCurveTo(0,0+this.height,0+this.borderRadius,0+this.height),e.ctx.lineTo(0+this.width-this.borderRadius,0+this.height),e.ctx.quadraticCurveTo(0+this.width,0+this.height,0+this.width,0+this.height-this.borderRadius),e.ctx.lineTo(0+this.width,0+this.borderRadius),e.ctx.quadraticCurveTo(0+this.width,0,0+this.width-this.borderRadius,0),e.ctx.lineTo(0+this.borderRadius,0),e.ctx.quadraticCurveTo(0,0,0,0+this.borderRadius)),e.ctx.closePath(),e.ctx.fill(),e.ctx.lineWidth>0&&e.ctx.stroke()}})}getBounds(){return this.rect}}class Mf{x;y;z;brightness;constructor(t,e,i,r){this.x=t,this.y=e,this.z=i,this.brightness=r}setBrightness(t){this.brightness=Math.min(Math.max(t,0),1)}}class k_{x;y;width;height;rotation;showFlame;constructor(){this.x=0,this.y=0,this.width=25,this.height=20,this.rotation=0,this.showFlame=!1}draw(t,e){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=1,t.strokeStyle="#ffffff",e?.(t),t.beginPath(),t.moveTo(10,0),t.lineTo(-10,10),t.lineTo(-5,0),t.lineTo(-10,-10),t.lineTo(10,0),t.closePath(),t.stroke(),this.showFlame&&(t.beginPath(),t.moveTo(-7.5,-5),t.lineTo(-15,0),t.lineTo(-7.5,5),t.closePath(),t.stroke()),t.restore()}}class E_{x;y;scaleX;scaleY;color;alpha;lineWidth;branch;constructor(){this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.color="#ffffff",this.alpha=1,this.lineWidth=1,this.branch=[],this.branch[0]=-140-Math.random()*20,this.branch[1]=-30-Math.random()*30,this.branch[2]=Math.random()*80-40,this.branch[3]=-100-Math.random()*40,this.branch[4]=-60-Math.random()*40,this.branch[5]=Math.random()*60-30,this.branch[6]=-110-Math.random()*20}draw(t,e){t.save(),t.translate(this.x,this.y),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.strokeStyle=Zo(this.color,this.alpha),e?.(t),t.beginPath(),t.moveTo(0,0),t.lineTo(0,this.branch[0]),t.moveTo(0,this.branch[1]),t.lineTo(this.branch[2],this.branch[3]),t.moveTo(0,this.branch[4]),t.lineTo(this.branch[5],this.branch[6]),t.stroke(),t.restore()}}class P_{x;y;z;fl;vpX;vpY;cX;cY;cZ;constructor(t,e,i){this.x=t,this.y=e,this.z=i,this.fl=250,this.vpX=0,this.vpY=0,this.cX=0,this.cY=0,this.cZ=0}setVanishingPoint(t,e){this.vpX=t,this.vpY=e}setCenter(t,e,i){this.cX=t,this.cY=e,this.cZ=i}rotateX(t){const e=Math.cos(t),i=Math.sin(t),r=this.y*e-this.z*i,s=this.z*e+this.y*i;this.y=r,this.z=s}rotateY(t){const e=Math.cos(t),i=Math.sin(t),r=this.x*e-this.z*i,s=this.z*e+this.x*i;this.x=r,this.z=s}rotateZ(t){const e=Math.cos(t),i=Math.sin(t),r=this.x*e-this.y*i,s=this.y*e+this.x*i;this.x=r,this.y=s}getScreenX(){const t=this.fl/(this.fl+this.z+this.cZ);return this.vpX+(this.cX+this.x)*t}getScreenY(){const t=this.fl/(this.fl+this.z+this.cZ);return this.vpY+(this.cY+this.y)*t}}class A_{pointA;pointB;pointC;color;lineWidth;alpha;constructor(t,e,i,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=i,this.color=r,this.lineWidth=1,this.alpha=1}draw(t,e){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=Zo(this.color,this.alpha),e?.(t),t.beginPath(),t.moveTo(this.pointA.getScreenX(),this.pointA.getScreenY()),t.lineTo(this.pointB.getScreenX(),this.pointB.getScreenY()),t.lineTo(this.pointC.getScreenX(),this.pointC.getScreenY()),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore())}getDepth(){return Math.min(this.pointA.z,this.pointB.z,this.pointC.z)}isBackface(){const t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),i=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*i}}class M_{pointA;pointB;pointC;color;lineWidth;alpha;light;constructor(t,e,i,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=i,this.color=r,this.lineWidth=1,this.alpha=1,this.light=new Mf(0,0,0,1)}draw(t,e){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=this.getAdjustedColor(),e?.(t),t.beginPath(),t.moveTo(this.pointA.getScreenX(),this.pointA.getScreenY()),t.lineTo(this.pointB.getScreenX(),this.pointB.getScreenY()),t.lineTo(this.pointC.getScreenX(),this.pointC.getScreenY()),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore())}getDepth(){return Math.min(this.pointA.z,this.pointB.z,this.pointC.z)}isBackface(){const t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),i=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*i}getAdjustedColor(){const t=ya(this.color);let e=t>>16,i=t>>8&255,r=t&255;const s=this.getLightFactor();return e*=s,i*=s,r*=s,Hc(e<<16|i<<8|r)}getLightFactor(){const t={x:this.pointA.x-this.pointB.x,y:this.pointA.y-this.pointB.y,z:this.pointA.z-this.pointB.z},e={x:this.pointB.x-this.pointC.x,y:this.pointB.y-this.pointC.y,z:this.pointB.z-this.pointC.z},i={x:t.y*e.z-t.z*e.y,y:-(t.x*e.z-t.z*e.x),z:t.x*e.y-t.y*e.x},r=i.x*this.light.x+i.y*this.light.y+i.z*this.light.z,s=Math.sqrt(i.x*i.x+i.y*i.y+i.z*i.z),a=Math.sqrt(this.light.x*this.light.x+this.light.y*this.light.y+this.light.z*this.light.z);return Math.acos(r/(s*a))/Math.PI*this.light.brightness}}class R_{min;max;value;x;y;width;height;backColor;backBorderColor;backWidth;handleColor;handleBorderColor;handleHeight;handleY;onchange;prevCanvas;currentContext;animatedID=0;constructor(t=0,e=100,i=0,r){this.min=t,this.max=e,this.value=i,this.onchange=r,this.x=0,this.y=0,this.width=16,this.height=100,this.backColor="#cccccc",this.backBorderColor="#999999",this.backWidth=4,this.handleColor="#eeeeee",this.handleBorderColor="#cccccc",this.handleHeight=6,this.handleY=0,this.updatePosition()}draw(t,e){this.currentContext=t,t.save(),t.translate(this.x,this.y),e?.(t),t.clearRect(this.x,this.y,this.width,this.height),t.fillStyle=this.backColor,t.beginPath(),t.fillRect(this.width/2-this.backWidth/2,0,this.backWidth,this.height),t.closePath(),t.strokeStyle=this.handleBorderColor,t.fillStyle=this.handleColor,t.beginPath(),t.rect(0,this.handleY,this.width,this.handleHeight),t.closePath(),t.fill(),t.stroke(),t.restore(),(!this.prevCanvas||this.prevCanvas!=t.canvas)&&(this.captureMouse(t.canvas),this.prevCanvas=t.canvas)}updateValue(){const t=this.value,e=this.height-this.handleHeight,i=this.max-this.min;this.value=(e-this.handleY)/e*i+this.min,this.value!==t&&(this.onchange?.(this.value),Ko((r,s)=>{this.animatedID=s,this.currentContext&&this.draw(this.currentContext)}))}updatePosition(){const t=this.height-this.handleHeight,e=this.max-this.min;this.handleY=t-(this.value-this.min)/e*t}captureMouse(t){const e=new jn({x:0,y:0,width:0,height:0}),i=()=>{e.x=this.x,e.y=this.y+this.handleY,e.width=this.width,e.height=this.handleHeight};i();let r=!1;new Pr().captureMouse(t,{move:a=>{if(r){const o=a.y-this.y;this.handleY=Math.min(this.height-this.handleHeight,Math.max(o,0)),this.updateValue()}},start:a=>{r=e.isContainPoint(a)},end:a=>{i(),window.cancelAnimationFrame(this.animatedID)}})}}class D_{x;y;width;height;rotation;scaleX;scaleY;color;lineWidth;constructor(t,e,i="#ffffff"){this.x=0,this.y=0,this.width=t,this.height=e,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=i,this.lineWidth=1}draw(t,e){const i=this.height,r=this.width+i,s=i/2;t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,e?.(t),t.beginPath(),t.moveTo(0,-s),t.lineTo(r-2*s,-s),t.quadraticCurveTo(-s+r,-s,-s+r,0),t.lineTo(-s+r,i-2*s),t.quadraticCurveTo(-s+r,-s+i,r-2*s,-s+i),t.lineTo(0,-s+i),t.quadraticCurveTo(-s,-s+i,-s,i-2*s),t.lineTo(-s,0),t.quadraticCurveTo(-s,-s,0,-s),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.beginPath(),t.arc(0,0,2,0,Math.PI*2,!0),t.closePath(),t.stroke(),t.beginPath(),t.arc(this.width,0,2,0,Math.PI*2,!0),t.closePath(),t.stroke(),t.restore()}getPin(){return{x:this.x+Math.cos(this.rotation)*this.width,y:this.y+Math.sin(this.rotation)*this.width}}}class L_{R;r;O;constructor(t,e,i){this.R=t,this.r=e,this.O=i}draw(t,e){t.save(),e?.(t);let i=this.R-this.O,r=0,s=1;t.beginPath(),t.moveTo(i,r);let a,o;do{if(s>2e4)break;a=(this.R+this.r)*Math.cos(s*Math.PI/72)-(this.r+this.O)*Math.cos((this.R+this.r)/this.r*(s*Math.PI/72)),o=(this.R+this.r)*Math.sin(s*Math.PI/72)-(this.r+this.O)*Math.sin((this.R+this.r)/this.r*(s*Math.PI/72)),t.lineTo(a,o),i=a,r=o,s++}while(a!=this.R-this.O&&o!=0);t.stroke(),t.restore()}}class I_{r;constructor(t){this.r=t}draw(t,e){t.save(),e?.(t),t.beginPath(),t.moveTo(this.r,0);for(let i=0;i<9;i++)t.rotate(Math.PI/5),i%2==0?t.lineTo(this.r/.525731*.200811,0):t.lineTo(this.r,0);t.closePath(),t.fill(),t.restore()}}class O_{startX;startY;width;height;constructor(t,e,i,r){this.startX=t,this.startY=e,this.width=i,this.height=r}draw(t,e){t.save(),e?.(t);let i=0;const r=()=>{t.clearRect(this.startX,this.startY,this.width,this.height),t.setLineDash([4,2]),t.lineDashOffset=-i,t.strokeRect(this.startX,this.startY,this.width,this.height)};function s(){i++,i>16&&(i=0),r(),setTimeout(s,40)}s(),t.restore()}}class F_{constructor(){}draw(t,e){t.save(),e?.(t),t.beginPath(),t.arc(75,75,50,0,Math.PI*2,!0),t.moveTo(110,75),t.arc(75,75,35,0,Math.PI,!1),t.moveTo(65,65),t.arc(60,65,5,0,Math.PI*2,!0),t.moveTo(95,65),t.arc(90,65,5,0,Math.PI*2,!0),t.stroke(),t.restore()}}function Rf(n){switch(n){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-in-out":return[.42,0,.58,1];case"ease-out":return[0,0,.58,1]}}const N_={attributeName:["display"],values:[["block","block"]]},Me={easeName:"linear",begin:0,dur:300,repeatCount:1,direction:"normal",fill:"freeze",keyTimes:[0,1]};class G_{currentAnimateName;objects=[];actions=[];constructor(){}hasObjects(){return this.objects.length>0}fromDOM(t){return Array.isArray(t)||(t=[t]),this.objects=[],t.forEach(e=>{const i=Do(e);this.objects.push({width:parseFloat(i.css("width")),height:parseFloat(i.css("height")),dom:i,el:e,originCSSObject:i.css()})}),this}toCSS(t,...e){if(!this.hasObjects())return;switch(this.currentAnimateName=t,this[t](...e),this.objects[0].dom?.parent().css({position:"relative",perspective:"1000px",overflow:"hidden"}),t){default:this.objects.forEach((s,a)=>{s.dom?.css({position:"absolute","z-index":String(1e3+a),"transform-style":"preserve-3d","backface-visibility":"hidden"})});break}let i=0;const r=()=>{this.actions.forEach((s,a)=>{const o=this.objects[s.objectIndex];let h=[],l=[];Array.isArray(s.attributeName)?(h=s.attributeName,l=s.values):s.attributeName&&(h=[s.attributeName],l=[s.values]);const c=s.keyTimes.length,d=Ar(o.dom?.css("transform")??"");let f=s.begin;s.keyTimes.forEach((u,m)=>{const v={_matrix:d};h.forEach((b,S)=>{const E=l[S][s.direction=="reverse"?c-m-1:m];this._transformAttributeToCSSObjectUseMatrix(b,E,v)}),m==0?o.dom?.css(Object.assign(v,{transition:""})):(setTimeout(()=>{o.dom?.css(Object.assign(v,{transition:`all ${s.realKeyTimes[m]}ms cubic-bezier(${s.keySplines[m-1].join(",")})`}))},f),f+=s.realKeyTimes[m])}),setTimeout(()=>{s.fill==="remove"&&o.dom?.css(o.originCSSObject??{}),a==this.actions.length-1&&(typeof s.repeatCount=="number"&&++i<s.repeatCount||s.repeatCount=="infinite")&&requestAnimationFrame(()=>{this.currentAnimateName===t&&r()})},s.begin+s.dur)})};r()}_transformAttributeToCSSObjectUseMatrix(t,e,i={}){switch(t){case"translateTo":i._matrix.translateTo(e[0]??0,e[1]??0);break;case"translate":i._matrix.translate(e[0]??0,e[1]??0);break;case"rotate":i._matrix.rotate(e??0);break;case"rotateXTo":i._matrix.rotateXTo(e??0);break;case"rotateYTo":i._matrix.rotateYTo(e??0);break;case"scaleTo":typeof e=="number"?i._matrix.scaleTo(e??1):i._matrix.scaleTo(e[0]??1,e[1]??1);break;case"scale":typeof e=="number"?i._matrix.scale(e??1):i._matrix.scale(e[0]??1,e[1]??1);break;case"scaleX":i._matrix.scale(e??1,1);break;case"scaleY":i._matrix.scale(1,e??1);break;default:Object.assign(i,{[t]:`${e??""}`});break}return Object.assign(i,{transform:i._matrix.toString()}),i}_addAction(t,e=!1){return this.actions=e?[]:this.actions,Array.isArray(t)||(t=[t]),t.forEach(i=>{this.actions.push(Object.assign(i,{realKeyTimes:i.keyTimes.map(r=>i.dur*r)}))}),this}_addAnimate(t=N_,e=Me,i=0,r=!1){const s=e.keyTimes??[0,1],a=[];return s.forEach((o,h)=>{h>0&&a.push(Rf(e.easeName??"linear"))}),this._addAction({objectIndex:i,attributeName:t.attributeName,values:t.values,begin:e.begin??0,dur:e.dur??300,keyTimes:s,keySplines:a,repeatCount:e.repeatCount??1,direction:e.direction??"normal",fill:e.fill??"freeze"},r),this}_predefinedAnimate(t,e,i,r,s=Me,a=this.objects.length-1){let o=!0,h=!1,l=!1,c=!1;const d=this.objects.length;a=(a+d)%d;const f=(a-1+d)%d,u=(a+1+d)%d,m=this.objects[a],v=this.objects[f],b=this.objects[u];if(v&&f!==a){const S=t(v);S&&(this._addAnimate(S,s,f,o),o=!1,h=!0)}if(m){const S=e(m);S&&(this._addAnimate(S,s,a,o),o=!1,l=!0)}if(b&&u!==a){const S=i(b);S&&(this._addAnimate(S,s,u,o),o=!1,c=!0)}this.objects.forEach((S,E)=>{if(!(E==f&&h||E==a&&l||E==u&&c)){const _=r(S);_&&(this._addAnimate(_,s,E,o),o=!1)}})}flip(t=Me,e=this.objects.length-1){const i=e-1,r=this.objects[i],s=this.objects[e],a=Ar(s.dom?.css("transform")??""),o=a.clone();r.dom?.show(),r.dom?.css("opacity","1");const h=r.el?.getBoundingClientRect();r.dom?.css("opacity","0"),s.dom?.show(),s.dom?.css("opacity","1");const l=s.el?.getBoundingClientRect(),c=r.dom?.css("background-color"),d=s.dom?.css("background-color");o.translate((h?.left??0)-(l?.left??0),(h?.top??0)-(l?.top??0)),o.scale((h?.width??1)/(l?.width??1),(h?.height??1)/(l?.height??1));const f={transform:o.toString(),transition:""};c&&Object.assign(f,{"background-color":c}),s.dom?.css(f);const u={transform:a.toString(),transition:`all ${t.dur}ms cubic-bezier(${Rf(t.easeName??"linear").join(",")})`};d&&Object.assign(u,{"background-color":d}),setTimeout(()=>{s.dom?.css(u)},t.begin)}slideLeft(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["translateTo"],values:[[[0,0],[-i.width,0]]]}),i=>({attributeName:["opacity","translateTo"],values:[[1,1],[[i.width,0],[0,0]]]}),i=>{},i=>({attributeName:["translateTo"],values:[[[-i.width,0],[-i.width,0]]]}),t,e)}slideRight(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>{},i=>({attributeName:["opacity","translateTo"],values:[[1,1],[[-i.width,0],[0,0]]]}),i=>({attributeName:["translateTo"],values:[[[0,0],[i.width,0]]]}),i=>({attributeName:["translateTo"],values:[[[i.width,0],[i.width,0]]]}),t,e)}slideDown(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["translateTo"],values:[[[0,0],[0,i.height]]]}),i=>({attributeName:["opacity","translateTo"],values:[[1,1],[[0,-i.height],[0,0]]]}),i=>{},i=>({attributeName:["translateTo"],values:[[[0,i.height],[0,i.height]]]}),t,e)}slideUp(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["translateTo"],values:[[[0,0],[0,-i.height]]]}),i=>({attributeName:["opacity","translateTo"],values:[[1,1],[[0,i.height],[0,0]]]}),i=>{},i=>({attributeName:["translateTo"],values:[[[0,-i.height],[0,-i.height]]]}),t,e)}flipLeft(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["opacity","rotateYTo"],values:[[1,1],[0,180]]}),i=>({attributeName:["opacity","rotateYTo"],values:[[1,1],[-180,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}flipRight(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["opacity","rotateYTo"],values:[[1,1],[0,-180]]}),i=>({attributeName:["opacity","rotateYTo"],values:[[1,1],[180,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}flipDown(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["opacity","rotateXTo"],values:[[1,1],[0,-180]]}),i=>({attributeName:["opacity","rotateXTo"],values:[[1,1],[180,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}flipUp(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>({attributeName:["opacity","rotateXTo"],values:[[1,1],[0,180]]}),i=>({attributeName:["opacity","rotateXTo"],values:[[1,1],[-180,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}popIn(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>{},i=>({attributeName:["translateTo","scaleTo","opacity"],values:[[[0,0],[0,0]],[.8,1],[0,1]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}popOut(t=Me,e=this.objects.length-1){this._predefinedAnimate(i=>{},i=>({attributeName:["translateTo","scaleTo","opacity"],values:[[[0,0],[0,0]],[1,1.2],[1,0]]}),i=>{},i=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}rotate(t=Me,e=this.objects.length-1){Object.assign(t,{keyTimes:[0,1]});const i=t.degree??360;this._predefinedAnimate(r=>{},r=>({attributeName:["opacity","rotate"],values:[[1,1],[0,i]]}),r=>{},r=>({attributeName:["opacity"],values:[[0,0]]}),t,e)}}class rs{video;constructor(t){this.video=t}setSrcObject(t){this.video.addEventListener("loadedmetadata",e=>{const i=e.target;i instanceof HTMLVideoElement&&console.log(`${i.id} videoWidth: ${i.videoWidth}px, videoHeight: ${i.videoHeight}px.`)}),this.video.srcObject=t}static videoMediaChangeSupport=async()=>new Promise(t=>{const e=document.createElement("iframe"),i=document.createElement("video"),r=document.createElement("source"),s=new MediaSource;s.addEventListener("sourceopen",()=>t(!0)),r.src=URL.createObjectURL(s),r.media="(min-width:10px)",i.append(r),e.width="5",e.style.cssText="position: absolute; visibility: hidden;",document.documentElement.append(e),e.contentDocument?.body.append(i),setTimeout(()=>{e.width="15"}),setTimeout(()=>{e.remove(),t(!1)},1e3)});static captureWebCameraPhoto(t,e){navigator.mediaDevices.getUserMedia({video:!0}).then(i=>{t.srcObject=i;const r=t.videoWidth,s=t.videoHeight,a=e.getContext("2d");e.width=r,e.height=s,a?.drawImage(t,0,0,r,s)})}static tryAutoPlayOrAutoPlayAfterClick(t){return new Promise(e=>{t.play().then(()=>{t.autoplay=!0,e(!0)}).catch(()=>{rs.setAutoPlayWhenClick(t),e(!1)})})}static setAutoPlayWhenClick(t){function e(){t.autoplay=!0,t.play(),document.removeEventListener("click",e),document.removeEventListener("touchend",e)}document.addEventListener("click",e),document.addEventListener("touchend",e)}}class U_{localVideoUtil;remoteVideoUtil;localPeerConnection=null;remotePeerConnection=null;constructor(t,e){this.localVideoUtil=new rs(t),this.remoteVideoUtil=new rs(e)}start(){this.getLocalMediaStream().then(t=>{this.call(t)})}end(){this.localPeerConnection?.close(),this.remotePeerConnection?.close(),this.localPeerConnection=null,this.remotePeerConnection=null,this.trace("Ending call.")}getLocalMediaStream(){return new Promise((t,e)=>{navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then(i=>{this.localVideoUtil.setSrcObject(i),t(i)}).catch(i=>{this.trace(`navigator.getUserMedia error: ${i}.`),e(i)})})}gotRemoteMediaStream(t){const e=t.streams[0];this.remoteVideoUtil.setSrcObject(e),this.trace("Remote peer connection received remote stream.")}call(t){const e=t.getVideoTracks(),i=t.getAudioTracks();e.length>0&&this.trace(`Using video device: ${e[0].label}.`),i.length>0&&this.trace(`Using audio device: ${i[0].label}.`);const r=void 0,s=new RTCPeerConnection(r);this.localPeerConnection=s,this.trace("Created local peer connection object localPeerConnection."),s.addEventListener("icecandidate",this.handleConnection),s.addEventListener("iceconnectionstatechange",this.handleConnectionChange);const a=new RTCPeerConnection(r);this.remotePeerConnection=a,this.trace("Created remote peer connection object remotePeerConnection."),a.addEventListener("icecandidate",this.handleConnection),a.addEventListener("iceconnectionstatechange",this.handleConnectionChange),a.addEventListener("track",this.gotRemoteMediaStream),this.trace("Add local localStream to localPeerConnection."),s.addTrack(e[0],t),s.addTrack(i[0],t),this.trace("localPeerConnection createOffer start."),s.createOffer({offerToReceiveVideo:!0}).then(o=>this.createdOffer(o)).catch(o=>this.setSessionDescriptionError(o))}handleConnection(t){const e=t.target,i=t.candidate;if(e&&i){const r=new RTCIceCandidate(i),s=this.getOtherPeer(e);s&&(s.addIceCandidate(r).then(()=>{this.handleConnectionSuccess(e)}).catch(a=>{this.handleConnectionFailure(e,a)}),this.trace(`${this.getPeerName(e)} ICE candidate:
|
|
39
|
+
`):c.send(JSON.stringify(s))):(c.open(d,r,!0),f(),c.send(JSON.stringify(s)))})}function w_(n,t){const e=Fh();e.open("HEAD",n),e.filepath=n,e.callback=t,e.onload=function(){const i=parseFloat(window.localStorage.getItem("lm_"+this.filepath)??""),r=Date.parse(this.getResponseHeader("Last-Modified"));(isNaN(i)||r>i)&&(window.localStorage.setItem("lm_"+this.filepath,String(Date.now())),isFinite(i)&&this.callback(r,i))},e.send()}let Ia;const Af=new WeakMap;function Oh(n,t){let e=Af.get(n);e||(e=new Map,Af.set(n,e));let i=e.get(t);return i||(i=new Mf,e.set(t,i)),i}class Mf{subscribers;constructor(){this.subscribers=new Set}depend(){Ia&&this.subscribers.add(Ia)}notify(){this.subscribers.forEach(t=>t())}}function b_(n){Ia=n,n(),Ia=null}function x_(n){return Object.keys(n).forEach(t=>{let e=n[t];const i=Oh(n,t);Object.defineProperty(n,t,{get(){return i.depend(),e},set(r){r!=e&&(e=r,i.notify())}})}),n}function S_(n){return new Proxy(n,{get(t,e,i){return Oh(n,e).depend(),Reflect.get(t,e,i)},set(t,e,i,r){const s=Oh(n,e);return n[e]!=i&&(n[e]=i,s.notify()),Reflect.set(t,e,i,r)}})}class Fa{x;y;z;constructor(t=[0,0,0],e=[0,0,0]){const[i,r,s]=t,[a,o,h]=e;this.x=i-a,this.y=r-o,this.z=s-h}get length(){const{x:t,y:e,z:i}=this;return Math.sqrt(t*t+e*e+i*i)}unit(){const t=this.length;return new Fa([this.x/t,this.y/t,this.z/t])}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){const e=this.x,i=this.y,r=this.z,s=t.x,a=t.y,o=t.z;return new Fa([i*o-r*a,r*s-e*o,e*a-s*i])}}class Oa extends Wt{app;rotate;scale;isMouseDownInBounds=!1;constructor(t,e={x:0,y:0}){super(e),this.rotate=e.rotate??0,this.scale=e.scale??1,this.app=t,this.app.on("mouseDown",i=>{this.isMouseDownInBounds=this.getBounds().isContainPoint(this.app.mouse.point)}),this.app.on("mouseUp",i=>{this.isMouseDownInBounds=!1}),this.app.on("mouseMove",i=>{this.isMouseDownInBounds&&(this.x=this.app.mouse.point.x,this.y=this.app.mouse.point.y)})}draw(t){this._draw({extra:t,init:()=>{},shape:()=>{}})}_draw({init:t,extra:e,shape:i}){this.app.ctx.save(),t?.(this.app),e?.(this.app),this.app.ctx.translate(this.x,this.y),this.app.ctx.rotate(this.rotate),this.app.ctx.scale(this.scale,this.scale),i(this.app),this.app.ctx.restore()}}class C_ extends Oa{constructor(t,e={x:0,y:0}){super(t,e)}draw(t){super._draw({extra:t,init:e=>{e.ctx.lineWidth=2,e.ctx.fillStyle="#ffff00"},shape:e=>{e.ctx.beginPath(),e.ctx.moveTo(-50,-25),e.ctx.lineTo(0,-25),e.ctx.lineTo(0,-50),e.ctx.lineTo(50,0),e.ctx.lineTo(0,50),e.ctx.lineTo(0,25),e.ctx.lineTo(-50,25),e.ctx.lineTo(-50,-25),e.ctx.closePath(),e.ctx.fill(),e.ctx.lineWidth>0&&e.ctx.stroke()}})}}class T_ extends Oa{radius;constructor(t,e={x:0,y:0,radius:40}){super(t,e),this.radius=e.radius}draw(t){super._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.fillStyle="#ff0000"},shape:e=>{e.ctx.beginPath(),e.ctx.arc(0,0,this.radius,0,Math.PI*2,!0),e.ctx.closePath(),e.ctx.fill(),e.ctx.lineWidth>0&&e.ctx.stroke()}})}}class k_ extends Oa{toX;toY;c1x;c1y;c2x;c2y;constructor(t,e={x:0,y:0,toX:0,toY:0}){super(t,e),this.toX=e.toX,this.toY=e.toY,this.c1x=e.c1x??0,this.c1y=e.c1y??0,this.c2x=e.c2x??0,this.c2y=e.c2y??0}draw(t){this._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.strokeStyle="#eeeeee"},shape:e=>{e.ctx.beginPath(),e.ctx.moveTo(0,0),e.ctx.lineTo(this.toX-this.x,this.toY-this.y),e.ctx.lineWidth>0&&e.ctx.stroke()}})}drawQuadratic(t){this._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.strokeStyle="#eeeeee"},shape:e=>{e.ctx.beginPath(),e.ctx.moveTo(0,0),e.ctx.quadraticCurveTo(this.c1x-this.x,this.c1y-this.y,this.toX-this.x,this.toY-this.y),e.ctx.lineWidth>0&&e.ctx.stroke()}})}drawQuadraticThrough(t){this._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.strokeStyle="#eeeeee"},shape:e=>{e.ctx.beginPath(),e.ctx.moveTo(0,0);const i=this.c1x*2-(this.x+this.toX)/2,r=this.c1y*2-(this.y+this.toY)/2;e.ctx.quadraticCurveTo(i-this.x,r-this.y,this.toX-this.x,this.toY-this.y),e.ctx.lineWidth>0&&e.ctx.stroke()}})}drawQuadraticThroughCurve(t,e){this._draw({extra:e,init:i=>{i.ctx.lineWidth=1,i.ctx.strokeStyle="#eeeeee"},shape:i=>{const r=t.length;if(r<3)return new Error("points length must >= 3");const s=(t[0].x+t[r-1].x)/2,a=(t[0].y+t[r-1].y)/2;i.ctx.beginPath(),i.ctx.moveTo(s,a);let o=0;for(;o<r-1;o++){const h=(t[o].x+t[o+1].x)/2,l=(t[o].y+t[o+1].y)/2;i.ctx.quadraticCurveTo(t[o].x-this.x,t[o].y-this.y,h-this.x,l-this.y)}i.ctx.quadraticCurveTo(t[o].x-this.x,t[o].y-this.y,s-this.x,a-this.y),i.ctx.lineWidth>0&&i.ctx.stroke()}})}drawQuadraticThroughCurveNotGood(t,e){this._draw({extra:e,init:i=>{i.ctx.lineWidth=1,i.ctx.strokeStyle="#eeeeee"},shape:i=>{const r=t.length;if(r<3)return new Error("points length must >= 3");i.ctx.beginPath(),i.ctx.moveTo(t[0].x,t[0].y);let s=1;for(;s<r-2;s++){const a=(t[s].x+t[s+1].x)/2,o=(t[s].y+t[s+1].y)/2;i.ctx.quadraticCurveTo(t[s].x-this.x,t[s].y-this.y,a-this.x,o-this.y)}i.ctx.quadraticCurveTo(t[s].x-this.x,t[s].y-this.y,t[s+1].x-this.x,t[s+1].y-this.y),i.ctx.lineWidth>0&&i.ctx.stroke()}})}getBounds(){if(this.rotate===0){const t=Math.min(this.x,this.toX),e=Math.min(this.y,this.toY),i=Math.max(this.x,this.toX),r=Math.max(this.y,this.toY);return new jn({x:t,y:e,width:i-t,height:r-e})}else{const t=Math.sin(this.rotate),e=Math.cos(this.rotate),i=e*this.x-t*this.y,r=e*this.toX-t*this.toY,s=e*this.y+t*this.x,a=e*this.toY+t*this.toX;return new jn({x:Math.min(i,r),y:Math.min(s,a),width:Math.max(i,r)-Math.min(i,r),height:Math.max(s,a)-Math.min(s,a)})}}}class E_ extends Oa{width;height;borderRadius;rect;constructor(t,e={x:0,y:0,width:50,height:50}){return super(t,e),this.width=e.width,this.height=e.height,this.borderRadius=e.borderRadius??0,this.rect=new jn({x:this.x,y:this.y,width:this.width,height:this.height}),new Proxy(this,{get:(r,s,a)=>Reflect.get(r,s,a),set:(r,s,a,o)=>{switch(s){case"x":case"y":case"width":case"height":this.rect[s]=a;break}return Reflect.set(r,s,a,o)}})}draw(t){this._draw({extra:t,init:e=>{e.ctx.lineWidth=1,e.ctx.fillStyle="#ff0000"},shape:e=>{e.ctx.beginPath(),this.borderRadius<=0?e.ctx.rect(0,0,this.width,this.height):(e.ctx.moveTo(0,0+this.borderRadius),e.ctx.lineTo(0,0+this.height-this.borderRadius),e.ctx.quadraticCurveTo(0,0+this.height,0+this.borderRadius,0+this.height),e.ctx.lineTo(0+this.width-this.borderRadius,0+this.height),e.ctx.quadraticCurveTo(0+this.width,0+this.height,0+this.width,0+this.height-this.borderRadius),e.ctx.lineTo(0+this.width,0+this.borderRadius),e.ctx.quadraticCurveTo(0+this.width,0,0+this.width-this.borderRadius,0),e.ctx.lineTo(0+this.borderRadius,0),e.ctx.quadraticCurveTo(0,0,0,0+this.borderRadius)),e.ctx.closePath(),e.ctx.fill(),e.ctx.lineWidth>0&&e.ctx.stroke()}})}getBounds(){return this.rect}}class Rf{x;y;z;brightness;constructor(t,e,i,r){this.x=t,this.y=e,this.z=i,this.brightness=r}setBrightness(t){this.brightness=Math.min(Math.max(t,0),1)}}class P_{x;y;width;height;rotation;showFlame;constructor(){this.x=0,this.y=0,this.width=25,this.height=20,this.rotation=0,this.showFlame=!1}draw(t,e){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=1,t.strokeStyle="#ffffff",e?.(t),t.beginPath(),t.moveTo(10,0),t.lineTo(-10,10),t.lineTo(-5,0),t.lineTo(-10,-10),t.lineTo(10,0),t.closePath(),t.stroke(),this.showFlame&&(t.beginPath(),t.moveTo(-7.5,-5),t.lineTo(-15,0),t.lineTo(-7.5,5),t.closePath(),t.stroke()),t.restore()}}class A_{x;y;scaleX;scaleY;color;alpha;lineWidth;branch;constructor(){this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.color="#ffffff",this.alpha=1,this.lineWidth=1,this.branch=[],this.branch[0]=-140-Math.random()*20,this.branch[1]=-30-Math.random()*30,this.branch[2]=Math.random()*80-40,this.branch[3]=-100-Math.random()*40,this.branch[4]=-60-Math.random()*40,this.branch[5]=Math.random()*60-30,this.branch[6]=-110-Math.random()*20}draw(t,e){t.save(),t.translate(this.x,this.y),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.strokeStyle=Qo(this.color,this.alpha),e?.(t),t.beginPath(),t.moveTo(0,0),t.lineTo(0,this.branch[0]),t.moveTo(0,this.branch[1]),t.lineTo(this.branch[2],this.branch[3]),t.moveTo(0,this.branch[4]),t.lineTo(this.branch[5],this.branch[6]),t.stroke(),t.restore()}}class M_{x;y;z;fl;vpX;vpY;cX;cY;cZ;constructor(t,e,i){this.x=t,this.y=e,this.z=i,this.fl=250,this.vpX=0,this.vpY=0,this.cX=0,this.cY=0,this.cZ=0}setVanishingPoint(t,e){this.vpX=t,this.vpY=e}setCenter(t,e,i){this.cX=t,this.cY=e,this.cZ=i}rotateX(t){const e=Math.cos(t),i=Math.sin(t),r=this.y*e-this.z*i,s=this.z*e+this.y*i;this.y=r,this.z=s}rotateY(t){const e=Math.cos(t),i=Math.sin(t),r=this.x*e-this.z*i,s=this.z*e+this.x*i;this.x=r,this.z=s}rotateZ(t){const e=Math.cos(t),i=Math.sin(t),r=this.x*e-this.y*i,s=this.y*e+this.x*i;this.x=r,this.y=s}getScreenX(){const t=this.fl/(this.fl+this.z+this.cZ);return this.vpX+(this.cX+this.x)*t}getScreenY(){const t=this.fl/(this.fl+this.z+this.cZ);return this.vpY+(this.cY+this.y)*t}}class R_{pointA;pointB;pointC;color;lineWidth;alpha;constructor(t,e,i,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=i,this.color=r,this.lineWidth=1,this.alpha=1}draw(t,e){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=Qo(this.color,this.alpha),e?.(t),t.beginPath(),t.moveTo(this.pointA.getScreenX(),this.pointA.getScreenY()),t.lineTo(this.pointB.getScreenX(),this.pointB.getScreenY()),t.lineTo(this.pointC.getScreenX(),this.pointC.getScreenY()),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore())}getDepth(){return Math.min(this.pointA.z,this.pointB.z,this.pointC.z)}isBackface(){const t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),i=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*i}}class D_{pointA;pointB;pointC;color;lineWidth;alpha;light;constructor(t,e,i,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=i,this.color=r,this.lineWidth=1,this.alpha=1,this.light=new Rf(0,0,0,1)}draw(t,e){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=this.getAdjustedColor(),e?.(t),t.beginPath(),t.moveTo(this.pointA.getScreenX(),this.pointA.getScreenY()),t.lineTo(this.pointB.getScreenX(),this.pointB.getScreenY()),t.lineTo(this.pointC.getScreenX(),this.pointC.getScreenY()),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore())}getDepth(){return Math.min(this.pointA.z,this.pointB.z,this.pointC.z)}isBackface(){const t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),i=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*i}getAdjustedColor(){const t=ya(this.color);let e=t>>16,i=t>>8&255,r=t&255;const s=this.getLightFactor();return e*=s,i*=s,r*=s,Xc(e<<16|i<<8|r)}getLightFactor(){const t={x:this.pointA.x-this.pointB.x,y:this.pointA.y-this.pointB.y,z:this.pointA.z-this.pointB.z},e={x:this.pointB.x-this.pointC.x,y:this.pointB.y-this.pointC.y,z:this.pointB.z-this.pointC.z},i={x:t.y*e.z-t.z*e.y,y:-(t.x*e.z-t.z*e.x),z:t.x*e.y-t.y*e.x},r=i.x*this.light.x+i.y*this.light.y+i.z*this.light.z,s=Math.sqrt(i.x*i.x+i.y*i.y+i.z*i.z),a=Math.sqrt(this.light.x*this.light.x+this.light.y*this.light.y+this.light.z*this.light.z);return Math.acos(r/(s*a))/Math.PI*this.light.brightness}}class L_{min;max;value;x;y;width;height;backColor;backBorderColor;backWidth;handleColor;handleBorderColor;handleHeight;handleY;onchange;prevCanvas;currentContext;animatedID=0;constructor(t=0,e=100,i=0,r){this.min=t,this.max=e,this.value=i,this.onchange=r,this.x=0,this.y=0,this.width=16,this.height=100,this.backColor="#cccccc",this.backBorderColor="#999999",this.backWidth=4,this.handleColor="#eeeeee",this.handleBorderColor="#cccccc",this.handleHeight=6,this.handleY=0,this.updatePosition()}draw(t,e){this.currentContext=t,t.save(),t.translate(this.x,this.y),e?.(t),t.clearRect(this.x,this.y,this.width,this.height),t.fillStyle=this.backColor,t.beginPath(),t.fillRect(this.width/2-this.backWidth/2,0,this.backWidth,this.height),t.closePath(),t.strokeStyle=this.handleBorderColor,t.fillStyle=this.handleColor,t.beginPath(),t.rect(0,this.handleY,this.width,this.handleHeight),t.closePath(),t.fill(),t.stroke(),t.restore(),(!this.prevCanvas||this.prevCanvas!=t.canvas)&&(this.captureMouse(t.canvas),this.prevCanvas=t.canvas)}updateValue(){const t=this.value,e=this.height-this.handleHeight,i=this.max-this.min;this.value=(e-this.handleY)/e*i+this.min,this.value!==t&&(this.onchange?.(this.value),Ko((r,s)=>{this.animatedID=s,this.currentContext&&this.draw(this.currentContext)}))}updatePosition(){const t=this.height-this.handleHeight,e=this.max-this.min;this.handleY=t-(this.value-this.min)/e*t}captureMouse(t){const e=new jn({x:0,y:0,width:0,height:0}),i=()=>{e.x=this.x,e.y=this.y+this.handleY,e.width=this.width,e.height=this.handleHeight};i();let r=!1;new Pr().captureMouse(t,{move:a=>{if(r){const o=a.y-this.y;this.handleY=Math.min(this.height-this.handleHeight,Math.max(o,0)),this.updateValue()}},start:a=>{r=e.isContainPoint(a)},end:a=>{i(),window.cancelAnimationFrame(this.animatedID)}})}}class I_{x;y;width;height;rotation;scaleX;scaleY;color;lineWidth;constructor(t,e,i="#ffffff"){this.x=0,this.y=0,this.width=t,this.height=e,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=i,this.lineWidth=1}draw(t,e){const i=this.height,r=this.width+i,s=i/2;t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.fillStyle=this.color,e?.(t),t.beginPath(),t.moveTo(0,-s),t.lineTo(r-2*s,-s),t.quadraticCurveTo(-s+r,-s,-s+r,0),t.lineTo(-s+r,i-2*s),t.quadraticCurveTo(-s+r,-s+i,r-2*s,-s+i),t.lineTo(0,-s+i),t.quadraticCurveTo(-s,-s+i,-s,i-2*s),t.lineTo(-s,0),t.quadraticCurveTo(-s,-s,0,-s),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.beginPath(),t.arc(0,0,2,0,Math.PI*2,!0),t.closePath(),t.stroke(),t.beginPath(),t.arc(this.width,0,2,0,Math.PI*2,!0),t.closePath(),t.stroke(),t.restore()}getPin(){return{x:this.x+Math.cos(this.rotation)*this.width,y:this.y+Math.sin(this.rotation)*this.width}}}class F_{R;r;O;constructor(t,e,i){this.R=t,this.r=e,this.O=i}draw(t,e){t.save(),e?.(t);let i=this.R-this.O,r=0,s=1;t.beginPath(),t.moveTo(i,r);let a,o;do{if(s>2e4)break;a=(this.R+this.r)*Math.cos(s*Math.PI/72)-(this.r+this.O)*Math.cos((this.R+this.r)/this.r*(s*Math.PI/72)),o=(this.R+this.r)*Math.sin(s*Math.PI/72)-(this.r+this.O)*Math.sin((this.R+this.r)/this.r*(s*Math.PI/72)),t.lineTo(a,o),i=a,r=o,s++}while(a!=this.R-this.O&&o!=0);t.stroke(),t.restore()}}class O_{r;constructor(t){this.r=t}draw(t,e){t.save(),e?.(t),t.beginPath(),t.moveTo(this.r,0);for(let i=0;i<9;i++)t.rotate(Math.PI/5),i%2==0?t.lineTo(this.r/.525731*.200811,0):t.lineTo(this.r,0);t.closePath(),t.fill(),t.restore()}}class N_{startX;startY;width;height;constructor(t,e,i,r){this.startX=t,this.startY=e,this.width=i,this.height=r}draw(t,e){t.save(),e?.(t);let i=0;const r=()=>{t.clearRect(this.startX,this.startY,this.width,this.height),t.setLineDash([4,2]),t.lineDashOffset=-i,t.strokeRect(this.startX,this.startY,this.width,this.height)};function s(){i++,i>16&&(i=0),r(),setTimeout(s,40)}s(),t.restore()}}class G_{constructor(){}draw(t,e){t.save(),e?.(t),t.beginPath(),t.arc(75,75,50,0,Math.PI*2,!0),t.moveTo(110,75),t.arc(75,75,35,0,Math.PI,!1),t.moveTo(65,65),t.arc(60,65,5,0,Math.PI*2,!0),t.moveTo(95,65),t.arc(90,65,5,0,Math.PI*2,!0),t.stroke(),t.restore()}}class rs{video;constructor(t){this.video=t}setSrcObject(t){this.video.addEventListener("loadedmetadata",e=>{const i=e.target;i instanceof HTMLVideoElement&&console.log(`${i.id} videoWidth: ${i.videoWidth}px, videoHeight: ${i.videoHeight}px.`)}),this.video.srcObject=t}static videoMediaChangeSupport=async()=>new Promise(t=>{const e=document.createElement("iframe"),i=document.createElement("video"),r=document.createElement("source"),s=new MediaSource;s.addEventListener("sourceopen",()=>t(!0)),r.src=URL.createObjectURL(s),r.media="(min-width:10px)",i.append(r),e.width="5",e.style.cssText="position: absolute; visibility: hidden;",document.documentElement.append(e),e.contentDocument?.body.append(i),setTimeout(()=>{e.width="15"}),setTimeout(()=>{e.remove(),t(!1)},1e3)});static captureWebCameraPhoto(t,e){navigator.mediaDevices.getUserMedia({video:!0}).then(i=>{t.srcObject=i;const r=t.videoWidth,s=t.videoHeight,a=e.getContext("2d");e.width=r,e.height=s,a?.drawImage(t,0,0,r,s)})}static tryAutoPlayOrAutoPlayAfterClick(t){return new Promise(e=>{t.play().then(()=>{t.autoplay=!0,e(!0)}).catch(()=>{rs.setAutoPlayWhenClick(t),e(!1)})})}static setAutoPlayWhenClick(t){function e(){t.autoplay=!0,t.play(),document.removeEventListener("click",e),document.removeEventListener("touchend",e)}document.addEventListener("click",e),document.addEventListener("touchend",e)}}class U_{localVideoUtil;remoteVideoUtil;localPeerConnection=null;remotePeerConnection=null;constructor(t,e){this.localVideoUtil=new rs(t),this.remoteVideoUtil=new rs(e)}start(){this.getLocalMediaStream().then(t=>{this.call(t)})}end(){this.localPeerConnection?.close(),this.remotePeerConnection?.close(),this.localPeerConnection=null,this.remotePeerConnection=null,this.trace("Ending call.")}getLocalMediaStream(){return new Promise((t,e)=>{navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then(i=>{this.localVideoUtil.setSrcObject(i),t(i)}).catch(i=>{this.trace(`navigator.getUserMedia error: ${i}.`),e(i)})})}gotRemoteMediaStream(t){const e=t.streams[0];this.remoteVideoUtil.setSrcObject(e),this.trace("Remote peer connection received remote stream.")}call(t){const e=t.getVideoTracks(),i=t.getAudioTracks();e.length>0&&this.trace(`Using video device: ${e[0].label}.`),i.length>0&&this.trace(`Using audio device: ${i[0].label}.`);const r=void 0,s=new RTCPeerConnection(r);this.localPeerConnection=s,this.trace("Created local peer connection object localPeerConnection."),s.addEventListener("icecandidate",this.handleConnection),s.addEventListener("iceconnectionstatechange",this.handleConnectionChange);const a=new RTCPeerConnection(r);this.remotePeerConnection=a,this.trace("Created remote peer connection object remotePeerConnection."),a.addEventListener("icecandidate",this.handleConnection),a.addEventListener("iceconnectionstatechange",this.handleConnectionChange),a.addEventListener("track",this.gotRemoteMediaStream),this.trace("Add local localStream to localPeerConnection."),s.addTrack(e[0],t),s.addTrack(i[0],t),this.trace("localPeerConnection createOffer start."),s.createOffer({offerToReceiveVideo:!0}).then(o=>this.createdOffer(o)).catch(o=>this.setSessionDescriptionError(o))}handleConnection(t){const e=t.target,i=t.candidate;if(e&&i){const r=new RTCIceCandidate(i),s=this.getOtherPeer(e);s&&(s.addIceCandidate(r).then(()=>{this.handleConnectionSuccess(e)}).catch(a=>{this.handleConnectionFailure(e,a)}),this.trace(`${this.getPeerName(e)} ICE candidate:
|
|
40
40
|
${t.candidate.candidate}.`))}}handleConnectionSuccess(t){this.trace(`${this.getPeerName(t)} addIceCandidate success.`)}handleConnectionFailure(t,e){this.trace(`${this.getPeerName(t)} failed to add ICE Candidate:
|
|
41
41
|
${e.toString()}.`)}handleConnectionChange(t){const e=t.target;console.log("ICE state change event: ",t),e&&this.trace(`${this.getPeerName(e)} ICE state: ${e.iceConnectionState}.`)}createdOffer(t){this.trace(`Offer from localPeerConnection:
|
|
42
42
|
${t.sdp}`),this.localPeerConnection&&(this.trace("localPeerConnection setLocalDescription start."),this.localPeerConnection.setLocalDescription(t).then(()=>{this.setLocalDescriptionSuccess(this.localPeerConnection)}).catch(e=>this.setSessionDescriptionError(e))),this.remotePeerConnection&&(this.trace("remotePeerConnection setRemoteDescription start."),this.remotePeerConnection.setRemoteDescription(t).then(()=>{this.setRemoteDescriptionSuccess(this.remotePeerConnection)}).catch(e=>this.setSessionDescriptionError(e)),this.trace("remotePeerConnection createAnswer start."),this.remotePeerConnection.createAnswer().then(e=>this.createdAnswer(e)).catch(e=>this.setSessionDescriptionError(e)))}createdAnswer(t){this.trace(`Answer from remotePeerConnection:
|
|
43
|
-
${t.sdp}.`),this.remotePeerConnection&&(this.trace("remotePeerConnection setLocalDescription start."),this.remotePeerConnection.setLocalDescription(t).then(()=>{this.setLocalDescriptionSuccess(this.remotePeerConnection)}).catch(e=>this.setSessionDescriptionError(e))),this.localPeerConnection&&(this.trace("localPeerConnection setRemoteDescription start."),this.localPeerConnection.setRemoteDescription(t).then(()=>{this.setRemoteDescriptionSuccess(this.localPeerConnection)}).catch(e=>this.setSessionDescriptionError(e)))}setSessionDescriptionError(t){this.trace(`Failed to create session description: ${t.toString()}.`)}setDescriptionSuccess(t,e){const i=this.getPeerName(t);this.trace(`${i} ${e} complete.`)}setLocalDescriptionSuccess(t){this.setDescriptionSuccess(t,"setLocalDescription")}setRemoteDescriptionSuccess(t){this.setDescriptionSuccess(t,"setRemoteDescription")}trace(t){t=t.trim();const e=(window.performance.now()/1e3).toFixed(3);console.log(e,t);const i=document.createElement("div");i.innerHTML=`<div>${e}, ${t}</div>`,document.getElementById("trace")?.appendChild(i)}getOtherPeer(t){return t===this.localPeerConnection?this.remotePeerConnection:this.localPeerConnection}getPeerName(t){return t===this.localPeerConnection?"localPeerConnection":"remotePeerConnection"}}class B_{canvas;gl;constructor(t){this.canvas=t;const e={alpha:!0,premultipliedAlpha:!1};if(this.gl=this.canvas.getContext("webgl",e),!this.gl)throw new Error("WebGL failed to initialize.")}}function Df(n,t){return!n||n.parentElement===null?t:Df(n.parentElement,t.concat([n]))}const Nh=function(n,t){return getComputedStyle(n,null).getPropertyValue(t)},z_=function(n){return Nh(n,"overflow")+Nh(n,"overflow-y")+Nh(n,"overflow-x")},$_=function(n){return/(auto|scroll)/.test(z_(n))};function V_(n){if(!(n instanceof HTMLElement||n instanceof SVGElement))return;const t=Df(n.parentElement,[]);for(let e=0;e<t.length;e+=1)if($_(t[e]))return t[e];return document.scrollingElement||document.documentElement}var Gh={exports:{}},ss={},Uh={},Bh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n._registerNode=n.Konva=n.glob=void 0;const t=Math.PI/180;function e(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}n.glob=typeof xo<"u"?xo:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},n.Konva={_global:n.glob,version:"9.2.2",isBrowser:e(),isUnminified:/param/.test(function(r){}.toString()),dblClickWindow:400,getAngle(r){return n.Konva.angleDeg?r*t:r},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return n.Konva.DD.isDragging},isDragReady(){return!!n.Konva.DD.node},releaseCanvasOnDestroy:!0,document:n.glob.document,_injectGlobal(r){n.glob.Konva=r}};const i=r=>{n.Konva[r.prototype.getClassName()]=r};n._registerNode=i,n.Konva._injectGlobal(n.Konva)})(Bh);const Nt=St(xt({__proto__:null,default:Pe(Bh)},[Bh]));var zh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Util=n.Transform=void 0;const t=Nt;class e{constructor(x=[1,0,0,1,0,0]){this.dirty=!1,this.m=x&&x.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new e(this.m)}copyInto(x){x.m[0]=this.m[0],x.m[1]=this.m[1],x.m[2]=this.m[2],x.m[3]=this.m[3],x.m[4]=this.m[4],x.m[5]=this.m[5]}point(x){var P=this.m;return{x:P[0]*x.x+P[2]*x.y+P[4],y:P[1]*x.x+P[3]*x.y+P[5]}}translate(x,P){return this.m[4]+=this.m[0]*x+this.m[2]*P,this.m[5]+=this.m[1]*x+this.m[3]*P,this}scale(x,P){return this.m[0]*=x,this.m[1]*=x,this.m[2]*=P,this.m[3]*=P,this}rotate(x){var P=Math.cos(x),R=Math.sin(x),F=this.m[0]*P+this.m[2]*R,L=this.m[1]*P+this.m[3]*R,$=this.m[0]*-R+this.m[2]*P,U=this.m[1]*-R+this.m[3]*P;return this.m[0]=F,this.m[1]=L,this.m[2]=$,this.m[3]=U,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(x,P){var R=this.m[0]+this.m[2]*P,F=this.m[1]+this.m[3]*P,L=this.m[2]+this.m[0]*x,$=this.m[3]+this.m[1]*x;return this.m[0]=R,this.m[1]=F,this.m[2]=L,this.m[3]=$,this}multiply(x){var P=this.m[0]*x.m[0]+this.m[2]*x.m[1],R=this.m[1]*x.m[0]+this.m[3]*x.m[1],F=this.m[0]*x.m[2]+this.m[2]*x.m[3],L=this.m[1]*x.m[2]+this.m[3]*x.m[3],$=this.m[0]*x.m[4]+this.m[2]*x.m[5]+this.m[4],U=this.m[1]*x.m[4]+this.m[3]*x.m[5]+this.m[5];return this.m[0]=P,this.m[1]=R,this.m[2]=F,this.m[3]=L,this.m[4]=$,this.m[5]=U,this}invert(){var x=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),P=this.m[3]*x,R=-this.m[1]*x,F=-this.m[2]*x,L=this.m[0]*x,$=x*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),U=x*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=P,this.m[1]=R,this.m[2]=F,this.m[3]=L,this.m[4]=$,this.m[5]=U,this}getMatrix(){return this.m}decompose(){var x=this.m[0],P=this.m[1],R=this.m[2],F=this.m[3],L=this.m[4],$=this.m[5],U=x*F-P*R;let z={x:L,y:$,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(x!=0||P!=0){var q=Math.sqrt(x*x+P*P);z.rotation=P>0?Math.acos(x/q):-Math.acos(x/q),z.scaleX=q,z.scaleY=U/q,z.skewX=(x*R+P*F)/U,z.skewY=0}else if(R!=0||F!=0){var K=Math.sqrt(R*R+F*F);z.rotation=Math.PI/2-(F>0?Math.acos(-R/K):-Math.acos(R/K)),z.scaleX=U/K,z.scaleY=K,z.skewX=0,z.skewY=(x*R+P*F)/U}return z.rotation=n.Util._getRotation(z.rotation),z}}n.Transform=e;var i="[object Array]",r="[object Number]",s="[object String]",a="[object Boolean]",o=Math.PI/180,h=180/Math.PI,l="#",c="",d="0",f="Konva warning: ",u="Konva error: ",m="rgb(",v={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,132,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,255,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],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],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,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],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:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],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,5]},b=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,S=[];const E=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(_){setTimeout(_,60)};n.Util={_isElement(_){return!!(_&&_.nodeType==1)},_isFunction(_){return!!(_&&_.constructor&&_.call&&_.apply)},_isPlainObject(_){return!!_&&_.constructor===Object},_isArray(_){return Object.prototype.toString.call(_)===i},_isNumber(_){return Object.prototype.toString.call(_)===r&&!isNaN(_)&&isFinite(_)},_isString(_){return Object.prototype.toString.call(_)===s},_isBoolean(_){return Object.prototype.toString.call(_)===a},isObject(_){return _ instanceof Object},isValidSelector(_){if(typeof _!="string")return!1;var x=_[0];return x==="#"||x==="."||x===x.toUpperCase()},_sign(_){return _===0||_>0?1:-1},requestAnimFrame(_){S.push(_),S.length===1&&E(function(){const x=S;S=[],x.forEach(function(P){P()})})},createCanvasElement(){var _=document.createElement("canvas");try{_.style=_.style||{}}catch{}return _},createImageElement(){return document.createElement("img")},_isInDocument(_){for(;_=_.parentNode;)if(_==document)return!0;return!1},_urlToImage(_,x){var P=n.Util.createImageElement();P.onload=function(){x(P)},P.src=_},_rgbToHex(_,x,P){return((1<<24)+(_<<16)+(x<<8)+P).toString(16).slice(1)},_hexToRgb(_){_=_.replace(l,c);var x=parseInt(_,16);return{r:x>>16&255,g:x>>8&255,b:x&255}},getRandomColor(){for(var _=(Math.random()*16777215<<0).toString(16);_.length<6;)_=d+_;return l+_},getRGB(_){var x;return _ in v?(x=v[_],{r:x[0],g:x[1],b:x[2]}):_[0]===l?this._hexToRgb(_.substring(1)):_.substr(0,4)===m?(x=b.exec(_.replace(/ /g,"")),{r:parseInt(x[1],10),g:parseInt(x[2],10),b:parseInt(x[3],10)}):{r:0,g:0,b:0}},colorToRGBA(_){return _=_||"black",n.Util._namedColorToRBA(_)||n.Util._hex3ColorToRGBA(_)||n.Util._hex4ColorToRGBA(_)||n.Util._hex6ColorToRGBA(_)||n.Util._hex8ColorToRGBA(_)||n.Util._rgbColorToRGBA(_)||n.Util._rgbaColorToRGBA(_)||n.Util._hslColorToRGBA(_)},_namedColorToRBA(_){var x=v[_.toLowerCase()];return x?{r:x[0],g:x[1],b:x[2],a:1}:null},_rgbColorToRGBA(_){if(_.indexOf("rgb(")===0){_=_.match(/rgb\(([^)]+)\)/)[1];var x=_.split(/ *, */).map(Number);return{r:x[0],g:x[1],b:x[2],a:1}}},_rgbaColorToRGBA(_){if(_.indexOf("rgba(")===0){_=_.match(/rgba\(([^)]+)\)/)[1];var x=_.split(/ *, */).map((P,R)=>P.slice(-1)==="%"?R===3?parseInt(P)/100:parseInt(P)/100*255:Number(P));return{r:x[0],g:x[1],b:x[2],a:x[3]}}},_hex8ColorToRGBA(_){if(_[0]==="#"&&_.length===9)return{r:parseInt(_.slice(1,3),16),g:parseInt(_.slice(3,5),16),b:parseInt(_.slice(5,7),16),a:parseInt(_.slice(7,9),16)/255}},_hex6ColorToRGBA(_){if(_[0]==="#"&&_.length===7)return{r:parseInt(_.slice(1,3),16),g:parseInt(_.slice(3,5),16),b:parseInt(_.slice(5,7),16),a:1}},_hex4ColorToRGBA(_){if(_[0]==="#"&&_.length===5)return{r:parseInt(_[1]+_[1],16),g:parseInt(_[2]+_[2],16),b:parseInt(_[3]+_[3],16),a:parseInt(_[4]+_[4],16)/255}},_hex3ColorToRGBA(_){if(_[0]==="#"&&_.length===4)return{r:parseInt(_[1]+_[1],16),g:parseInt(_[2]+_[2],16),b:parseInt(_[3]+_[3],16),a:1}},_hslColorToRGBA(_){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(_)){const[x,...P]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(_),R=Number(P[0])/360,F=Number(P[1])/100,L=Number(P[2])/100;let $,U,z;if(F===0)return z=L*255,{r:Math.round(z),g:Math.round(z),b:Math.round(z),a:1};L<.5?$=L*(1+F):$=L+F-L*F;const q=2*L-$,K=[0,0,0];for(let Z=0;Z<3;Z++)U=R+1/3*-(Z-1),U<0&&U++,U>1&&U--,6*U<1?z=q+($-q)*6*U:2*U<1?z=$:3*U<2?z=q+($-q)*(2/3-U)*6:z=q,K[Z]=z*255;return{r:Math.round(K[0]),g:Math.round(K[1]),b:Math.round(K[2]),a:1}}},haveIntersection(_,x){return!(x.x>_.x+_.width||x.x+x.width<_.x||x.y>_.y+_.height||x.y+x.height<_.y)},cloneObject(_){var x={};for(var P in _)this._isPlainObject(_[P])?x[P]=this.cloneObject(_[P]):this._isArray(_[P])?x[P]=this.cloneArray(_[P]):x[P]=_[P];return x},cloneArray(_){return _.slice(0)},degToRad(_){return _*o},radToDeg(_){return _*h},_degToRad(_){return n.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),n.Util.degToRad(_)},_radToDeg(_){return n.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),n.Util.radToDeg(_)},_getRotation(_){return t.Konva.angleDeg?n.Util.radToDeg(_):_},_capitalize(_){return _.charAt(0).toUpperCase()+_.slice(1)},throw(_){throw new Error(u+_)},error(_){console.error(u+_)},warn(_){t.Konva.showWarnings&&console.warn(f+_)},each(_,x){for(var P in _)x(P,_[P])},_inRange(_,x,P){return x<=_&&_<P},_getProjectionToSegment(_,x,P,R,F,L){var $,U,z,q=(_-P)*(_-P)+(x-R)*(x-R);if(q==0)$=_,U=x,z=(F-P)*(F-P)+(L-R)*(L-R);else{var K=((F-_)*(P-_)+(L-x)*(R-x))/q;K<0?($=_,U=x,z=(_-F)*(_-F)+(x-L)*(x-L)):K>1?($=P,U=R,z=(P-F)*(P-F)+(R-L)*(R-L)):($=_+K*(P-_),U=x+K*(R-x),z=($-F)*($-F)+(U-L)*(U-L))}return[$,U,z]},_getProjectionToLine(_,x,P){var R=n.Util.cloneObject(_),F=Number.MAX_VALUE;return x.forEach(function(L,$){if(!(!P&&$===x.length-1)){var U=x[($+1)%x.length],z=n.Util._getProjectionToSegment(L.x,L.y,U.x,U.y,_.x,_.y),q=z[0],K=z[1],Z=z[2];Z<F&&(R.x=q,R.y=K,F=Z)}}),R},_prepareArrayForTween(_,x,P){var R,F=[],L=[];if(_.length>x.length){var $=x;x=_,_=$}for(R=0;R<_.length;R+=2)F.push({x:_[R],y:_[R+1]});for(R=0;R<x.length;R+=2)L.push({x:x[R],y:x[R+1]});var U=[];return L.forEach(function(z){var q=n.Util._getProjectionToLine(z,F,P);U.push(q.x),U.push(q.y)}),U},_prepareToStringify(_){var x;_.visitedByCircularReferenceRemoval=!0;for(var P in _)if(_.hasOwnProperty(P)&&_[P]&&typeof _[P]=="object"){if(x=Object.getOwnPropertyDescriptor(_,P),_[P].visitedByCircularReferenceRemoval||n.Util._isElement(_[P]))if(x.configurable)delete _[P];else return null;else if(n.Util._prepareToStringify(_[P])===null)if(x.configurable)delete _[P];else return null}return delete _.visitedByCircularReferenceRemoval,_},_assign(_,x){for(var P in x)_[P]=x[P];return _},_getFirstPointerId(_){return _.touches?_.changedTouches[0].identifier:_.pointerId||999},releaseCanvas(..._){t.Konva.releaseCanvasOnDestroy&&_.forEach(x=>{x.width=0,x.height=0})},drawRoundedRectPath(_,x,P,R){let F=0,L=0,$=0,U=0;typeof R=="number"?F=L=$=U=Math.min(R,x/2,P/2):(F=Math.min(R[0]||0,x/2,P/2),L=Math.min(R[1]||0,x/2,P/2),U=Math.min(R[2]||0,x/2,P/2),$=Math.min(R[3]||0,x/2,P/2)),_.moveTo(F,0),_.lineTo(x-L,0),_.arc(x-L,L,L,Math.PI*3/2,0,!1),_.lineTo(x,P-U),_.arc(x-U,P-U,U,0,Math.PI/2,!1),_.lineTo($,P),_.arc($,P-$,$,Math.PI/2,Math.PI,!1),_.lineTo(0,F),_.arc(F,F,F,Math.PI,Math.PI*3/2,!1)}}})(zh);const re=St(xt({__proto__:null,default:Pe(zh)},[zh]));var as={},$h={},te={};Object.defineProperty(te,"__esModule",{value:!0});var Lf=te.getComponentValidator=Vf=te.getBooleanValidator=$f=te.getNumberArrayValidator=zf=te.getFunctionValidator=Bf=te.getStringOrGradientValidator=Uf=te.getStringValidator=Gf=te.getNumberOrAutoValidator=Nf=te.getNumberOrArrayOfNumbersValidator=Ff=te.getNumberValidator=Of=te.alphaComponent=If=te.RGBComponent=void 0;const xi=Nt,se=re;function Si(n){return se.Util._isString(n)?'"'+n+'"':Object.prototype.toString.call(n)==="[object Number]"||se.Util._isBoolean(n)?n:Object.prototype.toString.call(n)}function H_(n){return n>255?255:n<0?0:Math.round(n)}var If=te.RGBComponent=H_;function j_(n){return n>1?1:n<1e-4?1e-4:n}var Of=te.alphaComponent=j_;function X_(){if(xi.Konva.isUnminified)return function(n,t){return se.Util._isNumber(n)||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),n}}var Ff=te.getNumberValidator=X_;function Y_(n){if(xi.Konva.isUnminified)return function(t,e){let i=se.Util._isNumber(t),r=se.Util._isArray(t)&&t.length==n;return!i&&!r&&se.Util.warn(Si(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or Array<number>('+n+")"),t}}var Nf=te.getNumberOrArrayOfNumbersValidator=Y_;function q_(){if(xi.Konva.isUnminified)return function(n,t){var e=se.Util._isNumber(n),i=n==="auto";return e||i||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),n}}var Gf=te.getNumberOrAutoValidator=q_;function W_(){if(xi.Konva.isUnminified)return function(n,t){return se.Util._isString(n)||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),n}}var Uf=te.getStringValidator=W_;function K_(){if(xi.Konva.isUnminified)return function(n,t){const e=se.Util._isString(n),i=Object.prototype.toString.call(n)==="[object CanvasGradient]"||n&&n.addColorStop;return e||i||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),n}}var Bf=te.getStringOrGradientValidator=K_;function Z_(){if(xi.Konva.isUnminified)return function(n,t){return se.Util._isFunction(n)||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),n}}var zf=te.getFunctionValidator=Z_;function J_(){if(xi.Konva.isUnminified)return function(n,t){const e=Int8Array?Object.getPrototypeOf(Int8Array):null;return e&&n instanceof e||(se.Util._isArray(n)?n.forEach(function(i){se.Util._isNumber(i)||se.Util.warn('"'+t+'" attribute has non numeric element '+i+". Make sure that all elements are numbers.")}):se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),n}}var $f=te.getNumberArrayValidator=J_;function Q_(){if(xi.Konva.isUnminified)return function(n,t){var e=n===!0||n===!1;return e||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),n}}var Vf=te.getBooleanValidator=Q_;function t5(n){if(xi.Konva.isUnminified)return function(t,e){return t==null||se.Util.isObject(t)||se.Util.warn(Si(t)+' is a not valid value for "'+e+'" attribute. The value should be an object with properties '+n),t}}Lf=te.getComponentValidator=t5;const Gt=St(xt({__proto__:null,get RGBComponent(){return If},get alphaComponent(){return Of},default:te,get getBooleanValidator(){return Vf},get getComponentValidator(){return Lf},get getFunctionValidator(){return zf},get getNumberArrayValidator(){return $f},get getNumberOrArrayOfNumbersValidator(){return Nf},get getNumberOrAutoValidator(){return Gf},get getNumberValidator(){return Ff},get getStringOrGradientValidator(){return Bf},get getStringValidator(){return Uf}},[te]));(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Factory=void 0;const t=re,e=Gt;var i="get",r="set";n.Factory={addGetterSetter(s,a,o,h,l){n.Factory.addGetter(s,a,o),n.Factory.addSetter(s,a,h,l),n.Factory.addOverloadedGetterSetter(s,a)},addGetter(s,a,o){var h=i+t.Util._capitalize(a);s.prototype[h]=s.prototype[h]||function(){var l=this.attrs[a];return l===void 0?o:l}},addSetter(s,a,o,h){var l=r+t.Util._capitalize(a);s.prototype[l]||n.Factory.overWriteSetter(s,a,o,h)},overWriteSetter(s,a,o,h){var l=r+t.Util._capitalize(a);s.prototype[l]=function(c){return o&&c!==void 0&&c!==null&&(c=o.call(this,c,a)),this._setAttr(a,c),h&&h.call(this),this}},addComponentsGetterSetter(s,a,o,h,l){var c=o.length,d=t.Util._capitalize,f=i+d(a),u=r+d(a),m,v;s.prototype[f]=function(){var S={};for(m=0;m<c;m++)v=o[m],S[v]=this.getAttr(a+d(v));return S};var b=(0,e.getComponentValidator)(o);s.prototype[u]=function(S){var E=this.attrs[a],_;h&&(S=h.call(this,S)),b&&b.call(this,S,a);for(_ in S)S.hasOwnProperty(_)&&this._setAttr(a+d(_),S[_]);return S||o.forEach(x=>{this._setAttr(a+d(x),void 0)}),this._fireChangeEvent(a,E,S),l&&l.call(this),this},n.Factory.addOverloadedGetterSetter(s,a)},addOverloadedGetterSetter(s,a){var o=t.Util._capitalize(a),h=r+o,l=i+o;s.prototype[a]=function(){return arguments.length?(this[h](arguments[0]),this):this[l]()}},addDeprecatedGetterSetter(s,a,o,h){t.Util.error("Adding deprecated "+a);var l=i+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";s.prototype[l]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?o:d},n.Factory.addSetter(s,a,h,function(){t.Util.error(c)}),n.Factory.addOverloadedGetterSetter(s,a)},backCompat(s,a){t.Util.each(a,function(o,h){var l=s.prototype[h],c=i+t.Util._capitalize(o),d=r+t.Util._capitalize(o);function f(){l.apply(this,arguments),t.Util.error('"'+o+'" method is deprecated and will be removed soon. Use ""'+h+'" instead.')}s.prototype[o]=f,s.prototype[c]=f,s.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})($h);const Ft=St(xt({__proto__:null,default:Pe($h)},[$h]));var Ci={},Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});var Hf=Ti.HitContext=Wf=Ti.SceneContext=qf=Ti.Context=void 0;const jf=re,e5=Nt;function i5(n){var t=[],e=n.length,i=jf.Util,r,s;for(r=0;r<e;r++)s=n[r],i._isNumber(s)?s=Math.round(s*1e3)/1e3:i._isString(s)||(s=s+""),t.push(s);return t}var Xf=",",n5="(",r5=")",s5="([",a5="])",o5=";",h5="()",l5="=",Yf=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],c5=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const u5=100;class Na{constructor(t){this.canvas=t,e5.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){var i=this.traceArr,r=i.length,s="",a,o,h,l;for(a=0;a<r;a++)o=i[a],h=o.method,h?(l=o.args,s+=h,t?s+=h5:jf.Util._isArray(l[0])?s+=s5+l.join(Xf)+a5:(e&&(l=l.map(c=>typeof c=="number"?Math.floor(c):c)),s+=n5+l.join(Xf)+r5)):(s+=o.property,t||(s+=l5+o.val)),s+=o5;return s}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr,i;e.push(t),i=e.length,i>=u5&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();e!==1&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,r,s,a){this._context.arc(t,e,i,r,s,a)}arcTo(t,e,i,r,s){this._context.arcTo(t,e,i,r,s)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,r,s,a){this._context.bezierCurveTo(t,e,i,r,s,a)}clearRect(t,e,i,r){this._context.clearRect(t,e,i,r)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var i=arguments;if(i.length===2)return this._context.createImageData(t,e);if(i.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,i,r){return this._context.createLinearGradient(t,e,i,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,r,s,a){return this._context.createRadialGradient(t,e,i,r,s,a)}drawImage(t,e,i,r,s,a,o,h,l){var c=arguments,d=this._context;c.length===3?d.drawImage(t,e,i):c.length===5?d.drawImage(t,e,i,r,s):c.length===9&&d.drawImage(t,e,i,r,s,a,o,h,l)}ellipse(t,e,i,r,s,a,o,h){this._context.ellipse(t,e,i,r,s,a,o,h)}isPointInPath(t,e,i,r){return i?this._context.isPointInPath(i,t,e,r):this._context.isPointInPath(t,e,r)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,i,r){this._context.fillRect(t,e,i,r)}strokeRect(t,e,i,r){this._context.strokeRect(t,e,i,r)}fillText(t,e,i,r){r?this._context.fillText(t,e,i,r):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,r){return this._context.getImageData(t,e,i,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,r){this._context.rect(t,e,i,r)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,r){this._context.quadraticCurveTo(t,e,i,r)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,r,s,a){this._context.setTransform(t,e,i,r,s,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,r){this._context.strokeText(t,e,i,r)}transform(t,e,i,r,s,a){this._context.transform(t,e,i,r,s,a)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t=this,e=Yf.length,i=this.setAttr,r,s,a=function(o){var h=t[o],l;t[o]=function(){return s=i5(Array.prototype.slice.call(arguments,0)),l=h.apply(t,arguments),t._trace({method:o,args:s}),l}};for(r=0;r<e;r++)a(Yf[r]);t.setAttr=function(){i.apply(t,arguments);var o=arguments[0],h=arguments[1];(o==="shadowOffsetX"||o==="shadowOffsetY"||o==="shadowBlur")&&(h=h/this.canvas.getPixelRatio()),t._trace({property:o,val:h})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;var i=!e||e==="source-over";i||this.setAttr("globalCompositeOperation",e)}}var qf=Ti.Context=Na;c5.forEach(function(n){Object.defineProperty(Na.prototype,n,{get(){return this._context[n]},set(t){this._context[n]=t}})});class f5 extends Na{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),i=t.getFillPriority();if(e&&i==="color"){this._fillColor(t);return}const r=t.getFillPatternImage();if(r&&i==="pattern"){this._fillPattern(t);return}const s=t.getFillLinearGradientColorStops();if(s&&i==="linear-gradient"){this._fillLinearGradient(t);return}const a=t.getFillRadialGradientColorStops();if(a&&i==="radial-gradient"){this._fillRadialGradient(t);return}e?this._fillColor(t):r?this._fillPattern(t):s?this._fillLinearGradient(t):a&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(e.x,e.y,i.x,i.y);if(r){for(var a=0;a<r.length;a+=2)s.addColorStop(r[a],r[a+1]);this.setAttr("strokeStyle",s)}}_stroke(t){var e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var s=t.getStrokeLinearGradientColorStops();s?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}}_applyShadow(t){var e,i,r,s=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",a=(i=t.getShadowBlur())!==null&&i!==void 0?i:5,o=(r=t.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},h=t.getAbsoluteScale(),l=this.canvas.getPixelRatio(),c=h.x*l,d=h.y*l;this.setAttr("shadowColor",s),this.setAttr("shadowBlur",a*Math.min(Math.abs(c),Math.abs(d))),this.setAttr("shadowOffsetX",o.x*c),this.setAttr("shadowOffsetY",o.y*d)}}var Wf=Ti.SceneContext=f5;class d5 extends Na{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const s=t.getStrokeScaleEnabled();if(!s){this.save();var e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(t);var i=t.hitStrokeWidth(),r=i==="auto"?t.strokeWidth():i;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),s||this.restore()}}}Hf=Ti.HitContext=d5;const Kf=St(xt({__proto__:null,get Context(){return qf},get HitContext(){return Hf},get SceneContext(){return Wf},default:Ti},[Ti]));Object.defineProperty(Ci,"__esModule",{value:!0});var Zf=Ci.HitCanvas=ed=Ci.SceneCanvas=td=Ci.Canvas=void 0;const Ga=re,Jf=Kf,Qf=Nt,g5=Ft,p5=Gt;var Ua;function m5(){if(Ua)return Ua;var n=Ga.Util.createCanvasElement(),t=n.getContext("2d");return Ua=function(){var e=Qf.Konva._global.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/i}(),Ga.Util.releaseCanvas(n),Ua}class Ba{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=t||{},i=e.pixelRatio||Qf.Konva.pixelRatio||m5();this.pixelRatio=i,this._canvas=Ga.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio,i=this.getContext()._context;i.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio,i=this.getContext()._context;i.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch{try{return this._canvas.toDataURL()}catch(r){return Ga.Util.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}var td=Ci.Canvas=Ba;g5.Factory.addGetterSetter(Ba,"pixelRatio",void 0,(0,p5.getNumberValidator)());class v5 extends Ba{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new Jf.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}var ed=Ci.SceneCanvas=v5;class _5 extends Ba{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new Jf.HitContext(this),this.setSize(t.width,t.height)}}Zf=Ci.HitCanvas=_5;const za=St(xt({__proto__:null,get Canvas(){return td},get HitCanvas(){return Zf},get SceneCanvas(){return ed},default:Ci},[Ci]));var Vh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.DD=void 0;const t=Nt,e=re;n.DD={get isDragging(){var i=!1;return n.DD._dragElements.forEach(r=>{r.dragStatus==="dragging"&&(i=!0)}),i},justDragged:!1,get node(){var i;return n.DD._dragElements.forEach(r=>{i=r.node}),i},_dragElements:new Map,_drag(i){const r=[];n.DD._dragElements.forEach((s,a)=>{const{node:o}=s,h=o.getStage();h.setPointersPositions(i),s.pointerId===void 0&&(s.pointerId=e.Util._getFirstPointerId(i));const l=h._changedPointerPositions.find(f=>f.id===s.pointerId);if(l){if(s.dragStatus!=="dragging"){var c=o.dragDistance(),d=Math.max(Math.abs(l.x-s.startPointerPos.x),Math.abs(l.y-s.startPointerPos.y));if(d<c||(o.startDrag({evt:i}),!o.isDragging()))return}o._setDragPosition(i,s),r.push(o)}}),r.forEach(s=>{s.fire("dragmove",{type:"dragmove",target:s,evt:i},!0)})},_endDragBefore(i){const r=[];n.DD._dragElements.forEach(s=>{const{node:a}=s,o=a.getStage();if(i&&o.setPointersPositions(i),!o._changedPointerPositions.find(c=>c.id===s.pointerId))return;(s.dragStatus==="dragging"||s.dragStatus==="stopped")&&(n.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,s.dragStatus="stopped");const l=s.node.getLayer()||s.node instanceof t.Konva.Stage&&s.node;l&&r.indexOf(l)===-1&&r.push(l)}),r.forEach(s=>{s.draw()})},_endDragAfter(i){n.DD._dragElements.forEach((r,s)=>{r.dragStatus==="stopped"&&r.node.fire("dragend",{type:"dragend",target:r.node,evt:i},!0),r.dragStatus!=="dragging"&&n.DD._dragElements.delete(s)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",n.DD._endDragBefore,!0),window.addEventListener("touchend",n.DD._endDragBefore,!0),window.addEventListener("mousemove",n.DD._drag),window.addEventListener("touchmove",n.DD._drag),window.addEventListener("mouseup",n.DD._endDragAfter,!1),window.addEventListener("touchend",n.DD._endDragAfter,!1))})(Vh);const Hh=St(xt({__proto__:null,default:Pe(Vh)},[Vh]));Object.defineProperty(as,"__esModule",{value:!0});var id=as.Node=void 0;const Ut=re,os=Ft,$a=za,Tn=Nt,Xe=Hh,he=Gt;var Va="absoluteOpacity",Ha="allEventListeners",ki="absoluteTransform",nd="absoluteScale",kn="canvas",y5="Change",w5="children",b5="konva",jh="listening",rd="mouseenter",sd="mouseleave",ad="set",od="Shape",ja=" ",hd="stage",Zi="transform",x5="Stage",Xh="visible",S5=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(ja);let C5=1,Lt=class Rl{constructor(t){this._id=C5++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===Zi||t===ki)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){var i=this._cache.get(t),r=t===Zi||t===ki,s=i===void 0||r&&i.dirty===!0;return s&&(i=e.call(this),this._cache.set(t,i)),i}_calculate(t,e,i){if(!this._attachedDepsListeners.get(t)){const r=e.map(s=>s+"Change.konva").join(ja);this.on(r,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}_getCanvasCache(){return this._cache.get(kn)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===ki&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(kn)){const{scene:t,filter:e,hit:i}=this._cache.get(kn);Ut.Util.releaseCanvas(t,e,i),this._cache.delete(kn)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},i={};(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)&&(i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var r=Math.ceil(e.width||i.width),s=Math.ceil(e.height||i.height),a=e.pixelRatio,o=e.x===void 0?Math.floor(i.x):e.x,h=e.y===void 0?Math.floor(i.y):e.y,l=e.offset||0,c=e.drawBorder||!1,d=e.hitCanvasPixelRatio||1;if(!r||!s){Ut.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}r+=l*2+1,s+=l*2+1,o-=l,h-=l;var f=new $a.SceneCanvas({pixelRatio:a,width:r,height:s}),u=new $a.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),m=new $a.HitCanvas({pixelRatio:d,width:r,height:s}),v=f.getContext(),b=m.getContext();return m.isCache=!0,f.isCache=!0,this._cache.delete(kn),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),v.save(),b.save(),v.translate(-o,-h),b.translate(-o,-h),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Va),this._clearSelfAndDescendantCache(nd),this.drawScene(f,this),this.drawHit(m,this),this._isUnderCache=!1,v.restore(),b.restore(),c&&(v.save(),v.beginPath(),v.rect(0,0,r,s),v.closePath(),v.setAttr("strokeStyle","red"),v.setAttr("lineWidth",5),v.stroke(),v.restore()),this._cache.set(kn,{scene:f,filter:u,hit:m,x:o,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(kn)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],r=1/0,s=1/0,a=-1/0,o=-1/0,h=this.getAbsoluteTransform(e);return i.forEach(function(l){var c=h.point(l);r===void 0&&(r=a=c.x,s=o=c.y),r=Math.min(r,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)}),{x:r,y:s,width:a-r,height:o-s}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);var i=this._getCachedSceneCanvas(),r=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/r,i.height/r),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),i=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0,i.width/i.pixelRatio,i.height/i.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),e=this._getCanvasCache(),i=e.scene,r=e.filter,s=r.getContext(),a,o,h,l;if(t){if(!this._filterUpToDate){var c=i.pixelRatio;r.setSize(i.width/i.pixelRatio,i.height/i.pixelRatio);try{for(a=t.length,s.clear(),s.drawImage(i._canvas,0,0,i.getWidth()/c,i.getHeight()/c),o=s.getImageData(0,0,r.getWidth(),r.getHeight()),h=0;h<a;h++){if(l=t[h],typeof l!="function"){Ut.Util.error("Filter should be type of function, but got "+typeof l+" instead. Please check correct filters");continue}l.call(this,o),s.putImageData(o,0,0)}}catch(d){Ut.Util.error("Unable to apply filter. "+d.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return r}return i}on(t,e){if(this._cache&&this._cache.delete(Ha),arguments.length===3)return this._delegate.apply(this,arguments);var i=t.split(ja),r=i.length,s,a,o,h,l;for(s=0;s<r;s++)a=i[s],o=a.split("."),h=o[0],l=o[1]||"",this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:l,handler:e});return this}off(t,e){var i=(t||"").split(ja),r=i.length,s,a,o,h,l,c;if(this._cache&&this._cache.delete(Ha),!t)for(a in this.eventListeners)this._off(a);for(s=0;s<r;s++)if(o=i[s],h=o.split("."),l=h[0],c=h[1],l)this.eventListeners[l]&&this._off(l,c,e);else for(a in this.eventListeners)this._off(a,c,e);return this}dispatchEvent(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(i){e.call(this,i.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,i){var r=this;this.on(t,function(s){for(var a=s.target.findAncestors(e,!0,r),o=0;o<a.length;o++)s=Ut.Util.cloneObject(s),s.currentTarget=a[o],i.call(a[o],s)})}remove(){return this.isDragging()&&this.stopDrag(),Xe.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(ki),this._clearSelfAndDescendantCache(Va),this._clearSelfAndDescendantCache(nd),this._clearSelfAndDescendantCache(hd),this._clearSelfAndDescendantCache(Xh),this._clearSelfAndDescendantCache(jh)}_remove(){this._clearCaches();var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){var e="get"+Ut.Util._capitalize(t);return Ut.Util._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){for(var t=this.getParent(),e=[];t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{var e,i;if(!t)return this;for(e in t)e!==w5&&(i=ad+Ut.Util._capitalize(e),Ut.Util._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(jh,this._isListening)}_isListening(t){if(!this.listening())return!1;const i=this.getParent();return i&&i!==t&&this!==t?i._isListening(t):!0}isVisible(){return this._getCache(Xh,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const i=this.getParent();return i&&i!==t&&this!==t?i._isVisible(t):!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var i=this.getLayer(),r=!1;Xe.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===i)&&(r=!0)});var s=!e&&!Tn.Konva.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!s}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),e=this,i=0,r,s,a,o;function h(c){for(r=[],s=c.length,a=0;a<s;a++)o=c[a],i++,o.nodeType!==od&&(r=r.concat(o.getChildren().slice())),o._id===e._id&&(a=s);r.length>0&&r[0].getDepth()<=t&&h(r)}const l=this.getStage();return e.nodeType!==x5&&l&&h(l.getChildren()),i}getDepth(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Zi),this._clearSelfAndDescendantCache(ki)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;var e=t.getPointerPosition();if(!e)return null;var i=this.getAbsoluteTransform().copy();return i.invert(),i.point(e)}getAbsolutePosition(t){let e=!1,i=this.parent;for(;i;){if(i.isCached()){e=!0;break}i=i.parent}e&&!t&&(t=!0);var r=this.getAbsoluteTransform(t).getMatrix(),s=new Ut.Transform,a=this.offset();return s.m=r.slice(),s.translate(a.x,a.y),s.getTranslation()}setAbsolutePosition(t){const{x:e,y:i,...r}=this._clearTransform();this.attrs.x=e,this.attrs.y=i,this._clearCache(Zi);var s=this._getAbsoluteTransform().copy();return s.invert(),s.translate(t.x,t.y),t={x:this.attrs.x+s.getTranslation().x,y:this.attrs.y+s.getTranslation().y},this._setTransform(r),this.setPosition({x:t.x,y:t.y}),this._clearCache(Zi),this._clearSelfAndDescendantCache(ki),this}_setTransform(t){var e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var e=t.x,i=t.y,r=this.x(),s=this.y();return e!==void 0&&(r+=e),i!==void 0&&(s+=i),this.setPosition({x:r,y:s}),this}_eachAncestorReverse(t,e){var i=[],r=this.getParent(),s,a;if(!(e&&e._id===this._id)){for(i.unshift(this);r&&(!e||r._id!==e._id);)i.unshift(r),r=r.parent;for(s=i.length,a=0;a<s;a++)t(i[a])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveUp function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveDown function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Ut.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Ut.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Va,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},e=this.getAttrs(),i,r,s,a,o;t.attrs={};for(i in e)r=e[i],o=Ut.Util.isObject(r)&&!Ut.Util._isPlainObject(r)&&!Ut.Util._isArray(r),!o&&(s=typeof this[i]=="function"&&this[i],delete e[i],a=s?s.call(this):null,e[i]=r,a!==r&&(t.attrs[i]=r));return t.className=this.getClassName(),Ut.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,i){var r=[];e&&this._isMatch(t)&&r.push(this);for(var s=this.parent;s;){if(s===i)return r;s._isMatch(t)&&r.push(s),s=s.parent}return r}isAncestorOf(t){return!1}findAncestor(t,e,i){return this.findAncestors(t,e,i)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var e=t.replace(/ /g,"").split(","),i=e.length,r,s;for(r=0;r<i;r++)if(s=e[r],Ut.Util.isValidSelector(s)||(Ut.Util.warn('Selector "'+s+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Ut.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Ut.Util.warn("Konva is awesome, right?")),s.charAt(0)==="#"){if(this.id()===s.slice(1))return!0}else if(s.charAt(0)==="."){if(this.hasName(s.slice(1)))return!0}else if(this.className===s||this.nodeType===s)return!0;return!1}getLayer(){var t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(hd,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():null}fire(t,e={},i){return e.target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(ki,this._getAbsoluteTransform)}_getAbsoluteTransform(t){var e;if(t)return e=new Ut.Transform,this._eachAncestorReverse(function(r){var s=r.transformsEnabled();s==="all"?e.multiply(r.getTransform()):s==="position"&&e.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),e;e=this._cache.get(ki)||new Ut.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var i=this.transformsEnabled();if(i==="all")e.multiply(this.getTransform());else if(i==="position"){const r=this.attrs.x||0,s=this.attrs.y||0,a=this.attrs.offsetX||0,o=this.attrs.offsetY||0;e.translate(r-a,s-o)}return e.dirty=!1,e}getAbsoluteScale(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();const r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Zi,this._getTransform)}_getTransform(){var t,e,i=this._cache.get(Zi)||new Ut.Transform;i.reset();var r=this.x(),s=this.y(),a=Tn.Konva.getAngle(this.rotation()),o=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,h=(e=this.attrs.scaleY)!==null&&e!==void 0?e:1,l=this.attrs.skewX||0,c=this.attrs.skewY||0,d=this.attrs.offsetX||0,f=this.attrs.offsetY||0;return(r!==0||s!==0)&&i.translate(r,s),a!==0&&i.rotate(a),(l!==0||c!==0)&&i.skew(l,c),(o!==1||h!==1)&&i.scale(o,h),(d!==0||f!==0)&&i.translate(-1*d,-1*f),i.dirty=!1,i}clone(t){var e=Ut.Util.cloneObject(this.attrs),i,r,s,a,o;for(i in t)e[i]=t[i];var h=new this.constructor(e);for(i in this.eventListeners)for(r=this.eventListeners[i],s=r.length,a=0;a<s;a++)o=r[a],o.name.indexOf(b5)<0&&(h.eventListeners[i]||(h.eventListeners[i]=[]),h.eventListeners[i].push(o));return h}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),i=this.getStage(),r=t.x!==void 0?t.x:Math.floor(e.x),s=t.y!==void 0?t.y:Math.floor(e.y),a=t.pixelRatio||1,o=new $a.SceneCanvas({width:t.width||Math.ceil(e.width)||(i?i.width():0),height:t.height||Math.ceil(e.height)||(i?i.height():0),pixelRatio:a}),h=o.getContext();return t.imageSmoothingEnabled===!1&&(h._context.imageSmoothingEnabled=!1),h.save(),(r||s)&&h.translate(-1*r,-1*s),this.drawScene(o),h.restore(),o}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};var e=t.mimeType||null,i=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(r),r}toImage(t){return new Promise((e,i)=>{try{const r=t?.callback;r&&delete t.callback,Ut.Util._urlToImage(this.toDataURL(t),function(s){e(s),r?.(s)})}catch(r){i(r)}})}toBlob(t){return new Promise((e,i)=>{try{const r=t?.callback;r&&delete t.callback,this.toCanvas(t).toBlob(s=>{e(s),r?.(s)})}catch(r){i(r)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Tn.Konva.dragDistance}_off(t,e,i){var r=this.eventListeners[t],s,a,o;for(s=0;s<r.length;s++)if(a=r[s].name,o=r[s].handler,(a!=="konva"||e==="konva")&&(!e||a===e)&&(!i||i===o)){if(r.splice(s,1),r.length===0){delete this.eventListeners[t];break}s--}}_fireChangeEvent(t,e,i){this._fire(t+y5,{oldVal:e,newVal:i})}addName(t){if(!this.hasName(t)){var e=this.name(),i=e?e+" "+t:t;this.name(i)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;var i=(e||"").split(/\s/g);return i.indexOf(t)!==-1}removeName(t){var e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return i!==-1&&(e.splice(i,1),this.name(e.join(" "))),this}setAttr(t,e){var i=this[ad+Ut.Util._capitalize(t)];return Ut.Util._isFunction(i)?i.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(Tn.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,e){var i=this.attrs[t];i===e&&!Ut.Util.isObject(e)||(e==null?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,i,e),this._requestDraw())}_setComponentAttr(t,e,i){var r;i!==void 0&&(r=this.attrs[t],r||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,r,i))}_fireAndBubble(t,e,i){e&&this.nodeType===od&&(e.target=this);var r=(t===rd||t===sd)&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||this.nodeType==="Stage"&&!i);if(!r){this._fire(t,e);var s=(t===rd||t===sd)&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!s&&(i&&i.parent?this._fireAndBubble.call(this.parent,t,e,i):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,i,r;const s=(e=this._cache.get(Ha))!==null&&e!==void 0?e:{};let a=s?.[t];if(a===void 0){a=[];let o=Object.getPrototypeOf(this);for(;o;){const h=(r=(i=o.eventListeners)===null||i===void 0?void 0:i[t])!==null&&r!==void 0?r:[];a.push(...h),o=Object.getPrototypeOf(o)}s[t]=a,this._cache.set(Ha,s)}return a}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;const i=this._getProtoListeners(t);if(i)for(var r=0;r<i.length;r++)i[r].handler.call(this,e);const s=this.eventListeners[t];if(s)for(var r=0;r<s.length;r++)s[r].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){var e=t?t.pointerId:void 0,i=this.getStage(),r=this.getAbsolutePosition();if(i){var s=i._getPointerById(e)||i._changedPointerPositions[0]||r;Xe.DD._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-r.x,y:s.y-r.y},dragStatus:"ready",pointerId:e})}}startDrag(t,e=!0){Xe.DD._dragElements.has(this._id)||this._createDragElement(t);const i=Xe.DD._dragElements.get(this._id);i.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const i=this.getStage()._getPointerById(e.pointerId);if(i){var r={x:i.x-e.offset.x,y:i.y-e.offset.y},s=this.dragBoundFunc();if(s!==void 0){const a=s.call(this,r,t);a?r=a:Ut.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(t){const e=Xe.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),Xe.DD._endDragBefore(t),Xe.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Xe.DD._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){var e=t.evt.button!==void 0,i=!e||Tn.Konva.dragButtons.indexOf(t.evt.button)>=0;if(i&&!this.isDragging()){var r=!1;Xe.DD._dragElements.forEach(s=>{this.isAncestorOf(s.node)&&(r=!0)}),r||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const e=Xe.DD._dragElements.get(this._id),i=e&&e.dragStatus==="dragging",r=e&&e.dragStatus==="ready";i?this.stopDrag():r&&Xe.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const e=this.getStage();if(!e)return!1;const i={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return Ut.Util.haveIntersection(i,this.getClientRect())}static create(t,e){return Ut.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var i=Rl.prototype.getClassName.call(t),r=t.children,s,a,o;e&&(t.attrs.container=e),Tn.Konva[i]||(Ut.Util.warn('Can not find a node with class name "'+i+'". Fallback to "Shape".'),i="Shape");const h=Tn.Konva[i];if(s=new h(t.attrs),r)for(a=r.length,o=0;o<a;o++)s.add(Rl._createNode(r[o]));return s}};id=as.Node=Lt,Lt.prototype.nodeType="Node",Lt.prototype._attrsAffectingSize=[],Lt.prototype.eventListeners={},Lt.prototype.on.call(Lt.prototype,S5,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Zi),this._clearSelfAndDescendantCache(ki)}),Lt.prototype.on.call(Lt.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Xh)}),Lt.prototype.on.call(Lt.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(jh)}),Lt.prototype.on.call(Lt.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(Va)});const Zt=os.Factory.addGetterSetter;Zt(Lt,"zIndex"),Zt(Lt,"absolutePosition"),Zt(Lt,"position"),Zt(Lt,"x",0,(0,he.getNumberValidator)()),Zt(Lt,"y",0,(0,he.getNumberValidator)()),Zt(Lt,"globalCompositeOperation","source-over",(0,he.getStringValidator)()),Zt(Lt,"opacity",1,(0,he.getNumberValidator)()),Zt(Lt,"name","",(0,he.getStringValidator)()),Zt(Lt,"id","",(0,he.getStringValidator)()),Zt(Lt,"rotation",0,(0,he.getNumberValidator)()),os.Factory.addComponentsGetterSetter(Lt,"scale",["x","y"]),Zt(Lt,"scaleX",1,(0,he.getNumberValidator)()),Zt(Lt,"scaleY",1,(0,he.getNumberValidator)()),os.Factory.addComponentsGetterSetter(Lt,"skew",["x","y"]),Zt(Lt,"skewX",0,(0,he.getNumberValidator)()),Zt(Lt,"skewY",0,(0,he.getNumberValidator)()),os.Factory.addComponentsGetterSetter(Lt,"offset",["x","y"]),Zt(Lt,"offsetX",0,(0,he.getNumberValidator)()),Zt(Lt,"offsetY",0,(0,he.getNumberValidator)()),Zt(Lt,"dragDistance",null,(0,he.getNumberValidator)()),Zt(Lt,"width",0,(0,he.getNumberValidator)()),Zt(Lt,"height",0,(0,he.getNumberValidator)()),Zt(Lt,"listening",!0,(0,he.getBooleanValidator)()),Zt(Lt,"preventDefault",!0,(0,he.getBooleanValidator)()),Zt(Lt,"filters",null,function(n){return this._filterUpToDate=!1,n}),Zt(Lt,"visible",!0,(0,he.getBooleanValidator)()),Zt(Lt,"transformsEnabled","all",(0,he.getStringValidator)()),Zt(Lt,"size"),Zt(Lt,"dragBoundFunc"),Zt(Lt,"draggable",!1,(0,he.getBooleanValidator)()),os.Factory.backCompat(Lt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});const le=St(xt({__proto__:null,get Node(){return id},default:as},[as]));var hs={};Object.defineProperty(hs,"__esModule",{value:!0});var ld=hs.Container=void 0;const nr=Ft,Yh=le,Xa=Gt;class En extends Yh.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var i=[];return e.forEach(function(r){t(r)&&i.push(r)}),i}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var e=0;e<t.length;e++)this.add(t[e]);return this}const i=t[0];return i.getParent()?(i.moveTo(this),this):(this._validateAdd(i),i.index=this.getChildren().length,i.parent=this,i._clearCaches(),this.getChildren().push(i),this._fire("add",{child:i}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var i=[];return this._descendants(r=>{const s=r._isMatch(t);return s&&i.push(r),!!(s&&e)}),i}_descendants(t){let e=!1;const i=this.getChildren();for(const r of i){if(e=t(r),e)return!0;if(r.hasChildren()&&(e=r._descendants(t),e))return!0}return!1}toObject(){var t=Yh.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var e=Yh.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(i){e.add(i.clone())}),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach(i=>{i.isVisible()&&i.intersects(t)&&e.push(i)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),!this.isCached()&&((e=this.children)===null||e===void 0||e.forEach(function(i){i._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,i){e.index=i}),this._requestDraw()}drawScene(t,e){var i=this.getLayer(),r=t||i&&i.getCanvas(),s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.scene,h=r&&r.isCache;if(!this.isVisible()&&!h)return this;if(o){s.save();var l=this.getAbsoluteTransform(e).getMatrix();s.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",r,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var i=this.getLayer(),r=t||i&&i.hitCanvas,s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.hit;if(o){s.save();var h=this.getAbsoluteTransform(e).getMatrix();s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",r,e);return this}_drawChildren(t,e,i){var r,s=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),h=this.clipFunc(),l=a&&o||h;const c=i===this;if(l){s.save();var d=this.getAbsoluteTransform(i),f=d.getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s.beginPath();let b;if(h)b=h.call(this,s,this);else{var u=this.clipX(),m=this.clipY();s.rect(u,m,a,o)}s.clip.apply(s,b),f=d.copy().invert().getMatrix(),s.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var v=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";v&&(s.save(),s._applyGlobalCompositeOperation(this)),(r=this.children)===null||r===void 0||r.forEach(function(b){b[t](e,i)}),v&&s.restore(),l&&s.restore()}getClientRect(t={}){var e,i=t.skipTransform,r=t.relativeTo,s,a,o,h,l={x:1/0,y:1/0,width:0,height:0},c=this;(e=this.children)===null||e===void 0||e.forEach(function(v){if(v.visible()){var b=v.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});b.width===0&&b.height===0||(s===void 0?(s=b.x,a=b.y,o=b.x+b.width,h=b.y+b.height):(s=Math.min(s,b.x),a=Math.min(a,b.y),o=Math.max(o,b.x+b.width),h=Math.max(h,b.y+b.height)))}});for(var d=this.find("Shape"),f=!1,u=0;u<d.length;u++){var m=d[u];if(m._isVisible(this)){f=!0;break}}return f&&s!==void 0?l={x:s,y:a,width:o-s,height:h-a}:l={x:0,y:0,width:0,height:0},i?l:this._transformedRect(l,r)}}ld=hs.Container=En,nr.Factory.addComponentsGetterSetter(En,"clip",["x","y","width","height"]),nr.Factory.addGetterSetter(En,"clipX",void 0,(0,Xa.getNumberValidator)()),nr.Factory.addGetterSetter(En,"clipY",void 0,(0,Xa.getNumberValidator)()),nr.Factory.addGetterSetter(En,"clipWidth",void 0,(0,Xa.getNumberValidator)()),nr.Factory.addGetterSetter(En,"clipHeight",void 0,(0,Xa.getNumberValidator)()),nr.Factory.addGetterSetter(En,"clipFunc");const Ya=St(xt({__proto__:null,get Container(){return ld},default:hs},[hs]));var qh={},Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});var cd=Ge.releaseCapture=pd=Ge.setPointerCapture=gd=Ge.hasPointerCapture=dd=Ge.createEvent=fd=Ge.getCapturedShape=void 0;const T5=Nt,ls=new Map,ud=T5.Konva._global.PointerEvent!==void 0;function k5(n){return ls.get(n)}var fd=Ge.getCapturedShape=k5;function Wh(n){return{evt:n,pointerId:n.pointerId}}var dd=Ge.createEvent=Wh;function E5(n,t){return ls.get(n)===t}var gd=Ge.hasPointerCapture=E5;function P5(n,t){md(n),t.getStage()&&(ls.set(n,t),ud&&t._fire("gotpointercapture",Wh(new PointerEvent("gotpointercapture"))))}var pd=Ge.setPointerCapture=P5;function md(n,t){const e=ls.get(n);if(!e)return;const i=e.getStage();i&&i.content,ls.delete(n),ud&&e._fire("lostpointercapture",Wh(new PointerEvent("lostpointercapture")))}cd=Ge.releaseCapture=md;const vd=St(xt({__proto__:null,get createEvent(){return dd},default:Ge,get getCapturedShape(){return fd},get hasPointerCapture(){return gd},get releaseCapture(){return cd},get setPointerCapture(){return pd}},[Ge]));(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Stage=n.stages=void 0;const t=re,e=Ft,i=Ya,r=Nt,s=za,a=Hh,o=Nt,h=vd;var l="Stage",c="string",d="px",f="mouseout",u="mouseleave",m="mouseover",v="mouseenter",b="mousemove",S="mousedown",E="mouseup",_="pointermove",x="pointerdown",P="pointerup",R="pointercancel",F="lostpointercapture",L="pointerout",$="pointerleave",U="pointerover",z="pointerenter",q="contextmenu",K="touchstart",Z="touchend",at="touchmove",vt="touchcancel",_t="wheel",pt=5,nt=[[v,"_pointerenter"],[S,"_pointerdown"],[b,"_pointermove"],[E,"_pointerup"],[u,"_pointerleave"],[K,"_pointerdown"],[at,"_pointermove"],[Z,"_pointerup"],[vt,"_pointercancel"],[m,"_pointerover"],[_t,"_wheel"],[q,"_contextmenu"],[x,"_pointerdown"],[_,"_pointermove"],[P,"_pointerup"],[R,"_pointercancel"],[F,"_lostpointercapture"]];const J={mouse:{[L]:f,[$]:u,[U]:m,[z]:v,[_]:b,[x]:S,[P]:E,[R]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[L]:"touchout",[$]:"touchleave",[U]:"touchover",[z]:"touchenter",[_]:at,[x]:K,[P]:Z,[R]:vt,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[L]:L,[$]:$,[U]:U,[z]:z,[_]:_,[x]:x,[P]:P,[R]:R,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},I=W=>W.indexOf("pointer")>=0?"pointer":W.indexOf("touch")>=0?"touch":"mouse",D=W=>{const N=I(W);if(N==="pointer")return r.Konva.pointerEventsEnabled&&J.pointer;if(N==="touch")return J.touch;if(N==="mouse")return J.mouse};function A(W={}){return(W.clipFunc||W.clipWidth||W.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),W}const B="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";n.stages=[];class j extends i.Container{constructor(N){super(A(N)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),n.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{A(this.attrs)}),this._checkVisibility()}_validateAdd(N){const Y=N.getType()==="Layer",X=N.getType()==="FastLayer";Y||X||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const N=this.visible()?"":"none";this.content.style.display=N}setContainer(N){if(typeof N===c){if(N.charAt(0)==="."){var Y=N.slice(1);N=document.getElementsByClassName(Y)[0]}else{var X;N.charAt(0)!=="#"?X=N:X=N.slice(1),N=document.getElementById(X)}if(!N)throw"Can not find container in document with id "+X}return this._setAttr("container",N),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),N.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var N=this.children,Y=N.length,X;for(X=0;X<Y;X++)N[X].clear();return this}clone(N){return N||(N={}),N.container=typeof document<"u"&&document.createElement("div"),i.Container.prototype.clone.call(this,N)}destroy(){super.destroy();var N=this.content;N&&t.Util._isInDocument(N)&&this.container().removeChild(N);var Y=n.stages.indexOf(this);return Y>-1&&n.stages.splice(Y,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const N=this._pointerPositions[0]||this._changedPointerPositions[0];return N?{x:N.x,y:N.y}:(t.Util.warn(B),null)}_getPointerById(N){return this._pointerPositions.find(Y=>Y.id===N)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(N){N=N||{},N.x=N.x||0,N.y=N.y||0,N.width=N.width||this.width(),N.height=N.height||this.height();var Y=new s.SceneCanvas({width:N.width,height:N.height,pixelRatio:N.pixelRatio||1}),X=Y.getContext()._context,et=this.children;return(N.x||N.y)&&X.translate(-1*N.x,-1*N.y),et.forEach(function(ht){if(ht.isVisible()){var mt=ht._toKonvaCanvas(N);X.drawImage(mt._canvas,N.x,N.y,mt.getWidth()/mt.getPixelRatio(),mt.getHeight()/mt.getPixelRatio())}}),Y}getIntersection(N){if(!N)return null;var Y=this.children,X=Y.length,et=X-1,ht;for(ht=et;ht>=0;ht--){const mt=Y[ht].getIntersection(N);if(mt)return mt}return null}_resizeDOM(){var N=this.width(),Y=this.height();this.content&&(this.content.style.width=N+d,this.content.style.height=Y+d),this.bufferCanvas.setSize(N,Y),this.bufferHitCanvas.setSize(N,Y),this.children.forEach(X=>{X.setSize({width:N,height:Y}),X.draw()})}add(N,...Y){if(arguments.length>1){for(var X=0;X<arguments.length;X++)this.add(arguments[X]);return this}super.add(N);var et=this.children.length;return et>pt&&t.Util.warn("The stage has "+et+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),N.setSize({width:this.width(),height:this.height()}),N.draw(),r.Konva.isBrowser&&this.content.appendChild(N.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(N){return h.hasPointerCapture(N,this)}setPointerCapture(N){h.setPointerCapture(N,this)}releaseCapture(N){h.releaseCapture(N,this)}getLayers(){return this.children}_bindContentEvents(){r.Konva.isBrowser&&nt.forEach(([N,Y])=>{this.content.addEventListener(N,X=>{this[Y](X)},{passive:!1})})}_pointerenter(N){this.setPointersPositions(N);const Y=D(N.type);Y&&this._fire(Y.pointerenter,{evt:N,target:this,currentTarget:this})}_pointerover(N){this.setPointersPositions(N);const Y=D(N.type);Y&&this._fire(Y.pointerover,{evt:N,target:this,currentTarget:this})}_getTargetShape(N){let Y=this[N+"targetShape"];return Y&&!Y.getStage()&&(Y=null),Y}_pointerleave(N){const Y=D(N.type),X=I(N.type);if(Y){this.setPointersPositions(N);var et=this._getTargetShape(X),ht=!a.DD.isDragging||r.Konva.hitOnDragEnabled;et&&ht?(et._fireAndBubble(Y.pointerout,{evt:N}),et._fireAndBubble(Y.pointerleave,{evt:N}),this._fire(Y.pointerleave,{evt:N,target:this,currentTarget:this}),this[X+"targetShape"]=null):ht&&(this._fire(Y.pointerleave,{evt:N,target:this,currentTarget:this}),this._fire(Y.pointerout,{evt:N,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(N){const Y=D(N.type),X=I(N.type);if(Y){this.setPointersPositions(N);var et=!1;this._changedPointerPositions.forEach(ht=>{var mt=this.getIntersection(ht);if(a.DD.justDragged=!1,r.Konva["_"+X+"ListenClick"]=!0,!mt||!mt.isListening())return;r.Konva.capturePointerEventsEnabled&&mt.setPointerCapture(ht.id),this[X+"ClickStartShape"]=mt,mt._fireAndBubble(Y.pointerdown,{evt:N,pointerId:ht.id}),et=!0;const bt=N.type.indexOf("touch")>=0;mt.preventDefault()&&N.cancelable&&bt&&N.preventDefault()}),et||this._fire(Y.pointerdown,{evt:N,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(N){const Y=D(N.type),X=I(N.type);if(!Y)return;a.DD.isDragging&&a.DD.node.preventDefault()&&N.cancelable&&N.preventDefault(),this.setPointersPositions(N);var et=!a.DD.isDragging||r.Konva.hitOnDragEnabled;if(!et)return;var ht={};let mt=!1;var bt=this._getTargetShape(X);this._changedPointerPositions.forEach(Tt=>{const yt=h.getCapturedShape(Tt.id)||this.getIntersection(Tt),Et=Tt.id,Pt={evt:N,pointerId:Et};var Ot=bt!==yt;if(Ot&&bt&&(bt._fireAndBubble(Y.pointerout,{...Pt},yt),bt._fireAndBubble(Y.pointerleave,{...Pt},yt)),yt){if(ht[yt._id])return;ht[yt._id]=!0}yt&&yt.isListening()?(mt=!0,Ot&&(yt._fireAndBubble(Y.pointerover,{...Pt},bt),yt._fireAndBubble(Y.pointerenter,{...Pt},bt),this[X+"targetShape"]=yt),yt._fireAndBubble(Y.pointermove,{...Pt})):bt&&(this._fire(Y.pointerover,{evt:N,target:this,currentTarget:this,pointerId:Et}),this[X+"targetShape"]=null)}),mt||this._fire(Y.pointermove,{evt:N,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(N){const Y=D(N.type),X=I(N.type);if(!Y)return;this.setPointersPositions(N);const et=this[X+"ClickStartShape"],ht=this[X+"ClickEndShape"];var mt={};let bt=!1;this._changedPointerPositions.forEach(Tt=>{const yt=h.getCapturedShape(Tt.id)||this.getIntersection(Tt);if(yt){if(yt.releaseCapture(Tt.id),mt[yt._id])return;mt[yt._id]=!0}const Et=Tt.id,Pt={evt:N,pointerId:Et};let Ot=!1;r.Konva["_"+X+"InDblClickWindow"]?(Ot=!0,clearTimeout(this[X+"DblTimeout"])):a.DD.justDragged||(r.Konva["_"+X+"InDblClickWindow"]=!0,clearTimeout(this[X+"DblTimeout"])),this[X+"DblTimeout"]=setTimeout(function(){r.Konva["_"+X+"InDblClickWindow"]=!1},r.Konva.dblClickWindow),yt&&yt.isListening()?(bt=!0,this[X+"ClickEndShape"]=yt,yt._fireAndBubble(Y.pointerup,{...Pt}),r.Konva["_"+X+"ListenClick"]&&et&&et===yt&&(yt._fireAndBubble(Y.pointerclick,{...Pt}),Ot&&ht&&ht===yt&&yt._fireAndBubble(Y.pointerdblclick,{...Pt}))):(this[X+"ClickEndShape"]=null,r.Konva["_"+X+"ListenClick"]&&this._fire(Y.pointerclick,{evt:N,target:this,currentTarget:this,pointerId:Et}),Ot&&this._fire(Y.pointerdblclick,{evt:N,target:this,currentTarget:this,pointerId:Et}))}),bt||this._fire(Y.pointerup,{evt:N,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r.Konva["_"+X+"ListenClick"]=!1,N.cancelable&&X!=="touch"&&N.preventDefault()}_contextmenu(N){this.setPointersPositions(N);var Y=this.getIntersection(this.getPointerPosition());Y&&Y.isListening()?Y._fireAndBubble(q,{evt:N}):this._fire(q,{evt:N,target:this,currentTarget:this})}_wheel(N){this.setPointersPositions(N);var Y=this.getIntersection(this.getPointerPosition());Y&&Y.isListening()?Y._fireAndBubble(_t,{evt:N}):this._fire(_t,{evt:N,target:this,currentTarget:this})}_pointercancel(N){this.setPointersPositions(N);const Y=h.getCapturedShape(N.pointerId)||this.getIntersection(this.getPointerPosition());Y&&Y._fireAndBubble(P,h.createEvent(N)),h.releaseCapture(N.pointerId)}_lostpointercapture(N){h.releaseCapture(N.pointerId)}setPointersPositions(N){var Y=this._getContentPosition(),X=null,et=null;N=N||window.event,N.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(N.touches,ht=>{this._pointerPositions.push({id:ht.identifier,x:(ht.clientX-Y.left)/Y.scaleX,y:(ht.clientY-Y.top)/Y.scaleY})}),Array.prototype.forEach.call(N.changedTouches||N.touches,ht=>{this._changedPointerPositions.push({id:ht.identifier,x:(ht.clientX-Y.left)/Y.scaleX,y:(ht.clientY-Y.top)/Y.scaleY})})):(X=(N.clientX-Y.left)/Y.scaleX,et=(N.clientY-Y.top)/Y.scaleY,this.pointerPos={x:X,y:et},this._pointerPositions=[{x:X,y:et,id:t.Util._getFirstPointerId(N)}],this._changedPointerPositions=[{x:X,y:et,id:t.Util._getFirstPointerId(N)}])}_setPointerPosition(N){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(N)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var N=this.content.getBoundingClientRect();return{top:N.top,left:N.left,scaleX:N.width/this.content.clientWidth||1,scaleY:N.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!r.Konva.isBrowser){var N=this.container();if(!N)throw"Stage has no container. A container is required.";N.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),N.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(N){N.batchDraw()}),this}}n.Stage=j,j.prototype.nodeType=l,(0,o._registerNode)(j),e.Factory.addGetterSetter(j,"container")})(qh);const A5=St(xt({__proto__:null,default:Pe(qh)},[qh]));var cs={},Kh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Shape=n.shapes=void 0;const t=Nt,e=re,i=Ft,r=le,s=Gt,a=Nt,o=vd;var h="hasShadow",l="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let u;function m(){return u||(u=e.Util.createCanvasElement().getContext("2d"),u)}n.shapes={};function v($){const U=this.attrs.fillRule;U?$.fill(U):$.fill()}function b($){$.stroke()}function S($){$.fill()}function E($){$.stroke()}function _(){this._clearCache(h)}function x(){this._clearCache(l)}function P(){this._clearCache(c)}function R(){this._clearCache(d)}function F(){this._clearCache(f)}class L extends r.Node{constructor(U){super(U);let z;for(;z=e.Util.getRandomColor(),!(z&&!(z in n.shapes)););this.colorKey=z,n.shapes[z]=this}getContext(){return e.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return e.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var U=m();const z=U.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(z&&z.setTransform){const q=new e.Transform;q.translate(this.fillPatternX(),this.fillPatternY()),q.rotate(t.Konva.getAngle(this.fillPatternRotation())),q.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),q.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const K=q.getMatrix(),Z=typeof DOMMatrix>"u"?{a:K[0],b:K[1],c:K[2],d:K[3],e:K[4],f:K[5]}:new DOMMatrix(K);z.setTransform(Z)}return z}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var U=this.fillLinearGradientColorStops();if(U){for(var z=m(),q=this.fillLinearGradientStartPoint(),K=this.fillLinearGradientEndPoint(),Z=z.createLinearGradient(q.x,q.y,K.x,K.y),at=0;at<U.length;at+=2)Z.addColorStop(U[at],U[at+1]);return Z}}_getRadialGradient(){return this._getCache(f,this.__getRadialGradient)}__getRadialGradient(){var U=this.fillRadialGradientColorStops();if(U){for(var z=m(),q=this.fillRadialGradientStartPoint(),K=this.fillRadialGradientEndPoint(),Z=z.createRadialGradient(q.x,q.y,this.fillRadialGradientStartRadius(),K.x,K.y,this.fillRadialGradientEndRadius()),at=0;at<U.length;at+=2)Z.addColorStop(U[at],U[at+1]);return Z}}getShadowRGBA(){return this._getCache(l,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var U=e.Util.colorToRGBA(this.shadowColor());if(U)return"rgba("+U.r+","+U.g+","+U.b+","+U.a*(this.shadowOpacity()||1)+")"}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const U=this.hitStrokeWidth();return U==="auto"?this.hasStroke():this.strokeEnabled()&&!!U}intersects(U){var z=this.getStage();if(!z)return!1;const q=z.bufferHitCanvas;return q.getContext().clear(),this.drawHit(q,void 0,!0),q.context.getImageData(Math.round(U.x),Math.round(U.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete n.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(U){var z;if(!this.getStage()||!((z=this.attrs.perfectDrawEnabled)!==null&&z!==void 0?z:!0))return!1;const K=U||this.hasFill(),Z=this.hasStroke(),at=this.getAbsoluteOpacity()!==1;if(K&&Z&&at)return!0;const vt=this.hasShadow(),_t=this.shadowForStrokeEnabled();return!!(K&&Z&&vt&&_t)}setStrokeHitEnabled(U){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),U?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var U=this.size();return{x:this._centroid?-U.width/2:0,y:this._centroid?-U.height/2:0,width:U.width,height:U.height}}getClientRect(U={}){const z=U.skipTransform,q=U.relativeTo,K=this.getSelfRect(),at=!U.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,vt=K.width+at,_t=K.height+at,pt=!U.skipShadow&&this.hasShadow(),nt=pt?this.shadowOffsetX():0,J=pt?this.shadowOffsetY():0,I=vt+Math.abs(nt),D=_t+Math.abs(J),A=pt&&this.shadowBlur()||0,B=I+A*2,j=D+A*2,W={width:B,height:j,x:-(at/2+A)+Math.min(nt,0)+K.x,y:-(at/2+A)+Math.min(J,0)+K.y};return z?W:this._transformedRect(W,q)}drawScene(U,z){var q=this.getLayer(),K=U||q.getCanvas(),Z=K.getContext(),at=this._getCanvasCache(),vt=this.getSceneFunc(),_t=this.hasShadow(),pt,nt,J,I=K.isCache,D=z===this;if(!this.isVisible()&&!D)return this;if(at){Z.save();var A=this.getAbsoluteTransform(z).getMatrix();return Z.transform(A[0],A[1],A[2],A[3],A[4],A[5]),this._drawCachedSceneCanvas(Z),Z.restore(),this}if(!vt)return this;if(Z.save(),this._useBufferCanvas()&&!I){pt=this.getStage(),nt=pt.bufferCanvas,J=nt.getContext(),J.clear(),J.save(),J._applyLineJoin(this);var B=this.getAbsoluteTransform(z).getMatrix();J.transform(B[0],B[1],B[2],B[3],B[4],B[5]),vt.call(this,J,this),J.restore();var j=nt.pixelRatio;_t&&Z._applyShadow(this),Z._applyOpacity(this),Z._applyGlobalCompositeOperation(this),Z.drawImage(nt._canvas,0,0,nt.width/j,nt.height/j)}else{if(Z._applyLineJoin(this),!D){var B=this.getAbsoluteTransform(z).getMatrix();Z.transform(B[0],B[1],B[2],B[3],B[4],B[5]),Z._applyOpacity(this),Z._applyGlobalCompositeOperation(this)}_t&&Z._applyShadow(this),vt.call(this,Z,this)}return Z.restore(),this}drawHit(U,z,q=!1){if(!this.shouldDrawHit(z,q))return this;var K=this.getLayer(),Z=U||K.hitCanvas,at=Z&&Z.getContext(),vt=this.hitFunc()||this.sceneFunc(),_t=this._getCanvasCache(),pt=_t&&_t.hit;if(this.colorKey||e.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),pt){at.save();var nt=this.getAbsoluteTransform(z).getMatrix();return at.transform(nt[0],nt[1],nt[2],nt[3],nt[4],nt[5]),this._drawCachedHitCanvas(at),at.restore(),this}if(!vt)return this;if(at.save(),at._applyLineJoin(this),!(this===z)){var I=this.getAbsoluteTransform(z).getMatrix();at.transform(I[0],I[1],I[2],I[3],I[4],I[5])}return vt.call(this,at,this),at.restore(),this}drawHitFromCache(U=0){var z=this._getCanvasCache(),q=this._getCachedSceneCanvas(),K=z.hit,Z=K.getContext(),at=K.getWidth(),vt=K.getHeight(),_t,pt,nt,J,I,D;Z.clear(),Z.drawImage(q._canvas,0,0,at,vt);try{for(_t=Z.getImageData(0,0,at,vt),pt=_t.data,nt=pt.length,J=e.Util._hexToRgb(this.colorKey),I=0;I<nt;I+=4)D=pt[I+3],D>U?(pt[I]=J.r,pt[I+1]=J.g,pt[I+2]=J.b,pt[I+3]=255):pt[I+3]=0;Z.putImageData(_t,0,0)}catch(A){e.Util.error("Unable to draw hit graph from cached scene canvas. "+A.message)}return this}hasPointerCapture(U){return o.hasPointerCapture(U,this)}setPointerCapture(U){o.setPointerCapture(U,this)}releaseCapture(U){o.releaseCapture(U,this)}}n.Shape=L,L.prototype._fillFunc=v,L.prototype._strokeFunc=b,L.prototype._fillFuncHit=S,L.prototype._strokeFuncHit=E,L.prototype._centroid=!1,L.prototype.nodeType="Shape",(0,a._registerNode)(L),L.prototype.eventListeners={},L.prototype.on.call(L.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",_),L.prototype.on.call(L.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",x),L.prototype.on.call(L.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",P),L.prototype.on.call(L.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",R),L.prototype.on.call(L.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",F),i.Factory.addGetterSetter(L,"stroke",void 0,(0,s.getStringOrGradientValidator)()),i.Factory.addGetterSetter(L,"strokeWidth",2,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillAfterStrokeEnabled",!1),i.Factory.addGetterSetter(L,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),i.Factory.addGetterSetter(L,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(L,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(L,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(L,"lineJoin"),i.Factory.addGetterSetter(L,"lineCap"),i.Factory.addGetterSetter(L,"sceneFunc"),i.Factory.addGetterSetter(L,"hitFunc"),i.Factory.addGetterSetter(L,"dash"),i.Factory.addGetterSetter(L,"dashOffset",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"shadowColor",void 0,(0,s.getStringValidator)()),i.Factory.addGetterSetter(L,"shadowBlur",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"shadowOpacity",1,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(L,"shadowOffset",["x","y"]),i.Factory.addGetterSetter(L,"shadowOffsetX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"shadowOffsetY",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillPatternImage"),i.Factory.addGetterSetter(L,"fill",void 0,(0,s.getStringOrGradientValidator)()),i.Factory.addGetterSetter(L,"fillPatternX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillPatternY",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillLinearGradientColorStops"),i.Factory.addGetterSetter(L,"strokeLinearGradientColorStops"),i.Factory.addGetterSetter(L,"fillRadialGradientStartRadius",0),i.Factory.addGetterSetter(L,"fillRadialGradientEndRadius",0),i.Factory.addGetterSetter(L,"fillRadialGradientColorStops"),i.Factory.addGetterSetter(L,"fillPatternRepeat","repeat"),i.Factory.addGetterSetter(L,"fillEnabled",!0),i.Factory.addGetterSetter(L,"strokeEnabled",!0),i.Factory.addGetterSetter(L,"shadowEnabled",!0),i.Factory.addGetterSetter(L,"dashEnabled",!0),i.Factory.addGetterSetter(L,"strokeScaleEnabled",!0),i.Factory.addGetterSetter(L,"fillPriority","color"),i.Factory.addComponentsGetterSetter(L,"fillPatternOffset",["x","y"]),i.Factory.addGetterSetter(L,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(L,"fillPatternScale",["x","y"]),i.Factory.addGetterSetter(L,"fillPatternScaleX",1,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillPatternScaleY",1,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(L,"fillLinearGradientStartPoint",["x","y"]),i.Factory.addComponentsGetterSetter(L,"strokeLinearGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(L,"fillLinearGradientStartPointX",0),i.Factory.addGetterSetter(L,"strokeLinearGradientStartPointX",0),i.Factory.addGetterSetter(L,"fillLinearGradientStartPointY",0),i.Factory.addGetterSetter(L,"strokeLinearGradientStartPointY",0),i.Factory.addComponentsGetterSetter(L,"fillLinearGradientEndPoint",["x","y"]),i.Factory.addComponentsGetterSetter(L,"strokeLinearGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(L,"fillLinearGradientEndPointX",0),i.Factory.addGetterSetter(L,"strokeLinearGradientEndPointX",0),i.Factory.addGetterSetter(L,"fillLinearGradientEndPointY",0),i.Factory.addGetterSetter(L,"strokeLinearGradientEndPointY",0),i.Factory.addComponentsGetterSetter(L,"fillRadialGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(L,"fillRadialGradientStartPointX",0),i.Factory.addGetterSetter(L,"fillRadialGradientStartPointY",0),i.Factory.addComponentsGetterSetter(L,"fillRadialGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(L,"fillRadialGradientEndPointX",0),i.Factory.addGetterSetter(L,"fillRadialGradientEndPointY",0),i.Factory.addGetterSetter(L,"fillPatternRotation",0),i.Factory.addGetterSetter(L,"fillRule",void 0,(0,s.getStringValidator)()),i.Factory.backCompat(L,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Kh);const me=St(xt({__proto__:null,default:Pe(Kh)},[Kh]));Object.defineProperty(cs,"__esModule",{value:!0});var _d=cs.Layer=void 0;const Ei=re,Zh=Ya,rr=le,Jh=Ft,yd=za,M5=Gt,R5=me,D5=Nt;var L5="#",I5="beforeDraw",O5="draw",wd=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],F5=wd.length;class sr extends Zh.Container{constructor(t){super(t),this.canvas=new yd.SceneCanvas,this.hitCanvas=new yd.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){rr.Node.prototype.moveToTop.call(this);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var t=rr.Node.prototype.moveUp.call(this);if(!t)return!1;var e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(rr.Node.prototype.moveDown.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(rr.Node.prototype.moveToBottom.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var t=this.getNativeCanvasElement();return rr.Node.prototype.remove.call(this),t&&t.parentNode&&Ei.Util._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&Ei.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return t=t||{},t.width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=t.x!==void 0?t.x:this.x(),t.y=t.y!==void 0?t.y:this.y(),rr.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Ei.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Ei.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Ei.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,i=!1;;){for(let r=0;r<F5;r++){const s=wd[r],a=this._getIntersection({x:t.x+s.x*e,y:t.y+s.y*e}),o=a.shape;if(o)return o;if(i=!!a.antialiased,!a.antialiased)break}if(i)e+=1;else return null}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=i[3];if(r===255){const s=Ei.Util._rgbToHex(i[0],i[1],i[2]),a=R5.shapes[L5+s];return a?{shape:a}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(t,e){var i=this.getLayer(),r=t||i&&i.getCanvas();return this._fire(I5,{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Zh.Container.prototype.drawScene.call(this,r,e),this._fire(O5,{node:this}),this}drawHit(t,e){var i=this.getLayer(),r=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),Zh.Container.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){Ei.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return Ei.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,e=!!this.hitCanvas._canvas.parentNode;e?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return Ei.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}_d=cs.Layer=sr,sr.prototype.nodeType="Layer",(0,D5._registerNode)(sr),Jh.Factory.addGetterSetter(sr,"imageSmoothingEnabled",!0),Jh.Factory.addGetterSetter(sr,"clearBeforeDraw",!0),Jh.Factory.addGetterSetter(sr,"hitGraphEnabled",!0,(0,M5.getBooleanValidator)());const bd=St(xt({__proto__:null,get Layer(){return _d},default:cs},[cs]));var us={};Object.defineProperty(us,"__esModule",{value:!0});var xd=us.FastLayer=void 0;const N5=re,G5=bd,U5=Nt;class Qh extends G5.Layer{constructor(t){super(t),this.listening(!1),N5.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}xd=us.FastLayer=Qh,Qh.prototype.nodeType="FastLayer",(0,U5._registerNode)(Qh);const B5=St(xt({__proto__:null,get FastLayer(){return xd},default:us},[us]));var fs={};Object.defineProperty(fs,"__esModule",{value:!0});var Sd=fs.Group=void 0;const z5=re,$5=Ya,V5=Nt;class tl extends $5.Container{_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&z5.Util.throw("You may only add groups and shapes to groups.")}}Sd=fs.Group=tl,tl.prototype.nodeType="Group",(0,V5._registerNode)(tl);const el=St(xt({__proto__:null,get Group(){return Sd},default:fs},[fs]));var ds={};Object.defineProperty(ds,"__esModule",{value:!0});var Cd=ds.Animation=void 0;const il=Nt,Td=re,nl=function(){return il.glob.performance&&il.glob.performance.now?function(){return il.glob.performance.now()}:function(){return new Date().getTime()}}();class ai{constructor(t,e){this.id=ai.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:nl(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,i=e.length;for(let r=0;r<i;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=ai.animations,i=e.length;for(let r=0;r<i;r++)if(e[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=nl(),ai._addAnimation(this),this}stop(){return ai._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,i=this.animations,r=i.length;for(let s=0;s<r;s++)if(i[s].id===e){this.animations.splice(s,1);break}}static _runFrames(){const t={},e=this.animations;for(let i=0;i<e.length;i++){const r=e[i],s=r.layers,a=r.func;r._updateFrameObject(nl());const o=s.length;let h;if(a?h=a.call(r,r.frame)!==!1:h=!0,!!h)for(let l=0;l<o;l++){const c=s[l];c._id!==void 0&&(t[c._id]=c)}}for(let i in t)t.hasOwnProperty(i)&&t[i].batchDraw()}static _animationLoop(){const t=ai;t.animations.length?(t._runFrames(),Td.Util.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Td.Util.requestAnimFrame(this._animationLoop))}}Cd=ds.Animation=ai,ai.animations=[],ai.animIdCounter=0,ai.animRunning=!1;const rl=St(xt({__proto__:null,get Animation(){return Cd},default:ds},[ds]));var sl={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Easings=n.Tween=void 0;const t=re,e=rl,i=le,r=Nt;var s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},a=1,o=2,h=3,l=0,c=["fill","stroke","shadowColor"];class d{constructor(m,v,b,S,E,_,x){this.prop=m,this.propFunc=v,this.begin=S,this._pos=S,this.duration=_,this._change=0,this.prevPos=0,this.yoyo=x,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=b,this._change=E-this.begin,this.pause()}fire(m){var v=this[m];v&&v()}setTime(m){m>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():m<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=m,this.update())}getTime(){return this._time}setPosition(m){this.prevPos=this._pos,this.propFunc(m),this._pos=m}getPosition(m){return m===void 0&&(m=this._time),this.func(m,this.begin,this._change,this.duration)}play(){this.state=o,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=h,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(m){this.pause(),this._time=m,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var m=this.getTimer()-this._startTime;this.state===o?this.setTime(m):this.state===h&&this.setTime(this.duration-m)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(m){var v=this,b=m.node,S=b._id,E,_=m.easing||n.Easings.Linear,x=!!m.yoyo,P;typeof m.duration>"u"?E=.3:m.duration===0?E=.001:E=m.duration,this.node=b,this._id=l++;var R=b.getLayer()||(b instanceof r.Konva.Stage?b.getLayers():null);R||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new e.Animation(function(){v.tween.onEnterFrame()},R),this.tween=new d(P,function(F){v._tweenFunc(F)},_,0,1,E*1e3,x),this._addListeners(),f.attrs[S]||(f.attrs[S]={}),f.attrs[S][this._id]||(f.attrs[S][this._id]={}),f.tweens[S]||(f.tweens[S]={});for(P in m)s[P]===void 0&&this._addAttr(P,m[P]);this.reset(),this.onFinish=m.onFinish,this.onReset=m.onReset,this.onUpdate=m.onUpdate}_addAttr(m,v){var b=this.node,S=b._id,E,_,x,P,R,F,L,$;if(x=f.tweens[S][m],x&&delete f.attrs[S][x][m],E=b.getAttr(m),t.Util._isArray(v))if(_=[],R=Math.max(v.length,E.length),m==="points"&&v.length!==E.length&&(v.length>E.length?(L=E,E=t.Util._prepareArrayForTween(E,v,b.closed())):(F=v,v=t.Util._prepareArrayForTween(v,E,b.closed()))),m.indexOf("fill")===0)for(P=0;P<R;P++)if(P%2===0)_.push(v[P]-E[P]);else{var U=t.Util.colorToRGBA(E[P]);$=t.Util.colorToRGBA(v[P]),E[P]=U,_.push({r:$.r-U.r,g:$.g-U.g,b:$.b-U.b,a:$.a-U.a})}else for(P=0;P<R;P++)_.push(v[P]-E[P]);else c.indexOf(m)!==-1?(E=t.Util.colorToRGBA(E),$=t.Util.colorToRGBA(v),_={r:$.r-E.r,g:$.g-E.g,b:$.b-E.b,a:$.a-E.a}):_=v-E;f.attrs[S][this._id][m]={start:E,diff:_,end:v,trueEnd:F,trueStart:L},f.tweens[S][m]=this._id}_tweenFunc(m){var v=this.node,b=f.attrs[v._id][this._id],S,E,_,x,P,R,F,L;for(S in b){if(E=b[S],_=E.start,x=E.diff,L=E.end,t.Util._isArray(_))if(P=[],F=Math.max(_.length,L.length),S.indexOf("fill")===0)for(R=0;R<F;R++)R%2===0?P.push((_[R]||0)+x[R]*m):P.push("rgba("+Math.round(_[R].r+x[R].r*m)+","+Math.round(_[R].g+x[R].g*m)+","+Math.round(_[R].b+x[R].b*m)+","+(_[R].a+x[R].a*m)+")");else for(R=0;R<F;R++)P.push((_[R]||0)+x[R]*m);else c.indexOf(S)!==-1?P="rgba("+Math.round(_.r+x.r*m)+","+Math.round(_.g+x.g*m)+","+Math.round(_.b+x.b*m)+","+(_.a+x.a*m)+")":P=_+x*m;v.setAttr(S,P)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var m=this.node,v=f.attrs[m._id][this._id];v.points&&v.points.trueEnd&&m.setAttr("points",v.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var m=this.node,v=f.attrs[m._id][this._id];v.points&&v.points.trueStart&&m.points(v.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(m){return this.tween.seek(m*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var m=this.node._id,v=this._id,b=f.tweens[m],S;this.pause();for(S in b)delete f.tweens[m][S];delete f.attrs[m][v]}}n.Tween=f,f.attrs={},f.tweens={},i.Node.prototype.to=function(u){var m=u.onFinish;u.node=this,u.onFinish=function(){this.destroy(),m&&m()};var v=new f(u);v.play()},n.Easings={BackEaseIn(u,m,v,b){var S=1.70158;return v*(u/=b)*u*((S+1)*u-S)+m},BackEaseOut(u,m,v,b){var S=1.70158;return v*((u=u/b-1)*u*((S+1)*u+S)+1)+m},BackEaseInOut(u,m,v,b){var S=1.70158;return(u/=b/2)<1?v/2*(u*u*(((S*=1.525)+1)*u-S))+m:v/2*((u-=2)*u*(((S*=1.525)+1)*u+S)+2)+m},ElasticEaseIn(u,m,v,b,S,E){var _=0;return u===0?m:(u/=b)===1?m+v:(E||(E=b*.3),!S||S<Math.abs(v)?(S=v,_=E/4):_=E/(2*Math.PI)*Math.asin(v/S),-(S*Math.pow(2,10*(u-=1))*Math.sin((u*b-_)*(2*Math.PI)/E))+m)},ElasticEaseOut(u,m,v,b,S,E){var _=0;return u===0?m:(u/=b)===1?m+v:(E||(E=b*.3),!S||S<Math.abs(v)?(S=v,_=E/4):_=E/(2*Math.PI)*Math.asin(v/S),S*Math.pow(2,-10*u)*Math.sin((u*b-_)*(2*Math.PI)/E)+v+m)},ElasticEaseInOut(u,m,v,b,S,E){var _=0;return u===0?m:(u/=b/2)===2?m+v:(E||(E=b*(.3*1.5)),!S||S<Math.abs(v)?(S=v,_=E/4):_=E/(2*Math.PI)*Math.asin(v/S),u<1?-.5*(S*Math.pow(2,10*(u-=1))*Math.sin((u*b-_)*(2*Math.PI)/E))+m:S*Math.pow(2,-10*(u-=1))*Math.sin((u*b-_)*(2*Math.PI)/E)*.5+v+m)},BounceEaseOut(u,m,v,b){return(u/=b)<1/2.75?v*(7.5625*u*u)+m:u<2/2.75?v*(7.5625*(u-=1.5/2.75)*u+.75)+m:u<2.5/2.75?v*(7.5625*(u-=2.25/2.75)*u+.9375)+m:v*(7.5625*(u-=2.625/2.75)*u+.984375)+m},BounceEaseIn(u,m,v,b){return v-n.Easings.BounceEaseOut(b-u,0,v,b)+m},BounceEaseInOut(u,m,v,b){return u<b/2?n.Easings.BounceEaseIn(u*2,0,v,b)*.5+m:n.Easings.BounceEaseOut(u*2-b,0,v,b)*.5+v*.5+m},EaseIn(u,m,v,b){return v*(u/=b)*u+m},EaseOut(u,m,v,b){return-v*(u/=b)*(u-2)+m},EaseInOut(u,m,v,b){return(u/=b/2)<1?v/2*u*u+m:-v/2*(--u*(u-2)-1)+m},StrongEaseIn(u,m,v,b){return v*(u/=b)*u*u*u*u+m},StrongEaseOut(u,m,v,b){return v*((u=u/b-1)*u*u*u*u+1)+m},StrongEaseInOut(u,m,v,b){return(u/=b/2)<1?v/2*u*u*u*u*u+m:v/2*((u-=2)*u*u*u*u+2)+m},Linear(u,m,v,b){return v*u/b+m}}})(sl);const H5=St(xt({__proto__:null,default:Pe(sl)},[sl]));(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Konva=void 0;const t=Nt,e=re,i=le,r=Ya,s=A5,a=bd,o=B5,h=el,l=Hh,c=me,d=rl,f=H5,u=Kf,m=za;n.Konva=e.Util._assign(t.Konva,{Util:e.Util,Transform:e.Transform,Node:i.Node,Container:r.Container,Stage:s.Stage,stages:s.stages,Layer:a.Layer,FastLayer:o.FastLayer,Group:h.Group,DD:l.DD,Shape:c.Shape,shapes:c.shapes,Animation:d.Animation,Tween:f.Tween,Easings:f.Easings,Context:u.Context,Canvas:m.Canvas}),n.default=n.Konva})(Uh);const j5=St(xt({__proto__:null,default:Pe(Uh)},[Uh]));var gs={};Object.defineProperty(gs,"__esModule",{value:!0});var kd=gs.Arc=void 0;const qa=Ft,X5=me,Ed=Nt,Wa=Gt,Y5=Nt;class Pi extends X5.Shape{_sceneFunc(t){var e=Ed.Konva.getAngle(this.angle()),i=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,i),t.arc(0,0,this.innerRadius(),e,0,!i),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),i=this.clockwise(),r=Ed.Konva.getAngle(i?360-this.angle():this.angle()),s=Math.cos(Math.min(r,Math.PI)),a=1,o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),h=Math.sin(Math.min(r,Math.PI/2)),l=s*(s>0?t:e),c=a*e,d=o*(o>0?t:e),f=h*(h>0?e:t);return{x:l,y:i?-1*f:d,width:c-l,height:f-d}}}kd=gs.Arc=Pi,Pi.prototype._centroid=!0,Pi.prototype.className="Arc",Pi.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,Y5._registerNode)(Pi),qa.Factory.addGetterSetter(Pi,"innerRadius",0,(0,Wa.getNumberValidator)()),qa.Factory.addGetterSetter(Pi,"outerRadius",0,(0,Wa.getNumberValidator)()),qa.Factory.addGetterSetter(Pi,"angle",0,(0,Wa.getNumberValidator)()),qa.Factory.addGetterSetter(Pi,"clockwise",!1,(0,Wa.getBooleanValidator)());const q5=St(xt({__proto__:null,get Arc(){return kd},default:gs},[gs]));var ps={},ms={};Object.defineProperty(ms,"__esModule",{value:!0});var Pd=ms.Line=void 0;const Ka=Ft,W5=me,Ad=Gt,K5=Nt;function al(n,t,e,i,r,s,a){var o=Math.sqrt(Math.pow(e-n,2)+Math.pow(i-t,2)),h=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-i,2)),l=a*o/(o+h),c=a*h/(o+h),d=e-l*(r-n),f=i-l*(s-t),u=e+c*(r-n),m=i+c*(s-t);return[d,f,u,m]}function Md(n,t){var e=n.length,i=[],r,s;for(r=2;r<e-2;r+=2)s=al(n[r-2],n[r-1],n[r],n[r+1],n[r+2],n[r+3],t),!isNaN(s[0])&&(i.push(s[0]),i.push(s[1]),i.push(n[r]),i.push(n[r+1]),i.push(s[2]),i.push(s[3]));return i}class Ji extends W5.Shape{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){var e=this.points(),i=e.length,r=this.tension(),s=this.closed(),a=this.bezier(),o,h,l;if(i){if(t.beginPath(),t.moveTo(e[0],e[1]),r!==0&&i>4){for(o=this.getTensionPoints(),h=o.length,l=s?0:4,s||t.quadraticCurveTo(o[0],o[1],o[2],o[3]);l<h-2;)t.bezierCurveTo(o[l++],o[l++],o[l++],o[l++],o[l++],o[l++]);s||t.quadraticCurveTo(o[h-2],o[h-1],e[i-2],e[i-1])}else if(a)for(l=2;l<i;)t.bezierCurveTo(e[l++],e[l++],e[l++],e[l++],e[l++],e[l++]);else for(l=2;l<i;l+=2)t.lineTo(e[l],e[l+1]);s?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Md(this.points(),this.tension())}_getTensionPointsClosed(){var t=this.points(),e=t.length,i=this.tension(),r=al(t[e-2],t[e-1],t[0],t[1],t[2],t[3],i),s=al(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],i),a=Md(t,i),o=[r[2],r[3]].concat(a).concat([s[0],s[1],t[e-2],t[e-1],s[2],s[3],r[0],r[1],t[0],t[1]]);return o}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};this.tension()!==0?t=[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:t=this.points();for(var e=t[0],i=t[0],r=t[1],s=t[1],a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],e=Math.min(e,a),i=Math.max(i,a),r=Math.min(r,o),s=Math.max(s,o);return{x:e,y:r,width:i-e,height:s-r}}}Pd=ms.Line=Ji,Ji.prototype.className="Line",Ji.prototype._attrsAffectingSize=["points","bezier","tension"],(0,K5._registerNode)(Ji),Ka.Factory.addGetterSetter(Ji,"closed",!1),Ka.Factory.addGetterSetter(Ji,"bezier",!1),Ka.Factory.addGetterSetter(Ji,"tension",0,(0,Ad.getNumberValidator)()),Ka.Factory.addGetterSetter(Ji,"points",[],(0,Ad.getNumberArrayValidator)());const Rd=St(xt({__proto__:null,get Line(){return Pd},default:ms},[ms]));var vs={},ol={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.t2length=n.getQuadraticArcLength=n.getCubicArcLength=n.binomialCoefficients=n.cValues=n.tValues=void 0,n.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],n.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],n.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const t=(a,o,h)=>{let l,c,d;l=h/2,c=0;for(let u=0;u<20;u++)d=l*n.tValues[20][u]+l,c+=n.cValues[20][u]*i(a,o,d);return l*c};n.getCubicArcLength=t;const e=(a,o,h)=>{h===void 0&&(h=1);const l=a[0]-2*a[1]+a[2],c=o[0]-2*o[1]+o[2],d=2*a[1]-2*a[0],f=2*o[1]-2*o[0],u=4*(l*l+c*c),m=4*(l*d+c*f),v=d*d+f*f;if(u===0)return h*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(o[2]-o[0],2));const b=m/(2*u),S=v/u,E=h+b,_=S-b*b,x=E*E+_>0?Math.sqrt(E*E+_):0,P=b*b+_>0?Math.sqrt(b*b+_):0,R=b+Math.sqrt(b*b+_)!==0?_*Math.log(Math.abs((E+x)/(b+P))):0;return Math.sqrt(u)/2*(E*x-b*P+R)};n.getQuadraticArcLength=e;function i(a,o,h){const l=r(1,h,a),c=r(1,h,o),d=l*l+c*c;return Math.sqrt(d)}const r=(a,o,h)=>{const l=h.length-1;let c,d;if(l===0)return 0;if(a===0){d=0;for(let f=0;f<=l;f++)d+=n.binomialCoefficients[l][f]*Math.pow(1-o,l-f)*Math.pow(o,f)*h[f];return d}else{c=new Array(l);for(let f=0;f<l;f++)c[f]=l*(h[f+1]-h[f]);return r(a-1,o,c)}},s=(a,o,h)=>{let l=1,c=a/o,d=(a-h(c))/o,f=0;for(;l>.001;){const u=h(c+d),m=Math.abs(a-u)/o;if(m<l)l=m,c+=d;else{const v=h(c-d),b=Math.abs(a-v)/o;b<l?(l=b,c-=d):d/=2}if(f++,f>500)break}return c};n.t2length=s})(ol);const Z5=St(xt({__proto__:null,default:Pe(ol)},[ol]));Object.defineProperty(vs,"__esModule",{value:!0});var Dd=vs.Path=void 0;const J5=Ft,Q5=me,t3=Nt,ar=Z5;class ue extends Q5.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ue.parsePathData(this.data()),this.pathLength=ue.getPathLength(this.dataArray)}_sceneFunc(t){var e=this.dataArray;t.beginPath();for(var i=!1,r=0;r<e.length;r++){var s=e[r].command,a=e[r].points;switch(s){case"L":t.lineTo(a[0],a[1]);break;case"M":t.moveTo(a[0],a[1]);break;case"C":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":t.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":var o=a[0],h=a[1],l=a[2],c=a[3],d=a[4],f=a[5],u=a[6],m=a[7],v=l>c?l:c,b=l>c?1:l/c,S=l>c?c/l:1;t.translate(o,h),t.rotate(u),t.scale(b,S),t.arc(0,0,v,d,d+f,1-m),t.scale(1/b,1/S),t.rotate(-u),t.translate(-o,-h);break;case"z":i=!0,t.closePath();break}}!i&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(l){if(l.command==="A"){var c=l.points[4],d=l.points[5],f=l.points[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),d<0)for(let m=c-u;m>f;m-=u){const v=ue.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(v.x,v.y)}else for(let m=c+u;m<f;m+=u){const v=ue.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(v.x,v.y)}}else if(l.command==="C")for(let m=0;m<=1;m+=.01){const v=ue.getPointOnCubicBezier(m,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(v.x,v.y)}else t=t.concat(l.points)});for(var e=t[0],i=t[0],r=t[1],s=t[1],a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],isNaN(a)||(e=Math.min(e,a),i=Math.max(i,a)),isNaN(o)||(r=Math.min(r,o),s=Math.max(s,o));return{x:e,y:r,width:i-e,height:s-r}}getLength(){return this.pathLength}getPointAtLength(t){return ue.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}static getPathLength(t){let e=0;for(var i=0;i<t.length;++i)e+=t[i].pathLength;return e}static getPointAtLengthOfDataArray(t,e){var i,r=0,s=e.length;if(!s)return null;for(;r<s&&t>e[r].pathLength;)t-=e[r].pathLength,++r;if(r===s)return i=e[r-1].points.slice(-2),{x:i[0],y:i[1]};if(t<.01)return i=e[r].points.slice(0,2),{x:i[0],y:i[1]};var a=e[r],o=a.points;switch(a.command){case"L":return ue.getPointOnLine(t,a.start.x,a.start.y,o[0],o[1]);case"C":return ue.getPointOnCubicBezier((0,ar.t2length)(t,ue.getPathLength(e),v=>(0,ar.getCubicArcLength)([a.start.x,o[0],o[2],o[4]],[a.start.y,o[1],o[3],o[5]],v)),a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return ue.getPointOnQuadraticBezier((0,ar.t2length)(t,ue.getPathLength(e),v=>(0,ar.getQuadraticArcLength)([a.start.x,o[0],o[2]],[a.start.y,o[1],o[3]],v)),a.start.x,a.start.y,o[0],o[1],o[2],o[3]);case"A":var h=o[0],l=o[1],c=o[2],d=o[3],f=o[4],u=o[5],m=o[6];return f+=u*t/a.pathLength,ue.getPointOnEllipticalArc(h,l,c,d,f,m)}return null}static getPointOnLine(t,e,i,r,s,a,o){a===void 0&&(a=e),o===void 0&&(o=i);var h=(s-i)/(r-e+1e-8),l=Math.sqrt(t*t/(1+h*h));r<e&&(l*=-1);var c=h*l,d;if(r===e)d={x:a,y:o+c};else if((o-i)/(a-e+1e-8)===h)d={x:a+l,y:o+c};else{var f,u,m=this.getLineLength(e,i,r,s),v=(a-e)*(r-e)+(o-i)*(s-i);v=v/(m*m),f=e+v*(r-e),u=i+v*(s-i);var b=this.getLineLength(a,o,f,u),S=Math.sqrt(t*t-b*b);l=Math.sqrt(S*S/(1+h*h)),r<e&&(l*=-1),c=h*l,d={x:f+l,y:u+c}}return d}static getPointOnCubicBezier(t,e,i,r,s,a,o,h,l){function c(b){return b*b*b}function d(b){return 3*b*b*(1-b)}function f(b){return 3*b*(1-b)*(1-b)}function u(b){return(1-b)*(1-b)*(1-b)}var m=h*c(t)+a*d(t)+r*f(t)+e*u(t),v=l*c(t)+o*d(t)+s*f(t)+i*u(t);return{x:m,y:v}}static getPointOnQuadraticBezier(t,e,i,r,s,a,o){function h(u){return u*u}function l(u){return 2*u*(1-u)}function c(u){return(1-u)*(1-u)}var d=a*h(t)+r*l(t)+e*c(t),f=o*h(t)+s*l(t)+i*c(t);return{x:d,y:f}}static getPointOnEllipticalArc(t,e,i,r,s,a){var o=Math.cos(a),h=Math.sin(a),l={x:i*Math.cos(s),y:r*Math.sin(s)};return{x:t+(l.x*o-l.y*h),y:e+(l.x*h+l.y*o)}}static parsePathData(t){if(!t)return[];var e=t,i=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var r=0;r<i.length;r++)e=e.replace(new RegExp(i[r],"g"),"|"+i[r]);var s=e.split("|"),a=[],o=[],h=0,l=0,c=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,d;for(r=1;r<s.length;r++){var f=s[r],u=f.charAt(0);for(f=f.slice(1),o.length=0;d=c.exec(f);)o.push(d[0]);for(var m=[],v=0,b=o.length;v<b;v++){if(o[v]==="00"){m.push(0,0);continue}var S=parseFloat(o[v]);isNaN(S)?m.push(0):m.push(S)}for(;m.length>0&&!isNaN(m[0]);){var E="",_=[],x=h,P=l,R,F,L,$,U,z,q,K,Z,at;switch(u){case"l":h+=m.shift(),l+=m.shift(),E="L",_.push(h,l);break;case"L":h=m.shift(),l=m.shift(),_.push(h,l);break;case"m":var vt=m.shift(),_t=m.shift();if(h+=vt,l+=_t,E="M",a.length>2&&a[a.length-1].command==="z"){for(var pt=a.length-2;pt>=0;pt--)if(a[pt].command==="M"){h=a[pt].points[0]+vt,l=a[pt].points[1]+_t;break}}_.push(h,l),u="l";break;case"M":h=m.shift(),l=m.shift(),E="M",_.push(h,l),u="L";break;case"h":h+=m.shift(),E="L",_.push(h,l);break;case"H":h=m.shift(),E="L",_.push(h,l);break;case"v":l+=m.shift(),E="L",_.push(h,l);break;case"V":l=m.shift(),E="L",_.push(h,l);break;case"C":_.push(m.shift(),m.shift(),m.shift(),m.shift()),h=m.shift(),l=m.shift(),_.push(h,l);break;case"c":_.push(h+m.shift(),l+m.shift(),h+m.shift(),l+m.shift()),h+=m.shift(),l+=m.shift(),E="C",_.push(h,l);break;case"S":F=h,L=l,R=a[a.length-1],R.command==="C"&&(F=h+(h-R.points[2]),L=l+(l-R.points[3])),_.push(F,L,m.shift(),m.shift()),h=m.shift(),l=m.shift(),E="C",_.push(h,l);break;case"s":F=h,L=l,R=a[a.length-1],R.command==="C"&&(F=h+(h-R.points[2]),L=l+(l-R.points[3])),_.push(F,L,h+m.shift(),l+m.shift()),h+=m.shift(),l+=m.shift(),E="C",_.push(h,l);break;case"Q":_.push(m.shift(),m.shift()),h=m.shift(),l=m.shift(),_.push(h,l);break;case"q":_.push(h+m.shift(),l+m.shift()),h+=m.shift(),l+=m.shift(),E="Q",_.push(h,l);break;case"T":F=h,L=l,R=a[a.length-1],R.command==="Q"&&(F=h+(h-R.points[0]),L=l+(l-R.points[1])),h=m.shift(),l=m.shift(),E="Q",_.push(F,L,h,l);break;case"t":F=h,L=l,R=a[a.length-1],R.command==="Q"&&(F=h+(h-R.points[0]),L=l+(l-R.points[1])),h+=m.shift(),l+=m.shift(),E="Q",_.push(F,L,h,l);break;case"A":$=m.shift(),U=m.shift(),z=m.shift(),q=m.shift(),K=m.shift(),Z=h,at=l,h=m.shift(),l=m.shift(),E="A",_=this.convertEndpointToCenterParameterization(Z,at,h,l,q,K,$,U,z);break;case"a":$=m.shift(),U=m.shift(),z=m.shift(),q=m.shift(),K=m.shift(),Z=h,at=l,h+=m.shift(),l+=m.shift(),E="A",_=this.convertEndpointToCenterParameterization(Z,at,h,l,q,K,$,U,z);break}a.push({command:E||u,points:_,start:{x,y:P},pathLength:this.calcLength(x,P,E||u,_)})}(u==="z"||u==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,e,i,r){var s,a,o,h,l=ue;switch(i){case"L":return l.getLineLength(t,e,r[0],r[1]);case"C":return(0,ar.getCubicArcLength)([t,r[0],r[2],r[4]],[e,r[1],r[3],r[5]],1);case"Q":return(0,ar.getQuadraticArcLength)([t,r[0],r[2]],[e,r[1],r[3]],1);case"A":s=0;var c=r[4],d=r[5],f=r[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),a=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),d<0)for(h=c-u;h>f;h-=u)o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),a=o;else for(h=c+u;h<f;h+=u)o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),a=o;return o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],f,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),s}return 0}static convertEndpointToCenterParameterization(t,e,i,r,s,a,o,h,l){var c=l*(Math.PI/180),d=Math.cos(c)*(t-i)/2+Math.sin(c)*(e-r)/2,f=-1*Math.sin(c)*(t-i)/2+Math.cos(c)*(e-r)/2,u=d*d/(o*o)+f*f/(h*h);u>1&&(o*=Math.sqrt(u),h*=Math.sqrt(u));var m=Math.sqrt((o*o*(h*h)-o*o*(f*f)-h*h*(d*d))/(o*o*(f*f)+h*h*(d*d)));s===a&&(m*=-1),isNaN(m)&&(m=0);var v=m*o*f/h,b=m*-h*d/o,S=(t+i)/2+Math.cos(c)*v-Math.sin(c)*b,E=(e+r)/2+Math.sin(c)*v+Math.cos(c)*b,_=function(U){return Math.sqrt(U[0]*U[0]+U[1]*U[1])},x=function(U,z){return(U[0]*z[0]+U[1]*z[1])/(_(U)*_(z))},P=function(U,z){return(U[0]*z[1]<U[1]*z[0]?-1:1)*Math.acos(x(U,z))},R=P([1,0],[(d-v)/o,(f-b)/h]),F=[(d-v)/o,(f-b)/h],L=[(-1*d-v)/o,(-1*f-b)/h],$=P(F,L);return x(F,L)<=-1&&($=Math.PI),x(F,L)>=1&&($=0),a===0&&$>0&&($=$-2*Math.PI),a===1&&$<0&&($=$+2*Math.PI),[S,E,o,h,R,$,c,a]}}Dd=vs.Path=ue,ue.prototype.className="Path",ue.prototype._attrsAffectingSize=["data"],(0,t3._registerNode)(ue),J5.Factory.addGetterSetter(ue,"data");const hl=St(xt({__proto__:null,get Path(){return Dd},default:vs},[vs]));Object.defineProperty(ps,"__esModule",{value:!0});var Ld=ps.Arrow=void 0;const Za=Ft,e3=Rd,Id=Gt,i3=Nt,Od=hl;class Pn extends e3.Line{_sceneFunc(t){super._sceneFunc(t);var e=Math.PI*2,i=this.points(),r=i,s=this.tension()!==0&&i.length>4;s&&(r=this.getTensionPoints());var a=this.pointerLength(),o=i.length,h,l;if(s){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],i[o-2],i[o-1]],u=Od.Path.calcLength(r[r.length-4],r[r.length-3],"C",f),m=Od.Path.getPointOnQuadraticBezier(Math.min(1,1-a/u),f[0],f[1],f[2],f[3],f[4],f[5]);h=i[o-2]-m.x,l=i[o-1]-m.y}else h=i[o-2]-i[o-4],l=i[o-1]-i[o-3];var c=(Math.atan2(l,h)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(i[o-2],i[o-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(i[0],i[1]),s?(h=(r[0]+r[2])/2-i[0],l=(r[1]+r[3])/2-i[1]):(h=i[2]-i[0],l=i[3]-i[1]),t.rotate((Math.atan2(-l,-h)+e)%e),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x-e,y:t.y-e,width:t.width+e*2,height:t.height+e*2}}}Ld=ps.Arrow=Pn,Pn.prototype.className="Arrow",(0,i3._registerNode)(Pn),Za.Factory.addGetterSetter(Pn,"pointerLength",10,(0,Id.getNumberValidator)()),Za.Factory.addGetterSetter(Pn,"pointerWidth",10,(0,Id.getNumberValidator)()),Za.Factory.addGetterSetter(Pn,"pointerAtBeginning",!1),Za.Factory.addGetterSetter(Pn,"pointerAtEnding",!0);const n3=St(xt({__proto__:null,get Arrow(){return Ld},default:ps},[ps]));var _s={};Object.defineProperty(_s,"__esModule",{value:!0});var Fd=_s.Circle=void 0;const r3=Ft,s3=me,a3=Gt,o3=Nt;class or extends s3.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}Fd=_s.Circle=or,or.prototype._centroid=!0,or.prototype.className="Circle",or.prototype._attrsAffectingSize=["radius"],(0,o3._registerNode)(or),r3.Factory.addGetterSetter(or,"radius",0,(0,a3.getNumberValidator)());const h3=St(xt({__proto__:null,get Circle(){return Fd},default:_s},[_s]));var ys={};Object.defineProperty(ys,"__esModule",{value:!0});var Nd=ys.Ellipse=void 0;const ll=Ft,l3=me,Gd=Gt,c3=Nt;class Qi extends l3.Shape{_sceneFunc(t){var e=this.radiusX(),i=this.radiusY();t.beginPath(),t.save(),e!==i&&t.scale(1,i/e),t.arc(0,0,e,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}Nd=ys.Ellipse=Qi,Qi.prototype.className="Ellipse",Qi.prototype._centroid=!0,Qi.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,c3._registerNode)(Qi),ll.Factory.addComponentsGetterSetter(Qi,"radius",["x","y"]),ll.Factory.addGetterSetter(Qi,"radiusX",0,(0,Gd.getNumberValidator)()),ll.Factory.addGetterSetter(Qi,"radiusY",0,(0,Gd.getNumberValidator)());const u3=St(xt({__proto__:null,get Ellipse(){return Nd},default:ys},[ys]));var ws={};Object.defineProperty(ws,"__esModule",{value:!0});var Ud=ws.Image=void 0;const cl=re,An=Ft,f3=me,d3=Nt,bs=Gt;let oi=class P1 extends f3.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const e=this.getWidth(),i=this.getHeight(),r=this.cornerRadius(),s=this.attrs.image;let a;if(s){const o=this.attrs.cropWidth,h=this.attrs.cropHeight;o&&h?a=[s,this.cropX(),this.cropY(),o,h,0,0,e,i]:a=[s,0,0,e,i]}(this.hasFill()||this.hasStroke()||r)&&(t.beginPath(),r?cl.Util.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)),s&&(r&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var e=this.width(),i=this.height(),r=this.cornerRadius();t.beginPath(),r?cl.Util.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e;return(t=this.attrs.width)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.width}getHeight(){var t,e;return(t=this.attrs.height)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.height}static fromURL(t,e,i=null){var r=cl.Util.createImageElement();r.onload=function(){var s=new P1({image:r});e(s)},r.onerror=i,r.crossOrigin="Anonymous",r.src=t}};Ud=ws.Image=oi,oi.prototype.className="Image",(0,d3._registerNode)(oi),An.Factory.addGetterSetter(oi,"cornerRadius",0,(0,bs.getNumberOrArrayOfNumbersValidator)(4)),An.Factory.addGetterSetter(oi,"image"),An.Factory.addComponentsGetterSetter(oi,"crop",["x","y","width","height"]),An.Factory.addGetterSetter(oi,"cropX",0,(0,bs.getNumberValidator)()),An.Factory.addGetterSetter(oi,"cropY",0,(0,bs.getNumberValidator)()),An.Factory.addGetterSetter(oi,"cropWidth",0,(0,bs.getNumberValidator)()),An.Factory.addGetterSetter(oi,"cropHeight",0,(0,bs.getNumberValidator)());const g3=St(xt({__proto__:null,get Image(){return Ud},default:ws},[ws]));var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});var Bd=Mn.Tag=Vd=Mn.Label=void 0;const Ja=Ft,p3=me,m3=el,ul=Gt,zd=Nt;var $d=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],v3="Change.konva",_3="none",fl="up",dl="right",gl="down",pl="left",y3=$d.length;class ml extends m3.Group{constructor(t){super(t),this.on("add.konva",function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var e=this,i,r=function(){e._sync()};for(i=0;i<y3;i++)t.on($d[i]+v3,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var t=this.getText(),e=this.getTag(),i,r,s,a,o,h,l;if(t&&e){switch(i=t.width(),r=t.height(),s=e.pointerDirection(),a=e.pointerWidth(),l=e.pointerHeight(),o=0,h=0,s){case fl:o=i/2,h=-1*l;break;case dl:o=i+a,h=r/2;break;case gl:o=i/2,h=r+l;break;case pl:o=-1*a,h=r/2;break}e.setAttrs({x:-1*o,y:-1*h,width:i,height:r}),t.setAttrs({x:-1*o,y:-1*h})}}}var Vd=Mn.Label=ml;ml.prototype.className="Label",(0,zd._registerNode)(ml);class Rn extends p3.Shape{_sceneFunc(t){var e=this.width(),i=this.height(),r=this.pointerDirection(),s=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius();let h=0,l=0,c=0,d=0;typeof o=="number"?h=l=c=d=Math.min(o,e/2,i/2):(h=Math.min(o[0]||0,e/2,i/2),l=Math.min(o[1]||0,e/2,i/2),d=Math.min(o[2]||0,e/2,i/2),c=Math.min(o[3]||0,e/2,i/2)),t.beginPath(),t.moveTo(h,0),r===fl&&(t.lineTo((e-s)/2,0),t.lineTo(e/2,-1*a),t.lineTo((e+s)/2,0)),t.lineTo(e-l,0),t.arc(e-l,l,l,Math.PI*3/2,0,!1),r===dl&&(t.lineTo(e,(i-a)/2),t.lineTo(e+s,i/2),t.lineTo(e,(i+a)/2)),t.lineTo(e,i-d),t.arc(e-d,i-d,d,0,Math.PI/2,!1),r===gl&&(t.lineTo((e+s)/2,i),t.lineTo(e/2,i+a),t.lineTo((e-s)/2,i)),t.lineTo(c,i),t.arc(c,i-c,c,Math.PI/2,Math.PI,!1),r===pl&&(t.lineTo(0,(i+a)/2),t.lineTo(-1*s,i/2),t.lineTo(0,(i-a)/2)),t.lineTo(0,h),t.arc(h,h,h,Math.PI,Math.PI*3/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){var t=0,e=0,i=this.pointerWidth(),r=this.pointerHeight(),s=this.pointerDirection(),a=this.width(),o=this.height();return s===fl?(e-=r,o+=r):s===gl?o+=r:s===pl?(t-=i*1.5,a+=i):s===dl&&(a+=i*1.5),{x:t,y:e,width:a,height:o}}}Bd=Mn.Tag=Rn,Rn.prototype.className="Tag",(0,zd._registerNode)(Rn),Ja.Factory.addGetterSetter(Rn,"pointerDirection",_3),Ja.Factory.addGetterSetter(Rn,"pointerWidth",0,(0,ul.getNumberValidator)()),Ja.Factory.addGetterSetter(Rn,"pointerHeight",0,(0,ul.getNumberValidator)()),Ja.Factory.addGetterSetter(Rn,"cornerRadius",0,(0,ul.getNumberOrArrayOfNumbersValidator)(4));const w3=St(xt({__proto__:null,get Label(){return Vd},get Tag(){return Bd},default:Mn},[Mn]));var xs={};Object.defineProperty(xs,"__esModule",{value:!0});var Hd=xs.Rect=void 0;const b3=Ft,x3=me,S3=Nt,C3=re,T3=Gt;class Qa extends x3.Shape{_sceneFunc(t){var e=this.cornerRadius(),i=this.width(),r=this.height();t.beginPath(),e?C3.Util.drawRoundedRectPath(t,i,r,e):t.rect(0,0,i,r),t.closePath(),t.fillStrokeShape(this)}}Hd=xs.Rect=Qa,Qa.prototype.className="Rect",(0,S3._registerNode)(Qa),b3.Factory.addGetterSetter(Qa,"cornerRadius",0,(0,T3.getNumberOrArrayOfNumbersValidator)(4));const jd=St(xt({__proto__:null,get Rect(){return Hd},default:xs},[xs]));var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});var Xd=Ss.RegularPolygon=void 0;const Yd=Ft,k3=me,qd=Gt,E3=Nt;class Dn extends k3.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(var i=1;i<e.length;i++)t.lineTo(e[i].x,e[i].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,i=[];for(var r=0;r<t;r++)i.push({x:e*Math.sin(r*2*Math.PI/t),y:-1*e*Math.cos(r*2*Math.PI/t)});return i}getSelfRect(){const t=this._getPoints();var e=t[0].x,i=t[0].y,r=t[0].x,s=t[0].y;return t.forEach(a=>{e=Math.min(e,a.x),i=Math.max(i,a.x),r=Math.min(r,a.y),s=Math.max(s,a.y)}),{x:e,y:r,width:i-e,height:s-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Xd=Ss.RegularPolygon=Dn,Dn.prototype.className="RegularPolygon",Dn.prototype._centroid=!0,Dn.prototype._attrsAffectingSize=["radius"],(0,E3._registerNode)(Dn),Yd.Factory.addGetterSetter(Dn,"radius",0,(0,qd.getNumberValidator)()),Yd.Factory.addGetterSetter(Dn,"sides",0,(0,qd.getNumberValidator)());const P3=St(xt({__proto__:null,get RegularPolygon(){return Xd},default:Ss},[Ss]));var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});var Wd=Cs.Ring=void 0;const Kd=Ft,A3=me,Zd=Gt,M3=Nt;var Jd=Math.PI*2;class Ln extends A3.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,Jd,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),Jd,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}Wd=Cs.Ring=Ln,Ln.prototype.className="Ring",Ln.prototype._centroid=!0,Ln.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,M3._registerNode)(Ln),Kd.Factory.addGetterSetter(Ln,"innerRadius",0,(0,Zd.getNumberValidator)()),Kd.Factory.addGetterSetter(Ln,"outerRadius",0,(0,Zd.getNumberValidator)());const R3=St(xt({__proto__:null,get Ring(){return Wd},default:Cs},[Cs]));var Ts={};Object.defineProperty(Ts,"__esModule",{value:!0});var Qd=Ts.Sprite=void 0;const In=Ft,D3=me,L3=rl,t0=Gt,I3=Nt;class hi extends D3.Shape{constructor(t){super(t),this._updated=!0,this.anim=new L3.Animation(()=>{var e=this._updated;return this._updated=!1,e}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var e=this.animation(),i=this.frameIndex(),r=i*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+0],h=s[r+1],l=s[r+2],c=s[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,l,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[e],u=i*2;t.drawImage(d,o,h,l,c,f[u+0],f[u+1],l,c)}else t.drawImage(d,o,h,l,c,0,0,l,c)}_hitFunc(t){var e=this.animation(),i=this.frameIndex(),r=i*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+2],h=s[r+3];if(t.beginPath(),a){var l=a[e],c=i*2;t.rect(l[c+0],l[c+1],o,h)}else t.rect(0,0,o,h);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),e=this.animation(),i=this.animations(),r=i[e],s=r.length/4;t<s-1?this.frameIndex(t+1):this.frameIndex(0)}}Qd=Ts.Sprite=hi,hi.prototype.className="Sprite",(0,I3._registerNode)(hi),In.Factory.addGetterSetter(hi,"animation"),In.Factory.addGetterSetter(hi,"animations"),In.Factory.addGetterSetter(hi,"frameOffsets"),In.Factory.addGetterSetter(hi,"image"),In.Factory.addGetterSetter(hi,"frameIndex",0,(0,t0.getNumberValidator)()),In.Factory.addGetterSetter(hi,"frameRate",17,(0,t0.getNumberValidator)()),In.Factory.backCompat(hi,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});const O3=St(xt({__proto__:null,get Sprite(){return Qd},default:Ts},[Ts]));var ks={};Object.defineProperty(ks,"__esModule",{value:!0});var e0=ks.Star=void 0;const vl=Ft,F3=me,_l=Gt,N3=Nt;class tn extends F3.Shape{_sceneFunc(t){var e=this.innerRadius(),i=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-i);for(var s=1;s<r*2;s++){var a=s%2===0?i:e,o=a*Math.sin(s*Math.PI/r),h=-1*a*Math.cos(s*Math.PI/r);t.lineTo(o,h)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}e0=ks.Star=tn,tn.prototype.className="Star",tn.prototype._centroid=!0,tn.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,N3._registerNode)(tn),vl.Factory.addGetterSetter(tn,"numPoints",5,(0,_l.getNumberValidator)()),vl.Factory.addGetterSetter(tn,"innerRadius",0,(0,_l.getNumberValidator)()),vl.Factory.addGetterSetter(tn,"outerRadius",0,(0,_l.getNumberValidator)());const G3=St(xt({__proto__:null,get Star(){return e0},default:ks},[ks]));var On={};Object.defineProperty(On,"__esModule",{value:!0});var i0=On.Text=r0=On.stringToArray=void 0;const yl=re,xe=Ft,U3=me,en=Gt,B3=Nt;function n0(n){return Array.from(n)}var r0=On.stringToArray=n0,hr="auto",z3="center",s0="inherit",Es="justify",$3="Change.konva",V3="2d",a0="-",o0="left",H3="text",j3="Text",X3="top",Y3="bottom",h0="middle",l0="normal",q3="px ",to=" ",W3="right",c0="rtl",K3="word",Z3="char",u0="none",wl="…",f0=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],J3=f0.length;function Q3(n){return n.split(",").map(t=>{t=t.trim();const e=t.indexOf(" ")>=0,i=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!i&&(t=`"${t}"`),t}).join(", ")}var eo;function bl(){return eo||(eo=yl.Util.createCanvasElement().getContext(V3),eo)}function ty(n){n.fillText(this._partialText,this._partialTextX,this._partialTextY)}function ey(n){n.setAttr("miterLimit",2),n.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function iy(n){return n=n||{},!n.fillLinearGradientColorStops&&!n.fillRadialGradientColorStops&&!n.fillPatternImage&&(n.fill=n.fill||"black"),n}class ae extends U3.Shape{constructor(t){super(iy(t)),this._partialTextX=0,this._partialTextY=0;for(var e=0;e<J3;e++)this.on(f0[e]+$3,this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,i=e.length;if(this.text()){var r=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,o=this.verticalAlign(),h=this.direction(),l=0,c=this.align(),d=this.getWidth(),f=this.letterSpacing(),u=this.fill(),m=this.textDecoration(),v=m.indexOf("underline")!==-1,b=m.indexOf("line-through")!==-1,S;h=h===s0?t.direction:h;var E=0,E=a/2,_=0,x=0;for(h===c0&&t.setAttr("direction",h),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",h0),t.setAttr("textAlign",o0),o===h0?l=(this.getHeight()-i*a-r*2)/2:o===Y3&&(l=this.getHeight()-i*a-r*2),t.translate(r,l+r),S=0;S<i;S++){var _=0,x=0,P=e[S],R=P.text,F=P.width,L=P.lastInParagraph,$,U,z;if(t.save(),c===W3?_+=d-F-r*2:c===z3&&(_+=(d-F-r*2)/2),v){t.save(),t.beginPath(),t.moveTo(_,E+x+Math.round(s/2)),$=R.split(" ").length-1,U=$===0,z=c===Es&&!L?d-r*2:F,t.lineTo(_+Math.round(z),E+x+Math.round(s/2)),t.lineWidth=s/15;const _t=this._getLinearGradient();t.strokeStyle=_t||u,t.stroke(),t.restore()}if(b){t.save(),t.beginPath(),t.moveTo(_,E+x),$=R.split(" ").length-1,U=$===0,z=c===Es&&L&&!U?d-r*2:F,t.lineTo(_+Math.round(z),E+x),t.lineWidth=s/15;const _t=this._getLinearGradient();t.strokeStyle=_t||u,t.stroke(),t.restore()}if(h!==c0&&(f!==0||c===Es)){$=R.split(" ").length-1;for(var q=n0(R),K=0;K<q.length;K++){var Z=q[K];Z===" "&&!L&&c===Es&&(_+=(d-r*2-F)/$),this._partialTextX=_,this._partialTextY=E+x,this._partialText=Z,t.fillStrokeShape(this),_+=this.measureSize(Z).width+f}}else f!==0&&t.setAttr("letterSpacing",`${f}px`),this._partialTextX=_,this._partialTextY=E+x,this._partialText=R,t.fillStrokeShape(this);t.restore(),i>1&&(E+=a)}}}_hitFunc(t){var e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=yl.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(H3,e),this}getWidth(){var t=this.attrs.width===hr||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===hr||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return yl.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e=bl(),i=this.fontSize(),r;return e.save(),e.font=this._getContextFont(),r=e.measureText(t),e.restore(),{width:r.width,height:i}}_getContextFont(){return this.fontStyle()+to+this.fontVariant()+to+(this.fontSize()+q3)+Q3(this.fontFamily())}_addTextLine(t){this.align()===Es&&(t=t.trim());var i=this._getTextWidth(t);return this.textArr.push({text:t,width:i,lastInParagraph:!1})}_getTextWidth(t){var e=this.letterSpacing(),i=t.length;return bl().measureText(t).width+(i?e*(i-1):0)}_setTextData(){var t=this.text().split(`
|
|
44
|
-
`),e=+this.fontSize(),i=0,r=this.lineHeight()*e,s=this.attrs.width,a=this.attrs.height,o=s!==hr&&s!==void 0,h=a!==hr&&a!==void 0,l=this.padding(),c=s-l*2,d=a-l*2,f=0,u=this.wrap(),m=u!==u0,v=u!==Z3&&m,b=this.ellipsis();this.textArr=[],bl().font=this._getContextFont();for(var S=b?this._getTextWidth(wl):0,E=0,_=t.length;E<_;++E){var x=t[E],P=this._getTextWidth(x);if(o&&P>c)for(;x.length>0;){for(var R=0,F=x.length,L="",$=0;R<F;){var U=R+F>>>1,z=x.slice(0,U+1),q=this._getTextWidth(z)+S;q<=c?(R=U+1,L=z,$=q):F=U}if(L){if(v){var K,Z=x[L.length],at=Z===to||Z===a0;at&&$<=c?K=L.length:K=Math.max(L.lastIndexOf(to),L.lastIndexOf(a0))+1,K>0&&(R=K,L=L.slice(0,R),$=this._getTextWidth(L))}L=L.trimRight(),this._addTextLine(L),i=Math.max(i,$),f+=r;var vt=this._shouldHandleEllipsis(f);if(vt){this._tryToAddEllipsisToLastLine();break}if(x=x.slice(R),x=x.trimLeft(),x.length>0&&(P=this._getTextWidth(x),P<=c)){this._addTextLine(x),f+=r,i=Math.max(i,P);break}}else break}else this._addTextLine(x),f+=r,i=Math.max(i,P),this._shouldHandleEllipsis(f)&&E<_-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),h&&f+r>d)break}this.textHeight=e,this.textWidth=i}_shouldHandleEllipsis(t){var e=+this.fontSize(),i=this.lineHeight()*e,r=this.attrs.height,s=r!==hr&&r!==void 0,a=this.padding(),o=r-a*2,h=this.wrap(),l=h!==u0;return!l||s&&t+i>o}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,e=t!==hr&&t!==void 0,i=this.padding(),r=t-i*2,s=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!s)){if(e){var o=this._getTextWidth(a.text+wl)<r;o||(a.text=a.text.slice(0,a.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+wl)}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,e=this.hasShadow();return t&&e?!0:super._useBufferCanvas()}}i0=On.Text=ae,ae.prototype._fillFunc=ty,ae.prototype._strokeFunc=ey,ae.prototype.className=j3,ae.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,B3._registerNode)(ae),xe.Factory.overWriteSetter(ae,"width",(0,en.getNumberOrAutoValidator)()),xe.Factory.overWriteSetter(ae,"height",(0,en.getNumberOrAutoValidator)()),xe.Factory.addGetterSetter(ae,"direction",s0),xe.Factory.addGetterSetter(ae,"fontFamily","Arial"),xe.Factory.addGetterSetter(ae,"fontSize",12,(0,en.getNumberValidator)()),xe.Factory.addGetterSetter(ae,"fontStyle",l0),xe.Factory.addGetterSetter(ae,"fontVariant",l0),xe.Factory.addGetterSetter(ae,"padding",0,(0,en.getNumberValidator)()),xe.Factory.addGetterSetter(ae,"align",o0),xe.Factory.addGetterSetter(ae,"verticalAlign",X3),xe.Factory.addGetterSetter(ae,"lineHeight",1,(0,en.getNumberValidator)()),xe.Factory.addGetterSetter(ae,"wrap",K3),xe.Factory.addGetterSetter(ae,"ellipsis",!1,(0,en.getBooleanValidator)()),xe.Factory.addGetterSetter(ae,"letterSpacing",0,(0,en.getNumberValidator)()),xe.Factory.addGetterSetter(ae,"text","",(0,en.getStringValidator)()),xe.Factory.addGetterSetter(ae,"textDecoration","");const d0=St(xt({__proto__:null,get Text(){return i0},default:On,get stringToArray(){return r0}},[On]));var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});var g0=Ps.TextPath=void 0;const xl=re,Ze=Ft,ny=me,As=hl,Sl=d0,p0=Gt,ry=Nt;var sy="",m0="normal";function v0(n){n.fillText(this.partialText,0,0)}function _0(n){n.strokeText(this.partialText,0,0)}class fe extends ny.Shape{constructor(t){super(t),this.dummyCanvas=xl.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return As.Path.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;const e=this.pathLength;return t-1>e?null:As.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=As.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),i=this.fill(),r=this.fontSize(),s=this.glyphInfo;e==="underline"&&t.beginPath();for(var a=0;a<s.length;a++){t.save();var o=s[a].p0;t.translate(o.x,o.y),t.rotate(s[a].rotation),this.partialText=s[a].text,t.fillStrokeShape(this),e==="underline"&&(a===0&&t.moveTo(0,r/2+1),t.lineTo(r,r/2+1)),t.restore()}e==="underline"&&(t.strokeStyle=i,t.lineWidth=r/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var i=e[0].p0;t.moveTo(i.x,i.y)}for(var r=0;r<e.length;r++){var s=e[r].p1;t.lineTo(s.x,s.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return xl.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return Sl.Text.prototype.setText.call(this,t)}_getContextFont(){return Sl.Text.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas,i=e.getContext("2d");i.save(),i.font=this._getContextFont();var r=i.measureText(t);return i.restore(),{width:r.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),r=this.align(),s=this.kerningFunc(),a=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let o=0;r==="center"&&(o=Math.max(0,this.pathLength/2-a/2)),r==="right"&&(o=Math.max(0,this.pathLength-a));const h=(0,Sl.stringToArray)(this.text());let l=o;for(var c=0;c<h.length;c++){const d=this._getPointAtLength(l);if(!d)return;let f=this._getTextSize(h[c]).width+i;if(h[c]===" "&&r==="justify"){const E=this.text().split(" ").length-1;f+=(this.pathLength-a)/E}const u=this._getPointAtLength(l+f);if(!u)return;const m=As.Path.getLineLength(d.x,d.y,u.x,u.y);let v=0;if(s)try{v=s(h[c-1],h[c])*this.fontSize()}catch{v=0}d.x+=v,u.x+=v,this.textWidth+=v;const b=As.Path.getPointOnLine(v+m/2,d.x,d.y,u.x,u.y),S=Math.atan2(u.y-d.y,u.x-d.x);this.glyphInfo.push({transposeX:b.x,transposeY:b.y,text:h[c],rotation:S,p0:d,p1:u}),l+=f}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach(function(c){t.push(c.p0.x),t.push(c.p0.y),t.push(c.p1.x),t.push(c.p1.y)});for(var e=t[0]||0,i=t[0]||0,r=t[1]||0,s=t[1]||0,a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],e=Math.min(e,a),i=Math.max(i,a),r=Math.min(r,o),s=Math.max(s,o);var l=this.fontSize();return{x:e-l/2,y:r-l/2,width:i-e+l,height:s-r+l}}destroy(){return xl.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}g0=Ps.TextPath=fe,fe.prototype._fillFunc=v0,fe.prototype._strokeFunc=_0,fe.prototype._fillFuncHit=v0,fe.prototype._strokeFuncHit=_0,fe.prototype.className="TextPath",fe.prototype._attrsAffectingSize=["text","fontSize","data"],(0,ry._registerNode)(fe),Ze.Factory.addGetterSetter(fe,"data"),Ze.Factory.addGetterSetter(fe,"fontFamily","Arial"),Ze.Factory.addGetterSetter(fe,"fontSize",12,(0,p0.getNumberValidator)()),Ze.Factory.addGetterSetter(fe,"fontStyle",m0),Ze.Factory.addGetterSetter(fe,"align","left"),Ze.Factory.addGetterSetter(fe,"letterSpacing",0,(0,p0.getNumberValidator)()),Ze.Factory.addGetterSetter(fe,"textBaseline","middle"),Ze.Factory.addGetterSetter(fe,"fontVariant",m0),Ze.Factory.addGetterSetter(fe,"text",sy),Ze.Factory.addGetterSetter(fe,"textDecoration",null),Ze.Factory.addGetterSetter(fe,"kerningFunc",null);const ay=St(xt({__proto__:null,get TextPath(){return g0},default:Ps},[Ps]));var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0});var y0=Ms.Transformer=void 0;const Kt=re,Yt=Ft,w0=le,oy=me,hy=jd,b0=el,Je=Nt,nn=Gt,ly=Nt;var x0="tr-konva",cy=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(n=>n+`.${x0}`).join(" "),S0="nodesRect",uy=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],fy={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const dy="ontouchstart"in Je.Konva._global;function gy(n,t,e){if(n==="rotater")return e;t+=Kt.Util.degToRad(fy[n]||0);var i=(Kt.Util.radToDeg(t)%360+360)%360;return Kt.Util._inRange(i,315+22.5,360)||Kt.Util._inRange(i,0,22.5)?"ns-resize":Kt.Util._inRange(i,45-22.5,45+22.5)?"nesw-resize":Kt.Util._inRange(i,90-22.5,90+22.5)?"ew-resize":Kt.Util._inRange(i,135-22.5,135+22.5)?"nwse-resize":Kt.Util._inRange(i,180-22.5,180+22.5)?"ns-resize":Kt.Util._inRange(i,225-22.5,225+22.5)?"nesw-resize":Kt.Util._inRange(i,270-22.5,270+22.5)?"ew-resize":Kt.Util._inRange(i,315-22.5,315+22.5)?"nwse-resize":(Kt.Util.error("Transformer has unknown angle for cursor detection: "+i),"pointer")}var io=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],C0=1e8;function py(n){return{x:n.x+n.width/2*Math.cos(n.rotation)+n.height/2*Math.sin(-n.rotation),y:n.y+n.height/2*Math.cos(n.rotation)+n.width/2*Math.sin(n.rotation)}}function T0(n,t,e){const i=e.x+(n.x-e.x)*Math.cos(t)-(n.y-e.y)*Math.sin(t),r=e.y+(n.x-e.x)*Math.sin(t)+(n.y-e.y)*Math.cos(t);return{...n,rotation:n.rotation+t,x:i,y:r}}function my(n,t){const e=py(n);return T0(n,t,e)}function vy(n,t,e){let i=t;for(let r=0;r<n.length;r++){const s=Je.Konva.getAngle(n[r]),a=Math.abs(s-t)%(Math.PI*2);Math.min(a,Math.PI*2-a)<e&&(i=s)}return i}class Ht extends b0.Group{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(cy,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return Kt.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return x0+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter(r=>r.isAncestorOf(this)?(Kt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=e,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(r=>{const s=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(o=>o+"Change."+this._getEventNamespace()).join(" ");r.on(a,s),r.on(uy.map(o=>o+`.${this._getEventNamespace()}`).join(" "),s),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,s),this._proxyDrag(r)}),this._resetTransformCache();var i=!!this.findOne(".top-left");return i&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,i=>{e=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(i,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,i=>{if(!e)return;const r=t.getAbsolutePosition(),s=r.x-e.x,a=r.y-e.y;this.nodes().forEach(o=>{if(o===t||o.isDragging())return;const h=o.getAbsolutePosition();o.setAbsolutePosition({x:h.x+s,y:h.y+a}),o.startDrag(i)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(S0),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(S0,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),i){var r=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=t.getAbsoluteScale(i),a=t.getAbsolutePosition(i),o=r.x*s.x-t.offsetX()*s.x,h=r.y*s.y-t.offsetY()*s.y;const l=(Je.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+o*Math.cos(l)+h*Math.sin(-l),y:a.y+h*Math.cos(l)+o*Math.sin(l),width:r.width*s.x,height:r.height*s.y,rotation:l};return T0(c,-Je.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-C0,y:-C0,width:0,height:0,rotation:0};const e=[];this.nodes().map(l=>{const c=l.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=l.getAbsoluteTransform();d.forEach(function(u){var m=f.point(u);e.push(m)})});const i=new Kt.Transform;i.rotate(-Je.Konva.getAngle(this.rotation()));var r=1/0,s=1/0,a=-1/0,o=-1/0;e.forEach(function(l){var c=i.point(l);r===void 0&&(r=a=c.x,s=o=c.y),r=Math.min(r,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)}),i.invert();const h=i.point({x:r,y:s});return{x:h.x,y:h.y,width:a-r,height:o-s,rotation:Je.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),io.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){var e=new hy.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:dy?10:"auto"}),i=this;e.on("mousedown touchstart",function(r){i._handleMouseDown(r)}),e.on("dragstart",r=>{e.stopDrag(),r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),e.on("mouseenter",()=>{var r=Je.Konva.getAngle(this.rotation()),s=this.rotateAnchorCursor(),a=gy(t,r,s);e.getStage().content&&(e.getStage().content.style.cursor=a),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){var t=new oy.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,i){var r=i.getParent(),s=r.padding();e.beginPath(),e.rect(-s,-s,i.width()+s*2,i.height()+s*2),e.moveTo(i.width()/2,-s),r.rotateEnabled()&&e.lineTo(i.width()/2,-r.rotateAnchorOffset()*Kt.Util._sign(i.height())-s),e.fillStrokeShape(i)},hitFunc:(e,i)=>{if(this.shouldOverdrawWholeArea()){var r=this.padding();e.beginPath(),e.rect(-r,-r,i.width()+r*2,i.height()+r*2),e.fillStrokeShape(i)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",e=>{e.cancelBubble=!0}),t.on("dragmove",e=>{e.cancelBubble=!0}),t.on("dragend",e=>{e.cancelBubble=!0}),this.on("dragmove",e=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var e=this._getNodeRect(),i=e.width,r=e.height,s=Math.sqrt(Math.pow(i,2)+Math.pow(r,2));this.sin=Math.abs(r/s),this.cos=Math.abs(i/s),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),o=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:o.x-a.x,y:o.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(h=>{h._fire("transformstart",{evt:t.evt,target:h})})}_handleMouseMove(t){var e,i,r,s=this.findOne("."+this._movingAnchorName),a=s.getStage();a.setPointersPositions(t);const o=a.getPointerPosition();let h={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const l=s.getAbsolutePosition();this.anchorDragBoundFunc()&&(h=this.anchorDragBoundFunc()(l,h,t)),s.setAbsolutePosition(h);const c=s.getAbsolutePosition();if(!(l.x===c.x&&l.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();e=s.x()-d.width/2,i=-s.y()+d.height/2;let K=Math.atan2(-i,e)+Math.PI/2;d.height<0&&(K-=Math.PI);var f=Je.Konva.getAngle(this.rotation());const Z=f+K,at=Je.Konva.getAngle(this.rotationSnapTolerance()),_t=vy(this.rotationSnaps(),Z,at)-d.rotation,pt=my(d,_t);this._fitNodesInto(pt,t);return}var u=this.shiftBehavior(),m;u==="inverted"?m=this.keepRatio()&&!t.shiftKey:u==="none"?m=this.keepRatio():m=this.keepRatio()||t.shiftKey;var _=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(m){var v=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(v.x-s.x(),2)+Math.pow(v.y-s.y(),2));var b=this.findOne(".top-left").x()>v.x?-1:1,S=this.findOne(".top-left").y()>v.y?-1:1;e=r*this.cos*b,i=r*this.sin*S,this.findOne(".top-left").x(v.x-e),this.findOne(".top-left").y(v.y-i)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(m){var v=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(s.x()-v.x,2)+Math.pow(v.y-s.y(),2));var b=this.findOne(".top-right").x()<v.x?-1:1,S=this.findOne(".top-right").y()>v.y?-1:1;e=r*this.cos*b,i=r*this.sin*S,this.findOne(".top-right").x(v.x+e),this.findOne(".top-right").y(v.y-i)}var E=s.position();this.findOne(".top-left").y(E.y),this.findOne(".bottom-right").x(E.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(s.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(s.x());else if(this._movingAnchorName==="bottom-left"){if(m){var v=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(v.x-s.x(),2)+Math.pow(s.y()-v.y,2));var b=v.x<s.x()?-1:1,S=s.y()<v.y?-1:1;e=r*this.cos*b,i=r*this.sin*S,s.x(v.x-e),s.y(v.y+i)}E=s.position(),this.findOne(".top-left").x(E.x),this.findOne(".bottom-right").y(E.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(s.y());else if(this._movingAnchorName==="bottom-right"){if(m){var v=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(s.x()-v.x,2)+Math.pow(s.y()-v.y,2));var b=this.findOne(".bottom-right").x()<v.x?-1:1,S=this.findOne(".bottom-right").y()<v.y?-1:1;e=r*this.cos*b,i=r*this.sin*S,this.findOne(".bottom-right").x(v.x+e),this.findOne(".bottom-right").y(v.y+i)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var _=this.centeredScaling()||t.altKey;if(_){var x=this.findOne(".top-left"),P=this.findOne(".bottom-right"),R=x.x(),F=x.y(),L=this.getWidth()-P.x(),$=this.getHeight()-P.y();P.move({x:-R,y:-F}),x.move({x:L,y:$})}var U=this.findOne(".top-left").getAbsolutePosition();e=U.x,i=U.y;var z=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),q=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:i,width:z,height:q,rotation:Je.Konva.getAngle(this.rotation())},t)}}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var e=this.getNode();this._fire("transformend",{evt:t,target:e}),e&&this._nodes.forEach(i=>{i._fire("transformend",{evt:t,target:i})}),this._movingAnchorName=null}}_fitNodesInto(t,e){var i=this._getNodeRect();const r=1;if(Kt.Util._inRange(t.width,-this.padding()*2-r,r)){this.update();return}if(Kt.Util._inRange(t.height,-this.padding()*2-r,r)){this.update();return}const s=this.flipEnabled();var a=new Kt.Transform;if(a.rotate(Je.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!s){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!s){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!s){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!s){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(i,t);d?t=d:Kt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,h=new Kt.Transform;h.translate(i.x,i.y),h.rotate(i.rotation),h.scale(i.width/o,i.height/o);const l=new Kt.Transform;l.translate(t.x,t.y),l.rotate(t.rotation),l.scale(t.width/o,t.height/o);const c=l.multiply(h.invert());this._nodes.forEach(d=>{var f;const u=d.getParent().getAbsoluteTransform(),m=d.getTransform().copy();m.translate(d.offsetX(),d.offsetY());const v=new Kt.Transform;v.multiply(u.copy().invert()).multiply(c).multiply(u).multiply(m);const b=v.decompose();d.setAttrs(b),this._fire("transform",{evt:e,target:d}),d._fire("transform",{evt:e,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Kt.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t,e=this._getNodeRect();this.rotation(Kt.Util._getRotation(e.rotation));var i=e.width,r=e.height,s=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),h=this.anchorSize();const l=this.find("._anchor");l.forEach(d=>{d.setAttrs({width:h,height:h,offsetX:h/2,offsetY:h/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:h/2+o,offsetY:h/2+o,visible:a&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:h/2+o,visible:a&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:h/2-o,offsetY:h/2+o,visible:a&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:h/2+o,visible:a&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:r/2,offsetX:h/2-o,visible:a&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:h/2+o,offsetY:h/2-o,visible:a&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:r,offsetY:h/2-o,visible:a&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:r,offsetX:h/2-o,offsetY:h/2-o,visible:a&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:i/2,y:-this.rotateAnchorOffset()*Kt.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&l.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),b0.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return w0.Node.prototype.toObject.call(this)}clone(t){var e=w0.Node.prototype.clone.call(this,t);return e}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}y0=Ms.Transformer=Ht;function _y(n){return n instanceof Array||Kt.Util.warn("enabledAnchors value should be an array"),n instanceof Array&&n.forEach(function(t){io.indexOf(t)===-1&&Kt.Util.warn("Unknown anchor name: "+t+". Available names are: "+io.join(", "))}),n||[]}Ht.prototype.className="Transformer",(0,ly._registerNode)(Ht),Yt.Factory.addGetterSetter(Ht,"enabledAnchors",io,_y),Yt.Factory.addGetterSetter(Ht,"flipEnabled",!0,(0,nn.getBooleanValidator)()),Yt.Factory.addGetterSetter(Ht,"resizeEnabled",!0),Yt.Factory.addGetterSetter(Ht,"anchorSize",10,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"rotateEnabled",!0),Yt.Factory.addGetterSetter(Ht,"rotationSnaps",[]),Yt.Factory.addGetterSetter(Ht,"rotateAnchorOffset",50,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"rotateAnchorCursor","crosshair"),Yt.Factory.addGetterSetter(Ht,"rotationSnapTolerance",5,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"borderEnabled",!0),Yt.Factory.addGetterSetter(Ht,"anchorStroke","rgb(0, 161, 255)"),Yt.Factory.addGetterSetter(Ht,"anchorStrokeWidth",1,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"anchorFill","white"),Yt.Factory.addGetterSetter(Ht,"anchorCornerRadius",0,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"borderStroke","rgb(0, 161, 255)"),Yt.Factory.addGetterSetter(Ht,"borderStrokeWidth",1,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"borderDash"),Yt.Factory.addGetterSetter(Ht,"keepRatio",!0),Yt.Factory.addGetterSetter(Ht,"shiftBehavior","default"),Yt.Factory.addGetterSetter(Ht,"centeredScaling",!1),Yt.Factory.addGetterSetter(Ht,"ignoreStroke",!1),Yt.Factory.addGetterSetter(Ht,"padding",0,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"node"),Yt.Factory.addGetterSetter(Ht,"nodes"),Yt.Factory.addGetterSetter(Ht,"boundBoxFunc"),Yt.Factory.addGetterSetter(Ht,"anchorDragBoundFunc"),Yt.Factory.addGetterSetter(Ht,"anchorStyleFunc"),Yt.Factory.addGetterSetter(Ht,"shouldOverdrawWholeArea",!1),Yt.Factory.addGetterSetter(Ht,"useSingleNodeRotation",!0),Yt.Factory.backCompat(Ht,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});const yy=St(xt({__proto__:null,get Transformer(){return y0},default:Ms},[Ms]));var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});var k0=Rs.Wedge=void 0;const no=Ft,wy=me,by=Nt,E0=Gt,xy=Nt;class Ai extends wy.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,by.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}k0=Rs.Wedge=Ai,Ai.prototype.className="Wedge",Ai.prototype._centroid=!0,Ai.prototype._attrsAffectingSize=["radius"],(0,xy._registerNode)(Ai),no.Factory.addGetterSetter(Ai,"radius",0,(0,E0.getNumberValidator)()),no.Factory.addGetterSetter(Ai,"angle",0,(0,E0.getNumberValidator)()),no.Factory.addGetterSetter(Ai,"clockwise",!1),no.Factory.backCompat(Ai,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});const Sy=St(xt({__proto__:null,get Wedge(){return k0},default:Rs},[Rs]));var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});var P0=Ds.Blur=void 0;const A0=Ft,Cy=le,Ty=Gt;function M0(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var ky=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Ey=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Py(n,t){var e=n.data,i=n.width,r=n.height,s,a,o,h,l,c,d,f,u,m,v,b,S,E,_,x,P,R,F,L,$,U,z,q,K=t+t+1,Z=i-1,at=r-1,vt=t+1,_t=vt*(vt+1)/2,pt=new M0,nt=null,J=pt,I=null,D=null,A=ky[t],B=Ey[t];for(o=1;o<K;o++)J=J.next=new M0,o===vt&&(nt=J);for(J.next=pt,d=c=0,a=0;a<r;a++){for(x=P=R=F=f=u=m=v=0,b=vt*(L=e[c]),S=vt*($=e[c+1]),E=vt*(U=e[c+2]),_=vt*(z=e[c+3]),f+=_t*L,u+=_t*$,m+=_t*U,v+=_t*z,J=pt,o=0;o<vt;o++)J.r=L,J.g=$,J.b=U,J.a=z,J=J.next;for(o=1;o<vt;o++)h=c+((Z<o?Z:o)<<2),f+=(J.r=L=e[h])*(q=vt-o),u+=(J.g=$=e[h+1])*q,m+=(J.b=U=e[h+2])*q,v+=(J.a=z=e[h+3])*q,x+=L,P+=$,R+=U,F+=z,J=J.next;for(I=pt,D=nt,s=0;s<i;s++)e[c+3]=z=v*A>>B,z!==0?(z=255/z,e[c]=(f*A>>B)*z,e[c+1]=(u*A>>B)*z,e[c+2]=(m*A>>B)*z):e[c]=e[c+1]=e[c+2]=0,f-=b,u-=S,m-=E,v-=_,b-=I.r,S-=I.g,E-=I.b,_-=I.a,h=d+((h=s+t+1)<Z?h:Z)<<2,x+=I.r=e[h],P+=I.g=e[h+1],R+=I.b=e[h+2],F+=I.a=e[h+3],f+=x,u+=P,m+=R,v+=F,I=I.next,b+=L=D.r,S+=$=D.g,E+=U=D.b,_+=z=D.a,x-=L,P-=$,R-=U,F-=z,D=D.next,c+=4;d+=i}for(s=0;s<i;s++){for(P=R=F=x=u=m=v=f=0,c=s<<2,b=vt*(L=e[c]),S=vt*($=e[c+1]),E=vt*(U=e[c+2]),_=vt*(z=e[c+3]),f+=_t*L,u+=_t*$,m+=_t*U,v+=_t*z,J=pt,o=0;o<vt;o++)J.r=L,J.g=$,J.b=U,J.a=z,J=J.next;for(l=i,o=1;o<=t;o++)c=l+s<<2,f+=(J.r=L=e[c])*(q=vt-o),u+=(J.g=$=e[c+1])*q,m+=(J.b=U=e[c+2])*q,v+=(J.a=z=e[c+3])*q,x+=L,P+=$,R+=U,F+=z,J=J.next,o<at&&(l+=i);for(c=s,I=pt,D=nt,a=0;a<r;a++)h=c<<2,e[h+3]=z=v*A>>B,z>0?(z=255/z,e[h]=(f*A>>B)*z,e[h+1]=(u*A>>B)*z,e[h+2]=(m*A>>B)*z):e[h]=e[h+1]=e[h+2]=0,f-=b,u-=S,m-=E,v-=_,b-=I.r,S-=I.g,E-=I.b,_-=I.a,h=s+((h=a+vt)<at?h:at)*i<<2,f+=x+=I.r=e[h],u+=P+=I.g=e[h+1],m+=R+=I.b=e[h+2],v+=F+=I.a=e[h+3],I=I.next,b+=L=D.r,S+=$=D.g,E+=U=D.b,_+=z=D.a,x-=L,P-=$,R-=U,F-=z,D=D.next,c+=i}}const Ay=function(t){var e=Math.round(this.blurRadius());e>0&&Py(t,e)};P0=Ds.Blur=Ay,A0.Factory.addGetterSetter(Cy.Node,"blurRadius",0,(0,Ty.getNumberValidator)(),A0.Factory.afterSetFilter);const My=St(xt({__proto__:null,get Blur(){return P0},default:Ds},[Ds]));var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});var R0=Ls.Brighten=void 0;const D0=Ft,Ry=le,Dy=Gt,Ly=function(n){var t=this.brightness()*255,e=n.data,i=e.length,r;for(r=0;r<i;r+=4)e[r]+=t,e[r+1]+=t,e[r+2]+=t};R0=Ls.Brighten=Ly,D0.Factory.addGetterSetter(Ry.Node,"brightness",0,(0,Dy.getNumberValidator)(),D0.Factory.afterSetFilter);const Iy=St(xt({__proto__:null,get Brighten(){return R0},default:Ls},[Ls]));var Is={};Object.defineProperty(Is,"__esModule",{value:!0});var L0=Is.Contrast=void 0;const I0=Ft,Oy=le,Fy=Gt,Ny=function(n){var t=Math.pow((this.contrast()+100)/100,2),e=n.data,i=e.length,r=150,s=150,a=150,o;for(o=0;o<i;o+=4)r=e[o],s=e[o+1],a=e[o+2],r/=255,r-=.5,r*=t,r+=.5,r*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,r=r<0?0:r>255?255:r,s=s<0?0:s>255?255:s,a=a<0?0:a>255?255:a,e[o]=r,e[o+1]=s,e[o+2]=a};L0=Is.Contrast=Ny,I0.Factory.addGetterSetter(Oy.Node,"contrast",0,(0,Fy.getNumberValidator)(),I0.Factory.afterSetFilter);const Gy=St(xt({__proto__:null,get Contrast(){return L0},default:Is},[Is]));var Os={};Object.defineProperty(Os,"__esModule",{value:!0});var O0=Os.Emboss=void 0;const rn=Ft,ro=le,Uy=re,F0=Gt,By=function(n){var t=this.embossStrength()*10,e=this.embossWhiteLevel()*255,i=this.embossDirection(),r=this.embossBlend(),s=0,a=0,o=n.data,h=n.width,l=n.height,c=h*4,d=l;switch(i){case"top-left":s=-1,a=-1;break;case"top":s=-1,a=0;break;case"top-right":s=-1,a=1;break;case"right":s=0,a=1;break;case"bottom-right":s=1,a=1;break;case"bottom":s=1,a=0;break;case"bottom-left":s=1,a=-1;break;case"left":s=0,a=-1;break;default:Uy.Util.error("Unknown emboss direction: "+i)}do{var f=(d-1)*c,u=s;d+u<1&&(u=0),d+u>l&&(u=0);var m=(d-1+u)*h*4,v=h;do{var b=f+(v-1)*4,S=a;v+S<1&&(S=0),v+S>h&&(S=0);var E=m+(v-1+S)*4,_=o[b]-o[E],x=o[b+1]-o[E+1],P=o[b+2]-o[E+2],R=_,F=R>0?R:-R,L=x>0?x:-x,$=P>0?P:-P;if(L>F&&(R=x),$>F&&(R=P),R*=t,r){var U=o[b]+R,z=o[b+1]+R,q=o[b+2]+R;o[b]=U>255?255:U<0?0:U,o[b+1]=z>255?255:z<0?0:z,o[b+2]=q>255?255:q<0?0:q}else{var K=e-R;K<0?K=0:K>255&&(K=255),o[b]=o[b+1]=o[b+2]=K}}while(--v)}while(--d)};O0=Os.Emboss=By,rn.Factory.addGetterSetter(ro.Node,"embossStrength",.5,(0,F0.getNumberValidator)(),rn.Factory.afterSetFilter),rn.Factory.addGetterSetter(ro.Node,"embossWhiteLevel",.5,(0,F0.getNumberValidator)(),rn.Factory.afterSetFilter),rn.Factory.addGetterSetter(ro.Node,"embossDirection","top-left",null,rn.Factory.afterSetFilter),rn.Factory.addGetterSetter(ro.Node,"embossBlend",!1,null,rn.Factory.afterSetFilter);const zy=St(xt({__proto__:null,get Emboss(){return O0},default:Os},[Os]));var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0});var N0=Fs.Enhance=void 0;const G0=Ft,$y=le,Vy=Gt;function Cl(n,t,e,i,r){var s=e-t,a=r-i,o;return s===0?i+a/2:a===0?i:(o=(n-t)/s,o=a*o+i,o)}const Hy=function(n){var t=n.data,e=t.length,i=t[0],r=i,s,a=t[1],o=a,h,l=t[2],c=l,d,f,u=this.enhance();if(u!==0){for(f=0;f<e;f+=4)s=t[f+0],s<i?i=s:s>r&&(r=s),h=t[f+1],h<a?a=h:h>o&&(o=h),d=t[f+2],d<l?l=d:d>c&&(c=d);r===i&&(r=255,i=0),o===a&&(o=255,a=0),c===l&&(c=255,l=0);var m,v,b,S,E,_,x,P,R;for(u>0?(v=r+u*(255-r),b=i-u*(i-0),E=o+u*(255-o),_=a-u*(a-0),P=c+u*(255-c),R=l-u*(l-0)):(m=(r+i)*.5,v=r+u*(r-m),b=i+u*(i-m),S=(o+a)*.5,E=o+u*(o-S),_=a+u*(a-S),x=(c+l)*.5,P=c+u*(c-x),R=l+u*(l-x)),f=0;f<e;f+=4)t[f+0]=Cl(t[f+0],i,r,b,v),t[f+1]=Cl(t[f+1],a,o,_,E),t[f+2]=Cl(t[f+2],l,c,R,P)}};N0=Fs.Enhance=Hy,G0.Factory.addGetterSetter($y.Node,"enhance",0,(0,Vy.getNumberValidator)(),G0.Factory.afterSetFilter);const jy=St(xt({__proto__:null,get Enhance(){return N0},default:Fs},[Fs]));var Ns={};Object.defineProperty(Ns,"__esModule",{value:!0});var U0=Ns.Grayscale=void 0;const Xy=function(n){var t=n.data,e=t.length,i,r;for(i=0;i<e;i+=4)r=.34*t[i]+.5*t[i+1]+.16*t[i+2],t[i]=r,t[i+1]=r,t[i+2]=r};U0=Ns.Grayscale=Xy;const Yy=St(xt({__proto__:null,get Grayscale(){return U0},default:Ns},[Ns]));var Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});var B0=Gs.HSL=void 0;const lr=Ft,Tl=le,kl=Gt;lr.Factory.addGetterSetter(Tl.Node,"hue",0,(0,kl.getNumberValidator)(),lr.Factory.afterSetFilter),lr.Factory.addGetterSetter(Tl.Node,"saturation",0,(0,kl.getNumberValidator)(),lr.Factory.afterSetFilter),lr.Factory.addGetterSetter(Tl.Node,"luminance",0,(0,kl.getNumberValidator)(),lr.Factory.afterSetFilter);const qy=function(n){var t=n.data,e=t.length,i=1,r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o,h=i*r*Math.cos(s*Math.PI/180),l=i*r*Math.sin(s*Math.PI/180),c=.299*i+.701*h+.167*l,d=.587*i-.587*h+.33*l,f=.114*i-.114*h-.497*l,u=.299*i-.299*h-.328*l,m=.587*i+.413*h+.035*l,v=.114*i-.114*h+.293*l,b=.299*i-.3*h+1.25*l,S=.587*i-.586*h-1.05*l,E=.114*i+.886*h-.2*l,_,x,P,R;for(o=0;o<e;o+=4)_=t[o+0],x=t[o+1],P=t[o+2],R=t[o+3],t[o+0]=c*_+d*x+f*P+a,t[o+1]=u*_+m*x+v*P+a,t[o+2]=b*_+S*x+E*P+a,t[o+3]=R};B0=Gs.HSL=qy;const Wy=St(xt({__proto__:null,get HSL(){return B0},default:Gs},[Gs]));var Us={};Object.defineProperty(Us,"__esModule",{value:!0});var z0=Us.HSV=void 0;const cr=Ft,El=le,Pl=Gt,Ky=function(n){var t=n.data,e=t.length,i=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a,o=i*r*Math.cos(s*Math.PI/180),h=i*r*Math.sin(s*Math.PI/180),l=.299*i+.701*o+.167*h,c=.587*i-.587*o+.33*h,d=.114*i-.114*o-.497*h,f=.299*i-.299*o-.328*h,u=.587*i+.413*o+.035*h,m=.114*i-.114*o+.293*h,v=.299*i-.3*o+1.25*h,b=.587*i-.586*o-1.05*h,S=.114*i+.886*o-.2*h,E,_,x,P;for(a=0;a<e;a+=4)E=t[a+0],_=t[a+1],x=t[a+2],P=t[a+3],t[a+0]=l*E+c*_+d*x,t[a+1]=f*E+u*_+m*x,t[a+2]=v*E+b*_+S*x,t[a+3]=P};z0=Us.HSV=Ky,cr.Factory.addGetterSetter(El.Node,"hue",0,(0,Pl.getNumberValidator)(),cr.Factory.afterSetFilter),cr.Factory.addGetterSetter(El.Node,"saturation",0,(0,Pl.getNumberValidator)(),cr.Factory.afterSetFilter),cr.Factory.addGetterSetter(El.Node,"value",0,(0,Pl.getNumberValidator)(),cr.Factory.afterSetFilter);const Zy=St(xt({__proto__:null,get HSV(){return z0},default:Us},[Us]));var Bs={};Object.defineProperty(Bs,"__esModule",{value:!0});var $0=Bs.Invert=void 0;const Jy=function(n){var t=n.data,e=t.length,i;for(i=0;i<e;i+=4)t[i]=255-t[i],t[i+1]=255-t[i+1],t[i+2]=255-t[i+2]};$0=Bs.Invert=Jy;const Qy=St(xt({__proto__:null,get Invert(){return $0},default:Bs},[Bs]));var zs={};Object.defineProperty(zs,"__esModule",{value:!0});var V0=zs.Kaleidoscope=void 0;const so=Ft,H0=le,j0=re,X0=Gt;var t4=function(n,t,e){var i=n.data,r=t.data,s=n.width,a=n.height,o=e.polarCenterX||s/2,h=e.polarCenterY||a/2,l,c,d,f=0,u=0,m=0,v=0,b,S=Math.sqrt(o*o+h*h);c=s-o,d=a-h,b=Math.sqrt(c*c+d*d),S=b>S?b:S;var E=a,_=s,x,P,R=360/_*Math.PI/180,F,L;for(P=0;P<_;P+=1)for(F=Math.sin(P*R),L=Math.cos(P*R),x=0;x<E;x+=1)c=Math.floor(o+S*x/E*L),d=Math.floor(h+S*x/E*F),l=(d*s+c)*4,f=i[l+0],u=i[l+1],m=i[l+2],v=i[l+3],l=(P+x*s)*4,r[l+0]=f,r[l+1]=u,r[l+2]=m,r[l+3]=v},e4=function(n,t,e){var i=n.data,r=t.data,s=n.width,a=n.height,o=e.polarCenterX||s/2,h=e.polarCenterY||a/2,l,c,d,f,u,m=0,v=0,b=0,S=0,E,_=Math.sqrt(o*o+h*h);c=s-o,d=a-h,E=Math.sqrt(c*c+d*d),_=E>_?E:_;var x=a,P=s,R,F,L=e.polarRotation||0,$,U;for(c=0;c<s;c+=1)for(d=0;d<a;d+=1)f=c-o,u=d-h,R=Math.sqrt(f*f+u*u)*x/_,F=(Math.atan2(u,f)*180/Math.PI+360+L)%360,F=F*P/360,$=Math.floor(F),U=Math.floor(R),l=(U*s+$)*4,m=i[l+0],v=i[l+1],b=i[l+2],S=i[l+3],l=(d*s+c)*4,r[l+0]=m,r[l+1]=v,r[l+2]=b,r[l+3]=S};const i4=function(n){var t=n.width,e=n.height,i,r,s,a,o,h,l,c,d,f,u=Math.round(this.kaleidoscopePower()),m=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(m%360)/360);if(!(u<1)){var b=j0.Util.createCanvasElement();b.width=t,b.height=e;var S=b.getContext("2d").getImageData(0,0,t,e);j0.Util.releaseCanvas(b),t4(n,S,{polarCenterX:t/2,polarCenterY:e/2});for(var E=t/Math.pow(2,u);E<=8;)E=E*2,u-=1;E=Math.ceil(E);var _=E,x=0,P=_,R=1;for(v+E>t&&(x=_,P=0,R=-1),r=0;r<e;r+=1)for(i=x;i!==P;i+=R)s=Math.round(i+v)%t,d=(t*r+s)*4,o=S.data[d+0],h=S.data[d+1],l=S.data[d+2],c=S.data[d+3],f=(t*r+i)*4,S.data[f+0]=o,S.data[f+1]=h,S.data[f+2]=l,S.data[f+3]=c;for(r=0;r<e;r+=1)for(_=Math.floor(E),a=0;a<u;a+=1){for(i=0;i<_+1;i+=1)d=(t*r+i)*4,o=S.data[d+0],h=S.data[d+1],l=S.data[d+2],c=S.data[d+3],f=(t*r+_*2-i-1)*4,S.data[f+0]=o,S.data[f+1]=h,S.data[f+2]=l,S.data[f+3]=c;_*=2}e4(S,n,{polarRotation:0})}};V0=zs.Kaleidoscope=i4,so.Factory.addGetterSetter(H0.Node,"kaleidoscopePower",2,(0,X0.getNumberValidator)(),so.Factory.afterSetFilter),so.Factory.addGetterSetter(H0.Node,"kaleidoscopeAngle",0,(0,X0.getNumberValidator)(),so.Factory.afterSetFilter);const n4=St(xt({__proto__:null,get Kaleidoscope(){return V0},default:zs},[zs]));var $s={};Object.defineProperty($s,"__esModule",{value:!0});var Y0=$s.Mask=void 0;const q0=Ft,r4=le,s4=Gt;function ao(n,t,e){var i=(e*n.width+t)*4,r=[];return r.push(n.data[i++],n.data[i++],n.data[i++],n.data[i++]),r}function Vs(n,t){return Math.sqrt(Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2)+Math.pow(n[2]-t[2],2))}function a4(n){for(var t=[0,0,0],e=0;e<n.length;e++)t[0]+=n[e][0],t[1]+=n[e][1],t[2]+=n[e][2];return t[0]/=n.length,t[1]/=n.length,t[2]/=n.length,t}function o4(n,t){var e=ao(n,0,0),i=ao(n,n.width-1,0),r=ao(n,0,n.height-1),s=ao(n,n.width-1,n.height-1),a=t||10;if(Vs(e,i)<a&&Vs(i,s)<a&&Vs(s,r)<a&&Vs(r,e)<a){for(var o=a4([i,e,s,r]),h=[],l=0;l<n.width*n.height;l++){var c=Vs(o,[n.data[l*4],n.data[l*4+1],n.data[l*4+2]]);h[l]=c<a?0:255}return h}}function h4(n,t){for(var e=0;e<n.width*n.height;e++)n.data[4*e+3]=t[e]}function l4(n,t,e){for(var i=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,m=h+f-s;if(u>=0&&u<e&&m>=0&&m<t){var v=u*t+m,b=i[d*r+f];c+=n[v]*b}}a[l]=c===255*8?255:0}return a}function c4(n,t,e){for(var i=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,m=h+f-s;if(u>=0&&u<e&&m>=0&&m<t){var v=u*t+m,b=i[d*r+f];c+=n[v]*b}}a[l]=c>=255*4?255:0}return a}function u4(n,t,e){for(var i=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,m=h+f-s;if(u>=0&&u<e&&m>=0&&m<t){var v=u*t+m,b=i[d*r+f];c+=n[v]*b}}a[l]=c}return a}const f4=function(n){var t=this.threshold(),e=o4(n,t);return e&&(e=l4(e,n.width,n.height),e=c4(e,n.width,n.height),e=u4(e,n.width,n.height),h4(n,e)),n};Y0=$s.Mask=f4,q0.Factory.addGetterSetter(r4.Node,"threshold",0,(0,s4.getNumberValidator)(),q0.Factory.afterSetFilter);const d4=St(xt({__proto__:null,get Mask(){return Y0},default:$s},[$s]));var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});var W0=Hs.Noise=void 0;const K0=Ft,g4=le,p4=Gt,m4=function(n){var t=this.noise()*255,e=n.data,i=e.length,r=t/2,s;for(s=0;s<i;s+=4)e[s+0]+=r-2*r*Math.random(),e[s+1]+=r-2*r*Math.random(),e[s+2]+=r-2*r*Math.random()};W0=Hs.Noise=m4,K0.Factory.addGetterSetter(g4.Node,"noise",.2,(0,p4.getNumberValidator)(),K0.Factory.afterSetFilter);const v4=St(xt({__proto__:null,get Noise(){return W0},default:Hs},[Hs]));var js={};Object.defineProperty(js,"__esModule",{value:!0});var Z0=js.Pixelate=void 0;const J0=Ft,_4=re,y4=le,w4=Gt,b4=function(n){var t=Math.ceil(this.pixelSize()),e=n.width,i=n.height,r,s,a,o,h,l,c,d=Math.ceil(e/t),f=Math.ceil(i/t),u,m,v,b,S,E,_,x=n.data;if(t<=0){_4.Util.error("pixelSize value can not be <= 0");return}for(S=0;S<d;S+=1)for(E=0;E<f;E+=1){for(o=0,h=0,l=0,c=0,u=S*t,m=u+t,v=E*t,b=v+t,_=0,r=u;r<m;r+=1)if(!(r>=e))for(s=v;s<b;s+=1)s>=i||(a=(e*s+r)*4,o+=x[a+0],h+=x[a+1],l+=x[a+2],c+=x[a+3],_+=1);for(o=o/_,h=h/_,l=l/_,c=c/_,r=u;r<m;r+=1)if(!(r>=e))for(s=v;s<b;s+=1)s>=i||(a=(e*s+r)*4,x[a+0]=o,x[a+1]=h,x[a+2]=l,x[a+3]=c)}};Z0=js.Pixelate=b4,J0.Factory.addGetterSetter(y4.Node,"pixelSize",8,(0,w4.getNumberValidator)(),J0.Factory.afterSetFilter);const x4=St(xt({__proto__:null,get Pixelate(){return Z0},default:js},[js]));var Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});var Q0=Xs.Posterize=void 0;const t1=Ft,S4=le,C4=Gt,T4=function(n){var t=Math.round(this.levels()*254)+1,e=n.data,i=e.length,r=255/t,s;for(s=0;s<i;s+=1)e[s]=Math.floor(e[s]/r)*r};Q0=Xs.Posterize=T4,t1.Factory.addGetterSetter(S4.Node,"levels",.5,(0,C4.getNumberValidator)(),t1.Factory.afterSetFilter);const k4=St(xt({__proto__:null,get Posterize(){return Q0},default:Xs},[Xs]));var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0});var e1=Ys.RGB=void 0;const oo=Ft,Al=le,E4=Gt,P4=function(n){var t=n.data,e=t.length,i=this.red(),r=this.green(),s=this.blue(),a,o;for(a=0;a<e;a+=4)o=(.34*t[a]+.5*t[a+1]+.16*t[a+2])/255,t[a]=o*i,t[a+1]=o*r,t[a+2]=o*s,t[a+3]=t[a+3]};e1=Ys.RGB=P4,oo.Factory.addGetterSetter(Al.Node,"red",0,function(n){return this._filterUpToDate=!1,n>255?255:n<0?0:Math.round(n)}),oo.Factory.addGetterSetter(Al.Node,"green",0,function(n){return this._filterUpToDate=!1,n>255?255:n<0?0:Math.round(n)}),oo.Factory.addGetterSetter(Al.Node,"blue",0,E4.RGBComponent,oo.Factory.afterSetFilter);const A4=St(xt({__proto__:null,get RGB(){return e1},default:Ys},[Ys]));var qs={};Object.defineProperty(qs,"__esModule",{value:!0});var i1=qs.RGBA=void 0;const Ws=Ft,ho=le,M4=Gt,R4=function(n){var t=n.data,e=t.length,i=this.red(),r=this.green(),s=this.blue(),a=this.alpha(),o,h;for(o=0;o<e;o+=4)h=1-a,t[o]=i*a+t[o]*h,t[o+1]=r*a+t[o+1]*h,t[o+2]=s*a+t[o+2]*h};i1=qs.RGBA=R4,Ws.Factory.addGetterSetter(ho.Node,"red",0,function(n){return this._filterUpToDate=!1,n>255?255:n<0?0:Math.round(n)}),Ws.Factory.addGetterSetter(ho.Node,"green",0,function(n){return this._filterUpToDate=!1,n>255?255:n<0?0:Math.round(n)}),Ws.Factory.addGetterSetter(ho.Node,"blue",0,M4.RGBComponent,Ws.Factory.afterSetFilter),Ws.Factory.addGetterSetter(ho.Node,"alpha",1,function(n){return this._filterUpToDate=!1,n>1?1:n<0?0:n});const D4=St(xt({__proto__:null,get RGBA(){return i1},default:qs},[qs]));var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});var n1=Ks.Sepia=void 0;const L4=function(n){var t=n.data,e=t.length,i,r,s,a;for(i=0;i<e;i+=4)r=t[i+0],s=t[i+1],a=t[i+2],t[i+0]=Math.min(255,r*.393+s*.769+a*.189),t[i+1]=Math.min(255,r*.349+s*.686+a*.168),t[i+2]=Math.min(255,r*.272+s*.534+a*.131)};n1=Ks.Sepia=L4;const I4=St(xt({__proto__:null,get Sepia(){return n1},default:Ks},[Ks]));var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});var r1=Zs.Solarize=void 0;const O4=function(n){var t=n.data,e=n.width,i=n.height,r=e*4,s=i;do{var a=(s-1)*r,o=e;do{var h=a+(o-1)*4,l=t[h],c=t[h+1],d=t[h+2];l>127&&(l=255-l),c>127&&(c=255-c),d>127&&(d=255-d),t[h]=l,t[h+1]=c,t[h+2]=d}while(--o)}while(--s)};r1=Zs.Solarize=O4;const F4=St(xt({__proto__:null,get Solarize(){return r1},default:Zs},[Zs]));var Js={};Object.defineProperty(Js,"__esModule",{value:!0});var s1=Js.Threshold=void 0;const a1=Ft,N4=le,G4=Gt,U4=function(n){var t=this.threshold()*255,e=n.data,i=e.length,r;for(r=0;r<i;r+=1)e[r]=e[r]<t?0:255};s1=Js.Threshold=U4,a1.Factory.addGetterSetter(N4.Node,"threshold",.5,(0,G4.getNumberValidator)(),a1.Factory.afterSetFilter);const B4=St(xt({__proto__:null,get Threshold(){return s1},default:Js},[Js]));Object.defineProperty(ss,"__esModule",{value:!0});var o1=ss.Konva=void 0;const h1=j5,z4=q5,$4=n3,V4=h3,H4=u3,j4=g3,l1=w3,X4=Rd,Y4=hl,q4=jd,W4=P3,K4=R3,Z4=O3,J4=G3,Q4=d0,t6=ay,e6=yy,i6=Sy,n6=My,r6=Iy,s6=Gy,a6=zy,o6=jy,h6=Yy,l6=Wy,c6=Zy,u6=Qy,f6=n4,d6=d4,g6=v4,p6=x4,m6=k4,v6=A4,_6=D4,y6=I4,w6=F4,b6=B4;o1=ss.Konva=h1.Konva.Util._assign(h1.Konva,{Arc:z4.Arc,Arrow:$4.Arrow,Circle:V4.Circle,Ellipse:H4.Ellipse,Image:j4.Image,Label:l1.Label,Tag:l1.Tag,Line:X4.Line,Path:Y4.Path,Rect:q4.Rect,RegularPolygon:W4.RegularPolygon,Ring:K4.Ring,Sprite:Z4.Sprite,Star:J4.Star,Text:Q4.Text,TextPath:t6.TextPath,Transformer:e6.Transformer,Wedge:i6.Wedge,Filters:{Blur:n6.Blur,Brighten:r6.Brighten,Contrast:s6.Contrast,Emboss:a6.Emboss,Enhance:o6.Enhance,Grayscale:h6.Grayscale,HSL:l6.HSL,HSV:c6.HSV,Invert:u6.Invert,Kaleidoscope:f6.Kaleidoscope,Mask:d6.Mask,Noise:g6.Noise,Pixelate:p6.Pixelate,Posterize:m6.Posterize,RGB:v6.RGB,RGBA:_6.RGBA,Sepia:y6.Sepia,Solarize:w6.Solarize,Threshold:b6.Threshold}});const x6=St(xt({__proto__:null,get Konva(){return o1},default:ss},[ss]));var S6=Gh.exports;Object.defineProperty(S6,"__esModule",{value:!0});const C6=x6;Gh.exports=C6.Konva;var T6=Gh.exports;const Vt=Pe(T6),c1=(n,t)=>{if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++){const i=n[e],r=t.find(s=>s.id===i.id);if(!r||!k6(i,r))return!1}return!0},k6=(n,t)=>n.attrs.id===n.attrs.id&&n._id===t._id,ur=n=>n.reduce((t,e)=>[...t,...e.toArray()],[]),E6=n=>{n.sort(function(e,i){return e-i});const t=Math.floor(n.length/2);return n[t]},u1=n=>{const t=Math.atan2(n[1],n[0]),e=Math.pow(n[0],2)+Math.pow(n[1],2),i=Math.sqrt(e),r=(n[0]*n[3]-n[2]*n[1])/i;return{rotation:t/(Math.PI/180),scaleX:i,scaleY:r,x:n[4],y:n[5]}},P6=(n,t)=>{const e=n.getTransform().getMatrix(),i=t.getTransform().getMatrix(),r=e[0],s=e[1],a=e[2],o=e[3],h=e[4],l=e[5],c=i[0],d=i[1],f=i[2],u=i[3],m=i[4],v=i[5],b=c*u,S=d*f,E=(f*s-r*u)/(S-b),_=(c*s-r*d)/(b-S),x=(f*o-a*u)/(S-b),P=(c*o-a*d)/(b-S),R=(f*(l-v)+u*(m-h))/(S-b),F=(c*(l-v)+d*(m-h))/(b-S);return u1([E,_,x,P,R,F])};class f1{app;constructor(t){this.app=t}}class A6 extends f1{constructor(t){super(t),this.app.stage.on("mousedown",this.onMouseDown),this.app.stage.on("mouseup",this.onMouseUp),this.app.stage.on("mousemove",this.onMouseMove),this.app.stage.on("mouseover",this.onMouseOver),this.app.stage.on("mouseout",this.onMouseOut),this.app.stage.on("dblclick",this.onMouseDoubleClick),this.app.stage.on("click",this.onMouseClick),this.app.stage.on("contextmenu",this.onMouseContextmenu),this.app.stage.on("wheel",this.onWheel)}onMouseDown=t=>{t.evt.button===1&&this.app.triggerPanning(!0),!this.app.stage.draggable()&&this.app.emit("mouseDown",t)};onMouseUp=t=>{t.evt.button===1&&this.app.triggerPanning(!1),!this.app.stage.draggable()&&this.app.emit("mouseUp",t)};onMouseMove=t=>{this.app.stage.draggable()||this.app.emit("mouseMove",t)};onMouseOver=t=>{this.app.stage.draggable()||this.app.emit("mouseOver",t)};onMouseOut=t=>{this.app.stage.draggable()||this.app.emit("mouseOut",t)};onMouseDoubleClick=t=>{this.app.stage.draggable()||this.app.emit("mouseDoubleClick",t)};onMouseClick=t=>{this.app.stage.draggable()||this.app.emit("mouseClick",t)};onMouseContextmenu=t=>{this.app.triggerTool(!1),this.app.emit("mouseContextMenu",t),setTimeout(()=>this.app.triggerTool(!0),100)};onWheel=t=>{if(t.evt.preventDefault(),!this.app.config.mousewheel.enabled)return;const e=this.app.stage.scaleX();this.app.emit("canvasZoomStart",e);const i=this.app.stage.getPointerPosition()??new Wt({x:0,y:0}),r=new Wt({x:(i.x-this.app.stage.x())/e,y:(i.y-this.app.stage.y())/e}),s=(t.evt.shiftKey&&!t.evt.ctrlKey?t.evt.deltaX:t.evt.deltaY)>0?1:-1;let a=e;s>0?a+=this.app.config.mousewheel.factor:a-=this.app.config.mousewheel.factor,a=Math.min(Math.max(a,this.app.config.scale.min),this.app.config.scale.max),this.app.stage.scale({x:a,y:a}),this.app.stage.position({x:i.x-r.x*a,y:i.y-r.y*a}),this.app.emit("canvasZoomEnd",a)};destroy(){this.app.stage.off("mousedown",this.onMouseDown),this.app.stage.off("mouseup",this.onMouseUp),this.app.stage.off("mousemove",this.onMouseMove),this.app.stage.off("mouseover",this.onMouseOver),this.app.stage.off("mouseout",this.onMouseOut),this.app.stage.off("dblclick",this.onMouseDoubleClick),this.app.stage.off("click",this.onMouseClick),this.app.stage.off("contextmenu",this.onMouseContextmenu),this.app.stage.off("wheel",this.onWheel)}}const d1=n=>typeof n=="function";class M6 extends f1{currentTool=null;enable=!0;constructor(t){super(t),this.app.on("mouseDown",this.onMousedown),this.app.on("mouseMove",this.onMousemove),this.app.on("mouseUp",this.onMouseup),this.app.on("mouseClick",this.onClick),this.app.on("mouseDoubleClick",this.onDoubleClick)}get available(){return this.currentTool!==null&&this.enable&&!this.app.stage.draggable()}async setTool(t){const e=this.currentTool;e?.name!==t.name&&(e?.hooks&&d1(e?.hooks?.onInactive)&&await e.hooks.onInactive?.(this.app,e),this.currentTool=t,this.currentTool?.hooks&&d1(this.currentTool?.hooks?.onActive)&&await this.currentTool.hooks.onActive?.(this.app,this.currentTool),this.app.render(),this.app.emit("toolChanged",e,t))}trigger(t){const e=this.enable;t===void 0?this.enable=!this.enable:this.enable=t,this.currentTool?.enableChanged?.(e,this.enable)}onMousedown=t=>{!this.available||!this.currentTool?.mousedown||t.evt.button!==0||this.currentTool.mousedown({event:t,pointer:this.app.pointer,app:this.app})};onMouseup=t=>{!this.available||!this.currentTool?.mouseup||t.evt.button!==0||this.currentTool.mouseup({event:t,pointer:this.app.pointer,app:this.app})};onMousemove=t=>{!this.available||!this.currentTool?.mousemove||t.evt.button!==0||this.currentTool.mousemove({event:t,pointer:this.app.pointer,app:this.app})};onClick=t=>{!this.available||!this.currentTool?.click||t.evt.button!==0||this.currentTool.click({event:t,pointer:this.app.pointer,app:this.app})};onDoubleClick=t=>{!this.available||!this.currentTool?.doubleClick||t.evt.button!==0||this.currentTool.doubleClick({event:t,pointer:this.app.pointer,app:this.app})};destroy(){this.app.off("mouseDown",this.onMousedown),this.app.off("mouseMove",this.onMousemove),this.app.off("mouseUp",this.onMouseup),this.app.off("mouseClick",this.onClick),this.app.off("mouseDoubleClick",this.onDoubleClick),this.currentTool=null}}var R6=Object.defineProperty,D6=Object.getOwnPropertyDescriptor,sn=(n,t,e,i)=>{for(var r=i>1?void 0:i?D6(t,e):t,s=n.length-1,a;s>=0;s--)(a=n[s])&&(r=(i?a(t,e,r):a(r))||r);return i&&r&&R6(t,e,r),r};class L6{name="alignmentPlugin";alignment;app;options;keyFns=[];constructor(t){this.options={enabled:!0,...t}}install(t){this.app=t,this.alignment=new Mi(t,this.options),this.app.alignLeft=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignLeft(e),this},this.app.alignRight=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignRight(e),this},this.app.alignTop=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignTop(e),this},this.app.alignBottom=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignBottom(e),this},this.app.alignCenterX=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignCenterX(e),this},this.app.alignCenterY=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignCenterY(e),this},this.app.dispersionX=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.dispersionX(e),this},this.app.dispersionY=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.dispersionY(e),this},this.keyFns.push(Qt.on({key:"a",title:"左对齐",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"h",title:"水平居中",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"d",title:"右对齐",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"w",title:"顶对齐",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"v",title:"垂直居中",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"s",title:"底对齐",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"h",title:"水平分布",ctrl:!0,shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"v",title:"垂直分布",ctrl:!0,shift:!0},()=>{})),this.app.emit("alignmentInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.app?.emit("alignmentDestroy",this)}enable(){this.alignment&&(this.options.enabled=!0,this.alignment.enabled=!0)}disable(){this.alignment&&(this.options.enabled=!1,this.alignment.enabled=!1)}isEnabled(){return this.options.enabled&&(this.alignment?.enabled??!1)}}function an(n,t,e){const i=e.value;return e.value=function(...r){if(this.enabled)return i.apply(this,r);console.log(`Method ${t} is disabled.`)},e}class Mi{app;enabled;constructor(t,e){const{enabled:i}=e;this.app=t,this.enabled=i}alignLeft(t){const e=t.map(r=>r.getClientRect()),i=Math.min(...e.map(r=>r.x));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].x-i;return a.attrs={...a.attrs,x:a.attrs.x-o},a}))}alignRight(t){const e=t.map(r=>r.getClientRect()),i=Math.max(...e.map(r=>r.x+r.width));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=i-(e[s].x+e[s].width);return a.attrs={...a.attrs,x:a.attrs.x+o},a}))}alignTop(t){const e=t.map(r=>r.getClientRect()),i=Math.min(...e.map(r=>r.y));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].y-i;return a.attrs={...a.attrs,y:a.attrs.y-o},a}))}alignBottom(t){const e=t.map(r=>r.getClientRect()),i=Math.max(...e.map(r=>r.y+r.height));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=i-(e[s].y+e[s].height);return a.attrs={...a.attrs,y:a.attrs.y+o},a}))}alignCenterX(t){const e=t.map(r=>r.getClientRect()),i=e.reduce((r,s)=>r+(s.x+s.width/2),0)/e.length;this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=i-(e[s].x+e[s].width/2);return a.attrs={...a.attrs,x:a.attrs.x+o},a}))}alignCenterY(t){const e=t.map(r=>r.getClientRect()),i=e.reduce((r,s)=>r+(s.y+s.height/2),0)/e.length;this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=i-(e[s].y+e[s].height/2);return a.attrs={...a.attrs,y:a.attrs.y+o},a}))}dispersionX(t){t.map(r=>r.getClientRect().x+r.getClientRect().width/2).every((r,s,a)=>r===a[0])||this.distributeNodes(t,"x")}dispersionY(t){t.map(r=>r.getClientRect().y+r.getClientRect().height/2).every((r,s,a)=>r===a[0])||this.distributeNodes(t,"y")}distributeNodes(t,e){if(t.length<=2)return;t.sort((d,f)=>d.getClientRect()[e]-f.getClientRect()[e]);const i=t[0],r=t[t.length-1],s=i.getClientRect()[e]+(e==="x"?i.getClientRect().width:i.getClientRect().height),a=r.getClientRect()[e]-s,h=t.slice(1,-1).reduce((d,f)=>d+(e==="x"?f.getClientRect().width:f.getClientRect().height),0),l=Math.max((a-h)/(t.length-1),0);let c=s;this.app.update(...t.map((d,f)=>{const u=d.toObject();if(f===0||f===t.length-1)return u;const m=c+l;return u.attrs[e]=m-d.getClientRect()[e]+u.attrs[e],c=m+(e==="x"?d.getClientRect().width:d.getClientRect().height),u}))}}sn([an],Mi.prototype,"alignLeft",1),sn([an],Mi.prototype,"alignRight",1),sn([an],Mi.prototype,"alignTop",1),sn([an],Mi.prototype,"alignBottom",1),sn([an],Mi.prototype,"alignCenterX",1),sn([an],Mi.prototype,"alignCenterY",1),sn([an],Mi.prototype,"dispersionX",1),sn([an],Mi.prototype,"dispersionY",1);class g1{app;selected;optionLayer;enabled;multipleSelect;hightLightConfig;transformerConfig;rubberConfig;transformer;rubberRect;rubberStartPoint=new Wt({x:0,y:0});rubberEnable=!1;hightLightRects;constructor(t,e){const{enabled:i,multipleSelect:r,transformer:s,hightLight:a,rubber:o}=e;this.app=t,this.selected=new Map,this.hightLightRects=new Map,this.enabled=i,this.multipleSelect=r,this.transformerConfig=s,this.hightLightConfig=a,this.rubberConfig=o,this.optionLayer=new Vt.Layer,this.optionLayer.name("pictode:option:layer"),this.app.stage.add(this.optionLayer),this.transformer=new Vt.Transformer({...this.transformerConfig,shouldOverdrawWholeArea:!1,flipEnabled:!1}),this.transformer.anchorStyleFunc(h=>{["middle-left","middle-right","top-center","bottom-center"].some(c=>h.hasName(c))&&([...this.selected.values()][0]instanceof Vt.Text||[...this.selected.values()][0]instanceof Vt.Group||this.selected.size>1)&&h.visible(!1);const l=(c="")=>{const d=h.getStage();!d||!d.content||(d.content.style.cursor=c)};h.on("mousedown",()=>{this.enabled=!1}),h.on("mouseup",()=>{this.enabled=!0}),h.on("mouseenter",()=>{this.enabled=!1,h.hasName("rotater")&&l("grabbing")}),h.on("mouseout",()=>{this.enabled=!0,h.hasName("rotater")&&l()})}),this.optionLayer.add(this.transformer),this.rubberRect=new Vt.Rect({stroke:this.rubberConfig.stroke,fill:this.rubberConfig.fill,strokeWidth:this.rubberConfig.strokeWidth,strokeScaleEnabled:!1}),this.optionLayer.add(this.rubberRect),this.transformer.on("transformstart",this.onTransformStart),this.transformer.on("transformend",this.onTransformEnd),this.transformer.on("dragstart",this.onDragStart),this.transformer.on("dragend",this.onDragEnd),this.app.on("mouseDown",this.onMouseDown),this.app.on("mouseMove",this.onMouseMove),this.app.on("mouseUp",this.onMouseUp),this.app.on("mouseClick",this.onMouseClick),this.app.on("mouseOut",this.onMouseOut)}handleNodeRemoved=({target:t})=>{this.cancelSelect(t),t.off("removed",this.handleNodeRemoved)};select(...t){this.enabled&&(c1(t,[...this.selected.values()])||(this.cancelSelect(),this.transformer.nodes(t.filter(e=>(e.draggable(!0),e.on("removed",this.handleNodeRemoved),this.selected.set(e.id(),e),e!==this.rubberRect))),this.setHightRect(...t),this.app.render(),this.app.emit("selectedChanged",Array.from(this.selected.values()))))}cancelSelect(...t){this.selected.size!==0&&(t.length===0&&(t=[...this.selected.values()]),t.forEach(e=>{e.draggable(!1),e.off("removed",this.handleNodeRemoved),this.selected.delete(e.id())}),this.removeHightRect(...t),this.transformer.nodes([...this.selected.values()]),this.app.emit("selectedChanged",Array.from(this.selected.values())))}selectAll(){this.select(...this.app.mainLayer.getChildren())}triggerSelector(t){t===void 0?this.enabled=!this.enabled:this.enabled=t,this.enabled||(this.rubberEnable=!1)}isSelected(t){return this.selected.has(t.id())}getSelectClientRect(){return this.transformer.getClientRect()}setHightRect(...t){this.hightLightRects=t.reduce((e,i)=>{const r=new Vt.Rect({stroke:this.hightLightConfig.stroke,strokeWidth:this.hightLightConfig.strokeWidth,dash:this.hightLightConfig.dash,fillEnabled:!1,strokeScaleEnabled:!1});this.calculateNodeRect(i,r,this.hightLightConfig.padding??0),this.optionLayer.add(r);const s=()=>requestAnimationFrame(()=>this.calculateNodeRect(i,r,this.hightLightConfig.padding??0));return i.on("dragmove transform xChange yChange",s),e.set(i.id(),{rect:r,transformHandler:s}),e},new Map)}removeHightRect(...t){t.forEach(e=>{const i=this.hightLightRects.get(e.id());i&&(e.off("dragmove transform xChange yChange",i.transformHandler),i.rect.remove(),this.hightLightRects.delete(e.id()))})}calculateNodeRect(t,e,i=0){const{x:r,y:s,width:a,height:o}=this.getNodeRect(t,i);e.position({x:(r-this.app.stage.x())/this.app.stage.scaleX(),y:(s-this.app.stage.y())/this.app.stage.scaleY()}),e.width(a/this.app.stage.scaleX()),e.height(o/this.app.stage.scaleY()),e.rotation(t.rotation())}getNodeRect(t,e=0){const i=f=>Vt.angleDeg?f*Math.PI/180:f,r=[];let s=[];t instanceof Vt.Group?s=t.getChildren():s=[t],s.map(f=>{const u=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.transformer.ignoreStroke()}),m=[{x:u.x,y:u.y},{x:u.x+u.width,y:u.y},{x:u.x+u.width,y:u.y+u.height},{x:u.x,y:u.y+u.height}],v=f.getAbsoluteTransform();m.forEach(function(b){const S=v.point(b);r.push(new Wt({x:S.x,y:S.y}))})});const a=new Vt.Transform;a.rotate(-i(t.rotation()));let o,h,l,c;r.forEach(function(f){const u=a.point(f);(o===void 0||h===void 0||l===void 0||c===void 0)&&(o=l=u.x,h=c=u.y),o=Math.min(o,u.x),h=Math.min(h,u.y),l=Math.max(l,u.x),c=Math.max(c,u.y)}),a.invert();const d=a.point({x:(o??0)-e,y:(h??0)-e});return{x:d.x,y:d.y,width:(l??0)-(o??0)+e*2,height:(c??0)-(h??0)+e*2}}onTransformStart=()=>{this.app.emit("nodeTransformStart",Array.from(this.selected.values())),this.app.emit("nodeUpdateBefore",Array.from(this.selected.values()))};onTransformEnd=()=>{this.app.emit("nodeTransformEnd",Array.from(this.selected.values())),this.app.emit("nodeUpdated",Array.from(this.selected.values()))};onDragStart=()=>{this.app.emit("nodeTransformStart",Array.from(this.selected.values())),this.app.emit("nodeUpdateBefore",Array.from(this.selected.values()))};onDragEnd=()=>{this.app.emit("nodeTransformEnd",Array.from(this.selected.values())),this.app.emit("nodeUpdated",Array.from(this.selected.values()))};onMouseDown=t=>{!this.enabled||t.evt.button!==0||t.target instanceof Vt.Stage&&(this.cancelSelect(),this.rubberStartPoint.clone(this.app.pointer),this.rubberRect.setPosition(this.rubberStartPoint),this.rubberRect.width(0),this.rubberRect.height(0),this.rubberRect.visible(!1),this.rubberEnable=!0)};onMouseMove=()=>{if(!this.enabled||!this.rubberEnable)return;const t=new Wt({x:Math.min(this.app.pointer.x,this.rubberStartPoint.x),y:Math.min(this.app.pointer.y,this.rubberStartPoint.y)});this.rubberRect.setPosition(t),this.rubberRect.width(Math.max(this.app.pointer.x,this.rubberStartPoint.x)-t.x),this.rubberRect.height(Math.max(this.app.pointer.y,this.rubberStartPoint.y)-t.y),this.rubberRect.visible(!0)};onMouseUp=t=>{if(!(!this.enabled||t.evt.button!==0)&&this.rubberEnable){const e=this.app.getShapesInArea(this.rubberRect);this.select(...e),this.rubberRect.visible(!1),this.rubberEnable=!1;return}};onMouseClick=t=>{if(!this.enabled||t.evt.button!==0||t.target instanceof Vt.Stage||!t.target.attrs.id)return;const i=this.app.findTopGroup(t.target)??t.target;t.evt.shiftKey&&this.multipleSelect?this.selected.has(i.attrs.id)?this.cancelSelect(i):this.select(...this.selected.values(),i):this.select(i)};onMouseOut=t=>{t.target instanceof Vt.Stage&&(this.rubberEnable=!1)};destroy(){this.transformer.off("transformstart",this.onTransformStart),this.transformer.off("transformend",this.onTransformEnd),this.transformer.off("dragstart",this.onDragStart),this.transformer.off("dragend",this.onDragEnd),this.app.off("mouseDown",this.onMouseDown),this.app.off("mouseMove",this.onMouseMove),this.app.off("mouseUp",this.onMouseUp),this.app.off("mouseClick",this.onMouseClick),this.app.off("mouseOut",this.onMouseOut),this.selected.clear(),this.enabled=!1,this.transformer.remove(),this.optionLayer.remove()}}const I6={enabled:!0,multipleSelect:!0,transformer:{padding:6,ignoreStroke:!0,borderStroke:"#4e86e3",borderStrokeWidth:1,borderDash:[3,3],anchorSize:8,anchorStroke:"#4e86e3",anchorCornerRadius:3,anchorStrokeWidth:1,rotateAnchorOffset:20},hightLight:{padding:3,stroke:"#4e86e3",strokeWidth:1},rubber:{stroke:"#4e86e3",strokeWidth:1,fill:"#4e86e350"}};class O6{name="selectorPlugin";selector;app;options;keyFns=[];constructor(t){this.options={...I6,...t}}install(t){this.app=t,this.selector=new g1(t,this.options),this.app.on("canvasCleared",this.onCanvasCleared),this.app.select=function(...e){const i=this.app.getPlugin("selectorPlugin");return i&&i.selector?.select(...e),this},this.app.cancelSelect=function(...e){const i=this.app.getPlugin("selectorPlugin");return i&&i.selector?.cancelSelect(...e),this},this.app.selectByEvent=function(e){return this.app.getPlugin("selectorPlugin")&&(e.target instanceof Vt.Stage?this.cancelSelect():this.select(e.target)),this},this.app.selectAll=function(){const e=this.app.getPlugin("selectorPlugin");return e&&e.selector?.selectAll(),this},this.app.triggerSelector=function(e){const i=this.app.getPlugin("selectorPlugin");return i&&i.selector?.triggerSelector(e),this},this.app.isSelected=function(e){const i=this.app.getPlugin("selectorPlugin");return i?i.selector?.isSelected(e)??!1:!1},this.keyFns.push(Qt.on({key:"a",title:"全部选中",exact:!0,ctrl:!0},()=>{const e=this.app?.isPluginEnable("selectorPlugin");this.app?.triggerSelector(!0),this.app?.selectAll(),this.app?.triggerSelector(e)})),this.keyFns.push(Qt.on({key:"g",title:"组合",ctrl:!0,shift:!0,exact:!0},()=>{})),this.app.emit("selectorInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.selector?.destroy(),this.app?.off("canvasCleared",this.onCanvasCleared),this.app?.emit("selectorDestroy",this)}enable(){this.selector&&(this.selector.triggerSelector(!0),this.options.enabled=!0)}disable(){this.selector&&(this.selector.cancelSelect(),this.selector.triggerSelector(!1),this.options.enabled=!1)}isEnabled(){return this.options.enabled&&(this.selector?.enabled??!1)}onCanvasCleared=()=>{this.selector?.cancelSelect()}}class fr{app;id=0;name;options;executed=!1;executeTime=new Date().getTime();constructor(t,e){this.app=t,this.name=this.constructor.name,this.options=e}toJSON(){return{id:this.id,name:this.name,options:this.options,executed:this.executed,executeTime:this.executeTime}}fromJSON(t){this.id=t.id,this.name=t.name,this.options=t.options,this.executed=t.executed,this.executeTime=t.executeTime}}class F6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._add(...this.options.nodes)}undo(){this.app._remove(...this.options.nodes)}}class N6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._remove(...this.options.nodes)}undo(){this.app._add(...this.options.nodes)}}class G6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._update(...this.options.newNodes)}undo(){this.app._update(...this.options.oldNodes)}}class U6 extends fr{constructor(t,e){super(t,e)}execute(){this.options.nodes.forEach(({node:t,newZIndex:e})=>{t.setZIndex(e)})}undo(){this.options.nodes.forEach(({node:t,oldZIndex:e})=>{t.setZIndex(e)})}}class B6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._makeGroup(this.options.nodes)}undo(){this.app._decomposeGroup(this.options.group)}}class z6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._decomposeGroup(this.options.group)}undo(){this.app._makeGroup(this.options.nodes)}}class p1{name="history";app;enabled;stackSize;undoStack=[];redoStack=[];idCounter=0;constructor(t,e){const{enabled:i,stackSize:r}=e;this.app=t,this.enabled=i,this.stackSize=r}execute(t,e){this.undoStack.length>this.stackSize&&this.undoStack.shift(),this.undoStack.push(t),t.id=++this.idCounter,e&&t.execute(),t.executed=!0,t.executeTime=new Date().getTime(),this.redoStack=[],this.app.emit("stackChanged",this.undoStack,this.redoStack)}undo(t=1){if(!this.enabled)return;let e;for(;t;)this.undoStack.length>0&&(e=this.undoStack.pop(),e&&(e.undo(),this.redoStack.push(e),this.app.emit("stackChanged",this.undoStack,this.redoStack))),--t;return this.app.emit("historyUndo",t,e?.toJSON()),e}redo(t=1){if(!this.enabled)return;let e;for(;t;)this.redoStack.length>0&&(e=this.redoStack.pop(),e&&(e.execute(),this.undoStack.push(e),this.app.emit("stackChanged",this.undoStack,this.redoStack))),--t;return this.app.emit("historyRedo",t,e?.toJSON()),e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}jump(t){if(!this.enabled)return;let e=this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0;if(e===void 0||t>e.id)for(e=this.redo();e!==void 0&&t>e.id;)e=this.redo();else for(;e=this.undoStack[this.undoStack.length-1],!(e===void 0||t===e.id);)this.undo();this.app.emit("stackChanged",this.undoStack,this.redoStack)}destroy(){this.undoStack=[],this.redoStack=[],this.app.emit("stackChanged",this.undoStack,this.redoStack)}}class $6{name="historyPlugin";history;app;options;keyFns=[];oldNodes=[];constructor(t){this.options={enabled:!0,stackSize:100,...t}}install(t){this.app=t,this.history=new p1(t,this.options),this.history.app=t,this.app.on("nodeAdded",this.onNodeAdded),this.app.on("nodeRemoved",this.onNodeRemove),this.app.on("nodeUpdateBefore",this.onNodeUpdateBefore),this.app.on("nodeZindexChanged",this.onNodeZIndexChanged),this.app.on("nodeGroupMake",this.onMakeGroup),this.app.on("nodeGroupDecompose",this.onDecomposeGroup),this.app.on("nodeUpdated",this.onNodeUpdated),this.app.undo=function(e=1){const i=this.app.getPlugin("historyPlugin");return i&&i.history?.undo(e),this},this.app.redo=function(e=1){const i=this.app.getPlugin("historyPlugin");return i&&i.history?.redo(e),this},this.app.canUndo=function(){const e=this.app.getPlugin("historyPlugin");return e?e.history?.canUndo()??!1:!1},this.app.canRedo=function(){const e=this.app.getPlugin("historyPlugin");return e?e.history?.canRedo()??!1:!1},this.app.jump=function(e){const i=this.app.getPlugin("historyPlugin");return i&&i.history?.jump(e),this},this.keyFns.push(Qt.on({key:"z",title:"撤销",exact:!0,ctrl:!0},()=>{this.app?.undo()})),this.keyFns.push(Qt.on({key:"y",title:"重做",exact:!0,ctrl:!0},()=>{this.app?.redo()})),this.app.emit("historyInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.history?.destroy(),this.app?.off("nodeAdded",this.onNodeAdded),this.app?.off("nodeRemoved",this.onNodeRemove),this.app?.off("nodeUpdateBefore",this.onNodeUpdateBefore),this.app?.off("nodeUpdated",this.onNodeUpdated),this.app?.off("nodeGroupMake",this.onMakeGroup),this.app?.off("nodeGroupDecompose",this.onDecomposeGroup),this.app?.emit("historyDestroy",this)}enable(){this.history&&(this.options.enabled=!0,this.history.enabled=!0)}disable(){this.history&&(this.options.enabled=!1,this.history.enabled=!1)}isEnabled(){return this.options.enabled&&(this.history?.enabled??!1)}onNodeAdded=t=>{!this.app||!this.history||this.history.execute(new F6(this.app,{nodes:t}))};onNodeRemove=t=>{!this.app||!this.history||this.history.execute(new N6(this.app,{nodes:t}))};onNodeUpdateBefore=t=>{this.oldNodes=t.map(e=>e.toObject())};onNodeUpdated=t=>{!this.app||!this.history||this.history.execute(new G6(this.app,{oldNodes:this.oldNodes,newNodes:t.map(e=>e.toObject())}))};onNodeZIndexChanged=t=>{!this.app||!this.history||this.history.execute(new U6(this.app,{nodes:t}))};onMakeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new B6(this.app,{nodes:e,group:t}))};onDecomposeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new z6(this.app,{nodes:e,group:t}))}}class V6{name="diamondTool";hooks;config;diamond=null;startPointer=new Wt({x:0,y:0});constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.diamond||(this.startPointer.clone(t.pointer),this.diamond=new Vt.RegularPolygon({sides:4,radius:0,strokeScaleEnabled:!1,...this.config}),this.diamond.setPosition(this.startPointer),t.add(this.diamond),this.hooks?.onStartDrawing?.(t,this.diamond))}mousemove({app:t}){if(!this.diamond)return;const e=t.pointer.x-this.startPointer.x,i=t.pointer.y-this.startPointer.y,r=new Wt({x:this.startPointer.x+e/2,y:this.startPointer.y+i/2});this.diamond.setPosition(r),this.diamond.radius(r.distanceTo(t.pointer)),t.render()}mouseup({app:t,pointer:e}){if(this.diamond){if(this.startPointer.eq(e)){this.diamond?.destroy(),this.diamond=null;return}this.hooks?.onCompleteDrawing?.(t,this.diamond),this.diamond=null,this.startPointer.setXY(0,0)}}enableChanged(){this.diamond=null,this.startPointer.setXY(0,0)}}class H6{name="drawingTool";config;hooks;line=null;points=[];constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){const e=this.points.at(-1);(!e||!e.eq(t.pointer))&&this.points.push(t.pointer),!this.line&&(this.line=new Vt.Line({points:ur(this.points),globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",strokeScaleEnabled:!1,hitStrokeWidth:20,...this.config}),t.add(this.line),this.hooks?.onStartDrawing?.(t,this.line))}mousemove({app:t,event:e}){this.line&&(e.evt.stopPropagation(),this.points.push(t.pointer),this.line.points(ur(this.points)))}mouseup({app:t,pointer:e}){if(!this.line)return;const i=this.points.at(-1);this.points.length<=6&&i&&e.distanceTo(i)<10&&this.line&&this.line.destroy(),this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[]}enableChanged(){this.line=null,this.points=[]}}class j6{name="ellipseTool";config;hooks;ellipse=null;startPointer=new Wt({x:0,y:0});constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.ellipse||(this.startPointer.clone(t.pointer),this.ellipse=new Vt.Ellipse({radiusX:0,radiusY:0,strokeScaleEnabled:!1,...this.config}),this.ellipse.setPosition(this.startPointer),this.ellipse.radius(new Wt({x:0,y:0})),t.add(this.ellipse))}mousemove({app:t}){if(!this.ellipse)return;const e=t.pointer.x-this.startPointer.x,i=t.pointer.y-this.startPointer.y,r=new Wt({x:Math.abs(e)/2,y:Math.abs(i)/2});this.ellipse.setPosition(new Wt({x:this.startPointer.x+e/2,y:this.startPointer.y+i/2})),this.ellipse.radius(r),t.render()}mouseup({app:t,pointer:e}){if(this.ellipse){if(this.startPointer.eq(e)){this.ellipse?.destroy(),this.ellipse=null;return}this.hooks?.onCompleteDrawing?.(t,this.ellipse),this.ellipse=null,this.startPointer.setXY(0,0)}}enableChanged(){this.ellipse=null,this.startPointer.setXY(0,0)}}class X6{name="imageTool";config;hooks;image=null;isAdded=!1;imageElement=new Image;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.image&&(this.image.opacity(1),this.hooks?.onCompleteDrawing?.(t,this.image),this.image=null)}mousemove({app:t,pointer:e}){if(this.isAdded||(this.image=new Vt.Image({strokeScaleEnabled:!1,image:this.imageElement,...this.config}),this.image.opacity(.5),this.image.image(this.imageElement),t.add(this.image),this.isAdded=!0),!this.image)return;const i=200,r=i*((this.imageElement.height??1)/(this.imageElement.width??1));this.image.width(i),this.image.height(r),this.image.position(new Wt({x:e.x-i/2,y:e.y-r/2})),t.render()}enableChanged(){this.image=null,this.imageElement=new Image}}class Y6{name="lineTool";config;hooks;points=[];line=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.line||(this.line=new Vt.Line({points:ur(this.points),fill:"transparent",strokeScaleEnabled:!1,hitStrokeWidth:20,...this.config}),t.add(this.line),this.hooks?.onStartDrawing?.(t,this.line));const e=this.points.at(-1);(!e||!e.eq(t.pointer))&&this.points.push(t.pointer),this.line.points(ur(this.points))}mousemove({app:t,pointer:e}){this.line&&(this.line.points(ur(this.points).concat(e.x,e.y)),t.render())}doubleClick({app:t}){this.line&&(this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[])}enableChanged(){this.line=null,this.points=[]}}class q6{name="rectTool";config;hooks;startPointer=new Wt({x:0,y:0});rectangle=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.rectangle||(this.startPointer.clone(t.pointer),this.rectangle=new Vt.Rect({strokeScaleEnabled:!1,...this.config}),this.rectangle.setPosition(this.startPointer),this.rectangle.width(0),this.rectangle.height(0),t.add(this.rectangle),this.hooks?.onStartDrawing?.(t,this.rectangle))}mousemove({app:t}){this.rectangle&&(this.rectangle.setPosition(new Wt({x:Math.min(this.startPointer.x,t.pointer.x),y:Math.min(this.startPointer.y,t.pointer.y)})),this.rectangle.width(Math.abs(t.pointer.x-this.startPointer.x)),this.rectangle.height(Math.abs(t.pointer.y-this.startPointer.y)),t.render())}mouseup({app:t,pointer:e}){if(this.rectangle){if(this.startPointer.eq(e)){this.rectangle?.destroy(),this.rectangle=null;return}this.hooks?.onCompleteDrawing?.(t,this.rectangle),this.rectangle=null,this.startPointer.setXY(0,0)}}enableChanged(){this.rectangle=null,this.startPointer.setXY(0,0)}}class W6{name="selectTool";hooks;constructor(t){this.hooks=t.hooks}}const K6=(n,t,e)=>{t.hide();const i=t.absolutePosition(),r={x:n.stage.container().offsetLeft+i.x,y:n.stage.container().offsetTop+i.y},s=document.createElement("textarea");document.body.appendChild(s),s.value=t.text(),s.style.position="absolute",s.style.top=r.y+"px",s.style.left=r.x+"px",s.style.width=t.width()*t.scaleX()-t.padding()*2+"px",s.style.height=t.height()*t.scaleX()-t.padding()*2+5+"px",s.style.fontSize=t.fontSize()*t.scaleX()+"px",s.style.border="none",s.style.padding="0px",s.style.margin="0px",s.style.overflow="hidden",s.style.background="none",s.style.outline="none",s.style.resize="none",s.style.lineHeight=t.lineHeight().toString(),s.style.fontFamily=t.fontFamily(),s.style.transformOrigin="left top",s.style.textAlign=t.align(),s.style.color=t.stroke(),s.style.caretColor=t.stroke();const a=t.rotation();let o="";a&&(o+="rotateZ("+a+"deg)");let h=0;navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&(h+=2+Math.round(t.fontSize()/20)),o+="translateY(-"+h+"px)",s.style.transform=o,s.style.height=s.scrollHeight+3+"px",s.focus();function c(){s.parentNode?.removeChild(s),window.removeEventListener("click",f),t.show()}function d(u){u=Math.max(s.value.length*t.fontSize(),u);const m=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),v=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;(m||v)&&(u=Math.ceil(u)),(document.DOCUMENT_NODE||/Edge/.test(navigator.userAgent))&&(u+=1),s.style.width=u+"px"}s.addEventListener("keydown",function(u){u.key==="Enter"&&!u.shiftKey&&(s.value.trim().length>=1?t.text(s.value.charAt(0)===" "?s.value.substring(1):s.value):n.remove(t),c(),e()),u.key==="Escape"&&c()}),s.addEventListener("keydown",function(){const u=t.getAbsoluteScale().x;d(t.width()*u),s.style.height="auto",s.style.height=s.scrollHeight+t.fontSize()+"px"});function f(u){u.target!==s&&(t.text(s.value),c())}setTimeout(()=>{window.addEventListener("click",f)})};class Z6{name="textTool";config;hooks;textNode=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}doubleClick({app:t,pointer:e}){this.textNode=new Vt.Text({...this.config,text:" ",x:e.x,y:e.y,fontFamily:"JiaYouYa"}),this.textNode.on("dblclick",({target:i})=>{K6(t,i,()=>{this.hooks?.onCompleteDrawing?.(t,i)})}),t.add(this.textNode),this.textNode.fire("dblclick")}enableChanged(){this.textNode=null}}class J6{name="eraserTool";hooks;targetMap=new Map;isEraser=!1;constructor(t){this.hooks=t.hooks}mousedown({event:t}){this.isEraser=!0,!(t.target instanceof Vt.Stage)&&(this.targetMap.set(t.target.id(),{node:t.target,opacity:t.target.attrs.opacity}),t.target.opacity(.3))}mouseup({app:t}){this.targetMap.size&&(t.remove(...[...this.targetMap.values()].map(({node:e,opacity:i})=>(e.opacity(i),e))),this.targetMap.clear(),this.isEraser=!1)}mousemove({event:t}){!this.isEraser||t.target instanceof Vt.Stage||this.targetMap.get(t.target.id())||(this.targetMap.set(t.target.id(),{node:t.target,opacity:t.target.attrs.opacity}),t.target.opacity(.3))}enableChanged(){this.targetMap.clear(),this.isEraser=!1}}const m1={backgroundColor:"#ffffff",scale:{min:.05,max:5},panning:{enabled:!1,cursor:"grabbing"},mousewheel:{enabled:!1,factor:.1}};class Q6 extends Zl{stage;mainLayer;config;mouse;tooler;installedPlugins=new Map;resizeObserver;constructor(t){super(),this.config={...m1,...t},this.stage=new Vt.Stage({container:document.createElement("div"),width:500,height:500}),this.stage.container().style.backgroundColor=this.config.backgroundColor,this.mainLayer=new Vt.Layer,this.mainLayer.name("main:layer"),this.stage.add(this.mainLayer),this.tooler=new M6(this),this.mouse=new A6(this),this.resizeObserver=new ResizeObserver(e=>{const{width:i,height:r}=e[0].contentRect;this.stage.width(i),this.stage.height(r),this.emit("resizeRoot",i,r),this.render()}),this.triggerPanning(this.config.panning.enabled),this.triggerMouseWheel(this.config.mousewheel.enabled),this.registerKeyFns()}registerKeyFns(){Qt.on({key:"o",title:"打开",exact:!0,ctrl:!0},()=>{ec().then(t=>ko(t[0])).then(t=>{this.fromJSON(t)})}),Qt.on({key:"e",title:"导出图片",exact:!0,ctrl:!0,shift:!0},()=>{}),Qt.on({key:"[",title:"下移一层",exact:!0,ctrl:!0},()=>{}),Qt.on({key:"]",title:"上移一层",exact:!0,ctrl:!0},()=>{}),Qt.on({key:"[",title:"置于底层",exact:!0,ctrl:!0,shift:!0},()=>{}),Qt.on({key:"]",title:"置于顶层",exact:!0,ctrl:!0,shift:!0},()=>{}),Qt.on({key:["delete","backspace"],title:"删除"},()=>{console.log("删除")}),Qt.on({key:"r",title:"重置画布",exact:!0,ctrl:!0},()=>{}),Qt.on({key:" ",title:"移动画布"},()=>(console.log("移动画布"),this.triggerPanning(!0),()=>{this.triggerPanning(!1)})),Qt.on({key:["Control","Meta"],title:"缩放画布"},()=>(this.triggerMouseWheel(!0),()=>{this.triggerMouseWheel(!1)})),Qt.on({key:"j",title:"解除组合",ctrl:!0,shift:!0,exact:!0},()=>{})}get pointer(){const{x:t,y:e}=this.stage.getRelativePointerPosition()??{x:0,y:0};return new Wt({x:t,y:e})}get curTool(){return this.tooler.currentTool}get containerElement(){return this.stage.container()}mount(t){this.stage.container(t),this.resizeObserver.observe(this.stage.container())}async setTool(t){await this.tooler.setTool(t)}triggerPanning(t){return t===void 0?this.stage.draggable(this.stage.draggable()):this.stage.draggable(t),this.stage.draggable()?this.stage.container().style.cursor=this.config.panning.cursor??"grabbing":this.stage.container().style.cursor="default",this}triggerMouseWheel(t){return t===void 0?this.config.mousewheel.enabled=!this.config.mousewheel.enabled:this.config.mousewheel.enabled=t,this}triggerTool(t){return this.tooler.trigger(t),this}add(...t){return this._add(...t),this.emit("nodeAdded",t),this}_add(...t){return this.mainLayer.add(...t.map(e=>(e.attrs.id||e.id(`#${R1()}`),e))),this.render(),this}remove(...t){return this._remove(...t),this.emit("nodeRemoved",t),this}_remove(...t){return t.forEach(e=>{e.remove()}),this.render(),this}update(...t){const e=i=>i.reduce((r,s)=>{const a=this.getNodeById(s.attrs.id);return a&&r.push(a),r},[]);return this.emit("nodeUpdateBefore",e(t)),this._update(...t),this.emit("nodeUpdated",e(t)),this}_update(...t){return t.forEach(e=>{this.getNodeById(e.attrs.id)?.setAttrs(e.attrs)}),this.render(),this}makeGroup(t){const e=this._makeGroup(t);return e instanceof Vt.Group&&this.emit("nodeGroupMake",e,t),e}_makeGroup(t){if(t.length<2)return t;const e=new Vt.Group({draggable:!0});return e.add(...t.map(i=>(i.draggable(!1),i))),this._add(e),e}decomposeGroup(t){const e=this._decomposeGroup(t);return this.emit("nodeGroupDecompose",t,e),e}_decomposeGroup(t){const e=t.getParent()??this.mainLayer,i=[...t.getChildren()].map(r=>{const{x:s,y:a,scaleX:o,scaleY:h,skewX:l,skewY:c,rotation:d}=r.getTransform().decompose();return r.moveTo(e),r.x(s),r.y(a),r.scaleX(o),r.scaleY(h),r.skewX(l),r.skewY(c),r.rotation(d),r});return this._remove(t),i}findTopGroup(t){return t.parent instanceof Vt.Group&&t.parent.parent instanceof Vt.Group?this.findTopGroup(t.parent):t.parent instanceof Vt.Group?t.parent:null}moveUp(...t){return this.moveZIndexNodes(t,e=>e.moveUp()),this}moveDown(...t){return this.moveZIndexNodes(t,e=>e.moveDown()),this}moveTop(...t){return this.moveZIndexNodes(t,e=>e.moveToTop()),this}moveBottom(...t){return t.forEach(e=>e.moveToBottom()),this.moveZIndexNodes(t,e=>e.moveToBottom()),this}moveZIndexNodes(t,e){const i=t.map(r=>{const s={node:r,oldZIndex:r.getZIndex(),newZIndex:r.getZIndex()};return e(r),s.newZIndex=r.getZIndex(),s});i.some(({oldZIndex:r,newZIndex:s})=>r!==s)&&this.emit("nodeZindexChanged",i)}getNodeById(t){return this.getNodes(e=>e.id()===t)?.[0]}getNodes(t){return this.mainLayer.find(t)??[]}isPointInArea(t,e){const{width:i,height:r,x:s,y:a}=e;return t.x>=s&&t.x<=s+i&&t.y>=a&&t.y<=a+r}getShapesInArea(t){return this.mainLayer.getChildren(e=>e.visible()&&e!==t&&this.haveIntersection(t,e))}haveIntersection(t,e){const i=t.getClientRect({relativeTo:this.stage}),r=e.getClientRect({relativeTo:this.stage}),s=i.x<=r.x&&i.y<=r.y,a=i.x+i.width>=r.x+r.width&&i.y<=r.y,o=i.x<=r.x&&i.y+i.height>=r.y+r.height,h=i.x+i.width>=r.x+r.width&&i.y+i.height>=r.y+r.height;return s&&a&&o&&h}render(){this.mainLayer.draw()}scale(){return this.stage.scaleX()}scaleTo(t,e=new Wt({x:0,y:0})){const i=this.scale();this.emit("canvasZoomStart",i);const r=Math.min(Math.max(t,this.config.scale.min),this.config.scale.max),s=new Wt({x:(e.x-this.stage.x())/i,y:(e.y-this.stage.y())/i});return this.stage.scale({x:r,y:r}),this.stage.position({x:e.x-s.x*r,y:e.y-s.y*r}),this.emit("canvasZoomEnd",this.scale()),this}clear(){this.mainLayer.removeChildren(),this.emit("canvasCleared"),this.render()}async toDataURL(t,e){const{padding:i=10,pixelRatio:r=2,mimeType:s="image/png",quality:a=1,haveBackground:o=!1}=e??{},h=new Vt.Layer;this.stage.add(h);let l=[];t&&t.length>0?l=t.map(R=>R.toObject()):l=this.mainLayer.children?.map(R=>R.toObject())??[];const c=l.map(R=>Vt.Node.create(R));h.add(...c);const d=new Vt.Transformer({rotateAnchorOffset:0});d.nodes(c);const f=d.getClientRect(),u=this.stage.scaleX(),m=this.stage.scaleY(),v=this.stage.x(),b=this.stage.y(),S=f.width+i*2,E=f.height+i*2,_=f.x-i,x=f.y-i,P=new Vt.Rect({width:S,height:E,x:(_-v)/u,y:(x-b)/m,fill:this.stage.container().style.backgroundColor});return o&&(h.add(P),P.moveToBottom()),new Promise((R,F)=>{try{h.toDataURL({width:S,height:E,x:_,y:x,pixelRatio:r,mimeType:s,quality:a,callback:L=>{R({dataURL:L,width:S,height:E}),d.remove(),h.remove()}})}catch(L){F(L)}})}toJSON(){return JSON.stringify(this.mainLayer.toObject())}fromJSON(t){this.clear(),this.mainLayer.remove();const e=Vt.Node.create(t,"layer");return this.mainLayer=e,this.stage.add(this.mainLayer),this.render(),this}use(t,...e){return this.installedPlugins.has(t.name)||(this.installedPlugins.set(t.name,t),t.install(this,...e)),this}getPlugin(t){return this.installedPlugins.get(t)}getPlugins(t){return t.map(e=>this.getPlugin(e))}enablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.enable?.()),this}disablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.disable?.()),this}isPluginEnable(t){return this.getPlugin(t)?.isEnabled?.()??!1}destroyPlugins(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.destroy()),this}destroy(){this.resizeObserver.disconnect(),this.destroyPlugins(Array.from(this.installedPlugins.keys())),this.mouse.destroy(),this.tooler.destroy(),this.stage.destroy(),this.removeAllListeners()}}const v1=[],_1={};function Ml(n){v1.push(n)}function t8(n,t=!1){const e=Yc();if(_1[e])return;wx.error(s=>{console.log(s.errMsg??JSON.stringify(s))}),wx.ready(()=>{v1.forEach(s=>s())});const i=["updateAppMessageShareData","updateTimelineShareData","onMenuShareWeibo","onMenuShareQZone","startRecord","stopRecord","onVoiceRecordEnd","playVoice","pauseVoice","stopVoice","onVoicePlayEnd","uploadVoice","downloadVoice","chooseImage","previewImage","uploadImage","downloadImage","getLocalImgData","translateVoice","getNetworkType","openLocation","getLocation","hideOptionMenu","showOptionMenu","hideMenuItems","showMenuItems","hideAllNonBaseMenuItem","showAllNonBaseMenuItem","closeWindow","scanQRCode","openProductSpecificView","addCard","chooseCard","openCard"],r=["wx-open-launch-app","wx-open-launch-app","wx-open-subscribe","wx-open-audio"];wx.config(Object.assign(n,{debug:t,jsApiList:i,openTagList:r})),_1[e]=!0}function e8(n){return new Promise((t,e)=>{wx.checkJsApi({jsApiList:[n],success:function(i){i.checkResult[n]?t(!0):e(!1)},fail:function(){e(!1)}})})}function i8(n){Ml(function(){wx.updateAppMessageShareData(n)})}function n8(n){Ml(function(){wx.updateTimelineShareData(n)})}function r8(n){wx.chooseImage(n)}function s8(n){wx.previewImage(n)}function a8(n){wx.uploadImage(n)}function o8(n){wx.downloadImage(n)}function h8(n){wx.getLocalImgData(n)}function l8(){wx.startRecord()}function c8(n){wx.stopRecord(n)}function u8(n){wx.onVoiceRecordEnd(n)}function f8(n){wx.playVoice(n)}function d8(n){wx.pauseVoice(n)}function g8(n){wx.stopVoice(n)}function p8(n){wx.onVoicePlayEnd(n)}function m8(n){wx.uploadVoice(n)}function v8(n){wx.downloadVoice(n)}function _8(n){wx.translateVoice(n)}function y8(n){wx.getNetworkType(n)}function w8(n){wx.openLocation(n)}function b8(n){wx.getLocation(n)}function x8(n){wx.scanQRCode(n)}function S8(n,t,e){function i(){WeixinJSBridge.invoke("getBrandWCPayRequest",n,function(r){r.err_msg=="get_brand_wcpay_request:ok"?t():e(r.err_msg)})}typeof WeixinJSBridge>"u"?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",i,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",i),document.attachEvent("onWeixinJSBridgeReady",i)):i()}function C8(n){window.AlipayJSBridge?n&&n():document.addEventListener("AlipayJSBridgeReady",n,!1)}function Qs(n,t){let e="未知错误";switch(n.error){case 1:e="接口不存在";break;case 2:e="参数无效";break;case 3:e="发生未知错误";break;case 4:e="接口无权限";break;case 10:e="用户取消";break;case 11:e="操作失败",t==="chooseImage"&&(e="操作失败(权限不够)");break;case 12:e="GPS打开,但定位失败";break;case 13:e="获取地理位置信息失败";break;case 14:e="定位超时";break;case 15:e="网络错误";break;case 16:e="GPS未打开或用户未授权";break}return`${n.error}(${e}): ${n.errorMessage}`}function T8(n,t,e){ap.tradePay(Object.assign(n,{}),function(i){let r="未知错误";switch(i.resultCode){case 9e3:return r="订单支付成功",t?.(r);case 8e3:r="正在处理中";break;case 4e3:r="订单支付失败";break;case 6001:r="用户中途取消";break;case 6002:r="网络连接出错";break;case 99:r="用户点击忘记密码导致快捷界面退出(only iOS)";break}e?.(r)})}function k8(n,t,e){ap.scan(Object.assign(n,{fail:i=>{e?.(Qs(i))}}),function(i){t?.(i.code)})}function E8(n,t,e){ap.getLocation(Object.assign(n,{fail:i=>{e?.(Qs(i))}}),function(i){t?.(i)})}function P8(n,t,e){ap.openLocation(Object.assign(n,{fail:i=>{e?.(Qs(i))}}),function(){t?.()})}function A8(n,t,e){ap.chooseImage(Object.assign(n,{fail:i=>{e?.(Qs(i,"chooseImage"))}}),function(i){t?.(i)})}function M8(n,t,e){ap.previewImage(Object.assign(n,{fail:i=>{e?.(Qs(i))}}),function(){t?.()})}class R8{map;constructor(t,e=120.619585,i=31.299379,r=18){this.map=new T.Map(t),this.map.centerAndZoom(new T.LngLat(e,i),r)}}V.AlignmentPlugin=L6,V.AnimateOperation=G_,V.CanvasOperation=Wo,V.CustomCanvasContext=Lr,V.CustomCanvasGradient=_a,V.CustomCanvasPattern=jo,V.DEFAULT_APP_CONFIG=m1,V.DOMCanvas=hp,V.DOMEvent=Eg,V.DOMKey=Qt,V.DOMMedia=kg,V.DOMMouse=Pr,V.DOMQuery=oe,V.DOMScroll=Pg,V.DOMToBlob=tc,V.DOMToString=Ql,V.DOMUtil=It,V.Dep=Pf,V.DiamondTool=V6,V.DrawingTool=H6,V.EllipseTool=j6,V.EraserTool=J6,V.HSVToRGBObject=pp,V.History=p1,V.HistoryPlugin=$6,V.ImageTool=X6,V.KonvaApp=Q6,V.LineTool=Y6,V.Matrix=we,V.Matrix3D=pn,V.PathGroup=mn,V.Point=Wt,V.Polygon=Ir,V.QRCode=Ki,V.RGBStringToHexString=dp,V.RGBToHSVObject=mp,V.Rect=jn,V.RectTool=q6,V.SVGOperation=Vi,V.SelectTool=W6,V.Selector=g1,V.SelectorPlugin=O6,V.ShapeArmyAnts=O_,V.ShapeArrow=x_,V.ShapeBall=S_,V.ShapeLight=Mf,V.ShapeLine=C_,V.ShapePoint3d=P_,V.ShapeRect=T_,V.ShapeSegment=D_,V.ShapeShip=k_,V.ShapeSlider=R_,V.ShapeSmileFace=F_,V.ShapeSpirograph=L_,V.ShapeStar=I_,V.ShapeTree=E_,V.ShapeTriangle=A_,V.ShapeTriangleLight=M_,V.TWEEN=b_,V.TextTool=Z6,V.Vector=ua,V.VideoUtil=rs,V.WebGLRenderer=B_,V.WebRTCClient=U_,V.WebSocketClient=W1,V.YZRaphael=qo,V.absolutize=da,V.addWatermark=e_,V.addWxJsReadyFnBeforeConfig=Ml,V.ajax=l_,V.aliJsChooseImage=A8,V.aliJsGetLocation=E8,V.aliJsOpenLocation=P8,V.aliJsPreviewImage=M8,V.aliJsReady=C8,V.aliJsScan=k8,V.aliJsTradePay=T8,V.angle=Io,V.animateInWeb=Ko,V.appendURLSearchString=wa,V.base64URLDecode=_p,V.base64URLEncode=vp,V.blobToRawImage=Ev,V.canDrawBitmap=_g,V.canUsePaths=vg,V.canUseWorker=pc,V.changeBrightness=Qv,V.changeDiaphaneity=t_,V.changeSize=Jv,V.checkWxJsApi=e8,V.clearCookies=Tg,V.colorNumberToHexString=Hc,V.colorNumberToRGBString=jc,V.compression=n_,V.createXMLHttpRequest=Lh,V.debugObject=wg,V.debugObjectProperty=yg,V.distance=mc,V.dquery=Do,V.drawQRCodeToCanvas=o_,V.fileOrBlobToDataURL=Rh,V.fileToArrayBufferPromise=ic,V.flatPoints=ur,V.flipSideToSide=Av,V.flipUpsideDown=Mv,V.formDataToSearchString=Qo,V.getBrowserClient=Ao,V.getBrowserClientVersion=rg,V.getBrowserLanguage=ag,V.getCookie=Sg,V.getCookieObject=Cg,V.getDirection=vc,V.getDocumentElement=Eo,V.getElementLeftInPage=oc,V.getElementPositionInPage=ac,V.getElementPositionInPage2=Q1,V.getElementPositionInViewport=tg,V.getElementTopInPage=hc,V.getFileExtensionFromFile=nc,V.getFileTypeFromFile=H1,V.getFilesImageInfo=bv,V.getFormSubmitData=h_,V.getGlobal=Po,V.getGroupCoords=P6,V.getImageDataByAIData=r_,V.getImageDataFromBitmap=Sv,V.getImageDataFromUrl=yf,V.getImageDataFromVideo=xv,V.getImageMainColor=Pv,V.getInternetExplorerVersion=uc,V.getMiddleValue=E6,V.getMousePositionInElement=ze,V.getMousePositionInPage=lc,V.getMousePositionInViewport=ig,V.getOperatingSystem=ha,V.getOperatingSystemVersion=ng,V.getPageClient=aa,V.getPageScroll=Hn,V.getPageSize=K1,V.getPointAtLength=Lc,V.getRaphael=sp,V.getRawImageInfo=Mh,V.getRelativeBoundingClientRect=eg,V.getScrollParent=V_,V.getTimeZone=og,V.getTotalLength=Dc,V.getURL=Jo,V.getUserGeolocationPromise=sg,V.getViewportSize=oa,V.getWorker=kp,V.gifImage=xf,V.h=q1,V.handleDragAndDropFiles=X1,V.handleInputFiles=j1,V.hasDocument=gg,V.hasHistory=pg,V.hasWindow=gc,V.hexStringToColorNumber=ya,V.hexStringToRGBString=Zo,V.ifWebFileHasChanged=c_,V.imageDataToBitmap=Cv,V.imageDataToBlob=kv,V.imageDataToDataURL=Tv,V.injectWxJsConfig=t8,V.isAliBrowser=dc,V.isAliMiniProgram=fg,V.isAndroid=cc,V.isAppleDevice=hg,V.isBrowserSupportFileAPI=mg,V.isDarkMode=cg,V.isElementInViewport=J1,V.isElementInViewportSimple=Z1,V.isIE=dg,V.isIOS=Mo,V.isMacOS=Ro,V.isMobile=lg,V.isPointInPath=Ic,V.isPointInStroke=Oc,V.isSvgPath=xc,V.isURL=yp,V.isWxBrowser=fc,V.isWxMiniProgram=ug,V.jpgToPng=qv,V.leftRotate=Rv,V.linkExport=To,V.localstorage=Fo,V.mapTDTJSSDK=R8,V.marginSharpen=Yv,V.microTask=Y1,V.mosaic=i_,V.mount=kr,V.norm=ca,V.normalize=ga,V.normalizePoint=Oo,V.onHashChange=Cp,V.onHistoryChange=Tp,V.onURLChange=Sp,V.outputGifBase64=Sf,V.outputQRCodeBase64=a_,V.parse=fa,V.parseTransformToMatrix=Ar,V.parseURL=Xc,V.patch=rc,V.patchDOM=sc,V.pngToJpg=Wv,V.qrDecompose=u1,V.radiusClip=Zv,V.randomColorHexString=up,V.randomColorHexString2=fp,V.randomColorNumber=cp,V.rappar=Uc,V.reactiveVue2=f_,V.reactiveVue3=d_,V.readFileInBrowser=ko,V.recordToSearchString=qc,V.recordToSearchString2=xp,V.rectClip=Kv,V.relative=Ng,V.rightRotate=Dv,V.searchStringToRecord=wp,V.searchStringToRecord2=bp,V.selectFileInBrowser=ec,V.setCookie=xg,V.setRem=bg,V.shadeColor=gp,V.shapeArrayEqual=c1,V.sharpen=Xv,V.stringToBlob=Co,V.stringToDOM=V1,V.theme=lp,V.toBlackAndWhite=Ov,V.toBlue=Uv,V.toBlueAndGreen=$v,V.toBlueAndGrey=jv,V.toDegree=Lo,V.toGreen=Gv,V.toGreenAndGrey=Hv,V.toGrey=Lv,V.toGrey2=Iv,V.toOpposite=Fv,V.toRadian=la,V.toRed=Nv,V.toRedAndBlue=zv,V.toRedAndGreen=Bv,V.toRedAndGrey=Vv,V.trimURLHash=Yc,V.watchEffect=u_,V.wxJsChooseImage=r8,V.wxJsDownloadImage=o8,V.wxJsDownloadVoice=v8,V.wxJsGetLocalImgData=h8,V.wxJsGetLocation=b8,V.wxJsGetNetworkType=y8,V.wxJsOnVoicePlayEnd=p8,V.wxJsOnVoiceRecordEnd=u8,V.wxJsOpenLocation=w8,V.wxJsPauseVoice=d8,V.wxJsPay=S8,V.wxJsPlayVoice=f8,V.wxJsPreviewImage=s8,V.wxJsScanQRCode=x8,V.wxJsStartRecord=l8,V.wxJsStopRecord=c8,V.wxJsStopVoice=g8,V.wxJsTranslateVoice=_8,V.wxJsUpdateAppMessageShareData=i8,V.wxJsUpdateTimelineShareData=n8,V.wxJsUploadImage=a8,V.wxJsUploadVoice=m8,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
|
|
43
|
+
${t.sdp}.`),this.remotePeerConnection&&(this.trace("remotePeerConnection setLocalDescription start."),this.remotePeerConnection.setLocalDescription(t).then(()=>{this.setLocalDescriptionSuccess(this.remotePeerConnection)}).catch(e=>this.setSessionDescriptionError(e))),this.localPeerConnection&&(this.trace("localPeerConnection setRemoteDescription start."),this.localPeerConnection.setRemoteDescription(t).then(()=>{this.setRemoteDescriptionSuccess(this.localPeerConnection)}).catch(e=>this.setSessionDescriptionError(e)))}setSessionDescriptionError(t){this.trace(`Failed to create session description: ${t.toString()}.`)}setDescriptionSuccess(t,e){const i=this.getPeerName(t);this.trace(`${i} ${e} complete.`)}setLocalDescriptionSuccess(t){this.setDescriptionSuccess(t,"setLocalDescription")}setRemoteDescriptionSuccess(t){this.setDescriptionSuccess(t,"setRemoteDescription")}trace(t){t=t.trim();const e=(window.performance.now()/1e3).toFixed(3);console.log(e,t);const i=document.createElement("div");i.innerHTML=`<div>${e}, ${t}</div>`,document.getElementById("trace")?.appendChild(i)}getOtherPeer(t){return t===this.localPeerConnection?this.remotePeerConnection:this.localPeerConnection}getPeerName(t){return t===this.localPeerConnection?"localPeerConnection":"remotePeerConnection"}}class B_{canvas;gl;constructor(t){this.canvas=t;const e={alpha:!0,premultipliedAlpha:!1};if(this.gl=this.canvas.getContext("webgl",e),!this.gl)throw new Error("WebGL failed to initialize.")}}function Df(n,t){return!n||n.parentElement===null?t:Df(n.parentElement,t.concat([n]))}const Nh=function(n,t){return getComputedStyle(n,null).getPropertyValue(t)},z_=function(n){return Nh(n,"overflow")+Nh(n,"overflow-y")+Nh(n,"overflow-x")},$_=function(n){return/(auto|scroll)/.test(z_(n))};function V_(n){if(!(n instanceof HTMLElement||n instanceof SVGElement))return;const t=Df(n.parentElement,[]);for(let e=0;e<t.length;e+=1)if($_(t[e]))return t[e];return document.scrollingElement||document.documentElement}var Gh={exports:{}},ss={},Uh={},Bh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n._registerNode=n.Konva=n.glob=void 0;const t=Math.PI/180;function e(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}n.glob=typeof xo<"u"?xo:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},n.Konva={_global:n.glob,version:"9.2.2",isBrowser:e(),isUnminified:/param/.test(function(r){}.toString()),dblClickWindow:400,getAngle(r){return n.Konva.angleDeg?r*t:r},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return n.Konva.DD.isDragging},isDragReady(){return!!n.Konva.DD.node},releaseCanvasOnDestroy:!0,document:n.glob.document,_injectGlobal(r){n.glob.Konva=r}};const i=r=>{n.Konva[r.prototype.getClassName()]=r};n._registerNode=i,n.Konva._injectGlobal(n.Konva)})(Bh);const Nt=St(xt({__proto__:null,default:Pe(Bh)},[Bh]));var zh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Util=n.Transform=void 0;const t=Nt;class e{constructor(x=[1,0,0,1,0,0]){this.dirty=!1,this.m=x&&x.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new e(this.m)}copyInto(x){x.m[0]=this.m[0],x.m[1]=this.m[1],x.m[2]=this.m[2],x.m[3]=this.m[3],x.m[4]=this.m[4],x.m[5]=this.m[5]}point(x){var P=this.m;return{x:P[0]*x.x+P[2]*x.y+P[4],y:P[1]*x.x+P[3]*x.y+P[5]}}translate(x,P){return this.m[4]+=this.m[0]*x+this.m[2]*P,this.m[5]+=this.m[1]*x+this.m[3]*P,this}scale(x,P){return this.m[0]*=x,this.m[1]*=x,this.m[2]*=P,this.m[3]*=P,this}rotate(x){var P=Math.cos(x),R=Math.sin(x),O=this.m[0]*P+this.m[2]*R,L=this.m[1]*P+this.m[3]*R,$=this.m[0]*-R+this.m[2]*P,U=this.m[1]*-R+this.m[3]*P;return this.m[0]=O,this.m[1]=L,this.m[2]=$,this.m[3]=U,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(x,P){var R=this.m[0]+this.m[2]*P,O=this.m[1]+this.m[3]*P,L=this.m[2]+this.m[0]*x,$=this.m[3]+this.m[1]*x;return this.m[0]=R,this.m[1]=O,this.m[2]=L,this.m[3]=$,this}multiply(x){var P=this.m[0]*x.m[0]+this.m[2]*x.m[1],R=this.m[1]*x.m[0]+this.m[3]*x.m[1],O=this.m[0]*x.m[2]+this.m[2]*x.m[3],L=this.m[1]*x.m[2]+this.m[3]*x.m[3],$=this.m[0]*x.m[4]+this.m[2]*x.m[5]+this.m[4],U=this.m[1]*x.m[4]+this.m[3]*x.m[5]+this.m[5];return this.m[0]=P,this.m[1]=R,this.m[2]=O,this.m[3]=L,this.m[4]=$,this.m[5]=U,this}invert(){var x=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),P=this.m[3]*x,R=-this.m[1]*x,O=-this.m[2]*x,L=this.m[0]*x,$=x*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),U=x*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=P,this.m[1]=R,this.m[2]=O,this.m[3]=L,this.m[4]=$,this.m[5]=U,this}getMatrix(){return this.m}decompose(){var x=this.m[0],P=this.m[1],R=this.m[2],O=this.m[3],L=this.m[4],$=this.m[5],U=x*O-P*R;let z={x:L,y:$,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(x!=0||P!=0){var q=Math.sqrt(x*x+P*P);z.rotation=P>0?Math.acos(x/q):-Math.acos(x/q),z.scaleX=q,z.scaleY=U/q,z.skewX=(x*R+P*O)/U,z.skewY=0}else if(R!=0||O!=0){var K=Math.sqrt(R*R+O*O);z.rotation=Math.PI/2-(O>0?Math.acos(-R/K):-Math.acos(R/K)),z.scaleX=U/K,z.scaleY=K,z.skewX=0,z.skewY=(x*R+P*O)/U}return z.rotation=n.Util._getRotation(z.rotation),z}}n.Transform=e;var i="[object Array]",r="[object Number]",s="[object String]",a="[object Boolean]",o=Math.PI/180,h=180/Math.PI,l="#",c="",d="0",f="Konva warning: ",u="Konva error: ",m="rgb(",v={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,132,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,255,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],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],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,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],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:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],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,5]},b=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,S=[];const E=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(_){setTimeout(_,60)};n.Util={_isElement(_){return!!(_&&_.nodeType==1)},_isFunction(_){return!!(_&&_.constructor&&_.call&&_.apply)},_isPlainObject(_){return!!_&&_.constructor===Object},_isArray(_){return Object.prototype.toString.call(_)===i},_isNumber(_){return Object.prototype.toString.call(_)===r&&!isNaN(_)&&isFinite(_)},_isString(_){return Object.prototype.toString.call(_)===s},_isBoolean(_){return Object.prototype.toString.call(_)===a},isObject(_){return _ instanceof Object},isValidSelector(_){if(typeof _!="string")return!1;var x=_[0];return x==="#"||x==="."||x===x.toUpperCase()},_sign(_){return _===0||_>0?1:-1},requestAnimFrame(_){S.push(_),S.length===1&&E(function(){const x=S;S=[],x.forEach(function(P){P()})})},createCanvasElement(){var _=document.createElement("canvas");try{_.style=_.style||{}}catch{}return _},createImageElement(){return document.createElement("img")},_isInDocument(_){for(;_=_.parentNode;)if(_==document)return!0;return!1},_urlToImage(_,x){var P=n.Util.createImageElement();P.onload=function(){x(P)},P.src=_},_rgbToHex(_,x,P){return((1<<24)+(_<<16)+(x<<8)+P).toString(16).slice(1)},_hexToRgb(_){_=_.replace(l,c);var x=parseInt(_,16);return{r:x>>16&255,g:x>>8&255,b:x&255}},getRandomColor(){for(var _=(Math.random()*16777215<<0).toString(16);_.length<6;)_=d+_;return l+_},getRGB(_){var x;return _ in v?(x=v[_],{r:x[0],g:x[1],b:x[2]}):_[0]===l?this._hexToRgb(_.substring(1)):_.substr(0,4)===m?(x=b.exec(_.replace(/ /g,"")),{r:parseInt(x[1],10),g:parseInt(x[2],10),b:parseInt(x[3],10)}):{r:0,g:0,b:0}},colorToRGBA(_){return _=_||"black",n.Util._namedColorToRBA(_)||n.Util._hex3ColorToRGBA(_)||n.Util._hex4ColorToRGBA(_)||n.Util._hex6ColorToRGBA(_)||n.Util._hex8ColorToRGBA(_)||n.Util._rgbColorToRGBA(_)||n.Util._rgbaColorToRGBA(_)||n.Util._hslColorToRGBA(_)},_namedColorToRBA(_){var x=v[_.toLowerCase()];return x?{r:x[0],g:x[1],b:x[2],a:1}:null},_rgbColorToRGBA(_){if(_.indexOf("rgb(")===0){_=_.match(/rgb\(([^)]+)\)/)[1];var x=_.split(/ *, */).map(Number);return{r:x[0],g:x[1],b:x[2],a:1}}},_rgbaColorToRGBA(_){if(_.indexOf("rgba(")===0){_=_.match(/rgba\(([^)]+)\)/)[1];var x=_.split(/ *, */).map((P,R)=>P.slice(-1)==="%"?R===3?parseInt(P)/100:parseInt(P)/100*255:Number(P));return{r:x[0],g:x[1],b:x[2],a:x[3]}}},_hex8ColorToRGBA(_){if(_[0]==="#"&&_.length===9)return{r:parseInt(_.slice(1,3),16),g:parseInt(_.slice(3,5),16),b:parseInt(_.slice(5,7),16),a:parseInt(_.slice(7,9),16)/255}},_hex6ColorToRGBA(_){if(_[0]==="#"&&_.length===7)return{r:parseInt(_.slice(1,3),16),g:parseInt(_.slice(3,5),16),b:parseInt(_.slice(5,7),16),a:1}},_hex4ColorToRGBA(_){if(_[0]==="#"&&_.length===5)return{r:parseInt(_[1]+_[1],16),g:parseInt(_[2]+_[2],16),b:parseInt(_[3]+_[3],16),a:parseInt(_[4]+_[4],16)/255}},_hex3ColorToRGBA(_){if(_[0]==="#"&&_.length===4)return{r:parseInt(_[1]+_[1],16),g:parseInt(_[2]+_[2],16),b:parseInt(_[3]+_[3],16),a:1}},_hslColorToRGBA(_){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(_)){const[x,...P]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(_),R=Number(P[0])/360,O=Number(P[1])/100,L=Number(P[2])/100;let $,U,z;if(O===0)return z=L*255,{r:Math.round(z),g:Math.round(z),b:Math.round(z),a:1};L<.5?$=L*(1+O):$=L+O-L*O;const q=2*L-$,K=[0,0,0];for(let Z=0;Z<3;Z++)U=R+1/3*-(Z-1),U<0&&U++,U>1&&U--,6*U<1?z=q+($-q)*6*U:2*U<1?z=$:3*U<2?z=q+($-q)*(2/3-U)*6:z=q,K[Z]=z*255;return{r:Math.round(K[0]),g:Math.round(K[1]),b:Math.round(K[2]),a:1}}},haveIntersection(_,x){return!(x.x>_.x+_.width||x.x+x.width<_.x||x.y>_.y+_.height||x.y+x.height<_.y)},cloneObject(_){var x={};for(var P in _)this._isPlainObject(_[P])?x[P]=this.cloneObject(_[P]):this._isArray(_[P])?x[P]=this.cloneArray(_[P]):x[P]=_[P];return x},cloneArray(_){return _.slice(0)},degToRad(_){return _*o},radToDeg(_){return _*h},_degToRad(_){return n.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),n.Util.degToRad(_)},_radToDeg(_){return n.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),n.Util.radToDeg(_)},_getRotation(_){return t.Konva.angleDeg?n.Util.radToDeg(_):_},_capitalize(_){return _.charAt(0).toUpperCase()+_.slice(1)},throw(_){throw new Error(u+_)},error(_){console.error(u+_)},warn(_){t.Konva.showWarnings&&console.warn(f+_)},each(_,x){for(var P in _)x(P,_[P])},_inRange(_,x,P){return x<=_&&_<P},_getProjectionToSegment(_,x,P,R,O,L){var $,U,z,q=(_-P)*(_-P)+(x-R)*(x-R);if(q==0)$=_,U=x,z=(O-P)*(O-P)+(L-R)*(L-R);else{var K=((O-_)*(P-_)+(L-x)*(R-x))/q;K<0?($=_,U=x,z=(_-O)*(_-O)+(x-L)*(x-L)):K>1?($=P,U=R,z=(P-O)*(P-O)+(R-L)*(R-L)):($=_+K*(P-_),U=x+K*(R-x),z=($-O)*($-O)+(U-L)*(U-L))}return[$,U,z]},_getProjectionToLine(_,x,P){var R=n.Util.cloneObject(_),O=Number.MAX_VALUE;return x.forEach(function(L,$){if(!(!P&&$===x.length-1)){var U=x[($+1)%x.length],z=n.Util._getProjectionToSegment(L.x,L.y,U.x,U.y,_.x,_.y),q=z[0],K=z[1],Z=z[2];Z<O&&(R.x=q,R.y=K,O=Z)}}),R},_prepareArrayForTween(_,x,P){var R,O=[],L=[];if(_.length>x.length){var $=x;x=_,_=$}for(R=0;R<_.length;R+=2)O.push({x:_[R],y:_[R+1]});for(R=0;R<x.length;R+=2)L.push({x:x[R],y:x[R+1]});var U=[];return L.forEach(function(z){var q=n.Util._getProjectionToLine(z,O,P);U.push(q.x),U.push(q.y)}),U},_prepareToStringify(_){var x;_.visitedByCircularReferenceRemoval=!0;for(var P in _)if(_.hasOwnProperty(P)&&_[P]&&typeof _[P]=="object"){if(x=Object.getOwnPropertyDescriptor(_,P),_[P].visitedByCircularReferenceRemoval||n.Util._isElement(_[P]))if(x.configurable)delete _[P];else return null;else if(n.Util._prepareToStringify(_[P])===null)if(x.configurable)delete _[P];else return null}return delete _.visitedByCircularReferenceRemoval,_},_assign(_,x){for(var P in x)_[P]=x[P];return _},_getFirstPointerId(_){return _.touches?_.changedTouches[0].identifier:_.pointerId||999},releaseCanvas(..._){t.Konva.releaseCanvasOnDestroy&&_.forEach(x=>{x.width=0,x.height=0})},drawRoundedRectPath(_,x,P,R){let O=0,L=0,$=0,U=0;typeof R=="number"?O=L=$=U=Math.min(R,x/2,P/2):(O=Math.min(R[0]||0,x/2,P/2),L=Math.min(R[1]||0,x/2,P/2),U=Math.min(R[2]||0,x/2,P/2),$=Math.min(R[3]||0,x/2,P/2)),_.moveTo(O,0),_.lineTo(x-L,0),_.arc(x-L,L,L,Math.PI*3/2,0,!1),_.lineTo(x,P-U),_.arc(x-U,P-U,U,0,Math.PI/2,!1),_.lineTo($,P),_.arc($,P-$,$,Math.PI/2,Math.PI,!1),_.lineTo(0,O),_.arc(O,O,O,Math.PI,Math.PI*3/2,!1)}}})(zh);const re=St(xt({__proto__:null,default:Pe(zh)},[zh]));var as={},$h={},te={};Object.defineProperty(te,"__esModule",{value:!0});var Lf=te.getComponentValidator=Vf=te.getBooleanValidator=$f=te.getNumberArrayValidator=zf=te.getFunctionValidator=Bf=te.getStringOrGradientValidator=Uf=te.getStringValidator=Gf=te.getNumberOrAutoValidator=Nf=te.getNumberOrArrayOfNumbersValidator=Of=te.getNumberValidator=Ff=te.alphaComponent=If=te.RGBComponent=void 0;const xi=Nt,se=re;function Si(n){return se.Util._isString(n)?'"'+n+'"':Object.prototype.toString.call(n)==="[object Number]"||se.Util._isBoolean(n)?n:Object.prototype.toString.call(n)}function H_(n){return n>255?255:n<0?0:Math.round(n)}var If=te.RGBComponent=H_;function j_(n){return n>1?1:n<1e-4?1e-4:n}var Ff=te.alphaComponent=j_;function X_(){if(xi.Konva.isUnminified)return function(n,t){return se.Util._isNumber(n)||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),n}}var Of=te.getNumberValidator=X_;function Y_(n){if(xi.Konva.isUnminified)return function(t,e){let i=se.Util._isNumber(t),r=se.Util._isArray(t)&&t.length==n;return!i&&!r&&se.Util.warn(Si(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or Array<number>('+n+")"),t}}var Nf=te.getNumberOrArrayOfNumbersValidator=Y_;function q_(){if(xi.Konva.isUnminified)return function(n,t){var e=se.Util._isNumber(n),i=n==="auto";return e||i||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),n}}var Gf=te.getNumberOrAutoValidator=q_;function W_(){if(xi.Konva.isUnminified)return function(n,t){return se.Util._isString(n)||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),n}}var Uf=te.getStringValidator=W_;function K_(){if(xi.Konva.isUnminified)return function(n,t){const e=se.Util._isString(n),i=Object.prototype.toString.call(n)==="[object CanvasGradient]"||n&&n.addColorStop;return e||i||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),n}}var Bf=te.getStringOrGradientValidator=K_;function Z_(){if(xi.Konva.isUnminified)return function(n,t){return se.Util._isFunction(n)||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),n}}var zf=te.getFunctionValidator=Z_;function J_(){if(xi.Konva.isUnminified)return function(n,t){const e=Int8Array?Object.getPrototypeOf(Int8Array):null;return e&&n instanceof e||(se.Util._isArray(n)?n.forEach(function(i){se.Util._isNumber(i)||se.Util.warn('"'+t+'" attribute has non numeric element '+i+". Make sure that all elements are numbers.")}):se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),n}}var $f=te.getNumberArrayValidator=J_;function Q_(){if(xi.Konva.isUnminified)return function(n,t){var e=n===!0||n===!1;return e||se.Util.warn(Si(n)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),n}}var Vf=te.getBooleanValidator=Q_;function t5(n){if(xi.Konva.isUnminified)return function(t,e){return t==null||se.Util.isObject(t)||se.Util.warn(Si(t)+' is a not valid value for "'+e+'" attribute. The value should be an object with properties '+n),t}}Lf=te.getComponentValidator=t5;const Gt=St(xt({__proto__:null,get RGBComponent(){return If},get alphaComponent(){return Ff},default:te,get getBooleanValidator(){return Vf},get getComponentValidator(){return Lf},get getFunctionValidator(){return zf},get getNumberArrayValidator(){return $f},get getNumberOrArrayOfNumbersValidator(){return Nf},get getNumberOrAutoValidator(){return Gf},get getNumberValidator(){return Of},get getStringOrGradientValidator(){return Bf},get getStringValidator(){return Uf}},[te]));(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Factory=void 0;const t=re,e=Gt;var i="get",r="set";n.Factory={addGetterSetter(s,a,o,h,l){n.Factory.addGetter(s,a,o),n.Factory.addSetter(s,a,h,l),n.Factory.addOverloadedGetterSetter(s,a)},addGetter(s,a,o){var h=i+t.Util._capitalize(a);s.prototype[h]=s.prototype[h]||function(){var l=this.attrs[a];return l===void 0?o:l}},addSetter(s,a,o,h){var l=r+t.Util._capitalize(a);s.prototype[l]||n.Factory.overWriteSetter(s,a,o,h)},overWriteSetter(s,a,o,h){var l=r+t.Util._capitalize(a);s.prototype[l]=function(c){return o&&c!==void 0&&c!==null&&(c=o.call(this,c,a)),this._setAttr(a,c),h&&h.call(this),this}},addComponentsGetterSetter(s,a,o,h,l){var c=o.length,d=t.Util._capitalize,f=i+d(a),u=r+d(a),m,v;s.prototype[f]=function(){var S={};for(m=0;m<c;m++)v=o[m],S[v]=this.getAttr(a+d(v));return S};var b=(0,e.getComponentValidator)(o);s.prototype[u]=function(S){var E=this.attrs[a],_;h&&(S=h.call(this,S)),b&&b.call(this,S,a);for(_ in S)S.hasOwnProperty(_)&&this._setAttr(a+d(_),S[_]);return S||o.forEach(x=>{this._setAttr(a+d(x),void 0)}),this._fireChangeEvent(a,E,S),l&&l.call(this),this},n.Factory.addOverloadedGetterSetter(s,a)},addOverloadedGetterSetter(s,a){var o=t.Util._capitalize(a),h=r+o,l=i+o;s.prototype[a]=function(){return arguments.length?(this[h](arguments[0]),this):this[l]()}},addDeprecatedGetterSetter(s,a,o,h){t.Util.error("Adding deprecated "+a);var l=i+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";s.prototype[l]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?o:d},n.Factory.addSetter(s,a,h,function(){t.Util.error(c)}),n.Factory.addOverloadedGetterSetter(s,a)},backCompat(s,a){t.Util.each(a,function(o,h){var l=s.prototype[h],c=i+t.Util._capitalize(o),d=r+t.Util._capitalize(o);function f(){l.apply(this,arguments),t.Util.error('"'+o+'" method is deprecated and will be removed soon. Use ""'+h+'" instead.')}s.prototype[o]=f,s.prototype[c]=f,s.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})($h);const Ot=St(xt({__proto__:null,default:Pe($h)},[$h]));var Ci={},Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});var Hf=Ti.HitContext=Wf=Ti.SceneContext=qf=Ti.Context=void 0;const jf=re,e5=Nt;function i5(n){var t=[],e=n.length,i=jf.Util,r,s;for(r=0;r<e;r++)s=n[r],i._isNumber(s)?s=Math.round(s*1e3)/1e3:i._isString(s)||(s=s+""),t.push(s);return t}var Xf=",",n5="(",r5=")",s5="([",a5="])",o5=";",h5="()",l5="=",Yf=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],c5=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const u5=100;class Na{constructor(t){this.canvas=t,e5.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){var i=this.traceArr,r=i.length,s="",a,o,h,l;for(a=0;a<r;a++)o=i[a],h=o.method,h?(l=o.args,s+=h,t?s+=h5:jf.Util._isArray(l[0])?s+=s5+l.join(Xf)+a5:(e&&(l=l.map(c=>typeof c=="number"?Math.floor(c):c)),s+=n5+l.join(Xf)+r5)):(s+=o.property,t||(s+=l5+o.val)),s+=o5;return s}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr,i;e.push(t),i=e.length,i>=u5&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();e!==1&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,r,s,a){this._context.arc(t,e,i,r,s,a)}arcTo(t,e,i,r,s){this._context.arcTo(t,e,i,r,s)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,r,s,a){this._context.bezierCurveTo(t,e,i,r,s,a)}clearRect(t,e,i,r){this._context.clearRect(t,e,i,r)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var i=arguments;if(i.length===2)return this._context.createImageData(t,e);if(i.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,i,r){return this._context.createLinearGradient(t,e,i,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,r,s,a){return this._context.createRadialGradient(t,e,i,r,s,a)}drawImage(t,e,i,r,s,a,o,h,l){var c=arguments,d=this._context;c.length===3?d.drawImage(t,e,i):c.length===5?d.drawImage(t,e,i,r,s):c.length===9&&d.drawImage(t,e,i,r,s,a,o,h,l)}ellipse(t,e,i,r,s,a,o,h){this._context.ellipse(t,e,i,r,s,a,o,h)}isPointInPath(t,e,i,r){return i?this._context.isPointInPath(i,t,e,r):this._context.isPointInPath(t,e,r)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,i,r){this._context.fillRect(t,e,i,r)}strokeRect(t,e,i,r){this._context.strokeRect(t,e,i,r)}fillText(t,e,i,r){r?this._context.fillText(t,e,i,r):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,r){return this._context.getImageData(t,e,i,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,r){this._context.rect(t,e,i,r)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,r){this._context.quadraticCurveTo(t,e,i,r)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,r,s,a){this._context.setTransform(t,e,i,r,s,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,r){this._context.strokeText(t,e,i,r)}transform(t,e,i,r,s,a){this._context.transform(t,e,i,r,s,a)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t=this,e=Yf.length,i=this.setAttr,r,s,a=function(o){var h=t[o],l;t[o]=function(){return s=i5(Array.prototype.slice.call(arguments,0)),l=h.apply(t,arguments),t._trace({method:o,args:s}),l}};for(r=0;r<e;r++)a(Yf[r]);t.setAttr=function(){i.apply(t,arguments);var o=arguments[0],h=arguments[1];(o==="shadowOffsetX"||o==="shadowOffsetY"||o==="shadowBlur")&&(h=h/this.canvas.getPixelRatio()),t._trace({property:o,val:h})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;var i=!e||e==="source-over";i||this.setAttr("globalCompositeOperation",e)}}var qf=Ti.Context=Na;c5.forEach(function(n){Object.defineProperty(Na.prototype,n,{get(){return this._context[n]},set(t){this._context[n]=t}})});class f5 extends Na{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),i=t.getFillPriority();if(e&&i==="color"){this._fillColor(t);return}const r=t.getFillPatternImage();if(r&&i==="pattern"){this._fillPattern(t);return}const s=t.getFillLinearGradientColorStops();if(s&&i==="linear-gradient"){this._fillLinearGradient(t);return}const a=t.getFillRadialGradientColorStops();if(a&&i==="radial-gradient"){this._fillRadialGradient(t);return}e?this._fillColor(t):r?this._fillPattern(t):s?this._fillLinearGradient(t):a&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(e.x,e.y,i.x,i.y);if(r){for(var a=0;a<r.length;a+=2)s.addColorStop(r[a],r[a+1]);this.setAttr("strokeStyle",s)}}_stroke(t){var e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var s=t.getStrokeLinearGradientColorStops();s?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}}_applyShadow(t){var e,i,r,s=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",a=(i=t.getShadowBlur())!==null&&i!==void 0?i:5,o=(r=t.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},h=t.getAbsoluteScale(),l=this.canvas.getPixelRatio(),c=h.x*l,d=h.y*l;this.setAttr("shadowColor",s),this.setAttr("shadowBlur",a*Math.min(Math.abs(c),Math.abs(d))),this.setAttr("shadowOffsetX",o.x*c),this.setAttr("shadowOffsetY",o.y*d)}}var Wf=Ti.SceneContext=f5;class d5 extends Na{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const s=t.getStrokeScaleEnabled();if(!s){this.save();var e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(t);var i=t.hitStrokeWidth(),r=i==="auto"?t.strokeWidth():i;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),s||this.restore()}}}Hf=Ti.HitContext=d5;const Kf=St(xt({__proto__:null,get Context(){return qf},get HitContext(){return Hf},get SceneContext(){return Wf},default:Ti},[Ti]));Object.defineProperty(Ci,"__esModule",{value:!0});var Zf=Ci.HitCanvas=ed=Ci.SceneCanvas=td=Ci.Canvas=void 0;const Ga=re,Jf=Kf,Qf=Nt,g5=Ot,p5=Gt;var Ua;function m5(){if(Ua)return Ua;var n=Ga.Util.createCanvasElement(),t=n.getContext("2d");return Ua=function(){var e=Qf.Konva._global.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/i}(),Ga.Util.releaseCanvas(n),Ua}class Ba{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=t||{},i=e.pixelRatio||Qf.Konva.pixelRatio||m5();this.pixelRatio=i,this._canvas=Ga.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio,i=this.getContext()._context;i.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio,i=this.getContext()._context;i.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch{try{return this._canvas.toDataURL()}catch(r){return Ga.Util.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}var td=Ci.Canvas=Ba;g5.Factory.addGetterSetter(Ba,"pixelRatio",void 0,(0,p5.getNumberValidator)());class v5 extends Ba{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new Jf.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}var ed=Ci.SceneCanvas=v5;class _5 extends Ba{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new Jf.HitContext(this),this.setSize(t.width,t.height)}}Zf=Ci.HitCanvas=_5;const za=St(xt({__proto__:null,get Canvas(){return td},get HitCanvas(){return Zf},get SceneCanvas(){return ed},default:Ci},[Ci]));var Vh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.DD=void 0;const t=Nt,e=re;n.DD={get isDragging(){var i=!1;return n.DD._dragElements.forEach(r=>{r.dragStatus==="dragging"&&(i=!0)}),i},justDragged:!1,get node(){var i;return n.DD._dragElements.forEach(r=>{i=r.node}),i},_dragElements:new Map,_drag(i){const r=[];n.DD._dragElements.forEach((s,a)=>{const{node:o}=s,h=o.getStage();h.setPointersPositions(i),s.pointerId===void 0&&(s.pointerId=e.Util._getFirstPointerId(i));const l=h._changedPointerPositions.find(f=>f.id===s.pointerId);if(l){if(s.dragStatus!=="dragging"){var c=o.dragDistance(),d=Math.max(Math.abs(l.x-s.startPointerPos.x),Math.abs(l.y-s.startPointerPos.y));if(d<c||(o.startDrag({evt:i}),!o.isDragging()))return}o._setDragPosition(i,s),r.push(o)}}),r.forEach(s=>{s.fire("dragmove",{type:"dragmove",target:s,evt:i},!0)})},_endDragBefore(i){const r=[];n.DD._dragElements.forEach(s=>{const{node:a}=s,o=a.getStage();if(i&&o.setPointersPositions(i),!o._changedPointerPositions.find(c=>c.id===s.pointerId))return;(s.dragStatus==="dragging"||s.dragStatus==="stopped")&&(n.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,s.dragStatus="stopped");const l=s.node.getLayer()||s.node instanceof t.Konva.Stage&&s.node;l&&r.indexOf(l)===-1&&r.push(l)}),r.forEach(s=>{s.draw()})},_endDragAfter(i){n.DD._dragElements.forEach((r,s)=>{r.dragStatus==="stopped"&&r.node.fire("dragend",{type:"dragend",target:r.node,evt:i},!0),r.dragStatus!=="dragging"&&n.DD._dragElements.delete(s)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",n.DD._endDragBefore,!0),window.addEventListener("touchend",n.DD._endDragBefore,!0),window.addEventListener("mousemove",n.DD._drag),window.addEventListener("touchmove",n.DD._drag),window.addEventListener("mouseup",n.DD._endDragAfter,!1),window.addEventListener("touchend",n.DD._endDragAfter,!1))})(Vh);const Hh=St(xt({__proto__:null,default:Pe(Vh)},[Vh]));Object.defineProperty(as,"__esModule",{value:!0});var id=as.Node=void 0;const Ut=re,os=Ot,$a=za,Tn=Nt,Xe=Hh,he=Gt;var Va="absoluteOpacity",Ha="allEventListeners",ki="absoluteTransform",nd="absoluteScale",kn="canvas",y5="Change",w5="children",b5="konva",jh="listening",rd="mouseenter",sd="mouseleave",ad="set",od="Shape",ja=" ",hd="stage",Zi="transform",x5="Stage",Xh="visible",S5=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(ja);let C5=1,Lt=class Rl{constructor(t){this._id=C5++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===Zi||t===ki)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){var i=this._cache.get(t),r=t===Zi||t===ki,s=i===void 0||r&&i.dirty===!0;return s&&(i=e.call(this),this._cache.set(t,i)),i}_calculate(t,e,i){if(!this._attachedDepsListeners.get(t)){const r=e.map(s=>s+"Change.konva").join(ja);this.on(r,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}_getCanvasCache(){return this._cache.get(kn)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===ki&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(kn)){const{scene:t,filter:e,hit:i}=this._cache.get(kn);Ut.Util.releaseCanvas(t,e,i),this._cache.delete(kn)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},i={};(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)&&(i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var r=Math.ceil(e.width||i.width),s=Math.ceil(e.height||i.height),a=e.pixelRatio,o=e.x===void 0?Math.floor(i.x):e.x,h=e.y===void 0?Math.floor(i.y):e.y,l=e.offset||0,c=e.drawBorder||!1,d=e.hitCanvasPixelRatio||1;if(!r||!s){Ut.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}r+=l*2+1,s+=l*2+1,o-=l,h-=l;var f=new $a.SceneCanvas({pixelRatio:a,width:r,height:s}),u=new $a.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),m=new $a.HitCanvas({pixelRatio:d,width:r,height:s}),v=f.getContext(),b=m.getContext();return m.isCache=!0,f.isCache=!0,this._cache.delete(kn),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),v.save(),b.save(),v.translate(-o,-h),b.translate(-o,-h),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Va),this._clearSelfAndDescendantCache(nd),this.drawScene(f,this),this.drawHit(m,this),this._isUnderCache=!1,v.restore(),b.restore(),c&&(v.save(),v.beginPath(),v.rect(0,0,r,s),v.closePath(),v.setAttr("strokeStyle","red"),v.setAttr("lineWidth",5),v.stroke(),v.restore()),this._cache.set(kn,{scene:f,filter:u,hit:m,x:o,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(kn)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],r=1/0,s=1/0,a=-1/0,o=-1/0,h=this.getAbsoluteTransform(e);return i.forEach(function(l){var c=h.point(l);r===void 0&&(r=a=c.x,s=o=c.y),r=Math.min(r,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)}),{x:r,y:s,width:a-r,height:o-s}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);var i=this._getCachedSceneCanvas(),r=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/r,i.height/r),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),i=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0,i.width/i.pixelRatio,i.height/i.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),e=this._getCanvasCache(),i=e.scene,r=e.filter,s=r.getContext(),a,o,h,l;if(t){if(!this._filterUpToDate){var c=i.pixelRatio;r.setSize(i.width/i.pixelRatio,i.height/i.pixelRatio);try{for(a=t.length,s.clear(),s.drawImage(i._canvas,0,0,i.getWidth()/c,i.getHeight()/c),o=s.getImageData(0,0,r.getWidth(),r.getHeight()),h=0;h<a;h++){if(l=t[h],typeof l!="function"){Ut.Util.error("Filter should be type of function, but got "+typeof l+" instead. Please check correct filters");continue}l.call(this,o),s.putImageData(o,0,0)}}catch(d){Ut.Util.error("Unable to apply filter. "+d.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return r}return i}on(t,e){if(this._cache&&this._cache.delete(Ha),arguments.length===3)return this._delegate.apply(this,arguments);var i=t.split(ja),r=i.length,s,a,o,h,l;for(s=0;s<r;s++)a=i[s],o=a.split("."),h=o[0],l=o[1]||"",this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:l,handler:e});return this}off(t,e){var i=(t||"").split(ja),r=i.length,s,a,o,h,l,c;if(this._cache&&this._cache.delete(Ha),!t)for(a in this.eventListeners)this._off(a);for(s=0;s<r;s++)if(o=i[s],h=o.split("."),l=h[0],c=h[1],l)this.eventListeners[l]&&this._off(l,c,e);else for(a in this.eventListeners)this._off(a,c,e);return this}dispatchEvent(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(i){e.call(this,i.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,i){var r=this;this.on(t,function(s){for(var a=s.target.findAncestors(e,!0,r),o=0;o<a.length;o++)s=Ut.Util.cloneObject(s),s.currentTarget=a[o],i.call(a[o],s)})}remove(){return this.isDragging()&&this.stopDrag(),Xe.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(ki),this._clearSelfAndDescendantCache(Va),this._clearSelfAndDescendantCache(nd),this._clearSelfAndDescendantCache(hd),this._clearSelfAndDescendantCache(Xh),this._clearSelfAndDescendantCache(jh)}_remove(){this._clearCaches();var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){var e="get"+Ut.Util._capitalize(t);return Ut.Util._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){for(var t=this.getParent(),e=[];t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{var e,i;if(!t)return this;for(e in t)e!==w5&&(i=ad+Ut.Util._capitalize(e),Ut.Util._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(jh,this._isListening)}_isListening(t){if(!this.listening())return!1;const i=this.getParent();return i&&i!==t&&this!==t?i._isListening(t):!0}isVisible(){return this._getCache(Xh,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const i=this.getParent();return i&&i!==t&&this!==t?i._isVisible(t):!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var i=this.getLayer(),r=!1;Xe.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===i)&&(r=!0)});var s=!e&&!Tn.Konva.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!s}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),e=this,i=0,r,s,a,o;function h(c){for(r=[],s=c.length,a=0;a<s;a++)o=c[a],i++,o.nodeType!==od&&(r=r.concat(o.getChildren().slice())),o._id===e._id&&(a=s);r.length>0&&r[0].getDepth()<=t&&h(r)}const l=this.getStage();return e.nodeType!==x5&&l&&h(l.getChildren()),i}getDepth(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Zi),this._clearSelfAndDescendantCache(ki)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;var e=t.getPointerPosition();if(!e)return null;var i=this.getAbsoluteTransform().copy();return i.invert(),i.point(e)}getAbsolutePosition(t){let e=!1,i=this.parent;for(;i;){if(i.isCached()){e=!0;break}i=i.parent}e&&!t&&(t=!0);var r=this.getAbsoluteTransform(t).getMatrix(),s=new Ut.Transform,a=this.offset();return s.m=r.slice(),s.translate(a.x,a.y),s.getTranslation()}setAbsolutePosition(t){const{x:e,y:i,...r}=this._clearTransform();this.attrs.x=e,this.attrs.y=i,this._clearCache(Zi);var s=this._getAbsoluteTransform().copy();return s.invert(),s.translate(t.x,t.y),t={x:this.attrs.x+s.getTranslation().x,y:this.attrs.y+s.getTranslation().y},this._setTransform(r),this.setPosition({x:t.x,y:t.y}),this._clearCache(Zi),this._clearSelfAndDescendantCache(ki),this}_setTransform(t){var e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var e=t.x,i=t.y,r=this.x(),s=this.y();return e!==void 0&&(r+=e),i!==void 0&&(s+=i),this.setPosition({x:r,y:s}),this}_eachAncestorReverse(t,e){var i=[],r=this.getParent(),s,a;if(!(e&&e._id===this._id)){for(i.unshift(this);r&&(!e||r._id!==e._id);)i.unshift(r),r=r.parent;for(s=i.length,a=0;a<s;a++)t(i[a])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveUp function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveDown function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Ut.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Ut.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Ut.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Va,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},e=this.getAttrs(),i,r,s,a,o;t.attrs={};for(i in e)r=e[i],o=Ut.Util.isObject(r)&&!Ut.Util._isPlainObject(r)&&!Ut.Util._isArray(r),!o&&(s=typeof this[i]=="function"&&this[i],delete e[i],a=s?s.call(this):null,e[i]=r,a!==r&&(t.attrs[i]=r));return t.className=this.getClassName(),Ut.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,i){var r=[];e&&this._isMatch(t)&&r.push(this);for(var s=this.parent;s;){if(s===i)return r;s._isMatch(t)&&r.push(s),s=s.parent}return r}isAncestorOf(t){return!1}findAncestor(t,e,i){return this.findAncestors(t,e,i)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var e=t.replace(/ /g,"").split(","),i=e.length,r,s;for(r=0;r<i;r++)if(s=e[r],Ut.Util.isValidSelector(s)||(Ut.Util.warn('Selector "'+s+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Ut.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Ut.Util.warn("Konva is awesome, right?")),s.charAt(0)==="#"){if(this.id()===s.slice(1))return!0}else if(s.charAt(0)==="."){if(this.hasName(s.slice(1)))return!0}else if(this.className===s||this.nodeType===s)return!0;return!1}getLayer(){var t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(hd,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():null}fire(t,e={},i){return e.target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(ki,this._getAbsoluteTransform)}_getAbsoluteTransform(t){var e;if(t)return e=new Ut.Transform,this._eachAncestorReverse(function(r){var s=r.transformsEnabled();s==="all"?e.multiply(r.getTransform()):s==="position"&&e.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),e;e=this._cache.get(ki)||new Ut.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var i=this.transformsEnabled();if(i==="all")e.multiply(this.getTransform());else if(i==="position"){const r=this.attrs.x||0,s=this.attrs.y||0,a=this.attrs.offsetX||0,o=this.attrs.offsetY||0;e.translate(r-a,s-o)}return e.dirty=!1,e}getAbsoluteScale(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();const r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Zi,this._getTransform)}_getTransform(){var t,e,i=this._cache.get(Zi)||new Ut.Transform;i.reset();var r=this.x(),s=this.y(),a=Tn.Konva.getAngle(this.rotation()),o=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,h=(e=this.attrs.scaleY)!==null&&e!==void 0?e:1,l=this.attrs.skewX||0,c=this.attrs.skewY||0,d=this.attrs.offsetX||0,f=this.attrs.offsetY||0;return(r!==0||s!==0)&&i.translate(r,s),a!==0&&i.rotate(a),(l!==0||c!==0)&&i.skew(l,c),(o!==1||h!==1)&&i.scale(o,h),(d!==0||f!==0)&&i.translate(-1*d,-1*f),i.dirty=!1,i}clone(t){var e=Ut.Util.cloneObject(this.attrs),i,r,s,a,o;for(i in t)e[i]=t[i];var h=new this.constructor(e);for(i in this.eventListeners)for(r=this.eventListeners[i],s=r.length,a=0;a<s;a++)o=r[a],o.name.indexOf(b5)<0&&(h.eventListeners[i]||(h.eventListeners[i]=[]),h.eventListeners[i].push(o));return h}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),i=this.getStage(),r=t.x!==void 0?t.x:Math.floor(e.x),s=t.y!==void 0?t.y:Math.floor(e.y),a=t.pixelRatio||1,o=new $a.SceneCanvas({width:t.width||Math.ceil(e.width)||(i?i.width():0),height:t.height||Math.ceil(e.height)||(i?i.height():0),pixelRatio:a}),h=o.getContext();return t.imageSmoothingEnabled===!1&&(h._context.imageSmoothingEnabled=!1),h.save(),(r||s)&&h.translate(-1*r,-1*s),this.drawScene(o),h.restore(),o}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};var e=t.mimeType||null,i=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(r),r}toImage(t){return new Promise((e,i)=>{try{const r=t?.callback;r&&delete t.callback,Ut.Util._urlToImage(this.toDataURL(t),function(s){e(s),r?.(s)})}catch(r){i(r)}})}toBlob(t){return new Promise((e,i)=>{try{const r=t?.callback;r&&delete t.callback,this.toCanvas(t).toBlob(s=>{e(s),r?.(s)})}catch(r){i(r)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Tn.Konva.dragDistance}_off(t,e,i){var r=this.eventListeners[t],s,a,o;for(s=0;s<r.length;s++)if(a=r[s].name,o=r[s].handler,(a!=="konva"||e==="konva")&&(!e||a===e)&&(!i||i===o)){if(r.splice(s,1),r.length===0){delete this.eventListeners[t];break}s--}}_fireChangeEvent(t,e,i){this._fire(t+y5,{oldVal:e,newVal:i})}addName(t){if(!this.hasName(t)){var e=this.name(),i=e?e+" "+t:t;this.name(i)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;var i=(e||"").split(/\s/g);return i.indexOf(t)!==-1}removeName(t){var e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return i!==-1&&(e.splice(i,1),this.name(e.join(" "))),this}setAttr(t,e){var i=this[ad+Ut.Util._capitalize(t)];return Ut.Util._isFunction(i)?i.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(Tn.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,e){var i=this.attrs[t];i===e&&!Ut.Util.isObject(e)||(e==null?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,i,e),this._requestDraw())}_setComponentAttr(t,e,i){var r;i!==void 0&&(r=this.attrs[t],r||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,r,i))}_fireAndBubble(t,e,i){e&&this.nodeType===od&&(e.target=this);var r=(t===rd||t===sd)&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||this.nodeType==="Stage"&&!i);if(!r){this._fire(t,e);var s=(t===rd||t===sd)&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!s&&(i&&i.parent?this._fireAndBubble.call(this.parent,t,e,i):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,i,r;const s=(e=this._cache.get(Ha))!==null&&e!==void 0?e:{};let a=s?.[t];if(a===void 0){a=[];let o=Object.getPrototypeOf(this);for(;o;){const h=(r=(i=o.eventListeners)===null||i===void 0?void 0:i[t])!==null&&r!==void 0?r:[];a.push(...h),o=Object.getPrototypeOf(o)}s[t]=a,this._cache.set(Ha,s)}return a}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;const i=this._getProtoListeners(t);if(i)for(var r=0;r<i.length;r++)i[r].handler.call(this,e);const s=this.eventListeners[t];if(s)for(var r=0;r<s.length;r++)s[r].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){var e=t?t.pointerId:void 0,i=this.getStage(),r=this.getAbsolutePosition();if(i){var s=i._getPointerById(e)||i._changedPointerPositions[0]||r;Xe.DD._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-r.x,y:s.y-r.y},dragStatus:"ready",pointerId:e})}}startDrag(t,e=!0){Xe.DD._dragElements.has(this._id)||this._createDragElement(t);const i=Xe.DD._dragElements.get(this._id);i.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const i=this.getStage()._getPointerById(e.pointerId);if(i){var r={x:i.x-e.offset.x,y:i.y-e.offset.y},s=this.dragBoundFunc();if(s!==void 0){const a=s.call(this,r,t);a?r=a:Ut.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(t){const e=Xe.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),Xe.DD._endDragBefore(t),Xe.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Xe.DD._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){var e=t.evt.button!==void 0,i=!e||Tn.Konva.dragButtons.indexOf(t.evt.button)>=0;if(i&&!this.isDragging()){var r=!1;Xe.DD._dragElements.forEach(s=>{this.isAncestorOf(s.node)&&(r=!0)}),r||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const e=Xe.DD._dragElements.get(this._id),i=e&&e.dragStatus==="dragging",r=e&&e.dragStatus==="ready";i?this.stopDrag():r&&Xe.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const e=this.getStage();if(!e)return!1;const i={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return Ut.Util.haveIntersection(i,this.getClientRect())}static create(t,e){return Ut.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var i=Rl.prototype.getClassName.call(t),r=t.children,s,a,o;e&&(t.attrs.container=e),Tn.Konva[i]||(Ut.Util.warn('Can not find a node with class name "'+i+'". Fallback to "Shape".'),i="Shape");const h=Tn.Konva[i];if(s=new h(t.attrs),r)for(a=r.length,o=0;o<a;o++)s.add(Rl._createNode(r[o]));return s}};id=as.Node=Lt,Lt.prototype.nodeType="Node",Lt.prototype._attrsAffectingSize=[],Lt.prototype.eventListeners={},Lt.prototype.on.call(Lt.prototype,S5,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Zi),this._clearSelfAndDescendantCache(ki)}),Lt.prototype.on.call(Lt.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Xh)}),Lt.prototype.on.call(Lt.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(jh)}),Lt.prototype.on.call(Lt.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(Va)});const Zt=os.Factory.addGetterSetter;Zt(Lt,"zIndex"),Zt(Lt,"absolutePosition"),Zt(Lt,"position"),Zt(Lt,"x",0,(0,he.getNumberValidator)()),Zt(Lt,"y",0,(0,he.getNumberValidator)()),Zt(Lt,"globalCompositeOperation","source-over",(0,he.getStringValidator)()),Zt(Lt,"opacity",1,(0,he.getNumberValidator)()),Zt(Lt,"name","",(0,he.getStringValidator)()),Zt(Lt,"id","",(0,he.getStringValidator)()),Zt(Lt,"rotation",0,(0,he.getNumberValidator)()),os.Factory.addComponentsGetterSetter(Lt,"scale",["x","y"]),Zt(Lt,"scaleX",1,(0,he.getNumberValidator)()),Zt(Lt,"scaleY",1,(0,he.getNumberValidator)()),os.Factory.addComponentsGetterSetter(Lt,"skew",["x","y"]),Zt(Lt,"skewX",0,(0,he.getNumberValidator)()),Zt(Lt,"skewY",0,(0,he.getNumberValidator)()),os.Factory.addComponentsGetterSetter(Lt,"offset",["x","y"]),Zt(Lt,"offsetX",0,(0,he.getNumberValidator)()),Zt(Lt,"offsetY",0,(0,he.getNumberValidator)()),Zt(Lt,"dragDistance",null,(0,he.getNumberValidator)()),Zt(Lt,"width",0,(0,he.getNumberValidator)()),Zt(Lt,"height",0,(0,he.getNumberValidator)()),Zt(Lt,"listening",!0,(0,he.getBooleanValidator)()),Zt(Lt,"preventDefault",!0,(0,he.getBooleanValidator)()),Zt(Lt,"filters",null,function(n){return this._filterUpToDate=!1,n}),Zt(Lt,"visible",!0,(0,he.getBooleanValidator)()),Zt(Lt,"transformsEnabled","all",(0,he.getStringValidator)()),Zt(Lt,"size"),Zt(Lt,"dragBoundFunc"),Zt(Lt,"draggable",!1,(0,he.getBooleanValidator)()),os.Factory.backCompat(Lt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});const le=St(xt({__proto__:null,get Node(){return id},default:as},[as]));var hs={};Object.defineProperty(hs,"__esModule",{value:!0});var ld=hs.Container=void 0;const nr=Ot,Yh=le,Xa=Gt;class En extends Yh.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var i=[];return e.forEach(function(r){t(r)&&i.push(r)}),i}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var e=0;e<t.length;e++)this.add(t[e]);return this}const i=t[0];return i.getParent()?(i.moveTo(this),this):(this._validateAdd(i),i.index=this.getChildren().length,i.parent=this,i._clearCaches(),this.getChildren().push(i),this._fire("add",{child:i}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var i=[];return this._descendants(r=>{const s=r._isMatch(t);return s&&i.push(r),!!(s&&e)}),i}_descendants(t){let e=!1;const i=this.getChildren();for(const r of i){if(e=t(r),e)return!0;if(r.hasChildren()&&(e=r._descendants(t),e))return!0}return!1}toObject(){var t=Yh.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var e=Yh.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(i){e.add(i.clone())}),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach(i=>{i.isVisible()&&i.intersects(t)&&e.push(i)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),!this.isCached()&&((e=this.children)===null||e===void 0||e.forEach(function(i){i._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,i){e.index=i}),this._requestDraw()}drawScene(t,e){var i=this.getLayer(),r=t||i&&i.getCanvas(),s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.scene,h=r&&r.isCache;if(!this.isVisible()&&!h)return this;if(o){s.save();var l=this.getAbsoluteTransform(e).getMatrix();s.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",r,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var i=this.getLayer(),r=t||i&&i.hitCanvas,s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.hit;if(o){s.save();var h=this.getAbsoluteTransform(e).getMatrix();s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",r,e);return this}_drawChildren(t,e,i){var r,s=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),h=this.clipFunc(),l=a&&o||h;const c=i===this;if(l){s.save();var d=this.getAbsoluteTransform(i),f=d.getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s.beginPath();let b;if(h)b=h.call(this,s,this);else{var u=this.clipX(),m=this.clipY();s.rect(u,m,a,o)}s.clip.apply(s,b),f=d.copy().invert().getMatrix(),s.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var v=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";v&&(s.save(),s._applyGlobalCompositeOperation(this)),(r=this.children)===null||r===void 0||r.forEach(function(b){b[t](e,i)}),v&&s.restore(),l&&s.restore()}getClientRect(t={}){var e,i=t.skipTransform,r=t.relativeTo,s,a,o,h,l={x:1/0,y:1/0,width:0,height:0},c=this;(e=this.children)===null||e===void 0||e.forEach(function(v){if(v.visible()){var b=v.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});b.width===0&&b.height===0||(s===void 0?(s=b.x,a=b.y,o=b.x+b.width,h=b.y+b.height):(s=Math.min(s,b.x),a=Math.min(a,b.y),o=Math.max(o,b.x+b.width),h=Math.max(h,b.y+b.height)))}});for(var d=this.find("Shape"),f=!1,u=0;u<d.length;u++){var m=d[u];if(m._isVisible(this)){f=!0;break}}return f&&s!==void 0?l={x:s,y:a,width:o-s,height:h-a}:l={x:0,y:0,width:0,height:0},i?l:this._transformedRect(l,r)}}ld=hs.Container=En,nr.Factory.addComponentsGetterSetter(En,"clip",["x","y","width","height"]),nr.Factory.addGetterSetter(En,"clipX",void 0,(0,Xa.getNumberValidator)()),nr.Factory.addGetterSetter(En,"clipY",void 0,(0,Xa.getNumberValidator)()),nr.Factory.addGetterSetter(En,"clipWidth",void 0,(0,Xa.getNumberValidator)()),nr.Factory.addGetterSetter(En,"clipHeight",void 0,(0,Xa.getNumberValidator)()),nr.Factory.addGetterSetter(En,"clipFunc");const Ya=St(xt({__proto__:null,get Container(){return ld},default:hs},[hs]));var qh={},Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});var cd=Ge.releaseCapture=pd=Ge.setPointerCapture=gd=Ge.hasPointerCapture=dd=Ge.createEvent=fd=Ge.getCapturedShape=void 0;const T5=Nt,ls=new Map,ud=T5.Konva._global.PointerEvent!==void 0;function k5(n){return ls.get(n)}var fd=Ge.getCapturedShape=k5;function Wh(n){return{evt:n,pointerId:n.pointerId}}var dd=Ge.createEvent=Wh;function E5(n,t){return ls.get(n)===t}var gd=Ge.hasPointerCapture=E5;function P5(n,t){md(n),t.getStage()&&(ls.set(n,t),ud&&t._fire("gotpointercapture",Wh(new PointerEvent("gotpointercapture"))))}var pd=Ge.setPointerCapture=P5;function md(n,t){const e=ls.get(n);if(!e)return;const i=e.getStage();i&&i.content,ls.delete(n),ud&&e._fire("lostpointercapture",Wh(new PointerEvent("lostpointercapture")))}cd=Ge.releaseCapture=md;const vd=St(xt({__proto__:null,get createEvent(){return dd},default:Ge,get getCapturedShape(){return fd},get hasPointerCapture(){return gd},get releaseCapture(){return cd},get setPointerCapture(){return pd}},[Ge]));(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Stage=n.stages=void 0;const t=re,e=Ot,i=Ya,r=Nt,s=za,a=Hh,o=Nt,h=vd;var l="Stage",c="string",d="px",f="mouseout",u="mouseleave",m="mouseover",v="mouseenter",b="mousemove",S="mousedown",E="mouseup",_="pointermove",x="pointerdown",P="pointerup",R="pointercancel",O="lostpointercapture",L="pointerout",$="pointerleave",U="pointerover",z="pointerenter",q="contextmenu",K="touchstart",Z="touchend",at="touchmove",vt="touchcancel",_t="wheel",pt=5,nt=[[v,"_pointerenter"],[S,"_pointerdown"],[b,"_pointermove"],[E,"_pointerup"],[u,"_pointerleave"],[K,"_pointerdown"],[at,"_pointermove"],[Z,"_pointerup"],[vt,"_pointercancel"],[m,"_pointerover"],[_t,"_wheel"],[q,"_contextmenu"],[x,"_pointerdown"],[_,"_pointermove"],[P,"_pointerup"],[R,"_pointercancel"],[O,"_lostpointercapture"]];const J={mouse:{[L]:f,[$]:u,[U]:m,[z]:v,[_]:b,[x]:S,[P]:E,[R]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[L]:"touchout",[$]:"touchleave",[U]:"touchover",[z]:"touchenter",[_]:at,[x]:K,[P]:Z,[R]:vt,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[L]:L,[$]:$,[U]:U,[z]:z,[_]:_,[x]:x,[P]:P,[R]:R,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},I=W=>W.indexOf("pointer")>=0?"pointer":W.indexOf("touch")>=0?"touch":"mouse",D=W=>{const N=I(W);if(N==="pointer")return r.Konva.pointerEventsEnabled&&J.pointer;if(N==="touch")return J.touch;if(N==="mouse")return J.mouse};function A(W={}){return(W.clipFunc||W.clipWidth||W.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),W}const B="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";n.stages=[];class j extends i.Container{constructor(N){super(A(N)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),n.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{A(this.attrs)}),this._checkVisibility()}_validateAdd(N){const Y=N.getType()==="Layer",X=N.getType()==="FastLayer";Y||X||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const N=this.visible()?"":"none";this.content.style.display=N}setContainer(N){if(typeof N===c){if(N.charAt(0)==="."){var Y=N.slice(1);N=document.getElementsByClassName(Y)[0]}else{var X;N.charAt(0)!=="#"?X=N:X=N.slice(1),N=document.getElementById(X)}if(!N)throw"Can not find container in document with id "+X}return this._setAttr("container",N),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),N.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var N=this.children,Y=N.length,X;for(X=0;X<Y;X++)N[X].clear();return this}clone(N){return N||(N={}),N.container=typeof document<"u"&&document.createElement("div"),i.Container.prototype.clone.call(this,N)}destroy(){super.destroy();var N=this.content;N&&t.Util._isInDocument(N)&&this.container().removeChild(N);var Y=n.stages.indexOf(this);return Y>-1&&n.stages.splice(Y,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const N=this._pointerPositions[0]||this._changedPointerPositions[0];return N?{x:N.x,y:N.y}:(t.Util.warn(B),null)}_getPointerById(N){return this._pointerPositions.find(Y=>Y.id===N)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(N){N=N||{},N.x=N.x||0,N.y=N.y||0,N.width=N.width||this.width(),N.height=N.height||this.height();var Y=new s.SceneCanvas({width:N.width,height:N.height,pixelRatio:N.pixelRatio||1}),X=Y.getContext()._context,et=this.children;return(N.x||N.y)&&X.translate(-1*N.x,-1*N.y),et.forEach(function(ht){if(ht.isVisible()){var mt=ht._toKonvaCanvas(N);X.drawImage(mt._canvas,N.x,N.y,mt.getWidth()/mt.getPixelRatio(),mt.getHeight()/mt.getPixelRatio())}}),Y}getIntersection(N){if(!N)return null;var Y=this.children,X=Y.length,et=X-1,ht;for(ht=et;ht>=0;ht--){const mt=Y[ht].getIntersection(N);if(mt)return mt}return null}_resizeDOM(){var N=this.width(),Y=this.height();this.content&&(this.content.style.width=N+d,this.content.style.height=Y+d),this.bufferCanvas.setSize(N,Y),this.bufferHitCanvas.setSize(N,Y),this.children.forEach(X=>{X.setSize({width:N,height:Y}),X.draw()})}add(N,...Y){if(arguments.length>1){for(var X=0;X<arguments.length;X++)this.add(arguments[X]);return this}super.add(N);var et=this.children.length;return et>pt&&t.Util.warn("The stage has "+et+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),N.setSize({width:this.width(),height:this.height()}),N.draw(),r.Konva.isBrowser&&this.content.appendChild(N.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(N){return h.hasPointerCapture(N,this)}setPointerCapture(N){h.setPointerCapture(N,this)}releaseCapture(N){h.releaseCapture(N,this)}getLayers(){return this.children}_bindContentEvents(){r.Konva.isBrowser&&nt.forEach(([N,Y])=>{this.content.addEventListener(N,X=>{this[Y](X)},{passive:!1})})}_pointerenter(N){this.setPointersPositions(N);const Y=D(N.type);Y&&this._fire(Y.pointerenter,{evt:N,target:this,currentTarget:this})}_pointerover(N){this.setPointersPositions(N);const Y=D(N.type);Y&&this._fire(Y.pointerover,{evt:N,target:this,currentTarget:this})}_getTargetShape(N){let Y=this[N+"targetShape"];return Y&&!Y.getStage()&&(Y=null),Y}_pointerleave(N){const Y=D(N.type),X=I(N.type);if(Y){this.setPointersPositions(N);var et=this._getTargetShape(X),ht=!a.DD.isDragging||r.Konva.hitOnDragEnabled;et&&ht?(et._fireAndBubble(Y.pointerout,{evt:N}),et._fireAndBubble(Y.pointerleave,{evt:N}),this._fire(Y.pointerleave,{evt:N,target:this,currentTarget:this}),this[X+"targetShape"]=null):ht&&(this._fire(Y.pointerleave,{evt:N,target:this,currentTarget:this}),this._fire(Y.pointerout,{evt:N,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(N){const Y=D(N.type),X=I(N.type);if(Y){this.setPointersPositions(N);var et=!1;this._changedPointerPositions.forEach(ht=>{var mt=this.getIntersection(ht);if(a.DD.justDragged=!1,r.Konva["_"+X+"ListenClick"]=!0,!mt||!mt.isListening())return;r.Konva.capturePointerEventsEnabled&&mt.setPointerCapture(ht.id),this[X+"ClickStartShape"]=mt,mt._fireAndBubble(Y.pointerdown,{evt:N,pointerId:ht.id}),et=!0;const bt=N.type.indexOf("touch")>=0;mt.preventDefault()&&N.cancelable&&bt&&N.preventDefault()}),et||this._fire(Y.pointerdown,{evt:N,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(N){const Y=D(N.type),X=I(N.type);if(!Y)return;a.DD.isDragging&&a.DD.node.preventDefault()&&N.cancelable&&N.preventDefault(),this.setPointersPositions(N);var et=!a.DD.isDragging||r.Konva.hitOnDragEnabled;if(!et)return;var ht={};let mt=!1;var bt=this._getTargetShape(X);this._changedPointerPositions.forEach(Tt=>{const yt=h.getCapturedShape(Tt.id)||this.getIntersection(Tt),Et=Tt.id,Pt={evt:N,pointerId:Et};var Ft=bt!==yt;if(Ft&&bt&&(bt._fireAndBubble(Y.pointerout,{...Pt},yt),bt._fireAndBubble(Y.pointerleave,{...Pt},yt)),yt){if(ht[yt._id])return;ht[yt._id]=!0}yt&&yt.isListening()?(mt=!0,Ft&&(yt._fireAndBubble(Y.pointerover,{...Pt},bt),yt._fireAndBubble(Y.pointerenter,{...Pt},bt),this[X+"targetShape"]=yt),yt._fireAndBubble(Y.pointermove,{...Pt})):bt&&(this._fire(Y.pointerover,{evt:N,target:this,currentTarget:this,pointerId:Et}),this[X+"targetShape"]=null)}),mt||this._fire(Y.pointermove,{evt:N,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(N){const Y=D(N.type),X=I(N.type);if(!Y)return;this.setPointersPositions(N);const et=this[X+"ClickStartShape"],ht=this[X+"ClickEndShape"];var mt={};let bt=!1;this._changedPointerPositions.forEach(Tt=>{const yt=h.getCapturedShape(Tt.id)||this.getIntersection(Tt);if(yt){if(yt.releaseCapture(Tt.id),mt[yt._id])return;mt[yt._id]=!0}const Et=Tt.id,Pt={evt:N,pointerId:Et};let Ft=!1;r.Konva["_"+X+"InDblClickWindow"]?(Ft=!0,clearTimeout(this[X+"DblTimeout"])):a.DD.justDragged||(r.Konva["_"+X+"InDblClickWindow"]=!0,clearTimeout(this[X+"DblTimeout"])),this[X+"DblTimeout"]=setTimeout(function(){r.Konva["_"+X+"InDblClickWindow"]=!1},r.Konva.dblClickWindow),yt&&yt.isListening()?(bt=!0,this[X+"ClickEndShape"]=yt,yt._fireAndBubble(Y.pointerup,{...Pt}),r.Konva["_"+X+"ListenClick"]&&et&&et===yt&&(yt._fireAndBubble(Y.pointerclick,{...Pt}),Ft&&ht&&ht===yt&&yt._fireAndBubble(Y.pointerdblclick,{...Pt}))):(this[X+"ClickEndShape"]=null,r.Konva["_"+X+"ListenClick"]&&this._fire(Y.pointerclick,{evt:N,target:this,currentTarget:this,pointerId:Et}),Ft&&this._fire(Y.pointerdblclick,{evt:N,target:this,currentTarget:this,pointerId:Et}))}),bt||this._fire(Y.pointerup,{evt:N,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r.Konva["_"+X+"ListenClick"]=!1,N.cancelable&&X!=="touch"&&N.preventDefault()}_contextmenu(N){this.setPointersPositions(N);var Y=this.getIntersection(this.getPointerPosition());Y&&Y.isListening()?Y._fireAndBubble(q,{evt:N}):this._fire(q,{evt:N,target:this,currentTarget:this})}_wheel(N){this.setPointersPositions(N);var Y=this.getIntersection(this.getPointerPosition());Y&&Y.isListening()?Y._fireAndBubble(_t,{evt:N}):this._fire(_t,{evt:N,target:this,currentTarget:this})}_pointercancel(N){this.setPointersPositions(N);const Y=h.getCapturedShape(N.pointerId)||this.getIntersection(this.getPointerPosition());Y&&Y._fireAndBubble(P,h.createEvent(N)),h.releaseCapture(N.pointerId)}_lostpointercapture(N){h.releaseCapture(N.pointerId)}setPointersPositions(N){var Y=this._getContentPosition(),X=null,et=null;N=N||window.event,N.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(N.touches,ht=>{this._pointerPositions.push({id:ht.identifier,x:(ht.clientX-Y.left)/Y.scaleX,y:(ht.clientY-Y.top)/Y.scaleY})}),Array.prototype.forEach.call(N.changedTouches||N.touches,ht=>{this._changedPointerPositions.push({id:ht.identifier,x:(ht.clientX-Y.left)/Y.scaleX,y:(ht.clientY-Y.top)/Y.scaleY})})):(X=(N.clientX-Y.left)/Y.scaleX,et=(N.clientY-Y.top)/Y.scaleY,this.pointerPos={x:X,y:et},this._pointerPositions=[{x:X,y:et,id:t.Util._getFirstPointerId(N)}],this._changedPointerPositions=[{x:X,y:et,id:t.Util._getFirstPointerId(N)}])}_setPointerPosition(N){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(N)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var N=this.content.getBoundingClientRect();return{top:N.top,left:N.left,scaleX:N.width/this.content.clientWidth||1,scaleY:N.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!r.Konva.isBrowser){var N=this.container();if(!N)throw"Stage has no container. A container is required.";N.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),N.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(N){N.batchDraw()}),this}}n.Stage=j,j.prototype.nodeType=l,(0,o._registerNode)(j),e.Factory.addGetterSetter(j,"container")})(qh);const A5=St(xt({__proto__:null,default:Pe(qh)},[qh]));var cs={},Kh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Shape=n.shapes=void 0;const t=Nt,e=re,i=Ot,r=le,s=Gt,a=Nt,o=vd;var h="hasShadow",l="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let u;function m(){return u||(u=e.Util.createCanvasElement().getContext("2d"),u)}n.shapes={};function v($){const U=this.attrs.fillRule;U?$.fill(U):$.fill()}function b($){$.stroke()}function S($){$.fill()}function E($){$.stroke()}function _(){this._clearCache(h)}function x(){this._clearCache(l)}function P(){this._clearCache(c)}function R(){this._clearCache(d)}function O(){this._clearCache(f)}class L extends r.Node{constructor(U){super(U);let z;for(;z=e.Util.getRandomColor(),!(z&&!(z in n.shapes)););this.colorKey=z,n.shapes[z]=this}getContext(){return e.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return e.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var U=m();const z=U.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(z&&z.setTransform){const q=new e.Transform;q.translate(this.fillPatternX(),this.fillPatternY()),q.rotate(t.Konva.getAngle(this.fillPatternRotation())),q.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),q.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const K=q.getMatrix(),Z=typeof DOMMatrix>"u"?{a:K[0],b:K[1],c:K[2],d:K[3],e:K[4],f:K[5]}:new DOMMatrix(K);z.setTransform(Z)}return z}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var U=this.fillLinearGradientColorStops();if(U){for(var z=m(),q=this.fillLinearGradientStartPoint(),K=this.fillLinearGradientEndPoint(),Z=z.createLinearGradient(q.x,q.y,K.x,K.y),at=0;at<U.length;at+=2)Z.addColorStop(U[at],U[at+1]);return Z}}_getRadialGradient(){return this._getCache(f,this.__getRadialGradient)}__getRadialGradient(){var U=this.fillRadialGradientColorStops();if(U){for(var z=m(),q=this.fillRadialGradientStartPoint(),K=this.fillRadialGradientEndPoint(),Z=z.createRadialGradient(q.x,q.y,this.fillRadialGradientStartRadius(),K.x,K.y,this.fillRadialGradientEndRadius()),at=0;at<U.length;at+=2)Z.addColorStop(U[at],U[at+1]);return Z}}getShadowRGBA(){return this._getCache(l,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var U=e.Util.colorToRGBA(this.shadowColor());if(U)return"rgba("+U.r+","+U.g+","+U.b+","+U.a*(this.shadowOpacity()||1)+")"}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const U=this.hitStrokeWidth();return U==="auto"?this.hasStroke():this.strokeEnabled()&&!!U}intersects(U){var z=this.getStage();if(!z)return!1;const q=z.bufferHitCanvas;return q.getContext().clear(),this.drawHit(q,void 0,!0),q.context.getImageData(Math.round(U.x),Math.round(U.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete n.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(U){var z;if(!this.getStage()||!((z=this.attrs.perfectDrawEnabled)!==null&&z!==void 0?z:!0))return!1;const K=U||this.hasFill(),Z=this.hasStroke(),at=this.getAbsoluteOpacity()!==1;if(K&&Z&&at)return!0;const vt=this.hasShadow(),_t=this.shadowForStrokeEnabled();return!!(K&&Z&&vt&&_t)}setStrokeHitEnabled(U){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),U?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var U=this.size();return{x:this._centroid?-U.width/2:0,y:this._centroid?-U.height/2:0,width:U.width,height:U.height}}getClientRect(U={}){const z=U.skipTransform,q=U.relativeTo,K=this.getSelfRect(),at=!U.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,vt=K.width+at,_t=K.height+at,pt=!U.skipShadow&&this.hasShadow(),nt=pt?this.shadowOffsetX():0,J=pt?this.shadowOffsetY():0,I=vt+Math.abs(nt),D=_t+Math.abs(J),A=pt&&this.shadowBlur()||0,B=I+A*2,j=D+A*2,W={width:B,height:j,x:-(at/2+A)+Math.min(nt,0)+K.x,y:-(at/2+A)+Math.min(J,0)+K.y};return z?W:this._transformedRect(W,q)}drawScene(U,z){var q=this.getLayer(),K=U||q.getCanvas(),Z=K.getContext(),at=this._getCanvasCache(),vt=this.getSceneFunc(),_t=this.hasShadow(),pt,nt,J,I=K.isCache,D=z===this;if(!this.isVisible()&&!D)return this;if(at){Z.save();var A=this.getAbsoluteTransform(z).getMatrix();return Z.transform(A[0],A[1],A[2],A[3],A[4],A[5]),this._drawCachedSceneCanvas(Z),Z.restore(),this}if(!vt)return this;if(Z.save(),this._useBufferCanvas()&&!I){pt=this.getStage(),nt=pt.bufferCanvas,J=nt.getContext(),J.clear(),J.save(),J._applyLineJoin(this);var B=this.getAbsoluteTransform(z).getMatrix();J.transform(B[0],B[1],B[2],B[3],B[4],B[5]),vt.call(this,J,this),J.restore();var j=nt.pixelRatio;_t&&Z._applyShadow(this),Z._applyOpacity(this),Z._applyGlobalCompositeOperation(this),Z.drawImage(nt._canvas,0,0,nt.width/j,nt.height/j)}else{if(Z._applyLineJoin(this),!D){var B=this.getAbsoluteTransform(z).getMatrix();Z.transform(B[0],B[1],B[2],B[3],B[4],B[5]),Z._applyOpacity(this),Z._applyGlobalCompositeOperation(this)}_t&&Z._applyShadow(this),vt.call(this,Z,this)}return Z.restore(),this}drawHit(U,z,q=!1){if(!this.shouldDrawHit(z,q))return this;var K=this.getLayer(),Z=U||K.hitCanvas,at=Z&&Z.getContext(),vt=this.hitFunc()||this.sceneFunc(),_t=this._getCanvasCache(),pt=_t&&_t.hit;if(this.colorKey||e.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),pt){at.save();var nt=this.getAbsoluteTransform(z).getMatrix();return at.transform(nt[0],nt[1],nt[2],nt[3],nt[4],nt[5]),this._drawCachedHitCanvas(at),at.restore(),this}if(!vt)return this;if(at.save(),at._applyLineJoin(this),!(this===z)){var I=this.getAbsoluteTransform(z).getMatrix();at.transform(I[0],I[1],I[2],I[3],I[4],I[5])}return vt.call(this,at,this),at.restore(),this}drawHitFromCache(U=0){var z=this._getCanvasCache(),q=this._getCachedSceneCanvas(),K=z.hit,Z=K.getContext(),at=K.getWidth(),vt=K.getHeight(),_t,pt,nt,J,I,D;Z.clear(),Z.drawImage(q._canvas,0,0,at,vt);try{for(_t=Z.getImageData(0,0,at,vt),pt=_t.data,nt=pt.length,J=e.Util._hexToRgb(this.colorKey),I=0;I<nt;I+=4)D=pt[I+3],D>U?(pt[I]=J.r,pt[I+1]=J.g,pt[I+2]=J.b,pt[I+3]=255):pt[I+3]=0;Z.putImageData(_t,0,0)}catch(A){e.Util.error("Unable to draw hit graph from cached scene canvas. "+A.message)}return this}hasPointerCapture(U){return o.hasPointerCapture(U,this)}setPointerCapture(U){o.setPointerCapture(U,this)}releaseCapture(U){o.releaseCapture(U,this)}}n.Shape=L,L.prototype._fillFunc=v,L.prototype._strokeFunc=b,L.prototype._fillFuncHit=S,L.prototype._strokeFuncHit=E,L.prototype._centroid=!1,L.prototype.nodeType="Shape",(0,a._registerNode)(L),L.prototype.eventListeners={},L.prototype.on.call(L.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",_),L.prototype.on.call(L.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",x),L.prototype.on.call(L.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",P),L.prototype.on.call(L.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",R),L.prototype.on.call(L.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",O),i.Factory.addGetterSetter(L,"stroke",void 0,(0,s.getStringOrGradientValidator)()),i.Factory.addGetterSetter(L,"strokeWidth",2,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillAfterStrokeEnabled",!1),i.Factory.addGetterSetter(L,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),i.Factory.addGetterSetter(L,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(L,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(L,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),i.Factory.addGetterSetter(L,"lineJoin"),i.Factory.addGetterSetter(L,"lineCap"),i.Factory.addGetterSetter(L,"sceneFunc"),i.Factory.addGetterSetter(L,"hitFunc"),i.Factory.addGetterSetter(L,"dash"),i.Factory.addGetterSetter(L,"dashOffset",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"shadowColor",void 0,(0,s.getStringValidator)()),i.Factory.addGetterSetter(L,"shadowBlur",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"shadowOpacity",1,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(L,"shadowOffset",["x","y"]),i.Factory.addGetterSetter(L,"shadowOffsetX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"shadowOffsetY",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillPatternImage"),i.Factory.addGetterSetter(L,"fill",void 0,(0,s.getStringOrGradientValidator)()),i.Factory.addGetterSetter(L,"fillPatternX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillPatternY",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillLinearGradientColorStops"),i.Factory.addGetterSetter(L,"strokeLinearGradientColorStops"),i.Factory.addGetterSetter(L,"fillRadialGradientStartRadius",0),i.Factory.addGetterSetter(L,"fillRadialGradientEndRadius",0),i.Factory.addGetterSetter(L,"fillRadialGradientColorStops"),i.Factory.addGetterSetter(L,"fillPatternRepeat","repeat"),i.Factory.addGetterSetter(L,"fillEnabled",!0),i.Factory.addGetterSetter(L,"strokeEnabled",!0),i.Factory.addGetterSetter(L,"shadowEnabled",!0),i.Factory.addGetterSetter(L,"dashEnabled",!0),i.Factory.addGetterSetter(L,"strokeScaleEnabled",!0),i.Factory.addGetterSetter(L,"fillPriority","color"),i.Factory.addComponentsGetterSetter(L,"fillPatternOffset",["x","y"]),i.Factory.addGetterSetter(L,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(L,"fillPatternScale",["x","y"]),i.Factory.addGetterSetter(L,"fillPatternScaleX",1,(0,s.getNumberValidator)()),i.Factory.addGetterSetter(L,"fillPatternScaleY",1,(0,s.getNumberValidator)()),i.Factory.addComponentsGetterSetter(L,"fillLinearGradientStartPoint",["x","y"]),i.Factory.addComponentsGetterSetter(L,"strokeLinearGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(L,"fillLinearGradientStartPointX",0),i.Factory.addGetterSetter(L,"strokeLinearGradientStartPointX",0),i.Factory.addGetterSetter(L,"fillLinearGradientStartPointY",0),i.Factory.addGetterSetter(L,"strokeLinearGradientStartPointY",0),i.Factory.addComponentsGetterSetter(L,"fillLinearGradientEndPoint",["x","y"]),i.Factory.addComponentsGetterSetter(L,"strokeLinearGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(L,"fillLinearGradientEndPointX",0),i.Factory.addGetterSetter(L,"strokeLinearGradientEndPointX",0),i.Factory.addGetterSetter(L,"fillLinearGradientEndPointY",0),i.Factory.addGetterSetter(L,"strokeLinearGradientEndPointY",0),i.Factory.addComponentsGetterSetter(L,"fillRadialGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(L,"fillRadialGradientStartPointX",0),i.Factory.addGetterSetter(L,"fillRadialGradientStartPointY",0),i.Factory.addComponentsGetterSetter(L,"fillRadialGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(L,"fillRadialGradientEndPointX",0),i.Factory.addGetterSetter(L,"fillRadialGradientEndPointY",0),i.Factory.addGetterSetter(L,"fillPatternRotation",0),i.Factory.addGetterSetter(L,"fillRule",void 0,(0,s.getStringValidator)()),i.Factory.backCompat(L,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Kh);const me=St(xt({__proto__:null,default:Pe(Kh)},[Kh]));Object.defineProperty(cs,"__esModule",{value:!0});var _d=cs.Layer=void 0;const Ei=re,Zh=Ya,rr=le,Jh=Ot,yd=za,M5=Gt,R5=me,D5=Nt;var L5="#",I5="beforeDraw",F5="draw",wd=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],O5=wd.length;class sr extends Zh.Container{constructor(t){super(t),this.canvas=new yd.SceneCanvas,this.hitCanvas=new yd.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){rr.Node.prototype.moveToTop.call(this);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var t=rr.Node.prototype.moveUp.call(this);if(!t)return!1;var e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(rr.Node.prototype.moveDown.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(rr.Node.prototype.moveToBottom.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var t=this.getNativeCanvasElement();return rr.Node.prototype.remove.call(this),t&&t.parentNode&&Ei.Util._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&Ei.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return t=t||{},t.width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=t.x!==void 0?t.x:this.x(),t.y=t.y!==void 0?t.y:this.y(),rr.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Ei.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Ei.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Ei.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,i=!1;;){for(let r=0;r<O5;r++){const s=wd[r],a=this._getIntersection({x:t.x+s.x*e,y:t.y+s.y*e}),o=a.shape;if(o)return o;if(i=!!a.antialiased,!a.antialiased)break}if(i)e+=1;else return null}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=i[3];if(r===255){const s=Ei.Util._rgbToHex(i[0],i[1],i[2]),a=R5.shapes[L5+s];return a?{shape:a}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(t,e){var i=this.getLayer(),r=t||i&&i.getCanvas();return this._fire(I5,{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Zh.Container.prototype.drawScene.call(this,r,e),this._fire(F5,{node:this}),this}drawHit(t,e){var i=this.getLayer(),r=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),Zh.Container.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){Ei.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return Ei.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,e=!!this.hitCanvas._canvas.parentNode;e?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return Ei.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}_d=cs.Layer=sr,sr.prototype.nodeType="Layer",(0,D5._registerNode)(sr),Jh.Factory.addGetterSetter(sr,"imageSmoothingEnabled",!0),Jh.Factory.addGetterSetter(sr,"clearBeforeDraw",!0),Jh.Factory.addGetterSetter(sr,"hitGraphEnabled",!0,(0,M5.getBooleanValidator)());const bd=St(xt({__proto__:null,get Layer(){return _d},default:cs},[cs]));var us={};Object.defineProperty(us,"__esModule",{value:!0});var xd=us.FastLayer=void 0;const N5=re,G5=bd,U5=Nt;class Qh extends G5.Layer{constructor(t){super(t),this.listening(!1),N5.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}xd=us.FastLayer=Qh,Qh.prototype.nodeType="FastLayer",(0,U5._registerNode)(Qh);const B5=St(xt({__proto__:null,get FastLayer(){return xd},default:us},[us]));var fs={};Object.defineProperty(fs,"__esModule",{value:!0});var Sd=fs.Group=void 0;const z5=re,$5=Ya,V5=Nt;class tl extends $5.Container{_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&z5.Util.throw("You may only add groups and shapes to groups.")}}Sd=fs.Group=tl,tl.prototype.nodeType="Group",(0,V5._registerNode)(tl);const el=St(xt({__proto__:null,get Group(){return Sd},default:fs},[fs]));var ds={};Object.defineProperty(ds,"__esModule",{value:!0});var Cd=ds.Animation=void 0;const il=Nt,Td=re,nl=function(){return il.glob.performance&&il.glob.performance.now?function(){return il.glob.performance.now()}:function(){return new Date().getTime()}}();class ai{constructor(t,e){this.id=ai.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:nl(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,i=e.length;for(let r=0;r<i;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=ai.animations,i=e.length;for(let r=0;r<i;r++)if(e[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=nl(),ai._addAnimation(this),this}stop(){return ai._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,i=this.animations,r=i.length;for(let s=0;s<r;s++)if(i[s].id===e){this.animations.splice(s,1);break}}static _runFrames(){const t={},e=this.animations;for(let i=0;i<e.length;i++){const r=e[i],s=r.layers,a=r.func;r._updateFrameObject(nl());const o=s.length;let h;if(a?h=a.call(r,r.frame)!==!1:h=!0,!!h)for(let l=0;l<o;l++){const c=s[l];c._id!==void 0&&(t[c._id]=c)}}for(let i in t)t.hasOwnProperty(i)&&t[i].batchDraw()}static _animationLoop(){const t=ai;t.animations.length?(t._runFrames(),Td.Util.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Td.Util.requestAnimFrame(this._animationLoop))}}Cd=ds.Animation=ai,ai.animations=[],ai.animIdCounter=0,ai.animRunning=!1;const rl=St(xt({__proto__:null,get Animation(){return Cd},default:ds},[ds]));var sl={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Easings=n.Tween=void 0;const t=re,e=rl,i=le,r=Nt;var s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},a=1,o=2,h=3,l=0,c=["fill","stroke","shadowColor"];class d{constructor(m,v,b,S,E,_,x){this.prop=m,this.propFunc=v,this.begin=S,this._pos=S,this.duration=_,this._change=0,this.prevPos=0,this.yoyo=x,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=b,this._change=E-this.begin,this.pause()}fire(m){var v=this[m];v&&v()}setTime(m){m>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():m<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=m,this.update())}getTime(){return this._time}setPosition(m){this.prevPos=this._pos,this.propFunc(m),this._pos=m}getPosition(m){return m===void 0&&(m=this._time),this.func(m,this.begin,this._change,this.duration)}play(){this.state=o,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=h,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(m){this.pause(),this._time=m,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var m=this.getTimer()-this._startTime;this.state===o?this.setTime(m):this.state===h&&this.setTime(this.duration-m)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(m){var v=this,b=m.node,S=b._id,E,_=m.easing||n.Easings.Linear,x=!!m.yoyo,P;typeof m.duration>"u"?E=.3:m.duration===0?E=.001:E=m.duration,this.node=b,this._id=l++;var R=b.getLayer()||(b instanceof r.Konva.Stage?b.getLayers():null);R||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new e.Animation(function(){v.tween.onEnterFrame()},R),this.tween=new d(P,function(O){v._tweenFunc(O)},_,0,1,E*1e3,x),this._addListeners(),f.attrs[S]||(f.attrs[S]={}),f.attrs[S][this._id]||(f.attrs[S][this._id]={}),f.tweens[S]||(f.tweens[S]={});for(P in m)s[P]===void 0&&this._addAttr(P,m[P]);this.reset(),this.onFinish=m.onFinish,this.onReset=m.onReset,this.onUpdate=m.onUpdate}_addAttr(m,v){var b=this.node,S=b._id,E,_,x,P,R,O,L,$;if(x=f.tweens[S][m],x&&delete f.attrs[S][x][m],E=b.getAttr(m),t.Util._isArray(v))if(_=[],R=Math.max(v.length,E.length),m==="points"&&v.length!==E.length&&(v.length>E.length?(L=E,E=t.Util._prepareArrayForTween(E,v,b.closed())):(O=v,v=t.Util._prepareArrayForTween(v,E,b.closed()))),m.indexOf("fill")===0)for(P=0;P<R;P++)if(P%2===0)_.push(v[P]-E[P]);else{var U=t.Util.colorToRGBA(E[P]);$=t.Util.colorToRGBA(v[P]),E[P]=U,_.push({r:$.r-U.r,g:$.g-U.g,b:$.b-U.b,a:$.a-U.a})}else for(P=0;P<R;P++)_.push(v[P]-E[P]);else c.indexOf(m)!==-1?(E=t.Util.colorToRGBA(E),$=t.Util.colorToRGBA(v),_={r:$.r-E.r,g:$.g-E.g,b:$.b-E.b,a:$.a-E.a}):_=v-E;f.attrs[S][this._id][m]={start:E,diff:_,end:v,trueEnd:O,trueStart:L},f.tweens[S][m]=this._id}_tweenFunc(m){var v=this.node,b=f.attrs[v._id][this._id],S,E,_,x,P,R,O,L;for(S in b){if(E=b[S],_=E.start,x=E.diff,L=E.end,t.Util._isArray(_))if(P=[],O=Math.max(_.length,L.length),S.indexOf("fill")===0)for(R=0;R<O;R++)R%2===0?P.push((_[R]||0)+x[R]*m):P.push("rgba("+Math.round(_[R].r+x[R].r*m)+","+Math.round(_[R].g+x[R].g*m)+","+Math.round(_[R].b+x[R].b*m)+","+(_[R].a+x[R].a*m)+")");else for(R=0;R<O;R++)P.push((_[R]||0)+x[R]*m);else c.indexOf(S)!==-1?P="rgba("+Math.round(_.r+x.r*m)+","+Math.round(_.g+x.g*m)+","+Math.round(_.b+x.b*m)+","+(_.a+x.a*m)+")":P=_+x*m;v.setAttr(S,P)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var m=this.node,v=f.attrs[m._id][this._id];v.points&&v.points.trueEnd&&m.setAttr("points",v.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var m=this.node,v=f.attrs[m._id][this._id];v.points&&v.points.trueStart&&m.points(v.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(m){return this.tween.seek(m*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var m=this.node._id,v=this._id,b=f.tweens[m],S;this.pause();for(S in b)delete f.tweens[m][S];delete f.attrs[m][v]}}n.Tween=f,f.attrs={},f.tweens={},i.Node.prototype.to=function(u){var m=u.onFinish;u.node=this,u.onFinish=function(){this.destroy(),m&&m()};var v=new f(u);v.play()},n.Easings={BackEaseIn(u,m,v,b){var S=1.70158;return v*(u/=b)*u*((S+1)*u-S)+m},BackEaseOut(u,m,v,b){var S=1.70158;return v*((u=u/b-1)*u*((S+1)*u+S)+1)+m},BackEaseInOut(u,m,v,b){var S=1.70158;return(u/=b/2)<1?v/2*(u*u*(((S*=1.525)+1)*u-S))+m:v/2*((u-=2)*u*(((S*=1.525)+1)*u+S)+2)+m},ElasticEaseIn(u,m,v,b,S,E){var _=0;return u===0?m:(u/=b)===1?m+v:(E||(E=b*.3),!S||S<Math.abs(v)?(S=v,_=E/4):_=E/(2*Math.PI)*Math.asin(v/S),-(S*Math.pow(2,10*(u-=1))*Math.sin((u*b-_)*(2*Math.PI)/E))+m)},ElasticEaseOut(u,m,v,b,S,E){var _=0;return u===0?m:(u/=b)===1?m+v:(E||(E=b*.3),!S||S<Math.abs(v)?(S=v,_=E/4):_=E/(2*Math.PI)*Math.asin(v/S),S*Math.pow(2,-10*u)*Math.sin((u*b-_)*(2*Math.PI)/E)+v+m)},ElasticEaseInOut(u,m,v,b,S,E){var _=0;return u===0?m:(u/=b/2)===2?m+v:(E||(E=b*(.3*1.5)),!S||S<Math.abs(v)?(S=v,_=E/4):_=E/(2*Math.PI)*Math.asin(v/S),u<1?-.5*(S*Math.pow(2,10*(u-=1))*Math.sin((u*b-_)*(2*Math.PI)/E))+m:S*Math.pow(2,-10*(u-=1))*Math.sin((u*b-_)*(2*Math.PI)/E)*.5+v+m)},BounceEaseOut(u,m,v,b){return(u/=b)<1/2.75?v*(7.5625*u*u)+m:u<2/2.75?v*(7.5625*(u-=1.5/2.75)*u+.75)+m:u<2.5/2.75?v*(7.5625*(u-=2.25/2.75)*u+.9375)+m:v*(7.5625*(u-=2.625/2.75)*u+.984375)+m},BounceEaseIn(u,m,v,b){return v-n.Easings.BounceEaseOut(b-u,0,v,b)+m},BounceEaseInOut(u,m,v,b){return u<b/2?n.Easings.BounceEaseIn(u*2,0,v,b)*.5+m:n.Easings.BounceEaseOut(u*2-b,0,v,b)*.5+v*.5+m},EaseIn(u,m,v,b){return v*(u/=b)*u+m},EaseOut(u,m,v,b){return-v*(u/=b)*(u-2)+m},EaseInOut(u,m,v,b){return(u/=b/2)<1?v/2*u*u+m:-v/2*(--u*(u-2)-1)+m},StrongEaseIn(u,m,v,b){return v*(u/=b)*u*u*u*u+m},StrongEaseOut(u,m,v,b){return v*((u=u/b-1)*u*u*u*u+1)+m},StrongEaseInOut(u,m,v,b){return(u/=b/2)<1?v/2*u*u*u*u*u+m:v/2*((u-=2)*u*u*u*u+2)+m},Linear(u,m,v,b){return v*u/b+m}}})(sl);const H5=St(xt({__proto__:null,default:Pe(sl)},[sl]));(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Konva=void 0;const t=Nt,e=re,i=le,r=Ya,s=A5,a=bd,o=B5,h=el,l=Hh,c=me,d=rl,f=H5,u=Kf,m=za;n.Konva=e.Util._assign(t.Konva,{Util:e.Util,Transform:e.Transform,Node:i.Node,Container:r.Container,Stage:s.Stage,stages:s.stages,Layer:a.Layer,FastLayer:o.FastLayer,Group:h.Group,DD:l.DD,Shape:c.Shape,shapes:c.shapes,Animation:d.Animation,Tween:f.Tween,Easings:f.Easings,Context:u.Context,Canvas:m.Canvas}),n.default=n.Konva})(Uh);const j5=St(xt({__proto__:null,default:Pe(Uh)},[Uh]));var gs={};Object.defineProperty(gs,"__esModule",{value:!0});var kd=gs.Arc=void 0;const qa=Ot,X5=me,Ed=Nt,Wa=Gt,Y5=Nt;class Pi extends X5.Shape{_sceneFunc(t){var e=Ed.Konva.getAngle(this.angle()),i=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,i),t.arc(0,0,this.innerRadius(),e,0,!i),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),i=this.clockwise(),r=Ed.Konva.getAngle(i?360-this.angle():this.angle()),s=Math.cos(Math.min(r,Math.PI)),a=1,o=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),h=Math.sin(Math.min(r,Math.PI/2)),l=s*(s>0?t:e),c=a*e,d=o*(o>0?t:e),f=h*(h>0?e:t);return{x:l,y:i?-1*f:d,width:c-l,height:f-d}}}kd=gs.Arc=Pi,Pi.prototype._centroid=!0,Pi.prototype.className="Arc",Pi.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,Y5._registerNode)(Pi),qa.Factory.addGetterSetter(Pi,"innerRadius",0,(0,Wa.getNumberValidator)()),qa.Factory.addGetterSetter(Pi,"outerRadius",0,(0,Wa.getNumberValidator)()),qa.Factory.addGetterSetter(Pi,"angle",0,(0,Wa.getNumberValidator)()),qa.Factory.addGetterSetter(Pi,"clockwise",!1,(0,Wa.getBooleanValidator)());const q5=St(xt({__proto__:null,get Arc(){return kd},default:gs},[gs]));var ps={},ms={};Object.defineProperty(ms,"__esModule",{value:!0});var Pd=ms.Line=void 0;const Ka=Ot,W5=me,Ad=Gt,K5=Nt;function al(n,t,e,i,r,s,a){var o=Math.sqrt(Math.pow(e-n,2)+Math.pow(i-t,2)),h=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-i,2)),l=a*o/(o+h),c=a*h/(o+h),d=e-l*(r-n),f=i-l*(s-t),u=e+c*(r-n),m=i+c*(s-t);return[d,f,u,m]}function Md(n,t){var e=n.length,i=[],r,s;for(r=2;r<e-2;r+=2)s=al(n[r-2],n[r-1],n[r],n[r+1],n[r+2],n[r+3],t),!isNaN(s[0])&&(i.push(s[0]),i.push(s[1]),i.push(n[r]),i.push(n[r+1]),i.push(s[2]),i.push(s[3]));return i}class Ji extends W5.Shape{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){var e=this.points(),i=e.length,r=this.tension(),s=this.closed(),a=this.bezier(),o,h,l;if(i){if(t.beginPath(),t.moveTo(e[0],e[1]),r!==0&&i>4){for(o=this.getTensionPoints(),h=o.length,l=s?0:4,s||t.quadraticCurveTo(o[0],o[1],o[2],o[3]);l<h-2;)t.bezierCurveTo(o[l++],o[l++],o[l++],o[l++],o[l++],o[l++]);s||t.quadraticCurveTo(o[h-2],o[h-1],e[i-2],e[i-1])}else if(a)for(l=2;l<i;)t.bezierCurveTo(e[l++],e[l++],e[l++],e[l++],e[l++],e[l++]);else for(l=2;l<i;l+=2)t.lineTo(e[l],e[l+1]);s?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Md(this.points(),this.tension())}_getTensionPointsClosed(){var t=this.points(),e=t.length,i=this.tension(),r=al(t[e-2],t[e-1],t[0],t[1],t[2],t[3],i),s=al(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],i),a=Md(t,i),o=[r[2],r[3]].concat(a).concat([s[0],s[1],t[e-2],t[e-1],s[2],s[3],r[0],r[1],t[0],t[1]]);return o}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};this.tension()!==0?t=[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:t=this.points();for(var e=t[0],i=t[0],r=t[1],s=t[1],a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],e=Math.min(e,a),i=Math.max(i,a),r=Math.min(r,o),s=Math.max(s,o);return{x:e,y:r,width:i-e,height:s-r}}}Pd=ms.Line=Ji,Ji.prototype.className="Line",Ji.prototype._attrsAffectingSize=["points","bezier","tension"],(0,K5._registerNode)(Ji),Ka.Factory.addGetterSetter(Ji,"closed",!1),Ka.Factory.addGetterSetter(Ji,"bezier",!1),Ka.Factory.addGetterSetter(Ji,"tension",0,(0,Ad.getNumberValidator)()),Ka.Factory.addGetterSetter(Ji,"points",[],(0,Ad.getNumberArrayValidator)());const Rd=St(xt({__proto__:null,get Line(){return Pd},default:ms},[ms]));var vs={},ol={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.t2length=n.getQuadraticArcLength=n.getCubicArcLength=n.binomialCoefficients=n.cValues=n.tValues=void 0,n.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],n.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],n.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const t=(a,o,h)=>{let l,c,d;l=h/2,c=0;for(let u=0;u<20;u++)d=l*n.tValues[20][u]+l,c+=n.cValues[20][u]*i(a,o,d);return l*c};n.getCubicArcLength=t;const e=(a,o,h)=>{h===void 0&&(h=1);const l=a[0]-2*a[1]+a[2],c=o[0]-2*o[1]+o[2],d=2*a[1]-2*a[0],f=2*o[1]-2*o[0],u=4*(l*l+c*c),m=4*(l*d+c*f),v=d*d+f*f;if(u===0)return h*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(o[2]-o[0],2));const b=m/(2*u),S=v/u,E=h+b,_=S-b*b,x=E*E+_>0?Math.sqrt(E*E+_):0,P=b*b+_>0?Math.sqrt(b*b+_):0,R=b+Math.sqrt(b*b+_)!==0?_*Math.log(Math.abs((E+x)/(b+P))):0;return Math.sqrt(u)/2*(E*x-b*P+R)};n.getQuadraticArcLength=e;function i(a,o,h){const l=r(1,h,a),c=r(1,h,o),d=l*l+c*c;return Math.sqrt(d)}const r=(a,o,h)=>{const l=h.length-1;let c,d;if(l===0)return 0;if(a===0){d=0;for(let f=0;f<=l;f++)d+=n.binomialCoefficients[l][f]*Math.pow(1-o,l-f)*Math.pow(o,f)*h[f];return d}else{c=new Array(l);for(let f=0;f<l;f++)c[f]=l*(h[f+1]-h[f]);return r(a-1,o,c)}},s=(a,o,h)=>{let l=1,c=a/o,d=(a-h(c))/o,f=0;for(;l>.001;){const u=h(c+d),m=Math.abs(a-u)/o;if(m<l)l=m,c+=d;else{const v=h(c-d),b=Math.abs(a-v)/o;b<l?(l=b,c-=d):d/=2}if(f++,f>500)break}return c};n.t2length=s})(ol);const Z5=St(xt({__proto__:null,default:Pe(ol)},[ol]));Object.defineProperty(vs,"__esModule",{value:!0});var Dd=vs.Path=void 0;const J5=Ot,Q5=me,t3=Nt,ar=Z5;class ue extends Q5.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ue.parsePathData(this.data()),this.pathLength=ue.getPathLength(this.dataArray)}_sceneFunc(t){var e=this.dataArray;t.beginPath();for(var i=!1,r=0;r<e.length;r++){var s=e[r].command,a=e[r].points;switch(s){case"L":t.lineTo(a[0],a[1]);break;case"M":t.moveTo(a[0],a[1]);break;case"C":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":t.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":var o=a[0],h=a[1],l=a[2],c=a[3],d=a[4],f=a[5],u=a[6],m=a[7],v=l>c?l:c,b=l>c?1:l/c,S=l>c?c/l:1;t.translate(o,h),t.rotate(u),t.scale(b,S),t.arc(0,0,v,d,d+f,1-m),t.scale(1/b,1/S),t.rotate(-u),t.translate(-o,-h);break;case"z":i=!0,t.closePath();break}}!i&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(l){if(l.command==="A"){var c=l.points[4],d=l.points[5],f=l.points[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),d<0)for(let m=c-u;m>f;m-=u){const v=ue.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(v.x,v.y)}else for(let m=c+u;m<f;m+=u){const v=ue.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(v.x,v.y)}}else if(l.command==="C")for(let m=0;m<=1;m+=.01){const v=ue.getPointOnCubicBezier(m,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(v.x,v.y)}else t=t.concat(l.points)});for(var e=t[0],i=t[0],r=t[1],s=t[1],a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],isNaN(a)||(e=Math.min(e,a),i=Math.max(i,a)),isNaN(o)||(r=Math.min(r,o),s=Math.max(s,o));return{x:e,y:r,width:i-e,height:s-r}}getLength(){return this.pathLength}getPointAtLength(t){return ue.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}static getPathLength(t){let e=0;for(var i=0;i<t.length;++i)e+=t[i].pathLength;return e}static getPointAtLengthOfDataArray(t,e){var i,r=0,s=e.length;if(!s)return null;for(;r<s&&t>e[r].pathLength;)t-=e[r].pathLength,++r;if(r===s)return i=e[r-1].points.slice(-2),{x:i[0],y:i[1]};if(t<.01)return i=e[r].points.slice(0,2),{x:i[0],y:i[1]};var a=e[r],o=a.points;switch(a.command){case"L":return ue.getPointOnLine(t,a.start.x,a.start.y,o[0],o[1]);case"C":return ue.getPointOnCubicBezier((0,ar.t2length)(t,ue.getPathLength(e),v=>(0,ar.getCubicArcLength)([a.start.x,o[0],o[2],o[4]],[a.start.y,o[1],o[3],o[5]],v)),a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return ue.getPointOnQuadraticBezier((0,ar.t2length)(t,ue.getPathLength(e),v=>(0,ar.getQuadraticArcLength)([a.start.x,o[0],o[2]],[a.start.y,o[1],o[3]],v)),a.start.x,a.start.y,o[0],o[1],o[2],o[3]);case"A":var h=o[0],l=o[1],c=o[2],d=o[3],f=o[4],u=o[5],m=o[6];return f+=u*t/a.pathLength,ue.getPointOnEllipticalArc(h,l,c,d,f,m)}return null}static getPointOnLine(t,e,i,r,s,a,o){a===void 0&&(a=e),o===void 0&&(o=i);var h=(s-i)/(r-e+1e-8),l=Math.sqrt(t*t/(1+h*h));r<e&&(l*=-1);var c=h*l,d;if(r===e)d={x:a,y:o+c};else if((o-i)/(a-e+1e-8)===h)d={x:a+l,y:o+c};else{var f,u,m=this.getLineLength(e,i,r,s),v=(a-e)*(r-e)+(o-i)*(s-i);v=v/(m*m),f=e+v*(r-e),u=i+v*(s-i);var b=this.getLineLength(a,o,f,u),S=Math.sqrt(t*t-b*b);l=Math.sqrt(S*S/(1+h*h)),r<e&&(l*=-1),c=h*l,d={x:f+l,y:u+c}}return d}static getPointOnCubicBezier(t,e,i,r,s,a,o,h,l){function c(b){return b*b*b}function d(b){return 3*b*b*(1-b)}function f(b){return 3*b*(1-b)*(1-b)}function u(b){return(1-b)*(1-b)*(1-b)}var m=h*c(t)+a*d(t)+r*f(t)+e*u(t),v=l*c(t)+o*d(t)+s*f(t)+i*u(t);return{x:m,y:v}}static getPointOnQuadraticBezier(t,e,i,r,s,a,o){function h(u){return u*u}function l(u){return 2*u*(1-u)}function c(u){return(1-u)*(1-u)}var d=a*h(t)+r*l(t)+e*c(t),f=o*h(t)+s*l(t)+i*c(t);return{x:d,y:f}}static getPointOnEllipticalArc(t,e,i,r,s,a){var o=Math.cos(a),h=Math.sin(a),l={x:i*Math.cos(s),y:r*Math.sin(s)};return{x:t+(l.x*o-l.y*h),y:e+(l.x*h+l.y*o)}}static parsePathData(t){if(!t)return[];var e=t,i=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var r=0;r<i.length;r++)e=e.replace(new RegExp(i[r],"g"),"|"+i[r]);var s=e.split("|"),a=[],o=[],h=0,l=0,c=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,d;for(r=1;r<s.length;r++){var f=s[r],u=f.charAt(0);for(f=f.slice(1),o.length=0;d=c.exec(f);)o.push(d[0]);for(var m=[],v=0,b=o.length;v<b;v++){if(o[v]==="00"){m.push(0,0);continue}var S=parseFloat(o[v]);isNaN(S)?m.push(0):m.push(S)}for(;m.length>0&&!isNaN(m[0]);){var E="",_=[],x=h,P=l,R,O,L,$,U,z,q,K,Z,at;switch(u){case"l":h+=m.shift(),l+=m.shift(),E="L",_.push(h,l);break;case"L":h=m.shift(),l=m.shift(),_.push(h,l);break;case"m":var vt=m.shift(),_t=m.shift();if(h+=vt,l+=_t,E="M",a.length>2&&a[a.length-1].command==="z"){for(var pt=a.length-2;pt>=0;pt--)if(a[pt].command==="M"){h=a[pt].points[0]+vt,l=a[pt].points[1]+_t;break}}_.push(h,l),u="l";break;case"M":h=m.shift(),l=m.shift(),E="M",_.push(h,l),u="L";break;case"h":h+=m.shift(),E="L",_.push(h,l);break;case"H":h=m.shift(),E="L",_.push(h,l);break;case"v":l+=m.shift(),E="L",_.push(h,l);break;case"V":l=m.shift(),E="L",_.push(h,l);break;case"C":_.push(m.shift(),m.shift(),m.shift(),m.shift()),h=m.shift(),l=m.shift(),_.push(h,l);break;case"c":_.push(h+m.shift(),l+m.shift(),h+m.shift(),l+m.shift()),h+=m.shift(),l+=m.shift(),E="C",_.push(h,l);break;case"S":O=h,L=l,R=a[a.length-1],R.command==="C"&&(O=h+(h-R.points[2]),L=l+(l-R.points[3])),_.push(O,L,m.shift(),m.shift()),h=m.shift(),l=m.shift(),E="C",_.push(h,l);break;case"s":O=h,L=l,R=a[a.length-1],R.command==="C"&&(O=h+(h-R.points[2]),L=l+(l-R.points[3])),_.push(O,L,h+m.shift(),l+m.shift()),h+=m.shift(),l+=m.shift(),E="C",_.push(h,l);break;case"Q":_.push(m.shift(),m.shift()),h=m.shift(),l=m.shift(),_.push(h,l);break;case"q":_.push(h+m.shift(),l+m.shift()),h+=m.shift(),l+=m.shift(),E="Q",_.push(h,l);break;case"T":O=h,L=l,R=a[a.length-1],R.command==="Q"&&(O=h+(h-R.points[0]),L=l+(l-R.points[1])),h=m.shift(),l=m.shift(),E="Q",_.push(O,L,h,l);break;case"t":O=h,L=l,R=a[a.length-1],R.command==="Q"&&(O=h+(h-R.points[0]),L=l+(l-R.points[1])),h+=m.shift(),l+=m.shift(),E="Q",_.push(O,L,h,l);break;case"A":$=m.shift(),U=m.shift(),z=m.shift(),q=m.shift(),K=m.shift(),Z=h,at=l,h=m.shift(),l=m.shift(),E="A",_=this.convertEndpointToCenterParameterization(Z,at,h,l,q,K,$,U,z);break;case"a":$=m.shift(),U=m.shift(),z=m.shift(),q=m.shift(),K=m.shift(),Z=h,at=l,h+=m.shift(),l+=m.shift(),E="A",_=this.convertEndpointToCenterParameterization(Z,at,h,l,q,K,$,U,z);break}a.push({command:E||u,points:_,start:{x,y:P},pathLength:this.calcLength(x,P,E||u,_)})}(u==="z"||u==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,e,i,r){var s,a,o,h,l=ue;switch(i){case"L":return l.getLineLength(t,e,r[0],r[1]);case"C":return(0,ar.getCubicArcLength)([t,r[0],r[2],r[4]],[e,r[1],r[3],r[5]],1);case"Q":return(0,ar.getQuadraticArcLength)([t,r[0],r[2]],[e,r[1],r[3]],1);case"A":s=0;var c=r[4],d=r[5],f=r[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),a=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),d<0)for(h=c-u;h>f;h-=u)o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),a=o;else for(h=c+u;h<f;h+=u)o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),a=o;return o=l.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],f,0),s+=l.getLineLength(a.x,a.y,o.x,o.y),s}return 0}static convertEndpointToCenterParameterization(t,e,i,r,s,a,o,h,l){var c=l*(Math.PI/180),d=Math.cos(c)*(t-i)/2+Math.sin(c)*(e-r)/2,f=-1*Math.sin(c)*(t-i)/2+Math.cos(c)*(e-r)/2,u=d*d/(o*o)+f*f/(h*h);u>1&&(o*=Math.sqrt(u),h*=Math.sqrt(u));var m=Math.sqrt((o*o*(h*h)-o*o*(f*f)-h*h*(d*d))/(o*o*(f*f)+h*h*(d*d)));s===a&&(m*=-1),isNaN(m)&&(m=0);var v=m*o*f/h,b=m*-h*d/o,S=(t+i)/2+Math.cos(c)*v-Math.sin(c)*b,E=(e+r)/2+Math.sin(c)*v+Math.cos(c)*b,_=function(U){return Math.sqrt(U[0]*U[0]+U[1]*U[1])},x=function(U,z){return(U[0]*z[0]+U[1]*z[1])/(_(U)*_(z))},P=function(U,z){return(U[0]*z[1]<U[1]*z[0]?-1:1)*Math.acos(x(U,z))},R=P([1,0],[(d-v)/o,(f-b)/h]),O=[(d-v)/o,(f-b)/h],L=[(-1*d-v)/o,(-1*f-b)/h],$=P(O,L);return x(O,L)<=-1&&($=Math.PI),x(O,L)>=1&&($=0),a===0&&$>0&&($=$-2*Math.PI),a===1&&$<0&&($=$+2*Math.PI),[S,E,o,h,R,$,c,a]}}Dd=vs.Path=ue,ue.prototype.className="Path",ue.prototype._attrsAffectingSize=["data"],(0,t3._registerNode)(ue),J5.Factory.addGetterSetter(ue,"data");const hl=St(xt({__proto__:null,get Path(){return Dd},default:vs},[vs]));Object.defineProperty(ps,"__esModule",{value:!0});var Ld=ps.Arrow=void 0;const Za=Ot,e3=Rd,Id=Gt,i3=Nt,Fd=hl;class Pn extends e3.Line{_sceneFunc(t){super._sceneFunc(t);var e=Math.PI*2,i=this.points(),r=i,s=this.tension()!==0&&i.length>4;s&&(r=this.getTensionPoints());var a=this.pointerLength(),o=i.length,h,l;if(s){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],i[o-2],i[o-1]],u=Fd.Path.calcLength(r[r.length-4],r[r.length-3],"C",f),m=Fd.Path.getPointOnQuadraticBezier(Math.min(1,1-a/u),f[0],f[1],f[2],f[3],f[4],f[5]);h=i[o-2]-m.x,l=i[o-1]-m.y}else h=i[o-2]-i[o-4],l=i[o-1]-i[o-3];var c=(Math.atan2(l,h)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(i[o-2],i[o-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(i[0],i[1]),s?(h=(r[0]+r[2])/2-i[0],l=(r[1]+r[3])/2-i[1]):(h=i[2]-i[0],l=i[3]-i[1]),t.rotate((Math.atan2(-l,-h)+e)%e),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x-e,y:t.y-e,width:t.width+e*2,height:t.height+e*2}}}Ld=ps.Arrow=Pn,Pn.prototype.className="Arrow",(0,i3._registerNode)(Pn),Za.Factory.addGetterSetter(Pn,"pointerLength",10,(0,Id.getNumberValidator)()),Za.Factory.addGetterSetter(Pn,"pointerWidth",10,(0,Id.getNumberValidator)()),Za.Factory.addGetterSetter(Pn,"pointerAtBeginning",!1),Za.Factory.addGetterSetter(Pn,"pointerAtEnding",!0);const n3=St(xt({__proto__:null,get Arrow(){return Ld},default:ps},[ps]));var _s={};Object.defineProperty(_s,"__esModule",{value:!0});var Od=_s.Circle=void 0;const r3=Ot,s3=me,a3=Gt,o3=Nt;class or extends s3.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}Od=_s.Circle=or,or.prototype._centroid=!0,or.prototype.className="Circle",or.prototype._attrsAffectingSize=["radius"],(0,o3._registerNode)(or),r3.Factory.addGetterSetter(or,"radius",0,(0,a3.getNumberValidator)());const h3=St(xt({__proto__:null,get Circle(){return Od},default:_s},[_s]));var ys={};Object.defineProperty(ys,"__esModule",{value:!0});var Nd=ys.Ellipse=void 0;const ll=Ot,l3=me,Gd=Gt,c3=Nt;class Qi extends l3.Shape{_sceneFunc(t){var e=this.radiusX(),i=this.radiusY();t.beginPath(),t.save(),e!==i&&t.scale(1,i/e),t.arc(0,0,e,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}Nd=ys.Ellipse=Qi,Qi.prototype.className="Ellipse",Qi.prototype._centroid=!0,Qi.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,c3._registerNode)(Qi),ll.Factory.addComponentsGetterSetter(Qi,"radius",["x","y"]),ll.Factory.addGetterSetter(Qi,"radiusX",0,(0,Gd.getNumberValidator)()),ll.Factory.addGetterSetter(Qi,"radiusY",0,(0,Gd.getNumberValidator)());const u3=St(xt({__proto__:null,get Ellipse(){return Nd},default:ys},[ys]));var ws={};Object.defineProperty(ws,"__esModule",{value:!0});var Ud=ws.Image=void 0;const cl=re,An=Ot,f3=me,d3=Nt,bs=Gt;let oi=class P1 extends f3.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const e=this.getWidth(),i=this.getHeight(),r=this.cornerRadius(),s=this.attrs.image;let a;if(s){const o=this.attrs.cropWidth,h=this.attrs.cropHeight;o&&h?a=[s,this.cropX(),this.cropY(),o,h,0,0,e,i]:a=[s,0,0,e,i]}(this.hasFill()||this.hasStroke()||r)&&(t.beginPath(),r?cl.Util.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)),s&&(r&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var e=this.width(),i=this.height(),r=this.cornerRadius();t.beginPath(),r?cl.Util.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e;return(t=this.attrs.width)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.width}getHeight(){var t,e;return(t=this.attrs.height)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.height}static fromURL(t,e,i=null){var r=cl.Util.createImageElement();r.onload=function(){var s=new P1({image:r});e(s)},r.onerror=i,r.crossOrigin="Anonymous",r.src=t}};Ud=ws.Image=oi,oi.prototype.className="Image",(0,d3._registerNode)(oi),An.Factory.addGetterSetter(oi,"cornerRadius",0,(0,bs.getNumberOrArrayOfNumbersValidator)(4)),An.Factory.addGetterSetter(oi,"image"),An.Factory.addComponentsGetterSetter(oi,"crop",["x","y","width","height"]),An.Factory.addGetterSetter(oi,"cropX",0,(0,bs.getNumberValidator)()),An.Factory.addGetterSetter(oi,"cropY",0,(0,bs.getNumberValidator)()),An.Factory.addGetterSetter(oi,"cropWidth",0,(0,bs.getNumberValidator)()),An.Factory.addGetterSetter(oi,"cropHeight",0,(0,bs.getNumberValidator)());const g3=St(xt({__proto__:null,get Image(){return Ud},default:ws},[ws]));var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});var Bd=Mn.Tag=Vd=Mn.Label=void 0;const Ja=Ot,p3=me,m3=el,ul=Gt,zd=Nt;var $d=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],v3="Change.konva",_3="none",fl="up",dl="right",gl="down",pl="left",y3=$d.length;class ml extends m3.Group{constructor(t){super(t),this.on("add.konva",function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var e=this,i,r=function(){e._sync()};for(i=0;i<y3;i++)t.on($d[i]+v3,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var t=this.getText(),e=this.getTag(),i,r,s,a,o,h,l;if(t&&e){switch(i=t.width(),r=t.height(),s=e.pointerDirection(),a=e.pointerWidth(),l=e.pointerHeight(),o=0,h=0,s){case fl:o=i/2,h=-1*l;break;case dl:o=i+a,h=r/2;break;case gl:o=i/2,h=r+l;break;case pl:o=-1*a,h=r/2;break}e.setAttrs({x:-1*o,y:-1*h,width:i,height:r}),t.setAttrs({x:-1*o,y:-1*h})}}}var Vd=Mn.Label=ml;ml.prototype.className="Label",(0,zd._registerNode)(ml);class Rn extends p3.Shape{_sceneFunc(t){var e=this.width(),i=this.height(),r=this.pointerDirection(),s=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius();let h=0,l=0,c=0,d=0;typeof o=="number"?h=l=c=d=Math.min(o,e/2,i/2):(h=Math.min(o[0]||0,e/2,i/2),l=Math.min(o[1]||0,e/2,i/2),d=Math.min(o[2]||0,e/2,i/2),c=Math.min(o[3]||0,e/2,i/2)),t.beginPath(),t.moveTo(h,0),r===fl&&(t.lineTo((e-s)/2,0),t.lineTo(e/2,-1*a),t.lineTo((e+s)/2,0)),t.lineTo(e-l,0),t.arc(e-l,l,l,Math.PI*3/2,0,!1),r===dl&&(t.lineTo(e,(i-a)/2),t.lineTo(e+s,i/2),t.lineTo(e,(i+a)/2)),t.lineTo(e,i-d),t.arc(e-d,i-d,d,0,Math.PI/2,!1),r===gl&&(t.lineTo((e+s)/2,i),t.lineTo(e/2,i+a),t.lineTo((e-s)/2,i)),t.lineTo(c,i),t.arc(c,i-c,c,Math.PI/2,Math.PI,!1),r===pl&&(t.lineTo(0,(i+a)/2),t.lineTo(-1*s,i/2),t.lineTo(0,(i-a)/2)),t.lineTo(0,h),t.arc(h,h,h,Math.PI,Math.PI*3/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){var t=0,e=0,i=this.pointerWidth(),r=this.pointerHeight(),s=this.pointerDirection(),a=this.width(),o=this.height();return s===fl?(e-=r,o+=r):s===gl?o+=r:s===pl?(t-=i*1.5,a+=i):s===dl&&(a+=i*1.5),{x:t,y:e,width:a,height:o}}}Bd=Mn.Tag=Rn,Rn.prototype.className="Tag",(0,zd._registerNode)(Rn),Ja.Factory.addGetterSetter(Rn,"pointerDirection",_3),Ja.Factory.addGetterSetter(Rn,"pointerWidth",0,(0,ul.getNumberValidator)()),Ja.Factory.addGetterSetter(Rn,"pointerHeight",0,(0,ul.getNumberValidator)()),Ja.Factory.addGetterSetter(Rn,"cornerRadius",0,(0,ul.getNumberOrArrayOfNumbersValidator)(4));const w3=St(xt({__proto__:null,get Label(){return Vd},get Tag(){return Bd},default:Mn},[Mn]));var xs={};Object.defineProperty(xs,"__esModule",{value:!0});var Hd=xs.Rect=void 0;const b3=Ot,x3=me,S3=Nt,C3=re,T3=Gt;class Qa extends x3.Shape{_sceneFunc(t){var e=this.cornerRadius(),i=this.width(),r=this.height();t.beginPath(),e?C3.Util.drawRoundedRectPath(t,i,r,e):t.rect(0,0,i,r),t.closePath(),t.fillStrokeShape(this)}}Hd=xs.Rect=Qa,Qa.prototype.className="Rect",(0,S3._registerNode)(Qa),b3.Factory.addGetterSetter(Qa,"cornerRadius",0,(0,T3.getNumberOrArrayOfNumbersValidator)(4));const jd=St(xt({__proto__:null,get Rect(){return Hd},default:xs},[xs]));var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});var Xd=Ss.RegularPolygon=void 0;const Yd=Ot,k3=me,qd=Gt,E3=Nt;class Dn extends k3.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(var i=1;i<e.length;i++)t.lineTo(e[i].x,e[i].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,i=[];for(var r=0;r<t;r++)i.push({x:e*Math.sin(r*2*Math.PI/t),y:-1*e*Math.cos(r*2*Math.PI/t)});return i}getSelfRect(){const t=this._getPoints();var e=t[0].x,i=t[0].y,r=t[0].x,s=t[0].y;return t.forEach(a=>{e=Math.min(e,a.x),i=Math.max(i,a.x),r=Math.min(r,a.y),s=Math.max(s,a.y)}),{x:e,y:r,width:i-e,height:s-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}Xd=Ss.RegularPolygon=Dn,Dn.prototype.className="RegularPolygon",Dn.prototype._centroid=!0,Dn.prototype._attrsAffectingSize=["radius"],(0,E3._registerNode)(Dn),Yd.Factory.addGetterSetter(Dn,"radius",0,(0,qd.getNumberValidator)()),Yd.Factory.addGetterSetter(Dn,"sides",0,(0,qd.getNumberValidator)());const P3=St(xt({__proto__:null,get RegularPolygon(){return Xd},default:Ss},[Ss]));var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});var Wd=Cs.Ring=void 0;const Kd=Ot,A3=me,Zd=Gt,M3=Nt;var Jd=Math.PI*2;class Ln extends A3.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,Jd,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),Jd,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}Wd=Cs.Ring=Ln,Ln.prototype.className="Ring",Ln.prototype._centroid=!0,Ln.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,M3._registerNode)(Ln),Kd.Factory.addGetterSetter(Ln,"innerRadius",0,(0,Zd.getNumberValidator)()),Kd.Factory.addGetterSetter(Ln,"outerRadius",0,(0,Zd.getNumberValidator)());const R3=St(xt({__proto__:null,get Ring(){return Wd},default:Cs},[Cs]));var Ts={};Object.defineProperty(Ts,"__esModule",{value:!0});var Qd=Ts.Sprite=void 0;const In=Ot,D3=me,L3=rl,t0=Gt,I3=Nt;class hi extends D3.Shape{constructor(t){super(t),this._updated=!0,this.anim=new L3.Animation(()=>{var e=this._updated;return this._updated=!1,e}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var e=this.animation(),i=this.frameIndex(),r=i*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+0],h=s[r+1],l=s[r+2],c=s[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,l,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[e],u=i*2;t.drawImage(d,o,h,l,c,f[u+0],f[u+1],l,c)}else t.drawImage(d,o,h,l,c,0,0,l,c)}_hitFunc(t){var e=this.animation(),i=this.frameIndex(),r=i*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+2],h=s[r+3];if(t.beginPath(),a){var l=a[e],c=i*2;t.rect(l[c+0],l[c+1],o,h)}else t.rect(0,0,o,h);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),e=this.animation(),i=this.animations(),r=i[e],s=r.length/4;t<s-1?this.frameIndex(t+1):this.frameIndex(0)}}Qd=Ts.Sprite=hi,hi.prototype.className="Sprite",(0,I3._registerNode)(hi),In.Factory.addGetterSetter(hi,"animation"),In.Factory.addGetterSetter(hi,"animations"),In.Factory.addGetterSetter(hi,"frameOffsets"),In.Factory.addGetterSetter(hi,"image"),In.Factory.addGetterSetter(hi,"frameIndex",0,(0,t0.getNumberValidator)()),In.Factory.addGetterSetter(hi,"frameRate",17,(0,t0.getNumberValidator)()),In.Factory.backCompat(hi,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});const F3=St(xt({__proto__:null,get Sprite(){return Qd},default:Ts},[Ts]));var ks={};Object.defineProperty(ks,"__esModule",{value:!0});var e0=ks.Star=void 0;const vl=Ot,O3=me,_l=Gt,N3=Nt;class tn extends O3.Shape{_sceneFunc(t){var e=this.innerRadius(),i=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-i);for(var s=1;s<r*2;s++){var a=s%2===0?i:e,o=a*Math.sin(s*Math.PI/r),h=-1*a*Math.cos(s*Math.PI/r);t.lineTo(o,h)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}e0=ks.Star=tn,tn.prototype.className="Star",tn.prototype._centroid=!0,tn.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,N3._registerNode)(tn),vl.Factory.addGetterSetter(tn,"numPoints",5,(0,_l.getNumberValidator)()),vl.Factory.addGetterSetter(tn,"innerRadius",0,(0,_l.getNumberValidator)()),vl.Factory.addGetterSetter(tn,"outerRadius",0,(0,_l.getNumberValidator)());const G3=St(xt({__proto__:null,get Star(){return e0},default:ks},[ks]));var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});var i0=Fn.Text=r0=Fn.stringToArray=void 0;const yl=re,xe=Ot,U3=me,en=Gt,B3=Nt;function n0(n){return Array.from(n)}var r0=Fn.stringToArray=n0,hr="auto",z3="center",s0="inherit",Es="justify",$3="Change.konva",V3="2d",a0="-",o0="left",H3="text",j3="Text",X3="top",Y3="bottom",h0="middle",l0="normal",q3="px ",to=" ",W3="right",c0="rtl",K3="word",Z3="char",u0="none",wl="…",f0=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],J3=f0.length;function Q3(n){return n.split(",").map(t=>{t=t.trim();const e=t.indexOf(" ")>=0,i=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!i&&(t=`"${t}"`),t}).join(", ")}var eo;function bl(){return eo||(eo=yl.Util.createCanvasElement().getContext(V3),eo)}function ty(n){n.fillText(this._partialText,this._partialTextX,this._partialTextY)}function ey(n){n.setAttr("miterLimit",2),n.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function iy(n){return n=n||{},!n.fillLinearGradientColorStops&&!n.fillRadialGradientColorStops&&!n.fillPatternImage&&(n.fill=n.fill||"black"),n}class ae extends U3.Shape{constructor(t){super(iy(t)),this._partialTextX=0,this._partialTextY=0;for(var e=0;e<J3;e++)this.on(f0[e]+$3,this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,i=e.length;if(this.text()){var r=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,o=this.verticalAlign(),h=this.direction(),l=0,c=this.align(),d=this.getWidth(),f=this.letterSpacing(),u=this.fill(),m=this.textDecoration(),v=m.indexOf("underline")!==-1,b=m.indexOf("line-through")!==-1,S;h=h===s0?t.direction:h;var E=0,E=a/2,_=0,x=0;for(h===c0&&t.setAttr("direction",h),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",h0),t.setAttr("textAlign",o0),o===h0?l=(this.getHeight()-i*a-r*2)/2:o===Y3&&(l=this.getHeight()-i*a-r*2),t.translate(r,l+r),S=0;S<i;S++){var _=0,x=0,P=e[S],R=P.text,O=P.width,L=P.lastInParagraph,$,U,z;if(t.save(),c===W3?_+=d-O-r*2:c===z3&&(_+=(d-O-r*2)/2),v){t.save(),t.beginPath(),t.moveTo(_,E+x+Math.round(s/2)),$=R.split(" ").length-1,U=$===0,z=c===Es&&!L?d-r*2:O,t.lineTo(_+Math.round(z),E+x+Math.round(s/2)),t.lineWidth=s/15;const _t=this._getLinearGradient();t.strokeStyle=_t||u,t.stroke(),t.restore()}if(b){t.save(),t.beginPath(),t.moveTo(_,E+x),$=R.split(" ").length-1,U=$===0,z=c===Es&&L&&!U?d-r*2:O,t.lineTo(_+Math.round(z),E+x),t.lineWidth=s/15;const _t=this._getLinearGradient();t.strokeStyle=_t||u,t.stroke(),t.restore()}if(h!==c0&&(f!==0||c===Es)){$=R.split(" ").length-1;for(var q=n0(R),K=0;K<q.length;K++){var Z=q[K];Z===" "&&!L&&c===Es&&(_+=(d-r*2-O)/$),this._partialTextX=_,this._partialTextY=E+x,this._partialText=Z,t.fillStrokeShape(this),_+=this.measureSize(Z).width+f}}else f!==0&&t.setAttr("letterSpacing",`${f}px`),this._partialTextX=_,this._partialTextY=E+x,this._partialText=R,t.fillStrokeShape(this);t.restore(),i>1&&(E+=a)}}}_hitFunc(t){var e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=yl.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(H3,e),this}getWidth(){var t=this.attrs.width===hr||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===hr||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return yl.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e=bl(),i=this.fontSize(),r;return e.save(),e.font=this._getContextFont(),r=e.measureText(t),e.restore(),{width:r.width,height:i}}_getContextFont(){return this.fontStyle()+to+this.fontVariant()+to+(this.fontSize()+q3)+Q3(this.fontFamily())}_addTextLine(t){this.align()===Es&&(t=t.trim());var i=this._getTextWidth(t);return this.textArr.push({text:t,width:i,lastInParagraph:!1})}_getTextWidth(t){var e=this.letterSpacing(),i=t.length;return bl().measureText(t).width+(i?e*(i-1):0)}_setTextData(){var t=this.text().split(`
|
|
44
|
+
`),e=+this.fontSize(),i=0,r=this.lineHeight()*e,s=this.attrs.width,a=this.attrs.height,o=s!==hr&&s!==void 0,h=a!==hr&&a!==void 0,l=this.padding(),c=s-l*2,d=a-l*2,f=0,u=this.wrap(),m=u!==u0,v=u!==Z3&&m,b=this.ellipsis();this.textArr=[],bl().font=this._getContextFont();for(var S=b?this._getTextWidth(wl):0,E=0,_=t.length;E<_;++E){var x=t[E],P=this._getTextWidth(x);if(o&&P>c)for(;x.length>0;){for(var R=0,O=x.length,L="",$=0;R<O;){var U=R+O>>>1,z=x.slice(0,U+1),q=this._getTextWidth(z)+S;q<=c?(R=U+1,L=z,$=q):O=U}if(L){if(v){var K,Z=x[L.length],at=Z===to||Z===a0;at&&$<=c?K=L.length:K=Math.max(L.lastIndexOf(to),L.lastIndexOf(a0))+1,K>0&&(R=K,L=L.slice(0,R),$=this._getTextWidth(L))}L=L.trimRight(),this._addTextLine(L),i=Math.max(i,$),f+=r;var vt=this._shouldHandleEllipsis(f);if(vt){this._tryToAddEllipsisToLastLine();break}if(x=x.slice(R),x=x.trimLeft(),x.length>0&&(P=this._getTextWidth(x),P<=c)){this._addTextLine(x),f+=r,i=Math.max(i,P);break}}else break}else this._addTextLine(x),f+=r,i=Math.max(i,P),this._shouldHandleEllipsis(f)&&E<_-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),h&&f+r>d)break}this.textHeight=e,this.textWidth=i}_shouldHandleEllipsis(t){var e=+this.fontSize(),i=this.lineHeight()*e,r=this.attrs.height,s=r!==hr&&r!==void 0,a=this.padding(),o=r-a*2,h=this.wrap(),l=h!==u0;return!l||s&&t+i>o}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,e=t!==hr&&t!==void 0,i=this.padding(),r=t-i*2,s=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!s)){if(e){var o=this._getTextWidth(a.text+wl)<r;o||(a.text=a.text.slice(0,a.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+wl)}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,e=this.hasShadow();return t&&e?!0:super._useBufferCanvas()}}i0=Fn.Text=ae,ae.prototype._fillFunc=ty,ae.prototype._strokeFunc=ey,ae.prototype.className=j3,ae.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,B3._registerNode)(ae),xe.Factory.overWriteSetter(ae,"width",(0,en.getNumberOrAutoValidator)()),xe.Factory.overWriteSetter(ae,"height",(0,en.getNumberOrAutoValidator)()),xe.Factory.addGetterSetter(ae,"direction",s0),xe.Factory.addGetterSetter(ae,"fontFamily","Arial"),xe.Factory.addGetterSetter(ae,"fontSize",12,(0,en.getNumberValidator)()),xe.Factory.addGetterSetter(ae,"fontStyle",l0),xe.Factory.addGetterSetter(ae,"fontVariant",l0),xe.Factory.addGetterSetter(ae,"padding",0,(0,en.getNumberValidator)()),xe.Factory.addGetterSetter(ae,"align",o0),xe.Factory.addGetterSetter(ae,"verticalAlign",X3),xe.Factory.addGetterSetter(ae,"lineHeight",1,(0,en.getNumberValidator)()),xe.Factory.addGetterSetter(ae,"wrap",K3),xe.Factory.addGetterSetter(ae,"ellipsis",!1,(0,en.getBooleanValidator)()),xe.Factory.addGetterSetter(ae,"letterSpacing",0,(0,en.getNumberValidator)()),xe.Factory.addGetterSetter(ae,"text","",(0,en.getStringValidator)()),xe.Factory.addGetterSetter(ae,"textDecoration","");const d0=St(xt({__proto__:null,get Text(){return i0},default:Fn,get stringToArray(){return r0}},[Fn]));var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});var g0=Ps.TextPath=void 0;const xl=re,Ze=Ot,ny=me,As=hl,Sl=d0,p0=Gt,ry=Nt;var sy="",m0="normal";function v0(n){n.fillText(this.partialText,0,0)}function _0(n){n.strokeText(this.partialText,0,0)}class fe extends ny.Shape{constructor(t){super(t),this.dummyCanvas=xl.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return As.Path.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;const e=this.pathLength;return t-1>e?null:As.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=As.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),i=this.fill(),r=this.fontSize(),s=this.glyphInfo;e==="underline"&&t.beginPath();for(var a=0;a<s.length;a++){t.save();var o=s[a].p0;t.translate(o.x,o.y),t.rotate(s[a].rotation),this.partialText=s[a].text,t.fillStrokeShape(this),e==="underline"&&(a===0&&t.moveTo(0,r/2+1),t.lineTo(r,r/2+1)),t.restore()}e==="underline"&&(t.strokeStyle=i,t.lineWidth=r/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var i=e[0].p0;t.moveTo(i.x,i.y)}for(var r=0;r<e.length;r++){var s=e[r].p1;t.lineTo(s.x,s.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return xl.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return Sl.Text.prototype.setText.call(this,t)}_getContextFont(){return Sl.Text.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas,i=e.getContext("2d");i.save(),i.font=this._getContextFont();var r=i.measureText(t);return i.restore(),{width:r.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),r=this.align(),s=this.kerningFunc(),a=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let o=0;r==="center"&&(o=Math.max(0,this.pathLength/2-a/2)),r==="right"&&(o=Math.max(0,this.pathLength-a));const h=(0,Sl.stringToArray)(this.text());let l=o;for(var c=0;c<h.length;c++){const d=this._getPointAtLength(l);if(!d)return;let f=this._getTextSize(h[c]).width+i;if(h[c]===" "&&r==="justify"){const E=this.text().split(" ").length-1;f+=(this.pathLength-a)/E}const u=this._getPointAtLength(l+f);if(!u)return;const m=As.Path.getLineLength(d.x,d.y,u.x,u.y);let v=0;if(s)try{v=s(h[c-1],h[c])*this.fontSize()}catch{v=0}d.x+=v,u.x+=v,this.textWidth+=v;const b=As.Path.getPointOnLine(v+m/2,d.x,d.y,u.x,u.y),S=Math.atan2(u.y-d.y,u.x-d.x);this.glyphInfo.push({transposeX:b.x,transposeY:b.y,text:h[c],rotation:S,p0:d,p1:u}),l+=f}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach(function(c){t.push(c.p0.x),t.push(c.p0.y),t.push(c.p1.x),t.push(c.p1.y)});for(var e=t[0]||0,i=t[0]||0,r=t[1]||0,s=t[1]||0,a,o,h=0;h<t.length/2;h++)a=t[h*2],o=t[h*2+1],e=Math.min(e,a),i=Math.max(i,a),r=Math.min(r,o),s=Math.max(s,o);var l=this.fontSize();return{x:e-l/2,y:r-l/2,width:i-e+l,height:s-r+l}}destroy(){return xl.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}g0=Ps.TextPath=fe,fe.prototype._fillFunc=v0,fe.prototype._strokeFunc=_0,fe.prototype._fillFuncHit=v0,fe.prototype._strokeFuncHit=_0,fe.prototype.className="TextPath",fe.prototype._attrsAffectingSize=["text","fontSize","data"],(0,ry._registerNode)(fe),Ze.Factory.addGetterSetter(fe,"data"),Ze.Factory.addGetterSetter(fe,"fontFamily","Arial"),Ze.Factory.addGetterSetter(fe,"fontSize",12,(0,p0.getNumberValidator)()),Ze.Factory.addGetterSetter(fe,"fontStyle",m0),Ze.Factory.addGetterSetter(fe,"align","left"),Ze.Factory.addGetterSetter(fe,"letterSpacing",0,(0,p0.getNumberValidator)()),Ze.Factory.addGetterSetter(fe,"textBaseline","middle"),Ze.Factory.addGetterSetter(fe,"fontVariant",m0),Ze.Factory.addGetterSetter(fe,"text",sy),Ze.Factory.addGetterSetter(fe,"textDecoration",null),Ze.Factory.addGetterSetter(fe,"kerningFunc",null);const ay=St(xt({__proto__:null,get TextPath(){return g0},default:Ps},[Ps]));var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0});var y0=Ms.Transformer=void 0;const Kt=re,Yt=Ot,w0=le,oy=me,hy=jd,b0=el,Je=Nt,nn=Gt,ly=Nt;var x0="tr-konva",cy=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(n=>n+`.${x0}`).join(" "),S0="nodesRect",uy=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],fy={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const dy="ontouchstart"in Je.Konva._global;function gy(n,t,e){if(n==="rotater")return e;t+=Kt.Util.degToRad(fy[n]||0);var i=(Kt.Util.radToDeg(t)%360+360)%360;return Kt.Util._inRange(i,315+22.5,360)||Kt.Util._inRange(i,0,22.5)?"ns-resize":Kt.Util._inRange(i,45-22.5,45+22.5)?"nesw-resize":Kt.Util._inRange(i,90-22.5,90+22.5)?"ew-resize":Kt.Util._inRange(i,135-22.5,135+22.5)?"nwse-resize":Kt.Util._inRange(i,180-22.5,180+22.5)?"ns-resize":Kt.Util._inRange(i,225-22.5,225+22.5)?"nesw-resize":Kt.Util._inRange(i,270-22.5,270+22.5)?"ew-resize":Kt.Util._inRange(i,315-22.5,315+22.5)?"nwse-resize":(Kt.Util.error("Transformer has unknown angle for cursor detection: "+i),"pointer")}var io=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],C0=1e8;function py(n){return{x:n.x+n.width/2*Math.cos(n.rotation)+n.height/2*Math.sin(-n.rotation),y:n.y+n.height/2*Math.cos(n.rotation)+n.width/2*Math.sin(n.rotation)}}function T0(n,t,e){const i=e.x+(n.x-e.x)*Math.cos(t)-(n.y-e.y)*Math.sin(t),r=e.y+(n.x-e.x)*Math.sin(t)+(n.y-e.y)*Math.cos(t);return{...n,rotation:n.rotation+t,x:i,y:r}}function my(n,t){const e=py(n);return T0(n,t,e)}function vy(n,t,e){let i=t;for(let r=0;r<n.length;r++){const s=Je.Konva.getAngle(n[r]),a=Math.abs(s-t)%(Math.PI*2);Math.min(a,Math.PI*2-a)<e&&(i=s)}return i}class Ht extends b0.Group{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(cy,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return Kt.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return x0+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter(r=>r.isAncestorOf(this)?(Kt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=e,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(r=>{const s=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(o=>o+"Change."+this._getEventNamespace()).join(" ");r.on(a,s),r.on(uy.map(o=>o+`.${this._getEventNamespace()}`).join(" "),s),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,s),this._proxyDrag(r)}),this._resetTransformCache();var i=!!this.findOne(".top-left");return i&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,i=>{e=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(i,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,i=>{if(!e)return;const r=t.getAbsolutePosition(),s=r.x-e.x,a=r.y-e.y;this.nodes().forEach(o=>{if(o===t||o.isDragging())return;const h=o.getAbsolutePosition();o.setAbsolutePosition({x:h.x+s,y:h.y+a}),o.startDrag(i)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(S0),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(S0,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),i){var r=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=t.getAbsoluteScale(i),a=t.getAbsolutePosition(i),o=r.x*s.x-t.offsetX()*s.x,h=r.y*s.y-t.offsetY()*s.y;const l=(Je.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+o*Math.cos(l)+h*Math.sin(-l),y:a.y+h*Math.cos(l)+o*Math.sin(l),width:r.width*s.x,height:r.height*s.y,rotation:l};return T0(c,-Je.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-C0,y:-C0,width:0,height:0,rotation:0};const e=[];this.nodes().map(l=>{const c=l.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=l.getAbsoluteTransform();d.forEach(function(u){var m=f.point(u);e.push(m)})});const i=new Kt.Transform;i.rotate(-Je.Konva.getAngle(this.rotation()));var r=1/0,s=1/0,a=-1/0,o=-1/0;e.forEach(function(l){var c=i.point(l);r===void 0&&(r=a=c.x,s=o=c.y),r=Math.min(r,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),o=Math.max(o,c.y)}),i.invert();const h=i.point({x:r,y:s});return{x:h.x,y:h.y,width:a-r,height:o-s,rotation:Je.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),io.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){var e=new hy.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:dy?10:"auto"}),i=this;e.on("mousedown touchstart",function(r){i._handleMouseDown(r)}),e.on("dragstart",r=>{e.stopDrag(),r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),e.on("mouseenter",()=>{var r=Je.Konva.getAngle(this.rotation()),s=this.rotateAnchorCursor(),a=gy(t,r,s);e.getStage().content&&(e.getStage().content.style.cursor=a),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){var t=new oy.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,i){var r=i.getParent(),s=r.padding();e.beginPath(),e.rect(-s,-s,i.width()+s*2,i.height()+s*2),e.moveTo(i.width()/2,-s),r.rotateEnabled()&&e.lineTo(i.width()/2,-r.rotateAnchorOffset()*Kt.Util._sign(i.height())-s),e.fillStrokeShape(i)},hitFunc:(e,i)=>{if(this.shouldOverdrawWholeArea()){var r=this.padding();e.beginPath(),e.rect(-r,-r,i.width()+r*2,i.height()+r*2),e.fillStrokeShape(i)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",e=>{e.cancelBubble=!0}),t.on("dragmove",e=>{e.cancelBubble=!0}),t.on("dragend",e=>{e.cancelBubble=!0}),this.on("dragmove",e=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var e=this._getNodeRect(),i=e.width,r=e.height,s=Math.sqrt(Math.pow(i,2)+Math.pow(r,2));this.sin=Math.abs(r/s),this.cos=Math.abs(i/s),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),o=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:o.x-a.x,y:o.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(h=>{h._fire("transformstart",{evt:t.evt,target:h})})}_handleMouseMove(t){var e,i,r,s=this.findOne("."+this._movingAnchorName),a=s.getStage();a.setPointersPositions(t);const o=a.getPointerPosition();let h={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const l=s.getAbsolutePosition();this.anchorDragBoundFunc()&&(h=this.anchorDragBoundFunc()(l,h,t)),s.setAbsolutePosition(h);const c=s.getAbsolutePosition();if(!(l.x===c.x&&l.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();e=s.x()-d.width/2,i=-s.y()+d.height/2;let K=Math.atan2(-i,e)+Math.PI/2;d.height<0&&(K-=Math.PI);var f=Je.Konva.getAngle(this.rotation());const Z=f+K,at=Je.Konva.getAngle(this.rotationSnapTolerance()),_t=vy(this.rotationSnaps(),Z,at)-d.rotation,pt=my(d,_t);this._fitNodesInto(pt,t);return}var u=this.shiftBehavior(),m;u==="inverted"?m=this.keepRatio()&&!t.shiftKey:u==="none"?m=this.keepRatio():m=this.keepRatio()||t.shiftKey;var _=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(m){var v=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(v.x-s.x(),2)+Math.pow(v.y-s.y(),2));var b=this.findOne(".top-left").x()>v.x?-1:1,S=this.findOne(".top-left").y()>v.y?-1:1;e=r*this.cos*b,i=r*this.sin*S,this.findOne(".top-left").x(v.x-e),this.findOne(".top-left").y(v.y-i)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(m){var v=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(s.x()-v.x,2)+Math.pow(v.y-s.y(),2));var b=this.findOne(".top-right").x()<v.x?-1:1,S=this.findOne(".top-right").y()>v.y?-1:1;e=r*this.cos*b,i=r*this.sin*S,this.findOne(".top-right").x(v.x+e),this.findOne(".top-right").y(v.y-i)}var E=s.position();this.findOne(".top-left").y(E.y),this.findOne(".bottom-right").x(E.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(s.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(s.x());else if(this._movingAnchorName==="bottom-left"){if(m){var v=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(v.x-s.x(),2)+Math.pow(s.y()-v.y,2));var b=v.x<s.x()?-1:1,S=s.y()<v.y?-1:1;e=r*this.cos*b,i=r*this.sin*S,s.x(v.x-e),s.y(v.y+i)}E=s.position(),this.findOne(".top-left").x(E.x),this.findOne(".bottom-right").y(E.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(s.y());else if(this._movingAnchorName==="bottom-right"){if(m){var v=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(s.x()-v.x,2)+Math.pow(s.y()-v.y,2));var b=this.findOne(".bottom-right").x()<v.x?-1:1,S=this.findOne(".bottom-right").y()<v.y?-1:1;e=r*this.cos*b,i=r*this.sin*S,this.findOne(".bottom-right").x(v.x+e),this.findOne(".bottom-right").y(v.y+i)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var _=this.centeredScaling()||t.altKey;if(_){var x=this.findOne(".top-left"),P=this.findOne(".bottom-right"),R=x.x(),O=x.y(),L=this.getWidth()-P.x(),$=this.getHeight()-P.y();P.move({x:-R,y:-O}),x.move({x:L,y:$})}var U=this.findOne(".top-left").getAbsolutePosition();e=U.x,i=U.y;var z=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),q=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:i,width:z,height:q,rotation:Je.Konva.getAngle(this.rotation())},t)}}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var e=this.getNode();this._fire("transformend",{evt:t,target:e}),e&&this._nodes.forEach(i=>{i._fire("transformend",{evt:t,target:i})}),this._movingAnchorName=null}}_fitNodesInto(t,e){var i=this._getNodeRect();const r=1;if(Kt.Util._inRange(t.width,-this.padding()*2-r,r)){this.update();return}if(Kt.Util._inRange(t.height,-this.padding()*2-r,r)){this.update();return}const s=this.flipEnabled();var a=new Kt.Transform;if(a.rotate(Je.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!s){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!s){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!s){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!s){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(i,t);d?t=d:Kt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,h=new Kt.Transform;h.translate(i.x,i.y),h.rotate(i.rotation),h.scale(i.width/o,i.height/o);const l=new Kt.Transform;l.translate(t.x,t.y),l.rotate(t.rotation),l.scale(t.width/o,t.height/o);const c=l.multiply(h.invert());this._nodes.forEach(d=>{var f;const u=d.getParent().getAbsoluteTransform(),m=d.getTransform().copy();m.translate(d.offsetX(),d.offsetY());const v=new Kt.Transform;v.multiply(u.copy().invert()).multiply(c).multiply(u).multiply(m);const b=v.decompose();d.setAttrs(b),this._fire("transform",{evt:e,target:d}),d._fire("transform",{evt:e,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Kt.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t,e=this._getNodeRect();this.rotation(Kt.Util._getRotation(e.rotation));var i=e.width,r=e.height,s=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),h=this.anchorSize();const l=this.find("._anchor");l.forEach(d=>{d.setAttrs({width:h,height:h,offsetX:h/2,offsetY:h/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:h/2+o,offsetY:h/2+o,visible:a&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:h/2+o,visible:a&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:h/2-o,offsetY:h/2+o,visible:a&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:h/2+o,visible:a&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:r/2,offsetX:h/2-o,visible:a&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:h/2+o,offsetY:h/2-o,visible:a&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:r,offsetY:h/2-o,visible:a&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:r,offsetX:h/2-o,offsetY:h/2-o,visible:a&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:i/2,y:-this.rotateAnchorOffset()*Kt.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&l.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),b0.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return w0.Node.prototype.toObject.call(this)}clone(t){var e=w0.Node.prototype.clone.call(this,t);return e}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}y0=Ms.Transformer=Ht;function _y(n){return n instanceof Array||Kt.Util.warn("enabledAnchors value should be an array"),n instanceof Array&&n.forEach(function(t){io.indexOf(t)===-1&&Kt.Util.warn("Unknown anchor name: "+t+". Available names are: "+io.join(", "))}),n||[]}Ht.prototype.className="Transformer",(0,ly._registerNode)(Ht),Yt.Factory.addGetterSetter(Ht,"enabledAnchors",io,_y),Yt.Factory.addGetterSetter(Ht,"flipEnabled",!0,(0,nn.getBooleanValidator)()),Yt.Factory.addGetterSetter(Ht,"resizeEnabled",!0),Yt.Factory.addGetterSetter(Ht,"anchorSize",10,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"rotateEnabled",!0),Yt.Factory.addGetterSetter(Ht,"rotationSnaps",[]),Yt.Factory.addGetterSetter(Ht,"rotateAnchorOffset",50,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"rotateAnchorCursor","crosshair"),Yt.Factory.addGetterSetter(Ht,"rotationSnapTolerance",5,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"borderEnabled",!0),Yt.Factory.addGetterSetter(Ht,"anchorStroke","rgb(0, 161, 255)"),Yt.Factory.addGetterSetter(Ht,"anchorStrokeWidth",1,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"anchorFill","white"),Yt.Factory.addGetterSetter(Ht,"anchorCornerRadius",0,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"borderStroke","rgb(0, 161, 255)"),Yt.Factory.addGetterSetter(Ht,"borderStrokeWidth",1,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"borderDash"),Yt.Factory.addGetterSetter(Ht,"keepRatio",!0),Yt.Factory.addGetterSetter(Ht,"shiftBehavior","default"),Yt.Factory.addGetterSetter(Ht,"centeredScaling",!1),Yt.Factory.addGetterSetter(Ht,"ignoreStroke",!1),Yt.Factory.addGetterSetter(Ht,"padding",0,(0,nn.getNumberValidator)()),Yt.Factory.addGetterSetter(Ht,"node"),Yt.Factory.addGetterSetter(Ht,"nodes"),Yt.Factory.addGetterSetter(Ht,"boundBoxFunc"),Yt.Factory.addGetterSetter(Ht,"anchorDragBoundFunc"),Yt.Factory.addGetterSetter(Ht,"anchorStyleFunc"),Yt.Factory.addGetterSetter(Ht,"shouldOverdrawWholeArea",!1),Yt.Factory.addGetterSetter(Ht,"useSingleNodeRotation",!0),Yt.Factory.backCompat(Ht,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});const yy=St(xt({__proto__:null,get Transformer(){return y0},default:Ms},[Ms]));var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});var k0=Rs.Wedge=void 0;const no=Ot,wy=me,by=Nt,E0=Gt,xy=Nt;class Ai extends wy.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,by.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}k0=Rs.Wedge=Ai,Ai.prototype.className="Wedge",Ai.prototype._centroid=!0,Ai.prototype._attrsAffectingSize=["radius"],(0,xy._registerNode)(Ai),no.Factory.addGetterSetter(Ai,"radius",0,(0,E0.getNumberValidator)()),no.Factory.addGetterSetter(Ai,"angle",0,(0,E0.getNumberValidator)()),no.Factory.addGetterSetter(Ai,"clockwise",!1),no.Factory.backCompat(Ai,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});const Sy=St(xt({__proto__:null,get Wedge(){return k0},default:Rs},[Rs]));var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});var P0=Ds.Blur=void 0;const A0=Ot,Cy=le,Ty=Gt;function M0(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var ky=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Ey=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Py(n,t){var e=n.data,i=n.width,r=n.height,s,a,o,h,l,c,d,f,u,m,v,b,S,E,_,x,P,R,O,L,$,U,z,q,K=t+t+1,Z=i-1,at=r-1,vt=t+1,_t=vt*(vt+1)/2,pt=new M0,nt=null,J=pt,I=null,D=null,A=ky[t],B=Ey[t];for(o=1;o<K;o++)J=J.next=new M0,o===vt&&(nt=J);for(J.next=pt,d=c=0,a=0;a<r;a++){for(x=P=R=O=f=u=m=v=0,b=vt*(L=e[c]),S=vt*($=e[c+1]),E=vt*(U=e[c+2]),_=vt*(z=e[c+3]),f+=_t*L,u+=_t*$,m+=_t*U,v+=_t*z,J=pt,o=0;o<vt;o++)J.r=L,J.g=$,J.b=U,J.a=z,J=J.next;for(o=1;o<vt;o++)h=c+((Z<o?Z:o)<<2),f+=(J.r=L=e[h])*(q=vt-o),u+=(J.g=$=e[h+1])*q,m+=(J.b=U=e[h+2])*q,v+=(J.a=z=e[h+3])*q,x+=L,P+=$,R+=U,O+=z,J=J.next;for(I=pt,D=nt,s=0;s<i;s++)e[c+3]=z=v*A>>B,z!==0?(z=255/z,e[c]=(f*A>>B)*z,e[c+1]=(u*A>>B)*z,e[c+2]=(m*A>>B)*z):e[c]=e[c+1]=e[c+2]=0,f-=b,u-=S,m-=E,v-=_,b-=I.r,S-=I.g,E-=I.b,_-=I.a,h=d+((h=s+t+1)<Z?h:Z)<<2,x+=I.r=e[h],P+=I.g=e[h+1],R+=I.b=e[h+2],O+=I.a=e[h+3],f+=x,u+=P,m+=R,v+=O,I=I.next,b+=L=D.r,S+=$=D.g,E+=U=D.b,_+=z=D.a,x-=L,P-=$,R-=U,O-=z,D=D.next,c+=4;d+=i}for(s=0;s<i;s++){for(P=R=O=x=u=m=v=f=0,c=s<<2,b=vt*(L=e[c]),S=vt*($=e[c+1]),E=vt*(U=e[c+2]),_=vt*(z=e[c+3]),f+=_t*L,u+=_t*$,m+=_t*U,v+=_t*z,J=pt,o=0;o<vt;o++)J.r=L,J.g=$,J.b=U,J.a=z,J=J.next;for(l=i,o=1;o<=t;o++)c=l+s<<2,f+=(J.r=L=e[c])*(q=vt-o),u+=(J.g=$=e[c+1])*q,m+=(J.b=U=e[c+2])*q,v+=(J.a=z=e[c+3])*q,x+=L,P+=$,R+=U,O+=z,J=J.next,o<at&&(l+=i);for(c=s,I=pt,D=nt,a=0;a<r;a++)h=c<<2,e[h+3]=z=v*A>>B,z>0?(z=255/z,e[h]=(f*A>>B)*z,e[h+1]=(u*A>>B)*z,e[h+2]=(m*A>>B)*z):e[h]=e[h+1]=e[h+2]=0,f-=b,u-=S,m-=E,v-=_,b-=I.r,S-=I.g,E-=I.b,_-=I.a,h=s+((h=a+vt)<at?h:at)*i<<2,f+=x+=I.r=e[h],u+=P+=I.g=e[h+1],m+=R+=I.b=e[h+2],v+=O+=I.a=e[h+3],I=I.next,b+=L=D.r,S+=$=D.g,E+=U=D.b,_+=z=D.a,x-=L,P-=$,R-=U,O-=z,D=D.next,c+=i}}const Ay=function(t){var e=Math.round(this.blurRadius());e>0&&Py(t,e)};P0=Ds.Blur=Ay,A0.Factory.addGetterSetter(Cy.Node,"blurRadius",0,(0,Ty.getNumberValidator)(),A0.Factory.afterSetFilter);const My=St(xt({__proto__:null,get Blur(){return P0},default:Ds},[Ds]));var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});var R0=Ls.Brighten=void 0;const D0=Ot,Ry=le,Dy=Gt,Ly=function(n){var t=this.brightness()*255,e=n.data,i=e.length,r;for(r=0;r<i;r+=4)e[r]+=t,e[r+1]+=t,e[r+2]+=t};R0=Ls.Brighten=Ly,D0.Factory.addGetterSetter(Ry.Node,"brightness",0,(0,Dy.getNumberValidator)(),D0.Factory.afterSetFilter);const Iy=St(xt({__proto__:null,get Brighten(){return R0},default:Ls},[Ls]));var Is={};Object.defineProperty(Is,"__esModule",{value:!0});var L0=Is.Contrast=void 0;const I0=Ot,Fy=le,Oy=Gt,Ny=function(n){var t=Math.pow((this.contrast()+100)/100,2),e=n.data,i=e.length,r=150,s=150,a=150,o;for(o=0;o<i;o+=4)r=e[o],s=e[o+1],a=e[o+2],r/=255,r-=.5,r*=t,r+=.5,r*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,r=r<0?0:r>255?255:r,s=s<0?0:s>255?255:s,a=a<0?0:a>255?255:a,e[o]=r,e[o+1]=s,e[o+2]=a};L0=Is.Contrast=Ny,I0.Factory.addGetterSetter(Fy.Node,"contrast",0,(0,Oy.getNumberValidator)(),I0.Factory.afterSetFilter);const Gy=St(xt({__proto__:null,get Contrast(){return L0},default:Is},[Is]));var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0});var F0=Fs.Emboss=void 0;const rn=Ot,ro=le,Uy=re,O0=Gt,By=function(n){var t=this.embossStrength()*10,e=this.embossWhiteLevel()*255,i=this.embossDirection(),r=this.embossBlend(),s=0,a=0,o=n.data,h=n.width,l=n.height,c=h*4,d=l;switch(i){case"top-left":s=-1,a=-1;break;case"top":s=-1,a=0;break;case"top-right":s=-1,a=1;break;case"right":s=0,a=1;break;case"bottom-right":s=1,a=1;break;case"bottom":s=1,a=0;break;case"bottom-left":s=1,a=-1;break;case"left":s=0,a=-1;break;default:Uy.Util.error("Unknown emboss direction: "+i)}do{var f=(d-1)*c,u=s;d+u<1&&(u=0),d+u>l&&(u=0);var m=(d-1+u)*h*4,v=h;do{var b=f+(v-1)*4,S=a;v+S<1&&(S=0),v+S>h&&(S=0);var E=m+(v-1+S)*4,_=o[b]-o[E],x=o[b+1]-o[E+1],P=o[b+2]-o[E+2],R=_,O=R>0?R:-R,L=x>0?x:-x,$=P>0?P:-P;if(L>O&&(R=x),$>O&&(R=P),R*=t,r){var U=o[b]+R,z=o[b+1]+R,q=o[b+2]+R;o[b]=U>255?255:U<0?0:U,o[b+1]=z>255?255:z<0?0:z,o[b+2]=q>255?255:q<0?0:q}else{var K=e-R;K<0?K=0:K>255&&(K=255),o[b]=o[b+1]=o[b+2]=K}}while(--v)}while(--d)};F0=Fs.Emboss=By,rn.Factory.addGetterSetter(ro.Node,"embossStrength",.5,(0,O0.getNumberValidator)(),rn.Factory.afterSetFilter),rn.Factory.addGetterSetter(ro.Node,"embossWhiteLevel",.5,(0,O0.getNumberValidator)(),rn.Factory.afterSetFilter),rn.Factory.addGetterSetter(ro.Node,"embossDirection","top-left",null,rn.Factory.afterSetFilter),rn.Factory.addGetterSetter(ro.Node,"embossBlend",!1,null,rn.Factory.afterSetFilter);const zy=St(xt({__proto__:null,get Emboss(){return F0},default:Fs},[Fs]));var Os={};Object.defineProperty(Os,"__esModule",{value:!0});var N0=Os.Enhance=void 0;const G0=Ot,$y=le,Vy=Gt;function Cl(n,t,e,i,r){var s=e-t,a=r-i,o;return s===0?i+a/2:a===0?i:(o=(n-t)/s,o=a*o+i,o)}const Hy=function(n){var t=n.data,e=t.length,i=t[0],r=i,s,a=t[1],o=a,h,l=t[2],c=l,d,f,u=this.enhance();if(u!==0){for(f=0;f<e;f+=4)s=t[f+0],s<i?i=s:s>r&&(r=s),h=t[f+1],h<a?a=h:h>o&&(o=h),d=t[f+2],d<l?l=d:d>c&&(c=d);r===i&&(r=255,i=0),o===a&&(o=255,a=0),c===l&&(c=255,l=0);var m,v,b,S,E,_,x,P,R;for(u>0?(v=r+u*(255-r),b=i-u*(i-0),E=o+u*(255-o),_=a-u*(a-0),P=c+u*(255-c),R=l-u*(l-0)):(m=(r+i)*.5,v=r+u*(r-m),b=i+u*(i-m),S=(o+a)*.5,E=o+u*(o-S),_=a+u*(a-S),x=(c+l)*.5,P=c+u*(c-x),R=l+u*(l-x)),f=0;f<e;f+=4)t[f+0]=Cl(t[f+0],i,r,b,v),t[f+1]=Cl(t[f+1],a,o,_,E),t[f+2]=Cl(t[f+2],l,c,R,P)}};N0=Os.Enhance=Hy,G0.Factory.addGetterSetter($y.Node,"enhance",0,(0,Vy.getNumberValidator)(),G0.Factory.afterSetFilter);const jy=St(xt({__proto__:null,get Enhance(){return N0},default:Os},[Os]));var Ns={};Object.defineProperty(Ns,"__esModule",{value:!0});var U0=Ns.Grayscale=void 0;const Xy=function(n){var t=n.data,e=t.length,i,r;for(i=0;i<e;i+=4)r=.34*t[i]+.5*t[i+1]+.16*t[i+2],t[i]=r,t[i+1]=r,t[i+2]=r};U0=Ns.Grayscale=Xy;const Yy=St(xt({__proto__:null,get Grayscale(){return U0},default:Ns},[Ns]));var Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});var B0=Gs.HSL=void 0;const lr=Ot,Tl=le,kl=Gt;lr.Factory.addGetterSetter(Tl.Node,"hue",0,(0,kl.getNumberValidator)(),lr.Factory.afterSetFilter),lr.Factory.addGetterSetter(Tl.Node,"saturation",0,(0,kl.getNumberValidator)(),lr.Factory.afterSetFilter),lr.Factory.addGetterSetter(Tl.Node,"luminance",0,(0,kl.getNumberValidator)(),lr.Factory.afterSetFilter);const qy=function(n){var t=n.data,e=t.length,i=1,r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o,h=i*r*Math.cos(s*Math.PI/180),l=i*r*Math.sin(s*Math.PI/180),c=.299*i+.701*h+.167*l,d=.587*i-.587*h+.33*l,f=.114*i-.114*h-.497*l,u=.299*i-.299*h-.328*l,m=.587*i+.413*h+.035*l,v=.114*i-.114*h+.293*l,b=.299*i-.3*h+1.25*l,S=.587*i-.586*h-1.05*l,E=.114*i+.886*h-.2*l,_,x,P,R;for(o=0;o<e;o+=4)_=t[o+0],x=t[o+1],P=t[o+2],R=t[o+3],t[o+0]=c*_+d*x+f*P+a,t[o+1]=u*_+m*x+v*P+a,t[o+2]=b*_+S*x+E*P+a,t[o+3]=R};B0=Gs.HSL=qy;const Wy=St(xt({__proto__:null,get HSL(){return B0},default:Gs},[Gs]));var Us={};Object.defineProperty(Us,"__esModule",{value:!0});var z0=Us.HSV=void 0;const cr=Ot,El=le,Pl=Gt,Ky=function(n){var t=n.data,e=t.length,i=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a,o=i*r*Math.cos(s*Math.PI/180),h=i*r*Math.sin(s*Math.PI/180),l=.299*i+.701*o+.167*h,c=.587*i-.587*o+.33*h,d=.114*i-.114*o-.497*h,f=.299*i-.299*o-.328*h,u=.587*i+.413*o+.035*h,m=.114*i-.114*o+.293*h,v=.299*i-.3*o+1.25*h,b=.587*i-.586*o-1.05*h,S=.114*i+.886*o-.2*h,E,_,x,P;for(a=0;a<e;a+=4)E=t[a+0],_=t[a+1],x=t[a+2],P=t[a+3],t[a+0]=l*E+c*_+d*x,t[a+1]=f*E+u*_+m*x,t[a+2]=v*E+b*_+S*x,t[a+3]=P};z0=Us.HSV=Ky,cr.Factory.addGetterSetter(El.Node,"hue",0,(0,Pl.getNumberValidator)(),cr.Factory.afterSetFilter),cr.Factory.addGetterSetter(El.Node,"saturation",0,(0,Pl.getNumberValidator)(),cr.Factory.afterSetFilter),cr.Factory.addGetterSetter(El.Node,"value",0,(0,Pl.getNumberValidator)(),cr.Factory.afterSetFilter);const Zy=St(xt({__proto__:null,get HSV(){return z0},default:Us},[Us]));var Bs={};Object.defineProperty(Bs,"__esModule",{value:!0});var $0=Bs.Invert=void 0;const Jy=function(n){var t=n.data,e=t.length,i;for(i=0;i<e;i+=4)t[i]=255-t[i],t[i+1]=255-t[i+1],t[i+2]=255-t[i+2]};$0=Bs.Invert=Jy;const Qy=St(xt({__proto__:null,get Invert(){return $0},default:Bs},[Bs]));var zs={};Object.defineProperty(zs,"__esModule",{value:!0});var V0=zs.Kaleidoscope=void 0;const so=Ot,H0=le,j0=re,X0=Gt;var t4=function(n,t,e){var i=n.data,r=t.data,s=n.width,a=n.height,o=e.polarCenterX||s/2,h=e.polarCenterY||a/2,l,c,d,f=0,u=0,m=0,v=0,b,S=Math.sqrt(o*o+h*h);c=s-o,d=a-h,b=Math.sqrt(c*c+d*d),S=b>S?b:S;var E=a,_=s,x,P,R=360/_*Math.PI/180,O,L;for(P=0;P<_;P+=1)for(O=Math.sin(P*R),L=Math.cos(P*R),x=0;x<E;x+=1)c=Math.floor(o+S*x/E*L),d=Math.floor(h+S*x/E*O),l=(d*s+c)*4,f=i[l+0],u=i[l+1],m=i[l+2],v=i[l+3],l=(P+x*s)*4,r[l+0]=f,r[l+1]=u,r[l+2]=m,r[l+3]=v},e4=function(n,t,e){var i=n.data,r=t.data,s=n.width,a=n.height,o=e.polarCenterX||s/2,h=e.polarCenterY||a/2,l,c,d,f,u,m=0,v=0,b=0,S=0,E,_=Math.sqrt(o*o+h*h);c=s-o,d=a-h,E=Math.sqrt(c*c+d*d),_=E>_?E:_;var x=a,P=s,R,O,L=e.polarRotation||0,$,U;for(c=0;c<s;c+=1)for(d=0;d<a;d+=1)f=c-o,u=d-h,R=Math.sqrt(f*f+u*u)*x/_,O=(Math.atan2(u,f)*180/Math.PI+360+L)%360,O=O*P/360,$=Math.floor(O),U=Math.floor(R),l=(U*s+$)*4,m=i[l+0],v=i[l+1],b=i[l+2],S=i[l+3],l=(d*s+c)*4,r[l+0]=m,r[l+1]=v,r[l+2]=b,r[l+3]=S};const i4=function(n){var t=n.width,e=n.height,i,r,s,a,o,h,l,c,d,f,u=Math.round(this.kaleidoscopePower()),m=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(m%360)/360);if(!(u<1)){var b=j0.Util.createCanvasElement();b.width=t,b.height=e;var S=b.getContext("2d").getImageData(0,0,t,e);j0.Util.releaseCanvas(b),t4(n,S,{polarCenterX:t/2,polarCenterY:e/2});for(var E=t/Math.pow(2,u);E<=8;)E=E*2,u-=1;E=Math.ceil(E);var _=E,x=0,P=_,R=1;for(v+E>t&&(x=_,P=0,R=-1),r=0;r<e;r+=1)for(i=x;i!==P;i+=R)s=Math.round(i+v)%t,d=(t*r+s)*4,o=S.data[d+0],h=S.data[d+1],l=S.data[d+2],c=S.data[d+3],f=(t*r+i)*4,S.data[f+0]=o,S.data[f+1]=h,S.data[f+2]=l,S.data[f+3]=c;for(r=0;r<e;r+=1)for(_=Math.floor(E),a=0;a<u;a+=1){for(i=0;i<_+1;i+=1)d=(t*r+i)*4,o=S.data[d+0],h=S.data[d+1],l=S.data[d+2],c=S.data[d+3],f=(t*r+_*2-i-1)*4,S.data[f+0]=o,S.data[f+1]=h,S.data[f+2]=l,S.data[f+3]=c;_*=2}e4(S,n,{polarRotation:0})}};V0=zs.Kaleidoscope=i4,so.Factory.addGetterSetter(H0.Node,"kaleidoscopePower",2,(0,X0.getNumberValidator)(),so.Factory.afterSetFilter),so.Factory.addGetterSetter(H0.Node,"kaleidoscopeAngle",0,(0,X0.getNumberValidator)(),so.Factory.afterSetFilter);const n4=St(xt({__proto__:null,get Kaleidoscope(){return V0},default:zs},[zs]));var $s={};Object.defineProperty($s,"__esModule",{value:!0});var Y0=$s.Mask=void 0;const q0=Ot,r4=le,s4=Gt;function ao(n,t,e){var i=(e*n.width+t)*4,r=[];return r.push(n.data[i++],n.data[i++],n.data[i++],n.data[i++]),r}function Vs(n,t){return Math.sqrt(Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2)+Math.pow(n[2]-t[2],2))}function a4(n){for(var t=[0,0,0],e=0;e<n.length;e++)t[0]+=n[e][0],t[1]+=n[e][1],t[2]+=n[e][2];return t[0]/=n.length,t[1]/=n.length,t[2]/=n.length,t}function o4(n,t){var e=ao(n,0,0),i=ao(n,n.width-1,0),r=ao(n,0,n.height-1),s=ao(n,n.width-1,n.height-1),a=t||10;if(Vs(e,i)<a&&Vs(i,s)<a&&Vs(s,r)<a&&Vs(r,e)<a){for(var o=a4([i,e,s,r]),h=[],l=0;l<n.width*n.height;l++){var c=Vs(o,[n.data[l*4],n.data[l*4+1],n.data[l*4+2]]);h[l]=c<a?0:255}return h}}function h4(n,t){for(var e=0;e<n.width*n.height;e++)n.data[4*e+3]=t[e]}function l4(n,t,e){for(var i=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,m=h+f-s;if(u>=0&&u<e&&m>=0&&m<t){var v=u*t+m,b=i[d*r+f];c+=n[v]*b}}a[l]=c===255*8?255:0}return a}function c4(n,t,e){for(var i=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,m=h+f-s;if(u>=0&&u<e&&m>=0&&m<t){var v=u*t+m,b=i[d*r+f];c+=n[v]*b}}a[l]=c>=255*4?255:0}return a}function u4(n,t,e){for(var i=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],r=Math.round(Math.sqrt(i.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var h=0;h<t;h++){for(var l=o*t+h,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,m=h+f-s;if(u>=0&&u<e&&m>=0&&m<t){var v=u*t+m,b=i[d*r+f];c+=n[v]*b}}a[l]=c}return a}const f4=function(n){var t=this.threshold(),e=o4(n,t);return e&&(e=l4(e,n.width,n.height),e=c4(e,n.width,n.height),e=u4(e,n.width,n.height),h4(n,e)),n};Y0=$s.Mask=f4,q0.Factory.addGetterSetter(r4.Node,"threshold",0,(0,s4.getNumberValidator)(),q0.Factory.afterSetFilter);const d4=St(xt({__proto__:null,get Mask(){return Y0},default:$s},[$s]));var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});var W0=Hs.Noise=void 0;const K0=Ot,g4=le,p4=Gt,m4=function(n){var t=this.noise()*255,e=n.data,i=e.length,r=t/2,s;for(s=0;s<i;s+=4)e[s+0]+=r-2*r*Math.random(),e[s+1]+=r-2*r*Math.random(),e[s+2]+=r-2*r*Math.random()};W0=Hs.Noise=m4,K0.Factory.addGetterSetter(g4.Node,"noise",.2,(0,p4.getNumberValidator)(),K0.Factory.afterSetFilter);const v4=St(xt({__proto__:null,get Noise(){return W0},default:Hs},[Hs]));var js={};Object.defineProperty(js,"__esModule",{value:!0});var Z0=js.Pixelate=void 0;const J0=Ot,_4=re,y4=le,w4=Gt,b4=function(n){var t=Math.ceil(this.pixelSize()),e=n.width,i=n.height,r,s,a,o,h,l,c,d=Math.ceil(e/t),f=Math.ceil(i/t),u,m,v,b,S,E,_,x=n.data;if(t<=0){_4.Util.error("pixelSize value can not be <= 0");return}for(S=0;S<d;S+=1)for(E=0;E<f;E+=1){for(o=0,h=0,l=0,c=0,u=S*t,m=u+t,v=E*t,b=v+t,_=0,r=u;r<m;r+=1)if(!(r>=e))for(s=v;s<b;s+=1)s>=i||(a=(e*s+r)*4,o+=x[a+0],h+=x[a+1],l+=x[a+2],c+=x[a+3],_+=1);for(o=o/_,h=h/_,l=l/_,c=c/_,r=u;r<m;r+=1)if(!(r>=e))for(s=v;s<b;s+=1)s>=i||(a=(e*s+r)*4,x[a+0]=o,x[a+1]=h,x[a+2]=l,x[a+3]=c)}};Z0=js.Pixelate=b4,J0.Factory.addGetterSetter(y4.Node,"pixelSize",8,(0,w4.getNumberValidator)(),J0.Factory.afterSetFilter);const x4=St(xt({__proto__:null,get Pixelate(){return Z0},default:js},[js]));var Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});var Q0=Xs.Posterize=void 0;const t1=Ot,S4=le,C4=Gt,T4=function(n){var t=Math.round(this.levels()*254)+1,e=n.data,i=e.length,r=255/t,s;for(s=0;s<i;s+=1)e[s]=Math.floor(e[s]/r)*r};Q0=Xs.Posterize=T4,t1.Factory.addGetterSetter(S4.Node,"levels",.5,(0,C4.getNumberValidator)(),t1.Factory.afterSetFilter);const k4=St(xt({__proto__:null,get Posterize(){return Q0},default:Xs},[Xs]));var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0});var e1=Ys.RGB=void 0;const oo=Ot,Al=le,E4=Gt,P4=function(n){var t=n.data,e=t.length,i=this.red(),r=this.green(),s=this.blue(),a,o;for(a=0;a<e;a+=4)o=(.34*t[a]+.5*t[a+1]+.16*t[a+2])/255,t[a]=o*i,t[a+1]=o*r,t[a+2]=o*s,t[a+3]=t[a+3]};e1=Ys.RGB=P4,oo.Factory.addGetterSetter(Al.Node,"red",0,function(n){return this._filterUpToDate=!1,n>255?255:n<0?0:Math.round(n)}),oo.Factory.addGetterSetter(Al.Node,"green",0,function(n){return this._filterUpToDate=!1,n>255?255:n<0?0:Math.round(n)}),oo.Factory.addGetterSetter(Al.Node,"blue",0,E4.RGBComponent,oo.Factory.afterSetFilter);const A4=St(xt({__proto__:null,get RGB(){return e1},default:Ys},[Ys]));var qs={};Object.defineProperty(qs,"__esModule",{value:!0});var i1=qs.RGBA=void 0;const Ws=Ot,ho=le,M4=Gt,R4=function(n){var t=n.data,e=t.length,i=this.red(),r=this.green(),s=this.blue(),a=this.alpha(),o,h;for(o=0;o<e;o+=4)h=1-a,t[o]=i*a+t[o]*h,t[o+1]=r*a+t[o+1]*h,t[o+2]=s*a+t[o+2]*h};i1=qs.RGBA=R4,Ws.Factory.addGetterSetter(ho.Node,"red",0,function(n){return this._filterUpToDate=!1,n>255?255:n<0?0:Math.round(n)}),Ws.Factory.addGetterSetter(ho.Node,"green",0,function(n){return this._filterUpToDate=!1,n>255?255:n<0?0:Math.round(n)}),Ws.Factory.addGetterSetter(ho.Node,"blue",0,M4.RGBComponent,Ws.Factory.afterSetFilter),Ws.Factory.addGetterSetter(ho.Node,"alpha",1,function(n){return this._filterUpToDate=!1,n>1?1:n<0?0:n});const D4=St(xt({__proto__:null,get RGBA(){return i1},default:qs},[qs]));var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});var n1=Ks.Sepia=void 0;const L4=function(n){var t=n.data,e=t.length,i,r,s,a;for(i=0;i<e;i+=4)r=t[i+0],s=t[i+1],a=t[i+2],t[i+0]=Math.min(255,r*.393+s*.769+a*.189),t[i+1]=Math.min(255,r*.349+s*.686+a*.168),t[i+2]=Math.min(255,r*.272+s*.534+a*.131)};n1=Ks.Sepia=L4;const I4=St(xt({__proto__:null,get Sepia(){return n1},default:Ks},[Ks]));var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});var r1=Zs.Solarize=void 0;const F4=function(n){var t=n.data,e=n.width,i=n.height,r=e*4,s=i;do{var a=(s-1)*r,o=e;do{var h=a+(o-1)*4,l=t[h],c=t[h+1],d=t[h+2];l>127&&(l=255-l),c>127&&(c=255-c),d>127&&(d=255-d),t[h]=l,t[h+1]=c,t[h+2]=d}while(--o)}while(--s)};r1=Zs.Solarize=F4;const O4=St(xt({__proto__:null,get Solarize(){return r1},default:Zs},[Zs]));var Js={};Object.defineProperty(Js,"__esModule",{value:!0});var s1=Js.Threshold=void 0;const a1=Ot,N4=le,G4=Gt,U4=function(n){var t=this.threshold()*255,e=n.data,i=e.length,r;for(r=0;r<i;r+=1)e[r]=e[r]<t?0:255};s1=Js.Threshold=U4,a1.Factory.addGetterSetter(N4.Node,"threshold",.5,(0,G4.getNumberValidator)(),a1.Factory.afterSetFilter);const B4=St(xt({__proto__:null,get Threshold(){return s1},default:Js},[Js]));Object.defineProperty(ss,"__esModule",{value:!0});var o1=ss.Konva=void 0;const h1=j5,z4=q5,$4=n3,V4=h3,H4=u3,j4=g3,l1=w3,X4=Rd,Y4=hl,q4=jd,W4=P3,K4=R3,Z4=F3,J4=G3,Q4=d0,t6=ay,e6=yy,i6=Sy,n6=My,r6=Iy,s6=Gy,a6=zy,o6=jy,h6=Yy,l6=Wy,c6=Zy,u6=Qy,f6=n4,d6=d4,g6=v4,p6=x4,m6=k4,v6=A4,_6=D4,y6=I4,w6=O4,b6=B4;o1=ss.Konva=h1.Konva.Util._assign(h1.Konva,{Arc:z4.Arc,Arrow:$4.Arrow,Circle:V4.Circle,Ellipse:H4.Ellipse,Image:j4.Image,Label:l1.Label,Tag:l1.Tag,Line:X4.Line,Path:Y4.Path,Rect:q4.Rect,RegularPolygon:W4.RegularPolygon,Ring:K4.Ring,Sprite:Z4.Sprite,Star:J4.Star,Text:Q4.Text,TextPath:t6.TextPath,Transformer:e6.Transformer,Wedge:i6.Wedge,Filters:{Blur:n6.Blur,Brighten:r6.Brighten,Contrast:s6.Contrast,Emboss:a6.Emboss,Enhance:o6.Enhance,Grayscale:h6.Grayscale,HSL:l6.HSL,HSV:c6.HSV,Invert:u6.Invert,Kaleidoscope:f6.Kaleidoscope,Mask:d6.Mask,Noise:g6.Noise,Pixelate:p6.Pixelate,Posterize:m6.Posterize,RGB:v6.RGB,RGBA:_6.RGBA,Sepia:y6.Sepia,Solarize:w6.Solarize,Threshold:b6.Threshold}});const x6=St(xt({__proto__:null,get Konva(){return o1},default:ss},[ss]));var S6=Gh.exports;Object.defineProperty(S6,"__esModule",{value:!0});const C6=x6;Gh.exports=C6.Konva;var T6=Gh.exports;const Vt=Pe(T6),c1=(n,t)=>{if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++){const i=n[e],r=t.find(s=>s.id===i.id);if(!r||!k6(i,r))return!1}return!0},k6=(n,t)=>n.attrs.id===n.attrs.id&&n._id===t._id,ur=n=>n.reduce((t,e)=>[...t,...e.toArray()],[]),E6=n=>{n.sort(function(e,i){return e-i});const t=Math.floor(n.length/2);return n[t]},u1=n=>{const t=Math.atan2(n[1],n[0]),e=Math.pow(n[0],2)+Math.pow(n[1],2),i=Math.sqrt(e),r=(n[0]*n[3]-n[2]*n[1])/i;return{rotation:t/(Math.PI/180),scaleX:i,scaleY:r,x:n[4],y:n[5]}},P6=(n,t)=>{const e=n.getTransform().getMatrix(),i=t.getTransform().getMatrix(),r=e[0],s=e[1],a=e[2],o=e[3],h=e[4],l=e[5],c=i[0],d=i[1],f=i[2],u=i[3],m=i[4],v=i[5],b=c*u,S=d*f,E=(f*s-r*u)/(S-b),_=(c*s-r*d)/(b-S),x=(f*o-a*u)/(S-b),P=(c*o-a*d)/(b-S),R=(f*(l-v)+u*(m-h))/(S-b),O=(c*(l-v)+d*(m-h))/(b-S);return u1([E,_,x,P,R,O])};class f1{app;constructor(t){this.app=t}}class A6 extends f1{constructor(t){super(t),this.app.stage.on("mousedown",this.onMouseDown),this.app.stage.on("mouseup",this.onMouseUp),this.app.stage.on("mousemove",this.onMouseMove),this.app.stage.on("mouseover",this.onMouseOver),this.app.stage.on("mouseout",this.onMouseOut),this.app.stage.on("dblclick",this.onMouseDoubleClick),this.app.stage.on("click",this.onMouseClick),this.app.stage.on("contextmenu",this.onMouseContextmenu),this.app.stage.on("wheel",this.onWheel)}onMouseDown=t=>{t.evt.button===1&&this.app.triggerPanning(!0),!this.app.stage.draggable()&&this.app.emit("mouseDown",t)};onMouseUp=t=>{t.evt.button===1&&this.app.triggerPanning(!1),!this.app.stage.draggable()&&this.app.emit("mouseUp",t)};onMouseMove=t=>{this.app.stage.draggable()||this.app.emit("mouseMove",t)};onMouseOver=t=>{this.app.stage.draggable()||this.app.emit("mouseOver",t)};onMouseOut=t=>{this.app.stage.draggable()||this.app.emit("mouseOut",t)};onMouseDoubleClick=t=>{this.app.stage.draggable()||this.app.emit("mouseDoubleClick",t)};onMouseClick=t=>{this.app.stage.draggable()||this.app.emit("mouseClick",t)};onMouseContextmenu=t=>{this.app.triggerTool(!1),this.app.emit("mouseContextMenu",t),setTimeout(()=>this.app.triggerTool(!0),100)};onWheel=t=>{if(t.evt.preventDefault(),!this.app.config.mousewheel.enabled)return;const e=this.app.stage.scaleX();this.app.emit("canvasZoomStart",e);const i=this.app.stage.getPointerPosition()??new Wt({x:0,y:0}),r=new Wt({x:(i.x-this.app.stage.x())/e,y:(i.y-this.app.stage.y())/e}),s=(t.evt.shiftKey&&!t.evt.ctrlKey?t.evt.deltaX:t.evt.deltaY)>0?1:-1;let a=e;s>0?a+=this.app.config.mousewheel.factor:a-=this.app.config.mousewheel.factor,a=Math.min(Math.max(a,this.app.config.scale.min),this.app.config.scale.max),this.app.stage.scale({x:a,y:a}),this.app.stage.position({x:i.x-r.x*a,y:i.y-r.y*a}),this.app.emit("canvasZoomEnd",a)};destroy(){this.app.stage.off("mousedown",this.onMouseDown),this.app.stage.off("mouseup",this.onMouseUp),this.app.stage.off("mousemove",this.onMouseMove),this.app.stage.off("mouseover",this.onMouseOver),this.app.stage.off("mouseout",this.onMouseOut),this.app.stage.off("dblclick",this.onMouseDoubleClick),this.app.stage.off("click",this.onMouseClick),this.app.stage.off("contextmenu",this.onMouseContextmenu),this.app.stage.off("wheel",this.onWheel)}}const d1=n=>typeof n=="function";class M6 extends f1{currentTool=null;enable=!0;constructor(t){super(t),this.app.on("mouseDown",this.onMousedown),this.app.on("mouseMove",this.onMousemove),this.app.on("mouseUp",this.onMouseup),this.app.on("mouseClick",this.onClick),this.app.on("mouseDoubleClick",this.onDoubleClick)}get available(){return this.currentTool!==null&&this.enable&&!this.app.stage.draggable()}async setTool(t){const e=this.currentTool;e?.name!==t.name&&(e?.hooks&&d1(e?.hooks?.onInactive)&&await e.hooks.onInactive?.(this.app,e),this.currentTool=t,this.currentTool?.hooks&&d1(this.currentTool?.hooks?.onActive)&&await this.currentTool.hooks.onActive?.(this.app,this.currentTool),this.app.render(),this.app.emit("toolChanged",e,t))}trigger(t){const e=this.enable;t===void 0?this.enable=!this.enable:this.enable=t,this.currentTool?.enableChanged?.(e,this.enable)}onMousedown=t=>{!this.available||!this.currentTool?.mousedown||t.evt.button!==0||this.currentTool.mousedown({event:t,pointer:this.app.pointer,app:this.app})};onMouseup=t=>{!this.available||!this.currentTool?.mouseup||t.evt.button!==0||this.currentTool.mouseup({event:t,pointer:this.app.pointer,app:this.app})};onMousemove=t=>{!this.available||!this.currentTool?.mousemove||t.evt.button!==0||this.currentTool.mousemove({event:t,pointer:this.app.pointer,app:this.app})};onClick=t=>{!this.available||!this.currentTool?.click||t.evt.button!==0||this.currentTool.click({event:t,pointer:this.app.pointer,app:this.app})};onDoubleClick=t=>{!this.available||!this.currentTool?.doubleClick||t.evt.button!==0||this.currentTool.doubleClick({event:t,pointer:this.app.pointer,app:this.app})};destroy(){this.app.off("mouseDown",this.onMousedown),this.app.off("mouseMove",this.onMousemove),this.app.off("mouseUp",this.onMouseup),this.app.off("mouseClick",this.onClick),this.app.off("mouseDoubleClick",this.onDoubleClick),this.currentTool=null}}var R6=Object.defineProperty,D6=Object.getOwnPropertyDescriptor,sn=(n,t,e,i)=>{for(var r=i>1?void 0:i?D6(t,e):t,s=n.length-1,a;s>=0;s--)(a=n[s])&&(r=(i?a(t,e,r):a(r))||r);return i&&r&&R6(t,e,r),r};class L6{name="alignmentPlugin";alignment;app;options;keyFns=[];constructor(t){this.options={enabled:!0,...t}}install(t){this.app=t,this.alignment=new Mi(t,this.options),this.app.alignLeft=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignLeft(e),this},this.app.alignRight=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignRight(e),this},this.app.alignTop=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignTop(e),this},this.app.alignBottom=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignBottom(e),this},this.app.alignCenterX=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignCenterX(e),this},this.app.alignCenterY=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.alignCenterY(e),this},this.app.dispersionX=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.dispersionX(e),this},this.app.dispersionY=function(e){const i=this.app.getPlugin("alignmentPlugin");return i&&i.alignment?.dispersionY(e),this},this.keyFns.push(Qt.on({key:"a",title:"左对齐",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"h",title:"水平居中",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"d",title:"右对齐",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"w",title:"顶对齐",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"v",title:"垂直居中",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"s",title:"底对齐",shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"h",title:"水平分布",ctrl:!0,shift:!0},()=>{})),this.keyFns.push(Qt.on({key:"v",title:"垂直分布",ctrl:!0,shift:!0},()=>{})),this.app.emit("alignmentInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.app?.emit("alignmentDestroy",this)}enable(){this.alignment&&(this.options.enabled=!0,this.alignment.enabled=!0)}disable(){this.alignment&&(this.options.enabled=!1,this.alignment.enabled=!1)}isEnabled(){return this.options.enabled&&(this.alignment?.enabled??!1)}}function an(n,t,e){const i=e.value;return e.value=function(...r){if(this.enabled)return i.apply(this,r);console.log(`Method ${t} is disabled.`)},e}class Mi{app;enabled;constructor(t,e){const{enabled:i}=e;this.app=t,this.enabled=i}alignLeft(t){const e=t.map(r=>r.getClientRect()),i=Math.min(...e.map(r=>r.x));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].x-i;return a.attrs={...a.attrs,x:a.attrs.x-o},a}))}alignRight(t){const e=t.map(r=>r.getClientRect()),i=Math.max(...e.map(r=>r.x+r.width));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=i-(e[s].x+e[s].width);return a.attrs={...a.attrs,x:a.attrs.x+o},a}))}alignTop(t){const e=t.map(r=>r.getClientRect()),i=Math.min(...e.map(r=>r.y));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].y-i;return a.attrs={...a.attrs,y:a.attrs.y-o},a}))}alignBottom(t){const e=t.map(r=>r.getClientRect()),i=Math.max(...e.map(r=>r.y+r.height));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=i-(e[s].y+e[s].height);return a.attrs={...a.attrs,y:a.attrs.y+o},a}))}alignCenterX(t){const e=t.map(r=>r.getClientRect()),i=e.reduce((r,s)=>r+(s.x+s.width/2),0)/e.length;this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=i-(e[s].x+e[s].width/2);return a.attrs={...a.attrs,x:a.attrs.x+o},a}))}alignCenterY(t){const e=t.map(r=>r.getClientRect()),i=e.reduce((r,s)=>r+(s.y+s.height/2),0)/e.length;this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=i-(e[s].y+e[s].height/2);return a.attrs={...a.attrs,y:a.attrs.y+o},a}))}dispersionX(t){t.map(r=>r.getClientRect().x+r.getClientRect().width/2).every((r,s,a)=>r===a[0])||this.distributeNodes(t,"x")}dispersionY(t){t.map(r=>r.getClientRect().y+r.getClientRect().height/2).every((r,s,a)=>r===a[0])||this.distributeNodes(t,"y")}distributeNodes(t,e){if(t.length<=2)return;t.sort((d,f)=>d.getClientRect()[e]-f.getClientRect()[e]);const i=t[0],r=t[t.length-1],s=i.getClientRect()[e]+(e==="x"?i.getClientRect().width:i.getClientRect().height),a=r.getClientRect()[e]-s,h=t.slice(1,-1).reduce((d,f)=>d+(e==="x"?f.getClientRect().width:f.getClientRect().height),0),l=Math.max((a-h)/(t.length-1),0);let c=s;this.app.update(...t.map((d,f)=>{const u=d.toObject();if(f===0||f===t.length-1)return u;const m=c+l;return u.attrs[e]=m-d.getClientRect()[e]+u.attrs[e],c=m+(e==="x"?d.getClientRect().width:d.getClientRect().height),u}))}}sn([an],Mi.prototype,"alignLeft",1),sn([an],Mi.prototype,"alignRight",1),sn([an],Mi.prototype,"alignTop",1),sn([an],Mi.prototype,"alignBottom",1),sn([an],Mi.prototype,"alignCenterX",1),sn([an],Mi.prototype,"alignCenterY",1),sn([an],Mi.prototype,"dispersionX",1),sn([an],Mi.prototype,"dispersionY",1);class g1{app;selected;optionLayer;enabled;multipleSelect;hightLightConfig;transformerConfig;rubberConfig;transformer;rubberRect;rubberStartPoint=new Wt({x:0,y:0});rubberEnable=!1;hightLightRects;constructor(t,e){const{enabled:i,multipleSelect:r,transformer:s,hightLight:a,rubber:o}=e;this.app=t,this.selected=new Map,this.hightLightRects=new Map,this.enabled=i,this.multipleSelect=r,this.transformerConfig=s,this.hightLightConfig=a,this.rubberConfig=o,this.optionLayer=new Vt.Layer,this.optionLayer.name("pictode:option:layer"),this.app.stage.add(this.optionLayer),this.transformer=new Vt.Transformer({...this.transformerConfig,shouldOverdrawWholeArea:!1,flipEnabled:!1}),this.transformer.anchorStyleFunc(h=>{["middle-left","middle-right","top-center","bottom-center"].some(c=>h.hasName(c))&&([...this.selected.values()][0]instanceof Vt.Text||[...this.selected.values()][0]instanceof Vt.Group||this.selected.size>1)&&h.visible(!1);const l=(c="")=>{const d=h.getStage();!d||!d.content||(d.content.style.cursor=c)};h.on("mousedown",()=>{this.enabled=!1}),h.on("mouseup",()=>{this.enabled=!0}),h.on("mouseenter",()=>{this.enabled=!1,h.hasName("rotater")&&l("grabbing")}),h.on("mouseout",()=>{this.enabled=!0,h.hasName("rotater")&&l()})}),this.optionLayer.add(this.transformer),this.rubberRect=new Vt.Rect({stroke:this.rubberConfig.stroke,fill:this.rubberConfig.fill,strokeWidth:this.rubberConfig.strokeWidth,strokeScaleEnabled:!1}),this.optionLayer.add(this.rubberRect),this.transformer.on("transformstart",this.onTransformStart),this.transformer.on("transformend",this.onTransformEnd),this.transformer.on("dragstart",this.onDragStart),this.transformer.on("dragend",this.onDragEnd),this.app.on("mouseDown",this.onMouseDown),this.app.on("mouseMove",this.onMouseMove),this.app.on("mouseUp",this.onMouseUp),this.app.on("mouseClick",this.onMouseClick),this.app.on("mouseOut",this.onMouseOut)}handleNodeRemoved=({target:t})=>{this.cancelSelect(t),t.off("removed",this.handleNodeRemoved)};select(...t){this.enabled&&(c1(t,[...this.selected.values()])||(this.cancelSelect(),this.transformer.nodes(t.filter(e=>(e.draggable(!0),e.on("removed",this.handleNodeRemoved),this.selected.set(e.id(),e),e!==this.rubberRect))),this.setHightRect(...t),this.app.render(),this.app.emit("selectedChanged",Array.from(this.selected.values()))))}cancelSelect(...t){this.selected.size!==0&&(t.length===0&&(t=[...this.selected.values()]),t.forEach(e=>{e.draggable(!1),e.off("removed",this.handleNodeRemoved),this.selected.delete(e.id())}),this.removeHightRect(...t),this.transformer.nodes([...this.selected.values()]),this.app.emit("selectedChanged",Array.from(this.selected.values())))}selectAll(){this.select(...this.app.mainLayer.getChildren())}triggerSelector(t){t===void 0?this.enabled=!this.enabled:this.enabled=t,this.enabled||(this.rubberEnable=!1)}isSelected(t){return this.selected.has(t.id())}getSelectClientRect(){return this.transformer.getClientRect()}setHightRect(...t){this.hightLightRects=t.reduce((e,i)=>{const r=new Vt.Rect({stroke:this.hightLightConfig.stroke,strokeWidth:this.hightLightConfig.strokeWidth,dash:this.hightLightConfig.dash,fillEnabled:!1,strokeScaleEnabled:!1});this.calculateNodeRect(i,r,this.hightLightConfig.padding??0),this.optionLayer.add(r);const s=()=>requestAnimationFrame(()=>this.calculateNodeRect(i,r,this.hightLightConfig.padding??0));return i.on("dragmove transform xChange yChange",s),e.set(i.id(),{rect:r,transformHandler:s}),e},new Map)}removeHightRect(...t){t.forEach(e=>{const i=this.hightLightRects.get(e.id());i&&(e.off("dragmove transform xChange yChange",i.transformHandler),i.rect.remove(),this.hightLightRects.delete(e.id()))})}calculateNodeRect(t,e,i=0){const{x:r,y:s,width:a,height:o}=this.getNodeRect(t,i);e.position({x:(r-this.app.stage.x())/this.app.stage.scaleX(),y:(s-this.app.stage.y())/this.app.stage.scaleY()}),e.width(a/this.app.stage.scaleX()),e.height(o/this.app.stage.scaleY()),e.rotation(t.rotation())}getNodeRect(t,e=0){const i=f=>Vt.angleDeg?f*Math.PI/180:f,r=[];let s=[];t instanceof Vt.Group?s=t.getChildren():s=[t],s.map(f=>{const u=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.transformer.ignoreStroke()}),m=[{x:u.x,y:u.y},{x:u.x+u.width,y:u.y},{x:u.x+u.width,y:u.y+u.height},{x:u.x,y:u.y+u.height}],v=f.getAbsoluteTransform();m.forEach(function(b){const S=v.point(b);r.push(new Wt({x:S.x,y:S.y}))})});const a=new Vt.Transform;a.rotate(-i(t.rotation()));let o,h,l,c;r.forEach(function(f){const u=a.point(f);(o===void 0||h===void 0||l===void 0||c===void 0)&&(o=l=u.x,h=c=u.y),o=Math.min(o,u.x),h=Math.min(h,u.y),l=Math.max(l,u.x),c=Math.max(c,u.y)}),a.invert();const d=a.point({x:(o??0)-e,y:(h??0)-e});return{x:d.x,y:d.y,width:(l??0)-(o??0)+e*2,height:(c??0)-(h??0)+e*2}}onTransformStart=()=>{this.app.emit("nodeTransformStart",Array.from(this.selected.values())),this.app.emit("nodeUpdateBefore",Array.from(this.selected.values()))};onTransformEnd=()=>{this.app.emit("nodeTransformEnd",Array.from(this.selected.values())),this.app.emit("nodeUpdated",Array.from(this.selected.values()))};onDragStart=()=>{this.app.emit("nodeTransformStart",Array.from(this.selected.values())),this.app.emit("nodeUpdateBefore",Array.from(this.selected.values()))};onDragEnd=()=>{this.app.emit("nodeTransformEnd",Array.from(this.selected.values())),this.app.emit("nodeUpdated",Array.from(this.selected.values()))};onMouseDown=t=>{!this.enabled||t.evt.button!==0||t.target instanceof Vt.Stage&&(this.cancelSelect(),this.rubberStartPoint.clone(this.app.pointer),this.rubberRect.setPosition(this.rubberStartPoint),this.rubberRect.width(0),this.rubberRect.height(0),this.rubberRect.visible(!1),this.rubberEnable=!0)};onMouseMove=()=>{if(!this.enabled||!this.rubberEnable)return;const t=new Wt({x:Math.min(this.app.pointer.x,this.rubberStartPoint.x),y:Math.min(this.app.pointer.y,this.rubberStartPoint.y)});this.rubberRect.setPosition(t),this.rubberRect.width(Math.max(this.app.pointer.x,this.rubberStartPoint.x)-t.x),this.rubberRect.height(Math.max(this.app.pointer.y,this.rubberStartPoint.y)-t.y),this.rubberRect.visible(!0)};onMouseUp=t=>{if(!(!this.enabled||t.evt.button!==0)&&this.rubberEnable){const e=this.app.getShapesInArea(this.rubberRect);this.select(...e),this.rubberRect.visible(!1),this.rubberEnable=!1;return}};onMouseClick=t=>{if(!this.enabled||t.evt.button!==0||t.target instanceof Vt.Stage||!t.target.attrs.id)return;const i=this.app.findTopGroup(t.target)??t.target;t.evt.shiftKey&&this.multipleSelect?this.selected.has(i.attrs.id)?this.cancelSelect(i):this.select(...this.selected.values(),i):this.select(i)};onMouseOut=t=>{t.target instanceof Vt.Stage&&(this.rubberEnable=!1)};destroy(){this.transformer.off("transformstart",this.onTransformStart),this.transformer.off("transformend",this.onTransformEnd),this.transformer.off("dragstart",this.onDragStart),this.transformer.off("dragend",this.onDragEnd),this.app.off("mouseDown",this.onMouseDown),this.app.off("mouseMove",this.onMouseMove),this.app.off("mouseUp",this.onMouseUp),this.app.off("mouseClick",this.onMouseClick),this.app.off("mouseOut",this.onMouseOut),this.selected.clear(),this.enabled=!1,this.transformer.remove(),this.optionLayer.remove()}}const I6={enabled:!0,multipleSelect:!0,transformer:{padding:6,ignoreStroke:!0,borderStroke:"#4e86e3",borderStrokeWidth:1,borderDash:[3,3],anchorSize:8,anchorStroke:"#4e86e3",anchorCornerRadius:3,anchorStrokeWidth:1,rotateAnchorOffset:20},hightLight:{padding:3,stroke:"#4e86e3",strokeWidth:1},rubber:{stroke:"#4e86e3",strokeWidth:1,fill:"#4e86e350"}};class F6{name="selectorPlugin";selector;app;options;keyFns=[];constructor(t){this.options={...I6,...t}}install(t){this.app=t,this.selector=new g1(t,this.options),this.app.on("canvasCleared",this.onCanvasCleared),this.app.select=function(...e){const i=this.app.getPlugin("selectorPlugin");return i&&i.selector?.select(...e),this},this.app.cancelSelect=function(...e){const i=this.app.getPlugin("selectorPlugin");return i&&i.selector?.cancelSelect(...e),this},this.app.selectByEvent=function(e){return this.app.getPlugin("selectorPlugin")&&(e.target instanceof Vt.Stage?this.cancelSelect():this.select(e.target)),this},this.app.selectAll=function(){const e=this.app.getPlugin("selectorPlugin");return e&&e.selector?.selectAll(),this},this.app.triggerSelector=function(e){const i=this.app.getPlugin("selectorPlugin");return i&&i.selector?.triggerSelector(e),this},this.app.isSelected=function(e){const i=this.app.getPlugin("selectorPlugin");return i?i.selector?.isSelected(e)??!1:!1},this.keyFns.push(Qt.on({key:"a",title:"全部选中",exact:!0,ctrl:!0},()=>{const e=this.app?.isPluginEnable("selectorPlugin");this.app?.triggerSelector(!0),this.app?.selectAll(),this.app?.triggerSelector(e)})),this.keyFns.push(Qt.on({key:"g",title:"组合",ctrl:!0,shift:!0,exact:!0},()=>{})),this.app.emit("selectorInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.selector?.destroy(),this.app?.off("canvasCleared",this.onCanvasCleared),this.app?.emit("selectorDestroy",this)}enable(){this.selector&&(this.selector.triggerSelector(!0),this.options.enabled=!0)}disable(){this.selector&&(this.selector.cancelSelect(),this.selector.triggerSelector(!1),this.options.enabled=!1)}isEnabled(){return this.options.enabled&&(this.selector?.enabled??!1)}onCanvasCleared=()=>{this.selector?.cancelSelect()}}class fr{app;id=0;name;options;executed=!1;executeTime=new Date().getTime();constructor(t,e){this.app=t,this.name=this.constructor.name,this.options=e}toJSON(){return{id:this.id,name:this.name,options:this.options,executed:this.executed,executeTime:this.executeTime}}fromJSON(t){this.id=t.id,this.name=t.name,this.options=t.options,this.executed=t.executed,this.executeTime=t.executeTime}}class O6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._add(...this.options.nodes)}undo(){this.app._remove(...this.options.nodes)}}class N6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._remove(...this.options.nodes)}undo(){this.app._add(...this.options.nodes)}}class G6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._update(...this.options.newNodes)}undo(){this.app._update(...this.options.oldNodes)}}class U6 extends fr{constructor(t,e){super(t,e)}execute(){this.options.nodes.forEach(({node:t,newZIndex:e})=>{t.setZIndex(e)})}undo(){this.options.nodes.forEach(({node:t,oldZIndex:e})=>{t.setZIndex(e)})}}class B6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._makeGroup(this.options.nodes)}undo(){this.app._decomposeGroup(this.options.group)}}class z6 extends fr{constructor(t,e){super(t,e)}execute(){this.app._decomposeGroup(this.options.group)}undo(){this.app._makeGroup(this.options.nodes)}}class p1{name="history";app;enabled;stackSize;undoStack=[];redoStack=[];idCounter=0;constructor(t,e){const{enabled:i,stackSize:r}=e;this.app=t,this.enabled=i,this.stackSize=r}execute(t,e){this.undoStack.length>this.stackSize&&this.undoStack.shift(),this.undoStack.push(t),t.id=++this.idCounter,e&&t.execute(),t.executed=!0,t.executeTime=new Date().getTime(),this.redoStack=[],this.app.emit("stackChanged",this.undoStack,this.redoStack)}undo(t=1){if(!this.enabled)return;let e;for(;t;)this.undoStack.length>0&&(e=this.undoStack.pop(),e&&(e.undo(),this.redoStack.push(e),this.app.emit("stackChanged",this.undoStack,this.redoStack))),--t;return this.app.emit("historyUndo",t,e?.toJSON()),e}redo(t=1){if(!this.enabled)return;let e;for(;t;)this.redoStack.length>0&&(e=this.redoStack.pop(),e&&(e.execute(),this.undoStack.push(e),this.app.emit("stackChanged",this.undoStack,this.redoStack))),--t;return this.app.emit("historyRedo",t,e?.toJSON()),e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}jump(t){if(!this.enabled)return;let e=this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0;if(e===void 0||t>e.id)for(e=this.redo();e!==void 0&&t>e.id;)e=this.redo();else for(;e=this.undoStack[this.undoStack.length-1],!(e===void 0||t===e.id);)this.undo();this.app.emit("stackChanged",this.undoStack,this.redoStack)}destroy(){this.undoStack=[],this.redoStack=[],this.app.emit("stackChanged",this.undoStack,this.redoStack)}}class $6{name="historyPlugin";history;app;options;keyFns=[];oldNodes=[];constructor(t){this.options={enabled:!0,stackSize:100,...t}}install(t){this.app=t,this.history=new p1(t,this.options),this.history.app=t,this.app.on("nodeAdded",this.onNodeAdded),this.app.on("nodeRemoved",this.onNodeRemove),this.app.on("nodeUpdateBefore",this.onNodeUpdateBefore),this.app.on("nodeZindexChanged",this.onNodeZIndexChanged),this.app.on("nodeGroupMake",this.onMakeGroup),this.app.on("nodeGroupDecompose",this.onDecomposeGroup),this.app.on("nodeUpdated",this.onNodeUpdated),this.app.undo=function(e=1){const i=this.app.getPlugin("historyPlugin");return i&&i.history?.undo(e),this},this.app.redo=function(e=1){const i=this.app.getPlugin("historyPlugin");return i&&i.history?.redo(e),this},this.app.canUndo=function(){const e=this.app.getPlugin("historyPlugin");return e?e.history?.canUndo()??!1:!1},this.app.canRedo=function(){const e=this.app.getPlugin("historyPlugin");return e?e.history?.canRedo()??!1:!1},this.app.jump=function(e){const i=this.app.getPlugin("historyPlugin");return i&&i.history?.jump(e),this},this.keyFns.push(Qt.on({key:"z",title:"撤销",exact:!0,ctrl:!0},()=>{this.app?.undo()})),this.keyFns.push(Qt.on({key:"y",title:"重做",exact:!0,ctrl:!0},()=>{this.app?.redo()})),this.app.emit("historyInstalled",this)}destroy(){this.keyFns.forEach(t=>t.removeListener?.()),this.keyFns=[],this.history?.destroy(),this.app?.off("nodeAdded",this.onNodeAdded),this.app?.off("nodeRemoved",this.onNodeRemove),this.app?.off("nodeUpdateBefore",this.onNodeUpdateBefore),this.app?.off("nodeUpdated",this.onNodeUpdated),this.app?.off("nodeGroupMake",this.onMakeGroup),this.app?.off("nodeGroupDecompose",this.onDecomposeGroup),this.app?.emit("historyDestroy",this)}enable(){this.history&&(this.options.enabled=!0,this.history.enabled=!0)}disable(){this.history&&(this.options.enabled=!1,this.history.enabled=!1)}isEnabled(){return this.options.enabled&&(this.history?.enabled??!1)}onNodeAdded=t=>{!this.app||!this.history||this.history.execute(new O6(this.app,{nodes:t}))};onNodeRemove=t=>{!this.app||!this.history||this.history.execute(new N6(this.app,{nodes:t}))};onNodeUpdateBefore=t=>{this.oldNodes=t.map(e=>e.toObject())};onNodeUpdated=t=>{!this.app||!this.history||this.history.execute(new G6(this.app,{oldNodes:this.oldNodes,newNodes:t.map(e=>e.toObject())}))};onNodeZIndexChanged=t=>{!this.app||!this.history||this.history.execute(new U6(this.app,{nodes:t}))};onMakeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new B6(this.app,{nodes:e,group:t}))};onDecomposeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new z6(this.app,{nodes:e,group:t}))}}class V6{name="diamondTool";hooks;config;diamond=null;startPointer=new Wt({x:0,y:0});constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.diamond||(this.startPointer.clone(t.pointer),this.diamond=new Vt.RegularPolygon({sides:4,radius:0,strokeScaleEnabled:!1,...this.config}),this.diamond.setPosition(this.startPointer),t.add(this.diamond),this.hooks?.onStartDrawing?.(t,this.diamond))}mousemove({app:t}){if(!this.diamond)return;const e=t.pointer.x-this.startPointer.x,i=t.pointer.y-this.startPointer.y,r=new Wt({x:this.startPointer.x+e/2,y:this.startPointer.y+i/2});this.diamond.setPosition(r),this.diamond.radius(r.distanceTo(t.pointer)),t.render()}mouseup({app:t,pointer:e}){if(this.diamond){if(this.startPointer.eq(e)){this.diamond?.destroy(),this.diamond=null;return}this.hooks?.onCompleteDrawing?.(t,this.diamond),this.diamond=null,this.startPointer.setXY(0,0)}}enableChanged(){this.diamond=null,this.startPointer.setXY(0,0)}}class H6{name="drawingTool";config;hooks;line=null;points=[];constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){const e=this.points.at(-1);(!e||!e.eq(t.pointer))&&this.points.push(t.pointer),!this.line&&(this.line=new Vt.Line({points:ur(this.points),globalCompositeOperation:"source-over",lineCap:"round",lineJoin:"round",strokeScaleEnabled:!1,hitStrokeWidth:20,...this.config}),t.add(this.line),this.hooks?.onStartDrawing?.(t,this.line))}mousemove({app:t,event:e}){this.line&&(e.evt.stopPropagation(),this.points.push(t.pointer),this.line.points(ur(this.points)))}mouseup({app:t,pointer:e}){if(!this.line)return;const i=this.points.at(-1);this.points.length<=6&&i&&e.distanceTo(i)<10&&this.line&&this.line.destroy(),this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[]}enableChanged(){this.line=null,this.points=[]}}class j6{name="ellipseTool";config;hooks;ellipse=null;startPointer=new Wt({x:0,y:0});constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.ellipse||(this.startPointer.clone(t.pointer),this.ellipse=new Vt.Ellipse({radiusX:0,radiusY:0,strokeScaleEnabled:!1,...this.config}),this.ellipse.setPosition(this.startPointer),this.ellipse.radius(new Wt({x:0,y:0})),t.add(this.ellipse))}mousemove({app:t}){if(!this.ellipse)return;const e=t.pointer.x-this.startPointer.x,i=t.pointer.y-this.startPointer.y,r=new Wt({x:Math.abs(e)/2,y:Math.abs(i)/2});this.ellipse.setPosition(new Wt({x:this.startPointer.x+e/2,y:this.startPointer.y+i/2})),this.ellipse.radius(r),t.render()}mouseup({app:t,pointer:e}){if(this.ellipse){if(this.startPointer.eq(e)){this.ellipse?.destroy(),this.ellipse=null;return}this.hooks?.onCompleteDrawing?.(t,this.ellipse),this.ellipse=null,this.startPointer.setXY(0,0)}}enableChanged(){this.ellipse=null,this.startPointer.setXY(0,0)}}class X6{name="imageTool";config;hooks;image=null;isAdded=!1;imageElement=new Image;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.image&&(this.image.opacity(1),this.hooks?.onCompleteDrawing?.(t,this.image),this.image=null)}mousemove({app:t,pointer:e}){if(this.isAdded||(this.image=new Vt.Image({strokeScaleEnabled:!1,image:this.imageElement,...this.config}),this.image.opacity(.5),this.image.image(this.imageElement),t.add(this.image),this.isAdded=!0),!this.image)return;const i=200,r=i*((this.imageElement.height??1)/(this.imageElement.width??1));this.image.width(i),this.image.height(r),this.image.position(new Wt({x:e.x-i/2,y:e.y-r/2})),t.render()}enableChanged(){this.image=null,this.imageElement=new Image}}class Y6{name="lineTool";config;hooks;points=[];line=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.line||(this.line=new Vt.Line({points:ur(this.points),fill:"transparent",strokeScaleEnabled:!1,hitStrokeWidth:20,...this.config}),t.add(this.line),this.hooks?.onStartDrawing?.(t,this.line));const e=this.points.at(-1);(!e||!e.eq(t.pointer))&&this.points.push(t.pointer),this.line.points(ur(this.points))}mousemove({app:t,pointer:e}){this.line&&(this.line.points(ur(this.points).concat(e.x,e.y)),t.render())}doubleClick({app:t}){this.line&&(this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[])}enableChanged(){this.line=null,this.points=[]}}class q6{name="rectTool";config;hooks;startPointer=new Wt({x:0,y:0});rectangle=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}mousedown({app:t}){this.rectangle||(this.startPointer.clone(t.pointer),this.rectangle=new Vt.Rect({strokeScaleEnabled:!1,...this.config}),this.rectangle.setPosition(this.startPointer),this.rectangle.width(0),this.rectangle.height(0),t.add(this.rectangle),this.hooks?.onStartDrawing?.(t,this.rectangle))}mousemove({app:t}){this.rectangle&&(this.rectangle.setPosition(new Wt({x:Math.min(this.startPointer.x,t.pointer.x),y:Math.min(this.startPointer.y,t.pointer.y)})),this.rectangle.width(Math.abs(t.pointer.x-this.startPointer.x)),this.rectangle.height(Math.abs(t.pointer.y-this.startPointer.y)),t.render())}mouseup({app:t,pointer:e}){if(this.rectangle){if(this.startPointer.eq(e)){this.rectangle?.destroy(),this.rectangle=null;return}this.hooks?.onCompleteDrawing?.(t,this.rectangle),this.rectangle=null,this.startPointer.setXY(0,0)}}enableChanged(){this.rectangle=null,this.startPointer.setXY(0,0)}}class W6{name="selectTool";hooks;constructor(t){this.hooks=t.hooks}}const K6=(n,t,e)=>{t.hide();const i=t.absolutePosition(),r={x:n.stage.container().offsetLeft+i.x,y:n.stage.container().offsetTop+i.y},s=document.createElement("textarea");document.body.appendChild(s),s.value=t.text(),s.style.position="absolute",s.style.top=r.y+"px",s.style.left=r.x+"px",s.style.width=t.width()*t.scaleX()-t.padding()*2+"px",s.style.height=t.height()*t.scaleX()-t.padding()*2+5+"px",s.style.fontSize=t.fontSize()*t.scaleX()+"px",s.style.border="none",s.style.padding="0px",s.style.margin="0px",s.style.overflow="hidden",s.style.background="none",s.style.outline="none",s.style.resize="none",s.style.lineHeight=t.lineHeight().toString(),s.style.fontFamily=t.fontFamily(),s.style.transformOrigin="left top",s.style.textAlign=t.align(),s.style.color=t.stroke(),s.style.caretColor=t.stroke();const a=t.rotation();let o="";a&&(o+="rotateZ("+a+"deg)");let h=0;navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&(h+=2+Math.round(t.fontSize()/20)),o+="translateY(-"+h+"px)",s.style.transform=o,s.style.height=s.scrollHeight+3+"px",s.focus();function c(){s.parentNode?.removeChild(s),window.removeEventListener("click",f),t.show()}function d(u){u=Math.max(s.value.length*t.fontSize(),u);const m=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),v=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;(m||v)&&(u=Math.ceil(u)),(document.DOCUMENT_NODE||/Edge/.test(navigator.userAgent))&&(u+=1),s.style.width=u+"px"}s.addEventListener("keydown",function(u){u.key==="Enter"&&!u.shiftKey&&(s.value.trim().length>=1?t.text(s.value.charAt(0)===" "?s.value.substring(1):s.value):n.remove(t),c(),e()),u.key==="Escape"&&c()}),s.addEventListener("keydown",function(){const u=t.getAbsoluteScale().x;d(t.width()*u),s.style.height="auto",s.style.height=s.scrollHeight+t.fontSize()+"px"});function f(u){u.target!==s&&(t.text(s.value),c())}setTimeout(()=>{window.addEventListener("click",f)})};class Z6{name="textTool";config;hooks;textNode=null;constructor({config:t,hooks:e}){this.config=t,this.hooks=e}doubleClick({app:t,pointer:e}){this.textNode=new Vt.Text({...this.config,text:" ",x:e.x,y:e.y,fontFamily:"JiaYouYa"}),this.textNode.on("dblclick",({target:i})=>{K6(t,i,()=>{this.hooks?.onCompleteDrawing?.(t,i)})}),t.add(this.textNode),this.textNode.fire("dblclick")}enableChanged(){this.textNode=null}}class J6{name="eraserTool";hooks;targetMap=new Map;isEraser=!1;constructor(t){this.hooks=t.hooks}mousedown({event:t}){this.isEraser=!0,!(t.target instanceof Vt.Stage)&&(this.targetMap.set(t.target.id(),{node:t.target,opacity:t.target.attrs.opacity}),t.target.opacity(.3))}mouseup({app:t}){this.targetMap.size&&(t.remove(...[...this.targetMap.values()].map(({node:e,opacity:i})=>(e.opacity(i),e))),this.targetMap.clear(),this.isEraser=!1)}mousemove({event:t}){!this.isEraser||t.target instanceof Vt.Stage||this.targetMap.get(t.target.id())||(this.targetMap.set(t.target.id(),{node:t.target,opacity:t.target.attrs.opacity}),t.target.opacity(.3))}enableChanged(){this.targetMap.clear(),this.isEraser=!1}}const m1={backgroundColor:"#ffffff",scale:{min:.05,max:5},panning:{enabled:!1,cursor:"grabbing"},mousewheel:{enabled:!1,factor:.1}};class Q6 extends Zl{stage;mainLayer;config;mouse;tooler;installedPlugins=new Map;resizeObserver;constructor(t){super(),this.config={...m1,...t},this.stage=new Vt.Stage({container:document.createElement("div"),width:500,height:500}),this.stage.container().style.backgroundColor=this.config.backgroundColor,this.mainLayer=new Vt.Layer,this.mainLayer.name("main:layer"),this.stage.add(this.mainLayer),this.tooler=new M6(this),this.mouse=new A6(this),this.resizeObserver=new ResizeObserver(e=>{const{width:i,height:r}=e[0].contentRect;this.stage.width(i),this.stage.height(r),this.emit("resizeRoot",i,r),this.render()}),this.triggerPanning(this.config.panning.enabled),this.triggerMouseWheel(this.config.mousewheel.enabled),this.registerKeyFns()}registerKeyFns(){Qt.on({key:"o",title:"打开",exact:!0,ctrl:!0},()=>{ec().then(t=>ko(t[0])).then(t=>{this.fromJSON(t)})}),Qt.on({key:"e",title:"导出图片",exact:!0,ctrl:!0,shift:!0},()=>{}),Qt.on({key:"[",title:"下移一层",exact:!0,ctrl:!0},()=>{}),Qt.on({key:"]",title:"上移一层",exact:!0,ctrl:!0},()=>{}),Qt.on({key:"[",title:"置于底层",exact:!0,ctrl:!0,shift:!0},()=>{}),Qt.on({key:"]",title:"置于顶层",exact:!0,ctrl:!0,shift:!0},()=>{}),Qt.on({key:["delete","backspace"],title:"删除"},()=>{console.log("删除")}),Qt.on({key:"r",title:"重置画布",exact:!0,ctrl:!0},()=>{}),Qt.on({key:" ",title:"移动画布"},()=>(console.log("移动画布"),this.triggerPanning(!0),()=>{this.triggerPanning(!1)})),Qt.on({key:["Control","Meta"],title:"缩放画布"},()=>(this.triggerMouseWheel(!0),()=>{this.triggerMouseWheel(!1)})),Qt.on({key:"j",title:"解除组合",ctrl:!0,shift:!0,exact:!0},()=>{})}get pointer(){const{x:t,y:e}=this.stage.getRelativePointerPosition()??{x:0,y:0};return new Wt({x:t,y:e})}get curTool(){return this.tooler.currentTool}get containerElement(){return this.stage.container()}mount(t){this.stage.container(t),this.resizeObserver.observe(this.stage.container())}async setTool(t){await this.tooler.setTool(t)}triggerPanning(t){return t===void 0?this.stage.draggable(this.stage.draggable()):this.stage.draggable(t),this.stage.draggable()?this.stage.container().style.cursor=this.config.panning.cursor??"grabbing":this.stage.container().style.cursor="default",this}triggerMouseWheel(t){return t===void 0?this.config.mousewheel.enabled=!this.config.mousewheel.enabled:this.config.mousewheel.enabled=t,this}triggerTool(t){return this.tooler.trigger(t),this}add(...t){return this._add(...t),this.emit("nodeAdded",t),this}_add(...t){return this.mainLayer.add(...t.map(e=>(e.attrs.id||e.id(`#${R1()}`),e))),this.render(),this}remove(...t){return this._remove(...t),this.emit("nodeRemoved",t),this}_remove(...t){return t.forEach(e=>{e.remove()}),this.render(),this}update(...t){const e=i=>i.reduce((r,s)=>{const a=this.getNodeById(s.attrs.id);return a&&r.push(a),r},[]);return this.emit("nodeUpdateBefore",e(t)),this._update(...t),this.emit("nodeUpdated",e(t)),this}_update(...t){return t.forEach(e=>{this.getNodeById(e.attrs.id)?.setAttrs(e.attrs)}),this.render(),this}makeGroup(t){const e=this._makeGroup(t);return e instanceof Vt.Group&&this.emit("nodeGroupMake",e,t),e}_makeGroup(t){if(t.length<2)return t;const e=new Vt.Group({draggable:!0});return e.add(...t.map(i=>(i.draggable(!1),i))),this._add(e),e}decomposeGroup(t){const e=this._decomposeGroup(t);return this.emit("nodeGroupDecompose",t,e),e}_decomposeGroup(t){const e=t.getParent()??this.mainLayer,i=[...t.getChildren()].map(r=>{const{x:s,y:a,scaleX:o,scaleY:h,skewX:l,skewY:c,rotation:d}=r.getTransform().decompose();return r.moveTo(e),r.x(s),r.y(a),r.scaleX(o),r.scaleY(h),r.skewX(l),r.skewY(c),r.rotation(d),r});return this._remove(t),i}findTopGroup(t){return t.parent instanceof Vt.Group&&t.parent.parent instanceof Vt.Group?this.findTopGroup(t.parent):t.parent instanceof Vt.Group?t.parent:null}moveUp(...t){return this.moveZIndexNodes(t,e=>e.moveUp()),this}moveDown(...t){return this.moveZIndexNodes(t,e=>e.moveDown()),this}moveTop(...t){return this.moveZIndexNodes(t,e=>e.moveToTop()),this}moveBottom(...t){return t.forEach(e=>e.moveToBottom()),this.moveZIndexNodes(t,e=>e.moveToBottom()),this}moveZIndexNodes(t,e){const i=t.map(r=>{const s={node:r,oldZIndex:r.getZIndex(),newZIndex:r.getZIndex()};return e(r),s.newZIndex=r.getZIndex(),s});i.some(({oldZIndex:r,newZIndex:s})=>r!==s)&&this.emit("nodeZindexChanged",i)}getNodeById(t){return this.getNodes(e=>e.id()===t)?.[0]}getNodes(t){return this.mainLayer.find(t)??[]}isPointInArea(t,e){const{width:i,height:r,x:s,y:a}=e;return t.x>=s&&t.x<=s+i&&t.y>=a&&t.y<=a+r}getShapesInArea(t){return this.mainLayer.getChildren(e=>e.visible()&&e!==t&&this.haveIntersection(t,e))}haveIntersection(t,e){const i=t.getClientRect({relativeTo:this.stage}),r=e.getClientRect({relativeTo:this.stage}),s=i.x<=r.x&&i.y<=r.y,a=i.x+i.width>=r.x+r.width&&i.y<=r.y,o=i.x<=r.x&&i.y+i.height>=r.y+r.height,h=i.x+i.width>=r.x+r.width&&i.y+i.height>=r.y+r.height;return s&&a&&o&&h}render(){this.mainLayer.draw()}scale(){return this.stage.scaleX()}scaleTo(t,e=new Wt({x:0,y:0})){const i=this.scale();this.emit("canvasZoomStart",i);const r=Math.min(Math.max(t,this.config.scale.min),this.config.scale.max),s=new Wt({x:(e.x-this.stage.x())/i,y:(e.y-this.stage.y())/i});return this.stage.scale({x:r,y:r}),this.stage.position({x:e.x-s.x*r,y:e.y-s.y*r}),this.emit("canvasZoomEnd",this.scale()),this}clear(){this.mainLayer.removeChildren(),this.emit("canvasCleared"),this.render()}async toDataURL(t,e){const{padding:i=10,pixelRatio:r=2,mimeType:s="image/png",quality:a=1,haveBackground:o=!1}=e??{},h=new Vt.Layer;this.stage.add(h);let l=[];t&&t.length>0?l=t.map(R=>R.toObject()):l=this.mainLayer.children?.map(R=>R.toObject())??[];const c=l.map(R=>Vt.Node.create(R));h.add(...c);const d=new Vt.Transformer({rotateAnchorOffset:0});d.nodes(c);const f=d.getClientRect(),u=this.stage.scaleX(),m=this.stage.scaleY(),v=this.stage.x(),b=this.stage.y(),S=f.width+i*2,E=f.height+i*2,_=f.x-i,x=f.y-i,P=new Vt.Rect({width:S,height:E,x:(_-v)/u,y:(x-b)/m,fill:this.stage.container().style.backgroundColor});return o&&(h.add(P),P.moveToBottom()),new Promise((R,O)=>{try{h.toDataURL({width:S,height:E,x:_,y:x,pixelRatio:r,mimeType:s,quality:a,callback:L=>{R({dataURL:L,width:S,height:E}),d.remove(),h.remove()}})}catch(L){O(L)}})}toJSON(){return JSON.stringify(this.mainLayer.toObject())}fromJSON(t){this.clear(),this.mainLayer.remove();const e=Vt.Node.create(t,"layer");return this.mainLayer=e,this.stage.add(this.mainLayer),this.render(),this}use(t,...e){return this.installedPlugins.has(t.name)||(this.installedPlugins.set(t.name,t),t.install(this,...e)),this}getPlugin(t){return this.installedPlugins.get(t)}getPlugins(t){return t.map(e=>this.getPlugin(e))}enablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.enable?.()),this}disablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.disable?.()),this}isPluginEnable(t){return this.getPlugin(t)?.isEnabled?.()??!1}destroyPlugins(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(i=>i?.destroy()),this}destroy(){this.resizeObserver.disconnect(),this.destroyPlugins(Array.from(this.installedPlugins.keys())),this.mouse.destroy(),this.tooler.destroy(),this.stage.destroy(),this.removeAllListeners()}}const v1=[],_1={};function Ml(n){v1.push(n)}function t8(n,t=!1){const e=Wc();if(_1[e])return;wx.error(s=>{console.log(s.errMsg??JSON.stringify(s))}),wx.ready(()=>{v1.forEach(s=>s())});const i=["updateAppMessageShareData","updateTimelineShareData","onMenuShareWeibo","onMenuShareQZone","startRecord","stopRecord","onVoiceRecordEnd","playVoice","pauseVoice","stopVoice","onVoicePlayEnd","uploadVoice","downloadVoice","chooseImage","previewImage","uploadImage","downloadImage","getLocalImgData","translateVoice","getNetworkType","openLocation","getLocation","hideOptionMenu","showOptionMenu","hideMenuItems","showMenuItems","hideAllNonBaseMenuItem","showAllNonBaseMenuItem","closeWindow","scanQRCode","openProductSpecificView","addCard","chooseCard","openCard"],r=["wx-open-launch-app","wx-open-launch-app","wx-open-subscribe","wx-open-audio"];wx.config(Object.assign(n,{debug:t,jsApiList:i,openTagList:r})),_1[e]=!0}function e8(n){return new Promise((t,e)=>{wx.checkJsApi({jsApiList:[n],success:function(i){i.checkResult[n]?t(!0):e(!1)},fail:function(){e(!1)}})})}function i8(n){Ml(function(){wx.updateAppMessageShareData(n)})}function n8(n){Ml(function(){wx.updateTimelineShareData(n)})}function r8(n){wx.chooseImage(n)}function s8(n){wx.previewImage(n)}function a8(n){wx.uploadImage(n)}function o8(n){wx.downloadImage(n)}function h8(n){wx.getLocalImgData(n)}function l8(){wx.startRecord()}function c8(n){wx.stopRecord(n)}function u8(n){wx.onVoiceRecordEnd(n)}function f8(n){wx.playVoice(n)}function d8(n){wx.pauseVoice(n)}function g8(n){wx.stopVoice(n)}function p8(n){wx.onVoicePlayEnd(n)}function m8(n){wx.uploadVoice(n)}function v8(n){wx.downloadVoice(n)}function _8(n){wx.translateVoice(n)}function y8(n){wx.getNetworkType(n)}function w8(n){wx.openLocation(n)}function b8(n){wx.getLocation(n)}function x8(n){wx.scanQRCode(n)}function S8(n,t,e){function i(){WeixinJSBridge.invoke("getBrandWCPayRequest",n,function(r){r.err_msg=="get_brand_wcpay_request:ok"?t():e(r.err_msg)})}typeof WeixinJSBridge>"u"?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",i,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",i),document.attachEvent("onWeixinJSBridgeReady",i)):i()}function C8(n){window.AlipayJSBridge?n&&n():document.addEventListener("AlipayJSBridgeReady",n,!1)}function Qs(n,t){let e="未知错误";switch(n.error){case 1:e="接口不存在";break;case 2:e="参数无效";break;case 3:e="发生未知错误";break;case 4:e="接口无权限";break;case 10:e="用户取消";break;case 11:e="操作失败",t==="chooseImage"&&(e="操作失败(权限不够)");break;case 12:e="GPS打开,但定位失败";break;case 13:e="获取地理位置信息失败";break;case 14:e="定位超时";break;case 15:e="网络错误";break;case 16:e="GPS未打开或用户未授权";break}return`${n.error}(${e}): ${n.errorMessage}`}function T8(n,t,e){ap.tradePay(Object.assign(n,{}),function(i){let r="未知错误";switch(i.resultCode){case 9e3:return r="订单支付成功",t?.(r);case 8e3:r="正在处理中";break;case 4e3:r="订单支付失败";break;case 6001:r="用户中途取消";break;case 6002:r="网络连接出错";break;case 99:r="用户点击忘记密码导致快捷界面退出(only iOS)";break}e?.(r)})}function k8(n,t,e){ap.scan(Object.assign(n,{fail:i=>{e?.(Qs(i))}}),function(i){t?.(i.code)})}function E8(n,t,e){ap.getLocation(Object.assign(n,{fail:i=>{e?.(Qs(i))}}),function(i){t?.(i)})}function P8(n,t,e){ap.openLocation(Object.assign(n,{fail:i=>{e?.(Qs(i))}}),function(){t?.()})}function A8(n,t,e){ap.chooseImage(Object.assign(n,{fail:i=>{e?.(Qs(i,"chooseImage"))}}),function(i){t?.(i)})}function M8(n,t,e){ap.previewImage(Object.assign(n,{fail:i=>{e?.(Qs(i))}}),function(){t?.()})}class R8{map;constructor(t,e=120.619585,i=31.299379,r=18){this.map=new T.Map(t),this.map.centerAndZoom(new T.LngLat(e,i),r)}}V.AlignmentPlugin=L6,V.AnimateOperation=lp,V.CanvasOperation=Wo,V.CustomCanvasContext=Mr,V.CustomCanvasGradient=fa,V.CustomCanvasPattern=No,V.DEFAULT_APP_CONFIG=m1,V.DOMCanvas=_p,V.DOMEvent=Eg,V.DOMKey=Qt,V.DOMMedia=kg,V.DOMMouse=Pr,V.DOMQuery=oe,V.DOMScroll=Pg,V.DOMToBlob=tc,V.DOMToString=Ql,V.DOMUtil=It,V.Dep=Mf,V.DiamondTool=V6,V.DrawingTool=H6,V.EllipseTool=j6,V.EraserTool=J6,V.HSVToRGBObject=Tp,V.History=p1,V.HistoryPlugin=$6,V.ImageTool=X6,V.KonvaApp=Q6,V.LineTool=Y6,V.Matrix=we,V.Matrix3D=pn,V.PathGroup=mn,V.Point=Wt,V.Polygon=Ir,V.QRCode=Ki,V.RGBStringToHexString=Sp,V.RGBToHSVObject=kp,V.Rect=jn,V.RectTool=q6,V.SVGOperation=Vi,V.SelectTool=W6,V.Selector=g1,V.SelectorPlugin=F6,V.ShapeArmyAnts=N_,V.ShapeArrow=C_,V.ShapeBall=T_,V.ShapeLight=Rf,V.ShapeLine=k_,V.ShapePoint3d=M_,V.ShapeRect=E_,V.ShapeSegment=I_,V.ShapeShip=P_,V.ShapeSlider=L_,V.ShapeSmileFace=G_,V.ShapeSpirograph=F_,V.ShapeStar=O_,V.ShapeTree=A_,V.ShapeTriangle=R_,V.ShapeTriangleLight=D_,V.TWEEN=vp,V.TextTool=Z6,V.Vector=Fa,V.VideoUtil=rs,V.WebGLRenderer=B_,V.WebRTCClient=U_,V.WebSocketClient=W1,V.YZRaphael=qo,V.absolutize=pa,V.addWatermark=u_,V.addWxJsReadyFnBeforeConfig=Ml,V.ajax=y_,V.aliJsChooseImage=A8,V.aliJsGetLocation=E8,V.aliJsOpenLocation=P8,V.aliJsPreviewImage=M8,V.aliJsReady=C8,V.aliJsScan=k8,V.aliJsTradePay=T8,V.angle=Io,V.animateInWeb=Ko,V.appendURLSearchString=wa,V.base64URLDecode=Pp,V.base64URLEncode=Ep,V.blobToRawImage=Nv,V.canDrawBitmap=_g,V.canUsePaths=vg,V.canUseWorker=pc,V.changeBrightness=l_,V.changeDiaphaneity=c_,V.changeSize=h_,V.checkWxJsApi=e8,V.clearCookies=Tg,V.colorNumberToHexString=Xc,V.colorNumberToRGBString=Yc,V.compression=d_,V.createXMLHttpRequest=Fh,V.debugObject=wg,V.debugObjectProperty=yg,V.distance=mc,V.dquery=Do,V.drawQRCodeToCanvas=v_,V.fileOrBlobToDataURL=Lh,V.fileToArrayBufferPromise=ic,V.flatPoints=ur,V.flipSideToSide=Uv,V.flipUpsideDown=Bv,V.formDataToSearchString=eh,V.getBrowserClient=Ao,V.getBrowserClientVersion=rg,V.getBrowserLanguage=ag,V.getCookie=Sg,V.getCookieObject=Cg,V.getDirection=vc,V.getDocumentElement=Eo,V.getElementLeftInPage=oc,V.getElementPositionInPage=ac,V.getElementPositionInPage2=Q1,V.getElementPositionInViewport=tg,V.getElementTopInPage=hc,V.getFileExtensionFromFile=nc,V.getFileTypeFromFile=H1,V.getFilesImageInfo=Rv,V.getFormSubmitData=__,V.getGlobal=Po,V.getGroupCoords=P6,V.getImageDataByAIData=g_,V.getImageDataFromBitmap=Lv,V.getImageDataFromUrl=bf,V.getImageDataFromVideo=Dv,V.getImageMainColor=Gv,V.getInternetExplorerVersion=uc,V.getMiddleValue=E6,V.getMousePositionInElement=ze,V.getMousePositionInPage=lc,V.getMousePositionInViewport=ig,V.getOperatingSystem=ha,V.getOperatingSystemVersion=ng,V.getPageClient=aa,V.getPageScroll=Hn,V.getPageSize=K1,V.getPointAtLength=Gc,V.getRaphael=sp,V.getRawImageInfo=Dh,V.getRelativeBoundingClientRect=eg,V.getScrollParent=V_,V.getTimeZone=og,V.getTotalLength=Nc,V.getURL=th,V.getUserGeolocationPromise=sg,V.getViewportSize=oa,V.getWorker=Op,V.gifImage=Cf,V.h=q1,V.handleDragAndDropFiles=X1,V.handleInputFiles=j1,V.hasDocument=gg,V.hasHistory=pg,V.hasWindow=gc,V.hexStringToColorNumber=ya,V.hexStringToRGBString=Qo,V.ifWebFileHasChanged=w_,V.imageDataToBitmap=Iv,V.imageDataToBlob=Ov,V.imageDataToDataURL=Fv,V.injectWxJsConfig=t8,V.isAliBrowser=dc,V.isAliMiniProgram=fg,V.isAndroid=cc,V.isAppleDevice=hg,V.isBrowserSupportFileAPI=mg,V.isDarkMode=cg,V.isElementInViewport=J1,V.isElementInViewportSimple=Z1,V.isIE=dg,V.isIOS=Mo,V.isMacOS=Ro,V.isMobile=lg,V.isPointInPath=Uc,V.isPointInStroke=Bc,V.isSvgPath=Ec,V.isURL=Ap,V.isWxBrowser=fc,V.isWxMiniProgram=ug,V.jpgToPng=r_,V.leftRotate=zv,V.linkExport=To,V.localstorage=Oo,V.mapTDTJSSDK=R8,V.marginSharpen=n_,V.microTask=Y1,V.mosaic=f_,V.mount=kr,V.norm=ca,V.normalize=ma,V.normalizePoint=Fo,V.onHashChange=Ip,V.onHistoryChange=Fp,V.onURLChange=Lp,V.outputGifBase64=Tf,V.outputQRCodeBase64=m_,V.parse=ga,V.parseTransformToMatrix=Rr,V.parseURL=qc,V.patch=rc,V.patchDOM=sc,V.pngToJpg=s_,V.qrDecompose=u1,V.radiusClip=o_,V.randomColorHexString=bp,V.randomColorHexString2=xp,V.randomColorNumber=wp,V.rappar=kc,V.reactiveVue2=x_,V.reactiveVue3=S_,V.readFileInBrowser=ko,V.recordToSearchString=Kc,V.recordToSearchString2=Dp,V.rectClip=a_,V.relative=Vg,V.rightRotate=$v,V.searchStringToRecord=Mp,V.searchStringToRecord2=Rp,V.selectFileInBrowser=ec,V.setCookie=xg,V.setRem=bg,V.shadeColor=Cp,V.shapeArrayEqual=c1,V.sharpen=i_,V.stringToBlob=Co,V.stringToDOM=V1,V.theme=yp,V.toBlackAndWhite=jv,V.toBlue=Wv,V.toBlueAndGreen=Jv,V.toBlueAndGrey=e_,V.toDegree=Lo,V.toGreen=qv,V.toGreenAndGrey=t_,V.toGrey=Vv,V.toGrey2=Hv,V.toOpposite=Xv,V.toRadian=la,V.toRed=Yv,V.toRedAndBlue=Zv,V.toRedAndGreen=Kv,V.toRedAndGrey=Qv,V.trimURLHash=Wc,V.watchEffect=b_,V.wxJsChooseImage=r8,V.wxJsDownloadImage=o8,V.wxJsDownloadVoice=v8,V.wxJsGetLocalImgData=h8,V.wxJsGetLocation=b8,V.wxJsGetNetworkType=y8,V.wxJsOnVoicePlayEnd=p8,V.wxJsOnVoiceRecordEnd=u8,V.wxJsOpenLocation=w8,V.wxJsPauseVoice=d8,V.wxJsPay=S8,V.wxJsPlayVoice=f8,V.wxJsPreviewImage=s8,V.wxJsScanQRCode=x8,V.wxJsStartRecord=l8,V.wxJsStopRecord=c8,V.wxJsStopVoice=g8,V.wxJsTranslateVoice=_8,V.wxJsUpdateAppMessageShareData=i8,V.wxJsUpdateTimelineShareData=n8,V.wxJsUploadImage=a8,V.wxJsUploadVoice=m8,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
|
|
45
45
|
//# sourceMappingURL=zyzgroup_core_web.umd.cjs.map
|