@zyui/components 0.0.93 → 0.0.94

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 Nge=Object.defineProperty;var Dge=(o,r,l)=>r in o?Nge(o,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[r]=l;var Vc=(o,r,l)=>Dge(o,typeof r!="symbol"?r+"":r,l);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("vue"),Oge=require("side-channel"),Sn=require("element-plus"),$ge="0.0.93";var Bge=Object.defineProperty,Mge=(o,r,l)=>r in o?Bge(o,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[r]=l,UQ=(o,r,l)=>Mge(o,typeof r!="symbol"?r+"":r,l);function pie(o,r){return function(){return o.apply(r,arguments)}}const{toString:Rge}=Object.prototype,{getPrototypeOf:Ite}=Object,CH=(o=>r=>{const l=Rge.call(r);return o[l]||(o[l]=l.slice(8,-1).toLowerCase())})(Object.create(null)),n1=o=>(o=o.toLowerCase(),r=>CH(r)===o),xH=o=>r=>typeof r===o,{isArray:E4}=Array,_6=xH("undefined");function Ige(o){return o!==null&&!_6(o)&&o.constructor!==null&&!_6(o.constructor)&&Mg(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const hie=n1("ArrayBuffer");function Pge(o){let r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(o):r=o&&o.buffer&&hie(o.buffer),r}const Fge=xH("string"),Mg=xH("function"),vie=xH("number"),SH=o=>o!==null&&typeof o=="object",Lge=o=>o===!0||o===!1,C9=o=>{if(CH(o)!=="object")return!1;const r=Ite(o);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in o)&&!(Symbol.iterator in o)},Vge=n1("Date"),Hge=n1("File"),zge=n1("Blob"),Uge=n1("FileList"),jge=o=>SH(o)&&Mg(o.pipe),Wge=o=>{let r;return o&&(typeof FormData=="function"&&o instanceof FormData||Mg(o.append)&&((r=CH(o))==="formdata"||r==="object"&&Mg(o.toString)&&o.toString()==="[object FormData]"))},Zge=n1("URLSearchParams"),[Gge,qge,Yge,Kge]=["ReadableStream","Request","Response","Headers"].map(n1),Xge=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F6(o,r,{allOwnKeys:l=!1}={}){if(o===null||typeof o>"u")return;let u,g;if(typeof o!="object"&&(o=[o]),E4(o))for(u=0,g=o.length;u<g;u++)r.call(null,o[u],u,o);else{const h=l?Object.getOwnPropertyNames(o):Object.keys(o),b=h.length;let x;for(u=0;u<b;u++)x=h[u],r.call(null,o[x],x,o)}}function bie(o,r){r=r.toLowerCase();const l=Object.keys(o);let u=l.length,g;for(;u-- >0;)if(g=l[u],r===g.toLowerCase())return g;return null}const jE=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,yie=o=>!_6(o)&&o!==jE;function zee(){const{caseless:o}=yie(this)&&this||{},r={},l=(u,g)=>{const h=o&&bie(r,g)||g;C9(r[h])&&C9(u)?r[h]=zee(r[h],u):C9(u)?r[h]=zee({},u):E4(u)?r[h]=u.slice():r[h]=u};for(let u=0,g=arguments.length;u<g;u++)arguments[u]&&F6(arguments[u],l);return r}const Jge=(o,r,l,{allOwnKeys:u}={})=>(F6(r,(g,h)=>{l&&Mg(g)?o[h]=pie(g,l):o[h]=g},{allOwnKeys:u}),o),Qge=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),epe=(o,r,l,u)=>{o.prototype=Object.create(r.prototype,u),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:r.prototype}),l&&Object.assign(o.prototype,l)},tpe=(o,r,l,u)=>{let g,h,b;const x={};if(r=r||{},o==null)return r;do{for(g=Object.getOwnPropertyNames(o),h=g.length;h-- >0;)b=g[h],(!u||u(b,o,r))&&!x[b]&&(r[b]=o[b],x[b]=!0);o=l!==!1&&Ite(o)}while(o&&(!l||l(o,r))&&o!==Object.prototype);return r},npe=(o,r,l)=>{o=String(o),(l===void 0||l>o.length)&&(l=o.length),l-=r.length;const u=o.indexOf(r,l);return u!==-1&&u===l},ope=o=>{if(!o)return null;if(E4(o))return o;let r=o.length;if(!vie(r))return null;const l=new Array(r);for(;r-- >0;)l[r]=o[r];return l},spe=(o=>r=>o&&r instanceof o)(typeof Uint8Array<"u"&&Ite(Uint8Array)),rpe=(o,r)=>{const l=(o&&o[Symbol.iterator]).call(o);let u;for(;(u=l.next())&&!u.done;){const g=u.value;r.call(o,g[0],g[1])}},ape=(o,r)=>{let l;const u=[];for(;(l=o.exec(r))!==null;)u.push(l);return u},lpe=n1("HTMLFormElement"),ipe=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,l,u){return l.toUpperCase()+u}),Hse=(({hasOwnProperty:o})=>(r,l)=>o.call(r,l))(Object.prototype),cpe=n1("RegExp"),wie=(o,r)=>{const l=Object.getOwnPropertyDescriptors(o),u={};F6(l,(g,h)=>{let b;(b=r(g,h,o))!==!1&&(u[h]=b||g)}),Object.defineProperties(o,u)},upe=o=>{wie(o,(r,l)=>{if(Mg(o)&&["arguments","caller","callee"].indexOf(l)!==-1)return!1;const u=o[l];if(Mg(u)){if(r.enumerable=!1,"writable"in r){r.writable=!1;return}r.set||(r.set=()=>{throw Error("Can not rewrite read-only method '"+l+"'")})}})},dpe=(o,r)=>{const l={},u=g=>{g.forEach(h=>{l[h]=!0})};return E4(o)?u(o):u(String(o).split(r)),l},fpe=()=>{},mpe=(o,r)=>o!=null&&Number.isFinite(o=+o)?o:r,jQ="abcdefghijklmnopqrstuvwxyz",zse="0123456789",Cie={DIGIT:zse,ALPHA:jQ,ALPHA_DIGIT:jQ+jQ.toUpperCase()+zse},gpe=(o=16,r=Cie.ALPHA_DIGIT)=>{let l="";const{length:u}=r;for(;o--;)l+=r[Math.random()*u|0];return l};function ppe(o){return!!(o&&Mg(o.append)&&o[Symbol.toStringTag]==="FormData"&&o[Symbol.iterator])}const hpe=o=>{const r=new Array(10),l=(u,g)=>{if(SH(u)){if(r.indexOf(u)>=0)return;if(!("toJSON"in u)){r[g]=u;const h=E4(u)?[]:{};return F6(u,(b,x)=>{const S=l(b,g+1);!_6(S)&&(h[x]=S)}),r[g]=void 0,h}}return u};return l(o,0)},vpe=n1("AsyncFunction"),bpe=o=>o&&(SH(o)||Mg(o))&&Mg(o.then)&&Mg(o.catch),xie=((o,r)=>o?setImmediate:r?((l,u)=>(jE.addEventListener("message",({source:g,data:h})=>{g===jE&&h===l&&u.length&&u.shift()()},!1),g=>{u.push(g),jE.postMessage(l,"*")}))(`axios@${Math.random()}`,[]):l=>setTimeout(l))(typeof setImmediate=="function",Mg(jE.postMessage)),ype=typeof queueMicrotask<"u"?queueMicrotask.bind(jE):typeof process<"u"&&process.nextTick||xie,An={isArray:E4,isArrayBuffer:hie,isBuffer:Ige,isFormData:Wge,isArrayBufferView:Pge,isString:Fge,isNumber:vie,isBoolean:Lge,isObject:SH,isPlainObject:C9,isReadableStream:Gge,isRequest:qge,isResponse:Yge,isHeaders:Kge,isUndefined:_6,isDate:Vge,isFile:Hge,isBlob:zge,isRegExp:cpe,isFunction:Mg,isStream:jge,isURLSearchParams:Zge,isTypedArray:spe,isFileList:Uge,forEach:F6,merge:zee,extend:Jge,trim:Xge,stripBOM:Qge,inherits:epe,toFlatObject:tpe,kindOf:CH,kindOfTest:n1,endsWith:npe,toArray:ope,forEachEntry:rpe,matchAll:ape,isHTMLForm:lpe,hasOwnProperty:Hse,hasOwnProp:Hse,reduceDescriptors:wie,freezeMethods:upe,toObjectSet:dpe,toCamelCase:ipe,noop:fpe,toFiniteNumber:mpe,findKey:bie,global:jE,isContextDefined:yie,ALPHABET:Cie,generateString:gpe,isSpecCompliantForm:ppe,toJSONObject:hpe,isAsyncFn:vpe,isThenable:bpe,setImmediate:xie,asap:ype};function kr(o,r,l,u,g){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=o,this.name="AxiosError",r&&(this.code=r),l&&(this.config=l),u&&(this.request=u),g&&(this.response=g,this.status=g.status?g.status:null)}An.inherits(kr,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:An.toJSONObject(this.config),code:this.code,status:this.status}}});const Sie=kr.prototype,Eie={};["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=>{Eie[o]={value:o}});Object.defineProperties(kr,Eie);Object.defineProperty(Sie,"isAxiosError",{value:!0});kr.from=(o,r,l,u,g,h)=>{const b=Object.create(Sie);return An.toFlatObject(o,b,function(x){return x!==Error.prototype},x=>x!=="isAxiosError"),kr.call(b,o.message,r,l,u,g),b.cause=o,b.name=o.name,h&&Object.assign(b,h),b};const wpe=null;function Uee(o){return An.isPlainObject(o)||An.isArray(o)}function _ie(o){return An.endsWith(o,"[]")?o.slice(0,-2):o}function Use(o,r,l){return o?o.concat(r).map(function(u,g){return u=_ie(u),!l&&g?"["+u+"]":u}).join(l?".":""):r}function Cpe(o){return An.isArray(o)&&!o.some(Uee)}const xpe=An.toFlatObject(An,{},null,function(o){return/^is[A-Z]/.test(o)});function EH(o,r,l){if(!An.isObject(o))throw new TypeError("target must be an object");r=r||new FormData,l=An.toFlatObject(l,{metaTokens:!0,dots:!1,indexes:!1},!1,function(F,W){return!An.isUndefined(W[F])});const u=l.metaTokens,g=l.visitor||_,h=l.dots,b=l.indexes,x=(l.Blob||typeof Blob<"u"&&Blob)&&An.isSpecCompliantForm(r);if(!An.isFunction(g))throw new TypeError("visitor must be a function");function S(F){if(F===null)return"";if(An.isDate(F))return F.toISOString();if(!x&&An.isBlob(F))throw new kr("Blob is not supported. Use a Buffer instead.");return An.isArrayBuffer(F)||An.isTypedArray(F)?x&&typeof Blob=="function"?new Blob([F]):Buffer.from(F):F}function _(F,W,Z){let G=F;if(F&&!Z&&typeof F=="object"){if(An.endsWith(W,"{}"))W=u?W:W.slice(0,-2),F=JSON.stringify(F);else if(An.isArray(F)&&Cpe(F)||(An.isFileList(F)||An.endsWith(W,"[]"))&&(G=An.toArray(F)))return W=_ie(W),G.forEach(function(K,q){!(An.isUndefined(K)||K===null)&&r.append(b===!0?Use([W],q,h):b===null?W:W+"[]",S(K))}),!1}return Uee(F)?!0:(r.append(Use(Z,W,h),S(F)),!1)}const N=[],D=Object.assign(xpe,{defaultVisitor:_,convertValue:S,isVisitable:Uee});function R(F,W){if(!An.isUndefined(F)){if(N.indexOf(F)!==-1)throw Error("Circular reference detected in "+W.join("."));N.push(F),An.forEach(F,function(Z,G){(!(An.isUndefined(Z)||Z===null)&&g.call(r,Z,An.isString(G)?G.trim():G,W,D))===!0&&R(Z,W?W.concat(G):[G])}),N.pop()}}if(!An.isObject(o))throw new TypeError("data must be an object");return R(o),r}function jse(o){const r={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(o).replace(/[!'()~]|%20|%00/g,function(l){return r[l]})}function Pte(o,r){this._pairs=[],o&&EH(o,this,r)}const kie=Pte.prototype;kie.append=function(o,r){this._pairs.push([o,r])};kie.toString=function(o){const r=o?function(l){return o.call(this,l,jse)}:jse;return this._pairs.map(function(l){return r(l[0])+"="+r(l[1])},"").join("&")};function Spe(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Tie(o,r,l){if(!r)return o;const u=l&&l.encode||Spe;An.isFunction(l)&&(l={serialize:l});const g=l&&l.serialize;let h;if(g?h=g(r,l):h=An.isURLSearchParams(r)?r.toString():new Pte(r,l).toString(u),h){const b=o.indexOf("#");b!==-1&&(o=o.slice(0,b)),o+=(o.indexOf("?")===-1?"?":"&")+h}return o}let Wse=class{constructor(){this.handlers=[]}use(r,l,u){return this.handlers.push({fulfilled:r,rejected:l,synchronous:u?u.synchronous:!1,runWhen:u?u.runWhen:null}),this.handlers.length-1}eject(r){this.handlers[r]&&(this.handlers[r]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(r){An.forEach(this.handlers,function(l){l!==null&&r(l)})}};const Aie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Epe=typeof URLSearchParams<"u"?URLSearchParams:Pte,_pe=typeof FormData<"u"?FormData:null,kpe=typeof Blob<"u"?Blob:null,Tpe={isBrowser:!0,classes:{URLSearchParams:Epe,FormData:_pe,Blob:kpe},protocols:["http","https","file","blob","url","data"]},Fte=typeof window<"u"&&typeof document<"u",jee=typeof navigator=="object"&&navigator||void 0,Ape=Fte&&(!jee||["ReactNative","NativeScript","NS"].indexOf(jee.product)<0),Npe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Dpe=Fte&&window.location.href||"http://localhost",Ope=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Fte,hasStandardBrowserEnv:Ape,hasStandardBrowserWebWorkerEnv:Npe,navigator:jee,origin:Dpe},Symbol.toStringTag,{value:"Module"})),rf={...Ope,...Tpe};function $pe(o,r){return EH(o,new rf.classes.URLSearchParams,Object.assign({visitor:function(l,u,g,h){return rf.isNode&&An.isBuffer(l)?(this.append(u,l.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)}},r))}function Bpe(o){return An.matchAll(/\w+|\[(\w*)]/g,o).map(r=>r[0]==="[]"?"":r[1]||r[0])}function Mpe(o){const r={},l=Object.keys(o);let u;const g=l.length;let h;for(u=0;u<g;u++)h=l[u],r[h]=o[h];return r}function Nie(o){function r(l,u,g,h){let b=l[h++];if(b==="__proto__")return!0;const x=Number.isFinite(+b),S=h>=l.length;return b=!b&&An.isArray(g)?g.length:b,S?(An.hasOwnProp(g,b)?g[b]=[g[b],u]:g[b]=u,!x):((!g[b]||!An.isObject(g[b]))&&(g[b]=[]),r(l,u,g[b],h)&&An.isArray(g[b])&&(g[b]=Mpe(g[b])),!x)}if(An.isFormData(o)&&An.isFunction(o.entries)){const l={};return An.forEachEntry(o,(u,g)=>{r(Bpe(u),g,l,0)}),l}return null}function Rpe(o,r,l){if(An.isString(o))try{return(r||JSON.parse)(o),An.trim(o)}catch(u){if(u.name!=="SyntaxError")throw u}return(0,JSON.stringify)(o)}const L6={transitional:Aie,adapter:["xhr","http","fetch"],transformRequest:[function(o,r){const l=r.getContentType()||"",u=l.indexOf("application/json")>-1,g=An.isObject(o);if(g&&An.isHTMLForm(o)&&(o=new FormData(o)),An.isFormData(o))return u?JSON.stringify(Nie(o)):o;if(An.isArrayBuffer(o)||An.isBuffer(o)||An.isStream(o)||An.isFile(o)||An.isBlob(o)||An.isReadableStream(o))return o;if(An.isArrayBufferView(o))return o.buffer;if(An.isURLSearchParams(o))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),o.toString();let h;if(g){if(l.indexOf("application/x-www-form-urlencoded")>-1)return $pe(o,this.formSerializer).toString();if((h=An.isFileList(o))||l.indexOf("multipart/form-data")>-1){const b=this.env&&this.env.FormData;return EH(h?{"files[]":o}:o,b&&new b,this.formSerializer)}}return g||u?(r.setContentType("application/json",!1),Rpe(o)):o}],transformResponse:[function(o){const r=this.transitional||L6.transitional,l=r&&r.forcedJSONParsing,u=this.responseType==="json";if(An.isResponse(o)||An.isReadableStream(o))return o;if(o&&An.isString(o)&&(l&&!this.responseType||u)){const g=!(r&&r.silentJSONParsing)&&u;try{return JSON.parse(o)}catch(h){if(g)throw h.name==="SyntaxError"?kr.from(h,kr.ERR_BAD_RESPONSE,this,null,this.response):h}}return o}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:rf.classes.FormData,Blob:rf.classes.Blob},validateStatus:function(o){return o>=200&&o<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};An.forEach(["delete","get","head","post","put","patch"],o=>{L6.headers[o]={}});const Ipe=An.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"]),Ppe=o=>{const r={};let l,u,g;return o&&o.split(`
1
+ "use strict";var Nge=Object.defineProperty;var Dge=(o,r,l)=>r in o?Nge(o,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[r]=l;var Vc=(o,r,l)=>Dge(o,typeof r!="symbol"?r+"":r,l);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("vue"),Oge=require("side-channel"),Sn=require("element-plus"),$ge="0.0.94";var Bge=Object.defineProperty,Mge=(o,r,l)=>r in o?Bge(o,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[r]=l,UQ=(o,r,l)=>Mge(o,typeof r!="symbol"?r+"":r,l);function pie(o,r){return function(){return o.apply(r,arguments)}}const{toString:Rge}=Object.prototype,{getPrototypeOf:Ite}=Object,CH=(o=>r=>{const l=Rge.call(r);return o[l]||(o[l]=l.slice(8,-1).toLowerCase())})(Object.create(null)),n1=o=>(o=o.toLowerCase(),r=>CH(r)===o),xH=o=>r=>typeof r===o,{isArray:E4}=Array,_6=xH("undefined");function Ige(o){return o!==null&&!_6(o)&&o.constructor!==null&&!_6(o.constructor)&&Mg(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const hie=n1("ArrayBuffer");function Pge(o){let r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(o):r=o&&o.buffer&&hie(o.buffer),r}const Fge=xH("string"),Mg=xH("function"),vie=xH("number"),SH=o=>o!==null&&typeof o=="object",Lge=o=>o===!0||o===!1,C9=o=>{if(CH(o)!=="object")return!1;const r=Ite(o);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in o)&&!(Symbol.iterator in o)},Vge=n1("Date"),Hge=n1("File"),zge=n1("Blob"),Uge=n1("FileList"),jge=o=>SH(o)&&Mg(o.pipe),Wge=o=>{let r;return o&&(typeof FormData=="function"&&o instanceof FormData||Mg(o.append)&&((r=CH(o))==="formdata"||r==="object"&&Mg(o.toString)&&o.toString()==="[object FormData]"))},Zge=n1("URLSearchParams"),[Gge,qge,Yge,Kge]=["ReadableStream","Request","Response","Headers"].map(n1),Xge=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F6(o,r,{allOwnKeys:l=!1}={}){if(o===null||typeof o>"u")return;let u,g;if(typeof o!="object"&&(o=[o]),E4(o))for(u=0,g=o.length;u<g;u++)r.call(null,o[u],u,o);else{const h=l?Object.getOwnPropertyNames(o):Object.keys(o),b=h.length;let x;for(u=0;u<b;u++)x=h[u],r.call(null,o[x],x,o)}}function bie(o,r){r=r.toLowerCase();const l=Object.keys(o);let u=l.length,g;for(;u-- >0;)if(g=l[u],r===g.toLowerCase())return g;return null}const jE=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,yie=o=>!_6(o)&&o!==jE;function zee(){const{caseless:o}=yie(this)&&this||{},r={},l=(u,g)=>{const h=o&&bie(r,g)||g;C9(r[h])&&C9(u)?r[h]=zee(r[h],u):C9(u)?r[h]=zee({},u):E4(u)?r[h]=u.slice():r[h]=u};for(let u=0,g=arguments.length;u<g;u++)arguments[u]&&F6(arguments[u],l);return r}const Jge=(o,r,l,{allOwnKeys:u}={})=>(F6(r,(g,h)=>{l&&Mg(g)?o[h]=pie(g,l):o[h]=g},{allOwnKeys:u}),o),Qge=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),epe=(o,r,l,u)=>{o.prototype=Object.create(r.prototype,u),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:r.prototype}),l&&Object.assign(o.prototype,l)},tpe=(o,r,l,u)=>{let g,h,b;const x={};if(r=r||{},o==null)return r;do{for(g=Object.getOwnPropertyNames(o),h=g.length;h-- >0;)b=g[h],(!u||u(b,o,r))&&!x[b]&&(r[b]=o[b],x[b]=!0);o=l!==!1&&Ite(o)}while(o&&(!l||l(o,r))&&o!==Object.prototype);return r},npe=(o,r,l)=>{o=String(o),(l===void 0||l>o.length)&&(l=o.length),l-=r.length;const u=o.indexOf(r,l);return u!==-1&&u===l},ope=o=>{if(!o)return null;if(E4(o))return o;let r=o.length;if(!vie(r))return null;const l=new Array(r);for(;r-- >0;)l[r]=o[r];return l},spe=(o=>r=>o&&r instanceof o)(typeof Uint8Array<"u"&&Ite(Uint8Array)),rpe=(o,r)=>{const l=(o&&o[Symbol.iterator]).call(o);let u;for(;(u=l.next())&&!u.done;){const g=u.value;r.call(o,g[0],g[1])}},ape=(o,r)=>{let l;const u=[];for(;(l=o.exec(r))!==null;)u.push(l);return u},lpe=n1("HTMLFormElement"),ipe=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,l,u){return l.toUpperCase()+u}),Hse=(({hasOwnProperty:o})=>(r,l)=>o.call(r,l))(Object.prototype),cpe=n1("RegExp"),wie=(o,r)=>{const l=Object.getOwnPropertyDescriptors(o),u={};F6(l,(g,h)=>{let b;(b=r(g,h,o))!==!1&&(u[h]=b||g)}),Object.defineProperties(o,u)},upe=o=>{wie(o,(r,l)=>{if(Mg(o)&&["arguments","caller","callee"].indexOf(l)!==-1)return!1;const u=o[l];if(Mg(u)){if(r.enumerable=!1,"writable"in r){r.writable=!1;return}r.set||(r.set=()=>{throw Error("Can not rewrite read-only method '"+l+"'")})}})},dpe=(o,r)=>{const l={},u=g=>{g.forEach(h=>{l[h]=!0})};return E4(o)?u(o):u(String(o).split(r)),l},fpe=()=>{},mpe=(o,r)=>o!=null&&Number.isFinite(o=+o)?o:r,jQ="abcdefghijklmnopqrstuvwxyz",zse="0123456789",Cie={DIGIT:zse,ALPHA:jQ,ALPHA_DIGIT:jQ+jQ.toUpperCase()+zse},gpe=(o=16,r=Cie.ALPHA_DIGIT)=>{let l="";const{length:u}=r;for(;o--;)l+=r[Math.random()*u|0];return l};function ppe(o){return!!(o&&Mg(o.append)&&o[Symbol.toStringTag]==="FormData"&&o[Symbol.iterator])}const hpe=o=>{const r=new Array(10),l=(u,g)=>{if(SH(u)){if(r.indexOf(u)>=0)return;if(!("toJSON"in u)){r[g]=u;const h=E4(u)?[]:{};return F6(u,(b,x)=>{const S=l(b,g+1);!_6(S)&&(h[x]=S)}),r[g]=void 0,h}}return u};return l(o,0)},vpe=n1("AsyncFunction"),bpe=o=>o&&(SH(o)||Mg(o))&&Mg(o.then)&&Mg(o.catch),xie=((o,r)=>o?setImmediate:r?((l,u)=>(jE.addEventListener("message",({source:g,data:h})=>{g===jE&&h===l&&u.length&&u.shift()()},!1),g=>{u.push(g),jE.postMessage(l,"*")}))(`axios@${Math.random()}`,[]):l=>setTimeout(l))(typeof setImmediate=="function",Mg(jE.postMessage)),ype=typeof queueMicrotask<"u"?queueMicrotask.bind(jE):typeof process<"u"&&process.nextTick||xie,An={isArray:E4,isArrayBuffer:hie,isBuffer:Ige,isFormData:Wge,isArrayBufferView:Pge,isString:Fge,isNumber:vie,isBoolean:Lge,isObject:SH,isPlainObject:C9,isReadableStream:Gge,isRequest:qge,isResponse:Yge,isHeaders:Kge,isUndefined:_6,isDate:Vge,isFile:Hge,isBlob:zge,isRegExp:cpe,isFunction:Mg,isStream:jge,isURLSearchParams:Zge,isTypedArray:spe,isFileList:Uge,forEach:F6,merge:zee,extend:Jge,trim:Xge,stripBOM:Qge,inherits:epe,toFlatObject:tpe,kindOf:CH,kindOfTest:n1,endsWith:npe,toArray:ope,forEachEntry:rpe,matchAll:ape,isHTMLForm:lpe,hasOwnProperty:Hse,hasOwnProp:Hse,reduceDescriptors:wie,freezeMethods:upe,toObjectSet:dpe,toCamelCase:ipe,noop:fpe,toFiniteNumber:mpe,findKey:bie,global:jE,isContextDefined:yie,ALPHABET:Cie,generateString:gpe,isSpecCompliantForm:ppe,toJSONObject:hpe,isAsyncFn:vpe,isThenable:bpe,setImmediate:xie,asap:ype};function kr(o,r,l,u,g){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=o,this.name="AxiosError",r&&(this.code=r),l&&(this.config=l),u&&(this.request=u),g&&(this.response=g,this.status=g.status?g.status:null)}An.inherits(kr,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:An.toJSONObject(this.config),code:this.code,status:this.status}}});const Sie=kr.prototype,Eie={};["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=>{Eie[o]={value:o}});Object.defineProperties(kr,Eie);Object.defineProperty(Sie,"isAxiosError",{value:!0});kr.from=(o,r,l,u,g,h)=>{const b=Object.create(Sie);return An.toFlatObject(o,b,function(x){return x!==Error.prototype},x=>x!=="isAxiosError"),kr.call(b,o.message,r,l,u,g),b.cause=o,b.name=o.name,h&&Object.assign(b,h),b};const wpe=null;function Uee(o){return An.isPlainObject(o)||An.isArray(o)}function _ie(o){return An.endsWith(o,"[]")?o.slice(0,-2):o}function Use(o,r,l){return o?o.concat(r).map(function(u,g){return u=_ie(u),!l&&g?"["+u+"]":u}).join(l?".":""):r}function Cpe(o){return An.isArray(o)&&!o.some(Uee)}const xpe=An.toFlatObject(An,{},null,function(o){return/^is[A-Z]/.test(o)});function EH(o,r,l){if(!An.isObject(o))throw new TypeError("target must be an object");r=r||new FormData,l=An.toFlatObject(l,{metaTokens:!0,dots:!1,indexes:!1},!1,function(F,W){return!An.isUndefined(W[F])});const u=l.metaTokens,g=l.visitor||_,h=l.dots,b=l.indexes,x=(l.Blob||typeof Blob<"u"&&Blob)&&An.isSpecCompliantForm(r);if(!An.isFunction(g))throw new TypeError("visitor must be a function");function S(F){if(F===null)return"";if(An.isDate(F))return F.toISOString();if(!x&&An.isBlob(F))throw new kr("Blob is not supported. Use a Buffer instead.");return An.isArrayBuffer(F)||An.isTypedArray(F)?x&&typeof Blob=="function"?new Blob([F]):Buffer.from(F):F}function _(F,W,Z){let G=F;if(F&&!Z&&typeof F=="object"){if(An.endsWith(W,"{}"))W=u?W:W.slice(0,-2),F=JSON.stringify(F);else if(An.isArray(F)&&Cpe(F)||(An.isFileList(F)||An.endsWith(W,"[]"))&&(G=An.toArray(F)))return W=_ie(W),G.forEach(function(K,q){!(An.isUndefined(K)||K===null)&&r.append(b===!0?Use([W],q,h):b===null?W:W+"[]",S(K))}),!1}return Uee(F)?!0:(r.append(Use(Z,W,h),S(F)),!1)}const N=[],D=Object.assign(xpe,{defaultVisitor:_,convertValue:S,isVisitable:Uee});function R(F,W){if(!An.isUndefined(F)){if(N.indexOf(F)!==-1)throw Error("Circular reference detected in "+W.join("."));N.push(F),An.forEach(F,function(Z,G){(!(An.isUndefined(Z)||Z===null)&&g.call(r,Z,An.isString(G)?G.trim():G,W,D))===!0&&R(Z,W?W.concat(G):[G])}),N.pop()}}if(!An.isObject(o))throw new TypeError("data must be an object");return R(o),r}function jse(o){const r={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(o).replace(/[!'()~]|%20|%00/g,function(l){return r[l]})}function Pte(o,r){this._pairs=[],o&&EH(o,this,r)}const kie=Pte.prototype;kie.append=function(o,r){this._pairs.push([o,r])};kie.toString=function(o){const r=o?function(l){return o.call(this,l,jse)}:jse;return this._pairs.map(function(l){return r(l[0])+"="+r(l[1])},"").join("&")};function Spe(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Tie(o,r,l){if(!r)return o;const u=l&&l.encode||Spe;An.isFunction(l)&&(l={serialize:l});const g=l&&l.serialize;let h;if(g?h=g(r,l):h=An.isURLSearchParams(r)?r.toString():new Pte(r,l).toString(u),h){const b=o.indexOf("#");b!==-1&&(o=o.slice(0,b)),o+=(o.indexOf("?")===-1?"?":"&")+h}return o}let Wse=class{constructor(){this.handlers=[]}use(r,l,u){return this.handlers.push({fulfilled:r,rejected:l,synchronous:u?u.synchronous:!1,runWhen:u?u.runWhen:null}),this.handlers.length-1}eject(r){this.handlers[r]&&(this.handlers[r]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(r){An.forEach(this.handlers,function(l){l!==null&&r(l)})}};const Aie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Epe=typeof URLSearchParams<"u"?URLSearchParams:Pte,_pe=typeof FormData<"u"?FormData:null,kpe=typeof Blob<"u"?Blob:null,Tpe={isBrowser:!0,classes:{URLSearchParams:Epe,FormData:_pe,Blob:kpe},protocols:["http","https","file","blob","url","data"]},Fte=typeof window<"u"&&typeof document<"u",jee=typeof navigator=="object"&&navigator||void 0,Ape=Fte&&(!jee||["ReactNative","NativeScript","NS"].indexOf(jee.product)<0),Npe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Dpe=Fte&&window.location.href||"http://localhost",Ope=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Fte,hasStandardBrowserEnv:Ape,hasStandardBrowserWebWorkerEnv:Npe,navigator:jee,origin:Dpe},Symbol.toStringTag,{value:"Module"})),rf={...Ope,...Tpe};function $pe(o,r){return EH(o,new rf.classes.URLSearchParams,Object.assign({visitor:function(l,u,g,h){return rf.isNode&&An.isBuffer(l)?(this.append(u,l.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)}},r))}function Bpe(o){return An.matchAll(/\w+|\[(\w*)]/g,o).map(r=>r[0]==="[]"?"":r[1]||r[0])}function Mpe(o){const r={},l=Object.keys(o);let u;const g=l.length;let h;for(u=0;u<g;u++)h=l[u],r[h]=o[h];return r}function Nie(o){function r(l,u,g,h){let b=l[h++];if(b==="__proto__")return!0;const x=Number.isFinite(+b),S=h>=l.length;return b=!b&&An.isArray(g)?g.length:b,S?(An.hasOwnProp(g,b)?g[b]=[g[b],u]:g[b]=u,!x):((!g[b]||!An.isObject(g[b]))&&(g[b]=[]),r(l,u,g[b],h)&&An.isArray(g[b])&&(g[b]=Mpe(g[b])),!x)}if(An.isFormData(o)&&An.isFunction(o.entries)){const l={};return An.forEachEntry(o,(u,g)=>{r(Bpe(u),g,l,0)}),l}return null}function Rpe(o,r,l){if(An.isString(o))try{return(r||JSON.parse)(o),An.trim(o)}catch(u){if(u.name!=="SyntaxError")throw u}return(0,JSON.stringify)(o)}const L6={transitional:Aie,adapter:["xhr","http","fetch"],transformRequest:[function(o,r){const l=r.getContentType()||"",u=l.indexOf("application/json")>-1,g=An.isObject(o);if(g&&An.isHTMLForm(o)&&(o=new FormData(o)),An.isFormData(o))return u?JSON.stringify(Nie(o)):o;if(An.isArrayBuffer(o)||An.isBuffer(o)||An.isStream(o)||An.isFile(o)||An.isBlob(o)||An.isReadableStream(o))return o;if(An.isArrayBufferView(o))return o.buffer;if(An.isURLSearchParams(o))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),o.toString();let h;if(g){if(l.indexOf("application/x-www-form-urlencoded")>-1)return $pe(o,this.formSerializer).toString();if((h=An.isFileList(o))||l.indexOf("multipart/form-data")>-1){const b=this.env&&this.env.FormData;return EH(h?{"files[]":o}:o,b&&new b,this.formSerializer)}}return g||u?(r.setContentType("application/json",!1),Rpe(o)):o}],transformResponse:[function(o){const r=this.transitional||L6.transitional,l=r&&r.forcedJSONParsing,u=this.responseType==="json";if(An.isResponse(o)||An.isReadableStream(o))return o;if(o&&An.isString(o)&&(l&&!this.responseType||u)){const g=!(r&&r.silentJSONParsing)&&u;try{return JSON.parse(o)}catch(h){if(g)throw h.name==="SyntaxError"?kr.from(h,kr.ERR_BAD_RESPONSE,this,null,this.response):h}}return o}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:rf.classes.FormData,Blob:rf.classes.Blob},validateStatus:function(o){return o>=200&&o<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};An.forEach(["delete","get","head","post","put","patch"],o=>{L6.headers[o]={}});const Ipe=An.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"]),Ppe=o=>{const r={};let l,u,g;return o&&o.split(`
2
2
  `).forEach(function(h){g=h.indexOf(":"),l=h.substring(0,g).trim().toLowerCase(),u=h.substring(g+1).trim(),!(!l||r[l]&&Ipe[l])&&(l==="set-cookie"?r[l]?r[l].push(u):r[l]=[u]:r[l]=r[l]?r[l]+", "+u:u)}),r},Zse=Symbol("internals");function o6(o){return o&&String(o).trim().toLowerCase()}function x9(o){return o===!1||o==null?o:An.isArray(o)?o.map(x9):String(o)}function Fpe(o){const r=Object.create(null),l=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let u;for(;u=l.exec(o);)r[u[1]]=u[2];return r}const Lpe=o=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());function WQ(o,r,l,u,g){if(An.isFunction(u))return u.call(this,r,l);if(g&&(r=l),!!An.isString(r)){if(An.isString(u))return r.indexOf(u)!==-1;if(An.isRegExp(u))return u.test(r)}}function Vpe(o){return o.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(r,l,u)=>l.toUpperCase()+u)}function Hpe(o,r){const l=An.toCamelCase(" "+r);["get","set","has"].forEach(u=>{Object.defineProperty(o,u+l,{value:function(g,h,b){return this[u].call(this,r,g,h,b)},configurable:!0})})}let Lm=class{constructor(r){r&&this.set(r)}set(r,l,u){const g=this;function h(x,S,_){const N=o6(S);if(!N)throw new Error("header name must be a non-empty string");const D=An.findKey(g,N);(!D||g[D]===void 0||_===!0||_===void 0&&g[D]!==!1)&&(g[D||S]=x9(x))}const b=(x,S)=>An.forEach(x,(_,N)=>h(_,N,S));if(An.isPlainObject(r)||r instanceof this.constructor)b(r,l);else if(An.isString(r)&&(r=r.trim())&&!Lpe(r))b(Ppe(r),l);else if(An.isHeaders(r))for(const[x,S]of r.entries())h(S,x,u);else r!=null&&h(l,r,u);return this}get(r,l){if(r=o6(r),r){const u=An.findKey(this,r);if(u){const g=this[u];if(!l)return g;if(l===!0)return Fpe(g);if(An.isFunction(l))return l.call(this,g,u);if(An.isRegExp(l))return l.exec(g);throw new TypeError("parser must be boolean|regexp|function")}}}has(r,l){if(r=o6(r),r){const u=An.findKey(this,r);return!!(u&&this[u]!==void 0&&(!l||WQ(this,this[u],u,l)))}return!1}delete(r,l){const u=this;let g=!1;function h(b){if(b=o6(b),b){const x=An.findKey(u,b);x&&(!l||WQ(u,u[x],x,l))&&(delete u[x],g=!0)}}return An.isArray(r)?r.forEach(h):h(r),g}clear(r){const l=Object.keys(this);let u=l.length,g=!1;for(;u--;){const h=l[u];(!r||WQ(this,this[h],h,r,!0))&&(delete this[h],g=!0)}return g}normalize(r){const l=this,u={};return An.forEach(this,(g,h)=>{const b=An.findKey(u,h);if(b){l[b]=x9(g),delete l[h];return}const x=r?Vpe(h):String(h).trim();x!==h&&delete l[h],l[x]=x9(g),u[x]=!0}),this}concat(...r){return this.constructor.concat(this,...r)}toJSON(r){const l=Object.create(null);return An.forEach(this,(u,g)=>{u!=null&&u!==!1&&(l[g]=r&&An.isArray(u)?u.join(", "):u)}),l}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([r,l])=>r+": "+l).join(`
3
3
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(r){return r instanceof this?r:new this(r)}static concat(r,...l){const u=new this(r);return l.forEach(g=>u.set(g)),u}static accessor(r){const l=(this[Zse]=this[Zse]={accessors:{}}).accessors,u=this.prototype;function g(h){const b=o6(h);l[b]||(Hpe(u,h),l[b]=!0)}return An.isArray(r)?r.forEach(g):g(r),this}};Lm.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);An.reduceDescriptors(Lm.prototype,({value:o},r)=>{let l=r[0].toUpperCase()+r.slice(1);return{get:()=>o,set(u){this[l]=u}}});An.freezeMethods(Lm);function ZQ(o,r){const l=this||L6,u=r||l,g=Lm.from(u.headers);let h=u.data;return An.forEach(o,function(b){h=b.call(l,h,g.normalize(),r?r.status:void 0)}),g.normalize(),h}function Die(o){return!!(o&&o.__CANCEL__)}function _4(o,r,l){kr.call(this,o??"canceled",kr.ERR_CANCELED,r,l),this.name="CanceledError"}An.inherits(_4,kr,{__CANCEL__:!0});function Oie(o,r,l){const u=l.config.validateStatus;!l.status||!u||u(l.status)?o(l):r(new kr("Request failed with status code "+l.status,[kr.ERR_BAD_REQUEST,kr.ERR_BAD_RESPONSE][Math.floor(l.status/100)-4],l.config,l.request,l))}function zpe(o){const r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return r&&r[1]||""}function Upe(o,r){o=o||10;const l=new Array(o),u=new Array(o);let g=0,h=0,b;return r=r!==void 0?r:1e3,function(x){const S=Date.now(),_=u[h];b||(b=S),l[g]=x,u[g]=S;let N=h,D=0;for(;N!==g;)D+=l[N++],N=N%o;if(g=(g+1)%o,g===h&&(h=(h+1)%o),S-b<r)return;const R=_&&S-_;return R?Math.round(D*1e3/R):void 0}}function jpe(o,r){let l=0,u=1e3/r,g,h;const b=(x,S=Date.now())=>{l=S,g=null,h&&(clearTimeout(h),h=null),o.apply(null,x)};return[(...x)=>{const S=Date.now(),_=S-l;_>=u?b(x,S):(g=x,h||(h=setTimeout(()=>{h=null,b(g)},u-_)))},()=>g&&b(g)]}const F9=(o,r,l=3)=>{let u=0;const g=Upe(50,250);return jpe(h=>{const b=h.loaded,x=h.lengthComputable?h.total:void 0,S=b-u,_=g(S),N=b<=x;u=b;const D={loaded:b,total:x,progress:x?b/x:void 0,bytes:S,rate:_||void 0,estimated:_&&x&&N?(x-b)/_:void 0,event:h,lengthComputable:x!=null,[r?"download":"upload"]:!0};o(D)},l)},Gse=(o,r)=>{const l=o!=null;return[u=>r[0]({lengthComputable:l,total:o,loaded:u}),r[1]]},qse=o=>(...r)=>An.asap(()=>o(...r)),Wpe=rf.hasStandardBrowserEnv?((o,r)=>l=>(l=new URL(l,rf.origin),o.protocol===l.protocol&&o.host===l.host&&(r||o.port===l.port)))(new URL(rf.origin),rf.navigator&&/(msie|trident)/i.test(rf.navigator.userAgent)):()=>!0,Zpe=rf.hasStandardBrowserEnv?{write(o,r,l,u,g,h){const b=[o+"="+encodeURIComponent(r)];An.isNumber(l)&&b.push("expires="+new Date(l).toGMTString()),An.isString(u)&&b.push("path="+u),An.isString(g)&&b.push("domain="+g),h===!0&&b.push("secure"),document.cookie=b.join("; ")},read(o){const r=document.cookie.match(new RegExp("(^|;\\s*)("+o+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove(o){this.write(o,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Gpe(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function qpe(o,r){return r?o.replace(/\/?\/$/,"")+"/"+r.replace(/^\/+/,""):o}function $ie(o,r){return o&&!Gpe(r)?qpe(o,r):r}const Yse=o=>o instanceof Lm?{...o}:o;function t_(o,r){r=r||{};const l={};function u(_,N,D,R){return An.isPlainObject(_)&&An.isPlainObject(N)?An.merge.call({caseless:R},_,N):An.isPlainObject(N)?An.merge({},N):An.isArray(N)?N.slice():N}function g(_,N,D,R){if(An.isUndefined(N)){if(!An.isUndefined(_))return u(void 0,_,D,R)}else return u(_,N,D,R)}function h(_,N){if(!An.isUndefined(N))return u(void 0,N)}function b(_,N){if(An.isUndefined(N)){if(!An.isUndefined(_))return u(void 0,_)}else return u(void 0,N)}function x(_,N,D){if(D in r)return u(_,N);if(D in o)return u(void 0,_)}const S={url:h,method:h,data:h,baseURL:b,transformRequest:b,transformResponse:b,paramsSerializer:b,timeout:b,timeoutMessage:b,withCredentials:b,withXSRFToken:b,adapter:b,responseType:b,xsrfCookieName:b,xsrfHeaderName:b,onUploadProgress:b,onDownloadProgress:b,decompress:b,maxContentLength:b,maxBodyLength:b,beforeRedirect:b,transport:b,httpAgent:b,httpsAgent:b,cancelToken:b,socketPath:b,responseEncoding:b,validateStatus:x,headers:(_,N,D)=>g(Yse(_),Yse(N),D,!0)};return An.forEach(Object.keys(Object.assign({},o,r)),function(_){const N=S[_]||g,D=N(o[_],r[_],_);An.isUndefined(D)&&N!==x||(l[_]=D)}),l}const Bie=o=>{const r=t_({},o);let{data:l,withXSRFToken:u,xsrfHeaderName:g,xsrfCookieName:h,headers:b,auth:x}=r;r.headers=b=Lm.from(b),r.url=Tie($ie(r.baseURL,r.url),o.params,o.paramsSerializer),x&&b.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):"")));let S;if(An.isFormData(l)){if(rf.hasStandardBrowserEnv||rf.hasStandardBrowserWebWorkerEnv)b.setContentType(void 0);else if((S=b.getContentType())!==!1){const[_,...N]=S?S.split(";").map(D=>D.trim()).filter(Boolean):[];b.setContentType([_||"multipart/form-data",...N].join("; "))}}if(rf.hasStandardBrowserEnv&&(u&&An.isFunction(u)&&(u=u(r)),u||u!==!1&&Wpe(r.url))){const _=g&&h&&Zpe.read(h);_&&b.set(g,_)}return r},Ype=typeof XMLHttpRequest<"u",Kpe=Ype&&function(o){return new Promise(function(r,l){const u=Bie(o);let g=u.data;const h=Lm.from(u.headers).normalize();let{responseType:b,onUploadProgress:x,onDownloadProgress:S}=u,_,N,D,R,F;function W(){R&&R(),F&&F(),u.cancelToken&&u.cancelToken.unsubscribe(_),u.signal&&u.signal.removeEventListener("abort",_)}let Z=new XMLHttpRequest;Z.open(u.method.toUpperCase(),u.url,!0),Z.timeout=u.timeout;function G(){if(!Z)return;const q=Lm.from("getAllResponseHeaders"in Z&&Z.getAllResponseHeaders()),H={data:!b||b==="text"||b==="json"?Z.responseText:Z.response,status:Z.status,statusText:Z.statusText,headers:q,config:o,request:Z};Oie(function(de){r(de),W()},function(de){l(de),W()},H),Z=null}"onloadend"in Z?Z.onloadend=G:Z.onreadystatechange=function(){!Z||Z.readyState!==4||Z.status===0&&!(Z.responseURL&&Z.responseURL.indexOf("file:")===0)||setTimeout(G)},Z.onabort=function(){Z&&(l(new kr("Request aborted",kr.ECONNABORTED,o,Z)),Z=null)},Z.onerror=function(){l(new kr("Network Error",kr.ERR_NETWORK,o,Z)),Z=null},Z.ontimeout=function(){let q=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded";const H=u.transitional||Aie;u.timeoutErrorMessage&&(q=u.timeoutErrorMessage),l(new kr(q,H.clarifyTimeoutError?kr.ETIMEDOUT:kr.ECONNABORTED,o,Z)),Z=null},g===void 0&&h.setContentType(null),"setRequestHeader"in Z&&An.forEach(h.toJSON(),function(q,H){Z.setRequestHeader(H,q)}),An.isUndefined(u.withCredentials)||(Z.withCredentials=!!u.withCredentials),b&&b!=="json"&&(Z.responseType=u.responseType),S&&([D,F]=F9(S,!0),Z.addEventListener("progress",D)),x&&Z.upload&&([N,R]=F9(x),Z.upload.addEventListener("progress",N),Z.upload.addEventListener("loadend",R)),(u.cancelToken||u.signal)&&(_=q=>{Z&&(l(!q||q.type?new _4(null,o,Z):q),Z.abort(),Z=null)},u.cancelToken&&u.cancelToken.subscribe(_),u.signal&&(u.signal.aborted?_():u.signal.addEventListener("abort",_)));const K=zpe(u.url);if(K&&rf.protocols.indexOf(K)===-1){l(new kr("Unsupported protocol "+K+":",kr.ERR_BAD_REQUEST,o));return}Z.send(g||null)})},Xpe=(o,r)=>{const{length:l}=o=o?o.filter(Boolean):[];if(r||l){let u=new AbortController,g;const h=function(_){if(!g){g=!0,x();const N=_ instanceof Error?_:this.reason;u.abort(N instanceof kr?N:new _4(N instanceof Error?N.message:N))}};let b=r&&setTimeout(()=>{b=null,h(new kr(`timeout ${r} of ms exceeded`,kr.ETIMEDOUT))},r);const x=()=>{o&&(b&&clearTimeout(b),b=null,o.forEach(_=>{_.unsubscribe?_.unsubscribe(h):_.removeEventListener("abort",h)}),o=null)};o.forEach(_=>_.addEventListener("abort",h));const{signal:S}=u;return S.unsubscribe=()=>An.asap(x),S}},Jpe=function*(o,r){let l=o.byteLength;if(l<r){yield o;return}let u=0,g;for(;u<l;)g=u+r,yield o.slice(u,g),u=g},Qpe=async function*(o,r){for await(const l of ehe(o))yield*Jpe(l,r)},ehe=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const r=o.getReader();try{for(;;){const{done:l,value:u}=await r.read();if(l)break;yield u}}finally{await r.cancel()}},Kse=(o,r,l,u)=>{const g=Qpe(o,r);let h=0,b,x=S=>{b||(b=!0,u&&u(S))};return new ReadableStream({async pull(S){try{const{done:_,value:N}=await g.next();if(_){x(),S.close();return}let D=N.byteLength;if(l){let R=h+=D;l(R)}S.enqueue(new Uint8Array(N))}catch(_){throw x(_),_}},cancel(S){return x(S),g.return()}},{highWaterMark:2})},_H=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Mie=_H&&typeof ReadableStream=="function",the=_H&&(typeof TextEncoder=="function"?(o=>r=>o.encode(r))(new TextEncoder):async o=>new Uint8Array(await new Response(o).arrayBuffer())),Rie=(o,...r)=>{try{return!!o(...r)}catch{return!1}},nhe=Mie&&Rie(()=>{let o=!1;const r=new Request(rf.origin,{body:new ReadableStream,method:"POST",get duplex(){return o=!0,"half"}}).headers.has("Content-Type");return o&&!r}),Xse=64*1024,Wee=Mie&&Rie(()=>An.isReadableStream(new Response("").body)),L9={stream:Wee&&(o=>o.body)};_H&&(o=>{["text","arrayBuffer","blob","formData","stream"].forEach(r=>{!L9[r]&&(L9[r]=An.isFunction(o[r])?l=>l[r]():(l,u)=>{throw new kr(`Response type '${r}' is not supported`,kr.ERR_NOT_SUPPORT,u)})})})(new Response);const ohe=async o=>{if(o==null)return 0;if(An.isBlob(o))return o.size;if(An.isSpecCompliantForm(o))return(await new Request(rf.origin,{method:"POST",body:o}).arrayBuffer()).byteLength;if(An.isArrayBufferView(o)||An.isArrayBuffer(o))return o.byteLength;if(An.isURLSearchParams(o)&&(o=o+""),An.isString(o))return(await the(o)).byteLength},she=async(o,r)=>An.toFiniteNumber(o.getContentLength())??ohe(r),rhe=_H&&(async o=>{let{url:r,method:l,data:u,signal:g,cancelToken:h,timeout:b,onDownloadProgress:x,onUploadProgress:S,responseType:_,headers:N,withCredentials:D="same-origin",fetchOptions:R}=Bie(o);_=_?(_+"").toLowerCase():"text";let F=Xpe([g,h&&h.toAbortSignal()],b),W;const Z=F&&F.unsubscribe&&(()=>{F.unsubscribe()});let G;try{if(S&&nhe&&l!=="get"&&l!=="head"&&(G=await she(N,u))!==0){let Je=new Request(r,{method:"POST",body:u,duplex:"half"}),De;if(An.isFormData(u)&&(De=Je.headers.get("content-type"))&&N.setContentType(De),Je.body){const[ne,Me]=Gse(G,F9(qse(S)));u=Kse(Je.body,Xse,ne,Me)}}An.isString(D)||(D=D?"include":"omit");const K="credentials"in Request.prototype;W=new Request(r,{...R,signal:F,method:l.toUpperCase(),headers:N.normalize().toJSON(),body:u,duplex:"half",credentials:K?D:void 0});let q=await fetch(W);const H=Wee&&(_==="stream"||_==="response");if(Wee&&(x||H&&Z)){const Je={};["status","statusText","headers"].forEach(ut=>{Je[ut]=q[ut]});const De=An.toFiniteNumber(q.headers.get("content-length")),[ne,Me]=x&&Gse(De,F9(qse(x),!0))||[];q=new Response(Kse(q.body,Xse,ne,()=>{Me&&Me(),Z&&Z()}),Je)}_=_||"text";let de=await L9[An.findKey(L9,_)||"text"](q,o);return!H&&Z&&Z(),await new Promise((Je,De)=>{Oie(Je,De,{data:de,headers:Lm.from(q.headers),status:q.status,statusText:q.statusText,config:o,request:W})})}catch(K){throw Z&&Z(),K&&K.name==="TypeError"&&/fetch/i.test(K.message)?Object.assign(new kr("Network Error",kr.ERR_NETWORK,o,W),{cause:K.cause||K}):kr.from(K,K&&K.code,o,W)}}),Zee={http:wpe,xhr:Kpe,fetch:rhe};An.forEach(Zee,(o,r)=>{if(o){try{Object.defineProperty(o,"name",{value:r})}catch{}Object.defineProperty(o,"adapterName",{value:r})}});const Jse=o=>`- ${o}`,ahe=o=>An.isFunction(o)||o===null||o===!1,Iie={getAdapter:o=>{o=An.isArray(o)?o:[o];const{length:r}=o;let l,u;const g={};for(let h=0;h<r;h++){l=o[h];let b;if(u=l,!ahe(l)&&(u=Zee[(b=String(l)).toLowerCase()],u===void 0))throw new kr(`Unknown adapter '${b}'`);if(u)break;g[b||"#"+h]=u}if(!u){const h=Object.entries(g).map(([x,S])=>`adapter ${x} `+(S===!1?"is not supported by the environment":"is not available in the build"));let b=r?h.length>1?`since :
4
4
  `+h.map(Jse).join(`
@@ -118,7 +118,7 @@ Required: `+w.join(", "));return Ut[fe].apply(null,He)},log:Ut=>{console.log(Ut,
118
118
  <source src="`+tt.source+'"'+(tt.sourcemime?' type="'+tt.sourcemime+'"':"")+` />
119
119
  `+(tt.altsource?'<source src="'+tt.altsource+'"'+(tt.altsourcemime?' type="'+tt.altsourcemime+'"':"")+` />
120
120
  `:"")+"</video>",Re=(tt,nt)=>{var At;const qt=M.extend({},nt);if(!qt.source&&(M.extend(qt,We((At=qt.embed)!==null&&At!==void 0?At:"",tt.schema)),!qt.source))return"";qt.altsource||(qt.altsource=""),qt.poster||(qt.poster=""),qt.source=tt.convertURL(qt.source,"source"),qt.altsource=tt.convertURL(qt.altsource,"source"),qt.sourcemime=kt(qt.source),qt.altsourcemime=kt(qt.altsource),qt.poster=tt.convertURL(qt.poster,"poster");const fo=le(qt.source);if(fo&&(qt.source=fo.url,qt.type=fo.type,qt.allowfullscreen=fo.allowFullscreen,qt.width=qt.width||String(fo.w),qt.height=qt.height||String(fo.h)),qt.embed)return St(qt.embed,qt,!0,tt.schema);{const wo=ne(tt),Xo=Me(tt),us=ut(tt);return qt.width=qt.width||"300",qt.height=qt.height||"150",M.each(qt,(ms,Jo)=>{qt[Jo]=tt.dom.encode(""+ms)}),qt.type==="iframe"?ie(qt,us):qt.sourcemime==="application/x-shockwave-flash"?te(qt):qt.sourcemime.indexOf("audio")!==-1?ye(qt,wo):Be(qt,Xo)}},dt=tt=>tt.hasAttribute("data-mce-object")||tt.hasAttribute("data-ephox-embed-iri"),Ue=tt=>{tt.on("mousedown",nt=>{const At=tt.dom.getParent(nt.target,".mce-preview-object");At&&tt.dom.getAttrib(At,"data-mce-selected")==="2"&&nt.stopImmediatePropagation()}),tt.on("click keyup touchend",()=>{const nt=tt.selection.getNode();nt&&tt.dom.hasClass(nt,"mce-preview-object")&&tt.dom.getAttrib(nt,"data-mce-selected")&&nt.setAttribute("data-mce-selected","2")}),tt.on("ObjectResized",nt=>{const At=nt.target;if(At.getAttribute("data-mce-object")){let qt=At.getAttribute("data-mce-html");qt&&(qt=unescape(qt),At.setAttribute("data-mce-html",escape(St(qt,{width:String(nt.width),height:String(nt.height)},!1,tt.schema))))}})},bt={},Dt=(tt,nt,At)=>new Promise((qt,fo)=>{const wo=Xo=>(Xo.html&&(bt[tt.source]=Xo),qt({url:tt.source,html:Xo.html?Xo.html:nt(tt)}));bt[tt.source]?wo(bt[tt.source]):At({url:tt.source}).then(wo).catch(fo)}),mn=(tt,nt)=>Promise.resolve({html:nt(tt),url:tt.source}),Et=tt=>nt=>Re(tt,nt),Rt=(tt,nt)=>{const At=ue(tt);return At?Dt(nt,Et(tt),At):mn(nt,Et(tt))},tn=tt=>K(bt,tt),vn=(tt,nt)=>G(nt,tt).bind(At=>G(At,"meta")),$o=(tt,nt,At)=>qt=>{const fo=()=>G(tt,qt),wo=()=>G(nt,qt),Xo=Jo=>G(Jo,"value").bind(Ae=>Ae.length>0?_.some(Ae):_.none()),us=()=>fo().bind(Jo=>h(Jo)?Xo(Jo).orThunk(wo):wo().orThunk(()=>_.from(Jo))),ms=()=>wo().orThunk(()=>fo().bind(Jo=>h(Jo)?Xo(Jo):_.from(Jo)));return{[qt]:(qt===At?us():ms()).getOr("")}},Yn=(tt,nt)=>{const At={};return G(tt,"dimensions").each(qt=>{D(["width","height"],fo=>{G(nt,fo).orThunk(()=>G(qt,fo)).each(wo=>At[fo]=wo)})}),At},Ft=(tt,nt)=>{const At=nt&&nt!=="dimensions"?vn(nt,tt).getOr({}):{},qt=$o(tt,At,nt);return{...qt("source"),...qt("altsource"),...qt("poster"),...qt("embed"),...Yn(tt,At)}},on=tt=>{const nt={...tt,source:{value:G(tt,"source").getOr("")},altsource:{value:G(tt,"altsource").getOr("")},poster:{value:G(tt,"poster").getOr("")}};return D(["width","height"],At=>{G(tt,At).each(qt=>{const fo=nt.dimensions||{};fo[At]=qt,nt.dimensions=fo})}),nt},wn=tt=>nt=>{const At=nt&&nt.msg?"Media embed handler error: "+nt.msg:"Media embed handler threw unknown error.";tt.notificationManager.open({type:"error",text:At})},On=tt=>{const nt=tt.selection.getNode(),At=dt(nt)?tt.serializer.serialize(nt,{selection:!0}):"",qt=We(At,tt.schema),wo=(()=>{if(jo(qt.source,qt.type)){const Xo=tt.dom.getRect(nt);return{width:Xo.w.toString().replace(/px$/,""),height:Xo.h.toString().replace(/px$/,"")}}else return{}})();return{embed:At,...qt,...wo}},po=(tt,nt)=>At=>{if(g(At.url)&&At.url.trim().length>0){const qt=At.html,wo={...We(qt,nt.schema),source:At.url,embed:qt};tt.setData(on(wo))}},_o=(tt,nt)=>{const At=tt.dom.select("*[data-mce-object]");for(let qt=0;qt<nt.length;qt++)for(let fo=At.length-1;fo>=0;fo--)nt[qt]===At[fo]&&At.splice(fo,1);tt.selection.select(At[0])},Ko=(tt,nt)=>{const At=tt.dom.select("*[data-mce-object]");tt.insertContent(nt),_o(tt,At),tt.nodeChanged()},jo=(tt,nt)=>S(nt)&&nt==="ephox-embed-iri"&&S(le(tt)),Ws=(tt,nt)=>((qt,fo)=>qt.width!==fo.width||qt.height!==fo.height)(tt,nt)&&jo(nt.source,tt.type),bn=(tt,nt,At)=>{var qt;nt.embed=Ws(tt,nt)&&ke(At)?Re(At,{...nt,embed:""}):St((qt=nt.embed)!==null&&qt!==void 0?qt:"",nt,!1,At.schema),nt.embed&&(tt.source===nt.source||tn(nt.source))?Ko(At,nt.embed):Rt(At,nt).then(fo=>{Ko(At,fo.html)}).catch(wn(At))},No=tt=>{const nt=On(tt),At=q(nt),qt=on(nt),fo=(lo,Lo)=>{const ds=Ft(Lo.getData(),"source");lo.source!==ds.source&&(po(so,tt)({url:ds.source,html:""}),Rt(tt,ds).then(po(so,tt)).catch(wn(tt)))},wo=lo=>{var Lo;const ds=Ft(lo.getData()),ls=We((Lo=ds.embed)!==null&&Lo!==void 0?Lo:"",tt.schema);lo.setData(on(ls))},Xo=(lo,Lo,ds)=>{const ls=Ft(lo.getData(),Lo),Bs=Ws(ds,ls)&&ke(tt)?{...ls,embed:""}:ls,Xr=Re(tt,Bs);lo.setData(on({...Bs,embed:Xr}))},us=[{name:"source",type:"urlinput",filetype:"media",label:"Source",picker_text:"Browse files"}],ms=ke(tt)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],Jo={title:"General",name:"general",items:R([us,ms])},rt={title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]},Xt=[];Mt(tt)&&Xt.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),be(tt)&&Xt.push({name:"poster",type:"urlinput",filetype:"image",label:"Media poster (Image URL)"});const Rn={title:"Advanced",name:"advanced",items:Xt},dn=[Jo,rt];Xt.length>0&&dn.push(Rn);const go={type:"tabpanel",tabs:dn},so=tt.windowManager.open({title:"Insert/Edit Media",size:"normal",body:go,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:lo=>{const Lo=Ft(lo.getData());bn(At.get(),Lo,tt),lo.close()},onChange:(lo,Lo)=>{switch(Lo.name){case"source":fo(At.get(),lo);break;case"embed":wo(lo);break;case"dimensions":case"altsource":case"poster":Xo(lo,Lo.name,At.get());break}At.set(Ft(lo.getData()))},initialData:qt})},or=tt=>({showDialog:()=>{No(tt)}}),Zr=tt=>{const nt=()=>{No(tt)};tt.addCommand("mceMedia",nt)};var Tr=tinymce.util.Tools.resolve("tinymce.Env");const Ln=tt=>{const nt=tt.name;return nt==="iframe"||nt==="video"||nt==="audio"},Kr=(tt,nt,At,qt=null)=>{const fo=tt.attr(At);return S(fo)?fo:K(nt,At)?null:qt},bs=(tt,nt,At)=>{const qt=nt.name==="img"||tt.name==="video",fo=qt?"300":null,wo=tt.name==="audio"?"30":"150",Xo=qt?wo:null;nt.attr({width:Kr(tt,At,"width",fo),height:Kr(tt,At,"height",Xo)})},Zl=(tt,nt,At,qt)=>{const fo=Ie(tt.schema).parse(qt,{context:nt});for(;fo.firstChild;)At.append(fo.firstChild)},Ss=(tt,nt)=>{const At=nt.name,qt=new Ve("img",1);return ya(tt,nt,qt),bs(nt,qt,{}),qt.attr({style:nt.attr("style"),src:Tr.transparentSrc,"data-mce-object":At,class:"mce-object mce-object-"+At}),qt},ro=(tt,nt)=>{var At;const qt=nt.name,fo=new Ve("span",1);fo.attr({contentEditable:"false",style:nt.attr("style"),"data-mce-object":qt,class:"mce-preview-object mce-object-"+qt}),ya(tt,nt,fo);const wo=tt.dom.parseStyle((At=nt.attr("style"))!==null&&At!==void 0?At:""),Xo=new Ve(qt,1);if(bs(nt,Xo,wo),Xo.attr({src:nt.attr("src"),style:nt.attr("style"),class:nt.attr("class")}),qt==="iframe")Xo.attr({allowfullscreen:nt.attr("allowfullscreen"),frameborder:"0",sandbox:nt.attr("sandbox"),referrerpolicy:nt.attr("referrerpolicy")});else{D(["controls","crossorigin","currentTime","loop","muted","poster","preload"],Ae=>{Xo.attr(Ae,nt.attr(Ae))});const Jo=fo.attr("data-mce-html");S(Jo)&&Zl(tt,qt,Xo,unescape(Jo))}const us=new Ve("span",1);return us.attr("class","mce-shim"),fo.append(Xo),fo.append(us),fo},ya=(tt,nt,At)=>{var qt;const fo=(qt=nt.attributes)!==null&&qt!==void 0?qt:[];let wo=fo.length;for(;wo--;){const Jo=fo[wo].name;let Ae=fo[wo].value;Jo!=="width"&&Jo!=="height"&&Jo!=="style"&&!de(Jo,"data-mce-")&&((Jo==="data"||Jo==="src")&&(Ae=tt.convertURL(Ae,Jo)),At.attr("data-mce-p-"+Jo,Ae))}const Xo=pt({inner:!0},tt.schema),us=new Ve("div",1);D(nt.children(),Jo=>us.append(Jo));const ms=Xo.serialize(us);ms&&(At.attr("data-mce-html",escape(ms)),At.empty())},_t=tt=>{const nt=tt.attr("class");return g(nt)&&/\btiny-pageembed\b/.test(nt)},Tt=tt=>{let nt=tt;for(;nt=nt.parent;)if(nt.attr("data-ephox-embed-iri")||_t(nt))return!0;return!1},Cn=tt=>nt=>{let At=nt.length,qt;for(;At--;)qt=nt[At],qt.parent&&(qt.parent.attr("data-mce-object")||(Ln(qt)&&st(tt)?Tt(qt)||qt.replace(ro(tt,qt)):Tt(qt)||qt.replace(Ss(tt,qt))))},zn=(tt,nt,At)=>{const qt=tt.options.get,fo=qt("xss_sanitization"),wo=Ne(tt);return Ie(tt.schema,{sanitize:fo,validate:wo}).parse(At,{context:nt})},$s=tt=>{tt.on("PreInit",()=>{const{schema:nt,serializer:At,parser:qt}=tt,fo=nt.getBoolAttrs();D("webkitallowfullscreen mozallowfullscreen".split(" "),wo=>{fo[wo]={}}),Z({embed:["wmode"]},(wo,Xo)=>{const us=nt.getElementRule(Xo);us&&D(wo,ms=>{us.attributes[ms]={},us.attributesOrder.push(ms)})}),qt.addNodeFilter("iframe,video,audio,object,embed",Cn(tt)),At.addAttributeFilter("data-mce-object",(wo,Xo)=>{var us;let ms=wo.length;for(;ms--;){const Jo=wo[ms];if(!Jo.parent)continue;const Ae=Jo.attr(Xo),rt=new Ve(Ae,1);if(Ae!=="audio"){const go=Jo.attr("class");go&&go.indexOf("mce-preview-object")!==-1&&Jo.firstChild?rt.attr({width:Jo.firstChild.attr("width"),height:Jo.firstChild.attr("height")}):rt.attr({width:Jo.attr("width"),height:Jo.attr("height")})}rt.attr({style:Jo.attr("style")});const Xt=(us=Jo.attributes)!==null&&us!==void 0?us:[];let Rn=Xt.length;for(;Rn--;){const go=Xt[Rn].name;go.indexOf("data-mce-p-")===0&&rt.attr(go.substr(11),Xt[Rn].value)}const dn=Jo.attr("data-mce-html");if(dn){const go=zn(tt,Ae,unescape(dn));D(go.children(),so=>rt.append(so))}Jo.replace(rt)}})}),tt.on("SetContent",()=>{const nt=tt.dom;D(nt.select("span.mce-preview-object"),At=>{nt.select("span.mce-shim",At).length===0&&nt.add(At,"span",{class:"mce-shim"})})})},Jn=tt=>{tt.on("ResolveName",nt=>{let At;nt.target.nodeType===1&&(At=nt.target.getAttribute("data-mce-object"))&&(nt.name=At)})},wr=tt=>nt=>{const At=()=>{nt.setEnabled(tt.selection.isEditable())};return tt.on("NodeChange",At),At(),()=>{tt.off("NodeChange",At)}},cs=tt=>{const nt=()=>tt.execCommand("mceMedia");tt.ui.registry.addToggleButton("media",{tooltip:"Insert/edit media",icon:"embed",onAction:nt,onSetup:At=>{const qt=tt.selection;At.setActive(dt(qt.getNode()));const fo=qt.selectorChangedWithUnbind("img[data-mce-object],span[data-mce-object],div[data-ephox-embed-iri]",At.setActive).unbind,wo=wr(tt)(At);return()=>{fo(),wo()}}}),tt.ui.registry.addMenuItem("media",{icon:"embed",text:"Media...",onAction:nt,onSetup:wr(tt)})};var bl=()=>{o.add("media",tt=>(De(tt),Zr(tt),cs(tt),Jn(tt),$s(tt),Ue(tt),or(tt)))};bl()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const r=K=>q=>typeof q===K,l=r("boolean"),u=r("number"),g=K=>q=>q.options.get(K),h=K=>{const q=K.options.register;q("nonbreaking_force_tab",{processor:H=>l(H)?{value:H?3:0,valid:!0}:u(H)?{value:H,valid:!0}:{valid:!1,message:"Must be a boolean or number."},default:!1}),q("nonbreaking_wrap",{processor:"boolean",default:!0})},b=g("nonbreaking_force_tab"),x=g("nonbreaking_wrap"),S=(K,q)=>{let H="";for(let de=0;de<q;de++)H+=K;return H},_=K=>K.plugins.visualchars?K.plugins.visualchars.isEnabled():!1,N=(K,q)=>{const H=()=>_(K)?"mce-nbsp-wrap mce-nbsp":"mce-nbsp-wrap",de=()=>`<span class="${H()}" contenteditable="false">${S("&nbsp;",q)}</span>`,De=x(K)||K.plugins.visualchars?de():S("&nbsp;",q);K.undoManager.transact(()=>K.insertContent(De))},D=K=>{K.addCommand("mceNonBreaking",()=>{N(K,1)})};var R=tinymce.util.Tools.resolve("tinymce.util.VK");const F=K=>{const q=b(K);q>0&&K.on("keydown",H=>{if(H.keyCode===R.TAB&&!H.isDefaultPrevented()){if(H.shiftKey)return;H.preventDefault(),H.stopImmediatePropagation(),N(K,q)}})},W=K=>q=>{const H=()=>{q.setEnabled(K.selection.isEditable())};return K.on("NodeChange",H),H(),()=>{K.off("NodeChange",H)}},Z=K=>{const q=()=>K.execCommand("mceNonBreaking");K.ui.registry.addButton("nonbreaking",{icon:"non-breaking",tooltip:"Nonbreaking space",onAction:q,onSetup:W(K)}),K.ui.registry.addMenuItem("nonbreaking",{icon:"non-breaking",text:"Nonbreaking space",onAction:q,onSetup:W(K)})};var G=()=>{o.add("nonbreaking",K=>{h(K),D(K),Z(K),F(K)})};G()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),r=tinymce.util.Tools.resolve("tinymce.Env");const l=W=>Z=>Z.options.get(W),u=W=>{const Z=W.options.register;Z("pagebreak_separator",{processor:"string",default:"<!-- pagebreak -->"}),Z("pagebreak_split_block",{processor:"boolean",default:!1})},g=l("pagebreak_separator"),h=l("pagebreak_split_block"),b="mce-pagebreak",x=W=>{const Z=`<img src="${r.transparentSrc}" class="${b}" data-mce-resize="false" data-mce-placeholder />`;return W?`<p>${Z}</p>`:Z},S=W=>{const Z=g(W),G=()=>h(W),K=new RegExp(Z.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,q=>"\\"+q),"gi");W.on("BeforeSetContent",q=>{q.content=q.content.replace(K,x(G()))}),W.on("PreInit",()=>{W.serializer.addNodeFilter("img",q=>{let H=q.length,de,Je;for(;H--;)if(de=q[H],Je=de.attr("class"),Je&&Je.indexOf(b)!==-1){const De=de.parent;if(De&&W.schema.getBlockElements()[De.name]&&G()){De.type=3,De.value=Z,De.raw=!0,de.remove();continue}de.type=3,de.value=Z,de.raw=!0}})})},_=W=>{W.addCommand("mcePageBreak",()=>{W.insertContent(x(h(W)))})},N=W=>{W.on("ResolveName",Z=>{Z.target.nodeName==="IMG"&&W.dom.hasClass(Z.target,b)&&(Z.name="pagebreak")})},D=W=>Z=>{const G=()=>{Z.setEnabled(W.selection.isEditable())};return W.on("NodeChange",G),G(),()=>{W.off("NodeChange",G)}},R=W=>{const Z=()=>W.execCommand("mcePageBreak");W.ui.registry.addButton("pagebreak",{icon:"page-break",tooltip:"Page break",onAction:Z,onSetup:D(W)}),W.ui.registry.addMenuItem("pagebreak",{text:"Page break",icon:"page-break",onAction:Z,onSetup:D(W)})};var F=()=>{o.add("pagebreak",W=>{u(W),_(W),R(W),S(W),N(W)})};F()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const l=(Ft=>on=>Ft===on)(void 0),u=Ft=>Ft==null,g=Ft=>!u(Ft),h=Ft=>()=>Ft,b=h(!1);class x{constructor(on,wn){this.tag=on,this.value=wn}static some(on){return new x(!0,on)}static none(){return x.singletonNone}fold(on,wn){return this.tag?wn(this.value):on()}isSome(){return this.tag}isNone(){return!this.tag}map(on){return this.tag?x.some(on(this.value)):x.none()}bind(on){return this.tag?on(this.value):x.none()}exists(on){return this.tag&&on(this.value)}forall(on){return!this.tag||on(this.value)}filter(on){return!this.tag||on(this.value)?this:x.none()}getOr(on){return this.tag?this.value:on}or(on){return this.tag?this:on}getOrThunk(on){return this.tag?this.value:on()}orThunk(on){return this.tag?this:on()}getOrDie(on){if(this.tag)return this.value;throw new Error(on??"Called getOrDie on None")}static from(on){return g(on)?x.some(on):x.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(on){this.tag&&on(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}x.singletonNone=new x(!1);const S=(Ft,on,wn)=>{for(let On=0,po=Ft.length;On<po;On++){const _o=Ft[On];if(on(_o,On))return x.some(_o);if(wn(_o,On))break}return x.none()},_=(Ft,on)=>S(Ft,on,b),N=(Ft,on)=>{for(let wn=0;wn<Ft.length;wn++){const On=on(Ft[wn],wn);if(On.isSome())return On}return x.none()},D=(Ft,on,wn=0,On)=>{const po=Ft.indexOf(on,wn);return po!==-1?l(On)?!0:po+on.length<=On:!1},R=Ft=>{let on=!1,wn;return(...On)=>(on||(on=!0,wn=Ft.apply(null,On)),wn)},F=(Ft,on,wn,On)=>{const po=Ft.isiOS()&&/ipad/i.test(wn)===!0,_o=Ft.isiOS()&&!po,Ko=Ft.isiOS()||Ft.isAndroid(),jo=Ko||On("(pointer:coarse)"),Ws=po||!_o&&Ko&&On("(min-device-width:768px)"),bn=_o||Ko&&!Ws,No=on.isSafari()&&Ft.isiOS()&&/safari/i.test(wn)===!1,or=!bn&&!Ws&&!No;return{isiPad:h(po),isiPhone:h(_o),isTablet:h(Ws),isPhone:h(bn),isTouch:h(jo),isAndroid:Ft.isAndroid,isiOS:Ft.isiOS,isWebView:h(No),isDesktop:h(or)}},W=(Ft,on)=>{for(let wn=0;wn<Ft.length;wn++){const On=Ft[wn];if(On.test(on))return On}},Z=(Ft,on)=>{const wn=W(Ft,on);if(!wn)return{major:0,minor:0};const On=po=>Number(on.replace(wn,"$"+po));return q(On(1),On(2))},G=(Ft,on)=>{const wn=String(on).toLowerCase();return Ft.length===0?K():Z(Ft,wn)},K=()=>q(0,0),q=(Ft,on)=>({major:Ft,minor:on}),H={nu:q,detect:G,unknown:K},de=(Ft,on)=>N(on.brands,wn=>{const On=wn.brand.toLowerCase();return _(Ft,po=>{var _o;return On===((_o=po.brand)===null||_o===void 0?void 0:_o.toLowerCase())}).map(po=>({current:po.name,version:H.nu(parseInt(wn.version,10),0)}))}),Je=(Ft,on)=>{const wn=String(on).toLowerCase();return _(Ft,On=>On.search(wn))},De=(Ft,on)=>Je(Ft,on).map(wn=>{const On=H.detect(wn.versionRegexes,on);return{current:wn.name,version:On}}),ne=(Ft,on)=>Je(Ft,on).map(wn=>{const On=H.detect(wn.versionRegexes,on);return{current:wn.name,version:On}}),Me=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ut=Ft=>on=>D(on,Ft),st=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:Ft=>D(Ft,"edge/")&&D(Ft,"chrome")&&D(Ft,"safari")&&D(Ft,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Me],search:Ft=>D(Ft,"chrome")&&!D(Ft,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:Ft=>D(Ft,"msie")||D(Ft,"trident")},{name:"Opera",versionRegexes:[Me,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ut("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ut("firefox")},{name:"Safari",versionRegexes:[Me,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:Ft=>(D(Ft,"safari")||D(Ft,"mobile/"))&&D(Ft,"applewebkit")}],Ne=[{name:"Windows",search:ut("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:Ft=>D(Ft,"iphone")||D(Ft,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ut("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:ut("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ut("linux"),versionRegexes:[]},{name:"Solaris",search:ut("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ut("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:ut("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],ue={browsers:h(st),oses:h(Ne)},Mt="Edge",be="Chromium",ke="IE",M="Opera",je="Firefox",we="Safari",ot=()=>et({current:void 0,version:H.unknown()}),et=Ft=>{const on=Ft.current,wn=Ft.version,On=po=>()=>on===po;return{current:on,version:wn,isEdge:On(Mt),isChromium:On(be),isIE:On(ke),isOpera:On(M),isFirefox:On(je),isSafari:On(we)}},ge={unknown:ot,nu:et,edge:h(Mt),chromium:h(be),ie:h(ke),opera:h(M),firefox:h(je),safari:h(we)},We="Windows",kt="iOS",Ve="Android",pt="Linux",Ie="macOS",vt="Solaris",se="FreeBSD",pn="ChromeOS",wt=()=>St({current:void 0,version:H.unknown()}),St=Ft=>{const on=Ft.current,wn=Ft.version,On=po=>()=>on===po;return{current:on,version:wn,isWindows:On(We),isiOS:On(kt),isAndroid:On(Ve),isMacOS:On(Ie),isLinux:On(pt),isSolaris:On(vt),isFreeBSD:On(se),isChromeOS:On(pn)}},zt={unknown:wt,nu:St,windows:h(We),ios:h(kt),android:h(Ve),linux:h(pt),macos:h(Ie),solaris:h(vt),freebsd:h(se),chromeos:h(pn)},ee={detect:(Ft,on,wn)=>{const On=ue.browsers(),po=ue.oses(),_o=on.bind(Ws=>de(On,Ws)).orThunk(()=>De(On,Ft)).fold(ge.unknown,ge.nu),Ko=ne(po,Ft).fold(zt.unknown,zt.nu),jo=F(Ko,_o,Ft,wn);return{browser:_o,os:Ko,deviceType:jo}}},le=Ft=>window.matchMedia(Ft).matches;let ie=R(()=>ee.detect(window.navigator.userAgent,x.from(window.navigator.userAgentData),le));const te=()=>ie(),ye=()=>te().os.isMacOS(),Be=()=>te().os.isiOS(),Re=()=>{const Ft=ye()||Be();return`<script>(${(wn=>{document.addEventListener("click",On=>{for(let po=On.target;po;po=po.parentNode)if(po.nodeName==="A"){const Ko=po.getAttribute("href");if(Ko&&Ko.startsWith("#")){On.preventDefault();const Ws=document.getElementById(Ko.substring(1));Ws&&Ws.scrollIntoView({behavior:"smooth"});return}(wn?On.metaKey:On.ctrlKey&&!On.altKey)||On.preventDefault()}},!1)}).toString()})(${Ft})<\/script>`};var dt=tinymce.util.Tools.resolve("tinymce.util.Tools");const Ue=Ft=>on=>on.options.get(Ft),bt=Ue("content_style"),Dt=Ue("content_css_cors"),mn=Ue("body_class"),Et=Ue("body_id"),Rt=Ft=>{var on;let wn="";const On=Ft.dom.encode,po=(on=bt(Ft))!==null&&on!==void 0?on:"";wn+=`<base href="${On(Ft.documentBaseURI.getURI())}">`;const _o=Dt(Ft)?' crossorigin="anonymous"':"";dt.each(Ft.contentCSS,or=>{wn+='<link type="text/css" rel="stylesheet" href="'+On(Ft.documentBaseURI.toAbsolute(or))+'"'+_o+">"}),po&&(wn+='<style type="text/css">'+po+"</style>");const Ko=Et(Ft),jo=mn(Ft),Ws=Ft.getBody().dir,bn=Ws?' dir="'+On(Ws)+'"':"";return"<!DOCTYPE html><html><head>"+wn+'</head><body id="'+On(Ko)+'" class="mce-content-body '+On(jo)+'"'+bn+">"+Ft.getContent()+Re()+"</body></html>"},tn=Ft=>{const on=Rt(Ft);Ft.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:on}}).focus("close")},vn=Ft=>{Ft.addCommand("mcePreview",()=>{tn(Ft)})},$o=Ft=>{const on=()=>Ft.execCommand("mcePreview");Ft.ui.registry.addButton("preview",{icon:"preview",tooltip:"Preview",onAction:on,context:"any"}),Ft.ui.registry.addMenuItem("preview",{icon:"preview",text:"Preview",onAction:on,context:"any"})};var Yn=()=>{o.add("preview",Ft=>{vn(Ft),$o(Ft)})};Yn()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const r=(mt,ee,le)=>{var ie;return le(mt,ee.prototype)?!0:((ie=mt.constructor)===null||ie===void 0?void 0:ie.name)===ee.name},l=mt=>{const ee=typeof mt;return mt===null?"null":ee==="object"&&Array.isArray(mt)?"array":ee==="object"&&r(mt,String,(le,ie)=>ie.isPrototypeOf(le))?"string":ee},u=mt=>ee=>l(ee)===mt,g=mt=>ee=>typeof ee===mt,h=u("string"),b=g("boolean"),x=mt=>mt==null,S=mt=>!x(mt),_=g("function"),D=(mt=>()=>mt)(!1);class R{constructor(ee,le){this.tag=ee,this.value=le}static some(ee){return new R(!0,ee)}static none(){return R.singletonNone}fold(ee,le){return this.tag?le(this.value):ee()}isSome(){return this.tag}isNone(){return!this.tag}map(ee){return this.tag?R.some(ee(this.value)):R.none()}bind(ee){return this.tag?ee(this.value):R.none()}exists(ee){return this.tag&&ee(this.value)}forall(ee){return!this.tag||ee(this.value)}filter(ee){return!this.tag||ee(this.value)?this:R.none()}getOr(ee){return this.tag?this.value:ee}or(ee){return this.tag?this:ee}getOrThunk(ee){return this.tag?this.value:ee()}orThunk(ee){return this.tag?this:ee()}getOrDie(ee){if(this.tag)return this.value;throw new Error(ee??"Called getOrDie on None")}static from(ee){return S(ee)?R.some(ee):R.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(ee){this.tag&&ee(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}R.singletonNone=new R(!1);const F=()=>window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295;let W=0;const Z=mt=>{const le=new Date().getTime(),ie=Math.floor(F()*1e9);return W++,mt+"_"+ie+W+String(le)},G=(mt,ee,le)=>{mt.execCommand("mceInsertTable",!1,{rows:le,columns:ee})},K=(mt,ee,le)=>{const ie=mt.editorUpload.blobCache,te=ie.create(Z("mceu"),le,ee);ie.add(te),mt.insertContent(mt.dom.createHTML("img",{src:te.blobUri()}))},q=mt=>new Promise(ee=>{const le=new FileReader;le.onloadend=()=>{ee(le.result.split(",")[1])},le.readAsDataURL(mt)});var H=tinymce.util.Tools.resolve("tinymce.util.Delay");const de=mt=>new Promise(ee=>{let le=!1;const ie=document.createElement("input");ie.type="file",ie.accept="image/*",ie.style.position="fixed",ie.style.left="0",ie.style.top="0",ie.style.opacity="0.001",document.body.appendChild(ie);const te=Re=>{var dt;le||((dt=ie.parentNode)===null||dt===void 0||dt.removeChild(ie),le=!0,ee(Re))},ye=Re=>{te(Array.prototype.slice.call(Re.target.files))};ie.addEventListener("input",ye),ie.addEventListener("change",ye);const Be=Re=>{const dt=()=>{te([])};le||(Re.type==="focusin"?H.setEditorTimeout(mt,dt,1e3):dt()),mt.off("focusin remove",Be)};mt.on("focusin remove",Be),ie.click()}),Je=mt=>{mt.on("PreInit",()=>{mt.queryCommandSupported("QuickbarInsertImage")||mt.addCommand("QuickbarInsertImage",()=>{de(mt).then(ee=>{if(ee.length>0){const le=ee[0];q(le).then(ie=>{K(mt,ie,le)})}})})})},De=mt=>ee=>ee.options.get(mt),ne=mt=>{const ee=mt.options.register,le=Be=>Re=>{const dt=b(Re)||h(Re);return dt?b(Re)?{value:Re?Be:"",valid:dt}:{value:Re.trim(),valid:dt}:{valid:!1,message:"Must be a boolean or string."}},ie="bold italic | quicklink h2 h3 blockquote";ee("quickbars_selection_toolbar",{processor:le(ie),default:ie});const te="quickimage quicktable";ee("quickbars_insert_toolbar",{processor:le(te),default:te});const ye="alignleft aligncenter alignright";ee("quickbars_image_toolbar",{processor:le(ye),default:ye})},Me=De("quickbars_selection_toolbar"),ut=De("quickbars_insert_toolbar"),st=De("quickbars_image_toolbar"),Ne=mt=>{mt.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:()=>mt.execCommand("QuickbarInsertImage")}),mt.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:()=>{G(mt,2,2)}})},ue=(mt,ee)=>{const ie=(ee||document).createElement("div");if(ie.innerHTML=mt,!ie.hasChildNodes()||ie.childNodes.length>1){const te="HTML does not have a single root node";throw console.error(te,mt),new Error(te)}return ke(ie.childNodes[0])},Mt=(mt,ee)=>{const ie=(ee||document).createElement(mt);return ke(ie)},be=(mt,ee)=>{const ie=(ee||document).createTextNode(mt);return ke(ie)},ke=mt=>{if(mt==null)throw new Error("Node cannot be null or undefined");return{dom:mt}},je={fromHtml:ue,fromTag:Mt,fromText:be,fromDom:ke,fromPoint:(mt,ee,le)=>R.from(mt.dom.elementFromPoint(ee,le)).map(ke)},we=1,ot=(mt,ee)=>{const le=mt.dom;if(le.nodeType!==we)return!1;{const ie=le;if(ie.matches!==void 0)return ie.matches(ee);if(ie.msMatchesSelector!==void 0)return ie.msMatchesSelector(ee);if(ie.webkitMatchesSelector!==void 0)return ie.webkitMatchesSelector(ee);if(ie.mozMatchesSelector!==void 0)return ie.mozMatchesSelector(ee);throw new Error("Browser lacks native selectors")}},et=mt=>mt.dom.nodeName.toLowerCase(),ge=(mt,ee)=>{const le=mt.dom;return le&&le.hasAttribute?le.hasAttribute(ee):!1};var We=(mt,ee,le,ie,te)=>mt(le,ie)?R.some(le):_(te)&&te(le)?R.none():ee(le,ie,te);const kt=(mt,ee,le)=>{let ie=mt.dom;const te=_(le)?le:D;for(;ie.parentNode;){ie=ie.parentNode;const ye=je.fromDom(ie);if(ee(ye))return R.some(ye);if(te(ye))break}return R.none()},Ve=(mt,ee,le)=>We((te,ye)=>ye(te),kt,mt,ee,le),pt=(mt,ee,le)=>kt(mt,ie=>ot(ie,ee),le),Ie=(mt,ee,le)=>We((te,ye)=>ot(te,ye),pt,mt,ee,le),vt=mt=>mt.dom.classList!==void 0,se=(mt,ee)=>vt(mt)&&mt.dom.classList.contains(ee),pn=(mt,ee,le)=>Ve(mt,ee,le).isSome(),wt=mt=>{const ee=ut(mt);ee.length>0&&mt.ui.registry.addContextToolbar("quickblock",{predicate:le=>{const ie=je.fromDom(le),te=mt.schema.getTextBlockElements(),ye=Be=>Be.dom===mt.getBody();return!ge(ie,"data-mce-bogus")&&Ie(ie,'table,[data-mce-bogus="all"]',ye).fold(()=>pn(ie,Be=>et(Be)in te&&mt.dom.isEmpty(Be.dom),ye),D)},items:ee,position:"line",scope:"editor"})},St=mt=>{const ee=Be=>mt.dom.isEditable(Be),le=Be=>ee(Be.parentElement),ie=Be=>{const Re=Be.nodeName==="FIGURE"&&/image/i.test(Be.className),dt=Be.nodeName==="IMG"||Re,Ue=se(je.fromDom(Be),"mce-pagebreak");return dt&&le(Be)&&!Ue},te=st(mt);te.length>0&&mt.ui.registry.addContextToolbar("imageselection",{predicate:ie,items:te,position:"node"});const ye=Me(mt);ye.length>0&&mt.ui.registry.addContextToolbar("textselection",{predicate:Be=>!ie(Be)&&!mt.selection.isCollapsed()&&ee(Be),items:ye,position:"selection",scope:"editor"})};var zt=()=>{o.add("quickbars",mt=>{ne(mt),Je(mt),Ne(mt),wt(mt),St(mt)})};zt()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const l=(K=>q=>typeof q===K)("function");var u=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),g=tinymce.util.Tools.resolve("tinymce.util.Tools");const h=K=>q=>q.options.get(K),b=K=>{const q=K.options.register;q("save_enablewhendirty",{processor:"boolean",default:!0}),q("save_onsavecallback",{processor:"function"}),q("save_oncancelcallback",{processor:"function"})},x=h("save_enablewhendirty"),S=h("save_onsavecallback"),_=h("save_oncancelcallback"),N=(K,q)=>{K.notificationManager.open({text:q,type:"error"})},D=K=>{const q=u.DOM.getParent(K.id,"form");if(x(K)&&!K.isDirty())return;K.save();const H=S(K);if(l(H)){H.call(K,K),K.nodeChanged();return}q?(K.setDirty(!1),(!q.onsubmit||q.onsubmit())&&(typeof q.submit=="function"?q.submit():N(K,"Error: Form submit field collision.")),K.nodeChanged()):N(K,"Error: No form element found.")},R=K=>{const q=g.trim(K.startContent),H=_(K);if(l(H)){H.call(K,K);return}K.resetContent(q)},F=K=>{K.addCommand("mceSave",()=>{D(K)}),K.addCommand("mceCancel",()=>{R(K)})},W=K=>q=>{const H=()=>{q.setEnabled(!x(K)||K.isDirty())};return H(),K.on("NodeChange dirty",H),()=>K.off("NodeChange dirty",H)},Z=K=>{K.ui.registry.addButton("save",{icon:"save",tooltip:"Save",enabled:!1,onAction:()=>K.execCommand("mceSave"),onSetup:W(K),shortcut:"Meta+S"}),K.ui.registry.addButton("cancel",{icon:"cancel",tooltip:"Cancel",enabled:!1,onAction:()=>K.execCommand("mceCancel"),onSetup:W(K)}),K.addShortcut("Meta+S","","mceSave")};var G=()=>{o.add("save",K=>{b(K),Z(K),F(K)})};G()})();(function(){const o=(Ae,rt,Xt)=>{var Rn;return Xt(Ae,rt.prototype)?!0:((Rn=Ae.constructor)===null||Rn===void 0?void 0:Rn.name)===rt.name},r=Ae=>{const rt=typeof Ae;return Ae===null?"null":rt==="object"&&Array.isArray(Ae)?"array":rt==="object"&&o(Ae,String,(Xt,Rn)=>Rn.isPrototypeOf(Xt))?"string":rt},l=Ae=>rt=>r(rt)===Ae,u=Ae=>rt=>typeof rt===Ae,g=l("string"),h=l("array"),b=u("boolean"),x=Ae=>Ae==null,S=Ae=>!x(Ae),_=u("number"),N=()=>{},D=Ae=>()=>Ae,R=D(!0);class F{constructor(rt,Xt){this.tag=rt,this.value=Xt}static some(rt){return new F(!0,rt)}static none(){return F.singletonNone}fold(rt,Xt){return this.tag?Xt(this.value):rt()}isSome(){return this.tag}isNone(){return!this.tag}map(rt){return this.tag?F.some(rt(this.value)):F.none()}bind(rt){return this.tag?rt(this.value):F.none()}exists(rt){return this.tag&&rt(this.value)}forall(rt){return!this.tag||rt(this.value)}filter(rt){return!this.tag||rt(this.value)?this:F.none()}getOr(rt){return this.tag?this.value:rt}or(rt){return this.tag?this:rt}getOrThunk(rt){return this.tag?this.value:rt()}orThunk(rt){return this.tag?this:rt()}getOrDie(rt){if(this.tag)return this.value;throw new Error(rt??"Called getOrDie on None")}static from(rt){return S(rt)?F.some(rt):F.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(rt){this.tag&&rt(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}F.singletonNone=new F(!1);const W=Array.prototype.slice,Z=Array.prototype.push,G=(Ae,rt)=>{const Xt=Ae.length,Rn=new Array(Xt);for(let dn=0;dn<Xt;dn++){const go=Ae[dn];Rn[dn]=rt(go,dn)}return Rn},K=(Ae,rt)=>{for(let Xt=0,Rn=Ae.length;Xt<Rn;Xt++){const dn=Ae[Xt];rt(dn,Xt)}},q=(Ae,rt)=>{for(let Xt=Ae.length-1;Xt>=0;Xt--){const Rn=Ae[Xt];rt(Rn,Xt)}},H=(Ae,rt)=>{if(Ae.length===0)return[];{let Xt=rt(Ae[0]);const Rn=[];let dn=[];for(let go=0,so=Ae.length;go<so;go++){const lo=Ae[go],Lo=rt(lo);Lo!==Xt&&(Rn.push(dn),dn=[]),Xt=Lo,dn.push(lo)}return dn.length!==0&&Rn.push(dn),Rn}},de=(Ae,rt,Xt)=>(K(Ae,(Rn,dn)=>{Xt=rt(Xt,Rn,dn)}),Xt),Je=Ae=>{const rt=[];for(let Xt=0,Rn=Ae.length;Xt<Rn;++Xt){if(!h(Ae[Xt]))throw new Error("Arr.flatten item "+Xt+" was not an array, input: "+Ae);Z.apply(rt,Ae[Xt])}return rt},De=(Ae,rt)=>Je(G(Ae,rt)),ne=(Ae,rt)=>{const Xt=W.call(Ae,0);return Xt.sort(rt),Xt},Me=Object.hasOwnProperty,ut=(Ae,rt)=>Me.call(Ae,rt),st=Ae=>{let rt=Ae;return{get:()=>rt,set:dn=>{rt=dn}}},Ne=Ae=>{const rt=st(F.none()),Xt=()=>rt.get().each(Ae);return{clear:()=>{Xt(),rt.set(F.none())},isSet:()=>rt.get().isSome(),get:()=>rt.get(),set:lo=>{Xt(),rt.set(F.some(lo))}}},ue=()=>{const Ae=Ne(N);return{...Ae,on:Xt=>Ae.get().each(Xt)}};var Mt=tinymce.util.Tools.resolve("tinymce.PluginManager");const M=D("[~№|!-*+-\\/:;?@\\[-`{}¡«·»¿;·՚-՟։֊־׀׃׆׳״؉؊،؍؛؞؟٪-٭۔܀-܍߷-߹࠰-࠾࡞।॥॰෴๏๚๛༄-༒༺-༽྅࿐-࿔࿙࿚၊-၏჻፡-፨᐀᙭᙮᚛᚜᛫-᛭᜵᜶។-៖៘-៚᠀-᠊᥄᥅᨞᨟᪠-᪦᪨-᪭᭚-᭠᯼-᯿᰻-᰿᱾᱿᳓‐-‧‰-⁃⁅-⁑⁓-⁞⁽⁾₍₎〈〉❨-❵⟅⟆⟦-⟯⦃-⦘⧘-⧛⧼⧽⳹-⳼⳾⳿⵰⸀-⸮⸰⸱、-〃〈-】〔-〟〰〽゠・꓾꓿꘍-꘏꙳꙾꛲-꛷꡴-꡷꣎꣏꣸-꣺꤮꤯꥟꧁-꧍꧞꧟꩜-꩟꫞꫟꯫﴾﴿︐-︙︰-﹒﹔-﹡﹣﹨﹪﹫!-#%-*,-/:;?@[-]_{}⦅-・]");var je=tinymce.util.Tools.resolve("tinymce.Env"),we=tinymce.util.Tools.resolve("tinymce.util.Tools");const ot=(Ae,rt)=>{const Rn=(rt||document).createElement("div");if(Rn.innerHTML=Ae,!Rn.hasChildNodes()||Rn.childNodes.length>1){const dn="HTML does not have a single root node";throw console.error(dn,Ae),new Error(dn)}return We(Rn.childNodes[0])},et=(Ae,rt)=>{const Rn=(rt||document).createElement(Ae);return We(Rn)},ge=(Ae,rt)=>{const Rn=(rt||document).createTextNode(Ae);return We(Rn)},We=Ae=>{if(Ae==null)throw new Error("Node cannot be null or undefined");return{dom:Ae}},Ve={fromHtml:ot,fromTag:et,fromText:ge,fromDom:We,fromPoint:(Ae,rt,Xt)=>F.from(Ae.dom.elementFromPoint(rt,Xt)).map(We)},pt=9,Ie=11,vt=1,se=3,pn=Ae=>Ae.nodeType!==vt&&Ae.nodeType!==pt&&Ae.nodeType!==Ie||Ae.childElementCount===0,wt=(Ae,rt)=>{const Xt=rt===void 0?document:rt.dom;return pn(Xt)?[]:G(Xt.querySelectorAll(Ae),Ve.fromDom)},St=(Ae,rt,Xt)=>(Ae.compareDocumentPosition(rt)&Xt)!==0,zt=(Ae,rt)=>St(Ae,rt,Node.DOCUMENT_POSITION_PRECEDING),mt=Ae=>Ae.dom.nodeType,le=(Ae=>rt=>mt(rt)===Ae)(se),ie=Ae=>F.from(Ae.dom.parentNode).map(Ve.fromDom),te=Ae=>G(Ae.dom.childNodes,Ve.fromDom),ye=(Ae,rt)=>({element:Ae,offset:rt}),Be=(Ae,rt)=>{const Xt=te(Ae);return Xt.length>0&&rt<Xt.length?ye(Xt[rt],0):ye(Ae,rt)},Re=(Ae,rt)=>{ie(Ae).each(Rn=>{Rn.dom.insertBefore(rt.dom,Ae.dom)})},dt=(Ae,rt)=>{Ae.dom.appendChild(rt.dom)},Ue=(Ae,rt)=>{Re(Ae,rt),dt(rt,Ae)},bt=(Ae,rt,Xt)=>{if(g(Xt)||b(Xt)||_(Xt))Ae.setAttribute(rt,Xt+"");else throw console.error("Invalid call to Attribute.set. Key ",rt,":: Value ",Xt,":: Element ",Ae),new Error("Attribute value was not simple")},Dt=(Ae,rt,Xt)=>{bt(Ae.dom,rt,Xt)},Et=((Ae,rt)=>{const Xt=go=>{if(!Ae(go))throw new Error("Can only get "+rt+" value of a "+rt+" node");return Rn(go).getOr("")},Rn=go=>Ae(go)?F.from(go.dom.nodeValue):F.none();return{get:Xt,getOption:Rn,set:(go,so)=>{if(!Ae(go))throw new Error("Can only set raw "+rt+" value of a "+rt+" node");go.dom.nodeValue=so}}})(le,"text"),Rt=Ae=>Et.get(Ae),tn=(Ae,rt)=>wt(rt,Ae);var vn=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker");const $o=(Ae,rt)=>Ae.isBlock(rt)||ut(Ae.schema.getVoidElements(),rt.nodeName),Yn=(Ae,rt)=>!Ae.isEditable(rt),Ft=(Ae,rt)=>Ae.getContentEditable(rt)==="true"&&rt.parentNode&&!Ae.isEditable(rt.parentNode),on=(Ae,rt)=>!Ae.isBlock(rt)&&ut(Ae.schema.getWhitespaceElements(),rt.nodeName),wn=(Ae,rt)=>$o(Ae,rt)||Yn(Ae,rt)||on(Ae,rt)||Ft(Ae,rt),On=Ae=>Ae.nodeType===3,po=()=>({sOffset:0,fOffset:0,elements:[]}),_o=(Ae,rt)=>Be(Ve.fromDom(Ae),rt),Ko=(Ae,rt,Xt,Rn,dn,go=!0)=>{let so=go?rt(!1):Xt;for(;so;){const lo=Yn(Ae,so);if(lo||on(Ae,so)){if(lo?Rn.cef(so):Rn.boundary(so))break;so=rt(!0);continue}else if($o(Ae,so)){if(Rn.boundary(so))break}else On(so)&&Rn.text(so);if(so===dn)break;so=rt(!1)}},jo=(Ae,rt,Xt,Rn,dn)=>{var go;if(wn(Ae,Xt))return;const so=(go=Ae.getParent(Rn,Ae.isBlock))!==null&&go!==void 0?go:Ae.getRoot(),lo=new vn(Xt,so),Lo=dn?lo.next.bind(lo):lo.prev.bind(lo);Ko(Ae,Lo,Xt,{boundary:R,cef:R,text:ds=>{dn?rt.fOffset+=ds.length:rt.sOffset+=ds.length,rt.elements.push(Ve.fromDom(ds))}})},Ws=(Ae,rt,Xt,Rn,dn,go=!0)=>{const so=new vn(Xt,rt),lo=[];let Lo=po();jo(Ae,Lo,Xt,rt,!1);const ds=()=>(Lo.elements.length>0&&(lo.push(Lo),Lo=po()),!1);return Ko(Ae,so.next.bind(so),Xt,{boundary:ds,cef:ls=>(ds(),dn&&lo.push(...dn.cef(ls)),!1),text:ls=>{Lo.elements.push(Ve.fromDom(ls)),dn&&dn.text(ls,Lo)}},Rn,go),Rn&&jo(Ae,Lo,Rn,rt,!0),ds(),lo},bn=(Ae,rt)=>{const Xt=_o(rt.startContainer,rt.startOffset),Rn=Xt.element.dom,dn=_o(rt.endContainer,rt.endOffset),go=dn.element.dom;return Ws(Ae,rt.commonAncestorContainer,Rn,go,{text:(so,lo)=>{so===go?lo.fOffset+=so.length-dn.offset:so===Rn&&(lo.sOffset+=Xt.offset)},cef:so=>{const lo=De(tn(Ve.fromDom(so),"*[contenteditable=true]"),Lo=>{const ds=Lo.dom;return Ws(Ae,ds,ds)});return ne(lo,(Lo,ds)=>zt(Lo.elements[0].dom,ds.elements[0].dom)?1:-1)}},!1)},No=(Ae,rt)=>rt.collapsed?[]:bn(Ae,rt),or=(Ae,rt)=>{const Xt=Ae.createRng();return Xt.selectNode(rt),No(Ae,Xt)},Zr=(Ae,rt)=>De(rt,Xt=>or(Ae,Xt)),Tr=(Ae,rt,Xt=0,Rn=Ae.length)=>{const dn=rt.regex;dn.lastIndex=Xt;const go=[];let so;for(;so=dn.exec(Ae);){const lo=so[rt.matchIndex],Lo=so.index+so[0].indexOf(lo),ds=Lo+lo.length;if(ds>Rn)break;go.push({start:Lo,finish:ds}),dn.lastIndex=ds}return go},Ln=(Ae,rt)=>{const Xt=de(Ae,(Rn,dn)=>{const go=Rt(dn),so=Rn.last,lo=so+go.length,Lo=De(rt,(ds,ls)=>ds.start<lo&&ds.finish>so?[{element:dn,start:Math.max(so,ds.start)-so,finish:Math.min(lo,ds.finish)-so,matchId:ls}]:[]);return{results:Rn.results.concat(Lo),last:lo}},{results:[],last:0}).results;return H(Xt,Rn=>Rn.matchId)},Kr=(Ae,rt)=>De(rt,Xt=>{const Rn=Xt.elements,dn=G(Rn,Rt).join(""),go=Tr(dn,Ae,Xt.sOffset,dn.length-Xt.fOffset);return Ln(Rn,go)}),bs=(Ae,rt)=>{q(Ae,(Xt,Rn)=>{q(Xt,dn=>{const go=Ve.fromDom(rt.cloneNode(!1));Dt(go,"data-mce-index",Rn);const so=dn.element.dom;if(so.length===dn.finish&&dn.start===0)Ue(dn.element,go);else{so.length!==dn.finish&&so.splitText(dn.finish);const lo=so.splitText(dn.start);Ue(Ve.fromDom(lo),go)}})})},Zl=(Ae,rt,Xt,Rn)=>{const dn=or(Ae,Xt),go=Kr(rt,dn);return bs(go,Rn),go.length},Ss=(Ae,rt,Xt,Rn)=>{const dn=Xt.getBookmark(),go=Ae.select("td[data-mce-selected],th[data-mce-selected]"),so=go.length>0?Zr(Ae,go):No(Ae,Xt.getRng()),lo=Kr(rt,so);return bs(lo,Rn),Xt.moveToBookmark(dn),lo.length},ro=Ae=>Ae.getAttribute("data-mce-index"),ya=(Ae,rt,Xt,Rn)=>{const dn=Ae.dom.create("span",{"data-mce-bogus":1});dn.className="mce-match-marker";const go=Ae.getBody();return nt(Ae,rt,!1),Rn?Ss(Ae.dom,Xt,Ae.selection,dn):Zl(Ae.dom,Xt,go,dn)},_t=Ae=>{var rt;const Xt=Ae.parentNode;Ae.firstChild&&Xt.insertBefore(Ae.firstChild,Ae),(rt=Ae.parentNode)===null||rt===void 0||rt.removeChild(Ae)},Tt=(Ae,rt)=>{const Xt=[],Rn=we.toArray(Ae.getBody().getElementsByTagName("span"));if(Rn.length)for(let dn=0;dn<Rn.length;dn++){const go=ro(Rn[dn]);go===null||!go.length||go===rt.toString()&&Xt.push(Rn[dn])}return Xt},Cn=(Ae,rt,Xt)=>{const Rn=rt.get();let dn=Rn.index;const go=Ae.dom;Xt?dn+1===Rn.count?dn=0:dn++:dn-1===-1?dn=Rn.count-1:dn--,go.removeClass(Tt(Ae,Rn.index),"mce-match-marker-selected");const so=Tt(Ae,dn);return so.length?(go.addClass(Tt(Ae,dn),"mce-match-marker-selected"),Ae.selection.scrollIntoView(so[0]),dn):-1},zn=(Ae,rt)=>{const Xt=rt.parentNode;Ae.remove(rt),Xt&&Ae.isEmpty(Xt)&&Ae.remove(Xt)},$s=(Ae,rt)=>{const Rn="("+Ae.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&").replace(/\s/g,"[^\\S\\r\\n\\uFEFF]")+")";return rt?`(?:^|\\s|${M()})`+Rn+`(?=$|\\s|${M()})`:Rn},Jn=(Ae,rt,Xt,Rn,dn,go)=>{const so=Ae.selection,lo=$s(Xt,dn),Lo=so.isForward(),ds={regex:new RegExp(lo,Rn?"g":"gi"),matchIndex:1},ls=ya(Ae,rt,ds,go);if(je.browser.isSafari()&&so.setRng(so.getRng(),Lo),ls){const Bs=Cn(Ae,rt,!0);rt.set({index:Bs,count:ls,text:Xt,matchCase:Rn,wholeWord:dn,inSelection:go})}return ls},wr=(Ae,rt)=>{const Xt=Cn(Ae,rt,!0);rt.set({...rt.get(),index:Xt})},cs=(Ae,rt)=>{const Xt=Cn(Ae,rt,!1);rt.set({...rt.get(),index:Xt})},bl=Ae=>{const rt=ro(Ae);return rt!==null&&rt.length>0},tt=(Ae,rt,Xt,Rn,dn)=>{const go=rt.get(),so=go.index;let lo,Lo=so;Rn=Rn!==!1;const ds=Ae.getBody(),ls=we.grep(we.toArray(ds.getElementsByTagName("span")),bl);for(let Bs=0;Bs<ls.length;Bs++){const Xr=ro(ls[Bs]);let Ar=lo=parseInt(Xr,10);if(dn||Ar===go.index){for(Xt.length?(ls[Bs].innerText=Xt,_t(ls[Bs])):zn(Ae.dom,ls[Bs]);ls[++Bs];)if(Ar=parseInt(ro(ls[Bs]),10),Ar===lo)zn(Ae.dom,ls[Bs]);else{Bs--;break}Rn&&Lo--}else lo>so&&ls[Bs].setAttribute("data-mce-index",String(lo-1))}return rt.set({...go,count:dn?0:go.count-1,index:Lo}),Rn?wr(Ae,rt):cs(Ae,rt),!dn&&rt.get().count>0},nt=(Ae,rt,Xt)=>{let Rn,dn;const go=rt.get(),so=we.toArray(Ae.getBody().getElementsByTagName("span"));for(let lo=0;lo<so.length;lo++){const Lo=ro(so[lo]);Lo!==null&&Lo.length&&(Lo===go.index.toString()&&(Rn||(Rn=so[lo].firstChild),dn=so[lo].firstChild),_t(so[lo]))}if(rt.set({...go,index:-1,count:0,text:""}),Rn&&dn){const lo=Ae.dom.createRng();return lo.setStart(Rn,0),lo.setEnd(dn,dn.data.length),Xt!==!1&&Ae.selection.setRng(lo),lo}else return},At=(Ae,rt)=>rt.get().count>1,qt=(Ae,rt)=>rt.get().count>1,fo=(Ae,rt)=>({done:lo=>nt(Ae,rt,lo),find:(lo,Lo,ds,ls=!1)=>Jn(Ae,rt,lo,Lo,ds,ls),next:()=>wr(Ae,rt),prev:()=>cs(Ae,rt),replace:(lo,Lo,ds)=>tt(Ae,rt,lo,Lo,ds)}),wo=(Ae,rt)=>{const Xt=ue();Ae.undoManager.add();const Rn=we.trim(Ae.selection.getContent({format:"text"})),dn=as=>{as.setEnabled("next",At(Ae,rt)),as.setEnabled("prev",qt(Ae,rt))},go=as=>{const Hs=as.getData(),Ps=rt.get();rt.set({...Ps,matchCase:Hs.matchcase,wholeWord:Hs.wholewords,inSelection:Hs.inselection})},so=(as,Hs)=>{K(["replace","replaceall","prev","next"],Ni=>as.setEnabled(Ni,!Hs))},lo=(as,Hs)=>{Hs.redial(Cr(as,Hs.getData()))},Lo=(as,Hs)=>{je.browser.isSafari()&&je.deviceType.isTouch()&&(Hs==="find"||Hs==="replace"||Hs==="replaceall")&&as.focus(Hs)},ds=as=>{nt(Ae,rt,!1),so(as,!0),dn(as)},ls=as=>{const Hs=as.getData(),Ps=rt.get();if(!Hs.findtext.length){ds(as);return}if(Ps.text===Hs.findtext&&Ps.matchCase===Hs.matchcase&&Ps.wholeWord===Hs.wholewords)wr(Ae,rt);else{const Jr=Jn(Ae,rt,Hs.findtext,Hs.matchcase,Hs.wholewords,Hs.inselection);Jr<=0&&lo(!0,as),so(as,Jr===0)}dn(as)},Bs=rt.get(),Xr={findtext:Rn,replacetext:"",wholewords:Bs.wholeWord,matchcase:Bs.matchCase,inselection:Bs.inSelection},Ar=as=>{const Hs=[{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 as&&Hs.push({type:"alertbanner",level:"error",text:"Could not find the specified string.",icon:"warning"}),Hs},Cr=(as,Hs)=>({title:"Find and Replace",size:"normal",body:{type:"panel",items:Ar(as)},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:Hs,onChange:(Ps,Jr)=>{as&&lo(!1,Ps),Jr.name==="findtext"&&rt.get().count>0&&ds(Ps)},onAction:(Ps,Jr)=>{const Ni=Ps.getData();switch(Jr.name){case"find":ls(Ps);break;case"replace":tt(Ae,rt,Ni.replacetext)?dn(Ps):ds(Ps);break;case"replaceall":tt(Ae,rt,Ni.replacetext,!0,!0),ds(Ps);break;case"prev":cs(Ae,rt),dn(Ps);break;case"next":wr(Ae,rt),dn(Ps);break;case"matchcase":case"wholewords":case"inselection":lo(!1,Ps),go(Ps),ds(Ps);break}Lo(Ps,Jr.name)},onSubmit:Ps=>{ls(Ps),Lo(Ps,"find")},onClose:()=>{Ae.focus(),nt(Ae,rt),Ae.undoManager.add()}});Xt.set(Ae.windowManager.open(Cr(!1,Xr),{inline:"toolbar"}))},Xo=(Ae,rt)=>{Ae.addCommand("SearchReplace",()=>{wo(Ae,rt)})},us=(Ae,rt)=>()=>{wo(Ae,rt)},ms=(Ae,rt)=>{Ae.ui.registry.addMenuItem("searchreplace",{text:"Find and replace...",shortcut:"Meta+F",onAction:us(Ae,rt),icon:"search"}),Ae.ui.registry.addButton("searchreplace",{tooltip:"Find and replace",onAction:us(Ae,rt),icon:"search",shortcut:"Meta+F"}),Ae.shortcuts.add("Meta+F","",us(Ae,rt))};var Jo=()=>{Mt.add("searchreplace",Ae=>{const rt=st({index:-1,count:0,text:"",matchCase:!1,wholeWord:!1,inSelection:!1});return Xo(Ae,rt),ms(Ae,rt),fo(Ae,rt)})};Jo()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const r=(P,j,pe)=>{var Fe;return pe(P,j.prototype)?!0:((Fe=P.constructor)===null||Fe===void 0?void 0:Fe.name)===j.name},l=P=>{const j=typeof P;return P===null?"null":j==="object"&&Array.isArray(P)?"array":j==="object"&&r(P,String,(pe,Fe)=>Fe.isPrototypeOf(pe))?"string":j},u=P=>j=>l(j)===P,g=P=>j=>typeof j===P,h=P=>j=>P===j,b=u("string"),x=u("array"),S=g("boolean"),_=h(void 0),N=P=>P==null,D=P=>!N(P),R=g("function"),F=g("number"),W=()=>{},Z=(P,j)=>pe=>P(j(pe)),G=P=>()=>P,K=P=>P,q=(P,j)=>P===j;function H(P,...j){return(...pe)=>{const Fe=j.concat(pe);return P.apply(null,Fe)}}const de=P=>{P()},Je=G(!1),De=G(!0);class ne{constructor(j,pe){this.tag=j,this.value=pe}static some(j){return new ne(!0,j)}static none(){return ne.singletonNone}fold(j,pe){return this.tag?pe(this.value):j()}isSome(){return this.tag}isNone(){return!this.tag}map(j){return this.tag?ne.some(j(this.value)):ne.none()}bind(j){return this.tag?j(this.value):ne.none()}exists(j){return this.tag&&j(this.value)}forall(j){return!this.tag||j(this.value)}filter(j){return!this.tag||j(this.value)?this:ne.none()}getOr(j){return this.tag?this.value:j}or(j){return this.tag?this:j}getOrThunk(j){return this.tag?this.value:j()}orThunk(j){return this.tag?this:j()}getOrDie(j){if(this.tag)return this.value;throw new Error(j??"Called getOrDie on None")}static from(j){return D(j)?ne.some(j):ne.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(j){this.tag&&j(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}ne.singletonNone=new ne(!1);const Me=Array.prototype.indexOf,ut=Array.prototype.push,st=(P,j)=>Me.call(P,j),Ne=(P,j)=>st(P,j)>-1,ue=(P,j)=>{for(let pe=0,Fe=P.length;pe<Fe;pe++){const ft=P[pe];if(j(ft,pe))return!0}return!1},Mt=(P,j)=>{const pe=[];for(let Fe=0;Fe<P;Fe++)pe.push(j(Fe));return pe},be=(P,j)=>{const pe=P.length,Fe=new Array(pe);for(let ft=0;ft<pe;ft++){const rn=P[ft];Fe[ft]=j(rn,ft)}return Fe},ke=(P,j)=>{for(let pe=0,Fe=P.length;pe<Fe;pe++){const ft=P[pe];j(ft,pe)}},M=(P,j)=>{for(let pe=P.length-1;pe>=0;pe--){const Fe=P[pe];j(Fe,pe)}},je=(P,j)=>{const pe=[],Fe=[];for(let ft=0,rn=P.length;ft<rn;ft++){const Vn=P[ft];(j(Vn,ft)?pe:Fe).push(Vn)}return{pass:pe,fail:Fe}},we=(P,j)=>{const pe=[];for(let Fe=0,ft=P.length;Fe<ft;Fe++){const rn=P[Fe];j(rn,Fe)&&pe.push(rn)}return pe},ot=(P,j,pe)=>(M(P,(Fe,ft)=>{pe=j(pe,Fe,ft)}),pe),et=(P,j,pe)=>(ke(P,(Fe,ft)=>{pe=j(pe,Fe,ft)}),pe),ge=(P,j,pe)=>{for(let Fe=0,ft=P.length;Fe<ft;Fe++){const rn=P[Fe];if(j(rn,Fe))return ne.some(rn);if(pe(rn,Fe))break}return ne.none()},We=(P,j)=>ge(P,j,Je),kt=P=>{const j=[];for(let pe=0,Fe=P.length;pe<Fe;++pe){if(!x(P[pe]))throw new Error("Arr.flatten item "+pe+" was not an array, input: "+P);ut.apply(j,P[pe])}return j},Ve=(P,j)=>kt(be(P,j)),pt=(P,j)=>{for(let pe=0,Fe=P.length;pe<Fe;++pe){const ft=P[pe];if(j(ft,pe)!==!0)return!1}return!0},Ie=(P,j)=>{const pe={};for(let Fe=0,ft=P.length;Fe<ft;Fe++){const rn=P[Fe];pe[String(rn)]=j(rn,Fe)}return pe},vt=(P,j)=>j>=0&&j<P.length?ne.some(P[j]):ne.none(),se=P=>vt(P,0),pn=P=>vt(P,P.length-1),wt=(P,j)=>{for(let pe=0;pe<P.length;pe++){const Fe=j(P[pe],pe);if(Fe.isSome())return Fe}return ne.none()},St=Object.keys,zt=Object.hasOwnProperty,mt=(P,j)=>{const pe=St(P);for(let Fe=0,ft=pe.length;Fe<ft;Fe++){const rn=pe[Fe],Vn=P[rn];j(Vn,rn)}},ee=P=>(j,pe)=>{P[pe]=j},le=(P,j,pe,Fe)=>{mt(P,(ft,rn)=>{(j(ft,rn)?pe:Fe)(ft,rn)})},ie=(P,j)=>{const pe={};return le(P,j,ee(pe),W),pe},te=(P,j)=>{const pe=[];return mt(P,(Fe,ft)=>{pe.push(j(Fe,ft))}),pe},ye=P=>te(P,K),Be=P=>St(P).length,Re=(P,j)=>dt(P,j)?ne.from(P[j]):ne.none(),dt=(P,j)=>zt.call(P,j),Ue=(P,j)=>dt(P,j)&&P[j]!==void 0&&P[j]!==null,bt=P=>{for(const j in P)if(zt.call(P,j))return!1;return!0},Dt=P=>{let j=P;return{get:()=>j,set:ft=>{j=ft}}},mn=(P,j,pe=q)=>P.exists(Fe=>pe(Fe,j)),Et=P=>{const j=[],pe=Fe=>{j.push(Fe)};for(let Fe=0;Fe<P.length;Fe++)P[Fe].each(pe);return j},Rt=(P,j,pe)=>P.isSome()&&j.isSome()?ne.some(pe(P.getOrDie(),j.getOrDie())):ne.none(),tn=P=>P.bind(K),vn=(P,j)=>P?ne.some(j):ne.none(),$o=P=>{const j=Dt(ne.none()),pe=()=>j.get().each(P);return{clear:()=>{pe(),j.set(ne.none())},isSet:()=>j.get().isSome(),get:()=>j.get(),set:io=>{pe(),j.set(ne.some(io))}}},Yn=()=>$o(P=>P.unbind()),Ft=(P,j)=>P.substring(j),on=(P,j,pe)=>j===""||P.length>=j.length&&P.substr(pe,pe+j.length)===j,wn=(P,j)=>On(P,j)?Ft(P,j.length):P,On=(P,j)=>on(P,j,0),_o=(P=>j=>j.replace(P,""))(/^\s+|\s+$/g),Ko=P=>P.length>0,jo=P=>!Ko(P),Ws=(P,j=10)=>{const pe=parseInt(P,j);return isNaN(pe)?ne.none():ne.some(pe)},bn=P=>{const j=parseFloat(P);return isNaN(j)?ne.none():ne.some(j)},No=P=>{let j=!1,pe;return(...Fe)=>(j||(j=!0,pe=P.apply(null,Fe)),pe)},or=(P,j)=>{const Fe=(j||document).createElement("div");if(Fe.innerHTML=P,!Fe.hasChildNodes()||Fe.childNodes.length>1){const ft="HTML does not have a single root node";throw console.error(ft,P),new Error(ft)}return Ln(Fe.childNodes[0])},Zr=(P,j)=>{const Fe=(j||document).createElement(P);return Ln(Fe)},Tr=(P,j)=>{const Fe=(j||document).createTextNode(P);return Ln(Fe)},Ln=P=>{if(P==null)throw new Error("Node cannot be null or undefined");return{dom:P}},bs={fromHtml:or,fromTag:Zr,fromText:Tr,fromDom:Ln,fromPoint:(P,j,pe)=>ne.from(P.dom.elementFromPoint(j,pe)).map(Ln)},Zl=8,Ss=9,ro=11,ya=1,_t=3,Tt=(P,j)=>{const pe=P.dom;if(pe.nodeType!==ya)return!1;{const Fe=pe;if(Fe.matches!==void 0)return Fe.matches(j);if(Fe.msMatchesSelector!==void 0)return Fe.msMatchesSelector(j);if(Fe.webkitMatchesSelector!==void 0)return Fe.webkitMatchesSelector(j);if(Fe.mozMatchesSelector!==void 0)return Fe.mozMatchesSelector(j);throw new Error("Browser lacks native selectors")}},Cn=P=>P.nodeType!==ya&&P.nodeType!==Ss&&P.nodeType!==ro||P.childElementCount===0,zn=(P,j)=>{const pe=j===void 0?document:j.dom;return Cn(pe)?[]:be(pe.querySelectorAll(P),bs.fromDom)},$s=(P,j)=>{const pe=j===void 0?document:j.dom;return Cn(pe)?ne.none():ne.from(pe.querySelector(P)).map(bs.fromDom)},Jn=(P,j)=>P.dom===j.dom,wr=Tt,cs=P=>P.dom.nodeName.toLowerCase(),bl=P=>P.dom.nodeType,tt=P=>j=>bl(j)===P,nt=P=>bl(P)===Zl||cs(P)==="#comment",At=tt(ya),qt=tt(_t),fo=tt(Ss),wo=tt(ro),Xo=P=>j=>At(j)&&cs(j)===P,us=P=>bs.fromDom(P.dom.ownerDocument),ms=P=>fo(P)?P:us(P),Jo=P=>ne.from(P.dom.parentNode).map(bs.fromDom),Ae=(P,j)=>{const pe=R(j)?j:Je;let Fe=P.dom;const ft=[];for(;Fe.parentNode!==null&&Fe.parentNode!==void 0;){const rn=Fe.parentNode,Vn=bs.fromDom(rn);if(ft.push(Vn),pe(Vn)===!0)break;Fe=rn}return ft},rt=P=>ne.from(P.dom.previousSibling).map(bs.fromDom),Xt=P=>ne.from(P.dom.nextSibling).map(bs.fromDom),Rn=P=>be(P.dom.childNodes,bs.fromDom),dn=(P,j)=>{const pe=P.dom.childNodes;return ne.from(pe[j]).map(bs.fromDom)},go=P=>dn(P,0),so=P=>wo(P)&&D(P.dom.host),lo=P=>bs.fromDom(P.dom.getRootNode()),Lo=P=>{const j=lo(P);return so(j)?ne.some(j):ne.none()},ds=P=>bs.fromDom(P.dom.host),ls=(P,j)=>{Jo(P).each(Fe=>{Fe.dom.insertBefore(j.dom,P.dom)})},Bs=(P,j)=>{Xt(P).fold(()=>{Jo(P).each(ft=>{Ar(ft,j)})},Fe=>{ls(Fe,j)})},Xr=(P,j)=>{go(P).fold(()=>{Ar(P,j)},Fe=>{P.dom.insertBefore(j.dom,Fe.dom)})},Ar=(P,j)=>{P.dom.appendChild(j.dom)},Cr=(P,j)=>{ls(P,j),Ar(j,P)},as=(P,j)=>{ke(j,(pe,Fe)=>{const ft=Fe===0?P:j[Fe-1];Bs(ft,pe)})},Hs=(P,j)=>{ke(j,pe=>{Ar(P,pe)})},Ps=(P,j,pe)=>{if(b(pe)||S(pe)||F(pe))P.setAttribute(j,pe+"");else throw console.error("Invalid call to Attribute.set. Key ",j,":: Value ",pe,":: Element ",P),new Error("Attribute value was not simple")},Jr=(P,j,pe)=>{Ps(P.dom,j,pe)},Ni=(P,j)=>{const pe=P.dom;mt(j,(Fe,ft)=>{Ps(pe,ft,Fe)})},nl=(P,j)=>{const pe=P.dom.getAttribute(j);return pe===null?void 0:pe},Vo=(P,j)=>ne.from(nl(P,j)),Qr=(P,j)=>{P.dom.removeAttribute(j)},wa=P=>et(P.dom.attributes,(j,pe)=>(j[pe.name]=pe.value,j),{}),xr=P=>{const j=P.dom;j.parentNode!==null&&j.parentNode.removeChild(j)},La=P=>{const j=Rn(P);j.length>0&&as(P,j),xr(P)},Wi=P=>be(P,bs.fromDom),sr=P=>P.style!==void 0&&R(P.style.getPropertyValue),Ca=P=>{const j=qt(P)?P.dom.parentNode:P.dom;if(j==null||j.ownerDocument===null)return!1;const pe=j.ownerDocument;return Lo(bs.fromDom(j)).fold(()=>pe.body.contains(j),Z(Ca,ds))},Ys=(P,j,pe)=>{if(!b(pe))throw console.error("Invalid call to CSS.set. Property ",j,":: Value ",pe,":: Element ",P),new Error("CSS value must be a string: "+pe);sr(P)&&P.style.setProperty(j,pe)},Va=(P,j)=>{sr(P)&&P.style.removeProperty(j)},In=(P,j,pe)=>{const Fe=P.dom;Ys(Fe,j,pe)},Al=(P,j)=>{const pe=P.dom,ft=window.getComputedStyle(pe).getPropertyValue(j);return ft===""&&!Ca(P)?Gl(pe,j):ft},Gl=(P,j)=>sr(P)?P.style.getPropertyValue(j):"",yl=(P,j)=>{const pe=P.dom,Fe=Gl(pe,j);return ne.from(Fe).filter(ft=>ft.length>0)},bc=(P,j)=>{const pe=P.dom;Va(pe,j),mn(Vo(P,"style").map(_o),"")&&Qr(P,"style")},$a=(P,j)=>bn(P).getOr(j),ol=(P,j,pe)=>$a(Al(P,j),pe),fa=(P,j,pe,Fe)=>{const ft=ol(P,`padding-${pe}`,0),rn=ol(P,`padding-${Fe}`,0),Vn=ol(P,`border-${pe}-width`,0),io=ol(P,`border-${Fe}-width`,0);return j-ft-rn-Vn-io},Zi=(P,j)=>{const pe=P.dom,Fe=pe.getBoundingClientRect().width||pe.offsetWidth;return j==="border-box"?Fe:fa(P,Fe,"left","right")},qi=P=>Zi(P,"content-box"),yc=((P,j)=>{const pe=rn=>{if(!P(rn))throw new Error("Can only get "+j+" value of a "+j+" node");return Fe(rn).getOr("")},Fe=rn=>P(rn)?ne.from(rn.dom.nodeValue):ne.none();return{get:pe,getOption:Fe,set:(rn,Vn)=>{if(!P(rn))throw new Error("Can only set raw "+j+" value of a "+j+" node");rn.dom.nodeValue=Vn}}})(qt,"text"),Di=P=>yc.get(P),Hu=(P,j)=>yc.set(P,j);var _n=(P,j,pe,Fe,ft)=>P(pe,Fe)?ne.some(pe):R(ft)&&ft(pe)?ne.none():j(pe,Fe,ft);const sc=(P,j,pe)=>{let Fe=P.dom;const ft=R(pe)?pe:Je;for(;Fe.parentNode;){Fe=Fe.parentNode;const rn=bs.fromDom(Fe);if(j(rn))return ne.some(rn);if(ft(rn))break}return ne.none()},wc=(P,j,pe)=>_n((ft,rn)=>rn(ft),sc,P,j,pe),Ce=(P,j)=>{const pe=ft=>j(bs.fromDom(ft));return We(P.dom.childNodes,pe).map(bs.fromDom)},Ge=(P,j,pe)=>sc(P,Fe=>Tt(Fe,j),pe),Ct=(P,j)=>Ce(P,pe=>Tt(pe,j)),Jt=(P,j)=>$s(j,P),me=(P,j,pe)=>_n((ft,rn)=>Tt(ft,rn),Ge,P,j,pe),Oe=P=>me(P,"[contenteditable]"),yt=(P,j=!1)=>Ca(P)?P.dom.isContentEditable:Oe(P).fold(G(j),pe=>Kt(pe)==="true"),Kt=P=>P.dom.contentEditable,Qn=(P,j)=>we(Rn(P),j),ae=(P,j)=>{let pe=[];return ke(Rn(P),Fe=>{j(Fe)&&(pe=pe.concat([Fe])),pe=pe.concat(ae(Fe,j))}),pe},xe=(P,j)=>Qn(P,pe=>Tt(pe,j)),Xe=(P,j)=>zn(j,P),Ot=(P,j)=>Ct(P,j).isSome(),xn=P=>P.nodeName.toLowerCase(),Go=P=>bs.fromDom(P.getBody()),Os=P=>j=>Jn(j,Go(P)),Ur=P=>P?P.replace(/px$/,""):"",jr=P=>/^\d+(\.\d+)?$/.test(P)?P+"px":P,Sa=P=>bs.fromDom(P.selection.getStart()),fs=P=>bs.fromDom(P.selection.getEnd()),rc=P=>wc(P,Xo("table")).forall(yt),Cc=["tfoot","thead","tbody","colgroup"],Yi=P=>Ne(Cc,P),uf=(P,j)=>({rows:P,columns:j}),df=(P,j,pe)=>({element:P,rowspan:j,colspan:pe}),ql=(P,j,pe,Fe,ft,rn)=>({element:P,rowspan:j,colspan:pe,row:Fe,column:ft,isLocked:rn}),Gc=(P,j,pe)=>({element:P,cells:j,section:pe}),Cu=(P,j,pe,Fe)=>({startRow:P,startCol:j,finishRow:pe,finishCol:Fe}),xu=(P,j,pe)=>({element:P,colspan:j,column:pe}),wd=(P,j)=>({element:P,columns:j}),nm=(P,j,pe=0)=>Vo(P,j).map(Fe=>parseInt(Fe,10)).getOr(pe),Hm=(P,j)=>qc(P,j,De),qc=(P,j,pe)=>Ve(Rn(P),Fe=>Tt(Fe,j)?pe(Fe)?[Fe]:[]:qc(Fe,j,pe)),Ki=(P,j,pe=Je)=>{if(pe(j))return ne.none();if(Ne(P,cs(j)))return ne.some(j);const Fe=ft=>Tt(ft,"table")||pe(ft);return Ge(j,P.join(","),Fe)},il=(P,j)=>Ki(["td","th"],P,j),Cd=P=>Hm(P,"th,td"),$e=P=>Tt(P,"colgroup")?xe(P,"col"):Ve(sn(P),j=>xe(j,"col")),qe=(P,j)=>me(P,"table",j),It=P=>Hm(P,"tr"),sn=P=>qe(P).fold(G([]),j=>xe(j,"colgroup")),bo=Xo("th"),Es=(P,j)=>P&&j?"sectionCells":P?"section":"cells",rr=P=>{const j=P.section==="thead",pe=mn(ma(P.cells),"th");return P.section==="tfoot"?{type:"footer"}:j||pe?{type:"header",subType:Es(j,pe)}:{type:"body"}},ma=P=>{const j=we(P,pe=>bo(pe.element));return j.length===0?ne.some("td"):j.length===P.length?ne.some("th"):ne.none()},ea=P=>{const j=be(P,ft=>rr(ft).type),pe=Ne(j,"header"),Fe=Ne(j,"footer");if(!pe&&!Fe)return ne.some("body");{const ft=Ne(j,"body");return pe&&!ft&&!Fe?ne.some("header"):!pe&&!ft&&Fe?ne.some("footer"):ne.none()}},Yl=(P,j)=>be(P,pe=>{if(cs(pe)==="colgroup"){const Fe=be($e(pe),ft=>{const rn=nm(ft,"span",1);return df(ft,1,rn)});return Gc(pe,Fe,"colgroup")}else{const Fe=be(Cd(pe),ft=>{const rn=nm(ft,"rowspan",1),Vn=nm(ft,"colspan",1);return df(ft,rn,Vn)});return Gc(pe,Fe,j(pe))}}),hs=P=>Jo(P).map(j=>{const pe=cs(j);return Yi(pe)?pe:"tbody"}).getOr("tbody"),Nl=P=>{const j=It(P),Fe=[...sn(P),...j];return Yl(Fe,hs)},Su="data-snooker-locked-cols",zu=P=>Vo(P,Su).bind(j=>ne.from(j.match(/\d+/g))).map(j=>Ie(j,De)),xd=(P,j)=>P+","+j,om=(P,j,pe)=>ne.from(P.access[xd(j,pe)]),Kl=(P,j,pe)=>{const Fe=ac(P,ft=>pe(j,ft.element));return Fe.length>0?ne.some(Fe[0]):ne.none()},ac=(P,j)=>{const pe=Ve(P.all,Fe=>Fe.cells);return we(pe,j)},zm=P=>{const j={};let pe=0;return ke(P.cells,Fe=>{const ft=Fe.colspan;Mt(ft,rn=>{const Vn=pe+rn;j[Vn]=xu(Fe.element,ft,Vn)}),pe+=ft}),j},Vp=P=>{const j={},pe=[],ft=se(P).map(_c=>_c.element).bind(qe).bind(zu).getOr({});let rn=0,Vn=0,io=0;const{pass:Wo,fail:ks}=je(P,_c=>_c.section==="colgroup");ke(ks,_c=>{const Bi=[];ke(_c.cells,Au=>{let Wu=0;for(;j[xd(io,Wu)]!==void 0;)Wu++;const v1=Ue(ft,Wu.toString()),qp=ql(Au.element,Au.rowspan,Au.colspan,io,Wu,v1);for(let Wg=0;Wg<Au.colspan;Wg++)for(let Yp=0;Yp<Au.rowspan;Yp++){const b1=io+Yp,y1=Wu+Wg,Sf=xd(b1,y1);j[Sf]=qp,Vn=Math.max(Vn,y1+1)}Bi.push(qp)}),rn++,pe.push(Gc(_c.element,Bi,_c.section)),io++});const{columns:Sr,colgroups:ia}=pn(Wo).map(_c=>{const Bi=zm(_c);return{colgroups:[wd(_c.element,ye(Bi))],columns:Bi}}).getOrThunk(()=>({colgroups:[],columns:{}}));return{grid:uf(rn,Vn),access:j,all:pe,columns:Sr,colgroups:ia}},$r={fromTable:P=>{const j=Nl(P);return Vp(j)},generate:Vp,getAt:om,findItem:Kl,filterItems:ac,justCells:P=>Ve(P.all,j=>j.cells),justColumns:P=>ye(P.columns),hasColumns:P=>St(P.columns).length>0,getColumnAt:(P,j)=>ne.from(P.columns[j])},Sd=(P,j)=>wt(P.all,pe=>We(pe.cells,Fe=>Jn(j,Fe.element))),Qe=(P,j,pe)=>{const Fe=be(j.selection,rn=>il(rn).bind(Vn=>Sd(P,Vn)).filter(pe)),ft=Et(Fe);return vn(ft.length>0,ft)},Jv=(P,j)=>j.mergable,Xl=(P,j)=>j.unmergable,sm=(P,j)=>Qe(P,j,De),Xi=(P,j)=>Sd(P,j).exists(pe=>!pe.isLocked),rm=(P,j)=>pt(j,pe=>Xi(P,pe)),Um=(P,j)=>Jv(P,j).filter(pe=>rm(P,pe.cells)),Ed=(P,j)=>Xl(P,j).filter(pe=>rm(P,pe));var Oi=["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"],_d=()=>{const P=ks=>bs.fromDom(ks.dom.cloneNode(!1)),j=ks=>ms(ks).dom,pe=ks=>At(ks)?cs(ks)==="body"?!0:Ne(Oi,cs(ks)):!1,Fe=ks=>At(ks)?Ne(["br","img","hr","input"],cs(ks)):!1,ft=ks=>At(ks)&&nl(ks,"contenteditable")==="false",rn=(ks,Sr)=>ks.dom.compareDocumentPosition(Sr.dom),Vn=(ks,Sr)=>{const ia=wa(ks);Ni(Sr,ia)},io=ks=>{const Sr=cs(ks);return Ne(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],Sr)},Wo=ks=>At(ks)?Vo(ks,"lang"):ne.none();return{up:G({selector:Ge,closest:me,predicate:sc,all:Ae}),down:G({selector:Xe,predicate:ae}),styles:G({get:Al,getRaw:yl,set:In,remove:bc}),attrs:G({get:nl,set:Jr,remove:Qr,copyTo:Vn}),insert:G({before:ls,after:Bs,afterAll:as,append:Ar,appendAll:Hs,prepend:Xr,wrap:Cr}),remove:G({unwrap:La,remove:xr}),create:G({nu:bs.fromTag,clone:P,text:bs.fromText}),query:G({comparePosition:rn,prevSibling:rt,nextSibling:Xt}),property:G({children:Rn,name:cs,parent:Jo,document:j,isText:qt,isComment:nt,isElement:At,isSpecial:io,getLanguage:Wo,getText:Di,setText:Hu,isBoundary:pe,isEmptyTag:Fe,isNonEditable:ft}),eq:Jn,is:wr}};const jm=(P,j,pe,Fe)=>{const ft=pe[0],rn=pe.slice(1);return Fe(P,j,ft,rn)},ff=(P,j,pe)=>pe.length>0?jm(P,j,pe,gi):ne.none(),gi=(P,j,pe,Fe)=>{const ft=j(P,pe);return ot(Fe,(rn,Vn)=>{const io=j(P,Vn);return cl(P,rn,io)},ft)},cl=(P,j,pe)=>j.bind(Fe=>pe.filter(H(P.eq,Fe))),mf=ff,lc=_d(),Yc=(P,j)=>mf(lc,(pe,Fe)=>P(Fe),j),gf=(P,j)=>{const pe=$r.fromTable(P);return sm(pe,j).bind(ft=>{const rn=ft[ft.length-1],Vn=ft[0].row,io=rn.row+rn.rowspan,Wo=pe.all.slice(Vn,io);return ea(Wo)}).getOr("")},_s=(P,j)=>j.column>=P.startCol&&j.column+j.colspan-1<=P.finishCol&&j.row>=P.startRow&&j.row+j.rowspan-1<=P.finishRow,Kc=(P,j)=>{let pe=!0;const Fe=H(_s,j);for(let ft=j.startRow;ft<=j.finishRow;ft++)for(let rn=j.startCol;rn<=j.finishCol;rn++)pe=pe&&$r.getAt(P,ft,rn).exists(Fe);return pe?ne.some(j):ne.none()},Pg=(P,j)=>Cu(Math.min(P.row,j.row),Math.min(P.column,j.column),Math.max(P.row+P.rowspan-1,j.row+j.rowspan-1),Math.max(P.column+P.colspan-1,j.column+j.colspan-1)),Vs=(P,j,pe)=>{const Fe=$r.findItem(P,j,Jn),ft=$r.findItem(P,pe,Jn);return Fe.bind(rn=>ft.map(Vn=>Pg(rn,Vn)))},Jl=(P,j,pe)=>Vs(P,j,pe).bind(Fe=>Kc(P,Fe)),Eu=(P,j,pe)=>{const Fe=pf(P);return Jl(Fe,j,pe)},pf=$r.fromTable;var Uu=tinymce.util.Tools.resolve("tinymce.util.Tools");const Dl=(P,j,pe)=>{const Fe=P.select("td,th",j);let ft;for(let rn=0;rn<Fe.length;rn++){const Vn=P.getStyle(Fe[rn],pe);if(_(ft)&&(ft=Vn),ft!==Vn)return""}return ft},Ol=(P,j,pe)=>{Uu.each("left center right".split(" "),Fe=>{Fe!==pe&&P.formatter.remove("align"+Fe,{},j)}),pe&&P.formatter.apply("align"+pe,{},j)},Qv=(P,j,pe)=>{Uu.each("top middle bottom".split(" "),Fe=>{Fe!==pe&&P.formatter.remove("valign"+Fe,{},j)}),pe&&P.formatter.apply("valign"+pe,{},j)},hf=(P,j,pe)=>{P.dispatch("TableModified",{...pe,table:j})};var ga=tinymce.util.Tools.resolve("tinymce.Env");const Xc="tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol",Jc=Mt(5,P=>{const j=`${P+1}px`;return{title:j,value:j}}),kd=be(["Solid","Dotted","Dashed","Double","Groove","Ridge","Inset","Outset","None","Hidden"],P=>({title:P,value:P.toLowerCase()})),Qc="100%",br=P=>{var j;const pe=P.dom,Fe=(j=pe.getParent(P.selection.getStart(),pe.isBlock))!==null&&j!==void 0?j:P.getBody();return qi(bs.fromDom(Fe))+"px"},Wm=(P,j)=>l1(P)||!xc(P)?j:zp(P)?{...j,width:br(P)}:{...j,width:Qc},a1=(P,j)=>l1(P)||xc(P)?j:zp(P)?{...j,width:br(P)}:{...j,width:Qc},$l=P=>j=>j.options.get(P),Ql=P=>{const j=P.options.register;j("table_border_widths",{processor:"object[]",default:Jc}),j("table_border_styles",{processor:"object[]",default:kd}),j("table_cell_advtab",{processor:"boolean",default:!0}),j("table_row_advtab",{processor:"boolean",default:!0}),j("table_advtab",{processor:"boolean",default:!0}),j("table_appearance_options",{processor:"boolean",default:!0}),j("table_grid",{processor:"boolean",default:!ga.deviceType.isTouch()}),j("table_cell_class_list",{processor:"object[]",default:[]}),j("table_row_class_list",{processor:"object[]",default:[]}),j("table_class_list",{processor:"object[]",default:[]}),j("table_toolbar",{processor:"string",default:Xc}),j("table_background_color_map",{processor:"object[]",default:[]}),j("table_border_color_map",{processor:"object[]",default:[]})},eu=$l("table_sizing_mode"),Ba=$l("table_border_widths"),Td=$l("table_border_styles"),sl=$l("table_cell_advtab"),hi=$l("table_row_advtab"),Br=$l("table_advtab"),Gr=$l("table_appearance_options"),Zm=$l("table_grid"),xc=$l("table_style_by_css"),ar=$l("table_cell_class_list"),tu=$l("table_row_class_list"),nu=$l("table_class_list"),ou=$l("table_toolbar"),Ma=$l("table_background_color_map"),vf=$l("table_border_color_map"),zp=P=>eu(P)==="fixed",l1=P=>eu(P)==="responsive",$i=P=>{const j=P.options,pe=j.get("table_default_styles");return j.isSet("table_default_styles")?pe:Wm(P,pe)},i1=P=>{const j=P.options,pe=j.get("table_default_attributes");return j.isSet("table_default_attributes")?pe:a1(P,pe)},Fg=P=>Ge(P,"table"),c1=(P,j)=>{const pe=Xe(P,j);return pe.length>0?ne.some(pe):ne.none()},Bo=(P,j,pe)=>Jt(P,j).bind(Fe=>Jt(P,pe).bind(ft=>Yc(Fg,[Fe,ft]).map(rn=>({first:Fe,last:ft,table:rn})))),_u=(P,j)=>c1(P,j),Ya=(P,j,pe)=>Bo(P,j,pe).bind(Fe=>{const ft=Wo=>Jn(P,Wo),rn="thead,tfoot,tbody,table",Vn=Ge(Fe.first,rn,ft),io=Ge(Fe.last,rn,ft);return Vn.bind(Wo=>io.bind(ks=>Jn(Wo,ks)?Eu(Fe.table,Fe.first,Fe.last):ne.none()))}),Ha=K,Up=P=>{const j=(Fe,ft)=>Vo(Fe,ft).exists(rn=>parseInt(rn,10)>1),pe=Fe=>j(Fe,"rowspan")||j(Fe,"colspan");return P.length>0&&pt(P,pe)?ne.some(P):ne.none()},Rs=(P,j,pe)=>j.length<=1?ne.none():Ya(P,pe.firstSelectedSelector,pe.lastSelectedSelector).map(Fe=>({bounds:Fe,cells:j})),Ad="data-mce-selected",su="td["+Ad+"],th["+Ad+"]",ic="data-mce-first-selected",Bl="td["+ic+"],th["+ic+"]",ul="data-mce-last-selected",Gm="td["+ul+"],th["+ul+"]",la={selected:Ad,selectedSelector:su,firstSelected:ic,firstSelectedSelector:Bl,lastSelected:ul,lastSelectedSelector:Gm},Lg=P=>qe(P).bind(j=>_u(j,la.firstSelectedSelector)).fold(G(P),j=>j[0]),Sc=P=>(j,pe)=>{const Fe=cs(j),ft=Fe==="col"||Fe==="colgroup"?Lg(j):j;return me(ft,P,pe)},ju=Sc("th,td,caption"),Vg=Sc("th,td"),za=P=>Wi(P.model.table.getSelectedCells()),cc=(P,j)=>{const pe=Vg(P),Fe=pe.bind(ft=>qe(ft)).map(ft=>It(ft));return Rt(pe,Fe,(ft,rn)=>we(rn,Vn=>ue(Wi(Vn.dom.cells),io=>nl(io,j)==="1"||Jn(io,ft)))).getOr([])},ta=[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}],ei=P=>({value:Ho(P)}),ku=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Ua=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,u1=P=>ku.test(P)||Ua.test(P),Ho=P=>wn(P,"#").toUpperCase(),dl=P=>u1(P)?ne.some({value:Ho(P)}):ne.none(),L=P=>{const j=P.toString(16);return(j.length===1?"0"+j:j).toUpperCase()},Q=P=>{const j=L(P.red)+L(P.green)+L(P.blue);return ei(j)},ve=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,Ze=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,it=(P,j,pe,Fe)=>({red:P,green:j,blue:pe,alpha:Fe}),hn=(P,j,pe,Fe)=>{const ft=parseInt(P,10),rn=parseInt(j,10),Vn=parseInt(pe,10),io=parseFloat(Fe);return it(ft,rn,Vn,io)},Dn=P=>{const j=ve.exec(P);if(j!==null)return ne.some(hn(j[1],j[2],j[3],"1"));const pe=Ze.exec(P);return pe!==null?ne.some(hn(pe[1],pe[2],pe[3],pe[4])):ne.none()},qo=P=>dl(P).orThunk(()=>Dn(P).map(Q)).getOrThunk(()=>{const j=document.createElement("canvas");j.height=1,j.width=1;const pe=j.getContext("2d");pe.clearRect(0,0,j.width,j.height),pe.fillStyle="#FFFFFF",pe.fillStyle=P,pe.fillRect(0,0,1,1);const Fe=pe.getImageData(0,0,1,1).data,ft=Fe[0],rn=Fe[1],Vn=Fe[2],io=Fe[3];return Q(it(ft,rn,Vn,io))}),es=P=>Dn(P).map(Q).map(j=>"#"+j.value).getOr(P),Do=(P,j,pe)=>Fe=>{const ft=Yn(),rn=jo(pe),Vn=()=>{const io=za(P),Wo=ks=>P.formatter.match(j,{value:pe},ks.dom,rn);rn?(Fe.setActive(!ue(io,Wo)),ft.set(P.formatter.formatChanged(j,ks=>Fe.setActive(!ks),!0))):(Fe.setActive(pt(io,Wo)),ft.set(P.formatter.formatChanged(j,Fe.setActive,!1,{value:pe})))};return P.initialized?Vn():P.on("init",Vn),ft.clear},gs=P=>Ue(P,"menu"),Vr=P=>be(P,j=>{const pe=j.text||j.title||"";return gs(j)?{text:pe,items:Vr(j.menu)}:{text:pe,value:j.value}}),vi=P=>P.length?ne.some(Vr([{text:"Select...",value:"mce-no-match"},...P])):ne.none(),pa=(P,j,pe,Fe)=>be(j,ft=>{const rn=ft.text||ft.title;return gs(ft)?{type:"nestedmenuitem",text:rn,getSubmenuItems:()=>pa(P,ft.menu,pe,Fe)}:{text:rn,type:"togglemenuitem",onAction:()=>Fe(ft.value),onSetup:Do(P,pe,ft.value)}}),bf=(P,j)=>pe=>{P.execCommand("mceTableApplyCellStyle",!1,{[j]:pe})},am=P=>Ve(P,j=>gs(j)?[{...j,menu:am(j.menu)}]:Ko(j.value)?[j]:[]),qm=(P,j,pe,Fe)=>ft=>ft(pa(P,j,pe,Fe)),Ym=(P,j,pe)=>{const Fe=be(j,ft=>({text:ft.title,value:"#"+qo(ft.value).value,type:"choiceitem"}));return[{type:"fancymenuitem",fancytype:"colorswatch",initData:{colors:Fe.length>0?Fe:void 0,allowCustomColors:!1},onAction:ft=>{const rn=ft.value==="remove"?"":ft.value;P.execCommand("mceTableApplyCellStyle",!1,{[pe]:rn})}}]},_a=P=>()=>{const pe=P.queryCommandValue("mceTableRowType")==="header"?"body":"header";P.execCommand("mceTableRowType",!1,{type:pe})},Km=P=>()=>{const pe=P.queryCommandValue("mceTableColType")==="th"?"td":"th";P.execCommand("mceTableColType",!1,{type:pe})},d1=P=>vi(ar(P)).map(j=>({name:"class",type:"listbox",label:"Class",items:j})),f1=[{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:ta}],lm=P=>f1.concat(d1(P).toArray()),Hr=(P,j)=>{const Fe=[{name:"borderstyle",type:"listbox",label:"Border style",items:[{text:"Select...",value:""}].concat(Vr(Td(P)))},{name:"bordercolor",type:"colorinput",label:"Border color"},{name:"backgroundcolor",type:"colorinput",label:"Background color"}];return{title:"Advanced",name:"advanced",items:j==="cell"?[{name:"borderwidth",type:"input",label:"Border width"}].concat(Fe):Fe}},Hg={normal:(P,j)=>{const pe=P.dom;return{setAttrib:(Vn,io)=>{pe.setAttrib(j,Vn,io)},setStyle:(Vn,io)=>{pe.setStyle(j,Vn,io)},setFormat:(Vn,io)=>{io===""?P.formatter.remove(Vn,{value:null},j,!0):P.formatter.apply(Vn,{value:io},j)}}}},wl=P=>On(P,"rgb")?es(P):P,yf=P=>{const j=bs.fromDom(P);return{borderwidth:yl(j,"border-width").getOr(""),borderstyle:yl(j,"border-style").getOr(""),bordercolor:yl(j,"border-color").map(wl).getOr(""),backgroundcolor:yl(j,"background-color").map(wl).getOr("")}},Ka=P=>{const j=P[0],pe=P.slice(1);return ke(pe,Fe=>{ke(St(j),ft=>{mt(Fe,(rn,Vn)=>{const io=j[ft];io!==""&&ft===Vn&&io!==rn&&(j[ft]=ft==="class"?"mce-no-match":"")})})}),j},fl=(P,j,pe,Fe)=>We(P,ft=>!_(pe.formatter.matchNode(Fe,j+ft))).getOr(""),im=H(fl,["left","center","right"],"align"),TC=H(fl,["top","middle","bottom"],"valign"),e0=(P,j)=>{const pe=$i(P),Fe=i1(P),ft=()=>({borderstyle:Re(pe,"border-style").getOr(""),bordercolor:wl(Re(pe,"border-color").getOr("")),backgroundcolor:wl(Re(pe,"background-color").getOr(""))}),rn={height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:""},Vn=()=>{const Sr=pe["border-width"];return xc(P)&&Sr?{border:Sr}:Re(Fe,"border").fold(()=>({}),ia=>({border:ia}))},io=j?ft():{},Wo=()=>{const Sr=Re(pe,"border-spacing").or(Re(Fe,"cellspacing")).fold(()=>({}),ja=>({cellspacing:ja})),ia=Re(pe,"border-padding").or(Re(Fe,"cellpadding")).fold(()=>({}),ja=>({cellpadding:ja}));return{...Sr,...ia}};return{...rn,...pe,...Fe,...io,...Vn(),...Wo()}},jp=P=>qe(bs.fromDom(P)).map(j=>{const pe={selection:Wi(P.cells)};return gf(j,pe)}).getOr(""),Nd=(P,j,pe)=>{const Fe=(io,Wo)=>{const ks=yl(bs.fromDom(Wo),"border-width");return xc(P)&&ks.isSome()?ks.getOr(""):io.getAttrib(Wo,"border")||Dl(P.dom,Wo,"border-width")||Dl(P.dom,Wo,"border")||""},ft=P.dom,rn=xc(P)?ft.getStyle(j,"border-spacing")||ft.getAttrib(j,"cellspacing"):ft.getAttrib(j,"cellspacing")||ft.getStyle(j,"border-spacing"),Vn=xc(P)?Dl(ft,j,"padding")||ft.getAttrib(j,"cellpadding"):ft.getAttrib(j,"cellpadding")||Dl(ft,j,"padding");return{width:ft.getStyle(j,"width")||ft.getAttrib(j,"width"),height:ft.getStyle(j,"height")||ft.getAttrib(j,"height"),cellspacing:rn??"",cellpadding:Vn??"",border:Fe(ft,j),caption:!!ft.select("caption",j)[0],class:ft.getAttrib(j,"class",""),align:im(P,j),...pe?yf(j):{}}},m1=(P,j,pe)=>{const Fe=P.dom;return{height:Fe.getStyle(j,"height")||Fe.getAttrib(j,"height"),class:Fe.getAttrib(j,"class",""),type:jp(j),align:im(P,j),...pe?yf(j):{}}},AC=(P,j,pe,Fe)=>{const ft=P.dom,rn=Fe.getOr(j);return{width:((io,Wo)=>ft.getStyle(io,Wo)||ft.getAttrib(io,Wo))(rn,"width"),scope:ft.getAttrib(j,"scope"),celltype:xn(j),class:ft.getAttrib(j,"class",""),halign:im(P,j),valign:TC(P,j),...pe?yf(j):{}}},cm=(P,j)=>{const pe=$r.fromTable(P),Fe=$r.justCells(pe),ft=we(Fe,rn=>ue(j,Vn=>Jn(rn.element,Vn)));return be(ft,rn=>({element:rn.element.dom,column:$r.getColumnAt(pe,rn.column).map(Vn=>Vn.element.dom)}))},g1=(P,j,pe,Fe)=>{Fe("scope")&&P.setAttrib("scope",pe.scope),Fe("class")&&pe.class!=="mce-no-match"&&P.setAttrib("class",pe.class),Fe("width")&&j.setStyle("width",jr(pe.width))},Xm=(P,j,pe)=>{pe("backgroundcolor")&&P.setFormat("tablecellbackgroundcolor",j.backgroundcolor),pe("bordercolor")&&P.setFormat("tablecellbordercolor",j.bordercolor),pe("borderstyle")&&P.setFormat("tablecellborderstyle",j.borderstyle),pe("borderwidth")&&P.setFormat("tablecellborderwidth",jr(j.borderwidth))},zg=(P,j,pe,Fe)=>{const ft=j.length===1;ke(j,rn=>{const Vn=rn.element,io=ft?De:Fe,Wo=Hg.normal(P,Vn),ks=rn.column.map(Sr=>Hg.normal(P,Sr)).getOr(Wo);g1(Wo,ks,pe,io),sl(P)&&Xm(Wo,pe,io),Fe("halign")&&Ol(P,Vn,pe.halign),Fe("valign")&&Qv(P,Vn,pe.valign)})},t0=(P,j)=>{P.execCommand("mceTableCellType",!1,{type:j.celltype,no_events:!0})},p1=(P,j,pe,Fe)=>{const ft=ie(Fe,(rn,Vn)=>pe[Vn]!==rn);Be(ft)>0&&j.length>=1&&qe(j[0]).each(rn=>{const Vn=cm(rn,j),io=Be(ie(ft,(ks,Sr)=>Sr!=="scope"&&Sr!=="celltype"))>0,Wo=dt(ft,"celltype");(io||dt(ft,"scope"))&&zg(P,Vn,Fe,H(dt,ft)),Wo&&t0(P,Fe),hf(P,rn.dom,{structure:Wo,style:io})})},NC=(P,j,pe,Fe)=>{const ft=Fe.getData();Fe.close(),P.undoManager.transact(()=>{p1(P,j,pe,ft),P.focus()})},DC=(P,j)=>{const pe=qe(j[0]).map(Fe=>be(cm(Fe,j),ft=>AC(P,ft.element,sl(P),ft.column)));return Ka(pe.getOrDie())},Tu=P=>{const j=za(P);if(j.length===0)return;const pe=DC(P,j),Fe={type:"tabpanel",tabs:[{title:"General",name:"general",items:lm(P)},Hr(P,"cell")]},ft={type:"panel",items:[{type:"grid",columns:2,items:lm(P)}]};P.windowManager.open({title:"Cell Properties",size:"normal",body:sl(P)?Fe:ft,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:pe,onSubmit:H(NC,P,j,pe)})},Dd=P=>vi(tu(P)).map(j=>({name:"class",type:"listbox",label:"Class",items:j})),Ec=[{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"}],lr=P=>Ec.concat(Dd(P).toArray()),ti=(P,j,pe)=>{pe("class")&&j.class!=="mce-no-match"&&P.setAttrib("class",j.class),pe("height")&&P.setStyle("height",jr(j.height))},n0=(P,j,pe)=>{pe("backgroundcolor")&&P.setStyle("background-color",j.backgroundcolor),pe("bordercolor")&&P.setStyle("border-color",j.bordercolor),pe("borderstyle")&&P.setStyle("border-style",j.borderstyle)},Wp=(P,j,pe,Fe)=>{const rn=j.length===1?De:Fe;ke(j,Vn=>{const io=xe(bs.fromDom(Vn),"td,th"),Wo=Hg.normal(P,Vn);ti(Wo,pe,rn),hi(P)&&n0(Wo,pe,rn),Fe("height")&&ke(io,ks=>{P.dom.setStyle(ks.dom,"height",null)}),Fe("align")&&Ol(P,Vn,pe.align)})},wf=(P,j)=>{P.execCommand("mceTableRowType",!1,{type:j.type,no_events:!0})},um=(P,j,pe,Fe)=>{const ft=ie(Fe,(rn,Vn)=>pe[Vn]!==rn);if(Be(ft)>0){const rn=dt(ft,"type"),Vn=rn?Be(ft)>1:!0;Vn&&Wp(P,j,Fe,H(dt,ft)),rn&&wf(P,Fe),qe(bs.fromDom(j[0])).each(io=>hf(P,io.dom,{structure:rn,style:Vn}))}},ru=(P,j,pe,Fe)=>{const ft=Fe.getData();Fe.close(),P.undoManager.transact(()=>{um(P,j,pe,ft),P.focus()})},o0=P=>{const j=cc(Sa(P),la.selected);if(j.length===0)return;const pe=be(j,Vn=>m1(P,Vn.dom,hi(P))),Fe=Ka(pe),ft={type:"tabpanel",tabs:[{title:"General",name:"general",items:lr(P)},Hr(P,"row")]},rn={type:"panel",items:[{type:"grid",columns:2,items:lr(P)}]};P.windowManager.open({title:"Row Properties",size:"normal",body:hi(P)?ft:rn,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:Fe,onSubmit:H(ru,P,be(j,Vn=>Vn.dom),Fe)})},Ty=(P,j,pe)=>{const Fe=pe?[{type:"input",name:"cols",label:"Cols",inputMode:"numeric"},{type:"input",name:"rows",label:"Rows",inputMode:"numeric"}]:[],ft=[{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}],rn=Gr(P)?[{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"}]}]:[],Vn=[{type:"listbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}],io=j.length>0?[{name:"class",type:"listbox",label:"Class",items:j}]:[];return Fe.concat(ft).concat(rn).concat(Vn).concat(io)},na=(P,j,pe,Fe)=>{if(j.tagName==="TD"||j.tagName==="TH")b(pe)&&D(Fe)?P.setStyle(j,pe,Fe):P.setStyles(j,pe);else if(j.children)for(let ft=0;ft<j.children.length;ft++)na(P,j.children[ft],pe,Fe)},s0=(P,j,pe,Fe)=>{const ft=P.dom,rn={},Vn={},io=xc(P),Wo=Br(P),ks=parseFloat(pe.border)===0;if(!_(pe.class)&&pe.class!=="mce-no-match"&&(rn.class=pe.class),Vn.height=jr(pe.height),io?Vn.width=jr(pe.width):ft.getAttrib(j,"width")&&(rn.width=Ur(pe.width)),io?(ks?(rn.border=0,Vn["border-width"]=""):(Vn["border-width"]=jr(pe.border),rn.border=1),Vn["border-spacing"]=jr(pe.cellspacing)):(rn.border=ks?0:pe.border,rn.cellpadding=pe.cellpadding,rn.cellspacing=pe.cellspacing),io&&j.children){const Sr={};if(ks?Sr["border-width"]="":Fe.border&&(Sr["border-width"]=jr(pe.border)),Fe.cellpadding&&(Sr.padding=jr(pe.cellpadding)),Wo&&Fe.bordercolor&&(Sr["border-color"]=pe.bordercolor),!bt(Sr))for(let ia=0;ia<j.children.length;ia++)na(ft,j.children[ia],Sr)}if(Wo){const Sr=pe;Vn["background-color"]=Sr.backgroundcolor,Vn["border-color"]=Sr.bordercolor,Vn["border-style"]=Sr.borderstyle}ft.setStyles(j,{...$i(P),...Vn}),ft.setAttribs(j,{...i1(P),...rn})},Nr=(P,j,pe,Fe)=>{const ft=P.dom,rn=Fe.getData(),Vn=ie(rn,(io,Wo)=>pe[Wo]!==io);Fe.close(),P.undoManager.transact(()=>{if(!j){const io=Ws(rn.cols).getOr(1),Wo=Ws(rn.rows).getOr(1);P.execCommand("mceInsertTable",!1,{rows:Wo,columns:io}),j=Vg(Sa(P),Os(P)).bind(ks=>qe(ks,Os(P))).map(ks=>ks.dom).getOrDie()}if(Be(Vn)>0){const io={border:dt(Vn,"border"),bordercolor:dt(Vn,"bordercolor"),cellpadding:dt(Vn,"cellpadding")};s0(P,j,rn,io);const Wo=ft.select("caption",j)[0];(Wo&&!rn.caption||!Wo&&rn.caption)&&P.execCommand("mceTableToggleCaption"),Ol(P,j,rn.align)}if(P.focus(),P.addVisual(),Be(Vn)>0){const io=dt(Vn,"caption"),Wo=io?Be(Vn)>1:!0;hf(P,j,{structure:io,style:Wo})}})},h1=(P,j)=>{const pe=P.dom;let Fe,ft=e0(P,Br(P));j?(ft.cols="1",ft.rows="1",Br(P)&&(ft.borderstyle="",ft.bordercolor="",ft.backgroundcolor="")):(Fe=pe.getParent(P.selection.getStart(),"table",P.getBody()),Fe?ft=Nd(P,Fe,Br(P)):Br(P)&&(ft.borderstyle="",ft.bordercolor="",ft.backgroundcolor=""));const rn=vi(nu(P));rn.isSome()&&ft.class&&(ft.class=ft.class.replace(/\s*mce\-item\-table\s*/g,""));const Vn={type:"grid",columns:2,items:Ty(P,rn.getOr([]),j)},io=()=>({type:"panel",items:[Vn]}),Wo=()=>({type:"tabpanel",tabs:[{title:"General",name:"general",items:[Vn]},Hr(P,"table")]}),ks=Br(P)?Wo():io();P.windowManager.open({title:"Table Properties",size:"normal",body:ks,onSubmit:H(Nr,P,Fe,ft),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:ft})},Ml=P=>{const j=pe=>{rc(Sa(P))&&pe()};mt({mceTableProps:H(h1,P,!1),mceTableRowProps:H(o0,P),mceTableCellProps:H(Tu,P),mceInsertTableDialog:H(h1,P,!0)},(pe,Fe)=>P.addCommand(Fe,()=>j(pe)))},Ug=P=>({element:P,mergable:ne.none(),unmergable:ne.none(),selection:[P]}),bi=(P,j,pe)=>({element:pe,mergable:Rs(j,P,la),unmergable:Up(P),selection:Ha(P)}),r0=P=>{const j=Dt(ne.none()),pe=Dt([]);let Fe=ne.none();const ft=Xo("caption"),rn=zs=>Fe.forall(qr=>!qr[zs]),Vn=()=>ju(Sa(P),Os(P)),io=()=>ju(fs(P),Os(P)),Wo=()=>Vn().bind(zs=>tn(Rt(qe(zs),io().bind(qe),(qr,Rl)=>Jn(qr,Rl)?ft(zs)?ne.some(Ug(zs)):ne.some(bi(za(P),qr,zs)):ne.none()))),ks=zs=>qe(zs.element).map(Rl=>{const uc=$r.fromTable(Rl),Jm=sm(uc,zs).getOr([]),Dy=et(Jm,(Kp,Xp)=>(Xp.isLocked&&(Kp.onAny=!0,Xp.column===0?Kp.onFirst=!0:Xp.column+Xp.colspan>=uc.grid.columns&&(Kp.onLast=!0)),Kp),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:Um(uc,zs).isSome(),unmergeable:Ed(uc,zs).isSome(),locked:Dy}}),Sr=()=>{j.set(No(Wo)()),Fe=j.get().bind(ks),ke(pe.get(),de)},ia=zs=>(zs(),pe.set(pe.get().concat([zs])),()=>{pe.set(we(pe.get(),qr=>qr!==zs))}),ja=(zs,qr)=>ia(()=>j.get().fold(()=>{zs.setEnabled(!1)},Rl=>{zs.setEnabled(!qr(Rl)&&P.selection.isEditable())})),_c=(zs,qr,Rl)=>ia(()=>j.get().fold(()=>{zs.setEnabled(!1),zs.setActive(!1)},uc=>{zs.setEnabled(!qr(uc)&&P.selection.isEditable()),zs.setActive(Rl(uc))})),Bi=zs=>Fe.exists(qr=>qr.locked[zs]),Au=zs=>ja(zs,qr=>!1),Wu=zs=>ja(zs,qr=>ft(qr.element)),v1=zs=>qr=>ja(qr,Rl=>ft(Rl.element)||Bi(zs)),qp=zs=>qr=>ja(qr,Rl=>ft(Rl.element)||zs().isNone()),Wg=(zs,qr)=>Rl=>ja(Rl,uc=>ft(uc.element)||zs().isNone()||Bi(qr)),Yp=zs=>ja(zs,qr=>rn("mergeable")),b1=zs=>ja(zs,qr=>rn("unmergeable")),y1=zs=>_c(zs,Je,qr=>qe(qr.element,Os(P)).exists(uc=>Ot(uc,"caption"))),Sf=(zs,qr)=>Rl=>_c(Rl,uc=>ft(uc.element),()=>P.queryCommandValue(zs)===qr),BC=Sf("mceTableRowType","header"),MC=Sf("mceTableColType","th");return P.on("NodeChange ExecCommand TableSelectorChange",Sr),{onSetupTable:Au,onSetupCellOrRow:Wu,onSetupColumn:v1,onSetupPasteable:qp,onSetupPasteableColumn:Wg,onSetupMergeable:Yp,onSetupUnmergeable:b1,resetTargets:Sr,onSetupTableWithCaption:y1,onSetupTableRowHeaders:BC,onSetupTableColumnHeaders:MC,targets:j.get}};var OC=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const Ay="x-tinymce/dom-table-",Cf=Ay+"rows",$C=Ay+"columns",au=P=>{var j;const pe=(j=OC.read())!==null&&j!==void 0?j:[];return wt(pe,Fe=>ne.from(Fe.getType(P)))},Ra=()=>au(Cf),xf=()=>au($C),Dr=P=>j=>{const pe=()=>{j.setEnabled(P.selection.isEditable())};return P.on("NodeChange",pe),pe(),()=>{P.off("NodeChange",pe)}},a0=(P,j)=>{P.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",onSetup:Dr(P),fetch:io=>io("inserttable | cell row column | advtablesort | tableprops deletetable")});const pe=io=>()=>P.execCommand(io),Fe=(io,Wo)=>{P.queryCommandSupported(Wo.command)&&P.ui.registry.addButton(io,{...Wo,onAction:R(Wo.onAction)?Wo.onAction:pe(Wo.command)})},ft=(io,Wo)=>{P.queryCommandSupported(Wo.command)&&P.ui.registry.addToggleButton(io,{...Wo,onAction:R(Wo.onAction)?Wo.onAction:pe(Wo.command)})};Fe("tableprops",{tooltip:"Table properties",command:"mceTableProps",icon:"table",onSetup:j.onSetupTable}),Fe("tabledelete",{tooltip:"Delete table",command:"mceTableDelete",icon:"table-delete-table",onSetup:j.onSetupTable}),Fe("tablecellprops",{tooltip:"Cell properties",command:"mceTableCellProps",icon:"table-cell-properties",onSetup:j.onSetupCellOrRow}),Fe("tablemergecells",{tooltip:"Merge cells",command:"mceTableMergeCells",icon:"table-merge-cells",onSetup:j.onSetupMergeable}),Fe("tablesplitcells",{tooltip:"Split cell",command:"mceTableSplitCells",icon:"table-split-cells",onSetup:j.onSetupUnmergeable}),Fe("tableinsertrowbefore",{tooltip:"Insert row before",command:"mceTableInsertRowBefore",icon:"table-insert-row-above",onSetup:j.onSetupCellOrRow}),Fe("tableinsertrowafter",{tooltip:"Insert row after",command:"mceTableInsertRowAfter",icon:"table-insert-row-after",onSetup:j.onSetupCellOrRow}),Fe("tabledeleterow",{tooltip:"Delete row",command:"mceTableDeleteRow",icon:"table-delete-row",onSetup:j.onSetupCellOrRow}),Fe("tablerowprops",{tooltip:"Row properties",command:"mceTableRowProps",icon:"table-row-properties",onSetup:j.onSetupCellOrRow}),Fe("tableinsertcolbefore",{tooltip:"Insert column before",command:"mceTableInsertColBefore",icon:"table-insert-column-before",onSetup:j.onSetupColumn("onFirst")}),Fe("tableinsertcolafter",{tooltip:"Insert column after",command:"mceTableInsertColAfter",icon:"table-insert-column-after",onSetup:j.onSetupColumn("onLast")}),Fe("tabledeletecol",{tooltip:"Delete column",command:"mceTableDeleteCol",icon:"table-delete-column",onSetup:j.onSetupColumn("onAny")}),Fe("tablecutrow",{tooltip:"Cut row",command:"mceTableCutRow",icon:"cut-row",onSetup:j.onSetupCellOrRow}),Fe("tablecopyrow",{tooltip:"Copy row",command:"mceTableCopyRow",icon:"duplicate-row",onSetup:j.onSetupCellOrRow}),Fe("tablepasterowbefore",{tooltip:"Paste row before",command:"mceTablePasteRowBefore",icon:"paste-row-before",onSetup:j.onSetupPasteable(Ra)}),Fe("tablepasterowafter",{tooltip:"Paste row after",command:"mceTablePasteRowAfter",icon:"paste-row-after",onSetup:j.onSetupPasteable(Ra)}),Fe("tablecutcol",{tooltip:"Cut column",command:"mceTableCutCol",icon:"cut-column",onSetup:j.onSetupColumn("onAny")}),Fe("tablecopycol",{tooltip:"Copy column",command:"mceTableCopyCol",icon:"duplicate-column",onSetup:j.onSetupColumn("onAny")}),Fe("tablepastecolbefore",{tooltip:"Paste column before",command:"mceTablePasteColBefore",icon:"paste-column-before",onSetup:j.onSetupPasteableColumn(xf,"onFirst")}),Fe("tablepastecolafter",{tooltip:"Paste column after",command:"mceTablePasteColAfter",icon:"paste-column-after",onSetup:j.onSetupPasteableColumn(xf,"onLast")}),Fe("tableinsertdialog",{tooltip:"Insert table",command:"mceInsertTableDialog",icon:"table",onSetup:Dr(P)});const rn=am(nu(P));rn.length!==0&&P.queryCommandSupported("mceTableToggleClass")&&P.ui.registry.addMenuButton("tableclass",{icon:"table-classes",tooltip:"Table styles",fetch:qm(P,rn,"tableclass",io=>P.execCommand("mceTableToggleClass",!1,io)),onSetup:j.onSetupTable});const Vn=am(ar(P));Vn.length!==0&&P.queryCommandSupported("mceTableCellToggleClass")&&P.ui.registry.addMenuButton("tablecellclass",{icon:"table-cell-classes",tooltip:"Cell styles",fetch:qm(P,Vn,"tablecellclass",io=>P.execCommand("mceTableCellToggleClass",!1,io)),onSetup:j.onSetupCellOrRow}),P.queryCommandSupported("mceTableApplyCellStyle")&&(P.ui.registry.addMenuButton("tablecellvalign",{icon:"vertical-align",tooltip:"Vertical align",fetch:qm(P,ta,"tablecellverticalalign",bf(P,"vertical-align")),onSetup:j.onSetupCellOrRow}),P.ui.registry.addMenuButton("tablecellborderwidth",{icon:"border-width",tooltip:"Border width",fetch:qm(P,Ba(P),"tablecellborderwidth",bf(P,"border-width")),onSetup:j.onSetupCellOrRow}),P.ui.registry.addMenuButton("tablecellborderstyle",{icon:"border-style",tooltip:"Border style",fetch:qm(P,Td(P),"tablecellborderstyle",bf(P,"border-style")),onSetup:j.onSetupCellOrRow}),P.ui.registry.addMenuButton("tablecellbackgroundcolor",{icon:"cell-background-color",tooltip:"Background color",fetch:io=>io(Ym(P,Ma(P),"background-color")),onSetup:j.onSetupCellOrRow}),P.ui.registry.addMenuButton("tablecellbordercolor",{icon:"cell-border-color",tooltip:"Border color",fetch:io=>io(Ym(P,vf(P),"border-color")),onSetup:j.onSetupCellOrRow})),ft("tablecaption",{tooltip:"Table caption",icon:"table-caption",command:"mceTableToggleCaption",onSetup:j.onSetupTableWithCaption}),ft("tablerowheader",{tooltip:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:_a(P),onSetup:j.onSetupTableRowHeaders}),ft("tablecolheader",{tooltip:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:Km(P),onSetup:j.onSetupTableColumnHeaders})},Zp=P=>{const j=Fe=>P.dom.is(Fe,"table")&&P.getBody().contains(Fe)&&P.dom.isEditable(Fe.parentNode),pe=ou(P);pe.length>0&&P.ui.registry.addContextToolbar("table",{predicate:j,items:pe,scope:"node",position:"node"})},jg=P=>j=>{const pe=()=>{j.setEnabled(P.selection.isEditable())};return P.on("NodeChange",pe),pe(),()=>{P.off("NodeChange",pe)}},Ny=(P,j)=>{const pe=ia=>()=>P.execCommand(ia),Fe=(ia,ja)=>P.queryCommandSupported(ja.command)?(P.ui.registry.addMenuItem(ia,{...ja,onAction:R(ja.onAction)?ja.onAction:pe(ja.command)}),!0):!1,ft=(ia,ja)=>{P.queryCommandSupported(ja.command)&&P.ui.registry.addToggleMenuItem(ia,{...ja,onAction:R(ja.onAction)?ja.onAction:pe(ja.command)})},rn=ia=>{P.execCommand("mceInsertTable",!1,{rows:ia.numRows,columns:ia.numColumns})},Vn=[Fe("tableinsertrowbefore",{text:"Insert row before",icon:"table-insert-row-above",command:"mceTableInsertRowBefore",onSetup:j.onSetupCellOrRow}),Fe("tableinsertrowafter",{text:"Insert row after",icon:"table-insert-row-after",command:"mceTableInsertRowAfter",onSetup:j.onSetupCellOrRow}),Fe("tabledeleterow",{text:"Delete row",icon:"table-delete-row",command:"mceTableDeleteRow",onSetup:j.onSetupCellOrRow}),Fe("tablerowprops",{text:"Row properties",icon:"table-row-properties",command:"mceTableRowProps",onSetup:j.onSetupCellOrRow}),Fe("tablecutrow",{text:"Cut row",icon:"cut-row",command:"mceTableCutRow",onSetup:j.onSetupCellOrRow}),Fe("tablecopyrow",{text:"Copy row",icon:"duplicate-row",command:"mceTableCopyRow",onSetup:j.onSetupCellOrRow}),Fe("tablepasterowbefore",{text:"Paste row before",icon:"paste-row-before",command:"mceTablePasteRowBefore",onSetup:j.onSetupPasteable(Ra)}),Fe("tablepasterowafter",{text:"Paste row after",icon:"paste-row-after",command:"mceTablePasteRowAfter",onSetup:j.onSetupPasteable(Ra)})],io=[Fe("tableinsertcolumnbefore",{text:"Insert column before",icon:"table-insert-column-before",command:"mceTableInsertColBefore",onSetup:j.onSetupColumn("onFirst")}),Fe("tableinsertcolumnafter",{text:"Insert column after",icon:"table-insert-column-after",command:"mceTableInsertColAfter",onSetup:j.onSetupColumn("onLast")}),Fe("tabledeletecolumn",{text:"Delete column",icon:"table-delete-column",command:"mceTableDeleteCol",onSetup:j.onSetupColumn("onAny")}),Fe("tablecutcolumn",{text:"Cut column",icon:"cut-column",command:"mceTableCutCol",onSetup:j.onSetupColumn("onAny")}),Fe("tablecopycolumn",{text:"Copy column",icon:"duplicate-column",command:"mceTableCopyCol",onSetup:j.onSetupColumn("onAny")}),Fe("tablepastecolumnbefore",{text:"Paste column before",icon:"paste-column-before",command:"mceTablePasteColBefore",onSetup:j.onSetupPasteableColumn(xf,"onFirst")}),Fe("tablepastecolumnafter",{text:"Paste column after",icon:"paste-column-after",command:"mceTablePasteColAfter",onSetup:j.onSetupPasteableColumn(xf,"onLast")})],Wo=[Fe("tablecellprops",{text:"Cell properties",icon:"table-cell-properties",command:"mceTableCellProps",onSetup:j.onSetupCellOrRow}),Fe("tablemergecells",{text:"Merge cells",icon:"table-merge-cells",command:"mceTableMergeCells",onSetup:j.onSetupMergeable}),Fe("tablesplitcells",{text:"Split cell",icon:"table-split-cells",command:"mceTableSplitCells",onSetup:j.onSetupUnmergeable})];Zm(P)?P.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"inserttable",onAction:rn}],onSetup:jg(P)}):P.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:pe("mceInsertTableDialog"),onSetup:jg(P)}),P.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:pe("mceInsertTableDialog"),onSetup:jg(P)}),Fe("tableprops",{text:"Table properties",onSetup:j.onSetupTable,command:"mceTableProps"}),Fe("deletetable",{text:"Delete table",icon:"table-delete-table",onSetup:j.onSetupTable,command:"mceTableDelete"}),Ne(Vn,!0)&&P.ui.registry.addNestedMenuItem("row",{type:"nestedmenuitem",text:"Row",getSubmenuItems:G("tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter")}),Ne(io,!0)&&P.ui.registry.addNestedMenuItem("column",{type:"nestedmenuitem",text:"Column",getSubmenuItems:G("tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter")}),Ne(Wo,!0)&&P.ui.registry.addNestedMenuItem("cell",{type:"nestedmenuitem",text:"Cell",getSubmenuItems:G("tablecellprops tablemergecells tablesplitcells")}),P.ui.registry.addContextMenu("table",{update:()=>(j.resetTargets(),j.targets().fold(G(""),ia=>cs(ia.element)==="caption"?"tableprops deletetable":"cell row column | advtablesort | tableprops deletetable"))});const ks=am(nu(P));ks.length!==0&&P.queryCommandSupported("mceTableToggleClass")&&P.ui.registry.addNestedMenuItem("tableclass",{icon:"table-classes",text:"Table styles",getSubmenuItems:()=>pa(P,ks,"tableclass",ia=>P.execCommand("mceTableToggleClass",!1,ia)),onSetup:j.onSetupTable});const Sr=am(ar(P));Sr.length!==0&&P.queryCommandSupported("mceTableCellToggleClass")&&P.ui.registry.addNestedMenuItem("tablecellclass",{icon:"table-cell-classes",text:"Cell styles",getSubmenuItems:()=>pa(P,Sr,"tablecellclass",ia=>P.execCommand("mceTableCellToggleClass",!1,ia)),onSetup:j.onSetupCellOrRow}),P.queryCommandSupported("mceTableApplyCellStyle")&&(P.ui.registry.addNestedMenuItem("tablecellvalign",{icon:"vertical-align",text:"Vertical align",getSubmenuItems:()=>pa(P,ta,"tablecellverticalalign",bf(P,"vertical-align")),onSetup:j.onSetupCellOrRow}),P.ui.registry.addNestedMenuItem("tablecellborderwidth",{icon:"border-width",text:"Border width",getSubmenuItems:()=>pa(P,Ba(P),"tablecellborderwidth",bf(P,"border-width")),onSetup:j.onSetupCellOrRow}),P.ui.registry.addNestedMenuItem("tablecellborderstyle",{icon:"border-style",text:"Border style",getSubmenuItems:()=>pa(P,Td(P),"tablecellborderstyle",bf(P,"border-style")),onSetup:j.onSetupCellOrRow}),P.ui.registry.addNestedMenuItem("tablecellbackgroundcolor",{icon:"cell-background-color",text:"Background color",getSubmenuItems:()=>Ym(P,Ma(P),"background-color"),onSetup:j.onSetupCellOrRow}),P.ui.registry.addNestedMenuItem("tablecellbordercolor",{icon:"cell-border-color",text:"Border color",getSubmenuItems:()=>Ym(P,vf(P),"border-color"),onSetup:j.onSetupCellOrRow})),ft("tablecaption",{icon:"table-caption",text:"Table caption",command:"mceTableToggleCaption",onSetup:j.onSetupTableWithCaption}),ft("tablerowheader",{text:"Row header",icon:"table-top-header",command:"mceTableRowType",onAction:_a(P),onSetup:j.onSetupTableRowHeaders}),ft("tablecolheader",{text:"Column header",icon:"table-left-header",command:"mceTableColType",onAction:Km(P),onSetup:j.onSetupTableRowHeaders})},Gp=P=>{const j=r0(P);Ql(P),Ml(P),Ny(P,j),a0(P,j),Zp(P)};var m_=()=>{o.add("table",Gp)};m_()})();(function(){const o=R=>{let F=R;return{get:()=>F,set:G=>{F=G}}};var r=tinymce.util.Tools.resolve("tinymce.PluginManager");const l=(R,F)=>{R.dispatch("VisualBlocks",{state:F})},u=(R,F,W)=>{R.dom.toggleClass(R.getBody(),"mce-visualblocks"),W.set(!W.get()),l(R,W.get())},g=(R,F,W)=>{R.addCommand("mceVisualBlocks",()=>{u(R,F,W)})},h=R=>F=>F.options.get(R),b=R=>{const F=R.options.register;F("visualblocks_default_state",{processor:"boolean",default:!1})},x=h("visualblocks_default_state"),S=(R,F,W)=>{R.on("PreviewFormats AfterPreviewFormats",Z=>{W.get()&&R.dom.toggleClass(R.getBody(),"mce-visualblocks",Z.type==="afterpreviewformats")}),R.on("init",()=>{x(R)&&u(R,F,W)})},_=(R,F)=>W=>{W.setActive(F.get());const Z=G=>W.setActive(G.state);return R.on("VisualBlocks",Z),()=>R.off("VisualBlocks",Z)},N=(R,F)=>{const W=()=>R.execCommand("mceVisualBlocks");R.ui.registry.addToggleButton("visualblocks",{icon:"visualblocks",tooltip:"Show blocks",onAction:W,onSetup:_(R,F),context:"any"}),R.ui.registry.addToggleMenuItem("visualblocks",{text:"Show blocks",icon:"visualblocks",onAction:W,onSetup:_(R,F),context:"any"})};var D=()=>{r.add("visualblocks",(R,F)=>{b(R);const W=o(!1);g(R,F,W),N(R,W),S(R,F,W)})};D()})();(function(){const o=(_t,Tt,Cn)=>{var zn;return Cn(_t,Tt.prototype)?!0:((zn=_t.constructor)===null||zn===void 0?void 0:zn.name)===Tt.name},r=_t=>{const Tt=typeof _t;return _t===null?"null":Tt==="object"&&Array.isArray(_t)?"array":Tt==="object"&&o(_t,String,(Cn,zn)=>zn.isPrototypeOf(Cn))?"string":Tt},l=_t=>Tt=>r(Tt)===_t,u=_t=>Tt=>typeof Tt===_t,g=_t=>Tt=>_t===Tt,h=l("string"),b=l("object"),x=g(null),S=u("boolean"),_=_t=>_t==null,N=_t=>!_(_t),D=u("number");class R{constructor(Tt,Cn){this.tag=Tt,this.value=Cn}static some(Tt){return new R(!0,Tt)}static none(){return R.singletonNone}fold(Tt,Cn){return this.tag?Cn(this.value):Tt()}isSome(){return this.tag}isNone(){return!this.tag}map(Tt){return this.tag?R.some(Tt(this.value)):R.none()}bind(Tt){return this.tag?Tt(this.value):R.none()}exists(Tt){return this.tag&&Tt(this.value)}forall(Tt){return!this.tag||Tt(this.value)}filter(Tt){return!this.tag||Tt(this.value)?this:R.none()}getOr(Tt){return this.tag?this.value:Tt}or(Tt){return this.tag?this:Tt}getOrThunk(Tt){return this.tag?this.value:Tt()}orThunk(Tt){return this.tag?this:Tt()}getOrDie(Tt){if(this.tag)return this.value;throw new Error(Tt??"Called getOrDie on None")}static from(Tt){return N(Tt)?R.some(Tt):R.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(Tt){this.tag&&Tt(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}R.singletonNone=new R(!1);const F=(_t,Tt)=>{const Cn=_t.length,zn=new Array(Cn);for(let $s=0;$s<Cn;$s++){const Jn=_t[$s];zn[$s]=Tt(Jn,$s)}return zn},W=(_t,Tt)=>{for(let Cn=0,zn=_t.length;Cn<zn;Cn++){const $s=_t[Cn];Tt($s,Cn)}},Z=(_t,Tt)=>{const Cn=[];for(let zn=0,$s=_t.length;zn<$s;zn++){const Jn=_t[zn];Tt(Jn,zn)&&Cn.push(Jn)}return Cn},G=Object.keys,K=(_t,Tt)=>{const Cn=G(_t);for(let zn=0,$s=Cn.length;zn<$s;zn++){const Jn=Cn[zn],wr=_t[Jn];Tt(wr,Jn)}},q=_t=>{let Tt=_t;return{get:()=>Tt,set:$s=>{Tt=$s}}},H=typeof window<"u"?window:Function("return this;")(),de=(_t,Tt)=>{let Cn=Tt??H;for(let zn=0;zn<_t.length&&Cn!==void 0&&Cn!==null;++zn)Cn=Cn[_t[zn]];return Cn},Je=(_t,Tt)=>{const Cn=_t.split(".");return de(Cn,Tt)},De=(_t,Tt)=>{let Cn=null;return{cancel:()=>{x(Cn)||(clearTimeout(Cn),Cn=null)},throttle:(...Jn)=>{x(Cn)&&(Cn=setTimeout(()=>{Cn=null,_t.apply(null,Jn)},Tt))}}};var ne=tinymce.util.Tools.resolve("tinymce.PluginManager");const Me=_t=>({isEnabled:()=>_t.get()}),ut=(_t,Tt)=>_t.dispatch("VisualChars",{state:Tt}),st=(_t,Tt)=>{const zn=(Tt||document).createElement("div");if(zn.innerHTML=_t,!zn.hasChildNodes()||zn.childNodes.length>1){const $s="HTML does not have a single root node";throw console.error($s,_t),new Error($s)}return Mt(zn.childNodes[0])},Ne=(_t,Tt)=>{const zn=(Tt||document).createElement(_t);return Mt(zn)},ue=(_t,Tt)=>{const zn=(Tt||document).createTextNode(_t);return Mt(zn)},Mt=_t=>{if(_t==null)throw new Error("Node cannot be null or undefined");return{dom:_t}},ke={fromHtml:st,fromTag:Ne,fromText:ue,fromDom:Mt,fromPoint:(_t,Tt,Cn)=>R.from(_t.dom.elementFromPoint(Tt,Cn)).map(Mt)},M=1,je=3,we=(_t,Tt)=>Je(_t,Tt),ot=(_t,Tt)=>{const Cn=we(_t,Tt);if(Cn==null)throw new Error(_t+" not available on this browser");return Cn},et=Object.getPrototypeOf,ge=_t=>ot("HTMLElement",_t),We=_t=>{const Tt=Je("ownerDocument.defaultView",_t);return b(_t)&&(ge(Tt).prototype.isPrototypeOf(_t)||/^HTML\w*Element$/.test(et(_t).constructor.name))},kt=_t=>_t.dom.nodeType,Ve=_t=>_t.dom.nodeValue,pt=_t=>Tt=>kt(Tt)===_t,Ie=_t=>vt(_t)&&We(_t.dom),vt=pt(M),se=pt(je),pn=(_t,Tt,Cn)=>{if(h(Cn)||S(Cn)||D(Cn))_t.setAttribute(Tt,Cn+"");else throw console.error("Invalid call to Attribute.set. Key ",Tt,":: Value ",Cn,":: Element ",_t),new Error("Attribute value was not simple")},wt=(_t,Tt,Cn)=>{pn(_t.dom,Tt,Cn)},St=(_t,Tt)=>{const Cn=_t.dom.getAttribute(Tt);return Cn===null?void 0:Cn},zt=(_t,Tt)=>{_t.dom.removeAttribute(Tt)},mt=(_t,Tt)=>{const Cn=St(_t,Tt);return Cn===void 0||Cn===""?[]:Cn.split(" ")},ee=(_t,Tt,Cn)=>{const $s=mt(_t,Tt).concat([Cn]);return wt(_t,Tt,$s.join(" ")),!0},le=(_t,Tt,Cn)=>{const zn=Z(mt(_t,Tt),$s=>$s!==Cn);return zn.length>0?wt(_t,Tt,zn.join(" ")):zt(_t,Tt),!1},ie=_t=>_t.dom.classList!==void 0,te=_t=>mt(_t,"class"),ye=(_t,Tt)=>ee(_t,"class",Tt),Be=(_t,Tt)=>le(_t,"class",Tt),Re=(_t,Tt)=>{ie(_t)?_t.dom.classList.add(Tt):ye(_t,Tt)},dt=_t=>{(ie(_t)?_t.dom.classList:te(_t)).length===0&&zt(_t,"class")},Ue=(_t,Tt)=>{ie(_t)?_t.dom.classList.remove(Tt):Be(_t,Tt),dt(_t)},bt=_t=>_t.dom.contentEditable,Dt={" ":"nbsp","­":"shy"},mn=(_t,Tt)=>{let Cn="";return K(_t,(zn,$s)=>{Cn+=$s}),new RegExp("["+Cn+"]",Tt?"g":"")},Et=_t=>{let Tt="";return K(_t,Cn=>{Tt&&(Tt+=","),Tt+="span.mce-"+Cn}),Tt},Rt=mn(Dt),tn=mn(Dt,!0),vn=Et(Dt),$o="mce-nbsp",Yn=_t=>'<span data-mce-bogus="1" class="mce-'+Dt[_t]+'">'+_t+"</span>",Ft=_t=>_t.nodeName.toLowerCase()==="span"&&_t.classList.contains("mce-nbsp-wrap"),on=_t=>{const Tt=Ve(_t);return se(_t)&&h(Tt)&&Rt.test(Tt)},wn=_t=>Ie(_t)&&bt(_t)==="false",On=(_t,Tt)=>{if(Ie(_t)&&!Ft(_t.dom)){const Cn=bt(_t);if(Cn==="true")return!0;if(Cn==="false")return!1}return Tt},po=(_t,Tt,Cn)=>{let zn=[];const $s=_t.dom,Jn=F($s.childNodes,ke.fromDom),wr=cs=>Ft(cs.dom)||!wn(cs);return W(Jn,cs=>{Cn&&wr(cs)&&Tt(cs)&&(zn=zn.concat([cs])),zn=zn.concat(po(cs,Tt,On(cs,Cn)))}),zn},_o=(_t,Tt)=>{for(;_t.parentNode;){if(_t.parentNode===Tt)return Tt;_t=_t.parentNode}},Ko=_t=>_t.replace(tn,Yn),jo=(_t,Tt)=>{const Cn=_t.dom,zn=po(ke.fromDom(Tt),on,_t.dom.isEditable(Tt));W(zn,$s=>{var Jn;const wr=$s.dom.parentNode;if(Ft(wr))Re(ke.fromDom(wr),$o);else{const cs=Ko(Cn.encode((Jn=Ve($s))!==null&&Jn!==void 0?Jn:"")),bl=Cn.create("div",{},cs);let tt;for(;tt=bl.lastChild;)Cn.insertAfter(tt,$s.dom);_t.dom.remove($s.dom)}})},Ws=(_t,Tt)=>{const Cn=_t.dom.select(vn,Tt);W(Cn,zn=>{Ft(zn)?Ue(ke.fromDom(zn),$o):_t.dom.remove(zn,!0)})},bn=_t=>{const Tt=_t.getBody(),Cn=_t.selection.getBookmark();let zn=_o(_t.selection.getNode(),Tt);zn=zn!==void 0?zn:Tt,Ws(_t,zn),jo(_t,zn),_t.selection.moveToBookmark(Cn)},No=(_t,Tt)=>{ut(_t,Tt.get());const Cn=_t.getBody();Tt.get()===!0?jo(_t,Cn):Ws(_t,Cn)},or=(_t,Tt)=>{Tt.set(!Tt.get());const Cn=_t.selection.getBookmark();No(_t,Tt),_t.selection.moveToBookmark(Cn)},Zr=(_t,Tt)=>{_t.addCommand("mceVisualChars",()=>{or(_t,Tt)})},Tr=_t=>Tt=>Tt.options.get(_t),Ln=_t=>{const Tt=_t.options.register;Tt("visualchars_default_state",{processor:"boolean",default:!1})},Kr=Tr("visualchars_default_state"),bs=(_t,Tt)=>{_t.on("init",()=>{No(_t,Tt)})},Zl=(_t,Tt)=>{const Cn=De(()=>{bn(_t)},300);_t.on("keydown",zn=>{Tt.get()===!0&&(zn.keyCode===13?bn(_t):Cn.throttle())}),_t.on("remove",Cn.cancel)},Ss=(_t,Tt)=>Cn=>{Cn.setActive(Tt.get());const zn=$s=>Cn.setActive($s.state);return _t.on("VisualChars",zn),()=>_t.off("VisualChars",zn)},ro=(_t,Tt)=>{const Cn=()=>_t.execCommand("mceVisualChars");_t.ui.registry.addToggleButton("visualchars",{tooltip:"Show invisible characters",icon:"visualchars",onAction:Cn,onSetup:Ss(_t,Tt),context:"any"}),_t.ui.registry.addToggleMenuItem("visualchars",{text:"Show invisible characters",icon:"visualchars",onAction:Cn,onSetup:Ss(_t,Tt),context:"any"})};var ya=()=>{ne.add("visualchars",_t=>{Ln(_t);const Tt=q(Kr(_t));return Zr(_t,Tt),ro(_t,Tt),Zl(_t,Tt),bs(_t,Tt),Me(Tt)})};ya()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const l=(ee=>le=>ee===le)(null),u=ee=>ee,g=(ee,le)=>{const ie=ee.length,te=new Array(ie);for(let ye=0;ye<ie;ye++){const Be=ee[ye];te[ye]=le(Be,ye)}return te},h=(ee,le)=>{let ie=null;return{cancel:()=>{l(ie)||(clearTimeout(ie),ie=null)},throttle:(...Be)=>{l(ie)&&(ie=setTimeout(()=>{ie=null,ee.apply(null,Be)},le))}}},b=ee=>ee.replace(/\uFEFF/g,""),S={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:"[~№|!-*+-\\/:;?@\\[-`{}¡«·»¿;·՚-՟։֊־׀׃׆׳״؉؊،؍؛؞؟٪-٭۔܀-܍߷-߹࠰-࠾࡞।॥॰෴๏๚๛༄-༒༺-༽྅࿐-࿔࿙࿚၊-၏჻፡-፨᐀᙭᙮᚛᚜᛫-᛭᜵᜶។-៖៘-៚᠀-᠊᥄᥅᨞᨟᪠-᪦᪨-᪭᭚-᭠᯼-᯿᰻-᰿᱾᱿᳓‐-‧‰-⁃⁅-⁑⁓-⁞⁽⁾₍₎〈〉❨-❵⟅⟆⟦-⟯⦃-⦘⧘-⧛⧼⧽⳹-⳼⳾⳿⵰⸀-⸮⸰⸱、-〃〈-】〔-〟〰〽゠・꓾꓿꘍-꘏꙳꙾꛲-꛷꡴-꡷꣎꣏꣸-꣺꤮꤯꥟꧁-꧍꧞꧟꩜-꩟꫞꫟꯫﴾﴿︐-︙︰-﹒﹔-﹡﹣﹨﹪﹫!-#%-*,-/:;?@[-]_{}⦅-・]"},_={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},N=[new RegExp(S.aletter),new RegExp(S.midnumlet),new RegExp(S.midletter),new RegExp(S.midnum),new RegExp(S.numeric),new RegExp(S.cr),new RegExp(S.lf),new RegExp(S.newline),new RegExp(S.extend),new RegExp(S.format),new RegExp(S.katakana),new RegExp(S.extendnumlet),new RegExp("@")],D="",R=new RegExp("^"+S.punctuation+"$"),F=/^\s+$/,W=N,Z=_.OTHER,G=ee=>{let le=Z;const ie=W.length;for(let te=0;te<ie;++te){const ye=W[te];if(ye&&ye.test(ee)){le=te;break}}return le},K=ee=>{const le={};return ie=>{if(le[ie])return le[ie];{const te=ee(ie);return le[ie]=te,te}}},q=ee=>{const le=K(G);return g(ee,le)},H=(ee,le)=>{const ie=ee[le],te=ee[le+1];if(le<0||le>ee.length-1&&le!==0||ie===_.ALETTER&&te===_.ALETTER)return!1;const ye=ee[le+2];if(ie===_.ALETTER&&(te===_.MIDLETTER||te===_.MIDNUMLET||te===_.AT)&&ye===_.ALETTER)return!1;const Be=ee[le-1];return(ie===_.MIDLETTER||ie===_.MIDNUMLET||te===_.AT)&&te===_.ALETTER&&Be===_.ALETTER||(ie===_.NUMERIC||ie===_.ALETTER)&&(te===_.NUMERIC||te===_.ALETTER)||(ie===_.MIDNUM||ie===_.MIDNUMLET)&&te===_.NUMERIC&&Be===_.NUMERIC||ie===_.NUMERIC&&(te===_.MIDNUM||te===_.MIDNUMLET)&&ye===_.NUMERIC||(ie===_.EXTEND||ie===_.FORMAT)&&(te===_.ALETTER||te===_.NUMERIC||te===_.KATAKANA||te===_.EXTEND||te===_.FORMAT)||(te===_.EXTEND||te===_.FORMAT&&(ye===_.ALETTER||ye===_.NUMERIC||ye===_.KATAKANA||ye===_.EXTEND||ye===_.FORMAT))&&(ie===_.ALETTER||ie===_.NUMERIC||ie===_.KATAKANA||ie===_.EXTEND||ie===_.FORMAT)||ie===_.CR&&te===_.LF?!1:ie===_.NEWLINE||ie===_.CR||ie===_.LF||te===_.NEWLINE||te===_.CR||te===_.LF?!0:!(ie===_.KATAKANA&&te===_.KATAKANA||te===_.EXTENDNUMLET&&(ie===_.ALETTER||ie===_.NUMERIC||ie===_.KATAKANA||ie===_.EXTENDNUMLET)||ie===_.EXTENDNUMLET&&(te===_.ALETTER||te===_.NUMERIC||te===_.KATAKANA)||ie===_.AT)},de=D,Je=F,De=R,ne=ee=>ee==="http"||ee==="https",Me=(ee,le)=>{let ie;for(ie=le;ie<ee.length&&!Je.test(ee[ie]);ie++);return ie},ut=(ee,le)=>{const ie=Me(ee,le+1);return ee.slice(le+1,ie).join(de).substr(0,3)==="://"?ie:le},st=(ee,le,ie,te)=>{const ye=[],Be=[];let Re=[];for(let dt=0;dt<ie.length;++dt)if(Re.push(ee[dt]),H(ie,dt)){const Ue=le[dt];if((te.includeWhitespace||!Je.test(Ue))&&(te.includePunctuation||!De.test(Ue))){const bt=dt-Re.length+1,Dt=dt+1,mn=le.slice(bt,Dt).join(de);if(ne(mn)){const Et=ut(le,dt),Rt=ee.slice(Dt,Et);Array.prototype.push.apply(Re,Rt),dt=Et}le[dt+1]==="."&&/^([a-zA-Z]\.)+$/.test(mn+".")?(Re.push(ee[dt+1]),Be.push({start:bt,end:Dt+1})):Be.push({start:bt,end:Dt}),ye.push(Re)}Re=[]}return{words:ye,indices:Be}},Ne=()=>({includeWhitespace:!1,includePunctuation:!1}),ue=(ee,le,ie)=>{ie={...Ne(),...ie};const te=g(ee,le),ye=q(te);return st(ee,te,ye,ie)},be=(ee,le,ie)=>ue(ee,le,ie).words;var ke=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker");const M=(ee,le)=>{const ie=le.getBlockElements(),te=le.getVoidElements(),ye=bt=>ie[bt.nodeName]||te[bt.nodeName],Be=[];let Re="";const dt=new ke(ee,ee);let Ue;for(;Ue=dt.next();)Ue.nodeType===3?Re+=b(Ue.data):ye(Ue)&&Re.length&&(Be.push(Re),Re="");return Re.length&&Be.push(Re),Be},je=ee=>ee.replace(/\u200B/g,""),we=ee=>ee.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length,ot=(ee,le)=>{const ie=je(M(ee,le).join(`
121
- `));return be(ie.split(""),u).length},et=(ee,le)=>{const ie=M(ee,le).join("");return we(ie)},ge=(ee,le)=>{const ie=M(ee,le).join("").replace(/\s/g,"");return we(ie)},We=(ee,le)=>()=>le(ee.getBody(),ee.schema),kt=(ee,le)=>()=>le(ee.selection.getRng().cloneContents(),ee.schema),Ve=ee=>We(ee,ot),pt=ee=>({body:{getWordCount:Ve(ee),getCharacterCount:We(ee,et),getCharacterCountWithoutSpaces:We(ee,ge)},selection:{getWordCount:kt(ee,ot),getCharacterCount:kt(ee,et),getCharacterCountWithoutSpaces:kt(ee,ge)},getCount:Ve(ee)}),Ie=(ee,le)=>{ee.windowManager.open({title:"Word Count",body:{type:"panel",items:[{type:"table",header:["Count","Document","Selection"],cells:[["Words",String(le.body.getWordCount()),String(le.selection.getWordCount())],["Characters (no spaces)",String(le.body.getCharacterCountWithoutSpaces()),String(le.selection.getCharacterCountWithoutSpaces())],["Characters",String(le.body.getCharacterCount()),String(le.selection.getCharacterCount())]]}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}]})},vt=(ee,le)=>{ee.addCommand("mceWordCount",()=>Ie(ee,le))};var se=tinymce.util.Tools.resolve("tinymce.util.Delay");const pn=(ee,le)=>{ee.dispatch("wordCountUpdate",{wordCount:{words:le.body.getWordCount(),characters:le.body.getCharacterCount(),charactersWithoutSpaces:le.body.getCharacterCountWithoutSpaces()}})},wt=(ee,le)=>{pn(ee,le)},St=(ee,le,ie)=>{const te=h(()=>wt(ee,le),ie);ee.on("init",()=>{wt(ee,le),se.setEditorTimeout(ee,()=>{ee.on("SetContent BeforeAddUndo Undo Redo ViewUpdate keyup",te.throttle)},0),ee.on("remove",te.cancel)})},zt=ee=>{const le=()=>ee.execCommand("mceWordCount");ee.ui.registry.addButton("wordcount",{tooltip:"Word count",icon:"character-count",onAction:le,context:"any"}),ee.ui.registry.addMenuItem("wordcount",{text:"Word count",icon:"character-count",onAction:le,context:"any"})};var mt=(ee=300)=>{o.add("wordcount",le=>{const ie=pt(le);return vt(le,ie),zt(le),St(le,ie,ee),ie})};mt()})();const mOe=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),gOe=(o,r="wps_office")=>{const l=o.split(","),u=l[0].match(/:(.*?);/)[1],g=atob(l[1]);let h=g.length;const b=new Uint8Array(h);for(;h--;)b[h]=g.charCodeAt(h);return new File([b],r,{type:u})},pOe=o=>btoa(o.match(/\w{2}/g).map(r=>String.fromCharCode(parseInt(r,16))).join(""));function hOe(o){if(!o)return[];let r=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,l=new RegExp(`(?:(${r.source}))([\\da-fA-F\\s]+)\\}`,"g"),u=o.match(l);console.log("images",u);const g=[];if(u||(r=/{\\pict[\s\S]+?(\\pngblip-?\d+)?(\\wmetafile8-?\d+)?{\\\*\\blipuid\s?[\da-fA-F]+[\s}]*?/,l=new RegExp(`(?:(${r.source}))([\\da-fA-F\\s]+)\\}`,"g"),u=o.match(l)),u)for(const h of u){let b=!1;if(h.includes("\\pngblip")?b="image/png":h.includes("\\jpegblip")&&(b="image/jpeg"),b){const x=h.replace(r,"").replace(/[^\da-fA-F]/g,""),S=`data:${b};base64,${pOe(x)}`;g.push({base64:S,file:gOe(S)})}}return g}const vOe=(o,r)=>{if(!r)return o;try{const u=new DOMParser().parseFromString(o,"text/html"),g=u.querySelectorAll("img"),b=(r.clipboardData||window.Clipboard).getData("text/rtf"),x=hOe(b);return g.forEach((S,_)=>{var D;const N=S.getAttribute("src");if(N&&N.startsWith("file:")&&(D=x==null?void 0:x[_])!=null&&D.base64){const R=x[_].base64;S.setAttribute("src",R)}}),u.body.innerHTML}catch{return o}},bOe=o=>{const r=atob(o.split(",")[1]),l=o.split(",")[0].split(":")[1].split(";")[0],u=new ArrayBuffer(r.length),g=new Uint8Array(u);for(let h=0;h<r.length;h++)g[h]=r.charCodeAt(h);return new Blob([u],{type:l})},yOe=async o=>{try{const r=bOe(o),l=new FormData;l.append("files",r,"image.png");const g=await(await fetch(`${process.env.NODE_ENV==="development"?"/api":""}/ajax/uploaddoc`,{method:"POST",body:l})).json();if(g.status===1)return g.file_url;throw new Error(g.message)}catch(r){throw r}},wOe=async o=>{const l=new DOMParser().parseFromString(o,"text/html"),u=l.getElementsByTagName("img"),g=[],h=3;for(let b=0;b<u.length;b++){const x=u[b],S=x.getAttribute("src");S&&S.startsWith("data:image")&&(g.push({img:x,src:S,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 b=0;b<g.length;b+=h){const S=g.slice(b,b+h).map(async _=>{try{const N=await yOe(_.src);_.img.setAttribute("src",N)}catch{_.img.remove()}});await Promise.all(S)}return l.body.innerHTML},COe=o=>{o.querySelectorAll("td").forEach(l=>{const u=l.getAttribute("width"),g=l.getAttribute("style")||"";u==="0"&&g.includes("border:none")&&l.remove()})},xOe=o=>{o.querySelectorAll("table").forEach(l=>{l.style.maxWidth="100%"})},SOe=o=>{o.querySelectorAll("table").forEach(l=>{l.style.tableLayout="fixed";const u=l.getAttribute("style")||"";if(u){const g=u.split(";").filter(b=>b.trim()),h=[];g.forEach(b=>{const[x,S]=b.split(":").map(_=>_.trim());x&&S&&(["margin","margin-right","margin-left"].includes(x.toLowerCase())||h.push(`${x}: ${S}`))}),h.some(b=>b.toLowerCase().startsWith("width"))||h.push("width: 100%"),l.setAttribute("style",h.join("; "))}})},EOe=o=>{o.querySelectorAll("table").forEach(l=>{const u=l.querySelectorAll("tr");if(u.length>0){const b=u[0].querySelectorAll("td, th").length;if(b>0){const x=(100/b).toFixed(2);u.forEach(S=>{S.querySelectorAll("td, th").forEach((N,D)=>{const R=N,F=parseInt(R.getAttribute("colspan")||"1"),W=(parseFloat(x)*F).toFixed(2),G=(R.getAttribute("style")||"").split(";").filter(q=>!q.trim().toLowerCase().startsWith("width")).join(";"),K=G?`${G}; width: ${W}%`:`width: ${W}%`;R.setAttribute("style",K)})})}}})},_Oe=o=>{o.querySelectorAll("table").forEach(l=>{const u=l.querySelectorAll("td");let g=!1,h="";for(const b of u){const x=b.getAttribute("style")||"",S=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);(S?S[0]:"").includes("double")&&(g=!0,S&&(h=S[0].replace(/^border(?:-(?:right|left|top|bottom))?(?:-style)?:\s*/,""),b.style.borderTop=h,b.style.borderRight=h,b.style.borderBottom=h,b.style.borderLeft=h))}g&&h&&(l.style.borderCollapse="separate",l.style.borderSpacing="2px",l.style.border=h)})},kOe=o=>{o.querySelectorAll("table").forEach(l=>{l.querySelectorAll("td[rowspan]").forEach(g=>{const x=((g.getAttribute("style")||"").match(/border-[^:]+:[^;]+(?:solid|double)[^;]+/g)||[]).find(S=>!S.includes("none"));if(x){const S=x.split(":")[1].trim();g.style.borderBottom=S}})})},TOe=o=>{o.querySelectorAll('[style*="mso-"]').forEach(l=>{const g=(l.getAttribute("style")||"").replace(/mso-[^:]+:[^;]+;/g,"");l.setAttribute("style",g)})},AOe=o=>{o.querySelectorAll('[style*="tab-stops"]').forEach(l=>{const g=(l.getAttribute("style")||"").replace(/tab-stops:[^;]+;/g,"");l.setAttribute("style",g)})},NOe=o=>{o=o.replace(/<a(?!.*?href=)[^>]*>([\s\S]*?)<\/a>/gi,"$1");const l=new DOMParser().parseFromString(o,"text/html");return COe(l),xOe(l),_Oe(l),kOe(l),TOe(l),AOe(l),SOe(l),EOe(l),o=l.body.innerHTML,o};Q9.PluginManager.add("pasteprocess",o=>(o.on("paste",r=>{if(r.clipboardData){const l=r.clipboardData.getData("text/html")||r.clipboardData.getData("text");if(mOe(l)){r.preventDefault();const u=o.windowManager.open({title:"处理中",body:{type:"panel",items:[{type:"htmlpanel",html:'<div style="text-align: center; padding: 20px;">正在处理Word内容,请稍候...</div>'}]},buttons:[]}),g=NOe(l),h=vOe(g,r);wOe(h).then(b=>{o.insertContent(b),u.close()})}}}),{}));let s9="A4";const ute={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}},DOe=Object.keys(ute).map(o=>`pagesize${o}`).join(" ");Q9.PluginManager.add("pagesize",o=>{const r=o.options.register;r("pagesize",{processor:"string",default:"A4"}),s9=(g=>h=>h.options.get(g))("pagesize")(o);const u=g=>{const h=ute[g];if(h){const b=(window.devicePixelRatio||1)*96,x=h.width*b/25.4;o!=null&&o.container&&(o.container.style.minWidth=`${x}px`);const S=o.contentAreaContainer.querySelector("iframe");S&&(S.style.width=`${x}px`),o.fire("pagesizechange",{size:g})}};return Object.keys(ute).forEach(g=>{o.ui.registry.addToggleMenuItem(`pagesize${g}`,{text:g,onAction:()=>{s9=g,u(g)},onSetup:h=>(h.setActive(s9===g),()=>{})})}),o.on("init",()=>{u(s9)}),{}});const OOe=["accordion","advlist","anchor","autolink","autosave","charmap","directionality","importcss","insertdatetime","lists","image","media","pagebreak","preview","save","searchreplace","table","fullscreen","wordcount","pasteprocess","pagesize"],$Oe="undo redo | blocks bold italic forecolor removeformat alignleft aligncenter alignright alignjustify outdent indent pagebreakfullscreen preview",BOe={license_key:"gpl",skin:!1,content_css:["css/content.css","css/reset.css"],promotion:!1,menu:{pagesize:{title:"页面大小",items:DOe}},menubar:"file edit insert table tools help pagesize",cleanup:!0,branding:!1,language:"zh_CN",plugins:OOe,toolbar:$Oe,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((r,l)=>{const u=new FormData;u.append("files",o.blob(),o.filename()),fetch(`${process.env.NODE_ENV==="development"?"/api":""}/ajax/uploaddoc`,{method:"POST",body:u}).then(g=>g.json()).then(g=>{g.status===1?r(g.file_url):l(`上传失败: ${g.message}`)}).catch(g=>{l(`上传出错: ${g.message}`)})})},MOe={name:"ProEditor",components:{Editor:dOe},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:r}){Vm(o.modelValue);const l=d.ref(null),u=d.reactive({myInit:h(BOe),contentValue:o.modelValue,timeout:null});d.onMounted(()=>{Q9.init({license_key:"gpl"}),Q9.activeEditor.on("pagesizechange",b=>{r("update:pagesize",b.size)})}),d.watch(()=>u.contentValue,()=>{g(()=>{r("update:modelValue",u.contentValue)})}),d.watch(()=>o.modelValue,b=>{!q9(b)&&b!==u.contentValue&&(u.contentValue=b)}),d.watch(()=>o.height,b=>{var x,S,_,N,D,R,F,W;l.value&&((W=(N=(_=(S=(x=l.value)==null?void 0:x.getEditor)==null?void 0:S.call(x))==null?void 0:_.dom)==null?void 0:N.setStyle)==null||W.call(N,(F=(R=(D=l.value)==null?void 0:D.getEditor)==null?void 0:R.call(D))==null?void 0:F.editorContainer,"height",b+"px"))});function g(b,x=400){u.timeout!==null&&clearTimeout(u.timeout),u.timeout=setTimeout(b,x)}function h(b){var N;o!=null&&o.height&&(b.height=o.height),o!=null&&o.width&&(b.width=o.width);const{placeholder:x,pagesize:S}=o,_=`${location==null?void 0:location.origin}/${q9(window==null?void 0:window.zyuiAssetsPath)?"assets/":window==null?void 0:window.zyuiAssetsPath}`;return b={...b,content_css:(N=b==null?void 0:b.content_css)==null?void 0:N.map(D=>D.includes("http")?D:`${_}${D}`),placeholder:x,...o.hasPagesize&&{menu:{...b.menu,pagesize:b.menu.pagesize},menubar:b.menubar.includes("pagesize")?b.menubar:`${b.menubar} pagesize`,pagesize:S},...!o.hasPagesize&&{menu:Object.fromEntries(Object.entries(b.menu).filter(([D])=>D!=="pagesize")),menubar:b.menubar.replace(/pagesize/g,"").trim(),pagesize:""}},b}return{...d.toRefs(u),editorRef:l,customer:h,debounce:g}}},ROe={class:"my-tinymce"};function IOe(o,r,l,u,g,h){const b=d.resolveComponent("Editor");return d.openBlock(),d.createElementBlock("div",ROe,[d.createVNode(b,{modelValue:o.contentValue,"onUpdate:modelValue":r[0]||(r[0]=x=>o.contentValue=x),init:o.myInit,ref:"editorRef"},null,8,["modelValue","init"])])}const Fue=vl(MOe,[["render",IOe]]),POe={name:"ShadowDomWrap",setup(o,{emit:r,expose:l}){const u=d.ref(null),g=d.ref(),h=d.ref(!1),b=S=>{if(S.target.closest(".context-menu")||!u.value)return;const N=u.value.contains(S.target);!N&&h.value?(h.value=!1,r("onBlur")):N&&!h.value&&(h.value=!0,r("onFocus"))},x=S=>{h.value=!0,r("onFocus"),S.stopPropagation()};return d.onMounted(()=>{var D,R,F;g.value=(D=u.value)==null?void 0:D.attachShadow({mode:"open"}),document.addEventListener("click",b);const S=q9(window==null?void 0:window.zyuiAssetsPath)?"assets/":window==null?void 0:window.zyuiAssetsPath,_=document.createElement("link");_.rel="stylesheet",_.href=`${location==null?void 0:location.origin}/${S}css/index.min.css`,(R=g.value)==null||R.appendChild(_);const N=document.createElement("link");N.rel="stylesheet",N.href=`${location==null?void 0:location.origin}/${S}css/reset.css`,(F=g.value)==null||F.appendChild(N)}),d.onUnmounted(()=>{document.removeEventListener("click",b)}),l({focus:()=>{h.value=!0}}),{shadowHost:u,shadowRoot:g,handleClick:x}}};function FOe(o,r,l,u,g,h){return d.openBlock(),d.createElementBlock("div",{ref:"shadowHost",class:"shadow-host",onClick:r[0]||(r[0]=d.withModifiers((...b)=>u.handleClick&&u.handleClick(...b),["stop"]))},[u.shadowRoot?(d.openBlock(),d.createBlock(d.Teleport,{key:0,to:u.shadowRoot},[d.renderSlot(o.$slots,"default")],8,["to"])):d.createCommentVNode("",!0)],512)}const yne=vl(POe,[["render",FOe]]),LOe=["innerHTML"],Lue=d.defineComponent({__name:"index",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const r=d.useModel(o,"modelValue");return(l,u)=>(d.openBlock(),d.createBlock(yne,null,{default:d.withCtx(()=>[d.createElementVNode("div",{innerHTML:r.value},null,8,LOe)]),_:1}))}}),Vue=Symbol("nodesUI"),cf=()=>{const o=d.inject(Vue);if(!o)throw new Error("NodesUI context not found");return o};function wne(o){if(!o||!o.ownerDocument)return null;const r=[];let l=o;for(;l&&l.nodeType===Node.ELEMENT_NODE;){let u=l.nodeName.toLowerCase();if(l.id){u=`#${CSS.escape(l.id)}`,r.unshift(u);break}if(l.className&&typeof l.className=="string"){const g=l.className.trim().split(/\s+/);g.length>0&&g[0]&&(u+=`.${CSS.escape(g[0])}`)}if(l.parentElement){const h=Array.from(l.parentElement.children).filter(b=>b.nodeName.toLowerCase()===l.nodeName.toLowerCase());if(h.length>1){const b=h.indexOf(l)+1;u+=`:nth-of-type(${b})`}}if(r.unshift(u),l=l.parentElement,l&&(l.nodeName.toLowerCase()==="body"||l.nodeName.toLowerCase()==="html"))break}return r.length?r.join(" > "):null}function VOe(o,r){if(!r)return null;try{return(r.shadowRoot||r).querySelector(`#${CSS.escape(o)}`)}catch(l){return console.error("nodePath query error:",l),null}}function Hue(o,r){if(!r)return null;try{return(r.shadowRoot||r).querySelector(o)}catch(l){return console.error("nodePath query error:",l),null}}const Q3=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}`:""),zue=o=>{if(o.nodeType===Node.TEXT_NODE)return o;let r=null;for(let l=o.childNodes.length-1;l>=0;l--){const u=o.childNodes[l],g=zue(u);if(g){r=g;break}}return r},HOe=(o,r,l)=>{var u,g,h;if(!Cne(o)){const b=l==null?void 0:l.getRootNode(),x=(u=b==null?void 0:b.getSelection)==null?void 0:u.call(b),S=Hue(o.nodePath,l);if(x&&o.startOffset!==void 0&&r&&S){const _=document.createRange(),N=(o==null?void 0:o.textNodeIndex)||0,D=S.childNodes[N]||S;let R,F;if(D.nodeType===Node.TEXT_NODE)R=D,F=Math.min(o.startOffset,((g=D.textContent)==null?void 0:g.length)||0);else{const Z=zue(D);Z?(R=Z,F=((h=Z.textContent)==null?void 0:h.length)||0):(R=D,F=0)}_.setStart(R,F),_.setEnd(R,F);const W=document.createElement("span");W.classList.add("empty-text-node"),_.insertNode(W),_.insertNode(r),_.setStartAfter(r),_.collapse(!0),x.removeAllRanges(),x.addRange(_)}}},zOe=(o,r)=>{r!=null&&r.id&&(o.id=r==null?void 0:r.id),(r==null?void 0:r.nodePath)!==void 0&&o.setAttribute("data-nodePath",r.nodePath),(r==null?void 0:r.textNodeIndex)!==void 0&&r.textNodeIndex>=0&&o.setAttribute("data-textNodeIndex",r.textNodeIndex.toString()),r.startOffset!==void 0&&r.startOffset>=0&&o.setAttribute("data-startOffset",r.startOffset.toString()),(r==null?void 0:r.subNodeSort)!==void 0&&r.subNodeSort>=0&&o.setAttribute("data-subNodeSort",r.subNodeSort.toString()),(r==null?void 0:r.groupKey)!==void 0&&o.setAttribute("data-groupKey",r.groupKey)},UOe=o=>{const r=o.parentNode;if(!r)return-1;let l=0;for(let u=0;u<r.childNodes.length;u++){const g=r.childNodes[u];if(g===o)return l;l++,g.nodeType===Node.ELEMENT_NODE&&(g.classList.contains("node-item")&&(l-=2,l<0&&(l=0)),g.classList.contains("empty-text-node")&&(l-=1,l<0&&(l=0)))}return-1},jOe=o=>{const r=o.closest("TD"),l=o.closest(".node-item");let u=null;if(l?u=l:r&&r.classList.contains("node-item-td")&&(u=r),!u)return null;const g=u||o;let h=g==null?void 0:g.getAttribute("data-nodePath");if(h||(h=wne(g)),(g==null?void 0:g.getAttribute("selectable"))==="false")return null;const b={element:g,nodePath:h},x=g==null?void 0:g.getAttribute("data-textNodeIndex");x&&(b.textNodeIndex=Number(x));const S=g==null?void 0:g.getAttribute("data-startOffset");S&&(b.startOffset=Number(S));const _=g==null?void 0:g.getAttribute("data-subNodeSort");_&&(b.subNodeSort=Number(_));const N=g==null?void 0:g.getAttribute("data-groupKey");N&&(b.groupKey=N);const D=g==null?void 0:g.getAttribute("id");return D&&(b.id=D),b},Uue=o=>o2e(o,r=>d.toValue(r.nodes).map(l=>({...l,color:r.color,activated:r==null?void 0:r.activated,dataGroupKey:r.id}))),eH=(o,r)=>{const l=o.startsWith("#")?o.slice(1):o;let u,g,h;if(l.length===3)u=parseInt(l[0]+l[0],16),g=parseInt(l[1]+l[1],16),h=parseInt(l[2]+l[2],16);else if(l.length===6)u=parseInt(l.substring(0,2),16),g=parseInt(l.substring(2,4),16),h=parseInt(l.substring(4,6),16);else return console.warn("Invalid color format:",o),`rgba(0, 0, 0, ${r})`;return`rgba(${u}, ${g}, ${h}, ${r})`},WOe=o=>{const{element:r}=o;if(!r)return null;if(r.tagName.toLowerCase()!=="td")return{showTextType:"input"};const u=r.closest("tr"),g=Array.from(u.parentElement.children).indexOf(u),h=Array.from(u.children).indexOf(r),b=r.closest("table"),x=r.closest("body").querySelectorAll("table");return{showTextType:"cell",tableIndex:Array.from(x).indexOf(b)+1,colIndex:h,rowIndex:g}},ZOe=(o,r)=>{var g,h;let l=1;const u=(g=o==null?void 0:o.map(b=>r==null?void 0:r.find(x=>(x==null?void 0:x.id)===(b==null?void 0:b.id))))==null?void 0:g.filter(Boolean);return(u==null?void 0:u.length)>0?(h=u==null?void 0:u.map(x=>{const S=WOe(x);return S?(S==null?void 0:S.showTextType)==="input"?{...x,...S,inputIndex:l++}:{...x,...S}:null}))==null?void 0:h.filter(Boolean):[]};function GOe(o){if(!o||o.length===0)return[];const r=[...o].sort((g,h)=>g.rowIndex!==h.rowIndex?g.rowIndex-h.rowIndex:g.colIndex-h.colIndex),l=[],u=new Set;for(const g of r){if(u.has(g))continue;const h=[];let b=0,x=0;for(let S=g.colIndex;r.find(N=>N.rowIndex===g.rowIndex&&N.colIndex===S&&!u.has(N));S++)x++;if(x!==0){b=x;for(let S=g.rowIndex;;S++){let _=0;const N=[];for(let D=g.colIndex;D<g.colIndex+b;D++){const R=r.find(F=>F.rowIndex===S&&F.colIndex===D&&!u.has(F));if(R)_++,N.push(R);else break}if(_===b)h.push(...N);else break}h.length>0&&(l.push([...h]),h.forEach(S=>u.add(S)))}}return l}function qOe(o){if(!o||o.length===0)return{min:null,max:null};let r=o[0],l=o[0];for(const u of o)(u.colIndex<r.colIndex||u.colIndex===r.colIndex&&u.rowIndex<r.rowIndex)&&(r=u),(u.colIndex>l.colIndex||u.colIndex===l.colIndex&&u.rowIndex>l.rowIndex)&&(l=u);return{min:r,max:l}}const jue=(o,r)=>{var _;const l=ZOe(o,r||[]),u=[],g=[];(_=d.toValue(l))==null||_.forEach(N=>{(N==null?void 0:N.showTextType)==="input"?u.push(N):g.push(N)});const h=a2e(g,"tableIndex"),b=Object.entries(h).map(([N,D])=>({tableIndex:Number(N),nodes:D})),x=Tce(b==null?void 0:b.map(N=>GOe(N==null?void 0:N.nodes))),S=(x==null?void 0:x.map(N=>qOe(N)))||[];return[...u,...S]},d4=o=>{function r(l){let u="";for(;l>=0;)u=String.fromCharCode(65+l%26)+u,l=Math.floor(l/26)-1;return u}return(o==null?void 0:o.colIndex)>=0&&(o==null?void 0:o.rowIndex)>=0?`${r(o==null?void 0:o.colIndex)}${o==null?void 0:o.rowIndex}`:""},YOe=(o,r)=>{const l=jue(o,r||[]),u=[];return l==null||l.forEach(g=>{var h,b;(g==null?void 0:g.showTextType)==="input"?u.push(`填写${g==null?void 0:g.inputIndex}`):u.push(((h=g==null?void 0:g.min)==null?void 0:h.id)===((b=g==null?void 0:g.max)==null?void 0:b.id)?d4(g==null?void 0:g.min):`${d4(g==null?void 0:g.min)}:${d4(g==null?void 0:g.max)}`)}),u==null?void 0:u.join(",")},Cne=o=>o.startOffset===void 0&&o.textNodeIndex===void 0,KOe=o=>{var r;if(((r=o.textContent)==null?void 0:r.trim())===""&&o.querySelector("p")){const l=o.querySelector("p");if(l){const u=D=>{const R={};return D&&D.split(";").forEach(F=>{const[W,Z]=F.split(":").map(G=>G.trim());W&&Z&&(R[W]=Z)}),R},g=D=>Object.entries(D).map(([R,F])=>`${R}: ${F}`).join("; "),h=u(o.getAttribute("style")||""),b=u(l.getAttribute("style")||""),x=l.querySelectorAll("span");let S={};x.forEach(D=>{const R=u(D.getAttribute("style")||"");S={...S,...R}});const _={...h,...b,...S},N=g(_);N&&o.setAttribute("style",N),o.removeChild(l)}}},XOe=o=>{var l;return(l=ua(o))==null?void 0:l.map(u=>(u==null||delete u.element,u))},JOe={key:0,class:"td-node"},QOe={key:1},e$e=d.defineComponent({__name:"index",props:{node:{}},setup(o){const r=o,l=d.computed(()=>{var u,g;return((g=(u=r==null?void 0:r.node)==null?void 0:u.element)==null?void 0:g.tagName)==="TD"});return(u,g)=>{var h,b;return l.value?(d.openBlock(),d.createElementBlock("span",JOe,d.toDisplayString((h=r==null?void 0:r.node)==null?void 0:h.label),1)):(d.openBlock(),d.createElementBlock("span",QOe,d.toDisplayString((b=r==null?void 0:r.node)==null?void 0:b.label),1))}}}),Wue=Symbol("nodesEditor"),Sy=()=>{const o=d.inject(Wue);if(!o)throw new Error("NodesEditor context not found");return o},qH=d.defineComponent({__name:"index",props:{node:{}},setup(o){const r=o,{currentNodes:l}=cf(),{nodes:u,renderType:g,disabledNodes:h}=Sy(),b=d.computed(()=>{var D;return(D=r.node)!=null&&D.id?u.value.some(R=>R.id===r.node.id):!1}),x=d.computed(()=>{var D;if(!((D=r.node)!=null&&D.element))return!1;try{return r.node.element.parentNode!==null}catch(R){return console.warn("Element validation failed:",R),!1}}),S=d.computed(()=>{var F,W;const D=(F=h==null?void 0:h.value)==null?void 0:F.some(Z=>{var G;return(Z==null?void 0:Z.id)===((G=r==null?void 0:r.node)==null?void 0:G.id)}),R=(W=d.toValue(l))==null?void 0:W.find(Z=>{var G;return(Z==null?void 0:Z.id)===((G=r==null?void 0:r.node)==null?void 0:G.id)});return{...r==null?void 0:r.node,...R,disabled:D}}),_=D=>{var F;let R="";if(d.toValue(D==null?void 0:D.activated)&&(R="normal"),D!=null&&D.disabled&&(R="disabled"),(F=r==null?void 0:r.node)!=null&&F.element)switch(R){case"normal":r.node.element.style.setProperty("--node-color",(D==null?void 0:D.color)||"#409eff"),r.node.element.style.setProperty("--node-bg-color",eH((D==null?void 0:D.color)||"#409eff",.1)),r.node.element.setAttribute("data-dataGroupKey",D==null?void 0:D.dataGroupKey),r.node.element.setAttribute("selectable","false"),r.node.element.classList.add("activated");break;case"disabled":r.node.element.style.setProperty("--node-color",(D==null?void 0:D.color)||"#F56C6C"),r.node.element.style.setProperty("--node-bg-color",eH((D==null?void 0:D.color)||"#F56C6C",.1)),r.node.element.setAttribute("data-dataGroupKey",D==null?void 0:D.dataGroupKey),r.node.element.setAttribute("selectable","false"),r.node.element.classList.add("disabled");break;default:N();break}},N=()=>{var D,R,F,W,Z;(D=r==null?void 0:r.node)!=null&&D.element&&((R=r.node.element)==null||R.removeAttribute("data-dataGroupKey"),(F=r.node.element)==null||F.removeAttribute("selectable"),(W=r.node.element)==null||W.classList.remove("activated"),(Z=r.node.element)==null||Z.classList.remove("disabled"))};return d.watch(()=>S,()=>{const D=d.toValue(S);D!=null&&D.id?_(D):N()},{immediate:!0,deep:!0}),(D,R)=>{var F;return(F=D.node)!=null&&F.element&&x.value&&b.value?(d.openBlock(),d.createBlock(d.Teleport,{key:0,to:D.node.element},[d.createElementVNode("div",{class:d.normalizeClass(["node-item-render",`node-item-${d.unref(g)}`])},[d.renderSlot(D.$slots,"default",{node:D.node},()=>[d.createVNode(e$e,{node:D.node},null,8,["node"])])],2)],8,["to"])):d.createCommentVNode("",!0)}}});function t$e(){const o=d.ref(!1),r=u=>{u.key==="Control"&&(o.value=!0)},l=u=>{u.key==="Control"&&(o.value=!1)};return d.onMounted(()=>{window.addEventListener("keydown",r),window.addEventListener("keyup",l)}),d.onUnmounted(()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",l)}),o}function Zue(){const{selectedNodes:o,setSelectedNodes:r,containerRef:l}=cf(),{editorId:u,nodes:g,disabledNodes:h}=Sy(),b=d.ref(!1),x=d.ref({x:0,y:0}),S=d.ref({x:0,y:0}),_=d.ref({left:0,top:0,width:0,height:0}),N=d.ref(null),D=ne=>{const Me=ne.closest(".node-item-td")||ne.closest(".node-item");if(Me!==null){let ut=[];if(Me.classList.contains("node-selected"))return;const st=Me.getAttribute("id");if(st&&g.value){const Ne=g.value.find(ue=>ue.id===st);Ne&&(ut=[Ne])}ut=H(ut),r(ut)}},R=ne=>{var Ne;if(ne.button===2&&D(ne==null?void 0:ne.target),ne.button!==0||(b.value=!0,!N.value))return;const Me=(Ne=l==null?void 0:l.value)==null?void 0:Ne.getBoundingClientRect();if(!Me)return;const ut=ne.clientX-(Me==null?void 0:Me.left),st=ne.clientY-(Me==null?void 0:Me.top);x.value={x:ut,y:st},S.value={x:ut,y:st},K(ne),de(),N.value.style.display="block",window.addEventListener("mousemove",F),window.addEventListener("wheel",W),window.addEventListener("mouseup",Z)},F=aee(ne=>{var Me;if(b.value){const ut=(Me=l==null?void 0:l.value)==null?void 0:Me.getBoundingClientRect();if(!ut)return;const st=ne.clientX-(ut==null?void 0:ut.left),Ne=ne.clientY-(ut==null?void 0:ut.top);S.value={x:st,y:Ne},de()}},16),W=aee(ne=>{b.value&&setTimeout(()=>{var Ne;const Me=(Ne=l==null?void 0:l.value)==null?void 0:Ne.getBoundingClientRect();if(!Me)return;const ut=ne.clientX-(Me==null?void 0:Me.left),st=ne.clientY-(Me==null?void 0:Me.top);S.value={x:ut,y:st},de()},0)},16),Z=ne=>{ne.button===0&&(b.value=!1,N.value&&(de(),N.value.style.display="none",window.removeEventListener("mousemove",F),window.removeEventListener("wheel",W),window.removeEventListener("mouseup",Z)))},G=t$e(),K=ne=>{var ut,st;let Me=[];if(ne.button===0&&(ne!=null&&ne.target)){const Ne=((ut=ne==null?void 0:ne.target)==null?void 0:ut.closest(".node-item-td"))||((st=ne==null?void 0:ne.target)==null?void 0:st.closest(".node-item"));if(Ne!==null){const ue=Ne.getAttribute("id");if(ue&&g.value){const Mt=g.value.find(be=>be.id===ue);Mt&&(G.value?o.value.some(be=>Q3(be)===Q3(Mt))?Me=o.value.filter(ke=>Q3(ke)!==Q3(Mt)):Me=[...o.value,Mt]:Mt&&(Me=[Mt]))}}Me=H(Me),r(Me)}},q=()=>{var Mt;if(!l.value||!(_.value.width>3||_.value.height>3))return;let ne=[];const Me=(Mt=l==null?void 0:l.value)==null?void 0:Mt.getBoundingClientRect(),ut=_.value.left+(Me==null?void 0:Me.left),st=_.value.top+(Me==null?void 0:Me.top),Ne={left:_.value.left+(Me==null?void 0:Me.left),right:ut+_.value.width,top:_.value.top+(Me==null?void 0:Me.top),bottom:st+_.value.height};if(l.value.querySelectorAll("*").forEach(be=>{const ke=be.getBoundingClientRect();if(!Ne)return;const M={left:ke.left,right:ke.right,top:ke.top,bottom:ke.bottom};if(M.right>Ne.left&&M.left<Ne.right&&M.bottom>Ne.top&&M.top<Ne.bottom){const je=be.getAttribute("id");if(je&&g.value){const we=g.value.find(ot=>ot.id===je);we&&(ne=[...ne,we])}}}),ne=H(ne),G.value){const be=new Set(o.value.map(M=>Q3(M))),ke=ne.filter(M=>!be.has(Q3(M)));r([...o.value,...ke])}else r(ne)},H=ne=>{var ut;let Me=[];if(ne.length>0){const st=(ut=ne.map(ke=>ke==null?void 0:ke.groupKey))==null?void 0:ut.filter(Boolean),Ne=new Set(st),ue=Array.from(Ne),Mt=g.value.filter(ke=>ue.includes(ke.groupKey));Me=[...ne,...Mt],Me=[...Wce(Me.filter(ke=>ke==null?void 0:ke.id),"id")||[],...Me.filter(ke=>!ke.id)]}if(h&&h.value&&h.value.length>0){const st=new Set(h.value.map(Ne=>Ne.id).filter(Boolean));Me=Me.filter(Ne=>Ne.id?!st.has(Ne.id):!0)}return Me},de=aee(()=>{if(!N.value||!l.value)return;const{x:ne,y:Me}=x.value,{x:ut,y:st}=S.value,Ne=Math.min(ne,ut),ue=Math.min(Me,st),Mt=Math.abs(ne-ut),be=Math.abs(Me-st);_.value={left:Ne,top:ue,width:Mt,height:be}},16),Je=ne=>{if(!N.value)return;const{left:Me,top:ut,width:st,height:Ne}=d.toValue(ne);N.value.style.left=`${Me}px`,N.value.style.top=`${ut}px`,N.value.style.width=`${st}px`,N.value.style.height=`${Ne}px`},De=()=>{if(!l.value)return;l.value.addEventListener("mousedown",R);const ne=document.getElementById(`select_area_${u}`);if(ne){N.value=ne;return}const Me=document.createElement("div");Me.id=`select_area_${u}`,Me.style.position="absolute",Me.style.border="1px solid #1677ff",Me.style.backgroundColor="rgba(22, 119, 255, 0.05)",Me.style.pointerEvents="none",Me.style.display="none",l.value.appendChild(Me),N.value=Me};return d.watch(_,(ne,Me)=>{da(ne,Me)||(Je(ne),b.value&&q())},{deep:!0}),d.watch(()=>l.value,ne=>{d.toValue(ne)&&De()},{immediate:!0}),d.onUnmounted(()=>{l.value&&l.value.removeEventListener("mousedown",R)}),{isSelecting:b,selectionBox:N}}function Gue(){const{selectedNodes:o,containerRef:r}=cf(),l=()=>{var g;(g=d.toValue(r))==null||g.querySelectorAll(".node-selected").forEach(h=>{h.classList.remove("node-selected")})},u=g=>{g.forEach(h=>{h.classList.add("node-selected")})};d.watch(()=>o,()=>{l(),setTimeout(()=>{var h,b;const g=(b=(h=d.toValue(o))==null?void 0:h.map(x=>{var S;return(S=r.value)==null?void 0:S.querySelector(`[id="${x.id}"]`)}))==null?void 0:b.filter(Boolean);u(g)},0)},{deep:!0})}const J6=()=>{const{nodes:o,updateNodes:r,inputTypes:l}=Sy();return{nodes:o,addNode:S=>{const N=(Array.isArray(S)?S:[S]).map(R=>({...R,id:R.id||JE()})),D=[...o.value,...N];r(D)},removeNode:async S=>{var W,Z;const _=Array.isArray(S)?S:[S],N=[],D=[];_.forEach(G=>{const K=o.value.find(q=>(q==null?void 0:q.id)===G);Cne(K)?N.push(G):D.push(G)});const R=await((Z=(W=l==null?void 0:l.find(G=>{var K;return((K=G.value)==null?void 0:K.toLowerCase())==="text"}))==null?void 0:W.getDefaultProps)==null?void 0:Z.call(W))||{};let F=o.value.filter(G=>!D.includes(G==null?void 0:G.id));F=F==null?void 0:F.map(G=>N.includes(G==null?void 0:G.id)?{id:G==null?void 0:G.id,nodePath:G==null?void 0:G.nodePath,label:"文本",nodeType:"text",props:{...R}}:G),r(F)},editNodes:S=>{const _=Array.isArray(S)?S:[S],N=JE(),D=_.map(F=>{const W={...F};let Z=F==null?void 0:F.id;return Z||(Z=JE(),W.id=Z),W!=null&&W.groupKey||(W.groupKey=N),W}),R=[...o.value];D.forEach(F=>{const W=R.findIndex(Z=>Z.id===F.id);W!==-1?R[W]=F:R.push(F)}),r(R)},insertNodeAt:(S,_)=>{const N=[...o.value];N.splice(_,0,S),r(N)},moveNode:(S,_)=>{const N=[...o.value],[D]=N.splice(S,1);N.splice(_,0,D),r(N)}}};function n$e(){const{removeNode:o}=J6(),{containerRef:r}=cf(),l=d.ref(null),u=h=>{var Z,G;if(h.target instanceof Element&&(h.target.closest(".node-item")||h.target.closest(".node-item-td")||h.target.closest(".disabeld-edit")))return;const b=h.target;if(b===r.value)return;const S=((Z=r.value)==null?void 0:Z.getRootNode()).getSelection(),_=(G=r.value)==null?void 0:G.querySelectorAll('[contenteditable="true"]');_==null||_.forEach(K=>{K.setAttribute("contenteditable","false")});const N=b.textContent||"",D=b.innerHTML||"";l.value=b,b.setAttribute("contenteditable","true"),b.focus();const R=new MutationObserver(()=>{b.textContent!==N&&(b.innerHTML=D)});R.observe(b,{characterData:!0,childList:!0,subtree:!0});const F=K=>{K.preventDefault()};b.addEventListener("input",F),b.addEventListener("paste",F),b.addEventListener("drop",F),b.addEventListener("keydown",K=>{var q,H,de,Je;if(((q=document.activeElement)==null?void 0:q.shadowRoot)===((H=r.value)==null?void 0:H.getRootNode())&&!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(K.key)){if(K.key==="Backspace"||K.key==="Delete"){const De=S==null?void 0:S.getRangeAt(0);if(b.blur(),(De==null?void 0:De.startOffset)===0){const ne=De.startContainer;if(ne.nodeType===Node.TEXT_NODE){const Me=ne.previousSibling;if(Me&&Me.nodeType===Node.ELEMENT_NODE&&Me.classList.contains("node-item")){const ut=Me.getAttribute("id");ut&&o(ut),(de=ne.parentElement)==null||de.normalize();return}}else if(ne.nodeType===Node.ELEMENT_NODE){const Me=ne.previousSibling;if(Me&&Me.nodeType===Node.ELEMENT_NODE&&Me.classList.contains("node-item")){const ut=Me.getAttribute("id");ut&&o(ut),(Je=ne.parentElement)==null||Je.normalize();return}}}}K.preventDefault()}});const W=()=>{b==null||b.normalize(),R.disconnect(),b.removeEventListener("input",F),b.removeEventListener("paste",F),b.removeEventListener("drop",F),b.removeEventListener("blur",W),b.setAttribute("contenteditable","false")};b.addEventListener("blur",W)},g=()=>{var h;(h=r.value)==null||h.addEventListener("dblclick",u)};return d.watch(r,h=>{h&&g()},{immediate:!0}),d.onUnmounted(()=>{var h;(h=r.value)==null||h.removeEventListener("dblclick",u)}),{}}function o$e(){const{containerRef:o,focusedElement:r,cursorPosition:l,focusedNodeIndex:u,preNodeNumber:g}=cf(),h=_=>{var D,R;const N=_==null?void 0:_.getSelection();try{if((D=r.value)==null||D.normalize(),N){const F=N.getRangeAt(0);u.value=UOe(F.startContainer);const W=F.startOffset,Z=(R=r.value)==null?void 0:R.querySelectorAll(".node-item");let G=0;return g.value=0,Z==null||Z.forEach(K=>{const q=document.createRange();if(q.selectNode(K),q.comparePoint(F.startContainer,W)>=0){g.value+=1;const H=K.getAttribute("data-startOffset");Number(H)>G&&(G=Number(H))}}),G+W}}catch{}return 0},b=()=>{var N;const _=(N=o.value)==null?void 0:N.getRootNode();l.value=h(_)},x=_=>{var F;const N=_.target;if(N===o.value)return;r.value=N;const D=(F=o.value)==null?void 0:F.getRootNode();l.value=h(D),N.addEventListener("click",b),N.addEventListener("keyup",W=>{["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(W.key)&&b()});const R=()=>{N.removeEventListener("click",b),N.removeEventListener("keyup",b),N.removeEventListener("blur",R),setTimeout(()=>{r.value=null,u.value=0,l.value=-1},300)};N.addEventListener("blur",R)},S=()=>{var _;(_=o.value)==null||_.addEventListener("focus",x,!0)};return d.watch(o,_=>{_&&S()},{immediate:!0}),d.onUnmounted(()=>{var _;(_=o.value)==null||_.removeEventListener("focus",x,!0)}),{focusedElement:r,cursorPosition:l,focusedNodeIndex:u,preNodeNumber:g}}function s$e(o){const r=o.value===null?[]:[JSON.parse(JSON.stringify(o.value))],l=d.ref(r),u=d.ref(0),g=d.ref(!1),h=d.computed(()=>l.value[u.value]),b=()=>{u.value>0&&(g.value=!0,u.value--,o.value=JSON.parse(JSON.stringify(l.value[u.value])))},x=()=>{u.value<l.value.length-1&&(g.value=!0,u.value++,o.value=JSON.parse(JSON.stringify(l.value[u.value])))},S=_=>{(_.ctrlKey||_.metaKey)&&_.key==="z"?(_.preventDefault(),b()):(_.ctrlKey||_.metaKey)&&_.key==="y"&&(_.preventDefault(),x())};return d.onMounted(()=>{window.addEventListener("keydown",S)}),d.onUnmounted(()=>{window.removeEventListener("keydown",S)}),d.watch(o,gC(_=>{_&&!g.value&&(l.value.splice(u.value+1),l.value.push(JSON.parse(JSON.stringify(_))),u.value++),g.value&&(g.value=!1)},300),{deep:!0}),{current:h,undo:b,redo:x}}function r$e(){const{modelValue:o,inputTypes:r}=Sy(),{nodes:l,addNode:u}=J6(),g=x=>{if(!x||typeof x!="string")return[];const _=new DOMParser().parseFromString(x,"text/html");return Array.from(_.querySelectorAll("td")).filter(R=>{var F;return!((F=R.textContent)!=null&&F.trim())})},h=(x,S)=>{const _=S.map(D=>D.nodePath);return x==null?void 0:x.map(D=>({nodePath:wne(D)})).filter(D=>{const R=D==null?void 0:D.nodePath;return!_.includes(R)})},b=async x=>{var N,D;const S=await((D=(N=r==null?void 0:r.find(R=>{var F;return((F=R.value)==null?void 0:F.toLowerCase())==="text"}))==null?void 0:N.getDefaultProps)==null?void 0:D.call(N))||{},_=x.map(R=>({nodeType:"Text",label:"文本",props:{...S},...R}));u(_)};d.onMounted(()=>{const x=g(d.toValue(o)),S=h(x,d.toValue(l));b(S)})}function a$e(){const{selectedNodes:o,containerRef:r,isFocused:l}=cf(),{removeNode:u}=J6(),g=d.ref(null),h=S=>{if(l.value&&(S.key==="Delete"||S.key==="Backspace")){let _=[];S.preventDefault(),d.toValue(o).length>0&&(d.toValue(o).forEach(N=>{var D,R,F;if(((D=N==null?void 0:N.element)==null?void 0:D.tagName)==="TD"){const W=(R=N==null?void 0:N.element)==null?void 0:R.getAttribute("id");W&&_.push(W)}else{const W=(F=N==null?void 0:N.element)==null?void 0:F.getAttribute("id");W&&_.push(W)}}),o.value=[],(_==null?void 0:_.length)>0&&u(_))}},b=S=>{var _;(_=d.toValue(r))!=null&&_.contains(S.target)?g.value=S.target:g.value=null},x=()=>{r.value&&(window.addEventListener("keydown",h),r.value.addEventListener("mousedown",b))};d.watch(()=>r.value,S=>{d.toValue(S)&&x()},{immediate:!0}),d.onUnmounted(()=>{r.value&&(window.removeEventListener("keydown",h),r.value.removeEventListener("mousedown",b))})}function YH(){const{nodes:o}=Sy(),{containerRef:r,renderNodes:l,uiReady:u}=cf(),{removeNode:g}=J6(),h=()=>{var x;l.value=[...((x=o.value)==null?void 0:x.map(S=>{var N;const _=(N=r.value)==null?void 0:N.querySelector(`[id="${S.id}"]`);return{...S,element:_}}))||[]].filter(S=>!!(S!=null&&S.element))},b=gC(x=>{d.nextTick(()=>{var S;g((S=x==null?void 0:x.map(_=>_==null?void 0:_.id))==null?void 0:S.filter(Boolean))})},500);d.watch(()=>[l.value,u],()=>{if(d.toValue(u)){const x=t2e(o.value,l.value,"id");b(x)}},{immediate:!0,deep:!0}),d.watch(()=>[o.value,r.value,u],()=>{d.toValue(u)&&d.nextTick(()=>{h()})},{immediate:!0,deep:!0})}const dte=d.ref({});function KH(o){return d.computed(()=>{var r;return(r=dte.value)==null?void 0:r[o]})}function que(){const o=Sy(),r=cf();d.onMounted(()=>{const{editorId:l}=o;l&&(dte.value[l]=d.ref({...o,...r}))}),d.onUnmounted(()=>{const{editorId:l}=o;l&&(dte.value[l]=null)})}const l$e=d.defineComponent({__name:"NodesEditUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"edit"}},setup(o){const{nodes:r}=Sy(),{uiReady:l,renderNodes:u}=cf();return que(),s$e(r),Zue(),Gue(),a$e(),o$e(),n$e(),r$e(),YH(),(g,h)=>d.unref(l)?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(d.unref(u),b=>(d.openBlock(),d.createBlock(qH,{key:b==null?void 0:b.id,node:b},{default:d.withCtx(x=>[d.renderSlot(g.$slots,"nodeItem",{node:x==null?void 0:x.node})]),_:2},1032,["node"]))),128)):d.createCommentVNode("",!0)}}),Fae=d.defineComponent({__name:"NodesPreviewUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:r,renderNodes:l}=cf();return YH(),(u,g)=>d.unref(r)?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(d.unref(l),h=>(d.openBlock(),d.createBlock(qH,{key:h==null?void 0:h.id,node:h},{default:d.withCtx(b=>[d.renderSlot(u.$slots,"nodeItem",{node:b==null?void 0:b.node})]),_:2},1032,["node"]))),128)):d.createCommentVNode("",!0)}}),i$e=d.defineComponent({__name:"NodesEnterUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:r,renderNodes:l}=cf();return YH(),(u,g)=>d.unref(r)?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(d.unref(l),h=>(d.openBlock(),d.createBlock(qH,{key:h==null?void 0:h.id,node:h},{default:d.withCtx(b=>[d.renderSlot(u.$slots,"nodeItem",{node:b==null?void 0:b.node})]),_:2},1032,["node"]))),128)):d.createCommentVNode("",!0)}}),c$e=d.defineComponent({__name:"NodesSelectUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"select"}},setup(o){const{uiReady:r,renderNodes:l}=cf();return que(),Zue(),Gue(),YH(),(u,g)=>d.unref(r)?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(d.unref(l),h=>(d.openBlock(),d.createBlock(qH,{key:h==null?void 0:h.id,node:h},{default:d.withCtx(b=>[d.renderSlot(u.$slots,"nodeItem",{node:b==null?void 0:b.node})]),_:2},1032,["node"]))),128)):d.createCommentVNode("",!0)}}),fC=d.ref({});function Yue(o){return d.computed(()=>(fC.value[o]||(fC.value[o]=d.ref([])),fC.value[o]))}function u$e(o){const{editorId:r}=o,l=d.ref(!1);d.onMounted(()=>{fC.value[r]||(fC.value[r]=d.ref([]));const u=fC.value[r].findIndex(g=>g.id===o.id);u!==-1&&fC.value[r].splice(u,1),l.value=!0,fC.value[r].push({...o,isMounted:l})}),d.onUnmounted(()=>{l.value=!1})}const d$e=d.defineComponent({__name:"NodesProvider",props:d.mergeModels({modelValue:{type:String,default:""},nodes:{type:Array,default:()=>[]},renderType:{type:String,default:"preview"},inputTypes:{type:Array,default:()=>[]},editorId:{type:String,default:""},disabledNodes:{type:Array,default:()=>[]}},{formData:{},formDataModifiers:{},nodes:{},nodesModifiers:{}}),emits:["update:formData","update:nodes"],setup(o){const r=o,l=d.useModel(o,"formData"),u=d.useModel(o,"nodes"),g=d.computed(()=>r.modelValue),h=Yue(r==null?void 0:r.editorId),b=d.computed(()=>{var D,R,F;const N=[...Uue(((F=(R=(D=d.toValue(h))==null?void 0:D.filter(W=>d.toValue(W==null?void 0:W.activated)))==null?void 0:R.filter(W=>d.toValue(W.isMounted)))==null?void 0:F.filter(W=>d.toValue(W==null?void 0:W.isOccupy)))||[]),...r.disabledNodes||[]];return Wce(N,"id")}),x=d.computed(()=>d.toValue(r.renderType)),S=_=>{da(u.value,_)||(u.value=_)};return d.provide(Wue,{modelValue:g,renderType:x,inputTypes:r.inputTypes,editorId:r==null?void 0:r.editorId,nodes:u,disabledNodes:b,updateNodes:S,formData:l}),(_,N)=>d.renderSlot(_.$slots,"default")}}),f$e=d.defineComponent({__name:"NodesUIProvider",props:{nodes:{type:Array,default:()=>[]},selectedNodes:{type:Array,default:()=>[]},nodesGroups:{type:Array,default:()=>[]},editorId:{type:String,default:""},htmlRenderRef:{type:Object,default:()=>{}}},emits:["onSelectedNodes","update:selectedNodes"],setup(o,{expose:r,emit:l}){const u=o,g=l,h=d.ref(null),b=d.ref(null),x=d.ref([]),S=d.ref(null),_=d.ref(-1),N=d.ref(0),D=d.ref(0),R=Yue(u==null?void 0:u.editorId),F=d.ref(!1),W=d.ref(!1),Z=d.computed(()=>u.htmlRenderRef),G=d.computed({get:()=>(u.selectedNodes||[]).map(Je=>{var Me;let De=(Me=u==null?void 0:u.nodes)==null?void 0:Me.find(ut=>(ut==null?void 0:ut.id)===(Je==null?void 0:Je.id)),ne=Je!=null&&Je.element?Je==null?void 0:Je.element:VOe(Je==null?void 0:Je.id,h.value);return{...De||{},...Je,element:ne}}),set:Je=>{const De=Je.map(({element:ne,...Me})=>{var st;return{...((st=u==null?void 0:u.nodes)==null?void 0:st.find(Ne=>(Ne==null?void 0:Ne.id)===(Me==null?void 0:Me.id)))||{},...Me}});g("update:selectedNodes",De)}}),K=d.computed(()=>{var ne,Me,ut;const Je=(Me=(ne=d.toValue(R))==null?void 0:ne.filter(st=>d.toValue(st==null?void 0:st.activated)))==null?void 0:Me.filter(st=>d.toValue(st.isMounted)),De=((ut=d.toValue(u==null?void 0:u.nodesGroups)||[])==null?void 0:ut.map(st=>({...st||{},activated:!0})))||[];return Uue([...De,...Je])}),q=d.ref([]),H=Je=>{var Me;const De=Je.map(({...ut})=>{var Mt;let st=(Mt=x.value)==null?void 0:Mt.find(be=>(be==null?void 0:be.id)===(ut==null?void 0:ut.id));const{element:Ne,...ue}={...st||{},...ut};return ue}),ne=(Me=G.value)==null?void 0:Me.map(({element:ut,...st})=>st);da(De,ne)||(G.value=De,g("onSelectedNodes",De))},de=d.computed(()=>d.toValue(u==null?void 0:u.nodesGroups));return r({setSelectedNodes:H}),d.provide(Vue,{containerRef:h,htmlRenderRef:Z,contextMenuRef:b,focusedElement:S,currentRenderNodes:q,cursorPosition:_,focusedNodeIndex:N,preNodeNumber:D,currentNodes:K,selectedNodes:G,setSelectedNodes:H,renderNodes:x,uiReady:F,isFocused:W,nodesGroups:de}),(Je,De)=>d.renderSlot(Je.$slots,"default")}}),m$e=["onClick"],g$e={key:0,class:"icon"},p$e={key:1,class:"arrow"},h$e=["onClick"],v$e={key:0,class:"icon"},b$e=d.defineComponent({__name:"index",props:d.mergeModels({style:{},direction:{}},{show:{},showModifiers:{}}),emits:d.mergeModels(["select"],["update:show"]),setup(o,{emit:r}){const{contextMenuRef:l,selectedNodes:u,setSelectedNodes:g,focusedElement:h,cursorPosition:b,focusedNodeIndex:x,preNodeNumber:S}=cf(),{inputTypes:_}=Sy(),N=d.useModel(o,"show"),{editNodes:D}=J6(),R=async G=>{var K,q;if(d.toValue(h)&&!u2e(d.toValue(b))){const H=wne(d.toValue(h)),de=d.toValue(b),Je=(d.toValue(S)||0)+1,De=jOe(d.toValue(h));if(H&&de&&de>=0){const ne=await((K=G==null?void 0:G.getDefaultProps)==null?void 0:K.call(G))||{};D({...De,label:G==null?void 0:G.label,nodePath:H,startOffset:de,subNodeSort:Je,textNodeIndex:d.toValue(x)||0,nodeType:G==null?void 0:G.value,props:ne})}}else if(u){const H=d.toValue(u);if(H!=null&&H.length){const de=await((q=G==null?void 0:G.getDefaultProps)==null?void 0:q.call(G))||{},Je=H==null?void 0:H.map(De=>({...De,label:G==null?void 0:G.label,element:De==null?void 0:De.element,nodePath:De==null?void 0:De.nodePath,nodeType:G==null?void 0:G.value,props:de}));D(Je),g(Je)}}N.value=!1},F=d.computed(()=>{const G=[],K=[];return d.toValue(_).forEach(q=>{q.groupName==="system"?K.push({...q,handler:()=>{R(q)}}):G.push({...q,handler:()=>{R(q)}})}),[{label:"限定填写内容",icon:"i-bi:lock",children:G},{label:"插入记录标识",icon:"i-bi:flag",children:K}].filter(q=>{var H;return(H=q==null?void 0:q.children)==null?void 0:H.length})}),W=r,Z=(G,K)=>{G.preventDefault(),K!=null&&K.handler&&K.handler(),K!=null&&K.value&&W("select",K==null?void 0:K.value)};return(G,K)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:"context-menu",style:d.normalizeStyle({...G.style}),ref_key:"contextMenuRef",ref:l},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(F.value,q=>(d.openBlock(),d.createElementBlock("div",{key:q==null?void 0:q.label,class:"menu-item"},[d.createElementVNode("div",{class:"menu-item-content",onClick:H=>Z(H,q)},[q!=null&&q.icon?(d.openBlock(),d.createElementBlock("div",g$e,[d.createElementVNode("div",{class:d.normalizeClass(q==null?void 0:q.icon)},null,2)])):d.createCommentVNode("",!0),d.createTextVNode(" "+d.toDisplayString(q.label)+" ",1),q!=null&&q.children?(d.openBlock(),d.createElementBlock("span",p$e,"›")):d.createCommentVNode("",!0)],8,m$e),q!=null&&q.children?(d.openBlock(),d.createElementBlock("div",{key:0,class:d.normalizeClass(["submenu",{"submenu-bottom":G.direction==="bottom"}])},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(q.children,H=>(d.openBlock(),d.createElementBlock("div",{key:H.action,class:"menu-item",onClick:de=>Z(de,H)},[H!=null&&H.icon?(d.openBlock(),d.createElementBlock("div",v$e,[d.createElementVNode("div",{class:d.normalizeClass(H==null?void 0:H.icon)},null,2)])):d.createCommentVNode("",!0),d.createTextVNode(" "+d.toDisplayString(H.label),1)],8,h$e))),128))],2)):d.createCommentVNode("",!0)]))),128))],4)),[[d.vShow,N.value]])}}),y$e=vl(b$e,[["__scopeId","data-v-58d034b8"]]);function w$e(o){const{headerHeight:r}=o,l=d.ref(!1),u=d.ref("top"),{contextMenuRef:g}=cf(),h=d.ref({left:"0px",top:"0px"}),b=S=>{S.preventDefault(),l.value=!0,d.nextTick(()=>{const N=S.currentTarget.getBoundingClientRect(),D=S.clientX-N.left,R=S.clientY-N.top,F=g==null?void 0:g.value,W=F==null?void 0:F.offsetWidth,Z=F==null?void 0:F.offsetHeight,G=N.width-D<W,K=N.height-R<Z,q=Array.from((F==null?void 0:F.querySelectorAll(".submenu"))||[]).reduce((H,de)=>Math.max(H,de.offsetHeight||0),0);N.height-R<q?u.value="bottom":u.value="top",h.value={left:G?`${D-W}px`:`${D}px`,top:K?`${R-Z+d.toValue(r)}px`:`${R+d.toValue(r)}px`}})},x=S=>{const _=document.querySelector(".context-menu");_&&!_.contains(S.target)&&(l.value=!1)};return d.onMounted(()=>{document.addEventListener("mousedown",x)}),d.onUnmounted(()=>{document.removeEventListener("mousedown",x)}),{showContextMenu:l,contextMenuStyle:h,contextMenuRef:g,onContextMenu:b,closeContextMenu:x,direction:u}}function Kue(o){return{all:o=o||new Map,on:function(r,l){var u=o.get(r);u?u.push(l):o.set(r,[l])},off:function(r,l){var u=o.get(r);u&&(l?u.splice(u.indexOf(l)>>>0,1):o.set(r,[]))},emit:function(r,l){var u=o.get(r);u&&u.slice().map(function(g){g(l)}),(u=o.get("*"))&&u.slice().map(function(g){g(r,l)})}}}const fte=Kue(),Xue=(...o)=>{const r=o[0],l=o[1];d.onMounted(()=>{fte.on(r,l)}),d.onBeforeUnmount(()=>{fte.off(r)})},xne=()=>(...r)=>{fte.emit(...r)};let ME=null;function C$e(o){const{onSelected:r}={},{selectedNodes:l,uiReady:u,setSelectedNodes:g}=cf(),h=d.ref("multiple"),b=(S="select")=>{var N,D;let _=[];h.value==="single"?(N=l.value)!=null&&N[0]&&_.push((D=l.value)==null?void 0:D[0]):_=ua(l.value),ME==null||ME({data:_,type:S}),S==="blur"&&(ME=null,h.value="multiple"),g(_)};return d.watch(()=>l,()=>{u.value&&(b(),r==null||r(d.toValue(l)))},{deep:!0}),Xue("selectNodes",S=>{const{data:_,callback:N=null,mode:D="multiple"}=S;h.value=D,setTimeout(()=>{g(d.toValue(_)),ME=N},100)}),{onBlur:()=>{ME&&(b("blur"),ME=null,g([]))}}}const tH={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}},x$e={class:"relative"},S$e=["innerHTML"],E$e={style:{overflow:"hidden"}},_$e=["innerHTML"],k$e=d.defineComponent({__name:"index",props:{headerHtml:{type:String,default:""},footerHtml:{type:String,default:""},pagesize:{type:String,default:"A4"}},emits:["onUiReady"],setup(o,{expose:r,emit:l}){const u=d.ref(),{containerRef:g,uiReady:h,isFocused:b}=cf(),{nodes:x,modelValue:S,renderType:_}=Sy(),N=d.computed(()=>d.toValue(_)==="edit"),D=o,R=l,F=()=>{R("onUiReady",{containerRef:g})},{height:W}=zDe(u),Z=d.computed(()=>{const ue=tH[D.pagesize]||tH.A4,Mt=(window.devicePixelRatio||1)*96;return`${ue.height*Mt/25.4-d.toValue(W)}px`}),{showContextMenu:G,contextMenuStyle:K,onContextMenu:q,direction:H}=w$e({headerHeight:W}),de=d.ref(null),Je=ue=>{let Mt=null;if(Cne(ue))Mt=Hue(ue.nodePath,d.toValue(g)),Mt&&(Mt.classList.add("node-item-td"),Mt.setAttribute("contenteditable","false"),KOe(Mt));else{const be=document.createElement("span");be.setAttribute("contenteditable","false"),be.classList.add("node-item"),Mt=be,HOe(ue,Mt,g.value)}return Mt&&zOe(Mt,ue),Mt},De=()=>{const ue=h2e(x.value,[Mt=>Mt.nodePath,Mt=>Mt.textNodeIndex,Mt=>Mt.startOffset??-1,Mt=>Mt.subNodeSort],["asc","desc","desc","desc"]);ue==null||ue.forEach(Mt=>{Je(Mt)})},ne=()=>{de.value&&(h.value=!1,d.nextTick(()=>{de.value&&(de.value.innerHTML=d.toValue(S),De(),h.value=!0,d.nextTick(()=>{F()}))}))};d.watch(()=>[x,S,de],()=>{ne()},{deep:!0,immediate:!0});const Me=d.ref(),ut=()=>{b.value=!0},{onBlur:st}=C$e(),Ne=()=>{b.value=!1,st()};return r({renderHtml:ne}),(ue,Mt)=>(d.openBlock(),d.createElementBlock("div",x$e,[d.createVNode(yne,{onOnBlur:Ne,onOnFocus:ut,ref_key:"shadowDomRef",ref:Me},{default:d.withCtx(()=>[d.createElementVNode("div",{ref_key:"headerRef",ref:u,style:{overflow:"hidden"}},[d.createElementVNode("div",{innerHTML:D==null?void 0:D.headerHtml,class:"disabeld-edit docHeaderHtml",onClick:ut},null,8,S$e)],512),d.createElementVNode("html",{class:"nodes-editor",ref_key:"containerRef",ref:g,style:d.normalizeStyle([{position:"relative"},{position:"relative",minHeight:Z.value}]),onContextmenu:Mt[0]||(Mt[0]=d.withModifiers((...be)=>d.unref(q)&&d.unref(q)(...be),["prevent"]))},[d.createElementVNode("body",{ref_key:"bodyRef",ref:de},null,512)],36),d.createElementVNode("div",E$e,[d.createElementVNode("div",{innerHTML:D==null?void 0:D.footerHtml,class:"disabeld-edit docFooterHtml",onClick:ut},null,8,_$e)])]),_:1},512),N.value?(d.openBlock(),d.createBlock(y$e,{key:0,show:d.unref(G),"onUpdate:show":Mt[1]||(Mt[1]=be=>d.isRef(G)?G.value=be:null),style:d.normalizeStyle(d.unref(K)),direction:d.unref(H)},null,8,["show","style","direction"])):d.createCommentVNode("",!0)]))}}),T$e={class:"pagesize"},A$e=d.defineComponent({__name:"index",props:{pagesize:{type:String,default:"A4"}},setup(o){const r=o,l=d.computed(()=>{const u=tH[r.pagesize]||tH.A4,g=(window.devicePixelRatio||1)*96;return u.width*g/25.4});return(u,g)=>(d.openBlock(),d.createElementBlock("div",T$e,[d.createElementVNode("div",{style:d.normalizeStyle({width:`${l.value}px`}),class:"pagesize-content"},[d.renderSlot(u.$slots,"default",{},void 0,!0)],4)]))}}),N$e=vl(A$e,[["__scopeId","data-v-2877c433"]]),Jue=d.defineComponent({__name:"index",props:d.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:""},disabledNodes:{type:Array,default:()=>[]},headerHtml:{type:String,default:""},footerHtml:{type:String,default:""}},{selectedNodes:{default:[]},selectedNodesModifiers:{}}),emits:d.mergeModels(["update:nodes","update:formData","onSelectedNodes","onUiReady"],["update:selectedNodes"]),setup(o,{expose:r,emit:l}){const u=o,g=l,h=d.useModel(o,"selectedNodes");Vm(u.formData);const b=d.ref(),x=d.ref(null),S=Z=>{g("onUiReady",Z)},_=d.ref(),N=d.computed(()=>d.toValue(u.renderType)),D=d.computed(()=>{switch(d.toValue(N)){case"edit":return l$e;case"select":return c$e;case"preview":return Fae;case"enter":return i$e;default:return Fae}}),R=Z=>{g("update:nodes",Z)},F=Z=>{g("update:formData",Z)},W=Z=>{g("onSelectedNodes",Z)};return r({formRef:{validate:()=>{var Z,G,K;return(K=(G=(Z=b.value)==null?void 0:Z.formRef)==null?void 0:G.validate)==null?void 0:K.call(G)}},setSelectedNodes:Z=>{var G,K;(K=(G=_.value)==null?void 0:G.setSelectedNodes)==null||K.call(G,Z)}}),(Z,G)=>(d.openBlock(),d.createBlock(N$e,{pagesize:o.pagesize},{default:d.withCtx(()=>[d.createVNode(f$e,{ref_key:"UIRef",ref:_,nodes:o.nodes,"onUpdate:nodes":R,selectedNodes:h.value,"onUpdate:selectedNodes":G[0]||(G[0]=K=>h.value=K),onOnSelectedNodes:W,nodesGroups:o.nodesGroups,editorId:u==null?void 0:u.id,htmlRenderRef:x.value},{default:d.withCtx(()=>[d.createVNode(d$e,{renderType:N.value,"model-value":o.modelValue,nodes:o.nodes,"onUpdate:nodes":R,formData:o.formData,"onUpdate:formData":F,inputTypes:o.inputTypes,editorId:u==null?void 0:u.id,disabledNodes:o.disabledNodes},{default:d.withCtx(()=>[d.createVNode(k$e,{ref_key:"htmlRenderRef",ref:x,headerHtml:o.headerHtml,footerHtml:o.footerHtml,pagesize:u==null?void 0:u.pagesize,onOnUiReady:S},null,8,["headerHtml","footerHtml","pagesize"]),(d.openBlock(),d.createBlock(d.resolveDynamicComponent(D.value),{renderType:N.value,pagesize:o.pagesize,ref_key:"contentRef",ref:b},{nodeItem:d.withCtx(K=>[d.renderSlot(Z.$slots,"nodeItem",{node:K==null?void 0:K.node})]),_:3},8,["renderType","pagesize"]))]),_:3},8,["renderType","model-value","nodes","formData","inputTypes","editorId","disabledNodes"])]),_:3},8,["nodes","selectedNodes","nodesGroups","editorId","htmlRenderRef"])]),_:3},8,["pagesize"]))}}),D$e={class:"nodes-text"},O$e={key:0,class:"node-text-input"},$$e={key:1,class:"node-text-td"},B$e={key:0,class:"node-text-table-index"},M$e=d.defineComponent({__name:"index",props:d.mergeModels({editorId:{type:String,default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const r=o,l=d.useModel(o,"modelValue"),u=KH(r==null?void 0:r.editorId),g=d.computed(()=>{var b;return jue(l.value,((b=d.toValue(u))==null?void 0:b.renderNodes)||[])}),h=d.computed(()=>{var b;return((b=d.toValue(g))==null?void 0:b.length)>0?!d.toValue(g).some(S=>{var _,N;return((_=S==null?void 0:S.min)==null?void 0:_.tableIndex)>1||((N=S==null?void 0:S.max)==null?void 0:N.tableIndex)>1}):!0});return(b,x)=>(d.openBlock(),d.createElementBlock("div",D$e,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(g.value,(S,_)=>{var N,D,R;return d.openBlock(),d.createElementBlock("div",{key:_,class:"node-text-item"},[(S==null?void 0:S.showTextType)==="input"?(d.openBlock(),d.createElementBlock("span",O$e," 填写"+d.toDisplayString(S==null?void 0:S.inputIndex),1)):(d.openBlock(),d.createElementBlock("span",$$e,[h.value?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("span",B$e,d.toDisplayString(`表${(N=S==null?void 0:S.min)==null?void 0:N.tableIndex}.`),1)),d.createTextVNode(" "+d.toDisplayString(((D=S==null?void 0:S.min)==null?void 0:D.id)===((R=S==null?void 0:S.max)==null?void 0:R.id)?d.unref(d4)(S==null?void 0:S.min):`${d.unref(d4)(S==null?void 0:S.min)}:${d.unref(d4)(S==null?void 0:S.max)}`),1)]))])}),128))]))}}),Lae=vl(M$e,[["__scopeId","data-v-da41f195"]]);function Sne(o){const{nodes:r,mode:l="multiple"}=o,u=d.ref(!1),g=xne();return{isSelecting:u,selectNodes:()=>{if(u.value)return!1;u.value=!0,g("selectNodes",{data:ua(d.toValue(r)),mode:l,callback:({data:b,type:x})=>{r.value=XOe(ua(d.toValue(b))),x==="blur"&&(u.value=!1)}})}}}const e4=["#ff9b40","#b36c2d","#7548ff","#5233b3","#649ee5","#aac4ed","#f9ce57","#ae74e8"],r9=d.ref(0),RE=new Map,R$e={key:0,class:"node-select-small gap-x-2"},I$e={key:1,class:"text-[#999]"},P$e={key:1,class:"node-select"},F$e={class:"flex py-2 px-2 justify-between items-center noder-select-header"},L$e={class:"flex gap-2"},V$e={key:1},H$e={class:"flex gap-1"},z$e=d.defineComponent({__name:"index",props:d.mergeModels({mode:{type:String,default:"multiple"},color:{type:String},id:{type:String,default:""},editorId:{type:String,default:""},size:{type:String,default:"default"},label:{type:String,default:"点击选择"},isOccupy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const r=o,l=d.ref((RE==null?void 0:RE[r==null?void 0:r.id])||0),u=d.ref((r==null?void 0:r.id)||JE()),g=d.useModel(o,"modelValue");Vm(g);const{selectNodes:h,isSelecting:b}=Sne({nodes:g,mode:r.mode}),x=()=>{g.value=[]},S=d.computed(()=>r.color||(e4==null?void 0:e4[d.toValue(l)%(e4==null?void 0:e4.length)])||"#409eff");d.onMounted(()=>{q9(RE==null?void 0:RE[r==null?void 0:r.id])&&(r!=null&&r.id)&&(RE[r==null?void 0:r.id]=r9.value,l.value=r9.value,r9.value=r9.value+1)});const _=d.computed(()=>r.isOccupy),N=d.computed(()=>!d.toValue(b));return u$e({id:u.value,editorId:r.editorId,nodes:g,activated:N,color:S,isOccupy:_}),(D,R)=>{var F;return r.size==="small"?(d.openBlock(),d.createElementBlock("div",R$e,[d.createElementVNode("div",{style:d.normalizeStyle({"--node-color":S.value}),class:"node-color cursor-pointer"},null,4),d.createElementVNode("div",null,d.toDisplayString(r.label),1),r.disabled?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,style:d.normalizeStyle(d.unref(b)?{color:"#409eff"}:{}),onClick:R[0]||(R[0]=(...W)=>d.unref(h)&&d.unref(h)(...W))},R[6]||(R[6]=[d.createElementVNode("div",{class:"i-bi:hand-index text-[18px] cursor-pointer"},null,-1)]),4)),d.createElementVNode("div",{class:"flex items-center flex-wrap gap-1 cursor-pointer",onClick:R[2]||(R[2]=()=>{r!=null&&r.disabled||d.unref(h)()})},[((F=g.value)==null?void 0:F.length)>0?(d.openBlock(),d.createBlock(Lae,{key:0,modelValue:g.value,"onUpdate:modelValue":R[1]||(R[1]=W=>g.value=W),editorId:o.editorId},null,8,["modelValue","editorId"])):(d.openBlock(),d.createElementBlock("div",I$e,"未设置"))])])):(d.openBlock(),d.createElementBlock("div",P$e,[d.createElementVNode("div",F$e,[d.createElementVNode("div",L$e,[d.createElementVNode("div",{style:d.normalizeStyle({"--node-color":S.value}),class:"node-color cursor-pointer"},null,4),r.disabled?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,style:d.normalizeStyle(d.unref(b)?{color:"#409eff"}:{})},[d.createElementVNode("div",{class:"i-bi:hand-index text-[18px] cursor-pointer",onClick:R[3]||(R[3]=(...W)=>d.unref(h)&&d.unref(h)(...W))})],4)),r.disabled?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",V$e,[d.createElementVNode("div",{class:"i-bi:eraser-fill text-[18px] cursor-pointer",onClick:x})]))]),d.createElementVNode("div",H$e,[R[8]||(R[8]=d.createElementVNode("div",{class:"color-[#999]"},"Ctrl+左键多选",-1)),d.createElementVNode("div",null,[d.createVNode(d.unref(Sn.ElPopover),{placement:"top-start",width:200,trigger:"hover",content:"this is content, this is content, this is content"},{reference:d.withCtx(()=>R[7]||(R[7]=[d.createElementVNode("div",{class:"flex flex-center"},[d.createElementVNode("div",{class:"i-bi:info-circle-fill mr-2"}),d.createTextVNode(" 使用帮助 ")],-1)])),_:1})])])]),d.createElementVNode("div",{class:"min-h-[42px] px-2 py-1",onClick:R[5]||(R[5]=()=>{r!=null&&r.disabled||d.unref(h)()})},[d.createVNode(Lae,{modelValue:g.value,"onUpdate:modelValue":R[4]||(R[4]=W=>g.value=W),editorId:o.editorId},null,8,["modelValue","editorId"])])]))}}}),Que=vl(z$e,[["__scopeId","data-v-177e4feb"]]);function U$e(o){if(!o.startsWith("="))return[];const r=[];let l=1;for(o.startsWith("=")&&r.push({type:"startOperator",value:"="});l<o.length;){const u=o[l];if(/\s/.test(u)){l++;continue}if(/[A-Za-z]/.test(u)&&/\d/.test(o[l+1])){let g="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)g+=o[l++];for(;l<o.length&&/\d/.test(o[l]);)g+=o[l++];if(l<o.length&&o[l]===":"){l++;let h="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)h+=o[l++];for(;l<o.length&&/\d/.test(o[l]);)h+=o[l++];r.push({type:"range",value:`${g}:${h}`});continue}else{r.push({type:"cell",value:g});continue}}if(/[A-Za-z]/.test(u)&&/\d/.test(o[l+1])){let g="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)g+=o[l++];for(;l<o.length&&/\d/.test(o[l]);)g+=o[l++];r.push({type:"cell",value:g});continue}if(/[A-Za-z]/.test(u)){let g="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)g+=o[l++];if(["AVERAGE","AVEDEV","SUM","IF","COUNT","MAX","MIN","SQRT"].includes(g.toUpperCase())&&o[l]==="("){r.push({type:"function",value:g});continue}l-=g.length}if(/\d/.test(u)){let g="";for(;l<o.length&&(/\d/.test(o[l])||o[l]===".");)g+=o[l++];r.push({type:"number",value:g});continue}if(u==='"'){let g="";for(g+=u,l++;l<o.length&&o[l]!=='"';)g+=o[l++];g+=u,l++,r.push({type:"string",value:g});continue}if(/[A-Za-z]/.test(u)&&/\d/.test(o[l+1])){let g="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)g+=o[l++];for(;l<o.length&&/\d/.test(o[l]);)g+=o[l++];r.push({type:"cell",value:g});continue}if(u===":"){r.push({type:"operator",value:":"}),l++;continue}if(/[+\-*/=><]/.test(u)){r.push({type:"operator",value:u}),l++;continue}if(/[()]/.test(u)){r.push({type:"paren",value:u}),l++;continue}if(u===","){r.push({type:"separator",value:","}),l++;continue}l++}return r}function j$e(o,r){const l=[];let u=0;for(;u<o.length;){let g=!1;for(const h of r){const b=h.value;if(o.startsWith(b,u)){l.push({type:h.type,value:b,...h.cellValue?{cellValue:h.cellValue}:{}}),u+=b.length,g=!0;break}}g||(l.push({type:"plain",value:o[u]}),u++)}return l}function W$e(o){const r=KH(o.editorId),l=(b,x)=>{let S=[];const _=Math.min(b.colIndex,x.colIndex),N=Math.max(b.colIndex,x.colIndex),D=Math.min(b.rowIndex,x.rowIndex),R=Math.max(b.rowIndex,x.rowIndex);for(let F=D;F<=R;F++)for(let W=_;W<=N;W++)S.push({colIndex:W,rowIndex:F});return S},u=b=>{var N;const x=b.includes(":");let S=[];if(x){const[D,R]=b.split(":").map(F=>h(F));S=l(D,R)}else S=[h(b)];return g(S,d.toValue((N=d.toValue(r))==null?void 0:N.nodes))},g=(b,x)=>x==null?void 0:x.filter(S=>{const _=S.nodePath.split(" > ");let N=1,D=1;return _.forEach(R=>{if(R.startsWith("tr")){const F=R.match(/tr(?::nth-of-type\((\d+)\))?/);F&&F[1]&&(N=parseInt(F[1]))}else if(R.startsWith("td")){const F=R.match(/td(?::nth-of-type\((\d+)\))?/);F&&(D=F[1]?parseInt(F[1]):1)}}),b.some(R=>N===R.rowIndex+1&&D===R.colIndex+1)}),h=b=>{if(!b)return{colIndex:-1,rowIndex:-1};const x=b.match(/^([A-Za-z]+)(\d+)$/);if(!x)return{colIndex:-1,rowIndex:-1};const S=x[1].toUpperCase(),_=parseInt(x[2]);let N=0;for(let D=0;D<S.length;D++)N=N*26+(S.charCodeAt(D)-64);return{colIndex:N-1,rowIndex:_}};return{getCellValue:u}}const Vae=["#0288D1","#D32F2F","#F57C00","#388E3C","#303F9F","#7B1FA2","#C2185B","#880E4F","#689F38","#5D4037"];function Z$e(o,r,l){const u=d.ref(null),g=d.ref(null);function h(){return o.value&&o.value.textContent||""}d.onMounted(()=>{o.value&&(u.value=()=>{const x=h();r.value=x},g.value=()=>{const x=h();r.value=x},o.value.addEventListener("input",u.value),o.value.addEventListener("blur",g.value))}),d.onUnmounted(()=>{o.value&&(u.value&&o.value.removeEventListener("input",u.value),g.value&&o.value.removeEventListener("blur",g.value))});const b=x=>{var S,_,N,D;if(x>=0){const R=window.getSelection();if(R){const F=R.getRangeAt(0),W=((S=F.startContainer)==null?void 0:S.nodeName)==="#text"?F.startContainer:(N=(_=F.startContainer)==null?void 0:_.childNodes)==null?void 0:N[0],Z=Math.min(x,((D=W.textContent)==null?void 0:D.length)||0);F.setStart(W,Z)}}};return d.watch(()=>[r,o],()=>{var x;o.value&&(da((x=o.value)==null?void 0:x.textContent,d.toValue(r))||(o.value.textContent=d.toValue(r),b(d.toValue(l))))},{deep:!0,immediate:!0}),{getFormulaContent:h}}function Ene(o){const{element:r,onFocus:l,onBlur:u}=o,g=d.ref(!1),h=()=>{g.value=!0,l==null||l()},b=()=>{g.value=!1,u==null||u()};return d.onMounted(()=>{var x,S;d.toValue(r)&&((x=d.toValue(r))==null||x.addEventListener("focus",h),(S=d.toValue(r))==null||S.addEventListener("blur",b))}),d.onUnmounted(()=>{var x,S;d.toValue(r)&&((x=d.toValue(r))==null||x.removeEventListener("focus",h),(S=d.toValue(r))==null||S.removeEventListener("blur",b))}),g}function G$e(o){const{element:r,showStr:l,editorId:u}=o,g=KH(u),h=Ene({element:r}),b=d.computed(()=>{var x;return(x=l==null?void 0:l.value)==null?void 0:x.filter(S=>["range","cell"].includes(S.type))});return d.watch(()=>h,()=>{var S,_,N,D,R,F;const x=W=>{var Z;W.preventDefault(),(Z=d.toValue(r))==null||Z.focus()};d.toValue(h)?((S=d.toValue(g))==null||S.containerRef.addEventListener("click",x),(_=d.toValue(g))==null||_.containerRef.addEventListener("mousedown",x),(N=document.querySelectorAll(".select-function"))==null||N.forEach(W=>{W.addEventListener("click",x),W.addEventListener("mousedown",x)})):((D=d.toValue(g))==null||D.containerRef.removeEventListener("click",x),(R=d.toValue(g))==null||R.containerRef.removeEventListener("mousedown",x),(F=document.querySelectorAll(".select-function"))==null||F.forEach(W=>{W.removeEventListener("click",x),W.removeEventListener("mousedown",x)}))},{deep:!0}),d.watch(()=>[h,b],()=>{var x,S,_,N,D;if((x=d.toValue(g))!=null&&x.containerRef&&((N=(_=(S=d.toValue(g))==null?void 0:S.containerRef)==null?void 0:_.querySelectorAll(".node-formula-cell"))==null||N.forEach(R=>{R.classList.remove("node-formula-cell")}),d.toValue(h))){let R=[];(D=b.value)!=null&&D.length&&(b.value.forEach(F=>{var W;R=[...R,...((W=F==null?void 0:F.cellValue)==null?void 0:W.map(Z=>({color:F==null?void 0:F.color,backgroundColor:eH((F==null?void 0:F.color)||"#000",.1),element:Z==null?void 0:Z.element})))||[]]}),R.forEach(F=>{var W;F!=null&&F.element&&((W=F==null?void 0:F.element)==null||W.classList.add("node-formula-cell"),F==null||F.element.style.setProperty("--formula-node-color",F==null?void 0:F.color),F==null||F.element.style.setProperty("--formula-node-bg-color",F==null?void 0:F.backgroundColor))}))}},{deep:!0}),h}const q$e=o=>{const{element:r}=o,l=d.ref(-1),u=x=>{const S=x==null?void 0:x.getSelection();try{if(S)return S.getRangeAt(0).startOffset}catch{}return 0},g=()=>{var S;const x=(S=r.value)==null?void 0:S.getRootNode();l.value=u(x)},h=x=>{var D;const S=x.target,_=(D=r.value)==null?void 0:D.getRootNode();l.value=u(_),S.addEventListener("click",g),S.addEventListener("keyup",R=>{["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(R.key)&&g()});const N=()=>{S.removeEventListener("click",g),S.removeEventListener("keyup",g),S.removeEventListener("blur",N),setTimeout(()=>{l.value=-1},300)};S.addEventListener("blur",N)},b=()=>{var x;(x=r.value)==null||x.addEventListener("focus",h,!0)};return d.watch(r,x=>{x&&b()},{immediate:!0}),d.onUnmounted(()=>{var x;(x=r.value)==null||x.removeEventListener("focus",h,!0)}),{startOffset:l}};function Y$e(o,r,l,u){if(r<0||l<0||r>=o.length)throw new Error("Invalid start or length");const g=r+l;return o.slice(0,r)+u+o.slice(g)}const K$e=(o,r)=>{var u;let l=0;for(let g=0;g<r;g++){const h=o[g];l+=(u=h==null?void 0:h.value)==null?void 0:u.length}return l},X$e=o=>{const{startOffset:r,showStr:l,value:u,editorId:g,currentItemIndex:h,currentItem:b,element:x}=o,S=KH(g),_=d.ref(-1),N=d.ref(0),D=Ene({element:x}),R=d.ref(!1),F=xne(),W=Z=>{var G,K;if(d.toValue(R)&&d.toValue(D)&&!da((G=d.toValue(b))==null?void 0:G.cellValue,Z)){const q=YOe(Z,((K=d.toValue(S))==null?void 0:K.nodes)||"");let H=q;q&&(d.toValue(N)===0&&(H+=","),d.toValue(_)>=0&&(u.value=Y$e(d.toValue(u),d.toValue(_),d.toValue(N),H),N.value=q.length))}};d.watch(()=>h,()=>{var Z,G,K,q,H,de;if((Z=S.value)==null||Z.setSelectedNodes([]),["range","cell"].includes((G=d.toValue(b))==null?void 0:G.type))return _.value=K$e(l.value,h.value),N.value=(q=(K=d.toValue(b))==null?void 0:K.value)==null?void 0:q.length,R.value=!0,F("selectNodes",{data:(H=d.toValue(b))==null?void 0:H.cellValue,mode:"multiple",callback:({data:Je})=>{W(Je)}}),!1;if([",","(","="].includes((de=d.toValue(b))==null?void 0:de.value))return _.value=d.toValue(r),R.value=!0,N.value=0,F("selectNodes",{data:[],mode:"multiple",callback:({data:Je})=>{W(Je)}}),!1;R.value=!1,_.value=-1},{immediate:!0,deep:!0})},J$e=o=>{const{startOffset:r,showStr:l}=o,u=d.ref(-1);d.watch(()=>r,()=>{var h;if(d.toValue(r)<=0)u.value=-1;else{let b=0;for(let x=0;x<l.value.length;x++){const S=l.value[x];if(b+=(h=S==null?void 0:S.value)==null?void 0:h.length,b>=d.toValue(r)){u.value=x;break}}}},{deep:!0,immediate:!0});const g=d.computed(()=>{var h;return(h=d.toValue(l))==null?void 0:h[d.toValue(u)]});return{currentItemIndex:u,currentItem:g}};function Q$e(o,r,l,u){if(r<0||l<0||r>=o.length)throw new Error("Invalid start or length");const g=r+l;return o.slice(0,r)+u+o.slice(g)}const e5e=(o,r)=>{var u;let l=0;for(let g=0;g<r;g++){const h=o[g];l+=(u=h==null?void 0:h.value)==null?void 0:u.length}return l},t5e=o=>{const{startOffset:r,showStr:l,value:u,currentItemIndex:g,currentItem:h,element:b}=o,x=d.ref(-1),S=d.ref(0),_=Ene({element:b}),N=d.ref(!1),D=xne(),R=F=>{var W;if(d.toValue(N)&&d.toValue(_)&&!da((W=d.toValue(h))==null?void 0:W.value,F)){const Z=F,G=Z;Z&&d.toValue(x)>=0&&(u.value=Q$e(d.toValue(u),d.toValue(x),d.toValue(S),G),S.value=Z.length)}};d.watch(()=>g,()=>{var F,W,Z,G,K;if(["function"].includes((F=d.toValue(h))==null?void 0:F.type))return x.value=e5e(l.value,g.value),S.value=(Z=(W=d.toValue(h))==null?void 0:W.value)==null?void 0:Z.length,N.value=!0,D("selectFunction",{data:(G=d.toValue(h))==null?void 0:G.value,callback:({data:q})=>{R(q)}}),!1;if([",","(","="].includes((K=d.toValue(h))==null?void 0:K.value))return x.value=d.toValue(r),N.value=!0,S.value=0,D("selectFunction",{data:"",callback:({data:q})=>{R(q)}}),!1;N.value=!1,x.value=-1},{immediate:!0,deep:!0})},n5e={class:"node-formula"},o5e={class:"node-formula-show"},s5e=d.defineComponent({__name:"index",props:d.mergeModels({id:{type:String,default:""},editorId:{type:String,default:""}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const r=o,{getCellValue:l}=W$e({editorId:r==null?void 0:r.editorId}),u=d.useModel(o,"modelValue"),g=d.ref(),{startOffset:h}=q$e({element:g});Z$e(g,u,h);const b=d.computed(()=>{const N=U$e(u.value);return N==null?void 0:N.map(R=>R.type==="cell"||R.type==="range"?{cellValue:l(R.value),...R}:R)}),x=d.computed(()=>{const N=j$e(u.value,b.value);let D=-1;return N.map(F=>(F==null?void 0:F.type)==="cell"||(F==null?void 0:F.type)==="range"?(D++,{...F,color:Vae[D%Vae.length]}):(F==null?void 0:F.type)==="function"?{...F,color:"#0318ff"}:F)});G$e({element:g,showStr:x,editorId:r==null?void 0:r.editorId});const{currentItemIndex:S,currentItem:_}=J$e({element:g,startOffset:h,value:u,showStr:x});return X$e({element:g,startOffset:h,showStr:x,editorId:r==null?void 0:r.editorId,value:u,currentItemIndex:S,currentItem:_}),t5e({element:g,startOffset:h,showStr:x,value:u,currentItemIndex:S,currentItem:_}),(N,D)=>(d.openBlock(),d.createElementBlock("div",n5e,[d.createElementVNode("div",{contenteditable:"true",ref_key:"formulaRef",ref:g,class:"node-formula-input"},null,512),d.createElementVNode("div",o5e,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(x.value,(R,F)=>(d.openBlock(),d.createElementBlock("span",{key:F,class:d.normalizeClass(["node-formula-item",`node-formula-item-type-${R==null?void 0:R.type}`,F===d.unref(S)?"node-formula-item-active":""]),style:d.normalizeStyle({"--text-color":(R==null?void 0:R.color)||"#000","--bg-color":d.unref(eH)((R==null?void 0:R.color)||"#000",.1)})},d.toDisplayString(R.value),7))),128))])]))}}),ede=vl(s5e,[["__scopeId","data-v-f4b96eb4"]]),r5e=[{label:"平均值",value:"AVERAGE"},{label:"均值绝对偏差",value:"AVEDEV"},{label:"求和",value:"SUM"},{label:"条件判断",value:"IF"},{label:"统计数量",value:"COUNT"},{label:"最大值",value:"MAX"},{label:"最小值",value:"MIN"},{label:"正平方根",value:"SQRT"}],a5e={class:"select-function"},l5e=["onClick"],i5e={class:"function-item"},c5e={class:"function-item-desc"},u5e=d.defineComponent({__name:"index",props:d.mergeModels({id:{type:String,default:""},functionList:{type:Array,default:()=>[]}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const r=o;let l=null;const u=d.computed(()=>{var b;return((b=r.functionList)==null?void 0:b.length)>0?r.functionList:r5e}),g=d.useModel(o,"modelValue"),h=b=>{g.value=b,l==null||l({data:b})};return Xue("selectFunction",({data:b,callback:x})=>{l=x,g.value=b}),(b,x)=>(d.openBlock(),d.createElementBlock("div",a5e,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u.value,(S,_)=>(d.openBlock(),d.createElementBlock("div",{key:_},[d.createElementVNode("div",{onClick:()=>{h(S.value)},class:d.normalizeClass(["function-item-wrapper",{active:g.value===S.value}])},[d.createElementVNode("div",i5e,d.toDisplayString(S.value),1),d.createElementVNode("div",c5e,d.toDisplayString(S.label),1)],10,l5e)]))),128))]))}}),tde=vl(u5e,[["__scopeId","data-v-6e079ff0"]]),d5e=["innerHTML"],nde=d.defineComponent({__name:"index",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const r=d.useModel(o,"modelValue");return(l,u)=>(d.openBlock(),d.createBlock(yne,null,{default:d.withCtx(()=>[d.createElementVNode("div",{innerHTML:r.value},null,8,d5e)]),_:1}))}});function XH(o){return d.getCurrentScope()?(d.onScopeDispose(o),!0):!1}function my(o){return typeof o=="function"?o():d.unref(o)}const f5e=typeof window<"u"&&typeof document<"u",m5e=o=>typeof o<"u",g5e=Object.prototype.toString,p5e=o=>g5e.call(o)==="[object Object]",h5e=()=>{};function v5e(o,r){function l(...u){return new Promise((g,h)=>{Promise.resolve(o(()=>r.apply(this,u),{fn:r,thisArg:this,args:u})).then(g).catch(h)})}return l}const ode=o=>o();function b5e(o=ode){const r=d.ref(!0);function l(){r.value=!1}function u(){r.value=!0}const g=(...h)=>{r.value&&o(...h)};return{isActive:d.readonly(r),pause:l,resume:u,eventFilter:g}}function Hae(o,r=!1,l="Timeout"){return new Promise((u,g)=>{setTimeout(r?()=>g(l):u,o)})}function y5e(o,r,l={}){const{eventFilter:u=ode,...g}=l;return d.watch(o,v5e(u,r),g)}function t4(o,r,l={}){const{eventFilter:u,...g}=l,{eventFilter:h,pause:b,resume:x,isActive:S}=b5e(u);return{stop:y5e(o,r,{...g,eventFilter:h}),pause:b,resume:x,isActive:S}}function w5e(o,r={}){if(!d.isRef(o))return d.toRefs(o);const l=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const u in o.value)l[u]=d.customRef(()=>({get(){return o.value[u]},set(g){var h;if((h=my(r.replaceRef))!=null?h:!0)if(Array.isArray(o.value)){const x=[...o.value];x[u]=g,o.value=x}else{const x={...o.value,[u]:g};Object.setPrototypeOf(x,Object.getPrototypeOf(o.value)),o.value=x}else o.value[u]=g}}));return l}function mte(o,r=!1){function l(D,{flush:R="sync",deep:F=!1,timeout:W,throwOnTimeout:Z}={}){let G=null;const q=[new Promise(H=>{G=d.watch(o,de=>{D(de)!==r&&(G==null||G(),H(de))},{flush:R,deep:F,immediate:!0})})];return W!=null&&q.push(Hae(W,Z).then(()=>my(o)).finally(()=>G==null?void 0:G())),Promise.race(q)}function u(D,R){if(!d.isRef(D))return l(de=>de===D,R);const{flush:F="sync",deep:W=!1,timeout:Z,throwOnTimeout:G}=R??{};let K=null;const H=[new Promise(de=>{K=d.watch([o,D],([Je,De])=>{r!==(Je===De)&&(K==null||K(),de(Je))},{flush:F,deep:W,immediate:!0})})];return Z!=null&&H.push(Hae(Z,G).then(()=>my(o)).finally(()=>(K==null||K(),my(o)))),Promise.race(H)}function g(D){return l(R=>!!R,D)}function h(D){return u(null,D)}function b(D){return u(void 0,D)}function x(D){return l(Number.isNaN,D)}function S(D,R){return l(F=>{const W=Array.from(F);return W.includes(D)||W.includes(my(D))},R)}function _(D){return N(1,D)}function N(D=1,R){let F=-1;return l(()=>(F+=1,F>=D),R)}return Array.isArray(my(o))?{toMatch:l,toContains:S,changed:_,changedTimes:N,get not(){return mte(o,!r)}}:{toMatch:l,toBe:u,toBeTruthy:g,toBeNull:h,toBeNaN:x,toBeUndefined:b,changed:_,changedTimes:N,get not(){return mte(o,!r)}}}function gte(o){return mte(o)}function C5e(o){var r;const l=my(o);return(r=l==null?void 0:l.$el)!=null?r:l}const sde=f5e?window:void 0;function rde(...o){let r,l,u,g;if(typeof o[0]=="string"||Array.isArray(o[0])?([l,u,g]=o,r=sde):[r,l,u,g]=o,!r)return h5e;Array.isArray(l)||(l=[l]),Array.isArray(u)||(u=[u]);const h=[],b=()=>{h.forEach(N=>N()),h.length=0},x=(N,D,R,F)=>(N.addEventListener(D,R,F),()=>N.removeEventListener(D,R,F)),S=d.watch(()=>[C5e(r),my(g)],([N,D])=>{if(b(),!N)return;const R=p5e(D)?{...D}:D;h.push(...l.flatMap(F=>u.map(W=>x(N,F,W,R))))},{immediate:!0,flush:"post"}),_=()=>{S(),b()};return XH(_),_}function x5e(o){return typeof o=="function"?o:typeof o=="string"?r=>r.key===o:Array.isArray(o)?r=>o.includes(r.key):()=>!0}function zae(...o){let r,l,u={};o.length===3?(r=o[0],l=o[1],u=o[2]):o.length===2?typeof o[1]=="object"?(r=!0,l=o[0],u=o[1]):(r=o[0],l=o[1]):(r=!0,l=o[0]);const{target:g=sde,eventName:h="keydown",passive:b=!1,dedupe:x=!1}=u,S=x5e(r);return rde(g,h,N=>{N.repeat&&my(x)||S(N)&&l(N)},b)}function S5e(o){return JSON.parse(JSON.stringify(o))}function mee(o,r,l,u={}){var g,h,b;const{clone:x=!1,passive:S=!1,eventName:_,deep:N=!1,defaultValue:D,shouldEmit:R}=u,F=d.getCurrentInstance(),W=l||(F==null?void 0:F.emit)||((g=F==null?void 0:F.$emit)==null?void 0:g.bind(F))||((b=(h=F==null?void 0:F.proxy)==null?void 0:h.$emit)==null?void 0:b.bind(F==null?void 0:F.proxy));let Z=_;r||(r="modelValue"),Z=Z||`update:${r.toString()}`;const G=H=>x?typeof x=="function"?x(H):S5e(H):H,K=()=>m5e(o[r])?G(o[r]):D,q=H=>{R?R(H)&&W(Z,H):W(Z,H)};if(S){const H=K(),de=d.ref(H);let Je=!1;return d.watch(()=>o[r],De=>{Je||(Je=!0,de.value=G(De),d.nextTick(()=>Je=!1))}),d.watch(de,De=>{!Je&&(De!==o[r]||N)&&q(De)},{deep:N}),de}else return d.computed({get(){return K()},set(H){q(H)}})}var E5e={value:()=>{}};function JH(){for(var o=0,r=arguments.length,l={},u;o<r;++o){if(!(u=arguments[o]+"")||u in l||/[\s.]/.test(u))throw new Error("illegal type: "+u);l[u]=[]}return new N9(l)}function N9(o){this._=o}function _5e(o,r){return o.trim().split(/^|\s+/).map(function(l){var u="",g=l.indexOf(".");if(g>=0&&(u=l.slice(g+1),l=l.slice(0,g)),l&&!r.hasOwnProperty(l))throw new Error("unknown type: "+l);return{type:l,name:u}})}N9.prototype=JH.prototype={constructor:N9,on:function(o,r){var l=this._,u=_5e(o+"",l),g,h=-1,b=u.length;if(arguments.length<2){for(;++h<b;)if((g=(o=u[h]).type)&&(g=k5e(l[g],o.name)))return g;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++h<b;)if(g=(o=u[h]).type)l[g]=Uae(l[g],o.name,r);else if(r==null)for(g in l)l[g]=Uae(l[g],o.name,null);return this},copy:function(){var o={},r=this._;for(var l in r)o[l]=r[l].slice();return new N9(o)},call:function(o,r){if((g=arguments.length-2)>0)for(var l=new Array(g),u=0,g,h;u<g;++u)l[u]=arguments[u+2];if(!this._.hasOwnProperty(o))throw new Error("unknown type: "+o);for(h=this._[o],u=0,g=h.length;u<g;++u)h[u].value.apply(r,l)},apply:function(o,r,l){if(!this._.hasOwnProperty(o))throw new Error("unknown type: "+o);for(var u=this._[o],g=0,h=u.length;g<h;++g)u[g].value.apply(r,l)}};function k5e(o,r){for(var l=0,u=o.length,g;l<u;++l)if((g=o[l]).name===r)return g.value}function Uae(o,r,l){for(var u=0,g=o.length;u<g;++u)if(o[u].name===r){o[u]=E5e,o=o.slice(0,u).concat(o.slice(u+1));break}return l!=null&&o.push({name:r,value:l}),o}var pte="http://www.w3.org/1999/xhtml";const jae={svg:"http://www.w3.org/2000/svg",xhtml:pte,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function QH(o){var r=o+="",l=r.indexOf(":");return l>=0&&(r=o.slice(0,l))!=="xmlns"&&(o=o.slice(l+1)),jae.hasOwnProperty(r)?{space:jae[r],local:o}:o}function T5e(o){return function(){var r=this.ownerDocument,l=this.namespaceURI;return l===pte&&r.documentElement.namespaceURI===pte?r.createElement(o):r.createElementNS(l,o)}}function A5e(o){return function(){return this.ownerDocument.createElementNS(o.space,o.local)}}function ade(o){var r=QH(o);return(r.local?A5e:T5e)(r)}function N5e(){}function _ne(o){return o==null?N5e:function(){return this.querySelector(o)}}function D5e(o){typeof o!="function"&&(o=_ne(o));for(var r=this._groups,l=r.length,u=new Array(l),g=0;g<l;++g)for(var h=r[g],b=h.length,x=u[g]=new Array(b),S,_,N=0;N<b;++N)(S=h[N])&&(_=o.call(S,S.__data__,N,h))&&("__data__"in S&&(_.__data__=S.__data__),x[N]=_);return new Ig(u,this._parents)}function O5e(o){return o==null?[]:Array.isArray(o)?o:Array.from(o)}function $5e(){return[]}function lde(o){return o==null?$5e:function(){return this.querySelectorAll(o)}}function B5e(o){return function(){return O5e(o.apply(this,arguments))}}function M5e(o){typeof o=="function"?o=B5e(o):o=lde(o);for(var r=this._groups,l=r.length,u=[],g=[],h=0;h<l;++h)for(var b=r[h],x=b.length,S,_=0;_<x;++_)(S=b[_])&&(u.push(o.call(S,S.__data__,_,b)),g.push(S));return new Ig(u,g)}function ide(o){return function(){return this.matches(o)}}function cde(o){return function(r){return r.matches(o)}}var R5e=Array.prototype.find;function I5e(o){return function(){return R5e.call(this.children,o)}}function P5e(){return this.firstElementChild}function F5e(o){return this.select(o==null?P5e:I5e(typeof o=="function"?o:cde(o)))}var L5e=Array.prototype.filter;function V5e(){return Array.from(this.children)}function H5e(o){return function(){return L5e.call(this.children,o)}}function z5e(o){return this.selectAll(o==null?V5e:H5e(typeof o=="function"?o:cde(o)))}function U5e(o){typeof o!="function"&&(o=ide(o));for(var r=this._groups,l=r.length,u=new Array(l),g=0;g<l;++g)for(var h=r[g],b=h.length,x=u[g]=[],S,_=0;_<b;++_)(S=h[_])&&o.call(S,S.__data__,_,h)&&x.push(S);return new Ig(u,this._parents)}function ude(o){return new Array(o.length)}function j5e(){return new Ig(this._enter||this._groups.map(ude),this._parents)}function nH(o,r){this.ownerDocument=o.ownerDocument,this.namespaceURI=o.namespaceURI,this._next=null,this._parent=o,this.__data__=r}nH.prototype={constructor:nH,appendChild:function(o){return this._parent.insertBefore(o,this._next)},insertBefore:function(o,r){return this._parent.insertBefore(o,r)},querySelector:function(o){return this._parent.querySelector(o)},querySelectorAll:function(o){return this._parent.querySelectorAll(o)}};function W5e(o){return function(){return o}}function Z5e(o,r,l,u,g,h){for(var b=0,x,S=r.length,_=h.length;b<_;++b)(x=r[b])?(x.__data__=h[b],u[b]=x):l[b]=new nH(o,h[b]);for(;b<S;++b)(x=r[b])&&(g[b]=x)}function G5e(o,r,l,u,g,h,b){var x,S,_=new Map,N=r.length,D=h.length,R=new Array(N),F;for(x=0;x<N;++x)(S=r[x])&&(R[x]=F=b.call(S,S.__data__,x,r)+"",_.has(F)?g[x]=S:_.set(F,S));for(x=0;x<D;++x)F=b.call(o,h[x],x,h)+"",(S=_.get(F))?(u[x]=S,S.__data__=h[x],_.delete(F)):l[x]=new nH(o,h[x]);for(x=0;x<N;++x)(S=r[x])&&_.get(R[x])===S&&(g[x]=S)}function q5e(o){return o.__data__}function Y5e(o,r){if(!arguments.length)return Array.from(this,q5e);var l=r?G5e:Z5e,u=this._parents,g=this._groups;typeof o!="function"&&(o=W5e(o));for(var h=g.length,b=new Array(h),x=new Array(h),S=new Array(h),_=0;_<h;++_){var N=u[_],D=g[_],R=D.length,F=K5e(o.call(N,N&&N.__data__,_,u)),W=F.length,Z=x[_]=new Array(W),G=b[_]=new Array(W),K=S[_]=new Array(R);l(N,D,Z,G,K,F,r);for(var q=0,H=0,de,Je;q<W;++q)if(de=Z[q]){for(q>=H&&(H=q+1);!(Je=G[H])&&++H<W;);de._next=Je||null}}return b=new Ig(b,u),b._enter=x,b._exit=S,b}function K5e(o){return typeof o=="object"&&"length"in o?o:Array.from(o)}function X5e(){return new Ig(this._exit||this._groups.map(ude),this._parents)}function J5e(o,r,l){var u=this.enter(),g=this,h=this.exit();return typeof o=="function"?(u=o(u),u&&(u=u.selection())):u=u.append(o+""),r!=null&&(g=r(g),g&&(g=g.selection())),l==null?h.remove():l(h),u&&g?u.merge(g).order():g}function Q5e(o){for(var r=o.selection?o.selection():o,l=this._groups,u=r._groups,g=l.length,h=u.length,b=Math.min(g,h),x=new Array(g),S=0;S<b;++S)for(var _=l[S],N=u[S],D=_.length,R=x[S]=new Array(D),F,W=0;W<D;++W)(F=_[W]||N[W])&&(R[W]=F);for(;S<g;++S)x[S]=l[S];return new Ig(x,this._parents)}function eBe(){for(var o=this._groups,r=-1,l=o.length;++r<l;)for(var u=o[r],g=u.length-1,h=u[g],b;--g>=0;)(b=u[g])&&(h&&b.compareDocumentPosition(h)^4&&h.parentNode.insertBefore(b,h),h=b);return this}function tBe(o){o||(o=nBe);function r(D,R){return D&&R?o(D.__data__,R.__data__):!D-!R}for(var l=this._groups,u=l.length,g=new Array(u),h=0;h<u;++h){for(var b=l[h],x=b.length,S=g[h]=new Array(x),_,N=0;N<x;++N)(_=b[N])&&(S[N]=_);S.sort(r)}return new Ig(g,this._parents).order()}function nBe(o,r){return o<r?-1:o>r?1:o>=r?0:NaN}function oBe(){var o=arguments[0];return arguments[0]=this,o.apply(null,arguments),this}function sBe(){return Array.from(this)}function rBe(){for(var o=this._groups,r=0,l=o.length;r<l;++r)for(var u=o[r],g=0,h=u.length;g<h;++g){var b=u[g];if(b)return b}return null}function aBe(){let o=0;for(const r of this)++o;return o}function lBe(){return!this.node()}function iBe(o){for(var r=this._groups,l=0,u=r.length;l<u;++l)for(var g=r[l],h=0,b=g.length,x;h<b;++h)(x=g[h])&&o.call(x,x.__data__,h,g);return this}function cBe(o){return function(){this.removeAttribute(o)}}function uBe(o){return function(){this.removeAttributeNS(o.space,o.local)}}function dBe(o,r){return function(){this.setAttribute(o,r)}}function fBe(o,r){return function(){this.setAttributeNS(o.space,o.local,r)}}function mBe(o,r){return function(){var l=r.apply(this,arguments);l==null?this.removeAttribute(o):this.setAttribute(o,l)}}function gBe(o,r){return function(){var l=r.apply(this,arguments);l==null?this.removeAttributeNS(o.space,o.local):this.setAttributeNS(o.space,o.local,l)}}function pBe(o,r){var l=QH(o);if(arguments.length<2){var u=this.node();return l.local?u.getAttributeNS(l.space,l.local):u.getAttribute(l)}return this.each((r==null?l.local?uBe:cBe:typeof r=="function"?l.local?gBe:mBe:l.local?fBe:dBe)(l,r))}function dde(o){return o.ownerDocument&&o.ownerDocument.defaultView||o.document&&o||o.defaultView}function hBe(o){return function(){this.style.removeProperty(o)}}function vBe(o,r,l){return function(){this.style.setProperty(o,r,l)}}function bBe(o,r,l){return function(){var u=r.apply(this,arguments);u==null?this.style.removeProperty(o):this.style.setProperty(o,u,l)}}function yBe(o,r,l){return arguments.length>1?this.each((r==null?hBe:typeof r=="function"?bBe:vBe)(o,r,l??"")):y4(this.node(),o)}function y4(o,r){return o.style.getPropertyValue(r)||dde(o).getComputedStyle(o,null).getPropertyValue(r)}function wBe(o){return function(){delete this[o]}}function CBe(o,r){return function(){this[o]=r}}function xBe(o,r){return function(){var l=r.apply(this,arguments);l==null?delete this[o]:this[o]=l}}function SBe(o,r){return arguments.length>1?this.each((r==null?wBe:typeof r=="function"?xBe:CBe)(o,r)):this.node()[o]}function fde(o){return o.trim().split(/^|\s+/)}function kne(o){return o.classList||new mde(o)}function mde(o){this._node=o,this._names=fde(o.getAttribute("class")||"")}mde.prototype={add:function(o){var r=this._names.indexOf(o);r<0&&(this._names.push(o),this._node.setAttribute("class",this._names.join(" ")))},remove:function(o){var r=this._names.indexOf(o);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(o){return this._names.indexOf(o)>=0}};function gde(o,r){for(var l=kne(o),u=-1,g=r.length;++u<g;)l.add(r[u])}function pde(o,r){for(var l=kne(o),u=-1,g=r.length;++u<g;)l.remove(r[u])}function EBe(o){return function(){gde(this,o)}}function _Be(o){return function(){pde(this,o)}}function kBe(o,r){return function(){(r.apply(this,arguments)?gde:pde)(this,o)}}function TBe(o,r){var l=fde(o+"");if(arguments.length<2){for(var u=kne(this.node()),g=-1,h=l.length;++g<h;)if(!u.contains(l[g]))return!1;return!0}return this.each((typeof r=="function"?kBe:r?EBe:_Be)(l,r))}function ABe(){this.textContent=""}function NBe(o){return function(){this.textContent=o}}function DBe(o){return function(){var r=o.apply(this,arguments);this.textContent=r??""}}function OBe(o){return arguments.length?this.each(o==null?ABe:(typeof o=="function"?DBe:NBe)(o)):this.node().textContent}function $Be(){this.innerHTML=""}function BBe(o){return function(){this.innerHTML=o}}function MBe(o){return function(){var r=o.apply(this,arguments);this.innerHTML=r??""}}function RBe(o){return arguments.length?this.each(o==null?$Be:(typeof o=="function"?MBe:BBe)(o)):this.node().innerHTML}function IBe(){this.nextSibling&&this.parentNode.appendChild(this)}function PBe(){return this.each(IBe)}function FBe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function LBe(){return this.each(FBe)}function VBe(o){var r=typeof o=="function"?o:ade(o);return this.select(function(){return this.appendChild(r.apply(this,arguments))})}function HBe(){return null}function zBe(o,r){var l=typeof o=="function"?o:ade(o),u=r==null?HBe:typeof r=="function"?r:_ne(r);return this.select(function(){return this.insertBefore(l.apply(this,arguments),u.apply(this,arguments)||null)})}function UBe(){var o=this.parentNode;o&&o.removeChild(this)}function jBe(){return this.each(UBe)}function WBe(){var o=this.cloneNode(!1),r=this.parentNode;return r?r.insertBefore(o,this.nextSibling):o}function ZBe(){var o=this.cloneNode(!0),r=this.parentNode;return r?r.insertBefore(o,this.nextSibling):o}function GBe(o){return this.select(o?ZBe:WBe)}function qBe(o){return arguments.length?this.property("__data__",o):this.node().__data__}function YBe(o){return function(r){o.call(this,r,this.__data__)}}function KBe(o){return o.trim().split(/^|\s+/).map(function(r){var l="",u=r.indexOf(".");return u>=0&&(l=r.slice(u+1),r=r.slice(0,u)),{type:r,name:l}})}function XBe(o){return function(){var r=this.__on;if(r){for(var l=0,u=-1,g=r.length,h;l<g;++l)h=r[l],(!o.type||h.type===o.type)&&h.name===o.name?this.removeEventListener(h.type,h.listener,h.options):r[++u]=h;++u?r.length=u:delete this.__on}}}function JBe(o,r,l){return function(){var u=this.__on,g,h=YBe(r);if(u){for(var b=0,x=u.length;b<x;++b)if((g=u[b]).type===o.type&&g.name===o.name){this.removeEventListener(g.type,g.listener,g.options),this.addEventListener(g.type,g.listener=h,g.options=l),g.value=r;return}}this.addEventListener(o.type,h,l),g={type:o.type,name:o.name,value:r,listener:h,options:l},u?u.push(g):this.__on=[g]}}function QBe(o,r,l){var u=KBe(o+""),g,h=u.length,b;if(arguments.length<2){var x=this.node().__on;if(x){for(var S=0,_=x.length,N;S<_;++S)for(g=0,N=x[S];g<h;++g)if((b=u[g]).type===N.type&&b.name===N.name)return N.value}return}for(x=r?JBe:XBe,g=0;g<h;++g)this.each(x(u[g],r,l));return this}function hde(o,r,l){var u=dde(o),g=u.CustomEvent;typeof g=="function"?g=new g(r,l):(g=u.document.createEvent("Event"),l?(g.initEvent(r,l.bubbles,l.cancelable),g.detail=l.detail):g.initEvent(r,!1,!1)),o.dispatchEvent(g)}function e6e(o,r){return function(){return hde(this,o,r)}}function t6e(o,r){return function(){return hde(this,o,r.apply(this,arguments))}}function n6e(o,r){return this.each((typeof r=="function"?t6e:e6e)(o,r))}function*o6e(){for(var o=this._groups,r=0,l=o.length;r<l;++r)for(var u=o[r],g=0,h=u.length,b;g<h;++g)(b=u[g])&&(yield b)}var vde=[null];function Ig(o,r){this._groups=o,this._parents=r}function Q6(){return new Ig([[document.documentElement]],vde)}function s6e(){return this}Ig.prototype=Q6.prototype={constructor:Ig,select:D5e,selectAll:M5e,selectChild:F5e,selectChildren:z5e,filter:U5e,data:Y5e,enter:j5e,exit:X5e,join:J5e,merge:Q5e,selection:s6e,order:eBe,sort:tBe,call:oBe,nodes:sBe,node:rBe,size:aBe,empty:lBe,each:iBe,attr:pBe,style:yBe,property:SBe,classed:TBe,text:OBe,html:RBe,raise:PBe,lower:LBe,append:VBe,insert:zBe,remove:jBe,clone:GBe,datum:qBe,on:QBe,dispatch:n6e,[Symbol.iterator]:o6e};function e1(o){return typeof o=="string"?new Ig([[document.querySelector(o)]],[document.documentElement]):new Ig([[o]],vde)}function r6e(o){let r;for(;r=o.sourceEvent;)o=r;return o}function zv(o,r){if(o=r6e(o),r===void 0&&(r=o.currentTarget),r){var l=r.ownerSVGElement||r;if(l.createSVGPoint){var u=l.createSVGPoint();return u.x=o.clientX,u.y=o.clientY,u=u.matrixTransform(r.getScreenCTM().inverse()),[u.x,u.y]}if(r.getBoundingClientRect){var g=r.getBoundingClientRect();return[o.clientX-g.left-r.clientLeft,o.clientY-g.top-r.clientTop]}}return[o.pageX,o.pageY]}const a6e={passive:!1},O6={capture:!0,passive:!1};function gee(o){o.stopImmediatePropagation()}function f4(o){o.preventDefault(),o.stopImmediatePropagation()}function bde(o){var r=o.document.documentElement,l=e1(o).on("dragstart.drag",f4,O6);"onselectstart"in r?l.on("selectstart.drag",f4,O6):(r.__noselect=r.style.MozUserSelect,r.style.MozUserSelect="none")}function yde(o,r){var l=o.document.documentElement,u=e1(o).on("dragstart.drag",null);r&&(u.on("click.drag",f4,O6),setTimeout(function(){u.on("click.drag",null)},0)),"onselectstart"in l?u.on("selectstart.drag",null):(l.style.MozUserSelect=l.__noselect,delete l.__noselect)}const a9=o=>()=>o;function hte(o,{sourceEvent:r,subject:l,target:u,identifier:g,active:h,x:b,y:x,dx:S,dy:_,dispatch:N}){Object.defineProperties(this,{type:{value:o,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:l,enumerable:!0,configurable:!0},target:{value:u,enumerable:!0,configurable:!0},identifier:{value:g,enumerable:!0,configurable:!0},active:{value:h,enumerable:!0,configurable:!0},x:{value:b,enumerable:!0,configurable:!0},y:{value:x,enumerable:!0,configurable:!0},dx:{value:S,enumerable:!0,configurable:!0},dy:{value:_,enumerable:!0,configurable:!0},_:{value:N}})}hte.prototype.on=function(){var o=this._.on.apply(this._,arguments);return o===this._?this:o};function l6e(o){return!o.ctrlKey&&!o.button}function i6e(){return this.parentNode}function c6e(o,r){return r??{x:o.x,y:o.y}}function u6e(){return navigator.maxTouchPoints||"ontouchstart"in this}function d6e(){var o=l6e,r=i6e,l=c6e,u=u6e,g={},h=JH("start","drag","end"),b=0,x,S,_,N,D=0;function R(de){de.on("mousedown.drag",F).filter(u).on("touchstart.drag",G).on("touchmove.drag",K,a6e).on("touchend.drag touchcancel.drag",q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function F(de,Je){if(!(N||!o.call(this,de,Je))){var De=H(this,r.call(this,de,Je),de,Je,"mouse");De&&(e1(de.view).on("mousemove.drag",W,O6).on("mouseup.drag",Z,O6),bde(de.view),gee(de),_=!1,x=de.clientX,S=de.clientY,De("start",de))}}function W(de){if(f4(de),!_){var Je=de.clientX-x,De=de.clientY-S;_=Je*Je+De*De>D}g.mouse("drag",de)}function Z(de){e1(de.view).on("mousemove.drag mouseup.drag",null),yde(de.view,_),f4(de),g.mouse("end",de)}function G(de,Je){if(o.call(this,de,Je)){var De=de.changedTouches,ne=r.call(this,de,Je),Me=De.length,ut,st;for(ut=0;ut<Me;++ut)(st=H(this,ne,de,Je,De[ut].identifier,De[ut]))&&(gee(de),st("start",de,De[ut]))}}function K(de){var Je=de.changedTouches,De=Je.length,ne,Me;for(ne=0;ne<De;++ne)(Me=g[Je[ne].identifier])&&(f4(de),Me("drag",de,Je[ne]))}function q(de){var Je=de.changedTouches,De=Je.length,ne,Me;for(N&&clearTimeout(N),N=setTimeout(function(){N=null},500),ne=0;ne<De;++ne)(Me=g[Je[ne].identifier])&&(gee(de),Me("end",de,Je[ne]))}function H(de,Je,De,ne,Me,ut){var st=h.copy(),Ne=zv(ut||De,Je),ue,Mt,be;if((be=l.call(de,new hte("beforestart",{sourceEvent:De,target:R,identifier:Me,active:b,x:Ne[0],y:Ne[1],dx:0,dy:0,dispatch:st}),ne))!=null)return ue=be.x-Ne[0]||0,Mt=be.y-Ne[1]||0,function ke(M,je,we){var ot=Ne,et;switch(M){case"start":g[Me]=ke,et=b++;break;case"end":delete g[Me],--b;case"drag":Ne=zv(we||je,Je),et=b;break}st.call(M,de,new hte(M,{sourceEvent:je,subject:be,target:R,identifier:Me,active:et,x:Ne[0]+ue,y:Ne[1]+Mt,dx:Ne[0]-ot[0],dy:Ne[1]-ot[1],dispatch:st}),ne)}}return R.filter=function(de){return arguments.length?(o=typeof de=="function"?de:a9(!!de),R):o},R.container=function(de){return arguments.length?(r=typeof de=="function"?de:a9(de),R):r},R.subject=function(de){return arguments.length?(l=typeof de=="function"?de:a9(de),R):l},R.touchable=function(de){return arguments.length?(u=typeof de=="function"?de:a9(!!de),R):u},R.on=function(){var de=h.on.apply(h,arguments);return de===h?R:de},R.clickDistance=function(de){return arguments.length?(D=(de=+de)*de,R):Math.sqrt(D)},R}function Tne(o,r,l){o.prototype=r.prototype=l,l.constructor=o}function wde(o,r){var l=Object.create(o.prototype);for(var u in r)l[u]=r[u];return l}function eM(){}var $6=.7,oH=1/$6,m4="\\s*([+-]?\\d+)\\s*",B6="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",f6e=/^#([0-9a-f]{3,8})$/,m6e=new RegExp(`^rgb\\(${m4},${m4},${m4}\\)$`),g6e=new RegExp(`^rgb\\(${jv},${jv},${jv}\\)$`),p6e=new RegExp(`^rgba\\(${m4},${m4},${m4},${B6}\\)$`),h6e=new RegExp(`^rgba\\(${jv},${jv},${jv},${B6}\\)$`),v6e=new RegExp(`^hsl\\(${B6},${jv},${jv}\\)$`),b6e=new RegExp(`^hsla\\(${B6},${jv},${jv},${B6}\\)$`),Wae={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};Tne(eM,M6,{copy(o){return Object.assign(new this.constructor,this,o)},displayable(){return this.rgb().displayable()},hex:Zae,formatHex:Zae,formatHex8:y6e,formatHsl:w6e,formatRgb:Gae,toString:Gae});function Zae(){return this.rgb().formatHex()}function y6e(){return this.rgb().formatHex8()}function w6e(){return Cde(this).formatHsl()}function Gae(){return this.rgb().formatRgb()}function M6(o){var r,l;return o=(o+"").trim().toLowerCase(),(r=f6e.exec(o))?(l=r[1].length,r=parseInt(r[1],16),l===6?qae(r):l===3?new Fm(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):l===8?l9(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):l===4?l9(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=m6e.exec(o))?new Fm(r[1],r[2],r[3],1):(r=g6e.exec(o))?new Fm(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=p6e.exec(o))?l9(r[1],r[2],r[3],r[4]):(r=h6e.exec(o))?l9(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=v6e.exec(o))?Xae(r[1],r[2]/100,r[3]/100,1):(r=b6e.exec(o))?Xae(r[1],r[2]/100,r[3]/100,r[4]):Wae.hasOwnProperty(o)?qae(Wae[o]):o==="transparent"?new Fm(NaN,NaN,NaN,0):null}function qae(o){return new Fm(o>>16&255,o>>8&255,o&255,1)}function l9(o,r,l,u){return u<=0&&(o=r=l=NaN),new Fm(o,r,l,u)}function C6e(o){return o instanceof eM||(o=M6(o)),o?(o=o.rgb(),new Fm(o.r,o.g,o.b,o.opacity)):new Fm}function vte(o,r,l,u){return arguments.length===1?C6e(o):new Fm(o,r,l,u??1)}function Fm(o,r,l,u){this.r=+o,this.g=+r,this.b=+l,this.opacity=+u}Tne(Fm,vte,wde(eM,{brighter(o){return o=o==null?oH:Math.pow(oH,o),new Fm(this.r*o,this.g*o,this.b*o,this.opacity)},darker(o){return o=o==null?$6:Math.pow($6,o),new Fm(this.r*o,this.g*o,this.b*o,this.opacity)},rgb(){return this},clamp(){return new Fm(QE(this.r),QE(this.g),QE(this.b),sH(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:Yae,formatHex:Yae,formatHex8:x6e,formatRgb:Kae,toString:Kae}));function Yae(){return`#${ZE(this.r)}${ZE(this.g)}${ZE(this.b)}`}function x6e(){return`#${ZE(this.r)}${ZE(this.g)}${ZE(this.b)}${ZE((isNaN(this.opacity)?1:this.opacity)*255)}`}function Kae(){const o=sH(this.opacity);return`${o===1?"rgb(":"rgba("}${QE(this.r)}, ${QE(this.g)}, ${QE(this.b)}${o===1?")":`, ${o})`}`}function sH(o){return isNaN(o)?1:Math.max(0,Math.min(1,o))}function QE(o){return Math.max(0,Math.min(255,Math.round(o)||0))}function ZE(o){return o=QE(o),(o<16?"0":"")+o.toString(16)}function Xae(o,r,l,u){return u<=0?o=r=l=NaN:l<=0||l>=1?o=r=NaN:r<=0&&(o=NaN),new t1(o,r,l,u)}function Cde(o){if(o instanceof t1)return new t1(o.h,o.s,o.l,o.opacity);if(o instanceof eM||(o=M6(o)),!o)return new t1;if(o instanceof t1)return o;o=o.rgb();var r=o.r/255,l=o.g/255,u=o.b/255,g=Math.min(r,l,u),h=Math.max(r,l,u),b=NaN,x=h-g,S=(h+g)/2;return x?(r===h?b=(l-u)/x+(l<u)*6:l===h?b=(u-r)/x+2:b=(r-l)/x+4,x/=S<.5?h+g:2-h-g,b*=60):x=S>0&&S<1?0:b,new t1(b,x,S,o.opacity)}function S6e(o,r,l,u){return arguments.length===1?Cde(o):new t1(o,r,l,u??1)}function t1(o,r,l,u){this.h=+o,this.s=+r,this.l=+l,this.opacity=+u}Tne(t1,S6e,wde(eM,{brighter(o){return o=o==null?oH:Math.pow(oH,o),new t1(this.h,this.s,this.l*o,this.opacity)},darker(o){return o=o==null?$6:Math.pow($6,o),new t1(this.h,this.s,this.l*o,this.opacity)},rgb(){var o=this.h%360+(this.h<0)*360,r=isNaN(o)||isNaN(this.s)?0:this.s,l=this.l,u=l+(l<.5?l:1-l)*r,g=2*l-u;return new Fm(pee(o>=240?o-240:o+120,g,u),pee(o,g,u),pee(o<120?o+240:o-120,g,u),this.opacity)},clamp(){return new t1(Jae(this.h),i9(this.s),i9(this.l),sH(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=sH(this.opacity);return`${o===1?"hsl(":"hsla("}${Jae(this.h)}, ${i9(this.s)*100}%, ${i9(this.l)*100}%${o===1?")":`, ${o})`}`}}));function Jae(o){return o=(o||0)%360,o<0?o+360:o}function i9(o){return Math.max(0,Math.min(1,o||0))}function pee(o,r,l){return(o<60?r+(l-r)*o/60:o<180?l:o<240?r+(l-r)*(240-o)/60:r)*255}const xde=o=>()=>o;function E6e(o,r){return function(l){return o+l*r}}function _6e(o,r,l){return o=Math.pow(o,l),r=Math.pow(r,l)-o,l=1/l,function(u){return Math.pow(o+u*r,l)}}function k6e(o){return(o=+o)==1?Sde:function(r,l){return l-r?_6e(r,l,o):xde(isNaN(r)?l:r)}}function Sde(o,r){var l=r-o;return l?E6e(o,l):xde(isNaN(o)?r:o)}const Qae=function o(r){var l=k6e(r);function u(g,h){var b=l((g=vte(g)).r,(h=vte(h)).r),x=l(g.g,h.g),S=l(g.b,h.b),_=Sde(g.opacity,h.opacity);return function(N){return g.r=b(N),g.g=x(N),g.b=S(N),g.opacity=_(N),g+""}}return u.gamma=o,u}(1);function cC(o,r){return o=+o,r=+r,function(l){return o*(1-l)+r*l}}var bte=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hee=new RegExp(bte.source,"g");function T6e(o){return function(){return o}}function A6e(o){return function(r){return o(r)+""}}function N6e(o,r){var l=bte.lastIndex=hee.lastIndex=0,u,g,h,b=-1,x=[],S=[];for(o=o+"",r=r+"";(u=bte.exec(o))&&(g=hee.exec(r));)(h=g.index)>l&&(h=r.slice(l,h),x[b]?x[b]+=h:x[++b]=h),(u=u[0])===(g=g[0])?x[b]?x[b]+=g:x[++b]=g:(x[++b]=null,S.push({i:b,x:cC(u,g)})),l=hee.lastIndex;return l<r.length&&(h=r.slice(l),x[b]?x[b]+=h:x[++b]=h),x.length<2?S[0]?A6e(S[0].x):T6e(r):(r=S.length,function(_){for(var N=0,D;N<r;++N)x[(D=S[N]).i]=D.x(_);return x.join("")})}var ele=180/Math.PI,yte={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ede(o,r,l,u,g,h){var b,x,S;return(b=Math.sqrt(o*o+r*r))&&(o/=b,r/=b),(S=o*l+r*u)&&(l-=o*S,u-=r*S),(x=Math.sqrt(l*l+u*u))&&(l/=x,u/=x,S/=x),o*u<r*l&&(o=-o,r=-r,S=-S,b=-b),{translateX:g,translateY:h,rotate:Math.atan2(r,o)*ele,skewX:Math.atan(S)*ele,scaleX:b,scaleY:x}}var c9;function D6e(o){const r=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(o+"");return r.isIdentity?yte:Ede(r.a,r.b,r.c,r.d,r.e,r.f)}function O6e(o){return o==null||(c9||(c9=document.createElementNS("http://www.w3.org/2000/svg","g")),c9.setAttribute("transform",o),!(o=c9.transform.baseVal.consolidate()))?yte:(o=o.matrix,Ede(o.a,o.b,o.c,o.d,o.e,o.f))}function _de(o,r,l,u){function g(_){return _.length?_.pop()+" ":""}function h(_,N,D,R,F,W){if(_!==D||N!==R){var Z=F.push("translate(",null,r,null,l);W.push({i:Z-4,x:cC(_,D)},{i:Z-2,x:cC(N,R)})}else(D||R)&&F.push("translate("+D+r+R+l)}function b(_,N,D,R){_!==N?(_-N>180?N+=360:N-_>180&&(_+=360),R.push({i:D.push(g(D)+"rotate(",null,u)-2,x:cC(_,N)})):N&&D.push(g(D)+"rotate("+N+u)}function x(_,N,D,R){_!==N?R.push({i:D.push(g(D)+"skewX(",null,u)-2,x:cC(_,N)}):N&&D.push(g(D)+"skewX("+N+u)}function S(_,N,D,R,F,W){if(_!==D||N!==R){var Z=F.push(g(F)+"scale(",null,",",null,")");W.push({i:Z-4,x:cC(_,D)},{i:Z-2,x:cC(N,R)})}else(D!==1||R!==1)&&F.push(g(F)+"scale("+D+","+R+")")}return function(_,N){var D=[],R=[];return _=o(_),N=o(N),h(_.translateX,_.translateY,N.translateX,N.translateY,D,R),b(_.rotate,N.rotate,D,R),x(_.skewX,N.skewX,D,R),S(_.scaleX,_.scaleY,N.scaleX,N.scaleY,D,R),_=N=null,function(F){for(var W=-1,Z=R.length,G;++W<Z;)D[(G=R[W]).i]=G.x(F);return D.join("")}}}var $6e=_de(D6e,"px, ","px)","deg)"),B6e=_de(O6e,", ",")",")"),M6e=1e-12;function tle(o){return((o=Math.exp(o))+1/o)/2}function R6e(o){return((o=Math.exp(o))-1/o)/2}function I6e(o){return((o=Math.exp(2*o))-1)/(o+1)}const P6e=function o(r,l,u){function g(h,b){var x=h[0],S=h[1],_=h[2],N=b[0],D=b[1],R=b[2],F=N-x,W=D-S,Z=F*F+W*W,G,K;if(Z<M6e)K=Math.log(R/_)/r,G=function(ne){return[x+ne*F,S+ne*W,_*Math.exp(r*ne*K)]};else{var q=Math.sqrt(Z),H=(R*R-_*_+u*Z)/(2*_*l*q),de=(R*R-_*_-u*Z)/(2*R*l*q),Je=Math.log(Math.sqrt(H*H+1)-H),De=Math.log(Math.sqrt(de*de+1)-de);K=(De-Je)/r,G=function(ne){var Me=ne*K,ut=tle(Je),st=_/(l*q)*(ut*I6e(r*Me+Je)-R6e(Je));return[x+st*F,S+st*W,_*ut/tle(r*Me+Je)]}}return G.duration=K*1e3*r/Math.SQRT2,G}return g.rho=function(h){var b=Math.max(.001,+h),x=b*b,S=x*x;return o(b,x,S)},g}(Math.SQRT2,2,4);var w4=0,c6=0,a6=0,kde=1e3,rH,u6,aH=0,r_=0,ez=0,R6=typeof performance=="object"&&performance.now?performance:Date,Tde=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(o){setTimeout(o,17)};function Ane(){return r_||(Tde(F6e),r_=R6.now()+ez)}function F6e(){r_=0}function lH(){this._call=this._time=this._next=null}lH.prototype=Ade.prototype={constructor:lH,restart:function(o,r,l){if(typeof o!="function")throw new TypeError("callback is not a function");l=(l==null?Ane():+l)+(r==null?0:+r),!this._next&&u6!==this&&(u6?u6._next=this:rH=this,u6=this),this._call=o,this._time=l,wte()},stop:function(){this._call&&(this._call=null,this._time=1/0,wte())}};function Ade(o,r,l){var u=new lH;return u.restart(o,r,l),u}function L6e(){Ane(),++w4;for(var o=rH,r;o;)(r=r_-o._time)>=0&&o._call.call(void 0,r),o=o._next;--w4}function nle(){r_=(aH=R6.now())+ez,w4=c6=0;try{L6e()}finally{w4=0,H6e(),r_=0}}function V6e(){var o=R6.now(),r=o-aH;r>kde&&(ez-=r,aH=o)}function H6e(){for(var o,r=rH,l,u=1/0;r;)r._call?(u>r._time&&(u=r._time),o=r,r=r._next):(l=r._next,r._next=null,r=o?o._next=l:rH=l);u6=o,wte(u)}function wte(o){if(!w4){c6&&(c6=clearTimeout(c6));var r=o-r_;r>24?(o<1/0&&(c6=setTimeout(nle,o-R6.now()-ez)),a6&&(a6=clearInterval(a6))):(a6||(aH=R6.now(),a6=setInterval(V6e,kde)),w4=1,Tde(nle))}}function ole(o,r,l){var u=new lH;return r=r==null?0:+r,u.restart(g=>{u.stop(),o(g+r)},r,l),u}var z6e=JH("start","end","cancel","interrupt"),U6e=[],Nde=0,sle=1,Cte=2,D9=3,rle=4,xte=5,O9=6;function tz(o,r,l,u,g,h){var b=o.__transition;if(!b)o.__transition={};else if(l in b)return;j6e(o,l,{name:r,index:u,group:g,on:z6e,tween:U6e,time:h.time,delay:h.delay,duration:h.duration,ease:h.ease,timer:null,state:Nde})}function Nne(o,r){var l=s1(o,r);if(l.state>Nde)throw new Error("too late; already scheduled");return l}function Kv(o,r){var l=s1(o,r);if(l.state>D9)throw new Error("too late; already running");return l}function s1(o,r){var l=o.__transition;if(!l||!(l=l[r]))throw new Error("transition not found");return l}function j6e(o,r,l){var u=o.__transition,g;u[r]=l,l.timer=Ade(h,0,l.time);function h(_){l.state=sle,l.timer.restart(b,l.delay,l.time),l.delay<=_&&b(_-l.delay)}function b(_){var N,D,R,F;if(l.state!==sle)return S();for(N in u)if(F=u[N],F.name===l.name){if(F.state===D9)return ole(b);F.state===rle?(F.state=O9,F.timer.stop(),F.on.call("interrupt",o,o.__data__,F.index,F.group),delete u[N]):+N<r&&(F.state=O9,F.timer.stop(),F.on.call("cancel",o,o.__data__,F.index,F.group),delete u[N])}if(ole(function(){l.state===D9&&(l.state=rle,l.timer.restart(x,l.delay,l.time),x(_))}),l.state=Cte,l.on.call("start",o,o.__data__,l.index,l.group),l.state===Cte){for(l.state=D9,g=new Array(R=l.tween.length),N=0,D=-1;N<R;++N)(F=l.tween[N].value.call(o,o.__data__,l.index,l.group))&&(g[++D]=F);g.length=D+1}}function x(_){for(var N=_<l.duration?l.ease.call(null,_/l.duration):(l.timer.restart(S),l.state=xte,1),D=-1,R=g.length;++D<R;)g[D].call(o,N);l.state===xte&&(l.on.call("end",o,o.__data__,l.index,l.group),S())}function S(){l.state=O9,l.timer.stop(),delete u[r];for(var _ in u)return;delete o.__transition}}function $9(o,r){var l=o.__transition,u,g,h=!0,b;if(l){r=r==null?null:r+"";for(b in l){if((u=l[b]).name!==r){h=!1;continue}g=u.state>Cte&&u.state<xte,u.state=O9,u.timer.stop(),u.on.call(g?"interrupt":"cancel",o,o.__data__,u.index,u.group),delete l[b]}h&&delete o.__transition}}function W6e(o){return this.each(function(){$9(this,o)})}function Z6e(o,r){var l,u;return function(){var g=Kv(this,o),h=g.tween;if(h!==l){u=l=h;for(var b=0,x=u.length;b<x;++b)if(u[b].name===r){u=u.slice(),u.splice(b,1);break}}g.tween=u}}function G6e(o,r,l){var u,g;if(typeof l!="function")throw new Error;return function(){var h=Kv(this,o),b=h.tween;if(b!==u){g=(u=b).slice();for(var x={name:r,value:l},S=0,_=g.length;S<_;++S)if(g[S].name===r){g[S]=x;break}S===_&&g.push(x)}h.tween=g}}function q6e(o,r){var l=this._id;if(o+="",arguments.length<2){for(var u=s1(this.node(),l).tween,g=0,h=u.length,b;g<h;++g)if((b=u[g]).name===o)return b.value;return null}return this.each((r==null?Z6e:G6e)(l,o,r))}function Dne(o,r,l){var u=o._id;return o.each(function(){var g=Kv(this,u);(g.value||(g.value={}))[r]=l.apply(this,arguments)}),function(g){return s1(g,u).value[r]}}function Dde(o,r){var l;return(typeof r=="number"?cC:r instanceof M6?Qae:(l=M6(r))?(r=l,Qae):N6e)(o,r)}function Y6e(o){return function(){this.removeAttribute(o)}}function K6e(o){return function(){this.removeAttributeNS(o.space,o.local)}}function X6e(o,r,l){var u,g=l+"",h;return function(){var b=this.getAttribute(o);return b===g?null:b===u?h:h=r(u=b,l)}}function J6e(o,r,l){var u,g=l+"",h;return function(){var b=this.getAttributeNS(o.space,o.local);return b===g?null:b===u?h:h=r(u=b,l)}}function Q6e(o,r,l){var u,g,h;return function(){var b,x=l(this),S;return x==null?void this.removeAttribute(o):(b=this.getAttribute(o),S=x+"",b===S?null:b===u&&S===g?h:(g=S,h=r(u=b,x)))}}function eMe(o,r,l){var u,g,h;return function(){var b,x=l(this),S;return x==null?void this.removeAttributeNS(o.space,o.local):(b=this.getAttributeNS(o.space,o.local),S=x+"",b===S?null:b===u&&S===g?h:(g=S,h=r(u=b,x)))}}function tMe(o,r){var l=QH(o),u=l==="transform"?B6e:Dde;return this.attrTween(o,typeof r=="function"?(l.local?eMe:Q6e)(l,u,Dne(this,"attr."+o,r)):r==null?(l.local?K6e:Y6e)(l):(l.local?J6e:X6e)(l,u,r))}function nMe(o,r){return function(l){this.setAttribute(o,r.call(this,l))}}function oMe(o,r){return function(l){this.setAttributeNS(o.space,o.local,r.call(this,l))}}function sMe(o,r){var l,u;function g(){var h=r.apply(this,arguments);return h!==u&&(l=(u=h)&&oMe(o,h)),l}return g._value=r,g}function rMe(o,r){var l,u;function g(){var h=r.apply(this,arguments);return h!==u&&(l=(u=h)&&nMe(o,h)),l}return g._value=r,g}function aMe(o,r){var l="attr."+o;if(arguments.length<2)return(l=this.tween(l))&&l._value;if(r==null)return this.tween(l,null);if(typeof r!="function")throw new Error;var u=QH(o);return this.tween(l,(u.local?sMe:rMe)(u,r))}function lMe(o,r){return function(){Nne(this,o).delay=+r.apply(this,arguments)}}function iMe(o,r){return r=+r,function(){Nne(this,o).delay=r}}function cMe(o){var r=this._id;return arguments.length?this.each((typeof o=="function"?lMe:iMe)(r,o)):s1(this.node(),r).delay}function uMe(o,r){return function(){Kv(this,o).duration=+r.apply(this,arguments)}}function dMe(o,r){return r=+r,function(){Kv(this,o).duration=r}}function fMe(o){var r=this._id;return arguments.length?this.each((typeof o=="function"?uMe:dMe)(r,o)):s1(this.node(),r).duration}function mMe(o,r){if(typeof r!="function")throw new Error;return function(){Kv(this,o).ease=r}}function gMe(o){var r=this._id;return arguments.length?this.each(mMe(r,o)):s1(this.node(),r).ease}function pMe(o,r){return function(){var l=r.apply(this,arguments);if(typeof l!="function")throw new Error;Kv(this,o).ease=l}}function hMe(o){if(typeof o!="function")throw new Error;return this.each(pMe(this._id,o))}function vMe(o){typeof o!="function"&&(o=ide(o));for(var r=this._groups,l=r.length,u=new Array(l),g=0;g<l;++g)for(var h=r[g],b=h.length,x=u[g]=[],S,_=0;_<b;++_)(S=h[_])&&o.call(S,S.__data__,_,h)&&x.push(S);return new yy(u,this._parents,this._name,this._id)}function bMe(o){if(o._id!==this._id)throw new Error;for(var r=this._groups,l=o._groups,u=r.length,g=l.length,h=Math.min(u,g),b=new Array(u),x=0;x<h;++x)for(var S=r[x],_=l[x],N=S.length,D=b[x]=new Array(N),R,F=0;F<N;++F)(R=S[F]||_[F])&&(D[F]=R);for(;x<u;++x)b[x]=r[x];return new yy(b,this._parents,this._name,this._id)}function yMe(o){return(o+"").trim().split(/^|\s+/).every(function(r){var l=r.indexOf(".");return l>=0&&(r=r.slice(0,l)),!r||r==="start"})}function wMe(o,r,l){var u,g,h=yMe(r)?Nne:Kv;return function(){var b=h(this,o),x=b.on;x!==u&&(g=(u=x).copy()).on(r,l),b.on=g}}function CMe(o,r){var l=this._id;return arguments.length<2?s1(this.node(),l).on.on(o):this.each(wMe(l,o,r))}function xMe(o){return function(){var r=this.parentNode;for(var l in this.__transition)if(+l!==o)return;r&&r.removeChild(this)}}function SMe(){return this.on("end.remove",xMe(this._id))}function EMe(o){var r=this._name,l=this._id;typeof o!="function"&&(o=_ne(o));for(var u=this._groups,g=u.length,h=new Array(g),b=0;b<g;++b)for(var x=u[b],S=x.length,_=h[b]=new Array(S),N,D,R=0;R<S;++R)(N=x[R])&&(D=o.call(N,N.__data__,R,x))&&("__data__"in N&&(D.__data__=N.__data__),_[R]=D,tz(_[R],r,l,R,_,s1(N,l)));return new yy(h,this._parents,r,l)}function _Me(o){var r=this._name,l=this._id;typeof o!="function"&&(o=lde(o));for(var u=this._groups,g=u.length,h=[],b=[],x=0;x<g;++x)for(var S=u[x],_=S.length,N,D=0;D<_;++D)if(N=S[D]){for(var R=o.call(N,N.__data__,D,S),F,W=s1(N,l),Z=0,G=R.length;Z<G;++Z)(F=R[Z])&&tz(F,r,l,Z,R,W);h.push(R),b.push(N)}return new yy(h,b,r,l)}var kMe=Q6.prototype.constructor;function TMe(){return new kMe(this._groups,this._parents)}function AMe(o,r){var l,u,g;return function(){var h=y4(this,o),b=(this.style.removeProperty(o),y4(this,o));return h===b?null:h===l&&b===u?g:g=r(l=h,u=b)}}function Ode(o){return function(){this.style.removeProperty(o)}}function NMe(o,r,l){var u,g=l+"",h;return function(){var b=y4(this,o);return b===g?null:b===u?h:h=r(u=b,l)}}function DMe(o,r,l){var u,g,h;return function(){var b=y4(this,o),x=l(this),S=x+"";return x==null&&(S=x=(this.style.removeProperty(o),y4(this,o))),b===S?null:b===u&&S===g?h:(g=S,h=r(u=b,x))}}function OMe(o,r){var l,u,g,h="style."+r,b="end."+h,x;return function(){var S=Kv(this,o),_=S.on,N=S.value[h]==null?x||(x=Ode(r)):void 0;(_!==l||g!==N)&&(u=(l=_).copy()).on(b,g=N),S.on=u}}function $Me(o,r,l){var u=(o+="")=="transform"?$6e:Dde;return r==null?this.styleTween(o,AMe(o,u)).on("end.style."+o,Ode(o)):typeof r=="function"?this.styleTween(o,DMe(o,u,Dne(this,"style."+o,r))).each(OMe(this._id,o)):this.styleTween(o,NMe(o,u,r),l).on("end.style."+o,null)}function BMe(o,r,l){return function(u){this.style.setProperty(o,r.call(this,u),l)}}function MMe(o,r,l){var u,g;function h(){var b=r.apply(this,arguments);return b!==g&&(u=(g=b)&&BMe(o,b,l)),u}return h._value=r,h}function RMe(o,r,l){var u="style."+(o+="");if(arguments.length<2)return(u=this.tween(u))&&u._value;if(r==null)return this.tween(u,null);if(typeof r!="function")throw new Error;return this.tween(u,MMe(o,r,l??""))}function IMe(o){return function(){this.textContent=o}}function PMe(o){return function(){var r=o(this);this.textContent=r??""}}function FMe(o){return this.tween("text",typeof o=="function"?PMe(Dne(this,"text",o)):IMe(o==null?"":o+""))}function LMe(o){return function(r){this.textContent=o.call(this,r)}}function VMe(o){var r,l;function u(){var g=o.apply(this,arguments);return g!==l&&(r=(l=g)&&LMe(g)),r}return u._value=o,u}function HMe(o){var r="text";if(arguments.length<1)return(r=this.tween(r))&&r._value;if(o==null)return this.tween(r,null);if(typeof o!="function")throw new Error;return this.tween(r,VMe(o))}function zMe(){for(var o=this._name,r=this._id,l=$de(),u=this._groups,g=u.length,h=0;h<g;++h)for(var b=u[h],x=b.length,S,_=0;_<x;++_)if(S=b[_]){var N=s1(S,r);tz(S,o,l,_,b,{time:N.time+N.delay+N.duration,delay:0,duration:N.duration,ease:N.ease})}return new yy(u,this._parents,o,l)}function UMe(){var o,r,l=this,u=l._id,g=l.size();return new Promise(function(h,b){var x={value:b},S={value:function(){--g===0&&h()}};l.each(function(){var _=Kv(this,u),N=_.on;N!==o&&(r=(o=N).copy(),r._.cancel.push(x),r._.interrupt.push(x),r._.end.push(S)),_.on=r}),g===0&&h()})}var jMe=0;function yy(o,r,l,u){this._groups=o,this._parents=r,this._name=l,this._id=u}function $de(){return++jMe}var dy=Q6.prototype;yy.prototype={constructor:yy,select:EMe,selectAll:_Me,selectChild:dy.selectChild,selectChildren:dy.selectChildren,filter:vMe,merge:bMe,selection:TMe,transition:zMe,call:dy.call,nodes:dy.nodes,node:dy.node,size:dy.size,empty:dy.empty,each:dy.each,on:CMe,attr:tMe,attrTween:aMe,style:$Me,styleTween:RMe,text:FMe,textTween:HMe,remove:SMe,tween:q6e,delay:cMe,duration:fMe,ease:gMe,easeVarying:hMe,end:UMe,[Symbol.iterator]:dy[Symbol.iterator]};function WMe(o){return((o*=2)<=1?o*o*o:(o-=2)*o*o+2)/2}var ZMe={time:null,delay:0,duration:250,ease:WMe};function GMe(o,r){for(var l;!(l=o.__transition)||!(l=l[r]);)if(!(o=o.parentNode))throw new Error(`transition ${r} not found`);return l}function qMe(o){var r,l;o instanceof yy?(r=o._id,o=o._name):(r=$de(),(l=ZMe).time=Ane(),o=o==null?null:o+"");for(var u=this._groups,g=u.length,h=0;h<g;++h)for(var b=u[h],x=b.length,S,_=0;_<x;++_)(S=b[_])&&tz(S,o,r,_,b,l||GMe(S,r));return new yy(u,this._parents,o,r)}Q6.prototype.interrupt=W6e;Q6.prototype.transition=qMe;const u9=o=>()=>o;function YMe(o,{sourceEvent:r,target:l,transform:u,dispatch:g}){Object.defineProperties(this,{type:{value:o,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},transform:{value:u,enumerable:!0,configurable:!0},_:{value:g}})}function py(o,r,l){this.k=o,this.x=r,this.y=l}py.prototype={constructor:py,scale:function(o){return o===1?this:new py(this.k*o,this.x,this.y)},translate:function(o,r){return o===0&r===0?this:new py(this.k,this.x+this.k*o,this.y+this.k*r)},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 C4=new py(1,0,0);py.prototype;function vee(o){o.stopImmediatePropagation()}function l6(o){o.preventDefault(),o.stopImmediatePropagation()}function KMe(o){return(!o.ctrlKey||o.type==="wheel")&&!o.button}function XMe(){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 ale(){return this.__zoom||C4}function JMe(o){return-o.deltaY*(o.deltaMode===1?.05:o.deltaMode?1:.002)*(o.ctrlKey?10:1)}function QMe(){return navigator.maxTouchPoints||"ontouchstart"in this}function eRe(o,r,l){var u=o.invertX(r[0][0])-l[0][0],g=o.invertX(r[1][0])-l[1][0],h=o.invertY(r[0][1])-l[0][1],b=o.invertY(r[1][1])-l[1][1];return o.translate(g>u?(u+g)/2:Math.min(0,u)||Math.max(0,g),b>h?(h+b)/2:Math.min(0,h)||Math.max(0,b))}function tRe(){var o=KMe,r=XMe,l=eRe,u=JMe,g=QMe,h=[0,1/0],b=[[-1/0,-1/0],[1/0,1/0]],x=250,S=P6e,_=JH("start","zoom","end"),N,D,R,F=500,W=150,Z=0,G=10;function K(be){be.property("__zoom",ale).on("wheel.zoom",Me,{passive:!1}).on("mousedown.zoom",ut).on("dblclick.zoom",st).filter(g).on("touchstart.zoom",Ne).on("touchmove.zoom",ue).on("touchend.zoom touchcancel.zoom",Mt).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}K.transform=function(be,ke,M,je){var we=be.selection?be.selection():be;we.property("__zoom",ale),be!==we?Je(be,ke,M,je):we.interrupt().each(function(){De(this,arguments).event(je).start().zoom(null,typeof ke=="function"?ke.apply(this,arguments):ke).end()})},K.scaleBy=function(be,ke,M,je){K.scaleTo(be,function(){var we=this.__zoom.k,ot=typeof ke=="function"?ke.apply(this,arguments):ke;return we*ot},M,je)},K.scaleTo=function(be,ke,M,je){K.transform(be,function(){var we=r.apply(this,arguments),ot=this.__zoom,et=M==null?de(we):typeof M=="function"?M.apply(this,arguments):M,ge=ot.invert(et),We=typeof ke=="function"?ke.apply(this,arguments):ke;return l(H(q(ot,We),et,ge),we,b)},M,je)},K.translateBy=function(be,ke,M,je){K.transform(be,function(){return l(this.__zoom.translate(typeof ke=="function"?ke.apply(this,arguments):ke,typeof M=="function"?M.apply(this,arguments):M),r.apply(this,arguments),b)},null,je)},K.translateTo=function(be,ke,M,je,we){K.transform(be,function(){var ot=r.apply(this,arguments),et=this.__zoom,ge=je==null?de(ot):typeof je=="function"?je.apply(this,arguments):je;return l(C4.translate(ge[0],ge[1]).scale(et.k).translate(typeof ke=="function"?-ke.apply(this,arguments):-ke,typeof M=="function"?-M.apply(this,arguments):-M),ot,b)},je,we)};function q(be,ke){return ke=Math.max(h[0],Math.min(h[1],ke)),ke===be.k?be:new py(ke,be.x,be.y)}function H(be,ke,M){var je=ke[0]-M[0]*be.k,we=ke[1]-M[1]*be.k;return je===be.x&&we===be.y?be:new py(be.k,je,we)}function de(be){return[(+be[0][0]+ +be[1][0])/2,(+be[0][1]+ +be[1][1])/2]}function Je(be,ke,M,je){be.on("start.zoom",function(){De(this,arguments).event(je).start()}).on("interrupt.zoom end.zoom",function(){De(this,arguments).event(je).end()}).tween("zoom",function(){var we=this,ot=arguments,et=De(we,ot).event(je),ge=r.apply(we,ot),We=M==null?de(ge):typeof M=="function"?M.apply(we,ot):M,kt=Math.max(ge[1][0]-ge[0][0],ge[1][1]-ge[0][1]),Ve=we.__zoom,pt=typeof ke=="function"?ke.apply(we,ot):ke,Ie=S(Ve.invert(We).concat(kt/Ve.k),pt.invert(We).concat(kt/pt.k));return function(vt){if(vt===1)vt=pt;else{var se=Ie(vt),pn=kt/se[2];vt=new py(pn,We[0]-se[0]*pn,We[1]-se[1]*pn)}et.zoom(null,vt)}})}function De(be,ke,M){return!M&&be.__zooming||new ne(be,ke)}function ne(be,ke){this.that=be,this.args=ke,this.active=0,this.sourceEvent=null,this.extent=r.apply(be,ke),this.taps=0}ne.prototype={event:function(be){return be&&(this.sourceEvent=be),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(be,ke){return this.mouse&&be!=="mouse"&&(this.mouse[1]=ke.invert(this.mouse[0])),this.touch0&&be!=="touch"&&(this.touch0[1]=ke.invert(this.touch0[0])),this.touch1&&be!=="touch"&&(this.touch1[1]=ke.invert(this.touch1[0])),this.that.__zoom=ke,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(be){var ke=e1(this.that).datum();_.call(be,this.that,new YMe(be,{sourceEvent:this.sourceEvent,target:K,type:be,transform:this.that.__zoom,dispatch:_}),ke)}};function Me(be,...ke){if(!o.apply(this,arguments))return;var M=De(this,ke).event(be),je=this.__zoom,we=Math.max(h[0],Math.min(h[1],je.k*Math.pow(2,u.apply(this,arguments)))),ot=zv(be);if(M.wheel)(M.mouse[0][0]!==ot[0]||M.mouse[0][1]!==ot[1])&&(M.mouse[1]=je.invert(M.mouse[0]=ot)),clearTimeout(M.wheel);else{if(je.k===we)return;M.mouse=[ot,je.invert(ot)],$9(this),M.start()}l6(be),M.wheel=setTimeout(et,W),M.zoom("mouse",l(H(q(je,we),M.mouse[0],M.mouse[1]),M.extent,b));function et(){M.wheel=null,M.end()}}function ut(be,...ke){if(R||!o.apply(this,arguments))return;var M=be.currentTarget,je=De(this,ke,!0).event(be),we=e1(be.view).on("mousemove.zoom",We,!0).on("mouseup.zoom",kt,!0),ot=zv(be,M),et=be.clientX,ge=be.clientY;bde(be.view),vee(be),je.mouse=[ot,this.__zoom.invert(ot)],$9(this),je.start();function We(Ve){if(l6(Ve),!je.moved){var pt=Ve.clientX-et,Ie=Ve.clientY-ge;je.moved=pt*pt+Ie*Ie>Z}je.event(Ve).zoom("mouse",l(H(je.that.__zoom,je.mouse[0]=zv(Ve,M),je.mouse[1]),je.extent,b))}function kt(Ve){we.on("mousemove.zoom mouseup.zoom",null),yde(Ve.view,je.moved),l6(Ve),je.event(Ve).end()}}function st(be,...ke){if(o.apply(this,arguments)){var M=this.__zoom,je=zv(be.changedTouches?be.changedTouches[0]:be,this),we=M.invert(je),ot=M.k*(be.shiftKey?.5:2),et=l(H(q(M,ot),je,we),r.apply(this,ke),b);l6(be),x>0?e1(this).transition().duration(x).call(Je,et,je,be):e1(this).call(K.transform,et,je,be)}}function Ne(be,...ke){if(o.apply(this,arguments)){var M=be.touches,je=M.length,we=De(this,ke,be.changedTouches.length===je).event(be),ot,et,ge,We;for(vee(be),et=0;et<je;++et)ge=M[et],We=zv(ge,this),We=[We,this.__zoom.invert(We),ge.identifier],we.touch0?!we.touch1&&we.touch0[2]!==We[2]&&(we.touch1=We,we.taps=0):(we.touch0=We,ot=!0,we.taps=1+!!N);N&&(N=clearTimeout(N)),ot&&(we.taps<2&&(D=We[0],N=setTimeout(function(){N=null},F)),$9(this),we.start())}}function ue(be,...ke){if(this.__zooming){var M=De(this,ke).event(be),je=be.changedTouches,we=je.length,ot,et,ge,We;for(l6(be),ot=0;ot<we;++ot)et=je[ot],ge=zv(et,this),M.touch0&&M.touch0[2]===et.identifier?M.touch0[0]=ge:M.touch1&&M.touch1[2]===et.identifier&&(M.touch1[0]=ge);if(et=M.that.__zoom,M.touch1){var kt=M.touch0[0],Ve=M.touch0[1],pt=M.touch1[0],Ie=M.touch1[1],vt=(vt=pt[0]-kt[0])*vt+(vt=pt[1]-kt[1])*vt,se=(se=Ie[0]-Ve[0])*se+(se=Ie[1]-Ve[1])*se;et=q(et,Math.sqrt(vt/se)),ge=[(kt[0]+pt[0])/2,(kt[1]+pt[1])/2],We=[(Ve[0]+Ie[0])/2,(Ve[1]+Ie[1])/2]}else if(M.touch0)ge=M.touch0[0],We=M.touch0[1];else return;M.zoom("touch",l(H(et,ge,We),M.extent,b))}}function Mt(be,...ke){if(this.__zooming){var M=De(this,ke).event(be),je=be.changedTouches,we=je.length,ot,et;for(vee(be),R&&clearTimeout(R),R=setTimeout(function(){R=null},F),ot=0;ot<we;++ot)et=je[ot],M.touch0&&M.touch0[2]===et.identifier?delete M.touch0:M.touch1&&M.touch1[2]===et.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(et=zv(et,this),Math.hypot(D[0]-et[0],D[1]-et[1])<G)){var ge=e1(this).on("dblclick.zoom");ge&&ge.apply(this,arguments)}}}return K.wheelDelta=function(be){return arguments.length?(u=typeof be=="function"?be:u9(+be),K):u},K.filter=function(be){return arguments.length?(o=typeof be=="function"?be:u9(!!be),K):o},K.touchable=function(be){return arguments.length?(g=typeof be=="function"?be:u9(!!be),K):g},K.extent=function(be){return arguments.length?(r=typeof be=="function"?be:u9([[+be[0][0],+be[0][1]],[+be[1][0],+be[1][1]]]),K):r},K.scaleExtent=function(be){return arguments.length?(h[0]=+be[0],h[1]=+be[1],K):[h[0],h[1]]},K.translateExtent=function(be){return arguments.length?(b[0][0]=+be[0][0],b[1][0]=+be[1][0],b[0][1]=+be[0][1],b[1][1]=+be[1][1],K):[[b[0][0],b[0][1]],[b[1][0],b[1][1]]]},K.constrain=function(be){return arguments.length?(l=be,K):l},K.duration=function(be){return arguments.length?(x=+be,K):x},K.interpolate=function(be){return arguments.length?(S=be,K):S},K.on=function(){var be=_.on.apply(_,arguments);return be===_?K:be},K.clickDistance=function(be){return arguments.length?(Z=(be=+be)*be,K):Math.sqrt(Z)},K.tapDistance=function(be){return arguments.length?(G=+be,K):G},K}var rs=(o=>(o.Left="left",o.Top="top",o.Right="right",o.Bottom="bottom",o))(rs||{}),One=(o=>(o.Partial="partial",o.Full="full",o))(One||{}),zE=(o=>(o.Bezier="default",o.SimpleBezier="simple-bezier",o.Straight="straight",o.Step="step",o.SmoothStep="smoothstep",o))(zE||{}),wC=(o=>(o.Strict="strict",o.Loose="loose",o))(wC||{}),iH=(o=>(o.Arrow="arrow",o.ArrowClosed="arrowclosed",o))(iH||{}),b6=(o=>(o.Free="free",o.Vertical="vertical",o.Horizontal="horizontal",o))(b6||{}),Bde=(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))(Bde||{});const nRe=["INPUT","SELECT","TEXTAREA"];function Ste(o){var r,l;const u=((l=(r=o.composedPath)==null?void 0:r.call(o))==null?void 0:l[0])||o.target,g=typeof(u==null?void 0:u.hasAttribute)=="function"?u.hasAttribute("contenteditable"):!1,h=typeof(u==null?void 0:u.closest)=="function"?u.closest(".nokey"):null;return nRe.includes(u==null?void 0:u.nodeName)||g||!!h}function oRe(o){return o.ctrlKey||o.metaKey||o.shiftKey||o.altKey}function lle(o,r,l,u){const g=r.replace("+",`
121
+ `));return be(ie.split(""),u).length},et=(ee,le)=>{const ie=M(ee,le).join("");return we(ie)},ge=(ee,le)=>{const ie=M(ee,le).join("").replace(/\s/g,"");return we(ie)},We=(ee,le)=>()=>le(ee.getBody(),ee.schema),kt=(ee,le)=>()=>le(ee.selection.getRng().cloneContents(),ee.schema),Ve=ee=>We(ee,ot),pt=ee=>({body:{getWordCount:Ve(ee),getCharacterCount:We(ee,et),getCharacterCountWithoutSpaces:We(ee,ge)},selection:{getWordCount:kt(ee,ot),getCharacterCount:kt(ee,et),getCharacterCountWithoutSpaces:kt(ee,ge)},getCount:Ve(ee)}),Ie=(ee,le)=>{ee.windowManager.open({title:"Word Count",body:{type:"panel",items:[{type:"table",header:["Count","Document","Selection"],cells:[["Words",String(le.body.getWordCount()),String(le.selection.getWordCount())],["Characters (no spaces)",String(le.body.getCharacterCountWithoutSpaces()),String(le.selection.getCharacterCountWithoutSpaces())],["Characters",String(le.body.getCharacterCount()),String(le.selection.getCharacterCount())]]}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}]})},vt=(ee,le)=>{ee.addCommand("mceWordCount",()=>Ie(ee,le))};var se=tinymce.util.Tools.resolve("tinymce.util.Delay");const pn=(ee,le)=>{ee.dispatch("wordCountUpdate",{wordCount:{words:le.body.getWordCount(),characters:le.body.getCharacterCount(),charactersWithoutSpaces:le.body.getCharacterCountWithoutSpaces()}})},wt=(ee,le)=>{pn(ee,le)},St=(ee,le,ie)=>{const te=h(()=>wt(ee,le),ie);ee.on("init",()=>{wt(ee,le),se.setEditorTimeout(ee,()=>{ee.on("SetContent BeforeAddUndo Undo Redo ViewUpdate keyup",te.throttle)},0),ee.on("remove",te.cancel)})},zt=ee=>{const le=()=>ee.execCommand("mceWordCount");ee.ui.registry.addButton("wordcount",{tooltip:"Word count",icon:"character-count",onAction:le,context:"any"}),ee.ui.registry.addMenuItem("wordcount",{text:"Word count",icon:"character-count",onAction:le,context:"any"})};var mt=(ee=300)=>{o.add("wordcount",le=>{const ie=pt(le);return vt(le,ie),zt(le),St(le,ie,ee),ie})};mt()})();const mOe=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),gOe=(o,r="wps_office")=>{const l=o.split(","),u=l[0].match(/:(.*?);/)[1],g=atob(l[1]);let h=g.length;const b=new Uint8Array(h);for(;h--;)b[h]=g.charCodeAt(h);return new File([b],r,{type:u})},pOe=o=>btoa(o.match(/\w{2}/g).map(r=>String.fromCharCode(parseInt(r,16))).join(""));function hOe(o){if(!o)return[];let r=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,l=new RegExp(`(?:(${r.source}))([\\da-fA-F\\s]+)\\}`,"g"),u=o.match(l);console.log("images",u);const g=[];if(u||(r=/{\\pict[\s\S]+?(\\pngblip-?\d+)?(\\wmetafile8-?\d+)?{\\\*\\blipuid\s?[\da-fA-F]+[\s}]*?/,l=new RegExp(`(?:(${r.source}))([\\da-fA-F\\s]+)\\}`,"g"),u=o.match(l)),u)for(const h of u){let b=!1;if(h.includes("\\pngblip")?b="image/png":h.includes("\\jpegblip")&&(b="image/jpeg"),b){const x=h.replace(r,"").replace(/[^\da-fA-F]/g,""),S=`data:${b};base64,${pOe(x)}`;g.push({base64:S,file:gOe(S)})}}return g}const vOe=(o,r)=>{if(!r)return o;try{const u=new DOMParser().parseFromString(o,"text/html"),g=u.querySelectorAll("img"),b=(r.clipboardData||window.Clipboard).getData("text/rtf"),x=hOe(b);return g.forEach((S,_)=>{var D;const N=S.getAttribute("src");if(N&&N.startsWith("file:")&&(D=x==null?void 0:x[_])!=null&&D.base64){const R=x[_].base64;S.setAttribute("src",R)}}),u.body.innerHTML}catch{return o}},bOe=o=>{const r=atob(o.split(",")[1]),l=o.split(",")[0].split(":")[1].split(";")[0],u=new ArrayBuffer(r.length),g=new Uint8Array(u);for(let h=0;h<r.length;h++)g[h]=r.charCodeAt(h);return new Blob([u],{type:l})},yOe=async o=>{try{const r=bOe(o),l=new FormData;l.append("files",r,"image.png");const g=await(await fetch(`${process.env.NODE_ENV==="development"?"/api":""}/ajax/uploaddoc`,{method:"POST",body:l})).json();if(g.status===1)return g.file_url;throw new Error(g.message)}catch(r){throw r}},wOe=async o=>{const l=new DOMParser().parseFromString(o,"text/html"),u=l.getElementsByTagName("img"),g=[],h=3;for(let b=0;b<u.length;b++){const x=u[b],S=x.getAttribute("src");S&&S.startsWith("data:image")&&(g.push({img:x,src:S,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 b=0;b<g.length;b+=h){const S=g.slice(b,b+h).map(async _=>{try{const N=await yOe(_.src);_.img.setAttribute("src",N)}catch{_.img.remove()}});await Promise.all(S)}return l.body.innerHTML},COe=o=>{o.querySelectorAll("td").forEach(l=>{const u=l.getAttribute("width"),g=l.getAttribute("style")||"";u==="0"&&g.includes("border:none")&&l.remove()})},xOe=o=>{o.querySelectorAll("table").forEach(l=>{l.style.maxWidth="100%"})},SOe=o=>{o.querySelectorAll("table").forEach(l=>{l.style.tableLayout="fixed";const u=l.getAttribute("style")||"";if(u){const g=u.split(";").filter(b=>b.trim()),h=[];g.forEach(b=>{const[x,S]=b.split(":").map(_=>_.trim());x&&S&&(["margin","margin-right","margin-left"].includes(x.toLowerCase())||h.push(`${x}: ${S}`))}),h.some(b=>b.toLowerCase().startsWith("width"))||h.push("width: 100%"),l.setAttribute("style",h.join("; "))}})},EOe=o=>{o.querySelectorAll("table").forEach(l=>{const u=l.querySelectorAll("tr");if(u.length>0){const b=u[0].querySelectorAll("td, th").length;if(b>0){const x=(100/b).toFixed(2);u.forEach(S=>{S.querySelectorAll("td, th").forEach((N,D)=>{const R=N,F=parseInt(R.getAttribute("colspan")||"1"),W=(parseFloat(x)*F).toFixed(2),G=(R.getAttribute("style")||"").split(";").filter(q=>!q.trim().toLowerCase().startsWith("width")).join(";"),K=G?`${G}; width: ${W}%`:`width: ${W}%`;R.setAttribute("style",K)})})}}})},_Oe=o=>{o.querySelectorAll("table").forEach(l=>{const u=l.querySelectorAll("td");let g=!1,h="";for(const b of u){const x=b.getAttribute("style")||"",S=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);(S?S[0]:"").includes("double")&&(g=!0,S&&(h=S[0].replace(/^border(?:-(?:right|left|top|bottom))?(?:-style)?:\s*/,""),b.style.borderTop=h,b.style.borderRight=h,b.style.borderBottom=h,b.style.borderLeft=h))}g&&h&&(l.style.borderCollapse="separate",l.style.borderSpacing="2px",l.style.border=h)})},kOe=o=>{o.querySelectorAll("table").forEach(l=>{l.querySelectorAll("td[rowspan]").forEach(g=>{const x=((g.getAttribute("style")||"").match(/border-[^:]+:[^;]+(?:solid|double)[^;]+/g)||[]).find(S=>!S.includes("none"));if(x){const S=x.split(":")[1].trim();g.style.borderBottom=S}})})},TOe=o=>{o.querySelectorAll('[style*="mso-"]').forEach(l=>{const g=(l.getAttribute("style")||"").replace(/mso-[^:]+:[^;]+;/g,"");l.setAttribute("style",g)})},AOe=o=>{o.querySelectorAll('[style*="tab-stops"]').forEach(l=>{const g=(l.getAttribute("style")||"").replace(/tab-stops:[^;]+;/g,"");l.setAttribute("style",g)})},NOe=o=>{o=o.replace(/<a(?!.*?href=)[^>]*>([\s\S]*?)<\/a>/gi,"$1");const l=new DOMParser().parseFromString(o,"text/html");return COe(l),xOe(l),_Oe(l),kOe(l),TOe(l),AOe(l),SOe(l),EOe(l),o=l.body.innerHTML,o};Q9.PluginManager.add("pasteprocess",o=>(o.on("paste",r=>{if(r.clipboardData){const l=r.clipboardData.getData("text/html")||r.clipboardData.getData("text");if(mOe(l)){r.preventDefault();const u=o.windowManager.open({title:"处理中",body:{type:"panel",items:[{type:"htmlpanel",html:'<div style="text-align: center; padding: 20px;">正在处理Word内容,请稍候...</div>'}]},buttons:[]}),g=NOe(l),h=vOe(g,r);wOe(h).then(b=>{o.insertContent(b),u.close()})}}}),{}));let s9="A4";const ute={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}},DOe=Object.keys(ute).map(o=>`pagesize${o}`).join(" ");Q9.PluginManager.add("pagesize",o=>{const r=o.options.register;r("pagesize",{processor:"string",default:"A4"}),s9=(g=>h=>h.options.get(g))("pagesize")(o);const u=g=>{const h=ute[g];if(h){const b=(window.devicePixelRatio||1)*96,x=h.width*b/25.4;o!=null&&o.container&&(o.container.style.minWidth=`${x}px`);const S=o.contentAreaContainer.querySelector("iframe");S&&(S.style.width=`${x}px`),o.fire("pagesizechange",{size:g})}};return Object.keys(ute).forEach(g=>{o.ui.registry.addToggleMenuItem(`pagesize${g}`,{text:g,onAction:()=>{s9=g,u(g)},onSetup:h=>(h.setActive(s9===g),()=>{})})}),o.on("init",()=>{u(s9)}),{}});const OOe=["accordion","advlist","anchor","autolink","autosave","charmap","directionality","importcss","insertdatetime","lists","image","media","pagebreak","preview","save","searchreplace","table","fullscreen","wordcount","pasteprocess","pagesize"],$Oe="undo redo | blocks bold italic forecolor removeformat alignleft aligncenter alignright alignjustify outdent indent pagebreakfullscreen preview",BOe={license_key:"gpl",skin:!1,content_css:["css/content.css","css/reset.css"],promotion:!1,menu:{pagesize:{title:"页面大小",items:DOe}},menubar:"file edit insert table tools help pagesize",cleanup:!0,branding:!1,language:"zh_CN",plugins:OOe,toolbar:$Oe,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((r,l)=>{const u=new FormData;u.append("files",o.blob(),o.filename()),fetch(`${process.env.NODE_ENV==="development"?"/api":""}/ajax/uploaddoc`,{method:"POST",body:u}).then(g=>g.json()).then(g=>{g.status===1?r(g.file_url):l(`上传失败: ${g.message}`)}).catch(g=>{l(`上传出错: ${g.message}`)})})},MOe={name:"ProEditor",components:{Editor:dOe},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:r}){Vm(o.modelValue);const l=d.ref(null),u=d.reactive({myInit:h(BOe),contentValue:o.modelValue,timeout:null});d.onMounted(()=>{Q9.init({license_key:"gpl"}),Q9.activeEditor.on("pagesizechange",b=>{r("update:pagesize",b.size)})}),d.watch(()=>u.contentValue,()=>{g(()=>{r("update:modelValue",u.contentValue)})}),d.watch(()=>o.modelValue,b=>{!q9(b)&&b!==u.contentValue&&(u.contentValue=b)}),d.watch(()=>o.height,b=>{var x,S,_,N,D,R,F,W;l.value&&((W=(N=(_=(S=(x=l.value)==null?void 0:x.getEditor)==null?void 0:S.call(x))==null?void 0:_.dom)==null?void 0:N.setStyle)==null||W.call(N,(F=(R=(D=l.value)==null?void 0:D.getEditor)==null?void 0:R.call(D))==null?void 0:F.editorContainer,"height",b+"px"))});function g(b,x=400){u.timeout!==null&&clearTimeout(u.timeout),u.timeout=setTimeout(b,x)}function h(b){var N;o!=null&&o.height&&(b.height=o.height),o!=null&&o.width&&(b.width=o.width);const{placeholder:x,pagesize:S}=o,_=`${location==null?void 0:location.origin}/${q9(window==null?void 0:window.zyuiAssetsPath)?"assets/":window==null?void 0:window.zyuiAssetsPath}`;return b={...b,content_css:(N=b==null?void 0:b.content_css)==null?void 0:N.map(D=>D.includes("http")?D:`${_}${D}`),placeholder:x,...o.hasPagesize&&{menu:{...b.menu,pagesize:b.menu.pagesize},menubar:b.menubar.includes("pagesize")?b.menubar:`${b.menubar} pagesize`,pagesize:S},...!o.hasPagesize&&{menu:Object.fromEntries(Object.entries(b.menu).filter(([D])=>D!=="pagesize")),menubar:b.menubar.replace(/pagesize/g,"").trim(),pagesize:""}},b}return{...d.toRefs(u),editorRef:l,customer:h,debounce:g}}},ROe={class:"my-tinymce"};function IOe(o,r,l,u,g,h){const b=d.resolveComponent("Editor");return d.openBlock(),d.createElementBlock("div",ROe,[d.createVNode(b,{modelValue:o.contentValue,"onUpdate:modelValue":r[0]||(r[0]=x=>o.contentValue=x),init:o.myInit,ref:"editorRef"},null,8,["modelValue","init"])])}const Fue=vl(MOe,[["render",IOe]]),POe={name:"ShadowDomWrap",setup(o,{emit:r,expose:l}){const u=d.ref(null),g=d.ref(),h=d.ref(!1),b=S=>{if(S.target.closest(".context-menu")||!u.value)return;const N=u.value.contains(S.target);!N&&h.value?(h.value=!1,r("onBlur")):N&&!h.value&&(h.value=!0,r("onFocus"))},x=S=>{h.value=!0,r("onFocus"),S.stopPropagation()};return d.onMounted(()=>{var D,R,F;g.value=(D=u.value)==null?void 0:D.attachShadow({mode:"open"}),document.addEventListener("click",b);const S=q9(window==null?void 0:window.zyuiAssetsPath)?"assets/":window==null?void 0:window.zyuiAssetsPath,_=document.createElement("link");_.rel="stylesheet",_.href=`${location==null?void 0:location.origin}/${S}css/index.min.css`,(R=g.value)==null||R.appendChild(_);const N=document.createElement("link");N.rel="stylesheet",N.href=`${location==null?void 0:location.origin}/${S}css/reset.css`,(F=g.value)==null||F.appendChild(N)}),d.onUnmounted(()=>{document.removeEventListener("click",b)}),l({focus:()=>{h.value=!0}}),{shadowHost:u,shadowRoot:g,handleClick:x}}};function FOe(o,r,l,u,g,h){return d.openBlock(),d.createElementBlock("div",{ref:"shadowHost",class:"shadow-host",onClick:r[0]||(r[0]=d.withModifiers((...b)=>u.handleClick&&u.handleClick(...b),["stop"]))},[u.shadowRoot?(d.openBlock(),d.createBlock(d.Teleport,{key:0,to:u.shadowRoot},[d.renderSlot(o.$slots,"default")],8,["to"])):d.createCommentVNode("",!0)],512)}const yne=vl(POe,[["render",FOe]]),LOe=["innerHTML"],Lue=d.defineComponent({__name:"index",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const r=d.useModel(o,"modelValue");return(l,u)=>(d.openBlock(),d.createBlock(yne,null,{default:d.withCtx(()=>[d.createElementVNode("div",{innerHTML:r.value},null,8,LOe)]),_:1}))}}),Vue=Symbol("nodesUI"),cf=()=>{const o=d.inject(Vue);if(!o)throw new Error("NodesUI context not found");return o};function wne(o){if(!o||!o.ownerDocument)return null;const r=[];let l=o;for(;l&&l.nodeType===Node.ELEMENT_NODE;){let u=l.nodeName.toLowerCase();if(l.id){u=`#${CSS.escape(l.id)}`,r.unshift(u);break}if(l.className&&typeof l.className=="string"){const g=l.className.trim().split(/\s+/);g.length>0&&g[0]&&(u+=`.${CSS.escape(g[0])}`)}if(l.parentElement){const h=Array.from(l.parentElement.children).filter(b=>b.nodeName.toLowerCase()===l.nodeName.toLowerCase());if(h.length>1){const b=h.indexOf(l)+1;u+=`:nth-of-type(${b})`}}if(r.unshift(u),l=l.parentElement,l&&(l.nodeName.toLowerCase()==="body"||l.nodeName.toLowerCase()==="html"))break}return r.length?r.join(" > "):null}function VOe(o,r){if(!r)return null;try{return(r.shadowRoot||r).querySelector(`#${CSS.escape(o)}`)}catch(l){return console.error("nodePath query error:",l),null}}function Hue(o,r){if(!r)return null;try{return(r.shadowRoot||r).querySelector(o)}catch(l){return console.error("nodePath query error:",l),null}}const Q3=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}`:""),zue=o=>{if(o.nodeType===Node.TEXT_NODE)return o;let r=null;for(let l=o.childNodes.length-1;l>=0;l--){const u=o.childNodes[l],g=zue(u);if(g){r=g;break}}return r},HOe=(o,r,l)=>{var u,g,h;if(!Cne(o)){const b=l==null?void 0:l.getRootNode(),x=(u=b==null?void 0:b.getSelection)==null?void 0:u.call(b),S=Hue(o.nodePath,l);if(x&&o.startOffset!==void 0&&r&&S){const _=document.createRange(),N=(o==null?void 0:o.textNodeIndex)||0,D=S.childNodes[N]||S;let R,F;if(D.nodeType===Node.TEXT_NODE)R=D,F=Math.min(o.startOffset,((g=D.textContent)==null?void 0:g.length)||0);else{const Z=zue(D);Z?(R=Z,F=((h=Z.textContent)==null?void 0:h.length)||0):(R=D,F=0)}_.setStart(R,F),_.setEnd(R,F);const W=document.createElement("span");W.classList.add("empty-text-node"),_.insertNode(W),_.insertNode(r),_.setStartAfter(r),_.collapse(!0),x.removeAllRanges(),x.addRange(_)}}},zOe=(o,r)=>{r!=null&&r.id&&(o.id=r==null?void 0:r.id),(r==null?void 0:r.nodePath)!==void 0&&o.setAttribute("data-nodePath",r.nodePath),(r==null?void 0:r.textNodeIndex)!==void 0&&r.textNodeIndex>=0&&o.setAttribute("data-textNodeIndex",r.textNodeIndex.toString()),r.startOffset!==void 0&&r.startOffset>=0&&o.setAttribute("data-startOffset",r.startOffset.toString()),(r==null?void 0:r.subNodeSort)!==void 0&&r.subNodeSort>=0&&o.setAttribute("data-subNodeSort",r.subNodeSort.toString()),(r==null?void 0:r.groupKey)!==void 0&&o.setAttribute("data-groupKey",r.groupKey)},UOe=o=>{const r=o.parentNode;if(!r)return-1;let l=0;for(let u=0;u<r.childNodes.length;u++){const g=r.childNodes[u];if(g===o)return l;l++,g.nodeType===Node.ELEMENT_NODE&&(g.classList.contains("node-item")&&(l-=2,l<0&&(l=0)),g.classList.contains("empty-text-node")&&(l-=1,l<0&&(l=0)))}return-1},jOe=o=>{const r=o.closest("TD"),l=o.closest(".node-item");let u=null;if(l?u=l:r&&r.classList.contains("node-item-td")&&(u=r),!u)return null;const g=u||o;let h=g==null?void 0:g.getAttribute("data-nodePath");if(h||(h=wne(g)),(g==null?void 0:g.getAttribute("selectable"))==="false")return null;const b={element:g,nodePath:h},x=g==null?void 0:g.getAttribute("data-textNodeIndex");x&&(b.textNodeIndex=Number(x));const S=g==null?void 0:g.getAttribute("data-startOffset");S&&(b.startOffset=Number(S));const _=g==null?void 0:g.getAttribute("data-subNodeSort");_&&(b.subNodeSort=Number(_));const N=g==null?void 0:g.getAttribute("data-groupKey");N&&(b.groupKey=N);const D=g==null?void 0:g.getAttribute("id");return D&&(b.id=D),b},Uue=o=>o2e(o,r=>d.toValue(r.nodes).map(l=>({...l,color:r.color,activated:r==null?void 0:r.activated,dataGroupKey:r.id}))),eH=(o,r)=>{const l=o.startsWith("#")?o.slice(1):o;let u,g,h;if(l.length===3)u=parseInt(l[0]+l[0],16),g=parseInt(l[1]+l[1],16),h=parseInt(l[2]+l[2],16);else if(l.length===6)u=parseInt(l.substring(0,2),16),g=parseInt(l.substring(2,4),16),h=parseInt(l.substring(4,6),16);else return console.warn("Invalid color format:",o),`rgba(0, 0, 0, ${r})`;return`rgba(${u}, ${g}, ${h}, ${r})`},WOe=o=>{const{element:r}=o;if(!r)return null;if(r.tagName.toLowerCase()!=="td")return{showTextType:"input"};const u=r.closest("tr"),g=Array.from(u.parentElement.children).indexOf(u),h=Array.from(u.children).indexOf(r),b=r.closest("table"),x=r.closest("body").querySelectorAll("table");return{showTextType:"cell",tableIndex:Array.from(x).indexOf(b)+1,colIndex:h,rowIndex:g}},ZOe=(o,r)=>{var g,h;let l=1;const u=(g=o==null?void 0:o.map(b=>r==null?void 0:r.find(x=>(x==null?void 0:x.id)===(b==null?void 0:b.id))))==null?void 0:g.filter(Boolean);return(u==null?void 0:u.length)>0?(h=u==null?void 0:u.map(x=>{const S=WOe(x);return S?(S==null?void 0:S.showTextType)==="input"?{...x,...S,inputIndex:l++}:{...x,...S}:null}))==null?void 0:h.filter(Boolean):[]};function GOe(o){if(!o||o.length===0)return[];const r=[...o].sort((g,h)=>g.rowIndex!==h.rowIndex?g.rowIndex-h.rowIndex:g.colIndex-h.colIndex),l=[],u=new Set;for(const g of r){if(u.has(g))continue;const h=[];let b=0,x=0;for(let S=g.colIndex;r.find(N=>N.rowIndex===g.rowIndex&&N.colIndex===S&&!u.has(N));S++)x++;if(x!==0){b=x;for(let S=g.rowIndex;;S++){let _=0;const N=[];for(let D=g.colIndex;D<g.colIndex+b;D++){const R=r.find(F=>F.rowIndex===S&&F.colIndex===D&&!u.has(F));if(R)_++,N.push(R);else break}if(_===b)h.push(...N);else break}h.length>0&&(l.push([...h]),h.forEach(S=>u.add(S)))}}return l}function qOe(o){if(!o||o.length===0)return{min:null,max:null};let r=o[0],l=o[0];for(const u of o)(u.colIndex<r.colIndex||u.colIndex===r.colIndex&&u.rowIndex<r.rowIndex)&&(r=u),(u.colIndex>l.colIndex||u.colIndex===l.colIndex&&u.rowIndex>l.rowIndex)&&(l=u);return{min:r,max:l}}const jue=(o,r)=>{var _;const l=ZOe(o,r||[]),u=[],g=[];(_=d.toValue(l))==null||_.forEach(N=>{(N==null?void 0:N.showTextType)==="input"?u.push(N):g.push(N)});const h=a2e(g,"tableIndex"),b=Object.entries(h).map(([N,D])=>({tableIndex:Number(N),nodes:D})),x=Tce(b==null?void 0:b.map(N=>GOe(N==null?void 0:N.nodes))),S=(x==null?void 0:x.map(N=>qOe(N)))||[];return[...u,...S]},d4=o=>{function r(l){let u="";for(;l>=0;)u=String.fromCharCode(65+l%26)+u,l=Math.floor(l/26)-1;return u}return(o==null?void 0:o.colIndex)>=0&&(o==null?void 0:o.rowIndex)>=0?`${r(o==null?void 0:o.colIndex)}${o==null?void 0:o.rowIndex}`:""},YOe=(o,r)=>{const l=jue(o,r||[]),u=[];return l==null||l.forEach(g=>{var h,b;(g==null?void 0:g.showTextType)==="input"?u.push(`填写${g==null?void 0:g.inputIndex}`):u.push(((h=g==null?void 0:g.min)==null?void 0:h.id)===((b=g==null?void 0:g.max)==null?void 0:b.id)?d4(g==null?void 0:g.min):`${d4(g==null?void 0:g.min)}:${d4(g==null?void 0:g.max)}`)}),u==null?void 0:u.join(",")},Cne=o=>o.startOffset===void 0&&o.textNodeIndex===void 0,KOe=o=>{var r;if(((r=o.textContent)==null?void 0:r.trim())===""&&o.querySelector("p")){const l=o.querySelector("p");if(l){const u=D=>{const R={};return D&&D.split(";").forEach(F=>{const[W,Z]=F.split(":").map(G=>G.trim());W&&Z&&(R[W]=Z)}),R},g=D=>Object.entries(D).map(([R,F])=>`${R}: ${F}`).join("; "),h=u(o.getAttribute("style")||""),b=u(l.getAttribute("style")||""),x=l.querySelectorAll("span");let S={};x.forEach(D=>{const R=u(D.getAttribute("style")||"");S={...S,...R}});const _={...h,...b,...S},N=g(_);N&&o.setAttribute("style",N),o.removeChild(l)}}},XOe=o=>{var l;return(l=ua(o))==null?void 0:l.map(u=>(u==null||delete u.element,u))},JOe={key:0,class:"td-node"},QOe={key:1},e$e=d.defineComponent({__name:"index",props:{node:{}},setup(o){const r=o,l=d.computed(()=>{var u,g;return((g=(u=r==null?void 0:r.node)==null?void 0:u.element)==null?void 0:g.tagName)==="TD"});return(u,g)=>{var h,b;return l.value?(d.openBlock(),d.createElementBlock("span",JOe,d.toDisplayString((h=r==null?void 0:r.node)==null?void 0:h.label),1)):(d.openBlock(),d.createElementBlock("span",QOe,d.toDisplayString((b=r==null?void 0:r.node)==null?void 0:b.label),1))}}}),Wue=Symbol("nodesEditor"),Sy=()=>{const o=d.inject(Wue);if(!o)throw new Error("NodesEditor context not found");return o},qH=d.defineComponent({__name:"index",props:{node:{}},setup(o){const r=o,{currentNodes:l}=cf(),{nodes:u,renderType:g,disabledNodes:h}=Sy(),b=d.computed(()=>{var D;return(D=r.node)!=null&&D.id?u.value.some(R=>R.id===r.node.id):!1}),x=d.computed(()=>{var D;if(!((D=r.node)!=null&&D.element))return!1;try{return r.node.element.parentNode!==null}catch(R){return console.warn("Element validation failed:",R),!1}}),S=d.computed(()=>{var F,W;const D=(F=h==null?void 0:h.value)==null?void 0:F.some(Z=>{var G;return(Z==null?void 0:Z.id)===((G=r==null?void 0:r.node)==null?void 0:G.id)}),R=(W=d.toValue(l))==null?void 0:W.find(Z=>{var G;return(Z==null?void 0:Z.id)===((G=r==null?void 0:r.node)==null?void 0:G.id)});return{...r==null?void 0:r.node,...R,disabled:D}}),_=D=>{var F;let R="";if(d.toValue(D==null?void 0:D.activated)&&(R="normal"),D!=null&&D.disabled&&(R="disabled"),(F=r==null?void 0:r.node)!=null&&F.element)switch(R){case"normal":r.node.element.style.setProperty("--node-color",(D==null?void 0:D.color)||"#409eff"),r.node.element.style.setProperty("--node-bg-color",eH((D==null?void 0:D.color)||"#409eff",.1)),r.node.element.setAttribute("data-dataGroupKey",D==null?void 0:D.dataGroupKey),r.node.element.setAttribute("selectable","false"),r.node.element.classList.add("activated");break;case"disabled":r.node.element.style.setProperty("--node-color",(D==null?void 0:D.color)||"#F56C6C"),r.node.element.style.setProperty("--node-bg-color",eH((D==null?void 0:D.color)||"#F56C6C",.1)),r.node.element.setAttribute("data-dataGroupKey",D==null?void 0:D.dataGroupKey),r.node.element.setAttribute("selectable","false"),r.node.element.classList.add("disabled");break;default:N();break}},N=()=>{var D,R,F,W,Z;(D=r==null?void 0:r.node)!=null&&D.element&&((R=r.node.element)==null||R.removeAttribute("data-dataGroupKey"),(F=r.node.element)==null||F.removeAttribute("selectable"),(W=r.node.element)==null||W.classList.remove("activated"),(Z=r.node.element)==null||Z.classList.remove("disabled"))};return d.watch(()=>S,()=>{const D=d.toValue(S);D!=null&&D.id?_(D):N()},{immediate:!0,deep:!0}),(D,R)=>{var F;return(F=D.node)!=null&&F.element&&x.value&&b.value?(d.openBlock(),d.createBlock(d.Teleport,{key:0,to:D.node.element},[d.createElementVNode("div",{class:d.normalizeClass(["node-item-render",`node-item-${d.unref(g)}`])},[d.renderSlot(D.$slots,"default",{node:D.node},()=>[d.createVNode(e$e,{node:D.node},null,8,["node"])])],2)],8,["to"])):d.createCommentVNode("",!0)}}});function t$e(){const o=d.ref(!1),r=u=>{u.key==="Control"&&(o.value=!0)},l=u=>{u.key==="Control"&&(o.value=!1)};return d.onMounted(()=>{window.addEventListener("keydown",r),window.addEventListener("keyup",l)}),d.onUnmounted(()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",l)}),o}function Zue(){const{selectedNodes:o,setSelectedNodes:r,containerRef:l}=cf(),{editorId:u,nodes:g,disabledNodes:h}=Sy(),b=d.ref(!1),x=d.ref({x:0,y:0}),S=d.ref({x:0,y:0}),_=d.ref({left:0,top:0,width:0,height:0}),N=d.ref(null),D=ne=>{const Me=ne.closest(".node-item-td")||ne.closest(".node-item");if(Me!==null){let ut=[];if(Me.classList.contains("node-selected"))return;const st=Me.getAttribute("id");if(st&&g.value){const Ne=g.value.find(ue=>ue.id===st);Ne&&(ut=[Ne])}ut=H(ut),r(ut)}},R=ne=>{var Ne;if(ne.button===2&&D(ne==null?void 0:ne.target),ne.button!==0||(b.value=!0,!N.value))return;const Me=(Ne=l==null?void 0:l.value)==null?void 0:Ne.getBoundingClientRect();if(!Me)return;const ut=ne.clientX-(Me==null?void 0:Me.left),st=ne.clientY-(Me==null?void 0:Me.top);x.value={x:ut,y:st},S.value={x:ut,y:st},K(ne),de(),N.value.style.display="block",window.addEventListener("mousemove",F),window.addEventListener("wheel",W),window.addEventListener("mouseup",Z)},F=aee(ne=>{var Me;if(b.value){const ut=(Me=l==null?void 0:l.value)==null?void 0:Me.getBoundingClientRect();if(!ut)return;const st=ne.clientX-(ut==null?void 0:ut.left),Ne=ne.clientY-(ut==null?void 0:ut.top);S.value={x:st,y:Ne},de()}},16),W=aee(ne=>{b.value&&setTimeout(()=>{var Ne;const Me=(Ne=l==null?void 0:l.value)==null?void 0:Ne.getBoundingClientRect();if(!Me)return;const ut=ne.clientX-(Me==null?void 0:Me.left),st=ne.clientY-(Me==null?void 0:Me.top);S.value={x:ut,y:st},de()},0)},16),Z=ne=>{ne.button===0&&(b.value=!1,N.value&&(de(),N.value.style.display="none",window.removeEventListener("mousemove",F),window.removeEventListener("wheel",W),window.removeEventListener("mouseup",Z)))},G=t$e(),K=ne=>{var ut,st;let Me=[];if(ne.button===0&&(ne!=null&&ne.target)){const Ne=((ut=ne==null?void 0:ne.target)==null?void 0:ut.closest(".node-item-td"))||((st=ne==null?void 0:ne.target)==null?void 0:st.closest(".node-item"));if(Ne!==null){const ue=Ne.getAttribute("id");if(ue&&g.value){const Mt=g.value.find(be=>be.id===ue);Mt&&(G.value?o.value.some(be=>Q3(be)===Q3(Mt))?Me=o.value.filter(ke=>Q3(ke)!==Q3(Mt)):Me=[...o.value,Mt]:Mt&&(Me=[Mt]))}}Me=H(Me),r(Me)}},q=()=>{var Mt;if(!l.value||!(_.value.width>3||_.value.height>3))return;let ne=[];const Me=(Mt=l==null?void 0:l.value)==null?void 0:Mt.getBoundingClientRect(),ut=_.value.left+(Me==null?void 0:Me.left),st=_.value.top+(Me==null?void 0:Me.top),Ne={left:_.value.left+(Me==null?void 0:Me.left),right:ut+_.value.width,top:_.value.top+(Me==null?void 0:Me.top),bottom:st+_.value.height};if(l.value.querySelectorAll("*").forEach(be=>{const ke=be.getBoundingClientRect();if(!Ne)return;const M={left:ke.left,right:ke.right,top:ke.top,bottom:ke.bottom};if(M.right>Ne.left&&M.left<Ne.right&&M.bottom>Ne.top&&M.top<Ne.bottom){const je=be.getAttribute("id");if(je&&g.value){const we=g.value.find(ot=>ot.id===je);we&&(ne=[...ne,we])}}}),ne=H(ne),G.value){const be=new Set(o.value.map(M=>Q3(M))),ke=ne.filter(M=>!be.has(Q3(M)));r([...o.value,...ke])}else r(ne)},H=ne=>{var ut;let Me=[];if(ne.length>0){const st=(ut=ne.map(ke=>ke==null?void 0:ke.groupKey))==null?void 0:ut.filter(Boolean),Ne=new Set(st),ue=Array.from(Ne),Mt=g.value.filter(ke=>ue.includes(ke.groupKey));Me=[...ne,...Mt],Me=[...Wce(Me.filter(ke=>ke==null?void 0:ke.id),"id")||[],...Me.filter(ke=>!ke.id)]}if(h&&h.value&&h.value.length>0){const st=new Set(h.value.map(Ne=>Ne.id).filter(Boolean));Me=Me.filter(Ne=>Ne.id?!st.has(Ne.id):!0)}return Me},de=aee(()=>{if(!N.value||!l.value)return;const{x:ne,y:Me}=x.value,{x:ut,y:st}=S.value,Ne=Math.min(ne,ut),ue=Math.min(Me,st),Mt=Math.abs(ne-ut),be=Math.abs(Me-st);_.value={left:Ne,top:ue,width:Mt,height:be}},16),Je=ne=>{if(!N.value)return;const{left:Me,top:ut,width:st,height:Ne}=d.toValue(ne);N.value.style.left=`${Me}px`,N.value.style.top=`${ut}px`,N.value.style.width=`${st}px`,N.value.style.height=`${Ne}px`},De=()=>{if(!l.value)return;l.value.addEventListener("mousedown",R);const ne=document.getElementById(`select_area_${u}`);if(ne){N.value=ne;return}const Me=document.createElement("div");Me.id=`select_area_${u}`,Me.style.position="absolute",Me.style.border="1px solid #1677ff",Me.style.backgroundColor="rgba(22, 119, 255, 0.05)",Me.style.pointerEvents="none",Me.style.display="none",l.value.appendChild(Me),N.value=Me};return d.watch(_,(ne,Me)=>{da(ne,Me)||(Je(ne),b.value&&q())},{deep:!0}),d.watch(()=>l.value,ne=>{d.toValue(ne)&&De()},{immediate:!0}),d.onUnmounted(()=>{l.value&&l.value.removeEventListener("mousedown",R)}),{isSelecting:b,selectionBox:N}}function Gue(){const{selectedNodes:o,containerRef:r}=cf(),l=()=>{var g;(g=d.toValue(r))==null||g.querySelectorAll(".node-selected").forEach(h=>{h.classList.remove("node-selected")})},u=g=>{g.forEach(h=>{h.classList.add("node-selected")})};d.watch(()=>o,()=>{l(),setTimeout(()=>{var h,b;const g=(b=(h=d.toValue(o))==null?void 0:h.map(x=>{var S;return(S=r.value)==null?void 0:S.querySelector(`[id="${x.id}"]`)}))==null?void 0:b.filter(Boolean);u(g)},0)},{deep:!0})}const J6=()=>{const{nodes:o,updateNodes:r,inputTypes:l}=Sy();return{nodes:o,addNode:S=>{const N=(Array.isArray(S)?S:[S]).map(R=>({...R,id:R.id||JE()})),D=[...o.value,...N];r(D)},removeNode:async S=>{var W,Z;const _=Array.isArray(S)?S:[S],N=[],D=[];_.forEach(G=>{const K=o.value.find(q=>(q==null?void 0:q.id)===G);Cne(K)?N.push(G):D.push(G)});const R=await((Z=(W=l==null?void 0:l.find(G=>{var K;return((K=G.value)==null?void 0:K.toLowerCase())==="text"}))==null?void 0:W.getDefaultProps)==null?void 0:Z.call(W))||{};let F=o.value.filter(G=>!D.includes(G==null?void 0:G.id));F=F==null?void 0:F.map(G=>N.includes(G==null?void 0:G.id)?{id:G==null?void 0:G.id,nodePath:G==null?void 0:G.nodePath,label:"文本",nodeType:"text",props:{...R}}:G),r(F)},editNodes:S=>{const _=Array.isArray(S)?S:[S],N=JE(),D=_.map(F=>{const W={...F};let Z=F==null?void 0:F.id;return Z||(Z=JE(),W.id=Z),W!=null&&W.groupKey||(W.groupKey=N),W}),R=[...o.value];D.forEach(F=>{const W=R.findIndex(Z=>Z.id===F.id);W!==-1?R[W]=F:R.push(F)}),r(R)},insertNodeAt:(S,_)=>{const N=[...o.value];N.splice(_,0,S),r(N)},moveNode:(S,_)=>{const N=[...o.value],[D]=N.splice(S,1);N.splice(_,0,D),r(N)}}};function n$e(){const{removeNode:o}=J6(),{containerRef:r}=cf(),l=d.ref(null),u=h=>{var Z,G;if(h.target instanceof Element&&(h.target.closest(".node-item")||h.target.closest(".node-item-td")||h.target.closest(".disabeld-edit")))return;const b=h.target;if(b===r.value)return;const S=((Z=r.value)==null?void 0:Z.getRootNode()).getSelection(),_=(G=r.value)==null?void 0:G.querySelectorAll('[contenteditable="true"]');_==null||_.forEach(K=>{K.setAttribute("contenteditable","false")});const N=b.textContent||"",D=b.innerHTML||"";l.value=b,b.setAttribute("contenteditable","true"),b.focus();const R=new MutationObserver(()=>{b.textContent!==N&&(b.innerHTML=D)});R.observe(b,{characterData:!0,childList:!0,subtree:!0});const F=K=>{K.preventDefault()};b.addEventListener("input",F),b.addEventListener("paste",F),b.addEventListener("drop",F),b.addEventListener("keydown",K=>{var q,H,de,Je;if(((q=document.activeElement)==null?void 0:q.shadowRoot)===((H=r.value)==null?void 0:H.getRootNode())&&!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(K.key)){if(K.key==="Backspace"||K.key==="Delete"){const De=S==null?void 0:S.getRangeAt(0);if(b.blur(),(De==null?void 0:De.startOffset)===0){const ne=De.startContainer;if(ne.nodeType===Node.TEXT_NODE){const Me=ne.previousSibling;if(Me&&Me.nodeType===Node.ELEMENT_NODE&&Me.classList.contains("node-item")){const ut=Me.getAttribute("id");ut&&o(ut),(de=ne.parentElement)==null||de.normalize();return}}else if(ne.nodeType===Node.ELEMENT_NODE){const Me=ne.previousSibling;if(Me&&Me.nodeType===Node.ELEMENT_NODE&&Me.classList.contains("node-item")){const ut=Me.getAttribute("id");ut&&o(ut),(Je=ne.parentElement)==null||Je.normalize();return}}}}K.preventDefault()}});const W=()=>{b==null||b.normalize(),R.disconnect(),b.removeEventListener("input",F),b.removeEventListener("paste",F),b.removeEventListener("drop",F),b.removeEventListener("blur",W),b.setAttribute("contenteditable","false")};b.addEventListener("blur",W)},g=()=>{var h;(h=r.value)==null||h.addEventListener("dblclick",u)};return d.watch(r,h=>{h&&g()},{immediate:!0}),d.onUnmounted(()=>{var h;(h=r.value)==null||h.removeEventListener("dblclick",u)}),{}}function o$e(){const{containerRef:o,focusedElement:r,cursorPosition:l,focusedNodeIndex:u,preNodeNumber:g}=cf(),h=_=>{var D,R;const N=_==null?void 0:_.getSelection();try{if((D=r.value)==null||D.normalize(),N){const F=N.getRangeAt(0);u.value=UOe(F.startContainer);const W=F.startOffset,Z=(R=r.value)==null?void 0:R.querySelectorAll(".node-item");let G=0;return g.value=0,Z==null||Z.forEach(K=>{const q=document.createRange();if(q.selectNode(K),q.comparePoint(F.startContainer,W)>=0){g.value+=1;const H=K.getAttribute("data-startOffset");Number(H)>G&&(G=Number(H))}}),G+W}}catch{}return 0},b=()=>{var N;const _=(N=o.value)==null?void 0:N.getRootNode();l.value=h(_)},x=_=>{var F;const N=_.target;if(N===o.value)return;r.value=N;const D=(F=o.value)==null?void 0:F.getRootNode();l.value=h(D),N.addEventListener("click",b),N.addEventListener("keyup",W=>{["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(W.key)&&b()});const R=()=>{N.removeEventListener("click",b),N.removeEventListener("keyup",b),N.removeEventListener("blur",R),setTimeout(()=>{r.value=null,u.value=0,l.value=-1},300)};N.addEventListener("blur",R)},S=()=>{var _;(_=o.value)==null||_.addEventListener("focus",x,!0)};return d.watch(o,_=>{_&&S()},{immediate:!0}),d.onUnmounted(()=>{var _;(_=o.value)==null||_.removeEventListener("focus",x,!0)}),{focusedElement:r,cursorPosition:l,focusedNodeIndex:u,preNodeNumber:g}}function s$e(o){const r=o.value===null?[]:[JSON.parse(JSON.stringify(o.value))],l=d.ref(r),u=d.ref(0),g=d.ref(!1),h=d.computed(()=>l.value[u.value]),b=()=>{u.value>0&&(g.value=!0,u.value--,o.value=JSON.parse(JSON.stringify(l.value[u.value])))},x=()=>{u.value<l.value.length-1&&(g.value=!0,u.value++,o.value=JSON.parse(JSON.stringify(l.value[u.value])))},S=_=>{(_.ctrlKey||_.metaKey)&&_.key==="z"?(_.preventDefault(),b()):(_.ctrlKey||_.metaKey)&&_.key==="y"&&(_.preventDefault(),x())};return d.onMounted(()=>{window.addEventListener("keydown",S)}),d.onUnmounted(()=>{window.removeEventListener("keydown",S)}),d.watch(o,gC(_=>{_&&!g.value&&(l.value.splice(u.value+1),l.value.push(JSON.parse(JSON.stringify(_))),u.value++),g.value&&(g.value=!1)},300),{deep:!0}),{current:h,undo:b,redo:x}}function r$e(){const{modelValue:o,inputTypes:r}=Sy(),{nodes:l,addNode:u}=J6(),g=x=>{if(!x||typeof x!="string")return[];const _=new DOMParser().parseFromString(x,"text/html");return Array.from(_.querySelectorAll("td")).filter(R=>{var F;return!((F=R.textContent)!=null&&F.trim())})},h=(x,S)=>{const _=S.map(D=>D.nodePath);return x==null?void 0:x.map(D=>({nodePath:wne(D)})).filter(D=>{const R=D==null?void 0:D.nodePath;return!_.includes(R)})},b=async x=>{var N,D;const S=await((D=(N=r==null?void 0:r.find(R=>{var F;return((F=R.value)==null?void 0:F.toLowerCase())==="text"}))==null?void 0:N.getDefaultProps)==null?void 0:D.call(N))||{},_=x.map(R=>({nodeType:"Text",label:"文本",props:{...S},...R}));u(_)};d.onMounted(()=>{const x=g(d.toValue(o)),S=h(x,d.toValue(l));b(S)})}function a$e(){const{selectedNodes:o,containerRef:r,isFocused:l}=cf(),{removeNode:u}=J6(),g=d.ref(null),h=S=>{if(l.value&&(S.key==="Delete"||S.key==="Backspace")){let _=[];S.preventDefault(),d.toValue(o).length>0&&(d.toValue(o).forEach(N=>{var D,R,F;if(((D=N==null?void 0:N.element)==null?void 0:D.tagName)==="TD"){const W=(R=N==null?void 0:N.element)==null?void 0:R.getAttribute("id");W&&_.push(W)}else{const W=(F=N==null?void 0:N.element)==null?void 0:F.getAttribute("id");W&&_.push(W)}}),o.value=[],(_==null?void 0:_.length)>0&&u(_))}},b=S=>{var _;(_=d.toValue(r))!=null&&_.contains(S.target)?g.value=S.target:g.value=null},x=()=>{r.value&&(window.addEventListener("keydown",h),r.value.addEventListener("mousedown",b))};d.watch(()=>r.value,S=>{d.toValue(S)&&x()},{immediate:!0}),d.onUnmounted(()=>{r.value&&(window.removeEventListener("keydown",h),r.value.removeEventListener("mousedown",b))})}function YH(){const{nodes:o}=Sy(),{containerRef:r,renderNodes:l,uiReady:u}=cf(),{removeNode:g}=J6(),h=()=>{var x;l.value=[...((x=o.value)==null?void 0:x.map(S=>{var N;const _=(N=r.value)==null?void 0:N.querySelector(`[id="${S.id}"]`);return{...S,element:_}}))||[]].filter(S=>!!(S!=null&&S.element))},b=gC(x=>{d.nextTick(()=>{var S;g((S=x==null?void 0:x.map(_=>_==null?void 0:_.id))==null?void 0:S.filter(Boolean))})},500);d.watch(()=>[l.value,u],()=>{if(d.toValue(u)){const x=t2e(o.value,l.value,"id");b(x)}},{immediate:!0,deep:!0}),d.watch(()=>[o.value,r.value,u],()=>{d.toValue(u)&&d.nextTick(()=>{h()})},{immediate:!0,deep:!0})}const dte=d.ref({});function KH(o){return d.computed(()=>{var r;return(r=dte.value)==null?void 0:r[o]})}function que(){const o=Sy(),r=cf();d.onMounted(()=>{const{editorId:l}=o;l&&(dte.value[l]=d.ref({...o,...r}))}),d.onUnmounted(()=>{const{editorId:l}=o;l&&(dte.value[l]=null)})}const l$e=d.defineComponent({__name:"NodesEditUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"edit"}},setup(o){const{nodes:r}=Sy(),{uiReady:l,renderNodes:u}=cf();return que(),s$e(r),Zue(),Gue(),a$e(),o$e(),n$e(),r$e(),YH(),(g,h)=>d.unref(l)?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(d.unref(u),b=>(d.openBlock(),d.createBlock(qH,{key:b==null?void 0:b.id,node:b},{default:d.withCtx(x=>[d.renderSlot(g.$slots,"nodeItem",{node:x==null?void 0:x.node})]),_:2},1032,["node"]))),128)):d.createCommentVNode("",!0)}}),Fae=d.defineComponent({__name:"NodesPreviewUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:r,renderNodes:l}=cf();return YH(),(u,g)=>d.unref(r)?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(d.unref(l),h=>(d.openBlock(),d.createBlock(qH,{key:h==null?void 0:h.id,node:h},{default:d.withCtx(b=>[d.renderSlot(u.$slots,"nodeItem",{node:b==null?void 0:b.node})]),_:2},1032,["node"]))),128)):d.createCommentVNode("",!0)}}),i$e=d.defineComponent({__name:"NodesEnterUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"enter"}},setup(o){const{uiReady:r,renderNodes:l}=cf();return YH(),(u,g)=>d.unref(r)?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(d.unref(l),h=>(d.openBlock(),d.createBlock(qH,{key:h==null?void 0:h.id,node:h},{default:d.withCtx(b=>[d.renderSlot(u.$slots,"nodeItem",{node:b==null?void 0:b.node})]),_:2},1032,["node"]))),128)):d.createCommentVNode("",!0)}}),c$e=d.defineComponent({__name:"NodesSelectUI",props:{pagesize:{type:String,default:"A4"},renderType:{type:String,default:"select"}},setup(o){const{uiReady:r,renderNodes:l}=cf();return que(),Zue(),Gue(),YH(),(u,g)=>d.unref(r)?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(d.unref(l),h=>(d.openBlock(),d.createBlock(qH,{key:h==null?void 0:h.id,node:h},{default:d.withCtx(b=>[d.renderSlot(u.$slots,"nodeItem",{node:b==null?void 0:b.node})]),_:2},1032,["node"]))),128)):d.createCommentVNode("",!0)}}),fC=d.ref({});function Yue(o){return d.computed(()=>(fC.value[o]||(fC.value[o]=d.ref([])),fC.value[o]))}function u$e(o){const{editorId:r}=o,l=d.ref(!1);d.onMounted(()=>{fC.value[r]||(fC.value[r]=d.ref([]));const u=fC.value[r].findIndex(g=>g.id===o.id);u!==-1&&fC.value[r].splice(u,1),l.value=!0,fC.value[r].push({...o,isMounted:l})}),d.onUnmounted(()=>{l.value=!1})}const d$e=d.defineComponent({__name:"NodesProvider",props:d.mergeModels({modelValue:{type:String,default:""},nodes:{type:Array,default:()=>[]},renderType:{type:String,default:"preview"},inputTypes:{type:Array,default:()=>[]},editorId:{type:String,default:""},disabledNodes:{type:Array,default:()=>[]}},{formData:{},formDataModifiers:{},nodes:{},nodesModifiers:{}}),emits:["update:formData","update:nodes"],setup(o){const r=o,l=d.useModel(o,"formData"),u=d.useModel(o,"nodes"),g=d.computed(()=>r.modelValue),h=Yue(r==null?void 0:r.editorId),b=d.computed(()=>{var D,R,F;const N=[...Uue(((F=(R=(D=d.toValue(h))==null?void 0:D.filter(W=>d.toValue(W==null?void 0:W.activated)))==null?void 0:R.filter(W=>d.toValue(W.isMounted)))==null?void 0:F.filter(W=>d.toValue(W==null?void 0:W.isOccupy)))||[]),...r.disabledNodes||[]];return Wce(N,"id")}),x=d.computed(()=>d.toValue(r.renderType)),S=_=>{da(u.value,_)||(u.value=_)};return d.provide(Wue,{modelValue:g,renderType:x,inputTypes:r.inputTypes,editorId:r==null?void 0:r.editorId,nodes:u,disabledNodes:b,updateNodes:S,formData:l}),(_,N)=>d.renderSlot(_.$slots,"default")}}),f$e=d.defineComponent({__name:"NodesUIProvider",props:{nodes:{type:Array,default:()=>[]},selectedNodes:{type:Array,default:()=>[]},nodesGroups:{type:Array,default:()=>[]},editorId:{type:String,default:""},htmlRenderRef:{type:Object,default:()=>{}}},emits:["onSelectedNodes","update:selectedNodes"],setup(o,{expose:r,emit:l}){const u=o,g=l,h=d.ref(null),b=d.ref(null),x=d.ref([]),S=d.ref(null),_=d.ref(-1),N=d.ref(0),D=d.ref(0),R=Yue(u==null?void 0:u.editorId),F=d.ref(!1),W=d.ref(!1),Z=d.computed(()=>u.htmlRenderRef),G=d.computed({get:()=>(u.selectedNodes||[]).map(Je=>{var Me;let De=(Me=u==null?void 0:u.nodes)==null?void 0:Me.find(ut=>(ut==null?void 0:ut.id)===(Je==null?void 0:Je.id)),ne=Je!=null&&Je.element?Je==null?void 0:Je.element:VOe(Je==null?void 0:Je.id,h.value);return{...De||{},...Je,element:ne}}),set:Je=>{const De=Je.map(({element:ne,...Me})=>{var st;return{...((st=u==null?void 0:u.nodes)==null?void 0:st.find(Ne=>(Ne==null?void 0:Ne.id)===(Me==null?void 0:Me.id)))||{},...Me}});g("update:selectedNodes",De)}}),K=d.computed(()=>{var ne,Me,ut;const Je=(Me=(ne=d.toValue(R))==null?void 0:ne.filter(st=>d.toValue(st==null?void 0:st.activated)))==null?void 0:Me.filter(st=>d.toValue(st.isMounted)),De=((ut=d.toValue(u==null?void 0:u.nodesGroups)||[])==null?void 0:ut.map(st=>({...st||{},activated:!0})))||[];return Uue([...De,...Je])}),q=d.ref([]),H=Je=>{var Me;const De=Je.map(({...ut})=>{var Mt;let st=(Mt=x.value)==null?void 0:Mt.find(be=>(be==null?void 0:be.id)===(ut==null?void 0:ut.id));const{element:Ne,...ue}={...st||{},...ut};return ue}),ne=(Me=G.value)==null?void 0:Me.map(({element:ut,...st})=>st);da(De,ne)||(G.value=De,g("onSelectedNodes",De))},de=d.computed(()=>d.toValue(u==null?void 0:u.nodesGroups));return r({setSelectedNodes:H}),d.provide(Vue,{containerRef:h,htmlRenderRef:Z,contextMenuRef:b,focusedElement:S,currentRenderNodes:q,cursorPosition:_,focusedNodeIndex:N,preNodeNumber:D,currentNodes:K,selectedNodes:G,setSelectedNodes:H,renderNodes:x,uiReady:F,isFocused:W,nodesGroups:de}),(Je,De)=>d.renderSlot(Je.$slots,"default")}}),m$e=["onClick"],g$e={key:0,class:"icon"},p$e={key:1,class:"arrow"},h$e=["onClick"],v$e={key:0,class:"icon"},b$e=d.defineComponent({__name:"index",props:d.mergeModels({style:{},direction:{}},{show:{},showModifiers:{}}),emits:d.mergeModels(["select"],["update:show"]),setup(o,{emit:r}){const{contextMenuRef:l,selectedNodes:u,setSelectedNodes:g,focusedElement:h,cursorPosition:b,focusedNodeIndex:x,preNodeNumber:S}=cf(),{inputTypes:_}=Sy(),N=d.useModel(o,"show"),{editNodes:D}=J6(),R=async G=>{var K,q;if(d.toValue(h)&&!u2e(d.toValue(b))){const H=wne(d.toValue(h)),de=d.toValue(b),Je=(d.toValue(S)||0)+1,De=jOe(d.toValue(h));if(H&&de&&de>=0){const ne=await((K=G==null?void 0:G.getDefaultProps)==null?void 0:K.call(G))||{};D({...De,label:G==null?void 0:G.label,nodePath:H,startOffset:de,subNodeSort:Je,textNodeIndex:d.toValue(x)||0,nodeType:G==null?void 0:G.value,props:ne})}}else if(u){const H=d.toValue(u);if(H!=null&&H.length){const de=await((q=G==null?void 0:G.getDefaultProps)==null?void 0:q.call(G))||{},Je=H==null?void 0:H.map(De=>({...De,label:G==null?void 0:G.label,element:De==null?void 0:De.element,nodePath:De==null?void 0:De.nodePath,nodeType:G==null?void 0:G.value,props:de}));D(Je),g(Je)}}N.value=!1},F=d.computed(()=>{const G=[],K=[];return d.toValue(_).forEach(q=>{q.groupName==="system"?K.push({...q,handler:()=>{R(q)}}):G.push({...q,handler:()=>{R(q)}})}),[{label:"限定填写内容",icon:"i-bi:lock",children:G},{label:"插入记录标识",icon:"i-bi:flag",children:K}].filter(q=>{var H;return(H=q==null?void 0:q.children)==null?void 0:H.length})}),W=r,Z=(G,K)=>{G.preventDefault(),K!=null&&K.handler&&K.handler(),K!=null&&K.value&&W("select",K==null?void 0:K.value)};return(G,K)=>d.withDirectives((d.openBlock(),d.createElementBlock("div",{class:"context-menu",style:d.normalizeStyle({...G.style}),ref_key:"contextMenuRef",ref:l},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(F.value,q=>(d.openBlock(),d.createElementBlock("div",{key:q==null?void 0:q.label,class:"menu-item"},[d.createElementVNode("div",{class:"menu-item-content",onClick:H=>Z(H,q)},[q!=null&&q.icon?(d.openBlock(),d.createElementBlock("div",g$e,[d.createElementVNode("div",{class:d.normalizeClass(q==null?void 0:q.icon)},null,2)])):d.createCommentVNode("",!0),d.createTextVNode(" "+d.toDisplayString(q.label)+" ",1),q!=null&&q.children?(d.openBlock(),d.createElementBlock("span",p$e,"›")):d.createCommentVNode("",!0)],8,m$e),q!=null&&q.children?(d.openBlock(),d.createElementBlock("div",{key:0,class:d.normalizeClass(["submenu",{"submenu-bottom":G.direction==="bottom"}])},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(q.children,H=>(d.openBlock(),d.createElementBlock("div",{key:H.action,class:"menu-item",onClick:de=>Z(de,H)},[H!=null&&H.icon?(d.openBlock(),d.createElementBlock("div",v$e,[d.createElementVNode("div",{class:d.normalizeClass(H==null?void 0:H.icon)},null,2)])):d.createCommentVNode("",!0),d.createTextVNode(" "+d.toDisplayString(H.label),1)],8,h$e))),128))],2)):d.createCommentVNode("",!0)]))),128))],4)),[[d.vShow,N.value]])}}),y$e=vl(b$e,[["__scopeId","data-v-58d034b8"]]);function w$e(o){const{headerHeight:r}=o,l=d.ref(!1),u=d.ref("top"),{contextMenuRef:g}=cf(),h=d.ref({left:"0px",top:"0px"}),b=S=>{S.preventDefault(),l.value=!0,d.nextTick(()=>{const N=S.currentTarget.getBoundingClientRect(),D=S.clientX-N.left,R=S.clientY-N.top,F=g==null?void 0:g.value,W=F==null?void 0:F.offsetWidth,Z=F==null?void 0:F.offsetHeight,G=N.width-D<W,K=N.height-R<Z,q=Array.from((F==null?void 0:F.querySelectorAll(".submenu"))||[]).reduce((H,de)=>Math.max(H,de.offsetHeight||0),0);N.height-R<q?u.value="bottom":u.value="top",h.value={left:G?`${D-W}px`:`${D}px`,top:K?`${R-Z+d.toValue(r)}px`:`${R+d.toValue(r)}px`}})},x=S=>{const _=document.querySelector(".context-menu");_&&!_.contains(S.target)&&(l.value=!1)};return d.onMounted(()=>{document.addEventListener("mousedown",x)}),d.onUnmounted(()=>{document.removeEventListener("mousedown",x)}),{showContextMenu:l,contextMenuStyle:h,contextMenuRef:g,onContextMenu:b,closeContextMenu:x,direction:u}}function Kue(o){return{all:o=o||new Map,on:function(r,l){var u=o.get(r);u?u.push(l):o.set(r,[l])},off:function(r,l){var u=o.get(r);u&&(l?u.splice(u.indexOf(l)>>>0,1):o.set(r,[]))},emit:function(r,l){var u=o.get(r);u&&u.slice().map(function(g){g(l)}),(u=o.get("*"))&&u.slice().map(function(g){g(r,l)})}}}const fte=Kue(),Xue=(...o)=>{const r=o[0],l=o[1];d.onMounted(()=>{fte.on(r,l)}),d.onBeforeUnmount(()=>{fte.off(r)})},xne=()=>(...r)=>{fte.emit(...r)};let ME=null;function C$e(o){const{onSelected:r}={},{selectedNodes:l,uiReady:u,setSelectedNodes:g}=cf(),h=d.ref("multiple"),b=(S="select")=>{var N,D;let _=[];h.value==="single"?(N=l.value)!=null&&N[0]&&_.push((D=l.value)==null?void 0:D[0]):_=ua(l.value),ME==null||ME({data:_,type:S}),S==="blur"&&(ME=null,h.value="multiple"),g(_)};return d.watch(()=>l,()=>{u.value&&(b(),r==null||r(d.toValue(l)))},{deep:!0}),Xue("selectNodes",S=>{const{data:_,callback:N=null,mode:D="multiple"}=S;h.value=D,setTimeout(()=>{g(d.toValue(_)),ME=N},100)}),{onBlur:()=>{ME&&(b("blur"),ME=null,g([]))}}}const tH={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}},x$e={class:"relative"},S$e=["innerHTML"],E$e={style:{overflow:"hidden"}},_$e=["innerHTML"],k$e=d.defineComponent({__name:"index",props:{headerHtml:{type:String,default:""},footerHtml:{type:String,default:""},pagesize:{type:String,default:"A4"}},emits:["onUiReady"],setup(o,{expose:r,emit:l}){const u=d.ref(),{containerRef:g,uiReady:h,isFocused:b}=cf(),{nodes:x,modelValue:S,renderType:_}=Sy(),N=d.computed(()=>d.toValue(_)==="edit"),D=o,R=l,F=()=>{R("onUiReady",{containerRef:g})},{height:W}=zDe(u),Z=d.computed(()=>{const ue=tH[D.pagesize]||tH.A4,Mt=(window.devicePixelRatio||1)*96;return`${ue.height*Mt/25.4-d.toValue(W)}px`}),{showContextMenu:G,contextMenuStyle:K,onContextMenu:q,direction:H}=w$e({headerHeight:W}),de=d.ref(null),Je=ue=>{let Mt=null;if(Cne(ue))Mt=Hue(ue.nodePath,d.toValue(g)),Mt&&(Mt.classList.add("node-item-td"),Mt.setAttribute("contenteditable","false"),KOe(Mt));else{const be=document.createElement("span");be.setAttribute("contenteditable","false"),be.classList.add("node-item"),Mt=be,HOe(ue,Mt,g.value)}return Mt&&zOe(Mt,ue),Mt},De=()=>{const ue=h2e(x.value,[Mt=>Mt.nodePath,Mt=>Mt.textNodeIndex,Mt=>Mt.startOffset??-1,Mt=>Mt.subNodeSort],["asc","desc","desc","desc"]);ue==null||ue.forEach(Mt=>{Je(Mt)})},ne=()=>{de.value&&(h.value=!1,d.nextTick(()=>{de.value&&(de.value.innerHTML=d.toValue(S),De(),h.value=!0,d.nextTick(()=>{F()}))}))};d.watch(()=>[x,S,de],()=>{ne()},{deep:!0,immediate:!0});const Me=d.ref(),ut=()=>{b.value=!0},{onBlur:st}=C$e(),Ne=()=>{b.value=!1,st()};return r({renderHtml:ne}),(ue,Mt)=>(d.openBlock(),d.createElementBlock("div",x$e,[d.createVNode(yne,{onOnBlur:Ne,onOnFocus:ut,ref_key:"shadowDomRef",ref:Me},{default:d.withCtx(()=>[d.createElementVNode("div",{ref_key:"headerRef",ref:u,style:{overflow:"hidden"}},[d.createElementVNode("div",{innerHTML:D==null?void 0:D.headerHtml,class:"disabeld-edit docHeaderHtml",onClick:ut},null,8,S$e)],512),d.createElementVNode("html",{class:"nodes-editor",ref_key:"containerRef",ref:g,style:d.normalizeStyle([{position:"relative"},{position:"relative",minHeight:Z.value}]),onContextmenu:Mt[0]||(Mt[0]=d.withModifiers((...be)=>d.unref(q)&&d.unref(q)(...be),["prevent"]))},[d.createElementVNode("body",{ref_key:"bodyRef",ref:de},null,512),d.createElementVNode("div",E$e,[d.createElementVNode("div",{innerHTML:D==null?void 0:D.footerHtml,class:"disabeld-edit docFooterHtml",onClick:ut},null,8,_$e)])],36)]),_:1},512),N.value?(d.openBlock(),d.createBlock(y$e,{key:0,show:d.unref(G),"onUpdate:show":Mt[1]||(Mt[1]=be=>d.isRef(G)?G.value=be:null),style:d.normalizeStyle(d.unref(K)),direction:d.unref(H)},null,8,["show","style","direction"])):d.createCommentVNode("",!0)]))}}),T$e={class:"pagesize"},A$e=d.defineComponent({__name:"index",props:{pagesize:{type:String,default:"A4"}},setup(o){const r=o,l=d.computed(()=>{const u=tH[r.pagesize]||tH.A4,g=(window.devicePixelRatio||1)*96;return u.width*g/25.4});return(u,g)=>(d.openBlock(),d.createElementBlock("div",T$e,[d.createElementVNode("div",{style:d.normalizeStyle({width:`${l.value}px`}),class:"pagesize-content"},[d.renderSlot(u.$slots,"default",{},void 0,!0)],4)]))}}),N$e=vl(A$e,[["__scopeId","data-v-2877c433"]]),Jue=d.defineComponent({__name:"index",props:d.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:""},disabledNodes:{type:Array,default:()=>[]},headerHtml:{type:String,default:""},footerHtml:{type:String,default:""}},{selectedNodes:{default:[]},selectedNodesModifiers:{}}),emits:d.mergeModels(["update:nodes","update:formData","onSelectedNodes","onUiReady"],["update:selectedNodes"]),setup(o,{expose:r,emit:l}){const u=o,g=l,h=d.useModel(o,"selectedNodes");Vm(u.formData);const b=d.ref(),x=d.ref(null),S=Z=>{g("onUiReady",Z)},_=d.ref(),N=d.computed(()=>d.toValue(u.renderType)),D=d.computed(()=>{switch(d.toValue(N)){case"edit":return l$e;case"select":return c$e;case"preview":return Fae;case"enter":return i$e;default:return Fae}}),R=Z=>{g("update:nodes",Z)},F=Z=>{g("update:formData",Z)},W=Z=>{g("onSelectedNodes",Z)};return r({formRef:{validate:()=>{var Z,G,K;return(K=(G=(Z=b.value)==null?void 0:Z.formRef)==null?void 0:G.validate)==null?void 0:K.call(G)}},setSelectedNodes:Z=>{var G,K;(K=(G=_.value)==null?void 0:G.setSelectedNodes)==null||K.call(G,Z)}}),(Z,G)=>(d.openBlock(),d.createBlock(N$e,{pagesize:o.pagesize},{default:d.withCtx(()=>[d.createVNode(f$e,{ref_key:"UIRef",ref:_,nodes:o.nodes,"onUpdate:nodes":R,selectedNodes:h.value,"onUpdate:selectedNodes":G[0]||(G[0]=K=>h.value=K),onOnSelectedNodes:W,nodesGroups:o.nodesGroups,editorId:u==null?void 0:u.id,htmlRenderRef:x.value},{default:d.withCtx(()=>[d.createVNode(d$e,{renderType:N.value,"model-value":o.modelValue,nodes:o.nodes,"onUpdate:nodes":R,formData:o.formData,"onUpdate:formData":F,inputTypes:o.inputTypes,editorId:u==null?void 0:u.id,disabledNodes:o.disabledNodes},{default:d.withCtx(()=>[d.createVNode(k$e,{ref_key:"htmlRenderRef",ref:x,headerHtml:o.headerHtml,footerHtml:o.footerHtml,pagesize:u==null?void 0:u.pagesize,onOnUiReady:S},null,8,["headerHtml","footerHtml","pagesize"]),(d.openBlock(),d.createBlock(d.resolveDynamicComponent(D.value),{renderType:N.value,pagesize:o.pagesize,ref_key:"contentRef",ref:b},{nodeItem:d.withCtx(K=>[d.renderSlot(Z.$slots,"nodeItem",{node:K==null?void 0:K.node})]),_:3},8,["renderType","pagesize"]))]),_:3},8,["renderType","model-value","nodes","formData","inputTypes","editorId","disabledNodes"])]),_:3},8,["nodes","selectedNodes","nodesGroups","editorId","htmlRenderRef"])]),_:3},8,["pagesize"]))}}),D$e={class:"nodes-text"},O$e={key:0,class:"node-text-input"},$$e={key:1,class:"node-text-td"},B$e={key:0,class:"node-text-table-index"},M$e=d.defineComponent({__name:"index",props:d.mergeModels({editorId:{type:String,default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const r=o,l=d.useModel(o,"modelValue"),u=KH(r==null?void 0:r.editorId),g=d.computed(()=>{var b;return jue(l.value,((b=d.toValue(u))==null?void 0:b.renderNodes)||[])}),h=d.computed(()=>{var b;return((b=d.toValue(g))==null?void 0:b.length)>0?!d.toValue(g).some(S=>{var _,N;return((_=S==null?void 0:S.min)==null?void 0:_.tableIndex)>1||((N=S==null?void 0:S.max)==null?void 0:N.tableIndex)>1}):!0});return(b,x)=>(d.openBlock(),d.createElementBlock("div",D$e,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(g.value,(S,_)=>{var N,D,R;return d.openBlock(),d.createElementBlock("div",{key:_,class:"node-text-item"},[(S==null?void 0:S.showTextType)==="input"?(d.openBlock(),d.createElementBlock("span",O$e," 填写"+d.toDisplayString(S==null?void 0:S.inputIndex),1)):(d.openBlock(),d.createElementBlock("span",$$e,[h.value?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("span",B$e,d.toDisplayString(`表${(N=S==null?void 0:S.min)==null?void 0:N.tableIndex}.`),1)),d.createTextVNode(" "+d.toDisplayString(((D=S==null?void 0:S.min)==null?void 0:D.id)===((R=S==null?void 0:S.max)==null?void 0:R.id)?d.unref(d4)(S==null?void 0:S.min):`${d.unref(d4)(S==null?void 0:S.min)}:${d.unref(d4)(S==null?void 0:S.max)}`),1)]))])}),128))]))}}),Lae=vl(M$e,[["__scopeId","data-v-da41f195"]]);function Sne(o){const{nodes:r,mode:l="multiple"}=o,u=d.ref(!1),g=xne();return{isSelecting:u,selectNodes:()=>{if(u.value)return!1;u.value=!0,g("selectNodes",{data:ua(d.toValue(r)),mode:l,callback:({data:b,type:x})=>{r.value=XOe(ua(d.toValue(b))),x==="blur"&&(u.value=!1)}})}}}const e4=["#ff9b40","#b36c2d","#7548ff","#5233b3","#649ee5","#aac4ed","#f9ce57","#ae74e8"],r9=d.ref(0),RE=new Map,R$e={key:0,class:"node-select-small gap-x-2"},I$e={key:1,class:"text-[#999]"},P$e={key:1,class:"node-select"},F$e={class:"flex py-2 px-2 justify-between items-center noder-select-header"},L$e={class:"flex gap-2"},V$e={key:1},H$e={class:"flex gap-1"},z$e=d.defineComponent({__name:"index",props:d.mergeModels({mode:{type:String,default:"multiple"},color:{type:String},id:{type:String,default:""},editorId:{type:String,default:""},size:{type:String,default:"default"},label:{type:String,default:"点击选择"},isOccupy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const r=o,l=d.ref((RE==null?void 0:RE[r==null?void 0:r.id])||0),u=d.ref((r==null?void 0:r.id)||JE()),g=d.useModel(o,"modelValue");Vm(g);const{selectNodes:h,isSelecting:b}=Sne({nodes:g,mode:r.mode}),x=()=>{g.value=[]},S=d.computed(()=>r.color||(e4==null?void 0:e4[d.toValue(l)%(e4==null?void 0:e4.length)])||"#409eff");d.onMounted(()=>{q9(RE==null?void 0:RE[r==null?void 0:r.id])&&(r!=null&&r.id)&&(RE[r==null?void 0:r.id]=r9.value,l.value=r9.value,r9.value=r9.value+1)});const _=d.computed(()=>r.isOccupy),N=d.computed(()=>!d.toValue(b));return u$e({id:u.value,editorId:r.editorId,nodes:g,activated:N,color:S,isOccupy:_}),(D,R)=>{var F;return r.size==="small"?(d.openBlock(),d.createElementBlock("div",R$e,[d.createElementVNode("div",{style:d.normalizeStyle({"--node-color":S.value}),class:"node-color cursor-pointer"},null,4),d.createElementVNode("div",null,d.toDisplayString(r.label),1),r.disabled?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,style:d.normalizeStyle(d.unref(b)?{color:"#409eff"}:{}),onClick:R[0]||(R[0]=(...W)=>d.unref(h)&&d.unref(h)(...W))},R[6]||(R[6]=[d.createElementVNode("div",{class:"i-bi:hand-index text-[18px] cursor-pointer"},null,-1)]),4)),d.createElementVNode("div",{class:"flex items-center flex-wrap gap-1 cursor-pointer",onClick:R[2]||(R[2]=()=>{r!=null&&r.disabled||d.unref(h)()})},[((F=g.value)==null?void 0:F.length)>0?(d.openBlock(),d.createBlock(Lae,{key:0,modelValue:g.value,"onUpdate:modelValue":R[1]||(R[1]=W=>g.value=W),editorId:o.editorId},null,8,["modelValue","editorId"])):(d.openBlock(),d.createElementBlock("div",I$e,"未设置"))])])):(d.openBlock(),d.createElementBlock("div",P$e,[d.createElementVNode("div",F$e,[d.createElementVNode("div",L$e,[d.createElementVNode("div",{style:d.normalizeStyle({"--node-color":S.value}),class:"node-color cursor-pointer"},null,4),r.disabled?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,style:d.normalizeStyle(d.unref(b)?{color:"#409eff"}:{})},[d.createElementVNode("div",{class:"i-bi:hand-index text-[18px] cursor-pointer",onClick:R[3]||(R[3]=(...W)=>d.unref(h)&&d.unref(h)(...W))})],4)),r.disabled?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",V$e,[d.createElementVNode("div",{class:"i-bi:eraser-fill text-[18px] cursor-pointer",onClick:x})]))]),d.createElementVNode("div",H$e,[R[8]||(R[8]=d.createElementVNode("div",{class:"color-[#999]"},"Ctrl+左键多选",-1)),d.createElementVNode("div",null,[d.createVNode(d.unref(Sn.ElPopover),{placement:"top-start",width:200,trigger:"hover",content:"this is content, this is content, this is content"},{reference:d.withCtx(()=>R[7]||(R[7]=[d.createElementVNode("div",{class:"flex flex-center"},[d.createElementVNode("div",{class:"i-bi:info-circle-fill mr-2"}),d.createTextVNode(" 使用帮助 ")],-1)])),_:1})])])]),d.createElementVNode("div",{class:"min-h-[42px] px-2 py-1",onClick:R[5]||(R[5]=()=>{r!=null&&r.disabled||d.unref(h)()})},[d.createVNode(Lae,{modelValue:g.value,"onUpdate:modelValue":R[4]||(R[4]=W=>g.value=W),editorId:o.editorId},null,8,["modelValue","editorId"])])]))}}}),Que=vl(z$e,[["__scopeId","data-v-177e4feb"]]);function U$e(o){if(!o.startsWith("="))return[];const r=[];let l=1;for(o.startsWith("=")&&r.push({type:"startOperator",value:"="});l<o.length;){const u=o[l];if(/\s/.test(u)){l++;continue}if(/[A-Za-z]/.test(u)&&/\d/.test(o[l+1])){let g="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)g+=o[l++];for(;l<o.length&&/\d/.test(o[l]);)g+=o[l++];if(l<o.length&&o[l]===":"){l++;let h="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)h+=o[l++];for(;l<o.length&&/\d/.test(o[l]);)h+=o[l++];r.push({type:"range",value:`${g}:${h}`});continue}else{r.push({type:"cell",value:g});continue}}if(/[A-Za-z]/.test(u)&&/\d/.test(o[l+1])){let g="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)g+=o[l++];for(;l<o.length&&/\d/.test(o[l]);)g+=o[l++];r.push({type:"cell",value:g});continue}if(/[A-Za-z]/.test(u)){let g="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)g+=o[l++];if(["AVERAGE","AVEDEV","SUM","IF","COUNT","MAX","MIN","SQRT"].includes(g.toUpperCase())&&o[l]==="("){r.push({type:"function",value:g});continue}l-=g.length}if(/\d/.test(u)){let g="";for(;l<o.length&&(/\d/.test(o[l])||o[l]===".");)g+=o[l++];r.push({type:"number",value:g});continue}if(u==='"'){let g="";for(g+=u,l++;l<o.length&&o[l]!=='"';)g+=o[l++];g+=u,l++,r.push({type:"string",value:g});continue}if(/[A-Za-z]/.test(u)&&/\d/.test(o[l+1])){let g="";for(;l<o.length&&/[A-Za-z]/.test(o[l]);)g+=o[l++];for(;l<o.length&&/\d/.test(o[l]);)g+=o[l++];r.push({type:"cell",value:g});continue}if(u===":"){r.push({type:"operator",value:":"}),l++;continue}if(/[+\-*/=><]/.test(u)){r.push({type:"operator",value:u}),l++;continue}if(/[()]/.test(u)){r.push({type:"paren",value:u}),l++;continue}if(u===","){r.push({type:"separator",value:","}),l++;continue}l++}return r}function j$e(o,r){const l=[];let u=0;for(;u<o.length;){let g=!1;for(const h of r){const b=h.value;if(o.startsWith(b,u)){l.push({type:h.type,value:b,...h.cellValue?{cellValue:h.cellValue}:{}}),u+=b.length,g=!0;break}}g||(l.push({type:"plain",value:o[u]}),u++)}return l}function W$e(o){const r=KH(o.editorId),l=(b,x)=>{let S=[];const _=Math.min(b.colIndex,x.colIndex),N=Math.max(b.colIndex,x.colIndex),D=Math.min(b.rowIndex,x.rowIndex),R=Math.max(b.rowIndex,x.rowIndex);for(let F=D;F<=R;F++)for(let W=_;W<=N;W++)S.push({colIndex:W,rowIndex:F});return S},u=b=>{var N;const x=b.includes(":");let S=[];if(x){const[D,R]=b.split(":").map(F=>h(F));S=l(D,R)}else S=[h(b)];return g(S,d.toValue((N=d.toValue(r))==null?void 0:N.nodes))},g=(b,x)=>x==null?void 0:x.filter(S=>{const _=S.nodePath.split(" > ");let N=1,D=1;return _.forEach(R=>{if(R.startsWith("tr")){const F=R.match(/tr(?::nth-of-type\((\d+)\))?/);F&&F[1]&&(N=parseInt(F[1]))}else if(R.startsWith("td")){const F=R.match(/td(?::nth-of-type\((\d+)\))?/);F&&(D=F[1]?parseInt(F[1]):1)}}),b.some(R=>N===R.rowIndex+1&&D===R.colIndex+1)}),h=b=>{if(!b)return{colIndex:-1,rowIndex:-1};const x=b.match(/^([A-Za-z]+)(\d+)$/);if(!x)return{colIndex:-1,rowIndex:-1};const S=x[1].toUpperCase(),_=parseInt(x[2]);let N=0;for(let D=0;D<S.length;D++)N=N*26+(S.charCodeAt(D)-64);return{colIndex:N-1,rowIndex:_}};return{getCellValue:u}}const Vae=["#0288D1","#D32F2F","#F57C00","#388E3C","#303F9F","#7B1FA2","#C2185B","#880E4F","#689F38","#5D4037"];function Z$e(o,r,l){const u=d.ref(null),g=d.ref(null);function h(){return o.value&&o.value.textContent||""}d.onMounted(()=>{o.value&&(u.value=()=>{const x=h();r.value=x},g.value=()=>{const x=h();r.value=x},o.value.addEventListener("input",u.value),o.value.addEventListener("blur",g.value))}),d.onUnmounted(()=>{o.value&&(u.value&&o.value.removeEventListener("input",u.value),g.value&&o.value.removeEventListener("blur",g.value))});const b=x=>{var S,_,N,D;if(x>=0){const R=window.getSelection();if(R){const F=R.getRangeAt(0),W=((S=F.startContainer)==null?void 0:S.nodeName)==="#text"?F.startContainer:(N=(_=F.startContainer)==null?void 0:_.childNodes)==null?void 0:N[0],Z=Math.min(x,((D=W.textContent)==null?void 0:D.length)||0);F.setStart(W,Z)}}};return d.watch(()=>[r,o],()=>{var x;o.value&&(da((x=o.value)==null?void 0:x.textContent,d.toValue(r))||(o.value.textContent=d.toValue(r),b(d.toValue(l))))},{deep:!0,immediate:!0}),{getFormulaContent:h}}function Ene(o){const{element:r,onFocus:l,onBlur:u}=o,g=d.ref(!1),h=()=>{g.value=!0,l==null||l()},b=()=>{g.value=!1,u==null||u()};return d.onMounted(()=>{var x,S;d.toValue(r)&&((x=d.toValue(r))==null||x.addEventListener("focus",h),(S=d.toValue(r))==null||S.addEventListener("blur",b))}),d.onUnmounted(()=>{var x,S;d.toValue(r)&&((x=d.toValue(r))==null||x.removeEventListener("focus",h),(S=d.toValue(r))==null||S.removeEventListener("blur",b))}),g}function G$e(o){const{element:r,showStr:l,editorId:u}=o,g=KH(u),h=Ene({element:r}),b=d.computed(()=>{var x;return(x=l==null?void 0:l.value)==null?void 0:x.filter(S=>["range","cell"].includes(S.type))});return d.watch(()=>h,()=>{var S,_,N,D,R,F;const x=W=>{var Z;W.preventDefault(),(Z=d.toValue(r))==null||Z.focus()};d.toValue(h)?((S=d.toValue(g))==null||S.containerRef.addEventListener("click",x),(_=d.toValue(g))==null||_.containerRef.addEventListener("mousedown",x),(N=document.querySelectorAll(".select-function"))==null||N.forEach(W=>{W.addEventListener("click",x),W.addEventListener("mousedown",x)})):((D=d.toValue(g))==null||D.containerRef.removeEventListener("click",x),(R=d.toValue(g))==null||R.containerRef.removeEventListener("mousedown",x),(F=document.querySelectorAll(".select-function"))==null||F.forEach(W=>{W.removeEventListener("click",x),W.removeEventListener("mousedown",x)}))},{deep:!0}),d.watch(()=>[h,b],()=>{var x,S,_,N,D;if((x=d.toValue(g))!=null&&x.containerRef&&((N=(_=(S=d.toValue(g))==null?void 0:S.containerRef)==null?void 0:_.querySelectorAll(".node-formula-cell"))==null||N.forEach(R=>{R.classList.remove("node-formula-cell")}),d.toValue(h))){let R=[];(D=b.value)!=null&&D.length&&(b.value.forEach(F=>{var W;R=[...R,...((W=F==null?void 0:F.cellValue)==null?void 0:W.map(Z=>({color:F==null?void 0:F.color,backgroundColor:eH((F==null?void 0:F.color)||"#000",.1),element:Z==null?void 0:Z.element})))||[]]}),R.forEach(F=>{var W;F!=null&&F.element&&((W=F==null?void 0:F.element)==null||W.classList.add("node-formula-cell"),F==null||F.element.style.setProperty("--formula-node-color",F==null?void 0:F.color),F==null||F.element.style.setProperty("--formula-node-bg-color",F==null?void 0:F.backgroundColor))}))}},{deep:!0}),h}const q$e=o=>{const{element:r}=o,l=d.ref(-1),u=x=>{const S=x==null?void 0:x.getSelection();try{if(S)return S.getRangeAt(0).startOffset}catch{}return 0},g=()=>{var S;const x=(S=r.value)==null?void 0:S.getRootNode();l.value=u(x)},h=x=>{var D;const S=x.target,_=(D=r.value)==null?void 0:D.getRootNode();l.value=u(_),S.addEventListener("click",g),S.addEventListener("keyup",R=>{["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(R.key)&&g()});const N=()=>{S.removeEventListener("click",g),S.removeEventListener("keyup",g),S.removeEventListener("blur",N),setTimeout(()=>{l.value=-1},300)};S.addEventListener("blur",N)},b=()=>{var x;(x=r.value)==null||x.addEventListener("focus",h,!0)};return d.watch(r,x=>{x&&b()},{immediate:!0}),d.onUnmounted(()=>{var x;(x=r.value)==null||x.removeEventListener("focus",h,!0)}),{startOffset:l}};function Y$e(o,r,l,u){if(r<0||l<0||r>=o.length)throw new Error("Invalid start or length");const g=r+l;return o.slice(0,r)+u+o.slice(g)}const K$e=(o,r)=>{var u;let l=0;for(let g=0;g<r;g++){const h=o[g];l+=(u=h==null?void 0:h.value)==null?void 0:u.length}return l},X$e=o=>{const{startOffset:r,showStr:l,value:u,editorId:g,currentItemIndex:h,currentItem:b,element:x}=o,S=KH(g),_=d.ref(-1),N=d.ref(0),D=Ene({element:x}),R=d.ref(!1),F=xne(),W=Z=>{var G,K;if(d.toValue(R)&&d.toValue(D)&&!da((G=d.toValue(b))==null?void 0:G.cellValue,Z)){const q=YOe(Z,((K=d.toValue(S))==null?void 0:K.nodes)||"");let H=q;q&&(d.toValue(N)===0&&(H+=","),d.toValue(_)>=0&&(u.value=Y$e(d.toValue(u),d.toValue(_),d.toValue(N),H),N.value=q.length))}};d.watch(()=>h,()=>{var Z,G,K,q,H,de;if((Z=S.value)==null||Z.setSelectedNodes([]),["range","cell"].includes((G=d.toValue(b))==null?void 0:G.type))return _.value=K$e(l.value,h.value),N.value=(q=(K=d.toValue(b))==null?void 0:K.value)==null?void 0:q.length,R.value=!0,F("selectNodes",{data:(H=d.toValue(b))==null?void 0:H.cellValue,mode:"multiple",callback:({data:Je})=>{W(Je)}}),!1;if([",","(","="].includes((de=d.toValue(b))==null?void 0:de.value))return _.value=d.toValue(r),R.value=!0,N.value=0,F("selectNodes",{data:[],mode:"multiple",callback:({data:Je})=>{W(Je)}}),!1;R.value=!1,_.value=-1},{immediate:!0,deep:!0})},J$e=o=>{const{startOffset:r,showStr:l}=o,u=d.ref(-1);d.watch(()=>r,()=>{var h;if(d.toValue(r)<=0)u.value=-1;else{let b=0;for(let x=0;x<l.value.length;x++){const S=l.value[x];if(b+=(h=S==null?void 0:S.value)==null?void 0:h.length,b>=d.toValue(r)){u.value=x;break}}}},{deep:!0,immediate:!0});const g=d.computed(()=>{var h;return(h=d.toValue(l))==null?void 0:h[d.toValue(u)]});return{currentItemIndex:u,currentItem:g}};function Q$e(o,r,l,u){if(r<0||l<0||r>=o.length)throw new Error("Invalid start or length");const g=r+l;return o.slice(0,r)+u+o.slice(g)}const e5e=(o,r)=>{var u;let l=0;for(let g=0;g<r;g++){const h=o[g];l+=(u=h==null?void 0:h.value)==null?void 0:u.length}return l},t5e=o=>{const{startOffset:r,showStr:l,value:u,currentItemIndex:g,currentItem:h,element:b}=o,x=d.ref(-1),S=d.ref(0),_=Ene({element:b}),N=d.ref(!1),D=xne(),R=F=>{var W;if(d.toValue(N)&&d.toValue(_)&&!da((W=d.toValue(h))==null?void 0:W.value,F)){const Z=F,G=Z;Z&&d.toValue(x)>=0&&(u.value=Q$e(d.toValue(u),d.toValue(x),d.toValue(S),G),S.value=Z.length)}};d.watch(()=>g,()=>{var F,W,Z,G,K;if(["function"].includes((F=d.toValue(h))==null?void 0:F.type))return x.value=e5e(l.value,g.value),S.value=(Z=(W=d.toValue(h))==null?void 0:W.value)==null?void 0:Z.length,N.value=!0,D("selectFunction",{data:(G=d.toValue(h))==null?void 0:G.value,callback:({data:q})=>{R(q)}}),!1;if([",","(","="].includes((K=d.toValue(h))==null?void 0:K.value))return x.value=d.toValue(r),N.value=!0,S.value=0,D("selectFunction",{data:"",callback:({data:q})=>{R(q)}}),!1;N.value=!1,x.value=-1},{immediate:!0,deep:!0})},n5e={class:"node-formula"},o5e={class:"node-formula-show"},s5e=d.defineComponent({__name:"index",props:d.mergeModels({id:{type:String,default:""},editorId:{type:String,default:""}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const r=o,{getCellValue:l}=W$e({editorId:r==null?void 0:r.editorId}),u=d.useModel(o,"modelValue"),g=d.ref(),{startOffset:h}=q$e({element:g});Z$e(g,u,h);const b=d.computed(()=>{const N=U$e(u.value);return N==null?void 0:N.map(R=>R.type==="cell"||R.type==="range"?{cellValue:l(R.value),...R}:R)}),x=d.computed(()=>{const N=j$e(u.value,b.value);let D=-1;return N.map(F=>(F==null?void 0:F.type)==="cell"||(F==null?void 0:F.type)==="range"?(D++,{...F,color:Vae[D%Vae.length]}):(F==null?void 0:F.type)==="function"?{...F,color:"#0318ff"}:F)});G$e({element:g,showStr:x,editorId:r==null?void 0:r.editorId});const{currentItemIndex:S,currentItem:_}=J$e({element:g,startOffset:h,value:u,showStr:x});return X$e({element:g,startOffset:h,showStr:x,editorId:r==null?void 0:r.editorId,value:u,currentItemIndex:S,currentItem:_}),t5e({element:g,startOffset:h,showStr:x,value:u,currentItemIndex:S,currentItem:_}),(N,D)=>(d.openBlock(),d.createElementBlock("div",n5e,[d.createElementVNode("div",{contenteditable:"true",ref_key:"formulaRef",ref:g,class:"node-formula-input"},null,512),d.createElementVNode("div",o5e,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(x.value,(R,F)=>(d.openBlock(),d.createElementBlock("span",{key:F,class:d.normalizeClass(["node-formula-item",`node-formula-item-type-${R==null?void 0:R.type}`,F===d.unref(S)?"node-formula-item-active":""]),style:d.normalizeStyle({"--text-color":(R==null?void 0:R.color)||"#000","--bg-color":d.unref(eH)((R==null?void 0:R.color)||"#000",.1)})},d.toDisplayString(R.value),7))),128))])]))}}),ede=vl(s5e,[["__scopeId","data-v-f4b96eb4"]]),r5e=[{label:"平均值",value:"AVERAGE"},{label:"均值绝对偏差",value:"AVEDEV"},{label:"求和",value:"SUM"},{label:"条件判断",value:"IF"},{label:"统计数量",value:"COUNT"},{label:"最大值",value:"MAX"},{label:"最小值",value:"MIN"},{label:"正平方根",value:"SQRT"}],a5e={class:"select-function"},l5e=["onClick"],i5e={class:"function-item"},c5e={class:"function-item-desc"},u5e=d.defineComponent({__name:"index",props:d.mergeModels({id:{type:String,default:""},functionList:{type:Array,default:()=>[]}},{modelValue:{type:String,default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const r=o;let l=null;const u=d.computed(()=>{var b;return((b=r.functionList)==null?void 0:b.length)>0?r.functionList:r5e}),g=d.useModel(o,"modelValue"),h=b=>{g.value=b,l==null||l({data:b})};return Xue("selectFunction",({data:b,callback:x})=>{l=x,g.value=b}),(b,x)=>(d.openBlock(),d.createElementBlock("div",a5e,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u.value,(S,_)=>(d.openBlock(),d.createElementBlock("div",{key:_},[d.createElementVNode("div",{onClick:()=>{h(S.value)},class:d.normalizeClass(["function-item-wrapper",{active:g.value===S.value}])},[d.createElementVNode("div",i5e,d.toDisplayString(S.value),1),d.createElementVNode("div",c5e,d.toDisplayString(S.label),1)],10,l5e)]))),128))]))}}),tde=vl(u5e,[["__scopeId","data-v-6e079ff0"]]),d5e=["innerHTML"],nde=d.defineComponent({__name:"index",props:{modelValue:{},modelModifiers:{}},emits:["update:modelValue"],setup(o){const r=d.useModel(o,"modelValue");return(l,u)=>(d.openBlock(),d.createBlock(yne,null,{default:d.withCtx(()=>[d.createElementVNode("div",{innerHTML:r.value},null,8,d5e)]),_:1}))}});function XH(o){return d.getCurrentScope()?(d.onScopeDispose(o),!0):!1}function my(o){return typeof o=="function"?o():d.unref(o)}const f5e=typeof window<"u"&&typeof document<"u",m5e=o=>typeof o<"u",g5e=Object.prototype.toString,p5e=o=>g5e.call(o)==="[object Object]",h5e=()=>{};function v5e(o,r){function l(...u){return new Promise((g,h)=>{Promise.resolve(o(()=>r.apply(this,u),{fn:r,thisArg:this,args:u})).then(g).catch(h)})}return l}const ode=o=>o();function b5e(o=ode){const r=d.ref(!0);function l(){r.value=!1}function u(){r.value=!0}const g=(...h)=>{r.value&&o(...h)};return{isActive:d.readonly(r),pause:l,resume:u,eventFilter:g}}function Hae(o,r=!1,l="Timeout"){return new Promise((u,g)=>{setTimeout(r?()=>g(l):u,o)})}function y5e(o,r,l={}){const{eventFilter:u=ode,...g}=l;return d.watch(o,v5e(u,r),g)}function t4(o,r,l={}){const{eventFilter:u,...g}=l,{eventFilter:h,pause:b,resume:x,isActive:S}=b5e(u);return{stop:y5e(o,r,{...g,eventFilter:h}),pause:b,resume:x,isActive:S}}function w5e(o,r={}){if(!d.isRef(o))return d.toRefs(o);const l=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const u in o.value)l[u]=d.customRef(()=>({get(){return o.value[u]},set(g){var h;if((h=my(r.replaceRef))!=null?h:!0)if(Array.isArray(o.value)){const x=[...o.value];x[u]=g,o.value=x}else{const x={...o.value,[u]:g};Object.setPrototypeOf(x,Object.getPrototypeOf(o.value)),o.value=x}else o.value[u]=g}}));return l}function mte(o,r=!1){function l(D,{flush:R="sync",deep:F=!1,timeout:W,throwOnTimeout:Z}={}){let G=null;const q=[new Promise(H=>{G=d.watch(o,de=>{D(de)!==r&&(G==null||G(),H(de))},{flush:R,deep:F,immediate:!0})})];return W!=null&&q.push(Hae(W,Z).then(()=>my(o)).finally(()=>G==null?void 0:G())),Promise.race(q)}function u(D,R){if(!d.isRef(D))return l(de=>de===D,R);const{flush:F="sync",deep:W=!1,timeout:Z,throwOnTimeout:G}=R??{};let K=null;const H=[new Promise(de=>{K=d.watch([o,D],([Je,De])=>{r!==(Je===De)&&(K==null||K(),de(Je))},{flush:F,deep:W,immediate:!0})})];return Z!=null&&H.push(Hae(Z,G).then(()=>my(o)).finally(()=>(K==null||K(),my(o)))),Promise.race(H)}function g(D){return l(R=>!!R,D)}function h(D){return u(null,D)}function b(D){return u(void 0,D)}function x(D){return l(Number.isNaN,D)}function S(D,R){return l(F=>{const W=Array.from(F);return W.includes(D)||W.includes(my(D))},R)}function _(D){return N(1,D)}function N(D=1,R){let F=-1;return l(()=>(F+=1,F>=D),R)}return Array.isArray(my(o))?{toMatch:l,toContains:S,changed:_,changedTimes:N,get not(){return mte(o,!r)}}:{toMatch:l,toBe:u,toBeTruthy:g,toBeNull:h,toBeNaN:x,toBeUndefined:b,changed:_,changedTimes:N,get not(){return mte(o,!r)}}}function gte(o){return mte(o)}function C5e(o){var r;const l=my(o);return(r=l==null?void 0:l.$el)!=null?r:l}const sde=f5e?window:void 0;function rde(...o){let r,l,u,g;if(typeof o[0]=="string"||Array.isArray(o[0])?([l,u,g]=o,r=sde):[r,l,u,g]=o,!r)return h5e;Array.isArray(l)||(l=[l]),Array.isArray(u)||(u=[u]);const h=[],b=()=>{h.forEach(N=>N()),h.length=0},x=(N,D,R,F)=>(N.addEventListener(D,R,F),()=>N.removeEventListener(D,R,F)),S=d.watch(()=>[C5e(r),my(g)],([N,D])=>{if(b(),!N)return;const R=p5e(D)?{...D}:D;h.push(...l.flatMap(F=>u.map(W=>x(N,F,W,R))))},{immediate:!0,flush:"post"}),_=()=>{S(),b()};return XH(_),_}function x5e(o){return typeof o=="function"?o:typeof o=="string"?r=>r.key===o:Array.isArray(o)?r=>o.includes(r.key):()=>!0}function zae(...o){let r,l,u={};o.length===3?(r=o[0],l=o[1],u=o[2]):o.length===2?typeof o[1]=="object"?(r=!0,l=o[0],u=o[1]):(r=o[0],l=o[1]):(r=!0,l=o[0]);const{target:g=sde,eventName:h="keydown",passive:b=!1,dedupe:x=!1}=u,S=x5e(r);return rde(g,h,N=>{N.repeat&&my(x)||S(N)&&l(N)},b)}function S5e(o){return JSON.parse(JSON.stringify(o))}function mee(o,r,l,u={}){var g,h,b;const{clone:x=!1,passive:S=!1,eventName:_,deep:N=!1,defaultValue:D,shouldEmit:R}=u,F=d.getCurrentInstance(),W=l||(F==null?void 0:F.emit)||((g=F==null?void 0:F.$emit)==null?void 0:g.bind(F))||((b=(h=F==null?void 0:F.proxy)==null?void 0:h.$emit)==null?void 0:b.bind(F==null?void 0:F.proxy));let Z=_;r||(r="modelValue"),Z=Z||`update:${r.toString()}`;const G=H=>x?typeof x=="function"?x(H):S5e(H):H,K=()=>m5e(o[r])?G(o[r]):D,q=H=>{R?R(H)&&W(Z,H):W(Z,H)};if(S){const H=K(),de=d.ref(H);let Je=!1;return d.watch(()=>o[r],De=>{Je||(Je=!0,de.value=G(De),d.nextTick(()=>Je=!1))}),d.watch(de,De=>{!Je&&(De!==o[r]||N)&&q(De)},{deep:N}),de}else return d.computed({get(){return K()},set(H){q(H)}})}var E5e={value:()=>{}};function JH(){for(var o=0,r=arguments.length,l={},u;o<r;++o){if(!(u=arguments[o]+"")||u in l||/[\s.]/.test(u))throw new Error("illegal type: "+u);l[u]=[]}return new N9(l)}function N9(o){this._=o}function _5e(o,r){return o.trim().split(/^|\s+/).map(function(l){var u="",g=l.indexOf(".");if(g>=0&&(u=l.slice(g+1),l=l.slice(0,g)),l&&!r.hasOwnProperty(l))throw new Error("unknown type: "+l);return{type:l,name:u}})}N9.prototype=JH.prototype={constructor:N9,on:function(o,r){var l=this._,u=_5e(o+"",l),g,h=-1,b=u.length;if(arguments.length<2){for(;++h<b;)if((g=(o=u[h]).type)&&(g=k5e(l[g],o.name)))return g;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++h<b;)if(g=(o=u[h]).type)l[g]=Uae(l[g],o.name,r);else if(r==null)for(g in l)l[g]=Uae(l[g],o.name,null);return this},copy:function(){var o={},r=this._;for(var l in r)o[l]=r[l].slice();return new N9(o)},call:function(o,r){if((g=arguments.length-2)>0)for(var l=new Array(g),u=0,g,h;u<g;++u)l[u]=arguments[u+2];if(!this._.hasOwnProperty(o))throw new Error("unknown type: "+o);for(h=this._[o],u=0,g=h.length;u<g;++u)h[u].value.apply(r,l)},apply:function(o,r,l){if(!this._.hasOwnProperty(o))throw new Error("unknown type: "+o);for(var u=this._[o],g=0,h=u.length;g<h;++g)u[g].value.apply(r,l)}};function k5e(o,r){for(var l=0,u=o.length,g;l<u;++l)if((g=o[l]).name===r)return g.value}function Uae(o,r,l){for(var u=0,g=o.length;u<g;++u)if(o[u].name===r){o[u]=E5e,o=o.slice(0,u).concat(o.slice(u+1));break}return l!=null&&o.push({name:r,value:l}),o}var pte="http://www.w3.org/1999/xhtml";const jae={svg:"http://www.w3.org/2000/svg",xhtml:pte,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function QH(o){var r=o+="",l=r.indexOf(":");return l>=0&&(r=o.slice(0,l))!=="xmlns"&&(o=o.slice(l+1)),jae.hasOwnProperty(r)?{space:jae[r],local:o}:o}function T5e(o){return function(){var r=this.ownerDocument,l=this.namespaceURI;return l===pte&&r.documentElement.namespaceURI===pte?r.createElement(o):r.createElementNS(l,o)}}function A5e(o){return function(){return this.ownerDocument.createElementNS(o.space,o.local)}}function ade(o){var r=QH(o);return(r.local?A5e:T5e)(r)}function N5e(){}function _ne(o){return o==null?N5e:function(){return this.querySelector(o)}}function D5e(o){typeof o!="function"&&(o=_ne(o));for(var r=this._groups,l=r.length,u=new Array(l),g=0;g<l;++g)for(var h=r[g],b=h.length,x=u[g]=new Array(b),S,_,N=0;N<b;++N)(S=h[N])&&(_=o.call(S,S.__data__,N,h))&&("__data__"in S&&(_.__data__=S.__data__),x[N]=_);return new Ig(u,this._parents)}function O5e(o){return o==null?[]:Array.isArray(o)?o:Array.from(o)}function $5e(){return[]}function lde(o){return o==null?$5e:function(){return this.querySelectorAll(o)}}function B5e(o){return function(){return O5e(o.apply(this,arguments))}}function M5e(o){typeof o=="function"?o=B5e(o):o=lde(o);for(var r=this._groups,l=r.length,u=[],g=[],h=0;h<l;++h)for(var b=r[h],x=b.length,S,_=0;_<x;++_)(S=b[_])&&(u.push(o.call(S,S.__data__,_,b)),g.push(S));return new Ig(u,g)}function ide(o){return function(){return this.matches(o)}}function cde(o){return function(r){return r.matches(o)}}var R5e=Array.prototype.find;function I5e(o){return function(){return R5e.call(this.children,o)}}function P5e(){return this.firstElementChild}function F5e(o){return this.select(o==null?P5e:I5e(typeof o=="function"?o:cde(o)))}var L5e=Array.prototype.filter;function V5e(){return Array.from(this.children)}function H5e(o){return function(){return L5e.call(this.children,o)}}function z5e(o){return this.selectAll(o==null?V5e:H5e(typeof o=="function"?o:cde(o)))}function U5e(o){typeof o!="function"&&(o=ide(o));for(var r=this._groups,l=r.length,u=new Array(l),g=0;g<l;++g)for(var h=r[g],b=h.length,x=u[g]=[],S,_=0;_<b;++_)(S=h[_])&&o.call(S,S.__data__,_,h)&&x.push(S);return new Ig(u,this._parents)}function ude(o){return new Array(o.length)}function j5e(){return new Ig(this._enter||this._groups.map(ude),this._parents)}function nH(o,r){this.ownerDocument=o.ownerDocument,this.namespaceURI=o.namespaceURI,this._next=null,this._parent=o,this.__data__=r}nH.prototype={constructor:nH,appendChild:function(o){return this._parent.insertBefore(o,this._next)},insertBefore:function(o,r){return this._parent.insertBefore(o,r)},querySelector:function(o){return this._parent.querySelector(o)},querySelectorAll:function(o){return this._parent.querySelectorAll(o)}};function W5e(o){return function(){return o}}function Z5e(o,r,l,u,g,h){for(var b=0,x,S=r.length,_=h.length;b<_;++b)(x=r[b])?(x.__data__=h[b],u[b]=x):l[b]=new nH(o,h[b]);for(;b<S;++b)(x=r[b])&&(g[b]=x)}function G5e(o,r,l,u,g,h,b){var x,S,_=new Map,N=r.length,D=h.length,R=new Array(N),F;for(x=0;x<N;++x)(S=r[x])&&(R[x]=F=b.call(S,S.__data__,x,r)+"",_.has(F)?g[x]=S:_.set(F,S));for(x=0;x<D;++x)F=b.call(o,h[x],x,h)+"",(S=_.get(F))?(u[x]=S,S.__data__=h[x],_.delete(F)):l[x]=new nH(o,h[x]);for(x=0;x<N;++x)(S=r[x])&&_.get(R[x])===S&&(g[x]=S)}function q5e(o){return o.__data__}function Y5e(o,r){if(!arguments.length)return Array.from(this,q5e);var l=r?G5e:Z5e,u=this._parents,g=this._groups;typeof o!="function"&&(o=W5e(o));for(var h=g.length,b=new Array(h),x=new Array(h),S=new Array(h),_=0;_<h;++_){var N=u[_],D=g[_],R=D.length,F=K5e(o.call(N,N&&N.__data__,_,u)),W=F.length,Z=x[_]=new Array(W),G=b[_]=new Array(W),K=S[_]=new Array(R);l(N,D,Z,G,K,F,r);for(var q=0,H=0,de,Je;q<W;++q)if(de=Z[q]){for(q>=H&&(H=q+1);!(Je=G[H])&&++H<W;);de._next=Je||null}}return b=new Ig(b,u),b._enter=x,b._exit=S,b}function K5e(o){return typeof o=="object"&&"length"in o?o:Array.from(o)}function X5e(){return new Ig(this._exit||this._groups.map(ude),this._parents)}function J5e(o,r,l){var u=this.enter(),g=this,h=this.exit();return typeof o=="function"?(u=o(u),u&&(u=u.selection())):u=u.append(o+""),r!=null&&(g=r(g),g&&(g=g.selection())),l==null?h.remove():l(h),u&&g?u.merge(g).order():g}function Q5e(o){for(var r=o.selection?o.selection():o,l=this._groups,u=r._groups,g=l.length,h=u.length,b=Math.min(g,h),x=new Array(g),S=0;S<b;++S)for(var _=l[S],N=u[S],D=_.length,R=x[S]=new Array(D),F,W=0;W<D;++W)(F=_[W]||N[W])&&(R[W]=F);for(;S<g;++S)x[S]=l[S];return new Ig(x,this._parents)}function eBe(){for(var o=this._groups,r=-1,l=o.length;++r<l;)for(var u=o[r],g=u.length-1,h=u[g],b;--g>=0;)(b=u[g])&&(h&&b.compareDocumentPosition(h)^4&&h.parentNode.insertBefore(b,h),h=b);return this}function tBe(o){o||(o=nBe);function r(D,R){return D&&R?o(D.__data__,R.__data__):!D-!R}for(var l=this._groups,u=l.length,g=new Array(u),h=0;h<u;++h){for(var b=l[h],x=b.length,S=g[h]=new Array(x),_,N=0;N<x;++N)(_=b[N])&&(S[N]=_);S.sort(r)}return new Ig(g,this._parents).order()}function nBe(o,r){return o<r?-1:o>r?1:o>=r?0:NaN}function oBe(){var o=arguments[0];return arguments[0]=this,o.apply(null,arguments),this}function sBe(){return Array.from(this)}function rBe(){for(var o=this._groups,r=0,l=o.length;r<l;++r)for(var u=o[r],g=0,h=u.length;g<h;++g){var b=u[g];if(b)return b}return null}function aBe(){let o=0;for(const r of this)++o;return o}function lBe(){return!this.node()}function iBe(o){for(var r=this._groups,l=0,u=r.length;l<u;++l)for(var g=r[l],h=0,b=g.length,x;h<b;++h)(x=g[h])&&o.call(x,x.__data__,h,g);return this}function cBe(o){return function(){this.removeAttribute(o)}}function uBe(o){return function(){this.removeAttributeNS(o.space,o.local)}}function dBe(o,r){return function(){this.setAttribute(o,r)}}function fBe(o,r){return function(){this.setAttributeNS(o.space,o.local,r)}}function mBe(o,r){return function(){var l=r.apply(this,arguments);l==null?this.removeAttribute(o):this.setAttribute(o,l)}}function gBe(o,r){return function(){var l=r.apply(this,arguments);l==null?this.removeAttributeNS(o.space,o.local):this.setAttributeNS(o.space,o.local,l)}}function pBe(o,r){var l=QH(o);if(arguments.length<2){var u=this.node();return l.local?u.getAttributeNS(l.space,l.local):u.getAttribute(l)}return this.each((r==null?l.local?uBe:cBe:typeof r=="function"?l.local?gBe:mBe:l.local?fBe:dBe)(l,r))}function dde(o){return o.ownerDocument&&o.ownerDocument.defaultView||o.document&&o||o.defaultView}function hBe(o){return function(){this.style.removeProperty(o)}}function vBe(o,r,l){return function(){this.style.setProperty(o,r,l)}}function bBe(o,r,l){return function(){var u=r.apply(this,arguments);u==null?this.style.removeProperty(o):this.style.setProperty(o,u,l)}}function yBe(o,r,l){return arguments.length>1?this.each((r==null?hBe:typeof r=="function"?bBe:vBe)(o,r,l??"")):y4(this.node(),o)}function y4(o,r){return o.style.getPropertyValue(r)||dde(o).getComputedStyle(o,null).getPropertyValue(r)}function wBe(o){return function(){delete this[o]}}function CBe(o,r){return function(){this[o]=r}}function xBe(o,r){return function(){var l=r.apply(this,arguments);l==null?delete this[o]:this[o]=l}}function SBe(o,r){return arguments.length>1?this.each((r==null?wBe:typeof r=="function"?xBe:CBe)(o,r)):this.node()[o]}function fde(o){return o.trim().split(/^|\s+/)}function kne(o){return o.classList||new mde(o)}function mde(o){this._node=o,this._names=fde(o.getAttribute("class")||"")}mde.prototype={add:function(o){var r=this._names.indexOf(o);r<0&&(this._names.push(o),this._node.setAttribute("class",this._names.join(" ")))},remove:function(o){var r=this._names.indexOf(o);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(o){return this._names.indexOf(o)>=0}};function gde(o,r){for(var l=kne(o),u=-1,g=r.length;++u<g;)l.add(r[u])}function pde(o,r){for(var l=kne(o),u=-1,g=r.length;++u<g;)l.remove(r[u])}function EBe(o){return function(){gde(this,o)}}function _Be(o){return function(){pde(this,o)}}function kBe(o,r){return function(){(r.apply(this,arguments)?gde:pde)(this,o)}}function TBe(o,r){var l=fde(o+"");if(arguments.length<2){for(var u=kne(this.node()),g=-1,h=l.length;++g<h;)if(!u.contains(l[g]))return!1;return!0}return this.each((typeof r=="function"?kBe:r?EBe:_Be)(l,r))}function ABe(){this.textContent=""}function NBe(o){return function(){this.textContent=o}}function DBe(o){return function(){var r=o.apply(this,arguments);this.textContent=r??""}}function OBe(o){return arguments.length?this.each(o==null?ABe:(typeof o=="function"?DBe:NBe)(o)):this.node().textContent}function $Be(){this.innerHTML=""}function BBe(o){return function(){this.innerHTML=o}}function MBe(o){return function(){var r=o.apply(this,arguments);this.innerHTML=r??""}}function RBe(o){return arguments.length?this.each(o==null?$Be:(typeof o=="function"?MBe:BBe)(o)):this.node().innerHTML}function IBe(){this.nextSibling&&this.parentNode.appendChild(this)}function PBe(){return this.each(IBe)}function FBe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function LBe(){return this.each(FBe)}function VBe(o){var r=typeof o=="function"?o:ade(o);return this.select(function(){return this.appendChild(r.apply(this,arguments))})}function HBe(){return null}function zBe(o,r){var l=typeof o=="function"?o:ade(o),u=r==null?HBe:typeof r=="function"?r:_ne(r);return this.select(function(){return this.insertBefore(l.apply(this,arguments),u.apply(this,arguments)||null)})}function UBe(){var o=this.parentNode;o&&o.removeChild(this)}function jBe(){return this.each(UBe)}function WBe(){var o=this.cloneNode(!1),r=this.parentNode;return r?r.insertBefore(o,this.nextSibling):o}function ZBe(){var o=this.cloneNode(!0),r=this.parentNode;return r?r.insertBefore(o,this.nextSibling):o}function GBe(o){return this.select(o?ZBe:WBe)}function qBe(o){return arguments.length?this.property("__data__",o):this.node().__data__}function YBe(o){return function(r){o.call(this,r,this.__data__)}}function KBe(o){return o.trim().split(/^|\s+/).map(function(r){var l="",u=r.indexOf(".");return u>=0&&(l=r.slice(u+1),r=r.slice(0,u)),{type:r,name:l}})}function XBe(o){return function(){var r=this.__on;if(r){for(var l=0,u=-1,g=r.length,h;l<g;++l)h=r[l],(!o.type||h.type===o.type)&&h.name===o.name?this.removeEventListener(h.type,h.listener,h.options):r[++u]=h;++u?r.length=u:delete this.__on}}}function JBe(o,r,l){return function(){var u=this.__on,g,h=YBe(r);if(u){for(var b=0,x=u.length;b<x;++b)if((g=u[b]).type===o.type&&g.name===o.name){this.removeEventListener(g.type,g.listener,g.options),this.addEventListener(g.type,g.listener=h,g.options=l),g.value=r;return}}this.addEventListener(o.type,h,l),g={type:o.type,name:o.name,value:r,listener:h,options:l},u?u.push(g):this.__on=[g]}}function QBe(o,r,l){var u=KBe(o+""),g,h=u.length,b;if(arguments.length<2){var x=this.node().__on;if(x){for(var S=0,_=x.length,N;S<_;++S)for(g=0,N=x[S];g<h;++g)if((b=u[g]).type===N.type&&b.name===N.name)return N.value}return}for(x=r?JBe:XBe,g=0;g<h;++g)this.each(x(u[g],r,l));return this}function hde(o,r,l){var u=dde(o),g=u.CustomEvent;typeof g=="function"?g=new g(r,l):(g=u.document.createEvent("Event"),l?(g.initEvent(r,l.bubbles,l.cancelable),g.detail=l.detail):g.initEvent(r,!1,!1)),o.dispatchEvent(g)}function e6e(o,r){return function(){return hde(this,o,r)}}function t6e(o,r){return function(){return hde(this,o,r.apply(this,arguments))}}function n6e(o,r){return this.each((typeof r=="function"?t6e:e6e)(o,r))}function*o6e(){for(var o=this._groups,r=0,l=o.length;r<l;++r)for(var u=o[r],g=0,h=u.length,b;g<h;++g)(b=u[g])&&(yield b)}var vde=[null];function Ig(o,r){this._groups=o,this._parents=r}function Q6(){return new Ig([[document.documentElement]],vde)}function s6e(){return this}Ig.prototype=Q6.prototype={constructor:Ig,select:D5e,selectAll:M5e,selectChild:F5e,selectChildren:z5e,filter:U5e,data:Y5e,enter:j5e,exit:X5e,join:J5e,merge:Q5e,selection:s6e,order:eBe,sort:tBe,call:oBe,nodes:sBe,node:rBe,size:aBe,empty:lBe,each:iBe,attr:pBe,style:yBe,property:SBe,classed:TBe,text:OBe,html:RBe,raise:PBe,lower:LBe,append:VBe,insert:zBe,remove:jBe,clone:GBe,datum:qBe,on:QBe,dispatch:n6e,[Symbol.iterator]:o6e};function e1(o){return typeof o=="string"?new Ig([[document.querySelector(o)]],[document.documentElement]):new Ig([[o]],vde)}function r6e(o){let r;for(;r=o.sourceEvent;)o=r;return o}function zv(o,r){if(o=r6e(o),r===void 0&&(r=o.currentTarget),r){var l=r.ownerSVGElement||r;if(l.createSVGPoint){var u=l.createSVGPoint();return u.x=o.clientX,u.y=o.clientY,u=u.matrixTransform(r.getScreenCTM().inverse()),[u.x,u.y]}if(r.getBoundingClientRect){var g=r.getBoundingClientRect();return[o.clientX-g.left-r.clientLeft,o.clientY-g.top-r.clientTop]}}return[o.pageX,o.pageY]}const a6e={passive:!1},O6={capture:!0,passive:!1};function gee(o){o.stopImmediatePropagation()}function f4(o){o.preventDefault(),o.stopImmediatePropagation()}function bde(o){var r=o.document.documentElement,l=e1(o).on("dragstart.drag",f4,O6);"onselectstart"in r?l.on("selectstart.drag",f4,O6):(r.__noselect=r.style.MozUserSelect,r.style.MozUserSelect="none")}function yde(o,r){var l=o.document.documentElement,u=e1(o).on("dragstart.drag",null);r&&(u.on("click.drag",f4,O6),setTimeout(function(){u.on("click.drag",null)},0)),"onselectstart"in l?u.on("selectstart.drag",null):(l.style.MozUserSelect=l.__noselect,delete l.__noselect)}const a9=o=>()=>o;function hte(o,{sourceEvent:r,subject:l,target:u,identifier:g,active:h,x:b,y:x,dx:S,dy:_,dispatch:N}){Object.defineProperties(this,{type:{value:o,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:l,enumerable:!0,configurable:!0},target:{value:u,enumerable:!0,configurable:!0},identifier:{value:g,enumerable:!0,configurable:!0},active:{value:h,enumerable:!0,configurable:!0},x:{value:b,enumerable:!0,configurable:!0},y:{value:x,enumerable:!0,configurable:!0},dx:{value:S,enumerable:!0,configurable:!0},dy:{value:_,enumerable:!0,configurable:!0},_:{value:N}})}hte.prototype.on=function(){var o=this._.on.apply(this._,arguments);return o===this._?this:o};function l6e(o){return!o.ctrlKey&&!o.button}function i6e(){return this.parentNode}function c6e(o,r){return r??{x:o.x,y:o.y}}function u6e(){return navigator.maxTouchPoints||"ontouchstart"in this}function d6e(){var o=l6e,r=i6e,l=c6e,u=u6e,g={},h=JH("start","drag","end"),b=0,x,S,_,N,D=0;function R(de){de.on("mousedown.drag",F).filter(u).on("touchstart.drag",G).on("touchmove.drag",K,a6e).on("touchend.drag touchcancel.drag",q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function F(de,Je){if(!(N||!o.call(this,de,Je))){var De=H(this,r.call(this,de,Je),de,Je,"mouse");De&&(e1(de.view).on("mousemove.drag",W,O6).on("mouseup.drag",Z,O6),bde(de.view),gee(de),_=!1,x=de.clientX,S=de.clientY,De("start",de))}}function W(de){if(f4(de),!_){var Je=de.clientX-x,De=de.clientY-S;_=Je*Je+De*De>D}g.mouse("drag",de)}function Z(de){e1(de.view).on("mousemove.drag mouseup.drag",null),yde(de.view,_),f4(de),g.mouse("end",de)}function G(de,Je){if(o.call(this,de,Je)){var De=de.changedTouches,ne=r.call(this,de,Je),Me=De.length,ut,st;for(ut=0;ut<Me;++ut)(st=H(this,ne,de,Je,De[ut].identifier,De[ut]))&&(gee(de),st("start",de,De[ut]))}}function K(de){var Je=de.changedTouches,De=Je.length,ne,Me;for(ne=0;ne<De;++ne)(Me=g[Je[ne].identifier])&&(f4(de),Me("drag",de,Je[ne]))}function q(de){var Je=de.changedTouches,De=Je.length,ne,Me;for(N&&clearTimeout(N),N=setTimeout(function(){N=null},500),ne=0;ne<De;++ne)(Me=g[Je[ne].identifier])&&(gee(de),Me("end",de,Je[ne]))}function H(de,Je,De,ne,Me,ut){var st=h.copy(),Ne=zv(ut||De,Je),ue,Mt,be;if((be=l.call(de,new hte("beforestart",{sourceEvent:De,target:R,identifier:Me,active:b,x:Ne[0],y:Ne[1],dx:0,dy:0,dispatch:st}),ne))!=null)return ue=be.x-Ne[0]||0,Mt=be.y-Ne[1]||0,function ke(M,je,we){var ot=Ne,et;switch(M){case"start":g[Me]=ke,et=b++;break;case"end":delete g[Me],--b;case"drag":Ne=zv(we||je,Je),et=b;break}st.call(M,de,new hte(M,{sourceEvent:je,subject:be,target:R,identifier:Me,active:et,x:Ne[0]+ue,y:Ne[1]+Mt,dx:Ne[0]-ot[0],dy:Ne[1]-ot[1],dispatch:st}),ne)}}return R.filter=function(de){return arguments.length?(o=typeof de=="function"?de:a9(!!de),R):o},R.container=function(de){return arguments.length?(r=typeof de=="function"?de:a9(de),R):r},R.subject=function(de){return arguments.length?(l=typeof de=="function"?de:a9(de),R):l},R.touchable=function(de){return arguments.length?(u=typeof de=="function"?de:a9(!!de),R):u},R.on=function(){var de=h.on.apply(h,arguments);return de===h?R:de},R.clickDistance=function(de){return arguments.length?(D=(de=+de)*de,R):Math.sqrt(D)},R}function Tne(o,r,l){o.prototype=r.prototype=l,l.constructor=o}function wde(o,r){var l=Object.create(o.prototype);for(var u in r)l[u]=r[u];return l}function eM(){}var $6=.7,oH=1/$6,m4="\\s*([+-]?\\d+)\\s*",B6="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",f6e=/^#([0-9a-f]{3,8})$/,m6e=new RegExp(`^rgb\\(${m4},${m4},${m4}\\)$`),g6e=new RegExp(`^rgb\\(${jv},${jv},${jv}\\)$`),p6e=new RegExp(`^rgba\\(${m4},${m4},${m4},${B6}\\)$`),h6e=new RegExp(`^rgba\\(${jv},${jv},${jv},${B6}\\)$`),v6e=new RegExp(`^hsl\\(${B6},${jv},${jv}\\)$`),b6e=new RegExp(`^hsla\\(${B6},${jv},${jv},${B6}\\)$`),Wae={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};Tne(eM,M6,{copy(o){return Object.assign(new this.constructor,this,o)},displayable(){return this.rgb().displayable()},hex:Zae,formatHex:Zae,formatHex8:y6e,formatHsl:w6e,formatRgb:Gae,toString:Gae});function Zae(){return this.rgb().formatHex()}function y6e(){return this.rgb().formatHex8()}function w6e(){return Cde(this).formatHsl()}function Gae(){return this.rgb().formatRgb()}function M6(o){var r,l;return o=(o+"").trim().toLowerCase(),(r=f6e.exec(o))?(l=r[1].length,r=parseInt(r[1],16),l===6?qae(r):l===3?new Fm(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):l===8?l9(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):l===4?l9(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=m6e.exec(o))?new Fm(r[1],r[2],r[3],1):(r=g6e.exec(o))?new Fm(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=p6e.exec(o))?l9(r[1],r[2],r[3],r[4]):(r=h6e.exec(o))?l9(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=v6e.exec(o))?Xae(r[1],r[2]/100,r[3]/100,1):(r=b6e.exec(o))?Xae(r[1],r[2]/100,r[3]/100,r[4]):Wae.hasOwnProperty(o)?qae(Wae[o]):o==="transparent"?new Fm(NaN,NaN,NaN,0):null}function qae(o){return new Fm(o>>16&255,o>>8&255,o&255,1)}function l9(o,r,l,u){return u<=0&&(o=r=l=NaN),new Fm(o,r,l,u)}function C6e(o){return o instanceof eM||(o=M6(o)),o?(o=o.rgb(),new Fm(o.r,o.g,o.b,o.opacity)):new Fm}function vte(o,r,l,u){return arguments.length===1?C6e(o):new Fm(o,r,l,u??1)}function Fm(o,r,l,u){this.r=+o,this.g=+r,this.b=+l,this.opacity=+u}Tne(Fm,vte,wde(eM,{brighter(o){return o=o==null?oH:Math.pow(oH,o),new Fm(this.r*o,this.g*o,this.b*o,this.opacity)},darker(o){return o=o==null?$6:Math.pow($6,o),new Fm(this.r*o,this.g*o,this.b*o,this.opacity)},rgb(){return this},clamp(){return new Fm(QE(this.r),QE(this.g),QE(this.b),sH(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:Yae,formatHex:Yae,formatHex8:x6e,formatRgb:Kae,toString:Kae}));function Yae(){return`#${ZE(this.r)}${ZE(this.g)}${ZE(this.b)}`}function x6e(){return`#${ZE(this.r)}${ZE(this.g)}${ZE(this.b)}${ZE((isNaN(this.opacity)?1:this.opacity)*255)}`}function Kae(){const o=sH(this.opacity);return`${o===1?"rgb(":"rgba("}${QE(this.r)}, ${QE(this.g)}, ${QE(this.b)}${o===1?")":`, ${o})`}`}function sH(o){return isNaN(o)?1:Math.max(0,Math.min(1,o))}function QE(o){return Math.max(0,Math.min(255,Math.round(o)||0))}function ZE(o){return o=QE(o),(o<16?"0":"")+o.toString(16)}function Xae(o,r,l,u){return u<=0?o=r=l=NaN:l<=0||l>=1?o=r=NaN:r<=0&&(o=NaN),new t1(o,r,l,u)}function Cde(o){if(o instanceof t1)return new t1(o.h,o.s,o.l,o.opacity);if(o instanceof eM||(o=M6(o)),!o)return new t1;if(o instanceof t1)return o;o=o.rgb();var r=o.r/255,l=o.g/255,u=o.b/255,g=Math.min(r,l,u),h=Math.max(r,l,u),b=NaN,x=h-g,S=(h+g)/2;return x?(r===h?b=(l-u)/x+(l<u)*6:l===h?b=(u-r)/x+2:b=(r-l)/x+4,x/=S<.5?h+g:2-h-g,b*=60):x=S>0&&S<1?0:b,new t1(b,x,S,o.opacity)}function S6e(o,r,l,u){return arguments.length===1?Cde(o):new t1(o,r,l,u??1)}function t1(o,r,l,u){this.h=+o,this.s=+r,this.l=+l,this.opacity=+u}Tne(t1,S6e,wde(eM,{brighter(o){return o=o==null?oH:Math.pow(oH,o),new t1(this.h,this.s,this.l*o,this.opacity)},darker(o){return o=o==null?$6:Math.pow($6,o),new t1(this.h,this.s,this.l*o,this.opacity)},rgb(){var o=this.h%360+(this.h<0)*360,r=isNaN(o)||isNaN(this.s)?0:this.s,l=this.l,u=l+(l<.5?l:1-l)*r,g=2*l-u;return new Fm(pee(o>=240?o-240:o+120,g,u),pee(o,g,u),pee(o<120?o+240:o-120,g,u),this.opacity)},clamp(){return new t1(Jae(this.h),i9(this.s),i9(this.l),sH(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=sH(this.opacity);return`${o===1?"hsl(":"hsla("}${Jae(this.h)}, ${i9(this.s)*100}%, ${i9(this.l)*100}%${o===1?")":`, ${o})`}`}}));function Jae(o){return o=(o||0)%360,o<0?o+360:o}function i9(o){return Math.max(0,Math.min(1,o||0))}function pee(o,r,l){return(o<60?r+(l-r)*o/60:o<180?l:o<240?r+(l-r)*(240-o)/60:r)*255}const xde=o=>()=>o;function E6e(o,r){return function(l){return o+l*r}}function _6e(o,r,l){return o=Math.pow(o,l),r=Math.pow(r,l)-o,l=1/l,function(u){return Math.pow(o+u*r,l)}}function k6e(o){return(o=+o)==1?Sde:function(r,l){return l-r?_6e(r,l,o):xde(isNaN(r)?l:r)}}function Sde(o,r){var l=r-o;return l?E6e(o,l):xde(isNaN(o)?r:o)}const Qae=function o(r){var l=k6e(r);function u(g,h){var b=l((g=vte(g)).r,(h=vte(h)).r),x=l(g.g,h.g),S=l(g.b,h.b),_=Sde(g.opacity,h.opacity);return function(N){return g.r=b(N),g.g=x(N),g.b=S(N),g.opacity=_(N),g+""}}return u.gamma=o,u}(1);function cC(o,r){return o=+o,r=+r,function(l){return o*(1-l)+r*l}}var bte=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hee=new RegExp(bte.source,"g");function T6e(o){return function(){return o}}function A6e(o){return function(r){return o(r)+""}}function N6e(o,r){var l=bte.lastIndex=hee.lastIndex=0,u,g,h,b=-1,x=[],S=[];for(o=o+"",r=r+"";(u=bte.exec(o))&&(g=hee.exec(r));)(h=g.index)>l&&(h=r.slice(l,h),x[b]?x[b]+=h:x[++b]=h),(u=u[0])===(g=g[0])?x[b]?x[b]+=g:x[++b]=g:(x[++b]=null,S.push({i:b,x:cC(u,g)})),l=hee.lastIndex;return l<r.length&&(h=r.slice(l),x[b]?x[b]+=h:x[++b]=h),x.length<2?S[0]?A6e(S[0].x):T6e(r):(r=S.length,function(_){for(var N=0,D;N<r;++N)x[(D=S[N]).i]=D.x(_);return x.join("")})}var ele=180/Math.PI,yte={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ede(o,r,l,u,g,h){var b,x,S;return(b=Math.sqrt(o*o+r*r))&&(o/=b,r/=b),(S=o*l+r*u)&&(l-=o*S,u-=r*S),(x=Math.sqrt(l*l+u*u))&&(l/=x,u/=x,S/=x),o*u<r*l&&(o=-o,r=-r,S=-S,b=-b),{translateX:g,translateY:h,rotate:Math.atan2(r,o)*ele,skewX:Math.atan(S)*ele,scaleX:b,scaleY:x}}var c9;function D6e(o){const r=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(o+"");return r.isIdentity?yte:Ede(r.a,r.b,r.c,r.d,r.e,r.f)}function O6e(o){return o==null||(c9||(c9=document.createElementNS("http://www.w3.org/2000/svg","g")),c9.setAttribute("transform",o),!(o=c9.transform.baseVal.consolidate()))?yte:(o=o.matrix,Ede(o.a,o.b,o.c,o.d,o.e,o.f))}function _de(o,r,l,u){function g(_){return _.length?_.pop()+" ":""}function h(_,N,D,R,F,W){if(_!==D||N!==R){var Z=F.push("translate(",null,r,null,l);W.push({i:Z-4,x:cC(_,D)},{i:Z-2,x:cC(N,R)})}else(D||R)&&F.push("translate("+D+r+R+l)}function b(_,N,D,R){_!==N?(_-N>180?N+=360:N-_>180&&(_+=360),R.push({i:D.push(g(D)+"rotate(",null,u)-2,x:cC(_,N)})):N&&D.push(g(D)+"rotate("+N+u)}function x(_,N,D,R){_!==N?R.push({i:D.push(g(D)+"skewX(",null,u)-2,x:cC(_,N)}):N&&D.push(g(D)+"skewX("+N+u)}function S(_,N,D,R,F,W){if(_!==D||N!==R){var Z=F.push(g(F)+"scale(",null,",",null,")");W.push({i:Z-4,x:cC(_,D)},{i:Z-2,x:cC(N,R)})}else(D!==1||R!==1)&&F.push(g(F)+"scale("+D+","+R+")")}return function(_,N){var D=[],R=[];return _=o(_),N=o(N),h(_.translateX,_.translateY,N.translateX,N.translateY,D,R),b(_.rotate,N.rotate,D,R),x(_.skewX,N.skewX,D,R),S(_.scaleX,_.scaleY,N.scaleX,N.scaleY,D,R),_=N=null,function(F){for(var W=-1,Z=R.length,G;++W<Z;)D[(G=R[W]).i]=G.x(F);return D.join("")}}}var $6e=_de(D6e,"px, ","px)","deg)"),B6e=_de(O6e,", ",")",")"),M6e=1e-12;function tle(o){return((o=Math.exp(o))+1/o)/2}function R6e(o){return((o=Math.exp(o))-1/o)/2}function I6e(o){return((o=Math.exp(2*o))-1)/(o+1)}const P6e=function o(r,l,u){function g(h,b){var x=h[0],S=h[1],_=h[2],N=b[0],D=b[1],R=b[2],F=N-x,W=D-S,Z=F*F+W*W,G,K;if(Z<M6e)K=Math.log(R/_)/r,G=function(ne){return[x+ne*F,S+ne*W,_*Math.exp(r*ne*K)]};else{var q=Math.sqrt(Z),H=(R*R-_*_+u*Z)/(2*_*l*q),de=(R*R-_*_-u*Z)/(2*R*l*q),Je=Math.log(Math.sqrt(H*H+1)-H),De=Math.log(Math.sqrt(de*de+1)-de);K=(De-Je)/r,G=function(ne){var Me=ne*K,ut=tle(Je),st=_/(l*q)*(ut*I6e(r*Me+Je)-R6e(Je));return[x+st*F,S+st*W,_*ut/tle(r*Me+Je)]}}return G.duration=K*1e3*r/Math.SQRT2,G}return g.rho=function(h){var b=Math.max(.001,+h),x=b*b,S=x*x;return o(b,x,S)},g}(Math.SQRT2,2,4);var w4=0,c6=0,a6=0,kde=1e3,rH,u6,aH=0,r_=0,ez=0,R6=typeof performance=="object"&&performance.now?performance:Date,Tde=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(o){setTimeout(o,17)};function Ane(){return r_||(Tde(F6e),r_=R6.now()+ez)}function F6e(){r_=0}function lH(){this._call=this._time=this._next=null}lH.prototype=Ade.prototype={constructor:lH,restart:function(o,r,l){if(typeof o!="function")throw new TypeError("callback is not a function");l=(l==null?Ane():+l)+(r==null?0:+r),!this._next&&u6!==this&&(u6?u6._next=this:rH=this,u6=this),this._call=o,this._time=l,wte()},stop:function(){this._call&&(this._call=null,this._time=1/0,wte())}};function Ade(o,r,l){var u=new lH;return u.restart(o,r,l),u}function L6e(){Ane(),++w4;for(var o=rH,r;o;)(r=r_-o._time)>=0&&o._call.call(void 0,r),o=o._next;--w4}function nle(){r_=(aH=R6.now())+ez,w4=c6=0;try{L6e()}finally{w4=0,H6e(),r_=0}}function V6e(){var o=R6.now(),r=o-aH;r>kde&&(ez-=r,aH=o)}function H6e(){for(var o,r=rH,l,u=1/0;r;)r._call?(u>r._time&&(u=r._time),o=r,r=r._next):(l=r._next,r._next=null,r=o?o._next=l:rH=l);u6=o,wte(u)}function wte(o){if(!w4){c6&&(c6=clearTimeout(c6));var r=o-r_;r>24?(o<1/0&&(c6=setTimeout(nle,o-R6.now()-ez)),a6&&(a6=clearInterval(a6))):(a6||(aH=R6.now(),a6=setInterval(V6e,kde)),w4=1,Tde(nle))}}function ole(o,r,l){var u=new lH;return r=r==null?0:+r,u.restart(g=>{u.stop(),o(g+r)},r,l),u}var z6e=JH("start","end","cancel","interrupt"),U6e=[],Nde=0,sle=1,Cte=2,D9=3,rle=4,xte=5,O9=6;function tz(o,r,l,u,g,h){var b=o.__transition;if(!b)o.__transition={};else if(l in b)return;j6e(o,l,{name:r,index:u,group:g,on:z6e,tween:U6e,time:h.time,delay:h.delay,duration:h.duration,ease:h.ease,timer:null,state:Nde})}function Nne(o,r){var l=s1(o,r);if(l.state>Nde)throw new Error("too late; already scheduled");return l}function Kv(o,r){var l=s1(o,r);if(l.state>D9)throw new Error("too late; already running");return l}function s1(o,r){var l=o.__transition;if(!l||!(l=l[r]))throw new Error("transition not found");return l}function j6e(o,r,l){var u=o.__transition,g;u[r]=l,l.timer=Ade(h,0,l.time);function h(_){l.state=sle,l.timer.restart(b,l.delay,l.time),l.delay<=_&&b(_-l.delay)}function b(_){var N,D,R,F;if(l.state!==sle)return S();for(N in u)if(F=u[N],F.name===l.name){if(F.state===D9)return ole(b);F.state===rle?(F.state=O9,F.timer.stop(),F.on.call("interrupt",o,o.__data__,F.index,F.group),delete u[N]):+N<r&&(F.state=O9,F.timer.stop(),F.on.call("cancel",o,o.__data__,F.index,F.group),delete u[N])}if(ole(function(){l.state===D9&&(l.state=rle,l.timer.restart(x,l.delay,l.time),x(_))}),l.state=Cte,l.on.call("start",o,o.__data__,l.index,l.group),l.state===Cte){for(l.state=D9,g=new Array(R=l.tween.length),N=0,D=-1;N<R;++N)(F=l.tween[N].value.call(o,o.__data__,l.index,l.group))&&(g[++D]=F);g.length=D+1}}function x(_){for(var N=_<l.duration?l.ease.call(null,_/l.duration):(l.timer.restart(S),l.state=xte,1),D=-1,R=g.length;++D<R;)g[D].call(o,N);l.state===xte&&(l.on.call("end",o,o.__data__,l.index,l.group),S())}function S(){l.state=O9,l.timer.stop(),delete u[r];for(var _ in u)return;delete o.__transition}}function $9(o,r){var l=o.__transition,u,g,h=!0,b;if(l){r=r==null?null:r+"";for(b in l){if((u=l[b]).name!==r){h=!1;continue}g=u.state>Cte&&u.state<xte,u.state=O9,u.timer.stop(),u.on.call(g?"interrupt":"cancel",o,o.__data__,u.index,u.group),delete l[b]}h&&delete o.__transition}}function W6e(o){return this.each(function(){$9(this,o)})}function Z6e(o,r){var l,u;return function(){var g=Kv(this,o),h=g.tween;if(h!==l){u=l=h;for(var b=0,x=u.length;b<x;++b)if(u[b].name===r){u=u.slice(),u.splice(b,1);break}}g.tween=u}}function G6e(o,r,l){var u,g;if(typeof l!="function")throw new Error;return function(){var h=Kv(this,o),b=h.tween;if(b!==u){g=(u=b).slice();for(var x={name:r,value:l},S=0,_=g.length;S<_;++S)if(g[S].name===r){g[S]=x;break}S===_&&g.push(x)}h.tween=g}}function q6e(o,r){var l=this._id;if(o+="",arguments.length<2){for(var u=s1(this.node(),l).tween,g=0,h=u.length,b;g<h;++g)if((b=u[g]).name===o)return b.value;return null}return this.each((r==null?Z6e:G6e)(l,o,r))}function Dne(o,r,l){var u=o._id;return o.each(function(){var g=Kv(this,u);(g.value||(g.value={}))[r]=l.apply(this,arguments)}),function(g){return s1(g,u).value[r]}}function Dde(o,r){var l;return(typeof r=="number"?cC:r instanceof M6?Qae:(l=M6(r))?(r=l,Qae):N6e)(o,r)}function Y6e(o){return function(){this.removeAttribute(o)}}function K6e(o){return function(){this.removeAttributeNS(o.space,o.local)}}function X6e(o,r,l){var u,g=l+"",h;return function(){var b=this.getAttribute(o);return b===g?null:b===u?h:h=r(u=b,l)}}function J6e(o,r,l){var u,g=l+"",h;return function(){var b=this.getAttributeNS(o.space,o.local);return b===g?null:b===u?h:h=r(u=b,l)}}function Q6e(o,r,l){var u,g,h;return function(){var b,x=l(this),S;return x==null?void this.removeAttribute(o):(b=this.getAttribute(o),S=x+"",b===S?null:b===u&&S===g?h:(g=S,h=r(u=b,x)))}}function eMe(o,r,l){var u,g,h;return function(){var b,x=l(this),S;return x==null?void this.removeAttributeNS(o.space,o.local):(b=this.getAttributeNS(o.space,o.local),S=x+"",b===S?null:b===u&&S===g?h:(g=S,h=r(u=b,x)))}}function tMe(o,r){var l=QH(o),u=l==="transform"?B6e:Dde;return this.attrTween(o,typeof r=="function"?(l.local?eMe:Q6e)(l,u,Dne(this,"attr."+o,r)):r==null?(l.local?K6e:Y6e)(l):(l.local?J6e:X6e)(l,u,r))}function nMe(o,r){return function(l){this.setAttribute(o,r.call(this,l))}}function oMe(o,r){return function(l){this.setAttributeNS(o.space,o.local,r.call(this,l))}}function sMe(o,r){var l,u;function g(){var h=r.apply(this,arguments);return h!==u&&(l=(u=h)&&oMe(o,h)),l}return g._value=r,g}function rMe(o,r){var l,u;function g(){var h=r.apply(this,arguments);return h!==u&&(l=(u=h)&&nMe(o,h)),l}return g._value=r,g}function aMe(o,r){var l="attr."+o;if(arguments.length<2)return(l=this.tween(l))&&l._value;if(r==null)return this.tween(l,null);if(typeof r!="function")throw new Error;var u=QH(o);return this.tween(l,(u.local?sMe:rMe)(u,r))}function lMe(o,r){return function(){Nne(this,o).delay=+r.apply(this,arguments)}}function iMe(o,r){return r=+r,function(){Nne(this,o).delay=r}}function cMe(o){var r=this._id;return arguments.length?this.each((typeof o=="function"?lMe:iMe)(r,o)):s1(this.node(),r).delay}function uMe(o,r){return function(){Kv(this,o).duration=+r.apply(this,arguments)}}function dMe(o,r){return r=+r,function(){Kv(this,o).duration=r}}function fMe(o){var r=this._id;return arguments.length?this.each((typeof o=="function"?uMe:dMe)(r,o)):s1(this.node(),r).duration}function mMe(o,r){if(typeof r!="function")throw new Error;return function(){Kv(this,o).ease=r}}function gMe(o){var r=this._id;return arguments.length?this.each(mMe(r,o)):s1(this.node(),r).ease}function pMe(o,r){return function(){var l=r.apply(this,arguments);if(typeof l!="function")throw new Error;Kv(this,o).ease=l}}function hMe(o){if(typeof o!="function")throw new Error;return this.each(pMe(this._id,o))}function vMe(o){typeof o!="function"&&(o=ide(o));for(var r=this._groups,l=r.length,u=new Array(l),g=0;g<l;++g)for(var h=r[g],b=h.length,x=u[g]=[],S,_=0;_<b;++_)(S=h[_])&&o.call(S,S.__data__,_,h)&&x.push(S);return new yy(u,this._parents,this._name,this._id)}function bMe(o){if(o._id!==this._id)throw new Error;for(var r=this._groups,l=o._groups,u=r.length,g=l.length,h=Math.min(u,g),b=new Array(u),x=0;x<h;++x)for(var S=r[x],_=l[x],N=S.length,D=b[x]=new Array(N),R,F=0;F<N;++F)(R=S[F]||_[F])&&(D[F]=R);for(;x<u;++x)b[x]=r[x];return new yy(b,this._parents,this._name,this._id)}function yMe(o){return(o+"").trim().split(/^|\s+/).every(function(r){var l=r.indexOf(".");return l>=0&&(r=r.slice(0,l)),!r||r==="start"})}function wMe(o,r,l){var u,g,h=yMe(r)?Nne:Kv;return function(){var b=h(this,o),x=b.on;x!==u&&(g=(u=x).copy()).on(r,l),b.on=g}}function CMe(o,r){var l=this._id;return arguments.length<2?s1(this.node(),l).on.on(o):this.each(wMe(l,o,r))}function xMe(o){return function(){var r=this.parentNode;for(var l in this.__transition)if(+l!==o)return;r&&r.removeChild(this)}}function SMe(){return this.on("end.remove",xMe(this._id))}function EMe(o){var r=this._name,l=this._id;typeof o!="function"&&(o=_ne(o));for(var u=this._groups,g=u.length,h=new Array(g),b=0;b<g;++b)for(var x=u[b],S=x.length,_=h[b]=new Array(S),N,D,R=0;R<S;++R)(N=x[R])&&(D=o.call(N,N.__data__,R,x))&&("__data__"in N&&(D.__data__=N.__data__),_[R]=D,tz(_[R],r,l,R,_,s1(N,l)));return new yy(h,this._parents,r,l)}function _Me(o){var r=this._name,l=this._id;typeof o!="function"&&(o=lde(o));for(var u=this._groups,g=u.length,h=[],b=[],x=0;x<g;++x)for(var S=u[x],_=S.length,N,D=0;D<_;++D)if(N=S[D]){for(var R=o.call(N,N.__data__,D,S),F,W=s1(N,l),Z=0,G=R.length;Z<G;++Z)(F=R[Z])&&tz(F,r,l,Z,R,W);h.push(R),b.push(N)}return new yy(h,b,r,l)}var kMe=Q6.prototype.constructor;function TMe(){return new kMe(this._groups,this._parents)}function AMe(o,r){var l,u,g;return function(){var h=y4(this,o),b=(this.style.removeProperty(o),y4(this,o));return h===b?null:h===l&&b===u?g:g=r(l=h,u=b)}}function Ode(o){return function(){this.style.removeProperty(o)}}function NMe(o,r,l){var u,g=l+"",h;return function(){var b=y4(this,o);return b===g?null:b===u?h:h=r(u=b,l)}}function DMe(o,r,l){var u,g,h;return function(){var b=y4(this,o),x=l(this),S=x+"";return x==null&&(S=x=(this.style.removeProperty(o),y4(this,o))),b===S?null:b===u&&S===g?h:(g=S,h=r(u=b,x))}}function OMe(o,r){var l,u,g,h="style."+r,b="end."+h,x;return function(){var S=Kv(this,o),_=S.on,N=S.value[h]==null?x||(x=Ode(r)):void 0;(_!==l||g!==N)&&(u=(l=_).copy()).on(b,g=N),S.on=u}}function $Me(o,r,l){var u=(o+="")=="transform"?$6e:Dde;return r==null?this.styleTween(o,AMe(o,u)).on("end.style."+o,Ode(o)):typeof r=="function"?this.styleTween(o,DMe(o,u,Dne(this,"style."+o,r))).each(OMe(this._id,o)):this.styleTween(o,NMe(o,u,r),l).on("end.style."+o,null)}function BMe(o,r,l){return function(u){this.style.setProperty(o,r.call(this,u),l)}}function MMe(o,r,l){var u,g;function h(){var b=r.apply(this,arguments);return b!==g&&(u=(g=b)&&BMe(o,b,l)),u}return h._value=r,h}function RMe(o,r,l){var u="style."+(o+="");if(arguments.length<2)return(u=this.tween(u))&&u._value;if(r==null)return this.tween(u,null);if(typeof r!="function")throw new Error;return this.tween(u,MMe(o,r,l??""))}function IMe(o){return function(){this.textContent=o}}function PMe(o){return function(){var r=o(this);this.textContent=r??""}}function FMe(o){return this.tween("text",typeof o=="function"?PMe(Dne(this,"text",o)):IMe(o==null?"":o+""))}function LMe(o){return function(r){this.textContent=o.call(this,r)}}function VMe(o){var r,l;function u(){var g=o.apply(this,arguments);return g!==l&&(r=(l=g)&&LMe(g)),r}return u._value=o,u}function HMe(o){var r="text";if(arguments.length<1)return(r=this.tween(r))&&r._value;if(o==null)return this.tween(r,null);if(typeof o!="function")throw new Error;return this.tween(r,VMe(o))}function zMe(){for(var o=this._name,r=this._id,l=$de(),u=this._groups,g=u.length,h=0;h<g;++h)for(var b=u[h],x=b.length,S,_=0;_<x;++_)if(S=b[_]){var N=s1(S,r);tz(S,o,l,_,b,{time:N.time+N.delay+N.duration,delay:0,duration:N.duration,ease:N.ease})}return new yy(u,this._parents,o,l)}function UMe(){var o,r,l=this,u=l._id,g=l.size();return new Promise(function(h,b){var x={value:b},S={value:function(){--g===0&&h()}};l.each(function(){var _=Kv(this,u),N=_.on;N!==o&&(r=(o=N).copy(),r._.cancel.push(x),r._.interrupt.push(x),r._.end.push(S)),_.on=r}),g===0&&h()})}var jMe=0;function yy(o,r,l,u){this._groups=o,this._parents=r,this._name=l,this._id=u}function $de(){return++jMe}var dy=Q6.prototype;yy.prototype={constructor:yy,select:EMe,selectAll:_Me,selectChild:dy.selectChild,selectChildren:dy.selectChildren,filter:vMe,merge:bMe,selection:TMe,transition:zMe,call:dy.call,nodes:dy.nodes,node:dy.node,size:dy.size,empty:dy.empty,each:dy.each,on:CMe,attr:tMe,attrTween:aMe,style:$Me,styleTween:RMe,text:FMe,textTween:HMe,remove:SMe,tween:q6e,delay:cMe,duration:fMe,ease:gMe,easeVarying:hMe,end:UMe,[Symbol.iterator]:dy[Symbol.iterator]};function WMe(o){return((o*=2)<=1?o*o*o:(o-=2)*o*o+2)/2}var ZMe={time:null,delay:0,duration:250,ease:WMe};function GMe(o,r){for(var l;!(l=o.__transition)||!(l=l[r]);)if(!(o=o.parentNode))throw new Error(`transition ${r} not found`);return l}function qMe(o){var r,l;o instanceof yy?(r=o._id,o=o._name):(r=$de(),(l=ZMe).time=Ane(),o=o==null?null:o+"");for(var u=this._groups,g=u.length,h=0;h<g;++h)for(var b=u[h],x=b.length,S,_=0;_<x;++_)(S=b[_])&&tz(S,o,r,_,b,l||GMe(S,r));return new yy(u,this._parents,o,r)}Q6.prototype.interrupt=W6e;Q6.prototype.transition=qMe;const u9=o=>()=>o;function YMe(o,{sourceEvent:r,target:l,transform:u,dispatch:g}){Object.defineProperties(this,{type:{value:o,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},transform:{value:u,enumerable:!0,configurable:!0},_:{value:g}})}function py(o,r,l){this.k=o,this.x=r,this.y=l}py.prototype={constructor:py,scale:function(o){return o===1?this:new py(this.k*o,this.x,this.y)},translate:function(o,r){return o===0&r===0?this:new py(this.k,this.x+this.k*o,this.y+this.k*r)},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 C4=new py(1,0,0);py.prototype;function vee(o){o.stopImmediatePropagation()}function l6(o){o.preventDefault(),o.stopImmediatePropagation()}function KMe(o){return(!o.ctrlKey||o.type==="wheel")&&!o.button}function XMe(){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 ale(){return this.__zoom||C4}function JMe(o){return-o.deltaY*(o.deltaMode===1?.05:o.deltaMode?1:.002)*(o.ctrlKey?10:1)}function QMe(){return navigator.maxTouchPoints||"ontouchstart"in this}function eRe(o,r,l){var u=o.invertX(r[0][0])-l[0][0],g=o.invertX(r[1][0])-l[1][0],h=o.invertY(r[0][1])-l[0][1],b=o.invertY(r[1][1])-l[1][1];return o.translate(g>u?(u+g)/2:Math.min(0,u)||Math.max(0,g),b>h?(h+b)/2:Math.min(0,h)||Math.max(0,b))}function tRe(){var o=KMe,r=XMe,l=eRe,u=JMe,g=QMe,h=[0,1/0],b=[[-1/0,-1/0],[1/0,1/0]],x=250,S=P6e,_=JH("start","zoom","end"),N,D,R,F=500,W=150,Z=0,G=10;function K(be){be.property("__zoom",ale).on("wheel.zoom",Me,{passive:!1}).on("mousedown.zoom",ut).on("dblclick.zoom",st).filter(g).on("touchstart.zoom",Ne).on("touchmove.zoom",ue).on("touchend.zoom touchcancel.zoom",Mt).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}K.transform=function(be,ke,M,je){var we=be.selection?be.selection():be;we.property("__zoom",ale),be!==we?Je(be,ke,M,je):we.interrupt().each(function(){De(this,arguments).event(je).start().zoom(null,typeof ke=="function"?ke.apply(this,arguments):ke).end()})},K.scaleBy=function(be,ke,M,je){K.scaleTo(be,function(){var we=this.__zoom.k,ot=typeof ke=="function"?ke.apply(this,arguments):ke;return we*ot},M,je)},K.scaleTo=function(be,ke,M,je){K.transform(be,function(){var we=r.apply(this,arguments),ot=this.__zoom,et=M==null?de(we):typeof M=="function"?M.apply(this,arguments):M,ge=ot.invert(et),We=typeof ke=="function"?ke.apply(this,arguments):ke;return l(H(q(ot,We),et,ge),we,b)},M,je)},K.translateBy=function(be,ke,M,je){K.transform(be,function(){return l(this.__zoom.translate(typeof ke=="function"?ke.apply(this,arguments):ke,typeof M=="function"?M.apply(this,arguments):M),r.apply(this,arguments),b)},null,je)},K.translateTo=function(be,ke,M,je,we){K.transform(be,function(){var ot=r.apply(this,arguments),et=this.__zoom,ge=je==null?de(ot):typeof je=="function"?je.apply(this,arguments):je;return l(C4.translate(ge[0],ge[1]).scale(et.k).translate(typeof ke=="function"?-ke.apply(this,arguments):-ke,typeof M=="function"?-M.apply(this,arguments):-M),ot,b)},je,we)};function q(be,ke){return ke=Math.max(h[0],Math.min(h[1],ke)),ke===be.k?be:new py(ke,be.x,be.y)}function H(be,ke,M){var je=ke[0]-M[0]*be.k,we=ke[1]-M[1]*be.k;return je===be.x&&we===be.y?be:new py(be.k,je,we)}function de(be){return[(+be[0][0]+ +be[1][0])/2,(+be[0][1]+ +be[1][1])/2]}function Je(be,ke,M,je){be.on("start.zoom",function(){De(this,arguments).event(je).start()}).on("interrupt.zoom end.zoom",function(){De(this,arguments).event(je).end()}).tween("zoom",function(){var we=this,ot=arguments,et=De(we,ot).event(je),ge=r.apply(we,ot),We=M==null?de(ge):typeof M=="function"?M.apply(we,ot):M,kt=Math.max(ge[1][0]-ge[0][0],ge[1][1]-ge[0][1]),Ve=we.__zoom,pt=typeof ke=="function"?ke.apply(we,ot):ke,Ie=S(Ve.invert(We).concat(kt/Ve.k),pt.invert(We).concat(kt/pt.k));return function(vt){if(vt===1)vt=pt;else{var se=Ie(vt),pn=kt/se[2];vt=new py(pn,We[0]-se[0]*pn,We[1]-se[1]*pn)}et.zoom(null,vt)}})}function De(be,ke,M){return!M&&be.__zooming||new ne(be,ke)}function ne(be,ke){this.that=be,this.args=ke,this.active=0,this.sourceEvent=null,this.extent=r.apply(be,ke),this.taps=0}ne.prototype={event:function(be){return be&&(this.sourceEvent=be),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(be,ke){return this.mouse&&be!=="mouse"&&(this.mouse[1]=ke.invert(this.mouse[0])),this.touch0&&be!=="touch"&&(this.touch0[1]=ke.invert(this.touch0[0])),this.touch1&&be!=="touch"&&(this.touch1[1]=ke.invert(this.touch1[0])),this.that.__zoom=ke,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(be){var ke=e1(this.that).datum();_.call(be,this.that,new YMe(be,{sourceEvent:this.sourceEvent,target:K,type:be,transform:this.that.__zoom,dispatch:_}),ke)}};function Me(be,...ke){if(!o.apply(this,arguments))return;var M=De(this,ke).event(be),je=this.__zoom,we=Math.max(h[0],Math.min(h[1],je.k*Math.pow(2,u.apply(this,arguments)))),ot=zv(be);if(M.wheel)(M.mouse[0][0]!==ot[0]||M.mouse[0][1]!==ot[1])&&(M.mouse[1]=je.invert(M.mouse[0]=ot)),clearTimeout(M.wheel);else{if(je.k===we)return;M.mouse=[ot,je.invert(ot)],$9(this),M.start()}l6(be),M.wheel=setTimeout(et,W),M.zoom("mouse",l(H(q(je,we),M.mouse[0],M.mouse[1]),M.extent,b));function et(){M.wheel=null,M.end()}}function ut(be,...ke){if(R||!o.apply(this,arguments))return;var M=be.currentTarget,je=De(this,ke,!0).event(be),we=e1(be.view).on("mousemove.zoom",We,!0).on("mouseup.zoom",kt,!0),ot=zv(be,M),et=be.clientX,ge=be.clientY;bde(be.view),vee(be),je.mouse=[ot,this.__zoom.invert(ot)],$9(this),je.start();function We(Ve){if(l6(Ve),!je.moved){var pt=Ve.clientX-et,Ie=Ve.clientY-ge;je.moved=pt*pt+Ie*Ie>Z}je.event(Ve).zoom("mouse",l(H(je.that.__zoom,je.mouse[0]=zv(Ve,M),je.mouse[1]),je.extent,b))}function kt(Ve){we.on("mousemove.zoom mouseup.zoom",null),yde(Ve.view,je.moved),l6(Ve),je.event(Ve).end()}}function st(be,...ke){if(o.apply(this,arguments)){var M=this.__zoom,je=zv(be.changedTouches?be.changedTouches[0]:be,this),we=M.invert(je),ot=M.k*(be.shiftKey?.5:2),et=l(H(q(M,ot),je,we),r.apply(this,ke),b);l6(be),x>0?e1(this).transition().duration(x).call(Je,et,je,be):e1(this).call(K.transform,et,je,be)}}function Ne(be,...ke){if(o.apply(this,arguments)){var M=be.touches,je=M.length,we=De(this,ke,be.changedTouches.length===je).event(be),ot,et,ge,We;for(vee(be),et=0;et<je;++et)ge=M[et],We=zv(ge,this),We=[We,this.__zoom.invert(We),ge.identifier],we.touch0?!we.touch1&&we.touch0[2]!==We[2]&&(we.touch1=We,we.taps=0):(we.touch0=We,ot=!0,we.taps=1+!!N);N&&(N=clearTimeout(N)),ot&&(we.taps<2&&(D=We[0],N=setTimeout(function(){N=null},F)),$9(this),we.start())}}function ue(be,...ke){if(this.__zooming){var M=De(this,ke).event(be),je=be.changedTouches,we=je.length,ot,et,ge,We;for(l6(be),ot=0;ot<we;++ot)et=je[ot],ge=zv(et,this),M.touch0&&M.touch0[2]===et.identifier?M.touch0[0]=ge:M.touch1&&M.touch1[2]===et.identifier&&(M.touch1[0]=ge);if(et=M.that.__zoom,M.touch1){var kt=M.touch0[0],Ve=M.touch0[1],pt=M.touch1[0],Ie=M.touch1[1],vt=(vt=pt[0]-kt[0])*vt+(vt=pt[1]-kt[1])*vt,se=(se=Ie[0]-Ve[0])*se+(se=Ie[1]-Ve[1])*se;et=q(et,Math.sqrt(vt/se)),ge=[(kt[0]+pt[0])/2,(kt[1]+pt[1])/2],We=[(Ve[0]+Ie[0])/2,(Ve[1]+Ie[1])/2]}else if(M.touch0)ge=M.touch0[0],We=M.touch0[1];else return;M.zoom("touch",l(H(et,ge,We),M.extent,b))}}function Mt(be,...ke){if(this.__zooming){var M=De(this,ke).event(be),je=be.changedTouches,we=je.length,ot,et;for(vee(be),R&&clearTimeout(R),R=setTimeout(function(){R=null},F),ot=0;ot<we;++ot)et=je[ot],M.touch0&&M.touch0[2]===et.identifier?delete M.touch0:M.touch1&&M.touch1[2]===et.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(et=zv(et,this),Math.hypot(D[0]-et[0],D[1]-et[1])<G)){var ge=e1(this).on("dblclick.zoom");ge&&ge.apply(this,arguments)}}}return K.wheelDelta=function(be){return arguments.length?(u=typeof be=="function"?be:u9(+be),K):u},K.filter=function(be){return arguments.length?(o=typeof be=="function"?be:u9(!!be),K):o},K.touchable=function(be){return arguments.length?(g=typeof be=="function"?be:u9(!!be),K):g},K.extent=function(be){return arguments.length?(r=typeof be=="function"?be:u9([[+be[0][0],+be[0][1]],[+be[1][0],+be[1][1]]]),K):r},K.scaleExtent=function(be){return arguments.length?(h[0]=+be[0],h[1]=+be[1],K):[h[0],h[1]]},K.translateExtent=function(be){return arguments.length?(b[0][0]=+be[0][0],b[1][0]=+be[1][0],b[0][1]=+be[0][1],b[1][1]=+be[1][1],K):[[b[0][0],b[0][1]],[b[1][0],b[1][1]]]},K.constrain=function(be){return arguments.length?(l=be,K):l},K.duration=function(be){return arguments.length?(x=+be,K):x},K.interpolate=function(be){return arguments.length?(S=be,K):S},K.on=function(){var be=_.on.apply(_,arguments);return be===_?K:be},K.clickDistance=function(be){return arguments.length?(Z=(be=+be)*be,K):Math.sqrt(Z)},K.tapDistance=function(be){return arguments.length?(G=+be,K):G},K}var rs=(o=>(o.Left="left",o.Top="top",o.Right="right",o.Bottom="bottom",o))(rs||{}),One=(o=>(o.Partial="partial",o.Full="full",o))(One||{}),zE=(o=>(o.Bezier="default",o.SimpleBezier="simple-bezier",o.Straight="straight",o.Step="step",o.SmoothStep="smoothstep",o))(zE||{}),wC=(o=>(o.Strict="strict",o.Loose="loose",o))(wC||{}),iH=(o=>(o.Arrow="arrow",o.ArrowClosed="arrowclosed",o))(iH||{}),b6=(o=>(o.Free="free",o.Vertical="vertical",o.Horizontal="horizontal",o))(b6||{}),Bde=(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))(Bde||{});const nRe=["INPUT","SELECT","TEXTAREA"];function Ste(o){var r,l;const u=((l=(r=o.composedPath)==null?void 0:r.call(o))==null?void 0:l[0])||o.target,g=typeof(u==null?void 0:u.hasAttribute)=="function"?u.hasAttribute("contenteditable"):!1,h=typeof(u==null?void 0:u.closest)=="function"?u.closest(".nokey"):null;return nRe.includes(u==null?void 0:u.nodeName)||g||!!h}function oRe(o){return o.ctrlKey||o.metaKey||o.shiftKey||o.altKey}function lle(o,r,l,u){const g=r.replace("+",`
122
122
  `).replace(`
123
123
 
124
124
  `,`
package/es/index.mjs CHANGED
@@ -4,7 +4,7 @@ var cu = (o, r, i) => hhe(o, typeof r != "symbol" ? r + "" : r, i);
4
4
  import { defineComponent as Uo, reactive as gD, provide as gg, inject as hg, ref as cn, watch as zo, toValue as Ct, computed as _n, openBlock as lt, createElementBlock as sn, createElementVNode as zt, mergeModels as la, useModel as vr, Fragment as lr, renderList as ca, createVNode as fn, unref as Oe, withCtx as Cn, createCommentVNode as Mo, toDisplayString as Ls, createTextVNode as Gs, createBlock as fo, withDirectives as bz, mergeProps as Am, resolveComponent as J4, isRef as hp, onUnmounted as fd, watchEffect as fce, onMounted as Fi, onBeforeUnmount as hD, nextTick as gu, toRefs as sx, getCurrentScope as Ine, onScopeDispose as lR, renderSlot as Ir, normalizeStyle as Pl, onActivated as phe, onDeactivated as vhe, h as Ka, withModifiers as rx, Teleport as Pne, normalizeClass as Bi, vShow as bhe, resolveDynamicComponent as kE, createPropsRestProxy as yhe, toRef as gi, effectScope as mce, getCurrentInstance as ax, useSlots as whe, onBeforeMount as Che, useAttrs as xhe, isMemoSame as She, customRef as _he, markRaw as cR, readonly as Ehe, createStaticVNode as The, createSlots as gce, normalizeProps as khe, guardReactiveProps as Ahe, withKeys as NR } from "vue";
5
5
  import Dhe from "side-channel";
6
6
  import { ElImage as Ky, ElIcon as uh, ElPopover as MR, ElForm as ix, ElFormItem as dg, ElInput as fh, ElButton as Wu, ElScrollbar as yz, ElLoadingDirective as Bne, ElSelect as zE, ElOption as UE, ElDialog as wz, ElTabs as hce, ElTabPane as pce, useFormItem as Ohe, ElTable as $he, ElTableColumn as KH, ElCheckbox as Xy, ElMessageBox as Nhe, ElRadioGroup as vce, ElRadio as QC, ElTree as bce } from "element-plus";
7
- const Mhe = "0.0.93";
7
+ const Mhe = "0.0.94";
8
8
  var Rhe = Object.defineProperty, Ihe = (o, r, i) => r in o ? Rhe(o, r, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[r] = i, zee = (o, r, i) => Ihe(o, typeof r != "symbol" ? r + "" : r, i);
9
9
  function yce(o, r) {
10
10
  return function() {
@@ -71404,15 +71404,15 @@ const JV = {
71404
71404
  zt("body", {
71405
71405
  ref_key: "bodyRef",
71406
71406
  ref: ue
71407
- }, null, 512)
71408
- ], 36),
71409
- zt("div", $Ne, [
71410
- zt("div", {
71411
- innerHTML: D == null ? void 0 : D.footerHtml,
71412
- class: "disabeld-edit docFooterHtml",
71413
- onClick: dt
71414
- }, null, 8, NNe)
71415
- ])
71407
+ }, null, 512),
71408
+ zt("div", $Ne, [
71409
+ zt("div", {
71410
+ innerHTML: D == null ? void 0 : D.footerHtml,
71411
+ class: "disabeld-edit docFooterHtml",
71412
+ onClick: dt
71413
+ }, null, 8, NNe)
71414
+ ])
71415
+ ], 36)
71416
71416
  ]),
71417
71417
  _: 1
71418
71418
  }, 512),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyui/components",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.mjs",
6
6
  "types": "./es/index.d.ts",