@inditextech/weave-sdk 0.1.0

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/sdk.cjs ADDED
@@ -0,0 +1,62 @@
1
+ "use strict";var Fm=Object.defineProperty;var Hm=(x,c,r)=>c in x?Fm(x,c,{enumerable:!0,configurable:!0,writable:!0,value:r}):x[c]=r;var E=(x,c,r)=>(Hm(x,typeof c!="symbol"?c+"":c,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("konva"),Jd=require("react"),lu=require("@syncedstore/core"),bm=require("yjs"),Ud=require("konva/lib/shapes/Line"),Bm=require("konva/lib/shapes/Circle"),Qr=new WeakMap,Hs=new WeakMap,gr=new WeakMap,pu=Symbol("anyProducer"),Fd=Promise.resolve(),mu=Symbol("listenerAdded"),vu=Symbol("listenerRemoved");let yu=!1,zc=!1;const Su=x=>typeof x=="string"||typeof x=="symbol"||typeof x=="number";function Wo(x){if(!Su(x))throw new TypeError("`eventName` must be a string, symbol, or number")}function au(x){if(typeof x!="function")throw new TypeError("listener must be a function")}function Uo(x,c){const r=Hs.get(x);if(r.has(c))return r.get(c)}function jl(x,c){const r=Su(c)?c:pu,l=gr.get(x);if(l.has(r))return l.get(r)}function Gm(x,c,r){const l=gr.get(x);if(l.has(c))for(const u of l.get(c))u.enqueue(r);if(l.has(pu)){const u=Promise.all([c,r]);for(const h of l.get(pu))h.enqueue(u)}}function Hd(x,c){c=Array.isArray(c)?c:[c];let r=!1,l=()=>{},u=[];const h={enqueue(g){u.push(g),l()},finish(){r=!0,l()}};for(const g of c){let v=jl(x,g);v||(v=new Set,gr.get(x).set(g,v)),v.add(h)}return{async next(){return u?u.length===0?r?(u=void 0,this.next()):(await new Promise(g=>{l=g}),this.next()):{done:!1,value:await u.shift()}:{done:!0}},async return(g){u=void 0;for(const v of c){const S=jl(x,v);S&&(S.delete(h),S.size===0&&gr.get(x).delete(v))}return l(),arguments.length>0?{done:!0,value:await g}:{done:!0}},[Symbol.asyncIterator](){return this}}}function bd(x){if(x===void 0)return Bd;if(!Array.isArray(x))throw new TypeError("`methodNames` must be an array of strings");for(const c of x)if(!Bd.includes(c))throw typeof c!="string"?new TypeError("`methodNames` element must be a string"):new Error(`${c} is not Emittery method`);return x}const Ho=x=>x===mu||x===vu;function uu(x,c,r){if(Ho(c))try{yu=!0,x.emit(c,r)}finally{yu=!1}}class Zs{static mixin(c,r){return r=bd(r),l=>{if(typeof l!="function")throw new TypeError("`target` must be function");for(const g of r)if(l.prototype[g]!==void 0)throw new Error(`The property \`${g}\` already exists on \`target\``);function u(){return Object.defineProperty(this,c,{enumerable:!1,value:new Zs}),this[c]}Object.defineProperty(l.prototype,c,{enumerable:!1,get:u});const h=g=>function(...v){return this[c][g](...v)};for(const g of r)Object.defineProperty(l.prototype,g,{enumerable:!1,value:h(g)});return l}}static get isDebugEnabled(){var r;if(typeof((r=globalThis.process)==null?void 0:r.env)!="object")return zc;const{env:c}=globalThis.process??{env:{}};return c.DEBUG==="emittery"||c.DEBUG==="*"||zc}static set isDebugEnabled(c){zc=c}constructor(c={}){Qr.set(this,new Set),Hs.set(this,new Map),gr.set(this,new Map),gr.get(this).set(pu,new Set),this.debug=c.debug??{},this.debug.enabled===void 0&&(this.debug.enabled=!1),this.debug.logger||(this.debug.logger=(r,l,u,h)=>{try{h=JSON.stringify(h)}catch{h=`Object with the following keys failed to stringify: ${Object.keys(h).join(",")}`}(typeof u=="symbol"||typeof u=="number")&&(u=u.toString());const g=new Date,v=`${g.getHours()}:${g.getMinutes()}:${g.getSeconds()}.${g.getMilliseconds()}`;console.log(`[${v}][emittery:${r}][${l}] Event Name: ${u}
2
+ data: ${h}`)})}logIfDebugEnabled(c,r,l){(Zs.isDebugEnabled||this.debug.enabled)&&this.debug.logger(c,this.debug.name,r,l)}on(c,r,{signal:l}={}){au(r),c=Array.isArray(c)?c:[c];for(const h of c){Wo(h);let g=Uo(this,h);g||(g=new Set,Hs.get(this).set(h,g)),g.add(r),this.logIfDebugEnabled("subscribe",h,void 0),Ho(h)||uu(this,mu,{eventName:h,listener:r})}const u=()=>{this.off(c,r),l==null||l.removeEventListener("abort",u)};return l==null||l.addEventListener("abort",u,{once:!0}),l!=null&&l.aborted&&u(),u}off(c,r){au(r),c=Array.isArray(c)?c:[c];for(const l of c){Wo(l);const u=Uo(this,l);u&&(u.delete(r),u.size===0&&Hs.get(this).delete(l)),this.logIfDebugEnabled("unsubscribe",l,void 0),Ho(l)||uu(this,vu,{eventName:l,listener:r})}}once(c){let r;const l=new Promise(u=>{r=this.on(c,h=>{r(),u(h)})});return l.off=r,l}events(c){c=Array.isArray(c)?c:[c];for(const r of c)Wo(r);return Hd(this,c)}async emit(c,r){if(Wo(c),Ho(c)&&!yu)throw new TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");this.logIfDebugEnabled("emit",c,r),Gm(this,c,r);const l=Uo(this,c)??new Set,u=Qr.get(this),h=[...l],g=Ho(c)?[]:[...u];await Fd,await Promise.all([...h.map(async v=>{if(l.has(v))return v(r)}),...g.map(async v=>{if(u.has(v))return v(c,r)})])}async emitSerial(c,r){if(Wo(c),Ho(c)&&!yu)throw new TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");this.logIfDebugEnabled("emitSerial",c,r);const l=Uo(this,c)??new Set,u=Qr.get(this),h=[...l],g=[...u];await Fd;for(const v of h)l.has(v)&&await v(r);for(const v of g)u.has(v)&&await v(c,r)}onAny(c,{signal:r}={}){au(c),this.logIfDebugEnabled("subscribeAny",void 0,void 0),Qr.get(this).add(c),uu(this,mu,{listener:c});const l=()=>{this.offAny(c),r==null||r.removeEventListener("abort",l)};return r==null||r.addEventListener("abort",l,{once:!0}),r!=null&&r.aborted&&l(),l}anyEvent(){return Hd(this)}offAny(c){au(c),this.logIfDebugEnabled("unsubscribeAny",void 0,void 0),uu(this,vu,{listener:c}),Qr.get(this).delete(c)}clearListeners(c){c=Array.isArray(c)?c:[c];for(const r of c)if(this.logIfDebugEnabled("clear",r,void 0),Su(r)){const l=Uo(this,r);l&&l.clear();const u=jl(this,r);if(u){for(const h of u)h.finish();u.clear()}}else{Qr.get(this).clear();for(const[l,u]of Hs.get(this).entries())u.clear(),Hs.get(this).delete(l);for(const[l,u]of gr.get(this).entries()){for(const h of u)h.finish();u.clear(),gr.get(this).delete(l)}}}listenerCount(c){var l,u,h;c=Array.isArray(c)?c:[c];let r=0;for(const g of c){if(Su(g)){r+=Qr.get(this).size+(((l=Uo(this,g))==null?void 0:l.size)??0)+(((u=jl(this,g))==null?void 0:u.size)??0)+(((h=jl(this))==null?void 0:h.size)??0);continue}g!==void 0&&Wo(g),r+=Qr.get(this).size;for(const v of Hs.get(this).values())r+=v.size;for(const v of gr.get(this).values())r+=v.size}return r}bindMethods(c,r){if(typeof c!="object"||c===null)throw new TypeError("`target` must be an object");r=bd(r);for(const l of r){if(c[l]!==void 0)throw new Error(`The property \`${l}\` already exists on \`target\``);Object.defineProperty(c,l,{enumerable:!1,value:this[l].bind(this)})}}}const Bd=Object.getOwnPropertyNames(Zs.prototype).filter(x=>x!=="constructor");Object.defineProperty(Zs,"listenerAdded",{value:mu,writable:!1,enumerable:!0,configurable:!1});Object.defineProperty(Zs,"listenerRemoved",{value:vu,writable:!1,enumerable:!0,configurable:!1});const bt=[];for(let x=0;x<256;++x)bt.push((x+256).toString(16).slice(1));function Zm(x,c=0){return(bt[x[c+0]]+bt[x[c+1]]+bt[x[c+2]]+bt[x[c+3]]+"-"+bt[x[c+4]]+bt[x[c+5]]+"-"+bt[x[c+6]]+bt[x[c+7]]+"-"+bt[x[c+8]]+bt[x[c+9]]+"-"+bt[x[c+10]]+bt[x[c+11]]+bt[x[c+12]]+bt[x[c+13]]+bt[x[c+14]]+bt[x[c+15]]).toLowerCase()}let Oc;const Xm=new Uint8Array(16);function Ym(){if(!Oc){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Oc=crypto.getRandomValues.bind(crypto)}return Oc(Xm)}const Km=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gd={randomUUID:Km};function et(x,c,r){var u;if(Gd.randomUUID&&!x)return Gd.randomUUID();x=x||{};const l=x.random??((u=x.rng)==null?void 0:u.call(x))??Ym();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,Zm(l)}const wu="mainLayer",cu={IDLE:"idle",STARTING:"starting",LOADING_FONTS:"loadingFonts",RUNNING:"running"},qr={UP:"up",DOWN:"down",FRONT:"front",BACK:"back"},xu="white",Go={PNG:"image/png"},jd={"image/png":".png","image/jpeg":".jpg"};var ql=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _u(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}var Pu={exports:{}};/**
3
+ * @license
4
+ * Lodash <https://lodash.com/>
5
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
6
+ * Released under MIT license <https://lodash.com/license>
7
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9
+ */Pu.exports;(function(x,c){(function(){var r,l="4.17.21",u=200,h="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",g="Expected a function",v="Invalid `variable` option passed into `_.template`",S="__lodash_hash_undefined__",_=500,C="__lodash_placeholder__",R=1,D=2,H=4,Z=1,F=2,Y=1,X=2,se=4,j=8,ye=16,we=32,xe=64,Ie=128,at=256,gt=512,$t=30,en="...",It=800,pt=16,tn=1,At=2,mt=3,ut=1/0,V=9007199254740991,le=17976931348623157e292,ae=NaN,ge=4294967295,pe=ge-1,Fi=ge>>>1,Un=[["ary",Ie],["bind",Y],["bindKey",X],["curry",j],["curryRight",ye],["flip",gt],["partial",we],["partialRight",xe],["rearg",at]],pn="[object Arguments]",nn="[object Array]",Hi="[object AsyncFunction]",jr="[object Boolean]",bi="[object Date]",Xs="[object DOMException]",Nt="[object Error]",Bi="[object Function]",rn="[object GeneratorFunction]",An="[object Map]",$r="[object Number]",Iu="[object Null]",ni="[object Object]",ea="[object Promise]",Au="[object Proxy]",ii="[object RegExp]",Nn="[object Set]",es="[object String]",Ys="[object Symbol]",ts="[object Undefined]",ns="[object WeakMap]",Nu="[object WeakSet]",is="[object ArrayBuffer]",vr="[object DataView]",Zo="[object Float32Array]",Xo="[object Float64Array]",Yo="[object Int8Array]",Ko="[object Int16Array]",Qo="[object Int32Array]",Vo="[object Uint8Array]",qo="[object Uint8ClampedArray]",Jo="[object Uint16Array]",Ks="[object Uint32Array]",Tu=/\b__p \+= '';/g,Lu=/\b(__p \+=) '' \+/g,Cu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ta=/&(?:amp|lt|gt|quot|#39);/g,na=/[&<>"']/g,ku=RegExp(ta.source),ia=RegExp(na.source),ra=/<%-([\s\S]+?)%>/g,Ru=/<%([\s\S]+?)%>/g,Qs=/<%=([\s\S]+?)%>/g,sa=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,oa=/^\w*$/,Mu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jo=/[\\^$.*+?()[\]{}|]/g,zu=RegExp(jo.source),Vs=/^\s+/,$o=/\s/,Ou=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,rs=/\{\n\/\* \[wrapped with (.+)\] \*/,Du=/,? & /,Wu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Uu=/[()=,{}\[\]\/\s]/,Fu=/\\(\\)?/g,Hu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,la=/\w*$/,bu=/^[-+]0x[0-9a-f]+$/i,Bu=/^0b[01]+$/i,Gu=/^\[object .+?Constructor\]$/,Zu=/^0o[0-7]+$/i,Xu=/^(?:0|[1-9]\d*)$/,Yu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,qs=/($^)/,Ku=/['\n\r\u2028\u2029\\]/g,yr="\\ud800-\\udfff",ss="\\u0300-\\u036f",el="\\ufe20-\\ufe2f",tl="\\u20d0-\\u20ff",aa=ss+el+tl,Js="\\u2700-\\u27bf",Gi="a-z\\xdf-\\xf6\\xf8-\\xff",Si="\\xac\\xb1\\xd7\\xf7",Ge="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fe="\\u2000-\\u206f",wi=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",vt="A-Z\\xc0-\\xd6\\xd8-\\xde",Rt="\\ufe0e\\ufe0f",xi=Si+Ge+Fe+wi,Pi="['’]",Bt="["+yr+"]",os="["+xi+"]",ls="["+aa+"]",nl="\\d+",js="["+Js+"]",il="["+Gi+"]",mn="[^"+yr+xi+nl+Js+Gi+vt+"]",rl="\\ud83c[\\udffb-\\udfff]",Qu="(?:"+ls+"|"+rl+")",ua="[^"+yr+"]",Sr="(?:\\ud83c[\\udde6-\\uddff]){2}",wr="[\\ud800-\\udbff][\\udc00-\\udfff]",Fn="["+vt+"]",as="\\u200d",ca="(?:"+il+"|"+mn+")",Vu="(?:"+Fn+"|"+mn+")",$s="(?:"+Pi+"(?:d|ll|m|re|s|t|ve))?",sl="(?:"+Pi+"(?:D|LL|M|RE|S|T|VE))?",eo=Qu+"?",xr="["+Rt+"]?",qu="(?:"+as+"(?:"+[ua,Sr,wr].join("|")+")"+xr+eo+")*",ol="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Me="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ll=xr+eo+qu,al="(?:"+[js,Sr,wr].join("|")+")"+ll,da="(?:"+[ua+ls+"?",ls,Sr,wr,Bt].join("|")+")",Ju=RegExp(Pi,"g"),ju=RegExp(ls,"g"),je=RegExp(rl+"(?="+rl+")|"+da+ll,"g"),ul=RegExp([Fn+"?"+il+"+"+$s+"(?="+[os,Fn,"$"].join("|")+")",Vu+"+"+sl+"(?="+[os,Fn+ca,"$"].join("|")+")",Fn+"?"+ca+"+"+$s,Fn+"+"+sl,Me,ol,nl,al].join("|"),"g"),$u=RegExp("["+as+yr+aa+Rt+"]"),cl=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ec=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],to=-1,Te={};Te[Zo]=Te[Xo]=Te[Yo]=Te[Ko]=Te[Qo]=Te[Vo]=Te[qo]=Te[Jo]=Te[Ks]=!0,Te[pn]=Te[nn]=Te[is]=Te[jr]=Te[vr]=Te[bi]=Te[Nt]=Te[Bi]=Te[An]=Te[$r]=Te[ni]=Te[ii]=Te[Nn]=Te[es]=Te[ns]=!1;var He={};He[pn]=He[nn]=He[is]=He[vr]=He[jr]=He[bi]=He[Zo]=He[Xo]=He[Yo]=He[Ko]=He[Qo]=He[An]=He[$r]=He[ni]=He[ii]=He[Nn]=He[es]=He[Ys]=He[Vo]=He[qo]=He[Jo]=He[Ks]=!0,He[Nt]=He[Bi]=He[ns]=!1;var tc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Tn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ri={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},no={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},dl=parseFloat,fa=parseInt,ha=typeof ql=="object"&&ql&&ql.Object===Object&&ql,Hn=typeof self=="object"&&self&&self.Object===Object&&self,yt=ha||Hn||Function("return this")(),Pr=c&&!c.nodeType&&c,Zi=Pr&&!0&&x&&!x.nodeType&&x,vn=Zi&&Zi.exports===Pr,_r=vn&&ha.process,Mt=function(){try{var T=Zi&&Zi.require&&Zi.require("util").types;return T||_r&&_r.binding&&_r.binding("util")}catch{}}(),Xi=Mt&&Mt.isArrayBuffer,io=Mt&&Mt.isDate,ro=Mt&&Mt.isMap,fl=Mt&&Mt.isRegExp,so=Mt&&Mt.isSet,oo=Mt&&Mt.isTypedArray;function ct(T,z,W){switch(W.length){case 0:return T.call(z);case 1:return T.call(z,W[0]);case 2:return T.call(z,W[0],W[1]);case 3:return T.call(z,W[0],W[1],W[2])}return T.apply(z,W)}function yn(T,z,W,$){for(var he=-1,Le=T==null?0:T.length;++he<Le;){var Ve=T[he];z($,Ve,W(Ve),T)}return $}function Ke(T,z){for(var W=-1,$=T==null?0:T.length;++W<$&&z(T[W],W,T)!==!1;);return T}function _i(T,z){for(var W=T==null?0:T.length;W--&&z(T[W],W,T)!==!1;);return T}function lo(T,z){for(var W=-1,$=T==null?0:T.length;++W<$;)if(!z(T[W],W,T))return!1;return!0}function si(T,z){for(var W=-1,$=T==null?0:T.length,he=0,Le=[];++W<$;){var Ve=T[W];z(Ve,W,T)&&(Le[he++]=Ve)}return Le}function Sn(T,z){var W=T==null?0:T.length;return!!W&&Ei(T,z,0)>-1}function bn(T,z,W){for(var $=-1,he=T==null?0:T.length;++$<he;)if(W(z,T[$]))return!0;return!1}function We(T,z){for(var W=-1,$=T==null?0:T.length,he=Array($);++W<$;)he[W]=z(T[W],W,T);return he}function oi(T,z){for(var W=-1,$=z.length,he=T.length;++W<$;)T[he+W]=z[W];return T}function Er(T,z,W,$){var he=-1,Le=T==null?0:T.length;for($&&Le&&(W=T[++he]);++he<Le;)W=z(W,T[he],he,T);return W}function ga(T,z,W,$){var he=T==null?0:T.length;for($&&he&&(W=T[--he]);he--;)W=z(W,T[he],he,T);return W}function ao(T,z){for(var W=-1,$=T==null?0:T.length;++W<$;)if(z(T[W],W,T))return!0;return!1}var hl=Ar("length");function uo(T){return T.split("")}function pa(T){return T.match(Wu)||[]}function gl(T,z,W){var $;return W(T,function(he,Le,Ve){if(z(he,Le,Ve))return $=Le,!1}),$}function us(T,z,W,$){for(var he=T.length,Le=W+($?1:-1);$?Le--:++Le<he;)if(z(T[Le],Le,T))return Le;return-1}function Ei(T,z,W){return z===z?wa(T,z,W):us(T,Yi,W)}function Ir(T,z,W,$){for(var he=W-1,Le=T.length;++he<Le;)if($(T[he],z))return he;return-1}function Yi(T){return T!==T}function cs(T,z){var W=T==null?0:T.length;return W?Ln(T,z)/W:ae}function Ar(T){return function(z){return z==null?r:z[T]}}function Gt(T){return function(z){return T==null?r:T[z]}}function sn(T,z,W,$,he){return he(T,function(Le,Ve,ke){W=$?($=!1,Le):z(W,Le,Ve,ke)}),W}function Ki(T,z){var W=T.length;for(T.sort(z);W--;)T[W]=T[W].value;return T}function Ln(T,z){for(var W,$=-1,he=T.length;++$<he;){var Le=z(T[$]);Le!==r&&(W=W===r?Le:W+Le)}return W}function Cn(T,z){for(var W=-1,$=Array(T);++W<T;)$[W]=z(W);return $}function Qi(T,z){return We(z,function(W){return[W,T[W]]})}function pl(T){return T&&T.slice(0,on(T)+1).replace(Vs,"")}function zt(T){return function(z){return T(z)}}function ds(T,z){return We(z,function(W){return T[W]})}function St(T,z){return T.has(z)}function Zt(T,z){for(var W=-1,$=T.length;++W<$&&Ei(z,T[W],0)>-1;);return W}function Ze(T,z){for(var W=T.length;W--&&Ei(z,T[W],0)>-1;);return W}function fs(T,z){for(var W=T.length,$=0;W--;)T[W]===z&&++$;return $}var kn=Gt(tc),ma=Gt(Tn);function va(T){return"\\"+no[T]}function ml(T,z){return T==null?r:T[z]}function Ii(T){return $u.test(T)}function ya(T){return cl.test(T)}function hs(T){for(var z,W=[];!(z=T.next()).done;)W.push(z.value);return W}function Ai(T){var z=-1,W=Array(T.size);return T.forEach(function($,he){W[++z]=[he,$]}),W}function co(T,z){return function(W){return T(z(W))}}function wn(T,z){for(var W=-1,$=T.length,he=0,Le=[];++W<$;){var Ve=T[W];(Ve===z||Ve===C)&&(T[W]=C,Le[he++]=W)}return Le}function Vi(T){var z=-1,W=Array(T.size);return T.forEach(function($){W[++z]=$}),W}function Sa(T){var z=-1,W=Array(T.size);return T.forEach(function($){W[++z]=[$,$]}),W}function wa(T,z,W){for(var $=W-1,he=T.length;++$<he;)if(T[$]===z)return $;return-1}function Nr(T,z,W){for(var $=W+1;$--;)if(T[$]===z)return $;return $}function qi(T){return Ii(T)?Tr(T):hl(T)}function Ot(T){return Ii(T)?Bn(T):uo(T)}function on(T){for(var z=T.length;z--&&$o.test(T.charAt(z)););return z}var gs=Gt(ri);function Tr(T){for(var z=je.lastIndex=0;je.test(T);)++z;return z}function Bn(T){return T.match(je)||[]}function vl(T){return T.match(ul)||[]}var Lr=function T(z){z=z==null?yt:Ji.defaults(yt.Object(),z,Ji.pick(yt,ec));var W=z.Array,$=z.Date,he=z.Error,Le=z.Function,Ve=z.Math,ke=z.Object,Xe=z.RegExp,tt=z.String,Oe=z.TypeError,ji=W.prototype,ps=Le.prototype,Gn=ke.prototype,fo=z["__core-js_shared__"],nt=ps.toString,ze=Gn.hasOwnProperty,yl=0,ho=function(){var e=/[^.]+$/.exec(fo&&fo.keys&&fo.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ln=Gn.toString,xn=nt.call(ke),ms=yt._,Sl=Xe("^"+nt.call(ze).replace(jo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Cr=vn?z.Buffer:r,li=z.Symbol,vs=z.Uint8Array,wl=Cr?Cr.allocUnsafe:r,ys=co(ke.getPrototypeOf,ke),xl=ke.create,Pl=Gn.propertyIsEnumerable,Ss=ji.splice,kr=li?li.isConcatSpreadable:r,Rr=li?li.iterator:r,Zn=li?li.toStringTag:r,$i=function(){try{var e=qt(ke,"defineProperty");return e({},"",{}),e}catch{}}(),xa=z.clearTimeout!==yt.clearTimeout&&z.clearTimeout,_l=$&&$.now!==yt.Date.now&&$.now,Pa=z.setTimeout!==yt.setTimeout&&z.setTimeout,ws=Ve.ceil,xs=Ve.floor,go=ke.getOwnPropertySymbols,El=Cr?Cr.isBuffer:r,Il=z.isFinite,_a=ji.join,Ea=co(ke.keys,ke),it=Ve.max,wt=Ve.min,nc=$.now,ic=z.parseInt,Al=Ve.random,Ia=ji.reverse,po=qt(z,"DataView"),Mr=qt(z,"Map"),zr=qt(z,"Promise"),Or=qt(z,"Set"),Ps=qt(z,"WeakMap"),_s=qt(ke,"create"),Dr=Ps&&new Ps,Ni={},rc=Ws(po),Aa=Ws(Mr),Na=Ws(zr),Ta=Ws(Or),La=Ws(Ps),Es=li?li.prototype:r,Xt=Es?Es.valueOf:r,Nl=Es?Es.toString:r;function y(e){if($e(e)&&!Se(e)&&!(e instanceof Ae)){if(e instanceof Dt)return e;if(ze.call(e,"__wrapped__"))return id(e)}return new Dt(e)}var Xn=function(){function e(){}return function(i){if(!Je(i))return{};if(xl)return xl(i);e.prototype=i;var o=new e;return e.prototype=r,o}}();function er(){}function Dt(e,i){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!i,this.__index__=0,this.__values__=r}y.templateSettings={escape:ra,evaluate:Ru,interpolate:Qs,variable:"",imports:{_:y}},y.prototype=er.prototype,y.prototype.constructor=y,Dt.prototype=Xn(er.prototype),Dt.prototype.constructor=Dt;function Ae(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ge,this.__views__=[]}function Is(){var e=new Ae(this.__wrapped__);return e.__actions__=Ct(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ct(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ct(this.__views__),e}function Tt(){if(this.__filtered__){var e=new Ae(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function sc(){var e=this.__wrapped__.value(),i=this.__dir__,o=Se(e),f=i<0,m=o?e.length:0,w=ff(0,m,this.__views__),I=w.start,A=w.end,k=A-I,b=f?A:I-1,B=this.__iteratees__,G=B.length,q=0,ie=wt(k,this.__takeCount__);if(!o||!f&&m==k&&ie==k)return Lo(e,this.__actions__);var de=[];e:for(;k--&&q<ie;){b+=i;for(var Ee=-1,fe=e[b];++Ee<G;){var Ne=B[Ee],Re=Ne.iteratee,Dn=Ne.type,hn=Re(fe);if(Dn==At)fe=hn;else if(!hn){if(Dn==tn)continue e;break e}}de[q++]=fe}return de}Ae.prototype=Xn(er.prototype),Ae.prototype.constructor=Ae;function tr(e){var i=-1,o=e==null?0:e.length;for(this.clear();++i<o;){var f=e[i];this.set(f[0],f[1])}}function Yt(){this.__data__=_s?_s(null):{},this.size=0}function Wt(e){var i=this.has(e)&&delete this.__data__[e];return this.size-=i?1:0,i}function Ca(e){var i=this.__data__;if(_s){var o=i[e];return o===S?r:o}return ze.call(i,e)?i[e]:r}function ka(e){var i=this.__data__;return _s?i[e]!==r:ze.call(i,e)}function Ra(e,i){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=_s&&i===r?S:i,this}tr.prototype.clear=Yt,tr.prototype.delete=Wt,tr.prototype.get=Ca,tr.prototype.has=ka,tr.prototype.set=Ra;function Yn(e){var i=-1,o=e==null?0:e.length;for(this.clear();++i<o;){var f=e[i];this.set(f[0],f[1])}}function Ma(){this.__data__=[],this.size=0}function Tl(e){var i=this.__data__,o=Ns(i,e);if(o<0)return!1;var f=i.length-1;return o==f?i.pop():Ss.call(i,o,1),--this.size,!0}function za(e){var i=this.__data__,o=Ns(i,e);return o<0?r:i[o][1]}function Ll(e){return Ns(this.__data__,e)>-1}function Oa(e,i){var o=this.__data__,f=Ns(o,e);return f<0?(++this.size,o.push([e,i])):o[f][1]=i,this}Yn.prototype.clear=Ma,Yn.prototype.delete=Tl,Yn.prototype.get=za,Yn.prototype.has=Ll,Yn.prototype.set=Oa;function Kn(e){var i=-1,o=e==null?0:e.length;for(this.clear();++i<o;){var f=e[i];this.set(f[0],f[1])}}function mo(){this.size=0,this.__data__={hash:new tr,map:new(Mr||Yn),string:new tr}}function vo(e){var i=qe(this,e).delete(e);return this.size-=i?1:0,i}function Da(e){return qe(this,e).get(e)}function Wa(e){return qe(this,e).has(e)}function Cl(e,i){var o=qe(this,e),f=o.size;return o.set(e,i),this.size+=o.size==f?0:1,this}Kn.prototype.clear=mo,Kn.prototype.delete=vo,Kn.prototype.get=Da,Kn.prototype.has=Wa,Kn.prototype.set=Cl;function Ti(e){var i=-1,o=e==null?0:e.length;for(this.__data__=new Kn;++i<o;)this.add(e[i])}function Ua(e){return this.__data__.set(e,S),this}function yo(e){return this.__data__.has(e)}Ti.prototype.add=Ti.prototype.push=Ua,Ti.prototype.has=yo;function Pn(e){var i=this.__data__=new Yn(e);this.size=i.size}function kl(){this.__data__=new Yn,this.size=0}function Fa(e){var i=this.__data__,o=i.delete(e);return this.size=i.size,o}function ai(e){return this.__data__.get(e)}function oc(e){return this.__data__.has(e)}function lc(e,i){var o=this.__data__;if(o instanceof Yn){var f=o.__data__;if(!Mr||f.length<u-1)return f.push([e,i]),this.size=++o.size,this;o=this.__data__=new Kn(f)}return o.set(e,i),this.size=o.size,this}Pn.prototype.clear=kl,Pn.prototype.delete=Fa,Pn.prototype.get=ai,Pn.prototype.has=oc,Pn.prototype.set=lc;function As(e,i){var o=Se(e),f=!o&&Us(e),m=!o&&!f&&Kr(e),w=!o&&!f&&!m&&Oo(e),I=o||f||m||w,A=I?Cn(e.length,tt):[],k=A.length;for(var b in e)(i||ze.call(e,b))&&!(I&&(b=="length"||m&&(b=="offset"||b=="parent")||w&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||ur(b,k)))&&A.push(b);return A}function xt(e){var i=e.length;return i?e[or(0,i-1)]:r}function ac(e,i){return ja(Ct(e),Ci(i,0,e.length))}function ee(e){return ja(Ct(e))}function Li(e,i,o){(o!==r&&!vi(e[i],o)||o===r&&!(i in e))&&Rn(e,i,o)}function nr(e,i,o){var f=e[i];(!(ze.call(e,i)&&vi(f,o))||o===r&&!(i in e))&&Rn(e,i,o)}function Ns(e,i){for(var o=e.length;o--;)if(vi(e[o][0],i))return o;return-1}function uc(e,i,o,f){return Pt(e,function(m,w,I){i(f,m,o(m),I)}),f}function Wr(e,i){return e&&Jn(i,kt(i),e)}function So(e,i){return e&&Jn(i,En(i),e)}function Rn(e,i,o){i=="__proto__"&&$i?$i(e,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[i]=o}function wo(e,i){for(var o=-1,f=i.length,m=W(f),w=e==null;++o<f;)m[o]=w?r:Ic(e,i[o]);return m}function Ci(e,i,o){return e===e&&(o!==r&&(e=e<=o?e:o),i!==r&&(e=e>=i?e:i)),e}function an(e,i,o,f,m,w){var I,A=i&R,k=i&D,b=i&H;if(o&&(I=m?o(e,f,m,w):o(e)),I!==r)return I;if(!Je(e))return e;var B=Se(e);if(B){if(I=gf(e),!A)return Ct(e,I)}else{var G=Jt(e),q=G==Bi||G==rn;if(Kr(e))return Zl(e,A);if(G==ni||G==pn||q&&!m){if(I=k||q?{}:Qc(e),!A)return k?ko(e,So(I,e)):zi(e,Wr(I,e))}else{if(!He[G])return m?e:{};I=pf(e,G,A)}}w||(w=new Pn);var ie=w.get(e);if(ie)return ie;w.set(e,I),_d(e)?e.forEach(function(fe){I.add(an(fe,i,o,fe,e,w))}):xd(e)&&e.forEach(function(fe,Ne){I.set(Ne,an(fe,i,o,Ne,e,w))});var de=b?k?J:U:k?En:kt,Ee=B?r:de(e);return Ke(Ee||e,function(fe,Ne){Ee&&(Ne=fe,fe=e[Ne]),nr(I,Ne,an(fe,i,o,Ne,e,w))}),I}function Rl(e){var i=kt(e);return function(o){return xo(o,e,i)}}function xo(e,i,o){var f=o.length;if(e==null)return!f;for(e=ke(e);f--;){var m=o[f],w=i[m],I=e[m];if(I===r&&!(m in e)||!w(I))return!1}return!0}function dt(e,i,o){if(typeof e!="function")throw new Oe(g);return Ql(function(){e.apply(r,o)},i)}function Ut(e,i,o,f){var m=-1,w=Sn,I=!0,A=e.length,k=[],b=i.length;if(!A)return k;o&&(i=We(i,zt(o))),f?(w=bn,I=!1):i.length>=u&&(w=St,I=!1,i=new Ti(i));e:for(;++m<A;){var B=e[m],G=o==null?B:o(B);if(B=f||B!==0?B:0,I&&G===G){for(var q=b;q--;)if(i[q]===G)continue e;k.push(B)}else w(i,G,f)||k.push(B)}return k}var Pt=Ro(zn),Po=Ro(Eo,!0);function Ha(e,i){var o=!0;return Pt(e,function(f,m,w){return o=!!i(f,m,w),o}),o}function Kt(e,i,o){for(var f=-1,m=e.length;++f<m;){var w=e[f],I=i(w);if(I!=null&&(A===r?I===I&&!On(I):o(I,A)))var A=I,k=w}return k}function ba(e,i,o,f){var m=e.length;for(o=Pe(o),o<0&&(o=-o>m?0:m+o),f=f===r||f>m?m:Pe(f),f<0&&(f+=m),f=o>f?0:Id(f);o<f;)e[o++]=i;return e}function Mn(e,i){var o=[];return Pt(e,function(f,m,w){i(f,m,w)&&o.push(f)}),o}function _t(e,i,o,f,m){var w=-1,I=e.length;for(o||(o=vf),m||(m=[]);++w<I;){var A=e[w];i>0&&o(A)?i>1?_t(A,i-1,o,f,m):oi(m,A):f||(m[m.length]=A)}return m}var _o=Mo(),Ml=Mo(!0);function zn(e,i){return e&&_o(e,i,kt)}function Eo(e,i){return e&&Ml(e,i,kt)}function ir(e,i){return si(i,function(o){return cr(e[o])})}function Qn(e,i){i=gi(i,e);for(var o=0,f=i.length;e!=null&&o<f;)e=e[Oi(i[o++])];return o&&o==f?e:r}function Ts(e,i,o){var f=i(e);return Se(e)?f:oi(f,o(e))}function ft(e){return e==null?e===r?ts:Iu:Zn&&Zn in ke(e)?hc(e):Ef(e)}function Ur(e,i){return e>i}function Ls(e,i){return e!=null&&ze.call(e,i)}function zl(e,i){return e!=null&&i in ke(e)}function Ol(e,i,o){return e>=wt(i,o)&&e<it(i,o)}function Cs(e,i,o){for(var f=o?bn:Sn,m=e[0].length,w=e.length,I=w,A=W(w),k=1/0,b=[];I--;){var B=e[I];I&&i&&(B=We(B,zt(i))),k=wt(B.length,k),A[I]=!o&&(i||m>=120&&B.length>=120)?new Ti(I&&B):r}B=e[0];var G=-1,q=A[0];e:for(;++G<m&&b.length<k;){var ie=B[G],de=i?i(ie):ie;if(ie=o||ie!==0?ie:0,!(q?St(q,de):f(b,de,o))){for(I=w;--I;){var Ee=A[I];if(!(Ee?St(Ee,de):f(e[I],de,o)))continue e}q&&q.push(de),b.push(ie)}}return b}function Ba(e,i,o,f){return zn(e,function(m,w,I){i(f,o(m),w,I)}),f}function rr(e,i,o){i=gi(i,e),e=jc(e,i);var f=e==null?e:e[Oi($n(i))];return f==null?r:ct(f,e,o)}function Ga(e){return $e(e)&&ft(e)==pn}function Io(e){return $e(e)&&ft(e)==is}function Dl(e){return $e(e)&&ft(e)==bi}function Ye(e,i,o,f,m){return e===i?!0:e==null||i==null||!$e(e)&&!$e(i)?e!==e&&i!==i:_e(e,i,o,f,Ye,m)}function _e(e,i,o,f,m,w){var I=Se(e),A=Se(i),k=I?nn:Jt(e),b=A?nn:Jt(i);k=k==pn?ni:k,b=b==pn?ni:b;var B=k==ni,G=b==ni,q=k==b;if(q&&Kr(e)){if(!Kr(i))return!1;I=!0,B=!1}if(q&&!B)return w||(w=new Pn),I||Oo(e)?Ht(e,i,o,f,m,w):mi(e,i,k,o,f,m,w);if(!(o&Z)){var ie=B&&ze.call(e,"__wrapped__"),de=G&&ze.call(i,"__wrapped__");if(ie||de){var Ee=ie?e.value():e,fe=de?i.value():i;return w||(w=new Pn),m(Ee,fe,o,f,w)}}return q?(w||(w=new Pn),O(e,i,o,f,m,w)):!1}function rt(e){return $e(e)&&Jt(e)==An}function Qe(e,i,o,f){var m=o.length,w=m,I=!f;if(e==null)return!w;for(e=ke(e);m--;){var A=o[m];if(I&&A[2]?A[1]!==e[A[0]]:!(A[0]in e))return!1}for(;++m<w;){A=o[m];var k=A[0],b=e[k],B=A[1];if(I&&A[2]){if(b===r&&!(k in e))return!1}else{var G=new Pn;if(f)var q=f(b,B,k,e,i,G);if(!(q===r?Ye(B,b,Z|F,f,G):q))return!1}}return!0}function ht(e){if(!Je(e)||Sf(e))return!1;var i=cr(e)?Sl:Gu;return i.test(Ws(e))}function un(e){return $e(e)&&ft(e)==ii}function Fr(e){return $e(e)&&Jt(e)==Nn}function st(e){return $e(e)&&ru(e.length)&&!!Te[ft(e)]}function Hr(e){return typeof e=="function"?e:e==null?In:typeof e=="object"?Se(e)?No(e[0],e[1]):Ft(e):Dd(e)}function ui(e){if(!Kl(e))return Ea(e);var i=[];for(var o in ke(e))ze.call(e,o)&&o!="constructor"&&i.push(o);return i}function Ao(e){if(!Je(e))return _f(e);var i=Kl(e),o=[];for(var f in e)f=="constructor"&&(i||!ze.call(e,f))||o.push(f);return o}function ks(e,i){return e<i}function br(e,i){var o=-1,f=_n(e)?W(e.length):[];return Pt(e,function(m,w,I){f[++o]=i(m,w,I)}),f}function Ft(e){var i=Ce(e);return i.length==1&&i[0][2]?qc(i[0][0],i[0][1]):function(o){return o===e||Qe(o,e,i)}}function No(e,i){return pc(e)&&Vc(i)?qc(Oi(e),i):function(o){var f=Ic(o,e);return f===r&&f===i?Ac(o,e):Ye(i,f,Z|F)}}function Br(e,i,o,f,m){e!==i&&_o(i,function(w,I){if(m||(m=new Pn),Je(w))ci(e,i,I,o,Br,f,m);else{var A=f?f(vc(e,I),w,I+"",e,i,m):r;A===r&&(A=w),Li(e,I,A)}},En)}function ci(e,i,o,f,m,w,I){var A=vc(e,o),k=vc(i,o),b=I.get(k);if(b){Li(e,o,b);return}var B=w?w(A,k,o+"",e,i,I):r,G=B===r;if(G){var q=Se(k),ie=!q&&Kr(k),de=!q&&!ie&&Oo(k);B=k,q||ie||de?Se(A)?B=A:ot(A)?B=Ct(A):ie?(G=!1,B=Zl(k,!0)):de?(G=!1,B=Ka(k,!0)):B=[]:Vl(k)||Us(k)?(B=A,Us(A)?B=Ad(A):(!Je(A)||cr(A))&&(B=Qc(k))):G=!1}G&&(I.set(k,B),m(B,k,f,w,I),I.delete(k)),Li(e,o,B)}function sr(e,i){var o=e.length;if(o)return i+=i<0?o:0,ur(i,o)?e[i]:r}function Rs(e,i,o){i.length?i=We(i,function(w){return Se(w)?function(I){return Qn(I,w.length===1?w[0]:w)}:w}):i=[In];var f=-1;i=We(i,zt(Q()));var m=br(e,function(w,I,A){var k=We(i,function(b){return b(w)});return{criteria:k,index:++f,value:w}});return Ki(m,function(w,I){return Qa(w,I,o)})}function Wl(e,i){return di(e,i,function(o,f){return Ac(e,f)})}function di(e,i,o){for(var f=-1,m=i.length,w={};++f<m;){var I=i[f],A=Qn(e,I);o(A,I)&&Et(w,gi(I,e),A)}return w}function To(e){return function(i){return Qn(i,e)}}function Vn(e,i,o,f){var m=f?Ir:Ei,w=-1,I=i.length,A=e;for(e===i&&(i=Ct(i)),o&&(A=We(e,zt(o)));++w<I;)for(var k=0,b=i[w],B=o?o(b):b;(k=m(A,B,k,f))>-1;)A!==e&&Ss.call(A,k,1),Ss.call(e,k,1);return e}function Ms(e,i){for(var o=e?i.length:0,f=o-1;o--;){var m=i[o];if(o==f||m!==w){var w=m;ur(m)?Ss.call(e,m,1):hi(e,m)}}return e}function or(e,i){return e+xs(Al()*(i-e+1))}function Ul(e,i,o,f){for(var m=-1,w=it(ws((i-e)/(o||1)),0),I=W(w);w--;)I[f?w:++m]=e,e+=o;return I}function Gr(e,i){var o="";if(!e||i<1||i>V)return o;do i%2&&(o+=e),i=xs(i/2),i&&(e+=e);while(i);return o}function ve(e,i){return yc(Jc(e,i,In),e+"")}function Lt(e){return xt(Do(e))}function ki(e,i){var o=Do(e);return ja(o,Ci(i,0,o.length))}function Et(e,i,o,f){if(!Je(e))return e;i=gi(i,e);for(var m=-1,w=i.length,I=w-1,A=e;A!=null&&++m<w;){var k=Oi(i[m]),b=o;if(k==="__proto__"||k==="constructor"||k==="prototype")return e;if(m!=I){var B=A[k];b=f?f(B,k,A):r,b===r&&(b=Je(B)?B:ur(i[m+1])?[]:{})}nr(A,k,b),A=A[k]}return e}var zs=Dr?function(e,i){return Dr.set(e,i),e}:In,Za=$i?function(e,i){return $i(e,"toString",{configurable:!0,enumerable:!1,value:Tc(i),writable:!0})}:In;function Qt(e){return ja(Do(e))}function cn(e,i,o){var f=-1,m=e.length;i<0&&(i=-i>m?0:m+i),o=o>m?m:o,o<0&&(o+=m),m=i>o?0:o-i>>>0,i>>>=0;for(var w=W(m);++f<m;)w[f]=e[f+i];return w}function Fl(e,i){var o;return Pt(e,function(f,m,w){return o=i(f,m,w),!o}),!!o}function Zr(e,i,o){var f=0,m=e==null?f:e.length;if(typeof i=="number"&&i===i&&m<=Fi){for(;f<m;){var w=f+m>>>1,I=e[w];I!==null&&!On(I)&&(o?I<=i:I<i)?f=w+1:m=w}return m}return Hl(e,i,In,o)}function Hl(e,i,o,f){var m=0,w=e==null?0:e.length;if(w===0)return 0;i=o(i);for(var I=i!==i,A=i===null,k=On(i),b=i===r;m<w;){var B=xs((m+w)/2),G=o(e[B]),q=G!==r,ie=G===null,de=G===G,Ee=On(G);if(I)var fe=f||de;else b?fe=de&&(f||q):A?fe=de&&q&&(f||!ie):k?fe=de&&q&&!ie&&(f||!Ee):ie||Ee?fe=!1:fe=f?G<=i:G<i;fe?m=B+1:w=B}return wt(w,pe)}function fi(e,i){for(var o=-1,f=e.length,m=0,w=[];++o<f;){var I=e[o],A=i?i(I):I;if(!o||!vi(A,k)){var k=A;w[m++]=I===0?0:I}}return w}function bl(e){return typeof e=="number"?e:On(e)?ae:+e}function Vt(e){if(typeof e=="string")return e;if(Se(e))return We(e,Vt)+"";if(On(e))return Nl?Nl.call(e):"";var i=e+"";return i=="0"&&1/e==-1/0?"-0":i}function qn(e,i,o){var f=-1,m=Sn,w=e.length,I=!0,A=[],k=A;if(o)I=!1,m=bn;else if(w>=u){var b=i?null:K(e);if(b)return Vi(b);I=!1,m=St,k=new Ti}else k=i?[]:A;e:for(;++f<w;){var B=e[f],G=i?i(B):B;if(B=o||B!==0?B:0,I&&G===G){for(var q=k.length;q--;)if(k[q]===G)continue e;i&&k.push(G),A.push(B)}else m(k,G,o)||(k!==A&&k.push(G),A.push(B))}return A}function hi(e,i){return i=gi(i,e),e=jc(e,i),e==null||delete e[Oi($n(i))]}function Bl(e,i,o,f){return Et(e,i,o(Qn(e,i)),f)}function Os(e,i,o,f){for(var m=e.length,w=f?m:-1;(f?w--:++w<m)&&i(e[w],w,e););return o?cn(e,f?0:w,f?w+1:m):cn(e,f?w+1:0,f?m:w)}function Lo(e,i){var o=e;return o instanceof Ae&&(o=o.value()),Er(i,function(f,m){return m.func.apply(m.thisArg,oi([f],m.args))},o)}function Xr(e,i,o){var f=e.length;if(f<2)return f?qn(e[0]):[];for(var m=-1,w=W(f);++m<f;)for(var I=e[m],A=-1;++A<f;)A!=m&&(w[m]=Ut(w[m]||I,e[A],i,o));return qn(_t(w,1),i,o)}function Xa(e,i,o){for(var f=-1,m=e.length,w=i.length,I={};++f<m;){var A=f<w?i[f]:r;o(I,e[f],A)}return I}function Gl(e){return ot(e)?e:[]}function Co(e){return typeof e=="function"?e:In}function gi(e,i){return Se(e)?e:pc(e,i)?[e]:nd(De(e))}var lr=ve;function Ri(e,i,o){var f=e.length;return o=o===r?f:o,!i&&o>=f?e:cn(e,i,o)}var Mi=xa||function(e){return yt.clearTimeout(e)};function Zl(e,i){if(i)return e.slice();var o=e.length,f=wl?wl(o):new e.constructor(o);return e.copy(f),f}function be(e){var i=new e.constructor(e.byteLength);return new vs(i).set(new vs(e)),i}function cc(e,i){var o=i?be(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function Ya(e){var i=new e.constructor(e.source,la.exec(e));return i.lastIndex=e.lastIndex,i}function dc(e){return Xt?ke(Xt.call(e)):{}}function Ka(e,i){var o=i?be(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function Xl(e,i){if(e!==i){var o=e!==r,f=e===null,m=e===e,w=On(e),I=i!==r,A=i===null,k=i===i,b=On(i);if(!A&&!b&&!w&&e>i||w&&I&&k&&!A&&!b||f&&I&&k||!o&&k||!m)return 1;if(!f&&!w&&!b&&e<i||b&&o&&m&&!f&&!w||A&&o&&m||!I&&m||!k)return-1}return 0}function Qa(e,i,o){for(var f=-1,m=e.criteria,w=i.criteria,I=m.length,A=o.length;++f<I;){var k=Xl(m[f],w[f]);if(k){if(f>=A)return k;var b=o[f];return k*(b=="desc"?-1:1)}}return e.index-i.index}function Va(e,i,o,f){for(var m=-1,w=e.length,I=o.length,A=-1,k=i.length,b=it(w-I,0),B=W(k+b),G=!f;++A<k;)B[A]=i[A];for(;++m<I;)(G||m<w)&&(B[o[m]]=e[m]);for(;b--;)B[A++]=e[m++];return B}function dn(e,i,o,f){for(var m=-1,w=e.length,I=-1,A=o.length,k=-1,b=i.length,B=it(w-A,0),G=W(B+b),q=!f;++m<B;)G[m]=e[m];for(var ie=m;++k<b;)G[ie+k]=i[k];for(;++I<A;)(q||m<w)&&(G[ie+o[I]]=e[m++]);return G}function Ct(e,i){var o=-1,f=e.length;for(i||(i=W(f));++o<f;)i[o]=e[o];return i}function Jn(e,i,o,f){var m=!o;o||(o={});for(var w=-1,I=i.length;++w<I;){var A=i[w],k=f?f(o[A],e[A],A,o,e):r;k===r&&(k=e[A]),m?Rn(o,A,k):nr(o,A,k)}return o}function zi(e,i){return Jn(e,gc(e),i)}function ko(e,i){return Jn(e,Yc(e),i)}function jn(e,i){return function(o,f){var m=Se(o)?yn:uc,w=i?i():{};return m(o,e,Q(f,2),w)}}function pi(e){return ve(function(i,o){var f=-1,m=o.length,w=m>1?o[m-1]:r,I=m>2?o[2]:r;for(w=e.length>3&&typeof w=="function"?(m--,w):r,I&&fn(o[0],o[1],I)&&(w=m<3?r:w,m=1),i=ke(i);++f<m;){var A=o[f];A&&e(i,A,f,w)}return i})}function Ro(e,i){return function(o,f){if(o==null)return o;if(!_n(o))return e(o,f);for(var m=o.length,w=i?m:-1,I=ke(o);(i?w--:++w<m)&&f(I[w],w,I)!==!1;);return o}}function Mo(e){return function(i,o,f){for(var m=-1,w=ke(i),I=f(i),A=I.length;A--;){var k=I[e?A:++m];if(o(w[k],k,w)===!1)break}return i}}function fc(e,i,o){var f=i&Y,m=Yr(e);function w(){var I=this&&this!==yt&&this instanceof w?m:e;return I.apply(f?o:this,arguments)}return w}function Yl(e){return function(i){i=De(i);var o=Ii(i)?Ot(i):r,f=o?o[0]:i.charAt(0),m=o?Ri(o,1).join(""):i.slice(1);return f[e]()+m}}function ar(e){return function(i){return Er(zd(Md(i).replace(Ju,"")),e,"")}}function Yr(e){return function(){var i=arguments;switch(i.length){case 0:return new e;case 1:return new e(i[0]);case 2:return new e(i[0],i[1]);case 3:return new e(i[0],i[1],i[2]);case 4:return new e(i[0],i[1],i[2],i[3]);case 5:return new e(i[0],i[1],i[2],i[3],i[4]);case 6:return new e(i[0],i[1],i[2],i[3],i[4],i[5]);case 7:return new e(i[0],i[1],i[2],i[3],i[4],i[5],i[6])}var o=Xn(e.prototype),f=e.apply(o,i);return Je(f)?f:o}}function qa(e,i,o){var f=Yr(e);function m(){for(var w=arguments.length,I=W(w),A=w,k=ce(m);A--;)I[A]=arguments[A];var b=w<3&&I[0]!==k&&I[w-1]!==k?[]:wn(I,k);if(w-=b.length,w<o)return N(e,i,zo,m.placeholder,r,I,b,r,r,o-w);var B=this&&this!==yt&&this instanceof m?f:e;return ct(B,this,I)}return m}function Ds(e){return function(i,o,f){var m=ke(i);if(!_n(i)){var w=Q(o,3);i=kt(i),o=function(A){return w(m[A],A,m)}}var I=e(i,o,f);return I>-1?m[w?i[I]:I]:r}}function Ja(e){return L(function(i){var o=i.length,f=o,m=Dt.prototype.thru;for(e&&i.reverse();f--;){var w=i[f];if(typeof w!="function")throw new Oe(g);if(m&&!I&&me(w)=="wrapper")var I=new Dt([],!0)}for(f=I?f:o;++f<o;){w=i[f];var A=me(w),k=A=="wrapper"?re(w):r;k&&mc(k[0])&&k[1]==(Ie|j|we|at)&&!k[4].length&&k[9]==1?I=I[me(k[0])].apply(I,k[3]):I=w.length==1&&mc(w)?I[A]():I.thru(w)}return function(){var b=arguments,B=b[0];if(I&&b.length==1&&Se(B))return I.plant(B).value();for(var G=0,q=o?i[G].apply(this,b):B;++G<o;)q=i[G].call(this,q);return q}})}function zo(e,i,o,f,m,w,I,A,k,b){var B=i&Ie,G=i&Y,q=i&X,ie=i&(j|ye),de=i&gt,Ee=q?r:Yr(e);function fe(){for(var Ne=arguments.length,Re=W(Ne),Dn=Ne;Dn--;)Re[Dn]=arguments[Dn];if(ie)var hn=ce(fe),Wn=fs(Re,hn);if(f&&(Re=Va(Re,f,m,ie)),w&&(Re=dn(Re,w,I,ie)),Ne-=Wn,ie&&Ne<b){var lt=wn(Re,hn);return N(e,i,zo,fe.placeholder,o,Re,lt,A,k,b-Ne)}var yi=G?o:this,fr=q?yi[e]:e;return Ne=Re.length,A?Re=If(Re,A):de&&Ne>1&&Re.reverse(),B&&k<Ne&&(Re.length=k),this&&this!==yt&&this instanceof fe&&(fr=Ee||Yr(fr)),fr.apply(yi,Re)}return fe}function t(e,i){return function(o,f){return Ba(o,e,i(f),{})}}function n(e,i){return function(o,f){var m;if(o===r&&f===r)return i;if(o!==r&&(m=o),f!==r){if(m===r)return f;typeof o=="string"||typeof f=="string"?(o=Vt(o),f=Vt(f)):(o=bl(o),f=bl(f)),m=e(o,f)}return m}}function s(e){return L(function(i){return i=We(i,zt(Q())),ve(function(o){var f=this;return e(i,function(m){return ct(m,f,o)})})})}function a(e,i){i=i===r?" ":Vt(i);var o=i.length;if(o<2)return o?Gr(i,e):i;var f=Gr(i,ws(e/qi(i)));return Ii(i)?Ri(Ot(f),0,e).join(""):f.slice(0,e)}function d(e,i,o,f){var m=i&Y,w=Yr(e);function I(){for(var A=-1,k=arguments.length,b=-1,B=f.length,G=W(B+k),q=this&&this!==yt&&this instanceof I?w:e;++b<B;)G[b]=f[b];for(;k--;)G[b++]=arguments[++A];return ct(q,m?o:this,G)}return I}function p(e){return function(i,o,f){return f&&typeof f!="number"&&fn(i,o,f)&&(o=f=r),i=dr(i),o===r?(o=i,i=0):o=dr(o),f=f===r?i<o?1:-1:dr(f),Ul(i,o,f,e)}}function P(e){return function(i,o){return typeof i=="string"&&typeof o=="string"||(i=ei(i),o=ei(o)),e(i,o)}}function N(e,i,o,f,m,w,I,A,k,b){var B=i&j,G=B?I:r,q=B?r:I,ie=B?w:r,de=B?r:w;i|=B?we:xe,i&=~(B?xe:we),i&se||(i&=-4);var Ee=[e,i,m,ie,G,de,q,A,k,b],fe=o.apply(r,Ee);return mc(e)&&$c(fe,Ee),fe.placeholder=f,ed(fe,e,i)}function M(e){var i=Ve[e];return function(o,f){if(o=ei(o),f=f==null?0:wt(Pe(f),292),f&&Il(o)){var m=(De(o)+"e").split("e"),w=i(m[0]+"e"+(+m[1]+f));return m=(De(w)+"e").split("e"),+(m[0]+"e"+(+m[1]-f))}return i(o)}}var K=Or&&1/Vi(new Or([,-0]))[1]==ut?function(e){return new Or(e)}:kc;function te(e){return function(i){var o=Jt(i);return o==An?Ai(i):o==Nn?Sa(i):Qi(i,e(i))}}function ue(e,i,o,f,m,w,I,A){var k=i&X;if(!k&&typeof e!="function")throw new Oe(g);var b=f?f.length:0;if(b||(i&=-97,f=m=r),I=I===r?I:it(Pe(I),0),A=A===r?A:Pe(A),b-=m?m.length:0,i&xe){var B=f,G=m;f=m=r}var q=k?r:re(e),ie=[e,i,o,f,m,B,G,w,I,A];if(q&&Pf(ie,q),e=ie[0],i=ie[1],o=ie[2],f=ie[3],m=ie[4],A=ie[9]=ie[9]===r?k?0:e.length:it(ie[9]-b,0),!A&&i&(j|ye)&&(i&=-25),!i||i==Y)var de=fc(e,i,o);else i==j||i==ye?de=qa(e,i,A):(i==we||i==(Y|we))&&!m.length?de=d(e,i,o,f):de=zo.apply(r,ie);var Ee=q?zs:$c;return ed(Ee(de,ie),e,i)}function oe(e,i,o,f){return e===r||vi(e,Gn[o])&&!ze.call(f,o)?i:e}function Be(e,i,o,f,m,w){return Je(e)&&Je(i)&&(w.set(i,e),Br(e,i,r,Be,w),w.delete(i)),e}function Ue(e){return Vl(e)?r:e}function Ht(e,i,o,f,m,w){var I=o&Z,A=e.length,k=i.length;if(A!=k&&!(I&&k>A))return!1;var b=w.get(e),B=w.get(i);if(b&&B)return b==i&&B==e;var G=-1,q=!0,ie=o&F?new Ti:r;for(w.set(e,i),w.set(i,e);++G<A;){var de=e[G],Ee=i[G];if(f)var fe=I?f(Ee,de,G,i,e,w):f(de,Ee,G,e,i,w);if(fe!==r){if(fe)continue;q=!1;break}if(ie){if(!ao(i,function(Ne,Re){if(!St(ie,Re)&&(de===Ne||m(de,Ne,o,f,w)))return ie.push(Re)})){q=!1;break}}else if(!(de===Ee||m(de,Ee,o,f,w))){q=!1;break}}return w.delete(e),w.delete(i),q}function mi(e,i,o,f,m,w,I){switch(o){case vr:if(e.byteLength!=i.byteLength||e.byteOffset!=i.byteOffset)return!1;e=e.buffer,i=i.buffer;case is:return!(e.byteLength!=i.byteLength||!w(new vs(e),new vs(i)));case jr:case bi:case $r:return vi(+e,+i);case Nt:return e.name==i.name&&e.message==i.message;case ii:case es:return e==i+"";case An:var A=Ai;case Nn:var k=f&Z;if(A||(A=Vi),e.size!=i.size&&!k)return!1;var b=I.get(e);if(b)return b==i;f|=F,I.set(e,i);var B=Ht(A(e),A(i),f,m,w,I);return I.delete(e),B;case Ys:if(Xt)return Xt.call(e)==Xt.call(i)}return!1}function O(e,i,o,f,m,w){var I=o&Z,A=U(e),k=A.length,b=U(i),B=b.length;if(k!=B&&!I)return!1;for(var G=k;G--;){var q=A[G];if(!(I?q in i:ze.call(i,q)))return!1}var ie=w.get(e),de=w.get(i);if(ie&&de)return ie==i&&de==e;var Ee=!0;w.set(e,i),w.set(i,e);for(var fe=I;++G<k;){q=A[G];var Ne=e[q],Re=i[q];if(f)var Dn=I?f(Re,Ne,q,i,e,w):f(Ne,Re,q,e,i,w);if(!(Dn===r?Ne===Re||m(Ne,Re,o,f,w):Dn)){Ee=!1;break}fe||(fe=q=="constructor")}if(Ee&&!fe){var hn=e.constructor,Wn=i.constructor;hn!=Wn&&"constructor"in e&&"constructor"in i&&!(typeof hn=="function"&&hn instanceof hn&&typeof Wn=="function"&&Wn instanceof Wn)&&(Ee=!1)}return w.delete(e),w.delete(i),Ee}function L(e){return yc(Jc(e,r,od),e+"")}function U(e){return Ts(e,kt,gc)}function J(e){return Ts(e,En,Yc)}var re=Dr?function(e){return Dr.get(e)}:kc;function me(e){for(var i=e.name+"",o=Ni[i],f=ze.call(Ni,i)?o.length:0;f--;){var m=o[f],w=m.func;if(w==null||w==e)return m.name}return i}function ce(e){var i=ze.call(y,"placeholder")?y:e;return i.placeholder}function Q(){var e=y.iteratee||Lc;return e=e===Lc?Hr:e,arguments.length?e(arguments[0],arguments[1]):e}function qe(e,i){var o=e.__data__;return yf(i)?o[typeof i=="string"?"string":"hash"]:o.map}function Ce(e){for(var i=kt(e),o=i.length;o--;){var f=i[o],m=e[f];i[o]=[f,m,Vc(m)]}return i}function qt(e,i){var o=ml(e,i);return ht(o)?o:r}function hc(e){var i=ze.call(e,Zn),o=e[Zn];try{e[Zn]=r;var f=!0}catch{}var m=ln.call(e);return f&&(i?e[Zn]=o:delete e[Zn]),m}var gc=go?function(e){return e==null?[]:(e=ke(e),si(go(e),function(i){return Pl.call(e,i)}))}:Rc,Yc=go?function(e){for(var i=[];e;)oi(i,gc(e)),e=ys(e);return i}:Rc,Jt=ft;(po&&Jt(new po(new ArrayBuffer(1)))!=vr||Mr&&Jt(new Mr)!=An||zr&&Jt(zr.resolve())!=ea||Or&&Jt(new Or)!=Nn||Ps&&Jt(new Ps)!=ns)&&(Jt=function(e){var i=ft(e),o=i==ni?e.constructor:r,f=o?Ws(o):"";if(f)switch(f){case rc:return vr;case Aa:return An;case Na:return ea;case Ta:return Nn;case La:return ns}return i});function ff(e,i,o){for(var f=-1,m=o.length;++f<m;){var w=o[f],I=w.size;switch(w.type){case"drop":e+=I;break;case"dropRight":i-=I;break;case"take":i=wt(i,e+I);break;case"takeRight":e=it(e,i-I);break}}return{start:e,end:i}}function hf(e){var i=e.match(rs);return i?i[1].split(Du):[]}function Kc(e,i,o){i=gi(i,e);for(var f=-1,m=i.length,w=!1;++f<m;){var I=Oi(i[f]);if(!(w=e!=null&&o(e,I)))break;e=e[I]}return w||++f!=m?w:(m=e==null?0:e.length,!!m&&ru(m)&&ur(I,m)&&(Se(e)||Us(e)))}function gf(e){var i=e.length,o=new e.constructor(i);return i&&typeof e[0]=="string"&&ze.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function Qc(e){return typeof e.constructor=="function"&&!Kl(e)?Xn(ys(e)):{}}function pf(e,i,o){var f=e.constructor;switch(i){case is:return be(e);case jr:case bi:return new f(+e);case vr:return cc(e,o);case Zo:case Xo:case Yo:case Ko:case Qo:case Vo:case qo:case Jo:case Ks:return Ka(e,o);case An:return new f;case $r:case es:return new f(e);case ii:return Ya(e);case Nn:return new f;case Ys:return dc(e)}}function mf(e,i){var o=i.length;if(!o)return e;var f=o-1;return i[f]=(o>1?"& ":"")+i[f],i=i.join(o>2?", ":" "),e.replace(Ou,`{
10
+ /* [wrapped with `+i+`] */
11
+ `)}function vf(e){return Se(e)||Us(e)||!!(kr&&e&&e[kr])}function ur(e,i){var o=typeof e;return i=i??V,!!i&&(o=="number"||o!="symbol"&&Xu.test(e))&&e>-1&&e%1==0&&e<i}function fn(e,i,o){if(!Je(o))return!1;var f=typeof i;return(f=="number"?_n(o)&&ur(i,o.length):f=="string"&&i in o)?vi(o[i],e):!1}function pc(e,i){if(Se(e))return!1;var o=typeof e;return o=="number"||o=="symbol"||o=="boolean"||e==null||On(e)?!0:oa.test(e)||!sa.test(e)||i!=null&&e in ke(i)}function yf(e){var i=typeof e;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?e!=="__proto__":e===null}function mc(e){var i=me(e),o=y[i];if(typeof o!="function"||!(i in Ae.prototype))return!1;if(e===o)return!0;var f=re(o);return!!f&&e===f[0]}function Sf(e){return!!ho&&ho in e}var wf=fo?cr:Mc;function Kl(e){var i=e&&e.constructor,o=typeof i=="function"&&i.prototype||Gn;return e===o}function Vc(e){return e===e&&!Je(e)}function qc(e,i){return function(o){return o==null?!1:o[e]===i&&(i!==r||e in ke(o))}}function xf(e){var i=nu(e,function(f){return o.size===_&&o.clear(),f}),o=i.cache;return i}function Pf(e,i){var o=e[1],f=i[1],m=o|f,w=m<(Y|X|Ie),I=f==Ie&&o==j||f==Ie&&o==at&&e[7].length<=i[8]||f==(Ie|at)&&i[7].length<=i[8]&&o==j;if(!(w||I))return e;f&Y&&(e[2]=i[2],m|=o&Y?0:se);var A=i[3];if(A){var k=e[3];e[3]=k?Va(k,A,i[4]):A,e[4]=k?wn(e[3],C):i[4]}return A=i[5],A&&(k=e[5],e[5]=k?dn(k,A,i[6]):A,e[6]=k?wn(e[5],C):i[6]),A=i[7],A&&(e[7]=A),f&Ie&&(e[8]=e[8]==null?i[8]:wt(e[8],i[8])),e[9]==null&&(e[9]=i[9]),e[0]=i[0],e[1]=m,e}function _f(e){var i=[];if(e!=null)for(var o in ke(e))i.push(o);return i}function Ef(e){return ln.call(e)}function Jc(e,i,o){return i=it(i===r?e.length-1:i,0),function(){for(var f=arguments,m=-1,w=it(f.length-i,0),I=W(w);++m<w;)I[m]=f[i+m];m=-1;for(var A=W(i+1);++m<i;)A[m]=f[m];return A[i]=o(I),ct(e,this,A)}}function jc(e,i){return i.length<2?e:Qn(e,cn(i,0,-1))}function If(e,i){for(var o=e.length,f=wt(i.length,o),m=Ct(e);f--;){var w=i[f];e[f]=ur(w,o)?m[w]:r}return e}function vc(e,i){if(!(i==="constructor"&&typeof e[i]=="function")&&i!="__proto__")return e[i]}var $c=td(zs),Ql=Pa||function(e,i){return yt.setTimeout(e,i)},yc=td(Za);function ed(e,i,o){var f=i+"";return yc(e,mf(f,Af(hf(f),o)))}function td(e){var i=0,o=0;return function(){var f=nc(),m=pt-(f-o);if(o=f,m>0){if(++i>=It)return arguments[0]}else i=0;return e.apply(r,arguments)}}function ja(e,i){var o=-1,f=e.length,m=f-1;for(i=i===r?f:i;++o<i;){var w=or(o,m),I=e[w];e[w]=e[o],e[o]=I}return e.length=i,e}var nd=xf(function(e){var i=[];return e.charCodeAt(0)===46&&i.push(""),e.replace(Mu,function(o,f,m,w){i.push(m?w.replace(Fu,"$1"):f||o)}),i});function Oi(e){if(typeof e=="string"||On(e))return e;var i=e+"";return i=="0"&&1/e==-1/0?"-0":i}function Ws(e){if(e!=null){try{return nt.call(e)}catch{}try{return e+""}catch{}}return""}function Af(e,i){return Ke(Un,function(o){var f="_."+o[0];i&o[1]&&!Sn(e,f)&&e.push(f)}),e.sort()}function id(e){if(e instanceof Ae)return e.clone();var i=new Dt(e.__wrapped__,e.__chain__);return i.__actions__=Ct(e.__actions__),i.__index__=e.__index__,i.__values__=e.__values__,i}function Nf(e,i,o){(o?fn(e,i,o):i===r)?i=1:i=it(Pe(i),0);var f=e==null?0:e.length;if(!f||i<1)return[];for(var m=0,w=0,I=W(ws(f/i));m<f;)I[w++]=cn(e,m,m+=i);return I}function Tf(e){for(var i=-1,o=e==null?0:e.length,f=0,m=[];++i<o;){var w=e[i];w&&(m[f++]=w)}return m}function Lf(){var e=arguments.length;if(!e)return[];for(var i=W(e-1),o=arguments[0],f=e;f--;)i[f-1]=arguments[f];return oi(Se(o)?Ct(o):[o],_t(i,1))}var Cf=ve(function(e,i){return ot(e)?Ut(e,_t(i,1,ot,!0)):[]}),kf=ve(function(e,i){var o=$n(i);return ot(o)&&(o=r),ot(e)?Ut(e,_t(i,1,ot,!0),Q(o,2)):[]}),Rf=ve(function(e,i){var o=$n(i);return ot(o)&&(o=r),ot(e)?Ut(e,_t(i,1,ot,!0),r,o):[]});function Mf(e,i,o){var f=e==null?0:e.length;return f?(i=o||i===r?1:Pe(i),cn(e,i<0?0:i,f)):[]}function zf(e,i,o){var f=e==null?0:e.length;return f?(i=o||i===r?1:Pe(i),i=f-i,cn(e,0,i<0?0:i)):[]}function Of(e,i){return e&&e.length?Os(e,Q(i,3),!0,!0):[]}function Df(e,i){return e&&e.length?Os(e,Q(i,3),!0):[]}function Wf(e,i,o,f){var m=e==null?0:e.length;return m?(o&&typeof o!="number"&&fn(e,i,o)&&(o=0,f=m),ba(e,i,o,f)):[]}function rd(e,i,o){var f=e==null?0:e.length;if(!f)return-1;var m=o==null?0:Pe(o);return m<0&&(m=it(f+m,0)),us(e,Q(i,3),m)}function sd(e,i,o){var f=e==null?0:e.length;if(!f)return-1;var m=f-1;return o!==r&&(m=Pe(o),m=o<0?it(f+m,0):wt(m,f-1)),us(e,Q(i,3),m,!0)}function od(e){var i=e==null?0:e.length;return i?_t(e,1):[]}function Uf(e){var i=e==null?0:e.length;return i?_t(e,ut):[]}function Ff(e,i){var o=e==null?0:e.length;return o?(i=i===r?1:Pe(i),_t(e,i)):[]}function Hf(e){for(var i=-1,o=e==null?0:e.length,f={};++i<o;){var m=e[i];f[m[0]]=m[1]}return f}function ld(e){return e&&e.length?e[0]:r}function bf(e,i,o){var f=e==null?0:e.length;if(!f)return-1;var m=o==null?0:Pe(o);return m<0&&(m=it(f+m,0)),Ei(e,i,m)}function Bf(e){var i=e==null?0:e.length;return i?cn(e,0,-1):[]}var Gf=ve(function(e){var i=We(e,Gl);return i.length&&i[0]===e[0]?Cs(i):[]}),Zf=ve(function(e){var i=$n(e),o=We(e,Gl);return i===$n(o)?i=r:o.pop(),o.length&&o[0]===e[0]?Cs(o,Q(i,2)):[]}),Xf=ve(function(e){var i=$n(e),o=We(e,Gl);return i=typeof i=="function"?i:r,i&&o.pop(),o.length&&o[0]===e[0]?Cs(o,r,i):[]});function Yf(e,i){return e==null?"":_a.call(e,i)}function $n(e){var i=e==null?0:e.length;return i?e[i-1]:r}function Kf(e,i,o){var f=e==null?0:e.length;if(!f)return-1;var m=f;return o!==r&&(m=Pe(o),m=m<0?it(f+m,0):wt(m,f-1)),i===i?Nr(e,i,m):us(e,Yi,m,!0)}function Qf(e,i){return e&&e.length?sr(e,Pe(i)):r}var Vf=ve(ad);function ad(e,i){return e&&e.length&&i&&i.length?Vn(e,i):e}function qf(e,i,o){return e&&e.length&&i&&i.length?Vn(e,i,Q(o,2)):e}function Jf(e,i,o){return e&&e.length&&i&&i.length?Vn(e,i,r,o):e}var jf=L(function(e,i){var o=e==null?0:e.length,f=wo(e,i);return Ms(e,We(i,function(m){return ur(m,o)?+m:m}).sort(Xl)),f});function $f(e,i){var o=[];if(!(e&&e.length))return o;var f=-1,m=[],w=e.length;for(i=Q(i,3);++f<w;){var I=e[f];i(I,f,e)&&(o.push(I),m.push(f))}return Ms(e,m),o}function Sc(e){return e==null?e:Ia.call(e)}function eh(e,i,o){var f=e==null?0:e.length;return f?(o&&typeof o!="number"&&fn(e,i,o)?(i=0,o=f):(i=i==null?0:Pe(i),o=o===r?f:Pe(o)),cn(e,i,o)):[]}function th(e,i){return Zr(e,i)}function nh(e,i,o){return Hl(e,i,Q(o,2))}function ih(e,i){var o=e==null?0:e.length;if(o){var f=Zr(e,i);if(f<o&&vi(e[f],i))return f}return-1}function rh(e,i){return Zr(e,i,!0)}function sh(e,i,o){return Hl(e,i,Q(o,2),!0)}function oh(e,i){var o=e==null?0:e.length;if(o){var f=Zr(e,i,!0)-1;if(vi(e[f],i))return f}return-1}function lh(e){return e&&e.length?fi(e):[]}function ah(e,i){return e&&e.length?fi(e,Q(i,2)):[]}function uh(e){var i=e==null?0:e.length;return i?cn(e,1,i):[]}function ch(e,i,o){return e&&e.length?(i=o||i===r?1:Pe(i),cn(e,0,i<0?0:i)):[]}function dh(e,i,o){var f=e==null?0:e.length;return f?(i=o||i===r?1:Pe(i),i=f-i,cn(e,i<0?0:i,f)):[]}function fh(e,i){return e&&e.length?Os(e,Q(i,3),!1,!0):[]}function hh(e,i){return e&&e.length?Os(e,Q(i,3)):[]}var gh=ve(function(e){return qn(_t(e,1,ot,!0))}),ph=ve(function(e){var i=$n(e);return ot(i)&&(i=r),qn(_t(e,1,ot,!0),Q(i,2))}),mh=ve(function(e){var i=$n(e);return i=typeof i=="function"?i:r,qn(_t(e,1,ot,!0),r,i)});function vh(e){return e&&e.length?qn(e):[]}function yh(e,i){return e&&e.length?qn(e,Q(i,2)):[]}function Sh(e,i){return i=typeof i=="function"?i:r,e&&e.length?qn(e,r,i):[]}function wc(e){if(!(e&&e.length))return[];var i=0;return e=si(e,function(o){if(ot(o))return i=it(o.length,i),!0}),Cn(i,function(o){return We(e,Ar(o))})}function ud(e,i){if(!(e&&e.length))return[];var o=wc(e);return i==null?o:We(o,function(f){return ct(i,r,f)})}var wh=ve(function(e,i){return ot(e)?Ut(e,i):[]}),xh=ve(function(e){return Xr(si(e,ot))}),Ph=ve(function(e){var i=$n(e);return ot(i)&&(i=r),Xr(si(e,ot),Q(i,2))}),_h=ve(function(e){var i=$n(e);return i=typeof i=="function"?i:r,Xr(si(e,ot),r,i)}),Eh=ve(wc);function Ih(e,i){return Xa(e||[],i||[],nr)}function Ah(e,i){return Xa(e||[],i||[],Et)}var Nh=ve(function(e){var i=e.length,o=i>1?e[i-1]:r;return o=typeof o=="function"?(e.pop(),o):r,ud(e,o)});function cd(e){var i=y(e);return i.__chain__=!0,i}function Th(e,i){return i(e),e}function $a(e,i){return i(e)}var Lh=L(function(e){var i=e.length,o=i?e[0]:0,f=this.__wrapped__,m=function(w){return wo(w,e)};return i>1||this.__actions__.length||!(f instanceof Ae)||!ur(o)?this.thru(m):(f=f.slice(o,+o+(i?1:0)),f.__actions__.push({func:$a,args:[m],thisArg:r}),new Dt(f,this.__chain__).thru(function(w){return i&&!w.length&&w.push(r),w}))});function Ch(){return cd(this)}function kh(){return new Dt(this.value(),this.__chain__)}function Rh(){this.__values__===r&&(this.__values__=Ed(this.value()));var e=this.__index__>=this.__values__.length,i=e?r:this.__values__[this.__index__++];return{done:e,value:i}}function Mh(){return this}function zh(e){for(var i,o=this;o instanceof er;){var f=id(o);f.__index__=0,f.__values__=r,i?m.__wrapped__=f:i=f;var m=f;o=o.__wrapped__}return m.__wrapped__=e,i}function Oh(){var e=this.__wrapped__;if(e instanceof Ae){var i=e;return this.__actions__.length&&(i=new Ae(this)),i=i.reverse(),i.__actions__.push({func:$a,args:[Sc],thisArg:r}),new Dt(i,this.__chain__)}return this.thru(Sc)}function Dh(){return Lo(this.__wrapped__,this.__actions__)}var Wh=jn(function(e,i,o){ze.call(e,o)?++e[o]:Rn(e,o,1)});function Uh(e,i,o){var f=Se(e)?lo:Ha;return o&&fn(e,i,o)&&(i=r),f(e,Q(i,3))}function Fh(e,i){var o=Se(e)?si:Mn;return o(e,Q(i,3))}var Hh=Ds(rd),bh=Ds(sd);function Bh(e,i){return _t(eu(e,i),1)}function Gh(e,i){return _t(eu(e,i),ut)}function Zh(e,i,o){return o=o===r?1:Pe(o),_t(eu(e,i),o)}function dd(e,i){var o=Se(e)?Ke:Pt;return o(e,Q(i,3))}function fd(e,i){var o=Se(e)?_i:Po;return o(e,Q(i,3))}var Xh=jn(function(e,i,o){ze.call(e,o)?e[o].push(i):Rn(e,o,[i])});function Yh(e,i,o,f){e=_n(e)?e:Do(e),o=o&&!f?Pe(o):0;var m=e.length;return o<0&&(o=it(m+o,0)),su(e)?o<=m&&e.indexOf(i,o)>-1:!!m&&Ei(e,i,o)>-1}var Kh=ve(function(e,i,o){var f=-1,m=typeof i=="function",w=_n(e)?W(e.length):[];return Pt(e,function(I){w[++f]=m?ct(i,I,o):rr(I,i,o)}),w}),Qh=jn(function(e,i,o){Rn(e,o,i)});function eu(e,i){var o=Se(e)?We:br;return o(e,Q(i,3))}function Vh(e,i,o,f){return e==null?[]:(Se(i)||(i=i==null?[]:[i]),o=f?r:o,Se(o)||(o=o==null?[]:[o]),Rs(e,i,o))}var qh=jn(function(e,i,o){e[o?0:1].push(i)},function(){return[[],[]]});function Jh(e,i,o){var f=Se(e)?Er:sn,m=arguments.length<3;return f(e,Q(i,4),o,m,Pt)}function jh(e,i,o){var f=Se(e)?ga:sn,m=arguments.length<3;return f(e,Q(i,4),o,m,Po)}function $h(e,i){var o=Se(e)?si:Mn;return o(e,iu(Q(i,3)))}function eg(e){var i=Se(e)?xt:Lt;return i(e)}function tg(e,i,o){(o?fn(e,i,o):i===r)?i=1:i=Pe(i);var f=Se(e)?ac:ki;return f(e,i)}function ng(e){var i=Se(e)?ee:Qt;return i(e)}function ig(e){if(e==null)return 0;if(_n(e))return su(e)?qi(e):e.length;var i=Jt(e);return i==An||i==Nn?e.size:ui(e).length}function rg(e,i,o){var f=Se(e)?ao:Fl;return o&&fn(e,i,o)&&(i=r),f(e,Q(i,3))}var sg=ve(function(e,i){if(e==null)return[];var o=i.length;return o>1&&fn(e,i[0],i[1])?i=[]:o>2&&fn(i[0],i[1],i[2])&&(i=[i[0]]),Rs(e,_t(i,1),[])}),tu=_l||function(){return yt.Date.now()};function og(e,i){if(typeof i!="function")throw new Oe(g);return e=Pe(e),function(){if(--e<1)return i.apply(this,arguments)}}function hd(e,i,o){return i=o?r:i,i=e&&i==null?e.length:i,ue(e,Ie,r,r,r,r,i)}function gd(e,i){var o;if(typeof i!="function")throw new Oe(g);return e=Pe(e),function(){return--e>0&&(o=i.apply(this,arguments)),e<=1&&(i=r),o}}var xc=ve(function(e,i,o){var f=Y;if(o.length){var m=wn(o,ce(xc));f|=we}return ue(e,f,i,o,m)}),pd=ve(function(e,i,o){var f=Y|X;if(o.length){var m=wn(o,ce(pd));f|=we}return ue(i,f,e,o,m)});function md(e,i,o){i=o?r:i;var f=ue(e,j,r,r,r,r,r,i);return f.placeholder=md.placeholder,f}function vd(e,i,o){i=o?r:i;var f=ue(e,ye,r,r,r,r,r,i);return f.placeholder=vd.placeholder,f}function yd(e,i,o){var f,m,w,I,A,k,b=0,B=!1,G=!1,q=!0;if(typeof e!="function")throw new Oe(g);i=ei(i)||0,Je(o)&&(B=!!o.leading,G="maxWait"in o,w=G?it(ei(o.maxWait)||0,i):w,q="trailing"in o?!!o.trailing:q);function ie(lt){var yi=f,fr=m;return f=m=r,b=lt,I=e.apply(fr,yi),I}function de(lt){return b=lt,A=Ql(Ne,i),B?ie(lt):I}function Ee(lt){var yi=lt-k,fr=lt-b,Wd=i-yi;return G?wt(Wd,w-fr):Wd}function fe(lt){var yi=lt-k,fr=lt-b;return k===r||yi>=i||yi<0||G&&fr>=w}function Ne(){var lt=tu();if(fe(lt))return Re(lt);A=Ql(Ne,Ee(lt))}function Re(lt){return A=r,q&&f?ie(lt):(f=m=r,I)}function Dn(){A!==r&&Mi(A),b=0,f=k=m=A=r}function hn(){return A===r?I:Re(tu())}function Wn(){var lt=tu(),yi=fe(lt);if(f=arguments,m=this,k=lt,yi){if(A===r)return de(k);if(G)return Mi(A),A=Ql(Ne,i),ie(k)}return A===r&&(A=Ql(Ne,i)),I}return Wn.cancel=Dn,Wn.flush=hn,Wn}var lg=ve(function(e,i){return dt(e,1,i)}),ag=ve(function(e,i,o){return dt(e,ei(i)||0,o)});function ug(e){return ue(e,gt)}function nu(e,i){if(typeof e!="function"||i!=null&&typeof i!="function")throw new Oe(g);var o=function(){var f=arguments,m=i?i.apply(this,f):f[0],w=o.cache;if(w.has(m))return w.get(m);var I=e.apply(this,f);return o.cache=w.set(m,I)||w,I};return o.cache=new(nu.Cache||Kn),o}nu.Cache=Kn;function iu(e){if(typeof e!="function")throw new Oe(g);return function(){var i=arguments;switch(i.length){case 0:return!e.call(this);case 1:return!e.call(this,i[0]);case 2:return!e.call(this,i[0],i[1]);case 3:return!e.call(this,i[0],i[1],i[2])}return!e.apply(this,i)}}function cg(e){return gd(2,e)}var dg=lr(function(e,i){i=i.length==1&&Se(i[0])?We(i[0],zt(Q())):We(_t(i,1),zt(Q()));var o=i.length;return ve(function(f){for(var m=-1,w=wt(f.length,o);++m<w;)f[m]=i[m].call(this,f[m]);return ct(e,this,f)})}),Pc=ve(function(e,i){var o=wn(i,ce(Pc));return ue(e,we,r,i,o)}),Sd=ve(function(e,i){var o=wn(i,ce(Sd));return ue(e,xe,r,i,o)}),fg=L(function(e,i){return ue(e,at,r,r,r,i)});function hg(e,i){if(typeof e!="function")throw new Oe(g);return i=i===r?i:Pe(i),ve(e,i)}function gg(e,i){if(typeof e!="function")throw new Oe(g);return i=i==null?0:it(Pe(i),0),ve(function(o){var f=o[i],m=Ri(o,0,i);return f&&oi(m,f),ct(e,this,m)})}function pg(e,i,o){var f=!0,m=!0;if(typeof e!="function")throw new Oe(g);return Je(o)&&(f="leading"in o?!!o.leading:f,m="trailing"in o?!!o.trailing:m),yd(e,i,{leading:f,maxWait:i,trailing:m})}function mg(e){return hd(e,1)}function vg(e,i){return Pc(Co(i),e)}function yg(){if(!arguments.length)return[];var e=arguments[0];return Se(e)?e:[e]}function Sg(e){return an(e,H)}function wg(e,i){return i=typeof i=="function"?i:r,an(e,H,i)}function xg(e){return an(e,R|H)}function Pg(e,i){return i=typeof i=="function"?i:r,an(e,R|H,i)}function _g(e,i){return i==null||xo(e,i,kt(i))}function vi(e,i){return e===i||e!==e&&i!==i}var Eg=P(Ur),Ig=P(function(e,i){return e>=i}),Us=Ga(function(){return arguments}())?Ga:function(e){return $e(e)&&ze.call(e,"callee")&&!Pl.call(e,"callee")},Se=W.isArray,Ag=Xi?zt(Xi):Io;function _n(e){return e!=null&&ru(e.length)&&!cr(e)}function ot(e){return $e(e)&&_n(e)}function Ng(e){return e===!0||e===!1||$e(e)&&ft(e)==jr}var Kr=El||Mc,Tg=io?zt(io):Dl;function Lg(e){return $e(e)&&e.nodeType===1&&!Vl(e)}function Cg(e){if(e==null)return!0;if(_n(e)&&(Se(e)||typeof e=="string"||typeof e.splice=="function"||Kr(e)||Oo(e)||Us(e)))return!e.length;var i=Jt(e);if(i==An||i==Nn)return!e.size;if(Kl(e))return!ui(e).length;for(var o in e)if(ze.call(e,o))return!1;return!0}function kg(e,i){return Ye(e,i)}function Rg(e,i,o){o=typeof o=="function"?o:r;var f=o?o(e,i):r;return f===r?Ye(e,i,r,o):!!f}function _c(e){if(!$e(e))return!1;var i=ft(e);return i==Nt||i==Xs||typeof e.message=="string"&&typeof e.name=="string"&&!Vl(e)}function Mg(e){return typeof e=="number"&&Il(e)}function cr(e){if(!Je(e))return!1;var i=ft(e);return i==Bi||i==rn||i==Hi||i==Au}function wd(e){return typeof e=="number"&&e==Pe(e)}function ru(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=V}function Je(e){var i=typeof e;return e!=null&&(i=="object"||i=="function")}function $e(e){return e!=null&&typeof e=="object"}var xd=ro?zt(ro):rt;function zg(e,i){return e===i||Qe(e,i,Ce(i))}function Og(e,i,o){return o=typeof o=="function"?o:r,Qe(e,i,Ce(i),o)}function Dg(e){return Pd(e)&&e!=+e}function Wg(e){if(wf(e))throw new he(h);return ht(e)}function Ug(e){return e===null}function Fg(e){return e==null}function Pd(e){return typeof e=="number"||$e(e)&&ft(e)==$r}function Vl(e){if(!$e(e)||ft(e)!=ni)return!1;var i=ys(e);if(i===null)return!0;var o=ze.call(i,"constructor")&&i.constructor;return typeof o=="function"&&o instanceof o&&nt.call(o)==xn}var Ec=fl?zt(fl):un;function Hg(e){return wd(e)&&e>=-9007199254740991&&e<=V}var _d=so?zt(so):Fr;function su(e){return typeof e=="string"||!Se(e)&&$e(e)&&ft(e)==es}function On(e){return typeof e=="symbol"||$e(e)&&ft(e)==Ys}var Oo=oo?zt(oo):st;function bg(e){return e===r}function Bg(e){return $e(e)&&Jt(e)==ns}function Gg(e){return $e(e)&&ft(e)==Nu}var Zg=P(ks),Xg=P(function(e,i){return e<=i});function Ed(e){if(!e)return[];if(_n(e))return su(e)?Ot(e):Ct(e);if(Rr&&e[Rr])return hs(e[Rr]());var i=Jt(e),o=i==An?Ai:i==Nn?Vi:Do;return o(e)}function dr(e){if(!e)return e===0?e:0;if(e=ei(e),e===ut||e===-1/0){var i=e<0?-1:1;return i*le}return e===e?e:0}function Pe(e){var i=dr(e),o=i%1;return i===i?o?i-o:i:0}function Id(e){return e?Ci(Pe(e),0,ge):0}function ei(e){if(typeof e=="number")return e;if(On(e))return ae;if(Je(e)){var i=typeof e.valueOf=="function"?e.valueOf():e;e=Je(i)?i+"":i}if(typeof e!="string")return e===0?e:+e;e=pl(e);var o=Bu.test(e);return o||Zu.test(e)?fa(e.slice(2),o?2:8):bu.test(e)?ae:+e}function Ad(e){return Jn(e,En(e))}function Yg(e){return e?Ci(Pe(e),-9007199254740991,V):e===0?e:0}function De(e){return e==null?"":Vt(e)}var Kg=pi(function(e,i){if(Kl(i)||_n(i)){Jn(i,kt(i),e);return}for(var o in i)ze.call(i,o)&&nr(e,o,i[o])}),Nd=pi(function(e,i){Jn(i,En(i),e)}),ou=pi(function(e,i,o,f){Jn(i,En(i),e,f)}),Qg=pi(function(e,i,o,f){Jn(i,kt(i),e,f)}),Vg=L(wo);function qg(e,i){var o=Xn(e);return i==null?o:Wr(o,i)}var Jg=ve(function(e,i){e=ke(e);var o=-1,f=i.length,m=f>2?i[2]:r;for(m&&fn(i[0],i[1],m)&&(f=1);++o<f;)for(var w=i[o],I=En(w),A=-1,k=I.length;++A<k;){var b=I[A],B=e[b];(B===r||vi(B,Gn[b])&&!ze.call(e,b))&&(e[b]=w[b])}return e}),jg=ve(function(e){return e.push(r,Be),ct(Td,r,e)});function $g(e,i){return gl(e,Q(i,3),zn)}function ep(e,i){return gl(e,Q(i,3),Eo)}function tp(e,i){return e==null?e:_o(e,Q(i,3),En)}function np(e,i){return e==null?e:Ml(e,Q(i,3),En)}function ip(e,i){return e&&zn(e,Q(i,3))}function rp(e,i){return e&&Eo(e,Q(i,3))}function sp(e){return e==null?[]:ir(e,kt(e))}function op(e){return e==null?[]:ir(e,En(e))}function Ic(e,i,o){var f=e==null?r:Qn(e,i);return f===r?o:f}function lp(e,i){return e!=null&&Kc(e,i,Ls)}function Ac(e,i){return e!=null&&Kc(e,i,zl)}var ap=t(function(e,i,o){i!=null&&typeof i.toString!="function"&&(i=ln.call(i)),e[i]=o},Tc(In)),up=t(function(e,i,o){i!=null&&typeof i.toString!="function"&&(i=ln.call(i)),ze.call(e,i)?e[i].push(o):e[i]=[o]},Q),cp=ve(rr);function kt(e){return _n(e)?As(e):ui(e)}function En(e){return _n(e)?As(e,!0):Ao(e)}function dp(e,i){var o={};return i=Q(i,3),zn(e,function(f,m,w){Rn(o,i(f,m,w),f)}),o}function fp(e,i){var o={};return i=Q(i,3),zn(e,function(f,m,w){Rn(o,m,i(f,m,w))}),o}var hp=pi(function(e,i,o){Br(e,i,o)}),Td=pi(function(e,i,o,f){Br(e,i,o,f)}),gp=L(function(e,i){var o={};if(e==null)return o;var f=!1;i=We(i,function(w){return w=gi(w,e),f||(f=w.length>1),w}),Jn(e,J(e),o),f&&(o=an(o,R|D|H,Ue));for(var m=i.length;m--;)hi(o,i[m]);return o});function pp(e,i){return Ld(e,iu(Q(i)))}var mp=L(function(e,i){return e==null?{}:Wl(e,i)});function Ld(e,i){if(e==null)return{};var o=We(J(e),function(f){return[f]});return i=Q(i),di(e,o,function(f,m){return i(f,m[0])})}function vp(e,i,o){i=gi(i,e);var f=-1,m=i.length;for(m||(m=1,e=r);++f<m;){var w=e==null?r:e[Oi(i[f])];w===r&&(f=m,w=o),e=cr(w)?w.call(e):w}return e}function yp(e,i,o){return e==null?e:Et(e,i,o)}function Sp(e,i,o,f){return f=typeof f=="function"?f:r,e==null?e:Et(e,i,o,f)}var Cd=te(kt),kd=te(En);function wp(e,i,o){var f=Se(e),m=f||Kr(e)||Oo(e);if(i=Q(i,4),o==null){var w=e&&e.constructor;m?o=f?new w:[]:Je(e)?o=cr(w)?Xn(ys(e)):{}:o={}}return(m?Ke:zn)(e,function(I,A,k){return i(o,I,A,k)}),o}function xp(e,i){return e==null?!0:hi(e,i)}function Pp(e,i,o){return e==null?e:Bl(e,i,Co(o))}function _p(e,i,o,f){return f=typeof f=="function"?f:r,e==null?e:Bl(e,i,Co(o),f)}function Do(e){return e==null?[]:ds(e,kt(e))}function Ep(e){return e==null?[]:ds(e,En(e))}function Ip(e,i,o){return o===r&&(o=i,i=r),o!==r&&(o=ei(o),o=o===o?o:0),i!==r&&(i=ei(i),i=i===i?i:0),Ci(ei(e),i,o)}function Ap(e,i,o){return i=dr(i),o===r?(o=i,i=0):o=dr(o),e=ei(e),Ol(e,i,o)}function Np(e,i,o){if(o&&typeof o!="boolean"&&fn(e,i,o)&&(i=o=r),o===r&&(typeof i=="boolean"?(o=i,i=r):typeof e=="boolean"&&(o=e,e=r)),e===r&&i===r?(e=0,i=1):(e=dr(e),i===r?(i=e,e=0):i=dr(i)),e>i){var f=e;e=i,i=f}if(o||e%1||i%1){var m=Al();return wt(e+m*(i-e+dl("1e-"+((m+"").length-1))),i)}return or(e,i)}var Tp=ar(function(e,i,o){return i=i.toLowerCase(),e+(o?Rd(i):i)});function Rd(e){return Nc(De(e).toLowerCase())}function Md(e){return e=De(e),e&&e.replace(Yu,kn).replace(ju,"")}function Lp(e,i,o){e=De(e),i=Vt(i);var f=e.length;o=o===r?f:Ci(Pe(o),0,f);var m=o;return o-=i.length,o>=0&&e.slice(o,m)==i}function Cp(e){return e=De(e),e&&ia.test(e)?e.replace(na,ma):e}function kp(e){return e=De(e),e&&zu.test(e)?e.replace(jo,"\\$&"):e}var Rp=ar(function(e,i,o){return e+(o?"-":"")+i.toLowerCase()}),Mp=ar(function(e,i,o){return e+(o?" ":"")+i.toLowerCase()}),zp=Yl("toLowerCase");function Op(e,i,o){e=De(e),i=Pe(i);var f=i?qi(e):0;if(!i||f>=i)return e;var m=(i-f)/2;return a(xs(m),o)+e+a(ws(m),o)}function Dp(e,i,o){e=De(e),i=Pe(i);var f=i?qi(e):0;return i&&f<i?e+a(i-f,o):e}function Wp(e,i,o){e=De(e),i=Pe(i);var f=i?qi(e):0;return i&&f<i?a(i-f,o)+e:e}function Up(e,i,o){return o||i==null?i=0:i&&(i=+i),ic(De(e).replace(Vs,""),i||0)}function Fp(e,i,o){return(o?fn(e,i,o):i===r)?i=1:i=Pe(i),Gr(De(e),i)}function Hp(){var e=arguments,i=De(e[0]);return e.length<3?i:i.replace(e[1],e[2])}var bp=ar(function(e,i,o){return e+(o?"_":"")+i.toLowerCase()});function Bp(e,i,o){return o&&typeof o!="number"&&fn(e,i,o)&&(i=o=r),o=o===r?ge:o>>>0,o?(e=De(e),e&&(typeof i=="string"||i!=null&&!Ec(i))&&(i=Vt(i),!i&&Ii(e))?Ri(Ot(e),0,o):e.split(i,o)):[]}var Gp=ar(function(e,i,o){return e+(o?" ":"")+Nc(i)});function Zp(e,i,o){return e=De(e),o=o==null?0:Ci(Pe(o),0,e.length),i=Vt(i),e.slice(o,o+i.length)==i}function Xp(e,i,o){var f=y.templateSettings;o&&fn(e,i,o)&&(i=r),e=De(e),i=ou({},i,f,oe);var m=ou({},i.imports,f.imports,oe),w=kt(m),I=ds(m,w),A,k,b=0,B=i.interpolate||qs,G="__p += '",q=Xe((i.escape||qs).source+"|"+B.source+"|"+(B===Qs?Hu:qs).source+"|"+(i.evaluate||qs).source+"|$","g"),ie="//# sourceURL="+(ze.call(i,"sourceURL")?(i.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++to+"]")+`
12
+ `;e.replace(q,function(fe,Ne,Re,Dn,hn,Wn){return Re||(Re=Dn),G+=e.slice(b,Wn).replace(Ku,va),Ne&&(A=!0,G+=`' +
13
+ __e(`+Ne+`) +
14
+ '`),hn&&(k=!0,G+=`';
15
+ `+hn+`;
16
+ __p += '`),Re&&(G+=`' +
17
+ ((__t = (`+Re+`)) == null ? '' : __t) +
18
+ '`),b=Wn+fe.length,fe}),G+=`';
19
+ `;var de=ze.call(i,"variable")&&i.variable;if(!de)G=`with (obj) {
20
+ `+G+`
21
+ }
22
+ `;else if(Uu.test(de))throw new he(v);G=(k?G.replace(Tu,""):G).replace(Lu,"$1").replace(Cu,"$1;"),G="function("+(de||"obj")+`) {
23
+ `+(de?"":`obj || (obj = {});
24
+ `)+"var __t, __p = ''"+(A?", __e = _.escape":"")+(k?`, __j = Array.prototype.join;
25
+ function print() { __p += __j.call(arguments, '') }
26
+ `:`;
27
+ `)+G+`return __p
28
+ }`;var Ee=Od(function(){return Le(w,ie+"return "+G).apply(r,I)});if(Ee.source=G,_c(Ee))throw Ee;return Ee}function Yp(e){return De(e).toLowerCase()}function Kp(e){return De(e).toUpperCase()}function Qp(e,i,o){if(e=De(e),e&&(o||i===r))return pl(e);if(!e||!(i=Vt(i)))return e;var f=Ot(e),m=Ot(i),w=Zt(f,m),I=Ze(f,m)+1;return Ri(f,w,I).join("")}function Vp(e,i,o){if(e=De(e),e&&(o||i===r))return e.slice(0,on(e)+1);if(!e||!(i=Vt(i)))return e;var f=Ot(e),m=Ze(f,Ot(i))+1;return Ri(f,0,m).join("")}function qp(e,i,o){if(e=De(e),e&&(o||i===r))return e.replace(Vs,"");if(!e||!(i=Vt(i)))return e;var f=Ot(e),m=Zt(f,Ot(i));return Ri(f,m).join("")}function Jp(e,i){var o=$t,f=en;if(Je(i)){var m="separator"in i?i.separator:m;o="length"in i?Pe(i.length):o,f="omission"in i?Vt(i.omission):f}e=De(e);var w=e.length;if(Ii(e)){var I=Ot(e);w=I.length}if(o>=w)return e;var A=o-qi(f);if(A<1)return f;var k=I?Ri(I,0,A).join(""):e.slice(0,A);if(m===r)return k+f;if(I&&(A+=k.length-A),Ec(m)){if(e.slice(A).search(m)){var b,B=k;for(m.global||(m=Xe(m.source,De(la.exec(m))+"g")),m.lastIndex=0;b=m.exec(B);)var G=b.index;k=k.slice(0,G===r?A:G)}}else if(e.indexOf(Vt(m),A)!=A){var q=k.lastIndexOf(m);q>-1&&(k=k.slice(0,q))}return k+f}function jp(e){return e=De(e),e&&ku.test(e)?e.replace(ta,gs):e}var $p=ar(function(e,i,o){return e+(o?" ":"")+i.toUpperCase()}),Nc=Yl("toUpperCase");function zd(e,i,o){return e=De(e),i=o?r:i,i===r?ya(e)?vl(e):pa(e):e.match(i)||[]}var Od=ve(function(e,i){try{return ct(e,r,i)}catch(o){return _c(o)?o:new he(o)}}),em=L(function(e,i){return Ke(i,function(o){o=Oi(o),Rn(e,o,xc(e[o],e))}),e});function tm(e){var i=e==null?0:e.length,o=Q();return e=i?We(e,function(f){if(typeof f[1]!="function")throw new Oe(g);return[o(f[0]),f[1]]}):[],ve(function(f){for(var m=-1;++m<i;){var w=e[m];if(ct(w[0],this,f))return ct(w[1],this,f)}})}function nm(e){return Rl(an(e,R))}function Tc(e){return function(){return e}}function im(e,i){return e==null||e!==e?i:e}var rm=Ja(),sm=Ja(!0);function In(e){return e}function Lc(e){return Hr(typeof e=="function"?e:an(e,R))}function om(e){return Ft(an(e,R))}function lm(e,i){return No(e,an(i,R))}var am=ve(function(e,i){return function(o){return rr(o,e,i)}}),um=ve(function(e,i){return function(o){return rr(e,o,i)}});function Cc(e,i,o){var f=kt(i),m=ir(i,f);o==null&&!(Je(i)&&(m.length||!f.length))&&(o=i,i=e,e=this,m=ir(i,kt(i)));var w=!(Je(o)&&"chain"in o)||!!o.chain,I=cr(e);return Ke(m,function(A){var k=i[A];e[A]=k,I&&(e.prototype[A]=function(){var b=this.__chain__;if(w||b){var B=e(this.__wrapped__),G=B.__actions__=Ct(this.__actions__);return G.push({func:k,args:arguments,thisArg:e}),B.__chain__=b,B}return k.apply(e,oi([this.value()],arguments))})}),e}function cm(){return yt._===this&&(yt._=ms),this}function kc(){}function dm(e){return e=Pe(e),ve(function(i){return sr(i,e)})}var fm=s(We),hm=s(lo),gm=s(ao);function Dd(e){return pc(e)?Ar(Oi(e)):To(e)}function pm(e){return function(i){return e==null?r:Qn(e,i)}}var mm=p(),vm=p(!0);function Rc(){return[]}function Mc(){return!1}function ym(){return{}}function Sm(){return""}function wm(){return!0}function xm(e,i){if(e=Pe(e),e<1||e>V)return[];var o=ge,f=wt(e,ge);i=Q(i),e-=ge;for(var m=Cn(f,i);++o<e;)i(o);return m}function Pm(e){return Se(e)?We(e,Oi):On(e)?[e]:Ct(nd(De(e)))}function _m(e){var i=++yl;return De(e)+i}var Em=n(function(e,i){return e+i},0),Im=M("ceil"),Am=n(function(e,i){return e/i},1),Nm=M("floor");function Tm(e){return e&&e.length?Kt(e,In,Ur):r}function Lm(e,i){return e&&e.length?Kt(e,Q(i,2),Ur):r}function Cm(e){return cs(e,In)}function km(e,i){return cs(e,Q(i,2))}function Rm(e){return e&&e.length?Kt(e,In,ks):r}function Mm(e,i){return e&&e.length?Kt(e,Q(i,2),ks):r}var zm=n(function(e,i){return e*i},1),Om=M("round"),Dm=n(function(e,i){return e-i},0);function Wm(e){return e&&e.length?Ln(e,In):0}function Um(e,i){return e&&e.length?Ln(e,Q(i,2)):0}return y.after=og,y.ary=hd,y.assign=Kg,y.assignIn=Nd,y.assignInWith=ou,y.assignWith=Qg,y.at=Vg,y.before=gd,y.bind=xc,y.bindAll=em,y.bindKey=pd,y.castArray=yg,y.chain=cd,y.chunk=Nf,y.compact=Tf,y.concat=Lf,y.cond=tm,y.conforms=nm,y.constant=Tc,y.countBy=Wh,y.create=qg,y.curry=md,y.curryRight=vd,y.debounce=yd,y.defaults=Jg,y.defaultsDeep=jg,y.defer=lg,y.delay=ag,y.difference=Cf,y.differenceBy=kf,y.differenceWith=Rf,y.drop=Mf,y.dropRight=zf,y.dropRightWhile=Of,y.dropWhile=Df,y.fill=Wf,y.filter=Fh,y.flatMap=Bh,y.flatMapDeep=Gh,y.flatMapDepth=Zh,y.flatten=od,y.flattenDeep=Uf,y.flattenDepth=Ff,y.flip=ug,y.flow=rm,y.flowRight=sm,y.fromPairs=Hf,y.functions=sp,y.functionsIn=op,y.groupBy=Xh,y.initial=Bf,y.intersection=Gf,y.intersectionBy=Zf,y.intersectionWith=Xf,y.invert=ap,y.invertBy=up,y.invokeMap=Kh,y.iteratee=Lc,y.keyBy=Qh,y.keys=kt,y.keysIn=En,y.map=eu,y.mapKeys=dp,y.mapValues=fp,y.matches=om,y.matchesProperty=lm,y.memoize=nu,y.merge=hp,y.mergeWith=Td,y.method=am,y.methodOf=um,y.mixin=Cc,y.negate=iu,y.nthArg=dm,y.omit=gp,y.omitBy=pp,y.once=cg,y.orderBy=Vh,y.over=fm,y.overArgs=dg,y.overEvery=hm,y.overSome=gm,y.partial=Pc,y.partialRight=Sd,y.partition=qh,y.pick=mp,y.pickBy=Ld,y.property=Dd,y.propertyOf=pm,y.pull=Vf,y.pullAll=ad,y.pullAllBy=qf,y.pullAllWith=Jf,y.pullAt=jf,y.range=mm,y.rangeRight=vm,y.rearg=fg,y.reject=$h,y.remove=$f,y.rest=hg,y.reverse=Sc,y.sampleSize=tg,y.set=yp,y.setWith=Sp,y.shuffle=ng,y.slice=eh,y.sortBy=sg,y.sortedUniq=lh,y.sortedUniqBy=ah,y.split=Bp,y.spread=gg,y.tail=uh,y.take=ch,y.takeRight=dh,y.takeRightWhile=fh,y.takeWhile=hh,y.tap=Th,y.throttle=pg,y.thru=$a,y.toArray=Ed,y.toPairs=Cd,y.toPairsIn=kd,y.toPath=Pm,y.toPlainObject=Ad,y.transform=wp,y.unary=mg,y.union=gh,y.unionBy=ph,y.unionWith=mh,y.uniq=vh,y.uniqBy=yh,y.uniqWith=Sh,y.unset=xp,y.unzip=wc,y.unzipWith=ud,y.update=Pp,y.updateWith=_p,y.values=Do,y.valuesIn=Ep,y.without=wh,y.words=zd,y.wrap=vg,y.xor=xh,y.xorBy=Ph,y.xorWith=_h,y.zip=Eh,y.zipObject=Ih,y.zipObjectDeep=Ah,y.zipWith=Nh,y.entries=Cd,y.entriesIn=kd,y.extend=Nd,y.extendWith=ou,Cc(y,y),y.add=Em,y.attempt=Od,y.camelCase=Tp,y.capitalize=Rd,y.ceil=Im,y.clamp=Ip,y.clone=Sg,y.cloneDeep=xg,y.cloneDeepWith=Pg,y.cloneWith=wg,y.conformsTo=_g,y.deburr=Md,y.defaultTo=im,y.divide=Am,y.endsWith=Lp,y.eq=vi,y.escape=Cp,y.escapeRegExp=kp,y.every=Uh,y.find=Hh,y.findIndex=rd,y.findKey=$g,y.findLast=bh,y.findLastIndex=sd,y.findLastKey=ep,y.floor=Nm,y.forEach=dd,y.forEachRight=fd,y.forIn=tp,y.forInRight=np,y.forOwn=ip,y.forOwnRight=rp,y.get=Ic,y.gt=Eg,y.gte=Ig,y.has=lp,y.hasIn=Ac,y.head=ld,y.identity=In,y.includes=Yh,y.indexOf=bf,y.inRange=Ap,y.invoke=cp,y.isArguments=Us,y.isArray=Se,y.isArrayBuffer=Ag,y.isArrayLike=_n,y.isArrayLikeObject=ot,y.isBoolean=Ng,y.isBuffer=Kr,y.isDate=Tg,y.isElement=Lg,y.isEmpty=Cg,y.isEqual=kg,y.isEqualWith=Rg,y.isError=_c,y.isFinite=Mg,y.isFunction=cr,y.isInteger=wd,y.isLength=ru,y.isMap=xd,y.isMatch=zg,y.isMatchWith=Og,y.isNaN=Dg,y.isNative=Wg,y.isNil=Fg,y.isNull=Ug,y.isNumber=Pd,y.isObject=Je,y.isObjectLike=$e,y.isPlainObject=Vl,y.isRegExp=Ec,y.isSafeInteger=Hg,y.isSet=_d,y.isString=su,y.isSymbol=On,y.isTypedArray=Oo,y.isUndefined=bg,y.isWeakMap=Bg,y.isWeakSet=Gg,y.join=Yf,y.kebabCase=Rp,y.last=$n,y.lastIndexOf=Kf,y.lowerCase=Mp,y.lowerFirst=zp,y.lt=Zg,y.lte=Xg,y.max=Tm,y.maxBy=Lm,y.mean=Cm,y.meanBy=km,y.min=Rm,y.minBy=Mm,y.stubArray=Rc,y.stubFalse=Mc,y.stubObject=ym,y.stubString=Sm,y.stubTrue=wm,y.multiply=zm,y.nth=Qf,y.noConflict=cm,y.noop=kc,y.now=tu,y.pad=Op,y.padEnd=Dp,y.padStart=Wp,y.parseInt=Up,y.random=Np,y.reduce=Jh,y.reduceRight=jh,y.repeat=Fp,y.replace=Hp,y.result=vp,y.round=Om,y.runInContext=T,y.sample=eg,y.size=ig,y.snakeCase=bp,y.some=rg,y.sortedIndex=th,y.sortedIndexBy=nh,y.sortedIndexOf=ih,y.sortedLastIndex=rh,y.sortedLastIndexBy=sh,y.sortedLastIndexOf=oh,y.startCase=Gp,y.startsWith=Zp,y.subtract=Dm,y.sum=Wm,y.sumBy=Um,y.template=Xp,y.times=xm,y.toFinite=dr,y.toInteger=Pe,y.toLength=Id,y.toLower=Yp,y.toNumber=ei,y.toSafeInteger=Yg,y.toString=De,y.toUpper=Kp,y.trim=Qp,y.trimEnd=Vp,y.trimStart=qp,y.truncate=Jp,y.unescape=jp,y.uniqueId=_m,y.upperCase=$p,y.upperFirst=Nc,y.each=dd,y.eachRight=fd,y.first=ld,Cc(y,function(){var e={};return zn(y,function(i,o){ze.call(y.prototype,o)||(e[o]=i)}),e}(),{chain:!1}),y.VERSION=l,Ke(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){y[e].placeholder=y}),Ke(["drop","take"],function(e,i){Ae.prototype[e]=function(o){o=o===r?1:it(Pe(o),0);var f=this.__filtered__&&!i?new Ae(this):this.clone();return f.__filtered__?f.__takeCount__=wt(o,f.__takeCount__):f.__views__.push({size:wt(o,ge),type:e+(f.__dir__<0?"Right":"")}),f},Ae.prototype[e+"Right"]=function(o){return this.reverse()[e](o).reverse()}}),Ke(["filter","map","takeWhile"],function(e,i){var o=i+1,f=o==tn||o==mt;Ae.prototype[e]=function(m){var w=this.clone();return w.__iteratees__.push({iteratee:Q(m,3),type:o}),w.__filtered__=w.__filtered__||f,w}}),Ke(["head","last"],function(e,i){var o="take"+(i?"Right":"");Ae.prototype[e]=function(){return this[o](1).value()[0]}}),Ke(["initial","tail"],function(e,i){var o="drop"+(i?"":"Right");Ae.prototype[e]=function(){return this.__filtered__?new Ae(this):this[o](1)}}),Ae.prototype.compact=function(){return this.filter(In)},Ae.prototype.find=function(e){return this.filter(e).head()},Ae.prototype.findLast=function(e){return this.reverse().find(e)},Ae.prototype.invokeMap=ve(function(e,i){return typeof e=="function"?new Ae(this):this.map(function(o){return rr(o,e,i)})}),Ae.prototype.reject=function(e){return this.filter(iu(Q(e)))},Ae.prototype.slice=function(e,i){e=Pe(e);var o=this;return o.__filtered__&&(e>0||i<0)?new Ae(o):(e<0?o=o.takeRight(-e):e&&(o=o.drop(e)),i!==r&&(i=Pe(i),o=i<0?o.dropRight(-i):o.take(i-e)),o)},Ae.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ae.prototype.toArray=function(){return this.take(ge)},zn(Ae.prototype,function(e,i){var o=/^(?:filter|find|map|reject)|While$/.test(i),f=/^(?:head|last)$/.test(i),m=y[f?"take"+(i=="last"?"Right":""):i],w=f||/^find/.test(i);m&&(y.prototype[i]=function(){var I=this.__wrapped__,A=f?[1]:arguments,k=I instanceof Ae,b=A[0],B=k||Se(I),G=function(Ne){var Re=m.apply(y,oi([Ne],A));return f&&q?Re[0]:Re};B&&o&&typeof b=="function"&&b.length!=1&&(k=B=!1);var q=this.__chain__,ie=!!this.__actions__.length,de=w&&!q,Ee=k&&!ie;if(!w&&B){I=Ee?I:new Ae(this);var fe=e.apply(I,A);return fe.__actions__.push({func:$a,args:[G],thisArg:r}),new Dt(fe,q)}return de&&Ee?e.apply(this,A):(fe=this.thru(G),de?f?fe.value()[0]:fe.value():fe)})}),Ke(["pop","push","shift","sort","splice","unshift"],function(e){var i=ji[e],o=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",f=/^(?:pop|shift)$/.test(e);y.prototype[e]=function(){var m=arguments;if(f&&!this.__chain__){var w=this.value();return i.apply(Se(w)?w:[],m)}return this[o](function(I){return i.apply(Se(I)?I:[],m)})}}),zn(Ae.prototype,function(e,i){var o=y[i];if(o){var f=o.name+"";ze.call(Ni,f)||(Ni[f]=[]),Ni[f].push({name:i,func:o})}}),Ni[zo(r,X).name]=[{name:"wrapper",func:r}],Ae.prototype.clone=Is,Ae.prototype.reverse=Tt,Ae.prototype.value=sc,y.prototype.at=Lh,y.prototype.chain=Ch,y.prototype.commit=kh,y.prototype.next=Rh,y.prototype.plant=zh,y.prototype.reverse=Oh,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=Dh,y.prototype.first=y.prototype.head,Rr&&(y.prototype[Rr]=Mh),y},Ji=Lr();Zi?((Zi.exports=Ji)._=Ji,Pr._=Ji):yt._=Ji}).call(ql)})(Pu,Pu.exports);var jt=Pu.exports;const Qm=_u(jt),Vm=16;class qm{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("reconciler")}addNode(c,r){const l=c.getAttrs(),u=r.getAttrs().initialZIndex;if(c instanceof ne.Stage&&r instanceof ne.Layer&&c.add(r),c instanceof ne.Layer&&c.add(r),c instanceof ne.Group&&typeof l.containerId<"u"){const h=c.findOne(`#${l.containerId}`);h==null||h.add(r)}c instanceof ne.Group&&typeof l.containerId>"u"&&c.add(r),u&&r.zIndex(u)}getConfig(){const c=this.instance,r=this.logger,l=this.addNode;return{noTimeout:-1,isPrimaryRenderer:!0,supportsPersistence:!1,supportsHydration:!1,supportsMutation:!0,supportsMicrotasks:!1,getCurrentEventPriority(){return Vm},getInstanceFromNode(u){return r.debug({node:u},"getInstanceFromNode"),null},beforeActiveInstanceBlur(){r.debug("beforeActiveInstanceBlur")},afterActiveInstanceBlur(){r.debug("afterActiveInstanceBlur")},prepareScopeUpdate(u,h){r.debug({scopeInstance:u,instance:h},"prepareScopeUpdate")},getInstanceFromScope(u){return r.debug({scopeInstance:u},"getInstanceFromScope"),null},getRootHostContext(u){return r.debug({rootContainer:u},"getRootHostContext"),u},prepareForCommit(u){return r.debug({containerInfo:u},"prepareForCommit"),null},scheduleTimeout(u,h){return r.debug({fn:u,delay:h},"scheduleTimeout"),setTimeout(u,h)},cancelTimeout(u){r.debug({id:u},"cancelTimeout"),u&&clearTimeout(u)},preparePortalMount(u){r.debug({containerInfo:u},"preparePortalMount")},resetAfterCommit(u){r.debug({containerInfo:u},"resetAfterCommit")},createTextInstance(u,h,g){return r.debug({text:u,rootContainer:h,hostContext:g},"createTextInstance"),null},getChildHostContext(u,h,g){return r.debug({parentHostContext:u,type:h,rootContainer:g},"getChildHostContext"),u},shouldSetTextContent(u,h){return r.debug({type:u,props:h},"shouldSetTextContext"),!1},createInstance(u,h,g,v){r.debug({type:u,props:h,rootContainer:g,hostContext:v},"createInstance");const S=g.getNodeHandler(u);if(!S)return;const _={...h};return delete _.zIndex,_.initialZIndex=h.zIndex,u==="stage"&&(_.container=g.getStageConfiguration().container,_.width=g.getStageConfiguration().width,_.height=g.getStageConfiguration().height),S.createInstance(_)},detachDeletedInstance(u){r.debug({node:u},"detachDeletedInstance")},getPublicInstance(u){return r.debug({instance:u},"getPublicInstance"),u},appendInitialChild(u,h){r.debug({parentInstance:u,child:h},"appendInitialChild"),l(u,h)},appendChildToContainer(u,h){r.debug({container:u,child:h},"appendChildToContainer"),h instanceof ne.Stage&&u.getStageManager().setStage(h)},insertInContainerBefore(u,h){r.debug({container:u,child:h},"insertInContainerBefore")},insertBefore(u,h,g){if(r.debug({parentInstance:u,child:h,beforeChild:g},"insertBefore "),u instanceof ne.Layer){u.add(h);const v=g.zIndex();h.zIndex(v-1)}if(u instanceof ne.Group){u.add(h);const v=g.zIndex();h.zIndex(v-1)}},appendChild(u,h){r.debug({parentInstance:u,child:h},"appendChild"),l(u,h)},finalizeInitialChildren(){return r.debug("finalizeInitialChildren"),!1},prepareUpdate(u,h,g,v,S,_){return r.debug({instance:u,type:h,oldProps:g,newProps:v,rootContainer:S,hostContext:_},"clearContainer"),{}},clearContainer(u){r.debug({container:u},"clearContainer")},setCurrentUpdatePriority(){r.debug("setCurrentUpdatePriority")},getCurrentUpdatePriority(){return r.debug("getCurrentUpdatePriority"),1},resolveUpdatePriority(){return r.debug("resolveUpdatePriority"),1},maySuspendCommit(){r.debug("maySuspendCommit")},commitUpdate(u,h,g,v,S){if(r.debug({instance:u,type:g,prevProps:v,nextProps:S},"commitUpdate"),!(u instanceof rf)&&!jt.isEqual(v,S)){const _=c.getNodeHandler(g);if(!_)return;_.updateInstance(u,S);const C=S.zIndex;C&&u.zIndex(C)}},removeChildFromContainer(){r.debug("removeChildFromContainer")},removeChild(u,h){r.debug({child:h},"removeChild"),h.destroy()}}}}class Jm{serialize(c){return JSON.stringify(c,(l,u)=>{switch(l){case"_owner":case"_store":case"ref":return;default:return u}})}deserialize(c){if(typeof c=="string"&&(c=JSON.parse(c)),c instanceof Object){const r=c;return this.deserializeElement(r)}throw new Error("Deserialization error: incorrect data type")}deserializeElement(c){if(jt.isEmpty(c))return c;if(c instanceof Array)return c.map(S=>this.deserializeElement(S));const{key:r,type:l,props:u}=c;if(typeof l!="string")throw new Error(`Deserialization error: element type must be string received [${l}]`);const{children:h,...g}=u;let v=[];return h&&(v=this.deserializeElement(h)),Jd.createElement(l.toLowerCase(),{...g,key:r},v)}}var $d={exports:{}},Dc={exports:{}},Wc={};/**
29
+ * @license React
30
+ * scheduler.production.min.js
31
+ *
32
+ * Copyright (c) Facebook, Inc. and its affiliates.
33
+ *
34
+ * This source code is licensed under the MIT license found in the
35
+ * LICENSE file in the root directory of this source tree.
36
+ */var Zd;function jm(){return Zd||(Zd=1,function(x){function c(V,le){var ae=V.length;V.push(le);e:for(;0<ae;){var ge=ae-1>>>1,pe=V[ge];if(0<u(pe,le))V[ge]=le,V[ae]=pe,ae=ge;else break e}}function r(V){return V.length===0?null:V[0]}function l(V){if(V.length===0)return null;var le=V[0],ae=V.pop();if(ae!==le){V[0]=ae;e:for(var ge=0,pe=V.length,Fi=pe>>>1;ge<Fi;){var Un=2*(ge+1)-1,pn=V[Un],nn=Un+1,Hi=V[nn];if(0>u(pn,ae))nn<pe&&0>u(Hi,pn)?(V[ge]=Hi,V[nn]=ae,ge=nn):(V[ge]=pn,V[Un]=ae,ge=Un);else if(nn<pe&&0>u(Hi,ae))V[ge]=Hi,V[nn]=ae,ge=nn;else break e}}return le}function u(V,le){var ae=V.sortIndex-le.sortIndex;return ae!==0?ae:V.id-le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;x.unstable_now=function(){return h.now()}}else{var g=Date,v=g.now();x.unstable_now=function(){return g.now()-v}}var S=[],_=[],C=1,R=null,D=3,H=!1,Z=!1,F=!1,Y=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(V){for(var le=r(_);le!==null;){if(le.callback===null)l(_);else if(le.startTime<=V)l(_),le.sortIndex=le.expirationTime,c(S,le);else break;le=r(_)}}function ye(V){if(F=!1,j(V),!Z)if(r(S)!==null)Z=!0,mt(we);else{var le=r(_);le!==null&&ut(ye,le.startTime-V)}}function we(V,le){Z=!1,F&&(F=!1,X(at),at=-1),H=!0;var ae=D;try{for(j(le),R=r(S);R!==null&&(!(R.expirationTime>le)||V&&!en());){var ge=R.callback;if(typeof ge=="function"){R.callback=null,D=R.priorityLevel;var pe=ge(R.expirationTime<=le);le=x.unstable_now(),typeof pe=="function"?R.callback=pe:R===r(S)&&l(S),j(le)}else l(S);R=r(S)}if(R!==null)var Fi=!0;else{var Un=r(_);Un!==null&&ut(ye,Un.startTime-le),Fi=!1}return Fi}finally{R=null,D=ae,H=!1}}var xe=!1,Ie=null,at=-1,gt=5,$t=-1;function en(){return!(x.unstable_now()-$t<gt)}function It(){if(Ie!==null){var V=x.unstable_now();$t=V;var le=!0;try{le=Ie(!0,V)}finally{le?pt():(xe=!1,Ie=null)}}else xe=!1}var pt;if(typeof se=="function")pt=function(){se(It)};else if(typeof MessageChannel<"u"){var tn=new MessageChannel,At=tn.port2;tn.port1.onmessage=It,pt=function(){At.postMessage(null)}}else pt=function(){Y(It,0)};function mt(V){Ie=V,xe||(xe=!0,pt())}function ut(V,le){at=Y(function(){V(x.unstable_now())},le)}x.unstable_IdlePriority=5,x.unstable_ImmediatePriority=1,x.unstable_LowPriority=4,x.unstable_NormalPriority=3,x.unstable_Profiling=null,x.unstable_UserBlockingPriority=2,x.unstable_cancelCallback=function(V){V.callback=null},x.unstable_continueExecution=function(){Z||H||(Z=!0,mt(we))},x.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):gt=0<V?Math.floor(1e3/V):5},x.unstable_getCurrentPriorityLevel=function(){return D},x.unstable_getFirstCallbackNode=function(){return r(S)},x.unstable_next=function(V){switch(D){case 1:case 2:case 3:var le=3;break;default:le=D}var ae=D;D=le;try{return V()}finally{D=ae}},x.unstable_pauseExecution=function(){},x.unstable_requestPaint=function(){},x.unstable_runWithPriority=function(V,le){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var ae=D;D=V;try{return le()}finally{D=ae}},x.unstable_scheduleCallback=function(V,le,ae){var ge=x.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?ge+ae:ge):ae=ge,V){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=ae+pe,V={id:C++,callback:le,priorityLevel:V,startTime:ae,expirationTime:pe,sortIndex:-1},ae>ge?(V.sortIndex=ae,c(_,V),r(S)===null&&V===r(_)&&(F?(X(at),at=-1):F=!0,ut(ye,ae-ge))):(V.sortIndex=pe,c(S,V),Z||H||(Z=!0,mt(we))),V},x.unstable_shouldYield=en,x.unstable_wrapCallback=function(V){var le=D;return function(){var ae=D;D=le;try{return V.apply(this,arguments)}finally{D=ae}}}}(Wc)),Wc}var Xd;function $m(){return Xd||(Xd=1,Dc.exports=jm()),Dc.exports}/**
37
+ * @license React
38
+ * react-reconciler.production.min.js
39
+ *
40
+ * Copyright (c) Facebook, Inc. and its affiliates.
41
+ *
42
+ * This source code is licensed under the MIT license found in the
43
+ * LICENSE file in the root directory of this source tree.
44
+ */var ev=function(c){var r={},l=Jd,u=$m(),h=Object.assign;function g(t){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+t,s=1;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var v=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=Symbol.for("react.element"),_=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),H=Symbol.for("react.provider"),Z=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),ye=Symbol.for("react.offscreen"),we=Symbol.iterator;function xe(t){return t===null||typeof t!="object"?null:(t=we&&t[we]||t["@@iterator"],typeof t=="function"?t:null)}function Ie(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case _:return"Portal";case D:return"Profiler";case R:return"StrictMode";case Y:return"Suspense";case X:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Z:return(t.displayName||"Context")+".Consumer";case H:return(t._context.displayName||"Context")+".Provider";case F:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case se:return n=t.displayName||null,n!==null?n:Ie(t.type)||"Memo";case j:n=t._payload,t=t._init;try{return Ie(t(n))}catch{}}return null}function at(t){var n=t.type;switch(t.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ie(n);case 8:return n===R?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function gt(t){var n=t,s=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,n.flags&4098&&(s=n.return),t=n.return;while(t)}return n.tag===3?s:null}function $t(t){if(gt(t)!==t)throw Error(g(188))}function en(t){var n=t.alternate;if(!n){if(n=gt(t),n===null)throw Error(g(188));return n!==t?null:t}for(var s=t,a=n;;){var d=s.return;if(d===null)break;var p=d.alternate;if(p===null){if(a=d.return,a!==null){s=a;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===s)return $t(d),t;if(p===a)return $t(d),n;p=p.sibling}throw Error(g(188))}if(s.return!==a.return)s=d,a=p;else{for(var P=!1,N=d.child;N;){if(N===s){P=!0,s=d,a=p;break}if(N===a){P=!0,a=d,s=p;break}N=N.sibling}if(!P){for(N=p.child;N;){if(N===s){P=!0,s=p,a=d;break}if(N===a){P=!0,a=p,s=d;break}N=N.sibling}if(!P)throw Error(g(189))}}if(s.alternate!==a)throw Error(g(190))}if(s.tag!==3)throw Error(g(188));return s.stateNode.current===s?t:n}function It(t){return t=en(t),t!==null?pt(t):null}function pt(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var n=pt(t);if(n!==null)return n;t=t.sibling}return null}function tn(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){if(t.tag!==4){var n=tn(t);if(n!==null)return n}t=t.sibling}return null}var At=Array.isArray,mt=c.getPublicInstance,ut=c.getRootHostContext,V=c.getChildHostContext,le=c.prepareForCommit,ae=c.resetAfterCommit,ge=c.createInstance,pe=c.appendInitialChild,Fi=c.finalizeInitialChildren,Un=c.prepareUpdate,pn=c.shouldSetTextContent,nn=c.createTextInstance,Hi=c.scheduleTimeout,jr=c.cancelTimeout,bi=c.noTimeout,Xs=c.isPrimaryRenderer,Nt=c.supportsMutation,Bi=c.supportsPersistence,rn=c.supportsHydration,An=c.getInstanceFromNode,$r=c.preparePortalMount,Iu=c.getCurrentEventPriority,ni=c.detachDeletedInstance,ea=c.supportsMicrotasks,Au=c.scheduleMicrotask,ii=c.supportsTestSelectors,Nn=c.findFiberRoot,es=c.getBoundingRect,Ys=c.getTextContent,ts=c.isHiddenSubtree,ns=c.matchAccessibilityRole,Nu=c.setFocusIfFocusable,is=c.setupIntersectionObserver,vr=c.appendChild,Zo=c.appendChildToContainer,Xo=c.commitTextUpdate,Yo=c.commitMount,Ko=c.commitUpdate,Qo=c.insertBefore,Vo=c.insertInContainerBefore,qo=c.removeChild,Jo=c.removeChildFromContainer,Ks=c.resetTextContent,Tu=c.hideInstance,Lu=c.hideTextInstance,Cu=c.unhideInstance,ta=c.unhideTextInstance,na=c.clearContainer,ku=c.cloneInstance,ia=c.createContainerChildSet,ra=c.appendChildToContainerChildSet,Ru=c.finalizeContainerChildren,Qs=c.replaceContainerChildren,sa=c.cloneHiddenInstance,oa=c.cloneHiddenTextInstance,Mu=c.canHydrateInstance,jo=c.canHydrateTextInstance,zu=c.canHydrateSuspenseInstance,Vs=c.isSuspenseInstancePending,$o=c.isSuspenseInstanceFallback,Ou=c.registerSuspenseInstanceRetry,rs=c.getNextHydratableSibling,Du=c.getFirstHydratableChild,Wu=c.getFirstHydratableChildWithinContainer,Uu=c.getFirstHydratableChildWithinSuspenseInstance,Fu=c.hydrateInstance,Hu=c.hydrateTextInstance,la=c.hydrateSuspenseInstance,bu=c.getNextHydratableInstanceAfterSuspenseInstance,Bu=c.commitHydratedContainer,Gu=c.commitHydratedSuspenseInstance,Zu=c.clearSuspenseBoundary,Xu=c.clearSuspenseBoundaryFromContainer,Yu=c.shouldDeleteUnhydratedTailInstances,qs=c.didNotMatchHydratedContainerTextInstance,Ku=c.didNotMatchHydratedTextInstance,yr;function ss(t){if(yr===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);yr=n&&n[1]||""}return`
45
+ `+yr+t}var el=!1;function tl(t,n){if(!t||el)return"";el=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(K){var a=K}Reflect.construct(t,[],n)}else{try{n.call()}catch(K){a=K}t.call(n.prototype)}else{try{throw Error()}catch(K){a=K}t()}}catch(K){if(K&&a&&typeof K.stack=="string"){for(var d=K.stack.split(`
46
+ `),p=a.stack.split(`
47
+ `),P=d.length-1,N=p.length-1;1<=P&&0<=N&&d[P]!==p[N];)N--;for(;1<=P&&0<=N;P--,N--)if(d[P]!==p[N]){if(P!==1||N!==1)do if(P--,N--,0>N||d[P]!==p[N]){var M=`
48
+ `+d[P].replace(" at new "," at ");return t.displayName&&M.includes("<anonymous>")&&(M=M.replace("<anonymous>",t.displayName)),M}while(1<=P&&0<=N);break}}}finally{el=!1,Error.prepareStackTrace=s}return(t=t?t.displayName||t.name:"")?ss(t):""}var aa=Object.prototype.hasOwnProperty,Js=[],Gi=-1;function Si(t){return{current:t}}function Ge(t){0>Gi||(t.current=Js[Gi],Js[Gi]=null,Gi--)}function Fe(t,n){Gi++,Js[Gi]=t.current,t.current=n}var wi={},vt=Si(wi),Rt=Si(!1),xi=wi;function Pi(t,n){var s=t.type.contextTypes;if(!s)return wi;var a=t.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var d={},p;for(p in s)d[p]=n[p];return a&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=d),d}function Bt(t){return t=t.childContextTypes,t!=null}function os(){Ge(Rt),Ge(vt)}function ls(t,n,s){if(vt.current!==wi)throw Error(g(168));Fe(vt,n),Fe(Rt,s)}function nl(t,n,s){var a=t.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var d in a)if(!(d in n))throw Error(g(108,at(t)||"Unknown",d));return h({},s,a)}function js(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||wi,xi=vt.current,Fe(vt,t),Fe(Rt,Rt.current),!0}function il(t,n,s){var a=t.stateNode;if(!a)throw Error(g(169));s?(t=nl(t,n,xi),a.__reactInternalMemoizedMergedChildContext=t,Ge(Rt),Ge(vt),Fe(vt,t)):Ge(Rt),Fe(Rt,s)}var mn=Math.clz32?Math.clz32:ua,rl=Math.log,Qu=Math.LN2;function ua(t){return t>>>=0,t===0?32:31-(rl(t)/Qu|0)|0}var Sr=64,wr=4194304;function Fn(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function as(t,n){var s=t.pendingLanes;if(s===0)return 0;var a=0,d=t.suspendedLanes,p=t.pingedLanes,P=s&268435455;if(P!==0){var N=P&~d;N!==0?a=Fn(N):(p&=P,p!==0&&(a=Fn(p)))}else P=s&~d,P!==0?a=Fn(P):p!==0&&(a=Fn(p));if(a===0)return 0;if(n!==0&&n!==a&&!(n&d)&&(d=a&-a,p=n&-n,d>=p||d===16&&(p&4194240)!==0))return n;if(a&4&&(a|=s&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=a;0<n;)s=31-mn(n),d=1<<s,a|=t[s],n&=~d;return a}function ca(t,n){switch(t){case 1:case 2:case 4:return n+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vu(t,n){for(var s=t.suspendedLanes,a=t.pingedLanes,d=t.expirationTimes,p=t.pendingLanes;0<p;){var P=31-mn(p),N=1<<P,M=d[P];M===-1?(!(N&s)||N&a)&&(d[P]=ca(N,n)):M<=n&&(t.expiredLanes|=N),p&=~N}}function $s(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function sl(){var t=Sr;return Sr<<=1,!(Sr&4194240)&&(Sr=64),t}function eo(t){for(var n=[],s=0;31>s;s++)n.push(t);return n}function xr(t,n,s){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-mn(n),t[n]=s}function qu(t,n){var s=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var a=t.eventTimes;for(t=t.expirationTimes;0<s;){var d=31-mn(s),p=1<<d;n[d]=0,a[d]=-1,t[d]=-1,s&=~p}}function ol(t,n){var s=t.entangledLanes|=n;for(t=t.entanglements;s;){var a=31-mn(s),d=1<<a;d&n|t[a]&n&&(t[a]|=n),s&=~d}}var Me=0;function ll(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var al=u.unstable_scheduleCallback,da=u.unstable_cancelCallback,Ju=u.unstable_shouldYield,ju=u.unstable_requestPaint,je=u.unstable_now,ul=u.unstable_ImmediatePriority,$u=u.unstable_UserBlockingPriority,cl=u.unstable_NormalPriority,ec=u.unstable_IdlePriority,to=null,Te=null;function He(t){if(Te&&typeof Te.onCommitFiberRoot=="function")try{Te.onCommitFiberRoot(to,t,void 0,(t.current.flags&128)===128)}catch{}}function tc(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Tn=typeof Object.is=="function"?Object.is:tc,ri=null,no=!1,dl=!1;function fa(t){ri===null?ri=[t]:ri.push(t)}function ha(t){no=!0,fa(t)}function Hn(){if(!dl&&ri!==null){dl=!0;var t=0,n=Me;try{var s=ri;for(Me=1;t<s.length;t++){var a=s[t];do a=a(!0);while(a!==null)}ri=null,no=!1}catch(d){throw ri!==null&&(ri=ri.slice(t+1)),al(ul,Hn),d}finally{Me=n,dl=!1}}return null}var yt=v.ReactCurrentBatchConfig;function Pr(t,n){if(Tn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var s=Object.keys(t),a=Object.keys(n);if(s.length!==a.length)return!1;for(a=0;a<s.length;a++){var d=s[a];if(!aa.call(n,d)||!Tn(t[d],n[d]))return!1}return!0}function Zi(t){switch(t.tag){case 5:return ss(t.type);case 16:return ss("Lazy");case 13:return ss("Suspense");case 19:return ss("SuspenseList");case 0:case 2:case 15:return t=tl(t.type,!1),t;case 11:return t=tl(t.type.render,!1),t;case 1:return t=tl(t.type,!0),t;default:return""}}function vn(t,n){if(t&&t.defaultProps){n=h({},n),t=t.defaultProps;for(var s in t)n[s]===void 0&&(n[s]=t[s]);return n}return n}var _r=Si(null),Mt=null,Xi=null,io=null;function ro(){io=Xi=Mt=null}function fl(t,n,s){Xs?(Fe(_r,n._currentValue),n._currentValue=s):(Fe(_r,n._currentValue2),n._currentValue2=s)}function so(t){var n=_r.current;Ge(_r),Xs?t._currentValue=n:t._currentValue2=n}function oo(t,n,s){for(;t!==null;){var a=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),t===s)break;t=t.return}}function ct(t,n){Mt=t,io=Xi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&n&&(Yt=!0),t.firstContext=null)}function yn(t){var n=Xs?t._currentValue:t._currentValue2;if(io!==t)if(t={context:t,memoizedValue:n,next:null},Xi===null){if(Mt===null)throw Error(g(308));Xi=t,Mt.dependencies={lanes:0,firstContext:t}}else Xi=Xi.next=t;return n}var Ke=null,_i=!1;function lo(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function si(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Sn(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function bn(t,n){var s=t.updateQueue;s!==null&&(s=s.shared,Za(t)?(t=s.interleaved,t===null?(n.next=n,Ke===null?Ke=[s]:Ke.push(s)):(n.next=t.next,t.next=n),s.interleaved=n):(t=s.pending,t===null?n.next=n:(n.next=t.next,t.next=n),s.pending=n))}function We(t,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var a=n.lanes;a&=t.pendingLanes,s|=a,n.lanes=s,ol(t,s)}}function oi(t,n){var s=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var d=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var P={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};p===null?d=p=P:p=p.next=P,s=s.next}while(s!==null);p===null?d=p=n:p=p.next=n}else d=p=n;s={baseState:a.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:a.shared,effects:a.effects},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=n:t.next=n,s.lastBaseUpdate=n}function Er(t,n,s,a){var d=t.updateQueue;_i=!1;var p=d.firstBaseUpdate,P=d.lastBaseUpdate,N=d.shared.pending;if(N!==null){d.shared.pending=null;var M=N,K=M.next;M.next=null,P===null?p=K:P.next=K,P=M;var te=t.alternate;te!==null&&(te=te.updateQueue,N=te.lastBaseUpdate,N!==P&&(N===null?te.firstBaseUpdate=K:N.next=K,te.lastBaseUpdate=M))}if(p!==null){var ue=d.baseState;P=0,te=K=M=null,N=p;do{var oe=N.lane,Be=N.eventTime;if((a&oe)===oe){te!==null&&(te=te.next={eventTime:Be,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var Ue=t,Ht=N;switch(oe=n,Be=s,Ht.tag){case 1:if(Ue=Ht.payload,typeof Ue=="function"){ue=Ue.call(Be,ue,oe);break e}ue=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=Ht.payload,oe=typeof Ue=="function"?Ue.call(Be,ue,oe):Ue,oe==null)break e;ue=h({},ue,oe);break e;case 2:_i=!0}}N.callback!==null&&N.lane!==0&&(t.flags|=64,oe=d.effects,oe===null?d.effects=[N]:oe.push(N))}else Be={eventTime:Be,lane:oe,tag:N.tag,payload:N.payload,callback:N.callback,next:null},te===null?(K=te=Be,M=ue):te=te.next=Be,P|=oe;if(N=N.next,N===null){if(N=d.shared.pending,N===null)break;oe=N,N=oe.next,oe.next=null,d.lastBaseUpdate=oe,d.shared.pending=null}}while(!0);if(te===null&&(M=ue),d.baseState=M,d.firstBaseUpdate=K,d.lastBaseUpdate=te,n=d.shared.interleaved,n!==null){d=n;do P|=d.lane,d=d.next;while(d!==n)}else p===null&&(d.shared.lanes=0);ui|=P,t.lanes=P,t.memoizedState=ue}}function ga(t,n,s){if(t=n.effects,n.effects=null,t!==null)for(n=0;n<t.length;n++){var a=t[n],d=a.callback;if(d!==null){if(a.callback=null,a=s,typeof d!="function")throw Error(g(191,d));d.call(a)}}}var ao=new l.Component().refs;function hl(t,n,s,a){n=t.memoizedState,s=s(a,n),s=s==null?n:h({},n,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var uo={isMounted:function(t){return(t=t._reactInternals)?gt(t)===t:!1},enqueueSetState:function(t,n,s){t=t._reactInternals;var a=Lt(),d=ki(t),p=Sn(a,d);p.payload=n,s!=null&&(p.callback=s),bn(t,p),n=Et(t,d,a),n!==null&&We(n,t,d)},enqueueReplaceState:function(t,n,s){t=t._reactInternals;var a=Lt(),d=ki(t),p=Sn(a,d);p.tag=1,p.payload=n,s!=null&&(p.callback=s),bn(t,p),n=Et(t,d,a),n!==null&&We(n,t,d)},enqueueForceUpdate:function(t,n){t=t._reactInternals;var s=Lt(),a=ki(t),d=Sn(s,a);d.tag=2,n!=null&&(d.callback=n),bn(t,d),n=Et(t,a,s),n!==null&&We(n,t,a)}};function pa(t,n,s,a,d,p,P){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(a,p,P):n.prototype&&n.prototype.isPureReactComponent?!Pr(s,a)||!Pr(d,p):!0}function gl(t,n,s){var a=!1,d=wi,p=n.contextType;return typeof p=="object"&&p!==null?p=yn(p):(d=Bt(n)?xi:vt.current,a=n.contextTypes,p=(a=a!=null)?Pi(t,d):wi),n=new n(s,p),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=uo,t.stateNode=n,n._reactInternals=t,a&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=d,t.__reactInternalMemoizedMaskedChildContext=p),n}function us(t,n,s,a){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(s,a),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(s,a),n.state!==t&&uo.enqueueReplaceState(n,n.state,null)}function Ei(t,n,s,a){var d=t.stateNode;d.props=s,d.state=t.memoizedState,d.refs=ao,lo(t);var p=n.contextType;typeof p=="object"&&p!==null?d.context=yn(p):(p=Bt(n)?xi:vt.current,d.context=Pi(t,p)),d.state=t.memoizedState,p=n.getDerivedStateFromProps,typeof p=="function"&&(hl(t,n,p,s),d.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(n=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),n!==d.state&&uo.enqueueReplaceState(d,d.state,null),Er(t,s,d,a),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308)}var Ir=[],Yi=0,cs=null,Ar=0,Gt=[],sn=0,Ki=null,Ln=1,Cn="";function Qi(t,n){Ir[Yi++]=Ar,Ir[Yi++]=cs,cs=t,Ar=n}function pl(t,n,s){Gt[sn++]=Ln,Gt[sn++]=Cn,Gt[sn++]=Ki,Ki=t;var a=Ln;t=Cn;var d=32-mn(a)-1;a&=~(1<<d),s+=1;var p=32-mn(n)+d;if(30<p){var P=d-d%5;p=(a&(1<<P)-1).toString(32),a>>=P,d-=P,Ln=1<<32-mn(n)+d|s<<d|a,Cn=p+t}else Ln=1<<p|s<<d|a,Cn=t}function zt(t){t.return!==null&&(Qi(t,1),pl(t,1,0))}function ds(t){for(;t===cs;)cs=Ir[--Yi],Ir[Yi]=null,Ar=Ir[--Yi],Ir[Yi]=null;for(;t===Ki;)Ki=Gt[--sn],Gt[sn]=null,Cn=Gt[--sn],Gt[sn]=null,Ln=Gt[--sn],Gt[sn]=null}var St=null,Zt=null,Ze=!1,fs=!1,kn=null;function ma(t,n){var s=dn(5,null,null,0);s.elementType="DELETED",s.stateNode=n,s.return=t,n=t.deletions,n===null?(t.deletions=[s],t.flags|=16):n.push(s)}function va(t,n){switch(t.tag){case 5:return n=Mu(n,t.type,t.pendingProps),n!==null?(t.stateNode=n,St=t,Zt=Du(n),!0):!1;case 6:return n=jo(n,t.pendingProps),n!==null?(t.stateNode=n,St=t,Zt=null,!0):!1;case 13:if(n=zu(n),n!==null){var s=Ki!==null?{id:Ln,overflow:Cn}:null;return t.memoizedState={dehydrated:n,treeContext:s,retryLane:1073741824},s=dn(18,null,null,0),s.stateNode=n,s.return=t,t.child=s,St=t,Zt=null,!0}return!1;default:return!1}}function ml(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Ii(t){if(Ze){var n=Zt;if(n){var s=n;if(!va(t,n)){if(ml(t))throw Error(g(418));n=rs(s);var a=St;n&&va(t,n)?ma(a,s):(t.flags=t.flags&-4097|2,Ze=!1,St=t)}}else{if(ml(t))throw Error(g(418));t.flags=t.flags&-4097|2,Ze=!1,St=t}}}function ya(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;St=t}function hs(t){if(!rn||t!==St)return!1;if(!Ze)return ya(t),Ze=!0,!1;if(t.tag!==3&&(t.tag!==5||Yu(t.type)&&!pn(t.type,t.memoizedProps))){var n=Zt;if(n){if(ml(t)){for(t=Zt;t;)t=rs(t);throw Error(g(418))}for(;n;)ma(t,n),n=rs(n)}}if(ya(t),t.tag===13){if(!rn)throw Error(g(316));if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(g(317));Zt=bu(t)}else Zt=St?rs(t.stateNode):null;return!0}function Ai(){rn&&(Zt=St=null,fs=Ze=!1)}function co(t){kn===null?kn=[t]:kn.push(t)}function wn(t,n,s){if(t=s.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(g(309));var a=s.stateNode}if(!a)throw Error(g(147,t));var d=a,p=""+t;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===p?n.ref:(n=function(P){var N=d.refs;N===ao&&(N=d.refs={}),P===null?delete N[p]:N[p]=P},n._stringRef=p,n)}if(typeof t!="string")throw Error(g(284));if(!s._owner)throw Error(g(290,t))}return t}function Vi(t,n){throw t=Object.prototype.toString.call(n),Error(g(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t))}function Sa(t){var n=t._init;return n(t._payload)}function wa(t){function n(O,L){if(t){var U=O.deletions;U===null?(O.deletions=[L],O.flags|=16):U.push(L)}}function s(O,L){if(!t)return null;for(;L!==null;)n(O,L),L=L.sibling;return null}function a(O,L){for(O=new Map;L!==null;)L.key!==null?O.set(L.key,L):O.set(L.index,L),L=L.sibling;return O}function d(O,L){return O=zi(O,L),O.index=0,O.sibling=null,O}function p(O,L,U){return O.index=U,t?(U=O.alternate,U!==null?(U=U.index,U<L?(O.flags|=2,L):U):(O.flags|=2,L)):(O.flags|=1048576,L)}function P(O){return t&&O.alternate===null&&(O.flags|=2),O}function N(O,L,U,J){return L===null||L.tag!==6?(L=Ro(U,O.mode,J),L.return=O,L):(L=d(L,U),L.return=O,L)}function M(O,L,U,J){var re=U.type;return re===C?te(O,L,U.props.children,J,U.key):L!==null&&(L.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===j&&Sa(re)===L.type)?(J=d(L,U.props),J.ref=wn(O,L,U),J.return=O,J):(J=ko(U.type,U.key,U.props,null,O.mode,J),J.ref=wn(O,L,U),J.return=O,J)}function K(O,L,U,J){return L===null||L.tag!==4||L.stateNode.containerInfo!==U.containerInfo||L.stateNode.implementation!==U.implementation?(L=Mo(U,O.mode,J),L.return=O,L):(L=d(L,U.children||[]),L.return=O,L)}function te(O,L,U,J,re){return L===null||L.tag!==7?(L=jn(U,O.mode,J,re),L.return=O,L):(L=d(L,U),L.return=O,L)}function ue(O,L,U){if(typeof L=="string"&&L!==""||typeof L=="number")return L=Ro(""+L,O.mode,U),L.return=O,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case S:return U=ko(L.type,L.key,L.props,null,O.mode,U),U.ref=wn(O,null,L),U.return=O,U;case _:return L=Mo(L,O.mode,U),L.return=O,L;case j:var J=L._init;return ue(O,J(L._payload),U)}if(At(L)||xe(L))return L=jn(L,O.mode,U,null),L.return=O,L;Vi(O,L)}return null}function oe(O,L,U,J){var re=L!==null?L.key:null;if(typeof U=="string"&&U!==""||typeof U=="number")return re!==null?null:N(O,L,""+U,J);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case S:return U.key===re?M(O,L,U,J):null;case _:return U.key===re?K(O,L,U,J):null;case j:return re=U._init,oe(O,L,re(U._payload),J)}if(At(U)||xe(U))return re!==null?null:te(O,L,U,J,null);Vi(O,U)}return null}function Be(O,L,U,J,re){if(typeof J=="string"&&J!==""||typeof J=="number")return O=O.get(U)||null,N(L,O,""+J,re);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case S:return O=O.get(J.key===null?U:J.key)||null,M(L,O,J,re);case _:return O=O.get(J.key===null?U:J.key)||null,K(L,O,J,re);case j:var me=J._init;return Be(O,L,U,me(J._payload),re)}if(At(J)||xe(J))return O=O.get(U)||null,te(L,O,J,re,null);Vi(L,J)}return null}function Ue(O,L,U,J){for(var re=null,me=null,ce=L,Q=L=0,qe=null;ce!==null&&Q<U.length;Q++){ce.index>Q?(qe=ce,ce=null):qe=ce.sibling;var Ce=oe(O,ce,U[Q],J);if(Ce===null){ce===null&&(ce=qe);break}t&&ce&&Ce.alternate===null&&n(O,ce),L=p(Ce,L,Q),me===null?re=Ce:me.sibling=Ce,me=Ce,ce=qe}if(Q===U.length)return s(O,ce),Ze&&Qi(O,Q),re;if(ce===null){for(;Q<U.length;Q++)ce=ue(O,U[Q],J),ce!==null&&(L=p(ce,L,Q),me===null?re=ce:me.sibling=ce,me=ce);return Ze&&Qi(O,Q),re}for(ce=a(O,ce);Q<U.length;Q++)qe=Be(ce,O,Q,U[Q],J),qe!==null&&(t&&qe.alternate!==null&&ce.delete(qe.key===null?Q:qe.key),L=p(qe,L,Q),me===null?re=qe:me.sibling=qe,me=qe);return t&&ce.forEach(function(qt){return n(O,qt)}),Ze&&Qi(O,Q),re}function Ht(O,L,U,J){var re=xe(U);if(typeof re!="function")throw Error(g(150));if(U=re.call(U),U==null)throw Error(g(151));for(var me=re=null,ce=L,Q=L=0,qe=null,Ce=U.next();ce!==null&&!Ce.done;Q++,Ce=U.next()){ce.index>Q?(qe=ce,ce=null):qe=ce.sibling;var qt=oe(O,ce,Ce.value,J);if(qt===null){ce===null&&(ce=qe);break}t&&ce&&qt.alternate===null&&n(O,ce),L=p(qt,L,Q),me===null?re=qt:me.sibling=qt,me=qt,ce=qe}if(Ce.done)return s(O,ce),Ze&&Qi(O,Q),re;if(ce===null){for(;!Ce.done;Q++,Ce=U.next())Ce=ue(O,Ce.value,J),Ce!==null&&(L=p(Ce,L,Q),me===null?re=Ce:me.sibling=Ce,me=Ce);return Ze&&Qi(O,Q),re}for(ce=a(O,ce);!Ce.done;Q++,Ce=U.next())Ce=Be(ce,O,Q,Ce.value,J),Ce!==null&&(t&&Ce.alternate!==null&&ce.delete(Ce.key===null?Q:Ce.key),L=p(Ce,L,Q),me===null?re=Ce:me.sibling=Ce,me=Ce);return t&&ce.forEach(function(hc){return n(O,hc)}),Ze&&Qi(O,Q),re}function mi(O,L,U,J){if(typeof U=="object"&&U!==null&&U.type===C&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case S:e:{for(var re=U.key,me=L;me!==null;){if(me.key===re){if(re=U.type,re===C){if(me.tag===7){s(O,me.sibling),L=d(me,U.props.children),L.return=O,O=L;break e}}else if(me.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===j&&Sa(re)===me.type){s(O,me.sibling),L=d(me,U.props),L.ref=wn(O,me,U),L.return=O,O=L;break e}s(O,me);break}else n(O,me);me=me.sibling}U.type===C?(L=jn(U.props.children,O.mode,J,U.key),L.return=O,O=L):(J=ko(U.type,U.key,U.props,null,O.mode,J),J.ref=wn(O,L,U),J.return=O,O=J)}return P(O);case _:e:{for(me=U.key;L!==null;){if(L.key===me)if(L.tag===4&&L.stateNode.containerInfo===U.containerInfo&&L.stateNode.implementation===U.implementation){s(O,L.sibling),L=d(L,U.children||[]),L.return=O,O=L;break e}else{s(O,L);break}else n(O,L);L=L.sibling}L=Mo(U,O.mode,J),L.return=O,O=L}return P(O);case j:return me=U._init,mi(O,L,me(U._payload),J)}if(At(U))return Ue(O,L,U,J);if(xe(U))return Ht(O,L,U,J);Vi(O,U)}return typeof U=="string"&&U!==""||typeof U=="number"?(U=""+U,L!==null&&L.tag===6?(s(O,L.sibling),L=d(L,U),L.return=O,O=L):(s(O,L),L=Ro(U,O.mode,J),L.return=O,O=L),P(O)):s(O,L)}return mi}var Nr=wa(!0),qi=wa(!1),Ot={},on=Si(Ot),gs=Si(Ot),Tr=Si(Ot);function Bn(t){if(t===Ot)throw Error(g(174));return t}function vl(t,n){Fe(Tr,n),Fe(gs,t),Fe(on,Ot),t=ut(n),Ge(on),Fe(on,t)}function Lr(){Ge(on),Ge(gs),Ge(Tr)}function Ji(t){var n=Bn(Tr.current),s=Bn(on.current);n=V(s,t.type,n),s!==n&&(Fe(gs,t),Fe(on,n))}function T(t){gs.current===t&&(Ge(on),Ge(gs))}var z=Si(0);function W(t){for(var n=t;n!==null;){if(n.tag===13){var s=n.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Vs(s)||$o(s)))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if(n.flags&128)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var $=[];function he(){for(var t=0;t<$.length;t++){var n=$[t];Xs?n._workInProgressVersionPrimary=null:n._workInProgressVersionSecondary=null}$.length=0}var Le=v.ReactCurrentDispatcher,Ve=v.ReactCurrentBatchConfig,ke=0,Xe=null,tt=null,Oe=null,ji=!1,ps=!1,Gn=0,fo=0;function nt(){throw Error(g(321))}function ze(t,n){if(n===null)return!1;for(var s=0;s<n.length&&s<t.length;s++)if(!Tn(t[s],n[s]))return!1;return!0}function yl(t,n,s,a,d,p){if(ke=p,Xe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Le.current=t===null||t.memoizedState===null?Or:Ps,t=s(a,d),ps){p=0;do{if(ps=!1,Gn=0,25<=p)throw Error(g(301));p+=1,Oe=tt=null,n.updateQueue=null,Le.current=_s,t=s(a,d)}while(ps)}if(Le.current=zr,n=tt!==null&&tt.next!==null,ke=0,Oe=tt=Xe=null,ji=!1,n)throw Error(g(300));return t}function ho(){var t=Gn!==0;return Gn=0,t}function ln(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Oe===null?Xe.memoizedState=Oe=t:Oe=Oe.next=t,Oe}function xn(){if(tt===null){var t=Xe.alternate;t=t!==null?t.memoizedState:null}else t=tt.next;var n=Oe===null?Xe.memoizedState:Oe.next;if(n!==null)Oe=n,tt=t;else{if(t===null)throw Error(g(310));tt=t,t={memoizedState:tt.memoizedState,baseState:tt.baseState,baseQueue:tt.baseQueue,queue:tt.queue,next:null},Oe===null?Xe.memoizedState=Oe=t:Oe=Oe.next=t}return Oe}function ms(t,n){return typeof n=="function"?n(t):n}function Sl(t){var n=xn(),s=n.queue;if(s===null)throw Error(g(311));s.lastRenderedReducer=t;var a=tt,d=a.baseQueue,p=s.pending;if(p!==null){if(d!==null){var P=d.next;d.next=p.next,p.next=P}a.baseQueue=d=p,s.pending=null}if(d!==null){p=d.next,a=a.baseState;var N=P=null,M=null,K=p;do{var te=K.lane;if((ke&te)===te)M!==null&&(M=M.next={lane:0,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),a=K.hasEagerState?K.eagerState:t(a,K.action);else{var ue={lane:te,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null};M===null?(N=M=ue,P=a):M=M.next=ue,Xe.lanes|=te,ui|=te}K=K.next}while(K!==null&&K!==p);M===null?P=a:M.next=N,Tn(a,n.memoizedState)||(Yt=!0),n.memoizedState=a,n.baseState=P,n.baseQueue=M,s.lastRenderedState=a}if(t=s.interleaved,t!==null){d=t;do p=d.lane,Xe.lanes|=p,ui|=p,d=d.next;while(d!==t)}else d===null&&(s.lanes=0);return[n.memoizedState,s.dispatch]}function Cr(t){var n=xn(),s=n.queue;if(s===null)throw Error(g(311));s.lastRenderedReducer=t;var a=s.dispatch,d=s.pending,p=n.memoizedState;if(d!==null){s.pending=null;var P=d=d.next;do p=t(p,P.action),P=P.next;while(P!==d);Tn(p,n.memoizedState)||(Yt=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),s.lastRenderedState=p}return[p,a]}function li(){}function vs(t,n){var s=Xe,a=xn(),d=n(),p=!Tn(a.memoizedState,d);if(p&&(a.memoizedState=d,Yt=!0),a=a.queue,_l(xl.bind(null,s,a,t),[t]),a.getSnapshot!==n||p||Oe!==null&&Oe.memoizedState.tag&1){if(s.flags|=2048,kr(9,ys.bind(null,s,a,d,n),void 0,null),rt===null)throw Error(g(349));ke&30||wl(s,n,d)}return d}function wl(t,n,s){t.flags|=16384,t={getSnapshot:n,value:s},n=Xe.updateQueue,n===null?(n={lastEffect:null,stores:null},Xe.updateQueue=n,n.stores=[t]):(s=n.stores,s===null?n.stores=[t]:s.push(t))}function ys(t,n,s,a){n.value=s,n.getSnapshot=a,Pl(n)&&Et(t,1,-1)}function xl(t,n,s){return s(function(){Pl(n)&&Et(t,1,-1)})}function Pl(t){var n=t.getSnapshot;t=t.value;try{var s=n();return!Tn(t,s)}catch{return!0}}function Ss(t){var n=ln();return typeof t=="function"&&(t=t()),n.memoizedState=n.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:t},n.queue=t,t=t.dispatch=ic.bind(null,Xe,t),[n.memoizedState,t]}function kr(t,n,s,a){return t={tag:t,create:n,destroy:s,deps:a,next:null},n=Xe.updateQueue,n===null?(n={lastEffect:null,stores:null},Xe.updateQueue=n,n.lastEffect=t.next=t):(s=n.lastEffect,s===null?n.lastEffect=t.next=t:(a=s.next,s.next=t,t.next=a,n.lastEffect=t)),t}function Rr(){return xn().memoizedState}function Zn(t,n,s,a){var d=ln();Xe.flags|=t,d.memoizedState=kr(1|n,s,void 0,a===void 0?null:a)}function $i(t,n,s,a){var d=xn();a=a===void 0?null:a;var p=void 0;if(tt!==null){var P=tt.memoizedState;if(p=P.destroy,a!==null&&ze(a,P.deps)){d.memoizedState=kr(n,s,p,a);return}}Xe.flags|=t,d.memoizedState=kr(1|n,s,p,a)}function xa(t,n){return Zn(8390656,8,t,n)}function _l(t,n){return $i(2048,8,t,n)}function Pa(t,n){return $i(4,2,t,n)}function ws(t,n){return $i(4,4,t,n)}function xs(t,n){if(typeof n=="function")return t=t(),n(t),function(){n(null)};if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function go(t,n,s){return s=s!=null?s.concat([t]):null,$i(4,4,xs.bind(null,n,t),s)}function El(){}function Il(t,n){var s=xn();n=n===void 0?null:n;var a=s.memoizedState;return a!==null&&n!==null&&ze(n,a[1])?a[0]:(s.memoizedState=[t,n],t)}function _a(t,n){var s=xn();n=n===void 0?null:n;var a=s.memoizedState;return a!==null&&n!==null&&ze(n,a[1])?a[0]:(t=t(),s.memoizedState=[t,n],t)}function Ea(t,n,s){return ke&21?(Tn(s,n)||(s=sl(),Xe.lanes|=s,ui|=s,t.baseState=!0),n):(t.baseState&&(t.baseState=!1,Yt=!0),t.memoizedState=s)}function it(t,n){var s=Me;Me=s!==0&&4>s?s:4,t(!0);var a=Ve.transition;Ve.transition={};try{t(!1),n()}finally{Me=s,Ve.transition=a}}function wt(){return xn().memoizedState}function nc(t,n,s){var a=ki(t);s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},Al(t)?Ia(n,s):(po(t,n,s),s=Lt(),t=Et(t,a,s),t!==null&&Mr(t,n,a))}function ic(t,n,s){var a=ki(t),d={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(Al(t))Ia(n,d);else{po(t,n,d);var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var P=n.lastRenderedState,N=p(P,s);if(d.hasEagerState=!0,d.eagerState=N,Tn(N,P))return}catch{}finally{}s=Lt(),t=Et(t,a,s),t!==null&&Mr(t,n,a)}}function Al(t){var n=t.alternate;return t===Xe||n!==null&&n===Xe}function Ia(t,n){ps=ji=!0;var s=t.pending;s===null?n.next=n:(n.next=s.next,s.next=n),t.pending=n}function po(t,n,s){Za(t)?(t=n.interleaved,t===null?(s.next=s,Ke===null?Ke=[n]:Ke.push(n)):(s.next=t.next,t.next=s),n.interleaved=s):(t=n.pending,t===null?s.next=s:(s.next=t.next,t.next=s),n.pending=s)}function Mr(t,n,s){if(s&4194240){var a=n.lanes;a&=t.pendingLanes,s|=a,n.lanes=s,ol(t,s)}}var zr={readContext:yn,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useInsertionEffect:nt,useLayoutEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useMutableSource:nt,useSyncExternalStore:nt,useId:nt,unstable_isNewReconciler:!1},Or={readContext:yn,useCallback:function(t,n){return ln().memoizedState=[t,n===void 0?null:n],t},useContext:yn,useEffect:xa,useImperativeHandle:function(t,n,s){return s=s!=null?s.concat([t]):null,Zn(4194308,4,xs.bind(null,n,t),s)},useLayoutEffect:function(t,n){return Zn(4194308,4,t,n)},useInsertionEffect:function(t,n){return Zn(4,2,t,n)},useMemo:function(t,n){var s=ln();return n=n===void 0?null:n,t=t(),s.memoizedState=[t,n],t},useReducer:function(t,n,s){var a=ln();return n=s!==void 0?s(n):n,a.memoizedState=a.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=nc.bind(null,Xe,t),[a.memoizedState,t]},useRef:function(t){var n=ln();return t={current:t},n.memoizedState=t},useState:Ss,useDebugValue:El,useDeferredValue:function(t){return ln().memoizedState=t},useTransition:function(){var t=Ss(!1),n=t[0];return t=it.bind(null,t[1]),ln().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,s){var a=Xe,d=ln();if(Ze){if(s===void 0)throw Error(g(407));s=s()}else{if(s=n(),rt===null)throw Error(g(349));ke&30||wl(a,n,s)}d.memoizedState=s;var p={value:s,getSnapshot:n};return d.queue=p,xa(xl.bind(null,a,p,t),[t]),a.flags|=2048,kr(9,ys.bind(null,a,p,s,n),void 0,null),s},useId:function(){var t=ln(),n=rt.identifierPrefix;if(Ze){var s=Cn,a=Ln;s=(a&~(1<<32-mn(a)-1)).toString(32)+s,n=":"+n+"R"+s,s=Gn++,0<s&&(n+="H"+s.toString(32)),n+=":"}else s=fo++,n=":"+n+"r"+s.toString(32)+":";return t.memoizedState=n},unstable_isNewReconciler:!1},Ps={readContext:yn,useCallback:Il,useContext:yn,useEffect:_l,useImperativeHandle:go,useInsertionEffect:Pa,useLayoutEffect:ws,useMemo:_a,useReducer:Sl,useRef:Rr,useState:function(){return Sl(ms)},useDebugValue:El,useDeferredValue:function(t){var n=xn();return Ea(n,tt.memoizedState,t)},useTransition:function(){var t=Sl(ms)[0],n=xn().memoizedState;return[t,n]},useMutableSource:li,useSyncExternalStore:vs,useId:wt,unstable_isNewReconciler:!1},_s={readContext:yn,useCallback:Il,useContext:yn,useEffect:_l,useImperativeHandle:go,useInsertionEffect:Pa,useLayoutEffect:ws,useMemo:_a,useReducer:Cr,useRef:Rr,useState:function(){return Cr(ms)},useDebugValue:El,useDeferredValue:function(t){var n=xn();return tt===null?n.memoizedState=t:Ea(n,tt.memoizedState,t)},useTransition:function(){var t=Cr(ms)[0],n=xn().memoizedState;return[t,n]},useMutableSource:li,useSyncExternalStore:vs,useId:wt,unstable_isNewReconciler:!1};function Dr(t,n){try{var s="",a=n;do s+=Zi(a),a=a.return;while(a);var d=s}catch(p){d=`
49
+ Error generating stack: `+p.message+`
50
+ `+p.stack}return{value:t,source:n,stack:d}}function Ni(t,n){try{console.error(n.value)}catch(s){setTimeout(function(){throw s})}}var rc=typeof WeakMap=="function"?WeakMap:Map;function Aa(t,n,s){s=Sn(-1,s),s.tag=3,s.payload={element:null};var a=n.value;return s.callback=function(){Rs||(Rs=!0,Wl=a),Ni(t,n)},s}function Na(t,n,s){s=Sn(-1,s),s.tag=3;var a=t.type.getDerivedStateFromError;if(typeof a=="function"){var d=n.value;s.payload=function(){return a(d)},s.callback=function(){Ni(t,n)}}var p=t.stateNode;return p!==null&&typeof p.componentDidCatch=="function"&&(s.callback=function(){Ni(t,n),typeof a!="function"&&(di===null?di=new Set([this]):di.add(this));var P=n.stack;this.componentDidCatch(n.value,{componentStack:P!==null?P:""})}),s}function Ta(t,n,s){var a=t.pingCache;if(a===null){a=t.pingCache=new rc;var d=new Set;a.set(n,d)}else d=a.get(n),d===void 0&&(d=new Set,a.set(n,d));d.has(s)||(d.add(s),t=cc.bind(null,t,n,s),n.then(t,t))}function La(t){do{var n;if((n=t.tag===13)&&(n=t.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return t;t=t.return}while(t!==null);return null}function Es(t,n,s,a,d){return t.mode&1?(t.flags|=65536,t.lanes=d,t):(t===n?t.flags|=65536:(t.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(n=Sn(-1,1),n.tag=2,bn(s,n))),s.lanes|=1),t)}function Xt(t){t.flags|=4}function Nl(t,n){if(t!==null&&t.child===n.child)return!0;if(n.flags&16)return!1;for(t=n.child;t!==null;){if(t.flags&12854||t.subtreeFlags&12854)return!1;t=t.sibling}return!0}var y,Xn,er,Dt;if(Nt)y=function(t,n){for(var s=n.child;s!==null;){if(s.tag===5||s.tag===6)pe(t,s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},Xn=function(){},er=function(t,n,s,a,d){if(t=t.memoizedProps,t!==a){var p=n.stateNode,P=Bn(on.current);s=Un(p,s,t,a,d,P),(n.updateQueue=s)&&Xt(n)}},Dt=function(t,n,s,a){s!==a&&Xt(n)};else if(Bi){y=function(t,n,s,a){for(var d=n.child;d!==null;){if(d.tag===5){var p=d.stateNode;s&&a&&(p=sa(p,d.type,d.memoizedProps,d)),pe(t,p)}else if(d.tag===6)p=d.stateNode,s&&a&&(p=oa(p,d.memoizedProps,d)),pe(t,p);else if(d.tag!==4){if(d.tag===22&&d.memoizedState!==null)p=d.child,p!==null&&(p.return=d),y(t,d,!0,!0);else if(d.child!==null){d.child.return=d,d=d.child;continue}}if(d===n)break;for(;d.sibling===null;){if(d.return===null||d.return===n)return;d=d.return}d.sibling.return=d.return,d=d.sibling}};var Ae=function(t,n,s,a){for(var d=n.child;d!==null;){if(d.tag===5){var p=d.stateNode;s&&a&&(p=sa(p,d.type,d.memoizedProps,d)),ra(t,p)}else if(d.tag===6)p=d.stateNode,s&&a&&(p=oa(p,d.memoizedProps,d)),ra(t,p);else if(d.tag!==4){if(d.tag===22&&d.memoizedState!==null)p=d.child,p!==null&&(p.return=d),Ae(t,d,!0,!0);else if(d.child!==null){d.child.return=d,d=d.child;continue}}if(d===n)break;for(;d.sibling===null;){if(d.return===null||d.return===n)return;d=d.return}d.sibling.return=d.return,d=d.sibling}};Xn=function(t,n){var s=n.stateNode;if(!Nl(t,n)){t=s.containerInfo;var a=ia(t);Ae(a,n,!1,!1),s.pendingChildren=a,Xt(n),Ru(t,a)}},er=function(t,n,s,a,d){var p=t.stateNode,P=t.memoizedProps;if((t=Nl(t,n))&&P===a)n.stateNode=p;else{var N=n.stateNode,M=Bn(on.current),K=null;P!==a&&(K=Un(N,s,P,a,d,M)),t&&K===null?n.stateNode=p:(p=ku(p,K,s,P,a,n,t,N),Fi(p,s,a,d,M)&&Xt(n),n.stateNode=p,t?Xt(n):y(p,n,!1,!1))}},Dt=function(t,n,s,a){s!==a?(t=Bn(Tr.current),s=Bn(on.current),n.stateNode=nn(a,t,s,n),Xt(n)):n.stateNode=t.stateNode}}else Xn=function(){},er=function(){},Dt=function(){};function Is(t,n){if(!Ze)switch(t.tailMode){case"hidden":n=t.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:a.sibling=null}}function Tt(t){var n=t.alternate!==null&&t.alternate.child===t.child,s=0,a=0;if(n)for(var d=t.child;d!==null;)s|=d.lanes|d.childLanes,a|=d.subtreeFlags&14680064,a|=d.flags&14680064,d.return=t,d=d.sibling;else for(d=t.child;d!==null;)s|=d.lanes|d.childLanes,a|=d.subtreeFlags,a|=d.flags,d.return=t,d=d.sibling;return t.subtreeFlags|=a,t.childLanes=s,n}function sc(t,n,s){var a=n.pendingProps;switch(ds(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Tt(n),null;case 1:return Bt(n.type)&&os(),Tt(n),null;case 3:return a=n.stateNode,Lr(),Ge(Rt),Ge(vt),he(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(hs(n)?Xt(n):t===null||t.memoizedState.isDehydrated&&!(n.flags&256)||(n.flags|=1024,kn!==null&&(Zr(kn),kn=null))),Xn(t,n),Tt(n),null;case 5:T(n),s=Bn(Tr.current);var d=n.type;if(t!==null&&n.stateNode!=null)er(t,n,d,a,s),t.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!a){if(n.stateNode===null)throw Error(g(166));return Tt(n),null}if(t=Bn(on.current),hs(n)){if(!rn)throw Error(g(175));t=Fu(n.stateNode,n.type,n.memoizedProps,s,t,n,!fs),n.updateQueue=t,t!==null&&Xt(n)}else{var p=ge(d,a,s,t,n);y(p,n,!1,!1),n.stateNode=p,Fi(p,d,a,s,t)&&Xt(n)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return Tt(n),null;case 6:if(t&&n.stateNode!=null)Dt(t,n,t.memoizedProps,a);else{if(typeof a!="string"&&n.stateNode===null)throw Error(g(166));if(t=Bn(Tr.current),s=Bn(on.current),hs(n)){if(!rn)throw Error(g(176));if(t=n.stateNode,a=n.memoizedProps,(s=Hu(t,a,n,!fs))&&(d=St,d!==null))switch(d.tag){case 3:qs(d.stateNode.containerInfo,t,a,(d.mode&1)!==0);break;case 5:Ku(d.type,d.memoizedProps,d.stateNode,t,a,(d.mode&1)!==0)}s&&Xt(n)}else n.stateNode=nn(a,t,s,n)}return Tt(n),null;case 13:if(Ge(z),a=n.memoizedState,Ze&&Zt!==null&&n.mode&1&&!(n.flags&128)){for(t=Zt;t;)t=rs(t);return Ai(),n.flags|=98560,n}if(a!==null&&a.dehydrated!==null){if(a=hs(n),t===null){if(!a)throw Error(g(318));if(!rn)throw Error(g(344));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(g(317));la(t,n)}else Ai(),!(n.flags&128)&&(n.memoizedState=null),n.flags|=4;return Tt(n),null}return kn!==null&&(Zr(kn),kn=null),n.flags&128?(n.lanes=s,n):(a=a!==null,s=!1,t===null?hs(n):s=t.memoizedState!==null,a!==s&&a&&(n.child.flags|=8192,n.mode&1&&(t===null||z.current&1?st===0&&(st=3):Lo())),n.updateQueue!==null&&(n.flags|=4),Tt(n),null);case 4:return Lr(),Xn(t,n),t===null&&$r(n.stateNode.containerInfo),Tt(n),null;case 10:return so(n.type._context),Tt(n),null;case 17:return Bt(n.type)&&os(),Tt(n),null;case 19:if(Ge(z),d=n.memoizedState,d===null)return Tt(n),null;if(a=(n.flags&128)!==0,p=d.rendering,p===null)if(a)Is(d,!1);else{if(st!==0||t!==null&&t.flags&128)for(t=n.child;t!==null;){if(p=W(t),p!==null){for(n.flags|=128,Is(d,!1),t=p.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),n.subtreeFlags=0,t=s,a=n.child;a!==null;)s=a,d=t,s.flags&=14680066,p=s.alternate,p===null?(s.childLanes=0,s.lanes=d,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=p.childLanes,s.lanes=p.lanes,s.child=p.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=p.memoizedProps,s.memoizedState=p.memoizedState,s.updateQueue=p.updateQueue,s.type=p.type,d=p.dependencies,s.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),a=a.sibling;return Fe(z,z.current&1|2),n.child}t=t.sibling}d.tail!==null&&je()>Br&&(n.flags|=128,a=!0,Is(d,!1),n.lanes=4194304)}else{if(!a)if(t=W(p),t!==null){if(n.flags|=128,a=!0,t=t.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),Is(d,!0),d.tail===null&&d.tailMode==="hidden"&&!p.alternate&&!Ze)return Tt(n),null}else 2*je()-d.renderingStartTime>Br&&s!==1073741824&&(n.flags|=128,a=!0,Is(d,!1),n.lanes=4194304);d.isBackwards?(p.sibling=n.child,n.child=p):(t=d.last,t!==null?t.sibling=p:n.child=p,d.last=p)}return d.tail!==null?(n=d.tail,d.rendering=n,d.tail=n.sibling,d.renderingStartTime=je(),n.sibling=null,t=z.current,Fe(z,a?t&1|2:t&1),n):(Tt(n),null);case 22:case 23:return qn(),a=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==a&&(n.flags|=8192),a&&n.mode&1?un&1073741824&&(Tt(n),Nt&&n.subtreeFlags&6&&(n.flags|=8192)):Tt(n),null;case 24:return null;case 25:return null}throw Error(g(156,n.tag))}var tr=v.ReactCurrentOwner,Yt=!1;function Wt(t,n,s,a){n.child=t===null?qi(n,null,s,a):Nr(n,t.child,s,a)}function Ca(t,n,s,a,d){s=s.render;var p=n.ref;return ct(n,d),a=yl(t,n,s,a,p,d),s=ho(),t!==null&&!Yt?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~d,ai(t,n,d)):(Ze&&s&&zt(n),n.flags|=1,Wt(t,n,a,d),n.child)}function ka(t,n,s,a,d){if(t===null){var p=s.type;return typeof p=="function"&&!Ct(p)&&p.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(n.tag=15,n.type=p,Ra(t,n,p,a,d)):(t=ko(s.type,null,a,n,n.mode,d),t.ref=n.ref,t.return=n,n.child=t)}if(p=t.child,!(t.lanes&d)){var P=p.memoizedProps;if(s=s.compare,s=s!==null?s:Pr,s(P,a)&&t.ref===n.ref)return ai(t,n,d)}return n.flags|=1,t=zi(p,a),t.ref=n.ref,t.return=n,n.child=t}function Ra(t,n,s,a,d){if(t!==null){var p=t.memoizedProps;if(Pr(p,a)&&t.ref===n.ref)if(Yt=!1,n.pendingProps=a=p,(t.lanes&d)!==0)t.flags&131072&&(Yt=!0);else return n.lanes=t.lanes,ai(t,n,d)}return Tl(t,n,s,a,d)}function Yn(t,n,s){var a=n.pendingProps,d=a.children,p=t!==null?t.memoizedState:null;if(a.mode==="hidden")if(!(n.mode&1))n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Fe(Fr,un),un|=s;else if(s&1073741824)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},a=p!==null?p.baseLanes:s,Fe(Fr,un),un|=a;else return t=p!==null?p.baseLanes|s:s,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:t,cachePool:null,transitions:null},n.updateQueue=null,Fe(Fr,un),un|=t,null;else p!==null?(a=p.baseLanes|s,n.memoizedState=null):a=s,Fe(Fr,un),un|=a;return Wt(t,n,d,s),n.child}function Ma(t,n){var s=n.ref;(t===null&&s!==null||t!==null&&t.ref!==s)&&(n.flags|=512,n.flags|=2097152)}function Tl(t,n,s,a,d){var p=Bt(s)?xi:vt.current;return p=Pi(n,p),ct(n,d),s=yl(t,n,s,a,p,d),a=ho(),t!==null&&!Yt?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~d,ai(t,n,d)):(Ze&&a&&zt(n),n.flags|=1,Wt(t,n,s,d),n.child)}function za(t,n,s,a,d){if(Bt(s)){var p=!0;js(n)}else p=!1;if(ct(n,d),n.stateNode===null)t!==null&&(t.alternate=null,n.alternate=null,n.flags|=2),gl(n,s,a),Ei(n,s,a,d),a=!0;else if(t===null){var P=n.stateNode,N=n.memoizedProps;P.props=N;var M=P.context,K=s.contextType;typeof K=="object"&&K!==null?K=yn(K):(K=Bt(s)?xi:vt.current,K=Pi(n,K));var te=s.getDerivedStateFromProps,ue=typeof te=="function"||typeof P.getSnapshotBeforeUpdate=="function";ue||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(N!==a||M!==K)&&us(n,P,a,K),_i=!1;var oe=n.memoizedState;P.state=oe,Er(n,a,P,d),M=n.memoizedState,N!==a||oe!==M||Rt.current||_i?(typeof te=="function"&&(hl(n,s,te,a),M=n.memoizedState),(N=_i||pa(n,s,N,a,oe,M,K))?(ue||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount()),typeof P.componentDidMount=="function"&&(n.flags|=4194308)):(typeof P.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=a,n.memoizedState=M),P.props=a,P.state=M,P.context=K,a=N):(typeof P.componentDidMount=="function"&&(n.flags|=4194308),a=!1)}else{P=n.stateNode,si(t,n),N=n.memoizedProps,K=n.type===n.elementType?N:vn(n.type,N),P.props=K,ue=n.pendingProps,oe=P.context,M=s.contextType,typeof M=="object"&&M!==null?M=yn(M):(M=Bt(s)?xi:vt.current,M=Pi(n,M));var Be=s.getDerivedStateFromProps;(te=typeof Be=="function"||typeof P.getSnapshotBeforeUpdate=="function")||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(N!==ue||oe!==M)&&us(n,P,a,M),_i=!1,oe=n.memoizedState,P.state=oe,Er(n,a,P,d);var Ue=n.memoizedState;N!==ue||oe!==Ue||Rt.current||_i?(typeof Be=="function"&&(hl(n,s,Be,a),Ue=n.memoizedState),(K=_i||pa(n,s,K,a,oe,Ue,M)||!1)?(te||typeof P.UNSAFE_componentWillUpdate!="function"&&typeof P.componentWillUpdate!="function"||(typeof P.componentWillUpdate=="function"&&P.componentWillUpdate(a,Ue,M),typeof P.UNSAFE_componentWillUpdate=="function"&&P.UNSAFE_componentWillUpdate(a,Ue,M)),typeof P.componentDidUpdate=="function"&&(n.flags|=4),typeof P.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof P.componentDidUpdate!="function"||N===t.memoizedProps&&oe===t.memoizedState||(n.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||N===t.memoizedProps&&oe===t.memoizedState||(n.flags|=1024),n.memoizedProps=a,n.memoizedState=Ue),P.props=a,P.state=Ue,P.context=M,a=K):(typeof P.componentDidUpdate!="function"||N===t.memoizedProps&&oe===t.memoizedState||(n.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||N===t.memoizedProps&&oe===t.memoizedState||(n.flags|=1024),a=!1)}return Ll(t,n,s,a,p,d)}function Ll(t,n,s,a,d,p){Ma(t,n);var P=(n.flags&128)!==0;if(!a&&!P)return d&&il(n,s,!1),ai(t,n,p);a=n.stateNode,tr.current=n;var N=P&&typeof s.getDerivedStateFromError!="function"?null:a.render();return n.flags|=1,t!==null&&P?(n.child=Nr(n,t.child,null,p),n.child=Nr(n,null,N,p)):Wt(t,n,N,p),n.memoizedState=a.state,d&&il(n,s,!0),n.child}function Oa(t){var n=t.stateNode;n.pendingContext?ls(t,n.pendingContext,n.pendingContext!==n.context):n.context&&ls(t,n.context,!1),vl(t,n.containerInfo)}function Kn(t,n,s,a,d){return Ai(),co(d),n.flags|=256,Wt(t,n,s,a),n.child}var mo={dehydrated:null,treeContext:null,retryLane:0};function vo(t){return{baseLanes:t,cachePool:null,transitions:null}}function Da(t,n){return{baseLanes:t.baseLanes|n,cachePool:null,transitions:t.transitions}}function Wa(t,n,s){var a=n.pendingProps,d=z.current,p=!1,P=(n.flags&128)!==0,N;if((N=P)||(N=t!==null&&t.memoizedState===null?!1:(d&2)!==0),N?(p=!0,n.flags&=-129):(t===null||t.memoizedState!==null)&&(d|=1),Fe(z,d&1),t===null)return Ii(n),t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(n.mode&1?$o(t)?n.lanes=8:n.lanes=1073741824:n.lanes=1,null):(d=a.children,t=a.fallback,p?(a=n.mode,p=n.child,d={mode:"hidden",children:d},!(a&1)&&p!==null?(p.childLanes=0,p.pendingProps=d):p=pi(d,a,0,null),t=jn(t,a,s,null),p.return=n,t.return=n,p.sibling=t,n.child=p,n.child.memoizedState=vo(s),n.memoizedState=mo,t):Cl(n,d));if(d=t.memoizedState,d!==null){if(N=d.dehydrated,N!==null){if(P)return n.flags&256?(n.flags&=-257,yo(t,n,s,Error(g(422)))):n.memoizedState!==null?(n.child=t.child,n.flags|=128,null):(p=a.fallback,d=n.mode,a=pi({mode:"visible",children:a.children},d,0,null),p=jn(p,d,s,null),p.flags|=2,a.return=n,p.return=n,a.sibling=p,n.child=a,n.mode&1&&Nr(n,t.child,null,s),n.child.memoizedState=vo(s),n.memoizedState=mo,p);if(!(n.mode&1))n=yo(t,n,s,null);else if($o(N))n=yo(t,n,s,Error(g(419)));else if(a=(s&t.childLanes)!==0,Yt||a){if(a=rt,a!==null){switch(s&-s){case 4:p=2;break;case 16:p=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:p=32;break;case 536870912:p=268435456;break;default:p=0}a=p&(a.suspendedLanes|s)?0:p,a!==0&&a!==d.retryLane&&(d.retryLane=a,Et(t,a,-1))}Lo(),n=yo(t,n,s,Error(g(421)))}else Vs(N)?(n.flags|=128,n.child=t.child,n=dc.bind(null,t),Ou(N,n),n=null):(s=d.treeContext,rn&&(Zt=Uu(N),St=n,Ze=!0,kn=null,fs=!1,s!==null&&(Gt[sn++]=Ln,Gt[sn++]=Cn,Gt[sn++]=Ki,Ln=s.id,Cn=s.overflow,Ki=n)),n=Cl(n,n.pendingProps.children),n.flags|=4096);return n}return p?(a=Ua(t,n,a.children,a.fallback,s),p=n.child,d=t.child.memoizedState,p.memoizedState=d===null?vo(s):Da(d,s),p.childLanes=t.childLanes&~s,n.memoizedState=mo,a):(s=Ti(t,n,a.children,s),n.memoizedState=null,s)}return p?(a=Ua(t,n,a.children,a.fallback,s),p=n.child,d=t.child.memoizedState,p.memoizedState=d===null?vo(s):Da(d,s),p.childLanes=t.childLanes&~s,n.memoizedState=mo,a):(s=Ti(t,n,a.children,s),n.memoizedState=null,s)}function Cl(t,n){return n=pi({mode:"visible",children:n},t.mode,0,null),n.return=t,t.child=n}function Ti(t,n,s,a){var d=t.child;return t=d.sibling,s=zi(d,{mode:"visible",children:s}),!(n.mode&1)&&(s.lanes=a),s.return=n,s.sibling=null,t!==null&&(a=n.deletions,a===null?(n.deletions=[t],n.flags|=16):a.push(t)),n.child=s}function Ua(t,n,s,a,d){var p=n.mode;t=t.child;var P=t.sibling,N={mode:"hidden",children:s};return!(p&1)&&n.child!==t?(s=n.child,s.childLanes=0,s.pendingProps=N,n.deletions=null):(s=zi(t,N),s.subtreeFlags=t.subtreeFlags&14680064),P!==null?a=zi(P,a):(a=jn(a,p,d,null),a.flags|=2),a.return=n,s.return=n,s.sibling=a,n.child=s,a}function yo(t,n,s,a){return a!==null&&co(a),Nr(n,t.child,null,s),t=Cl(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Pn(t,n,s){t.lanes|=n;var a=t.alternate;a!==null&&(a.lanes|=n),oo(t.return,n,s)}function kl(t,n,s,a,d){var p=t.memoizedState;p===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:a,tail:s,tailMode:d}:(p.isBackwards=n,p.rendering=null,p.renderingStartTime=0,p.last=a,p.tail=s,p.tailMode=d)}function Fa(t,n,s){var a=n.pendingProps,d=a.revealOrder,p=a.tail;if(Wt(t,n,a.children,s),a=z.current,a&2)a=a&1|2,n.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Pn(t,s,n);else if(t.tag===19)Pn(t,s,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}a&=1}if(Fe(z,a),!(n.mode&1))n.memoizedState=null;else switch(d){case"forwards":for(s=n.child,d=null;s!==null;)t=s.alternate,t!==null&&W(t)===null&&(d=s),s=s.sibling;s=d,s===null?(d=n.child,n.child=null):(d=s.sibling,s.sibling=null),kl(n,!1,d,s,p);break;case"backwards":for(s=null,d=n.child,n.child=null;d!==null;){if(t=d.alternate,t!==null&&W(t)===null){n.child=d;break}t=d.sibling,d.sibling=s,s=d,d=t}kl(n,!0,s,null,p);break;case"together":kl(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function ai(t,n,s){if(t!==null&&(n.dependencies=t.dependencies),ui|=n.lanes,!(s&n.childLanes))return null;if(t!==null&&n.child!==t.child)throw Error(g(153));if(n.child!==null){for(t=n.child,s=zi(t,t.pendingProps),n.child=s,s.return=n;t.sibling!==null;)t=t.sibling,s=s.sibling=zi(t,t.pendingProps),s.return=n;s.sibling=null}return n.child}function oc(t,n,s){switch(n.tag){case 3:Oa(n),Ai();break;case 5:Ji(n);break;case 1:Bt(n.type)&&js(n);break;case 4:vl(n,n.stateNode.containerInfo);break;case 10:fl(n,n.type._context,n.memoizedProps.value);break;case 13:var a=n.memoizedState;if(a!==null)return a.dehydrated!==null?(Fe(z,z.current&1),n.flags|=128,null):s&n.child.childLanes?Wa(t,n,s):(Fe(z,z.current&1),t=ai(t,n,s),t!==null?t.sibling:null);Fe(z,z.current&1);break;case 19:if(a=(s&n.childLanes)!==0,t.flags&128){if(a)return Fa(t,n,s);n.flags|=128}var d=n.memoizedState;if(d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),Fe(z,z.current),a)break;return null;case 22:case 23:return n.lanes=0,Yn(t,n,s)}return ai(t,n,s)}function lc(t,n){switch(ds(n),n.tag){case 1:return Bt(n.type)&&os(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Lr(),Ge(Rt),Ge(vt),he(),t=n.flags,t&65536&&!(t&128)?(n.flags=t&-65537|128,n):null;case 5:return T(n),null;case 13:if(Ge(z),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(g(340));Ai()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Ge(z),null;case 4:return Lr(),null;case 10:return so(n.type._context),null;case 22:case 23:return qn(),null;case 24:return null;default:return null}}var As=!1,xt=!1,ac=typeof WeakSet=="function"?WeakSet:Set,ee=null;function Li(t,n){var s=t.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){be(t,n,a)}else s.current=null}function nr(t,n,s){try{s()}catch(a){be(t,n,a)}}var Ns=!1;function uc(t,n){for(le(t.containerInfo),ee=n;ee!==null;)if(t=ee,n=t.child,(t.subtreeFlags&1028)!==0&&n!==null)n.return=t,ee=n;else for(;ee!==null;){t=ee;try{var s=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(s!==null){var a=s.memoizedProps,d=s.memoizedState,p=t.stateNode,P=p.getSnapshotBeforeUpdate(t.elementType===t.type?a:vn(t.type,a),d);p.__reactInternalSnapshotBeforeUpdate=P}break;case 3:Nt&&na(t.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(g(163))}}catch(N){be(t,t.return,N)}if(n=t.sibling,n!==null){n.return=t.return,ee=n;break}ee=t.return}return s=Ns,Ns=!1,s}function Wr(t,n,s){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&t)===t){var p=d.destroy;d.destroy=void 0,p!==void 0&&nr(n,s,p)}d=d.next}while(d!==a)}}function So(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&t)===t){var a=s.create;s.destroy=a()}s=s.next}while(s!==n)}}function Rn(t){var n=t.ref;if(n!==null){var s=t.stateNode;switch(t.tag){case 5:t=mt(s);break;default:t=s}typeof n=="function"?n(t):n.current=t}}function wo(t){var n=t.alternate;n!==null&&(t.alternate=null,wo(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&ni(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Ci(t){return t.tag===5||t.tag===3||t.tag===4}function an(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Ci(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Rl(t,n,s){var a=t.tag;if(a===5||a===6)t=t.stateNode,n?Vo(s,t,n):Zo(s,t);else if(a!==4&&(t=t.child,t!==null))for(Rl(t,n,s),t=t.sibling;t!==null;)Rl(t,n,s),t=t.sibling}function xo(t,n,s){var a=t.tag;if(a===5||a===6)t=t.stateNode,n?Qo(s,t,n):vr(s,t);else if(a!==4&&(t=t.child,t!==null))for(xo(t,n,s),t=t.sibling;t!==null;)xo(t,n,s),t=t.sibling}var dt=null,Ut=!1;function Pt(t,n,s){for(s=s.child;s!==null;)Po(t,n,s),s=s.sibling}function Po(t,n,s){if(Te&&typeof Te.onCommitFiberUnmount=="function")try{Te.onCommitFiberUnmount(to,s)}catch{}switch(s.tag){case 5:xt||Li(s,n);case 6:if(Nt){var a=dt,d=Ut;dt=null,Pt(t,n,s),dt=a,Ut=d,dt!==null&&(Ut?Jo(dt,s.stateNode):qo(dt,s.stateNode))}else Pt(t,n,s);break;case 18:Nt&&dt!==null&&(Ut?Xu(dt,s.stateNode):Zu(dt,s.stateNode));break;case 4:Nt?(a=dt,d=Ut,dt=s.stateNode.containerInfo,Ut=!0,Pt(t,n,s),dt=a,Ut=d):(Bi&&(a=s.stateNode.containerInfo,d=ia(a),Qs(a,d)),Pt(t,n,s));break;case 0:case 11:case 14:case 15:if(!xt&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){d=a=a.next;do{var p=d,P=p.destroy;p=p.tag,P!==void 0&&(p&2||p&4)&&nr(s,n,P),d=d.next}while(d!==a)}Pt(t,n,s);break;case 1:if(!xt&&(Li(s,n),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(N){be(s,n,N)}Pt(t,n,s);break;case 21:Pt(t,n,s);break;case 22:s.mode&1?(xt=(a=xt)||s.memoizedState!==null,Pt(t,n,s),xt=a):Pt(t,n,s);break;default:Pt(t,n,s)}}function Ha(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var s=t.stateNode;s===null&&(s=t.stateNode=new ac),n.forEach(function(a){var d=Ka.bind(null,t,a);s.has(a)||(s.add(a),a.then(d,d))})}}function Kt(t,n){var s=n.deletions;if(s!==null)for(var a=0;a<s.length;a++){var d=s[a];try{var p=t,P=n;if(Nt){var N=P;e:for(;N!==null;){switch(N.tag){case 5:dt=N.stateNode,Ut=!1;break e;case 3:dt=N.stateNode.containerInfo,Ut=!0;break e;case 4:dt=N.stateNode.containerInfo,Ut=!0;break e}N=N.return}if(dt===null)throw Error(g(160));Po(p,P,d),dt=null,Ut=!1}else Po(p,P,d);var M=d.alternate;M!==null&&(M.return=null),d.return=null}catch(K){be(d,n,K)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)ba(n,t),n=n.sibling}function ba(t,n){var s=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Kt(n,t),Mn(t),a&4){try{Wr(3,t,t.return),So(3,t)}catch(M){be(t,t.return,M)}try{Wr(5,t,t.return)}catch(M){be(t,t.return,M)}}break;case 1:Kt(n,t),Mn(t),a&512&&s!==null&&Li(s,s.return);break;case 5:if(Kt(n,t),Mn(t),a&512&&s!==null&&Li(s,s.return),Nt){if(t.flags&32){var d=t.stateNode;try{Ks(d)}catch(M){be(t,t.return,M)}}if(a&4&&(d=t.stateNode,d!=null)){var p=t.memoizedProps;if(s=s!==null?s.memoizedProps:p,a=t.type,n=t.updateQueue,t.updateQueue=null,n!==null)try{Ko(d,n,a,s,p,t)}catch(M){be(t,t.return,M)}}}break;case 6:if(Kt(n,t),Mn(t),a&4&&Nt){if(t.stateNode===null)throw Error(g(162));d=t.stateNode,p=t.memoizedProps,s=s!==null?s.memoizedProps:p;try{Xo(d,s,p)}catch(M){be(t,t.return,M)}}break;case 3:if(Kt(n,t),Mn(t),a&4){if(Nt&&rn&&s!==null&&s.memoizedState.isDehydrated)try{Bu(n.containerInfo)}catch(M){be(t,t.return,M)}if(Bi){s=n.containerInfo,d=n.pendingChildren;try{Qs(s,d)}catch(M){be(t,t.return,M)}}}break;case 4:if(Kt(n,t),Mn(t),a&4&&Bi){d=t.stateNode,s=d.containerInfo,d=d.pendingChildren;try{Qs(s,d)}catch(M){be(t,t.return,M)}}break;case 13:Kt(n,t),Mn(t),s=t.child,s.flags&8192&&s.memoizedState!==null&&(s.alternate===null||s.alternate.memoizedState===null)&&(No=je()),a&4&&Ha(t);break;case 22:if(s=s!==null&&s.memoizedState!==null,t.mode&1){var P=xt;xt=P||s,Kt(n,t),xt=P}else Kt(n,t);if(Mn(t),a&8192){if(a=t.memoizedState!==null,Nt){e:if(n=null,Nt)for(P=t;;){if(P.tag===5){if(n===null){n=P;try{d=P.stateNode,a?Tu(d):Cu(P.stateNode,P.memoizedProps)}catch(M){be(t,t.return,M)}}}else if(P.tag===6){if(n===null)try{p=P.stateNode,a?Lu(p):ta(p,P.memoizedProps)}catch(M){be(t,t.return,M)}}else if((P.tag!==22&&P.tag!==23||P.memoizedState===null||P===t)&&P.child!==null){P.child.return=P,P=P.child;continue}if(P===t)break e;for(;P.sibling===null;){if(P.return===null||P.return===t)break e;n===P&&(n=null),P=P.return}n===P&&(n=null),P.sibling.return=P.return,P=P.sibling}}if(a&&!s&&t.mode&1)for(ee=t,t=t.child;t!==null;){for(s=ee=t;ee!==null;){switch(d=ee,p=d.child,d.tag){case 0:case 11:case 14:case 15:Wr(4,d,d.return);break;case 1:Li(d,d.return);var N=d.stateNode;if(typeof N.componentWillUnmount=="function"){a=d,n=d.return;try{P=a,N.props=P.memoizedProps,N.state=P.memoizedState,N.componentWillUnmount()}catch(M){be(a,n,M)}}break;case 5:Li(d,d.return);break;case 22:if(d.memoizedState!==null){zn(s);continue}}p!==null?(p.return=d,ee=p):zn(s)}t=t.sibling}}break;case 19:Kt(n,t),Mn(t),a&4&&Ha(t);break;case 21:break;default:Kt(n,t),Mn(t)}}function Mn(t){var n=t.flags;if(n&2){try{if(Nt){e:{for(var s=t.return;s!==null;){if(Ci(s)){var a=s;break e}s=s.return}throw Error(g(160))}switch(a.tag){case 5:var d=a.stateNode;a.flags&32&&(Ks(d),a.flags&=-33);var p=an(t);xo(t,p,d);break;case 3:case 4:var P=a.stateNode.containerInfo,N=an(t);Rl(t,N,P);break;default:throw Error(g(161))}}}catch(M){be(t,t.return,M)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function _t(t,n,s){ee=t,_o(t)}function _o(t,n,s){for(var a=(t.mode&1)!==0;ee!==null;){var d=ee,p=d.child;if(d.tag===22&&a){var P=d.memoizedState!==null||As;if(!P){var N=d.alternate,M=N!==null&&N.memoizedState!==null||xt;N=As;var K=xt;if(As=P,(xt=M)&&!K)for(ee=d;ee!==null;)P=ee,M=P.child,P.tag===22&&P.memoizedState!==null?Eo(d):M!==null?(M.return=P,ee=M):Eo(d);for(;p!==null;)ee=p,_o(p),p=p.sibling;ee=d,As=N,xt=K}Ml(t)}else d.subtreeFlags&8772&&p!==null?(p.return=d,ee=p):Ml(t)}}function Ml(t){for(;ee!==null;){var n=ee;if(n.flags&8772){var s=n.alternate;try{if(n.flags&8772)switch(n.tag){case 0:case 11:case 15:xt||So(5,n);break;case 1:var a=n.stateNode;if(n.flags&4&&!xt)if(s===null)a.componentDidMount();else{var d=n.elementType===n.type?s.memoizedProps:vn(n.type,s.memoizedProps);a.componentDidUpdate(d,s.memoizedState,a.__reactInternalSnapshotBeforeUpdate)}var p=n.updateQueue;p!==null&&ga(n,p,a);break;case 3:var P=n.updateQueue;if(P!==null){if(s=null,n.child!==null)switch(n.child.tag){case 5:s=mt(n.child.stateNode);break;case 1:s=n.child.stateNode}ga(n,P,s)}break;case 5:var N=n.stateNode;s===null&&n.flags&4&&Yo(N,n.type,n.memoizedProps,n);break;case 6:break;case 4:break;case 12:break;case 13:if(rn&&n.memoizedState===null){var M=n.alternate;if(M!==null){var K=M.memoizedState;if(K!==null){var te=K.dehydrated;te!==null&&Gu(te)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(g(163))}xt||n.flags&512&&Rn(n)}catch(ue){be(n,n.return,ue)}}if(n===t){ee=null;break}if(s=n.sibling,s!==null){s.return=n.return,ee=s;break}ee=n.return}}function zn(t){for(;ee!==null;){var n=ee;if(n===t){ee=null;break}var s=n.sibling;if(s!==null){s.return=n.return,ee=s;break}ee=n.return}}function Eo(t){for(;ee!==null;){var n=ee;try{switch(n.tag){case 0:case 11:case 15:var s=n.return;try{So(4,n)}catch(M){be(n,s,M)}break;case 1:var a=n.stateNode;if(typeof a.componentDidMount=="function"){var d=n.return;try{a.componentDidMount()}catch(M){be(n,d,M)}}var p=n.return;try{Rn(n)}catch(M){be(n,p,M)}break;case 5:var P=n.return;try{Rn(n)}catch(M){be(n,P,M)}}}catch(M){be(n,n.return,M)}if(n===t){ee=null;break}var N=n.sibling;if(N!==null){N.return=n.return,ee=N;break}ee=n.return}}var ir=0,Qn=1,Ts=2,ft=3,Ur=4;if(typeof Symbol=="function"&&Symbol.for){var Ls=Symbol.for;ir=Ls("selector.component"),Qn=Ls("selector.has_pseudo_class"),Ts=Ls("selector.role"),ft=Ls("selector.test_id"),Ur=Ls("selector.text")}function zl(t){var n=An(t);if(n!=null){if(typeof n.memoizedProps["data-testname"]!="string")throw Error(g(364));return n}if(t=Nn(t),t===null)throw Error(g(362));return t.stateNode.current}function Ol(t,n){switch(n.$$typeof){case ir:if(t.type===n.value)return!0;break;case Qn:e:{n=n.value,t=[t,0];for(var s=0;s<t.length;){var a=t[s++],d=t[s++],p=n[d];if(a.tag!==5||!ts(a)){for(;p!=null&&Ol(a,p);)d++,p=n[d];if(d===n.length){n=!0;break e}else for(a=a.child;a!==null;)t.push(a,d),a=a.sibling}}n=!1}return n;case Ts:if(t.tag===5&&ns(t.stateNode,n.value))return!0;break;case Ur:if((t.tag===5||t.tag===6)&&(t=Ys(t),t!==null&&0<=t.indexOf(n.value)))return!0;break;case ft:if(t.tag===5&&(t=t.memoizedProps["data-testname"],typeof t=="string"&&t.toLowerCase()===n.value.toLowerCase()))return!0;break;default:throw Error(g(365))}return!1}function Cs(t){switch(t.$$typeof){case ir:return"<"+(Ie(t.value)||"Unknown")+">";case Qn:return":has("+(Cs(t)||"")+")";case Ts:return'[role="'+t.value+'"]';case Ur:return'"'+t.value+'"';case ft:return'[data-testname="'+t.value+'"]';default:throw Error(g(365))}}function Ba(t,n){var s=[];t=[t,0];for(var a=0;a<t.length;){var d=t[a++],p=t[a++],P=n[p];if(d.tag!==5||!ts(d)){for(;P!=null&&Ol(d,P);)p++,P=n[p];if(p===n.length)s.push(d);else for(d=d.child;d!==null;)t.push(d,p),d=d.sibling}}return s}function rr(t,n){if(!ii)throw Error(g(363));t=zl(t),t=Ba(t,n),n=[],t=Array.from(t);for(var s=0;s<t.length;){var a=t[s++];if(a.tag===5)ts(a)||n.push(a.stateNode);else for(a=a.child;a!==null;)t.push(a),a=a.sibling}return n}var Ga=Math.ceil,Io=v.ReactCurrentDispatcher,Dl=v.ReactCurrentOwner,Ye=v.ReactCurrentBatchConfig,_e=0,rt=null,Qe=null,ht=0,un=0,Fr=Si(0),st=0,Hr=null,ui=0,Ao=0,ks=0,br=null,Ft=null,No=0,Br=1/0,ci=null;function sr(){Br=je()+500}var Rs=!1,Wl=null,di=null,To=!1,Vn=null,Ms=0,or=0,Ul=null,Gr=-1,ve=0;function Lt(){return _e&6?je():Gr!==-1?Gr:Gr=je()}function ki(t){return t.mode&1?_e&2&&ht!==0?ht&-ht:yt.transition!==null?(ve===0&&(ve=sl()),ve):(t=Me,t!==0?t:Iu()):1}function Et(t,n,s){if(50<or)throw or=0,Ul=null,Error(g(185));var a=zs(t,n);return a===null?null:(xr(a,n,s),(!(_e&2)||a!==rt)&&(a===rt&&(!(_e&2)&&(Ao|=n),st===4&&fi(a,ht)),Qt(a,s),n===1&&_e===0&&!(t.mode&1)&&(sr(),no&&Hn())),a)}function zs(t,n){t.lanes|=n;var s=t.alternate;for(s!==null&&(s.lanes|=n),s=t,t=t.return;t!==null;)t.childLanes|=n,s=t.alternate,s!==null&&(s.childLanes|=n),s=t,t=t.return;return s.tag===3?s.stateNode:null}function Za(t){return(rt!==null||Ke!==null)&&(t.mode&1)!==0&&(_e&2)===0}function Qt(t,n){var s=t.callbackNode;Vu(t,n);var a=as(t,t===rt?ht:0);if(a===0)s!==null&&da(s),t.callbackNode=null,t.callbackPriority=0;else if(n=a&-a,t.callbackPriority!==n){if(s!=null&&da(s),n===1)t.tag===0?ha(bl.bind(null,t)):fa(bl.bind(null,t)),ea?Au(function(){_e===0&&Hn()}):al(ul,Hn),s=null;else{switch(ll(a)){case 1:s=ul;break;case 4:s=$u;break;case 16:s=cl;break;case 536870912:s=ec;break;default:s=cl}s=Qa(s,cn.bind(null,t))}t.callbackPriority=n,t.callbackNode=s}}function cn(t,n){if(Gr=-1,ve=0,_e&6)throw Error(g(327));var s=t.callbackNode;if(Mi()&&t.callbackNode!==s)return null;var a=as(t,t===rt?ht:0);if(a===0)return null;if(a&30||a&t.expiredLanes||n)n=Xr(t,a);else{n=a;var d=_e;_e|=2;var p=Os();(rt!==t||ht!==n)&&(ci=null,sr(),hi(t,n));do try{Gl();break}catch(N){Bl(t,N)}while(!0);ro(),Io.current=p,_e=d,Qe!==null?n=0:(rt=null,ht=0,n=st)}if(n!==0){if(n===2&&(d=$s(t),d!==0&&(a=d,n=Fl(t,d))),n===1)throw s=Hr,hi(t,0),fi(t,a),Qt(t,je()),s;if(n===6)fi(t,a);else{if(d=t.current.alternate,!(a&30)&&!Hl(d)&&(n=Xr(t,a),n===2&&(p=$s(t),p!==0&&(a=p,n=Fl(t,p))),n===1))throw s=Hr,hi(t,0),fi(t,a),Qt(t,je()),s;switch(t.finishedWork=d,t.finishedLanes=a,n){case 0:case 1:throw Error(g(345));case 2:lr(t,Ft,ci);break;case 3:if(fi(t,a),(a&130023424)===a&&(n=No+500-je(),10<n)){if(as(t,0)!==0)break;if(d=t.suspendedLanes,(d&a)!==a){Lt(),t.pingedLanes|=t.suspendedLanes&d;break}t.timeoutHandle=Hi(lr.bind(null,t,Ft,ci),n);break}lr(t,Ft,ci);break;case 4:if(fi(t,a),(a&4194240)===a)break;for(n=t.eventTimes,d=-1;0<a;){var P=31-mn(a);p=1<<P,P=n[P],P>d&&(d=P),a&=~p}if(a=d,a=je()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*Ga(a/1960))-a,10<a){t.timeoutHandle=Hi(lr.bind(null,t,Ft,ci),a);break}lr(t,Ft,ci);break;case 5:lr(t,Ft,ci);break;default:throw Error(g(329))}}}return Qt(t,je()),t.callbackNode===s?cn.bind(null,t):null}function Fl(t,n){var s=br;return t.current.memoizedState.isDehydrated&&(hi(t,n).flags|=256),t=Xr(t,n),t!==2&&(n=Ft,Ft=s,n!==null&&Zr(n)),t}function Zr(t){Ft===null?Ft=t:Ft.push.apply(Ft,t)}function Hl(t){for(var n=t;;){if(n.flags&16384){var s=n.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var a=0;a<s.length;a++){var d=s[a],p=d.getSnapshot;d=d.value;try{if(!Tn(p(),d))return!1}catch{return!1}}}if(s=n.child,n.subtreeFlags&16384&&s!==null)s.return=n,n=s;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function fi(t,n){for(n&=~ks,n&=~Ao,t.suspendedLanes|=n,t.pingedLanes&=~n,t=t.expirationTimes;0<n;){var s=31-mn(n),a=1<<s;t[s]=-1,n&=~a}}function bl(t){if(_e&6)throw Error(g(327));Mi();var n=as(t,0);if(!(n&1))return Qt(t,je()),null;var s=Xr(t,n);if(t.tag!==0&&s===2){var a=$s(t);a!==0&&(n=a,s=Fl(t,a))}if(s===1)throw s=Hr,hi(t,0),fi(t,n),Qt(t,je()),s;if(s===6)throw Error(g(345));return t.finishedWork=t.current.alternate,t.finishedLanes=n,lr(t,Ft,ci),Qt(t,je()),null}function Vt(t){Vn!==null&&Vn.tag===0&&!(_e&6)&&Mi();var n=_e;_e|=1;var s=Ye.transition,a=Me;try{if(Ye.transition=null,Me=1,t)return t()}finally{Me=a,Ye.transition=s,_e=n,!(_e&6)&&Hn()}}function qn(){un=Fr.current,Ge(Fr)}function hi(t,n){t.finishedWork=null,t.finishedLanes=0;var s=t.timeoutHandle;if(s!==bi&&(t.timeoutHandle=bi,jr(s)),Qe!==null)for(s=Qe.return;s!==null;){var a=s;switch(ds(a),a.tag){case 1:a=a.type.childContextTypes,a!=null&&os();break;case 3:Lr(),Ge(Rt),Ge(vt),he();break;case 5:T(a);break;case 4:Lr();break;case 13:Ge(z);break;case 19:Ge(z);break;case 10:so(a.type._context);break;case 22:case 23:qn()}s=s.return}if(rt=t,Qe=t=zi(t.current,null),ht=un=n,st=0,Hr=null,ks=Ao=ui=0,Ft=br=null,Ke!==null){for(n=0;n<Ke.length;n++)if(s=Ke[n],a=s.interleaved,a!==null){s.interleaved=null;var d=a.next,p=s.pending;if(p!==null){var P=p.next;p.next=d,a.next=P}s.pending=a}Ke=null}return t}function Bl(t,n){do{var s=Qe;try{if(ro(),Le.current=zr,ji){for(var a=Xe.memoizedState;a!==null;){var d=a.queue;d!==null&&(d.pending=null),a=a.next}ji=!1}if(ke=0,Oe=tt=Xe=null,ps=!1,Gn=0,Dl.current=null,s===null||s.return===null){st=1,Hr=n,Qe=null;break}e:{var p=t,P=s.return,N=s,M=n;if(n=ht,N.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){var K=M,te=N,ue=te.tag;if(!(te.mode&1)&&(ue===0||ue===11||ue===15)){var oe=te.alternate;oe?(te.updateQueue=oe.updateQueue,te.memoizedState=oe.memoizedState,te.lanes=oe.lanes):(te.updateQueue=null,te.memoizedState=null)}var Be=La(P);if(Be!==null){Be.flags&=-257,Es(Be,P,N,p,n),Be.mode&1&&Ta(p,K,n),n=Be,M=K;var Ue=n.updateQueue;if(Ue===null){var Ht=new Set;Ht.add(M),n.updateQueue=Ht}else Ue.add(M);break e}else{if(!(n&1)){Ta(p,K,n),Lo();break e}M=Error(g(426))}}else if(Ze&&N.mode&1){var mi=La(P);if(mi!==null){!(mi.flags&65536)&&(mi.flags|=256),Es(mi,P,N,p,n),co(M);break e}}p=M,st!==4&&(st=2),br===null?br=[p]:br.push(p),M=Dr(M,N),N=P;do{switch(N.tag){case 3:N.flags|=65536,n&=-n,N.lanes|=n;var O=Aa(N,M,n);oi(N,O);break e;case 1:p=M;var L=N.type,U=N.stateNode;if(!(N.flags&128)&&(typeof L.getDerivedStateFromError=="function"||U!==null&&typeof U.componentDidCatch=="function"&&(di===null||!di.has(U)))){N.flags|=65536,n&=-n,N.lanes|=n;var J=Na(N,p,n);oi(N,J);break e}}N=N.return}while(N!==null)}gi(s)}catch(re){n=re,Qe===s&&s!==null&&(Qe=s=s.return);continue}break}while(!0)}function Os(){var t=Io.current;return Io.current=zr,t===null?zr:t}function Lo(){(st===0||st===3||st===2)&&(st=4),rt===null||!(ui&268435455)&&!(Ao&268435455)||fi(rt,ht)}function Xr(t,n){var s=_e;_e|=2;var a=Os();(rt!==t||ht!==n)&&(ci=null,hi(t,n));do try{Xa();break}catch(d){Bl(t,d)}while(!0);if(ro(),_e=s,Io.current=a,Qe!==null)throw Error(g(261));return rt=null,ht=0,st}function Xa(){for(;Qe!==null;)Co(Qe)}function Gl(){for(;Qe!==null&&!Ju();)Co(Qe)}function Co(t){var n=Xl(t.alternate,t,un);t.memoizedProps=t.pendingProps,n===null?gi(t):Qe=n,Dl.current=null}function gi(t){var n=t;do{var s=n.alternate;if(t=n.return,n.flags&32768){if(s=lc(s,n),s!==null){s.flags&=32767,Qe=s;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{st=6,Qe=null;return}}else if(s=sc(s,n,un),s!==null){Qe=s;return}if(n=n.sibling,n!==null){Qe=n;return}Qe=n=t}while(n!==null);st===0&&(st=5)}function lr(t,n,s){var a=Me,d=Ye.transition;try{Ye.transition=null,Me=1,Ri(t,n,s,a)}finally{Ye.transition=d,Me=a}return null}function Ri(t,n,s,a){do Mi();while(Vn!==null);if(_e&6)throw Error(g(327));s=t.finishedWork;var d=t.finishedLanes;if(s===null)return null;if(t.finishedWork=null,t.finishedLanes=0,s===t.current)throw Error(g(177));t.callbackNode=null,t.callbackPriority=0;var p=s.lanes|s.childLanes;if(qu(t,p),t===rt&&(Qe=rt=null,ht=0),!(s.subtreeFlags&2064)&&!(s.flags&2064)||To||(To=!0,Qa(cl,function(){return Mi(),null})),p=(s.flags&15990)!==0,s.subtreeFlags&15990||p){p=Ye.transition,Ye.transition=null;var P=Me;Me=1;var N=_e;_e|=4,Dl.current=null,uc(t,s),ba(s,t),ae(t.containerInfo),t.current=s,_t(s),ju(),_e=N,Me=P,Ye.transition=p}else t.current=s;if(To&&(To=!1,Vn=t,Ms=d),p=t.pendingLanes,p===0&&(di=null),He(s.stateNode),Qt(t,je()),n!==null)for(a=t.onRecoverableError,s=0;s<n.length;s++)a(n[s]);if(Rs)throw Rs=!1,t=Wl,Wl=null,t;return Ms&1&&t.tag!==0&&Mi(),p=t.pendingLanes,p&1?t===Ul?or++:(or=0,Ul=t):or=0,Hn(),null}function Mi(){if(Vn!==null){var t=ll(Ms),n=Ye.transition,s=Me;try{if(Ye.transition=null,Me=16>t?16:t,Vn===null)var a=!1;else{if(t=Vn,Vn=null,Ms=0,_e&6)throw Error(g(331));var d=_e;for(_e|=4,ee=t.current;ee!==null;){var p=ee,P=p.child;if(ee.flags&16){var N=p.deletions;if(N!==null){for(var M=0;M<N.length;M++){var K=N[M];for(ee=K;ee!==null;){var te=ee;switch(te.tag){case 0:case 11:case 15:Wr(8,te,p)}var ue=te.child;if(ue!==null)ue.return=te,ee=ue;else for(;ee!==null;){te=ee;var oe=te.sibling,Be=te.return;if(wo(te),te===K){ee=null;break}if(oe!==null){oe.return=Be,ee=oe;break}ee=Be}}}var Ue=p.alternate;if(Ue!==null){var Ht=Ue.child;if(Ht!==null){Ue.child=null;do{var mi=Ht.sibling;Ht.sibling=null,Ht=mi}while(Ht!==null)}}ee=p}}if(p.subtreeFlags&2064&&P!==null)P.return=p,ee=P;else e:for(;ee!==null;){if(p=ee,p.flags&2048)switch(p.tag){case 0:case 11:case 15:Wr(9,p,p.return)}var O=p.sibling;if(O!==null){O.return=p.return,ee=O;break e}ee=p.return}}var L=t.current;for(ee=L;ee!==null;){P=ee;var U=P.child;if(P.subtreeFlags&2064&&U!==null)U.return=P,ee=U;else e:for(P=L;ee!==null;){if(N=ee,N.flags&2048)try{switch(N.tag){case 0:case 11:case 15:So(9,N)}}catch(re){be(N,N.return,re)}if(N===P){ee=null;break e}var J=N.sibling;if(J!==null){J.return=N.return,ee=J;break e}ee=N.return}}if(_e=d,Hn(),Te&&typeof Te.onPostCommitFiberRoot=="function")try{Te.onPostCommitFiberRoot(to,t)}catch{}a=!0}return a}finally{Me=s,Ye.transition=n}}return!1}function Zl(t,n,s){n=Dr(s,n),n=Aa(t,n,1),bn(t,n),n=Lt(),t=zs(t,1),t!==null&&(xr(t,1,n),Qt(t,n))}function be(t,n,s){if(t.tag===3)Zl(t,t,s);else for(;n!==null;){if(n.tag===3){Zl(n,t,s);break}else if(n.tag===1){var a=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(di===null||!di.has(a))){t=Dr(s,t),t=Na(n,t,1),bn(n,t),t=Lt(),n=zs(n,1),n!==null&&(xr(n,1,t),Qt(n,t));break}}n=n.return}}function cc(t,n,s){var a=t.pingCache;a!==null&&a.delete(n),n=Lt(),t.pingedLanes|=t.suspendedLanes&s,rt===t&&(ht&s)===s&&(st===4||st===3&&(ht&130023424)===ht&&500>je()-No?hi(t,0):ks|=s),Qt(t,n)}function Ya(t,n){n===0&&(t.mode&1?(n=wr,wr<<=1,!(wr&130023424)&&(wr=4194304)):n=1);var s=Lt();t=zs(t,n),t!==null&&(xr(t,n,s),Qt(t,s))}function dc(t){var n=t.memoizedState,s=0;n!==null&&(s=n.retryLane),Ya(t,s)}function Ka(t,n){var s=0;switch(t.tag){case 13:var a=t.stateNode,d=t.memoizedState;d!==null&&(s=d.retryLane);break;case 19:a=t.stateNode;break;default:throw Error(g(314))}a!==null&&a.delete(n),Ya(t,s)}var Xl;Xl=function(t,n,s){if(t!==null)if(t.memoizedProps!==n.pendingProps||Rt.current)Yt=!0;else{if(!(t.lanes&s)&&!(n.flags&128))return Yt=!1,oc(t,n,s);Yt=!!(t.flags&131072)}else Yt=!1,Ze&&n.flags&1048576&&pl(n,Ar,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;t!==null&&(t.alternate=null,n.alternate=null,n.flags|=2),t=n.pendingProps;var d=Pi(n,vt.current);ct(n,s),d=yl(null,n,a,t,d,s);var p=ho();return n.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Bt(a)?(p=!0,js(n)):p=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,lo(n),d.updater=uo,n.stateNode=d,d._reactInternals=n,Ei(n,a,t,s),n=Ll(null,n,a,!0,p,s)):(n.tag=0,Ze&&p&&zt(n),Wt(null,n,d,s),n=n.child),n;case 16:a=n.elementType;e:{switch(t!==null&&(t.alternate=null,n.alternate=null,n.flags|=2),t=n.pendingProps,d=a._init,a=d(a._payload),n.type=a,d=n.tag=Jn(a),t=vn(a,t),d){case 0:n=Tl(null,n,a,t,s);break e;case 1:n=za(null,n,a,t,s);break e;case 11:n=Ca(null,n,a,t,s);break e;case 14:n=ka(null,n,a,vn(a.type,t),s);break e}throw Error(g(306,a,""))}return n;case 0:return a=n.type,d=n.pendingProps,d=n.elementType===a?d:vn(a,d),Tl(t,n,a,d,s);case 1:return a=n.type,d=n.pendingProps,d=n.elementType===a?d:vn(a,d),za(t,n,a,d,s);case 3:e:{if(Oa(n),t===null)throw Error(g(387));a=n.pendingProps,p=n.memoizedState,d=p.element,si(t,n),Er(n,a,null,s);var P=n.memoizedState;if(a=P.element,rn&&p.isDehydrated)if(p={element:a,isDehydrated:!1,cache:P.cache,pendingSuspenseBoundaries:P.pendingSuspenseBoundaries,transitions:P.transitions},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){d=Error(g(423)),n=Kn(t,n,a,s,d);break e}else if(a!==d){d=Error(g(424)),n=Kn(t,n,a,s,d);break e}else for(rn&&(Zt=Wu(n.stateNode.containerInfo),St=n,Ze=!0,kn=null,fs=!1),s=qi(n,null,a,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Ai(),a===d){n=ai(t,n,s);break e}Wt(t,n,a,s)}n=n.child}return n;case 5:return Ji(n),t===null&&Ii(n),a=n.type,d=n.pendingProps,p=t!==null?t.memoizedProps:null,P=d.children,pn(a,d)?P=null:p!==null&&pn(a,p)&&(n.flags|=32),Ma(t,n),Wt(t,n,P,s),n.child;case 6:return t===null&&Ii(n),null;case 13:return Wa(t,n,s);case 4:return vl(n,n.stateNode.containerInfo),a=n.pendingProps,t===null?n.child=Nr(n,null,a,s):Wt(t,n,a,s),n.child;case 11:return a=n.type,d=n.pendingProps,d=n.elementType===a?d:vn(a,d),Ca(t,n,a,d,s);case 7:return Wt(t,n,n.pendingProps,s),n.child;case 8:return Wt(t,n,n.pendingProps.children,s),n.child;case 12:return Wt(t,n,n.pendingProps.children,s),n.child;case 10:e:{if(a=n.type._context,d=n.pendingProps,p=n.memoizedProps,P=d.value,fl(n,a,P),p!==null)if(Tn(p.value,P)){if(p.children===d.children&&!Rt.current){n=ai(t,n,s);break e}}else for(p=n.child,p!==null&&(p.return=n);p!==null;){var N=p.dependencies;if(N!==null){P=p.child;for(var M=N.firstContext;M!==null;){if(M.context===a){if(p.tag===1){M=Sn(-1,s&-s),M.tag=2;var K=p.updateQueue;if(K!==null){K=K.shared;var te=K.pending;te===null?M.next=M:(M.next=te.next,te.next=M),K.pending=M}}p.lanes|=s,M=p.alternate,M!==null&&(M.lanes|=s),oo(p.return,s,n),N.lanes|=s;break}M=M.next}}else if(p.tag===10)P=p.type===n.type?null:p.child;else if(p.tag===18){if(P=p.return,P===null)throw Error(g(341));P.lanes|=s,N=P.alternate,N!==null&&(N.lanes|=s),oo(P,s,n),P=p.sibling}else P=p.child;if(P!==null)P.return=p;else for(P=p;P!==null;){if(P===n){P=null;break}if(p=P.sibling,p!==null){p.return=P.return,P=p;break}P=P.return}p=P}Wt(t,n,d.children,s),n=n.child}return n;case 9:return d=n.type,a=n.pendingProps.children,ct(n,s),d=yn(d),a=a(d),n.flags|=1,Wt(t,n,a,s),n.child;case 14:return a=n.type,d=vn(a,n.pendingProps),d=vn(a.type,d),ka(t,n,a,d,s);case 15:return Ra(t,n,n.type,n.pendingProps,s);case 17:return a=n.type,d=n.pendingProps,d=n.elementType===a?d:vn(a,d),t!==null&&(t.alternate=null,n.alternate=null,n.flags|=2),n.tag=1,Bt(a)?(t=!0,js(n)):t=!1,ct(n,s),gl(n,a,d),Ei(n,a,d,s),Ll(null,n,a,!0,t,s);case 19:return Fa(t,n,s);case 22:return Yn(t,n,s)}throw Error(g(156,n.tag))};function Qa(t,n){return al(t,n)}function Va(t,n,s,a){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(t,n,s,a){return new Va(t,n,s,a)}function Ct(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Jn(t){if(typeof t=="function")return Ct(t)?1:0;if(t!=null){if(t=t.$$typeof,t===F)return 11;if(t===se)return 14}return 2}function zi(t,n){var s=t.alternate;return s===null?(s=dn(t.tag,n,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=n,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&14680064,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,n=t.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s}function ko(t,n,s,a,d,p){var P=2;if(a=t,typeof t=="function")Ct(t)&&(P=1);else if(typeof t=="string")P=5;else e:switch(t){case C:return jn(s.children,d,p,n);case R:P=8,d|=8;break;case D:return t=dn(12,s,n,d|2),t.elementType=D,t.lanes=p,t;case Y:return t=dn(13,s,n,d),t.elementType=Y,t.lanes=p,t;case X:return t=dn(19,s,n,d),t.elementType=X,t.lanes=p,t;case ye:return pi(s,d,p,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case H:P=10;break e;case Z:P=9;break e;case F:P=11;break e;case se:P=14;break e;case j:P=16,a=null;break e}throw Error(g(130,t==null?t:typeof t,""))}return n=dn(P,s,n,d),n.elementType=t,n.type=a,n.lanes=p,n}function jn(t,n,s,a){return t=dn(7,t,a,n),t.lanes=s,t}function pi(t,n,s,a){return t=dn(22,t,a,n),t.elementType=ye,t.lanes=s,t.stateNode={},t}function Ro(t,n,s){return t=dn(6,t,null,n),t.lanes=s,t}function Mo(t,n,s){return n=dn(4,t.children!==null?t.children:[],t.key,n),n.lanes=s,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function fc(t,n,s,a,d){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=bi,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=eo(0),this.expirationTimes=eo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=eo(0),this.identifierPrefix=a,this.onRecoverableError=d,rn&&(this.mutableSourceEagerHydrationData=null)}function Yl(t,n,s,a,d,p,P,N,M){return t=new fc(t,n,s,N,M),n===1?(n=1,p===!0&&(n|=8)):n=0,p=dn(3,null,null,n),t.current=p,p.stateNode=t,p.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},lo(p),t}function ar(t){if(!t)return wi;t=t._reactInternals;e:{if(gt(t)!==t||t.tag!==1)throw Error(g(170));var n=t;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Bt(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(g(171))}if(t.tag===1){var s=t.type;if(Bt(s))return nl(t,s,n)}return n}function Yr(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(g(188)):(t=Object.keys(t).join(","),Error(g(268,t)));return t=It(n),t===null?null:t.stateNode}function qa(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<n?s:n}}function Ds(t,n){qa(t,n),(t=t.alternate)&&qa(t,n)}function Ja(t){return t=It(t),t===null?null:t.stateNode}function zo(){return null}return r.attemptContinuousHydration=function(t){if(t.tag===13){var n=Lt();Et(t,134217728,n),Ds(t,134217728)}},r.attemptDiscreteHydration=function(t){if(t.tag===13){var n=Lt();Et(t,1,n),Ds(t,1)}},r.attemptHydrationAtCurrentPriority=function(t){if(t.tag===13){var n=Lt(),s=ki(t);Et(t,s,n),Ds(t,s)}},r.attemptSynchronousHydration=function(t){switch(t.tag){case 3:var n=t.stateNode;if(n.current.memoizedState.isDehydrated){var s=Fn(n.pendingLanes);s!==0&&(ol(n,s|1),Qt(n,je()),!(_e&6)&&(sr(),Hn()))}break;case 13:var a=Lt();Vt(function(){return Et(t,1,a)}),Ds(t,1)}},r.batchedUpdates=function(t,n){var s=_e;_e|=1;try{return t(n)}finally{_e=s,_e===0&&(sr(),no&&Hn())}},r.createComponentSelector=function(t){return{$$typeof:ir,value:t}},r.createContainer=function(t,n,s,a,d,p,P){return Yl(t,n,!1,null,s,a,d,p,P)},r.createHasPseudoClassSelector=function(t){return{$$typeof:Qn,value:t}},r.createHydrationContainer=function(t,n,s,a,d,p,P,N,M){return t=Yl(s,a,!0,t,d,p,P,N,M),t.context=ar(null),s=t.current,a=Lt(),d=ki(s),p=Sn(a,d),p.callback=n??null,bn(s,p),t.current.lanes=d,xr(t,d,a),Qt(t,a),t},r.createPortal=function(t,n,s){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_,key:a==null?null:""+a,children:t,containerInfo:n,implementation:s}},r.createRoleSelector=function(t){return{$$typeof:Ts,value:t}},r.createTestNameSelector=function(t){return{$$typeof:ft,value:t}},r.createTextSelector=function(t){return{$$typeof:Ur,value:t}},r.deferredUpdates=function(t){var n=Me,s=Ye.transition;try{return Ye.transition=null,Me=16,t()}finally{Me=n,Ye.transition=s}},r.discreteUpdates=function(t,n,s,a,d){var p=Me,P=Ye.transition;try{return Ye.transition=null,Me=1,t(n,s,a,d)}finally{Me=p,Ye.transition=P,_e===0&&sr()}},r.findAllNodes=rr,r.findBoundingRects=function(t,n){if(!ii)throw Error(g(363));n=rr(t,n),t=[];for(var s=0;s<n.length;s++)t.push(es(n[s]));for(n=t.length-1;0<n;n--){s=t[n];for(var a=s.x,d=a+s.width,p=s.y,P=p+s.height,N=n-1;0<=N;N--)if(n!==N){var M=t[N],K=M.x,te=K+M.width,ue=M.y,oe=ue+M.height;if(a>=K&&p>=ue&&d<=te&&P<=oe){t.splice(n,1);break}else if(a!==K||s.width!==M.width||oe<p||ue>P){if(!(p!==ue||s.height!==M.height||te<a||K>d)){K>a&&(M.width+=K-a,M.x=a),te<d&&(M.width=d-K),t.splice(n,1);break}}else{ue>p&&(M.height+=ue-p,M.y=p),oe<P&&(M.height=P-ue),t.splice(n,1);break}}}return t},r.findHostInstance=Yr,r.findHostInstanceWithNoPortals=function(t){return t=en(t),t=t!==null?tn(t):null,t===null?null:t.stateNode},r.findHostInstanceWithWarning=function(t){return Yr(t)},r.flushControlled=function(t){var n=_e;_e|=1;var s=Ye.transition,a=Me;try{Ye.transition=null,Me=1,t()}finally{Me=a,Ye.transition=s,_e=n,_e===0&&(sr(),Hn())}},r.flushPassiveEffects=Mi,r.flushSync=Vt,r.focusWithin=function(t,n){if(!ii)throw Error(g(363));for(t=zl(t),n=Ba(t,n),n=Array.from(n),t=0;t<n.length;){var s=n[t++];if(!ts(s)){if(s.tag===5&&Nu(s.stateNode))return!0;for(s=s.child;s!==null;)n.push(s),s=s.sibling}}return!1},r.getCurrentUpdatePriority=function(){return Me},r.getFindAllNodesFailureDescription=function(t,n){if(!ii)throw Error(g(363));var s=0,a=[];t=[zl(t),0];for(var d=0;d<t.length;){var p=t[d++],P=t[d++],N=n[P];if((p.tag!==5||!ts(p))&&(Ol(p,N)&&(a.push(Cs(N)),P++,P>s&&(s=P)),P<n.length))for(p=p.child;p!==null;)t.push(p,P),p=p.sibling}if(s<n.length){for(t=[];s<n.length;s++)t.push(Cs(n[s]));return`findAllNodes was able to match part of the selector:
51
+ `+(a.join(" > ")+`
52
+
53
+ No matching component was found for:
54
+ `)+t.join(" > ")}return null},r.getPublicRootInstance=function(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return mt(t.child.stateNode);default:return t.child.stateNode}},r.injectIntoDevTools=function(t){if(t={bundleType:t.bundleType,version:t.version,rendererPackageName:t.rendererPackageName,rendererConfig:t.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:v.ReactCurrentDispatcher,findHostInstanceByFiber:Ja,findFiberByHostInstance:t.findFiberByHostInstance||zo,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.1.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")t=!1;else{var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled||!n.supportsFiber)t=!0;else{try{to=n.inject(t),Te=n}catch{}t=!!n.checkDCE}}return t},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(t,n,s,a){if(!ii)throw Error(g(363));t=rr(t,n);var d=is(t,s,a).disconnect;return{disconnect:function(){d()}}},r.registerMutableSourceForHydration=function(t,n){var s=n._getVersion;s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s)},r.runWithPriority=function(t,n){var s=Me;try{return Me=t,n()}finally{Me=s}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(t,n,s,a){var d=n.current,p=Lt(),P=ki(d);return s=ar(s),n.context===null?n.context=s:n.pendingContext=s,n=Sn(p,P),n.payload={element:t},a=a===void 0?null:a,a!==null&&(n.callback=a),bn(d,n),t=Et(d,P,p),t!==null&&We(t,d,P),P},r};$d.exports=ev;var tv=$d.exports;const nv=_u(tv);class iv{constructor(c,r,l){E(this,"instance");E(this,"reconciler");E(this,"serializer");E(this,"renderer");E(this,"root");this.instance=c,this.reconciler=r,this.serializer=l,this.renderer=null}init(){this.renderer=nv(this.reconciler.getConfig()),this.root=this.renderer.createContainer(this.instance,0,null,!0,null,"",c=>{console.error(c)},null),this.root.onUncaughtError=function(c){console.error(c)}}render(c){var u,h,g,v;const r=JSON.parse(JSON.stringify(this.instance.getStore().getState()));if(!((u=r==null?void 0:r.weave)!=null&&u.key)||!((h=r==null?void 0:r.weave)!=null&&h.type)||!((g=r==null?void 0:r.weave)!=null&&g.props))return;const l=this.serializer.deserialize(r.weave);(v=this.renderer)==null||v.updateContainer(l,this.root,null,c)}}class rv{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("groups-manager"),this.logger.debug("Groups manager created")}allNodesInSameParent(c){var v,S,_;const r=this.instance.getStage();if(c.length===0)return{allInSame:!1,nodeId:void 0,parentId:void 0};let l=!0;const u=r.findOne(`#${c[0].props.id}`),h=(v=u==null?void 0:u.getParent())==null?void 0:v.getAttrs().id,g=(S=u==null?void 0:u.getParent())==null?void 0:S.getAttrs().nodeId;for(const C of c){const R=r.findOne(`#${C.props.id}`);if(((_=R==null?void 0:R.getParent())==null?void 0:_.getAttrs().id)!==h){l=!1;break}}return{allInSame:l,nodeId:g,parentId:h}}group(c){this.logger.debug({nodes:c},"Grouping nodes");const r=this.instance.getStage(),l=this.instance.getStore().getState(),u=this.instance.getMainLayer();if(jt.isEmpty(l.weave)){this.logger.warn({nodes:c},"State is empty, cannot group nodes");return}const{allInSame:h,nodeId:g,parentId:v}=this.allNodesInSameParent(c);if(!h){this.logger.warn({nodes:c},"Not all nodes are in the same container, cannot group them");return}const S=this.instance.getPlugin("nodesSelection");S&&(S.getTransformer().hide(),S.setSelectedNodes([]));let _=v??wu;typeof _>"u"&&(_=wu);const C=r.findOne(`#${_}`),R=et(),D=new ne.Group({id:et(),nodeType:"group",draggable:!0});C==null||C.add(D);const Z=this.instance.getNodeHandler("group").createNode(R,{draggable:!0});this.instance.addNode(Z,g??_);const F=c.map(X=>{const se=u==null?void 0:u.findOne(`#${X.key}`);return{node:X,zIndex:(se==null?void 0:se.zIndex())??-1}}).filter(X=>X.zIndex!==-1),Y=jt.orderBy(F,["zIndex"],["asc"]).map(X=>X.node);for(const[X,se]of Y.entries()){if(se.type==="group"){const ye=se,we=u==null?void 0:u.findOne(`#${ye.key}`);if(we){const xe=we.getAbsolutePosition(),Ie=we.getAbsoluteRotation();we.moveTo(D),we.setAbsolutePosition(xe),we.rotation(Ie),we.zIndex(X),we.setAttr("id",et()),we.setAttr("draggable",!1);const gt=this.instance.getNodeHandler("group").toNode(we);this.instance.addNode(gt,R)}continue}const j=u==null?void 0:u.findOne(`#${se.key}`);if(j){const ye=j.getAbsolutePosition(),we=j.getAbsoluteRotation();j.moveTo(D),j.setAbsolutePosition(ye),j.rotation(we),j.zIndex(X),j.setAttr("id",et()),j.setAttr("draggable",!1);const Ie=this.instance.getNodeHandler(j.getAttrs().nodeType).toNode(j);this.instance.addNode(Ie,R)}}this.instance.removeNodes(Y),D.destroy(),setTimeout(()=>{const X=r.findOne(`#${R}`),se=this.instance.getPlugin("nodesSelection");if(X&&se){const j=se.getTransformer();se.setSelectedNodes([X]),j.show(),j.forceUpdate()}},0)}unGroup(c){var R,D,H;this.logger.warn({group:c},"Un-grouping group");const l=this.instance.getStage().findOne(`#${c.props.id}`);if(!l){this.logger.warn({group:c},"Group instance doesn't exists, cannot un-group");return}let u,h=this.instance.getMainLayer();if(l.getParent()&&l.getParent()instanceof ne.Group&&((R=l.getParent())!=null&&R.getAttrs().nodeId)&&(u=(D=l.getParent())==null?void 0:D.getAttrs().nodeId,h=l.getParent()),l.getParent()&&l.getParent()instanceof ne.Group&&!((H=l.getParent())!=null&&H.getAttrs().nodeId)&&(h=l.getParent()),l.getParent()&&l.getParent()instanceof ne.Layer&&(h=l.getParent()),!h){this.logger.warn({group:c},"Group target container doesn't exists, cannot un-group");return}const g=(h==null?void 0:h.getChildren().length)??0;let v;const S=[...l.getChildren()];for(const Z of S){const F=Z.getAbsolutePosition(),Y=Z.getAbsoluteRotation();Z.moveTo(h),Z.setAbsolutePosition(F),Z.rotation(Y),Z.zIndex(g-1+Z.zIndex()),Z.setAttr("id",et()),Z.setAttr("draggable",!0),v=Z.getAttrs().id;const se=this.instance.getNodeHandler(Z.getAttrs().nodeType).toNode(Z);this.instance.addNode(se,u??h.getAttrs().id),Z.destroy()}const C=this.instance.getNodeHandler("group").toNode(l);this.instance.removeNode(C),setTimeout(()=>{const Z=h.findOne(`#${v}`),F=this.instance.getPlugin("nodesSelection");Z&&F&&F.setSelectedNodes([Z])},0)}}var Eu={exports:{}};function sv(x){try{return JSON.stringify(x)}catch{return'"[Circular]"'}}var ov=lv;function lv(x,c,r){var l=r&&r.stringify||sv,u=1;if(typeof x=="object"&&x!==null){var h=c.length+u;if(h===1)return x;var g=new Array(h);g[0]=l(x);for(var v=1;v<h;v++)g[v]=l(c[v]);return g.join(" ")}if(typeof x!="string")return x;var S=c.length;if(S===0)return x;for(var _="",C=1-u,R=-1,D=x&&x.length||0,H=0;H<D;){if(x.charCodeAt(H)===37&&H+1<D){switch(R=R>-1?R:0,x.charCodeAt(H+1)){case 100:case 102:if(C>=S||c[C]==null)break;R<H&&(_+=x.slice(R,H)),_+=Number(c[C]),R=H+2,H++;break;case 105:if(C>=S||c[C]==null)break;R<H&&(_+=x.slice(R,H)),_+=Math.floor(Number(c[C])),R=H+2,H++;break;case 79:case 111:case 106:if(C>=S||c[C]===void 0)break;R<H&&(_+=x.slice(R,H));var Z=typeof c[C];if(Z==="string"){_+="'"+c[C]+"'",R=H+2,H++;break}if(Z==="function"){_+=c[C].name||"<anonymous>",R=H+2,H++;break}_+=l(c[C]),R=H+2,H++;break;case 115:if(C>=S)break;R<H&&(_+=x.slice(R,H)),_+=String(c[C]),R=H+2,H++;break;case 37:R<H&&(_+=x.slice(R,H)),_+="%",R=H+2,H++,C--;break}++C}++H}return R===-1?x:(R<D&&(_+=x.slice(R)),_)}const Yd=ov;Eu.exports=pr;const $l=Pv().console||{},av={mapHttpRequest:du,mapHttpResponse:du,wrapRequestSerializer:Uc,wrapResponseSerializer:Uc,wrapErrorSerializer:Uc,req:du,res:du,err:Qd,errWithCause:Qd};function Jr(x,c){return x==="silent"?1/0:c.levels.values[x]}const Gc=Symbol("pino.logFuncs"),Fc=Symbol("pino.hierarchy"),uv={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Kd(x,c){const r={logger:c,parent:x[Fc]};c[Fc]=r}function cv(x,c,r){const l={};c.forEach(u=>{l[u]=r[u]?r[u]:$l[u]||$l[uv[u]||"log"]||Bo}),x[Gc]=l}function dv(x,c){return Array.isArray(x)?x.filter(function(l){return l!=="!stdSerializers.err"}):x===!0?Object.keys(c):!1}function pr(x){x=x||{},x.browser=x.browser||{};const c=x.browser.transmit;if(c&&typeof c.send!="function")throw Error("pino: transmit option must have a send function");const r=x.browser.write||$l;x.browser.write&&(x.browser.asObject=!0);const l=x.serializers||{},u=dv(x.browser.serialize,l);let h=x.browser.serialize;Array.isArray(x.browser.serialize)&&x.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const g=Object.keys(x.customLevels||{}),v=["error","fatal","warn","info","debug","trace"].concat(g);typeof r=="function"&&v.forEach(function(F){r[F]=r}),(x.enabled===!1||x.browser.disabled)&&(x.level="silent");const S=x.level||"info",_=Object.create(r);_.log||(_.log=Bo),cv(_,v,r),Kd({},_),Object.defineProperty(_,"levelVal",{get:R}),Object.defineProperty(_,"level",{get:D,set:H});const C={transmit:c,serialize:u,asObject:x.browser.asObject,formatters:x.browser.formatters,levels:v,timestamp:Sv(x),messageKey:x.messageKey||"msg",onChild:x.onChild||Bo};_.levels=fv(x),_.level=S,_.setMaxListeners=_.getMaxListeners=_.emit=_.addListener=_.on=_.prependListener=_.once=_.prependOnceListener=_.removeListener=_.removeAllListeners=_.listeners=_.listenerCount=_.eventNames=_.write=_.flush=Bo,_.serializers=l,_._serialize=u,_._stdErrSerialize=h,_.child=function(...F){return Z.call(this,C,...F)},c&&(_._logEvent=Hc());function R(){return Jr(this.level,this)}function D(){return this._level}function H(F){if(F!=="silent"&&!this.levels.values[F])throw Error("unknown level "+F);this._level=F,Fs(this,C,_,"error"),Fs(this,C,_,"fatal"),Fs(this,C,_,"warn"),Fs(this,C,_,"info"),Fs(this,C,_,"debug"),Fs(this,C,_,"trace"),g.forEach(Y=>{Fs(this,C,_,Y)})}function Z(F,Y,X){if(!Y)throw new Error("missing bindings for child Pino");X=X||{},u&&Y.serializers&&(X.serializers=Y.serializers);const se=X.serializers;if(u&&se){var j=Object.assign({},l,se),ye=x.browser.serialize===!0?Object.keys(j):u;delete Y.serializers,Zc([Y],ye,j,this._stdErrSerialize)}function we(Ie){this._childLevel=(Ie._childLevel|0)+1,this.bindings=Y,j&&(this.serializers=j,this._serialize=ye),c&&(this._logEvent=Hc([].concat(Ie._logEvent.bindings,Y)))}we.prototype=this;const xe=new we(this);return Kd(this,xe),xe.child=function(...Ie){return Z.call(this,F,...Ie)},xe.level=X.level||this.level,F.onChild(xe),xe}return _}function fv(x){const c=x.customLevels||{},r=Object.assign({},pr.levels.values,c),l=Object.assign({},pr.levels.labels,hv(c));return{values:r,labels:l}}function hv(x){const c={};return Object.keys(x).forEach(function(r){c[x[r]]=r}),c}pr.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};pr.stdSerializers=av;pr.stdTimeFunctions=Object.assign({},{nullTime:ef,epochTime:tf,unixTime:wv,isoTime:xv});function gv(x){const c=[];x.bindings&&c.push(x.bindings);let r=x[Fc];for(;r.parent;)r=r.parent,r.logger.bindings&&c.push(r.logger.bindings);return c.reverse()}function Fs(x,c,r,l){if(Object.defineProperty(x,l,{value:Jr(x.level,r)>Jr(l,r)?Bo:r[Gc][l],writable:!0,enumerable:!0,configurable:!0}),x[l]===Bo){if(!c.transmit)return;const h=c.transmit.level||x.level,g=Jr(h,r);if(Jr(l,r)<g)return}x[l]=mv(x,c,r,l);const u=gv(x);u.length!==0&&(x[l]=pv(u,x[l]))}function pv(x,c){return function(){return c.apply(this,[...x,...arguments])}}function mv(x,c,r,l){return function(u){return function(){const g=c.timestamp(),v=new Array(arguments.length),S=Object.getPrototypeOf&&Object.getPrototypeOf(this)===$l?$l:this;for(var _=0;_<v.length;_++)v[_]=arguments[_];var C=!1;if(c.serialize&&(Zc(v,this._serialize,this.serializers,this._stdErrSerialize),C=!0),c.asObject||c.formatters?u.call(S,vv(this,l,v,g,c)):u.apply(S,v),c.transmit){const R=c.transmit.level||x._level,D=Jr(R,r),H=Jr(l,r);if(H<D)return;yv(this,{ts:g,methodLevel:l,methodValue:H,transmitValue:r.levels.values[c.transmit.level||x._level],send:c.transmit.send,val:Jr(x._level,r)},v,C)}}}(x[Gc][l])}function vv(x,c,r,l,u){const{level:h,log:g=D=>D}=u.formatters||{},v=r.slice();let S=v[0];const _={};if(l&&(_.time=l),h){const D=h(c,x.levels.values[c]);Object.assign(_,D)}else _.level=x.levels.values[c];let C=(x._childLevel|0)+1;if(C<1&&(C=1),S!==null&&typeof S=="object"){for(;C--&&typeof v[0]=="object";)Object.assign(_,v.shift());S=v.length?Yd(v.shift(),v):void 0}else typeof S=="string"&&(S=Yd(v.shift(),v));return S!==void 0&&(_[u.messageKey]=S),g(_)}function Zc(x,c,r,l){for(const u in x)if(l&&x[u]instanceof Error)x[u]=pr.stdSerializers.err(x[u]);else if(typeof x[u]=="object"&&!Array.isArray(x[u])&&c)for(const h in x[u])c.indexOf(h)>-1&&h in r&&(x[u][h]=r[h](x[u][h]))}function yv(x,c,r,l=!1){const u=c.send,h=c.ts,g=c.methodLevel,v=c.methodValue,S=c.val,_=x._logEvent.bindings;l||Zc(r,x._serialize||Object.keys(x.serializers),x.serializers,x._stdErrSerialize===void 0?!0:x._stdErrSerialize),x._logEvent.ts=h,x._logEvent.messages=r.filter(function(C){return _.indexOf(C)===-1}),x._logEvent.level.label=g,x._logEvent.level.value=v,u(g,x._logEvent,S),x._logEvent=Hc(_)}function Hc(x){return{ts:0,messages:[],bindings:x||[],level:{label:"",value:0}}}function Qd(x){const c={type:x.constructor.name,msg:x.message,stack:x.stack};for(const r in x)c[r]===void 0&&(c[r]=x[r]);return c}function Sv(x){return typeof x.timestamp=="function"?x.timestamp:x.timestamp===!1?ef:tf}function du(){return{}}function Uc(x){return x}function Bo(){}function ef(){return!1}function tf(){return Date.now()}function wv(){return Math.round(Date.now()/1e3)}function xv(){return new Date(Date.now()).toISOString()}function Pv(){function x(c){return typeof c<"u"&&c}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return x(self)||x(window)||x(this)||{}}}Eu.exports.default=pr;Eu.exports.pino=pr;var _v=Eu.exports;const Ev=_u(_v);class Iv{constructor(c){E(this,"config");E(this,"disabled");E(this,"logger");this.config=c,this.disabled=this.config.disabled??!1,this.logger=Ev({name:"weave.js",level:this.config.level??"error",browser:{write:{warn:r=>{this.log(console.warn,"WARN",r,{textColor:"white",bgColor:"yellow"})},debug:r=>{this.log(console.debug,"DEBUG",r,{textColor:"white",bgColor:"pink"})},info:r=>{this.log(console.info,"INFO",r,{textColor:"white",bgColor:"blue"})},error:r=>{this.log(console.error,"ERROR",r,{textColor:"white",bgColor:"red"})},trace:r=>{this.log(console.trace,"TRACE",r,{textColor:"white",bgColor:"green"})}},disabled:this.disabled}})}log(c,r,l,{textColor:u,bgColor:h}){const{name:g,msg:v,time:S,..._}=l,C={..._};delete C.level;const R=new Date(S),D=[`%cWEAVE.JS%c %c[${r}]%c %c[${g}]%c %c${R.toISOString()}%c
55
+ %s`,"color: black; font-weight: bold; padding: 2px","color: black;",`color: ${u}; background: ${h}; padding: 2px`,"color: black;","color: white; background: black; padding: 2px","color: black;","color: white; background: black; padding: 2px","color: black; margin-top: 2px",v];jt.isEqual(C,{})||D.push(C),c(...D)}getDisabled(){return this.disabled}getLevel(){return this.logger.level}getLogger(){return this.logger}getChildLogger(c){return this.logger.child({name:c})}}class Av{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("targeting-manager"),this.logger.debug("Targeting manager created")}getMousePointer(c){this.logger.debug({point:c},"getMousePointer");const r=this.instance.getStage(),l=this.instance.getMainLayer();let u=c||(r.getPointerPosition()??{x:0,y:0}),h=l,g=l;const v=r.getIntersection(u);if(v){const S=this.instance.getInstanceRecursive(v,["group"]);let _=null;S.getParent()&&(_=this.instance.getInstanceRecursive(S.getParent(),["group"])),S&&S instanceof ne.Group&&S.getAttrs().containerId&&(h=S.findOne(`#${S.getAttrs().containerId}`),g=S),_&&_ instanceof ne.Group&&_.getAttrs().containerId&&(h=_.findOne(`#${_.getAttrs().containerId}`),g=_)}return(g==null?void 0:g.getAttrs().nodeType)!=="layer"&&(u=(h==null?void 0:h.getRelativePointerPosition())??u),(g==null?void 0:g.getAttrs().nodeType)==="layer"&&(u=(h==null?void 0:h.getRelativePointerPosition())??{x:0,y:0}),{mousePoint:u,container:g,measureContainer:h}}getMousePointerRelativeToContainer(c){return{mousePoint:c.getRelativePointerPosition()??{x:0,y:0},container:c}}}class Nv{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("cloning-manager"),this.logger.debug("Cloning manager created")}allInstancesInSameParent(c){var h,g,v,S,_;if(c.length===0)return{allInSame:!1,nodeId:void 0,parentId:void 0};let r=!0;const l=(g=(h=c[0])==null?void 0:h.getParent())==null?void 0:g.getAttrs().id,u=(S=(v=c[0])==null?void 0:v.getParent())==null?void 0:S.getAttrs().nodeId;for(const C of c)if(((_=C==null?void 0:C.getParent())==null?void 0:_.getAttrs().id)!==l){r=!1;break}return{allInSame:r,nodeId:u,parentId:l}}nodesToGroupSerialized(c){if(c.length===0)return;const{allInSame:r}=this.allInstancesInSameParent(c);if(!r)return;const l=et(),u=new ne.Group({id:l}),h=c.map(_=>({node:_,zIndex:_.zIndex()})).filter(_=>_.zIndex!==-1),g=jt.orderBy(h,["zIndex"],["asc"]).map(_=>_.node);for(const[_,C]of g.entries()){if(C.getAttrs().type==="group"){const F=C.clone({id:et(),type:"group"}),Y=F.getAbsolutePosition(),X=F.getAbsoluteRotation();F.moveTo(u),F.zIndex(_),F.setAbsolutePosition(Y),F.rotation(X);continue}const D=C.clone({id:et()}),H=D.getAbsolutePosition(),Z=D.getAbsoluteRotation();D.moveTo(u),D.zIndex(_),D.setAbsolutePosition(H),D.rotation(Z)}const v={x:1/0,y:1/0},S=[];return u.getChildren().forEach(_=>{const C=this.instance.getNodeHandler(_.getAttrs().nodeType);(_.x()<v.x||_.y()<v.y)&&(v.x=_.x(),v.y=_.y());const R=C.toNode(_);S.push(R)}),u.destroy(),{serializedNodes:S,minPoint:v}}cloneNodes(c,r,l){if(c.length===0||!r)return;const{allInSame:u}=this.allInstancesInSameParent(c);if(!u)return;const h=et(),g=new ne.Group({id:h});r.add(g);const v=c.map(R=>({node:R,zIndex:R.zIndex()})).filter(R=>R.zIndex!==-1),S=jt.orderBy(v,["zIndex"],["asc"]).map(R=>R.node);for(const[R,D]of S.entries()){if(D.getAttrs().type==="group"){const X=D.clone({id:et(),type:"group"}),se=X.getAbsolutePosition(),j=X.getAbsoluteRotation();X.moveTo(g),X.zIndex(R),X.setAbsolutePosition(se),X.rotation(j);continue}const Z=D.clone({id:et()}),F=Z.getAbsolutePosition(),Y=Z.getAbsoluteRotation();Z.moveTo(g),Z.zIndex(R),Z.setAbsolutePosition(F),Z.rotation(Y)}const _=g.getClientRect({relativeTo:r});g.x(l.x-_.x),g.y(l.y-_.y);const C=[...g.getChildren()];for(const[R,D]of C.entries()){const H=D.getAbsolutePosition(),Z=D.getAbsoluteRotation();D.moveTo(r),D.zIndex(R),D.setAbsolutePosition(H),D.rotation(Z);const Y=this.instance.getNodeHandler(D.getAttrs().nodeType).toNode(D);this.instance.addNode(Y,r.getAttrs().id),D.destroy()}g.destroy()}}var nf={exports:{}};(function(x){(function(){function c(F,Y){document.addEventListener?F.addEventListener("scroll",Y,!1):F.attachEvent("scroll",Y)}function r(F){document.body?F():document.addEventListener?document.addEventListener("DOMContentLoaded",function Y(){document.removeEventListener("DOMContentLoaded",Y),F()}):document.attachEvent("onreadystatechange",function Y(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",Y),F())})}function l(F){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(F)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function u(F,Y){F.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+Y+";"}function h(F){var Y=F.g.offsetWidth,X=Y+100;return F.j.style.width=X+"px",F.i.scrollLeft=X,F.h.scrollLeft=F.h.scrollWidth+100,F.l!==Y?(F.l=Y,!0):!1}function g(F,Y){function X(){var j=se;h(j)&&j.g.parentNode!==null&&Y(j.l)}var se=F;c(F.h,X),c(F.i,X),h(F)}function v(F,Y,X){Y=Y||{},X=X||window,this.family=F,this.style=Y.style||"normal",this.weight=Y.weight||"normal",this.stretch=Y.stretch||"normal",this.context=X}var S=null,_=null,C=null,R=null;function D(F){return _===null&&(H(F)&&/Apple/.test(window.navigator.vendor)?(F=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),_=!!F&&603>parseInt(F[1],10)):_=!1),_}function H(F){return R===null&&(R=!!F.document.fonts),R}function Z(F,Y){var X=F.style,se=F.weight;if(C===null){var j=document.createElement("div");try{j.style.font="condensed 100px sans-serif"}catch{}C=j.style.font!==""}return[X,se,C?F.stretch:"","100px",Y].join(" ")}v.prototype.load=function(F,Y){var X=this,se=F||"BESbswy",j=0,ye=Y||3e3,we=new Date().getTime();return new Promise(function(xe,Ie){if(H(X.context)&&!D(X.context)){var at=new Promise(function($t,en){function It(){new Date().getTime()-we>=ye?en(Error(""+ye+"ms timeout exceeded")):X.context.document.fonts.load(Z(X,'"'+X.family+'"'),se).then(function(pt){1<=pt.length?$t():setTimeout(It,25)},en)}It()}),gt=new Promise(function($t,en){j=setTimeout(function(){en(Error(""+ye+"ms timeout exceeded"))},ye)});Promise.race([gt,at]).then(function(){clearTimeout(j),xe(X)},Ie)}else r(function(){function $t(){var pe;(pe=At!=-1&&mt!=-1||At!=-1&&ut!=-1||mt!=-1&&ut!=-1)&&((pe=At!=mt&&At!=ut&&mt!=ut)||(S===null&&(pe=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),S=!!pe&&(536>parseInt(pe[1],10)||parseInt(pe[1],10)===536&&11>=parseInt(pe[2],10))),pe=S&&(At==V&&mt==V&&ut==V||At==le&&mt==le&&ut==le||At==ae&&mt==ae&&ut==ae)),pe=!pe),pe&&(ge.parentNode!==null&&ge.parentNode.removeChild(ge),clearTimeout(j),xe(X))}function en(){if(new Date().getTime()-we>=ye)ge.parentNode!==null&&ge.parentNode.removeChild(ge),Ie(Error(""+ye+"ms timeout exceeded"));else{var pe=X.context.document.hidden;(pe===!0||pe===void 0)&&(At=It.g.offsetWidth,mt=pt.g.offsetWidth,ut=tn.g.offsetWidth,$t()),j=setTimeout(en,50)}}var It=new l(se),pt=new l(se),tn=new l(se),At=-1,mt=-1,ut=-1,V=-1,le=-1,ae=-1,ge=document.createElement("div");ge.dir="ltr",u(It,Z(X,"sans-serif")),u(pt,Z(X,"serif")),u(tn,Z(X,"monospace")),ge.appendChild(It.g),ge.appendChild(pt.g),ge.appendChild(tn.g),X.context.document.body.appendChild(ge),V=It.g.offsetWidth,le=pt.g.offsetWidth,ae=tn.g.offsetWidth,en(),g(It,function(pe){At=pe,$t()}),u(It,Z(X,'"'+X.family+'",sans-serif')),g(pt,function(pe){mt=pe,$t()}),u(pt,Z(X,'"'+X.family+'",serif')),g(tn,function(pe){ut=pe,$t()}),u(tn,Z(X,'"'+X.family+'",monospace'))})})},x.exports=v})()})(nf);var Tv=nf.exports;const Lv=_u(Tv);class Cv{constructor(c){E(this,"instance");E(this,"logger");E(this,"loadedFonts",[]);this.instance=c,this.logger=this.instance.getChildLogger("fonts-manager"),this.logger.debug("Fonts manager created")}async loadFont(c,r){return new Promise(l=>{this.logger.debug(`Loading font with id [${c.id}]`),r.load().then(()=>{this.logger.debug(`Font with id [${c.id}] loaded`),this.loadedFonts.push(c),l()}).catch(()=>{this.logger.debug(`Font with id [${c.id}] failed to load`),l()})})}async loadFonts(){var c;if(this.logger.info("Loading fonts"),this.instance.getConfiguration().fonts){const r=[];for(const l of((c=this.instance.getConfiguration())==null?void 0:c.fonts)??[]){const u=new Lv(l.id);r.push(this.loadFont(l,u))}await Promise.allSettled(r)}this.logger.info("Fonts loaded"),this.instance.emitEvent("weaveFontsLoaded",{})}getFonts(){return this.loadedFonts}}class kv{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("zindex-manager"),this.logger.debug("zIndex manager created")}moveUp(c){this.logger.debug(`Moving instance with id [${c.getAttrs().id}], up one step of z-index`),c.moveUp();const l=this.instance.getNodeHandler(c.getAttrs().nodeType).toNode(c);this.instance.moveNode(l,qr.UP)}moveDown(c){this.logger.debug(`Moving instance with id [${c.getAttrs().id}], down one step of z-index`),c.moveDown();const l=this.instance.getNodeHandler(c.getAttrs().nodeType).toNode(c);this.instance.moveNode(l,qr.DOWN)}sendToBack(c){this.logger.debug(`Moving instance with id [${c.getAttrs().id}], to bottom of z-index`),c.moveToBottom();const l=this.instance.getNodeHandler(c.getAttrs().nodeType).toNode(c);this.instance.moveNode(l,qr.BACK)}bringToFront(c){this.logger.debug(`Moving instance with id [${c.getAttrs().id}], to top of z-index`),c.moveToTop();const l=this.instance.getNodeHandler(c.getAttrs().nodeType).toNode(c);this.instance.updateNode(l),this.instance.moveNode(l,qr.FRONT)}}class Rv{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("state-manager"),this.logger.debug("State manager created")}getInstanceRecursive(c,r=[]){var u,h;const l=c.getAttrs();return c.getParent()&&((u=c.getParent())!=null&&u.getAttrs().nodeType)&&!["stage","layer",...r].includes((h=c.getParent())==null?void 0:h.getAttrs().nodeType)?this.getInstanceRecursive(c.getParent()):l.id==="mainLayer"?this.instance.getMainLayer():l.id==="stage"?this.instance.getMainLayer():c}findNodeById(c,r,l=null,u=-1){let h={node:null,parent:l,index:u};return c.key===r?{node:c,parent:l,index:u}:(Array.isArray(c.props.children)&&c.props.children.length>0&&c.props.children.some((g,v)=>(h=this.findNodeById(g,r,c,v),h.node)),h)}findNodesByType(c,r){var u;const l=[];return c.type===r?(l.push(c),l):((u=c.props)!=null&&u.children&&c.props.children.length>0&&c.props.children.some(h=>{l.push(...this.findNodesByType(h,r))}),l)}getNode(c){const r=this.instance.getStore().getState().weave;return jt.isEmpty(r)?{node:null,parent:null,index:-1}:this.findNodeById(r,c)}addNode(c,r="mainLayer",l=void 0,u=!0){const h=this.instance.getStore().getUser().name;this.instance.getStore().getDocument().transact(()=>{const g=this.instance.getStore().getState();if(jt.isEmpty(g.weave)){this.logger.warn({node:c,parentId:r,doRender:u},"State is empty, cannot add the node");return}const{node:v}=this.findNodeById(g.weave,c.key);if(v){const _=`Node with key [${c.key}] already exists, cannot add it`;this.logger.warn({node:c,parentId:r,doRender:u},_);return}const{node:S}=this.findNodeById(g.weave,r);if(!S){const _=`Parent container with key [${c.key}] doesn't exists, cannot add it`;this.logger.warn({node:c,parentId:r,doRender:u},_);return}if((!S.props.children||typeof S.props.children>"u")&&(S.props.children=[]),l){let _=JSON.parse(JSON.stringify([...S.props.children]));_.splice(l,0,c),_=_.map((C,R)=>({...C,props:{...C.props,zIndex:R}})),S.props.children=_}else{const _=S.props.children.length,C={...c,props:{...c.props,zIndex:_}};S.props.children.push(C)}u&&this.instance.render()},h)}updateNode(c,r=!0){const l=this.instance.getStore().getUser().name;this.instance.getStore().getDocument().transact(()=>{const u=this.instance.getStore().getState();if(jt.isEmpty(u.weave)){this.logger.warn({node:c,doRender:r},"State is empty, cannot update the node");return}const{node:h}=this.findNodeById(u.weave,c.key);if(!h){const v=`Node with key [${c.key}] doesn't exists, cannot update it`;this.logger.warn({node:c,doRender:r},v);return}const g=JSON.parse(JSON.stringify({...h.props,...c.props}));h.props={...g},r&&this.instance.render()},l)}removeNode(c,r=!0){const l=this.instance.getStore().getUser().name;this.instance.getStore().getDocument().transact(()=>{const u=this.instance.getStore().getState();if(jt.isEmpty(u.weave)){this.logger.warn({node:c,doRender:r},"State is empty, cannot update the node");return}const{node:h,parent:g}=this.findNodeById(u.weave,c.key);if(!h){const v=`Node with key [${c.key}] doesn't exists, cannot remove it`;this.logger.warn({node:c,doRender:r},v);return}if(g){const S=JSON.parse(JSON.stringify(g.props.children)).filter(_=>_.key!==c.key);g.props.children=S}r&&this.instance.render()},l)}removeNodes(c,r=!0){for(const l of c)this.removeNode(l,!1);r&&this.instance.render()}moveNode(c,r,l=!0){const u=this.instance.getStore().getUser().name;this.instance.getStore().getDocument().transact(()=>{const h=this.instance.getStore().getState();if(jt.isEmpty(h.weave)){this.logger.warn({node:c,doRender:l},"State is empty, cannot update the node");return}const{node:g,parent:v}=this.findNodeById(h.weave,c.key);if(!g){const S=`Node with key [${c.key}] doesn't exists, cannot update it`;this.logger.warn({node:c,doRender:l},S);return}if(v){let S=JSON.parse(JSON.stringify([...v.props.children??[]]));const _=JSON.parse(JSON.stringify({...c})),C=S.length,R=S.findIndex(D=>D.key===_.key);S.splice(R,1),r===qr.UP&&S.splice(R+1,0,_),r===qr.DOWN&&S.splice(R-1,0,_),r===qr.FRONT&&S.splice(C-1,0,_),r===qr.BACK&&S.splice(0,0,_),S=S.map((D,H)=>({...D,props:{...D.props,zIndex:H}})),v.props.children||(v.props.children=[]),v.props.children=S,l&&this.instance.render()}},u)}}class Mv{constructor(c){E(this,"instance");E(this,"nodesHandlers",{});E(this,"actionsHandlers",{});E(this,"plugins",{});E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("register-manager"),this.logger.debug("Register manager created")}getPlugins(){return this.plugins}getNodesHandlers(){return this.nodesHandlers}getActionsHandlers(){return this.actionsHandlers}getPlugin(c){if(!this.plugins[c]){const r=`Plugin with name [${c}] is not registered`;throw this.logger.error(r),new Error(r)}return this.plugins[c]}getActionHandler(c){if(!this.actionsHandlers[c]){const r=`Action handler with name [${c}] is not registered`;throw this.logger.error(r),new Error(r)}return this.actionsHandlers[c]}getNodeHandler(c){if(!this.nodesHandlers[c]){const r=`Node handler with type [${c}] is not registered`;throw this.logger.error(r),new Error(r)}return this.nodesHandlers[c]}registerPlugins(){const c=this.instance.getConfiguration();if(c.plugins)for(const r of c.plugins)this.registerPlugin(r);this.logger.info("Plugins registered")}registerPlugin(c){const r=c.getName();c.register(this.instance),this.plugins[r]=c}registerNodesHandlers(){const c=this.instance.getConfiguration();if(c.nodes)for(const r of c.nodes)this.registerNodeHandler(r);this.logger.info("Nodes handlers registered")}registerNodeHandler(c){const r=c.getNodeType();if(this.nodesHandlers[r]){const l=`Node handler with type [${r}] already exists`;throw this.logger.error(l),new Error(l)}c.register(this.instance),this.nodesHandlers[r]=c}registerActionsHandlers(){const c=this.instance.getConfiguration();if(c.actions)for(const r of c.actions)this.registerActionHandler(r);this.logger.info("Actions handlers registered")}registerActionHandler(c){const r=c.getName();if(this.actionsHandlers[r]){const l=`Action handler with name [${r}] already exists`;throw this.logger.error(l),new Error(l)}c.register(this.instance),this.actionsHandlers[r]=c}}const zv="0.1.0";class Ov{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("setup-manager"),this.logger.debug("Setup manager created")}welcomeLog(){const c=this.instance.getLogger().getDisabled(),r=this.instance.getLogger().getLevel(),l=[`%cWEAVE.JS%c
56
+ version: ${zv}
57
+ log disabled: ${c}
58
+ log level: ${r}`,"color: black; font-size: 20px; font-weight: bold; padding: 2px; margin-bottom: 12px;","color: black;"];console.log(...l)}setupLog(){const c=this.instance.getRegisterManager().getNodesHandlers(),r=this.instance.getRegisterManager().getActionsHandlers(),l=this.instance.getRegisterManager().getPlugins(),u=[`%cWEAVE.JS SETUP%c
59
+ REGISTERED%c
60
+ nodes: ${Object.keys(c).length}
61
+ actions: ${Object.keys(r).length}
62
+ plugins: ${Object.keys(l).length}`,"color: black; font-size: 16px; font-weight: bold; padding: 2px;","color: black; font-size: 12px; font-weight: bold; margin-top: 8px; margin-bottom: 8px; border-bottom: solid 1px black;","color: black;"];console.log(...u)}setupPlugins(){var r;this.logger.debug("Setting up plugins");const c=this.instance.getRegisterManager().getPlugins();for(const l of Object.keys(c)){const u=c[l];(r=u.init)==null||r.call(u)}}setupActions(){var r;this.logger.debug("Setting up actions");const c=this.instance.getRegisterManager().getActionsHandlers();for(const l of Object.keys(c)){const u=c[l];(r=u.init)==null||r.call(u)}}}class Dv{constructor(c,r){E(this,"instance");E(this,"logger");E(this,"stage");E(this,"config");this.instance=c,this.config=r,this.logger=this.instance.getChildLogger("stage-manager"),this.logger.debug({config:r},"Stage manager created")}getConfiguration(){return this.config}setStage(c){this.stage=c}getStage(){return this.stage}getMainLayer(){return this.getStage().findOne(`#${wu}`)}getInstanceRecursive(c,r=[]){var u,h;const l=c.getAttrs();return c.getParent()&&((u=c.getParent())!=null&&u.getAttrs().nodeType)&&!["stage","layer",...r].includes((h=c.getParent())==null?void 0:h.getAttrs().nodeType)?this.getInstanceRecursive(c.getParent()):l.id==="mainLayer"?this.instance.getMainLayer():l.id==="stage"?this.instance.getMainLayer():c}initStage(){const c={container:this.instance.getStageConfiguration().container,width:this.instance.getStageConfiguration().width,height:this.instance.getStageConfiguration().height,id:"stage",initialZIndex:void 0},r=new ne.Stage({...c});r.draw(),this.setStage(r)}}class Wv{constructor(c){E(this,"instance");E(this,"activeAction");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("actions-manager"),this.logger.debug("Actions manager created")}getActiveAction(){return this.activeAction}triggerAction(c,r){var g,v;const l=this.instance.getConfiguration(),u=this.instance.getActionsHandlers();if(!u[c]){const S=`Action handler with name [${c}] not registered`;throw this.logger.error(S),new Error(S)}typeof this.activeAction<"u"&&this.cancelAction(this.activeAction),this.activeAction=c;const h=u[c].trigger(this.cancelActionCallback(c),r);return(v=(g=l.callbacks)==null?void 0:g.onActiveActionChange)==null||v.call(g,this.activeAction),this.instance.emitEvent("onActiveActionChange",this.activeAction),h}updatePropsAction(c,r){var u,h;const l=this.instance.getActionsHandlers();if(!l[c]){const g=`Action handler with name [${c}] not registered`;throw this.logger.error(g),new Error(g)}if(this.activeAction!==c){const g=`Action handler with name [${c}] not active`;throw this.logger.error(g),new Error(g)}this.activeAction=c,(h=(u=l[c]).updateProps)==null||h.call(u,r)}getPropsAction(c){var l,u;const r=this.instance.getActionsHandlers();if(!r[c]){const h=`Action handler with name [${c}] not registered`;throw this.logger.error(h),new Error(h)}if(this.activeAction!==c){const h=`Action handler with name [${c}] not active`;throw this.logger.error(h),new Error(h)}return this.activeAction=c,(u=(l=r[c]).getProps)==null?void 0:u.call(l)}cancelAction(c){var u,h,g,v;const r=this.instance.getConfiguration(),l=this.instance.getActionsHandlers();if(!l[c]){const S=`Action handler with name [${c}] not registered`;throw this.logger.error(S),new Error(S)}this.activeAction=void 0,(h=(u=l[c]).cleanup)==null||h.call(u),(v=(g=r.callbacks)==null?void 0:g.onActiveActionChange)==null||v.call(g,this.activeAction),this.instance.emitEvent("onActiveActionChange",this.activeAction)}cancelActionCallback(c){return()=>{this.cancelAction(c)}}}class Uv{constructor(c){E(this,"instance");E(this,"store");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("store-manager"),this.logger.debug("Store manager created")}getStore(){return this.store}registerStore(c){if(typeof this.store<"u"){const l="Store already registered";throw this.logger.error(l),new Error(l)}const r=c.register(this.instance);this.store=r}}class Fv{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("export-manager"),this.logger.debug("Export manager created")}exportStage(c){return new Promise(r=>{var H;const{format:l=Go.PNG,padding:u=0,pixelRatio:h=1,backgroundColor:g=xu}=c,v=this.instance.getStage(),S=this.instance.getMainLayer(),_=v.scaleX(),C=v.x(),R=v.y();let D;if(S){const Z=S.getClientRect({relativeTo:v}),F=Math.min(v.width()/(Z.width+u*2),v.height()/(Z.height+u*2));v.setAttrs({x:-Z.x*F+(v.width()-Z.width*F)/2,y:-Z.y*F+(v.height()-Z.height*F)/2});const Y=v.scale();Y.x=F,Y.y=F,v.scale(Y);const X=this.instance.getPlugins();for(const j of Object.keys(X)){const ye=X[j];(H=ye.render)==null||H.call(ye)}const se=v.getClientRect({relativeTo:v});D=new ne.Rect({x:se.x,y:se.y,width:se.width,height:se.height,fill:g}),S.add(D),D.moveToBottom(),v.toImage({mimeType:l,x:((S==null?void 0:S.x())??0)-u,y:((S==null?void 0:S.y())??0)-u,width:((S==null?void 0:S.width())??0)+u*2,height:((S==null?void 0:S.height())??0)+u*2,pixelRatio:h,quality:c.quality??1,callback:j=>{var we;v.setAttrs({x:C,y:R,scaleX:_,scaleY:_});const ye=this.instance.getPlugins();for(const xe of Object.keys(ye)){const Ie=ye[xe];(we=Ie.render)==null||we.call(Ie)}D==null||D.destroy(),r(j)}})}})}exportNode(c,r){return new Promise(l=>{const{format:u=Go.PNG,padding:h=0,pixelRatio:g=1,backgroundColor:v=xu}=r,S=this.instance.getMainLayer();if(S){const _=c.clone({id:et()}),C=new ne.Group({x:_.getAbsolutePosition().x,y:_.getAbsolutePosition().y,visible:!1});S.add(C);const R=_.getClientRect(),D=new ne.Rect({x:0,y:0,width:R.width+2*h,height:R.height+2*h,fill:v});C.add(D),D.zIndex(0),_.moveTo(C),_.setPosition({x:h,y:h}),_.zIndex(1),C.visible(!0),C.toImage({mimeType:u,pixelRatio:g,quality:r.quality??1,callback:H=>{C==null||C.destroy(),l(H)}})}})}}class Hv{constructor(c){E(this,"instance");E(this,"logger");this.instance=c,this.logger=this.instance.getChildLogger("plugins-manager"),this.logger.debug("Plugins manager created")}enable(c){var l,u;const r=this.instance.getPlugins();if(!r[c]){const h=`Plugin with name [${c}] not registered`;throw this.logger.error(h),new Error(h)}(u=(l=r[c]).enable)==null||u.call(l)}disable(c){var l,u;const r=this.instance.getPlugins();if(!r[c]){const h=`Plugin with name [${c}] not registered`;throw this.logger.error(h),new Error(h)}(u=(l=r[c]).disable)==null||u.call(l)}isEnabled(c){var l,u;const r=this.instance.getPlugins();if(!r[c]){const h=`Plugin with name [${c}] not registered`;throw this.logger.error(h),new Error(h)}return(u=(l=r[c]).isEnabled)==null?void 0:u.call(l)}}class rf extends Zs{constructor(r,l){var u;super();E(this,"id");E(this,"config");E(this,"logger");E(this,"moduleLogger");E(this,"reconciler");E(this,"stateSerializer");E(this,"renderer");E(this,"status",cu.IDLE);E(this,"setupManager");E(this,"registerManager");E(this,"stateManager");E(this,"storeManager");E(this,"stageManager");E(this,"groupsManager");E(this,"targetingManager");E(this,"cloningManager");E(this,"fontsManager");E(this,"zIndexManager");E(this,"pluginsManager");E(this,"actionsManager");E(this,"exportManager");ne.showWarnings=!1,this.id=et(),this.config=r,this.logger=new Iv(((u=this.config)==null?void 0:u.logger)??{disabled:!1,level:"error"}),this.moduleLogger=this.logger.getChildLogger("main"),this.stateSerializer=new Jm,this.reconciler=new qm(this),this.renderer=new iv(this,this.reconciler,this.stateSerializer),this.setupManager=new Ov(this),this.registerManager=new Mv(this),this.storeManager=new Uv(this),this.stateManager=new Rv(this),this.stageManager=new Dv(this,l),this.groupsManager=new rv(this),this.targetingManager=new Av(this),this.cloningManager=new Nv(this),this.fontsManager=new Cv(this),this.zIndexManager=new kv(this),this.exportManager=new Fv(this),this.actionsManager=new Wv(this),this.pluginsManager=new Hv(this),window.weave||(window.weave=this),this.setupManager.welcomeLog()}setupRenderer(){this.renderer.init(),this.renderer.render(()=>{var r,l;this.setupManager.setupPlugins(),this.setupManager.setupActions(),this.moduleLogger.info("Instance started"),this.status=cu.RUNNING,(l=(r=this.getConfiguration().callbacks)==null?void 0:r.onInstanceStatus)==null||l.call(r,this.status),this.emitEvent("onInstanceStatus",this.status)})}setStatus(r){this.status=r}getStatus(){return this.status}setStore(r){this.storeManager.registerStore(r)}async start(){var l,u,h,g;this.moduleLogger.info("Start instance"),this.status=cu.STARTING,(u=(l=this.getConfiguration().callbacks)==null?void 0:l.onInstanceStatus)==null||u.call(l,this.status),this.emitEvent("onInstanceStatus",this.status),this.registerManager.registerNodesHandlers(),this.registerManager.registerPlugins(),this.registerManager.registerActionsHandlers(),this.storeManager.registerStore(this.config.store),this.status=cu.LOADING_FONTS,(g=(h=this.getConfiguration().callbacks)==null?void 0:h.onInstanceStatus)==null||g.call(h,this.status),this.emitEvent("onInstanceStatus",this.status),await this.fontsManager.loadFonts(),this.setupManager.setupLog(),this.stageManager.initStage();const r=this.storeManager.getStore();r.setup(),r.connect()}getId(){return this.id}getConfiguration(){return this.config}emitEvent(r,l){this.moduleLogger.debug({payload:l},`Emitted event [${r}]`),this.emit(r,l)}addEventListener(r,l){this.moduleLogger.debug(`Listening event [${r}]`),this.on(r,l)}removeEventListener(r,l){this.moduleLogger.debug(`Removing listening to event [${r}]`),this.off(r,l)}getLogger(){return this.logger}getMainLogger(){return this.moduleLogger}getChildLogger(r){return this.logger.getChildLogger(r)}getStageManager(){return this.stageManager}getStage(){return this.stageManager.getStage()}getMainLayer(){return this.stageManager.getMainLayer()}setStage(r){this.stageManager.setStage(r)}getStageConfiguration(){return this.stageManager.getConfiguration()}getInstanceRecursive(r,l=[]){return this.stageManager.getInstanceRecursive(r,l)}getRegisterManager(){return this.registerManager}getPlugins(){return this.registerManager.getPlugins()}getPlugin(r){return this.registerManager.getPlugin(r)}getNodesHandlers(){return this.registerManager.getNodesHandlers()}getNodeHandler(r){return this.registerManager.getNodeHandler(r)}getActionsHandlers(){return this.registerManager.getActionsHandlers()}getActionHandler(r){return this.registerManager.getActionHandler(r)}getStore(){return this.storeManager.getStore()}registerPlugin(r){this.registerManager.registerPlugin(r)}registerNodeHandler(r){this.registerManager.registerNodeHandler(r)}registerActionHandler(r){this.registerManager.registerActionHandler(r)}registerStore(r){this.storeManager.registerStore(r)}isPluginEnabled(r){return this.pluginsManager.isEnabled(r)}enablePlugin(r){this.pluginsManager.enable(r)}disablePlugin(r){this.pluginsManager.disable(r)}getActiveAction(){return this.actionsManager.getActiveAction()}triggerAction(r,l){return this.actionsManager.triggerAction(r,l)}getPropsAction(r){return this.actionsManager.getPropsAction(r)}updatePropsAction(r,l){this.actionsManager.updatePropsAction(r,l)}cancelAction(r){this.actionsManager.cancelAction(r)}update(r){this.getStore().setState(r),this.renderer.render(()=>{var l,u;(u=(l=this.config.callbacks)==null?void 0:l.onRender)==null||u.call(l),this.emitEvent("onRender",{})})}render(){this.renderer.render(()=>{var r,l;(l=(r=this.config.callbacks)==null?void 0:r.onRender)==null||l.call(r),this.emitEvent("onRender",{})})}findNodeById(r,l,u=null,h=-1){return this.stateManager.findNodeById(r,l,u,h)}findNodesByType(r,l){return this.stateManager.findNodesByType(r,l)}getNode(r){return this.stateManager.getNode(r)}addNode(r,l="mainLayer",u=void 0,h=!0){this.stateManager.addNode(r,l,u,h)}updateNode(r,l=!0){this.stateManager.updateNode(r,l)}removeNode(r,l=!0){this.stateManager.removeNode(r,l);const u=this.getPlugin("nodesSelection");u&&u.setSelectedNodes([])}removeNodes(r,l=!0){for(const h of r)this.removeNode(h,!1);const u=this.getPlugin("nodesSelection");u&&u.setSelectedNodes([]),l&&this.render()}moveNode(r,l,u=!0){this.stateManager.moveNode(r,l,u)}moveUp(r){this.zIndexManager.moveUp(r)}moveDown(r){this.zIndexManager.moveDown(r)}sendToBack(r){this.zIndexManager.sendToBack(r)}bringToFront(r){this.zIndexManager.bringToFront(r)}group(r){this.groupsManager.group(r)}unGroup(r){this.groupsManager.unGroup(r)}getMousePointer(r){return this.targetingManager.getMousePointer(r)}getMousePointerRelativeToContainer(r){return this.targetingManager.getMousePointerRelativeToContainer(r)}nodesToGroupSerialized(r){return this.cloningManager.nodesToGroupSerialized(r)}cloneNodes(r,l,u){this.cloningManager.cloneNodes(r,l,u)}getFonts(){return this.fontsManager.getFonts()}async exportStage(r){return await this.exportManager.exportStage(r)}async exportNode(r,l){return await this.exportManager.exportNode(r,l)}}class bv{constructor(c){E(this,"instance");E(this,"name");E(this,"supportsUndoManager");E(this,"config");E(this,"state");E(this,"latestState");E(this,"document");E(this,"logger");E(this,"undoManager");E(this,"isRoomLoaded",!1);this.config=c,this.latestState={weave:{}},this.state=lu.syncedStore({weave:{}}),this.document=lu.getYjsDoc(this.state)}getName(){return this.name}getLogger(){return this.logger}register(c){return this.instance=c,this.logger=this.instance.getChildLogger(this.getName()),this.instance.getMainLogger().info(`Store with name [${this.getName()}] registered`),this}getUser(){return this.config.getUser()}setState(c){this.state=c}setLatestState(c){this.latestState=c}getLatestState(){return this.latestState}getDocument(){return this.document}getState(){return this.state}getStateJson(){return JSON.parse(JSON.stringify(this.state,void 0,2))}setup(){var r,l,u;const c=this.instance.getConfiguration();if((l=(r=c.callbacks)==null?void 0:r.onRoomLoaded)==null||l.call(r,this.isRoomLoaded),this.instance.emitEvent("onRoomLoaded",this.isRoomLoaded),this.supportsUndoManager){const h=lu.getYjsValue(this.getState().weave);h&&(this.undoManager=new bm.UndoManager([h],{captureTimeout:250,trackedOrigins:new Set([this.config.getUser().name]),...(u=this.config)==null?void 0:u.undoManagerOptions}),this.undoManager.addTrackedOrigin(this.config.getUser().name),this.undoManager.on("stack-item-added",()=>{var v,S;const g={canUndo:this.undoManager.canUndo(),canRedo:this.undoManager.canRedo(),redoStackLength:this.undoManager.redoStack.length,undoStackLength:this.undoManager.undoStack.length};(S=(v=c.callbacks)==null?void 0:v.onUndoManagerStatusChange)==null||S.call(v,g),this.instance.emitEvent("onUndoManagerStatusChange",g)}),this.undoManager.on("stack-item-popped",()=>{var v,S;const g={canUndo:this.undoManager.canUndo(),canRedo:this.undoManager.canRedo(),redoStackLength:this.undoManager.redoStack.length,undoStackLength:this.undoManager.undoStack.length};(S=(v=c.callbacks)==null?void 0:v.onUndoManagerStatusChange)==null||S.call(v,g),this.instance.emitEvent("onUndoManagerStatusChange",g)}))}lu.observeDeep(this.getState(),()=>{var g,v,S,_;const h=JSON.parse(JSON.stringify(this.getState()));(v=(g=c.callbacks)==null?void 0:g.onStateChange)==null||v.call(g,h),this.instance.emitEvent("onStateChange",h),!this.isRoomLoaded&&!jt.isEmpty(this.state.weave)&&(this.instance.setupRenderer(),this.isRoomLoaded=!0,(_=(S=c.callbacks)==null?void 0:S.onRoomLoaded)==null||_.call(S,this.isRoomLoaded),this.instance.emitEvent("onRoomLoaded",this.isRoomLoaded)),this.isRoomLoaded&&!jt.isEmpty(this.state.weave)&&this.instance.render()})}canUndoStateStep(){if(!this.supportsUndoManager)throw new Error("Undo manager not supported");return this.undoManager.canUndo()}canRedoStateStep(){if(!this.supportsUndoManager)throw new Error("Undo manager not supported");return this.undoManager.canRedo()}undoStateStep(){if(!this.supportsUndoManager)throw new Error("Undo manager not supported");this.undoManager.undo()}redoStateStep(){if(!this.supportsUndoManager)throw new Error("Undo manager not supported");this.undoManager.redo()}}class mr{constructor(){E(this,"instance");E(this,"nodeType");E(this,"logger");E(this,"previousPointer")}register(c){return this.instance=c,this.logger=this.instance.getChildLogger(this.getNodeType()),this.instance.getChildLogger("node").debug(`Node with type [${this.getNodeType()}] registered`),this}getNodeType(){return this.nodeType}getLogger(){return this.logger}getSelectionPlugin(){return this.instance.getPlugin("nodesSelection")}isSelecting(){return this.instance.getActiveAction()==="selectionTool"}isPasting(){return this.instance.getPlugin("copyPasteNodes").isPasting()}isNodeSelected(c){const r=this.instance.getPlugin("nodesSelection");let l=!1;return r.getSelectedNodes().length===1&&r.getSelectedNodes()[0].getAttrs().id===c.getAttrs().id&&(l=!0),l}setupDefaultNodeEvents(c){this.previousPointer=null,this.instance.addEventListener("onNodesChange",()=>{if(this.isSelecting()&&this.isNodeSelected(c)){c.draggable(!0);return}c.draggable(!1)}),c.on("transform",r=>{this.isSelecting()&&this.isNodeSelected(c)&&(this.instance.updateNode(this.toNode(c)),r.cancelBubble=!0)}),c.on("dragmove",r=>{this.isSelecting()&&this.isNodeSelected(c)&&(this.instance.updateNode(this.toNode(c)),r.cancelBubble=!0)}),c.on("dragend",r=>{this.isSelecting()&&this.isNodeSelected(c)&&(this.instance.updateNode(this.toNode(c)),r.cancelBubble=!0)}),this.previousPointer=null,c.on("mouseenter",r=>{const l=this.instance.getInstanceRecursive(c);if(this.isSelecting()&&!this.isNodeSelected(l)&&!this.isPasting()){const u=this.instance.getStage();this.previousPointer=u.container().style.cursor,u.container().style.cursor="pointer",r.cancelBubble=!0}}),c.on("mouseleave",r=>{const l=this.instance.getInstanceRecursive(c);if(this.isSelecting()&&!this.isNodeSelected(l)&&!this.isPasting()){const u=this.instance.getStage();u.container().style.cursor=this.previousPointer??"default",this.previousPointer=null,r.cancelBubble=!0}})}}class gn{constructor(c){E(this,"instance");E(this,"name");E(this,"props");E(this,"callbacks");E(this,"logger");return this.callbacks=c,new Proxy(this,{set:(r,l,u)=>{var h,g,v;return Reflect.set(r,l,u),(h=this.internalUpdate)==null||h.call(this),(v=(g=this.callbacks)==null?void 0:g.onPropsChange)==null||v.call(g,this.props),!0}})}getName(){return this.name}getLogger(){return this.logger}register(c){return this.instance=c,this.logger=this.instance.getChildLogger(this.getName()),this.instance.getChildLogger("action").debug(`Action handler with name [${this.getName()}] registered`),this}updateProps(c){this.props={...this.props,...c}}getProps(){return this.props}}class ti{constructor(){E(this,"instance");E(this,"name");E(this,"enabled",!0);E(this,"logger")}register(c){return this.instance=c,this.logger=this.instance.getChildLogger(this.getName()),this.instance.getChildLogger("plugin").debug(`Plugin with name [${this.getName()}] registered`),this}getName(){return this.name}getLogger(){return this.logger}isEnabled(){return this.enabled}}function sf(x){x.width(Math.round((Math.max(1,x.width()*x.scaleX())+Number.EPSILON)*100)/100),x.height(Math.round((Math.max(1,x.height()*x.scaleY())+Number.EPSILON)*100)/100),x.scaleX(1),x.scaleY(1),x.x(Math.round((x.x()+Number.EPSILON)*100)/100),x.y(Math.round((x.y()+Number.EPSILON)*100)/100),x.rotation(Math.round((x.rotation()+Number.EPSILON)*100)/100)}function Bv(x,c){const r=new CustomEvent(x,{detail:c});window.dispatchEvent(r)}const Gv="stage";class Zv extends mr{constructor(){super(...arguments);E(this,"nodeType",Gv)}createNode(r,l){return{key:r,type:this.nodeType,props:{...l,id:r,nodeType:this.nodeType,children:[]}}}createInstance(r){const l=new ne.Stage({...r});return l.draw(),l}updateInstance(){}removeInstance(r){r.destroy()}toNode(r){const l=r.getAttrs();return{key:l.id??"",type:l.nodeType,props:{...l,id:l.id??"",nodeType:l.nodeType,children:[]}}}}const Xv="layer";class Yv extends mr{constructor(){super(...arguments);E(this,"nodeType",Xv)}createNode(r,l){return{key:r,type:this.nodeType,props:{...l,id:r,nodeType:this.nodeType,children:[]}}}createInstance(r){return new ne.Layer({...r})}updateInstance(r,l){r.setAttrs({...l})}removeInstance(r){r.destroy()}toNode(r){const l=r.getAttrs(),u=[],h=[...r.getChildren()];for(const g of h){const v=this.instance.getNodeHandler(g.getAttr("nodeType"));u.push(v.toNode(g))}return{key:l.id??"",type:l.nodeType,props:{...l,id:l.id??"",nodeType:l.nodeType,children:u}}}}const Kv="group";class Qv extends mr{constructor(){super(...arguments);E(this,"nodeType",Kv)}createNode(r,l){return{key:r,type:this.nodeType,props:{...l,id:r,nodeType:this.nodeType,children:[]}}}createInstance(r){const l=new ne.Group({...r,name:"node"});return this.setupDefaultNodeEvents(l),l}updateInstance(r,l){r.setAttrs({...l})}removeInstance(r){r.destroy()}toNode(r){const l=r.getAttrs(),u=[],h=[...r.getChildren()];for(const g of h){const v=this.instance.getNodeHandler(g.getAttr("nodeType"));u.push(v.toNode(g))}return{key:l.id??"",type:l.nodeType,props:{...l,id:l.id??"",nodeType:l.nodeType,children:u}}}}const Vv="rectangle";class qv extends mr{constructor(){super(...arguments);E(this,"nodeType",Vv)}createNode(r,l){return{key:r,type:this.nodeType,props:{...l,id:r,nodeType:this.nodeType,children:[]}}}createInstance(r){const l=new ne.Rect({...r,name:"node"});return this.setupDefaultNodeEvents(l),l}updateInstance(r,l){r.setAttrs({...l})}removeInstance(r){r.destroy()}toNode(r){const l=r.getAttrs(),u={...l};return delete u.draggable,{key:l.id??"",type:l.nodeType,props:{...u,id:l.id??"",nodeType:l.nodeType,children:[]}}}}const Jv="line";class jv extends mr{constructor(){super(...arguments);E(this,"nodeType",Jv)}createNode(r,l){return{key:r,type:this.nodeType,props:{...l,id:r,nodeType:this.nodeType,children:[]}}}createInstance(r){const l=new ne.Line({...r,name:"node"});return this.setupDefaultNodeEvents(l),l}updateInstance(r,l){r.setAttrs({...l})}removeInstance(r){r.destroy()}toNode(r){const l=r.getAttrs(),u={...l};return delete u.draggable,{key:l.id??"",type:l.nodeType,props:{...u,id:l.id??"",nodeType:l.nodeType,children:[]}}}}const Vd="text";class $v extends mr{constructor(){super();E(this,"nodeType",Vd);E(this,"editing",!1);this.editing=!1}getType(){return"text"}createNode(r,l){return{key:r,type:this.nodeType,props:{...l,id:r,nodeType:this.nodeType,children:[]}}}updateNode(r){const l=r.clone();l.setAttr("triggerEditMode",void 0),this.instance.updateNode(this.toNode(l)),l.destroy()}createInstance(r){const l=new ne.Text({...r,name:"node"});return this.setupDefaultNodeEvents(l),l.on("dblclick dbltap",u=>{if(u.cancelBubble=!0,this.editing||!(this.isSelecting()&&this.isNodeSelected(l)))return;const h=this.instance.getStage(),g=h.getPointerPosition();if(g){const S=h.getAllIntersections(g).filter(_=>_.getAttrs().nodeType===Vd);S.length>0&&this.triggerEditMode(S[0])}}),l.on("transform",u=>{this.isSelecting()&&this.isNodeSelected(l)&&(l.setAttrs({width:l.width()*l.scaleX(),scaleX:1}),sf(l),l.fontSize(l.fontSize()*l.scaleY()),this.instance.updateNode(this.toNode(l)),u.cancelBubble=!0)}),l.setAttr("triggerEditMode",this.triggerEditMode.bind(this)),l}updateInstance(r,l){r.setAttrs({...l})}removeInstance(r){r.destroy()}toNode(r){const l=r.getAttrs(),u={...l};return delete u.draggable,delete u.triggerEditMode,{key:l.id??"",type:l.nodeType,props:{...u,id:l.id??"",nodeType:l.nodeType,children:[]}}}createTextAreaDOM(r,l){const u=this.instance.getStage(),h=document.createElement("textarea");u.container().appendChild(h),window.weaveTextEditing=!0,h.value=r.text(),h.id=r.id(),h.style.position="fixed",h.style.top=l.y+"px",h.style.left=l.x+"px",h.style.width=(r.width()-r.padding()*2)*r.getAbsoluteScale().x+"px",h.style.height=(r.height()-r.padding()*2)*r.getAbsoluteScale().x+"px",h.style.fontSize=r.fontSize()*r.getAbsoluteScale().x+"px",h.style.border="solid 1px rgba(0,0,255,0.5)",h.style.padding="0px",h.style.margin="0px",h.style.overflow="hidden",h.style.background="rgba(255,255,255,0.5)",h.style.outline="none",h.style.resize="none",h.style.lineHeight=`${r.lineHeight()}`,h.style.fontFamily=r.fontFamily(),h.style.transformOrigin="left top",h.style.textAlign=r.align(),h.style.color=`${r.fill()}`;const g=r.rotation();let v="";g&&(v+="rotateZ("+g+"deg)");const S=1,_=2;v+="translateX(-"+S+"px)",v+="translateY(-"+_+"px)",h.style.transform=v;const C=H=>{if(h&&r){if(H.key==="Enter"&&!H.shiftKey){r.text(h.value),this.updateNode(r),this.removeTextAreaDOM(r),window.removeEventListener("click",D);return}if(H.key==="Enter"&&H.shiftKey){if(h&&r)try{r.text(h.value),h.style.width=r.width()*r.getAbsoluteScale().x+"px",h.style.height="auto",h.style.height=h.scrollHeight+r.fontSize()*r.getAbsoluteScale().x+"px",h.tabIndex=1,h.focus()}catch(Z){console.error(Z)}return}if(H.key==="Escape"){this.removeTextAreaDOM(r),window.removeEventListener("click",D);return}}},R=H=>{r.text(h.value),h&&r&&(h.style.width=r.width()*r.getAbsoluteScale().x+"px",H.key==="Enter"&&H.shiftKey||(h.style.height="auto",h.style.height=h.scrollHeight+"px"))};h.addEventListener("keydown",C),h.addEventListener("keyup",R),h.tabIndex=1,h.focus();const D=H=>{!H&&h.value===""&&(this.updateNode(r),this.removeTextAreaDOM(r),h.removeEventListener("keydown",C),h.removeEventListener("keyup",R),window.removeEventListener("click",D),window.removeEventListener("touchstart",D)),H&&H.target!==h&&h.value!==""&&(r.text(h.value),this.updateNode(r),this.removeTextAreaDOM(r),h.removeEventListener("keydown",C),h.removeEventListener("keyup",R),window.removeEventListener("click",D),window.removeEventListener("touchstart",D))};setTimeout(()=>{window.addEventListener("click",D),window.addEventListener("touchstart",D)})}removeTextAreaDOM(r){const l=this.instance.getStage();window.weaveTextEditing=!1;const u=document.getElementById(r.id());u&&u.remove(),r.visible(!0);const h=this.instance.getPlugin("nodesSelection");if(h){this.instance.enablePlugin("nodesSelection");const g=h.getTransformer();g&&(g.nodes([r]),g.show(),g.forceUpdate()),this.instance.triggerAction("selectionTool")}this.editing=!1,l.container().tabIndex=1,l.container().click(),l.container().focus()}triggerEditMode(r){const l=this.instance.getStage();this.editing=!0,r.visible(!1);const u=this.instance.getPlugin("nodesSelection");if(u){const v=u.getTransformer();this.instance.disablePlugin("nodesSelection"),v.hide()}const h=r.absolutePosition(),g={x:l.container().offsetLeft+h.x,y:l.container().offsetTop+h.y};this.createTextAreaDOM(r,g)}}class e0{constructor(c,r,l,u,h){E(this,"instance");E(this,"image");E(this,"internalImage");E(this,"clipGroup");E(this,"clipRect");E(this,"grid");E(this,"transformer");E(this,"node");E(this,"handleHide");E(this,"handleCrop");E(this,"handleDrag");this.instance=c,this.node=r,this.image=l,this.internalImage=u,this.clipGroup=h,this.handleHide=this.hide.bind(this),this.handleCrop=this.handleClipTransform.bind(this),this.handleDrag=this.handleClipDrag.bind(this)}show(){const c=this.internalImage.getAttr("image");this.instance.getPlugin("nodesSnapping")&&this.instance.disablePlugin("nodesSnapping");const l=this.instance.getPlugin("nodesSelection");l&&(this.instance.disablePlugin("nodesSelection"),l.getTransformer().nodes([]),l.getTransformer().hide());const u=this.internalImage.cropWidth()===0?this.image.width()/this.image.width():this.image.width()/this.internalImage.cropWidth(),h=u*c.width,g=u*c.height,v=this.internalImage.cropX()*u,S=this.internalImage.cropY()*u;this.internalImage.hide();const _=this.internalImage.clone({width:h,height:g,cropX:0,cropY:0,cropWidth:0,cropHeight:0,visible:!0,draggable:!1,rotation:0});this.clipRect=new ne.Rect({width:this.internalImage.width(),height:this.internalImage.height(),fill:"rgba(0,0,0,0.5)",x:0,y:0,draggable:!0,rotation:0}),this.transformer=new ne.Transformer({flipEnabled:!1,keepRatio:!1,rotateEnabled:!1,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],rotation:0}),this.grid=new ne.Group,this.transformer.on("dragmove",this.handleDrag),this.transformer.on("transform",this.handleCrop),this.transformer.nodes([this.clipRect]),this.clipGroup.add(_),this.clipGroup.add(this.clipRect),this.clipGroup.add(this.grid),this.clipGroup.add(this.transformer),this.clipGroup.setPosition({x:-v,y:-S}),this.clipRect.position({x:v,y:S}),this.handleClipTransform(),this.clipGroup.show(),this.instance.getStage().container().addEventListener("keydown",this.handleHide)}hide(){this.handleClipEnd(),this.node.cropping=!1,this.instance.getStage().container().removeEventListener("keydown",this.handleHide),this.transformer.off("dragmove",this.handleDrag),this.transformer.off("transform",this.handleCrop),this.clipGroup.destroyChildren(),this.clipGroup.hide(),this.instance.getPlugin("nodesSnapping")&&this.instance.enablePlugin("nodesSnapping");const r=this.instance.getPlugin("nodesSelection");if(r){this.instance.enablePlugin("nodesSelection");const l=r.getTransformer();l.nodes([this.image]),l.show(),setTimeout(()=>{l.forceUpdate()},0)}this.internalImage.show()}handleClipTransform(){if(!this.node.cropping)return;const c=this.internalImage.getAttr("image");let r=this.clipRect.x(),l=this.clipRect.y(),u=this.clipRect.width()*this.clipRect.scaleX(),h=this.clipRect.height()*this.clipRect.scaleY();r<0&&(u+=r,r=0),r+u>c.width&&(u=c.width-r),l<0&&(h+=l,l=0),l+h>c.height&&(h=c.height-l),this.clipRect.setAttrs({x:r,y:l,width:u,height:h,scaleX:1,scaleY:1}),this.transformer.absolutePosition(this.clipRect.absolutePosition()),this.grid.position({x:r,y:l}),this.drawGridLines(u,h)}handleClipDrag(){if(!this.node.cropping)return;const c=this.internalImage.getAttr("image");let r=this.clipRect.x(),l=this.clipRect.y(),u=this.clipRect.width(),h=this.clipRect.height();const g=c.width,v=c.height;r<0&&(r=0),r+u>g&&(r=g-u,u=g-r),l<0&&(l=0),l+h>v&&(l=v-h,h=v-l),this.clipRect.setAttrs({x:r,y:l,width:u,height:h}),this.grid.position({x:r,y:l}),this.drawGridLines(u,h)}drawGridLines(c,r){if(!this.node.cropping)return;this.grid.destroyChildren();const l=c/3,u=r/3;for(let h=1;h<=2;h++){const g=new ne.Line({points:[l*h,0,l*h,r],stroke:"#ffffff",strokeWidth:1}),v=new ne.Line({points:[0,u*h,c,u*h],stroke:"#ffffff",strokeWidth:1});this.grid.add(g,v)}}handleClipEnd(){if(!this.node.cropping)return;const c=this.clipRect.x(),r=this.clipRect.y(),l=this.clipRect.width(),u=this.clipRect.height();if(this.image){this.image.setAttrs({width:l,height:u,cropX:c,cropY:r,cropWidth:l,cropHeight:u});const h=this.clipRect.getAbsolutePosition();this.image.setPosition({x:h.x,y:h.y}),this.instance.updateNode(this.node.toNode(this.image))}}}const t0="image";class n0 extends mr{constructor(){super();E(this,"nodeType",t0);E(this,"imageLoaded");E(this,"cropping");this.imageLoaded=!1,this.cropping=!1}createNode(r,l){return{key:r,type:this.nodeType,props:{...l,id:r,nodeType:this.nodeType,children:[]}}}createInstance(r){const l=r.imageProperties,u=r,{id:h}=u,g={...u};delete g.imageProperties,delete g.zIndex;const v={...r};delete v.imageProperties,delete v.imageURL,delete v.zIndex;const S=new ne.Group({...g,id:h,name:"node"}),_=new ne.Rect({...g,id:`${h}-placeholder`,x:0,y:0,scaleX:1,scaleY:1,rotation:0,width:u.width??0,height:u.height??0,fill:"#ccccccff",strokeWidth:0,draggable:!1,visible:!0});S.add(_);const C=new ne.Image({...v,...l,id:`${h}-image`,x:0,y:0,scaleX:1,scaleY:1,rotation:0,width:0,height:0,draggable:!1,visible:!1});S.add(C);const R=new ne.Group({x:0,y:0,visible:!1});S.add(R),this.setupDefaultNodeEvents(S),S.on("dblclick dbltap",Z=>{if(Z.cancelBubble=!0,this.cropping||!C.getAttr("image")||!(this.isSelecting()&&this.isNodeSelected(S)))return;this.cropping=!0,new e0(this.instance,this,S,C,R).show()});const H=this.getImageToolAction().getPreloadedImage(u.id);return H?(_==null||_.setAttrs({width:u.width?u.width:H.width,height:u.height?u.height:H.height,visible:!1}),C==null||C.setAttrs({width:u.width?u.width:H.width,height:u.height?u.height:H.height,image:H,visible:!0}),this.imageLoaded=!0,S.setAttr("width",S.width()?S.width():H.width),S.setAttr("height",S.height()?S.height():H.height),S.setAttr("imageInfo",{width:H.width,height:H.height}),this.instance.updateNode(this.toNode(S))):this.loadImage(u,S),S.setAttr("imageURL",u.imageURL),S}updateInstance(r,l){const u=r.getAttrs().id,h=r;r.setAttrs({...l});const g=h.findOne(`#${u}-placeholder`),v=h.findOne(`#${u}-image`),S=h.getAttrs(),_={...S};delete _.nodeType,delete _.imageProperties,delete _.imageURL,delete _.zIndex,this.imageLoaded||(g==null||g.setAttrs({..._,...S.imageProperties??{},name:void 0,id:`${u}-placeholder`,x:0,y:0,scaleX:1,scaleY:1,rotation:0,visible:!0,fill:"#ccccccff",strokeWidth:0,draggable:!1,zIndex:0}),v==null||v.setAttrs({..._,...S.imageProperties??{},name:void 0,id:`${u}-image`,x:0,y:0,scaleX:1,scaleY:1,rotation:0,visible:!1,draggable:!1,zIndex:1})),this.imageLoaded&&(v==null||v.setAttrs({..._,...S.imageProperties??{},name:void 0,id:`${u}-image`,x:0,y:0,scaleX:1,scaleY:1,rotation:0,visible:!0,draggable:!1,zIndex:0}))}removeInstance(r){r.destroy()}toNode(r){const l=r.getAttrs(),u={...l};return delete u.draggable,{key:l.id??"",type:l.nodeType,props:{...u,id:l.id??"",nodeType:l.nodeType,children:[]}}}loadImage(r,l){const u=r,h=l.findOne(`#${u.id}`),g=l.findOne(`#${u.id}-placeholder`),v=l.findOne(`#${u.id}-image`),S=new Image;S.onerror=_=>{console.error("Error loading image",_),g==null||g.setAttrs({visible:!0}),v==null||v.setAttrs({visible:!1})},S.onload=()=>{h==null||h.setAttrs({width:u.width?u.width:S.width,height:u.height?u.height:S.height}),g==null||g.destroy(),v==null||v.setAttrs({width:u.width?u.width:S.width,height:u.height?u.height:S.height,image:S,visible:!0}),v==null||v.zIndex(0),this.imageLoaded=!0,l.setAttr("width",u.width?u.width:S.width),l.setAttr("height",u.height?u.height:S.height),l.setAttr("imageInfo",{width:S.width,height:S.height}),this.instance.updateNode(this.toNode(l))},u.imageURL&&(S.src=u.imageURL)}getImageToolAction(){const r=this.instance.getActionHandler("imageTool");if(!r)throw new Error("Image Tool action not found");return r}}const of="frame";class i0 extends mr{constructor(){super(...arguments);E(this,"nodeType",of)}createNode(r,l){return{key:r,type:this.nodeType,props:{...l,id:r,nodeType:this.nodeType,children:[]}}}createInstance(r){const{id:l}=r,u={...r};delete u.fontFamily,delete u.zIndex;const h=1403,g=992,v=30,S=2,_=new ne.Group({...u,containerId:`${l}-group-internal`,width:h+S*2,height:g+v+S*2,fill:"#ffffffff",clipX:0,clipY:0,clipWidth:h+S*2,clipHeight:g+v+S*2,name:"node"}),C=new ne.Rect({id:`${l}-bg`,nodeId:l,x:S,y:v+S,width:h,stroke:"#000000ff",strokeWidth:2,height:g,fill:"#ffffffff",draggable:!1});_.add(C);const R=new ne.Text({id:`${l}-title`,x:0,y:0,width:h,height:v-10,fontSize:20,fontFamily:r.fontFamily,align:"left",text:u.title,stroke:"#000000ff",strokeWidth:1,listening:!1,draggable:!1});_.add(R);const D=new ne.Group({id:`${l}-group-internal`,nodeId:l,x:S,y:v+S,width:h,height:g,draggable:!1,stroke:"transparent",strokeWidth:S,clipX:0,clipY:0,clipWidth:h,clipHeight:g});return _.add(D),this.setupDefaultNodeEvents(_),_}updateInstance(r,l){const{id:u}=l,h=r,g={...l};delete g.title,r.setAttrs({...g});const v=h.findOne(`#${u}-title`);v&&v.setAttrs({text:l.title})}removeInstance(r){r.destroy()}toNode(r){const l=r.getAttrs(),u=r.findOne(`#${l.containerId}`),h=[];if(u){const v=[...u.getChildren()];for(const S of v){const _=this.instance.getNodeHandler(S.getAttr("nodeType"));h.push(_.toNode(S))}}const g={...l};return delete g.draggable,{key:l.id??"",type:l.nodeType,props:{...g,id:l.id??"",nodeType:l.nodeType,children:h}}}}class r0 extends gn{constructor(){super(...arguments);E(this,"previousAction");E(this,"cancelAction");E(this,"internalUpdate")}getName(){return"zoomOutTool"}getStageZoomPlugin(){return this.instance.getPlugin("stageZoom")}init(){if(!this.getStageZoomPlugin())throw new Error("WeaveZoomOutToolAction requires the WeaveStageZoomPlugin to be loaded")}trigger(r,l){const u=this.getStageZoomPlugin();u.canZoomOut()&&(u.zoomOut(),this.previousAction=l.previousAction,this.cancelAction=r,this.cancelAction())}cleanup(){const r=this.instance.getStage();this.instance.triggerAction(this.previousAction),r.container().style.cursor="default"}}class s0 extends gn{constructor(){super(...arguments);E(this,"previousAction");E(this,"cancelAction");E(this,"internalUpdate")}getName(){return"zoomInTool"}getStageZoomPlugin(){return this.instance.getPlugin("stageZoom")}init(){if(!this.getStageZoomPlugin())throw new Error("WeaveZoomInToolAction requires the WeaveStageZoomPlugin to be loaded")}trigger(r,l){const u=this.getStageZoomPlugin();u.canZoomIn()&&(u.zoomIn(),this.previousAction=l.previousAction,this.cancelAction=r,this.cancelAction())}cleanup(){const r=this.instance.getStage();this.instance.triggerAction(this.previousAction),r.container().style.cursor="default"}}class o0 extends gn{constructor(){super(...arguments);E(this,"previousAction");E(this,"cancelAction");E(this,"internalUpdate")}getName(){return"fitToScreenTool"}getStageZoomPlugin(){return this.instance.getPlugin("stageZoom")}init(){if(!this.getStageZoomPlugin())throw new Error("WeaveFitToScreenToolAction requires the WeaveStageZoomPlugin to be loaded")}trigger(r,l){this.getStageZoomPlugin().fitToScreen(),this.previousAction=l.previousAction,this.cancelAction=r,this.cancelAction()}cleanup(){const r=this.instance.getStage();this.instance.triggerAction(this.previousAction),r.container().style.cursor="default"}}class l0 extends gn{constructor(){super(...arguments);E(this,"previousAction");E(this,"cancelAction");E(this,"internalUpdate")}getName(){return"fitToSelectionTool"}getNodesSelectionPlugin(){return this.instance.getPlugin("nodesSelection")}getStageZoomPlugin(){return this.instance.getPlugin("stageZoom")}init(){if(!this.getStageZoomPlugin())throw new Error("WeaveFitToSelectionTool requires the WeaveStageZoomPlugin to be loaded");if(!this.getNodesSelectionPlugin())throw new Error("WeaveFitToSelectionTool requires the WeaveNodeSelectionPlugin to be loaded")}trigger(r,l){this.getStageZoomPlugin().fitToSelection(),this.previousAction=l.previousAction,this.cancelAction=r,this.cancelAction()}cleanup(){const r=this.instance.getStage();this.instance.triggerAction(this.previousAction),r.container().style.cursor="default"}}const lf="moveTool",hu={IDLE:"idle",MOVING:"moving"};class a0 extends gn{constructor(){super();E(this,"initialized",!1);E(this,"state");E(this,"cancelAction");E(this,"internalUpdate");E(this,"init");this.initialized=!1,this.state=hu.IDLE}getName(){return lf}setupEvents(){this.initialized=!0}setState(r){this.state=r}setMoving(){const r=this.instance.getStage();r.container().style.cursor="grab",r.container().focus(),this.setState(hu.MOVING)}trigger(r){if(!this.instance)throw new Error("Instance not defined");this.initialized||this.setupEvents();const l=this.instance.getStage();l.container().tabIndex=1,l.container().focus(),this.cancelAction=r,this.setMoving()}cleanup(){const r=this.instance.getStage();r.container().style.cursor="default";const l=this.instance.getPlugin("nodesSelection");if(l){const u=l.getTransformer();this.instance.disablePlugin("nodesSelection"),u.hide()}this.setState(hu.IDLE)}}const Xc="selectionTool",gu={IDLE:"idle",SELECTING:"selection"};class u0 extends gn{constructor(){super();E(this,"initialized",!1);E(this,"state");E(this,"cancelAction");E(this,"internalUpdate");E(this,"init");this.initialized=!1,this.state=gu.IDLE}getName(){return Xc}setupEvents(){this.initialized=!0}setState(r){this.state=r}setSelection(){const r=this.instance.getStage(),l=this.instance.getPlugin("nodesSelection");if(l){const u=l.getTransformer();this.instance.enablePlugin("nodesSelection"),u.show()}r.container().style.cursor="default",r.container().focus(),this.setState(gu.SELECTING)}trigger(r){if(!this.instance)throw new Error("Instance not defined");this.initialized||this.setupEvents();const l=this.instance.getStage();l.container().tabIndex=1,l.container().focus(),this.cancelAction=r,this.setSelection()}cleanup(){const r=this.instance.getStage();r.container().style.cursor="default";const l=this.instance.getPlugin("nodesSelection");if(l){const u=l.getTransformer();this.instance.disablePlugin("nodesSelection"),u.hide()}this.setState(gu.IDLE)}}const af="rectangleTool",hr={IDLE:"idle",ADDING:"adding",DEFINING_SIZE:"definingSize",ADDED:"added"};class c0 extends gn{constructor(r){super(r);E(this,"initialized",!1);E(this,"state");E(this,"rectId");E(this,"creating");E(this,"moved");E(this,"clickPoint");E(this,"container");E(this,"cancelAction");E(this,"internalUpdate");E(this,"init");this.initialized=!1,this.state=hr.IDLE,this.rectId=null,this.creating=!1,this.moved=!1,this.container=void 0,this.clickPoint=null,this.props=this.initProps()}getName(){return af}initProps(){return{opacity:1,fill:"#71717aff",stroke:"#000000ff",strokeWidth:1,width:100,height:100}}setupEvents(){const r=this.instance.getStage();r.container().addEventListener("keydown",l=>{if(l.key==="Enter"){this.cancelAction();return}if(l.key==="Escape"){this.cancelAction();return}}),r.on("mousedown touchstart",l=>{l.evt.preventDefault(),this.state===hr.ADDING&&(this.creating=!0,this.handleAdding())}),r.on("mousemove touchmove",l=>{l.evt.preventDefault(),this.state===hr.DEFINING_SIZE&&(this.moved=!0,this.handleMovement())}),r.on("mouseup touchend",l=>{l.evt.preventDefault(),this.state===hr.DEFINING_SIZE&&(this.creating=!1,this.handleSettingSize())}),this.initialized=!0}setState(r){this.state=r}addRectangle(){const r=this.instance.getStage();r.container().style.cursor="crosshair",r.container().focus(),this.clickPoint=null,this.setState(hr.ADDING)}handleAdding(){var g,v,S;const{mousePoint:r,container:l}=this.instance.getMousePointer();this.clickPoint=r,this.container=l,this.rectId=et();const h=this.instance.getNodeHandler("rectangle").createNode(this.rectId,{...this.props,x:((g=this.clickPoint)==null?void 0:g.x)??0,y:((v=this.clickPoint)==null?void 0:v.y)??0,width:0,height:0});this.instance.addNode(h,(S=this.container)==null?void 0:S.getAttrs().id),this.setState(hr.DEFINING_SIZE)}handleSettingSize(){var l,u;const r=this.instance.getStage().findOne(`#${this.rectId}`);if(this.rectId&&this.clickPoint&&this.container&&r){const{mousePoint:h}=this.instance.getMousePointerRelativeToContainer(this.container),g=h.x-((l=this.clickPoint)==null?void 0:l.x),v=h.y-((u=this.clickPoint)==null?void 0:u.y),S=this.instance.getNodeHandler("rectangle");r.setAttrs({...this.props,x:this.moved?r.getAttrs().x:this.clickPoint.x,y:this.moved?r.getAttrs().y:this.clickPoint.y,width:this.moved?Math.abs(g):this.props.width,height:this.moved?Math.abs(v):this.props.height}),this.instance.updateNode(S.toNode(r))}this.cancelAction()}handleMovement(){var l,u;if(this.state!==hr.DEFINING_SIZE)return;const r=this.instance.getStage().findOne(`#${this.rectId}`);if(this.rectId&&this.container&&this.clickPoint&&r){const{mousePoint:h}=this.instance.getMousePointerRelativeToContainer(this.container),g=h.x-((l=this.clickPoint)==null?void 0:l.x),v=h.y-((u=this.clickPoint)==null?void 0:u.y),S=this.instance.getNodeHandler("rectangle");r.setAttrs({width:g,height:v}),this.instance.updateNode(S.toNode(r))}}trigger(r){if(!this.instance)throw new Error("Instance not defined");this.initialized||this.setupEvents();const l=this.instance.getStage();l.container().tabIndex=1,l.container().focus(),this.cancelAction=r,this.props=this.initProps(),this.addRectangle()}cleanup(){const r=this.instance.getStage();r.container().style.cursor="default";const l=this.instance.getPlugin("nodesSelection");if(l){const u=r.findOne(`#${this.rectId}`);u&&l.setSelectedNodes([u]),this.instance.triggerAction(Xc)}this.rectId=null,this.creating=!1,this.moved=!1,this.container=void 0,this.clickPoint=null,this.setState(hr.IDLE)}}const Di={IDLE:"idle",ADDING:"adding",DEFINING_SIZE:"definingSize",ADDED:"added"};class d0 extends gn{constructor(r){super(r);E(this,"initialized",!1);E(this,"initialCursor",null);E(this,"state");E(this,"lineId");E(this,"tempLineId");E(this,"container");E(this,"measureContainer");E(this,"clickPoint");E(this,"tempPoint");E(this,"tempNextPoint");E(this,"cancelAction");E(this,"internalUpdate");E(this,"init");this.initialized=!1,this.state=Di.IDLE,this.lineId=null,this.tempLineId=null,this.container=void 0,this.measureContainer=void 0,this.clickPoint=null,this.tempPoint=void 0,this.tempNextPoint=void 0,this.props=this.initProps()}getName(){return"penTool"}initProps(){return{stroke:"#000000ff",strokeWidth:1,opacity:1}}setupEvents(){const r=this.instance.getStage();r.container().addEventListener("keydown",l=>{if(l.key==="Enter"){this.cancelAction();return}if(l.key==="Escape"){this.cancelAction();return}}),r.on("dblclick dbltap",l=>{l.evt.preventDefault(),this.cancelAction()}),r.on("click tap",l=>{if(l.evt.preventDefault(),this.state!==Di.IDLE){if(this.state===Di.ADDING){this.handleAdding();return}if(this.state===Di.DEFINING_SIZE){this.handleSettingSize();return}}}),r.on("mousemove touchmove",l=>{l.evt.preventDefault(),this.handleMovement()}),this.initialized=!0}setState(r){this.state=r}addLine(){const r=this.instance.getStage();r.container().style.cursor="crosshair",this.tempPoint=void 0,this.tempNextPoint=void 0,this.clickPoint=null,this.setState(Di.ADDING)}handleAdding(){var _,C,R,D,H,Z,F,Y,X,se,j,ye;const r=this.instance.getStage(),{mousePoint:l,container:u,measureContainer:h}=this.instance.getMousePointer();this.clickPoint=l,this.container=u,this.measureContainer=h,this.lineId=et(),this.tempLineId=et();const g=this.instance.getNodeHandler("line"),v=g.createNode(this.lineId,{...this.props,x:((_=this.clickPoint)==null?void 0:_.x)??0,y:((C=this.clickPoint)==null?void 0:C.y)??0,points:[0,0]});this.instance.addNode(v,(R=this.container)==null?void 0:R.getAttrs().id),this.tempPoint=new ne.Circle({x:((D=this.clickPoint)==null?void 0:D.x)??0,y:((H=this.clickPoint)==null?void 0:H.y)??0,radius:5/r.scaleX(),stroke:"#cccccc",strokeWidth:0,fill:"#cccccc"}),(Z=this.measureContainer)==null||Z.add(this.tempPoint);const S=g.createNode(this.tempLineId,{...this.props,x:((F=this.clickPoint)==null?void 0:F.x)??0,y:((Y=this.clickPoint)==null?void 0:Y.y)??0,points:[0,0]});this.instance.addNode(S,(X=this.container)==null?void 0:X.getAttrs().id),this.tempNextPoint=new ne.Circle({x:((se=this.clickPoint)==null?void 0:se.x)??0,y:((j=this.clickPoint)==null?void 0:j.y)??0,radius:5/r.scaleX(),stroke:"#cccccc",strokeWidth:0,fill:"#cccccc"}),(ye=this.measureContainer)==null||ye.add(this.tempNextPoint),this.setState(Di.DEFINING_SIZE)}handleSettingSize(){const r=this.instance.getStage().findOne(`#${this.tempLineId}`),l=this.instance.getStage().findOne(`#${this.lineId}`);if(this.lineId&&this.tempPoint&&this.tempNextPoint&&this.measureContainer&&l&&r){const{mousePoint:u}=this.instance.getMousePointerRelativeToContainer(this.measureContainer),h=[...l.points()];h.push(u.x-l.x()),h.push(u.y-l.y()),l.setAttrs({...this.props,points:h});const g=this.instance.getNodeHandler("line");this.instance.updateNode(g.toNode(l)),this.tempPoint.setAttrs({x:u.x,y:u.y}),this.tempNextPoint.setAttrs({x:u.x,y:u.y}),r.setAttrs({...this.props,x:u.x,y:u.y,points:[0,0]}),this.instance.updateNode(g.toNode(r))}this.setState(Di.DEFINING_SIZE)}handleMovement(){if(this.state!==Di.DEFINING_SIZE)return;const r=this.instance.getStage().findOne(`#${this.tempLineId}`);if(this.lineId&&this.measureContainer&&this.tempNextPoint&&r){const{mousePoint:l}=this.instance.getMousePointerRelativeToContainer(this.measureContainer);r.setAttrs({...this.props,points:[r.points()[0],r.points()[1],l.x-r.x(),l.y-r.y()]});const u=this.instance.getNodeHandler("line");this.instance.updateNode(u.toNode(r)),this.tempNextPoint.setAttrs({x:l.x,y:l.y})}}trigger(r){if(!this.instance)throw new Error("Instance not defined");this.initialized||this.setupEvents();const l=this.instance.getStage();l.container().tabIndex=1,l.container().focus(),this.cancelAction=r,this.props=this.initProps(),this.addLine()}cleanup(){var g,v;const r=this.instance.getStage();(g=this.tempPoint)==null||g.destroy(),(v=this.tempNextPoint)==null||v.destroy();const l=this.instance.getStage().findOne(`#${this.tempLineId}`),u=this.instance.getStage().findOne(`#${this.lineId}`);if(l){const S=this.instance.getNodeHandler("line");this.instance.removeNode(S.toNode(l))}if(this.lineId&&u&&u.points().length<4){const S=this.instance.getNodeHandler("line");this.instance.removeNode(S.toNode(u))}if(this.lineId&&u&&u.points().length>=4){const S=this.instance.getNodeHandler("line");u.setAttrs({...this.props,strokeWidth:1,hitStrokeWidth:16}),this.instance.updateNode(S.toNode(u))}const h=this.instance.getPlugin("nodesSelection");if(h){const S=r.findOne(`#${this.lineId}`);S&&h.setSelectedNodes([S]),this.instance.triggerAction("selectionTool")}r.container().style.cursor="default",this.initialCursor=null,this.tempPoint=void 0,this.tempNextPoint=void 0,this.lineId=null,this.tempLineId=null,this.container=void 0,this.clickPoint=null,this.setState(Di.IDLE)}}const Wi={INACTIVE:"inactive",IDLE:"idle",DEFINE_STROKE:"defineStroke"};class f0 extends gn{constructor(r){super(r);E(this,"initialized",!1);E(this,"state");E(this,"clickPoint");E(this,"strokeId");E(this,"container");E(this,"measureContainer");E(this,"cancelAction");E(this,"internalUpdate");E(this,"init");this.initialized=!1,this.state=Wi.INACTIVE,this.strokeId=null,this.clickPoint=null,this.container=void 0,this.measureContainer=void 0,this.props=this.initProps()}getName(){return"brushTool"}initProps(){return{stroke:"#000000ff",strokeWidth:1,opacity:1}}setupEvents(){const r=this.instance.getStage();r.container().tabIndex=1,r.container().focus(),r.container().addEventListener("keydown",l=>{if(l.key==="Enter"){this.cancelAction();return}if(l.key==="Escape"){this.cancelAction();return}}),r.on("mousedown touchstart",l=>{this.state===Wi.IDLE&&(this.handleStartStroke(),l.evt.preventDefault(),l.evt.stopPropagation())}),r.on("mousemove touchmove",l=>{this.state===Wi.DEFINE_STROKE&&(this.handleMovement(),l.evt.preventDefault(),l.evt.stopPropagation())}),r.on("mouseup touchend",l=>{this.state===Wi.DEFINE_STROKE&&(this.handleEndStroke(),l.evt.preventDefault(),l.evt.stopPropagation())}),this.initialized=!0}setState(r){this.state=r}handleStartStroke(){var v,S,_;const{mousePoint:r,container:l,measureContainer:u}=this.instance.getMousePointer();this.clickPoint=r,this.container=l,this.measureContainer=u,this.strokeId=et();const g=this.instance.getNodeHandler("line").createNode(this.strokeId,{...this.props,x:((v=this.clickPoint)==null?void 0:v.x)??0,y:((S=this.clickPoint)==null?void 0:S.y)??0,points:[0,0]});this.instance.addNode(g,(_=this.container)==null?void 0:_.getAttrs().id),this.setState(Wi.DEFINE_STROKE)}handleEndStroke(){const r=this.instance.getStage(),l=this.instance.getStage().findOne(`#${this.strokeId}`);if(l){const u=this.instance.getNodeHandler("line");l.setAttrs({...this.props,hitStrokeWidth:10}),this.instance.updateNode(u.toNode(l)),this.clickPoint=null,r.container().tabIndex=1,r.container().focus(),this.setState(Wi.IDLE)}}handleMovement(){if(this.state!==Wi.DEFINE_STROKE)return;const r=this.instance.getStage().findOne(`#${this.strokeId}`);if(this.measureContainer&&r){const{mousePoint:l}=this.instance.getMousePointerRelativeToContainer(this.measureContainer);r.points([...r.points(),l.x-r.x(),l.y-r.y()]);const u=this.instance.getNodeHandler("line");this.instance.updateNode(u.toNode(r))}}trigger(r){if(!this.instance)throw new Error("Instance not defined");this.initialized||this.setupEvents();const l=this.instance.getPlugin("nodesSelection");l&&l.getTransformer().hide();const u=this.instance.getStage();u.container().tabIndex=1,u.container().focus(),this.cancelAction=r,this.props=this.initProps(),this.setState(Wi.IDLE),u.container().style.cursor="crosshair"}cleanup(){const r=this.instance.getStage();r.container().style.cursor="default";const l=this.instance.getPlugin("nodesSelection");if(l){const u=r.findOne(`#${this.strokeId}`);u&&l.setSelectedNodes([u]),this.instance.triggerAction("selectionTool")}this.clickPoint=null,this.setState(Wi.INACTIVE)}}const bs={IDLE:"idle",ADDING:"adding",FINISHED:"finished"};class h0 extends gn{constructor(){super();E(this,"initialized",!1);E(this,"initialCursor",null);E(this,"state");E(this,"textId");E(this,"container");E(this,"clickPoint");E(this,"cancelAction");E(this,"internalUpdate");E(this,"init");this.initialized=!1,this.state=bs.IDLE,this.textId=null,this.container=void 0,this.clickPoint=null}getName(){return"textTool"}setupEvents(){const r=this.instance.getStage();r.container().addEventListener("keydown",l=>{if(l.key==="Escape"){this.cancelAction();return}}),r.on("click tap",l=>{if(l.evt.preventDefault(),this.state!==bs.IDLE&&this.state===bs.ADDING){this.handleAdding();return}}),r.on("mousemove touchmove",l=>{l.evt.preventDefault()}),this.initialized=!0}setState(r){this.state=r}addText(){const r=this.instance.getStage(),l=this.instance.getPlugin("nodesSelection");l&&l.getTransformer().hide(),r.container().style.cursor="crosshair",this.clickPoint=null,this.setState(bs.ADDING)}handleAdding(){var g,v,S;const{mousePoint:r,container:l}=this.instance.getMousePointer();this.clickPoint=r,this.container=l,this.textId=et();const h=this.instance.getNodeHandler("text").createNode(this.textId,{x:((g=this.clickPoint)==null?void 0:g.x)??0,y:((v=this.clickPoint)==null?void 0:v.y)??0,text:"Your text here...",width:300,fontSize:20,fontFamily:"NotoSansMono, monospace",fill:"#000000ff",strokeEnabled:!1,stroke:"#000000ff",strokeWidth:1,align:"left",verticalAlign:"top",opacity:1,draggable:!0});this.instance.addNode(h,(S=this.container)==null?void 0:S.getAttrs().id),this.setState(bs.FINISHED),this.cancelAction()}trigger(r){if(!this.instance)throw new Error("Instance not defined");this.initialized||this.setupEvents(),this.cancelAction=r,this.addText()}cleanup(){const r=this.instance.getStage();r.container().style.cursor="default";const l=r.findOne(`#${this.textId}`);l&&l.getAttr("triggerEditMode")(l),this.initialCursor=null,this.textId=null,this.container=void 0,this.clickPoint=null,this.setState(bs.IDLE)}}const Ui={IDLE:"idle",UPLOADING:"uploading",ADDING:"adding",FINISHED:"finished"};class g0 extends gn{constructor(r){const{onPropsChange:l,...u}=r;super({onPropsChange:l});E(this,"imageCallbacks");E(this,"initialized",!1);E(this,"initialCursor",null);E(this,"state");E(this,"imageId");E(this,"tempImageId");E(this,"container");E(this,"imageURL");E(this,"preloadImgs");E(this,"clickPoint");E(this,"cancelAction");E(this,"update");this.imageCallbacks=u,this.initialized=!1,this.state=Ui.IDLE,this.imageId=null,this.tempImageId=null,this.container=void 0,this.imageURL=null,this.preloadImgs={},this.clickPoint=null}getName(){return"imageTool"}getPreloadedImage(r){var l;return(l=this.preloadImgs)==null?void 0:l[r]}initProps(){return{width:100,height:100,scaleX:1,scaleY:1}}init(){this.instance.addEventListener("onStageDrop",()=>{window.weaveDragImageURL&&(this.instance.triggerAction("imageTool",{imageURL:window.weaveDragImageURL}),window.weaveDragImageURL=void 0)})}setupEvents(){const r=this.instance.getStage();r.container().addEventListener("keydown",l=>{l.key==="Escape"&&this.cancelAction(),l.preventDefault()}),r.on("click tap",l=>{if(l.evt.preventDefault(),this.state!==Ui.IDLE&&this.state!==Ui.UPLOADING&&this.state===Ui.ADDING){this.handleAdding();return}}),r.on("mousemove touchmove",l=>{l.evt.preventDefault();const u=this.instance.getStage().findOne(`#${this.tempImageId}`);if(this.state===Ui.ADDING&&u){const h=r.getRelativePointerPosition();u.setAttrs({...this.props,name:void 0,x:((h==null?void 0:h.x)??0)+2,y:((h==null?void 0:h.y)??0)+2,fill:"#ccccccff",stroke:"#000000ff",strokeWidth:1});const g=this.instance.getNodeHandler("rectangle");this.instance.updateNode(g.toNode(u))}}),this.initialized=!0}setState(r){this.state=r}loadImage(r){var u,h;const l=this.instance.getStage();l.container().style.cursor="crosshair",l.container().focus(),this.imageId=et(),this.imageURL=r,this.preloadImgs[this.imageId]=new Image,this.preloadImgs[this.imageId].onerror=g=>{console.error(g)},this.preloadImgs[this.imageId].onload=()=>{var g,v;(v=(g=this.imageCallbacks)==null?void 0:g.onImageLoadEnd)==null||v.call(g),this.imageId&&(this.props={...this.props,width:this.preloadImgs[this.imageId].width,height:this.preloadImgs[this.imageId].height}),this.addImageNode()},this.preloadImgs[this.imageId].onerror=()=>{var g,v;(v=(g=this.imageCallbacks)==null?void 0:g.onImageLoadEnd)==null||v.call(g,new Error("Error loading image")),this.cancelAction()},this.preloadImgs[this.imageId].src=r,(h=(u=this.imageCallbacks)==null?void 0:u.onImageLoadStart)==null||h.call(u)}addImageNode(){var l;const r=this.instance.getStage();if(r.container().style.cursor="crosshair",r.container().focus(),this.imageId){const u=r.getRelativePointerPosition(),h=this.instance.getNodeHandler("rectangle");this.tempImageId=et();const g=h.createNode(this.tempImageId,{...this.props,x:((u==null?void 0:u.x)??0)+5,y:((u==null?void 0:u.y)??0)+5,width:this.preloadImgs[this.imageId].width,height:this.preloadImgs[this.imageId].height,fill:"#ccccccff",stroke:"#000000ff",strokeWidth:1});this.instance.addNode(g,(l=this.container)==null?void 0:l.getAttrs().id)}this.clickPoint=null,this.setState(Ui.ADDING)}addImage(){var r;(r=this.imageCallbacks)==null||r.onUploadImage(this.loadImage.bind(this)),this.setState(Ui.UPLOADING)}handleAdding(){var l,u,h;const r=this.instance.getStage().findOne(`#${this.tempImageId}`);if(this.imageId&&this.imageURL&&this.preloadImgs[this.imageId]&&r){const{mousePoint:g,container:v}=this.instance.getMousePointer();this.clickPoint=g,this.container=v;const _=this.instance.getNodeHandler("image").createNode(this.imageId,{...this.props,x:((l=this.clickPoint)==null?void 0:l.x)??0,y:((u=this.clickPoint)==null?void 0:u.y)??0,opacity:1,imageURL:this.imageURL,stroke:"#000000ff",strokeWidth:0,imageInfo:{width:this.preloadImgs[this.imageId].width,height:this.preloadImgs[this.imageId].height}});this.instance.addNode(_,(h=this.container)==null?void 0:h.getAttrs().id);const C=this.instance.getNodeHandler("rectangle");this.instance.removeNode(C.toNode(r)),this.setState(Ui.FINISHED)}this.cancelAction()}trigger(r,l){if(!this.instance)throw new Error("Instance not defined");if(this.initialized||this.setupEvents(),this.cancelAction=r,l!=null&&l.imageURL){this.loadImage(l.imageURL);return}return this.props=this.initProps(),this.addImage(),{finishUploadCallback:this.loadImage.bind(this)}}internalUpdate(){var l;if((l=this.instance)==null?void 0:l.getStage()){const u=this.instance.getStage().findOne(`#${this.tempImageId}`);if(u){u.setAttrs({...this.props,name:void 0,fill:"#ccccccff",stroke:"#000000ff",strokeWidth:1});const h=this.instance.getNodeHandler("rectangle");this.instance.updateNode(h.toNode(u))}}}cleanup(){const r=this.instance.getStage();this.imageId&&delete this.preloadImgs[this.imageId];const l=this.instance.getStage().findOne(`#${this.tempImageId}`);if(l){const h=this.instance.getNodeHandler("rectangle");this.instance.removeNode(h.toNode(l))}const u=this.instance.getPlugin("nodesSelection");if(u){const h=r.findOne(`#${this.imageId}`);h&&u.setSelectedNodes([h]),this.instance.triggerAction("selectionTool")}r.container().style.cursor="default",this.initialCursor=null,this.imageId=null,this.container=void 0,this.imageURL=null,this.clickPoint=null,this.setState(Ui.IDLE)}}const uf="frameTool",bo={IDLE:"idle",ADDING:"adding",ADDED:"added"};class p0 extends gn{constructor(r){super(r);E(this,"initialized",!1);E(this,"state");E(this,"frameId");E(this,"container");E(this,"clickPoint");E(this,"cancelAction");E(this,"internalUpdate");E(this,"init");this.initialized=!1,this.state=bo.IDLE,this.frameId=null,this.container=void 0,this.clickPoint=null}getName(){return uf}initProps(r){return{title:"Frame XXX",fontFamily:(r==null?void 0:r.fontFamily)??"Arial",editing:!1,opacity:1}}setupEvents(){const r=this.instance.getStage();r.container().addEventListener("keydown",l=>{if(l.key==="Escape"){this.cancelAction();return}}),r.on("click tap",l=>{if(l.evt.preventDefault(),this.state!==bo.IDLE&&this.state===bo.ADDING){this.handleAdding();return}}),this.initialized=!0}setState(r){this.state=r}addFrame(){const r=this.instance.getStage();r.container().style.cursor="crosshair",r.container().focus(),this.frameId=null,this.clickPoint=null,this.setState(bo.ADDING)}handleAdding(){var g,v,S;const{mousePoint:r,container:l}=this.instance.getMousePointer();if((l==null?void 0:l.getAttrs().id)!==wu){(g=this.cancelAction)==null||g.call(this);return}this.clickPoint=r,this.container=l,this.frameId=et();const h=this.instance.getNodeHandler("frame").createNode(this.frameId,{...this.props,x:this.clickPoint.x,y:this.clickPoint.y});this.instance.addNode(h,(v=this.container)==null?void 0:v.getAttrs().id),(S=this.cancelAction)==null||S.call(this)}trigger(r,l){if(!this.instance)throw new Error("Instance not defined");this.initialized||this.setupEvents();const u=this.instance.getStage();u.container().tabIndex=1,u.container().focus(),this.cancelAction=r,this.props=this.initProps(l),this.addFrame()}cleanup(){const r=this.instance.getStage();r.container().style.cursor="default";const l=this.instance.getPlugin("nodesSelection");if(l){const u=r.findOne(`#${this.frameId}`);u&&l.setSelectedNodes([u]),this.instance.triggerAction("selectionTool")}this.frameId=null,this.container=void 0,this.clickPoint=null,this.setState(bo.IDLE)}}class m0 extends gn{constructor(){super(...arguments);E(this,"cancelAction");E(this,"defaultFormatOptions",{format:Go.PNG,padding:0,pixelRatio:1,backgroundColor:xu,quality:1});E(this,"options");E(this,"internalUpdate");E(this,"init")}getName(){return"exportStageTool"}async exportStage(){var u;const r=await this.instance.exportStage(this.options),l=document.createElement("a");l.href=r.src,l.download=`stage${jd[this.options.format??Go.PNG]}`,l.click(),(u=this.cancelAction)==null||u.call(this)}async trigger(r,{options:l}){if(!this.instance)throw new Error("Instance not defined");const u=this.instance.getStage();u.container().tabIndex=1,u.container().focus(),this.cancelAction=r,this.options={...this.defaultFormatOptions,...l},await this.exportStage()}cleanup(){const r=this.instance.getStage();r.container().tabIndex=0,r.container().click(),r.container().focus(),this.instance.triggerAction("selectionTool")}}class v0 extends gn{constructor(){super(...arguments);E(this,"cancelAction");E(this,"defaultFormatOptions",{format:Go.PNG,padding:0,pixelRatio:1,backgroundColor:xu,quality:1});E(this,"options");E(this,"internalUpdate");E(this,"init")}getName(){return"exportNodeTool"}async exportNode(r){var h;const l=await this.instance.exportNode(r,this.options),u=document.createElement("a");u.href=l.src,u.download=`node-${r.getAttrs().id}${jd[this.options.format??Go.PNG]}`,u.click(),(h=this.cancelAction)==null||h.call(this)}async trigger(r,{node:l,options:u}){if(!this.instance)throw new Error("Instance not defined");const h=this.instance.getStage();h.container().tabIndex=1,h.container().focus(),this.cancelAction=r,this.options={...this.defaultFormatOptions,...u},await this.exportNode(l)}cleanup(){const r=this.instance.getStage();r.container().tabIndex=0,r.container().click(),r.container().focus(),this.instance.triggerAction("selectionTool")}}const cf=50,bc="gridLayer",Bc={LINES:"lines",DOTS:"dots"};class y0 extends ti{constructor(r){super();E(this,"moveToolActive");E(this,"isMouseMiddleButtonPressed");E(this,"isSpaceKeyPressed");E(this,"type","lines");E(this,"gridColor","rgba(0,0,0,0.2)");E(this,"originColor","rgba(255,0,0,0.2)");E(this,"gridSize");const{gridSize:l=cf}=r;this.moveToolActive=!1,this.isMouseMiddleButtonPressed=!1,this.isSpaceKeyPressed=!1,this.gridSize=l}registersLayers(){return!0}getName(){return"stageGrid"}getLayerName(){return bc}initLayer(){const r=this.instance.getStage(),l=new ne.Layer({id:this.getLayerName(),listening:!1});r.add(l)}init(){this.initEvents(),this.renderGrid()}initEvents(){const r=this.instance.getStage();r.container().addEventListener("keydown",l=>{l.code==="Space"&&(this.isSpaceKeyPressed=!0)}),r.container().addEventListener("keyup",l=>{l.code==="Space"&&(this.isSpaceKeyPressed=!1)}),r.on("mousedown",l=>{const u=this.instance.getActiveAction();l&&l.evt.button===0&&u==="moveTool"&&(this.moveToolActive=!0,l.cancelBubble=!0),l&&(l.evt.button===2||l.evt.buttons===4)&&(this.isMouseMiddleButtonPressed=!0,l.cancelBubble=!0)}),r.on("mouseup",l=>{const u=this.instance.getActiveAction();l&&l.evt.button===0&&u==="moveTool"&&(this.moveToolActive=!1,l.cancelBubble=!0),l&&(l.evt.button===1||l.evt.buttons===0)&&(this.isMouseMiddleButtonPressed=!1,l.cancelBubble=!0)}),r.on("mousemove",l=>{l.evt.preventDefault(),!(!this.enabled||!(this.isSpaceKeyPressed||this.isMouseMiddleButtonPressed||this.moveToolActive))&&this.render()}),r.on("touchmove",l=>{l.evt.preventDefault(),this.enabled&&this.render()}),r.on("wheel",l=>{l.evt.preventDefault(),!(!this.enabled||this.isSpaceKeyPressed||this.isMouseMiddleButtonPressed)&&this.render()})}getLayer(){return this.instance.getStage().findOne(`#${bc}`)}renderGrid(){const r=this.getLayer();if(r&&(r.destroyChildren(),!!this.enabled))switch(this.type){case Bc.LINES:this.renderGridLines();break;case Bc.DOTS:this.renderGridDots();break;default:this.renderGridLines();break}}round(r,l){return Math.round(r/l)*l}renderGridLines(){const r=this.getLayer();if(!r)return;const l=this.instance.getStage(),u=this.round(l.x(),this.gridSize)*-1,h=[];for(let S=u;S<u+l.width();S+=this.gridSize)h.push(S/l.scaleX());const g=this.round(l.y(),this.gridSize)*-1,v=[];for(let S=g;S<g+l.height();S+=this.gridSize)v.push(S/l.scaleY());for(let S=0;S<h.length;S++){const _=h[S];let C=this.gridColor;_===0&&(C=this.originColor),r.add(new Ud.Line({points:[_,(-l.y()-2*this.gridSize)/l.scaleY(),_,(l.height()-l.y()+2*this.gridSize)/l.scaleY()],stroke:C,strokeWidth:(_%(10*(this.gridSize/l.scaleX()))===0?2.5:.5)/l.scaleX(),listening:!1}))}for(let S=0;S<v.length;S++){const _=v[S];let C=this.gridColor;_===0&&(C=this.originColor),r.add(new Ud.Line({points:[(-l.x()-2*this.gridSize)/l.scaleX(),_,(l.width()-l.x()+2*this.gridSize)/l.scaleX(),_],stroke:C,strokeWidth:(_%(10*(this.gridSize/l.scaleY()))===0?2.5:.5)/l.scaleX(),listening:!1}))}}renderGridDots(){const r=this.getLayer();if(!r)return;const l=this.instance.getStage(),u=this.round(l.x(),this.gridSize)*-1,h=[];for(let S=u;S<u+l.width();S+=this.gridSize)h.push(S/l.scaleX());const g=this.round(l.y(),this.gridSize)*-1,v=[];for(let S=g;S<g+l.height();S+=this.gridSize)v.push(S/l.scaleY());for(let S=0;S<h.length;S++){const _=h[S];for(let C=0;C<v.length;C++){const R=v[C];let D=this.gridColor;(_===0||R===0)&&(D=this.originColor),r.add(new Bm.Circle({x:_,y:R,radius:(_===0||R===0?2.5:1.5)/l.scaleX(),fill:D,stroke:D,strokeWidth:0,listening:!1}))}}}render(){this.renderGrid()}enable(){var r;this.enabled=!0,(r=this.getLayer())==null||r.show(),this.render()}disable(){var r;this.enabled=!1,(r=this.getLayer())==null||r.hide(),this.render()}getType(){return this.type}setType(r){this.type=r,this.render()}}class S0 extends ti{constructor(){super();E(this,"moveToolActive");E(this,"isMouseMiddleButtonPressed");E(this,"isSpaceKeyPressed");E(this,"previousPointer");E(this,"getLayerName");E(this,"initLayer");E(this,"render");this.enabled=!0,this.moveToolActive=!1,this.isMouseMiddleButtonPressed=!1,this.isSpaceKeyPressed=!1,this.previousPointer=null}registersLayers(){return!1}getName(){return"stagePanning"}init(){this.initEvents()}enableMove(){const r=this.instance.getStage();r.container().style.cursor!=="grabbing"&&(this.previousPointer=r.container().style.cursor,r.container().style.cursor="grabbing")}disableMove(){const r=this.instance.getStage();r.container().style.cursor==="grabbing"&&(r.container().style.cursor=this.previousPointer??"default",this.previousPointer=null)}initEvents(){let r=1/0,l=1/0;const u=this.instance.getStage();u.container().addEventListener("keydown",h=>{h.code==="Space"&&(this.isSpaceKeyPressed=!0,this.enableMove())}),u.container().addEventListener("keyup",h=>{h.code==="Space"&&(this.isSpaceKeyPressed=!1,this.disableMove())}),u.on("mousedown",h=>{const g=this.instance.getActiveAction();let v=!1;h&&h.evt.button===0&&g==="moveTool"&&(this.moveToolActive=!0,v=!0),h&&(h.evt.button===2||h.evt.buttons===4)&&(this.isMouseMiddleButtonPressed=!0,v=!0),v&&(this.enableMove(),h.cancelBubble=!0)}),u.on("mouseup",h=>{const g=this.instance.getActiveAction();let v=!1;h&&h.evt.button===0&&g==="moveTool"&&(this.moveToolActive=!1,v=!0),h&&(h.evt.button===1||h.evt.buttons===0)&&(this.isMouseMiddleButtonPressed=!1,v=!0),v&&(this.disableMove(),h.cancelBubble=!0)}),u.on("mousemove",h=>{h.evt.preventDefault();const g=u.getPointerPosition();r===1/0&&(r=(g==null?void 0:g.x)??0),l===1/0&&(l=(g==null?void 0:g.y)??0);const v=r-((g==null?void 0:g.x)??0),S=l-((g==null?void 0:g.y)??0);r=(g==null?void 0:g.x)??0,l=(g==null?void 0:g.y)??0,!(!this.enabled||!(this.isSpaceKeyPressed||this.isMouseMiddleButtonPressed||this.moveToolActive))&&(u.x(u.x()-v),u.y(u.y()-S))}),u.on("touchstart",h=>{h.evt.preventDefault();const g=u.getPointerPosition();r=(g==null?void 0:g.x)??0,l=(g==null?void 0:g.y)??0}),u.on("touchmove",h=>{if(h.evt.preventDefault(),this.instance.getActiveAction()!=="moveTool")return;const v=u.getPointerPosition();r===1/0&&(r=(v==null?void 0:v.x)??0),l===1/0&&(l=(v==null?void 0:v.y)??0);const S=r-((v==null?void 0:v.x)??0),_=l-((v==null?void 0:v.y)??0);r=(v==null?void 0:v.x)??0,l=(v==null?void 0:v.y)??0,this.enabled&&(u.x(u.x()-S),u.y(u.y()-_))}),u.on("wheel",h=>{h.evt.preventDefault(),!(!this.enabled||this.isSpaceKeyPressed||this.isMouseMiddleButtonPressed)&&(u.x(u.x()-h.evt.deltaX),u.y(u.y()-h.evt.deltaY))})}enable(){this.enabled=!0}disable(){this.enabled=!1}}class w0 extends ti{constructor(){super(...arguments);E(this,"getLayerName");E(this,"initLayer");E(this,"render")}registersLayers(){return!1}getName(){return"stageResize"}init(){const r=this.instance.getStage();window.addEventListener("resize",()=>{var u;const l=r.container().parentNode;if(this.enabled&&l){const h=r.container().getBoundingClientRect(),g=h.width,v=h.height;r.width(g),r.height(v);const S=this.instance.getPlugins();for(const _ of Object.keys(S)){const C=S[_];(u=C.render)==null||u.call(C)}}})}enable(){this.enabled=!0}disable(){this.enabled=!1}}class x0 extends ti{constructor(r){super();E(this,"getLayerName");E(this,"initLayer");E(this,"render");E(this,"zoomSteps");E(this,"actualScale");E(this,"actualStep");E(this,"padding",100);E(this,"defaultStep");E(this,"onZoomChangeCb");const{zoomSteps:l=[.1,.25,.5,1,2,4,8],defaultZoom:u=1,onZoomChange:h}=r;if(this.zoomSteps=l,!this.zoomSteps.includes(u))throw new Error(`Default zoom ${u} is not in zoom steps`);this.actualStep=l.findIndex(g=>g===u),this.actualScale=this.zoomSteps[this.actualStep],this.defaultStep=this.actualStep,this.onZoomChangeCb=h}registersLayers(){return!1}getName(){return"stageZoom"}init(){this.setZoom(this.zoomSteps[this.actualStep])}setZoom(r,l=!0){var g,v;const u=this.instance.getStage();if(this.instance.getMainLayer()){const S=u.scaleX(),_=u.scale();if(_.x=r,_.y=r,u.scale(_),this.actualScale=r,l){const D={x:u.width()/2,y:u.height()/2},H={x:(D.x-u.x())/S,y:(D.y-u.y())/S},Z={x:D.x-H.x*r,y:D.y-H.y*r};u.position(Z)}const C=this.instance.getPlugins();for(const D of Object.keys(C)){const H=C[D];(g=H.render)==null||g.call(H)}const R={scale:r,zoomSteps:this.zoomSteps,actualStep:this.actualStep,onDefaultStep:this.actualStep===this.defaultStep,canZoomIn:this.canZoomIn(),canZoomOut:this.canZoomOut()};(v=this.onZoomChangeCb)==null||v.call(this,R),this.instance.emitEvent("onZoomChange",R)}}canZoomOut(){return this.enabled?(this.zoomSteps.findIndex(l=>l===this.actualScale)===-1&&(this.actualStep=this.findClosestStepIndex()),this.actualStep-1>0):!1}canZoomIn(){return this.enabled?(this.zoomSteps.findIndex(l=>l===this.actualScale)===-1&&(this.actualStep=this.findClosestStepIndex()),this.actualStep+1<this.zoomSteps.length):!1}zoomToStep(r){if(this.enabled){if(r<0||r>=this.zoomSteps.length)throw new Error(`Defined step ${r} is out of bounds`);this.actualStep=r,this.setZoom(this.zoomSteps[r])}}findClosestStepIndex(){let r=0,l=1/0;for(let u=0;u<this.zoomSteps.length;u++)Math.abs(this.zoomSteps[u]-this.actualScale)<l&&(r=u,l=Math.abs(this.zoomSteps[u]-this.actualScale));return r}zoomIn(){if(!this.enabled||!this.canZoomIn())return;this.zoomSteps.findIndex(l=>l===this.actualScale)===-1?this.actualStep=this.findClosestStepIndex():this.actualStep+=1,this.setZoom(this.zoomSteps[this.actualStep])}zoomOut(){if(!this.enabled||!this.canZoomOut())return;this.zoomSteps.findIndex(l=>l===this.actualScale)===-1?this.actualStep=this.findClosestStepIndex():this.actualStep-=1,this.setZoom(this.zoomSteps[this.actualStep])}fitToScreen(){if(!this.enabled)return;const r=this.instance.getMainLayer();if((r==null?void 0:r.getChildren().length)===0){this.setZoom(this.zoomSteps[this.defaultStep]);return}const l=this.instance.getStage();if(r){const u=r.getClientRect({relativeTo:l}),h=Math.min(l.width()/(u.width+this.padding*2),l.height()/(u.height+this.padding*2));l.setAttrs({x:-u.x*h+(l.width()-u.width*h)/2,y:-u.y*h+(l.height()-u.height*h)/2}),this.setZoom(h,!1)}}fitToSelection(){if(!this.enabled)return;const r=this.instance.getStage(),l=this.instance.getPlugin("nodesSelection");if(l.getTransformer().getNodes().length===0)return;let h=r.findOne("#zoomTransformer");if(!h){h=new ne.Transformer({id:"zoomTransformer",clearBeforeDraw:!0,resizeEnabled:!1,ignoreStroke:!0,rotateEnabled:!1,enabledAnchors:[],shouldOverdrawWholeArea:!0,scaleX:r.scaleX(),scaleY:r.scaleY()});const S=this.instance.getMainLayer();S==null||S.add(h)}this.setZoom(1,!1),r.setAttrs({x:0,y:0}),h.setNodes(l.getTransformer().getNodes()),h.forceUpdate();const g=h.__getNodeRect(),v=Math.min(r.width()/(h.width()+this.padding*2),r.height()/(h.height()+this.padding*2));r.setAttrs({x:-g.x*v+(r.width()-h.width()*v)/2,y:-g.y*v+(r.height()-h.height()*v)/2}),this.setZoom(v,!1),h.destroy()}enable(){this.enabled=!0}disable(){this.enabled=!1}}const df="selectionLayer";class P0 extends ti{constructor(r){super();E(this,"tr");E(this,"selectionRectangle");E(this,"active");E(this,"cameFromSelectingMultiple");E(this,"selecting");E(this,"initialized");E(this,"callbacks");E(this,"render");this.callbacks=r,this.active=!1,this.cameFromSelectingMultiple=!1,this.selecting=!1,this.initialized=!1,this.enabled=!1}registersLayers(){return!0}getName(){return"nodesSelection"}getLayerName(){return df}initLayer(){const r=this.instance.getStage(),l=new ne.Layer({id:this.getLayerName()});r.add(l)}init(){const r=this.instance.getStage(),l=this.getLayer();r.container().tabIndex=1,r.container().focus();const u=new ne.Rect({fill:"rgba(147, 197, 253, 0.25)",stroke:"#1e40afff",strokeWidth:1*r.scaleX(),dash:[12*r.scaleX(),4*r.scaleX()],visible:!1,listening:!1});l==null||l.add(u);const h=new ne.Transformer({id:"selectionTransformer",rotationSnaps:[0,45,90,135,180,225,270,315,360],rotationSnapTolerance:3,ignoreStroke:!0,flipEnabled:!1,useSingleNodeRotation:!0,shouldOverdrawWholeArea:!0,anchorStyleFunc:g=>{g.stroke("#27272aff"),g.cornerRadius(12),(g.hasName("top-center")||g.hasName("bottom-center"))&&(g.height(8),g.offsetY(4),g.width(32),g.offsetX(16)),(g.hasName("middle-left")||g.hasName("middle-right"))&&(g.height(32),g.offsetY(16),g.width(8),g.offsetX(4))},borderStroke:"#1e40afff"});l==null||l.add(h),h.on("mouseenter",g=>{const v=this.instance.getStage();v.container().style.cursor="grab",g.cancelBubble=!0}),h.on("mouseleave",g=>{const v=this.instance.getStage();v.container().style.cursor="default",g.cancelBubble=!0}),this.tr=h,this.selectionRectangle=u,this.tr.on("dblclick dbltap",g=>{g.cancelBubble=!0,this.tr.getNodes().length===1&&this.tr.getNodes()[0].fire("dblclick")}),this.initEvents(),this.initialized=!0,this.instance.on("onRender",()=>{this.triggerSelectedNodesEvent()}),this.instance.on("onActiveActionChange",g=>{if(typeof g<"u"&&g!=="selectionTool"){this.active=!1;return}this.active=!0}),this.instance.on("onNodeRemoved",g=>{const S=this.getSelectedNodes().filter(_=>_.getAttrs().id!==g.id);this.tr.nodes(S),this.triggerSelectedNodesEvent(),r.container().tabIndex=1,r.container().focus(),r.container().style.cursor="default"})}getLayer(){return this.instance.getStage().findOne(`#${this.getLayerName()}`)}triggerSelectedNodesEvent(){var l,u;const r=this.tr.getNodes().map(h=>{const g=h.getAttr("nodeType"),v=this.instance.getNodeHandler(g);return{instance:h,node:v.toNode(h)}});(u=(l=this.callbacks)==null?void 0:l.onNodesChange)==null||u.call(l,r),this.instance.emitEvent("onNodesChange",r)}initEvents(){let r,l,u,h;this.selecting=!1;const g=this.instance.getStage();g.container().addEventListener("keydown",v=>{if(v.key==="Backspace"||v.key==="Delete"){const _=this.getSelectedNodes().map(C=>this.instance.getNodeHandler(C.getAttrs().nodeType).toNode(C));this.instance.removeNodes(_),this.tr.nodes([]),this.triggerSelectedNodesEvent();return}}),g.on("mousedown touchstart",v=>{var C,R,D,H;if(!this.initialized||!this.active||v.evt.button&&v.evt.button!==0)return;const S=this.instance.getInstanceRecursive(v.target);if(!(v.target instanceof ne.Stage)&&!(S&&S.getAttrs().nodeType==="frame"))return;v.evt.preventDefault();const _=this.instance.getStage();r=((C=_.getRelativePointerPosition())==null?void 0:C.x)??0,l=((R=_.getRelativePointerPosition())==null?void 0:R.y)??0,u=((D=_.getRelativePointerPosition())==null?void 0:D.x)??0,h=((H=_.getRelativePointerPosition())==null?void 0:H.y)??0,this.selectionRectangle.strokeWidth(1/g.scaleX()),this.selectionRectangle.dash([12/g.scaleX(),4/g.scaleX()]),this.selectionRectangle.width(0),this.selectionRectangle.height(0),this.selecting=!0,v.target instanceof ne.Stage||(this.cameFromSelectingMultiple=!0)}),g.on("mousemove touchmove",v=>{var _,C;if(!this.initialized||!this.active)return;if(!this.selecting){this.cameFromSelectingMultiple=!1;return}v.evt.preventDefault();const S=this.instance.getStage();u=((_=S.getRelativePointerPosition())==null?void 0:_.x)??0,h=((C=S.getRelativePointerPosition())==null?void 0:C.y)??0,this.selectionRectangle.setAttrs({visible:!0,x:Math.min(r,u),y:Math.min(l,h),width:Math.abs(u-r),height:Math.abs(h-l)})}),g.on("mouseup touchend",v=>{if(!this.initialized||!this.active)return;if(this.selecting=!1,!this.selectionRectangle.visible()){this.cameFromSelectingMultiple=!1;return}v.evt.preventDefault(),this.tr.nodes([]),this.selectionRectangle.visible(!1);const S=g.find(F=>["Shape","Group"].includes(F.getType())&&typeof F.getAttrs().id<"u"),_=this.selectionRectangle.getClientRect(),C=S.filter(F=>{const Y=this.instance.getInstanceRecursive(F.getParent());if(F.getAttrs().nodeType&&F.getAttrs().nodeType==="frame"){const X=F.getClientRect();return X.x>=_.x&&X.y>=_.y&&X.x+X.width<=_.x+_.width&&X.y+X.height<=_.y+_.height}return F.getAttrs().nodeType&&(F==null?void 0:F.getAttrs().nodeType)==="group"&&["layer","frame"].includes(Y==null?void 0:Y.getAttrs().nodeType)||F.getAttrs().nodeType&&F.getAttrs().nodeType!=="group"&&["layer","frame"].includes(Y==null?void 0:Y.getAttrs().nodeType)?F.getAttrs().nodeType&&ne.Util.haveIntersection(_,F.getClientRect()):!1}),R=new Set,D=C.filter(F=>F.getAttrs().nodeType==="frame"),H=C.map(F=>F.getAttrs().id);C.filter(F=>F.getAttrs().nodeType!=="frame").forEach(F=>{const Y=this.instance.getInstanceRecursive(F.getParent());H.includes(Y==null?void 0:Y.getAttrs().id)||R.add(F)}),D.forEach(F=>{const Y=F;R.add(Y)}),this.tr.nodes([...R]),this.triggerSelectedNodesEvent(),g.container().tabIndex=1,g.container().focus()}),g.on("click tap",v=>{var F,Y;if(!this.enabled)return;const S=this.instance.getPlugin("contextMenu");if(this.cameFromSelectingMultiple){this.cameFromSelectingMultiple=!1;return}let _;const C=g.getPointerPosition();if(C){const X=g.getIntersection(C);X&&(_=this.instance.getInstanceRecursive(X))}if(!this.initialized||v.evt.button&&v.evt.button!==0||this.selectionRectangle.visible())return;if(v.target instanceof ne.Stage&&!_){this.tr.nodes([]),this.triggerSelectedNodesEvent(),S&&!S.isTapHold()&&((Y=(F=this.callbacks)==null?void 0:F.onStageSelection)==null||Y.call(F),this.instance.emitEvent("onStageSelection",void 0));return}const R=v.evt.shiftKey||v.evt.ctrlKey||v.evt.metaKey,D=this.tr.nodes().indexOf(v.target)>=0;let H=!1,Z=_&&!(_.getAttrs().active??!1)?_:v.target;if(Z.getParent()instanceof ne.Transformer){const se=g.getAllIntersections(C).filter(ye=>ye.getAttrs().nodeType);let j=null;se.length>0&&(j=this.instance.getInstanceRecursive(se[se.length-1])),j&&j.getAttrs().nodeType&&(this.tr.nodes([]),this.triggerSelectedNodesEvent(),Z=j)}if(Z.getAttrs().nodeType){if(!R&&!D)this.tr.nodes([Z]),this.tr.show(),H=!0;else if(R&&D){const X=this.tr.nodes().slice();X.splice(X.indexOf(Z),1),this.tr.nodes(X),H=!0}else if(R&&!D){const X=this.tr.nodes().concat([Z]);this.tr.nodes(X),H=!0}H&&(g.container().tabIndex=1,g.container().focus(),g.container().style.cursor="grab"),this.triggerSelectedNodesEvent()}})}getTransformer(){return this.tr}setSelectedNodes(r){this.tr.setNodes(r),this.triggerSelectedNodesEvent()}getSelectedNodes(){return this.tr.nodes()}removeSelectedNodes(){const r=this.tr.getNodes();for(const l of r)l.destroy()}selectAll(){const r=this.instance.getMainLayer();if(r){const l=r.getChildren();this.tr.nodes(l)}}selectNone(){this.tr.nodes([])}enable(){var r;(r=this.getLayer())==null||r.show(),this.enabled=!0}disable(){var r;(r=this.getLayer())==null||r.hide(),this.enabled=!1}}const fu="userInfo";class _0 extends ti{constructor(r){super();E(this,"connectedUsers",{});E(this,"getUser");E(this,"onConnectedUsersChanged");E(this,"getLayerName");E(this,"initLayer");E(this,"render");const{getUser:l,onConnectedUsersChanged:u}=r;this.connectedUsers={},this.onConnectedUsersChanged=u,this.getUser=l??(()=>({name:"Unknown",email:"unknown@domain.com"}))}registersLayers(){return!1}getName(){return"connectedUsers"}init(){var u;const r=this.instance.getStore(),l=this.getUser();r.setAwarenessInfo(fu,l),(u=this.onConnectedUsersChanged)==null||u.call(this,{[l.name]:l}),r.onAwarenessChange(h=>{var v,S;if(!this.enabled){this.connectedUsers={},(v=this.onConnectedUsersChanged)==null||v.call(this,{});return}const g={};for(const _ of h)if(_[fu]&&_[fu]){const C=_[fu];g[C.name]=C}jt.isEqual(this.connectedUsers,g)||(S=this.onConnectedUsersChanged)==null||S.call(this,g),this.connectedUsers=g})}enable(){this.enabled=!0}disable(){this.enabled=!1}}const qd="usersPointersLayer",Fo="userPointer";class E0 extends ti{constructor(r){super();E(this,"usersPointers");E(this,"usersPointersTimers");E(this,"getUser");E(this,"renderCursors");E(this,"userPointerCircleRadius",4);E(this,"userPointerSeparation",8);E(this,"userPointerCircleStrokeWidth",1);E(this,"userPointerNameFontSize",10);E(this,"userPointerBackgroundCornerRadius",4);E(this,"userPointerBackgroundPaddingX",4);E(this,"userPointerBackgroundPaddingY",8);E(this,"render");const{getUser:l}=r;this.renderCursors=!0,this.usersPointers={},this.usersPointersTimers={},this.getUser=l??(()=>({name:"Unknown",email:"unknown@domain.com"}))}registersLayers(){return!0}getName(){return"usersPointers"}getLayerName(){return qd}initLayer(){const r=this.instance.getStage(),l=new ne.Layer({id:this.getLayerName()});r.add(l)}getLayer(){return this.instance.getStage().findOne(`#${qd}`)}init(){const r=this.instance.getStore(),l=this.instance.getStage();r.onAwarenessChange(u=>{var g;const h=this.getUser();for(const v of u)if(v[Fo]&&v[Fo]&&h.name!==v[Fo].user){const S=v[Fo];this.usersPointers[S.user]={oldPos:((g=this.usersPointers[S.user])==null?void 0:g.actualPos)??{user:S.user,x:0,y:0},actualPos:S}}this.renderPointers()}),l.on("dragmove",u=>{u.evt.preventDefault();const h=this.getUser(),g=l.getRelativePointerPosition();g&&r.setAwarenessInfo(Fo,{user:h.name,x:g.x,y:g.y})}),l.on("pointermove",u=>{u.evt.preventDefault();const h=this.getUser(),g=l.getRelativePointerPosition();g&&r.setAwarenessInfo(Fo,{user:h.name,x:g.x,y:g.y})}),this.instance.addEventListener("onZoomChange",()=>{this.renderPointers()})}stringToColour(r){let l=0;r.split("").forEach(h=>{l=h.charCodeAt(0)+((l<<5)-l)});let u="#";for(let h=0;h<3;h++){const g=l>>h*8&255;u+=g.toString(16).padStart(2,"0")}return u}setUserMovementTimer(r){const l=this.getLayer();this.usersPointersTimers[`${r.user}-opacity`]&&clearTimeout(this.usersPointersTimers[`${r.user}-opacity`]),this.usersPointersTimers[`${r.user}-opacity`]=setTimeout(()=>{const u=l==null?void 0:l.findOne(`#${r.user}`);u&&u.opacity(.5)},5e3),this.usersPointersTimers[`${r.user}-destroy`]&&clearTimeout(this.usersPointersTimers[`${r.user}-destroy`]),this.usersPointersTimers[`${r.user}-destroy`]=setTimeout(()=>{const u=l==null?void 0:l.findOne(`#${r.user}`);u&&u.destroy()},3e4)}renderPointers(){var u,h,g,v,S,_,C,R,D;const r=this.instance.getStage(),l=this.getLayer();if(l==null||l.clear(),!!this.enabled&&this.renderCursors)for(const H of Object.keys(this.usersPointers)){const Z=this.usersPointers[H],F=l==null?void 0:l.findOne(`#${Z.actualPos.user}`);if(!F){const xe=new ne.Group({id:Z.actualPos.user,x:Z.actualPos.x,y:Z.actualPos.y,opacity:1,listening:!1}),Ie=new ne.Circle({id:"userPoint",x:0,y:0,radius:this.userPointerCircleRadius/r.scaleX(),fill:this.stringToColour(Z.actualPos.user),stroke:"black",strokeWidth:this.userPointerCircleStrokeWidth/r.scaleX(),listening:!1}),at=new ne.Text({id:"userPointName",x:(this.userPointerSeparation+this.userPointerBackgroundPaddingX)/r.scaleX(),y:0/r.scaleX(),height:Ie.height()*2/r.scaleX(),text:Z.actualPos.user,fontSize:this.userPointerNameFontSize/r.scaleX(),fontFamily:"NotoSansMono, monospace",fill:"black",align:"left",verticalAlign:"middle",listening:!1}),gt=new ne.Rect({id:"userPointRect",x:this.userPointerSeparation/r.scaleX(),y:-this.userPointerBackgroundPaddingY/r.scaleX(),width:(at.width()+this.userPointerBackgroundPaddingX*2)/r.scaleX(),height:(at.height()+this.userPointerBackgroundPaddingY*2)/r.scaleX(),cornerRadius:this.userPointerBackgroundCornerRadius/r.scaleX(),fill:"rgba(0,0,0,0.2)",strokeWidth:0,listening:!1});Ie.setAttrs({y:gt.y()+gt.height()/2}),xe.add(Ie),xe.add(gt),xe.add(at),l==null||l.add(xe),this.setUserMovementTimer(Z.actualPos);continue}const Y={x:Z.oldPos.x,y:Z.oldPos.y},X={x:Z.actualPos.x,y:Z.actualPos.y},se=!Qm.isEqual(X,Y),j=F.getChildren(xe=>xe.getAttrs().id==="userPoint");(u=j[0])==null||u.setAttrs({radius:this.userPointerCircleRadius/r.scaleX(),strokeWidth:this.userPointerCircleStrokeWidth/r.scaleX()});const ye=F.getChildren(xe=>xe.getAttrs().id==="userPointName");(g=ye[0])==null||g.setAttrs({x:(this.userPointerSeparation+this.userPointerBackgroundPaddingX)/r.scaleX(),y:0/r.scaleX(),height:(h=j[0])==null?void 0:h.height(),fontSize:this.userPointerNameFontSize/r.scaleX()});const we=F.getChildren(xe=>xe.getAttrs().id==="userPointRect");(_=we[0])==null||_.setAttrs({x:this.userPointerSeparation/r.scaleX(),y:-this.userPointerBackgroundPaddingY/r.scaleX(),cornerRadius:this.userPointerBackgroundCornerRadius/r.scaleX(),width:((v=ye[0])==null?void 0:v.width())+this.userPointerBackgroundPaddingX*2,height:((S=ye[0])==null?void 0:S.height())+this.userPointerBackgroundPaddingY*2}),(D=j[0])==null||D.setAttrs({y:((C=we[0])==null?void 0:C.y())+((R=we[0])==null?void 0:R.height())/2}),se&&(F.setAttrs({x:Z.actualPos.x,y:Z.actualPos.y,opacity:1}),se&&this.setUserMovementTimer(Z.actualPos))}}toggleRenderCursors(){this.renderCursors=!this.renderCursors}setRenderCursors(r){this.renderCursors=r}enable(){var r;(r=this.getLayer())==null||r.show(),this.enabled=!0}disable(){var r;(r=this.getLayer())==null||r.hide(),this.enabled=!1}}class I0 extends ti{constructor(r,l){super();E(this,"config");E(this,"callbacks");E(this,"touchTimer");E(this,"tapHold");E(this,"getLayerName");E(this,"initLayer");E(this,"render");this.touchTimer=void 0,this.tapHold=!1,this.config=r,this.callbacks=l}registersLayers(){return!1}getName(){return"contextMenu"}init(){this.initEvents()}triggerContextMenu(r){var _,C;const l=this.instance.getStage(),u=this.instance.getPlugin("nodesSelection");let h=!1;if(u){const D=u.getTransformer().getClientRect(),H=l.getPointerPosition();H&&H.x>=D.x&&H.x<=D.x+D.width&&H.y>=D.y&&H.y<=D.y+D.height&&(h=!0)}if(r!==l&&!h)return;let g=[];h&&(g=u.getTransformer().getNodes().map(D=>{const H=this.instance.getNodeHandler(D.getAttrs().nodeType);return{instance:D,node:H.toNode(D)}}).filter(D=>D!==void 0));const v=l.container().getBoundingClientRect(),S=l.getPointerPosition();if(v&&S){const R={x:v.left+S.x+(this.config.xOffset??4),y:v.top+S.y+(this.config.yOffset??4)};(C=(_=this.callbacks).onNodeMenu)==null||C.call(_,this.instance,g,R,!0)}}initEvents(){const r=this.instance.getStage();r.on("touchstart",l=>{l.evt.preventDefault(),this.touchTimer=setTimeout(()=>{this.tapHold=!0,this.triggerContextMenu(l.target)},500)}),r.on("touchmove",l=>{l.evt.preventDefault(),this.tapHold=!1,this.touchTimer&&clearTimeout(this.touchTimer)}),r.on("touchend",l=>{l.evt.preventDefault(),this.touchTimer&&clearTimeout(this.touchTimer),this.tapHold&&(this.tapHold=!1)}),r.on("contextmenu",l=>{l.evt.preventDefault(),this.enabled&&this.triggerContextMenu(l.target)}),this.instance.addEventListener("onStageSelection",()=>{var h,g;if(this.tapHold)return;const l=r.container().getBoundingClientRect(),u=r.getPointerPosition();if(l&&u){const v={x:l.left+u.x+(this.config.xOffset??4),y:l.top+u.y+(this.config.yOffset??4)};(g=(h=this.callbacks).onNodeMenu)==null||g.call(h,this.instance,[],v,!1)}})}isTapHold(){return this.tapHold}enable(){this.enabled=!0}disable(){this.enabled=!1}}class A0 extends ti{constructor(r){super();E(this,"callbacks");E(this,"getLayerName");E(this,"initLayer");E(this,"render");this.callbacks=r,this.enabled=!0}registersLayers(){return!1}getName(){return"stageDropArea"}init(){this.initEvents()}initEvents(){const r=this.instance.getStage();r.container().addEventListener("dragover",l=>{l.preventDefault(),l.stopPropagation()}),r.container().addEventListener("drop",l=>{var u,h;l.preventDefault(),l.stopPropagation(),(h=(u=this.callbacks)==null?void 0:u.onStageDrop)==null||h.call(u,l),this.instance.emitEvent("onStageDrop",l)})}enable(){this.enabled=!0}disable(){this.enabled=!1}}const Vr={IDLE:"idle",PASTING:"pasting"};class N0 extends ti{constructor(r){super();E(this,"state");E(this,"callbacks");E(this,"toPaste");E(this,"getLayerName");E(this,"initLayer");E(this,"render");this.callbacks=r,this.state=Vr.IDLE}registersLayers(){return!1}getName(){return"copyPasteNodes"}init(){this.initEvents()}readClipboardData(){return new Promise((r,l)=>{setTimeout(async()=>{if(typeof navigator.clipboard>"u")return l(new Error("Clipboard API not supported"));navigator.clipboard.readText().then(u=>{try{const h=JSON.parse(u);h.weave&&h.weaveMinPoint&&(this.toPaste={weaveInstanceId:h.weaveInstanceId,weave:h.weave,weaveMinPoint:h.weaveMinPoint}),r()}catch(h){l(h)}}).catch(u=>{l(u)})})})}writeClipboardData(r){return new Promise((l,u)=>{setTimeout(async()=>{if(typeof navigator.clipboard>"u")return u(new Error("Clipboard API not supported"));navigator.clipboard.writeText(r).then(()=>{l()}).catch(h=>{u(h)})})})}initEvents(){const r=this.instance.getStage();document.oncopy=async()=>{this.performCopy()},document.onpaste=async l=>{var h,g,v,S,_,C,R;if(!(!this.enabled||!((h=l.clipboardData)!=null&&h.items))){try{await this.readClipboardData(),this.performPaste()}catch(D){(v=(g=this.callbacks)==null?void 0:g.onPaste)==null||v.call(g,D),this.instance.emitEvent("onPaste",D)}try{const D=await navigator.clipboard.read();if(D&&D.length===1){const H=D[0];(_=(S=this.callbacks)==null?void 0:S.onPasteExternal)==null||_.call(S,H),this.instance.emitEvent("onPasteExternal",H)}}catch(D){(R=(C=this.callbacks)==null?void 0:C.onPaste)==null||R.call(C,D),this.instance.emitEvent("onPaste",D)}}},r.container().addEventListener("keydown",l=>{if(l.key==="Escape"){this.cancel();return}}),r.on("click tap",l=>{if(l.evt.preventDefault(),this.state!==Vr.IDLE&&this.state===Vr.PASTING){this.handlePaste();return}})}mapToPasteNodes(){return this.getNodesSelectionPlugin().getSelectedNodes().map(u=>({konvaNode:u,node:u.getAttrs()}))}setState(r){this.state=r}handlePaste(){var r,l;if(this.toPaste){const{mousePoint:u,container:h}=this.instance.getMousePointer();for(const g of Object.keys(this.toPaste.weave)){const v=this.toPaste.weave[g],S=et();v.key=S,v.props.id=S,v.props.x=u.x+(v.props.x-this.toPaste.weaveMinPoint.x),v.props.y=u.y+(v.props.y-this.toPaste.weaveMinPoint.y),this.instance.addNode(v,h==null?void 0:h.getAttr("id")),(l=(r=this.callbacks)==null?void 0:r.onPaste)==null||l.call(r),this.instance.emitEvent("onPaste",void 0)}this.toPaste=void 0}this.cancel()}async performCopy(){var v,S,_,C;if(!this.enabled)return;const r=this.instance.getStage();r.container().style.cursor="default",r.container().focus(),this.setState(Vr.IDLE);const u=this.getNodesSelectionPlugin().getSelectedNodes();if(u.length===0)return;const h={weaveInstanceId:this.instance.getId(),weave:{},weaveMinPoint:{x:0,y:0}},g=this.instance.nodesToGroupSerialized(u);if(g&&g.serializedNodes&&g.serializedNodes.length>0){h.weaveMinPoint=g.minPoint;for(const R of g.serializedNodes)h.weave[R.key??""]=R;try{await this.writeClipboardData(JSON.stringify(h)),(S=(v=this.callbacks)==null?void 0:v.onCopy)==null||S.call(v),this.instance.emitEvent("onCopy",void 0)}catch(R){(C=(_=this.callbacks)==null?void 0:_.onCopy)==null||C.call(_,R),this.instance.emitEvent("onCopy",R)}}}performPaste(){if(!this.enabled)return;const r=this.instance.getStage();r.container().style.cursor="crosshair",r.container().focus(),this.state=Vr.PASTING}async copy(){await this.performCopy()}async paste(){await this.readClipboardData(),this.performPaste()}getSelectedNodes(){return this.mapToPasteNodes()}isPasting(){return this.state===Vr.PASTING}cancel(){const r=this.instance.getStage();r.container().style.cursor="default",r.container().focus(),this.toPaste=void 0,this.setState(Vr.IDLE)}getNodesSelectionPlugin(){const r=this.instance.getPlugin("nodesSelection");if(!r)throw new Error("Nodes selection plugin not found");return r}enable(){this.enabled=!0}disable(){this.enabled=!1}}const Jl="guide-line",Bs={HORIZONTAL:"H",VERTICAL:"V"},Gs={START:"start",CENTER:"center",END:"end"};class T0 extends ti{constructor(){super();E(this,"guideLineOffset");E(this,"render");this.guideLineOffset=10,this.enabled=!0}registersLayers(){return!0}getName(){return"nodesSnapping"}init(){this.initEvents()}setEnabled(r){this.enabled=r}initEvents(){const r=this.instance.getStage(),l=this.instance.getMainLayer();l&&(r.on("dragmove",u=>{if(this.enabled&&u.target instanceof ne.Transformer){const g=u.target.getNodes()[0];if(typeof g>"u")return;l.find(`.${Jl}`).forEach(R=>R.destroy());const v=this.getLineGuideStops(g),S=this.getObjectSnappingEdges(g),_=this.getGuides(v,S);if(!_.length)return;this.drawGuides(_);const C=g.absolutePosition();_.forEach(R=>{switch(R.orientation){case Bs.VERTICAL:{C.x=R.lineGuide+R.offset;break}case Bs.HORIZONTAL:{C.y=R.lineGuide+R.offset;break}}}),g.absolutePosition(C)}}),r.on("dragend",()=>{this.enabled&&l.find(`.${Jl}`).forEach(u=>u.destroy())}))}getLineGuideStops(r){const l=this.instance.getStage(),u=[0,l.width()/2,l.width()],h=[0,l.height()/2,l.height()];return l.find(".node").forEach(g=>{if(g===r)return;const v=g.getClientRect();u.push([v.x,v.x+v.width,v.x+v.width/2]),h.push([v.y,v.y+v.height,v.y+v.height/2])}),{vertical:u.flat(),horizontal:h.flat()}}getObjectSnappingEdges(r){const l=r.getClientRect(),u=r.absolutePosition();return{vertical:[{guide:Math.round(l.x),offset:Math.round(u.x-l.x),snap:Gs.START},{guide:Math.round(l.x+l.width/2),offset:Math.round(u.x-l.x-l.width/2),snap:Gs.CENTER},{guide:Math.round(l.x+l.width),offset:Math.round(u.x-l.x-l.width),snap:Gs.END}],horizontal:[{guide:Math.round(l.y),offset:Math.round(u.y-l.y),snap:Gs.START},{guide:Math.round(l.y+l.height/2),offset:Math.round(u.y-l.y-l.height/2),snap:Gs.CENTER},{guide:Math.round(l.y+l.height),offset:Math.round(u.y-l.y-l.height),snap:Gs.END}]}}getGuides(r,l){const u=[],h=[];r.vertical.forEach(_=>{l.vertical.forEach(C=>{const R=Math.abs(_-C.guide);R<this.guideLineOffset&&u.push({lineGuide:_,diff:R,snap:C.snap,offset:C.offset})})}),r.horizontal.forEach(_=>{l.horizontal.forEach(C=>{const R=Math.abs(_-C.guide);R<this.guideLineOffset&&h.push({lineGuide:_,diff:R,snap:C.snap,offset:C.offset})})});const g=[],v=u.sort((_,C)=>_.diff-C.diff)[0],S=h.sort((_,C)=>_.diff-C.diff)[0];return v&&g.push({lineGuide:v.lineGuide,offset:v.offset,orientation:Bs.VERTICAL,snap:v.snap}),S&&g.push({lineGuide:S.lineGuide,offset:S.offset,orientation:Bs.HORIZONTAL,snap:S.snap}),g}drawGuides(r){const l=this.instance.getStage(),u=this.instance.getMainLayer();u&&r.forEach(h=>{if(h.orientation===Bs.HORIZONTAL){const g=new ne.Line({points:[-6e3,0,6e3,0],stroke:"rgb(0, 161, 255)",strokeWidth:1/l.scaleX(),name:Jl,dash:[4/l.scaleX(),6/l.scaleX()]});u.add(g),g.absolutePosition({x:0,y:h.lineGuide})}if(h.orientation===Bs.VERTICAL){const g=new ne.Line({points:[0,-6e3,0,6e3],stroke:"rgb(0, 161, 255)",strokeWidth:1/l.scaleX(),name:Jl,dash:[4/l.scaleX(),6/l.scaleX()]});u.add(g),g.absolutePosition({x:h.lineGuide,y:0})}})}enable(){this.enabled=!0}disable(){this.enabled=!1}}exports.BRUSH_TOOL_STATE=Wi;exports.COPY_PASTE_NODES_PLUGIN_STATE=Vr;exports.FRAME_TOOL_ACTION_NAME=uf;exports.FRAME_TOOL_STATE=bo;exports.GUIDE_LINE_NAME=Jl;exports.GUIDE_ORIENTATION=Bs;exports.IMAGE_TOOL_STATE=Ui;exports.MOVE_TOOL_ACTION_NAME=lf;exports.MOVE_TOOL_STATE=hu;exports.NODE_SNAP=Gs;exports.PEN_TOOL_STATE=Di;exports.RECTANGLE_TOOL_ACTION_NAME=af;exports.RECTANGLE_TOOL_STATE=hr;exports.SELECTION_TOOL_ACTION_NAME=Xc;exports.SELECTION_TOOL_STATE=gu;exports.TEXT_TOOL_STATE=bs;exports.WEAVE_FRAME_NODE_TYPE=of;exports.WEAVE_GRID_DEFAULT_SIZE=cf;exports.WEAVE_GRID_LAYER_ID=bc;exports.WEAVE_GRID_TYPES=Bc;exports.WEAVE_NODES_SELECTION_LAYER_ID=df;exports.Weave=rf;exports.WeaveAction=gn;exports.WeaveBrushToolAction=f0;exports.WeaveConnectedUsersPlugin=_0;exports.WeaveContextMenuPlugin=I0;exports.WeaveCopyPasteNodesPlugin=N0;exports.WeaveExportNodeToolAction=v0;exports.WeaveExportStageToolAction=m0;exports.WeaveFitToScreenToolAction=o0;exports.WeaveFitToSelectionToolAction=l0;exports.WeaveFrameNode=i0;exports.WeaveFrameToolAction=p0;exports.WeaveGroupNode=Qv;exports.WeaveImageNode=n0;exports.WeaveImageToolAction=g0;exports.WeaveLayerNode=Yv;exports.WeaveLineNode=jv;exports.WeaveMoveToolAction=a0;exports.WeaveNode=mr;exports.WeaveNodesSelectionPlugin=P0;exports.WeaveNodesSnappingPlugin=T0;exports.WeavePenToolAction=d0;exports.WeavePlugin=ti;exports.WeaveRectangleNode=qv;exports.WeaveRectangleToolAction=c0;exports.WeaveSelectionToolAction=u0;exports.WeaveStageDropAreaPlugin=A0;exports.WeaveStageGridPlugin=y0;exports.WeaveStageNode=Zv;exports.WeaveStagePanningPlugin=S0;exports.WeaveStageResizePlugin=w0;exports.WeaveStageZoomPlugin=x0;exports.WeaveStore=bv;exports.WeaveTextNode=$v;exports.WeaveTextToolAction=h0;exports.WeaveUsersPointersPlugin=E0;exports.WeaveZoomInToolAction=s0;exports.WeaveZoomOutToolAction=r0;exports.resetScale=sf;exports.sendEvent=Bv;