@zyui/components 0.0.20 → 0.0.22

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/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var xfe=Object.defineProperty;var Efe=(o,a,c)=>a in o?xfe(o,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[a]=c;var Bl=(o,a,c)=>Efe(o,typeof a!="symbol"?a+"":a,c);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("vue"),rs=require("element-plus"),_fe="0.0.20";var Tfe=Object.defineProperty,kfe=(o,a,c)=>a in o?Tfe(o,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[a]=c,vQ=(o,a,c)=>kfe(o,typeof a!="symbol"?a+"":a,c);function bie(o,a){return function(){return o.apply(a,arguments)}}const{toString:Afe}=Object.prototype,{getPrototypeOf:ite}=Object,HH=(o=>a=>{const c=Afe.call(a);return o[c]||(o[c]=c.slice(8,-1).toLowerCase())})(Object.create(null)),Op=o=>(o=o.toLowerCase(),a=>HH(a)===o),zH=o=>a=>typeof a===o,{isArray:B4}=Array,uM=zH("undefined");function Ofe(o){return o!==null&&!uM(o)&&o.constructor!==null&&!uM(o.constructor)&&gg(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const vie=Op("ArrayBuffer");function Nfe(o){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(o):a=o&&o.buffer&&vie(o.buffer),a}const $fe=zH("string"),gg=zH("function"),yie=zH("number"),UH=o=>o!==null&&typeof o=="object",Dfe=o=>o===!0||o===!1,ZV=o=>{if(HH(o)!=="object")return!1;const a=ite(o);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in o)&&!(Symbol.iterator in o)},Mfe=Op("Date"),Rfe=Op("File"),Ife=Op("Blob"),Pfe=Op("FileList"),Bfe=o=>UH(o)&&gg(o.pipe),Ffe=o=>{let a;return o&&(typeof FormData=="function"&&o instanceof FormData||gg(o.append)&&((a=HH(o))==="formdata"||a==="object"&&gg(o.toString)&&o.toString()==="[object FormData]"))},Lfe=Op("URLSearchParams"),[Vfe,Hfe,zfe,Ufe]=["ReadableStream","Request","Response","Headers"].map(Op),jfe=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function SM(o,a,{allOwnKeys:c=!1}={}){if(o===null||typeof o>"u")return;let d,g;if(typeof o!="object"&&(o=[o]),B4(o))for(d=0,g=o.length;d<g;d++)a.call(null,o[d],d,o);else{const p=c?Object.getOwnPropertyNames(o):Object.keys(o),y=p.length;let x;for(d=0;d<y;d++)x=p[d],a.call(null,o[x],x,o)}}function wie(o,a){a=a.toLowerCase();const c=Object.keys(o);let d=c.length,g;for(;d-- >0;)if(g=c[d],a===g.toLowerCase())return g;return null}const Lx=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Cie=o=>!uM(o)&&o!==Lx;function gee(){const{caseless:o}=Cie(this)&&this||{},a={},c=(d,g)=>{const p=o&&wie(a,g)||g;ZV(a[p])&&ZV(d)?a[p]=gee(a[p],d):ZV(d)?a[p]=gee({},d):B4(d)?a[p]=d.slice():a[p]=d};for(let d=0,g=arguments.length;d<g;d++)arguments[d]&&SM(arguments[d],c);return a}const Wfe=(o,a,c,{allOwnKeys:d}={})=>(SM(a,(g,p)=>{c&&gg(g)?o[p]=bie(g,c):o[p]=g},{allOwnKeys:d}),o),Zfe=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),Gfe=(o,a,c,d)=>{o.prototype=Object.create(a.prototype,d),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:a.prototype}),c&&Object.assign(o.prototype,c)},qfe=(o,a,c,d)=>{let g,p,y;const x={};if(a=a||{},o==null)return a;do{for(g=Object.getOwnPropertyNames(o),p=g.length;p-- >0;)y=g[p],(!d||d(y,o,a))&&!x[y]&&(a[y]=o[y],x[y]=!0);o=c!==!1&&ite(o)}while(o&&(!c||c(o,a))&&o!==Object.prototype);return a},Yfe=(o,a,c)=>{o=String(o),(c===void 0||c>o.length)&&(c=o.length),c-=a.length;const d=o.indexOf(a,c);return d!==-1&&d===c},Kfe=o=>{if(!o)return null;if(B4(o))return o;let a=o.length;if(!yie(a))return null;const c=new Array(a);for(;a-- >0;)c[a]=o[a];return c},Xfe=(o=>a=>o&&a instanceof o)(typeof Uint8Array<"u"&&ite(Uint8Array)),Jfe=(o,a)=>{const c=(o&&o[Symbol.iterator]).call(o);let d;for(;(d=c.next())&&!d.done;){const g=d.value;a.call(o,g[0],g[1])}},Qfe=(o,a)=>{let c;const d=[];for(;(c=o.exec(a))!==null;)d.push(c);return d},eme=Op("HTMLFormElement"),tme=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,c,d){return c.toUpperCase()+d}),Goe=(({hasOwnProperty:o})=>(a,c)=>o.call(a,c))(Object.prototype),nme=Op("RegExp"),Sie=(o,a)=>{const c=Object.getOwnPropertyDescriptors(o),d={};SM(c,(g,p)=>{let y;(y=a(g,p,o))!==!1&&(d[p]=y||g)}),Object.defineProperties(o,d)},ome=o=>{Sie(o,(a,c)=>{if(gg(o)&&["arguments","caller","callee"].indexOf(c)!==-1)return!1;const d=o[c];if(gg(d)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+c+"'")})}})},sme=(o,a)=>{const c={},d=g=>{g.forEach(p=>{c[p]=!0})};return B4(o)?d(o):d(String(o).split(a)),c},rme=()=>{},ame=(o,a)=>o!=null&&Number.isFinite(o=+o)?o:a,yQ="abcdefghijklmnopqrstuvwxyz",qoe="0123456789",xie={DIGIT:qoe,ALPHA:yQ,ALPHA_DIGIT:yQ+yQ.toUpperCase()+qoe},ime=(o=16,a=xie.ALPHA_DIGIT)=>{let c="";const{length:d}=a;for(;o--;)c+=a[Math.random()*d|0];return c};function cme(o){return!!(o&&gg(o.append)&&o[Symbol.toStringTag]==="FormData"&&o[Symbol.iterator])}const lme=o=>{const a=new Array(10),c=(d,g)=>{if(UH(d)){if(a.indexOf(d)>=0)return;if(!("toJSON"in d)){a[g]=d;const p=B4(d)?[]:{};return SM(d,(y,x)=>{const T=c(y,g+1);!uM(T)&&(p[x]=T)}),a[g]=void 0,p}}return d};return c(o,0)},ume=Op("AsyncFunction"),dme=o=>o&&(UH(o)||gg(o))&&gg(o.then)&&gg(o.catch),Eie=((o,a)=>o?setImmediate:a?((c,d)=>(Lx.addEventListener("message",({source:g,data:p})=>{g===Lx&&p===c&&d.length&&d.shift()()},!1),g=>{d.push(g),Lx.postMessage(c,"*")}))(`axios@${Math.random()}`,[]):c=>setTimeout(c))(typeof setImmediate=="function",gg(Lx.postMessage)),fme=typeof queueMicrotask<"u"?queueMicrotask.bind(Lx):typeof process<"u"&&process.nextTick||Eie,Mn={isArray:B4,isArrayBuffer:vie,isBuffer:Ofe,isFormData:Ffe,isArrayBufferView:Nfe,isString:$fe,isNumber:yie,isBoolean:Dfe,isObject:UH,isPlainObject:ZV,isReadableStream:Vfe,isRequest:Hfe,isResponse:zfe,isHeaders:Ufe,isUndefined:uM,isDate:Mfe,isFile:Rfe,isBlob:Ife,isRegExp:nme,isFunction:gg,isStream:Bfe,isURLSearchParams:Lfe,isTypedArray:Xfe,isFileList:Pfe,forEach:SM,merge:gee,extend:Wfe,trim:jfe,stripBOM:Zfe,inherits:Gfe,toFlatObject:qfe,kindOf:HH,kindOfTest:Op,endsWith:Yfe,toArray:Kfe,forEachEntry:Jfe,matchAll:Qfe,isHTMLForm:eme,hasOwnProperty:Goe,hasOwnProp:Goe,reduceDescriptors:Sie,freezeMethods:ome,toObjectSet:sme,toCamelCase:tme,noop:rme,toFiniteNumber:ame,findKey:wie,global:Lx,isContextDefined:Cie,ALPHABET:xie,generateString:ime,isSpecCompliantForm:cme,toJSONObject:lme,isAsyncFn:ume,isThenable:dme,setImmediate:Eie,asap:fme};function Er(o,a,c,d,g){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=o,this.name="AxiosError",a&&(this.code=a),c&&(this.config=c),d&&(this.request=d),g&&(this.response=g,this.status=g.status?g.status:null)}Mn.inherits(Er,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Mn.toJSONObject(this.config),code:this.code,status:this.status}}});const _ie=Er.prototype,Tie={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(o=>{Tie[o]={value:o}});Object.defineProperties(Er,Tie);Object.defineProperty(_ie,"isAxiosError",{value:!0});Er.from=(o,a,c,d,g,p)=>{const y=Object.create(_ie);return Mn.toFlatObject(o,y,function(x){return x!==Error.prototype},x=>x!=="isAxiosError"),Er.call(y,o.message,a,c,d,g),y.cause=o,y.name=o.name,p&&Object.assign(y,p),y};const mme=null;function hee(o){return Mn.isPlainObject(o)||Mn.isArray(o)}function kie(o){return Mn.endsWith(o,"[]")?o.slice(0,-2):o}function Yoe(o,a,c){return o?o.concat(a).map(function(d,g){return d=kie(d),!c&&g?"["+d+"]":d}).join(c?".":""):a}function gme(o){return Mn.isArray(o)&&!o.some(hee)}const hme=Mn.toFlatObject(Mn,{},null,function(o){return/^is[A-Z]/.test(o)});function jH(o,a,c){if(!Mn.isObject(o))throw new TypeError("target must be an object");a=a||new FormData,c=Mn.toFlatObject(c,{metaTokens:!0,dots:!1,indexes:!1},!1,function(U,q){return!Mn.isUndefined(q[U])});const d=c.metaTokens,g=c.visitor||A,p=c.dots,y=c.indexes,x=(c.Blob||typeof Blob<"u"&&Blob)&&Mn.isSpecCompliantForm(a);if(!Mn.isFunction(g))throw new TypeError("visitor must be a function");function T(U){if(U===null)return"";if(Mn.isDate(U))return U.toISOString();if(!x&&Mn.isBlob(U))throw new Er("Blob is not supported. Use a Buffer instead.");return Mn.isArrayBuffer(U)||Mn.isTypedArray(U)?x&&typeof Blob=="function"?new Blob([U]):Buffer.from(U):U}function A(U,q,Q){let ee=U;if(U&&!Q&&typeof U=="object"){if(Mn.endsWith(q,"{}"))q=d?q:q.slice(0,-2),U=JSON.stringify(U);else if(Mn.isArray(U)&&gme(U)||(Mn.isFileList(U)||Mn.endsWith(q,"[]"))&&(ee=Mn.toArray(U)))return q=kie(q),ee.forEach(function(le,ae){!(Mn.isUndefined(le)||le===null)&&a.append(y===!0?Yoe([q],ae,p):y===null?q:q+"[]",T(le))}),!1}return hee(U)?!0:(a.append(Yoe(Q,q,p),T(U)),!1)}const M=[],P=Object.assign(hme,{defaultVisitor:A,convertValue:T,isVisitable:hee});function z(U,q){if(!Mn.isUndefined(U)){if(M.indexOf(U)!==-1)throw Error("Circular reference detected in "+q.join("."));M.push(U),Mn.forEach(U,function(Q,ee){(!(Mn.isUndefined(Q)||Q===null)&&g.call(a,Q,Mn.isString(ee)?ee.trim():ee,q,P))===!0&&z(Q,q?q.concat(ee):[ee])}),M.pop()}}if(!Mn.isObject(o))throw new TypeError("data must be an object");return z(o),a}function Koe(o){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(o).replace(/[!'()~]|%20|%00/g,function(c){return a[c]})}function cte(o,a){this._pairs=[],o&&jH(o,this,a)}const Aie=cte.prototype;Aie.append=function(o,a){this._pairs.push([o,a])};Aie.toString=function(o){const a=o?function(c){return o.call(this,c,Koe)}:Koe;return this._pairs.map(function(c){return a(c[0])+"="+a(c[1])},"").join("&")};function pme(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oie(o,a,c){if(!a)return o;const d=c&&c.encode||pme;Mn.isFunction(c)&&(c={serialize:c});const g=c&&c.serialize;let p;if(g?p=g(a,c):p=Mn.isURLSearchParams(a)?a.toString():new cte(a,c).toString(d),p){const y=o.indexOf("#");y!==-1&&(o=o.slice(0,y)),o+=(o.indexOf("?")===-1?"?":"&")+p}return o}let Xoe=class{constructor(){this.handlers=[]}use(a,c,d){return this.handlers.push({fulfilled:a,rejected:c,synchronous:d?d.synchronous:!1,runWhen:d?d.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){Mn.forEach(this.handlers,function(c){c!==null&&a(c)})}};const Nie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},bme=typeof URLSearchParams<"u"?URLSearchParams:cte,vme=typeof FormData<"u"?FormData:null,yme=typeof Blob<"u"?Blob:null,wme={isBrowser:!0,classes:{URLSearchParams:bme,FormData:vme,Blob:yme},protocols:["http","https","file","blob","url","data"]},lte=typeof window<"u"&&typeof document<"u",pee=typeof navigator=="object"&&navigator||void 0,Cme=lte&&(!pee||["ReactNative","NativeScript","NS"].indexOf(pee.product)<0),Sme=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xme=lte&&window.location.href||"http://localhost",Eme=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:lte,hasStandardBrowserEnv:Cme,hasStandardBrowserWebWorkerEnv:Sme,navigator:pee,origin:xme},Symbol.toStringTag,{value:"Module"})),Gd={...Eme,...wme};function _me(o,a){return jH(o,new Gd.classes.URLSearchParams,Object.assign({visitor:function(c,d,g,p){return Gd.isNode&&Mn.isBuffer(c)?(this.append(d,c.toString("base64")),!1):p.defaultVisitor.apply(this,arguments)}},a))}function Tme(o){return Mn.matchAll(/\w+|\[(\w*)]/g,o).map(a=>a[0]==="[]"?"":a[1]||a[0])}function kme(o){const a={},c=Object.keys(o);let d;const g=c.length;let p;for(d=0;d<g;d++)p=c[d],a[p]=o[p];return a}function $ie(o){function a(c,d,g,p){let y=c[p++];if(y==="__proto__")return!0;const x=Number.isFinite(+y),T=p>=c.length;return y=!y&&Mn.isArray(g)?g.length:y,T?(Mn.hasOwnProp(g,y)?g[y]=[g[y],d]:g[y]=d,!x):((!g[y]||!Mn.isObject(g[y]))&&(g[y]=[]),a(c,d,g[y],p)&&Mn.isArray(g[y])&&(g[y]=kme(g[y])),!x)}if(Mn.isFormData(o)&&Mn.isFunction(o.entries)){const c={};return Mn.forEachEntry(o,(d,g)=>{a(Tme(d),g,c,0)}),c}return null}function Ame(o,a,c){if(Mn.isString(o))try{return(a||JSON.parse)(o),Mn.trim(o)}catch(d){if(d.name!=="SyntaxError")throw d}return(0,JSON.stringify)(o)}const xM={transitional:Nie,adapter:["xhr","http","fetch"],transformRequest:[function(o,a){const c=a.getContentType()||"",d=c.indexOf("application/json")>-1,g=Mn.isObject(o);if(g&&Mn.isHTMLForm(o)&&(o=new FormData(o)),Mn.isFormData(o))return d?JSON.stringify($ie(o)):o;if(Mn.isArrayBuffer(o)||Mn.isBuffer(o)||Mn.isStream(o)||Mn.isFile(o)||Mn.isBlob(o)||Mn.isReadableStream(o))return o;if(Mn.isArrayBufferView(o))return o.buffer;if(Mn.isURLSearchParams(o))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),o.toString();let p;if(g){if(c.indexOf("application/x-www-form-urlencoded")>-1)return _me(o,this.formSerializer).toString();if((p=Mn.isFileList(o))||c.indexOf("multipart/form-data")>-1){const y=this.env&&this.env.FormData;return jH(p?{"files[]":o}:o,y&&new y,this.formSerializer)}}return g||d?(a.setContentType("application/json",!1),Ame(o)):o}],transformResponse:[function(o){const a=this.transitional||xM.transitional,c=a&&a.forcedJSONParsing,d=this.responseType==="json";if(Mn.isResponse(o)||Mn.isReadableStream(o))return o;if(o&&Mn.isString(o)&&(c&&!this.responseType||d)){const g=!(a&&a.silentJSONParsing)&&d;try{return JSON.parse(o)}catch(p){if(g)throw p.name==="SyntaxError"?Er.from(p,Er.ERR_BAD_RESPONSE,this,null,this.response):p}}return o}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Gd.classes.FormData,Blob:Gd.classes.Blob},validateStatus:function(o){return o>=200&&o<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Mn.forEach(["delete","get","head","post","put","patch"],o=>{xM.headers[o]={}});const Ome=Mn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Nme=o=>{const a={};let c,d,g;return o&&o.split(`
1
+ "use strict";var xfe=Object.defineProperty;var Efe=(o,a,c)=>a in o?xfe(o,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[a]=c;var Bl=(o,a,c)=>Efe(o,typeof a!="symbol"?a+"":a,c);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("vue"),rs=require("element-plus"),_fe="0.0.22";var Tfe=Object.defineProperty,kfe=(o,a,c)=>a in o?Tfe(o,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[a]=c,vQ=(o,a,c)=>kfe(o,typeof a!="symbol"?a+"":a,c);function bie(o,a){return function(){return o.apply(a,arguments)}}const{toString:Afe}=Object.prototype,{getPrototypeOf:ite}=Object,HH=(o=>a=>{const c=Afe.call(a);return o[c]||(o[c]=c.slice(8,-1).toLowerCase())})(Object.create(null)),Op=o=>(o=o.toLowerCase(),a=>HH(a)===o),zH=o=>a=>typeof a===o,{isArray:B4}=Array,uM=zH("undefined");function Ofe(o){return o!==null&&!uM(o)&&o.constructor!==null&&!uM(o.constructor)&&gg(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const vie=Op("ArrayBuffer");function Nfe(o){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(o):a=o&&o.buffer&&vie(o.buffer),a}const $fe=zH("string"),gg=zH("function"),yie=zH("number"),UH=o=>o!==null&&typeof o=="object",Dfe=o=>o===!0||o===!1,ZV=o=>{if(HH(o)!=="object")return!1;const a=ite(o);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in o)&&!(Symbol.iterator in o)},Mfe=Op("Date"),Rfe=Op("File"),Ife=Op("Blob"),Pfe=Op("FileList"),Bfe=o=>UH(o)&&gg(o.pipe),Ffe=o=>{let a;return o&&(typeof FormData=="function"&&o instanceof FormData||gg(o.append)&&((a=HH(o))==="formdata"||a==="object"&&gg(o.toString)&&o.toString()==="[object FormData]"))},Lfe=Op("URLSearchParams"),[Vfe,Hfe,zfe,Ufe]=["ReadableStream","Request","Response","Headers"].map(Op),jfe=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function SM(o,a,{allOwnKeys:c=!1}={}){if(o===null||typeof o>"u")return;let d,g;if(typeof o!="object"&&(o=[o]),B4(o))for(d=0,g=o.length;d<g;d++)a.call(null,o[d],d,o);else{const p=c?Object.getOwnPropertyNames(o):Object.keys(o),y=p.length;let x;for(d=0;d<y;d++)x=p[d],a.call(null,o[x],x,o)}}function wie(o,a){a=a.toLowerCase();const c=Object.keys(o);let d=c.length,g;for(;d-- >0;)if(g=c[d],a===g.toLowerCase())return g;return null}const Lx=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Cie=o=>!uM(o)&&o!==Lx;function gee(){const{caseless:o}=Cie(this)&&this||{},a={},c=(d,g)=>{const p=o&&wie(a,g)||g;ZV(a[p])&&ZV(d)?a[p]=gee(a[p],d):ZV(d)?a[p]=gee({},d):B4(d)?a[p]=d.slice():a[p]=d};for(let d=0,g=arguments.length;d<g;d++)arguments[d]&&SM(arguments[d],c);return a}const Wfe=(o,a,c,{allOwnKeys:d}={})=>(SM(a,(g,p)=>{c&&gg(g)?o[p]=bie(g,c):o[p]=g},{allOwnKeys:d}),o),Zfe=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),Gfe=(o,a,c,d)=>{o.prototype=Object.create(a.prototype,d),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:a.prototype}),c&&Object.assign(o.prototype,c)},qfe=(o,a,c,d)=>{let g,p,y;const x={};if(a=a||{},o==null)return a;do{for(g=Object.getOwnPropertyNames(o),p=g.length;p-- >0;)y=g[p],(!d||d(y,o,a))&&!x[y]&&(a[y]=o[y],x[y]=!0);o=c!==!1&&ite(o)}while(o&&(!c||c(o,a))&&o!==Object.prototype);return a},Yfe=(o,a,c)=>{o=String(o),(c===void 0||c>o.length)&&(c=o.length),c-=a.length;const d=o.indexOf(a,c);return d!==-1&&d===c},Kfe=o=>{if(!o)return null;if(B4(o))return o;let a=o.length;if(!yie(a))return null;const c=new Array(a);for(;a-- >0;)c[a]=o[a];return c},Xfe=(o=>a=>o&&a instanceof o)(typeof Uint8Array<"u"&&ite(Uint8Array)),Jfe=(o,a)=>{const c=(o&&o[Symbol.iterator]).call(o);let d;for(;(d=c.next())&&!d.done;){const g=d.value;a.call(o,g[0],g[1])}},Qfe=(o,a)=>{let c;const d=[];for(;(c=o.exec(a))!==null;)d.push(c);return d},eme=Op("HTMLFormElement"),tme=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,c,d){return c.toUpperCase()+d}),Goe=(({hasOwnProperty:o})=>(a,c)=>o.call(a,c))(Object.prototype),nme=Op("RegExp"),Sie=(o,a)=>{const c=Object.getOwnPropertyDescriptors(o),d={};SM(c,(g,p)=>{let y;(y=a(g,p,o))!==!1&&(d[p]=y||g)}),Object.defineProperties(o,d)},ome=o=>{Sie(o,(a,c)=>{if(gg(o)&&["arguments","caller","callee"].indexOf(c)!==-1)return!1;const d=o[c];if(gg(d)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+c+"'")})}})},sme=(o,a)=>{const c={},d=g=>{g.forEach(p=>{c[p]=!0})};return B4(o)?d(o):d(String(o).split(a)),c},rme=()=>{},ame=(o,a)=>o!=null&&Number.isFinite(o=+o)?o:a,yQ="abcdefghijklmnopqrstuvwxyz",qoe="0123456789",xie={DIGIT:qoe,ALPHA:yQ,ALPHA_DIGIT:yQ+yQ.toUpperCase()+qoe},ime=(o=16,a=xie.ALPHA_DIGIT)=>{let c="";const{length:d}=a;for(;o--;)c+=a[Math.random()*d|0];return c};function cme(o){return!!(o&&gg(o.append)&&o[Symbol.toStringTag]==="FormData"&&o[Symbol.iterator])}const lme=o=>{const a=new Array(10),c=(d,g)=>{if(UH(d)){if(a.indexOf(d)>=0)return;if(!("toJSON"in d)){a[g]=d;const p=B4(d)?[]:{};return SM(d,(y,x)=>{const T=c(y,g+1);!uM(T)&&(p[x]=T)}),a[g]=void 0,p}}return d};return c(o,0)},ume=Op("AsyncFunction"),dme=o=>o&&(UH(o)||gg(o))&&gg(o.then)&&gg(o.catch),Eie=((o,a)=>o?setImmediate:a?((c,d)=>(Lx.addEventListener("message",({source:g,data:p})=>{g===Lx&&p===c&&d.length&&d.shift()()},!1),g=>{d.push(g),Lx.postMessage(c,"*")}))(`axios@${Math.random()}`,[]):c=>setTimeout(c))(typeof setImmediate=="function",gg(Lx.postMessage)),fme=typeof queueMicrotask<"u"?queueMicrotask.bind(Lx):typeof process<"u"&&process.nextTick||Eie,Mn={isArray:B4,isArrayBuffer:vie,isBuffer:Ofe,isFormData:Ffe,isArrayBufferView:Nfe,isString:$fe,isNumber:yie,isBoolean:Dfe,isObject:UH,isPlainObject:ZV,isReadableStream:Vfe,isRequest:Hfe,isResponse:zfe,isHeaders:Ufe,isUndefined:uM,isDate:Mfe,isFile:Rfe,isBlob:Ife,isRegExp:nme,isFunction:gg,isStream:Bfe,isURLSearchParams:Lfe,isTypedArray:Xfe,isFileList:Pfe,forEach:SM,merge:gee,extend:Wfe,trim:jfe,stripBOM:Zfe,inherits:Gfe,toFlatObject:qfe,kindOf:HH,kindOfTest:Op,endsWith:Yfe,toArray:Kfe,forEachEntry:Jfe,matchAll:Qfe,isHTMLForm:eme,hasOwnProperty:Goe,hasOwnProp:Goe,reduceDescriptors:Sie,freezeMethods:ome,toObjectSet:sme,toCamelCase:tme,noop:rme,toFiniteNumber:ame,findKey:wie,global:Lx,isContextDefined:Cie,ALPHABET:xie,generateString:ime,isSpecCompliantForm:cme,toJSONObject:lme,isAsyncFn:ume,isThenable:dme,setImmediate:Eie,asap:fme};function Er(o,a,c,d,g){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=o,this.name="AxiosError",a&&(this.code=a),c&&(this.config=c),d&&(this.request=d),g&&(this.response=g,this.status=g.status?g.status:null)}Mn.inherits(Er,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Mn.toJSONObject(this.config),code:this.code,status:this.status}}});const _ie=Er.prototype,Tie={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(o=>{Tie[o]={value:o}});Object.defineProperties(Er,Tie);Object.defineProperty(_ie,"isAxiosError",{value:!0});Er.from=(o,a,c,d,g,p)=>{const y=Object.create(_ie);return Mn.toFlatObject(o,y,function(x){return x!==Error.prototype},x=>x!=="isAxiosError"),Er.call(y,o.message,a,c,d,g),y.cause=o,y.name=o.name,p&&Object.assign(y,p),y};const mme=null;function hee(o){return Mn.isPlainObject(o)||Mn.isArray(o)}function kie(o){return Mn.endsWith(o,"[]")?o.slice(0,-2):o}function Yoe(o,a,c){return o?o.concat(a).map(function(d,g){return d=kie(d),!c&&g?"["+d+"]":d}).join(c?".":""):a}function gme(o){return Mn.isArray(o)&&!o.some(hee)}const hme=Mn.toFlatObject(Mn,{},null,function(o){return/^is[A-Z]/.test(o)});function jH(o,a,c){if(!Mn.isObject(o))throw new TypeError("target must be an object");a=a||new FormData,c=Mn.toFlatObject(c,{metaTokens:!0,dots:!1,indexes:!1},!1,function(U,q){return!Mn.isUndefined(q[U])});const d=c.metaTokens,g=c.visitor||A,p=c.dots,y=c.indexes,x=(c.Blob||typeof Blob<"u"&&Blob)&&Mn.isSpecCompliantForm(a);if(!Mn.isFunction(g))throw new TypeError("visitor must be a function");function T(U){if(U===null)return"";if(Mn.isDate(U))return U.toISOString();if(!x&&Mn.isBlob(U))throw new Er("Blob is not supported. Use a Buffer instead.");return Mn.isArrayBuffer(U)||Mn.isTypedArray(U)?x&&typeof Blob=="function"?new Blob([U]):Buffer.from(U):U}function A(U,q,Q){let ee=U;if(U&&!Q&&typeof U=="object"){if(Mn.endsWith(q,"{}"))q=d?q:q.slice(0,-2),U=JSON.stringify(U);else if(Mn.isArray(U)&&gme(U)||(Mn.isFileList(U)||Mn.endsWith(q,"[]"))&&(ee=Mn.toArray(U)))return q=kie(q),ee.forEach(function(le,ae){!(Mn.isUndefined(le)||le===null)&&a.append(y===!0?Yoe([q],ae,p):y===null?q:q+"[]",T(le))}),!1}return hee(U)?!0:(a.append(Yoe(Q,q,p),T(U)),!1)}const M=[],P=Object.assign(hme,{defaultVisitor:A,convertValue:T,isVisitable:hee});function z(U,q){if(!Mn.isUndefined(U)){if(M.indexOf(U)!==-1)throw Error("Circular reference detected in "+q.join("."));M.push(U),Mn.forEach(U,function(Q,ee){(!(Mn.isUndefined(Q)||Q===null)&&g.call(a,Q,Mn.isString(ee)?ee.trim():ee,q,P))===!0&&z(Q,q?q.concat(ee):[ee])}),M.pop()}}if(!Mn.isObject(o))throw new TypeError("data must be an object");return z(o),a}function Koe(o){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(o).replace(/[!'()~]|%20|%00/g,function(c){return a[c]})}function cte(o,a){this._pairs=[],o&&jH(o,this,a)}const Aie=cte.prototype;Aie.append=function(o,a){this._pairs.push([o,a])};Aie.toString=function(o){const a=o?function(c){return o.call(this,c,Koe)}:Koe;return this._pairs.map(function(c){return a(c[0])+"="+a(c[1])},"").join("&")};function pme(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oie(o,a,c){if(!a)return o;const d=c&&c.encode||pme;Mn.isFunction(c)&&(c={serialize:c});const g=c&&c.serialize;let p;if(g?p=g(a,c):p=Mn.isURLSearchParams(a)?a.toString():new cte(a,c).toString(d),p){const y=o.indexOf("#");y!==-1&&(o=o.slice(0,y)),o+=(o.indexOf("?")===-1?"?":"&")+p}return o}let Xoe=class{constructor(){this.handlers=[]}use(a,c,d){return this.handlers.push({fulfilled:a,rejected:c,synchronous:d?d.synchronous:!1,runWhen:d?d.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){Mn.forEach(this.handlers,function(c){c!==null&&a(c)})}};const Nie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},bme=typeof URLSearchParams<"u"?URLSearchParams:cte,vme=typeof FormData<"u"?FormData:null,yme=typeof Blob<"u"?Blob:null,wme={isBrowser:!0,classes:{URLSearchParams:bme,FormData:vme,Blob:yme},protocols:["http","https","file","blob","url","data"]},lte=typeof window<"u"&&typeof document<"u",pee=typeof navigator=="object"&&navigator||void 0,Cme=lte&&(!pee||["ReactNative","NativeScript","NS"].indexOf(pee.product)<0),Sme=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xme=lte&&window.location.href||"http://localhost",Eme=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:lte,hasStandardBrowserEnv:Cme,hasStandardBrowserWebWorkerEnv:Sme,navigator:pee,origin:xme},Symbol.toStringTag,{value:"Module"})),Gd={...Eme,...wme};function _me(o,a){return jH(o,new Gd.classes.URLSearchParams,Object.assign({visitor:function(c,d,g,p){return Gd.isNode&&Mn.isBuffer(c)?(this.append(d,c.toString("base64")),!1):p.defaultVisitor.apply(this,arguments)}},a))}function Tme(o){return Mn.matchAll(/\w+|\[(\w*)]/g,o).map(a=>a[0]==="[]"?"":a[1]||a[0])}function kme(o){const a={},c=Object.keys(o);let d;const g=c.length;let p;for(d=0;d<g;d++)p=c[d],a[p]=o[p];return a}function $ie(o){function a(c,d,g,p){let y=c[p++];if(y==="__proto__")return!0;const x=Number.isFinite(+y),T=p>=c.length;return y=!y&&Mn.isArray(g)?g.length:y,T?(Mn.hasOwnProp(g,y)?g[y]=[g[y],d]:g[y]=d,!x):((!g[y]||!Mn.isObject(g[y]))&&(g[y]=[]),a(c,d,g[y],p)&&Mn.isArray(g[y])&&(g[y]=kme(g[y])),!x)}if(Mn.isFormData(o)&&Mn.isFunction(o.entries)){const c={};return Mn.forEachEntry(o,(d,g)=>{a(Tme(d),g,c,0)}),c}return null}function Ame(o,a,c){if(Mn.isString(o))try{return(a||JSON.parse)(o),Mn.trim(o)}catch(d){if(d.name!=="SyntaxError")throw d}return(0,JSON.stringify)(o)}const xM={transitional:Nie,adapter:["xhr","http","fetch"],transformRequest:[function(o,a){const c=a.getContentType()||"",d=c.indexOf("application/json")>-1,g=Mn.isObject(o);if(g&&Mn.isHTMLForm(o)&&(o=new FormData(o)),Mn.isFormData(o))return d?JSON.stringify($ie(o)):o;if(Mn.isArrayBuffer(o)||Mn.isBuffer(o)||Mn.isStream(o)||Mn.isFile(o)||Mn.isBlob(o)||Mn.isReadableStream(o))return o;if(Mn.isArrayBufferView(o))return o.buffer;if(Mn.isURLSearchParams(o))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),o.toString();let p;if(g){if(c.indexOf("application/x-www-form-urlencoded")>-1)return _me(o,this.formSerializer).toString();if((p=Mn.isFileList(o))||c.indexOf("multipart/form-data")>-1){const y=this.env&&this.env.FormData;return jH(p?{"files[]":o}:o,y&&new y,this.formSerializer)}}return g||d?(a.setContentType("application/json",!1),Ame(o)):o}],transformResponse:[function(o){const a=this.transitional||xM.transitional,c=a&&a.forcedJSONParsing,d=this.responseType==="json";if(Mn.isResponse(o)||Mn.isReadableStream(o))return o;if(o&&Mn.isString(o)&&(c&&!this.responseType||d)){const g=!(a&&a.silentJSONParsing)&&d;try{return JSON.parse(o)}catch(p){if(g)throw p.name==="SyntaxError"?Er.from(p,Er.ERR_BAD_RESPONSE,this,null,this.response):p}}return o}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Gd.classes.FormData,Blob:Gd.classes.Blob},validateStatus:function(o){return o>=200&&o<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Mn.forEach(["delete","get","head","post","put","patch"],o=>{xM.headers[o]={}});const Ome=Mn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Nme=o=>{const a={};let c,d,g;return o&&o.split(`
2
2
  `).forEach(function(p){g=p.indexOf(":"),c=p.substring(0,g).trim().toLowerCase(),d=p.substring(g+1).trim(),!(!c||a[c]&&Ome[c])&&(c==="set-cookie"?a[c]?a[c].push(d):a[c]=[d]:a[c]=a[c]?a[c]+", "+d:d)}),a},Joe=Symbol("internals");function j6(o){return o&&String(o).trim().toLowerCase()}function GV(o){return o===!1||o==null?o:Mn.isArray(o)?o.map(GV):String(o)}function $me(o){const a=Object.create(null),c=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let d;for(;d=c.exec(o);)a[d[1]]=d[2];return a}const Dme=o=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());function wQ(o,a,c,d,g){if(Mn.isFunction(d))return d.call(this,a,c);if(g&&(a=c),!!Mn.isString(a)){if(Mn.isString(d))return a.indexOf(d)!==-1;if(Mn.isRegExp(d))return d.test(a)}}function Mme(o){return o.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(a,c,d)=>c.toUpperCase()+d)}function Rme(o,a){const c=Mn.toCamelCase(" "+a);["get","set","has"].forEach(d=>{Object.defineProperty(o,d+c,{value:function(g,p,y){return this[d].call(this,a,g,p,y)},configurable:!0})})}let vm=class{constructor(a){a&&this.set(a)}set(a,c,d){const g=this;function p(x,T,A){const M=j6(T);if(!M)throw new Error("header name must be a non-empty string");const P=Mn.findKey(g,M);(!P||g[P]===void 0||A===!0||A===void 0&&g[P]!==!1)&&(g[P||T]=GV(x))}const y=(x,T)=>Mn.forEach(x,(A,M)=>p(A,M,T));if(Mn.isPlainObject(a)||a instanceof this.constructor)y(a,c);else if(Mn.isString(a)&&(a=a.trim())&&!Dme(a))y(Nme(a),c);else if(Mn.isHeaders(a))for(const[x,T]of a.entries())p(T,x,d);else a!=null&&p(c,a,d);return this}get(a,c){if(a=j6(a),a){const d=Mn.findKey(this,a);if(d){const g=this[d];if(!c)return g;if(c===!0)return $me(g);if(Mn.isFunction(c))return c.call(this,g,d);if(Mn.isRegExp(c))return c.exec(g);throw new TypeError("parser must be boolean|regexp|function")}}}has(a,c){if(a=j6(a),a){const d=Mn.findKey(this,a);return!!(d&&this[d]!==void 0&&(!c||wQ(this,this[d],d,c)))}return!1}delete(a,c){const d=this;let g=!1;function p(y){if(y=j6(y),y){const x=Mn.findKey(d,y);x&&(!c||wQ(d,d[x],x,c))&&(delete d[x],g=!0)}}return Mn.isArray(a)?a.forEach(p):p(a),g}clear(a){const c=Object.keys(this);let d=c.length,g=!1;for(;d--;){const p=c[d];(!a||wQ(this,this[p],p,a,!0))&&(delete this[p],g=!0)}return g}normalize(a){const c=this,d={};return Mn.forEach(this,(g,p)=>{const y=Mn.findKey(d,p);if(y){c[y]=GV(g),delete c[p];return}const x=a?Mme(p):String(p).trim();x!==p&&delete c[p],c[x]=GV(g),d[x]=!0}),this}concat(...a){return this.constructor.concat(this,...a)}toJSON(a){const c=Object.create(null);return Mn.forEach(this,(d,g)=>{d!=null&&d!==!1&&(c[g]=a&&Mn.isArray(d)?d.join(", "):d)}),c}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([a,c])=>a+": "+c).join(`
3
3
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...c){const d=new this(a);return c.forEach(g=>d.set(g)),d}static accessor(a){const c=(this[Joe]=this[Joe]={accessors:{}}).accessors,d=this.prototype;function g(p){const y=j6(p);c[y]||(Rme(d,p),c[y]=!0)}return Mn.isArray(a)?a.forEach(g):g(a),this}};vm.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Mn.reduceDescriptors(vm.prototype,({value:o},a)=>{let c=a[0].toUpperCase()+a.slice(1);return{get:()=>o,set(d){this[c]=d}}});Mn.freezeMethods(vm);function CQ(o,a){const c=this||xM,d=a||c,g=vm.from(d.headers);let p=d.data;return Mn.forEach(o,function(y){p=y.call(c,p,g.normalize(),a?a.status:void 0)}),g.normalize(),p}function Die(o){return!!(o&&o.__CANCEL__)}function F4(o,a,c){Er.call(this,o??"canceled",Er.ERR_CANCELED,a,c),this.name="CanceledError"}Mn.inherits(F4,Er,{__CANCEL__:!0});function Mie(o,a,c){const d=c.config.validateStatus;!c.status||!d||d(c.status)?o(c):a(new Er("Request failed with status code "+c.status,[Er.ERR_BAD_REQUEST,Er.ERR_BAD_RESPONSE][Math.floor(c.status/100)-4],c.config,c.request,c))}function Ime(o){const a=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return a&&a[1]||""}function Pme(o,a){o=o||10;const c=new Array(o),d=new Array(o);let g=0,p=0,y;return a=a!==void 0?a:1e3,function(x){const T=Date.now(),A=d[p];y||(y=T),c[g]=x,d[g]=T;let M=p,P=0;for(;M!==g;)P+=c[M++],M=M%o;if(g=(g+1)%o,g===p&&(p=(p+1)%o),T-y<a)return;const z=A&&T-A;return z?Math.round(P*1e3/z):void 0}}function Bme(o,a){let c=0,d=1e3/a,g,p;const y=(x,T=Date.now())=>{c=T,g=null,p&&(clearTimeout(p),p=null),o.apply(null,x)};return[(...x)=>{const T=Date.now(),A=T-c;A>=d?y(x,T):(g=x,p||(p=setTimeout(()=>{p=null,y(g)},d-A)))},()=>g&&y(g)]}const iH=(o,a,c=3)=>{let d=0;const g=Pme(50,250);return Bme(p=>{const y=p.loaded,x=p.lengthComputable?p.total:void 0,T=y-d,A=g(T),M=y<=x;d=y;const P={loaded:y,total:x,progress:x?y/x:void 0,bytes:T,rate:A||void 0,estimated:A&&x&&M?(x-y)/A:void 0,event:p,lengthComputable:x!=null,[a?"download":"upload"]:!0};o(P)},c)},Qoe=(o,a)=>{const c=o!=null;return[d=>a[0]({lengthComputable:c,total:o,loaded:d}),a[1]]},ese=o=>(...a)=>Mn.asap(()=>o(...a)),Fme=Gd.hasStandardBrowserEnv?((o,a)=>c=>(c=new URL(c,Gd.origin),o.protocol===c.protocol&&o.host===c.host&&(a||o.port===c.port)))(new URL(Gd.origin),Gd.navigator&&/(msie|trident)/i.test(Gd.navigator.userAgent)):()=>!0,Lme=Gd.hasStandardBrowserEnv?{write(o,a,c,d,g,p){const y=[o+"="+encodeURIComponent(a)];Mn.isNumber(c)&&y.push("expires="+new Date(c).toGMTString()),Mn.isString(d)&&y.push("path="+d),Mn.isString(g)&&y.push("domain="+g),p===!0&&y.push("secure"),document.cookie=y.join("; ")},read(o){const a=document.cookie.match(new RegExp("(^|;\\s*)("+o+")=([^;]*)"));return a?decodeURIComponent(a[3]):null},remove(o){this.write(o,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Vme(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function Hme(o,a){return a?o.replace(/\/?\/$/,"")+"/"+a.replace(/^\/+/,""):o}function Rie(o,a){return o&&!Vme(a)?Hme(o,a):a}const tse=o=>o instanceof vm?{...o}:o;function Kx(o,a){a=a||{};const c={};function d(A,M,P,z){return Mn.isPlainObject(A)&&Mn.isPlainObject(M)?Mn.merge.call({caseless:z},A,M):Mn.isPlainObject(M)?Mn.merge({},M):Mn.isArray(M)?M.slice():M}function g(A,M,P,z){if(Mn.isUndefined(M)){if(!Mn.isUndefined(A))return d(void 0,A,P,z)}else return d(A,M,P,z)}function p(A,M){if(!Mn.isUndefined(M))return d(void 0,M)}function y(A,M){if(Mn.isUndefined(M)){if(!Mn.isUndefined(A))return d(void 0,A)}else return d(void 0,M)}function x(A,M,P){if(P in a)return d(A,M);if(P in o)return d(void 0,A)}const T={url:p,method:p,data:p,baseURL:y,transformRequest:y,transformResponse:y,paramsSerializer:y,timeout:y,timeoutMessage:y,withCredentials:y,withXSRFToken:y,adapter:y,responseType:y,xsrfCookieName:y,xsrfHeaderName:y,onUploadProgress:y,onDownloadProgress:y,decompress:y,maxContentLength:y,maxBodyLength:y,beforeRedirect:y,transport:y,httpAgent:y,httpsAgent:y,cancelToken:y,socketPath:y,responseEncoding:y,validateStatus:x,headers:(A,M,P)=>g(tse(A),tse(M),P,!0)};return Mn.forEach(Object.keys(Object.assign({},o,a)),function(A){const M=T[A]||g,P=M(o[A],a[A],A);Mn.isUndefined(P)&&M!==x||(c[A]=P)}),c}const Iie=o=>{const a=Kx({},o);let{data:c,withXSRFToken:d,xsrfHeaderName:g,xsrfCookieName:p,headers:y,auth:x}=a;a.headers=y=vm.from(y),a.url=Oie(Rie(a.baseURL,a.url),o.params,o.paramsSerializer),x&&y.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):"")));let T;if(Mn.isFormData(c)){if(Gd.hasStandardBrowserEnv||Gd.hasStandardBrowserWebWorkerEnv)y.setContentType(void 0);else if((T=y.getContentType())!==!1){const[A,...M]=T?T.split(";").map(P=>P.trim()).filter(Boolean):[];y.setContentType([A||"multipart/form-data",...M].join("; "))}}if(Gd.hasStandardBrowserEnv&&(d&&Mn.isFunction(d)&&(d=d(a)),d||d!==!1&&Fme(a.url))){const A=g&&p&&Lme.read(p);A&&y.set(g,A)}return a},zme=typeof XMLHttpRequest<"u",Ume=zme&&function(o){return new Promise(function(a,c){const d=Iie(o);let g=d.data;const p=vm.from(d.headers).normalize();let{responseType:y,onUploadProgress:x,onDownloadProgress:T}=d,A,M,P,z,U;function q(){z&&z(),U&&U(),d.cancelToken&&d.cancelToken.unsubscribe(A),d.signal&&d.signal.removeEventListener("abort",A)}let Q=new XMLHttpRequest;Q.open(d.method.toUpperCase(),d.url,!0),Q.timeout=d.timeout;function ee(){if(!Q)return;const ae=vm.from("getAllResponseHeaders"in Q&&Q.getAllResponseHeaders()),Z={data:!y||y==="text"||y==="json"?Q.responseText:Q.response,status:Q.status,statusText:Q.statusText,headers:ae,config:o,request:Q};Mie(function(Ae){a(Ae),q()},function(Ae){c(Ae),q()},Z),Q=null}"onloadend"in Q?Q.onloadend=ee:Q.onreadystatechange=function(){!Q||Q.readyState!==4||Q.status===0&&!(Q.responseURL&&Q.responseURL.indexOf("file:")===0)||setTimeout(ee)},Q.onabort=function(){Q&&(c(new Er("Request aborted",Er.ECONNABORTED,o,Q)),Q=null)},Q.onerror=function(){c(new Er("Network Error",Er.ERR_NETWORK,o,Q)),Q=null},Q.ontimeout=function(){let ae=d.timeout?"timeout of "+d.timeout+"ms exceeded":"timeout exceeded";const Z=d.transitional||Nie;d.timeoutErrorMessage&&(ae=d.timeoutErrorMessage),c(new Er(ae,Z.clarifyTimeoutError?Er.ETIMEDOUT:Er.ECONNABORTED,o,Q)),Q=null},g===void 0&&p.setContentType(null),"setRequestHeader"in Q&&Mn.forEach(p.toJSON(),function(ae,Z){Q.setRequestHeader(Z,ae)}),Mn.isUndefined(d.withCredentials)||(Q.withCredentials=!!d.withCredentials),y&&y!=="json"&&(Q.responseType=d.responseType),T&&([P,U]=iH(T,!0),Q.addEventListener("progress",P)),x&&Q.upload&&([M,z]=iH(x),Q.upload.addEventListener("progress",M),Q.upload.addEventListener("loadend",z)),(d.cancelToken||d.signal)&&(A=ae=>{Q&&(c(!ae||ae.type?new F4(null,o,Q):ae),Q.abort(),Q=null)},d.cancelToken&&d.cancelToken.subscribe(A),d.signal&&(d.signal.aborted?A():d.signal.addEventListener("abort",A)));const le=Ime(d.url);if(le&&Gd.protocols.indexOf(le)===-1){c(new Er("Unsupported protocol "+le+":",Er.ERR_BAD_REQUEST,o));return}Q.send(g||null)})},jme=(o,a)=>{const{length:c}=o=o?o.filter(Boolean):[];if(a||c){let d=new AbortController,g;const p=function(A){if(!g){g=!0,x();const M=A instanceof Error?A:this.reason;d.abort(M instanceof Er?M:new F4(M instanceof Error?M.message:M))}};let y=a&&setTimeout(()=>{y=null,p(new Er(`timeout ${a} of ms exceeded`,Er.ETIMEDOUT))},a);const x=()=>{o&&(y&&clearTimeout(y),y=null,o.forEach(A=>{A.unsubscribe?A.unsubscribe(p):A.removeEventListener("abort",p)}),o=null)};o.forEach(A=>A.addEventListener("abort",p));const{signal:T}=d;return T.unsubscribe=()=>Mn.asap(x),T}},Wme=function*(o,a){let c=o.byteLength;if(c<a){yield o;return}let d=0,g;for(;d<c;)g=d+a,yield o.slice(d,g),d=g},Zme=async function*(o,a){for await(const c of Gme(o))yield*Wme(c,a)},Gme=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const a=o.getReader();try{for(;;){const{done:c,value:d}=await a.read();if(c)break;yield d}}finally{await a.cancel()}},nse=(o,a,c,d)=>{const g=Zme(o,a);let p=0,y,x=T=>{y||(y=!0,d&&d(T))};return new ReadableStream({async pull(T){try{const{done:A,value:M}=await g.next();if(A){x(),T.close();return}let P=M.byteLength;if(c){let z=p+=P;c(z)}T.enqueue(new Uint8Array(M))}catch(A){throw x(A),A}},cancel(T){return x(T),g.return()}},{highWaterMark:2})},WH=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Pie=WH&&typeof ReadableStream=="function",qme=WH&&(typeof TextEncoder=="function"?(o=>a=>o.encode(a))(new TextEncoder):async o=>new Uint8Array(await new Response(o).arrayBuffer())),Bie=(o,...a)=>{try{return!!o(...a)}catch{return!1}},Yme=Pie&&Bie(()=>{let o=!1;const a=new Request(Gd.origin,{body:new ReadableStream,method:"POST",get duplex(){return o=!0,"half"}}).headers.has("Content-Type");return o&&!a}),ose=64*1024,bee=Pie&&Bie(()=>Mn.isReadableStream(new Response("").body)),cH={stream:bee&&(o=>o.body)};WH&&(o=>{["text","arrayBuffer","blob","formData","stream"].forEach(a=>{!cH[a]&&(cH[a]=Mn.isFunction(o[a])?c=>c[a]():(c,d)=>{throw new Er(`Response type '${a}' is not supported`,Er.ERR_NOT_SUPPORT,d)})})})(new Response);const Kme=async o=>{if(o==null)return 0;if(Mn.isBlob(o))return o.size;if(Mn.isSpecCompliantForm(o))return(await new Request(Gd.origin,{method:"POST",body:o}).arrayBuffer()).byteLength;if(Mn.isArrayBufferView(o)||Mn.isArrayBuffer(o))return o.byteLength;if(Mn.isURLSearchParams(o)&&(o=o+""),Mn.isString(o))return(await qme(o)).byteLength},Xme=async(o,a)=>Mn.toFiniteNumber(o.getContentLength())??Kme(a),Jme=WH&&(async o=>{let{url:a,method:c,data:d,signal:g,cancelToken:p,timeout:y,onDownloadProgress:x,onUploadProgress:T,responseType:A,headers:M,withCredentials:P="same-origin",fetchOptions:z}=Iie(o);A=A?(A+"").toLowerCase():"text";let U=jme([g,p&&p.toAbortSignal()],y),q;const Q=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let ee;try{if(T&&Yme&&c!=="get"&&c!=="head"&&(ee=await Xme(M,d))!==0){let mt=new Request(a,{method:"POST",body:d,duplex:"half"}),Le;if(Mn.isFormData(d)&&(Le=mt.headers.get("content-type"))&&M.setContentType(Le),mt.body){const[J,Ge]=Qoe(ee,iH(ese(T)));d=nse(mt.body,ose,J,Ge)}}Mn.isString(P)||(P=P?"include":"omit");const le="credentials"in Request.prototype;q=new Request(a,{...z,signal:U,method:c.toUpperCase(),headers:M.normalize().toJSON(),body:d,duplex:"half",credentials:le?P:void 0});let ae=await fetch(q);const Z=bee&&(A==="stream"||A==="response");if(bee&&(x||Z&&Q)){const mt={};["status","statusText","headers"].forEach(vt=>{mt[vt]=ae[vt]});const Le=Mn.toFiniteNumber(ae.headers.get("content-length")),[J,Ge]=x&&Qoe(Le,iH(ese(x),!0))||[];ae=new Response(nse(ae.body,ose,J,()=>{Ge&&Ge(),Q&&Q()}),mt)}A=A||"text";let Ae=await cH[Mn.findKey(cH,A)||"text"](ae,o);return!Z&&Q&&Q(),await new Promise((mt,Le)=>{Mie(mt,Le,{data:Ae,headers:vm.from(ae.headers),status:ae.status,statusText:ae.statusText,config:o,request:q})})}catch(le){throw Q&&Q(),le&&le.name==="TypeError"&&/fetch/i.test(le.message)?Object.assign(new Er("Network Error",Er.ERR_NETWORK,o,q),{cause:le.cause||le}):Er.from(le,le&&le.code,o,q)}}),vee={http:mme,xhr:Ume,fetch:Jme};Mn.forEach(vee,(o,a)=>{if(o){try{Object.defineProperty(o,"name",{value:a})}catch{}Object.defineProperty(o,"adapterName",{value:a})}});const sse=o=>`- ${o}`,Qme=o=>Mn.isFunction(o)||o===null||o===!1,Fie={getAdapter:o=>{o=Mn.isArray(o)?o:[o];const{length:a}=o;let c,d;const g={};for(let p=0;p<a;p++){c=o[p];let y;if(d=c,!Qme(c)&&(d=vee[(y=String(c)).toLowerCase()],d===void 0))throw new Er(`Unknown adapter '${y}'`);if(d)break;g[y||"#"+p]=d}if(!d){const p=Object.entries(g).map(([x,T])=>`adapter ${x} `+(T===!1?"is not supported by the environment":"is not available in the build"));let y=a?p.length>1?`since :
4
4
  `+p.map(sse).join(`
@@ -109,7 +109,7 @@ Required: `+v.join(", "));return vn[fe].apply(null,ke)},log:vn=>{console.log(vn,
109
109
  `:"")+"</video>",ve=(Xe,qe)=>{var Bt;const Yt=we.extend({},qe);if(!Yt.source&&(we.extend(Yt,nt((Bt=Yt.embed)!==null&&Bt!==void 0?Bt:"",Xe.schema)),!Yt.source))return"";Yt.altsource||(Yt.altsource=""),Yt.poster||(Yt.poster=""),Yt.source=Xe.convertURL(Yt.source,"source"),Yt.altsource=Xe.convertURL(Yt.altsource,"source"),Yt.sourcemime=ge(Yt.source),Yt.altsourcemime=ge(Yt.altsource),Yt.poster=Xe.convertURL(Yt.poster,"poster");const fo=Ct(Yt.source);if(fo&&(Yt.source=fo.url,Yt.type=fo.type,Yt.allowfullscreen=fo.allowFullscreen,Yt.width=Yt.width||String(fo.w),Yt.height=Yt.height||String(fo.h)),Yt.embed)return gn(Yt.embed,Yt,!0,Xe.schema);{const No=mt(Xe),Wo=Le(Xe),js=J(Xe);return Yt.width=Yt.width||"300",Yt.height=Yt.height||"150",we.each(Yt,(cn,Wt)=>{Yt[Wt]=Xe.dom.encode(""+cn)}),Yt.type==="iframe"?K(Yt,js):Yt.sourcemime==="application/x-shockwave-flash"?re(Yt):Yt.sourcemime.indexOf("audio")!==-1?ce(Yt,No):W(Yt,Wo)}},Ne=Xe=>Xe.hasAttribute("data-mce-object")||Xe.hasAttribute("data-ephox-embed-iri"),Pe=Xe=>{Xe.on("mousedown",qe=>{const Bt=Xe.dom.getParent(qe.target,".mce-preview-object");Bt&&Xe.dom.getAttrib(Bt,"data-mce-selected")==="2"&&qe.stopImmediatePropagation()}),Xe.on("click keyup touchend",()=>{const qe=Xe.selection.getNode();qe&&Xe.dom.hasClass(qe,"mce-preview-object")&&Xe.dom.getAttrib(qe,"data-mce-selected")&&qe.setAttribute("data-mce-selected","2")}),Xe.on("ObjectResized",qe=>{const Bt=qe.target;if(Bt.getAttribute("data-mce-object")){let Yt=Bt.getAttribute("data-mce-html");Yt&&(Yt=unescape(Yt),Bt.setAttribute("data-mce-html",escape(gn(Yt,{width:String(qe.width),height:String(qe.height)},!1,Xe.schema))))}})},ut={},je=(Xe,qe,Bt)=>new Promise((Yt,fo)=>{const No=Wo=>(Wo.html&&(ut[Xe.source]=Wo),Yt({url:Xe.source,html:Wo.html?Wo.html:qe(Xe)}));ut[Xe.source]?No(ut[Xe.source]):Bt({url:Xe.source}).then(No).catch(fo)}),pt=(Xe,qe)=>Promise.resolve({html:qe(Xe),url:Xe.source}),$t=Xe=>qe=>ve(Xe,qe),hn=(Xe,qe)=>{const Bt=yt(Xe);return Bt?je(qe,$t(Xe),Bt):pt(qe,$t(Xe))},Et=Xe=>ae(ut,Xe),It=(Xe,qe)=>le(qe,Xe).bind(Bt=>le(Bt,"meta")),dn=(Xe,qe,Bt)=>Yt=>{const fo=()=>le(Xe,Yt),No=()=>le(qe,Yt),Wo=Wt=>le(Wt,"value").bind(Qe=>Qe.length>0?A.some(Qe):A.none()),js=()=>fo().bind(Wt=>p(Wt)?Wo(Wt).orThunk(No):No().orThunk(()=>A.from(Wt))),cn=()=>No().orThunk(()=>fo().bind(Wt=>p(Wt)?Wo(Wt):A.from(Wt)));return{[Yt]:(Yt===Bt?js():cn()).getOr("")}},_n=(Xe,qe)=>{const Bt={};return le(Xe,"dimensions").each(Yt=>{P(["width","height"],fo=>{le(qe,fo).orThunk(()=>le(Yt,fo)).each(No=>Bt[fo]=No)})}),Bt},So=(Xe,qe)=>{const Bt=qe&&qe!=="dimensions"?It(qe,Xe).getOr({}):{},Yt=dn(Xe,Bt,qe);return{...Yt("source"),...Yt("altsource"),...Yt("poster"),...Yt("embed"),..._n(Xe,Bt)}},Jn=Xe=>{const qe={...Xe,source:{value:le(Xe,"source").getOr("")},altsource:{value:le(Xe,"altsource").getOr("")},poster:{value:le(Xe,"poster").getOr("")}};return P(["width","height"],Bt=>{le(Xe,Bt).each(Yt=>{const fo=qe.dimensions||{};fo[Bt]=Yt,qe.dimensions=fo})}),qe},Ot=Xe=>qe=>{const Bt=qe&&qe.msg?"Media embed handler error: "+qe.msg:"Media embed handler threw unknown error.";Xe.notificationManager.open({type:"error",text:Bt})},rn=Xe=>{const qe=Xe.selection.getNode(),Bt=Ne(qe)?Xe.serializer.serialize(qe,{selection:!0}):"",Yt=nt(Bt,Xe.schema),No=(()=>{if(Mo(Yt.source,Yt.type)){const Wo=Xe.dom.getRect(qe);return{width:Wo.w.toString().replace(/px$/,""),height:Wo.h.toString().replace(/px$/,"")}}else return{}})();return{embed:Bt,...Yt,...No}},an=(Xe,qe)=>Bt=>{if(g(Bt.url)&&Bt.url.trim().length>0){const Yt=Bt.html,No={...nt(Yt,qe.schema),source:Bt.url,embed:Yt};Xe.setData(Jn(No))}},On=(Xe,qe)=>{const Bt=Xe.dom.select("*[data-mce-object]");for(let Yt=0;Yt<qe.length;Yt++)for(let fo=Bt.length-1;fo>=0;fo--)qe[Yt]===Bt[fo]&&Bt.splice(fo,1);Xe.selection.select(Bt[0])},_o=(Xe,qe)=>{const Bt=Xe.dom.select("*[data-mce-object]");Xe.insertContent(qe),On(Xe,Bt),Xe.nodeChanged()},Mo=(Xe,qe)=>T(qe)&&qe==="ephox-embed-iri"&&T(Ct(Xe)),ws=(Xe,qe)=>((Yt,fo)=>Yt.width!==fo.width||Yt.height!==fo.height)(Xe,qe)&&Mo(qe.source,Xe.type),vo=(Xe,qe,Bt)=>{var Yt;qe.embed=ws(Xe,qe)&&Vt(Bt)?ve(Bt,{...qe,embed:""}):gn((Yt=qe.embed)!==null&&Yt!==void 0?Yt:"",qe,!1,Bt.schema),qe.embed&&(Xe.source===qe.source||Et(qe.source))?_o(Bt,qe.embed):hn(Bt,qe).then(fo=>{_o(Bt,fo.html)}).catch(Ot(Bt))},Us=Xe=>{const qe=rn(Xe),Bt=U(qe),Yt=Jn(qe),fo=(no,wo)=>{const Io=So(wo.getData(),"source");no.source!==Io.source&&(an(uo,Xe)({url:Io.source,html:""}),hn(Xe,Io).then(an(uo,Xe)).catch(Ot(Xe)))},No=no=>{var wo;const Io=So(no.getData()),cs=nt((wo=Io.embed)!==null&&wo!==void 0?wo:"",Xe.schema);no.setData(Jn(cs))},Wo=(no,wo,Io)=>{const cs=So(no.getData(),wo),Js=ws(Io,cs)&&Vt(Xe)?{...cs,embed:""}:cs,Es=ve(Xe,Js);no.setData(Jn({...Js,embed:Es}))},js=[{name:"source",type:"urlinput",filetype:"media",label:"Source",picker_text:"Browse files"}],cn=Vt(Xe)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],Wt={title:"General",name:"general",items:z([js,cn])},st={title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]},ln=[];De(Xe)&&ln.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),ue(Xe)&&ln.push({name:"poster",type:"urlinput",filetype:"image",label:"Media poster (Image URL)"});const yn={title:"Advanced",name:"advanced",items:ln},Hn=[Wt,st];ln.length>0&&Hn.push(yn);const co={type:"tabpanel",tabs:Hn},uo=Xe.windowManager.open({title:"Insert/Edit Media",size:"normal",body:co,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:no=>{const wo=So(no.getData());vo(Bt.get(),wo,Xe),no.close()},onChange:(no,wo)=>{switch(wo.name){case"source":fo(Bt.get(),no);break;case"embed":No(no);break;case"dimensions":case"altsource":case"poster":Wo(no,wo.name,Bt.get());break}Bt.set(So(no.getData()))},initialData:Yt})},fn=Xe=>({showDialog:()=>{Us(Xe)}}),Vo=Xe=>{const qe=()=>{Us(Xe)};Xe.addCommand("mceMedia",qe)},tr=(Xe,qe,Bt)=>Xe.length>=qe.length&&Xe.substr(Bt,Bt+qe.length)===qe,rr=(Xe,qe)=>tr(Xe,qe,0);var Pr=tinymce.util.Tools.resolve("tinymce.Env");const Br=Xe=>{const qe=Xe.name;return qe==="iframe"||qe==="video"||qe==="audio"},Ts=(Xe,qe,Bt,Yt=null)=>{const fo=Xe.attr(Bt);return T(fo)?fo:ae(qe,Bt)?null:Yt},Ar=(Xe,qe,Bt)=>{const Yt=qe.name==="img"||Xe.name==="video",fo=Yt?"300":null,No=Xe.name==="audio"?"30":"150",Wo=Yt?No:null;qe.attr({width:Ts(Xe,Bt,"width",fo),height:Ts(Xe,Bt,"height",Wo)})},Xr=(Xe,qe,Bt,Yt)=>{const fo=He(Xe.schema).parse(Yt,{context:qe});for(;fo.firstChild;)Bt.append(fo.firstChild)},xs=(Xe,qe)=>{const Bt=qe.name,Yt=new We("img",1);return Bs(Xe,qe,Yt),Ar(qe,Yt,{}),Yt.attr({style:qe.attr("style"),src:Pr.transparentSrc,"data-mce-object":Bt,class:"mce-object mce-object-"+Bt}),Yt},lo=(Xe,qe)=>{var Bt;const Yt=qe.name,fo=new We("span",1);fo.attr({contentEditable:"false",style:qe.attr("style"),"data-mce-object":Yt,class:"mce-preview-object mce-object-"+Yt}),Bs(Xe,qe,fo);const No=Xe.dom.parseStyle((Bt=qe.attr("style"))!==null&&Bt!==void 0?Bt:""),Wo=new We(Yt,1);if(Ar(qe,Wo,No),Wo.attr({src:qe.attr("src"),style:qe.attr("style"),class:qe.attr("class")}),Yt==="iframe")Wo.attr({allowfullscreen:qe.attr("allowfullscreen"),frameborder:"0",sandbox:qe.attr("sandbox"),referrerpolicy:qe.attr("referrerpolicy")});else{P(["controls","crossorigin","currentTime","loop","muted","poster","preload"],Qe=>{Wo.attr(Qe,qe.attr(Qe))});const Wt=fo.attr("data-mce-html");T(Wt)&&Xr(Xe,Yt,Wo,unescape(Wt))}const js=new We("span",1);return js.attr("class","mce-shim"),fo.append(Wo),fo.append(js),fo},Bs=(Xe,qe,Bt)=>{var Yt;const fo=(Yt=qe.attributes)!==null&&Yt!==void 0?Yt:[];let No=fo.length;for(;No--;){const Wt=fo[No].name;let Qe=fo[No].value;Wt!=="width"&&Wt!=="height"&&Wt!=="style"&&!rr(Wt,"data-mce-")&&((Wt==="data"||Wt==="src")&&(Qe=Xe.convertURL(Qe,Wt)),Bt.attr("data-mce-p-"+Wt,Qe))}const Wo=kt({inner:!0},Xe.schema),js=new We("div",1);P(qe.children(),Wt=>js.append(Wt));const cn=Wo.serialize(js);cn&&(Bt.attr("data-mce-html",escape(cn)),Bt.empty())},_t=Xe=>{const qe=Xe.attr("class");return g(qe)&&/\btiny-pageembed\b/.test(qe)},Ht=Xe=>{let qe=Xe;for(;qe=qe.parent;)if(qe.attr("data-ephox-embed-iri")||_t(qe))return!0;return!1},Bn=Xe=>qe=>{let Bt=qe.length,Yt;for(;Bt--;)Yt=qe[Bt],Yt.parent&&(Yt.parent.attr("data-mce-object")||(Br(Yt)&&Ge(Xe)?Ht(Yt)||Yt.replace(lo(Xe,Yt)):Ht(Yt)||Yt.replace(xs(Xe,Yt))))},ro=(Xe,qe,Bt)=>{const Yt=Xe.options.get,fo=Yt("xss_sanitization"),No=vt(Xe);return He(Xe.schema,{sanitize:fo,validate:No}).parse(Bt,{context:qe})},Ro=Xe=>{Xe.on("PreInit",()=>{const{schema:qe,serializer:Bt,parser:Yt}=Xe,fo=qe.getBoolAttrs();P("webkitallowfullscreen mozallowfullscreen".split(" "),No=>{fo[No]={}}),ee({embed:["wmode"]},(No,Wo)=>{const js=qe.getElementRule(Wo);js&&P(No,cn=>{js.attributes[cn]={},js.attributesOrder.push(cn)})}),Yt.addNodeFilter("iframe,video,audio,object,embed",Bn(Xe)),Bt.addAttributeFilter("data-mce-object",(No,Wo)=>{var js;let cn=No.length;for(;cn--;){const Wt=No[cn];if(!Wt.parent)continue;const Qe=Wt.attr(Wo),st=new We(Qe,1);if(Qe!=="audio"){const co=Wt.attr("class");co&&co.indexOf("mce-preview-object")!==-1&&Wt.firstChild?st.attr({width:Wt.firstChild.attr("width"),height:Wt.firstChild.attr("height")}):st.attr({width:Wt.attr("width"),height:Wt.attr("height")})}st.attr({style:Wt.attr("style")});const ln=(js=Wt.attributes)!==null&&js!==void 0?js:[];let yn=ln.length;for(;yn--;){const co=ln[yn].name;co.indexOf("data-mce-p-")===0&&st.attr(co.substr(11),ln[yn].value)}const Hn=Wt.attr("data-mce-html");if(Hn){const co=ro(Xe,Qe,unescape(Hn));P(co.children(),uo=>st.append(uo))}Wt.replace(st)}})}),Xe.on("SetContent",()=>{const qe=Xe.dom;P(qe.select("span.mce-preview-object"),Bt=>{qe.select("span.mce-shim",Bt).length===0&&qe.add(Bt,"span",{class:"mce-shim"})})})},is=Xe=>{Xe.on("ResolveName",qe=>{let Bt;qe.target.nodeType===1&&(Bt=qe.target.getAttribute("data-mce-object"))&&(qe.name=Bt)})},yr=Xe=>qe=>{const Bt=()=>{qe.setEnabled(Xe.selection.isEditable())};return Xe.on("NodeChange",Bt),Bt(),()=>{Xe.off("NodeChange",Bt)}},wr=Xe=>{const qe=()=>Xe.execCommand("mceMedia");Xe.ui.registry.addToggleButton("media",{tooltip:"Insert/edit media",icon:"embed",onAction:qe,onSetup:Bt=>{const Yt=Xe.selection;Bt.setActive(Ne(Yt.getNode()));const fo=Yt.selectorChangedWithUnbind("img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]",Bt.setActive).unbind,No=yr(Xe)(Bt);return()=>{fo(),No()}}}),Xe.ui.registry.addMenuItem("media",{icon:"embed",text:"Media...",onAction:qe,onSetup:yr(Xe)})};var ar=()=>{o.add("media",Xe=>(Ae(Xe),Vo(Xe),wr(Xe),is(Xe),Ro(Xe),Pe(Xe),fn(Xe)))};ar()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const a=le=>ae=>typeof ae===le,c=a("boolean"),d=a("number"),g=le=>ae=>ae.options.get(le),p=le=>{const ae=le.options.register;ae("nonbreaking_force_tab",{processor:Z=>c(Z)?{value:Z?3:0,valid:!0}:d(Z)?{value:Z,valid:!0}:{valid:!1,message:"Must be a boolean or number."},default:!1}),ae("nonbreaking_wrap",{processor:"boolean",default:!0})},y=g("nonbreaking_force_tab"),x=g("nonbreaking_wrap"),T=(le,ae)=>{let Z="";for(let Ae=0;Ae<ae;Ae++)Z+=le;return Z},A=le=>le.plugins.visualchars?le.plugins.visualchars.isEnabled():!1,M=(le,ae)=>{const Z=()=>A(le)?"mce-nbsp-wrap mce-nbsp":"mce-nbsp-wrap",Ae=()=>`<span class="${Z()}" contenteditable="false">${T("&nbsp;",ae)}</span>`,Le=x(le)||le.plugins.visualchars?Ae():T("&nbsp;",ae);le.undoManager.transact(()=>le.insertContent(Le))},P=le=>{le.addCommand("mceNonBreaking",()=>{M(le,1)})};var z=tinymce.util.Tools.resolve("tinymce.util.VK");const U=le=>{const ae=y(le);ae>0&&le.on("keydown",Z=>{if(Z.keyCode===z.TAB&&!Z.isDefaultPrevented()){if(Z.shiftKey)return;Z.preventDefault(),Z.stopImmediatePropagation(),M(le,ae)}})},q=le=>ae=>{const Z=()=>{ae.setEnabled(le.selection.isEditable())};return le.on("NodeChange",Z),Z(),()=>{le.off("NodeChange",Z)}},Q=le=>{const ae=()=>le.execCommand("mceNonBreaking");le.ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:ae,onSetup:q(le)}),le.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:ae,onSetup:q(le)})};var ee=()=>{o.add("nonbreaking",le=>{p(le),P(le),Q(le),U(le)})};ee()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.Env");const c=q=>Q=>Q.options.get(q),d=q=>{const Q=q.options.register;Q("pagebreak_separator",{processor:"string",default:"<!-- pagebreak -->"}),Q("pagebreak_split_block",{processor:"boolean",default:!1})},g=c("pagebreak_separator"),p=c("pagebreak_split_block"),y="mce-pagebreak",x=q=>{const Q=`<img src="${a.transparentSrc}" class="${y}" data-mce-resize="false" data-mce-placeholder />`;return q?`<p>${Q}</p>`:Q},T=q=>{const Q=g(q),ee=()=>p(q),le=new RegExp(Q.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,ae=>"\\"+ae),"gi");q.on("BeforeSetContent",ae=>{ae.content=ae.content.replace(le,x(ee()))}),q.on("PreInit",()=>{q.serializer.addNodeFilter("img",ae=>{let Z=ae.length,Ae,mt;for(;Z--;)if(Ae=ae[Z],mt=Ae.attr("class"),mt&&mt.indexOf(y)!==-1){const Le=Ae.parent;if(Le&&q.schema.getBlockElements()[Le.name]&&ee()){Le.type=3,Le.value=Q,Le.raw=!0,Ae.remove();continue}Ae.type=3,Ae.value=Q,Ae.raw=!0}})})},A=q=>{q.addCommand("mcePageBreak",()=>{q.insertContent(x(p(q)))})},M=q=>{q.on("ResolveName",Q=>{Q.target.nodeName==="IMG"&&q.dom.hasClass(Q.target,y)&&(Q.name="pagebreak")})},P=q=>Q=>{const ee=()=>{Q.setEnabled(q.selection.isEditable())};return q.on("NodeChange",ee),ee(),()=>{q.off("NodeChange",ee)}},z=q=>{const Q=()=>q.execCommand("mcePageBreak");q.ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:Q,onSetup:P(q)}),q.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:Q,onSetup:P(q)})};var U=()=>{o.add("pagebreak",q=>{d(q),A(q),z(q),T(q),M(q)})};U()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const c=(Ot=>rn=>Ot===rn)(void 0),d=Ot=>Ot==null,g=Ot=>!d(Ot);class p{constructor(rn,an){this.tag=rn,this.value=an}static some(rn){return new p(!0,rn)}static none(){return p.singletonNone}fold(rn,an){return this.tag?an(this.value):rn()}isSome(){return this.tag}isNone(){return!this.tag}map(rn){return this.tag?p.some(rn(this.value)):p.none()}bind(rn){return this.tag?rn(this.value):p.none()}exists(rn){return this.tag&&rn(this.value)}forall(rn){return!this.tag||rn(this.value)}filter(rn){return!this.tag||rn(this.value)?this:p.none()}getOr(rn){return this.tag?this.value:rn}or(rn){return this.tag?this:rn}getOrThunk(rn){return this.tag?this.value:rn()}orThunk(rn){return this.tag?this:rn()}getOrDie(rn){if(this.tag)return this.value;throw new Error(rn??"Called getOrDie on None")}static from(rn){return g(rn)?p.some(rn):p.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(rn){this.tag&&rn(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}p.singletonNone=new p(!1);const y=Ot=>()=>Ot,x=y(!1),T=(Ot,rn,an)=>{for(let On=0,_o=Ot.length;On<_o;On++){const Mo=Ot[On];if(rn(Mo,On))return p.some(Mo);if(an(Mo,On))break}return p.none()},A=(Ot,rn)=>T(Ot,rn,x),M=(Ot,rn)=>{for(let an=0;an<Ot.length;an++){const On=rn(Ot[an],an);if(On.isSome())return On}return p.none()};typeof window<"u"||Function("return this;")();const P=Ot=>{let rn=!1,an;return(...On)=>(rn||(rn=!0,an=Ot.apply(null,On)),an)},z=(Ot,rn,an,On)=>{const _o=Ot.isiOS()&&/ipad/i.test(an)===!0,Mo=Ot.isiOS()&&!_o,ws=Ot.isiOS()||Ot.isAndroid(),vo=ws||On("(pointer:coarse)"),Us=_o||!Mo&&ws&&On("(min-device-width:768px)"),fn=Mo||ws&&!Us,Vo=rn.isSafari()&&Ot.isiOS()&&/safari/i.test(an)===!1,tr=!fn&&!Us&&!Vo;return{isiPad:y(_o),isiPhone:y(Mo),isTablet:y(Us),isPhone:y(fn),isTouch:y(vo),isAndroid:Ot.isAndroid,isiOS:Ot.isiOS,isWebView:y(Vo),isDesktop:y(tr)}},U=(Ot,rn)=>{for(let an=0;an<Ot.length;an++){const On=Ot[an];if(On.test(rn))return On}},q=(Ot,rn)=>{const an=U(Ot,rn);if(!an)return{major:0,minor:0};const On=_o=>Number(rn.replace(an,"$"+_o));return le(On(1),On(2))},Q=(Ot,rn)=>{const an=String(rn).toLowerCase();return Ot.length===0?ee():q(Ot,an)},ee=()=>le(0,0),le=(Ot,rn)=>({major:Ot,minor:rn}),ae={nu:le,detect:Q,unknown:ee},Z=(Ot,rn)=>M(rn.brands,an=>{const On=an.brand.toLowerCase();return A(Ot,_o=>{var Mo;return On===((Mo=_o.brand)===null||Mo===void 0?void 0:Mo.toLowerCase())}).map(_o=>({current:_o.name,version:ae.nu(parseInt(an.version,10),0)}))}),Ae=(Ot,rn)=>{const an=String(rn).toLowerCase();return A(Ot,On=>On.search(an))},mt=(Ot,rn)=>Ae(Ot,rn).map(an=>{const On=ae.detect(an.versionRegexes,rn);return{current:an.name,version:On}}),Le=(Ot,rn)=>Ae(Ot,rn).map(an=>{const On=ae.detect(an.versionRegexes,rn);return{current:an.name,version:On}}),J=(Ot,rn,an=0,On)=>{const _o=Ot.indexOf(rn,an);return _o!==-1?c(On)?!0:_o+rn.length<=On:!1},Ge=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,vt=Ot=>rn=>J(rn,Ot),yt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:Ot=>J(Ot,"edge/")&&J(Ot,"chrome")&&J(Ot,"safari")&&J(Ot,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ge],search:Ot=>J(Ot,"chrome")&&!J(Ot,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:Ot=>J(Ot,"msie")||J(Ot,"trident")},{name:"Opera",versionRegexes:[Ge,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:vt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:vt("firefox")},{name:"Safari",versionRegexes:[Ge,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:Ot=>(J(Ot,"safari")||J(Ot,"mobile/"))&&J(Ot,"applewebkit")}],De=[{name:"Windows",search:vt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:Ot=>J(Ot,"iphone")||J(Ot,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:vt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:vt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:vt("linux"),versionRegexes:[]},{name:"Solaris",search:vt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:vt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:vt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],ue={browsers:y(yt),oses:y(De)},Vt="Edge",we="Chromium",Ie="IE",D="Opera",Ue="Firefox",be="Safari",tt=()=>nt({current:void 0,version:ae.unknown()}),nt=Ot=>{const rn=Ot.current,an=Ot.version,On=_o=>()=>rn===_o;return{current:rn,version:an,isEdge:On(Vt),isChromium:On(we),isIE:On(Ie),isOpera:On(D),isFirefox:On(Ue),isSafari:On(be)}},ge={unknown:tt,nu:nt,edge:y(Vt),chromium:y(we),ie:y(Ie),opera:y(D),firefox:y(Ue),safari:y(be)},We="Windows",kt="iOS",He="Android",ht="Linux",Me="macOS",lt="Solaris",te="FreeBSD",gn="ChromeOS",ft=()=>St({current:void 0,version:ae.unknown()}),St=Ot=>{const rn=Ot.current,an=Ot.version,On=_o=>()=>rn===_o;return{current:rn,version:an,isWindows:On(We),isiOS:On(kt),isAndroid:On(He),isMacOS:On(Me),isLinux:On(ht),isSolaris:On(lt),isFreeBSD:On(te),isChromeOS:On(gn)}},jt={unknown:ft,nu:St,windows:y(We),ios:y(kt),android:y(He),linux:y(ht),macos:y(Me),solaris:y(lt),freebsd:y(te),chromeos:y(gn)},K={detect:(Ot,rn,an)=>{const On=ue.browsers(),_o=ue.oses(),Mo=rn.bind(Us=>Z(On,Us)).orThunk(()=>mt(On,Ot)).fold(ge.unknown,ge.nu),ws=Le(_o,Ot).fold(jt.unknown,jt.nu),vo=z(ws,Mo,Ot,an);return{browser:Mo,os:ws,deviceType:vo}}},re=Ot=>window.matchMedia(Ot).matches;let ce=P(()=>K.detect(window.navigator.userAgent,p.from(window.navigator.userAgentData),re));const W=()=>ce(),ve=()=>W().os.isMacOS(),Ne=()=>W().os.isiOS(),Pe=()=>{const Ot=ve()||Ne();return`<script>(${(an=>{document.addEventListener("click",On=>{for(let _o=On.target;_o;_o=_o.parentNode)if(_o.nodeName==="A"){const ws=_o.getAttribute("href");if(ws&&ws.startsWith("#")){On.preventDefault();const Us=document.getElementById(ws.substring(1));Us&&Us.scrollIntoView({behavior:"smooth"});return}(an?On.metaKey:On.ctrlKey&&!On.altKey)||On.preventDefault()}},!1)}).toString()})(${Ot})<\/script>`};var ut=tinymce.util.Tools.resolve("tinymce.util.Tools");const je=Ot=>rn=>rn.options.get(Ot),pt=je("content_style"),$t=je("content_css_cors"),hn=je("body_class"),Et=je("body_id"),It=Ot=>{var rn;let an="";const On=Ot.dom.encode,_o=(rn=pt(Ot))!==null&&rn!==void 0?rn:"";an+=`<base href="${On(Ot.documentBaseURI.getURI())}">`;const Mo=$t(Ot)?' crossorigin="anonymous"':"";ut.each(Ot.contentCSS,tr=>{an+='<link type="text/css" rel="stylesheet" href="'+On(Ot.documentBaseURI.toAbsolute(tr))+'"'+Mo+">"}),_o&&(an+='<style type="text/css">'+_o+"</style>");const ws=Et(Ot),vo=hn(Ot),Us=Ot.getBody().dir,fn=Us?' dir="'+On(Us)+'"':"";return"<!DOCTYPE html><html><head>"+an+'</head><body id="'+On(ws)+'" class="mce-content-body '+On(vo)+'"'+fn+">"+Ot.getContent()+Pe()+"</body></html>"},dn=Ot=>{const rn=It(Ot);Ot.windowManager.open({title:"Preview",size:"large",body:{type:"panel",items:[{name:"preview",type:"iframe",sandboxed:!0,transparent:!1}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{preview:rn}}).focus("close")},_n=Ot=>{Ot.addCommand("mcePreview",()=>{dn(Ot)})},So=Ot=>{const rn=()=>Ot.execCommand("mcePreview");Ot.ui.registry.addButton("preview",{icon:"preview",tooltip:"Preview",onAction:rn,context:"any"}),Ot.ui.registry.addMenuItem("preview",{icon:"preview",text:"Preview",onAction:rn,context:"any"})};var Jn=()=>{o.add("preview",Ot=>{_n(Ot),So(Ot)})};Jn()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const a=()=>window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295;let c=0;const d=Ct=>{const re=new Date().getTime(),ce=Math.floor(a()*1e9);return c++,Ct+"_"+ce+c+String(re)},g=(Ct,K,re)=>{Ct.execCommand("mceInsertTable",!1,{rows:re,columns:K})},p=(Ct,K,re)=>{const ce=Ct.editorUpload.blobCache,W=ce.create(d("mceu"),re,K);ce.add(W),Ct.insertContent(Ct.dom.createHTML("img",{src:W.blobUri()}))},y=Ct=>new Promise(K=>{const re=new FileReader;re.onloadend=()=>{K(re.result.split(",")[1])},re.readAsDataURL(Ct)});var x=tinymce.util.Tools.resolve("tinymce.util.Delay");const T=Ct=>new Promise(K=>{let re=!1;const ce=document.createElement("input");ce.type="file",ce.accept="image/*",ce.style.position="fixed",ce.style.left="0",ce.style.top="0",ce.style.opacity="0.001",document.body.appendChild(ce);const W=Pe=>{var ut;re||((ut=ce.parentNode)===null||ut===void 0||ut.removeChild(ce),re=!0,K(Pe))},ve=Pe=>{W(Array.prototype.slice.call(Pe.target.files))};ce.addEventListener("input",ve),ce.addEventListener("change",ve);const Ne=Pe=>{const ut=()=>{W([])};re||(Pe.type==="focusin"?x.setEditorTimeout(Ct,ut,1e3):ut()),Ct.off("focusin remove",Ne)};Ct.on("focusin remove",Ne),ce.click()}),A=Ct=>{Ct.on("PreInit",()=>{Ct.queryCommandSupported("QuickbarInsertImage")||Ct.addCommand("QuickbarInsertImage",()=>{T(Ct).then(K=>{if(K.length>0){const re=K[0];y(re).then(ce=>{p(Ct,ce,re)})}})})})},M=(Ct,K,re)=>{var ce;return re(Ct,K.prototype)?!0:((ce=Ct.constructor)===null||ce===void 0?void 0:ce.name)===K.name},P=Ct=>{const K=typeof Ct;return Ct===null?"null":K==="object"&&Array.isArray(Ct)?"array":K==="object"&&M(Ct,String,(re,ce)=>ce.isPrototypeOf(re))?"string":K},z=Ct=>K=>P(K)===Ct,U=Ct=>K=>typeof K===Ct,q=z("string"),Q=U("boolean"),ee=Ct=>Ct==null,le=Ct=>!ee(Ct),ae=U("function"),Z=Ct=>K=>K.options.get(Ct),Ae=Ct=>{const K=Ct.options.register,re=Ne=>Pe=>{const ut=Q(Pe)||q(Pe);return ut?Q(Pe)?{value:Pe?Ne:"",valid:ut}:{value:Pe.trim(),valid:ut}:{valid:!1,message:"Must be a boolean or string."}},ce="bold italic | quicklink h2 h3 blockquote";K("quickbars_selection_toolbar",{processor:re(ce),default:ce});const W="quickimage quicktable";K("quickbars_insert_toolbar",{processor:re(W),default:W});const ve="alignleft aligncenter alignright";K("quickbars_image_toolbar",{processor:re(ve),default:ve})},mt=Z("quickbars_selection_toolbar"),Le=Z("quickbars_insert_toolbar"),J=Z("quickbars_image_toolbar"),Ge=Ct=>{Ct.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:()=>Ct.execCommand("QuickbarInsertImage")}),Ct.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:()=>{g(Ct,2,2)}})},yt=(Ct=>()=>Ct)(!1);class De{constructor(K,re){this.tag=K,this.value=re}static some(K){return new De(!0,K)}static none(){return De.singletonNone}fold(K,re){return this.tag?re(this.value):K()}isSome(){return this.tag}isNone(){return!this.tag}map(K){return this.tag?De.some(K(this.value)):De.none()}bind(K){return this.tag?K(this.value):De.none()}exists(K){return this.tag&&K(this.value)}forall(K){return!this.tag||K(this.value)}filter(K){return!this.tag||K(this.value)?this:De.none()}getOr(K){return this.tag?this.value:K}or(K){return this.tag?this:K}getOrThunk(K){return this.tag?this.value:K()}orThunk(K){return this.tag?this:K()}getOrDie(K){if(this.tag)return this.value;throw new Error(K??"Called getOrDie on None")}static from(K){return le(K)?De.some(K):De.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(K){this.tag&&K(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}De.singletonNone=new De(!1),typeof window<"u"||Function("return this;")();const ue=1,Vt=Ct=>Ct.dom.nodeName.toLowerCase(),we=(Ct,K)=>{const re=Ct.dom;return re&&re.hasAttribute?re.hasAttribute(K):!1};var Ie=(Ct,K,re,ce,W)=>Ct(re,ce)?De.some(re):ae(W)&&W(re)?De.none():K(re,ce,W);const D=(Ct,K)=>{const ce=(K||document).createElement("div");if(ce.innerHTML=Ct,!ce.hasChildNodes()||ce.childNodes.length>1){const W="HTML does not have a single root node";throw console.error(W,Ct),new Error(W)}return tt(ce.childNodes[0])},Ue=(Ct,K)=>{const ce=(K||document).createElement(Ct);return tt(ce)},be=(Ct,K)=>{const ce=(K||document).createTextNode(Ct);return tt(ce)},tt=Ct=>{if(Ct==null)throw new Error("Node cannot be null or undefined");return{dom:Ct}},ge={fromHtml:D,fromTag:Ue,fromText:be,fromDom:tt,fromPoint:(Ct,K,re)=>De.from(Ct.dom.elementFromPoint(K,re)).map(tt)},We=(Ct,K)=>{const re=Ct.dom;if(re.nodeType!==ue)return!1;{const ce=re;if(ce.matches!==void 0)return ce.matches(K);if(ce.msMatchesSelector!==void 0)return ce.msMatchesSelector(K);if(ce.webkitMatchesSelector!==void 0)return ce.webkitMatchesSelector(K);if(ce.mozMatchesSelector!==void 0)return ce.mozMatchesSelector(K);throw new Error("Browser lacks native selectors")}},kt=(Ct,K,re)=>{let ce=Ct.dom;const W=ae(re)?re:yt;for(;ce.parentNode;){ce=ce.parentNode;const ve=ge.fromDom(ce);if(K(ve))return De.some(ve);if(W(ve))break}return De.none()},He=(Ct,K,re)=>Ie((W,ve)=>ve(W),kt,Ct,K,re),ht=(Ct,K,re)=>He(Ct,K,re).isSome(),Me=(Ct,K,re)=>kt(Ct,ce=>We(ce,K),re),lt=(Ct,K,re)=>Ie((W,ve)=>We(W,ve),Me,Ct,K,re),te=Ct=>{const K=Le(Ct);K.length>0&&Ct.ui.registry.addContextToolbar("quickblock",{predicate:re=>{const ce=ge.fromDom(re),W=Ct.schema.getTextBlockElements(),ve=Ne=>Ne.dom===Ct.getBody();return!we(ce,"data-mce-bogus")&&lt(ce,'table,[data-mce-bogus="all"]',ve).fold(()=>ht(ce,Ne=>Vt(Ne)in W&&Ct.dom.isEmpty(Ne.dom),ve),yt)},items:K,position:"line",scope:"editor"})},gn=Ct=>Ct.dom.classList!==void 0,ft=(Ct,K)=>gn(Ct)&&Ct.dom.classList.contains(K),St=Ct=>{const K=Ne=>Ct.dom.isEditable(Ne),re=Ne=>K(Ne.parentElement),ce=Ne=>{const Pe=Ne.nodeName==="FIGURE"&&/image/i.test(Ne.className),ut=Ne.nodeName==="IMG"||Pe,je=ft(ge.fromDom(Ne),"mce-pagebreak");return ut&&re(Ne)&&!je},W=J(Ct);W.length>0&&Ct.ui.registry.addContextToolbar("imageselection",{predicate:ce,items:W,position:"node"});const ve=mt(Ct);ve.length>0&&Ct.ui.registry.addContextToolbar("textselection",{predicate:Ne=>!ce(Ne)&&!Ct.selection.isCollapsed()&&K(Ne),items:ve,position:"selection",scope:"editor"})};var jt=()=>{o.add("quickbars",Ct=>{Ae(Ct),A(Ct),Ge(Ct),te(Ct),St(Ct)})};jt()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const c=(le=>ae=>typeof ae===le)("function");var d=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),g=tinymce.util.Tools.resolve("tinymce.util.Tools");const p=le=>ae=>ae.options.get(le),y=le=>{const ae=le.options.register;ae("save_enablewhendirty",{processor:"boolean",default:!0}),ae("save_onsavecallback",{processor:"function"}),ae("save_oncancelcallback",{processor:"function"})},x=p("save_enablewhendirty"),T=p("save_onsavecallback"),A=p("save_oncancelcallback"),M=(le,ae)=>{le.notificationManager.open({text:ae,type:"error"})},P=le=>{const ae=d.DOM.getParent(le.id,"form");if(x(le)&&!le.isDirty())return;le.save();const Z=T(le);if(c(Z)){Z.call(le,le),le.nodeChanged();return}ae?(le.setDirty(!1),(!ae.onsubmit||ae.onsubmit())&&(typeof ae.submit=="function"?ae.submit():M(le,"Error: Form submit field collision.")),le.nodeChanged()):M(le,"Error: No form element found.")},z=le=>{const ae=g.trim(le.startContent),Z=A(le);if(c(Z)){Z.call(le,le);return}le.resetContent(ae)},U=le=>{le.addCommand("mceSave",()=>{P(le)}),le.addCommand("mceCancel",()=>{z(le)})},q=le=>ae=>{const Z=()=>{ae.setEnabled(!x(le)||le.isDirty())};return Z(),le.on("NodeChange dirty",Z),()=>le.off("NodeChange dirty",Z)},Q=le=>{le.ui.registry.addButton("save",{icon:"save",tooltip:"Save",enabled:!1,onAction:()=>le.execCommand("mceSave"),onSetup:q(le),shortcut:"Meta+S"}),le.ui.registry.addButton("cancel",{icon:"cancel",tooltip:"Cancel",enabled:!1,onAction:()=>le.execCommand("mceCancel"),onSetup:q(le)}),le.addShortcut("Meta+S","","mceSave")};var ee=()=>{o.add("save",le=>{y(le),Q(le),U(le)})};ee()})();(function(){const o=Qe=>{let st=Qe;return{get:()=>st,set:Hn=>{st=Hn}}};var a=tinymce.util.Tools.resolve("tinymce.PluginManager");const c=(Qe,st,ln)=>{var yn;return ln(Qe,st.prototype)?!0:((yn=Qe.constructor)===null||yn===void 0?void 0:yn.name)===st.name},d=Qe=>{const st=typeof Qe;return Qe===null?"null":st==="object"&&Array.isArray(Qe)?"array":st==="object"&&c(Qe,String,(ln,yn)=>yn.isPrototypeOf(ln))?"string":st},g=Qe=>st=>d(st)===Qe,p=Qe=>st=>typeof st===Qe,y=g("string"),x=g("array"),T=p("boolean"),A=Qe=>Qe==null,M=Qe=>!A(Qe),P=p("number"),z=()=>{},U=Qe=>()=>Qe,q=U(!0),ee=U("[~№|!-*+-\\/:;?@\\[-`{}¡«·»¿;·՚-՟։֊־׀׃׆׳״؉؊،؍؛؞؟٪-٭۔܀-܍߷-߹࠰-࠾࡞।॥॰෴๏๚๛༄-༒༺-༽྅࿐-࿔࿙࿚၊-၏჻፡-፨᐀᙭᙮᚛᚜᛫-᛭᜵᜶។-៖៘-៚᠀-᠊᥄᥅᨞᨟᪠-᪦᪨-᪭᭚-᭠᯼-᯿᰻-᰿᱾᱿᳓‐-‧‰-⁃⁅-⁑⁓-⁞⁽⁾₍₎〈〉❨-❵⟅⟆⟦-⟯⦃-⦘⧘-⧛⧼⧽⳹-⳼⳾⳿⵰⸀-⸮⸰⸱、-〃〈-】〔-〟〰〽゠・꓾꓿꘍-꘏꙳꙾꛲-꛷꡴-꡷꣎꣏꣸-꣺꤮꤯꥟꧁-꧍꧞꧟꩜-꩟꫞꫟꯫﴾﴿︐-︙︰-﹒﹔-﹡﹣﹨﹪﹫!-#%-*,-/:;?@[-]_{}⦅-・]");class le{constructor(st,ln){this.tag=st,this.value=ln}static some(st){return new le(!0,st)}static none(){return le.singletonNone}fold(st,ln){return this.tag?ln(this.value):st()}isSome(){return this.tag}isNone(){return!this.tag}map(st){return this.tag?le.some(st(this.value)):le.none()}bind(st){return this.tag?st(this.value):le.none()}exists(st){return this.tag&&st(this.value)}forall(st){return!this.tag||st(this.value)}filter(st){return!this.tag||st(this.value)?this:le.none()}getOr(st){return this.tag?this.value:st}or(st){return this.tag?this:st}getOrThunk(st){return this.tag?this.value:st()}orThunk(st){return this.tag?this:st()}getOrDie(st){if(this.tag)return this.value;throw new Error(st??"Called getOrDie on None")}static from(st){return M(st)?le.some(st):le.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(st){this.tag&&st(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}le.singletonNone=new le(!1);const ae=ee;var Z=tinymce.util.Tools.resolve("tinymce.Env"),Ae=tinymce.util.Tools.resolve("tinymce.util.Tools");const mt=Array.prototype.slice,Le=Array.prototype.push,J=(Qe,st)=>{const ln=Qe.length,yn=new Array(ln);for(let Hn=0;Hn<ln;Hn++){const co=Qe[Hn];yn[Hn]=st(co,Hn)}return yn},Ge=(Qe,st)=>{for(let ln=0,yn=Qe.length;ln<yn;ln++){const Hn=Qe[ln];st(Hn,ln)}},vt=(Qe,st)=>{for(let ln=Qe.length-1;ln>=0;ln--){const yn=Qe[ln];st(yn,ln)}},yt=(Qe,st)=>{if(Qe.length===0)return[];{let ln=st(Qe[0]);const yn=[];let Hn=[];for(let co=0,uo=Qe.length;co<uo;co++){const no=Qe[co],wo=st(no);wo!==ln&&(yn.push(Hn),Hn=[]),ln=wo,Hn.push(no)}return Hn.length!==0&&yn.push(Hn),yn}},De=(Qe,st,ln)=>(Ge(Qe,(yn,Hn)=>{ln=st(ln,yn,Hn)}),ln),ue=Qe=>{const st=[];for(let ln=0,yn=Qe.length;ln<yn;++ln){if(!x(Qe[ln]))throw new Error("Arr.flatten item "+ln+" was not an array, input: "+Qe);Le.apply(st,Qe[ln])}return st},Vt=(Qe,st)=>ue(J(Qe,st)),we=(Qe,st)=>{const ln=mt.call(Qe,0);return ln.sort(st),ln},Ie=Object.hasOwnProperty,D=(Qe,st)=>Ie.call(Qe,st);typeof window<"u"||Function("return this;")();const Ue=9,be=11,tt=1,nt=3,ge=Qe=>Qe.dom.nodeType,kt=(Qe=>st=>ge(st)===Qe)(nt),He=(Qe,st,ln)=>{if(y(ln)||T(ln)||P(ln))Qe.setAttribute(st,ln+"");else throw console.error("Invalid call to Attribute.set. Key ",st,":: Value ",ln,":: Element ",Qe),new Error("Attribute value was not simple")},ht=(Qe,st,ln)=>{He(Qe.dom,st,ln)},Me=(Qe,st)=>{const yn=(st||document).createElement("div");if(yn.innerHTML=Qe,!yn.hasChildNodes()||yn.childNodes.length>1){const Hn="HTML does not have a single root node";throw console.error(Hn,Qe),new Error(Hn)}return gn(yn.childNodes[0])},lt=(Qe,st)=>{const yn=(st||document).createElement(Qe);return gn(yn)},te=(Qe,st)=>{const yn=(st||document).createTextNode(Qe);return gn(yn)},gn=Qe=>{if(Qe==null)throw new Error("Node cannot be null or undefined");return{dom:Qe}},St={fromHtml:Me,fromTag:lt,fromText:te,fromDom:gn,fromPoint:(Qe,st,ln)=>le.from(Qe.dom.elementFromPoint(st,ln)).map(gn)},jt=Qe=>Qe.nodeType!==tt&&Qe.nodeType!==Ue&&Qe.nodeType!==be||Qe.childElementCount===0,Ct=(Qe,st)=>{const ln=st===void 0?document:st.dom;return jt(ln)?[]:J(ln.querySelectorAll(Qe),St.fromDom)},K=Qe=>le.from(Qe.dom.parentNode).map(St.fromDom),re=Qe=>J(Qe.dom.childNodes,St.fromDom),ce=(Qe,st)=>({element:Qe,offset:st}),W=(Qe,st)=>{const ln=re(Qe);return ln.length>0&&st<ln.length?ce(ln[st],0):ce(Qe,st)},ve=(Qe,st)=>{K(Qe).each(yn=>{yn.dom.insertBefore(st.dom,Qe.dom)})},Ne=(Qe,st)=>{Qe.dom.appendChild(st.dom)},Pe=(Qe,st)=>{ve(Qe,st),Ne(st,Qe)},je=((Qe,st)=>{const ln=co=>{if(!Qe(co))throw new Error("Can only get "+st+" value of a "+st+" node");return yn(co).getOr("")},yn=co=>Qe(co)?le.from(co.dom.nodeValue):le.none();return{get:ln,getOption:yn,set:(co,uo)=>{if(!Qe(co))throw new Error("Can only set raw "+st+" value of a "+st+" node");co.dom.nodeValue=uo}}})(kt,"text"),pt=Qe=>je.get(Qe),$t=(Qe,st,ln)=>(Qe.compareDocumentPosition(st)&ln)!==0,hn=(Qe,st)=>$t(Qe,st,Node.DOCUMENT_POSITION_PRECEDING),Et=(Qe,st)=>Ct(st,Qe);var It=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker");const dn=(Qe,st)=>Qe.isBlock(st)||D(Qe.schema.getVoidElements(),st.nodeName),_n=(Qe,st)=>!Qe.isEditable(st),So=(Qe,st)=>Qe.getContentEditable(st)==="true"&&st.parentNode&&!Qe.isEditable(st.parentNode),Jn=(Qe,st)=>!Qe.isBlock(st)&&D(Qe.schema.getWhitespaceElements(),st.nodeName),Ot=(Qe,st)=>dn(Qe,st)||_n(Qe,st)||Jn(Qe,st)||So(Qe,st),rn=Qe=>Qe.nodeType===3,an=()=>({sOffset:0,fOffset:0,elements:[]}),On=(Qe,st)=>W(St.fromDom(Qe),st),_o=(Qe,st,ln,yn,Hn,co=!0)=>{let uo=co?st(!1):ln;for(;uo;){const no=_n(Qe,uo);if(no||Jn(Qe,uo)){if(no?yn.cef(uo):yn.boundary(uo))break;uo=st(!0);continue}else if(dn(Qe,uo)){if(yn.boundary(uo))break}else rn(uo)&&yn.text(uo);if(uo===Hn)break;uo=st(!1)}},Mo=(Qe,st,ln,yn,Hn)=>{var co;if(Ot(Qe,ln))return;const uo=(co=Qe.getParent(yn,Qe.isBlock))!==null&&co!==void 0?co:Qe.getRoot(),no=new It(ln,uo),wo=Hn?no.next.bind(no):no.prev.bind(no);_o(Qe,wo,ln,{boundary:q,cef:q,text:Io=>{Hn?st.fOffset+=Io.length:st.sOffset+=Io.length,st.elements.push(St.fromDom(Io))}})},ws=(Qe,st,ln,yn,Hn,co=!0)=>{const uo=new It(ln,st),no=[];let wo=an();Mo(Qe,wo,ln,st,!1);const Io=()=>(wo.elements.length>0&&(no.push(wo),wo=an()),!1);return _o(Qe,uo.next.bind(uo),ln,{boundary:Io,cef:cs=>(Io(),Hn&&no.push(...Hn.cef(cs)),!1),text:cs=>{wo.elements.push(St.fromDom(cs)),Hn&&Hn.text(cs,wo)}},yn,co),yn&&Mo(Qe,wo,yn,st,!0),Io(),no},vo=(Qe,st)=>{const ln=On(st.startContainer,st.startOffset),yn=ln.element.dom,Hn=On(st.endContainer,st.endOffset),co=Hn.element.dom;return ws(Qe,st.commonAncestorContainer,yn,co,{text:(uo,no)=>{uo===co?no.fOffset+=uo.length-Hn.offset:uo===yn&&(no.sOffset+=ln.offset)},cef:uo=>{const no=Vt(Et(St.fromDom(uo),"*[contenteditable=true]"),wo=>{const Io=wo.dom;return ws(Qe,Io,Io)});return we(no,(wo,Io)=>hn(wo.elements[0].dom,Io.elements[0].dom)?1:-1)}},!1)},Us=(Qe,st)=>st.collapsed?[]:vo(Qe,st),fn=(Qe,st)=>{const ln=Qe.createRng();return ln.selectNode(st),Us(Qe,ln)},Vo=(Qe,st)=>Vt(st,ln=>fn(Qe,ln)),tr=(Qe,st,ln=0,yn=Qe.length)=>{const Hn=st.regex;Hn.lastIndex=ln;const co=[];let uo;for(;uo=Hn.exec(Qe);){const no=uo[st.matchIndex],wo=uo.index+uo[0].indexOf(no),Io=wo+no.length;if(Io>yn)break;co.push({start:wo,finish:Io}),Hn.lastIndex=Io}return co},rr=(Qe,st)=>{const ln=De(Qe,(yn,Hn)=>{const co=pt(Hn),uo=yn.last,no=uo+co.length,wo=Vt(st,(Io,cs)=>Io.start<no&&Io.finish>uo?[{element:Hn,start:Math.max(uo,Io.start)-uo,finish:Math.min(no,Io.finish)-uo,matchId:cs}]:[]);return{results:yn.results.concat(wo),last:no}},{results:[],last:0}).results;return yt(ln,yn=>yn.matchId)},Pr=(Qe,st)=>Vt(st,ln=>{const yn=ln.elements,Hn=J(yn,pt).join(""),co=tr(Hn,Qe,ln.sOffset,Hn.length-ln.fOffset);return rr(yn,co)}),Br=(Qe,st)=>{vt(Qe,(ln,yn)=>{vt(ln,Hn=>{const co=St.fromDom(st.cloneNode(!1));ht(co,"data-mce-index",yn);const uo=Hn.element.dom;if(uo.length===Hn.finish&&Hn.start===0)Pe(Hn.element,co);else{uo.length!==Hn.finish&&uo.splitText(Hn.finish);const no=uo.splitText(Hn.start);Pe(St.fromDom(no),co)}})})},Ts=(Qe,st,ln,yn)=>{const Hn=fn(Qe,ln),co=Pr(st,Hn);return Br(co,yn),co.length},Ar=(Qe,st,ln,yn)=>{const Hn=ln.getBookmark(),co=Qe.select("td[data-mce-selected],th[data-mce-selected]"),uo=co.length>0?Vo(Qe,co):Us(Qe,ln.getRng()),no=Pr(st,uo);return Br(no,yn),ln.moveToBookmark(Hn),no.length},Xr=Qe=>Qe.getAttribute("data-mce-index"),xs=(Qe,st,ln,yn)=>{const Hn=Qe.dom.create("span",{"data-mce-bogus":1});Hn.className="mce-match-marker";const co=Qe.getBody();return ar(Qe,st,!1),yn?Ar(Qe.dom,ln,Qe.selection,Hn):Ts(Qe.dom,ln,co,Hn)},lo=Qe=>{var st;const ln=Qe.parentNode;Qe.firstChild&&ln.insertBefore(Qe.firstChild,Qe),(st=Qe.parentNode)===null||st===void 0||st.removeChild(Qe)},Bs=(Qe,st)=>{const ln=[],yn=Ae.toArray(Qe.getBody().getElementsByTagName("span"));if(yn.length)for(let Hn=0;Hn<yn.length;Hn++){const co=Xr(yn[Hn]);co===null||!co.length||co===st.toString()&&ln.push(yn[Hn])}return ln},_t=(Qe,st,ln)=>{const yn=st.get();let Hn=yn.index;const co=Qe.dom;ln?Hn+1===yn.count?Hn=0:Hn++:Hn-1===-1?Hn=yn.count-1:Hn--,co.removeClass(Bs(Qe,yn.index),"mce-match-marker-selected");const uo=Bs(Qe,Hn);return uo.length?(co.addClass(Bs(Qe,Hn),"mce-match-marker-selected"),Qe.selection.scrollIntoView(uo[0]),Hn):-1},Ht=(Qe,st)=>{const ln=st.parentNode;Qe.remove(st),ln&&Qe.isEmpty(ln)&&Qe.remove(ln)},Bn=(Qe,st)=>{const yn="("+Qe.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&").replace(/\s/g,"[^\\S\\r\\n\\uFEFF]")+")";return st?`(?:^|\\s|${ae()})`+yn+`(?=$|\\s|${ae()})`:yn},ro=(Qe,st,ln,yn,Hn,co)=>{const uo=Qe.selection,no=Bn(ln,Hn),wo=uo.isForward(),Io={regex:new RegExp(no,yn?"g":"gi"),matchIndex:1},cs=xs(Qe,st,Io,co);if(Z.browser.isSafari()&&uo.setRng(uo.getRng(),wo),cs){const Js=_t(Qe,st,!0);st.set({index:Js,count:cs,text:ln,matchCase:yn,wholeWord:Hn,inSelection:co})}return cs},Ro=(Qe,st)=>{const ln=_t(Qe,st,!0);st.set({...st.get(),index:ln})},is=(Qe,st)=>{const ln=_t(Qe,st,!1);st.set({...st.get(),index:ln})},yr=Qe=>{const st=Xr(Qe);return st!==null&&st.length>0},wr=(Qe,st,ln,yn,Hn)=>{const co=st.get(),uo=co.index;let no,wo=uo;yn=yn!==!1;const Io=Qe.getBody(),cs=Ae.grep(Ae.toArray(Io.getElementsByTagName("span")),yr);for(let Js=0;Js<cs.length;Js++){const Es=Xr(cs[Js]);let Ya=no=parseInt(Es,10);if(Hn||Ya===co.index){for(ln.length?(cs[Js].innerText=ln,lo(cs[Js])):Ht(Qe.dom,cs[Js]);cs[++Js];)if(Ya=parseInt(Xr(cs[Js]),10),Ya===no)Ht(Qe.dom,cs[Js]);else{Js--;break}yn&&wo--}else no>uo&&cs[Js].setAttribute("data-mce-index",String(no-1))}return st.set({...co,count:Hn?0:co.count-1,index:wo}),yn?Ro(Qe,st):is(Qe,st),!Hn&&st.get().count>0},ar=(Qe,st,ln)=>{let yn,Hn;const co=st.get(),uo=Ae.toArray(Qe.getBody().getElementsByTagName("span"));for(let no=0;no<uo.length;no++){const wo=Xr(uo[no]);wo!==null&&wo.length&&(wo===co.index.toString()&&(yn||(yn=uo[no].firstChild),Hn=uo[no].firstChild),lo(uo[no]))}if(st.set({...co,index:-1,count:0,text:""}),yn&&Hn){const no=Qe.dom.createRng();return no.setStart(yn,0),no.setEnd(Hn,Hn.data.length),ln!==!1&&Qe.selection.setRng(no),no}else return},Xe=(Qe,st)=>st.get().count>1,qe=(Qe,st)=>st.get().count>1,Bt=(Qe,st)=>({done:no=>ar(Qe,st,no),find:(no,wo,Io,cs=!1)=>ro(Qe,st,no,wo,Io,cs),next:()=>Ro(Qe,st),prev:()=>is(Qe,st),replace:(no,wo,Io)=>wr(Qe,st,no,wo,Io)}),Yt=Qe=>{const st=o(le.none()),ln=()=>st.get().each(Qe);return{clear:()=>{ln(),st.set(le.none())},isSet:()=>st.get().isSome(),get:()=>st.get(),set:no=>{ln(),st.set(le.some(no))}}},fo=()=>{const Qe=Yt(z);return{...Qe,on:ln=>Qe.get().each(ln)}},No=(Qe,st)=>{const ln=fo();Qe.undoManager.add();const yn=Ae.trim(Qe.selection.getContent({format:"text"})),Hn=Ho=>{Ho.setEnabled("next",Xe(Qe,st)),Ho.setEnabled("prev",qe(Qe,st))},co=Ho=>{const Jo=Ho.getData(),ts=st.get();st.set({...ts,matchCase:Jo.matchcase,wholeWord:Jo.wholewords,inSelection:Jo.inselection})},uo=(Ho,Jo)=>{Ge(["replace","replaceall","prev","next"],na=>Ho.setEnabled(na,!Jo))},no=(Ho,Jo)=>{Jo.redial(ta(Ho,Jo.getData()))},wo=(Ho,Jo)=>{Z.browser.isSafari()&&Z.deviceType.isTouch()&&(Jo==="find"||Jo==="replace"||Jo==="replaceall")&&Ho.focus(Jo)},Io=Ho=>{ar(Qe,st,!1),uo(Ho,!0),Hn(Ho)},cs=Ho=>{const Jo=Ho.getData(),ts=st.get();if(!Jo.findtext.length){Io(Ho);return}if(ts.text===Jo.findtext&&ts.matchCase===Jo.matchcase&&ts.wholeWord===Jo.wholewords)Ro(Qe,st);else{const ca=ro(Qe,st,Jo.findtext,Jo.matchcase,Jo.wholewords,Jo.inselection);ca<=0&&no(!0,Ho),uo(Ho,ca===0)}Hn(Ho)},Js=st.get(),Es={findtext:yn,replacetext:"",wholewords:Js.wholeWord,matchcase:Js.matchCase,inselection:Js.inSelection},Ya=Ho=>{const Jo=[{type:"label",label:"Find",for:"findtext",items:[{type:"bar",items:[{type:"input",name:"findtext",maximized:!0,inputMode:"search"},{type:"button",name:"prev",text:"Previous",icon:"action-prev",enabled:!1,borderless:!0},{type:"button",name:"next",text:"Next",icon:"action-next",enabled:!1,borderless:!0}]}]},{type:"input",name:"replacetext",label:"Replace with",inputMode:"search"}];return Ho&&Jo.push({type:"alertbanner",level:"error",text:"Could not find the specified string.",icon:"warning"}),Jo},ta=(Ho,Jo)=>({title:"Find and Replace",size:"normal",body:{type:"panel",items:Ya(Ho)},buttons:[{type:"menu",name:"options",icon:"preferences",tooltip:"Preferences",align:"start",items:[{type:"togglemenuitem",name:"matchcase",text:"Match case"},{type:"togglemenuitem",name:"wholewords",text:"Find whole words only"},{type:"togglemenuitem",name:"inselection",text:"Find in selection"}]},{type:"custom",name:"find",text:"Find",primary:!0},{type:"custom",name:"replace",text:"Replace",enabled:!1},{type:"custom",name:"replaceall",text:"Replace all",enabled:!1}],initialData:Jo,onChange:(ts,ca)=>{Ho&&no(!1,ts),ca.name==="findtext"&&st.get().count>0&&Io(ts)},onAction:(ts,ca)=>{const na=ts.getData();switch(ca.name){case"find":cs(ts);break;case"replace":wr(Qe,st,na.replacetext)?Hn(ts):Io(ts);break;case"replaceall":wr(Qe,st,na.replacetext,!0,!0),Io(ts);break;case"prev":is(Qe,st),Hn(ts);break;case"next":Ro(Qe,st),Hn(ts);break;case"matchcase":case"wholewords":case"inselection":no(!1,ts),co(ts),Io(ts);break}wo(ts,ca.name)},onSubmit:ts=>{cs(ts),wo(ts,"find")},onClose:()=>{Qe.focus(),ar(Qe,st),Qe.undoManager.add()}});ln.set(Qe.windowManager.open(ta(!1,Es),{inline:"toolbar"}))},Wo=(Qe,st)=>{Qe.addCommand("SearchReplace",()=>{No(Qe,st)})},js=(Qe,st)=>()=>{No(Qe,st)},cn=(Qe,st)=>{Qe.ui.registry.addMenuItem("searchreplace",{text:"Find and replace...",shortcut:"Meta+F",onAction:js(Qe,st),icon:"search"}),Qe.ui.registry.addButton("searchreplace",{tooltip:"Find and replace",onAction:js(Qe,st),icon:"search",shortcut:"Meta+F"}),Qe.shortcuts.add("Meta+F","",js(Qe,st))};var Wt=()=>{a.add("searchreplace",Qe=>{const st=o({index:-1,count:0,text:"",matchCase:!1,wholeWord:!1,inSelection:!1});return Wo(Qe,st),cn(Qe,st),Bt(Qe,st)})};Wt()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const a=(R,H,me)=>{var Oe;return me(R,H.prototype)?!0:((Oe=R.constructor)===null||Oe===void 0?void 0:Oe.name)===H.name},c=R=>{const H=typeof R;return R===null?"null":H==="object"&&Array.isArray(R)?"array":H==="object"&&a(R,String,(me,Oe)=>Oe.isPrototypeOf(me))?"string":H},d=R=>H=>c(H)===R,g=R=>H=>typeof H===R,p=R=>H=>R===H,y=d("string"),x=d("array"),T=g("boolean"),A=p(void 0),M=R=>R==null,P=R=>!M(R),z=g("function"),U=g("number"),q=()=>{},Q=(R,H)=>me=>R(H(me)),ee=R=>()=>R,le=R=>R,ae=(R,H)=>R===H;function Z(R,...H){return(...me)=>{const Oe=H.concat(me);return R.apply(null,Oe)}}const Ae=R=>{R()},mt=ee(!1),Le=ee(!0);class J{constructor(H,me){this.tag=H,this.value=me}static some(H){return new J(!0,H)}static none(){return J.singletonNone}fold(H,me){return this.tag?me(this.value):H()}isSome(){return this.tag}isNone(){return!this.tag}map(H){return this.tag?J.some(H(this.value)):J.none()}bind(H){return this.tag?H(this.value):J.none()}exists(H){return this.tag&&H(this.value)}forall(H){return!this.tag||H(this.value)}filter(H){return!this.tag||H(this.value)?this:J.none()}getOr(H){return this.tag?this.value:H}or(H){return this.tag?this:H}getOrThunk(H){return this.tag?this.value:H()}orThunk(H){return this.tag?this:H()}getOrDie(H){if(this.tag)return this.value;throw new Error(H??"Called getOrDie on None")}static from(H){return P(H)?J.some(H):J.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(H){this.tag&&H(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}J.singletonNone=new J(!1);const Ge=Object.keys,vt=Object.hasOwnProperty,yt=(R,H)=>{const me=Ge(R);for(let Oe=0,ct=me.length;Oe<ct;Oe++){const on=me[Oe],Nn=R[on];H(Nn,on)}},De=R=>(H,me)=>{R[me]=H},ue=(R,H,me,Oe)=>{yt(R,(ct,on)=>{(H(ct,on)?me:Oe)(ct,on)})},Vt=(R,H)=>{const me={};return ue(R,H,De(me),q),me},we=(R,H)=>{const me=[];return yt(R,(Oe,ct)=>{me.push(H(Oe,ct))}),me},Ie=R=>we(R,le),D=R=>Ge(R).length,Ue=(R,H)=>be(R,H)?J.from(R[H]):J.none(),be=(R,H)=>vt.call(R,H),tt=(R,H)=>be(R,H)&&R[H]!==void 0&&R[H]!==null,nt=R=>{for(const H in R)if(vt.call(R,H))return!1;return!0},ge=Array.prototype.indexOf,We=Array.prototype.push,kt=(R,H)=>ge.call(R,H),He=(R,H)=>kt(R,H)>-1,ht=(R,H)=>{for(let me=0,Oe=R.length;me<Oe;me++){const ct=R[me];if(H(ct,me))return!0}return!1},Me=(R,H)=>{const me=[];for(let Oe=0;Oe<R;Oe++)me.push(H(Oe));return me},lt=(R,H)=>{const me=R.length,Oe=new Array(me);for(let ct=0;ct<me;ct++){const on=R[ct];Oe[ct]=H(on,ct)}return Oe},te=(R,H)=>{for(let me=0,Oe=R.length;me<Oe;me++){const ct=R[me];H(ct,me)}},gn=(R,H)=>{for(let me=R.length-1;me>=0;me--){const Oe=R[me];H(Oe,me)}},ft=(R,H)=>{const me=[],Oe=[];for(let ct=0,on=R.length;ct<on;ct++){const Nn=R[ct];(H(Nn,ct)?me:Oe).push(Nn)}return{pass:me,fail:Oe}},St=(R,H)=>{const me=[];for(let Oe=0,ct=R.length;Oe<ct;Oe++){const on=R[Oe];H(on,Oe)&&me.push(on)}return me},jt=(R,H,me)=>(gn(R,(Oe,ct)=>{me=H(me,Oe,ct)}),me),Ct=(R,H,me)=>(te(R,(Oe,ct)=>{me=H(me,Oe,ct)}),me),K=(R,H,me)=>{for(let Oe=0,ct=R.length;Oe<ct;Oe++){const on=R[Oe];if(H(on,Oe))return J.some(on);if(me(on,Oe))break}return J.none()},re=(R,H)=>K(R,H,mt),ce=R=>{const H=[];for(let me=0,Oe=R.length;me<Oe;++me){if(!x(R[me]))throw new Error("Arr.flatten item "+me+" was not an array, input: "+R);We.apply(H,R[me])}return H},W=(R,H)=>ce(lt(R,H)),ve=(R,H)=>{for(let me=0,Oe=R.length;me<Oe;++me){const ct=R[me];if(H(ct,me)!==!0)return!1}return!0},Ne=(R,H)=>{const me={};for(let Oe=0,ct=R.length;Oe<ct;Oe++){const on=R[Oe];me[String(on)]=H(on,Oe)}return me},Pe=(R,H)=>H>=0&&H<R.length?J.some(R[H]):J.none(),ut=R=>Pe(R,0),je=R=>Pe(R,R.length-1),pt=(R,H)=>{for(let me=0;me<R.length;me++){const Oe=H(R[me],me);if(Oe.isSome())return Oe}return J.none()},$t=8,hn=9,Et=11,It=1,dn=3,_n=(R,H)=>{const Oe=(H||document).createElement("div");if(Oe.innerHTML=R,!Oe.hasChildNodes()||Oe.childNodes.length>1){const ct="HTML does not have a single root node";throw console.error(ct,R),new Error(ct)}return Ot(Oe.childNodes[0])},So=(R,H)=>{const Oe=(H||document).createElement(R);return Ot(Oe)},Jn=(R,H)=>{const Oe=(H||document).createTextNode(R);return Ot(Oe)},Ot=R=>{if(R==null)throw new Error("Node cannot be null or undefined");return{dom:R}},an={fromHtml:_n,fromTag:So,fromText:Jn,fromDom:Ot,fromPoint:(R,H,me)=>J.from(R.dom.elementFromPoint(H,me)).map(Ot)},On=(R,H)=>{const me=R.dom;if(me.nodeType!==It)return!1;{const Oe=me;if(Oe.matches!==void 0)return Oe.matches(H);if(Oe.msMatchesSelector!==void 0)return Oe.msMatchesSelector(H);if(Oe.webkitMatchesSelector!==void 0)return Oe.webkitMatchesSelector(H);if(Oe.mozMatchesSelector!==void 0)return Oe.mozMatchesSelector(H);throw new Error("Browser lacks native selectors")}},_o=R=>R.nodeType!==It&&R.nodeType!==hn&&R.nodeType!==Et||R.childElementCount===0,Mo=(R,H)=>{const me=H===void 0?document:H.dom;return _o(me)?[]:lt(me.querySelectorAll(R),an.fromDom)},ws=(R,H)=>{const me=H===void 0?document:H.dom;return _o(me)?J.none():J.from(me.querySelector(R)).map(an.fromDom)},vo=(R,H)=>R.dom===H.dom,Us=On;typeof window<"u"||Function("return this;")();const fn=R=>R.dom.nodeName.toLowerCase(),Vo=R=>R.dom.nodeType,tr=R=>H=>Vo(H)===R,rr=R=>Vo(R)===$t||fn(R)==="#comment",Pr=tr(It),Br=tr(dn),Ts=tr(hn),Ar=tr(Et),Xr=R=>H=>Pr(H)&&fn(H)===R,xs=R=>an.fromDom(R.dom.ownerDocument),lo=R=>Ts(R)?R:xs(R),Bs=R=>J.from(R.dom.parentNode).map(an.fromDom),_t=(R,H)=>{const me=z(H)?H:mt;let Oe=R.dom;const ct=[];for(;Oe.parentNode!==null&&Oe.parentNode!==void 0;){const on=Oe.parentNode,Nn=an.fromDom(on);if(ct.push(Nn),me(Nn)===!0)break;Oe=on}return ct},Ht=R=>J.from(R.dom.previousSibling).map(an.fromDom),Bn=R=>J.from(R.dom.nextSibling).map(an.fromDom),ro=R=>lt(R.dom.childNodes,an.fromDom),Ro=(R,H)=>{const me=R.dom.childNodes;return J.from(me[H]).map(an.fromDom)},is=R=>Ro(R,0),yr=R=>Ar(R)&&P(R.dom.host),wr=R=>an.fromDom(R.dom.getRootNode()),ar=R=>{const H=wr(R);return yr(H)?J.some(H):J.none()},Xe=R=>an.fromDom(R.dom.host),qe=R=>{const H=Br(R)?R.dom.parentNode:R.dom;if(H==null||H.ownerDocument===null)return!1;const me=H.ownerDocument;return ar(an.fromDom(H)).fold(()=>me.body.contains(H),Q(qe,Xe))};var Bt=(R,H,me,Oe,ct)=>R(me,Oe)?J.some(me):z(ct)&&ct(me)?J.none():H(me,Oe,ct);const Yt=(R,H,me)=>{let Oe=R.dom;const ct=z(me)?me:mt;for(;Oe.parentNode;){Oe=Oe.parentNode;const on=an.fromDom(Oe);if(H(on))return J.some(on);if(ct(on))break}return J.none()},fo=(R,H,me)=>Bt((ct,on)=>on(ct),Yt,R,H,me),No=(R,H)=>{const me=ct=>H(an.fromDom(ct));return re(R.dom.childNodes,me).map(an.fromDom)},Wo=(R,H,me)=>Yt(R,Oe=>On(Oe,H),me),js=(R,H)=>No(R,me=>On(me,H)),cn=(R,H)=>ws(H,R),Wt=(R,H,me)=>Bt((ct,on)=>On(ct,on),Wo,R,H,me),Qe=R=>Wt(R,"[contenteditable]"),st=(R,H=!1)=>qe(R)?R.dom.isContentEditable:Qe(R).fold(ee(H),me=>ln(me)==="true"),ln=R=>R.dom.contentEditable,yn=R=>R.nodeName.toLowerCase(),Hn=R=>an.fromDom(R.getBody()),co=R=>H=>vo(H,Hn(R)),uo=R=>R?R.replace(/px$/,""):"",no=R=>/^\d+(\.\d+)?$/.test(R)?R+"px":R,wo=R=>an.fromDom(R.selection.getStart()),Io=R=>an.fromDom(R.selection.getEnd()),cs=R=>fo(R,Xr("table")).forall(st),Js=(R,H)=>St(ro(R),H),Es=(R,H)=>{let me=[];return te(ro(R),Oe=>{H(Oe)&&(me=me.concat([Oe])),me=me.concat(Es(Oe,H))}),me},Ya=(R,H)=>Js(R,me=>On(me,H)),ta=(R,H)=>Mo(H,R),Ho=(R,H,me)=>{if(y(me)||T(me)||U(me))R.setAttribute(H,me+"");else throw console.error("Invalid call to Attribute.set. Key ",H,":: Value ",me,":: Element ",R),new Error("Attribute value was not simple")},Jo=(R,H,me)=>{Ho(R.dom,H,me)},ts=(R,H)=>{const me=R.dom;yt(H,(Oe,ct)=>{Ho(me,ct,Oe)})},ca=(R,H)=>{const me=R.dom.getAttribute(H);return me===null?void 0:me},na=(R,H)=>J.from(ca(R,H)),la=(R,H)=>{R.dom.removeAttribute(H)},Ys=R=>Ct(R.dom.attributes,(H,me)=>(H[me.name]=me.value,H),{}),jl=(R,H,me=ae)=>R.exists(Oe=>me(Oe,H)),ui=R=>{const H=[],me=Oe=>{H.push(Oe)};for(let Oe=0;Oe<R.length;Oe++)R[Oe].each(me);return H},tl=(R,H,me)=>R.isSome()&&H.isSome()?J.some(me(R.getOrDie(),H.getOrDie())):J.none(),ls=R=>R.bind(le),Oi=(R,H)=>R?J.some(H):J.none(),ir=(R,H)=>R.substring(H),Rc=(R,H,me)=>H===""||R.length>=H.length&&R.substr(me,me+H.length)===H,oi=(R,H)=>qi(R,H)?ir(R,H.length):R,qi=(R,H)=>Rc(R,H,0),Ic=(R=>H=>H.replace(R,""))(/^\s+|\s+$/g),di=R=>R.length>0,Pc=R=>!di(R),wc=(R,H=10)=>{const me=parseInt(R,H);return isNaN(me)?J.none():J.some(me)},Bc=R=>{const H=parseFloat(R);return isNaN(H)?J.none():J.some(H)},Or=R=>R.style!==void 0&&z(R.style.getPropertyValue),Ni=(R,H,me)=>{if(!y(me))throw console.error("Invalid call to CSS.set. Property ",H,":: Value ",me,":: Element ",R),new Error("CSS value must be a string: "+me);Or(R)&&R.style.setProperty(H,me)},Cc=(R,H)=>{Or(R)&&R.style.removeProperty(H)},Sc=(R,H,me)=>{const Oe=R.dom;Ni(Oe,H,me)},wl=(R,H)=>{const me=R.dom,ct=window.getComputedStyle(me).getPropertyValue(H);return ct===""&&!qe(R)?fi(me,H):ct},fi=(R,H)=>Or(R)?R.style.getPropertyValue(H):"",Fr=(R,H)=>{const me=R.dom,Oe=fi(me,H);return J.from(Oe).filter(ct=>ct.length>0)},Wr=(R,H)=>{const me=R.dom;Cc(me,H),jl(na(R,"style").map(Ic),"")&&la(R,"style")},Ka=(R,H,me=0)=>na(R,H).map(Oe=>parseInt(Oe,10)).getOr(me),nl=(R,H)=>ol(R,H,Le),ol=(R,H,me)=>W(ro(R),Oe=>On(Oe,H)?me(Oe)?[Oe]:[]:ol(Oe,H,me)),ka=["tfoot","thead","tbody","colgroup"],Se=R=>He(ka,R),Ze=(R,H)=>({rows:R,columns:H}),dt=(R,H,me)=>({element:R,rowspan:H,colspan:me}),Jt=(R,H,me,Oe,ct,on)=>({element:R,rowspan:H,colspan:me,row:Oe,column:ct,isLocked:on}),de=(R,H,me)=>({element:R,cells:H,section:me}),Ce=(R,H,me,Oe)=>({startRow:R,startCol:H,finishRow:me,finishCol:Oe}),ot=(R,H,me)=>({element:R,colspan:H,column:me}),Xt=(R,H)=>({element:R,columns:H}),In=(R,H,me=mt)=>{if(me(H))return J.none();if(He(R,fn(H)))return J.some(H);const Oe=ct=>On(ct,"table")||me(ct);return Wo(H,R.join(","),Oe)},se=(R,H)=>In(["td","th"],R,H),ye=R=>nl(R,"th,td"),Ke=R=>On(R,"colgroup")?Ya(R,"col"):W(kn(R),H=>Ya(H,"col")),At=(R,H)=>Wt(R,"table",H),Tn=R=>nl(R,"tr"),kn=R=>At(R).fold(ee([]),H=>Ya(H,"colgroup")),fs=(R,H)=>lt(R,me=>{if(fn(me)==="colgroup"){const Oe=lt(Ke(me),ct=>{const on=Ka(ct,"span",1);return dt(ct,1,on)});return de(me,Oe,"colgroup")}else{const Oe=lt(ye(me),ct=>{const on=Ka(ct,"rowspan",1),Nn=Ka(ct,"colspan",1);return dt(ct,on,Nn)});return de(me,Oe,H(me))}}),Jr=R=>Bs(R).map(H=>{const me=fn(H);return Se(me)?me:"tbody"}).getOr("tbody"),tn=R=>{const H=Tn(R),Oe=[...kn(R),...H];return fs(Oe,Jr)},ua="data-snooker-locked-cols",Vs=R=>na(R,ua).bind(H=>J.from(H.match(/\d+/g))).map(H=>Ne(H,Le)),sl=(R,H)=>R+","+H,Zr=(R,H,me)=>J.from(R.access[sl(H,me)]),us=(R,H,me)=>{const Oe=mi(R,ct=>me(H,ct.element));return Oe.length>0?J.some(Oe[0]):J.none()},mi=(R,H)=>{const me=W(R.all,Oe=>Oe.cells);return St(me,H)},Aa=R=>{const H={};let me=0;return te(R.cells,Oe=>{const ct=Oe.colspan;Me(ct,on=>{const Nn=me+on;H[Nn]=ot(Oe.element,ct,Nn)}),me+=ct}),H},gi=R=>{const H={},me=[],ct=ut(R).map(Tc=>Tc.element).bind(At).bind(Vs).getOr({});let on=0,Nn=0,ao=0;const{pass:Zo,fail:es}=ft(R,Tc=>Tc.section==="colgroup");te(es,Tc=>{const ju=[];te(Tc.cells,zc=>{let hu=0;for(;H[sl(ao,hu)]!==void 0;)hu++;const Ng=tt(ct,hu.toString()),$g=Jt(zc.element,zc.rowspan,zc.colspan,ao,hu,Ng);for(let kc=0;kc<zc.colspan;kc++)for(let Dg=0;Dg<zc.rowspan;Dg++){const Mg=ao+Dg,Wp=hu+kc,Ah=sl(Mg,Wp);H[Ah]=$g,Nn=Math.max(Nn,Wp+1)}ju.push($g)}),on++,me.push(de(Tc.element,ju,Tc.section)),ao++});const{columns:lr,colgroups:sr}=je(Zo).map(Tc=>{const ju=Aa(Tc);return{colgroups:[Xt(Tc.element,Ie(ju))],columns:ju}}).getOrThunk(()=>({colgroups:[],columns:{}}));return{grid:Ze(on,Nn),access:H,all:me,columns:lr,colgroups:sr}},Zl={fromTable:R=>{const H=tn(R);return gi(H)},generate:gi,getAt:Zr,findItem:us,filterItems:mi,justCells:R=>W(R.all,H=>H.cells),justColumns:R=>Ie(R.columns),hasColumns:R=>Ge(R.columns).length>0,getColumnAt:(R,H)=>J.from(R.columns[H])};var Oa=tinymce.util.Tools.resolve("tinymce.util.Tools");const Va=(R,H,me)=>{const Oe=R.select("td,th",H);let ct;for(let on=0;on<Oe.length;on++){const Nn=R.getStyle(Oe[on],me);if(A(ct)&&(ct=Nn),ct!==Nn)return""}return ct},$i=(R,H,me)=>{Oa.each("left center right".split(" "),Oe=>{Oe!==me&&R.formatter.remove("align"+Oe,{},H)}),me&&R.formatter.apply("align"+me,{},H)},lu=(R,H,me)=>{Oa.each("top middle bottom".split(" "),Oe=>{Oe!==me&&R.formatter.remove("valign"+Oe,{},H)}),me&&R.formatter.apply("valign"+me,{},H)},$e=(R,H,me)=>{R.dispatch("TableModified",{...me,table:H})},Be=(R,H)=>Bc(R).getOr(H),Dt=(R,H,me)=>Be(wl(R,H),me),nn=(R,H,me,Oe)=>{const ct=Dt(R,`padding-${me}`,0),on=Dt(R,`padding-${Oe}`,0),Nn=Dt(R,`border-${me}-width`,0),ao=Dt(R,`border-${Oe}-width`,0);return H-ct-on-Nn-ao},po=(R,H)=>{const me=R.dom,Oe=me.getBoundingClientRect().width||me.offsetWidth;return H==="border-box"?Oe:nn(R,Oe,"left","right")},ss=R=>po(R,"content-box");var cr=tinymce.util.Tools.resolve("tinymce.Env");const ga="tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol",Yi=Me(5,R=>{const H=`${R+1}px`;return{title:H,value:H}}),hi=lt(["Solid","Dotted","Dashed","Double","Groove","Ridge","Inset","Outset","None","Hidden"],R=>({title:R,value:R.toLowerCase()})),Nr="100%",sa=R=>{var H;const me=R.dom,Oe=(H=me.getParent(R.selection.getStart(),me.isBlock))!==null&&H!==void 0?H:R.getBody();return ss(an.fromDom(Oe))+"px"},Sa=(R,H)=>Jd(R)||!Fc(R)?H:Cm(R)?{...H,width:sa(R)}:{...H,width:Nr},si=(R,H)=>Jd(R)||Fc(R)?H:Cm(R)?{...H,width:sa(R)}:{...H,width:Nr},Qr=R=>H=>H.options.get(R),Ha=R=>{const H=R.options.register;H("table_border_widths",{processor:"object[]",default:Yi}),H("table_border_styles",{processor:"object[]",default:hi}),H("table_cell_advtab",{processor:"boolean",default:!0}),H("table_row_advtab",{processor:"boolean",default:!0}),H("table_advtab",{processor:"boolean",default:!0}),H("table_appearance_options",{processor:"boolean",default:!0}),H("table_grid",{processor:"boolean",default:!cr.deviceType.isTouch()}),H("table_cell_class_list",{processor:"object[]",default:[]}),H("table_row_class_list",{processor:"object[]",default:[]}),H("table_class_list",{processor:"object[]",default:[]}),H("table_toolbar",{processor:"string",default:ga}),H("table_background_color_map",{processor:"object[]",default:[]}),H("table_border_color_map",{processor:"object[]",default:[]})},Ks=Qr("table_sizing_mode"),Gl=Qr("table_border_widths"),wm=Qr("table_border_styles"),Ru=Qr("table_cell_advtab"),Yd=Qr("table_row_advtab"),Kd=Qr("table_advtab"),id=Qr("table_appearance_options"),cd=Qr("table_grid"),Fc=Qr("table_style_by_css"),Di=Qr("table_cell_class_list"),Mp=Qr("table_row_class_list"),uu=Qr("table_class_list"),vg=Qr("table_toolbar"),Xd=Qr("table_background_color_map"),yg=Qr("table_border_color_map"),Cm=R=>Ks(R)==="fixed",Jd=R=>Ks(R)==="responsive",Sm=R=>{const H=R.options,me=H.get("table_default_styles");return H.isSet("table_default_styles")?me:Sa(R,me)},wg=R=>{const H=R.options,me=H.get("table_default_attributes");return H.isSet("table_default_attributes")?me:si(R,me)},ld=(R,H)=>H.column>=R.startCol&&H.column+H.colspan-1<=R.finishCol&&H.row>=R.startRow&&H.row+H.rowspan-1<=R.finishRow,Cg=(R,H)=>{let me=!0;const Oe=Z(ld,H);for(let ct=H.startRow;ct<=H.finishRow;ct++)for(let on=H.startCol;on<=H.finishCol;on++)me=me&&Zl.getAt(R,ct,on).exists(Oe);return me?J.some(H):J.none()},et=(R,H)=>Ce(Math.min(R.row,H.row),Math.min(R.column,H.column),Math.max(R.row+R.rowspan-1,H.row+H.rowspan-1),Math.max(R.column+R.colspan-1,H.column+H.colspan-1)),Qd=(R,H,me)=>{const Oe=Zl.findItem(R,H,vo),ct=Zl.findItem(R,me,vo);return Oe.bind(on=>ct.map(Nn=>et(on,Nn)))},rc=(R,H,me)=>Qd(R,H,me).bind(Oe=>Cg(R,Oe)),Sb=(R,H,me)=>{const Oe=Rp(R);return rc(Oe,H,me)},Rp=Zl.fromTable,ud=(R,H)=>{Bs(R).each(Oe=>{Oe.dom.insertBefore(H.dom,R.dom)})},$s=(R,H)=>{Bn(R).fold(()=>{Bs(R).each(ct=>{pi(ct,H)})},Oe=>{ud(Oe,H)})},ra=(R,H)=>{is(R).fold(()=>{pi(R,H)},Oe=>{R.dom.insertBefore(H.dom,Oe.dom)})},pi=(R,H)=>{R.dom.appendChild(H.dom)},Iu=(R,H)=>{ud(R,H),pi(H,R)},Sh=(R,H)=>{te(H,(me,Oe)=>{const ct=Oe===0?R:H[Oe-1];$s(ct,me)})},ef=(R,H)=>{te(H,me=>{pi(R,me)})},Mi=R=>{const H=R.dom;H.parentNode!==null&&H.parentNode.removeChild(H)},xm=R=>{const H=ro(R);H.length>0&&Sh(R,H),Mi(R)},Pu=((R,H)=>{const me=on=>{if(!R(on))throw new Error("Can only get "+H+" value of a "+H+" node");return Oe(on).getOr("")},Oe=on=>R(on)?J.from(on.dom.nodeValue):J.none();return{get:me,getOption:Oe,set:(on,Nn)=>{if(!R(on))throw new Error("Can only set raw "+H+" value of a "+H+" node");on.dom.nodeValue=Nn}}})(Br,"text"),Bu=R=>Pu.get(R),Df=(R,H)=>Pu.set(R,H);var rl=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],_m=()=>{const R=es=>an.fromDom(es.dom.cloneNode(!1)),H=es=>lo(es).dom,me=es=>Pr(es)?fn(es)==="body"?!0:He(rl,fn(es)):!1,Oe=es=>Pr(es)?He(["br","img","hr","input"],fn(es)):!1,ct=es=>Pr(es)&&ca(es,"contenteditable")==="false",on=(es,lr)=>es.dom.compareDocumentPosition(lr.dom),Nn=(es,lr)=>{const sr=Ys(es);ts(lr,sr)},ao=es=>{const lr=fn(es);return He(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],lr)},Zo=es=>Pr(es)?na(es,"lang"):J.none();return{up:ee({selector:Wo,closest:Wt,predicate:Yt,all:_t}),down:ee({selector:ta,predicate:Es}),styles:ee({get:wl,getRaw:Fr,set:Sc,remove:Wr}),attrs:ee({get:ca,set:Jo,remove:la,copyTo:Nn}),insert:ee({before:ud,after:$s,afterAll:Sh,append:pi,appendAll:ef,prepend:ra,wrap:Iu}),remove:ee({unwrap:xm,remove:Mi}),create:ee({nu:an.fromTag,clone:R,text:an.fromText}),query:ee({comparePosition:on,prevSibling:Ht,nextSibling:Bn}),property:ee({children:ro,name:fn,parent:Bs,document:H,isText:Br,isComment:rr,isElement:Pr,isSpecial:ao,getLanguage:Zo,getText:Bu,setText:Df,isBoundary:me,isEmptyTag:Oe,isNonEditable:ct}),eq:vo,is:Us}};const ri=(R,H,me,Oe)=>{const ct=me[0],on=me.slice(1);return Oe(R,H,ct,on)},Fu=(R,H,me)=>me.length>0?ri(R,H,me,Cl):J.none(),Cl=(R,H,me,Oe)=>{const ct=H(R,me);return jt(Oe,(on,Nn)=>{const ao=H(R,Nn);return Ri(R,on,ao)},ct)},Ri=(R,H,me)=>H.bind(Oe=>me.filter(Z(R.eq,Oe))),dd=Fu,Ip=_m(),Tm=(R,H)=>dd(Ip,(me,Oe)=>R(Oe),H),ql=R=>Wo(R,"table"),tf=(R,H)=>{const me=ta(R,H);return me.length>0?J.some(me):J.none()},Pp=(R,H,me)=>cn(R,H).bind(Oe=>cn(R,me).bind(ct=>Tm(ql,[Oe,ct]).map(on=>({first:Oe,last:ct,table:on})))),Sg=(R,H)=>tf(R,H),Bp=(R,H,me)=>Pp(R,H,me).bind(Oe=>{const ct=Zo=>vo(R,Zo),on="thead,tfoot,tbody,table",Nn=Wo(Oe.first,on,ct),ao=Wo(Oe.last,on,ct);return Nn.bind(Zo=>ao.bind(es=>vo(Zo,es)?Sb(Oe.table,Oe.first,Oe.last):J.none()))}),Fp=R=>lt(R,an.fromDom),xg="data-mce-selected",Lu="td["+xg+"],th["+xg+"]",km="data-mce-first-selected",du="td["+km+"],th["+km+"]",Lr="data-mce-last-selected",za="td["+Lr+"],th["+Lr+"]",ac={selected:xg,selectedSelector:Lu,firstSelected:km,firstSelectedSelector:du,lastSelected:Lr,lastSelectedSelector:za},Am=R=>At(R).bind(H=>Sg(H,ac.firstSelectedSelector)).fold(ee(R),H=>H[0]),Mf=R=>(H,me)=>{const Oe=fn(H),ct=Oe==="col"||Oe==="colgroup"?Am(H):H;return Wt(ct,R,me)},Ua=Mf("th,td,caption"),ho=Mf("th,td"),Om=R=>Fp(R.model.table.getSelectedCells()),Vu=(R,H)=>{const me=ho(R),Oe=me.bind(ct=>At(ct)).map(ct=>Tn(ct));return tl(me,Oe,(ct,on)=>St(on,Nn=>ht(Fp(Nn.dom.cells),ao=>ca(ao,H)==="1"||vo(ao,ct)))).getOr([])},ic=[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}],Ws=R=>({value:xh(R)}),nf=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Nm=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Eg=R=>nf.test(R)||Nm.test(R),xh=R=>oi(R,"#").toUpperCase(),Qo=R=>Eg(R)?J.some({value:xh(R)}):J.none(),ha=R=>{const H=R.toString(16);return(H.length===1?"0"+H:H).toUpperCase()},fd=R=>{const H=ha(R.red)+ha(R.green)+ha(R.blue);return Ws(H)},xc=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,cc=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,Lc=(R,H,me,Oe)=>({red:R,green:H,blue:me,alpha:Oe}),Xa=(R,H,me,Oe)=>{const ct=parseInt(R,10),on=parseInt(H,10),Nn=parseInt(me,10),ao=parseFloat(Oe);return Lc(ct,on,Nn,ao)},Ki=R=>{const H=xc.exec(R);if(H!==null)return J.some(Xa(H[1],H[2],H[3],"1"));const me=cc.exec(R);return me!==null?J.some(Xa(me[1],me[2],me[3],me[4])):J.none()},al=R=>Qo(R).orThunk(()=>Ki(R).map(fd)).getOrThunk(()=>{const H=document.createElement("canvas");H.height=1,H.width=1;const me=H.getContext("2d");me.clearRect(0,0,H.width,H.height),me.fillStyle="#FFFFFF",me.fillStyle=R,me.fillRect(0,0,1,1);const Oe=me.getImageData(0,0,1,1).data,ct=Oe[0],on=Oe[1],Nn=Oe[2],ao=Oe[3];return fd(Lc(ct,on,Nn,ao))}),_g=R=>Ki(R).map(fd).map(H=>"#"+H.value).getOr(R),$r=R=>{let H=R;return{get:()=>H,set:ct=>{H=ct}}},Tg=R=>{const H=$r(J.none()),me=()=>H.get().each(R);return{clear:()=>{me(),H.set(J.none())},isSet:()=>H.get().isSome(),get:()=>H.get(),set:ao=>{me(),H.set(J.some(ao))}}},xa=()=>Tg(R=>R.unbind()),md=(R,H,me)=>Oe=>{const ct=xa(),on=Pc(me),Nn=()=>{const ao=Om(R),Zo=es=>R.formatter.match(H,{value:me},es.dom,on);on?(Oe.setActive(!ht(ao,Zo)),ct.set(R.formatter.formatChanged(H,es=>Oe.setActive(!es),!0))):(Oe.setActive(ve(ao,Zo)),ct.set(R.formatter.formatChanged(H,Oe.setActive,!1,{value:me})))};return R.initialized?Nn():R.on("init",Nn),ct.clear},fu=R=>tt(R,"menu"),ur=R=>lt(R,H=>{const me=H.text||H.title||"";return fu(H)?{text:me,items:ur(H.menu)}:{text:me,value:H.value}}),Yl=R=>R.length?J.some(ur([{text:"Select...",value:"mce-no-match"},...R])):J.none(),Rf=(R,H,me,Oe)=>lt(H,ct=>{const on=ct.text||ct.title;return fu(ct)?{type:"nestedmenuitem",text:on,getSubmenuItems:()=>Rf(R,ct.menu,me,Oe)}:{text:on,type:"togglemenuitem",onAction:()=>Oe(ct.value),onSetup:md(R,me,ct.value)}}),gd=(R,H)=>me=>{R.execCommand("mceTableApplyCellStyle",!1,{[H]:me})},Dr=R=>W(R,H=>fu(H)?[{...H,menu:Dr(H.menu)}]:di(H.value)?[H]:[]),Hu=(R,H,me,Oe)=>ct=>ct(Rf(R,H,me,Oe)),il=(R,H,me)=>{const Oe=lt(H,ct=>({text:ct.title,value:"#"+al(ct.value).value,type:"choiceitem"}));return[{type:"fancymenuitem",fancytype:"colorswatch",initData:{colors:Oe.length>0?Oe:void 0,allowCustomColors:!1},onAction:ct=>{const on=ct.value==="remove"?"":ct.value;R.execCommand("mceTableApplyCellStyle",!1,{[me]:on})}}]},bs=R=>()=>{const me=R.queryCommandValue("mceTableRowType")==="header"?"body":"header";R.execCommand("mceTableRowType",!1,{type:me})},of=R=>()=>{const me=R.queryCommandValue("mceTableColType")==="th"?"td":"th";R.execCommand("mceTableColType",!1,{type:me})},kg=R=>Yl(Di(R)).map(H=>({name:"class",type:"listbox",label:"Class",items:H})),F=[{name:"width",type:"input",label:"Width"},{name:"celltype",type:"listbox",label:"Cell type",items:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{name:"scope",type:"listbox",label:"Scope",items:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{name:"halign",type:"listbox",label:"Horizontal align",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{name:"valign",type:"listbox",label:"Vertical align",items:ic}],X=R=>F.concat(kg(R).toArray()),pe=(R,H)=>{const Oe=[{name:"borderstyle",type:"listbox",label:"Border style",items:[{text:"Select...",value:""}].concat(ur(wm(R)))},{name:"bordercolor",type:"colorinput",label:"Border color"},{name:"backgroundcolor",type:"colorinput",label:"Background color"}];return{title:"Advanced",name:"advanced",items:H==="cell"?[{name:"borderwidth",type:"input",label:"Border width"}].concat(Oe):Oe}},it={normal:(R,H)=>{const me=R.dom;return{setAttrib:(Nn,ao)=>{me.setAttrib(H,Nn,ao)},setStyle:(Nn,ao)=>{me.setStyle(H,Nn,ao)},setFormat:(Nn,ao)=>{ao===""?R.formatter.remove(Nn,{value:null},H,!0):R.formatter.apply(Nn,{value:ao},H)}}}},wn=Xr("th"),$o=(R,H)=>R&&H?"sectionCells":R?"section":"cells",ns=R=>{const H=R.section==="thead",me=jl(Ko(R.cells),"th");return R.section==="tfoot"?{type:"footer"}:H||me?{type:"header",subType:$o(H,me)}:{type:"body"}},Ko=R=>{const H=St(R,me=>wn(me.element));return H.length===0?J.some("td"):H.length===R.length?J.some("th"):J.none()},mo=R=>{const H=lt(R,ct=>ns(ct).type),me=He(H,"header"),Oe=He(H,"footer");if(!me&&!Oe)return J.some("body");{const ct=He(H,"body");return me&&!ct&&!Oe?J.some("header"):!me&&!ct&&Oe?J.some("footer"):J.none()}},Vr=R=>{let H=!1,me;return(...Oe)=>(H||(H=!0,me=R.apply(null,Oe)),me)},aa=(R,H)=>pt(R.all,me=>re(me.cells,Oe=>vo(H,Oe.element))),cl=(R,H,me)=>{const Oe=lt(H.selection,on=>se(on).bind(Nn=>aa(R,Nn)).filter(me)),ct=ui(Oe);return Oi(ct.length>0,ct)},Vc=(R,H)=>H.mergable,xb=(R,H)=>H.unmergable,If=(R,H)=>cl(R,H,Le),Lp=(R,H)=>aa(R,H).exists(me=>!me.isLocked),Ii=(R,H)=>ve(H,me=>Lp(R,me)),Vp=(R,H)=>Vc(R,H).filter(me=>Ii(R,me.cells)),A0=(R,H)=>xb(R,H).filter(me=>Ii(R,me));({...{generate:R=>{if(!x(R))throw new Error("cases must be an array");if(R.length===0)throw new Error("there must be at least one case");const H=[],me={};return te(R,(Oe,ct)=>{const on=Ge(Oe);if(on.length!==1)throw new Error("one and only one name per case");const Nn=on[0],ao=Oe[Nn];if(me[Nn]!==void 0)throw new Error("duplicate key detected:"+Nn);if(Nn==="cata")throw new Error("cannot have a case named cata (sorry)");if(!x(ao))throw new Error("case arguments must be an array");H.push(Nn),me[Nn]=(...Zo)=>{const es=Zo.length;if(es!==ao.length)throw new Error("Wrong number of arguments to case "+Nn+". Expected "+ao.length+" ("+ao+"), got "+es);return{fold:(...sr)=>{if(sr.length!==R.length)throw new Error("Wrong number of arguments to fold. Expected "+R.length+", got "+sr.length);return sr[ct].apply(null,Zo)},match:sr=>{const qr=Ge(sr);if(H.length!==qr.length)throw new Error("Wrong number of arguments to match. Expected: "+H.join(",")+`
110
110
  Actual: `+qr.join(","));if(!ve(H,ju=>He(qr,ju)))throw new Error("Not all branches were specified when using match. Specified: "+qr.join(", ")+`
111
111
  Required: `+H.join(", "));return sr[Nn].apply(null,Zo)},log:sr=>{console.log(sr,{constructors:H,constructor:Nn,params:Zo})}}}}),me}}.generate([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])});const Eb=(R,H)=>{const me=Zl.fromTable(R);return If(me,H).bind(ct=>{const on=ct[ct.length-1],Nn=ct[0].row,ao=on.row+on.rowspan,Zo=me.all.slice(Nn,ao);return mo(Zo)}).getOr("")},Bi=R=>qi(R,"rgb")?_g(R):R,Fo=R=>{const H=an.fromDom(R);return{borderwidth:Fr(H,"border-width").getOr(""),borderstyle:Fr(H,"border-style").getOr(""),bordercolor:Fr(H,"border-color").map(Bi).getOr(""),backgroundcolor:Fr(H,"background-color").map(Bi).getOr("")}},Kl=R=>{const H=R[0],me=R.slice(1);return te(me,Oe=>{te(Ge(H),ct=>{yt(Oe,(on,Nn)=>{const ao=H[ct];ao!==""&&ct===Nn&&ao!==on&&(H[ct]=ct==="class"?"mce-no-match":"")})})}),H},$m=(R,H,me,Oe)=>re(R,ct=>!A(me.formatter.matchNode(Oe,H+ct))).getOr(""),Ag=Z($m,["left","center","right"],"align"),O0=Z($m,["top","middle","bottom"],"valign"),Up=(R,H)=>{const me=Sm(R),Oe=wg(R),ct=()=>({borderstyle:Ue(me,"border-style").getOr(""),bordercolor:Bi(Ue(me,"border-color").getOr("")),backgroundcolor:Bi(Ue(me,"background-color").getOr(""))}),on={height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:""},Nn=()=>{const lr=me["border-width"];return Fc(R)&&lr?{border:lr}:Ue(Oe,"border").fold(()=>({}),sr=>({border:sr}))},ao=H?ct():{},Zo=()=>{const lr=Ue(me,"border-spacing").or(Ue(Oe,"cellspacing")).fold(()=>({}),qr=>({cellspacing:qr})),sr=Ue(me,"border-padding").or(Ue(Oe,"cellpadding")).fold(()=>({}),qr=>({cellpadding:qr}));return{...lr,...sr}};return{...on,...me,...Oe,...ao,...Nn(),...Zo()}},mu=R=>At(an.fromDom(R)).map(H=>{const me={selection:Fp(R.cells)};return Eb(H,me)}).getOr(""),hd=(R,H,me)=>{const Oe=(ao,Zo)=>{const es=Fr(an.fromDom(Zo),"border-width");return Fc(R)&&es.isSome()?es.getOr(""):ao.getAttrib(Zo,"border")||Va(R.dom,Zo,"border-width")||Va(R.dom,Zo,"border")||""},ct=R.dom,on=Fc(R)?ct.getStyle(H,"border-spacing")||ct.getAttrib(H,"cellspacing"):ct.getAttrib(H,"cellspacing")||ct.getStyle(H,"border-spacing"),Nn=Fc(R)?Va(ct,H,"padding")||ct.getAttrib(H,"cellpadding"):ct.getAttrib(H,"cellpadding")||Va(ct,H,"padding");return{width:ct.getStyle(H,"width")||ct.getAttrib(H,"width"),height:ct.getStyle(H,"height")||ct.getAttrib(H,"height"),cellspacing:on??"",cellpadding:Nn??"",border:Oe(ct,H),caption:!!ct.select("caption",H)[0],class:ct.getAttrib(H,"class",""),align:Ag(R,H),...me?Fo(H):{}}},Pf=(R,H,me)=>{const Oe=R.dom;return{height:Oe.getStyle(H,"height")||Oe.getAttrib(H,"height"),class:Oe.getAttrib(H,"class",""),type:mu(H),align:Ag(R,H),...me?Fo(H):{}}},Zn=(R,H,me,Oe)=>{const ct=R.dom,on=Oe.getOr(H);return{width:((ao,Zo)=>ct.getStyle(ao,Zo)||ct.getAttrib(ao,Zo))(on,"width"),scope:ct.getAttrib(H,"scope"),celltype:yn(H),class:ct.getAttrib(H,"class",""),halign:Ag(R,H),valign:O0(R,H),...me?Fo(H):{}}},Sl=(R,H)=>{const me=Zl.fromTable(R),Oe=Zl.justCells(me),ct=St(Oe,on=>ht(H,Nn=>vo(on.element,Nn)));return lt(ct,on=>({element:on.element.dom,column:Zl.getColumnAt(me,on.column).map(Nn=>Nn.element.dom)}))},_b=(R,H,me,Oe)=>{Oe("scope")&&R.setAttrib("scope",me.scope),Oe("class")&&me.class!=="mce-no-match"&&R.setAttrib("class",me.class),Oe("width")&&H.setStyle("width",no(me.width))},Dm=(R,H,me)=>{me("backgroundcolor")&&R.setFormat("tablecellbackgroundcolor",H.backgroundcolor),me("bordercolor")&&R.setFormat("tablecellbordercolor",H.bordercolor),me("borderstyle")&&R.setFormat("tablecellborderstyle",H.borderstyle),me("borderwidth")&&R.setFormat("tablecellborderwidth",no(H.borderwidth))},gu=(R,H,me,Oe)=>{const ct=H.length===1;te(H,on=>{const Nn=on.element,ao=ct?Le:Oe,Zo=it.normal(R,Nn),es=on.column.map(lr=>it.normal(R,lr)).getOr(Zo);_b(Zo,es,me,ao),Ru(R)&&Dm(Zo,me,ao),Oe("halign")&&$i(R,Nn,me.halign),Oe("valign")&&lu(R,Nn,me.valign)})},Eh=(R,H)=>{R.execCommand("mceTableCellType",!1,{type:H.celltype,no_events:!0})},Bf=(R,H,me,Oe)=>{const ct=Vt(Oe,(on,Nn)=>me[Nn]!==on);D(ct)>0&&H.length>=1&&At(H[0]).each(on=>{const Nn=Sl(on,H),ao=D(Vt(ct,(es,lr)=>lr!=="scope"&&lr!=="celltype"))>0,Zo=be(ct,"celltype");(ao||be(ct,"scope"))&&gu(R,Nn,Oe,Z(be,ct)),Zo&&Eh(R,Oe),$e(R,on.dom,{structure:Zo,style:ao})})},Mm=(R,H,me,Oe)=>{const ct=Oe.getData();Oe.close(),R.undoManager.transact(()=>{Bf(R,H,me,ct),R.focus()})},_h=(R,H)=>{const me=At(H[0]).map(Oe=>lt(Sl(Oe,H),ct=>Zn(R,ct.element,Ru(R),ct.column)));return Kl(me.getOrDie())},zu=R=>{const H=Om(R);if(H.length===0)return;const me=_h(R,H),Oe={type:"tabpanel",tabs:[{title:"General",name:"general",items:X(R)},pe(R,"cell")]},ct={type:"panel",items:[{type:"grid",columns:2,items:X(R)}]};R.windowManager.open({title:"Cell Properties",size:"normal",body:Ru(R)?Oe:ct,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:me,onSubmit:Z(Mm,R,H,me)})},N0=R=>Yl(Mp(R)).map(H=>({name:"class",type:"listbox",label:"Class",items:H})),ia=[{type:"listbox",name:"type",label:"Row type",items:[{text:"Header",value:"header"},{text:"Body",value:"body"},{text:"Footer",value:"footer"}]},{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height",type:"input"}],Sn=R=>ia.concat(N0(R).toArray()),Ec=(R,H,me)=>{me("class")&&H.class!=="mce-no-match"&&R.setAttrib("class",H.class),me("height")&&R.setStyle("height",no(H.height))},Uu=(R,H,me)=>{me("backgroundcolor")&&R.setStyle("background-color",H.backgroundcolor),me("bordercolor")&&R.setStyle("border-color",H.bordercolor),me("borderstyle")&&R.setStyle("border-style",H.borderstyle)},Ja=(R,H,me,Oe)=>{const on=H.length===1?Le:Oe;te(H,Nn=>{const ao=Ya(an.fromDom(Nn),"td,th"),Zo=it.normal(R,Nn);Ec(Zo,me,on),Yd(R)&&Uu(Zo,me,on),Oe("height")&&te(ao,es=>{R.dom.setStyle(es.dom,"height",null)}),Oe("align")&&$i(R,Nn,me.align)})},Og=(R,H)=>{R.execCommand("mceTableRowType",!1,{type:H.type,no_events:!0})},Qa=(R,H,me,Oe)=>{const ct=Vt(Oe,(on,Nn)=>me[Nn]!==on);if(D(ct)>0){const on=be(ct,"type"),Nn=on?D(ct)>1:!0;Nn&&Ja(R,H,Oe,Z(be,ct)),on&&Og(R,Oe),At(an.fromDom(H[0])).each(ao=>$e(R,ao.dom,{structure:on,style:Nn}))}},Fs=(R,H,me,Oe)=>{const ct=Oe.getData();Oe.close(),R.undoManager.transact(()=>{Qa(R,H,me,ct),R.focus()})},jp=R=>{const H=Vu(wo(R),ac.selected);if(H.length===0)return;const me=lt(H,Nn=>Pf(R,Nn.dom,Yd(R))),Oe=Kl(me),ct={type:"tabpanel",tabs:[{title:"General",name:"general",items:Sn(R)},pe(R,"row")]},on={type:"panel",items:[{type:"grid",columns:2,items:Sn(R)}]};R.windowManager.open({title:"Row Properties",size:"normal",body:Yd(R)?ct:on,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:Oe,onSubmit:Z(Fs,R,lt(H,Nn=>Nn.dom),Oe)})},sn=(R,H,me)=>{const Oe=me?[{type:"input",name:"cols",label:"Cols",inputMode:"numeric"},{type:"input",name:"rows",label:"Rows",inputMode:"numeric"}]:[],ct=[{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}],on=id(R)?[{type:"input",name:"cellspacing",label:"Cell spacing",inputMode:"numeric"},{type:"input",name:"cellpadding",label:"Cell padding",inputMode:"numeric"},{type:"input",name:"border",label:"Border width"},{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[],Nn=[{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}],ao=H.length>0?[{name:"class",type:"listbox",label:"Class",items:H}]:[];return Oe.concat(ct).concat(on).concat(Nn).concat(ao)},Ls=(R,H,me,Oe)=>{if(H.tagName==="TD"||H.tagName==="TH")y(me)&&P(Oe)?R.setStyle(H,me,Oe):R.setStyles(H,me);else if(H.children)for(let ct=0;ct<H.children.length;ct++)Ls(R,H.children[ct],me,Oe)},Tb=(R,H,me,Oe)=>{const ct=R.dom,on={},Nn={},ao=Fc(R),Zo=Kd(R),es=parseFloat(me.border)===0;if(!A(me.class)&&me.class!=="mce-no-match"&&(on.class=me.class),Nn.height=no(me.height),ao?Nn.width=no(me.width):ct.getAttrib(H,"width")&&(on.width=uo(me.width)),ao?(es?(on.border=0,Nn["border-width"]=""):(Nn["border-width"]=no(me.border),on.border=1),Nn["border-spacing"]=no(me.cellspacing)):(on.border=es?0:me.border,on.cellpadding=me.cellpadding,on.cellspacing=me.cellspacing),ao&&H.children){const lr={};if(es?lr["border-width"]="":Oe.border&&(lr["border-width"]=no(me.border)),Oe.cellpadding&&(lr.padding=no(me.cellpadding)),Zo&&Oe.bordercolor&&(lr["border-color"]=me.bordercolor),!nt(lr))for(let sr=0;sr<H.children.length;sr++)Ls(ct,H.children[sr],lr)}if(Zo){const lr=me;Nn["background-color"]=lr.backgroundcolor,Nn["border-color"]=lr.bordercolor,Nn["border-style"]=lr.borderstyle}ct.setStyles(H,{...Sm(R),...Nn}),ct.setAttribs(H,{...wg(R),...on})},Na=(R,H,me,Oe)=>{const ct=R.dom,on=Oe.getData(),Nn=Vt(on,(ao,Zo)=>me[Zo]!==ao);Oe.close(),R.undoManager.transact(()=>{if(!H){const ao=wc(on.cols).getOr(1),Zo=wc(on.rows).getOr(1);R.execCommand("mceInsertTable",!1,{rows:Zo,columns:ao}),H=ho(wo(R),co(R)).bind(es=>At(es,co(R))).map(es=>es.dom).getOrDie()}if(D(Nn)>0){const ao={border:be(Nn,"border"),bordercolor:be(Nn,"bordercolor"),cellpadding:be(Nn,"cellpadding")};Tb(R,H,on,ao);const Zo=ct.select("caption",H)[0];(Zo&&!on.caption||!Zo&&on.caption)&&R.execCommand("mceTableToggleCaption"),$i(R,H,on.align)}if(R.focus(),R.addVisual(),D(Nn)>0){const ao=be(Nn,"caption"),Zo=ao?D(Nn)>1:!0;$e(R,H,{structure:ao,style:Zo})}})},Xl=(R,H)=>{const me=R.dom;let Oe,ct=Up(R,Kd(R));H?(ct.cols="1",ct.rows="1",Kd(R)&&(ct.borderstyle="",ct.bordercolor="",ct.backgroundcolor="")):(Oe=me.getParent(R.selection.getStart(),"table",R.getBody()),Oe?ct=hd(R,Oe,Kd(R)):Kd(R)&&(ct.borderstyle="",ct.bordercolor="",ct.backgroundcolor=""));const on=Yl(uu(R));on.isSome()&&ct.class&&(ct.class=ct.class.replace(/\s*mce\-item\-table\s*/g,""));const Nn={type:"grid",columns:2,items:sn(R,on.getOr([]),H)},ao=()=>({type:"panel",items:[Nn]}),Zo=()=>({type:"tabpanel",tabs:[{title:"General",name:"general",items:[Nn]},pe(R,"table")]}),es=Kd(R)?Zo():ao();R.windowManager.open({title:"Table Properties",size:"normal",body:es,onSubmit:Z(Na,R,Oe,ct),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:ct})},bi=R=>{const H=me=>{cs(wo(R))&&me()};yt({mceTableProps:Z(Xl,R,!1),mceTableRowProps:Z(jp,R),mceTableCellProps:Z(zu,R),mceInsertTableDialog:Z(Xl,R,!0)},(me,Oe)=>R.addCommand(Oe,()=>H(me)))},e2=(R,H)=>js(R,H).isSome(),pd=le,$0=R=>{const H=(Oe,ct)=>na(Oe,ct).exists(on=>parseInt(on,10)>1),me=Oe=>H(Oe,"rowspan")||H(Oe,"colspan");return R.length>0&&ve(R,me)?J.some(R):J.none()},Hc=(R,H,me)=>H.length<=1?J.none():Bp(R,me.firstSelectedSelector,me.lastSelectedSelector).map(Oe=>({bounds:Oe,cells:H})),Hs=R=>({element:R,mergable:J.none(),unmergable:J.none(),selection:[R]}),bd=(R,H,me)=>({element:me,mergable:Hc(H,R,ac),unmergable:$0(R),selection:pd(R)}),Th=R=>{const H=$r(J.none()),me=$r([]);let Oe=J.none();const ct=Xr("caption"),on=Ds=>Oe.forall(Cr=>!Cr[Ds]),Nn=()=>Ua(wo(R),co(R)),ao=()=>Ua(Io(R),co(R)),Zo=()=>Nn().bind(Ds=>ls(tl(At(Ds),ao().bind(At),(Cr,Uc)=>vo(Cr,Uc)?ct(Ds)?J.some(Hs(Ds)):J.some(bd(Om(R),Cr,Ds)):J.none()))),es=Ds=>At(Ds.element).map(Uc=>{const Ea=Zl.fromTable(Uc),Zp=If(Ea,Ds).getOr([]),Oh=Ct(Zp,(Ff,ul)=>(ul.isLocked&&(Ff.onAny=!0,ul.column===0?Ff.onFirst=!0:ul.column+ul.colspan>=Ea.grid.columns&&(Ff.onLast=!0)),Ff),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:Vp(Ea,Ds).isSome(),unmergeable:A0(Ea,Ds).isSome(),locked:Oh}}),lr=()=>{H.set(Vr(Zo)()),Oe=H.get().bind(es),te(me.get(),Ae)},sr=Ds=>(Ds(),me.set(me.get().concat([Ds])),()=>{me.set(St(me.get(),Cr=>Cr!==Ds))}),qr=(Ds,Cr)=>sr(()=>H.get().fold(()=>{Ds.setEnabled(!1)},Uc=>{Ds.setEnabled(!Cr(Uc)&&R.selection.isEditable())})),Tc=(Ds,Cr,Uc)=>sr(()=>H.get().fold(()=>{Ds.setEnabled(!1),Ds.setActive(!1)},Ea=>{Ds.setEnabled(!Cr(Ea)&&R.selection.isEditable()),Ds.setActive(Uc(Ea))})),ju=Ds=>Oe.exists(Cr=>Cr.locked[Ds]),zc=Ds=>qr(Ds,Cr=>!1),hu=Ds=>qr(Ds,Cr=>ct(Cr.element)),Ng=Ds=>Cr=>qr(Cr,Uc=>ct(Uc.element)||ju(Ds)),$g=Ds=>Cr=>qr(Cr,Uc=>ct(Uc.element)||Ds().isNone()),kc=(Ds,Cr)=>Uc=>qr(Uc,Ea=>ct(Ea.element)||Ds().isNone()||ju(Cr)),Dg=Ds=>qr(Ds,Cr=>on("mergeable")),Mg=Ds=>qr(Ds,Cr=>on("unmergeable")),Wp=Ds=>Tc(Ds,mt,Cr=>At(Cr.element,co(R)).exists(Ea=>e2(Ea,"caption"))),Ah=(Ds,Cr)=>Uc=>Tc(Uc,Ea=>ct(Ea.element),()=>R.queryCommandValue(Ds)===Cr),ai=Ah("mceTableRowType","header"),pu=Ah("mceTableColType","th");return R.on("NodeChange ExecCommand TableSelectorChange",lr),{onSetupTable:zc,onSetupCellOrRow:hu,onSetupColumn:Ng,onSetupPasteable:$g,onSetupPasteableColumn:kc,onSetupMergeable:Dg,onSetupUnmergeable:Mg,resetTargets:lr,onSetupTableWithCaption:Wp,onSetupTableRowHeaders:ai,onSetupTableColumnHeaders:pu,targets:H.get}};var pa=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const kh="x-tinymce/dom-table-",sf=kh+"rows",D0=kh+"columns",_c=R=>{var H;const me=(H=pa.read())!==null&&H!==void 0?H:[];return pt(me,Oe=>J.from(Oe.getType(R)))},xl=()=>_c(sf),Tt=()=>_c(D0),ll=R=>H=>{const me=()=>{H.setEnabled(R.selection.isEditable())};return R.on("NodeChange",me),me(),()=>{R.off("NodeChange",me)}},ei=(R,H)=>{R.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",onSetup:ll(R),fetch:ao=>ao("inserttable | cell row column | advtablesort | tableprops deletetable")});const me=ao=>()=>R.execCommand(ao),Oe=(ao,Zo)=>{R.queryCommandSupported(Zo.command)&&R.ui.registry.addButton(ao,{...Zo,onAction:z(Zo.onAction)?Zo.onAction:me(Zo.command)})},ct=(ao,Zo)=>{R.queryCommandSupported(Zo.command)&&R.ui.registry.addToggleButton(ao,{...Zo,onAction:z(Zo.onAction)?Zo.onAction:me(Zo.command)})};Oe("tableprops",{tooltip:"Table properties",command:"mceTableProps",icon:"table",onSetup:H.onSetupTable}),Oe("tabledelete",{tooltip:"Delete table",command:"mceTableDelete",icon:"table-delete-table",onSetup:H.onSetupTable}),Oe("tablecellprops",{tooltip:"Cell properties",command:"mceTableCellProps",icon:"table-cell-properties",onSetup:H.onSetupCellOrRow}),Oe("tablemergecells",{tooltip:"Merge cells",command:"mceTableMergeCells",icon:"table-merge-cells",onSetup:H.onSetupMergeable}),Oe("tablesplitcells",{tooltip:"Split cell",command:"mceTableSplitCells",icon:"table-split-cells",onSetup:H.onSetupUnmergeable}),Oe("tableinsertrowbefore",{tooltip:"Insert row before",command:"mceTableInsertRowBefore",icon:"table-insert-row-above",onSetup:H.onSetupCellOrRow}),Oe("tableinsertrowafter",{tooltip:"Insert row after",command:"mceTableInsertRowAfter",icon:"table-insert-row-after",onSetup:H.onSetupCellOrRow}),Oe("tabledeleterow",{tooltip:"Delete row",command:"mceTableDeleteRow",icon:"table-delete-row",onSetup:H.onSetupCellOrRow}),Oe("tablerowprops",{tooltip:"Row properties",command:"mceTableRowProps",icon:"table-row-properties",onSetup:H.onSetupCellOrRow}),Oe("tableinsertcolbefore",{tooltip:"Insert column before",command:"mceTableInsertColBefore",icon:"table-insert-column-before",onSetup:H.onSetupColumn("onFirst")}),Oe("tableinsertcolafter",{tooltip:"Insert column after",command:"mceTableInsertColAfter",icon:"table-insert-column-after",onSetup:H.onSetupColumn("onLast")}),Oe("tabledeletecol",{tooltip:"Delete column",command:"mceTableDeleteCol",icon:"table-delete-column",onSetup:H.onSetupColumn("onAny")}),Oe("tablecutrow",{tooltip:"Cut row",command:"mceTableCutRow",icon:"cut-row",onSetup:H.onSetupCellOrRow}),Oe("tablecopyrow",{tooltip:"Copy row",command:"mceTableCopyRow",icon:"duplicate-row",onSetup:H.onSetupCellOrRow}),Oe("tablepasterowbefore",{tooltip:"Paste row before",command:"mceTablePasteRowBefore",icon:"paste-row-before",onSetup:H.onSetupPasteable(xl)}),Oe("tablepasterowafter",{tooltip:"Paste row after",command:"mceTablePasteRowAfter",icon:"paste-row-after",onSetup:H.onSetupPasteable(xl)}),Oe("tablecutcol",{tooltip:"Cut column",command:"mceTableCutCol",icon:"cut-column",onSetup:H.onSetupColumn("onAny")}),Oe("tablecopycol",{tooltip:"Copy column",command:"mceTableCopyCol",icon:"duplicate-column",onSetup:H.onSetupColumn("onAny")}),Oe("tablepastecolbefore",{tooltip:"Paste column before",command:"mceTablePasteColBefore",icon:"paste-column-before",onSetup:H.onSetupPasteableColumn(Tt,"onFirst")}),Oe("tablepastecolafter",{tooltip:"Paste column after",command:"mceTablePasteColAfter",icon:"paste-column-after",onSetup:H.onSetupPasteableColumn(Tt,"onLast")}),Oe("tableinsertdialog",{tooltip:"Insert table",command:"mceInsertTableDialog",icon:"table",onSetup:ll(R)});const on=Dr(uu(R));on.length!==0&&R.queryCommandSupported("mceTableToggleClass")&&R.ui.registry.addMenuButton("tableclass",{icon:"table-classes",tooltip:"Table styles",fetch:Hu(R,on,"tableclass",ao=>R.execCommand("mceTableToggleClass",!1,ao)),onSetup:H.onSetupTable});const Nn=Dr(Di(R));Nn.length!==0&&R.queryCommandSupported("mceTableCellToggleClass")&&R.ui.registry.addMenuButton("tablecellclass",{icon:"table-cell-classes",tooltip:"Cell styles",fetch:Hu(R,Nn,"tablecellclass",ao=>R.execCommand("mceTableCellToggleClass",!1,ao)),onSetup:H.onSetupCellOrRow}),R.queryCommandSupported("mceTableApplyCellStyle")&&(R.ui.registry.addMenuButton("tablecellvalign",{icon:"vertical-align",tooltip:"Vertical align",fetch:Hu(R,ic,"tablecellverticalalign",gd(R,"vertical-align")),onSetup:H.onSetupCellOrRow}),R.ui.registry.addMenuButton("tablecellborderwidth",{icon:"border-width",tooltip:"Border width",fetch:Hu(R,Gl(R),"tablecellborderwidth",gd(R,"border-width")),onSetup:H.onSetupCellOrRow}),R.ui.registry.addMenuButton("tablecellborderstyle",{icon:"border-style",tooltip:"Border style",fetch:Hu(R,wm(R),"tablecellborderstyle",gd(R,"border-style")),onSetup:H.onSetupCellOrRow}),R.ui.registry.addMenuButton("tablecellbackgroundcolor",{icon:"cell-background-color",tooltip:"Background color",fetch:ao=>ao(il(R,Xd(R),"background-color")),onSetup:H.onSetupCellOrRow}),R.ui.registry.addMenuButton("tablecellbordercolor",{icon:"cell-border-color",tooltip:"Border color",fetch:ao=>ao(il(R,yg(R),"border-color")),onSetup:H.onSetupCellOrRow})),ct("tablecaption",{tooltip:"Table caption",icon:"table-caption",command:"mceTableToggleCaption",onSetup:H.onSetupTableWithCaption}),ct("tablerowheader",{tooltip:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:bs(R),onSetup:H.onSetupTableRowHeaders}),ct("tablecolheader",{tooltip:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:of(R),onSetup:H.onSetupTableColumnHeaders})},Gr=R=>{const H=Oe=>R.dom.is(Oe,"table")&&R.getBody().contains(Oe)&&R.dom.isEditable(Oe.parentNode),me=vg(R);me.length>0&&R.ui.registry.addContextToolbar("table",{predicate:H,items:me,scope:"node",position:"node"})},El=R=>H=>{const me=()=>{H.setEnabled(R.selection.isEditable())};return R.on("NodeChange",me),me(),()=>{R.off("NodeChange",me)}},ba=(R,H)=>{const me=sr=>()=>R.execCommand(sr),Oe=(sr,qr)=>R.queryCommandSupported(qr.command)?(R.ui.registry.addMenuItem(sr,{...qr,onAction:z(qr.onAction)?qr.onAction:me(qr.command)}),!0):!1,ct=(sr,qr)=>{R.queryCommandSupported(qr.command)&&R.ui.registry.addToggleMenuItem(sr,{...qr,onAction:z(qr.onAction)?qr.onAction:me(qr.command)})},on=sr=>{R.execCommand("mceInsertTable",!1,{rows:sr.numRows,columns:sr.numColumns})},Nn=[Oe("tableinsertrowbefore",{text:"Insert row before",icon:"table-insert-row-above",command:"mceTableInsertRowBefore",onSetup:H.onSetupCellOrRow}),Oe("tableinsertrowafter",{text:"Insert row after",icon:"table-insert-row-after",command:"mceTableInsertRowAfter",onSetup:H.onSetupCellOrRow}),Oe("tabledeleterow",{text:"Delete row",icon:"table-delete-row",command:"mceTableDeleteRow",onSetup:H.onSetupCellOrRow}),Oe("tablerowprops",{text:"Row properties",icon:"table-row-properties",command:"mceTableRowProps",onSetup:H.onSetupCellOrRow}),Oe("tablecutrow",{text:"Cut row",icon:"cut-row",command:"mceTableCutRow",onSetup:H.onSetupCellOrRow}),Oe("tablecopyrow",{text:"Copy row",icon:"duplicate-row",command:"mceTableCopyRow",onSetup:H.onSetupCellOrRow}),Oe("tablepasterowbefore",{text:"Paste row before",icon:"paste-row-before",command:"mceTablePasteRowBefore",onSetup:H.onSetupPasteable(xl)}),Oe("tablepasterowafter",{text:"Paste row after",icon:"paste-row-after",command:"mceTablePasteRowAfter",onSetup:H.onSetupPasteable(xl)})],ao=[Oe("tableinsertcolumnbefore",{text:"Insert column before",icon:"table-insert-column-before",command:"mceTableInsertColBefore",onSetup:H.onSetupColumn("onFirst")}),Oe("tableinsertcolumnafter",{text:"Insert column after",icon:"table-insert-column-after",command:"mceTableInsertColAfter",onSetup:H.onSetupColumn("onLast")}),Oe("tabledeletecolumn",{text:"Delete column",icon:"table-delete-column",command:"mceTableDeleteCol",onSetup:H.onSetupColumn("onAny")}),Oe("tablecutcolumn",{text:"Cut column",icon:"cut-column",command:"mceTableCutCol",onSetup:H.onSetupColumn("onAny")}),Oe("tablecopycolumn",{text:"Copy column",icon:"duplicate-column",command:"mceTableCopyCol",onSetup:H.onSetupColumn("onAny")}),Oe("tablepastecolumnbefore",{text:"Paste column before",icon:"paste-column-before",command:"mceTablePasteColBefore",onSetup:H.onSetupPasteableColumn(Tt,"onFirst")}),Oe("tablepastecolumnafter",{text:"Paste column after",icon:"paste-column-after",command:"mceTablePasteColAfter",onSetup:H.onSetupPasteableColumn(Tt,"onLast")})],Zo=[Oe("tablecellprops",{text:"Cell properties",icon:"table-cell-properties",command:"mceTableCellProps",onSetup:H.onSetupCellOrRow}),Oe("tablemergecells",{text:"Merge cells",icon:"table-merge-cells",command:"mceTableMergeCells",onSetup:H.onSetupMergeable}),Oe("tablesplitcells",{text:"Split cell",icon:"table-split-cells",command:"mceTableSplitCells",onSetup:H.onSetupUnmergeable})];cd(R)?R.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"inserttable",onAction:on}],onSetup:El(R)}):R.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:me("mceInsertTableDialog"),onSetup:El(R)}),R.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:me("mceInsertTableDialog"),onSetup:El(R)}),Oe("tableprops",{text:"Table properties",onSetup:H.onSetupTable,command:"mceTableProps"}),Oe("deletetable",{text:"Delete table",icon:"table-delete-table",onSetup:H.onSetupTable,command:"mceTableDelete"}),He(Nn,!0)&&R.ui.registry.addNestedMenuItem("row",{type:"nestedmenuitem",text:"Row",getSubmenuItems:ee("tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter")}),He(ao,!0)&&R.ui.registry.addNestedMenuItem("column",{type:"nestedmenuitem",text:"Column",getSubmenuItems:ee("tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter")}),He(Zo,!0)&&R.ui.registry.addNestedMenuItem("cell",{type:"nestedmenuitem",text:"Cell",getSubmenuItems:ee("tablecellprops tablemergecells tablesplitcells")}),R.ui.registry.addContextMenu("table",{update:()=>(H.resetTargets(),H.targets().fold(ee(""),sr=>fn(sr.element)==="caption"?"tableprops deletetable":"cell row column | advtablesort | tableprops deletetable"))});const es=Dr(uu(R));es.length!==0&&R.queryCommandSupported("mceTableToggleClass")&&R.ui.registry.addNestedMenuItem("tableclass",{icon:"table-classes",text:"Table styles",getSubmenuItems:()=>Rf(R,es,"tableclass",sr=>R.execCommand("mceTableToggleClass",!1,sr)),onSetup:H.onSetupTable});const lr=Dr(Di(R));lr.length!==0&&R.queryCommandSupported("mceTableCellToggleClass")&&R.ui.registry.addNestedMenuItem("tablecellclass",{icon:"table-cell-classes",text:"Cell styles",getSubmenuItems:()=>Rf(R,lr,"tablecellclass",sr=>R.execCommand("mceTableCellToggleClass",!1,sr)),onSetup:H.onSetupCellOrRow}),R.queryCommandSupported("mceTableApplyCellStyle")&&(R.ui.registry.addNestedMenuItem("tablecellvalign",{icon:"vertical-align",text:"Vertical align",getSubmenuItems:()=>Rf(R,ic,"tablecellverticalalign",gd(R,"vertical-align")),onSetup:H.onSetupCellOrRow}),R.ui.registry.addNestedMenuItem("tablecellborderwidth",{icon:"border-width",text:"Border width",getSubmenuItems:()=>Rf(R,Gl(R),"tablecellborderwidth",gd(R,"border-width")),onSetup:H.onSetupCellOrRow}),R.ui.registry.addNestedMenuItem("tablecellborderstyle",{icon:"border-style",text:"Border style",getSubmenuItems:()=>Rf(R,wm(R),"tablecellborderstyle",gd(R,"border-style")),onSetup:H.onSetupCellOrRow}),R.ui.registry.addNestedMenuItem("tablecellbackgroundcolor",{icon:"cell-background-color",text:"Background color",getSubmenuItems:()=>il(R,Xd(R),"background-color"),onSetup:H.onSetupCellOrRow}),R.ui.registry.addNestedMenuItem("tablecellbordercolor",{icon:"cell-border-color",text:"Border color",getSubmenuItems:()=>il(R,yg(R),"border-color"),onSetup:H.onSetupCellOrRow})),ct("tablecaption",{icon:"table-caption",text:"Table caption",command:"mceTableToggleCaption",onSetup:H.onSetupTableWithCaption}),ct("tablerowheader",{text:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:bs(R),onSetup:H.onSetupTableRowHeaders}),ct("tablecolheader",{text:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:of(R),onSetup:H.onSetupTableRowHeaders})},pr=R=>{const H=Th(R);Ha(R),bi(R),ba(R,H),ei(R,H),Gr(R)};var Rm=()=>{o.add("table",pr)};Rm()})();(function(){const o=z=>{let U=z;return{get:()=>U,set:ee=>{U=ee}}};var a=tinymce.util.Tools.resolve("tinymce.PluginManager");const c=(z,U)=>{z.dispatch("VisualBlocks",{state:U})},d=(z,U,q)=>{z.dom.toggleClass(z.getBody(),"mce-visualblocks"),q.set(!q.get()),c(z,q.get())},g=(z,U,q)=>{z.addCommand("mceVisualBlocks",()=>{d(z,U,q)})},p=z=>U=>U.options.get(z),y=z=>{const U=z.options.register;U("visualblocks_default_state",{processor:"boolean",default:!1})},x=p("visualblocks_default_state"),T=(z,U,q)=>{z.on("PreviewFormats AfterPreviewFormats",Q=>{q.get()&&z.dom.toggleClass(z.getBody(),"mce-visualblocks",Q.type==="afterpreviewformats")}),z.on("init",()=>{x(z)&&d(z,U,q)})},A=(z,U)=>q=>{q.setActive(U.get());const Q=ee=>q.setActive(ee.state);return z.on("VisualBlocks",Q),()=>z.off("VisualBlocks",Q)},M=(z,U)=>{const q=()=>z.execCommand("mceVisualBlocks");z.ui.registry.addToggleButton("visualblocks",{icon:"visualblocks",tooltip:"Show blocks",onAction:q,onSetup:A(z,U),context:"any"}),z.ui.registry.addToggleMenuItem("visualblocks",{text:"Show blocks",icon:"visualblocks",onAction:q,onSetup:A(z,U),context:"any"})};var P=()=>{a.add("visualblocks",(z,U)=>{y(z);const q=o(!1);g(z,U,q),M(z,q),T(z,U,q)})};P()})();(function(){const o=_t=>{let Ht=_t;return{get:()=>Ht,set:Ro=>{Ht=Ro}}};var a=tinymce.util.Tools.resolve("tinymce.PluginManager");const c=_t=>({isEnabled:()=>_t.get()}),d=(_t,Ht)=>_t.dispatch("VisualChars",{state:Ht}),g=(_t,Ht,Bn)=>{var ro;return Bn(_t,Ht.prototype)?!0:((ro=_t.constructor)===null||ro===void 0?void 0:ro.name)===Ht.name},p=_t=>{const Ht=typeof _t;return _t===null?"null":Ht==="object"&&Array.isArray(_t)?"array":Ht==="object"&&g(_t,String,(Bn,ro)=>ro.isPrototypeOf(Bn))?"string":Ht},y=_t=>Ht=>p(Ht)===_t,x=_t=>Ht=>typeof Ht===_t,T=_t=>Ht=>_t===Ht,A=y("string"),M=y("object"),P=T(null),z=x("boolean"),U=_t=>_t==null,q=_t=>!U(_t),Q=x("number");class ee{constructor(Ht,Bn){this.tag=Ht,this.value=Bn}static some(Ht){return new ee(!0,Ht)}static none(){return ee.singletonNone}fold(Ht,Bn){return this.tag?Bn(this.value):Ht()}isSome(){return this.tag}isNone(){return!this.tag}map(Ht){return this.tag?ee.some(Ht(this.value)):ee.none()}bind(Ht){return this.tag?Ht(this.value):ee.none()}exists(Ht){return this.tag&&Ht(this.value)}forall(Ht){return!this.tag||Ht(this.value)}filter(Ht){return!this.tag||Ht(this.value)?this:ee.none()}getOr(Ht){return this.tag?this.value:Ht}or(Ht){return this.tag?this:Ht}getOrThunk(Ht){return this.tag?this.value:Ht()}orThunk(Ht){return this.tag?this:Ht()}getOrDie(Ht){if(this.tag)return this.value;throw new Error(Ht??"Called getOrDie on None")}static from(Ht){return q(Ht)?ee.some(Ht):ee.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(Ht){this.tag&&Ht(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}ee.singletonNone=new ee(!1);const le=(_t,Ht)=>{const Bn=_t.length,ro=new Array(Bn);for(let Ro=0;Ro<Bn;Ro++){const is=_t[Ro];ro[Ro]=Ht(is,Ro)}return ro},ae=(_t,Ht)=>{for(let Bn=0,ro=_t.length;Bn<ro;Bn++){const Ro=_t[Bn];Ht(Ro,Bn)}},Z=(_t,Ht)=>{const Bn=[];for(let ro=0,Ro=_t.length;ro<Ro;ro++){const is=_t[ro];Ht(is,ro)&&Bn.push(is)}return Bn},Ae=Object.keys,mt=(_t,Ht)=>{const Bn=Ae(_t);for(let ro=0,Ro=Bn.length;ro<Ro;ro++){const is=Bn[ro],yr=_t[is];Ht(yr,is)}},Le=typeof window<"u"?window:Function("return this;")(),J=(_t,Ht)=>{let Bn=Ht??Le;for(let ro=0;ro<_t.length&&Bn!==void 0&&Bn!==null;++ro)Bn=Bn[_t[ro]];return Bn},Ge=(_t,Ht)=>{const Bn=_t.split(".");return J(Bn,Ht)},vt=(_t,Ht)=>Ge(_t,Ht),yt=(_t,Ht)=>{const Bn=vt(_t,Ht);if(Bn==null)throw new Error(_t+" not available on this browser");return Bn},De=Object.getPrototypeOf,ue=_t=>yt("HTMLElement",_t),Vt=_t=>{const Ht=Ge("ownerDocument.defaultView",_t);return M(_t)&&(ue(Ht).prototype.isPrototypeOf(_t)||/^HTML\w*Element$/.test(De(_t).constructor.name))},we=1,Ie=3,D=_t=>_t.dom.nodeType,Ue=_t=>_t.dom.nodeValue,be=_t=>Ht=>D(Ht)===_t,tt=_t=>nt(_t)&&Vt(_t.dom),nt=be(we),ge=be(Ie),We=(_t,Ht,Bn)=>{if(A(Bn)||z(Bn)||Q(Bn))_t.setAttribute(Ht,Bn+"");else throw console.error("Invalid call to Attribute.set. Key ",Ht,":: Value ",Bn,":: Element ",_t),new Error("Attribute value was not simple")},kt=(_t,Ht,Bn)=>{We(_t.dom,Ht,Bn)},He=(_t,Ht)=>{const Bn=_t.dom.getAttribute(Ht);return Bn===null?void 0:Bn},ht=(_t,Ht)=>{_t.dom.removeAttribute(Ht)},Me=(_t,Ht)=>{const Bn=He(_t,Ht);return Bn===void 0||Bn===""?[]:Bn.split(" ")},lt=(_t,Ht,Bn)=>{const Ro=Me(_t,Ht).concat([Bn]);return kt(_t,Ht,Ro.join(" ")),!0},te=(_t,Ht,Bn)=>{const ro=Z(Me(_t,Ht),Ro=>Ro!==Bn);return ro.length>0?kt(_t,Ht,ro.join(" ")):ht(_t,Ht),!1},gn=_t=>_t.dom.classList!==void 0,ft=_t=>Me(_t,"class"),St=(_t,Ht)=>lt(_t,"class",Ht),jt=(_t,Ht)=>te(_t,"class",Ht),Ct=(_t,Ht)=>{gn(_t)?_t.dom.classList.add(Ht):St(_t,Ht)},K=_t=>{(gn(_t)?_t.dom.classList:ft(_t)).length===0&&ht(_t,"class")},re=(_t,Ht)=>{gn(_t)?_t.dom.classList.remove(Ht):jt(_t,Ht),K(_t)},ce=(_t,Ht)=>{const ro=(Ht||document).createElement("div");if(ro.innerHTML=_t,!ro.hasChildNodes()||ro.childNodes.length>1){const Ro="HTML does not have a single root node";throw console.error(Ro,_t),new Error(Ro)}return Ne(ro.childNodes[0])},W=(_t,Ht)=>{const ro=(Ht||document).createElement(_t);return Ne(ro)},ve=(_t,Ht)=>{const ro=(Ht||document).createTextNode(_t);return Ne(ro)},Ne=_t=>{if(_t==null)throw new Error("Node cannot be null or undefined");return{dom:_t}},ut={fromHtml:ce,fromTag:W,fromText:ve,fromDom:Ne,fromPoint:(_t,Ht,Bn)=>ee.from(_t.dom.elementFromPoint(Ht,Bn)).map(Ne)},je={" ":"nbsp","­":"shy"},pt=(_t,Ht)=>{let Bn="";return mt(_t,(ro,Ro)=>{Bn+=Ro}),new RegExp("["+Bn+"]",Ht?"g":"")},$t=_t=>{let Ht="";return mt(_t,Bn=>{Ht&&(Ht+=","),Ht+="span.mce-"+Bn}),Ht},hn=pt(je),Et=pt(je,!0),It=$t(je),dn="mce-nbsp",_n=_t=>_t.dom.contentEditable,So=_t=>'<span data-mce-bogus="1" class="mce-'+je[_t]+'">'+_t+"</span>",Jn=_t=>_t.nodeName.toLowerCase()==="span"&&_t.classList.contains("mce-nbsp-wrap"),Ot=_t=>{const Ht=Ue(_t);return ge(_t)&&A(Ht)&&hn.test(Ht)},rn=_t=>tt(_t)&&_n(_t)==="false",an=(_t,Ht)=>{if(tt(_t)&&!Jn(_t.dom)){const Bn=_n(_t);if(Bn==="true")return!0;if(Bn==="false")return!1}return Ht},On=(_t,Ht,Bn)=>{let ro=[];const Ro=_t.dom,is=le(Ro.childNodes,ut.fromDom),yr=wr=>Jn(wr.dom)||!rn(wr);return ae(is,wr=>{Bn&&yr(wr)&&Ht(wr)&&(ro=ro.concat([wr])),ro=ro.concat(On(wr,Ht,an(wr,Bn)))}),ro},_o=(_t,Ht)=>{for(;_t.parentNode;){if(_t.parentNode===Ht)return Ht;_t=_t.parentNode}},Mo=_t=>_t.replace(Et,So),ws=(_t,Ht)=>{const Bn=_t.dom,ro=On(ut.fromDom(Ht),Ot,_t.dom.isEditable(Ht));ae(ro,Ro=>{var is;const yr=Ro.dom.parentNode;if(Jn(yr))Ct(ut.fromDom(yr),dn);else{const wr=Mo(Bn.encode((is=Ue(Ro))!==null&&is!==void 0?is:"")),ar=Bn.create("div",{},wr);let Xe;for(;Xe=ar.lastChild;)Bn.insertAfter(Xe,Ro.dom);_t.dom.remove(Ro.dom)}})},vo=(_t,Ht)=>{const Bn=_t.dom.select(It,Ht);ae(Bn,ro=>{Jn(ro)?re(ut.fromDom(ro),dn):_t.dom.remove(ro,!0)})},Us=_t=>{const Ht=_t.getBody(),Bn=_t.selection.getBookmark();let ro=_o(_t.selection.getNode(),Ht);ro=ro!==void 0?ro:Ht,vo(_t,ro),ws(_t,ro),_t.selection.moveToBookmark(Bn)},fn=(_t,Ht)=>{d(_t,Ht.get());const Bn=_t.getBody();Ht.get()===!0?ws(_t,Bn):vo(_t,Bn)},Vo=(_t,Ht)=>{Ht.set(!Ht.get());const Bn=_t.selection.getBookmark();fn(_t,Ht),_t.selection.moveToBookmark(Bn)},tr=(_t,Ht)=>{_t.addCommand("mceVisualChars",()=>{Vo(_t,Ht)})},rr=_t=>Ht=>Ht.options.get(_t),Pr=_t=>{const Ht=_t.options.register;Ht("visualchars_default_state",{processor:"boolean",default:!1})},Br=rr("visualchars_default_state"),Ts=(_t,Ht)=>{_t.on("init",()=>{fn(_t,Ht)})},Ar=(_t,Ht)=>{let Bn=null;return{cancel:()=>{P(Bn)||(clearTimeout(Bn),Bn=null)},throttle:(...is)=>{P(Bn)&&(Bn=setTimeout(()=>{Bn=null,_t.apply(null,is)},Ht))}}},Xr=(_t,Ht)=>{const Bn=Ar(()=>{Us(_t)},300);_t.on("keydown",ro=>{Ht.get()===!0&&(ro.keyCode===13?Us(_t):Bn.throttle())}),_t.on("remove",Bn.cancel)},xs=(_t,Ht)=>Bn=>{Bn.setActive(Ht.get());const ro=Ro=>Bn.setActive(Ro.state);return _t.on("VisualChars",ro),()=>_t.off("VisualChars",ro)},lo=(_t,Ht)=>{const Bn=()=>_t.execCommand("mceVisualChars");_t.ui.registry.addToggleButton("visualchars",{tooltip:"Show invisible characters",icon:"visualchars",onAction:Bn,onSetup:xs(_t,Ht),context:"any"}),_t.ui.registry.addToggleMenuItem("visualchars",{text:"Show invisible characters",icon:"visualchars",onAction:Bn,onSetup:xs(_t,Ht),context:"any"})};var Bs=()=>{a.add("visualchars",_t=>{Pr(_t);const Ht=o(Br(_t));return tr(_t,Ht),lo(_t,Ht),Xr(_t,Ht),Ts(_t,Ht),c(Ht)})};Bs()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const c=(K=>re=>K===re)(null),d=K=>K,g=(K,re)=>{const ce=K.length,W=new Array(ce);for(let ve=0;ve<ce;ve++){const Ne=K[ve];W[ve]=re(Ne,ve)}return W},y={aletter:"[A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-׳ؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆༀཀ-ཇཉ-ཬྈ-ྌႠ-Ⴥა-ჺჼᄀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᨀ-ᨖᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᯀ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⒶ-ⓩⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〻〼ㄅ-ㄭㄱ-ㆎㆠ-ㆺꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐꞑꞠ-ꞩꟺ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zᅠ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]",midnumlet:"[-'\\.‘’․﹒'.]",midletter:"[:··״‧︓﹕:]",midnum:"[±+*/,;;։،؍٬߸⁄︐︔﹐﹔,;]",numeric:"[0-9٠-٩٫۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹]",cr:"\\r",lf:"\\n",newline:"[\v\f…\u2028\u2029]",extend:"[̀-ͯ҃-҉֑-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ऀ-ःऺ-़ा-ॏ॑-ॗॢॣঁ-ঃ়া-ৄেৈো-্ৗৢৣਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑੰੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕౖౢౣಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣംഃാ-ൄെ-ൈൊ-്ൗൢൣංඃ්ා-ුූෘ-ෟෲෳัิ-ฺ็-๎ັິ-ູົຼ່-ໍ༹༘༙༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈᧉᨗ-ᨛᩕ-ᩞ᩠-᩿᩼ᬀ-ᬄ᬴-᭄᭫-᭳ᮀ-ᮂᮡ-᯦᮪-᯳ᰤ-᰷᳐-᳔᳒-᳨᳭ᳲ᷀-ᷦ᷼-᷿‌‍⃐-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꙯-꙲꙼꙽꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣠-꣱ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀ꨩ-ꨶꩃꩌꩍꩻꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꯣ-ꯪ꯬꯭ﬞ︀-️︠-゙゚︦]",format:"[­؀-؃۝܏឴឵‎‏‪-‮⁠-⁤-\uFEFF-]",katakana:"[〱-〵゛゜゠-ヺー-ヿㇰ-ㇿ㋐-㋾㌀-㍗ヲ-ン]",extendnumlet:"[=_‿⁀⁔︳︴﹍-﹏_∀-⋿<>]",punctuation:"[~№|!-*+-\\/:;?@\\[-`{}¡«·»¿;·՚-՟։֊־׀׃׆׳״؉؊،؍؛؞؟٪-٭۔܀-܍߷-߹࠰-࠾࡞।॥॰෴๏๚๛༄-༒༺-༽྅࿐-࿔࿙࿚၊-၏჻፡-፨᐀᙭᙮᚛᚜᛫-᛭᜵᜶។-៖៘-៚᠀-᠊᥄᥅᨞᨟᪠-᪦᪨-᪭᭚-᭠᯼-᯿᰻-᰿᱾᱿᳓‐-‧‰-⁃⁅-⁑⁓-⁞⁽⁾₍₎〈〉❨-❵⟅⟆⟦-⟯⦃-⦘⧘-⧛⧼⧽⳹-⳼⳾⳿⵰⸀-⸮⸰⸱、-〃〈-】〔-〟〰〽゠・꓾꓿꘍-꘏꙳꙾꛲-꛷꡴-꡷꣎꣏꣸-꣺꤮꤯꥟꧁-꧍꧞꧟꩜-꩟꫞꫟꯫﴾﴿︐-︙︰-﹒﹔-﹡﹣﹨﹪﹫!-#%-*,-/:;?@[-]_{}⦅-・]"},x={ALETTER:0,MIDNUMLET:1,MIDLETTER:2,MIDNUM:3,NUMERIC:4,CR:5,LF:6,NEWLINE:7,EXTEND:8,FORMAT:9,KATAKANA:10,EXTENDNUMLET:11,AT:12,OTHER:13},T=[new RegExp(y.aletter),new RegExp(y.midnumlet),new RegExp(y.midletter),new RegExp(y.midnum),new RegExp(y.numeric),new RegExp(y.cr),new RegExp(y.lf),new RegExp(y.newline),new RegExp(y.extend),new RegExp(y.format),new RegExp(y.katakana),new RegExp(y.extendnumlet),new RegExp("@")],A="",M=new RegExp("^"+y.punctuation+"$"),P=/^\s+$/,z=T,U=x.OTHER,q=K=>{let re=U;const ce=z.length;for(let W=0;W<ce;++W){const ve=z[W];if(ve&&ve.test(K)){re=W;break}}return re},Q=K=>{const re={};return ce=>{if(re[ce])return re[ce];{const W=K(ce);return re[ce]=W,W}}},ee=K=>{const re=Q(q);return g(K,re)},le=(K,re)=>{const ce=K[re],W=K[re+1];if(re<0||re>K.length-1&&re!==0||ce===x.ALETTER&&W===x.ALETTER)return!1;const ve=K[re+2];if(ce===x.ALETTER&&(W===x.MIDLETTER||W===x.MIDNUMLET||W===x.AT)&&ve===x.ALETTER)return!1;const Ne=K[re-1];return(ce===x.MIDLETTER||ce===x.MIDNUMLET||W===x.AT)&&W===x.ALETTER&&Ne===x.ALETTER||(ce===x.NUMERIC||ce===x.ALETTER)&&(W===x.NUMERIC||W===x.ALETTER)||(ce===x.MIDNUM||ce===x.MIDNUMLET)&&W===x.NUMERIC&&Ne===x.NUMERIC||ce===x.NUMERIC&&(W===x.MIDNUM||W===x.MIDNUMLET)&&ve===x.NUMERIC||(ce===x.EXTEND||ce===x.FORMAT)&&(W===x.ALETTER||W===x.NUMERIC||W===x.KATAKANA||W===x.EXTEND||W===x.FORMAT)||(W===x.EXTEND||W===x.FORMAT&&(ve===x.ALETTER||ve===x.NUMERIC||ve===x.KATAKANA||ve===x.EXTEND||ve===x.FORMAT))&&(ce===x.ALETTER||ce===x.NUMERIC||ce===x.KATAKANA||ce===x.EXTEND||ce===x.FORMAT)||ce===x.CR&&W===x.LF?!1:ce===x.NEWLINE||ce===x.CR||ce===x.LF||W===x.NEWLINE||W===x.CR||W===x.LF?!0:!(ce===x.KATAKANA&&W===x.KATAKANA||W===x.EXTENDNUMLET&&(ce===x.ALETTER||ce===x.NUMERIC||ce===x.KATAKANA||ce===x.EXTENDNUMLET)||ce===x.EXTENDNUMLET&&(W===x.ALETTER||W===x.NUMERIC||W===x.KATAKANA)||ce===x.AT)},ae=A,Z=P,Ae=M,mt=K=>K==="http"||K==="https",Le=(K,re)=>{let ce;for(ce=re;ce<K.length&&!Z.test(K[ce]);ce++);return ce},J=(K,re)=>{const ce=Le(K,re+1);return K.slice(re+1,ce).join(ae).substr(0,3)==="://"?ce:re},Ge=(K,re,ce,W)=>{const ve=[],Ne=[];let Pe=[];for(let ut=0;ut<ce.length;++ut)if(Pe.push(K[ut]),le(ce,ut)){const je=re[ut];if((W.includeWhitespace||!Z.test(je))&&(W.includePunctuation||!Ae.test(je))){const pt=ut-Pe.length+1,$t=ut+1,hn=re.slice(pt,$t).join(ae);if(mt(hn)){const Et=J(re,ut),It=K.slice($t,Et);Array.prototype.push.apply(Pe,It),ut=Et}re[ut+1]==="."&&/^([a-zA-Z]\.)+$/.test(hn+".")?(Pe.push(K[ut+1]),Ne.push({start:pt,end:$t+1})):Ne.push({start:pt,end:$t}),ve.push(Pe)}Pe=[]}return{words:ve,indices:Ne}},vt=()=>({includeWhitespace:!1,includePunctuation:!1}),yt=(K,re,ce)=>{ce={...vt(),...ce};const W=g(K,re),ve=ee(W);return Ge(K,W,ve,ce)},ue=(K,re,ce)=>yt(K,re,ce).words,Vt=K=>K.replace(/\uFEFF/g,"");var we=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker");const Ie=(K,re)=>{const ce=re.getBlockElements(),W=re.getVoidElements(),ve=pt=>ce[pt.nodeName]||W[pt.nodeName],Ne=[];let Pe="";const ut=new we(K,K);let je;for(;je=ut.next();)je.nodeType===3?Pe+=Vt(je.data):ve(je)&&Pe.length&&(Ne.push(Pe),Pe="");return Pe.length&&Ne.push(Pe),Ne},D=K=>K.replace(/\u200B/g,""),Ue=K=>K.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length,be=(K,re)=>{const ce=D(Ie(K,re).join(`
112
- `));return ue(ce.split(""),d).length},tt=(K,re)=>{const ce=Ie(K,re).join("");return Ue(ce)},nt=(K,re)=>{const ce=Ie(K,re).join("").replace(/\s/g,"");return Ue(ce)},ge=(K,re)=>()=>re(K.getBody(),K.schema),We=(K,re)=>()=>re(K.selection.getRng().cloneContents(),K.schema),kt=K=>ge(K,be),He=K=>({body:{getWordCount:kt(K),getCharacterCount:ge(K,tt),getCharacterCountWithoutSpaces:ge(K,nt)},selection:{getWordCount:We(K,be),getCharacterCount:We(K,tt),getCharacterCountWithoutSpaces:We(K,nt)},getCount:kt(K)}),ht=(K,re)=>{K.windowManager.open({title:"Word Count",body:{type:"panel",items:[{type:"table",header:["Count","Document","Selection"],cells:[["Words",String(re.body.getWordCount()),String(re.selection.getWordCount())],["Characters (no spaces)",String(re.body.getCharacterCountWithoutSpaces()),String(re.selection.getCharacterCountWithoutSpaces())],["Characters",String(re.body.getCharacterCount()),String(re.selection.getCharacterCount())]]}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}]})},Me=(K,re)=>{K.addCommand("mceWordCount",()=>ht(K,re))},lt=(K,re)=>{let ce=null;return{cancel:()=>{c(ce)||(clearTimeout(ce),ce=null)},throttle:(...Ne)=>{c(ce)&&(ce=setTimeout(()=>{ce=null,K.apply(null,Ne)},re))}}};var te=tinymce.util.Tools.resolve("tinymce.util.Delay");const gn=(K,re)=>{K.dispatch("wordCountUpdate",{wordCount:{words:re.body.getWordCount(),characters:re.body.getCharacterCount(),charactersWithoutSpaces:re.body.getCharacterCountWithoutSpaces()}})},ft=(K,re)=>{gn(K,re)},St=(K,re,ce)=>{const W=lt(()=>ft(K,re),ce);K.on("init",()=>{ft(K,re),te.setEditorTimeout(K,()=>{K.on("SetContent BeforeAddUndo Undo Redo ViewUpdate keyup",W.throttle)},0),K.on("remove",W.cancel)})},jt=K=>{const re=()=>K.execCommand("mceWordCount");K.ui.registry.addButton("wordcount",{tooltip:"Word count",icon:"character-count",onAction:re,context:"any"}),K.ui.registry.addMenuItem("wordcount",{text:"Word count",icon:"character-count",onAction:re,context:"any"})};var Ct=(K=300)=>{o.add("wordcount",re=>{const ce=He(re);return Me(re,ce),jt(re),St(re,ce,K),ce})};Ct()})();const gAe=o=>/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument/i.test(o)||/class="OutlineElement/.test(o)||/id="?docs\-internal\-guid\-/.test(o),hAe=(o,a="wps_office")=>{const c=o.split(","),d=c[0].match(/:(.*?);/)[1],g=atob(c[1]);let p=g.length;const y=new Uint8Array(p);for(;p--;)y[p]=g.charCodeAt(p);return new File([y],a,{type:d})},pAe=o=>btoa(o.match(/\w{2}/g).map(a=>String.fromCharCode(parseInt(a,16))).join(""));function bAe(o){if(!o)return[];let a=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,c=new RegExp(`(?:(${a.source}))([\\da-fA-F\\s]+)\\}`,"g"),d=o.match(c);console.log("images",d);const g=[];if(d||(a=/{\\pict[\s\S]+?(\\pngblip-?\d+)?(\\wmetafile8-?\d+)?{\\\*\\blipuid\s?[\da-fA-F]+[\s}]*?/,c=new RegExp(`(?:(${a.source}))([\\da-fA-F\\s]+)\\}`,"g"),d=o.match(c)),d)for(const p of d){let y=!1;if(p.includes("\\pngblip")?y="image/png":p.includes("\\jpegblip")&&(y="image/jpeg"),y){const x=p.replace(a,"").replace(/[^\da-fA-F]/g,""),T=`data:${y};base64,${pAe(x)}`;g.push({base64:T,file:hAe(T)})}}return g}const vAe=(o,a)=>{if(!a)return o;try{const d=new DOMParser().parseFromString(o,"text/html"),g=d.querySelectorAll("img"),y=(a.clipboardData||window.Clipboard).getData("text/rtf"),x=bAe(y);return g.forEach((T,A)=>{var P;const M=T.getAttribute("src");if(M&&M.startsWith("file:")&&(P=x==null?void 0:x[A])!=null&&P.base64){const z=x[A].base64;T.setAttribute("src",z)}}),d.body.innerHTML}catch{return o}},yAe=o=>{const a=atob(o.split(",")[1]),c=o.split(",")[0].split(":")[1].split(";")[0],d=new ArrayBuffer(a.length),g=new Uint8Array(d);for(let p=0;p<a.length;p++)g[p]=a.charCodeAt(p);return new Blob([d],{type:c})},wAe=async o=>{try{const a=yAe(o),c=new FormData;c.append("files",a,"image.png");const g=await(await fetch("/api/ajax/uploaddoc",{method:"POST",body:c})).json();if(g.status===1)return g.file_url;throw new Error(g.message)}catch(a){throw a}},CAe=async o=>{const c=new DOMParser().parseFromString(o,"text/html"),d=c.getElementsByTagName("img"),g=[],p=3;for(let y=0;y<d.length;y++){const x=d[y],T=x.getAttribute("src");T&&T.startsWith("data:image")&&(g.push({img:x,src:T,width:x.getAttribute("width"),height:x.getAttribute("height")}),g[g.length-1].width&&x.setAttribute("width",g[g.length-1].width),g[g.length-1].height&&x.setAttribute("height",g[g.length-1].height))}for(let y=0;y<g.length;y+=p){const T=g.slice(y,y+p).map(async A=>{try{const M=await wAe(A.src);A.img.setAttribute("src",M)}catch{A.img.remove()}});await Promise.all(T)}return c.body.innerHTML},SAe=o=>{o.querySelectorAll("td").forEach(c=>{const d=c.getAttribute("width"),g=c.getAttribute("style")||"";d==="0"&&g.includes("border:none")&&c.remove()})},xAe=o=>{o.querySelectorAll("table").forEach(c=>{c.style.maxWidth="100%"})},EAe=o=>{o.querySelectorAll("table").forEach(c=>{const d=c.querySelectorAll("td");let g=!1,p="";for(const y of d){const x=y.getAttribute("style")||"",T=x.match(/border(?:-(?:right|left|top|bottom))?(?:-style)?:\s*[0-9.]*(?:pt|px)?\s*double\s*(?:windowtext|[#a-zA-Z0-9]+)?/i)||x.match(/border(?:-(?:right|left|top|bottom))?:\s*[0-9.]*(?:pt|px)?\s*double\s*(?:windowtext|[#a-zA-Z0-9]+)?/i);(T?T[0]:"").includes("double")&&(g=!0,T&&(p=T[0].replace(/^border(?:-(?:right|left|top|bottom))?(?:-style)?:\s*/,""),y.style.borderTop=p,y.style.borderRight=p,y.style.borderBottom=p,y.style.borderLeft=p))}g&&p&&(c.style.borderCollapse="separate",c.style.borderSpacing="2px",c.style.border=p)})},_Ae=o=>{o.querySelectorAll("table").forEach(c=>{c.querySelectorAll("td[rowspan]").forEach(g=>{const x=((g.getAttribute("style")||"").match(/border-[^:]+:[^;]+(?:solid|double)[^;]+/g)||[]).find(T=>!T.includes("none"));if(x){const T=x.split(":")[1].trim();g.style.borderBottom=T}})})},TAe=o=>{o.querySelectorAll('[style*="mso-"]').forEach(c=>{const g=(c.getAttribute("style")||"").replace(/mso-[^:]+:[^;]+;/g,"");c.setAttribute("style",g)})},kAe=o=>{o.querySelectorAll('[style*="tab-stops"]').forEach(c=>{const g=(c.getAttribute("style")||"").replace(/tab-stops:[^;]+;/g,"");c.setAttribute("style",g)})},AAe=o=>{o=o.replace(/<a(?!.*?href=)[^>]*>([\s\S]*?)<\/a>/gi,"$1");const c=new DOMParser().parseFromString(o,"text/html");return SAe(c),xAe(c),EAe(c),_Ae(c),TAe(c),kAe(c),o=c.body.innerHTML,o};CH.PluginManager.add("pasteprocess",o=>(o.on("paste",a=>{if(a.clipboardData){const c=a.clipboardData.getData("text/html")||a.clipboardData.getData("text");if(gAe(c)){a.preventDefault();const d=o.windowManager.open({title:"处理中",body:{type:"panel",items:[{type:"htmlpanel",html:'<div style="text-align: center; padding: 20px;">正在处理Word内容,请稍候...</div>'}]},buttons:[]}),g=AAe(c),p=vAe(g,a);CAe(p).then(y=>{o.insertContent(y),d.close()})}}}),{}));let NV="A4";const Iee={A3:{width:297,height:420},A4:{width:210,height:297},A5:{width:148,height:210},B3:{width:353,height:500},B4:{width:257,height:364},B5:{width:176,height:250}},OAe=Object.keys(Iee).map(o=>`pagesize${o}`).join(" ");CH.PluginManager.add("pagesize",o=>{const a=o.options.register;a("pagesize",{processor:"string",default:"A4"}),NV=(g=>p=>p.options.get(g))("pagesize")(o);const d=g=>{const p=Iee[g];if(p){const y=(window.devicePixelRatio||1)*96,x=p.width*y/25.4;o!=null&&o.container&&(o.container.style.minWidth=`${x}px`);const T=o.contentAreaContainer.querySelector("iframe");T&&(T.style.width=`${x}px`),o.fire("pagesizechange",{size:g})}};return Object.keys(Iee).forEach(g=>{o.ui.registry.addToggleMenuItem(`pagesize${g}`,{text:g,onAction:()=>{NV=g,d(g)},onSetup:p=>(p.setActive(NV===g),()=>{})})}),o.on("init",()=>{d(NV)}),{}});const NAe=["accordion","advlist","anchor","autolink","autosave","charmap","directionality","importcss","insertdatetime","lists","image","media","pagebreak","preview","save","searchreplace","table","fullscreen","wordcount","pasteprocess","pagesize"],$Ae="undo redo | blocks bold italic forecolor removeformat alignleft aligncenter alignright alignjustify outdent indent pagebreakfullscreen preview",DAe={license_key:"gpl",skin:!1,content_css:["./content.css","./reset.css"],promotion:!1,menu:{pagesize:{title:"页面大小",items:OAe}},menubar:"file edit insert table tools help pagesize",cleanup:!0,branding:!1,language:"zh_CN",plugins:NAe,toolbar:$Ae,fontsize_formats:"12px 14px 16px 18px 20px 22px 24px 28px 32px 36px 48px 56px 72px",font_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;",lineheight_formats:"0.5 0.8 1 1.2 1.5 1.75 2 2.5 3 4 5",elementpath:!1,paste_data_images:!0,object_resizing:!0,pagesize:"A4",images_upload_handler:o=>new Promise((a,c)=>{const d=new FormData;d.append("files",o.blob(),o.filename()),fetch("/api/ajax/uploaddoc",{method:"POST",body:d}).then(g=>g.json()).then(g=>{g.status===1?a(g.file_url):c(`上传失败: ${g.message}`)}).catch(g=>{c(`上传出错: ${g.message}`)})})},MAe={name:"ProEditor",components:{Editor:fAe},props:{modelValue:{type:String,default:""},pagesize:{type:String,default:"A4"},hasPagesize:{type:Boolean,default:!1},placeholder:{type:String,default:"请输入内容"},width:{type:[Number,String],default:"100%"},height:{type:Number,default:400}},setup(o,{emit:a}){const c=w.reactive({myInit:g(DAe),contentValue:o.modelValue,timeout:null});w.onMounted(()=>{CH.init({license_key:"gpl"}),CH.activeEditor.on("pagesizechange",p=>{a("update:pagesize",p.size)})}),w.watch(()=>c.contentValue,()=>{d(()=>{a("update:modelValue",c.contentValue)})}),w.watch(()=>o.modelValue,p=>{p&&p!==c.contentValue&&(c.contentValue=p)});function d(p,y=400){c.timeout!==null&&clearTimeout(c.timeout),c.timeout=setTimeout(p,y)}function g(p){o!=null&&o.height&&(p.height=o.height),o!=null&&o.width&&(p.width=o.width);const{placeholder:y,pagesize:x}=o;return p={...p,placeholder:y,...o.hasPagesize&&{menu:{...p.menu,pagesize:p.menu.pagesize},menubar:p.menubar.includes("pagesize")?p.menubar:`${p.menubar} pagesize`,pagesize:x},...!o.hasPagesize&&{menu:Object.fromEntries(Object.entries(p.menu).filter(([T])=>T!=="pagesize")),menubar:p.menubar.replace(/pagesize/g,"").trim(),pagesize:""}},p}return{...w.toRefs(c),customer:g,debounce:d}}},RAe={class:"my-tinymce"};function IAe(o,a,c,d,g,p){const y=w.resolveComponent("Editor");return w.openBlock(),w.createElementBlock("div",RAe,[w.createVNode(y,{modelValue:o.contentValue,"onUpdate:modelValue":a[0]||(a[0]=x=>o.contentValue=x),init:o.myInit},null,8,["modelValue","init"])])}const Mle=cu(MAe,[["render",IAe]]),PAe={name:"ShadowDomWrap",setup(o,{emit:a,expose:c}){const d=w.ref(null),g=w.ref(),p=w.ref(!1),y=T=>{if(!d.value)return;const A=d.value.contains(T.target);!A&&p.value?(p.value=!1,a("onBlur")):A&&!p.value&&(p.value=!0)},x=T=>{T.stopPropagation(),p.value||(p.value=!0,a("onFocus"))};return w.onMounted(()=>{var M,P,z;g.value=(M=d.value)==null?void 0:M.attachShadow({mode:"open"}),document.addEventListener("click",y);const T=document.createElement("link");T.rel="stylesheet",T.href=`${location==null?void 0:location.origin}/css/index.min.css`,(P=g.value)==null||P.appendChild(T);const A=document.createElement("link");A.rel="stylesheet",A.href=`${location==null?void 0:location.origin}/css/reset.css`,(z=g.value)==null||z.appendChild(A)}),w.onUnmounted(()=>{document.removeEventListener("click",y)}),c({focus:()=>{p.value=!0}}),{shadowHost:d,shadowRoot:g,handleClick:x}}};function BAe(o,a,c,d,g,p){return w.openBlock(),w.createElementBlock("div",{ref:"shadowHost",class:"shadow-host",onClick:a[0]||(a[0]=w.withModifiers((...y)=>d.handleClick&&d.handleClick(...y),["stop"]))},[d.shadowRoot?(w.openBlock(),w.createBlock(w.Teleport,{key:0,to:d.shadowRoot},[w.renderSlot(o.$slots,"default")],8,["to"])):w.createCommentVNode("",!0)],512)}const Hte=cu(PAe,[["render",BAe]]),FAe=["innerHTML"],Rle=w.defineComponent({__name:"index",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const a=w.useModel(o,"modelValue");return(c,d)=>(w.openBlock(),w.createBlock(Hte,null,{default:w.withCtx(()=>[w.createElementVNode("div",{innerHTML:a.value},null,8,FAe)]),_:1}))}}),Ile=Symbol("nodesUI"),$f=()=>{const o=w.inject(Ile);if(!o)throw new Error("NodesUI context not found");return o};function zte(o){if(!o||!o.ownerDocument)return null;const a=[];for(let c=o;c&&c.nodeType===1;c=c.parentElement){let d=0;for(let y=c.previousSibling;y;y=y.previousSibling)y.nodeType===1&&y.nodeName===c.nodeName&&d++;const g=c.nodeName.toLowerCase(),p=d?`${g}:nth-child(${d+1})`:g;a.unshift(p)}return a.length?a.join(" > "):null}function LAe(o,a){if(!a)return null;try{return(a.shadowRoot||a).querySelector(`#${CSS.escape(o)}`)}catch(c){return console.error("nodePath query error:",c),null}}function Ple(o,a){if(!a)return null;try{return(a.shadowRoot||a).querySelector(o)}catch(c){return console.error("nodePath query error:",c),null}}const d4=o=>o!=null&&o.id?o==null?void 0:o.id:o.nodePath+(o!=null&&o.textNodeIndex?`-${o==null?void 0:o.textNodeIndex}`:"")+(o!=null&&o.startOffset?`-${o==null?void 0:o.startOffset}`:"")+(o!=null&&o.subNodeSort?`-${o==null?void 0:o.subNodeSort}`:""),VAe=(o,a,c)=>{var d,g;if(!jte(o)){const p=c==null?void 0:c.getRootNode(),y=(d=p==null?void 0:p.getSelection)==null?void 0:d.call(p),x=Ple(o.nodePath,c);if(y&&o.startOffset!==void 0&&a&&x){const T=document.createRange(),A=(o==null?void 0:o.textNodeIndex)||0,M=x.childNodes[A]||x,P=Math.min(o.startOffset,((g=M.textContent)==null?void 0:g.length)||0);T.setStart(M,P),T.setEnd(M,P);const z=document.createElement("span");z.classList.add("empty-text-node"),T.insertNode(z),T.insertNode(a),T.setStartAfter(a),T.collapse(!0),y.removeAllRanges(),y.addRange(T)}}},HAe=(o,a)=>{a!=null&&a.id&&(o.id=a==null?void 0:a.id),(a==null?void 0:a.nodePath)!==void 0&&o.setAttribute("data-nodePath",a.nodePath),(a==null?void 0:a.textNodeIndex)!==void 0&&a.textNodeIndex>=0&&o.setAttribute("data-textNodeIndex",a.textNodeIndex.toString()),a.startOffset!==void 0&&a.startOffset>=0&&o.setAttribute("data-startOffset",a.startOffset.toString()),(a==null?void 0:a.subNodeSort)!==void 0&&a.subNodeSort>=0&&o.setAttribute("data-subNodeSort",a.subNodeSort.toString()),(a==null?void 0:a.groupKey)!==void 0&&o.setAttribute("data-groupKey",a.groupKey)},zAe=o=>{const a=o.parentNode;if(!a)return-1;let c=0;for(let d=0;d<a.childNodes.length;d++){const g=a.childNodes[d];if(g===o)return c;c++,g.nodeType===Node.ELEMENT_NODE&&(g.classList.contains("node-item")&&(c-=2,c<0&&(c=0)),g.classList.contains("empty-text-node")&&(c-=1,c<0&&(c=0)))}return-1},UAe=o=>{let a=o.closest("TD"),c=o.closest(".node-item"),d=null;if(c?d=c:a&&a.classList.contains("node-item-td")&&(d=a),!d)return null;const g=d||o;let p=g==null?void 0:g.getAttribute("data-nodePath");if(p||(p=zte(g)),(g==null?void 0:g.getAttribute("selectable"))==="false")return null;let y={element:g,nodePath:p};const x=g==null?void 0:g.getAttribute("data-textNodeIndex");x&&(y.textNodeIndex=Number(x));const T=g==null?void 0:g.getAttribute("data-startOffset");T&&(y.startOffset=Number(T));const A=g==null?void 0:g.getAttribute("data-subNodeSort");A&&(y.subNodeSort=Number(A));const M=g==null?void 0:g.getAttribute("data-groupKey");M&&(y.groupKey=M);const P=g==null?void 0:g.getAttribute("id");return P&&(y.id=P),y},jAe=o=>a0e(o,a=>w.toValue(a.nodes).map(c=>({...c,color:a.color,activated:a==null?void 0:a.activated,dataGroupKey:a.id}))),Ute=(o,a)=>{const c=o.startsWith("#")?o.slice(1):o;let d,g,p;if(c.length===3)d=parseInt(c[0]+c[0],16),g=parseInt(c[1]+c[1],16),p=parseInt(c[2]+c[2],16);else if(c.length===6)d=parseInt(c.substring(0,2),16),g=parseInt(c.substring(2,4),16),p=parseInt(c.substring(4,6),16);else return console.warn("Invalid color format:",o),`rgba(0, 0, 0, ${a})`;return`rgba(${d}, ${g}, ${p}, ${a})`},WAe=o=>{const{element:a}=o;if(!a)return null;if(a.tagName.toLowerCase()!=="td")return{showTextType:"input"};const d=a.closest("tr"),g=Array.from(d.parentElement.children).indexOf(d),p=Array.from(d.children).indexOf(a),y=a.closest("table"),x=a.closest("body").querySelectorAll("table");return{showTextType:"cell",tableIndex:Array.from(x).indexOf(y)+1,colIndex:p,rowIndex:g}},ZAe=(o,a)=>{var g,p;let c=1;const d=(g=o==null?void 0:o.map(y=>a==null?void 0:a.find(x=>(x==null?void 0:x.id)===(y==null?void 0:y.id))))==null?void 0:g.filter(Boolean);return(d==null?void 0:d.length)>0?(p=d==null?void 0:d.map(x=>{const T=WAe(x);return T?(T==null?void 0:T.showTextType)==="input"?{...x,...T,inputIndex:c++}:{...x,...T}:null}))==null?void 0:p.filter(Boolean):[]};function GAe(o){if(!o||o.length===0)return[];const a=[...o].sort((g,p)=>g.rowIndex!==p.rowIndex?g.rowIndex-p.rowIndex:g.colIndex-p.colIndex),c=[],d=new Set;for(const g of a){if(d.has(g))continue;const p=[];let y=0,x=0;for(let T=g.colIndex;a.find(M=>M.rowIndex===g.rowIndex&&M.colIndex===T&&!d.has(M));T++)x++;if(x!==0){y=x;for(let T=g.rowIndex;;T++){let A=0;const M=[];for(let P=g.colIndex;P<g.colIndex+y;P++){const z=a.find(U=>U.rowIndex===T&&U.colIndex===P&&!d.has(U));if(z)A++,M.push(z);else break}if(A===y)p.push(...M);else break}p.length>0&&(c.push([...p]),p.forEach(T=>d.add(T)))}}return c}function qAe(o){if(!o||o.length===0)return{min:null,max:null};let a=o[0],c=o[0];for(const d of o)(d.colIndex<a.colIndex||d.colIndex===a.colIndex&&d.rowIndex<a.rowIndex)&&(a=d),(d.colIndex>c.colIndex||d.colIndex===c.colIndex&&d.rowIndex>c.rowIndex)&&(c=d);return{min:a,max:c}}const Ble=(o,a)=>{var A;const c=ZAe(o,a||[]),d=[],g=[];(A=w.toValue(c))==null||A.forEach(M=>{(M==null?void 0:M.showTextType)==="input"?d.push(M):g.push(M)});const p=l0e(g,"tableIndex"),y=Object.entries(p).map(([M,P])=>({tableIndex:Number(M),nodes:P})),x=xce(y==null?void 0:y.map(M=>GAe(M==null?void 0:M.nodes))),T=(x==null?void 0:x.map(M=>qAe(M)))||[];return[...d,...T]},x4=o=>{function a(c){let d="";for(;c>=0;)d=String.fromCharCode(65+c%26)+d,c=Math.floor(c/26)-1;return d}return(o==null?void 0:o.colIndex)>=0&&(o==null?void 0:o.rowIndex)>=0?`${a(o==null?void 0:o.colIndex)}${o==null?void 0:o.rowIndex}`:""},YAe=(o,a)=>{const c=Ble(o,a||[]);let d=[];return c==null||c.forEach(g=>{var p,y;(g==null?void 0:g.showTextType)==="input"?d.push(`填写${g==null?void 0:g.inputIndex}`):d.push(((p=g==null?void 0:g.min)==null?void 0:p.id)===((y=g==null?void 0:g.max)==null?void 0:y.id)?x4(g==null?void 0:g.min):`${x4(g==null?void 0:g.min)}:${x4(g==null?void 0:g.max)}`)}),d==null?void 0:d.join(",")},jte=o=>o.startOffset===void 0&&o.textNodeIndex===void 0,KAe={key:0},XAe={key:1,class:"td-node"},JAe=w.defineComponent({__name:"index",props:{node:{}},setup(o){const a=o,c=w.computed(()=>{var d,g;return((g=(d=a==null?void 0:a.node)==null?void 0:d.element)==null?void 0:g.TagName)==="TD"});return(d,g)=>{var p,y;return c.value?(w.openBlock(),w.createElementBlock("span",KAe,w.toDisplayString((p=a==null?void 0:a.node)==null?void 0:p.label),1)):(w.openBlock(),w.createElementBlock("span",XAe,w.toDisplayString((y=a==null?void 0:a.node)==null?void 0:y.label),1))}}}),Fle=Symbol("nodesEditor"),T0=()=>{const o=w.inject(Fle);if(!o)throw new Error("NodesEditor context not found");return o},pz=w.defineComponent({__name:"index",props:{node:{}},setup(o){const a=o,{currentNodes:c}=$f(),{nodes:d}=T0(),g=w.computed(()=>{var x;return(x=a.node)!=null&&x.id?d.value.some(T=>T.id===a.node.id):!1}),p=w.computed(()=>{var x;if(!((x=a.node)!=null&&x.element))return!1;try{return a.node.element.parentNode!==null}catch(T){return console.warn("Element validation failed:",T),!1}}),y=w.computed(()=>{var x;return(x=w.toValue(c))==null?void 0:x.find(T=>{var A;return(T==null?void 0:T.id)===((A=a==null?void 0:a.node)==null?void 0:A.id)})});return w.watch(()=>y,()=>{var T,A,M,P;const x=w.toValue(y);(T=a==null?void 0:a.node)!=null&&T.element&&(x?x!=null&&x.activated||(a.node.element.style.setProperty("--node-color",(x==null?void 0:x.color)||"#409eff"),a.node.element.style.setProperty("--node-bg-color",Ute((x==null?void 0:x.color)||"#409eff",.1)),a.node.element.setAttribute("data-dataGroupKey",x==null?void 0:x.dataGroupKey),a.node.element.setAttribute("selectable","false"),a.node.element.classList.add("activated")):((A=a.node.element)==null||A.removeAttribute("data-dataGroupKey"),(M=a.node.element)==null||M.removeAttribute("selectable"),(P=a.node.element)==null||P.classList.remove("activated")))},{immediate:!0,deep:!0}),(x,T)=>{var A;return(A=x.node)!=null&&A.element&&p.value&&g.value?(w.openBlock(),w.createBlock(w.Teleport,{key:0,to:x.node.element},[w.renderSlot(x.$slots,"default",{node:x.node},()=>[w.createVNode(JAe,{node:x.node},null,8,["node"])])],8,["to"])):w.createCommentVNode("",!0)}}});function QAe(){const o=w.ref(!1),a=d=>{d.key==="Control"&&(o.value=!0)},c=d=>{d.key==="Control"&&(o.value=!1)};return w.onMounted(()=>{window.addEventListener("keydown",a),window.addEventListener("keyup",c)}),w.onUnmounted(()=>{window.removeEventListener("keydown",a),window.removeEventListener("keyup",c)}),o}function Lle(){const{selectedNodes:o,setSelectedNodes:a,containerRef:c,renderNodes:d}=$f(),{editorId:g,nodes:p}=T0(),y=w.ref(!1),x=w.ref({x:0,y:0}),T=w.ref({x:0,y:0}),A=w.ref({left:0,top:0,width:0,height:0}),M=w.ref(null),P=Le=>{const J=Le.closest(".node-item-td")||Le.closest(".node-item");if(J!==null){let Ge=[];if(J.classList.contains("node-selected"))return;const vt=J.getAttribute("id");if(vt&&p.value){const yt=p.value.find(De=>De.id===vt);yt&&(Ge=[yt])}Ge=ae(Ge),a(Ge)}},z=Le=>{Le.button===2&&P(Le==null?void 0:Le.target),Le.button===0&&(y.value=!0,M.value&&(x.value={x:Le.pageX,y:Le.pageY},T.value={x:Le.pageX,y:Le.pageY},ee(Le),Z(),M.value.style.display="block",window.addEventListener("mousemove",U),window.addEventListener("mouseup",q)))},U=Hse(Le=>{y.value&&(T.value={x:Le.pageX,y:Le.pageY},Z())},16),q=Le=>{Le.button===0&&(y.value=!1,M.value&&(Z(),M.value.style.display="none",window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",q)))},Q=QAe(),ee=Le=>{var Ge,vt;let J=[];if(Le.button===0&&(Le!=null&&Le.target)){const yt=((Ge=Le==null?void 0:Le.target)==null?void 0:Ge.closest(".node-item-td"))||((vt=Le==null?void 0:Le.target)==null?void 0:vt.closest(".node-item"));if(yt!==null){const De=yt.getAttribute("id");if(De&&p.value){const ue=p.value.find(Vt=>Vt.id===De);ue&&(Q.value?o.value.some(Vt=>d4(Vt)===d4(ue))?J=o.value.filter(we=>d4(we)!==d4(ue)):J=[...o.value,ue]:ue&&(J=[ue]))}}J=ae(J),a(J)}},le=()=>{if(!c.value||!(A.value.width>3||A.value.height>3))return;let Le=[];const J={left:A.value.left,right:A.value.left+A.value.width,top:A.value.top,bottom:A.value.top+A.value.height};if(c.value.querySelectorAll("*").forEach(vt=>{const yt=vt.getBoundingClientRect(),De=window.scrollX||window.pageXOffset,ue=window.scrollY||window.pageYOffset,Vt={left:yt.left+De,right:yt.right+De,top:yt.top+ue,bottom:yt.bottom+ue};if(Vt.right>J.left&&Vt.left<J.right&&Vt.bottom>J.top&&Vt.top<J.bottom){const we=vt.getAttribute("id");if(we&&p.value){const Ie=p.value.find(D=>D.id===we);Ie&&(Le=[...Le,Ie])}}}),Le=ae(Le),console.log(Le),Q.value){const vt=new Set(o.value.map(De=>d4(De))),yt=Le.filter(De=>!vt.has(d4(De)));a([...o.value,...yt])}else a(Le)},ae=Le=>{var Ge;let J=[];if(Le.length>0){const vt=(Ge=Le.map(we=>we==null?void 0:we.groupKey))==null?void 0:Ge.filter(Boolean),yt=new Set(vt),De=Array.from(yt),ue=p.value.filter(we=>De.includes(we.groupKey));J=[...Le,...ue],J=[...A0e(J.filter(we=>we==null?void 0:we.id),"id")||[],...J.filter(we=>!we.id)]}return J},Z=Hse(()=>{if(!M.value)return;const{x:Le,y:J}=x.value,{x:Ge,y:vt}=T.value,yt=Math.min(Le,Ge),De=Math.min(J,vt),ue=Math.abs(Le-Ge),Vt=Math.abs(J-vt);A.value={left:yt,top:De,width:ue,height:Vt}},16);w.watch(A,Le=>{Ae(Le),y.value&&le()},{deep:!0});const Ae=Le=>{if(!M.value)return;const{left:J,top:Ge,width:vt,height:yt}=w.toValue(Le);M.value.style.left=`${J}px`,M.value.style.top=`${Ge}px`,M.value.style.width=`${vt}px`,M.value.style.height=`${yt}px`},mt=()=>{if(!c.value)return;c.value.addEventListener("mousedown",z);const Le=document.getElementById(`select_area_${g}`);if(Le){M.value=Le;return}const J=document.createElement("div");J.id=`select_area_${g}`,J.style.position="absolute",J.style.border="1px solid #1677ff",J.style.backgroundColor="rgba(22, 119, 255, 0.05)",J.style.pointerEvents="none",J.style.display="none",document.body.appendChild(J),M.value=J};return w.watch(()=>c.value,Le=>{w.toValue(Le)&&mt()},{immediate:!0}),w.onUnmounted(()=>{c.value&&c.value.removeEventListener("mousedown",z)}),{isSelecting:y,selectionBox:M}}function Vle(){const{selectedNodes:o,containerRef:a}=$f();w.watch(()=>o,()=>{c(),setTimeout(()=>{var p,y;const g=(y=(p=w.toValue(o))==null?void 0:p.map(x=>{var T;return(T=a.value)==null?void 0:T.querySelector(`[id="${x.id}"]`)}))==null?void 0:y.filter(Boolean);d(g)},0)},{deep:!0});const c=()=>{var g;(g=w.toValue(a))==null||g.querySelectorAll(".node-selected").forEach(p=>{p.classList.remove("node-selected")})},d=g=>{g.forEach(p=>{p.classList.add("node-selected")})}}const rd=[];for(let o=0;o<256;++o)rd.push((o+256).toString(16).slice(1));function eOe(o,a=0){return(rd[o[a+0]]+rd[o[a+1]]+rd[o[a+2]]+rd[o[a+3]]+"-"+rd[o[a+4]]+rd[o[a+5]]+"-"+rd[o[a+6]]+rd[o[a+7]]+"-"+rd[o[a+8]]+rd[o[a+9]]+"-"+rd[o[a+10]]+rd[o[a+11]]+rd[o[a+12]]+rd[o[a+13]]+rd[o[a+14]]+rd[o[a+15]]).toLowerCase()}let PQ;const tOe=new Uint8Array(16);function nOe(){if(!PQ){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");PQ=crypto.getRandomValues.bind(crypto)}return PQ(tOe)}const oOe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hre={randomUUID:oOe};function E4(o,a,c){var g;if(Hre.randomUUID&&!a&&!o)return Hre.randomUUID();o=o||{};const d=o.random??((g=o.rng)==null?void 0:g.call(o))??nOe();if(d.length<16)throw new Error("Random bytes length must be >= 16");return d[6]=d[6]&15|64,d[8]=d[8]&63|128,eOe(d)}const bz=()=>{const{nodes:o,updateNodes:a}=T0();return{nodes:o,addNode:x=>{const A=(Array.isArray(x)?x:[x]).map(P=>({...P,id:P.id||E4()})),M=[...o.value,...A];a(M)},removeNode:x=>{const T=Array.isArray(x)?x:[x],A=[],M=[];T.forEach(z=>{const U=o.value.find(q=>(q==null?void 0:q.id)===z);jte(U)?A.push(z):M.push(z)});let P=o.value.filter(z=>!M.includes(z==null?void 0:z.id));P=P==null?void 0:P.map(z=>A.includes(z==null?void 0:z.id)?{id:z==null?void 0:z.id,nodePath:z==null?void 0:z.nodePath,label:"文本",nodeType:"text"}:z),a(P)},editNodes:x=>{const T=Array.isArray(x)?x:[x];let A=E4();const M=T.map(z=>{let U={...z},q=z==null?void 0:z.id;return q||(q=E4(),U.id=q),U!=null&&U.groupKey||(U.groupKey=A),U}),P=[...o.value];M.forEach(z=>{const U=P.findIndex(q=>q.id===z.id);U!==-1?P[U]=z:P.push(z)}),a(P)},insertNodeAt:(x,T)=>{const A=[...o.value];A.splice(T,0,x),a(A)},moveNode:(x,T)=>{const A=[...o.value],[M]=A.splice(x,1);A.splice(T,0,M),a(A)}}};function sOe(){const{removeNode:o}=bz(),{containerRef:a}=$f(),c=g=>{var q,Q;if(g.target instanceof Element&&g.target.classList.contains("node-item"))return;const p=g.target;if(p===a.value)return;const x=((q=a.value)==null?void 0:q.getRootNode()).getSelection(),T=(Q=a.value)==null?void 0:Q.querySelectorAll('[contenteditable="true"]');T==null||T.forEach(ee=>{ee.setAttribute("contenteditable","false")});const A=p.textContent||"",M=p.innerHTML||"";p.setAttribute("contenteditable","true"),p.focus();const P=new MutationObserver(()=>{p.textContent!==A&&(p.innerHTML=M)});P.observe(p,{characterData:!0,childList:!0,subtree:!0});const z=ee=>{ee.preventDefault()};p.addEventListener("input",z),p.addEventListener("paste",z),p.addEventListener("drop",z),p.addEventListener("keydown",ee=>{var le,ae,Z,Ae;if(((le=document.activeElement)==null?void 0:le.shadowRoot)===((ae=a.value)==null?void 0:ae.getRootNode())&&!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(ee.key)){if(ee.key==="Backspace"||ee.key==="Delete"){const mt=x==null?void 0:x.getRangeAt(0);if(p.blur(),(mt==null?void 0:mt.startOffset)===0){const Le=mt.startContainer;if(Le.nodeType===Node.TEXT_NODE){const J=Le.previousSibling;if(J&&J.nodeType===Node.ELEMENT_NODE&&J.classList.contains("node-item")){const Ge=J.getAttribute("id");Ge&&o(Ge),(Z=Le.parentElement)==null||Z.normalize();return}}else if(Le.nodeType===Node.ELEMENT_NODE){const J=Le.previousSibling;if(J&&J.nodeType===Node.ELEMENT_NODE&&J.classList.contains("node-item")){const Ge=J.getAttribute("id");Ge&&o(Ge),(Ae=Le.parentElement)==null||Ae.normalize();return}}}}ee.preventDefault()}});const U=()=>{P.disconnect(),p.removeEventListener("input",z),p.removeEventListener("paste",z),p.removeEventListener("drop",z),p.removeEventListener("blur",U),p.setAttribute("contenteditable","false")};p.addEventListener("blur",U)};w.watch(a,g=>{g&&d()},{immediate:!0});const d=()=>{var g;(g=a.value)==null||g.addEventListener("dblclick",c)};return w.onUnmounted(()=>{var g;(g=a.value)==null||g.removeEventListener("dblclick",c)}),{}}function rOe(){const{containerRef:o,focusedElement:a,cursorPosition:c,focusedNodeIndex:d,preNodeNumber:g}=$f(),p=A=>{var P,z;const M=A==null?void 0:A.getSelection();try{if((P=a.value)==null||P.normalize(),M){const U=M.getRangeAt(0);d.value=zAe(U.startContainer);const q=U.startOffset,Q=(z=a.value)==null?void 0:z.querySelectorAll(".node-item");let ee=0;return g.value=0,Q==null||Q.forEach(le=>{const ae=document.createRange();if(ae.selectNode(le),ae.comparePoint(U.startContainer,q)>=0){g.value+=1;const Z=le.getAttribute("data-startOffset");Number(Z)>ee&&(ee=Number(Z))}}),ee+q}}catch{}return 0},y=()=>{var M;const A=(M=o.value)==null?void 0:M.getRootNode();c.value=p(A)},x=A=>{var U;const M=A.target;if(M===o.value)return;a.value=M;const P=(U=o.value)==null?void 0:U.getRootNode();c.value=p(P),M.addEventListener("click",y),M.addEventListener("keyup",q=>{["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(q.key)&&y()});const z=()=>{M.removeEventListener("click",y),M.removeEventListener("keyup",y),M.removeEventListener("blur",z),setTimeout(()=>{a.value=null,d.value=0,c.value=-1},300)};M.addEventListener("blur",z)};w.watch(o,A=>{A&&T()},{immediate:!0});const T=()=>{var A;(A=o.value)==null||A.addEventListener("focus",x,!0)};return w.onUnmounted(()=>{var A;(A=o.value)==null||A.removeEventListener("focus",x,!0)}),{focusedElement:a,cursorPosition:c,focusedNodeIndex:d,preNodeNumber:g}}function aOe(o){const a=o.value===null?[]:[JSON.parse(JSON.stringify(o.value))],c=w.ref(a),d=w.ref(0),g=w.ref(!1),p=w.computed(()=>c.value[d.value]),y=()=>{d.value>0&&(g.value=!0,d.value--,o.value=JSON.parse(JSON.stringify(c.value[d.value])))},x=()=>{d.value<c.value.length-1&&(g.value=!0,d.value++,o.value=JSON.parse(JSON.stringify(c.value[d.value])))},T=A=>{(A.ctrlKey||A.metaKey)&&A.key==="z"?(A.preventDefault(),y()):(A.ctrlKey||A.metaKey)&&A.key==="y"&&(A.preventDefault(),x())};return w.onMounted(()=>{window.addEventListener("keydown",T)}),w.onUnmounted(()=>{window.removeEventListener("keydown",T)}),w.watch(o,Vx(A=>{A&&!g.value&&(c.value.splice(d.value+1),c.value.push(JSON.parse(JSON.stringify(A))),d.value++),g.value&&(g.value=!1)},300),{deep:!0}),{current:p,undo:y,redo:x}}function iOe(){const{modelValue:o}=T0(),{nodes:a,addNode:c}=bz(),d=y=>{if(!y||typeof y!="string")return[];const T=new DOMParser().parseFromString(y,"text/html");return Array.from(T.querySelectorAll("td")).filter(P=>{var z;return!((z=P.textContent)!=null&&z.trim())})},g=(y,x)=>{const T=x.map(M=>M.nodePath);return y==null?void 0:y.map(M=>({nodePath:zte(M)})).filter(M=>{const P=M==null?void 0:M.nodePath;return!T.includes(P)})},p=y=>{const x=y.map(T=>({nodeType:"Text",label:"文本",...T}));c(x)};w.onMounted(()=>{const y=d(o),x=g(y,w.toValue(a));p(x)})}function cOe(){const{selectedNodes:o,containerRef:a}=$f(),{removeNode:c}=bz(),d=w.ref(null),g=x=>{var T;if((T=w.toValue(a))!=null&&T.contains(d.value)&&(x.key==="Delete"||x.key==="Backspace")){let A=[];x.preventDefault(),w.toValue(o).length>0&&(w.toValue(o).forEach(M=>{var P,z,U;if(((P=M==null?void 0:M.element)==null?void 0:P.tagName)==="TD"){const q=(z=M==null?void 0:M.element)==null?void 0:z.getAttribute("id");q&&A.push(q)}else{const q=(U=M==null?void 0:M.element)==null?void 0:U.getAttribute("id");q&&A.push(q)}}),o.value=[],(A==null?void 0:A.length)>0&&c(A))}},p=x=>{var T;(T=w.toValue(a))!=null&&T.contains(x.target)?d.value=x.target:d.value=null},y=()=>{a.value&&(window.addEventListener("keydown",g),a.value.addEventListener("mousedown",p))};w.watch(()=>a.value,x=>{w.toValue(x)&&y()},{immediate:!0}),w.onUnmounted(()=>{a.value&&(window.removeEventListener("keydown",g),a.value.removeEventListener("mousedown",p))})}function vz(){const{nodes:o}=T0(),{containerRef:a,renderNodes:c,uiReady:d}=$f(),g=()=>{var p;c.value=[...(p=o.value)==null?void 0:p.map(y=>{var T;const x=(T=a.value)==null?void 0:T.querySelector(`[id="${y.id}"]`);return{...y,element:x}})].filter(y=>!!(y!=null&&y.element))};w.watch(()=>[o,a.value,d],()=>{w.toValue(d)&&g()},{immediate:!0,deep:!0})}const Pee=w.ref({});function yz(o){return w.computed(()=>{var a;return(a=Pee.value)==null?void 0:a[o]})}function Hle(){const o=T0(),a=$f();w.onMounted(()=>{const{editorId:c}=o;c&&(Pee.value[c]=w.ref({...o,...a}))}),w.onUnmounted(()=>{const{editorId:c}=o;c&&(Pee.value[c]=null)})}const lOe=w.defineComponent({__name:"NodesEditUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{nodes:a}=T0(),{uiReady:c,renderNodes:d}=$f();return Hle(),aOe(a),Lle(),Vle(),cOe(),rOe(),sOe(),iOe(),vz(),(g,p)=>w.unref(c)?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(w.unref(d),y=>(w.openBlock(),w.createBlock(pz,{key:y==null?void 0:y.id,node:y},{default:w.withCtx(x=>[w.renderSlot(g.$slots,"nodeItem",{node:x==null?void 0:x.node})]),_:2},1032,["node"]))),128)):w.createCommentVNode("",!0)}}),zre=w.defineComponent({__name:"NodesPreviewUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:a,renderNodes:c}=$f();return vz(),(d,g)=>w.unref(a)?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(w.unref(c),p=>(w.openBlock(),w.createBlock(pz,{key:p==null?void 0:p.id,node:p},{default:w.withCtx(y=>[w.renderSlot(d.$slots,"nodeItem",{node:y==null?void 0:y.node})]),_:2},1032,["node"]))),128)):w.createCommentVNode("",!0)}}),uOe=w.defineComponent({__name:"NodesEnterUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:a,renderNodes:c}=$f();return vz(),(d,g)=>w.unref(a)?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(w.unref(c),p=>(w.openBlock(),w.createBlock(pz,{key:p==null?void 0:p.id,node:p},{default:w.withCtx(y=>[w.renderSlot(d.$slots,"nodeItem",{node:y==null?void 0:y.node})]),_:2},1032,["node"]))),128)):w.createCommentVNode("",!0)}}),dOe=w.defineComponent({__name:"NodesSelectUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:a,renderNodes:c}=$f();return Hle(),Lle(),Vle(),vz(),(d,g)=>w.unref(a)?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(w.unref(c),p=>(w.openBlock(),w.createBlock(pz,{key:p==null?void 0:p.id,node:p},{default:w.withCtx(y=>[w.renderSlot(d.$slots,"nodeItem",{node:y==null?void 0:y.node})]),_:2},1032,["node"]))),128)):w.createCommentVNode("",!0)}}),fOe=w.defineComponent({__name:"NodesProvider",props:w.mergeModels({modelValue:{type:String,default:""},nodes:{type:Array,default:()=>[]},renderType:{type:String,default:"preview"},inputTypes:{type:Array,default:()=>[]},editorId:{type:String,default:""}},{formData:{},formDataModifiers:{},nodes:{},nodesModifiers:{}}),emits:w.mergeModels(["update:nodes"],["update:formData","update:nodes"]),setup(o,{emit:a}){const c=o,d=w.useModel(o,"formData"),g=w.useModel(o,"nodes");return w.provide(Fle,{modelValue:c.modelValue,renderType:c.renderType,inputTypes:c.inputTypes,editorId:c==null?void 0:c.editorId,nodes:g,updateNodes:p=>g.value=p,formData:d}),(p,y)=>w.renderSlot(p.$slots,"default")}}),jw=w.ref({});function mOe(o){return jw.value[o]||(jw.value[o]=w.ref([])),jw.value[o]}function gOe(o){const{editorId:a}=o;jw.value[a]||(jw.value[a]=w.ref([])),jw.value[a].push(o),w.onUnmounted(()=>{jw.value[a]=jw.value[a].filter(c=>c.id!==o.id)})}const hOe=w.defineComponent({__name:"NodesUIProvider",props:{nodes:{type:Array,default:()=>[]},selectedNodes:{type:Array,default:()=>[]},nodesGroups:{type:Array,default:()=>[]},editorId:{type:String,default:""}},emits:["onSelectedNodes","update:selectedNodes"],setup(o,{expose:a,emit:c}){const d=o,g=c,p=w.computed({get:()=>(d.selectedNodes||[]).map(le=>{var Ae;let ae=(Ae=d==null?void 0:d.nodes)==null?void 0:Ae.find(mt=>(mt==null?void 0:mt.id)===(le==null?void 0:le.id)),Z=le!=null&&le.element?le==null?void 0:le.element:LAe(le==null?void 0:le.id,y.value);return{...ae||{},...le,element:Z}}),set:le=>{const ae=le.map(({element:Z,...Ae})=>{var Le;return{...((Le=d==null?void 0:d.nodes)==null?void 0:Le.find(J=>(J==null?void 0:J.id)===(Ae==null?void 0:Ae.id)))||{},...Ae}});g("update:selectedNodes",ae)}}),y=w.ref(null),x=w.ref([]),T=w.ref(null),A=w.ref(-1),M=w.ref(0),P=w.ref(0),z=mOe(d==null?void 0:d.editorId),U=w.ref(!1),q=w.computed(()=>{var ae;const le=((ae=w.toValue(z))==null?void 0:ae.filter(Z=>!w.toValue(Z==null?void 0:Z.activated)))||[];return jAe([...(d==null?void 0:d.nodesGroups)||[],...le])}),Q=w.ref([]),ee=le=>{const ae=le.map(({element:Z,...Ae})=>{var Le;return{...((Le=x.value)==null?void 0:Le.find(J=>(J==null?void 0:J.id)===(Ae==null?void 0:Ae.id)))||{},...Ae}});p.value=le,g("onSelectedNodes",ae)};return a({setSelectedNodes:ee}),w.provide(Ile,{containerRef:y,focusedElement:T,currentRenderNodes:Q,cursorPosition:A,focusedNodeIndex:M,preNodeNumber:P,currentNodes:q,selectedNodes:p,setSelectedNodes:ee,renderNodes:x,uiReady:U}),(le,ae)=>w.renderSlot(le.$slots,"default")}}),pOe=["onClick"],bOe={key:0,class:"icon"},vOe={key:1,class:"arrow"},yOe={key:0,class:"submenu"},wOe=["onClick"],COe={key:0,class:"icon"},SOe=w.defineComponent({__name:"index",props:w.mergeModels({style:{}},{show:{},showModifiers:{}}),emits:w.mergeModels(["select"],["update:show"]),setup(o,{emit:a}){const{selectedNodes:c,focusedElement:d,cursorPosition:g,focusedNodeIndex:p,preNodeNumber:y}=$f(),{inputTypes:x}=T0(),T=w.useModel(o,"show"),{editNodes:A}=bz(),M=q=>{if(w.toValue(d)&&!g0e(w.toValue(g))){const Q=zte(w.toValue(d)),ee=w.toValue(g),le=(w.toValue(y)||0)+1,ae=UAe(w.toValue(d));Q&&ee&&ee>=0&&A({...ae,label:q==null?void 0:q.label,nodePath:Q,startOffset:ee,subNodeSort:le,textNodeIndex:w.toValue(p)||0,nodeType:q==null?void 0:q.value})}else if(c){const Q=w.toValue(c);Q!=null&&Q.length&&A(Q==null?void 0:Q.map(ee=>({...ee,label:q==null?void 0:q.label,element:ee==null?void 0:ee.element,nodePath:ee==null?void 0:ee.nodePath,nodeType:q==null?void 0:q.value})))}T.value=!1},P=w.computed(()=>{const q=[],Q=[];return w.toValue(x).forEach(ee=>{ee.groupName==="system"?Q.push({...ee,handler:()=>{M(ee)}}):q.push({...ee,handler:()=>{M(ee)}})}),[{label:"限定填写内容",icon:"i-bi:lock",children:q},{label:"插入记录标识",icon:"i-bi:flag",children:Q}].filter(ee=>{var le;return(le=ee==null?void 0:ee.children)==null?void 0:le.length})}),z=a,U=(q,Q)=>{q.preventDefault(),Q!=null&&Q.handler&&Q.handler(),Q!=null&&Q.value&&z("select",Q==null?void 0:Q.value)};return(q,Q)=>w.withDirectives((w.openBlock(),w.createElementBlock("div",{class:"context-menu",style:w.normalizeStyle({...q.style})},[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(P.value,ee=>(w.openBlock(),w.createElementBlock("div",{key:ee==null?void 0:ee.label,class:"menu-item"},[w.createElementVNode("div",{class:"menu-item-content",onClick:le=>U(le,ee)},[ee!=null&&ee.icon?(w.openBlock(),w.createElementBlock("div",bOe,[w.createElementVNode("div",{class:w.normalizeClass(ee==null?void 0:ee.icon)},null,2)])):w.createCommentVNode("",!0),w.createTextVNode(" "+w.toDisplayString(ee.label)+" ",1),ee!=null&&ee.children?(w.openBlock(),w.createElementBlock("span",vOe,"›")):w.createCommentVNode("",!0)],8,pOe),ee!=null&&ee.children?(w.openBlock(),w.createElementBlock("div",yOe,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(ee.children,le=>(w.openBlock(),w.createElementBlock("div",{key:le.action,class:"menu-item",onClick:ae=>U(ae,le)},[le!=null&&le.icon?(w.openBlock(),w.createElementBlock("div",COe,[w.createElementVNode("div",{class:w.normalizeClass(le==null?void 0:le.icon)},null,2)])):w.createCommentVNode("",!0),w.createTextVNode(" "+w.toDisplayString(le.label),1)],8,wOe))),128))])):w.createCommentVNode("",!0)]))),128))],4)),[[w.vShow,T.value]])}}),xOe=cu(SOe,[["__scopeId","data-v-7f46efc3"]]);function EOe(){const o=w.ref(!1),a=w.ref({left:"0px",top:"0px"}),c=g=>{g.preventDefault(),o.value=!0;const y=g.currentTarget.getBoundingClientRect(),x=g.clientX-y.left,T=g.clientY-y.top,A=118,M=y.width-x<A;a.value={left:M?`${x-A}px`:`${x}px`,top:`${T}px`}},d=g=>{const p=document.querySelector(".context-menu");p&&!p.contains(g.target)&&(o.value=!1)};return w.onMounted(()=>{document.addEventListener("mousedown",d)}),w.onUnmounted(()=>{document.removeEventListener("mousedown",d)}),{showContextMenu:o,contextMenuStyle:a,onContextMenu:c,closeContextMenu:d}}function zle(o){return{all:o=o||new Map,on:function(a,c){var d=o.get(a);d?d.push(c):o.set(a,[c])},off:function(a,c){var d=o.get(a);d&&(c?d.splice(d.indexOf(c)>>>0,1):o.set(a,[]))},emit:function(a,c){var d=o.get(a);d&&d.slice().map(function(g){g(c)}),(d=o.get("*"))&&d.slice().map(function(g){g(a,c)})}}}const Bee=zle(),Ule=(...o)=>{const a=o[0],c=o[1];w.onMounted(()=>{Bee.on(a,c)}),w.onBeforeUnmount(()=>{Bee.off(a)})},Wte=()=>(...a)=>{Bee.emit(...a)};let m0=null;function _Oe(o){const{onSelected:a}=o,{selectedNodes:c,setSelectedNodes:d}=$f();return w.watch(()=>c,()=>{m0==null||m0({data:c.value}),a==null||a(w.toValue(c))},{deep:!0}),Ule("selectNodes",p=>{const{data:y,callback:x=null,mode:T="multiple"}=p;setTimeout(()=>{d(w.toValue(y)),m0=x},100)}),{onBlur:()=>{m0&&(m0==null||m0({data:c.value,type:"blur"}),m0=null,d([]))}}}const TOe={class:"relative"},kOe=w.defineComponent({__name:"index",props:{hasContextMenu:{type:Boolean,default:!1}},setup(o){const{containerRef:a,uiReady:c}=$f(),{nodes:d,modelValue:g}=T0(),{showContextMenu:p,contextMenuStyle:y,onContextMenu:x}=EOe(),T=w.ref(null),A=U=>{let q=null;if(jte(U))q=Ple(U.nodePath,w.toValue(a)),q&&q.classList.add("node-item-td");else{const Q=document.createElement("span");Q.setAttribute("contenteditable","false"),Q.classList.add("node-item"),q=Q,VAe(U,q,a.value)}return q&&HAe(q,U),q},M=()=>{const U=C0e(d.value,[q=>q.nodePath,q=>q.textNodeIndex,q=>q.startOffset??-1,q=>q.subNodeSort],["asc","desc","desc","desc"]);U==null||U.forEach(q=>{A(q)})};w.watch(()=>[d,g,T],()=>{T.value&&(c.value=!1,w.nextTick(()=>{T.value&&(T.value.innerHTML=g,M(),c.value=!0)}))},{deep:!0,immediate:!0});const P=w.ref(),{onBlur:z}=_Oe({onSelected:()=>{var U;(U=P.value)==null||U.focus()}});return(U,q)=>(w.openBlock(),w.createElementBlock("div",TOe,[w.createVNode(Hte,{onOnBlur:w.unref(z),ref_key:"shadowDomRef",ref:P},{default:w.withCtx(()=>[w.createElementVNode("html",{class:"nodes-editor",ref_key:"containerRef",ref:a,onContextmenu:q[0]||(q[0]=w.withModifiers((...Q)=>w.unref(x)&&w.unref(x)(...Q),["prevent"]))},[w.createElementVNode("body",{ref_key:"bodyRef",ref:T},null,512)],544)]),_:1},8,["onOnBlur"]),o.hasContextMenu?(w.openBlock(),w.createBlock(xOe,{key:0,show:w.unref(p),"onUpdate:show":q[1]||(q[1]=Q=>w.isRef(p)?p.value=Q:null),style:w.normalizeStyle(w.unref(y))},null,8,["show","style"])):w.createCommentVNode("",!0)]))}}),jle=w.defineComponent({__name:"index",props:w.mergeModels({modelValue:{type:String,default:""},nodes:{type:Array,default:()=>[]},pagesize:{type:String,default:"A4"},renderType:{type:String,default:"preview"},formData:{type:Object,default:()=>({})},inputTypes:{type:Array,default:()=>[]},nodesGroups:{type:Array,default:()=>[]},id:{type:String,default:""}},{selectedNodes:{default:[]},selectedNodesModifiers:{}}),emits:w.mergeModels(["update:nodes","update:formData","onSelectedNodes"],["update:selectedNodes"]),setup(o,{expose:a,emit:c}){const d=o,g=c,p=w.useModel(o,"selectedNodes"),y=w.ref(),x=w.ref(),T=w.computed(()=>{switch(d.renderType){case"edit":return lOe;case"select":return dOe;case"result":return zre;case"enter":return uOe;default:return zre}}),A=z=>{g("update:nodes",z)},M=z=>{g("update:formData",z)},P=z=>{g("onSelectedNodes",z)};return a({formRef:{validate:()=>{var z,U,q;return(q=(U=(z=y.value)==null?void 0:z.formRef)==null?void 0:U.validate)==null?void 0:q.call(U)}},setSelectedNodes:z=>{var U,q;(q=(U=x.value)==null?void 0:U.setSelectedNodes)==null||q.call(U,z)}}),(z,U)=>(w.openBlock(),w.createBlock(hOe,{ref_key:"UIRef",ref:x,nodes:o.nodes,"onUpdate:nodes":A,selectedNodes:p.value,"onUpdate:selectedNodes":U[0]||(U[0]=q=>p.value=q),onOnSelectedNodes:P,nodesGroups:o.nodesGroups,editorId:d==null?void 0:d.id},{default:w.withCtx(()=>[w.createVNode(fOe,{renderType:o.renderType,"model-value":o.modelValue,nodes:o.nodes,"onUpdate:nodes":A,formData:o.formData,"onUpdate:formData":M,inputTypes:o.inputTypes,editorId:d==null?void 0:d.id},{default:w.withCtx(()=>[w.createVNode(kOe,{hasContextMenu:o.renderType==="edit"},null,8,["hasContextMenu"]),(w.openBlock(),w.createBlock(w.resolveDynamicComponent(T.value),{renderType:o.renderType,pagesize:o.pagesize,ref_key:"contentRef",ref:y},{nodeItem:w.withCtx(q=>[w.renderSlot(z.$slots,"nodeItem",{node:q==null?void 0:q.node})]),_:3},8,["renderType","pagesize"]))]),_:3},8,["renderType","model-value","nodes","formData","inputTypes","editorId"])]),_:3},8,["nodes","selectedNodes","nodesGroups","editorId"]))}}),AOe={class:"nodes-text"},OOe={key:0,class:"node-text-input"},NOe={key:1,class:"node-text-td"},$Oe={key:0,class:"node-text-table-index"},DOe=w.defineComponent({__name:"index",props:w.mergeModels({editorId:{type:String,default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const a=o,c=w.useModel(o,"modelValue"),d=yz(a==null?void 0:a.editorId),g=w.computed(()=>{var y,x,T,A,M,P;if(((y=w.toValue(p))==null?void 0:y.length)>0)if((T=(x=w.toValue(p))==null?void 0:x[0])!=null&&T.element){const z=(M=(A=w.toValue(p))==null?void 0:A[0])==null?void 0:M.element.closest("body").querySelectorAll("table");return((P=Array.from(z))==null?void 0:P.length)===1}else return!0;else return!0}),p=w.computed(()=>{var y;return Ble(c.value,((y=w.toValue(d))==null?void 0:y.renderNodes)||[])});return(y,x)=>(w.openBlock(),w.createElementBlock("div",AOe,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(p.value,(T,A)=>{var M,P,z;return w.openBlock(),w.createElementBlock("div",{key:A,class:"node-text-item"},[(T==null?void 0:T.showTextType)==="input"?(w.openBlock(),w.createElementBlock("span",OOe," 填写"+w.toDisplayString(T==null?void 0:T.inputIndex),1)):(w.openBlock(),w.createElementBlock("span",NOe,[g.value?w.createCommentVNode("",!0):(w.openBlock(),w.createElementBlock("span",$Oe,w.toDisplayString(`表${(M=T==null?void 0:T.min)==null?void 0:M.tableIndex}.`),1)),w.createTextVNode(" "+w.toDisplayString(((P=T==null?void 0:T.min)==null?void 0:P.id)===((z=T==null?void 0:T.max)==null?void 0:z.id)?w.unref(x4)(T==null?void 0:T.min):`${w.unref(x4)(T==null?void 0:T.min)}:${w.unref(x4)(T==null?void 0:T.max)}`),1)]))])}),128))]))}}),MOe=cu(DOe,[["__scopeId","data-v-67e3a210"]]);function ROe(o){const{nodes:a,mode:c="multiple"}=o,d=w.ref(!1),g=Wte();return{isSelecting:d,selectNodes:()=>{if(d.value)return!1;d.value=!0,g("selectNodes",{data:w.toValue(a),mode:c,callback:({data:y,type:x})=>{a.value=y,x==="blur"&&(d.value=!1)}})}}}const f4=["#ff9b40","#b36c2d","#7548ff","#5233b3","#649ee5","#aac4ed","#f9ce57","#ae74e8"],BQ=w.ref(0),$x=new Map,IOe={class:"node-select"},POe={class:"flex py-2 px-2 justify-between items-center noder-select-header"},BOe={class:"flex gap-2"},FOe={class:"flex gap-1"},LOe=w.defineComponent({__name:"index",props:w.mergeModels({mode:{type:String,default:"multiple"},color:{type:String},id:{type:String,default:""},editorId:{type:String,default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const a=o;!($x!=null&&$x[a==null?void 0:a.id])&&(a!=null&&a.id)&&($x[a==null?void 0:a.id]=BQ.value,BQ.value=BQ.value+1);const c=w.ref(($x==null?void 0:$x[a==null?void 0:a.id])||0),d=w.useModel(o,"modelValue"),{selectNodes:g,isSelecting:p}=ROe({nodes:d,mode:a.mode}),y=()=>{d.value=[]},x=w.computed(()=>a.color||(f4==null?void 0:f4[w.toValue(c)%(f4==null?void 0:f4.length)])||"#409eff");return gOe({id:a.id,editorId:a.editorId,nodes:d,activated:p,color:x.value}),(T,A)=>(w.openBlock(),w.createElementBlock("div",IOe,[w.createElementVNode("div",POe,[w.createElementVNode("div",BOe,[w.createElementVNode("div",{style:w.normalizeStyle({"--node-color":x.value}),class:"node-color cursor-pointer"},null,4),w.createElementVNode("div",{style:w.normalizeStyle(w.unref(p)?{color:"#409eff"}:{})},[w.createElementVNode("div",{class:"i-bi:hand-index text-[18px] cursor-pointer",onClick:A[0]||(A[0]=(...M)=>w.unref(g)&&w.unref(g)(...M))})],4),w.createElementVNode("div",null,[w.createElementVNode("div",{class:"i-bi:eraser-fill text-[18px] cursor-pointer",onClick:y})])]),w.createElementVNode("div",FOe,[A[4]||(A[4]=w.createElementVNode("div",{class:"color-[#999]"},"Ctrl+左键多选",-1)),w.createElementVNode("div",null,[w.createVNode(w.unref(rs.ElPopover),{placement:"top-start",width:200,trigger:"hover",content:"this is content, this is content, this is content"},{reference:w.withCtx(()=>A[3]||(A[3]=[w.createElementVNode("div",{class:"flex flex-center"},[w.createElementVNode("div",{class:"i-bi:info-circle-fill mr-2"}),w.createTextVNode(" 使用帮助 ")],-1)])),_:1})])])]),w.createElementVNode("div",{class:"min-h-[42px] px-2 py-1",onClick:A[2]||(A[2]=(...M)=>w.unref(g)&&w.unref(g)(...M))},[w.createVNode(MOe,{modelValue:d.value,"onUpdate:modelValue":A[1]||(A[1]=M=>d.value=M),editorId:o.editorId},null,8,["modelValue","editorId"])])]))}}),Wle=cu(LOe,[["__scopeId","data-v-aa7f5cc8"]]);function VOe(o){if(!o.startsWith("="))return[];const a=[];let c=1;for(o.startsWith("=")&&a.push({type:"startOperator",value:"="});c<o.length;){const d=o[c];if(/\s/.test(d)){c++;continue}if(/[A-Za-z]/.test(d)&&/\d/.test(o[c+1])){let g="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)g+=o[c++];for(;c<o.length&&/\d/.test(o[c]);)g+=o[c++];if(c<o.length&&o[c]===":"){c++;let p="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)p+=o[c++];for(;c<o.length&&/\d/.test(o[c]);)p+=o[c++];a.push({type:"range",value:`${g}:${p}`});continue}else{a.push({type:"cell",value:g});continue}}if(/[A-Za-z]/.test(d)&&/\d/.test(o[c+1])){let g="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)g+=o[c++];for(;c<o.length&&/\d/.test(o[c]);)g+=o[c++];a.push({type:"cell",value:g});continue}if(/[A-Za-z]/.test(d)){let g="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)g+=o[c++];if(["AVERAGE","AVEDEV","SUM","IF","COUNT","MAX","MIN","SQRT"].includes(g.toUpperCase())&&o[c]==="("){a.push({type:"function",value:g});continue}c-=g.length}if(/\d/.test(d)){let g="";for(;c<o.length&&(/\d/.test(o[c])||o[c]===".");)g+=o[c++];a.push({type:"number",value:g});continue}if(d==='"'){let g="";for(g+=d,c++;c<o.length&&o[c]!=='"';)g+=o[c++];g+=d,c++,a.push({type:"string",value:g});continue}if(/[A-Za-z]/.test(d)&&/\d/.test(o[c+1])){let g="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)g+=o[c++];for(;c<o.length&&/\d/.test(o[c]);)g+=o[c++];a.push({type:"cell",value:g});continue}if(d===":"){a.push({type:"operator",value:":"}),c++;continue}if(/[+\-*/=><]/.test(d)){a.push({type:"operator",value:d}),c++;continue}if(/[()]/.test(d)){a.push({type:"paren",value:d}),c++;continue}if(d===","){a.push({type:"separator",value:","}),c++;continue}c++}return a}function HOe(o,a){const c=[];let d=0;for(;d<o.length;){let g=!1;for(const p of a){const y=p.value;if(o.startsWith(y,d)){c.push({type:p.type,value:y,...p.cellValue?{cellValue:p.cellValue}:{}}),d+=y.length,g=!0;break}}g||(c.push({type:"plain",value:o[d]}),d++)}return c}function zOe(o){const a=yz(o.editorId),c=(y,x)=>{let T=[];const A=Math.min(y.colIndex,x.colIndex),M=Math.max(y.colIndex,x.colIndex),P=Math.min(y.rowIndex,x.rowIndex),z=Math.max(y.rowIndex,x.rowIndex);for(let U=P;U<=z;U++)for(let q=A;q<=M;q++)T.push({colIndex:q,rowIndex:U});return T},d=y=>{var M;const x=y.includes(":");let T=[];if(x){const[P,z]=y.split(":").map(U=>p(U));T=c(P,z)}else T=[p(y)];return g(T,w.toValue((M=w.toValue(a))==null?void 0:M.nodes))},g=(y,x)=>x==null?void 0:x.filter(T=>{const A=T.nodePath.split(" > ");let M=1,P=1;return A.forEach(z=>{if(z.startsWith("tr")){const U=z.match(/tr(?::nth-child\((\d+)\))?/);U&&U[1]&&(M=parseInt(U[1]))}else if(z.startsWith("td")){const U=z.match(/td(?::nth-child\((\d+)\))?/);U&&(P=U[1]?parseInt(U[1]):1)}}),y.some(z=>M===z.rowIndex+1&&P===z.colIndex+1)}),p=y=>{if(!y)return{colIndex:-1,rowIndex:-1};const x=y.match(/^([A-Za-z]+)(\d+)$/);if(!x)return{colIndex:-1,rowIndex:-1};const T=x[1].toUpperCase(),A=parseInt(x[2]);let M=0;for(let P=0;P<T.length;P++)M=M*26+(T.charCodeAt(P)-64);return{colIndex:M-1,rowIndex:A}};return{getCellValue:d}}const Ure=["#0288D1","#D32F2F","#F57C00","#388E3C","#303F9F","#7B1FA2","#C2185B","#880E4F","#689F38","#5D4037"];function UOe(o,a,c){const d=w.ref(null),g=w.ref(null);function p(){return o.value&&o.value.textContent||""}w.onMounted(()=>{o.value&&(d.value=()=>{const x=p();a.value=x},g.value=()=>{const x=p();a.value=x},o.value.addEventListener("input",d.value),o.value.addEventListener("blur",g.value))}),w.onUnmounted(()=>{o.value&&(d.value&&o.value.removeEventListener("input",d.value),g.value&&o.value.removeEventListener("blur",g.value))});const y=x=>{var T,A,M,P;if(x>=0){const z=window.getSelection();if(z){const U=z.getRangeAt(0),q=((T=U.startContainer)==null?void 0:T.nodeName)==="#text"?U.startContainer:(M=(A=U.startContainer)==null?void 0:A.childNodes)==null?void 0:M[0],Q=Math.min(x,((P=q.textContent)==null?void 0:P.length)||0);U.setStart(q,Q)}}};return w.watch(()=>[a,o],()=>{var x;o.value&&(Mu((x=o.value)==null?void 0:x.textContent,w.toValue(a))||(o.value.textContent=w.toValue(a),y(w.toValue(c))))},{deep:!0,immediate:!0}),{getFormulaContent:p}}function Zte(o){const{element:a,onFocus:c,onBlur:d}=o,g=w.ref(!1),p=()=>{g.value=!0,c==null||c()},y=()=>{g.value=!1,d==null||d()};return w.onMounted(()=>{var x,T;w.toValue(a)&&((x=w.toValue(a))==null||x.addEventListener("focus",p),(T=w.toValue(a))==null||T.addEventListener("blur",y))}),w.onUnmounted(()=>{var x,T;w.toValue(a)&&((x=w.toValue(a))==null||x.removeEventListener("focus",p),(T=w.toValue(a))==null||T.removeEventListener("blur",y))}),g}function jOe(o){const{element:a,showStr:c,editorId:d}=o,g=yz(d),p=Zte({element:a}),y=w.computed(()=>{var x;return(x=c==null?void 0:c.value)==null?void 0:x.filter(T=>["range","cell"].includes(T.type))});return w.watch(()=>p,()=>{var T,A,M,P,z,U;const x=q=>{var Q;q.preventDefault(),(Q=w.toValue(a))==null||Q.focus()};w.toValue(p)?((T=w.toValue(g))==null||T.containerRef.addEventListener("click",x),(A=w.toValue(g))==null||A.containerRef.addEventListener("mousedown",x),(M=document.querySelectorAll(".select-function"))==null||M.forEach(q=>{q.addEventListener("click",x),q.addEventListener("mousedown",x)})):((P=w.toValue(g))==null||P.containerRef.removeEventListener("click",x),(z=w.toValue(g))==null||z.containerRef.removeEventListener("mousedown",x),(U=document.querySelectorAll(".select-function"))==null||U.forEach(q=>{q.removeEventListener("click",x),q.removeEventListener("mousedown",x)}))},{deep:!0}),w.watch(()=>[p,y],()=>{var x,T,A,M,P;if((x=w.toValue(g))!=null&&x.containerRef&&((M=(A=(T=w.toValue(g))==null?void 0:T.containerRef)==null?void 0:A.querySelectorAll(".node-formula-cell"))==null||M.forEach(z=>{z.classList.remove("node-formula-cell")}),w.toValue(p))){let z=[];(P=y.value)!=null&&P.length&&(y.value.forEach(U=>{var q;z=[...z,...((q=U==null?void 0:U.cellValue)==null?void 0:q.map(Q=>({color:U==null?void 0:U.color,backgroundColor:Ute((U==null?void 0:U.color)||"#000",.1),element:Q==null?void 0:Q.element})))||[]]}),z.forEach(U=>{var q;U!=null&&U.element&&((q=U==null?void 0:U.element)==null||q.classList.add("node-formula-cell"),U==null||U.element.style.setProperty("--formula-node-color",U==null?void 0:U.color),U==null||U.element.style.setProperty("--formula-node-bg-color",U==null?void 0:U.backgroundColor))}))}},{deep:!0}),p}const WOe=o=>{const{element:a}=o,c=w.ref(-1),d=x=>{const T=x==null?void 0:x.getSelection();try{if(T)return T.getRangeAt(0).startOffset}catch{}return 0},g=()=>{var T;const x=(T=a.value)==null?void 0:T.getRootNode();c.value=d(x)},p=x=>{var P;const T=x.target,A=(P=a.value)==null?void 0:P.getRootNode();c.value=d(A),T.addEventListener("click",g),T.addEventListener("keyup",z=>{["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(z.key)&&g()});const M=()=>{T.removeEventListener("click",g),T.removeEventListener("keyup",g),T.removeEventListener("blur",M),setTimeout(()=>{c.value=-1},300)};T.addEventListener("blur",M)};w.watch(a,x=>{x&&y()},{immediate:!0});const y=()=>{var x;(x=a.value)==null||x.addEventListener("focus",p,!0)};return w.onUnmounted(()=>{var x;(x=a.value)==null||x.removeEventListener("focus",p,!0)}),{startOffset:c}};function ZOe(o,a,c,d){if(a<0||c<0||a>=o.length)throw new Error("Invalid start or length");const g=a+c;return o.slice(0,a)+d+o.slice(g)}const GOe=(o,a)=>{var d;let c=0;for(let g=0;g<a;g++){const p=o[g];c+=(d=p==null?void 0:p.value)==null?void 0:d.length}return c},qOe=o=>{const{startOffset:a,showStr:c,value:d,editorId:g,currentItemIndex:p,currentItem:y,element:x}=o,T=yz(g),A=w.ref(-1),M=w.ref(0),P=Zte({element:x}),z=w.ref(!1),U=Wte(),q=Q=>{var ee,le;if(w.toValue(z)&&w.toValue(P)&&!Mu((ee=w.toValue(y))==null?void 0:ee.cellValue,Q)){const ae=YAe(Q,((le=w.toValue(T))==null?void 0:le.nodes)||"");let Z=ae;ae&&(w.toValue(M)===0&&(Z+=","),w.toValue(A)>=0&&(d.value=ZOe(w.toValue(d),w.toValue(A),w.toValue(M),Z),M.value=ae.length))}};w.watch(()=>p,()=>{var Q,ee,le,ae,Z,Ae;if((Q=T.value)==null||Q.setSelectedNodes([]),["range","cell"].includes((ee=w.toValue(y))==null?void 0:ee.type))return A.value=GOe(c.value,p.value),M.value=(ae=(le=w.toValue(y))==null?void 0:le.value)==null?void 0:ae.length,z.value=!0,U("selectNodes",{data:(Z=w.toValue(y))==null?void 0:Z.cellValue,mode:"multiple",callback:({data:mt})=>{q(mt)}}),!1;if([",","(","="].includes((Ae=w.toValue(y))==null?void 0:Ae.value))return A.value=w.toValue(a),z.value=!0,M.value=0,U("selectNodes",{data:[],mode:"multiple",callback:({data:mt})=>{q(mt)}}),!1;z.value=!1,A.value=-1},{immediate:!0,deep:!0})},YOe=o=>{const{startOffset:a,showStr:c}=o,d=w.ref(-1);w.watch(()=>a,()=>{var p;if(w.toValue(a)<=0)d.value=-1;else{let y=0;for(let x=0;x<c.value.length;x++){const T=c.value[x];if(y+=(p=T==null?void 0:T.value)==null?void 0:p.length,y>=w.toValue(a)){d.value=x;break}}}},{deep:!0,immediate:!0});const g=w.computed(()=>{var p;return(p=w.toValue(c))==null?void 0:p[w.toValue(d)]});return{currentItemIndex:d,currentItem:g}};function KOe(o,a,c,d){if(a<0||c<0||a>=o.length)throw new Error("Invalid start or length");const g=a+c;return o.slice(0,a)+d+o.slice(g)}const XOe=(o,a)=>{var d;let c=0;for(let g=0;g<a;g++){const p=o[g];c+=(d=p==null?void 0:p.value)==null?void 0:d.length}return c},JOe=o=>{const{startOffset:a,showStr:c,value:d,currentItemIndex:g,currentItem:p,element:y}=o,x=w.ref(-1),T=w.ref(0),A=Zte({element:y}),M=w.ref(!1),P=Wte(),z=U=>{var q;if(w.toValue(M)&&w.toValue(A)&&!Mu((q=w.toValue(p))==null?void 0:q.value,U)){const Q=U,ee=Q;Q&&w.toValue(x)>=0&&(d.value=KOe(w.toValue(d),w.toValue(x),w.toValue(T),ee),T.value=Q.length)}};w.watch(()=>g,()=>{var U,q,Q,ee,le;if(["function"].includes((U=w.toValue(p))==null?void 0:U.type))return x.value=XOe(c.value,g.value),T.value=(Q=(q=w.toValue(p))==null?void 0:q.value)==null?void 0:Q.length,M.value=!0,P("selectFunction",{data:(ee=w.toValue(p))==null?void 0:ee.value,callback:({data:ae})=>{console.log(ae),z(ae)}}),!1;if([",","(","="].includes((le=w.toValue(p))==null?void 0:le.value))return x.value=w.toValue(a),M.value=!0,T.value=0,P("selectFunction",{data:"",callback:({data:ae})=>{console.log(ae),z(ae)}}),!1;M.value=!1,x.value=-1},{immediate:!0,deep:!0})},QOe={class:"node-formula"},eNe={class:"node-formula-show"},tNe=w.defineComponent({__name:"index",props:w.mergeModels({id:{type:String,default:""},editorId:{type:String,default:""}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const a=o,{getCellValue:c}=zOe({editorId:a==null?void 0:a.editorId}),d=w.useModel(o,"modelValue"),g=w.ref(),{startOffset:p}=WOe({element:g});UOe(g,d,p);const y=w.computed(()=>{const M=VOe(d.value);return M==null?void 0:M.map(z=>z.type==="cell"||z.type==="range"?{cellValue:c(z.value),...z}:z)}),x=w.computed(()=>{const M=HOe(d.value,y.value);let P=-1;return M.map(U=>(U==null?void 0:U.type)==="cell"||(U==null?void 0:U.type)==="range"?(P++,{...U,color:Ure[P%Ure.length]}):(U==null?void 0:U.type)==="function"?{...U,color:"#0318ff"}:U)});jOe({element:g,showStr:x,editorId:a==null?void 0:a.editorId});const{currentItemIndex:T,currentItem:A}=YOe({element:g,startOffset:p,value:d,showStr:x});return qOe({element:g,startOffset:p,showStr:x,editorId:a==null?void 0:a.editorId,value:d,currentItemIndex:T,currentItem:A}),JOe({element:g,startOffset:p,showStr:x,value:d,currentItemIndex:T,currentItem:A}),(M,P)=>(w.openBlock(),w.createElementBlock("div",QOe,[w.createElementVNode("div",{contenteditable:"true",ref_key:"formulaRef",ref:g,class:"node-formula-input"},null,512),w.createElementVNode("div",eNe,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(x.value,(z,U)=>(w.openBlock(),w.createElementBlock("span",{key:U,class:w.normalizeClass(["node-formula-item",`node-formula-item-type-${z==null?void 0:z.type}`,U===w.unref(T)?"node-formula-item-active":""]),style:w.normalizeStyle({"--text-color":(z==null?void 0:z.color)||"#000","--bg-color":w.unref(Ute)((z==null?void 0:z.color)||"#000",.1)})},w.toDisplayString(z.value),7))),128))])]))}}),Zle=cu(tNe,[["__scopeId","data-v-f4b96eb4"]]),nNe=[{label:"平均值",value:"AVERAGE"},{label:"均值绝对偏差",value:"AVEDEV"},{label:"求和",value:"SUM"},{label:"条件判断",value:"IF"},{label:"统计数量",value:"COUNT"},{label:"最大值",value:"MAX"},{label:"最小值",value:"MIN"},{label:"正平方根",value:"SQRT"}],oNe={class:"select-function"},sNe=["onClick"],rNe={class:"function-item"},aNe={class:"function-item-desc"},iNe=w.defineComponent({__name:"index",props:w.mergeModels({id:{type:String,default:""},functionList:{type:Array,default:()=>[]}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const a=o;let c=null;const d=w.computed(()=>{var y;return((y=a.functionList)==null?void 0:y.length)>0?a.functionList:nNe}),g=w.useModel(o,"modelValue"),p=y=>{g.value=y,c==null||c({data:y})};return Ule("selectFunction",({data:y,callback:x})=>{c=x,g.value=y}),(y,x)=>(w.openBlock(),w.createElementBlock("div",oNe,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(d.value,(T,A)=>(w.openBlock(),w.createElementBlock("div",{key:A},[w.createElementVNode("div",{onClick:()=>{p(T.value)},class:w.normalizeClass(["function-item-wrapper",{active:g.value===T.value}])},[w.createElementVNode("div",rNe,w.toDisplayString(T.value),1),w.createElementVNode("div",aNe,w.toDisplayString(T.label),1)],10,sNe)]))),128))]))}}),Gle=cu(iNe,[["__scopeId","data-v-6e079ff0"]]),cNe=["innerHTML"],qle=w.defineComponent({__name:"index",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const a=w.useModel(o,"modelValue");return(c,d)=>(w.openBlock(),w.createBlock(Hte,null,{default:w.withCtx(()=>[w.createElementVNode("div",{innerHTML:a.value},null,8,cNe)]),_:1}))}});function wz(o){return w.getCurrentScope()?(w.onScopeDispose(o),!0):!1}function p0(o){return typeof o=="function"?o():w.unref(o)}const lNe=typeof window<"u"&&typeof document<"u",uNe=o=>typeof o<"u",dNe=Object.prototype.toString,fNe=o=>dNe.call(o)==="[object Object]",mNe=()=>{};function gNe(o,a){function c(...d){return new Promise((g,p)=>{Promise.resolve(o(()=>a.apply(this,d),{fn:a,thisArg:this,args:d})).then(g).catch(p)})}return c}const Yle=o=>o();function hNe(o=Yle){const a=w.ref(!0);function c(){a.value=!1}function d(){a.value=!0}const g=(...p)=>{a.value&&o(...p)};return{isActive:w.readonly(a),pause:c,resume:d,eventFilter:g}}function jre(o,a=!1,c="Timeout"){return new Promise((d,g)=>{setTimeout(a?()=>g(c):d,o)})}function pNe(o,a,c={}){const{eventFilter:d=Yle,...g}=c;return w.watch(o,gNe(d,a),g)}function m4(o,a,c={}){const{eventFilter:d,...g}=c,{eventFilter:p,pause:y,resume:x,isActive:T}=hNe(d);return{stop:pNe(o,a,{...g,eventFilter:p}),pause:y,resume:x,isActive:T}}function bNe(o,a={}){if(!w.isRef(o))return w.toRefs(o);const c=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const d in o.value)c[d]=w.customRef(()=>({get(){return o.value[d]},set(g){var p;if((p=p0(a.replaceRef))!=null?p:!0)if(Array.isArray(o.value)){const x=[...o.value];x[d]=g,o.value=x}else{const x={...o.value,[d]:g};Object.setPrototypeOf(x,Object.getPrototypeOf(o.value)),o.value=x}else o.value[d]=g}}));return c}function Fee(o,a=!1){function c(P,{flush:z="sync",deep:U=!1,timeout:q,throwOnTimeout:Q}={}){let ee=null;const ae=[new Promise(Z=>{ee=w.watch(o,Ae=>{P(Ae)!==a&&(ee==null||ee(),Z(Ae))},{flush:z,deep:U,immediate:!0})})];return q!=null&&ae.push(jre(q,Q).then(()=>p0(o)).finally(()=>ee==null?void 0:ee())),Promise.race(ae)}function d(P,z){if(!w.isRef(P))return c(Ae=>Ae===P,z);const{flush:U="sync",deep:q=!1,timeout:Q,throwOnTimeout:ee}=z??{};let le=null;const Z=[new Promise(Ae=>{le=w.watch([o,P],([mt,Le])=>{a!==(mt===Le)&&(le==null||le(),Ae(mt))},{flush:U,deep:q,immediate:!0})})];return Q!=null&&Z.push(jre(Q,ee).then(()=>p0(o)).finally(()=>(le==null||le(),p0(o)))),Promise.race(Z)}function g(P){return c(z=>!!z,P)}function p(P){return d(null,P)}function y(P){return d(void 0,P)}function x(P){return c(Number.isNaN,P)}function T(P,z){return c(U=>{const q=Array.from(U);return q.includes(P)||q.includes(p0(P))},z)}function A(P){return M(1,P)}function M(P=1,z){let U=-1;return c(()=>(U+=1,U>=P),z)}return Array.isArray(p0(o))?{toMatch:c,toContains:T,changed:A,changedTimes:M,get not(){return Fee(o,!a)}}:{toMatch:c,toBe:d,toBeTruthy:g,toBeNull:p,toBeNaN:x,toBeUndefined:y,changed:A,changedTimes:M,get not(){return Fee(o,!a)}}}function Lee(o){return Fee(o)}function vNe(o){var a;const c=p0(o);return(a=c==null?void 0:c.$el)!=null?a:c}const Kle=lNe?window:void 0;function Xle(...o){let a,c,d,g;if(typeof o[0]=="string"||Array.isArray(o[0])?([c,d,g]=o,a=Kle):[a,c,d,g]=o,!a)return mNe;Array.isArray(c)||(c=[c]),Array.isArray(d)||(d=[d]);const p=[],y=()=>{p.forEach(M=>M()),p.length=0},x=(M,P,z,U)=>(M.addEventListener(P,z,U),()=>M.removeEventListener(P,z,U)),T=w.watch(()=>[vNe(a),p0(g)],([M,P])=>{if(y(),!M)return;const z=fNe(P)?{...P}:P;p.push(...c.flatMap(U=>d.map(q=>x(M,U,q,z))))},{immediate:!0,flush:"post"}),A=()=>{T(),y()};return wz(A),A}function yNe(o){return typeof o=="function"?o:typeof o=="string"?a=>a.key===o:Array.isArray(o)?a=>o.includes(a.key):()=>!0}function Wre(...o){let a,c,d={};o.length===3?(a=o[0],c=o[1],d=o[2]):o.length===2?typeof o[1]=="object"?(a=!0,c=o[0],d=o[1]):(a=o[0],c=o[1]):(a=!0,c=o[0]);const{target:g=Kle,eventName:p="keydown",passive:y=!1,dedupe:x=!1}=d,T=yNe(a);return Xle(g,p,M=>{M.repeat&&p0(x)||T(M)&&c(M)},y)}function wNe(o){return JSON.parse(JSON.stringify(o))}function FQ(o,a,c,d={}){var g,p,y;const{clone:x=!1,passive:T=!1,eventName:A,deep:M=!1,defaultValue:P,shouldEmit:z}=d,U=w.getCurrentInstance(),q=c||(U==null?void 0:U.emit)||((g=U==null?void 0:U.$emit)==null?void 0:g.bind(U))||((y=(p=U==null?void 0:U.proxy)==null?void 0:p.$emit)==null?void 0:y.bind(U==null?void 0:U.proxy));let Q=A;a||(a="modelValue"),Q=Q||`update:${a.toString()}`;const ee=Z=>x?typeof x=="function"?x(Z):wNe(Z):Z,le=()=>uNe(o[a])?ee(o[a]):P,ae=Z=>{z?z(Z)&&q(Q,Z):q(Q,Z)};if(T){const Z=le(),Ae=w.ref(Z);let mt=!1;return w.watch(()=>o[a],Le=>{mt||(mt=!0,Ae.value=ee(Le),w.nextTick(()=>mt=!1))}),w.watch(Ae,Le=>{!mt&&(Le!==o[a]||M)&&ae(Le)},{deep:M}),Ae}else return w.computed({get(){return le()},set(Z){ae(Z)}})}var CNe={value:()=>{}};function Cz(){for(var o=0,a=arguments.length,c={},d;o<a;++o){if(!(d=arguments[o]+"")||d in c||/[\s.]/.test(d))throw new Error("illegal type: "+d);c[d]=[]}return new JV(c)}function JV(o){this._=o}function SNe(o,a){return o.trim().split(/^|\s+/).map(function(c){var d="",g=c.indexOf(".");if(g>=0&&(d=c.slice(g+1),c=c.slice(0,g)),c&&!a.hasOwnProperty(c))throw new Error("unknown type: "+c);return{type:c,name:d}})}JV.prototype=Cz.prototype={constructor:JV,on:function(o,a){var c=this._,d=SNe(o+"",c),g,p=-1,y=d.length;if(arguments.length<2){for(;++p<y;)if((g=(o=d[p]).type)&&(g=xNe(c[g],o.name)))return g;return}if(a!=null&&typeof a!="function")throw new Error("invalid callback: "+a);for(;++p<y;)if(g=(o=d[p]).type)c[g]=Zre(c[g],o.name,a);else if(a==null)for(g in c)c[g]=Zre(c[g],o.name,null);return this},copy:function(){var o={},a=this._;for(var c in a)o[c]=a[c].slice();return new JV(o)},call:function(o,a){if((g=arguments.length-2)>0)for(var c=new Array(g),d=0,g,p;d<g;++d)c[d]=arguments[d+2];if(!this._.hasOwnProperty(o))throw new Error("unknown type: "+o);for(p=this._[o],d=0,g=p.length;d<g;++d)p[d].value.apply(a,c)},apply:function(o,a,c){if(!this._.hasOwnProperty(o))throw new Error("unknown type: "+o);for(var d=this._[o],g=0,p=d.length;g<p;++g)d[g].value.apply(a,c)}};function xNe(o,a){for(var c=0,d=o.length,g;c<d;++c)if((g=o[c]).name===a)return g.value}function Zre(o,a,c){for(var d=0,g=o.length;d<g;++d)if(o[d].name===a){o[d]=CNe,o=o.slice(0,d).concat(o.slice(d+1));break}return c!=null&&o.push({name:a,value:c}),o}var Vee="http://www.w3.org/1999/xhtml";const Gre={svg:"http://www.w3.org/2000/svg",xhtml:Vee,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Sz(o){var a=o+="",c=a.indexOf(":");return c>=0&&(a=o.slice(0,c))!=="xmlns"&&(o=o.slice(c+1)),Gre.hasOwnProperty(a)?{space:Gre[a],local:o}:o}function ENe(o){return function(){var a=this.ownerDocument,c=this.namespaceURI;return c===Vee&&a.documentElement.namespaceURI===Vee?a.createElement(o):a.createElementNS(c,o)}}function _Ne(o){return function(){return this.ownerDocument.createElementNS(o.space,o.local)}}function Jle(o){var a=Sz(o);return(a.local?_Ne:ENe)(a)}function TNe(){}function Gte(o){return o==null?TNe:function(){return this.querySelector(o)}}function kNe(o){typeof o!="function"&&(o=Gte(o));for(var a=this._groups,c=a.length,d=new Array(c),g=0;g<c;++g)for(var p=a[g],y=p.length,x=d[g]=new Array(y),T,A,M=0;M<y;++M)(T=p[M])&&(A=o.call(T,T.__data__,M,p))&&("__data__"in T&&(A.__data__=T.__data__),x[M]=A);return new pg(d,this._parents)}function ANe(o){return o==null?[]:Array.isArray(o)?o:Array.from(o)}function ONe(){return[]}function Qle(o){return o==null?ONe:function(){return this.querySelectorAll(o)}}function NNe(o){return function(){return ANe(o.apply(this,arguments))}}function $Ne(o){typeof o=="function"?o=NNe(o):o=Qle(o);for(var a=this._groups,c=a.length,d=[],g=[],p=0;p<c;++p)for(var y=a[p],x=y.length,T,A=0;A<x;++A)(T=y[A])&&(d.push(o.call(T,T.__data__,A,y)),g.push(T));return new pg(d,g)}function eue(o){return function(){return this.matches(o)}}function tue(o){return function(a){return a.matches(o)}}var DNe=Array.prototype.find;function MNe(o){return function(){return DNe.call(this.children,o)}}function RNe(){return this.firstElementChild}function INe(o){return this.select(o==null?RNe:MNe(typeof o=="function"?o:tue(o)))}var PNe=Array.prototype.filter;function BNe(){return Array.from(this.children)}function FNe(o){return function(){return PNe.call(this.children,o)}}function LNe(o){return this.selectAll(o==null?BNe:FNe(typeof o=="function"?o:tue(o)))}function VNe(o){typeof o!="function"&&(o=eue(o));for(var a=this._groups,c=a.length,d=new Array(c),g=0;g<c;++g)for(var p=a[g],y=p.length,x=d[g]=[],T,A=0;A<y;++A)(T=p[A])&&o.call(T,T.__data__,A,p)&&x.push(T);return new pg(d,this._parents)}function nue(o){return new Array(o.length)}function HNe(){return new pg(this._enter||this._groups.map(nue),this._parents)}function SH(o,a){this.ownerDocument=o.ownerDocument,this.namespaceURI=o.namespaceURI,this._next=null,this._parent=o,this.__data__=a}SH.prototype={constructor:SH,appendChild:function(o){return this._parent.insertBefore(o,this._next)},insertBefore:function(o,a){return this._parent.insertBefore(o,a)},querySelector:function(o){return this._parent.querySelector(o)},querySelectorAll:function(o){return this._parent.querySelectorAll(o)}};function zNe(o){return function(){return o}}function UNe(o,a,c,d,g,p){for(var y=0,x,T=a.length,A=p.length;y<A;++y)(x=a[y])?(x.__data__=p[y],d[y]=x):c[y]=new SH(o,p[y]);for(;y<T;++y)(x=a[y])&&(g[y]=x)}function jNe(o,a,c,d,g,p,y){var x,T,A=new Map,M=a.length,P=p.length,z=new Array(M),U;for(x=0;x<M;++x)(T=a[x])&&(z[x]=U=y.call(T,T.__data__,x,a)+"",A.has(U)?g[x]=T:A.set(U,T));for(x=0;x<P;++x)U=y.call(o,p[x],x,p)+"",(T=A.get(U))?(d[x]=T,T.__data__=p[x],A.delete(U)):c[x]=new SH(o,p[x]);for(x=0;x<M;++x)(T=a[x])&&A.get(z[x])===T&&(g[x]=T)}function WNe(o){return o.__data__}function ZNe(o,a){if(!arguments.length)return Array.from(this,WNe);var c=a?jNe:UNe,d=this._parents,g=this._groups;typeof o!="function"&&(o=zNe(o));for(var p=g.length,y=new Array(p),x=new Array(p),T=new Array(p),A=0;A<p;++A){var M=d[A],P=g[A],z=P.length,U=GNe(o.call(M,M&&M.__data__,A,d)),q=U.length,Q=x[A]=new Array(q),ee=y[A]=new Array(q),le=T[A]=new Array(z);c(M,P,Q,ee,le,U,a);for(var ae=0,Z=0,Ae,mt;ae<q;++ae)if(Ae=Q[ae]){for(ae>=Z&&(Z=ae+1);!(mt=ee[Z])&&++Z<q;);Ae._next=mt||null}}return y=new pg(y,d),y._enter=x,y._exit=T,y}function GNe(o){return typeof o=="object"&&"length"in o?o:Array.from(o)}function qNe(){return new pg(this._exit||this._groups.map(nue),this._parents)}function YNe(o,a,c){var d=this.enter(),g=this,p=this.exit();return typeof o=="function"?(d=o(d),d&&(d=d.selection())):d=d.append(o+""),a!=null&&(g=a(g),g&&(g=g.selection())),c==null?p.remove():c(p),d&&g?d.merge(g).order():g}function KNe(o){for(var a=o.selection?o.selection():o,c=this._groups,d=a._groups,g=c.length,p=d.length,y=Math.min(g,p),x=new Array(g),T=0;T<y;++T)for(var A=c[T],M=d[T],P=A.length,z=x[T]=new Array(P),U,q=0;q<P;++q)(U=A[q]||M[q])&&(z[q]=U);for(;T<g;++T)x[T]=c[T];return new pg(x,this._parents)}function XNe(){for(var o=this._groups,a=-1,c=o.length;++a<c;)for(var d=o[a],g=d.length-1,p=d[g],y;--g>=0;)(y=d[g])&&(p&&y.compareDocumentPosition(p)^4&&p.parentNode.insertBefore(y,p),p=y);return this}function JNe(o){o||(o=QNe);function a(P,z){return P&&z?o(P.__data__,z.__data__):!P-!z}for(var c=this._groups,d=c.length,g=new Array(d),p=0;p<d;++p){for(var y=c[p],x=y.length,T=g[p]=new Array(x),A,M=0;M<x;++M)(A=y[M])&&(T[M]=A);T.sort(a)}return new pg(g,this._parents).order()}function QNe(o,a){return o<a?-1:o>a?1:o>=a?0:NaN}function e5e(){var o=arguments[0];return arguments[0]=this,o.apply(null,arguments),this}function t5e(){return Array.from(this)}function n5e(){for(var o=this._groups,a=0,c=o.length;a<c;++a)for(var d=o[a],g=0,p=d.length;g<p;++g){var y=d[g];if(y)return y}return null}function o5e(){let o=0;for(const a of this)++o;return o}function s5e(){return!this.node()}function r5e(o){for(var a=this._groups,c=0,d=a.length;c<d;++c)for(var g=a[c],p=0,y=g.length,x;p<y;++p)(x=g[p])&&o.call(x,x.__data__,p,g);return this}function a5e(o){return function(){this.removeAttribute(o)}}function i5e(o){return function(){this.removeAttributeNS(o.space,o.local)}}function c5e(o,a){return function(){this.setAttribute(o,a)}}function l5e(o,a){return function(){this.setAttributeNS(o.space,o.local,a)}}function u5e(o,a){return function(){var c=a.apply(this,arguments);c==null?this.removeAttribute(o):this.setAttribute(o,c)}}function d5e(o,a){return function(){var c=a.apply(this,arguments);c==null?this.removeAttributeNS(o.space,o.local):this.setAttributeNS(o.space,o.local,c)}}function f5e(o,a){var c=Sz(o);if(arguments.length<2){var d=this.node();return c.local?d.getAttributeNS(c.space,c.local):d.getAttribute(c)}return this.each((a==null?c.local?i5e:a5e:typeof a=="function"?c.local?d5e:u5e:c.local?l5e:c5e)(c,a))}function oue(o){return o.ownerDocument&&o.ownerDocument.defaultView||o.document&&o||o.defaultView}function m5e(o){return function(){this.style.removeProperty(o)}}function g5e(o,a,c){return function(){this.style.setProperty(o,a,c)}}function h5e(o,a,c){return function(){var d=a.apply(this,arguments);d==null?this.style.removeProperty(o):this.style.setProperty(o,d,c)}}function p5e(o,a,c){return arguments.length>1?this.each((a==null?m5e:typeof a=="function"?h5e:g5e)(o,a,c??"")):D4(this.node(),o)}function D4(o,a){return o.style.getPropertyValue(a)||oue(o).getComputedStyle(o,null).getPropertyValue(a)}function b5e(o){return function(){delete this[o]}}function v5e(o,a){return function(){this[o]=a}}function y5e(o,a){return function(){var c=a.apply(this,arguments);c==null?delete this[o]:this[o]=c}}function w5e(o,a){return arguments.length>1?this.each((a==null?b5e:typeof a=="function"?y5e:v5e)(o,a)):this.node()[o]}function sue(o){return o.trim().split(/^|\s+/)}function qte(o){return o.classList||new rue(o)}function rue(o){this._node=o,this._names=sue(o.getAttribute("class")||"")}rue.prototype={add:function(o){var a=this._names.indexOf(o);a<0&&(this._names.push(o),this._node.setAttribute("class",this._names.join(" ")))},remove:function(o){var a=this._names.indexOf(o);a>=0&&(this._names.splice(a,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(o){return this._names.indexOf(o)>=0}};function aue(o,a){for(var c=qte(o),d=-1,g=a.length;++d<g;)c.add(a[d])}function iue(o,a){for(var c=qte(o),d=-1,g=a.length;++d<g;)c.remove(a[d])}function C5e(o){return function(){aue(this,o)}}function S5e(o){return function(){iue(this,o)}}function x5e(o,a){return function(){(a.apply(this,arguments)?aue:iue)(this,o)}}function E5e(o,a){var c=sue(o+"");if(arguments.length<2){for(var d=qte(this.node()),g=-1,p=c.length;++g<p;)if(!d.contains(c[g]))return!1;return!0}return this.each((typeof a=="function"?x5e:a?C5e:S5e)(c,a))}function _5e(){this.textContent=""}function T5e(o){return function(){this.textContent=o}}function k5e(o){return function(){var a=o.apply(this,arguments);this.textContent=a??""}}function A5e(o){return arguments.length?this.each(o==null?_5e:(typeof o=="function"?k5e:T5e)(o)):this.node().textContent}function O5e(){this.innerHTML=""}function N5e(o){return function(){this.innerHTML=o}}function $5e(o){return function(){var a=o.apply(this,arguments);this.innerHTML=a??""}}function D5e(o){return arguments.length?this.each(o==null?O5e:(typeof o=="function"?$5e:N5e)(o)):this.node().innerHTML}function M5e(){this.nextSibling&&this.parentNode.appendChild(this)}function R5e(){return this.each(M5e)}function I5e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function P5e(){return this.each(I5e)}function B5e(o){var a=typeof o=="function"?o:Jle(o);return this.select(function(){return this.appendChild(a.apply(this,arguments))})}function F5e(){return null}function L5e(o,a){var c=typeof o=="function"?o:Jle(o),d=a==null?F5e:typeof a=="function"?a:Gte(a);return this.select(function(){return this.insertBefore(c.apply(this,arguments),d.apply(this,arguments)||null)})}function V5e(){var o=this.parentNode;o&&o.removeChild(this)}function H5e(){return this.each(V5e)}function z5e(){var o=this.cloneNode(!1),a=this.parentNode;return a?a.insertBefore(o,this.nextSibling):o}function U5e(){var o=this.cloneNode(!0),a=this.parentNode;return a?a.insertBefore(o,this.nextSibling):o}function j5e(o){return this.select(o?U5e:z5e)}function W5e(o){return arguments.length?this.property("__data__",o):this.node().__data__}function Z5e(o){return function(a){o.call(this,a,this.__data__)}}function G5e(o){return o.trim().split(/^|\s+/).map(function(a){var c="",d=a.indexOf(".");return d>=0&&(c=a.slice(d+1),a=a.slice(0,d)),{type:a,name:c}})}function q5e(o){return function(){var a=this.__on;if(a){for(var c=0,d=-1,g=a.length,p;c<g;++c)p=a[c],(!o.type||p.type===o.type)&&p.name===o.name?this.removeEventListener(p.type,p.listener,p.options):a[++d]=p;++d?a.length=d:delete this.__on}}}function Y5e(o,a,c){return function(){var d=this.__on,g,p=Z5e(a);if(d){for(var y=0,x=d.length;y<x;++y)if((g=d[y]).type===o.type&&g.name===o.name){this.removeEventListener(g.type,g.listener,g.options),this.addEventListener(g.type,g.listener=p,g.options=c),g.value=a;return}}this.addEventListener(o.type,p,c),g={type:o.type,name:o.name,value:a,listener:p,options:c},d?d.push(g):this.__on=[g]}}function K5e(o,a,c){var d=G5e(o+""),g,p=d.length,y;if(arguments.length<2){var x=this.node().__on;if(x){for(var T=0,A=x.length,M;T<A;++T)for(g=0,M=x[T];g<p;++g)if((y=d[g]).type===M.type&&y.name===M.name)return M.value}return}for(x=a?Y5e:q5e,g=0;g<p;++g)this.each(x(d[g],a,c));return this}function cue(o,a,c){var d=oue(o),g=d.CustomEvent;typeof g=="function"?g=new g(a,c):(g=d.document.createEvent("Event"),c?(g.initEvent(a,c.bubbles,c.cancelable),g.detail=c.detail):g.initEvent(a,!1,!1)),o.dispatchEvent(g)}function X5e(o,a){return function(){return cue(this,o,a)}}function J5e(o,a){return function(){return cue(this,o,a.apply(this,arguments))}}function Q5e(o,a){return this.each((typeof a=="function"?J5e:X5e)(o,a))}function*e$e(){for(var o=this._groups,a=0,c=o.length;a<c;++a)for(var d=o[a],g=0,p=d.length,y;g<p;++g)(y=d[g])&&(yield y)}var lue=[null];function pg(o,a){this._groups=o,this._parents=a}function IM(){return new pg([[document.documentElement]],lue)}function t$e(){return this}pg.prototype=IM.prototype={constructor:pg,select:kNe,selectAll:$Ne,selectChild:INe,selectChildren:LNe,filter:VNe,data:ZNe,enter:HNe,exit:qNe,join:YNe,merge:KNe,selection:t$e,order:XNe,sort:JNe,call:e5e,nodes:t5e,node:n5e,size:o5e,empty:s5e,each:r5e,attr:f5e,style:p5e,property:w5e,classed:E5e,text:A5e,html:D5e,raise:R5e,lower:P5e,append:B5e,insert:L5e,remove:H5e,clone:j5e,datum:W5e,on:K5e,dispatch:Q5e,[Symbol.iterator]:e$e};function kp(o){return typeof o=="string"?new pg([[document.querySelector(o)]],[document.documentElement]):new pg([[o]],lue)}function n$e(o){let a;for(;a=o.sourceEvent;)o=a;return o}function gb(o,a){if(o=n$e(o),a===void 0&&(a=o.currentTarget),a){var c=a.ownerSVGElement||a;if(c.createSVGPoint){var d=c.createSVGPoint();return d.x=o.clientX,d.y=o.clientY,d=d.matrixTransform(a.getScreenCTM().inverse()),[d.x,d.y]}if(a.getBoundingClientRect){var g=a.getBoundingClientRect();return[o.clientX-g.left-a.clientLeft,o.clientY-g.top-a.clientTop]}}return[o.pageX,o.pageY]}const o$e={passive:!1},hM={capture:!0,passive:!1};function LQ(o){o.stopImmediatePropagation()}function _4(o){o.preventDefault(),o.stopImmediatePropagation()}function uue(o){var a=o.document.documentElement,c=kp(o).on("dragstart.drag",_4,hM);"onselectstart"in a?c.on("selectstart.drag",_4,hM):(a.__noselect=a.style.MozUserSelect,a.style.MozUserSelect="none")}function due(o,a){var c=o.document.documentElement,d=kp(o).on("dragstart.drag",null);a&&(d.on("click.drag",_4,hM),setTimeout(function(){d.on("click.drag",null)},0)),"onselectstart"in c?d.on("selectstart.drag",null):(c.style.MozUserSelect=c.__noselect,delete c.__noselect)}const $V=o=>()=>o;function Hee(o,{sourceEvent:a,subject:c,target:d,identifier:g,active:p,x:y,y:x,dx:T,dy:A,dispatch:M}){Object.defineProperties(this,{type:{value:o,enumerable:!0,configurable:!0},sourceEvent:{value:a,enumerable:!0,configurable:!0},subject:{value:c,enumerable:!0,configurable:!0},target:{value:d,enumerable:!0,configurable:!0},identifier:{value:g,enumerable:!0,configurable:!0},active:{value:p,enumerable:!0,configurable:!0},x:{value:y,enumerable:!0,configurable:!0},y:{value:x,enumerable:!0,configurable:!0},dx:{value:T,enumerable:!0,configurable:!0},dy:{value:A,enumerable:!0,configurable:!0},_:{value:M}})}Hee.prototype.on=function(){var o=this._.on.apply(this._,arguments);return o===this._?this:o};function s$e(o){return!o.ctrlKey&&!o.button}function r$e(){return this.parentNode}function a$e(o,a){return a??{x:o.x,y:o.y}}function i$e(){return navigator.maxTouchPoints||"ontouchstart"in this}function c$e(){var o=s$e,a=r$e,c=a$e,d=i$e,g={},p=Cz("start","drag","end"),y=0,x,T,A,M,P=0;function z(Ae){Ae.on("mousedown.drag",U).filter(d).on("touchstart.drag",ee).on("touchmove.drag",le,o$e).on("touchend.drag touchcancel.drag",ae).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U(Ae,mt){if(!(M||!o.call(this,Ae,mt))){var Le=Z(this,a.call(this,Ae,mt),Ae,mt,"mouse");Le&&(kp(Ae.view).on("mousemove.drag",q,hM).on("mouseup.drag",Q,hM),uue(Ae.view),LQ(Ae),A=!1,x=Ae.clientX,T=Ae.clientY,Le("start",Ae))}}function q(Ae){if(_4(Ae),!A){var mt=Ae.clientX-x,Le=Ae.clientY-T;A=mt*mt+Le*Le>P}g.mouse("drag",Ae)}function Q(Ae){kp(Ae.view).on("mousemove.drag mouseup.drag",null),due(Ae.view,A),_4(Ae),g.mouse("end",Ae)}function ee(Ae,mt){if(o.call(this,Ae,mt)){var Le=Ae.changedTouches,J=a.call(this,Ae,mt),Ge=Le.length,vt,yt;for(vt=0;vt<Ge;++vt)(yt=Z(this,J,Ae,mt,Le[vt].identifier,Le[vt]))&&(LQ(Ae),yt("start",Ae,Le[vt]))}}function le(Ae){var mt=Ae.changedTouches,Le=mt.length,J,Ge;for(J=0;J<Le;++J)(Ge=g[mt[J].identifier])&&(_4(Ae),Ge("drag",Ae,mt[J]))}function ae(Ae){var mt=Ae.changedTouches,Le=mt.length,J,Ge;for(M&&clearTimeout(M),M=setTimeout(function(){M=null},500),J=0;J<Le;++J)(Ge=g[mt[J].identifier])&&(LQ(Ae),Ge("end",Ae,mt[J]))}function Z(Ae,mt,Le,J,Ge,vt){var yt=p.copy(),De=gb(vt||Le,mt),ue,Vt,we;if((we=c.call(Ae,new Hee("beforestart",{sourceEvent:Le,target:z,identifier:Ge,active:y,x:De[0],y:De[1],dx:0,dy:0,dispatch:yt}),J))!=null)return ue=we.x-De[0]||0,Vt=we.y-De[1]||0,function Ie(D,Ue,be){var tt=De,nt;switch(D){case"start":g[Ge]=Ie,nt=y++;break;case"end":delete g[Ge],--y;case"drag":De=gb(be||Ue,mt),nt=y;break}yt.call(D,Ae,new Hee(D,{sourceEvent:Ue,subject:we,target:z,identifier:Ge,active:nt,x:De[0]+ue,y:De[1]+Vt,dx:De[0]-tt[0],dy:De[1]-tt[1],dispatch:yt}),J)}}return z.filter=function(Ae){return arguments.length?(o=typeof Ae=="function"?Ae:$V(!!Ae),z):o},z.container=function(Ae){return arguments.length?(a=typeof Ae=="function"?Ae:$V(Ae),z):a},z.subject=function(Ae){return arguments.length?(c=typeof Ae=="function"?Ae:$V(Ae),z):c},z.touchable=function(Ae){return arguments.length?(d=typeof Ae=="function"?Ae:$V(!!Ae),z):d},z.on=function(){var Ae=p.on.apply(p,arguments);return Ae===p?z:Ae},z.clickDistance=function(Ae){return arguments.length?(P=(Ae=+Ae)*Ae,z):Math.sqrt(P)},z}function Yte(o,a,c){o.prototype=a.prototype=c,c.constructor=o}function fue(o,a){var c=Object.create(o.prototype);for(var d in a)c[d]=a[d];return c}function PM(){}var pM=.7,xH=1/pM,T4="\\s*([+-]?\\d+)\\s*",bM="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",l$e=/^#([0-9a-f]{3,8})$/,u$e=new RegExp(`^rgb\\(${T4},${T4},${T4}\\)$`),d$e=new RegExp(`^rgb\\(${pb},${pb},${pb}\\)$`),f$e=new RegExp(`^rgba\\(${T4},${T4},${T4},${bM}\\)$`),m$e=new RegExp(`^rgba\\(${pb},${pb},${pb},${bM}\\)$`),g$e=new RegExp(`^hsl\\(${bM},${pb},${pb}\\)$`),h$e=new RegExp(`^hsla\\(${bM},${pb},${pb},${bM}\\)$`),qre={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Yte(PM,vM,{copy(o){return Object.assign(new this.constructor,this,o)},displayable(){return this.rgb().displayable()},hex:Yre,formatHex:Yre,formatHex8:p$e,formatHsl:b$e,formatRgb:Kre,toString:Kre});function Yre(){return this.rgb().formatHex()}function p$e(){return this.rgb().formatHex8()}function b$e(){return mue(this).formatHsl()}function Kre(){return this.rgb().formatRgb()}function vM(o){var a,c;return o=(o+"").trim().toLowerCase(),(a=l$e.exec(o))?(c=a[1].length,a=parseInt(a[1],16),c===6?Xre(a):c===3?new bm(a>>8&15|a>>4&240,a>>4&15|a&240,(a&15)<<4|a&15,1):c===8?DV(a>>24&255,a>>16&255,a>>8&255,(a&255)/255):c===4?DV(a>>12&15|a>>8&240,a>>8&15|a>>4&240,a>>4&15|a&240,((a&15)<<4|a&15)/255):null):(a=u$e.exec(o))?new bm(a[1],a[2],a[3],1):(a=d$e.exec(o))?new bm(a[1]*255/100,a[2]*255/100,a[3]*255/100,1):(a=f$e.exec(o))?DV(a[1],a[2],a[3],a[4]):(a=m$e.exec(o))?DV(a[1]*255/100,a[2]*255/100,a[3]*255/100,a[4]):(a=g$e.exec(o))?eae(a[1],a[2]/100,a[3]/100,1):(a=h$e.exec(o))?eae(a[1],a[2]/100,a[3]/100,a[4]):qre.hasOwnProperty(o)?Xre(qre[o]):o==="transparent"?new bm(NaN,NaN,NaN,0):null}function Xre(o){return new bm(o>>16&255,o>>8&255,o&255,1)}function DV(o,a,c,d){return d<=0&&(o=a=c=NaN),new bm(o,a,c,d)}function v$e(o){return o instanceof PM||(o=vM(o)),o?(o=o.rgb(),new bm(o.r,o.g,o.b,o.opacity)):new bm}function zee(o,a,c,d){return arguments.length===1?v$e(o):new bm(o,a,c,d??1)}function bm(o,a,c,d){this.r=+o,this.g=+a,this.b=+c,this.opacity=+d}Yte(bm,zee,fue(PM,{brighter(o){return o=o==null?xH:Math.pow(xH,o),new bm(this.r*o,this.g*o,this.b*o,this.opacity)},darker(o){return o=o==null?pM:Math.pow(pM,o),new bm(this.r*o,this.g*o,this.b*o,this.opacity)},rgb(){return this},clamp(){return new bm(qx(this.r),qx(this.g),qx(this.b),EH(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Jre,formatHex:Jre,formatHex8:y$e,formatRgb:Qre,toString:Qre}));function Jre(){return`#${Hx(this.r)}${Hx(this.g)}${Hx(this.b)}`}function y$e(){return`#${Hx(this.r)}${Hx(this.g)}${Hx(this.b)}${Hx((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qre(){const o=EH(this.opacity);return`${o===1?"rgb(":"rgba("}${qx(this.r)}, ${qx(this.g)}, ${qx(this.b)}${o===1?")":`, ${o})`}`}function EH(o){return isNaN(o)?1:Math.max(0,Math.min(1,o))}function qx(o){return Math.max(0,Math.min(255,Math.round(o)||0))}function Hx(o){return o=qx(o),(o<16?"0":"")+o.toString(16)}function eae(o,a,c,d){return d<=0?o=a=c=NaN:c<=0||c>=1?o=a=NaN:a<=0&&(o=NaN),new Ap(o,a,c,d)}function mue(o){if(o instanceof Ap)return new Ap(o.h,o.s,o.l,o.opacity);if(o instanceof PM||(o=vM(o)),!o)return new Ap;if(o instanceof Ap)return o;o=o.rgb();var a=o.r/255,c=o.g/255,d=o.b/255,g=Math.min(a,c,d),p=Math.max(a,c,d),y=NaN,x=p-g,T=(p+g)/2;return x?(a===p?y=(c-d)/x+(c<d)*6:c===p?y=(d-a)/x+2:y=(a-c)/x+4,x/=T<.5?p+g:2-p-g,y*=60):x=T>0&&T<1?0:y,new Ap(y,x,T,o.opacity)}function w$e(o,a,c,d){return arguments.length===1?mue(o):new Ap(o,a,c,d??1)}function Ap(o,a,c,d){this.h=+o,this.s=+a,this.l=+c,this.opacity=+d}Yte(Ap,w$e,fue(PM,{brighter(o){return o=o==null?xH:Math.pow(xH,o),new Ap(this.h,this.s,this.l*o,this.opacity)},darker(o){return o=o==null?pM:Math.pow(pM,o),new Ap(this.h,this.s,this.l*o,this.opacity)},rgb(){var o=this.h%360+(this.h<0)*360,a=isNaN(o)||isNaN(this.s)?0:this.s,c=this.l,d=c+(c<.5?c:1-c)*a,g=2*c-d;return new bm(VQ(o>=240?o-240:o+120,g,d),VQ(o,g,d),VQ(o<120?o+240:o-120,g,d),this.opacity)},clamp(){return new Ap(tae(this.h),MV(this.s),MV(this.l),EH(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const o=EH(this.opacity);return`${o===1?"hsl(":"hsla("}${tae(this.h)}, ${MV(this.s)*100}%, ${MV(this.l)*100}%${o===1?")":`, ${o})`}`}}));function tae(o){return o=(o||0)%360,o<0?o+360:o}function MV(o){return Math.max(0,Math.min(1,o||0))}function VQ(o,a,c){return(o<60?a+(c-a)*o/60:o<180?c:o<240?a+(c-a)*(240-o)/60:a)*255}const gue=o=>()=>o;function C$e(o,a){return function(c){return o+c*a}}function S$e(o,a,c){return o=Math.pow(o,c),a=Math.pow(a,c)-o,c=1/c,function(d){return Math.pow(o+d*a,c)}}function x$e(o){return(o=+o)==1?hue:function(a,c){return c-a?S$e(a,c,o):gue(isNaN(a)?c:a)}}function hue(o,a){var c=a-o;return c?C$e(o,c):gue(isNaN(o)?a:o)}const nae=function o(a){var c=x$e(a);function d(g,p){var y=c((g=zee(g)).r,(p=zee(p)).r),x=c(g.g,p.g),T=c(g.b,p.b),A=hue(g.opacity,p.opacity);return function(M){return g.r=y(M),g.g=x(M),g.b=T(M),g.opacity=A(M),g+""}}return d.gamma=o,d}(1);function Hw(o,a){return o=+o,a=+a,function(c){return o*(1-c)+a*c}}var Uee=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,HQ=new RegExp(Uee.source,"g");function E$e(o){return function(){return o}}function _$e(o){return function(a){return o(a)+""}}function T$e(o,a){var c=Uee.lastIndex=HQ.lastIndex=0,d,g,p,y=-1,x=[],T=[];for(o=o+"",a=a+"";(d=Uee.exec(o))&&(g=HQ.exec(a));)(p=g.index)>c&&(p=a.slice(c,p),x[y]?x[y]+=p:x[++y]=p),(d=d[0])===(g=g[0])?x[y]?x[y]+=g:x[++y]=g:(x[++y]=null,T.push({i:y,x:Hw(d,g)})),c=HQ.lastIndex;return c<a.length&&(p=a.slice(c),x[y]?x[y]+=p:x[++y]=p),x.length<2?T[0]?_$e(T[0].x):E$e(a):(a=T.length,function(A){for(var M=0,P;M<a;++M)x[(P=T[M]).i]=P.x(A);return x.join("")})}var oae=180/Math.PI,jee={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pue(o,a,c,d,g,p){var y,x,T;return(y=Math.sqrt(o*o+a*a))&&(o/=y,a/=y),(T=o*c+a*d)&&(c-=o*T,d-=a*T),(x=Math.sqrt(c*c+d*d))&&(c/=x,d/=x,T/=x),o*d<a*c&&(o=-o,a=-a,T=-T,y=-y),{translateX:g,translateY:p,rotate:Math.atan2(a,o)*oae,skewX:Math.atan(T)*oae,scaleX:y,scaleY:x}}var RV;function k$e(o){const a=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(o+"");return a.isIdentity?jee:pue(a.a,a.b,a.c,a.d,a.e,a.f)}function A$e(o){return o==null||(RV||(RV=document.createElementNS("http://www.w3.org/2000/svg","g")),RV.setAttribute("transform",o),!(o=RV.transform.baseVal.consolidate()))?jee:(o=o.matrix,pue(o.a,o.b,o.c,o.d,o.e,o.f))}function bue(o,a,c,d){function g(A){return A.length?A.pop()+" ":""}function p(A,M,P,z,U,q){if(A!==P||M!==z){var Q=U.push("translate(",null,a,null,c);q.push({i:Q-4,x:Hw(A,P)},{i:Q-2,x:Hw(M,z)})}else(P||z)&&U.push("translate("+P+a+z+c)}function y(A,M,P,z){A!==M?(A-M>180?M+=360:M-A>180&&(A+=360),z.push({i:P.push(g(P)+"rotate(",null,d)-2,x:Hw(A,M)})):M&&P.push(g(P)+"rotate("+M+d)}function x(A,M,P,z){A!==M?z.push({i:P.push(g(P)+"skewX(",null,d)-2,x:Hw(A,M)}):M&&P.push(g(P)+"skewX("+M+d)}function T(A,M,P,z,U,q){if(A!==P||M!==z){var Q=U.push(g(U)+"scale(",null,",",null,")");q.push({i:Q-4,x:Hw(A,P)},{i:Q-2,x:Hw(M,z)})}else(P!==1||z!==1)&&U.push(g(U)+"scale("+P+","+z+")")}return function(A,M){var P=[],z=[];return A=o(A),M=o(M),p(A.translateX,A.translateY,M.translateX,M.translateY,P,z),y(A.rotate,M.rotate,P,z),x(A.skewX,M.skewX,P,z),T(A.scaleX,A.scaleY,M.scaleX,M.scaleY,P,z),A=M=null,function(U){for(var q=-1,Q=z.length,ee;++q<Q;)P[(ee=z[q]).i]=ee.x(U);return P.join("")}}}var O$e=bue(k$e,"px, ","px)","deg)"),N$e=bue(A$e,", ",")",")"),$$e=1e-12;function sae(o){return((o=Math.exp(o))+1/o)/2}function D$e(o){return((o=Math.exp(o))-1/o)/2}function M$e(o){return((o=Math.exp(2*o))-1)/(o+1)}const R$e=function o(a,c,d){function g(p,y){var x=p[0],T=p[1],A=p[2],M=y[0],P=y[1],z=y[2],U=M-x,q=P-T,Q=U*U+q*q,ee,le;if(Q<$$e)le=Math.log(z/A)/a,ee=function(J){return[x+J*U,T+J*q,A*Math.exp(a*J*le)]};else{var ae=Math.sqrt(Q),Z=(z*z-A*A+d*Q)/(2*A*c*ae),Ae=(z*z-A*A-d*Q)/(2*z*c*ae),mt=Math.log(Math.sqrt(Z*Z+1)-Z),Le=Math.log(Math.sqrt(Ae*Ae+1)-Ae);le=(Le-mt)/a,ee=function(J){var Ge=J*le,vt=sae(mt),yt=A/(c*ae)*(vt*M$e(a*Ge+mt)-D$e(mt));return[x+yt*U,T+yt*q,A*vt/sae(a*Ge+mt)]}}return ee.duration=le*1e3*a/Math.SQRT2,ee}return g.rho=function(p){var y=Math.max(.001,+p),x=y*y,T=x*x;return o(y,x,T)},g}(Math.SQRT2,2,4);var M4=0,Y6=0,G6=0,vue=1e3,_H,K6,TH=0,Qx=0,xz=0,yM=typeof performance=="object"&&performance.now?performance:Date,yue=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(o){setTimeout(o,17)};function Kte(){return Qx||(yue(I$e),Qx=yM.now()+xz)}function I$e(){Qx=0}function kH(){this._call=this._time=this._next=null}kH.prototype=wue.prototype={constructor:kH,restart:function(o,a,c){if(typeof o!="function")throw new TypeError("callback is not a function");c=(c==null?Kte():+c)+(a==null?0:+a),!this._next&&K6!==this&&(K6?K6._next=this:_H=this,K6=this),this._call=o,this._time=c,Wee()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wee())}};function wue(o,a,c){var d=new kH;return d.restart(o,a,c),d}function P$e(){Kte(),++M4;for(var o=_H,a;o;)(a=Qx-o._time)>=0&&o._call.call(void 0,a),o=o._next;--M4}function rae(){Qx=(TH=yM.now())+xz,M4=Y6=0;try{P$e()}finally{M4=0,F$e(),Qx=0}}function B$e(){var o=yM.now(),a=o-TH;a>vue&&(xz-=a,TH=o)}function F$e(){for(var o,a=_H,c,d=1/0;a;)a._call?(d>a._time&&(d=a._time),o=a,a=a._next):(c=a._next,a._next=null,a=o?o._next=c:_H=c);K6=o,Wee(d)}function Wee(o){if(!M4){Y6&&(Y6=clearTimeout(Y6));var a=o-Qx;a>24?(o<1/0&&(Y6=setTimeout(rae,o-yM.now()-xz)),G6&&(G6=clearInterval(G6))):(G6||(TH=yM.now(),G6=setInterval(B$e,vue)),M4=1,yue(rae))}}function aae(o,a,c){var d=new kH;return a=a==null?0:+a,d.restart(g=>{d.stop(),o(g+a)},a,c),d}var L$e=Cz("start","end","cancel","interrupt"),V$e=[],Cue=0,iae=1,Zee=2,QV=3,cae=4,Gee=5,eH=6;function Ez(o,a,c,d,g,p){var y=o.__transition;if(!y)o.__transition={};else if(c in y)return;H$e(o,c,{name:a,index:d,group:g,on:L$e,tween:V$e,time:p.time,delay:p.delay,duration:p.duration,ease:p.ease,timer:null,state:Cue})}function Xte(o,a){var c=$p(o,a);if(c.state>Cue)throw new Error("too late; already scheduled");return c}function Cb(o,a){var c=$p(o,a);if(c.state>QV)throw new Error("too late; already running");return c}function $p(o,a){var c=o.__transition;if(!c||!(c=c[a]))throw new Error("transition not found");return c}function H$e(o,a,c){var d=o.__transition,g;d[a]=c,c.timer=wue(p,0,c.time);function p(A){c.state=iae,c.timer.restart(y,c.delay,c.time),c.delay<=A&&y(A-c.delay)}function y(A){var M,P,z,U;if(c.state!==iae)return T();for(M in d)if(U=d[M],U.name===c.name){if(U.state===QV)return aae(y);U.state===cae?(U.state=eH,U.timer.stop(),U.on.call("interrupt",o,o.__data__,U.index,U.group),delete d[M]):+M<a&&(U.state=eH,U.timer.stop(),U.on.call("cancel",o,o.__data__,U.index,U.group),delete d[M])}if(aae(function(){c.state===QV&&(c.state=cae,c.timer.restart(x,c.delay,c.time),x(A))}),c.state=Zee,c.on.call("start",o,o.__data__,c.index,c.group),c.state===Zee){for(c.state=QV,g=new Array(z=c.tween.length),M=0,P=-1;M<z;++M)(U=c.tween[M].value.call(o,o.__data__,c.index,c.group))&&(g[++P]=U);g.length=P+1}}function x(A){for(var M=A<c.duration?c.ease.call(null,A/c.duration):(c.timer.restart(T),c.state=Gee,1),P=-1,z=g.length;++P<z;)g[P].call(o,M);c.state===Gee&&(c.on.call("end",o,o.__data__,c.index,c.group),T())}function T(){c.state=eH,c.timer.stop(),delete d[a];for(var A in d)return;delete o.__transition}}function tH(o,a){var c=o.__transition,d,g,p=!0,y;if(c){a=a==null?null:a+"";for(y in c){if((d=c[y]).name!==a){p=!1;continue}g=d.state>Zee&&d.state<Gee,d.state=eH,d.timer.stop(),d.on.call(g?"interrupt":"cancel",o,o.__data__,d.index,d.group),delete c[y]}p&&delete o.__transition}}function z$e(o){return this.each(function(){tH(this,o)})}function U$e(o,a){var c,d;return function(){var g=Cb(this,o),p=g.tween;if(p!==c){d=c=p;for(var y=0,x=d.length;y<x;++y)if(d[y].name===a){d=d.slice(),d.splice(y,1);break}}g.tween=d}}function j$e(o,a,c){var d,g;if(typeof c!="function")throw new Error;return function(){var p=Cb(this,o),y=p.tween;if(y!==d){g=(d=y).slice();for(var x={name:a,value:c},T=0,A=g.length;T<A;++T)if(g[T].name===a){g[T]=x;break}T===A&&g.push(x)}p.tween=g}}function W$e(o,a){var c=this._id;if(o+="",arguments.length<2){for(var d=$p(this.node(),c).tween,g=0,p=d.length,y;g<p;++g)if((y=d[g]).name===o)return y.value;return null}return this.each((a==null?U$e:j$e)(c,o,a))}function Jte(o,a,c){var d=o._id;return o.each(function(){var g=Cb(this,d);(g.value||(g.value={}))[a]=c.apply(this,arguments)}),function(g){return $p(g,d).value[a]}}function Sue(o,a){var c;return(typeof a=="number"?Hw:a instanceof vM?nae:(c=vM(a))?(a=c,nae):T$e)(o,a)}function Z$e(o){return function(){this.removeAttribute(o)}}function G$e(o){return function(){this.removeAttributeNS(o.space,o.local)}}function q$e(o,a,c){var d,g=c+"",p;return function(){var y=this.getAttribute(o);return y===g?null:y===d?p:p=a(d=y,c)}}function Y$e(o,a,c){var d,g=c+"",p;return function(){var y=this.getAttributeNS(o.space,o.local);return y===g?null:y===d?p:p=a(d=y,c)}}function K$e(o,a,c){var d,g,p;return function(){var y,x=c(this),T;return x==null?void this.removeAttribute(o):(y=this.getAttribute(o),T=x+"",y===T?null:y===d&&T===g?p:(g=T,p=a(d=y,x)))}}function X$e(o,a,c){var d,g,p;return function(){var y,x=c(this),T;return x==null?void this.removeAttributeNS(o.space,o.local):(y=this.getAttributeNS(o.space,o.local),T=x+"",y===T?null:y===d&&T===g?p:(g=T,p=a(d=y,x)))}}function J$e(o,a){var c=Sz(o),d=c==="transform"?N$e:Sue;return this.attrTween(o,typeof a=="function"?(c.local?X$e:K$e)(c,d,Jte(this,"attr."+o,a)):a==null?(c.local?G$e:Z$e)(c):(c.local?Y$e:q$e)(c,d,a))}function Q$e(o,a){return function(c){this.setAttribute(o,a.call(this,c))}}function eDe(o,a){return function(c){this.setAttributeNS(o.space,o.local,a.call(this,c))}}function tDe(o,a){var c,d;function g(){var p=a.apply(this,arguments);return p!==d&&(c=(d=p)&&eDe(o,p)),c}return g._value=a,g}function nDe(o,a){var c,d;function g(){var p=a.apply(this,arguments);return p!==d&&(c=(d=p)&&Q$e(o,p)),c}return g._value=a,g}function oDe(o,a){var c="attr."+o;if(arguments.length<2)return(c=this.tween(c))&&c._value;if(a==null)return this.tween(c,null);if(typeof a!="function")throw new Error;var d=Sz(o);return this.tween(c,(d.local?tDe:nDe)(d,a))}function sDe(o,a){return function(){Xte(this,o).delay=+a.apply(this,arguments)}}function rDe(o,a){return a=+a,function(){Xte(this,o).delay=a}}function aDe(o){var a=this._id;return arguments.length?this.each((typeof o=="function"?sDe:rDe)(a,o)):$p(this.node(),a).delay}function iDe(o,a){return function(){Cb(this,o).duration=+a.apply(this,arguments)}}function cDe(o,a){return a=+a,function(){Cb(this,o).duration=a}}function lDe(o){var a=this._id;return arguments.length?this.each((typeof o=="function"?iDe:cDe)(a,o)):$p(this.node(),a).duration}function uDe(o,a){if(typeof a!="function")throw new Error;return function(){Cb(this,o).ease=a}}function dDe(o){var a=this._id;return arguments.length?this.each(uDe(a,o)):$p(this.node(),a).ease}function fDe(o,a){return function(){var c=a.apply(this,arguments);if(typeof c!="function")throw new Error;Cb(this,o).ease=c}}function mDe(o){if(typeof o!="function")throw new Error;return this.each(fDe(this._id,o))}function gDe(o){typeof o!="function"&&(o=eue(o));for(var a=this._groups,c=a.length,d=new Array(c),g=0;g<c;++g)for(var p=a[g],y=p.length,x=d[g]=[],T,A=0;A<y;++A)(T=p[A])&&o.call(T,T.__data__,A,p)&&x.push(T);return new S0(d,this._parents,this._name,this._id)}function hDe(o){if(o._id!==this._id)throw new Error;for(var a=this._groups,c=o._groups,d=a.length,g=c.length,p=Math.min(d,g),y=new Array(d),x=0;x<p;++x)for(var T=a[x],A=c[x],M=T.length,P=y[x]=new Array(M),z,U=0;U<M;++U)(z=T[U]||A[U])&&(P[U]=z);for(;x<d;++x)y[x]=a[x];return new S0(y,this._parents,this._name,this._id)}function pDe(o){return(o+"").trim().split(/^|\s+/).every(function(a){var c=a.indexOf(".");return c>=0&&(a=a.slice(0,c)),!a||a==="start"})}function bDe(o,a,c){var d,g,p=pDe(a)?Xte:Cb;return function(){var y=p(this,o),x=y.on;x!==d&&(g=(d=x).copy()).on(a,c),y.on=g}}function vDe(o,a){var c=this._id;return arguments.length<2?$p(this.node(),c).on.on(o):this.each(bDe(c,o,a))}function yDe(o){return function(){var a=this.parentNode;for(var c in this.__transition)if(+c!==o)return;a&&a.removeChild(this)}}function wDe(){return this.on("end.remove",yDe(this._id))}function CDe(o){var a=this._name,c=this._id;typeof o!="function"&&(o=Gte(o));for(var d=this._groups,g=d.length,p=new Array(g),y=0;y<g;++y)for(var x=d[y],T=x.length,A=p[y]=new Array(T),M,P,z=0;z<T;++z)(M=x[z])&&(P=o.call(M,M.__data__,z,x))&&("__data__"in M&&(P.__data__=M.__data__),A[z]=P,Ez(A[z],a,c,z,A,$p(M,c)));return new S0(p,this._parents,a,c)}function SDe(o){var a=this._name,c=this._id;typeof o!="function"&&(o=Qle(o));for(var d=this._groups,g=d.length,p=[],y=[],x=0;x<g;++x)for(var T=d[x],A=T.length,M,P=0;P<A;++P)if(M=T[P]){for(var z=o.call(M,M.__data__,P,T),U,q=$p(M,c),Q=0,ee=z.length;Q<ee;++Q)(U=z[Q])&&Ez(U,a,c,Q,z,q);p.push(z),y.push(M)}return new S0(p,y,a,c)}var xDe=IM.prototype.constructor;function EDe(){return new xDe(this._groups,this._parents)}function _De(o,a){var c,d,g;return function(){var p=D4(this,o),y=(this.style.removeProperty(o),D4(this,o));return p===y?null:p===c&&y===d?g:g=a(c=p,d=y)}}function xue(o){return function(){this.style.removeProperty(o)}}function TDe(o,a,c){var d,g=c+"",p;return function(){var y=D4(this,o);return y===g?null:y===d?p:p=a(d=y,c)}}function kDe(o,a,c){var d,g,p;return function(){var y=D4(this,o),x=c(this),T=x+"";return x==null&&(T=x=(this.style.removeProperty(o),D4(this,o))),y===T?null:y===d&&T===g?p:(g=T,p=a(d=y,x))}}function ADe(o,a){var c,d,g,p="style."+a,y="end."+p,x;return function(){var T=Cb(this,o),A=T.on,M=T.value[p]==null?x||(x=xue(a)):void 0;(A!==c||g!==M)&&(d=(c=A).copy()).on(y,g=M),T.on=d}}function ODe(o,a,c){var d=(o+="")=="transform"?O$e:Sue;return a==null?this.styleTween(o,_De(o,d)).on("end.style."+o,xue(o)):typeof a=="function"?this.styleTween(o,kDe(o,d,Jte(this,"style."+o,a))).each(ADe(this._id,o)):this.styleTween(o,TDe(o,d,a),c).on("end.style."+o,null)}function NDe(o,a,c){return function(d){this.style.setProperty(o,a.call(this,d),c)}}function $De(o,a,c){var d,g;function p(){var y=a.apply(this,arguments);return y!==g&&(d=(g=y)&&NDe(o,y,c)),d}return p._value=a,p}function DDe(o,a,c){var d="style."+(o+="");if(arguments.length<2)return(d=this.tween(d))&&d._value;if(a==null)return this.tween(d,null);if(typeof a!="function")throw new Error;return this.tween(d,$De(o,a,c??""))}function MDe(o){return function(){this.textContent=o}}function RDe(o){return function(){var a=o(this);this.textContent=a??""}}function IDe(o){return this.tween("text",typeof o=="function"?RDe(Jte(this,"text",o)):MDe(o==null?"":o+""))}function PDe(o){return function(a){this.textContent=o.call(this,a)}}function BDe(o){var a,c;function d(){var g=o.apply(this,arguments);return g!==c&&(a=(c=g)&&PDe(g)),a}return d._value=o,d}function FDe(o){var a="text";if(arguments.length<1)return(a=this.tween(a))&&a._value;if(o==null)return this.tween(a,null);if(typeof o!="function")throw new Error;return this.tween(a,BDe(o))}function LDe(){for(var o=this._name,a=this._id,c=Eue(),d=this._groups,g=d.length,p=0;p<g;++p)for(var y=d[p],x=y.length,T,A=0;A<x;++A)if(T=y[A]){var M=$p(T,a);Ez(T,o,c,A,y,{time:M.time+M.delay+M.duration,delay:0,duration:M.duration,ease:M.ease})}return new S0(d,this._parents,o,c)}function VDe(){var o,a,c=this,d=c._id,g=c.size();return new Promise(function(p,y){var x={value:y},T={value:function(){--g===0&&p()}};c.each(function(){var A=Cb(this,d),M=A.on;M!==o&&(a=(o=M).copy(),a._.cancel.push(x),a._.interrupt.push(x),a._.end.push(T)),A.on=a}),g===0&&p()})}var HDe=0;function S0(o,a,c,d){this._groups=o,this._parents=a,this._name=c,this._id=d}function Eue(){return++HDe}var g0=IM.prototype;S0.prototype={constructor:S0,select:CDe,selectAll:SDe,selectChild:g0.selectChild,selectChildren:g0.selectChildren,filter:gDe,merge:hDe,selection:EDe,transition:LDe,call:g0.call,nodes:g0.nodes,node:g0.node,size:g0.size,empty:g0.empty,each:g0.each,on:vDe,attr:J$e,attrTween:oDe,style:ODe,styleTween:DDe,text:IDe,textTween:FDe,remove:wDe,tween:W$e,delay:aDe,duration:lDe,ease:dDe,easeVarying:mDe,end:VDe,[Symbol.iterator]:g0[Symbol.iterator]};function zDe(o){return((o*=2)<=1?o*o*o:(o-=2)*o*o+2)/2}var UDe={time:null,delay:0,duration:250,ease:zDe};function jDe(o,a){for(var c;!(c=o.__transition)||!(c=c[a]);)if(!(o=o.parentNode))throw new Error(`transition ${a} not found`);return c}function WDe(o){var a,c;o instanceof S0?(a=o._id,o=o._name):(a=Eue(),(c=UDe).time=Kte(),o=o==null?null:o+"");for(var d=this._groups,g=d.length,p=0;p<g;++p)for(var y=d[p],x=y.length,T,A=0;A<x;++A)(T=y[A])&&Ez(T,o,a,A,y,c||jDe(T,a));return new S0(d,this._parents,o,a)}IM.prototype.interrupt=z$e;IM.prototype.transition=WDe;const IV=o=>()=>o;function ZDe(o,{sourceEvent:a,target:c,transform:d,dispatch:g}){Object.defineProperties(this,{type:{value:o,enumerable:!0,configurable:!0},sourceEvent:{value:a,enumerable:!0,configurable:!0},target:{value:c,enumerable:!0,configurable:!0},transform:{value:d,enumerable:!0,configurable:!0},_:{value:g}})}function v0(o,a,c){this.k=o,this.x=a,this.y=c}v0.prototype={constructor:v0,scale:function(o){return o===1?this:new v0(this.k*o,this.x,this.y)},translate:function(o,a){return o===0&a===0?this:new v0(this.k,this.x+this.k*o,this.y+this.k*a)},apply:function(o){return[o[0]*this.k+this.x,o[1]*this.k+this.y]},applyX:function(o){return o*this.k+this.x},applyY:function(o){return o*this.k+this.y},invert:function(o){return[(o[0]-this.x)/this.k,(o[1]-this.y)/this.k]},invertX:function(o){return(o-this.x)/this.k},invertY:function(o){return(o-this.y)/this.k},rescaleX:function(o){return o.copy().domain(o.range().map(this.invertX,this).map(o.invert,o))},rescaleY:function(o){return o.copy().domain(o.range().map(this.invertY,this).map(o.invert,o))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var R4=new v0(1,0,0);v0.prototype;function zQ(o){o.stopImmediatePropagation()}function q6(o){o.preventDefault(),o.stopImmediatePropagation()}function GDe(o){return(!o.ctrlKey||o.type==="wheel")&&!o.button}function qDe(){var o=this;return o instanceof SVGElement?(o=o.ownerSVGElement||o,o.hasAttribute("viewBox")?(o=o.viewBox.baseVal,[[o.x,o.y],[o.x+o.width,o.y+o.height]]):[[0,0],[o.width.baseVal.value,o.height.baseVal.value]]):[[0,0],[o.clientWidth,o.clientHeight]]}function lae(){return this.__zoom||R4}function YDe(o){return-o.deltaY*(o.deltaMode===1?.05:o.deltaMode?1:.002)*(o.ctrlKey?10:1)}function KDe(){return navigator.maxTouchPoints||"ontouchstart"in this}function XDe(o,a,c){var d=o.invertX(a[0][0])-c[0][0],g=o.invertX(a[1][0])-c[1][0],p=o.invertY(a[0][1])-c[0][1],y=o.invertY(a[1][1])-c[1][1];return o.translate(g>d?(d+g)/2:Math.min(0,d)||Math.max(0,g),y>p?(p+y)/2:Math.min(0,p)||Math.max(0,y))}function JDe(){var o=GDe,a=qDe,c=XDe,d=YDe,g=KDe,p=[0,1/0],y=[[-1/0,-1/0],[1/0,1/0]],x=250,T=R$e,A=Cz("start","zoom","end"),M,P,z,U=500,q=150,Q=0,ee=10;function le(we){we.property("__zoom",lae).on("wheel.zoom",Ge,{passive:!1}).on("mousedown.zoom",vt).on("dblclick.zoom",yt).filter(g).on("touchstart.zoom",De).on("touchmove.zoom",ue).on("touchend.zoom touchcancel.zoom",Vt).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}le.transform=function(we,Ie,D,Ue){var be=we.selection?we.selection():we;be.property("__zoom",lae),we!==be?mt(we,Ie,D,Ue):be.interrupt().each(function(){Le(this,arguments).event(Ue).start().zoom(null,typeof Ie=="function"?Ie.apply(this,arguments):Ie).end()})},le.scaleBy=function(we,Ie,D,Ue){le.scaleTo(we,function(){var be=this.__zoom.k,tt=typeof Ie=="function"?Ie.apply(this,arguments):Ie;return be*tt},D,Ue)},le.scaleTo=function(we,Ie,D,Ue){le.transform(we,function(){var be=a.apply(this,arguments),tt=this.__zoom,nt=D==null?Ae(be):typeof D=="function"?D.apply(this,arguments):D,ge=tt.invert(nt),We=typeof Ie=="function"?Ie.apply(this,arguments):Ie;return c(Z(ae(tt,We),nt,ge),be,y)},D,Ue)},le.translateBy=function(we,Ie,D,Ue){le.transform(we,function(){return c(this.__zoom.translate(typeof Ie=="function"?Ie.apply(this,arguments):Ie,typeof D=="function"?D.apply(this,arguments):D),a.apply(this,arguments),y)},null,Ue)},le.translateTo=function(we,Ie,D,Ue,be){le.transform(we,function(){var tt=a.apply(this,arguments),nt=this.__zoom,ge=Ue==null?Ae(tt):typeof Ue=="function"?Ue.apply(this,arguments):Ue;return c(R4.translate(ge[0],ge[1]).scale(nt.k).translate(typeof Ie=="function"?-Ie.apply(this,arguments):-Ie,typeof D=="function"?-D.apply(this,arguments):-D),tt,y)},Ue,be)};function ae(we,Ie){return Ie=Math.max(p[0],Math.min(p[1],Ie)),Ie===we.k?we:new v0(Ie,we.x,we.y)}function Z(we,Ie,D){var Ue=Ie[0]-D[0]*we.k,be=Ie[1]-D[1]*we.k;return Ue===we.x&&be===we.y?we:new v0(we.k,Ue,be)}function Ae(we){return[(+we[0][0]+ +we[1][0])/2,(+we[0][1]+ +we[1][1])/2]}function mt(we,Ie,D,Ue){we.on("start.zoom",function(){Le(this,arguments).event(Ue).start()}).on("interrupt.zoom end.zoom",function(){Le(this,arguments).event(Ue).end()}).tween("zoom",function(){var be=this,tt=arguments,nt=Le(be,tt).event(Ue),ge=a.apply(be,tt),We=D==null?Ae(ge):typeof D=="function"?D.apply(be,tt):D,kt=Math.max(ge[1][0]-ge[0][0],ge[1][1]-ge[0][1]),He=be.__zoom,ht=typeof Ie=="function"?Ie.apply(be,tt):Ie,Me=T(He.invert(We).concat(kt/He.k),ht.invert(We).concat(kt/ht.k));return function(lt){if(lt===1)lt=ht;else{var te=Me(lt),gn=kt/te[2];lt=new v0(gn,We[0]-te[0]*gn,We[1]-te[1]*gn)}nt.zoom(null,lt)}})}function Le(we,Ie,D){return!D&&we.__zooming||new J(we,Ie)}function J(we,Ie){this.that=we,this.args=Ie,this.active=0,this.sourceEvent=null,this.extent=a.apply(we,Ie),this.taps=0}J.prototype={event:function(we){return we&&(this.sourceEvent=we),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(we,Ie){return this.mouse&&we!=="mouse"&&(this.mouse[1]=Ie.invert(this.mouse[0])),this.touch0&&we!=="touch"&&(this.touch0[1]=Ie.invert(this.touch0[0])),this.touch1&&we!=="touch"&&(this.touch1[1]=Ie.invert(this.touch1[0])),this.that.__zoom=Ie,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(we){var Ie=kp(this.that).datum();A.call(we,this.that,new ZDe(we,{sourceEvent:this.sourceEvent,target:le,type:we,transform:this.that.__zoom,dispatch:A}),Ie)}};function Ge(we,...Ie){if(!o.apply(this,arguments))return;var D=Le(this,Ie).event(we),Ue=this.__zoom,be=Math.max(p[0],Math.min(p[1],Ue.k*Math.pow(2,d.apply(this,arguments)))),tt=gb(we);if(D.wheel)(D.mouse[0][0]!==tt[0]||D.mouse[0][1]!==tt[1])&&(D.mouse[1]=Ue.invert(D.mouse[0]=tt)),clearTimeout(D.wheel);else{if(Ue.k===be)return;D.mouse=[tt,Ue.invert(tt)],tH(this),D.start()}q6(we),D.wheel=setTimeout(nt,q),D.zoom("mouse",c(Z(ae(Ue,be),D.mouse[0],D.mouse[1]),D.extent,y));function nt(){D.wheel=null,D.end()}}function vt(we,...Ie){if(z||!o.apply(this,arguments))return;var D=we.currentTarget,Ue=Le(this,Ie,!0).event(we),be=kp(we.view).on("mousemove.zoom",We,!0).on("mouseup.zoom",kt,!0),tt=gb(we,D),nt=we.clientX,ge=we.clientY;uue(we.view),zQ(we),Ue.mouse=[tt,this.__zoom.invert(tt)],tH(this),Ue.start();function We(He){if(q6(He),!Ue.moved){var ht=He.clientX-nt,Me=He.clientY-ge;Ue.moved=ht*ht+Me*Me>Q}Ue.event(He).zoom("mouse",c(Z(Ue.that.__zoom,Ue.mouse[0]=gb(He,D),Ue.mouse[1]),Ue.extent,y))}function kt(He){be.on("mousemove.zoom mouseup.zoom",null),due(He.view,Ue.moved),q6(He),Ue.event(He).end()}}function yt(we,...Ie){if(o.apply(this,arguments)){var D=this.__zoom,Ue=gb(we.changedTouches?we.changedTouches[0]:we,this),be=D.invert(Ue),tt=D.k*(we.shiftKey?.5:2),nt=c(Z(ae(D,tt),Ue,be),a.apply(this,Ie),y);q6(we),x>0?kp(this).transition().duration(x).call(mt,nt,Ue,we):kp(this).call(le.transform,nt,Ue,we)}}function De(we,...Ie){if(o.apply(this,arguments)){var D=we.touches,Ue=D.length,be=Le(this,Ie,we.changedTouches.length===Ue).event(we),tt,nt,ge,We;for(zQ(we),nt=0;nt<Ue;++nt)ge=D[nt],We=gb(ge,this),We=[We,this.__zoom.invert(We),ge.identifier],be.touch0?!be.touch1&&be.touch0[2]!==We[2]&&(be.touch1=We,be.taps=0):(be.touch0=We,tt=!0,be.taps=1+!!M);M&&(M=clearTimeout(M)),tt&&(be.taps<2&&(P=We[0],M=setTimeout(function(){M=null},U)),tH(this),be.start())}}function ue(we,...Ie){if(this.__zooming){var D=Le(this,Ie).event(we),Ue=we.changedTouches,be=Ue.length,tt,nt,ge,We;for(q6(we),tt=0;tt<be;++tt)nt=Ue[tt],ge=gb(nt,this),D.touch0&&D.touch0[2]===nt.identifier?D.touch0[0]=ge:D.touch1&&D.touch1[2]===nt.identifier&&(D.touch1[0]=ge);if(nt=D.that.__zoom,D.touch1){var kt=D.touch0[0],He=D.touch0[1],ht=D.touch1[0],Me=D.touch1[1],lt=(lt=ht[0]-kt[0])*lt+(lt=ht[1]-kt[1])*lt,te=(te=Me[0]-He[0])*te+(te=Me[1]-He[1])*te;nt=ae(nt,Math.sqrt(lt/te)),ge=[(kt[0]+ht[0])/2,(kt[1]+ht[1])/2],We=[(He[0]+Me[0])/2,(He[1]+Me[1])/2]}else if(D.touch0)ge=D.touch0[0],We=D.touch0[1];else return;D.zoom("touch",c(Z(nt,ge,We),D.extent,y))}}function Vt(we,...Ie){if(this.__zooming){var D=Le(this,Ie).event(we),Ue=we.changedTouches,be=Ue.length,tt,nt;for(zQ(we),z&&clearTimeout(z),z=setTimeout(function(){z=null},U),tt=0;tt<be;++tt)nt=Ue[tt],D.touch0&&D.touch0[2]===nt.identifier?delete D.touch0:D.touch1&&D.touch1[2]===nt.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(nt=gb(nt,this),Math.hypot(P[0]-nt[0],P[1]-nt[1])<ee)){var ge=kp(this).on("dblclick.zoom");ge&&ge.apply(this,arguments)}}}return le.wheelDelta=function(we){return arguments.length?(d=typeof we=="function"?we:IV(+we),le):d},le.filter=function(we){return arguments.length?(o=typeof we=="function"?we:IV(!!we),le):o},le.touchable=function(we){return arguments.length?(g=typeof we=="function"?we:IV(!!we),le):g},le.extent=function(we){return arguments.length?(a=typeof we=="function"?we:IV([[+we[0][0],+we[0][1]],[+we[1][0],+we[1][1]]]),le):a},le.scaleExtent=function(we){return arguments.length?(p[0]=+we[0],p[1]=+we[1],le):[p[0],p[1]]},le.translateExtent=function(we){return arguments.length?(y[0][0]=+we[0][0],y[1][0]=+we[1][0],y[0][1]=+we[0][1],y[1][1]=+we[1][1],le):[[y[0][0],y[0][1]],[y[1][0],y[1][1]]]},le.constrain=function(we){return arguments.length?(c=we,le):c},le.duration=function(we){return arguments.length?(x=+we,le):x},le.interpolate=function(we){return arguments.length?(T=we,le):T},le.on=function(){var we=A.on.apply(A,arguments);return we===A?le:we},le.clickDistance=function(we){return arguments.length?(Q=(we=+we)*we,le):Math.sqrt(Q)},le.tapDistance=function(we){return arguments.length?(ee=+we,le):ee},le}var os=(o=>(o.Left="left",o.Top="top",o.Right="right",o.Bottom="bottom",o))(os||{}),Qte=(o=>(o.Partial="partial",o.Full="full",o))(Qte||{}),Bx=(o=>(o.Bezier="default",o.SimpleBezier="simple-bezier",o.Straight="straight",o.Step="step",o.SmoothStep="smoothstep",o))(Bx||{}),Yw=(o=>(o.Strict="strict",o.Loose="loose",o))(Yw||{}),AH=(o=>(o.Arrow="arrow",o.ArrowClosed="arrowclosed",o))(AH||{}),oM=(o=>(o.Free="free",o.Vertical="vertical",o.Horizontal="horizontal",o))(oM||{}),_ue=(o=>(o.TopLeft="top-left",o.TopCenter="top-center",o.TopRight="top-right",o.BottomLeft="bottom-left",o.BottomCenter="bottom-center",o.BottomRight="bottom-right",o))(_ue||{});const QDe=["INPUT","SELECT","TEXTAREA"];function qee(o){var a,c;const d=((c=(a=o.composedPath)==null?void 0:a.call(o))==null?void 0:c[0])||o.target,g=typeof(d==null?void 0:d.hasAttribute)=="function"?d.hasAttribute("contenteditable"):!1,p=typeof(d==null?void 0:d.closest)=="function"?d.closest(".nokey"):null;return QDe.includes(d==null?void 0:d.nodeName)||g||!!p}function e6e(o){return o.ctrlKey||o.metaKey||o.shiftKey||o.altKey}function uae(o,a,c,d){const g=a.replace("+",`
112
+ `));return ue(ce.split(""),d).length},tt=(K,re)=>{const ce=Ie(K,re).join("");return Ue(ce)},nt=(K,re)=>{const ce=Ie(K,re).join("").replace(/\s/g,"");return Ue(ce)},ge=(K,re)=>()=>re(K.getBody(),K.schema),We=(K,re)=>()=>re(K.selection.getRng().cloneContents(),K.schema),kt=K=>ge(K,be),He=K=>({body:{getWordCount:kt(K),getCharacterCount:ge(K,tt),getCharacterCountWithoutSpaces:ge(K,nt)},selection:{getWordCount:We(K,be),getCharacterCount:We(K,tt),getCharacterCountWithoutSpaces:We(K,nt)},getCount:kt(K)}),ht=(K,re)=>{K.windowManager.open({title:"Word Count",body:{type:"panel",items:[{type:"table",header:["Count","Document","Selection"],cells:[["Words",String(re.body.getWordCount()),String(re.selection.getWordCount())],["Characters (no spaces)",String(re.body.getCharacterCountWithoutSpaces()),String(re.selection.getCharacterCountWithoutSpaces())],["Characters",String(re.body.getCharacterCount()),String(re.selection.getCharacterCount())]]}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}]})},Me=(K,re)=>{K.addCommand("mceWordCount",()=>ht(K,re))},lt=(K,re)=>{let ce=null;return{cancel:()=>{c(ce)||(clearTimeout(ce),ce=null)},throttle:(...Ne)=>{c(ce)&&(ce=setTimeout(()=>{ce=null,K.apply(null,Ne)},re))}}};var te=tinymce.util.Tools.resolve("tinymce.util.Delay");const gn=(K,re)=>{K.dispatch("wordCountUpdate",{wordCount:{words:re.body.getWordCount(),characters:re.body.getCharacterCount(),charactersWithoutSpaces:re.body.getCharacterCountWithoutSpaces()}})},ft=(K,re)=>{gn(K,re)},St=(K,re,ce)=>{const W=lt(()=>ft(K,re),ce);K.on("init",()=>{ft(K,re),te.setEditorTimeout(K,()=>{K.on("SetContent BeforeAddUndo Undo Redo ViewUpdate keyup",W.throttle)},0),K.on("remove",W.cancel)})},jt=K=>{const re=()=>K.execCommand("mceWordCount");K.ui.registry.addButton("wordcount",{tooltip:"Word count",icon:"character-count",onAction:re,context:"any"}),K.ui.registry.addMenuItem("wordcount",{text:"Word count",icon:"character-count",onAction:re,context:"any"})};var Ct=(K=300)=>{o.add("wordcount",re=>{const ce=He(re);return Me(re,ce),jt(re),St(re,ce,K),ce})};Ct()})();const gAe=o=>/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument/i.test(o)||/class="OutlineElement/.test(o)||/id="?docs\-internal\-guid\-/.test(o),hAe=(o,a="wps_office")=>{const c=o.split(","),d=c[0].match(/:(.*?);/)[1],g=atob(c[1]);let p=g.length;const y=new Uint8Array(p);for(;p--;)y[p]=g.charCodeAt(p);return new File([y],a,{type:d})},pAe=o=>btoa(o.match(/\w{2}/g).map(a=>String.fromCharCode(parseInt(a,16))).join(""));function bAe(o){if(!o)return[];let a=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,c=new RegExp(`(?:(${a.source}))([\\da-fA-F\\s]+)\\}`,"g"),d=o.match(c);console.log("images",d);const g=[];if(d||(a=/{\\pict[\s\S]+?(\\pngblip-?\d+)?(\\wmetafile8-?\d+)?{\\\*\\blipuid\s?[\da-fA-F]+[\s}]*?/,c=new RegExp(`(?:(${a.source}))([\\da-fA-F\\s]+)\\}`,"g"),d=o.match(c)),d)for(const p of d){let y=!1;if(p.includes("\\pngblip")?y="image/png":p.includes("\\jpegblip")&&(y="image/jpeg"),y){const x=p.replace(a,"").replace(/[^\da-fA-F]/g,""),T=`data:${y};base64,${pAe(x)}`;g.push({base64:T,file:hAe(T)})}}return g}const vAe=(o,a)=>{if(!a)return o;try{const d=new DOMParser().parseFromString(o,"text/html"),g=d.querySelectorAll("img"),y=(a.clipboardData||window.Clipboard).getData("text/rtf"),x=bAe(y);return g.forEach((T,A)=>{var P;const M=T.getAttribute("src");if(M&&M.startsWith("file:")&&(P=x==null?void 0:x[A])!=null&&P.base64){const z=x[A].base64;T.setAttribute("src",z)}}),d.body.innerHTML}catch{return o}},yAe=o=>{const a=atob(o.split(",")[1]),c=o.split(",")[0].split(":")[1].split(";")[0],d=new ArrayBuffer(a.length),g=new Uint8Array(d);for(let p=0;p<a.length;p++)g[p]=a.charCodeAt(p);return new Blob([d],{type:c})},wAe=async o=>{try{const a=yAe(o),c=new FormData;c.append("files",a,"image.png");const g=await(await fetch("/api/ajax/uploaddoc",{method:"POST",body:c})).json();if(g.status===1)return g.file_url;throw new Error(g.message)}catch(a){throw a}},CAe=async o=>{const c=new DOMParser().parseFromString(o,"text/html"),d=c.getElementsByTagName("img"),g=[],p=3;for(let y=0;y<d.length;y++){const x=d[y],T=x.getAttribute("src");T&&T.startsWith("data:image")&&(g.push({img:x,src:T,width:x.getAttribute("width"),height:x.getAttribute("height")}),g[g.length-1].width&&x.setAttribute("width",g[g.length-1].width),g[g.length-1].height&&x.setAttribute("height",g[g.length-1].height))}for(let y=0;y<g.length;y+=p){const T=g.slice(y,y+p).map(async A=>{try{const M=await wAe(A.src);A.img.setAttribute("src",M)}catch{A.img.remove()}});await Promise.all(T)}return c.body.innerHTML},SAe=o=>{o.querySelectorAll("td").forEach(c=>{const d=c.getAttribute("width"),g=c.getAttribute("style")||"";d==="0"&&g.includes("border:none")&&c.remove()})},xAe=o=>{o.querySelectorAll("table").forEach(c=>{c.style.maxWidth="100%"})},EAe=o=>{o.querySelectorAll("table").forEach(c=>{const d=c.querySelectorAll("td");let g=!1,p="";for(const y of d){const x=y.getAttribute("style")||"",T=x.match(/border(?:-(?:right|left|top|bottom))?(?:-style)?:\s*[0-9.]*(?:pt|px)?\s*double\s*(?:windowtext|[#a-zA-Z0-9]+)?/i)||x.match(/border(?:-(?:right|left|top|bottom))?:\s*[0-9.]*(?:pt|px)?\s*double\s*(?:windowtext|[#a-zA-Z0-9]+)?/i);(T?T[0]:"").includes("double")&&(g=!0,T&&(p=T[0].replace(/^border(?:-(?:right|left|top|bottom))?(?:-style)?:\s*/,""),y.style.borderTop=p,y.style.borderRight=p,y.style.borderBottom=p,y.style.borderLeft=p))}g&&p&&(c.style.borderCollapse="separate",c.style.borderSpacing="2px",c.style.border=p)})},_Ae=o=>{o.querySelectorAll("table").forEach(c=>{c.querySelectorAll("td[rowspan]").forEach(g=>{const x=((g.getAttribute("style")||"").match(/border-[^:]+:[^;]+(?:solid|double)[^;]+/g)||[]).find(T=>!T.includes("none"));if(x){const T=x.split(":")[1].trim();g.style.borderBottom=T}})})},TAe=o=>{o.querySelectorAll('[style*="mso-"]').forEach(c=>{const g=(c.getAttribute("style")||"").replace(/mso-[^:]+:[^;]+;/g,"");c.setAttribute("style",g)})},kAe=o=>{o.querySelectorAll('[style*="tab-stops"]').forEach(c=>{const g=(c.getAttribute("style")||"").replace(/tab-stops:[^;]+;/g,"");c.setAttribute("style",g)})},AAe=o=>{o=o.replace(/<a(?!.*?href=)[^>]*>([\s\S]*?)<\/a>/gi,"$1");const c=new DOMParser().parseFromString(o,"text/html");return SAe(c),xAe(c),EAe(c),_Ae(c),TAe(c),kAe(c),o=c.body.innerHTML,o};CH.PluginManager.add("pasteprocess",o=>(o.on("paste",a=>{if(a.clipboardData){const c=a.clipboardData.getData("text/html")||a.clipboardData.getData("text");if(gAe(c)){a.preventDefault();const d=o.windowManager.open({title:"处理中",body:{type:"panel",items:[{type:"htmlpanel",html:'<div style="text-align: center; padding: 20px;">正在处理Word内容,请稍候...</div>'}]},buttons:[]}),g=AAe(c),p=vAe(g,a);CAe(p).then(y=>{o.insertContent(y),d.close()})}}}),{}));let NV="A4";const Iee={A3:{width:297,height:420},A4:{width:210,height:297},A5:{width:148,height:210},B3:{width:353,height:500},B4:{width:257,height:364},B5:{width:176,height:250}},OAe=Object.keys(Iee).map(o=>`pagesize${o}`).join(" ");CH.PluginManager.add("pagesize",o=>{const a=o.options.register;a("pagesize",{processor:"string",default:"A4"}),NV=(g=>p=>p.options.get(g))("pagesize")(o);const d=g=>{const p=Iee[g];if(p){const y=(window.devicePixelRatio||1)*96,x=p.width*y/25.4;o!=null&&o.container&&(o.container.style.minWidth=`${x}px`);const T=o.contentAreaContainer.querySelector("iframe");T&&(T.style.width=`${x}px`),o.fire("pagesizechange",{size:g})}};return Object.keys(Iee).forEach(g=>{o.ui.registry.addToggleMenuItem(`pagesize${g}`,{text:g,onAction:()=>{NV=g,d(g)},onSetup:p=>(p.setActive(NV===g),()=>{})})}),o.on("init",()=>{d(NV)}),{}});const NAe=["accordion","advlist","anchor","autolink","autosave","charmap","directionality","importcss","insertdatetime","lists","image","media","pagebreak","preview","save","searchreplace","table","fullscreen","wordcount","pasteprocess","pagesize"],$Ae="undo redo | blocks bold italic forecolor removeformat alignleft aligncenter alignright alignjustify outdent indent pagebreakfullscreen preview",DAe={license_key:"gpl",skin:!1,content_css:["./content.css","./reset.css"],promotion:!1,menu:{pagesize:{title:"页面大小",items:OAe}},menubar:"file edit insert table tools help pagesize",cleanup:!0,branding:!1,language:"zh_CN",plugins:NAe,toolbar:$Ae,fontsize_formats:"12px 14px 16px 18px 20px 22px 24px 28px 32px 36px 48px 56px 72px",font_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;",lineheight_formats:"0.5 0.8 1 1.2 1.5 1.75 2 2.5 3 4 5",elementpath:!1,paste_data_images:!0,object_resizing:!0,pagesize:"A4",images_upload_handler:o=>new Promise((a,c)=>{const d=new FormData;d.append("files",o.blob(),o.filename()),fetch("/api/ajax/uploaddoc",{method:"POST",body:d}).then(g=>g.json()).then(g=>{g.status===1?a(g.file_url):c(`上传失败: ${g.message}`)}).catch(g=>{c(`上传出错: ${g.message}`)})})},MAe={name:"ProEditor",components:{Editor:fAe},props:{modelValue:{type:String,default:""},pagesize:{type:String,default:"A4"},hasPagesize:{type:Boolean,default:!1},placeholder:{type:String,default:"请输入内容"},width:{type:[Number,String],default:"100%"},height:{type:Number,default:400}},setup(o,{emit:a}){const c=w.reactive({myInit:g(DAe),contentValue:o.modelValue,timeout:null});w.onMounted(()=>{CH.init({license_key:"gpl"}),CH.activeEditor.on("pagesizechange",p=>{a("update:pagesize",p.size)})}),w.watch(()=>c.contentValue,()=>{d(()=>{a("update:modelValue",c.contentValue)})}),w.watch(()=>o.modelValue,p=>{p&&p!==c.contentValue&&(c.contentValue=p)});function d(p,y=400){c.timeout!==null&&clearTimeout(c.timeout),c.timeout=setTimeout(p,y)}function g(p){o!=null&&o.height&&(p.height=o.height),o!=null&&o.width&&(p.width=o.width);const{placeholder:y,pagesize:x}=o;return p={...p,placeholder:y,...o.hasPagesize&&{menu:{...p.menu,pagesize:p.menu.pagesize},menubar:p.menubar.includes("pagesize")?p.menubar:`${p.menubar} pagesize`,pagesize:x},...!o.hasPagesize&&{menu:Object.fromEntries(Object.entries(p.menu).filter(([T])=>T!=="pagesize")),menubar:p.menubar.replace(/pagesize/g,"").trim(),pagesize:""}},p}return{...w.toRefs(c),customer:g,debounce:d}}},RAe={class:"my-tinymce"};function IAe(o,a,c,d,g,p){const y=w.resolveComponent("Editor");return w.openBlock(),w.createElementBlock("div",RAe,[w.createVNode(y,{modelValue:o.contentValue,"onUpdate:modelValue":a[0]||(a[0]=x=>o.contentValue=x),init:o.myInit},null,8,["modelValue","init"])])}const Mle=cu(MAe,[["render",IAe]]),PAe={name:"ShadowDomWrap",setup(o,{emit:a,expose:c}){const d=w.ref(null),g=w.ref(),p=w.ref(!1),y=T=>{if(!d.value)return;const A=d.value.contains(T.target);!A&&p.value?(p.value=!1,a("onBlur")):A&&!p.value&&(p.value=!0)},x=T=>{T.stopPropagation(),p.value||(p.value=!0,a("onFocus"))};return w.onMounted(()=>{var M,P,z;g.value=(M=d.value)==null?void 0:M.attachShadow({mode:"open"}),document.addEventListener("click",y);const T=document.createElement("link");T.rel="stylesheet",T.href=`${location==null?void 0:location.origin}/css/index.min.css`,(P=g.value)==null||P.appendChild(T);const A=document.createElement("link");A.rel="stylesheet",A.href=`${location==null?void 0:location.origin}/css/reset.css`,(z=g.value)==null||z.appendChild(A)}),w.onUnmounted(()=>{document.removeEventListener("click",y)}),c({focus:()=>{p.value=!0}}),{shadowHost:d,shadowRoot:g,handleClick:x}}};function BAe(o,a,c,d,g,p){return w.openBlock(),w.createElementBlock("div",{ref:"shadowHost",class:"shadow-host",onClick:a[0]||(a[0]=w.withModifiers((...y)=>d.handleClick&&d.handleClick(...y),["stop"]))},[d.shadowRoot?(w.openBlock(),w.createBlock(w.Teleport,{key:0,to:d.shadowRoot},[w.renderSlot(o.$slots,"default")],8,["to"])):w.createCommentVNode("",!0)],512)}const Hte=cu(PAe,[["render",BAe]]),FAe=["innerHTML"],Rle=w.defineComponent({__name:"index",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const a=w.useModel(o,"modelValue");return(c,d)=>(w.openBlock(),w.createBlock(Hte,null,{default:w.withCtx(()=>[w.createElementVNode("div",{innerHTML:a.value},null,8,FAe)]),_:1}))}}),Ile=Symbol("nodesUI"),$f=()=>{const o=w.inject(Ile);if(!o)throw new Error("NodesUI context not found");return o};function zte(o){if(!o||!o.ownerDocument)return null;const a=[];for(let c=o;c&&c.nodeType===1;c=c.parentElement){let d=0;for(let y=c.previousSibling;y;y=y.previousSibling)y.nodeType===1&&y.nodeName===c.nodeName&&d++;const g=c.nodeName.toLowerCase(),p=d?`${g}:nth-child(${d+1})`:g;a.unshift(p)}return a.length?a.join(" > "):null}function LAe(o,a){if(!a)return null;try{return(a.shadowRoot||a).querySelector(`#${CSS.escape(o)}`)}catch(c){return console.error("nodePath query error:",c),null}}function Ple(o,a){if(!a)return null;try{return(a.shadowRoot||a).querySelector(o)}catch(c){return console.error("nodePath query error:",c),null}}const d4=o=>o!=null&&o.id?o==null?void 0:o.id:o.nodePath+(o!=null&&o.textNodeIndex?`-${o==null?void 0:o.textNodeIndex}`:"")+(o!=null&&o.startOffset?`-${o==null?void 0:o.startOffset}`:"")+(o!=null&&o.subNodeSort?`-${o==null?void 0:o.subNodeSort}`:""),VAe=(o,a,c)=>{var d,g;if(!jte(o)){const p=c==null?void 0:c.getRootNode(),y=(d=p==null?void 0:p.getSelection)==null?void 0:d.call(p),x=Ple(o.nodePath,c);if(y&&o.startOffset!==void 0&&a&&x){const T=document.createRange(),A=(o==null?void 0:o.textNodeIndex)||0,M=x.childNodes[A]||x,P=Math.min(o.startOffset,((g=M.textContent)==null?void 0:g.length)||0);T.setStart(M,P),T.setEnd(M,P);const z=document.createElement("span");z.classList.add("empty-text-node"),T.insertNode(z),T.insertNode(a),T.setStartAfter(a),T.collapse(!0),y.removeAllRanges(),y.addRange(T)}}},HAe=(o,a)=>{a!=null&&a.id&&(o.id=a==null?void 0:a.id),(a==null?void 0:a.nodePath)!==void 0&&o.setAttribute("data-nodePath",a.nodePath),(a==null?void 0:a.textNodeIndex)!==void 0&&a.textNodeIndex>=0&&o.setAttribute("data-textNodeIndex",a.textNodeIndex.toString()),a.startOffset!==void 0&&a.startOffset>=0&&o.setAttribute("data-startOffset",a.startOffset.toString()),(a==null?void 0:a.subNodeSort)!==void 0&&a.subNodeSort>=0&&o.setAttribute("data-subNodeSort",a.subNodeSort.toString()),(a==null?void 0:a.groupKey)!==void 0&&o.setAttribute("data-groupKey",a.groupKey)},zAe=o=>{const a=o.parentNode;if(!a)return-1;let c=0;for(let d=0;d<a.childNodes.length;d++){const g=a.childNodes[d];if(g===o)return c;c++,g.nodeType===Node.ELEMENT_NODE&&(g.classList.contains("node-item")&&(c-=2,c<0&&(c=0)),g.classList.contains("empty-text-node")&&(c-=1,c<0&&(c=0)))}return-1},UAe=o=>{let a=o.closest("TD"),c=o.closest(".node-item"),d=null;if(c?d=c:a&&a.classList.contains("node-item-td")&&(d=a),!d)return null;const g=d||o;let p=g==null?void 0:g.getAttribute("data-nodePath");if(p||(p=zte(g)),(g==null?void 0:g.getAttribute("selectable"))==="false")return null;let y={element:g,nodePath:p};const x=g==null?void 0:g.getAttribute("data-textNodeIndex");x&&(y.textNodeIndex=Number(x));const T=g==null?void 0:g.getAttribute("data-startOffset");T&&(y.startOffset=Number(T));const A=g==null?void 0:g.getAttribute("data-subNodeSort");A&&(y.subNodeSort=Number(A));const M=g==null?void 0:g.getAttribute("data-groupKey");M&&(y.groupKey=M);const P=g==null?void 0:g.getAttribute("id");return P&&(y.id=P),y},jAe=o=>a0e(o,a=>w.toValue(a.nodes).map(c=>({...c,color:a.color,activated:a==null?void 0:a.activated,dataGroupKey:a.id}))),Ute=(o,a)=>{const c=o.startsWith("#")?o.slice(1):o;let d,g,p;if(c.length===3)d=parseInt(c[0]+c[0],16),g=parseInt(c[1]+c[1],16),p=parseInt(c[2]+c[2],16);else if(c.length===6)d=parseInt(c.substring(0,2),16),g=parseInt(c.substring(2,4),16),p=parseInt(c.substring(4,6),16);else return console.warn("Invalid color format:",o),`rgba(0, 0, 0, ${a})`;return`rgba(${d}, ${g}, ${p}, ${a})`},WAe=o=>{const{element:a}=o;if(!a)return null;if(a.tagName.toLowerCase()!=="td")return{showTextType:"input"};const d=a.closest("tr"),g=Array.from(d.parentElement.children).indexOf(d),p=Array.from(d.children).indexOf(a),y=a.closest("table"),x=a.closest("body").querySelectorAll("table");return{showTextType:"cell",tableIndex:Array.from(x).indexOf(y)+1,colIndex:p,rowIndex:g}},ZAe=(o,a)=>{var g,p;let c=1;const d=(g=o==null?void 0:o.map(y=>a==null?void 0:a.find(x=>(x==null?void 0:x.id)===(y==null?void 0:y.id))))==null?void 0:g.filter(Boolean);return(d==null?void 0:d.length)>0?(p=d==null?void 0:d.map(x=>{const T=WAe(x);return T?(T==null?void 0:T.showTextType)==="input"?{...x,...T,inputIndex:c++}:{...x,...T}:null}))==null?void 0:p.filter(Boolean):[]};function GAe(o){if(!o||o.length===0)return[];const a=[...o].sort((g,p)=>g.rowIndex!==p.rowIndex?g.rowIndex-p.rowIndex:g.colIndex-p.colIndex),c=[],d=new Set;for(const g of a){if(d.has(g))continue;const p=[];let y=0,x=0;for(let T=g.colIndex;a.find(M=>M.rowIndex===g.rowIndex&&M.colIndex===T&&!d.has(M));T++)x++;if(x!==0){y=x;for(let T=g.rowIndex;;T++){let A=0;const M=[];for(let P=g.colIndex;P<g.colIndex+y;P++){const z=a.find(U=>U.rowIndex===T&&U.colIndex===P&&!d.has(U));if(z)A++,M.push(z);else break}if(A===y)p.push(...M);else break}p.length>0&&(c.push([...p]),p.forEach(T=>d.add(T)))}}return c}function qAe(o){if(!o||o.length===0)return{min:null,max:null};let a=o[0],c=o[0];for(const d of o)(d.colIndex<a.colIndex||d.colIndex===a.colIndex&&d.rowIndex<a.rowIndex)&&(a=d),(d.colIndex>c.colIndex||d.colIndex===c.colIndex&&d.rowIndex>c.rowIndex)&&(c=d);return{min:a,max:c}}const Ble=(o,a)=>{var A;const c=ZAe(o,a||[]),d=[],g=[];(A=w.toValue(c))==null||A.forEach(M=>{(M==null?void 0:M.showTextType)==="input"?d.push(M):g.push(M)});const p=l0e(g,"tableIndex"),y=Object.entries(p).map(([M,P])=>({tableIndex:Number(M),nodes:P})),x=xce(y==null?void 0:y.map(M=>GAe(M==null?void 0:M.nodes))),T=(x==null?void 0:x.map(M=>qAe(M)))||[];return[...d,...T]},x4=o=>{function a(c){let d="";for(;c>=0;)d=String.fromCharCode(65+c%26)+d,c=Math.floor(c/26)-1;return d}return(o==null?void 0:o.colIndex)>=0&&(o==null?void 0:o.rowIndex)>=0?`${a(o==null?void 0:o.colIndex)}${o==null?void 0:o.rowIndex}`:""},YAe=(o,a)=>{const c=Ble(o,a||[]);let d=[];return c==null||c.forEach(g=>{var p,y;(g==null?void 0:g.showTextType)==="input"?d.push(`填写${g==null?void 0:g.inputIndex}`):d.push(((p=g==null?void 0:g.min)==null?void 0:p.id)===((y=g==null?void 0:g.max)==null?void 0:y.id)?x4(g==null?void 0:g.min):`${x4(g==null?void 0:g.min)}:${x4(g==null?void 0:g.max)}`)}),d==null?void 0:d.join(",")},jte=o=>o.startOffset===void 0&&o.textNodeIndex===void 0,KAe={key:0},XAe={key:1,class:"td-node"},JAe=w.defineComponent({__name:"index",props:{node:{}},setup(o){const a=o,c=w.computed(()=>{var d,g;return((g=(d=a==null?void 0:a.node)==null?void 0:d.element)==null?void 0:g.TagName)==="TD"});return(d,g)=>{var p,y;return c.value?(w.openBlock(),w.createElementBlock("span",KAe,w.toDisplayString((p=a==null?void 0:a.node)==null?void 0:p.label),1)):(w.openBlock(),w.createElementBlock("span",XAe,w.toDisplayString((y=a==null?void 0:a.node)==null?void 0:y.label),1))}}}),Fle=Symbol("nodesEditor"),T0=()=>{const o=w.inject(Fle);if(!o)throw new Error("NodesEditor context not found");return o},pz=w.defineComponent({__name:"index",props:{node:{}},setup(o){const a=o,{currentNodes:c}=$f(),{nodes:d}=T0(),g=w.computed(()=>{var x;return(x=a.node)!=null&&x.id?d.value.some(T=>T.id===a.node.id):!1}),p=w.computed(()=>{var x;if(!((x=a.node)!=null&&x.element))return!1;try{return a.node.element.parentNode!==null}catch(T){return console.warn("Element validation failed:",T),!1}}),y=w.computed(()=>{var x;return(x=w.toValue(c))==null?void 0:x.find(T=>{var A;return(T==null?void 0:T.id)===((A=a==null?void 0:a.node)==null?void 0:A.id)})});return w.watch(()=>y,()=>{var T,A,M,P;const x=w.toValue(y);(T=a==null?void 0:a.node)!=null&&T.element&&(x?x!=null&&x.activated||(a.node.element.style.setProperty("--node-color",(x==null?void 0:x.color)||"#409eff"),a.node.element.style.setProperty("--node-bg-color",Ute((x==null?void 0:x.color)||"#409eff",.1)),a.node.element.setAttribute("data-dataGroupKey",x==null?void 0:x.dataGroupKey),a.node.element.setAttribute("selectable","false"),a.node.element.classList.add("activated")):((A=a.node.element)==null||A.removeAttribute("data-dataGroupKey"),(M=a.node.element)==null||M.removeAttribute("selectable"),(P=a.node.element)==null||P.classList.remove("activated")))},{immediate:!0,deep:!0}),(x,T)=>{var A;return(A=x.node)!=null&&A.element&&p.value&&g.value?(w.openBlock(),w.createBlock(w.Teleport,{key:0,to:x.node.element},[w.renderSlot(x.$slots,"default",{node:x.node},()=>[w.createVNode(JAe,{node:x.node},null,8,["node"])])],8,["to"])):w.createCommentVNode("",!0)}}});function QAe(){const o=w.ref(!1),a=d=>{d.key==="Control"&&(o.value=!0)},c=d=>{d.key==="Control"&&(o.value=!1)};return w.onMounted(()=>{window.addEventListener("keydown",a),window.addEventListener("keyup",c)}),w.onUnmounted(()=>{window.removeEventListener("keydown",a),window.removeEventListener("keyup",c)}),o}function Lle(){const{selectedNodes:o,setSelectedNodes:a,containerRef:c,renderNodes:d}=$f(),{editorId:g,nodes:p}=T0(),y=w.ref(!1),x=w.ref({x:0,y:0}),T=w.ref({x:0,y:0}),A=w.ref({left:0,top:0,width:0,height:0}),M=w.ref(null),P=Le=>{const J=Le.closest(".node-item-td")||Le.closest(".node-item");if(J!==null){let Ge=[];if(J.classList.contains("node-selected"))return;const vt=J.getAttribute("id");if(vt&&p.value){const yt=p.value.find(De=>De.id===vt);yt&&(Ge=[yt])}Ge=ae(Ge),a(Ge)}},z=Le=>{Le.button===2&&P(Le==null?void 0:Le.target),Le.button===0&&(y.value=!0,M.value&&(x.value={x:Le.pageX,y:Le.pageY},T.value={x:Le.pageX,y:Le.pageY},ee(Le),Z(),M.value.style.display="block",window.addEventListener("mousemove",U),window.addEventListener("mouseup",q)))},U=Hse(Le=>{y.value&&(T.value={x:Le.pageX,y:Le.pageY},Z())},16),q=Le=>{Le.button===0&&(y.value=!1,M.value&&(Z(),M.value.style.display="none",window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",q)))},Q=QAe(),ee=Le=>{var Ge,vt;let J=[];if(Le.button===0&&(Le!=null&&Le.target)){const yt=((Ge=Le==null?void 0:Le.target)==null?void 0:Ge.closest(".node-item-td"))||((vt=Le==null?void 0:Le.target)==null?void 0:vt.closest(".node-item"));if(yt!==null){const De=yt.getAttribute("id");if(De&&p.value){const ue=p.value.find(Vt=>Vt.id===De);ue&&(Q.value?o.value.some(Vt=>d4(Vt)===d4(ue))?J=o.value.filter(we=>d4(we)!==d4(ue)):J=[...o.value,ue]:ue&&(J=[ue]))}}J=ae(J),a(J)}},le=()=>{if(!c.value||!(A.value.width>3||A.value.height>3))return;let Le=[];const J={left:A.value.left,right:A.value.left+A.value.width,top:A.value.top,bottom:A.value.top+A.value.height};if(c.value.querySelectorAll("*").forEach(vt=>{const yt=vt.getBoundingClientRect(),De=window.scrollX||window.pageXOffset,ue=window.scrollY||window.pageYOffset,Vt={left:yt.left+De,right:yt.right+De,top:yt.top+ue,bottom:yt.bottom+ue};if(Vt.right>J.left&&Vt.left<J.right&&Vt.bottom>J.top&&Vt.top<J.bottom){const we=vt.getAttribute("id");if(we&&p.value){const Ie=p.value.find(D=>D.id===we);Ie&&(Le=[...Le,Ie])}}}),Le=ae(Le),console.log(Le),Q.value){const vt=new Set(o.value.map(De=>d4(De))),yt=Le.filter(De=>!vt.has(d4(De)));a([...o.value,...yt])}else a(Le)},ae=Le=>{var Ge;let J=[];if(Le.length>0){const vt=(Ge=Le.map(we=>we==null?void 0:we.groupKey))==null?void 0:Ge.filter(Boolean),yt=new Set(vt),De=Array.from(yt),ue=p.value.filter(we=>De.includes(we.groupKey));J=[...Le,...ue],J=[...A0e(J.filter(we=>we==null?void 0:we.id),"id")||[],...J.filter(we=>!we.id)]}return J},Z=Hse(()=>{if(!M.value)return;const{x:Le,y:J}=x.value,{x:Ge,y:vt}=T.value,yt=Math.min(Le,Ge),De=Math.min(J,vt),ue=Math.abs(Le-Ge),Vt=Math.abs(J-vt);A.value={left:yt,top:De,width:ue,height:Vt}},16),Ae=Le=>{if(!M.value)return;const{left:J,top:Ge,width:vt,height:yt}=w.toValue(Le);M.value.style.left=`${J}px`,M.value.style.top=`${Ge}px`,M.value.style.width=`${vt}px`,M.value.style.height=`${yt}px`},mt=()=>{if(!c.value)return;c.value.addEventListener("mousedown",z);const Le=document.getElementById(`select_area_${g}`);if(Le){M.value=Le;return}const J=document.createElement("div");J.id=`select_area_${g}`,J.style.position="absolute",J.style.border="1px solid #1677ff",J.style.backgroundColor="rgba(22, 119, 255, 0.05)",J.style.pointerEvents="none",J.style.display="none",document.body.appendChild(J),M.value=J};return w.watch(A,Le=>{Ae(Le),y.value&&le()},{deep:!0}),w.watch(()=>c.value,Le=>{w.toValue(Le)&&mt()},{immediate:!0}),w.onUnmounted(()=>{c.value&&c.value.removeEventListener("mousedown",z)}),{isSelecting:y,selectionBox:M}}function Vle(){const{selectedNodes:o,containerRef:a}=$f(),c=()=>{var g;(g=w.toValue(a))==null||g.querySelectorAll(".node-selected").forEach(p=>{p.classList.remove("node-selected")})},d=g=>{g.forEach(p=>{p.classList.add("node-selected")})};w.watch(()=>o,()=>{c(),setTimeout(()=>{var p,y;const g=(y=(p=w.toValue(o))==null?void 0:p.map(x=>{var T;return(T=a.value)==null?void 0:T.querySelector(`[id="${x.id}"]`)}))==null?void 0:y.filter(Boolean);d(g)},0)},{deep:!0})}const rd=[];for(let o=0;o<256;++o)rd.push((o+256).toString(16).slice(1));function eOe(o,a=0){return(rd[o[a+0]]+rd[o[a+1]]+rd[o[a+2]]+rd[o[a+3]]+"-"+rd[o[a+4]]+rd[o[a+5]]+"-"+rd[o[a+6]]+rd[o[a+7]]+"-"+rd[o[a+8]]+rd[o[a+9]]+"-"+rd[o[a+10]]+rd[o[a+11]]+rd[o[a+12]]+rd[o[a+13]]+rd[o[a+14]]+rd[o[a+15]]).toLowerCase()}let PQ;const tOe=new Uint8Array(16);function nOe(){if(!PQ){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");PQ=crypto.getRandomValues.bind(crypto)}return PQ(tOe)}const oOe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hre={randomUUID:oOe};function E4(o,a,c){var g;if(Hre.randomUUID&&!a&&!o)return Hre.randomUUID();o=o||{};const d=o.random??((g=o.rng)==null?void 0:g.call(o))??nOe();if(d.length<16)throw new Error("Random bytes length must be >= 16");return d[6]=d[6]&15|64,d[8]=d[8]&63|128,eOe(d)}const bz=()=>{const{nodes:o,updateNodes:a}=T0();return{nodes:o,addNode:x=>{const A=(Array.isArray(x)?x:[x]).map(P=>({...P,id:P.id||E4()})),M=[...o.value,...A];a(M)},removeNode:x=>{const T=Array.isArray(x)?x:[x],A=[],M=[];T.forEach(z=>{const U=o.value.find(q=>(q==null?void 0:q.id)===z);jte(U)?A.push(z):M.push(z)});let P=o.value.filter(z=>!M.includes(z==null?void 0:z.id));P=P==null?void 0:P.map(z=>A.includes(z==null?void 0:z.id)?{id:z==null?void 0:z.id,nodePath:z==null?void 0:z.nodePath,label:"文本",nodeType:"text"}:z),a(P)},editNodes:x=>{const T=Array.isArray(x)?x:[x];let A=E4();const M=T.map(z=>{let U={...z},q=z==null?void 0:z.id;return q||(q=E4(),U.id=q),U!=null&&U.groupKey||(U.groupKey=A),U}),P=[...o.value];M.forEach(z=>{const U=P.findIndex(q=>q.id===z.id);U!==-1?P[U]=z:P.push(z)}),a(P)},insertNodeAt:(x,T)=>{const A=[...o.value];A.splice(T,0,x),a(A)},moveNode:(x,T)=>{const A=[...o.value],[M]=A.splice(x,1);A.splice(T,0,M),a(A)}}};function sOe(){const{removeNode:o}=bz(),{containerRef:a}=$f(),c=g=>{var q,Q;if(g.target instanceof Element&&g.target.classList.contains("node-item"))return;const p=g.target;if(p===a.value)return;const x=((q=a.value)==null?void 0:q.getRootNode()).getSelection(),T=(Q=a.value)==null?void 0:Q.querySelectorAll('[contenteditable="true"]');T==null||T.forEach(ee=>{ee.setAttribute("contenteditable","false")});const A=p.textContent||"",M=p.innerHTML||"";p.setAttribute("contenteditable","true"),p.focus();const P=new MutationObserver(()=>{p.textContent!==A&&(p.innerHTML=M)});P.observe(p,{characterData:!0,childList:!0,subtree:!0});const z=ee=>{ee.preventDefault()};p.addEventListener("input",z),p.addEventListener("paste",z),p.addEventListener("drop",z),p.addEventListener("keydown",ee=>{var le,ae,Z,Ae;if(((le=document.activeElement)==null?void 0:le.shadowRoot)===((ae=a.value)==null?void 0:ae.getRootNode())&&!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(ee.key)){if(ee.key==="Backspace"||ee.key==="Delete"){const mt=x==null?void 0:x.getRangeAt(0);if(p.blur(),(mt==null?void 0:mt.startOffset)===0){const Le=mt.startContainer;if(Le.nodeType===Node.TEXT_NODE){const J=Le.previousSibling;if(J&&J.nodeType===Node.ELEMENT_NODE&&J.classList.contains("node-item")){const Ge=J.getAttribute("id");Ge&&o(Ge),(Z=Le.parentElement)==null||Z.normalize();return}}else if(Le.nodeType===Node.ELEMENT_NODE){const J=Le.previousSibling;if(J&&J.nodeType===Node.ELEMENT_NODE&&J.classList.contains("node-item")){const Ge=J.getAttribute("id");Ge&&o(Ge),(Ae=Le.parentElement)==null||Ae.normalize();return}}}}ee.preventDefault()}});const U=()=>{P.disconnect(),p.removeEventListener("input",z),p.removeEventListener("paste",z),p.removeEventListener("drop",z),p.removeEventListener("blur",U),p.setAttribute("contenteditable","false")};p.addEventListener("blur",U)},d=()=>{var g;(g=a.value)==null||g.addEventListener("dblclick",c)};return w.watch(a,g=>{g&&d()},{immediate:!0}),w.onUnmounted(()=>{var g;(g=a.value)==null||g.removeEventListener("dblclick",c)}),{}}function rOe(){const{containerRef:o,focusedElement:a,cursorPosition:c,focusedNodeIndex:d,preNodeNumber:g}=$f(),p=A=>{var P,z;const M=A==null?void 0:A.getSelection();try{if((P=a.value)==null||P.normalize(),M){const U=M.getRangeAt(0);d.value=zAe(U.startContainer);const q=U.startOffset,Q=(z=a.value)==null?void 0:z.querySelectorAll(".node-item");let ee=0;return g.value=0,Q==null||Q.forEach(le=>{const ae=document.createRange();if(ae.selectNode(le),ae.comparePoint(U.startContainer,q)>=0){g.value+=1;const Z=le.getAttribute("data-startOffset");Number(Z)>ee&&(ee=Number(Z))}}),ee+q}}catch{}return 0},y=()=>{var M;const A=(M=o.value)==null?void 0:M.getRootNode();c.value=p(A)},x=A=>{var U;const M=A.target;if(M===o.value)return;a.value=M;const P=(U=o.value)==null?void 0:U.getRootNode();c.value=p(P),M.addEventListener("click",y),M.addEventListener("keyup",q=>{["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(q.key)&&y()});const z=()=>{M.removeEventListener("click",y),M.removeEventListener("keyup",y),M.removeEventListener("blur",z),setTimeout(()=>{a.value=null,d.value=0,c.value=-1},300)};M.addEventListener("blur",z)},T=()=>{var A;(A=o.value)==null||A.addEventListener("focus",x,!0)};return w.watch(o,A=>{A&&T()},{immediate:!0}),w.onUnmounted(()=>{var A;(A=o.value)==null||A.removeEventListener("focus",x,!0)}),{focusedElement:a,cursorPosition:c,focusedNodeIndex:d,preNodeNumber:g}}function aOe(o){const a=o.value===null?[]:[JSON.parse(JSON.stringify(o.value))],c=w.ref(a),d=w.ref(0),g=w.ref(!1),p=w.computed(()=>c.value[d.value]),y=()=>{d.value>0&&(g.value=!0,d.value--,o.value=JSON.parse(JSON.stringify(c.value[d.value])))},x=()=>{d.value<c.value.length-1&&(g.value=!0,d.value++,o.value=JSON.parse(JSON.stringify(c.value[d.value])))},T=A=>{(A.ctrlKey||A.metaKey)&&A.key==="z"?(A.preventDefault(),y()):(A.ctrlKey||A.metaKey)&&A.key==="y"&&(A.preventDefault(),x())};return w.onMounted(()=>{window.addEventListener("keydown",T)}),w.onUnmounted(()=>{window.removeEventListener("keydown",T)}),w.watch(o,Vx(A=>{A&&!g.value&&(c.value.splice(d.value+1),c.value.push(JSON.parse(JSON.stringify(A))),d.value++),g.value&&(g.value=!1)},300),{deep:!0}),{current:p,undo:y,redo:x}}function iOe(){const{modelValue:o}=T0(),{nodes:a,addNode:c}=bz(),d=y=>{if(!y||typeof y!="string")return[];const T=new DOMParser().parseFromString(y,"text/html");return Array.from(T.querySelectorAll("td")).filter(P=>{var z;return!((z=P.textContent)!=null&&z.trim())})},g=(y,x)=>{const T=x.map(M=>M.nodePath);return y==null?void 0:y.map(M=>({nodePath:zte(M)})).filter(M=>{const P=M==null?void 0:M.nodePath;return!T.includes(P)})},p=y=>{const x=y.map(T=>({nodeType:"Text",label:"文本",...T}));c(x)};w.onMounted(()=>{const y=d(o),x=g(y,w.toValue(a));p(x)})}function cOe(){const{selectedNodes:o,containerRef:a}=$f(),{removeNode:c}=bz(),d=w.ref(null),g=x=>{var T;if((T=w.toValue(a))!=null&&T.contains(d.value)&&(x.key==="Delete"||x.key==="Backspace")){let A=[];x.preventDefault(),w.toValue(o).length>0&&(w.toValue(o).forEach(M=>{var P,z,U;if(((P=M==null?void 0:M.element)==null?void 0:P.tagName)==="TD"){const q=(z=M==null?void 0:M.element)==null?void 0:z.getAttribute("id");q&&A.push(q)}else{const q=(U=M==null?void 0:M.element)==null?void 0:U.getAttribute("id");q&&A.push(q)}}),o.value=[],(A==null?void 0:A.length)>0&&c(A))}},p=x=>{var T;(T=w.toValue(a))!=null&&T.contains(x.target)?d.value=x.target:d.value=null},y=()=>{a.value&&(window.addEventListener("keydown",g),a.value.addEventListener("mousedown",p))};w.watch(()=>a.value,x=>{w.toValue(x)&&y()},{immediate:!0}),w.onUnmounted(()=>{a.value&&(window.removeEventListener("keydown",g),a.value.removeEventListener("mousedown",p))})}function vz(){const{nodes:o}=T0(),{containerRef:a,renderNodes:c,uiReady:d}=$f(),g=()=>{var p;c.value=[...(p=o.value)==null?void 0:p.map(y=>{var T;const x=(T=a.value)==null?void 0:T.querySelector(`[id="${y.id}"]`);return{...y,element:x}})].filter(y=>!!(y!=null&&y.element))};w.watch(()=>[o,a.value,d],()=>{w.toValue(d)&&g()},{immediate:!0,deep:!0})}const Pee=w.ref({});function yz(o){return w.computed(()=>{var a;return(a=Pee.value)==null?void 0:a[o]})}function Hle(){const o=T0(),a=$f();w.onMounted(()=>{const{editorId:c}=o;c&&(Pee.value[c]=w.ref({...o,...a}))}),w.onUnmounted(()=>{const{editorId:c}=o;c&&(Pee.value[c]=null)})}const lOe=w.defineComponent({__name:"NodesEditUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{nodes:a}=T0(),{uiReady:c,renderNodes:d}=$f();return Hle(),aOe(a),Lle(),Vle(),cOe(),rOe(),sOe(),iOe(),vz(),(g,p)=>w.unref(c)?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(w.unref(d),y=>(w.openBlock(),w.createBlock(pz,{key:y==null?void 0:y.id,node:y},{default:w.withCtx(x=>[w.renderSlot(g.$slots,"nodeItem",{node:x==null?void 0:x.node})]),_:2},1032,["node"]))),128)):w.createCommentVNode("",!0)}}),zre=w.defineComponent({__name:"NodesPreviewUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:a,renderNodes:c}=$f();return vz(),(d,g)=>w.unref(a)?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(w.unref(c),p=>(w.openBlock(),w.createBlock(pz,{key:p==null?void 0:p.id,node:p},{default:w.withCtx(y=>[w.renderSlot(d.$slots,"nodeItem",{node:y==null?void 0:y.node})]),_:2},1032,["node"]))),128)):w.createCommentVNode("",!0)}}),uOe=w.defineComponent({__name:"NodesEnterUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:a,renderNodes:c}=$f();return vz(),(d,g)=>w.unref(a)?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(w.unref(c),p=>(w.openBlock(),w.createBlock(pz,{key:p==null?void 0:p.id,node:p},{default:w.withCtx(y=>[w.renderSlot(d.$slots,"nodeItem",{node:y==null?void 0:y.node})]),_:2},1032,["node"]))),128)):w.createCommentVNode("",!0)}}),dOe=w.defineComponent({__name:"NodesSelectUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:a,renderNodes:c}=$f();return Hle(),Lle(),Vle(),vz(),(d,g)=>w.unref(a)?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(w.unref(c),p=>(w.openBlock(),w.createBlock(pz,{key:p==null?void 0:p.id,node:p},{default:w.withCtx(y=>[w.renderSlot(d.$slots,"nodeItem",{node:y==null?void 0:y.node})]),_:2},1032,["node"]))),128)):w.createCommentVNode("",!0)}}),fOe=w.defineComponent({__name:"NodesProvider",props:w.mergeModels({modelValue:{type:String,default:""},nodes:{type:Array,default:()=>[]},renderType:{type:String,default:"preview"},inputTypes:{type:Array,default:()=>[]},editorId:{type:String,default:""}},{formData:{},formDataModifiers:{},nodes:{},nodesModifiers:{}}),emits:w.mergeModels(["update:nodes"],["update:formData","update:nodes"]),setup(o,{emit:a}){const c=o,d=w.useModel(o,"formData"),g=w.useModel(o,"nodes");return w.provide(Fle,{modelValue:c.modelValue,renderType:c.renderType,inputTypes:c.inputTypes,editorId:c==null?void 0:c.editorId,nodes:g,updateNodes:p=>g.value=p,formData:d}),(p,y)=>w.renderSlot(p.$slots,"default")}}),jw=w.ref({});function mOe(o){return jw.value[o]||(jw.value[o]=w.ref([])),jw.value[o]}function gOe(o){const{editorId:a}=o;jw.value[a]||(jw.value[a]=w.ref([])),jw.value[a].push(o),w.onUnmounted(()=>{jw.value[a]=jw.value[a].filter(c=>c.id!==o.id)})}const hOe=w.defineComponent({__name:"NodesUIProvider",props:{nodes:{type:Array,default:()=>[]},selectedNodes:{type:Array,default:()=>[]},nodesGroups:{type:Array,default:()=>[]},editorId:{type:String,default:""}},emits:["onSelectedNodes","update:selectedNodes"],setup(o,{expose:a,emit:c}){const d=o,g=c,p=w.computed({get:()=>(d.selectedNodes||[]).map(le=>{var Ae;let ae=(Ae=d==null?void 0:d.nodes)==null?void 0:Ae.find(mt=>(mt==null?void 0:mt.id)===(le==null?void 0:le.id)),Z=le!=null&&le.element?le==null?void 0:le.element:LAe(le==null?void 0:le.id,y.value);return{...ae||{},...le,element:Z}}),set:le=>{const ae=le.map(({element:Z,...Ae})=>{var Le;return{...((Le=d==null?void 0:d.nodes)==null?void 0:Le.find(J=>(J==null?void 0:J.id)===(Ae==null?void 0:Ae.id)))||{},...Ae}});g("update:selectedNodes",ae)}}),y=w.ref(null),x=w.ref([]),T=w.ref(null),A=w.ref(-1),M=w.ref(0),P=w.ref(0),z=mOe(d==null?void 0:d.editorId),U=w.ref(!1),q=w.computed(()=>{var ae;const le=((ae=w.toValue(z))==null?void 0:ae.filter(Z=>!w.toValue(Z==null?void 0:Z.activated)))||[];return jAe([...(d==null?void 0:d.nodesGroups)||[],...le])}),Q=w.ref([]),ee=le=>{const ae=le.map(({element:Z,...Ae})=>{var Le;return{...((Le=x.value)==null?void 0:Le.find(J=>(J==null?void 0:J.id)===(Ae==null?void 0:Ae.id)))||{},...Ae}});p.value=le,g("onSelectedNodes",ae)};return a({setSelectedNodes:ee}),w.provide(Ile,{containerRef:y,focusedElement:T,currentRenderNodes:Q,cursorPosition:A,focusedNodeIndex:M,preNodeNumber:P,currentNodes:q,selectedNodes:p,setSelectedNodes:ee,renderNodes:x,uiReady:U}),(le,ae)=>w.renderSlot(le.$slots,"default")}}),pOe=["onClick"],bOe={key:0,class:"icon"},vOe={key:1,class:"arrow"},yOe={key:0,class:"submenu"},wOe=["onClick"],COe={key:0,class:"icon"},SOe=w.defineComponent({__name:"index",props:w.mergeModels({style:{}},{show:{},showModifiers:{}}),emits:w.mergeModels(["select"],["update:show"]),setup(o,{emit:a}){const{selectedNodes:c,focusedElement:d,cursorPosition:g,focusedNodeIndex:p,preNodeNumber:y}=$f(),{inputTypes:x}=T0(),T=w.useModel(o,"show"),{editNodes:A}=bz(),M=q=>{if(w.toValue(d)&&!g0e(w.toValue(g))){const Q=zte(w.toValue(d)),ee=w.toValue(g),le=(w.toValue(y)||0)+1,ae=UAe(w.toValue(d));Q&&ee&&ee>=0&&A({...ae,label:q==null?void 0:q.label,nodePath:Q,startOffset:ee,subNodeSort:le,textNodeIndex:w.toValue(p)||0,nodeType:q==null?void 0:q.value})}else if(c){const Q=w.toValue(c);Q!=null&&Q.length&&A(Q==null?void 0:Q.map(ee=>({...ee,label:q==null?void 0:q.label,element:ee==null?void 0:ee.element,nodePath:ee==null?void 0:ee.nodePath,nodeType:q==null?void 0:q.value})))}T.value=!1},P=w.computed(()=>{const q=[],Q=[];return w.toValue(x).forEach(ee=>{ee.groupName==="system"?Q.push({...ee,handler:()=>{M(ee)}}):q.push({...ee,handler:()=>{M(ee)}})}),[{label:"限定填写内容",icon:"i-bi:lock",children:q},{label:"插入记录标识",icon:"i-bi:flag",children:Q}].filter(ee=>{var le;return(le=ee==null?void 0:ee.children)==null?void 0:le.length})}),z=a,U=(q,Q)=>{q.preventDefault(),Q!=null&&Q.handler&&Q.handler(),Q!=null&&Q.value&&z("select",Q==null?void 0:Q.value)};return(q,Q)=>w.withDirectives((w.openBlock(),w.createElementBlock("div",{class:"context-menu",style:w.normalizeStyle({...q.style})},[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(P.value,ee=>(w.openBlock(),w.createElementBlock("div",{key:ee==null?void 0:ee.label,class:"menu-item"},[w.createElementVNode("div",{class:"menu-item-content",onClick:le=>U(le,ee)},[ee!=null&&ee.icon?(w.openBlock(),w.createElementBlock("div",bOe,[w.createElementVNode("div",{class:w.normalizeClass(ee==null?void 0:ee.icon)},null,2)])):w.createCommentVNode("",!0),w.createTextVNode(" "+w.toDisplayString(ee.label)+" ",1),ee!=null&&ee.children?(w.openBlock(),w.createElementBlock("span",vOe,"›")):w.createCommentVNode("",!0)],8,pOe),ee!=null&&ee.children?(w.openBlock(),w.createElementBlock("div",yOe,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(ee.children,le=>(w.openBlock(),w.createElementBlock("div",{key:le.action,class:"menu-item",onClick:ae=>U(ae,le)},[le!=null&&le.icon?(w.openBlock(),w.createElementBlock("div",COe,[w.createElementVNode("div",{class:w.normalizeClass(le==null?void 0:le.icon)},null,2)])):w.createCommentVNode("",!0),w.createTextVNode(" "+w.toDisplayString(le.label),1)],8,wOe))),128))])):w.createCommentVNode("",!0)]))),128))],4)),[[w.vShow,T.value]])}}),xOe=cu(SOe,[["__scopeId","data-v-7f46efc3"]]);function EOe(){const o=w.ref(!1),a=w.ref({left:"0px",top:"0px"}),c=g=>{g.preventDefault(),o.value=!0;const y=g.currentTarget.getBoundingClientRect(),x=g.clientX-y.left,T=g.clientY-y.top,A=118,M=y.width-x<A;a.value={left:M?`${x-A}px`:`${x}px`,top:`${T}px`}},d=g=>{const p=document.querySelector(".context-menu");p&&!p.contains(g.target)&&(o.value=!1)};return w.onMounted(()=>{document.addEventListener("mousedown",d)}),w.onUnmounted(()=>{document.removeEventListener("mousedown",d)}),{showContextMenu:o,contextMenuStyle:a,onContextMenu:c,closeContextMenu:d}}function zle(o){return{all:o=o||new Map,on:function(a,c){var d=o.get(a);d?d.push(c):o.set(a,[c])},off:function(a,c){var d=o.get(a);d&&(c?d.splice(d.indexOf(c)>>>0,1):o.set(a,[]))},emit:function(a,c){var d=o.get(a);d&&d.slice().map(function(g){g(c)}),(d=o.get("*"))&&d.slice().map(function(g){g(a,c)})}}}const Bee=zle(),Ule=(...o)=>{const a=o[0],c=o[1];w.onMounted(()=>{Bee.on(a,c)}),w.onBeforeUnmount(()=>{Bee.off(a)})},Wte=()=>(...a)=>{Bee.emit(...a)};let m0=null;function _Oe(o){const{onSelected:a}=o,{selectedNodes:c,setSelectedNodes:d}=$f();return w.watch(()=>c,()=>{m0==null||m0({data:c.value}),a==null||a(w.toValue(c))},{deep:!0}),Ule("selectNodes",p=>{const{data:y,callback:x=null,mode:T="multiple"}=p;setTimeout(()=>{d(w.toValue(y)),m0=x},100)}),{onBlur:()=>{m0&&(m0==null||m0({data:c.value,type:"blur"}),m0=null,d([]))}}}const TOe={class:"relative"},kOe=w.defineComponent({__name:"index",props:{hasContextMenu:{type:Boolean,default:!1}},setup(o){const{containerRef:a,uiReady:c}=$f(),{nodes:d,modelValue:g}=T0(),{showContextMenu:p,contextMenuStyle:y,onContextMenu:x}=EOe(),T=w.ref(null),A=U=>{let q=null;if(jte(U))q=Ple(U.nodePath,w.toValue(a)),q&&q.classList.add("node-item-td");else{const Q=document.createElement("span");Q.setAttribute("contenteditable","false"),Q.classList.add("node-item"),q=Q,VAe(U,q,a.value)}return q&&HAe(q,U),q},M=()=>{const U=C0e(d.value,[q=>q.nodePath,q=>q.textNodeIndex,q=>q.startOffset??-1,q=>q.subNodeSort],["asc","desc","desc","desc"]);U==null||U.forEach(q=>{A(q)})};w.watch(()=>[d,g,T],()=>{T.value&&(c.value=!1,w.nextTick(()=>{T.value&&(T.value.innerHTML=g,M(),c.value=!0)}))},{deep:!0,immediate:!0});const P=w.ref(),{onBlur:z}=_Oe({onSelected:()=>{var U;(U=P.value)==null||U.focus()}});return(U,q)=>(w.openBlock(),w.createElementBlock("div",TOe,[w.createVNode(Hte,{onOnBlur:w.unref(z),ref_key:"shadowDomRef",ref:P},{default:w.withCtx(()=>[w.createElementVNode("html",{class:"nodes-editor",ref_key:"containerRef",ref:a,onContextmenu:q[0]||(q[0]=w.withModifiers((...Q)=>w.unref(x)&&w.unref(x)(...Q),["prevent"]))},[w.createElementVNode("body",{ref_key:"bodyRef",ref:T},null,512)],544)]),_:1},8,["onOnBlur"]),o.hasContextMenu?(w.openBlock(),w.createBlock(xOe,{key:0,show:w.unref(p),"onUpdate:show":q[1]||(q[1]=Q=>w.isRef(p)?p.value=Q:null),style:w.normalizeStyle(w.unref(y))},null,8,["show","style"])):w.createCommentVNode("",!0)]))}}),jle=w.defineComponent({__name:"index",props:w.mergeModels({modelValue:{type:String,default:""},nodes:{type:Array,default:()=>[]},pagesize:{type:String,default:"A4"},renderType:{type:String,default:"preview"},formData:{type:Object,default:()=>({})},inputTypes:{type:Array,default:()=>[]},nodesGroups:{type:Array,default:()=>[]},id:{type:String,default:""}},{selectedNodes:{default:[]},selectedNodesModifiers:{}}),emits:w.mergeModels(["update:nodes","update:formData","onSelectedNodes"],["update:selectedNodes"]),setup(o,{expose:a,emit:c}){const d=o,g=c,p=w.useModel(o,"selectedNodes"),y=w.ref(),x=w.ref(),T=w.computed(()=>{switch(d.renderType){case"edit":return lOe;case"select":return dOe;case"result":return zre;case"enter":return uOe;default:return zre}}),A=z=>{g("update:nodes",z)},M=z=>{g("update:formData",z)},P=z=>{g("onSelectedNodes",z)};return a({formRef:{validate:()=>{var z,U,q;return(q=(U=(z=y.value)==null?void 0:z.formRef)==null?void 0:U.validate)==null?void 0:q.call(U)}},setSelectedNodes:z=>{var U,q;(q=(U=x.value)==null?void 0:U.setSelectedNodes)==null||q.call(U,z)}}),(z,U)=>(w.openBlock(),w.createBlock(hOe,{ref_key:"UIRef",ref:x,nodes:o.nodes,"onUpdate:nodes":A,selectedNodes:p.value,"onUpdate:selectedNodes":U[0]||(U[0]=q=>p.value=q),onOnSelectedNodes:P,nodesGroups:o.nodesGroups,editorId:d==null?void 0:d.id},{default:w.withCtx(()=>[w.createVNode(fOe,{renderType:o.renderType,"model-value":o.modelValue,nodes:o.nodes,"onUpdate:nodes":A,formData:o.formData,"onUpdate:formData":M,inputTypes:o.inputTypes,editorId:d==null?void 0:d.id},{default:w.withCtx(()=>[w.createVNode(kOe,{hasContextMenu:o.renderType==="edit"},null,8,["hasContextMenu"]),(w.openBlock(),w.createBlock(w.resolveDynamicComponent(T.value),{renderType:o.renderType,pagesize:o.pagesize,ref_key:"contentRef",ref:y},{nodeItem:w.withCtx(q=>[w.renderSlot(z.$slots,"nodeItem",{node:q==null?void 0:q.node})]),_:3},8,["renderType","pagesize"]))]),_:3},8,["renderType","model-value","nodes","formData","inputTypes","editorId"])]),_:3},8,["nodes","selectedNodes","nodesGroups","editorId"]))}}),AOe={class:"nodes-text"},OOe={key:0,class:"node-text-input"},NOe={key:1,class:"node-text-td"},$Oe={key:0,class:"node-text-table-index"},DOe=w.defineComponent({__name:"index",props:w.mergeModels({editorId:{type:String,default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const a=o,c=w.useModel(o,"modelValue"),d=yz(a==null?void 0:a.editorId),g=w.computed(()=>{var y,x,T,A,M,P;if(((y=w.toValue(p))==null?void 0:y.length)>0)if((T=(x=w.toValue(p))==null?void 0:x[0])!=null&&T.element){const z=(M=(A=w.toValue(p))==null?void 0:A[0])==null?void 0:M.element.closest("body").querySelectorAll("table");return((P=Array.from(z))==null?void 0:P.length)===1}else return!0;else return!0}),p=w.computed(()=>{var y;return Ble(c.value,((y=w.toValue(d))==null?void 0:y.renderNodes)||[])});return(y,x)=>(w.openBlock(),w.createElementBlock("div",AOe,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(p.value,(T,A)=>{var M,P,z;return w.openBlock(),w.createElementBlock("div",{key:A,class:"node-text-item"},[(T==null?void 0:T.showTextType)==="input"?(w.openBlock(),w.createElementBlock("span",OOe," 填写"+w.toDisplayString(T==null?void 0:T.inputIndex),1)):(w.openBlock(),w.createElementBlock("span",NOe,[g.value?w.createCommentVNode("",!0):(w.openBlock(),w.createElementBlock("span",$Oe,w.toDisplayString(`表${(M=T==null?void 0:T.min)==null?void 0:M.tableIndex}.`),1)),w.createTextVNode(" "+w.toDisplayString(((P=T==null?void 0:T.min)==null?void 0:P.id)===((z=T==null?void 0:T.max)==null?void 0:z.id)?w.unref(x4)(T==null?void 0:T.min):`${w.unref(x4)(T==null?void 0:T.min)}:${w.unref(x4)(T==null?void 0:T.max)}`),1)]))])}),128))]))}}),MOe=cu(DOe,[["__scopeId","data-v-67e3a210"]]);function ROe(o){const{nodes:a,mode:c="multiple"}=o,d=w.ref(!1),g=Wte();return{isSelecting:d,selectNodes:()=>{if(d.value)return!1;d.value=!0,g("selectNodes",{data:w.toValue(a),mode:c,callback:({data:y,type:x})=>{a.value=y,x==="blur"&&(d.value=!1)}})}}}const f4=["#ff9b40","#b36c2d","#7548ff","#5233b3","#649ee5","#aac4ed","#f9ce57","#ae74e8"],BQ=w.ref(0),$x=new Map,IOe={class:"node-select"},POe={class:"flex py-2 px-2 justify-between items-center noder-select-header"},BOe={class:"flex gap-2"},FOe={class:"flex gap-1"},LOe=w.defineComponent({__name:"index",props:w.mergeModels({mode:{type:String,default:"multiple"},color:{type:String},id:{type:String,default:""},editorId:{type:String,default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const a=o;!($x!=null&&$x[a==null?void 0:a.id])&&(a!=null&&a.id)&&($x[a==null?void 0:a.id]=BQ.value,BQ.value=BQ.value+1);const c=w.ref(($x==null?void 0:$x[a==null?void 0:a.id])||0),d=w.useModel(o,"modelValue"),{selectNodes:g,isSelecting:p}=ROe({nodes:d,mode:a.mode}),y=()=>{d.value=[]},x=w.computed(()=>a.color||(f4==null?void 0:f4[w.toValue(c)%(f4==null?void 0:f4.length)])||"#409eff");return gOe({id:a.id,editorId:a.editorId,nodes:d,activated:p,color:x.value}),(T,A)=>(w.openBlock(),w.createElementBlock("div",IOe,[w.createElementVNode("div",POe,[w.createElementVNode("div",BOe,[w.createElementVNode("div",{style:w.normalizeStyle({"--node-color":x.value}),class:"node-color cursor-pointer"},null,4),w.createElementVNode("div",{style:w.normalizeStyle(w.unref(p)?{color:"#409eff"}:{})},[w.createElementVNode("div",{class:"i-bi:hand-index text-[18px] cursor-pointer",onClick:A[0]||(A[0]=(...M)=>w.unref(g)&&w.unref(g)(...M))})],4),w.createElementVNode("div",null,[w.createElementVNode("div",{class:"i-bi:eraser-fill text-[18px] cursor-pointer",onClick:y})])]),w.createElementVNode("div",FOe,[A[4]||(A[4]=w.createElementVNode("div",{class:"color-[#999]"},"Ctrl+左键多选",-1)),w.createElementVNode("div",null,[w.createVNode(w.unref(rs.ElPopover),{placement:"top-start",width:200,trigger:"hover",content:"this is content, this is content, this is content"},{reference:w.withCtx(()=>A[3]||(A[3]=[w.createElementVNode("div",{class:"flex flex-center"},[w.createElementVNode("div",{class:"i-bi:info-circle-fill mr-2"}),w.createTextVNode(" 使用帮助 ")],-1)])),_:1})])])]),w.createElementVNode("div",{class:"min-h-[42px] px-2 py-1",onClick:A[2]||(A[2]=(...M)=>w.unref(g)&&w.unref(g)(...M))},[w.createVNode(MOe,{modelValue:d.value,"onUpdate:modelValue":A[1]||(A[1]=M=>d.value=M),editorId:o.editorId},null,8,["modelValue","editorId"])])]))}}),Wle=cu(LOe,[["__scopeId","data-v-aa7f5cc8"]]);function VOe(o){if(!o.startsWith("="))return[];const a=[];let c=1;for(o.startsWith("=")&&a.push({type:"startOperator",value:"="});c<o.length;){const d=o[c];if(/\s/.test(d)){c++;continue}if(/[A-Za-z]/.test(d)&&/\d/.test(o[c+1])){let g="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)g+=o[c++];for(;c<o.length&&/\d/.test(o[c]);)g+=o[c++];if(c<o.length&&o[c]===":"){c++;let p="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)p+=o[c++];for(;c<o.length&&/\d/.test(o[c]);)p+=o[c++];a.push({type:"range",value:`${g}:${p}`});continue}else{a.push({type:"cell",value:g});continue}}if(/[A-Za-z]/.test(d)&&/\d/.test(o[c+1])){let g="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)g+=o[c++];for(;c<o.length&&/\d/.test(o[c]);)g+=o[c++];a.push({type:"cell",value:g});continue}if(/[A-Za-z]/.test(d)){let g="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)g+=o[c++];if(["AVERAGE","AVEDEV","SUM","IF","COUNT","MAX","MIN","SQRT"].includes(g.toUpperCase())&&o[c]==="("){a.push({type:"function",value:g});continue}c-=g.length}if(/\d/.test(d)){let g="";for(;c<o.length&&(/\d/.test(o[c])||o[c]===".");)g+=o[c++];a.push({type:"number",value:g});continue}if(d==='"'){let g="";for(g+=d,c++;c<o.length&&o[c]!=='"';)g+=o[c++];g+=d,c++,a.push({type:"string",value:g});continue}if(/[A-Za-z]/.test(d)&&/\d/.test(o[c+1])){let g="";for(;c<o.length&&/[A-Za-z]/.test(o[c]);)g+=o[c++];for(;c<o.length&&/\d/.test(o[c]);)g+=o[c++];a.push({type:"cell",value:g});continue}if(d===":"){a.push({type:"operator",value:":"}),c++;continue}if(/[+\-*/=><]/.test(d)){a.push({type:"operator",value:d}),c++;continue}if(/[()]/.test(d)){a.push({type:"paren",value:d}),c++;continue}if(d===","){a.push({type:"separator",value:","}),c++;continue}c++}return a}function HOe(o,a){const c=[];let d=0;for(;d<o.length;){let g=!1;for(const p of a){const y=p.value;if(o.startsWith(y,d)){c.push({type:p.type,value:y,...p.cellValue?{cellValue:p.cellValue}:{}}),d+=y.length,g=!0;break}}g||(c.push({type:"plain",value:o[d]}),d++)}return c}function zOe(o){const a=yz(o.editorId),c=(y,x)=>{let T=[];const A=Math.min(y.colIndex,x.colIndex),M=Math.max(y.colIndex,x.colIndex),P=Math.min(y.rowIndex,x.rowIndex),z=Math.max(y.rowIndex,x.rowIndex);for(let U=P;U<=z;U++)for(let q=A;q<=M;q++)T.push({colIndex:q,rowIndex:U});return T},d=y=>{var M;const x=y.includes(":");let T=[];if(x){const[P,z]=y.split(":").map(U=>p(U));T=c(P,z)}else T=[p(y)];return g(T,w.toValue((M=w.toValue(a))==null?void 0:M.nodes))},g=(y,x)=>x==null?void 0:x.filter(T=>{const A=T.nodePath.split(" > ");let M=1,P=1;return A.forEach(z=>{if(z.startsWith("tr")){const U=z.match(/tr(?::nth-child\((\d+)\))?/);U&&U[1]&&(M=parseInt(U[1]))}else if(z.startsWith("td")){const U=z.match(/td(?::nth-child\((\d+)\))?/);U&&(P=U[1]?parseInt(U[1]):1)}}),y.some(z=>M===z.rowIndex+1&&P===z.colIndex+1)}),p=y=>{if(!y)return{colIndex:-1,rowIndex:-1};const x=y.match(/^([A-Za-z]+)(\d+)$/);if(!x)return{colIndex:-1,rowIndex:-1};const T=x[1].toUpperCase(),A=parseInt(x[2]);let M=0;for(let P=0;P<T.length;P++)M=M*26+(T.charCodeAt(P)-64);return{colIndex:M-1,rowIndex:A}};return{getCellValue:d}}const Ure=["#0288D1","#D32F2F","#F57C00","#388E3C","#303F9F","#7B1FA2","#C2185B","#880E4F","#689F38","#5D4037"];function UOe(o,a,c){const d=w.ref(null),g=w.ref(null);function p(){return o.value&&o.value.textContent||""}w.onMounted(()=>{o.value&&(d.value=()=>{const x=p();a.value=x},g.value=()=>{const x=p();a.value=x},o.value.addEventListener("input",d.value),o.value.addEventListener("blur",g.value))}),w.onUnmounted(()=>{o.value&&(d.value&&o.value.removeEventListener("input",d.value),g.value&&o.value.removeEventListener("blur",g.value))});const y=x=>{var T,A,M,P;if(x>=0){const z=window.getSelection();if(z){const U=z.getRangeAt(0),q=((T=U.startContainer)==null?void 0:T.nodeName)==="#text"?U.startContainer:(M=(A=U.startContainer)==null?void 0:A.childNodes)==null?void 0:M[0],Q=Math.min(x,((P=q.textContent)==null?void 0:P.length)||0);U.setStart(q,Q)}}};return w.watch(()=>[a,o],()=>{var x;o.value&&(Mu((x=o.value)==null?void 0:x.textContent,w.toValue(a))||(o.value.textContent=w.toValue(a),y(w.toValue(c))))},{deep:!0,immediate:!0}),{getFormulaContent:p}}function Zte(o){const{element:a,onFocus:c,onBlur:d}=o,g=w.ref(!1),p=()=>{g.value=!0,c==null||c()},y=()=>{g.value=!1,d==null||d()};return w.onMounted(()=>{var x,T;w.toValue(a)&&((x=w.toValue(a))==null||x.addEventListener("focus",p),(T=w.toValue(a))==null||T.addEventListener("blur",y))}),w.onUnmounted(()=>{var x,T;w.toValue(a)&&((x=w.toValue(a))==null||x.removeEventListener("focus",p),(T=w.toValue(a))==null||T.removeEventListener("blur",y))}),g}function jOe(o){const{element:a,showStr:c,editorId:d}=o,g=yz(d),p=Zte({element:a}),y=w.computed(()=>{var x;return(x=c==null?void 0:c.value)==null?void 0:x.filter(T=>["range","cell"].includes(T.type))});return w.watch(()=>p,()=>{var T,A,M,P,z,U;const x=q=>{var Q;q.preventDefault(),(Q=w.toValue(a))==null||Q.focus()};w.toValue(p)?((T=w.toValue(g))==null||T.containerRef.addEventListener("click",x),(A=w.toValue(g))==null||A.containerRef.addEventListener("mousedown",x),(M=document.querySelectorAll(".select-function"))==null||M.forEach(q=>{q.addEventListener("click",x),q.addEventListener("mousedown",x)})):((P=w.toValue(g))==null||P.containerRef.removeEventListener("click",x),(z=w.toValue(g))==null||z.containerRef.removeEventListener("mousedown",x),(U=document.querySelectorAll(".select-function"))==null||U.forEach(q=>{q.removeEventListener("click",x),q.removeEventListener("mousedown",x)}))},{deep:!0}),w.watch(()=>[p,y],()=>{var x,T,A,M,P;if((x=w.toValue(g))!=null&&x.containerRef&&((M=(A=(T=w.toValue(g))==null?void 0:T.containerRef)==null?void 0:A.querySelectorAll(".node-formula-cell"))==null||M.forEach(z=>{z.classList.remove("node-formula-cell")}),w.toValue(p))){let z=[];(P=y.value)!=null&&P.length&&(y.value.forEach(U=>{var q;z=[...z,...((q=U==null?void 0:U.cellValue)==null?void 0:q.map(Q=>({color:U==null?void 0:U.color,backgroundColor:Ute((U==null?void 0:U.color)||"#000",.1),element:Q==null?void 0:Q.element})))||[]]}),z.forEach(U=>{var q;U!=null&&U.element&&((q=U==null?void 0:U.element)==null||q.classList.add("node-formula-cell"),U==null||U.element.style.setProperty("--formula-node-color",U==null?void 0:U.color),U==null||U.element.style.setProperty("--formula-node-bg-color",U==null?void 0:U.backgroundColor))}))}},{deep:!0}),p}const WOe=o=>{const{element:a}=o,c=w.ref(-1),d=x=>{const T=x==null?void 0:x.getSelection();try{if(T)return T.getRangeAt(0).startOffset}catch{}return 0},g=()=>{var T;const x=(T=a.value)==null?void 0:T.getRootNode();c.value=d(x)},p=x=>{var P;const T=x.target,A=(P=a.value)==null?void 0:P.getRootNode();c.value=d(A),T.addEventListener("click",g),T.addEventListener("keyup",z=>{["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(z.key)&&g()});const M=()=>{T.removeEventListener("click",g),T.removeEventListener("keyup",g),T.removeEventListener("blur",M),setTimeout(()=>{c.value=-1},300)};T.addEventListener("blur",M)},y=()=>{var x;(x=a.value)==null||x.addEventListener("focus",p,!0)};return w.watch(a,x=>{x&&y()},{immediate:!0}),w.onUnmounted(()=>{var x;(x=a.value)==null||x.removeEventListener("focus",p,!0)}),{startOffset:c}};function ZOe(o,a,c,d){if(a<0||c<0||a>=o.length)throw new Error("Invalid start or length");const g=a+c;return o.slice(0,a)+d+o.slice(g)}const GOe=(o,a)=>{var d;let c=0;for(let g=0;g<a;g++){const p=o[g];c+=(d=p==null?void 0:p.value)==null?void 0:d.length}return c},qOe=o=>{const{startOffset:a,showStr:c,value:d,editorId:g,currentItemIndex:p,currentItem:y,element:x}=o,T=yz(g),A=w.ref(-1),M=w.ref(0),P=Zte({element:x}),z=w.ref(!1),U=Wte(),q=Q=>{var ee,le;if(w.toValue(z)&&w.toValue(P)&&!Mu((ee=w.toValue(y))==null?void 0:ee.cellValue,Q)){const ae=YAe(Q,((le=w.toValue(T))==null?void 0:le.nodes)||"");let Z=ae;ae&&(w.toValue(M)===0&&(Z+=","),w.toValue(A)>=0&&(d.value=ZOe(w.toValue(d),w.toValue(A),w.toValue(M),Z),M.value=ae.length))}};w.watch(()=>p,()=>{var Q,ee,le,ae,Z,Ae;if((Q=T.value)==null||Q.setSelectedNodes([]),["range","cell"].includes((ee=w.toValue(y))==null?void 0:ee.type))return A.value=GOe(c.value,p.value),M.value=(ae=(le=w.toValue(y))==null?void 0:le.value)==null?void 0:ae.length,z.value=!0,U("selectNodes",{data:(Z=w.toValue(y))==null?void 0:Z.cellValue,mode:"multiple",callback:({data:mt})=>{q(mt)}}),!1;if([",","(","="].includes((Ae=w.toValue(y))==null?void 0:Ae.value))return A.value=w.toValue(a),z.value=!0,M.value=0,U("selectNodes",{data:[],mode:"multiple",callback:({data:mt})=>{q(mt)}}),!1;z.value=!1,A.value=-1},{immediate:!0,deep:!0})},YOe=o=>{const{startOffset:a,showStr:c}=o,d=w.ref(-1);w.watch(()=>a,()=>{var p;if(w.toValue(a)<=0)d.value=-1;else{let y=0;for(let x=0;x<c.value.length;x++){const T=c.value[x];if(y+=(p=T==null?void 0:T.value)==null?void 0:p.length,y>=w.toValue(a)){d.value=x;break}}}},{deep:!0,immediate:!0});const g=w.computed(()=>{var p;return(p=w.toValue(c))==null?void 0:p[w.toValue(d)]});return{currentItemIndex:d,currentItem:g}};function KOe(o,a,c,d){if(a<0||c<0||a>=o.length)throw new Error("Invalid start or length");const g=a+c;return o.slice(0,a)+d+o.slice(g)}const XOe=(o,a)=>{var d;let c=0;for(let g=0;g<a;g++){const p=o[g];c+=(d=p==null?void 0:p.value)==null?void 0:d.length}return c},JOe=o=>{const{startOffset:a,showStr:c,value:d,currentItemIndex:g,currentItem:p,element:y}=o,x=w.ref(-1),T=w.ref(0),A=Zte({element:y}),M=w.ref(!1),P=Wte(),z=U=>{var q;if(w.toValue(M)&&w.toValue(A)&&!Mu((q=w.toValue(p))==null?void 0:q.value,U)){const Q=U,ee=Q;Q&&w.toValue(x)>=0&&(d.value=KOe(w.toValue(d),w.toValue(x),w.toValue(T),ee),T.value=Q.length)}};w.watch(()=>g,()=>{var U,q,Q,ee,le;if(["function"].includes((U=w.toValue(p))==null?void 0:U.type))return x.value=XOe(c.value,g.value),T.value=(Q=(q=w.toValue(p))==null?void 0:q.value)==null?void 0:Q.length,M.value=!0,P("selectFunction",{data:(ee=w.toValue(p))==null?void 0:ee.value,callback:({data:ae})=>{console.log(ae),z(ae)}}),!1;if([",","(","="].includes((le=w.toValue(p))==null?void 0:le.value))return x.value=w.toValue(a),M.value=!0,T.value=0,P("selectFunction",{data:"",callback:({data:ae})=>{console.log(ae),z(ae)}}),!1;M.value=!1,x.value=-1},{immediate:!0,deep:!0})},QOe={class:"node-formula"},eNe={class:"node-formula-show"},tNe=w.defineComponent({__name:"index",props:w.mergeModels({id:{type:String,default:""},editorId:{type:String,default:""}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const a=o,{getCellValue:c}=zOe({editorId:a==null?void 0:a.editorId}),d=w.useModel(o,"modelValue"),g=w.ref(),{startOffset:p}=WOe({element:g});UOe(g,d,p);const y=w.computed(()=>{const M=VOe(d.value);return M==null?void 0:M.map(z=>z.type==="cell"||z.type==="range"?{cellValue:c(z.value),...z}:z)}),x=w.computed(()=>{const M=HOe(d.value,y.value);let P=-1;return M.map(U=>(U==null?void 0:U.type)==="cell"||(U==null?void 0:U.type)==="range"?(P++,{...U,color:Ure[P%Ure.length]}):(U==null?void 0:U.type)==="function"?{...U,color:"#0318ff"}:U)});jOe({element:g,showStr:x,editorId:a==null?void 0:a.editorId});const{currentItemIndex:T,currentItem:A}=YOe({element:g,startOffset:p,value:d,showStr:x});return qOe({element:g,startOffset:p,showStr:x,editorId:a==null?void 0:a.editorId,value:d,currentItemIndex:T,currentItem:A}),JOe({element:g,startOffset:p,showStr:x,value:d,currentItemIndex:T,currentItem:A}),(M,P)=>(w.openBlock(),w.createElementBlock("div",QOe,[w.createElementVNode("div",{contenteditable:"true",ref_key:"formulaRef",ref:g,class:"node-formula-input"},null,512),w.createElementVNode("div",eNe,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(x.value,(z,U)=>(w.openBlock(),w.createElementBlock("span",{key:U,class:w.normalizeClass(["node-formula-item",`node-formula-item-type-${z==null?void 0:z.type}`,U===w.unref(T)?"node-formula-item-active":""]),style:w.normalizeStyle({"--text-color":(z==null?void 0:z.color)||"#000","--bg-color":w.unref(Ute)((z==null?void 0:z.color)||"#000",.1)})},w.toDisplayString(z.value),7))),128))])]))}}),Zle=cu(tNe,[["__scopeId","data-v-f4b96eb4"]]),nNe=[{label:"平均值",value:"AVERAGE"},{label:"均值绝对偏差",value:"AVEDEV"},{label:"求和",value:"SUM"},{label:"条件判断",value:"IF"},{label:"统计数量",value:"COUNT"},{label:"最大值",value:"MAX"},{label:"最小值",value:"MIN"},{label:"正平方根",value:"SQRT"}],oNe={class:"select-function"},sNe=["onClick"],rNe={class:"function-item"},aNe={class:"function-item-desc"},iNe=w.defineComponent({__name:"index",props:w.mergeModels({id:{type:String,default:""},functionList:{type:Array,default:()=>[]}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const a=o;let c=null;const d=w.computed(()=>{var y;return((y=a.functionList)==null?void 0:y.length)>0?a.functionList:nNe}),g=w.useModel(o,"modelValue"),p=y=>{g.value=y,c==null||c({data:y})};return Ule("selectFunction",({data:y,callback:x})=>{c=x,g.value=y}),(y,x)=>(w.openBlock(),w.createElementBlock("div",oNe,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(d.value,(T,A)=>(w.openBlock(),w.createElementBlock("div",{key:A},[w.createElementVNode("div",{onClick:()=>{p(T.value)},class:w.normalizeClass(["function-item-wrapper",{active:g.value===T.value}])},[w.createElementVNode("div",rNe,w.toDisplayString(T.value),1),w.createElementVNode("div",aNe,w.toDisplayString(T.label),1)],10,sNe)]))),128))]))}}),Gle=cu(iNe,[["__scopeId","data-v-6e079ff0"]]),cNe=["innerHTML"],qle=w.defineComponent({__name:"index",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const a=w.useModel(o,"modelValue");return(c,d)=>(w.openBlock(),w.createBlock(Hte,null,{default:w.withCtx(()=>[w.createElementVNode("div",{innerHTML:a.value},null,8,cNe)]),_:1}))}});function wz(o){return w.getCurrentScope()?(w.onScopeDispose(o),!0):!1}function p0(o){return typeof o=="function"?o():w.unref(o)}const lNe=typeof window<"u"&&typeof document<"u",uNe=o=>typeof o<"u",dNe=Object.prototype.toString,fNe=o=>dNe.call(o)==="[object Object]",mNe=()=>{};function gNe(o,a){function c(...d){return new Promise((g,p)=>{Promise.resolve(o(()=>a.apply(this,d),{fn:a,thisArg:this,args:d})).then(g).catch(p)})}return c}const Yle=o=>o();function hNe(o=Yle){const a=w.ref(!0);function c(){a.value=!1}function d(){a.value=!0}const g=(...p)=>{a.value&&o(...p)};return{isActive:w.readonly(a),pause:c,resume:d,eventFilter:g}}function jre(o,a=!1,c="Timeout"){return new Promise((d,g)=>{setTimeout(a?()=>g(c):d,o)})}function pNe(o,a,c={}){const{eventFilter:d=Yle,...g}=c;return w.watch(o,gNe(d,a),g)}function m4(o,a,c={}){const{eventFilter:d,...g}=c,{eventFilter:p,pause:y,resume:x,isActive:T}=hNe(d);return{stop:pNe(o,a,{...g,eventFilter:p}),pause:y,resume:x,isActive:T}}function bNe(o,a={}){if(!w.isRef(o))return w.toRefs(o);const c=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const d in o.value)c[d]=w.customRef(()=>({get(){return o.value[d]},set(g){var p;if((p=p0(a.replaceRef))!=null?p:!0)if(Array.isArray(o.value)){const x=[...o.value];x[d]=g,o.value=x}else{const x={...o.value,[d]:g};Object.setPrototypeOf(x,Object.getPrototypeOf(o.value)),o.value=x}else o.value[d]=g}}));return c}function Fee(o,a=!1){function c(P,{flush:z="sync",deep:U=!1,timeout:q,throwOnTimeout:Q}={}){let ee=null;const ae=[new Promise(Z=>{ee=w.watch(o,Ae=>{P(Ae)!==a&&(ee==null||ee(),Z(Ae))},{flush:z,deep:U,immediate:!0})})];return q!=null&&ae.push(jre(q,Q).then(()=>p0(o)).finally(()=>ee==null?void 0:ee())),Promise.race(ae)}function d(P,z){if(!w.isRef(P))return c(Ae=>Ae===P,z);const{flush:U="sync",deep:q=!1,timeout:Q,throwOnTimeout:ee}=z??{};let le=null;const Z=[new Promise(Ae=>{le=w.watch([o,P],([mt,Le])=>{a!==(mt===Le)&&(le==null||le(),Ae(mt))},{flush:U,deep:q,immediate:!0})})];return Q!=null&&Z.push(jre(Q,ee).then(()=>p0(o)).finally(()=>(le==null||le(),p0(o)))),Promise.race(Z)}function g(P){return c(z=>!!z,P)}function p(P){return d(null,P)}function y(P){return d(void 0,P)}function x(P){return c(Number.isNaN,P)}function T(P,z){return c(U=>{const q=Array.from(U);return q.includes(P)||q.includes(p0(P))},z)}function A(P){return M(1,P)}function M(P=1,z){let U=-1;return c(()=>(U+=1,U>=P),z)}return Array.isArray(p0(o))?{toMatch:c,toContains:T,changed:A,changedTimes:M,get not(){return Fee(o,!a)}}:{toMatch:c,toBe:d,toBeTruthy:g,toBeNull:p,toBeNaN:x,toBeUndefined:y,changed:A,changedTimes:M,get not(){return Fee(o,!a)}}}function Lee(o){return Fee(o)}function vNe(o){var a;const c=p0(o);return(a=c==null?void 0:c.$el)!=null?a:c}const Kle=lNe?window:void 0;function Xle(...o){let a,c,d,g;if(typeof o[0]=="string"||Array.isArray(o[0])?([c,d,g]=o,a=Kle):[a,c,d,g]=o,!a)return mNe;Array.isArray(c)||(c=[c]),Array.isArray(d)||(d=[d]);const p=[],y=()=>{p.forEach(M=>M()),p.length=0},x=(M,P,z,U)=>(M.addEventListener(P,z,U),()=>M.removeEventListener(P,z,U)),T=w.watch(()=>[vNe(a),p0(g)],([M,P])=>{if(y(),!M)return;const z=fNe(P)?{...P}:P;p.push(...c.flatMap(U=>d.map(q=>x(M,U,q,z))))},{immediate:!0,flush:"post"}),A=()=>{T(),y()};return wz(A),A}function yNe(o){return typeof o=="function"?o:typeof o=="string"?a=>a.key===o:Array.isArray(o)?a=>o.includes(a.key):()=>!0}function Wre(...o){let a,c,d={};o.length===3?(a=o[0],c=o[1],d=o[2]):o.length===2?typeof o[1]=="object"?(a=!0,c=o[0],d=o[1]):(a=o[0],c=o[1]):(a=!0,c=o[0]);const{target:g=Kle,eventName:p="keydown",passive:y=!1,dedupe:x=!1}=d,T=yNe(a);return Xle(g,p,M=>{M.repeat&&p0(x)||T(M)&&c(M)},y)}function wNe(o){return JSON.parse(JSON.stringify(o))}function FQ(o,a,c,d={}){var g,p,y;const{clone:x=!1,passive:T=!1,eventName:A,deep:M=!1,defaultValue:P,shouldEmit:z}=d,U=w.getCurrentInstance(),q=c||(U==null?void 0:U.emit)||((g=U==null?void 0:U.$emit)==null?void 0:g.bind(U))||((y=(p=U==null?void 0:U.proxy)==null?void 0:p.$emit)==null?void 0:y.bind(U==null?void 0:U.proxy));let Q=A;a||(a="modelValue"),Q=Q||`update:${a.toString()}`;const ee=Z=>x?typeof x=="function"?x(Z):wNe(Z):Z,le=()=>uNe(o[a])?ee(o[a]):P,ae=Z=>{z?z(Z)&&q(Q,Z):q(Q,Z)};if(T){const Z=le(),Ae=w.ref(Z);let mt=!1;return w.watch(()=>o[a],Le=>{mt||(mt=!0,Ae.value=ee(Le),w.nextTick(()=>mt=!1))}),w.watch(Ae,Le=>{!mt&&(Le!==o[a]||M)&&ae(Le)},{deep:M}),Ae}else return w.computed({get(){return le()},set(Z){ae(Z)}})}var CNe={value:()=>{}};function Cz(){for(var o=0,a=arguments.length,c={},d;o<a;++o){if(!(d=arguments[o]+"")||d in c||/[\s.]/.test(d))throw new Error("illegal type: "+d);c[d]=[]}return new JV(c)}function JV(o){this._=o}function SNe(o,a){return o.trim().split(/^|\s+/).map(function(c){var d="",g=c.indexOf(".");if(g>=0&&(d=c.slice(g+1),c=c.slice(0,g)),c&&!a.hasOwnProperty(c))throw new Error("unknown type: "+c);return{type:c,name:d}})}JV.prototype=Cz.prototype={constructor:JV,on:function(o,a){var c=this._,d=SNe(o+"",c),g,p=-1,y=d.length;if(arguments.length<2){for(;++p<y;)if((g=(o=d[p]).type)&&(g=xNe(c[g],o.name)))return g;return}if(a!=null&&typeof a!="function")throw new Error("invalid callback: "+a);for(;++p<y;)if(g=(o=d[p]).type)c[g]=Zre(c[g],o.name,a);else if(a==null)for(g in c)c[g]=Zre(c[g],o.name,null);return this},copy:function(){var o={},a=this._;for(var c in a)o[c]=a[c].slice();return new JV(o)},call:function(o,a){if((g=arguments.length-2)>0)for(var c=new Array(g),d=0,g,p;d<g;++d)c[d]=arguments[d+2];if(!this._.hasOwnProperty(o))throw new Error("unknown type: "+o);for(p=this._[o],d=0,g=p.length;d<g;++d)p[d].value.apply(a,c)},apply:function(o,a,c){if(!this._.hasOwnProperty(o))throw new Error("unknown type: "+o);for(var d=this._[o],g=0,p=d.length;g<p;++g)d[g].value.apply(a,c)}};function xNe(o,a){for(var c=0,d=o.length,g;c<d;++c)if((g=o[c]).name===a)return g.value}function Zre(o,a,c){for(var d=0,g=o.length;d<g;++d)if(o[d].name===a){o[d]=CNe,o=o.slice(0,d).concat(o.slice(d+1));break}return c!=null&&o.push({name:a,value:c}),o}var Vee="http://www.w3.org/1999/xhtml";const Gre={svg:"http://www.w3.org/2000/svg",xhtml:Vee,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Sz(o){var a=o+="",c=a.indexOf(":");return c>=0&&(a=o.slice(0,c))!=="xmlns"&&(o=o.slice(c+1)),Gre.hasOwnProperty(a)?{space:Gre[a],local:o}:o}function ENe(o){return function(){var a=this.ownerDocument,c=this.namespaceURI;return c===Vee&&a.documentElement.namespaceURI===Vee?a.createElement(o):a.createElementNS(c,o)}}function _Ne(o){return function(){return this.ownerDocument.createElementNS(o.space,o.local)}}function Jle(o){var a=Sz(o);return(a.local?_Ne:ENe)(a)}function TNe(){}function Gte(o){return o==null?TNe:function(){return this.querySelector(o)}}function kNe(o){typeof o!="function"&&(o=Gte(o));for(var a=this._groups,c=a.length,d=new Array(c),g=0;g<c;++g)for(var p=a[g],y=p.length,x=d[g]=new Array(y),T,A,M=0;M<y;++M)(T=p[M])&&(A=o.call(T,T.__data__,M,p))&&("__data__"in T&&(A.__data__=T.__data__),x[M]=A);return new pg(d,this._parents)}function ANe(o){return o==null?[]:Array.isArray(o)?o:Array.from(o)}function ONe(){return[]}function Qle(o){return o==null?ONe:function(){return this.querySelectorAll(o)}}function NNe(o){return function(){return ANe(o.apply(this,arguments))}}function $Ne(o){typeof o=="function"?o=NNe(o):o=Qle(o);for(var a=this._groups,c=a.length,d=[],g=[],p=0;p<c;++p)for(var y=a[p],x=y.length,T,A=0;A<x;++A)(T=y[A])&&(d.push(o.call(T,T.__data__,A,y)),g.push(T));return new pg(d,g)}function eue(o){return function(){return this.matches(o)}}function tue(o){return function(a){return a.matches(o)}}var DNe=Array.prototype.find;function MNe(o){return function(){return DNe.call(this.children,o)}}function RNe(){return this.firstElementChild}function INe(o){return this.select(o==null?RNe:MNe(typeof o=="function"?o:tue(o)))}var PNe=Array.prototype.filter;function BNe(){return Array.from(this.children)}function FNe(o){return function(){return PNe.call(this.children,o)}}function LNe(o){return this.selectAll(o==null?BNe:FNe(typeof o=="function"?o:tue(o)))}function VNe(o){typeof o!="function"&&(o=eue(o));for(var a=this._groups,c=a.length,d=new Array(c),g=0;g<c;++g)for(var p=a[g],y=p.length,x=d[g]=[],T,A=0;A<y;++A)(T=p[A])&&o.call(T,T.__data__,A,p)&&x.push(T);return new pg(d,this._parents)}function nue(o){return new Array(o.length)}function HNe(){return new pg(this._enter||this._groups.map(nue),this._parents)}function SH(o,a){this.ownerDocument=o.ownerDocument,this.namespaceURI=o.namespaceURI,this._next=null,this._parent=o,this.__data__=a}SH.prototype={constructor:SH,appendChild:function(o){return this._parent.insertBefore(o,this._next)},insertBefore:function(o,a){return this._parent.insertBefore(o,a)},querySelector:function(o){return this._parent.querySelector(o)},querySelectorAll:function(o){return this._parent.querySelectorAll(o)}};function zNe(o){return function(){return o}}function UNe(o,a,c,d,g,p){for(var y=0,x,T=a.length,A=p.length;y<A;++y)(x=a[y])?(x.__data__=p[y],d[y]=x):c[y]=new SH(o,p[y]);for(;y<T;++y)(x=a[y])&&(g[y]=x)}function jNe(o,a,c,d,g,p,y){var x,T,A=new Map,M=a.length,P=p.length,z=new Array(M),U;for(x=0;x<M;++x)(T=a[x])&&(z[x]=U=y.call(T,T.__data__,x,a)+"",A.has(U)?g[x]=T:A.set(U,T));for(x=0;x<P;++x)U=y.call(o,p[x],x,p)+"",(T=A.get(U))?(d[x]=T,T.__data__=p[x],A.delete(U)):c[x]=new SH(o,p[x]);for(x=0;x<M;++x)(T=a[x])&&A.get(z[x])===T&&(g[x]=T)}function WNe(o){return o.__data__}function ZNe(o,a){if(!arguments.length)return Array.from(this,WNe);var c=a?jNe:UNe,d=this._parents,g=this._groups;typeof o!="function"&&(o=zNe(o));for(var p=g.length,y=new Array(p),x=new Array(p),T=new Array(p),A=0;A<p;++A){var M=d[A],P=g[A],z=P.length,U=GNe(o.call(M,M&&M.__data__,A,d)),q=U.length,Q=x[A]=new Array(q),ee=y[A]=new Array(q),le=T[A]=new Array(z);c(M,P,Q,ee,le,U,a);for(var ae=0,Z=0,Ae,mt;ae<q;++ae)if(Ae=Q[ae]){for(ae>=Z&&(Z=ae+1);!(mt=ee[Z])&&++Z<q;);Ae._next=mt||null}}return y=new pg(y,d),y._enter=x,y._exit=T,y}function GNe(o){return typeof o=="object"&&"length"in o?o:Array.from(o)}function qNe(){return new pg(this._exit||this._groups.map(nue),this._parents)}function YNe(o,a,c){var d=this.enter(),g=this,p=this.exit();return typeof o=="function"?(d=o(d),d&&(d=d.selection())):d=d.append(o+""),a!=null&&(g=a(g),g&&(g=g.selection())),c==null?p.remove():c(p),d&&g?d.merge(g).order():g}function KNe(o){for(var a=o.selection?o.selection():o,c=this._groups,d=a._groups,g=c.length,p=d.length,y=Math.min(g,p),x=new Array(g),T=0;T<y;++T)for(var A=c[T],M=d[T],P=A.length,z=x[T]=new Array(P),U,q=0;q<P;++q)(U=A[q]||M[q])&&(z[q]=U);for(;T<g;++T)x[T]=c[T];return new pg(x,this._parents)}function XNe(){for(var o=this._groups,a=-1,c=o.length;++a<c;)for(var d=o[a],g=d.length-1,p=d[g],y;--g>=0;)(y=d[g])&&(p&&y.compareDocumentPosition(p)^4&&p.parentNode.insertBefore(y,p),p=y);return this}function JNe(o){o||(o=QNe);function a(P,z){return P&&z?o(P.__data__,z.__data__):!P-!z}for(var c=this._groups,d=c.length,g=new Array(d),p=0;p<d;++p){for(var y=c[p],x=y.length,T=g[p]=new Array(x),A,M=0;M<x;++M)(A=y[M])&&(T[M]=A);T.sort(a)}return new pg(g,this._parents).order()}function QNe(o,a){return o<a?-1:o>a?1:o>=a?0:NaN}function e5e(){var o=arguments[0];return arguments[0]=this,o.apply(null,arguments),this}function t5e(){return Array.from(this)}function n5e(){for(var o=this._groups,a=0,c=o.length;a<c;++a)for(var d=o[a],g=0,p=d.length;g<p;++g){var y=d[g];if(y)return y}return null}function o5e(){let o=0;for(const a of this)++o;return o}function s5e(){return!this.node()}function r5e(o){for(var a=this._groups,c=0,d=a.length;c<d;++c)for(var g=a[c],p=0,y=g.length,x;p<y;++p)(x=g[p])&&o.call(x,x.__data__,p,g);return this}function a5e(o){return function(){this.removeAttribute(o)}}function i5e(o){return function(){this.removeAttributeNS(o.space,o.local)}}function c5e(o,a){return function(){this.setAttribute(o,a)}}function l5e(o,a){return function(){this.setAttributeNS(o.space,o.local,a)}}function u5e(o,a){return function(){var c=a.apply(this,arguments);c==null?this.removeAttribute(o):this.setAttribute(o,c)}}function d5e(o,a){return function(){var c=a.apply(this,arguments);c==null?this.removeAttributeNS(o.space,o.local):this.setAttributeNS(o.space,o.local,c)}}function f5e(o,a){var c=Sz(o);if(arguments.length<2){var d=this.node();return c.local?d.getAttributeNS(c.space,c.local):d.getAttribute(c)}return this.each((a==null?c.local?i5e:a5e:typeof a=="function"?c.local?d5e:u5e:c.local?l5e:c5e)(c,a))}function oue(o){return o.ownerDocument&&o.ownerDocument.defaultView||o.document&&o||o.defaultView}function m5e(o){return function(){this.style.removeProperty(o)}}function g5e(o,a,c){return function(){this.style.setProperty(o,a,c)}}function h5e(o,a,c){return function(){var d=a.apply(this,arguments);d==null?this.style.removeProperty(o):this.style.setProperty(o,d,c)}}function p5e(o,a,c){return arguments.length>1?this.each((a==null?m5e:typeof a=="function"?h5e:g5e)(o,a,c??"")):D4(this.node(),o)}function D4(o,a){return o.style.getPropertyValue(a)||oue(o).getComputedStyle(o,null).getPropertyValue(a)}function b5e(o){return function(){delete this[o]}}function v5e(o,a){return function(){this[o]=a}}function y5e(o,a){return function(){var c=a.apply(this,arguments);c==null?delete this[o]:this[o]=c}}function w5e(o,a){return arguments.length>1?this.each((a==null?b5e:typeof a=="function"?y5e:v5e)(o,a)):this.node()[o]}function sue(o){return o.trim().split(/^|\s+/)}function qte(o){return o.classList||new rue(o)}function rue(o){this._node=o,this._names=sue(o.getAttribute("class")||"")}rue.prototype={add:function(o){var a=this._names.indexOf(o);a<0&&(this._names.push(o),this._node.setAttribute("class",this._names.join(" ")))},remove:function(o){var a=this._names.indexOf(o);a>=0&&(this._names.splice(a,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(o){return this._names.indexOf(o)>=0}};function aue(o,a){for(var c=qte(o),d=-1,g=a.length;++d<g;)c.add(a[d])}function iue(o,a){for(var c=qte(o),d=-1,g=a.length;++d<g;)c.remove(a[d])}function C5e(o){return function(){aue(this,o)}}function S5e(o){return function(){iue(this,o)}}function x5e(o,a){return function(){(a.apply(this,arguments)?aue:iue)(this,o)}}function E5e(o,a){var c=sue(o+"");if(arguments.length<2){for(var d=qte(this.node()),g=-1,p=c.length;++g<p;)if(!d.contains(c[g]))return!1;return!0}return this.each((typeof a=="function"?x5e:a?C5e:S5e)(c,a))}function _5e(){this.textContent=""}function T5e(o){return function(){this.textContent=o}}function k5e(o){return function(){var a=o.apply(this,arguments);this.textContent=a??""}}function A5e(o){return arguments.length?this.each(o==null?_5e:(typeof o=="function"?k5e:T5e)(o)):this.node().textContent}function O5e(){this.innerHTML=""}function N5e(o){return function(){this.innerHTML=o}}function $5e(o){return function(){var a=o.apply(this,arguments);this.innerHTML=a??""}}function D5e(o){return arguments.length?this.each(o==null?O5e:(typeof o=="function"?$5e:N5e)(o)):this.node().innerHTML}function M5e(){this.nextSibling&&this.parentNode.appendChild(this)}function R5e(){return this.each(M5e)}function I5e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function P5e(){return this.each(I5e)}function B5e(o){var a=typeof o=="function"?o:Jle(o);return this.select(function(){return this.appendChild(a.apply(this,arguments))})}function F5e(){return null}function L5e(o,a){var c=typeof o=="function"?o:Jle(o),d=a==null?F5e:typeof a=="function"?a:Gte(a);return this.select(function(){return this.insertBefore(c.apply(this,arguments),d.apply(this,arguments)||null)})}function V5e(){var o=this.parentNode;o&&o.removeChild(this)}function H5e(){return this.each(V5e)}function z5e(){var o=this.cloneNode(!1),a=this.parentNode;return a?a.insertBefore(o,this.nextSibling):o}function U5e(){var o=this.cloneNode(!0),a=this.parentNode;return a?a.insertBefore(o,this.nextSibling):o}function j5e(o){return this.select(o?U5e:z5e)}function W5e(o){return arguments.length?this.property("__data__",o):this.node().__data__}function Z5e(o){return function(a){o.call(this,a,this.__data__)}}function G5e(o){return o.trim().split(/^|\s+/).map(function(a){var c="",d=a.indexOf(".");return d>=0&&(c=a.slice(d+1),a=a.slice(0,d)),{type:a,name:c}})}function q5e(o){return function(){var a=this.__on;if(a){for(var c=0,d=-1,g=a.length,p;c<g;++c)p=a[c],(!o.type||p.type===o.type)&&p.name===o.name?this.removeEventListener(p.type,p.listener,p.options):a[++d]=p;++d?a.length=d:delete this.__on}}}function Y5e(o,a,c){return function(){var d=this.__on,g,p=Z5e(a);if(d){for(var y=0,x=d.length;y<x;++y)if((g=d[y]).type===o.type&&g.name===o.name){this.removeEventListener(g.type,g.listener,g.options),this.addEventListener(g.type,g.listener=p,g.options=c),g.value=a;return}}this.addEventListener(o.type,p,c),g={type:o.type,name:o.name,value:a,listener:p,options:c},d?d.push(g):this.__on=[g]}}function K5e(o,a,c){var d=G5e(o+""),g,p=d.length,y;if(arguments.length<2){var x=this.node().__on;if(x){for(var T=0,A=x.length,M;T<A;++T)for(g=0,M=x[T];g<p;++g)if((y=d[g]).type===M.type&&y.name===M.name)return M.value}return}for(x=a?Y5e:q5e,g=0;g<p;++g)this.each(x(d[g],a,c));return this}function cue(o,a,c){var d=oue(o),g=d.CustomEvent;typeof g=="function"?g=new g(a,c):(g=d.document.createEvent("Event"),c?(g.initEvent(a,c.bubbles,c.cancelable),g.detail=c.detail):g.initEvent(a,!1,!1)),o.dispatchEvent(g)}function X5e(o,a){return function(){return cue(this,o,a)}}function J5e(o,a){return function(){return cue(this,o,a.apply(this,arguments))}}function Q5e(o,a){return this.each((typeof a=="function"?J5e:X5e)(o,a))}function*e$e(){for(var o=this._groups,a=0,c=o.length;a<c;++a)for(var d=o[a],g=0,p=d.length,y;g<p;++g)(y=d[g])&&(yield y)}var lue=[null];function pg(o,a){this._groups=o,this._parents=a}function IM(){return new pg([[document.documentElement]],lue)}function t$e(){return this}pg.prototype=IM.prototype={constructor:pg,select:kNe,selectAll:$Ne,selectChild:INe,selectChildren:LNe,filter:VNe,data:ZNe,enter:HNe,exit:qNe,join:YNe,merge:KNe,selection:t$e,order:XNe,sort:JNe,call:e5e,nodes:t5e,node:n5e,size:o5e,empty:s5e,each:r5e,attr:f5e,style:p5e,property:w5e,classed:E5e,text:A5e,html:D5e,raise:R5e,lower:P5e,append:B5e,insert:L5e,remove:H5e,clone:j5e,datum:W5e,on:K5e,dispatch:Q5e,[Symbol.iterator]:e$e};function kp(o){return typeof o=="string"?new pg([[document.querySelector(o)]],[document.documentElement]):new pg([[o]],lue)}function n$e(o){let a;for(;a=o.sourceEvent;)o=a;return o}function gb(o,a){if(o=n$e(o),a===void 0&&(a=o.currentTarget),a){var c=a.ownerSVGElement||a;if(c.createSVGPoint){var d=c.createSVGPoint();return d.x=o.clientX,d.y=o.clientY,d=d.matrixTransform(a.getScreenCTM().inverse()),[d.x,d.y]}if(a.getBoundingClientRect){var g=a.getBoundingClientRect();return[o.clientX-g.left-a.clientLeft,o.clientY-g.top-a.clientTop]}}return[o.pageX,o.pageY]}const o$e={passive:!1},hM={capture:!0,passive:!1};function LQ(o){o.stopImmediatePropagation()}function _4(o){o.preventDefault(),o.stopImmediatePropagation()}function uue(o){var a=o.document.documentElement,c=kp(o).on("dragstart.drag",_4,hM);"onselectstart"in a?c.on("selectstart.drag",_4,hM):(a.__noselect=a.style.MozUserSelect,a.style.MozUserSelect="none")}function due(o,a){var c=o.document.documentElement,d=kp(o).on("dragstart.drag",null);a&&(d.on("click.drag",_4,hM),setTimeout(function(){d.on("click.drag",null)},0)),"onselectstart"in c?d.on("selectstart.drag",null):(c.style.MozUserSelect=c.__noselect,delete c.__noselect)}const $V=o=>()=>o;function Hee(o,{sourceEvent:a,subject:c,target:d,identifier:g,active:p,x:y,y:x,dx:T,dy:A,dispatch:M}){Object.defineProperties(this,{type:{value:o,enumerable:!0,configurable:!0},sourceEvent:{value:a,enumerable:!0,configurable:!0},subject:{value:c,enumerable:!0,configurable:!0},target:{value:d,enumerable:!0,configurable:!0},identifier:{value:g,enumerable:!0,configurable:!0},active:{value:p,enumerable:!0,configurable:!0},x:{value:y,enumerable:!0,configurable:!0},y:{value:x,enumerable:!0,configurable:!0},dx:{value:T,enumerable:!0,configurable:!0},dy:{value:A,enumerable:!0,configurable:!0},_:{value:M}})}Hee.prototype.on=function(){var o=this._.on.apply(this._,arguments);return o===this._?this:o};function s$e(o){return!o.ctrlKey&&!o.button}function r$e(){return this.parentNode}function a$e(o,a){return a??{x:o.x,y:o.y}}function i$e(){return navigator.maxTouchPoints||"ontouchstart"in this}function c$e(){var o=s$e,a=r$e,c=a$e,d=i$e,g={},p=Cz("start","drag","end"),y=0,x,T,A,M,P=0;function z(Ae){Ae.on("mousedown.drag",U).filter(d).on("touchstart.drag",ee).on("touchmove.drag",le,o$e).on("touchend.drag touchcancel.drag",ae).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function U(Ae,mt){if(!(M||!o.call(this,Ae,mt))){var Le=Z(this,a.call(this,Ae,mt),Ae,mt,"mouse");Le&&(kp(Ae.view).on("mousemove.drag",q,hM).on("mouseup.drag",Q,hM),uue(Ae.view),LQ(Ae),A=!1,x=Ae.clientX,T=Ae.clientY,Le("start",Ae))}}function q(Ae){if(_4(Ae),!A){var mt=Ae.clientX-x,Le=Ae.clientY-T;A=mt*mt+Le*Le>P}g.mouse("drag",Ae)}function Q(Ae){kp(Ae.view).on("mousemove.drag mouseup.drag",null),due(Ae.view,A),_4(Ae),g.mouse("end",Ae)}function ee(Ae,mt){if(o.call(this,Ae,mt)){var Le=Ae.changedTouches,J=a.call(this,Ae,mt),Ge=Le.length,vt,yt;for(vt=0;vt<Ge;++vt)(yt=Z(this,J,Ae,mt,Le[vt].identifier,Le[vt]))&&(LQ(Ae),yt("start",Ae,Le[vt]))}}function le(Ae){var mt=Ae.changedTouches,Le=mt.length,J,Ge;for(J=0;J<Le;++J)(Ge=g[mt[J].identifier])&&(_4(Ae),Ge("drag",Ae,mt[J]))}function ae(Ae){var mt=Ae.changedTouches,Le=mt.length,J,Ge;for(M&&clearTimeout(M),M=setTimeout(function(){M=null},500),J=0;J<Le;++J)(Ge=g[mt[J].identifier])&&(LQ(Ae),Ge("end",Ae,mt[J]))}function Z(Ae,mt,Le,J,Ge,vt){var yt=p.copy(),De=gb(vt||Le,mt),ue,Vt,we;if((we=c.call(Ae,new Hee("beforestart",{sourceEvent:Le,target:z,identifier:Ge,active:y,x:De[0],y:De[1],dx:0,dy:0,dispatch:yt}),J))!=null)return ue=we.x-De[0]||0,Vt=we.y-De[1]||0,function Ie(D,Ue,be){var tt=De,nt;switch(D){case"start":g[Ge]=Ie,nt=y++;break;case"end":delete g[Ge],--y;case"drag":De=gb(be||Ue,mt),nt=y;break}yt.call(D,Ae,new Hee(D,{sourceEvent:Ue,subject:we,target:z,identifier:Ge,active:nt,x:De[0]+ue,y:De[1]+Vt,dx:De[0]-tt[0],dy:De[1]-tt[1],dispatch:yt}),J)}}return z.filter=function(Ae){return arguments.length?(o=typeof Ae=="function"?Ae:$V(!!Ae),z):o},z.container=function(Ae){return arguments.length?(a=typeof Ae=="function"?Ae:$V(Ae),z):a},z.subject=function(Ae){return arguments.length?(c=typeof Ae=="function"?Ae:$V(Ae),z):c},z.touchable=function(Ae){return arguments.length?(d=typeof Ae=="function"?Ae:$V(!!Ae),z):d},z.on=function(){var Ae=p.on.apply(p,arguments);return Ae===p?z:Ae},z.clickDistance=function(Ae){return arguments.length?(P=(Ae=+Ae)*Ae,z):Math.sqrt(P)},z}function Yte(o,a,c){o.prototype=a.prototype=c,c.constructor=o}function fue(o,a){var c=Object.create(o.prototype);for(var d in a)c[d]=a[d];return c}function PM(){}var pM=.7,xH=1/pM,T4="\\s*([+-]?\\d+)\\s*",bM="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",l$e=/^#([0-9a-f]{3,8})$/,u$e=new RegExp(`^rgb\\(${T4},${T4},${T4}\\)$`),d$e=new RegExp(`^rgb\\(${pb},${pb},${pb}\\)$`),f$e=new RegExp(`^rgba\\(${T4},${T4},${T4},${bM}\\)$`),m$e=new RegExp(`^rgba\\(${pb},${pb},${pb},${bM}\\)$`),g$e=new RegExp(`^hsl\\(${bM},${pb},${pb}\\)$`),h$e=new RegExp(`^hsla\\(${bM},${pb},${pb},${bM}\\)$`),qre={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Yte(PM,vM,{copy(o){return Object.assign(new this.constructor,this,o)},displayable(){return this.rgb().displayable()},hex:Yre,formatHex:Yre,formatHex8:p$e,formatHsl:b$e,formatRgb:Kre,toString:Kre});function Yre(){return this.rgb().formatHex()}function p$e(){return this.rgb().formatHex8()}function b$e(){return mue(this).formatHsl()}function Kre(){return this.rgb().formatRgb()}function vM(o){var a,c;return o=(o+"").trim().toLowerCase(),(a=l$e.exec(o))?(c=a[1].length,a=parseInt(a[1],16),c===6?Xre(a):c===3?new bm(a>>8&15|a>>4&240,a>>4&15|a&240,(a&15)<<4|a&15,1):c===8?DV(a>>24&255,a>>16&255,a>>8&255,(a&255)/255):c===4?DV(a>>12&15|a>>8&240,a>>8&15|a>>4&240,a>>4&15|a&240,((a&15)<<4|a&15)/255):null):(a=u$e.exec(o))?new bm(a[1],a[2],a[3],1):(a=d$e.exec(o))?new bm(a[1]*255/100,a[2]*255/100,a[3]*255/100,1):(a=f$e.exec(o))?DV(a[1],a[2],a[3],a[4]):(a=m$e.exec(o))?DV(a[1]*255/100,a[2]*255/100,a[3]*255/100,a[4]):(a=g$e.exec(o))?eae(a[1],a[2]/100,a[3]/100,1):(a=h$e.exec(o))?eae(a[1],a[2]/100,a[3]/100,a[4]):qre.hasOwnProperty(o)?Xre(qre[o]):o==="transparent"?new bm(NaN,NaN,NaN,0):null}function Xre(o){return new bm(o>>16&255,o>>8&255,o&255,1)}function DV(o,a,c,d){return d<=0&&(o=a=c=NaN),new bm(o,a,c,d)}function v$e(o){return o instanceof PM||(o=vM(o)),o?(o=o.rgb(),new bm(o.r,o.g,o.b,o.opacity)):new bm}function zee(o,a,c,d){return arguments.length===1?v$e(o):new bm(o,a,c,d??1)}function bm(o,a,c,d){this.r=+o,this.g=+a,this.b=+c,this.opacity=+d}Yte(bm,zee,fue(PM,{brighter(o){return o=o==null?xH:Math.pow(xH,o),new bm(this.r*o,this.g*o,this.b*o,this.opacity)},darker(o){return o=o==null?pM:Math.pow(pM,o),new bm(this.r*o,this.g*o,this.b*o,this.opacity)},rgb(){return this},clamp(){return new bm(qx(this.r),qx(this.g),qx(this.b),EH(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Jre,formatHex:Jre,formatHex8:y$e,formatRgb:Qre,toString:Qre}));function Jre(){return`#${Hx(this.r)}${Hx(this.g)}${Hx(this.b)}`}function y$e(){return`#${Hx(this.r)}${Hx(this.g)}${Hx(this.b)}${Hx((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qre(){const o=EH(this.opacity);return`${o===1?"rgb(":"rgba("}${qx(this.r)}, ${qx(this.g)}, ${qx(this.b)}${o===1?")":`, ${o})`}`}function EH(o){return isNaN(o)?1:Math.max(0,Math.min(1,o))}function qx(o){return Math.max(0,Math.min(255,Math.round(o)||0))}function Hx(o){return o=qx(o),(o<16?"0":"")+o.toString(16)}function eae(o,a,c,d){return d<=0?o=a=c=NaN:c<=0||c>=1?o=a=NaN:a<=0&&(o=NaN),new Ap(o,a,c,d)}function mue(o){if(o instanceof Ap)return new Ap(o.h,o.s,o.l,o.opacity);if(o instanceof PM||(o=vM(o)),!o)return new Ap;if(o instanceof Ap)return o;o=o.rgb();var a=o.r/255,c=o.g/255,d=o.b/255,g=Math.min(a,c,d),p=Math.max(a,c,d),y=NaN,x=p-g,T=(p+g)/2;return x?(a===p?y=(c-d)/x+(c<d)*6:c===p?y=(d-a)/x+2:y=(a-c)/x+4,x/=T<.5?p+g:2-p-g,y*=60):x=T>0&&T<1?0:y,new Ap(y,x,T,o.opacity)}function w$e(o,a,c,d){return arguments.length===1?mue(o):new Ap(o,a,c,d??1)}function Ap(o,a,c,d){this.h=+o,this.s=+a,this.l=+c,this.opacity=+d}Yte(Ap,w$e,fue(PM,{brighter(o){return o=o==null?xH:Math.pow(xH,o),new Ap(this.h,this.s,this.l*o,this.opacity)},darker(o){return o=o==null?pM:Math.pow(pM,o),new Ap(this.h,this.s,this.l*o,this.opacity)},rgb(){var o=this.h%360+(this.h<0)*360,a=isNaN(o)||isNaN(this.s)?0:this.s,c=this.l,d=c+(c<.5?c:1-c)*a,g=2*c-d;return new bm(VQ(o>=240?o-240:o+120,g,d),VQ(o,g,d),VQ(o<120?o+240:o-120,g,d),this.opacity)},clamp(){return new Ap(tae(this.h),MV(this.s),MV(this.l),EH(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const o=EH(this.opacity);return`${o===1?"hsl(":"hsla("}${tae(this.h)}, ${MV(this.s)*100}%, ${MV(this.l)*100}%${o===1?")":`, ${o})`}`}}));function tae(o){return o=(o||0)%360,o<0?o+360:o}function MV(o){return Math.max(0,Math.min(1,o||0))}function VQ(o,a,c){return(o<60?a+(c-a)*o/60:o<180?c:o<240?a+(c-a)*(240-o)/60:a)*255}const gue=o=>()=>o;function C$e(o,a){return function(c){return o+c*a}}function S$e(o,a,c){return o=Math.pow(o,c),a=Math.pow(a,c)-o,c=1/c,function(d){return Math.pow(o+d*a,c)}}function x$e(o){return(o=+o)==1?hue:function(a,c){return c-a?S$e(a,c,o):gue(isNaN(a)?c:a)}}function hue(o,a){var c=a-o;return c?C$e(o,c):gue(isNaN(o)?a:o)}const nae=function o(a){var c=x$e(a);function d(g,p){var y=c((g=zee(g)).r,(p=zee(p)).r),x=c(g.g,p.g),T=c(g.b,p.b),A=hue(g.opacity,p.opacity);return function(M){return g.r=y(M),g.g=x(M),g.b=T(M),g.opacity=A(M),g+""}}return d.gamma=o,d}(1);function Hw(o,a){return o=+o,a=+a,function(c){return o*(1-c)+a*c}}var Uee=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,HQ=new RegExp(Uee.source,"g");function E$e(o){return function(){return o}}function _$e(o){return function(a){return o(a)+""}}function T$e(o,a){var c=Uee.lastIndex=HQ.lastIndex=0,d,g,p,y=-1,x=[],T=[];for(o=o+"",a=a+"";(d=Uee.exec(o))&&(g=HQ.exec(a));)(p=g.index)>c&&(p=a.slice(c,p),x[y]?x[y]+=p:x[++y]=p),(d=d[0])===(g=g[0])?x[y]?x[y]+=g:x[++y]=g:(x[++y]=null,T.push({i:y,x:Hw(d,g)})),c=HQ.lastIndex;return c<a.length&&(p=a.slice(c),x[y]?x[y]+=p:x[++y]=p),x.length<2?T[0]?_$e(T[0].x):E$e(a):(a=T.length,function(A){for(var M=0,P;M<a;++M)x[(P=T[M]).i]=P.x(A);return x.join("")})}var oae=180/Math.PI,jee={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pue(o,a,c,d,g,p){var y,x,T;return(y=Math.sqrt(o*o+a*a))&&(o/=y,a/=y),(T=o*c+a*d)&&(c-=o*T,d-=a*T),(x=Math.sqrt(c*c+d*d))&&(c/=x,d/=x,T/=x),o*d<a*c&&(o=-o,a=-a,T=-T,y=-y),{translateX:g,translateY:p,rotate:Math.atan2(a,o)*oae,skewX:Math.atan(T)*oae,scaleX:y,scaleY:x}}var RV;function k$e(o){const a=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(o+"");return a.isIdentity?jee:pue(a.a,a.b,a.c,a.d,a.e,a.f)}function A$e(o){return o==null||(RV||(RV=document.createElementNS("http://www.w3.org/2000/svg","g")),RV.setAttribute("transform",o),!(o=RV.transform.baseVal.consolidate()))?jee:(o=o.matrix,pue(o.a,o.b,o.c,o.d,o.e,o.f))}function bue(o,a,c,d){function g(A){return A.length?A.pop()+" ":""}function p(A,M,P,z,U,q){if(A!==P||M!==z){var Q=U.push("translate(",null,a,null,c);q.push({i:Q-4,x:Hw(A,P)},{i:Q-2,x:Hw(M,z)})}else(P||z)&&U.push("translate("+P+a+z+c)}function y(A,M,P,z){A!==M?(A-M>180?M+=360:M-A>180&&(A+=360),z.push({i:P.push(g(P)+"rotate(",null,d)-2,x:Hw(A,M)})):M&&P.push(g(P)+"rotate("+M+d)}function x(A,M,P,z){A!==M?z.push({i:P.push(g(P)+"skewX(",null,d)-2,x:Hw(A,M)}):M&&P.push(g(P)+"skewX("+M+d)}function T(A,M,P,z,U,q){if(A!==P||M!==z){var Q=U.push(g(U)+"scale(",null,",",null,")");q.push({i:Q-4,x:Hw(A,P)},{i:Q-2,x:Hw(M,z)})}else(P!==1||z!==1)&&U.push(g(U)+"scale("+P+","+z+")")}return function(A,M){var P=[],z=[];return A=o(A),M=o(M),p(A.translateX,A.translateY,M.translateX,M.translateY,P,z),y(A.rotate,M.rotate,P,z),x(A.skewX,M.skewX,P,z),T(A.scaleX,A.scaleY,M.scaleX,M.scaleY,P,z),A=M=null,function(U){for(var q=-1,Q=z.length,ee;++q<Q;)P[(ee=z[q]).i]=ee.x(U);return P.join("")}}}var O$e=bue(k$e,"px, ","px)","deg)"),N$e=bue(A$e,", ",")",")"),$$e=1e-12;function sae(o){return((o=Math.exp(o))+1/o)/2}function D$e(o){return((o=Math.exp(o))-1/o)/2}function M$e(o){return((o=Math.exp(2*o))-1)/(o+1)}const R$e=function o(a,c,d){function g(p,y){var x=p[0],T=p[1],A=p[2],M=y[0],P=y[1],z=y[2],U=M-x,q=P-T,Q=U*U+q*q,ee,le;if(Q<$$e)le=Math.log(z/A)/a,ee=function(J){return[x+J*U,T+J*q,A*Math.exp(a*J*le)]};else{var ae=Math.sqrt(Q),Z=(z*z-A*A+d*Q)/(2*A*c*ae),Ae=(z*z-A*A-d*Q)/(2*z*c*ae),mt=Math.log(Math.sqrt(Z*Z+1)-Z),Le=Math.log(Math.sqrt(Ae*Ae+1)-Ae);le=(Le-mt)/a,ee=function(J){var Ge=J*le,vt=sae(mt),yt=A/(c*ae)*(vt*M$e(a*Ge+mt)-D$e(mt));return[x+yt*U,T+yt*q,A*vt/sae(a*Ge+mt)]}}return ee.duration=le*1e3*a/Math.SQRT2,ee}return g.rho=function(p){var y=Math.max(.001,+p),x=y*y,T=x*x;return o(y,x,T)},g}(Math.SQRT2,2,4);var M4=0,Y6=0,G6=0,vue=1e3,_H,K6,TH=0,Qx=0,xz=0,yM=typeof performance=="object"&&performance.now?performance:Date,yue=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(o){setTimeout(o,17)};function Kte(){return Qx||(yue(I$e),Qx=yM.now()+xz)}function I$e(){Qx=0}function kH(){this._call=this._time=this._next=null}kH.prototype=wue.prototype={constructor:kH,restart:function(o,a,c){if(typeof o!="function")throw new TypeError("callback is not a function");c=(c==null?Kte():+c)+(a==null?0:+a),!this._next&&K6!==this&&(K6?K6._next=this:_H=this,K6=this),this._call=o,this._time=c,Wee()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wee())}};function wue(o,a,c){var d=new kH;return d.restart(o,a,c),d}function P$e(){Kte(),++M4;for(var o=_H,a;o;)(a=Qx-o._time)>=0&&o._call.call(void 0,a),o=o._next;--M4}function rae(){Qx=(TH=yM.now())+xz,M4=Y6=0;try{P$e()}finally{M4=0,F$e(),Qx=0}}function B$e(){var o=yM.now(),a=o-TH;a>vue&&(xz-=a,TH=o)}function F$e(){for(var o,a=_H,c,d=1/0;a;)a._call?(d>a._time&&(d=a._time),o=a,a=a._next):(c=a._next,a._next=null,a=o?o._next=c:_H=c);K6=o,Wee(d)}function Wee(o){if(!M4){Y6&&(Y6=clearTimeout(Y6));var a=o-Qx;a>24?(o<1/0&&(Y6=setTimeout(rae,o-yM.now()-xz)),G6&&(G6=clearInterval(G6))):(G6||(TH=yM.now(),G6=setInterval(B$e,vue)),M4=1,yue(rae))}}function aae(o,a,c){var d=new kH;return a=a==null?0:+a,d.restart(g=>{d.stop(),o(g+a)},a,c),d}var L$e=Cz("start","end","cancel","interrupt"),V$e=[],Cue=0,iae=1,Zee=2,QV=3,cae=4,Gee=5,eH=6;function Ez(o,a,c,d,g,p){var y=o.__transition;if(!y)o.__transition={};else if(c in y)return;H$e(o,c,{name:a,index:d,group:g,on:L$e,tween:V$e,time:p.time,delay:p.delay,duration:p.duration,ease:p.ease,timer:null,state:Cue})}function Xte(o,a){var c=$p(o,a);if(c.state>Cue)throw new Error("too late; already scheduled");return c}function Cb(o,a){var c=$p(o,a);if(c.state>QV)throw new Error("too late; already running");return c}function $p(o,a){var c=o.__transition;if(!c||!(c=c[a]))throw new Error("transition not found");return c}function H$e(o,a,c){var d=o.__transition,g;d[a]=c,c.timer=wue(p,0,c.time);function p(A){c.state=iae,c.timer.restart(y,c.delay,c.time),c.delay<=A&&y(A-c.delay)}function y(A){var M,P,z,U;if(c.state!==iae)return T();for(M in d)if(U=d[M],U.name===c.name){if(U.state===QV)return aae(y);U.state===cae?(U.state=eH,U.timer.stop(),U.on.call("interrupt",o,o.__data__,U.index,U.group),delete d[M]):+M<a&&(U.state=eH,U.timer.stop(),U.on.call("cancel",o,o.__data__,U.index,U.group),delete d[M])}if(aae(function(){c.state===QV&&(c.state=cae,c.timer.restart(x,c.delay,c.time),x(A))}),c.state=Zee,c.on.call("start",o,o.__data__,c.index,c.group),c.state===Zee){for(c.state=QV,g=new Array(z=c.tween.length),M=0,P=-1;M<z;++M)(U=c.tween[M].value.call(o,o.__data__,c.index,c.group))&&(g[++P]=U);g.length=P+1}}function x(A){for(var M=A<c.duration?c.ease.call(null,A/c.duration):(c.timer.restart(T),c.state=Gee,1),P=-1,z=g.length;++P<z;)g[P].call(o,M);c.state===Gee&&(c.on.call("end",o,o.__data__,c.index,c.group),T())}function T(){c.state=eH,c.timer.stop(),delete d[a];for(var A in d)return;delete o.__transition}}function tH(o,a){var c=o.__transition,d,g,p=!0,y;if(c){a=a==null?null:a+"";for(y in c){if((d=c[y]).name!==a){p=!1;continue}g=d.state>Zee&&d.state<Gee,d.state=eH,d.timer.stop(),d.on.call(g?"interrupt":"cancel",o,o.__data__,d.index,d.group),delete c[y]}p&&delete o.__transition}}function z$e(o){return this.each(function(){tH(this,o)})}function U$e(o,a){var c,d;return function(){var g=Cb(this,o),p=g.tween;if(p!==c){d=c=p;for(var y=0,x=d.length;y<x;++y)if(d[y].name===a){d=d.slice(),d.splice(y,1);break}}g.tween=d}}function j$e(o,a,c){var d,g;if(typeof c!="function")throw new Error;return function(){var p=Cb(this,o),y=p.tween;if(y!==d){g=(d=y).slice();for(var x={name:a,value:c},T=0,A=g.length;T<A;++T)if(g[T].name===a){g[T]=x;break}T===A&&g.push(x)}p.tween=g}}function W$e(o,a){var c=this._id;if(o+="",arguments.length<2){for(var d=$p(this.node(),c).tween,g=0,p=d.length,y;g<p;++g)if((y=d[g]).name===o)return y.value;return null}return this.each((a==null?U$e:j$e)(c,o,a))}function Jte(o,a,c){var d=o._id;return o.each(function(){var g=Cb(this,d);(g.value||(g.value={}))[a]=c.apply(this,arguments)}),function(g){return $p(g,d).value[a]}}function Sue(o,a){var c;return(typeof a=="number"?Hw:a instanceof vM?nae:(c=vM(a))?(a=c,nae):T$e)(o,a)}function Z$e(o){return function(){this.removeAttribute(o)}}function G$e(o){return function(){this.removeAttributeNS(o.space,o.local)}}function q$e(o,a,c){var d,g=c+"",p;return function(){var y=this.getAttribute(o);return y===g?null:y===d?p:p=a(d=y,c)}}function Y$e(o,a,c){var d,g=c+"",p;return function(){var y=this.getAttributeNS(o.space,o.local);return y===g?null:y===d?p:p=a(d=y,c)}}function K$e(o,a,c){var d,g,p;return function(){var y,x=c(this),T;return x==null?void this.removeAttribute(o):(y=this.getAttribute(o),T=x+"",y===T?null:y===d&&T===g?p:(g=T,p=a(d=y,x)))}}function X$e(o,a,c){var d,g,p;return function(){var y,x=c(this),T;return x==null?void this.removeAttributeNS(o.space,o.local):(y=this.getAttributeNS(o.space,o.local),T=x+"",y===T?null:y===d&&T===g?p:(g=T,p=a(d=y,x)))}}function J$e(o,a){var c=Sz(o),d=c==="transform"?N$e:Sue;return this.attrTween(o,typeof a=="function"?(c.local?X$e:K$e)(c,d,Jte(this,"attr."+o,a)):a==null?(c.local?G$e:Z$e)(c):(c.local?Y$e:q$e)(c,d,a))}function Q$e(o,a){return function(c){this.setAttribute(o,a.call(this,c))}}function eDe(o,a){return function(c){this.setAttributeNS(o.space,o.local,a.call(this,c))}}function tDe(o,a){var c,d;function g(){var p=a.apply(this,arguments);return p!==d&&(c=(d=p)&&eDe(o,p)),c}return g._value=a,g}function nDe(o,a){var c,d;function g(){var p=a.apply(this,arguments);return p!==d&&(c=(d=p)&&Q$e(o,p)),c}return g._value=a,g}function oDe(o,a){var c="attr."+o;if(arguments.length<2)return(c=this.tween(c))&&c._value;if(a==null)return this.tween(c,null);if(typeof a!="function")throw new Error;var d=Sz(o);return this.tween(c,(d.local?tDe:nDe)(d,a))}function sDe(o,a){return function(){Xte(this,o).delay=+a.apply(this,arguments)}}function rDe(o,a){return a=+a,function(){Xte(this,o).delay=a}}function aDe(o){var a=this._id;return arguments.length?this.each((typeof o=="function"?sDe:rDe)(a,o)):$p(this.node(),a).delay}function iDe(o,a){return function(){Cb(this,o).duration=+a.apply(this,arguments)}}function cDe(o,a){return a=+a,function(){Cb(this,o).duration=a}}function lDe(o){var a=this._id;return arguments.length?this.each((typeof o=="function"?iDe:cDe)(a,o)):$p(this.node(),a).duration}function uDe(o,a){if(typeof a!="function")throw new Error;return function(){Cb(this,o).ease=a}}function dDe(o){var a=this._id;return arguments.length?this.each(uDe(a,o)):$p(this.node(),a).ease}function fDe(o,a){return function(){var c=a.apply(this,arguments);if(typeof c!="function")throw new Error;Cb(this,o).ease=c}}function mDe(o){if(typeof o!="function")throw new Error;return this.each(fDe(this._id,o))}function gDe(o){typeof o!="function"&&(o=eue(o));for(var a=this._groups,c=a.length,d=new Array(c),g=0;g<c;++g)for(var p=a[g],y=p.length,x=d[g]=[],T,A=0;A<y;++A)(T=p[A])&&o.call(T,T.__data__,A,p)&&x.push(T);return new S0(d,this._parents,this._name,this._id)}function hDe(o){if(o._id!==this._id)throw new Error;for(var a=this._groups,c=o._groups,d=a.length,g=c.length,p=Math.min(d,g),y=new Array(d),x=0;x<p;++x)for(var T=a[x],A=c[x],M=T.length,P=y[x]=new Array(M),z,U=0;U<M;++U)(z=T[U]||A[U])&&(P[U]=z);for(;x<d;++x)y[x]=a[x];return new S0(y,this._parents,this._name,this._id)}function pDe(o){return(o+"").trim().split(/^|\s+/).every(function(a){var c=a.indexOf(".");return c>=0&&(a=a.slice(0,c)),!a||a==="start"})}function bDe(o,a,c){var d,g,p=pDe(a)?Xte:Cb;return function(){var y=p(this,o),x=y.on;x!==d&&(g=(d=x).copy()).on(a,c),y.on=g}}function vDe(o,a){var c=this._id;return arguments.length<2?$p(this.node(),c).on.on(o):this.each(bDe(c,o,a))}function yDe(o){return function(){var a=this.parentNode;for(var c in this.__transition)if(+c!==o)return;a&&a.removeChild(this)}}function wDe(){return this.on("end.remove",yDe(this._id))}function CDe(o){var a=this._name,c=this._id;typeof o!="function"&&(o=Gte(o));for(var d=this._groups,g=d.length,p=new Array(g),y=0;y<g;++y)for(var x=d[y],T=x.length,A=p[y]=new Array(T),M,P,z=0;z<T;++z)(M=x[z])&&(P=o.call(M,M.__data__,z,x))&&("__data__"in M&&(P.__data__=M.__data__),A[z]=P,Ez(A[z],a,c,z,A,$p(M,c)));return new S0(p,this._parents,a,c)}function SDe(o){var a=this._name,c=this._id;typeof o!="function"&&(o=Qle(o));for(var d=this._groups,g=d.length,p=[],y=[],x=0;x<g;++x)for(var T=d[x],A=T.length,M,P=0;P<A;++P)if(M=T[P]){for(var z=o.call(M,M.__data__,P,T),U,q=$p(M,c),Q=0,ee=z.length;Q<ee;++Q)(U=z[Q])&&Ez(U,a,c,Q,z,q);p.push(z),y.push(M)}return new S0(p,y,a,c)}var xDe=IM.prototype.constructor;function EDe(){return new xDe(this._groups,this._parents)}function _De(o,a){var c,d,g;return function(){var p=D4(this,o),y=(this.style.removeProperty(o),D4(this,o));return p===y?null:p===c&&y===d?g:g=a(c=p,d=y)}}function xue(o){return function(){this.style.removeProperty(o)}}function TDe(o,a,c){var d,g=c+"",p;return function(){var y=D4(this,o);return y===g?null:y===d?p:p=a(d=y,c)}}function kDe(o,a,c){var d,g,p;return function(){var y=D4(this,o),x=c(this),T=x+"";return x==null&&(T=x=(this.style.removeProperty(o),D4(this,o))),y===T?null:y===d&&T===g?p:(g=T,p=a(d=y,x))}}function ADe(o,a){var c,d,g,p="style."+a,y="end."+p,x;return function(){var T=Cb(this,o),A=T.on,M=T.value[p]==null?x||(x=xue(a)):void 0;(A!==c||g!==M)&&(d=(c=A).copy()).on(y,g=M),T.on=d}}function ODe(o,a,c){var d=(o+="")=="transform"?O$e:Sue;return a==null?this.styleTween(o,_De(o,d)).on("end.style."+o,xue(o)):typeof a=="function"?this.styleTween(o,kDe(o,d,Jte(this,"style."+o,a))).each(ADe(this._id,o)):this.styleTween(o,TDe(o,d,a),c).on("end.style."+o,null)}function NDe(o,a,c){return function(d){this.style.setProperty(o,a.call(this,d),c)}}function $De(o,a,c){var d,g;function p(){var y=a.apply(this,arguments);return y!==g&&(d=(g=y)&&NDe(o,y,c)),d}return p._value=a,p}function DDe(o,a,c){var d="style."+(o+="");if(arguments.length<2)return(d=this.tween(d))&&d._value;if(a==null)return this.tween(d,null);if(typeof a!="function")throw new Error;return this.tween(d,$De(o,a,c??""))}function MDe(o){return function(){this.textContent=o}}function RDe(o){return function(){var a=o(this);this.textContent=a??""}}function IDe(o){return this.tween("text",typeof o=="function"?RDe(Jte(this,"text",o)):MDe(o==null?"":o+""))}function PDe(o){return function(a){this.textContent=o.call(this,a)}}function BDe(o){var a,c;function d(){var g=o.apply(this,arguments);return g!==c&&(a=(c=g)&&PDe(g)),a}return d._value=o,d}function FDe(o){var a="text";if(arguments.length<1)return(a=this.tween(a))&&a._value;if(o==null)return this.tween(a,null);if(typeof o!="function")throw new Error;return this.tween(a,BDe(o))}function LDe(){for(var o=this._name,a=this._id,c=Eue(),d=this._groups,g=d.length,p=0;p<g;++p)for(var y=d[p],x=y.length,T,A=0;A<x;++A)if(T=y[A]){var M=$p(T,a);Ez(T,o,c,A,y,{time:M.time+M.delay+M.duration,delay:0,duration:M.duration,ease:M.ease})}return new S0(d,this._parents,o,c)}function VDe(){var o,a,c=this,d=c._id,g=c.size();return new Promise(function(p,y){var x={value:y},T={value:function(){--g===0&&p()}};c.each(function(){var A=Cb(this,d),M=A.on;M!==o&&(a=(o=M).copy(),a._.cancel.push(x),a._.interrupt.push(x),a._.end.push(T)),A.on=a}),g===0&&p()})}var HDe=0;function S0(o,a,c,d){this._groups=o,this._parents=a,this._name=c,this._id=d}function Eue(){return++HDe}var g0=IM.prototype;S0.prototype={constructor:S0,select:CDe,selectAll:SDe,selectChild:g0.selectChild,selectChildren:g0.selectChildren,filter:gDe,merge:hDe,selection:EDe,transition:LDe,call:g0.call,nodes:g0.nodes,node:g0.node,size:g0.size,empty:g0.empty,each:g0.each,on:vDe,attr:J$e,attrTween:oDe,style:ODe,styleTween:DDe,text:IDe,textTween:FDe,remove:wDe,tween:W$e,delay:aDe,duration:lDe,ease:dDe,easeVarying:mDe,end:VDe,[Symbol.iterator]:g0[Symbol.iterator]};function zDe(o){return((o*=2)<=1?o*o*o:(o-=2)*o*o+2)/2}var UDe={time:null,delay:0,duration:250,ease:zDe};function jDe(o,a){for(var c;!(c=o.__transition)||!(c=c[a]);)if(!(o=o.parentNode))throw new Error(`transition ${a} not found`);return c}function WDe(o){var a,c;o instanceof S0?(a=o._id,o=o._name):(a=Eue(),(c=UDe).time=Kte(),o=o==null?null:o+"");for(var d=this._groups,g=d.length,p=0;p<g;++p)for(var y=d[p],x=y.length,T,A=0;A<x;++A)(T=y[A])&&Ez(T,o,a,A,y,c||jDe(T,a));return new S0(d,this._parents,o,a)}IM.prototype.interrupt=z$e;IM.prototype.transition=WDe;const IV=o=>()=>o;function ZDe(o,{sourceEvent:a,target:c,transform:d,dispatch:g}){Object.defineProperties(this,{type:{value:o,enumerable:!0,configurable:!0},sourceEvent:{value:a,enumerable:!0,configurable:!0},target:{value:c,enumerable:!0,configurable:!0},transform:{value:d,enumerable:!0,configurable:!0},_:{value:g}})}function v0(o,a,c){this.k=o,this.x=a,this.y=c}v0.prototype={constructor:v0,scale:function(o){return o===1?this:new v0(this.k*o,this.x,this.y)},translate:function(o,a){return o===0&a===0?this:new v0(this.k,this.x+this.k*o,this.y+this.k*a)},apply:function(o){return[o[0]*this.k+this.x,o[1]*this.k+this.y]},applyX:function(o){return o*this.k+this.x},applyY:function(o){return o*this.k+this.y},invert:function(o){return[(o[0]-this.x)/this.k,(o[1]-this.y)/this.k]},invertX:function(o){return(o-this.x)/this.k},invertY:function(o){return(o-this.y)/this.k},rescaleX:function(o){return o.copy().domain(o.range().map(this.invertX,this).map(o.invert,o))},rescaleY:function(o){return o.copy().domain(o.range().map(this.invertY,this).map(o.invert,o))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var R4=new v0(1,0,0);v0.prototype;function zQ(o){o.stopImmediatePropagation()}function q6(o){o.preventDefault(),o.stopImmediatePropagation()}function GDe(o){return(!o.ctrlKey||o.type==="wheel")&&!o.button}function qDe(){var o=this;return o instanceof SVGElement?(o=o.ownerSVGElement||o,o.hasAttribute("viewBox")?(o=o.viewBox.baseVal,[[o.x,o.y],[o.x+o.width,o.y+o.height]]):[[0,0],[o.width.baseVal.value,o.height.baseVal.value]]):[[0,0],[o.clientWidth,o.clientHeight]]}function lae(){return this.__zoom||R4}function YDe(o){return-o.deltaY*(o.deltaMode===1?.05:o.deltaMode?1:.002)*(o.ctrlKey?10:1)}function KDe(){return navigator.maxTouchPoints||"ontouchstart"in this}function XDe(o,a,c){var d=o.invertX(a[0][0])-c[0][0],g=o.invertX(a[1][0])-c[1][0],p=o.invertY(a[0][1])-c[0][1],y=o.invertY(a[1][1])-c[1][1];return o.translate(g>d?(d+g)/2:Math.min(0,d)||Math.max(0,g),y>p?(p+y)/2:Math.min(0,p)||Math.max(0,y))}function JDe(){var o=GDe,a=qDe,c=XDe,d=YDe,g=KDe,p=[0,1/0],y=[[-1/0,-1/0],[1/0,1/0]],x=250,T=R$e,A=Cz("start","zoom","end"),M,P,z,U=500,q=150,Q=0,ee=10;function le(we){we.property("__zoom",lae).on("wheel.zoom",Ge,{passive:!1}).on("mousedown.zoom",vt).on("dblclick.zoom",yt).filter(g).on("touchstart.zoom",De).on("touchmove.zoom",ue).on("touchend.zoom touchcancel.zoom",Vt).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}le.transform=function(we,Ie,D,Ue){var be=we.selection?we.selection():we;be.property("__zoom",lae),we!==be?mt(we,Ie,D,Ue):be.interrupt().each(function(){Le(this,arguments).event(Ue).start().zoom(null,typeof Ie=="function"?Ie.apply(this,arguments):Ie).end()})},le.scaleBy=function(we,Ie,D,Ue){le.scaleTo(we,function(){var be=this.__zoom.k,tt=typeof Ie=="function"?Ie.apply(this,arguments):Ie;return be*tt},D,Ue)},le.scaleTo=function(we,Ie,D,Ue){le.transform(we,function(){var be=a.apply(this,arguments),tt=this.__zoom,nt=D==null?Ae(be):typeof D=="function"?D.apply(this,arguments):D,ge=tt.invert(nt),We=typeof Ie=="function"?Ie.apply(this,arguments):Ie;return c(Z(ae(tt,We),nt,ge),be,y)},D,Ue)},le.translateBy=function(we,Ie,D,Ue){le.transform(we,function(){return c(this.__zoom.translate(typeof Ie=="function"?Ie.apply(this,arguments):Ie,typeof D=="function"?D.apply(this,arguments):D),a.apply(this,arguments),y)},null,Ue)},le.translateTo=function(we,Ie,D,Ue,be){le.transform(we,function(){var tt=a.apply(this,arguments),nt=this.__zoom,ge=Ue==null?Ae(tt):typeof Ue=="function"?Ue.apply(this,arguments):Ue;return c(R4.translate(ge[0],ge[1]).scale(nt.k).translate(typeof Ie=="function"?-Ie.apply(this,arguments):-Ie,typeof D=="function"?-D.apply(this,arguments):-D),tt,y)},Ue,be)};function ae(we,Ie){return Ie=Math.max(p[0],Math.min(p[1],Ie)),Ie===we.k?we:new v0(Ie,we.x,we.y)}function Z(we,Ie,D){var Ue=Ie[0]-D[0]*we.k,be=Ie[1]-D[1]*we.k;return Ue===we.x&&be===we.y?we:new v0(we.k,Ue,be)}function Ae(we){return[(+we[0][0]+ +we[1][0])/2,(+we[0][1]+ +we[1][1])/2]}function mt(we,Ie,D,Ue){we.on("start.zoom",function(){Le(this,arguments).event(Ue).start()}).on("interrupt.zoom end.zoom",function(){Le(this,arguments).event(Ue).end()}).tween("zoom",function(){var be=this,tt=arguments,nt=Le(be,tt).event(Ue),ge=a.apply(be,tt),We=D==null?Ae(ge):typeof D=="function"?D.apply(be,tt):D,kt=Math.max(ge[1][0]-ge[0][0],ge[1][1]-ge[0][1]),He=be.__zoom,ht=typeof Ie=="function"?Ie.apply(be,tt):Ie,Me=T(He.invert(We).concat(kt/He.k),ht.invert(We).concat(kt/ht.k));return function(lt){if(lt===1)lt=ht;else{var te=Me(lt),gn=kt/te[2];lt=new v0(gn,We[0]-te[0]*gn,We[1]-te[1]*gn)}nt.zoom(null,lt)}})}function Le(we,Ie,D){return!D&&we.__zooming||new J(we,Ie)}function J(we,Ie){this.that=we,this.args=Ie,this.active=0,this.sourceEvent=null,this.extent=a.apply(we,Ie),this.taps=0}J.prototype={event:function(we){return we&&(this.sourceEvent=we),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(we,Ie){return this.mouse&&we!=="mouse"&&(this.mouse[1]=Ie.invert(this.mouse[0])),this.touch0&&we!=="touch"&&(this.touch0[1]=Ie.invert(this.touch0[0])),this.touch1&&we!=="touch"&&(this.touch1[1]=Ie.invert(this.touch1[0])),this.that.__zoom=Ie,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(we){var Ie=kp(this.that).datum();A.call(we,this.that,new ZDe(we,{sourceEvent:this.sourceEvent,target:le,type:we,transform:this.that.__zoom,dispatch:A}),Ie)}};function Ge(we,...Ie){if(!o.apply(this,arguments))return;var D=Le(this,Ie).event(we),Ue=this.__zoom,be=Math.max(p[0],Math.min(p[1],Ue.k*Math.pow(2,d.apply(this,arguments)))),tt=gb(we);if(D.wheel)(D.mouse[0][0]!==tt[0]||D.mouse[0][1]!==tt[1])&&(D.mouse[1]=Ue.invert(D.mouse[0]=tt)),clearTimeout(D.wheel);else{if(Ue.k===be)return;D.mouse=[tt,Ue.invert(tt)],tH(this),D.start()}q6(we),D.wheel=setTimeout(nt,q),D.zoom("mouse",c(Z(ae(Ue,be),D.mouse[0],D.mouse[1]),D.extent,y));function nt(){D.wheel=null,D.end()}}function vt(we,...Ie){if(z||!o.apply(this,arguments))return;var D=we.currentTarget,Ue=Le(this,Ie,!0).event(we),be=kp(we.view).on("mousemove.zoom",We,!0).on("mouseup.zoom",kt,!0),tt=gb(we,D),nt=we.clientX,ge=we.clientY;uue(we.view),zQ(we),Ue.mouse=[tt,this.__zoom.invert(tt)],tH(this),Ue.start();function We(He){if(q6(He),!Ue.moved){var ht=He.clientX-nt,Me=He.clientY-ge;Ue.moved=ht*ht+Me*Me>Q}Ue.event(He).zoom("mouse",c(Z(Ue.that.__zoom,Ue.mouse[0]=gb(He,D),Ue.mouse[1]),Ue.extent,y))}function kt(He){be.on("mousemove.zoom mouseup.zoom",null),due(He.view,Ue.moved),q6(He),Ue.event(He).end()}}function yt(we,...Ie){if(o.apply(this,arguments)){var D=this.__zoom,Ue=gb(we.changedTouches?we.changedTouches[0]:we,this),be=D.invert(Ue),tt=D.k*(we.shiftKey?.5:2),nt=c(Z(ae(D,tt),Ue,be),a.apply(this,Ie),y);q6(we),x>0?kp(this).transition().duration(x).call(mt,nt,Ue,we):kp(this).call(le.transform,nt,Ue,we)}}function De(we,...Ie){if(o.apply(this,arguments)){var D=we.touches,Ue=D.length,be=Le(this,Ie,we.changedTouches.length===Ue).event(we),tt,nt,ge,We;for(zQ(we),nt=0;nt<Ue;++nt)ge=D[nt],We=gb(ge,this),We=[We,this.__zoom.invert(We),ge.identifier],be.touch0?!be.touch1&&be.touch0[2]!==We[2]&&(be.touch1=We,be.taps=0):(be.touch0=We,tt=!0,be.taps=1+!!M);M&&(M=clearTimeout(M)),tt&&(be.taps<2&&(P=We[0],M=setTimeout(function(){M=null},U)),tH(this),be.start())}}function ue(we,...Ie){if(this.__zooming){var D=Le(this,Ie).event(we),Ue=we.changedTouches,be=Ue.length,tt,nt,ge,We;for(q6(we),tt=0;tt<be;++tt)nt=Ue[tt],ge=gb(nt,this),D.touch0&&D.touch0[2]===nt.identifier?D.touch0[0]=ge:D.touch1&&D.touch1[2]===nt.identifier&&(D.touch1[0]=ge);if(nt=D.that.__zoom,D.touch1){var kt=D.touch0[0],He=D.touch0[1],ht=D.touch1[0],Me=D.touch1[1],lt=(lt=ht[0]-kt[0])*lt+(lt=ht[1]-kt[1])*lt,te=(te=Me[0]-He[0])*te+(te=Me[1]-He[1])*te;nt=ae(nt,Math.sqrt(lt/te)),ge=[(kt[0]+ht[0])/2,(kt[1]+ht[1])/2],We=[(He[0]+Me[0])/2,(He[1]+Me[1])/2]}else if(D.touch0)ge=D.touch0[0],We=D.touch0[1];else return;D.zoom("touch",c(Z(nt,ge,We),D.extent,y))}}function Vt(we,...Ie){if(this.__zooming){var D=Le(this,Ie).event(we),Ue=we.changedTouches,be=Ue.length,tt,nt;for(zQ(we),z&&clearTimeout(z),z=setTimeout(function(){z=null},U),tt=0;tt<be;++tt)nt=Ue[tt],D.touch0&&D.touch0[2]===nt.identifier?delete D.touch0:D.touch1&&D.touch1[2]===nt.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(nt=gb(nt,this),Math.hypot(P[0]-nt[0],P[1]-nt[1])<ee)){var ge=kp(this).on("dblclick.zoom");ge&&ge.apply(this,arguments)}}}return le.wheelDelta=function(we){return arguments.length?(d=typeof we=="function"?we:IV(+we),le):d},le.filter=function(we){return arguments.length?(o=typeof we=="function"?we:IV(!!we),le):o},le.touchable=function(we){return arguments.length?(g=typeof we=="function"?we:IV(!!we),le):g},le.extent=function(we){return arguments.length?(a=typeof we=="function"?we:IV([[+we[0][0],+we[0][1]],[+we[1][0],+we[1][1]]]),le):a},le.scaleExtent=function(we){return arguments.length?(p[0]=+we[0],p[1]=+we[1],le):[p[0],p[1]]},le.translateExtent=function(we){return arguments.length?(y[0][0]=+we[0][0],y[1][0]=+we[1][0],y[0][1]=+we[0][1],y[1][1]=+we[1][1],le):[[y[0][0],y[0][1]],[y[1][0],y[1][1]]]},le.constrain=function(we){return arguments.length?(c=we,le):c},le.duration=function(we){return arguments.length?(x=+we,le):x},le.interpolate=function(we){return arguments.length?(T=we,le):T},le.on=function(){var we=A.on.apply(A,arguments);return we===A?le:we},le.clickDistance=function(we){return arguments.length?(Q=(we=+we)*we,le):Math.sqrt(Q)},le.tapDistance=function(we){return arguments.length?(ee=+we,le):ee},le}var os=(o=>(o.Left="left",o.Top="top",o.Right="right",o.Bottom="bottom",o))(os||{}),Qte=(o=>(o.Partial="partial",o.Full="full",o))(Qte||{}),Bx=(o=>(o.Bezier="default",o.SimpleBezier="simple-bezier",o.Straight="straight",o.Step="step",o.SmoothStep="smoothstep",o))(Bx||{}),Yw=(o=>(o.Strict="strict",o.Loose="loose",o))(Yw||{}),AH=(o=>(o.Arrow="arrow",o.ArrowClosed="arrowclosed",o))(AH||{}),oM=(o=>(o.Free="free",o.Vertical="vertical",o.Horizontal="horizontal",o))(oM||{}),_ue=(o=>(o.TopLeft="top-left",o.TopCenter="top-center",o.TopRight="top-right",o.BottomLeft="bottom-left",o.BottomCenter="bottom-center",o.BottomRight="bottom-right",o))(_ue||{});const QDe=["INPUT","SELECT","TEXTAREA"];function qee(o){var a,c;const d=((c=(a=o.composedPath)==null?void 0:a.call(o))==null?void 0:c[0])||o.target,g=typeof(d==null?void 0:d.hasAttribute)=="function"?d.hasAttribute("contenteditable"):!1,p=typeof(d==null?void 0:d.closest)=="function"?d.closest(".nokey"):null;return QDe.includes(d==null?void 0:d.nodeName)||g||!!p}function e6e(o){return o.ctrlKey||o.metaKey||o.shiftKey||o.altKey}function uae(o,a,c,d){const g=a.replace("+",`
113
113
  `).replace(`
114
114
 
115
115
  `,`