@zyzgroup/core-web 0.0.15 → 0.0.17
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 +20 -15
- package/dist/zyzgroup_core_web.iife.js.map +1 -1
- package/dist/zyzgroup_core_web.js +11021 -6753
- package/dist/zyzgroup_core_web.js.map +1 -1
- package/dist/zyzgroup_core_web.umd.cjs +20 -15
- package/dist/zyzgroup_core_web.umd.cjs.map +1 -1
- package/package.json +2 -1
- package/types/canvas/index.d.ts +1 -1
- package/types/canvas/index.d.ts.map +1 -1
- package/types/canvas/konva/utils/index.d.ts +2 -2
- package/types/canvas/konva/utils/index.d.ts.map +1 -1
- package/types/canvas/shapes/ball.d.ts +2 -2
- package/types/canvas/shapes/ball.d.ts.map +1 -1
- package/types/color.d.ts +1 -0
- package/types/color.d.ts.map +1 -1
- package/types/dom/DOMMouse.d.ts +3 -1
- package/types/dom/DOMMouse.d.ts.map +1 -1
- package/types/dom/DOMQuery.d.ts.map +1 -1
- package/types/dom/DOMScroll.d.ts +4 -0
- package/types/dom/DOMScroll.d.ts.map +1 -1
- package/types/dom/DOMUtil.d.ts +18 -0
- package/types/dom/DOMUtil.d.ts.map +1 -1
- package/types/index.d.ts +2 -4
- package/types/index.d.ts.map +1 -1
- package/types/position.d.ts.map +1 -1
- package/types/{math/AnimateShape.d.ts → shape/AnimateBasePoint.d.ts} +11 -11
- package/types/shape/AnimateBasePoint.d.ts.map +1 -0
- package/types/shape/Arc.d.ts +18 -0
- package/types/shape/Arc.d.ts.map +1 -0
- package/types/shape/CubicBezier.d.ts +11 -0
- package/types/shape/CubicBezier.d.ts.map +1 -0
- package/types/shape/Line.d.ts +10 -0
- package/types/shape/Line.d.ts.map +1 -0
- package/types/{math → shape}/Matrix.d.ts +3 -2
- package/types/shape/Matrix.d.ts.map +1 -0
- package/types/shape/PathGroup.d.ts +46 -0
- package/types/shape/PathGroup.d.ts.map +1 -0
- package/types/{math → shape}/Point.d.ts +5 -3
- package/types/shape/Point.d.ts.map +1 -0
- package/types/{math → shape}/Polygon.d.ts +5 -1
- package/types/shape/Polygon.d.ts.map +1 -0
- package/types/{math → shape}/Rect.d.ts +3 -3
- package/types/shape/Rect.d.ts.map +1 -0
- package/types/shape/Shape.d.ts +51 -0
- package/types/shape/Shape.d.ts.map +1 -0
- package/types/shape/Vector.d.ts.map +1 -0
- package/types/shape/YZRaphael.d.ts +4 -0
- package/types/shape/YZRaphael.d.ts.map +1 -0
- package/types/shape/index.d.ts +10 -0
- package/types/shape/index.d.ts.map +1 -0
- package/types/shape/lib/ShapeUtil.d.ts +10 -0
- package/types/shape/lib/ShapeUtil.d.ts.map +1 -0
- package/types/shape/lib/a2c.d.ts +3 -0
- package/types/{svg → shape/lib}/a2c.d.ts.map +1 -1
- package/types/shape/lib/abs-svg-path.d.ts +3 -0
- package/types/shape/lib/abs-svg-path.d.ts.map +1 -0
- package/types/shape/lib/is-svg-path.d.ts +3 -0
- package/types/shape/lib/is-svg-path.d.ts.map +1 -0
- package/types/shape/lib/normalize-svg-path.d.ts +3 -0
- package/types/shape/lib/normalize-svg-path.d.ts.map +1 -0
- package/types/shape/lib/parse-svg-path.d.ts +3 -0
- package/types/shape/lib/parse-svg-path.d.ts.map +1 -0
- package/types/{svg → shape/lib}/point-at-length.d.ts +3 -2
- package/types/shape/lib/point-at-length.d.ts.map +1 -0
- package/types/shape/lib/point-in-path.d.ts +3 -0
- package/types/shape/lib/point-in-path.d.ts.map +1 -0
- package/types/shape/lib/point-svg-path.d.ts +12 -0
- package/types/shape/lib/point-svg-path.d.ts.map +1 -0
- package/types/shape/lib/rappar.d.ts +3 -0
- package/types/shape/lib/rappar.d.ts.map +1 -0
- package/types/tween/Easing.d.ts +3 -0
- package/types/tween/Easing.d.ts.map +1 -1
- package/types/tween/index.d.ts +3 -0
- package/types/tween/index.d.ts.map +1 -1
- package/types/video.d.ts +1 -0
- package/types/video.d.ts.map +1 -1
- package/types/websocketclient.d.ts +22 -0
- package/types/websocketclient.d.ts.map +1 -0
- package/types/dom/zyzui.d.ts +0 -1
- package/types/dom/zyzui.d.ts.map +0 -1
- package/types/dom.d.ts +0 -22
- package/types/dom.d.ts.map +0 -1
- package/types/math/AnimateShape.d.ts.map +0 -1
- package/types/math/Matrix.d.ts.map +0 -1
- package/types/math/Point.d.ts.map +0 -1
- package/types/math/Polygon.d.ts.map +0 -1
- package/types/math/Rect.d.ts.map +0 -1
- package/types/math/Vector.d.ts.map +0 -1
- package/types/math/index.d.ts +0 -7
- package/types/math/index.d.ts.map +0 -1
- package/types/math/math.d.ts +0 -7
- package/types/math/math.d.ts.map +0 -1
- package/types/svg/a2c.d.ts +0 -2
- package/types/svg/abs-svg-path.d.ts +0 -2
- package/types/svg/abs-svg-path.d.ts.map +0 -1
- package/types/svg/index.d.ts +0 -49
- package/types/svg/index.d.ts.map +0 -1
- package/types/svg/is-svg-path.d.ts +0 -2
- package/types/svg/is-svg-path.d.ts.map +0 -1
- package/types/svg/normalize-svg-path.d.ts +0 -2
- package/types/svg/normalize-svg-path.d.ts.map +0 -1
- package/types/svg/parse-svg-path.d.ts +0 -2
- package/types/svg/parse-svg-path.d.ts.map +0 -1
- package/types/svg/platform-browser.d.ts +0 -13
- package/types/svg/platform-browser.d.ts.map +0 -1
- package/types/svg/platform-node.d.ts +0 -7
- package/types/svg/platform-node.d.ts.map +0 -1
- package/types/svg/point-at-length.d.ts.map +0 -1
- package/types/svg/point-in-path.d.ts +0 -2
- package/types/svg/point-in-path.d.ts.map +0 -1
- package/types/websocket.d.ts +0 -16
- package/types/websocket.d.ts.map +0 -1
- /package/types/{math → shape}/Vector.d.ts +0 -0
|
@@ -1,30 +1,35 @@
|
|
|
1
|
-
(function(E,ji){typeof exports=="object"&&typeof module<"u"?ji(exports):typeof define=="function"&&define.amd?define(["exports"],ji):(E=typeof globalThis<"u"?globalThis:E||self,ji(E.ZYZGroupCoreWeb={}))})(this,function(E){"use strict";typeof process<"u"&&process.versions!=null&&process.versions.node!=null;const ji=(i=12)=>"x".repeat(i).replace(/[x]/g,t=>(Math.random()*16|0).toString(16));function So(i){let t="";for(let e=0,n=i.length;e<n;e++){const r=i.charCodeAt(e);r>=1&&r<=127?t+=i.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 ne=(i=>(i.UNKNOWN="",i.HTML="text/html",i.CSS="text/css",i.JPEG="image/jpeg",i.PNG="image/png",i.GIF="image/gif",i.WEBP="image/webp",i.SVG="image/svg+xml",i.MPEG="audio/mpeg",i.OGG="audio/ogg",i.MP4="video/mp4",i.JSON="application/json",i.JAVASCRIPT="application/javascript",i.ECMASCRIPT="application/ecmascript",i.EXCEL="application/vnb.ms-excel",i.XWWW="application/x-www-form-urlencoded",i.CSV="application/x-csv",i.PDF="application/pdf",i.ZIP="application/zip",i.TGZ="application/x-gtar",i.TAR_GZ="application/x-gzip",i.XML="text/xml",i.TEXT="text/plain",i))(ne||{});const ui=(i,t=16)=>(i=i.toLowerCase(),(i.indexOf("0b")==0||i.indexOf("0x")==0)&&(i=i.slice(2)),parseInt(i,t));function sd(){const i=Uint32Array.of(305419896),t=new Uint8Array(i.buffer);switch(t[0]*16777216+t[1]*65536+t[2]*256+t[3]){case 305419896:return!1;case 2018915346:return!0}}const Co=i=>{let t=ne.UNKNOWN;switch(new DataView(i).getUint32(0,sd()).toString(16).toUpperCase()){case"FFD8FFDB":t=ne.JPEG;break;case"FFD8FFE0":case"FFD8FFE1":case"FFD8FFE2":case"FFD8FFE3":t=ne.JPEG;break;case"89504E47":t=ne.PNG;break;case"47494638":t=ne.GIF;break;case"52494646":t=ne.WEBP;break;case"25504446":t=ne.PDF;break;case"504B0304":t=ne.ZIP;break}return t},xo=function(){const i=[];return{writeByte(t){i.push(t&255)},writeShort(t){this.writeByte(t),this.writeByte(t>>>8)},writeBytes(t,e=0,n=t.length){for(let r=0;r<n;r++)this.writeByte(t[r+e])},writeString(t){for(let e=0,n=t.length;e<n;e++)this.writeByte(t.charCodeAt(e))},toByteArray(){return i},toString(){let t="[";for(let e=0,n=i.length;e<n;e++)e>0&&(t+=","),t+=i[e];return t+="]",t}}},ad=function(){let i=0,t=0,e=0,n="";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){n+=String.fromCharCode(r(a&63))};return{writeByte(a){for(i=i<<8|a&255,t+=8,e+=1;t>=6;)s(i>>>t-6),t-=6},flush(){if(t>0&&(s(i<<6-t),i=0,t=0),e%3!=0){const a=3-e%3;for(let o=0;o<a;o++)n+="="}},toString(){return n}}};function To(i,t){return function(){return i.apply(t,arguments)}}const{toString:od}=Object.prototype,{getPrototypeOf:Ts}=Object,Fn=(i=>t=>{const e=od.call(t);return i[e]||(i[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),Wt=i=>(i=i.toLowerCase(),t=>Fn(t)===i),Nn=i=>t=>typeof t===i,{isArray:di}=Array,Vi=Nn("undefined");function ld(i){return i!==null&&!Vi(i)&&i.constructor!==null&&!Vi(i.constructor)&&Ut(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Eo=Wt("ArrayBuffer");function hd(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&Eo(i.buffer),t}const cd=Nn("string"),Ut=Nn("function"),ko=Nn("number"),Un=i=>i!==null&&typeof i=="object",ud=i=>i===!0||i===!1,Gn=i=>{if(Fn(i)!=="object")return!1;const t=Ts(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},dd=Wt("Date"),fd=Wt("File"),gd=Wt("Blob"),pd=Wt("FileList"),md=i=>Un(i)&&Ut(i.pipe),_d=i=>{let t;return i&&(typeof FormData=="function"&&i instanceof FormData||Ut(i.append)&&((t=Fn(i))==="formdata"||t==="object"&&Ut(i.toString)&&i.toString()==="[object FormData]"))},vd=Wt("URLSearchParams"),yd=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $i(i,t,{allOwnKeys:e=!1}={}){if(i===null||typeof i>"u")return;let n,r;if(typeof i!="object"&&(i=[i]),di(i))for(n=0,r=i.length;n<r;n++)t.call(null,i[n],n,i);else{const s=e?Object.getOwnPropertyNames(i):Object.keys(i),a=s.length;let o;for(n=0;n<a;n++)o=s[n],t.call(null,i[o],o,i)}}function Ao(i,t){t=t.toLowerCase();const e=Object.keys(i);let n=e.length,r;for(;n-- >0;)if(r=e[n],t===r.toLowerCase())return r;return null}const Po=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Mo=i=>!Vi(i)&&i!==Po;function Es(){const{caseless:i}=Mo(this)&&this||{},t={},e=(n,r)=>{const s=i&&Ao(t,r)||r;Gn(t[s])&&Gn(n)?t[s]=Es(t[s],n):Gn(n)?t[s]=Es({},n):di(n)?t[s]=n.slice():t[s]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&$i(arguments[n],e);return t}const bd=(i,t,e,{allOwnKeys:n}={})=>($i(t,(r,s)=>{e&&Ut(r)?i[s]=To(r,e):i[s]=r},{allOwnKeys:n}),i),wd=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Sd=(i,t,e,n)=>{i.prototype=Object.create(t.prototype,n),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:t.prototype}),e&&Object.assign(i.prototype,e)},Cd=(i,t,e,n)=>{let r,s,a;const o={};if(t=t||{},i==null)return t;do{for(r=Object.getOwnPropertyNames(i),s=r.length;s-- >0;)a=r[s],(!n||n(a,i,t))&&!o[a]&&(t[a]=i[a],o[a]=!0);i=e!==!1&&Ts(i)}while(i&&(!e||e(i,t))&&i!==Object.prototype);return t},xd=(i,t,e)=>{i=String(i),(e===void 0||e>i.length)&&(e=i.length),e-=t.length;const n=i.indexOf(t,e);return n!==-1&&n===e},Td=i=>{if(!i)return null;if(di(i))return i;let t=i.length;if(!ko(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=i[t];return e},Ed=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&Ts(Uint8Array)),kd=(i,t)=>{const e=(i&&i[Symbol.iterator]).call(i);let n;for(;(n=e.next())&&!n.done;){const r=n.value;t.call(i,r[0],r[1])}},Ad=(i,t)=>{let e;const n=[];for(;(e=i.exec(t))!==null;)n.push(e);return n},Pd=Wt("HTMLFormElement"),Md=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,n){return e.toUpperCase()+n}),Ro=(({hasOwnProperty:i})=>(t,e)=>i.call(t,e))(Object.prototype),Rd=Wt("RegExp"),Do=(i,t)=>{const e=Object.getOwnPropertyDescriptors(i),n={};$i(e,(r,s)=>{let a;(a=t(r,s,i))!==!1&&(n[s]=a||r)}),Object.defineProperties(i,n)},Dd=i=>{Do(i,(t,e)=>{if(Ut(i)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const n=i[e];if(Ut(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},Ld=(i,t)=>{const e={},n=r=>{r.forEach(s=>{e[s]=!0})};return di(i)?n(i):n(String(i).split(t)),e},Od=()=>{},Id=(i,t)=>(i=+i,Number.isFinite(i)?i:t),ks="abcdefghijklmnopqrstuvwxyz",Lo="0123456789",Oo={DIGIT:Lo,ALPHA:ks,ALPHA_DIGIT:ks+ks.toUpperCase()+Lo},Fd=(i=16,t=Oo.ALPHA_DIGIT)=>{let e="";const{length:n}=t;for(;i--;)e+=t[Math.random()*n|0];return e};function Nd(i){return!!(i&&Ut(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const Ud=i=>{const t=new Array(10),e=(n,r)=>{if(Un(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[r]=n;const s=di(n)?[]:{};return $i(n,(a,o)=>{const h=e(a,r+1);!Vi(h)&&(s[o]=h)}),t[r]=void 0,s}}return n};return e(i,0)},Gd=Wt("AsyncFunction"),Bd=i=>i&&(Un(i)||Ut(i))&&Ut(i.then)&&Ut(i.catch),R={isArray:di,isArrayBuffer:Eo,isBuffer:ld,isFormData:_d,isArrayBufferView:hd,isString:cd,isNumber:ko,isBoolean:ud,isObject:Un,isPlainObject:Gn,isUndefined:Vi,isDate:dd,isFile:fd,isBlob:gd,isRegExp:Rd,isFunction:Ut,isStream:md,isURLSearchParams:vd,isTypedArray:Ed,isFileList:pd,forEach:$i,merge:Es,extend:bd,trim:yd,stripBOM:wd,inherits:Sd,toFlatObject:Cd,kindOf:Fn,kindOfTest:Wt,endsWith:xd,toArray:Td,forEachEntry:kd,matchAll:Ad,isHTMLForm:Pd,hasOwnProperty:Ro,hasOwnProp:Ro,reduceDescriptors:Do,freezeMethods:Dd,toObjectSet:Ld,toCamelCase:Md,noop:Od,toFiniteNumber:Id,findKey:Ao,global:Po,isContextDefined:Mo,ALPHABET:Oo,generateString:Fd,isSpecCompliantForm:Nd,toJSONObject:Ud,isAsyncFn:Gd,isThenable:Bd};function Z(i,t,e,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),r&&(this.response=r)}R.inherits(Z,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:R.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Io=Z.prototype,Fo={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{Fo[i]={value:i}}),Object.defineProperties(Z,Fo),Object.defineProperty(Io,"isAxiosError",{value:!0}),Z.from=(i,t,e,n,r,s)=>{const a=Object.create(Io);return R.toFlatObject(i,a,function(o){return o!==Error.prototype},o=>o!=="isAxiosError"),Z.call(a,i.message,t,e,n,r),a.cause=i,a.name=i.name,s&&Object.assign(a,s),a};const zd=null;function As(i){return R.isPlainObject(i)||R.isArray(i)}function No(i){return R.endsWith(i,"[]")?i.slice(0,-2):i}function Uo(i,t,e){return i?i.concat(t).map(function(n,r){return n=No(n),!e&&r?"["+n+"]":n}).join(e?".":""):t}function Hd(i){return R.isArray(i)&&!i.some(As)}const jd=R.toFlatObject(R,{},null,function(i){return/^is[A-Z]/.test(i)});function Bn(i,t,e){if(!R.isObject(i))throw new TypeError("target must be an object");t=t||new FormData,e=R.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,g){return!R.isUndefined(g[u])});const n=e.metaTokens,r=e.visitor||l,s=e.dots,a=e.indexes,o=(e.Blob||typeof Blob<"u"&&Blob)&&R.isSpecCompliantForm(t);if(!R.isFunction(r))throw new TypeError("visitor must be a function");function h(u){if(u===null)return"";if(R.isDate(u))return u.toISOString();if(!o&&R.isBlob(u))throw new Z("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(u)||R.isTypedArray(u)?o&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function l(u,g,p){let _=u;if(u&&!p&&typeof u=="object"){if(R.endsWith(g,"{}"))g=n?g:g.slice(0,-2),u=JSON.stringify(u);else if(R.isArray(u)&&Hd(u)||(R.isFileList(u)||R.endsWith(g,"[]"))&&(_=R.toArray(u)))return g=No(g),_.forEach(function(y,b){!(R.isUndefined(y)||y===null)&&t.append(a===!0?Uo([g],b,s):a===null?g:g+"[]",h(y))}),!1}return As(u)?!0:(t.append(Uo(p,g,s),h(u)),!1)}const c=[],d=Object.assign(jd,{defaultVisitor:l,convertValue:h,isVisitable:As});function f(u,g){if(!R.isUndefined(u)){if(c.indexOf(u)!==-1)throw Error("Circular reference detected in "+g.join("."));c.push(u),R.forEach(u,function(p,_){(!(R.isUndefined(p)||p===null)&&r.call(t,p,R.isString(_)?_.trim():_,g,d))===!0&&f(p,g?g.concat(_):[_])}),c.pop()}}if(!R.isObject(i))throw new TypeError("data must be an object");return f(i),t}function Go(i){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ps(i,t){this._pairs=[],i&&Bn(i,this,t)}const Bo=Ps.prototype;Bo.append=function(i,t){this._pairs.push([i,t])},Bo.toString=function(i){const t=i?function(e){return i.call(this,e,Go)}:Go;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};function Vd(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function zo(i,t,e){if(!t)return i;const n=e&&e.encode||Vd,r=e&&e.serialize;let s;if(r?s=r(t,e):s=R.isURLSearchParams(t)?t.toString():new Ps(t,e).toString(n),s){const a=i.indexOf("#");a!==-1&&(i=i.slice(0,a)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class $d{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){R.forEach(this.handlers,function(e){e!==null&&t(e)})}}const Ho=$d,jo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xd=typeof URLSearchParams<"u"?URLSearchParams:Ps,Yd=typeof FormData<"u"?FormData:null,Wd=typeof Blob<"u"?Blob:null,qd=(()=>{let i;return typeof navigator<"u"&&((i=navigator.product)==="ReactNative"||i==="NativeScript"||i==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Kd=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),qt={isBrowser:!0,classes:{URLSearchParams:Xd,FormData:Yd,Blob:Wd},isStandardBrowserEnv:qd,isStandardBrowserWebWorkerEnv:Kd,protocols:["http","https","file","blob","url","data"]};function Zd(i,t){return Bn(i,new qt.classes.URLSearchParams,Object.assign({visitor:function(e,n,r,s){return qt.isNode&&R.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Jd(i){return R.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Qd(i){const t={},e=Object.keys(i);let n;const r=e.length;let s;for(n=0;n<r;n++)s=e[n],t[s]=i[s];return t}function Vo(i){function t(e,n,r,s){let a=e[s++];const o=Number.isFinite(+a),h=s>=e.length;return a=!a&&R.isArray(r)?r.length:a,h?(R.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!R.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],s)&&R.isArray(r[a])&&(r[a]=Qd(r[a])),!o)}if(R.isFormData(i)&&R.isFunction(i.entries)){const e={};return R.forEachEntry(i,(n,r)=>{t(Jd(n),r,e,0)}),e}return null}function tf(i,t,e){if(R.isString(i))try{return(t||JSON.parse)(i),R.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(i)}const Ms={transitional:jo,adapter:["xhr","http"],transformRequest:[function(i,t){const e=t.getContentType()||"",n=e.indexOf("application/json")>-1,r=R.isObject(i);if(r&&R.isHTMLForm(i)&&(i=new FormData(i)),R.isFormData(i))return n&&n?JSON.stringify(Vo(i)):i;if(R.isArrayBuffer(i)||R.isBuffer(i)||R.isStream(i)||R.isFile(i)||R.isBlob(i))return i;if(R.isArrayBufferView(i))return i.buffer;if(R.isURLSearchParams(i))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let s;if(r){if(e.indexOf("application/x-www-form-urlencoded")>-1)return Zd(i,this.formSerializer).toString();if((s=R.isFileList(i))||e.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Bn(s?{"files[]":i}:i,a&&new a,this.formSerializer)}}return r||n?(t.setContentType("application/json",!1),tf(i)):i}],transformResponse:[function(i){const t=this.transitional||Ms.transitional,e=t&&t.forcedJSONParsing,n=this.responseType==="json";if(i&&R.isString(i)&&(e&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(i)}catch(s){if(r)throw s.name==="SyntaxError"?Z.from(s,Z.ERR_BAD_RESPONSE,this,null,this.response):s}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qt.classes.FormData,Blob:qt.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};R.forEach(["delete","get","head","post","put","patch"],i=>{Ms.headers[i]={}});const Rs=Ms,ef=R.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),nf=i=>{const t={};let e,n,r;return i&&i.split(`
|
|
2
|
-
`).forEach(function(s){r=s.indexOf(":"),e=s.substring(0,r).trim().toLowerCase(),n=s.substring(r+1).trim(),!(!e||t[e]&&
|
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const e=(this[
|
|
4
|
-
`+s.map(
|
|
5
|
-
`):" "+
|
|
1
|
+
(function(j,wt){typeof exports=="object"&&typeof module<"u"?wt(exports):typeof define=="function"&&define.amd?define(["exports"],wt):(j=typeof globalThis<"u"?globalThis:j||self,wt(j.ZYZGroupCoreWeb={}))})(this,function(j){"use strict";function wt(i,t){for(var e=0;e<t.length;e++){const n=t[e];if(typeof n!="string"&&!Array.isArray(n)){for(const r in n)if(r!=="default"&&!(r in i)){const s=Object.getOwnPropertyDescriptor(n,r);s&&Object.defineProperty(i,r,s.get?s:{enumerable:!0,get:()=>n[r]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}const Ys=typeof window=="object"&&typeof document=="object";typeof process<"u"&&process.versions!=null&&process.versions.node!=null;const Tg=(i=12)=>"x".repeat(i).replace(/[x]/g,t=>(Math.random()*16|0).toString(16));function Gh(i){let t="";for(let e=0,n=i.length;e<n;e++){const r=i.charCodeAt(e);r>=1&&r<=127?t+=i.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 ei=(i=>(i.UNKNOWN="",i.HTML="text/html",i.CSS="text/css",i.JPEG="image/jpeg",i.PNG="image/png",i.GIF="image/gif",i.WEBP="image/webp",i.SVG="image/svg+xml",i.MPEG="audio/mpeg",i.OGG="audio/ogg",i.MP4="video/mp4",i.JSON="application/json",i.JAVASCRIPT="application/javascript",i.ECMASCRIPT="application/ecmascript",i.EXCEL="application/vnb.ms-excel",i.XWWW="application/x-www-form-urlencoded",i.CSV="application/x-csv",i.PDF="application/pdf",i.ZIP="application/zip",i.TGZ="application/x-gtar",i.TAR_GZ="application/x-gzip",i.XML="text/xml",i.TEXT="text/plain",i))(ei||{});const _n=(i,t=16)=>(i=i.toLowerCase(),(i.indexOf("0b")==0||i.indexOf("0x")==0)&&(i=i.slice(2)),parseInt(i,t));function Pg(){const i=Uint32Array.of(305419896),t=new Uint8Array(i.buffer);switch(t[0]*16777216+t[1]*65536+t[2]*256+t[3]){case 305419896:return!1;case 2018915346:return!0}}const Bh=i=>{let t=ei.UNKNOWN;switch(new DataView(i).getUint32(0,Pg()).toString(16).toUpperCase()){case"FFD8FFDB":t=ei.JPEG;break;case"FFD8FFE0":case"FFD8FFE1":case"FFD8FFE2":case"FFD8FFE3":t=ei.JPEG;break;case"89504E47":t=ei.PNG;break;case"47494638":t=ei.GIF;break;case"52494646":t=ei.WEBP;break;case"25504446":t=ei.PDF;break;case"504B0304":t=ei.ZIP;break}return t},$h=function(){const i=[];return{writeByte(t){i.push(t&255)},writeShort(t){this.writeByte(t),this.writeByte(t>>>8)},writeBytes(t,e=0,n=t.length){for(let r=0;r<n;r++)this.writeByte(t[r+e])},writeString(t){for(let e=0,n=t.length;e<n;e++)this.writeByte(t.charCodeAt(e))},toByteArray(){return i},toString(){let t="[";for(let e=0,n=i.length;e<n;e++)e>0&&(t+=","),t+=i[e];return t+="]",t}}},Ag=function(){let i=0,t=0,e=0,n="";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){n+=String.fromCharCode(r(a&63))};return{writeByte(a){for(i=i<<8|a&255,t+=8,e+=1;t>=6;)s(i>>>t-6),t-=6},flush(){if(t>0&&(s(i<<6-t),i=0,t=0),e%3!=0){const a=3-e%3;for(let o=0;o<a;o++)n+="="}},toString(){return n}}};function Mg(i){const t=typeof i;return t!=="object"?t:Object.prototype.toString.call(i).replace(/^\[object (\S+)\]$/,"$1").toLowerCase()}function Rg(i){return Mg(i)==="object"}function zh(i,t=new WeakMap){if(i==null)return i;if(i.constructor===Date)return new Date(i);if(i.constructor===RegExp)return new RegExp(i);if(typeof i!="object")return i;if(t.has(i))return t.get(i);const e=Object.getOwnPropertyDescriptors(i),n=Object.create(Object.getPrototypeOf(i),e);t.set(i,n);for(const r of Reflect.ownKeys(i))n[r]=Rg(i[r])?zh(i[r],t):i[r];return n}Math.cbrt=Math.cbrt||function(i){const t=Math.pow(Math.abs(i),.3333333333333333);return i<0?-t:t};function jh(i,t){return function(){return i.apply(t,arguments)}}const{toString:Lg}=Object.prototype,{getPrototypeOf:po}=Object,Ws=(i=>t=>{const e=Lg.call(t);return i[e]||(i[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),Ve=i=>(i=i.toLowerCase(),t=>Ws(t)===i),Ks=i=>t=>typeof t===i,{isArray:yn}=Array,sr=Ks("undefined");function Dg(i){return i!==null&&!sr(i)&&i.constructor!==null&&!sr(i.constructor)&&Oe(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Hh=Ve("ArrayBuffer");function Ig(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&Hh(i.buffer),t}const Og=Ks("string"),Oe=Ks("function"),Vh=Ks("number"),Zs=i=>i!==null&&typeof i=="object",Fg=i=>i===!0||i===!1,Js=i=>{if(Ws(i)!=="object")return!1;const t=po(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},Ng=Ve("Date"),Ug=Ve("File"),Gg=Ve("Blob"),Bg=Ve("FileList"),$g=i=>Zs(i)&&Oe(i.pipe),zg=i=>{let t;return i&&(typeof FormData=="function"&&i instanceof FormData||Oe(i.append)&&((t=Ws(i))==="formdata"||t==="object"&&Oe(i.toString)&&i.toString()==="[object FormData]"))},jg=Ve("URLSearchParams"),Hg=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ar(i,t,{allOwnKeys:e=!1}={}){if(i===null||typeof i>"u")return;let n,r;if(typeof i!="object"&&(i=[i]),yn(i))for(n=0,r=i.length;n<r;n++)t.call(null,i[n],n,i);else{const s=e?Object.getOwnPropertyNames(i):Object.keys(i),a=s.length;let o;for(n=0;n<a;n++)o=s[n],t.call(null,i[o],o,i)}}function qh(i,t){t=t.toLowerCase();const e=Object.keys(i);let n=e.length,r;for(;n-- >0;)if(r=e[n],t===r.toLowerCase())return r;return null}const Xh=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Yh=i=>!sr(i)&&i!==Xh;function mo(){const{caseless:i}=Yh(this)&&this||{},t={},e=(n,r)=>{const s=i&&qh(t,r)||r;Js(t[s])&&Js(n)?t[s]=mo(t[s],n):Js(n)?t[s]=mo({},n):yn(n)?t[s]=n.slice():t[s]=n};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&ar(arguments[n],e);return t}const Vg=(i,t,e,{allOwnKeys:n}={})=>(ar(t,(r,s)=>{e&&Oe(r)?i[s]=jh(r,e):i[s]=r},{allOwnKeys:n}),i),qg=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Xg=(i,t,e,n)=>{i.prototype=Object.create(t.prototype,n),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:t.prototype}),e&&Object.assign(i.prototype,e)},Yg=(i,t,e,n)=>{let r,s,a;const o={};if(t=t||{},i==null)return t;do{for(r=Object.getOwnPropertyNames(i),s=r.length;s-- >0;)a=r[s],(!n||n(a,i,t))&&!o[a]&&(t[a]=i[a],o[a]=!0);i=e!==!1&&po(i)}while(i&&(!e||e(i,t))&&i!==Object.prototype);return t},Wg=(i,t,e)=>{i=String(i),(e===void 0||e>i.length)&&(e=i.length),e-=t.length;const n=i.indexOf(t,e);return n!==-1&&n===e},Kg=i=>{if(!i)return null;if(yn(i))return i;let t=i.length;if(!Vh(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=i[t];return e},Zg=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&po(Uint8Array)),Jg=(i,t)=>{const e=(i&&i[Symbol.iterator]).call(i);let n;for(;(n=e.next())&&!n.done;){const r=n.value;t.call(i,r[0],r[1])}},Qg=(i,t)=>{let e;const n=[];for(;(e=i.exec(t))!==null;)n.push(e);return n},tp=Ve("HTMLFormElement"),ep=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,n){return e.toUpperCase()+n}),Wh=(({hasOwnProperty:i})=>(t,e)=>i.call(t,e))(Object.prototype),ip=Ve("RegExp"),Kh=(i,t)=>{const e=Object.getOwnPropertyDescriptors(i),n={};ar(e,(r,s)=>{let a;(a=t(r,s,i))!==!1&&(n[s]=a||r)}),Object.defineProperties(i,n)},np=i=>{Kh(i,(t,e)=>{if(Oe(i)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const n=i[e];if(Oe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},rp=(i,t)=>{const e={},n=r=>{r.forEach(s=>{e[s]=!0})};return yn(i)?n(i):n(String(i).split(t)),e},sp=()=>{},ap=(i,t)=>(i=+i,Number.isFinite(i)?i:t),vo="abcdefghijklmnopqrstuvwxyz",Zh="0123456789",Jh={DIGIT:Zh,ALPHA:vo,ALPHA_DIGIT:vo+vo.toUpperCase()+Zh},op=(i=16,t=Jh.ALPHA_DIGIT)=>{let e="";const{length:n}=t;for(;i--;)e+=t[Math.random()*n|0];return e};function lp(i){return!!(i&&Oe(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const hp=i=>{const t=new Array(10),e=(n,r)=>{if(Zs(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[r]=n;const s=yn(n)?[]:{};return ar(n,(a,o)=>{const l=e(a,r+1);!sr(l)&&(s[o]=l)}),t[r]=void 0,s}}return n};return e(i,0)},cp=Ve("AsyncFunction"),up=i=>i&&(Zs(i)||Oe(i))&&Oe(i.then)&&Oe(i.catch),st={isArray:yn,isArrayBuffer:Hh,isBuffer:Dg,isFormData:zg,isArrayBufferView:Ig,isString:Og,isNumber:Vh,isBoolean:Fg,isObject:Zs,isPlainObject:Js,isUndefined:sr,isDate:Ng,isFile:Ug,isBlob:Gg,isRegExp:ip,isFunction:Oe,isStream:$g,isURLSearchParams:jg,isTypedArray:Zg,isFileList:Bg,forEach:ar,merge:mo,extend:Vg,trim:Hg,stripBOM:qg,inherits:Xg,toFlatObject:Yg,kindOf:Ws,kindOfTest:Ve,endsWith:Wg,toArray:Kg,forEachEntry:Jg,matchAll:Qg,isHTMLForm:tp,hasOwnProperty:Wh,hasOwnProp:Wh,reduceDescriptors:Kh,freezeMethods:np,toObjectSet:rp,toCamelCase:ep,noop:sp,toFiniteNumber:ap,findKey:qh,global:Xh,isContextDefined:Yh,ALPHABET:Jh,generateString:op,isSpecCompliantForm:lp,toJSONObject:hp,isAsyncFn:cp,isThenable:up};function $t(i,t,e,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),r&&(this.response=r)}st.inherits($t,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:st.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Qh=$t.prototype,tc={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{tc[i]={value:i}}),Object.defineProperties($t,tc),Object.defineProperty(Qh,"isAxiosError",{value:!0}),$t.from=(i,t,e,n,r,s)=>{const a=Object.create(Qh);return st.toFlatObject(i,a,function(o){return o!==Error.prototype},o=>o!=="isAxiosError"),$t.call(a,i.message,t,e,n,r),a.cause=i,a.name=i.name,s&&Object.assign(a,s),a};const fp=null;function _o(i){return st.isPlainObject(i)||st.isArray(i)}function ec(i){return st.endsWith(i,"[]")?i.slice(0,-2):i}function ic(i,t,e){return i?i.concat(t).map(function(n,r){return n=ec(n),!e&&r?"["+n+"]":n}).join(e?".":""):t}function dp(i){return st.isArray(i)&&!i.some(_o)}const gp=st.toFlatObject(st,{},null,function(i){return/^is[A-Z]/.test(i)});function Qs(i,t,e){if(!st.isObject(i))throw new TypeError("target must be an object");t=t||new FormData,e=st.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,g){return!st.isUndefined(g[u])});const n=e.metaTokens,r=e.visitor||h,s=e.dots,a=e.indexes,o=(e.Blob||typeof Blob<"u"&&Blob)&&st.isSpecCompliantForm(t);if(!st.isFunction(r))throw new TypeError("visitor must be a function");function l(u){if(u===null)return"";if(st.isDate(u))return u.toISOString();if(!o&&st.isBlob(u))throw new $t("Blob is not supported. Use a Buffer instead.");return st.isArrayBuffer(u)||st.isTypedArray(u)?o&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function h(u,g,m){let y=u;if(u&&!m&&typeof u=="object"){if(st.endsWith(g,"{}"))g=n?g:g.slice(0,-2),u=JSON.stringify(u);else if(st.isArray(u)&&dp(u)||(st.isFileList(u)||st.endsWith(g,"[]"))&&(y=st.toArray(u)))return g=ec(g),y.forEach(function(x,C){!(st.isUndefined(x)||x===null)&&t.append(a===!0?ic([g],C,s):a===null?g:g+"[]",l(x))}),!1}return _o(u)?!0:(t.append(ic(m,g,s),l(u)),!1)}const c=[],d=Object.assign(gp,{defaultVisitor:h,convertValue:l,isVisitable:_o});function f(u,g){if(!st.isUndefined(u)){if(c.indexOf(u)!==-1)throw Error("Circular reference detected in "+g.join("."));c.push(u),st.forEach(u,function(m,y){(!(st.isUndefined(m)||m===null)&&r.call(t,m,st.isString(y)?y.trim():y,g,d))===!0&&f(m,g?g.concat(y):[y])}),c.pop()}}if(!st.isObject(i))throw new TypeError("data must be an object");return f(i),t}function nc(i){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function yo(i,t){this._pairs=[],i&&Qs(i,this,t)}const rc=yo.prototype;rc.append=function(i,t){this._pairs.push([i,t])},rc.toString=function(i){const t=i?function(e){return i.call(this,e,nc)}:nc;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};function pp(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function sc(i,t,e){if(!t)return i;const n=e&&e.encode||pp,r=e&&e.serialize;let s;if(r?s=r(t,e):s=st.isURLSearchParams(t)?t.toString():new yo(t,e).toString(n),s){const a=i.indexOf("#");a!==-1&&(i=i.slice(0,a)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class mp{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){st.forEach(this.handlers,function(e){e!==null&&t(e)})}}const ac=mp,oc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vp=typeof URLSearchParams<"u"?URLSearchParams:yo,_p=typeof FormData<"u"?FormData:null,yp=typeof Blob<"u"?Blob:null,bp=(()=>{let i;return typeof navigator<"u"&&((i=navigator.product)==="ReactNative"||i==="NativeScript"||i==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),wp=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),qe={isBrowser:!0,classes:{URLSearchParams:vp,FormData:_p,Blob:yp},isStandardBrowserEnv:bp,isStandardBrowserWebWorkerEnv:wp,protocols:["http","https","file","blob","url","data"]};function xp(i,t){return Qs(i,new qe.classes.URLSearchParams,Object.assign({visitor:function(e,n,r,s){return qe.isNode&&st.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Sp(i){return st.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Cp(i){const t={},e=Object.keys(i);let n;const r=e.length;let s;for(n=0;n<r;n++)s=e[n],t[s]=i[s];return t}function lc(i){function t(e,n,r,s){let a=e[s++];const o=Number.isFinite(+a),l=s>=e.length;return a=!a&&st.isArray(r)?r.length:a,l?(st.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!st.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],s)&&st.isArray(r[a])&&(r[a]=Cp(r[a])),!o)}if(st.isFormData(i)&&st.isFunction(i.entries)){const e={};return st.forEachEntry(i,(n,r)=>{t(Sp(n),r,e,0)}),e}return null}function kp(i,t,e){if(st.isString(i))try{return(t||JSON.parse)(i),st.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(i)}const bo={transitional:oc,adapter:["xhr","http"],transformRequest:[function(i,t){const e=t.getContentType()||"",n=e.indexOf("application/json")>-1,r=st.isObject(i);if(r&&st.isHTMLForm(i)&&(i=new FormData(i)),st.isFormData(i))return n&&n?JSON.stringify(lc(i)):i;if(st.isArrayBuffer(i)||st.isBuffer(i)||st.isStream(i)||st.isFile(i)||st.isBlob(i))return i;if(st.isArrayBufferView(i))return i.buffer;if(st.isURLSearchParams(i))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let s;if(r){if(e.indexOf("application/x-www-form-urlencoded")>-1)return xp(i,this.formSerializer).toString();if((s=st.isFileList(i))||e.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Qs(s?{"files[]":i}:i,a&&new a,this.formSerializer)}}return r||n?(t.setContentType("application/json",!1),kp(i)):i}],transformResponse:[function(i){const t=this.transitional||bo.transitional,e=t&&t.forcedJSONParsing,n=this.responseType==="json";if(i&&st.isString(i)&&(e&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(i)}catch(s){if(r)throw s.name==="SyntaxError"?$t.from(s,$t.ERR_BAD_RESPONSE,this,null,this.response):s}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qe.classes.FormData,Blob:qe.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};st.forEach(["delete","get","head","post","put","patch"],i=>{bo.headers[i]={}});const wo=bo,Ep=st.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Tp=i=>{const t={};let e,n,r;return i&&i.split(`
|
|
2
|
+
`).forEach(function(s){r=s.indexOf(":"),e=s.substring(0,r).trim().toLowerCase(),n=s.substring(r+1).trim(),!(!e||t[e]&&Ep[e])&&(e==="set-cookie"?t[e]?t[e].push(n):t[e]=[n]:t[e]=t[e]?t[e]+", "+n:n)}),t},hc=Symbol("internals");function or(i){return i&&String(i).trim().toLowerCase()}function ta(i){return i===!1||i==null?i:st.isArray(i)?i.map(ta):String(i)}function Pp(i){const t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=e.exec(i);)t[n[1]]=n[2];return t}const Ap=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function xo(i,t,e,n,r){if(st.isFunction(n))return n.call(this,t,e);if(r&&(t=e),!!st.isString(t)){if(st.isString(n))return t.indexOf(n)!==-1;if(st.isRegExp(n))return n.test(t)}}function Mp(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,n)=>e.toUpperCase()+n)}function Rp(i,t){const e=st.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(i,n+e,{value:function(r,s,a){return this[n].call(this,t,r,s,a)},configurable:!0})})}class ea{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function s(o,l,h){const c=or(l);if(!c)throw new Error("header name must be a non-empty string");const d=st.findKey(r,c);(!d||r[d]===void 0||h===!0||h===void 0&&r[d]!==!1)&&(r[d||l]=ta(o))}const a=(o,l)=>st.forEach(o,(h,c)=>s(h,c,l));return st.isPlainObject(t)||t instanceof this.constructor?a(t,e):st.isString(t)&&(t=t.trim())&&!Ap(t)?a(Tp(t),e):t!=null&&s(e,t,n),this}get(t,e){if(t=or(t),t){const n=st.findKey(this,t);if(n){const r=this[n];if(!e)return r;if(e===!0)return Pp(r);if(st.isFunction(e))return e.call(this,r,n);if(st.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=or(t),t){const n=st.findKey(this,t);return!!(n&&this[n]!==void 0&&(!e||xo(this,this[n],n,e)))}return!1}delete(t,e){const n=this;let r=!1;function s(a){if(a=or(a),a){const o=st.findKey(n,a);o&&(!e||xo(n,n[o],o,e))&&(delete n[o],r=!0)}}return st.isArray(t)?t.forEach(s):s(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const s=e[n];(!t||xo(this,this[s],s,t,!0))&&(delete this[s],r=!0)}return r}normalize(t){const e=this,n={};return st.forEach(this,(r,s)=>{const a=st.findKey(n,s);if(a){e[a]=ta(r),delete e[s];return}const o=t?Mp(s):String(s).trim();o!==s&&delete e[s],e[o]=ta(r),n[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return st.forEach(this,(n,r)=>{n!=null&&n!==!1&&(e[r]=t&&st.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
|
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const e=(this[hc]=this[hc]={accessors:{}}).accessors,n=this.prototype;function r(s){const a=or(s);e[a]||(Rp(n,s),e[a]=!0)}return st.isArray(t)?t.forEach(r):r(t),this}}ea.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),st.reduceDescriptors(ea.prototype,({value:i},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>i,set(n){this[e]=n}}}),st.freezeMethods(ea);const ii=ea;function So(i,t){const e=this||wo,n=t||e,r=ii.from(n.headers);let s=n.data;return st.forEach(i,function(a){s=a.call(e,s,r.normalize(),t?t.status:void 0)}),r.normalize(),s}function cc(i){return!!(i&&i.__CANCEL__)}function lr(i,t,e){$t.call(this,i??"canceled",$t.ERR_CANCELED,t,e),this.name="CanceledError"}st.inherits(lr,$t,{__CANCEL__:!0});function Lp(i,t,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?i(e):t(new $t("Request failed with status code "+e.status,[$t.ERR_BAD_REQUEST,$t.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}const Dp=qe.isStandardBrowserEnv?function(){return{write:function(i,t,e,n,r,s){const a=[];a.push(i+"="+encodeURIComponent(t)),st.isNumber(e)&&a.push("expires="+new Date(e).toGMTString()),st.isString(n)&&a.push("path="+n),st.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(i){const t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Ip(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function Op(i,t){return t?i.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):i}function uc(i,t){return i&&!Ip(t)?Op(i,t):t}const Fp=qe.isStandardBrowserEnv?function(){const i=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let e;function n(r){let s=r;return i&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return e=n(window.location.href),function(r){const s=st.isString(r)?n(r):r;return s.protocol===e.protocol&&s.host===e.host}}():function(){return function(){return!0}}();function Np(i){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return t&&t[1]||""}function Up(i,t){i=i||10;const e=new Array(i),n=new Array(i);let r=0,s=0,a;return t=t!==void 0?t:1e3,function(o){const l=Date.now(),h=n[s];a||(a=l),e[r]=o,n[r]=l;let c=s,d=0;for(;c!==r;)d+=e[c++],c=c%i;if(r=(r+1)%i,r===s&&(s=(s+1)%i),l-a<t)return;const f=h&&l-h;return f?Math.round(d*1e3/f):void 0}}function fc(i,t){let e=0;const n=Up(50,250);return r=>{const s=r.loaded,a=r.lengthComputable?r.total:void 0,o=s-e,l=n(o),h=s<=a;e=s;const c={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&h?(a-s)/l:void 0,event:r};c[t?"download":"upload"]=!0,i(c)}}const Gp=typeof XMLHttpRequest<"u",Bp=Gp&&function(i){return new Promise(function(t,e){let n=i.data;const r=ii.from(i.headers).normalize(),s=i.responseType;let a;function o(){i.cancelToken&&i.cancelToken.unsubscribe(a),i.signal&&i.signal.removeEventListener("abort",a)}let l;st.isFormData(n)&&(qe.isStandardBrowserEnv||qe.isStandardBrowserWebWorkerEnv?r.setContentType(!1):r.getContentType(/^\s*multipart\/form-data/)?st.isString(l=r.getContentType())&&r.setContentType(l.replace(/^\s*(multipart\/form-data);+/,"$1")):r.setContentType("multipart/form-data"));let h=new XMLHttpRequest;if(i.auth){const u=i.auth.username||"",g=i.auth.password?unescape(encodeURIComponent(i.auth.password)):"";r.set("Authorization","Basic "+btoa(u+":"+g))}const c=uc(i.baseURL,i.url);h.open(i.method.toUpperCase(),sc(c,i.params,i.paramsSerializer),!0),h.timeout=i.timeout;function d(){if(!h)return;const u=ii.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),g={data:!s||s==="text"||s==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:u,config:i,request:h};Lp(function(m){t(m),o()},function(m){e(m),o()},g),h=null}if("onloadend"in h?h.onloadend=d:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(d)},h.onabort=function(){h&&(e(new $t("Request aborted",$t.ECONNABORTED,i,h)),h=null)},h.onerror=function(){e(new $t("Network Error",$t.ERR_NETWORK,i,h)),h=null},h.ontimeout=function(){let u=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const g=i.transitional||oc;i.timeoutErrorMessage&&(u=i.timeoutErrorMessage),e(new $t(u,g.clarifyTimeoutError?$t.ETIMEDOUT:$t.ECONNABORTED,i,h)),h=null},qe.isStandardBrowserEnv){const u=(i.withCredentials||Fp(c))&&i.xsrfCookieName&&Dp.read(i.xsrfCookieName);u&&r.set(i.xsrfHeaderName,u)}n===void 0&&r.setContentType(null),"setRequestHeader"in h&&st.forEach(r.toJSON(),function(u,g){h.setRequestHeader(g,u)}),st.isUndefined(i.withCredentials)||(h.withCredentials=!!i.withCredentials),s&&s!=="json"&&(h.responseType=i.responseType),typeof i.onDownloadProgress=="function"&&h.addEventListener("progress",fc(i.onDownloadProgress,!0)),typeof i.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",fc(i.onUploadProgress)),(i.cancelToken||i.signal)&&(a=u=>{h&&(e(!u||u.type?new lr(null,i,h):u),h.abort(),h=null)},i.cancelToken&&i.cancelToken.subscribe(a),i.signal&&(i.signal.aborted?a():i.signal.addEventListener("abort",a)));const f=Np(c);if(f&&qe.protocols.indexOf(f)===-1){e(new $t("Unsupported protocol "+f+":",$t.ERR_BAD_REQUEST,i));return}h.send(n||null)})},Co={http:fp,xhr:Bp};st.forEach(Co,(i,t)=>{if(i){try{Object.defineProperty(i,"name",{value:t})}catch{}Object.defineProperty(i,"adapterName",{value:t})}});const dc=i=>`- ${i}`,$p=i=>st.isFunction(i)||i===null||i===!1,gc={getAdapter:i=>{i=st.isArray(i)?i:[i];const{length:t}=i;let e,n;const r={};for(let s=0;s<t;s++){e=i[s];let a;if(n=e,!$p(e)&&(n=Co[(a=String(e)).toLowerCase()],n===void 0))throw new $t(`Unknown adapter '${a}'`);if(n)break;r[a||"#"+s]=n}if(!n){const s=Object.entries(r).map(([o,l])=>`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?s.length>1?`since :
|
|
4
|
+
`+s.map(dc).join(`
|
|
5
|
+
`):" "+dc(s[0]):"as no adapter specified";throw new $t("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:Co};function ko(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new lr(null,i)}function pc(i){return ko(i),i.headers=ii.from(i.headers),i.data=So.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),gc.getAdapter(i.adapter||wo.adapter)(i).then(function(t){return ko(i),t.data=So.call(i,i.transformResponse,t),t.headers=ii.from(t.headers),t},function(t){return cc(t)||(ko(i),t&&t.response&&(t.response.data=So.call(i,i.transformResponse,t.response),t.response.headers=ii.from(t.response.headers))),Promise.reject(t)})}const mc=i=>i instanceof ii?i.toJSON():i;function bn(i,t){t=t||{};const e={};function n(h,c,d){return st.isPlainObject(h)&&st.isPlainObject(c)?st.merge.call({caseless:d},h,c):st.isPlainObject(c)?st.merge({},c):st.isArray(c)?c.slice():c}function r(h,c,d){if(st.isUndefined(c)){if(!st.isUndefined(h))return n(void 0,h,d)}else return n(h,c,d)}function s(h,c){if(!st.isUndefined(c))return n(void 0,c)}function a(h,c){if(st.isUndefined(c)){if(!st.isUndefined(h))return n(void 0,h)}else return n(void 0,c)}function o(h,c,d){if(d in t)return n(h,c);if(d in i)return n(void 0,h)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(h,c)=>r(mc(h),mc(c),!0)};return st.forEach(Object.keys(Object.assign({},i,t)),function(h){const c=l[h]||r,d=c(i[h],t[h],h);st.isUndefined(d)&&c!==o||(e[h]=d)}),e}const vc="1.5.1",Eo={};["object","boolean","number","function","string","symbol"].forEach((i,t)=>{Eo[i]=function(e){return typeof e===i||"a"+(t<1?"n ":" ")+i}});const _c={};Eo.transitional=function(i,t,e){function n(r,s){return"[Axios v"+vc+"] Transitional option '"+r+"'"+s+(e?". "+e:"")}return(r,s,a)=>{if(i===!1)throw new $t(n(s," has been removed"+(t?" in "+t:"")),$t.ERR_DEPRECATED);return t&&!_c[s]&&(_c[s]=!0,console.warn(n(s," has been deprecated since v"+t+" and will be removed in the near future"))),i?i(r,s,a):!0}};function zp(i,t,e){if(typeof i!="object")throw new $t("options must be an object",$t.ERR_BAD_OPTION_VALUE);const n=Object.keys(i);let r=n.length;for(;r-- >0;){const s=n[r],a=t[s];if(a){const o=i[s],l=o===void 0||a(o,s,i);if(l!==!0)throw new $t("option "+s+" must be "+l,$t.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new $t("Unknown option "+s,$t.ERR_BAD_OPTION)}}const To={assertOptions:zp,validators:Eo},yi=To.validators;class ia{constructor(t){this.defaults=t,this.interceptors={request:new ac,response:new ac}}request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=bn(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&To.assertOptions(n,{silentJSONParsing:yi.transitional(yi.boolean),forcedJSONParsing:yi.transitional(yi.boolean),clarifyTimeoutError:yi.transitional(yi.boolean)},!1),r!=null&&(st.isFunction(r)?e.paramsSerializer={serialize:r}:To.assertOptions(r,{encode:yi.function,serialize:yi.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&st.merge(s.common,s[e.method]);s&&st.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),e.headers=ii.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(l=l&&g.synchronous,o.unshift(g.fulfilled,g.rejected))});const h=[];this.interceptors.response.forEach(function(g){h.push(g.fulfilled,g.rejected)});let c,d=0,f;if(!l){const g=[pc.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,h),f=g.length,c=Promise.resolve(e);d<f;)c=c.then(g[d++],g[d++]);return c}f=o.length;let u=e;for(d=0;d<f;){const g=o[d++],m=o[d++];try{u=g(u)}catch(y){m.call(this,y);break}}try{c=pc.call(this,u)}catch(g){return Promise.reject(g)}for(d=0,f=h.length;d<f;)c=c.then(h[d++],h[d++]);return c}getUri(t){t=bn(this.defaults,t);const e=uc(t.baseURL,t.url);return sc(e,t.params,t.paramsSerializer)}}st.forEach(["delete","get","head","options"],function(i){ia.prototype[i]=function(t,e){return this.request(bn(e||{},{method:i,url:t,data:(e||{}).data}))}}),st.forEach(["post","put","patch"],function(i){function t(e){return function(n,r,s){return this.request(bn(s||{},{method:i,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}ia.prototype[i]=t(),ia.prototype[i+"Form"]=t(!0)});const na=ia;class Po{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(r){e=r});const n=this;this.promise.then(r=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},t(function(r,s,a){n.reason||(n.reason=new lr(r,s,a),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new Po(function(e){t=e}),cancel:t}}}const jp=Po;function Hp(i){return function(t){return i.apply(null,t)}}function Vp(i){return st.isObject(i)&&i.isAxiosError===!0}const Ao={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ao).forEach(([i,t])=>{Ao[t]=i});const qp=Ao;function yc(i){const t=new na(i),e=jh(na.prototype.request,t);return st.extend(e,na.prototype,t,{allOwnKeys:!0}),st.extend(e,t,null,{allOwnKeys:!0}),e.create=function(n){return yc(bn(i,n))},e}const he=yc(wo);he.Axios=na,he.CanceledError=lr,he.CancelToken=jp,he.isCancel=cc,he.VERSION=vc,he.toFormData=Qs,he.AxiosError=$t,he.Cancel=he.CanceledError,he.all=function(i){return Promise.all(i)},he.spread=Hp,he.isAxiosError=Vp,he.mergeConfig=bn,he.AxiosHeaders=ii,he.formToJSON=i=>lc(st.isHTMLForm(i)?new FormData(i):i),he.getAdapter=gc.getAdapter,he.HttpStatusCode=qp,he.default=he;var Mo=function(i,t){return Mo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])},Mo(i,t)};function bi(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Mo(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function Ro(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function hr(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],a;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(o){a={error:o}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return s}function cr(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))}function ni(i){return typeof i=="function"}function Lo(i){var t=function(n){Error.call(n),n.stack=new Error().stack},e=i(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Do=Lo(function(i){return function(t){i(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
6
6
|
`+t.map(function(e,n){return n+1+") "+e.toString()}).join(`
|
|
7
|
-
`):"",this.name="UnsubscriptionError",this.errors=t}});function $n(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var Ki=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,n,r,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=zs(a),h=o.next();!h.done;h=o.next()){var l=h.value;l.remove(this)}}catch(p){t={error:p}}finally{try{h&&!h.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else a.remove(this);var c=this.initialTeardown;if(se(c))try{c()}catch(p){s=p instanceof js?p.errors:[p]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=zs(d),u=f.next();!u.done;u=f.next()){var g=u.value;try{rl(g)}catch(p){s=s??[],p instanceof js?s=qi(qi([],Wi(s)),Wi(p.errors)):s.push(p)}}}catch(p){n={error:p}}finally{try{u&&!u.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}if(s)throw new js(s)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)rl(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&$n(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&$n(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}(),il=Ki.EMPTY;function nl(i){return i instanceof Ki||i&&"closed"in i&&se(i.remove)&&se(i.add)&&se(i.unsubscribe)}function rl(i){se(i)?i():i.unsubscribe()}var sl={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Cf={setTimeout:function(i,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];return setTimeout.apply(void 0,qi([i,t],Wi(e)))},clearTimeout:function(i){return clearTimeout(i)},delegate:void 0};function xf(i){Cf.setTimeout(function(){throw i})}function al(){}function Xn(i){i()}var Vs=function(i){xe(t,i);function t(e){var n=i.call(this)||this;return n.isStopped=!1,e?(n.destination=e,nl(e)&&e.add(n)):n.destination=Af,n}return t.create=function(e,n,r){return new Xs(e,n,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Ki),Tf=Function.prototype.bind;function $s(i,t){return Tf.call(i,t)}var Ef=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(n){Yn(n)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(n){Yn(n)}else Yn(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){Yn(e)}},i}(),Xs=function(i){xe(t,i);function t(e,n,r){var s=i.call(this)||this,a;if(se(e)||!e)a={next:e??void 0,error:n??void 0,complete:r??void 0};else{var o;s&&sl.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=function(){return s.unsubscribe()},a={next:e.next&&$s(e.next,o),error:e.error&&$s(e.error,o),complete:e.complete&&$s(e.complete,o)}):a=e}return s.destination=new Ef(a),s}return t}(Vs);function Yn(i){xf(i)}function kf(i){throw i}var Af={closed:!0,next:al,error:kf,complete:al},Pf=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Mf(i){return i}function Rf(i){return i.length===0?Mf:i.length===1?i[0]:function(t){return i.reduce(function(e,n){return n(e)},t)}}var ol=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,n){var r=this,s=Lf(t)?t:new Xs(t,e,n);return Xn(function(){var a=r,o=a.operator,h=a.source;s.add(o?o.call(s,h):h?r._subscribe(s):r._trySubscribe(s))}),s},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var n=this;return e=ll(e),new e(function(r,s){var a=new Xs({next:function(o){try{t(o)}catch(h){s(h),a.unsubscribe()}},error:s,complete:r});n.subscribe(a)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Pf]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Rf(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=ll(t),new t(function(n,r){var s;e.subscribe(function(a){return s=a},function(a){return r(a)},function(){return n(s)})})},i.create=function(t){return new i(t)},i}();function ll(i){var t;return(t=i??sl.Promise)!==null&&t!==void 0?t:Promise}function Df(i){return i&&se(i.next)&&se(i.error)&&se(i.complete)}function Lf(i){return i&&i instanceof Vs||Df(i)&&nl(i)}(function(i){xe(t,i);function t(e,n,r,s,a,o){var h=i.call(this,e)||this;return h.onFinalize=a,h.shouldUnsubscribe=o,h._next=n?function(l){try{n(l)}catch(c){e.error(c)}}:i.prototype._next,h._error=s?function(l){try{s(l)}catch(c){e.error(c)}finally{this.unsubscribe()}}:i.prototype._error,h._complete=r?function(){try{r()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,h}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;i.prototype.unsubscribe.call(this),!n&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t})(Vs);var Of=Hs(function(i){return function(){i(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),If=function(i){xe(t,i);function t(){var e=i.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var n=new hl(this,this);return n.operator=e,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Of},t.prototype.next=function(e){var n=this;Xn(function(){var r,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=zs(n.currentObservers),o=a.next();!o.done;o=a.next()){var h=o.value;h.next(e)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var n=this;Xn(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=e;for(var r=n.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;Xn(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var n=e.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),i.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var n=this,r=this,s=r.hasError,a=r.isStopped,o=r.observers;return s||a?il:(this.currentObservers=null,o.push(e),new Ki(function(){n.currentObservers=null,$n(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var n=this,r=n.hasError,s=n.thrownError,a=n.isStopped;r?e.error(s):a&&e.complete()},t.prototype.asObservable=function(){var e=new ol;return e.source=this,e},t.create=function(e,n){return new hl(e,n)},t}(ol),hl=function(i){xe(t,i);function t(e,n){var r=i.call(this)||this;return r.destination=e,r.source=n,r}return t.prototype.next=function(e){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.next)===null||r===void 0||r.call(n,e)},t.prototype.error=function(e){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.error)===null||r===void 0||r.call(n,e)},t.prototype.complete=function(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)},t.prototype._subscribe=function(e){var n,r;return(r=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&r!==void 0?r:il},t}(If),Ff={now:function(){return Date.now()},delegate:void 0},Nf=function(i){xe(t,i);function t(e,n){return i.call(this)||this}return t.prototype.schedule=function(e,n){return this},t}(Ki),Ys={setInterval:function(i,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];var r=Ys.delegate;return r?.setInterval?r.setInterval.apply(r,qi([i,t],Wi(e))):setInterval.apply(void 0,qi([i,t],Wi(e)))},clearInterval:function(i){return clearInterval(i)},delegate:void 0},Uf=function(i){xe(t,i);function t(e,n){var r=i.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return t.prototype.schedule=function(e,n){var r;if(n===void 0&&(n=0),this.closed)return this;this.state=e;var s=this.id,a=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(a,s,n)),this.pending=!0,this.delay=n,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(a,this.id,n),this},t.prototype.requestAsyncId=function(e,n,r){return r===void 0&&(r=0),Ys.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,n,r){if(r===void 0&&(r=0),r!=null&&this.delay===r&&this.pending===!1)return n;n!=null&&Ys.clearInterval(n)},t.prototype.execute=function(e,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,n);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,n){var r=!1,s;try{this.work(e)}catch(a){r=!0,s=a||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var e=this,n=e.id,r=e.scheduler,s=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,$n(s,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,i.prototype.unsubscribe.call(this)}},t}(Nf),cl=function(){function i(t,e){e===void 0&&(e=i.now),this.schedulerActionCtor=t,this.now=e}return i.prototype.schedule=function(t,e,n){return e===void 0&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},i.now=Ff.now,i}(),Gf=function(i){xe(t,i);function t(e,n){n===void 0&&(n=cl.now);var r=i.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return t.prototype.flush=function(e){var n=this.actions;if(this._active){n.push(e);return}var r;this._active=!0;do if(r=e.execute(e.state,e.delay))break;while(e=n.shift());if(this._active=!1,r){for(;e=n.shift();)e.unsubscribe();throw r}},t}(cl);new Gf(Uf);function Bf(i){switch(i.responseType){case"json":{if("response"in i)return i.response;var t=i;return JSON.parse(t.responseText)}case"document":return i.responseXML;case"text":default:{if("response"in i)return i.response;var t=i;return t.responseText}}}var ul=Hs(function(i){return function(t,e,n){this.message=t,this.name="AjaxError",this.xhr=e,this.request=n,this.status=e.status,this.responseType=e.responseType;var r;try{r=Bf(e)}catch{r=e.responseText}this.response=r}});(function(){function i(t,e){return ul.call(this,"ajax timeout",t,e),this.name="AjaxTimeoutError",this}return i.prototype=Object.create(ul.prototype),i})();var Ws={exports:{}},gi=typeof Reflect=="object"?Reflect:null,dl=gi&&typeof gi.apply=="function"?gi.apply:function(i,t,e){return Function.prototype.apply.call(i,t,e)},Wn;gi&&typeof gi.ownKeys=="function"?Wn=gi.ownKeys:Object.getOwnPropertySymbols?Wn=function(i){return Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i))}:Wn=function(i){return Object.getOwnPropertyNames(i)};function zf(i){console&&console.warn&&console.warn(i)}var fl=Number.isNaN||function(i){return i!==i};function nt(){nt.init.call(this)}Ws.exports=nt,Ws.exports.once=$f,nt.EventEmitter=nt,nt.prototype._events=void 0,nt.prototype._eventsCount=0,nt.prototype._maxListeners=void 0;var gl=10;function qn(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(nt,"defaultMaxListeners",{enumerable:!0,get:function(){return gl},set:function(i){if(typeof i!="number"||i<0||fl(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");gl=i}}),nt.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},nt.prototype.setMaxListeners=function(i){if(typeof i!="number"||i<0||fl(i))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+i+".");return this._maxListeners=i,this};function pl(i){return i._maxListeners===void 0?nt.defaultMaxListeners:i._maxListeners}nt.prototype.getMaxListeners=function(){return pl(this)},nt.prototype.emit=function(i){for(var t=[],e=1;e<arguments.length;e++)t.push(arguments[e]);var n=i==="error",r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var o=r[i];if(o===void 0)return!1;if(typeof o=="function")dl(o,this,t);else for(var h=o.length,l=bl(o,h),e=0;e<h;++e)dl(l[e],this,t);return!0};function ml(i,t,e,n){var r,s,a;if(qn(e),s=i._events,s===void 0?(s=i._events=Object.create(null),i._eventsCount=0):(s.newListener!==void 0&&(i.emit("newListener",t,e.listener?e.listener:e),s=i._events),a=s[t]),a===void 0)a=s[t]=e,++i._eventsCount;else if(typeof a=="function"?a=s[t]=n?[e,a]:[a,e]:n?a.unshift(e):a.push(e),r=pl(i),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=i,o.type=t,o.count=a.length,zf(o)}return i}nt.prototype.addListener=function(i,t){return ml(this,i,t,!1)},nt.prototype.on=nt.prototype.addListener,nt.prototype.prependListener=function(i,t){return ml(this,i,t,!0)};function Hf(){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 _l(i,t,e){var n={fired:!1,wrapFn:void 0,target:i,type:t,listener:e},r=Hf.bind(n);return r.listener=e,n.wrapFn=r,r}nt.prototype.once=function(i,t){return qn(t),this.on(i,_l(this,i,t)),this},nt.prototype.prependOnceListener=function(i,t){return qn(t),this.prependListener(i,_l(this,i,t)),this},nt.prototype.removeListener=function(i,t){var e,n,r,s,a;if(qn(t),n=this._events,n===void 0)return this;if(e=n[i],e===void 0)return this;if(e===t||e.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[i],n.removeListener&&this.emit("removeListener",i,e.listener||t));else if(typeof e!="function"){for(r=-1,s=e.length-1;s>=0;s--)if(e[s]===t||e[s].listener===t){a=e[s].listener,r=s;break}if(r<0)return this;r===0?e.shift():jf(e,r),e.length===1&&(n[i]=e[0]),n.removeListener!==void 0&&this.emit("removeListener",i,a||t)}return this},nt.prototype.off=nt.prototype.removeListener,nt.prototype.removeAllListeners=function(i){var t,e,n;if(e=this._events,e===void 0)return this;if(e.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):e[i]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete e[i]),this;if(arguments.length===0){var r=Object.keys(e),s;for(n=0;n<r.length;++n)s=r[n],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=e[i],typeof t=="function")this.removeListener(i,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(i,t[n]);return this};function vl(i,t,e){var n=i._events;if(n===void 0)return[];var r=n[t];return r===void 0?[]:typeof r=="function"?e?[r.listener||r]:[r]:e?Vf(r):bl(r,r.length)}nt.prototype.listeners=function(i){return vl(this,i,!0)},nt.prototype.rawListeners=function(i){return vl(this,i,!1)},nt.listenerCount=function(i,t){return typeof i.listenerCount=="function"?i.listenerCount(t):yl.call(i,t)},nt.prototype.listenerCount=yl;function yl(i){var t=this._events;if(t!==void 0){var e=t[i];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}nt.prototype.eventNames=function(){return this._eventsCount>0?Wn(this._events):[]};function bl(i,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=i[n];return e}function jf(i,t){for(;t+1<i.length;t++)i[t]=i[t+1];i.pop()}function Vf(i){for(var t=new Array(i.length),e=0;e<t.length;++e)t[e]=i[e].listener||i[e];return t}function $f(i,t){return new Promise(function(e,n){function r(a){i.removeListener(t,s),n(a)}function s(){typeof i.removeListener=="function"&&i.removeListener("error",r),e([].slice.call(arguments))}wl(i,t,s,{once:!0}),t!=="error"&&Xf(i,r,{once:!0})})}function Xf(i,t,e){typeof i.on=="function"&&wl(i,"error",t,e)}function wl(i,t,e,n){if(typeof i.on=="function")n.once?i.once(t,e):i.on(t,e);else if(typeof i.addEventListener=="function")i.addEventListener(t,function r(s){n.once&&i.removeEventListener(t,r),e(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}var Yf=Ws.exports;class zv extends Yf.EventEmitter{constructor(){super()}on(t,e){return super.on(t,e)}addListener(t,e){return this.on(t,e)}prependListener(t,e){return super.prependListener(t,e)}once(t,e){return super.once(t,e)}prependOnceListener(t,e){return super.prependOnceListener(t,e)}removeListener(t,e){return super.removeListener(t,e)}off(t,e){return super.off(t,e)}removeAllListeners(t){return super.removeAllListeners(t)}emit(t,...e){return super.emit(t,...e)}listeners(t){return super.listeners(t)}rawListeners(t){return super.rawListeners(t)}listenerCount(t){return super.listenerCount(t)}}class Wf{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(n=>n!==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(n=>{Reflect.apply(n,this,e)})}once(t,e){const n=(()=>{let r=!1;return(...s)=>{r||(r=!0,Reflect.apply(e,this,s),this.off(t,n))}})();this.on(t,n)}}const Sl=(i,t="image/svg+xml",e="utf-8")=>new Blob([i],{type:`${t};charset=${e}`}),Cl=i=>new XMLSerializer().serializeToString(i),qf=(i,t="text/html")=>new DOMParser().parseFromString(i,t),Kf=(i,t="image/svg+xml",e="utf-8")=>Sl(Cl(i),t,e),Zf=(i,t)=>{const e=document.createElement("a");e.style.visibility="hidden",document.body.appendChild(e),e.download=t,typeof i=="string"?e.href=i:e.href=window.URL.createObjectURL(i),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)};function xl(i=["*"],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(i)&&i.length>0&&e.setAttribute("accept",i.join(",")),t&&e.setAttribute("multiple","true"),e.click(),new Promise((n,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);!i.includes("*")&&s.some(a=>!i.includes(`.${El(a)}`))&&r(new Error(`Please select files in ${i} format`)),n(s)}})})}const qs=(i,t="text",e)=>new Promise((n,r)=>{const s=new FileReader;switch(s.addEventListener("progress",a=>{e?.(a.loaded,a.total)}),s.addEventListener("load",a=>{n(a.target?.result)}),s.addEventListener("error",a=>{r(a)}),t){case"dataURL":s.readAsDataURL(i);break;case"binaryString":s.readAsBinaryString(i);break;case"arrayBuffer":s.readAsArrayBuffer(i);break;default:s.readAsText(i)}});function Tl(i,t,e){return qs(i.slice(t,e),"arrayBuffer")}async function Jf(i){const t=await Tl(i,0,4);return Co(t)}const El=i=>{let t;return i instanceof File?t=i.name:t=i,t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i)?.[1]??""};function Qf(i,t){i.addEventListener("change",function(){t(i.files)},!1)}function t0(i,t){i.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},!1),i.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&t(e.dataTransfer.files)},!1)}function e0(i){typeof queueMicrotask=="function"?queueMicrotask(i):Promise.resolve().then(i).catch(t=>setTimeout(()=>{throw t}))}function i0(i,t={},e=[]){return{tag:i,props:t,children:e}}function Zi(i,t){if(i.el)return;const e=i.el=document.createElement(i.tag);if(i.props)for(const n in i.props){const r=i.props[n];n.startsWith("on")?e.addEventListener(n.slice(2).toLowerCase(),r):e.setAttribute(n,r)}i.children&&(typeof i.children=="string"?e.textContent=i.children:i.children.forEach(n=>{Zi(n,e)})),t.appendChild(e)}function kl(i,t){if(i.tag!==t.tag){if(!i.el)return;const e=i.el.parentElement||document.body;e.removeChild(i.el),Zi(t,e)}else{const e=t.el=i.el;if(!e)return;const n=i.props,r=t.props;for(const o in n)o in r||(o.startsWith("on")?e.removeEventListener(o.slice(2).toLowerCase(),n[o]):e.removeAttribute(o));for(const o in r){const h=n[o],l=r[o];l!=h&&(o.startsWith("on")?e.addEventListener(o.slice(2).toLowerCase(),l):e.setAttribute(o,l))}const s=i.children||[],a=t.children||[];if(typeof a=="string")e.innerHTML=a;else if(typeof s=="string")e.innerHTML="",a.forEach(o=>{Zi(o,e)});else{const o=Math.min(s.length,a.length);for(let h=0;h<o;h++)kl(s[h],a[h]);a.length>s.length&&a.slice(s.length).forEach(h=>{Zi(h,e)}),a.length<s.length&&s.slice(a.length).forEach(h=>{h.el&&e.removeChild(h.el)})}}}function Al(i,t,e){if(!i){e&&t&&e.appendChild(t);return}if(!i.isEqualNode(t)){if(i.nodeName!==t.nodeName){e.replaceChild(t,i);return}if(i.nodeType===Node.TEXT_NODE){i.textContent!==t.textContent&&(i.textContent=t.textContent);return}for(let n=i.attributes.length-1;n>=0;n--){const r=i.attributes[n].name;!t.hasAttribute(r)&&r!=="open"&&i.removeAttribute(r)}for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n].name,s=t.attributes[n].value;i.setAttribute(r,s)}for(let n=0;n<t.childNodes.length;n++)i.childNodes[n]?Al(i.childNodes[n],t.childNodes[n],i):i.appendChild(t.childNodes[n].cloneNode(!0));for(;i.childNodes.length>t.childNodes.length;)i.lastChild&&i.removeChild(i.lastChild)}}class Ji{constructor(t){this.waitingResponse=[],this.messageQueue=[],this.url=t,this.createSocket()}createSocket(){this.socket=new Ji(this.url),this.socket.onopen=()=>{this.messageQueue.forEach(t=>this.socket.send(t)),this.messageQueue=[]},this.socket.onclose=t=>{const{code:e,reason:n,wasClean:r}=t;console.log(`ws closed : ${e} ${n} ${r}`)},this.socket.onerror=t=>{console.log(`ws error : ${t}`)},this.socket.onmessage=t=>{this.processMessage(t)}}recreateSocket(t){console.log("Reconnection Attempted"),this.messageQueue.push(t),this.createSocket()}closeSocket(){this.socket.close(),console.log("Socket closed manually.")}openSocket(){this.createSocket(),console.log("Socket opened manually.")}async sendPayload(t){let e=+new Date;const n=this.waitingResponse[e]={sent:e},r={...n,...t};try{this.socket.readyState===Ji.OPEN?this.socket.send(JSON.stringify(r)):this.recreateSocket(JSON.stringify(r));const s=await new Promise(function(a,o){n.resolve=a,console.log(n),setTimeout(()=>{o("Timeout")},5e3)});return console.info("Time took",(+new Date-n.sent)/1e3),s}finally{console.log("Exit code ran successfully"),delete this.waitingResponse[e]}}async processMessage(t){try{let e=JSON.parse(t.data);if(Object.prototype.hasOwnProperty.call(e,"requestid")){const n=this.waitingResponse[e.requestid];n?n.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(t.data)}}async sendRequest(t,e,n=r=>{console.log(r)}){this.sendPayload(t).then(function(r){e(r)},function(r){n(r)})}sendMessage(t){const e=(()=>{try{return JSON.stringify(t)}catch{return t}})();this.socket.readyState===Ji.OPEN?this.socket.send(e):this.recreateSocket(e)}}function Ks(){return document.compatMode=="BackCompat"?document.body:document.documentElement}function pi(){const i=Ks();return{scrollTop:i.scrollTop,scrollLeft:i.scrollLeft,scrollWidth:i.scrollWidth,scrollHeight:i.scrollHeight}}function Kn(){const i=Ks();return{clientTop:i.clientTop,clientLeft:i.clientLeft,clientWidth:i.clientWidth,clientHeight:i.clientHeight}}function Qi(){const{clientWidth:i,clientHeight:t}=Kn();return{width:window.innerWidth||i,height:window.innerHeight||t}}function n0(){const{scrollWidth:i,scrollHeight:t}=pi(),{width:e,height:n}=Qi();return{width:Math.max(i,e),height:Math.max(t,n)}}function r0(i){const{width:t,height:e}=Qi(),{top:n,left:r,right:s,bottom:a}=i.getBoundingClientRect();return(n>=0&&n<=e||a>=0&&a<=e)&&(r>=0&&r<=t||s>=0&&s<=t)}function s0(i,t,e){const n={threshold:1},r=function(a,o){const{width:h,height:l}=Qi();a.forEach(c=>{const{top:d,left:f,right:u,bottom:g}=c.boundingClientRect;(d>=0&&d<=l||g>=0&&g<=l)&&(f>=0&&f<=h||u>=0&&u<=h)?t(c.target):e?.(c.target)})};new IntersectionObserver(r,n).observe(i)}function Pl(i){const{top:t,left:e}=i.getBoundingClientRect(),n=pi();return{x:e+n.scrollLeft,y:t+n.scrollTop}}function a0(i){return{x:Ml(i),y:Rl(i)}}function Ml(i){let t=0;for(;i!==null;)t+=i.offsetLeft,i=i.offsetParent;return t}function Rl(i){let t=0;for(;i!==null;)t+=i.offsetTop,i=i.offsetParent;return t}function o0(i){const t=i.getBoundingClientRect();return{x:t.left,y:t.top}}function Dl(i){if(i.pageX&&i.pageY)return{x:i.pageX,y:i.pageY};const t=pi();return{x:i.clientX+t.scrollLeft,y:i.clientY+t.scrollTop}}function l0(i){return{x:i.clientX,y:i.clientY}}function Zn(i,t){const e=Dl(t),n=Pl(i);return{x:e.x-n.x,y:e.y-n.y}}const Ve=()=>{const i=navigator.userAgent.toLowerCase();let t="Unknown";return i.includes("mac")?t="macOS":i.includes("win")?t="Windows":/android/.test(i)?t="Android":/iphone|ipad|ipod/.test(i)?t="iOS":/linux/.test(i)?t="Linux":/bsd/.test(i)&&(t="BSD"),t.toLowerCase()},h0=()=>{const i=navigator.userAgent;let t="Unknown";if(/Windows NT/.test(i)){const e=i.match(/Windows NT (\d+\.\d+)/);e&&(t=e[1])}else if(/Mac OS X/.test(i)){const e=i.match(/Mac OS X (\d+_\d+)/);e&&(t=e[1].replace("_","."))}else if(/Android/.test(i)){const e=i.match(/Android (\d+\.\d+)/);e&&(t=e[1])}else if(/iPhone|iPad|iPod/.test(i)){const e=i.match(/OS (\d+_\d+)/);e&&(t=e[1].replace("_","."))}return t.toLowerCase()},c0=()=>{const i=navigator.userAgent.toLowerCase();let t="Unknown";return/chrome/.test(i)?t="Chrome":/firefox/.test(i)?t="Firefox":/safari/.test(i)?t="Safari":/edge/.test(i)?t="Edge":/msie|trident/.test(i)?t="IE":/MicroMessenger/.test(i)&&(t="Wechat"),t.toLowerCase()},u0=()=>{const i=navigator.userAgent;let t="Unknown";if(/Chrome/.test(i)){const e=i.match(/Chrome\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Firefox/.test(i)){const e=i.match(/Firefox\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Safari/.test(i)){const e=i.match(/Version\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Edge/.test(i)){const e=i.match(/Edge\/(\d+\.\d+)/);e&&(t=e[1])}else if(/MSIE|Trident/.test(i)){const e=i.match(/(?:MSIE|rv:)(\d+\.\d+)/);e&&(t=e[1])}return t},d0=()=>"geolocation"in navigator?new Promise((i,t)=>{navigator.geolocation.getCurrentPosition(e=>{const n=e.coords.latitude,r=e.coords.longitude;i({latitude:n,longitude:r})},e=>{t(e)})}):Promise.reject("Geolocation is not available.");function f0(){return(navigator.browserLanguage||navigator.language).toLowerCase()}function g0(){return Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase()}function Ll(){return Ve()==="ios"}function p0(){return Ve()==="ios"|Ve()==="macos"}function Ol(){return Ve()==="macos"}function Il(){return Ve()==="android"}function m0(){return Ll()||Il()}function _0(){return Ve()==="wechat"}function v0(){return typeof window=="object"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Fl(){const i=window.navigator.userAgent,t=i.indexOf("MSIE ");if(t>0)return parseInt(i.substring(t+5,i.indexOf(".",t)),10);if(i.indexOf("Trident/")>0){const r=i.indexOf("rv:");return parseInt(i.substring(r+3,i.indexOf(".",r)),10)}const n=i.indexOf("Edge/");return n>0?parseInt(i.substring(n+5,i.indexOf(".",n)),10):-1}const y0=Fl()!==-1,b0=typeof document<"u",Nl=typeof window<"u",w0=typeof history<"u",S0=Nl&&window.File&&window.FileReader&&window.FileList&&window.Blob;function C0(i){var t=document.documentElement,e=window.devicePixelRatio;t.dataset.dpr=e;var n=100,r=function(){var s=Math.min(t.clientWidth,i);t.dataset.width=s,t.dataset.rem=n=Math.round(100*(s/i)),t.style.fontSize=n+"px"};r(),window.rem2px=function(s){return s=parseFloat(s),s*n},window.px2rem=function(s){return s=parseFloat(s),s/n},window.addEventListener&&window.addEventListener("orientationchange"in window?"orientationchange":"resize",r,!1)}function x0(i){return btoa(encodeURIComponent(i)).replaceAll("+","*").replaceAll("/","-").replaceAll("=","")}function T0(i){let t=i.replaceAll("*","+").replaceAll("-","/");const e=t.length%4;return e&&(t=t.padEnd(t.length+(4-e),"=")),decodeURIComponent(atob(t))}function Ul(i){return new URL(i)}function E0(i){const t="(?<protocol>https?:)",e="(?<host>(?<hostname>[^/#?:]+)(?::(?<port>\\d+))?)",n="(?<pathname>(?:\\/[^/#?]+)*\\/?)",r="(?<search>(?:\\?[^#]*)?)",s="(?<hash>(?:#.*)?)",o=new RegExp(`^${t}//${e}${n}${r}${s}$`).exec(i);return o&&o.groups?(o.groups.port=o.groups?.port||"",o.groups):{protocol:"",host:"",hostname:"",port:"",pathname:"",search:"",hash:""}}function k0(i){i=i.replace(/^[#?&]/,"");const t={};if(!i)return t;const e=/(?:^|&)([^&=]*)=?([^&]*?)(?=&|$)/y;let n=e.exec(i);for(;n;)t[n[1]]=n[2],n=e.exec(i);return t}function A0(i){const t=Ul(i);return t.protocol==="http:"||t.protocol==="https:"}function Gl(i){return"?"+[...i.entries()].map(t=>encodeURIComponent(t[0])+"="+encodeURIComponent(t[1]instanceof File?t[1].name:t[1])).join("&")}function Zs(i,t){return i.indexOf("?")>=0?i+t.replace(/^\?/,"&"):i.replace(/(?:\?.*)?$/,t.replace(/^[&?]/,"?"))}function P0(i){return new URLSearchParams(i).toString()}function M0(i){let t="";for(const e in i)t&&(t+="&"),t+=`${e}=${i[e]}`;return t}const R0=i=>Array.from(new URLSearchParams(i)).reduce((t,[e,n])=>Object.assign({},t,{[e]:t[e]?(Array.isArray(t[e])?t[e]:[t[e]]).concat(n):n}),{});function D0(){const i={};let t=location.search;return t&&(t=t.substring(1,t.length),t.split("&").forEach(n=>{const r=n.split("=");i[r[0]]=decodeURIComponent(r[1])})),i}function L0(i){let t="";new MutationObserver(function(n){window.location.href!==t&&(t=window.location.href,console.log(`URL data changed to ${window.location.href}`),i&&i(location.href))}).observe(document,{attributes:!0,childList:!0,subtree:!0})}function O0(i){window.addEventListener("hashchange",()=>{i(location.hash)})}function I0(i){window.addEventListener("popstate",i,!1)}const F0=new Proxy({},{get(i,t){return function(e={},...n){const r=document.createElement(t);for(const s of Object.keys(e))r.setAttribute(s,e[s]);for(const s of n)typeof s=="string"?r.appendChild(document.createTextNode(s)):r.appendChild(s);return r}}}),N0=i=>navigator.clipboard.writeText(i),U0=()=>window.getSelection()?.toString(),G0=i=>i===document.activeElement,B0=i=>Array.prototype.slice.call(i.parentNode?.children).filter(t=>t!==i),z0=()=>!document.hidden,H0=(i={x:0,y:0})=>window.scrollTo(i.x,i.y),j0=()=>history.back(),V0=()=>history.go(-1);function $0(){const i=document.getElementsByTagName("img"),t=Qi().height;let e=0;return()=>{for(let n=e;n<i.length;n++)i[n].getBoundingClientRect().top<t&&(i[n].src=i[n].getAttribute("data-src")??"",e=n+1)}}const X0=()=>new Promise(i=>{const t=Array.from(document.querySelectorAll("link[rel=stylesheet]"));let e=document.styleSheets.length??0;const n=()=>e>=t.length?(i(),!0):!1;n()||t.forEach(r=>{r.onload=()=>{e+=1,n()}})}),Y0=(i,t,e=400)=>{const n=document.createElement("span");n.style.visibility="hidden",n.style.padding="0",n.style.whiteSpace="nowrap",n.style.overflow="visible",n.style.fontSize=t>12?t+"px":"12px",n.style.fontWeight=e.toString(),n.innerText=i,document.body.appendChild(n);const r=n.offsetWidth;return document.body.removeChild(n),r},W0=(i,t,e=12,n=400,r=!0)=>{let s="",a="",o="";if(!i||t<e||typeof i!="string")return s;const h=i.split(""),l=document.createElement("span");l.style.visibility="hidden",l.style.padding="0",l.style.whiteSpace="nowrap",l.style.overflow="visible",l.style.fontSize=e>12?e+"px":"12px",l.style.fontWeight=n.toString(),document.body.appendChild(l);for(let c=0,d=h.length;c<d;c++){const f=h[c];if(a=o,o+=f,s=o,l.innerText=o,l.offsetWidth>t){r?s=a+"...":s=a;break}}return document.body.removeChild(l),s};function q0(i,t="encode"){const e={"&":"&","<":"<",">":">",""":'"',"'":"'"};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=new RegExp(t=="decode"?n:e[n],"g");i=i.replace(r,t=="decode"?e[n]:n)}return i}const K0=i=>i.replace(/[\u00A0-\u9999<>&](?!#)/gim,t=>"&#"+t.charCodeAt(0)+";").replace(/\u0008/gim,"");function Z0(i){return i=i.replace(/<%=(.+?)%>/g,"`); \n echo( $1 ); \n echo(`").replace(/<%([\s\S]+?)%>/g,"`); \n $1 \n echo(`"),i="echo(`"+i+"`);",`(function parse(data){
|
|
7
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function ra(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var ur=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,n,r,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=Ro(a),l=o.next();!l.done;l=o.next()){var h=l.value;h.remove(this)}}catch(m){t={error:m}}finally{try{l&&!l.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else a.remove(this);var c=this.initialTeardown;if(ni(c))try{c()}catch(m){s=m instanceof Do?m.errors:[m]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=Ro(d),u=f.next();!u.done;u=f.next()){var g=u.value;try{xc(g)}catch(m){s=s??[],m instanceof Do?s=cr(cr([],hr(s)),hr(m.errors)):s.push(m)}}}catch(m){n={error:m}}finally{try{u&&!u.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}if(s)throw new Do(s)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)xc(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&ra(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&ra(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}(),bc=ur.EMPTY;function wc(i){return i instanceof ur||i&&"closed"in i&&ni(i.remove)&&ni(i.add)&&ni(i.unsubscribe)}function xc(i){ni(i)?i():i.unsubscribe()}var Sc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Xp={setTimeout:function(i,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];return setTimeout.apply(void 0,cr([i,t],hr(e)))},clearTimeout:function(i){return clearTimeout(i)},delegate:void 0};function Yp(i){Xp.setTimeout(function(){throw i})}function Cc(){}function sa(i){i()}var Io=function(i){bi(t,i);function t(e){var n=i.call(this)||this;return n.isStopped=!1,e?(n.destination=e,wc(e)&&e.add(n)):n.destination=Jp,n}return t.create=function(e,n,r){return new Fo(e,n,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(ur),Wp=Function.prototype.bind;function Oo(i,t){return Wp.call(i,t)}var Kp=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(n){aa(n)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(n){aa(n)}else aa(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){aa(e)}},i}(),Fo=function(i){bi(t,i);function t(e,n,r){var s=i.call(this)||this,a;if(ni(e)||!e)a={next:e??void 0,error:n??void 0,complete:r??void 0};else{var o;s&&Sc.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=function(){return s.unsubscribe()},a={next:e.next&&Oo(e.next,o),error:e.error&&Oo(e.error,o),complete:e.complete&&Oo(e.complete,o)}):a=e}return s.destination=new Kp(a),s}return t}(Io);function aa(i){Yp(i)}function Zp(i){throw i}var Jp={closed:!0,next:Cc,error:Zp,complete:Cc},Qp=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function t2(i){return i}function e2(i){return i.length===0?t2:i.length===1?i[0]:function(t){return i.reduce(function(e,n){return n(e)},t)}}var kc=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,n){var r=this,s=n2(t)?t:new Fo(t,e,n);return sa(function(){var a=r,o=a.operator,l=a.source;s.add(o?o.call(s,l):l?r._subscribe(s):r._trySubscribe(s))}),s},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var n=this;return e=Ec(e),new e(function(r,s){var a=new Fo({next:function(o){try{t(o)}catch(l){s(l),a.unsubscribe()}},error:s,complete:r});n.subscribe(a)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Qp]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return e2(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=Ec(t),new t(function(n,r){var s;e.subscribe(function(a){return s=a},function(a){return r(a)},function(){return n(s)})})},i.create=function(t){return new i(t)},i}();function Ec(i){var t;return(t=i??Sc.Promise)!==null&&t!==void 0?t:Promise}function i2(i){return i&&ni(i.next)&&ni(i.error)&&ni(i.complete)}function n2(i){return i&&i instanceof Io||i2(i)&&wc(i)}(function(i){bi(t,i);function t(e,n,r,s,a,o){var l=i.call(this,e)||this;return l.onFinalize=a,l.shouldUnsubscribe=o,l._next=n?function(h){try{n(h)}catch(c){e.error(c)}}:i.prototype._next,l._error=s?function(h){try{s(h)}catch(c){e.error(c)}finally{this.unsubscribe()}}:i.prototype._error,l._complete=r?function(){try{r()}catch(h){e.error(h)}finally{this.unsubscribe()}}:i.prototype._complete,l}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;i.prototype.unsubscribe.call(this),!n&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t})(Io);var r2=Lo(function(i){return function(){i(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),s2=function(i){bi(t,i);function t(){var e=i.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var n=new Tc(this,this);return n.operator=e,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new r2},t.prototype.next=function(e){var n=this;sa(function(){var r,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Ro(n.currentObservers),o=a.next();!o.done;o=a.next()){var l=o.value;l.next(e)}}catch(h){r={error:h}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var n=this;sa(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=e;for(var r=n.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;sa(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var n=e.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),i.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var n=this,r=this,s=r.hasError,a=r.isStopped,o=r.observers;return s||a?bc:(this.currentObservers=null,o.push(e),new ur(function(){n.currentObservers=null,ra(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var n=this,r=n.hasError,s=n.thrownError,a=n.isStopped;r?e.error(s):a&&e.complete()},t.prototype.asObservable=function(){var e=new kc;return e.source=this,e},t.create=function(e,n){return new Tc(e,n)},t}(kc),Tc=function(i){bi(t,i);function t(e,n){var r=i.call(this)||this;return r.destination=e,r.source=n,r}return t.prototype.next=function(e){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.next)===null||r===void 0||r.call(n,e)},t.prototype.error=function(e){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.error)===null||r===void 0||r.call(n,e)},t.prototype.complete=function(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)},t.prototype._subscribe=function(e){var n,r;return(r=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&r!==void 0?r:bc},t}(s2),a2={now:function(){return Date.now()},delegate:void 0},o2=function(i){bi(t,i);function t(e,n){return i.call(this)||this}return t.prototype.schedule=function(e,n){return this},t}(ur),No={setInterval:function(i,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];var r=No.delegate;return r?.setInterval?r.setInterval.apply(r,cr([i,t],hr(e))):setInterval.apply(void 0,cr([i,t],hr(e)))},clearInterval:function(i){return clearInterval(i)},delegate:void 0},l2=function(i){bi(t,i);function t(e,n){var r=i.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return t.prototype.schedule=function(e,n){var r;if(n===void 0&&(n=0),this.closed)return this;this.state=e;var s=this.id,a=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(a,s,n)),this.pending=!0,this.delay=n,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(a,this.id,n),this},t.prototype.requestAsyncId=function(e,n,r){return r===void 0&&(r=0),No.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,n,r){if(r===void 0&&(r=0),r!=null&&this.delay===r&&this.pending===!1)return n;n!=null&&No.clearInterval(n)},t.prototype.execute=function(e,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,n);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,n){var r=!1,s;try{this.work(e)}catch(a){r=!0,s=a||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var e=this,n=e.id,r=e.scheduler,s=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,ra(s,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,i.prototype.unsubscribe.call(this)}},t}(o2),Pc=function(){function i(t,e){e===void 0&&(e=i.now),this.schedulerActionCtor=t,this.now=e}return i.prototype.schedule=function(t,e,n){return e===void 0&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},i.now=a2.now,i}(),h2=function(i){bi(t,i);function t(e,n){n===void 0&&(n=Pc.now);var r=i.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return t.prototype.flush=function(e){var n=this.actions;if(this._active){n.push(e);return}var r;this._active=!0;do if(r=e.execute(e.state,e.delay))break;while(e=n.shift());if(this._active=!1,r){for(;e=n.shift();)e.unsubscribe();throw r}},t}(Pc);new h2(l2);function c2(i){switch(i.responseType){case"json":{if("response"in i)return i.response;var t=i;return JSON.parse(t.responseText)}case"document":return i.responseXML;case"text":default:{if("response"in i)return i.response;var t=i;return t.responseText}}}var Ac=Lo(function(i){return function(t,e,n){this.message=t,this.name="AjaxError",this.xhr=e,this.request=n,this.status=e.status,this.responseType=e.responseType;var r;try{r=c2(e)}catch{r=e.responseText}this.response=r}});(function(){function i(t,e){return Ac.call(this,"ajax timeout",t,e),this.name="AjaxTimeoutError",this}return i.prototype=Object.create(Ac.prototype),i})();var Uo={exports:{}},wn=typeof Reflect=="object"?Reflect:null,Mc=wn&&typeof wn.apply=="function"?wn.apply:function(i,t,e){return Function.prototype.apply.call(i,t,e)},oa;wn&&typeof wn.ownKeys=="function"?oa=wn.ownKeys:Object.getOwnPropertySymbols?oa=function(i){return Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i))}:oa=function(i){return Object.getOwnPropertyNames(i)};function u2(i){console&&console.warn&&console.warn(i)}var Rc=Number.isNaN||function(i){return i!==i};function Xt(){Xt.init.call(this)}Uo.exports=Xt,Uo.exports.once=p2,Xt.EventEmitter=Xt,Xt.prototype._events=void 0,Xt.prototype._eventsCount=0,Xt.prototype._maxListeners=void 0;var Lc=10;function la(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(Xt,"defaultMaxListeners",{enumerable:!0,get:function(){return Lc},set:function(i){if(typeof i!="number"||i<0||Rc(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");Lc=i}}),Xt.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},Xt.prototype.setMaxListeners=function(i){if(typeof i!="number"||i<0||Rc(i))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+i+".");return this._maxListeners=i,this};function Dc(i){return i._maxListeners===void 0?Xt.defaultMaxListeners:i._maxListeners}Xt.prototype.getMaxListeners=function(){return Dc(this)},Xt.prototype.emit=function(i){for(var t=[],e=1;e<arguments.length;e++)t.push(arguments[e]);var n=i==="error",r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var o=r[i];if(o===void 0)return!1;if(typeof o=="function")Mc(o,this,t);else for(var l=o.length,h=Uc(o,l),e=0;e<l;++e)Mc(h[e],this,t);return!0};function Ic(i,t,e,n){var r,s,a;if(la(e),s=i._events,s===void 0?(s=i._events=Object.create(null),i._eventsCount=0):(s.newListener!==void 0&&(i.emit("newListener",t,e.listener?e.listener:e),s=i._events),a=s[t]),a===void 0)a=s[t]=e,++i._eventsCount;else if(typeof a=="function"?a=s[t]=n?[e,a]:[a,e]:n?a.unshift(e):a.push(e),r=Dc(i),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=i,o.type=t,o.count=a.length,u2(o)}return i}Xt.prototype.addListener=function(i,t){return Ic(this,i,t,!1)},Xt.prototype.on=Xt.prototype.addListener,Xt.prototype.prependListener=function(i,t){return Ic(this,i,t,!0)};function f2(){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 Oc(i,t,e){var n={fired:!1,wrapFn:void 0,target:i,type:t,listener:e},r=f2.bind(n);return r.listener=e,n.wrapFn=r,r}Xt.prototype.once=function(i,t){return la(t),this.on(i,Oc(this,i,t)),this},Xt.prototype.prependOnceListener=function(i,t){return la(t),this.prependListener(i,Oc(this,i,t)),this},Xt.prototype.removeListener=function(i,t){var e,n,r,s,a;if(la(t),n=this._events,n===void 0)return this;if(e=n[i],e===void 0)return this;if(e===t||e.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[i],n.removeListener&&this.emit("removeListener",i,e.listener||t));else if(typeof e!="function"){for(r=-1,s=e.length-1;s>=0;s--)if(e[s]===t||e[s].listener===t){a=e[s].listener,r=s;break}if(r<0)return this;r===0?e.shift():d2(e,r),e.length===1&&(n[i]=e[0]),n.removeListener!==void 0&&this.emit("removeListener",i,a||t)}return this},Xt.prototype.off=Xt.prototype.removeListener,Xt.prototype.removeAllListeners=function(i){var t,e,n;if(e=this._events,e===void 0)return this;if(e.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):e[i]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete e[i]),this;if(arguments.length===0){var r=Object.keys(e),s;for(n=0;n<r.length;++n)s=r[n],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=e[i],typeof t=="function")this.removeListener(i,t);else if(t!==void 0)for(n=t.length-1;n>=0;n--)this.removeListener(i,t[n]);return this};function Fc(i,t,e){var n=i._events;if(n===void 0)return[];var r=n[t];return r===void 0?[]:typeof r=="function"?e?[r.listener||r]:[r]:e?g2(r):Uc(r,r.length)}Xt.prototype.listeners=function(i){return Fc(this,i,!0)},Xt.prototype.rawListeners=function(i){return Fc(this,i,!1)},Xt.listenerCount=function(i,t){return typeof i.listenerCount=="function"?i.listenerCount(t):Nc.call(i,t)},Xt.prototype.listenerCount=Nc;function Nc(i){var t=this._events;if(t!==void 0){var e=t[i];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}Xt.prototype.eventNames=function(){return this._eventsCount>0?oa(this._events):[]};function Uc(i,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=i[n];return e}function d2(i,t){for(;t+1<i.length;t++)i[t]=i[t+1];i.pop()}function g2(i){for(var t=new Array(i.length),e=0;e<t.length;++e)t[e]=i[e].listener||i[e];return t}function p2(i,t){return new Promise(function(e,n){function r(a){i.removeListener(t,s),n(a)}function s(){typeof i.removeListener=="function"&&i.removeListener("error",r),e([].slice.call(arguments))}Gc(i,t,s,{once:!0}),t!=="error"&&m2(i,r,{once:!0})})}function m2(i,t,e){typeof i.on=="function"&&Gc(i,"error",t,e)}function Gc(i,t,e,n){if(typeof i.on=="function")n.once?i.once(t,e):i.on(t,e);else if(typeof i.addEventListener=="function")i.addEventListener(t,function r(s){n.once&&i.removeEventListener(t,r),e(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}var v2=Uo.exports;class Kw extends v2.EventEmitter{constructor(){super()}on(t,e){return super.on(t,e)}addListener(t,e){return this.on(t,e)}prependListener(t,e){return super.prependListener(t,e)}once(t,e){return super.once(t,e)}prependOnceListener(t,e){return super.prependOnceListener(t,e)}removeListener(t,e){return super.removeListener(t,e)}off(t,e){return super.off(t,e)}removeAllListeners(t){return super.removeAllListeners(t)}emit(t,...e){return super.emit(t,...e)}listeners(t){return super.listeners(t)}rawListeners(t){return super.rawListeners(t)}listenerCount(t){return super.listenerCount(t)}}class _2{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(n=>n!==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(n=>{Reflect.apply(n,this,e)})}once(t,e){const n=(()=>{let r=!1;return(...s)=>{r||(r=!0,Reflect.apply(e,this,s),this.off(t,n))}})();this.on(t,n)}}const Bc=(i,t="image/svg+xml",e="utf-8")=>new Blob([i],{type:`${t};charset=${e}`}),$c=i=>new XMLSerializer().serializeToString(i),y2=(i,t="text/html")=>new DOMParser().parseFromString(i,t),b2=(i,t="image/svg+xml",e="utf-8")=>Bc($c(i),t,e),w2=(i,t)=>{const e=document.createElement("a");e.style.visibility="hidden",document.body.appendChild(e),e.download=t,typeof i=="string"?e.href=i:e.href=window.URL.createObjectURL(i),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href)};function zc(i=["*"],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(i)&&i.length>0&&e.setAttribute("accept",i.join(",")),t&&e.setAttribute("multiple","true"),e.click(),new Promise((n,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);!i.includes("*")&&s.some(a=>!i.includes(`.${Hc(a)}`))&&r(new Error(`Please select files in ${i} format`)),n(s)}})})}const Go=(i,t="text",e)=>new Promise((n,r)=>{const s=new FileReader;switch(s.addEventListener("progress",a=>{e?.(a.loaded,a.total)}),s.addEventListener("load",a=>{n(a.target?.result)}),s.addEventListener("error",a=>{r(a)}),t){case"dataURL":s.readAsDataURL(i);break;case"binaryString":s.readAsBinaryString(i);break;case"arrayBuffer":s.readAsArrayBuffer(i);break;default:s.readAsText(i)}});function jc(i,t,e){return Go(i.slice(t,e),"arrayBuffer")}async function x2(i){const t=await jc(i,0,4);return Bh(t)}const Hc=i=>{let t;return i instanceof File?t=i.name:t=i,t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i)?.[1]??""};function S2(i,t){i.addEventListener("change",function(){t(i.files)},!1)}function C2(i,t){i.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},!1),i.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer&&t(e.dataTransfer.files)},!1)}function k2(i){typeof queueMicrotask=="function"?queueMicrotask(i):Promise.resolve().then(i).catch(t=>setTimeout(()=>{throw t}))}function E2(i,t={},e=[]){return{tag:i,props:t,children:e}}function fr(i,t){if(i.el)return;const e=i.el=document.createElement(i.tag);if(i.props)for(const n in i.props){const r=i.props[n];n.startsWith("on")?e.addEventListener(n.slice(2).toLowerCase(),r):e.setAttribute(n,r)}i.children&&(typeof i.children=="string"?e.textContent=i.children:i.children.forEach(n=>{fr(n,e)})),t.appendChild(e)}function Vc(i,t){if(i.tag!==t.tag){if(!i.el)return;const e=i.el.parentElement||document.body;e.removeChild(i.el),fr(t,e)}else{const e=t.el=i.el;if(!e)return;const n=i.props,r=t.props;for(const o in n)o in r||(o.startsWith("on")?e.removeEventListener(o.slice(2).toLowerCase(),n[o]):e.removeAttribute(o));for(const o in r){const l=n[o],h=r[o];h!=l&&(o.startsWith("on")?e.addEventListener(o.slice(2).toLowerCase(),h):e.setAttribute(o,h))}const s=i.children||[],a=t.children||[];if(typeof a=="string")e.innerHTML=a;else if(typeof s=="string")e.innerHTML="",a.forEach(o=>{fr(o,e)});else{const o=Math.min(s.length,a.length);for(let l=0;l<o;l++)Vc(s[l],a[l]);a.length>s.length&&a.slice(s.length).forEach(l=>{fr(l,e)}),a.length<s.length&&s.slice(a.length).forEach(l=>{l.el&&e.removeChild(l.el)})}}}function qc(i,t,e){if(!i){e&&t&&e.appendChild(t);return}if(!i.isEqualNode(t)){if(i.nodeName!==t.nodeName){e.replaceChild(t,i);return}if(i.nodeType===Node.TEXT_NODE){i.textContent!==t.textContent&&(i.textContent=t.textContent);return}for(let n=i.attributes.length-1;n>=0;n--){const r=i.attributes[n].name;!t.hasAttribute(r)&&r!=="open"&&i.removeAttribute(r)}for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n].name,s=t.attributes[n].value;i.setAttribute(r,s)}for(let n=0;n<t.childNodes.length;n++)i.childNodes[n]?qc(i.childNodes[n],t.childNodes[n],i):i.appendChild(t.childNodes[n].cloneNode(!0));for(;i.childNodes.length>t.childNodes.length;)i.lastChild&&i.removeChild(i.lastChild)}}class T2{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:n,wasClean:r}=t;console.log(`ws closed : ${e} ${n} ${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 n=this.waitingResponse[e.requestid];n?n.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,n=this.waitingResponse[e]={requestid:e};try{let r;t instanceof Blob||t instanceof ArrayBuffer||typeof t=="string"?r=t:r=JSON.stringify({...n,...t});const s=await new Promise((a,o)=>{n.resolve=a,this.sendWithRetry(r),setTimeout(()=>{o("Timeout")},5e3)});return console.info("Time took",(+new Date-n.requestid)/1e3),s}catch(r){return Promise.reject(r)}finally{delete this.waitingResponse[e]}}async send(t,e,n=r=>{console.log(r)}){this.sendPayload(t).then(e,n)}}function Bo(){return document.compatMode=="BackCompat"?document.body:document.documentElement}function xn(){const i=Bo();return{scrollTop:i.scrollTop,scrollLeft:i.scrollLeft,scrollWidth:i.scrollWidth,scrollHeight:i.scrollHeight}}function ha(){const i=Bo();return{clientTop:i.clientTop,clientLeft:i.clientLeft,clientWidth:i.clientWidth,clientHeight:i.clientHeight}}function ca(){const{clientWidth:i,clientHeight:t}=ha();return{width:window.innerWidth||i,height:window.innerHeight||t}}function P2(){const{scrollWidth:i,scrollHeight:t}=xn(),{width:e,height:n}=ca();return{width:Math.max(i,e),height:Math.max(t,n)}}function A2(i){const{width:t,height:e}=ca(),{top:n,left:r,right:s,bottom:a}=i.getBoundingClientRect();return(n>=0&&n<=e||a>=0&&a<=e)&&(r>=0&&r<=t||s>=0&&s<=t)}function M2(i,t,e){const n={threshold:1};new IntersectionObserver(function(s,a){let o=s[0];if(s.length>1){const h=s.find(c=>c.isIntersecting);h&&(o=h)}o.isIntersecting&&o.intersectionRatio>=n.threshold?t(o.target):e?.(o.target)},n).observe(i)}function Xc(i){const{top:t,left:e}=i.getBoundingClientRect(),n=xn();return{x:e+n.scrollLeft,y:t+n.scrollTop}}function R2(i){return{x:Yc(i),y:Wc(i)}}function Yc(i){let t=0;for(;i!==null;)t+=i.offsetLeft,i=i.offsetParent;return t}function Wc(i){let t=0;for(;i!==null;)t+=i.offsetTop,i=i.offsetParent;return t}function L2(i){const t=i.getBoundingClientRect();return{x:t.left,y:t.top}}function Kc(i){if(i.pageX&&i.pageY)return{x:i.pageX,y:i.pageY};const t=xn();return{x:i.clientX+t.scrollLeft,y:i.clientY+t.scrollTop}}function D2(i){return{x:i.clientX,y:i.clientY}}function dr(i,t){const e=Kc(t),n=Xc(i);return{x:e.x-n.x,y:e.y-n.y}}const Hi=()=>{const i=navigator.userAgent.toLowerCase();let t="Unknown";return i.includes("mac")?t="macOS":i.includes("win")?t="Windows":/android/.test(i)?t="Android":/iphone|ipad|ipod/.test(i)?t="iOS":/linux/.test(i)?t="Linux":/bsd/.test(i)&&(t="BSD"),t.toLowerCase()},I2=()=>{const i=navigator.userAgent;let t="Unknown";if(/Windows NT/.test(i)){const e=i.match(/Windows NT (\d+\.\d+)/);e&&(t=e[1])}else if(/Mac OS X/.test(i)){const e=i.match(/Mac OS X (\d+_\d+)/);e&&(t=e[1].replace("_","."))}else if(/Android/.test(i)){const e=i.match(/Android (\d+\.\d+)/);e&&(t=e[1])}else if(/iPhone|iPad|iPod/.test(i)){const e=i.match(/OS (\d+_\d+)/);e&&(t=e[1].replace("_","."))}return t.toLowerCase()},O2=()=>{const i=navigator.userAgent.toLowerCase();let t="Unknown";return/chrome/.test(i)?t="Chrome":/firefox/.test(i)?t="Firefox":/safari/.test(i)?t="Safari":/edge/.test(i)?t="Edge":/msie|trident/.test(i)?t="IE":/MicroMessenger/.test(i)&&(t="Wechat"),t.toLowerCase()},F2=()=>{const i=navigator.userAgent;let t="Unknown";if(/Chrome/.test(i)){const e=i.match(/Chrome\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Firefox/.test(i)){const e=i.match(/Firefox\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Safari/.test(i)){const e=i.match(/Version\/(\d+\.\d+)/);e&&(t=e[1])}else if(/Edge/.test(i)){const e=i.match(/Edge\/(\d+\.\d+)/);e&&(t=e[1])}else if(/MSIE|Trident/.test(i)){const e=i.match(/(?:MSIE|rv:)(\d+\.\d+)/);e&&(t=e[1])}return t},N2=()=>"geolocation"in navigator?new Promise((i,t)=>{navigator.geolocation.getCurrentPosition(e=>{const n=e.coords.latitude,r=e.coords.longitude;i({latitude:n,longitude:r})},e=>{t(e)})}):Promise.reject("Geolocation is not available.");function U2(){return(navigator.browserLanguage||navigator.language).toLowerCase()}function G2(){return Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase()}function Zc(){return Hi()==="ios"}function B2(){return Hi()==="ios"|Hi()==="macos"}function Jc(){return Hi()==="macos"}function Qc(){return Hi()==="android"}function $2(){return Zc()||Qc()}function z2(){return Hi()==="wechat"}function j2(){return typeof window=="object"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function tu(){const i=window.navigator.userAgent,t=i.indexOf("MSIE ");if(t>0)return parseInt(i.substring(t+5,i.indexOf(".",t)),10);if(i.indexOf("Trident/")>0){const r=i.indexOf("rv:");return parseInt(i.substring(r+3,i.indexOf(".",r)),10)}const n=i.indexOf("Edge/");return n>0?parseInt(i.substring(n+5,i.indexOf(".",n)),10):-1}const H2=tu()!==-1,V2=typeof document<"u",eu=typeof window<"u",q2=typeof history<"u",X2=eu&&window.File&&window.FileReader&&window.FileList&&window.Blob;function Y2(i){var t=document.documentElement,e=window.top===window.self?window.devicePixelRatio:1;t.dataset.dpr=e;var n=100,r=function(){var s=Math.min(t.clientWidth,i);t.dataset.width=s,t.dataset.rem=n=Math.round(100*(s/i)),t.style.fontSize=n+"px"};r(),window.rem2px=function(s){return s=parseFloat(s),s*n},window.px2rem=function(s){return s=parseFloat(s),s/n},window.addEventListener&&window.addEventListener("orientationchange"in window?"orientationchange":"resize",r,!1)}function W2(i){return btoa(encodeURIComponent(i)).replaceAll("+","*").replaceAll("/","-").replaceAll("=","")}function K2(i){let t=i.replaceAll("*","+").replaceAll("-","/");const e=t.length%4;return e&&(t=t.padEnd(t.length+(4-e),"=")),decodeURIComponent(atob(t))}function iu(i){return new URL(i)}function Z2(i){const t="(?<protocol>https?:)",e="(?<host>(?<hostname>[^/#?:]+)(?::(?<port>\\d+))?)",n="(?<pathname>(?:\\/[^/#?]+)*\\/?)",r="(?<search>(?:\\?[^#]*)?)",s="(?<hash>(?:#.*)?)",o=new RegExp(`^${t}//${e}${n}${r}${s}$`).exec(i);return o&&o.groups?(o.groups.port=o.groups?.port||"",o.groups):{protocol:"",host:"",hostname:"",port:"",pathname:"",search:"",hash:""}}function J2(i){i=i.replace(/^[#?&]/,"");const t={};if(!i)return t;const e=/(?:^|&)([^&=]*)=?([^&]*?)(?=&|$)/y;let n=e.exec(i);for(;n;)t[n[1]]=n[2],n=e.exec(i);return t}function Q2(i){const t=iu(i);return t.protocol==="http:"||t.protocol==="https:"}function nu(i){return"?"+[...i.entries()].map(t=>encodeURIComponent(t[0])+"="+encodeURIComponent(t[1]instanceof File?t[1].name:t[1])).join("&")}function $o(i,t){return i.indexOf("?")>=0?i+t.replace(/^\?/,"&"):i.replace(/(?:\?.*)?$/,t.replace(/^[&?]/,"?"))}function tm(i){return new URLSearchParams(i).toString()}function em(i){let t="";for(const e in i)t&&(t+="&"),t+=`${e}=${i[e]}`;return t}const im=i=>Array.from(new URLSearchParams(i)).reduce((t,[e,n])=>Object.assign({},t,{[e]:t[e]?(Array.isArray(t[e])?t[e]:[t[e]]).concat(n):n}),{});function nm(){const i={};let t=location.search;return t&&(t=t.substring(1,t.length),t.split("&").forEach(n=>{const r=n.split("=");i[r[0]]=decodeURIComponent(r[1])})),i}function rm(i){let t="";new MutationObserver(function(n){window.location.href!==t&&(t=window.location.href,console.log(`URL data changed to ${window.location.href}`),i&&i(location.href))}).observe(document,{attributes:!0,childList:!0,subtree:!0})}function sm(i){window.addEventListener("hashchange",()=>{i(location.hash)})}function am(i){window.addEventListener("popstate",i,!1)}class om{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 dom=new Proxy({},{get(t,e){return function(n={},...r){const s=document.createElement(e);for(const a of Object.keys(n))s.setAttribute(a,n[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){
|
|
8
8
|
let output = "";
|
|
9
9
|
function echo(html){
|
|
10
10
|
output += html;
|
|
11
11
|
}
|
|
12
|
-
${
|
|
12
|
+
${t}
|
|
13
13
|
return output;
|
|
14
|
-
})`}const J0=typeof document<"u"&&document.ontouchstart?"touchstart":"click";function Q0(i){if(document.implementation.hasFeature("MouseEvents","2.0"))return i.button;switch(i.button){case 0:case 1:case 3:case 5:case 7:return 0;case 2:case 6:return 2;case 4:return 1}}class t1{static onDocumentReady(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}static loadScript(t){const e=document.createElement("script");e.type="text/javascript",e.src=t,e.async=!1,document.body.appendChild(e),e.onload=()=>{},e.onerror=()=>{}}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 iframePostMessage(t,e="http://test.com"){const n=document.createElement("iframe");n.src=`${e}/localstorage.html`,document.body.append(n),setTimeout(function(){n.contentWindow?.postMessage(t,e)},4e3),setTimeout(function(){n.remove()},6e3)}}function Bl(i,t=document){return new kt(i,t)}class kt{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}`)}get(t){return this.nodes[t]}concat(t){return new kt(this.nodes.concat(t.nodes),this.context)}then(t){return t(this)??this}each(t){return this.nodes.forEach((e,n)=>{t(e,n)}),this}on(t,e,n){return this.nodes.forEach(r=>{r.addEventListener(t,e,n)}),this}off(t,e,n){return this.nodes.forEach(r=>{r.removeEventListener(t,e,n)}),this}dispatchEvent(t,e){let n;const r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return typeof t=="string"?r.includes(t)?n=new MouseEvent(t,e):s.includes(t)?n=new KeyboardEvent(t,e):n=new Event(t,e):n=t,this.nodes.forEach(a=>{a.dispatchEvent(n)}),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(n=>{const r=kt._scriptConvert(n);r!=n&&e.content.replaceChild(r,n)}),e.content}static _scriptConvert(t){const e=n=>{const s=n.ownerDocument.createElement("script");s.text=n.text;const a=n.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(n=>{n.parentNode?.replaceChild(e(n),n)}),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 kt.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){return this.nodes.forEach(n=>{n[t](kt._fragment(e))}),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(n=>{e.push(...Array.from(n.querySelectorAll(t)))}),new kt(e,this.context)}filter(t){const e=[];return this.nodes.forEach(n=>{n.matches&&n.matches(t)&&e.push(n)}),new kt(e,this.context)}next(){const t=[];return this.nodes.forEach(e=>{const n=e.nextElementSibling;n&&t.push(n)}),new kt(t,this.context)}prev(){const t=[];return this.nodes.forEach(e=>{const n=e.previousElementSibling;n&&t.push(n)}),new kt(t,this.context)}closest(t){const e=[];return this.nodes.forEach(n=>{const r=n.closest(t);r&&e.push(r)}),new kt(e,this.context)}shadow(t){const e=[];this.nodes.forEach(r=>{r.shadowRoot&&e.push(r.shadowRoot)});const n=new kt(e,this.context);return t!==void 0?n.find(t):n}parent(t){return this.parents(t,!0)}parents(t,e=!1){const n=[],r=a=>{if(n.indexOf(a)==-1&&n.push(a),!e&&a.parentElement)return r(a.parentElement)};this.nodes.forEach(a=>{a.parentElement&&r(a.parentElement)});const s=new kt(n,this.context);return t!==void 0?s.filter(t):s}static getComputedStyle(t,e,n){let r;const s=t.style.getPropertyPriority(e);return"getComputedStyle"in window?(r=getComputedStyle.call(window,t,n),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 n=this.nodes[0].style;if(typeof t=="string"){const r=n.getPropertyPriority(t);return n.getPropertyValue(t)+(r?"!"+r:"")}else return Object.fromEntries(this.nodes[0].style.cssText.split(";").filter(r=>!!r).map(r=>r.split(":").map(s=>s.trim())))}else{let n={};return typeof t=="string"&&e!==void 0?n[t]=e:typeof t=="object"&&(n=t),this.nodes.forEach(r=>{Object.keys(n).forEach(s=>{const a=String(n[s]).toLowerCase().includes("!important")?"important":"";r.style.setProperty(s,String(n[s]).replace(/!important/i,""),a)})}),this}}addClass(t){return this.toggleClass(t,!0)}removeClass(t){return this.toggleClass(t,!1)}toggleClass(t,e){const n=t.split(/[,\s]+/);return this.nodes.forEach(r=>{n.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 n=!1;return this.nodes.forEach(r=>{n=n||e.every(s=>Array.from(r.classList??[]).includes(s.trim()))}),n}attr(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0].getAttribute(t);let n={};return typeof t=="object"?n=t:e!==void 0&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}removeAttr(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{n.removeAttribute(r)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0][t];{let n={};return typeof t=="object"?n=t:typeof t=="string"&&e!==void 0&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{const o=kt._fixProp(s);r[o]=a,o=="innerHTML"&&kt._scriptConvert(r)})}),this}}removeProp(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{delete n[kt._fixProp(r)]})}),this}changeSelected(t){this.nodes.forEach(e=>{if(e instanceof HTMLSelectElement){const n=e.options;for(let r=0,s=n.length;r<s;r++)n[r].value==t?n[r].selected=!0:n[r].selected=!1}})}changeChecked(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 n=Object.assign({},this.nodes[0].dataset);return Object.keys(n).forEach(r=>{if(n[r]?.startsWith("[")||n[r]?.startsWith("{"))try{n[r]=JSON.parse(n[r]??"")}catch{}}),typeof t=="string"?n[t]:n}else{let n={};return typeof t=="object"?n=t:typeof t=="string"&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).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(n=>{e.forEach(r=>{delete n.dataset[r]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.nodes.forEach(e=>{const n=e.style.display,r=getComputedStyle(e).display,s=n=="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=a}!s&&(t==null||t===!1)&&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 Jn{isMacOS=Ol();constructor(){}capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}getFormatKeys(t){const e=[];return t.ctrl&&e.push(this.isMacOS?"Cmd":"Ctrl"),t.shift&&e.push(this.isMacOS?"Option":"Shift"),t.alt&&e.push("Alt"),typeof t.key=="string"?e.push(this.capitalize(t.key)):Array.isArray(t.key)&&(t.key.map(n=>this.capitalize(n)),e.push(...t.key)),e}matchKeyScheme(t,e){const n=t.ctrl??!1,r=t.shift??!1,s=t.alt??!1;if(t.exact)return(n===e.metaKey||n===e.ctrlKey)&&r===e.shiftKey&&s===e.altKey;const a=[];return n&&a.push(n===e.metaKey||n===e.ctrlKey),r&&a.push(r===e.shiftKey),s&&a.push(s===e.altKey),a.every(o=>o)}on(t,e){const n=t?.target??window;if(t?.key===void 0||t?.key===null)return e;const r=this.getFormatKeys(t);let s=!1;const a=o=>{if(o.stopPropagation(),!s&&o.key!=="Control"&&o.key!=="Shift"&&o.key!=="Alt"&&r.find(h=>h.toLowerCase()===o.key.toLowerCase())&&this.matchKeyScheme(t,o)){o.preventDefault();const h=e();if(typeof h!="function")return;const l=c=>{c.preventDefault(),h(),n.removeEventListener("keyup",l)};n.addEventListener("keyup",l)}};return n.addEventListener("keydown",a),e.keys=r,e.title=t?.title??"",e.pause=()=>s=!0,e.unpause=()=>s=!1,e.removeListener=()=>n.removeEventListener("keydown",a),e}static getKeyCode(t){const e=t.code||(t.keyCode||t.charCode).toString();return{code:e,key:t.key.toLowerCase()||Jn.codeKeys[e]}}static codeKeys={8:"backspace",9:"tab",13:"enter",15:"command",16:"shift",17:"ctrl",18:"alt",19:"pause_break",20:"caps_lock",21:"numpad",27:"escape",32:"spacebar",33:"page_up",34:"page_down",35:"end",36:"home",37:"left_arrow",38:"up_arrow",39:"right_arrow",40:"down_arrow",45:"insert",46:"delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",91:"left_window_key",92:"right_window_key",93:"select_key",96:"numpad_0",97:"numpad_1",98:"numpad_2",99:"numpad_3",100:"numpad_4",101:"numpad_5",102:"numpad_6",103:"numpad_7",104:"numpad_8",105:"numpad_9",106:"multiply",107:"add",109:"subtract",110:"decimal_point",111:"divide",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",124:"f13",125:"f14",126:"f15",144:"num_lock",145:"scroll_lock",186:"semi_colon",187:"equal_sign",188:"comma",189:"dash",190:"period",191:"forward_slash",192:"grave_accent",219:"open_bracket",220:"back_slash",221:"close_braket",222:"single_quote"}}class Js{static captureMouse(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{e.isMouseDown=!0,document.addEventListener("mouseup",r,!1),t.style.userSelect="none",t.style.webkitUserSelect=""},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1,document.removeEventListener("mouseup",r,!1),t.style.userSelect="",t.style.webkitUserSelect=""},s=a=>{const o=Zn(t,a);e.x=o.x,e.y=o.y};return t.addEventListener("mousedown",n,!1),document.addEventListener("mousemove",s,!1),e}static captureTouch(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{a.preventDefault(),e.isMouseDown=!0},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1},s=a=>{const o=a.changedTouches[0],h=Zn(t,o);e.x=h.x,e.y=h.y};return t.addEventListener("touchstart",n,!1),t.addEventListener("touchend",r,!1),t.addEventListener("touchcancel",r,!1),t.addEventListener("touchmove",s,!1),e}static capturePointer(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{e.isMouseDown=!0,t.setPointerCapture(a.pointerId),t.style.userSelect="none",t.style.webkitUserSelect=""},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1,t.style.userSelect="",t.style.webkitUserSelect=""},s=a=>{const o=Zn(t,a);e.x=o.x,e.y=o.y};return t.addEventListener("pointerdown",n,!1),t.addEventListener("pointerup",r,!1),t.addEventListener("pointercancel",r,!1),t.addEventListener("pointermove",s,!1),e}}function Qs(i,t){if(typeof t<"u")window.localStorage.setItem(i,t);else return window.localStorage.getItem(i)??void 0}function e1(i,t,e){const n=new Date;n.setTime(n.getTime()+e*24*60*60*1e3);const r="expires="+n.toUTCString();document.cookie=i+"="+t+"; "+r}function i1(i){const t=i+"=",e=document.cookie.split(";");for(let n=0,r=e.length;n<r;n++){const s=e[n].trim();if(s.indexOf(t)==0)return s.substring(t.length,s.length)}return""}const n1=()=>document.cookie.split(";").map(i=>i.split("=")).reduce((i,[t,e])=>(i[t.trim().replace('"',"")]=e,i),{}),r1=()=>document.cookie.split(";").forEach(i=>document.cookie=i.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`));class s1{static theme(t){return t=t||Qs("theme"),typeof t>"u"&&(t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Qs("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 a1{static addEventListener(t,e,n){t.addEventListener(e,n,!1)}static removeEventListener(t,e,n){t.removeEventListener(e,n,!1)}static getTarget(t){return t.target||t.srcElement}}class o1{static setPageVerticalScrollPercent(t,e="width"){const n=Bl(t);n.css("transition","all linear 30ms");const{clientHeight:r}=Kn(),{scrollTop:s,scrollHeight:a}=pi(),o=a-r,h=o<=0?0:s/o*100;n.css(e,h+"%")}static pullDownRefresh(t,e,n=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<n&&(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>=n&&e()},!1)}static pullUpLoading(t,e=50){const{clientHeight:n}=Kn(),{scrollTop:r,scrollHeight:s}=pi();r+n>=s-e&&t()}}class ot{static version=.8;constructor(t,e){this.context=e??document;let n=[];if(Array.isArray(t))n=t;else if(t instanceof Node||t instanceof Window)n=[t];else if(t instanceof ot)n=t.nodes;else if(typeof t=="string"){if(typeof this.context.querySelector!="function")throw new Error("Invalid context");n=Array.from(this.context.querySelectorAll(t))}else if(t==null)n=[];else{let r=Array.from(t??[]);if(typeof t=="object"&&Array.isArray(r))n=r;else throw new Error(`Invalid selector "${t}"`)}this.nodes=n,this.length=n.length,this.each((r,s)=>{this[s]=r})}static _fragment(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childNodes.forEach(n=>{let r=ot._scriptConvert(n);r!=n&&e.content.replaceChild(r,n)}),e.content}static _scriptConvert(t){let e=n=>{let s=n.ownerDocument.createElement("script");s.text=n.text;let a=n.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(n=>{n.parentNode.replaceChild(e(n),n)}),t}static _fixProp(t){let 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}_insert(t,e){let n=[],r=this.length;if(r<1)return;let s=this;if(typeof e=="string")this.each(a=>{let o=ot._fragment(e);n.push(...o.childNodes),a[t](o)});else if(e instanceof ot){let a=r==1;e.each(o=>{this.each(h=>{let l=a?o:o.cloneNode(!0);n.push(l),h[t](l),ot._scriptConvert(l)})}),a||e.remove()}else if(e instanceof Node)this.each(a=>{let o=r===1?e:ot._fragment(e.outerHTML);n.push(...r===1?[e]:o.childNodes),a[t](o)}),r>1&&e.remove();else throw new Error(`Incorrect argument for "${t}(html)". It expects one string argument.`);return t=="replaceWith"&&(s=new ot(n,this.context)),s}_save(t,e,n){t._mQuery=t._mQuery??{},Array.isArray(n)?(t._mQuery[e]=t._mQuery[e]??[],t._mQuery[e].push(...n)):n!=null?t._mQuery[e]=n:delete t._mQuery[e]}get(t){t<0&&(t=this.length+t);let e=this[t];return e||(t!=null?null:this.nodes)}eq(t){t<0&&(t=this.length+t);let e=[this[t]];return e[0]==null&&(e=[]),new ot(e,this.context)}then(t){let e=t(this);return e??this}find(t){let e=[];return this.each(n=>{let r=Array.from(n.querySelectorAll(t));r.length>0&&e.push(...r)}),new ot(e,this.context)}filter(t){let e=[];return this.each(n=>{(n===t||typeof t=="string"&&n.matches&&n.matches(t)||typeof t=="function"&&t(n))&&e.push(n)}),new ot(e,this.context)}next(){let t=[];return this.each(e=>{let n=e.nextElementSibling;n&&t.push(n)}),new ot(t,this.context)}prev(){let t=[];return this.each(e=>{let n=e.previousElementSibling;n&&t.push(n)}),new ot(t,this.context)}shadow(t){let e=[];this.each(r=>{r.shadowRoot&&e.push(r.shadowRoot)});let n=new ot(e,this.context);return t?n.find(t):n}closest(t){let e=[];return this.each(n=>{let r=n.closest(t);r&&e.push(r)}),new ot(e,this.context)}host(t){let e=[],n=s=>s.parentNode?n(s.parentNode):s,r=s=>{let a=n(s);e.push(a.host?a.host:a),a.host&&t&&r(a.host)};return this.each(s=>{r(s)}),new ot(e,this.context)}parent(t){return this.parents(t,!0)}parents(t,e){let n=[],r=a=>{if(n.indexOf(a)==-1&&n.push(a),!e&&a.parentNode)return r(a.parentNode)};this.each(a=>{a.parentNode&&r(a.parentNode)});let s=new ot(n,this.context);return t?s.filter(t):s}add(t){let e=t instanceof ot?t.nodes:Array.isArray(t)?t:[t];return new ot(this.nodes.concat(e),this.context)}each(t){return this.nodes.forEach((e,n)=>{t(e,n,this)}),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.each(t=>{t.remove()}),this}css(t,e){let n=t,r=arguments.length;if(r===0||r===1&&typeof t=="string")if(this[0]){let s=this[0].style;if(typeof t=="string"){let a=s.getPropertyPriority(t);return s.getPropertyValue(t)+(a?"!"+a:"")}else return Object.fromEntries(this[0].style.cssText.split(";").filter(a=>!!a).map(a=>a.split(":").map(o=>o.trim())))}else return;else return typeof t!="object"&&(n={},n[t]=e),this.each((s,a)=>{Object.keys(n).forEach(o=>{let h=String(n[o]).toLowerCase().includes("!important")?"important":"";s.style.setProperty(o,String(n[o]).replace(/!important/i,""),h)})}),this}addClass(t){return this.toggleClass(t,!0),this}removeClass(t){return this.toggleClass(t,!1),this}toggleClass(t,e){return typeof t=="string"&&(t=t.split(/[,\s]+/)),this.each(n=>{let r=t;r==null&&e===!1&&(r=Array.from(n.classList)),r.forEach(s=>{if(s!==""){let a="toggle";e!=null&&(a=e?"add":"remove"),n.classList[a](s)}})}),this}hasClass(t){if(typeof t=="string"&&(t=t.split(/[,\s]+/)),t==null&&this.length>0)return Array.from(this[0].classList);let e=!1;return this.each(n=>{e=e||t.every(r=>Array.from(n.classList??[]).includes(r))}),e}on(t,e,n){typeof e=="function"&&(n=e,e=void 0);let r;return e?.delegate&&(r=e.delegate,delete e.delegate),t=t.split(/[,\s]+/),t.forEach(s=>{let[a,o]=String(s).toLowerCase().split(".");if(r){let h=n;n=l=>{let c=vt(l.target).parents(r);c.length>0?l.delegate=c[0]:l.delegate=l.target,(l.target.matches(r)||c.length>0)&&h(l)}}this.each(h=>{this._save(h,"events",[{event:a,scope:o,callback:n,options:e}]),h.addEventListener(a,n,e)})}),this}off(t,e,n){return typeof e=="function"&&(n=e,e=void 0),t=(t??"").split(/[,\s]+/),t.forEach(r=>{let[s,a]=String(r).toLowerCase().split(".");this.each(o=>{if(Array.isArray(o._mQuery?.events))for(let h=o._mQuery.events.length-1;h>=0;h--){let l=o._mQuery.events[h];a==null||a===""?(l.event==s||s==="")&&(l.callback==n||n==null)&&(o.removeEventListener(l.event,l.callback,l.options),o._mQuery.events.splice(h,1)):(l.event==s||s==="")&&l.scope==a&&(o.removeEventListener(l.event,l.callback,l.options),o._mQuery.events.splice(h,1))}})}),this}trigger(t,e){let n,r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return t instanceof Event||t instanceof CustomEvent?n=t:r.includes(t)?n=new MouseEvent(t,e):s.includes(t)?n=new KeyboardEvent(t,e):n=new Event(t,e),this.each(a=>{a.dispatchEvent(n)}),this}attr(t,e){if(e===void 0&&typeof t=="string")return this[0]?this[0].getAttribute(t):void 0;{let n={};return typeof t=="object"?n=t:n[t]=e,this.each(r=>{Object.entries(n).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}}removeAttr(){return this.each(t=>{Array.from(arguments).forEach(e=>{t.removeAttribute(e)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this[0]?this[0][t]:void 0;{let n={};return typeof t=="object"?n=t:n[t]=e,this.each(r=>{Object.entries(n).forEach(([s,a])=>{let o=ot._fixProp(s);r[o]=a,o=="innerHTML"&&ot._scriptConvert(r)})}),this}}removeProp(){return this.each(t=>{Array.from(arguments).forEach(e=>{delete t[ot._fixProp(e)]})}),this}data(t,e){if(t instanceof Object){Object.entries(t).forEach(n=>{this.data(n[0],n[1])});return}if(t&&t.indexOf("-")!=-1&&console.error(`Key "${t}" contains "-" (dash). Dashes are not allowed in property names. Use camelCase instead.`),arguments.length<2)if(this[0]){let n=Object.assign({},this[0].dataset);return Object.keys(n).forEach(r=>{if(n[r].startsWith("[")||n[r].startsWith("{"))try{n[r]=JSON.parse(n[r])}catch{}}),t?n[t]:n}else return;else return this.each(n=>{e!=null?n.dataset[t]=e instanceof Object?JSON.stringify(e):e:delete n.dataset[t]}),this}removeData(t){return typeof t=="string"&&(t=t.split(/[,\s]+/)),this.each(e=>{t.forEach(n=>{delete e.dataset[n]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.each(e=>{let n=e.style.display,r=getComputedStyle(e).display,s=n=="none"||r=="none";if(s&&(t==null||t===!0)){let a=e instanceof HTMLTableRowElement?"table-row":e instanceof HTMLTableCellElement?"table-cell":"block";e.style.display=e._mQuery?.prevDisplay??(n==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):this.prop("innerHTML",t)}text(t){return this.prop("textContent",t)}val(t){return this.prop("value",t)}change(){return this.trigger("change")}click(){return this.trigger("click")}}let vt=function(i,t){return new ot(i,t)};vt.html=i=>{let t=ot._fragment(i);return vt(t.children,t)},vt.version=ot.version,function(){let i=0;window.requestAnimationFrame||(window.requestAnimationFrame=function(t){const e=new Date().getTime(),n=Math.max(0,16-(e-i)),r=window.setTimeout(function(){t(e+n)},n);return i=e+n,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}();const zl=i=>{function t(e){const n=window.requestAnimationFrame(t);i(e,n)}window.requestAnimationFrame(t)},l1=(i,t)=>{const n=document.getElementById(i).getContext("2d");zl((r,s)=>{t(n,r,s)})};function h1(i,t,e,n,r=.5,s="ease"){return new Promise(a=>{const o=getComputedStyle(i),h=parseInt(o.width),l=parseInt(o.height);if(!i||!t){console.log("ERROR: Cannot do transition when one of the divs is null");return}switch(i.parentElement&&(i.parentElement.style.cssText+="; perspective: 900px; overflow: hidden;"),i.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",t.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",e){case"slide-left":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d("+h+"px, 0, 0)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(-"+h+"px, 0, 0)"},1);break;case"slide-right":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(-"+h+"px, 0, 0)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0px, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d("+h+"px, 0, 0)"},1);break;case"slide-down":i.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, "+l+"px, 0)"},1);break;case"slide-up":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, "+l+"px, 0)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":i.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(180deg)"},1);break;case"flip-right":i.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(180deg)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(-180deg)"},1);break;case"flip-down":i.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(180deg)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(-180deg)"},1);break;case"flip-up":i.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(180deg)"},1);break;case"pop-in":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: scale(1); opacity: 1;",i.style.cssText+="transition: "+r+"s "+s+";"},1);break;case"pop-out":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; opacity: 1;",i.style.cssText+="transition: "+r+"s "+s+"; transform: scale(1.7); opacity: 0;"},1);break;default:i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",vt(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; opacity: 1;",i.style.cssText+="transition: "+r+"s "+s},1);break}setTimeout(()=>{if(e==="slide-down"&&(vt(i).css("z-index","1019"),vt(t).css("z-index","1020")),t){const c=vt(t);c?.css({opacity:"1"}),c?.css({transition:"",transform:""})}if(i){const c=vt(i);c?.css({opacity:"1"}),c?.css({transition:"",transform:""})}typeof n=="function"&&n(),a()},r*1e3)})}var Hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jl(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Vl={exports:{}};(function(i){var t={};i.exports=t,t.parse=function(e,n){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 g=s(o,l);l+=4;var p=r(o,l),_=r(o,l+2),y=r(o,l+4);l+=6,l+=8;var b=s(o,l);l+=4,l+=p+_+y,t._readLocal(o,b,a,d,g,n)}return a},t._readLocal=function(e,n,r,s,a,o){var h=t.bin.readUshort,l=t.bin.readUint;l(e,n),n+=4,h(e,n),n+=2,h(e,n),n+=2;var c=h(e,n);n+=2,l(e,n),n+=4,l(e,n),n+=4,n+=8;var d=h(e,n);n+=2;var f=h(e,n);n+=2;var u=t.bin.readUTF8(e,n,d);if(n+=d,n+=f,o){r[u]={size:a,csize:s};return}var g=new Uint8Array(e.buffer,n);if(c==0)r[u]=new Uint8Array(g.buffer.slice(n,n+s));else if(c==8){var p=new Uint8Array(a);t.inflateRaw(g,p),r[u]=p}else throw"unknown compression method: "+c},t.inflateRaw=function(e,n){return t.F.inflate(e,n)},t.inflate=function(e,n){return e[0],e[1],t.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),n)},t.deflate=function(e,n){n==null&&(n={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,n.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,n){n==null&&(n={level:6});var r=new Uint8Array(50+Math.floor(e.length*1.1)),s=t.F.deflateRaw(e,r,s,n.level);return new Uint8Array(r.buffer,0,s)},t.encode=function(e,n){n==null&&(n=!1);var r=0,s=t.bin.writeUint,a=t.bin.writeUshort,o={};for(var h in e){var l=!t._noNeed(h)&&!n,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,g=[];for(var h in o){var p=o[h];g.push(u),u=t._writeHeader(f,u,h,p,0)}var _=0,y=u;for(var h in o){var p=o[h];g.push(u),u=t._writeHeader(f,u,h,p,1,g[_++])}var b=u-y;return s(f,u,101010256),u+=4,u+=4,a(f,u,_),u+=2,a(f,u,_),u+=2,s(f,u,b),u+=4,s(f,u,y),u+=4,u+=2,f.buffer},t._noNeed=function(e){var n=e.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(n)!=-1},t._writeHeader=function(e,n,r,s,a,o){var h=t.bin.writeUint,l=t.bin.writeUshort,c=s.file;h(e,n,a==0?67324752:33639248),n+=4,a==1&&(n+=2),l(e,n,20),n+=2,l(e,n,0),n+=2,l(e,n,s.cpr?8:0),n+=2,h(e,n,0),n+=4,h(e,n,s.crc),n+=4,h(e,n,c.length),n+=4,h(e,n,s.usize),n+=4,l(e,n,t.bin.sizeUTF8(r)),n+=2,l(e,n,0),n+=2,a==1&&(n+=2,n+=2,n+=6,h(e,n,o),n+=4);var d=t.bin.writeUTF8(e,n,r);return n+=d,a==0&&(e.set(c,n),n+=c.length),n},t.crc={table:function(){for(var e=new Uint32Array(256),n=0;n<256;n++){for(var r=n,s=0;s<8;s++)r&1?r=3988292384^r>>>1:r=r>>>1;e[n]=r}return e}(),update:function(e,n,r,s){for(var a=0;a<s;a++)e=t.crc.table[(e^n[r+a])&255]^e>>>8;return e},crc:function(e,n,r){return t.crc.update(4294967295,e,n,r)^4294967295}},t.adler=function(e,n,r){for(var s=1,a=0,o=n,h=n+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,n){return e[n]|e[n+1]<<8},writeUshort:function(e,n,r){e[n]=r&255,e[n+1]=r>>8&255},readUint:function(e,n){return e[n+3]*(256*256*256)+(e[n+2]<<16|e[n+1]<<8|e[n])},writeUint:function(e,n,r){e[n]=r&255,e[n+1]=r>>8&255,e[n+2]=r>>16&255,e[n+3]=r>>24&255},readASCII:function(e,n,r){for(var s="",a=0;a<r;a++)s+=String.fromCharCode(e[n+a]);return s},writeASCII:function(e,n,r){for(var s=0;s<r.length;s++)e[n+s]=r.charCodeAt(s)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,n,r){for(var s="",a,o=0;o<r;o++)s+="%"+t.bin.pad(e[n+o].toString(16));try{a=decodeURIComponent(s)}catch{return t.bin.readASCII(e,n,r)}return a},writeUTF8:function(e,n,r){for(var s=r.length,a=0,o=0;o<s;o++){var h=r.charCodeAt(o);if(!(h&4294967295-128+1))e[n+a]=h,a++;else if(!(h&4294967295-2048+1))e[n+a]=192|h>>6,e[n+a+1]=128|h>>0&63,a+=2;else if(!(h&4294967295-65536+1))e[n+a]=224|h>>12,e[n+a+1]=128|h>>6&63,e[n+a+2]=128|h>>0&63,a+=3;else if(!(h&4294967295-(1<<21)+1))e[n+a]=240|h>>18,e[n+a+1]=128|h>>12&63,e[n+a+2]=128|h>>6&63,e[n+a+3]=128|h>>0&63,a+=4;else throw"e"}return a},sizeUTF8:function(e){for(var n=e.length,r=0,s=0;s<n;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,n,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,g=e.length;if(s==0){for(;d<g;){var p=Math.min(65535,g-d);c(n,f,d+p==g?1:0),f=t.F._copyExact(e,d,p,n,f+8),d+=p}return f>>>3}var _=h.lits,y=h.strt,b=h.prev,m=0,v=0,w=0,S=0,k=0,C=0;for(g>2&&(C=t.F._hash(e,0),y[C]=0),d=0;d<g;d++){if(k=C,d+1<g-2){C=t.F._hash(e,d+1);var A=d+1&32767;b[A]=y[C],y[C]=A}if(u<=d){(m>14e3||v>26697)&&g-d>100&&(u<d&&(_[m]=d-u,m+=2,u=d),f=t.F._writeBlock(d==g-1||u==g?1:0,_,m,S,e,w,d-w,n,f),m=v=S=0,w=d);var x=0;d<g-2&&(x=t.F._bestMatch(e,d,b,k,Math.min(o[2],g-d),o[3]));var p=x>>>16,T=x&65535;if(x!=0){var p=x>>>16,T=x&65535,M=l(p,h.of0);h.lhst[257+M]++;var D=l(T,h.df0);h.dhst[D]++,S+=h.exb[M]+h.dxb[D],_[m]=p<<23|d-u,_[m+1]=T<<16|M<<8|D,m+=2,u=d+p}else h.lhst[e[d]]++;v++}}for((w!=d||e.length==0)&&(u<d&&(_[m]=d-u,m+=2,u=d),f=t.F._writeBlock(1,_,m,S,e,w,d-w,n,f),m=0,v=0,m=v=S=0,w=d);f&7;)f++;return f>>>3},t.F._bestMatch=function(e,n,r,s,a,o){var h=n&32767,l=r[h],c=h-l+32768&32767;if(l==h||s!=t.F._hash(e,n-c))return 0;for(var d=0,f=0,u=Math.min(32767,n);c<=u&&--o!=0&&l!=h;){if(d==0||e[n+d]==e[n+d-c]){var g=t.F._howLong(e,n,c);if(g>d){if(d=g,f=c,d>=a)break;c+2<g&&(g=c+2);for(var p=0,_=0;_<g-2;_++){var y=n-c+_+32768&32767,b=r[y],m=y-b+32768&32767;m>p&&(p=m,l=y)}}}h=l,l=r[h],c+=h-l+32768&32767}return d<<16|f},t.F._howLong=function(e,n,r){if(e[n]!=e[n-r]||e[n+1]!=e[n+1-r]||e[n+2]!=e[n+2-r])return 0;var s=n,a=Math.min(e.length,n+258);for(n+=3;n<a&&e[n]==e[n-r];)n++;return n-s},t.F._hash=function(e,n){return(e[n]<<8|e[n+1])+(e[n+2]<<4)&65535},t.saved=0,t.F._writeBlock=function(e,n,r,s,a,o,h,l,c){var d=t.F.U,f=t.F._putsF,u=t.F._putsE,g,p,_,y,b,m,v,w,S;d.lhst[256]++,g=t.F.getTrees(),p=g[0],_=g[1],y=g[2],b=g[3],m=g[4],v=g[5],w=g[6],S=g[7];var k=(c+3&7?8-(c+3&7):0)+32+(h<<3),C=s+t.F.contSize(d.fltree,d.lhst)+t.F.contSize(d.fdtree,d.dhst),A=s+t.F.contSize(d.ltree,d.lhst)+t.F.contSize(d.dtree,d.dhst);A+=14+3*v+t.F.contSize(d.itree,d.ihst)+(d.ihst[16]*2+d.ihst[17]*3+d.ihst[18]*7);for(var x=0;x<286;x++)d.lhst[x]=0;for(var x=0;x<30;x++)d.dhst[x]=0;for(var x=0;x<19;x++)d.ihst[x]=0;var T=k<C&&k<A?0:C<A?1:2;if(f(l,c,e),f(l,c+1,T),c+=3,T==0){for(;c&7;)c++;c=t.F._copyExact(a,o,h,l,c)}else{var M,D;if(T==1&&(M=d.fltree,D=d.fdtree),T==2){t.F.makeCodes(d.ltree,p),t.F.revCodes(d.ltree,p),t.F.makeCodes(d.dtree,_),t.F.revCodes(d.dtree,_),t.F.makeCodes(d.itree,y),t.F.revCodes(d.itree,y),M=d.ltree,D=d.dtree,u(l,c,b-257),c+=5,u(l,c,m-1),c+=5,u(l,c,v-4),c+=4;for(var O=0;O<v;O++)u(l,c+O*3,d.itree[(d.ordr[O]<<1)+1]);c+=3*v,c=t.F._codeTiny(w,d.itree,l,c),c=t.F._codeTiny(S,d.itree,l,c)}for(var I=o,H=0;H<r;H+=2){for(var j=n[H],$=j>>>23,et=I+(j&(1<<23)-1);I<et;)c=t.F._writeLit(a[I++],M,l,c);if($!=0){var G=n[H+1],z=G>>16,W=G>>8&255,J=G&255;c=t.F._writeLit(257+W,M,l,c),u(l,c,$-d.of0[W]),c+=d.exb[W],c=t.F._writeLit(J,D,l,c),f(l,c,z-d.df0[J]),c+=d.dxb[J],I+=$}}c=t.F._writeLit(256,M,l,c)}return c},t.F._copyExact=function(e,n,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,n,r),o),a+(r+4<<3)},t.F.getTrees=function(){for(var e=t.F.U,n=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[n,r,c,a,h,d,s,o]},t.F.getSecond=function(e){for(var n=[],r=0;r<e.length;r+=2)n.push(e[r+1]);return n},t.F.nonZero=function(e){for(var n="",r=0;r<e.length;r+=2)e[r+1]!=0&&(n+=(r>>1)+",");return n},t.F.contSize=function(e,n){for(var r=0,s=0;s<n.length;s++)r+=n[s]*e[(s<<1)+1];return r},t.F._codeTiny=function(e,n,r,s){for(var a=0;a<e.length;a+=2){var o=e[a],h=e[a+1];s=t.F._writeLit(o,n,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,n){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?n.push(17,d-3):n.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);n.push(16,d-3),s+=d*2-2}else n.push(a,0)}return r>>>1},t.F._hufTree=function(e,n,r){var s=[],a=e.length,o=n.length,h=0;for(h=0;h<o;h+=2)n[h]=0,n[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 n[(d<<1)+1]=1,n[(c<<1)+1]=1,1}s.sort(function(b,m){return b.f-m.f});var f=s[0],u=s[1],g=0,p=1,_=2;for(s[0]={lit:-1,f:f.f+u.f,l:f,r:u,d:0};p!=l-1;)g!=p&&(_==l||s[g].f<s[_].f)?f=s[g++]:f=s[_++],g!=p&&(_==l||s[g].f<s[_].f)?u=s[g++]:u=s[_++],s[p++]={lit:-1,f:f.f+u.f,l:f,r:u};var y=t.F.setDepth(s[p-1],0);for(y>r&&(t.F.restrictDepth(c,r,y),y=r),h=0;h<l;h++)n[(c[h].lit<<1)+1]=c[h].d;return y},t.F.setDepth=function(e,n){return e.lit!=-1?(e.d=n,n):Math.max(t.F.setDepth(e.l,n+1),t.F.setDepth(e.r,n+1))},t.F.restrictDepth=function(e,n,r){var s=0,a=1<<r-n,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>n;s++){var h=e[s].d;e[s].d=n,o+=a-(1<<r-h)}for(o=o>>>r-n;o>0;){var h=e[s].d;h<n?(e[s].d++,o-=1<<n-h-1):s++}for(;s>=0;s--)e[s].d==n&&o<0&&(e[s].d--,o++);o!=0&&console.log("debt left")},t.F._goodIndex=function(e,n){var r=0;return n[r|16]<=e&&(r|=16),n[r|8]<=e&&(r|=8),n[r|4]<=e&&(r|=4),n[r|2]<=e&&(r|=2),n[r|1]<=e&&(r|=1),r},t.F._writeLit=function(e,n,r,s){return t.F._putsF(r,s,n[e<<1]),s+n[(e<<1)+1]},t.F.inflate=function(e,n){var r=Uint8Array;if(e[0]==3&&e[1]==0)return n||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=n==null;u&&(n=new r(e.length>>>2<<3));for(var g=0,p=0,_=0,y=0,b=0,m=0,v=0,w=0,S=0,k,C;g==0;){if(g=a(e,S,1),p=a(e,S+1,2),S+=3,p==0){S&7&&(S+=8-(S&7));var A=(S>>>3)+4,x=e[A-4]|e[A-3]<<8;u&&(n=t.F._check(n,w+x)),n.set(new r(e.buffer,e.byteOffset+A,x),w),S=A+x<<3,w+=x;continue}if(u&&(n=t.F._check(n,w+(1<<17))),p==1&&(k=f.flmap,C=f.fdmap,m=512-1,v=32-1),p==2){_=o(e,S,5)+257,y=o(e,S+5,5)+1,b=o(e,S+10,4)+4,S+=14;for(var T=0;T<38;T+=2)f.itree[T]=0,f.itree[T+1]=0;for(var M=1,T=0;T<b;T++){var D=o(e,S+T*3,3);f.itree[(f.ordr[T]<<1)+1]=D,D>M&&(M=D)}S+=3*b,l(f.itree,M),c(f.itree,M,f.imap),k=f.lmap,C=f.dmap,S=h(f.imap,(1<<M)-1,_+y,e,S,f.ttree);var O=s._copyOut(f.ttree,0,_,f.ltree);m=(1<<O)-1;var I=s._copyOut(f.ttree,_,y,f.dtree);v=(1<<I)-1,l(f.ltree,O),c(f.ltree,O,k),l(f.dtree,I),c(f.dtree,I,C)}for(;;){var H=k[d(e,S)&m];S+=H&15;var j=H>>>4;if(!(j>>>8))n[w++]=j;else{if(j==256)break;var $=w+j-254;if(j>264){var et=f.ldef[j-257];$=w+(et>>>3)+o(e,S,et&7),S+=et&7}var G=C[d(e,S)&v];S+=G&15;var z=G>>>4,W=f.ddef[z],J=(W>>>4)+a(e,S,W&15);for(S+=W&15,u&&(n=t.F._check(n,w+(1<<17)));w<$;)n[w]=n[w++-J],n[w]=n[w++-J],n[w]=n[w++-J],n[w]=n[w++-J];w=$}}}return n.length==w?n:n.slice(0,w)},t.F._check=function(e,n){var r=e.length;if(n<=r)return e;var s=new Uint8Array(Math.max(r<<1,n));return s.set(e,0),s},t.F._decodeTiny=function(e,n,r,s,a,o){for(var h=t.F._bitsE,l=t.F._get17,c=0;c<r;){var d=e[l(s,a)&n];a+=d&15;var f=d>>>4;if(f<=15)o[c]=f,c++;else{var u=0,g=0;f==16?(g=3+h(s,a,2),a+=2,u=o[c-1]):f==17?(g=3+h(s,a,3),a+=3):f==18&&(g=11+h(s,a,7),a+=7);for(var p=c+g;c<p;)o[c]=u,c++}}return a},t.F._copyOut=function(e,n,r,s){for(var a=0,o=0,h=s.length>>>1;o<r;){var l=e[o+n];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,n){for(var r=t.F.U,s=e.length,a,o,h,l,c,d=r.bl_count,l=0;l<=n;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<=n;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,n,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=n-c,u=e[h]<<f,g=u+(1<<f);u!=g;){var p=o[u]>>>15-n;r[p]=d,u++}},t.F.revCodes=function(e,n){for(var r=t.F.U.rev15,s=15-n,a=0;a<e.length;a+=2){var o=e[a]<<n-e[a+1];e[a]=r[o]>>>s}},t.F._putsE=function(e,n,r){r=r<<(n&7);var s=n>>>3;e[s]|=r,e[s+1]|=r>>>8},t.F._putsF=function(e,n,r){r=r<<(n&7);var s=n>>>3;e[s]|=r,e[s+1]|=r>>>8,e[s+2]|=r>>>16},t.F._bitsE=function(e,n,r){return(e[n>>>3]|e[(n>>>3)+1]<<8)>>>(n&7)&(1<<r)-1},t.F._bitsF=function(e,n,r){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16)>>>(n&7)&(1<<r)-1},t.F._get17=function(e,n){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16)>>>(n&7)},t.F._get25=function(e,n){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16|e[(n>>>3)+3]<<24)>>>(n&7)},t.F.U=function(){var e=Uint16Array,n=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 n(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 n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new e(65536),prev:new e(32768)}}(),function(){for(var e=t.F.U,n=32768,r=0;r<n;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)}()})(Vl);var c1=Vl.exports;const $l=jl(c1);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const u1=4,Xl=0,Yl=1,d1=2;function mi(i){let t=i.length;for(;--t>=0;)i[t]=0}const f1=0,Wl=1,g1=2,p1=3,m1=258,ta=29,tn=256,en=tn+1+ta,_i=30,ea=19,ql=2*en+1,$e=15,ia=16,_1=7,na=256,Kl=16,Zl=17,Jl=18,ra=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]),Qn=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]),v1=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ql=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),y1=512,ae=new Array((en+2)*2);mi(ae);const nn=new Array(_i*2);mi(nn);const rn=new Array(y1);mi(rn);const sn=new Array(m1-p1+1);mi(sn);const sa=new Array(ta);mi(sa);const tr=new Array(_i);mi(tr);function aa(i,t,e,n,r){this.static_tree=i,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=r,this.has_stree=i&&i.length}let th,eh,ih;function oa(i,t){this.dyn_tree=i,this.max_code=0,this.stat_desc=t}const nh=i=>i<256?rn[i]:rn[256+(i>>>7)],an=(i,t)=>{i.pending_buf[i.pending++]=t&255,i.pending_buf[i.pending++]=t>>>8&255},Dt=(i,t,e)=>{i.bi_valid>ia-e?(i.bi_buf|=t<<i.bi_valid&65535,an(i,i.bi_buf),i.bi_buf=t>>ia-i.bi_valid,i.bi_valid+=e-ia):(i.bi_buf|=t<<i.bi_valid&65535,i.bi_valid+=e)},Kt=(i,t,e)=>{Dt(i,e[t*2],e[t*2+1])},rh=(i,t)=>{let e=0;do e|=i&1,i>>>=1,e<<=1;while(--t>0);return e>>>1},b1=i=>{i.bi_valid===16?(an(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},w1=(i,t)=>{const e=t.dyn_tree,n=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,g,p=0;for(f=0;f<=$e;f++)i.bl_count[f]=0;for(e[i.heap[i.heap_max]*2+1]=0,l=i.heap_max+1;l<ql;l++)c=i.heap[l],f=e[e[c*2+1]*2+1]+1,f>h&&(f=h,p++),e[c*2+1]=f,!(c>n)&&(i.bl_count[f]++,u=0,c>=o&&(u=a[c-o]),g=e[c*2],i.opt_len+=g*(f+u),s&&(i.static_len+=g*(r[c*2+1]+u)));if(p!==0){do{for(f=h-1;i.bl_count[f]===0;)f--;i.bl_count[f]--,i.bl_count[f+1]+=2,i.bl_count[h]--,p-=2}while(p>0);for(f=h;f!==0;f--)for(c=i.bl_count[f];c!==0;)d=i.heap[--l],!(d>n)&&(e[d*2+1]!==f&&(i.opt_len+=(f-e[d*2+1])*e[d*2],e[d*2+1]=f),c--)}},sh=(i,t,e)=>{const n=new Array($e+1);let r=0,s,a;for(s=1;s<=$e;s++)r=r+e[s-1]<<1,n[s]=r;for(a=0;a<=t;a++){let o=i[a*2+1];o!==0&&(i[a*2]=rh(n[o]++,o))}},S1=()=>{let i,t,e,n,r;const s=new Array($e+1);for(e=0,n=0;n<ta-1;n++)for(sa[n]=e,i=0;i<1<<ra[n];i++)sn[e++]=n;for(sn[e-1]=n,r=0,n=0;n<16;n++)for(tr[n]=r,i=0;i<1<<Qn[n];i++)rn[r++]=n;for(r>>=7;n<_i;n++)for(tr[n]=r<<7,i=0;i<1<<Qn[n]-7;i++)rn[256+r++]=n;for(t=0;t<=$e;t++)s[t]=0;for(i=0;i<=143;)ae[i*2+1]=8,i++,s[8]++;for(;i<=255;)ae[i*2+1]=9,i++,s[9]++;for(;i<=279;)ae[i*2+1]=7,i++,s[7]++;for(;i<=287;)ae[i*2+1]=8,i++,s[8]++;for(sh(ae,en+1,s),i=0;i<_i;i++)nn[i*2+1]=5,nn[i*2]=rh(i,5);th=new aa(ae,ra,tn+1,en,$e),eh=new aa(nn,Qn,0,_i,$e),ih=new aa(new Array(0),v1,0,ea,_1)},ah=i=>{let t;for(t=0;t<en;t++)i.dyn_ltree[t*2]=0;for(t=0;t<_i;t++)i.dyn_dtree[t*2]=0;for(t=0;t<ea;t++)i.bl_tree[t*2]=0;i.dyn_ltree[na*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},oh=i=>{i.bi_valid>8?an(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},lh=(i,t,e,n)=>{const r=t*2,s=e*2;return i[r]<i[s]||i[r]===i[s]&&n[t]<=n[e]},la=(i,t,e)=>{const n=i.heap[e];let r=e<<1;for(;r<=i.heap_len&&(r<i.heap_len&&lh(t,i.heap[r+1],i.heap[r],i.depth)&&r++,!lh(t,n,i.heap[r],i.depth));)i.heap[e]=i.heap[r],e=r,r<<=1;i.heap[e]=n},hh=(i,t,e)=>{let n,r,s=0,a,o;if(i.sym_next!==0)do n=i.pending_buf[i.sym_buf+s++]&255,n+=(i.pending_buf[i.sym_buf+s++]&255)<<8,r=i.pending_buf[i.sym_buf+s++],n===0?Kt(i,r,t):(a=sn[r],Kt(i,a+tn+1,t),o=ra[a],o!==0&&(r-=sa[a],Dt(i,r,o)),n--,a=nh(n),Kt(i,a,e),o=Qn[a],o!==0&&(n-=tr[a],Dt(i,n,o)));while(s<i.sym_next);Kt(i,na,t)},ha=(i,t)=>{const e=t.dyn_tree,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,h=-1,l;for(i.heap_len=0,i.heap_max=ql,a=0;a<s;a++)e[a*2]!==0?(i.heap[++i.heap_len]=h=a,i.depth[a]=0):e[a*2+1]=0;for(;i.heap_len<2;)l=i.heap[++i.heap_len]=h<2?++h:0,e[l*2]=1,i.depth[l]=0,i.opt_len--,r&&(i.static_len-=n[l*2+1]);for(t.max_code=h,a=i.heap_len>>1;a>=1;a--)la(i,e,a);l=s;do a=i.heap[1],i.heap[1]=i.heap[i.heap_len--],la(i,e,1),o=i.heap[1],i.heap[--i.heap_max]=a,i.heap[--i.heap_max]=o,e[l*2]=e[a*2]+e[o*2],i.depth[l]=(i.depth[a]>=i.depth[o]?i.depth[a]:i.depth[o])+1,e[a*2+1]=e[o*2+1]=l,i.heap[1]=l++,la(i,e,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],w1(i,t),sh(e,h,i.bl_count)},ch=(i,t,e)=>{let n,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,n=0;n<=e;n++)s=a,a=t[(n+1)*2+1],!(++o<h&&s===a)&&(o<l?i.bl_tree[s*2]+=o:s!==0?(s!==r&&i.bl_tree[s*2]++,i.bl_tree[Kl*2]++):o<=10?i.bl_tree[Zl*2]++:i.bl_tree[Jl*2]++,o=0,r=s,a===0?(h=138,l=3):s===a?(h=6,l=3):(h=7,l=4))},uh=(i,t,e)=>{let n,r=-1,s,a=t[0*2+1],o=0,h=7,l=4;for(a===0&&(h=138,l=3),n=0;n<=e;n++)if(s=a,a=t[(n+1)*2+1],!(++o<h&&s===a)){if(o<l)do Kt(i,s,i.bl_tree);while(--o!==0);else s!==0?(s!==r&&(Kt(i,s,i.bl_tree),o--),Kt(i,Kl,i.bl_tree),Dt(i,o-3,2)):o<=10?(Kt(i,Zl,i.bl_tree),Dt(i,o-3,3)):(Kt(i,Jl,i.bl_tree),Dt(i,o-11,7));o=0,r=s,a===0?(h=138,l=3):s===a?(h=6,l=3):(h=7,l=4)}},C1=i=>{let t;for(ch(i,i.dyn_ltree,i.l_desc.max_code),ch(i,i.dyn_dtree,i.d_desc.max_code),ha(i,i.bl_desc),t=ea-1;t>=3&&i.bl_tree[Ql[t]*2+1]===0;t--);return i.opt_len+=3*(t+1)+5+5+4,t},x1=(i,t,e,n)=>{let r;for(Dt(i,t-257,5),Dt(i,e-1,5),Dt(i,n-4,4),r=0;r<n;r++)Dt(i,i.bl_tree[Ql[r]*2+1],3);uh(i,i.dyn_ltree,t-1),uh(i,i.dyn_dtree,e-1)},T1=i=>{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&i.dyn_ltree[e*2]!==0)return Xl;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return Yl;for(e=32;e<tn;e++)if(i.dyn_ltree[e*2]!==0)return Yl;return Xl};let dh=!1;const E1=i=>{dh||(S1(),dh=!0),i.l_desc=new oa(i.dyn_ltree,th),i.d_desc=new oa(i.dyn_dtree,eh),i.bl_desc=new oa(i.bl_tree,ih),i.bi_buf=0,i.bi_valid=0,ah(i)},fh=(i,t,e,n)=>{Dt(i,(f1<<1)+(n?1:0),3),oh(i),an(i,e),an(i,~e),e&&i.pending_buf.set(i.window.subarray(t,t+e),i.pending),i.pending+=e},k1=i=>{Dt(i,Wl<<1,3),Kt(i,na,ae),b1(i)},A1=(i,t,e,n)=>{let r,s,a=0;i.level>0?(i.strm.data_type===d1&&(i.strm.data_type=T1(i)),ha(i,i.l_desc),ha(i,i.d_desc),a=C1(i),r=i.opt_len+3+7>>>3,s=i.static_len+3+7>>>3,s<=r&&(r=s)):r=s=e+5,e+4<=r&&t!==-1?fh(i,t,e,n):i.strategy===u1||s===r?(Dt(i,(Wl<<1)+(n?1:0),3),hh(i,ae,nn)):(Dt(i,(g1<<1)+(n?1:0),3),x1(i,i.l_desc.max_code+1,i.d_desc.max_code+1,a+1),hh(i,i.dyn_ltree,i.dyn_dtree)),ah(i),n&&oh(i)},P1=(i,t,e)=>(i.pending_buf[i.sym_buf+i.sym_next++]=t,i.pending_buf[i.sym_buf+i.sym_next++]=t>>8,i.pending_buf[i.sym_buf+i.sym_next++]=e,t===0?i.dyn_ltree[e*2]++:(i.matches++,t--,i.dyn_ltree[(sn[e]+tn+1)*2]++,i.dyn_dtree[nh(t)*2]++),i.sym_next===i.sym_end);var M1=E1,R1=fh,D1=A1,L1=P1,O1=k1,I1={_tr_init:M1,_tr_stored_block:R1,_tr_flush_block:D1,_tr_tally:L1,_tr_align:O1},on=(i,t,e,n)=>{let r=i&65535|0,s=i>>>16&65535|0,a=0;for(;e!==0;){a=e>2e3?2e3:e,e-=a;do r=r+t[n++]|0,s=s+r|0;while(--a);r%=65521,s%=65521}return r|s<<16|0};const F1=()=>{let i,t=[];for(var e=0;e<256;e++){i=e;for(var n=0;n<8;n++)i=i&1?3988292384^i>>>1:i>>>1;t[e]=i}return t},N1=new Uint32Array(F1());var Tt=(i,t,e,n)=>{const r=N1,s=n+e;i^=-1;for(let a=n;a<s;a++)i=i>>>8^r[(i^t[a])&255];return i^-1},Xe={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"},Ye={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:U1,_tr_stored_block:ca,_tr_flush_block:G1,_tr_tally:Te,_tr_align:B1}=I1,{Z_NO_FLUSH:Ee,Z_PARTIAL_FLUSH:z1,Z_FULL_FLUSH:H1,Z_FINISH:Gt,Z_BLOCK:gh,Z_OK:At,Z_STREAM_END:ph,Z_STREAM_ERROR:Zt,Z_DATA_ERROR:j1,Z_BUF_ERROR:ua,Z_DEFAULT_COMPRESSION:V1,Z_FILTERED:$1,Z_HUFFMAN_ONLY:er,Z_RLE:X1,Z_FIXED:Y1,Z_DEFAULT_STRATEGY:W1,Z_UNKNOWN:q1,Z_DEFLATED:ir}=Ye,K1=9,Z1=15,J1=8,Q1=29,da=256+1+Q1,tg=30,eg=19,ig=2*da+1,ng=15,K=3,ke=258,Jt=ke+K+1,rg=32,vi=42,fa=57,ga=69,pa=73,ma=91,_a=103,We=113,ln=666,Mt=1,yi=2,qe=3,bi=4,sg=3,Ke=(i,t)=>(i.msg=Xe[t],t),mh=i=>i*2-(i>4?9:0),Ae=i=>{let t=i.length;for(;--t>=0;)i[t]=0},ag=i=>{let t,e,n,r=i.w_size;t=i.hash_size,n=t;do e=i.head[--n],i.head[n]=e>=r?e-r:0;while(--t);t=r,n=t;do e=i.prev[--n],i.prev[n]=e>=r?e-r:0;while(--t)};let Pe=(i,t,e)=>(t<<i.hash_shift^e)&i.hash_mask;const Lt=i=>{const t=i.state;let e=t.pending;e>i.avail_out&&(e=i.avail_out),e!==0&&(i.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),i.next_out),i.next_out+=e,t.pending_out+=e,i.total_out+=e,i.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Ot=(i,t)=>{G1(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,t),i.block_start=i.strstart,Lt(i.strm)},tt=(i,t)=>{i.pending_buf[i.pending++]=t},hn=(i,t)=>{i.pending_buf[i.pending++]=t>>>8&255,i.pending_buf[i.pending++]=t&255},va=(i,t,e,n)=>{let r=i.avail_in;return r>n&&(r=n),r===0?0:(i.avail_in-=r,t.set(i.input.subarray(i.next_in,i.next_in+r),e),i.state.wrap===1?i.adler=on(i.adler,t,r,e):i.state.wrap===2&&(i.adler=Tt(i.adler,t,r,e)),i.next_in+=r,i.total_in+=r,r)},_h=(i,t)=>{let e=i.max_chain_length,n=i.strstart,r,s,a=i.prev_length,o=i.nice_match;const h=i.strstart>i.w_size-Jt?i.strstart-(i.w_size-Jt):0,l=i.window,c=i.w_mask,d=i.prev,f=i.strstart+ke;let u=l[n+a-1],g=l[n+a];i.prev_length>=i.good_match&&(e>>=2),o>i.lookahead&&(o=i.lookahead);do if(r=t,!(l[r+a]!==g||l[r+a-1]!==u||l[r]!==l[n]||l[++r]!==l[n+1])){n+=2,r++;do;while(l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&l[++n]===l[++r]&&n<f);if(s=ke-(f-n),n=f-ke,s>a){if(i.match_start=t,a=s,s>=o)break;u=l[n+a-1],g=l[n+a]}}while((t=d[t&c])>h&&--e!==0);return a<=i.lookahead?a:i.lookahead},wi=i=>{const t=i.w_size;let e,n,r;do{if(n=i.window_size-i.lookahead-i.strstart,i.strstart>=t+(t-Jt)&&(i.window.set(i.window.subarray(t,t+t-n),0),i.match_start-=t,i.strstart-=t,i.block_start-=t,i.insert>i.strstart&&(i.insert=i.strstart),ag(i),n+=t),i.strm.avail_in===0)break;if(e=va(i.strm,i.window,i.strstart+i.lookahead,n),i.lookahead+=e,i.lookahead+i.insert>=K)for(r=i.strstart-i.insert,i.ins_h=i.window[r],i.ins_h=Pe(i,i.ins_h,i.window[r+1]);i.insert&&(i.ins_h=Pe(i,i.ins_h,i.window[r+K-1]),i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,i.insert--,!(i.lookahead+i.insert<K)););}while(i.lookahead<Jt&&i.strm.avail_in!==0)},vh=(i,t)=>{let e=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,n,r,s,a=0,o=i.strm.avail_in;do{if(n=65535,s=i.bi_valid+42>>3,i.strm.avail_out<s||(s=i.strm.avail_out-s,r=i.strstart-i.block_start,n>r+i.strm.avail_in&&(n=r+i.strm.avail_in),n>s&&(n=s),n<e&&(n===0&&t!==Gt||t===Ee||n!==r+i.strm.avail_in)))break;a=t===Gt&&n===r+i.strm.avail_in?1:0,ca(i,0,0,a),i.pending_buf[i.pending-4]=n,i.pending_buf[i.pending-3]=n>>8,i.pending_buf[i.pending-2]=~n,i.pending_buf[i.pending-1]=~n>>8,Lt(i.strm),r&&(r>n&&(r=n),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+r),i.strm.next_out),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r,i.block_start+=r,n-=r),n&&(va(i.strm,i.strm.output,i.strm.next_out,n),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n)}while(a===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),a?bi:t!==Ee&&t!==Gt&&i.strm.avail_in===0&&i.strstart===i.block_start?yi:(s=i.window_size-i.strstart,i.strm.avail_in>s&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,s+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),s>i.strm.avail_in&&(s=i.strm.avail_in),s&&(va(i.strm,i.window,i.strstart,s),i.strstart+=s,i.insert+=s>i.w_size-i.insert?i.w_size-i.insert:s),i.high_water<i.strstart&&(i.high_water=i.strstart),s=i.bi_valid+42>>3,s=i.pending_buf_size-s>65535?65535:i.pending_buf_size-s,e=s>i.w_size?i.w_size:s,r=i.strstart-i.block_start,(r>=e||(r||t===Gt)&&t!==Ee&&i.strm.avail_in===0&&r<=s)&&(n=r>s?s:r,a=t===Gt&&i.strm.avail_in===0&&n===r?1:0,ca(i,i.block_start,n,a),i.block_start+=n,Lt(i.strm)),a?qe:Mt)},ya=(i,t)=>{let e,n;for(;;){if(i.lookahead<Jt){if(wi(i),i.lookahead<Jt&&t===Ee)return Mt;if(i.lookahead===0)break}if(e=0,i.lookahead>=K&&(i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+K-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),e!==0&&i.strstart-e<=i.w_size-Jt&&(i.match_length=_h(i,e)),i.match_length>=K)if(n=Te(i,i.strstart-i.match_start,i.match_length-K),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=K){i.match_length--;do i.strstart++,i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+K-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+1]);else n=Te(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(n&&(Ot(i,!1),i.strm.avail_out===0))return Mt}return i.insert=i.strstart<K-1?i.strstart:K-1,t===Gt?(Ot(i,!0),i.strm.avail_out===0?qe:bi):i.sym_next&&(Ot(i,!1),i.strm.avail_out===0)?Mt:yi},Si=(i,t)=>{let e,n,r;for(;;){if(i.lookahead<Jt){if(wi(i),i.lookahead<Jt&&t===Ee)return Mt;if(i.lookahead===0)break}if(e=0,i.lookahead>=K&&(i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+K-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=K-1,e!==0&&i.prev_length<i.max_lazy_match&&i.strstart-e<=i.w_size-Jt&&(i.match_length=_h(i,e),i.match_length<=5&&(i.strategy===$1||i.match_length===K&&i.strstart-i.match_start>4096)&&(i.match_length=K-1)),i.prev_length>=K&&i.match_length<=i.prev_length){r=i.strstart+i.lookahead-K,n=Te(i,i.strstart-1-i.prev_match,i.prev_length-K),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=r&&(i.ins_h=Pe(i,i.ins_h,i.window[i.strstart+K-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=K-1,i.strstart++,n&&(Ot(i,!1),i.strm.avail_out===0))return Mt}else if(i.match_available){if(n=Te(i,0,i.window[i.strstart-1]),n&&Ot(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return Mt}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(n=Te(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<K-1?i.strstart:K-1,t===Gt?(Ot(i,!0),i.strm.avail_out===0?qe:bi):i.sym_next&&(Ot(i,!1),i.strm.avail_out===0)?Mt:yi},og=(i,t)=>{let e,n,r,s;const a=i.window;for(;;){if(i.lookahead<=ke){if(wi(i),i.lookahead<=ke&&t===Ee)return Mt;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=K&&i.strstart>0&&(r=i.strstart-1,n=a[r],n===a[++r]&&n===a[++r]&&n===a[++r])){s=i.strstart+ke;do;while(n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&r<s);i.match_length=ke-(s-r),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=K?(e=Te(i,1,i.match_length-K),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(e=Te(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),e&&(Ot(i,!1),i.strm.avail_out===0))return Mt}return i.insert=0,t===Gt?(Ot(i,!0),i.strm.avail_out===0?qe:bi):i.sym_next&&(Ot(i,!1),i.strm.avail_out===0)?Mt:yi},lg=(i,t)=>{let e;for(;;){if(i.lookahead===0&&(wi(i),i.lookahead===0)){if(t===Ee)return Mt;break}if(i.match_length=0,e=Te(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,e&&(Ot(i,!1),i.strm.avail_out===0))return Mt}return i.insert=0,t===Gt?(Ot(i,!0),i.strm.avail_out===0?qe:bi):i.sym_next&&(Ot(i,!1),i.strm.avail_out===0)?Mt:yi};function Qt(i,t,e,n,r){this.good_length=i,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=r}const cn=[new Qt(0,0,0,0,vh),new Qt(4,4,8,4,ya),new Qt(4,5,16,8,ya),new Qt(4,6,32,32,ya),new Qt(4,4,16,16,Si),new Qt(8,16,32,32,Si),new Qt(8,16,128,128,Si),new Qt(8,32,128,256,Si),new Qt(32,128,258,1024,Si),new Qt(32,258,258,4096,Si)],hg=i=>{i.window_size=2*i.w_size,Ae(i.head),i.max_lazy_match=cn[i.level].max_lazy,i.good_match=cn[i.level].good_length,i.nice_match=cn[i.level].nice_length,i.max_chain_length=cn[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=K-1,i.match_available=0,i.ins_h=0};function cg(){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=ir,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(ig*2),this.dyn_dtree=new Uint16Array((2*tg+1)*2),this.bl_tree=new Uint16Array((2*eg+1)*2),Ae(this.dyn_ltree),Ae(this.dyn_dtree),Ae(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ng+1),this.heap=new Uint16Array(2*da+1),Ae(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*da+1),Ae(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 un=i=>{if(!i)return 1;const t=i.state;return!t||t.strm!==i||t.status!==vi&&t.status!==fa&&t.status!==ga&&t.status!==pa&&t.status!==ma&&t.status!==_a&&t.status!==We&&t.status!==ln?1:0},yh=i=>{if(un(i))return Ke(i,Zt);i.total_in=i.total_out=0,i.data_type=q1;const t=i.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?fa:t.wrap?vi:We,i.adler=t.wrap===2?0:1,t.last_flush=-2,U1(t),At},bh=i=>{const t=yh(i);return t===At&&hg(i.state),t},ug=(i,t)=>un(i)||i.state.wrap!==2?Zt:(i.state.gzhead=t,At),wh=(i,t,e,n,r,s)=>{if(!i)return Zt;let a=1;if(t===V1&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),r<1||r>K1||e!==ir||n<8||n>15||t<0||t>9||s<0||s>Y1||n===8&&a!==1)return Ke(i,Zt);n===8&&(n=9);const o=new cg;return i.state=o,o.strm=i,o.status=vi,o.wrap=a,o.gzhead=null,o.w_bits=n,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+K-1)/K),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,bh(i)},dg=(i,t)=>wh(i,t,ir,Z1,J1,W1),fg=(i,t)=>{if(un(i)||t>gh||t<0)return i?Ke(i,Zt):Zt;const e=i.state;if(!i.output||i.avail_in!==0&&!i.input||e.status===ln&&t!==Gt)return Ke(i,i.avail_out===0?ua:Zt);const n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(Lt(i),i.avail_out===0)return e.last_flush=-1,At}else if(i.avail_in===0&&mh(t)<=mh(n)&&t!==Gt)return Ke(i,ua);if(e.status===ln&&i.avail_in!==0)return Ke(i,ua);if(e.status===vi&&e.wrap===0&&(e.status=We),e.status===vi){let r=ir+(e.w_bits-8<<4)<<8,s=-1;if(e.strategy>=er||e.level<2?s=0:e.level<6?s=1:e.level===6?s=2:s=3,r|=s<<6,e.strstart!==0&&(r|=rg),r+=31-r%31,hn(e,r),e.strstart!==0&&(hn(e,i.adler>>>16),hn(e,i.adler&65535)),i.adler=1,e.status=We,Lt(i),e.pending!==0)return e.last_flush=-1,At}if(e.status===fa){if(i.adler=0,tt(e,31),tt(e,139),tt(e,8),e.gzhead)tt(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)),tt(e,e.gzhead.time&255),tt(e,e.gzhead.time>>8&255),tt(e,e.gzhead.time>>16&255),tt(e,e.gzhead.time>>24&255),tt(e,e.level===9?2:e.strategy>=er||e.level<2?4:0),tt(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(tt(e,e.gzhead.extra.length&255),tt(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(i.adler=Tt(i.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=ga;else if(tt(e,0),tt(e,0),tt(e,0),tt(e,0),tt(e,0),tt(e,e.level===9?2:e.strategy>=er||e.level<2?4:0),tt(e,sg),e.status=We,Lt(i),e.pending!==0)return e.last_flush=-1,At}if(e.status===ga){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&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex+=o,Lt(i),e.pending!==0)return e.last_flush=-1,At;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&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=pa}if(e.status===pa){if(e.gzhead.name){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),Lt(i),e.pending!==0)return e.last_flush=-1,At;r=0}e.gzindex<e.gzhead.name.length?s=e.gzhead.name.charCodeAt(e.gzindex++)&255:s=0,tt(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=ma}if(e.status===ma){if(e.gzhead.comment){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r)),Lt(i),e.pending!==0)return e.last_flush=-1,At;r=0}e.gzindex<e.gzhead.comment.length?s=e.gzhead.comment.charCodeAt(e.gzindex++)&255:s=0,tt(e,s)}while(s!==0);e.gzhead.hcrc&&e.pending>r&&(i.adler=Tt(i.adler,e.pending_buf,e.pending-r,r))}e.status=_a}if(e.status===_a){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(Lt(i),e.pending!==0))return e.last_flush=-1,At;tt(e,i.adler&255),tt(e,i.adler>>8&255),i.adler=0}if(e.status=We,Lt(i),e.pending!==0)return e.last_flush=-1,At}if(i.avail_in!==0||e.lookahead!==0||t!==Ee&&e.status!==ln){let r=e.level===0?vh(e,t):e.strategy===er?lg(e,t):e.strategy===X1?og(e,t):cn[e.level].func(e,t);if((r===qe||r===bi)&&(e.status=ln),r===Mt||r===qe)return i.avail_out===0&&(e.last_flush=-1),At;if(r===yi&&(t===z1?B1(e):t!==gh&&(ca(e,0,0,!1),t===H1&&(Ae(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),Lt(i),i.avail_out===0))return e.last_flush=-1,At}return t!==Gt?At:e.wrap<=0?ph:(e.wrap===2?(tt(e,i.adler&255),tt(e,i.adler>>8&255),tt(e,i.adler>>16&255),tt(e,i.adler>>24&255),tt(e,i.total_in&255),tt(e,i.total_in>>8&255),tt(e,i.total_in>>16&255),tt(e,i.total_in>>24&255)):(hn(e,i.adler>>>16),hn(e,i.adler&65535)),Lt(i),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?At:ph)},gg=i=>{if(un(i))return Zt;const t=i.state.status;return i.state=null,t===We?Ke(i,j1):At},pg=(i,t)=>{let e=t.length;if(un(i))return Zt;const n=i.state,r=n.wrap;if(r===2||r===1&&n.status!==vi||n.lookahead)return Zt;if(r===1&&(i.adler=on(i.adler,t,e,0)),n.wrap=0,e>=n.w_size){r===0&&(Ae(n.head),n.strstart=0,n.block_start=0,n.insert=0);let h=new Uint8Array(n.w_size);h.set(t.subarray(e-n.w_size,e),0),t=h,e=n.w_size}const s=i.avail_in,a=i.next_in,o=i.input;for(i.avail_in=e,i.next_in=0,i.input=t,wi(n);n.lookahead>=K;){let h=n.strstart,l=n.lookahead-(K-1);do n.ins_h=Pe(n,n.ins_h,n.window[h+K-1]),n.prev[h&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=h,h++;while(--l);n.strstart=h,n.lookahead=K-1,wi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=K-1,n.match_available=0,i.next_in=a,i.input=o,i.avail_in=s,n.wrap=r,At};var mg=dg,_g=wh,vg=bh,yg=yh,bg=ug,wg=fg,Sg=gg,Cg=pg,xg="pako deflate (from Nodeca project)",dn={deflateInit:mg,deflateInit2:_g,deflateReset:vg,deflateResetKeep:yg,deflateSetHeader:bg,deflate:wg,deflateEnd:Sg,deflateSetDictionary:Cg,deflateInfo:xg};const Tg=(i,t)=>Object.prototype.hasOwnProperty.call(i,t);var Eg=function(i){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 n in e)Tg(e,n)&&(i[n]=e[n])}}return i},kg=i=>{let t=0;for(let n=0,r=i.length;n<r;n++)t+=i[n].length;const e=new Uint8Array(t);for(let n=0,r=0,s=i.length;n<s;n++){let a=i[n];e.set(a,r),r+=a.length}return e},nr={assign:Eg,flattenChunks:kg};let Sh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Sh=!1}const fn=new Uint8Array(256);for(let i=0;i<256;i++)fn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;fn[254]=fn[254]=1;var Ag=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let t,e,n,r,s,a=i.length,o=0;for(r=0;r<a;r++)e=i.charCodeAt(r),(e&64512)===55296&&r+1<a&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-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=i.charCodeAt(r),(e&64512)===55296&&r+1<a&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-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 Pg=(i,t)=>{if(t<65534&&i.subarray&&Sh)return String.fromCharCode.apply(null,i.length===t?i:i.subarray(0,t));let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(i[n]);return e};var Mg=(i,t)=>{const e=t||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,t));let n,r;const s=new Array(e*2);for(r=0,n=0;n<e;){let a=i[n++];if(a<128){s[r++]=a;continue}let o=fn[a];if(o>4){s[r++]=65533,n+=o-1;continue}for(a&=o===2?31:o===3?15:7;o>1&&n<e;)a=a<<6|i[n++]&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 Pg(s,r)},Rg=(i,t)=>{t=t||i.length,t>i.length&&(t=i.length);let e=t-1;for(;e>=0&&(i[e]&192)===128;)e--;return e<0||e===0?t:e+fn[i[e]]>t?e:t},gn={string2buf:Ag,buf2string:Mg,utf8border:Rg};function Dg(){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 Ch=Dg;const xh=Object.prototype.toString,{Z_NO_FLUSH:Lg,Z_SYNC_FLUSH:Og,Z_FULL_FLUSH:Ig,Z_FINISH:Fg,Z_OK:rr,Z_STREAM_END:Ng,Z_DEFAULT_COMPRESSION:Ug,Z_DEFAULT_STRATEGY:Gg,Z_DEFLATED:Bg}=Ye;function pn(i){this.options=nr.assign({level:Ug,method:Bg,chunkSize:16384,windowBits:15,memLevel:8,strategy:Gg},i||{});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 Ch,this.strm.avail_out=0;let e=dn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==rr)throw new Error(Xe[e]);if(t.header&&dn.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=gn.string2buf(t.dictionary):xh.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,e=dn.deflateSetDictionary(this.strm,n),e!==rr)throw new Error(Xe[e]);this._dict_set=!0}}pn.prototype.push=function(i,t){const e=this.strm,n=this.options.chunkSize;let r,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Fg:Lg,typeof i=="string"?e.input=gn.string2buf(i):xh.call(i)==="[object ArrayBuffer]"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(s===Og||s===Ig)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(r=dn.deflate(e,s),r===Ng)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),r=dn.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===rr;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},pn.prototype.onData=function(i){this.chunks.push(i)},pn.prototype.onEnd=function(i){i===rr&&(this.result=nr.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function ba(i,t){const e=new pn(t);if(e.push(i,!0),e.err)throw e.msg||Xe[e.err];return e.result}function zg(i,t){return t=t||{},t.raw=!0,ba(i,t)}function Hg(i,t){return t=t||{},t.gzip=!0,ba(i,t)}var jg=pn,Vg=ba,$g=zg,Xg=Hg,Yg=Ye,Wg={Deflate:jg,deflate:Vg,deflateRaw:$g,gzip:Xg,constants:Yg};const sr=16209,qg=16191;var Kg=function(t,e){let n,r,s,a,o,h,l,c,d,f,u,g,p,_,y,b,m,v,w,S,k,C,A,x;const T=t.state;n=t.next_in,A=t.input,r=n+(t.avail_in-5),s=t.next_out,x=t.output,a=s-(e-t.avail_out),o=s+(t.avail_out-257),h=T.dmax,l=T.wsize,c=T.whave,d=T.wnext,f=T.window,u=T.hold,g=T.bits,p=T.lencode,_=T.distcode,y=(1<<T.lenbits)-1,b=(1<<T.distbits)-1;t:do{g<15&&(u+=A[n++]<<g,g+=8,u+=A[n++]<<g,g+=8),m=p[u&y];e:for(;;){if(v=m>>>24,u>>>=v,g-=v,v=m>>>16&255,v===0)x[s++]=m&65535;else if(v&16){w=m&65535,v&=15,v&&(g<v&&(u+=A[n++]<<g,g+=8),w+=u&(1<<v)-1,u>>>=v,g-=v),g<15&&(u+=A[n++]<<g,g+=8,u+=A[n++]<<g,g+=8),m=_[u&b];i:for(;;){if(v=m>>>24,u>>>=v,g-=v,v=m>>>16&255,v&16){if(S=m&65535,v&=15,g<v&&(u+=A[n++]<<g,g+=8,g<v&&(u+=A[n++]<<g,g+=8)),S+=u&(1<<v)-1,S>h){t.msg="invalid distance too far back",T.mode=sr;break t}if(u>>>=v,g-=v,v=s-a,S>v){if(v=S-v,v>c&&T.sane){t.msg="invalid distance too far back",T.mode=sr;break t}if(k=0,C=f,d===0){if(k+=l-v,v<w){w-=v;do x[s++]=f[k++];while(--v);k=s-S,C=x}}else if(d<v){if(k+=l+d-v,v-=d,v<w){w-=v;do x[s++]=f[k++];while(--v);if(k=0,d<w){v=d,w-=v;do x[s++]=f[k++];while(--v);k=s-S,C=x}}}else if(k+=d-v,v<w){w-=v;do x[s++]=f[k++];while(--v);k=s-S,C=x}for(;w>2;)x[s++]=C[k++],x[s++]=C[k++],x[s++]=C[k++],w-=3;w&&(x[s++]=C[k++],w>1&&(x[s++]=C[k++]))}else{k=s-S;do x[s++]=x[k++],x[s++]=x[k++],x[s++]=x[k++],w-=3;while(w>2);w&&(x[s++]=x[k++],w>1&&(x[s++]=x[k++]))}}else if(v&64){t.msg="invalid distance code",T.mode=sr;break t}else{m=_[(m&65535)+(u&(1<<v)-1)];continue i}break}}else if(v&64)if(v&32){T.mode=qg;break t}else{t.msg="invalid literal/length code",T.mode=sr;break t}else{m=p[(m&65535)+(u&(1<<v)-1)];continue e}break}}while(n<r&&s<o);w=g>>3,n-=w,g-=w<<3,u&=(1<<g)-1,t.next_in=n,t.next_out=s,t.avail_in=n<r?5+(r-n):5-(n-r),t.avail_out=s<o?257+(o-s):257-(s-o),T.hold=u,T.bits=g};const Ci=15,Th=852,Eh=592,kh=0,wa=1,Ah=2,Zg=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]),Jg=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]),Qg=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]),t2=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 mn=(i,t,e,n,r,s,a,o)=>{const h=o.bits;let l=0,c=0,d=0,f=0,u=0,g=0,p=0,_=0,y=0,b=0,m,v,w,S,k,C=null,A;const x=new Uint16Array(Ci+1),T=new Uint16Array(Ci+1);let M=null,D,O,I;for(l=0;l<=Ci;l++)x[l]=0;for(c=0;c<n;c++)x[t[e+c]]++;for(u=h,f=Ci;f>=1&&x[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&&x[d]===0;d++);for(u<d&&(u=d),_=1,l=1;l<=Ci;l++)if(_<<=1,_-=x[l],_<0)return-1;if(_>0&&(i===kh||f!==1))return-1;for(T[1]=0,l=1;l<Ci;l++)T[l+1]=T[l]+x[l];for(c=0;c<n;c++)t[e+c]!==0&&(a[T[t[e+c]]++]=c);if(i===kh?(C=M=a,A=20):i===wa?(C=Zg,M=Jg,A=257):(C=Qg,M=t2,A=0),b=0,c=0,l=d,k=s,g=u,p=0,w=-1,y=1<<u,S=y-1,i===wa&&y>Th||i===Ah&&y>Eh)return 1;for(;;){D=l-p,a[c]+1<A?(O=0,I=a[c]):a[c]>=A?(O=M[a[c]-A],I=C[a[c]-A]):(O=32+64,I=0),m=1<<l-p,v=1<<g,d=v;do v-=m,r[k+(b>>p)+v]=D<<24|O<<16|I|0;while(v!==0);for(m=1<<l-1;b&m;)m>>=1;if(m!==0?(b&=m-1,b+=m):b=0,c++,--x[l]===0){if(l===f)break;l=t[e+a[c]]}if(l>u&&(b&S)!==w){for(p===0&&(p=u),k+=d,g=l-p,_=1<<g;g+p<f&&(_-=x[g+p],!(_<=0));)g++,_<<=1;if(y+=1<<g,i===wa&&y>Th||i===Ah&&y>Eh)return 1;w=b&S,r[w]=u<<24|g<<16|k-s|0}}return b!==0&&(r[k+b]=l-p<<24|64<<16|0),o.bits=u,0};const e2=0,Ph=1,Mh=2,{Z_FINISH:Rh,Z_BLOCK:i2,Z_TREES:ar,Z_OK:Ze,Z_STREAM_END:n2,Z_NEED_DICT:r2,Z_STREAM_ERROR:Bt,Z_DATA_ERROR:Dh,Z_MEM_ERROR:Lh,Z_BUF_ERROR:s2,Z_DEFLATED:Oh}=Ye,or=16180,Ih=16181,Fh=16182,Nh=16183,Uh=16184,Gh=16185,Bh=16186,zh=16187,Hh=16188,jh=16189,lr=16190,oe=16191,Sa=16192,Vh=16193,Ca=16194,$h=16195,Xh=16196,Yh=16197,Wh=16198,hr=16199,cr=16200,qh=16201,Kh=16202,Zh=16203,Jh=16204,Qh=16205,xa=16206,tc=16207,ec=16208,ct=16209,ic=16210,nc=16211,a2=852,o2=592,l2=15,rc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function h2(){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 Je=i=>{if(!i)return 1;const t=i.state;return!t||t.strm!==i||t.mode<or||t.mode>nc?1:0},sc=i=>{if(Je(i))return Bt;const t=i.state;return i.total_in=i.total_out=t.total=0,i.msg="",t.wrap&&(i.adler=t.wrap&1),t.mode=or,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(a2),t.distcode=t.distdyn=new Int32Array(o2),t.sane=1,t.back=-1,Ze},ac=i=>{if(Je(i))return Bt;const t=i.state;return t.wsize=0,t.whave=0,t.wnext=0,sc(i)},oc=(i,t)=>{let e;if(Je(i))return Bt;const n=i.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Bt:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,ac(i))},lc=(i,t)=>{if(!i)return Bt;const e=new h2;i.state=e,e.strm=i,e.window=null,e.mode=or;const n=oc(i,t);return n!==Ze&&(i.state=null),n},c2=i=>lc(i,l2);let hc=!0,Ta,Ea;const u2=i=>{if(hc){Ta=new Int32Array(512),Ea=new Int32Array(32);let t=0;for(;t<144;)i.lens[t++]=8;for(;t<256;)i.lens[t++]=9;for(;t<280;)i.lens[t++]=7;for(;t<288;)i.lens[t++]=8;for(mn(Ph,i.lens,0,288,Ta,0,i.work,{bits:9}),t=0;t<32;)i.lens[t++]=5;mn(Mh,i.lens,0,32,Ea,0,i.work,{bits:5}),hc=!1}i.lencode=Ta,i.lenbits=9,i.distcode=Ea,i.distbits=5},cc=(i,t,e,n)=>{let r;const s=i.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=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>n&&(r=n),s.window.set(t.subarray(e-n,e-n+r),s.wnext),n-=r,n?(s.window.set(t.subarray(e-n,e),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},d2=(i,t)=>{let e,n,r,s,a,o,h,l,c,d,f,u,g,p,_=0,y,b,m,v,w,S,k,C;const A=new Uint8Array(4);let x,T;const M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Je(i)||!i.output||!i.input&&i.avail_in!==0)return Bt;e=i.state,e.mode===oe&&(e.mode=Sa),a=i.next_out,r=i.output,h=i.avail_out,s=i.next_in,n=i.input,o=i.avail_in,l=e.hold,c=e.bits,d=o,f=h,C=Ze;t:for(;;)switch(e.mode){case or:if(e.wrap===0){e.mode=Sa;break}for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.wrap&2&&l===35615){e.wbits===0&&(e.wbits=15),e.check=0,A[0]=l&255,A[1]=l>>>8&255,e.check=Tt(e.check,A,2,0),l=0,c=0,e.mode=Ih;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){i.msg="incorrect header check",e.mode=ct;break}if((l&15)!==Oh){i.msg="unknown compression method",e.mode=ct;break}if(l>>>=4,c-=4,k=(l&15)+8,e.wbits===0&&(e.wbits=k),k>15||k>e.wbits){i.msg="invalid window size",e.mode=ct;break}e.dmax=1<<e.wbits,e.flags=0,i.adler=e.check=1,e.mode=l&512?jh:oe,l=0,c=0;break;case Ih:for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.flags=l,(e.flags&255)!==Oh){i.msg="unknown compression method",e.mode=ct;break}if(e.flags&57344){i.msg="unknown header flags set",e.mode=ct;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&(A[0]=l&255,A[1]=l>>>8&255,e.check=Tt(e.check,A,2,0)),l=0,c=0,e.mode=Fh;case Fh:for(;c<32;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.head&&(e.head.time=l),e.flags&512&&e.wrap&4&&(A[0]=l&255,A[1]=l>>>8&255,A[2]=l>>>16&255,A[3]=l>>>24&255,e.check=Tt(e.check,A,4,0)),l=0,c=0,e.mode=Nh;case Nh:for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.head&&(e.head.xflags=l&255,e.head.os=l>>8),e.flags&512&&e.wrap&4&&(A[0]=l&255,A[1]=l>>>8&255,e.check=Tt(e.check,A,2,0)),l=0,c=0,e.mode=Uh;case Uh:if(e.flags&1024){for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.length=l,e.head&&(e.head.extra_len=l),e.flags&512&&e.wrap&4&&(A[0]=l&255,A[1]=l>>>8&255,e.check=Tt(e.check,A,2,0)),l=0,c=0}else e.head&&(e.head.extra=null);e.mode=Gh;case Gh:if(e.flags&1024&&(u=e.length,u>o&&(u=o),u&&(e.head&&(k=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(s,s+u),k)),e.flags&512&&e.wrap&4&&(e.check=Tt(e.check,n,u,s)),o-=u,s+=u,e.length-=u),e.length))break t;e.length=0,e.mode=Bh;case Bh:if(e.flags&2048){if(o===0)break t;u=0;do k=n[s+u++],e.head&&k&&e.length<65536&&(e.head.name+=String.fromCharCode(k));while(k&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=Tt(e.check,n,u,s)),o-=u,s+=u,k)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=zh;case zh:if(e.flags&4096){if(o===0)break t;u=0;do k=n[s+u++],e.head&&k&&e.length<65536&&(e.head.comment+=String.fromCharCode(k));while(k&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=Tt(e.check,n,u,s)),o-=u,s+=u,k)break t}else e.head&&(e.head.comment=null);e.mode=Hh;case Hh:if(e.flags&512){for(;c<16;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.wrap&4&&l!==(e.check&65535)){i.msg="header crc mismatch",e.mode=ct;break}l=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),i.adler=e.check=0,e.mode=oe;break;case jh:for(;c<32;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}i.adler=e.check=rc(l),l=0,c=0,e.mode=lr;case lr:if(e.havedict===0)return i.next_out=a,i.avail_out=h,i.next_in=s,i.avail_in=o,e.hold=l,e.bits=c,r2;i.adler=e.check=1,e.mode=oe;case oe:if(t===i2||t===ar)break t;case Sa:if(e.last){l>>>=c&7,c-=c&7,e.mode=xa;break}for(;c<3;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}switch(e.last=l&1,l>>>=1,c-=1,l&3){case 0:e.mode=Vh;break;case 1:if(u2(e),e.mode=hr,t===ar){l>>>=2,c-=2;break t}break;case 2:e.mode=Xh;break;case 3:i.msg="invalid block type",e.mode=ct}l>>>=2,c-=2;break;case Vh:for(l>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){i.msg="invalid stored block lengths",e.mode=ct;break}if(e.length=l&65535,l=0,c=0,e.mode=Ca,t===ar)break t;case Ca:e.mode=$h;case $h:if(u=e.length,u){if(u>o&&(u=o),u>h&&(u=h),u===0)break t;r.set(n.subarray(s,s+u),a),o-=u,s+=u,h-=u,a+=u,e.length-=u;break}e.mode=oe;break;case Xh:for(;c<14;){if(o===0)break t;o--,l+=n[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){i.msg="too many length or distance symbols",e.mode=ct;break}e.have=0,e.mode=Yh;case Yh:for(;e.have<e.ncode;){for(;c<3;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}e.lens[M[e.have++]]=l&7,l>>>=3,c-=3}for(;e.have<19;)e.lens[M[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,x={bits:e.lenbits},C=mn(e2,e.lens,0,19,e.lencode,0,e.work,x),e.lenbits=x.bits,C){i.msg="invalid code lengths set",e.mode=ct;break}e.have=0,e.mode=Wh;case Wh:for(;e.have<e.nlen+e.ndist;){for(;_=e.lencode[l&(1<<e.lenbits)-1],y=_>>>24,b=_>>>16&255,m=_&65535,!(y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(m<16)l>>>=y,c-=y,e.lens[e.have++]=m;else{if(m===16){for(T=y+2;c<T;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(l>>>=y,c-=y,e.have===0){i.msg="invalid bit length repeat",e.mode=ct;break}k=e.lens[e.have-1],u=3+(l&3),l>>>=2,c-=2}else if(m===17){for(T=y+3;c<T;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}l>>>=y,c-=y,k=0,u=3+(l&7),l>>>=3,c-=3}else{for(T=y+7;c<T;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}l>>>=y,c-=y,k=0,u=11+(l&127),l>>>=7,c-=7}if(e.have+u>e.nlen+e.ndist){i.msg="invalid bit length repeat",e.mode=ct;break}for(;u--;)e.lens[e.have++]=k}}if(e.mode===ct)break;if(e.lens[256]===0){i.msg="invalid code -- missing end-of-block",e.mode=ct;break}if(e.lenbits=9,x={bits:e.lenbits},C=mn(Ph,e.lens,0,e.nlen,e.lencode,0,e.work,x),e.lenbits=x.bits,C){i.msg="invalid literal/lengths set",e.mode=ct;break}if(e.distbits=6,e.distcode=e.distdyn,x={bits:e.distbits},C=mn(Mh,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,x),e.distbits=x.bits,C){i.msg="invalid distances set",e.mode=ct;break}if(e.mode=hr,t===ar)break t;case hr:e.mode=cr;case cr:if(o>=6&&h>=258){i.next_out=a,i.avail_out=h,i.next_in=s,i.avail_in=o,e.hold=l,e.bits=c,Kg(i,f),a=i.next_out,r=i.output,h=i.avail_out,s=i.next_in,n=i.input,o=i.avail_in,l=e.hold,c=e.bits,e.mode===oe&&(e.back=-1);break}for(e.back=0;_=e.lencode[l&(1<<e.lenbits)-1],y=_>>>24,b=_>>>16&255,m=_&65535,!(y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(b&&!(b&240)){for(v=y,w=b,S=m;_=e.lencode[S+((l&(1<<v+w)-1)>>v)],y=_>>>24,b=_>>>16&255,m=_&65535,!(v+y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}l>>>=v,c-=v,e.back+=v}if(l>>>=y,c-=y,e.back+=y,e.length=m,b===0){e.mode=Qh;break}if(b&32){e.back=-1,e.mode=oe;break}if(b&64){i.msg="invalid literal/length code",e.mode=ct;break}e.extra=b&15,e.mode=qh;case qh:if(e.extra){for(T=e.extra;c<T;){if(o===0)break t;o--,l+=n[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=Kh;case Kh:for(;_=e.distcode[l&(1<<e.distbits)-1],y=_>>>24,b=_>>>16&255,m=_&65535,!(y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(!(b&240)){for(v=y,w=b,S=m;_=e.distcode[S+((l&(1<<v+w)-1)>>v)],y=_>>>24,b=_>>>16&255,m=_&65535,!(v+y<=c);){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}l>>>=v,c-=v,e.back+=v}if(l>>>=y,c-=y,e.back+=y,b&64){i.msg="invalid distance code",e.mode=ct;break}e.offset=m,e.extra=b&15,e.mode=Zh;case Zh:if(e.extra){for(T=e.extra;c<T;){if(o===0)break t;o--,l+=n[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){i.msg="invalid distance too far back",e.mode=ct;break}e.mode=Jh;case Jh:if(h===0)break t;if(u=f-h,e.offset>u){if(u=e.offset-u,u>e.whave&&e.sane){i.msg="invalid distance too far back",e.mode=ct;break}u>e.wnext?(u-=e.wnext,g=e.wsize-u):g=e.wnext-u,u>e.length&&(u=e.length),p=e.window}else p=r,g=a-e.offset,u=e.length;u>h&&(u=h),h-=u,e.length-=u;do r[a++]=p[g++];while(--u);e.length===0&&(e.mode=cr);break;case Qh:if(h===0)break t;r[a++]=e.length,h--,e.mode=cr;break;case xa:if(e.wrap){for(;c<32;){if(o===0)break t;o--,l|=n[s++]<<c,c+=8}if(f-=h,i.total_out+=f,e.total+=f,e.wrap&4&&f&&(i.adler=e.check=e.flags?Tt(e.check,r,f,a-f):on(e.check,r,f,a-f)),f=h,e.wrap&4&&(e.flags?l:rc(l))!==e.check){i.msg="incorrect data check",e.mode=ct;break}l=0,c=0}e.mode=tc;case tc:if(e.wrap&&e.flags){for(;c<32;){if(o===0)break t;o--,l+=n[s++]<<c,c+=8}if(e.wrap&4&&l!==(e.total&4294967295)){i.msg="incorrect length check",e.mode=ct;break}l=0,c=0}e.mode=ec;case ec:C=n2;break t;case ct:C=Dh;break t;case ic:return Lh;case nc:default:return Bt}return i.next_out=a,i.avail_out=h,i.next_in=s,i.avail_in=o,e.hold=l,e.bits=c,(e.wsize||f!==i.avail_out&&e.mode<ct&&(e.mode<xa||t!==Rh))&&cc(i,i.output,i.next_out,f-i.avail_out),d-=i.avail_in,f-=i.avail_out,i.total_in+=d,i.total_out+=f,e.total+=f,e.wrap&4&&f&&(i.adler=e.check=e.flags?Tt(e.check,r,f,i.next_out-f):on(e.check,r,f,i.next_out-f)),i.data_type=e.bits+(e.last?64:0)+(e.mode===oe?128:0)+(e.mode===hr||e.mode===Ca?256:0),(d===0&&f===0||t===Rh)&&C===Ze&&(C=s2),C},f2=i=>{if(Je(i))return Bt;let t=i.state;return t.window&&(t.window=null),i.state=null,Ze},g2=(i,t)=>{if(Je(i))return Bt;const e=i.state;return e.wrap&2?(e.head=t,t.done=!1,Ze):Bt},p2=(i,t)=>{const e=t.length;let n,r,s;return Je(i)||(n=i.state,n.wrap!==0&&n.mode!==lr)?Bt:n.mode===lr&&(r=1,r=on(r,t,e,0),r!==n.check)?Dh:(s=cc(i,t,e,e),s?(n.mode=ic,Lh):(n.havedict=1,Ze))};var m2=ac,_2=oc,v2=sc,y2=c2,b2=lc,w2=d2,S2=f2,C2=g2,x2=p2,T2="pako inflate (from Nodeca project)",le={inflateReset:m2,inflateReset2:_2,inflateResetKeep:v2,inflateInit:y2,inflateInit2:b2,inflate:w2,inflateEnd:S2,inflateGetHeader:C2,inflateSetDictionary:x2,inflateInfo:T2};function E2(){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 k2=E2;const uc=Object.prototype.toString,{Z_NO_FLUSH:A2,Z_FINISH:P2,Z_OK:_n,Z_STREAM_END:ka,Z_NEED_DICT:Aa,Z_STREAM_ERROR:M2,Z_DATA_ERROR:dc,Z_MEM_ERROR:R2}=Ye;function vn(i){this.options=nr.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});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&&!(i&&i.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 Ch,this.strm.avail_out=0;let e=le.inflateInit2(this.strm,t.windowBits);if(e!==_n)throw new Error(Xe[e]);if(this.header=new k2,le.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=gn.string2buf(t.dictionary):uc.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=le.inflateSetDictionary(this.strm,t.dictionary),e!==_n)))throw new Error(Xe[e])}vn.prototype.push=function(i,t){const e=this.strm,n=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?P2:A2,uc.call(i)==="[object ArrayBuffer]"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),s=le.inflate(e,a),s===Aa&&r&&(s=le.inflateSetDictionary(e,r),s===_n?s=le.inflate(e,a):s===dc&&(s=Aa));e.avail_in>0&&s===ka&&e.state.wrap>0&&i[e.next_in]!==0;)le.inflateReset(e),s=le.inflate(e,a);switch(s){case M2:case dc:case Aa:case R2:return this.onEnd(s),this.ended=!0,!1}if(o=e.avail_out,e.next_out&&(e.avail_out===0||s===ka))if(this.options.to==="string"){let h=gn.utf8border(e.output,e.next_out),l=e.next_out-h,c=gn.buf2string(e.output,h);e.next_out=l,e.avail_out=n-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===_n&&o===0)){if(s===ka)return s=le.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},vn.prototype.onData=function(i){this.chunks.push(i)},vn.prototype.onEnd=function(i){i===_n&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=nr.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function Pa(i,t){const e=new vn(t);if(e.push(i),e.err)throw e.msg||Xe[e.err];return e.result}function D2(i,t){return t=t||{},t.raw=!0,Pa(i,t)}var L2=vn,O2=Pa,I2=D2,F2=Pa,N2=Ye,U2={Inflate:L2,inflate:O2,inflateRaw:I2,ungzip:F2,constants:N2};const{Deflate:G2,deflate:B2,deflateRaw:z2,gzip:H2}=Wg,{Inflate:j2,inflate:V2,inflateRaw:$2,ungzip:X2}=U2;var Y2=G2,W2=B2,q2=z2,K2=H2,Z2=j2,J2=V2,Q2=$2,tp=X2,ep=Ye,ip={Deflate:Y2,deflate:W2,deflateRaw:q2,gzip:K2,Inflate:Z2,inflate:J2,inflateRaw:Q2,ungzip:tp,constants:ep};const L={};L.toRGBA8=function(i){const t=i.width,e=i.height;if(i.tabs.acTL===null)return[L.toRGBA8.decodeImage(i.data,t,e,i).buffer];const n=[];i.frames[0].data===null&&(i.frames[0].data=i.data);const r=t*e*4,s=new Uint8Array(r),a=new Uint8Array(r),o=new Uint8Array(r);for(let h=0;h<i.frames.length;h++){const l=i.frames[h],c=l.rect.x,d=l.rect.y,f=l.rect.width,u=l.rect.height,g=L.toRGBA8.decodeImage(l.data,f,u,i);if(h!==0)for(let p=0;p<r;p++)o[p]=s[p];if(l.blend===0?L._copyTile(g,f,u,s,t,e,c,d,0):l.blend===1&&L._copyTile(g,f,u,s,t,e,c,d,1),n.push(s.buffer.slice(0)),l.dispose===1)L._copyTile(a,f,u,s,t,e,c,d,0);else if(l.dispose===2)for(let p=0;p<r;p++)s[p]=o[p]}return n},L.toRGBA8.decodeImage=function(i,t,e,n){const r=t*e,s=L.decode._getBPP(n),a=Math.ceil(t*s/8),o=new Uint8Array(r*4),h=new Uint32Array(o.buffer),l=n.ctype,c=n.depth,d=L._bin.readUshort;if(l===6){const f=r<<2;if(c===8)for(let u=0;u<f;u+=4)o[u]=i[u],o[u+1]=i[u+1],o[u+2]=i[u+2],o[u+3]=i[u+3];if(c===16)for(let u=0;u<f;u++)o[u]=i[u<<1]}else if(l===2){const f=n.tabs.tRNS;if(f===null){if(c===8)for(let u=0;u<r;u++){const g=u*3;h[u]=255<<24|i[g+2]<<16|i[g+1]<<8|i[g]}if(c===16)for(let u=0;u<r;u++){const g=u*6;h[u]=255<<24|i[g+4]<<16|i[g+2]<<8|i[g]}}else{const u=f[0],g=f[1],p=f[2];if(c===8)for(let _=0;_<r;_++){const y=_<<2,b=_*3;h[_]=255<<24|i[b+2]<<16|i[b+1]<<8|i[b],i[b]===u&&i[b+1]===g&&i[b+2]===p&&(o[y+3]=0)}if(c===16)for(let _=0;_<r;_++){const y=_<<2,b=_*6;h[_]=255<<24|i[b+4]<<16|i[b+2]<<8|i[b],d(i,b)===u&&d(i,b+2)===g&&d(i,b+4)===p&&(o[y+3]=0)}}}else if(l===3){const f=n.tabs.PLTE,u=n.tabs.tRNS,g=u?u.length:0;if(c===1)for(let p=0;p<e;p++){const _=p*a,y=p*t;for(let b=0;b<t;b++){const m=y+b<<2,v=i[_+(b>>3)]>>7-((b&7)<<0)&1,w=3*v;o[m]=f[w],o[m+1]=f[w+1],o[m+2]=f[w+2],o[m+3]=v<g?u[v]:255}}if(c===2)for(let p=0;p<e;p++){const _=p*a,y=p*t;for(let b=0;b<t;b++){const m=y+b<<2,v=i[_+(b>>2)]>>6-((b&3)<<1)&3,w=3*v;o[m]=f[w],o[m+1]=f[w+1],o[m+2]=f[w+2],o[m+3]=v<g?u[v]:255}}if(c===4)for(let p=0;p<e;p++){const _=p*a,y=p*t;for(let b=0;b<t;b++){const m=y+b<<2,v=i[_+(b>>1)]>>4-((b&1)<<2)&15,w=3*v;o[m]=f[w],o[m+1]=f[w+1],o[m+2]=f[w+2],o[m+3]=v<g?u[v]:255}}if(c===8)for(let p=0;p<r;p++){const _=p<<2,y=i[p],b=3*y;o[_]=f[b],o[_+1]=f[b+1],o[_+2]=f[b+2],o[_+3]=y<g?u[y]:255}}else if(l===4){if(c===8)for(let f=0;f<r;f++){const u=f<<2,g=f<<1,p=i[g];o[u]=p,o[u+1]=p,o[u+2]=p,o[u+3]=i[g+1]}if(c===16)for(let f=0;f<r;f++){const u=f<<2,g=f<<2,p=i[g];o[u]=p,o[u+1]=p,o[u+2]=p,o[u+3]=i[g+2]}}else if(l===0){const f=n.tabs.tRNS?n.tabs.tRNS:-1;for(let u=0;u<e;u++){const g=u*a,p=u*t;if(c===1)for(let _=0;_<t;_++){const y=255*(i[g+(_>>>3)]>>>7-(_&7)&1),b=y===f*255?0:255;h[p+_]=b<<24|y<<16|y<<8|y}else if(c===2)for(let _=0;_<t;_++){const y=85*(i[g+(_>>>2)]>>>6-((_&3)<<1)&3),b=y===f*85?0:255;h[p+_]=b<<24|y<<16|y<<8|y}else if(c===4)for(let _=0;_<t;_++){const y=17*(i[g+(_>>>1)]>>>4-((_&1)<<2)&15),b=y===f*17?0:255;h[p+_]=b<<24|y<<16|y<<8|y}else if(c===8)for(let _=0;_<t;_++){const y=i[g+_],b=y===f?0:255;h[p+_]=b<<24|y<<16|y<<8|y}else if(c===16)for(let _=0;_<t;_++){const y=i[g+(_<<1)],b=d(i,g+(_<<1))===f?0:255;h[p+_]=b<<24|y<<16|y<<8|y}}}return o},L.decode=function(i){const t=new Uint8Array(i);let e=8;const n=L._bin,r=n.readUshort,s=n.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=n.readUint(t,e);e+=4;const u=n.readASCII(t,e,4);if(e+=4,u==="IHDR")L.decode._IHDR(t,e,a);else if(u==="CgBI")a.tabs[u]=t.slice(e,e+4);else if(u==="IDAT"){for(let g=0;g<f;g++)o[h+g]=t[e+g];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 y=a.frames[a.frames.length-1];y.data=L.decode._decompress(a,l.slice(0,c),y.rect.width,y.rect.height),c=0}const g={x:s(t,e+12),y:s(t,e+16),width:s(t,e+4),height:s(t,e+8)};let p=r(t,e+22);p=r(t,e+20)/(p===0?100:p);const _={rect:g,delay:Math.round(p*1e3),dispose:t[e+24],blend:t[e+25]};a.frames.push(_)}else if(u==="fdAT"){for(let g=0;g<f-4;g++)l[c+g]=t[e+g+4];c+=f-4}else if(u==="pHYs")a.tabs[u]=[n.readUint(t,e),n.readUint(t,e+4),t[e+8]];else if(u==="cHRM"){a.tabs[u]=[];for(let g=0;g<8;g++)a.tabs[u].push(n.readUint(t,e+g*4))}else if(u==="tEXt"||u==="zTXt"){a.tabs[u]===null&&(a.tabs[u]={});const g=n.nextZero(t,e),p=n.readASCII(t,e,g-e);let _;const y=e+f-g-1;if(u==="tEXt")_=n.readASCII(t,g+1,y);else{const b=L.decode._inflate(t.slice(g+2,g+2+y));_=n.readUTF8(b,0,b.length)}a.tabs[u][p]=_}else if(u==="iTXt"){a.tabs[u]==null&&(a.tabs[u]={});let g=0,p=e;g=n.nextZero(t,p);const _=n.readASCII(t,p,g-p);p=g+1;const y=t[p];p+=2,g=n.nextZero(t,p),p=g+1,g=n.nextZero(t,p),p=g+1;let b;const m=f-(p-e);if(y===0)b=n.readUTF8(t,p,m);else{const v=L.decode._inflate(t.slice(p,p+m));b=n.readUTF8(v,0,v.length)}a.tabs[u][_]=b}else if(u==="PLTE")a.tabs[u]=n.readBytes(t,e,f);else if(u==="hIST"){const g=a.tabs.PLTE.length/3;a.tabs[u]=[];for(let p=0;p<g;p++)a.tabs[u].push(r(t,e+p*2))}else if(u==="tRNS")a.ctype===3?a.tabs[u]=n.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]=n.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=L.decode._decompress(a,l.slice(0,c),f.rect.width,f.rect.height),c=0}return a.data=L.decode._decompress(a,o,a.width,a.height),delete a.compress,delete a.interlace,delete a.filter,a},L.decode._decompress=function(i,t,e,n){const r=L.decode._getBPP(i),s=Math.ceil(e*r/8),a=new Uint8Array((s+1+i.interlace)*n);return i.tabs.CgBI?t=L.inflateRaw(t,a):t=L.decode._inflate(t,a),i.interlace===0?t=L.decode._filterZero(t,i,0,e,n):i.interlace===1&&(t=L.decode._readInterlace(t,i)),t},L.decode._inflate=function(i,t){return L.inflateRaw(new Uint8Array(i.buffer,2,i.length-6),t)},L.inflateRaw=function(){const i={};return i.H={},i.H.N=function(t,e){const n=Uint8Array;let r=0,s=0,a=0,o=0,h=0,l=0,c=0,d=0,f=0,u,g;if(t[0]===3&&t[1]===0)return e||new n(0);const p=i.H,_=p.b,y=p.e,b=p.R,m=p.n,v=p.A,w=p.Z,S=p.m,k=e===null;for(k&&(e=new n(t.length>>>2<<3));r===0;){if(r=_(t,f,1),s=_(t,f+1,2),f+=3,s===0){f&7&&(f+=8-(f&7));const C=(f>>>3)+4,A=t[C-4]|t[C-3]<<8;k&&(e=i.H.W(e,d+A)),e.set(new n(t.buffer,t.byteOffset+C,A),d),f=C+A<<3,d+=A;continue}if(k&&(e=i.H.W(e,d+(1<<17))),s===1&&(u=S.J,g=S.h,l=512-1,c=32-1),s===2){a=y(t,f,5)+257,o=y(t,f+5,5)+1,h=y(t,f+10,4)+4,f+=14;let C=1;for(let T=0;T<38;T+=2)S.Q[T]=0,S.Q[T+1]=0;for(let T=0;T<h;T++){const M=y(t,f+T*3,3);S.Q[(S.X[T]<<1)+1]=M,M>C&&(C=M)}f+=3*h,m(S.Q,C),v(S.Q,C,S.u),u=S.w,g=S.d,f=b(S.u,(1<<C)-1,a+o,t,f,S.v);const A=p.V(S.v,0,a,S.C);l=(1<<A)-1;const x=p.V(S.v,a,o,S.D);c=(1<<x)-1,m(S.C,A),v(S.C,A,u),m(S.D,x),v(S.D,x,g)}for(;;){const C=u[w(t,f)&l];f+=C&15;const A=C>>>4;if(!(A>>>8))e[d++]=A;else{if(A===256)break;{let x=d+A-254;if(A>264){const I=S.q[A-257];x=d+(I>>>3)+y(t,f,I&7),f+=I&7}const T=g[w(t,f)&c];f+=T&15;const M=T>>>4,D=S.c[M],O=(D>>>4)+_(t,f,D&15);for(f+=D&15;d<x;)e[d]=e[d++-O],e[d]=e[d++-O],e[d]=e[d++-O],e[d]=e[d++-O];d=x}}}}return e.length===d?e:e.slice(0,d)},i.H.W=function(t,e){const n=t.length;if(e<=n)return t;const r=new Uint8Array(n<<1);return r.set(t,0),r},i.H.R=function(t,e,n,r,s,a){const o=i.H.e,h=i.H.Z;let l=0;for(;l<n;){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 g=l+u;for(;l<g;)a[l]=f,l++}}return s},i.H.V=function(t,e,n,r){let s=0,a=0;const o=r.length>>>1;for(;a<n;){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},i.H.n=function(t,e){const n=i.H.m,r=t.length;let s,a,o,h,l;const c=n.j;for(let f=0;f<=e;f++)c[f]=0;for(h=1;h<r;h+=2)c[t[h]]++;const d=n.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]++)},i.H.A=function(t,e,n){const r=t.length,a=i.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 g=a[f]>>>15-e;n[g]=c,f++}}},i.H.l=function(t,e){const n=i.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]=n[a]>>>r}},i.H.M=function(t,e,n){n=n<<(e&7);const r=e>>>3;t[r]|=n,t[r+1]|=n>>>8},i.H.I=function(t,e,n){n=n<<(e&7);const r=e>>>3;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},i.H.e=function(t,e,n){return(t[e>>>3]|t[(e>>>3)+1]<<8)>>>(e&7)&(1<<n)-1},i.H.b=function(t,e,n){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)&(1<<n)-1},i.H.Z=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)},i.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)},i.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=i.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 n(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];n(t._,144,8),n(t._,255-143,9),n(t._,279-255,7),n(t._,287-279,8),i.H.n(t._,9),i.H.A(t._,9,t.J),i.H.l(t._,9),n(t.$,32,5),i.H.n(t.$,5),i.H.A(t.$,5,t.h),i.H.l(t.$,5),n(t.Q,19,0),n(t.C,286,0),n(t.D,30,0),n(t.v,320,0)}(),i.H.N}(),L.decode._readInterlace=function(i,t){const e=t.width,n=t.height,r=L.decode._getBPP(t),s=r>>3,a=Math.ceil(e*r/8),o=new Uint8Array(n*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 g=d[u],p=f[u];let _=0,y=0,b=l[u];for(;b<n;)b+=g,y++;let m=c[u];for(;m<e;)m+=p,_++;const v=Math.ceil(_*r/8);L.decode._filterZero(i,t,h,_,y);let w=0,S=l[u];for(;S<n;){let k=c[u],C=h+w*v<<3;for(;k<e;){if(r===1){let A=i[C>>3];A=A>>7-(C&7)&1,o[S*a+(k>>3)]|=A<<7-((k&7)<<0)}if(r===2){let A=i[C>>3];A=A>>6-(C&7)&3,o[S*a+(k>>2)]|=A<<6-((k&3)<<1)}if(r===4){let A=i[C>>3];A=A>>4-(C&7)&15,o[S*a+(k>>1)]|=A<<4-((k&1)<<2)}if(r>=8){const A=S*a+k*s;for(let x=0;x<s;x++)o[A+x]=i[(C>>3)+x]}C+=r,k+=p}w++,S+=g}_*y!==0&&(h+=y*(1+v)),u=u+1}return o},L.decode._getBPP=function(i){return[1,null,3,1,2,null,4][i.ctype]*i.depth},L.decode._filterZero=function(i,t,e,n,r){let s=L.decode._getBPP(t);const a=Math.ceil(n*s/8),o=L.decode._paeth;s=Math.ceil(s/8);let h=0,l=1,c=i[e],d=0;if(c>1&&(i[e]=[0,0,1][c-2]),c===3)for(d=s;d<a;d++)i[d+1]=i[d+1]+(i[d+1-s]>>>1)&255;for(let f=0;f<r;f++)if(h=e+f*a,l=h+f+1,c=i[l-1],d=0,c===0)for(;d<a;d++)i[h+d]=i[l+d];else if(c===1){for(;d<s;d++)i[h+d]=i[l+d];for(;d<a;d++)i[h+d]=i[l+d]+i[h+d-s]}else if(c===2)for(;d<a;d++)i[h+d]=i[l+d]+i[h+d-a];else if(c===3){for(;d<s;d++)i[h+d]=i[l+d]+(i[h+d-a]>>>1);for(;d<a;d++)i[h+d]=i[l+d]+(i[h+d-a]+i[h+d-s]>>>1)}else{for(;d<s;d++)i[h+d]=i[l+d]+o(0,i[h+d-a],0);for(;d<a;d++)i[h+d]=i[l+d]+o(i[h+d-s],i[h+d-a],i[h+d-s-a])}return i},L.decode._paeth=function(i,t,e){const n=i+t-e,r=n-i,s=n-t,a=n-e;return r*r<=s*s&&r*r<=a*a?i:s*s<=a*a?t:e},L.decode._IHDR=function(i,t,e){const n=L._bin;e.width=n.readUint(i,t),t+=4,e.height=n.readUint(i,t),t+=4,e.depth=i[t],t++,e.ctype=i[t],t++,e.compress=i[t],t++,e.filter=i[t],t++,e.interlace=i[t],t++},L._bin={nextZero:function(i,t){for(;i[t]!==0;)t++;return t},readUshort:function(i,t){return i[t]<<8|i[t+1]},writeUshort:function(i,t,e){i[t]=e>>8&255,i[t+1]=e&255},readUint:function(i,t){return i[t]*(256*256*256)+(i[t+1]<<16|i[t+2]<<8|i[t+3])},writeUint:function(i,t,e){i[t]=e>>24&255,i[t+1]=e>>16&255,i[t+2]=e>>8&255,i[t+3]=e&255},readASCII:function(i,t,e){let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(i[t+r]);return n},writeASCII:function(i,t,e){for(let n=0;n<e.length;n++)i[t+n]=e.charCodeAt(n)},readBytes:function(i,t,e){const n=[];for(let r=0;r<e;r++)n.push(i[t+r]);return n},pad:function(i){return i.length<2?"0"+i:i},readUTF8:function(i,t,e){let n="",r;for(let s=0;s<e;s++)n+="%"+L._bin.pad(i[t+s].toString(16));try{r=decodeURIComponent(n)}catch{return L._bin.readASCII(i,t,e)}return r}},L._copyTile=function(i,t,e,n,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 g=0;g<l;g++)if(a>=0&&o>=0?(d=u*t+g<<2,f=(o+u)*r+a+g<<2):(d=(-o+u)*t-a+g<<2,f=u*r+g<<2),h===0)n[f]=i[d],n[f+1]=i[d+1],n[f+2]=i[d+2],n[f+3]=i[d+3];else if(h===1){const p=i[d+3]*.00392156862745098,_=i[d]*p,y=i[d+1]*p,b=i[d+2]*p,m=n[f+3]*(1/255),v=n[f]*m,w=n[f+1]*m,S=n[f+2]*m,k=1-p,C=p+m*k,A=C===0?0:1/C;n[f+3]=255*C,n[f+0]=(_+v*k)*A,n[f+1]=(y+w*k)*A,n[f+2]=(b+S*k)*A}else if(h===2){const p=i[d+3],_=i[d],y=i[d+1],b=i[d+2],m=n[f+3],v=n[f],w=n[f+1],S=n[f+2];p===m&&_===v&&y===w&&b===S?(n[f]=0,n[f+1]=0,n[f+2]=0,n[f+3]=0):(n[f]=_,n[f+1]=y,n[f+2]=b,n[f+3]=p)}else if(h===3){const p=i[d+3],_=i[d],y=i[d+1],b=i[d+2],m=n[f+3],v=n[f],w=n[f+1],S=n[f+2];if(p===m&&_===v&&y===w&&b===S)continue;if(p<220&&m>20)return!1}return!0},L.encode=function(i,t,e,n,r,s,a){n===null&&(n=0),a===null&&(a=!1);const o=L.encode.compress(i,t,e,n,[!1,!1,!1,0,a]);return L.encode.compressPNG(o,-1),L.encode._main(o,t,e,r,s)},L.encodeLL=function(i,t,e,n,r,s,a,o){const h={ctype:0+(n===1?0:2)+(r===0?0:4),depth:s,frames:[]},l=(n+r)*s,c=l*t;for(let f=0;f<i.length;f++)h.frames.push({rect:{x:0,y:0,width:t,height:e},img:new Uint8Array(i[f]),blend:0,dispose:1,bpp:Math.ceil(l/8),bpl:Math.ceil(c/8)});return L.encode.compressPNG(h,0,!0),L.encode._main(h,t,e,a,o)},L.encode._main=function(i,t,e,n,r){r||(r={});const s=L.crc.crc,a=L._bin.writeUint,o=L._bin.writeUshort,h=L._bin.writeASCII;let l=8;const c=i.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),i.ctype===3){const _=i.plte.length;for(let y=0;y<_;y++)i.plte[y]>>>24!==255&&(d=!0);f+=8+_*3+4+(d?8+_*1+4:0)}for(let _=0;_<i.frames.length;_++){const y=i.frames[_];c&&(f+=38),f+=y.cimg.length+12,_!==0&&(f+=4)}f+=12;const u=new Uint8Array(f),g=[137,80,78,71,13,10,26,10];for(let _=0;_<8;_++)u[_]=g[_];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]=i.depth,l++,u[l]=i.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,i.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),i.ctype===3){const _=i.plte.length;a(u,l,_*3),l+=4,h(u,l,"PLTE"),l+=4;for(let y=0;y<_;y++){const b=y*3,m=i.plte[y],v=m&255,w=m>>>8&255,S=m>>>16&255;u[l+b+0]=v,u[l+b+1]=w,u[l+b+2]=S}if(l+=_*3,a(u,l,s(u,l-_*3-4,_*3+4)),l+=4,d){a(u,l,_),l+=4,h(u,l,"tRNS"),l+=4;for(let y=0;y<_;y++)u[l+y]=i.plte[y]>>>24&255;l+=_,a(u,l,s(u,l-_-4,_+4)),l+=4}}let p=0;for(let _=0;_<i.frames.length;_++){const y=i.frames[_];c&&(a(u,l,26),l+=4,h(u,l,"fcTL"),l+=4,a(u,l,p++),l+=4,a(u,l,y.rect.width),l+=4,a(u,l,y.rect.height),l+=4,a(u,l,y.rect.x),l+=4,a(u,l,y.rect.y),l+=4,o(u,l,n[_]),l+=2,o(u,l,1e3),l+=2,u[l]=y.dispose,l++,u[l]=y.blend,l++,a(u,l,s(u,l-30,30)),l+=4);const b=y.cimg,m=b.length;a(u,l,m+(_===0?0:4)),l+=4;const v=l;h(u,l,_===0?"IDAT":"fdAT"),l+=4,_!==0&&(a(u,l,p++),l+=4),u.set(b,l),l+=m,a(u,l,s(u,v,l-v)),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},L.encode.compressPNG=function(i,t,e){for(let n=0;n<i.frames.length;n++){const r=i.frames[n],s=r.rect.height,a=new Uint8Array(s*r.bpl+s);r.cimg=L.encode._filterZero(r.img,s,r.bpp,r.bpl,a,t,e)}},L.encode.compress=function(i,t,e,n,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 m=0;m<i.length;m++){const v=new Uint8Array(i[m]),w=v.length;for(let S=0;S<w;S+=4)f&=v[S+3]}const u=f!==255,g=L.encode.framize(i,t,e,s,a,o),p={},_=[],y=[];if(n!==0){const m=[];for(let C=0;C<g.length;C++)m.push(g[C].img.buffer);const v=L.encode.concatRGBA(m),w=L.quantize(v,n);let S=0;const k=new Uint8Array(w.abuf);for(let C=0;C<g.length;C++){const A=g[C].img,x=A.length;y.push(new Uint8Array(w.inds.buffer,S>>2,x>>2));for(let T=0;T<x;T+=4)A[T]=k[S+T],A[T+1]=k[S+T+1],A[T+2]=k[S+T+2],A[T+3]=k[S+T+3];S+=x}for(let C=0;C<w.plte.length;C++)_.push(w.plte[C].est.rgba)}else for(let m=0;m<g.length;m++){const v=g[m],w=new Uint32Array(v.img.buffer),S=v.rect.width,k=w.length,C=new Uint8Array(k);y.push(C);for(let A=0;A<k;A++){const x=w[A];if(A!==0&&x===w[A-1])C[A]=C[A-1];else if(A>S&&x===w[A-S])C[A]=C[A-S];else{let T=p[x];if(T===null&&(p[x]=T=_.length,_.push(x),_.length>=300))break;C[A]=T}}}const b=_.length;b<=256&&l===!1&&(b<=2?d=1:b<=4?d=2:b<=16?d=4:d=8,d=Math.max(d,h));for(let m=0;m<g.length;m++){const v=g[m],w=v.rect.width,S=v.rect.height;let k=v.img,C=4*w,A=4;if(b<=256&&l===!1){C=Math.ceil(d*w/8);const x=new Uint8Array(C*S),T=y[m];for(let M=0;M<S;M++){const D=M*C,O=M*w;if(d===8)for(let I=0;I<w;I++)x[D+I]=T[O+I];else if(d===4)for(let I=0;I<w;I++)x[D+(I>>1)]|=T[O+I]<<4-(I&1)*4;else if(d===2)for(let I=0;I<w;I++)x[D+(I>>2)]|=T[O+I]<<6-(I&3)*2;else if(d===1)for(let I=0;I<w;I++)x[D+(I>>3)]|=T[O+I]<<7-(I&7)*1}k=x,c=3,A=1}else if(u===!1&&g.length===1){const x=new Uint8Array(w*S*3),T=w*S;for(let M=0;M<T;M++){const D=M*3,O=M*4;x[D]=k[O],x[D+1]=k[O+1],x[D+2]=k[O+2]}k=x,c=2,A=3,C=3*w}v.img=k,v.bpl=C,v.bpp=A}return{ctype:c,depth:d,plte:_,frames:g}},L.encode.framize=function(i,t,e,n,r,s){const a=[];for(let o=0;o<i.length;o++){const h=new Uint8Array(i[o]),l=new Uint32Array(h.buffer);let c,d=0,f=0,u=t,g=e,p=n?1:0;if(o!==0){const _=s||n||o===1||a[o-2].dispose!==0?1:2;let y=0,b=1e9;for(let v=0;v<_;v++){const w=new Uint32Array(i[o-1-v]);let S=t,k=e,C=-1,A=-1;for(let T=0;T<e;T++)for(let M=0;M<t;M++){const D=T*t+M;l[D]!==w[D]&&(M<S&&(S=M),M>C&&(C=M),T<k&&(k=T),T>A&&(A=T))}C===-1&&(S=k=C=A=0),r&&((S&1)===1&&S--,(k&1)===1&&k--);const x=(C-S+1)*(A-k+1);x<b&&(b=x,y=v,d=S,f=k,u=C-S+1,g=A-k+1)}const m=new Uint8Array(i[o-1-y]);y===1&&(a[o-1].dispose=2),c=new Uint8Array(u*g*4),L._copyTile(m,t,e,c,u,g,-d,-f,0),p=L._copyTile(h,t,e,c,u,g,-d,-f,3)?1:0,p===1?L.encode._prepareDiff(h,t,e,c,{x:d,y:f,width:u,height:g}):L._copyTile(h,t,e,c,u,g,-d,-f,0)}else c=h.slice(0);a.push({rect:{x:d,y:f,width:u,height:g},img:c,blend:p,dispose:0})}if(n)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),g=Math.max(l.y+l.height,c.y+c.height),p={x:d,y:f,width:u-d,height:g-f};a[o-1].dispose=1,o-1!==0&&L.encode._updateFrame(i,t,e,a,o-1,p,r),L.encode._updateFrame(i,t,e,a,o,p,r)}return a},L.encode._updateFrame=function(i,t,e,n,r,s,a){const o=Uint8Array,h=Uint32Array,l=new o(i[r-1]),c=new h(i[r-1]),d=r+1<i.length?new o(i[r+1]):null,f=new o(i[r]),u=new h(f.buffer);let g=t,p=e,_=-1,y=-1;for(let m=0;m<s.height;m++)for(let v=0;v<s.width;v++){const w=s.x+v,S=s.y+m,k=S*t+w,C=u[k];C===0||n[r-1].dispose===0&&c[k]===C&&(d===null||d[k*4+3]!==0)||(w<g&&(g=w),w>_&&(_=w),S<p&&(p=S),S>y&&(y=S))}_===-1&&(g=p=_=y=0),a&&((g&1)===1&&g--,(p&1)===1&&p--),s={x:g,y:p,width:_-g+1,height:y-p+1};const b=n[r];b.rect=s,b.blend=1,b.img=new Uint8Array(s.width*s.height*4),n[r-1].dispose===0?(L._copyTile(l,t,e,b.img,s.width,s.height,-s.x,-s.y,0),L.encode._prepareDiff(f,t,e,b.img,s)):L._copyTile(f,t,e,b.img,s.width,s.height,-s.x,-s.y,0)},L.encode._prepareDiff=function(i,t,e,n,r){L._copyTile(i,t,e,n,r.width,r.height,-r.x,-r.y,2)},L.encode._filterZero=function(i,t,e,n,r,s,a){const o=[];let h=[0,1,2,3,4];s!==-1?h=[s]:(t*n>5e5||e===1)&&(h=[0]);let l;a&&(l={level:0});const c=r.length>1e7&&$l!=null?$l:ip;for(let u=0;u<h.length;u++){for(let g=0;g<t;g++)L.encode._filterLine(r,i,g,n,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]},L.encode._filterLine=function(i,t,e,n,r,s){const a=e*n;let o=a+e;const h=L.decode._paeth;if(i[o]=s,o++,s===0)if(n<500)for(let l=0;l<n;l++)i[o+l]=t[a+l];else i.set(new Uint8Array(t.buffer,a,n),o);else if(s===1){for(let l=0;l<r;l++)i[o+l]=t[a+l];for(let l=r;l<n;l++)i[o+l]=t[a+l]-t[a+l-r]+256&255}else if(e===0){for(let l=0;l<r;l++)i[o+l]=t[a+l];if(s===2)for(let l=r;l<n;l++)i[o+l]=t[a+l];if(s===3)for(let l=r;l<n;l++)i[o+l]=t[a+l]-(t[a+l-r]>>1)+256&255;if(s===4)for(let l=r;l<n;l++)i[o+l]=t[a+l]-h(t[a+l-r],0,0)+256&255}else{if(s===2)for(let l=0;l<n;l++)i[o+l]=t[a+l]+256-t[a+l-n]&255;if(s===3){for(let l=0;l<r;l++)i[o+l]=t[a+l]+256-(t[a+l-n]>>1)&255;for(let l=r;l<n;l++)i[o+l]=t[a+l]+256-(t[a+l-n]+t[a+l-r]>>1)&255}if(s===4){for(let l=0;l<r;l++)i[o+l]=t[a+l]+256-h(0,t[a+l-n],0)&255;for(let l=r;l<n;l++)i[o+l]=t[a+l]+256-h(t[a+l-r],t[a+l-n],t[a+l-r-n])&255}}},L.crc={table:function(){const i=new Uint32Array(256);for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e&1?e=3988292384^e>>>1:e=e>>>1;i[t]=e}return i}(),update:function(i,t,e,n){for(let r=0;r<n;r++)i=L.crc.table[(i^t[e+r])&255]^i>>>8;return i},crc:function(i,t,e){return L.crc.update(4294967295,i,t,e)^4294967295}},L.quantize=function(i,t){const e=new Uint8Array(i),n=e.slice(0),r=new Uint32Array(n.buffer),s=L.quantize.getKDtree(n,t),a=s[0],o=s[1],h=L.quantize.planeDst,l=e,c=r,d=l.length,f=new Uint8Array(e.length>>2);let u;if(e.length<2e7)for(let g=0;g<d;g+=4){const p=l[g]*.00392156862745098,_=l[g+1]*(1/255),y=l[g+2]*(1/255),b=l[g+3]*(1/255);u=L.quantize.getNearest(a,p,_,y,b),f[g>>2]=u.ind,c[g>>2]=u.est.rgba}else for(let g=0;g<d;g+=4){const p=l[g]*.00392156862745098,_=l[g+1]*(1/255),y=l[g+2]*(1/255),b=l[g+3]*(1/255);for(u=a;u.left;)u=h(u.est,p,_,y,b)<=0?u.left:u.right;f[g>>2]=u.ind,c[g>>2]=u.est.rgba}return{abuf:n.buffer,inds:f,plte:o}},L.quantize.getKDtree=function(i,t,e){e===null&&(e=1e-4);const n=new Uint32Array(i.buffer),r={i0:0,i1:i.length,bst:null,est:null,tdst:0,left:null,right:null};r.bst=L.quantize.stats(i,r.i0,r.i1),r.est=L.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=L.quantize.splitPixels(i,n,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=L.quantize.stats(i,d.i0,d.i1),d.est=L.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=L.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]},L.quantize.getNearest=function(i,t,e,n,r){if(i.left==null)return i.tdst=L.quantize.dist(i.est.q,t,e,n,r),i;const s=L.quantize.planeDst(i.est,t,e,n,r);let a=i.left,o=i.right;s>0&&(a=i.right,o=i.left);const h=L.quantize.getNearest(a,t,e,n,r);if(h.tdst<=s*s)return h;const l=L.quantize.getNearest(o,t,e,n,r);return l.tdst<h.tdst?l:h},L.quantize.planeDst=function(i,t,e,n,r){const s=i.e;return s[0]*t+s[1]*e+s[2]*n+s[3]*r-i.eMq},L.quantize.dist=function(i,t,e,n,r){const s=t-i[0],a=e-i[1],o=n-i[2],h=r-i[3];return s*s+a*a+o*o+h*h},L.quantize.splitPixels=function(i,t,e,n,r,s){const a=L.quantize.vecDot;for(n-=4;e<n;){for(;a(i,e,r)<=s;)e+=4;for(;a(i,n,r)>s;)n-=4;if(e>=n)break;const o=t[e>>2];t[e>>2]=t[n>>2],t[n>>2]=o,e+=4,n-=4}for(;a(i,e,r)>s;)e-=4;return e+4},L.quantize.vecDot=function(i,t,e){return i[t]*e[0]+i[t+1]*e[1]+i[t+2]*e[2]+i[t+3]*e[3]},L.quantize.stats=function(i,t,e){const n=[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=i[a]*.00392156862745098,h=i[a+1]*(1/255),l=i[a+2]*(1/255),c=i[a+3]*(1/255);r[0]+=o,r[1]+=h,r[2]+=l,r[3]+=c,n[0]+=o*o,n[1]+=o*h,n[2]+=o*l,n[3]+=o*c,n[5]+=h*h,n[6]+=h*l,n[7]+=h*c,n[10]+=l*l,n[11]+=l*c,n[15]+=c*c}return n[4]=n[1],n[8]=n[2],n[9]=n[6],n[12]=n[3],n[13]=n[7],n[14]=n[11],{R:n,m:r,N:s}},L.quantize.estats=function(i){const t=i.R,e=i.m,n=i.N,r=e[0],s=e[1],a=e[2],o=e[3],h=n===0?0:1/n,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=L.M4;let f=[Math.random(),Math.random(),Math.random(),Math.random()],u=0,g=0;if(n!==0)for(let y=0;y<16&&(f=d.multVec(c,f),g=Math.sqrt(d.dot(f,f)),f=d.sml(1/g,f),!(y!==0&&Math.abs(g-u)<1e-9));y++)u=g;const p=[r*h,s*h,a*h,o*h],_=d.dot(d.sml(255,p),f);return{Cov:l,q:p,e:f,L:u,eMq255:_,eMq:d.dot(f,p),rgba:(Math.round(255*p[3])<<24|Math.round(255*p[2])<<16|Math.round(255*p[1])<<8|Math.round(255*p[0])<<0)>>>0}},L.M4={multVec:function(i,t){return[i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3],i[4]*t[0]+i[5]*t[1]+i[6]*t[2]+i[7]*t[3],i[8]*t[0]+i[9]*t[1]+i[10]*t[2]+i[11]*t[3],i[12]*t[0]+i[13]*t[1]+i[14]*t[2]+i[15]*t[3]]},dot:function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},sml:function(i,t){return[i*t[0],i*t[1],i*t[2],i*t[3]]}},L.encode.concatRGBA=function(i){let t=0;for(let r=0;r<i.length;r++)t+=i[r].byteLength;const e=new Uint8Array(t);let n=0;for(let r=0;r<i.length;r++){const s=new Uint8Array(i[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[n+o]=h,e[n+o+1]=l,e[n+o+2]=c,e[n+o+3]=d}n+=a}return e.buffer};const ur=new Map,Ma=(i,t)=>{if(ur.has(i))return t(null,ur.get(i));const e=new Image;e.onload=function(){ur.set(i,{width:e.width,height:e.height,element:e}),t(null,ur.get(i))},e.onerror=function(n){t(n,null)},e.src=i},Ra=(i,t)=>{Ma(i,(e,n)=>{if(!n)return t(e,null);const r=document.createElement("canvas"),s=r.getContext("2d");return r.width=n.width,r.height=n.height,s.drawImage(n.element,0,0,r.width,r.height),s.getImageData(0,0,r.width,r.height)})},np=(i,t)=>{for(let e=0,n=i.length;e<n;e++){const r=i[e],{type:s}=r;if(s.split("/")[0]!=="image")return;let o;const h=new FileReader;h.onload=function(l){if(!l.target)return t("no reader target",null);const c=l.target.result;o=Co(c);const f=new Blob([c]);Da(f,(u,g)=>{if(!g)return t(u,null);Ma(g,(p,_)=>{if(!_)return t(p,null);Ra(g,(y,b)=>{if(!b)return t(y,null);const m={name:r.name,fileType:o,size:r.size,width:_.width,height:_.height,imgUrl:g,imageData:b,blob:f};return t(null,m)})})})},h.readAsArrayBuffer(r)}},rp=(i,t=0,e=0)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.drawImage(i,0,0,t,e),r.getImageData(0,0,t,e)},sp=(i,t=0,e=0)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.drawImage(i,0,0,t,e),r.getImageData(0,0,t,e)},ap=i=>{const t=i.width,e=i.height,n=t*e*3,r=n+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,n&255,n>>8&255,n>>16&255,n>>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=i.data;let l="";const c=t<<2;let d=e;const f=String.fromCharCode;do{const g=c*(d-1);let p="";for(let _=0;_<t;_++){const y=_<<2;p+=f(h[g+y+2])+f(h[g+y+1])+f(h[g+y])}for(let _=0;_<o;_++)p+=String.fromCharCode(0);l+=p}while(--d);function u(g){if(!window.btoa)throw"btoa undefined";let p="";if(typeof g=="string")p=g;else for(let _=0;_<g.length;_++)p+=String.fromCharCode(g[_]);return btoa(p)}return u(s.concat(a))+u(l)},op=i=>{const{width:t,height:e}=i,n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.putImageData(i,0,0,0,0,t,e),n.toDataURL("image/png")},lp=(i,t,e)=>{const{width:n,height:r}=i,s=document.createElement("canvas"),a=s.getContext("2d");s.width=n,s.height=r,a.putImageData(i,0,0,0,0,n,r);const o=`image/${t?t.toLowerCase():"png"}`;s.toBlob(h=>{e?.(null,h)},o,1)},Da=(i,t)=>{const e=new FileReader;e.onload=function(n){n.target?t(null,n.target.result):t("can't readAsDataURL",null)},e.readAsDataURL(i)},hp=(i,t)=>{Da(i,function(e,n){if(n){const r=new Image;r.src=n}else t(e)})};function cp(i,t){Ra(i,(e,n)=>{if(!n)return t(e,null);const r=n.data;let s=0;const a=[],o=[],h=[];for(let f=0;f<r.length;f+=4)a[s]=r[f],o[s]=r[f+1],h[s]=r[f+2],s+=1;const l=La(a),c=La(o),d=La(h);return t(null,"rgb("+l+","+c+","+d+")")})}function La(i){const t={},e=[],n=[];for(let o=0;o<i.length;o++)t[i[o]]?e.push(i[o]):t[i[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),n[o]=r}const s=Math.max.apply(null,n);let a=0;for(;a<n.length;a++)if(n[a]===s)return;return e[a]}const up=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},dp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;r[h]=t[((n-a-1)*e+o)*4],r[h+1]=t[((n-a-1)*e+o)*4+1],r[h+2]=t[((n-a-1)*e+o)*4+2],r[h+3]=t[((n-a-1)*e+o)*4+3]}return new ImageData(r,e,n)},fp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<n;o++){const h=(a*n+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,n,e)},gp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<n;o++){const h=(a*n+o)*4;r[h]=t[((n-o-1)*e+a)*4],r[h+1]=t[((n-o-1)*e+a)*4+1],r[h+2]=t[((n-o-1)*e+a)*4+2],r[h+3]=t[((n-o-1)*e+a)*4+3]}return new ImageData(r,n,e)},pp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},mp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},_p=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},vp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},yp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},bp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},wp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},Sp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},Cp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},xp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},Tp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},Ep=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},kp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},Ap=i=>fc(i,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Pp=i=>fc(i,[-1,-1,-1,-1,8,-1,-1,-1,-1]),Mp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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,n)},Rp=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;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=gc([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,n)},Dp=(i,t,e,n,r,s=!1,a)=>{const{data:o,width:h,height:l}=i;let c=r,d=n,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 g=new Uint8ClampedArray(o.length);for(let _=0;_<l;_++)for(let y=0;y<h;y++){const b=(_*h+y)*4;y>=c&&y<=c+f&&_>=d&&_<=d+u?(g[b]=o[b],g[b+1]=o[b+1],g[b+2]=o[b+2],g[b+3]=o[b+3]):(g[b]=255,g[b+1]=255,g[b+2]=255,g[b+3]=a&&["JPG","JPEG"].includes(a.toUpperCase())?255:0)}return new ImageData(g,h,l)}else{const g=new Uint8ClampedArray(f*u*4);for(let _=d;_<=d+u;_++)for(let y=c;y<=c+f;y++){const b=((_-d)*f+y-c)*4,m=(_*h+y)*4;g[b]=o[m],g[b+1]=o[m+1],g[b+2]=o[m+2],g[b+3]=o[m+3]}return new ImageData(g,f,u)}},Lp=(i,t,e,n)=>{const{data:r,width:s,height:a}=i;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]=n||e.toUpperCase()==="PNG"?0:255):(h[f]=r[f],h[f+1]=r[f+1],h[f+2]=r[f+2],h[f+3]=n||e.toUpperCase()==="PNG"?r[f+3]:255)}return new ImageData(h,s,a)},Op=(i,t,e,n,r,s=1e4)=>{const a=new Image;a.src=i;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,n,r),h.getImageData(0,0,n,r)},Ip=(i,t)=>{const{data:e,width:n,height:r}=i,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let h=0;h<n;h++){const l=(o*n+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,n,r)},Fp=(i,t,e=!1)=>{const{data:n,width:r,height:s}=i,a=new Uint8ClampedArray(n.length);for(let h=0;h<s;h++)for(let l=0;l<r;l++){const c=(h*r+l)*4;n[c+3]===0?(a[c]=255,a[c+1]=255,a[c+2]=255):(a[c]=n[c],a[c+1]=n[c+1],a[c+2]=n[c+2]);let d=n[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)},Np=(i,t,e,n)=>{const{data:r,width:s,height:a}=i,{data:o,width:h,height:l}=t;let c=e,d=n;e+l>a&&(c=a-l),n+h>s&&(d=s-h);const f=new Uint8ClampedArray(r.length);for(let g=0;g<a;g++)for(let p=0;p<s;p++){const _=(g*s+p)*4;if(p<d||p>d+h||g<=c||g>=c+l)f[_]=r[_],f[_+1]=r[_+1],f[_+2]=r[_+2],f[_+3]=r[_+3];else{const y=(g*s+p-((c+1)*s+(g-(c+1))*(s-h))+h-d-1)*4,b=[o[y],o[y+1],o[y+2],o[y+3]],m=[r[_],r[_+1],r[_+2],r[_+3]],v=gc(b,m);f[_]=v[0],f[_+1]=v[1],f[_+2]=v[2],f[_+3]=v[3]}}return new ImageData(f,s,a)},Up=(i,t,e,n,r,s=10)=>{const{data:a,width:o,height:h}=i;let l=r,c=n,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 p=0;p<h;p++)for(let _=0;_<o;_++){const y=(p*o+_)*4;if(_>=l&&_<=l+d&&p>=c&&p<=c+f){const b=Math.floor((_-l)/s),m=Math.floor((p-c)/s);let v=Math.floor(s*(b+1)-s/2+l),w=Math.floor(s*(m+1)-s/2+c);v>o-1&&(v=o-1),w>h-1&&(w=h-1);const S=(w*o+v)*4;u[y]=a[S],u[y+1]=a[S+1],u[y+2]=a[S+2],u[y+3]=a[S+3]}else u[y]=a[y],u[y+1]=a[y+1],u[y+2]=a[y+2],u[y+3]=a[y+3]}return new ImageData(u,o,h)},Gp=async(i,t,e,n,r,s)=>{const a=r/100;if(["JPG","JPEG"].includes(n.toUpperCase())){const o=new Image;o.src=i;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/${n.toLowerCase()}`,a)}else{const o=Math.floor(a*256),h=L.encode([i.data.buffer],t,e,o),l=new Blob([h]);s&&s(l)}},Bp=(i,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:n,width:r,height:s}=i,{data:a}=t,o=new Uint8ClampedArray(n.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,g=a[u],p=a[u+1],_=a[u+2],y=a[u+3];g===h.r&&p===h.g&&_===h.b&&y===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]=n[u],o[u+1]=n[u+1],o[u+2]=n[u+2],o[u+3]=n[u+3])}return new ImageData(o,r,s)}return i},fc=(i,t)=>{const{data:e,width:n,height:r}=i,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let h=0;h<n;h++){const l=(o*n+h)*4;for(let c=0;c<3;c++){const d=l+c;h===0||h===n-1||o===0||o===r-1?s[d]=e[d]:s[d]=t[0]*e[d-n*4-4]+t[1]*e[d-n*4]+t[2]*e[d-n*4+4]+t[3]*e[d-4]+t[4]*e[d]+t[5]*e[d+4]+t[6]*e[d+n*4-4]+t[7]*e[d+n*4]+t[8]*e[d+n*4+4]}s[l+3]=e[l+3]}return new ImageData(s,n,r)},gc=(i,t)=>{if(i&&i.length===4&&t&&t.length===4){const e=i[3],n=t[3];if(e===255||n===0)return i;if(e===0)return t;{const r=e/255,s=n/255,a=Math.max(Math.min(Math.floor(i[0]*r+t[0]*s*(1-r)),255),0),o=Math.max(Math.min(Math.floor(i[1]*r+t[1]*s*(1-r)),255),0),h=Math.max(Math.min(Math.floor(i[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]},pc=function(i,t,e){const n=new Array(i*i),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 _=0;_<h;_++)d.add(String.fromCharCode(_));d.add(String.fromCharCode(h)),d.add(String.fromCharCode(l));const f=xo(),u=r(f);u.write(h,c);let g=0,p=String.fromCharCode(n[g]);for(g+=1;g<n.length;){const _=String.fromCharCode(n[g]);g+=1,d.contains(p+_)?p=p+_:(u.write(d.indexOf(p),c),d.size()<4095&&(d.size()==1<<c&&(c+=1),d.add(p+_)),p=_)}return u.write(d.indexOf(p),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){n[h*i+o]=l},write(o){o.writeString("GIF87a"),o.writeShort(i),o.writeShort(i),o.writeByte(128),o.writeByte(0),o.writeByte(0),o.writeByte(ui("0x"+t[1]+t[2])),o.writeByte(ui("0x"+t[3]+t[4])),o.writeByte(ui("0x"+t[5]+t[6])),o.writeByte(ui("0x"+e[1]+e[2])),o.writeByte(ui("0x"+e[3]+e[4])),o.writeByte(ui("0x"+e[5]+e[6])),o.writeString(","),o.writeShort(0),o.writeShort(0),o.writeShort(i),o.writeShort(i),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(";")}}},mc=function(i,t,e,n){const r=pc(i,t,e);for(let l=0;l<i;l++)for(let c=0;c<i;c++)r.setPixel(c,l,n(c,l));const s=xo();r.write(s);const a=ad(),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},It={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},yn={M:0,L:1,H:2,Q:3},Me={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Et={glog:function(i){if(i<1)throw new Error("glog("+i+")");return Et.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return Et.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(let i=0;i<8;i++)Et.EXP_TABLE[i]=1<<i;for(let i=8;i<256;i++)Et.EXP_TABLE[i]=Et.EXP_TABLE[i-4]^Et.EXP_TABLE[i-5]^Et.EXP_TABLE[i-6]^Et.EXP_TABLE[i-8];for(let i=0;i<255;i++)Et.LOG_TABLE[Et.EXP_TABLE[i]]=i;const ut={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(i){let t=i<<10;for(;ut.getBCHDigit(t)-ut.getBCHDigit(ut.G15)>=0;)t^=ut.G15<<ut.getBCHDigit(t)-ut.getBCHDigit(ut.G15);return(i<<10|t)^ut.G15_MASK},getBCHTypeNumber:function(i){let t=i<<12;for(;ut.getBCHDigit(t)-ut.getBCHDigit(ut.G18)>=0;)t^=ut.G18<<ut.getBCHDigit(t)-ut.getBCHDigit(ut.G18);return i<<12|t},getBCHDigit:function(i){let t=0;for(;i!=0;)t++,i>>>=1;return t},getPatternPosition:function(i){return ut.PATTERN_POSITION_TABLE[i-1]},getMask:function(i,t,e){switch(i){case Me.PATTERN000:return(t+e)%2==0;case Me.PATTERN001:return t%2==0;case Me.PATTERN010:return e%3==0;case Me.PATTERN011:return(t+e)%3==0;case Me.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2==0;case Me.PATTERN101:return t*e%2+t*e%3==0;case Me.PATTERN110:return(t*e%2+t*e%3)%2==0;case Me.PATTERN111:return(t*e%3+(t+e)%2)%2==0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){let t=new xi([1],0);for(let e=0;e<i;e++)t=t.multiply(new xi([1,Et.gexp(e)],0));return t},getLengthInBits:function(i,t){if(1<=t&&t<10)switch(i){case It.MODE_NUMBER:return 10;case It.MODE_ALPHA_NUM:return 9;case It.MODE_8BIT_BYTE:return 8;case It.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(t<27)switch(i){case It.MODE_NUMBER:return 12;case It.MODE_ALPHA_NUM:return 11;case It.MODE_8BIT_BYTE:return 16;case It.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(t<41)switch(i){case It.MODE_NUMBER:return 14;case It.MODE_ALPHA_NUM:return 13;case It.MODE_8BIT_BYTE:return 16;case It.MODE_KANJI:return 12;default:throw new Error("mode:"+i)}else throw new Error("type:"+t)},getLostPoint:function(i){const t=i.getModuleCount();let e=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++){let o=0;const h=i.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==i.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;i.isDark(s,a)&&o++,i.isDark(s+1,a)&&o++,i.isDark(s,a+1)&&o++,i.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++)i.isDark(s,a)&&!i.isDark(s,a+1)&&i.isDark(s,a+2)&&i.isDark(s,a+3)&&i.isDark(s,a+4)&&!i.isDark(s,a+5)&&i.isDark(s,a+6)&&(e+=40);for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)i.isDark(a,s)&&!i.isDark(a+1,s)&&i.isDark(a+2,s)&&i.isDark(a+3,s)&&i.isDark(a+4,s)&&!i.isDark(a+5,s)&&i.isDark(a+6,s)&&(e+=40);let n=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++)i.isDark(a,s)&&n++;const r=Math.abs(100*n/t/t-50)/5;return e+=r*10,e}};class xi{num;constructor(t,e){if(t.length==null)throw new Error(t.length+"/"+e);let n=0;for(;n<t.length&&t[n]==0;)n++;this.num=new Array(t.length-n+e);for(let r=0;r<t.length-n;r++)this.num[r]=t[r+n]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let n=0;n<this.getLength();n++)for(let r=0;r<t.getLength();r++)e[n+r]^=Et.gexp(Et.glog(this.get(n))+Et.glog(t.get(r)));return new xi(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=Et.glog(this.get(0))-Et.glog(t.get(0)),n=new Array(this.getLength());for(let r=0;r<this.getLength();r++)n[r]=this.get(r);for(let r=0;r<t.getLength();r++)n[r]^=Et.gexp(Et.glog(t.get(r))+e);return new xi(n,0).mod(t)}}class he{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 n=he.getRsBlockTable(t,e);if(n==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);const r=n.length/3,s=[];for(let a=0;a<r;a++){const o=n[a*3+0],h=n[a*3+1],l=n[a*3+2];for(let c=0;c<o;c++)s.push(new he(h,l))}return s}static getRsBlockTable(t,e){switch(e){case yn.L:return he.RS_BLOCK_TABLE[(t-1)*4+0];case yn.M:return he.RS_BLOCK_TABLE[(t-1)*4+1];case yn.Q:return he.RS_BLOCK_TABLE[(t-1)*4+2];case yn.H:return he.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}class _c{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 n=0;n<e;n++)this.putBit((t>>>e-n-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 zp{mode;data;constructor(t){this.mode=It.MODE_8BIT_BYTE,this.data=t}getLength(){return this.data.length}write(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data.charCodeAt(e),8)}}class Re{static PAD0=236;static PAD1=17;typeNumber;errorCorrectLevel;modules;moduleCount;dataCache;dataList;constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=yn[e],this.modules=[],this.moduleCount=0,this.dataCache=null,this.dataList=[]}addData(t){const e=new zp(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=he.getRSBlocks(t,this.errorCorrectLevel),n=new _c;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];n.put(a.mode,4),n.put(a.getLength(),ut.getLengthInBits(a.mode,t)),a.write(n)}if(n.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 n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(let r=0;r<this.moduleCount;r++)this.modules[n][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=Re.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let n=-1;n<=7;n++)if(!(t+n<=-1||this.moduleCount<=t+n))for(let r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[t+n][e+r]=!0:this.modules[t+n][e+r]=!1)}getBestMaskPattern(){let t=0,e=0;for(let n=0;n<8;n++){this.makeImpl(!0,n);const r=ut.getLostPoint(this);(n==0||t>r)&&(t=r,e=n)}return e}createMovieClip(t,e,n){const r=t.createEmptyMovieClip(e,n),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=ut.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let n=0;n<t.length;n++){const r=t[e],s=t[n];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=ut.getBCHTypeNumber(this.typeNumber);for(let n=0;n<18;n++){const r=!t&&(e>>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(let n=0;n<18;n++){const r=!t&&(e>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}}setupTypeInfo(t,e){const n=this.errorCorrectLevel<<3|e,r=ut.getBCHTypeInfo(n);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 n=-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),ut.getMask(e,r,o-h)&&(l=!l),this.modules[r][o-h]=l,s--,s==-1&&(a++,s=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}}static createData(t,e,n){const r=he.getRSBlocks(t,e),s=new _c;for(let o=0;o<n.length;o++){const h=n[o];s.put(h.mode,4),s.put(h.getLength(),ut.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(Re.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Re.PAD1,8);return Re.createBytes(s,r)}static createBytes(t,e){let n=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 y=0;y<a[d].length;y++)a[d][y]=255&t.buffer[y+n];n+=f;const g=ut.getErrorCorrectPolynomial(u),_=new xi(a[d],g.getLength()-1).mod(g);o[d]=new Array(g.getLength()-1);for(let y=0;y<o[d].length;y++){const b=y+_.getLength()-o[d].length;o[d][y]=b>=0?_.get(b):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 vc=Math.ceil,bn=Math.floor,yc=Math.round;function Hp(i,t){const e=So(i),n=t?.ecc||"H",r=t?.size||256,s=-1,a=t?.padding||0,o=t?.color||"#000000",h=t?.background||"#ffffff",l=new Re(s,n);l.addData(e),l.make();const c=l.getModuleCount(),d=(r-a*2)/c,f=a,u=r-a;return mc(r,o,h,function(g,p){if(f<=g&&g<u&&f<=p&&p<u){const _=bn((g-f)/d),y=bn((p-f)/d);return l.isDark(y,_)?0:1}else return 1})}function jp(i,t){const e=t.x||0,n=t.y||0,r=So(i),s=t.ctx,a=t.ecc||"H",o=typeof t.size=="number"?bn(t.size):256,h=t.padding||0,l=-1,c=t.color||"#000000",d=t.background||"#ffffff",f=new Re(l,a);f.addData(r),f.make();const u=f.getModuleCount(),g=(o-h*2)/u;s.fillStyle=d,s.fillRect(e,n,o,o);for(let p=0;p<u;p++)for(let _=0;_<u;_++){const y=vc((_+1)*g)-bn(_*g),b=vc((p+1)*g)-bn(p*g);s.fillStyle=f.isDark(p,_)?c:d,s.fillRect(e+yc(_*g)+h,n+yc(p*g)+h,y,b)}}function bc(){let i=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{i=new window.ActiveXObject(t[e]);break}catch{continue}}else i=new XMLHttpRequest;return i}function Vp(i){if(!i.action)return;const t=i.method.toLowerCase()==="get",e=i.method.toLowerCase()==="post";let n=i.action,r=null;const s="---------------------------"+Date.now().toString(16);if(window.FormData)r=new FormData(i),t&&(n=Zs(n,Gl(r)));else if(t){let a="";for(let o=0;o<i.elements.length;o++){const h=i.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;c<h.files.length;a+="&"+encodeURIComponent(h.name)+"="+encodeURIComponent(h.files[c++].name));else(l!=="RADIO"&&l!=="CHECKBOX"||h.checked)&&(a+="&"+encodeURIComponent(h.name)+"="+encodeURIComponent(h.value))}n=Zs(n,a)}else if(e){let a=[];if(i.enctype==="application/x-www-form-urlencoded"){for(let o=0;o<i.elements.length;o++){const h=i.elements[o];h.hasAttribute("name")&&a.push(encodeURIComponent(h.name)+"="+encodeURIComponent(h.value))}r=a.join()}else if(i.enctype==="text/plain"){for(let o=0;o<i.elements.length;o++){const h=i.elements[o];h.hasAttribute("name")&&a.push(h.name+"="+h.value)}r=a.join(`\r
|
|
15
|
-
`)}else if(i.enctype==="multipart/form-data"){for(let o=0;o<i.elements.length;o++){const
|
|
14
|
+
})`}static safeHtml(t,e="encode"){const n={"&":"&","<":"<",">":">",""":'"',"'":"'"};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t=t.replace(new RegExp(e=="decode"?r:n[r],"g"),e=="decode"?n[r]:r));return t}static loadScript(t){const e=document.createElement("script");e.type="text/javascript",e.src=t,e.async=!1,document.body.appendChild(e),e.onload=()=>{},e.onerror=()=>{}}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 n=document.styleSheets.length??0;const r=()=>n>=e.length?(t(),!0):!1;r()||e.forEach(s=>{s.onload=()=>{n+=1,r()}})});static lazyloadImages(){const t=document.getElementsByTagName("img"),e=ca().height;let n=0;return()=>{for(let r=n;r<t.length;r++)t[r].getBoundingClientRect().top<e&&(t[r].src=t[r].getAttribute("data-src")??"",n=r+1)}}static iframePostMessage(t,e="http://test.com/localstorage.html"){const n=document.createElement("iframe");n.src=e,document.body.append(n),setTimeout(function(){n.contentWindow?.postMessage(t,e)},4e3),setTimeout(function(){n.remove()},6e3)}static getTextWidth=(t,e,n=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=n.toString(),r.innerText=t,document.body.appendChild(r);const s=r.offsetWidth;return document.body.removeChild(r),s};static getFixedWidthText=(t,e,n=12,r=400,s=!0)=>{let a="",o="",l="";if(!t||e<n||typeof t!="string")return a;const h=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=n>12?n+"px":"12px",c.style.fontWeight=r.toString(),document.body.appendChild(c);for(let d=0,f=h.length;d<f;d++){const u=h[d];if(o=l,l+=u,a=l,c.innerText=l,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(n=>{t(n.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)}function ru(i,t=document){return new me(i,t)}class me{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}`)}get(t){return this.nodes[t]}concat(t){return new me(this.nodes.concat(t.nodes),this.context)}then(t){return t(this)??this}each(t){return this.nodes.forEach((e,n)=>{t(e,n)}),this}on(t,e,n){return this.nodes.forEach(r=>{r.addEventListener(t,e,n)}),this}off(t,e,n){return this.nodes.forEach(r=>{r.removeEventListener(t,e,n)}),this}dispatchEvent(t,e){let n;const r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return typeof t=="string"?r.includes(t)?n=new MouseEvent(t,e):s.includes(t)?n=new KeyboardEvent(t,e):n=new Event(t,e):n=t,this.nodes.forEach(a=>{a.dispatchEvent(n)}),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(n=>{const r=me._scriptConvert(n);r!=n&&e.content.replaceChild(r,n)}),e.content}static _scriptConvert(t){const e=n=>{const s=n.ownerDocument.createElement("script");s.text=n.text;const a=n.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(n=>{n.parentNode?.replaceChild(e(n),n)}),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 me.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){return this.nodes.forEach(n=>{n[t](me._fragment(e))}),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(n=>{e.push(...Array.from(n.querySelectorAll(t)))}),new me(e,this.context)}filter(t){const e=[];return this.nodes.forEach(n=>{n.matches&&n.matches(t)&&e.push(n)}),new me(e,this.context)}next(){const t=[];return this.nodes.forEach(e=>{const n=e.nextElementSibling;n&&t.push(n)}),new me(t,this.context)}prev(){const t=[];return this.nodes.forEach(e=>{const n=e.previousElementSibling;n&&t.push(n)}),new me(t,this.context)}closest(t){const e=[];return this.nodes.forEach(n=>{const r=n.closest(t);r&&e.push(r)}),new me(e,this.context)}shadow(t){const e=[];this.nodes.forEach(r=>{r.shadowRoot&&e.push(r.shadowRoot)});const n=new me(e,this.context);return t!==void 0?n.find(t):n}parent(t){return this.parents(t,!0)}parents(t,e=!1){const n=[],r=a=>{if(n.indexOf(a)==-1&&n.push(a),!e&&a.parentElement)return r(a.parentElement)};this.nodes.forEach(a=>{a.parentElement&&r(a.parentElement)});const s=new me(n,this.context);return t!==void 0?s.filter(t):s}static getComputedStyle(t,e,n){let r;const s=t.style.getPropertyPriority(e);return"getComputedStyle"in window?(r=getComputedStyle.call(window,t,n),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 n=this.nodes[0].style;if(typeof t=="string"){const r=n.getPropertyPriority(t);return n.getPropertyValue(t)+(r?"!"+r:"")}else return Object.fromEntries(this.nodes[0].style.cssText.split(";").filter(r=>!!r).map(r=>r.split(":").map(s=>s.trim())))}else{let n={};return typeof t=="string"&&e!==void 0?n[t]=e:typeof t=="object"&&(n=t),this.nodes.forEach(r=>{Object.keys(n).forEach(s=>{const a=String(n[s]).toLowerCase().includes("!important")?"important":"";r.style.setProperty(s,String(n[s]).replace(/!important/i,""),a)})}),this}}addClass(t){return this.toggleClass(t,!0)}removeClass(t){return this.toggleClass(t,!1)}toggleClass(t,e){const n=t.split(/[,\s]+/);return this.nodes.forEach(r=>{n.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 n=!1;return this.nodes.forEach(r=>{n=n||e.every(s=>Array.from(r.classList??[]).includes(s.trim()))}),n}attr(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0].getAttribute(t);let n={};return typeof t=="object"?n=t:e!==void 0&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}removeAttr(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{n.removeAttribute(r)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this.nodes[0][t];{let n={};return typeof t=="object"?n=t:typeof t=="string"&&e!==void 0&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).forEach(([s,a])=>{const o=me._fixProp(s);r[o]=a,o=="innerHTML"&&me._scriptConvert(r)})}),this}}removeProp(t){const e=t.split(/[,\s]+/);return this.nodes.forEach(n=>{e.forEach(r=>{delete n[me._fixProp(r)]})}),this}changeSelected(t){this.nodes.forEach(e=>{if(e instanceof HTMLSelectElement){const n=e.options;for(let r=0,s=n.length;r<s;r++)n[r].value==t?n[r].selected=!0:n[r].selected=!1}})}changeChecked(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 n=Object.assign({},this.nodes[0].dataset);return Object.keys(n).forEach(r=>{if(n[r]?.startsWith("[")||n[r]?.startsWith("{"))try{n[r]=JSON.parse(n[r]??"")}catch{}}),typeof t=="string"?n[t]:n}else{let n={};return typeof t=="object"?n=t:typeof t=="string"&&(n[t]=e),this.nodes.forEach(r=>{Object.entries(n).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(n=>{e.forEach(r=>{delete n.dataset[r]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.nodes.forEach(e=>{const n=e.style.display,r=getComputedStyle(e).display,s=n=="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=a}!s&&(t==null||t===!1)&&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 ua{isMacOS=Jc();constructor(){}capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}getFormatKeys(t){const e=[];return t.ctrl&&e.push(this.isMacOS?"Cmd":"Ctrl"),t.shift&&e.push(this.isMacOS?"Option":"Shift"),t.alt&&e.push("Alt"),typeof t.key=="string"?e.push(this.capitalize(t.key)):Array.isArray(t.key)&&(t.key.map(n=>this.capitalize(n)),e.push(...t.key)),e}matchKeyScheme(t,e){const n=t.ctrl??!1,r=t.shift??!1,s=t.alt??!1;if(t.exact)return(n===e.metaKey||n===e.ctrlKey)&&r===e.shiftKey&&s===e.altKey;const a=[];return n&&a.push(n===e.metaKey||n===e.ctrlKey),r&&a.push(r===e.shiftKey),s&&a.push(s===e.altKey),a.every(o=>o)}on(t,e){const n=t?.target??window;if(t?.key===void 0||t?.key===null)return e;const r=this.getFormatKeys(t);let s=!1;const a=o=>{if(o.stopPropagation(),!s&&o.key!=="Control"&&o.key!=="Shift"&&o.key!=="Alt"&&r.find(l=>l.toLowerCase()===o.key.toLowerCase())&&this.matchKeyScheme(t,o)){o.preventDefault();const l=e();if(typeof l!="function")return;const h=c=>{c.preventDefault(),l(),n.removeEventListener("keyup",h)};n.addEventListener("keyup",h)}};return n.addEventListener("keydown",a),e.keys=r,e.title=t?.title??"",e.pause=()=>s=!0,e.unpause=()=>s=!1,e.removeListener=()=>n.removeEventListener("keydown",a),e}static getKeyCode(t){const e=t.code||(t.keyCode||t.charCode).toString();return{code:e,key:t.key.toLowerCase()||ua.codeKeys[e]}}static codeKeys={8:"backspace",9:"tab",13:"enter",15:"command",16:"shift",17:"ctrl",18:"alt",19:"pause_break",20:"caps_lock",21:"numpad",27:"escape",32:"spacebar",33:"page_up",34:"page_down",35:"end",36:"home",37:"left_arrow",38:"up_arrow",39:"right_arrow",40:"down_arrow",45:"insert",46:"delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",91:"left_window_key",92:"right_window_key",93:"select_key",96:"numpad_0",97:"numpad_1",98:"numpad_2",99:"numpad_3",100:"numpad_4",101:"numpad_5",102:"numpad_6",103:"numpad_7",104:"numpad_8",105:"numpad_9",106:"multiply",107:"add",109:"subtract",110:"decimal_point",111:"divide",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",124:"f13",125:"f14",126:"f15",144:"num_lock",145:"scroll_lock",186:"semi_colon",187:"equal_sign",188:"comma",189:"dash",190:"period",191:"forward_slash",192:"grave_accent",219:"open_bracket",220:"back_slash",221:"close_braket",222:"single_quote"}}class zo{static clickEvent=typeof document<"u"&&document.ontouchstart?"touchstart":"click";static captureMouse(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{e.isMouseDown=!0,document.addEventListener("mouseup",r,!1),t.style.userSelect="none",t.style.webkitUserSelect=""},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1,document.removeEventListener("mouseup",r,!1),t.style.userSelect="",t.style.webkitUserSelect=""},s=a=>{const o=dr(t,a);e.x=o.x,e.y=o.y};return t.addEventListener("mousedown",n,!1),document.addEventListener("mousemove",s,!1),e}static captureTouch(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{a.preventDefault(),e.isMouseDown=!0},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1},s=a=>{const o=a.changedTouches[0],l=dr(t,o);e.x=l.x,e.y=l.y};return t.addEventListener("touchstart",n,!1),t.addEventListener("touchend",r,!1),t.addEventListener("touchcancel",r,!1),t.addEventListener("touchmove",s,!1),e}static capturePointer(t){const e={x:0,y:0,isMouseDown:!1},n=a=>{e.isMouseDown=!0,t.setPointerCapture(a.pointerId),t.style.userSelect="none",t.style.webkitUserSelect=""},r=a=>{e.x=0,e.y=0,e.isMouseDown=!1,t.style.userSelect="",t.style.webkitUserSelect=""},s=a=>{const o=dr(t,a);e.x=o.x,e.y=o.y};return t.addEventListener("pointerdown",n,!1),t.addEventListener("pointerup",r,!1),t.addEventListener("pointercancel",r,!1),t.addEventListener("pointermove",s,!1),e}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 jo(i,t){if(typeof t<"u")window.localStorage.setItem(i,t);else return window.localStorage.getItem(i)??void 0}function lm(i,t,e){const n=new Date;n.setTime(n.getTime()+e*24*60*60*1e3);const r="expires="+n.toUTCString();document.cookie=i+"="+t+"; "+r}function hm(i){const t=i+"=",e=document.cookie.split(";");for(let n=0,r=e.length;n<r;n++){const s=e[n].trim();if(s.indexOf(t)==0)return s.substring(t.length,s.length)}return""}const cm=()=>document.cookie.split(";").map(i=>i.split("=")).reduce((i,[t,e])=>(i[t.trim().replace('"',"")]=e,i),{}),um=()=>document.cookie.split(";").forEach(i=>document.cookie=i.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`));class fm{static theme(t){return t=t||jo("theme"),typeof t>"u"&&(t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),jo("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 dm{static addEventListener(t,e,n){t.addEventListener(e,n,!1)}static removeEventListener(t,e,n){t.removeEventListener(e,n,!1)}static getTarget(t){return t.target||t.srcElement}}class gm{static setPageVerticalScrollPercent(t,e="width"){const n=ru(t);n.css("transition","all linear 30ms");const{clientHeight:r}=ha(),{scrollTop:s,scrollHeight:a}=xn(),o=a-r,l=o<=0?0:s/o*100;n.css(e,l+"%")}static pullDownRefresh(t,e,n=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<n&&(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>=n&&e()},!1)}static pullUpLoading(t,e=50){const{clientHeight:n}=ha(),{scrollTop:r,scrollHeight:s}=xn();r+n>=s-e&&t()}static scrollTo=(t={x:0,y:0})=>window.scrollTo(t.x,t.y)}class Zt{static version=.8;constructor(t,e){this.context=e??document;let n=[];if(Array.isArray(t))n=t;else if(t instanceof Node||t instanceof Window)n=[t];else if(t instanceof Zt)n=t.nodes;else if(typeof t=="string"){if(typeof this.context.querySelector!="function")throw new Error("Invalid context");n=Array.from(this.context.querySelectorAll(t))}else if(t==null)n=[];else{let r=Array.from(t??[]);if(typeof t=="object"&&Array.isArray(r))n=r;else throw new Error(`Invalid selector "${t}"`)}this.nodes=n,this.length=n.length,this.each((r,s)=>{this[s]=r})}static _fragment(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childNodes.forEach(n=>{let r=Zt._scriptConvert(n);r!=n&&e.content.replaceChild(r,n)}),e.content}static _scriptConvert(t){let e=n=>{let s=n.ownerDocument.createElement("script");s.text=n.text;let a=n.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(n=>{n.parentNode.replaceChild(e(n),n)}),t}static _fixProp(t){let 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}_insert(t,e){let n=[],r=this.length;if(r<1)return;let s=this;if(typeof e=="string")this.each(a=>{let o=Zt._fragment(e);n.push(...o.childNodes),a[t](o)});else if(e instanceof Zt){let a=r==1;e.each(o=>{this.each(l=>{let h=a?o:o.cloneNode(!0);n.push(h),l[t](h),Zt._scriptConvert(h)})}),a||e.remove()}else if(e instanceof Node)this.each(a=>{let o=r===1?e:Zt._fragment(e.outerHTML);n.push(...r===1?[e]:o.childNodes),a[t](o)}),r>1&&e.remove();else throw new Error(`Incorrect argument for "${t}(html)". It expects one string argument.`);return t=="replaceWith"&&(s=new Zt(n,this.context)),s}_save(t,e,n){t._mQuery=t._mQuery??{},Array.isArray(n)?(t._mQuery[e]=t._mQuery[e]??[],t._mQuery[e].push(...n)):n!=null?t._mQuery[e]=n:delete t._mQuery[e]}get(t){t<0&&(t=this.length+t);let e=this[t];return e||(t!=null?null:this.nodes)}eq(t){t<0&&(t=this.length+t);let e=[this[t]];return e[0]==null&&(e=[]),new Zt(e,this.context)}then(t){let e=t(this);return e??this}find(t){let e=[];return this.each(n=>{let r=Array.from(n.querySelectorAll(t));r.length>0&&e.push(...r)}),new Zt(e,this.context)}filter(t){let e=[];return this.each(n=>{(n===t||typeof t=="string"&&n.matches&&n.matches(t)||typeof t=="function"&&t(n))&&e.push(n)}),new Zt(e,this.context)}next(){let t=[];return this.each(e=>{let n=e.nextElementSibling;n&&t.push(n)}),new Zt(t,this.context)}prev(){let t=[];return this.each(e=>{let n=e.previousElementSibling;n&&t.push(n)}),new Zt(t,this.context)}shadow(t){let e=[];this.each(r=>{r.shadowRoot&&e.push(r.shadowRoot)});let n=new Zt(e,this.context);return t?n.find(t):n}closest(t){let e=[];return this.each(n=>{let r=n.closest(t);r&&e.push(r)}),new Zt(e,this.context)}host(t){let e=[],n=s=>s.parentNode?n(s.parentNode):s,r=s=>{let a=n(s);e.push(a.host?a.host:a),a.host&&t&&r(a.host)};return this.each(s=>{r(s)}),new Zt(e,this.context)}parent(t){return this.parents(t,!0)}parents(t,e){let n=[],r=a=>{if(n.indexOf(a)==-1&&n.push(a),!e&&a.parentNode)return r(a.parentNode)};this.each(a=>{a.parentNode&&r(a.parentNode)});let s=new Zt(n,this.context);return t?s.filter(t):s}add(t){let e=t instanceof Zt?t.nodes:Array.isArray(t)?t:[t];return new Zt(this.nodes.concat(e),this.context)}each(t){return this.nodes.forEach((e,n)=>{t(e,n,this)}),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.each(t=>{t.remove()}),this}css(t,e){let n=t,r=arguments.length;if(r===0||r===1&&typeof t=="string")if(this[0]){let s=this[0].style;if(typeof t=="string"){let a=s.getPropertyPriority(t);return s.getPropertyValue(t)+(a?"!"+a:"")}else return Object.fromEntries(this[0].style.cssText.split(";").filter(a=>!!a).map(a=>a.split(":").map(o=>o.trim())))}else return;else return typeof t!="object"&&(n={},n[t]=e),this.each((s,a)=>{Object.keys(n).forEach(o=>{let l=String(n[o]).toLowerCase().includes("!important")?"important":"";s.style.setProperty(o,String(n[o]).replace(/!important/i,""),l)})}),this}addClass(t){return this.toggleClass(t,!0),this}removeClass(t){return this.toggleClass(t,!1),this}toggleClass(t,e){return typeof t=="string"&&(t=t.split(/[,\s]+/)),this.each(n=>{let r=t;r==null&&e===!1&&(r=Array.from(n.classList)),r.forEach(s=>{if(s!==""){let a="toggle";e!=null&&(a=e?"add":"remove"),n.classList[a](s)}})}),this}hasClass(t){if(typeof t=="string"&&(t=t.split(/[,\s]+/)),t==null&&this.length>0)return Array.from(this[0].classList);let e=!1;return this.each(n=>{e=e||t.every(r=>Array.from(n.classList??[]).includes(r))}),e}on(t,e,n){typeof e=="function"&&(n=e,e=void 0);let r;return e?.delegate&&(r=e.delegate,delete e.delegate),t=t.split(/[,\s]+/),t.forEach(s=>{let[a,o]=String(s).toLowerCase().split(".");if(r){let l=n;n=h=>{let c=se(h.target).parents(r);c.length>0?h.delegate=c[0]:h.delegate=h.target,(h.target.matches(r)||c.length>0)&&l(h)}}this.each(l=>{this._save(l,"events",[{event:a,scope:o,callback:n,options:e}]),l.addEventListener(a,n,e)})}),this}off(t,e,n){return typeof e=="function"&&(n=e,e=void 0),t=(t??"").split(/[,\s]+/),t.forEach(r=>{let[s,a]=String(r).toLowerCase().split(".");this.each(o=>{if(Array.isArray(o._mQuery?.events))for(let l=o._mQuery.events.length-1;l>=0;l--){let h=o._mQuery.events[l];a==null||a===""?(h.event==s||s==="")&&(h.callback==n||n==null)&&(o.removeEventListener(h.event,h.callback,h.options),o._mQuery.events.splice(l,1)):(h.event==s||s==="")&&h.scope==a&&(o.removeEventListener(h.event,h.callback,h.options),o._mQuery.events.splice(l,1))}})}),this}trigger(t,e){let n,r=["click","dblclick","mousedown","mouseup","mousemove"],s=["keydown","keyup","keypress"];return t instanceof Event||t instanceof CustomEvent?n=t:r.includes(t)?n=new MouseEvent(t,e):s.includes(t)?n=new KeyboardEvent(t,e):n=new Event(t,e),this.each(a=>{a.dispatchEvent(n)}),this}attr(t,e){if(e===void 0&&typeof t=="string")return this[0]?this[0].getAttribute(t):void 0;{let n={};return typeof t=="object"?n=t:n[t]=e,this.each(r=>{Object.entries(n).forEach(([s,a])=>{r.setAttribute(s,a)})}),this}}removeAttr(){return this.each(t=>{Array.from(arguments).forEach(e=>{t.removeAttribute(e)})}),this}prop(t,e){if(e===void 0&&typeof t=="string")return this[0]?this[0][t]:void 0;{let n={};return typeof t=="object"?n=t:n[t]=e,this.each(r=>{Object.entries(n).forEach(([s,a])=>{let o=Zt._fixProp(s);r[o]=a,o=="innerHTML"&&Zt._scriptConvert(r)})}),this}}removeProp(){return this.each(t=>{Array.from(arguments).forEach(e=>{delete t[Zt._fixProp(e)]})}),this}data(t,e){if(t instanceof Object){Object.entries(t).forEach(n=>{this.data(n[0],n[1])});return}if(t&&t.indexOf("-")!=-1&&console.error(`Key "${t}" contains "-" (dash). Dashes are not allowed in property names. Use camelCase instead.`),arguments.length<2)if(this[0]){let n=Object.assign({},this[0].dataset);return Object.keys(n).forEach(r=>{if(n[r].startsWith("[")||n[r].startsWith("{"))try{n[r]=JSON.parse(n[r])}catch{}}),t?n[t]:n}else return;else return this.each(n=>{e!=null?n.dataset[t]=e instanceof Object?JSON.stringify(e):e:delete n.dataset[t]}),this}removeData(t){return typeof t=="string"&&(t=t.split(/[,\s]+/)),this.each(e=>{t.forEach(n=>{delete e.dataset[n]})}),this}show(){return this.toggle(!0)}hide(){return this.toggle(!1)}toggle(t){return this.each(e=>{let n=e.style.display,r=getComputedStyle(e).display,s=n=="none"||r=="none";if(s&&(t==null||t===!0)){let a=e instanceof HTMLTableRowElement?"table-row":e instanceof HTMLTableCellElement?"table-cell":"block";e.style.display=e._mQuery?.prevDisplay??(n==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):this.prop("innerHTML",t)}text(t){return this.prop("textContent",t)}val(t){return this.prop("value",t)}change(){return this.trigger("change")}click(){return this.trigger("click")}}let se=function(i,t){return new Zt(i,t)};se.html=i=>{let t=Zt._fragment(i);return se(t.children,t)},se.version=Zt.version,function(){let i=0;window.requestAnimationFrame||(window.requestAnimationFrame=function(t){const e=new Date().getTime(),n=Math.max(0,16-(e-i)),r=window.setTimeout(function(){t(e+n)},n);return i=e+n,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}();const su=i=>{function t(e){const n=window.requestAnimationFrame(t);i(e,n)}window.requestAnimationFrame(t)},pm=(i,t)=>{const n=document.getElementById(i).getContext("2d");su((r,s)=>{t(n,r,s)})};function mm(i,t,e,n,r=.5,s="ease"){return new Promise(a=>{const o=getComputedStyle(i),l=parseInt(o.width),h=parseInt(o.height);if(!i||!t){console.log("ERROR: Cannot do transition when one of the divs is null");return}switch(i.parentElement&&(i.parentElement.style.cssText+="; perspective: 900px; overflow: hidden;"),i.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",t.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",e){case"slide-left":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d("+l+"px, 0, 0)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(-"+l+"px, 0, 0)"},1);break;case"slide-right":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(-"+l+"px, 0, 0)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0px, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d("+l+"px, 0, 0)"},1);break;case"slide-down":i.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, "+h+"px, 0)"},1);break;case"slide-up":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, "+h+"px, 0)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)",i.style.cssText+="transition: "+r+"s "+s+"; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":i.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(180deg)"},1);break;case"flip-right":i.style.cssText+="overflow: hidden; transform: rotateY(0deg)",t.style.cssText+="overflow: hidden; transform: rotateY(180deg)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateY(-180deg)"},1);break;case"flip-down":i.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(180deg)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(-180deg)"},1);break;case"flip-up":i.style.cssText+="overflow: hidden; transform: rotateX(0deg)",t.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(0deg)",i.style.cssText+="transition: "+r+"s "+s+"; transform: rotateX(180deg)"},1);break;case"pop-in":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; transform: scale(1); opacity: 1;",i.style.cssText+="transition: "+r+"s "+s+";"},1);break;case"pop-out":i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",t.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; opacity: 1;",i.style.cssText+="transition: "+r+"s "+s+"; transform: scale(1.7); opacity: 0;"},1);break;default:i.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",t.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",se(t).show(),setTimeout(()=>{t.style.cssText+="transition: "+r+"s "+s+"; opacity: 1;",i.style.cssText+="transition: "+r+"s "+s},1);break}setTimeout(()=>{if(e==="slide-down"&&(se(i).css("z-index","1019"),se(t).css("z-index","1020")),t){const c=se(t);c?.css({opacity:"1"}),c?.css({transition:"",transform:""})}if(i){const c=se(i);c?.css({opacity:"1"}),c?.css({transition:"",transform:""})}typeof n=="function"&&n(),a()},r*1e3)})}var Ho=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pe(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function St(i){if(i.__esModule)return i;var t=i.default;if(typeof t=="function"){var e=function n(){return this instanceof n?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(i).forEach(function(n){var r=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return i[n]}})}),e}var au={exports:{}};(function(i){var t={};i.exports=t,t.parse=function(e,n){for(var r=t.bin.readUshort,s=t.bin.readUint,h=0,a={},o=new Uint8Array(e),l=o.length-4;s(o,l)!=101010256;)l--;var h=l;h+=4,h+=4;var c=r(o,h);h+=2,r(o,h),h+=2;var d=s(o,h);h+=4;var f=s(o,h);h+=4,h=f;for(var u=0;u<c;u++){s(o,h),h+=4,h+=4,h+=4,h+=4,s(o,h),h+=4;var d=s(o,h);h+=4;var g=s(o,h);h+=4;var m=r(o,h),y=r(o,h+2),x=r(o,h+4);h+=6,h+=8;var C=s(o,h);h+=4,h+=m+y+x,t._readLocal(o,C,a,d,g,n)}return a},t._readLocal=function(e,n,r,s,a,o){var l=t.bin.readUshort,h=t.bin.readUint;h(e,n),n+=4,l(e,n),n+=2,l(e,n),n+=2;var c=l(e,n);n+=2,h(e,n),n+=4,h(e,n),n+=4,n+=8;var d=l(e,n);n+=2;var f=l(e,n);n+=2;var u=t.bin.readUTF8(e,n,d);if(n+=d,n+=f,o){r[u]={size:a,csize:s};return}var g=new Uint8Array(e.buffer,n);if(c==0)r[u]=new Uint8Array(g.buffer.slice(n,n+s));else if(c==8){var m=new Uint8Array(a);t.inflateRaw(g,m),r[u]=m}else throw"unknown compression method: "+c},t.inflateRaw=function(e,n){return t.F.inflate(e,n)},t.inflate=function(e,n){return e[0],e[1],t.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),n)},t.deflate=function(e,n){n==null&&(n={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,n.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,n){n==null&&(n={level:6});var r=new Uint8Array(50+Math.floor(e.length*1.1)),s=t.F.deflateRaw(e,r,s,n.level);return new Uint8Array(r.buffer,0,s)},t.encode=function(e,n){n==null&&(n=!1);var r=0,s=t.bin.writeUint,a=t.bin.writeUshort,o={};for(var l in e){var h=!t._noNeed(l)&&!n,c=e[l],d=t.crc.crc(c,0,c.length);o[l]={cpr:h,usize:c.length,crc:d,file:h?t.deflateRaw(c):c}}for(var l in o)r+=o[l].file.length+30+46+2*t.bin.sizeUTF8(l);r+=22;var f=new Uint8Array(r),u=0,g=[];for(var l in o){var m=o[l];g.push(u),u=t._writeHeader(f,u,l,m,0)}var y=0,x=u;for(var l in o){var m=o[l];g.push(u),u=t._writeHeader(f,u,l,m,1,g[y++])}var C=u-x;return s(f,u,101010256),u+=4,u+=4,a(f,u,y),u+=2,a(f,u,y),u+=2,s(f,u,C),u+=4,s(f,u,x),u+=4,u+=2,f.buffer},t._noNeed=function(e){var n=e.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(n)!=-1},t._writeHeader=function(e,n,r,s,a,o){var l=t.bin.writeUint,h=t.bin.writeUshort,c=s.file;l(e,n,a==0?67324752:33639248),n+=4,a==1&&(n+=2),h(e,n,20),n+=2,h(e,n,0),n+=2,h(e,n,s.cpr?8:0),n+=2,l(e,n,0),n+=4,l(e,n,s.crc),n+=4,l(e,n,c.length),n+=4,l(e,n,s.usize),n+=4,h(e,n,t.bin.sizeUTF8(r)),n+=2,h(e,n,0),n+=2,a==1&&(n+=2,n+=2,n+=6,l(e,n,o),n+=4);var d=t.bin.writeUTF8(e,n,r);return n+=d,a==0&&(e.set(c,n),n+=c.length),n},t.crc={table:function(){for(var e=new Uint32Array(256),n=0;n<256;n++){for(var r=n,s=0;s<8;s++)r&1?r=3988292384^r>>>1:r=r>>>1;e[n]=r}return e}(),update:function(e,n,r,s){for(var a=0;a<s;a++)e=t.crc.table[(e^n[r+a])&255]^e>>>8;return e},crc:function(e,n,r){return t.crc.update(4294967295,e,n,r)^4294967295}},t.adler=function(e,n,r){for(var s=1,a=0,o=n,l=n+r;o<l;){for(var h=Math.min(o+5552,l);o<h;)s+=e[o++],a+=s;s=s%65521,a=a%65521}return a<<16|s},t.bin={readUshort:function(e,n){return e[n]|e[n+1]<<8},writeUshort:function(e,n,r){e[n]=r&255,e[n+1]=r>>8&255},readUint:function(e,n){return e[n+3]*(256*256*256)+(e[n+2]<<16|e[n+1]<<8|e[n])},writeUint:function(e,n,r){e[n]=r&255,e[n+1]=r>>8&255,e[n+2]=r>>16&255,e[n+3]=r>>24&255},readASCII:function(e,n,r){for(var s="",a=0;a<r;a++)s+=String.fromCharCode(e[n+a]);return s},writeASCII:function(e,n,r){for(var s=0;s<r.length;s++)e[n+s]=r.charCodeAt(s)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,n,r){for(var s="",a,o=0;o<r;o++)s+="%"+t.bin.pad(e[n+o].toString(16));try{a=decodeURIComponent(s)}catch{return t.bin.readASCII(e,n,r)}return a},writeUTF8:function(e,n,r){for(var s=r.length,a=0,o=0;o<s;o++){var l=r.charCodeAt(o);if(!(l&4294967295-128+1))e[n+a]=l,a++;else if(!(l&4294967295-2048+1))e[n+a]=192|l>>6,e[n+a+1]=128|l>>0&63,a+=2;else if(!(l&4294967295-65536+1))e[n+a]=224|l>>12,e[n+a+1]=128|l>>6&63,e[n+a+2]=128|l>>0&63,a+=3;else if(!(l&4294967295-(1<<21)+1))e[n+a]=240|l>>18,e[n+a+1]=128|l>>12&63,e[n+a+2]=128|l>>6&63,e[n+a+3]=128|l>>0&63,a+=4;else throw"e"}return a},sizeUTF8:function(e){for(var n=e.length,r=0,s=0;s<n;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,n,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],l=t.F.U,h=t.F._goodIndex;t.F._hash;var c=t.F._putsE,d=0,f=r<<3,u=0,g=e.length;if(s==0){for(;d<g;){var m=Math.min(65535,g-d);c(n,f,d+m==g?1:0),f=t.F._copyExact(e,d,m,n,f+8),d+=m}return f>>>3}var y=l.lits,x=l.strt,C=l.prev,v=0,b=0,k=0,T=0,R=0,A=0;for(g>2&&(A=t.F._hash(e,0),x[A]=0),d=0;d<g;d++){if(R=A,d+1<g-2){A=t.F._hash(e,d+1);var U=d+1&32767;C[U]=x[A],x[A]=U}if(u<=d){(v>14e3||b>26697)&&g-d>100&&(u<d&&(y[v]=d-u,v+=2,u=d),f=t.F._writeBlock(d==g-1||u==g?1:0,y,v,T,e,k,d-k,n,f),v=b=T=0,k=d);var I=0;d<g-2&&(I=t.F._bestMatch(e,d,C,R,Math.min(o[2],g-d),o[3]));var m=I>>>16,N=I&65535;if(I!=0){var m=I>>>16,N=I&65535,q=h(m,l.of0);l.lhst[257+q]++;var W=h(N,l.df0);l.dhst[W]++,T+=l.exb[q]+l.dxb[W],y[v]=m<<23|d-u,y[v+1]=N<<16|q<<8|W,v+=2,u=d+m}else l.lhst[e[d]]++;b++}}for((k!=d||e.length==0)&&(u<d&&(y[v]=d-u,v+=2,u=d),f=t.F._writeBlock(1,y,v,T,e,k,d-k,n,f),v=0,b=0,v=b=T=0,k=d);f&7;)f++;return f>>>3},t.F._bestMatch=function(e,n,r,s,a,o){var l=n&32767,h=r[l],c=l-h+32768&32767;if(h==l||s!=t.F._hash(e,n-c))return 0;for(var d=0,f=0,u=Math.min(32767,n);c<=u&&--o!=0&&h!=l;){if(d==0||e[n+d]==e[n+d-c]){var g=t.F._howLong(e,n,c);if(g>d){if(d=g,f=c,d>=a)break;c+2<g&&(g=c+2);for(var m=0,y=0;y<g-2;y++){var x=n-c+y+32768&32767,C=r[x],v=x-C+32768&32767;v>m&&(m=v,h=x)}}}l=h,h=r[l],c+=l-h+32768&32767}return d<<16|f},t.F._howLong=function(e,n,r){if(e[n]!=e[n-r]||e[n+1]!=e[n+1-r]||e[n+2]!=e[n+2-r])return 0;var s=n,a=Math.min(e.length,n+258);for(n+=3;n<a&&e[n]==e[n-r];)n++;return n-s},t.F._hash=function(e,n){return(e[n]<<8|e[n+1])+(e[n+2]<<4)&65535},t.saved=0,t.F._writeBlock=function(e,n,r,s,a,o,l,h,c){var d=t.F.U,f=t.F._putsF,u=t.F._putsE,g,m,y,x,C,v,b,k,T;d.lhst[256]++,g=t.F.getTrees(),m=g[0],y=g[1],x=g[2],C=g[3],v=g[4],b=g[5],k=g[6],T=g[7];var R=(c+3&7?8-(c+3&7):0)+32+(l<<3),A=s+t.F.contSize(d.fltree,d.lhst)+t.F.contSize(d.fdtree,d.dhst),U=s+t.F.contSize(d.ltree,d.lhst)+t.F.contSize(d.dtree,d.dhst);U+=14+3*b+t.F.contSize(d.itree,d.ihst)+(d.ihst[16]*2+d.ihst[17]*3+d.ihst[18]*7);for(var I=0;I<286;I++)d.lhst[I]=0;for(var I=0;I<30;I++)d.dhst[I]=0;for(var I=0;I<19;I++)d.ihst[I]=0;var N=R<A&&R<U?0:A<U?1:2;if(f(h,c,e),f(h,c+1,N),c+=3,N==0){for(;c&7;)c++;c=t.F._copyExact(a,o,l,h,c)}else{var q,W;if(N==1&&(q=d.fltree,W=d.fdtree),N==2){t.F.makeCodes(d.ltree,m),t.F.revCodes(d.ltree,m),t.F.makeCodes(d.dtree,y),t.F.revCodes(d.dtree,y),t.F.makeCodes(d.itree,x),t.F.revCodes(d.itree,x),q=d.ltree,W=d.dtree,u(h,c,C-257),c+=5,u(h,c,v-1),c+=5,u(h,c,b-4),c+=4;for(var K=0;K<b;K++)u(h,c+K*3,d.itree[(d.ordr[K]<<1)+1]);c+=3*b,c=t.F._codeTiny(k,d.itree,h,c),c=t.F._codeTiny(T,d.itree,h,c)}for(var it=o,pt=0;pt<r;pt+=2){for(var vt=n[pt],dt=vt>>>23,_t=it+(vt&(1<<23)-1);it<_t;)c=t.F._writeLit(a[it++],q,h,c);if(dt!=0){var yt=n[pt+1],L=yt>>16,M=yt>>8&255,E=yt&255;c=t.F._writeLit(257+M,q,h,c),u(h,c,dt-d.of0[M]),c+=d.exb[M],c=t.F._writeLit(E,W,h,c),f(h,c,L-d.df0[E]),c+=d.dxb[E],it+=dt}}c=t.F._writeLit(256,q,h,c)}return c},t.F._copyExact=function(e,n,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,n,r),o),a+(r+4<<3)},t.F.getTrees=function(){for(var e=t.F.U,n=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=[],l=t.F._lenCodes(e.dtree,o),h=0;h<s.length;h+=2)e.ihst[s[h]]++;for(var h=0;h<o.length;h+=2)e.ihst[o[h]]++;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[n,r,c,a,l,d,s,o]},t.F.getSecond=function(e){for(var n=[],r=0;r<e.length;r+=2)n.push(e[r+1]);return n},t.F.nonZero=function(e){for(var n="",r=0;r<e.length;r+=2)e[r+1]!=0&&(n+=(r>>1)+",");return n},t.F.contSize=function(e,n){for(var r=0,s=0;s<n.length;s++)r+=n[s]*e[(s<<1)+1];return r},t.F._codeTiny=function(e,n,r,s){for(var a=0;a<e.length;a+=2){var o=e[a],l=e[a+1];s=t.F._writeLit(o,n,r,s);var h=o==16?2:o==17?3:7;o>15&&(t.F._putsE(r,s,l,h),s+=h)}return s},t.F._lenCodes=function(e,n){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,l=s+5<r?e[s+5]:-1,h=s==0?-1:e[s-1];if(a==0&&o==a&&l==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?n.push(17,d-3):n.push(18,d-11),s+=d*2-2}else if(a==h&&o==a&&l==a){for(var c=s+5;c+2<r&&e[c+2]==a;)c+=2;var d=Math.min(c+1-s>>>1,6);n.push(16,d-3),s+=d*2-2}else n.push(a,0)}return r>>>1},t.F._hufTree=function(e,n,r){var s=[],a=e.length,o=n.length,l=0;for(l=0;l<o;l+=2)n[l]=0,n[l+1]=0;for(l=0;l<a;l++)e[l]!=0&&s.push({lit:l,f:e[l]});var h=s.length,c=s.slice(0);if(h==0)return 0;if(h==1){var d=s[0].lit,c=d==0?1:0;return n[(d<<1)+1]=1,n[(c<<1)+1]=1,1}s.sort(function(C,v){return C.f-v.f});var f=s[0],u=s[1],g=0,m=1,y=2;for(s[0]={lit:-1,f:f.f+u.f,l:f,r:u,d:0};m!=h-1;)g!=m&&(y==h||s[g].f<s[y].f)?f=s[g++]:f=s[y++],g!=m&&(y==h||s[g].f<s[y].f)?u=s[g++]:u=s[y++],s[m++]={lit:-1,f:f.f+u.f,l:f,r:u};var x=t.F.setDepth(s[m-1],0);for(x>r&&(t.F.restrictDepth(c,r,x),x=r),l=0;l<h;l++)n[(c[l].lit<<1)+1]=c[l].d;return x},t.F.setDepth=function(e,n){return e.lit!=-1?(e.d=n,n):Math.max(t.F.setDepth(e.l,n+1),t.F.setDepth(e.r,n+1))},t.F.restrictDepth=function(e,n,r){var s=0,a=1<<r-n,o=0;for(e.sort(function(h,c){return c.d==h.d?h.f-c.f:c.d-h.d}),s=0;s<e.length&&e[s].d>n;s++){var l=e[s].d;e[s].d=n,o+=a-(1<<r-l)}for(o=o>>>r-n;o>0;){var l=e[s].d;l<n?(e[s].d++,o-=1<<n-l-1):s++}for(;s>=0;s--)e[s].d==n&&o<0&&(e[s].d--,o++);o!=0&&console.log("debt left")},t.F._goodIndex=function(e,n){var r=0;return n[r|16]<=e&&(r|=16),n[r|8]<=e&&(r|=8),n[r|4]<=e&&(r|=4),n[r|2]<=e&&(r|=2),n[r|1]<=e&&(r|=1),r},t.F._writeLit=function(e,n,r,s){return t.F._putsF(r,s,n[e<<1]),s+n[(e<<1)+1]},t.F.inflate=function(e,n){var r=Uint8Array;if(e[0]==3&&e[1]==0)return n||new r(0);var s=t.F,a=s._bitsF,o=s._bitsE,l=s._decodeTiny,h=s.makeCodes,c=s.codes2map,d=s._get17,f=s.U,u=n==null;u&&(n=new r(e.length>>>2<<3));for(var g=0,m=0,y=0,x=0,C=0,v=0,b=0,k=0,T=0,R,A;g==0;){if(g=a(e,T,1),m=a(e,T+1,2),T+=3,m==0){T&7&&(T+=8-(T&7));var U=(T>>>3)+4,I=e[U-4]|e[U-3]<<8;u&&(n=t.F._check(n,k+I)),n.set(new r(e.buffer,e.byteOffset+U,I),k),T=U+I<<3,k+=I;continue}if(u&&(n=t.F._check(n,k+(1<<17))),m==1&&(R=f.flmap,A=f.fdmap,v=512-1,b=32-1),m==2){y=o(e,T,5)+257,x=o(e,T+5,5)+1,C=o(e,T+10,4)+4,T+=14;for(var N=0;N<38;N+=2)f.itree[N]=0,f.itree[N+1]=0;for(var q=1,N=0;N<C;N++){var W=o(e,T+N*3,3);f.itree[(f.ordr[N]<<1)+1]=W,W>q&&(q=W)}T+=3*C,h(f.itree,q),c(f.itree,q,f.imap),R=f.lmap,A=f.dmap,T=l(f.imap,(1<<q)-1,y+x,e,T,f.ttree);var K=s._copyOut(f.ttree,0,y,f.ltree);v=(1<<K)-1;var it=s._copyOut(f.ttree,y,x,f.dtree);b=(1<<it)-1,h(f.ltree,K),c(f.ltree,K,R),h(f.dtree,it),c(f.dtree,it,A)}for(;;){var pt=R[d(e,T)&v];T+=pt&15;var vt=pt>>>4;if(!(vt>>>8))n[k++]=vt;else{if(vt==256)break;var dt=k+vt-254;if(vt>264){var _t=f.ldef[vt-257];dt=k+(_t>>>3)+o(e,T,_t&7),T+=_t&7}var yt=A[d(e,T)&b];T+=yt&15;var L=yt>>>4,M=f.ddef[L],E=(M>>>4)+a(e,T,M&15);for(T+=M&15,u&&(n=t.F._check(n,k+(1<<17)));k<dt;)n[k]=n[k++-E],n[k]=n[k++-E],n[k]=n[k++-E],n[k]=n[k++-E];k=dt}}}return n.length==k?n:n.slice(0,k)},t.F._check=function(e,n){var r=e.length;if(n<=r)return e;var s=new Uint8Array(Math.max(r<<1,n));return s.set(e,0),s},t.F._decodeTiny=function(e,n,r,s,a,o){for(var l=t.F._bitsE,h=t.F._get17,c=0;c<r;){var d=e[h(s,a)&n];a+=d&15;var f=d>>>4;if(f<=15)o[c]=f,c++;else{var u=0,g=0;f==16?(g=3+l(s,a,2),a+=2,u=o[c-1]):f==17?(g=3+l(s,a,3),a+=3):f==18&&(g=11+l(s,a,7),a+=7);for(var m=c+g;c<m;)o[c]=u,c++}}return a},t.F._copyOut=function(e,n,r,s){for(var a=0,o=0,l=s.length>>>1;o<r;){var h=e[o+n];s[o<<1]=0,s[(o<<1)+1]=h,h>a&&(a=h),o++}for(;o<l;)s[o<<1]=0,s[(o<<1)+1]=0,o++;return a},t.F.makeCodes=function(e,n){for(var r=t.F.U,s=e.length,a,o,l,h,c,d=r.bl_count,h=0;h<=n;h++)d[h]=0;for(h=1;h<s;h+=2)d[e[h]]++;var f=r.next_code;for(a=0,d[0]=0,o=1;o<=n;o++)a=a+d[o-1]<<1,f[o]=a;for(l=0;l<s;l+=2)c=e[l+1],c!=0&&(e[l]=f[c],f[c]++)},t.F.codes2map=function(e,n,r){for(var s=e.length,a=t.F.U,o=a.rev15,l=0;l<s;l+=2)if(e[l+1]!=0)for(var h=l>>1,c=e[l+1],d=h<<4|c,f=n-c,u=e[l]<<f,g=u+(1<<f);u!=g;){var m=o[u]>>>15-n;r[m]=d,u++}},t.F.revCodes=function(e,n){for(var r=t.F.U.rev15,s=15-n,a=0;a<e.length;a+=2){var o=e[a]<<n-e[a+1];e[a]=r[o]>>>s}},t.F._putsE=function(e,n,r){r=r<<(n&7);var s=n>>>3;e[s]|=r,e[s+1]|=r>>>8},t.F._putsF=function(e,n,r){r=r<<(n&7);var s=n>>>3;e[s]|=r,e[s+1]|=r>>>8,e[s+2]|=r>>>16},t.F._bitsE=function(e,n,r){return(e[n>>>3]|e[(n>>>3)+1]<<8)>>>(n&7)&(1<<r)-1},t.F._bitsF=function(e,n,r){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16)>>>(n&7)&(1<<r)-1},t.F._get17=function(e,n){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16)>>>(n&7)},t.F._get25=function(e,n){return(e[n>>>3]|e[(n>>>3)+1]<<8|e[(n>>>3)+2]<<16|e[(n>>>3)+3]<<24)>>>(n&7)},t.F.U=function(){var e=Uint16Array,n=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 n(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 n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new e(65536),prev:new e(32768)}}(),function(){for(var e=t.F.U,n=32768,r=0;r<n;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,l,h){for(;l--!=0;)o.push(0,h)}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)}()})(au);var vm=au.exports;const ou=Pe(vm);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const _m=4,lu=0,hu=1,ym=2;function Sn(i){let t=i.length;for(;--t>=0;)i[t]=0}const bm=0,cu=1,wm=2,xm=3,Sm=258,Vo=29,gr=256,pr=gr+1+Vo,Cn=30,qo=19,uu=2*pr+1,Vi=15,Xo=16,Cm=7,Yo=256,fu=16,du=17,gu=18,Wo=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]),fa=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]),km=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),pu=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Em=512,ri=new Array((pr+2)*2);Sn(ri);const mr=new Array(Cn*2);Sn(mr);const vr=new Array(Em);Sn(vr);const _r=new Array(Sm-xm+1);Sn(_r);const Ko=new Array(Vo);Sn(Ko);const da=new Array(Cn);Sn(da);function Zo(i,t,e,n,r){this.static_tree=i,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=r,this.has_stree=i&&i.length}let mu,vu,_u;function Jo(i,t){this.dyn_tree=i,this.max_code=0,this.stat_desc=t}const yu=i=>i<256?vr[i]:vr[256+(i>>>7)],yr=(i,t)=>{i.pending_buf[i.pending++]=t&255,i.pending_buf[i.pending++]=t>>>8&255},ke=(i,t,e)=>{i.bi_valid>Xo-e?(i.bi_buf|=t<<i.bi_valid&65535,yr(i,i.bi_buf),i.bi_buf=t>>Xo-i.bi_valid,i.bi_valid+=e-Xo):(i.bi_buf|=t<<i.bi_valid&65535,i.bi_valid+=e)},Xe=(i,t,e)=>{ke(i,e[t*2],e[t*2+1])},bu=(i,t)=>{let e=0;do e|=i&1,i>>>=1,e<<=1;while(--t>0);return e>>>1},Tm=i=>{i.bi_valid===16?(yr(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},Pm=(i,t)=>{const e=t.dyn_tree,n=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,l=t.stat_desc.max_length;let h,c,d,f,u,g,m=0;for(f=0;f<=Vi;f++)i.bl_count[f]=0;for(e[i.heap[i.heap_max]*2+1]=0,h=i.heap_max+1;h<uu;h++)c=i.heap[h],f=e[e[c*2+1]*2+1]+1,f>l&&(f=l,m++),e[c*2+1]=f,!(c>n)&&(i.bl_count[f]++,u=0,c>=o&&(u=a[c-o]),g=e[c*2],i.opt_len+=g*(f+u),s&&(i.static_len+=g*(r[c*2+1]+u)));if(m!==0){do{for(f=l-1;i.bl_count[f]===0;)f--;i.bl_count[f]--,i.bl_count[f+1]+=2,i.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(c=i.bl_count[f];c!==0;)d=i.heap[--h],!(d>n)&&(e[d*2+1]!==f&&(i.opt_len+=(f-e[d*2+1])*e[d*2],e[d*2+1]=f),c--)}},wu=(i,t,e)=>{const n=new Array(Vi+1);let r=0,s,a;for(s=1;s<=Vi;s++)r=r+e[s-1]<<1,n[s]=r;for(a=0;a<=t;a++){let o=i[a*2+1];o!==0&&(i[a*2]=bu(n[o]++,o))}},Am=()=>{let i,t,e,n,r;const s=new Array(Vi+1);for(e=0,n=0;n<Vo-1;n++)for(Ko[n]=e,i=0;i<1<<Wo[n];i++)_r[e++]=n;for(_r[e-1]=n,r=0,n=0;n<16;n++)for(da[n]=r,i=0;i<1<<fa[n];i++)vr[r++]=n;for(r>>=7;n<Cn;n++)for(da[n]=r<<7,i=0;i<1<<fa[n]-7;i++)vr[256+r++]=n;for(t=0;t<=Vi;t++)s[t]=0;for(i=0;i<=143;)ri[i*2+1]=8,i++,s[8]++;for(;i<=255;)ri[i*2+1]=9,i++,s[9]++;for(;i<=279;)ri[i*2+1]=7,i++,s[7]++;for(;i<=287;)ri[i*2+1]=8,i++,s[8]++;for(wu(ri,pr+1,s),i=0;i<Cn;i++)mr[i*2+1]=5,mr[i*2]=bu(i,5);mu=new Zo(ri,Wo,gr+1,pr,Vi),vu=new Zo(mr,fa,0,Cn,Vi),_u=new Zo(new Array(0),km,0,qo,Cm)},xu=i=>{let t;for(t=0;t<pr;t++)i.dyn_ltree[t*2]=0;for(t=0;t<Cn;t++)i.dyn_dtree[t*2]=0;for(t=0;t<qo;t++)i.bl_tree[t*2]=0;i.dyn_ltree[Yo*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Su=i=>{i.bi_valid>8?yr(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},Cu=(i,t,e,n)=>{const r=t*2,s=e*2;return i[r]<i[s]||i[r]===i[s]&&n[t]<=n[e]},Qo=(i,t,e)=>{const n=i.heap[e];let r=e<<1;for(;r<=i.heap_len&&(r<i.heap_len&&Cu(t,i.heap[r+1],i.heap[r],i.depth)&&r++,!Cu(t,n,i.heap[r],i.depth));)i.heap[e]=i.heap[r],e=r,r<<=1;i.heap[e]=n},ku=(i,t,e)=>{let n,r,s=0,a,o;if(i.sym_next!==0)do n=i.pending_buf[i.sym_buf+s++]&255,n+=(i.pending_buf[i.sym_buf+s++]&255)<<8,r=i.pending_buf[i.sym_buf+s++],n===0?Xe(i,r,t):(a=_r[r],Xe(i,a+gr+1,t),o=Wo[a],o!==0&&(r-=Ko[a],ke(i,r,o)),n--,a=yu(n),Xe(i,a,e),o=fa[a],o!==0&&(n-=da[a],ke(i,n,o)));while(s<i.sym_next);Xe(i,Yo,t)},tl=(i,t)=>{const e=t.dyn_tree,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,l=-1,h;for(i.heap_len=0,i.heap_max=uu,a=0;a<s;a++)e[a*2]!==0?(i.heap[++i.heap_len]=l=a,i.depth[a]=0):e[a*2+1]=0;for(;i.heap_len<2;)h=i.heap[++i.heap_len]=l<2?++l:0,e[h*2]=1,i.depth[h]=0,i.opt_len--,r&&(i.static_len-=n[h*2+1]);for(t.max_code=l,a=i.heap_len>>1;a>=1;a--)Qo(i,e,a);h=s;do a=i.heap[1],i.heap[1]=i.heap[i.heap_len--],Qo(i,e,1),o=i.heap[1],i.heap[--i.heap_max]=a,i.heap[--i.heap_max]=o,e[h*2]=e[a*2]+e[o*2],i.depth[h]=(i.depth[a]>=i.depth[o]?i.depth[a]:i.depth[o])+1,e[a*2+1]=e[o*2+1]=h,i.heap[1]=h++,Qo(i,e,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],Pm(i,t),wu(e,l,i.bl_count)},Eu=(i,t,e)=>{let n,r=-1,s,a=t[0*2+1],o=0,l=7,h=4;for(a===0&&(l=138,h=3),t[(e+1)*2+1]=65535,n=0;n<=e;n++)s=a,a=t[(n+1)*2+1],!(++o<l&&s===a)&&(o<h?i.bl_tree[s*2]+=o:s!==0?(s!==r&&i.bl_tree[s*2]++,i.bl_tree[fu*2]++):o<=10?i.bl_tree[du*2]++:i.bl_tree[gu*2]++,o=0,r=s,a===0?(l=138,h=3):s===a?(l=6,h=3):(l=7,h=4))},Tu=(i,t,e)=>{let n,r=-1,s,a=t[0*2+1],o=0,l=7,h=4;for(a===0&&(l=138,h=3),n=0;n<=e;n++)if(s=a,a=t[(n+1)*2+1],!(++o<l&&s===a)){if(o<h)do Xe(i,s,i.bl_tree);while(--o!==0);else s!==0?(s!==r&&(Xe(i,s,i.bl_tree),o--),Xe(i,fu,i.bl_tree),ke(i,o-3,2)):o<=10?(Xe(i,du,i.bl_tree),ke(i,o-3,3)):(Xe(i,gu,i.bl_tree),ke(i,o-11,7));o=0,r=s,a===0?(l=138,h=3):s===a?(l=6,h=3):(l=7,h=4)}},Mm=i=>{let t;for(Eu(i,i.dyn_ltree,i.l_desc.max_code),Eu(i,i.dyn_dtree,i.d_desc.max_code),tl(i,i.bl_desc),t=qo-1;t>=3&&i.bl_tree[pu[t]*2+1]===0;t--);return i.opt_len+=3*(t+1)+5+5+4,t},Rm=(i,t,e,n)=>{let r;for(ke(i,t-257,5),ke(i,e-1,5),ke(i,n-4,4),r=0;r<n;r++)ke(i,i.bl_tree[pu[r]*2+1],3);Tu(i,i.dyn_ltree,t-1),Tu(i,i.dyn_dtree,e-1)},Lm=i=>{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&i.dyn_ltree[e*2]!==0)return lu;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return hu;for(e=32;e<gr;e++)if(i.dyn_ltree[e*2]!==0)return hu;return lu};let Pu=!1;const Dm=i=>{Pu||(Am(),Pu=!0),i.l_desc=new Jo(i.dyn_ltree,mu),i.d_desc=new Jo(i.dyn_dtree,vu),i.bl_desc=new Jo(i.bl_tree,_u),i.bi_buf=0,i.bi_valid=0,xu(i)},Au=(i,t,e,n)=>{ke(i,(bm<<1)+(n?1:0),3),Su(i),yr(i,e),yr(i,~e),e&&i.pending_buf.set(i.window.subarray(t,t+e),i.pending),i.pending+=e},Im=i=>{ke(i,cu<<1,3),Xe(i,Yo,ri),Tm(i)},Om=(i,t,e,n)=>{let r,s,a=0;i.level>0?(i.strm.data_type===ym&&(i.strm.data_type=Lm(i)),tl(i,i.l_desc),tl(i,i.d_desc),a=Mm(i),r=i.opt_len+3+7>>>3,s=i.static_len+3+7>>>3,s<=r&&(r=s)):r=s=e+5,e+4<=r&&t!==-1?Au(i,t,e,n):i.strategy===_m||s===r?(ke(i,(cu<<1)+(n?1:0),3),ku(i,ri,mr)):(ke(i,(wm<<1)+(n?1:0),3),Rm(i,i.l_desc.max_code+1,i.d_desc.max_code+1,a+1),ku(i,i.dyn_ltree,i.dyn_dtree)),xu(i),n&&Su(i)},Fm=(i,t,e)=>(i.pending_buf[i.sym_buf+i.sym_next++]=t,i.pending_buf[i.sym_buf+i.sym_next++]=t>>8,i.pending_buf[i.sym_buf+i.sym_next++]=e,t===0?i.dyn_ltree[e*2]++:(i.matches++,t--,i.dyn_ltree[(_r[e]+gr+1)*2]++,i.dyn_dtree[yu(t)*2]++),i.sym_next===i.sym_end);var Nm=Dm,Um=Au,Gm=Om,Bm=Fm,$m=Im,zm={_tr_init:Nm,_tr_stored_block:Um,_tr_flush_block:Gm,_tr_tally:Bm,_tr_align:$m},br=(i,t,e,n)=>{let r=i&65535|0,s=i>>>16&65535|0,a=0;for(;e!==0;){a=e>2e3?2e3:e,e-=a;do r=r+t[n++]|0,s=s+r|0;while(--a);r%=65521,s%=65521}return r|s<<16|0};const jm=()=>{let i,t=[];for(var e=0;e<256;e++){i=e;for(var n=0;n<8;n++)i=i&1?3988292384^i>>>1:i>>>1;t[e]=i}return t},Hm=new Uint32Array(jm());var de=(i,t,e,n)=>{const r=Hm,s=n+e;i^=-1;for(let a=n;a<s;a++)i=i>>>8^r[(i^t[a])&255];return i^-1},qi={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"},Xi={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:Vm,_tr_stored_block:el,_tr_flush_block:qm,_tr_tally:wi,_tr_align:Xm}=zm,{Z_NO_FLUSH:xi,Z_PARTIAL_FLUSH:Ym,Z_FULL_FLUSH:Wm,Z_FINISH:Fe,Z_BLOCK:Mu,Z_OK:ve,Z_STREAM_END:Ru,Z_STREAM_ERROR:Ye,Z_DATA_ERROR:Km,Z_BUF_ERROR:il,Z_DEFAULT_COMPRESSION:Zm,Z_FILTERED:Jm,Z_HUFFMAN_ONLY:ga,Z_RLE:Qm,Z_FIXED:tv,Z_DEFAULT_STRATEGY:ev,Z_UNKNOWN:iv,Z_DEFLATED:pa}=Xi,nv=9,rv=15,sv=8,av=29,nl=256+1+av,ov=30,lv=19,hv=2*nl+1,cv=15,Gt=3,Si=258,We=Si+Gt+1,uv=32,kn=42,rl=57,sl=69,al=73,ol=91,ll=103,Yi=113,wr=666,xe=1,En=2,Wi=3,Tn=4,fv=3,Ki=(i,t)=>(i.msg=qi[t],t),Lu=i=>i*2-(i>4?9:0),Ci=i=>{let t=i.length;for(;--t>=0;)i[t]=0},dv=i=>{let t,e,n,r=i.w_size;t=i.hash_size,n=t;do e=i.head[--n],i.head[n]=e>=r?e-r:0;while(--t);t=r,n=t;do e=i.prev[--n],i.prev[n]=e>=r?e-r:0;while(--t)};let ki=(i,t,e)=>(t<<i.hash_shift^e)&i.hash_mask;const Ae=i=>{const t=i.state;let e=t.pending;e>i.avail_out&&(e=i.avail_out),e!==0&&(i.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),i.next_out),i.next_out+=e,t.pending_out+=e,i.total_out+=e,i.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Me=(i,t)=>{qm(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,t),i.block_start=i.strstart,Ae(i.strm)},jt=(i,t)=>{i.pending_buf[i.pending++]=t},xr=(i,t)=>{i.pending_buf[i.pending++]=t>>>8&255,i.pending_buf[i.pending++]=t&255},hl=(i,t,e,n)=>{let r=i.avail_in;return r>n&&(r=n),r===0?0:(i.avail_in-=r,t.set(i.input.subarray(i.next_in,i.next_in+r),e),i.state.wrap===1?i.adler=br(i.adler,t,r,e):i.state.wrap===2&&(i.adler=de(i.adler,t,r,e)),i.next_in+=r,i.total_in+=r,r)},Du=(i,t)=>{let e=i.max_chain_length,n=i.strstart,r,s,a=i.prev_length,o=i.nice_match;const l=i.strstart>i.w_size-We?i.strstart-(i.w_size-We):0,h=i.window,c=i.w_mask,d=i.prev,f=i.strstart+Si;let u=h[n+a-1],g=h[n+a];i.prev_length>=i.good_match&&(e>>=2),o>i.lookahead&&(o=i.lookahead);do if(r=t,!(h[r+a]!==g||h[r+a-1]!==u||h[r]!==h[n]||h[++r]!==h[n+1])){n+=2,r++;do;while(h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&h[++n]===h[++r]&&n<f);if(s=Si-(f-n),n=f-Si,s>a){if(i.match_start=t,a=s,s>=o)break;u=h[n+a-1],g=h[n+a]}}while((t=d[t&c])>l&&--e!==0);return a<=i.lookahead?a:i.lookahead},Pn=i=>{const t=i.w_size;let e,n,r;do{if(n=i.window_size-i.lookahead-i.strstart,i.strstart>=t+(t-We)&&(i.window.set(i.window.subarray(t,t+t-n),0),i.match_start-=t,i.strstart-=t,i.block_start-=t,i.insert>i.strstart&&(i.insert=i.strstart),dv(i),n+=t),i.strm.avail_in===0)break;if(e=hl(i.strm,i.window,i.strstart+i.lookahead,n),i.lookahead+=e,i.lookahead+i.insert>=Gt)for(r=i.strstart-i.insert,i.ins_h=i.window[r],i.ins_h=ki(i,i.ins_h,i.window[r+1]);i.insert&&(i.ins_h=ki(i,i.ins_h,i.window[r+Gt-1]),i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,i.insert--,!(i.lookahead+i.insert<Gt)););}while(i.lookahead<We&&i.strm.avail_in!==0)},Iu=(i,t)=>{let e=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,n,r,s,a=0,o=i.strm.avail_in;do{if(n=65535,s=i.bi_valid+42>>3,i.strm.avail_out<s||(s=i.strm.avail_out-s,r=i.strstart-i.block_start,n>r+i.strm.avail_in&&(n=r+i.strm.avail_in),n>s&&(n=s),n<e&&(n===0&&t!==Fe||t===xi||n!==r+i.strm.avail_in)))break;a=t===Fe&&n===r+i.strm.avail_in?1:0,el(i,0,0,a),i.pending_buf[i.pending-4]=n,i.pending_buf[i.pending-3]=n>>8,i.pending_buf[i.pending-2]=~n,i.pending_buf[i.pending-1]=~n>>8,Ae(i.strm),r&&(r>n&&(r=n),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+r),i.strm.next_out),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r,i.block_start+=r,n-=r),n&&(hl(i.strm,i.strm.output,i.strm.next_out,n),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n)}while(a===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),a?Tn:t!==xi&&t!==Fe&&i.strm.avail_in===0&&i.strstart===i.block_start?En:(s=i.window_size-i.strstart,i.strm.avail_in>s&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,s+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),s>i.strm.avail_in&&(s=i.strm.avail_in),s&&(hl(i.strm,i.window,i.strstart,s),i.strstart+=s,i.insert+=s>i.w_size-i.insert?i.w_size-i.insert:s),i.high_water<i.strstart&&(i.high_water=i.strstart),s=i.bi_valid+42>>3,s=i.pending_buf_size-s>65535?65535:i.pending_buf_size-s,e=s>i.w_size?i.w_size:s,r=i.strstart-i.block_start,(r>=e||(r||t===Fe)&&t!==xi&&i.strm.avail_in===0&&r<=s)&&(n=r>s?s:r,a=t===Fe&&i.strm.avail_in===0&&n===r?1:0,el(i,i.block_start,n,a),i.block_start+=n,Ae(i.strm)),a?Wi:xe)},cl=(i,t)=>{let e,n;for(;;){if(i.lookahead<We){if(Pn(i),i.lookahead<We&&t===xi)return xe;if(i.lookahead===0)break}if(e=0,i.lookahead>=Gt&&(i.ins_h=ki(i,i.ins_h,i.window[i.strstart+Gt-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),e!==0&&i.strstart-e<=i.w_size-We&&(i.match_length=Du(i,e)),i.match_length>=Gt)if(n=wi(i,i.strstart-i.match_start,i.match_length-Gt),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=Gt){i.match_length--;do i.strstart++,i.ins_h=ki(i,i.ins_h,i.window[i.strstart+Gt-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=ki(i,i.ins_h,i.window[i.strstart+1]);else n=wi(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(n&&(Me(i,!1),i.strm.avail_out===0))return xe}return i.insert=i.strstart<Gt-1?i.strstart:Gt-1,t===Fe?(Me(i,!0),i.strm.avail_out===0?Wi:Tn):i.sym_next&&(Me(i,!1),i.strm.avail_out===0)?xe:En},An=(i,t)=>{let e,n,r;for(;;){if(i.lookahead<We){if(Pn(i),i.lookahead<We&&t===xi)return xe;if(i.lookahead===0)break}if(e=0,i.lookahead>=Gt&&(i.ins_h=ki(i,i.ins_h,i.window[i.strstart+Gt-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=Gt-1,e!==0&&i.prev_length<i.max_lazy_match&&i.strstart-e<=i.w_size-We&&(i.match_length=Du(i,e),i.match_length<=5&&(i.strategy===Jm||i.match_length===Gt&&i.strstart-i.match_start>4096)&&(i.match_length=Gt-1)),i.prev_length>=Gt&&i.match_length<=i.prev_length){r=i.strstart+i.lookahead-Gt,n=wi(i,i.strstart-1-i.prev_match,i.prev_length-Gt),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=r&&(i.ins_h=ki(i,i.ins_h,i.window[i.strstart+Gt-1]),e=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=Gt-1,i.strstart++,n&&(Me(i,!1),i.strm.avail_out===0))return xe}else if(i.match_available){if(n=wi(i,0,i.window[i.strstart-1]),n&&Me(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return xe}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(n=wi(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<Gt-1?i.strstart:Gt-1,t===Fe?(Me(i,!0),i.strm.avail_out===0?Wi:Tn):i.sym_next&&(Me(i,!1),i.strm.avail_out===0)?xe:En},gv=(i,t)=>{let e,n,r,s;const a=i.window;for(;;){if(i.lookahead<=Si){if(Pn(i),i.lookahead<=Si&&t===xi)return xe;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=Gt&&i.strstart>0&&(r=i.strstart-1,n=a[r],n===a[++r]&&n===a[++r]&&n===a[++r])){s=i.strstart+Si;do;while(n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&n===a[++r]&&r<s);i.match_length=Si-(s-r),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=Gt?(e=wi(i,1,i.match_length-Gt),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(e=wi(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),e&&(Me(i,!1),i.strm.avail_out===0))return xe}return i.insert=0,t===Fe?(Me(i,!0),i.strm.avail_out===0?Wi:Tn):i.sym_next&&(Me(i,!1),i.strm.avail_out===0)?xe:En},pv=(i,t)=>{let e;for(;;){if(i.lookahead===0&&(Pn(i),i.lookahead===0)){if(t===xi)return xe;break}if(i.match_length=0,e=wi(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,e&&(Me(i,!1),i.strm.avail_out===0))return xe}return i.insert=0,t===Fe?(Me(i,!0),i.strm.avail_out===0?Wi:Tn):i.sym_next&&(Me(i,!1),i.strm.avail_out===0)?xe:En};function Ke(i,t,e,n,r){this.good_length=i,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=r}const Sr=[new Ke(0,0,0,0,Iu),new Ke(4,4,8,4,cl),new Ke(4,5,16,8,cl),new Ke(4,6,32,32,cl),new Ke(4,4,16,16,An),new Ke(8,16,32,32,An),new Ke(8,16,128,128,An),new Ke(8,32,128,256,An),new Ke(32,128,258,1024,An),new Ke(32,258,258,4096,An)],mv=i=>{i.window_size=2*i.w_size,Ci(i.head),i.max_lazy_match=Sr[i.level].max_lazy,i.good_match=Sr[i.level].good_length,i.nice_match=Sr[i.level].nice_length,i.max_chain_length=Sr[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=Gt-1,i.match_available=0,i.ins_h=0};function vv(){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=pa,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(hv*2),this.dyn_dtree=new Uint16Array((2*ov+1)*2),this.bl_tree=new Uint16Array((2*lv+1)*2),Ci(this.dyn_ltree),Ci(this.dyn_dtree),Ci(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(cv+1),this.heap=new Uint16Array(2*nl+1),Ci(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*nl+1),Ci(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 Cr=i=>{if(!i)return 1;const t=i.state;return!t||t.strm!==i||t.status!==kn&&t.status!==rl&&t.status!==sl&&t.status!==al&&t.status!==ol&&t.status!==ll&&t.status!==Yi&&t.status!==wr?1:0},Ou=i=>{if(Cr(i))return Ki(i,Ye);i.total_in=i.total_out=0,i.data_type=iv;const t=i.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?rl:t.wrap?kn:Yi,i.adler=t.wrap===2?0:1,t.last_flush=-2,Vm(t),ve},Fu=i=>{const t=Ou(i);return t===ve&&mv(i.state),t},_v=(i,t)=>Cr(i)||i.state.wrap!==2?Ye:(i.state.gzhead=t,ve),Nu=(i,t,e,n,r,s)=>{if(!i)return Ye;let a=1;if(t===Zm&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),r<1||r>nv||e!==pa||n<8||n>15||t<0||t>9||s<0||s>tv||n===8&&a!==1)return Ki(i,Ye);n===8&&(n=9);const o=new vv;return i.state=o,o.strm=i,o.status=kn,o.wrap=a,o.gzhead=null,o.w_bits=n,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+Gt-1)/Gt),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,Fu(i)},yv=(i,t)=>Nu(i,t,pa,rv,sv,ev),bv=(i,t)=>{if(Cr(i)||t>Mu||t<0)return i?Ki(i,Ye):Ye;const e=i.state;if(!i.output||i.avail_in!==0&&!i.input||e.status===wr&&t!==Fe)return Ki(i,i.avail_out===0?il:Ye);const n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(Ae(i),i.avail_out===0)return e.last_flush=-1,ve}else if(i.avail_in===0&&Lu(t)<=Lu(n)&&t!==Fe)return Ki(i,il);if(e.status===wr&&i.avail_in!==0)return Ki(i,il);if(e.status===kn&&e.wrap===0&&(e.status=Yi),e.status===kn){let r=pa+(e.w_bits-8<<4)<<8,s=-1;if(e.strategy>=ga||e.level<2?s=0:e.level<6?s=1:e.level===6?s=2:s=3,r|=s<<6,e.strstart!==0&&(r|=uv),r+=31-r%31,xr(e,r),e.strstart!==0&&(xr(e,i.adler>>>16),xr(e,i.adler&65535)),i.adler=1,e.status=Yi,Ae(i),e.pending!==0)return e.last_flush=-1,ve}if(e.status===rl){if(i.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>=ga||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&&(i.adler=de(i.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=sl;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>=ga||e.level<2?4:0),jt(e,fv),e.status=Yi,Ae(i),e.pending!==0)return e.last_flush=-1,ve}if(e.status===sl){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&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex+=o,Ae(i),e.pending!==0)return e.last_flush=-1,ve;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&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=al}if(e.status===al){if(e.gzhead.name){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),Ae(i),e.pending!==0)return e.last_flush=-1,ve;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&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),e.gzindex=0}e.status=ol}if(e.status===ol){if(e.gzhead.comment){let r=e.pending,s;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>r&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r)),Ae(i),e.pending!==0)return e.last_flush=-1,ve;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&&(i.adler=de(i.adler,e.pending_buf,e.pending-r,r))}e.status=ll}if(e.status===ll){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(Ae(i),e.pending!==0))return e.last_flush=-1,ve;jt(e,i.adler&255),jt(e,i.adler>>8&255),i.adler=0}if(e.status=Yi,Ae(i),e.pending!==0)return e.last_flush=-1,ve}if(i.avail_in!==0||e.lookahead!==0||t!==xi&&e.status!==wr){let r=e.level===0?Iu(e,t):e.strategy===ga?pv(e,t):e.strategy===Qm?gv(e,t):Sr[e.level].func(e,t);if((r===Wi||r===Tn)&&(e.status=wr),r===xe||r===Wi)return i.avail_out===0&&(e.last_flush=-1),ve;if(r===En&&(t===Ym?Xm(e):t!==Mu&&(el(e,0,0,!1),t===Wm&&(Ci(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),Ae(i),i.avail_out===0))return e.last_flush=-1,ve}return t!==Fe?ve:e.wrap<=0?Ru:(e.wrap===2?(jt(e,i.adler&255),jt(e,i.adler>>8&255),jt(e,i.adler>>16&255),jt(e,i.adler>>24&255),jt(e,i.total_in&255),jt(e,i.total_in>>8&255),jt(e,i.total_in>>16&255),jt(e,i.total_in>>24&255)):(xr(e,i.adler>>>16),xr(e,i.adler&65535)),Ae(i),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?ve:Ru)},wv=i=>{if(Cr(i))return Ye;const t=i.state.status;return i.state=null,t===Yi?Ki(i,Km):ve},xv=(i,t)=>{let e=t.length;if(Cr(i))return Ye;const n=i.state,r=n.wrap;if(r===2||r===1&&n.status!==kn||n.lookahead)return Ye;if(r===1&&(i.adler=br(i.adler,t,e,0)),n.wrap=0,e>=n.w_size){r===0&&(Ci(n.head),n.strstart=0,n.block_start=0,n.insert=0);let l=new Uint8Array(n.w_size);l.set(t.subarray(e-n.w_size,e),0),t=l,e=n.w_size}const s=i.avail_in,a=i.next_in,o=i.input;for(i.avail_in=e,i.next_in=0,i.input=t,Pn(n);n.lookahead>=Gt;){let l=n.strstart,h=n.lookahead-(Gt-1);do n.ins_h=ki(n,n.ins_h,n.window[l+Gt-1]),n.prev[l&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=l,l++;while(--h);n.strstart=l,n.lookahead=Gt-1,Pn(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=Gt-1,n.match_available=0,i.next_in=a,i.input=o,i.avail_in=s,n.wrap=r,ve};var Sv=yv,Cv=Nu,kv=Fu,Ev=Ou,Tv=_v,Pv=bv,Av=wv,Mv=xv,Rv="pako deflate (from Nodeca project)",kr={deflateInit:Sv,deflateInit2:Cv,deflateReset:kv,deflateResetKeep:Ev,deflateSetHeader:Tv,deflate:Pv,deflateEnd:Av,deflateSetDictionary:Mv,deflateInfo:Rv};const Lv=(i,t)=>Object.prototype.hasOwnProperty.call(i,t);var Dv=function(i){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 n in e)Lv(e,n)&&(i[n]=e[n])}}return i},Iv=i=>{let t=0;for(let n=0,r=i.length;n<r;n++)t+=i[n].length;const e=new Uint8Array(t);for(let n=0,r=0,s=i.length;n<s;n++){let a=i[n];e.set(a,r),r+=a.length}return e},ma={assign:Dv,flattenChunks:Iv};let Uu=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Uu=!1}const Er=new Uint8Array(256);for(let i=0;i<256;i++)Er[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;Er[254]=Er[254]=1;var Ov=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let t,e,n,r,s,a=i.length,o=0;for(r=0;r<a;r++)e=i.charCodeAt(r),(e&64512)===55296&&r+1<a&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-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=i.charCodeAt(r),(e&64512)===55296&&r+1<a&&(n=i.charCodeAt(r+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-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 Fv=(i,t)=>{if(t<65534&&i.subarray&&Uu)return String.fromCharCode.apply(null,i.length===t?i:i.subarray(0,t));let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(i[n]);return e};var Nv=(i,t)=>{const e=t||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,t));let n,r;const s=new Array(e*2);for(r=0,n=0;n<e;){let a=i[n++];if(a<128){s[r++]=a;continue}let o=Er[a];if(o>4){s[r++]=65533,n+=o-1;continue}for(a&=o===2?31:o===3?15:7;o>1&&n<e;)a=a<<6|i[n++]&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 Fv(s,r)},Uv=(i,t)=>{t=t||i.length,t>i.length&&(t=i.length);let e=t-1;for(;e>=0&&(i[e]&192)===128;)e--;return e<0||e===0?t:e+Er[i[e]]>t?e:t},Tr={string2buf:Ov,buf2string:Nv,utf8border:Uv};function Gv(){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 Gu=Gv;const Bu=Object.prototype.toString,{Z_NO_FLUSH:Bv,Z_SYNC_FLUSH:$v,Z_FULL_FLUSH:zv,Z_FINISH:jv,Z_OK:va,Z_STREAM_END:Hv,Z_DEFAULT_COMPRESSION:Vv,Z_DEFAULT_STRATEGY:qv,Z_DEFLATED:Xv}=Xi;function Pr(i){this.options=ma.assign({level:Vv,method:Xv,chunkSize:16384,windowBits:15,memLevel:8,strategy:qv},i||{});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 Gu,this.strm.avail_out=0;let e=kr.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==va)throw new Error(qi[e]);if(t.header&&kr.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=Tr.string2buf(t.dictionary):Bu.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,e=kr.deflateSetDictionary(this.strm,n),e!==va)throw new Error(qi[e]);this._dict_set=!0}}Pr.prototype.push=function(i,t){const e=this.strm,n=this.options.chunkSize;let r,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?jv:Bv,typeof i=="string"?e.input=Tr.string2buf(i):Bu.call(i)==="[object ArrayBuffer]"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(s===$v||s===zv)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(r=kr.deflate(e,s),r===Hv)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),r=kr.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===va;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},Pr.prototype.onData=function(i){this.chunks.push(i)},Pr.prototype.onEnd=function(i){i===va&&(this.result=ma.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function ul(i,t){const e=new Pr(t);if(e.push(i,!0),e.err)throw e.msg||qi[e.err];return e.result}function Yv(i,t){return t=t||{},t.raw=!0,ul(i,t)}function Wv(i,t){return t=t||{},t.gzip=!0,ul(i,t)}var Kv=Pr,Zv=ul,Jv=Yv,Qv=Wv,t5=Xi,e5={Deflate:Kv,deflate:Zv,deflateRaw:Jv,gzip:Qv,constants:t5};const _a=16209,i5=16191;var n5=function(t,e){let n,r,s,a,o,l,h,c,d,f,u,g,m,y,x,C,v,b,k,T,R,A,U,I;const N=t.state;n=t.next_in,U=t.input,r=n+(t.avail_in-5),s=t.next_out,I=t.output,a=s-(e-t.avail_out),o=s+(t.avail_out-257),l=N.dmax,h=N.wsize,c=N.whave,d=N.wnext,f=N.window,u=N.hold,g=N.bits,m=N.lencode,y=N.distcode,x=(1<<N.lenbits)-1,C=(1<<N.distbits)-1;t:do{g<15&&(u+=U[n++]<<g,g+=8,u+=U[n++]<<g,g+=8),v=m[u&x];e:for(;;){if(b=v>>>24,u>>>=b,g-=b,b=v>>>16&255,b===0)I[s++]=v&65535;else if(b&16){k=v&65535,b&=15,b&&(g<b&&(u+=U[n++]<<g,g+=8),k+=u&(1<<b)-1,u>>>=b,g-=b),g<15&&(u+=U[n++]<<g,g+=8,u+=U[n++]<<g,g+=8),v=y[u&C];i:for(;;){if(b=v>>>24,u>>>=b,g-=b,b=v>>>16&255,b&16){if(T=v&65535,b&=15,g<b&&(u+=U[n++]<<g,g+=8,g<b&&(u+=U[n++]<<g,g+=8)),T+=u&(1<<b)-1,T>l){t.msg="invalid distance too far back",N.mode=_a;break t}if(u>>>=b,g-=b,b=s-a,T>b){if(b=T-b,b>c&&N.sane){t.msg="invalid distance too far back",N.mode=_a;break t}if(R=0,A=f,d===0){if(R+=h-b,b<k){k-=b;do I[s++]=f[R++];while(--b);R=s-T,A=I}}else if(d<b){if(R+=h+d-b,b-=d,b<k){k-=b;do I[s++]=f[R++];while(--b);if(R=0,d<k){b=d,k-=b;do I[s++]=f[R++];while(--b);R=s-T,A=I}}}else if(R+=d-b,b<k){k-=b;do I[s++]=f[R++];while(--b);R=s-T,A=I}for(;k>2;)I[s++]=A[R++],I[s++]=A[R++],I[s++]=A[R++],k-=3;k&&(I[s++]=A[R++],k>1&&(I[s++]=A[R++]))}else{R=s-T;do I[s++]=I[R++],I[s++]=I[R++],I[s++]=I[R++],k-=3;while(k>2);k&&(I[s++]=I[R++],k>1&&(I[s++]=I[R++]))}}else if(b&64){t.msg="invalid distance code",N.mode=_a;break t}else{v=y[(v&65535)+(u&(1<<b)-1)];continue i}break}}else if(b&64)if(b&32){N.mode=i5;break t}else{t.msg="invalid literal/length code",N.mode=_a;break t}else{v=m[(v&65535)+(u&(1<<b)-1)];continue e}break}}while(n<r&&s<o);k=g>>3,n-=k,g-=k<<3,u&=(1<<g)-1,t.next_in=n,t.next_out=s,t.avail_in=n<r?5+(r-n):5-(n-r),t.avail_out=s<o?257+(o-s):257-(s-o),N.hold=u,N.bits=g};const Mn=15,$u=852,zu=592,ju=0,fl=1,Hu=2,r5=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]),s5=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]),a5=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]),o5=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 Ar=(i,t,e,n,r,s,a,o)=>{const l=o.bits;let h=0,c=0,d=0,f=0,u=0,g=0,m=0,y=0,x=0,C=0,v,b,k,T,R,A=null,U;const I=new Uint16Array(Mn+1),N=new Uint16Array(Mn+1);let q=null,W,K,it;for(h=0;h<=Mn;h++)I[h]=0;for(c=0;c<n;c++)I[t[e+c]]++;for(u=l,f=Mn;f>=1&&I[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&&I[d]===0;d++);for(u<d&&(u=d),y=1,h=1;h<=Mn;h++)if(y<<=1,y-=I[h],y<0)return-1;if(y>0&&(i===ju||f!==1))return-1;for(N[1]=0,h=1;h<Mn;h++)N[h+1]=N[h]+I[h];for(c=0;c<n;c++)t[e+c]!==0&&(a[N[t[e+c]]++]=c);if(i===ju?(A=q=a,U=20):i===fl?(A=r5,q=s5,U=257):(A=a5,q=o5,U=0),C=0,c=0,h=d,R=s,g=u,m=0,k=-1,x=1<<u,T=x-1,i===fl&&x>$u||i===Hu&&x>zu)return 1;for(;;){W=h-m,a[c]+1<U?(K=0,it=a[c]):a[c]>=U?(K=q[a[c]-U],it=A[a[c]-U]):(K=32+64,it=0),v=1<<h-m,b=1<<g,d=b;do b-=v,r[R+(C>>m)+b]=W<<24|K<<16|it|0;while(b!==0);for(v=1<<h-1;C&v;)v>>=1;if(v!==0?(C&=v-1,C+=v):C=0,c++,--I[h]===0){if(h===f)break;h=t[e+a[c]]}if(h>u&&(C&T)!==k){for(m===0&&(m=u),R+=d,g=h-m,y=1<<g;g+m<f&&(y-=I[g+m],!(y<=0));)g++,y<<=1;if(x+=1<<g,i===fl&&x>$u||i===Hu&&x>zu)return 1;k=C&T,r[k]=u<<24|g<<16|R-s|0}}return C!==0&&(r[R+C]=h-m<<24|64<<16|0),o.bits=u,0};const l5=0,Vu=1,qu=2,{Z_FINISH:Xu,Z_BLOCK:h5,Z_TREES:ya,Z_OK:Zi,Z_STREAM_END:c5,Z_NEED_DICT:u5,Z_STREAM_ERROR:Ne,Z_DATA_ERROR:Yu,Z_MEM_ERROR:Wu,Z_BUF_ERROR:f5,Z_DEFLATED:Ku}=Xi,ba=16180,Zu=16181,Ju=16182,Qu=16183,tf=16184,ef=16185,nf=16186,rf=16187,sf=16188,af=16189,wa=16190,si=16191,dl=16192,of=16193,gl=16194,lf=16195,hf=16196,cf=16197,uf=16198,xa=16199,Sa=16200,ff=16201,df=16202,gf=16203,pf=16204,mf=16205,pl=16206,vf=16207,_f=16208,Qt=16209,yf=16210,bf=16211,d5=852,g5=592,p5=15,wf=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function m5(){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 Ji=i=>{if(!i)return 1;const t=i.state;return!t||t.strm!==i||t.mode<ba||t.mode>bf?1:0},xf=i=>{if(Ji(i))return Ne;const t=i.state;return i.total_in=i.total_out=t.total=0,i.msg="",t.wrap&&(i.adler=t.wrap&1),t.mode=ba,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(d5),t.distcode=t.distdyn=new Int32Array(g5),t.sane=1,t.back=-1,Zi},Sf=i=>{if(Ji(i))return Ne;const t=i.state;return t.wsize=0,t.whave=0,t.wnext=0,xf(i)},Cf=(i,t)=>{let e;if(Ji(i))return Ne;const n=i.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Ne:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,Sf(i))},kf=(i,t)=>{if(!i)return Ne;const e=new m5;i.state=e,e.strm=i,e.window=null,e.mode=ba;const n=Cf(i,t);return n!==Zi&&(i.state=null),n},v5=i=>kf(i,p5);let Ef=!0,ml,vl;const _5=i=>{if(Ef){ml=new Int32Array(512),vl=new Int32Array(32);let t=0;for(;t<144;)i.lens[t++]=8;for(;t<256;)i.lens[t++]=9;for(;t<280;)i.lens[t++]=7;for(;t<288;)i.lens[t++]=8;for(Ar(Vu,i.lens,0,288,ml,0,i.work,{bits:9}),t=0;t<32;)i.lens[t++]=5;Ar(qu,i.lens,0,32,vl,0,i.work,{bits:5}),Ef=!1}i.lencode=ml,i.lenbits=9,i.distcode=vl,i.distbits=5},Tf=(i,t,e,n)=>{let r;const s=i.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=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>n&&(r=n),s.window.set(t.subarray(e-n,e-n+r),s.wnext),n-=r,n?(s.window.set(t.subarray(e-n,e),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},y5=(i,t)=>{let e,n,r,s,a,o,l,h,c,d,f,u,g,m,y=0,x,C,v,b,k,T,R,A;const U=new Uint8Array(4);let I,N;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ji(i)||!i.output||!i.input&&i.avail_in!==0)return Ne;e=i.state,e.mode===si&&(e.mode=dl),a=i.next_out,r=i.output,l=i.avail_out,s=i.next_in,n=i.input,o=i.avail_in,h=e.hold,c=e.bits,d=o,f=l,A=Zi;t:for(;;)switch(e.mode){case ba:if(e.wrap===0){e.mode=dl;break}for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.wrap&2&&h===35615){e.wbits===0&&(e.wbits=15),e.check=0,U[0]=h&255,U[1]=h>>>8&255,e.check=de(e.check,U,2,0),h=0,c=0,e.mode=Zu;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((h&255)<<8)+(h>>8))%31){i.msg="incorrect header check",e.mode=Qt;break}if((h&15)!==Ku){i.msg="unknown compression method",e.mode=Qt;break}if(h>>>=4,c-=4,R=(h&15)+8,e.wbits===0&&(e.wbits=R),R>15||R>e.wbits){i.msg="invalid window size",e.mode=Qt;break}e.dmax=1<<e.wbits,e.flags=0,i.adler=e.check=1,e.mode=h&512?af:si,h=0,c=0;break;case Zu:for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.flags=h,(e.flags&255)!==Ku){i.msg="unknown compression method",e.mode=Qt;break}if(e.flags&57344){i.msg="unknown header flags set",e.mode=Qt;break}e.head&&(e.head.text=h>>8&1),e.flags&512&&e.wrap&4&&(U[0]=h&255,U[1]=h>>>8&255,e.check=de(e.check,U,2,0)),h=0,c=0,e.mode=Ju;case Ju:for(;c<32;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.head&&(e.head.time=h),e.flags&512&&e.wrap&4&&(U[0]=h&255,U[1]=h>>>8&255,U[2]=h>>>16&255,U[3]=h>>>24&255,e.check=de(e.check,U,4,0)),h=0,c=0,e.mode=Qu;case Qu:for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.head&&(e.head.xflags=h&255,e.head.os=h>>8),e.flags&512&&e.wrap&4&&(U[0]=h&255,U[1]=h>>>8&255,e.check=de(e.check,U,2,0)),h=0,c=0,e.mode=tf;case tf:if(e.flags&1024){for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.length=h,e.head&&(e.head.extra_len=h),e.flags&512&&e.wrap&4&&(U[0]=h&255,U[1]=h>>>8&255,e.check=de(e.check,U,2,0)),h=0,c=0}else e.head&&(e.head.extra=null);e.mode=ef;case ef:if(e.flags&1024&&(u=e.length,u>o&&(u=o),u&&(e.head&&(R=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(s,s+u),R)),e.flags&512&&e.wrap&4&&(e.check=de(e.check,n,u,s)),o-=u,s+=u,e.length-=u),e.length))break t;e.length=0,e.mode=nf;case nf:if(e.flags&2048){if(o===0)break t;u=0;do R=n[s+u++],e.head&&R&&e.length<65536&&(e.head.name+=String.fromCharCode(R));while(R&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=de(e.check,n,u,s)),o-=u,s+=u,R)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=rf;case rf:if(e.flags&4096){if(o===0)break t;u=0;do R=n[s+u++],e.head&&R&&e.length<65536&&(e.head.comment+=String.fromCharCode(R));while(R&&u<o);if(e.flags&512&&e.wrap&4&&(e.check=de(e.check,n,u,s)),o-=u,s+=u,R)break t}else e.head&&(e.head.comment=null);e.mode=sf;case sf:if(e.flags&512){for(;c<16;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.wrap&4&&h!==(e.check&65535)){i.msg="header crc mismatch",e.mode=Qt;break}h=0,c=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),i.adler=e.check=0,e.mode=si;break;case af:for(;c<32;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}i.adler=e.check=wf(h),h=0,c=0,e.mode=wa;case wa:if(e.havedict===0)return i.next_out=a,i.avail_out=l,i.next_in=s,i.avail_in=o,e.hold=h,e.bits=c,u5;i.adler=e.check=1,e.mode=si;case si:if(t===h5||t===ya)break t;case dl:if(e.last){h>>>=c&7,c-=c&7,e.mode=pl;break}for(;c<3;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}switch(e.last=h&1,h>>>=1,c-=1,h&3){case 0:e.mode=of;break;case 1:if(_5(e),e.mode=xa,t===ya){h>>>=2,c-=2;break t}break;case 2:e.mode=hf;break;case 3:i.msg="invalid block type",e.mode=Qt}h>>>=2,c-=2;break;case of:for(h>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if((h&65535)!==(h>>>16^65535)){i.msg="invalid stored block lengths",e.mode=Qt;break}if(e.length=h&65535,h=0,c=0,e.mode=gl,t===ya)break t;case gl:e.mode=lf;case lf:if(u=e.length,u){if(u>o&&(u=o),u>l&&(u=l),u===0)break t;r.set(n.subarray(s,s+u),a),o-=u,s+=u,l-=u,a+=u,e.length-=u;break}e.mode=si;break;case hf:for(;c<14;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.nlen=(h&31)+257,h>>>=5,c-=5,e.ndist=(h&31)+1,h>>>=5,c-=5,e.ncode=(h&15)+4,h>>>=4,c-=4,e.nlen>286||e.ndist>30){i.msg="too many length or distance symbols",e.mode=Qt;break}e.have=0,e.mode=cf;case cf:for(;e.have<e.ncode;){for(;c<3;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.lens[q[e.have++]]=h&7,h>>>=3,c-=3}for(;e.have<19;)e.lens[q[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,I={bits:e.lenbits},A=Ar(l5,e.lens,0,19,e.lencode,0,e.work,I),e.lenbits=I.bits,A){i.msg="invalid code lengths set",e.mode=Qt;break}e.have=0,e.mode=uf;case uf:for(;e.have<e.nlen+e.ndist;){for(;y=e.lencode[h&(1<<e.lenbits)-1],x=y>>>24,C=y>>>16&255,v=y&65535,!(x<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(v<16)h>>>=x,c-=x,e.lens[e.have++]=v;else{if(v===16){for(N=x+2;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(h>>>=x,c-=x,e.have===0){i.msg="invalid bit length repeat",e.mode=Qt;break}R=e.lens[e.have-1],u=3+(h&3),h>>>=2,c-=2}else if(v===17){for(N=x+3;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}h>>>=x,c-=x,R=0,u=3+(h&7),h>>>=3,c-=3}else{for(N=x+7;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}h>>>=x,c-=x,R=0,u=11+(h&127),h>>>=7,c-=7}if(e.have+u>e.nlen+e.ndist){i.msg="invalid bit length repeat",e.mode=Qt;break}for(;u--;)e.lens[e.have++]=R}}if(e.mode===Qt)break;if(e.lens[256]===0){i.msg="invalid code -- missing end-of-block",e.mode=Qt;break}if(e.lenbits=9,I={bits:e.lenbits},A=Ar(Vu,e.lens,0,e.nlen,e.lencode,0,e.work,I),e.lenbits=I.bits,A){i.msg="invalid literal/lengths set",e.mode=Qt;break}if(e.distbits=6,e.distcode=e.distdyn,I={bits:e.distbits},A=Ar(qu,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,I),e.distbits=I.bits,A){i.msg="invalid distances set",e.mode=Qt;break}if(e.mode=xa,t===ya)break t;case xa:e.mode=Sa;case Sa:if(o>=6&&l>=258){i.next_out=a,i.avail_out=l,i.next_in=s,i.avail_in=o,e.hold=h,e.bits=c,n5(i,f),a=i.next_out,r=i.output,l=i.avail_out,s=i.next_in,n=i.input,o=i.avail_in,h=e.hold,c=e.bits,e.mode===si&&(e.back=-1);break}for(e.back=0;y=e.lencode[h&(1<<e.lenbits)-1],x=y>>>24,C=y>>>16&255,v=y&65535,!(x<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(C&&!(C&240)){for(b=x,k=C,T=v;y=e.lencode[T+((h&(1<<b+k)-1)>>b)],x=y>>>24,C=y>>>16&255,v=y&65535,!(b+x<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}h>>>=b,c-=b,e.back+=b}if(h>>>=x,c-=x,e.back+=x,e.length=v,C===0){e.mode=mf;break}if(C&32){e.back=-1,e.mode=si;break}if(C&64){i.msg="invalid literal/length code",e.mode=Qt;break}e.extra=C&15,e.mode=ff;case ff:if(e.extra){for(N=e.extra;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.length+=h&(1<<e.extra)-1,h>>>=e.extra,c-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=df;case df:for(;y=e.distcode[h&(1<<e.distbits)-1],x=y>>>24,C=y>>>16&255,v=y&65535,!(x<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(!(C&240)){for(b=x,k=C,T=v;y=e.distcode[T+((h&(1<<b+k)-1)>>b)],x=y>>>24,C=y>>>16&255,v=y&65535,!(b+x<=c);){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}h>>>=b,c-=b,e.back+=b}if(h>>>=x,c-=x,e.back+=x,C&64){i.msg="invalid distance code",e.mode=Qt;break}e.offset=v,e.extra=C&15,e.mode=gf;case gf:if(e.extra){for(N=e.extra;c<N;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}e.offset+=h&(1<<e.extra)-1,h>>>=e.extra,c-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){i.msg="invalid distance too far back",e.mode=Qt;break}e.mode=pf;case pf:if(l===0)break t;if(u=f-l,e.offset>u){if(u=e.offset-u,u>e.whave&&e.sane){i.msg="invalid distance too far back",e.mode=Qt;break}u>e.wnext?(u-=e.wnext,g=e.wsize-u):g=e.wnext-u,u>e.length&&(u=e.length),m=e.window}else m=r,g=a-e.offset,u=e.length;u>l&&(u=l),l-=u,e.length-=u;do r[a++]=m[g++];while(--u);e.length===0&&(e.mode=Sa);break;case mf:if(l===0)break t;r[a++]=e.length,l--,e.mode=Sa;break;case pl:if(e.wrap){for(;c<32;){if(o===0)break t;o--,h|=n[s++]<<c,c+=8}if(f-=l,i.total_out+=f,e.total+=f,e.wrap&4&&f&&(i.adler=e.check=e.flags?de(e.check,r,f,a-f):br(e.check,r,f,a-f)),f=l,e.wrap&4&&(e.flags?h:wf(h))!==e.check){i.msg="incorrect data check",e.mode=Qt;break}h=0,c=0}e.mode=vf;case vf:if(e.wrap&&e.flags){for(;c<32;){if(o===0)break t;o--,h+=n[s++]<<c,c+=8}if(e.wrap&4&&h!==(e.total&4294967295)){i.msg="incorrect length check",e.mode=Qt;break}h=0,c=0}e.mode=_f;case _f:A=c5;break t;case Qt:A=Yu;break t;case yf:return Wu;case bf:default:return Ne}return i.next_out=a,i.avail_out=l,i.next_in=s,i.avail_in=o,e.hold=h,e.bits=c,(e.wsize||f!==i.avail_out&&e.mode<Qt&&(e.mode<pl||t!==Xu))&&Tf(i,i.output,i.next_out,f-i.avail_out),d-=i.avail_in,f-=i.avail_out,i.total_in+=d,i.total_out+=f,e.total+=f,e.wrap&4&&f&&(i.adler=e.check=e.flags?de(e.check,r,f,i.next_out-f):br(e.check,r,f,i.next_out-f)),i.data_type=e.bits+(e.last?64:0)+(e.mode===si?128:0)+(e.mode===xa||e.mode===gl?256:0),(d===0&&f===0||t===Xu)&&A===Zi&&(A=f5),A},b5=i=>{if(Ji(i))return Ne;let t=i.state;return t.window&&(t.window=null),i.state=null,Zi},w5=(i,t)=>{if(Ji(i))return Ne;const e=i.state;return e.wrap&2?(e.head=t,t.done=!1,Zi):Ne},x5=(i,t)=>{const e=t.length;let n,r,s;return Ji(i)||(n=i.state,n.wrap!==0&&n.mode!==wa)?Ne:n.mode===wa&&(r=1,r=br(r,t,e,0),r!==n.check)?Yu:(s=Tf(i,t,e,e),s?(n.mode=yf,Wu):(n.havedict=1,Zi))};var S5=Sf,C5=Cf,k5=xf,E5=v5,T5=kf,P5=y5,A5=b5,M5=w5,R5=x5,L5="pako inflate (from Nodeca project)",ai={inflateReset:S5,inflateReset2:C5,inflateResetKeep:k5,inflateInit:E5,inflateInit2:T5,inflate:P5,inflateEnd:A5,inflateGetHeader:M5,inflateSetDictionary:R5,inflateInfo:L5};function D5(){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 I5=D5;const Pf=Object.prototype.toString,{Z_NO_FLUSH:O5,Z_FINISH:F5,Z_OK:Mr,Z_STREAM_END:_l,Z_NEED_DICT:yl,Z_STREAM_ERROR:N5,Z_DATA_ERROR:Af,Z_MEM_ERROR:U5}=Xi;function Rr(i){this.options=ma.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});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&&!(i&&i.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 Gu,this.strm.avail_out=0;let e=ai.inflateInit2(this.strm,t.windowBits);if(e!==Mr)throw new Error(qi[e]);if(this.header=new I5,ai.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Tr.string2buf(t.dictionary):Pf.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=ai.inflateSetDictionary(this.strm,t.dictionary),e!==Mr)))throw new Error(qi[e])}Rr.prototype.push=function(i,t){const e=this.strm,n=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?F5:O5,Pf.call(i)==="[object ArrayBuffer]"?e.input=new Uint8Array(i):e.input=i,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),s=ai.inflate(e,a),s===yl&&r&&(s=ai.inflateSetDictionary(e,r),s===Mr?s=ai.inflate(e,a):s===Af&&(s=yl));e.avail_in>0&&s===_l&&e.state.wrap>0&&i[e.next_in]!==0;)ai.inflateReset(e),s=ai.inflate(e,a);switch(s){case N5:case Af:case yl:case U5:return this.onEnd(s),this.ended=!0,!1}if(o=e.avail_out,e.next_out&&(e.avail_out===0||s===_l))if(this.options.to==="string"){let l=Tr.utf8border(e.output,e.next_out),h=e.next_out-l,c=Tr.buf2string(e.output,l);e.next_out=h,e.avail_out=n-h,h&&e.output.set(e.output.subarray(l,l+h),0),this.onData(c)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(s===Mr&&o===0)){if(s===_l)return s=ai.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},Rr.prototype.onData=function(i){this.chunks.push(i)},Rr.prototype.onEnd=function(i){i===Mr&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=ma.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function bl(i,t){const e=new Rr(t);if(e.push(i),e.err)throw e.msg||qi[e.err];return e.result}function G5(i,t){return t=t||{},t.raw=!0,bl(i,t)}var B5=Rr,$5=bl,z5=G5,j5=bl,H5=Xi,V5={Inflate:B5,inflate:$5,inflateRaw:z5,ungzip:j5,constants:H5};const{Deflate:q5,deflate:X5,deflateRaw:Y5,gzip:W5}=e5,{Inflate:K5,inflate:Z5,inflateRaw:J5,ungzip:Q5}=V5;var t_=q5,e_=X5,i_=Y5,n_=W5,r_=K5,s_=Z5,a_=J5,o_=Q5,l_=Xi,h_={Deflate:t_,deflate:e_,deflateRaw:i_,gzip:n_,Inflate:r_,inflate:s_,inflateRaw:a_,ungzip:o_,constants:l_};const ut={};ut.toRGBA8=function(i){const t=i.width,e=i.height;if(i.tabs.acTL===null)return[ut.toRGBA8.decodeImage(i.data,t,e,i).buffer];const n=[];i.frames[0].data===null&&(i.frames[0].data=i.data);const r=t*e*4,s=new Uint8Array(r),a=new Uint8Array(r),o=new Uint8Array(r);for(let l=0;l<i.frames.length;l++){const h=i.frames[l],c=h.rect.x,d=h.rect.y,f=h.rect.width,u=h.rect.height,g=ut.toRGBA8.decodeImage(h.data,f,u,i);if(l!==0)for(let m=0;m<r;m++)o[m]=s[m];if(h.blend===0?ut._copyTile(g,f,u,s,t,e,c,d,0):h.blend===1&&ut._copyTile(g,f,u,s,t,e,c,d,1),n.push(s.buffer.slice(0)),h.dispose===1)ut._copyTile(a,f,u,s,t,e,c,d,0);else if(h.dispose===2)for(let m=0;m<r;m++)s[m]=o[m]}return n},ut.toRGBA8.decodeImage=function(i,t,e,n){const r=t*e,s=ut.decode._getBPP(n),a=Math.ceil(t*s/8),o=new Uint8Array(r*4),l=new Uint32Array(o.buffer),h=n.ctype,c=n.depth,d=ut._bin.readUshort;if(h===6){const f=r<<2;if(c===8)for(let u=0;u<f;u+=4)o[u]=i[u],o[u+1]=i[u+1],o[u+2]=i[u+2],o[u+3]=i[u+3];if(c===16)for(let u=0;u<f;u++)o[u]=i[u<<1]}else if(h===2){const f=n.tabs.tRNS;if(f===null){if(c===8)for(let u=0;u<r;u++){const g=u*3;l[u]=255<<24|i[g+2]<<16|i[g+1]<<8|i[g]}if(c===16)for(let u=0;u<r;u++){const g=u*6;l[u]=255<<24|i[g+4]<<16|i[g+2]<<8|i[g]}}else{const u=f[0],g=f[1],m=f[2];if(c===8)for(let y=0;y<r;y++){const x=y<<2,C=y*3;l[y]=255<<24|i[C+2]<<16|i[C+1]<<8|i[C],i[C]===u&&i[C+1]===g&&i[C+2]===m&&(o[x+3]=0)}if(c===16)for(let y=0;y<r;y++){const x=y<<2,C=y*6;l[y]=255<<24|i[C+4]<<16|i[C+2]<<8|i[C],d(i,C)===u&&d(i,C+2)===g&&d(i,C+4)===m&&(o[x+3]=0)}}}else if(h===3){const f=n.tabs.PLTE,u=n.tabs.tRNS,g=u?u.length:0;if(c===1)for(let m=0;m<e;m++){const y=m*a,x=m*t;for(let C=0;C<t;C++){const v=x+C<<2,b=i[y+(C>>3)]>>7-((C&7)<<0)&1,k=3*b;o[v]=f[k],o[v+1]=f[k+1],o[v+2]=f[k+2],o[v+3]=b<g?u[b]:255}}if(c===2)for(let m=0;m<e;m++){const y=m*a,x=m*t;for(let C=0;C<t;C++){const v=x+C<<2,b=i[y+(C>>2)]>>6-((C&3)<<1)&3,k=3*b;o[v]=f[k],o[v+1]=f[k+1],o[v+2]=f[k+2],o[v+3]=b<g?u[b]:255}}if(c===4)for(let m=0;m<e;m++){const y=m*a,x=m*t;for(let C=0;C<t;C++){const v=x+C<<2,b=i[y+(C>>1)]>>4-((C&1)<<2)&15,k=3*b;o[v]=f[k],o[v+1]=f[k+1],o[v+2]=f[k+2],o[v+3]=b<g?u[b]:255}}if(c===8)for(let m=0;m<r;m++){const y=m<<2,x=i[m],C=3*x;o[y]=f[C],o[y+1]=f[C+1],o[y+2]=f[C+2],o[y+3]=x<g?u[x]:255}}else if(h===4){if(c===8)for(let f=0;f<r;f++){const u=f<<2,g=f<<1,m=i[g];o[u]=m,o[u+1]=m,o[u+2]=m,o[u+3]=i[g+1]}if(c===16)for(let f=0;f<r;f++){const u=f<<2,g=f<<2,m=i[g];o[u]=m,o[u+1]=m,o[u+2]=m,o[u+3]=i[g+2]}}else if(h===0){const f=n.tabs.tRNS?n.tabs.tRNS:-1;for(let u=0;u<e;u++){const g=u*a,m=u*t;if(c===1)for(let y=0;y<t;y++){const x=255*(i[g+(y>>>3)]>>>7-(y&7)&1),C=x===f*255?0:255;l[m+y]=C<<24|x<<16|x<<8|x}else if(c===2)for(let y=0;y<t;y++){const x=85*(i[g+(y>>>2)]>>>6-((y&3)<<1)&3),C=x===f*85?0:255;l[m+y]=C<<24|x<<16|x<<8|x}else if(c===4)for(let y=0;y<t;y++){const x=17*(i[g+(y>>>1)]>>>4-((y&1)<<2)&15),C=x===f*17?0:255;l[m+y]=C<<24|x<<16|x<<8|x}else if(c===8)for(let y=0;y<t;y++){const x=i[g+y],C=x===f?0:255;l[m+y]=C<<24|x<<16|x<<8|x}else if(c===16)for(let y=0;y<t;y++){const x=i[g+(y<<1)],C=d(i,g+(y<<1))===f?0:255;l[m+y]=C<<24|x<<16|x<<8|x}}}return o},ut.decode=function(i){const t=new Uint8Array(i);let e=8;const n=ut._bin,r=n.readUshort,s=n.readUint,a={tabs:{},frames:[]},o=new Uint8Array(t.length);let l=0,h,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=n.readUint(t,e);e+=4;const u=n.readASCII(t,e,4);if(e+=4,u==="IHDR")ut.decode._IHDR(t,e,a);else if(u==="CgBI")a.tabs[u]=t.slice(e,e+4);else if(u==="IDAT"){for(let g=0;g<f;g++)o[l+g]=t[e+g];l+=f}else if(u==="acTL")a.tabs[u]={num_frames:s(t,e),num_plays:s(t,e+4)},h=new Uint8Array(t.length);else if(u==="fcTL"){if(c!==0){const x=a.frames[a.frames.length-1];x.data=ut.decode._decompress(a,h.slice(0,c),x.rect.width,x.rect.height),c=0}const g={x:s(t,e+12),y:s(t,e+16),width:s(t,e+4),height:s(t,e+8)};let m=r(t,e+22);m=r(t,e+20)/(m===0?100:m);const y={rect:g,delay:Math.round(m*1e3),dispose:t[e+24],blend:t[e+25]};a.frames.push(y)}else if(u==="fdAT"){for(let g=0;g<f-4;g++)h[c+g]=t[e+g+4];c+=f-4}else if(u==="pHYs")a.tabs[u]=[n.readUint(t,e),n.readUint(t,e+4),t[e+8]];else if(u==="cHRM"){a.tabs[u]=[];for(let g=0;g<8;g++)a.tabs[u].push(n.readUint(t,e+g*4))}else if(u==="tEXt"||u==="zTXt"){a.tabs[u]===null&&(a.tabs[u]={});const g=n.nextZero(t,e),m=n.readASCII(t,e,g-e);let y;const x=e+f-g-1;if(u==="tEXt")y=n.readASCII(t,g+1,x);else{const C=ut.decode._inflate(t.slice(g+2,g+2+x));y=n.readUTF8(C,0,C.length)}a.tabs[u][m]=y}else if(u==="iTXt"){a.tabs[u]==null&&(a.tabs[u]={});let g=0,m=e;g=n.nextZero(t,m);const y=n.readASCII(t,m,g-m);m=g+1;const x=t[m];m+=2,g=n.nextZero(t,m),m=g+1,g=n.nextZero(t,m),m=g+1;let C;const v=f-(m-e);if(x===0)C=n.readUTF8(t,m,v);else{const b=ut.decode._inflate(t.slice(m,m+v));C=n.readUTF8(b,0,b.length)}a.tabs[u][y]=C}else if(u==="PLTE")a.tabs[u]=n.readBytes(t,e,f);else if(u==="hIST"){const g=a.tabs.PLTE.length/3;a.tabs[u]=[];for(let m=0;m<g;m++)a.tabs[u].push(r(t,e+m*2))}else if(u==="tRNS")a.ctype===3?a.tabs[u]=n.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]=n.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=ut.decode._decompress(a,h.slice(0,c),f.rect.width,f.rect.height),c=0}return a.data=ut.decode._decompress(a,o,a.width,a.height),delete a.compress,delete a.interlace,delete a.filter,a},ut.decode._decompress=function(i,t,e,n){const r=ut.decode._getBPP(i),s=Math.ceil(e*r/8),a=new Uint8Array((s+1+i.interlace)*n);return i.tabs.CgBI?t=ut.inflateRaw(t,a):t=ut.decode._inflate(t,a),i.interlace===0?t=ut.decode._filterZero(t,i,0,e,n):i.interlace===1&&(t=ut.decode._readInterlace(t,i)),t},ut.decode._inflate=function(i,t){return ut.inflateRaw(new Uint8Array(i.buffer,2,i.length-6),t)},ut.inflateRaw=function(){const i={};return i.H={},i.H.N=function(t,e){const n=Uint8Array;let r=0,s=0,a=0,o=0,l=0,h=0,c=0,d=0,f=0,u,g;if(t[0]===3&&t[1]===0)return e||new n(0);const m=i.H,y=m.b,x=m.e,C=m.R,v=m.n,b=m.A,k=m.Z,T=m.m,R=e===null;for(R&&(e=new n(t.length>>>2<<3));r===0;){if(r=y(t,f,1),s=y(t,f+1,2),f+=3,s===0){f&7&&(f+=8-(f&7));const A=(f>>>3)+4,U=t[A-4]|t[A-3]<<8;R&&(e=i.H.W(e,d+U)),e.set(new n(t.buffer,t.byteOffset+A,U),d),f=A+U<<3,d+=U;continue}if(R&&(e=i.H.W(e,d+(1<<17))),s===1&&(u=T.J,g=T.h,h=512-1,c=32-1),s===2){a=x(t,f,5)+257,o=x(t,f+5,5)+1,l=x(t,f+10,4)+4,f+=14;let A=1;for(let N=0;N<38;N+=2)T.Q[N]=0,T.Q[N+1]=0;for(let N=0;N<l;N++){const q=x(t,f+N*3,3);T.Q[(T.X[N]<<1)+1]=q,q>A&&(A=q)}f+=3*l,v(T.Q,A),b(T.Q,A,T.u),u=T.w,g=T.d,f=C(T.u,(1<<A)-1,a+o,t,f,T.v);const U=m.V(T.v,0,a,T.C);h=(1<<U)-1;const I=m.V(T.v,a,o,T.D);c=(1<<I)-1,v(T.C,U),b(T.C,U,u),v(T.D,I),b(T.D,I,g)}for(;;){const A=u[k(t,f)&h];f+=A&15;const U=A>>>4;if(!(U>>>8))e[d++]=U;else{if(U===256)break;{let I=d+U-254;if(U>264){const it=T.q[U-257];I=d+(it>>>3)+x(t,f,it&7),f+=it&7}const N=g[k(t,f)&c];f+=N&15;const q=N>>>4,W=T.c[q],K=(W>>>4)+y(t,f,W&15);for(f+=W&15;d<I;)e[d]=e[d++-K],e[d]=e[d++-K],e[d]=e[d++-K],e[d]=e[d++-K];d=I}}}}return e.length===d?e:e.slice(0,d)},i.H.W=function(t,e){const n=t.length;if(e<=n)return t;const r=new Uint8Array(n<<1);return r.set(t,0),r},i.H.R=function(t,e,n,r,s,a){const o=i.H.e,l=i.H.Z;let h=0;for(;h<n;){const c=t[l(r,s)&e];s+=c&15;const d=c>>>4;if(d<=15)a[h]=d,h++;else{let f=0,u=0;d===16?(u=3+o(r,s,2),s+=2,f=a[h-1]):d===17?(u=3+o(r,s,3),s+=3):d===18&&(u=11+o(r,s,7),s+=7);const g=h+u;for(;h<g;)a[h]=f,h++}}return s},i.H.V=function(t,e,n,r){let s=0,a=0;const o=r.length>>>1;for(;a<n;){const l=t[a+e];r[a<<1]=0,r[(a<<1)+1]=l,l>s&&(s=l),a++}for(;a<o;)r[a<<1]=0,r[(a<<1)+1]=0,a++;return s},i.H.n=function(t,e){const n=i.H.m,r=t.length;let s,a,o,l,h;const c=n.j;for(let f=0;f<=e;f++)c[f]=0;for(l=1;l<r;l+=2)c[t[l]]++;const d=n.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)h=t[o+1],h!==0&&(t[o]=d[h],d[h]++)},i.H.A=function(t,e,n){const r=t.length,a=i.H.m.r;for(let o=0;o<r;o+=2)if(t[o+1]!==0){const l=o>>1,h=t[o+1],c=l<<4|h,d=e-h;let f=t[o]<<d;const u=f+(1<<d);for(;f!==u;){const g=a[f]>>>15-e;n[g]=c,f++}}},i.H.l=function(t,e){const n=i.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]=n[a]>>>r}},i.H.M=function(t,e,n){n=n<<(e&7);const r=e>>>3;t[r]|=n,t[r+1]|=n>>>8},i.H.I=function(t,e,n){n=n<<(e&7);const r=e>>>3;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},i.H.e=function(t,e,n){return(t[e>>>3]|t[(e>>>3)+1]<<8)>>>(e&7)&(1<<n)-1},i.H.b=function(t,e,n){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)&(1<<n)-1},i.H.Z=function(t,e){return(t[e>>>3]|t[(e>>>3)+1]<<8|t[(e>>>3)+2]<<16)>>>(e&7)},i.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)},i.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=i.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 n(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];n(t._,144,8),n(t._,255-143,9),n(t._,279-255,7),n(t._,287-279,8),i.H.n(t._,9),i.H.A(t._,9,t.J),i.H.l(t._,9),n(t.$,32,5),i.H.n(t.$,5),i.H.A(t.$,5,t.h),i.H.l(t.$,5),n(t.Q,19,0),n(t.C,286,0),n(t.D,30,0),n(t.v,320,0)}(),i.H.N}(),ut.decode._readInterlace=function(i,t){const e=t.width,n=t.height,r=ut.decode._getBPP(t),s=r>>3,a=Math.ceil(e*r/8),o=new Uint8Array(n*a);let l=0;const h=[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 g=d[u],m=f[u];let y=0,x=0,C=h[u];for(;C<n;)C+=g,x++;let v=c[u];for(;v<e;)v+=m,y++;const b=Math.ceil(y*r/8);ut.decode._filterZero(i,t,l,y,x);let k=0,T=h[u];for(;T<n;){let R=c[u],A=l+k*b<<3;for(;R<e;){if(r===1){let U=i[A>>3];U=U>>7-(A&7)&1,o[T*a+(R>>3)]|=U<<7-((R&7)<<0)}if(r===2){let U=i[A>>3];U=U>>6-(A&7)&3,o[T*a+(R>>2)]|=U<<6-((R&3)<<1)}if(r===4){let U=i[A>>3];U=U>>4-(A&7)&15,o[T*a+(R>>1)]|=U<<4-((R&1)<<2)}if(r>=8){const U=T*a+R*s;for(let I=0;I<s;I++)o[U+I]=i[(A>>3)+I]}A+=r,R+=m}k++,T+=g}y*x!==0&&(l+=x*(1+b)),u=u+1}return o},ut.decode._getBPP=function(i){return[1,null,3,1,2,null,4][i.ctype]*i.depth},ut.decode._filterZero=function(i,t,e,n,r){let s=ut.decode._getBPP(t);const a=Math.ceil(n*s/8),o=ut.decode._paeth;s=Math.ceil(s/8);let l=0,h=1,c=i[e],d=0;if(c>1&&(i[e]=[0,0,1][c-2]),c===3)for(d=s;d<a;d++)i[d+1]=i[d+1]+(i[d+1-s]>>>1)&255;for(let f=0;f<r;f++)if(l=e+f*a,h=l+f+1,c=i[h-1],d=0,c===0)for(;d<a;d++)i[l+d]=i[h+d];else if(c===1){for(;d<s;d++)i[l+d]=i[h+d];for(;d<a;d++)i[l+d]=i[h+d]+i[l+d-s]}else if(c===2)for(;d<a;d++)i[l+d]=i[h+d]+i[l+d-a];else if(c===3){for(;d<s;d++)i[l+d]=i[h+d]+(i[l+d-a]>>>1);for(;d<a;d++)i[l+d]=i[h+d]+(i[l+d-a]+i[l+d-s]>>>1)}else{for(;d<s;d++)i[l+d]=i[h+d]+o(0,i[l+d-a],0);for(;d<a;d++)i[l+d]=i[h+d]+o(i[l+d-s],i[l+d-a],i[l+d-s-a])}return i},ut.decode._paeth=function(i,t,e){const n=i+t-e,r=n-i,s=n-t,a=n-e;return r*r<=s*s&&r*r<=a*a?i:s*s<=a*a?t:e},ut.decode._IHDR=function(i,t,e){const n=ut._bin;e.width=n.readUint(i,t),t+=4,e.height=n.readUint(i,t),t+=4,e.depth=i[t],t++,e.ctype=i[t],t++,e.compress=i[t],t++,e.filter=i[t],t++,e.interlace=i[t],t++},ut._bin={nextZero:function(i,t){for(;i[t]!==0;)t++;return t},readUshort:function(i,t){return i[t]<<8|i[t+1]},writeUshort:function(i,t,e){i[t]=e>>8&255,i[t+1]=e&255},readUint:function(i,t){return i[t]*(256*256*256)+(i[t+1]<<16|i[t+2]<<8|i[t+3])},writeUint:function(i,t,e){i[t]=e>>24&255,i[t+1]=e>>16&255,i[t+2]=e>>8&255,i[t+3]=e&255},readASCII:function(i,t,e){let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(i[t+r]);return n},writeASCII:function(i,t,e){for(let n=0;n<e.length;n++)i[t+n]=e.charCodeAt(n)},readBytes:function(i,t,e){const n=[];for(let r=0;r<e;r++)n.push(i[t+r]);return n},pad:function(i){return i.length<2?"0"+i:i},readUTF8:function(i,t,e){let n="",r;for(let s=0;s<e;s++)n+="%"+ut._bin.pad(i[t+s].toString(16));try{r=decodeURIComponent(n)}catch{return ut._bin.readASCII(i,t,e)}return r}},ut._copyTile=function(i,t,e,n,r,s,a,o,l){const h=Math.min(t,r),c=Math.min(e,s);let d=0,f=0;for(let u=0;u<c;u++)for(let g=0;g<h;g++)if(a>=0&&o>=0?(d=u*t+g<<2,f=(o+u)*r+a+g<<2):(d=(-o+u)*t-a+g<<2,f=u*r+g<<2),l===0)n[f]=i[d],n[f+1]=i[d+1],n[f+2]=i[d+2],n[f+3]=i[d+3];else if(l===1){const m=i[d+3]*.00392156862745098,y=i[d]*m,x=i[d+1]*m,C=i[d+2]*m,v=n[f+3]*(1/255),b=n[f]*v,k=n[f+1]*v,T=n[f+2]*v,R=1-m,A=m+v*R,U=A===0?0:1/A;n[f+3]=255*A,n[f+0]=(y+b*R)*U,n[f+1]=(x+k*R)*U,n[f+2]=(C+T*R)*U}else if(l===2){const m=i[d+3],y=i[d],x=i[d+1],C=i[d+2],v=n[f+3],b=n[f],k=n[f+1],T=n[f+2];m===v&&y===b&&x===k&&C===T?(n[f]=0,n[f+1]=0,n[f+2]=0,n[f+3]=0):(n[f]=y,n[f+1]=x,n[f+2]=C,n[f+3]=m)}else if(l===3){const m=i[d+3],y=i[d],x=i[d+1],C=i[d+2],v=n[f+3],b=n[f],k=n[f+1],T=n[f+2];if(m===v&&y===b&&x===k&&C===T)continue;if(m<220&&v>20)return!1}return!0},ut.encode=function(i,t,e,n,r,s,a){n===null&&(n=0),a===null&&(a=!1);const o=ut.encode.compress(i,t,e,n,[!1,!1,!1,0,a]);return ut.encode.compressPNG(o,-1),ut.encode._main(o,t,e,r,s)},ut.encodeLL=function(i,t,e,n,r,s,a,o){const l={ctype:0+(n===1?0:2)+(r===0?0:4),depth:s,frames:[]},h=(n+r)*s,c=h*t;for(let f=0;f<i.length;f++)l.frames.push({rect:{x:0,y:0,width:t,height:e},img:new Uint8Array(i[f]),blend:0,dispose:1,bpp:Math.ceil(h/8),bpl:Math.ceil(c/8)});return ut.encode.compressPNG(l,0,!0),ut.encode._main(l,t,e,a,o)},ut.encode._main=function(i,t,e,n,r){r||(r={});const s=ut.crc.crc,a=ut._bin.writeUint,o=ut._bin.writeUshort,l=ut._bin.writeASCII;let h=8;const c=i.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),i.ctype===3){const y=i.plte.length;for(let x=0;x<y;x++)i.plte[x]>>>24!==255&&(d=!0);f+=8+y*3+4+(d?8+y*1+4:0)}for(let y=0;y<i.frames.length;y++){const x=i.frames[y];c&&(f+=38),f+=x.cimg.length+12,y!==0&&(f+=4)}f+=12;const u=new Uint8Array(f),g=[137,80,78,71,13,10,26,10];for(let y=0;y<8;y++)u[y]=g[y];if(a(u,h,13),h+=4,l(u,h,"IHDR"),h+=4,a(u,h,t),h+=4,a(u,h,e),h+=4,u[h]=i.depth,h++,u[h]=i.ctype,h++,u[h]=0,h++,u[h]=0,h++,u[h]=0,h++,a(u,h,s(u,h-17,17)),h+=4,r.sRGB!==null&&r.sRGB!==void 0&&(a(u,h,1),h+=4,l(u,h,"sRGB"),h+=4,u[h]=r.sRGB,h++,a(u,h,s(u,h-5,5)),h+=4),r.pHYs!==null&&r.pHYs!==void 0&&(a(u,h,9),h+=4,l(u,h,"pHYs"),h+=4,a(u,h,r.pHYs[0]),h+=4,a(u,h,r.pHYs[1]),h+=4,u[h]=r.pHYs[2],h++,a(u,h,s(u,h-13,13)),h+=4),c&&(a(u,h,8),h+=4,l(u,h,"acTL"),h+=4,a(u,h,i.frames.length),h+=4,a(u,h,r.loop!=null?r.loop:0),h+=4,a(u,h,s(u,h-12,12)),h+=4),i.ctype===3){const y=i.plte.length;a(u,h,y*3),h+=4,l(u,h,"PLTE"),h+=4;for(let x=0;x<y;x++){const C=x*3,v=i.plte[x],b=v&255,k=v>>>8&255,T=v>>>16&255;u[h+C+0]=b,u[h+C+1]=k,u[h+C+2]=T}if(h+=y*3,a(u,h,s(u,h-y*3-4,y*3+4)),h+=4,d){a(u,h,y),h+=4,l(u,h,"tRNS"),h+=4;for(let x=0;x<y;x++)u[h+x]=i.plte[x]>>>24&255;h+=y,a(u,h,s(u,h-y-4,y+4)),h+=4}}let m=0;for(let y=0;y<i.frames.length;y++){const x=i.frames[y];c&&(a(u,h,26),h+=4,l(u,h,"fcTL"),h+=4,a(u,h,m++),h+=4,a(u,h,x.rect.width),h+=4,a(u,h,x.rect.height),h+=4,a(u,h,x.rect.x),h+=4,a(u,h,x.rect.y),h+=4,o(u,h,n[y]),h+=2,o(u,h,1e3),h+=2,u[h]=x.dispose,h++,u[h]=x.blend,h++,a(u,h,s(u,h-30,30)),h+=4);const C=x.cimg,v=C.length;a(u,h,v+(y===0?0:4)),h+=4;const b=h;l(u,h,y===0?"IDAT":"fdAT"),h+=4,y!==0&&(a(u,h,m++),h+=4),u.set(C,h),h+=v,a(u,h,s(u,b,h-b)),h+=4}return a(u,h,0),h+=4,l(u,h,"IEND"),h+=4,a(u,h,s(u,h-4,4)),h+=4,u.buffer},ut.encode.compressPNG=function(i,t,e){for(let n=0;n<i.frames.length;n++){const r=i.frames[n],s=r.rect.height,a=new Uint8Array(s*r.bpl+s);r.cimg=ut.encode._filterZero(r.img,s,r.bpp,r.bpl,a,t,e)}},ut.encode.compress=function(i,t,e,n,r){const s=r[0],a=r[1],o=r[2],l=r[3],h=r[4];let c=6,d=8,f=255;for(let v=0;v<i.length;v++){const b=new Uint8Array(i[v]),k=b.length;for(let T=0;T<k;T+=4)f&=b[T+3]}const u=f!==255,g=ut.encode.framize(i,t,e,s,a,o),m={},y=[],x=[];if(n!==0){const v=[];for(let A=0;A<g.length;A++)v.push(g[A].img.buffer);const b=ut.encode.concatRGBA(v),k=ut.quantize(b,n);let T=0;const R=new Uint8Array(k.abuf);for(let A=0;A<g.length;A++){const U=g[A].img,I=U.length;x.push(new Uint8Array(k.inds.buffer,T>>2,I>>2));for(let N=0;N<I;N+=4)U[N]=R[T+N],U[N+1]=R[T+N+1],U[N+2]=R[T+N+2],U[N+3]=R[T+N+3];T+=I}for(let A=0;A<k.plte.length;A++)y.push(k.plte[A].est.rgba)}else for(let v=0;v<g.length;v++){const b=g[v],k=new Uint32Array(b.img.buffer),T=b.rect.width,R=k.length,A=new Uint8Array(R);x.push(A);for(let U=0;U<R;U++){const I=k[U];if(U!==0&&I===k[U-1])A[U]=A[U-1];else if(U>T&&I===k[U-T])A[U]=A[U-T];else{let N=m[I];if(N===null&&(m[I]=N=y.length,y.push(I),y.length>=300))break;A[U]=N}}}const C=y.length;C<=256&&h===!1&&(C<=2?d=1:C<=4?d=2:C<=16?d=4:d=8,d=Math.max(d,l));for(let v=0;v<g.length;v++){const b=g[v],k=b.rect.width,T=b.rect.height;let R=b.img,A=4*k,U=4;if(C<=256&&h===!1){A=Math.ceil(d*k/8);const I=new Uint8Array(A*T),N=x[v];for(let q=0;q<T;q++){const W=q*A,K=q*k;if(d===8)for(let it=0;it<k;it++)I[W+it]=N[K+it];else if(d===4)for(let it=0;it<k;it++)I[W+(it>>1)]|=N[K+it]<<4-(it&1)*4;else if(d===2)for(let it=0;it<k;it++)I[W+(it>>2)]|=N[K+it]<<6-(it&3)*2;else if(d===1)for(let it=0;it<k;it++)I[W+(it>>3)]|=N[K+it]<<7-(it&7)*1}R=I,c=3,U=1}else if(u===!1&&g.length===1){const I=new Uint8Array(k*T*3),N=k*T;for(let q=0;q<N;q++){const W=q*3,K=q*4;I[W]=R[K],I[W+1]=R[K+1],I[W+2]=R[K+2]}R=I,c=2,U=3,A=3*k}b.img=R,b.bpl=A,b.bpp=U}return{ctype:c,depth:d,plte:y,frames:g}},ut.encode.framize=function(i,t,e,n,r,s){const a=[];for(let o=0;o<i.length;o++){const l=new Uint8Array(i[o]),h=new Uint32Array(l.buffer);let c,d=0,f=0,u=t,g=e,m=n?1:0;if(o!==0){const y=s||n||o===1||a[o-2].dispose!==0?1:2;let x=0,C=1e9;for(let b=0;b<y;b++){const k=new Uint32Array(i[o-1-b]);let T=t,R=e,A=-1,U=-1;for(let N=0;N<e;N++)for(let q=0;q<t;q++){const W=N*t+q;h[W]!==k[W]&&(q<T&&(T=q),q>A&&(A=q),N<R&&(R=N),N>U&&(U=N))}A===-1&&(T=R=A=U=0),r&&((T&1)===1&&T--,(R&1)===1&&R--);const I=(A-T+1)*(U-R+1);I<C&&(C=I,x=b,d=T,f=R,u=A-T+1,g=U-R+1)}const v=new Uint8Array(i[o-1-x]);x===1&&(a[o-1].dispose=2),c=new Uint8Array(u*g*4),ut._copyTile(v,t,e,c,u,g,-d,-f,0),m=ut._copyTile(l,t,e,c,u,g,-d,-f,3)?1:0,m===1?ut.encode._prepareDiff(l,t,e,c,{x:d,y:f,width:u,height:g}):ut._copyTile(l,t,e,c,u,g,-d,-f,0)}else c=l.slice(0);a.push({rect:{x:d,y:f,width:u,height:g},img:c,blend:m,dispose:0})}if(n)for(let o=0;o<a.length;o++){const l=a[o];if(l.blend===1)continue;const h=l.rect,c=a[o-1].rect,d=Math.min(h.x,c.x),f=Math.min(h.y,c.y),u=Math.max(h.x+h.width,c.x+c.width),g=Math.max(h.y+h.height,c.y+c.height),m={x:d,y:f,width:u-d,height:g-f};a[o-1].dispose=1,o-1!==0&&ut.encode._updateFrame(i,t,e,a,o-1,m,r),ut.encode._updateFrame(i,t,e,a,o,m,r)}return a},ut.encode._updateFrame=function(i,t,e,n,r,s,a){const o=Uint8Array,l=Uint32Array,h=new o(i[r-1]),c=new l(i[r-1]),d=r+1<i.length?new o(i[r+1]):null,f=new o(i[r]),u=new l(f.buffer);let g=t,m=e,y=-1,x=-1;for(let v=0;v<s.height;v++)for(let b=0;b<s.width;b++){const k=s.x+b,T=s.y+v,R=T*t+k,A=u[R];A===0||n[r-1].dispose===0&&c[R]===A&&(d===null||d[R*4+3]!==0)||(k<g&&(g=k),k>y&&(y=k),T<m&&(m=T),T>x&&(x=T))}y===-1&&(g=m=y=x=0),a&&((g&1)===1&&g--,(m&1)===1&&m--),s={x:g,y:m,width:y-g+1,height:x-m+1};const C=n[r];C.rect=s,C.blend=1,C.img=new Uint8Array(s.width*s.height*4),n[r-1].dispose===0?(ut._copyTile(h,t,e,C.img,s.width,s.height,-s.x,-s.y,0),ut.encode._prepareDiff(f,t,e,C.img,s)):ut._copyTile(f,t,e,C.img,s.width,s.height,-s.x,-s.y,0)},ut.encode._prepareDiff=function(i,t,e,n,r){ut._copyTile(i,t,e,n,r.width,r.height,-r.x,-r.y,2)},ut.encode._filterZero=function(i,t,e,n,r,s,a){const o=[];let l=[0,1,2,3,4];s!==-1?l=[s]:(t*n>5e5||e===1)&&(l=[0]);let h;a&&(h={level:0});const c=r.length>1e7&&ou!=null?ou:h_;for(let u=0;u<l.length;u++){for(let g=0;g<t;g++)ut.encode._filterLine(r,i,g,n,e,l[u]);o.push(c.deflate(r,h))}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]},ut.encode._filterLine=function(i,t,e,n,r,s){const a=e*n;let o=a+e;const l=ut.decode._paeth;if(i[o]=s,o++,s===0)if(n<500)for(let h=0;h<n;h++)i[o+h]=t[a+h];else i.set(new Uint8Array(t.buffer,a,n),o);else if(s===1){for(let h=0;h<r;h++)i[o+h]=t[a+h];for(let h=r;h<n;h++)i[o+h]=t[a+h]-t[a+h-r]+256&255}else if(e===0){for(let h=0;h<r;h++)i[o+h]=t[a+h];if(s===2)for(let h=r;h<n;h++)i[o+h]=t[a+h];if(s===3)for(let h=r;h<n;h++)i[o+h]=t[a+h]-(t[a+h-r]>>1)+256&255;if(s===4)for(let h=r;h<n;h++)i[o+h]=t[a+h]-l(t[a+h-r],0,0)+256&255}else{if(s===2)for(let h=0;h<n;h++)i[o+h]=t[a+h]+256-t[a+h-n]&255;if(s===3){for(let h=0;h<r;h++)i[o+h]=t[a+h]+256-(t[a+h-n]>>1)&255;for(let h=r;h<n;h++)i[o+h]=t[a+h]+256-(t[a+h-n]+t[a+h-r]>>1)&255}if(s===4){for(let h=0;h<r;h++)i[o+h]=t[a+h]+256-l(0,t[a+h-n],0)&255;for(let h=r;h<n;h++)i[o+h]=t[a+h]+256-l(t[a+h-r],t[a+h-n],t[a+h-r-n])&255}}},ut.crc={table:function(){const i=new Uint32Array(256);for(let t=0;t<256;t++){let e=t;for(let n=0;n<8;n++)e&1?e=3988292384^e>>>1:e=e>>>1;i[t]=e}return i}(),update:function(i,t,e,n){for(let r=0;r<n;r++)i=ut.crc.table[(i^t[e+r])&255]^i>>>8;return i},crc:function(i,t,e){return ut.crc.update(4294967295,i,t,e)^4294967295}},ut.quantize=function(i,t){const e=new Uint8Array(i),n=e.slice(0),r=new Uint32Array(n.buffer),s=ut.quantize.getKDtree(n,t),a=s[0],o=s[1],l=ut.quantize.planeDst,h=e,c=r,d=h.length,f=new Uint8Array(e.length>>2);let u;if(e.length<2e7)for(let g=0;g<d;g+=4){const m=h[g]*.00392156862745098,y=h[g+1]*(1/255),x=h[g+2]*(1/255),C=h[g+3]*(1/255);u=ut.quantize.getNearest(a,m,y,x,C),f[g>>2]=u.ind,c[g>>2]=u.est.rgba}else for(let g=0;g<d;g+=4){const m=h[g]*.00392156862745098,y=h[g+1]*(1/255),x=h[g+2]*(1/255),C=h[g+3]*(1/255);for(u=a;u.left;)u=l(u.est,m,y,x,C)<=0?u.left:u.right;f[g>>2]=u.ind,c[g>>2]=u.est.rgba}return{abuf:n.buffer,inds:f,plte:o}},ut.quantize.getKDtree=function(i,t,e){e===null&&(e=1e-4);const n=new Uint32Array(i.buffer),r={i0:0,i1:i.length,bst:null,est:null,tdst:0,left:null,right:null};r.bst=ut.quantize.stats(i,r.i0,r.i1),r.est=ut.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 l=s[o],h=ut.quantize.splitPixels(i,n,l.i0,l.i1,l.est.e,l.est.eMq255);if(l.i0>=h||l.i1<=h){l.est.L=0;continue}const d={i0:l.i0,i1:h,bst:null,est:null,tdst:0,left:null,right:null};d.bst=ut.quantize.stats(i,d.i0,d.i1),d.est=ut.quantize.estats(d.bst);const f={i0:h,i1:l.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:l.bst.N-d.bst.N};for(let u=0;u<16;u++)f.bst.R[u]=l.bst.R[u]-d.bst.R[u];for(let u=0;u<4;u++)f.bst.m[u]=l.bst.m[u]-d.bst.m[u];f.est=ut.quantize.estats(f.bst),l.left=d,l.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]},ut.quantize.getNearest=function(i,t,e,n,r){if(i.left==null)return i.tdst=ut.quantize.dist(i.est.q,t,e,n,r),i;const s=ut.quantize.planeDst(i.est,t,e,n,r);let a=i.left,o=i.right;s>0&&(a=i.right,o=i.left);const l=ut.quantize.getNearest(a,t,e,n,r);if(l.tdst<=s*s)return l;const h=ut.quantize.getNearest(o,t,e,n,r);return h.tdst<l.tdst?h:l},ut.quantize.planeDst=function(i,t,e,n,r){const s=i.e;return s[0]*t+s[1]*e+s[2]*n+s[3]*r-i.eMq},ut.quantize.dist=function(i,t,e,n,r){const s=t-i[0],a=e-i[1],o=n-i[2],l=r-i[3];return s*s+a*a+o*o+l*l},ut.quantize.splitPixels=function(i,t,e,n,r,s){const a=ut.quantize.vecDot;for(n-=4;e<n;){for(;a(i,e,r)<=s;)e+=4;for(;a(i,n,r)>s;)n-=4;if(e>=n)break;const o=t[e>>2];t[e>>2]=t[n>>2],t[n>>2]=o,e+=4,n-=4}for(;a(i,e,r)>s;)e-=4;return e+4},ut.quantize.vecDot=function(i,t,e){return i[t]*e[0]+i[t+1]*e[1]+i[t+2]*e[2]+i[t+3]*e[3]},ut.quantize.stats=function(i,t,e){const n=[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=i[a]*.00392156862745098,l=i[a+1]*(1/255),h=i[a+2]*(1/255),c=i[a+3]*(1/255);r[0]+=o,r[1]+=l,r[2]+=h,r[3]+=c,n[0]+=o*o,n[1]+=o*l,n[2]+=o*h,n[3]+=o*c,n[5]+=l*l,n[6]+=l*h,n[7]+=l*c,n[10]+=h*h,n[11]+=h*c,n[15]+=c*c}return n[4]=n[1],n[8]=n[2],n[9]=n[6],n[12]=n[3],n[13]=n[7],n[14]=n[11],{R:n,m:r,N:s}},ut.quantize.estats=function(i){const t=i.R,e=i.m,n=i.N,r=e[0],s=e[1],a=e[2],o=e[3],l=n===0?0:1/n,h=[t[0]-r*r*l,t[1]-r*s*l,t[2]-r*a*l,t[3]-r*o*l,t[4]-s*r*l,t[5]-s*s*l,t[6]-s*a*l,t[7]-s*o*l,t[8]-a*r*l,t[9]-a*s*l,t[10]-a*a*l,t[11]-a*o*l,t[12]-o*r*l,t[13]-o*s*l,t[14]-o*a*l,t[15]-o*o*l],c=h,d=ut.M4;let f=[Math.random(),Math.random(),Math.random(),Math.random()],u=0,g=0;if(n!==0)for(let x=0;x<16&&(f=d.multVec(c,f),g=Math.sqrt(d.dot(f,f)),f=d.sml(1/g,f),!(x!==0&&Math.abs(g-u)<1e-9));x++)u=g;const m=[r*l,s*l,a*l,o*l],y=d.dot(d.sml(255,m),f);return{Cov:h,q:m,e:f,L:u,eMq255:y,eMq:d.dot(f,m),rgba:(Math.round(255*m[3])<<24|Math.round(255*m[2])<<16|Math.round(255*m[1])<<8|Math.round(255*m[0])<<0)>>>0}},ut.M4={multVec:function(i,t){return[i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3],i[4]*t[0]+i[5]*t[1]+i[6]*t[2]+i[7]*t[3],i[8]*t[0]+i[9]*t[1]+i[10]*t[2]+i[11]*t[3],i[12]*t[0]+i[13]*t[1]+i[14]*t[2]+i[15]*t[3]]},dot:function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},sml:function(i,t){return[i*t[0],i*t[1],i*t[2],i*t[3]]}},ut.encode.concatRGBA=function(i){let t=0;for(let r=0;r<i.length;r++)t+=i[r].byteLength;const e=new Uint8Array(t);let n=0;for(let r=0;r<i.length;r++){const s=new Uint8Array(i[r]),a=s.length;for(let o=0;o<a;o+=4){let l=s[o],h=s[o+1],c=s[o+2];const d=s[o+3];d===0&&(l=h=c=0),e[n+o]=l,e[n+o+1]=h,e[n+o+2]=c,e[n+o+3]=d}n+=a}return e.buffer};const Ca=new Map,wl=(i,t)=>{if(Ca.has(i))return t(null,Ca.get(i));const e=new Image;e.onload=function(){Ca.set(i,{width:e.width,height:e.height,element:e}),t(null,Ca.get(i))},e.onerror=function(n){t(n,null)},e.src=i},xl=(i,t)=>{wl(i,(e,n)=>{if(!n)return t(e,null);const r=document.createElement("canvas"),s=r.getContext("2d");return r.width=n.width,r.height=n.height,s.drawImage(n.element,0,0,r.width,r.height),s.getImageData(0,0,r.width,r.height)})},c_=(i,t)=>{for(let e=0,n=i.length;e<n;e++){const r=i[e],{type:s}=r;if(s.split("/")[0]!=="image")return;let o;const l=new FileReader;l.onload=function(h){if(!h.target)return t("no reader target",null);const c=h.target.result;o=Bh(c);const f=new Blob([c]);Sl(f,(u,g)=>{if(!g)return t(u,null);wl(g,(m,y)=>{if(!y)return t(m,null);xl(g,(x,C)=>{if(!C)return t(x,null);const v={name:r.name,fileType:o,size:r.size,width:y.width,height:y.height,imgUrl:g,imageData:C,blob:f};return t(null,v)})})})},l.readAsArrayBuffer(r)}},u_=(i,t=0,e=0)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.drawImage(i,0,0,t,e),r.getImageData(0,0,t,e)},f_=(i,t=0,e=0)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.drawImage(i,0,0,t,e),r.getImageData(0,0,t,e)},d_=i=>{const t=i.width,e=i.height,n=t*e*3,r=n+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,n&255,n>>8&255,n>>16&255,n>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=(4-t*3%4)%4,l=i.data;let h="";const c=t<<2;let d=e;const f=String.fromCharCode;do{const g=c*(d-1);let m="";for(let y=0;y<t;y++){const x=y<<2;m+=f(l[g+x+2])+f(l[g+x+1])+f(l[g+x])}for(let y=0;y<o;y++)m+=String.fromCharCode(0);h+=m}while(--d);function u(g){if(!window.btoa)throw"btoa undefined";let m="";if(typeof g=="string")m=g;else for(let y=0;y<g.length;y++)m+=String.fromCharCode(g[y]);return btoa(m)}return u(s.concat(a))+u(h)},g_=i=>{const{width:t,height:e}=i,n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t,n.height=e,r.putImageData(i,0,0,0,0,t,e),n.toDataURL("image/png")},p_=(i,t,e)=>{const{width:n,height:r}=i,s=document.createElement("canvas"),a=s.getContext("2d");s.width=n,s.height=r,a.putImageData(i,0,0,0,0,n,r);const o=`image/${t?t.toLowerCase():"png"}`;s.toBlob(l=>{e?.(null,l)},o,1)},Sl=(i,t)=>{const e=new FileReader;e.onload=function(n){n.target?t(null,n.target.result):t("can't readAsDataURL",null)},e.readAsDataURL(i)},m_=(i,t)=>{Sl(i,function(e,n){if(n){const r=new Image;r.src=n}else t(e)})};function v_(i,t){xl(i,(e,n)=>{if(!n)return t(e,null);const r=n.data;let s=0;const a=[],o=[],l=[];for(let f=0;f<r.length;f+=4)a[s]=r[f],o[s]=r[f+1],l[s]=r[f+2],s+=1;const h=Cl(a),c=Cl(o),d=Cl(l);return t(null,"rgb("+h+","+c+","+d+")")})}function Cl(i){const t={},e=[],n=[];for(let o=0;o<i.length;o++)t[i[o]]?e.push(i[o]):t[i[o]]=1;let r=0;for(let o=0;o<e.length;o++){r=0;for(let l=0;l<e.length;l++)e[o]===e[l]&&(r+=1),n[o]=r}const s=Math.max.apply(null,n);let a=0;for(;a<n.length;a++)if(n[a]===s)return;return e[a]}const __=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[(a*e+e-o-1)*4],r[l+1]=t[(a*e+e-o-1)*4+1],r[l+2]=t[(a*e+e-o-1)*4+2],r[l+3]=t[(a*e+e-o-1)*4+3]}return new ImageData(r,e,n)},y_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[((n-a-1)*e+o)*4],r[l+1]=t[((n-a-1)*e+o)*4+1],r[l+2]=t[((n-a-1)*e+o)*4+2],r[l+3]=t[((n-a-1)*e+o)*4+3]}return new ImageData(r,e,n)},b_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<n;o++){const l=(a*n+o)*4;r[l]=t[(o*e+e-a-1)*4],r[l+1]=t[(o*e+e-a-1)*4+1],r[l+2]=t[(o*e+e-a-1)*4+2],r[l+3]=t[(o*e+e-a-1)*4+3]}return new ImageData(r,n,e)},w_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<n;o++){const l=(a*n+o)*4;r[l]=t[((n-o-1)*e+a)*4],r[l+1]=t[((n-o-1)*e+a)*4+1],r[l+2]=t[((n-o-1)*e+a)*4+2],r[l+3]=t[((n-o-1)*e+a)*4+3]}return new ImageData(r,n,e)},x_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=(t[l]+t[l+1]+t[l+2])/3;r[l]=h,r[l+1]=h,r[l+2]=h,r[l+3]=t[l+3]}return new ImageData(r,e,n)},S_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=.2126*t[l]+.7152*t[l+1]+.0722*t[l+2];r[l]=h,r[l+1]=h,r[l+2]=h,r[l+3]=t[l+3]}return new ImageData(r,e,n)},C_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,c=(t[l]+t[l+1]+t[l+2])/3>127?255:0;r[l]=c,r[l+1]=c,r[l+2]=c,r[l+3]=t[l+3]}return new ImageData(r,e,n)},k_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=255-t[l],r[l+1]=255-t[l+1],r[l+2]=255-t[l+2],r[l+3]=t[l+3]}return new ImageData(r,e,n)},E_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[l],r[l+1]=0,r[l+2]=0,r[l+3]=t[l+3]}return new ImageData(r,e,n)},T_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=0,r[l+1]=t[l+1],r[l+2]=0,r[l+3]=t[l+3]}return new ImageData(r,e,n)},P_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=0,r[l+1]=0,r[l+2]=t[l+2],r[l+3]=t[l+3]}return new ImageData(r,e,n)},A_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[l],r[l+1]=t[l+1],r[l+2]=0,r[l+3]=t[l+3]}return new ImageData(r,e,n)},M_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[l],r[l+1]=0,r[l+2]=t[l+1],r[l+3]=t[l+3]}return new ImageData(r,e,n)},R_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=0,r[l+1]=t[l+1],r[l+2]=t[l+1],r[l+3]=t[l+3]}return new ImageData(r,e,n)},L_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=(t[l+1]+t[l+2])/2;r[l]=t[l],r[l+1]=h,r[l+2]=h,r[l+3]=t[l+3]}return new ImageData(r,e,n)},D_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=(t[l]+t[l+2])/2;r[l]=h,r[l+1]=t[l+1],r[l+2]=h,r[l+3]=t[l+3]}return new ImageData(r,e,n)},I_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4,h=(t[l]+t[l+1])/2;r[l]=h,r[l+1]=h,r[l+2]=t[l+2],r[l+3]=t[l+3]}return new ImageData(r,e,n)},O_=i=>Mf(i,[-1,-1,-1,-1,9,-1,-1,-1,-1]),F_=i=>Mf(i,[-1,-1,-1,-1,8,-1,-1,-1,-1]),N_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;r[l]=t[l],r[l+1]=t[l+1],r[l+2]=t[l+2],r[l+3]=255}return new ImageData(r,e,n)},U_=i=>{const{data:t,width:e,height:n}=i,r=new Uint8ClampedArray(t.length);for(let a=0;a<n;a++)for(let o=0;o<e;o++){const l=(a*e+o)*4;if(t[l+3]===0)r[l]=255,r[l+1]=255,r[l+2]=255,r[l+3]=255;else{const h=Rf([t[l],t[l+1],t[l+2],t[l+3]],[255,255,255,255]);r[l]=h[0],r[l+1]=h[1],r[l+2]=h[2],r[l+3]=h[3]}}return new ImageData(r,e,n)},G_=(i,t,e,n,r,s=!1,a)=>{const{data:o,width:l,height:h}=i;let c=r,d=n,f=t,u=e;if(c<0?c=0:c>l&&(c=l),d<0?d=0:d>h&&(d=h),f<1?f=1:f>l&&(f=l),u<1?u=1:u>h&&(u=h),c+f>l&&(f=l-c),d+u>h&&(u=h-d),s){const g=new Uint8ClampedArray(o.length);for(let y=0;y<h;y++)for(let x=0;x<l;x++){const C=(y*l+x)*4;x>=c&&x<=c+f&&y>=d&&y<=d+u?(g[C]=o[C],g[C+1]=o[C+1],g[C+2]=o[C+2],g[C+3]=o[C+3]):(g[C]=255,g[C+1]=255,g[C+2]=255,g[C+3]=a&&["JPG","JPEG"].includes(a.toUpperCase())?255:0)}return new ImageData(g,l,h)}else{const g=new Uint8ClampedArray(f*u*4);for(let y=d;y<=d+u;y++)for(let x=c;x<=c+f;x++){const C=((y-d)*f+x-c)*4,v=(y*l+x)*4;g[C]=o[v],g[C+1]=o[v+1],g[C+2]=o[v+2],g[C+3]=o[v+3]}return new ImageData(g,f,u)}},B_=(i,t,e,n)=>{const{data:r,width:s,height:a}=i;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 l=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?(l[f]=255,l[f+1]=255,l[f+2]=255,l[f+3]=n||e.toUpperCase()==="PNG"?0:255):(l[f]=r[f],l[f+1]=r[f+1],l[f+2]=r[f+2],l[f+3]=n||e.toUpperCase()==="PNG"?r[f+3]:255)}return new ImageData(l,s,a)},$_=(i,t,e,n,r,s=1e4)=>{const a=new Image;a.src=i;const o=document.createElement("canvas"),l=o.getContext("2d");return o.width=s,o.height=s,l.drawImage(a,0,0,t,e,0,0,n,r),l.getImageData(0,0,n,r)},z_=(i,t)=>{const{data:e,width:n,height:r}=i,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let l=0;l<n;l++){const h=(o*n+l)*4;s[h]=Math.max(Math.min(e[h]+t,255),0),s[h+1]=Math.max(Math.min(e[h+1]+t,255),0),s[h+2]=Math.max(Math.min(e[h+2]+t,255),0),s[h+3]=e[h+3]}return new ImageData(s,n,r)},j_=(i,t,e=!1)=>{const{data:n,width:r,height:s}=i,a=new Uint8ClampedArray(n.length);for(let l=0;l<s;l++)for(let h=0;h<r;h++){const c=(l*r+h)*4;n[c+3]===0?(a[c]=255,a[c+1]=255,a[c+2]=255):(a[c]=n[c],a[c+1]=n[c+1],a[c+2]=n[c+2]);let d=n[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)},H_=(i,t,e,n)=>{const{data:r,width:s,height:a}=i,{data:o,width:l,height:h}=t;let c=e,d=n;e+h>a&&(c=a-h),n+l>s&&(d=s-l);const f=new Uint8ClampedArray(r.length);for(let g=0;g<a;g++)for(let m=0;m<s;m++){const y=(g*s+m)*4;if(m<d||m>d+l||g<=c||g>=c+h)f[y]=r[y],f[y+1]=r[y+1],f[y+2]=r[y+2],f[y+3]=r[y+3];else{const x=(g*s+m-((c+1)*s+(g-(c+1))*(s-l))+l-d-1)*4,C=[o[x],o[x+1],o[x+2],o[x+3]],v=[r[y],r[y+1],r[y+2],r[y+3]],b=Rf(C,v);f[y]=b[0],f[y+1]=b[1],f[y+2]=b[2],f[y+3]=b[3]}}return new ImageData(f,s,a)},V_=(i,t,e,n,r,s=10)=>{const{data:a,width:o,height:l}=i;let h=r,c=n,d=t,f=e;h<0?h=0:h>o&&(h=o),c<0?c=0:c>l&&(c=l),d<1?d=1:d>o&&(d=o),f<1?f=1:f>l&&(f=l),h+d>o&&(d=o-h),c+f>l&&(f=l-c);const u=new Uint8ClampedArray(a.length);for(let m=0;m<l;m++)for(let y=0;y<o;y++){const x=(m*o+y)*4;if(y>=h&&y<=h+d&&m>=c&&m<=c+f){const C=Math.floor((y-h)/s),v=Math.floor((m-c)/s);let b=Math.floor(s*(C+1)-s/2+h),k=Math.floor(s*(v+1)-s/2+c);b>o-1&&(b=o-1),k>l-1&&(k=l-1);const T=(k*o+b)*4;u[x]=a[T],u[x+1]=a[T+1],u[x+2]=a[T+2],u[x+3]=a[T+3]}else u[x]=a[x],u[x+1]=a[x+1],u[x+2]=a[x+2],u[x+3]=a[x+3]}return new ImageData(u,o,l)},q_=async(i,t,e,n,r,s)=>{const a=r/100;if(["JPG","JPEG"].includes(n.toUpperCase())){const o=new Image;o.src=i;const l=document.createElement("canvas"),h=l.getContext("2d");l.width=t,l.height=e,h.drawImage(o,0,0,t,e),l.toBlob(c=>{s(c)},`image/${n.toLowerCase()}`,a)}else{const o=Math.floor(a*256),l=ut.encode([i.data.buffer],t,e,o),h=new Blob([l]);s&&s(h)}},X_=(i,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:n,width:r,height:s}=i,{data:a}=t,o=new Uint8ClampedArray(n.length),{backgroundColor:l,changeIntoColor:h}=e;for(let d=0;d<s;d++)for(let f=0;f<r;f++){const u=(d*r+f)*4,g=a[u],m=a[u+1],y=a[u+2],x=a[u+3];g===l.r&&m===l.g&&y===l.b&&x===l.a&&h.a!==0?(o[u]=h.r,o[u+1]=h.g,o[u+2]=h.b,o[u+3]=h.a):(o[u]=n[u],o[u+1]=n[u+1],o[u+2]=n[u+2],o[u+3]=n[u+3])}return new ImageData(o,r,s)}return i},Mf=(i,t)=>{const{data:e,width:n,height:r}=i,s=new Uint8ClampedArray(e.length);for(let o=0;o<r;o++)for(let l=0;l<n;l++){const h=(o*n+l)*4;for(let c=0;c<3;c++){const d=h+c;l===0||l===n-1||o===0||o===r-1?s[d]=e[d]:s[d]=t[0]*e[d-n*4-4]+t[1]*e[d-n*4]+t[2]*e[d-n*4+4]+t[3]*e[d-4]+t[4]*e[d]+t[5]*e[d+4]+t[6]*e[d+n*4-4]+t[7]*e[d+n*4]+t[8]*e[d+n*4+4]}s[h+3]=e[h+3]}return new ImageData(s,n,r)},Rf=(i,t)=>{if(i&&i.length===4&&t&&t.length===4){const e=i[3],n=t[3];if(e===255||n===0)return i;if(e===0)return t;{const r=e/255,s=n/255,a=Math.max(Math.min(Math.floor(i[0]*r+t[0]*s*(1-r)),255),0),o=Math.max(Math.min(Math.floor(i[1]*r+t[1]*s*(1-r)),255),0),l=Math.max(Math.min(Math.floor(i[2]*r+t[2]*s*(1-r)),255),0),h=Math.max(Math.min(Math.floor((r+s*(1-r))*255),255),0);return[a,o,l,h]}}return[255,255,255,255]},Lf=function(i,t,e){const n=new Array(i*i),r=function(o){const l=o;let h=0,c=0;return{write(d,f){if(d>>>f)throw new Error("length over");for(;h+f>=8;)l.writeByte(255&(d<<h|c)),f-=8-h,d>>>=8-h,c=0,h=0;c=d<<h|c,h=h+f},flush(){h>0&&l.writeByte(c)}}},s=function(o){const l=1<<o,h=(1<<o)+1;let c=o+1;const d=a();for(let y=0;y<l;y++)d.add(String.fromCharCode(y));d.add(String.fromCharCode(l)),d.add(String.fromCharCode(h));const f=$h(),u=r(f);u.write(l,c);let g=0,m=String.fromCharCode(n[g]);for(g+=1;g<n.length;){const y=String.fromCharCode(n[g]);g+=1,d.contains(m+y)?m=m+y:(u.write(d.indexOf(m),c),d.size()<4095&&(d.size()==1<<c&&(c+=1),d.add(m+y)),m=y)}return u.write(d.indexOf(m),c),u.write(h,c),u.flush(),f.toByteArray()},a=function(){const o={};let l=0;return{add(h){if(this.contains(h))throw new Error("dup key:"+h);o[h]=l,l+=1},size(){return l},indexOf(h){return o[h]},contains(h){return typeof o[h]<"u"}}};return{setPixel(o,l,h){n[l*i+o]=h},write(o){o.writeString("GIF87a"),o.writeShort(i),o.writeShort(i),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(i),o.writeShort(i),o.writeByte(0);const l=2,h=s(l);o.writeByte(l);let c=0;for(;h.length-c>255;)o.writeByte(255),o.writeBytes(h,c,255),c+=255;o.writeByte(h.length-c),o.writeBytes(h,c,h.length-c),o.writeByte(0),o.writeString(";")}}},Df=function(i,t,e,n){const r=Lf(i,t,e);for(let h=0;h<i;h++)for(let c=0;c<i;c++)r.setPixel(c,h,n(c,h));const s=$h();r.write(s);const a=Ag(),o=s.toByteArray();for(let h=0,c=o.length;h<c;h++)a.writeByte(o[h]);a.flush();let l="";return l+="data:image/gif;base64,",l+=a,l},Re={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Lr={M:0,L:1,H:2,Q:3},Ei={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},ge={glog:function(i){if(i<1)throw new Error("glog("+i+")");return ge.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return ge.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(let i=0;i<8;i++)ge.EXP_TABLE[i]=1<<i;for(let i=8;i<256;i++)ge.EXP_TABLE[i]=ge.EXP_TABLE[i-4]^ge.EXP_TABLE[i-5]^ge.EXP_TABLE[i-6]^ge.EXP_TABLE[i-8];for(let i=0;i<255;i++)ge.LOG_TABLE[ge.EXP_TABLE[i]]=i;const te={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(i){let t=i<<10;for(;te.getBCHDigit(t)-te.getBCHDigit(te.G15)>=0;)t^=te.G15<<te.getBCHDigit(t)-te.getBCHDigit(te.G15);return(i<<10|t)^te.G15_MASK},getBCHTypeNumber:function(i){let t=i<<12;for(;te.getBCHDigit(t)-te.getBCHDigit(te.G18)>=0;)t^=te.G18<<te.getBCHDigit(t)-te.getBCHDigit(te.G18);return i<<12|t},getBCHDigit:function(i){let t=0;for(;i!=0;)t++,i>>>=1;return t},getPatternPosition:function(i){return te.PATTERN_POSITION_TABLE[i-1]},getMask:function(i,t,e){switch(i){case Ei.PATTERN000:return(t+e)%2==0;case Ei.PATTERN001:return t%2==0;case Ei.PATTERN010:return e%3==0;case Ei.PATTERN011:return(t+e)%3==0;case Ei.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2==0;case Ei.PATTERN101:return t*e%2+t*e%3==0;case Ei.PATTERN110:return(t*e%2+t*e%3)%2==0;case Ei.PATTERN111:return(t*e%3+(t+e)%2)%2==0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){let t=new Rn([1],0);for(let e=0;e<i;e++)t=t.multiply(new Rn([1,ge.gexp(e)],0));return t},getLengthInBits:function(i,t){if(1<=t&&t<10)switch(i){case Re.MODE_NUMBER:return 10;case Re.MODE_ALPHA_NUM:return 9;case Re.MODE_8BIT_BYTE:return 8;case Re.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(t<27)switch(i){case Re.MODE_NUMBER:return 12;case Re.MODE_ALPHA_NUM:return 11;case Re.MODE_8BIT_BYTE:return 16;case Re.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(t<41)switch(i){case Re.MODE_NUMBER:return 14;case Re.MODE_ALPHA_NUM:return 13;case Re.MODE_8BIT_BYTE:return 16;case Re.MODE_KANJI:return 12;default:throw new Error("mode:"+i)}else throw new Error("type:"+t)},getLostPoint:function(i){const t=i.getModuleCount();let e=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++){let o=0;const l=i.isDark(s,a);for(let h=-1;h<=1;h++)if(!(s+h<0||t<=s+h))for(let c=-1;c<=1;c++)a+c<0||t<=a+c||h==0&&c==0||l==i.isDark(s+h,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;i.isDark(s,a)&&o++,i.isDark(s+1,a)&&o++,i.isDark(s,a+1)&&o++,i.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++)i.isDark(s,a)&&!i.isDark(s,a+1)&&i.isDark(s,a+2)&&i.isDark(s,a+3)&&i.isDark(s,a+4)&&!i.isDark(s,a+5)&&i.isDark(s,a+6)&&(e+=40);for(let s=0;s<t;s++)for(let a=0;a<t-6;a++)i.isDark(a,s)&&!i.isDark(a+1,s)&&i.isDark(a+2,s)&&i.isDark(a+3,s)&&i.isDark(a+4,s)&&!i.isDark(a+5,s)&&i.isDark(a+6,s)&&(e+=40);let n=0;for(let s=0;s<t;s++)for(let a=0;a<t;a++)i.isDark(a,s)&&n++;const r=Math.abs(100*n/t/t-50)/5;return e+=r*10,e}};class Rn{num;constructor(t,e){if(t.length==null)throw new Error(t.length+"/"+e);let n=0;for(;n<t.length&&t[n]==0;)n++;this.num=new Array(t.length-n+e);for(let r=0;r<t.length-n;r++)this.num[r]=t[r+n]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let n=0;n<this.getLength();n++)for(let r=0;r<t.getLength();r++)e[n+r]^=ge.gexp(ge.glog(this.get(n))+ge.glog(t.get(r)));return new Rn(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=ge.glog(this.get(0))-ge.glog(t.get(0)),n=new Array(this.getLength());for(let r=0;r<this.getLength();r++)n[r]=this.get(r);for(let r=0;r<t.getLength();r++)n[r]^=ge.gexp(ge.glog(t.get(r))+e);return new Rn(n,0).mod(t)}}class oi{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 n=oi.getRsBlockTable(t,e);if(n==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);const r=n.length/3,s=[];for(let a=0;a<r;a++){const o=n[a*3+0],l=n[a*3+1],h=n[a*3+2];for(let c=0;c<o;c++)s.push(new oi(l,h))}return s}static getRsBlockTable(t,e){switch(e){case Lr.L:return oi.RS_BLOCK_TABLE[(t-1)*4+0];case Lr.M:return oi.RS_BLOCK_TABLE[(t-1)*4+1];case Lr.Q:return oi.RS_BLOCK_TABLE[(t-1)*4+2];case Lr.H:return oi.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}class If{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 n=0;n<e;n++)this.putBit((t>>>e-n-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 Y_{mode;data;constructor(t){this.mode=Re.MODE_8BIT_BYTE,this.data=t}getLength(){return this.data.length}write(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data.charCodeAt(e),8)}}class Ti{static PAD0=236;static PAD1=17;typeNumber;errorCorrectLevel;modules;moduleCount;dataCache;dataList;constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=Lr[e],this.modules=[],this.moduleCount=0,this.dataCache=null,this.dataList=[]}addData(t){const e=new Y_(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=oi.getRSBlocks(t,this.errorCorrectLevel),n=new If;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];n.put(a.mode,4),n.put(a.getLength(),te.getLengthInBits(a.mode,t)),a.write(n)}if(n.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 n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(let r=0;r<this.moduleCount;r++)this.modules[n][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=Ti.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let n=-1;n<=7;n++)if(!(t+n<=-1||this.moduleCount<=t+n))for(let r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[t+n][e+r]=!0:this.modules[t+n][e+r]=!1)}getBestMaskPattern(){let t=0,e=0;for(let n=0;n<8;n++){this.makeImpl(!0,n);const r=te.getLostPoint(this);(n==0||t>r)&&(t=r,e=n)}return e}createMovieClip(t,e,n){const r=t.createEmptyMovieClip(e,n),s=1;this.make();for(let a=0;a<this.modules.length;a++){const o=a*s;for(let l=0;l<this.modules[a].length;l++){const h=l*s;this.modules[a][l]&&(r.beginFill(0,100),r.moveTo(h,o),r.lineTo(h+s,o),r.lineTo(h+s,o+s),r.lineTo(h,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=te.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let n=0;n<t.length;n++){const r=t[e],s=t[n];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=te.getBCHTypeNumber(this.typeNumber);for(let n=0;n<18;n++){const r=!t&&(e>>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(let n=0;n<18;n++){const r=!t&&(e>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}}setupTypeInfo(t,e){const n=this.errorCorrectLevel<<3|e,r=te.getBCHTypeInfo(n);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 n=-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 l=0;l<2;l++)if(this.modules[r][o-l]==null){let h=!1;a<t.length&&(h=(t[a]>>>s&1)==1),te.getMask(e,r,o-l)&&(h=!h),this.modules[r][o-l]=h,s--,s==-1&&(a++,s=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}}static createData(t,e,n){const r=oi.getRSBlocks(t,e),s=new If;for(let o=0;o<n.length;o++){const l=n[o];s.put(l.mode,4),s.put(l.getLength(),te.getLengthInBits(l.mode,t)),l.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(Ti.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Ti.PAD1,8);return Ti.createBytes(s,r)}static createBytes(t,e){let n=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 x=0;x<a[d].length;x++)a[d][x]=255&t.buffer[x+n];n+=f;const g=te.getErrorCorrectPolynomial(u),y=new Rn(a[d],g.getLength()-1).mod(g);o[d]=new Array(g.getLength()-1);for(let x=0;x<o[d].length;x++){const C=x+y.getLength()-o[d].length;o[d][x]=C>=0?y.get(C):0}}let l=0;for(let d=0;d<e.length;d++)l+=e[d].totalCount;const h=new Array(l);let c=0;for(let d=0;d<r;d++)for(let f=0;f<e.length;f++)d<a[f].length&&(h[c++]=a[f][d]);for(let d=0;d<s;d++)for(let f=0;f<e.length;f++)d<o[f].length&&(h[c++]=o[f][d]);return h}}const Of=Math.ceil,Dr=Math.floor,Ff=Math.round;function W_(i,t){const e=Gh(i),n=t?.ecc||"H",r=t?.size||256,s=-1,a=t?.padding||0,o=t?.color||"#000000",l=t?.background||"#ffffff",h=new Ti(s,n);h.addData(e),h.make();const c=h.getModuleCount(),d=(r-a*2)/c,f=a,u=r-a;return Df(r,o,l,function(g,m){if(f<=g&&g<u&&f<=m&&m<u){const y=Dr((g-f)/d),x=Dr((m-f)/d);return h.isDark(x,y)?0:1}else return 1})}function K_(i,t){const e=t.x||0,n=t.y||0,r=Gh(i),s=t.ctx,a=t.ecc||"H",o=typeof t.size=="number"?Dr(t.size):256,l=t.padding||0,h=-1,c=t.color||"#000000",d=t.background||"#ffffff",f=new Ti(h,a);f.addData(r),f.make();const u=f.getModuleCount(),g=(o-l*2)/u;s.fillStyle=d,s.fillRect(e,n,o,o);for(let m=0;m<u;m++)for(let y=0;y<u;y++){const x=Of((y+1)*g)-Dr(y*g),C=Of((m+1)*g)-Dr(m*g);s.fillStyle=f.isDark(m,y)?c:d,s.fillRect(e+Ff(y*g)+l,n+Ff(m*g)+l,x,C)}}function Nf(){let i=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{i=new window.ActiveXObject(t[e]);break}catch{continue}}else i=new XMLHttpRequest;return i}function Z_(i){if(!i.action)return;const t=i.method.toLowerCase()==="get",e=i.method.toLowerCase()==="post";let n=i.action,r=null;const s="---------------------------"+Date.now().toString(16);if(window.FormData)r=new FormData(i),t&&(n=$o(n,nu(r)));else if(t){let a="";for(let o=0;o<i.elements.length;o++){const l=i.elements[o];if(!l.hasAttribute("name"))continue;const h=l.nodeName.toUpperCase()==="INPUT"?l.getAttribute("type").toUpperCase():"TEXT";if(h==="FILE")for(let c=0;c<l.files.length;a+="&"+encodeURIComponent(l.name)+"="+encodeURIComponent(l.files[c++].name));else(h!=="RADIO"&&h!=="CHECKBOX"||l.checked)&&(a+="&"+encodeURIComponent(l.name)+"="+encodeURIComponent(l.value))}n=$o(n,a)}else if(e){let a=[];if(i.enctype==="application/x-www-form-urlencoded"){for(let o=0;o<i.elements.length;o++){const l=i.elements[o];l.hasAttribute("name")&&a.push(encodeURIComponent(l.name)+"="+encodeURIComponent(l.value))}r=a.join()}else if(i.enctype==="text/plain"){for(let o=0;o<i.elements.length;o++){const l=i.elements[o];l.hasAttribute("name")&&a.push(l.name+"="+l.value)}r=a.join(`\r
|
|
15
|
+
`)}else if(i.enctype==="multipart/form-data"){for(let o=0;o<i.elements.length;o++){const l=i.elements[o];if(!l.hasAttribute("name"))continue;if((l.nodeName.toUpperCase()==="INPUT"?l.getAttribute("type").toUpperCase():"TEXT")==="FILE")for(let c=0;c<l.files.length;c++){const d=l.files[c];a.push('Content-Disposition: form-data; name="'+l.name+'"; filename="'+d.name+`"\r
|
|
16
16
|
Content-Type: `+d.type+`\r
|
|
17
17
|
\r
|
|
18
|
-
`)}else a.push('Content-Disposition: form-data; name="'+
|
|
18
|
+
`)}else a.push('Content-Disposition: form-data; name="'+l.name+`"\r
|
|
19
19
|
\r
|
|
20
|
-
`+
|
|
20
|
+
`+l.value+`\r
|
|
21
21
|
`)}r=a.join(s+`\r
|
|
22
|
-
`)}}return{url:n,data:r,boundary:s}}function
|
|
22
|
+
`)}}return{url:n,data:r,boundary:s}}function J_({method:i="GET",url:t,data:e="",responseType:n="json",timeout:r=3e4,boundary:s=""}){return new Promise((a,o)=>{const l=Nf();l.onreadystatechange=function(h){l.readyState===4&&(l.status===200?a(l.response):o(l.statusText))},l.ontimeout=function(){o(`${t} is timed out for ${r}ms.`)},l.addEventListener("progress",function(h){if(h.lengthComputable){const c=Math.round(h.loaded*100/h.total);console.log(`progress : ${c}%`)}},!1),l.addEventListener("load",function(h){console.log("load")},!1),l.addEventListener("error",function(h){console.log(`error : ${h}`)},!1),l.timeout=r,l.responseType=n,s&&l.setRequestHeader("Content-Type","multipart/form-data; boundary="+s),i=i.toUpperCase(),i==="GET"?(l.open("GET",t+"?"+e,!0),l.send(null)):i==="POST"?(l.open("POST",t,!0),s?l.sendAsBinary(s+`\r
|
|
23
23
|
`+e+s+`--\r
|
|
24
|
-
`):h.send(e)):(h.open(i,t,!0),h.send(e))})}function Xp(i,t){const e=new XMLHttpRequest;e.open("HEAD",i),e.filepath=i,e.callback=t,e.onload=function(){const n=parseFloat(window.localStorage.getItem("lm_"+this.filepath)),r=Date.parse(this.getResponseHeader("Last-Modified"));(isNaN(n)||r>n)&&(window.localStorage.setItem("lm_"+this.filepath,Date.now()),isFinite(n)&&this.callback(r,n))},e.send()}let dr;const wc=new WeakMap;function Oa(i,t){let e=wc.get(i);e||(e=new Map,wc.set(i,e));let n=e.get(t);return n||(n=new Sc,e.set(t,n)),n}class Sc{subscribers;constructor(){this.subscribers=new Set}depend(){dr&&this.subscribers.add(dr)}notify(){this.subscribers.forEach(t=>t())}}function Yp(i){dr=i,i(),dr=null}function Wp(i){return Object.keys(i).forEach(t=>{let e=i[t];const n=Oa(i,t);Object.defineProperty(i,t,{get(){return n.depend(),e},set(r){r!=e&&(e=r,n.notify())}})}),i}function qp(i){return new Proxy(i,{get(t,e,n){return Oa(i,e).depend(),Reflect.get(t,e,n)},set(t,e,n,r){const s=Oa(i,e);return i[e]!=n&&(i[e]=n,s.notify()),Reflect.set(t,e,n,r)}})}const Kp=()=>Math.random()*16777215,Zp=()=>`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`,Jp=()=>`#${(~~(Math.random()*(1<<24))).toString(16)}`,Cc=function(i){let t="00000"+(i|0).toString(16);return t="#"+t.substring(t.length-6),t},xc=function(i,t=1){const e=i>>16&255,n=i>>8&255,r=i&255,s=t<0?0:t>1?1:t;return s===1?"rgb("+e+","+n+","+r+")":"rgba("+e+","+n+","+r+","+s+")"},fr=function(i){return i[0]==="#"&&(i=i.slice(1)),window.parseInt(i,16)},Ia=function(i,t=1){const e=fr(i);return xc(e,t)},Qp=i=>{const e=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(i);return e?"#"+((1<<24)+(parseInt(e[1])<<16)+(parseInt(e[2])<<8)+parseInt(e[3])).toString(16).slice(1):""};function tm(i,t,e,n){let r,s,a;i=i/360,t=t/100,e=e/100;const o=Math.floor(i*6),h=i*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:n??1}}function em(i,t,e,n){const r=Math.max(i,t,e),s=Math.min(i,t,e),a=r-s,o=r===0?0:a/r,h=r/255;let l;switch(r){case s:l=0;break;case i:l=t-e+a*(t<e?6:0),l/=6*a;break;case t:l=e-i+a*2,l/=6*a;break;case e:default:l=i-t+a*4,l/=6*a;break}return{h:Math.round(l*360),s:Math.round(o*100),v:Math.round(h*100),a:n??1}}const im=i=>i*Math.PI/180,nm=i=>i*180/Math.PI;function De(i,t,e,n,r=!1){return{x:r?i*n+t*e:i*n-t*e,y:r?t*n-i*e:t*n+i*e}}class ce{m;constructor(t=[1,0,0,1,0,0]){this.m=[t[0],t[1],t[2],t[3],t[4],t[5]]}unit(){return this.m=[1,0,0,1,0,0],this}multiply(t){const e=this.m;let n;t instanceof ce?n=t.m:n=t;const r=e[0]*n[0]+e[2]*n[1],s=e[1]*n[0]+e[3]*n[1],a=e[0]*n[2]+e[2]*n[3],o=e[1]*n[2]+e[3]*n[3],h=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[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 ce(this.m),e=t.m,n=1/(e[0]*e[3]-e[1]*e[2]),r=e[3]*n,s=-e[1]*n,a=-e[2]*n,o=e[0]*n,h=n*(e[2]*e[5]-e[3]*e[4]),l=n*(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.multiply([1,0,0,1,t,e])}rotate(t){const e=t*Math.PI/180,n=Math.cos(e),r=Math.sin(e);return this.multiply([n,r,-r,n,0,0])}skew(t,e=0){const n=t*Math.PI/180,r=e*Math.PI/180,s=Math.tan(n),a=Math.tan(r);return this.multiply([1,a,s,1,0,0])}scale(t,e){return this.multiply([t,0,0,e,0,0])}transformPoint(t,e){const n=t,r=e;return t=n*this.m[0]+r*this.m[2]+this.m[4],e=n*this.m[1]+r*this.m[3]+this.m[5],[t,e]}transformVector(t,e){const n=t,r=e;return t=n*this.m[0]+r*this.m[2],e=n*this.m[1]+r*this.m[3],[t,e]}}class gr{x;y;z;constructor(t=[0,0,0],e=[0,0,0]){const[n,r,s]=t,[a,o,h]=e;this.x=n-a,this.y=r-o,this.z=s-h}get length(){const{x:t,y:e,z:n}=this;return Math.sqrt(t*t+e*e+n*n)}unit(){const t=this.length;return new gr([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,n=this.y,r=this.z,s=t.x,a=t.y,o=t.z;return new gr([n*o-r*a,r*s-e*o,e*a-s*n])}}class pr{x;y;vx=0;vy=0;ax=0;ay=0;mass=0;constructor(t,e,n){this.x=t,this.y=e,n?.vx!==void 0&&(this.vx=n?.vx),n?.vy!==void 0&&(this.vy=n?.vy),n?.ax!==void 0&&(this.ax=n?.ax),n?.ay!==void 0&&(this.ay=n?.ay),n?.mass!==void 0&&(this.mass=n?.mass)}distanceTo(t){const e=t.x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)}angleTo(t){const e=t.x-this.x,n=t.y-this.y;return Math.atan2(n,e)}trackVelocity(t,e){return{vx:e.x-t.x,vy:e.y-t.y}}nextFrame(t){const e=t?.gravity??0,n=t?.friction??0;if(this.vx+=this.ax,this.vy+=this.ay,this.vy+=e,n>0){const r=Math.atan2(this.vy,this.vx);let s=Math.sqrt(this.vx*this.vx+this.vy*this.vy);s>n?s-=n: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 n=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+=n,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy};nextFrameSpringTo(t,e){const n=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+=n,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy}nextFrameSpringConnect(t,e){const n=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03,a=e?.springLength??100,o=this.angleTo(t);this.nextFrameSpringTo(new pr(t.x-Math.cos(o)*a,t.y-Math.sin(o)*a),{spring:s,friction:r,gravity:n})}}class pt extends pr{isMouseDown=!1;radius=0;constructor(t,e,n){super(t,e,n),n?.isMouseDown!==void 0&&(this.isMouseDown=n?.isMouseDown),n?.radius!==void 0&&(this.radius=n?.radius)}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 pt(this.x+(t.x-this.x)/2,this.y+(t.y-this.y)/2)}fromRadian(t,e){return new pt(Math.cos(t)*e,Math.sin(t)*e)}toArray(){return[this.x,this.y]}clone(t){this.setXY(t.x,t.y)}checkCollisionTo(t){const e=t.x-this.x,n=t.y-this.y;if(Math.sqrt(e*e+n*n)<this.radius+t.radius){const s=Math.atan2(n,e),a=Math.sin(s),o=Math.cos(s),h={x:0,y:0},l=De(e,n,a,o,!0),c=De(this.vx,this.vy,a,o,!0),d=De(t.vx,t.vy,a,o,!0),f=c.x-d.x;c.x=((this.mass-t.mass)*c.x+2*t.mass*d.x)/(this.mass+t.mass),d.x=f+c.x;const u=Math.abs(c.x)+Math.abs(d.x),g=this.radius+t.radius-Math.abs(h.x-l.x);h.x+=c.x/u*g,l.x+=d.x/u*g;const p=De(h.x,h.y,a,o,!1),_=De(l.x,l.y,a,o,!1);t.x=this.x+_.x,t.y=this.y+_.y,this.x=this.x+p.x,this.y=this.y+p.y;const y=De(c.x,c.y,a,o,!1),b=De(d.x,d.y,a,o,!1);this.vx=y.x,this.vy=y.y,t.vx=b.x,t.vy=b.y}}nextFrameWall(t){const e=t.left,n=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<n&&(this.y=n+this.radius,this.vy*=a)}}let Fa=class extends pr{width;height;constructor(t,e,n,r=n,s){super(t,e,s),this.width=n,this.height=r}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 rm{points=[];constructor(t){this.points=t}get length(){return this.points.length}getPoint(t){return this.points[t]}isContainPoint(t){const e=t.x,n=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===n||d===e&&f===n||n===c&&n===f)return!0;if(n>=c&&n<f||n<c&&n>=f){const u=(d-l)/(f-c),g=l+u*(n-c);if(g===e||Math.abs(g-e)<a)return!0;g>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})}}}const Ti={Linear:{None:function(i){return i}},Quadratic:{In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}},Cubic:{In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}},Quartic:{In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}},Quintic:{In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}},Sinusoidal:{In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}},Exponential:{In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}},Circular:{In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}},Elastic:{In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}},Back:{In:function(i){return i===1?1:i*i*((1.70158+1)*i-1.70158)},Out:function(i){return i===0?0:--i*i*((1.70158+1)*i+1.70158)+1},InOut:function(i){const t=2.5949095;return(i*=2)<1?.5*(i*i*((t+1)*i-t)):.5*((i-=2)*i*((t+1)*i+t)+2)}},Bounce:{In:function(i){return 1-Ti.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?Ti.Bounce.In(i*2)*.5:Ti.Bounce.Out(i*2-1)*.5+.5}},generatePow:function(i=4){return i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(t){return t**i},Out:function(t){return 1-(1-t)**i},InOut:function(t){return t<.5?(t*2)**i/2:(1-(2-t*2)**i)/2+.5}}},random:function(i){return Math.random()},createStep:function(i){return function(t){return Math.floor(t*i)/i}},createNoisyEasing:function(i,t=.1){const e=1-t;return function(n){return t*Math.random()+e*i(n)}}};let wn;typeof self>"u"&&typeof process<"u"&&process.hrtime?wn=function(){const i=process.hrtime();return i[0]*1e3+i[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?wn=self.performance.now.bind(self.performance):Date.now!==void 0?wn=Date.now:wn=function(){return new Date().getTime()};const Ei=wn;let Tc=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=Ei(),e=!1){let n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(let r=0;r<n.length;r++){const s=this._tweens[n[r]],a=!e;s&&s.update(t,a)===!1&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0}};const Qe={Linear:function(i,t){const e=i.length-1,n=e*t,r=Math.floor(n),s=Qe.Utils.Linear;return t<0?s(i[0],i[1],n):t>1?s(i[e],i[e-1],e-n):s(i[r],i[r+1>e?e:r+1],n-r)},Bezier:function(i,t){let e=0;const n=i.length-1,r=Math.pow,s=Qe.Utils.Bernstein;for(let a=0;a<=n;a++)e+=r(1-t,n-a)*r(t,a)*i[a]*s(n,a);return e},CatmullRom:function(i,t){const e=i.length-1;let n=e*t,r=Math.floor(n);const s=Qe.Utils.CatmullRom;return i[0]===i[e]?(t<0&&(r=Math.floor(n=e*(1+t))),s(i[(r-1+e)%e],i[r],i[(r+1)%e],i[(r+2)%e],n-r)):t<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):t>1?i[e]-(s(i[e],i[e],i[e-1],i[e-1],n-e)-i[e]):s(i[r?r-1:0],i[r],i[e<r+1?e:r+1],i[e<r+2?e:r+2],n-r)},Utils:{Linear:function(i,t,e){return(t-i)*e+i},Factorial:function(){const i=[1];return function(t){let e=1;if(i[t])return i[t];for(let n=t;n>1;n--)e*=n;return i[t]=e,e}}(),Bernstein:function(i,t){const e=Qe.Utils.Factorial;return e(i)/e(t)/e(i-t)},CatmullRom:function(i,t,e,n,r){const s=(e-i)*.5,a=(n-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}}};class Sn{static _nextId=0;static nextId(){return Sn._nextId++}}const zt=new Tc;let sm=class{constructor(t,e=zt){this._object=t,this._group=e}_id=Sn.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=Ti.Linear.None;_interpolationFunction=Qe.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=Ei()){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,n,r){for(const s in n){const a=t[s],o=Array.isArray(a),h=o?"array":typeof a,l=!o&&Array.isArray(n[s]);if(!(h==="undefined"||h==="function")){if(l){let c=n[s];if(c.length===0)continue;c=c.map(this._handleRelativeValue.bind(this,a)),n[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],n[s],r[s])}else typeof e[s]>"u"&&(e[s]=a),o||(e[s]*=1),l?r[s]=n[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=Ei()){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStartTime=t,this._group&&this._group.remove(this),this)}resume(t=Ei()){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=zt){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=Ti.Linear.None){return this._easingFunction=t,this}interpolation(t=Qe.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=Ei(),e=!0){if(this._isPaused)return!0;let n,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(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];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,n,r){for(const s in n){if(e[s]===void 0)continue;const a=e[s]||0;let o=n[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],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=n,this._valuesEnd[t]=e}};const am=Sn.nextId,om=zt.getAll.bind(zt),lm=zt.removeAll.bind(zt),hm=zt.add.bind(zt),cm=zt.remove.bind(zt),um=zt.update.bind(zt),dm={Easing:Ti,Group:Tc,Interpolation:Qe,now:Ei,Sequence:Sn,nextId:am,Tween:sm,getAll:om,removeAll:lm,add:hm,remove:cm,update:um};function Ec(i){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",i),t}function fm(i,t){const e=Ec(i),{x:n,y:r}=e.getPointAtLength(t);return[n,r]}function gm(i,t){return Ec(i).getTotalLength(t)}let Ht=null;function pm({d:i},t,e){Ht||(Ht=document.createElement("canvas").getContext("2d"));const n=new Path2D(i);return Ht.isPointInPath(n,t,e)}function kc({d:i},t,e,{lineWidth:n=1,lineCap:r="butt",lineJoin:s="miter"}){if(Ht||(Ht=document.createElement("canvas").getContext("2d")),Ht.isPointInStroke){Ht.save(),Ht.lineWidth=n,Ht.lineCap=r,Ht.lineJoin=s;const a=new Path2D(i),o=Ht.isPointInStroke(a,t,e);return Ht.restore(),o}}var Na={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},mm=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function _m(i){var t=[];return i.replace(mm,function(e,n,r){var s=n.toLowerCase();for(r=ym(r),s=="m"&&r.length>2&&(t.push([n].concat(r.splice(0,2))),s="l",n=n=="m"?"l":"L");;){if(r.length==Na[s])return r.unshift(n),t.push(r);if(r.length<Na[s])throw new Error("malformed path data");t.push([n].concat(r.splice(0,Na[s])))}}),t}var vm=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function ym(i){var t=i.match(vm);return t?t.map(Number):[]}function bm(i){var t=0,e=0,n=0,r=0;return i.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]+=n,s[7]+=r;break;case"v":s[1]+=r;break;case"h":s[1]+=n;break;default:for(var h=1;h<s.length;)s[h++]+=n,s[h++]+=r}switch(o){case"Z":n=t,r=e;break;case"H":n=s[1];break;case"V":r=s[1];break;case"M":n=t=s[1],r=e=s[2];break;default:n=s[s.length-2],r=s[s.length-1]}return s})}const Cn=Math.PI*2;function Ac(i,t,e,n){const r=i*n-t*e<0?-1:1;let s=i*e+t*n;return s>1&&(s=1),s<-1&&(s=-1),r*Math.acos(s)}function wm(i,t,e,n,r,s,a,o,h,l){const c=l*(i-e)/2+h*(t-n)/2,d=-h*(i-e)/2+l*(t-n)/2,f=a*a,u=o*o,g=c*c,p=d*d;let _=f*u-f*p-u*g;_<0&&(_=0),_/=f*p+u*g,_=Math.sqrt(_)*(r===s?-1:1);const y=_*a/o*d,b=_*-o/a*c,m=l*y-h*b+(i+e)/2,v=h*y+l*b+(t+n)/2,w=(c-y)/a,S=(d-b)/o,k=(-c-y)/a,C=(-d-b)/o,A=Ac(1,0,w,S);let x=Ac(w,S,k,C);return s===0&&x>0&&(x-=Cn),s===1&&x<0&&(x+=Cn),[m,v,A,x]}function Sm(i,t){const e=1.3333333333333333*Math.tan(t/4),n=Math.cos(i),r=Math.sin(i),s=Math.cos(i+t),a=Math.sin(i+t);return[n,r,n-r*e,r+n*e,s+a*e,a-s*e,s,a]}function Cm(i,t,e,n,r,s,a,o,h){const l=Math.sin(h*Cn/360),c=Math.cos(h*Cn/360),d=c*(i-e)/2+l*(t-n)/2,f=-l*(i-e)/2+c*(t-n)/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 g=wm(i,t,e,n,r,s,a,o,l,c),p=[];let _=g[2],y=g[3];const b=Math.max(Math.ceil(Math.abs(y)/(Cn/4)),1);y/=b;for(let m=0;m<b;m++)p.push(Sm(_,y)),_+=y;return p.map(m=>{for(let v=0;v<m.length;v+=2){let w=m[v+0],S=m[v+1];w*=a,S*=o;const k=c*w-l*S,C=l*w+c*S;m[v+0]=k+g[0],m[v+1]=C+g[1]}return m})}function xm(i){for(var t,e=[],n=0,r=0,s=0,a=0,o=null,h=null,l=0,c=0,d=0,f=i.length;d<f;d++){var u=i[d],g=u[0];switch(g){case"M":s=u[1],a=u[2];break;case"A":var p=Cm(l,c,u[6],u[7],u[4],u[5],u[1],u[2],u[3]);if(!p.length)continue;p=p.map(v=>{const[w,S,k,C,A,x,T,M]=v;return{x1:k,y1:C,x2:A,y2:x,x:T,y:M}});for(var _=0,y;_<p.length;_++)y=p[_],u=["C",y.x1,y.y1,y.x2,y.y2,y.x,y.y],_<p.length-1&&e.push(u);break;case"S":var b=l,m=c;(t=="C"||t=="S")&&(b+=b-n,m+=m-r),u=["C",b,m,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=Pc(l,c,o,h,u[1],u[2]);break;case"Q":o=u[1],h=u[2],u=Pc(l,c,u[1],u[2],u[3],u[4]);break;case"L":u=mr(l,c,u[1],u[2]);break;case"H":u=mr(l,c,u[1],c);break;case"V":u=mr(l,c,l,u[1]);break;case"Z":u=mr(l,c,s,a);break}t=g,l=u[u.length-2],c=u[u.length-1],u.length>4?(n=u[u.length-4],r=u[u.length-3]):(n=l,r=c),e.push(u)}return e}function mr(i,t,e,n){return["C",i,t,e,n,e,n]}function Pc(i,t,e,n,r,s){return["C",i/3+2/3*e,t/3+2/3*n,r/3+2/3*e,s/3+2/3*n,r,s]}function Tm(i){return typeof i!="string"?!1:(i=i.trim(),/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(i)&&/[\dz]$/i.test(i)&&i.length>4)}const _r=Symbol("initialPath"),ue=Symbol("path"),Le=Symbol("bounds"),vr=Symbol("savedPaths"),de=Symbol("renderProps"),Ua=Symbol("beginPath");class Em{constructor(t){if(!Tm(t))throw new Error("Not an SVG path!");this[_r]=bm(_m(t)),this[ue]=xm(this[_r]),this[Le]=null,this[vr]=[],this[de]={},this[Ua]=!1}save(){return this[vr].push({path:this[ue],bounds:this[Le],renderProps:Object.assign({},this[de])}),this}restore(){if(this[vr].length){const{path:t,bounds:e,renderProps:n}=this[vr].pop();this[ue]=t,this[Le]=e,this[de]=n}return this}get bounds(){if(!this[Le]){const t=this[ue];if(this[Le]=[0,0,0,0],t.length){const e=[1/0,1/0,-1/0,-1/0];for(let n=0,r=t.length;n<r;n++){const s=t[n].slice(1);for(let a=0;a<s.length;a+=2)s[a+0]<e[0]&&(e[0]=s[a+0]),s[a+1]<e[1]&&(e[1]=s[a+1]),s[a+0]>e[2]&&(e[2]=s[a+0]),s[a+1]>e[3]&&(e[3]=s[a+1])}this[Le]=e}}return this[Le]}get size(){const t=this.bounds;return[t[2]-t[0],t[3]-t[1]]}get center(){const[t,e,n,r]=this.bounds;return[(t+n)/2,(e+r)/2]}get d(){let t=this[ue].map(e=>{const[n,...r]=e;return n+r.join()}).join("");return this.isClosed&&(t+="Z"),t}get path(){return this[ue]}get isClosed(){const t=this[_r][this[_r].length-1];return t&&t[0]==="Z"}isPointInPath(t,e){return pm(this,t,e)}isPointInStroke(t,e,{lineWidth:n=1,lineCap:r="butt",lineJoin:s="miter"}){if(kc)return kc(this,t,e,{lineWidth:n,lineCap:r,lineJoin:s})}getPointAtLength(t){return fm(this.d,t)}getTotalLength(){return gm(this.d)}transform(...t){this[Le]=null;const e=new ce(t),n=this[ue];return this[ue]=n.map(r=>{const[s,...a]=r,o=[s];for(let h=0;h<a.length;h+=2){const l=a[h],c=a[h+1],[d,f]=e.transformPoint(l,c);o.push(d,f)}return o}),this}translate(t,e){const n=new ce().translate(t,e);return this.transform(...n.m)}rotate(t){const e=new ce().rotate(t);return this.transform(...e.m)}scale(t,e){e==null&&(e=t);const n=new ce().scale(t,e);return this.transform(...n.m)}skew(t,e){const n=new ce().skew(t,e);return this.transform(...n.m)}trim(){const[t,e]=this.bounds;return this.translate(-t,-e),this}beginPath(){return this[Ua]=!0,this}toCanvas(t){const e=this[ue],n=this[de];return e.length&&(this[Ua]&&t.beginPath(),e.forEach(r=>{const[s,...a]=r;s==="M"?t.moveTo(...a):t.bezierCurveTo(...a)}),this.isClosed&&t.closePath()),Object.assign(t,n),{stroke(){return t.stroke(),this},fill(){return t.fill(),this}}}strokeStyle(t){return this[de].strokeStyle=t,this}fillStyle(t){return this[de].fillStyle=t,this}lineWidth(t){return this[de].lineWidth=t,this}lineCap(t){return this[de].lineCap=t,this}lineJoin(t){return this[de].lineJoin=t,this}}const Mc=km("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 km(i,t=10){const e={},n=i.split(",");for(let r=0;r<n.length;r+=2){const s="&"+n[r+1]+";",a=parseInt(n[r],t);e[s]="&#"+a+";"}return e["\\xa0"]=" ",e}function Rt(i,t){const e=Object.keys(t);for(let n=0;n<e.length;n++)i=i.replace(new RegExp("{"+e[n]+"}","gi"),""+t[e[n]]);return i}function yr(i){let t,e;if(!i)throw new Error("cannot create a random attribute name for an undefined object");const n="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";t="";do for(t="",e=0;e<12;e++)t+=n[Math.floor(Math.random()*n.length)];while(i[t]);return t}function Am(i){const t={left:"start",right:"end",center:"middle",start:"start",end:"end"};return t[i]||t.start}function Pm(i){const t={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return t[i]||t.alphabetic}const xn={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 Ga{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}addColorStop(t,e){const n=this.__ctx.__createElement("stop");if(n.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&&(n.setAttribute("stop-color",Rt("rgb({r},{g},{b})",{r:s[1],g:s[2],b:s[3]})),n.setAttribute("stop-opacity",s[4]))}else n.setAttribute("stop-color",e);this.__root.appendChild(n)}}class Rc{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}}class br{__document=document;__canvas;__ctx;width;height;__styleStack;__groupStack;__rootSVG;__ids;__SVGdefs;__currentElement;__currentElementsToStyle=null;constructor({canvas:t,width:e=500,height:n=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=n),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(xn);for(let e=0,n=t.length;e<n;e++){const r=t[e];this[r]=xn[r].canvas}}__getStyleState(){const t={},e=Object.keys(xn);for(let n=0,r=e.length;n<r;n++){const s=e[n];t[s]=this[s]}return t}__applyStyleState(t){const e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){const s=e[n];this[s]=t[s]}}__createElement(t,e={},n=!1){const r=this.__document.createElementNS("http://www.w3.org/2000/svg",t),s=Object.keys(e);n&&(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 n=this.__currentElementsToStyle;n&&(e.setAttribute(t,""),e=n.element,n.children.forEach(s=>{s.setAttribute(t,"")}));const r=Object.keys(xn);for(let s=0;s<r.length;s++){const a=xn[r[s]],o=this[r[s]];if(a.apply){if(o instanceof Rc){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,Rt("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof Ga)e.setAttribute(a.apply,Rt("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,Rt("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(Mc);for(let s=0,a=r.length;s<a;s++){const o=r[s],h=Mc[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 n=this.__currentElement.getAttribute("transform");n?n+=" ":n="",n+=t,this.__currentElement.setAttribute("transform",n)}scale(t,e){e===void 0&&(e=t),this.__addTransform(Rt("scale({x},{y})",{x:t,y:e}))}rotate(t){const e=t*180/Math.PI;this.__addTransform(Rt("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))}translate(t,e){this.__addTransform(Rt("translate({x},{y})",{x:t,y:e}))}transform(t,e,n,r,s,a){this.__addTransform(Rt("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:n,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(Rt("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(Rt("L {x} {y}",this.__currentPosition)):this.__addPathCommand(Rt("M {x} {y}",this.__currentPosition))}bezierCurveTo(t,e,n,r,s,a){this.__currentPosition={x:s,y:a},this.__addPathCommand(Rt("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:n,cp2y:r,x:s,y:a}))}quadraticCurveTo(t,e,n,r){this.__currentPosition={x:n,y:r},this.__addPathCommand(Rt("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:n,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,n,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===n&&e===r||s===0){this.lineTo(t,e);return}const h=this.normalize([a-t,o-e]),l=this.normalize([n-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),g=t+u*f[0],p=e+u*f[1],_=[-h[1],h[0]],y=[l[1],-l[0]],b=function(w){const S=w[0];return w[1]>=0?Math.acos(S):-Math.acos(S)},m=b(_),v=b(y);this.lineTo(g+_[0]*s,p+_[1]*s),this.arc(g,p,s,m,v)}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,n,r){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+n,e),this.lineTo(t+n,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.closePath()}fillRect(t,e,n,r){const s=this.__createElement("rect",{x:t,y:e,width:n,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("fill")}strokeRect(t,e,n,r){const s=this.__createElement("rect",{x:t,y:e,width:n,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("stroke")}__clearCanvas(){const e=this.__closestGroupOrSvg().getAttribute("transform"),n=this.__rootSVG.childNodes[1],r=n.childNodes;for(let s=r.length-1;s>=0;s--)r[s]&&n.removeChild(r[s]);this.__currentElement=n,this.__groupStack=[],e&&this.__addTransform(e)}clearRect(t,e,n,r){if(t===0&&e===0&&n===this.width&&r===this.height){this.__clearCanvas();return}const s=this.__closestGroupOrSvg(),a=this.__createElement("rect",{x:t,y:e,width:n,height:r,fill:"#FFFFFF"},!0);s.appendChild(a)}createLinearGradient(t,e,n,r){const s=this.__createElement("linearGradient",{id:yr(this.__ids),x1:t+"px",x2:n+"px",y1:e+"px",y2:r+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(s),new Ga(s,this)}createRadialGradient(t,e,n,r,s,a){const o=this.__createElement("radialGradient",{id:yr(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 Ga(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),n={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"&&(n.decoration="underline"),this.__fontHref&&(n.href=this.__fontHref),n}__wrapTextLink(t,e){if(t.href){const n=this.__createElement("a");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),n.appendChild(e),n}return e}__applyText(t,e,n,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:n,"text-anchor":Am(this.textAlign),"dominant-baseline":Pm(this.textBaseline)},!0);o.appendChild(this.__document.createTextNode(t)),this.__currentElement=o,this.__applyStyleToCurrentElement(r),a.appendChild(this.__wrapTextLink(s,o))}fillText(t,e,n){this.__applyText(t,e,n,"fill")}strokeText(t,e,n){this.__applyText(t,e,n,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,n,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+n*Math.cos(s),h=e+n*Math.sin(s),l=t+n*Math.cos(r),c=e+n*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(Rt("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:n,ry:n,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"),n=yr(this.__ids),r=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",n),e.appendChild(this.__currentElement),this.__SVGdefs.appendChild(e),t.setAttribute("clip-path",Rt("url(#{id})",{id:n})),t.appendChild(r),this.__currentElement=r}drawImage(...t){let e=t[0],n,r,s,a,o=0,h=0,l,c,d,f,u,g,p,_;if(t.length===3)n=t[1],r=t[2],l=e.width,c=e.height,s=l,a=c;else if(t.length===5)n=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],n=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 y=this.__closestGroupOrSvg();this.__currentElement;const b="translate("+n+", "+r+")";if(e instanceof br){if(d=e.getSvg().cloneNode(!0),d.childNodes&&d.childNodes.length>1){for(f=d.childNodes[0];f.childNodes.length;)_=f.childNodes[0].getAttribute("id"),this.__ids[_]=_,this.__SVGdefs.appendChild(f.childNodes[0]);if(u=d.childNodes[1],u){const m=u.getAttribute("transform");let v;m?v=m+" "+b:v=b,u.setAttribute("transform",v),y.appendChild(u)}}}else(e.nodeName==="CANVAS"||e.nodeName==="IMG")&&(g=this.__createElement("image"),g.setAttribute("width",s),g.setAttribute("height",a),g.setAttribute("preserveAspectRatio","none"),(o||h||l!==e.width||c!==e.height)&&(p=this.__document.createElement("canvas"),p.width=s,p.height=a,p.getContext("2d")?.drawImage(e,o,h,l,c,0,0,s,a),e=p),g.setAttribute("transform",b),g.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.nodeName==="CANVAS"?e.toDataURL():e.getAttribute("src")),y.appendChild(g))}createPattern(t,e){const n=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),r=yr(this.__ids);let s;return n.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")),n.appendChild(s),this.__SVGdefs.appendChild(n)):t instanceof br&&(n.setAttribute("width",""+t.width),n.setAttribute("height",""+t.height),n.appendChild(t.__rootSVG.childNodes[1]),this.__SVGdefs.appendChild(n)),new Rc(n,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}drawFocusRing(){}createImageData(){}getImageData(){}putImageData(){}globalCompositeOperation(){}setTransform(){}}const Mm=br,Rm=function(i,t,e,n,r,s){i.beginPath(),i.moveTo(t,e+s),i.lineTo(t,e+r-s),i.quadraticCurveTo(t,e+r,t+s,e+r),i.lineTo(t+n-s,e+r),i.quadraticCurveTo(t+n,e+r,t+n,e+r-s),i.lineTo(t+n,e+s),i.quadraticCurveTo(t+n,e,t+n-s,e),i.lineTo(t+s,e),i.quadraticCurveTo(t,e,t,e+s),i.stroke()},Dm=function(i,t,e,n){var r=t-n,s=0,a=1;i.beginPath(),i.moveTo(r,s);do{if(a>2e4)break;var o=(t+e)*Math.cos(a*Math.PI/72)-(e+n)*Math.cos((t+e)/e*(a*Math.PI/72)),h=(t+e)*Math.sin(a*Math.PI/72)-(e+n)*Math.sin((t+e)/e*(a*Math.PI/72));i.lineTo(o,h),r=o,s=h,a++}while(o!=t-n&&h!=0);i.stroke()},Lm=function(i,t){i.save(),i.beginPath(),i.moveTo(t,0);for(var e=0;e<9;e++)i.rotate(Math.PI/5),e%2==0?i.lineTo(t/.525731*.200811,0):i.lineTo(t,0);i.closePath(),i.fill(),i.restore()},Om=function(i,t,e,n,r){var s=0;function a(){i.clearRect(t,e,n,r),i.setLineDash([4,2]),i.lineDashOffset=-s,i.strokeRect(t,e,n,r)}function o(){s++,s>16&&(s=0),a(),setTimeout(o,40)}o()},Im=function(i){i.beginPath(),i.arc(75,75,50,0,Math.PI*2,!0),i.moveTo(110,75),i.arc(75,75,35,0,Math.PI,!1),i.moveTo(65,65),i.arc(60,65,5,0,Math.PI*2,!0),i.moveTo(95,65),i.arc(90,65,5,0,Math.PI*2,!0),i.stroke()};let Fm=class{constructor(t=0,e=0,n="#ffff00",r=0){this.x=t,this.y=e,this.color=n,this.rotation=r}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=2,t.fillStyle=this.color,t.beginPath(),t.moveTo(-50,-25),t.lineTo(0,-25),t.lineTo(0,-50),t.lineTo(50,0),t.lineTo(0,50),t.lineTo(0,25),t.lineTo(-50,25),t.lineTo(-50,-25),t.closePath(),t.fill(),t.stroke(),t.restore()}};class Nm extends pt{constructor(t=40,e="#ff0000"){super(0,0,{vx:0,vy:0,radius:t}),this.x=0,this.y=0,this.radius=t,this.vx=0,this.vy=0,this.mass=1,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=e,this.lineWidth=1}draw(t){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,t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}getBounds(){return new Fa(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class Um{constructor(t=40,e="#ff0000"){this.x=0,this.y=0,this.xpos=0,this.ypos=0,this.zpos=0,this.radius=t,this.vx=0,this.vy=0,this.vz=0,this.mass=1,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=e,this.lineWidth=1,this.visible=!0}draw(t){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,t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}}class Gm{constructor(t=50,e=50,n="#ff0000"){this.x=0,this.y=0,this.width=t,this.height=e,this.vx=0,this.vy=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=n,this.lineWidth=1}draw(t){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,t.beginPath(),t.rect(0,0,this.width,this.height),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}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)}}class Bm{constructor(t,e,n,r){this.x=t===void 0?-100:t,this.y=e===void 0?-100:e,this.z=n===void 0?-100:n,this.brightness=r===void 0?1:r}setBrightness(t){this.brightness=Math.min(Math.max(t,0),1)}}let zm=class{constructor(t,e,n,r){this.x=0,this.y=0,this.x1=t===void 0?0:t,this.y1=e===void 0?0:e,this.x2=n===void 0?0:n,this.y2=r===void 0?0:r,this.rotation=0,this.scaleX=1,this.scaleY=1,this.lineWidth=1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.beginPath(),t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2),t.closePath(),t.stroke(),t.restore()}getBounds(){if(this.rotation===0){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),r=Math.max(this.y1,this.y2);return{x:this.x+t,y:this.y+e,width:n-t,height:r-e}}else{var s=Math.sin(this.rotation),a=Math.cos(this.rotation),o=a*this.x1-s*this.y1,h=a*this.x2-s*this.y2,l=a*this.y1+s*this.x1,c=a*this.y2+s*this.x2;return{x:this.x+Math.min(o,h),y:this.y+Math.min(l,c),width:Math.max(o,h)-Math.min(o,h),height:Math.max(l,c)-Math.min(l,c)}}}};class Hm{constructor(t,e,n){this.x=t===void 0?0:t,this.y=e===void 0?0:e,this.z=n===void 0?0:n,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,n){this.cX=t,this.cY=e,this.cZ=n}rotateX(t){var e=Math.cos(t),n=Math.sin(t),r=this.y*e-this.z*n,s=this.z*e+this.y*n;this.y=r,this.z=s}rotateY(t){var e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.z*n,s=this.z*e+this.x*n;this.x=r,this.z=s}rotateZ(t){var e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.y*n,s=this.y*e+this.x*n;this.x=r,this.y=s}getScreenX(){var t=this.fl/(this.fl+this.z+this.cZ);return this.vpX+(this.cX+this.x)*t}getScreenY(){var t=this.fl/(this.fl+this.z+this.cZ);return this.vpY+(this.cY+this.y)*t}}class jm{constructor(){this.x=0,this.y=0,this.width=25,this.height=20,this.rotation=0,this.showFlame=!1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=1,t.strokeStyle="#ffffff",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 Vm{constructor(t,e,n){this.min=t===void 0?0:t,this.max=e===void 0?100:e,this.value=n===void 0?100:n,this.onchange=null,this.x=0,this.y=0,this.width=16,this.height=100,this.backColor="#cccccc",this.backBorderColor="#999999",this.backWidth=4,this.backX=this.width/2-this.backWidth/2,this.handleColor="#eeeeee",this.handleBorderColor="#cccccc",this.handleHeight=6,this.handleY=0,this.updatePosition()}draw(t){t.save(),t.translate(this.x,this.y),t.fillStyle=this.backColor,t.beginPath(),t.fillRect(this.backX,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()}updateValue(){var t=this.value,e=this.height-this.handleHeight,n=this.max-this.min;this.value=(e-this.handleY)/e*n+this.min,typeof this.onchange=="function"&&this.value!==t&&this.onchange()}updatePosition(){var t=this.height-this.handleHeight,e=this.max-this.min;this.handleY=t-(this.value-this.min)/e*t}captureMouse(t){var e=this,n=Js.captureMouse(t),r=new Fa(0,0,0,0);o(),t.addEventListener("mousedown",function(){r.isContainPoint(n)&&(t.addEventListener("mouseup",s,!1),t.addEventListener("mousemove",a,!1))},!1);function s(){t.removeEventListener("mousemove",a,!1),t.removeEventListener("mouseup",s,!1),o()}function a(){var h=n.y-e.y;e.handleY=Math.min(e.height-e.handleHeight,Math.max(h,0)),e.updateValue()}function o(){r.x=e.x,r.y=e.y+e.handleY,r.width=e.width,r.height=e.handleHeight}}}class $m{constructor(t,e,n,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=n,this.color=r,this.lineWidth=1,this.alpha=1}draw(t){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=Ia(this.color,this.alpha),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(){var t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),n=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*n}}class Xm{constructor(t,e,n,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=n,this.color=r,this.lineWidth=1,this.alpha=1,this.light=null}draw(t){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=this.getAdjustedColor(),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(){var t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),n=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*n}getAdjustedColor(){var t=fr(this.color),e=t>>16,n=t>>8&255,r=t&255,s=this.getLightFactor();return e*=s,n*=s,r*=s,Cc(e<<16|n<<8|r)}getLightFactor(){var 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},n={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=n.x*this.light.x+n.y*this.light.y+n.z*this.light.z,s=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.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 Ym{constructor(){this.x=0,this.y=0,this.xpos=0,this.ypos=0,this.zpos=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){t.save(),t.translate(this.x,this.y),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.strokeStyle=Ia(this.color,this.alpha),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 Wm{constructor(t,e,n="#ffffff"){this.x=0,this.y=0,this.width=t,this.height=e,this.vx=0,this.vy=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=n,this.lineWidth=1}draw(t){var e=this.height,n=this.width+e,r=e/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,t.beginPath(),t.moveTo(0,-r),t.lineTo(n-2*r,-r),t.quadraticCurveTo(-r+n,-r,-r+n,0),t.lineTo(-r+n,e-2*r),t.quadraticCurveTo(-r+n,-r+e,n-2*r,-r+e),t.lineTo(0,-r+e),t.quadraticCurveTo(-r,-r+e,-r,e-2*r),t.lineTo(-r,0),t.quadraticCurveTo(-r,-r,0,-r),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 qm{canvas;context;mouse;constructor(t){this.canvas=t,this.context=t.getContext("2d",{willReadFrequently:!0}),this.mouse=Js.captureMouse(this.canvas)}getMouseRotation(t){return t.angleTo(this.mouse)}followMouse(t,e){const n=this.getMouseRotation(t),{x:r,y:s}=t.fromRadian(n,e);return t.x+=r,t.y+=s,t}followMouseWithAcceleration(t,e=.05){const n=this.getMouseRotation(t),{x:r,y:s}=t.fromRadian(n,e);return t.ax=r,t.ay=s,t.nextFrame(),t}getMouseDistance(t){return t.distanceTo(this.mouse)}clearRect(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this}lineWidth(t){return this.context.lineWidth=t,this}fillStyle(t){return this.context.fillStyle=t,this}fill(){return this.context.fill(),this}strokeStyle(t){return this.context.strokeStyle=t,this}stroke(){return this.context.stroke(),this}createLinearGradient(t,e,n){const r=this.context.createLinearGradient(t.x,t.y,e.x,e.y);return Object.keys(n).forEach(s=>r.addColorStop(parseFloat(s),n[parseFloat(s)])),r}createRadialGradient(t,e,n){const r=this.context.createRadialGradient(t.x,t.y,t.radius,e.x,e.y,e.radius);return Object.keys(n).forEach(s=>r.addColorStop(parseFloat(s),n[parseFloat(s)])),r}moveTo(t){this.context.moveTo(t.x,t.y)}closePath(){this.context.closePath()}lineTo(t,e){this.context.save(),this.context.beginPath(),this.context.moveTo(t.x,t.y),this.context.lineTo(e.x,e.y),this.context.stroke(),this.context.restore()}drawMouseMoveLine(){const t=()=>{this.context.lineTo(this.mouse.x,this.mouse.y),this.stroke()};this.canvas.addEventListener("mousedown",()=>{this.context.beginPath(),this.context.moveTo(this.mouse.x,this.mouse.y),this.canvas.addEventListener("mousemove",t,!1)},!1),this.canvas.addEventListener("mouseup",()=>{this.canvas.removeEventListener("mousemove",t,!1)},!1)}drawMouseMoveBrushLine({brush_size:t,brush_density:e,brush_color:n}={brush_size:25,brush_density:50,brush_color:"#000000"}){const r=this.getImageData(),s=r.data,a=fr(n),o=()=>{for(let h=0;h<e;h++){const l=Math.random()*Math.PI*2,c=Math.random()*t,d=this.mouse.x+Math.cos(l)*c|0,f=this.mouse.y+Math.sin(l)*c|0,u=(d+f*r.width)*4;s[u]=a>>16&255,s[u+1]=a>>8&255,s[u+2]=a&255,s[u+3]=255}this.putImageData(r)};this.canvas.addEventListener("mousedown",()=>{this.canvas.addEventListener("mousemove",o,!1)},!1),this.canvas.addEventListener("mouseup",()=>{this.canvas.removeEventListener("mousemove",o,!1)},!1)}quadraticCurveTo(t,e,n){this.context.save(),this.context.beginPath(),this.context.moveTo(t.x,t.y),this.context.quadraticCurveTo(e.x,e.y,n.x,n.y),this.context.stroke(),this.context.restore()}drawQuadraticCurveLine(t){const e=t.length;if(e<3)return new Error("points length must >= 3");this.context.beginPath(),this.context.moveTo(t[0].x,t[0].y);for(let n=1;n<e;n+=2)this.context.quadraticCurveTo(t[n].x,t[n].y,t[n+1].x,t[n+1].y);this.context.stroke()}quadraticThroughCurveTo(t,e,n){e.x=e.x*2-(t.x+n.x)/2,e.y=e.y*2-(t.y+n.y)/2,this.quadraticCurveTo(t,e,n)}drawQuadraticThroughCurveLine(t){const e=t.length;if(e<3)return new Error("points length must >= 3");this.context.beginPath(),this.context.moveTo(t[0].x,t[0].y);let n=1;for(;n<e-2;n++)this.context.quadraticCurveTo(t[n].x,t[n].y,(t[n].x+t[n+1].x)/2,(t[n].y+t[n+1].y)/2);this.context.quadraticCurveTo(t[n].x,t[n].y,t[n+1].x,t[n+1].y),this.context.stroke()}drawQuadraticThroughCurveLineBetter(t){const e=t.length;if(e<3)return new Error("points length must >= 3");const n=(t[0].x+t[e-1].x)/2,r=(t[0].y+t[e-1].y)/2;this.context.beginPath(),this.context.moveTo(n,r);let s=0;for(;s<e-1;s++){const a=(t[s].x+t[s+1].x)/2,o=(t[s].y+t[s+1].y)/2;this.context.quadraticCurveTo(t[s].x,t[s].y,a,o)}this.context.quadraticCurveTo(t[s].x,t[s].y,r,r),this.context.stroke()}fillRect(t){this.context.save(),this.context.fillRect(t.x,t.y,t.width,t.height),this.context.stroke(),this.context.restore()}drawImage(t,e=0,n=0){this.context.drawImage(t,e,n)}getImageData(t={x:0,y:0,width:this.canvas.width,height:this.canvas.height},e){return this.context.getImageData(t.x,t.y,t.width,t.height,e)}putImageData(t,e=0,n=0){return this.context.putImageData(t,e,n)}drawShape(t){t.draw(this.context)}}var Dc=null;if(navigator.mozGetUserMedia)console.log("This appears to be Firefox"),window.webrtcDetectedBrowser="firefox",window.webrtcDetectedVersion=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10),RTCSessionDescription=mozRTCSessionDescription,RTCIceCandidate=mozRTCIceCandidate,window.getUserMedia=navigator.mozGetUserMedia.bind(navigator),navigator.getUserMedia=Dc,window.createIceServer=function(i,t,e){var n=null,r=i.split(":");if(r[0].indexOf("stun")===0)n={url:i};else if(r[0].indexOf("turn")===0){var s=i.split("?");(s.length===1||s[1].indexOf("transport=udp")===0)&&(n={url:s[0],credential:e,username:t})}return n},window.createIceServers=function(i,t,e){for(var n=[],r=0;r<i.length;r++){var s=createIceServer(i[r],t,e);s!==null&&n.push(s)}return n},window.attachMediaStream=function(i,t){console.log("Attaching media stream"),i.mozSrcObject=t,i.play()},window.reattachMediaStream=function(i,t){console.log("Reattaching media stream"),i.mozSrcObject=t.mozSrcObject,i.play()};else if(navigator.webkitGetUserMedia){console.log("This appears to be Chrome"),window.webrtcDetectedBrowser="chrome";var Lc=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);Lc!==null?window.webrtcDetectedVersion=parseInt(Lc[2],10):window.webrtcDetectedVersion=999,window.createIceServer=function(i,t,e){var n=null,r=i.split(":");return r[0].indexOf("stun")===0?n={url:i}:r[0].indexOf("turn")===0&&(n={url:i,credential:e,username:t}),n},window.createIceServers=function(i,t,e){for(var n=[],r=0;r<i.length;r++){var s=createIceServer(i[r],t,e);s!==null&&n.push(s)}return n},window.getUserMedia=navigator.webkitGetUserMedia.bind(navigator),navigator.getUserMedia=Dc,window.attachMediaStream=function(i,t){typeof i.srcObject<"u"?i.srcObject=t:typeof i.mozSrcObject<"u"?i.mozSrcObject=t:typeof i.src<"u"?i.src=URL.createObjectURL(t):console.log("Error attaching stream to element.")},window.reattachMediaStream=function(i,t){i.src=t.src}}else console.log("Browser does not appear to be WebRTC-capable");class Tn{video;constructor(t){this.video=t}setSrcObject(t){this.video.addEventListener("loadedmetadata",e=>{const n=e.target;n instanceof HTMLVideoElement&&console.log(`${n.id} videoWidth: ${n.videoWidth}px, videoHeight: ${n.videoHeight}px.`)}),this.video.srcObject=t}static tryAutoPlayOrAutoPlayAfterClick(t){return new Promise(e=>{t.play().then(()=>{t.autoplay=!0,e(!0)}).catch(n=>{Tn.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 Km{localVideoUtil;remoteVideoUtil;localPeerConnection=null;remotePeerConnection=null;constructor(t,e){this.localVideoUtil=new Tn(t),this.remoteVideoUtil=new Tn(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(n=>{this.localVideoUtil.setSrcObject(n),t(n)}).catch(n=>{this.trace(`navigator.getUserMedia error: ${n}.`),e(n)})})}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(),n=t.getAudioTracks();e.length>0&&this.trace(`Using video device: ${e[0].label}.`),n.length>0&&this.trace(`Using audio device: ${n[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(n[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,n=t.candidate;if(e&&n){const r=new RTCIceCandidate(n),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:
|
|
24
|
+
`):l.send(e)):(l.open(i,t,!0),l.send(e))})}function Q_(i,t){const e=new XMLHttpRequest;e.open("HEAD",i),e.filepath=i,e.callback=t,e.onload=function(){const n=parseFloat(window.localStorage.getItem("lm_"+this.filepath)),r=Date.parse(this.getResponseHeader("Last-Modified"));(isNaN(n)||r>n)&&(window.localStorage.setItem("lm_"+this.filepath,Date.now()),isFinite(n)&&this.callback(r,n))},e.send()}let ka;const Uf=new WeakMap;function kl(i,t){let e=Uf.get(i);e||(e=new Map,Uf.set(i,e));let n=e.get(t);return n||(n=new Gf,e.set(t,n)),n}class Gf{subscribers;constructor(){this.subscribers=new Set}depend(){ka&&this.subscribers.add(ka)}notify(){this.subscribers.forEach(t=>t())}}function ty(i){ka=i,i(),ka=null}function ey(i){return Object.keys(i).forEach(t=>{let e=i[t];const n=kl(i,t);Object.defineProperty(i,t,{get(){return n.depend(),e},set(r){r!=e&&(e=r,n.notify())}})}),i}function iy(i){return new Proxy(i,{get(t,e,n){return kl(i,e).depend(),Reflect.get(t,e,n)},set(t,e,n,r){const s=kl(i,e);return i[e]!=n&&(i[e]=n,s.notify()),Reflect.set(t,e,n,r)}})}const ny=()=>Math.random()*16777215,ry=()=>`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`,sy=()=>`#${(~~(Math.random()*(1<<24))).toString(16)}`,Bf=function(i){let t="00000"+(i|0).toString(16);return t="#"+t.substring(t.length-6),t},$f=function(i,t=1){const e=i>>16&255,n=i>>8&255,r=i&255,s=t<0?0:t>1?1:t;return s===1?"rgb("+e+","+n+","+r+")":"rgba("+e+","+n+","+r+","+s+")"},Ea=function(i){return i[0]==="#"&&(i=i.slice(1)),window.parseInt(i,16)},El=function(i,t=1){const e=Ea(i);return $f(e,t)},ay=i=>{const e=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(i);return e?"#"+((1<<24)+(parseInt(e[1])<<16)+(parseInt(e[2])<<8)+parseInt(e[3])).toString(16).slice(1):""};function oy(i,t,e,n){let r,s,a;i=i/360,t=t/100,e=e/100;const o=Math.floor(i*6),l=i*6-o,h=e*(1-t),c=e*(1-l*t),d=e*(1-(1-l)*t);switch(o%6){case 0:r=e,s=d,a=h;break;case 1:r=c,s=e,a=h;break;case 2:r=h,s=e,a=d;break;case 3:r=h,s=c,a=e;break;case 4:r=d,s=h,a=e;break;case 5:default:r=e,s=h,a=c;break}return{r:Math.round(r*255),g:Math.round(s*255),b:Math.round(a*255),a:n??1}}function ly(i,t,e,n){const r=Math.max(i,t,e),s=Math.min(i,t,e),a=r-s,o=r===0?0:a/r,l=r/255;let h;switch(r){case s:h=0;break;case i:h=t-e+a*(t<e?6:0),h/=6*a;break;case t:h=e-i+a*2,h/=6*a;break;case e:default:h=i-t+a*4,h/=6*a;break}return{h:Math.round(h*360),s:Math.round(o*100),v:Math.round(l*100),a:n??1}}function hy(i,t){let e=parseInt(i.substring(1,3),16),n=parseInt(i.substring(3,5),16),r=parseInt(i.substring(5,7),16);e==0&&(e=32),n==0&&(n=32),r==0&&(r=32),e=e*(100+t)/100,n=n*(100+t)/100,r=r*(100+t)/100,e=e<255?e:255,n=n<255?n:255,r=r<255?r:255,e=Math.round(e),n=Math.round(n),r=Math.round(r);const s=e.toString(16).length==1?"0"+e.toString(16):e.toString(16),a=n.toString(16).length==1?"0"+n.toString(16):n.toString(16),o=r.toString(16).length==1?"0"+r.toString(16):r.toString(16);return"#"+s+a+o}const Ln={Linear:{None:function(i){return i}},Ease:{In:function(i){return Math.pow(i,1.7)}},Quadratic:{In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}},Cubic:{In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}},Quartic:{In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}},Quintic:{In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}},Sinusoidal:{In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}},Exponential:{In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}},Circular:{In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}},Elastic:{In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}},Back:{In:function(i){return i===1?1:i*i*((1.70158+1)*i-1.70158)},Out:function(i){return i===0?0:--i*i*((1.70158+1)*i+1.70158)+1},InOut:function(i){const t=2.5949095;return(i*=2)<1?.5*(i*i*((t+1)*i-t)):.5*((i-=2)*i*((t+1)*i+t)+2)}},Bounce:{In:function(i){return 1-Ln.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?Ln.Bounce.In(i*2)*.5:Ln.Bounce.Out(i*2-1)*.5+.5}},generatePow:function(i=4){return i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(t){return t**i},Out:function(t){return 1-(1-t)**i},InOut:function(t){return t<.5?(t*2)**i/2:(1-(2-t*2)**i)/2+.5}}},random:function(i){return Math.random()},createStep:function(i){return function(t){return Math.floor(t*i)/i}},createNoisyEasing:function(i,t=.1){const e=1-t;return function(n){return t*Math.random()+e*i(n)}}};let Ir;typeof self>"u"&&typeof process<"u"&&process.hrtime?Ir=function(){const i=process.hrtime();return i[0]*1e3+i[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?Ir=self.performance.now.bind(self.performance):Date.now!==void 0?Ir=Date.now:Ir=function(){return new Date().getTime()};const Dn=Ir;let zf=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=Dn(),e=!1){let n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(let r=0;r<n.length;r++){const s=this._tweens[n[r]],a=!e;s&&s.update(t,a)===!1&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0}};const Qi={Linear:function(i,t){const e=i.length-1,n=e*t,r=Math.floor(n),s=Qi.Utils.Linear;return t<0?s(i[0],i[1],n):t>1?s(i[e],i[e-1],e-n):s(i[r],i[r+1>e?e:r+1],n-r)},Bezier:function(i,t){let e=0;const n=i.length-1,r=Math.pow,s=Qi.Utils.Bernstein;for(let a=0;a<=n;a++)e+=r(1-t,n-a)*r(t,a)*i[a]*s(n,a);return e},CatmullRom:function(i,t){const e=i.length-1;let n=e*t,r=Math.floor(n);const s=Qi.Utils.CatmullRom;return i[0]===i[e]?(t<0&&(r=Math.floor(n=e*(1+t))),s(i[(r-1+e)%e],i[r],i[(r+1)%e],i[(r+2)%e],n-r)):t<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):t>1?i[e]-(s(i[e],i[e],i[e-1],i[e-1],n-e)-i[e]):s(i[r?r-1:0],i[r],i[e<r+1?e:r+1],i[e<r+2?e:r+2],n-r)},Utils:{Linear:function(i,t,e){return(t-i)*e+i},Factorial:function(){const i=[1];return function(t){let e=1;if(i[t])return i[t];for(let n=t;n>1;n--)e*=n;return i[t]=e,e}}(),Bernstein:function(i,t){const e=Qi.Utils.Factorial;return e(i)/e(t)/e(i-t)},CatmullRom:function(i,t,e,n,r){const s=(e-i)*.5,a=(n-t)*.5,o=r*r,l=r*o;return(2*t-2*e+s+a)*l+(-3*t+3*e-2*s-a)*o+s*r+t}}};class Or{static _nextId=0;static nextId(){return Or._nextId++}}const Ue=new zf;let cy=class{constructor(t,e=Ue){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=Ln.Linear.None;_interpolationFunction=Qi.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=Dn()){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,n,r){for(const s in n){const a=t[s],o=Array.isArray(a),l=o?"array":typeof a,h=!o&&Array.isArray(n[s]);if(!(l==="undefined"||l==="function")){if(h){let c=n[s];if(c.length===0)continue;c=c.map(this._handleRelativeValue.bind(this,a)),n[s]=[a].concat(c)}if((l==="object"||o)&&a&&!h){e[s]=o?[]:{};for(const c in a)e[s][c]=a[c];r[s]=o?[]:{},this._setupProperties(a,e[s],n[s],r[s])}else typeof e[s]>"u"&&(e[s]=a),o||(e[s]*=1),h?r[s]=n[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=Dn()){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStartTime=t,this._group&&this._group.remove(this),this)}resume(t=Dn()){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=Ue){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=Ln.Linear.None){return this._easingFunction=t,this}interpolation(t=Qi.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=Dn(),e=!0){if(this._isPaused)return!0;let n,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(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];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,l=this._chainedTweens.length;o<l;o++)this._chainedTweens[o].start(this._startTime+this._durationTime);return this._isPlaying=!1,!1}return!0}_updateProperties(t,e,n,r){for(const s in n){if(e[s]===void 0)continue;const a=e[s]||0;let o=n[s];const l=Array.isArray(t[s]),h=Array.isArray(o);!l&&h?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],n=this._valuesEnd[t];typeof n=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(n):this._valuesStartRepeat[t]=n,this._valuesEnd[t]=e}};const uy=Or.nextId,fy=Ue.getAll.bind(Ue),dy=Ue.removeAll.bind(Ue),gy=Ue.add.bind(Ue),py=Ue.remove.bind(Ue),my=Ue.update.bind(Ue),vy={Easing:Ln,Group:zf,Interpolation:Qi,now:Dn,Sequence:Or,nextId:uy,Tween:cy,getAll:fy,removeAll:dy,add:gy,remove:py,update:my};class Ta{x;y;vx=0;vy=0;ax=0;ay=0;mass=0;constructor(t,e,n={vx:0,vy:0,ax:0,ay:0,mass:0}){this.x=t,this.y=e,this.vx=n?.vx||0,this.vy=n?.vy||0,this.ax=n?.ax||0,this.ay=n?.ay||0,this.mass=n?.mass||0}distanceTo(t){const e=t.x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)}angleTo(t){const e=t.x-this.x,n=t.y-this.y;return Math.atan2(n,e)}trackVelocity(t,e){return{vx:e.x-t.x,vy:e.y-t.y}}nextFrame(t){const e=t?.gravity??0,n=t?.friction??0;if(this.vx+=this.ax,this.vy+=this.ay,this.vy+=e,n>0){const r=Math.atan2(this.vy,this.vx);let s=Math.sqrt(this.vx*this.vx+this.vy*this.vy);s>n?s-=n: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 n=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+=n,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy};nextFrameSpringTo(t,e){const n=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03;(Array.isArray(t)?t:[t]).forEach(o=>{const l=o.x-this.x,h=o.y-this.y,c=l*s,d=h*s;this.vx+=c,this.vy+=d}),this.vy+=n,this.vx*=r,this.vy*=r,this.x+=this.vx,this.y+=this.vy}nextFrameSpringConnect(t,e){const n=e?.gravity??0,r=e?.friction??.95,s=e?.spring??.03,a=e?.springLength??100,o=this.angleTo(t);this.nextFrameSpringTo(new Ta(t.x-Math.cos(o)*a,t.y-Math.sin(o)*a),{spring:s,friction:r,gravity:n})}}function tn(i,t,e,n,r=!1){return{x:r?i*n+t*e:i*n-t*e,y:r?t*n-i*e:t*n+i*e}}class Wt extends Ta{isMouseDown;radius;constructor(t,e,n){super(t,e,n),this.isMouseDown=n?.isMouseDown??!1,this.radius=n?.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(this.x+(t.x-this.x)/2,this.y+(t.y-this.y)/2)}fromRadian(t,e){return new Wt(Math.cos(t)*e,Math.sin(t)*e)}toArray(){return[this.x,this.y]}clone(t){this.setXY(t.x,t.y)}checkCollisionTo(t){const e=t.x-this.x,n=t.y-this.y;if(Math.sqrt(e*e+n*n)<this.radius+t.radius){const s=Math.atan2(n,e),a=Math.sin(s),o=Math.cos(s),l={x:0,y:0},h=tn(e,n,a,o,!0),c=tn(this.vx,this.vy,a,o,!0),d=tn(t.vx,t.vy,a,o,!0),f=c.x-d.x;c.x=((this.mass-t.mass)*c.x+2*t.mass*d.x)/(this.mass+t.mass),d.x=f+c.x;const u=Math.abs(c.x)+Math.abs(d.x),g=this.radius+t.radius-Math.abs(l.x-h.x);l.x+=c.x/u*g,h.x+=d.x/u*g;const m=tn(l.x,l.y,a,o,!1),y=tn(h.x,h.y,a,o,!1);t.x=this.x+y.x,t.y=this.y+y.y,this.x=this.x+m.x,this.y=this.y+m.y;const x=tn(c.x,c.y,a,o,!1),C=tn(d.x,d.y,a,o,!1);this.vx=x.x,this.vy=x.y,t.vx=C.x,t.vy=C.y}}nextFrameWall(t){const e=t.left,n=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<n&&(this.y=n+this.radius,this.vy*=a)}}let Fr=class go{m;constructor(t=[1,0,0,1,0,0]){this.m=[t[0],t[1],t[2],t[3],t[4],t[5]]}unit(){return this.m=[1,0,0,1,0,0],this}clone(){return new go(this.m)}multiply(t){const e=this.m;let n;t instanceof go?n=t.m:n=t;const r=e[0]*n[0]+e[2]*n[1],s=e[1]*n[0]+e[3]*n[1],a=e[0]*n[2]+e[2]*n[3],o=e[1]*n[2]+e[3]*n[3],l=e[0]*n[4]+e[2]*n[5]+e[4],h=e[1]*n[4]+e[3]*n[5]+e[5];return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=l,e[5]=h,this}inverse(){const t=new go(this.m),e=t.m,n=1/(e[0]*e[3]-e[1]*e[2]),r=e[3]*n,s=-e[1]*n,a=-e[2]*n,o=e[0]*n,l=n*(e[2]*e[5]-e[3]*e[4]),h=n*(e[1]*e[4]-e[0]*e[5]);return e[0]=r,e[1]=s,e[2]=a,e[3]=o,e[4]=l,e[5]=h,t}translate(t,e){return this.multiply([1,0,0,1,t,e])}rotate(t){const e=t*Math.PI/180,n=Math.cos(e),r=Math.sin(e);return this.multiply([n,r,-r,n,0,0])}skew(t,e=0){const n=t*Math.PI/180,r=e*Math.PI/180,s=Math.tan(n),a=Math.tan(r);return this.multiply([1,a,s,1,0,0])}scale(t,e){return this.multiply([t,0,0,e,0,0])}transformPoint(t,e,n=0,r=0){const s=t-n,a=e-r;return t=s*this.m[0]+a*this.m[2]+this.m[4],e=s*this.m[1]+a*this.m[3]+this.m[5],[t+n,e+r]}toString(){return`matrix(${this.m[0]}, ${this.m[1]}, ${this.m[2]}, ${this.m[3]}, ${this.m[4]}, ${this.m[5]})`}};class Pa{x;y;z;constructor(t=[0,0,0],e=[0,0,0]){const[n,r,s]=t,[a,o,l]=e;this.x=n-a,this.y=r-o,this.z=s-l}get length(){const{x:t,y:e,z:n}=this;return Math.sqrt(t*t+e*e+n*n)}unit(){const t=this.length;return new Pa([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,n=this.y,r=this.z,s=t.x,a=t.y,o=t.z;return new Pa([n*o-r*a,r*s-e*o,e*a-s*n])}}let Tl=class extends Ta{width;height;constructor(t,e,n,r=n,s){super(t,e,s),this.width=n,this.height=r}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 Nr{points;constructor(t=[]){this.points=t}toSVGPathData(){const t=[];for(let e=0,n=this.length;e<n;e++)t.push([e===0?"M":"L",this.points[e].x,this.points[e].y]);return t}toSVGPathD(){let t="";for(let e=0,n=this.length;e<n;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,n=t.y,r=this.length;let s=!1;const a=2e-10;for(let o=0,l=r-1;o<r;l=o,o++){const h=this.points[o].x,c=this.points[o].y,d=this.points[l].x,f=this.points[l].y;if(h===e&&c===n||d===e&&f===n||n===c&&n===f)return!0;if(n>=c&&n<f||n<c&&n>=f){const u=(d-h)/(f-c),g=h+u*(n-c);if(g===e||Math.abs(g-e)<a)return!0;g>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,n,r,s=1){const a=new Nr;for(let o=0;o<=s*n;o+=1){const l=Math.floor(o/s)/n*2*Math.PI,h=t+Math.cos(l)*r,c=e+Math.sin(l)*r;a.addPoint(new Wt(h,c))}return a}}function jf(i){return typeof i!="string"?!1:(i=i.trim(),/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(i)&&/[\dz]$/i.test(i)&&i.length>4)}const Pl={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},_y=/([astvzqmhlc])([^astvzqmhlc]*)/gi,yy=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function by(i){const t=i.match(yy);return t?t.map(Number):[]}function Aa(i){const t=[];return i.replace(_y,function(e,n,r){let s=n.toLowerCase();for(r=by(r),s=="m"&&r.length>2&&(t.push([n].concat(r.splice(0,2))),s="l",n=n=="m"?"l":"L");;){if(r.length==Pl[s])return r.unshift(n),t.push(r);if(r.length<Pl[s])throw new Error("malformed path data");t.push([n].concat(r.splice(0,Pl[s])))}}),t}function Ma(i){var t=0,e=0,n=0,r=0;return i.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]+=n,s[7]+=r;break;case"v":s[1]+=r;break;case"h":s[1]+=n;break;default:for(var l=1;l<s.length;)s[l++]+=n,s[l++]+=r}switch(o){case"Z":n=t,r=e;break;case"H":n=s[1];break;case"V":r=s[1];break;case"M":n=t=s[1],r=e=s[2];break;default:n=s[s.length-2],r=s[s.length-1]}return s})}const Ur=Math.PI*2;function Hf(i,t,e,n){const r=i*n-t*e<0?-1:1;let s=i*e+t*n;return s>1&&(s=1),s<-1&&(s=-1),r*Math.acos(s)}function wy(i,t,e,n,r,s,a,o,l,h){const c=h*(i-e)/2+l*(t-n)/2,d=-l*(i-e)/2+h*(t-n)/2,f=a*a,u=o*o,g=c*c,m=d*d;let y=f*u-f*m-u*g;y<0&&(y=0),y/=f*m+u*g,y=Math.sqrt(y)*(r===s?-1:1);const x=y*a/o*d,C=y*-o/a*c,v=h*x-l*C+(i+e)/2,b=l*x+h*C+(t+n)/2,k=(c-x)/a,T=(d-C)/o,R=(-c-x)/a,A=(-d-C)/o,U=Hf(1,0,k,T);let I=Hf(k,T,R,A);return s===0&&I>0&&(I-=Ur),s===1&&I<0&&(I+=Ur),[v,b,U,I]}function xy(i,t){const e=1.3333333333333333*Math.tan(t/4),n=Math.cos(i),r=Math.sin(i),s=Math.cos(i+t),a=Math.sin(i+t);return[n,r,n-r*e,r+n*e,s+a*e,a-s*e,s,a]}function Sy(i,t,e,n,r,s,a,o,l){const h=Math.sin(l*Ur/360),c=Math.cos(l*Ur/360),d=c*(i-e)/2+h*(t-n)/2,f=-h*(i-e)/2+c*(t-n)/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 g=wy(i,t,e,n,r,s,a,o,h,c),m=[];let y=g[2],x=g[3];const C=Math.max(Math.ceil(Math.abs(x)/(Ur/4)),1);x/=C;for(let v=0;v<C;v++)m.push(xy(y,x)),y+=x;return m.map(v=>{for(let b=0;b<v.length;b+=2){let k=v[b+0],T=v[b+1];k*=a,T*=o;const R=c*k-h*T,A=h*k+c*T;v[b+0]=R+g[0],v[b+1]=A+g[1]}return v})}function Gr(i){for(var t,e=[],n=0,r=0,s=0,a=0,o=null,l=null,h=0,c=0,d=0,f=i.length;d<f;d++){var u=i[d],g=u[0];switch(g){case"M":s=u[1],a=u[2];break;case"A":var m=Sy(h,c,u[6],u[7],u[4],u[5],u[1],u[2],u[3]);if(!m.length)continue;m=m.map(b=>{const[k,T,R,A,U,I,N,q]=b;return{x1:R,y1:A,x2:U,y2:I,x:N,y:q}});for(var y=0,x;y<m.length;y++)x=m[y],u=["C",x.x1,x.y1,x.x2,x.y2,x.x,x.y],y<m.length-1&&e.push(u);break;case"S":var C=h,v=c;(t=="C"||t=="S")&&(C+=C-n,v+=v-r),u=["C",C,v,u[1],u[2],u[3],u[4]];break;case"T":t=="Q"||t=="T"?(o=h*2-o,l=c*2-l):(o=h,l=c),u=Vf(h,c,o,l,u[1],u[2]);break;case"Q":o=u[1],l=u[2],u=Vf(h,c,u[1],u[2],u[3],u[4]);break;case"L":u=Ra(h,c,u[1],u[2]);break;case"H":u=Ra(h,c,u[1],c);break;case"V":u=Ra(h,c,h,u[1]);break;case"Z":u=Ra(h,c,s,a);break}t=g,h=u[u.length-2],c=u[u.length-1],u.length>4?(n=u[u.length-4],r=u[u.length-3]):(n=h,r=c),e.push(u)}return e}function Ra(i,t,e,n){return["C",i,t,e,n,e,n]}function Vf(i,t,e,n,r,s){return["C",i/3+2/3*e,t/3+2/3*n,r/3+2/3*e,s/3+2/3*n,r,s]}const Cy=i=>Array.isArray(i);function In(i){if(!(this instanceof In))return new In(i);this._path=Cy(i)?i:Aa(i),this._path=Ma(this._path),this._path=Ey(this._path),this._path=ky(this._path)}In.prototype.at=function(i,t){return this._walk(i,t).pos},In.prototype.length=function(){return this._walk(null).length},In.prototype._walk=function(i,t){let e=[0,0],n=[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],i===0)return{length:s,pos:e}}else if(d[0]==="C"){n[0]=r[0]=e[0],n[1]=r[1]=e[1],n[2]=s;let f=100;for(let u=0;u<=f;u++){let g=u/f,m=a(d,g),y=o(d,g);if(s+=Al(e[0],e[1],m,y),e[0]=m,e[1]=y,typeof i=="number"&&s>=i){let x=(s-i)/(s-n[2]),C=[e[0]*(1-x)+n[0]*x,e[1]*(1-x)+n[1]*x];return{length:s,pos:C}}n[0]=e[0],n[1]=e[1],n[2]=s}}else if(d[0]==="Q"){n[0]=r[0]=e[0],n[1]=r[1]=e[1],n[2]=s;let f=100;for(let u=0;u<=f;u++){let g=u/f,m=l(d,g),y=h(d,g);if(s+=Al(e[0],e[1],m,y),e[0]=m,e[1]=y,typeof i=="number"&&s>=i){let x=(s-i)/(s-n[2]),C=[e[0]*(1-x)+n[0]*x,e[1]*(1-x)+n[1]*x];return{length:s,pos:C}}n[0]=e[0],n[1]=e[1],n[2]=s}}else if(d[0]==="L"){if(n[0]=e[0],n[1]=e[1],n[2]=s,s+=Al(e[0],e[1],d[1],d[2]),e[0]=d[1],e[1]=d[2],typeof i=="number"&&s>=i){let f=(s-i)/(s-n[2]),u=[e[0]*(1-f)+n[0]*f,e[1]*(1-f)+n[1]*f];return{length:s,pos:u}}n[0]=e[0],n[1]=e[1],n[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 l(c,d){return Math.pow(1-d,2)*r[0]+2*(1-d)*d*c[1]+Math.pow(d,2)*c[3]}function h(c,d){return Math.pow(1-d,2)*r[1]+2*(1-d)*d*c[2]+Math.pow(d,2)*c[4]}};function Al(i,t,e,n){let r=i-e,s=t-n;return Math.sqrt(r*r+s*s)}function ky(i){let t,e=0,n=0,r={S:{to:"C",x:3},T:{to:"Q",x:1}};for(let s=0,a=i.length;s<a;s++){let o=i[s],l=r[o[0]];l&&(o[0]=l.to,t&&(t[0]===l.to?(e=2*t[l.x+2]-t[l.x],n=2*t[l.x+3]-t[l.x+1]):(e=t[t.length-2],n=t[t.length-1])),o.splice(1,0,e,n)),t=o}return i}function Ey(i){let t=[],e=["L",0,0],n;for(let r=0,s=i.length;r<s;r++){let a=i[r];switch(a[0]){case"M":e=["L",a[1],a[2]],t.push(a);break;case"Z":t.push(e);break;case"H":n=t[t.length-1]||["L",0,0],t.push(["L",a[1],n[n.length-1]]);break;case"V":n=t[t.length-1]||["L",0,0],t.push(["L",n[n.length-2],a[1]]);break;default:t.push(a)}}return t}const Ml=i=>{if(typeof i=="function"||Object(i)!==i)return i;const t=new i.constructor;for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=Ml(i[e]));return t};function Rl(i){const t=Rl.ps=Rl.ps||{};return t[i]?t[i].sleep=100:t[i]={sleep:100},setTimeout(()=>{for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e!==i&&(t[e].sleep--,t[e].sleep||delete t[e])}),t[i]}function Br(i,t,e,n){return i==null&&(i=t=e=n=0),t==null&&(t=i.y,e=i.width,n=i.height,i=i.x),{x:i,y:t,width:e,w:e,height:n,h:n,x2:i+e,y2:t+n,cx:i+e/2,cy:t+n/2,r1:Math.min(e,n)/2,r2:Math.max(e,n)/2,r0:Math.sqrt(e*e+n*n)/2,path:Ry(i,t,e,n),vb:[i,t,e,n].join(" ")}}function qf(i,t,e,n,r,s,a,o,l){const h=1-l,c=h**3,d=h**2,f=l*l,u=f*l,g=c*i+d*3*l*e+h*3*l*l*r+u*a,m=c*t+d*3*l*n+h*3*l*l*s+u*o,y=i+2*l*(e-i)+f*(r-2*e+i),x=t+2*l*(n-t)+f*(s-2*n+t),C=e+2*l*(r-e)+f*(a-2*r+e),v=n+2*l*(s-n)+f*(o-2*s+n),b=h*i+l*e,k=h*t+l*n,T=h*r+l*a,R=h*s+l*o,A=90-Math.atan2(y-C,x-v)*180/Math.PI;return{x:g,y:m,m:{x:y,y:x},n:{x:C,y:v},start:{x:b,y:k},end:{x:T,y:R},alpha:A}}function Xf(i,t,e,n,r,s,a,o){Array.isArray(i)||(i=[i,t,e,n,r,s,a,o]);const l=Jf(...i);return Br(l.min.x,l.min.y,l.max.x-l.min.x,l.max.y-l.min.y)}function Yf(i,t,e){return t>=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height}function Ty(i,t){i=Br(i),t=Br(t);const{x:e,y:n,width:r,height:s}=i,{x:a,y:o,width:l,height:h}=t,c=e+r/2,d=n+s/2,f=a+l/2,u=o+h/2;return Math.abs(c-f)<=(r+l)/2||Math.abs(d-u)<=(s+h)/2}function Wf(i,t,e,n,r){const s=-3*t+9*e-9*n+3*r,a=i*s+6*t-12*e+6*n;return i*a-3*t+3*e}function Kf(i,t,e,n,r,s,a,o,l){l==null&&(l=1),l=Math.max(0,Math.min(l,1));const h=l/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 g=0;g<c;g++){const m=h*d[g]+h,y=Wf(m,i,e,r,a),x=Wf(m,t,n,s,o),C=y*y+x*x;u+=f[g]*Math.sqrt(C)}return h*u}function Py(i,t,e,n,r,s,a,o){if(Math.max(i,e)<Math.min(r,a)||Math.min(i,e)>Math.max(r,a)||Math.max(t,n)<Math.min(s,o)||Math.min(t,n)>Math.max(s,o))return;const l=(i*n-t*e)*(r-a)-(i-e)*(r*o-s*a),h=(i*n-t*e)*(s-o)-(t-n)*(r*o-s*a),c=(i-e)*(s-o)-(t-n)*(r-a);if(!c)return;const d=l/c,f=h/c,u=Number(d.toFixed(2)),g=Number(f.toFixed(2));if(!(u<Number(Math.min(i,e).toFixed(2))||u>Number(Math.max(i,e).toFixed(2))||u<Number(Math.min(r,a).toFixed(2))||u>Number(Math.max(r,a).toFixed(2))||g<Number(Math.min(t,n).toFixed(2))||g>Number(Math.max(t,n).toFixed(2))||g<Number(Math.min(s,o).toFixed(2))||g>Number(Math.max(s,o).toFixed(2))))return{x:d,y:f}}function Ay(i,t,e){const n=Xf(i),r=Xf(t);if(!Ty(n,r))return e?0:[];const s=Kf.apply(0,i),a=Kf.apply(0,t),o=Math.ceil(s/8),l=Math.ceil(a/8),h=[],c=[],d={};let f=e?0:[];for(let u=0;u<o+1;u++){const g=qf.apply(0,i.concat(u/o));h.push({x:g.x,y:g.y,t:u/o})}for(let u=0;u<l+1;u++){const g=qf.apply(0,t.concat(u/l));c.push({x:g.x,y:g.y,t:u/l})}for(let u=0;u<o;u++)for(let g=0;g<l;g++){const m=h[u],y=h[u+1],x=c[g],C=c[g+1],v=Math.abs(y.x-m.x)<.001?"y":"x",b=Math.abs(C.x-x.x)<.001?"y":"x",k=Py(m.x,m.y,y.x,y.y,x.x,x.y,C.x,C.y);if(k&&d[k.x.toFixed(4)]!==k.y.toFixed(4)){d[k.x.toFixed(4)]=k.y.toFixed(4);const T=m.t+Math.abs((k[v]-m[v])/(y[v]-m[v]))*(y.t-m.t),R=x.t+Math.abs((k[b]-x[b])/(C[b]-x[b]))*(C.t-x.t);T>=0&&T<=1&&R>=0&&R<=1&&(e?f++:f.push({x:k.x,y:k.y,t1:T,t2:R}))}}return f}function Zf(i,t,e){let n,r,s,a,o,l,h,c,d,f,u=e?0:[];for(let g=0,m=i.length;g<m;g++){const y=i[g];if(y[0]==="M")n=o=y[1],r=l=y[2];else{y[0]==="C"?(d=[n,r].concat(y.slice(1)),n=d[6],r=d[7]):(d=[n,r,n,r,o,l,o,l],n=o,r=l);for(let x=0,C=t.length;x<C;x++){const v=t[x];if(v[0]==="M")s=h=v[1],a=c=v[2];else{v[0]==="C"?(f=[s,a].concat(v.slice(1)),s=f[6],a=f[7]):(f=[s,a,s,a,h,c,h,c],s=h,a=c);const b=Ay(d,f,e);if(e)u+=b;else{for(let k=0,T=b.length;k<T;k++)b[k].segment1=g,b[k].segment2=x,b[k].bez1=d,b[k].bez2=f;u=u.concat(b)}}}}}return u}function My(i){const t=Rl(i);if(t.bbox)return Ml(t.bbox);if(!i)return Br();let e=0,n=0,r=[],s=[],a=[];for(let f=0,u=i.length;f<u;f++)if(a=i[f],a[0]==="M")e=a[1],n=a[2],r.push(e),s.push(n);else{const g=Jf(e,n,a[1],a[2],a[3],a[4],a[5],a[6]);r=r.concat(g.min.x,g.max.x),s=s.concat(g.min.y,g.max.y),e=a[5],n=a[6]}const o=Math.min.apply(0,r),l=Math.min.apply(0,s),h=Math.max.apply(0,r),c=Math.max.apply(0,s),d=Br(o,l,h-o,c-l);return t.bbox=Ml(d),d}function Ry(i,t,e,n,r){return r?[["M",Number(i)+Number(r),t],["l",e-r*2,0],["a",r,r,0,0,1,r,r],["l",0,n-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-n],["a",r,r,0,0,1,r,-r],["z"]]:[["M",i,t],["l",e,0],["l",0,n],["l",-e,0],["z"]]}function Jf(i,t,e,n,r,s,a,o){const l=[],h=[[],[]];let c,d,f,u,g,m,y,x;for(let k=0;k<2;++k){if(k===0?(d=6*i-12*e+6*r,c=-3*i+9*e-9*r+3*a,f=3*e-3*i):(d=6*t-12*n+6*s,c=-3*t+9*n-9*s+3*o,f=3*n-3*t),Math.abs(c)<1e-12){if(Math.abs(d)<1e-12)continue;u=-f/d,u>0&&u<1&&l.push(u);continue}y=d*d-4*f*c,x=Math.sqrt(y),!(y<0)&&(g=(-d+x)/(2*c),g>0&&g<1&&l.push(g),m=(-d-x)/(2*c),m>0&&m<1&&l.push(m))}let C=l.length,v;const b=C;for(;C--;)u=l[C],v=1-u,h[0][C]=v*v*v*i+3*v*v*u*e+3*v*u*u*r+u*u*u*a,h[1][C]=v*v*v*t+3*v*v*u*n+3*v*u*u*s+u*u*u*o;return h[0][b]=i,h[1][b]=t,h[0][b+1]=a,h[1][b+1]=o,h[0].length=h[1].length=b+2,{min:{x:Math.min.apply(0,h[0]),y:Math.min.apply(0,h[1])},max:{x:Math.max.apply(0,h[0]),y:Math.max.apply(0,h[1])}}}function Ly(i,t,e){const n=My(i);return console.log(n),!(!Yf(n,t,e)||(console.log(Yf(n,t,e)),console.log(Zf(i,Gr([["M",t,e],["H",n.x2+10]]),1)%2!==1),Zf(i,Gr([["M",t,e],["H",n.x2+10]]),1)%2!==1))}const Ll=new Map;function Qf(i){if(Ll.has(i))return Ll.get(i);const t=In(i);return Ll.set(i,t),t}function t0(i){const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d",i),t}function e0(i,t){return Ys?t0(i).getTotalLength(t):Qf(i).length()}function i0(i,t){if(Ys)return t0(i).getPointAtLength(t);{const e=Qf(i),[n,r]=e.at(t);return{x:n,y:r}}}let Ge=null;function n0(i,t,e){if(Ys){Ge||(Ge=document.createElement("canvas").getContext("2d"));const n=new Path2D(i);return Ge.isPointInPath(n,t,e)}else return Ly(i,t,e)}function r0(i,t,e,{lineWidth:n=1,lineCap:r="butt",lineJoin:s="miter"}){if(Ys){if(Ge||(Ge=document.createElement("canvas").getContext("2d")),Ge.isPointInStroke){Ge.save(),Ge.lineWidth=n,Ge.lineCap=r,Ge.lineJoin=s;const a=new Path2D(i),o=Ge.isPointInStroke(a,t,e);return Ge.restore(),o}}else return null}function Dy(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var s0={},Dl={exports:{}},a0;function Iy(){return a0||(a0=1,function(i){(function(t){var e="0.4.0",n="hasOwnProperty",r=/[\.\/]/,s="*",a=function(){},o=function(f,u){return f-u},l,h,c={n:{}},d=function(f,u){var g=h,m=Array.prototype.slice.call(arguments,2),y=d.listeners(f),x=0,C,v=[],b={},k=[];l=f,h=0;for(var T=0,R=y.length;T<R;T++)"zIndex"in y[T]&&(v.push(y[T].zIndex),y[T].zIndex<0&&(b[y[T].zIndex]=y[T]));for(v.sort(o);v[x]<0;)if(C=b[v[x++]],k.push(C.apply(u,m)),h)return h=g,k;for(T=0;T<R;T++)if(C=y[T],"zIndex"in C)if(C.zIndex==v[x]){if(k.push(C.apply(u,m)),h)return h=g,k;do if(x++,C=b[v[x]],C&&k.push(C.apply(u,m)),h)return h=g,k;while(C)}else b[C.zIndex]=C;else if(k.push(C.apply(u,m)),h)return h=g,k;return h=g,k.length?k:null};d.listeners=function(f){var u=f.split(r),g=c,m,y,x,C,v,b,k,T,R=[g],A=[];for(C=0,v=u.length;C<v;C++){for(T=[],b=0,k=R.length;b<k;b++)for(g=R[b].n,y=[g[u[C]],g[s]],x=2;x--;)m=y[x],m&&(T.push(m),A=A.concat(m.f||[]));R=T}return A},d.on=function(f,u){for(var g=f.split(r),m=c,y=0,x=g.length;y<x;y++)m=m.n,!m[g[y]]&&(m[g[y]]={n:{}}),m=m[g[y]];for(m.f=m.f||[],y=0,x=m.f.length;y<x;y++)if(m.f[y]==u)return a;return m.f.push(u),function(C){+C==+C&&(u.zIndex=+C)}},d.stop=function(){h=1},d.nt=function(f){return f?new RegExp("(?:\\.|\\/|^)"+f+"(?:\\.|\\/|$)").test(l):l},d.unbind=function(f,u){var g=f.split(r),m,y,x,C,v,b,k,T=[c];for(C=0,v=g.length;C<v;C++)for(b=0;b<T.length;b+=x.length-2){if(x=[b,1],m=T[b].n,g[C]!=s)m[g[C]]&&x.push(m[g[C]]);else for(y in m)m[n](y)&&x.push(m[y]);T.splice.apply(T,x)}for(C=0,v=T.length;C<v;C++)for(m=T[C];m.n;){if(u){if(m.f){for(b=0,k=m.f.length;b<k;b++)if(m.f[b]==u){m.f.splice(b,1);break}!m.f.length&&delete m.f}for(y in m.n)if(m.n[n](y)&&m.n[y].f){var R=m.n[y].f;for(b=0,k=R.length;b<k;b++)if(R[b]==u){R.splice(b,1);break}!R.length&&delete m.n[y].f}}else{delete m.f;for(y in m.n)m.n[n](y)&&m.n[y].f&&delete m.n[y].f}m=m.n}},d.once=function(f,u){var g=function(){u.apply(this,arguments),d.unbind(f,g)};return d.on(f,g)},d.version=e,d.toString=function(){return"You are running Eve "+e},i.exports?i.exports=d:t.eve=d})(Ho)}(Dl)),Dl.exports}(function(i){if(typeof Dy=="function")var t=Iy();(function(){function e(f){var u=function(g){u.parse(g)};return u.mode="text",u.type=String(f||"html").toLowerCase(),u.textchunk="",u.raw="",u.parse=l,u.on=a,u.event=s,u.end=r,u}function n(f,u,g){f==`
|
|
25
|
+
`&&this.event("newline"),d[this.mode].call(this,f,u,g)}function r(){n.call(this,"eof"),this.event("eof")}function s(f,u,g){typeof t=="function"&&t("elemental."+f+"."+u,null,u,g||"",this.raw);for(var m=this.events&&this.events[f],y=m&&m.length;y--;)try{this.events[f][y](u,g||"",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 l(f){f=f||Object(f);for(var u=1,g=f.length+1,m,y,x=o(f,0);u<g;u++)m=y,y=x,x=o(f,u),this.raw+=y,n.call(this,y,x,m);this._beforeEnd=function(){n.call(this,"","",y)}}var h=/[\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,g){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,g){if(g=="!"&&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,g){g=="]"&&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,g){this.event("cdata",this.textchunk),this.textchunk="",this.mode="text"},"comment start":function(f,u,g){u==">"||f=="eof"?(this.event("comment",""),this.mode="comment instant end"):this.mode="comment"},"comment instant end":function(f,u,g){this.mode="text"},comment:function(f,u,g){f=="-"&&g=="-"&&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,g){this.event("comment",this.textchunk),this.textchunk="",this.mode="text"},declaration:function(f,u,g){f=="?"&&u==">"?this.mode="declaration end":(f=="eof"&&this.event("comment",this.textchunk),this.textchunk+=f)},"declaration end":function(f,u,g){this.event("comment",this.textchunk),this.textchunk="",this.mode="text"},"tag name start":function(f,u,g){if(f=="eof")this.event("text","<");else if(!h.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,g)}},"close tag name start":function(f,u,g){h.test(f)||(this.mode="close tag name",this.tagname="",this.nodename="",d[this.mode].call(this,f,u,g))},"close tag name":function(f,u,g){if(h.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,g){if(h.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,g){h.test(f)||(this.mode="attr",this.nodename="",d[this.mode].call(this,f,u,g))},attr:function(f,u,g){if(h.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,g){if(!h.test(f)){if(this.mode="attr value",this.quote=!1,f=="'"||f=='"'){this.quote=f;return}d[this.mode].call(this,f,u,g)}},"attr value":function(f,u,g){if(h.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&&g!="\\"&&(this.mode="attr start");break;default:this.attr[this.nodename]+=f}}};e.version="0.2.1",i.elemental=e,i.eve=t})()})(s0);const o0=Pe(s0),Rt=o0.eve,Oy=o0.elemental,Il={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};let $r;const On=$r={angle:function(i,t,e,n,r,s){if(r==null){const a=i-e,o=t-n;return!a&&!o?0:(180+Math.atan2(-o,-a)*180/Math.PI+360)%360}else return On.angle(i,t,r,s)-On.angle(e,n,r,s)},rad:function(i){return i%360*Math.PI/180},deg:function(i){return i*180/Math.PI%360},matrix:function(i,t,e,n,r,s){return new zr(i,t,e,n,r,s)}};function zr(i,t,e,n,r,s){i!=null?(this.a=+i,this.b=+t,this.c=+e,this.d=+n,this.e=+r,this.f=+s):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}(function(i){i.add=function(n,r,s,a,o,l){var h=[[],[],[]],c=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],d=[[n,s,o],[r,a,l],[0,0,1]],f,u,g,m;for(n&&n instanceof zr&&(d=[[n.a,n.c,n.e],[n.b,n.d,n.f],[0,0,1]]),f=0;f<3;f++)for(u=0;u<3;u++){for(m=0,g=0;g<3;g++)m+=c[f][g]*d[g][u];h[f][u]=m}this.a=h[0][0],this.b=h[1][0],this.c=h[0][1],this.d=h[1][1],this.e=h[0][2],this.f=h[1][2]},i.invert=function(){var n=this,r=n.a*n.d-n.b*n.c;return new zr(n.d/r,-n.b/r,-n.c/r,n.a/r,(n.c*n.f-n.d*n.e)/r,(n.b*n.e-n.a*n.f)/r)},i.clone=function(){return new zr(this.a,this.b,this.c,this.d,this.e,this.f)},i.translate=function(n,r){this.add(1,0,0,1,n,r)},i.scale=function(n,r,s,a){r==null&&(r=n),(s||a)&&this.add(1,0,0,1,s,a),this.add(n,0,0,r,0,0),(s||a)&&this.add(1,0,0,1,-s,-a)},i.rotate=function(n,r,s){n=$r.rad(n),r=r||0,s=s||0;var a=+Math.cos(n).toFixed(9),o=+Math.sin(n).toFixed(9);this.add(a,o,-o,a,r,s),this.add(1,0,0,1,-r,-s)},i.x=function(n,r){return n*this.a+r*this.c+this.e},i.y=function(n,r){return n*this.b+r*this.d+this.f},i.get=function(n){return+this[String.fromCharCode(97+n)].toFixed(4)},i.toString=function(){return $r.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()},i.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')"},i.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]};function t(n){return n[0]*n[0]+n[1]*n[1]}function e(n){var r=Math.sqrt(t(n));n[0]&&(n[0]/=r),n[1]&&(n[1]/=r)}i.split=function(){var n={};n.dx=this.e,n.dy=this.f;var r=[[this.a,this.c],[this.b,this.d]];n.scalex=Math.sqrt(t(r[0])),e(r[0]),n.shear=r[0][0]*r[1][0]+r[0][1]*r[1][1],r[1]=[r[1][0]-r[0][0]*n.shear,r[1][1]-r[0][1]*n.shear],n.scaley=Math.sqrt(t(r[1])),e(r[1]),n.shear/=n.scaley;var s=-r[0][1],a=r[1][1];return a<0?(n.rotate=$r.deg(Math.acos(a)),s<0&&(n.rotate=360-n.rotate)):n.rotate=$r.deg(Math.asin(s)),n.isSimple=!+n.shear.toFixed(9)&&(n.scalex.toFixed(9)==n.scaley.toFixed(9)||!n.rotate),n.isSuperSimple=!+n.shear.toFixed(9)&&n.scalex.toFixed(9)==n.scaley.toFixed(9)&&!n.rotate,n.noRotation=!+n.shear.toFixed(9)&&!n.rotate,n},i.toTransformString=function(n){var r=n||this.split();return r.isSimple?(r.scalex=+r.scalex.toFixed(4),r.scaley=+r.scaley.toFixed(4),r.rotate=+r.rotate.toFixed(4),(r.dx&&r.dy?"t"+[r.dx,r.dy]:"")+(r.scalex!=1||r.scaley!=1?"s"+[r.scalex,r.scaley,0,0]:"")+(r.rotate?"r"+[r.rotate,0,0]:"")):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}})(zr.prototype);function Fy(i){const t=On.matrix(),e=/\s+,?\s*|,\s*/;return(i+"").replace(/([a-z]+)\(([^)]+)\)(?:\s+,?\s*|,\s*|$)/gi,function(n,r,s){switch(s=s.split(e),r.toLowerCase()){case"translate":t.add(1,0,0,1,s[0],s[1]);break;case"scale":t.add(s[0],0,0,s[1],0,0);break;case"rotate":t.rotate(s[0],s[1],s[2]);break;case"skewx":t.add(1,0,Math.tan(On.rad(s[0])),1,0,0);break;case"skewy":t.add(1,Math.tan(On.rad(s[0])),0,1,0,0);break;case"matrix":t.add(s[0],s[1],s[2],s[3],s[4],s[5]);break}}),t.toTransformString()}function l0(i,t,e){for(var n=(i+"").split(";"),r=/^\s+|\s+$/g,s,a=0,o=n.length;a<o;a++){var l=n[a].split(":");s=l[0].replace(r,"").replace(/[A-Z]/g,function(h){return"-"+h.toLowerCase()}),(!e||s in e)&&(t[s]=l[1].replace(r,""),e&&!e[s]&&(t[s]=parseFloat(t[s])))}}function h0(i){const t=Oy(),e=[],n=[],r={};let s,a,o;function l(h,c){return function(d,f){const u={type:c||h,fill:"#000",stroke:"none"};e.push(u);for(let g in f)Object.prototype.hasOwnProperty.call(f,g)&&Rt("rappar."+h+".attr."+g,u,f[g],g);Rt("rappar."+h+".attrend",u,f)}}return Rt.on("rappar.polygon.attr.points",function(h){this.path="M"+h+"z",Rt.stop()}),Rt.on("rappar.image.attr.xlink:href",function(h){this.src=h,Rt.stop()}),Rt.on("rappar.path.attr.d",function(h){this.path=h,Rt.stop()}),Rt.on("rappar.*.attr.transform",function(h){this.transform=Fy(h),Rt.stop()}),Rt.on("rappar.*.attr.fill",function(h){var c=h.match(/url\(#([^)]+)\)/),d=this;c&&(c=c[1],r[c]?this.fill=r[c]:Rt.on("rappar.found."+c,function(f){d.fill=f}),Rt.stop())}),Rt.on("rappar.line.attrend",function(h){this.path="M"+[h.x1,h.y1,h.x2,h.y2]}),Rt.on("rappar.*.attrend",function(){for(var h=n.length;h--;)if(n[h]!=this)for(var c in n[h])c=="transform"&&this.transform?this.transform=n[h].transform+this.transform:this[c]=n[h][c]}),Rt.on("rappar.*.attr.style",function(h){var c=function(){l0(h,this,Il),Rt.unbind("rappar.*.attrend",c)};Rt.on("rappar.*.attrend",c),Rt.stop()}),Rt.on("rappar.*.attr.*",function(h,c){c in Il&&(this[c]=Il[c]?h:parseFloat(h))}),Rt.on("elemental.tag.circle",l("circle")),Rt.on("elemental.tag.ellipse",l("ellipse")),Rt.on("elemental.tag.polygon",l("polygon","path")),Rt.on("elemental.tag.path",l("path")),Rt.on("elemental.tag.line",l("line","path")),Rt.on("elemental.tag.rect",l("rect")),Rt.on("elemental.tag.image",l("image")),Rt.on("elemental.tag.text",l("text")),Rt.on("rappar.text.attrend",function(){s="",a=this,this["text-anchor"]=this["text-anchor"]||"start"}),Rt.on("elemental.text",function(h,c,d){a&&(s+=d)}),Rt.on("elemental./tag.text",function(){a.text=s,a=null}),Rt.on("elemental.tag.g",function(h,c){var d={};n.push(d);for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&Rt("rappar.g.attr."+f,d,c[f],f);Rt("rappar.g.attrend",d)}),Rt.on("elemental./tag.g",function(h,c){n.pop()}),Rt.on("elemental.tag.linearGradient",function(h,c){o={id:c.id,angle:+(360+On.angle(c.x1,c.y1,c.x2,c.y2,c.x1+100,c.y1)).toFixed(2),stops:[]}}),Rt.on("elemental./tag.linearGradient",function(){for(var h=[o.angle],c,d=0,f=o.stops.length;d<f;d++)c=o.stops[d],d&&d!=f-1?h.push(c.color+":"+c.offset):h.push(c.color);r[o.id]=h.join("-"),Rt("rappar.found."+o.id,null,r[o.id])}),Rt.on("elemental.tag.radialGradient",function(h,c){o={id:c.id,stops:[]}}),Rt.on("elemental./tag.radialGradient",function(){for(var h=[],c,d=0,f=o.stops.length;d<f;d++)c=o.stops[d],d&&d!=f-1?h.push(c.color+":"+c.offset):h.push(c.color);r[o.id]="r"+h.join("-"),Rt("rappar.found."+o.id,null,r[o.id])}),Rt.on("elemental.tag.stop",function(h,c){var d={};c.style&&l0(c.style,d),d.offset=d.offset||c.offset,d.color=d["stop-color"]||c["stop-color"],d.opacity=d["stop-opacity"]||c["stop-opacity"],~(d.offset+"").indexOf("%")?d.offset=parseFloat(d.offset):d.offset=parseFloat(d.offset)*100,d.offset=+d.offset.toFixed(2),o.stops.push(d)}),t(i),t.end(),e}function Ny(i){return i*Math.PI/180}function Uy(i){return i*180/Math.PI}function Gy(i,t,e,n){const r=i-e,s=t-n;return Math.sqrt(r*r+s*s)}let c0=class Sg{point;constructor(t,e){this.point=new Wt(t,e)}static fromSVGPathData(t){if(t.length<3)throw new Error("Line 参数个数错误");if(t[0].toUpperCase()!=="L")throw new Error("Line command 错误");return new Sg(t[1],t[2])}toSVGPathData(){return["L",this.point.x,this.point.y]}toSVGPathD(){return"L "+this.point.toSVGPathD()}},u0=class Cg extends c0{rx;ry;xAxisRotate;largeArcFlag;sweepFlag;constructor(t,e,n,r,s){super(t,e),this.rx=n,this.ry=r,this.xAxisRotate=s?.xAxisRotate??0,this.largeArcFlag=s?.largeArcFlag??1,this.sweepFlag=s?.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 Cg(t[6],t[7],t[1],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 jr extends c0{ctrlPoints=[];constructor(t,e,n,r,s,a){super(s,a),this.ctrlPoints.push(new Wt(t,e)),this.ctrlPoints.push(new Wt(n,r))}static fromSVGPathData(t){if(t.length<7)throw new Error("CubicBezier 参数个数错误");if(t[0].toUpperCase()!=="C")throw new Error("CubicBezier command 错误");return new jr(t[1],t[2],t[3],t[4],t[5],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()}`}}class en{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){this.startPoint=new Wt(t,e)}addLine(t){this.lines.push(t)}normalize(){let t=this.lines.reduce((n,r)=>(n+=r.toSVGPathD(),n),"");this.startPoint&&(t="M "+this.startPoint.toSVGPathD()+t),this.isClosed&&(t+="Z"),this.normalizedLines=[];const e=Gr(Ma(Aa(t)));for(let n=0,r=e.length;n<r;n++){const s=e[n];if(n==0&&s[0]=="M"){this.setStartPoint(s[1],s[2]);continue}if(n==r-1&&s[0]=="Z"){this.isClosed=!0;continue}this.normalizedLines.push(jr.fromSVGPathData(s))}}static fromSVGPathData(t){const e=new en;for(let n=0,r=t.length;n<r;n++){const s=t[n],a=s[0];if(n==0&&a=="M"){e.setStartPoint(s[1],s[2]);continue}if(n==r-1&&a=="Z"){e.isClosed=!0;continue}e.addLine(new jr(s[1],s[2],s[3],s[4],s[5],s[6]))}return e.normalize(),e}static fromSVGPathD(t){if(!jf(t))throw new Error("Not an SVG path!");const e=Gr(Ma(Aa(t)));return en.fromSVGPathData(e)}toSVGPathD(){let t="";this.startPoint&&(t+="M "+this.startPoint.toSVGPathD());for(let e=0,n=this.normalizedLines.length;e<n;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,n=this.normalizedLines.length;e<n;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(),e.forEach(n=>{const[r,...s]=n.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,n=this.normalizedLines.length;e<n;e++){const r=this.normalizedLines[e],s=[...r.ctrlPoints,r.point];for(let a=0;a<s.length;a++){const o=s[a].x,l=s[a].y;o<t[0]&&(t[0]=o),l<t[1]&&(t[1]=l),o>t[2]&&(t[2]=o),l>t[3]&&(t[3]=l)}}}return t}get size(){const t=this.bounds;return[t[2]-t[0],t[3]-t[1]]}get center(){const[t,e,n,r]=this.bounds;return[(t+n)/2,(e+r)/2]}getTotalLength(){return e0(this.toSVGPathD())}getPointAtLength(t){return i0(this.toSVGPathD(),t)}isPointInPath(t,e){return n0(this.toSVGPathD(),t,e)}isPointInStroke(t,e,n={lineWidth:1,lineCap:"butt",lineJoin:"miter"}){return r0(this.toSVGPathD(),t,e,n)}transform(t,e=0,n=0){if(this.startPoint){const[r,s]=t.transformPoint(this.startPoint.x,this.startPoint.y,e,n);this.setStartPoint(r,s)}return this.normalizedLines=this.normalizedLines.map(r=>{const[s,...a]=r.toSVGPathData(),o=[s];for(let l=0,h=a.length;l<h;l+=2){const c=a[l],d=a[l+1],[f,u]=t.transformPoint(c,d,e,n);o.push(f,u)}return jr.fromSVGPathData(o)}),this}translate(t,e){const n=new Fr().translate(t,e);return this.transform(n)}rotate(t,e=0,n=0){const r=new Fr().rotate(t);return this.transform(r,e,n)}scale(t,e=t,n=0,r=0){const s=new Fr().scale(t,e);return this.transform(s,n,r)}skew(t,e=0,n=0,r=0){const s=new Fr().skew(t,e);return this.transform(s,n,r)}trim(){const[t,e]=this.bounds;return this.translate(-t,-e),this}static generateRosetta(t,e,n,r,s){if(s==0)throw new Error("no dividing by zero, please");const a=new en;a.setStartPoint(t,e);const o=360/s;for(let l=0;l<s;l+=1){const h=o*l*Math.PI/180,c=t+2*n*Math.cos(h),d=e+2*n*Math.sin(h);a.addLine(new u0(c,d,n,r,{xAxisRotate:o*l,largeArcFlag:1,sweepFlag:1})),a.addLine(new u0(t,e,n,r,{xAxisRotate:o*l,largeArcFlag:1,sweepFlag:1}))}return a.normalize(),a}}var f0={exports:{}};(function(i,t){(function(e,n){i.exports=n()})(window,function(){return function(e){var n={};function r(s){if(n[s])return n[s].exports;var a=n[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=n,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 l in s)r.d(o,l,function(h){return s[h]}.bind(null,l));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,n,r){var s,a;s=[r(2)],(a=function(o){function l(p){if(l.is(p,"function"))return h?p():o.on("raphael.DOMload",p);if(l.is(p,_t))return l._engine.create[C](l,p.splice(0,3+l.is(p[0],dt))).add(p);var _=Array.prototype.slice.call(arguments,0);if(l.is(_[_.length-1],"function")){var w=_.pop();return h?w.call(l._engine.create[C](l,_)):o.on("raphael.DOMload",function(){w.call(l._engine.create[C](l,_))})}return l._engine.create[C](l,arguments)}l.version="2.3.0",l.eve=o;var h,c,d=/[, ]+/,f={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},u=/\{(\d+)\}/g,g="hasOwnProperty",m={doc:document,win:window},y={was:Object.prototype[g].call(m.win,"Raphael"),is:m.win.Raphael},x=function(){this.ca=this.customAttributes={}},C="apply",v="concat",b="ontouchstart"in window||window.TouchEvent||window.DocumentTouch&&document instanceof DocumentTouch,k="",T=" ",R=String,A="split",U="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[A](T),I={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},N=R.prototype.toLowerCase,q=Math,W=q.max,K=q.min,it=q.abs,pt=q.pow,vt=q.PI,dt="number",_t="array",yt=Object.prototype.toString,L=(l._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),M={NaN:1,Infinity:1,"-Infinity":1},E=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,F=q.round,z=parseFloat,Y=parseInt,D=R.prototype.toUpperCase,V=l._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=l._availableAnimAttrs={blur:dt,"clip-rect":"csv",cx:dt,cy:dt,fill:"colour","fill-opacity":dt,"font-size":dt,height:dt,opacity:dt,path:"path",r:dt,rx:dt,ry:dt,stroke:"colour","stroke-opacity":dt,"stroke-width":dt,transform:"transform",width:dt,x:dt,y:dt},tt=/[\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]*/,at={hs:1,rg:1},gt=/,?([achlmqrstvxz]),?/gi,Ct=/([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,bt=/(-?\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,Nt=(l._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]*([^\)]+?)\))?/,{}),Lt=function(p,_){return z(p)-z(_)},Dt=function(p){return p},Et=l._rectPath=function(p,_,w,S,P){return P?[["M",p+P,_],["l",w-2*P,0],["a",P,P,0,0,1,P,P],["l",0,S-2*P],["a",P,P,0,0,1,-P,P],["l",2*P-w,0],["a",P,P,0,0,1,-P,-P],["l",0,2*P-S],["a",P,P,0,0,1,P,-P],["z"]]:[["M",p,_],["l",w,0],["l",0,S],["l",-w,0],["z"]]},le=function(p,_,w,S){return S==null&&(S=w),[["M",p,_],["m",0,-S],["a",w,S,0,1,1,0,2*S],["a",w,S,0,1,1,0,-2*S],["z"]]},re=l._getPath={path:function(p){return p.attr("path")},circle:function(p){var _=p.attrs;return le(_.cx,_.cy,_.r)},ellipse:function(p){var _=p.attrs;return le(_.cx,_.cy,_.rx,_.ry)},rect:function(p){var _=p.attrs;return Et(_.x,_.y,_.width,_.height,_.r)},image:function(p){var _=p.attrs;return Et(_.x,_.y,_.width,_.height)},text:function(p){var _=p._getBBox();return Et(_.x,_.y,_.width,_.height)},set:function(p){var _=p._getBBox();return Et(_.x,_.y,_.width,_.height)}},fe=l.mapPath=function(p,_){if(!_)return p;var w,S,P,O,B,G,$;for(P=0,B=(p=Hs(p)).length;P<B;P++)for(O=1,G=($=p[P]).length;O<G;O+=2)w=_.x($[O],$[O+1]),S=_.y($[O],$[O+1]),$[O]=w,$[O+1]=S;return p};if(l._g=m,l.type=m.win.SVGAngle||m.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML",l.type=="VML"){var qt,De=m.doc.createElement("div");if(De.innerHTML='<v:shape adj="1"/>',(qt=De.firstChild).style.behavior="url(#default#VML)",!qt||typeof qt.adj!="object")return l.type=k;De=null}function Ce(p){if(typeof p=="function"||Object(p)!==p)return p;var _=new p.constructor;for(var w in p)p[g](w)&&(_[w]=Ce(p[w]));return _}l.svg=!(l.vml=l.type=="VML"),l._Paper=x,l.fn=c=x.prototype=l.prototype,l._id=0,l.is=function(p,_){return(_=N.call(_))=="finite"?!M[g](+p):_=="array"?p instanceof Array:_=="null"&&p===null||_==typeof p&&p!==null||_=="object"&&p===Object(p)||_=="array"&&Array.isArray&&Array.isArray(p)||yt.call(p).slice(8,-1).toLowerCase()==_},l.angle=function(p,_,w,S,P,O){if(P==null){var B=p-w,G=_-S;return B||G?(180+180*q.atan2(-G,-B)/vt+360)%360:0}return l.angle(p,_,P,O)-l.angle(w,S,P,O)},l.rad=function(p){return p%360*vt/180},l.deg=function(p){return Math.round(180*p/vt%360*1e3)/1e3},l.snapTo=function(p,_,w){if(w=l.is(w,"finite")?w:10,l.is(p,_t)){for(var S=p.length;S--;)if(it(p[S]-_)<=w)return p[S]}else{var P=_%(p=+p);if(P<w)return _-P;if(P>p-w)return _-P+p}return _};var Ni,Bs;l.createUUID=(Ni=/[xy]/g,Bs=function(p){var _=16*q.random()|0;return(p=="x"?_:3&_|8).toString(16)},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(Ni,Bs).toUpperCase()}),l.setWindow=function(p){o("raphael.setWindow",l,m.win,p),m.win=p,m.doc=m.win.document,l._engine.initWin&&l._engine.initWin(m.win)};var Ui=function(p){if(l.vml){var _,w=/^\s+|\s+$/g;try{var S=new ActiveXObject("htmlfile");S.write("<body>"),S.close(),_=S.body}catch{_=createPopup().document.body}var P=_.createTextRange();Ui=be(function(B){try{_.style.color=R(B).replace(w,k);var G=P.queryCommandValue("ForeColor");return"#"+("000000"+(G=(255&G)<<16|65280&G|(16711680&G)>>>16).toString(16)).slice(-6)}catch{return"none"}})}else{var O=m.doc.createElement("i");O.title="Raphaël Colour Picker",O.style.display="none",m.doc.body.appendChild(O),Ui=be(function(B){return O.style.color=B,m.doc.defaultView.getComputedStyle(O,k).getPropertyValue("color")})}return Ui(p)},qn=function(){return"hsb("+[this.h,this.s,this.b]+")"},Xn=function(){return"hsl("+[this.h,this.s,this.l]+")"},$s=function(){return this.hex},Yn=function(p,_,w){if(_==null&&l.is(p,"object")&&"r"in p&&"g"in p&&"b"in p&&(w=p.b,_=p.g,p=p.r),_==null&&l.is(p,"string")){var S=l.getRGB(p);p=S.r,_=S.g,w=S.b}return(p>1||_>1||w>1)&&(p/=255,_/=255,w/=255),[p,_,w]},ao=function(p,_,w,S){var P={r:p*=255,g:_*=255,b:w*=255,hex:l.rgb(p,_,w),toString:$s};return l.is(S,"finite")&&(P.opacity=S),P};function be(p,_,w){return function S(){var P=Array.prototype.slice.call(arguments,0),O=P.join("␀"),B=S.cache=S.cache||{},G=S.count=S.count||[];return B[g](O)?(function($,H){for(var J=0,ot=$.length;J<ot;J++)if($[J]===H)return $.push($.splice(J,1)[0])}(G,O),w?w(B[O]):B[O]):(G.length>=1e3&&delete B[G.shift()],G.push(O),B[O]=p[C](_,P),w?w(B[O]):B[O])}}l.color=function(p){var _;return l.is(p,"object")&&"h"in p&&"s"in p&&"b"in p?(_=l.hsb2rgb(p),p.r=_.r,p.g=_.g,p.b=_.b,p.hex=_.hex):l.is(p,"object")&&"h"in p&&"s"in p&&"l"in p?(_=l.hsl2rgb(p),p.r=_.r,p.g=_.g,p.b=_.b,p.hex=_.hex):(l.is(p,"string")&&(p=l.getRGB(p)),l.is(p,"object")&&"r"in p&&"g"in p&&"b"in p?(_=l.rgb2hsl(p),p.h=_.h,p.s=_.s,p.l=_.l,_=l.rgb2hsb(p),p.v=_.b):(p={hex:"none"}).r=p.g=p.b=p.h=p.s=p.v=p.l=-1),p.toString=$s,p},l.hsb2rgb=function(p,_,w,S){var P,O,B,G,$;return this.is(p,"object")&&"h"in p&&"s"in p&&"b"in p&&(w=p.b,_=p.s,S=p.o,p=p.h),G=($=w*_)*(1-it((p=(p*=360)%360/60)%2-1)),P=O=B=w-$,ao(P+=[$,G,0,0,G,$][p=~~p],O+=[G,$,$,G,0,0][p],B+=[0,0,G,$,$,G][p],S)},l.hsl2rgb=function(p,_,w,S){var P,O,B,G,$;return this.is(p,"object")&&"h"in p&&"s"in p&&"l"in p&&(w=p.l,_=p.s,p=p.h),(p>1||_>1||w>1)&&(p/=360,_/=100,w/=100),G=($=2*_*(w<.5?w:1-w))*(1-it((p=(p*=360)%360/60)%2-1)),P=O=B=w-$/2,ao(P+=[$,G,0,0,G,$][p=~~p],O+=[G,$,$,G,0,0][p],B+=[0,0,G,$,$,G][p],S)},l.rgb2hsb=function(p,_,w){var S,P;return p=(w=Yn(p,_,w))[0],_=w[1],w=w[2],{h:(((P=(S=W(p,_,w))-K(p,_,w))==0?null:S==p?(_-w)/P:S==_?(w-p)/P+2:(p-_)/P+4)+360)%6*60/360,s:P==0?0:P/S,b:S,toString:qn}},l.rgb2hsl=function(p,_,w){var S,P,O,B;return p=(w=Yn(p,_,w))[0],_=w[1],w=w[2],S=((P=W(p,_,w))+(O=K(p,_,w)))/2,{h:(((B=P-O)==0?null:P==p?(_-w)/B:P==_?(w-p)/B+2:(p-_)/B+4)+360)%6*60/360,s:B==0?0:S<.5?B/(2*S):B/(2-2*S),l:S,toString:Xn}},l._path2string=function(){return this.join(",").replace(gt,"$1")},l._preload=function(p,_){var w=m.doc.createElement("img");w.style.cssText="position:absolute;left:-9999em;top:-9999em",w.onload=function(){_.call(this),this.onload=null,m.doc.body.removeChild(this)},w.onerror=function(){m.doc.body.removeChild(this)},m.doc.body.appendChild(w),w.src=p};function Gi(){return this.hex}function Wn(p,_){for(var w=[],S=0,P=p.length;P-2*!_>S;S+=2){var O=[{x:+p[S-2],y:+p[S-1]},{x:+p[S],y:+p[S+1]},{x:+p[S+2],y:+p[S+3]},{x:+p[S+4],y:+p[S+5]}];_?S?P-4==S?O[3]={x:+p[0],y:+p[1]}:P-2==S&&(O[2]={x:+p[0],y:+p[1]},O[3]={x:+p[2],y:+p[3]}):O[0]={x:+p[P-2],y:+p[P-1]}:P-4==S?O[3]=O[2]:S||(O[0]={x:+p[S],y:+p[S+1]}),w.push(["C",(-O[0].x+6*O[1].x+O[2].x)/6,(-O[0].y+6*O[1].y+O[2].y)/6,(O[1].x+6*O[2].x-O[3].x)/6,(O[1].y+6*O[2].y-O[3].y)/6,O[2].x,O[2].y])}return w}l.getRGB=be(function(p){if(!p||(p=R(p)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:Gi};if(p=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:Gi};!at[g](p.toLowerCase().substring(0,2))&&p.charAt()!="#"&&(p=Ui(p));var _,w,S,P,O,B,G=p.match(L);return G?(G[2]&&(S=Y(G[2].substring(5),16),w=Y(G[2].substring(3,5),16),_=Y(G[2].substring(1,3),16)),G[3]&&(S=Y((O=G[3].charAt(3))+O,16),w=Y((O=G[3].charAt(2))+O,16),_=Y((O=G[3].charAt(1))+O,16)),G[4]&&(B=G[4][A](tt),_=z(B[0]),B[0].slice(-1)=="%"&&(_*=2.55),w=z(B[1]),B[1].slice(-1)=="%"&&(w*=2.55),S=z(B[2]),B[2].slice(-1)=="%"&&(S*=2.55),G[1].toLowerCase().slice(0,4)=="rgba"&&(P=z(B[3])),B[3]&&B[3].slice(-1)=="%"&&(P/=100)),G[5]?(B=G[5][A](tt),_=z(B[0]),B[0].slice(-1)=="%"&&(_*=2.55),w=z(B[1]),B[1].slice(-1)=="%"&&(w*=2.55),S=z(B[2]),B[2].slice(-1)=="%"&&(S*=2.55),(B[0].slice(-3)=="deg"||B[0].slice(-1)=="°")&&(_/=360),G[1].toLowerCase().slice(0,4)=="hsba"&&(P=z(B[3])),B[3]&&B[3].slice(-1)=="%"&&(P/=100),l.hsb2rgb(_,w,S,P)):G[6]?(B=G[6][A](tt),_=z(B[0]),B[0].slice(-1)=="%"&&(_*=2.55),w=z(B[1]),B[1].slice(-1)=="%"&&(w*=2.55),S=z(B[2]),B[2].slice(-1)=="%"&&(S*=2.55),(B[0].slice(-3)=="deg"||B[0].slice(-1)=="°")&&(_/=360),G[1].toLowerCase().slice(0,4)=="hsla"&&(P=z(B[3])),B[3]&&B[3].slice(-1)=="%"&&(P/=100),l.hsl2rgb(_,w,S,P)):((G={r:_,g:w,b:S,toString:Gi}).hex="#"+(16777216|S|w<<8|_<<16).toString(16).slice(1),l.is(P,"finite")&&(G.opacity=P),G)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:Gi}},l),l.hsb=be(function(p,_,w){return l.hsb2rgb(p,_,w).hex}),l.hsl=be(function(p,_,w){return l.hsl2rgb(p,_,w).hex}),l.rgb=be(function(p,_,w){function S(P){return P+.5|0}return"#"+(16777216|S(w)|S(_)<<8|S(p)<<16).toString(16).slice(1)}),l.getColor=function(p){var _=this.getColor.start=this.getColor.start||{h:0,s:1,b:p||.75},w=this.hsb2rgb(_.h,_.s,_.b);return _.h+=.075,_.h>1&&(_.h=0,_.s-=.2,_.s<=0&&(this.getColor.start={h:0,s:1,b:_.b})),w.hex},l.getColor.reset=function(){delete this.start},l.parsePathString=function(p){if(!p)return null;var _=$e(p);if(_.arr)return Ee(_.arr);var w={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},S=[];return l.is(p,_t)&&l.is(p[0],_t)&&(S=Ee(p)),S.length||R(p).replace(Ct,function(P,O,B){var G=[],$=O.toLowerCase();if(B.replace(bt,function(H,J){J&&G.push(+J)}),$=="m"&&G.length>2&&(S.push([O][v](G.splice(0,2))),$="l",O=O=="m"?"l":"L"),$=="r")S.push([O][v](G));else for(;G.length>=w[$]&&(S.push([O][v](G.splice(0,w[$]))),w[$]););}),S.toString=l._path2string,_.arr=Ee(S),S},l.parseTransformString=be(function(p){if(!p)return null;var _=[];return l.is(p,_t)&&l.is(p[0],_t)&&(_=Ee(p)),_.length||R(p).replace(Tt,function(w,S,P){var O=[];N.call(S),P.replace(bt,function(B,G){G&&O.push(+G)}),_.push([S][v](O))}),_.toString=l._path2string,_},this,function(p){if(!p)return p;for(var _=[],w=0;w<p.length;w++){for(var S=[],P=0;P<p[w].length;P++)S.push(p[w][P]);_.push(S)}return _});var $e=function(p){var _=$e.ps=$e.ps||{};return _[p]?_[p].sleep=100:_[p]={sleep:100},setTimeout(function(){for(var w in _)_[g](w)&&w!=p&&(_[w].sleep--,!_[w].sleep&&delete _[w])}),_[p]};function Kn(p,_,w,S,P){return p*(p*(-3*_+9*w-9*S+3*P)+6*_-12*w+6*S)-3*_+3*w}function He(p,_,w,S,P,O,B,G,$){$==null&&($=1);for(var H=($=$>1?1:$<0?0:$)/2,J=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],ot=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],et=0,Z=0;Z<12;Z++){var nt=H*J[Z]+H,lt=Kn(nt,p,w,P,B),rt=Kn(nt,_,S,O,G),Q=lt*lt+rt*rt;et+=ot[Z]*q.sqrt(Q)}return H*et}function zs(p,_,w,S,P,O,B,G){if(!(W(p,w)<K(P,B)||K(p,w)>W(P,B)||W(_,S)<K(O,G)||K(_,S)>W(O,G))){var $=(p-w)*(O-G)-(_-S)*(P-B);if($){var H=((p*S-_*w)*(P-B)-(p-w)*(P*G-O*B))/$,J=((p*S-_*w)*(O-G)-(_-S)*(P*G-O*B))/$,ot=+H.toFixed(2),et=+J.toFixed(2);if(!(ot<+K(p,w).toFixed(2)||ot>+W(p,w).toFixed(2)||ot<+K(P,B).toFixed(2)||ot>+W(P,B).toFixed(2)||et<+K(_,S).toFixed(2)||et>+W(_,S).toFixed(2)||et<+K(O,G).toFixed(2)||et>+W(O,G).toFixed(2)))return{x:H,y:J}}}}function Zn(p,_,w){var S=l.bezierBBox(p),P=l.bezierBBox(_);if(!l.isBBoxIntersect(S,P))return w?0:[];for(var O=He.apply(0,p),B=He.apply(0,_),G=W(~~(O/5),1),$=W(~~(B/5),1),H=[],J=[],ot={},et=w?0:[],Z=0;Z<G+1;Z++){var nt=l.findDotsAtSegment.apply(l,p.concat(Z/G));H.push({x:nt.x,y:nt.y,t:Z/G})}for(Z=0;Z<$+1;Z++)nt=l.findDotsAtSegment.apply(l,_.concat(Z/$)),J.push({x:nt.x,y:nt.y,t:Z/$});for(Z=0;Z<G;Z++)for(var lt=0;lt<$;lt++){var rt=H[Z],Q=H[Z+1],mt=J[lt],ht=J[lt+1],ft=it(Q.x-rt.x)<.001?"y":"x",ct=it(ht.x-mt.x)<.001?"y":"x",Pt=zs(rt.x,rt.y,Q.x,Q.y,mt.x,mt.y,ht.x,ht.y);if(Pt){if(ot[Pt.x.toFixed(4)]==Pt.y.toFixed(4))continue;ot[Pt.x.toFixed(4)]=Pt.y.toFixed(4);var kt=rt.t+it((Pt[ft]-rt[ft])/(Q[ft]-rt[ft]))*(Q.t-rt.t),At=mt.t+it((Pt[ct]-mt[ct])/(ht[ct]-mt[ct]))*(ht.t-mt.t);kt>=0&&kt<=1.001&&At>=0&&At<=1.001&&(w?et++:et.push({x:Pt.x,y:Pt.y,t1:K(kt,1),t2:K(At,1)}))}}return et}function js(p,_,w){p=l._path2curve(p),_=l._path2curve(_);for(var S,P,O,B,G,$,H,J,ot,et,Z=w?0:[],nt=0,lt=p.length;nt<lt;nt++){var rt=p[nt];if(rt[0]=="M")S=G=rt[1],P=$=rt[2];else{rt[0]=="C"?(ot=[S,P].concat(rt.slice(1)),S=ot[6],P=ot[7]):(ot=[S,P,S,P,G,$,G,$],S=G,P=$);for(var Q=0,mt=_.length;Q<mt;Q++){var ht=_[Q];if(ht[0]=="M")O=H=ht[1],B=J=ht[2];else{ht[0]=="C"?(et=[O,B].concat(ht.slice(1)),O=et[6],B=et[7]):(et=[O,B,O,B,H,J,H,J],O=H,B=J);var ft=Zn(ot,et,w);if(w)Z+=ft;else{for(var ct=0,Pt=ft.length;ct<Pt;ct++)ft[ct].segment1=nt,ft[ct].segment2=Q,ft[ct].bez1=ot,ft[ct].bez2=et;Z=Z.concat(ft)}}}}}return Z}l.findDotsAtSegment=function(p,_,w,S,P,O,B,G,$){var H=1-$,J=pt(H,3),ot=pt(H,2),et=$*$,Z=et*$,nt=J*p+3*ot*$*w+3*H*$*$*P+Z*B,lt=J*_+3*ot*$*S+3*H*$*$*O+Z*G,rt=p+2*$*(w-p)+et*(P-2*w+p),Q=_+2*$*(S-_)+et*(O-2*S+_),mt=w+2*$*(P-w)+et*(B-2*P+w),ht=S+2*$*(O-S)+et*(G-2*O+S),ft=H*p+$*w,ct=H*_+$*S,Pt=H*P+$*B,kt=H*O+$*G,At=90-180*q.atan2(rt-mt,Q-ht)/vt;return(rt>mt||Q<ht)&&(At+=180),{x:nt,y:lt,m:{x:rt,y:Q},n:{x:mt,y:ht},start:{x:ft,y:ct},end:{x:Pt,y:kt},alpha:At}},l.bezierBBox=function(p,_,w,S,P,O,B,G){l.is(p,"array")||(p=[p,_,w,S,P,O,B,G]);var $=lo.apply(null,p);return{x:$.min.x,y:$.min.y,x2:$.max.x,y2:$.max.y,width:$.max.x-$.min.x,height:$.max.y-$.min.y}},l.isPointInsideBBox=function(p,_,w){return _>=p.x&&_<=p.x2&&w>=p.y&&w<=p.y2},l.isBBoxIntersect=function(p,_){var w=l.isPointInsideBBox;return w(_,p.x,p.y)||w(_,p.x2,p.y)||w(_,p.x,p.y2)||w(_,p.x2,p.y2)||w(p,_.x,_.y)||w(p,_.x2,_.y)||w(p,_.x,_.y2)||w(p,_.x2,_.y2)||(p.x<_.x2&&p.x>_.x||_.x<p.x2&&_.x>p.x)&&(p.y<_.y2&&p.y>_.y||_.y<p.y2&&_.y>p.y)},l.pathIntersection=function(p,_){return js(p,_)},l.pathIntersectionNumber=function(p,_){return js(p,_,1)},l.isPointInsidePath=function(p,_,w){var S=l.pathBBox(p);return l.isPointInsideBBox(S,_,w)&&js(p,[["M",_,w],["H",S.x2+10]],1)%2==1},l._removedFactory=function(p){return function(){o("raphael.log",null,"Raphaël: you are calling to method “"+p+"” of removed object",p)}};var Bi=l.pathBBox=function(p){var _=$e(p);if(_.bbox)return Ce(_.bbox);if(!p)return{x:0,y:0,width:0,height:0,x2:0,y2:0};for(var w,S=0,P=0,O=[],B=[],G=0,$=(p=Hs(p)).length;G<$;G++)if((w=p[G])[0]=="M")S=w[1],P=w[2],O.push(S),B.push(P);else{var H=lo(S,P,w[1],w[2],w[3],w[4],w[5],w[6]);O=O[v](H.min.x,H.max.x),B=B[v](H.min.y,H.max.y),S=w[5],P=w[6]}var J=K[C](0,O),ot=K[C](0,B),et=W[C](0,O),Z=W[C](0,B),nt=et-J,lt=Z-ot,rt={x:J,y:ot,x2:et,y2:Z,width:nt,height:lt,cx:J+nt/2,cy:ot+lt/2};return _.bbox=Ce(rt),rt},Ee=function(p){var _=Ce(p);return _.toString=l._path2string,_},ng=l._pathToRelative=function(p){var _=$e(p);if(_.rel)return Ee(_.rel);l.is(p,_t)&&l.is(p&&p[0],_t)||(p=l.parsePathString(p));var w=[],S=0,P=0,O=0,B=0,G=0;p[0][0]=="M"&&(O=S=p[0][1],B=P=p[0][2],G++,w.push(["M",S,P]));for(var $=G,H=p.length;$<H;$++){var J=w[$]=[],ot=p[$];if(ot[0]!=N.call(ot[0]))switch(J[0]=N.call(ot[0]),J[0]){case"a":J[1]=ot[1],J[2]=ot[2],J[3]=ot[3],J[4]=ot[4],J[5]=ot[5],J[6]=+(ot[6]-S).toFixed(3),J[7]=+(ot[7]-P).toFixed(3);break;case"v":J[1]=+(ot[1]-P).toFixed(3);break;case"m":O=ot[1],B=ot[2];default:for(var et=1,Z=ot.length;et<Z;et++)J[et]=+(ot[et]-(et%2?S:P)).toFixed(3)}else{J=w[$]=[],ot[0]=="m"&&(O=ot[1]+S,B=ot[2]+P);for(var nt=0,lt=ot.length;nt<lt;nt++)w[$][nt]=ot[nt]}var rt=w[$].length;switch(w[$][0]){case"z":S=O,P=B;break;case"h":S+=+w[$][rt-1];break;case"v":P+=+w[$][rt-1];break;default:S+=+w[$][rt-2],P+=+w[$][rt-1]}}return w.toString=l._path2string,_.rel=Ee(w),w},Jn=l._pathToAbsolute=function(p){var _=$e(p);if(_.abs)return Ee(_.abs);if(l.is(p,_t)&&l.is(p&&p[0],_t)||(p=l.parsePathString(p)),!p||!p.length)return[["M",0,0]];var w=[],S=0,P=0,O=0,B=0,G=0;p[0][0]=="M"&&(O=S=+p[0][1],B=P=+p[0][2],G++,w[0]=["M",S,P]);for(var $,H,J=p.length==3&&p[0][0]=="M"&&p[1][0].toUpperCase()=="R"&&p[2][0].toUpperCase()=="Z",ot=G,et=p.length;ot<et;ot++){if(w.push($=[]),(H=p[ot])[0]!=D.call(H[0]))switch($[0]=D.call(H[0]),$[0]){case"A":$[1]=H[1],$[2]=H[2],$[3]=H[3],$[4]=H[4],$[5]=H[5],$[6]=+(H[6]+S),$[7]=+(H[7]+P);break;case"V":$[1]=+H[1]+P;break;case"H":$[1]=+H[1]+S;break;case"R":for(var Z=[S,P][v](H.slice(1)),nt=2,lt=Z.length;nt<lt;nt++)Z[nt]=+Z[nt]+S,Z[++nt]=+Z[nt]+P;w.pop(),w=w[v](Wn(Z,J));break;case"M":O=+H[1]+S,B=+H[2]+P;default:for(nt=1,lt=H.length;nt<lt;nt++)$[nt]=+H[nt]+(nt%2?S:P)}else if(H[0]=="R")Z=[S,P][v](H.slice(1)),w.pop(),w=w[v](Wn(Z,J)),$=["R"][v](H.slice(-2));else for(var rt=0,Q=H.length;rt<Q;rt++)$[rt]=H[rt];switch($[0]){case"Z":S=O,P=B;break;case"H":S=$[1];break;case"V":P=$[1];break;case"M":O=$[$.length-2],B=$[$.length-1];default:S=$[$.length-2],P=$[$.length-1]}}return w.toString=l._path2string,_.abs=Ee(w),w},Qn=function(p,_,w,S){return[p,_,w,S,w,S]},$i=function(p,_,w,S,P,O){return[1/3*p+2/3*w,1/3*_+2/3*S,1/3*P+2/3*w,1/3*O+2/3*S,P,O]},oo=function(p,_,w,S,P,O,B,G,$,H){var J,ot=120*vt/180,et=vt/180*(+P||0),Z=[],nt=be(function(wg,xg,fo){return{x:wg*q.cos(fo)-xg*q.sin(fo),y:wg*q.sin(fo)+xg*q.cos(fo)}});if(H)kt=H[0],At=H[1],ct=H[2],Pt=H[3];else{p=(J=nt(p,_,-et)).x,_=J.y,G=(J=nt(G,$,-et)).x,$=J.y;var lt=(p-G)/2,rt=(_-$)/2,Q=lt*lt/(w*w)+rt*rt/(S*S);Q>1&&(w*=Q=q.sqrt(Q),S*=Q);var mt=w*w,ht=S*S,ft=(O==B?-1:1)*q.sqrt(it((mt*ht-mt*rt*rt-ht*lt*lt)/(mt*rt*rt+ht*lt*lt))),ct=ft*w*rt/S+(p+G)/2,Pt=ft*-S*lt/w+(_+$)/2,kt=q.asin(((_-Pt)/S).toFixed(9)),At=q.asin((($-Pt)/S).toFixed(9));(kt=p<ct?vt-kt:kt)<0&&(kt=2*vt+kt),(At=G<ct?vt-At:At)<0&&(At=2*vt+At),B&&kt>At&&(kt-=2*vt),!B&&At>kt&&(At-=2*vt)}var er=At-kt;if(it(er)>ot){var Xs=At,Te=G,ti=$;At=kt+ot*(B&&At>kt?1:-1),G=ct+w*q.cos(At),$=Pt+S*q.sin(At),Z=oo(G,$,w,S,P,0,B,Te,ti,[At,Xs,ct,Pt])}er=At-kt;var ir=q.cos(kt),nr=q.sin(kt),co=q.cos(At),_i=q.sin(At),vn=q.tan(er/4),uo=4/3*w*vn,mg=4/3*S*vn,vg=[p,_],rr=[p+uo*nr,_-mg*ir],_g=[G+uo*_i,$-mg*co],yg=[G,$];if(rr[0]=2*vg[0]-rr[0],rr[1]=2*vg[1]-rr[1],H)return[rr,_g,yg][v](Z);for(var bg=[],ji=0,Ww=(Z=[rr,_g,yg][v](Z).join()[A](",")).length;ji<Ww;ji++)bg[ji]=ji%2?nt(Z[ji-1],Z[ji],et).y:nt(Z[ji],Z[ji+1],et).x;return bg},gn=function(p,_,w,S,P,O,B,G,$){var H=1-$;return{x:pt(H,3)*p+3*pt(H,2)*$*w+3*H*$*$*P+pt($,3)*B,y:pt(H,3)*_+3*pt(H,2)*$*S+3*H*$*$*O+pt($,3)*G}},lo=be(function(p,_,w,S,P,O,B,G){var $,H=P-2*w+p-(B-2*P+w),J=2*(w-p)-2*(P-w),ot=p-w,et=(-J+q.sqrt(J*J-4*H*ot))/2/H,Z=(-J-q.sqrt(J*J-4*H*ot))/2/H,nt=[_,G],lt=[p,B];return it(et)>"1e12"&&(et=.5),it(Z)>"1e12"&&(Z=.5),et>0&&et<1&&($=gn(p,_,w,S,P,O,B,G,et),lt.push($.x),nt.push($.y)),Z>0&&Z<1&&($=gn(p,_,w,S,P,O,B,G,Z),lt.push($.x),nt.push($.y)),H=O-2*S+_-(G-2*O+S),ot=_-S,et=(-(J=2*(S-_)-2*(O-S))+q.sqrt(J*J-4*H*ot))/2/H,Z=(-J-q.sqrt(J*J-4*H*ot))/2/H,it(et)>"1e12"&&(et=.5),it(Z)>"1e12"&&(Z=.5),et>0&&et<1&&($=gn(p,_,w,S,P,O,B,G,et),lt.push($.x),nt.push($.y)),Z>0&&Z<1&&($=gn(p,_,w,S,P,O,B,G,Z),lt.push($.x),nt.push($.y)),{min:{x:K[C](0,lt),y:K[C](0,nt)},max:{x:W[C](0,lt),y:W[C](0,nt)}}}),Hs=l._path2curve=be(function(p,_){var w=!_&&$e(p);if(!_&&w.curve)return Ee(w.curve);for(var S=Jn(p),P=_&&Jn(_),O={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},B={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},G=function(ft,ct,Pt){var kt,At;if(!ft)return["C",ct.x,ct.y,ct.x,ct.y,ct.x,ct.y];switch(!(ft[0]in{T:1,Q:1})&&(ct.qx=ct.qy=null),ft[0]){case"M":ct.X=ft[1],ct.Y=ft[2];break;case"A":ft=["C"][v](oo[C](0,[ct.x,ct.y][v](ft.slice(1))));break;case"S":Pt=="C"||Pt=="S"?(kt=2*ct.x-ct.bx,At=2*ct.y-ct.by):(kt=ct.x,At=ct.y),ft=["C",kt,At][v](ft.slice(1));break;case"T":Pt=="Q"||Pt=="T"?(ct.qx=2*ct.x-ct.qx,ct.qy=2*ct.y-ct.qy):(ct.qx=ct.x,ct.qy=ct.y),ft=["C"][v]($i(ct.x,ct.y,ct.qx,ct.qy,ft[1],ft[2]));break;case"Q":ct.qx=ft[1],ct.qy=ft[2],ft=["C"][v]($i(ct.x,ct.y,ft[1],ft[2],ft[3],ft[4]));break;case"L":ft=["C"][v](Qn(ct.x,ct.y,ft[1],ft[2]));break;case"H":ft=["C"][v](Qn(ct.x,ct.y,ft[1],ct.y));break;case"V":ft=["C"][v](Qn(ct.x,ct.y,ct.x,ft[1]));break;case"Z":ft=["C"][v](Qn(ct.x,ct.y,ct.X,ct.Y))}return ft},$=function(ft,ct){if(ft[ct].length>7){ft[ct].shift();for(var Pt=ft[ct];Pt.length;)J[ct]="A",P&&(ot[ct]="A"),ft.splice(ct++,0,["C"][v](Pt.splice(0,6)));ft.splice(ct,1),lt=W(S.length,P&&P.length||0)}},H=function(ft,ct,Pt,kt,At){ft&&ct&&ft[At][0]=="M"&&ct[At][0]!="M"&&(ct.splice(At,0,["M",kt.x,kt.y]),Pt.bx=0,Pt.by=0,Pt.x=ft[At][1],Pt.y=ft[At][2],lt=W(S.length,P&&P.length||0))},J=[],ot=[],et="",Z="",nt=0,lt=W(S.length,P&&P.length||0);nt<lt;nt++){S[nt]&&(et=S[nt][0]),et!="C"&&(J[nt]=et,nt&&(Z=J[nt-1])),S[nt]=G(S[nt],O,Z),J[nt]!="A"&&et=="C"&&(J[nt]="C"),$(S,nt),P&&(P[nt]&&(et=P[nt][0]),et!="C"&&(ot[nt]=et,nt&&(Z=ot[nt-1])),P[nt]=G(P[nt],B,Z),ot[nt]!="A"&&et=="C"&&(ot[nt]="C"),$(P,nt)),H(S,P,O,B,nt),H(P,S,B,O,nt);var rt=S[nt],Q=P&&P[nt],mt=rt.length,ht=P&&Q.length;O.x=rt[mt-2],O.y=rt[mt-1],O.bx=z(rt[mt-4])||O.x,O.by=z(rt[mt-3])||O.y,B.bx=P&&(z(Q[ht-4])||B.x),B.by=P&&(z(Q[ht-3])||B.y),B.x=P&&Q[ht-2],B.y=P&&Q[ht-1]}return P||(w.curve=Ee(S)),P?[S,P]:S},null,Ee),ho=(l._parseDots=be(function(p){for(var _=[],w=0,S=p.length;w<S;w++){var P={},O=p[w].match(/^([^:]*):?([\d\.]*)/);if(P.color=l.getRGB(O[1]),P.color.error)return null;P.opacity=P.color.opacity,P.color=P.color.hex,O[2]&&(P.offset=O[2]+"%"),_.push(P)}for(w=1,S=_.length-1;w<S;w++)if(!_[w].offset){for(var B=z(_[w-1].offset||0),G=0,$=w+1;$<S;$++)if(_[$].offset){G=_[$].offset;break}G||(G=100,$=S);for(var H=((G=z(G))-B)/($-w+1);w<$;w++)B+=H,_[w].offset=B+"%"}return _}),l._tear=function(p,_){p==_.top&&(_.top=p.prev),p==_.bottom&&(_.bottom=p.next),p.next&&(p.next.prev=p.prev),p.prev&&(p.prev.next=p.next)}),$w=(l._tofront=function(p,_){_.top!==p&&(ho(p,_),p.next=null,p.prev=_.top,_.top.next=p,_.top=p)},l._toback=function(p,_){_.bottom!==p&&(ho(p,_),p.next=_.bottom,p.prev=null,_.bottom.prev=p,_.bottom=p)},l._insertafter=function(p,_,w){ho(p,w),_==w.top&&(w.top=p),_.next&&(_.next.prev=p),p.next=_.next,p.prev=_,_.next=p},l._insertbefore=function(p,_,w){ho(p,w),_==w.bottom&&(w.bottom=p),_.prev&&(_.prev.next=p),p.prev=_.prev,_.prev=p,p.next=_},l.toMatrix=function(p,_){var w=Bi(p),S={_:{transform:k},getBBox:function(){return w}};return rg(S,_),S.matrix}),rg=(l.transformPath=function(p,_){return fe(p,$w(p,_))},l._extractTransform=function(p,_){if(_==null)return p._.transform;_=R(_).replace(/\.{3}|\u2026/g,p._.transform||k);var w,S,P=l.parseTransformString(_),O=0,B=1,G=1,$=p._,H=new pn;if($.transform=P||[],P)for(var J=0,ot=P.length;J<ot;J++){var et,Z,nt,lt,rt,Q=P[J],mt=Q.length,ht=R(Q[0]).toLowerCase(),ft=Q[0]!=ht,ct=ft?H.invert():0;ht=="t"&&mt==3?ft?(et=ct.x(0,0),Z=ct.y(0,0),nt=ct.x(Q[1],Q[2]),lt=ct.y(Q[1],Q[2]),H.translate(nt-et,lt-Z)):H.translate(Q[1],Q[2]):ht=="r"?mt==2?(rt=rt||p.getBBox(1),H.rotate(Q[1],rt.x+rt.width/2,rt.y+rt.height/2),O+=Q[1]):mt==4&&(ft?(nt=ct.x(Q[2],Q[3]),lt=ct.y(Q[2],Q[3]),H.rotate(Q[1],nt,lt)):H.rotate(Q[1],Q[2],Q[3]),O+=Q[1]):ht=="s"?mt==2||mt==3?(rt=rt||p.getBBox(1),H.scale(Q[1],Q[mt-1],rt.x+rt.width/2,rt.y+rt.height/2),B*=Q[1],G*=Q[mt-1]):mt==5&&(ft?(nt=ct.x(Q[3],Q[4]),lt=ct.y(Q[3],Q[4]),H.scale(Q[1],Q[2],nt,lt)):H.scale(Q[1],Q[2],Q[3],Q[4]),B*=Q[1],G*=Q[2]):ht=="m"&&mt==7&&H.add(Q[1],Q[2],Q[3],Q[4],Q[5],Q[6]),$.dirtyT=1,p.matrix=H}p.matrix=H,$.sx=B,$.sy=G,$.deg=O,$.dx=w=H.e,$.dy=S=H.f,B==1&&G==1&&!O&&$.bbox?($.bbox.x+=+w,$.bbox.y+=+S):$.dirtyT=1}),sg=function(p){var _=p[0];switch(_.toLowerCase()){case"t":return[_,0,0];case"m":return[_,1,0,0,1,0,0];case"r":return p.length==4?[_,0,p[2],p[3]]:[_,0];case"s":return p.length==5?[_,1,1,p[3],p[4]]:p.length==3?[_,1,1]:[_,1]}},zw=l._equaliseTransform=function(p,_){_=R(_).replace(/\.{3}|\u2026/g,p),p=l.parseTransformString(p)||[],_=l.parseTransformString(_)||[];for(var w,S,P,O,B=W(p.length,_.length),G=[],$=[],H=0;H<B;H++){if(P=p[H]||sg(_[H]),O=_[H]||sg(P),P[0]!=O[0]||P[0].toLowerCase()=="r"&&(P[2]!=O[2]||P[3]!=O[3])||P[0].toLowerCase()=="s"&&(P[3]!=O[3]||P[4]!=O[4]))return;for(G[H]=[],$[H]=[],w=0,S=W(P.length,O.length);w<S;w++)w in P&&(G[H][w]=P[w]),w in O&&($[H][w]=O[w])}return{from:G,to:$}};function pn(p,_,w,S,P,O){p!=null?(this.a=+p,this.b=+_,this.c=+w,this.d=+S,this.e=+P,this.f=+O):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}l._getContainer=function(p,_,w,S){var P;if((P=S!=null||l.is(p,"object")?p:m.doc.getElementById(p))!=null)return P.tagName?_==null?{container:P,width:P.style.pixelWidth||P.offsetWidth,height:P.style.pixelHeight||P.offsetHeight}:{container:P,width:_,height:w}:{container:1,x:p,y:_,width:w,height:S}},l.pathToRelative=ng,l._engine={},l.path2curve=Hs,l.matrix=function(p,_,w,S,P,O){return new pn(p,_,w,S,P,O)},function(p){function _(S){return S[0]*S[0]+S[1]*S[1]}function w(S){var P=q.sqrt(_(S));S[0]&&(S[0]/=P),S[1]&&(S[1]/=P)}p.add=function(S,P,O,B,G,$){var H,J,ot,et,Z=[[],[],[]],nt=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],lt=[[S,O,G],[P,B,$],[0,0,1]];for(S&&S instanceof pn&&(lt=[[S.a,S.c,S.e],[S.b,S.d,S.f],[0,0,1]]),H=0;H<3;H++)for(J=0;J<3;J++){for(et=0,ot=0;ot<3;ot++)et+=nt[H][ot]*lt[ot][J];Z[H][J]=et}this.a=Z[0][0],this.b=Z[1][0],this.c=Z[0][1],this.d=Z[1][1],this.e=Z[0][2],this.f=Z[1][2]},p.invert=function(){var S=this,P=S.a*S.d-S.b*S.c;return new pn(S.d/P,-S.b/P,-S.c/P,S.a/P,(S.c*S.f-S.d*S.e)/P,(S.b*S.e-S.a*S.f)/P)},p.clone=function(){return new pn(this.a,this.b,this.c,this.d,this.e,this.f)},p.translate=function(S,P){this.add(1,0,0,1,S,P)},p.scale=function(S,P,O,B){P==null&&(P=S),(O||B)&&this.add(1,0,0,1,O,B),this.add(S,0,0,P,0,0),(O||B)&&this.add(1,0,0,1,-O,-B)},p.rotate=function(S,P,O){S=l.rad(S),P=P||0,O=O||0;var B=+q.cos(S).toFixed(9),G=+q.sin(S).toFixed(9);this.add(B,G,-G,B,P,O),this.add(1,0,0,1,-P,-O)},p.x=function(S,P){return S*this.a+P*this.c+this.e},p.y=function(S,P){return S*this.b+P*this.d+this.f},p.get=function(S){return+this[R.fromCharCode(97+S)].toFixed(4)},p.toString=function(){return l.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 S={};S.dx=this.e,S.dy=this.f;var P=[[this.a,this.c],[this.b,this.d]];S.scalex=q.sqrt(_(P[0])),w(P[0]),S.shear=P[0][0]*P[1][0]+P[0][1]*P[1][1],P[1]=[P[1][0]-P[0][0]*S.shear,P[1][1]-P[0][1]*S.shear],S.scaley=q.sqrt(_(P[1])),w(P[1]),S.shear/=S.scaley;var O=-P[0][1],B=P[1][1];return B<0?(S.rotate=l.deg(q.acos(B)),O<0&&(S.rotate=360-S.rotate)):S.rotate=l.deg(q.asin(O)),S.isSimple=!(+S.shear.toFixed(9)||S.scalex.toFixed(9)!=S.scaley.toFixed(9)&&S.rotate),S.isSuperSimple=!+S.shear.toFixed(9)&&S.scalex.toFixed(9)==S.scaley.toFixed(9)&&!S.rotate,S.noRotation=!+S.shear.toFixed(9)&&!S.rotate,S},p.toTransformString=function(S){var P=S||this[A]();return P.isSimple?(P.scalex=+P.scalex.toFixed(4),P.scaley=+P.scaley.toFixed(4),P.rotate=+P.rotate.toFixed(4),(P.dx||P.dy?"t"+[P.dx,P.dy]:k)+(P.scalex!=1||P.scaley!=1?"s"+[P.scalex,P.scaley,0,0]:k)+(P.rotate?"r"+[P.rotate,0,0]:k)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(pn.prototype);for(var jw=function(){this.returnValue=!1},Hw=function(){return this.originalEvent.preventDefault()},Vw=function(){this.cancelBubble=!0},qw=function(){return this.originalEvent.stopPropagation()},ag=function(p){var _=m.doc.documentElement.scrollTop||m.doc.body.scrollTop,w=m.doc.documentElement.scrollLeft||m.doc.body.scrollLeft;return{x:p.clientX+w,y:p.clientY+_}},Xw=m.doc.addEventListener?function(p,_,w,S){var P=function(B){var G=ag(B);return w.call(S,B,G.x,G.y)};if(p.addEventListener(_,P,!1),b&&I[_]){var O=function(B){for(var G=ag(B),$=B,H=0,J=B.targetTouches&&B.targetTouches.length;H<J;H++)if(B.targetTouches[H].target==p){(B=B.targetTouches[H]).originalEvent=$,B.preventDefault=Hw,B.stopPropagation=qw;break}return w.call(S,B,G.x,G.y)};p.addEventListener(I[_],O,!1)}return function(){return p.removeEventListener(_,P,!1),b&&I[_]&&p.removeEventListener(I[_],O,!1),!0}}:m.doc.attachEvent?function(p,_,w,S){var P=function(O){O=O||m.win.event;var B=m.doc.documentElement.scrollTop||m.doc.body.scrollTop,G=m.doc.documentElement.scrollLeft||m.doc.body.scrollLeft,$=O.clientX+G,H=O.clientY+B;return O.preventDefault=O.preventDefault||jw,O.stopPropagation=O.stopPropagation||Vw,w.call(S,O,$,H)};return p.attachEvent("on"+_,P),function(){return p.detachEvent("on"+_,P),!0}}:void 0,zi=[],Mh=function(p){for(var _,w=p.clientX,S=p.clientY,P=m.doc.documentElement.scrollTop||m.doc.body.scrollTop,O=m.doc.documentElement.scrollLeft||m.doc.body.scrollLeft,B=zi.length;B--;){if(_=zi[B],b&&p.touches){for(var G,$=p.touches.length;$--;)if((G=p.touches[$]).identifier==_.el._drag.id){w=G.clientX,S=G.clientY,(p.originalEvent?p.originalEvent:p).preventDefault();break}}else p.preventDefault();var H,J=_.el.node,ot=J.nextSibling,et=J.parentNode,Z=J.style.display;m.win.opera&&et.removeChild(J),J.style.display="none",H=_.el.paper.getElementByPoint(w,S),J.style.display=Z,m.win.opera&&(ot?et.insertBefore(J,ot):et.appendChild(J)),H&&o("raphael.drag.over."+_.el.id,_.el,H),w+=O,S+=P,o("raphael.drag.move."+_.el.id,_.move_scope||_.el,w-_.el._drag.x,S-_.el._drag.y,w,S,p)}},Rh=function(p){l.unmousemove(Mh).unmouseup(Rh);for(var _,w=zi.length;w--;)(_=zi[w]).el._drag={},o("raphael.drag.end."+_.el.id,_.end_scope||_.start_scope||_.move_scope||_.el,p);zi=[]},Ht=l.el={},og=U.length;og--;)(function(p){l[p]=Ht[p]=function(_,w){return l.is(_,"function")&&(this.events=this.events||[],this.events.push({name:p,f:_,unbind:Xw(this.shape||this.node||m.doc,p,_,w||this)})),this},l["un"+p]=Ht["un"+p]=function(_){for(var w=this.events||[],S=w.length;S--;)w[S].name!=p||!l.is(_,"undefined")&&w[S].f!=_||(w[S].unbind(),w.splice(S,1),!w.length&&delete this.events);return this}})(U[og]);Ht.data=function(p,_){var w=Nt[this.id]=Nt[this.id]||{};if(arguments.length==0)return w;if(arguments.length==1){if(l.is(p,"object")){for(var S in p)p[g](S)&&this.data(S,p[S]);return this}return o("raphael.data.get."+this.id,this,w[p],p),w[p]}return w[p]=_,o("raphael.data.set."+this.id,this,_,p),this},Ht.removeData=function(p){return p==null?delete Nt[this.id]:Nt[this.id]&&delete Nt[this.id][p],this},Ht.getData=function(){return Ce(Nt[this.id]||{})},Ht.hover=function(p,_,w,S){return this.mouseover(p,w).mouseout(_,S||w)},Ht.unhover=function(p,_){return this.unmouseover(p).unmouseout(_)};var tr=[];Ht.drag=function(p,_,w,S,P,O){function B(G){(G.originalEvent||G).preventDefault();var $=G.clientX,H=G.clientY,J=m.doc.documentElement.scrollTop||m.doc.body.scrollTop,ot=m.doc.documentElement.scrollLeft||m.doc.body.scrollLeft;if(this._drag.id=G.identifier,b&&G.touches){for(var et,Z=G.touches.length;Z--;)if(et=G.touches[Z],this._drag.id=et.identifier,et.identifier==this._drag.id){$=et.clientX,H=et.clientY;break}}this._drag.x=$+ot,this._drag.y=H+J,!zi.length&&l.mousemove(Mh).mouseup(Rh),zi.push({el:this,move_scope:S,start_scope:P,end_scope:O}),_&&o.on("raphael.drag.start."+this.id,_),p&&o.on("raphael.drag.move."+this.id,p),w&&o.on("raphael.drag.end."+this.id,w),o("raphael.drag.start."+this.id,P||S||this,this._drag.x,this._drag.y,G)}return this._drag={},tr.push({el:this,start:B}),this.mousedown(B),this},Ht.onDragOver=function(p){p?o.on("raphael.drag.over."+this.id,p):o.unbind("raphael.drag.over."+this.id)},Ht.undrag=function(){for(var p=tr.length;p--;)tr[p].el==this&&(this.unmousedown(tr[p].start),tr.splice(p,1),o.unbind("raphael.drag.*."+this.id));!tr.length&&l.unmousemove(Mh).unmouseup(Rh),zi=[]},c.circle=function(p,_,w){var S=l._engine.circle(this,p||0,_||0,w||0);return this.__set__&&this.__set__.push(S),S},c.rect=function(p,_,w,S,P){var O=l._engine.rect(this,p||0,_||0,w||0,S||0,P||0);return this.__set__&&this.__set__.push(O),O},c.ellipse=function(p,_,w,S){var P=l._engine.ellipse(this,p||0,_||0,w||0,S||0);return this.__set__&&this.__set__.push(P),P},c.path=function(p){p&&!l.is(p,"string")&&!l.is(p[0],_t)&&(p+=k);var _=l._engine.path(l.format[C](l,arguments),this);return this.__set__&&this.__set__.push(_),_},c.image=function(p,_,w,S,P){var O=l._engine.image(this,p||"about:blank",_||0,w||0,S||0,P||0);return this.__set__&&this.__set__.push(O),O},c.text=function(p,_,w){var S=l._engine.text(this,p||0,_||0,R(w));return this.__set__&&this.__set__.push(S),S},c.set=function(p){!l.is(p,"array")&&(p=Array.prototype.splice.call(arguments,0,arguments.length));var _=new qs(p);return this.__set__&&this.__set__.push(_),_.paper=this,_.type="set",_},c.setStart=function(p){this.__set__=p||this.set()},c.setFinish=function(p){var _=this.__set__;return delete this.__set__,_},c.getSize=function(){var p=this.canvas.parentNode;return{width:p.offsetWidth,height:p.offsetHeight}},c.setSize=function(p,_){return l._engine.setSize.call(this,p,_)},c.setViewBox=function(p,_,w,S,P){return l._engine.setViewBox.call(this,p,_,w,S,P)},c.top=c.bottom=null,c.raphael=l;function lg(){return this.x+T+this.y+T+this.width+" × "+this.height}c.getElementByPoint=function(p,_){var w,S,P,O,B,G,$,H=this.canvas,J=m.doc.elementFromPoint(p,_);if(m.win.opera&&J.tagName=="svg"){var ot=(S=(w=H).getBoundingClientRect(),P=w.ownerDocument,O=P.body,B=P.documentElement,G=B.clientTop||O.clientTop||0,$=B.clientLeft||O.clientLeft||0,{y:S.top+(m.win.pageYOffset||B.scrollTop||O.scrollTop)-G,x:S.left+(m.win.pageXOffset||B.scrollLeft||O.scrollLeft)-$}),et=H.createSVGRect();et.x=p-ot.x,et.y=_-ot.y,et.width=et.height=1;var Z=H.getIntersectionList(et,null);Z.length&&(J=Z[Z.length-1])}if(!J)return null;for(;J.parentNode&&J!=H.parentNode&&!J.raphael;)J=J.parentNode;return J==this.canvas.parentNode&&(J=H),J=J&&J.raphael?this.getById(J.raphaelid):null},c.getElementsByBBox=function(p){var _=this.set();return this.forEach(function(w){l.isBBoxIntersect(w.getBBox(),p)&&_.push(w)}),_},c.getById=function(p){for(var _=this.bottom;_;){if(_.id==p)return _;_=_.next}return null},c.forEach=function(p,_){for(var w=this.bottom;w;){if(p.call(_,w)===!1)return this;w=w.next}return this},c.getElementsByPoint=function(p,_){var w=this.set();return this.forEach(function(S){S.isPointInside(p,_)&&w.push(S)}),w},Ht.isPointInside=function(p,_){var w=this.realPath=re[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(w=l.transformPath(w,this.attr("transform"))),l.isPointInsidePath(w,p,_)},Ht.getBBox=function(p){if(this.removed)return{};var _=this._;return p?(!_.dirty&&_.bboxwt||(this.realPath=re[this.type](this),_.bboxwt=Bi(this.realPath),_.bboxwt.toString=lg,_.dirty=0),_.bboxwt):((_.dirty||_.dirtyT||!_.bbox)&&(!_.dirty&&this.realPath||(_.bboxwt=0,this.realPath=re[this.type](this)),_.bbox=Bi(fe(this.realPath,this.matrix)),_.bbox.toString=lg,_.dirty=_.dirtyT=0),_.bbox)},Ht.clone=function(){if(this.removed)return null;var p=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(p),p},Ht.glow=function(p){if(this.type=="text")return null;var _={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"},w=_.width/2,S=this.paper,P=S.set(),O=this.realPath||re[this.type](this);O=this.matrix?fe(O,this.matrix):O;for(var B=1;B<w+1;B++)P.push(S.path(O).attr({stroke:_.color,fill:_.fill?_.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(_.width/w*B).toFixed(3),opacity:+(_.opacity/w).toFixed(3)}));return P.insertBefore(this).translate(_.offsetx,_.offsety)};var Lh=function(p,_,w,S,P,O,B,G,$){return $==null?He(p,_,w,S,P,O,B,G):l.findDotsAtSegment(p,_,w,S,P,O,B,G,function(H,J,ot,et,Z,nt,lt,rt,Q){if(!(Q<0||He(H,J,ot,et,Z,nt,lt,rt)<Q)){var mt,ht=.5,ft=1-ht;for(mt=He(H,J,ot,et,Z,nt,lt,rt,ft);it(mt-Q)>.01;)mt=He(H,J,ot,et,Z,nt,lt,rt,ft+=(mt<Q?1:-1)*(ht/=2));return ft}}(p,_,w,S,P,O,B,G,$))},Dh=function(p,_){return function(w,S,P){for(var O,B,G,$,H,J="",ot={},et=0,Z=0,nt=(w=Hs(w)).length;Z<nt;Z++){if((G=w[Z])[0]=="M")O=+G[1],B=+G[2];else{if(et+($=Lh(O,B,G[1],G[2],G[3],G[4],G[5],G[6]))>S){if(_&&!ot.start){if(J+=["C"+(H=Lh(O,B,G[1],G[2],G[3],G[4],G[5],G[6],S-et)).start.x,H.start.y,H.m.x,H.m.y,H.x,H.y],P)return J;ot.start=J,J=["M"+H.x,H.y+"C"+H.n.x,H.n.y,H.end.x,H.end.y,G[5],G[6]].join(),et+=$,O=+G[5],B=+G[6];continue}if(!p&&!_)return{x:(H=Lh(O,B,G[1],G[2],G[3],G[4],G[5],G[6],S-et)).x,y:H.y,alpha:H.alpha}}et+=$,O=+G[5],B=+G[6]}J+=G.shift()+G}return ot.end=J,(H=p?et:_?ot:l.findDotsAtSegment(O,B,G[0],G[1],G[2],G[3],G[4],G[5],1)).alpha&&(H={x:H.x,y:H.y,alpha:H.alpha}),H}},hg=Dh(1),cg=Dh(),Ih=Dh(0,1);l.getTotalLength=hg,l.getPointAtLength=cg,l.getSubpath=function(p,_,w){if(this.getTotalLength(p)-w<1e-6)return Ih(p,_).end;var S=Ih(p,w,1);return _?Ih(S,_).end:S},Ht.getTotalLength=function(){var p=this.getPath();if(p)return this.node.getTotalLength?this.node.getTotalLength():hg(p)},Ht.getPointAtLength=function(p){var _=this.getPath();if(_)return cg(_,p)},Ht.getPath=function(){var p,_=l._getPath[this.type];if(this.type!="text"&&this.type!="set")return _&&(p=_(this)),p},Ht.getSubpath=function(p,_){var w=this.getPath();if(w)return l.getSubpath(w,p,_)};var Ie=l.easing_formulas={linear:function(p){return p},"<":function(p){return pt(p,1.7)},">":function(p){return pt(p,.48)},"<>":function(p){var _=.48-p/1.04,w=q.sqrt(.1734+_*_),S=w-_,P=-w-_,O=pt(it(S),1/3)*(S<0?-1:1)+pt(it(P),1/3)*(P<0?-1:1)+.5;return 3*(1-O)*O*O+O*O*O},backIn:function(p){var _=1.70158;return p*p*((_+1)*p-_)},backOut:function(p){var _=1.70158;return(p-=1)*p*((_+1)*p+_)+1},elastic:function(p){return p==!!p?p:pt(2,-10*p)*q.sin(2*vt*(p-.075)/.3)+1},bounce:function(p){var _=7.5625,w=2.75;return p<1/w?_*p*p:p<2/w?_*(p-=1.5/w)*p+.75:p<2.5/w?_*(p-=2.25/w)*p+.9375:_*(p-=2.625/w)*p+.984375}};Ie.easeIn=Ie["ease-in"]=Ie["<"],Ie.easeOut=Ie["ease-out"]=Ie[">"],Ie.easeInOut=Ie["ease-in-out"]=Ie["<>"],Ie["back-in"]=Ie.backIn,Ie["back-out"]=Ie.backOut;var Bt=[],ug=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(p){setTimeout(p,16)},Oh=function(){for(var p=+new Date,_=0;_<Bt.length;_++){var w=Bt[_];if(!w.el.removed&&!w.paused){var S,P,O=p-w.start,B=w.ms,G=w.easing,$=w.from,H=w.diff,J=w.to,ot=(w.t,w.el),et={},Z={};if(w.initstatus?(O=(w.initstatus*w.anim.top-w.prev)/(w.percent-w.prev)*B,w.status=w.initstatus,delete w.initstatus,w.stop&&Bt.splice(_--,1)):w.status=(w.prev+(w.percent-w.prev)*(O/B))/w.anim.top,!(O<0))if(O<B){var nt=G(O/B);for(var lt in $)if($[g](lt)){switch(X[lt]){case dt:S=+$[lt]+nt*B*H[lt];break;case"colour":S="rgb("+[Fh(F($[lt].r+nt*B*H[lt].r)),Fh(F($[lt].g+nt*B*H[lt].g)),Fh(F($[lt].b+nt*B*H[lt].b))].join(",")+")";break;case"path":S=[];for(var rt=0,Q=$[lt].length;rt<Q;rt++){S[rt]=[$[lt][rt][0]];for(var mt=1,ht=$[lt][rt].length;mt<ht;mt++)S[rt][mt]=+$[lt][rt][mt]+nt*B*H[lt][rt][mt];S[rt]=S[rt].join(T)}S=S.join(T);break;case"transform":if(H[lt].real)for(S=[],rt=0,Q=$[lt].length;rt<Q;rt++)for(S[rt]=[$[lt][rt][0]],mt=1,ht=$[lt][rt].length;mt<ht;mt++)S[rt][mt]=$[lt][rt][mt]+nt*B*H[lt][rt][mt];else{var ft=function(Pt){return+$[lt][Pt]+nt*B*H[lt][Pt]};S=[["m",ft(0),ft(1),ft(2),ft(3),ft(4),ft(5)]]}break;case"csv":if(lt=="clip-rect")for(S=[],rt=4;rt--;)S[rt]=+$[lt][rt]+nt*B*H[lt][rt];break;default:var ct=[][v]($[lt]);for(S=[],rt=ot.paper.customAttributes[lt].length;rt--;)S[rt]=+ct[rt]+nt*B*H[lt][rt]}et[lt]=S}ot.attr(et),function(Pt,kt,At){setTimeout(function(){o("raphael.anim.frame."+Pt,kt,At)})}(ot.id,ot,w.anim)}else{if(function(Pt,kt,At){setTimeout(function(){o("raphael.anim.frame."+kt.id,kt,At),o("raphael.anim.finish."+kt.id,kt,At),l.is(Pt,"function")&&Pt.call(kt)})}(w.callback,ot,w.anim),ot.attr(J),Bt.splice(_--,1),w.repeat>1&&!w.next){for(P in J)J[g](P)&&(Z[P]=w.totalOrigin[P]);w.el.attr(Z),Vs(w.anim,w.el,w.anim.percents[0],null,w.totalOrigin,w.repeat-1)}w.next&&!w.stop&&Vs(w.anim,w.el,w.next,null,w.totalOrigin,w.repeat)}}}Bt.length&&ug(Oh)},Fh=function(p){return p>255?255:p<0?0:p};function Yw(p,_,w,S,P,O){var B=3*_,G=3*(S-_)-B,$=1-B-G,H=3*w,J=3*(P-w)-H,ot=1-H-J;function et(Z){return(($*Z+G)*Z+B)*Z}return function(Z,nt){var lt=function(rt,Q){var mt,ht,ft,ct,Pt,kt;for(ft=rt,kt=0;kt<8;kt++){if(ct=et(ft)-rt,it(ct)<Q)return ft;if(it(Pt=(3*$*ft+2*G)*ft+B)<1e-6)break;ft-=ct/Pt}if(ht=1,(ft=rt)<(mt=0))return mt;if(ft>ht)return ht;for(;mt<ht;){if(ct=et(ft),it(ct-rt)<Q)return ft;rt>ct?mt=ft:ht=ft,ft=(ht-mt)/2+mt}return ft}(Z,nt);return((ot*lt+J)*lt+H)*lt}(p,1/(200*O))}function vi(p,_){var w=[],S={};if(this.ms=_,this.times=1,p){for(var P in p)p[g](P)&&(S[z(P)]=p[P],w.push(z(P)));w.sort(Lt)}this.anim=S,this.top=w[w.length-1],this.percents=w}function Vs(p,_,w,S,P,O){w=z(w);var B,G,$,H,J,ot,et=p.ms,Z={},nt={},lt={};if(S)for(Q=0,mt=Bt.length;Q<mt;Q++){var rt=Bt[Q];if(rt.el.id==_.id&&rt.anim==p){rt.percent!=w?(Bt.splice(Q,1),$=1):G=rt,_.attr(rt.totalOrigin);break}}else S=+nt;for(var Q=0,mt=p.percents.length;Q<mt;Q++){if(p.percents[Q]==w||p.percents[Q]>S*p.top){w=p.percents[Q],J=p.percents[Q-1]||0,et=et/p.top*(w-J),H=p.percents[Q+1],B=p.anim[w];break}S&&_.attr(p.anim[p.percents[Q]])}if(B){if(G)G.initstatus=S,G.start=new Date-G.ms*S;else{for(var ht in B)if(B[g](ht)&&(X[g](ht)||_.paper.customAttributes[g](ht)))switch(Z[ht]=_.attr(ht),Z[ht]==null&&(Z[ht]=V[ht]),nt[ht]=B[ht],X[ht]){case dt:lt[ht]=(nt[ht]-Z[ht])/et;break;case"colour":Z[ht]=l.getRGB(Z[ht]);var ft=l.getRGB(nt[ht]);lt[ht]={r:(ft.r-Z[ht].r)/et,g:(ft.g-Z[ht].g)/et,b:(ft.b-Z[ht].b)/et};break;case"path":var ct=Hs(Z[ht],nt[ht]),Pt=ct[1];for(Z[ht]=ct[0],lt[ht]=[],Q=0,mt=Z[ht].length;Q<mt;Q++){lt[ht][Q]=[0];for(var kt=1,At=Z[ht][Q].length;kt<At;kt++)lt[ht][Q][kt]=(Pt[Q][kt]-Z[ht][Q][kt])/et}break;case"transform":var er=_._,Xs=zw(er[ht],nt[ht]);if(Xs)for(Z[ht]=Xs.from,nt[ht]=Xs.to,lt[ht]=[],lt[ht].real=!0,Q=0,mt=Z[ht].length;Q<mt;Q++)for(lt[ht][Q]=[Z[ht][Q][0]],kt=1,At=Z[ht][Q].length;kt<At;kt++)lt[ht][Q][kt]=(nt[ht][Q][kt]-Z[ht][Q][kt])/et;else{var Te=_.matrix||new pn,ti={_:{transform:er.transform},getBBox:function(){return _.getBBox(1)}};Z[ht]=[Te.a,Te.b,Te.c,Te.d,Te.e,Te.f],rg(ti,nt[ht]),nt[ht]=ti._.transform,lt[ht]=[(ti.matrix.a-Te.a)/et,(ti.matrix.b-Te.b)/et,(ti.matrix.c-Te.c)/et,(ti.matrix.d-Te.d)/et,(ti.matrix.e-Te.e)/et,(ti.matrix.f-Te.f)/et]}break;case"csv":var ir=R(B[ht])[A](d),nr=R(Z[ht])[A](d);if(ht=="clip-rect")for(Z[ht]=nr,lt[ht]=[],Q=nr.length;Q--;)lt[ht][Q]=(ir[Q]-Z[ht][Q])/et;nt[ht]=ir;break;default:for(ir=[][v](B[ht]),nr=[][v](Z[ht]),lt[ht]=[],Q=_.paper.customAttributes[ht].length;Q--;)lt[ht][Q]=((ir[Q]||0)-(nr[Q]||0))/et}var co=B.easing,_i=l.easing_formulas[co];if(!_i)if((_i=R(co).match(E))&&_i.length==5){var vn=_i;_i=function(uo){return Yw(uo,+vn[1],+vn[2],+vn[3],+vn[4],et)}}else _i=Dt;if(rt={anim:p,percent:w,timestamp:ot=B.start||p.start||+new Date,start:ot+(p.del||0),status:0,initstatus:S||0,stop:!1,ms:et,easing:_i,from:Z,diff:lt,to:nt,el:_,callback:B.callback,prev:J,next:H,repeat:O||p.times,origin:_.attr(),totalOrigin:P},Bt.push(rt),S&&!G&&!$&&(rt.stop=!0,rt.start=new Date-et*S,Bt.length==1))return Oh();$&&(rt.start=new Date-rt.ms*S),Bt.length==1&&ug(Oh)}o("raphael.anim.start."+_.id,_,p)}}function fg(p){for(var _=0;_<Bt.length;_++)Bt[_].el.paper==p&&Bt.splice(_--,1)}Ht.animateWith=function(p,_,w,S,P,O){if(this.removed)return O&&O.call(this),this;var B=w instanceof vi?w:l.animation(w,S,P,O);Vs(B,this,B.percents[0],null,this.attr());for(var G=0,$=Bt.length;G<$;G++)if(Bt[G].anim==_&&Bt[G].el==p){Bt[$-1].start=Bt[G].start;break}return this},Ht.onAnimation=function(p){return p?o.on("raphael.anim.frame."+this.id,p):o.unbind("raphael.anim.frame."+this.id),this},vi.prototype.delay=function(p){var _=new vi(this.anim,this.ms);return _.times=this.times,_.del=+p||0,_},vi.prototype.repeat=function(p){var _=new vi(this.anim,this.ms);return _.del=this.del,_.times=q.floor(W(p,0))||1,_},l.animation=function(p,_,w,S){if(p instanceof vi)return p;!l.is(w,"function")&&w||(S=S||w||null,w=null),p=Object(p),_=+_||0;var P,O,B={};for(O in p)p[g](O)&&z(O)!=O&&z(O)+"%"!=O&&(P=!0,B[O]=p[O]);if(P)return w&&(B.easing=w),S&&(B.callback=S),new vi({100:B},_);if(S){var G=0;for(var $ in p){var H=Y($);p[g]($)&&H>G&&(G=H)}!p[G+="%"].callback&&(p[G].callback=S)}return new vi(p,_)},Ht.animate=function(p,_,w,S){if(this.removed)return S&&S.call(this),this;var P=p instanceof vi?p:l.animation(p,_,w,S);return Vs(P,this,P.percents[0],null,this.attr()),this},Ht.setTime=function(p,_){return p&&_!=null&&this.status(p,K(_,p.ms)/p.ms),this},Ht.status=function(p,_){var w,S,P=[],O=0;if(_!=null)return Vs(p,this,-1,K(_,1)),this;for(w=Bt.length;O<w;O++)if((S=Bt[O]).el.id==this.id&&(!p||S.anim==p)){if(p)return S.status;P.push({anim:S.anim,status:S.status})}return p?0:P},Ht.pause=function(p){for(var _=0;_<Bt.length;_++)Bt[_].el.id!=this.id||p&&Bt[_].anim!=p||o("raphael.anim.pause."+this.id,this,Bt[_].anim)!==!1&&(Bt[_].paused=!0);return this},Ht.resume=function(p){for(var _=0;_<Bt.length;_++)if(Bt[_].el.id==this.id&&(!p||Bt[_].anim==p)){var w=Bt[_];o("raphael.anim.resume."+this.id,this,w.anim)!==!1&&(delete w.paused,this.status(w.anim,w.status))}return this},Ht.stop=function(p){for(var _=0;_<Bt.length;_++)Bt[_].el.id!=this.id||p&&Bt[_].anim!=p||o("raphael.anim.stop."+this.id,this,Bt[_].anim)!==!1&&Bt.splice(_--,1);return this},o.on("raphael.remove",fg),o.on("raphael.clear",fg),Ht.toString=function(){return"Raphaël’s object"};var dg,gg,mn,pg,qs=function(p){if(this.items=[],this.length=0,this.type="set",p)for(var _=0,w=p.length;_<w;_++)!p[_]||p[_].constructor!=Ht.constructor&&p[_].constructor!=qs||(this[this.items.length]=this.items[this.items.length]=p[_],this.length++)},we=qs.prototype;for(var Nh in we.push=function(){for(var p,_,w=0,S=arguments.length;w<S;w++)!(p=arguments[w])||p.constructor!=Ht.constructor&&p.constructor!=qs||(this[_=this.items.length]=this.items[_]=p,this.length++);return this},we.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},we.forEach=function(p,_){for(var w=0,S=this.items.length;w<S;w++)if(p.call(_,this.items[w],w)===!1)return this;return this},Ht)Ht[g](Nh)&&(we[Nh]=function(p){return function(){var _=arguments;return this.forEach(function(w){w[p][C](w,_)})}}(Nh));return we.attr=function(p,_){if(p&&l.is(p,_t)&&l.is(p[0],"object"))for(var w=0,S=p.length;w<S;w++)this.items[w].attr(p[w]);else for(var P=0,O=this.items.length;P<O;P++)this.items[P].attr(p,_);return this},we.clear=function(){for(;this.length;)this.pop()},we.splice=function(p,_,w){p=p<0?W(this.length+p,0):p,_=W(0,K(this.length-p,_));var S,P=[],O=[],B=[];for(S=2;S<arguments.length;S++)B.push(arguments[S]);for(S=0;S<_;S++)O.push(this[p+S]);for(;S<this.length-p;S++)P.push(this[p+S]);var G=B.length;for(S=0;S<G+P.length;S++)this.items[p+S]=this[p+S]=S<G?B[S]:P[S-G];for(S=this.items.length=this.length-=_-G;this[S];)delete this[S++];return new qs(O)},we.exclude=function(p){for(var _=0,w=this.length;_<w;_++)if(this[_]==p)return this.splice(_,1),!0},we.animate=function(p,_,w,S){(l.is(w,"function")||!w)&&(S=w||null);var P,O,B=this.items.length,G=B,$=this;if(!B)return this;S&&(O=function(){!--B&&S.call($)}),w=l.is(w,"string")?w:O;var H=l.animation(p,_,w,O);for(P=this.items[--G].animate(H);G--;)this.items[G]&&!this.items[G].removed&&this.items[G].animateWith(P,H,H),this.items[G]&&!this.items[G].removed||B--;return this},we.insertAfter=function(p){for(var _=this.items.length;_--;)this.items[_].insertAfter(p);return this},we.getBBox=function(){for(var p=[],_=[],w=[],S=[],P=this.items.length;P--;)if(!this.items[P].removed){var O=this.items[P].getBBox();p.push(O.x),_.push(O.y),w.push(O.x+O.width),S.push(O.y+O.height)}return{x:p=K[C](0,p),y:_=K[C](0,_),x2:w=W[C](0,w),y2:S=W[C](0,S),width:w-p,height:S-_}},we.clone=function(p){p=this.paper.set();for(var _=0,w=this.items.length;_<w;_++)p.push(this.items[_].clone());return p},we.toString=function(){return"Raphaël‘s set"},we.glow=function(p){var _=this.paper.set();return this.forEach(function(w,S){var P=w.glow(p);P?.forEach(function(O,B){_.push(O)})}),_},we.isPointInside=function(p,_){var w=!1;return this.forEach(function(S){if(S.isPointInside(p,_))return w=!0,!1}),w},l.registerFont=function(p){if(!p.face)return p;this.fonts=this.fonts||{};var _={w:p.w,face:{},glyphs:{}},w=p.face["font-family"];for(var S in p.face)p.face[g](S)&&(_.face[S]=p.face[S]);if(this.fonts[w]?this.fonts[w].push(_):this.fonts[w]=[_],!p.svg){for(var P in _.face["units-per-em"]=Y(p.face["units-per-em"],10),p.glyphs)if(p.glyphs[g](P)){var O=p.glyphs[P];if(_.glyphs[P]={w:O.w,k:{},d:O.d&&"M"+O.d.replace(/[mlcxtrv]/g,function(G){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[G]||"M"})+"z"},O.k)for(var B in O.k)O[g](B)&&(_.glyphs[P].k[B]=O.k[B])}}return p},c.getFont=function(p,_,w,S){if(S=S||"normal",w=w||"normal",_=+_||{normal:400,bold:700,lighter:300,bolder:800}[_]||400,l.fonts){var P,O=l.fonts[p];if(!O){var B=new RegExp("(^|\\s)"+p.replace(/[^\w\d\s+!~.:_-]/g,k)+"(\\s|$)","i");for(var G in l.fonts)if(l.fonts[g](G)&&B.test(G)){O=l.fonts[G];break}}if(O)for(var $=0,H=O.length;$<H&&((P=O[$]).face["font-weight"]!=_||P.face["font-style"]!=w&&P.face["font-style"]||P.face["font-stretch"]!=S);$++);return P}},c.print=function(p,_,w,S,P,O,B,G){O=O||"middle",B=W(K(B||0,1),-1),G=W(K(G||1,3),1);var $,H=R(w)[A](k),J=0,ot=0,et=k;if(l.is(S,"string")&&(S=this.getFont(S)),S){$=(P||16)/S.face["units-per-em"];for(var Z=S.face.bbox[A](d),nt=+Z[0],lt=Z[3]-Z[1],rt=0,Q=+Z[1]+(O=="baseline"?lt+ +S.face.descent:lt/2),mt=0,ht=H.length;mt<ht;mt++){if(H[mt]==`
|
|
26
|
+
`)J=0,ct=0,ot=0,rt+=lt*G;else{var ft=ot&&S.glyphs[H[mt-1]]||{},ct=S.glyphs[H[mt]];J+=ot?(ft.w||S.w)+(ft.k&&ft.k[H[mt]]||0)+S.w*B:0,ot=1}ct&&ct.d&&(et+=l.transformPath(ct.d,["t",J*$,rt*$,"s",$,$,nt,Q,"t",(p-nt)/$,(_-Q)/$]))}}return this.path(et).attr({fill:"#000",stroke:"none"})},c.add=function(p){if(l.is(p,"array"))for(var _,w=this.set(),S=0,P=p.length;S<P;S++)_=p[S]||{},f[g](_.type)&&w.push(this[_.type]().attr(_));return w},l.format=function(p,_){var w=l.is(_,_t)?[0][v](_):arguments;return p&&l.is(p,"string")&&w.length-1&&(p=p.replace(u,function(S,P){return w[++P]==null?k:w[P]})),p||k},l.fullfill=(dg=/\{([^\}]+)\}/g,gg=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,function(p,_){return String(p).replace(dg,function(w,S){return function(P,O,B){var G=B;return O.replace(gg,function($,H,J,ot,et){H=H||ot,G&&(H in G&&(G=G[H]),typeof G=="function"&&et&&(G=G()))}),G=(G==null||G==B?P:G)+""}(w,S,_)})}),l.ninja=function(){if(y.was)m.win.Raphael=y.is;else{window.Raphael=void 0;try{delete window.Raphael}catch{}}return l},l.st=we,o.on("raphael.DOMload",function(){h=!0}),(mn=document).readyState==null&&mn.addEventListener&&(mn.addEventListener("DOMContentLoaded",pg=function(){mn.removeEventListener("DOMContentLoaded",pg,!1),mn.readyState="complete"},!1),mn.readyState="loading"),function p(){/in/.test(mn.readyState)?setTimeout(p,9):l.eve("raphael.DOMload")}(),l}.apply(n,s))===void 0||(e.exports=a)},function(e,n,r){var s,a;s=[r(0),r(3),r(4)],(a=function(o){return o}.apply(n,s))===void 0||(e.exports=a)},function(e,n,r){var s,a,o,l,h,c,d,f,u,g,m,y,x,C;l="hasOwnProperty",h=/[\.\/]/,c=/\s*,\s*/,d=function(v,b){return v-b},f={n:{}},u=function(){for(var v=0,b=this.length;v<b;v++)if(this[v]!==void 0)return this[v]},g=function(){for(var v=this.length;--v;)if(this[v]!==void 0)return this[v]},m=Object.prototype.toString,y=String,x=Array.isArray||function(v){return v instanceof Array||m.call(v)=="[object Array]"},(C=function(v,b){var k,T=o,R=Array.prototype.slice.call(arguments,2),A=C.listeners(v),U=0,I=[],N={},q=[],W=a;q.firstDefined=u,q.lastDefined=g,a=v,o=0;for(var K=0,it=A.length;K<it;K++)"zIndex"in A[K]&&(I.push(A[K].zIndex),A[K].zIndex<0&&(N[A[K].zIndex]=A[K]));for(I.sort(d);I[U]<0;)if(k=N[I[U++]],q.push(k.apply(b,R)),o)return o=T,q;for(K=0;K<it;K++)if("zIndex"in(k=A[K]))if(k.zIndex==I[U]){if(q.push(k.apply(b,R)),o)break;do if((k=N[I[++U]])&&q.push(k.apply(b,R)),o)break;while(k)}else N[k.zIndex]=k;else if(q.push(k.apply(b,R)),o)break;return o=T,a=W,q})._events=f,C.listeners=function(v){var b,k,T,R,A,U,I,N,q=x(v)?v:v.split(h),W=f,K=[W],it=[];for(R=0,A=q.length;R<A;R++){for(N=[],U=0,I=K.length;U<I;U++)for(k=[(W=K[U].n)[q[R]],W["*"]],T=2;T--;)(b=k[T])&&(N.push(b),it=it.concat(b.f||[]));K=N}return it},C.separator=function(v){v?(v="["+(v=y(v).replace(/(?=[\.\^\]\[\-])/g,"\\"))+"]",h=new RegExp(v)):h=/[\.\/]/},C.on=function(v,b){if(typeof b!="function")return function(){};for(var k=x(v)?x(v[0])?v:[v]:y(v).split(c),T=0,R=k.length;T<R;T++)(function(A){for(var U,I=x(A)?A:y(A).split(h),N=f,q=0,W=I.length;q<W;q++)N=(N=N.n).hasOwnProperty(I[q])&&N[I[q]]||(N[I[q]]={n:{}});for(N.f=N.f||[],q=0,W=N.f.length;q<W;q++)if(N.f[q]==b){U=!0;break}!U&&N.f.push(b)})(k[T]);return function(A){+A==+A&&(b.zIndex=+A)}},C.f=function(v){var b=[].slice.call(arguments,1);return function(){C.apply(null,[v,null].concat(b).concat([].slice.call(arguments,0)))}},C.stop=function(){o=1},C.nt=function(v){var b=x(a)?a.join("."):a;return v?new RegExp("(?:\\.|\\/|^)"+v+"(?:\\.|\\/|$)").test(b):b},C.nts=function(){return x(a)?a:a.split(h)},C.off=C.unbind=function(v,b){if(v){var k=x(v)?x(v[0])?v:[v]:y(v).split(c);if(k.length>1)for(var T=0,R=k.length;T<R;T++)C.off(k[T],b);else{k=x(v)?v:y(v).split(h);var A,U,I,N,q,W=[f];for(T=0,R=k.length;T<R;T++)for(N=0;N<W.length;N+=I.length-2){if(I=[N,1],A=W[N].n,k[T]!="*")A[k[T]]&&I.push(A[k[T]]);else for(U in A)A[l](U)&&I.push(A[U]);W.splice.apply(W,I)}for(T=0,R=W.length;T<R;T++)for(A=W[T];A.n;){if(b){if(A.f){for(N=0,q=A.f.length;N<q;N++)if(A.f[N]==b){A.f.splice(N,1);break}!A.f.length&&delete A.f}for(U in A.n)if(A.n[l](U)&&A.n[U].f){var K=A.n[U].f;for(N=0,q=K.length;N<q;N++)if(K[N]==b){K.splice(N,1);break}!K.length&&delete A.n[U].f}}else for(U in delete A.f,A.n)A.n[l](U)&&A.n[U].f&&delete A.n[U].f;A=A.n}}}else C._events=f={n:{}}},C.once=function(v,b){var k=function(){return C.off(v,k),b.apply(this,arguments)};return C.on(v,k)},C.version="0.5.0",C.toString=function(){return"You are running Eve 0.5.0"},e.exports?e.exports=C:(s=function(){return C}.apply(n,[]))===void 0||(e.exports=s)},function(e,n,r){var s,a;s=[r(0)],(a=function(o){if(!o||o.svg){var l="hasOwnProperty",h=String,c=parseFloat,d=parseInt,f=Math,u=f.max,g=f.abs,m=f.pow,y=/[, ]+/,x=o.eve,C="",v=" ",b="http://www.w3.org/1999/xlink",k={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"},T={};o.toString=function(){return`Your browser supports SVG.
|
|
27
|
+
You are running Raphaël `+this.version};var R=function(L,M){if(M)for(var E in typeof L=="string"&&(L=R(L)),M)M[l](E)&&(E.substring(0,6)=="xlink:"?L.setAttributeNS(b,E.substring(6),h(M[E])):L.setAttribute(E,h(M[E])));else(L=o._g.doc.createElementNS("http://www.w3.org/2000/svg",L)).style&&(L.style.webkitTapHighlightColor="rgba(0,0,0,0)");return L},A=function(L,M){var E="linear",F=L.id+M,z=.5,Y=.5,D=L.node,V=L.paper,X=D.style,tt=o._g.doc.getElementById(F);if(!tt){if(M=(M=h(M).replace(o._radial_gradient,function(Lt,Dt,Et){if(E="radial",Dt&&Et){z=c(Dt);var le=2*((Y=c(Et))>.5)-1;m(z-.5,2)+m(Y-.5,2)>.25&&(Y=f.sqrt(.25-m(z-.5,2))*le+.5)&&Y!=.5&&(Y=Y.toFixed(5)-1e-5*le)}return C})).split(/\s*\-\s*/),E=="linear"){var at=M.shift();if(at=-c(at),isNaN(at))return null;var gt=[0,0,f.cos(o.rad(at)),f.sin(o.rad(at))],Ct=1/(u(g(gt[2]),g(gt[3]))||1);gt[2]*=Ct,gt[3]*=Ct,gt[2]<0&&(gt[0]=-gt[2],gt[2]=0),gt[3]<0&&(gt[1]=-gt[3],gt[3]=0)}var Tt=o._parseDots(M);if(!Tt)return null;if(F=F.replace(/[\(\)\s,\xb0#]/g,"_"),L.gradient&&F!=L.gradient.id&&(V.defs.removeChild(L.gradient),delete L.gradient),!L.gradient){tt=R(E+"Gradient",{id:F}),L.gradient=tt,R(tt,E=="radial"?{fx:z,fy:Y}:{x1:gt[0],y1:gt[1],x2:gt[2],y2:gt[3],gradientTransform:L.matrix.invert()}),V.defs.appendChild(tt);for(var bt=0,Nt=Tt.length;bt<Nt;bt++)tt.appendChild(R("stop",{offset:Tt[bt].offset?Tt[bt].offset:bt?"100%":"0%","stop-color":Tt[bt].color||"#fff","stop-opacity":isFinite(Tt[bt].opacity)?Tt[bt].opacity:1}))}}return R(D,{fill:U(F),opacity:1,"fill-opacity":1}),X.fill=C,X.opacity=1,X.fillOpacity=1,1},U=function(L){if((M=document.documentMode)&&(M===9||M===10))return"url('#"+L+"')";var M,E=document.location;return"url('"+(E.protocol+"//"+E.host+E.pathname+E.search)+"#"+L+"')"},I=function(L){var M=L.getBBox(1);R(L.pattern,{patternTransform:L.matrix.invert()+" translate("+M.x+","+M.y+")"})},N=function(L,M,E){if(L.type=="path"){for(var F,z,Y,D,V,X=h(M).toLowerCase().split("-"),tt=L.paper,at=E?"end":"start",gt=L.node,Ct=L.attrs,Tt=Ct["stroke-width"],bt=X.length,Nt="classic",Lt=3,Dt=3,Et=5;bt--;)switch(X[bt]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":Nt=X[bt];break;case"wide":Dt=5;break;case"narrow":Dt=2;break;case"long":Lt=5;break;case"short":Lt=2}if(Nt=="open"?(Lt+=2,Dt+=2,Et+=2,Y=1,D=E?4:1,V={fill:"none",stroke:Ct.stroke}):(D=Y=Lt/2,V={fill:Ct.stroke,stroke:"none"}),L._.arrows?E?(L._.arrows.endPath&&T[L._.arrows.endPath]--,L._.arrows.endMarker&&T[L._.arrows.endMarker]--):(L._.arrows.startPath&&T[L._.arrows.startPath]--,L._.arrows.startMarker&&T[L._.arrows.startMarker]--):L._.arrows={},Nt!="none"){var le="raphael-marker-"+Nt,re="raphael-marker-"+at+Nt+Lt+Dt+"-obj"+L.id;o._g.doc.getElementById(le)?T[le]++:(tt.defs.appendChild(R(R("path"),{"stroke-linecap":"round",d:k[Nt],id:le})),T[le]=1);var fe,qt=o._g.doc.getElementById(re);qt?(T[re]++,fe=qt.getElementsByTagName("use")[0]):(qt=R(R("marker"),{id:re,markerHeight:Dt,markerWidth:Lt,orient:"auto",refX:D,refY:Dt/2}),fe=R(R("use"),{"xlink:href":"#"+le,transform:(E?"rotate(180 "+Lt/2+" "+Dt/2+") ":C)+"scale("+Lt/Et+","+Dt/Et+")","stroke-width":(1/((Lt/Et+Dt/Et)/2)).toFixed(4)}),qt.appendChild(fe),tt.defs.appendChild(qt),T[re]=1),R(fe,V);var De=Y*(Nt!="diamond"&&Nt!="oval");E?(F=L._.arrows.startdx*Tt||0,z=o.getTotalLength(Ct.path)-De*Tt):(F=De*Tt,z=o.getTotalLength(Ct.path)-(L._.arrows.enddx*Tt||0)),(V={})["marker-"+at]="url(#"+re+")",(z||F)&&(V.d=o.getSubpath(Ct.path,F,z)),R(gt,V),L._.arrows[at+"Path"]=le,L._.arrows[at+"Marker"]=re,L._.arrows[at+"dx"]=De,L._.arrows[at+"Type"]=Nt,L._.arrows[at+"String"]=M}else E?(F=L._.arrows.startdx*Tt||0,z=o.getTotalLength(Ct.path)-F):(F=0,z=o.getTotalLength(Ct.path)-(L._.arrows.enddx*Tt||0)),L._.arrows[at+"Path"]&&R(gt,{d:o.getSubpath(Ct.path,F,z)}),delete L._.arrows[at+"Path"],delete L._.arrows[at+"Marker"],delete L._.arrows[at+"dx"],delete L._.arrows[at+"Type"],delete L._.arrows[at+"String"];for(V in T)if(T[l](V)&&!T[V]){var Ce=o._g.doc.getElementById(V);Ce&&Ce.parentNode.removeChild(Ce)}}},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]},W=function(L,M,E){if(M=q[h(M).toLowerCase()]){for(var F=L.attrs["stroke-width"]||"1",z={round:F,square:F,butt:0}[L.attrs["stroke-linecap"]||E["stroke-linecap"]]||0,Y=[],D=M.length;D--;)Y[D]=M[D]*F+(D%2?1:-1)*z;R(L.node,{"stroke-dasharray":Y.join(",")})}else R(L.node,{"stroke-dasharray":"none"})},K=function(L,M){var E=L.node,F=L.attrs,z=E.style.visibility;for(var Y in E.style.visibility="hidden",M)if(M[l](Y)){if(!o._availableAttrs[l](Y))continue;var D=M[Y];switch(F[Y]=D,Y){case"blur":L.blur(D);break;case"title":var V=E.getElementsByTagName("title");if(V.length&&(V=V[0]))V.firstChild.nodeValue=D;else{V=R("title");var X=o._g.doc.createTextNode(D);V.appendChild(X),E.appendChild(V)}break;case"href":case"target":var tt=E.parentNode;if(tt.tagName.toLowerCase()!="a"){var at=R("a");tt.insertBefore(at,E),at.appendChild(E),tt=at}Y=="target"?tt.setAttributeNS(b,"show",D=="blank"?"new":D):tt.setAttributeNS(b,Y,D);break;case"cursor":E.style.cursor=D;break;case"transform":L.transform(D);break;case"arrow-start":N(L,D);break;case"arrow-end":N(L,D,1);break;case"clip-rect":var gt=h(D).split(y);if(gt.length==4){L.clip&&L.clip.parentNode.parentNode.removeChild(L.clip.parentNode);var Ct=R("clipPath"),Tt=R("rect");Ct.id=o.createUUID(),R(Tt,{x:gt[0],y:gt[1],width:gt[2],height:gt[3]}),Ct.appendChild(Tt),L.paper.defs.appendChild(Ct),R(E,{"clip-path":"url(#"+Ct.id+")"}),L.clip=Tt}if(!D){var bt=E.getAttribute("clip-path");if(bt){var Nt=o._g.doc.getElementById(bt.replace(/(^url\(#|\)$)/g,C));Nt&&Nt.parentNode.removeChild(Nt),R(E,{"clip-path":C}),delete L.clip}}break;case"path":L.type=="path"&&(R(E,{d:D?F.path=o._pathToAbsolute(D):"M0,0"}),L._.dirty=1,L._.arrows&&("startString"in L._.arrows&&N(L,L._.arrows.startString),"endString"in L._.arrows&&N(L,L._.arrows.endString,1)));break;case"width":if(E.setAttribute(Y,D),L._.dirty=1,!F.fx)break;Y="x",D=F.x;case"x":F.fx&&(D=-F.x-(F.width||0));case"rx":if(Y=="rx"&&L.type=="rect")break;case"cx":E.setAttribute(Y,D),L.pattern&&I(L),L._.dirty=1;break;case"height":if(E.setAttribute(Y,D),L._.dirty=1,!F.fy)break;Y="y",D=F.y;case"y":F.fy&&(D=-F.y-(F.height||0));case"ry":if(Y=="ry"&&L.type=="rect")break;case"cy":E.setAttribute(Y,D),L.pattern&&I(L),L._.dirty=1;break;case"r":L.type=="rect"?R(E,{rx:D,ry:D}):E.setAttribute(Y,D),L._.dirty=1;break;case"src":L.type=="image"&&E.setAttributeNS(b,"href",D);break;case"stroke-width":L._.sx==1&&L._.sy==1||(D/=u(g(L._.sx),g(L._.sy))||1),E.setAttribute(Y,D),F["stroke-dasharray"]&&W(L,F["stroke-dasharray"],M),L._.arrows&&("startString"in L._.arrows&&N(L,L._.arrows.startString),"endString"in L._.arrows&&N(L,L._.arrows.endString,1));break;case"stroke-dasharray":W(L,D,M);break;case"fill":var Lt=h(D).match(o._ISURL);if(Lt){Ct=R("pattern");var Dt=R("image");Ct.id=o.createUUID(),R(Ct,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),R(Dt,{x:0,y:0,"xlink:href":Lt[1]}),Ct.appendChild(Dt),function(qt){o._preload(Lt[1],function(){var De=this.offsetWidth,Ce=this.offsetHeight;R(qt,{width:De,height:Ce}),R(Dt,{width:De,height:Ce})})}(Ct),L.paper.defs.appendChild(Ct),R(E,{fill:"url(#"+Ct.id+")"}),L.pattern=Ct,L.pattern&&I(L);break}var Et=o.getRGB(D);if(Et.error){if((L.type=="circle"||L.type=="ellipse"||h(D).charAt()!="r")&&A(L,D)){if("opacity"in F||"fill-opacity"in F){var le=o._g.doc.getElementById(E.getAttribute("fill").replace(/^url\(#|\)$/g,C));if(le){var re=le.getElementsByTagName("stop");R(re[re.length-1],{"stop-opacity":("opacity"in F?F.opacity:1)*("fill-opacity"in F?F["fill-opacity"]:1)})}}F.gradient=D,F.fill="none";break}}else delete M.gradient,delete F.gradient,!o.is(F.opacity,"undefined")&&o.is(M.opacity,"undefined")&&R(E,{opacity:F.opacity}),!o.is(F["fill-opacity"],"undefined")&&o.is(M["fill-opacity"],"undefined")&&R(E,{"fill-opacity":F["fill-opacity"]});Et[l]("opacity")&&R(E,{"fill-opacity":Et.opacity>1?Et.opacity/100:Et.opacity});case"stroke":Et=o.getRGB(D),E.setAttribute(Y,Et.hex),Y=="stroke"&&Et[l]("opacity")&&R(E,{"stroke-opacity":Et.opacity>1?Et.opacity/100:Et.opacity}),Y=="stroke"&&L._.arrows&&("startString"in L._.arrows&&N(L,L._.arrows.startString),"endString"in L._.arrows&&N(L,L._.arrows.endString,1));break;case"gradient":(L.type=="circle"||L.type=="ellipse"||h(D).charAt()!="r")&&A(L,D);break;case"opacity":F.gradient&&!F[l]("stroke-opacity")&&R(E,{"stroke-opacity":D>1?D/100:D});case"fill-opacity":if(F.gradient){(le=o._g.doc.getElementById(E.getAttribute("fill").replace(/^url\(#|\)$/g,C)))&&(re=le.getElementsByTagName("stop"),R(re[re.length-1],{"stop-opacity":D}));break}default:Y=="font-size"&&(D=d(D,10)+"px");var fe=Y.replace(/(\-.)/g,function(qt){return qt.substring(1).toUpperCase()});E.style[fe]=D,L._.dirty=1,E.setAttribute(Y,D)}}it(L,M),E.style.visibility=z},it=function(L,M){if(L.type=="text"&&(M[l]("text")||M[l]("font")||M[l]("font-size")||M[l]("x")||M[l]("y"))){var E=L.attrs,F=L.node,z=F.firstChild?d(o._g.doc.defaultView.getComputedStyle(F.firstChild,C).getPropertyValue("font-size"),10):10;if(M[l]("text")){for(E.text=M.text;F.firstChild;)F.removeChild(F.firstChild);for(var Y,D=h(M.text).split(`
|
|
28
|
+
`),V=[],X=0,tt=D.length;X<tt;X++)Y=R("tspan"),X&&R(Y,{dy:1.2*z,x:E.x}),Y.appendChild(o._g.doc.createTextNode(D[X])),F.appendChild(Y),V[X]=Y}else for(X=0,tt=(V=F.getElementsByTagName("tspan")).length;X<tt;X++)X?R(V[X],{dy:1.2*z,x:E.x}):R(V[0],{dy:0});R(F,{x:E.x,y:E.y}),L._.dirty=1;var at=L._getBBox(),gt=E.y-(at.y+at.height/2);gt&&o.is(gt,"finite")&&R(V[0],{dy:gt})}},pt=function(L){return L.parentNode&&L.parentNode.tagName.toLowerCase()==="a"?L.parentNode:L},vt=function(L,M){this[0]=this.node=L,L.raphael=!0,this.id=("0000"+(Math.random()*Math.pow(36,5)<<0).toString(36)).slice(-5),L.raphaelid=this.id,this.matrix=o.matrix(),this.realPath=null,this.paper=M,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!M.bottom&&(M.bottom=this),this.prev=M.top,M.top&&(M.top.next=this),M.top=this,this.next=null},dt=o.el;vt.prototype=dt,dt.constructor=vt,o._engine.path=function(L,M){var E=R("path");M.canvas&&M.canvas.appendChild(E);var F=new vt(E,M);return F.type="path",K(F,{fill:"none",stroke:"#000",path:L}),F},dt.rotate=function(L,M,E){if(this.removed)return this;if((L=h(L).split(y)).length-1&&(M=c(L[1]),E=c(L[2])),L=c(L[0]),E==null&&(M=E),M==null||E==null){var F=this.getBBox(1);M=F.x+F.width/2,E=F.y+F.height/2}return this.transform(this._.transform.concat([["r",L,M,E]])),this},dt.scale=function(L,M,E,F){if(this.removed)return this;if((L=h(L).split(y)).length-1&&(M=c(L[1]),E=c(L[2]),F=c(L[3])),L=c(L[0]),M==null&&(M=L),F==null&&(E=F),E==null||F==null)var z=this.getBBox(1);return E=E??z.x+z.width/2,F=F??z.y+z.height/2,this.transform(this._.transform.concat([["s",L,M,E,F]])),this},dt.translate=function(L,M){return this.removed?this:((L=h(L).split(y)).length-1&&(M=c(L[1])),L=c(L[0])||0,M=+M||0,this.transform(this._.transform.concat([["t",L,M]])),this)},dt.transform=function(L){var M=this._;if(L==null)return M.transform;if(o._extractTransform(this,L),this.clip&&R(this.clip,{transform:this.matrix.invert()}),this.pattern&&I(this),this.node&&R(this.node,{transform:this.matrix}),M.sx!=1||M.sy!=1){var E=this.attrs[l]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":E})}return this},dt.hide=function(){return this.removed||(this.node.style.display="none"),this},dt.show=function(){return this.removed||(this.node.style.display=""),this},dt.remove=function(){var L=pt(this.node);if(!this.removed&&L.parentNode){var M=this.paper;for(var E in M.__set__&&M.__set__.exclude(this),x.unbind("raphael.*.*."+this.id),this.gradient&&M.defs.removeChild(this.gradient),o._tear(this,M),L.parentNode.removeChild(L),this.removeData(),this)this[E]=typeof this[E]=="function"?o._removedFactory(E):null;this.removed=!0}},dt._getBBox=function(){if(this.node.style.display=="none"){this.show();var L=!0}var M,E=!1;this.paper.canvas.parentElement?M=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(M=this.paper.canvas.parentNode.style),M&&M.display=="none"&&(E=!0,M.display="");var F={};try{F=this.node.getBBox()}catch{F={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{F=F||{},E&&(M.display="none")}return L&&this.hide(),F},dt.attr=function(L,M){if(this.removed)return this;if(L==null){var E={};for(var F in this.attrs)this.attrs[l](F)&&(E[F]=this.attrs[F]);return E.gradient&&E.fill=="none"&&(E.fill=E.gradient)&&delete E.gradient,E.transform=this._.transform,E}if(M==null&&o.is(L,"string")){if(L=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(L=="transform")return this._.transform;for(var z=L.split(y),Y={},D=0,V=z.length;D<V;D++)(L=z[D])in this.attrs?Y[L]=this.attrs[L]:o.is(this.paper.customAttributes[L],"function")?Y[L]=this.paper.customAttributes[L].def:Y[L]=o._availableAttrs[L];return V-1?Y:Y[z[0]]}if(M==null&&o.is(L,"array")){for(Y={},D=0,V=L.length;D<V;D++)Y[L[D]]=this.attr(L[D]);return Y}if(M!=null){var X={};X[L]=M}else L!=null&&o.is(L,"object")&&(X=L);for(var tt in X)x("raphael.attr."+tt+"."+this.id,this,X[tt]);for(tt in this.paper.customAttributes)if(this.paper.customAttributes[l](tt)&&X[l](tt)&&o.is(this.paper.customAttributes[tt],"function")){var at=this.paper.customAttributes[tt].apply(this,[].concat(X[tt]));for(var gt in this.attrs[tt]=X[tt],at)at[l](gt)&&(X[gt]=at[gt])}return K(this,X),this},dt.toFront=function(){if(this.removed)return this;var L=pt(this.node);L.parentNode.appendChild(L);var M=this.paper;return M.top!=this&&o._tofront(this,M),this},dt.toBack=function(){if(this.removed)return this;var L=pt(this.node),M=L.parentNode;return M.insertBefore(L,M.firstChild),o._toback(this,this.paper),this.paper,this},dt.insertAfter=function(L){if(this.removed||!L)return this;var M=pt(this.node),E=pt(L.node||L[L.length-1].node);return E.nextSibling?E.parentNode.insertBefore(M,E.nextSibling):E.parentNode.appendChild(M),o._insertafter(this,L,this.paper),this},dt.insertBefore=function(L){if(this.removed||!L)return this;var M=pt(this.node),E=pt(L.node||L[0].node);return E.parentNode.insertBefore(M,E),o._insertbefore(this,L,this.paper),this},dt.blur=function(L){var M=this;if(+L!=0){var E=R("filter"),F=R("feGaussianBlur");M.attrs.blur=L,E.id=o.createUUID(),R(F,{stdDeviation:+L||1.5}),E.appendChild(F),M.paper.defs.appendChild(E),M._blur=E,R(M.node,{filter:"url(#"+E.id+")"})}else M._blur&&(M._blur.parentNode.removeChild(M._blur),delete M._blur,delete M.attrs.blur),M.node.removeAttribute("filter");return M},o._engine.circle=function(L,M,E,F){var z=R("circle");L.canvas&&L.canvas.appendChild(z);var Y=new vt(z,L);return Y.attrs={cx:M,cy:E,r:F,fill:"none",stroke:"#000"},Y.type="circle",R(z,Y.attrs),Y},o._engine.rect=function(L,M,E,F,z,Y){var D=R("rect");L.canvas&&L.canvas.appendChild(D);var V=new vt(D,L);return V.attrs={x:M,y:E,width:F,height:z,rx:Y||0,ry:Y||0,fill:"none",stroke:"#000"},V.type="rect",R(D,V.attrs),V},o._engine.ellipse=function(L,M,E,F,z){var Y=R("ellipse");L.canvas&&L.canvas.appendChild(Y);var D=new vt(Y,L);return D.attrs={cx:M,cy:E,rx:F,ry:z,fill:"none",stroke:"#000"},D.type="ellipse",R(Y,D.attrs),D},o._engine.image=function(L,M,E,F,z,Y){var D=R("image");R(D,{x:E,y:F,width:z,height:Y,preserveAspectRatio:"none"}),D.setAttributeNS(b,"href",M),L.canvas&&L.canvas.appendChild(D);var V=new vt(D,L);return V.attrs={x:E,y:F,width:z,height:Y,src:M},V.type="image",V},o._engine.text=function(L,M,E,F){var z=R("text");L.canvas&&L.canvas.appendChild(z);var Y=new vt(z,L);return Y.attrs={x:M,y:E,"text-anchor":"middle",text:F,"font-family":o._availableAttrs["font-family"],"font-size":o._availableAttrs["font-size"],stroke:"none",fill:"#000"},Y.type="text",K(Y,Y.attrs),Y},o._engine.setSize=function(L,M){return this.width=L||this.width,this.height=M||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 L=o._getContainer.apply(0,arguments),M=L&&L.container;if(!M)throw new Error("SVG container not found.");var E,F=L.x,z=L.y,Y=L.width,D=L.height,V=R("svg"),X="overflow:hidden;";return F=F||0,z=z||0,R(V,{height:D=D||342,version:1.1,width:Y=Y||512,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),M==1?(V.style.cssText=X+"position:absolute;left:"+F+"px;top:"+z+"px",o._g.doc.body.appendChild(V),E=1):(V.style.cssText=X+"position:relative",M.firstChild?M.insertBefore(V,M.firstChild):M.appendChild(V)),(M=new o._Paper).width=Y,M.height=D,M.canvas=V,M.clear(),M._left=M._top=0,E&&(M.renderfix=function(){}),M.renderfix(),M},o._engine.setViewBox=function(L,M,E,F,z){x("raphael.setViewBox",this,this._viewBox,[L,M,E,F,z]);var Y,D,V=this.getSize(),X=u(E/V.width,F/V.height),tt=this.top,at=z?"xMidYMid meet":"xMinYMin";for(L==null?(this._vbSize&&(X=1),delete this._vbSize,Y="0 0 "+this.width+v+this.height):(this._vbSize=X,Y=L+v+M+v+E+v+F),R(this.canvas,{viewBox:Y,preserveAspectRatio:at});X&&tt;)D="stroke-width"in tt.attrs?tt.attrs["stroke-width"]:1,tt.attr({"stroke-width":D}),tt._.dirty=1,tt._.dirtyT=1,tt=tt.prev;return this._viewBox=[L,M,E,F,!!z],this},o.prototype.renderfix=function(){var L,M=this.canvas,E=M.style;try{L=M.getScreenCTM()||M.createSVGMatrix()}catch{L=M.createSVGMatrix()}var F=-L.e%1,z=-L.f%1;(F||z)&&(F&&(this._left=(this._left+F)%1,E.left=this._left+"px"),z&&(this._top=(this._top+z)%1,E.top=this._top+"px"))},o.prototype.clear=function(){o.eve("raphael.clear",this);for(var L=this.canvas;L.firstChild;)L.removeChild(L.firstChild);this.bottom=this.top=null,(this.desc=R("desc")).appendChild(o._g.doc.createTextNode("Created with Raphaël "+o.version)),L.appendChild(this.desc),L.appendChild(this.defs=R("defs"))},o.prototype.remove=function(){for(var L in x("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this)this[L]=typeof this[L]=="function"?o._removedFactory(L):null};var _t=o.st;for(var yt in dt)dt[l](yt)&&!_t[l](yt)&&(_t[yt]=function(L){return function(){var M=arguments;return this.forEach(function(E){E[L].apply(E,M)})}}(yt))}}.apply(n,s))===void 0||(e.exports=a)},function(e,n,r){var s,a;s=[r(0)],(a=function(o){if(!o||o.vml){var l="hasOwnProperty",h=String,c=parseFloat,d=Math,f=d.round,u=d.max,g=d.min,m=d.abs,y=/[, ]+/,x=o.eve,C=" ",v="",b={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},k=/([clmz]),?([^clmz]*)/gi,T=/ progid:\S+Blur\([^\)]+\)/g,R=/-?[^,\s-]+/g,A="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",U=21600,I={path:1,rect:1,image:1},N={circle:1,ellipse:1},q=function(M,E,F){var z=o.matrix();return z.rotate(-M,.5,.5),{dx:z.x(E,F),dy:z.y(E,F)}},W=function(M,E,F,z,Y,D){var V=M._,X=M.matrix,tt=V.fillpos,at=M.node,gt=at.style,Ct=1,Tt="",bt=U/E,Nt=U/F;if(gt.visibility="hidden",E&&F){if(at.coordsize=m(bt)+C+m(Nt),gt.rotation=D*(E*F<0?-1:1),D){var Lt=q(D,z,Y);z=Lt.dx,Y=Lt.dy}if(E<0&&(Tt+="x"),F<0&&(Tt+=" y")&&(Ct=-1),gt.flip=Tt,at.coordorigin=z*-bt+C+Y*-Nt,tt||V.fillsize){var Dt=at.getElementsByTagName("fill");Dt=Dt&&Dt[0],at.removeChild(Dt),tt&&(Lt=q(D,X.x(tt[0],tt[1]),X.y(tt[0],tt[1])),Dt.position=Lt.dx*Ct+C+Lt.dy*Ct),V.fillsize&&(Dt.size=V.fillsize[0]*m(E)+C+V.fillsize[1]*m(F)),at.appendChild(Dt)}gt.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 K,it=function(M,E,F){for(var z=h(E).toLowerCase().split("-"),Y=F?"end":"start",D=z.length,V="classic",X="medium",tt="medium";D--;)switch(z[D]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":V=z[D];break;case"wide":case"narrow":tt=z[D];break;case"long":case"short":X=z[D]}var at=M.node.getElementsByTagName("stroke")[0];at[Y+"arrow"]=V,at[Y+"arrowlength"]=X,at[Y+"arrowwidth"]=tt},pt=function(M,E){M.attrs=M.attrs||{};var F=M.node,z=M.attrs,Y=F.style,D=I[M.type]&&(E.x!=z.x||E.y!=z.y||E.width!=z.width||E.height!=z.height||E.cx!=z.cx||E.cy!=z.cy||E.rx!=z.rx||E.ry!=z.ry||E.r!=z.r),V=N[M.type]&&(z.cx!=E.cx||z.cy!=E.cy||z.r!=E.r||z.rx!=E.rx||z.ry!=E.ry),X=M;for(var tt in E)E[l](tt)&&(z[tt]=E[tt]);if(D&&(z.path=o._getPath[M.type](M),M._.dirty=1),E.href&&(F.href=E.href),E.title&&(F.title=E.title),E.target&&(F.target=E.target),E.cursor&&(Y.cursor=E.cursor),"blur"in E&&M.blur(E.blur),(E.path&&M.type=="path"||D)&&(F.path=function(be){var Gi=/[ahqstv]/gi,Wn=o._pathToAbsolute;if(h(be).match(Gi)&&(Wn=o._path2curve),Gi=/[clmz]/g,Wn==o._pathToAbsolute&&!h(be).match(Gi)){var $e=h(be).replace(k,function(ng,Jn,Qn){var $i=[],oo=Jn.toLowerCase()=="m",gn=b[Jn];return Qn.replace(R,function(lo){oo&&$i.length==2&&(gn+=$i+b[Jn=="m"?"l":"L"],$i=[]),$i.push(f(lo*U))}),gn+$i});return $e}var Kn,He,zs=Wn(be);$e=[];for(var Zn=0,js=zs.length;Zn<js;Zn++){Kn=zs[Zn],(He=zs[Zn][0].toLowerCase())=="z"&&(He="x");for(var Bi=1,Ee=Kn.length;Bi<Ee;Bi++)He+=f(Kn[Bi]*U)+(Bi!=Ee-1?",":v);$e.push(He)}return $e.join(C)}(~h(z.path).toLowerCase().indexOf("r")?o._pathToAbsolute(z.path):z.path),M._.dirty=1,M.type=="image"&&(M._.fillpos=[z.x,z.y],M._.fillsize=[z.width,z.height],W(M,1,1,0,0,0))),"transform"in E&&M.transform(E.transform),V){var at=+z.cx,gt=+z.cy,Ct=+z.rx||+z.r||0,Tt=+z.ry||+z.r||0;F.path=o.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((at-Ct)*U),f((gt-Tt)*U),f((at+Ct)*U),f((gt+Tt)*U),f(at*U)),M._.dirty=1}if("clip-rect"in E){var bt=h(E["clip-rect"]).split(y);if(bt.length==4){bt[2]=+bt[2]+ +bt[0],bt[3]=+bt[3]+ +bt[1];var Nt=F.clipRect||o._g.doc.createElement("div"),Lt=Nt.style;Lt.clip=o.format("rect({1}px {2}px {3}px {0}px)",bt),F.clipRect||(Lt.position="absolute",Lt.top=0,Lt.left=0,Lt.width=M.paper.width+"px",Lt.height=M.paper.height+"px",F.parentNode.insertBefore(Nt,F),Nt.appendChild(F),F.clipRect=Nt)}E["clip-rect"]||F.clipRect&&(F.clipRect.style.clip="auto")}if(M.textpath){var Dt=M.textpath.style;E.font&&(Dt.font=E.font),E["font-family"]&&(Dt.fontFamily='"'+E["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,v)+'"'),E["font-size"]&&(Dt.fontSize=E["font-size"]),E["font-weight"]&&(Dt.fontWeight=E["font-weight"]),E["font-style"]&&(Dt.fontStyle=E["font-style"])}if("arrow-start"in E&&it(X,E["arrow-start"]),"arrow-end"in E&&it(X,E["arrow-end"],1),E.opacity!=null||E.fill!=null||E.src!=null||E.stroke!=null||E["stroke-width"]!=null||E["stroke-opacity"]!=null||E["fill-opacity"]!=null||E["stroke-dasharray"]!=null||E["stroke-miterlimit"]!=null||E["stroke-linejoin"]!=null||E["stroke-linecap"]!=null){var Et=F.getElementsByTagName("fill");if(!(Et=Et&&Et[0])&&(Et=K("fill")),M.type=="image"&&E.src&&(Et.src=E.src),E.fill&&(Et.on=!0),Et.on!=null&&E.fill!="none"&&E.fill!==null||(Et.on=!1),Et.on&&E.fill){var le=h(E.fill).match(o._ISURL);if(le){Et.parentNode==F&&F.removeChild(Et),Et.rotate=!0,Et.src=le[1],Et.type="tile";var re=M.getBBox(1);Et.position=re.x+C+re.y,M._.fillpos=[re.x,re.y],o._preload(le[1],function(){M._.fillsize=[this.offsetWidth,this.offsetHeight]})}else Et.color=o.getRGB(E.fill).hex,Et.src=v,Et.type="solid",o.getRGB(E.fill).error&&(X.type in{circle:1,ellipse:1}||h(E.fill).charAt()!="r")&&vt(X,E.fill,Et)&&(z.fill="none",z.gradient=E.fill,Et.rotate=!1)}if("fill-opacity"in E||"opacity"in E){var fe=((+z["fill-opacity"]+1||2)-1)*((+z.opacity+1||2)-1)*((+o.getRGB(E.fill).o+1||2)-1);fe=g(u(fe,0),1),Et.opacity=fe,Et.src&&(Et.color="none")}F.appendChild(Et);var qt=F.getElementsByTagName("stroke")&&F.getElementsByTagName("stroke")[0],De=!1;!qt&&(De=qt=K("stroke")),(E.stroke&&E.stroke!="none"||E["stroke-width"]||E["stroke-opacity"]!=null||E["stroke-dasharray"]||E["stroke-miterlimit"]||E["stroke-linejoin"]||E["stroke-linecap"])&&(qt.on=!0),(E.stroke=="none"||E.stroke===null||qt.on==null||E.stroke==0||E["stroke-width"]==0)&&(qt.on=!1);var Ce=o.getRGB(E.stroke);qt.on&&E.stroke&&(qt.color=Ce.hex),fe=((+z["stroke-opacity"]+1||2)-1)*((+z.opacity+1||2)-1)*((+Ce.o+1||2)-1);var Ni=.75*(c(E["stroke-width"])||1);if(fe=g(u(fe,0),1),E["stroke-width"]==null&&(Ni=z["stroke-width"]),E["stroke-width"]&&(qt.weight=Ni),Ni&&Ni<1&&(fe*=Ni)&&(qt.weight=1),qt.opacity=fe,E["stroke-linejoin"]&&(qt.joinstyle=E["stroke-linejoin"]||"miter"),qt.miterlimit=E["stroke-miterlimit"]||8,E["stroke-linecap"]&&(qt.endcap=E["stroke-linecap"]=="butt"?"flat":E["stroke-linecap"]=="square"?"square":"round"),"stroke-dasharray"in E){var Bs={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};qt.dashstyle=Bs[l](E["stroke-dasharray"])?Bs[E["stroke-dasharray"]]:v}De&&F.appendChild(qt)}if(X.type=="text"){X.paper.canvas.style.display=v;var Ui=X.paper.span,qn=z.font&&z.font.match(/\d+(?:\.\d*)?(?=px)/);Y=Ui.style,z.font&&(Y.font=z.font),z["font-family"]&&(Y.fontFamily=z["font-family"]),z["font-weight"]&&(Y.fontWeight=z["font-weight"]),z["font-style"]&&(Y.fontStyle=z["font-style"]),qn=c(z["font-size"]||qn&&qn[0])||10,Y.fontSize=100*qn+"px",X.textpath.string&&(Ui.innerHTML=h(X.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\n/g,"<br>"));var Xn=Ui.getBoundingClientRect();X.W=z.w=(Xn.right-Xn.left)/100,X.H=z.h=(Xn.bottom-Xn.top)/100,X.X=z.x,X.Y=z.y+X.H/2,("x"in E||"y"in E)&&(X.path.v=o.format("m{0},{1}l{2},{1}",f(z.x*U),f(z.y*U),f(z.x*U)+1));for(var $s=["x","y","text","font","font-family","font-weight","font-style","font-size"],Yn=0,ao=$s.length;Yn<ao;Yn++)if($s[Yn]in E){X._.dirty=1;break}switch(z["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}},vt=function(M,E,F){M.attrs=M.attrs||{},M.attrs;var z=Math.pow,Y="linear",D=".5 .5";if(M.attrs.gradient=E,E=(E=h(E).replace(o._radial_gradient,function(Ct,Tt,bt){return Y="radial",Tt&&bt&&(Tt=c(Tt),bt=c(bt),z(Tt-.5,2)+z(bt-.5,2)>.25&&(bt=d.sqrt(.25-z(Tt-.5,2))*(2*(bt>.5)-1)+.5),D=Tt+C+bt),v})).split(/\s*\-\s*/),Y=="linear"){var V=E.shift();if(V=-c(V),isNaN(V))return null}var X=o._parseDots(E);if(!X)return null;if(M=M.shape||M.node,X.length){M.removeChild(F),F.on=!0,F.method="none",F.color=X[0].color,F.color2=X[X.length-1].color;for(var tt=[],at=0,gt=X.length;at<gt;at++)X[at].offset&&tt.push(X[at].offset+C+X[at].color);F.colors=tt.length?tt.join():"0% "+F.color,Y=="radial"?(F.type="gradientTitle",F.focus="100%",F.focussize="0 0",F.focusposition=D,F.angle=0):(F.type="gradient",F.angle=(270-V)%360),M.appendChild(F)}return 1},dt=function(M,E){this[0]=this.node=M,M.raphael=!0,this.id=o._oid++,M.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=E,this.matrix=o.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!E.bottom&&(E.bottom=this),this.prev=E.top,E.top&&(E.top.next=this),E.top=this,this.next=null},_t=o.el;dt.prototype=_t,_t.constructor=dt,_t.transform=function(M){if(M==null)return this._.transform;var E,F=this.paper._viewBoxShift,z=F?"s"+[F.scale,F.scale]+"-1-1t"+[F.dx,F.dy]:v;F&&(E=M=h(M).replace(/\.{3}|\u2026/g,this._.transform||v)),o._extractTransform(this,z+M);var Y,D=this.matrix.clone(),V=this.skew,X=this.node,tt=~h(this.attrs.fill).indexOf("-"),at=!h(this.attrs.fill).indexOf("url(");if(D.translate(1,1),at||tt||this.type=="image")if(V.matrix="1 0 0 1",V.offset="0 0",Y=D.split(),tt&&Y.noRotation||!Y.isSimple){X.style.filter=D.toFilter();var gt=this.getBBox(),Ct=this.getBBox(1),Tt=gt.x-Ct.x,bt=gt.y-Ct.y;X.coordorigin=Tt*-U+C+bt*-U,W(this,1,1,Tt,bt,0)}else X.style.filter=v,W(this,Y.scalex,Y.scaley,Y.dx,Y.dy,Y.rotate);else X.style.filter=v,V.matrix=h(D),V.offset=D.offset();return E!==null&&(this._.transform=E,o._extractTransform(this,E)),this},_t.rotate=function(M,E,F){if(this.removed)return this;if(M!=null){if((M=h(M).split(y)).length-1&&(E=c(M[1]),F=c(M[2])),M=c(M[0]),F==null&&(E=F),E==null||F==null){var z=this.getBBox(1);E=z.x+z.width/2,F=z.y+z.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",M,E,F]])),this}},_t.translate=function(M,E){return this.removed?this:((M=h(M).split(y)).length-1&&(E=c(M[1])),M=c(M[0])||0,E=+E||0,this._.bbox&&(this._.bbox.x+=M,this._.bbox.y+=E),this.transform(this._.transform.concat([["t",M,E]])),this)},_t.scale=function(M,E,F,z){if(this.removed)return this;if((M=h(M).split(y)).length-1&&(E=c(M[1]),F=c(M[2]),z=c(M[3]),isNaN(F)&&(F=null),isNaN(z)&&(z=null)),M=c(M[0]),E==null&&(E=M),z==null&&(F=z),F==null||z==null)var Y=this.getBBox(1);return F=F??Y.x+Y.width/2,z=z??Y.y+Y.height/2,this.transform(this._.transform.concat([["s",M,E,F,z]])),this._.dirtyT=1,this},_t.hide=function(){return!this.removed&&(this.node.style.display="none"),this},_t.show=function(){return!this.removed&&(this.node.style.display=v),this},_t.auxGetBBox=o.el.getBBox,_t.getBBox=function(){var M=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var E={},F=1/this.paper._viewBoxShift.scale;return E.x=M.x-this.paper._viewBoxShift.dx,E.x*=F,E.y=M.y-this.paper._viewBoxShift.dy,E.y*=F,E.width=M.width*F,E.height=M.height*F,E.x2=E.x+E.width,E.y2=E.y+E.height,E}return M},_t._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}},_t.remove=function(){if(!this.removed&&this.node.parentNode){for(var M 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[M]=typeof this[M]=="function"?o._removedFactory(M):null;this.removed=!0}},_t.attr=function(M,E){if(this.removed)return this;if(M==null){var F={};for(var z in this.attrs)this.attrs[l](z)&&(F[z]=this.attrs[z]);return F.gradient&&F.fill=="none"&&(F.fill=F.gradient)&&delete F.gradient,F.transform=this._.transform,F}if(E==null&&o.is(M,"string")){if(M=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;for(var Y=M.split(y),D={},V=0,X=Y.length;V<X;V++)(M=Y[V])in this.attrs?D[M]=this.attrs[M]:o.is(this.paper.customAttributes[M],"function")?D[M]=this.paper.customAttributes[M].def:D[M]=o._availableAttrs[M];return X-1?D:D[Y[0]]}if(this.attrs&&E==null&&o.is(M,"array")){for(D={},V=0,X=M.length;V<X;V++)D[M[V]]=this.attr(M[V]);return D}var tt;for(var at in E!=null&&((tt={})[M]=E),E==null&&o.is(M,"object")&&(tt=M),tt)x("raphael.attr."+at+"."+this.id,this,tt[at]);if(tt){for(at in this.paper.customAttributes)if(this.paper.customAttributes[l](at)&&tt[l](at)&&o.is(this.paper.customAttributes[at],"function")){var gt=this.paper.customAttributes[at].apply(this,[].concat(tt[at]));for(var Ct in this.attrs[at]=tt[at],gt)gt[l](Ct)&&(tt[Ct]=gt[Ct])}tt.text&&this.type=="text"&&(this.textpath.string=tt.text),pt(this,tt)}return this},_t.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&o._tofront(this,this.paper),this},_t.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)},_t.insertAfter=function(M){return this.removed?this:(M.constructor==o.st.constructor&&(M=M[M.length-1]),M.node.nextSibling?M.node.parentNode.insertBefore(this.node,M.node.nextSibling):M.node.parentNode.appendChild(this.node),o._insertafter(this,M,this.paper),this)},_t.insertBefore=function(M){return this.removed?this:(M.constructor==o.st.constructor&&(M=M[0]),M.node.parentNode.insertBefore(this.node,M.node),o._insertbefore(this,M,this.paper),this)},_t.blur=function(M){var E=this.node.runtimeStyle,F=E.filter;return F=F.replace(T,v),+M!=0?(this.attrs.blur=M,E.filter=F+C+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+M||1.5)+")",E.margin=o.format("-{0}px 0 0 -{0}px",f(+M||1.5))):(E.filter=F,E.margin=0,delete this.attrs.blur),this},o._engine.path=function(M,E){var F=K("shape");F.style.cssText=A,F.coordsize=U+C+U,F.coordorigin=E.coordorigin;var z=new dt(F,E),Y={fill:"none",stroke:"#000"};M&&(Y.path=M),z.type="path",z.path=[],z.Path=v,pt(z,Y),E.canvas&&E.canvas.appendChild(F);var D=K("skew");return D.on=!0,F.appendChild(D),z.skew=D,z.transform(v),z},o._engine.rect=function(M,E,F,z,Y,D){var V=o._rectPath(E,F,z,Y,D),X=M.path(V),tt=X.attrs;return X.X=tt.x=E,X.Y=tt.y=F,X.W=tt.width=z,X.H=tt.height=Y,tt.r=D,tt.path=V,X.type="rect",X},o._engine.ellipse=function(M,E,F,z,Y){var D=M.path();return D.attrs,D.X=E-z,D.Y=F-Y,D.W=2*z,D.H=2*Y,D.type="ellipse",pt(D,{cx:E,cy:F,rx:z,ry:Y}),D},o._engine.circle=function(M,E,F,z){var Y=M.path();return Y.attrs,Y.X=E-z,Y.Y=F-z,Y.W=Y.H=2*z,Y.type="circle",pt(Y,{cx:E,cy:F,r:z}),Y},o._engine.image=function(M,E,F,z,Y,D){var V=o._rectPath(F,z,Y,D),X=M.path(V).attr({stroke:"none"}),tt=X.attrs,at=X.node,gt=at.getElementsByTagName("fill")[0];return tt.src=E,X.X=tt.x=F,X.Y=tt.y=z,X.W=tt.width=Y,X.H=tt.height=D,tt.path=V,X.type="image",gt.parentNode==at&&at.removeChild(gt),gt.rotate=!0,gt.src=E,gt.type="tile",X._.fillpos=[F,z],X._.fillsize=[Y,D],at.appendChild(gt),W(X,1,1,0,0,0),X},o._engine.text=function(M,E,F,z){var Y=K("shape"),D=K("path"),V=K("textpath");E=E||0,F=F||0,z=z||"",D.v=o.format("m{0},{1}l{2},{1}",f(E*U),f(F*U),f(E*U)+1),D.textpathok=!0,V.string=h(z),V.on=!0,Y.style.cssText=A,Y.coordsize=U+C+U,Y.coordorigin="0 0";var X=new dt(Y,M),tt={fill:"#000",stroke:"none",font:o._availableAttrs.font,text:z};X.shape=Y,X.path=D,X.textpath=V,X.type="text",X.attrs.text=h(z),X.attrs.x=E,X.attrs.y=F,X.attrs.w=1,X.attrs.h=1,pt(X,tt),Y.appendChild(V),Y.appendChild(D),M.canvas.appendChild(Y);var at=K("skew");return at.on=!0,Y.appendChild(at),X.skew=at,X.transform(v),X},o._engine.setSize=function(M,E){var F=this.canvas.style;return this.width=M,this.height=E,M==+M&&(M+="px"),E==+E&&(E+="px"),F.width=M,F.height=E,F.clip="rect(0 "+M+" "+E+" 0)",this._viewBox&&o._engine.setViewBox.apply(this,this._viewBox),this},o._engine.setViewBox=function(M,E,F,z,Y){o.eve("raphael.setViewBox",this,this._viewBox,[M,E,F,z,Y]);var D,V,X=this.getSize(),tt=X.width,at=X.height;return Y&&(F*(D=at/z)<tt&&(M-=(tt-F*D)/2/D),z*(V=tt/F)<at&&(E-=(at-z*V)/2/V)),this._viewBox=[M,E,F,z,!!Y],this._viewBoxShift={dx:-M,dy:-E,scale:X},this.forEach(function(gt){gt.transform("...")}),this},o._engine.initWin=function(M){var E=M.document;E.styleSheets.length<31?E.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):E.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!E.namespaces.rvml&&E.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),K=function(F){return E.createElement("<rvml:"+F+' class="rvml">')}}catch{K=function(z){return E.createElement("<"+z+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},o._engine.initWin(o._g.win),o._engine.create=function(){var M=o._getContainer.apply(0,arguments),E=M.container,F=M.height,z=M.width,Y=M.x,D=M.y;if(!E)throw new Error("VML container not found.");var V=new o._Paper,X=V.canvas=o._g.doc.createElement("div"),tt=X.style;return Y=Y||0,D=D||0,z=z||512,F=F||342,V.width=z,V.height=F,z==+z&&(z+="px"),F==+F&&(F+="px"),V.coordsize=216e5+C+216e5,V.coordorigin="0 0",V.span=o._g.doc.createElement("span"),V.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",X.appendChild(V.span),tt.cssText=o.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",z,F),E==1?(o._g.doc.body.appendChild(X),tt.left=Y+"px",tt.top=D+"px",tt.position="absolute"):E.firstChild?E.insertBefore(X,E.firstChild):E.appendChild(X),V.renderfix=function(){},V},o.prototype.clear=function(){o.eve("raphael.clear",this),this.canvas.innerHTML=v,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 M in o.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas),this)this[M]=typeof this[M]=="function"?o._removedFactory(M):null;return!0};var yt=o.st;for(var L in _t)_t[l](L)&&!yt[l](L)&&(yt[L]=function(M){return function(){var E=arguments;return this.forEach(function(F){F[M].apply(F,E)})}}(L))}}.apply(n,s))===void 0||(e.exports=a)}])})})(f0);var By=f0.exports;const _e=Pe(By);_e.easing_formulas.swing=function(i){return i+Math.sin(i*Math.PI*2)/2},_e.easing_formulas.may_cause_seizures=function(i){return i+.2*Math.random()-.1};function $y(i,t,e){let n;return i&&typeof i=="object"&&i.canvas?n=i:i&&(typeof i=="string"||i instanceof HTMLElement)?n=_e(i,t,e):n=_e(0,0,t,e),n}_e.fn.NPolygonPath=function(i,t,e,n,r=2){return{shape:this.path(Nr.generateInMultiplePoint(i,t,e,n,r).toSVGPathD()),afterPath:Nr.generateInMultiplePoint(i,t,e*r,n,1).toSVGPathD()}},_e.fn.zoom=function(i=1){return this.setViewBox(0,0,this.width/i,this.height/i),this},_e.fn.importSVG=function(i){return zy.fromSVG(i).toRaphael(this),this},_e.fn.brickwall=function(i,t,e,n,r){for(var s=n/r,a=e/3,o={fill:"firebrick",stroke:"#CCC"},l=0;l<r;l+=1){var h=this.rect(0,0,a,s).attr(o),c=this.rect(0,0,2*a,s).attr(o);l%2?(h.transform("T"+i+","+(t+l*s)),c.transform("T"+(i+a)+","+(t+l*s))):(c.transform("T"+i+","+(t+l*s)),h.transform("T"+(i+2*a)+","+(t+l*s)))}},_e.fn.rosetta=function(i,t,e,n,r){const s=en.generateRosetta(i,t,e,n,r);return s.center,this.path(s.toSVGPathD())},_e.fn.moon=function(i){i=i||{},i.r=typeof i.r=="number"?i.r:100,i.phase=typeof i.phase=="number"?i.phase:.25,i.x=typeof i.x=="number"?i.x:0,i.y=typeof i.y=="number"?i.y:0,this.circle(i.r+i.x,i.r+i.y,i.r).attr({"stroke-width":0,fill:"#999"});function t(n){n=typeof n=="number"?n:.25,n=Math.max(0,Math.min(1,n)),n=(n-.5)*2;let r="M"+i.r+",0";r+="a"+i.r+","+i.r+" 0 0,0 0,"+i.r*2;let s=n>0?0:1;return n=Math.abs(n),n=n||1e-4,i.inner_r=i.r/Math.pow(n,.5),r+="M"+i.r+","+i.r*2,r+="a"+i.inner_r+","+i.inner_r+" 0 0,"+s+" 0,"+i.r*-2,r}var e=this.path(t(i.phase)).attr({"stroke-width":0,stroke:"#999",fill:"#FF9"}).transform("T"+i.x+","+i.y);return{setPhase:function(n){e.attr("path",t(n))}}},_e.fn.star=function(i,t,e){let n="M"+i+","+(t-e);for(var r=0;r<6;r+=1){const s=270+r*144,a=i+e*Math.cos(s*Math.PI/180),o=t+e*Math.sin(s*Math.PI/180);n+="L"+a+","+o}return this.path(n).attr("stroke-width",0).attr("fill","red")},_e.fn.heart=function(i=150,t=300){let e="M"+i+","+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")},_e.el.redder=function(){const i=_e.getRGB(this.attr("fill"));i.r+=51,this.attr("fill","rgb("+i.r+","+i.g+","+i.b+")")},_e.installCustomAttributes=function(i){i.customAttributes.redness=function(t){const e=255*(1-t/100);return{fill:"rgb(255,"+e+", "+e+")"}},i.customAttributes.progress=function(t){const e=this.data("progresspath"),n=this.attr(),r={x:0,y:0},s=this.data("progresstrail");if(!e)return{transform:"t0,0"};Object.prototype.hasOwnProperty.call(n,"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 Ol=_e;let d0=class kg{pgs=[];history=[];save(){this.history.push(zh(this.pgs))}restore(){const t=this.history.pop();t&&(this.pgs=t)}get size(){let t=0,e=0;return this.pgs.forEach(n=>{const r=n.pg;if(r){const[s,a,o,l]=r.bounds,[h,c]=r.size;t=Math.max(t,s,s+h,o),e=Math.max(e,a,a+c,l)}}),[Math.ceil(t),Math.ceil(e)]}static fromSVG(t){const e=new kg,n=h0(t);for(let r=0,s=n.length;r<s;r++){const a=n[r],o={attrs:{}};for(const l in a)l==="type"||l==="path"||(o.attrs[l]=a[l]);switch(a.type){case"path":o.d=a.path,o.pg=en.fromSVGPathD(a.path);break}e.pgs.push(o)}return e}toRaphael(t){let e;t instanceof HTMLElement?e=Ol(HTMLElement):typeof t=="string"?e=Ol(document.getElementById(t)):e=t;const[n,r]=this.size;e.setSize(n,r);for(let s=0,a=this.pgs.length;s<a;s++){const o=this.pgs[s];o.pg&&e.path(o.pg.toSVGPathD()).attr(o.attrs)}}toCanvas(t,e){typeof t=="string"&&(t=document.getElementById(t));const n=t.getContext("2d"),[r,s]=this.size;t.width=r,t.height=s,n.clearRect(0,0,r,s);for(let a=0,o=this.pgs.length;a<o;a++){n.save();const l=this.pgs[a];l.pg&&l.pg.toCanvas(n),l.attrs&&this.toCanvasAttrs(n,l.attrs),n.fill(),n.stroke(),n.restore()}if(e){const a=o=>{const{x:l,y:h}=dr(n.canvas,o),c=this.pgs.find(d=>d.pg?.isPointInPath(l,h));c&&e?.(c)};t.removeEventListener("click",a),t.addEventListener("click",a)}return n}toCanvasAttrs(t,e){for(const n in e){const r=e[n];switch(n){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}}}};const zy=d0,g0=jy("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 jy(i,t=10){const e={},n=i.split(",");for(let r=0;r<n.length;r+=2){const s="&"+n[r+1]+";",a=parseInt(n[r],t);e[s]="&#"+a+";"}return e["\\xa0"]=" ",e}function Se(i,t){const e=Object.keys(t);for(let n=0;n<e.length;n++)i=i.replace(new RegExp("{"+e[n]+"}","gi"),""+t[e[n]]);return i}function La(i){let t,e;if(!i)throw new Error("cannot create a random attribute name for an undefined object");const n="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";t="";do for(t="",e=0;e<12;e++)t+=n[Math.floor(Math.random()*n.length)];while(i[t]);return t}function Hy(i){const t={left:"start",right:"end",center:"middle",start:"start",end:"end"};return t[i]||t.start}function Vy(i){const t={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return t[i]||t.alphabetic}const Hr={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 Fl{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}addColorStop(t,e){const n=this.__ctx.__createElement("stop");if(n.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&&(n.setAttribute("stop-color",Se("rgb({r},{g},{b})",{r:s[1],g:s[2],b:s[3]})),n.setAttribute("stop-opacity",s[4]))}else n.setAttribute("stop-color",e);this.__root.appendChild(n)}}class p0{__root;__ctx;constructor(t,e){this.__root=t,this.__ctx=e}}class Da{__document=document;__canvas;__ctx;width;height;__styleStack;__groupStack;__rootSVG;__ids;__SVGdefs;__currentElement;__currentElementsToStyle=null;constructor({canvas:t,width:e=500,height:n=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=n),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(Hr);for(let e=0,n=t.length;e<n;e++){const r=t[e];this[r]=Hr[r].canvas}}__getStyleState(){const t={},e=Object.keys(Hr);for(let n=0,r=e.length;n<r;n++){const s=e[n];t[s]=this[s]}return t}__applyStyleState(t){const e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){const s=e[n];this[s]=t[s]}}__createElement(t,e={},n=!1){const r=this.__document.createElementNS("http://www.w3.org/2000/svg",t),s=Object.keys(e);n&&(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 n=this.__currentElementsToStyle;n&&(e.setAttribute(t,""),e=n.element,n.children.forEach(s=>{s.setAttribute(t,"")}));const r=Object.keys(Hr);for(let s=0;s<r.length;s++){const a=Hr[r[s]],o=this[r[s]];if(a.apply){if(o instanceof p0){if(o.__ctx)for(;o.__ctx.__SVGdefs.childNodes.length;){const l=o.__ctx.__SVGdefs.childNodes[0].getAttribute("id");this.__ids[l]=l,this.__SVGdefs.appendChild(o.__ctx.__SVGdefs.childNodes[0])}e.setAttribute(a.apply,Se("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof Fl)e.setAttribute(a.apply,Se("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 h=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o);e.setAttribute(a.svgAttr,Se("rgb({r},{g},{b})",{r:h[1],g:h[2],b:h[3]}));let c=parseFloat(h[4]);const d=this.globalAlpha;d!=null&&(c*=d),e.setAttribute(a.svgAttr+"-opacity",""+c)}else{let l=a.svgAttr;if(r[s]==="globalAlpha"&&(l=t+"-"+a.svgAttr,e.getAttribute(l)))continue;l&&e.setAttribute(l,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(g0);for(let s=0,a=r.length;s<a;s++){const o=r[s],l=g0[o],h=new RegExp(o,"gi");h.test(e)&&(e=e.replace(h,l))}}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 n=this.__currentElement.getAttribute("transform");n?n+=" ":n="",n+=t,this.__currentElement.setAttribute("transform",n)}scale(t,e){e===void 0&&(e=t),this.__addTransform(Se("scale({x},{y})",{x:t,y:e}))}rotate(t){const e=t*180/Math.PI;this.__addTransform(Se("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))}translate(t,e){this.__addTransform(Se("translate({x},{y})",{x:t,y:e}))}transform(t,e,n,r,s,a){this.__addTransform(Se("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:n,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(Se("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(Se("L {x} {y}",this.__currentPosition)):this.__addPathCommand(Se("M {x} {y}",this.__currentPosition))}bezierCurveTo(t,e,n,r,s,a){this.__currentPosition={x:s,y:a},this.__addPathCommand(Se("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:n,cp2y:r,x:s,y:a}))}quadraticCurveTo(t,e,n,r){this.__currentPosition={x:n,y:r},this.__addPathCommand(Se("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:n,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,n,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===n&&e===r||s===0){this.lineTo(t,e);return}const l=this.normalize([a-t,o-e]),h=this.normalize([n-t,r-e]);if(l[0]*h[1]===l[1]*h[0]){this.lineTo(t,e);return}const c=l[0]*h[0]+l[1]*h[1],d=Math.acos(Math.abs(c)),f=this.normalize([l[0]+h[0],l[1]+h[1]]),u=s/Math.sin(d/2),g=t+u*f[0],m=e+u*f[1],y=[-l[1],l[0]],x=[h[1],-h[0]],C=function(k){const T=k[0];return k[1]>=0?Math.acos(T):-Math.acos(T)},v=C(y),b=C(x);this.lineTo(g+y[0]*s,m+y[1]*s),this.arc(g,m,s,v,b)}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,n,r){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+n,e),this.lineTo(t+n,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.closePath()}fillRect(t,e,n,r){const s=this.__createElement("rect",{x:t,y:e,width:n,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("fill")}strokeRect(t,e,n,r){const s=this.__createElement("rect",{x:t,y:e,width:n,height:r},!0);this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("stroke")}__clearCanvas(){const e=this.__closestGroupOrSvg().getAttribute("transform"),n=this.__rootSVG.childNodes[1],r=n.childNodes;for(let s=r.length-1;s>=0;s--)r[s]&&n.removeChild(r[s]);this.__currentElement=n,this.__groupStack=[],e&&this.__addTransform(e)}clearRect(t,e,n,r){if(t===0&&e===0&&n===this.width&&r===this.height){this.__clearCanvas();return}const s=this.__closestGroupOrSvg(),a=this.__createElement("rect",{x:t,y:e,width:n,height:r,fill:"#FFFFFF"},!0);s.appendChild(a)}createLinearGradient(t,e,n,r){const s=this.__createElement("linearGradient",{id:La(this.__ids),x1:t+"px",x2:n+"px",y1:e+"px",y2:r+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__SVGdefs.appendChild(s),new Fl(s,this)}createRadialGradient(t,e,n,r,s,a){const o=this.__createElement("radialGradient",{id:La(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 Fl(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),n={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"&&(n.decoration="underline"),this.__fontHref&&(n.href=this.__fontHref),n}__wrapTextLink(t,e){if(t.href){const n=this.__createElement("a");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),n.appendChild(e),n}return e}__applyText(t,e,n,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:n,"text-anchor":Hy(this.textAlign),"dominant-baseline":Vy(this.textBaseline)},!0);o.appendChild(this.__document.createTextNode(t)),this.__currentElement=o,this.__applyStyleToCurrentElement(r),a.appendChild(this.__wrapTextLink(s,o))}fillText(t,e,n){this.__applyText(t,e,n,"fill")}strokeText(t,e,n){this.__applyText(t,e,n,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,n,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+n*Math.cos(s),l=e+n*Math.sin(s),h=t+n*Math.cos(r),c=e+n*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(h,c),this.__addPathCommand(Se("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:n,ry:n,xAxisRotation:0,largeArcFlag:f,sweepFlag:d,endX:o,endY:l})),this.__currentPosition={x:o,y:l}}clip(){const t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),n=La(this.__ids),r=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",n),e.appendChild(this.__currentElement),this.__SVGdefs.appendChild(e),t.setAttribute("clip-path",Se("url(#{id})",{id:n})),t.appendChild(r),this.__currentElement=r}drawImage(...t){let e=t[0],n,r,s,a,o=0,l=0,h,c,d,f,u,g,m,y;if(t.length===3)n=t[1],r=t[2],h=e.width,c=e.height,s=h,a=c;else if(t.length===5)n=t[1],r=t[2],s=t[3],a=t[4],h=e.width,c=e.height;else if(t.length===9)o=t[1],l=t[2],h=t[3],c=t[4],n=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 x=this.__closestGroupOrSvg();this.__currentElement;const C="translate("+n+", "+r+")";if(e instanceof Da){if(d=e.getSvg().cloneNode(!0),d.childNodes&&d.childNodes.length>1){for(f=d.childNodes[0];f.childNodes.length;)y=f.childNodes[0].getAttribute("id"),this.__ids[y]=y,this.__SVGdefs.appendChild(f.childNodes[0]);if(u=d.childNodes[1],u){const v=u.getAttribute("transform");let b;v?b=v+" "+C:b=C,u.setAttribute("transform",b),x.appendChild(u)}}}else(e.nodeName==="CANVAS"||e.nodeName==="IMG")&&(g=this.__createElement("image"),g.setAttribute("width",s),g.setAttribute("height",a),g.setAttribute("preserveAspectRatio","none"),(o||l||h!==e.width||c!==e.height)&&(m=this.__document.createElement("canvas"),m.width=s,m.height=a,m.getContext("2d")?.drawImage(e,o,l,h,c,0,0,s,a),e=m),g.setAttribute("transform",C),g.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.nodeName==="CANVAS"?e.toDataURL():e.getAttribute("src")),x.appendChild(g))}createPattern(t,e){const n=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),r=La(this.__ids);let s;return n.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")),n.appendChild(s),this.__SVGdefs.appendChild(n)):t instanceof Da&&(n.setAttribute("width",""+t.width),n.setAttribute("height",""+t.height),n.appendChild(t.__rootSVG.childNodes[1]),this.__SVGdefs.appendChild(n)),new p0(n,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}drawFocusRing(){}createImageData(){}getImageData(){}putImageData(){}globalCompositeOperation(){}setTransform(){}}const qy=Da,Xy=function(i,t,e,n,r,s){i.beginPath(),i.moveTo(t,e+s),i.lineTo(t,e+r-s),i.quadraticCurveTo(t,e+r,t+s,e+r),i.lineTo(t+n-s,e+r),i.quadraticCurveTo(t+n,e+r,t+n,e+r-s),i.lineTo(t+n,e+s),i.quadraticCurveTo(t+n,e,t+n-s,e),i.lineTo(t+s,e),i.quadraticCurveTo(t,e,t,e+s),i.stroke()},Yy=function(i,t,e,n){var r=t-n,s=0,a=1;i.beginPath(),i.moveTo(r,s);do{if(a>2e4)break;var o=(t+e)*Math.cos(a*Math.PI/72)-(e+n)*Math.cos((t+e)/e*(a*Math.PI/72)),l=(t+e)*Math.sin(a*Math.PI/72)-(e+n)*Math.sin((t+e)/e*(a*Math.PI/72));i.lineTo(o,l),r=o,s=l,a++}while(o!=t-n&&l!=0);i.stroke()},Wy=function(i,t){i.save(),i.beginPath(),i.moveTo(t,0);for(var e=0;e<9;e++)i.rotate(Math.PI/5),e%2==0?i.lineTo(t/.525731*.200811,0):i.lineTo(t,0);i.closePath(),i.fill(),i.restore()},Ky=function(i,t,e,n,r){var s=0;function a(){i.clearRect(t,e,n,r),i.setLineDash([4,2]),i.lineDashOffset=-s,i.strokeRect(t,e,n,r)}function o(){s++,s>16&&(s=0),a(),setTimeout(o,40)}o()},Zy=function(i){i.beginPath(),i.arc(75,75,50,0,Math.PI*2,!0),i.moveTo(110,75),i.arc(75,75,35,0,Math.PI,!1),i.moveTo(65,65),i.arc(60,65,5,0,Math.PI*2,!0),i.moveTo(95,65),i.arc(90,65,5,0,Math.PI*2,!0),i.stroke()};let Jy=class{constructor(t=0,e=0,n="#ffff00",r=0){this.x=t,this.y=e,this.color=n,this.rotation=r}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=2,t.fillStyle=this.color,t.beginPath(),t.moveTo(-50,-25),t.lineTo(0,-25),t.lineTo(0,-50),t.lineTo(50,0),t.lineTo(0,50),t.lineTo(0,25),t.lineTo(-50,25),t.lineTo(-50,-25),t.closePath(),t.fill(),t.stroke(),t.restore()}};class Qy extends Wt{constructor(t=40,e="#ff0000"){super(0,0,{vx:0,vy:0,radius:t}),this.x=0,this.y=0,this.radius=t,this.vx=0,this.vy=0,this.mass=1,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=e,this.lineWidth=1}draw(t){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,t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}getBounds(){return new Tl(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class t3{constructor(t=40,e="#ff0000"){this.x=0,this.y=0,this.xpos=0,this.ypos=0,this.zpos=0,this.radius=t,this.vx=0,this.vy=0,this.vz=0,this.mass=1,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=e,this.lineWidth=1,this.visible=!0}draw(t){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,t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}}class e3{constructor(t=50,e=50,n="#ff0000"){this.x=0,this.y=0,this.width=t,this.height=e,this.vx=0,this.vy=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=n,this.lineWidth=1}draw(t){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,t.beginPath(),t.rect(0,0,this.width,this.height),t.closePath(),t.fill(),this.lineWidth>0&&t.stroke(),t.restore()}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)}}class i3{constructor(t,e,n,r){this.x=t===void 0?-100:t,this.y=e===void 0?-100:e,this.z=n===void 0?-100:n,this.brightness=r===void 0?1:r}setBrightness(t){this.brightness=Math.min(Math.max(t,0),1)}}let n3=class{constructor(t,e,n,r){this.x=0,this.y=0,this.x1=t===void 0?0:t,this.y1=e===void 0?0:e,this.x2=n===void 0?0:n,this.y2=r===void 0?0:r,this.rotation=0,this.scaleX=1,this.scaleY=1,this.lineWidth=1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.beginPath(),t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2),t.closePath(),t.stroke(),t.restore()}getBounds(){if(this.rotation===0){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),r=Math.max(this.y1,this.y2);return{x:this.x+t,y:this.y+e,width:n-t,height:r-e}}else{var s=Math.sin(this.rotation),a=Math.cos(this.rotation),o=a*this.x1-s*this.y1,l=a*this.x2-s*this.y2,h=a*this.y1+s*this.x1,c=a*this.y2+s*this.x2;return{x:this.x+Math.min(o,l),y:this.y+Math.min(h,c),width:Math.max(o,l)-Math.min(o,l),height:Math.max(h,c)-Math.min(h,c)}}}};class r3{constructor(t,e,n){this.x=t===void 0?0:t,this.y=e===void 0?0:e,this.z=n===void 0?0:n,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,n){this.cX=t,this.cY=e,this.cZ=n}rotateX(t){var e=Math.cos(t),n=Math.sin(t),r=this.y*e-this.z*n,s=this.z*e+this.y*n;this.y=r,this.z=s}rotateY(t){var e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.z*n,s=this.z*e+this.x*n;this.x=r,this.z=s}rotateZ(t){var e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.y*n,s=this.y*e+this.x*n;this.x=r,this.y=s}getScreenX(){var t=this.fl/(this.fl+this.z+this.cZ);return this.vpX+(this.cX+this.x)*t}getScreenY(){var t=this.fl/(this.fl+this.z+this.cZ);return this.vpY+(this.cY+this.y)*t}}class s3{constructor(){this.x=0,this.y=0,this.width=25,this.height=20,this.rotation=0,this.showFlame=!1}draw(t){t.save(),t.translate(this.x,this.y),t.rotate(this.rotation),t.lineWidth=1,t.strokeStyle="#ffffff",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 a3{constructor(t,e,n){this.min=t===void 0?0:t,this.max=e===void 0?100:e,this.value=n===void 0?100:n,this.onchange=null,this.x=0,this.y=0,this.width=16,this.height=100,this.backColor="#cccccc",this.backBorderColor="#999999",this.backWidth=4,this.backX=this.width/2-this.backWidth/2,this.handleColor="#eeeeee",this.handleBorderColor="#cccccc",this.handleHeight=6,this.handleY=0,this.updatePosition()}draw(t){t.save(),t.translate(this.x,this.y),t.fillStyle=this.backColor,t.beginPath(),t.fillRect(this.backX,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()}updateValue(){var t=this.value,e=this.height-this.handleHeight,n=this.max-this.min;this.value=(e-this.handleY)/e*n+this.min,typeof this.onchange=="function"&&this.value!==t&&this.onchange()}updatePosition(){var t=this.height-this.handleHeight,e=this.max-this.min;this.handleY=t-(this.value-this.min)/e*t}captureMouse(t){var e=this,n=zo.captureMouse(t),r=new Tl(0,0,0,0);o(),t.addEventListener("mousedown",function(){r.isContainPoint(n)&&(t.addEventListener("mouseup",s,!1),t.addEventListener("mousemove",a,!1))},!1);function s(){t.removeEventListener("mousemove",a,!1),t.removeEventListener("mouseup",s,!1),o()}function a(){var l=n.y-e.y;e.handleY=Math.min(e.height-e.handleHeight,Math.max(l,0)),e.updateValue()}function o(){r.x=e.x,r.y=e.y+e.handleY,r.width=e.width,r.height=e.handleHeight}}}class o3{constructor(t,e,n,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=n,this.color=r,this.lineWidth=1,this.alpha=1}draw(t){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=El(this.color,this.alpha),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(){var t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),n=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*n}}class l3{constructor(t,e,n,r="#ff0000"){this.pointA=t,this.pointB=e,this.pointC=n,this.color=r,this.lineWidth=1,this.alpha=1,this.light=null}draw(t){this.isBackface()||(t.save(),t.lineWidth=this.lineWidth,t.fillStyle=t.strokeStyle=this.getAdjustedColor(),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(){var t=this.pointC.getScreenX()-this.pointA.getScreenX(),e=this.pointC.getScreenY()-this.pointA.getScreenY(),n=this.pointB.getScreenX()-this.pointC.getScreenX(),r=this.pointB.getScreenY()-this.pointC.getScreenY();return t*r>e*n}getAdjustedColor(){var t=Ea(this.color),e=t>>16,n=t>>8&255,r=t&255,s=this.getLightFactor();return e*=s,n*=s,r*=s,Bf(e<<16|n<<8|r)}getLightFactor(){var 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},n={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=n.x*this.light.x+n.y*this.light.y+n.z*this.light.z,s=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.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 h3{constructor(){this.x=0,this.y=0,this.xpos=0,this.ypos=0,this.zpos=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){t.save(),t.translate(this.x,this.y),t.scale(this.scaleX,this.scaleY),t.lineWidth=this.lineWidth,t.strokeStyle=El(this.color,this.alpha),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 c3{constructor(t,e,n="#ffffff"){this.x=0,this.y=0,this.width=t,this.height=e,this.vx=0,this.vy=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.color=n,this.lineWidth=1}draw(t){var e=this.height,n=this.width+e,r=e/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,t.beginPath(),t.moveTo(0,-r),t.lineTo(n-2*r,-r),t.quadraticCurveTo(-r+n,-r,-r+n,0),t.lineTo(-r+n,e-2*r),t.quadraticCurveTo(-r+n,-r+e,n-2*r,-r+e),t.lineTo(0,-r+e),t.quadraticCurveTo(-r,-r+e,-r,e-2*r),t.lineTo(-r,0),t.quadraticCurveTo(-r,-r,0,-r),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 u3{canvas;context;mouse;constructor(t){this.canvas=t,this.context=t.getContext("2d",{willReadFrequently:!0}),this.mouse=zo.captureMouse(this.canvas)}getMouseRotation(t){return t.angleTo(this.mouse)}followMouse(t,e){const n=this.getMouseRotation(t),{x:r,y:s}=t.fromRadian(n,e);return t.x+=r,t.y+=s,t}followMouseWithAcceleration(t,e=.05){const n=this.getMouseRotation(t),{x:r,y:s}=t.fromRadian(n,e);return t.ax=r,t.ay=s,t.nextFrame(),t}getMouseDistance(t){return t.distanceTo(this.mouse)}clearRect(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this}lineWidth(t){return this.context.lineWidth=t,this}fillStyle(t){return this.context.fillStyle=t,this}fill(){return this.context.fill(),this}strokeStyle(t){return this.context.strokeStyle=t,this}stroke(){return this.context.stroke(),this}createLinearGradient(t,e,n){const r=this.context.createLinearGradient(t.x,t.y,e.x,e.y);return Object.keys(n).forEach(s=>r.addColorStop(parseFloat(s),n[parseFloat(s)])),r}createRadialGradient(t,e,n){const r=this.context.createRadialGradient(t.x,t.y,t.radius,e.x,e.y,e.radius);return Object.keys(n).forEach(s=>r.addColorStop(parseFloat(s),n[parseFloat(s)])),r}moveTo(t){this.context.moveTo(t.x,t.y)}closePath(){this.context.closePath()}lineTo(t,e){this.context.save(),this.context.beginPath(),this.context.moveTo(t.x,t.y),this.context.lineTo(e.x,e.y),this.context.stroke(),this.context.restore()}drawMouseMoveLine(){const t=()=>{this.context.lineTo(this.mouse.x,this.mouse.y),this.stroke()};this.canvas.addEventListener("mousedown",()=>{this.context.beginPath(),this.context.moveTo(this.mouse.x,this.mouse.y),this.canvas.addEventListener("mousemove",t,!1)},!1),this.canvas.addEventListener("mouseup",()=>{this.canvas.removeEventListener("mousemove",t,!1)},!1)}drawMouseMoveBrushLine({brush_size:t,brush_density:e,brush_color:n}={brush_size:25,brush_density:50,brush_color:"#000000"}){const r=this.getImageData(),s=r.data,a=Ea(n),o=()=>{for(let l=0;l<e;l++){const h=Math.random()*Math.PI*2,c=Math.random()*t,d=this.mouse.x+Math.cos(h)*c|0,f=this.mouse.y+Math.sin(h)*c|0,u=(d+f*r.width)*4;s[u]=a>>16&255,s[u+1]=a>>8&255,s[u+2]=a&255,s[u+3]=255}this.putImageData(r)};this.canvas.addEventListener("mousedown",()=>{this.canvas.addEventListener("mousemove",o,!1)},!1),this.canvas.addEventListener("mouseup",()=>{this.canvas.removeEventListener("mousemove",o,!1)},!1)}quadraticCurveTo(t,e,n){this.context.save(),this.context.beginPath(),this.context.moveTo(t.x,t.y),this.context.quadraticCurveTo(e.x,e.y,n.x,n.y),this.context.stroke(),this.context.restore()}drawQuadraticCurveLine(t){const e=t.length;if(e<3)return new Error("points length must >= 3");this.context.beginPath(),this.context.moveTo(t[0].x,t[0].y);for(let n=1;n<e;n+=2)this.context.quadraticCurveTo(t[n].x,t[n].y,t[n+1].x,t[n+1].y);this.context.stroke()}quadraticThroughCurveTo(t,e,n){e.x=e.x*2-(t.x+n.x)/2,e.y=e.y*2-(t.y+n.y)/2,this.quadraticCurveTo(t,e,n)}drawQuadraticThroughCurveLine(t){const e=t.length;if(e<3)return new Error("points length must >= 3");this.context.beginPath(),this.context.moveTo(t[0].x,t[0].y);let n=1;for(;n<e-2;n++)this.context.quadraticCurveTo(t[n].x,t[n].y,(t[n].x+t[n+1].x)/2,(t[n].y+t[n+1].y)/2);this.context.quadraticCurveTo(t[n].x,t[n].y,t[n+1].x,t[n+1].y),this.context.stroke()}drawQuadraticThroughCurveLineBetter(t){const e=t.length;if(e<3)return new Error("points length must >= 3");const n=(t[0].x+t[e-1].x)/2,r=(t[0].y+t[e-1].y)/2;this.context.beginPath(),this.context.moveTo(n,r);let s=0;for(;s<e-1;s++){const a=(t[s].x+t[s+1].x)/2,o=(t[s].y+t[s+1].y)/2;this.context.quadraticCurveTo(t[s].x,t[s].y,a,o)}this.context.quadraticCurveTo(t[s].x,t[s].y,r,r),this.context.stroke()}fillRect(t){this.context.save(),this.context.fillRect(t.x,t.y,t.width,t.height),this.context.stroke(),this.context.restore()}drawImage(t,e=0,n=0){this.context.drawImage(t,e,n)}getImageData(t={x:0,y:0,width:this.canvas.width,height:this.canvas.height},e){return this.context.getImageData(t.x,t.y,t.width,t.height,e)}putImageData(t,e=0,n=0){return this.context.putImageData(t,e,n)}drawShape(t){t.draw(this.context)}}var m0=null;if(navigator.mozGetUserMedia)console.log("This appears to be Firefox"),window.webrtcDetectedBrowser="firefox",window.webrtcDetectedVersion=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10),RTCSessionDescription=mozRTCSessionDescription,RTCIceCandidate=mozRTCIceCandidate,window.getUserMedia=navigator.mozGetUserMedia.bind(navigator),navigator.getUserMedia=m0,window.createIceServer=function(i,t,e){var n=null,r=i.split(":");if(r[0].indexOf("stun")===0)n={url:i};else if(r[0].indexOf("turn")===0){var s=i.split("?");(s.length===1||s[1].indexOf("transport=udp")===0)&&(n={url:s[0],credential:e,username:t})}return n},window.createIceServers=function(i,t,e){for(var n=[],r=0;r<i.length;r++){var s=createIceServer(i[r],t,e);s!==null&&n.push(s)}return n},window.attachMediaStream=function(i,t){console.log("Attaching media stream"),i.mozSrcObject=t,i.play()},window.reattachMediaStream=function(i,t){console.log("Reattaching media stream"),i.mozSrcObject=t.mozSrcObject,i.play()};else if(navigator.webkitGetUserMedia){console.log("This appears to be Chrome"),window.webrtcDetectedBrowser="chrome";var v0=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);v0!==null?window.webrtcDetectedVersion=parseInt(v0[2],10):window.webrtcDetectedVersion=999,window.createIceServer=function(i,t,e){var n=null,r=i.split(":");return r[0].indexOf("stun")===0?n={url:i}:r[0].indexOf("turn")===0&&(n={url:i,credential:e,username:t}),n},window.createIceServers=function(i,t,e){for(var n=[],r=0;r<i.length;r++){var s=createIceServer(i[r],t,e);s!==null&&n.push(s)}return n},window.getUserMedia=navigator.webkitGetUserMedia.bind(navigator),navigator.getUserMedia=m0,window.attachMediaStream=function(i,t){typeof i.srcObject<"u"?i.srcObject=t:typeof i.mozSrcObject<"u"?i.mozSrcObject=t:typeof i.src<"u"?i.src=URL.createObjectURL(t):console.log("Error attaching stream to element.")},window.reattachMediaStream=function(i,t){i.src=t.src}}else console.log("Browser does not appear to be WebRTC-capable");class Vr{video;constructor(t){this.video=t}setSrcObject(t){this.video.addEventListener("loadedmetadata",e=>{const n=e.target;n instanceof HTMLVideoElement&&console.log(`${n.id} videoWidth: ${n.videoWidth}px, videoHeight: ${n.videoHeight}px.`)}),this.video.srcObject=t}static captureWebCameraPhoto(t,e){navigator.mediaDevices.getUserMedia({video:!0}).then(n=>{t.srcObject=n;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(()=>{Vr.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 f3{localVideoUtil;remoteVideoUtil;localPeerConnection=null;remotePeerConnection=null;constructor(t,e){this.localVideoUtil=new Vr(t),this.remoteVideoUtil=new Vr(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(n=>{this.localVideoUtil.setSrcObject(n),t(n)}).catch(n=>{this.trace(`navigator.getUserMedia error: ${n}.`),e(n)})})}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(),n=t.getAudioTracks();e.length>0&&this.trace(`Using video device: ${e[0].label}.`),n.length>0&&this.trace(`Using audio device: ${n[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(n[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,n=t.candidate;if(e&&n){const r=new RTCIceCandidate(n),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:
|
|
25
30
|
${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:
|
|
26
31
|
${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:
|
|
27
32
|
${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:
|
|
28
|
-
${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 n=this.getPeerName(t);this.trace(`${n} ${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 n=document.createElement("div");n.innerHTML=`<div>${e}, ${t}</div>`,document.getElementById("trace")?.appendChild(n)}getOtherPeer(t){return t===this.localPeerConnection?this.remotePeerConnection:this.localPeerConnection}getPeerName(t){return t===this.localPeerConnection?"localPeerConnection":"remotePeerConnection"}}class Zm{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 Oc(i,t){return!i||i.parentElement===null?t:Oc(i.parentElement,t.concat([i]))}const Ba=function(i,t){return getComputedStyle(i,null).getPropertyValue(t)},Jm=function(i){return Ba(i,"overflow")+Ba(i,"overflow-y")+Ba(i,"overflow-x")},Qm=function(i){return/(auto|scroll)/.test(Jm(i))};function t5(i){if(!(i instanceof HTMLElement||i instanceof SVGElement))return;const t=Oc(i.parentElement,[]);for(let e=0;e<t.length;e+=1)if(Qm(t[e]))return t[e];return document.scrollingElement||document.documentElement}var za={exports:{}},wr={},Ic={},Y={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i._registerNode=i.Konva=i.glob=void 0;const t=Math.PI/180;function e(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}i.glob=typeof Hl<"u"?Hl:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},i.Konva={_global:i.glob,version:"9.2.2",isBrowser:e(),isUnminified:/param/.test(function(r){}.toString()),dblClickWindow:400,getAngle(r){return i.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 i.Konva.DD.isDragging},isDragReady(){return!!i.Konva.DD.node},releaseCanvasOnDestroy:!0,document:i.glob.document,_injectGlobal(r){i.glob.Konva=r}};const n=r=>{i.Konva[r.prototype.getClassName()]=r};i._registerNode=n,i.Konva._injectGlobal(i.Konva)})(Y);var gt={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Util=i.Transform=void 0;const t=Y;class e{constructor(v=[1,0,0,1,0,0]){this.dirty=!1,this.m=v&&v.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(v){v.m[0]=this.m[0],v.m[1]=this.m[1],v.m[2]=this.m[2],v.m[3]=this.m[3],v.m[4]=this.m[4],v.m[5]=this.m[5]}point(v){var w=this.m;return{x:w[0]*v.x+w[2]*v.y+w[4],y:w[1]*v.x+w[3]*v.y+w[5]}}translate(v,w){return this.m[4]+=this.m[0]*v+this.m[2]*w,this.m[5]+=this.m[1]*v+this.m[3]*w,this}scale(v,w){return this.m[0]*=v,this.m[1]*=v,this.m[2]*=w,this.m[3]*=w,this}rotate(v){var w=Math.cos(v),S=Math.sin(v),k=this.m[0]*w+this.m[2]*S,C=this.m[1]*w+this.m[3]*S,A=this.m[0]*-S+this.m[2]*w,x=this.m[1]*-S+this.m[3]*w;return this.m[0]=k,this.m[1]=C,this.m[2]=A,this.m[3]=x,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(v,w){var S=this.m[0]+this.m[2]*w,k=this.m[1]+this.m[3]*w,C=this.m[2]+this.m[0]*v,A=this.m[3]+this.m[1]*v;return this.m[0]=S,this.m[1]=k,this.m[2]=C,this.m[3]=A,this}multiply(v){var w=this.m[0]*v.m[0]+this.m[2]*v.m[1],S=this.m[1]*v.m[0]+this.m[3]*v.m[1],k=this.m[0]*v.m[2]+this.m[2]*v.m[3],C=this.m[1]*v.m[2]+this.m[3]*v.m[3],A=this.m[0]*v.m[4]+this.m[2]*v.m[5]+this.m[4],x=this.m[1]*v.m[4]+this.m[3]*v.m[5]+this.m[5];return this.m[0]=w,this.m[1]=S,this.m[2]=k,this.m[3]=C,this.m[4]=A,this.m[5]=x,this}invert(){var v=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),w=this.m[3]*v,S=-this.m[1]*v,k=-this.m[2]*v,C=this.m[0]*v,A=v*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),x=v*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=w,this.m[1]=S,this.m[2]=k,this.m[3]=C,this.m[4]=A,this.m[5]=x,this}getMatrix(){return this.m}decompose(){var v=this.m[0],w=this.m[1],S=this.m[2],k=this.m[3],C=this.m[4],A=this.m[5],x=v*k-w*S;let T={x:C,y:A,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(v!=0||w!=0){var M=Math.sqrt(v*v+w*w);T.rotation=w>0?Math.acos(v/M):-Math.acos(v/M),T.scaleX=M,T.scaleY=x/M,T.skewX=(v*S+w*k)/x,T.skewY=0}else if(S!=0||k!=0){var D=Math.sqrt(S*S+k*k);T.rotation=Math.PI/2-(k>0?Math.acos(-S/D):-Math.acos(S/D)),T.scaleX=x/D,T.scaleY=D,T.skewX=0,T.skewY=(v*S+w*k)/x}return T.rotation=i.Util._getRotation(T.rotation),T}}i.Transform=e;var n="[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: ",g="rgb(",p={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]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,y=[];const b=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(m){setTimeout(m,60)};i.Util={_isElement(m){return!!(m&&m.nodeType==1)},_isFunction(m){return!!(m&&m.constructor&&m.call&&m.apply)},_isPlainObject(m){return!!m&&m.constructor===Object},_isArray(m){return Object.prototype.toString.call(m)===n},_isNumber(m){return Object.prototype.toString.call(m)===r&&!isNaN(m)&&isFinite(m)},_isString(m){return Object.prototype.toString.call(m)===s},_isBoolean(m){return Object.prototype.toString.call(m)===a},isObject(m){return m instanceof Object},isValidSelector(m){if(typeof m!="string")return!1;var v=m[0];return v==="#"||v==="."||v===v.toUpperCase()},_sign(m){return m===0||m>0?1:-1},requestAnimFrame(m){y.push(m),y.length===1&&b(function(){const v=y;y=[],v.forEach(function(w){w()})})},createCanvasElement(){var m=document.createElement("canvas");try{m.style=m.style||{}}catch{}return m},createImageElement(){return document.createElement("img")},_isInDocument(m){for(;m=m.parentNode;)if(m==document)return!0;return!1},_urlToImage(m,v){var w=i.Util.createImageElement();w.onload=function(){v(w)},w.src=m},_rgbToHex(m,v,w){return((1<<24)+(m<<16)+(v<<8)+w).toString(16).slice(1)},_hexToRgb(m){m=m.replace(l,c);var v=parseInt(m,16);return{r:v>>16&255,g:v>>8&255,b:v&255}},getRandomColor(){for(var m=(Math.random()*16777215<<0).toString(16);m.length<6;)m=d+m;return l+m},getRGB(m){var v;return m in p?(v=p[m],{r:v[0],g:v[1],b:v[2]}):m[0]===l?this._hexToRgb(m.substring(1)):m.substr(0,4)===g?(v=_.exec(m.replace(/ /g,"")),{r:parseInt(v[1],10),g:parseInt(v[2],10),b:parseInt(v[3],10)}):{r:0,g:0,b:0}},colorToRGBA(m){return m=m||"black",i.Util._namedColorToRBA(m)||i.Util._hex3ColorToRGBA(m)||i.Util._hex4ColorToRGBA(m)||i.Util._hex6ColorToRGBA(m)||i.Util._hex8ColorToRGBA(m)||i.Util._rgbColorToRGBA(m)||i.Util._rgbaColorToRGBA(m)||i.Util._hslColorToRGBA(m)},_namedColorToRBA(m){var v=p[m.toLowerCase()];return v?{r:v[0],g:v[1],b:v[2],a:1}:null},_rgbColorToRGBA(m){if(m.indexOf("rgb(")===0){m=m.match(/rgb\(([^)]+)\)/)[1];var v=m.split(/ *, */).map(Number);return{r:v[0],g:v[1],b:v[2],a:1}}},_rgbaColorToRGBA(m){if(m.indexOf("rgba(")===0){m=m.match(/rgba\(([^)]+)\)/)[1];var v=m.split(/ *, */).map((w,S)=>w.slice(-1)==="%"?S===3?parseInt(w)/100:parseInt(w)/100*255:Number(w));return{r:v[0],g:v[1],b:v[2],a:v[3]}}},_hex8ColorToRGBA(m){if(m[0]==="#"&&m.length===9)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:parseInt(m.slice(7,9),16)/255}},_hex6ColorToRGBA(m){if(m[0]==="#"&&m.length===7)return{r:parseInt(m.slice(1,3),16),g:parseInt(m.slice(3,5),16),b:parseInt(m.slice(5,7),16),a:1}},_hex4ColorToRGBA(m){if(m[0]==="#"&&m.length===5)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:parseInt(m[4]+m[4],16)/255}},_hex3ColorToRGBA(m){if(m[0]==="#"&&m.length===4)return{r:parseInt(m[1]+m[1],16),g:parseInt(m[2]+m[2],16),b:parseInt(m[3]+m[3],16),a:1}},_hslColorToRGBA(m){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(m)){const[v,...w]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(m),S=Number(w[0])/360,k=Number(w[1])/100,C=Number(w[2])/100;let A,x,T;if(k===0)return T=C*255,{r:Math.round(T),g:Math.round(T),b:Math.round(T),a:1};C<.5?A=C*(1+k):A=C+k-C*k;const M=2*C-A,D=[0,0,0];for(let O=0;O<3;O++)x=S+1/3*-(O-1),x<0&&x++,x>1&&x--,6*x<1?T=M+(A-M)*6*x:2*x<1?T=A:3*x<2?T=M+(A-M)*(2/3-x)*6:T=M,D[O]=T*255;return{r:Math.round(D[0]),g:Math.round(D[1]),b:Math.round(D[2]),a:1}}},haveIntersection(m,v){return!(v.x>m.x+m.width||v.x+v.width<m.x||v.y>m.y+m.height||v.y+v.height<m.y)},cloneObject(m){var v={};for(var w in m)this._isPlainObject(m[w])?v[w]=this.cloneObject(m[w]):this._isArray(m[w])?v[w]=this.cloneArray(m[w]):v[w]=m[w];return v},cloneArray(m){return m.slice(0)},degToRad(m){return m*o},radToDeg(m){return m*h},_degToRad(m){return i.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),i.Util.degToRad(m)},_radToDeg(m){return i.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),i.Util.radToDeg(m)},_getRotation(m){return t.Konva.angleDeg?i.Util.radToDeg(m):m},_capitalize(m){return m.charAt(0).toUpperCase()+m.slice(1)},throw(m){throw new Error(u+m)},error(m){console.error(u+m)},warn(m){t.Konva.showWarnings&&console.warn(f+m)},each(m,v){for(var w in m)v(w,m[w])},_inRange(m,v,w){return v<=m&&m<w},_getProjectionToSegment(m,v,w,S,k,C){var A,x,T,M=(m-w)*(m-w)+(v-S)*(v-S);if(M==0)A=m,x=v,T=(k-w)*(k-w)+(C-S)*(C-S);else{var D=((k-m)*(w-m)+(C-v)*(S-v))/M;D<0?(A=m,x=v,T=(m-k)*(m-k)+(v-C)*(v-C)):D>1?(A=w,x=S,T=(w-k)*(w-k)+(S-C)*(S-C)):(A=m+D*(w-m),x=v+D*(S-v),T=(A-k)*(A-k)+(x-C)*(x-C))}return[A,x,T]},_getProjectionToLine(m,v,w){var S=i.Util.cloneObject(m),k=Number.MAX_VALUE;return v.forEach(function(C,A){if(!(!w&&A===v.length-1)){var x=v[(A+1)%v.length],T=i.Util._getProjectionToSegment(C.x,C.y,x.x,x.y,m.x,m.y),M=T[0],D=T[1],O=T[2];O<k&&(S.x=M,S.y=D,k=O)}}),S},_prepareArrayForTween(m,v,w){var S,k=[],C=[];if(m.length>v.length){var A=v;v=m,m=A}for(S=0;S<m.length;S+=2)k.push({x:m[S],y:m[S+1]});for(S=0;S<v.length;S+=2)C.push({x:v[S],y:v[S+1]});var x=[];return C.forEach(function(T){var M=i.Util._getProjectionToLine(T,k,w);x.push(M.x),x.push(M.y)}),x},_prepareToStringify(m){var v;m.visitedByCircularReferenceRemoval=!0;for(var w in m)if(m.hasOwnProperty(w)&&m[w]&&typeof m[w]=="object"){if(v=Object.getOwnPropertyDescriptor(m,w),m[w].visitedByCircularReferenceRemoval||i.Util._isElement(m[w]))if(v.configurable)delete m[w];else return null;else if(i.Util._prepareToStringify(m[w])===null)if(v.configurable)delete m[w];else return null}return delete m.visitedByCircularReferenceRemoval,m},_assign(m,v){for(var w in v)m[w]=v[w];return m},_getFirstPointerId(m){return m.touches?m.changedTouches[0].identifier:m.pointerId||999},releaseCanvas(...m){t.Konva.releaseCanvasOnDestroy&&m.forEach(v=>{v.width=0,v.height=0})},drawRoundedRectPath(m,v,w,S){let k=0,C=0,A=0,x=0;typeof S=="number"?k=C=A=x=Math.min(S,v/2,w/2):(k=Math.min(S[0]||0,v/2,w/2),C=Math.min(S[1]||0,v/2,w/2),x=Math.min(S[2]||0,v/2,w/2),A=Math.min(S[3]||0,v/2,w/2)),m.moveTo(k,0),m.lineTo(v-C,0),m.arc(v-C,C,C,Math.PI*3/2,0,!1),m.lineTo(v,w-x),m.arc(v-x,w-x,x,0,Math.PI/2,!1),m.lineTo(A,w),m.arc(A,w-A,A,Math.PI/2,Math.PI,!1),m.lineTo(0,k),m.arc(k,k,k,Math.PI,Math.PI*3/2,!1)}}})(gt);var dt={},X={},N={};Object.defineProperty(N,"__esModule",{value:!0}),N.getComponentValidator=N.getBooleanValidator=N.getNumberArrayValidator=N.getFunctionValidator=N.getStringOrGradientValidator=N.getStringValidator=N.getNumberOrAutoValidator=N.getNumberOrArrayOfNumbersValidator=N.getNumberValidator=N.alphaComponent=N.RGBComponent=void 0;const fe=Y,mt=gt;function ge(i){return mt.Util._isString(i)?'"'+i+'"':Object.prototype.toString.call(i)==="[object Number]"||mt.Util._isBoolean(i)?i:Object.prototype.toString.call(i)}function e5(i){return i>255?255:i<0?0:Math.round(i)}N.RGBComponent=e5;function i5(i){return i>1?1:i<1e-4?1e-4:i}N.alphaComponent=i5;function n5(){if(fe.Konva.isUnminified)return function(i,t){return mt.Util._isNumber(i)||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),i}}N.getNumberValidator=n5;function r5(i){if(fe.Konva.isUnminified)return function(t,e){let n=mt.Util._isNumber(t),r=mt.Util._isArray(t)&&t.length==i;return!n&&!r&&mt.Util.warn(ge(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or Array<number>('+i+")"),t}}N.getNumberOrArrayOfNumbersValidator=r5;function s5(){if(fe.Konva.isUnminified)return function(i,t){var e=mt.Util._isNumber(i),n=i==="auto";return e||n||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),i}}N.getNumberOrAutoValidator=s5;function a5(){if(fe.Konva.isUnminified)return function(i,t){return mt.Util._isString(i)||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),i}}N.getStringValidator=a5;function o5(){if(fe.Konva.isUnminified)return function(i,t){const e=mt.Util._isString(i),n=Object.prototype.toString.call(i)==="[object CanvasGradient]"||i&&i.addColorStop;return e||n||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),i}}N.getStringOrGradientValidator=o5;function l5(){if(fe.Konva.isUnminified)return function(i,t){return mt.Util._isFunction(i)||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),i}}N.getFunctionValidator=l5;function h5(){if(fe.Konva.isUnminified)return function(i,t){const e=Int8Array?Object.getPrototypeOf(Int8Array):null;return e&&i instanceof e||(mt.Util._isArray(i)?i.forEach(function(n){mt.Util._isNumber(n)||mt.Util.warn('"'+t+'" attribute has non numeric element '+n+". Make sure that all elements are numbers.")}):mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),i}}N.getNumberArrayValidator=h5;function c5(){if(fe.Konva.isUnminified)return function(i,t){var e=i===!0||i===!1;return e||mt.Util.warn(ge(i)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),i}}N.getBooleanValidator=c5;function u5(i){if(fe.Konva.isUnminified)return function(t,e){return t==null||mt.Util.isObject(t)||mt.Util.warn(ge(t)+' is a not valid value for "'+e+'" attribute. The value should be an object with properties '+i),t}}N.getComponentValidator=u5,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Factory=void 0;const t=gt,e=N;var n="get",r="set";i.Factory={addGetterSetter(s,a,o,h,l){i.Factory.addGetter(s,a,o),i.Factory.addSetter(s,a,h,l),i.Factory.addOverloadedGetterSetter(s,a)},addGetter(s,a,o){var h=n+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]||i.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=n+d(a),u=r+d(a),g,p;s.prototype[f]=function(){var y={};for(g=0;g<c;g++)p=o[g],y[p]=this.getAttr(a+d(p));return y};var _=(0,e.getComponentValidator)(o);s.prototype[u]=function(y){var b=this.attrs[a],m;h&&(y=h.call(this,y)),_&&_.call(this,y,a);for(m in y)y.hasOwnProperty(m)&&this._setAttr(a+d(m),y[m]);return y||o.forEach(v=>{this._setAttr(a+d(v),void 0)}),this._fireChangeEvent(a,b,y),l&&l.call(this),this},i.Factory.addOverloadedGetterSetter(s,a)},addOverloadedGetterSetter(s,a){var o=t.Util._capitalize(a),h=r+o,l=n+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=n+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},i.Factory.addSetter(s,a,h,function(){t.Util.error(c)}),i.Factory.addOverloadedGetterSetter(s,a)},backCompat(s,a){t.Util.each(a,function(o,h){var l=s.prototype[h],c=n+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}}}(X);var $t={},pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.HitContext=pe.SceneContext=pe.Context=void 0;const Fc=gt,d5=Y;function f5(i){var t=[],e=i.length,n=Fc.Util,r,s;for(r=0;r<e;r++)s=i[r],n._isNumber(s)?s=Math.round(s*1e3)/1e3:n._isString(s)||(s=s+""),t.push(s);return t}var Nc=",",g5="(",p5=")",m5="([",_5="])",v5=";",y5="()",b5="=",Uc=["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"],w5=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const S5=100;class Sr{constructor(t){this.canvas=t,d5.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 n=this.traceArr,r=n.length,s="",a,o,h,l;for(a=0;a<r;a++)o=n[a],h=o.method,h?(l=o.args,s+=h,t?s+=y5:Fc.Util._isArray(l[0])?s+=m5+l.join(Nc)+_5:(e&&(l=l.map(c=>typeof c=="number"?Math.floor(c):c)),s+=g5+l.join(Nc)+p5)):(s+=o.property,t||(s+=b5+o.val)),s+=v5;return s}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr,n;e.push(t),n=e.length,n>=S5&&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,n,r,s,a){this._context.arc(t,e,n,r,s,a)}arcTo(t,e,n,r,s){this._context.arcTo(t,e,n,r,s)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,n,r,s,a){this._context.bezierCurveTo(t,e,n,r,s,a)}clearRect(t,e,n,r){this._context.clearRect(t,e,n,r)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var n=arguments;if(n.length===2)return this._context.createImageData(t,e);if(n.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,n,r){return this._context.createLinearGradient(t,e,n,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,n,r,s,a){return this._context.createRadialGradient(t,e,n,r,s,a)}drawImage(t,e,n,r,s,a,o,h,l){var c=arguments,d=this._context;c.length===3?d.drawImage(t,e,n):c.length===5?d.drawImage(t,e,n,r,s):c.length===9&&d.drawImage(t,e,n,r,s,a,o,h,l)}ellipse(t,e,n,r,s,a,o,h){this._context.ellipse(t,e,n,r,s,a,o,h)}isPointInPath(t,e,n,r){return n?this._context.isPointInPath(n,t,e,r):this._context.isPointInPath(t,e,r)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,n,r){this._context.fillRect(t,e,n,r)}strokeRect(t,e,n,r){this._context.strokeRect(t,e,n,r)}fillText(t,e,n,r){r?this._context.fillText(t,e,n,r):this._context.fillText(t,e,n)}measureText(t){return this._context.measureText(t)}getImageData(t,e,n,r){return this._context.getImageData(t,e,n,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,n,r){this._context.rect(t,e,n,r)}putImageData(t,e,n){this._context.putImageData(t,e,n)}quadraticCurveTo(t,e,n,r){this._context.quadraticCurveTo(t,e,n,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,n,r,s,a){this._context.setTransform(t,e,n,r,s,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,n,r){this._context.strokeText(t,e,n,r)}transform(t,e,n,r,s,a){this._context.transform(t,e,n,r,s,a)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t=this,e=Uc.length,n=this.setAttr,r,s,a=function(o){var h=t[o],l;t[o]=function(){return s=f5(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(Uc[r]);t.setAttr=function(){n.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 n=!e||e==="source-over";n||this.setAttr("globalCompositeOperation",e)}}pe.Context=Sr,w5.forEach(function(i){Object.defineProperty(Sr.prototype,i,{get(){return this._context[i]},set(t){this._context[i]=t}})});class C5 extends Sr{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(),n=t.getFillPriority();if(e&&n==="color"){this._fillColor(t);return}const r=t.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(t);return}const s=t.getFillLinearGradientColorStops();if(s&&n==="linear-gradient"){this._fillLinearGradient(t);return}const a=t.getFillRadialGradientColorStops();if(a&&n==="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(),n=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(e.x,e.y,n.x,n.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(),n=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!n){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),n||this.restore()}}_applyShadow(t){var e,n,r,s=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",a=(n=t.getShadowBlur())!==null&&n!==void 0?n: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)}}pe.SceneContext=C5;class x5 extends Sr{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 n=t.hitStrokeWidth(),r=n==="auto"?t.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),s||this.restore()}}}pe.HitContext=x5,Object.defineProperty($t,"__esModule",{value:!0}),$t.HitCanvas=$t.SceneCanvas=$t.Canvas=void 0;const Cr=gt,Gc=pe,Bc=Y,T5=X,E5=N;var xr;function k5(){if(xr)return xr;var i=Cr.Util.createCanvasElement(),t=i.getContext("2d");return xr=function(){var e=Bc.Konva._global.devicePixelRatio||1,n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/n}(),Cr.Util.releaseCanvas(i),xr}class Tr{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=t||{},n=e.pixelRatio||Bc.Konva.pixelRatio||k5();this.pixelRatio=n,this._canvas=Cr.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,n=this.getContext()._context;n.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio,n=this.getContext()._context;n.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 Cr.Util.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}$t.Canvas=Tr,T5.Factory.addGetterSetter(Tr,"pixelRatio",void 0,(0,E5.getNumberValidator)());class A5 extends Tr{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new Gc.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}$t.SceneCanvas=A5;class P5 extends Tr{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new Gc.HitContext(this),this.setSize(t.width,t.height)}}$t.HitCanvas=P5;var Er={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.DD=void 0;const t=Y,e=gt;i.DD={get isDragging(){var n=!1;return i.DD._dragElements.forEach(r=>{r.dragStatus==="dragging"&&(n=!0)}),n},justDragged:!1,get node(){var n;return i.DD._dragElements.forEach(r=>{n=r.node}),n},_dragElements:new Map,_drag(n){const r=[];i.DD._dragElements.forEach((s,a)=>{const{node:o}=s,h=o.getStage();h.setPointersPositions(n),s.pointerId===void 0&&(s.pointerId=e.Util._getFirstPointerId(n));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:n}),!o.isDragging()))return}o._setDragPosition(n,s),r.push(o)}}),r.forEach(s=>{s.fire("dragmove",{type:"dragmove",target:s,evt:n},!0)})},_endDragBefore(n){const r=[];i.DD._dragElements.forEach(s=>{const{node:a}=s,o=a.getStage();if(n&&o.setPointersPositions(n),!o._changedPointerPositions.find(c=>c.id===s.pointerId))return;(s.dragStatus==="dragging"||s.dragStatus==="stopped")&&(i.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(n){i.DD._dragElements.forEach((r,s)=>{r.dragStatus==="stopped"&&r.node.fire("dragend",{type:"dragend",target:r.node,evt:n},!0),r.dragStatus!=="dragging"&&i.DD._dragElements.delete(s)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",i.DD._endDragBefore,!0),window.addEventListener("touchend",i.DD._endDragBefore,!0),window.addEventListener("mousemove",i.DD._drag),window.addEventListener("touchmove",i.DD._drag),window.addEventListener("mouseup",i.DD._endDragAfter,!1),window.addEventListener("touchend",i.DD._endDragAfter,!1))})(Er),Object.defineProperty(dt,"__esModule",{value:!0}),dt.Node=void 0;const q=gt,En=X,kr=$t,ti=Y,jt=Er,yt=N;var Ar="absoluteOpacity",Pr="allEventListeners",me="absoluteTransform",zc="absoluteScale",ei="canvas",M5="Change",R5="children",D5="konva",Ha="listening",Hc="mouseenter",jc="mouseleave",Vc="set",$c="Shape",Mr=" ",Xc="stage",Oe="transform",L5="Stage",ja="visible",O5=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Mr);let I5=1,V=class wo{constructor(t){this._id=I5++,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===Oe||t===me)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){var n=this._cache.get(t),r=t===Oe||t===me,s=n===void 0||r&&n.dirty===!0;return s&&(n=e.call(this),this._cache.set(t,n)),n}_calculate(t,e,n){if(!this._attachedDepsListeners.get(t)){const r=e.map(s=>s+"Change.konva").join(Mr);this.on(r,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,n)}_getCanvasCache(){return this._cache.get(ei)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===me&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ei)){const{scene:t,filter:e,hit:n}=this._cache.get(ei);q.Util.releaseCanvas(t,e,n),this._cache.delete(ei)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},n={};(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var r=Math.ceil(e.width||n.width),s=Math.ceil(e.height||n.height),a=e.pixelRatio,o=e.x===void 0?Math.floor(n.x):e.x,h=e.y===void 0?Math.floor(n.y):e.y,l=e.offset||0,c=e.drawBorder||!1,d=e.hitCanvasPixelRatio||1;if(!r||!s){q.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 kr.SceneCanvas({pixelRatio:a,width:r,height:s}),u=new kr.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),g=new kr.HitCanvas({pixelRatio:d,width:r,height:s}),p=f.getContext(),_=g.getContext();return g.isCache=!0,f.isCache=!0,this._cache.delete(ei),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),p.save(),_.save(),p.translate(-o,-h),_.translate(-o,-h),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Ar),this._clearSelfAndDescendantCache(zc),this.drawScene(f,this),this.drawHit(g,this),this._isUnderCache=!1,p.restore(),_.restore(),c&&(p.save(),p.beginPath(),p.rect(0,0,r,s),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(ei,{scene:f,filter:u,hit:g,x:o,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(ei)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var n=[{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 n.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 n=this._getCachedSceneCanvas(),r=n.pixelRatio;t.drawImage(n._canvas,0,0,n.width/r,n.height/r),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),n=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),e=this._getCanvasCache(),n=e.scene,r=e.filter,s=r.getContext(),a,o,h,l;if(t){if(!this._filterUpToDate){var c=n.pixelRatio;r.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio);try{for(a=t.length,s.clear(),s.drawImage(n._canvas,0,0,n.getWidth()/c,n.getHeight()/c),o=s.getImageData(0,0,r.getWidth(),r.getHeight()),h=0;h<a;h++){if(l=t[h],typeof l!="function"){q.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){q.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 n}on(t,e){if(this._cache&&this._cache.delete(Pr),arguments.length===3)return this._delegate.apply(this,arguments);var n=t.split(Mr),r=n.length,s,a,o,h,l;for(s=0;s<r;s++)a=n[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 n=(t||"").split(Mr),r=n.length,s,a,o,h,l,c;if(this._cache&&this._cache.delete(Pr),!t)for(a in this.eventListeners)this._off(a);for(s=0;s<r;s++)if(o=n[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(n){e.call(this,n.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,n){var r=this;this.on(t,function(s){for(var a=s.target.findAncestors(e,!0,r),o=0;o<a.length;o++)s=q.Util.cloneObject(s),s.currentTarget=a[o],n.call(a[o],s)})}remove(){return this.isDragging()&&this.stopDrag(),jt.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(me),this._clearSelfAndDescendantCache(Ar),this._clearSelfAndDescendantCache(zc),this._clearSelfAndDescendantCache(Xc),this._clearSelfAndDescendantCache(ja),this._clearSelfAndDescendantCache(Ha)}_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"+q.Util._capitalize(t);return q.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,n;if(!t)return this;for(e in t)e!==R5&&(n=Vc+q.Util._capitalize(e),q.Util._isFunction(this[n])?this[n](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(Ha,this._isListening)}_isListening(t){if(!this.listening())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isListening(t):!0}isVisible(){return this._getCache(ja,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var n=this.getLayer(),r=!1;jt.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===n)&&(r=!0)});var s=!e&&!ti.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,n=0,r,s,a,o;function h(c){for(r=[],s=c.length,a=0;a<s;a++)o=c[a],n++,o.nodeType!==$c&&(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!==L5&&l&&h(l.getChildren()),n}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(Oe),this._clearSelfAndDescendantCache(me)),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 n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(t){let e=!1,n=this.parent;for(;n;){if(n.isCached()){e=!0;break}n=n.parent}e&&!t&&(t=!0);var r=this.getAbsoluteTransform(t).getMatrix(),s=new q.Transform,a=this.offset();return s.m=r.slice(),s.translate(a.x,a.y),s.getTranslation()}setAbsolutePosition(t){const{x:e,y:n,...r}=this._clearTransform();this.attrs.x=e,this.attrs.y=n,this._clearCache(Oe);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(Oe),this._clearSelfAndDescendantCache(me),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,n=t.y,r=this.x(),s=this.y();return e!==void 0&&(r+=e),n!==void 0&&(s+=n),this.setPosition({x:r,y:s}),this}_eachAncestorReverse(t,e){var n=[],r=this.getParent(),s,a;if(!(e&&e._id===this._id)){for(n.unshift(this);r&&(!e||r._id!==e._id);)n.unshift(r),r=r.parent;for(s=n.length,a=0;a<s;a++)t(n[a])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return q.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 q.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 q.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 q.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 q.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&q.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(Ar,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(),n,r,s,a,o;t.attrs={};for(n in e)r=e[n],o=q.Util.isObject(r)&&!q.Util._isPlainObject(r)&&!q.Util._isArray(r),!o&&(s=typeof this[n]=="function"&&this[n],delete e[n],a=s?s.call(this):null,e[n]=r,a!==r&&(t.attrs[n]=r));return t.className=this.getClassName(),q.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,n){var r=[];e&&this._isMatch(t)&&r.push(this);for(var s=this.parent;s;){if(s===n)return r;s._isMatch(t)&&r.push(s),s=s.parent}return r}isAncestorOf(t){return!1}findAncestor(t,e,n){return this.findAncestors(t,e,n)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var e=t.replace(/ /g,"").split(","),n=e.length,r,s;for(r=0;r<n;r++)if(s=e[r],q.Util.isValidSelector(s)||(q.Util.warn('Selector "'+s+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),q.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),q.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(Xc,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():null}fire(t,e={},n){return e.target=e.target||this,n?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(me,this._getAbsoluteTransform)}_getAbsoluteTransform(t){var e;if(t)return e=new q.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(me)||new q.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var n=this.transformsEnabled();if(n==="all")e.multiply(this.getTransform());else if(n==="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(Oe,this._getTransform)}_getTransform(){var t,e,n=this._cache.get(Oe)||new q.Transform;n.reset();var r=this.x(),s=this.y(),a=ti.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)&&n.translate(r,s),a!==0&&n.rotate(a),(l!==0||c!==0)&&n.skew(l,c),(o!==1||h!==1)&&n.scale(o,h),(d!==0||f!==0)&&n.translate(-1*d,-1*f),n.dirty=!1,n}clone(t){var e=q.Util.cloneObject(this.attrs),n,r,s,a,o;for(n in t)e[n]=t[n];var h=new this.constructor(e);for(n in this.eventListeners)for(r=this.eventListeners[n],s=r.length,a=0;a<s;a++)o=r[a],o.name.indexOf(D5)<0&&(h.eventListeners[n]||(h.eventListeners[n]=[]),h.eventListeners[n].push(o));return h}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),n=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 kr.SceneCanvas({width:t.width||Math.ceil(e.width)||(n?n.width():0),height:t.height||Math.ceil(e.height)||(n?n.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,n=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,n);return t.callback&&t.callback(r),r}toImage(t){return new Promise((e,n)=>{try{const r=t?.callback;r&&delete t.callback,q.Util._urlToImage(this.toDataURL(t),function(s){e(s),r?.(s)})}catch(r){n(r)}})}toBlob(t){return new Promise((e,n)=>{try{const r=t?.callback;r&&delete t.callback,this.toCanvas(t).toBlob(s=>{e(s),r?.(s)})}catch(r){n(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():ti.Konva.dragDistance}_off(t,e,n){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)&&(!n||n===o)){if(r.splice(s,1),r.length===0){delete this.eventListeners[t];break}s--}}_fireChangeEvent(t,e,n){this._fire(t+M5,{oldVal:e,newVal:n})}addName(t){if(!this.hasName(t)){var e=this.name(),n=e?e+" "+t:t;this.name(n)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;var n=(e||"").split(/\s/g);return n.indexOf(t)!==-1}removeName(t){var e=(this.name()||"").split(/\s/g),n=e.indexOf(t);return n!==-1&&(e.splice(n,1),this.name(e.join(" "))),this}setAttr(t,e){var n=this[Vc+q.Util._capitalize(t)];return q.Util._isFunction(n)?n.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(ti.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,e){var n=this.attrs[t];n===e&&!q.Util.isObject(e)||(e==null?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,n,e),this._requestDraw())}_setComponentAttr(t,e,n){var r;n!==void 0&&(r=this.attrs[t],r||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=n,this._fireChangeEvent(t,r,n))}_fireAndBubble(t,e,n){e&&this.nodeType===$c&&(e.target=this);var r=(t===Hc||t===jc)&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType==="Stage"&&!n);if(!r){this._fire(t,e);var s=(t===Hc||t===jc)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!s&&(n&&n.parent?this._fireAndBubble.call(this.parent,t,e,n):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,n,r;const s=(e=this._cache.get(Pr))!==null&&e!==void 0?e:{};let a=s?.[t];if(a===void 0){a=[];let o=Object.getPrototypeOf(this);for(;o;){const h=(r=(n=o.eventListeners)===null||n===void 0?void 0:n[t])!==null&&r!==void 0?r:[];a.push(...h),o=Object.getPrototypeOf(o)}s[t]=a,this._cache.set(Pr,s)}return a}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;const n=this._getProtoListeners(t);if(n)for(var r=0;r<n.length;r++)n[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,n=this.getStage(),r=this.getAbsolutePosition();if(n){var s=n._getPointerById(e)||n._changedPointerPositions[0]||r;jt.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){jt.DD._dragElements.has(this._id)||this._createDragElement(t);const n=jt.DD._dragElements.get(this._id);n.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const n=this.getStage()._getPointerById(e.pointerId);if(n){var r={x:n.x-e.offset.x,y:n.y-e.offset.y},s=this.dragBoundFunc();if(s!==void 0){const a=s.call(this,r,t);a?r=a:q.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=jt.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),jt.DD._endDragBefore(t),jt.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=jt.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,n=!e||ti.Konva.dragButtons.indexOf(t.evt.button)>=0;if(n&&!this.isDragging()){var r=!1;jt.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=jt.DD._dragElements.get(this._id),n=e&&e.dragStatus==="dragging",r=e&&e.dragStatus==="ready";n?this.stopDrag():r&&jt.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 n={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return q.Util.haveIntersection(n,this.getClientRect())}static create(t,e){return q.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var n=wo.prototype.getClassName.call(t),r=t.children,s,a,o;e&&(t.attrs.container=e),ti.Konva[n]||(q.Util.warn('Can not find a node with class name "'+n+'". Fallback to "Shape".'),n="Shape");const h=ti.Konva[n];if(s=new h(t.attrs),r)for(a=r.length,o=0;o<a;o++)s.add(wo._createNode(r[o]));return s}};dt.Node=V,V.prototype.nodeType="Node",V.prototype._attrsAffectingSize=[],V.prototype.eventListeners={},V.prototype.on.call(V.prototype,O5,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Oe),this._clearSelfAndDescendantCache(me)}),V.prototype.on.call(V.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(ja)}),V.prototype.on.call(V.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Ha)}),V.prototype.on.call(V.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(Ar)});const at=En.Factory.addGetterSetter;at(V,"zIndex"),at(V,"absolutePosition"),at(V,"position"),at(V,"x",0,(0,yt.getNumberValidator)()),at(V,"y",0,(0,yt.getNumberValidator)()),at(V,"globalCompositeOperation","source-over",(0,yt.getStringValidator)()),at(V,"opacity",1,(0,yt.getNumberValidator)()),at(V,"name","",(0,yt.getStringValidator)()),at(V,"id","",(0,yt.getStringValidator)()),at(V,"rotation",0,(0,yt.getNumberValidator)()),En.Factory.addComponentsGetterSetter(V,"scale",["x","y"]),at(V,"scaleX",1,(0,yt.getNumberValidator)()),at(V,"scaleY",1,(0,yt.getNumberValidator)()),En.Factory.addComponentsGetterSetter(V,"skew",["x","y"]),at(V,"skewX",0,(0,yt.getNumberValidator)()),at(V,"skewY",0,(0,yt.getNumberValidator)()),En.Factory.addComponentsGetterSetter(V,"offset",["x","y"]),at(V,"offsetX",0,(0,yt.getNumberValidator)()),at(V,"offsetY",0,(0,yt.getNumberValidator)()),at(V,"dragDistance",null,(0,yt.getNumberValidator)()),at(V,"width",0,(0,yt.getNumberValidator)()),at(V,"height",0,(0,yt.getNumberValidator)()),at(V,"listening",!0,(0,yt.getBooleanValidator)()),at(V,"preventDefault",!0,(0,yt.getBooleanValidator)()),at(V,"filters",null,function(i){return this._filterUpToDate=!1,i}),at(V,"visible",!0,(0,yt.getBooleanValidator)()),at(V,"transformsEnabled","all",(0,yt.getStringValidator)()),at(V,"size"),at(V,"dragBoundFunc"),at(V,"draggable",!1,(0,yt.getBooleanValidator)()),En.Factory.backCompat(V,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var ii={};Object.defineProperty(ii,"__esModule",{value:!0}),ii.Container=void 0;const ki=X,Va=dt,Rr=N;class ni extends Va.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var n=[];return e.forEach(function(r){t(r)&&n.push(r)}),n}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 n=t[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),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 n=[];return this._descendants(r=>{const s=r._isMatch(t);return s&&n.push(r),!!(s&&e)}),n}_descendants(t){let e=!1;const n=this.getChildren();for(const r of n){if(e=t(r),e)return!0;if(r.hasChildren()&&(e=r._descendants(t),e))return!0}return!1}toObject(){var t=Va.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=Va.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(n){e.add(n.clone())}),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(t)&&e.push(n)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),!this.isCached()&&((e=this.children)===null||e===void 0||e.forEach(function(n){n._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,n){e.index=n}),this._requestDraw()}drawScene(t,e){var n=this.getLayer(),r=t||n&&n.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 n=this.getLayer(),r=t||n&&n.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,n){var r,s=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),h=this.clipFunc(),l=a&&o||h;const c=n===this;if(l){s.save();var d=this.getAbsoluteTransform(n),f=d.getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s.beginPath();let _;if(h)_=h.call(this,s,this);else{var u=this.clipX(),g=this.clipY();s.rect(u,g,a,o)}s.clip.apply(s,_),f=d.copy().invert().getMatrix(),s.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var p=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";p&&(s.save(),s._applyGlobalCompositeOperation(this)),(r=this.children)===null||r===void 0||r.forEach(function(_){_[t](e,n)}),p&&s.restore(),l&&s.restore()}getClientRect(t={}){var e,n=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(p){if(p.visible()){var _=p.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(s===void 0?(s=_.x,a=_.y,o=_.x+_.width,h=_.y+_.height):(s=Math.min(s,_.x),a=Math.min(a,_.y),o=Math.max(o,_.x+_.width),h=Math.max(h,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,u=0;u<d.length;u++){var g=d[u];if(g._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},n?l:this._transformedRect(l,r)}}ii.Container=ni,ki.Factory.addComponentsGetterSetter(ni,"clip",["x","y","width","height"]),ki.Factory.addGetterSetter(ni,"clipX",void 0,(0,Rr.getNumberValidator)()),ki.Factory.addGetterSetter(ni,"clipY",void 0,(0,Rr.getNumberValidator)()),ki.Factory.addGetterSetter(ni,"clipWidth",void 0,(0,Rr.getNumberValidator)()),ki.Factory.addGetterSetter(ni,"clipHeight",void 0,(0,Rr.getNumberValidator)()),ki.Factory.addGetterSetter(ni,"clipFunc");var Yc={},Ft={};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.releaseCapture=Ft.setPointerCapture=Ft.hasPointerCapture=Ft.createEvent=Ft.getCapturedShape=void 0;const F5=Y,kn=new Map,Wc=F5.Konva._global.PointerEvent!==void 0;function N5(i){return kn.get(i)}Ft.getCapturedShape=N5;function $a(i){return{evt:i,pointerId:i.pointerId}}Ft.createEvent=$a;function U5(i,t){return kn.get(i)===t}Ft.hasPointerCapture=U5;function G5(i,t){qc(i),t.getStage()&&(kn.set(i,t),Wc&&t._fire("gotpointercapture",$a(new PointerEvent("gotpointercapture"))))}Ft.setPointerCapture=G5;function qc(i,t){const e=kn.get(i);if(!e)return;const n=e.getStage();n&&n.content,kn.delete(i),Wc&&e._fire("lostpointercapture",$a(new PointerEvent("lostpointercapture")))}Ft.releaseCapture=qc,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Stage=i.stages=void 0;const t=gt,e=X,n=ii,r=Y,s=$t,a=Er,o=Y,h=Ft;var l="Stage",c="string",d="px",f="mouseout",u="mouseleave",g="mouseover",p="mouseenter",_="mousemove",y="mousedown",b="mouseup",m="pointermove",v="pointerdown",w="pointerup",S="pointercancel",k="lostpointercapture",C="pointerout",A="pointerleave",x="pointerover",T="pointerenter",M="contextmenu",D="touchstart",O="touchend",I="touchmove",H="touchcancel",j="wheel",$=5,et=[[p,"_pointerenter"],[y,"_pointerdown"],[_,"_pointermove"],[b,"_pointerup"],[u,"_pointerleave"],[D,"_pointerdown"],[I,"_pointermove"],[O,"_pointerup"],[H,"_pointercancel"],[g,"_pointerover"],[j,"_wheel"],[M,"_contextmenu"],[v,"_pointerdown"],[m,"_pointermove"],[w,"_pointerup"],[S,"_pointercancel"],[k,"_lostpointercapture"]];const G={mouse:{[C]:f,[A]:u,[x]:g,[T]:p,[m]:_,[v]:y,[w]:b,[S]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[C]:"touchout",[A]:"touchleave",[x]:"touchover",[T]:"touchenter",[m]:I,[v]:D,[w]:O,[S]:H,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[C]:C,[A]:A,[x]:x,[T]:T,[m]:m,[v]:v,[w]:w,[S]:S,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},z=Nt=>Nt.indexOf("pointer")>=0?"pointer":Nt.indexOf("touch")>=0?"touch":"mouse",W=Nt=>{const P=z(Nt);if(P==="pointer")return r.Konva.pointerEventsEnabled&&G.pointer;if(P==="touch")return G.touch;if(P==="mouse")return G.mouse};function J(Nt={}){return(Nt.clipFunc||Nt.clipWidth||Nt.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Nt}const lt="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);";i.stages=[];class we extends n.Container{constructor(P){super(J(P)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),i.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",()=>{J(this.attrs)}),this._checkVisibility()}_validateAdd(P){const F=P.getType()==="Layer",B=P.getType()==="FastLayer";F||B||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const P=this.visible()?"":"none";this.content.style.display=P}setContainer(P){if(typeof P===c){if(P.charAt(0)==="."){var F=P.slice(1);P=document.getElementsByClassName(F)[0]}else{var B;P.charAt(0)!=="#"?B=P:B=P.slice(1),P=document.getElementById(B)}if(!P)throw"Can not find container in document with id "+B}return this._setAttr("container",P),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),P.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var P=this.children,F=P.length,B;for(B=0;B<F;B++)P[B].clear();return this}clone(P){return P||(P={}),P.container=typeof document<"u"&&document.createElement("div"),n.Container.prototype.clone.call(this,P)}destroy(){super.destroy();var P=this.content;P&&t.Util._isInDocument(P)&&this.container().removeChild(P);var F=i.stages.indexOf(this);return F>-1&&i.stages.splice(F,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const P=this._pointerPositions[0]||this._changedPointerPositions[0];return P?{x:P.x,y:P.y}:(t.Util.warn(lt),null)}_getPointerById(P){return this._pointerPositions.find(F=>F.id===P)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(P){P=P||{},P.x=P.x||0,P.y=P.y||0,P.width=P.width||this.width(),P.height=P.height||this.height();var F=new s.SceneCanvas({width:P.width,height:P.height,pixelRatio:P.pixelRatio||1}),B=F.getContext()._context,ft=this.children;return(P.x||P.y)&&B.translate(-1*P.x,-1*P.y),ft.forEach(function(st){if(st.isVisible()){var bt=st._toKonvaCanvas(P);B.drawImage(bt._canvas,P.x,P.y,bt.getWidth()/bt.getPixelRatio(),bt.getHeight()/bt.getPixelRatio())}}),F}getIntersection(P){if(!P)return null;var F=this.children,B=F.length,ft=B-1,st;for(st=ft;st>=0;st--){const bt=F[st].getIntersection(P);if(bt)return bt}return null}_resizeDOM(){var P=this.width(),F=this.height();this.content&&(this.content.style.width=P+d,this.content.style.height=F+d),this.bufferCanvas.setSize(P,F),this.bufferHitCanvas.setSize(P,F),this.children.forEach(B=>{B.setSize({width:P,height:F}),B.draw()})}add(P,...F){if(arguments.length>1){for(var B=0;B<arguments.length;B++)this.add(arguments[B]);return this}super.add(P);var ft=this.children.length;return ft>$&&t.Util.warn("The stage has "+ft+" 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."),P.setSize({width:this.width(),height:this.height()}),P.draw(),r.Konva.isBrowser&&this.content.appendChild(P.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(P){return h.hasPointerCapture(P,this)}setPointerCapture(P){h.setPointerCapture(P,this)}releaseCapture(P){h.releaseCapture(P,this)}getLayers(){return this.children}_bindContentEvents(){r.Konva.isBrowser&&et.forEach(([P,F])=>{this.content.addEventListener(P,B=>{this[F](B)},{passive:!1})})}_pointerenter(P){this.setPointersPositions(P);const F=W(P.type);F&&this._fire(F.pointerenter,{evt:P,target:this,currentTarget:this})}_pointerover(P){this.setPointersPositions(P);const F=W(P.type);F&&this._fire(F.pointerover,{evt:P,target:this,currentTarget:this})}_getTargetShape(P){let F=this[P+"targetShape"];return F&&!F.getStage()&&(F=null),F}_pointerleave(P){const F=W(P.type),B=z(P.type);if(F){this.setPointersPositions(P);var ft=this._getTargetShape(B),st=!a.DD.isDragging||r.Konva.hitOnDragEnabled;ft&&st?(ft._fireAndBubble(F.pointerout,{evt:P}),ft._fireAndBubble(F.pointerleave,{evt:P}),this._fire(F.pointerleave,{evt:P,target:this,currentTarget:this}),this[B+"targetShape"]=null):st&&(this._fire(F.pointerleave,{evt:P,target:this,currentTarget:this}),this._fire(F.pointerout,{evt:P,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(P){const F=W(P.type),B=z(P.type);if(F){this.setPointersPositions(P);var ft=!1;this._changedPointerPositions.forEach(st=>{var bt=this.getIntersection(st);if(a.DD.justDragged=!1,r.Konva["_"+B+"ListenClick"]=!0,!bt||!bt.isListening())return;r.Konva.capturePointerEventsEnabled&&bt.setPointerCapture(st.id),this[B+"ClickStartShape"]=bt,bt._fireAndBubble(F.pointerdown,{evt:P,pointerId:st.id}),ft=!0;const Vt=P.type.indexOf("touch")>=0;bt.preventDefault()&&P.cancelable&&Vt&&P.preventDefault()}),ft||this._fire(F.pointerdown,{evt:P,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(P){const F=W(P.type),B=z(P.type);if(!F)return;a.DD.isDragging&&a.DD.node.preventDefault()&&P.cancelable&&P.preventDefault(),this.setPointersPositions(P);var ft=!a.DD.isDragging||r.Konva.hitOnDragEnabled;if(!ft)return;var st={};let bt=!1;var Vt=this._getTargetShape(B);this._changedPointerPositions.forEach(je=>{const ht=h.getCapturedShape(je.id)||this.getIntersection(je),zi=je.id,Se={evt:P,pointerId:zi};var Hi=Vt!==ht;if(Hi&&Vt&&(Vt._fireAndBubble(F.pointerout,{...Se},ht),Vt._fireAndBubble(F.pointerleave,{...Se},ht)),ht){if(st[ht._id])return;st[ht._id]=!0}ht&&ht.isListening()?(bt=!0,Hi&&(ht._fireAndBubble(F.pointerover,{...Se},Vt),ht._fireAndBubble(F.pointerenter,{...Se},Vt),this[B+"targetShape"]=ht),ht._fireAndBubble(F.pointermove,{...Se})):Vt&&(this._fire(F.pointerover,{evt:P,target:this,currentTarget:this,pointerId:zi}),this[B+"targetShape"]=null)}),bt||this._fire(F.pointermove,{evt:P,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(P){const F=W(P.type),B=z(P.type);if(!F)return;this.setPointersPositions(P);const ft=this[B+"ClickStartShape"],st=this[B+"ClickEndShape"];var bt={};let Vt=!1;this._changedPointerPositions.forEach(je=>{const ht=h.getCapturedShape(je.id)||this.getIntersection(je);if(ht){if(ht.releaseCapture(je.id),bt[ht._id])return;bt[ht._id]=!0}const zi=je.id,Se={evt:P,pointerId:zi};let Hi=!1;r.Konva["_"+B+"InDblClickWindow"]?(Hi=!0,clearTimeout(this[B+"DblTimeout"])):a.DD.justDragged||(r.Konva["_"+B+"InDblClickWindow"]=!0,clearTimeout(this[B+"DblTimeout"])),this[B+"DblTimeout"]=setTimeout(function(){r.Konva["_"+B+"InDblClickWindow"]=!1},r.Konva.dblClickWindow),ht&&ht.isListening()?(Vt=!0,this[B+"ClickEndShape"]=ht,ht._fireAndBubble(F.pointerup,{...Se}),r.Konva["_"+B+"ListenClick"]&&ft&&ft===ht&&(ht._fireAndBubble(F.pointerclick,{...Se}),Hi&&st&&st===ht&&ht._fireAndBubble(F.pointerdblclick,{...Se}))):(this[B+"ClickEndShape"]=null,r.Konva["_"+B+"ListenClick"]&&this._fire(F.pointerclick,{evt:P,target:this,currentTarget:this,pointerId:zi}),Hi&&this._fire(F.pointerdblclick,{evt:P,target:this,currentTarget:this,pointerId:zi}))}),Vt||this._fire(F.pointerup,{evt:P,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r.Konva["_"+B+"ListenClick"]=!1,P.cancelable&&B!=="touch"&&P.preventDefault()}_contextmenu(P){this.setPointersPositions(P);var F=this.getIntersection(this.getPointerPosition());F&&F.isListening()?F._fireAndBubble(M,{evt:P}):this._fire(M,{evt:P,target:this,currentTarget:this})}_wheel(P){this.setPointersPositions(P);var F=this.getIntersection(this.getPointerPosition());F&&F.isListening()?F._fireAndBubble(j,{evt:P}):this._fire(j,{evt:P,target:this,currentTarget:this})}_pointercancel(P){this.setPointersPositions(P);const F=h.getCapturedShape(P.pointerId)||this.getIntersection(this.getPointerPosition());F&&F._fireAndBubble(w,h.createEvent(P)),h.releaseCapture(P.pointerId)}_lostpointercapture(P){h.releaseCapture(P.pointerId)}setPointersPositions(P){var F=this._getContentPosition(),B=null,ft=null;P=P||window.event,P.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(P.touches,st=>{this._pointerPositions.push({id:st.identifier,x:(st.clientX-F.left)/F.scaleX,y:(st.clientY-F.top)/F.scaleY})}),Array.prototype.forEach.call(P.changedTouches||P.touches,st=>{this._changedPointerPositions.push({id:st.identifier,x:(st.clientX-F.left)/F.scaleX,y:(st.clientY-F.top)/F.scaleY})})):(B=(P.clientX-F.left)/F.scaleX,ft=(P.clientY-F.top)/F.scaleY,this.pointerPos={x:B,y:ft},this._pointerPositions=[{x:B,y:ft,id:t.Util._getFirstPointerId(P)}],this._changedPointerPositions=[{x:B,y:ft,id:t.Util._getFirstPointerId(P)}])}_setPointerPosition(P){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(P)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var P=this.content.getBoundingClientRect();return{top:P.top,left:P.left,scaleX:P.width/this.content.clientWidth||1,scaleY:P.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 P=this.container();if(!P)throw"Stage has no container. A container is required.";P.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"),P.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(P){P.batchDraw()}),this}}i.Stage=we,we.prototype.nodeType=l,(0,o._registerNode)(we),e.Factory.addGetterSetter(we,"container")}(Yc);var An={},St={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Shape=i.shapes=void 0;const t=Y,e=gt,n=X,r=dt,s=N,a=Y,o=Ft;var h="hasShadow",l="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let u;function g(){return u||(u=e.Util.createCanvasElement().getContext("2d"),u)}i.shapes={};function p(A){const x=this.attrs.fillRule;x?A.fill(x):A.fill()}function _(A){A.stroke()}function y(A){A.fill()}function b(A){A.stroke()}function m(){this._clearCache(h)}function v(){this._clearCache(l)}function w(){this._clearCache(c)}function S(){this._clearCache(d)}function k(){this._clearCache(f)}class C extends r.Node{constructor(x){super(x);let T;for(;T=e.Util.getRandomColor(),!(T&&!(T in i.shapes)););this.colorKey=T,i.shapes[T]=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 x=g();const T=x.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(T&&T.setTransform){const M=new e.Transform;M.translate(this.fillPatternX(),this.fillPatternY()),M.rotate(t.Konva.getAngle(this.fillPatternRotation())),M.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),M.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const D=M.getMatrix(),O=typeof DOMMatrix>"u"?{a:D[0],b:D[1],c:D[2],d:D[3],e:D[4],f:D[5]}:new DOMMatrix(D);T.setTransform(O)}return T}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var x=this.fillLinearGradientColorStops();if(x){for(var T=g(),M=this.fillLinearGradientStartPoint(),D=this.fillLinearGradientEndPoint(),O=T.createLinearGradient(M.x,M.y,D.x,D.y),I=0;I<x.length;I+=2)O.addColorStop(x[I],x[I+1]);return O}}_getRadialGradient(){return this._getCache(f,this.__getRadialGradient)}__getRadialGradient(){var x=this.fillRadialGradientColorStops();if(x){for(var T=g(),M=this.fillRadialGradientStartPoint(),D=this.fillRadialGradientEndPoint(),O=T.createRadialGradient(M.x,M.y,this.fillRadialGradientStartRadius(),D.x,D.y,this.fillRadialGradientEndRadius()),I=0;I<x.length;I+=2)O.addColorStop(x[I],x[I+1]);return O}}getShadowRGBA(){return this._getCache(l,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var x=e.Util.colorToRGBA(this.shadowColor());if(x)return"rgba("+x.r+","+x.g+","+x.b+","+x.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 x=this.hitStrokeWidth();return x==="auto"?this.hasStroke():this.strokeEnabled()&&!!x}intersects(x){var T=this.getStage();if(!T)return!1;const M=T.bufferHitCanvas;return M.getContext().clear(),this.drawHit(M,void 0,!0),M.context.getImageData(Math.round(x.x),Math.round(x.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete i.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(x){var T;if(!this.getStage()||!((T=this.attrs.perfectDrawEnabled)!==null&&T!==void 0?T:!0))return!1;const D=x||this.hasFill(),O=this.hasStroke(),I=this.getAbsoluteOpacity()!==1;if(D&&O&&I)return!0;const H=this.hasShadow(),j=this.shadowForStrokeEnabled();return!!(D&&O&&H&&j)}setStrokeHitEnabled(x){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),x?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var x=this.size();return{x:this._centroid?-x.width/2:0,y:this._centroid?-x.height/2:0,width:x.width,height:x.height}}getClientRect(x={}){const T=x.skipTransform,M=x.relativeTo,D=this.getSelfRect(),I=!x.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,H=D.width+I,j=D.height+I,$=!x.skipShadow&&this.hasShadow(),et=$?this.shadowOffsetX():0,G=$?this.shadowOffsetY():0,z=H+Math.abs(et),W=j+Math.abs(G),J=$&&this.shadowBlur()||0,lt=z+J*2,we=W+J*2,Nt={width:lt,height:we,x:-(I/2+J)+Math.min(et,0)+D.x,y:-(I/2+J)+Math.min(G,0)+D.y};return T?Nt:this._transformedRect(Nt,M)}drawScene(x,T){var M=this.getLayer(),D=x||M.getCanvas(),O=D.getContext(),I=this._getCanvasCache(),H=this.getSceneFunc(),j=this.hasShadow(),$,et,G,z=D.isCache,W=T===this;if(!this.isVisible()&&!W)return this;if(I){O.save();var J=this.getAbsoluteTransform(T).getMatrix();return O.transform(J[0],J[1],J[2],J[3],J[4],J[5]),this._drawCachedSceneCanvas(O),O.restore(),this}if(!H)return this;if(O.save(),this._useBufferCanvas()&&!z){$=this.getStage(),et=$.bufferCanvas,G=et.getContext(),G.clear(),G.save(),G._applyLineJoin(this);var lt=this.getAbsoluteTransform(T).getMatrix();G.transform(lt[0],lt[1],lt[2],lt[3],lt[4],lt[5]),H.call(this,G,this),G.restore();var we=et.pixelRatio;j&&O._applyShadow(this),O._applyOpacity(this),O._applyGlobalCompositeOperation(this),O.drawImage(et._canvas,0,0,et.width/we,et.height/we)}else{if(O._applyLineJoin(this),!W){var lt=this.getAbsoluteTransform(T).getMatrix();O.transform(lt[0],lt[1],lt[2],lt[3],lt[4],lt[5]),O._applyOpacity(this),O._applyGlobalCompositeOperation(this)}j&&O._applyShadow(this),H.call(this,O,this)}return O.restore(),this}drawHit(x,T,M=!1){if(!this.shouldDrawHit(T,M))return this;var D=this.getLayer(),O=x||D.hitCanvas,I=O&&O.getContext(),H=this.hitFunc()||this.sceneFunc(),j=this._getCanvasCache(),$=j&&j.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()"),$){I.save();var et=this.getAbsoluteTransform(T).getMatrix();return I.transform(et[0],et[1],et[2],et[3],et[4],et[5]),this._drawCachedHitCanvas(I),I.restore(),this}if(!H)return this;if(I.save(),I._applyLineJoin(this),!(this===T)){var z=this.getAbsoluteTransform(T).getMatrix();I.transform(z[0],z[1],z[2],z[3],z[4],z[5])}return H.call(this,I,this),I.restore(),this}drawHitFromCache(x=0){var T=this._getCanvasCache(),M=this._getCachedSceneCanvas(),D=T.hit,O=D.getContext(),I=D.getWidth(),H=D.getHeight(),j,$,et,G,z,W;O.clear(),O.drawImage(M._canvas,0,0,I,H);try{for(j=O.getImageData(0,0,I,H),$=j.data,et=$.length,G=e.Util._hexToRgb(this.colorKey),z=0;z<et;z+=4)W=$[z+3],W>x?($[z]=G.r,$[z+1]=G.g,$[z+2]=G.b,$[z+3]=255):$[z+3]=0;O.putImageData(j,0,0)}catch(J){e.Util.error("Unable to draw hit graph from cached scene canvas. "+J.message)}return this}hasPointerCapture(x){return o.hasPointerCapture(x,this)}setPointerCapture(x){o.setPointerCapture(x,this)}releaseCapture(x){o.releaseCapture(x,this)}}i.Shape=C,C.prototype._fillFunc=p,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=y,C.prototype._strokeFuncHit=b,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",m),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",v),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",k),n.Factory.addGetterSetter(C,"stroke",void 0,(0,s.getStringOrGradientValidator)()),n.Factory.addGetterSetter(C,"strokeWidth",2,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),n.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),n.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(C,"lineJoin"),n.Factory.addGetterSetter(C,"lineCap"),n.Factory.addGetterSetter(C,"sceneFunc"),n.Factory.addGetterSetter(C,"hitFunc"),n.Factory.addGetterSetter(C,"dash"),n.Factory.addGetterSetter(C,"dashOffset",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"shadowColor",void 0,(0,s.getStringValidator)()),n.Factory.addGetterSetter(C,"shadowBlur",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"shadowOpacity",1,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),n.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillPatternImage"),n.Factory.addGetterSetter(C,"fill",void 0,(0,s.getStringOrGradientValidator)()),n.Factory.addGetterSetter(C,"fillPatternX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillPatternY",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),n.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),n.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),n.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),n.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),n.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),n.Factory.addGetterSetter(C,"fillEnabled",!0),n.Factory.addGetterSetter(C,"strokeEnabled",!0),n.Factory.addGetterSetter(C,"shadowEnabled",!0),n.Factory.addGetterSetter(C,"dashEnabled",!0),n.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),n.Factory.addGetterSetter(C,"fillPriority","color"),n.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),n.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),n.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),n.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),n.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),n.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),n.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),n.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),n.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),n.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),n.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),n.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),n.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),n.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),n.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),n.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),n.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),n.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),n.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),n.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),n.Factory.addGetterSetter(C,"fillPatternRotation",0),n.Factory.addGetterSetter(C,"fillRule",void 0,(0,s.getStringValidator)()),n.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(St),Object.defineProperty(An,"__esModule",{value:!0}),An.Layer=void 0;const _e=gt,Xa=ii,Ai=dt,Ya=X,Kc=$t,B5=N,z5=St,H5=Y;var j5="#",V5="beforeDraw",$5="draw",Zc=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],X5=Zc.length;class Pi extends Xa.Container{constructor(t){super(t),this.canvas=new Kc.SceneCanvas,this.hitCanvas=new Kc.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(){Ai.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=Ai.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(Ai.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(Ai.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 Ai.Node.prototype.remove.call(this),t&&t.parentNode&&_e.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"&&_e.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(),Ai.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(){_e.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){_e.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,_e.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,n=!1;;){for(let r=0;r<X5;r++){const s=Zc[r],a=this._getIntersection({x:t.x+s.x*e,y:t.y+s.y*e}),o=a.shape;if(o)return o;if(n=!!a.antialiased,!a.antialiased)break}if(n)e+=1;else return null}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=n[3];if(r===255){const s=_e.Util._rgbToHex(n[0],n[1],n[2]),a=z5.shapes[j5+s];return a?{shape:a}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas();return this._fire(V5,{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Xa.Container.prototype.drawScene.call(this,r,e),this._fire($5,{node:this}),this}drawHit(t,e){var n=this.getLayer(),r=t||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Xa.Container.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){_e.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return _e.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 _e.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}An.Layer=Pi,Pi.prototype.nodeType="Layer",(0,H5._registerNode)(Pi),Ya.Factory.addGetterSetter(Pi,"imageSmoothingEnabled",!0),Ya.Factory.addGetterSetter(Pi,"clearBeforeDraw",!0),Ya.Factory.addGetterSetter(Pi,"hitGraphEnabled",!0,(0,B5.getBooleanValidator)());var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.FastLayer=void 0;const Y5=gt,W5=An,q5=Y;class Wa extends W5.Layer{constructor(t){super(t),this.listening(!1),Y5.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Dr.FastLayer=Wa,Wa.prototype.nodeType="FastLayer",(0,q5._registerNode)(Wa);var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.Group=void 0;const K5=gt,Z5=ii,J5=Y;class qa extends Z5.Container{_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&K5.Util.throw("You may only add groups and shapes to groups.")}}Mi.Group=qa,qa.prototype.nodeType="Group",(0,J5._registerNode)(qa);var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.Animation=void 0;const Ka=Y,Jc=gt,Za=function(){return Ka.glob.performance&&Ka.glob.performance.now?function(){return Ka.glob.performance.now()}:function(){return new Date().getTime()}}();class te{constructor(t,e){this.id=te.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Za(),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,n=e.length;for(let r=0;r<n;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=te.animations,n=e.length;for(let r=0;r<n;r++)if(e[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=Za(),te._addAnimation(this),this}stop(){return te._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,n=this.animations,r=n.length;for(let s=0;s<r;s++)if(n[s].id===e){this.animations.splice(s,1);break}}static _runFrames(){const t={},e=this.animations;for(let n=0;n<e.length;n++){const r=e[n],s=r.layers,a=r.func;r._updateFrameObject(Za());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 n in t)t.hasOwnProperty(n)&&t[n].batchDraw()}static _animationLoop(){const t=te;t.animations.length?(t._runFrames(),Jc.Util.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Jc.Util.requestAnimFrame(this._animationLoop))}}Ri.Animation=te,te.animations=[],te.animIdCounter=0,te.animRunning=!1;var Qc={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Easings=i.Tween=void 0;const t=gt,e=Ri,n=dt,r=Y;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(g,p,_,y,b,m,v){this.prop=g,this.propFunc=p,this.begin=y,this._pos=y,this.duration=m,this._change=0,this.prevPos=0,this.yoyo=v,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=_,this._change=b-this.begin,this.pause()}fire(g){var p=this[g];p&&p()}setTime(g){g>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():g<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=g,this.update())}getTime(){return this._time}setPosition(g){this.prevPos=this._pos,this.propFunc(g),this._pos=g}getPosition(g){return g===void 0&&(g=this._time),this.func(g,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(g){this.pause(),this._time=g,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 g=this.getTimer()-this._startTime;this.state===o?this.setTime(g):this.state===h&&this.setTime(this.duration-g)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(g){var p=this,_=g.node,y=_._id,b,m=g.easing||i.Easings.Linear,v=!!g.yoyo,w;typeof g.duration>"u"?b=.3:g.duration===0?b=.001:b=g.duration,this.node=_,this._id=l++;var S=_.getLayer()||(_ instanceof r.Konva.Stage?_.getLayers():null);S||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(){p.tween.onEnterFrame()},S),this.tween=new d(w,function(k){p._tweenFunc(k)},m,0,1,b*1e3,v),this._addListeners(),f.attrs[y]||(f.attrs[y]={}),f.attrs[y][this._id]||(f.attrs[y][this._id]={}),f.tweens[y]||(f.tweens[y]={});for(w in g)s[w]===void 0&&this._addAttr(w,g[w]);this.reset(),this.onFinish=g.onFinish,this.onReset=g.onReset,this.onUpdate=g.onUpdate}_addAttr(g,p){var _=this.node,y=_._id,b,m,v,w,S,k,C,A;if(v=f.tweens[y][g],v&&delete f.attrs[y][v][g],b=_.getAttr(g),t.Util._isArray(p))if(m=[],S=Math.max(p.length,b.length),g==="points"&&p.length!==b.length&&(p.length>b.length?(C=b,b=t.Util._prepareArrayForTween(b,p,_.closed())):(k=p,p=t.Util._prepareArrayForTween(p,b,_.closed()))),g.indexOf("fill")===0)for(w=0;w<S;w++)if(w%2===0)m.push(p[w]-b[w]);else{var x=t.Util.colorToRGBA(b[w]);A=t.Util.colorToRGBA(p[w]),b[w]=x,m.push({r:A.r-x.r,g:A.g-x.g,b:A.b-x.b,a:A.a-x.a})}else for(w=0;w<S;w++)m.push(p[w]-b[w]);else c.indexOf(g)!==-1?(b=t.Util.colorToRGBA(b),A=t.Util.colorToRGBA(p),m={r:A.r-b.r,g:A.g-b.g,b:A.b-b.b,a:A.a-b.a}):m=p-b;f.attrs[y][this._id][g]={start:b,diff:m,end:p,trueEnd:k,trueStart:C},f.tweens[y][g]=this._id}_tweenFunc(g){var p=this.node,_=f.attrs[p._id][this._id],y,b,m,v,w,S,k,C;for(y in _){if(b=_[y],m=b.start,v=b.diff,C=b.end,t.Util._isArray(m))if(w=[],k=Math.max(m.length,C.length),y.indexOf("fill")===0)for(S=0;S<k;S++)S%2===0?w.push((m[S]||0)+v[S]*g):w.push("rgba("+Math.round(m[S].r+v[S].r*g)+","+Math.round(m[S].g+v[S].g*g)+","+Math.round(m[S].b+v[S].b*g)+","+(m[S].a+v[S].a*g)+")");else for(S=0;S<k;S++)w.push((m[S]||0)+v[S]*g);else c.indexOf(y)!==-1?w="rgba("+Math.round(m.r+v.r*g)+","+Math.round(m.g+v.g*g)+","+Math.round(m.b+v.b*g)+","+(m.a+v.a*g)+")":w=m+v*g;p.setAttr(y,w)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var g=this.node,p=f.attrs[g._id][this._id];p.points&&p.points.trueEnd&&g.setAttr("points",p.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var g=this.node,p=f.attrs[g._id][this._id];p.points&&p.points.trueStart&&g.points(p.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(g){return this.tween.seek(g*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var g=this.node._id,p=this._id,_=f.tweens[g],y;this.pause();for(y in _)delete f.tweens[g][y];delete f.attrs[g][p]}}i.Tween=f,f.attrs={},f.tweens={},n.Node.prototype.to=function(u){var g=u.onFinish;u.node=this,u.onFinish=function(){this.destroy(),g&&g()};var p=new f(u);p.play()},i.Easings={BackEaseIn(u,g,p,_){var y=1.70158;return p*(u/=_)*u*((y+1)*u-y)+g},BackEaseOut(u,g,p,_){var y=1.70158;return p*((u=u/_-1)*u*((y+1)*u+y)+1)+g},BackEaseInOut(u,g,p,_){var y=1.70158;return(u/=_/2)<1?p/2*(u*u*(((y*=1.525)+1)*u-y))+g:p/2*((u-=2)*u*(((y*=1.525)+1)*u+y)+2)+g},ElasticEaseIn(u,g,p,_,y,b){var m=0;return u===0?g:(u/=_)===1?g+p:(b||(b=_*.3),!y||y<Math.abs(p)?(y=p,m=b/4):m=b/(2*Math.PI)*Math.asin(p/y),-(y*Math.pow(2,10*(u-=1))*Math.sin((u*_-m)*(2*Math.PI)/b))+g)},ElasticEaseOut(u,g,p,_,y,b){var m=0;return u===0?g:(u/=_)===1?g+p:(b||(b=_*.3),!y||y<Math.abs(p)?(y=p,m=b/4):m=b/(2*Math.PI)*Math.asin(p/y),y*Math.pow(2,-10*u)*Math.sin((u*_-m)*(2*Math.PI)/b)+p+g)},ElasticEaseInOut(u,g,p,_,y,b){var m=0;return u===0?g:(u/=_/2)===2?g+p:(b||(b=_*(.3*1.5)),!y||y<Math.abs(p)?(y=p,m=b/4):m=b/(2*Math.PI)*Math.asin(p/y),u<1?-.5*(y*Math.pow(2,10*(u-=1))*Math.sin((u*_-m)*(2*Math.PI)/b))+g:y*Math.pow(2,-10*(u-=1))*Math.sin((u*_-m)*(2*Math.PI)/b)*.5+p+g)},BounceEaseOut(u,g,p,_){return(u/=_)<1/2.75?p*(7.5625*u*u)+g:u<2/2.75?p*(7.5625*(u-=1.5/2.75)*u+.75)+g:u<2.5/2.75?p*(7.5625*(u-=2.25/2.75)*u+.9375)+g:p*(7.5625*(u-=2.625/2.75)*u+.984375)+g},BounceEaseIn(u,g,p,_){return p-i.Easings.BounceEaseOut(_-u,0,p,_)+g},BounceEaseInOut(u,g,p,_){return u<_/2?i.Easings.BounceEaseIn(u*2,0,p,_)*.5+g:i.Easings.BounceEaseOut(u*2-_,0,p,_)*.5+p*.5+g},EaseIn(u,g,p,_){return p*(u/=_)*u+g},EaseOut(u,g,p,_){return-p*(u/=_)*(u-2)+g},EaseInOut(u,g,p,_){return(u/=_/2)<1?p/2*u*u+g:-p/2*(--u*(u-2)-1)+g},StrongEaseIn(u,g,p,_){return p*(u/=_)*u*u*u*u+g},StrongEaseOut(u,g,p,_){return p*((u=u/_-1)*u*u*u*u+1)+g},StrongEaseInOut(u,g,p,_){return(u/=_/2)<1?p/2*u*u*u*u*u+g:p/2*((u-=2)*u*u*u*u+2)+g},Linear(u,g,p,_){return p*u/_+g}}})(Qc),function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Konva=void 0;const t=Y,e=gt,n=dt,r=ii,s=Yc,a=An,o=Dr,h=Mi,l=Er,c=St,d=Ri,f=Qc,u=pe,g=$t;i.Konva=e.Util._assign(t.Konva,{Util:e.Util,Transform:e.Transform,Node:n.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:g.Canvas}),i.default=i.Konva}(Ic);var Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.Arc=void 0;const Or=X,Q5=St,tu=Y,Ir=N,t3=Y;class ve extends Q5.Shape{_sceneFunc(t){var e=tu.Konva.getAngle(this.angle()),n=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,n),t.arc(0,0,this.innerRadius(),e,0,!n),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(),n=this.clockwise(),r=tu.Konva.getAngle(n?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:n?-1*f:d,width:c-l,height:f-d}}}Lr.Arc=ve,ve.prototype._centroid=!0,ve.prototype.className="Arc",ve.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,t3._registerNode)(ve),Or.Factory.addGetterSetter(ve,"innerRadius",0,(0,Ir.getNumberValidator)()),Or.Factory.addGetterSetter(ve,"outerRadius",0,(0,Ir.getNumberValidator)()),Or.Factory.addGetterSetter(ve,"angle",0,(0,Ir.getNumberValidator)()),Or.Factory.addGetterSetter(ve,"clockwise",!1,(0,Ir.getBooleanValidator)());var Fr={},Pn={};Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.Line=void 0;const Nr=X,e3=St,eu=N,i3=Y;function Ja(i,t,e,n,r,s,a){var o=Math.sqrt(Math.pow(e-i,2)+Math.pow(n-t,2)),h=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-n,2)),l=a*o/(o+h),c=a*h/(o+h),d=e-l*(r-i),f=n-l*(s-t),u=e+c*(r-i),g=n+c*(s-t);return[d,f,u,g]}function iu(i,t){var e=i.length,n=[],r,s;for(r=2;r<e-2;r+=2)s=Ja(i[r-2],i[r-1],i[r],i[r+1],i[r+2],i[r+3],t),!isNaN(s[0])&&(n.push(s[0]),n.push(s[1]),n.push(i[r]),n.push(i[r+1]),n.push(s[2]),n.push(s[3]));return n}class Ie extends e3.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(),n=e.length,r=this.tension(),s=this.closed(),a=this.bezier(),o,h,l;if(n){if(t.beginPath(),t.moveTo(e[0],e[1]),r!==0&&n>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[n-2],e[n-1])}else if(a)for(l=2;l<n;)t.bezierCurveTo(e[l++],e[l++],e[l++],e[l++],e[l++],e[l++]);else for(l=2;l<n;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():iu(this.points(),this.tension())}_getTensionPointsClosed(){var t=this.points(),e=t.length,n=this.tension(),r=Ja(t[e-2],t[e-1],t[0],t[1],t[2],t[3],n),s=Ja(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],n),a=iu(t,n),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],n=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),n=Math.max(n,a),r=Math.min(r,o),s=Math.max(s,o);return{x:e,y:r,width:n-e,height:s-r}}}Pn.Line=Ie,Ie.prototype.className="Line",Ie.prototype._attrsAffectingSize=["points","bezier","tension"],(0,i3._registerNode)(Ie),Nr.Factory.addGetterSetter(Ie,"closed",!1),Nr.Factory.addGetterSetter(Ie,"bezier",!1),Nr.Factory.addGetterSetter(Ie,"tension",0,(0,eu.getNumberValidator)()),Nr.Factory.addGetterSetter(Ie,"points",[],(0,eu.getNumberArrayValidator)());var Di={},nu={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.t2length=i.getQuadraticArcLength=i.getCubicArcLength=i.binomialCoefficients=i.cValues=i.tValues=void 0,i.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]],i.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]],i.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*i.tValues[20][u]+l,c+=i.cValues[20][u]*n(a,o,d);return l*c};i.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),g=4*(l*d+c*f),p=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 _=g/(2*u),y=p/u,b=h+_,m=y-_*_,v=b*b+m>0?Math.sqrt(b*b+m):0,w=_*_+m>0?Math.sqrt(_*_+m):0,S=_+Math.sqrt(_*_+m)!==0?m*Math.log(Math.abs((b+v)/(_+w))):0;return Math.sqrt(u)/2*(b*v-_*w+S)};i.getQuadraticArcLength=e;function n(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+=i.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),g=Math.abs(a-u)/o;if(g<l)l=g,c+=d;else{const p=h(c-d),_=Math.abs(a-p)/o;_<l?(l=_,c-=d):d/=2}if(f++,f>500)break}return c};i.t2length=s})(nu),Object.defineProperty(Di,"__esModule",{value:!0}),Di.Path=void 0;const n3=X,r3=St,s3=Y,Li=nu;class Ct extends r3.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Ct.parsePathData(this.data()),this.pathLength=Ct.getPathLength(this.dataArray)}_sceneFunc(t){var e=this.dataArray;t.beginPath();for(var n=!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],g=a[7],p=l>c?l:c,_=l>c?1:l/c,y=l>c?c/l:1;t.translate(o,h),t.rotate(u),t.scale(_,y),t.arc(0,0,p,d,d+f,1-g),t.scale(1/_,1/y),t.rotate(-u),t.translate(-o,-h);break;case"z":n=!0,t.closePath();break}}!n&&!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 g=c-u;g>f;g-=u){const p=Ct.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(p.x,p.y)}else for(let g=c+u;g<f;g+=u){const p=Ct.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(p.x,p.y)}}else if(l.command==="C")for(let g=0;g<=1;g+=.01){const p=Ct.getPointOnCubicBezier(g,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(p.x,p.y)}else t=t.concat(l.points)});for(var e=t[0],n=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),n=Math.max(n,a)),isNaN(o)||(r=Math.min(r,o),s=Math.max(s,o));return{x:e,y:r,width:n-e,height:s-r}}getLength(){return this.pathLength}getPointAtLength(t){return Ct.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}static getPathLength(t){let e=0;for(var n=0;n<t.length;++n)e+=t[n].pathLength;return e}static getPointAtLengthOfDataArray(t,e){var n,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 n=e[r-1].points.slice(-2),{x:n[0],y:n[1]};if(t<.01)return n=e[r].points.slice(0,2),{x:n[0],y:n[1]};var a=e[r],o=a.points;switch(a.command){case"L":return Ct.getPointOnLine(t,a.start.x,a.start.y,o[0],o[1]);case"C":return Ct.getPointOnCubicBezier((0,Li.t2length)(t,Ct.getPathLength(e),p=>(0,Li.getCubicArcLength)([a.start.x,o[0],o[2],o[4]],[a.start.y,o[1],o[3],o[5]],p)),a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return Ct.getPointOnQuadraticBezier((0,Li.t2length)(t,Ct.getPathLength(e),p=>(0,Li.getQuadraticArcLength)([a.start.x,o[0],o[2]],[a.start.y,o[1],o[3]],p)),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],g=o[6];return f+=u*t/a.pathLength,Ct.getPointOnEllipticalArc(h,l,c,d,f,g)}return null}static getPointOnLine(t,e,n,r,s,a,o){a===void 0&&(a=e),o===void 0&&(o=n);var h=(s-n)/(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-n)/(a-e+1e-8)===h)d={x:a+l,y:o+c};else{var f,u,g=this.getLineLength(e,n,r,s),p=(a-e)*(r-e)+(o-n)*(s-n);p=p/(g*g),f=e+p*(r-e),u=n+p*(s-n);var _=this.getLineLength(a,o,f,u),y=Math.sqrt(t*t-_*_);l=Math.sqrt(y*y/(1+h*h)),r<e&&(l*=-1),c=h*l,d={x:f+l,y:u+c}}return d}static getPointOnCubicBezier(t,e,n,r,s,a,o,h,l){function c(_){return _*_*_}function d(_){return 3*_*_*(1-_)}function f(_){return 3*_*(1-_)*(1-_)}function u(_){return(1-_)*(1-_)*(1-_)}var g=h*c(t)+a*d(t)+r*f(t)+e*u(t),p=l*c(t)+o*d(t)+s*f(t)+n*u(t);return{x:g,y:p}}static getPointOnQuadraticBezier(t,e,n,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)+n*c(t);return{x:d,y:f}}static getPointOnEllipticalArc(t,e,n,r,s,a){var o=Math.cos(a),h=Math.sin(a),l={x:n*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,n=["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<n.length;r++)e=e.replace(new RegExp(n[r],"g"),"|"+n[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 g=[],p=0,_=o.length;p<_;p++){if(o[p]==="00"){g.push(0,0);continue}var y=parseFloat(o[p]);isNaN(y)?g.push(0):g.push(y)}for(;g.length>0&&!isNaN(g[0]);){var b="",m=[],v=h,w=l,S,k,C,A,x,T,M,D,O,I;switch(u){case"l":h+=g.shift(),l+=g.shift(),b="L",m.push(h,l);break;case"L":h=g.shift(),l=g.shift(),m.push(h,l);break;case"m":var H=g.shift(),j=g.shift();if(h+=H,l+=j,b="M",a.length>2&&a[a.length-1].command==="z"){for(var $=a.length-2;$>=0;$--)if(a[$].command==="M"){h=a[$].points[0]+H,l=a[$].points[1]+j;break}}m.push(h,l),u="l";break;case"M":h=g.shift(),l=g.shift(),b="M",m.push(h,l),u="L";break;case"h":h+=g.shift(),b="L",m.push(h,l);break;case"H":h=g.shift(),b="L",m.push(h,l);break;case"v":l+=g.shift(),b="L",m.push(h,l);break;case"V":l=g.shift(),b="L",m.push(h,l);break;case"C":m.push(g.shift(),g.shift(),g.shift(),g.shift()),h=g.shift(),l=g.shift(),m.push(h,l);break;case"c":m.push(h+g.shift(),l+g.shift(),h+g.shift(),l+g.shift()),h+=g.shift(),l+=g.shift(),b="C",m.push(h,l);break;case"S":k=h,C=l,S=a[a.length-1],S.command==="C"&&(k=h+(h-S.points[2]),C=l+(l-S.points[3])),m.push(k,C,g.shift(),g.shift()),h=g.shift(),l=g.shift(),b="C",m.push(h,l);break;case"s":k=h,C=l,S=a[a.length-1],S.command==="C"&&(k=h+(h-S.points[2]),C=l+(l-S.points[3])),m.push(k,C,h+g.shift(),l+g.shift()),h+=g.shift(),l+=g.shift(),b="C",m.push(h,l);break;case"Q":m.push(g.shift(),g.shift()),h=g.shift(),l=g.shift(),m.push(h,l);break;case"q":m.push(h+g.shift(),l+g.shift()),h+=g.shift(),l+=g.shift(),b="Q",m.push(h,l);break;case"T":k=h,C=l,S=a[a.length-1],S.command==="Q"&&(k=h+(h-S.points[0]),C=l+(l-S.points[1])),h=g.shift(),l=g.shift(),b="Q",m.push(k,C,h,l);break;case"t":k=h,C=l,S=a[a.length-1],S.command==="Q"&&(k=h+(h-S.points[0]),C=l+(l-S.points[1])),h+=g.shift(),l+=g.shift(),b="Q",m.push(k,C,h,l);break;case"A":A=g.shift(),x=g.shift(),T=g.shift(),M=g.shift(),D=g.shift(),O=h,I=l,h=g.shift(),l=g.shift(),b="A",m=this.convertEndpointToCenterParameterization(O,I,h,l,M,D,A,x,T);break;case"a":A=g.shift(),x=g.shift(),T=g.shift(),M=g.shift(),D=g.shift(),O=h,I=l,h+=g.shift(),l+=g.shift(),b="A",m=this.convertEndpointToCenterParameterization(O,I,h,l,M,D,A,x,T);break}a.push({command:b||u,points:m,start:{x:v,y:w},pathLength:this.calcLength(v,w,b||u,m)})}(u==="z"||u==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,e,n,r){var s,a,o,h,l=Ct;switch(n){case"L":return l.getLineLength(t,e,r[0],r[1]);case"C":return(0,Li.getCubicArcLength)([t,r[0],r[2],r[4]],[e,r[1],r[3],r[5]],1);case"Q":return(0,Li.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,n,r,s,a,o,h,l){var c=l*(Math.PI/180),d=Math.cos(c)*(t-n)/2+Math.sin(c)*(e-r)/2,f=-1*Math.sin(c)*(t-n)/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 g=Math.sqrt((o*o*(h*h)-o*o*(f*f)-h*h*(d*d))/(o*o*(f*f)+h*h*(d*d)));s===a&&(g*=-1),isNaN(g)&&(g=0);var p=g*o*f/h,_=g*-h*d/o,y=(t+n)/2+Math.cos(c)*p-Math.sin(c)*_,b=(e+r)/2+Math.sin(c)*p+Math.cos(c)*_,m=function(x){return Math.sqrt(x[0]*x[0]+x[1]*x[1])},v=function(x,T){return(x[0]*T[0]+x[1]*T[1])/(m(x)*m(T))},w=function(x,T){return(x[0]*T[1]<x[1]*T[0]?-1:1)*Math.acos(v(x,T))},S=w([1,0],[(d-p)/o,(f-_)/h]),k=[(d-p)/o,(f-_)/h],C=[(-1*d-p)/o,(-1*f-_)/h],A=w(k,C);return v(k,C)<=-1&&(A=Math.PI),v(k,C)>=1&&(A=0),a===0&&A>0&&(A=A-2*Math.PI),a===1&&A<0&&(A=A+2*Math.PI),[y,b,o,h,S,A,c,a]}}Di.Path=Ct,Ct.prototype.className="Path",Ct.prototype._attrsAffectingSize=["data"],(0,s3._registerNode)(Ct),n3.Factory.addGetterSetter(Ct,"data"),Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.Arrow=void 0;const Ur=X,a3=Pn,ru=N,o3=Y,su=Di;class ri extends a3.Line{_sceneFunc(t){super._sceneFunc(t);var e=Math.PI*2,n=this.points(),r=n,s=this.tension()!==0&&n.length>4;s&&(r=this.getTensionPoints());var a=this.pointerLength(),o=n.length,h,l;if(s){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[o-2],n[o-1]],u=su.Path.calcLength(r[r.length-4],r[r.length-3],"C",f),g=su.Path.getPointOnQuadraticBezier(Math.min(1,1-a/u),f[0],f[1],f[2],f[3],f[4],f[5]);h=n[o-2]-g.x,l=n[o-1]-g.y}else h=n[o-2]-n[o-4],l=n[o-1]-n[o-3];var c=(Math.atan2(l,h)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(n[o-2],n[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(n[0],n[1]),s?(h=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(h=n[2]-n[0],l=n[3]-n[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}}}Fr.Arrow=ri,ri.prototype.className="Arrow",(0,o3._registerNode)(ri),Ur.Factory.addGetterSetter(ri,"pointerLength",10,(0,ru.getNumberValidator)()),Ur.Factory.addGetterSetter(ri,"pointerWidth",10,(0,ru.getNumberValidator)()),Ur.Factory.addGetterSetter(ri,"pointerAtBeginning",!1),Ur.Factory.addGetterSetter(ri,"pointerAtEnding",!0);var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.Circle=void 0;const l3=X,h3=St,c3=N,u3=Y;class Oi extends h3.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)}}Gr.Circle=Oi,Oi.prototype._centroid=!0,Oi.prototype.className="Circle",Oi.prototype._attrsAffectingSize=["radius"],(0,u3._registerNode)(Oi),l3.Factory.addGetterSetter(Oi,"radius",0,(0,c3.getNumberValidator)());var Br={};Object.defineProperty(Br,"__esModule",{value:!0}),Br.Ellipse=void 0;const Qa=X,d3=St,au=N,f3=Y;class Fe extends d3.Shape{_sceneFunc(t){var e=this.radiusX(),n=this.radiusY();t.beginPath(),t.save(),e!==n&&t.scale(1,n/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)}}Br.Ellipse=Fe,Fe.prototype.className="Ellipse",Fe.prototype._centroid=!0,Fe.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,f3._registerNode)(Fe),Qa.Factory.addComponentsGetterSetter(Fe,"radius",["x","y"]),Qa.Factory.addGetterSetter(Fe,"radiusX",0,(0,au.getNumberValidator)()),Qa.Factory.addGetterSetter(Fe,"radiusY",0,(0,au.getNumberValidator)());var zr={};Object.defineProperty(zr,"__esModule",{value:!0}),zr.Image=void 0;const to=gt,si=X,g3=St,p3=Y,Mn=N;let ee=class rd extends g3.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(),n=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,n]:a=[s,0,0,e,n]}(this.hasFill()||this.hasStroke()||r)&&(t.beginPath(),r?to.Util.drawRoundedRectPath(t,e,n,r):t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)),s&&(r&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var e=this.width(),n=this.height(),r=this.cornerRadius();t.beginPath(),r?to.Util.drawRoundedRectPath(t,e,n,r):t.rect(0,0,e,n),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,n=null){var r=to.Util.createImageElement();r.onload=function(){var s=new rd({image:r});e(s)},r.onerror=n,r.crossOrigin="Anonymous",r.src=t}};zr.Image=ee,ee.prototype.className="Image",(0,p3._registerNode)(ee),si.Factory.addGetterSetter(ee,"cornerRadius",0,(0,Mn.getNumberOrArrayOfNumbersValidator)(4)),si.Factory.addGetterSetter(ee,"image"),si.Factory.addComponentsGetterSetter(ee,"crop",["x","y","width","height"]),si.Factory.addGetterSetter(ee,"cropX",0,(0,Mn.getNumberValidator)()),si.Factory.addGetterSetter(ee,"cropY",0,(0,Mn.getNumberValidator)()),si.Factory.addGetterSetter(ee,"cropWidth",0,(0,Mn.getNumberValidator)()),si.Factory.addGetterSetter(ee,"cropHeight",0,(0,Mn.getNumberValidator)());var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.Tag=Ii.Label=void 0;const Hr=X,m3=St,_3=Mi,eo=N,ou=Y;var lu=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],v3="Change.konva",y3="none",io="up",no="right",ro="down",so="left",b3=lu.length;class ao extends _3.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,n,r=function(){e._sync()};for(n=0;n<b3;n++)t.on(lu[n]+v3,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var t=this.getText(),e=this.getTag(),n,r,s,a,o,h,l;if(t&&e){switch(n=t.width(),r=t.height(),s=e.pointerDirection(),a=e.pointerWidth(),l=e.pointerHeight(),o=0,h=0,s){case io:o=n/2,h=-1*l;break;case no:o=n+a,h=r/2;break;case ro:o=n/2,h=r+l;break;case so:o=-1*a,h=r/2;break}e.setAttrs({x:-1*o,y:-1*h,width:n,height:r}),t.setAttrs({x:-1*o,y:-1*h})}}}Ii.Label=ao,ao.prototype.className="Label",(0,ou._registerNode)(ao);class ai extends m3.Shape{_sceneFunc(t){var e=this.width(),n=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,n/2):(h=Math.min(o[0]||0,e/2,n/2),l=Math.min(o[1]||0,e/2,n/2),d=Math.min(o[2]||0,e/2,n/2),c=Math.min(o[3]||0,e/2,n/2)),t.beginPath(),t.moveTo(h,0),r===io&&(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===no&&(t.lineTo(e,(n-a)/2),t.lineTo(e+s,n/2),t.lineTo(e,(n+a)/2)),t.lineTo(e,n-d),t.arc(e-d,n-d,d,0,Math.PI/2,!1),r===ro&&(t.lineTo((e+s)/2,n),t.lineTo(e/2,n+a),t.lineTo((e-s)/2,n)),t.lineTo(c,n),t.arc(c,n-c,c,Math.PI/2,Math.PI,!1),r===so&&(t.lineTo(0,(n+a)/2),t.lineTo(-1*s,n/2),t.lineTo(0,(n-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,n=this.pointerWidth(),r=this.pointerHeight(),s=this.pointerDirection(),a=this.width(),o=this.height();return s===io?(e-=r,o+=r):s===ro?o+=r:s===so?(t-=n*1.5,a+=n):s===no&&(a+=n*1.5),{x:t,y:e,width:a,height:o}}}Ii.Tag=ai,ai.prototype.className="Tag",(0,ou._registerNode)(ai),Hr.Factory.addGetterSetter(ai,"pointerDirection",y3),Hr.Factory.addGetterSetter(ai,"pointerWidth",0,(0,eo.getNumberValidator)()),Hr.Factory.addGetterSetter(ai,"pointerHeight",0,(0,eo.getNumberValidator)()),Hr.Factory.addGetterSetter(ai,"cornerRadius",0,(0,eo.getNumberOrArrayOfNumbersValidator)(4));var Rn={};Object.defineProperty(Rn,"__esModule",{value:!0}),Rn.Rect=void 0;const w3=X,S3=St,C3=Y,x3=gt,T3=N;class jr extends S3.Shape{_sceneFunc(t){var e=this.cornerRadius(),n=this.width(),r=this.height();t.beginPath(),e?x3.Util.drawRoundedRectPath(t,n,r,e):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}}Rn.Rect=jr,jr.prototype.className="Rect",(0,C3._registerNode)(jr),w3.Factory.addGetterSetter(jr,"cornerRadius",0,(0,T3.getNumberOrArrayOfNumbersValidator)(4));var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.RegularPolygon=void 0;const hu=X,E3=St,cu=N,k3=Y;class oi extends E3.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(var n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,n=[];for(var r=0;r<t;r++)n.push({x:e*Math.sin(r*2*Math.PI/t),y:-1*e*Math.cos(r*2*Math.PI/t)});return n}getSelfRect(){const t=this._getPoints();var e=t[0].x,n=t[0].y,r=t[0].x,s=t[0].y;return t.forEach(a=>{e=Math.min(e,a.x),n=Math.max(n,a.x),r=Math.min(r,a.y),s=Math.max(s,a.y)}),{x:e,y:r,width:n-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)}}Vr.RegularPolygon=oi,oi.prototype.className="RegularPolygon",oi.prototype._centroid=!0,oi.prototype._attrsAffectingSize=["radius"],(0,k3._registerNode)(oi),hu.Factory.addGetterSetter(oi,"radius",0,(0,cu.getNumberValidator)()),hu.Factory.addGetterSetter(oi,"sides",0,(0,cu.getNumberValidator)());var $r={};Object.defineProperty($r,"__esModule",{value:!0}),$r.Ring=void 0;const uu=X,A3=St,du=N,P3=Y;var fu=Math.PI*2;class li extends A3.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,fu,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),fu,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)}}$r.Ring=li,li.prototype.className="Ring",li.prototype._centroid=!0,li.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,P3._registerNode)(li),uu.Factory.addGetterSetter(li,"innerRadius",0,(0,du.getNumberValidator)()),uu.Factory.addGetterSetter(li,"outerRadius",0,(0,du.getNumberValidator)());var Xr={};Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.Sprite=void 0;const hi=X,M3=St,R3=Ri,gu=N,D3=Y;class ie extends M3.Shape{constructor(t){super(t),this._updated=!0,this.anim=new R3.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(),n=this.frameIndex(),r=n*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=n*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(),n=this.frameIndex(),r=n*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=n*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(),n=this.animations(),r=n[e],s=r.length/4;t<s-1?this.frameIndex(t+1):this.frameIndex(0)}}Xr.Sprite=ie,ie.prototype.className="Sprite",(0,D3._registerNode)(ie),hi.Factory.addGetterSetter(ie,"animation"),hi.Factory.addGetterSetter(ie,"animations"),hi.Factory.addGetterSetter(ie,"frameOffsets"),hi.Factory.addGetterSetter(ie,"image"),hi.Factory.addGetterSetter(ie,"frameIndex",0,(0,gu.getNumberValidator)()),hi.Factory.addGetterSetter(ie,"frameRate",17,(0,gu.getNumberValidator)()),hi.Factory.backCompat(ie,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.Star=void 0;const oo=X,L3=St,lo=N,O3=Y;class Ne extends L3.Shape{_sceneFunc(t){var e=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-n);for(var s=1;s<r*2;s++){var a=s%2===0?n: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)}}Yr.Star=Ne,Ne.prototype.className="Star",Ne.prototype._centroid=!0,Ne.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,O3._registerNode)(Ne),oo.Factory.addGetterSetter(Ne,"numPoints",5,(0,lo.getNumberValidator)()),oo.Factory.addGetterSetter(Ne,"innerRadius",0,(0,lo.getNumberValidator)()),oo.Factory.addGetterSetter(Ne,"outerRadius",0,(0,lo.getNumberValidator)());var ci={};Object.defineProperty(ci,"__esModule",{value:!0}),ci.Text=ci.stringToArray=void 0;const ho=gt,Pt=X,I3=St,Ue=N,F3=Y;function pu(i){return Array.from(i)}ci.stringToArray=pu;var Fi="auto",N3="center",mu="inherit",Dn="justify",U3="Change.konva",G3="2d",_u="-",vu="left",B3="text",z3="Text",H3="top",j3="bottom",yu="middle",bu="normal",V3="px ",Wr=" ",$3="right",wu="rtl",X3="word",Y3="char",Su="none",co="…",Cu=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],W3=Cu.length;function q3(i){return i.split(",").map(t=>{t=t.trim();const e=t.indexOf(" ")>=0,n=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!n&&(t=`"${t}"`),t}).join(", ")}var qr;function uo(){return qr||(qr=ho.Util.createCanvasElement().getContext(G3),qr)}function K3(i){i.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Z3(i){i.setAttr("miterLimit",2),i.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function J3(i){return i=i||{},!i.fillLinearGradientColorStops&&!i.fillRadialGradientColorStops&&!i.fillPatternImage&&(i.fill=i.fill||"black"),i}class _t extends I3.Shape{constructor(t){super(J3(t)),this._partialTextX=0,this._partialTextY=0;for(var e=0;e<W3;e++)this.on(Cu[e]+U3,this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,n=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(),g=this.textDecoration(),p=g.indexOf("underline")!==-1,_=g.indexOf("line-through")!==-1,y;h=h===mu?t.direction:h;var b=0,b=a/2,m=0,v=0;for(h===wu&&t.setAttr("direction",h),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",yu),t.setAttr("textAlign",vu),o===yu?l=(this.getHeight()-n*a-r*2)/2:o===j3&&(l=this.getHeight()-n*a-r*2),t.translate(r,l+r),y=0;y<n;y++){var m=0,v=0,w=e[y],S=w.text,k=w.width,C=w.lastInParagraph,A,x,T;if(t.save(),c===$3?m+=d-k-r*2:c===N3&&(m+=(d-k-r*2)/2),p){t.save(),t.beginPath(),t.moveTo(m,b+v+Math.round(s/2)),A=S.split(" ").length-1,x=A===0,T=c===Dn&&!C?d-r*2:k,t.lineTo(m+Math.round(T),b+v+Math.round(s/2)),t.lineWidth=s/15;const j=this._getLinearGradient();t.strokeStyle=j||u,t.stroke(),t.restore()}if(_){t.save(),t.beginPath(),t.moveTo(m,b+v),A=S.split(" ").length-1,x=A===0,T=c===Dn&&C&&!x?d-r*2:k,t.lineTo(m+Math.round(T),b+v),t.lineWidth=s/15;const j=this._getLinearGradient();t.strokeStyle=j||u,t.stroke(),t.restore()}if(h!==wu&&(f!==0||c===Dn)){A=S.split(" ").length-1;for(var M=pu(S),D=0;D<M.length;D++){var O=M[D];O===" "&&!C&&c===Dn&&(m+=(d-r*2-k)/A),this._partialTextX=m,this._partialTextY=b+v,this._partialText=O,t.fillStrokeShape(this),m+=this.measureSize(O).width+f}}else f!==0&&t.setAttr("letterSpacing",`${f}px`),this._partialTextX=m,this._partialTextY=b+v,this._partialText=S,t.fillStrokeShape(this);t.restore(),n>1&&(b+=a)}}}_hitFunc(t){var e=this.getWidth(),n=this.getHeight();t.beginPath(),t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=ho.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(B3,e),this}getWidth(){var t=this.attrs.width===Fi||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Fi||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 ho.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=uo(),n=this.fontSize(),r;return e.save(),e.font=this._getContextFont(),r=e.measureText(t),e.restore(),{width:r.width,height:n}}_getContextFont(){return this.fontStyle()+Wr+this.fontVariant()+Wr+(this.fontSize()+V3)+q3(this.fontFamily())}_addTextLine(t){this.align()===Dn&&(t=t.trim());var n=this._getTextWidth(t);return this.textArr.push({text:t,width:n,lastInParagraph:!1})}_getTextWidth(t){var e=this.letterSpacing(),n=t.length;return uo().measureText(t).width+(n?e*(n-1):0)}_setTextData(){var t=this.text().split(`
|
|
29
|
-
`),e=+this.fontSize(),n=0,r=this.lineHeight()*e,s=this.attrs.width,a=this.attrs.height,o=s!==Fi&&s!==void 0,h=a!==Fi&&a!==void 0,l=this.padding(),c=s-l*2,d=a-l*2,f=0,u=this.wrap(),g=u!==Su,p=u!==Y3&&g,_=this.ellipsis();this.textArr=[],uo().font=this._getContextFont();for(var y=_?this._getTextWidth(co):0,b=0,m=t.length;b<m;++b){var v=t[b],w=this._getTextWidth(v);if(o&&w>c)for(;v.length>0;){for(var S=0,k=v.length,C="",A=0;S<k;){var x=S+k>>>1,T=v.slice(0,x+1),M=this._getTextWidth(T)+y;M<=c?(S=x+1,C=T,A=M):k=x}if(C){if(p){var D,O=v[C.length],I=O===Wr||O===_u;I&&A<=c?D=C.length:D=Math.max(C.lastIndexOf(Wr),C.lastIndexOf(_u))+1,D>0&&(S=D,C=C.slice(0,S),A=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),n=Math.max(n,A),f+=r;var H=this._shouldHandleEllipsis(f);if(H){this._tryToAddEllipsisToLastLine();break}if(v=v.slice(S),v=v.trimLeft(),v.length>0&&(w=this._getTextWidth(v),w<=c)){this._addTextLine(v),f+=r,n=Math.max(n,w);break}}else break}else this._addTextLine(v),f+=r,n=Math.max(n,w),this._shouldHandleEllipsis(f)&&b<m-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=n}_shouldHandleEllipsis(t){var e=+this.fontSize(),n=this.lineHeight()*e,r=this.attrs.height,s=r!==Fi&&r!==void 0,a=this.padding(),o=r-a*2,h=this.wrap(),l=h!==Su;return!l||s&&t+n>o}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,e=t!==Fi&&t!==void 0,n=this.padding(),r=t-n*2,s=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!s)){if(e){var o=this._getTextWidth(a.text+co)<r;o||(a.text=a.text.slice(0,a.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+co)}}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()}}ci.Text=_t,_t.prototype._fillFunc=K3,_t.prototype._strokeFunc=Z3,_t.prototype.className=z3,_t.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,F3._registerNode)(_t),Pt.Factory.overWriteSetter(_t,"width",(0,Ue.getNumberOrAutoValidator)()),Pt.Factory.overWriteSetter(_t,"height",(0,Ue.getNumberOrAutoValidator)()),Pt.Factory.addGetterSetter(_t,"direction",mu),Pt.Factory.addGetterSetter(_t,"fontFamily","Arial"),Pt.Factory.addGetterSetter(_t,"fontSize",12,(0,Ue.getNumberValidator)()),Pt.Factory.addGetterSetter(_t,"fontStyle",bu),Pt.Factory.addGetterSetter(_t,"fontVariant",bu),Pt.Factory.addGetterSetter(_t,"padding",0,(0,Ue.getNumberValidator)()),Pt.Factory.addGetterSetter(_t,"align",vu),Pt.Factory.addGetterSetter(_t,"verticalAlign",H3),Pt.Factory.addGetterSetter(_t,"lineHeight",1,(0,Ue.getNumberValidator)()),Pt.Factory.addGetterSetter(_t,"wrap",X3),Pt.Factory.addGetterSetter(_t,"ellipsis",!1,(0,Ue.getBooleanValidator)()),Pt.Factory.addGetterSetter(_t,"letterSpacing",0,(0,Ue.getNumberValidator)()),Pt.Factory.addGetterSetter(_t,"text","",(0,Ue.getStringValidator)()),Pt.Factory.addGetterSetter(_t,"textDecoration","");var Kr={};Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.TextPath=void 0;const fo=gt,Xt=X,Q3=St,Ln=Di,go=ci,xu=N,t4=Y;var e4="",Tu="normal";function Eu(i){i.fillText(this.partialText,0,0)}function ku(i){i.strokeText(this.partialText,0,0)}class xt extends Q3.Shape{constructor(t){super(t),this.dummyCanvas=fo.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 Ln.Path.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;const e=this.pathLength;return t-1>e?null:Ln.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=Ln.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(),n=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=n,t.lineWidth=r/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var n=e[0].p0;t.moveTo(n.x,n.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 fo.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 go.Text.prototype.setText.call(this,t)}_getContextFont(){return go.Text.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas,n=e.getContext("2d");n.save(),n.font=this._getContextFont();var r=n.measureText(t);return n.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 n=this.letterSpacing(),r=this.align(),s=this.kerningFunc(),a=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,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,go.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+n;if(h[c]===" "&&r==="justify"){const b=this.text().split(" ").length-1;f+=(this.pathLength-a)/b}const u=this._getPointAtLength(l+f);if(!u)return;const g=Ln.Path.getLineLength(d.x,d.y,u.x,u.y);let p=0;if(s)try{p=s(h[c-1],h[c])*this.fontSize()}catch{p=0}d.x+=p,u.x+=p,this.textWidth+=p;const _=Ln.Path.getPointOnLine(p+g/2,d.x,d.y,u.x,u.y),y=Math.atan2(u.y-d.y,u.x-d.x);this.glyphInfo.push({transposeX:_.x,transposeY:_.y,text:h[c],rotation:y,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,n=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),n=Math.max(n,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:n-e+l,height:s-r+l}}destroy(){return fo.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}Kr.TextPath=xt,xt.prototype._fillFunc=Eu,xt.prototype._strokeFunc=ku,xt.prototype._fillFuncHit=Eu,xt.prototype._strokeFuncHit=ku,xt.prototype.className="TextPath",xt.prototype._attrsAffectingSize=["text","fontSize","data"],(0,t4._registerNode)(xt),Xt.Factory.addGetterSetter(xt,"data"),Xt.Factory.addGetterSetter(xt,"fontFamily","Arial"),Xt.Factory.addGetterSetter(xt,"fontSize",12,(0,xu.getNumberValidator)()),Xt.Factory.addGetterSetter(xt,"fontStyle",Tu),Xt.Factory.addGetterSetter(xt,"align","left"),Xt.Factory.addGetterSetter(xt,"letterSpacing",0,(0,xu.getNumberValidator)()),Xt.Factory.addGetterSetter(xt,"textBaseline","middle"),Xt.Factory.addGetterSetter(xt,"fontVariant",Tu),Xt.Factory.addGetterSetter(xt,"text",e4),Xt.Factory.addGetterSetter(xt,"textDecoration",null),Xt.Factory.addGetterSetter(xt,"kerningFunc",null);var Zr={};Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.Transformer=void 0;const rt=gt,it=X,Au=dt,i4=St,n4=Rn,Pu=Mi,Yt=Y,Ge=N,r4=Y;var Mu="tr-konva",s4=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(i=>i+`.${Mu}`).join(" "),Ru="nodesRect",a4=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],o4={"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 l4="ontouchstart"in Yt.Konva._global;function h4(i,t,e){if(i==="rotater")return e;t+=rt.Util.degToRad(o4[i]||0);var n=(rt.Util.radToDeg(t)%360+360)%360;return rt.Util._inRange(n,315+22.5,360)||rt.Util._inRange(n,0,22.5)?"ns-resize":rt.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":rt.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":rt.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":rt.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":rt.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":rt.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":rt.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(rt.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var Jr=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],Du=1e8;function c4(i){return{x:i.x+i.width/2*Math.cos(i.rotation)+i.height/2*Math.sin(-i.rotation),y:i.y+i.height/2*Math.cos(i.rotation)+i.width/2*Math.sin(i.rotation)}}function Lu(i,t,e){const n=e.x+(i.x-e.x)*Math.cos(t)-(i.y-e.y)*Math.sin(t),r=e.y+(i.x-e.x)*Math.sin(t)+(i.y-e.y)*Math.cos(t);return{...i,rotation:i.rotation+t,x:n,y:r}}function u4(i,t){const e=c4(i);return Lu(i,t,e)}function d4(i,t,e){let n=t;for(let r=0;r<i.length;r++){const s=Yt.Konva.getAngle(i[r]),a=Math.abs(s-t)%(Math.PI*2);Math.min(a,Math.PI*2-a)<e&&(n=s)}return n}class Q extends Pu.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(s4,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return rt.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 Mu+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter(r=>r.isAncestorOf(this)?(rt.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(a4.map(o=>o+`.${this._getEventNamespace()}`).join(" "),s),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,s),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,n=>{e=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(n,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,n=>{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(n)}),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(Ru),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Ru,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),n){var r=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=t.getAbsoluteScale(n),a=t.getAbsolutePosition(n),o=r.x*s.x-t.offsetX()*s.x,h=r.y*s.y-t.offsetY()*s.y;const l=(Yt.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 Lu(c,-Yt.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-Du,y:-Du,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 g=f.point(u);e.push(g)})});const n=new rt.Transform;n.rotate(-Yt.Konva.getAngle(this.rotation()));var r=1/0,s=1/0,a=-1/0,o=-1/0;e.forEach(function(l){var c=n.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)}),n.invert();const h=n.point({x:r,y:s});return{x:h.x,y:h.y,width:a-r,height:o-s,rotation:Yt.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(),Jr.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){var e=new n4.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:l4?10:"auto"}),n=this;e.on("mousedown touchstart",function(r){n._handleMouseDown(r)}),e.on("dragstart",r=>{e.stopDrag(),r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),e.on("mouseenter",()=>{var r=Yt.Konva.getAngle(this.rotation()),s=this.rotateAnchorCursor(),a=h4(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 i4.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,n){var r=n.getParent(),s=r.padding();e.beginPath(),e.rect(-s,-s,n.width()+s*2,n.height()+s*2),e.moveTo(n.width()/2,-s),r.rotateEnabled()&&e.lineTo(n.width()/2,-r.rotateAnchorOffset()*rt.Util._sign(n.height())-s),e.fillStrokeShape(n)},hitFunc:(e,n)=>{if(this.shouldOverdrawWholeArea()){var r=this.padding();e.beginPath(),e.rect(-r,-r,n.width()+r*2,n.height()+r*2),e.fillStrokeShape(n)}}});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(),n=e.width,r=e.height,s=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/s),this.cos=Math.abs(n/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,n,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,n=-s.y()+d.height/2;let D=Math.atan2(-n,e)+Math.PI/2;d.height<0&&(D-=Math.PI);var f=Yt.Konva.getAngle(this.rotation());const O=f+D,I=Yt.Konva.getAngle(this.rotationSnapTolerance()),j=d4(this.rotationSnaps(),O,I)-d.rotation,$=u4(d,j);this._fitNodesInto($,t);return}var u=this.shiftBehavior(),g;u==="inverted"?g=this.keepRatio()&&!t.shiftKey:u==="none"?g=this.keepRatio():g=this.keepRatio()||t.shiftKey;var m=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(g){var p=m?{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(p.x-s.x(),2)+Math.pow(p.y-s.y(),2));var _=this.findOne(".top-left").x()>p.x?-1:1,y=this.findOne(".top-left").y()>p.y?-1:1;e=r*this.cos*_,n=r*this.sin*y,this.findOne(".top-left").x(p.x-e),this.findOne(".top-left").y(p.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(g){var p=m?{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()-p.x,2)+Math.pow(p.y-s.y(),2));var _=this.findOne(".top-right").x()<p.x?-1:1,y=this.findOne(".top-right").y()>p.y?-1:1;e=r*this.cos*_,n=r*this.sin*y,this.findOne(".top-right").x(p.x+e),this.findOne(".top-right").y(p.y-n)}var b=s.position();this.findOne(".top-left").y(b.y),this.findOne(".bottom-right").x(b.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(g){var p=m?{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(p.x-s.x(),2)+Math.pow(s.y()-p.y,2));var _=p.x<s.x()?-1:1,y=s.y()<p.y?-1:1;e=r*this.cos*_,n=r*this.sin*y,s.x(p.x-e),s.y(p.y+n)}b=s.position(),this.findOne(".top-left").x(b.x),this.findOne(".bottom-right").y(b.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(s.y());else if(this._movingAnchorName==="bottom-right"){if(g){var p=m?{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()-p.x,2)+Math.pow(s.y()-p.y,2));var _=this.findOne(".bottom-right").x()<p.x?-1:1,y=this.findOne(".bottom-right").y()<p.y?-1:1;e=r*this.cos*_,n=r*this.sin*y,this.findOne(".bottom-right").x(p.x+e),this.findOne(".bottom-right").y(p.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var m=this.centeredScaling()||t.altKey;if(m){var v=this.findOne(".top-left"),w=this.findOne(".bottom-right"),S=v.x(),k=v.y(),C=this.getWidth()-w.x(),A=this.getHeight()-w.y();w.move({x:-S,y:-k}),v.move({x:C,y:A})}var x=this.findOne(".top-left").getAbsolutePosition();e=x.x,n=x.y;var T=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),M=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:n,width:T,height:M,rotation:Yt.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(n=>{n._fire("transformend",{evt:t,target:n})}),this._movingAnchorName=null}}_fitNodesInto(t,e){var n=this._getNodeRect();const r=1;if(rt.Util._inRange(t.width,-this.padding()*2-r,r)){this.update();return}if(rt.Util._inRange(t.height,-this.padding()*2-r,r)){this.update();return}const s=this.flipEnabled();var a=new rt.Transform;if(a.rotate(Yt.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()(n,t);d?t=d:rt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,h=new rt.Transform;h.translate(n.x,n.y),h.rotate(n.rotation),h.scale(n.width/o,n.height/o);const l=new rt.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(),g=d.getTransform().copy();g.translate(d.offsetX(),d.offsetY());const p=new rt.Transform;p.multiply(u.copy().invert()).multiply(c).multiply(u).multiply(g);const _=p.decompose();d.setAttrs(_),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(rt.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(rt.Util._getRotation(e.rotation));var n=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:n/2,y:0,offsetY:h/2+o,visible:a&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,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:n,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:n/2,y:r,offsetY:h/2-o,visible:a&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:h/2-o,offsetY:h/2-o,visible:a&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*rt.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,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=""),Pu.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Au.Node.prototype.toObject.call(this)}clone(t){var e=Au.Node.prototype.clone.call(this,t);return e}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}Zr.Transformer=Q;function f4(i){return i instanceof Array||rt.Util.warn("enabledAnchors value should be an array"),i instanceof Array&&i.forEach(function(t){Jr.indexOf(t)===-1&&rt.Util.warn("Unknown anchor name: "+t+". Available names are: "+Jr.join(", "))}),i||[]}Q.prototype.className="Transformer",(0,r4._registerNode)(Q),it.Factory.addGetterSetter(Q,"enabledAnchors",Jr,f4),it.Factory.addGetterSetter(Q,"flipEnabled",!0,(0,Ge.getBooleanValidator)()),it.Factory.addGetterSetter(Q,"resizeEnabled",!0),it.Factory.addGetterSetter(Q,"anchorSize",10,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"rotateEnabled",!0),it.Factory.addGetterSetter(Q,"rotationSnaps",[]),it.Factory.addGetterSetter(Q,"rotateAnchorOffset",50,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"rotateAnchorCursor","crosshair"),it.Factory.addGetterSetter(Q,"rotationSnapTolerance",5,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"borderEnabled",!0),it.Factory.addGetterSetter(Q,"anchorStroke","rgb(0, 161, 255)"),it.Factory.addGetterSetter(Q,"anchorStrokeWidth",1,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"anchorFill","white"),it.Factory.addGetterSetter(Q,"anchorCornerRadius",0,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"borderStroke","rgb(0, 161, 255)"),it.Factory.addGetterSetter(Q,"borderStrokeWidth",1,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"borderDash"),it.Factory.addGetterSetter(Q,"keepRatio",!0),it.Factory.addGetterSetter(Q,"shiftBehavior","default"),it.Factory.addGetterSetter(Q,"centeredScaling",!1),it.Factory.addGetterSetter(Q,"ignoreStroke",!1),it.Factory.addGetterSetter(Q,"padding",0,(0,Ge.getNumberValidator)()),it.Factory.addGetterSetter(Q,"node"),it.Factory.addGetterSetter(Q,"nodes"),it.Factory.addGetterSetter(Q,"boundBoxFunc"),it.Factory.addGetterSetter(Q,"anchorDragBoundFunc"),it.Factory.addGetterSetter(Q,"anchorStyleFunc"),it.Factory.addGetterSetter(Q,"shouldOverdrawWholeArea",!1),it.Factory.addGetterSetter(Q,"useSingleNodeRotation",!0),it.Factory.backCompat(Q,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.Wedge=void 0;const ts=X,g4=St,p4=Y,Ou=N,m4=Y;class ye extends g4.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,p4.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)}}Qr.Wedge=ye,ye.prototype.className="Wedge",ye.prototype._centroid=!0,ye.prototype._attrsAffectingSize=["radius"],(0,m4._registerNode)(ye),ts.Factory.addGetterSetter(ye,"radius",0,(0,Ou.getNumberValidator)()),ts.Factory.addGetterSetter(ye,"angle",0,(0,Ou.getNumberValidator)()),ts.Factory.addGetterSetter(ye,"clockwise",!1),ts.Factory.backCompat(ye,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var es={};Object.defineProperty(es,"__esModule",{value:!0}),es.Blur=void 0;const Iu=X,_4=dt,v4=N;function Fu(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var y4=[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],b4=[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 w4(i,t){var e=i.data,n=i.width,r=i.height,s,a,o,h,l,c,d,f,u,g,p,_,y,b,m,v,w,S,k,C,A,x,T,M,D=t+t+1,O=n-1,I=r-1,H=t+1,j=H*(H+1)/2,$=new Fu,et=null,G=$,z=null,W=null,J=y4[t],lt=b4[t];for(o=1;o<D;o++)G=G.next=new Fu,o===H&&(et=G);for(G.next=$,d=c=0,a=0;a<r;a++){for(v=w=S=k=f=u=g=p=0,_=H*(C=e[c]),y=H*(A=e[c+1]),b=H*(x=e[c+2]),m=H*(T=e[c+3]),f+=j*C,u+=j*A,g+=j*x,p+=j*T,G=$,o=0;o<H;o++)G.r=C,G.g=A,G.b=x,G.a=T,G=G.next;for(o=1;o<H;o++)h=c+((O<o?O:o)<<2),f+=(G.r=C=e[h])*(M=H-o),u+=(G.g=A=e[h+1])*M,g+=(G.b=x=e[h+2])*M,p+=(G.a=T=e[h+3])*M,v+=C,w+=A,S+=x,k+=T,G=G.next;for(z=$,W=et,s=0;s<n;s++)e[c+3]=T=p*J>>lt,T!==0?(T=255/T,e[c]=(f*J>>lt)*T,e[c+1]=(u*J>>lt)*T,e[c+2]=(g*J>>lt)*T):e[c]=e[c+1]=e[c+2]=0,f-=_,u-=y,g-=b,p-=m,_-=z.r,y-=z.g,b-=z.b,m-=z.a,h=d+((h=s+t+1)<O?h:O)<<2,v+=z.r=e[h],w+=z.g=e[h+1],S+=z.b=e[h+2],k+=z.a=e[h+3],f+=v,u+=w,g+=S,p+=k,z=z.next,_+=C=W.r,y+=A=W.g,b+=x=W.b,m+=T=W.a,v-=C,w-=A,S-=x,k-=T,W=W.next,c+=4;d+=n}for(s=0;s<n;s++){for(w=S=k=v=u=g=p=f=0,c=s<<2,_=H*(C=e[c]),y=H*(A=e[c+1]),b=H*(x=e[c+2]),m=H*(T=e[c+3]),f+=j*C,u+=j*A,g+=j*x,p+=j*T,G=$,o=0;o<H;o++)G.r=C,G.g=A,G.b=x,G.a=T,G=G.next;for(l=n,o=1;o<=t;o++)c=l+s<<2,f+=(G.r=C=e[c])*(M=H-o),u+=(G.g=A=e[c+1])*M,g+=(G.b=x=e[c+2])*M,p+=(G.a=T=e[c+3])*M,v+=C,w+=A,S+=x,k+=T,G=G.next,o<I&&(l+=n);for(c=s,z=$,W=et,a=0;a<r;a++)h=c<<2,e[h+3]=T=p*J>>lt,T>0?(T=255/T,e[h]=(f*J>>lt)*T,e[h+1]=(u*J>>lt)*T,e[h+2]=(g*J>>lt)*T):e[h]=e[h+1]=e[h+2]=0,f-=_,u-=y,g-=b,p-=m,_-=z.r,y-=z.g,b-=z.b,m-=z.a,h=s+((h=a+H)<I?h:I)*n<<2,f+=v+=z.r=e[h],u+=w+=z.g=e[h+1],g+=S+=z.b=e[h+2],p+=k+=z.a=e[h+3],z=z.next,_+=C=W.r,y+=A=W.g,b+=x=W.b,m+=T=W.a,v-=C,w-=A,S-=x,k-=T,W=W.next,c+=n}}const S4=function(t){var e=Math.round(this.blurRadius());e>0&&w4(t,e)};es.Blur=S4,Iu.Factory.addGetterSetter(_4.Node,"blurRadius",0,(0,v4.getNumberValidator)(),Iu.Factory.afterSetFilter);var is={};Object.defineProperty(is,"__esModule",{value:!0}),is.Brighten=void 0;const Nu=X,C4=dt,x4=N,T4=function(i){var t=this.brightness()*255,e=i.data,n=e.length,r;for(r=0;r<n;r+=4)e[r]+=t,e[r+1]+=t,e[r+2]+=t};is.Brighten=T4,Nu.Factory.addGetterSetter(C4.Node,"brightness",0,(0,x4.getNumberValidator)(),Nu.Factory.afterSetFilter);var ns={};Object.defineProperty(ns,"__esModule",{value:!0}),ns.Contrast=void 0;const Uu=X,E4=dt,k4=N,A4=function(i){var t=Math.pow((this.contrast()+100)/100,2),e=i.data,n=e.length,r=150,s=150,a=150,o;for(o=0;o<n;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};ns.Contrast=A4,Uu.Factory.addGetterSetter(E4.Node,"contrast",0,(0,k4.getNumberValidator)(),Uu.Factory.afterSetFilter);var rs={};Object.defineProperty(rs,"__esModule",{value:!0}),rs.Emboss=void 0;const Be=X,ss=dt,P4=gt,Gu=N,M4=function(i){var t=this.embossStrength()*10,e=this.embossWhiteLevel()*255,n=this.embossDirection(),r=this.embossBlend(),s=0,a=0,o=i.data,h=i.width,l=i.height,c=h*4,d=l;switch(n){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:P4.Util.error("Unknown emboss direction: "+n)}do{var f=(d-1)*c,u=s;d+u<1&&(u=0),d+u>l&&(u=0);var g=(d-1+u)*h*4,p=h;do{var _=f+(p-1)*4,y=a;p+y<1&&(y=0),p+y>h&&(y=0);var b=g+(p-1+y)*4,m=o[_]-o[b],v=o[_+1]-o[b+1],w=o[_+2]-o[b+2],S=m,k=S>0?S:-S,C=v>0?v:-v,A=w>0?w:-w;if(C>k&&(S=v),A>k&&(S=w),S*=t,r){var x=o[_]+S,T=o[_+1]+S,M=o[_+2]+S;o[_]=x>255?255:x<0?0:x,o[_+1]=T>255?255:T<0?0:T,o[_+2]=M>255?255:M<0?0:M}else{var D=e-S;D<0?D=0:D>255&&(D=255),o[_]=o[_+1]=o[_+2]=D}}while(--p)}while(--d)};rs.Emboss=M4,Be.Factory.addGetterSetter(ss.Node,"embossStrength",.5,(0,Gu.getNumberValidator)(),Be.Factory.afterSetFilter),Be.Factory.addGetterSetter(ss.Node,"embossWhiteLevel",.5,(0,Gu.getNumberValidator)(),Be.Factory.afterSetFilter),Be.Factory.addGetterSetter(ss.Node,"embossDirection","top-left",null,Be.Factory.afterSetFilter),Be.Factory.addGetterSetter(ss.Node,"embossBlend",!1,null,Be.Factory.afterSetFilter);var as={};Object.defineProperty(as,"__esModule",{value:!0}),as.Enhance=void 0;const Bu=X,R4=dt,D4=N;function po(i,t,e,n,r){var s=e-t,a=r-n,o;return s===0?n+a/2:a===0?n:(o=(i-t)/s,o=a*o+n,o)}const L4=function(i){var t=i.data,e=t.length,n=t[0],r=n,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<n?n=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===n&&(r=255,n=0),o===a&&(o=255,a=0),c===l&&(c=255,l=0);var g,p,_,y,b,m,v,w,S;for(u>0?(p=r+u*(255-r),_=n-u*(n-0),b=o+u*(255-o),m=a-u*(a-0),w=c+u*(255-c),S=l-u*(l-0)):(g=(r+n)*.5,p=r+u*(r-g),_=n+u*(n-g),y=(o+a)*.5,b=o+u*(o-y),m=a+u*(a-y),v=(c+l)*.5,w=c+u*(c-v),S=l+u*(l-v)),f=0;f<e;f+=4)t[f+0]=po(t[f+0],n,r,_,p),t[f+1]=po(t[f+1],a,o,m,b),t[f+2]=po(t[f+2],l,c,S,w)}};as.Enhance=L4,Bu.Factory.addGetterSetter(R4.Node,"enhance",0,(0,D4.getNumberValidator)(),Bu.Factory.afterSetFilter);var os={};Object.defineProperty(os,"__esModule",{value:!0}),os.Grayscale=void 0;const O4=function(i){var t=i.data,e=t.length,n,r;for(n=0;n<e;n+=4)r=.34*t[n]+.5*t[n+1]+.16*t[n+2],t[n]=r,t[n+1]=r,t[n+2]=r};os.Grayscale=O4;var ls={};Object.defineProperty(ls,"__esModule",{value:!0}),ls.HSL=void 0;const Ni=X,mo=dt,_o=N;Ni.Factory.addGetterSetter(mo.Node,"hue",0,(0,_o.getNumberValidator)(),Ni.Factory.afterSetFilter),Ni.Factory.addGetterSetter(mo.Node,"saturation",0,(0,_o.getNumberValidator)(),Ni.Factory.afterSetFilter),Ni.Factory.addGetterSetter(mo.Node,"luminance",0,(0,_o.getNumberValidator)(),Ni.Factory.afterSetFilter);const I4=function(i){var t=i.data,e=t.length,n=1,r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o,h=n*r*Math.cos(s*Math.PI/180),l=n*r*Math.sin(s*Math.PI/180),c=.299*n+.701*h+.167*l,d=.587*n-.587*h+.33*l,f=.114*n-.114*h-.497*l,u=.299*n-.299*h-.328*l,g=.587*n+.413*h+.035*l,p=.114*n-.114*h+.293*l,_=.299*n-.3*h+1.25*l,y=.587*n-.586*h-1.05*l,b=.114*n+.886*h-.2*l,m,v,w,S;for(o=0;o<e;o+=4)m=t[o+0],v=t[o+1],w=t[o+2],S=t[o+3],t[o+0]=c*m+d*v+f*w+a,t[o+1]=u*m+g*v+p*w+a,t[o+2]=_*m+y*v+b*w+a,t[o+3]=S};ls.HSL=I4;var hs={};Object.defineProperty(hs,"__esModule",{value:!0}),hs.HSV=void 0;const Ui=X,vo=dt,yo=N,F4=function(i){var t=i.data,e=t.length,n=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a,o=n*r*Math.cos(s*Math.PI/180),h=n*r*Math.sin(s*Math.PI/180),l=.299*n+.701*o+.167*h,c=.587*n-.587*o+.33*h,d=.114*n-.114*o-.497*h,f=.299*n-.299*o-.328*h,u=.587*n+.413*o+.035*h,g=.114*n-.114*o+.293*h,p=.299*n-.3*o+1.25*h,_=.587*n-.586*o-1.05*h,y=.114*n+.886*o-.2*h,b,m,v,w;for(a=0;a<e;a+=4)b=t[a+0],m=t[a+1],v=t[a+2],w=t[a+3],t[a+0]=l*b+c*m+d*v,t[a+1]=f*b+u*m+g*v,t[a+2]=p*b+_*m+y*v,t[a+3]=w};hs.HSV=F4,Ui.Factory.addGetterSetter(vo.Node,"hue",0,(0,yo.getNumberValidator)(),Ui.Factory.afterSetFilter),Ui.Factory.addGetterSetter(vo.Node,"saturation",0,(0,yo.getNumberValidator)(),Ui.Factory.afterSetFilter),Ui.Factory.addGetterSetter(vo.Node,"value",0,(0,yo.getNumberValidator)(),Ui.Factory.afterSetFilter);var cs={};Object.defineProperty(cs,"__esModule",{value:!0}),cs.Invert=void 0;const N4=function(i){var t=i.data,e=t.length,n;for(n=0;n<e;n+=4)t[n]=255-t[n],t[n+1]=255-t[n+1],t[n+2]=255-t[n+2]};cs.Invert=N4;var us={};Object.defineProperty(us,"__esModule",{value:!0}),us.Kaleidoscope=void 0;const ds=X,zu=dt,Hu=gt,ju=N;var U4=function(i,t,e){var n=i.data,r=t.data,s=i.width,a=i.height,o=e.polarCenterX||s/2,h=e.polarCenterY||a/2,l,c,d,f=0,u=0,g=0,p=0,_,y=Math.sqrt(o*o+h*h);c=s-o,d=a-h,_=Math.sqrt(c*c+d*d),y=_>y?_:y;var b=a,m=s,v,w,S=360/m*Math.PI/180,k,C;for(w=0;w<m;w+=1)for(k=Math.sin(w*S),C=Math.cos(w*S),v=0;v<b;v+=1)c=Math.floor(o+y*v/b*C),d=Math.floor(h+y*v/b*k),l=(d*s+c)*4,f=n[l+0],u=n[l+1],g=n[l+2],p=n[l+3],l=(w+v*s)*4,r[l+0]=f,r[l+1]=u,r[l+2]=g,r[l+3]=p},G4=function(i,t,e){var n=i.data,r=t.data,s=i.width,a=i.height,o=e.polarCenterX||s/2,h=e.polarCenterY||a/2,l,c,d,f,u,g=0,p=0,_=0,y=0,b,m=Math.sqrt(o*o+h*h);c=s-o,d=a-h,b=Math.sqrt(c*c+d*d),m=b>m?b:m;var v=a,w=s,S,k,C=e.polarRotation||0,A,x;for(c=0;c<s;c+=1)for(d=0;d<a;d+=1)f=c-o,u=d-h,S=Math.sqrt(f*f+u*u)*v/m,k=(Math.atan2(u,f)*180/Math.PI+360+C)%360,k=k*w/360,A=Math.floor(k),x=Math.floor(S),l=(x*s+A)*4,g=n[l+0],p=n[l+1],_=n[l+2],y=n[l+3],l=(d*s+c)*4,r[l+0]=g,r[l+1]=p,r[l+2]=_,r[l+3]=y};const B4=function(i){var t=i.width,e=i.height,n,r,s,a,o,h,l,c,d,f,u=Math.round(this.kaleidoscopePower()),g=Math.round(this.kaleidoscopeAngle()),p=Math.floor(t*(g%360)/360);if(!(u<1)){var _=Hu.Util.createCanvasElement();_.width=t,_.height=e;var y=_.getContext("2d").getImageData(0,0,t,e);Hu.Util.releaseCanvas(_),U4(i,y,{polarCenterX:t/2,polarCenterY:e/2});for(var b=t/Math.pow(2,u);b<=8;)b=b*2,u-=1;b=Math.ceil(b);var m=b,v=0,w=m,S=1;for(p+b>t&&(v=m,w=0,S=-1),r=0;r<e;r+=1)for(n=v;n!==w;n+=S)s=Math.round(n+p)%t,d=(t*r+s)*4,o=y.data[d+0],h=y.data[d+1],l=y.data[d+2],c=y.data[d+3],f=(t*r+n)*4,y.data[f+0]=o,y.data[f+1]=h,y.data[f+2]=l,y.data[f+3]=c;for(r=0;r<e;r+=1)for(m=Math.floor(b),a=0;a<u;a+=1){for(n=0;n<m+1;n+=1)d=(t*r+n)*4,o=y.data[d+0],h=y.data[d+1],l=y.data[d+2],c=y.data[d+3],f=(t*r+m*2-n-1)*4,y.data[f+0]=o,y.data[f+1]=h,y.data[f+2]=l,y.data[f+3]=c;m*=2}G4(y,i,{polarRotation:0})}};us.Kaleidoscope=B4,ds.Factory.addGetterSetter(zu.Node,"kaleidoscopePower",2,(0,ju.getNumberValidator)(),ds.Factory.afterSetFilter),ds.Factory.addGetterSetter(zu.Node,"kaleidoscopeAngle",0,(0,ju.getNumberValidator)(),ds.Factory.afterSetFilter);var fs={};Object.defineProperty(fs,"__esModule",{value:!0}),fs.Mask=void 0;const Vu=X,z4=dt,H4=N;function gs(i,t,e){var n=(e*i.width+t)*4,r=[];return r.push(i.data[n++],i.data[n++],i.data[n++],i.data[n++]),r}function On(i,t){return Math.sqrt(Math.pow(i[0]-t[0],2)+Math.pow(i[1]-t[1],2)+Math.pow(i[2]-t[2],2))}function j4(i){for(var t=[0,0,0],e=0;e<i.length;e++)t[0]+=i[e][0],t[1]+=i[e][1],t[2]+=i[e][2];return t[0]/=i.length,t[1]/=i.length,t[2]/=i.length,t}function V4(i,t){var e=gs(i,0,0),n=gs(i,i.width-1,0),r=gs(i,0,i.height-1),s=gs(i,i.width-1,i.height-1),a=t||10;if(On(e,n)<a&&On(n,s)<a&&On(s,r)<a&&On(r,e)<a){for(var o=j4([n,e,s,r]),h=[],l=0;l<i.width*i.height;l++){var c=On(o,[i.data[l*4],i.data[l*4+1],i.data[l*4+2]]);h[l]=c<a?0:255}return h}}function $4(i,t){for(var e=0;e<i.width*i.height;e++)i.data[4*e+3]=t[e]}function X4(i,t,e){for(var n=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(n.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,g=h+f-s;if(u>=0&&u<e&&g>=0&&g<t){var p=u*t+g,_=n[d*r+f];c+=i[p]*_}}a[l]=c===255*8?255:0}return a}function Y4(i,t,e){for(var n=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(n.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,g=h+f-s;if(u>=0&&u<e&&g>=0&&g<t){var p=u*t+g,_=n[d*r+f];c+=i[p]*_}}a[l]=c>=255*4?255:0}return a}function W4(i,t,e){for(var n=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],r=Math.round(Math.sqrt(n.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,g=h+f-s;if(u>=0&&u<e&&g>=0&&g<t){var p=u*t+g,_=n[d*r+f];c+=i[p]*_}}a[l]=c}return a}const q4=function(i){var t=this.threshold(),e=V4(i,t);return e&&(e=X4(e,i.width,i.height),e=Y4(e,i.width,i.height),e=W4(e,i.width,i.height),$4(i,e)),i};fs.Mask=q4,Vu.Factory.addGetterSetter(z4.Node,"threshold",0,(0,H4.getNumberValidator)(),Vu.Factory.afterSetFilter);var ps={};Object.defineProperty(ps,"__esModule",{value:!0}),ps.Noise=void 0;const $u=X,K4=dt,Z4=N,J4=function(i){var t=this.noise()*255,e=i.data,n=e.length,r=t/2,s;for(s=0;s<n;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()};ps.Noise=J4,$u.Factory.addGetterSetter(K4.Node,"noise",.2,(0,Z4.getNumberValidator)(),$u.Factory.afterSetFilter);var ms={};Object.defineProperty(ms,"__esModule",{value:!0}),ms.Pixelate=void 0;const Xu=X,Q4=gt,t_=dt,e_=N,i_=function(i){var t=Math.ceil(this.pixelSize()),e=i.width,n=i.height,r,s,a,o,h,l,c,d=Math.ceil(e/t),f=Math.ceil(n/t),u,g,p,_,y,b,m,v=i.data;if(t<=0){Q4.Util.error("pixelSize value can not be <= 0");return}for(y=0;y<d;y+=1)for(b=0;b<f;b+=1){for(o=0,h=0,l=0,c=0,u=y*t,g=u+t,p=b*t,_=p+t,m=0,r=u;r<g;r+=1)if(!(r>=e))for(s=p;s<_;s+=1)s>=n||(a=(e*s+r)*4,o+=v[a+0],h+=v[a+1],l+=v[a+2],c+=v[a+3],m+=1);for(o=o/m,h=h/m,l=l/m,c=c/m,r=u;r<g;r+=1)if(!(r>=e))for(s=p;s<_;s+=1)s>=n||(a=(e*s+r)*4,v[a+0]=o,v[a+1]=h,v[a+2]=l,v[a+3]=c)}};ms.Pixelate=i_,Xu.Factory.addGetterSetter(t_.Node,"pixelSize",8,(0,e_.getNumberValidator)(),Xu.Factory.afterSetFilter);var _s={};Object.defineProperty(_s,"__esModule",{value:!0}),_s.Posterize=void 0;const Yu=X,n_=dt,r_=N,s_=function(i){var t=Math.round(this.levels()*254)+1,e=i.data,n=e.length,r=255/t,s;for(s=0;s<n;s+=1)e[s]=Math.floor(e[s]/r)*r};_s.Posterize=s_,Yu.Factory.addGetterSetter(n_.Node,"levels",.5,(0,r_.getNumberValidator)(),Yu.Factory.afterSetFilter);var vs={};Object.defineProperty(vs,"__esModule",{value:!0}),vs.RGB=void 0;const ys=X,bo=dt,a_=N,o_=function(i){var t=i.data,e=t.length,n=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*n,t[a+1]=o*r,t[a+2]=o*s,t[a+3]=t[a+3]};vs.RGB=o_,ys.Factory.addGetterSetter(bo.Node,"red",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),ys.Factory.addGetterSetter(bo.Node,"green",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),ys.Factory.addGetterSetter(bo.Node,"blue",0,a_.RGBComponent,ys.Factory.afterSetFilter);var bs={};Object.defineProperty(bs,"__esModule",{value:!0}),bs.RGBA=void 0;const In=X,ws=dt,l_=N,h_=function(i){var t=i.data,e=t.length,n=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]=n*a+t[o]*h,t[o+1]=r*a+t[o+1]*h,t[o+2]=s*a+t[o+2]*h};bs.RGBA=h_,In.Factory.addGetterSetter(ws.Node,"red",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),In.Factory.addGetterSetter(ws.Node,"green",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),In.Factory.addGetterSetter(ws.Node,"blue",0,l_.RGBComponent,In.Factory.afterSetFilter),In.Factory.addGetterSetter(ws.Node,"alpha",1,function(i){return this._filterUpToDate=!1,i>1?1:i<0?0:i});var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0}),Ss.Sepia=void 0;const c_=function(i){var t=i.data,e=t.length,n,r,s,a;for(n=0;n<e;n+=4)r=t[n+0],s=t[n+1],a=t[n+2],t[n+0]=Math.min(255,r*.393+s*.769+a*.189),t[n+1]=Math.min(255,r*.349+s*.686+a*.168),t[n+2]=Math.min(255,r*.272+s*.534+a*.131)};Ss.Sepia=c_;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.Solarize=void 0;const u_=function(i){var t=i.data,e=i.width,n=i.height,r=e*4,s=n;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)};Cs.Solarize=u_;var xs={};Object.defineProperty(xs,"__esModule",{value:!0}),xs.Threshold=void 0;const Wu=X,d_=dt,f_=N,g_=function(i){var t=this.threshold()*255,e=i.data,n=e.length,r;for(r=0;r<n;r+=1)e[r]=e[r]<t?0:255};xs.Threshold=g_,Wu.Factory.addGetterSetter(d_.Node,"threshold",.5,(0,f_.getNumberValidator)(),Wu.Factory.afterSetFilter),Object.defineProperty(wr,"__esModule",{value:!0}),wr.Konva=void 0;const qu=Ic,p_=Lr,m_=Fr,__=Gr,v_=Br,y_=zr,Ku=Ii,b_=Pn,w_=Di,S_=Rn,C_=Vr,x_=$r,T_=Xr,E_=Yr,k_=ci,A_=Kr,P_=Zr,M_=Qr,R_=es,D_=is,L_=ns,O_=rs,I_=as,F_=os,N_=ls,U_=hs,G_=cs,B_=us,z_=fs,H_=ps,j_=ms,V_=_s,$_=vs,X_=bs,Y_=Ss,W_=Cs,q_=xs;wr.Konva=qu.Konva.Util._assign(qu.Konva,{Arc:p_.Arc,Arrow:m_.Arrow,Circle:__.Circle,Ellipse:v_.Ellipse,Image:y_.Image,Label:Ku.Label,Tag:Ku.Tag,Line:b_.Line,Path:w_.Path,Rect:S_.Rect,RegularPolygon:C_.RegularPolygon,Ring:x_.Ring,Sprite:T_.Sprite,Star:E_.Star,Text:k_.Text,TextPath:A_.TextPath,Transformer:P_.Transformer,Wedge:M_.Wedge,Filters:{Blur:R_.Blur,Brighten:D_.Brighten,Contrast:L_.Contrast,Emboss:O_.Emboss,Enhance:I_.Enhance,Grayscale:F_.Grayscale,HSL:N_.HSL,HSV:U_.HSV,Invert:G_.Invert,Kaleidoscope:B_.Kaleidoscope,Mask:z_.Mask,Noise:H_.Noise,Pixelate:j_.Pixelate,Posterize:V_.Posterize,RGB:$_.RGB,RGBA:X_.RGBA,Sepia:Y_.Sepia,Solarize:W_.Solarize,Threshold:q_.Threshold}});var K_=za.exports;Object.defineProperty(K_,"__esModule",{value:!0});const Z_=wr;za.exports=Z_.Konva;var J_=za.exports;const U=jl(J_),Q_=U.Ellipse.prototype.toObject;U.Ellipse.prototype.toObject=function(){const i=Q_.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const tv=U.Line.prototype.toObject;U.Line.prototype.toObject=function(){const i=tv.call(this);return{...i,attrs:{...i.attrs,x:this.getAbsolutePosition().x,y:this.getAbsolutePosition().y,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const ev=U.Node.prototype.toObject,iv=function(){const i=ev.call(this);return{...i,attrs:{...i.attrs,x:this.getAbsolutePosition().x,y:this.getAbsolutePosition().y,scaleX:this.getAbsoluteScale().x,scaleY:this.getAbsoluteScale().y,rotation:this.getAbsoluteRotation(),opacity:this.getAbsoluteOpacity()}}};U.Node.prototype.toObject=iv;const nv=U.Node.prototype.remove;U.Node.prototype.remove=function(){return nv.call(this),this.fire("removed",{target:this}),this};const rv=U.Node.prototype.moveUp;U.Node.prototype.moveUp=function(){const i=rv.call(this);return i&&this.fire("move:up"),i};const sv=U.Node.prototype.moveDown;U.Node.prototype.moveDown=function(){const i=sv.call(this);return i&&this.fire("move:down"),i};const av=U.Node.prototype.moveToTop;U.Node.prototype.moveToTop=function(){const i=av.call(this);return i&&this.fire("move:top"),i};const ov=U.Node.prototype.moveToBottom;U.Node.prototype.moveToBottom=function(){const i=ov.call(this);return i&&this.fire("move:bottom"),i};const lv=U.Node.prototype.moveTo;U.Node.prototype.moveTo=function(i){const t=lv.call(this,i);return this.fire("move:to"),t};const hv=U.Rect.prototype.toObject;U.Rect.prototype.toObject=function(){const i=hv.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash(),cornerRadius:this.cornerRadius()}}};const cv=U.RegularPolygon.prototype.toObject;U.RegularPolygon.prototype.toObject=function(){const i=cv.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const uv=U.Text.prototype.toObject;U.Text.prototype.toObject=function(){const i=uv.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth()}}};const dv=U.Image.prototype.toObject;U.Image.prototype.toObject=function(){const i=dv.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash(),image:this.image()}}};const Zu=(i,t)=>{if(i.length!==t.length)return!1;for(let e=0;e<i.length;e++){const n=i[e],r=t.find(s=>s.id===n.id);if(!r||!fv(n,r))return!1}return!0},fv=(i,t)=>i.attrs.id===i.attrs.id&&i._id===t._id,Gi=i=>i.reduce((t,e)=>[...t,...e.toArray()],[]),gv=i=>{i.sort(function(e,n){return e-n});const t=Math.floor(i.length/2);return i[t]},Ju=i=>{const t=Math.atan2(i[1],i[0]),e=Math.pow(i[0],2)+Math.pow(i[1],2),n=Math.sqrt(e),r=(i[0]*i[3]-i[2]*i[1])/n;return{rotation:t/(Math.PI/180),scaleX:n,scaleY:r,x:i[4],y:i[5]}},pv=(i,t)=>{const e=i.getTransform().getMatrix(),n=t.getTransform().getMatrix(),r=e[0],s=e[1],a=e[2],o=e[3],h=e[4],l=e[5],c=n[0],d=n[1],f=n[2],u=n[3],g=n[4],p=n[5],_=c*u,y=d*f,b=(f*s-r*u)/(y-_),m=(c*s-r*d)/(_-y),v=(f*o-a*u)/(y-_),w=(c*o-a*d)/(_-y),S=(f*(l-p)+u*(g-h))/(y-_),k=(c*(l-p)+d*(g-h))/(_-y);return Ju([b,m,v,w,S,k])};class Qu{app;constructor(t){this.app=t}}class mv extends Qu{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 n=this.app.stage.getPointerPosition()??new pt(0,0),r=new pt((n.x-this.app.stage.x())/e,(n.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:n.x-r.x*a,y:n.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 td=i=>typeof i=="function";class _v extends Qu{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&&td(e?.hooks?.onInactive)&&await e.hooks.onInactive?.(this.app,e),this.currentTool=t,this.currentTool?.hooks&&td(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 vv=Object.defineProperty,yv=Object.getOwnPropertyDescriptor,ze=(i,t,e,n)=>{for(var r=n>1?void 0:n?yv(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&vv(t,e,r),r};class bv{name="alignmentPlugin";alignment;app;options;keyFns=[];constructor(t){this.options={enabled:!0,...t}}install(t){this.app=t,this.alignment=new be(t,this.options),this.app.alignLeft=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignLeft(e),this},this.app.alignRight=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignRight(e),this},this.app.alignTop=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignTop(e),this},this.app.alignBottom=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignBottom(e),this},this.app.alignCenterX=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignCenterX(e),this},this.app.alignCenterY=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignCenterY(e),this},this.app.dispersionX=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.dispersionX(e),this},this.app.dispersionY=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.dispersionY(e),this},this.keyFns.push(this.app.domKey.on({key:"a",title:"左对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"h",title:"水平居中",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"d",title:"右对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"w",title:"顶对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"v",title:"垂直居中",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"s",title:"底对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"h",title:"水平分布",ctrl:!0,shift:!0},()=>{})),this.keyFns.push(this.app.domKey.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 He(i,t,e){const n=e.value;return e.value=function(...r){if(this.enabled)return n.apply(this,r);console.log(`Method ${t} is disabled.`)},e}class be{app;enabled;constructor(t,e){const{enabled:n}=e;this.app=t,this.enabled=n}alignLeft(t){const e=t.map(r=>r.getClientRect()),n=Math.min(...e.map(r=>r.x));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].x-n;return a.attrs={...a.attrs,x:a.attrs.x-o},a}))}alignRight(t){const e=t.map(r=>r.getClientRect()),n=Math.max(...e.map(r=>r.x+r.width));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(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()),n=Math.min(...e.map(r=>r.y));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].y-n;return a.attrs={...a.attrs,y:a.attrs.y-o},a}))}alignBottom(t){const e=t.map(r=>r.getClientRect()),n=Math.max(...e.map(r=>r.y+r.height));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(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()),n=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=n-(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()),n=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=n-(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 n=t[0],r=t[t.length-1],s=n.getClientRect()[e]+(e==="x"?n.getClientRect().width:n.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 g=c+l;return u.attrs[e]=g-d.getClientRect()[e]+u.attrs[e],c=g+(e==="x"?d.getClientRect().width:d.getClientRect().height),u}))}}ze([He],be.prototype,"alignLeft",1),ze([He],be.prototype,"alignRight",1),ze([He],be.prototype,"alignTop",1),ze([He],be.prototype,"alignBottom",1),ze([He],be.prototype,"alignCenterX",1),ze([He],be.prototype,"alignCenterY",1),ze([He],be.prototype,"dispersionX",1),ze([He],be.prototype,"dispersionY",1);class ed{app;selected;optionLayer;enabled;multipleSelect;hightLightConfig;transformerConfig;rubberConfig;transformer;rubberRect;rubberStartPoint=new pt(0,0);rubberEnable=!1;hightLightRects;constructor(t,e){const{enabled:n,multipleSelect:r,transformer:s,hightLight:a,rubber:o}=e;this.app=t,this.selected=new Map,this.hightLightRects=new Map,this.enabled=n,this.multipleSelect=r,this.transformerConfig=s,this.hightLightConfig=a,this.rubberConfig=o,this.optionLayer=new U.Layer,this.optionLayer.name("pictode:option:layer"),this.app.stage.add(this.optionLayer),this.transformer=new U.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 U.Text||[...this.selected.values()][0]instanceof U.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 U.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&&(Zu(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,n)=>{const r=new U.Rect({stroke:this.hightLightConfig.stroke,strokeWidth:this.hightLightConfig.strokeWidth,dash:this.hightLightConfig.dash,fillEnabled:!1,strokeScaleEnabled:!1});this.calculateNodeRect(n,r,this.hightLightConfig.padding??0),this.optionLayer.add(r);const s=()=>requestAnimationFrame(()=>this.calculateNodeRect(n,r,this.hightLightConfig.padding??0));return n.on("dragmove transform xChange yChange",s),e.set(n.id(),{rect:r,transformHandler:s}),e},new Map)}removeHightRect(...t){t.forEach(e=>{const n=this.hightLightRects.get(e.id());n&&(e.off("dragmove transform xChange yChange",n.transformHandler),n.rect.remove(),this.hightLightRects.delete(e.id()))})}calculateNodeRect(t,e,n=0){const{x:r,y:s,width:a,height:o}=this.getNodeRect(t,n);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 n=f=>U.angleDeg?f*Math.PI/180:f,r=[];let s=[];t instanceof U.Group?s=t.getChildren():s=[t],s.map(f=>{const u=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.transformer.ignoreStroke()}),g=[{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}],p=f.getAbsoluteTransform();g.forEach(function(_){const y=p.point(_);r.push(new pt(y.x,y.y))})});const a=new U.Transform;a.rotate(-n(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 U.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 pt(Math.min(this.app.pointer.x,this.rubberStartPoint.x),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 U.Stage||!t.target.attrs.id)return;const n=this.app.findTopGroup(t.target)??t.target;t.evt.shiftKey&&this.multipleSelect?this.selected.has(n.attrs.id)?this.cancelSelect(n):this.select(...this.selected.values(),n):this.select(n)};onMouseOut=t=>{t.target instanceof U.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 wv={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 Sv{name="selectorPlugin";selector;app;options;keyFns=[];constructor(t){this.options={...wv,...t}}install(t){this.app=t,this.selector=new ed(t,this.options),this.app.on("canvasCleared",this.onCanvasCleared),this.app.select=function(...e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.select(...e),this},this.app.cancelSelect=function(...e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.cancelSelect(...e),this},this.app.selectByEvent=function(e){return this.app.getPlugin("selectorPlugin")&&(e.target instanceof U.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 n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.triggerSelector(e),this},this.app.isSelected=function(e){const n=this.app.getPlugin("selectorPlugin");return n?n.selector?.isSelected(e)??!1:!1},this.keyFns.push(this.app.domKey.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(this.app.domKey.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 Bi{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 Cv extends Bi{constructor(t,e){super(t,e)}execute(){this.app._add(...this.options.nodes)}undo(){this.app._remove(...this.options.nodes)}}class xv extends Bi{constructor(t,e){super(t,e)}execute(){this.app._remove(...this.options.nodes)}undo(){this.app._add(...this.options.nodes)}}class Tv extends Bi{constructor(t,e){super(t,e)}execute(){this.app._update(...this.options.newNodes)}undo(){this.app._update(...this.options.oldNodes)}}class Ev extends Bi{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 kv extends Bi{constructor(t,e){super(t,e)}execute(){this.app._makeGroup(this.options.nodes)}undo(){this.app._decomposeGroup(this.options.group)}}class Av extends Bi{constructor(t,e){super(t,e)}execute(){this.app._decomposeGroup(this.options.group)}undo(){this.app._makeGroup(this.options.nodes)}}class id{name="history";app;enabled;stackSize;undoStack=[];redoStack=[];idCounter=0;constructor(t,e){const{enabled:n,stackSize:r}=e;this.app=t,this.enabled=n,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 Pv{name="historyPlugin";history;app;options;keyFns=[];oldNodes=[];constructor(t){this.options={enabled:!0,stackSize:100,...t}}install(t){this.app=t,this.history=new id(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 n=this.app.getPlugin("historyPlugin");return n&&n.history?.undo(e),this},this.app.redo=function(e=1){const n=this.app.getPlugin("historyPlugin");return n&&n.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 n=this.app.getPlugin("historyPlugin");return n&&n.history?.jump(e),this},this.keyFns.push(this.app.domKey.on({key:"z",title:"撤销",exact:!0,ctrl:!0},()=>{this.app?.undo()})),this.keyFns.push(this.app.domKey.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 Cv(this.app,{nodes:t}))};onNodeRemove=t=>{!this.app||!this.history||this.history.execute(new xv(this.app,{nodes:t}))};onNodeUpdateBefore=t=>{this.oldNodes=t.map(e=>e.toObject())};onNodeUpdated=t=>{!this.app||!this.history||this.history.execute(new Tv(this.app,{oldNodes:this.oldNodes,newNodes:t.map(e=>e.toObject())}))};onNodeZIndexChanged=t=>{!this.app||!this.history||this.history.execute(new Ev(this.app,{nodes:t}))};onMakeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new kv(this.app,{nodes:e,group:t}))};onDecomposeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new Av(this.app,{nodes:e,group:t}))}}class Mv{name="diamondTool";hooks;config;diamond=null;startPointer=new pt(0,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 U.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,n=t.pointer.y-this.startPointer.y,r=new pt(this.startPointer.x+e/2,this.startPointer.y+n/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 Rv{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 U.Line({points:Gi(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(Gi(this.points)))}mouseup({app:t,pointer:e}){if(!this.line)return;const n=this.points.at(-1);this.points.length<=6&&n&&e.distanceTo(n)<10&&this.line&&this.line.destroy(),this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[]}enableChanged(){this.line=null,this.points=[]}}class Dv{name="ellipseTool";config;hooks;ellipse=null;startPointer=new pt(0,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 U.Ellipse({radiusX:0,radiusY:0,strokeScaleEnabled:!1,...this.config}),this.ellipse.setPosition(this.startPointer),this.ellipse.radius(new pt(0,0)),t.add(this.ellipse))}mousemove({app:t}){if(!this.ellipse)return;const e=t.pointer.x-this.startPointer.x,n=t.pointer.y-this.startPointer.y,r=new pt(Math.abs(e)/2,Math.abs(n)/2);this.ellipse.setPosition(new pt(this.startPointer.x+e/2,this.startPointer.y+n/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 Lv{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 U.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 n=200,r=n*((this.imageElement.height??1)/(this.imageElement.width??1));this.image.width(n),this.image.height(r),this.image.position(new pt(e.x-n/2,e.y-r/2)),t.render()}enableChanged(){this.image=null,this.imageElement=new Image}}class Ov{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 U.Line({points:Gi(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(Gi(this.points))}mousemove({app:t,pointer:e}){this.line&&(this.line.points(Gi(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 Iv{name="rectTool";config;hooks;startPointer=new pt(0,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 U.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 pt(Math.min(this.startPointer.x,t.pointer.x),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 Fv{name="selectTool";hooks;constructor(t){this.hooks=t.hooks}}const Nv=(i,t,e)=>{t.hide();const n=t.absolutePosition(),r={x:i.stage.container().offsetLeft+n.x,y:i.stage.container().offsetTop+n.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 g=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),p=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;(g||p)&&(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):i.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 Uv{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 U.Text({...this.config,text:" ",x:e.x,y:e.y,fontFamily:"JiaYouYa"}),this.textNode.on("dblclick",({target:n})=>{Nv(t,n,()=>{this.hooks?.onCompleteDrawing?.(t,n)})}),t.add(this.textNode),this.textNode.fire("dblclick")}enableChanged(){this.textNode=null}}class Gv{name="eraserTool";hooks;targetMap=new Map;isEraser=!1;constructor(t){this.hooks=t.hooks}mousedown({event:t}){this.isEraser=!0,!(t.target instanceof U.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:n})=>(e.opacity(n),e))),this.targetMap.clear(),this.isEraser=!1)}mousemove({event:t}){!this.isEraser||t.target instanceof U.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 nd={backgroundColor:"#ffffff",scale:{min:.05,max:5},panning:{enabled:!1,cursor:"grabbing"},mousewheel:{enabled:!1,factor:.1}};class Bv extends Wf{stage;mainLayer;config;domKey=new Jn;mouse;tooler;installedPlugins=new Map;resizeObserver;constructor(t){super(),this.config={...nd,...t},this.stage=new U.Stage({container:document.createElement("div"),width:500,height:500}),this.stage.container().style.backgroundColor=this.config.backgroundColor,this.mainLayer=new U.Layer,this.mainLayer.name("main:layer"),this.stage.add(this.mainLayer),this.tooler=new _v(this),this.mouse=new mv(this),this.resizeObserver=new ResizeObserver(e=>{const{width:n,height:r}=e[0].contentRect;this.stage.width(n),this.stage.height(r),this.emit("resizeRoot",n,r),this.render()}),this.triggerPanning(this.config.panning.enabled),this.triggerMouseWheel(this.config.mousewheel.enabled),this.registerKeyFns()}registerKeyFns(){this.domKey.on({key:"o",title:"打开",exact:!0,ctrl:!0},()=>{xl().then(t=>qs(t[0])).then(t=>{this.fromJSON(t)})}),this.domKey.on({key:"e",title:"导出图片",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:"[",title:"下移一层",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:"]",title:"上移一层",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:"[",title:"置于底层",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:"]",title:"置于顶层",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:["delete","backspace"],title:"删除"},()=>{console.log("删除")}),this.domKey.on({key:"r",title:"重置画布",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:" ",title:"移动画布"},()=>(console.log("移动画布"),this.triggerPanning(!0),()=>{this.triggerPanning(!1)})),this.domKey.on({key:["Control","Meta"],title:"缩放画布"},()=>(this.triggerMouseWheel(!0),()=>{this.triggerMouseWheel(!1)})),this.domKey.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 pt(t,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(`#${ji()}`),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=n=>n.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 U.Group&&this.emit("nodeGroupMake",e,t),e}_makeGroup(t){if(t.length<2)return t;const e=new U.Group({draggable:!0});return e.add(...t.map(n=>(n.draggable(!1),n))),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,n=[...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),n}findTopGroup(t){return t.parent instanceof U.Group&&t.parent.parent instanceof U.Group?this.findTopGroup(t.parent):t.parent instanceof U.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 n=t.map(r=>{const s={node:r,oldZIndex:r.getZIndex(),newZIndex:r.getZIndex()};return e(r),s.newZIndex=r.getZIndex(),s});n.some(({oldZIndex:r,newZIndex:s})=>r!==s)&&this.emit("nodeZindexChanged",n)}getNodeById(t){return this.getNodes(e=>e.id()===t)?.[0]}getNodes(t){return this.mainLayer.find(t)??[]}isPointInArea(t,e){const{width:n,height:r,x:s,y:a}=e;return t.x>=s&&t.x<=s+n&&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 n=t.getClientRect({relativeTo:this.stage}),r=e.getClientRect({relativeTo:this.stage}),s=n.x<=r.x&&n.y<=r.y,a=n.x+n.width>=r.x+r.width&&n.y<=r.y,o=n.x<=r.x&&n.y+n.height>=r.y+r.height,h=n.x+n.width>=r.x+r.width&&n.y+n.height>=r.y+r.height;return s&&a&&o&&h}render(){this.mainLayer.draw()}scale(){return this.stage.scaleX()}scaleTo(t,e=new pt(0,0)){const n=this.scale();this.emit("canvasZoomStart",n);const r=Math.min(Math.max(t,this.config.scale.min),this.config.scale.max),s=new pt((e.x-this.stage.x())/n,(e.y-this.stage.y())/n);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:n=10,pixelRatio:r=2,mimeType:s="image/png",quality:a=1,haveBackground:o=!1}=e??{},h=new U.Layer;this.stage.add(h);let l=[];t&&t.length>0?l=t.map(S=>S.toObject()):l=this.mainLayer.children?.map(S=>S.toObject())??[];const c=l.map(S=>U.Node.create(S));h.add(...c);const d=new U.Transformer({rotateAnchorOffset:0});d.nodes(c);const f=d.getClientRect(),u=this.stage.scaleX(),g=this.stage.scaleY(),p=this.stage.x(),_=this.stage.y(),y=f.width+n*2,b=f.height+n*2,m=f.x-n,v=f.y-n,w=new U.Rect({width:y,height:b,x:(m-p)/u,y:(v-_)/g,fill:this.stage.container().style.backgroundColor});return o&&(h.add(w),w.moveToBottom()),new Promise((S,k)=>{try{h.toDataURL({width:y,height:b,x:m,y:v,pixelRatio:r,mimeType:s,quality:a,callback:C=>{S({dataURL:C,width:y,height:b}),d.remove(),h.remove()}})}catch(C){k(C)}})}toJSON(){return JSON.stringify(this.mainLayer.toObject())}fromJSON(t){this.clear(),this.mainLayer.remove();const e=U.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(n=>n?.enable?.()),this}disablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.disable?.()),this}isPluginEnable(t){return this.getPlugin(t)?.isEnabled?.()??!1}destroyPlugins(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.destroy()),this}destroy(){this.resizeObserver.disconnect(),this.destroyPlugins(Array.from(this.installedPlugins.keys())),this.mouse.destroy(),this.tooler.destroy(),this.stage.destroy(),this.removeAllListeners()}}E.$=vt,E.AlignmentPlugin=bv,E.Arrow=Fm,E.Ball=Nm,E.Ball3d=Um,E.Box=Gm,E.C2S=Mm,E.CanvasWrap=qm,E.DEFAULT_APP_CONFIG=nd,E.DOMEvent=a1,E.DOMKey=Jn,E.DOMMedia=s1,E.DOMMouse=Js,E.DOMQuery=kt,E.DOMScroll=o1,E.DOMUtil=t1,E.Dep=Sc,E.DiamondTool=Mv,E.DrawingTool=Rv,E.EllipseTool=Dv,E.EraserTool=Gv,E.History=id,E.HistoryPlugin=Pv,E.ImageTool=Lv,E.KonvaApp=Bv,E.Light=Bm,E.Line=zm,E.LineTool=Ov,E.Matrix=ce,E.Point=pt,E.Point3d=Hm,E.Polygon=rm,E.QRCode=Re,E.Query=ot,E.Rect=Fa,E.RectTool=Iv,E.Segment=Wm,E.SelectTool=Fv,E.Selector=ed,E.SelectorPlugin=Sv,E.Ship=jm,E.Slider=Vm,E.SvgPath=Em,E.TWEEN=dm,E.TextTool=Uv,E.Tree=Ym,E.Triangle=$m,E.TriangleLight=Xm,E.Vector=gr,E.VideoUtil=Tn,E.WebGLRenderer=Zm,E.WebRTCClient=Km,E.WebSocket=Ji,E.addWatermark=Np,E.ajax=$p,E.angle2radian=im,E.animateCanvas=l1,E.animateInWeb=zl,E.appendUrlSearch=Zs,E.base64URLDecode=T0,E.base64URLEncode=x0,E.blobToRawImage=hp,E.changeBrightness=Ip,E.changeDiaphaneity=Fp,E.changeSize=Op,E.clearCookies=r1,E.clickEvent=J0,E.compileTemplate=Z0,E.compression=Gp,E.copyToClipboard=N0,E.createXMLHttpRequest=bc,E.cssTransition=h1,E.dom=F0,E.dquery=Bl,E.drawQRCodeToCanvas=jp,E.drawSpirograph=Dm,E.drawStar=Lm,E.dynamicStrokeLine=Om,E.encodeHTML=K0,E.fileOrBlobToDataURL=Da,E.fileToArrayBufferPromise=Tl,E.flatPoints=Gi,E.flipSideToSide=up,E.flipUpsideDown=dp,E.formDataToSearch=Gl,E.getBrowserClient=c0,E.getBrowserClientVersion=u0,E.getBrowserLanguage=f0,E.getCanvasImageData=Ra,E.getCanvasImageDataByBitmap=sp,E.getCanvasImageDataByVideo=rp,E.getCookie=i1,E.getCookieObject=n1,E.getDocumentElement=Ks,E.getElementLeftInPage=Ml,E.getElementPositionInPage=Pl,E.getElementPositionInPage2=a0,E.getElementPositionInViewport=o0,E.getElementTopInPage=Rl,E.getFileExtensionFromFile=El,E.getFileTypeFromFile=Jf,E.getFilesImageInfo=np,E.getFixedWidthText=W0,E.getFormElementData=Vp,E.getGroupCoords=pv,E.getImageDataByAIData=Bp,E.getImageMainColor=cp,E.getInternetExplorerVersion=Fl,E.getMiddleValue=gv,E.getMouseButton=Q0,E.getMousePositionInElement=Zn,E.getMousePositionInPage=Dl,E.getMousePositionInViewport=l0,E.getOperatingSystem=Ve,E.getOperatingSystemVersion=h0,E.getPageClient=Kn,E.getPageScroll=pi,E.getPageSize=n0,E.getRawImageInfo=Ma,E.getScrollParent=t5,E.getSelectedText=U0,E.getTextWidth=Y0,E.getTimeZone=g0,E.getURL=Ul,E.getUserGeolocationPromise=d0,E.getViewportSize=Qi,E.gifImage=pc,E.h=i0,E.handleDragAndDropFiles=t0,E.handleHashChange=O0,E.handleHistoryChange=I0,E.handleInputFiles=Qf,E.handleURLChange=L0,E.hasDocument=b0,E.hasHistory=w0,E.hasWindow=Nl,E.hexStr2num=fr,E.hexStr2rgbStr=Ia,E.hsv2rgb=tm,E.htmlElementToBlob=Kf,E.htmlIncodeOrDecode=q0,E.ifWebFileHasChanged=Xp,E.imageDataToBitmap=ap,E.imageDataToBlob=lp,E.imageDataToDataURL=op,E.isAndroid=Il,E.isAppleDevice=p0,E.isBrowserSupportFileAPI=S0,E.isDarkMode=v0,E.isElementFocus=G0,E.isElementInViewport=s0,E.isElementInViewportSimple=r0,E.isIE=y0,E.isIOS=Ll,E.isMacOS=Ol,E.isMobile=m0,E.isTabInView=z0,E.isURL=A0,E.isWechat=_0,E.jpgToPng=Mp,E.lazyloadImages=$0,E.leftRotate=fp,E.linkExport=Zf,E.localstorage=Qs,E.marginSharpen=Pp,E.microTask=e0,E.mosaic=Up,E.mount=Zi,E.navigateBack=j0,E.navigateBack2=V0,E.num2HexStr=Cc,E.num2rgbStr=xc,E.outputGifBase64=mc,E.outputQRCodeBase64=Hp,E.parseURL=E0,E.parseUrlParams=k0,E.patch=kl,E.patchDOM=Al,E.pngToJpg=Rp,E.qrDecompose=Ju,E.query=vt,E.radian2angle=nm,E.radiusClip=Lp,E.randomColorHexStr=Zp,E.randomColorHexStr2=Jp,E.randomColorNumber=Kp,E.reactiveVue2=Wp,E.reactiveVue3=qp,E.readFileInBrowser=qs,E.recordToSearch=P0,E.recordToSearch2=M0,E.rectClip=Dp,E.rgb2hsv=em,E.rgbStr2hexStr=Qp,E.rightRotate=gp,E.rotate=De,E.roundedRect=Rm,E.scrollTo=H0,E.searchToRecord=R0,E.searchToRecord2=D0,E.selectFileInBrowser=xl,E.setCookie=e1,E.setRem=C0,E.shapeArrayEqual=Zu,E.sharpen=Ap,E.siblings=B0,E.smileFace=Im,E.stringToBlob=Sl,E.stringToXml=qf,E.toBlackAndWhite=_p,E.toBlue=wp,E.toBlueAndGreen=xp,E.toBlueAndGrey=kp,E.toGreen=bp,E.toGreenAndGrey=Ep,E.toGrey=pp,E.toGrey2=mp,E.toOpposite=vp,E.toRed=yp,E.toRedAndBlue=Cp,E.toRedAndGreen=Sp,E.toRedAndGrey=Tp,E.waitForStyleSheetsLoaded=X0,E.watchEffect=Yp,E.xmlToString=Cl,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
33
|
+
${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 n=this.getPeerName(t);this.trace(`${n} ${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 n=document.createElement("div");n.innerHTML=`<div>${e}, ${t}</div>`,document.getElementById("trace")?.appendChild(n)}getOtherPeer(t){return t===this.localPeerConnection?this.remotePeerConnection:this.localPeerConnection}getPeerName(t){return t===this.localPeerConnection?"localPeerConnection":"remotePeerConnection"}}class d3{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 _0(i,t){return!i||i.parentElement===null?t:_0(i.parentElement,t.concat([i]))}const Nl=function(i,t){return getComputedStyle(i,null).getPropertyValue(t)},g3=function(i){return Nl(i,"overflow")+Nl(i,"overflow-y")+Nl(i,"overflow-x")},p3=function(i){return/(auto|scroll)/.test(g3(i))};function m3(i){if(!(i instanceof HTMLElement||i instanceof SVGElement))return;const t=_0(i.parentElement,[]);for(let e=0;e<t.length;e+=1)if(p3(t[e]))return t[e];return document.scrollingElement||document.documentElement}var Ul={exports:{}},qr={},Gl={},Bl={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i._registerNode=i.Konva=i.glob=void 0;const t=Math.PI/180;function e(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}i.glob=typeof Ho<"u"?Ho:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},i.Konva={_global:i.glob,version:"9.2.2",isBrowser:e(),isUnminified:/param/.test(function(r){}.toString()),dblClickWindow:400,getAngle(r){return i.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 i.Konva.DD.isDragging},isDragReady(){return!!i.Konva.DD.node},releaseCanvasOnDestroy:!0,document:i.glob.document,_injectGlobal(r){i.glob.Konva=r}};const n=r=>{i.Konva[r.prototype.getClassName()]=r};i._registerNode=n,i.Konva._injectGlobal(i.Konva)})(Bl);const Ot=St(wt({__proto__:null,default:Pe(Bl)},[Bl]));var $l={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Util=i.Transform=void 0;const t=Ot;class e{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.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(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){var k=this.m;return{x:k[0]*b.x+k[2]*b.y+k[4],y:k[1]*b.x+k[3]*b.y+k[5]}}translate(b,k){return this.m[4]+=this.m[0]*b+this.m[2]*k,this.m[5]+=this.m[1]*b+this.m[3]*k,this}scale(b,k){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=k,this.m[3]*=k,this}rotate(b){var k=Math.cos(b),T=Math.sin(b),R=this.m[0]*k+this.m[2]*T,A=this.m[1]*k+this.m[3]*T,U=this.m[0]*-T+this.m[2]*k,I=this.m[1]*-T+this.m[3]*k;return this.m[0]=R,this.m[1]=A,this.m[2]=U,this.m[3]=I,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,k){var T=this.m[0]+this.m[2]*k,R=this.m[1]+this.m[3]*k,A=this.m[2]+this.m[0]*b,U=this.m[3]+this.m[1]*b;return this.m[0]=T,this.m[1]=R,this.m[2]=A,this.m[3]=U,this}multiply(b){var k=this.m[0]*b.m[0]+this.m[2]*b.m[1],T=this.m[1]*b.m[0]+this.m[3]*b.m[1],R=this.m[0]*b.m[2]+this.m[2]*b.m[3],A=this.m[1]*b.m[2]+this.m[3]*b.m[3],U=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],I=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=k,this.m[1]=T,this.m[2]=R,this.m[3]=A,this.m[4]=U,this.m[5]=I,this}invert(){var b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),k=this.m[3]*b,T=-this.m[1]*b,R=-this.m[2]*b,A=this.m[0]*b,U=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),I=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=k,this.m[1]=T,this.m[2]=R,this.m[3]=A,this.m[4]=U,this.m[5]=I,this}getMatrix(){return this.m}decompose(){var b=this.m[0],k=this.m[1],T=this.m[2],R=this.m[3],A=this.m[4],U=this.m[5],I=b*R-k*T;let N={x:A,y:U,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||k!=0){var q=Math.sqrt(b*b+k*k);N.rotation=k>0?Math.acos(b/q):-Math.acos(b/q),N.scaleX=q,N.scaleY=I/q,N.skewX=(b*T+k*R)/I,N.skewY=0}else if(T!=0||R!=0){var W=Math.sqrt(T*T+R*R);N.rotation=Math.PI/2-(R>0?Math.acos(-T/W):-Math.acos(T/W)),N.scaleX=I/W,N.scaleY=W,N.skewX=0,N.skewY=(b*T+k*R)/I}return N.rotation=i.Util._getRotation(N.rotation),N}}i.Transform=e;var n="[object Array]",r="[object Number]",s="[object String]",a="[object Boolean]",o=Math.PI/180,l=180/Math.PI,h="#",c="",d="0",f="Konva warning: ",u="Konva error: ",g="rgb(",m={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]},y=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,x=[];const C=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(v){setTimeout(v,60)};i.Util={_isElement(v){return!!(v&&v.nodeType==1)},_isFunction(v){return!!(v&&v.constructor&&v.call&&v.apply)},_isPlainObject(v){return!!v&&v.constructor===Object},_isArray(v){return Object.prototype.toString.call(v)===n},_isNumber(v){return Object.prototype.toString.call(v)===r&&!isNaN(v)&&isFinite(v)},_isString(v){return Object.prototype.toString.call(v)===s},_isBoolean(v){return Object.prototype.toString.call(v)===a},isObject(v){return v instanceof Object},isValidSelector(v){if(typeof v!="string")return!1;var b=v[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(v){return v===0||v>0?1:-1},requestAnimFrame(v){x.push(v),x.length===1&&C(function(){const b=x;x=[],b.forEach(function(k){k()})})},createCanvasElement(){var v=document.createElement("canvas");try{v.style=v.style||{}}catch{}return v},createImageElement(){return document.createElement("img")},_isInDocument(v){for(;v=v.parentNode;)if(v==document)return!0;return!1},_urlToImage(v,b){var k=i.Util.createImageElement();k.onload=function(){b(k)},k.src=v},_rgbToHex(v,b,k){return((1<<24)+(v<<16)+(b<<8)+k).toString(16).slice(1)},_hexToRgb(v){v=v.replace(h,c);var b=parseInt(v,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){for(var v=(Math.random()*16777215<<0).toString(16);v.length<6;)v=d+v;return h+v},getRGB(v){var b;return v in m?(b=m[v],{r:b[0],g:b[1],b:b[2]}):v[0]===h?this._hexToRgb(v.substring(1)):v.substr(0,4)===g?(b=y.exec(v.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(v){return v=v||"black",i.Util._namedColorToRBA(v)||i.Util._hex3ColorToRGBA(v)||i.Util._hex4ColorToRGBA(v)||i.Util._hex6ColorToRGBA(v)||i.Util._hex8ColorToRGBA(v)||i.Util._rgbColorToRGBA(v)||i.Util._rgbaColorToRGBA(v)||i.Util._hslColorToRGBA(v)},_namedColorToRBA(v){var b=m[v.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(v){if(v.indexOf("rgb(")===0){v=v.match(/rgb\(([^)]+)\)/)[1];var b=v.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(v){if(v.indexOf("rgba(")===0){v=v.match(/rgba\(([^)]+)\)/)[1];var b=v.split(/ *, */).map((k,T)=>k.slice(-1)==="%"?T===3?parseInt(k)/100:parseInt(k)/100*255:Number(k));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(v){if(v[0]==="#"&&v.length===9)return{r:parseInt(v.slice(1,3),16),g:parseInt(v.slice(3,5),16),b:parseInt(v.slice(5,7),16),a:parseInt(v.slice(7,9),16)/255}},_hex6ColorToRGBA(v){if(v[0]==="#"&&v.length===7)return{r:parseInt(v.slice(1,3),16),g:parseInt(v.slice(3,5),16),b:parseInt(v.slice(5,7),16),a:1}},_hex4ColorToRGBA(v){if(v[0]==="#"&&v.length===5)return{r:parseInt(v[1]+v[1],16),g:parseInt(v[2]+v[2],16),b:parseInt(v[3]+v[3],16),a:parseInt(v[4]+v[4],16)/255}},_hex3ColorToRGBA(v){if(v[0]==="#"&&v.length===4)return{r:parseInt(v[1]+v[1],16),g:parseInt(v[2]+v[2],16),b:parseInt(v[3]+v[3],16),a:1}},_hslColorToRGBA(v){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(v)){const[b,...k]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(v),T=Number(k[0])/360,R=Number(k[1])/100,A=Number(k[2])/100;let U,I,N;if(R===0)return N=A*255,{r:Math.round(N),g:Math.round(N),b:Math.round(N),a:1};A<.5?U=A*(1+R):U=A+R-A*R;const q=2*A-U,W=[0,0,0];for(let K=0;K<3;K++)I=T+1/3*-(K-1),I<0&&I++,I>1&&I--,6*I<1?N=q+(U-q)*6*I:2*I<1?N=U:3*I<2?N=q+(U-q)*(2/3-I)*6:N=q,W[K]=N*255;return{r:Math.round(W[0]),g:Math.round(W[1]),b:Math.round(W[2]),a:1}}},haveIntersection(v,b){return!(b.x>v.x+v.width||b.x+b.width<v.x||b.y>v.y+v.height||b.y+b.height<v.y)},cloneObject(v){var b={};for(var k in v)this._isPlainObject(v[k])?b[k]=this.cloneObject(v[k]):this._isArray(v[k])?b[k]=this.cloneArray(v[k]):b[k]=v[k];return b},cloneArray(v){return v.slice(0)},degToRad(v){return v*o},radToDeg(v){return v*l},_degToRad(v){return i.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),i.Util.degToRad(v)},_radToDeg(v){return i.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),i.Util.radToDeg(v)},_getRotation(v){return t.Konva.angleDeg?i.Util.radToDeg(v):v},_capitalize(v){return v.charAt(0).toUpperCase()+v.slice(1)},throw(v){throw new Error(u+v)},error(v){console.error(u+v)},warn(v){t.Konva.showWarnings&&console.warn(f+v)},each(v,b){for(var k in v)b(k,v[k])},_inRange(v,b,k){return b<=v&&v<k},_getProjectionToSegment(v,b,k,T,R,A){var U,I,N,q=(v-k)*(v-k)+(b-T)*(b-T);if(q==0)U=v,I=b,N=(R-k)*(R-k)+(A-T)*(A-T);else{var W=((R-v)*(k-v)+(A-b)*(T-b))/q;W<0?(U=v,I=b,N=(v-R)*(v-R)+(b-A)*(b-A)):W>1?(U=k,I=T,N=(k-R)*(k-R)+(T-A)*(T-A)):(U=v+W*(k-v),I=b+W*(T-b),N=(U-R)*(U-R)+(I-A)*(I-A))}return[U,I,N]},_getProjectionToLine(v,b,k){var T=i.Util.cloneObject(v),R=Number.MAX_VALUE;return b.forEach(function(A,U){if(!(!k&&U===b.length-1)){var I=b[(U+1)%b.length],N=i.Util._getProjectionToSegment(A.x,A.y,I.x,I.y,v.x,v.y),q=N[0],W=N[1],K=N[2];K<R&&(T.x=q,T.y=W,R=K)}}),T},_prepareArrayForTween(v,b,k){var T,R=[],A=[];if(v.length>b.length){var U=b;b=v,v=U}for(T=0;T<v.length;T+=2)R.push({x:v[T],y:v[T+1]});for(T=0;T<b.length;T+=2)A.push({x:b[T],y:b[T+1]});var I=[];return A.forEach(function(N){var q=i.Util._getProjectionToLine(N,R,k);I.push(q.x),I.push(q.y)}),I},_prepareToStringify(v){var b;v.visitedByCircularReferenceRemoval=!0;for(var k in v)if(v.hasOwnProperty(k)&&v[k]&&typeof v[k]=="object"){if(b=Object.getOwnPropertyDescriptor(v,k),v[k].visitedByCircularReferenceRemoval||i.Util._isElement(v[k]))if(b.configurable)delete v[k];else return null;else if(i.Util._prepareToStringify(v[k])===null)if(b.configurable)delete v[k];else return null}return delete v.visitedByCircularReferenceRemoval,v},_assign(v,b){for(var k in b)v[k]=b[k];return v},_getFirstPointerId(v){return v.touches?v.changedTouches[0].identifier:v.pointerId||999},releaseCanvas(...v){t.Konva.releaseCanvasOnDestroy&&v.forEach(b=>{b.width=0,b.height=0})},drawRoundedRectPath(v,b,k,T){let R=0,A=0,U=0,I=0;typeof T=="number"?R=A=U=I=Math.min(T,b/2,k/2):(R=Math.min(T[0]||0,b/2,k/2),A=Math.min(T[1]||0,b/2,k/2),I=Math.min(T[2]||0,b/2,k/2),U=Math.min(T[3]||0,b/2,k/2)),v.moveTo(R,0),v.lineTo(b-A,0),v.arc(b-A,A,A,Math.PI*3/2,0,!1),v.lineTo(b,k-I),v.arc(b-I,k-I,I,0,Math.PI/2,!1),v.lineTo(U,k),v.arc(U,k-U,U,Math.PI/2,Math.PI,!1),v.lineTo(0,R),v.arc(R,R,R,Math.PI,Math.PI*3/2,!1)}}})($l);const ee=St(wt({__proto__:null,default:Pe($l)},[$l]));var Xr={},zl={},Jt={};Object.defineProperty(Jt,"__esModule",{value:!0});var y0=Jt.getComponentValidator=A0=Jt.getBooleanValidator=P0=Jt.getNumberArrayValidator=T0=Jt.getFunctionValidator=E0=Jt.getStringOrGradientValidator=k0=Jt.getStringValidator=C0=Jt.getNumberOrAutoValidator=S0=Jt.getNumberOrArrayOfNumbersValidator=x0=Jt.getNumberValidator=w0=Jt.alphaComponent=b0=Jt.RGBComponent=void 0;const li=Ot,ie=ee;function hi(i){return ie.Util._isString(i)?'"'+i+'"':Object.prototype.toString.call(i)==="[object Number]"||ie.Util._isBoolean(i)?i:Object.prototype.toString.call(i)}function v3(i){return i>255?255:i<0?0:Math.round(i)}var b0=Jt.RGBComponent=v3;function _3(i){return i>1?1:i<1e-4?1e-4:i}var w0=Jt.alphaComponent=_3;function y3(){if(li.Konva.isUnminified)return function(i,t){return ie.Util._isNumber(i)||ie.Util.warn(hi(i)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),i}}var x0=Jt.getNumberValidator=y3;function b3(i){if(li.Konva.isUnminified)return function(t,e){let n=ie.Util._isNumber(t),r=ie.Util._isArray(t)&&t.length==i;return!n&&!r&&ie.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or Array<number>('+i+")"),t}}var S0=Jt.getNumberOrArrayOfNumbersValidator=b3;function w3(){if(li.Konva.isUnminified)return function(i,t){var e=ie.Util._isNumber(i),n=i==="auto";return e||n||ie.Util.warn(hi(i)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),i}}var C0=Jt.getNumberOrAutoValidator=w3;function x3(){if(li.Konva.isUnminified)return function(i,t){return ie.Util._isString(i)||ie.Util.warn(hi(i)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),i}}var k0=Jt.getStringValidator=x3;function S3(){if(li.Konva.isUnminified)return function(i,t){const e=ie.Util._isString(i),n=Object.prototype.toString.call(i)==="[object CanvasGradient]"||i&&i.addColorStop;return e||n||ie.Util.warn(hi(i)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),i}}var E0=Jt.getStringOrGradientValidator=S3;function C3(){if(li.Konva.isUnminified)return function(i,t){return ie.Util._isFunction(i)||ie.Util.warn(hi(i)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),i}}var T0=Jt.getFunctionValidator=C3;function k3(){if(li.Konva.isUnminified)return function(i,t){const e=Int8Array?Object.getPrototypeOf(Int8Array):null;return e&&i instanceof e||(ie.Util._isArray(i)?i.forEach(function(n){ie.Util._isNumber(n)||ie.Util.warn('"'+t+'" attribute has non numeric element '+n+". Make sure that all elements are numbers.")}):ie.Util.warn(hi(i)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),i}}var P0=Jt.getNumberArrayValidator=k3;function E3(){if(li.Konva.isUnminified)return function(i,t){var e=i===!0||i===!1;return e||ie.Util.warn(hi(i)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),i}}var A0=Jt.getBooleanValidator=E3;function T3(i){if(li.Konva.isUnminified)return function(t,e){return t==null||ie.Util.isObject(t)||ie.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be an object with properties '+i),t}}y0=Jt.getComponentValidator=T3;const Ft=St(wt({__proto__:null,get RGBComponent(){return b0},get alphaComponent(){return w0},default:Jt,get getBooleanValidator(){return A0},get getComponentValidator(){return y0},get getFunctionValidator(){return T0},get getNumberArrayValidator(){return P0},get getNumberOrArrayOfNumbersValidator(){return S0},get getNumberOrAutoValidator(){return C0},get getNumberValidator(){return x0},get getStringOrGradientValidator(){return E0},get getStringValidator(){return k0}},[Jt]));(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Factory=void 0;const t=ee,e=Ft;var n="get",r="set";i.Factory={addGetterSetter(s,a,o,l,h){i.Factory.addGetter(s,a,o),i.Factory.addSetter(s,a,l,h),i.Factory.addOverloadedGetterSetter(s,a)},addGetter(s,a,o){var l=n+t.Util._capitalize(a);s.prototype[l]=s.prototype[l]||function(){var h=this.attrs[a];return h===void 0?o:h}},addSetter(s,a,o,l){var h=r+t.Util._capitalize(a);s.prototype[h]||i.Factory.overWriteSetter(s,a,o,l)},overWriteSetter(s,a,o,l){var h=r+t.Util._capitalize(a);s.prototype[h]=function(c){return o&&c!==void 0&&c!==null&&(c=o.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(s,a,o,l,h){var c=o.length,d=t.Util._capitalize,f=n+d(a),u=r+d(a),g,m;s.prototype[f]=function(){var x={};for(g=0;g<c;g++)m=o[g],x[m]=this.getAttr(a+d(m));return x};var y=(0,e.getComponentValidator)(o);s.prototype[u]=function(x){var C=this.attrs[a],v;l&&(x=l.call(this,x)),y&&y.call(this,x,a);for(v in x)x.hasOwnProperty(v)&&this._setAttr(a+d(v),x[v]);return x||o.forEach(b=>{this._setAttr(a+d(b),void 0)}),this._fireChangeEvent(a,C,x),h&&h.call(this),this},i.Factory.addOverloadedGetterSetter(s,a)},addOverloadedGetterSetter(s,a){var o=t.Util._capitalize(a),l=r+o,h=n+o;s.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[h]()}},addDeprecatedGetterSetter(s,a,o,l){t.Util.error("Adding deprecated "+a);var h=n+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";s.prototype[h]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?o:d},i.Factory.addSetter(s,a,l,function(){t.Util.error(c)}),i.Factory.addOverloadedGetterSetter(s,a)},backCompat(s,a){t.Util.each(a,function(o,l){var h=s.prototype[l],c=n+t.Util._capitalize(o),d=r+t.Util._capitalize(o);function f(){h.apply(this,arguments),t.Util.error('"'+o+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}s.prototype[o]=f,s.prototype[c]=f,s.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(zl);const It=St(wt({__proto__:null,default:Pe(zl)},[zl]));var ci={},ui={};Object.defineProperty(ui,"__esModule",{value:!0});var M0=ui.HitContext=O0=ui.SceneContext=I0=ui.Context=void 0;const R0=ee,P3=Ot;function A3(i){var t=[],e=i.length,n=R0.Util,r,s;for(r=0;r<e;r++)s=i[r],n._isNumber(s)?s=Math.round(s*1e3)/1e3:n._isString(s)||(s=s+""),t.push(s);return t}var L0=",",M3="(",R3=")",L3="([",D3="])",I3=";",O3="()",F3="=",D0=["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"],N3=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const U3=100;class Ia{constructor(t){this.canvas=t,P3.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 n=this.traceArr,r=n.length,s="",a,o,l,h;for(a=0;a<r;a++)o=n[a],l=o.method,l?(h=o.args,s+=l,t?s+=O3:R0.Util._isArray(h[0])?s+=L3+h.join(L0)+D3:(e&&(h=h.map(c=>typeof c=="number"?Math.floor(c):c)),s+=M3+h.join(L0)+R3)):(s+=o.property,t||(s+=F3+o.val)),s+=I3;return s}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr,n;e.push(t),n=e.length,n>=U3&&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,n,r,s,a){this._context.arc(t,e,n,r,s,a)}arcTo(t,e,n,r,s){this._context.arcTo(t,e,n,r,s)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,n,r,s,a){this._context.bezierCurveTo(t,e,n,r,s,a)}clearRect(t,e,n,r){this._context.clearRect(t,e,n,r)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var n=arguments;if(n.length===2)return this._context.createImageData(t,e);if(n.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,n,r){return this._context.createLinearGradient(t,e,n,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,n,r,s,a){return this._context.createRadialGradient(t,e,n,r,s,a)}drawImage(t,e,n,r,s,a,o,l,h){var c=arguments,d=this._context;c.length===3?d.drawImage(t,e,n):c.length===5?d.drawImage(t,e,n,r,s):c.length===9&&d.drawImage(t,e,n,r,s,a,o,l,h)}ellipse(t,e,n,r,s,a,o,l){this._context.ellipse(t,e,n,r,s,a,o,l)}isPointInPath(t,e,n,r){return n?this._context.isPointInPath(n,t,e,r):this._context.isPointInPath(t,e,r)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,n,r){this._context.fillRect(t,e,n,r)}strokeRect(t,e,n,r){this._context.strokeRect(t,e,n,r)}fillText(t,e,n,r){r?this._context.fillText(t,e,n,r):this._context.fillText(t,e,n)}measureText(t){return this._context.measureText(t)}getImageData(t,e,n,r){return this._context.getImageData(t,e,n,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,n,r){this._context.rect(t,e,n,r)}putImageData(t,e,n){this._context.putImageData(t,e,n)}quadraticCurveTo(t,e,n,r){this._context.quadraticCurveTo(t,e,n,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,n,r,s,a){this._context.setTransform(t,e,n,r,s,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,n,r){this._context.strokeText(t,e,n,r)}transform(t,e,n,r,s,a){this._context.transform(t,e,n,r,s,a)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t=this,e=D0.length,n=this.setAttr,r,s,a=function(o){var l=t[o],h;t[o]=function(){return s=A3(Array.prototype.slice.call(arguments,0)),h=l.apply(t,arguments),t._trace({method:o,args:s}),h}};for(r=0;r<e;r++)a(D0[r]);t.setAttr=function(){n.apply(t,arguments);var o=arguments[0],l=arguments[1];(o==="shadowOffsetX"||o==="shadowOffsetY"||o==="shadowBlur")&&(l=l/this.canvas.getPixelRatio()),t._trace({property:o,val:l})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;var n=!e||e==="source-over";n||this.setAttr("globalCompositeOperation",e)}}var I0=ui.Context=Ia;N3.forEach(function(i){Object.defineProperty(Ia.prototype,i,{get(){return this._context[i]},set(t){this._context[i]=t}})});class G3 extends Ia{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(),n=t.getFillPriority();if(e&&n==="color"){this._fillColor(t);return}const r=t.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(t);return}const s=t.getFillLinearGradientColorStops();if(s&&n==="linear-gradient"){this._fillLinearGradient(t);return}const a=t.getFillRadialGradientColorStops();if(a&&n==="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(),n=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(e.x,e.y,n.x,n.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(),n=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!n){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),n||this.restore()}}_applyShadow(t){var e,n,r,s=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",a=(n=t.getShadowBlur())!==null&&n!==void 0?n:5,o=(r=t.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},l=t.getAbsoluteScale(),h=this.canvas.getPixelRatio(),c=l.x*h,d=l.y*h;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 O0=ui.SceneContext=G3;class B3 extends Ia{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 n=t.hitStrokeWidth(),r=n==="auto"?t.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),s||this.restore()}}}M0=ui.HitContext=B3;const F0=St(wt({__proto__:null,get Context(){return I0},get HitContext(){return M0},get SceneContext(){return O0},default:ui},[ui]));Object.defineProperty(ci,"__esModule",{value:!0});var N0=ci.HitCanvas=$0=ci.SceneCanvas=B0=ci.Canvas=void 0;const Oa=ee,U0=F0,G0=Ot,$3=It,z3=Ft;var Fa;function j3(){if(Fa)return Fa;var i=Oa.Util.createCanvasElement(),t=i.getContext("2d");return Fa=function(){var e=G0.Konva._global.devicePixelRatio||1,n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/n}(),Oa.Util.releaseCanvas(i),Fa}class Na{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=t||{},n=e.pixelRatio||G0.Konva.pixelRatio||j3();this.pixelRatio=n,this._canvas=Oa.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,n=this.getContext()._context;n.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio,n=this.getContext()._context;n.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 Oa.Util.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}var B0=ci.Canvas=Na;$3.Factory.addGetterSetter(Na,"pixelRatio",void 0,(0,z3.getNumberValidator)());class H3 extends Na{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new U0.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}var $0=ci.SceneCanvas=H3;class V3 extends Na{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new U0.HitContext(this),this.setSize(t.width,t.height)}}N0=ci.HitCanvas=V3;const Ua=St(wt({__proto__:null,get Canvas(){return B0},get HitCanvas(){return N0},get SceneCanvas(){return $0},default:ci},[ci]));var jl={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.DD=void 0;const t=Ot,e=ee;i.DD={get isDragging(){var n=!1;return i.DD._dragElements.forEach(r=>{r.dragStatus==="dragging"&&(n=!0)}),n},justDragged:!1,get node(){var n;return i.DD._dragElements.forEach(r=>{n=r.node}),n},_dragElements:new Map,_drag(n){const r=[];i.DD._dragElements.forEach((s,a)=>{const{node:o}=s,l=o.getStage();l.setPointersPositions(n),s.pointerId===void 0&&(s.pointerId=e.Util._getFirstPointerId(n));const h=l._changedPointerPositions.find(f=>f.id===s.pointerId);if(h){if(s.dragStatus!=="dragging"){var c=o.dragDistance(),d=Math.max(Math.abs(h.x-s.startPointerPos.x),Math.abs(h.y-s.startPointerPos.y));if(d<c||(o.startDrag({evt:n}),!o.isDragging()))return}o._setDragPosition(n,s),r.push(o)}}),r.forEach(s=>{s.fire("dragmove",{type:"dragmove",target:s,evt:n},!0)})},_endDragBefore(n){const r=[];i.DD._dragElements.forEach(s=>{const{node:a}=s,o=a.getStage();if(n&&o.setPointersPositions(n),!o._changedPointerPositions.find(c=>c.id===s.pointerId))return;(s.dragStatus==="dragging"||s.dragStatus==="stopped")&&(i.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,s.dragStatus="stopped");const h=s.node.getLayer()||s.node instanceof t.Konva.Stage&&s.node;h&&r.indexOf(h)===-1&&r.push(h)}),r.forEach(s=>{s.draw()})},_endDragAfter(n){i.DD._dragElements.forEach((r,s)=>{r.dragStatus==="stopped"&&r.node.fire("dragend",{type:"dragend",target:r.node,evt:n},!0),r.dragStatus!=="dragging"&&i.DD._dragElements.delete(s)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",i.DD._endDragBefore,!0),window.addEventListener("touchend",i.DD._endDragBefore,!0),window.addEventListener("mousemove",i.DD._drag),window.addEventListener("touchmove",i.DD._drag),window.addEventListener("mouseup",i.DD._endDragAfter,!1),window.addEventListener("touchend",i.DD._endDragAfter,!1))})(jl);const Hl=St(wt({__proto__:null,default:Pe(jl)},[jl]));Object.defineProperty(Xr,"__esModule",{value:!0});var z0=Xr.Node=void 0;const Ut=ee,Yr=It,Ga=Ua,nn=Ot,Be=Hl,ae=Ft;var Ba="absoluteOpacity",$a="allEventListeners",fi="absoluteTransform",j0="absoluteScale",rn="canvas",q3="Change",X3="children",Y3="konva",Vl="listening",H0="mouseenter",V0="mouseleave",q0="set",X0="Shape",za=" ",Y0="stage",Pi="transform",W3="Stage",ql="visible",K3=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(za);let Z3=1,Mt=class Uh{constructor(t){this._id=Z3++,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===Pi||t===fi)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){var n=this._cache.get(t),r=t===Pi||t===fi,s=n===void 0||r&&n.dirty===!0;return s&&(n=e.call(this),this._cache.set(t,n)),n}_calculate(t,e,n){if(!this._attachedDepsListeners.get(t)){const r=e.map(s=>s+"Change.konva").join(za);this.on(r,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,n)}_getCanvasCache(){return this._cache.get(rn)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===fi&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(rn)){const{scene:t,filter:e,hit:n}=this._cache.get(rn);Ut.Util.releaseCanvas(t,e,n),this._cache.delete(rn)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},n={};(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var r=Math.ceil(e.width||n.width),s=Math.ceil(e.height||n.height),a=e.pixelRatio,o=e.x===void 0?Math.floor(n.x):e.x,l=e.y===void 0?Math.floor(n.y):e.y,h=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+=h*2+1,s+=h*2+1,o-=h,l-=h;var f=new Ga.SceneCanvas({pixelRatio:a,width:r,height:s}),u=new Ga.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),g=new Ga.HitCanvas({pixelRatio:d,width:r,height:s}),m=f.getContext(),y=g.getContext();return g.isCache=!0,f.isCache=!0,this._cache.delete(rn),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),m.save(),y.save(),m.translate(-o,-l),y.translate(-o,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Ba),this._clearSelfAndDescendantCache(j0),this.drawScene(f,this),this.drawHit(g,this),this._isUnderCache=!1,m.restore(),y.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,r,s),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(rn,{scene:f,filter:u,hit:g,x:o,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(rn)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var n=[{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,l=this.getAbsoluteTransform(e);return n.forEach(function(h){var c=l.point(h);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 n=this._getCachedSceneCanvas(),r=n.pixelRatio;t.drawImage(n._canvas,0,0,n.width/r,n.height/r),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),n=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),e=this._getCanvasCache(),n=e.scene,r=e.filter,s=r.getContext(),a,o,l,h;if(t){if(!this._filterUpToDate){var c=n.pixelRatio;r.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio);try{for(a=t.length,s.clear(),s.drawImage(n._canvas,0,0,n.getWidth()/c,n.getHeight()/c),o=s.getImageData(0,0,r.getWidth(),r.getHeight()),l=0;l<a;l++){if(h=t[l],typeof h!="function"){Ut.Util.error("Filter should be type of function, but got "+typeof h+" instead. Please check correct filters");continue}h.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 n}on(t,e){if(this._cache&&this._cache.delete($a),arguments.length===3)return this._delegate.apply(this,arguments);var n=t.split(za),r=n.length,s,a,o,l,h;for(s=0;s<r;s++)a=n[s],o=a.split("."),l=o[0],h=o[1]||"",this.eventListeners[l]||(this.eventListeners[l]=[]),this.eventListeners[l].push({name:h,handler:e});return this}off(t,e){var n=(t||"").split(za),r=n.length,s,a,o,l,h,c;if(this._cache&&this._cache.delete($a),!t)for(a in this.eventListeners)this._off(a);for(s=0;s<r;s++)if(o=n[s],l=o.split("."),h=l[0],c=l[1],h)this.eventListeners[h]&&this._off(h,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(n){e.call(this,n.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,n){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],n.call(a[o],s)})}remove(){return this.isDragging()&&this.stopDrag(),Be.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(fi),this._clearSelfAndDescendantCache(Ba),this._clearSelfAndDescendantCache(j0),this._clearSelfAndDescendantCache(Y0),this._clearSelfAndDescendantCache(ql),this._clearSelfAndDescendantCache(Vl)}_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,n;if(!t)return this;for(e in t)e!==X3&&(n=q0+Ut.Util._capitalize(e),Ut.Util._isFunction(this[n])?this[n](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(Vl,this._isListening)}_isListening(t){if(!this.listening())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isListening(t):!0}isVisible(){return this._getCache(ql,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var n=this.getLayer(),r=!1;Be.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===n)&&(r=!0)});var s=!e&&!nn.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,n=0,r,s,a,o;function l(c){for(r=[],s=c.length,a=0;a<s;a++)o=c[a],n++,o.nodeType!==X0&&(r=r.concat(o.getChildren().slice())),o._id===e._id&&(a=s);r.length>0&&r[0].getDepth()<=t&&l(r)}const h=this.getStage();return e.nodeType!==W3&&h&&l(h.getChildren()),n}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(Pi),this._clearSelfAndDescendantCache(fi)),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 n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(t){let e=!1,n=this.parent;for(;n;){if(n.isCached()){e=!0;break}n=n.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:n,...r}=this._clearTransform();this.attrs.x=e,this.attrs.y=n,this._clearCache(Pi);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(Pi),this._clearSelfAndDescendantCache(fi),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,n=t.y,r=this.x(),s=this.y();return e!==void 0&&(r+=e),n!==void 0&&(s+=n),this.setPosition({x:r,y:s}),this}_eachAncestorReverse(t,e){var n=[],r=this.getParent(),s,a;if(!(e&&e._id===this._id)){for(n.unshift(this);r&&(!e||r._id!==e._id);)n.unshift(r),r=r.parent;for(s=n.length,a=0;a<s;a++)t(n[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(Ba,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(),n,r,s,a,o;t.attrs={};for(n in e)r=e[n],o=Ut.Util.isObject(r)&&!Ut.Util._isPlainObject(r)&&!Ut.Util._isArray(r),!o&&(s=typeof this[n]=="function"&&this[n],delete e[n],a=s?s.call(this):null,e[n]=r,a!==r&&(t.attrs[n]=r));return t.className=this.getClassName(),Ut.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,n){var r=[];e&&this._isMatch(t)&&r.push(this);for(var s=this.parent;s;){if(s===n)return r;s._isMatch(t)&&r.push(s),s=s.parent}return r}isAncestorOf(t){return!1}findAncestor(t,e,n){return this.findAncestors(t,e,n)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var e=t.replace(/ /g,"").split(","),n=e.length,r,s;for(r=0;r<n;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(Y0,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():null}fire(t,e={},n){return e.target=e.target||this,n?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(fi,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(fi)||new Ut.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var n=this.transformsEnabled();if(n==="all")e.multiply(this.getTransform());else if(n==="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(Pi,this._getTransform)}_getTransform(){var t,e,n=this._cache.get(Pi)||new Ut.Transform;n.reset();var r=this.x(),s=this.y(),a=nn.Konva.getAngle(this.rotation()),o=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,l=(e=this.attrs.scaleY)!==null&&e!==void 0?e:1,h=this.attrs.skewX||0,c=this.attrs.skewY||0,d=this.attrs.offsetX||0,f=this.attrs.offsetY||0;return(r!==0||s!==0)&&n.translate(r,s),a!==0&&n.rotate(a),(h!==0||c!==0)&&n.skew(h,c),(o!==1||l!==1)&&n.scale(o,l),(d!==0||f!==0)&&n.translate(-1*d,-1*f),n.dirty=!1,n}clone(t){var e=Ut.Util.cloneObject(this.attrs),n,r,s,a,o;for(n in t)e[n]=t[n];var l=new this.constructor(e);for(n in this.eventListeners)for(r=this.eventListeners[n],s=r.length,a=0;a<s;a++)o=r[a],o.name.indexOf(Y3)<0&&(l.eventListeners[n]||(l.eventListeners[n]=[]),l.eventListeners[n].push(o));return l}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),n=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 Ga.SceneCanvas({width:t.width||Math.ceil(e.width)||(n?n.width():0),height:t.height||Math.ceil(e.height)||(n?n.height():0),pixelRatio:a}),l=o.getContext();return t.imageSmoothingEnabled===!1&&(l._context.imageSmoothingEnabled=!1),l.save(),(r||s)&&l.translate(-1*r,-1*s),this.drawScene(o),l.restore(),o}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};var e=t.mimeType||null,n=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,n);return t.callback&&t.callback(r),r}toImage(t){return new Promise((e,n)=>{try{const r=t?.callback;r&&delete t.callback,Ut.Util._urlToImage(this.toDataURL(t),function(s){e(s),r?.(s)})}catch(r){n(r)}})}toBlob(t){return new Promise((e,n)=>{try{const r=t?.callback;r&&delete t.callback,this.toCanvas(t).toBlob(s=>{e(s),r?.(s)})}catch(r){n(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():nn.Konva.dragDistance}_off(t,e,n){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)&&(!n||n===o)){if(r.splice(s,1),r.length===0){delete this.eventListeners[t];break}s--}}_fireChangeEvent(t,e,n){this._fire(t+q3,{oldVal:e,newVal:n})}addName(t){if(!this.hasName(t)){var e=this.name(),n=e?e+" "+t:t;this.name(n)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;var n=(e||"").split(/\s/g);return n.indexOf(t)!==-1}removeName(t){var e=(this.name()||"").split(/\s/g),n=e.indexOf(t);return n!==-1&&(e.splice(n,1),this.name(e.join(" "))),this}setAttr(t,e){var n=this[q0+Ut.Util._capitalize(t)];return Ut.Util._isFunction(n)?n.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(nn.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,e){var n=this.attrs[t];n===e&&!Ut.Util.isObject(e)||(e==null?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,n,e),this._requestDraw())}_setComponentAttr(t,e,n){var r;n!==void 0&&(r=this.attrs[t],r||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=n,this._fireChangeEvent(t,r,n))}_fireAndBubble(t,e,n){e&&this.nodeType===X0&&(e.target=this);var r=(t===H0||t===V0)&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType==="Stage"&&!n);if(!r){this._fire(t,e);var s=(t===H0||t===V0)&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!s&&(n&&n.parent?this._fireAndBubble.call(this.parent,t,e,n):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,n,r;const s=(e=this._cache.get($a))!==null&&e!==void 0?e:{};let a=s?.[t];if(a===void 0){a=[];let o=Object.getPrototypeOf(this);for(;o;){const l=(r=(n=o.eventListeners)===null||n===void 0?void 0:n[t])!==null&&r!==void 0?r:[];a.push(...l),o=Object.getPrototypeOf(o)}s[t]=a,this._cache.set($a,s)}return a}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;const n=this._getProtoListeners(t);if(n)for(var r=0;r<n.length;r++)n[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,n=this.getStage(),r=this.getAbsolutePosition();if(n){var s=n._getPointerById(e)||n._changedPointerPositions[0]||r;Be.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){Be.DD._dragElements.has(this._id)||this._createDragElement(t);const n=Be.DD._dragElements.get(this._id);n.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const n=this.getStage()._getPointerById(e.pointerId);if(n){var r={x:n.x-e.offset.x,y:n.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=Be.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),Be.DD._endDragBefore(t),Be.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Be.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,n=!e||nn.Konva.dragButtons.indexOf(t.evt.button)>=0;if(n&&!this.isDragging()){var r=!1;Be.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=Be.DD._dragElements.get(this._id),n=e&&e.dragStatus==="dragging",r=e&&e.dragStatus==="ready";n?this.stopDrag():r&&Be.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 n={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return Ut.Util.haveIntersection(n,this.getClientRect())}static create(t,e){return Ut.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var n=Uh.prototype.getClassName.call(t),r=t.children,s,a,o;e&&(t.attrs.container=e),nn.Konva[n]||(Ut.Util.warn('Can not find a node with class name "'+n+'". Fallback to "Shape".'),n="Shape");const l=nn.Konva[n];if(s=new l(t.attrs),r)for(a=r.length,o=0;o<a;o++)s.add(Uh._createNode(r[o]));return s}};z0=Xr.Node=Mt,Mt.prototype.nodeType="Node",Mt.prototype._attrsAffectingSize=[],Mt.prototype.eventListeners={},Mt.prototype.on.call(Mt.prototype,K3,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Pi),this._clearSelfAndDescendantCache(fi)}),Mt.prototype.on.call(Mt.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(ql)}),Mt.prototype.on.call(Mt.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Vl)}),Mt.prototype.on.call(Mt.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(Ba)});const Kt=Yr.Factory.addGetterSetter;Kt(Mt,"zIndex"),Kt(Mt,"absolutePosition"),Kt(Mt,"position"),Kt(Mt,"x",0,(0,ae.getNumberValidator)()),Kt(Mt,"y",0,(0,ae.getNumberValidator)()),Kt(Mt,"globalCompositeOperation","source-over",(0,ae.getStringValidator)()),Kt(Mt,"opacity",1,(0,ae.getNumberValidator)()),Kt(Mt,"name","",(0,ae.getStringValidator)()),Kt(Mt,"id","",(0,ae.getStringValidator)()),Kt(Mt,"rotation",0,(0,ae.getNumberValidator)()),Yr.Factory.addComponentsGetterSetter(Mt,"scale",["x","y"]),Kt(Mt,"scaleX",1,(0,ae.getNumberValidator)()),Kt(Mt,"scaleY",1,(0,ae.getNumberValidator)()),Yr.Factory.addComponentsGetterSetter(Mt,"skew",["x","y"]),Kt(Mt,"skewX",0,(0,ae.getNumberValidator)()),Kt(Mt,"skewY",0,(0,ae.getNumberValidator)()),Yr.Factory.addComponentsGetterSetter(Mt,"offset",["x","y"]),Kt(Mt,"offsetX",0,(0,ae.getNumberValidator)()),Kt(Mt,"offsetY",0,(0,ae.getNumberValidator)()),Kt(Mt,"dragDistance",null,(0,ae.getNumberValidator)()),Kt(Mt,"width",0,(0,ae.getNumberValidator)()),Kt(Mt,"height",0,(0,ae.getNumberValidator)()),Kt(Mt,"listening",!0,(0,ae.getBooleanValidator)()),Kt(Mt,"preventDefault",!0,(0,ae.getBooleanValidator)()),Kt(Mt,"filters",null,function(i){return this._filterUpToDate=!1,i}),Kt(Mt,"visible",!0,(0,ae.getBooleanValidator)()),Kt(Mt,"transformsEnabled","all",(0,ae.getStringValidator)()),Kt(Mt,"size"),Kt(Mt,"dragBoundFunc"),Kt(Mt,"draggable",!1,(0,ae.getBooleanValidator)()),Yr.Factory.backCompat(Mt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});const oe=St(wt({__proto__:null,get Node(){return z0},default:Xr},[Xr]));var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});var W0=Wr.Container=void 0;const Fn=It,Xl=oe,ja=Ft;class sn extends Xl.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var n=[];return e.forEach(function(r){t(r)&&n.push(r)}),n}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 n=t[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),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 n=[];return this._descendants(r=>{const s=r._isMatch(t);return s&&n.push(r),!!(s&&e)}),n}_descendants(t){let e=!1;const n=this.getChildren();for(const r of n){if(e=t(r),e)return!0;if(r.hasChildren()&&(e=r._descendants(t),e))return!0}return!1}toObject(){var t=Xl.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=Xl.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(n){e.add(n.clone())}),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(t)&&e.push(n)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),!this.isCached()&&((e=this.children)===null||e===void 0||e.forEach(function(n){n._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,n){e.index=n}),this._requestDraw()}drawScene(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas(),s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.scene,l=r&&r.isCache;if(!this.isVisible()&&!l)return this;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._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",r,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var n=this.getLayer(),r=t||n&&n.hitCanvas,s=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.hit;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._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",r,e);return this}_drawChildren(t,e,n){var r,s=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),l=this.clipFunc(),h=a&&o||l;const c=n===this;if(h){s.save();var d=this.getAbsoluteTransform(n),f=d.getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s.beginPath();let y;if(l)y=l.call(this,s,this);else{var u=this.clipX(),g=this.clipY();s.rect(u,g,a,o)}s.clip.apply(s,y),f=d.copy().invert().getMatrix(),s.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(s.save(),s._applyGlobalCompositeOperation(this)),(r=this.children)===null||r===void 0||r.forEach(function(y){y[t](e,n)}),m&&s.restore(),h&&s.restore()}getClientRect(t={}){var e,n=t.skipTransform,r=t.relativeTo,s,a,o,l,h={x:1/0,y:1/0,width:0,height:0},c=this;(e=this.children)===null||e===void 0||e.forEach(function(m){if(m.visible()){var y=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});y.width===0&&y.height===0||(s===void 0?(s=y.x,a=y.y,o=y.x+y.width,l=y.y+y.height):(s=Math.min(s,y.x),a=Math.min(a,y.y),o=Math.max(o,y.x+y.width),l=Math.max(l,y.y+y.height)))}});for(var d=this.find("Shape"),f=!1,u=0;u<d.length;u++){var g=d[u];if(g._isVisible(this)){f=!0;break}}return f&&s!==void 0?h={x:s,y:a,width:o-s,height:l-a}:h={x:0,y:0,width:0,height:0},n?h:this._transformedRect(h,r)}}W0=Wr.Container=sn,Fn.Factory.addComponentsGetterSetter(sn,"clip",["x","y","width","height"]),Fn.Factory.addGetterSetter(sn,"clipX",void 0,(0,ja.getNumberValidator)()),Fn.Factory.addGetterSetter(sn,"clipY",void 0,(0,ja.getNumberValidator)()),Fn.Factory.addGetterSetter(sn,"clipWidth",void 0,(0,ja.getNumberValidator)()),Fn.Factory.addGetterSetter(sn,"clipHeight",void 0,(0,ja.getNumberValidator)()),Fn.Factory.addGetterSetter(sn,"clipFunc");const Ha=St(wt({__proto__:null,get Container(){return W0},default:Wr},[Wr]));var Yl={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});var K0=Le.releaseCapture=ed=Le.setPointerCapture=td=Le.hasPointerCapture=Q0=Le.createEvent=J0=Le.getCapturedShape=void 0;const J3=Ot,Kr=new Map,Z0=J3.Konva._global.PointerEvent!==void 0;function Q3(i){return Kr.get(i)}var J0=Le.getCapturedShape=Q3;function Wl(i){return{evt:i,pointerId:i.pointerId}}var Q0=Le.createEvent=Wl;function t4(i,t){return Kr.get(i)===t}var td=Le.hasPointerCapture=t4;function e4(i,t){id(i),t.getStage()&&(Kr.set(i,t),Z0&&t._fire("gotpointercapture",Wl(new PointerEvent("gotpointercapture"))))}var ed=Le.setPointerCapture=e4;function id(i,t){const e=Kr.get(i);if(!e)return;const n=e.getStage();n&&n.content,Kr.delete(i),Z0&&e._fire("lostpointercapture",Wl(new PointerEvent("lostpointercapture")))}K0=Le.releaseCapture=id;const nd=St(wt({__proto__:null,get createEvent(){return Q0},default:Le,get getCapturedShape(){return J0},get hasPointerCapture(){return td},get releaseCapture(){return K0},get setPointerCapture(){return ed}},[Le]));(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Stage=i.stages=void 0;const t=ee,e=It,n=Ha,r=Ot,s=Ua,a=Hl,o=Ot,l=nd;var h="Stage",c="string",d="px",f="mouseout",u="mouseleave",g="mouseover",m="mouseenter",y="mousemove",x="mousedown",C="mouseup",v="pointermove",b="pointerdown",k="pointerup",T="pointercancel",R="lostpointercapture",A="pointerout",U="pointerleave",I="pointerover",N="pointerenter",q="contextmenu",W="touchstart",K="touchend",it="touchmove",pt="touchcancel",vt="wheel",dt=5,_t=[[m,"_pointerenter"],[x,"_pointerdown"],[y,"_pointermove"],[C,"_pointerup"],[u,"_pointerleave"],[W,"_pointerdown"],[it,"_pointermove"],[K,"_pointerup"],[pt,"_pointercancel"],[g,"_pointerover"],[vt,"_wheel"],[q,"_contextmenu"],[b,"_pointerdown"],[v,"_pointermove"],[k,"_pointerup"],[T,"_pointercancel"],[R,"_lostpointercapture"]];const yt={mouse:{[A]:f,[U]:u,[I]:g,[N]:m,[v]:y,[b]:x,[k]:C,[T]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[A]:"touchout",[U]:"touchleave",[I]:"touchover",[N]:"touchenter",[v]:it,[b]:W,[k]:K,[T]:pt,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[A]:A,[U]:U,[I]:I,[N]:N,[v]:v,[b]:b,[k]:k,[T]:T,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},L=Y=>Y.indexOf("pointer")>=0?"pointer":Y.indexOf("touch")>=0?"touch":"mouse",M=Y=>{const D=L(Y);if(D==="pointer")return r.Konva.pointerEventsEnabled&&yt.pointer;if(D==="touch")return yt.touch;if(D==="mouse")return yt.mouse};function E(Y={}){return(Y.clipFunc||Y.clipWidth||Y.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Y}const F="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);";i.stages=[];class z extends n.Container{constructor(D){super(E(D)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),i.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",()=>{E(this.attrs)}),this._checkVisibility()}_validateAdd(D){const V=D.getType()==="Layer",X=D.getType()==="FastLayer";V||X||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const D=this.visible()?"":"none";this.content.style.display=D}setContainer(D){if(typeof D===c){if(D.charAt(0)==="."){var V=D.slice(1);D=document.getElementsByClassName(V)[0]}else{var X;D.charAt(0)!=="#"?X=D:X=D.slice(1),D=document.getElementById(X)}if(!D)throw"Can not find container in document with id "+X}return this._setAttr("container",D),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),D.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var D=this.children,V=D.length,X;for(X=0;X<V;X++)D[X].clear();return this}clone(D){return D||(D={}),D.container=typeof document<"u"&&document.createElement("div"),n.Container.prototype.clone.call(this,D)}destroy(){super.destroy();var D=this.content;D&&t.Util._isInDocument(D)&&this.container().removeChild(D);var V=i.stages.indexOf(this);return V>-1&&i.stages.splice(V,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const D=this._pointerPositions[0]||this._changedPointerPositions[0];return D?{x:D.x,y:D.y}:(t.Util.warn(F),null)}_getPointerById(D){return this._pointerPositions.find(V=>V.id===D)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(D){D=D||{},D.x=D.x||0,D.y=D.y||0,D.width=D.width||this.width(),D.height=D.height||this.height();var V=new s.SceneCanvas({width:D.width,height:D.height,pixelRatio:D.pixelRatio||1}),X=V.getContext()._context,tt=this.children;return(D.x||D.y)&&X.translate(-1*D.x,-1*D.y),tt.forEach(function(at){if(at.isVisible()){var gt=at._toKonvaCanvas(D);X.drawImage(gt._canvas,D.x,D.y,gt.getWidth()/gt.getPixelRatio(),gt.getHeight()/gt.getPixelRatio())}}),V}getIntersection(D){if(!D)return null;var V=this.children,X=V.length,tt=X-1,at;for(at=tt;at>=0;at--){const gt=V[at].getIntersection(D);if(gt)return gt}return null}_resizeDOM(){var D=this.width(),V=this.height();this.content&&(this.content.style.width=D+d,this.content.style.height=V+d),this.bufferCanvas.setSize(D,V),this.bufferHitCanvas.setSize(D,V),this.children.forEach(X=>{X.setSize({width:D,height:V}),X.draw()})}add(D,...V){if(arguments.length>1){for(var X=0;X<arguments.length;X++)this.add(arguments[X]);return this}super.add(D);var tt=this.children.length;return tt>dt&&t.Util.warn("The stage has "+tt+" 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."),D.setSize({width:this.width(),height:this.height()}),D.draw(),r.Konva.isBrowser&&this.content.appendChild(D.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(D){return l.hasPointerCapture(D,this)}setPointerCapture(D){l.setPointerCapture(D,this)}releaseCapture(D){l.releaseCapture(D,this)}getLayers(){return this.children}_bindContentEvents(){r.Konva.isBrowser&&_t.forEach(([D,V])=>{this.content.addEventListener(D,X=>{this[V](X)},{passive:!1})})}_pointerenter(D){this.setPointersPositions(D);const V=M(D.type);V&&this._fire(V.pointerenter,{evt:D,target:this,currentTarget:this})}_pointerover(D){this.setPointersPositions(D);const V=M(D.type);V&&this._fire(V.pointerover,{evt:D,target:this,currentTarget:this})}_getTargetShape(D){let V=this[D+"targetShape"];return V&&!V.getStage()&&(V=null),V}_pointerleave(D){const V=M(D.type),X=L(D.type);if(V){this.setPointersPositions(D);var tt=this._getTargetShape(X),at=!a.DD.isDragging||r.Konva.hitOnDragEnabled;tt&&at?(tt._fireAndBubble(V.pointerout,{evt:D}),tt._fireAndBubble(V.pointerleave,{evt:D}),this._fire(V.pointerleave,{evt:D,target:this,currentTarget:this}),this[X+"targetShape"]=null):at&&(this._fire(V.pointerleave,{evt:D,target:this,currentTarget:this}),this._fire(V.pointerout,{evt:D,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(D){const V=M(D.type),X=L(D.type);if(V){this.setPointersPositions(D);var tt=!1;this._changedPointerPositions.forEach(at=>{var gt=this.getIntersection(at);if(a.DD.justDragged=!1,r.Konva["_"+X+"ListenClick"]=!0,!gt||!gt.isListening())return;r.Konva.capturePointerEventsEnabled&>.setPointerCapture(at.id),this[X+"ClickStartShape"]=gt,gt._fireAndBubble(V.pointerdown,{evt:D,pointerId:at.id}),tt=!0;const Ct=D.type.indexOf("touch")>=0;gt.preventDefault()&&D.cancelable&&Ct&&D.preventDefault()}),tt||this._fire(V.pointerdown,{evt:D,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(D){const V=M(D.type),X=L(D.type);if(!V)return;a.DD.isDragging&&a.DD.node.preventDefault()&&D.cancelable&&D.preventDefault(),this.setPointersPositions(D);var tt=!a.DD.isDragging||r.Konva.hitOnDragEnabled;if(!tt)return;var at={};let gt=!1;var Ct=this._getTargetShape(X);this._changedPointerPositions.forEach(Tt=>{const bt=l.getCapturedShape(Tt.id)||this.getIntersection(Tt),Nt=Tt.id,Lt={evt:D,pointerId:Nt};var Dt=Ct!==bt;if(Dt&&Ct&&(Ct._fireAndBubble(V.pointerout,{...Lt},bt),Ct._fireAndBubble(V.pointerleave,{...Lt},bt)),bt){if(at[bt._id])return;at[bt._id]=!0}bt&&bt.isListening()?(gt=!0,Dt&&(bt._fireAndBubble(V.pointerover,{...Lt},Ct),bt._fireAndBubble(V.pointerenter,{...Lt},Ct),this[X+"targetShape"]=bt),bt._fireAndBubble(V.pointermove,{...Lt})):Ct&&(this._fire(V.pointerover,{evt:D,target:this,currentTarget:this,pointerId:Nt}),this[X+"targetShape"]=null)}),gt||this._fire(V.pointermove,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(D){const V=M(D.type),X=L(D.type);if(!V)return;this.setPointersPositions(D);const tt=this[X+"ClickStartShape"],at=this[X+"ClickEndShape"];var gt={};let Ct=!1;this._changedPointerPositions.forEach(Tt=>{const bt=l.getCapturedShape(Tt.id)||this.getIntersection(Tt);if(bt){if(bt.releaseCapture(Tt.id),gt[bt._id])return;gt[bt._id]=!0}const Nt=Tt.id,Lt={evt:D,pointerId:Nt};let Dt=!1;r.Konva["_"+X+"InDblClickWindow"]?(Dt=!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),bt&&bt.isListening()?(Ct=!0,this[X+"ClickEndShape"]=bt,bt._fireAndBubble(V.pointerup,{...Lt}),r.Konva["_"+X+"ListenClick"]&&tt&&tt===bt&&(bt._fireAndBubble(V.pointerclick,{...Lt}),Dt&&at&&at===bt&&bt._fireAndBubble(V.pointerdblclick,{...Lt}))):(this[X+"ClickEndShape"]=null,r.Konva["_"+X+"ListenClick"]&&this._fire(V.pointerclick,{evt:D,target:this,currentTarget:this,pointerId:Nt}),Dt&&this._fire(V.pointerdblclick,{evt:D,target:this,currentTarget:this,pointerId:Nt}))}),Ct||this._fire(V.pointerup,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r.Konva["_"+X+"ListenClick"]=!1,D.cancelable&&X!=="touch"&&D.preventDefault()}_contextmenu(D){this.setPointersPositions(D);var V=this.getIntersection(this.getPointerPosition());V&&V.isListening()?V._fireAndBubble(q,{evt:D}):this._fire(q,{evt:D,target:this,currentTarget:this})}_wheel(D){this.setPointersPositions(D);var V=this.getIntersection(this.getPointerPosition());V&&V.isListening()?V._fireAndBubble(vt,{evt:D}):this._fire(vt,{evt:D,target:this,currentTarget:this})}_pointercancel(D){this.setPointersPositions(D);const V=l.getCapturedShape(D.pointerId)||this.getIntersection(this.getPointerPosition());V&&V._fireAndBubble(k,l.createEvent(D)),l.releaseCapture(D.pointerId)}_lostpointercapture(D){l.releaseCapture(D.pointerId)}setPointersPositions(D){var V=this._getContentPosition(),X=null,tt=null;D=D||window.event,D.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(D.touches,at=>{this._pointerPositions.push({id:at.identifier,x:(at.clientX-V.left)/V.scaleX,y:(at.clientY-V.top)/V.scaleY})}),Array.prototype.forEach.call(D.changedTouches||D.touches,at=>{this._changedPointerPositions.push({id:at.identifier,x:(at.clientX-V.left)/V.scaleX,y:(at.clientY-V.top)/V.scaleY})})):(X=(D.clientX-V.left)/V.scaleX,tt=(D.clientY-V.top)/V.scaleY,this.pointerPos={x:X,y:tt},this._pointerPositions=[{x:X,y:tt,id:t.Util._getFirstPointerId(D)}],this._changedPointerPositions=[{x:X,y:tt,id:t.Util._getFirstPointerId(D)}])}_setPointerPosition(D){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(D)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var D=this.content.getBoundingClientRect();return{top:D.top,left:D.left,scaleX:D.width/this.content.clientWidth||1,scaleY:D.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 D=this.container();if(!D)throw"Stage has no container. A container is required.";D.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"),D.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(D){D.batchDraw()}),this}}i.Stage=z,z.prototype.nodeType=h,(0,o._registerNode)(z),e.Factory.addGetterSetter(z,"container")})(Yl);const i4=St(wt({__proto__:null,default:Pe(Yl)},[Yl]));var Zr={},Kl={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Shape=i.shapes=void 0;const t=Ot,e=ee,n=It,r=oe,s=Ft,a=Ot,o=nd;var l="hasShadow",h="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let u;function g(){return u||(u=e.Util.createCanvasElement().getContext("2d"),u)}i.shapes={};function m(U){const I=this.attrs.fillRule;I?U.fill(I):U.fill()}function y(U){U.stroke()}function x(U){U.fill()}function C(U){U.stroke()}function v(){this._clearCache(l)}function b(){this._clearCache(h)}function k(){this._clearCache(c)}function T(){this._clearCache(d)}function R(){this._clearCache(f)}class A extends r.Node{constructor(I){super(I);let N;for(;N=e.Util.getRandomColor(),!(N&&!(N in i.shapes)););this.colorKey=N,i.shapes[N]=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(l,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 I=g();const N=I.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(N&&N.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 W=q.getMatrix(),K=typeof DOMMatrix>"u"?{a:W[0],b:W[1],c:W[2],d:W[3],e:W[4],f:W[5]}:new DOMMatrix(W);N.setTransform(K)}return N}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var I=this.fillLinearGradientColorStops();if(I){for(var N=g(),q=this.fillLinearGradientStartPoint(),W=this.fillLinearGradientEndPoint(),K=N.createLinearGradient(q.x,q.y,W.x,W.y),it=0;it<I.length;it+=2)K.addColorStop(I[it],I[it+1]);return K}}_getRadialGradient(){return this._getCache(f,this.__getRadialGradient)}__getRadialGradient(){var I=this.fillRadialGradientColorStops();if(I){for(var N=g(),q=this.fillRadialGradientStartPoint(),W=this.fillRadialGradientEndPoint(),K=N.createRadialGradient(q.x,q.y,this.fillRadialGradientStartRadius(),W.x,W.y,this.fillRadialGradientEndRadius()),it=0;it<I.length;it+=2)K.addColorStop(I[it],I[it+1]);return K}}getShadowRGBA(){return this._getCache(h,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var I=e.Util.colorToRGBA(this.shadowColor());if(I)return"rgba("+I.r+","+I.g+","+I.b+","+I.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 I=this.hitStrokeWidth();return I==="auto"?this.hasStroke():this.strokeEnabled()&&!!I}intersects(I){var N=this.getStage();if(!N)return!1;const q=N.bufferHitCanvas;return q.getContext().clear(),this.drawHit(q,void 0,!0),q.context.getImageData(Math.round(I.x),Math.round(I.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete i.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(I){var N;if(!this.getStage()||!((N=this.attrs.perfectDrawEnabled)!==null&&N!==void 0?N:!0))return!1;const W=I||this.hasFill(),K=this.hasStroke(),it=this.getAbsoluteOpacity()!==1;if(W&&K&&it)return!0;const pt=this.hasShadow(),vt=this.shadowForStrokeEnabled();return!!(W&&K&&pt&&vt)}setStrokeHitEnabled(I){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),I?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var I=this.size();return{x:this._centroid?-I.width/2:0,y:this._centroid?-I.height/2:0,width:I.width,height:I.height}}getClientRect(I={}){const N=I.skipTransform,q=I.relativeTo,W=this.getSelfRect(),it=!I.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,pt=W.width+it,vt=W.height+it,dt=!I.skipShadow&&this.hasShadow(),_t=dt?this.shadowOffsetX():0,yt=dt?this.shadowOffsetY():0,L=pt+Math.abs(_t),M=vt+Math.abs(yt),E=dt&&this.shadowBlur()||0,F=L+E*2,z=M+E*2,Y={width:F,height:z,x:-(it/2+E)+Math.min(_t,0)+W.x,y:-(it/2+E)+Math.min(yt,0)+W.y};return N?Y:this._transformedRect(Y,q)}drawScene(I,N){var q=this.getLayer(),W=I||q.getCanvas(),K=W.getContext(),it=this._getCanvasCache(),pt=this.getSceneFunc(),vt=this.hasShadow(),dt,_t,yt,L=W.isCache,M=N===this;if(!this.isVisible()&&!M)return this;if(it){K.save();var E=this.getAbsoluteTransform(N).getMatrix();return K.transform(E[0],E[1],E[2],E[3],E[4],E[5]),this._drawCachedSceneCanvas(K),K.restore(),this}if(!pt)return this;if(K.save(),this._useBufferCanvas()&&!L){dt=this.getStage(),_t=dt.bufferCanvas,yt=_t.getContext(),yt.clear(),yt.save(),yt._applyLineJoin(this);var F=this.getAbsoluteTransform(N).getMatrix();yt.transform(F[0],F[1],F[2],F[3],F[4],F[5]),pt.call(this,yt,this),yt.restore();var z=_t.pixelRatio;vt&&K._applyShadow(this),K._applyOpacity(this),K._applyGlobalCompositeOperation(this),K.drawImage(_t._canvas,0,0,_t.width/z,_t.height/z)}else{if(K._applyLineJoin(this),!M){var F=this.getAbsoluteTransform(N).getMatrix();K.transform(F[0],F[1],F[2],F[3],F[4],F[5]),K._applyOpacity(this),K._applyGlobalCompositeOperation(this)}vt&&K._applyShadow(this),pt.call(this,K,this)}return K.restore(),this}drawHit(I,N,q=!1){if(!this.shouldDrawHit(N,q))return this;var W=this.getLayer(),K=I||W.hitCanvas,it=K&&K.getContext(),pt=this.hitFunc()||this.sceneFunc(),vt=this._getCanvasCache(),dt=vt&&vt.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()"),dt){it.save();var _t=this.getAbsoluteTransform(N).getMatrix();return it.transform(_t[0],_t[1],_t[2],_t[3],_t[4],_t[5]),this._drawCachedHitCanvas(it),it.restore(),this}if(!pt)return this;if(it.save(),it._applyLineJoin(this),!(this===N)){var L=this.getAbsoluteTransform(N).getMatrix();it.transform(L[0],L[1],L[2],L[3],L[4],L[5])}return pt.call(this,it,this),it.restore(),this}drawHitFromCache(I=0){var N=this._getCanvasCache(),q=this._getCachedSceneCanvas(),W=N.hit,K=W.getContext(),it=W.getWidth(),pt=W.getHeight(),vt,dt,_t,yt,L,M;K.clear(),K.drawImage(q._canvas,0,0,it,pt);try{for(vt=K.getImageData(0,0,it,pt),dt=vt.data,_t=dt.length,yt=e.Util._hexToRgb(this.colorKey),L=0;L<_t;L+=4)M=dt[L+3],M>I?(dt[L]=yt.r,dt[L+1]=yt.g,dt[L+2]=yt.b,dt[L+3]=255):dt[L+3]=0;K.putImageData(vt,0,0)}catch(E){e.Util.error("Unable to draw hit graph from cached scene canvas. "+E.message)}return this}hasPointerCapture(I){return o.hasPointerCapture(I,this)}setPointerCapture(I){o.setPointerCapture(I,this)}releaseCapture(I){o.releaseCapture(I,this)}}i.Shape=A,A.prototype._fillFunc=m,A.prototype._strokeFunc=y,A.prototype._fillFuncHit=x,A.prototype._strokeFuncHit=C,A.prototype._centroid=!1,A.prototype.nodeType="Shape",(0,a._registerNode)(A),A.prototype.eventListeners={},A.prototype.on.call(A.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",v),A.prototype.on.call(A.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),A.prototype.on.call(A.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",k),A.prototype.on.call(A.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",T),A.prototype.on.call(A.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",R),n.Factory.addGetterSetter(A,"stroke",void 0,(0,s.getStringOrGradientValidator)()),n.Factory.addGetterSetter(A,"strokeWidth",2,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"fillAfterStrokeEnabled",!1),n.Factory.addGetterSetter(A,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),n.Factory.addGetterSetter(A,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(A,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(A,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),n.Factory.addGetterSetter(A,"lineJoin"),n.Factory.addGetterSetter(A,"lineCap"),n.Factory.addGetterSetter(A,"sceneFunc"),n.Factory.addGetterSetter(A,"hitFunc"),n.Factory.addGetterSetter(A,"dash"),n.Factory.addGetterSetter(A,"dashOffset",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"shadowColor",void 0,(0,s.getStringValidator)()),n.Factory.addGetterSetter(A,"shadowBlur",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"shadowOpacity",1,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(A,"shadowOffset",["x","y"]),n.Factory.addGetterSetter(A,"shadowOffsetX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"shadowOffsetY",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"fillPatternImage"),n.Factory.addGetterSetter(A,"fill",void 0,(0,s.getStringOrGradientValidator)()),n.Factory.addGetterSetter(A,"fillPatternX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"fillPatternY",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"fillLinearGradientColorStops"),n.Factory.addGetterSetter(A,"strokeLinearGradientColorStops"),n.Factory.addGetterSetter(A,"fillRadialGradientStartRadius",0),n.Factory.addGetterSetter(A,"fillRadialGradientEndRadius",0),n.Factory.addGetterSetter(A,"fillRadialGradientColorStops"),n.Factory.addGetterSetter(A,"fillPatternRepeat","repeat"),n.Factory.addGetterSetter(A,"fillEnabled",!0),n.Factory.addGetterSetter(A,"strokeEnabled",!0),n.Factory.addGetterSetter(A,"shadowEnabled",!0),n.Factory.addGetterSetter(A,"dashEnabled",!0),n.Factory.addGetterSetter(A,"strokeScaleEnabled",!0),n.Factory.addGetterSetter(A,"fillPriority","color"),n.Factory.addComponentsGetterSetter(A,"fillPatternOffset",["x","y"]),n.Factory.addGetterSetter(A,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(A,"fillPatternScale",["x","y"]),n.Factory.addGetterSetter(A,"fillPatternScaleX",1,(0,s.getNumberValidator)()),n.Factory.addGetterSetter(A,"fillPatternScaleY",1,(0,s.getNumberValidator)()),n.Factory.addComponentsGetterSetter(A,"fillLinearGradientStartPoint",["x","y"]),n.Factory.addComponentsGetterSetter(A,"strokeLinearGradientStartPoint",["x","y"]),n.Factory.addGetterSetter(A,"fillLinearGradientStartPointX",0),n.Factory.addGetterSetter(A,"strokeLinearGradientStartPointX",0),n.Factory.addGetterSetter(A,"fillLinearGradientStartPointY",0),n.Factory.addGetterSetter(A,"strokeLinearGradientStartPointY",0),n.Factory.addComponentsGetterSetter(A,"fillLinearGradientEndPoint",["x","y"]),n.Factory.addComponentsGetterSetter(A,"strokeLinearGradientEndPoint",["x","y"]),n.Factory.addGetterSetter(A,"fillLinearGradientEndPointX",0),n.Factory.addGetterSetter(A,"strokeLinearGradientEndPointX",0),n.Factory.addGetterSetter(A,"fillLinearGradientEndPointY",0),n.Factory.addGetterSetter(A,"strokeLinearGradientEndPointY",0),n.Factory.addComponentsGetterSetter(A,"fillRadialGradientStartPoint",["x","y"]),n.Factory.addGetterSetter(A,"fillRadialGradientStartPointX",0),n.Factory.addGetterSetter(A,"fillRadialGradientStartPointY",0),n.Factory.addComponentsGetterSetter(A,"fillRadialGradientEndPoint",["x","y"]),n.Factory.addGetterSetter(A,"fillRadialGradientEndPointX",0),n.Factory.addGetterSetter(A,"fillRadialGradientEndPointY",0),n.Factory.addGetterSetter(A,"fillPatternRotation",0),n.Factory.addGetterSetter(A,"fillRule",void 0,(0,s.getStringValidator)()),n.Factory.backCompat(A,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Kl);const pe=St(wt({__proto__:null,default:Pe(Kl)},[Kl]));Object.defineProperty(Zr,"__esModule",{value:!0});var rd=Zr.Layer=void 0;const di=ee,Zl=Ha,Nn=oe,Jl=It,sd=Ua,n4=Ft,r4=pe,s4=Ot;var a4="#",o4="beforeDraw",l4="draw",ad=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],h4=ad.length;class Un extends Zl.Container{constructor(t){super(t),this.canvas=new sd.SceneCanvas,this.hitCanvas=new sd.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(){Nn.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=Nn.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(Nn.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(Nn.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 Nn.Node.prototype.remove.call(this),t&&t.parentNode&&di.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"&&di.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(),Nn.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(){di.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){di.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,di.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,n=!1;;){for(let r=0;r<h4;r++){const s=ad[r],a=this._getIntersection({x:t.x+s.x*e,y:t.y+s.y*e}),o=a.shape;if(o)return o;if(n=!!a.antialiased,!a.antialiased)break}if(n)e+=1;else return null}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=n[3];if(r===255){const s=di.Util._rgbToHex(n[0],n[1],n[2]),a=r4.shapes[a4+s];return a?{shape:a}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas();return this._fire(o4,{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Zl.Container.prototype.drawScene.call(this,r,e),this._fire(l4,{node:this}),this}drawHit(t,e){var n=this.getLayer(),r=t||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Zl.Container.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){di.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return di.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 di.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}rd=Zr.Layer=Un,Un.prototype.nodeType="Layer",(0,s4._registerNode)(Un),Jl.Factory.addGetterSetter(Un,"imageSmoothingEnabled",!0),Jl.Factory.addGetterSetter(Un,"clearBeforeDraw",!0),Jl.Factory.addGetterSetter(Un,"hitGraphEnabled",!0,(0,n4.getBooleanValidator)());const od=St(wt({__proto__:null,get Layer(){return rd},default:Zr},[Zr]));var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0});var ld=Jr.FastLayer=void 0;const c4=ee,u4=od,f4=Ot;class Ql extends u4.Layer{constructor(t){super(t),this.listening(!1),c4.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}ld=Jr.FastLayer=Ql,Ql.prototype.nodeType="FastLayer",(0,f4._registerNode)(Ql);const d4=St(wt({__proto__:null,get FastLayer(){return ld},default:Jr},[Jr]));var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});var hd=Qr.Group=void 0;const g4=ee,p4=Ha,m4=Ot;class th extends p4.Container{_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&g4.Util.throw("You may only add groups and shapes to groups.")}}hd=Qr.Group=th,th.prototype.nodeType="Group",(0,m4._registerNode)(th);const eh=St(wt({__proto__:null,get Group(){return hd},default:Qr},[Qr]));var ts={};Object.defineProperty(ts,"__esModule",{value:!0});var cd=ts.Animation=void 0;const ih=Ot,ud=ee,nh=function(){return ih.glob.performance&&ih.glob.performance.now?function(){return ih.glob.performance.now()}:function(){return new Date().getTime()}}();class Ze{constructor(t,e){this.id=Ze.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:nh(),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,n=e.length;for(let r=0;r<n;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=Ze.animations,n=e.length;for(let r=0;r<n;r++)if(e[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=nh(),Ze._addAnimation(this),this}stop(){return Ze._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,n=this.animations,r=n.length;for(let s=0;s<r;s++)if(n[s].id===e){this.animations.splice(s,1);break}}static _runFrames(){const t={},e=this.animations;for(let n=0;n<e.length;n++){const r=e[n],s=r.layers,a=r.func;r._updateFrameObject(nh());const o=s.length;let l;if(a?l=a.call(r,r.frame)!==!1:l=!0,!!l)for(let h=0;h<o;h++){const c=s[h];c._id!==void 0&&(t[c._id]=c)}}for(let n in t)t.hasOwnProperty(n)&&t[n].batchDraw()}static _animationLoop(){const t=Ze;t.animations.length?(t._runFrames(),ud.Util.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,ud.Util.requestAnimFrame(this._animationLoop))}}cd=ts.Animation=Ze,Ze.animations=[],Ze.animIdCounter=0,Ze.animRunning=!1;const rh=St(wt({__proto__:null,get Animation(){return cd},default:ts},[ts]));var sh={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Easings=i.Tween=void 0;const t=ee,e=rh,n=oe,r=Ot;var s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},a=1,o=2,l=3,h=0,c=["fill","stroke","shadowColor"];class d{constructor(g,m,y,x,C,v,b){this.prop=g,this.propFunc=m,this.begin=x,this._pos=x,this.duration=v,this._change=0,this.prevPos=0,this.yoyo=b,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=y,this._change=C-this.begin,this.pause()}fire(g){var m=this[g];m&&m()}setTime(g){g>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():g<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=g,this.update())}getTime(){return this._time}setPosition(g){this.prevPos=this._pos,this.propFunc(g),this._pos=g}getPosition(g){return g===void 0&&(g=this._time),this.func(g,this.begin,this._change,this.duration)}play(){this.state=o,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(g){this.pause(),this._time=g,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 g=this.getTimer()-this._startTime;this.state===o?this.setTime(g):this.state===l&&this.setTime(this.duration-g)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(g){var m=this,y=g.node,x=y._id,C,v=g.easing||i.Easings.Linear,b=!!g.yoyo,k;typeof g.duration>"u"?C=.3:g.duration===0?C=.001:C=g.duration,this.node=y,this._id=h++;var T=y.getLayer()||(y instanceof r.Konva.Stage?y.getLayers():null);T||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(){m.tween.onEnterFrame()},T),this.tween=new d(k,function(R){m._tweenFunc(R)},v,0,1,C*1e3,b),this._addListeners(),f.attrs[x]||(f.attrs[x]={}),f.attrs[x][this._id]||(f.attrs[x][this._id]={}),f.tweens[x]||(f.tweens[x]={});for(k in g)s[k]===void 0&&this._addAttr(k,g[k]);this.reset(),this.onFinish=g.onFinish,this.onReset=g.onReset,this.onUpdate=g.onUpdate}_addAttr(g,m){var y=this.node,x=y._id,C,v,b,k,T,R,A,U;if(b=f.tweens[x][g],b&&delete f.attrs[x][b][g],C=y.getAttr(g),t.Util._isArray(m))if(v=[],T=Math.max(m.length,C.length),g==="points"&&m.length!==C.length&&(m.length>C.length?(A=C,C=t.Util._prepareArrayForTween(C,m,y.closed())):(R=m,m=t.Util._prepareArrayForTween(m,C,y.closed()))),g.indexOf("fill")===0)for(k=0;k<T;k++)if(k%2===0)v.push(m[k]-C[k]);else{var I=t.Util.colorToRGBA(C[k]);U=t.Util.colorToRGBA(m[k]),C[k]=I,v.push({r:U.r-I.r,g:U.g-I.g,b:U.b-I.b,a:U.a-I.a})}else for(k=0;k<T;k++)v.push(m[k]-C[k]);else c.indexOf(g)!==-1?(C=t.Util.colorToRGBA(C),U=t.Util.colorToRGBA(m),v={r:U.r-C.r,g:U.g-C.g,b:U.b-C.b,a:U.a-C.a}):v=m-C;f.attrs[x][this._id][g]={start:C,diff:v,end:m,trueEnd:R,trueStart:A},f.tweens[x][g]=this._id}_tweenFunc(g){var m=this.node,y=f.attrs[m._id][this._id],x,C,v,b,k,T,R,A;for(x in y){if(C=y[x],v=C.start,b=C.diff,A=C.end,t.Util._isArray(v))if(k=[],R=Math.max(v.length,A.length),x.indexOf("fill")===0)for(T=0;T<R;T++)T%2===0?k.push((v[T]||0)+b[T]*g):k.push("rgba("+Math.round(v[T].r+b[T].r*g)+","+Math.round(v[T].g+b[T].g*g)+","+Math.round(v[T].b+b[T].b*g)+","+(v[T].a+b[T].a*g)+")");else for(T=0;T<R;T++)k.push((v[T]||0)+b[T]*g);else c.indexOf(x)!==-1?k="rgba("+Math.round(v.r+b.r*g)+","+Math.round(v.g+b.g*g)+","+Math.round(v.b+b.b*g)+","+(v.a+b.a*g)+")":k=v+b*g;m.setAttr(x,k)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var g=this.node,m=f.attrs[g._id][this._id];m.points&&m.points.trueEnd&&g.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var g=this.node,m=f.attrs[g._id][this._id];m.points&&m.points.trueStart&&g.points(m.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(g){return this.tween.seek(g*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var g=this.node._id,m=this._id,y=f.tweens[g],x;this.pause();for(x in y)delete f.tweens[g][x];delete f.attrs[g][m]}}i.Tween=f,f.attrs={},f.tweens={},n.Node.prototype.to=function(u){var g=u.onFinish;u.node=this,u.onFinish=function(){this.destroy(),g&&g()};var m=new f(u);m.play()},i.Easings={BackEaseIn(u,g,m,y){var x=1.70158;return m*(u/=y)*u*((x+1)*u-x)+g},BackEaseOut(u,g,m,y){var x=1.70158;return m*((u=u/y-1)*u*((x+1)*u+x)+1)+g},BackEaseInOut(u,g,m,y){var x=1.70158;return(u/=y/2)<1?m/2*(u*u*(((x*=1.525)+1)*u-x))+g:m/2*((u-=2)*u*(((x*=1.525)+1)*u+x)+2)+g},ElasticEaseIn(u,g,m,y,x,C){var v=0;return u===0?g:(u/=y)===1?g+m:(C||(C=y*.3),!x||x<Math.abs(m)?(x=m,v=C/4):v=C/(2*Math.PI)*Math.asin(m/x),-(x*Math.pow(2,10*(u-=1))*Math.sin((u*y-v)*(2*Math.PI)/C))+g)},ElasticEaseOut(u,g,m,y,x,C){var v=0;return u===0?g:(u/=y)===1?g+m:(C||(C=y*.3),!x||x<Math.abs(m)?(x=m,v=C/4):v=C/(2*Math.PI)*Math.asin(m/x),x*Math.pow(2,-10*u)*Math.sin((u*y-v)*(2*Math.PI)/C)+m+g)},ElasticEaseInOut(u,g,m,y,x,C){var v=0;return u===0?g:(u/=y/2)===2?g+m:(C||(C=y*(.3*1.5)),!x||x<Math.abs(m)?(x=m,v=C/4):v=C/(2*Math.PI)*Math.asin(m/x),u<1?-.5*(x*Math.pow(2,10*(u-=1))*Math.sin((u*y-v)*(2*Math.PI)/C))+g:x*Math.pow(2,-10*(u-=1))*Math.sin((u*y-v)*(2*Math.PI)/C)*.5+m+g)},BounceEaseOut(u,g,m,y){return(u/=y)<1/2.75?m*(7.5625*u*u)+g:u<2/2.75?m*(7.5625*(u-=1.5/2.75)*u+.75)+g:u<2.5/2.75?m*(7.5625*(u-=2.25/2.75)*u+.9375)+g:m*(7.5625*(u-=2.625/2.75)*u+.984375)+g},BounceEaseIn(u,g,m,y){return m-i.Easings.BounceEaseOut(y-u,0,m,y)+g},BounceEaseInOut(u,g,m,y){return u<y/2?i.Easings.BounceEaseIn(u*2,0,m,y)*.5+g:i.Easings.BounceEaseOut(u*2-y,0,m,y)*.5+m*.5+g},EaseIn(u,g,m,y){return m*(u/=y)*u+g},EaseOut(u,g,m,y){return-m*(u/=y)*(u-2)+g},EaseInOut(u,g,m,y){return(u/=y/2)<1?m/2*u*u+g:-m/2*(--u*(u-2)-1)+g},StrongEaseIn(u,g,m,y){return m*(u/=y)*u*u*u*u+g},StrongEaseOut(u,g,m,y){return m*((u=u/y-1)*u*u*u*u+1)+g},StrongEaseInOut(u,g,m,y){return(u/=y/2)<1?m/2*u*u*u*u*u+g:m/2*((u-=2)*u*u*u*u+2)+g},Linear(u,g,m,y){return m*u/y+g}}})(sh);const v4=St(wt({__proto__:null,default:Pe(sh)},[sh]));(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.Konva=void 0;const t=Ot,e=ee,n=oe,r=Ha,s=i4,a=od,o=d4,l=eh,h=Hl,c=pe,d=rh,f=v4,u=F0,g=Ua;i.Konva=e.Util._assign(t.Konva,{Util:e.Util,Transform:e.Transform,Node:n.Node,Container:r.Container,Stage:s.Stage,stages:s.stages,Layer:a.Layer,FastLayer:o.FastLayer,Group:l.Group,DD:h.DD,Shape:c.Shape,shapes:c.shapes,Animation:d.Animation,Tween:f.Tween,Easings:f.Easings,Context:u.Context,Canvas:g.Canvas}),i.default=i.Konva})(Gl);const _4=St(wt({__proto__:null,default:Pe(Gl)},[Gl]));var es={};Object.defineProperty(es,"__esModule",{value:!0});var fd=es.Arc=void 0;const Va=It,y4=pe,dd=Ot,qa=Ft,b4=Ot;class gi extends y4.Shape{_sceneFunc(t){var e=dd.Konva.getAngle(this.angle()),n=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,n),t.arc(0,0,this.innerRadius(),e,0,!n),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(),n=this.clockwise(),r=dd.Konva.getAngle(n?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)),l=Math.sin(Math.min(r,Math.PI/2)),h=s*(s>0?t:e),c=a*e,d=o*(o>0?t:e),f=l*(l>0?e:t);return{x:h,y:n?-1*f:d,width:c-h,height:f-d}}}fd=es.Arc=gi,gi.prototype._centroid=!0,gi.prototype.className="Arc",gi.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,b4._registerNode)(gi),Va.Factory.addGetterSetter(gi,"innerRadius",0,(0,qa.getNumberValidator)()),Va.Factory.addGetterSetter(gi,"outerRadius",0,(0,qa.getNumberValidator)()),Va.Factory.addGetterSetter(gi,"angle",0,(0,qa.getNumberValidator)()),Va.Factory.addGetterSetter(gi,"clockwise",!1,(0,qa.getBooleanValidator)());const w4=St(wt({__proto__:null,get Arc(){return fd},default:es},[es]));var is={},ns={};Object.defineProperty(ns,"__esModule",{value:!0});var gd=ns.Line=void 0;const Xa=It,x4=pe,pd=Ft,S4=Ot;function ah(i,t,e,n,r,s,a){var o=Math.sqrt(Math.pow(e-i,2)+Math.pow(n-t,2)),l=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-n,2)),h=a*o/(o+l),c=a*l/(o+l),d=e-h*(r-i),f=n-h*(s-t),u=e+c*(r-i),g=n+c*(s-t);return[d,f,u,g]}function md(i,t){var e=i.length,n=[],r,s;for(r=2;r<e-2;r+=2)s=ah(i[r-2],i[r-1],i[r],i[r+1],i[r+2],i[r+3],t),!isNaN(s[0])&&(n.push(s[0]),n.push(s[1]),n.push(i[r]),n.push(i[r+1]),n.push(s[2]),n.push(s[3]));return n}class Ai extends x4.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(),n=e.length,r=this.tension(),s=this.closed(),a=this.bezier(),o,l,h;if(n){if(t.beginPath(),t.moveTo(e[0],e[1]),r!==0&&n>4){for(o=this.getTensionPoints(),l=o.length,h=s?0:4,s||t.quadraticCurveTo(o[0],o[1],o[2],o[3]);h<l-2;)t.bezierCurveTo(o[h++],o[h++],o[h++],o[h++],o[h++],o[h++]);s||t.quadraticCurveTo(o[l-2],o[l-1],e[n-2],e[n-1])}else if(a)for(h=2;h<n;)t.bezierCurveTo(e[h++],e[h++],e[h++],e[h++],e[h++],e[h++]);else for(h=2;h<n;h+=2)t.lineTo(e[h],e[h+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,n=this.tension(),r=ah(t[e-2],t[e-1],t[0],t[1],t[2],t[3],n),s=ah(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],n),a=md(t,n),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],n=t[0],r=t[1],s=t[1],a,o,l=0;l<t.length/2;l++)a=t[l*2],o=t[l*2+1],e=Math.min(e,a),n=Math.max(n,a),r=Math.min(r,o),s=Math.max(s,o);return{x:e,y:r,width:n-e,height:s-r}}}gd=ns.Line=Ai,Ai.prototype.className="Line",Ai.prototype._attrsAffectingSize=["points","bezier","tension"],(0,S4._registerNode)(Ai),Xa.Factory.addGetterSetter(Ai,"closed",!1),Xa.Factory.addGetterSetter(Ai,"bezier",!1),Xa.Factory.addGetterSetter(Ai,"tension",0,(0,pd.getNumberValidator)()),Xa.Factory.addGetterSetter(Ai,"points",[],(0,pd.getNumberArrayValidator)());const vd=St(wt({__proto__:null,get Line(){return gd},default:ns},[ns]));var rs={},oh={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.t2length=i.getQuadraticArcLength=i.getCubicArcLength=i.binomialCoefficients=i.cValues=i.tValues=void 0,i.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]],i.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]],i.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const t=(a,o,l)=>{let h,c,d;h=l/2,c=0;for(let u=0;u<20;u++)d=h*i.tValues[20][u]+h,c+=i.cValues[20][u]*n(a,o,d);return h*c};i.getCubicArcLength=t;const e=(a,o,l)=>{l===void 0&&(l=1);const h=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*(h*h+c*c),g=4*(h*d+c*f),m=d*d+f*f;if(u===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(o[2]-o[0],2));const y=g/(2*u),x=m/u,C=l+y,v=x-y*y,b=C*C+v>0?Math.sqrt(C*C+v):0,k=y*y+v>0?Math.sqrt(y*y+v):0,T=y+Math.sqrt(y*y+v)!==0?v*Math.log(Math.abs((C+b)/(y+k))):0;return Math.sqrt(u)/2*(C*b-y*k+T)};i.getQuadraticArcLength=e;function n(a,o,l){const h=r(1,l,a),c=r(1,l,o),d=h*h+c*c;return Math.sqrt(d)}const r=(a,o,l)=>{const h=l.length-1;let c,d;if(h===0)return 0;if(a===0){d=0;for(let f=0;f<=h;f++)d+=i.binomialCoefficients[h][f]*Math.pow(1-o,h-f)*Math.pow(o,f)*l[f];return d}else{c=new Array(h);for(let f=0;f<h;f++)c[f]=h*(l[f+1]-l[f]);return r(a-1,o,c)}},s=(a,o,l)=>{let h=1,c=a/o,d=(a-l(c))/o,f=0;for(;h>.001;){const u=l(c+d),g=Math.abs(a-u)/o;if(g<h)h=g,c+=d;else{const m=l(c-d),y=Math.abs(a-m)/o;y<h?(h=y,c-=d):d/=2}if(f++,f>500)break}return c};i.t2length=s})(oh);const C4=St(wt({__proto__:null,default:Pe(oh)},[oh]));Object.defineProperty(rs,"__esModule",{value:!0});var _d=rs.Path=void 0;const k4=It,E4=pe,T4=Ot,Gn=C4;class ce extends E4.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ce.parsePathData(this.data()),this.pathLength=ce.getPathLength(this.dataArray)}_sceneFunc(t){var e=this.dataArray;t.beginPath();for(var n=!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],l=a[1],h=a[2],c=a[3],d=a[4],f=a[5],u=a[6],g=a[7],m=h>c?h:c,y=h>c?1:h/c,x=h>c?c/h:1;t.translate(o,l),t.rotate(u),t.scale(y,x),t.arc(0,0,m,d,d+f,1-g),t.scale(1/y,1/x),t.rotate(-u),t.translate(-o,-l);break;case"z":n=!0,t.closePath();break}}!n&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(h){if(h.command==="A"){var c=h.points[4],d=h.points[5],f=h.points[4]+d,u=Math.PI/180;if(Math.abs(c-f)<u&&(u=Math.abs(c-f)),d<0)for(let g=c-u;g>f;g-=u){const m=ce.getPointOnEllipticalArc(h.points[0],h.points[1],h.points[2],h.points[3],g,0);t.push(m.x,m.y)}else for(let g=c+u;g<f;g+=u){const m=ce.getPointOnEllipticalArc(h.points[0],h.points[1],h.points[2],h.points[3],g,0);t.push(m.x,m.y)}}else if(h.command==="C")for(let g=0;g<=1;g+=.01){const m=ce.getPointOnCubicBezier(g,h.start.x,h.start.y,h.points[0],h.points[1],h.points[2],h.points[3],h.points[4],h.points[5]);t.push(m.x,m.y)}else t=t.concat(h.points)});for(var e=t[0],n=t[0],r=t[1],s=t[1],a,o,l=0;l<t.length/2;l++)a=t[l*2],o=t[l*2+1],isNaN(a)||(e=Math.min(e,a),n=Math.max(n,a)),isNaN(o)||(r=Math.min(r,o),s=Math.max(s,o));return{x:e,y:r,width:n-e,height:s-r}}getLength(){return this.pathLength}getPointAtLength(t){return ce.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}static getPathLength(t){let e=0;for(var n=0;n<t.length;++n)e+=t[n].pathLength;return e}static getPointAtLengthOfDataArray(t,e){var n,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 n=e[r-1].points.slice(-2),{x:n[0],y:n[1]};if(t<.01)return n=e[r].points.slice(0,2),{x:n[0],y:n[1]};var a=e[r],o=a.points;switch(a.command){case"L":return ce.getPointOnLine(t,a.start.x,a.start.y,o[0],o[1]);case"C":return ce.getPointOnCubicBezier((0,Gn.t2length)(t,ce.getPathLength(e),m=>(0,Gn.getCubicArcLength)([a.start.x,o[0],o[2],o[4]],[a.start.y,o[1],o[3],o[5]],m)),a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return ce.getPointOnQuadraticBezier((0,Gn.t2length)(t,ce.getPathLength(e),m=>(0,Gn.getQuadraticArcLength)([a.start.x,o[0],o[2]],[a.start.y,o[1],o[3]],m)),a.start.x,a.start.y,o[0],o[1],o[2],o[3]);case"A":var l=o[0],h=o[1],c=o[2],d=o[3],f=o[4],u=o[5],g=o[6];return f+=u*t/a.pathLength,ce.getPointOnEllipticalArc(l,h,c,d,f,g)}return null}static getPointOnLine(t,e,n,r,s,a,o){a===void 0&&(a=e),o===void 0&&(o=n);var l=(s-n)/(r-e+1e-8),h=Math.sqrt(t*t/(1+l*l));r<e&&(h*=-1);var c=l*h,d;if(r===e)d={x:a,y:o+c};else if((o-n)/(a-e+1e-8)===l)d={x:a+h,y:o+c};else{var f,u,g=this.getLineLength(e,n,r,s),m=(a-e)*(r-e)+(o-n)*(s-n);m=m/(g*g),f=e+m*(r-e),u=n+m*(s-n);var y=this.getLineLength(a,o,f,u),x=Math.sqrt(t*t-y*y);h=Math.sqrt(x*x/(1+l*l)),r<e&&(h*=-1),c=l*h,d={x:f+h,y:u+c}}return d}static getPointOnCubicBezier(t,e,n,r,s,a,o,l,h){function c(y){return y*y*y}function d(y){return 3*y*y*(1-y)}function f(y){return 3*y*(1-y)*(1-y)}function u(y){return(1-y)*(1-y)*(1-y)}var g=l*c(t)+a*d(t)+r*f(t)+e*u(t),m=h*c(t)+o*d(t)+s*f(t)+n*u(t);return{x:g,y:m}}static getPointOnQuadraticBezier(t,e,n,r,s,a,o){function l(u){return u*u}function h(u){return 2*u*(1-u)}function c(u){return(1-u)*(1-u)}var d=a*l(t)+r*h(t)+e*c(t),f=o*l(t)+s*h(t)+n*c(t);return{x:d,y:f}}static getPointOnEllipticalArc(t,e,n,r,s,a){var o=Math.cos(a),l=Math.sin(a),h={x:n*Math.cos(s),y:r*Math.sin(s)};return{x:t+(h.x*o-h.y*l),y:e+(h.x*l+h.y*o)}}static parsePathData(t){if(!t)return[];var e=t,n=["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<n.length;r++)e=e.replace(new RegExp(n[r],"g"),"|"+n[r]);var s=e.split("|"),a=[],o=[],l=0,h=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 g=[],m=0,y=o.length;m<y;m++){if(o[m]==="00"){g.push(0,0);continue}var x=parseFloat(o[m]);isNaN(x)?g.push(0):g.push(x)}for(;g.length>0&&!isNaN(g[0]);){var C="",v=[],b=l,k=h,T,R,A,U,I,N,q,W,K,it;switch(u){case"l":l+=g.shift(),h+=g.shift(),C="L",v.push(l,h);break;case"L":l=g.shift(),h=g.shift(),v.push(l,h);break;case"m":var pt=g.shift(),vt=g.shift();if(l+=pt,h+=vt,C="M",a.length>2&&a[a.length-1].command==="z"){for(var dt=a.length-2;dt>=0;dt--)if(a[dt].command==="M"){l=a[dt].points[0]+pt,h=a[dt].points[1]+vt;break}}v.push(l,h),u="l";break;case"M":l=g.shift(),h=g.shift(),C="M",v.push(l,h),u="L";break;case"h":l+=g.shift(),C="L",v.push(l,h);break;case"H":l=g.shift(),C="L",v.push(l,h);break;case"v":h+=g.shift(),C="L",v.push(l,h);break;case"V":h=g.shift(),C="L",v.push(l,h);break;case"C":v.push(g.shift(),g.shift(),g.shift(),g.shift()),l=g.shift(),h=g.shift(),v.push(l,h);break;case"c":v.push(l+g.shift(),h+g.shift(),l+g.shift(),h+g.shift()),l+=g.shift(),h+=g.shift(),C="C",v.push(l,h);break;case"S":R=l,A=h,T=a[a.length-1],T.command==="C"&&(R=l+(l-T.points[2]),A=h+(h-T.points[3])),v.push(R,A,g.shift(),g.shift()),l=g.shift(),h=g.shift(),C="C",v.push(l,h);break;case"s":R=l,A=h,T=a[a.length-1],T.command==="C"&&(R=l+(l-T.points[2]),A=h+(h-T.points[3])),v.push(R,A,l+g.shift(),h+g.shift()),l+=g.shift(),h+=g.shift(),C="C",v.push(l,h);break;case"Q":v.push(g.shift(),g.shift()),l=g.shift(),h=g.shift(),v.push(l,h);break;case"q":v.push(l+g.shift(),h+g.shift()),l+=g.shift(),h+=g.shift(),C="Q",v.push(l,h);break;case"T":R=l,A=h,T=a[a.length-1],T.command==="Q"&&(R=l+(l-T.points[0]),A=h+(h-T.points[1])),l=g.shift(),h=g.shift(),C="Q",v.push(R,A,l,h);break;case"t":R=l,A=h,T=a[a.length-1],T.command==="Q"&&(R=l+(l-T.points[0]),A=h+(h-T.points[1])),l+=g.shift(),h+=g.shift(),C="Q",v.push(R,A,l,h);break;case"A":U=g.shift(),I=g.shift(),N=g.shift(),q=g.shift(),W=g.shift(),K=l,it=h,l=g.shift(),h=g.shift(),C="A",v=this.convertEndpointToCenterParameterization(K,it,l,h,q,W,U,I,N);break;case"a":U=g.shift(),I=g.shift(),N=g.shift(),q=g.shift(),W=g.shift(),K=l,it=h,l+=g.shift(),h+=g.shift(),C="A",v=this.convertEndpointToCenterParameterization(K,it,l,h,q,W,U,I,N);break}a.push({command:C||u,points:v,start:{x:b,y:k},pathLength:this.calcLength(b,k,C||u,v)})}(u==="z"||u==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,e,n,r){var s,a,o,l,h=ce;switch(n){case"L":return h.getLineLength(t,e,r[0],r[1]);case"C":return(0,Gn.getCubicArcLength)([t,r[0],r[2],r[4]],[e,r[1],r[3],r[5]],1);case"Q":return(0,Gn.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=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),d<0)for(l=c-u;l>f;l-=u)o=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),s+=h.getLineLength(a.x,a.y,o.x,o.y),a=o;else for(l=c+u;l<f;l+=u)o=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),s+=h.getLineLength(a.x,a.y,o.x,o.y),a=o;return o=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],f,0),s+=h.getLineLength(a.x,a.y,o.x,o.y),s}return 0}static convertEndpointToCenterParameterization(t,e,n,r,s,a,o,l,h){var c=h*(Math.PI/180),d=Math.cos(c)*(t-n)/2+Math.sin(c)*(e-r)/2,f=-1*Math.sin(c)*(t-n)/2+Math.cos(c)*(e-r)/2,u=d*d/(o*o)+f*f/(l*l);u>1&&(o*=Math.sqrt(u),l*=Math.sqrt(u));var g=Math.sqrt((o*o*(l*l)-o*o*(f*f)-l*l*(d*d))/(o*o*(f*f)+l*l*(d*d)));s===a&&(g*=-1),isNaN(g)&&(g=0);var m=g*o*f/l,y=g*-l*d/o,x=(t+n)/2+Math.cos(c)*m-Math.sin(c)*y,C=(e+r)/2+Math.sin(c)*m+Math.cos(c)*y,v=function(I){return Math.sqrt(I[0]*I[0]+I[1]*I[1])},b=function(I,N){return(I[0]*N[0]+I[1]*N[1])/(v(I)*v(N))},k=function(I,N){return(I[0]*N[1]<I[1]*N[0]?-1:1)*Math.acos(b(I,N))},T=k([1,0],[(d-m)/o,(f-y)/l]),R=[(d-m)/o,(f-y)/l],A=[(-1*d-m)/o,(-1*f-y)/l],U=k(R,A);return b(R,A)<=-1&&(U=Math.PI),b(R,A)>=1&&(U=0),a===0&&U>0&&(U=U-2*Math.PI),a===1&&U<0&&(U=U+2*Math.PI),[x,C,o,l,T,U,c,a]}}_d=rs.Path=ce,ce.prototype.className="Path",ce.prototype._attrsAffectingSize=["data"],(0,T4._registerNode)(ce),k4.Factory.addGetterSetter(ce,"data");const lh=St(wt({__proto__:null,get Path(){return _d},default:rs},[rs]));Object.defineProperty(is,"__esModule",{value:!0});var yd=is.Arrow=void 0;const Ya=It,P4=vd,bd=Ft,A4=Ot,wd=lh;class an extends P4.Line{_sceneFunc(t){super._sceneFunc(t);var e=Math.PI*2,n=this.points(),r=n,s=this.tension()!==0&&n.length>4;s&&(r=this.getTensionPoints());var a=this.pointerLength(),o=n.length,l,h;if(s){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[o-2],n[o-1]],u=wd.Path.calcLength(r[r.length-4],r[r.length-3],"C",f),g=wd.Path.getPointOnQuadraticBezier(Math.min(1,1-a/u),f[0],f[1],f[2],f[3],f[4],f[5]);l=n[o-2]-g.x,h=n[o-1]-g.y}else l=n[o-2]-n[o-4],h=n[o-1]-n[o-3];var c=(Math.atan2(h,l)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(n[o-2],n[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(n[0],n[1]),s?(l=(r[0]+r[2])/2-n[0],h=(r[1]+r[3])/2-n[1]):(l=n[2]-n[0],h=n[3]-n[1]),t.rotate((Math.atan2(-h,-l)+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}}}yd=is.Arrow=an,an.prototype.className="Arrow",(0,A4._registerNode)(an),Ya.Factory.addGetterSetter(an,"pointerLength",10,(0,bd.getNumberValidator)()),Ya.Factory.addGetterSetter(an,"pointerWidth",10,(0,bd.getNumberValidator)()),Ya.Factory.addGetterSetter(an,"pointerAtBeginning",!1),Ya.Factory.addGetterSetter(an,"pointerAtEnding",!0);const M4=St(wt({__proto__:null,get Arrow(){return yd},default:is},[is]));var ss={};Object.defineProperty(ss,"__esModule",{value:!0});var xd=ss.Circle=void 0;const R4=It,L4=pe,D4=Ft,I4=Ot;class Bn extends L4.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)}}xd=ss.Circle=Bn,Bn.prototype._centroid=!0,Bn.prototype.className="Circle",Bn.prototype._attrsAffectingSize=["radius"],(0,I4._registerNode)(Bn),R4.Factory.addGetterSetter(Bn,"radius",0,(0,D4.getNumberValidator)());const O4=St(wt({__proto__:null,get Circle(){return xd},default:ss},[ss]));var as={};Object.defineProperty(as,"__esModule",{value:!0});var Sd=as.Ellipse=void 0;const hh=It,F4=pe,Cd=Ft,N4=Ot;class Mi extends F4.Shape{_sceneFunc(t){var e=this.radiusX(),n=this.radiusY();t.beginPath(),t.save(),e!==n&&t.scale(1,n/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)}}Sd=as.Ellipse=Mi,Mi.prototype.className="Ellipse",Mi.prototype._centroid=!0,Mi.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,N4._registerNode)(Mi),hh.Factory.addComponentsGetterSetter(Mi,"radius",["x","y"]),hh.Factory.addGetterSetter(Mi,"radiusX",0,(0,Cd.getNumberValidator)()),hh.Factory.addGetterSetter(Mi,"radiusY",0,(0,Cd.getNumberValidator)());const U4=St(wt({__proto__:null,get Ellipse(){return Sd},default:as},[as]));var os={};Object.defineProperty(os,"__esModule",{value:!0});var kd=os.Image=void 0;const ch=ee,on=It,G4=pe,B4=Ot,ls=Ft;let Je=class Eg extends G4.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(),n=this.getHeight(),r=this.cornerRadius(),s=this.attrs.image;let a;if(s){const o=this.attrs.cropWidth,l=this.attrs.cropHeight;o&&l?a=[s,this.cropX(),this.cropY(),o,l,0,0,e,n]:a=[s,0,0,e,n]}(this.hasFill()||this.hasStroke()||r)&&(t.beginPath(),r?ch.Util.drawRoundedRectPath(t,e,n,r):t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)),s&&(r&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var e=this.width(),n=this.height(),r=this.cornerRadius();t.beginPath(),r?ch.Util.drawRoundedRectPath(t,e,n,r):t.rect(0,0,e,n),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,n=null){var r=ch.Util.createImageElement();r.onload=function(){var s=new Eg({image:r});e(s)},r.onerror=n,r.crossOrigin="Anonymous",r.src=t}};kd=os.Image=Je,Je.prototype.className="Image",(0,B4._registerNode)(Je),on.Factory.addGetterSetter(Je,"cornerRadius",0,(0,ls.getNumberOrArrayOfNumbersValidator)(4)),on.Factory.addGetterSetter(Je,"image"),on.Factory.addComponentsGetterSetter(Je,"crop",["x","y","width","height"]),on.Factory.addGetterSetter(Je,"cropX",0,(0,ls.getNumberValidator)()),on.Factory.addGetterSetter(Je,"cropY",0,(0,ls.getNumberValidator)()),on.Factory.addGetterSetter(Je,"cropWidth",0,(0,ls.getNumberValidator)()),on.Factory.addGetterSetter(Je,"cropHeight",0,(0,ls.getNumberValidator)());const $4=St(wt({__proto__:null,get Image(){return kd},default:os},[os]));var ln={};Object.defineProperty(ln,"__esModule",{value:!0});var Ed=ln.Tag=Ad=ln.Label=void 0;const Wa=It,z4=pe,j4=eh,uh=Ft,Td=Ot;var Pd=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],H4="Change.konva",V4="none",fh="up",dh="right",gh="down",ph="left",q4=Pd.length;class mh extends j4.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,n,r=function(){e._sync()};for(n=0;n<q4;n++)t.on(Pd[n]+H4,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var t=this.getText(),e=this.getTag(),n,r,s,a,o,l,h;if(t&&e){switch(n=t.width(),r=t.height(),s=e.pointerDirection(),a=e.pointerWidth(),h=e.pointerHeight(),o=0,l=0,s){case fh:o=n/2,l=-1*h;break;case dh:o=n+a,l=r/2;break;case gh:o=n/2,l=r+h;break;case ph:o=-1*a,l=r/2;break}e.setAttrs({x:-1*o,y:-1*l,width:n,height:r}),t.setAttrs({x:-1*o,y:-1*l})}}}var Ad=ln.Label=mh;mh.prototype.className="Label",(0,Td._registerNode)(mh);class hn extends z4.Shape{_sceneFunc(t){var e=this.width(),n=this.height(),r=this.pointerDirection(),s=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius();let l=0,h=0,c=0,d=0;typeof o=="number"?l=h=c=d=Math.min(o,e/2,n/2):(l=Math.min(o[0]||0,e/2,n/2),h=Math.min(o[1]||0,e/2,n/2),d=Math.min(o[2]||0,e/2,n/2),c=Math.min(o[3]||0,e/2,n/2)),t.beginPath(),t.moveTo(l,0),r===fh&&(t.lineTo((e-s)/2,0),t.lineTo(e/2,-1*a),t.lineTo((e+s)/2,0)),t.lineTo(e-h,0),t.arc(e-h,h,h,Math.PI*3/2,0,!1),r===dh&&(t.lineTo(e,(n-a)/2),t.lineTo(e+s,n/2),t.lineTo(e,(n+a)/2)),t.lineTo(e,n-d),t.arc(e-d,n-d,d,0,Math.PI/2,!1),r===gh&&(t.lineTo((e+s)/2,n),t.lineTo(e/2,n+a),t.lineTo((e-s)/2,n)),t.lineTo(c,n),t.arc(c,n-c,c,Math.PI/2,Math.PI,!1),r===ph&&(t.lineTo(0,(n+a)/2),t.lineTo(-1*s,n/2),t.lineTo(0,(n-a)/2)),t.lineTo(0,l),t.arc(l,l,l,Math.PI,Math.PI*3/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){var t=0,e=0,n=this.pointerWidth(),r=this.pointerHeight(),s=this.pointerDirection(),a=this.width(),o=this.height();return s===fh?(e-=r,o+=r):s===gh?o+=r:s===ph?(t-=n*1.5,a+=n):s===dh&&(a+=n*1.5),{x:t,y:e,width:a,height:o}}}Ed=ln.Tag=hn,hn.prototype.className="Tag",(0,Td._registerNode)(hn),Wa.Factory.addGetterSetter(hn,"pointerDirection",V4),Wa.Factory.addGetterSetter(hn,"pointerWidth",0,(0,uh.getNumberValidator)()),Wa.Factory.addGetterSetter(hn,"pointerHeight",0,(0,uh.getNumberValidator)()),Wa.Factory.addGetterSetter(hn,"cornerRadius",0,(0,uh.getNumberOrArrayOfNumbersValidator)(4));const X4=St(wt({__proto__:null,get Label(){return Ad},get Tag(){return Ed},default:ln},[ln]));var hs={};Object.defineProperty(hs,"__esModule",{value:!0});var Md=hs.Rect=void 0;const Y4=It,W4=pe,K4=Ot,Z4=ee,J4=Ft;class Ka extends W4.Shape{_sceneFunc(t){var e=this.cornerRadius(),n=this.width(),r=this.height();t.beginPath(),e?Z4.Util.drawRoundedRectPath(t,n,r,e):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}}Md=hs.Rect=Ka,Ka.prototype.className="Rect",(0,K4._registerNode)(Ka),Y4.Factory.addGetterSetter(Ka,"cornerRadius",0,(0,J4.getNumberOrArrayOfNumbersValidator)(4));const Rd=St(wt({__proto__:null,get Rect(){return Md},default:hs},[hs]));var cs={};Object.defineProperty(cs,"__esModule",{value:!0});var Ld=cs.RegularPolygon=void 0;const Dd=It,Q4=pe,Id=Ft,t6=Ot;class cn extends Q4.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(var n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,n=[];for(var r=0;r<t;r++)n.push({x:e*Math.sin(r*2*Math.PI/t),y:-1*e*Math.cos(r*2*Math.PI/t)});return n}getSelfRect(){const t=this._getPoints();var e=t[0].x,n=t[0].y,r=t[0].x,s=t[0].y;return t.forEach(a=>{e=Math.min(e,a.x),n=Math.max(n,a.x),r=Math.min(r,a.y),s=Math.max(s,a.y)}),{x:e,y:r,width:n-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)}}Ld=cs.RegularPolygon=cn,cn.prototype.className="RegularPolygon",cn.prototype._centroid=!0,cn.prototype._attrsAffectingSize=["radius"],(0,t6._registerNode)(cn),Dd.Factory.addGetterSetter(cn,"radius",0,(0,Id.getNumberValidator)()),Dd.Factory.addGetterSetter(cn,"sides",0,(0,Id.getNumberValidator)());const e6=St(wt({__proto__:null,get RegularPolygon(){return Ld},default:cs},[cs]));var us={};Object.defineProperty(us,"__esModule",{value:!0});var Od=us.Ring=void 0;const Fd=It,i6=pe,Nd=Ft,n6=Ot;var Ud=Math.PI*2;class un extends i6.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,Ud,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),Ud,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)}}Od=us.Ring=un,un.prototype.className="Ring",un.prototype._centroid=!0,un.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,n6._registerNode)(un),Fd.Factory.addGetterSetter(un,"innerRadius",0,(0,Nd.getNumberValidator)()),Fd.Factory.addGetterSetter(un,"outerRadius",0,(0,Nd.getNumberValidator)());const r6=St(wt({__proto__:null,get Ring(){return Od},default:us},[us]));var fs={};Object.defineProperty(fs,"__esModule",{value:!0});var Gd=fs.Sprite=void 0;const fn=It,s6=pe,a6=rh,Bd=Ft,o6=Ot;class Qe extends s6.Shape{constructor(t){super(t),this._updated=!0,this.anim=new a6.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(),n=this.frameIndex(),r=n*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+0],l=s[r+1],h=s[r+2],c=s[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,h,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[e],u=n*2;t.drawImage(d,o,l,h,c,f[u+0],f[u+1],h,c)}else t.drawImage(d,o,l,h,c,0,0,h,c)}_hitFunc(t){var e=this.animation(),n=this.frameIndex(),r=n*4,s=this.animations()[e],a=this.frameOffsets(),o=s[r+2],l=s[r+3];if(t.beginPath(),a){var h=a[e],c=n*2;t.rect(h[c+0],h[c+1],o,l)}else t.rect(0,0,o,l);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(),n=this.animations(),r=n[e],s=r.length/4;t<s-1?this.frameIndex(t+1):this.frameIndex(0)}}Gd=fs.Sprite=Qe,Qe.prototype.className="Sprite",(0,o6._registerNode)(Qe),fn.Factory.addGetterSetter(Qe,"animation"),fn.Factory.addGetterSetter(Qe,"animations"),fn.Factory.addGetterSetter(Qe,"frameOffsets"),fn.Factory.addGetterSetter(Qe,"image"),fn.Factory.addGetterSetter(Qe,"frameIndex",0,(0,Bd.getNumberValidator)()),fn.Factory.addGetterSetter(Qe,"frameRate",17,(0,Bd.getNumberValidator)()),fn.Factory.backCompat(Qe,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});const l6=St(wt({__proto__:null,get Sprite(){return Gd},default:fs},[fs]));var ds={};Object.defineProperty(ds,"__esModule",{value:!0});var $d=ds.Star=void 0;const vh=It,h6=pe,_h=Ft,c6=Ot;class Ri extends h6.Shape{_sceneFunc(t){var e=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-n);for(var s=1;s<r*2;s++){var a=s%2===0?n:e,o=a*Math.sin(s*Math.PI/r),l=-1*a*Math.cos(s*Math.PI/r);t.lineTo(o,l)}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)}}$d=ds.Star=Ri,Ri.prototype.className="Star",Ri.prototype._centroid=!0,Ri.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,c6._registerNode)(Ri),vh.Factory.addGetterSetter(Ri,"numPoints",5,(0,_h.getNumberValidator)()),vh.Factory.addGetterSetter(Ri,"innerRadius",0,(0,_h.getNumberValidator)()),vh.Factory.addGetterSetter(Ri,"outerRadius",0,(0,_h.getNumberValidator)());const u6=St(wt({__proto__:null,get Star(){return $d},default:ds},[ds]));var dn={};Object.defineProperty(dn,"__esModule",{value:!0});var zd=dn.Text=Hd=dn.stringToArray=void 0;const yh=ee,ye=It,f6=pe,Li=Ft,d6=Ot;function jd(i){return Array.from(i)}var Hd=dn.stringToArray=jd,$n="auto",g6="center",Vd="inherit",gs="justify",p6="Change.konva",m6="2d",qd="-",Xd="left",v6="text",_6="Text",y6="top",b6="bottom",Yd="middle",Wd="normal",w6="px ",Za=" ",x6="right",Kd="rtl",S6="word",C6="char",Zd="none",bh="…",Jd=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],k6=Jd.length;function E6(i){return i.split(",").map(t=>{t=t.trim();const e=t.indexOf(" ")>=0,n=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!n&&(t=`"${t}"`),t}).join(", ")}var Ja;function wh(){return Ja||(Ja=yh.Util.createCanvasElement().getContext(m6),Ja)}function T6(i){i.fillText(this._partialText,this._partialTextX,this._partialTextY)}function P6(i){i.setAttr("miterLimit",2),i.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function A6(i){return i=i||{},!i.fillLinearGradientColorStops&&!i.fillRadialGradientColorStops&&!i.fillPatternImage&&(i.fill=i.fill||"black"),i}class ne extends f6.Shape{constructor(t){super(A6(t)),this._partialTextX=0,this._partialTextY=0;for(var e=0;e<k6;e++)this.on(Jd[e]+p6,this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,n=e.length;if(this.text()){var r=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,o=this.verticalAlign(),l=this.direction(),h=0,c=this.align(),d=this.getWidth(),f=this.letterSpacing(),u=this.fill(),g=this.textDecoration(),m=g.indexOf("underline")!==-1,y=g.indexOf("line-through")!==-1,x;l=l===Vd?t.direction:l;var C=0,C=a/2,v=0,b=0;for(l===Kd&&t.setAttr("direction",l),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",Yd),t.setAttr("textAlign",Xd),o===Yd?h=(this.getHeight()-n*a-r*2)/2:o===b6&&(h=this.getHeight()-n*a-r*2),t.translate(r,h+r),x=0;x<n;x++){var v=0,b=0,k=e[x],T=k.text,R=k.width,A=k.lastInParagraph,U,I,N;if(t.save(),c===x6?v+=d-R-r*2:c===g6&&(v+=(d-R-r*2)/2),m){t.save(),t.beginPath(),t.moveTo(v,C+b+Math.round(s/2)),U=T.split(" ").length-1,I=U===0,N=c===gs&&!A?d-r*2:R,t.lineTo(v+Math.round(N),C+b+Math.round(s/2)),t.lineWidth=s/15;const vt=this._getLinearGradient();t.strokeStyle=vt||u,t.stroke(),t.restore()}if(y){t.save(),t.beginPath(),t.moveTo(v,C+b),U=T.split(" ").length-1,I=U===0,N=c===gs&&A&&!I?d-r*2:R,t.lineTo(v+Math.round(N),C+b),t.lineWidth=s/15;const vt=this._getLinearGradient();t.strokeStyle=vt||u,t.stroke(),t.restore()}if(l!==Kd&&(f!==0||c===gs)){U=T.split(" ").length-1;for(var q=jd(T),W=0;W<q.length;W++){var K=q[W];K===" "&&!A&&c===gs&&(v+=(d-r*2-R)/U),this._partialTextX=v,this._partialTextY=C+b,this._partialText=K,t.fillStrokeShape(this),v+=this.measureSize(K).width+f}}else f!==0&&t.setAttr("letterSpacing",`${f}px`),this._partialTextX=v,this._partialTextY=C+b,this._partialText=T,t.fillStrokeShape(this);t.restore(),n>1&&(C+=a)}}}_hitFunc(t){var e=this.getWidth(),n=this.getHeight();t.beginPath(),t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=yh.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(v6,e),this}getWidth(){var t=this.attrs.width===$n||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===$n||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 yh.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=wh(),n=this.fontSize(),r;return e.save(),e.font=this._getContextFont(),r=e.measureText(t),e.restore(),{width:r.width,height:n}}_getContextFont(){return this.fontStyle()+Za+this.fontVariant()+Za+(this.fontSize()+w6)+E6(this.fontFamily())}_addTextLine(t){this.align()===gs&&(t=t.trim());var n=this._getTextWidth(t);return this.textArr.push({text:t,width:n,lastInParagraph:!1})}_getTextWidth(t){var e=this.letterSpacing(),n=t.length;return wh().measureText(t).width+(n?e*(n-1):0)}_setTextData(){var t=this.text().split(`
|
|
34
|
+
`),e=+this.fontSize(),n=0,r=this.lineHeight()*e,s=this.attrs.width,a=this.attrs.height,o=s!==$n&&s!==void 0,l=a!==$n&&a!==void 0,h=this.padding(),c=s-h*2,d=a-h*2,f=0,u=this.wrap(),g=u!==Zd,m=u!==C6&&g,y=this.ellipsis();this.textArr=[],wh().font=this._getContextFont();for(var x=y?this._getTextWidth(bh):0,C=0,v=t.length;C<v;++C){var b=t[C],k=this._getTextWidth(b);if(o&&k>c)for(;b.length>0;){for(var T=0,R=b.length,A="",U=0;T<R;){var I=T+R>>>1,N=b.slice(0,I+1),q=this._getTextWidth(N)+x;q<=c?(T=I+1,A=N,U=q):R=I}if(A){if(m){var W,K=b[A.length],it=K===Za||K===qd;it&&U<=c?W=A.length:W=Math.max(A.lastIndexOf(Za),A.lastIndexOf(qd))+1,W>0&&(T=W,A=A.slice(0,T),U=this._getTextWidth(A))}A=A.trimRight(),this._addTextLine(A),n=Math.max(n,U),f+=r;var pt=this._shouldHandleEllipsis(f);if(pt){this._tryToAddEllipsisToLastLine();break}if(b=b.slice(T),b=b.trimLeft(),b.length>0&&(k=this._getTextWidth(b),k<=c)){this._addTextLine(b),f+=r,n=Math.max(n,k);break}}else break}else this._addTextLine(b),f+=r,n=Math.max(n,k),this._shouldHandleEllipsis(f)&&C<v-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),l&&f+r>d)break}this.textHeight=e,this.textWidth=n}_shouldHandleEllipsis(t){var e=+this.fontSize(),n=this.lineHeight()*e,r=this.attrs.height,s=r!==$n&&r!==void 0,a=this.padding(),o=r-a*2,l=this.wrap(),h=l!==Zd;return!h||s&&t+n>o}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,e=t!==$n&&t!==void 0,n=this.padding(),r=t-n*2,s=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!s)){if(e){var o=this._getTextWidth(a.text+bh)<r;o||(a.text=a.text.slice(0,a.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+bh)}}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()}}zd=dn.Text=ne,ne.prototype._fillFunc=T6,ne.prototype._strokeFunc=P6,ne.prototype.className=_6,ne.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,d6._registerNode)(ne),ye.Factory.overWriteSetter(ne,"width",(0,Li.getNumberOrAutoValidator)()),ye.Factory.overWriteSetter(ne,"height",(0,Li.getNumberOrAutoValidator)()),ye.Factory.addGetterSetter(ne,"direction",Vd),ye.Factory.addGetterSetter(ne,"fontFamily","Arial"),ye.Factory.addGetterSetter(ne,"fontSize",12,(0,Li.getNumberValidator)()),ye.Factory.addGetterSetter(ne,"fontStyle",Wd),ye.Factory.addGetterSetter(ne,"fontVariant",Wd),ye.Factory.addGetterSetter(ne,"padding",0,(0,Li.getNumberValidator)()),ye.Factory.addGetterSetter(ne,"align",Xd),ye.Factory.addGetterSetter(ne,"verticalAlign",y6),ye.Factory.addGetterSetter(ne,"lineHeight",1,(0,Li.getNumberValidator)()),ye.Factory.addGetterSetter(ne,"wrap",S6),ye.Factory.addGetterSetter(ne,"ellipsis",!1,(0,Li.getBooleanValidator)()),ye.Factory.addGetterSetter(ne,"letterSpacing",0,(0,Li.getNumberValidator)()),ye.Factory.addGetterSetter(ne,"text","",(0,Li.getStringValidator)()),ye.Factory.addGetterSetter(ne,"textDecoration","");const Qd=St(wt({__proto__:null,get Text(){return zd},default:dn,get stringToArray(){return Hd}},[dn]));var ps={};Object.defineProperty(ps,"__esModule",{value:!0});var t1=ps.TextPath=void 0;const xh=ee,ze=It,M6=pe,ms=lh,Sh=Qd,e1=Ft,R6=Ot;var L6="",i1="normal";function n1(i){i.fillText(this.partialText,0,0)}function r1(i){i.strokeText(this.partialText,0,0)}class ue extends M6.Shape{constructor(t){super(t),this.dummyCanvas=xh.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 ms.Path.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;const e=this.pathLength;return t-1>e?null:ms.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=ms.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(),n=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=n,t.lineWidth=r/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var n=e[0].p0;t.moveTo(n.x,n.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 xh.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 Sh.Text.prototype.setText.call(this,t)}_getContextFont(){return Sh.Text.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas,n=e.getContext("2d");n.save(),n.font=this._getContextFont();var r=n.measureText(t);return n.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 n=this.letterSpacing(),r=this.align(),s=this.kerningFunc(),a=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,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 l=(0,Sh.stringToArray)(this.text());let h=o;for(var c=0;c<l.length;c++){const d=this._getPointAtLength(h);if(!d)return;let f=this._getTextSize(l[c]).width+n;if(l[c]===" "&&r==="justify"){const C=this.text().split(" ").length-1;f+=(this.pathLength-a)/C}const u=this._getPointAtLength(h+f);if(!u)return;const g=ms.Path.getLineLength(d.x,d.y,u.x,u.y);let m=0;if(s)try{m=s(l[c-1],l[c])*this.fontSize()}catch{m=0}d.x+=m,u.x+=m,this.textWidth+=m;const y=ms.Path.getPointOnLine(m+g/2,d.x,d.y,u.x,u.y),x=Math.atan2(u.y-d.y,u.x-d.x);this.glyphInfo.push({transposeX:y.x,transposeY:y.y,text:l[c],rotation:x,p0:d,p1:u}),h+=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,n=t[0]||0,r=t[1]||0,s=t[1]||0,a,o,l=0;l<t.length/2;l++)a=t[l*2],o=t[l*2+1],e=Math.min(e,a),n=Math.max(n,a),r=Math.min(r,o),s=Math.max(s,o);var h=this.fontSize();return{x:e-h/2,y:r-h/2,width:n-e+h,height:s-r+h}}destroy(){return xh.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}t1=ps.TextPath=ue,ue.prototype._fillFunc=n1,ue.prototype._strokeFunc=r1,ue.prototype._fillFuncHit=n1,ue.prototype._strokeFuncHit=r1,ue.prototype.className="TextPath",ue.prototype._attrsAffectingSize=["text","fontSize","data"],(0,R6._registerNode)(ue),ze.Factory.addGetterSetter(ue,"data"),ze.Factory.addGetterSetter(ue,"fontFamily","Arial"),ze.Factory.addGetterSetter(ue,"fontSize",12,(0,e1.getNumberValidator)()),ze.Factory.addGetterSetter(ue,"fontStyle",i1),ze.Factory.addGetterSetter(ue,"align","left"),ze.Factory.addGetterSetter(ue,"letterSpacing",0,(0,e1.getNumberValidator)()),ze.Factory.addGetterSetter(ue,"textBaseline","middle"),ze.Factory.addGetterSetter(ue,"fontVariant",i1),ze.Factory.addGetterSetter(ue,"text",L6),ze.Factory.addGetterSetter(ue,"textDecoration",null),ze.Factory.addGetterSetter(ue,"kerningFunc",null);const D6=St(wt({__proto__:null,get TextPath(){return t1},default:ps},[ps]));var vs={};Object.defineProperty(vs,"__esModule",{value:!0});var s1=vs.Transformer=void 0;const Yt=ee,Vt=It,a1=oe,I6=pe,O6=Rd,o1=eh,je=Ot,Di=Ft,F6=Ot;var l1="tr-konva",N6=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(i=>i+`.${l1}`).join(" "),h1="nodesRect",U6=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],G6={"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 B6="ontouchstart"in je.Konva._global;function $6(i,t,e){if(i==="rotater")return e;t+=Yt.Util.degToRad(G6[i]||0);var n=(Yt.Util.radToDeg(t)%360+360)%360;return Yt.Util._inRange(n,315+22.5,360)||Yt.Util._inRange(n,0,22.5)?"ns-resize":Yt.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Yt.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Yt.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Yt.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Yt.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Yt.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Yt.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Yt.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var Qa=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],c1=1e8;function z6(i){return{x:i.x+i.width/2*Math.cos(i.rotation)+i.height/2*Math.sin(-i.rotation),y:i.y+i.height/2*Math.cos(i.rotation)+i.width/2*Math.sin(i.rotation)}}function u1(i,t,e){const n=e.x+(i.x-e.x)*Math.cos(t)-(i.y-e.y)*Math.sin(t),r=e.y+(i.x-e.x)*Math.sin(t)+(i.y-e.y)*Math.cos(t);return{...i,rotation:i.rotation+t,x:n,y:r}}function j6(i,t){const e=z6(i);return u1(i,t,e)}function H6(i,t,e){let n=t;for(let r=0;r<i.length;r++){const s=je.Konva.getAngle(i[r]),a=Math.abs(s-t)%(Math.PI*2);Math.min(a,Math.PI*2-a)<e&&(n=s)}return n}class zt extends o1.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(N6,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return Yt.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 l1+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter(r=>r.isAncestorOf(this)?(Yt.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(U6.map(o=>o+`.${this._getEventNamespace()}`).join(" "),s),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,s),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,n=>{e=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(n,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,n=>{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 l=o.getAbsolutePosition();o.setAbsolutePosition({x:l.x+s,y:l.y+a}),o.startDrag(n)}),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(h1),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(h1,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),n){var r=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=t.getAbsoluteScale(n),a=t.getAbsolutePosition(n),o=r.x*s.x-t.offsetX()*s.x,l=r.y*s.y-t.offsetY()*s.y;const h=(je.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+o*Math.cos(h)+l*Math.sin(-h),y:a.y+l*Math.cos(h)+o*Math.sin(h),width:r.width*s.x,height:r.height*s.y,rotation:h};return u1(c,-je.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-c1,y:-c1,width:0,height:0,rotation:0};const e=[];this.nodes().map(h=>{const c=h.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=h.getAbsoluteTransform();d.forEach(function(u){var g=f.point(u);e.push(g)})});const n=new Yt.Transform;n.rotate(-je.Konva.getAngle(this.rotation()));var r=1/0,s=1/0,a=-1/0,o=-1/0;e.forEach(function(h){var c=n.point(h);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)}),n.invert();const l=n.point({x:r,y:s});return{x:l.x,y:l.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(),Qa.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){var e=new O6.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:B6?10:"auto"}),n=this;e.on("mousedown touchstart",function(r){n._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=$6(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 I6.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,n){var r=n.getParent(),s=r.padding();e.beginPath(),e.rect(-s,-s,n.width()+s*2,n.height()+s*2),e.moveTo(n.width()/2,-s),r.rotateEnabled()&&e.lineTo(n.width()/2,-r.rotateAnchorOffset()*Yt.Util._sign(n.height())-s),e.fillStrokeShape(n)},hitFunc:(e,n)=>{if(this.shouldOverdrawWholeArea()){var r=this.padding();e.beginPath(),e.rect(-r,-r,n.width()+r*2,n.height()+r*2),e.fillStrokeShape(n)}}});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(),n=e.width,r=e.height,s=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/s),this.cos=Math.abs(n/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(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var e,n,r,s=this.findOne("."+this._movingAnchorName),a=s.getStage();a.setPointersPositions(t);const o=a.getPointerPosition();let l={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const h=s.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(h,l,t)),s.setAbsolutePosition(l);const c=s.getAbsolutePosition();if(!(h.x===c.x&&h.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();e=s.x()-d.width/2,n=-s.y()+d.height/2;let W=Math.atan2(-n,e)+Math.PI/2;d.height<0&&(W-=Math.PI);var f=je.Konva.getAngle(this.rotation());const K=f+W,it=je.Konva.getAngle(this.rotationSnapTolerance()),vt=H6(this.rotationSnaps(),K,it)-d.rotation,dt=j6(d,vt);this._fitNodesInto(dt,t);return}var u=this.shiftBehavior(),g;u==="inverted"?g=this.keepRatio()&&!t.shiftKey:u==="none"?g=this.keepRatio():g=this.keepRatio()||t.shiftKey;var v=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(g){var m=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(m.x-s.x(),2)+Math.pow(m.y-s.y(),2));var y=this.findOne(".top-left").x()>m.x?-1:1,x=this.findOne(".top-left").y()>m.y?-1:1;e=r*this.cos*y,n=r*this.sin*x,this.findOne(".top-left").x(m.x-e),this.findOne(".top-left").y(m.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(g){var m=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()-m.x,2)+Math.pow(m.y-s.y(),2));var y=this.findOne(".top-right").x()<m.x?-1:1,x=this.findOne(".top-right").y()>m.y?-1:1;e=r*this.cos*y,n=r*this.sin*x,this.findOne(".top-right").x(m.x+e),this.findOne(".top-right").y(m.y-n)}var C=s.position();this.findOne(".top-left").y(C.y),this.findOne(".bottom-right").x(C.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(g){var m=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(m.x-s.x(),2)+Math.pow(s.y()-m.y,2));var y=m.x<s.x()?-1:1,x=s.y()<m.y?-1:1;e=r*this.cos*y,n=r*this.sin*x,s.x(m.x-e),s.y(m.y+n)}C=s.position(),this.findOne(".top-left").x(C.x),this.findOne(".bottom-right").y(C.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(s.y());else if(this._movingAnchorName==="bottom-right"){if(g){var m=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()-m.x,2)+Math.pow(s.y()-m.y,2));var y=this.findOne(".bottom-right").x()<m.x?-1:1,x=this.findOne(".bottom-right").y()<m.y?-1:1;e=r*this.cos*y,n=r*this.sin*x,this.findOne(".bottom-right").x(m.x+e),this.findOne(".bottom-right").y(m.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var v=this.centeredScaling()||t.altKey;if(v){var b=this.findOne(".top-left"),k=this.findOne(".bottom-right"),T=b.x(),R=b.y(),A=this.getWidth()-k.x(),U=this.getHeight()-k.y();k.move({x:-T,y:-R}),b.move({x:A,y:U})}var I=this.findOne(".top-left").getAbsolutePosition();e=I.x,n=I.y;var N=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:n,width:N,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(n=>{n._fire("transformend",{evt:t,target:n})}),this._movingAnchorName=null}}_fitNodesInto(t,e){var n=this._getNodeRect();const r=1;if(Yt.Util._inRange(t.width,-this.padding()*2-r,r)){this.update();return}if(Yt.Util._inRange(t.height,-this.padding()*2-r,r)){this.update();return}const s=this.flipEnabled();var a=new Yt.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()(n,t);d?t=d:Yt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,l=new Yt.Transform;l.translate(n.x,n.y),l.rotate(n.rotation),l.scale(n.width/o,n.height/o);const h=new Yt.Transform;h.translate(t.x,t.y),h.rotate(t.rotation),h.scale(t.width/o,t.height/o);const c=h.multiply(l.invert());this._nodes.forEach(d=>{var f;const u=d.getParent().getAbsoluteTransform(),g=d.getTransform().copy();g.translate(d.offsetX(),d.offsetY());const m=new Yt.Transform;m.multiply(u.copy().invert()).multiply(c).multiply(u).multiply(g);const y=m.decompose();d.setAttrs(y),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(Yt.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(Yt.Util._getRotation(e.rotation));var n=e.width,r=e.height,s=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),l=this.anchorSize();const h=this.find("._anchor");h.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+o,offsetY:l/2+o,visible:a&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:l/2+o,visible:a&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:l/2-o,offsetY:l/2+o,visible:a&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:l/2+o,visible:a&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:l/2-o,visible:a&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:l/2+o,offsetY:l/2-o,visible:a&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:l/2-o,visible:a&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:l/2-o,offsetY:l/2-o,visible:a&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*Yt.Util._sign(r)-o,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&h.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=""),o1.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return a1.Node.prototype.toObject.call(this)}clone(t){var e=a1.Node.prototype.clone.call(this,t);return e}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}s1=vs.Transformer=zt;function V6(i){return i instanceof Array||Yt.Util.warn("enabledAnchors value should be an array"),i instanceof Array&&i.forEach(function(t){Qa.indexOf(t)===-1&&Yt.Util.warn("Unknown anchor name: "+t+". Available names are: "+Qa.join(", "))}),i||[]}zt.prototype.className="Transformer",(0,F6._registerNode)(zt),Vt.Factory.addGetterSetter(zt,"enabledAnchors",Qa,V6),Vt.Factory.addGetterSetter(zt,"flipEnabled",!0,(0,Di.getBooleanValidator)()),Vt.Factory.addGetterSetter(zt,"resizeEnabled",!0),Vt.Factory.addGetterSetter(zt,"anchorSize",10,(0,Di.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"rotateEnabled",!0),Vt.Factory.addGetterSetter(zt,"rotationSnaps",[]),Vt.Factory.addGetterSetter(zt,"rotateAnchorOffset",50,(0,Di.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"rotateAnchorCursor","crosshair"),Vt.Factory.addGetterSetter(zt,"rotationSnapTolerance",5,(0,Di.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"borderEnabled",!0),Vt.Factory.addGetterSetter(zt,"anchorStroke","rgb(0, 161, 255)"),Vt.Factory.addGetterSetter(zt,"anchorStrokeWidth",1,(0,Di.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"anchorFill","white"),Vt.Factory.addGetterSetter(zt,"anchorCornerRadius",0,(0,Di.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"borderStroke","rgb(0, 161, 255)"),Vt.Factory.addGetterSetter(zt,"borderStrokeWidth",1,(0,Di.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"borderDash"),Vt.Factory.addGetterSetter(zt,"keepRatio",!0),Vt.Factory.addGetterSetter(zt,"shiftBehavior","default"),Vt.Factory.addGetterSetter(zt,"centeredScaling",!1),Vt.Factory.addGetterSetter(zt,"ignoreStroke",!1),Vt.Factory.addGetterSetter(zt,"padding",0,(0,Di.getNumberValidator)()),Vt.Factory.addGetterSetter(zt,"node"),Vt.Factory.addGetterSetter(zt,"nodes"),Vt.Factory.addGetterSetter(zt,"boundBoxFunc"),Vt.Factory.addGetterSetter(zt,"anchorDragBoundFunc"),Vt.Factory.addGetterSetter(zt,"anchorStyleFunc"),Vt.Factory.addGetterSetter(zt,"shouldOverdrawWholeArea",!1),Vt.Factory.addGetterSetter(zt,"useSingleNodeRotation",!0),Vt.Factory.backCompat(zt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});const q6=St(wt({__proto__:null,get Transformer(){return s1},default:vs},[vs]));var _s={};Object.defineProperty(_s,"__esModule",{value:!0});var f1=_s.Wedge=void 0;const to=It,X6=pe,Y6=Ot,d1=Ft,W6=Ot;class pi extends X6.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,Y6.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)}}f1=_s.Wedge=pi,pi.prototype.className="Wedge",pi.prototype._centroid=!0,pi.prototype._attrsAffectingSize=["radius"],(0,W6._registerNode)(pi),to.Factory.addGetterSetter(pi,"radius",0,(0,d1.getNumberValidator)()),to.Factory.addGetterSetter(pi,"angle",0,(0,d1.getNumberValidator)()),to.Factory.addGetterSetter(pi,"clockwise",!1),to.Factory.backCompat(pi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});const K6=St(wt({__proto__:null,get Wedge(){return f1},default:_s},[_s]));var ys={};Object.defineProperty(ys,"__esModule",{value:!0});var g1=ys.Blur=void 0;const p1=It,Z6=oe,J6=Ft;function m1(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var Q6=[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],t8=[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 e8(i,t){var e=i.data,n=i.width,r=i.height,s,a,o,l,h,c,d,f,u,g,m,y,x,C,v,b,k,T,R,A,U,I,N,q,W=t+t+1,K=n-1,it=r-1,pt=t+1,vt=pt*(pt+1)/2,dt=new m1,_t=null,yt=dt,L=null,M=null,E=Q6[t],F=t8[t];for(o=1;o<W;o++)yt=yt.next=new m1,o===pt&&(_t=yt);for(yt.next=dt,d=c=0,a=0;a<r;a++){for(b=k=T=R=f=u=g=m=0,y=pt*(A=e[c]),x=pt*(U=e[c+1]),C=pt*(I=e[c+2]),v=pt*(N=e[c+3]),f+=vt*A,u+=vt*U,g+=vt*I,m+=vt*N,yt=dt,o=0;o<pt;o++)yt.r=A,yt.g=U,yt.b=I,yt.a=N,yt=yt.next;for(o=1;o<pt;o++)l=c+((K<o?K:o)<<2),f+=(yt.r=A=e[l])*(q=pt-o),u+=(yt.g=U=e[l+1])*q,g+=(yt.b=I=e[l+2])*q,m+=(yt.a=N=e[l+3])*q,b+=A,k+=U,T+=I,R+=N,yt=yt.next;for(L=dt,M=_t,s=0;s<n;s++)e[c+3]=N=m*E>>F,N!==0?(N=255/N,e[c]=(f*E>>F)*N,e[c+1]=(u*E>>F)*N,e[c+2]=(g*E>>F)*N):e[c]=e[c+1]=e[c+2]=0,f-=y,u-=x,g-=C,m-=v,y-=L.r,x-=L.g,C-=L.b,v-=L.a,l=d+((l=s+t+1)<K?l:K)<<2,b+=L.r=e[l],k+=L.g=e[l+1],T+=L.b=e[l+2],R+=L.a=e[l+3],f+=b,u+=k,g+=T,m+=R,L=L.next,y+=A=M.r,x+=U=M.g,C+=I=M.b,v+=N=M.a,b-=A,k-=U,T-=I,R-=N,M=M.next,c+=4;d+=n}for(s=0;s<n;s++){for(k=T=R=b=u=g=m=f=0,c=s<<2,y=pt*(A=e[c]),x=pt*(U=e[c+1]),C=pt*(I=e[c+2]),v=pt*(N=e[c+3]),f+=vt*A,u+=vt*U,g+=vt*I,m+=vt*N,yt=dt,o=0;o<pt;o++)yt.r=A,yt.g=U,yt.b=I,yt.a=N,yt=yt.next;for(h=n,o=1;o<=t;o++)c=h+s<<2,f+=(yt.r=A=e[c])*(q=pt-o),u+=(yt.g=U=e[c+1])*q,g+=(yt.b=I=e[c+2])*q,m+=(yt.a=N=e[c+3])*q,b+=A,k+=U,T+=I,R+=N,yt=yt.next,o<it&&(h+=n);for(c=s,L=dt,M=_t,a=0;a<r;a++)l=c<<2,e[l+3]=N=m*E>>F,N>0?(N=255/N,e[l]=(f*E>>F)*N,e[l+1]=(u*E>>F)*N,e[l+2]=(g*E>>F)*N):e[l]=e[l+1]=e[l+2]=0,f-=y,u-=x,g-=C,m-=v,y-=L.r,x-=L.g,C-=L.b,v-=L.a,l=s+((l=a+pt)<it?l:it)*n<<2,f+=b+=L.r=e[l],u+=k+=L.g=e[l+1],g+=T+=L.b=e[l+2],m+=R+=L.a=e[l+3],L=L.next,y+=A=M.r,x+=U=M.g,C+=I=M.b,v+=N=M.a,b-=A,k-=U,T-=I,R-=N,M=M.next,c+=n}}const i8=function(t){var e=Math.round(this.blurRadius());e>0&&e8(t,e)};g1=ys.Blur=i8,p1.Factory.addGetterSetter(Z6.Node,"blurRadius",0,(0,J6.getNumberValidator)(),p1.Factory.afterSetFilter);const n8=St(wt({__proto__:null,get Blur(){return g1},default:ys},[ys]));var bs={};Object.defineProperty(bs,"__esModule",{value:!0});var v1=bs.Brighten=void 0;const _1=It,r8=oe,s8=Ft,a8=function(i){var t=this.brightness()*255,e=i.data,n=e.length,r;for(r=0;r<n;r+=4)e[r]+=t,e[r+1]+=t,e[r+2]+=t};v1=bs.Brighten=a8,_1.Factory.addGetterSetter(r8.Node,"brightness",0,(0,s8.getNumberValidator)(),_1.Factory.afterSetFilter);const o8=St(wt({__proto__:null,get Brighten(){return v1},default:bs},[bs]));var ws={};Object.defineProperty(ws,"__esModule",{value:!0});var y1=ws.Contrast=void 0;const b1=It,l8=oe,h8=Ft,c8=function(i){var t=Math.pow((this.contrast()+100)/100,2),e=i.data,n=e.length,r=150,s=150,a=150,o;for(o=0;o<n;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};y1=ws.Contrast=c8,b1.Factory.addGetterSetter(l8.Node,"contrast",0,(0,h8.getNumberValidator)(),b1.Factory.afterSetFilter);const u8=St(wt({__proto__:null,get Contrast(){return y1},default:ws},[ws]));var xs={};Object.defineProperty(xs,"__esModule",{value:!0});var w1=xs.Emboss=void 0;const Ii=It,eo=oe,f8=ee,x1=Ft,d8=function(i){var t=this.embossStrength()*10,e=this.embossWhiteLevel()*255,n=this.embossDirection(),r=this.embossBlend(),s=0,a=0,o=i.data,l=i.width,h=i.height,c=l*4,d=h;switch(n){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:f8.Util.error("Unknown emboss direction: "+n)}do{var f=(d-1)*c,u=s;d+u<1&&(u=0),d+u>h&&(u=0);var g=(d-1+u)*l*4,m=l;do{var y=f+(m-1)*4,x=a;m+x<1&&(x=0),m+x>l&&(x=0);var C=g+(m-1+x)*4,v=o[y]-o[C],b=o[y+1]-o[C+1],k=o[y+2]-o[C+2],T=v,R=T>0?T:-T,A=b>0?b:-b,U=k>0?k:-k;if(A>R&&(T=b),U>R&&(T=k),T*=t,r){var I=o[y]+T,N=o[y+1]+T,q=o[y+2]+T;o[y]=I>255?255:I<0?0:I,o[y+1]=N>255?255:N<0?0:N,o[y+2]=q>255?255:q<0?0:q}else{var W=e-T;W<0?W=0:W>255&&(W=255),o[y]=o[y+1]=o[y+2]=W}}while(--m)}while(--d)};w1=xs.Emboss=d8,Ii.Factory.addGetterSetter(eo.Node,"embossStrength",.5,(0,x1.getNumberValidator)(),Ii.Factory.afterSetFilter),Ii.Factory.addGetterSetter(eo.Node,"embossWhiteLevel",.5,(0,x1.getNumberValidator)(),Ii.Factory.afterSetFilter),Ii.Factory.addGetterSetter(eo.Node,"embossDirection","top-left",null,Ii.Factory.afterSetFilter),Ii.Factory.addGetterSetter(eo.Node,"embossBlend",!1,null,Ii.Factory.afterSetFilter);const g8=St(wt({__proto__:null,get Emboss(){return w1},default:xs},[xs]));var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});var S1=Ss.Enhance=void 0;const C1=It,p8=oe,m8=Ft;function Ch(i,t,e,n,r){var s=e-t,a=r-n,o;return s===0?n+a/2:a===0?n:(o=(i-t)/s,o=a*o+n,o)}const v8=function(i){var t=i.data,e=t.length,n=t[0],r=n,s,a=t[1],o=a,l,h=t[2],c=h,d,f,u=this.enhance();if(u!==0){for(f=0;f<e;f+=4)s=t[f+0],s<n?n=s:s>r&&(r=s),l=t[f+1],l<a?a=l:l>o&&(o=l),d=t[f+2],d<h?h=d:d>c&&(c=d);r===n&&(r=255,n=0),o===a&&(o=255,a=0),c===h&&(c=255,h=0);var g,m,y,x,C,v,b,k,T;for(u>0?(m=r+u*(255-r),y=n-u*(n-0),C=o+u*(255-o),v=a-u*(a-0),k=c+u*(255-c),T=h-u*(h-0)):(g=(r+n)*.5,m=r+u*(r-g),y=n+u*(n-g),x=(o+a)*.5,C=o+u*(o-x),v=a+u*(a-x),b=(c+h)*.5,k=c+u*(c-b),T=h+u*(h-b)),f=0;f<e;f+=4)t[f+0]=Ch(t[f+0],n,r,y,m),t[f+1]=Ch(t[f+1],a,o,v,C),t[f+2]=Ch(t[f+2],h,c,T,k)}};S1=Ss.Enhance=v8,C1.Factory.addGetterSetter(p8.Node,"enhance",0,(0,m8.getNumberValidator)(),C1.Factory.afterSetFilter);const _8=St(wt({__proto__:null,get Enhance(){return S1},default:Ss},[Ss]));var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});var k1=Cs.Grayscale=void 0;const y8=function(i){var t=i.data,e=t.length,n,r;for(n=0;n<e;n+=4)r=.34*t[n]+.5*t[n+1]+.16*t[n+2],t[n]=r,t[n+1]=r,t[n+2]=r};k1=Cs.Grayscale=y8;const b8=St(wt({__proto__:null,get Grayscale(){return k1},default:Cs},[Cs]));var ks={};Object.defineProperty(ks,"__esModule",{value:!0});var E1=ks.HSL=void 0;const zn=It,kh=oe,Eh=Ft;zn.Factory.addGetterSetter(kh.Node,"hue",0,(0,Eh.getNumberValidator)(),zn.Factory.afterSetFilter),zn.Factory.addGetterSetter(kh.Node,"saturation",0,(0,Eh.getNumberValidator)(),zn.Factory.afterSetFilter),zn.Factory.addGetterSetter(kh.Node,"luminance",0,(0,Eh.getNumberValidator)(),zn.Factory.afterSetFilter);const w8=function(i){var t=i.data,e=t.length,n=1,r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o,l=n*r*Math.cos(s*Math.PI/180),h=n*r*Math.sin(s*Math.PI/180),c=.299*n+.701*l+.167*h,d=.587*n-.587*l+.33*h,f=.114*n-.114*l-.497*h,u=.299*n-.299*l-.328*h,g=.587*n+.413*l+.035*h,m=.114*n-.114*l+.293*h,y=.299*n-.3*l+1.25*h,x=.587*n-.586*l-1.05*h,C=.114*n+.886*l-.2*h,v,b,k,T;for(o=0;o<e;o+=4)v=t[o+0],b=t[o+1],k=t[o+2],T=t[o+3],t[o+0]=c*v+d*b+f*k+a,t[o+1]=u*v+g*b+m*k+a,t[o+2]=y*v+x*b+C*k+a,t[o+3]=T};E1=ks.HSL=w8;const x8=St(wt({__proto__:null,get HSL(){return E1},default:ks},[ks]));var Es={};Object.defineProperty(Es,"__esModule",{value:!0});var T1=Es.HSV=void 0;const jn=It,Th=oe,Ph=Ft,S8=function(i){var t=i.data,e=t.length,n=Math.pow(2,this.value()),r=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,a,o=n*r*Math.cos(s*Math.PI/180),l=n*r*Math.sin(s*Math.PI/180),h=.299*n+.701*o+.167*l,c=.587*n-.587*o+.33*l,d=.114*n-.114*o-.497*l,f=.299*n-.299*o-.328*l,u=.587*n+.413*o+.035*l,g=.114*n-.114*o+.293*l,m=.299*n-.3*o+1.25*l,y=.587*n-.586*o-1.05*l,x=.114*n+.886*o-.2*l,C,v,b,k;for(a=0;a<e;a+=4)C=t[a+0],v=t[a+1],b=t[a+2],k=t[a+3],t[a+0]=h*C+c*v+d*b,t[a+1]=f*C+u*v+g*b,t[a+2]=m*C+y*v+x*b,t[a+3]=k};T1=Es.HSV=S8,jn.Factory.addGetterSetter(Th.Node,"hue",0,(0,Ph.getNumberValidator)(),jn.Factory.afterSetFilter),jn.Factory.addGetterSetter(Th.Node,"saturation",0,(0,Ph.getNumberValidator)(),jn.Factory.afterSetFilter),jn.Factory.addGetterSetter(Th.Node,"value",0,(0,Ph.getNumberValidator)(),jn.Factory.afterSetFilter);const C8=St(wt({__proto__:null,get HSV(){return T1},default:Es},[Es]));var Ts={};Object.defineProperty(Ts,"__esModule",{value:!0});var P1=Ts.Invert=void 0;const k8=function(i){var t=i.data,e=t.length,n;for(n=0;n<e;n+=4)t[n]=255-t[n],t[n+1]=255-t[n+1],t[n+2]=255-t[n+2]};P1=Ts.Invert=k8;const E8=St(wt({__proto__:null,get Invert(){return P1},default:Ts},[Ts]));var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});var A1=Ps.Kaleidoscope=void 0;const io=It,M1=oe,R1=ee,L1=Ft;var T8=function(i,t,e){var n=i.data,r=t.data,s=i.width,a=i.height,o=e.polarCenterX||s/2,l=e.polarCenterY||a/2,h,c,d,f=0,u=0,g=0,m=0,y,x=Math.sqrt(o*o+l*l);c=s-o,d=a-l,y=Math.sqrt(c*c+d*d),x=y>x?y:x;var C=a,v=s,b,k,T=360/v*Math.PI/180,R,A;for(k=0;k<v;k+=1)for(R=Math.sin(k*T),A=Math.cos(k*T),b=0;b<C;b+=1)c=Math.floor(o+x*b/C*A),d=Math.floor(l+x*b/C*R),h=(d*s+c)*4,f=n[h+0],u=n[h+1],g=n[h+2],m=n[h+3],h=(k+b*s)*4,r[h+0]=f,r[h+1]=u,r[h+2]=g,r[h+3]=m},P8=function(i,t,e){var n=i.data,r=t.data,s=i.width,a=i.height,o=e.polarCenterX||s/2,l=e.polarCenterY||a/2,h,c,d,f,u,g=0,m=0,y=0,x=0,C,v=Math.sqrt(o*o+l*l);c=s-o,d=a-l,C=Math.sqrt(c*c+d*d),v=C>v?C:v;var b=a,k=s,T,R,A=e.polarRotation||0,U,I;for(c=0;c<s;c+=1)for(d=0;d<a;d+=1)f=c-o,u=d-l,T=Math.sqrt(f*f+u*u)*b/v,R=(Math.atan2(u,f)*180/Math.PI+360+A)%360,R=R*k/360,U=Math.floor(R),I=Math.floor(T),h=(I*s+U)*4,g=n[h+0],m=n[h+1],y=n[h+2],x=n[h+3],h=(d*s+c)*4,r[h+0]=g,r[h+1]=m,r[h+2]=y,r[h+3]=x};const A8=function(i){var t=i.width,e=i.height,n,r,s,a,o,l,h,c,d,f,u=Math.round(this.kaleidoscopePower()),g=Math.round(this.kaleidoscopeAngle()),m=Math.floor(t*(g%360)/360);if(!(u<1)){var y=R1.Util.createCanvasElement();y.width=t,y.height=e;var x=y.getContext("2d").getImageData(0,0,t,e);R1.Util.releaseCanvas(y),T8(i,x,{polarCenterX:t/2,polarCenterY:e/2});for(var C=t/Math.pow(2,u);C<=8;)C=C*2,u-=1;C=Math.ceil(C);var v=C,b=0,k=v,T=1;for(m+C>t&&(b=v,k=0,T=-1),r=0;r<e;r+=1)for(n=b;n!==k;n+=T)s=Math.round(n+m)%t,d=(t*r+s)*4,o=x.data[d+0],l=x.data[d+1],h=x.data[d+2],c=x.data[d+3],f=(t*r+n)*4,x.data[f+0]=o,x.data[f+1]=l,x.data[f+2]=h,x.data[f+3]=c;for(r=0;r<e;r+=1)for(v=Math.floor(C),a=0;a<u;a+=1){for(n=0;n<v+1;n+=1)d=(t*r+n)*4,o=x.data[d+0],l=x.data[d+1],h=x.data[d+2],c=x.data[d+3],f=(t*r+v*2-n-1)*4,x.data[f+0]=o,x.data[f+1]=l,x.data[f+2]=h,x.data[f+3]=c;v*=2}P8(x,i,{polarRotation:0})}};A1=Ps.Kaleidoscope=A8,io.Factory.addGetterSetter(M1.Node,"kaleidoscopePower",2,(0,L1.getNumberValidator)(),io.Factory.afterSetFilter),io.Factory.addGetterSetter(M1.Node,"kaleidoscopeAngle",0,(0,L1.getNumberValidator)(),io.Factory.afterSetFilter);const M8=St(wt({__proto__:null,get Kaleidoscope(){return A1},default:Ps},[Ps]));var As={};Object.defineProperty(As,"__esModule",{value:!0});var D1=As.Mask=void 0;const I1=It,R8=oe,L8=Ft;function no(i,t,e){var n=(e*i.width+t)*4,r=[];return r.push(i.data[n++],i.data[n++],i.data[n++],i.data[n++]),r}function Ms(i,t){return Math.sqrt(Math.pow(i[0]-t[0],2)+Math.pow(i[1]-t[1],2)+Math.pow(i[2]-t[2],2))}function D8(i){for(var t=[0,0,0],e=0;e<i.length;e++)t[0]+=i[e][0],t[1]+=i[e][1],t[2]+=i[e][2];return t[0]/=i.length,t[1]/=i.length,t[2]/=i.length,t}function I8(i,t){var e=no(i,0,0),n=no(i,i.width-1,0),r=no(i,0,i.height-1),s=no(i,i.width-1,i.height-1),a=t||10;if(Ms(e,n)<a&&Ms(n,s)<a&&Ms(s,r)<a&&Ms(r,e)<a){for(var o=D8([n,e,s,r]),l=[],h=0;h<i.width*i.height;h++){var c=Ms(o,[i.data[h*4],i.data[h*4+1],i.data[h*4+2]]);l[h]=c<a?0:255}return l}}function O8(i,t){for(var e=0;e<i.width*i.height;e++)i.data[4*e+3]=t[e]}function F8(i,t,e){for(var n=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var l=0;l<t;l++){for(var h=o*t+l,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,g=l+f-s;if(u>=0&&u<e&&g>=0&&g<t){var m=u*t+g,y=n[d*r+f];c+=i[m]*y}}a[h]=c===255*8?255:0}return a}function N8(i,t,e){for(var n=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var l=0;l<t;l++){for(var h=o*t+l,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,g=l+f-s;if(u>=0&&u<e&&g>=0&&g<t){var m=u*t+g,y=n[d*r+f];c+=i[m]*y}}a[h]=c>=255*4?255:0}return a}function U8(i,t,e){for(var n=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],r=Math.round(Math.sqrt(n.length)),s=Math.floor(r/2),a=[],o=0;o<e;o++)for(var l=0;l<t;l++){for(var h=o*t+l,c=0,d=0;d<r;d++)for(var f=0;f<r;f++){var u=o+d-s,g=l+f-s;if(u>=0&&u<e&&g>=0&&g<t){var m=u*t+g,y=n[d*r+f];c+=i[m]*y}}a[h]=c}return a}const G8=function(i){var t=this.threshold(),e=I8(i,t);return e&&(e=F8(e,i.width,i.height),e=N8(e,i.width,i.height),e=U8(e,i.width,i.height),O8(i,e)),i};D1=As.Mask=G8,I1.Factory.addGetterSetter(R8.Node,"threshold",0,(0,L8.getNumberValidator)(),I1.Factory.afterSetFilter);const B8=St(wt({__proto__:null,get Mask(){return D1},default:As},[As]));var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});var O1=Rs.Noise=void 0;const F1=It,$8=oe,z8=Ft,j8=function(i){var t=this.noise()*255,e=i.data,n=e.length,r=t/2,s;for(s=0;s<n;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()};O1=Rs.Noise=j8,F1.Factory.addGetterSetter($8.Node,"noise",.2,(0,z8.getNumberValidator)(),F1.Factory.afterSetFilter);const H8=St(wt({__proto__:null,get Noise(){return O1},default:Rs},[Rs]));var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});var N1=Ls.Pixelate=void 0;const U1=It,V8=ee,q8=oe,X8=Ft,Y8=function(i){var t=Math.ceil(this.pixelSize()),e=i.width,n=i.height,r,s,a,o,l,h,c,d=Math.ceil(e/t),f=Math.ceil(n/t),u,g,m,y,x,C,v,b=i.data;if(t<=0){V8.Util.error("pixelSize value can not be <= 0");return}for(x=0;x<d;x+=1)for(C=0;C<f;C+=1){for(o=0,l=0,h=0,c=0,u=x*t,g=u+t,m=C*t,y=m+t,v=0,r=u;r<g;r+=1)if(!(r>=e))for(s=m;s<y;s+=1)s>=n||(a=(e*s+r)*4,o+=b[a+0],l+=b[a+1],h+=b[a+2],c+=b[a+3],v+=1);for(o=o/v,l=l/v,h=h/v,c=c/v,r=u;r<g;r+=1)if(!(r>=e))for(s=m;s<y;s+=1)s>=n||(a=(e*s+r)*4,b[a+0]=o,b[a+1]=l,b[a+2]=h,b[a+3]=c)}};N1=Ls.Pixelate=Y8,U1.Factory.addGetterSetter(q8.Node,"pixelSize",8,(0,X8.getNumberValidator)(),U1.Factory.afterSetFilter);const W8=St(wt({__proto__:null,get Pixelate(){return N1},default:Ls},[Ls]));var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});var G1=Ds.Posterize=void 0;const B1=It,K8=oe,Z8=Ft,J8=function(i){var t=Math.round(this.levels()*254)+1,e=i.data,n=e.length,r=255/t,s;for(s=0;s<n;s+=1)e[s]=Math.floor(e[s]/r)*r};G1=Ds.Posterize=J8,B1.Factory.addGetterSetter(K8.Node,"levels",.5,(0,Z8.getNumberValidator)(),B1.Factory.afterSetFilter);const Q8=St(wt({__proto__:null,get Posterize(){return G1},default:Ds},[Ds]));var Is={};Object.defineProperty(Is,"__esModule",{value:!0});var $1=Is.RGB=void 0;const ro=It,Ah=oe,tb=Ft,eb=function(i){var t=i.data,e=t.length,n=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*n,t[a+1]=o*r,t[a+2]=o*s,t[a+3]=t[a+3]};$1=Is.RGB=eb,ro.Factory.addGetterSetter(Ah.Node,"red",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),ro.Factory.addGetterSetter(Ah.Node,"green",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),ro.Factory.addGetterSetter(Ah.Node,"blue",0,tb.RGBComponent,ro.Factory.afterSetFilter);const ib=St(wt({__proto__:null,get RGB(){return $1},default:Is},[Is]));var Os={};Object.defineProperty(Os,"__esModule",{value:!0});var z1=Os.RGBA=void 0;const Fs=It,so=oe,nb=Ft,rb=function(i){var t=i.data,e=t.length,n=this.red(),r=this.green(),s=this.blue(),a=this.alpha(),o,l;for(o=0;o<e;o+=4)l=1-a,t[o]=n*a+t[o]*l,t[o+1]=r*a+t[o+1]*l,t[o+2]=s*a+t[o+2]*l};z1=Os.RGBA=rb,Fs.Factory.addGetterSetter(so.Node,"red",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),Fs.Factory.addGetterSetter(so.Node,"green",0,function(i){return this._filterUpToDate=!1,i>255?255:i<0?0:Math.round(i)}),Fs.Factory.addGetterSetter(so.Node,"blue",0,nb.RGBComponent,Fs.Factory.afterSetFilter),Fs.Factory.addGetterSetter(so.Node,"alpha",1,function(i){return this._filterUpToDate=!1,i>1?1:i<0?0:i});const sb=St(wt({__proto__:null,get RGBA(){return z1},default:Os},[Os]));var Ns={};Object.defineProperty(Ns,"__esModule",{value:!0});var j1=Ns.Sepia=void 0;const ab=function(i){var t=i.data,e=t.length,n,r,s,a;for(n=0;n<e;n+=4)r=t[n+0],s=t[n+1],a=t[n+2],t[n+0]=Math.min(255,r*.393+s*.769+a*.189),t[n+1]=Math.min(255,r*.349+s*.686+a*.168),t[n+2]=Math.min(255,r*.272+s*.534+a*.131)};j1=Ns.Sepia=ab;const ob=St(wt({__proto__:null,get Sepia(){return j1},default:Ns},[Ns]));var Us={};Object.defineProperty(Us,"__esModule",{value:!0});var H1=Us.Solarize=void 0;const lb=function(i){var t=i.data,e=i.width,n=i.height,r=e*4,s=n;do{var a=(s-1)*r,o=e;do{var l=a+(o-1)*4,h=t[l],c=t[l+1],d=t[l+2];h>127&&(h=255-h),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=h,t[l+1]=c,t[l+2]=d}while(--o)}while(--s)};H1=Us.Solarize=lb;const hb=St(wt({__proto__:null,get Solarize(){return H1},default:Us},[Us]));var Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});var V1=Gs.Threshold=void 0;const q1=It,cb=oe,ub=Ft,fb=function(i){var t=this.threshold()*255,e=i.data,n=e.length,r;for(r=0;r<n;r+=1)e[r]=e[r]<t?0:255};V1=Gs.Threshold=fb,q1.Factory.addGetterSetter(cb.Node,"threshold",.5,(0,ub.getNumberValidator)(),q1.Factory.afterSetFilter);const db=St(wt({__proto__:null,get Threshold(){return V1},default:Gs},[Gs]));Object.defineProperty(qr,"__esModule",{value:!0});var X1=qr.Konva=void 0;const Y1=_4,gb=w4,pb=M4,mb=O4,vb=U4,_b=$4,W1=X4,yb=vd,bb=lh,wb=Rd,xb=e6,Sb=r6,Cb=l6,kb=u6,Eb=Qd,Tb=D6,Pb=q6,Ab=K6,Mb=n8,Rb=o8,Lb=u8,Db=g8,Ib=_8,Ob=b8,Fb=x8,Nb=C8,Ub=E8,Gb=M8,Bb=B8,$b=H8,zb=W8,jb=Q8,Hb=ib,Vb=sb,qb=ob,Xb=hb,Yb=db;X1=qr.Konva=Y1.Konva.Util._assign(Y1.Konva,{Arc:gb.Arc,Arrow:pb.Arrow,Circle:mb.Circle,Ellipse:vb.Ellipse,Image:_b.Image,Label:W1.Label,Tag:W1.Tag,Line:yb.Line,Path:bb.Path,Rect:wb.Rect,RegularPolygon:xb.RegularPolygon,Ring:Sb.Ring,Sprite:Cb.Sprite,Star:kb.Star,Text:Eb.Text,TextPath:Tb.TextPath,Transformer:Pb.Transformer,Wedge:Ab.Wedge,Filters:{Blur:Mb.Blur,Brighten:Rb.Brighten,Contrast:Lb.Contrast,Emboss:Db.Emboss,Enhance:Ib.Enhance,Grayscale:Ob.Grayscale,HSL:Fb.HSL,HSV:Nb.HSV,Invert:Ub.Invert,Kaleidoscope:Gb.Kaleidoscope,Mask:Bb.Mask,Noise:$b.Noise,Pixelate:zb.Pixelate,Posterize:jb.Posterize,RGB:Hb.RGB,RGBA:Vb.RGBA,Sepia:qb.Sepia,Solarize:Xb.Solarize,Threshold:Yb.Threshold}});const Wb=St(wt({__proto__:null,get Konva(){return X1},default:qr},[qr]));var Kb=Ul.exports;Object.defineProperty(Kb,"__esModule",{value:!0});const Zb=Wb;Ul.exports=Zb.Konva;var Jb=Ul.exports;const xt=Pe(Jb),Qb=xt.Ellipse.prototype.toObject;xt.Ellipse.prototype.toObject=function(){const i=Qb.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const tw=xt.Line.prototype.toObject;xt.Line.prototype.toObject=function(){const i=tw.call(this);return{...i,attrs:{...i.attrs,x:this.getAbsolutePosition().x,y:this.getAbsolutePosition().y,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const ew=xt.Node.prototype.toObject,iw=function(){const i=ew.call(this);return{...i,attrs:{...i.attrs,x:this.getAbsolutePosition().x,y:this.getAbsolutePosition().y,scaleX:this.getAbsoluteScale().x,scaleY:this.getAbsoluteScale().y,rotation:this.getAbsoluteRotation(),opacity:this.getAbsoluteOpacity()}}};xt.Node.prototype.toObject=iw;const nw=xt.Node.prototype.remove;xt.Node.prototype.remove=function(){return nw.call(this),this.fire("removed",{target:this}),this};const rw=xt.Node.prototype.moveUp;xt.Node.prototype.moveUp=function(){const i=rw.call(this);return i&&this.fire("move:up"),i};const sw=xt.Node.prototype.moveDown;xt.Node.prototype.moveDown=function(){const i=sw.call(this);return i&&this.fire("move:down"),i};const aw=xt.Node.prototype.moveToTop;xt.Node.prototype.moveToTop=function(){const i=aw.call(this);return i&&this.fire("move:top"),i};const ow=xt.Node.prototype.moveToBottom;xt.Node.prototype.moveToBottom=function(){const i=ow.call(this);return i&&this.fire("move:bottom"),i};const lw=xt.Node.prototype.moveTo;xt.Node.prototype.moveTo=function(i){const t=lw.call(this,i);return this.fire("move:to"),t};const hw=xt.Rect.prototype.toObject;xt.Rect.prototype.toObject=function(){const i=hw.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash(),cornerRadius:this.cornerRadius()}}};const cw=xt.RegularPolygon.prototype.toObject;xt.RegularPolygon.prototype.toObject=function(){const i=cw.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash()}}};const uw=xt.Text.prototype.toObject;xt.Text.prototype.toObject=function(){const i=uw.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth()}}};const fw=xt.Image.prototype.toObject;xt.Image.prototype.toObject=function(){const i=fw.call(this);return{...i,attrs:{...i.attrs,strokeWidth:this.strokeWidth(),dash:this.dash(),image:this.image()}}};const K1=(i,t)=>{if(i.length!==t.length)return!1;for(let e=0;e<i.length;e++){const n=i[e],r=t.find(s=>s.id===n.id);if(!r||!dw(n,r))return!1}return!0},dw=(i,t)=>i.attrs.id===i.attrs.id&&i._id===t._id,Hn=i=>i.reduce((t,e)=>[...t,...e.toArray()],[]),gw=i=>{i.sort(function(e,n){return e-n});const t=Math.floor(i.length/2);return i[t]},Z1=i=>{const t=Math.atan2(i[1],i[0]),e=Math.pow(i[0],2)+Math.pow(i[1],2),n=Math.sqrt(e),r=(i[0]*i[3]-i[2]*i[1])/n;return{rotation:t/(Math.PI/180),scaleX:n,scaleY:r,x:i[4],y:i[5]}},pw=(i,t)=>{const e=i.getTransform().getMatrix(),n=t.getTransform().getMatrix(),r=e[0],s=e[1],a=e[2],o=e[3],l=e[4],h=e[5],c=n[0],d=n[1],f=n[2],u=n[3],g=n[4],m=n[5],y=c*u,x=d*f,C=(f*s-r*u)/(x-y),v=(c*s-r*d)/(y-x),b=(f*o-a*u)/(x-y),k=(c*o-a*d)/(y-x),T=(f*(h-m)+u*(g-l))/(x-y),R=(c*(h-m)+d*(g-l))/(y-x);return Z1([C,v,b,k,T,R])};class J1{app;constructor(t){this.app=t}}class mw extends J1{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 n=this.app.stage.getPointerPosition()??new Wt(0,0),r=new Wt((n.x-this.app.stage.x())/e,(n.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:n.x-r.x*a,y:n.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 Q1=i=>typeof i=="function";class vw extends J1{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&&Q1(e?.hooks?.onInactive)&&await e.hooks.onInactive?.(this.app,e),this.currentTool=t,this.currentTool?.hooks&&Q1(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 _w=Object.defineProperty,yw=Object.getOwnPropertyDescriptor,Oi=(i,t,e,n)=>{for(var r=n>1?void 0:n?yw(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&_w(t,e,r),r};class bw{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 n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignLeft(e),this},this.app.alignRight=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignRight(e),this},this.app.alignTop=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignTop(e),this},this.app.alignBottom=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignBottom(e),this},this.app.alignCenterX=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignCenterX(e),this},this.app.alignCenterY=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.alignCenterY(e),this},this.app.dispersionX=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.dispersionX(e),this},this.app.dispersionY=function(e){const n=this.app.getPlugin("alignmentPlugin");return n&&n.alignment?.dispersionY(e),this},this.keyFns.push(this.app.domKey.on({key:"a",title:"左对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"h",title:"水平居中",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"d",title:"右对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"w",title:"顶对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"v",title:"垂直居中",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"s",title:"底对齐",shift:!0},()=>{})),this.keyFns.push(this.app.domKey.on({key:"h",title:"水平分布",ctrl:!0,shift:!0},()=>{})),this.keyFns.push(this.app.domKey.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 Fi(i,t,e){const n=e.value;return e.value=function(...r){if(this.enabled)return n.apply(this,r);console.log(`Method ${t} is disabled.`)},e}class mi{app;enabled;constructor(t,e){const{enabled:n}=e;this.app=t,this.enabled=n}alignLeft(t){const e=t.map(r=>r.getClientRect()),n=Math.min(...e.map(r=>r.x));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].x-n;return a.attrs={...a.attrs,x:a.attrs.x-o},a}))}alignRight(t){const e=t.map(r=>r.getClientRect()),n=Math.max(...e.map(r=>r.x+r.width));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(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()),n=Math.min(...e.map(r=>r.y));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=e[s].y-n;return a.attrs={...a.attrs,y:a.attrs.y-o},a}))}alignBottom(t){const e=t.map(r=>r.getClientRect()),n=Math.max(...e.map(r=>r.y+r.height));this.app.update(...t.map((r,s)=>{const a=r.toObject(),o=n-(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()),n=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=n-(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()),n=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=n-(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 n=t[0],r=t[t.length-1],s=n.getClientRect()[e]+(e==="x"?n.getClientRect().width:n.getClientRect().height),a=r.getClientRect()[e]-s,l=t.slice(1,-1).reduce((d,f)=>d+(e==="x"?f.getClientRect().width:f.getClientRect().height),0),h=Math.max((a-l)/(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 g=c+h;return u.attrs[e]=g-d.getClientRect()[e]+u.attrs[e],c=g+(e==="x"?d.getClientRect().width:d.getClientRect().height),u}))}}Oi([Fi],mi.prototype,"alignLeft",1),Oi([Fi],mi.prototype,"alignRight",1),Oi([Fi],mi.prototype,"alignTop",1),Oi([Fi],mi.prototype,"alignBottom",1),Oi([Fi],mi.prototype,"alignCenterX",1),Oi([Fi],mi.prototype,"alignCenterY",1),Oi([Fi],mi.prototype,"dispersionX",1),Oi([Fi],mi.prototype,"dispersionY",1);class tg{app;selected;optionLayer;enabled;multipleSelect;hightLightConfig;transformerConfig;rubberConfig;transformer;rubberRect;rubberStartPoint=new Wt(0,0);rubberEnable=!1;hightLightRects;constructor(t,e){const{enabled:n,multipleSelect:r,transformer:s,hightLight:a,rubber:o}=e;this.app=t,this.selected=new Map,this.hightLightRects=new Map,this.enabled=n,this.multipleSelect=r,this.transformerConfig=s,this.hightLightConfig=a,this.rubberConfig=o,this.optionLayer=new xt.Layer,this.optionLayer.name("pictode:option:layer"),this.app.stage.add(this.optionLayer),this.transformer=new xt.Transformer({...this.transformerConfig,shouldOverdrawWholeArea:!1,flipEnabled:!1}),this.transformer.anchorStyleFunc(l=>{["middle-left","middle-right","top-center","bottom-center"].some(c=>l.hasName(c))&&([...this.selected.values()][0]instanceof xt.Text||[...this.selected.values()][0]instanceof xt.Group||this.selected.size>1)&&l.visible(!1);const h=(c="")=>{const d=l.getStage();!d||!d.content||(d.content.style.cursor=c)};l.on("mousedown",()=>{this.enabled=!1}),l.on("mouseup",()=>{this.enabled=!0}),l.on("mouseenter",()=>{this.enabled=!1,l.hasName("rotater")&&h("grabbing")}),l.on("mouseout",()=>{this.enabled=!0,l.hasName("rotater")&&h()})}),this.optionLayer.add(this.transformer),this.rubberRect=new xt.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&&(K1(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,n)=>{const r=new xt.Rect({stroke:this.hightLightConfig.stroke,strokeWidth:this.hightLightConfig.strokeWidth,dash:this.hightLightConfig.dash,fillEnabled:!1,strokeScaleEnabled:!1});this.calculateNodeRect(n,r,this.hightLightConfig.padding??0),this.optionLayer.add(r);const s=()=>requestAnimationFrame(()=>this.calculateNodeRect(n,r,this.hightLightConfig.padding??0));return n.on("dragmove transform xChange yChange",s),e.set(n.id(),{rect:r,transformHandler:s}),e},new Map)}removeHightRect(...t){t.forEach(e=>{const n=this.hightLightRects.get(e.id());n&&(e.off("dragmove transform xChange yChange",n.transformHandler),n.rect.remove(),this.hightLightRects.delete(e.id()))})}calculateNodeRect(t,e,n=0){const{x:r,y:s,width:a,height:o}=this.getNodeRect(t,n);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 n=f=>xt.angleDeg?f*Math.PI/180:f,r=[];let s=[];t instanceof xt.Group?s=t.getChildren():s=[t],s.map(f=>{const u=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.transformer.ignoreStroke()}),g=[{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}],m=f.getAbsoluteTransform();g.forEach(function(y){const x=m.point(y);r.push(new Wt(x.x,x.y))})});const a=new xt.Transform;a.rotate(-n(t.rotation()));let o,l,h,c;r.forEach(function(f){const u=a.point(f);(o===void 0||l===void 0||h===void 0||c===void 0)&&(o=h=u.x,l=c=u.y),o=Math.min(o,u.x),l=Math.min(l,u.y),h=Math.max(h,u.x),c=Math.max(c,u.y)}),a.invert();const d=a.point({x:(o??0)-e,y:(l??0)-e});return{x:d.x,y:d.y,width:(h??0)-(o??0)+e*2,height:(c??0)-(l??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 xt.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(Math.min(this.app.pointer.x,this.rubberStartPoint.x),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 xt.Stage||!t.target.attrs.id)return;const n=this.app.findTopGroup(t.target)??t.target;t.evt.shiftKey&&this.multipleSelect?this.selected.has(n.attrs.id)?this.cancelSelect(n):this.select(...this.selected.values(),n):this.select(n)};onMouseOut=t=>{t.target instanceof xt.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 ww={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 xw{name="selectorPlugin";selector;app;options;keyFns=[];constructor(t){this.options={...ww,...t}}install(t){this.app=t,this.selector=new tg(t,this.options),this.app.on("canvasCleared",this.onCanvasCleared),this.app.select=function(...e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.select(...e),this},this.app.cancelSelect=function(...e){const n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.cancelSelect(...e),this},this.app.selectByEvent=function(e){return this.app.getPlugin("selectorPlugin")&&(e.target instanceof xt.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 n=this.app.getPlugin("selectorPlugin");return n&&n.selector?.triggerSelector(e),this},this.app.isSelected=function(e){const n=this.app.getPlugin("selectorPlugin");return n?n.selector?.isSelected(e)??!1:!1},this.keyFns.push(this.app.domKey.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(this.app.domKey.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 Vn{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 Sw extends Vn{constructor(t,e){super(t,e)}execute(){this.app._add(...this.options.nodes)}undo(){this.app._remove(...this.options.nodes)}}class Cw extends Vn{constructor(t,e){super(t,e)}execute(){this.app._remove(...this.options.nodes)}undo(){this.app._add(...this.options.nodes)}}class kw extends Vn{constructor(t,e){super(t,e)}execute(){this.app._update(...this.options.newNodes)}undo(){this.app._update(...this.options.oldNodes)}}class Ew extends Vn{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 Tw extends Vn{constructor(t,e){super(t,e)}execute(){this.app._makeGroup(this.options.nodes)}undo(){this.app._decomposeGroup(this.options.group)}}class Pw extends Vn{constructor(t,e){super(t,e)}execute(){this.app._decomposeGroup(this.options.group)}undo(){this.app._makeGroup(this.options.nodes)}}class eg{name="history";app;enabled;stackSize;undoStack=[];redoStack=[];idCounter=0;constructor(t,e){const{enabled:n,stackSize:r}=e;this.app=t,this.enabled=n,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 Aw{name="historyPlugin";history;app;options;keyFns=[];oldNodes=[];constructor(t){this.options={enabled:!0,stackSize:100,...t}}install(t){this.app=t,this.history=new eg(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 n=this.app.getPlugin("historyPlugin");return n&&n.history?.undo(e),this},this.app.redo=function(e=1){const n=this.app.getPlugin("historyPlugin");return n&&n.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 n=this.app.getPlugin("historyPlugin");return n&&n.history?.jump(e),this},this.keyFns.push(this.app.domKey.on({key:"z",title:"撤销",exact:!0,ctrl:!0},()=>{this.app?.undo()})),this.keyFns.push(this.app.domKey.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 Sw(this.app,{nodes:t}))};onNodeRemove=t=>{!this.app||!this.history||this.history.execute(new Cw(this.app,{nodes:t}))};onNodeUpdateBefore=t=>{this.oldNodes=t.map(e=>e.toObject())};onNodeUpdated=t=>{!this.app||!this.history||this.history.execute(new kw(this.app,{oldNodes:this.oldNodes,newNodes:t.map(e=>e.toObject())}))};onNodeZIndexChanged=t=>{!this.app||!this.history||this.history.execute(new Ew(this.app,{nodes:t}))};onMakeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new Tw(this.app,{nodes:e,group:t}))};onDecomposeGroup=(t,e)=>{!this.app||!this.history||this.history.execute(new Pw(this.app,{nodes:e,group:t}))}}class Mw{name="diamondTool";hooks;config;diamond=null;startPointer=new Wt(0,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 xt.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,n=t.pointer.y-this.startPointer.y,r=new Wt(this.startPointer.x+e/2,this.startPointer.y+n/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 Rw{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 xt.Line({points:Hn(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(Hn(this.points)))}mouseup({app:t,pointer:e}){if(!this.line)return;const n=this.points.at(-1);this.points.length<=6&&n&&e.distanceTo(n)<10&&this.line&&this.line.destroy(),this.hooks?.onCompleteDrawing?.(t,this.line),this.line=null,this.points=[]}enableChanged(){this.line=null,this.points=[]}}class Lw{name="ellipseTool";config;hooks;ellipse=null;startPointer=new Wt(0,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 xt.Ellipse({radiusX:0,radiusY:0,strokeScaleEnabled:!1,...this.config}),this.ellipse.setPosition(this.startPointer),this.ellipse.radius(new Wt(0,0)),t.add(this.ellipse))}mousemove({app:t}){if(!this.ellipse)return;const e=t.pointer.x-this.startPointer.x,n=t.pointer.y-this.startPointer.y,r=new Wt(Math.abs(e)/2,Math.abs(n)/2);this.ellipse.setPosition(new Wt(this.startPointer.x+e/2,this.startPointer.y+n/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 Dw{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 xt.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 n=200,r=n*((this.imageElement.height??1)/(this.imageElement.width??1));this.image.width(n),this.image.height(r),this.image.position(new Wt(e.x-n/2,e.y-r/2)),t.render()}enableChanged(){this.image=null,this.imageElement=new Image}}class Iw{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 xt.Line({points:Hn(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(Hn(this.points))}mousemove({app:t,pointer:e}){this.line&&(this.line.points(Hn(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 Ow{name="rectTool";config;hooks;startPointer=new Wt(0,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 xt.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(Math.min(this.startPointer.x,t.pointer.x),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 Fw{name="selectTool";hooks;constructor(t){this.hooks=t.hooks}}const Nw=(i,t,e)=>{t.hide();const n=t.absolutePosition(),r={x:i.stage.container().offsetLeft+n.x,y:i.stage.container().offsetTop+n.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 l=0;navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&(l+=2+Math.round(t.fontSize()/20)),o+="translateY(-"+l+"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 g=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),m=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;(g||m)&&(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):i.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 Uw{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 xt.Text({...this.config,text:" ",x:e.x,y:e.y,fontFamily:"JiaYouYa"}),this.textNode.on("dblclick",({target:n})=>{Nw(t,n,()=>{this.hooks?.onCompleteDrawing?.(t,n)})}),t.add(this.textNode),this.textNode.fire("dblclick")}enableChanged(){this.textNode=null}}class Gw{name="eraserTool";hooks;targetMap=new Map;isEraser=!1;constructor(t){this.hooks=t.hooks}mousedown({event:t}){this.isEraser=!0,!(t.target instanceof xt.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:n})=>(e.opacity(n),e))),this.targetMap.clear(),this.isEraser=!1)}mousemove({event:t}){!this.isEraser||t.target instanceof xt.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 ig={backgroundColor:"#ffffff",scale:{min:.05,max:5},panning:{enabled:!1,cursor:"grabbing"},mousewheel:{enabled:!1,factor:.1}};class Bw extends _2{stage;mainLayer;config;domKey=new ua;mouse;tooler;installedPlugins=new Map;resizeObserver;constructor(t){super(),this.config={...ig,...t},this.stage=new xt.Stage({container:document.createElement("div"),width:500,height:500}),this.stage.container().style.backgroundColor=this.config.backgroundColor,this.mainLayer=new xt.Layer,this.mainLayer.name("main:layer"),this.stage.add(this.mainLayer),this.tooler=new vw(this),this.mouse=new mw(this),this.resizeObserver=new ResizeObserver(e=>{const{width:n,height:r}=e[0].contentRect;this.stage.width(n),this.stage.height(r),this.emit("resizeRoot",n,r),this.render()}),this.triggerPanning(this.config.panning.enabled),this.triggerMouseWheel(this.config.mousewheel.enabled),this.registerKeyFns()}registerKeyFns(){this.domKey.on({key:"o",title:"打开",exact:!0,ctrl:!0},()=>{zc().then(t=>Go(t[0])).then(t=>{this.fromJSON(t)})}),this.domKey.on({key:"e",title:"导出图片",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:"[",title:"下移一层",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:"]",title:"上移一层",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:"[",title:"置于底层",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:"]",title:"置于顶层",exact:!0,ctrl:!0,shift:!0},()=>{}),this.domKey.on({key:["delete","backspace"],title:"删除"},()=>{console.log("删除")}),this.domKey.on({key:"r",title:"重置画布",exact:!0,ctrl:!0},()=>{}),this.domKey.on({key:" ",title:"移动画布"},()=>(console.log("移动画布"),this.triggerPanning(!0),()=>{this.triggerPanning(!1)})),this.domKey.on({key:["Control","Meta"],title:"缩放画布"},()=>(this.triggerMouseWheel(!0),()=>{this.triggerMouseWheel(!1)})),this.domKey.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(t,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(`#${Tg()}`),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=n=>n.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 xt.Group&&this.emit("nodeGroupMake",e,t),e}_makeGroup(t){if(t.length<2)return t;const e=new xt.Group({draggable:!0});return e.add(...t.map(n=>(n.draggable(!1),n))),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,n=[...t.getChildren()].map(r=>{const{x:s,y:a,scaleX:o,scaleY:l,skewX:h,skewY:c,rotation:d}=r.getTransform().decompose();return r.moveTo(e),r.x(s),r.y(a),r.scaleX(o),r.scaleY(l),r.skewX(h),r.skewY(c),r.rotation(d),r});return this._remove(t),n}findTopGroup(t){return t.parent instanceof xt.Group&&t.parent.parent instanceof xt.Group?this.findTopGroup(t.parent):t.parent instanceof xt.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 n=t.map(r=>{const s={node:r,oldZIndex:r.getZIndex(),newZIndex:r.getZIndex()};return e(r),s.newZIndex=r.getZIndex(),s});n.some(({oldZIndex:r,newZIndex:s})=>r!==s)&&this.emit("nodeZindexChanged",n)}getNodeById(t){return this.getNodes(e=>e.id()===t)?.[0]}getNodes(t){return this.mainLayer.find(t)??[]}isPointInArea(t,e){const{width:n,height:r,x:s,y:a}=e;return t.x>=s&&t.x<=s+n&&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 n=t.getClientRect({relativeTo:this.stage}),r=e.getClientRect({relativeTo:this.stage}),s=n.x<=r.x&&n.y<=r.y,a=n.x+n.width>=r.x+r.width&&n.y<=r.y,o=n.x<=r.x&&n.y+n.height>=r.y+r.height,l=n.x+n.width>=r.x+r.width&&n.y+n.height>=r.y+r.height;return s&&a&&o&&l}render(){this.mainLayer.draw()}scale(){return this.stage.scaleX()}scaleTo(t,e=new Wt(0,0)){const n=this.scale();this.emit("canvasZoomStart",n);const r=Math.min(Math.max(t,this.config.scale.min),this.config.scale.max),s=new Wt((e.x-this.stage.x())/n,(e.y-this.stage.y())/n);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:n=10,pixelRatio:r=2,mimeType:s="image/png",quality:a=1,haveBackground:o=!1}=e??{},l=new xt.Layer;this.stage.add(l);let h=[];t&&t.length>0?h=t.map(T=>T.toObject()):h=this.mainLayer.children?.map(T=>T.toObject())??[];const c=h.map(T=>xt.Node.create(T));l.add(...c);const d=new xt.Transformer({rotateAnchorOffset:0});d.nodes(c);const f=d.getClientRect(),u=this.stage.scaleX(),g=this.stage.scaleY(),m=this.stage.x(),y=this.stage.y(),x=f.width+n*2,C=f.height+n*2,v=f.x-n,b=f.y-n,k=new xt.Rect({width:x,height:C,x:(v-m)/u,y:(b-y)/g,fill:this.stage.container().style.backgroundColor});return o&&(l.add(k),k.moveToBottom()),new Promise((T,R)=>{try{l.toDataURL({width:x,height:C,x:v,y:b,pixelRatio:r,mimeType:s,quality:a,callback:A=>{T({dataURL:A,width:x,height:C}),d.remove(),l.remove()}})}catch(A){R(A)}})}toJSON(){return JSON.stringify(this.mainLayer.toObject())}fromJSON(t){this.clear(),this.mainLayer.remove();const e=xt.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(n=>n?.enable?.()),this}disablePlugin(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.disable?.()),this}isPluginEnable(t){return this.getPlugin(t)?.isEnabled?.()??!1}destroyPlugins(t){return Array.isArray(t)||(t=[t]),this.getPlugins(t)?.forEach(n=>n?.destroy()),this}destroy(){this.resizeObserver.disconnect(),this.destroyPlugins(Array.from(this.installedPlugins.keys())),this.mouse.destroy(),this.tooler.destroy(),this.stage.destroy(),this.removeAllListeners()}}j.$=se,j.AlignmentPlugin=bw,j.Arrow=Jy,j.Ball=Qy,j.Ball3d=t3,j.Box=e3,j.C2S=qy,j.CanvasWrap=u3,j.DEFAULT_APP_CONFIG=ig,j.DOMEvent=dm,j.DOMKey=ua,j.DOMMedia=fm,j.DOMMouse=zo,j.DOMQuery=me,j.DOMScroll=gm,j.DOMUtil=om,j.Dep=Gf,j.DiamondTool=Mw,j.DrawingTool=Rw,j.EllipseTool=Lw,j.EraserTool=Gw,j.History=eg,j.HistoryPlugin=Aw,j.ImageTool=Dw,j.KonvaApp=Bw,j.Light=i3,j.Line=n3,j.LineTool=Iw,j.Matrix=Fr,j.PathGroup=en,j.Point=Wt,j.Point3d=r3,j.Polygon=Nr,j.QRCode=Ti,j.Query=Zt,j.Rect=Tl,j.RectTool=Ow,j.Segment=c3,j.SelectTool=Fw,j.Selector=tg,j.SelectorPlugin=xw,j.Shape=d0,j.Ship=s3,j.Slider=a3,j.TWEEN=vy,j.TextTool=Uw,j.Tree=h3,j.Triangle=o3,j.TriangleLight=l3,j.Vector=Pa,j.VideoUtil=Vr,j.WebGLRenderer=d3,j.WebRTCClient=f3,j.WebSocketClient=T2,j.YZRaphael=Ol,j.absolutize=Ma,j.addWatermark=H_,j.ajax=J_,j.angleToRadian=Ny,j.animateCanvas=pm,j.animateInWeb=su,j.appendUrlSearch=$o,j.base64URLDecode=K2,j.base64URLEncode=W2,j.blobToRawImage=m_,j.changeBrightness=z_,j.changeDiaphaneity=j_,j.changeSize=$_,j.clearCookies=um,j.compression=q_,j.createXMLHttpRequest=Nf,j.cssTransition=mm,j.distance=Gy,j.dquery=ru,j.drawQRCodeToCanvas=K_,j.drawSpirograph=Yy,j.drawStar=Wy,j.dynamicStrokeLine=Ky,j.fileOrBlobToDataURL=Sl,j.fileToArrayBufferPromise=jc,j.flatPoints=Hn,j.flipSideToSide=__,j.flipUpsideDown=y_,j.formDataToSearch=nu,j.getBrowserClient=O2,j.getBrowserClientVersion=F2,j.getBrowserLanguage=U2,j.getCanvasImageData=xl,j.getCanvasImageDataByBitmap=f_,j.getCanvasImageDataByVideo=u_,j.getCookie=hm,j.getCookieObject=cm,j.getDocumentElement=Bo,j.getElementLeftInPage=Yc,j.getElementPositionInPage=Xc,j.getElementPositionInPage2=R2,j.getElementPositionInViewport=L2,j.getElementTopInPage=Wc,j.getFileExtensionFromFile=Hc,j.getFileTypeFromFile=x2,j.getFilesImageInfo=c_,j.getFormElementData=Z_,j.getGroupCoords=pw,j.getImageDataByAIData=X_,j.getImageMainColor=v_,j.getInternetExplorerVersion=tu,j.getMiddleValue=gw,j.getMousePositionInElement=dr,j.getMousePositionInPage=Kc,j.getMousePositionInViewport=D2,j.getOperatingSystem=Hi,j.getOperatingSystemVersion=I2,j.getPageClient=ha,j.getPageScroll=xn,j.getPageSize=P2,j.getPointAtLength=i0,j.getRaphael=$y,j.getRawImageInfo=wl,j.getScrollParent=m3,j.getTimeZone=G2,j.getTotalLength=e0,j.getURL=iu,j.getUserGeolocationPromise=N2,j.getViewportSize=ca,j.gifImage=Lf,j.h=E2,j.handleDragAndDropFiles=C2,j.handleHashChange=sm,j.handleHistoryChange=am,j.handleInputFiles=S2,j.handleURLChange=rm,j.hasDocument=V2,j.hasHistory=q2,j.hasWindow=eu,j.hexStr2num=Ea,j.hexStr2rgbStr=El,j.hsv2rgb=oy,j.htmlElementToBlob=b2,j.ifWebFileHasChanged=Q_,j.imageDataToBitmap=d_,j.imageDataToBlob=p_,j.imageDataToDataURL=g_,j.isAndroid=Qc,j.isAppleDevice=B2,j.isBrowserSupportFileAPI=X2,j.isDarkMode=j2,j.isElementInViewport=M2,j.isElementInViewportSimple=A2,j.isIE=H2,j.isIOS=Zc,j.isMacOS=Jc,j.isMobile=$2,j.isPointInPath=n0,j.isPointInStroke=r0,j.isSvgPath=jf,j.isURL=Q2,j.isWechat=z2,j.jpgToPng=N_,j.leftRotate=b_,j.linkExport=w2,j.localstorage=jo,j.marginSharpen=F_,j.microTask=k2,j.mosaic=V_,j.mount=fr,j.normalize=Gr,j.num2HexStr=Bf,j.num2rgbStr=$f,j.outputGifBase64=Df,j.outputQRCodeBase64=W_,j.parse=Aa,j.parseURL=Z2,j.parseUrlParams=J2,j.patch=Vc,j.patchDOM=qc,j.pngToJpg=U_,j.qrDecompose=Z1,j.query=se,j.radianToAngle=Uy,j.radiusClip=B_,j.randomColorHexStr=ry,j.randomColorHexStr2=sy,j.randomColorNumber=ny,j.rappar=h0,j.reactiveVue2=ey,j.reactiveVue3=iy,j.readFileInBrowser=Go,j.recordToSearch=tm,j.recordToSearch2=em,j.rectClip=G_,j.rgb2hsv=ly,j.rgbStr2hexStr=ay,j.rightRotate=w_,j.roundedRect=Xy,j.searchToRecord=im,j.searchToRecord2=nm,j.selectFileInBrowser=zc,j.setCookie=lm,j.setRem=Y2,j.shadeColor=hy,j.shapeArrayEqual=K1,j.sharpen=O_,j.smileFace=Zy,j.stringToBlob=Bc,j.stringToXml=y2,j.toBlackAndWhite=C_,j.toBlue=P_,j.toBlueAndGreen=R_,j.toBlueAndGrey=I_,j.toGreen=T_,j.toGreenAndGrey=D_,j.toGrey=x_,j.toGrey2=S_,j.toOpposite=k_,j.toRed=E_,j.toRedAndBlue=M_,j.toRedAndGreen=A_,j.toRedAndGrey=L_,j.watchEffect=ty,j.xmlToString=$c,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
|
|
30
35
|
//# sourceMappingURL=zyzgroup_core_web.umd.cjs.map
|