@363045841yyt/klinechart 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);let f=require(`vue`);var p=class{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){let n=this.listeners.get(e);n&&n.delete(t)}emit(e,t){let n=this.listeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(t){console.error(`[EventBus] Error in handler for "${e}":`,t)}})}once(e,t){let n=r=>{this.off(e,n),t(r)};this.on(e,n)}clear(){this.listeners.clear()}listenerCount(e){return this.listeners.get(e)?.size??0}};function m(e,t){return function(){return e.apply(t,arguments)}}var{toString:h}=Object.prototype,{getPrototypeOf:g}=Object,{iterator:_,toStringTag:v}=Symbol,y=(e=>t=>{let n=h.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),b=e=>(e=e.toLowerCase(),t=>y(t)===e),x=e=>t=>typeof t===e,{isArray:S}=Array,C=x(`undefined`);function w(e){return e!==null&&!C(e)&&e.constructor!==null&&!C(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var T=b(`ArrayBuffer`);function E(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&T(e.buffer),t}var D=x(`string`),O=x(`function`),k=x(`number`),A=e=>typeof e==`object`&&!!e,j=e=>e===!0||e===!1,M=e=>{if(y(e)!==`object`)return!1;let t=g(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(v in e)&&!(_ in e)},ee=e=>{if(!A(e)||w(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},N=b(`Date`),P=b(`File`),F=e=>!!(e&&e.uri!==void 0),I=e=>e&&e.getParts!==void 0,te=b(`Blob`),L=b(`FileList`),ne=e=>A(e)&&O(e.pipe);function re(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var ie=re(),ae=ie.FormData===void 0?void 0:ie.FormData,oe=e=>{if(!e)return!1;if(ae&&e instanceof ae)return!0;let t=g(e);if(!t||t===Object.prototype||!O(e.append))return!1;let n=y(e);return n===`formdata`||n===`object`&&O(e.toString)&&e.toString()===`[object FormData]`},se=b(`URLSearchParams`),[ce,le,ue,de]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(b),fe=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function pe(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),S(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(w(e))return;let i=n?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length,o;for(r=0;r<a;r++)o=i[r],t.call(null,e[o],o,e)}}function me(e,t){if(w(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}var he=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,ge=e=>!C(e)&&e!==he;function _e(){let{caseless:e,skipUndefined:t}=ge(this)&&this||{},n={},r=(r,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=e&&me(n,i)||i;M(n[a])&&M(r)?n[a]=_e(n[a],r):M(r)?n[a]=_e({},r):S(r)?n[a]=r.slice():(!t||!C(r))&&(n[a]=r)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&pe(arguments[e],r);return n}var ve=(e,t,n,{allOwnKeys:r}={})=>(pe(t,(t,r)=>{n&&O(t)?Object.defineProperty(e,r,{value:m(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),ye=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),be=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{value:t.prototype}),n&&Object.assign(e.prototype,n)},xe=(e,t,n,r)=>{let i,a,o,s={};if(t||={},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&g(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Se=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},Ce=e=>{if(!e)return null;if(S(e))return e;let t=e.length;if(!k(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},we=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&g(Uint8Array)),Te=(e,t)=>{let n=(e&&e[_]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},Ee=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},De=b(`HTMLFormElement`),Oe=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),ke=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ae=b(`RegExp`),je=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};pe(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},Me=e=>{je(e,(t,n)=>{if(O(e)&&[`arguments`,`caller`,`callee`].indexOf(n)!==-1)return!1;let r=e[n];if(O(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},Ne=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return S(e)?r(e):r(String(e).split(t)),n},Pe=()=>{},Fe=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Ie(e){return!!(e&&O(e.append)&&e[v]===`FormData`&&e[_])}var Le=e=>{let t=Array(10),n=(e,r)=>{if(A(e)){if(t.indexOf(e)>=0)return;if(w(e))return e;if(!(`toJSON`in e)){t[r]=e;let i=S(e)?[]:{};return pe(e,(e,t)=>{let a=n(e,r+1);!C(a)&&(i[t]=a)}),t[r]=void 0,i}}return e};return n(e,0)},Re=b(`AsyncFunction`),ze=e=>e&&(A(e)||O(e))&&O(e.then)&&O(e.catch),Be=((e,t)=>e?setImmediate:t?((e,t)=>(he.addEventListener(`message`,({source:n,data:r})=>{n===he&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),he.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,O(he.postMessage)),R={isArray:S,isArrayBuffer:T,isBuffer:w,isFormData:oe,isArrayBufferView:E,isString:D,isNumber:k,isBoolean:j,isObject:A,isPlainObject:M,isEmptyObject:ee,isReadableStream:ce,isRequest:le,isResponse:ue,isHeaders:de,isUndefined:C,isDate:N,isFile:P,isReactNativeBlob:F,isReactNative:I,isBlob:te,isRegExp:Ae,isFunction:O,isStream:ne,isURLSearchParams:se,isTypedArray:we,isFileList:L,forEach:pe,merge:_e,extend:ve,trim:fe,stripBOM:ye,inherits:be,toFlatObject:xe,kindOf:y,kindOfTest:b,endsWith:Se,toArray:Ce,forEachEntry:Te,matchAll:Ee,isHTMLForm:De,hasOwnProperty:ke,hasOwnProp:ke,reduceDescriptors:je,freezeMethods:Me,toObjectSet:Ne,toCamelCase:Oe,noop:Pe,toFiniteNumber:Fe,findKey:me,global:he,isContextDefined:ge,isSpecCompliantForm:Ie,toJSONObject:Le,isAsyncFn:Re,isThenable:ze,setImmediate:Be,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(he):typeof process<`u`&&process.nextTick||Be,isIterable:e=>e!=null&&O(e[_])},z=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),Object.defineProperty(this,`message`,{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name=`AxiosError`,this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:R.toJSONObject(this.config),code:this.code,status:this.status}}};z.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,z.ERR_BAD_OPTION=`ERR_BAD_OPTION`,z.ECONNABORTED=`ECONNABORTED`,z.ETIMEDOUT=`ETIMEDOUT`,z.ERR_NETWORK=`ERR_NETWORK`,z.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,z.ERR_DEPRECATED=`ERR_DEPRECATED`,z.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,z.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,z.ERR_CANCELED=`ERR_CANCELED`,z.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,z.ERR_INVALID_URL=`ERR_INVALID_URL`,z.ERR_FORM_DATA_DEPTH_EXCEEDED=`ERR_FORM_DATA_DEPTH_EXCEEDED`;function Ve(e){return R.isPlainObject(e)||R.isArray(e)}function He(e){return R.endsWith(e,`[]`)?e.slice(0,-2):e}function Ue(e,t,n){return e?e.concat(t).map(function(e,t){return e=He(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function We(e){return R.isArray(e)&&!e.some(Ve)}var Ge=R.toFlatObject(R,{},null,function(e){return/^is[A-Z]/.test(e)});function Ke(e,t,n){if(!R.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=R.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!R.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||d,a=n.dots,o=n.indexes,s=n.Blob||typeof Blob<`u`&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=s&&R.isSpecCompliantForm(t);if(!R.isFunction(i))throw TypeError(`visitor must be a function`);function u(e){if(e===null)return``;if(R.isDate(e))return e.toISOString();if(R.isBoolean(e))return e.toString();if(!l&&R.isBlob(e))throw new z(`Blob is not supported. Use a Buffer instead.`);return R.isArrayBuffer(e)||R.isTypedArray(e)?l&&typeof Blob==`function`?new Blob([e]):Buffer.from(e):e}function d(e,n,i){let s=e;if(R.isReactNative(t)&&R.isReactNativeBlob(e))return t.append(Ue(i,n,a),u(e)),!1;if(e&&!i&&typeof e==`object`){if(R.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(R.isArray(e)&&We(e)||(R.isFileList(e)||R.endsWith(n,`[]`))&&(s=R.toArray(e)))return n=He(n),s.forEach(function(e,r){!(R.isUndefined(e)||e===null)&&t.append(o===!0?Ue([n],r,a):o===null?n:n+`[]`,u(e))}),!1}return Ve(e)?!0:(t.append(Ue(i,n,a),u(e)),!1)}let f=[],p=Object.assign(Ge,{defaultVisitor:d,convertValue:u,isVisitable:Ve});function m(e,n,r=0){if(!R.isUndefined(e)){if(r>c)throw new z(`Object is too deeply nested (`+r+` levels). Max depth: `+c,z.ERR_FORM_DATA_DEPTH_EXCEEDED);if(f.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));f.push(e),R.forEach(e,function(e,a){(!(R.isUndefined(e)||e===null)&&i.call(t,e,R.isString(a)?a.trim():a,n,p))===!0&&m(e,n?n.concat(a):[a],r+1)}),f.pop()}}if(!R.isObject(e))throw TypeError(`data must be an object`);return m(e),t}function qe(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Je(e,t){this._pairs=[],e&&Ke(e,this,t)}var Ye=Je.prototype;Ye.append=function(e,t){this._pairs.push([e,t])},Ye.toString=function(e){let t=e?function(t){return e.call(this,t,qe)}:qe;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function Xe(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function Ze(e,t,n){if(!t)return e;let r=n&&n.encode||Xe,i=R.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):R.isURLSearchParams(t)?t.toString():new Je(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var Qe=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){R.forEach(this.handlers,function(t){t!==null&&e(t)})}},$e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},et={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:Je,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},tt=c({hasBrowserEnv:()=>nt,hasStandardBrowserEnv:()=>it,hasStandardBrowserWebWorkerEnv:()=>at,navigator:()=>rt,origin:()=>ot}),nt=typeof window<`u`&&typeof document<`u`,rt=typeof navigator==`object`&&navigator||void 0,it=nt&&(!rt||[`ReactNative`,`NativeScript`,`NS`].indexOf(rt.product)<0),at=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,ot=nt&&window.location.href||`http://localhost`,B={...tt,...et};function st(e,t){return Ke(e,new B.classes.URLSearchParams,{visitor:function(e,t,n,r){return B.isNode&&R.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function ct(e){return R.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function lt(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r<i;r++)a=n[r],t[a]=e[a];return t}function ut(e){function t(e,n,r,i){let a=e[i++];if(a===`__proto__`)return!0;let o=Number.isFinite(+a),s=i>=e.length;return a=!a&&R.isArray(r)?r.length:a,s?(R.hasOwnProp(r,a)?r[a]=R.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!r[a]||!R.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&R.isArray(r[a])&&(r[a]=lt(r[a])),!o)}if(R.isFormData(e)&&R.isFunction(e.entries)){let n={};return R.forEachEntry(e,(e,r)=>{t(ct(e),r,n,0)}),n}return null}var dt=(e,t)=>e!=null&&R.hasOwnProp(e,t)?e[t]:void 0;function ft(e,t,n){if(R.isString(e))try{return(t||JSON.parse)(e),R.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var pt={transitional:$e,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=R.isObject(e);if(i&&R.isHTMLForm(e)&&(e=new FormData(e)),R.isFormData(e))return r?JSON.stringify(ut(e)):e;if(R.isArrayBuffer(e)||R.isBuffer(e)||R.isStream(e)||R.isFile(e)||R.isBlob(e)||R.isReadableStream(e))return e;if(R.isArrayBufferView(e))return e.buffer;if(R.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){let t=dt(this,`formSerializer`);if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return st(e,t).toString();if((a=R.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=dt(this,`env`),r=n&&n.FormData;return Ke(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),ft(e)):e}],transformResponse:[function(e){let t=dt(this,`transitional`)||pt.transitional,n=t&&t.forcedJSONParsing,r=dt(this,`responseType`),i=r===`json`;if(R.isResponse(e)||R.isReadableStream(e))return e;if(e&&R.isString(e)&&(n&&!r||i)){let n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,dt(this,`parseReviver`))}catch(e){if(n)throw e.name===`SyntaxError`?z.from(e,z.ERR_BAD_RESPONSE,this,null,dt(this,`response`)):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:B.classes.FormData,Blob:B.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};R.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`],e=>{pt.headers[e]={}});var mt=R.toObjectSet([`age`,`authorization`,`content-length`,`content-type`,`etag`,`expires`,`from`,`host`,`if-modified-since`,`if-unmodified-since`,`last-modified`,`location`,`max-forwards`,`proxy-authorization`,`referer`,`retry-after`,`user-agent`]),ht=e=>{let t={},n,r,i;return e&&e.split(`
2
- `).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&mt[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},gt=Symbol(`internals`),_t=/[^\x09\x20-\x7E\x80-\xFF]/g;function vt(e){let t=0,n=e.length;for(;t<n;){let n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==9&&t!==32)break;--n}return t===0&&n===e.length?e:e.slice(t,n)}function yt(e){return e&&String(e).trim().toLowerCase()}function bt(e){return vt(e.replace(_t,``))}function xt(e){return e===!1||e==null?e:R.isArray(e)?e.map(xt):bt(String(e))}function St(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var Ct=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function wt(e,t,n,r,i){if(R.isFunction(r))return r.call(this,t,n);if(i&&(t=n),R.isString(t)){if(R.isString(r))return t.indexOf(r)!==-1;if(R.isRegExp(r))return r.test(t)}}function Tt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function Et(e,t){let n=R.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var V=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=yt(t);if(!i)throw Error(`header name must be a non-empty string`);let a=R.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=xt(e))}let a=(e,t)=>R.forEach(e,(e,n)=>i(e,n,t));if(R.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(R.isString(e)&&(e=e.trim())&&!Ct(e))a(ht(e),t);else if(R.isObject(e)&&R.isIterable(e)){let n={},r,i;for(let t of e){if(!R.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);n[i=t[0]]=(r=n[i])?R.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=yt(e),e){let n=R.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return St(e);if(R.isFunction(t))return t.call(this,e,n);if(R.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=yt(e),e){let n=R.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||wt(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=yt(e),e){let i=R.findKey(n,e);i&&(!t||wt(n,n[i],i,t))&&(delete n[i],r=!0)}}return R.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||wt(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return R.forEach(this,(r,i)=>{let a=R.findKey(n,i);if(a){t[a]=xt(r),delete t[i];return}let o=e?Tt(i):String(i).trim();o!==i&&delete t[i],t[o]=xt(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return R.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&R.isArray(n)?n.join(`, `):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+`: `+t).join(`
3
- `)}getSetCookie(){return this.get(`set-cookie`)||[]}get[Symbol.toStringTag](){return`AxiosHeaders`}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[gt]=this[gt]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=yt(e);t[r]||(Et(n,e),t[r]=!0)}return R.isArray(e)?e.forEach(r):r(e),this}};V.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),R.reduceDescriptors(V.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),R.freezeMethods(V);function Dt(e,t){let n=this||pt,r=t||n,i=V.from(r.headers),a=r.data;return R.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function Ot(e){return!!(e&&e.__CANCEL__)}var kt=class extends z{constructor(e,t,n){super(e??`canceled`,z.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function At(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new z(`Request failed with status code `+n.status,[z.ERR_BAD_REQUEST,z.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function jt(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||``}function Mt(e,t){e||=10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||=c,n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o<t)return;let f=l&&c-l;return f?Math.round(d*1e3/f):void 0}}function Nt(e,t){let n=0,r=1e3/t,i,a,o=(t,r=Date.now())=>{n=r,i=null,a&&=(clearTimeout(a),null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||=setTimeout(()=>{a=null,o(i)},r-s))},()=>i&&o(i)]}var Pt=(e,t,n=3)=>{let r=0,i=Mt(50,250);return Nt(n=>{let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=o==null?a:Math.min(a,o),c=Math.max(0,s-r),l=i(c);r=Math.max(r,s),e({loaded:s,total:o,progress:o?s/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o?(o-s)/l:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},Ft=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},It=e=>(...t)=>R.asap(()=>e(...t)),Lt=B.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,B.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(B.origin),B.navigator&&/(msie|trident)/i.test(B.navigator.userAgent)):()=>!0,Rt=B.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];R.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),R.isString(r)&&s.push(`path=${r}`),R.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),R.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.match(RegExp(`(?:^|; )`+e+`=([^;]*)`));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function zt(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Bt(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Vt(e,t,n){let r=!zt(t);return e&&(r||n===!1)?Bt(e,t):t}var Ht=e=>e instanceof V?{...e}:e;function Ut(e,t){t||={};let n=Object.create(null);Object.defineProperty(n,`hasOwnProperty`,{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(e,t,n,r){return R.isPlainObject(e)&&R.isPlainObject(t)?R.merge.call({caseless:r},e,t):R.isPlainObject(t)?R.merge({},t):R.isArray(t)?t.slice():t}function i(e,t,n,i){if(!R.isUndefined(t))return r(e,t,n,i);if(!R.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!R.isUndefined(t))return r(void 0,t)}function o(e,t){if(!R.isUndefined(t))return r(void 0,t);if(!R.isUndefined(e))return r(void 0,e)}function s(n,i,a){if(R.hasOwnProp(t,a))return r(n,i);if(R.hasOwnProp(e,a))return r(void 0,n)}let c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:s,headers:(e,t,n)=>i(Ht(e),Ht(t),n,!0)};return R.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=R.hasOwnProp(c,r)?c[r]:i,o=a(R.hasOwnProp(e,r)?e[r]:void 0,R.hasOwnProp(t,r)?t[r]:void 0,r);R.isUndefined(o)&&a!==s||(n[r]=o)}),n}var Wt=e=>{let t=Ut({},e),n=e=>R.hasOwnProp(t,e)?t[e]:void 0,r=n(`data`),i=n(`withXSRFToken`),a=n(`xsrfHeaderName`),o=n(`xsrfCookieName`),s=n(`headers`),c=n(`auth`),l=n(`baseURL`),u=n(`allowAbsoluteUrls`),d=n(`url`);if(t.headers=s=V.from(s),t.url=Ze(Vt(l,d,u),e.params,e.paramsSerializer),c&&s.set(`Authorization`,`Basic `+btoa((c.username||``)+`:`+(c.password?unescape(encodeURIComponent(c.password)):``))),R.isFormData(r)){if(B.hasStandardBrowserEnv||B.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(R.isFunction(r.getHeaders)){let e=r.getHeaders(),t=[`content-type`,`content-length`];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}}if(B.hasStandardBrowserEnv&&(R.isFunction(i)&&(i=i(t)),i===!0||i==null&&Lt(t.url))){let e=a&&o&&Rt.read(o);e&&s.set(a,e)}return t},Gt=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=Wt(e),i=r.data,a=V.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=V.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());At(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf(`file:`)===0)||setTimeout(g)},h.onabort=function(){h&&=(n(new z(`Request aborted`,z.ECONNABORTED,e,h)),null)},h.onerror=function(t){let r=new z(t&&t.message?t.message:`Network Error`,z.ERR_NETWORK,e,h);r.event=t||null,n(r),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||$e;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new z(t,i.clarifyTimeoutError?z.ETIMEDOUT:z.ECONNABORTED,e,h)),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&R.forEach(a.toJSON(),function(e,t){h.setRequestHeader(t,e)}),R.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=Pt(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=Pt(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new kt(null,e,h):t),h.abort(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=jt(r.url);if(_&&B.protocols.indexOf(_)===-1){n(new z(`Unsupported protocol `+_+`:`,z.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Kt=(e,t)=>{let{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n=new AbortController,r,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof z?t:new kt(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new z(`timeout of ${t}ms exceeded`,z.ETIMEDOUT))},t),o=()=>{e&&=(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),null)};e.forEach(e=>e.addEventListener(`abort`,i));let{signal:s}=n;return s.unsubscribe=()=>R.asap(o),s}},qt=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},Jt=async function*(e,t){for await(let n of Yt(e))yield*qt(n,t)},Yt=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Xt=(e,t,n,r)=>{let i=Jt(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})},Zt=64*1024,{isFunction:Qt}=R,$t=(({Request:e,Response:t})=>({Request:e,Response:t}))(R.global),{ReadableStream:en,TextEncoder:tn}=R.global,nn=(e,...t)=>{try{return!!e(...t)}catch{return!1}},rn=e=>{e=R.merge.call({skipUndefined:!0},$t,e);let{fetch:t,Request:n,Response:r}=e,i=t?Qt(t):typeof fetch==`function`,a=Qt(n),o=Qt(r);if(!i)return!1;let s=i&&Qt(en),c=i&&(typeof tn==`function`?(e=>t=>e.encode(t))(new tn):async e=>new Uint8Array(await new n(e).arrayBuffer())),l=a&&s&&nn(()=>{let e=!1,t=new n(B.origin,{body:new en,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),u=o&&s&&nn(()=>R.isReadableStream(new r(``).body)),d={stream:u&&(e=>e.body)};i&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new z(`Response type '${e}' is not supported`,z.ERR_NOT_SUPPORT,n)})});let f=async e=>{if(e==null)return 0;if(R.isBlob(e))return e.size;if(R.isSpecCompliantForm(e))return(await new n(B.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(R.isArrayBufferView(e)||R.isArrayBuffer(e))return e.byteLength;if(R.isURLSearchParams(e)&&(e+=``),R.isString(e))return(await c(e)).byteLength},p=async(e,t)=>R.toFiniteNumber(e.getContentLength())??f(t);return async e=>{let{url:i,method:o,data:s,signal:c,cancelToken:f,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:_,headers:v,withCredentials:y=`same-origin`,fetchOptions:b}=Wt(e),x=t||fetch;_=_?(_+``).toLowerCase():`text`;let S=Kt([c,f&&f.toAbortSignal()],m),C=null,w=S&&S.unsubscribe&&(()=>{S.unsubscribe()}),T;try{if(g&&l&&o!==`get`&&o!==`head`&&(T=await p(v,s))!==0){let e=new n(i,{method:`POST`,body:s,duplex:`half`}),t;if(R.isFormData(s)&&(t=e.headers.get(`content-type`))&&v.setContentType(t),e.body){let[t,n]=Ft(T,Pt(It(g)));s=Xt(e.body,Zt,t,n)}}R.isString(y)||(y=y?`include`:`omit`);let t=a&&`credentials`in n.prototype;if(R.isFormData(s)){let e=v.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&v.delete(`content-type`)}let c={...b,signal:S,method:o.toUpperCase(),headers:v.normalize().toJSON(),body:s,duplex:`half`,credentials:t?y:void 0};C=a&&new n(i,c);let f=await(a?x(C,b):x(i,c)),m=u&&(_===`stream`||_===`response`);if(u&&(h||m&&w)){let e={};[`status`,`statusText`,`headers`].forEach(t=>{e[t]=f[t]});let t=R.toFiniteNumber(f.headers.get(`content-length`)),[n,i]=h&&Ft(t,Pt(It(h),!0))||[];f=new r(Xt(f.body,Zt,n,()=>{i&&i(),w&&w()}),e)}_||=`text`;let E=await d[R.findKey(d,_)||`text`](f,e);return!m&&w&&w(),await new Promise((t,n)=>{At(t,n,{data:E,headers:V.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:C})})}catch(t){throw w&&w(),t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new z(`Network Error`,z.ERR_NETWORK,e,C,t&&t.response),{cause:t.cause||t}):z.from(t,t&&t.code,e,C,t&&t.response)}}},an=new Map,on=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=an;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:rn(t)),l=c;return c};on();var sn={http:null,xhr:Gt,fetch:{get:on}};R.forEach(sn,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{value:t})}catch{}Object.defineProperty(e,`adapterName`,{value:t})}});var cn=e=>`- ${e}`,ln=e=>R.isFunction(e)||e===null||e===!1;function un(e,t){e=R.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o<n;o++){r=e[o];let n;if(i=r,!ln(r)&&(i=sn[(n=String(r)).toLowerCase()],i===void 0))throw new z(`Unknown adapter '${n}'`);if(i&&(R.isFunction(i)||(i=i.get(t))))break;a[n||`#`+o]=i}if(!i){let e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new z(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since :
4
- `+e.map(cn).join(`
5
- `):` `+cn(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var dn={getAdapter:un,adapters:sn};function fn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new kt(null,e)}function pn(e){return fn(e),e.headers=V.from(e.headers),e.data=Dt.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),dn.getAdapter(e.adapter||pt.adapter,e)(e).then(function(t){return fn(e),t.data=Dt.call(e,e.transformResponse,t),t.headers=V.from(t.headers),t},function(t){return Ot(t)||(fn(e),t&&t.response&&(t.response.data=Dt.call(e,e.transformResponse,t.response),t.response.headers=V.from(t.response.headers))),Promise.reject(t)})}var mn=`1.15.2`,hn={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{hn[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var gn={};hn.transitional=function(e,t,n){function r(e,t){return`[Axios v`+mn+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new z(r(i,` has been removed`+(t?` in `+t:``)),z.ERR_DEPRECATED);return t&&!gn[i]&&(gn[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},hn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function _n(e,t,n){if(typeof e!=`object`)throw new z(`options must be an object`,z.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new z(`option `+a+` must be `+n,z.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new z(`Unknown option `+a,z.ERR_BAD_OPTION)}}var vn={assertOptions:_n,validators:hn},H=vn.validators,yn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Qe,response:new Qe}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();let n=(()=>{if(!t.stack)return``;let e=t.stack.indexOf(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);let f=require(`vue`);var p=class{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){let n=this.listeners.get(e);n&&n.delete(t)}emit(e,t){let n=this.listeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(t){console.error(`[EventBus] Error in handler for "${e}":`,t)}})}once(e,t){let n=r=>{this.off(e,n),t(r)};this.on(e,n)}clear(){this.listeners.clear()}listenerCount(e){return this.listeners.get(e)?.size??0}};function m(e,t){return function(){return e.apply(t,arguments)}}var{toString:h}=Object.prototype,{getPrototypeOf:g}=Object,{iterator:_,toStringTag:v}=Symbol,y=(e=>t=>{let n=h.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),b=e=>(e=e.toLowerCase(),t=>y(t)===e),x=e=>t=>typeof t===e,{isArray:S}=Array,C=x(`undefined`);function w(e){return e!==null&&!C(e)&&e.constructor!==null&&!C(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var T=b(`ArrayBuffer`);function E(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&T(e.buffer),t}var D=x(`string`),O=x(`function`),k=x(`number`),A=e=>typeof e==`object`&&!!e,j=e=>e===!0||e===!1,M=e=>{if(y(e)!==`object`)return!1;let t=g(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(v in e)&&!(_ in e)},ee=e=>{if(!A(e)||w(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},te=b(`Date`),N=b(`File`),P=e=>!!(e&&e.uri!==void 0),F=e=>e&&e.getParts!==void 0,ne=b(`Blob`),I=b(`FileList`),re=e=>A(e)&&O(e.pipe);function ie(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var ae=ie(),oe=ae.FormData===void 0?void 0:ae.FormData,se=e=>{if(!e)return!1;if(oe&&e instanceof oe)return!0;let t=g(e);if(!t||t===Object.prototype||!O(e.append))return!1;let n=y(e);return n===`formdata`||n===`object`&&O(e.toString)&&e.toString()===`[object FormData]`},ce=b(`URLSearchParams`),[le,ue,de,fe]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(b),pe=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function me(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),S(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(w(e))return;let i=n?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length,o;for(r=0;r<a;r++)o=i[r],t.call(null,e[o],o,e)}}function he(e,t){if(w(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}var ge=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,_e=e=>!C(e)&&e!==ge;function ve(){let{caseless:e,skipUndefined:t}=_e(this)&&this||{},n={},r=(r,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=e&&he(n,i)||i;M(n[a])&&M(r)?n[a]=ve(n[a],r):M(r)?n[a]=ve({},r):S(r)?n[a]=r.slice():(!t||!C(r))&&(n[a]=r)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&me(arguments[e],r);return n}var ye=(e,t,n,{allOwnKeys:r}={})=>(me(t,(t,r)=>{n&&O(t)?Object.defineProperty(e,r,{value:m(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),be=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),xe=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{value:t.prototype}),n&&Object.assign(e.prototype,n)},Se=(e,t,n,r)=>{let i,a,o,s={};if(t||={},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&g(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ce=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},we=e=>{if(!e)return null;if(S(e))return e;let t=e.length;if(!k(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},Te=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&g(Uint8Array)),Ee=(e,t)=>{let n=(e&&e[_]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},De=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Oe=b(`HTMLFormElement`),ke=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),Ae=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),je=b(`RegExp`),Me=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};me(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},Ne=e=>{Me(e,(t,n)=>{if(O(e)&&[`arguments`,`caller`,`callee`].indexOf(n)!==-1)return!1;let r=e[n];if(O(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},Pe=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return S(e)?r(e):r(String(e).split(t)),n},Fe=()=>{},Ie=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Le(e){return!!(e&&O(e.append)&&e[v]===`FormData`&&e[_])}var Re=e=>{let t=Array(10),n=(e,r)=>{if(A(e)){if(t.indexOf(e)>=0)return;if(w(e))return e;if(!(`toJSON`in e)){t[r]=e;let i=S(e)?[]:{};return me(e,(e,t)=>{let a=n(e,r+1);!C(a)&&(i[t]=a)}),t[r]=void 0,i}}return e};return n(e,0)},ze=b(`AsyncFunction`),Be=e=>e&&(A(e)||O(e))&&O(e.then)&&O(e.catch),Ve=((e,t)=>e?setImmediate:t?((e,t)=>(ge.addEventListener(`message`,({source:n,data:r})=>{n===ge&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),ge.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,O(ge.postMessage)),L={isArray:S,isArrayBuffer:T,isBuffer:w,isFormData:se,isArrayBufferView:E,isString:D,isNumber:k,isBoolean:j,isObject:A,isPlainObject:M,isEmptyObject:ee,isReadableStream:le,isRequest:ue,isResponse:de,isHeaders:fe,isUndefined:C,isDate:te,isFile:N,isReactNativeBlob:P,isReactNative:F,isBlob:ne,isRegExp:je,isFunction:O,isStream:re,isURLSearchParams:ce,isTypedArray:Te,isFileList:I,forEach:me,merge:ve,extend:ye,trim:pe,stripBOM:be,inherits:xe,toFlatObject:Se,kindOf:y,kindOfTest:b,endsWith:Ce,toArray:we,forEachEntry:Ee,matchAll:De,isHTMLForm:Oe,hasOwnProperty:Ae,hasOwnProp:Ae,reduceDescriptors:Me,freezeMethods:Ne,toObjectSet:Pe,toCamelCase:ke,noop:Fe,toFiniteNumber:Ie,findKey:he,global:ge,isContextDefined:_e,isSpecCompliantForm:Le,toJSONObject:Re,isAsyncFn:ze,isThenable:Be,setImmediate:Ve,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(ge):typeof process<`u`&&process.nextTick||Ve,isIterable:e=>e!=null&&O(e[_])},R=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),Object.defineProperty(this,`message`,{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name=`AxiosError`,this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){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:L.toJSONObject(this.config),code:this.code,status:this.status}}};R.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,R.ERR_BAD_OPTION=`ERR_BAD_OPTION`,R.ECONNABORTED=`ECONNABORTED`,R.ETIMEDOUT=`ETIMEDOUT`,R.ERR_NETWORK=`ERR_NETWORK`,R.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,R.ERR_DEPRECATED=`ERR_DEPRECATED`,R.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,R.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,R.ERR_CANCELED=`ERR_CANCELED`,R.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,R.ERR_INVALID_URL=`ERR_INVALID_URL`,R.ERR_FORM_DATA_DEPTH_EXCEEDED=`ERR_FORM_DATA_DEPTH_EXCEEDED`;function He(e){return L.isPlainObject(e)||L.isArray(e)}function Ue(e){return L.endsWith(e,`[]`)?e.slice(0,-2):e}function We(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ue(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function Ge(e){return L.isArray(e)&&!e.some(He)}var Ke=L.toFlatObject(L,{},null,function(e){return/^is[A-Z]/.test(e)});function qe(e,t,n){if(!L.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=L.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!L.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||d,a=n.dots,o=n.indexes,s=n.Blob||typeof Blob<`u`&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=s&&L.isSpecCompliantForm(t);if(!L.isFunction(i))throw TypeError(`visitor must be a function`);function u(e){if(e===null)return``;if(L.isDate(e))return e.toISOString();if(L.isBoolean(e))return e.toString();if(!l&&L.isBlob(e))throw new R(`Blob is not supported. Use a Buffer instead.`);return L.isArrayBuffer(e)||L.isTypedArray(e)?l&&typeof Blob==`function`?new Blob([e]):Buffer.from(e):e}function d(e,n,i){let s=e;if(L.isReactNative(t)&&L.isReactNativeBlob(e))return t.append(We(i,n,a),u(e)),!1;if(e&&!i&&typeof e==`object`){if(L.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(L.isArray(e)&&Ge(e)||(L.isFileList(e)||L.endsWith(n,`[]`))&&(s=L.toArray(e)))return n=Ue(n),s.forEach(function(e,r){!(L.isUndefined(e)||e===null)&&t.append(o===!0?We([n],r,a):o===null?n:n+`[]`,u(e))}),!1}return He(e)?!0:(t.append(We(i,n,a),u(e)),!1)}let f=[],p=Object.assign(Ke,{defaultVisitor:d,convertValue:u,isVisitable:He});function m(e,n,r=0){if(!L.isUndefined(e)){if(r>c)throw new R(`Object is too deeply nested (`+r+` levels). Max depth: `+c,R.ERR_FORM_DATA_DEPTH_EXCEEDED);if(f.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));f.push(e),L.forEach(e,function(e,a){(!(L.isUndefined(e)||e===null)&&i.call(t,e,L.isString(a)?a.trim():a,n,p))===!0&&m(e,n?n.concat(a):[a],r+1)}),f.pop()}}if(!L.isObject(e))throw TypeError(`data must be an object`);return m(e),t}function Je(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Ye(e,t){this._pairs=[],e&&qe(e,this,t)}var Xe=Ye.prototype;Xe.append=function(e,t){this._pairs.push([e,t])},Xe.toString=function(e){let t=e?function(t){return e.call(this,t,Je)}:Je;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function Ze(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function Qe(e,t,n){if(!t)return e;let r=n&&n.encode||Ze,i=L.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):L.isURLSearchParams(t)?t.toString():new Ye(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var $e=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){L.forEach(this.handlers,function(t){t!==null&&e(t)})}},et={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},tt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:Ye,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},nt=c({hasBrowserEnv:()=>rt,hasStandardBrowserEnv:()=>at,hasStandardBrowserWebWorkerEnv:()=>ot,navigator:()=>it,origin:()=>st}),rt=typeof window<`u`&&typeof document<`u`,it=typeof navigator==`object`&&navigator||void 0,at=rt&&(!it||[`ReactNative`,`NativeScript`,`NS`].indexOf(it.product)<0),ot=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,st=rt&&window.location.href||`http://localhost`,z={...nt,...tt};function ct(e,t){return qe(e,new z.classes.URLSearchParams,{visitor:function(e,t,n,r){return z.isNode&&L.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function lt(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function ut(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r<i;r++)a=n[r],t[a]=e[a];return t}function dt(e){function t(e,n,r,i){let a=e[i++];if(a===`__proto__`)return!0;let o=Number.isFinite(+a),s=i>=e.length;return a=!a&&L.isArray(r)?r.length:a,s?(L.hasOwnProp(r,a)?r[a]=L.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!r[a]||!L.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&L.isArray(r[a])&&(r[a]=ut(r[a])),!o)}if(L.isFormData(e)&&L.isFunction(e.entries)){let n={};return L.forEachEntry(e,(e,r)=>{t(lt(e),r,n,0)}),n}return null}var ft=(e,t)=>e!=null&&L.hasOwnProp(e,t)?e[t]:void 0;function pt(e,t,n){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var mt={transitional:et,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=L.isObject(e);if(i&&L.isHTMLForm(e)&&(e=new FormData(e)),L.isFormData(e))return r?JSON.stringify(dt(e)):e;if(L.isArrayBuffer(e)||L.isBuffer(e)||L.isStream(e)||L.isFile(e)||L.isBlob(e)||L.isReadableStream(e))return e;if(L.isArrayBufferView(e))return e.buffer;if(L.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){let t=ft(this,`formSerializer`);if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return ct(e,t).toString();if((a=L.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=ft(this,`env`),r=n&&n.FormData;return qe(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),pt(e)):e}],transformResponse:[function(e){let t=ft(this,`transitional`)||mt.transitional,n=t&&t.forcedJSONParsing,r=ft(this,`responseType`),i=r===`json`;if(L.isResponse(e)||L.isReadableStream(e))return e;if(e&&L.isString(e)&&(n&&!r||i)){let n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,ft(this,`parseReviver`))}catch(e){if(n)throw e.name===`SyntaxError`?R.from(e,R.ERR_BAD_RESPONSE,this,null,ft(this,`response`)):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:z.classes.FormData,Blob:z.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};L.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`],e=>{mt.headers[e]={}});var ht=L.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`]),gt=e=>{let t={},n,r,i;return e&&e.split(`
2
+ `).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&ht[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},_t=Symbol(`internals`),vt=/[^\x09\x20-\x7E\x80-\xFF]/g;function yt(e){let t=0,n=e.length;for(;t<n;){let n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==9&&t!==32)break;--n}return t===0&&n===e.length?e:e.slice(t,n)}function bt(e){return e&&String(e).trim().toLowerCase()}function xt(e){return yt(e.replace(vt,``))}function St(e){return e===!1||e==null?e:L.isArray(e)?e.map(St):xt(String(e))}function Ct(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var wt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Tt(e,t,n,r,i){if(L.isFunction(r))return r.call(this,t,n);if(i&&(t=n),L.isString(t)){if(L.isString(r))return t.indexOf(r)!==-1;if(L.isRegExp(r))return r.test(t)}}function Et(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function Dt(e,t){let n=L.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var B=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=bt(t);if(!i)throw Error(`header name must be a non-empty string`);let a=L.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=St(e))}let a=(e,t)=>L.forEach(e,(e,n)=>i(e,n,t));if(L.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(L.isString(e)&&(e=e.trim())&&!wt(e))a(gt(e),t);else if(L.isObject(e)&&L.isIterable(e)){let n={},r,i;for(let t of e){if(!L.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);n[i=t[0]]=(r=n[i])?L.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=bt(e),e){let n=L.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return Ct(e);if(L.isFunction(t))return t.call(this,e,n);if(L.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=bt(e),e){let n=L.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Tt(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=bt(e),e){let i=L.findKey(n,e);i&&(!t||Tt(n,n[i],i,t))&&(delete n[i],r=!0)}}return L.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||Tt(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return L.forEach(this,(r,i)=>{let a=L.findKey(n,i);if(a){t[a]=St(r),delete t[i];return}let o=e?Et(i):String(i).trim();o!==i&&delete t[i],t[o]=St(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return L.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&L.isArray(n)?n.join(`, `):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+`: `+t).join(`
3
+ `)}getSetCookie(){return this.get(`set-cookie`)||[]}get[Symbol.toStringTag](){return`AxiosHeaders`}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[_t]=this[_t]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=bt(e);t[r]||(Dt(n,e),t[r]=!0)}return L.isArray(e)?e.forEach(r):r(e),this}};B.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),L.reduceDescriptors(B.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),L.freezeMethods(B);function Ot(e,t){let n=this||mt,r=t||n,i=B.from(r.headers),a=r.data;return L.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function kt(e){return!!(e&&e.__CANCEL__)}var At=class extends R{constructor(e,t,n){super(e??`canceled`,R.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function jt(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new R(`Request failed with status code `+n.status,[R.ERR_BAD_REQUEST,R.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Mt(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||``}function Nt(e,t){e||=10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||=c,n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o<t)return;let f=l&&c-l;return f?Math.round(d*1e3/f):void 0}}function Pt(e,t){let n=0,r=1e3/t,i,a,o=(t,r=Date.now())=>{n=r,i=null,a&&=(clearTimeout(a),null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||=setTimeout(()=>{a=null,o(i)},r-s))},()=>i&&o(i)]}var Ft=(e,t,n=3)=>{let r=0,i=Nt(50,250);return Pt(n=>{let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=o==null?a:Math.min(a,o),c=Math.max(0,s-r),l=i(c);r=Math.max(r,s),e({loaded:s,total:o,progress:o?s/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o?(o-s)/l:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},It=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Lt=e=>(...t)=>L.asap(()=>e(...t)),Rt=z.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,z.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(z.origin),z.navigator&&/(msie|trident)/i.test(z.navigator.userAgent)):()=>!0,zt=z.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];L.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),L.isString(r)&&s.push(`path=${r}`),L.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),L.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.match(RegExp(`(?:^|; )`+e+`=([^;]*)`));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function Bt(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Vt(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Ht(e,t,n){let r=!Bt(t);return e&&(r||n===!1)?Vt(e,t):t}var Ut=e=>e instanceof B?{...e}:e;function Wt(e,t){t||={};let n=Object.create(null);Object.defineProperty(n,`hasOwnProperty`,{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(e,t,n,r){return L.isPlainObject(e)&&L.isPlainObject(t)?L.merge.call({caseless:r},e,t):L.isPlainObject(t)?L.merge({},t):L.isArray(t)?t.slice():t}function i(e,t,n,i){if(!L.isUndefined(t))return r(e,t,n,i);if(!L.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!L.isUndefined(t))return r(void 0,t)}function o(e,t){if(!L.isUndefined(t))return r(void 0,t);if(!L.isUndefined(e))return r(void 0,e)}function s(n,i,a){if(L.hasOwnProp(t,a))return r(n,i);if(L.hasOwnProp(e,a))return r(void 0,n)}let c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:s,headers:(e,t,n)=>i(Ut(e),Ut(t),n,!0)};return L.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=L.hasOwnProp(c,r)?c[r]:i,o=a(L.hasOwnProp(e,r)?e[r]:void 0,L.hasOwnProp(t,r)?t[r]:void 0,r);L.isUndefined(o)&&a!==s||(n[r]=o)}),n}var Gt=e=>{let t=Wt({},e),n=e=>L.hasOwnProp(t,e)?t[e]:void 0,r=n(`data`),i=n(`withXSRFToken`),a=n(`xsrfHeaderName`),o=n(`xsrfCookieName`),s=n(`headers`),c=n(`auth`),l=n(`baseURL`),u=n(`allowAbsoluteUrls`),d=n(`url`);if(t.headers=s=B.from(s),t.url=Qe(Ht(l,d,u),e.params,e.paramsSerializer),c&&s.set(`Authorization`,`Basic `+btoa((c.username||``)+`:`+(c.password?unescape(encodeURIComponent(c.password)):``))),L.isFormData(r)){if(z.hasStandardBrowserEnv||z.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(L.isFunction(r.getHeaders)){let e=r.getHeaders(),t=[`content-type`,`content-length`];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}}if(z.hasStandardBrowserEnv&&(L.isFunction(i)&&(i=i(t)),i===!0||i==null&&Rt(t.url))){let e=a&&o&&zt.read(o);e&&s.set(a,e)}return t},Kt=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=Gt(e),i=r.data,a=B.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=B.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());jt(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf(`file:`)===0)||setTimeout(g)},h.onabort=function(){h&&=(n(new R(`Request aborted`,R.ECONNABORTED,e,h)),null)},h.onerror=function(t){let r=new R(t&&t.message?t.message:`Network Error`,R.ERR_NETWORK,e,h);r.event=t||null,n(r),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||et;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new R(t,i.clarifyTimeoutError?R.ETIMEDOUT:R.ECONNABORTED,e,h)),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&L.forEach(a.toJSON(),function(e,t){h.setRequestHeader(t,e)}),L.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=Ft(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=Ft(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new At(null,e,h):t),h.abort(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=Mt(r.url);if(_&&z.protocols.indexOf(_)===-1){n(new R(`Unsupported protocol `+_+`:`,R.ERR_BAD_REQUEST,e));return}h.send(i||null)})},qt=(e,t)=>{let{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n=new AbortController,r,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof R?t:new At(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new R(`timeout of ${t}ms exceeded`,R.ETIMEDOUT))},t),o=()=>{e&&=(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),null)};e.forEach(e=>e.addEventListener(`abort`,i));let{signal:s}=n;return s.unsubscribe=()=>L.asap(o),s}},Jt=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},Yt=async function*(e,t){for await(let n of Xt(e))yield*Jt(n,t)},Xt=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Zt=(e,t,n,r)=>{let i=Yt(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})},Qt=64*1024,{isFunction:$t}=L,en=(({Request:e,Response:t})=>({Request:e,Response:t}))(L.global),{ReadableStream:tn,TextEncoder:nn}=L.global,rn=(e,...t)=>{try{return!!e(...t)}catch{return!1}},an=e=>{e=L.merge.call({skipUndefined:!0},en,e);let{fetch:t,Request:n,Response:r}=e,i=t?$t(t):typeof fetch==`function`,a=$t(n),o=$t(r);if(!i)return!1;let s=i&&$t(tn),c=i&&(typeof nn==`function`?(e=>t=>e.encode(t))(new nn):async e=>new Uint8Array(await new n(e).arrayBuffer())),l=a&&s&&rn(()=>{let e=!1,t=new n(z.origin,{body:new tn,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),u=o&&s&&rn(()=>L.isReadableStream(new r(``).body)),d={stream:u&&(e=>e.body)};i&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new R(`Response type '${e}' is not supported`,R.ERR_NOT_SUPPORT,n)})});let f=async e=>{if(e==null)return 0;if(L.isBlob(e))return e.size;if(L.isSpecCompliantForm(e))return(await new n(z.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(L.isArrayBufferView(e)||L.isArrayBuffer(e))return e.byteLength;if(L.isURLSearchParams(e)&&(e+=``),L.isString(e))return(await c(e)).byteLength},p=async(e,t)=>L.toFiniteNumber(e.getContentLength())??f(t);return async e=>{let{url:i,method:o,data:s,signal:c,cancelToken:f,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:_,headers:v,withCredentials:y=`same-origin`,fetchOptions:b}=Gt(e),x=t||fetch;_=_?(_+``).toLowerCase():`text`;let S=qt([c,f&&f.toAbortSignal()],m),C=null,w=S&&S.unsubscribe&&(()=>{S.unsubscribe()}),T;try{if(g&&l&&o!==`get`&&o!==`head`&&(T=await p(v,s))!==0){let e=new n(i,{method:`POST`,body:s,duplex:`half`}),t;if(L.isFormData(s)&&(t=e.headers.get(`content-type`))&&v.setContentType(t),e.body){let[t,n]=It(T,Ft(Lt(g)));s=Zt(e.body,Qt,t,n)}}L.isString(y)||(y=y?`include`:`omit`);let t=a&&`credentials`in n.prototype;if(L.isFormData(s)){let e=v.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&v.delete(`content-type`)}let c={...b,signal:S,method:o.toUpperCase(),headers:v.normalize().toJSON(),body:s,duplex:`half`,credentials:t?y:void 0};C=a&&new n(i,c);let f=await(a?x(C,b):x(i,c)),m=u&&(_===`stream`||_===`response`);if(u&&(h||m&&w)){let e={};[`status`,`statusText`,`headers`].forEach(t=>{e[t]=f[t]});let t=L.toFiniteNumber(f.headers.get(`content-length`)),[n,i]=h&&It(t,Ft(Lt(h),!0))||[];f=new r(Zt(f.body,Qt,n,()=>{i&&i(),w&&w()}),e)}_||=`text`;let E=await d[L.findKey(d,_)||`text`](f,e);return!m&&w&&w(),await new Promise((t,n)=>{jt(t,n,{data:E,headers:B.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:C})})}catch(t){throw w&&w(),t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new R(`Network Error`,R.ERR_NETWORK,e,C,t&&t.response),{cause:t.cause||t}):R.from(t,t&&t.code,e,C,t&&t.response)}}},on=new Map,sn=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=on;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:an(t)),l=c;return c};sn();var cn={http:null,xhr:Kt,fetch:{get:sn}};L.forEach(cn,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{value:t})}catch{}Object.defineProperty(e,`adapterName`,{value:t})}});var ln=e=>`- ${e}`,un=e=>L.isFunction(e)||e===null||e===!1;function dn(e,t){e=L.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o<n;o++){r=e[o];let n;if(i=r,!un(r)&&(i=cn[(n=String(r)).toLowerCase()],i===void 0))throw new R(`Unknown adapter '${n}'`);if(i&&(L.isFunction(i)||(i=i.get(t))))break;a[n||`#`+o]=i}if(!i){let e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new R(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since :
4
+ `+e.map(ln).join(`
5
+ `):` `+ln(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var fn={getAdapter:dn,adapters:cn};function pn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new At(null,e)}function mn(e){return pn(e),e.headers=B.from(e.headers),e.data=Ot.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),fn.getAdapter(e.adapter||mt.adapter,e)(e).then(function(t){return pn(e),t.data=Ot.call(e,e.transformResponse,t),t.headers=B.from(t.headers),t},function(t){return kt(t)||(pn(e),t&&t.response&&(t.response.data=Ot.call(e,e.transformResponse,t.response),t.response.headers=B.from(t.response.headers))),Promise.reject(t)})}var hn=`1.15.2`,gn={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{gn[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var _n={};gn.transitional=function(e,t,n){function r(e,t){return`[Axios v`+hn+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new R(r(i,` has been removed`+(t?` in `+t:``)),R.ERR_DEPRECATED);return t&&!_n[i]&&(_n[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},gn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function vn(e,t,n){if(typeof e!=`object`)throw new R(`options must be an object`,R.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new R(`option `+a+` must be `+n,R.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new R(`Unknown option `+a,R.ERR_BAD_OPTION)}}var yn={assertOptions:vn,validators:gn},V=yn.validators,bn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new $e,response:new $e}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();let n=(()=>{if(!t.stack)return``;let e=t.stack.indexOf(`
6
6
  `);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(`
7
7
  `),r=t===-1?-1:n.indexOf(`
8
8
  `,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=`
9
- `+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=Ut(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&vn.assertOptions(n,{silentJSONParsing:H.transitional(H.boolean),forcedJSONParsing:H.transitional(H.boolean),clarifyTimeoutError:H.transitional(H.boolean),legacyInterceptorReqResOrdering:H.transitional(H.boolean)},!1),r!=null&&(R.isFunction(r)?t.paramsSerializer={serialize:r}:vn.assertOptions(r,{encode:H.function,serialize:H.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),vn.assertOptions(t,{baseUrl:H.spelling(`baseURL`),withXsrfToken:H.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&R.merge(i.common,i[t.method]);i&&R.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=V.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||$e;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[pn.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=pn.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=Ut(this.defaults,e),Ze(Vt(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};R.forEach([`delete`,`get`,`head`,`options`],function(e){yn.prototype[e]=function(t,n){return this.request(Ut(n||{},{method:e,url:t,data:(n||{}).data}))}}),R.forEach([`post`,`put`,`patch`],function(e){function t(t){return function(n,r,i){return this.request(Ut(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}yn.prototype[e]=t(),yn.prototype[e+`Form`]=t(!0)});var bn=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new kt(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function xn(e){return function(t){return e.apply(null,t)}}function Sn(e){return R.isObject(e)&&e.isAxiosError===!0}var Cn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Cn).forEach(([e,t])=>{Cn[t]=e});function wn(e){let t=new yn(e),n=m(yn.prototype.request,t);return R.extend(n,yn.prototype,t,{allOwnKeys:!0}),R.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return wn(Ut(e,t))},n}var U=wn(pt);U.Axios=yn,U.CanceledError=kt,U.CancelToken=bn,U.isCancel=Ot,U.VERSION=mn,U.toFormData=Ke,U.AxiosError=z,U.Cancel=U.CanceledError,U.all=function(e){return Promise.all(e)},U.spread=xn,U.isAxiosError=Sn,U.mergeConfig=Ut,U.AxiosHeaders=V,U.formToJSON=e=>ut(R.isHTMLForm(e)?new FormData(e):e),U.getAdapter=dn.getAdapter,U.HttpStatusCode=Cn,U.default=U;function Tn(e){if(/^\d{8}$/.test(e))return`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`;if(/^\d{4}-\d{2}-\d{2}T/.test(e))return e.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().slice(0,10)}function En(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)throw Error(`无法解析日期: ${e}`);let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return Date.UTC(n,r-1,i,-8,0,0,0)}function Dn(e){return e&&{daily:`d`,weekly:`w`,monthly:`m`,5:`5`,15:`15`,30:`30`,60:`60`}[e]||`d`}function On(e){return e&&{qfq:`2`,hfq:`1`,none:`3`}[e]||`3`}function kn(e){let t=Tn(e.date),n=e=>{let t=parseFloat(e);return Number.isNaN(t)?0:t};return{timestamp:En(t),stockCode:e.code,open:n(e.open),high:n(e.high),low:n(e.low),close:n(e.close),volume:n(e.volume),turnover:n(e.amount),changePercent:n(e.pctChg),turnoverRate:n(e.turn)}}var An=``,jn=`/api/stock/kdata`;async function Mn(e){let{timeout:t,...n}=e,r=`${An}${jn}`,i={stock_code:n.symbol,start_date:n.start_date,end_date:n.end_date,frequency:Dn(n.period),adjustflag:On(n.adjust),timeout:t};try{let e=(await U.get(r,{params:i,timeout:t?t*1e3:void 0})).data;if(!e.success)throw Error(`获取K线数据失败: ${e.error_msg||`未知错误`} (code: ${e.error_code})`);return!e.data||e.data.length===0?[]:e.data.map(kn).sort((e,t)=>e.timestamp-t.timestamp)}catch(e){throw U.isAxiosError(e)?Error(`获取K线数据失败: ${e.message}`):e}}function Nn(e){return e.map(e=>({timestamp:e.timestamp,open:e.open,high:e.high,low:e.low,close:e.close,stockCode:e.stockCode,volume:e.volume,turnover:e.turnover,amplitude:e.amplitude,changePercent:e.changePercent,changeAmount:e.changeAmount,turnoverRate:e.turnoverRate})).sort((e,t)=>e.timestamp-t.timestamp)}var Pn=`/api/public/stock_zh_a_hist`;function Fn(e){if(/^\d{8}$/.test(e))return`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`;if(/^\d{4}-\d{2}-\d{2}T/.test(e))return e.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().slice(0,10)}function In(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)throw Error(`无法解析日期: ${e}`);let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return Date.UTC(n,r-1,i,-8,0,0,0)}function Ln(e){return{timestamp:In(Fn(e.日期)),stockCode:e.股票代码,open:e.开盘,close:e.收盘,high:e.最高,low:e.最低,volume:e.成交量,turnover:e.成交额,amplitude:e.振幅,changePercent:e.涨跌幅,changeAmount:e.涨跌额,turnoverRate:e.换手率}}async function Rn(e){try{let{timeout:t,...n}=e;return(await U.get(Pn,{params:n,timeout:t?t*1e3:void 0})).data.map(Ln)}catch(e){throw U.isAxiosError(e)?Error(`获取K线数据失败: ${e.message}`):e}}var zn=class{name=`baostock`;async fetchKLineData(e){return Mn({symbol:this.addMarketPrefix(e.symbol),start_date:e.startDate,end_date:e.endDate,period:{daily:`daily`,weekly:`weekly`,monthly:`monthly`,"5min":`5`,"15min":`15`,"30min":`30`,"60min":`60`}[e.period]||`daily`,adjust:e.adjust,timeout:e.timeout})}addMarketPrefix(e){return/^(6|68)\d{5}$/.test(e)?`sh.${e}`:/^(0|3)\d{5}$/.test(e)?`sz.${e}`:e}},Bn=class{name=`dongcai`;async fetchKLineData(e){let t=e.startDate.replace(/-/g,``),n=e.endDate.replace(/-/g,``),r={daily:`daily`,weekly:`weekly`,monthly:`monthly`}[e.period];if(!r)throw Error(`东财数据源不支持周期: ${e.period}`);return Nn(await Rn({symbol:e.symbol,start_date:t,end_date:n,period:r,adjust:e.adjust===`none`?void 0:e.adjust,timeout:e.timeout}))}},Vn=class{static instances=new Map;static create(e){if(!this.instances.has(e))switch(e){case`baostock`:this.instances.set(e,new zn);break;case`dongcai`:this.instances.set(e,new Bn);break;default:throw Error(`未知的数据源类型: ${e}`)}return this.instances.get(e)}};async function Hn(e,t){return Vn.create(e).fetchKLineData(t)}var Un=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),Wn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=Un(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),W=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=Un(),n=Wn(),r=Un();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=Wn();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
10
- `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${I(e)}`}e.not=j;var M=F(e.operators.AND);function ee(...e){return e.reduce(M)}e.and=ee;var N=F(e.operators.OR);function P(...e){return e.reduce(N)}e.or=P;function F(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${I(n)} ${e} ${I(r)}`}function I(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),G=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=W(),n=Un();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),Gn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),Kn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=W(),n=G(),r=Gn();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),qn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=Kn(),n=W(),r=Gn(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),Jn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),Yn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),Xn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=Jn(),n=Yn(),r=Kn(),i=W(),a=G(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
9
+ `+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=Wt(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&yn.assertOptions(n,{silentJSONParsing:V.transitional(V.boolean),forcedJSONParsing:V.transitional(V.boolean),clarifyTimeoutError:V.transitional(V.boolean),legacyInterceptorReqResOrdering:V.transitional(V.boolean)},!1),r!=null&&(L.isFunction(r)?t.paramsSerializer={serialize:r}:yn.assertOptions(r,{encode:V.function,serialize:V.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),yn.assertOptions(t,{baseUrl:V.spelling(`baseURL`),withXsrfToken:V.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&L.merge(i.common,i[t.method]);i&&L.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=B.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||et;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[mn.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=mn.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=Wt(this.defaults,e),Qe(Ht(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};L.forEach([`delete`,`get`,`head`,`options`],function(e){bn.prototype[e]=function(t,n){return this.request(Wt(n||{},{method:e,url:t,data:(n||{}).data}))}}),L.forEach([`post`,`put`,`patch`],function(e){function t(t){return function(n,r,i){return this.request(Wt(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}bn.prototype[e]=t(),bn.prototype[e+`Form`]=t(!0)});var xn=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new At(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function Sn(e){return function(t){return e.apply(null,t)}}function Cn(e){return L.isObject(e)&&e.isAxiosError===!0}var wn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(wn).forEach(([e,t])=>{wn[t]=e});function Tn(e){let t=new bn(e),n=m(bn.prototype.request,t);return L.extend(n,bn.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return Tn(Wt(e,t))},n}var H=Tn(mt);H.Axios=bn,H.CanceledError=At,H.CancelToken=xn,H.isCancel=kt,H.VERSION=hn,H.toFormData=qe,H.AxiosError=R,H.Cancel=H.CanceledError,H.all=function(e){return Promise.all(e)},H.spread=Sn,H.isAxiosError=Cn,H.mergeConfig=Wt,H.AxiosHeaders=B,H.formToJSON=e=>dt(L.isHTMLForm(e)?new FormData(e):e),H.getAdapter=fn.getAdapter,H.HttpStatusCode=wn,H.default=H;function En(e){if(/^\d{8}$/.test(e))return`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`;if(/^\d{4}-\d{2}-\d{2}T/.test(e))return e.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().slice(0,10)}function Dn(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)throw Error(`无法解析日期: ${e}`);let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return Date.UTC(n,r-1,i,-8,0,0,0)}function On(e){return e&&{daily:`d`,weekly:`w`,monthly:`m`,5:`5`,15:`15`,30:`30`,60:`60`}[e]||`d`}function kn(e){return e&&{qfq:`2`,hfq:`1`,none:`3`}[e]||`3`}function An(e){let t=En(e.date),n=e=>{let t=parseFloat(e);return Number.isNaN(t)?0:t};return{timestamp:Dn(t),stockCode:e.code,open:n(e.open),high:n(e.high),low:n(e.low),close:n(e.close),volume:n(e.volume),turnover:n(e.amount),changePercent:n(e.pctChg),turnoverRate:n(e.turn)}}var jn=``,Mn=`/api/stock/kdata`;async function Nn(e){let{timeout:t,...n}=e,r=`${jn}${Mn}`,i={stock_code:n.symbol,start_date:n.start_date,end_date:n.end_date,frequency:On(n.period),adjustflag:kn(n.adjust),timeout:t};try{let e=(await H.get(r,{params:i,timeout:t?t*1e3:void 0})).data;if(!e.success)throw Error(`获取K线数据失败: ${e.error_msg||`未知错误`} (code: ${e.error_code})`);return!e.data||e.data.length===0?[]:e.data.map(An).sort((e,t)=>e.timestamp-t.timestamp)}catch(e){throw H.isAxiosError(e)?Error(`获取K线数据失败: ${e.message}`):e}}function Pn(e){return e.map(e=>({timestamp:e.timestamp,open:e.open,high:e.high,low:e.low,close:e.close,stockCode:e.stockCode,volume:e.volume,turnover:e.turnover,amplitude:e.amplitude,changePercent:e.changePercent,changeAmount:e.changeAmount,turnoverRate:e.turnoverRate})).sort((e,t)=>e.timestamp-t.timestamp)}var Fn=`/api/public/stock_zh_a_hist`;function In(e){if(/^\d{8}$/.test(e))return`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`;if(/^\d{4}-\d{2}-\d{2}T/.test(e))return e.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().slice(0,10)}function Ln(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)throw Error(`无法解析日期: ${e}`);let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return Date.UTC(n,r-1,i,-8,0,0,0)}function Rn(e){return{timestamp:Ln(In(e.日期)),stockCode:e.股票代码,open:e.开盘,close:e.收盘,high:e.最高,low:e.最低,volume:e.成交量,turnover:e.成交额,amplitude:e.振幅,changePercent:e.涨跌幅,changeAmount:e.涨跌额,turnoverRate:e.换手率}}async function zn(e){try{let{timeout:t,...n}=e;return(await H.get(Fn,{params:n,timeout:t?t*1e3:void 0})).data.map(Rn)}catch(e){throw H.isAxiosError(e)?Error(`获取K线数据失败: ${e.message}`):e}}var Bn=class{name=`baostock`;async fetchKLineData(e){return Nn({symbol:this.addMarketPrefix(e.symbol),start_date:e.startDate,end_date:e.endDate,period:{daily:`daily`,weekly:`weekly`,monthly:`monthly`,"5min":`5`,"15min":`15`,"30min":`30`,"60min":`60`}[e.period]||`daily`,adjust:e.adjust,timeout:e.timeout})}addMarketPrefix(e){return/^(6|68)\d{5}$/.test(e)?`sh.${e}`:/^(0|3)\d{5}$/.test(e)?`sz.${e}`:e}},Vn=class{name=`dongcai`;async fetchKLineData(e){let t=e.startDate.replace(/-/g,``),n=e.endDate.replace(/-/g,``),r={daily:`daily`,weekly:`weekly`,monthly:`monthly`}[e.period];if(!r)throw Error(`东财数据源不支持周期: ${e.period}`);return Pn(await zn({symbol:e.symbol,start_date:t,end_date:n,period:r,adjust:e.adjust===`none`?void 0:e.adjust,timeout:e.timeout}))}},Hn=class{static instances=new Map;static create(e){if(!this.instances.has(e))switch(e){case`baostock`:this.instances.set(e,new Bn);break;case`dongcai`:this.instances.set(e,new Vn);break;default:throw Error(`未知的数据源类型: ${e}`)}return this.instances.get(e)}};async function Un(e,t){return Hn.create(e).fetchKLineData(t)}var Wn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),Gn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=Wn(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),U=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=Wn(),n=Gn(),r=Wn();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=Gn();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
10
+ `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${F(e)}`}e.not=j;var M=P(e.operators.AND);function ee(...e){return e.reduce(M)}e.and=ee;var te=P(e.operators.OR);function N(...e){return e.reduce(te)}e.or=N;function P(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${F(n)} ${e} ${F(r)}`}function F(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),W=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=U(),n=Wn();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),G=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),Kn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=U(),n=W(),r=G();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),qn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=Kn(),n=U(),r=G(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),Jn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),Yn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),Xn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=Jn(),n=Yn(),r=Kn(),i=U(),a=W(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
11
11
  || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
12
12
  || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
13
- || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),Zn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assignDefaults=void 0;var t=W(),n=G();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),K=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=W(),n=G(),r=Gn(),i=G();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),Qn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=W(),n=Gn(),r=K(),i=Kn();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),$n=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=W(),n=G();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),er=s(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),tr=s(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else (p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),nr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=G(),n=er(),r=tr(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),rr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=qn(),n=Xn(),r=Yn(),i=Xn(),a=Zn(),o=Qn(),s=$n(),c=W(),l=Gn(),u=nr(),d=G(),f=Kn();function p(e){if(S(e)&&(w(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&A(e),D(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),T(e),j(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(S(e)&&(w(e),x(e))){C(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&A(e),O(e),k(e);let a=r.const(`_errs`,l.default.errors);T(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),E(e)}function T(e,t){if(e.opts.jtd)return ee(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);ee(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function E(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function D(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function O(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function k(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function j(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&M(e),t.return((0,c._)`${l.default.errors} === 0`))}function M({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function ee(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>oe(e,`$ref`,h.all.$ref.definition));return}p.jtd||P(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),N(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):N(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function N(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&oe(e,n.keyword,n.definition,t.type)})}function P(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(F(e,t),e.opts.allowUnionTypes||I(e,t),te(e,e.dataTypes))}function F(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{ne(e.dataTypes,t)||ie(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),re(e,t)}}function I(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&ie(e,`use allowUnionTypes to allow union type keyword`)}function te(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>L(t,e))&&ie(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function L(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function ne(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function re(e,t){let n=[];for(let r of e.dataTypes)ne(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function ie(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var ae=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,le(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=ae;function oe(e,t,n,r){let i=new ae(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var se=/^\/(?:[^~]|~0|~1)*$/,ce=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function le(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!se.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=ce.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=le})),ir=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),ar=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=nr();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),or=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=W(),n=ir(),r=Gn(),i=nr(),a=G(),o=rr(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),sr=c({$id:()=>cr,additionalProperties:()=>!1,default:()=>pr,description:()=>lr,properties:()=>fr,required:()=>dr,type:()=>ur}),cr,lr,ur,dr,fr,pr,mr=o((()=>{cr=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,lr=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,ur=`object`,dr=[`$data`],fr={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},pr={$id:cr,description:lr,type:ur,required:dr,properties:fr,additionalProperties:!1}})),hr=s(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){let r=i(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function c(e){let t=0,n={error:!1,address:``,zone:``},r=[],a=[],c=!1,l=!1,u=s;for(let i=0;i<e.length;i++){let s=e[i];if(!(s===`[`||s===`]`))if(s===`:`){if(c===!0&&(l=!0),!u(a,r,n))break;if(++t>7){n.error=!0;break}i>0&&e[i-1]===`:`&&(c=!0),r.push(`:`);continue}else if(s===`%`){if(!u(a,r,n))break;u=o}else{a.push(s);continue}}return a.length&&(u===o?n.zone=a.join(``):l?r.push(a.join(``)):r.push(i(a))),n.address=r.join(``),n}function l(e){if(u(e,`:`)<2)return{host:e,isIPV6:!1};let t=c(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function u(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function d(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function f(e,t){let n=t===!0?unescape:escape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function p(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let t=l(n);n=t.isIPV6===!0?`[${t.escapedHost}]`:e.host}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:a,recomposeAuthority:p,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:r,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:i}})),gr=s(((e,t)=>{var{isUUID:n}=hr(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),_r=s(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=hr(),{SCHEMES:c,getSchemeHandler:l}=gr();function u(e,t){return typeof e==`string`?e=m(g(e,t),t):typeof e==`object`&&(e=g(m(e,t),t)),e}function d(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=f(g(e,r),g(t,r),r,!0);return r.skipEscape=!0,m(i,r)}function f(e,t,n,i){let a={};return i||(e=g(m(e,n),n),t=g(m(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t,n){return typeof e==`string`?(e=unescape(e),e=m(a(g(e,n),!0),{...n,skipEscape:!0})):typeof e==`object`&&(e=m(a(e,!0),{...n,skipEscape:!0})),typeof t==`string`?(t=unescape(t),t=m(a(g(t,n),!0),{...n,skipEscape:!0})):typeof t==`object`&&(t=m(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function m(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},a=Object.assign({},t),o=[],s=l(a.scheme||n.scheme);s&&s.serialize&&s.serialize(n,a),n.path!==void 0&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),a.reference!==`suffix`&&n.scheme&&o.push(n.scheme,`:`);let c=i(n);if(c!==void 0&&(a.reference!==`suffix`&&o.push(`//`),o.push(c),n.path&&n.path[0]!==`/`&&o.push(`/`)),n.path!==void 0){let e=n.path;!a.absolutePath&&(!s||!s.absolutePath)&&(e=r(e)),c===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),o.push(e)}return n.query!==void 0&&o.push(`?`,n.query),n.fragment!==void 0&&o.push(`#`,n.fragment),o.join(``)}var h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let c=e.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||``,i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(o(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let t=l(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&a===!1&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}(!t||t&&!t.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&=escape(unescape(i.path)),i.fragment&&=encodeURI(decodeURIComponent(i.fragment))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return i}var _={SCHEMES:c,normalize:u,resolve:d,resolveComponent:f,equal:p,serialize:m,parse:g};t.exports=_,t.exports.default=_,t.exports.fastUri=_})),vr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=_r();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),yr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=rr();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return t.KeywordCxt}});var n=W();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return n.CodeGen}});var r=ir(),i=ar(),a=Jn(),o=or(),s=W(),c=nr(),l=Xn(),u=G(),f=(mr(),d(sr).default),p=vr(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=k(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=D.call(this),e.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(j.call(this,n,t),!t)return(0,u.eachItem)(n,e=>M.call(this,e)),this;N.call(this,t);let r={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,r.type.length===0?e=>M.call(this,e,r):e=>r.type.forEach(t=>M.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=F(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=r.default,x.MissingRefError=i.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function T(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function D(){let e={...this.opts};for(let t of h)delete e[t];return e}var O={log(){},warn(){},error(){}};function k(e){if(e===!1)return O;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var A=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!A.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function M(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?ee.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function ee(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function N(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=F(t)),e.validateSchema=this.compile(t,!0))}var P={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function F(e){return{anyOf:[e,P]}}})),br=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),xr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;var t=ar(),n=K(),r=W(),i=Gn(),a=or(),o=G(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0)if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}if(l.items!==!0)if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}e.callRef=l,e.default=s})),Sr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=br(),n=xr();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),Cr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),wr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),Tr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),Er=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r=Tr();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),Dr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=G(),r=W();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),Or=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),kr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=W(),r=G();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),Ar=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),jr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=er();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),Mr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Xn(),n=W(),r=G(),i=jr();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),Nr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r=jr();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),Pr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r=jr();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),Fr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Cr(),n=wr(),r=Er(),i=Dr(),a=Or(),o=kr(),s=Ar(),c=Mr(),l=Nr(),u=Pr();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),Ir=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateAdditionalItems=void 0;var t=W(),n=G(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),Lr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;var t=W(),n=G(),r=K(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),Rr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Lr();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),zr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r=K(),i=Ir();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),Br=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),Vr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=W(),n=G(),r=K();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
13
+ || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),Zn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assignDefaults=void 0;var t=U(),n=W();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),K=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=U(),n=W(),r=G(),i=W();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),Qn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=U(),n=G(),r=K(),i=Kn();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),$n=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=U(),n=W();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),er=s(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),tr=s(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else (p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),nr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=W(),n=er(),r=tr(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),rr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=qn(),n=Xn(),r=Yn(),i=Xn(),a=Zn(),o=Qn(),s=$n(),c=U(),l=G(),u=nr(),d=W(),f=Kn();function p(e){if(S(e)&&(w(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&A(e),D(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),T(e),j(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(S(e)&&(w(e),x(e))){C(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&A(e),O(e),k(e);let a=r.const(`_errs`,l.default.errors);T(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),E(e)}function T(e,t){if(e.opts.jtd)return ee(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);ee(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function E(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function D(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function O(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function k(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function j(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&M(e),t.return((0,c._)`${l.default.errors} === 0`))}function M({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function ee(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>se(e,`$ref`,h.all.$ref.definition));return}p.jtd||N(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),te(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):te(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function te(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&se(e,n.keyword,n.definition,t.type)})}function N(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(P(e,t),e.opts.allowUnionTypes||F(e,t),ne(e,e.dataTypes))}function P(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{re(e.dataTypes,t)||ae(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),ie(e,t)}}function F(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&ae(e,`use allowUnionTypes to allow union type keyword`)}function ne(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>I(t,e))&&ae(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function I(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function re(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function ie(e,t){let n=[];for(let r of e.dataTypes)re(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function ae(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var oe=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,ue(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=oe;function se(e,t,n,r){let i=new oe(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var ce=/^\/(?:[^~]|~0|~1)*$/,le=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ue(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!ce.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=le.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=ue})),ir=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),ar=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=nr();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),or=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=U(),n=ir(),r=G(),i=nr(),a=W(),o=rr(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),sr=c({$id:()=>cr,additionalProperties:()=>!1,default:()=>pr,description:()=>lr,properties:()=>fr,required:()=>dr,type:()=>ur}),cr,lr,ur,dr,fr,pr,mr=o((()=>{cr=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,lr=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,ur=`object`,dr=[`$data`],fr={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},pr={$id:cr,description:lr,type:ur,required:dr,properties:fr,additionalProperties:!1}})),hr=s(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){let r=i(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function c(e){let t=0,n={error:!1,address:``,zone:``},r=[],a=[],c=!1,l=!1,u=s;for(let i=0;i<e.length;i++){let s=e[i];if(!(s===`[`||s===`]`))if(s===`:`){if(c===!0&&(l=!0),!u(a,r,n))break;if(++t>7){n.error=!0;break}i>0&&e[i-1]===`:`&&(c=!0),r.push(`:`);continue}else if(s===`%`){if(!u(a,r,n))break;u=o}else{a.push(s);continue}}return a.length&&(u===o?n.zone=a.join(``):l?r.push(a.join(``)):r.push(i(a))),n.address=r.join(``),n}function l(e){if(u(e,`:`)<2)return{host:e,isIPV6:!1};let t=c(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function u(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function d(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function f(e,t){let n=t===!0?unescape:escape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function p(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let t=l(n);n=t.isIPV6===!0?`[${t.escapedHost}]`:e.host}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:a,recomposeAuthority:p,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:r,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:i}})),gr=s(((e,t)=>{var{isUUID:n}=hr(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),_r=s(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=hr(),{SCHEMES:c,getSchemeHandler:l}=gr();function u(e,t){return typeof e==`string`?e=m(g(e,t),t):typeof e==`object`&&(e=g(m(e,t),t)),e}function d(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=f(g(e,r),g(t,r),r,!0);return r.skipEscape=!0,m(i,r)}function f(e,t,n,i){let a={};return i||(e=g(m(e,n),n),t=g(m(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t,n){return typeof e==`string`?(e=unescape(e),e=m(a(g(e,n),!0),{...n,skipEscape:!0})):typeof e==`object`&&(e=m(a(e,!0),{...n,skipEscape:!0})),typeof t==`string`?(t=unescape(t),t=m(a(g(t,n),!0),{...n,skipEscape:!0})):typeof t==`object`&&(t=m(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function m(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},a=Object.assign({},t),o=[],s=l(a.scheme||n.scheme);s&&s.serialize&&s.serialize(n,a),n.path!==void 0&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),a.reference!==`suffix`&&n.scheme&&o.push(n.scheme,`:`);let c=i(n);if(c!==void 0&&(a.reference!==`suffix`&&o.push(`//`),o.push(c),n.path&&n.path[0]!==`/`&&o.push(`/`)),n.path!==void 0){let e=n.path;!a.absolutePath&&(!s||!s.absolutePath)&&(e=r(e)),c===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),o.push(e)}return n.query!==void 0&&o.push(`?`,n.query),n.fragment!==void 0&&o.push(`#`,n.fragment),o.join(``)}var h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let c=e.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||``,i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(o(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let t=l(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&a===!1&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}(!t||t&&!t.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&=escape(unescape(i.path)),i.fragment&&=encodeURI(decodeURIComponent(i.fragment))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return i}var _={SCHEMES:c,normalize:u,resolve:d,resolveComponent:f,equal:p,serialize:m,parse:g};t.exports=_,t.exports.default=_,t.exports.fastUri=_})),vr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=_r();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),yr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=rr();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return t.KeywordCxt}});var n=U();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return n.CodeGen}});var r=ir(),i=ar(),a=Jn(),o=or(),s=U(),c=nr(),l=Xn(),u=W(),f=(mr(),d(sr).default),p=vr(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=k(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=D.call(this),e.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(j.call(this,n,t),!t)return(0,u.eachItem)(n,e=>M.call(this,e)),this;te.call(this,t);let r={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,r.type.length===0?e=>M.call(this,e,r):e=>r.type.forEach(t=>M.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=P(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=r.default,x.MissingRefError=i.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function T(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function D(){let e={...this.opts};for(let t of h)delete e[t];return e}var O={log(){},warn(){},error(){}};function k(e){if(e===!1)return O;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var A=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!A.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function M(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?ee.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function ee(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function te(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=P(t)),e.validateSchema=this.compile(t,!0))}var N={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function P(e){return{anyOf:[e,N]}}})),br=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),xr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;var t=ar(),n=K(),r=U(),i=G(),a=or(),o=W(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0)if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}if(l.items!==!0)if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}e.callRef=l,e.default=s})),Sr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=br(),n=xr();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),Cr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),wr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),Tr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),Er=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r=Tr();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),Dr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=W(),r=U();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),Or=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),kr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=U(),r=W();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),Ar=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),jr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=er();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),Mr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Xn(),n=U(),r=W(),i=jr();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),Nr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r=jr();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),Pr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r=jr();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),Fr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Cr(),n=wr(),r=Er(),i=Dr(),a=Or(),o=kr(),s=Ar(),c=Mr(),l=Nr(),u=Pr();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),Ir=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateAdditionalItems=void 0;var t=U(),n=W(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),Lr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;var t=U(),n=W(),r=K(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),Rr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Lr();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),zr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r=K(),i=Ir();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),Br=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),Vr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=U(),n=W(),r=K();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
14
14
  missingProperty: ${i},
15
15
  depsCount: ${n},
16
- deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Hr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Ur=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=W(),r=Gn(),i=G();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Wr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=rr(),n=K(),r=G(),i=Ur();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),Gr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=W(),r=G(),i=G();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),Kr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=G();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),qr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:K().validateUnion,error:{message:`must match a schema in anyOf`}}})),Jr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Yr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=G();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Xr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Zr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=G();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Qr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Ir(),n=Rr(),r=Lr(),i=zr(),a=Br(),o=Vr(),s=Hr(),c=Ur(),l=Wr(),u=Gr(),d=Kr(),f=qr(),p=Jr(),m=Yr(),h=Xr(),g=Zr();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),$r=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),ei=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[$r().default]})),ti=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),ni=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Sr(),n=Fr(),r=Qr(),i=ei(),a=ti();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),ri=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),ii=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=ri(),r=or(),i=ar(),a=G();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),ai=c({$id:()=>si,$schema:()=>oi,default:()=>fi,definitions:()=>li,properties:()=>di,title:()=>ci,type:()=>ui}),oi,si,ci,li,ui,di,fi,pi=o((()=>{oi=`http://json-schema.org/draft-07/schema#`,si=`http://json-schema.org/draft-07/schema#`,ci=`Core schema meta-schema`,li={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},ui=[`object`,`boolean`],di={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},fi={$schema:oi,$id:si,title:ci,definitions:li,type:ui,properties:di,default:!0}})),mi=u(s(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=yr(),r=ni(),i=ii(),a=(pi(),d(ai).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=c;var l=rr();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=W();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var f=ir();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return f.default}});var p=ar();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return p.default}})}))(),1),hi={$schema:`http://json-schema.org/draft-07/schema#`,$id:`https://kmap.dev/schemas/semantic-chart-config/1.0.0`,title:`SemanticChartConfig`,description:`Agent 语义化图表配置`,type:`object`,required:[`version`,`data`],additionalProperties:!1,properties:{version:{type:`string`,pattern:`^[0-9]+\\.[0-9]+\\.[0-9]+$`,description:`semver 版本号`},data:{$ref:`#/$defs/DataConfig`},indicators:{$ref:`#/$defs/IndicatorsConfig`},markers:{$ref:`#/$defs/MarkersConfig`},chart:{$ref:`#/$defs/ChartOptions`},theme:{$ref:`#/$defs/ThemeConfig`}},$defs:{DataConfig:{type:`object`,required:[`source`,`symbol`,`startDate`,`endDate`,`period`,`adjust`],additionalProperties:!1,properties:{source:{type:`string`,enum:[`baostock`,`dongcai`]},symbol:{type:`string`,pattern:`^[0-9]{6}$`},exchange:{type:`string`,enum:[`SH`,`SZ`,`BJ`]},startDate:{type:`string`,format:`date`},endDate:{type:`string`,format:`date`},period:{type:`string`,enum:[`daily`,`weekly`,`monthly`,`5min`,`15min`,`30min`,`60min`]},adjust:{type:`string`,enum:[`qfq`,`hfq`,`none`]}}},IndicatorsConfig:{type:`object`,additionalProperties:!1,properties:{main:{type:`array`,items:{$ref:`#/$defs/MainIndicatorConfig`},maxItems:5},sub:{type:`array`,items:{$ref:`#/$defs/SubIndicatorConfig`},maxItems:5}}},MainIndicatorConfig:{type:`object`,required:[`type`,`enabled`],additionalProperties:!1,properties:{type:{type:`string`,enum:[`MA`,`BOLL`]},enabled:{type:`boolean`},params:{type:`object`}},allOf:[{if:{properties:{type:{const:`MA`}},required:[`type`]},then:{properties:{params:{type:`object`,additionalProperties:!1,properties:{periods:{type:`array`,items:{type:`integer`,minimum:1,maximum:250},minItems:1,maxItems:5}}}}},else:{properties:{params:{type:`object`,additionalProperties:!1,properties:{period:{type:`integer`,minimum:1,maximum:100},multiplier:{type:`number`,minimum:.1,maximum:5}}}}}}]},SubIndicatorConfig:{type:`object`,required:[`type`,`enabled`],additionalProperties:!1,properties:{type:{type:`string`,enum:[`VOLUME`,`MACD`,`RSI`,`CCI`,`STOCH`,`MOM`,`WMSR`,`KST`,`FASTK`]},enabled:{type:`boolean`},params:{type:`object`}},allOf:[{if:{properties:{type:{const:`MACD`}}},then:{properties:{params:{type:`object`,additionalProperties:!1,properties:{fast:{type:`integer`,minimum:1,maximum:50},slow:{type:`integer`,minimum:1,maximum:100},signal:{type:`integer`,minimum:1,maximum:50}}}}}},{if:{properties:{type:{const:`RSI`}}},then:{properties:{params:{type:`object`,additionalProperties:!1,properties:{period1:{type:`integer`,minimum:1,maximum:100},period2:{type:`integer`,minimum:1,maximum:100},period3:{type:`integer`,minimum:1,maximum:100}}}}}}]},MarkersConfig:{type:`object`,additionalProperties:!1,properties:{showVolumePriceMarkers:{type:`boolean`},showExtremaMarkers:{type:`boolean`},customMarkers:{type:`array`,items:{$ref:`#/$defs/CustomMarker`},maxItems:100},legend:{$ref:`#/$defs/LegendConfig`}}},CustomMarker:{type:`object`,required:[`id`,`date`,`shape`],additionalProperties:!1,properties:{id:{type:`string`,maxLength:64},date:{type:`string`,description:`日期时间字符串,日K用 YYYY-MM-DD,分钟K用 YYYY-MM-DD HH:mm`,pattern:`^[0-9]{4}-[0-9]{2}-[0-9]{2}( [0-9]{2}:[0-9]{2})?$`},shape:{type:`string`,enum:[`arrow_up`,`arrow_down`,`flag`,`circle`,`rectangle`,`diamond`]},groupKey:{type:`string`,maxLength:32},offset:{type:`object`,additionalProperties:!1,properties:{x:{type:`number`,minimum:-500,maximum:500},y:{type:`number`,minimum:-500,maximum:500}}},style:{$ref:`#/$defs/MarkerStyle`},label:{$ref:`#/$defs/MarkerLabel`},metadata:{type:`object`,maxProperties:20,additionalProperties:{type:[`string`,`number`,`boolean`,`null`],maxLength:200}}}},MarkerStyle:{type:`object`,additionalProperties:!1,properties:{fillColor:{type:`string`,pattern:`^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$`},strokeColor:{type:`string`,pattern:`^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$`},textColor:{type:`string`,pattern:`^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$`},size:{type:`number`,minimum:4,maximum:50},lineWidth:{type:`number`,minimum:.5,maximum:10},opacity:{type:`number`,minimum:0,maximum:1}}},MarkerLabel:{type:`object`,required:[`text`],additionalProperties:!1,properties:{text:{type:`string`,maxLength:50},position:{type:`string`,enum:[`left`,`right`,`top`,`bottom`,`inside`]},align:{type:`string`,enum:[`start`,`center`,`end`]},fontSize:{type:`number`,minimum:8,maximum:24},offset:{type:`object`,additionalProperties:!1,properties:{x:{type:`number`,minimum:-500,maximum:500},y:{type:`number`,minimum:-500,maximum:500}}}}},LegendConfig:{type:`object`,additionalProperties:!1,properties:{enabled:{type:`boolean`},position:{type:`string`,enum:[`bottom-right`,`bottom-left`,`top-right`,`top-left`]},onClick:{type:`string`,enum:[`highlight`,`toggle`,`none`]}}},ChartOptions:{type:`object`,additionalProperties:!1,properties:{kWidth:{type:`number`,minimum:2,maximum:50},kGap:{type:`number`,minimum:0,maximum:20},autoScrollToRight:{type:`boolean`}}},ThemeConfig:{type:`object`,additionalProperties:!1,properties:{priceUpColor:{type:`string`,pattern:`^#[0-9a-fA-F]{6}$`},priceDownColor:{type:`string`,pattern:`^#[0-9a-fA-F]{6}$`}}}}},gi=[`__proto__`,`constructor`,`prototype`],_i=/^(#[0-9a-fA-F]{3,8}|rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)|rgba\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*[\d.]+\s*\))$/,vi={SH:/^(600|601|603|605|688)\d{3}$/,SZ:/^(000|001|002|003|300|301)\d{3}$/,BJ:/^(83|87|43|82)\d{4}$/};function yi(e){return{"5min":30,"15min":60,"30min":90,"60min":180,daily:365*3,weekly:365*5,monthly:365*10}[e]??365}var bi=(typeof document<`u`?document.createElement(`canvas`):null)?.getContext(`2d`)??null,xi=class e{ajv;limits;constructor(){this.ajv=new mi.default({allErrors:!0,allowUnionTypes:!0}),this.ajv.addFormat(`date`,{type:`string`,validate:e=>/^\d{4}-\d{2}-\d{2}$/.test(e)}),this.ajv.addSchema(hi),this.limits={maxJsonSize:64*1024,maxIndicators:10,maxCustomMarkers:100}}validateRawInput(e){return(typeof TextEncoder<`u`?new TextEncoder().encode(e).byteLength:e.length*3)>this.limits.maxJsonSize?{valid:!1,errors:[`JSON payload too large (max 64KB)`]}:{valid:!0}}validate(e){if(!e||typeof e!=`object`)return{valid:!1,errors:[`Config must be an object`]};let t=this.checkPrototypePollution(e);return t.valid?this.ajv.validate(`https://kmap.dev/schemas/semantic-chart-config/1.0.0`,e)?{valid:!0}:{valid:!1,errors:this.ajv.errors?.map(e=>`${e.instancePath} ${e.message}`)||[`Schema validation failed`]}:t}securityCheck(e){let t=[],n=this.checkDateRange(e.data);n.valid||t.push(...n.errors||[]);let r=this.checkSymbol(e.data);if(r.valid||t.push(...r.errors||[]),e.indicators&&(e.indicators.main?.length||0)+(e.indicators.sub?.length||0)>this.limits.maxIndicators&&t.push(`Too many indicators (max ${this.limits.maxIndicators})`),(e.markers?.customMarkers?.length||0)>this.limits.maxCustomMarkers&&t.push(`Too many custom markers (max ${this.limits.maxCustomMarkers})`),e.markers?.customMarkers)for(let n of e.markers.customMarkers){if(n.style){let e=this.checkMarkerStyle(n.style,n.id);t.push(...e)}let e=this.checkMarkerDate(n.date,n.id);t.push(...e)}return{passed:t.length===0,violations:t.length>0?t:void 0}}checkPrototypePollution(e,t=``){if(!e||typeof e!=`object`)return{valid:!0};let n=[];for(let r of Object.keys(e))gi.includes(r)&&n.push(`Forbidden key "${r}" found at ${t}`);return n.length>0?{valid:!1,errors:n}:{valid:!0}}checkDateRange(e){let t=[],n=new Date(e.startDate),r=new Date(e.endDate);if(isNaN(n.getTime())&&t.push(`Invalid startDate: ${e.startDate}`),isNaN(r.getTime())&&t.push(`Invalid endDate: ${e.endDate}`),t.length>0)return{valid:!1,errors:t};let i=yi(e.period),a=Math.ceil((r.getTime()-n.getTime())/(1e3*60*60*24));return a>i&&t.push(`Date range exceeds maximum for period "${e.period}" (max ${i} days, got ${a})`),a<0&&t.push(`endDate must be after startDate`),t.length>0?{valid:!1,errors:t}:{valid:!0}}checkSymbol(e){let{symbol:t,exchange:n}=e;if(n){if(!vi[n].test(t))return{valid:!1,errors:[`Invalid symbol "${t}" for exchange "${n}"`]}}else if(!Object.values(vi).some(e=>e.test(t)))return{valid:!1,errors:[`Invalid symbol format: "${t}"`]};return{valid:!0}}checkMarkerStyle(e,t){let n=[],r=[`fillColor`,`strokeColor`,`textColor`];for(let i of r){let r=e[i];typeof r==`string`&&!_i.test(r)&&n.push(`Invalid ${i} in marker "${t}": ${r}`)}if(bi)for(let i of r){let r=e[i];typeof r==`string`&&(bi.fillStyle=`#000000`,bi.fillStyle=r,bi.fillStyle===`#000000`&&r!==`#000000`&&!r.startsWith(`#000`)&&n.push(`Potentially unsafe ${i} in marker "${t}": ${r}`))}return n}static DATE_PATTERN=/^\d{4}-\d{2}-\d{2}( \d{2}:\d{2})?$/;checkMarkerDate(t,n){let r=[];if(!e.DATE_PATTERN.test(t))return r.push(`Invalid date format in marker "${n}": ${t} (expected YYYY-MM-DD or YYYY-MM-DD HH:mm)`),r;let i=t.includes(` `),a;if(i)a=new Date(t);else{let[e,n,r]=t.split(`-`).map(Number);a=new Date(Date.UTC(e,n-1,r))}return isNaN(a.getTime())&&r.push(`Invalid date value in marker "${n}": ${t}`),r}},Si=class{chart;validator;events;constructor(e){this.chart=e,this.validator=new xi,this.events=new p}async applyConfig(e){let t=this.validator.validate(e);if(!t.valid)return{success:!1,errors:t.errors};let n=this.validator.securityCheck(e);if(!n.passed)return{success:!1,errors:n.violations};this.events.emit(`config:loading`,void 0);try{return await this.doApplyConfig(e),this.events.emit(`config:ready`,void 0),{success:!0}}catch(e){return this.events.emit(`config:error`,e),{success:!1,errors:[e instanceof Error?e.message:String(e)]}}}on(e,t){this.events.on(e,t)}off(e,t){this.events.off(e,t)}async doApplyConfig(e){console.log(`[Semantic] doApplyConfig start, data config:`,e.data);let t=await Hn(e.data.source,{symbol:e.data.symbol,startDate:e.data.startDate,endDate:e.data.endDate,period:e.data.period,adjust:e.data.adjust});console.log(`[Semantic] fetched data:`,t.length,`items`),this.chart.updateData(t),e.indicators&&(console.log(`[Semantic] applying indicators:`,e.indicators),this.applyIndicators(e.indicators.main,e.indicators.sub)),e.markers&&(console.log(`[Semantic] applying markers:`,e.markers.customMarkers?.length,`markers`),this.applyMarkers(e.markers.customMarkers,e.data.period)),e.chart&&this.applyChartOptions(e.chart),console.log(`[Semantic] doApplyConfig done`)}applyIndicators(e,t){if(e){for(let t of e)if(t.enabled)switch(t.type){case`MA`:this.applyMAIndicator(t);break;case`BOLL`:this.applyBOLLIndicator(t);break;case`EXPMA`:this.applyEXPMAIndicator(t);break;case`ENE`:this.applyENEIndicator(t);break}}if(this.chart.clearSubPanes(),t)for(let e of t)this.applySubIndicator(e)}applyMAIndicator(e){let t=e.params?.periods||[5,10,20,30,60],n={};for(let e of t)e===5?n.ma5=!0:e===10?n.ma10=!0:e===20?n.ma20=!0:e===30?n.ma30=!0:e===60&&(n.ma60=!0);console.log(`[Semantic] applyMAIndicator, periods:`,t,`maFlags:`,n),this.chart.updateRendererConfig(`ma`,n)}applyBOLLIndicator(e){let t={period:e.params?.period||20,multiplier:e.params?.multiplier||2};this.chart.updateRendererConfig(`boll`,t)}applyEXPMAIndicator(e){let t={fastPeriod:e.params?.fastPeriod||12,slowPeriod:e.params?.slowPeriod||50};this.chart.updateRendererConfig(`expma`,t)}applyENEIndicator(e){let t={period:e.params?.period||10,deviation:e.params?.deviation||11};this.chart.updateRendererConfig(`ene`,t)}applySubIndicator(e){if(!e.enabled)return;let{type:t,params:n}=e;this.chart.createSubPane(t,n)||console.warn(`[Semantic] Failed to create sub pane for ${t}`)}applyMarkers(e,t){if(!e||e.length===0){this.chart.clearCustomMarkers();return}let n=e.map(e=>({id:e.id,date:e.date,timestamp:Ci(e.date,t||`daily`),shape:e.shape,groupKey:e.groupKey,offset:e.offset,style:e.style,label:e.label,metadata:e.metadata}));this.chart.updateCustomMarkers(n)}applyChartOptions(e){e.autoScrollToRight}};function Ci(e,t){if(e.includes(` `)){let[t,n]=e.split(` `),r=t.split(`-`).map(Number),i=r[0],a=r[1],o=r[2],s=n.split(`:`).map(Number),c=s[0],l=s[1];return Date.UTC(i,a-1,o,c-8,l,0,0)}else{let t=e.split(`-`).map(Number),n=t[0],r=t[1],i=t[2];return Date.UTC(n,r-1,i,-8,0,0,0)}}var wi={arrow_up:16,arrow_down:16,flag:14,circle:12,rectangle:14,diamond:12};function Ti(e,t,n,r,i,a){let o=a.fillColor||`#000000`,s=a.strokeColor||o,c=i||wi[t];switch(e.fillStyle=o,e.strokeStyle=s,e.lineWidth=a.lineWidth||1,a.opacity!==void 0&&(e.globalAlpha=a.opacity),t){case`arrow_up`:Ai(e,n,r,c);break;case`arrow_down`:ji(e,n,r,c);break;case`circle`:Mi(e,n,r,c);break;case`rectangle`:Ni(e,n,r,c);break;case`diamond`:Pi(e,n,r,c);break;case`flag`:Fi(e,n,r,c);break}e.globalAlpha=1}var Ei=2.5,Di=4;function Oi(e,t,n,r,i,a,o=!1){let s=t.fontSize||12,c=a.textColor||`#333333`,l=i/2;e.font=`${s}px sans-serif`,e.fillStyle=c,e.textBaseline=`middle`;let u=i*Ei,d=ki(e,t.text,u),f=e.measureText(d).width,p=n,m=r;switch(t.position){case`left`:p=n-l-f/2-Di;break;case`right`:p=n+l+f/2+Di;break;case`top`:m=r-l-s/2-Di;break;case`bottom`:m=r+l+s/2+Di;break;default:m=o?r-l-s/2-Di:r+l+s/2+Di;break}t.offset&&(p+=t.offset.x||0,m+=t.offset.y||0),e.textAlign=t.align||`center`,e.fillText(d,p,m)}function ki(e,t,n){if(e.measureText(t).width<=n)return t;let r=e.measureText(`…`).width,i=0,a=t.length;for(;i<a;){let o=Math.ceil((i+a)/2),s=t.slice(0,o);e.measureText(s).width+r<=n?i=o:a=o-1}return t.slice(0,i)+`…`}function Ai(e,t,n,r){e.beginPath(),e.moveTo(t,n-r/2),e.lineTo(t-r/2,n+r/2),e.lineTo(t+r/2,n+r/2),e.closePath(),e.fill()}function ji(e,t,n,r){e.beginPath(),e.moveTo(t,n+r/2),e.lineTo(t-r/2,n-r/2),e.lineTo(t+r/2,n-r/2),e.closePath(),e.fill()}function Mi(e,t,n,r){e.beginPath(),e.arc(t,n,r/2,0,Math.PI*2),e.fill()}function Ni(e,t,n,r){e.fillRect(t-r/2,n-r/2,r,r)}function Pi(e,t,n,r){e.beginPath(),e.moveTo(t,n-r/2),e.lineTo(t+r/2,n),e.lineTo(t,n+r/2),e.lineTo(t-r/2,n),e.closePath(),e.fill()}function Fi(e,t,n,r){e.beginPath(),e.moveTo(t-r/4,n+r/2),e.lineTo(t-r/4,n-r/2),e.stroke(),e.beginPath(),e.moveTo(t-r/4,n-r/2),e.lineTo(t+r/2,n-r/4),e.lineTo(t-r/4,n),e.closePath(),e.fill()}function Ii(e,t,n,r,i,a){let o=a/2;switch(n){case`circle`:let n=e-r,a=t-i;return n*n+a*a<=o*o;default:return e>=r-o&&e<=r+o&&t>=i-o&&t<=i+o}}var Li=function(e){return e.Registered=`registered`,e.Installed=`installed`,e.Error=`error`,e}({});function Ri(e){return{id:e.id,top:e.top,height:e.height,yAxis:{priceToY:t=>e.yAxis.priceToY(t),yToPrice:t=>e.yAxis.yToPrice(t),getPaddingTop:()=>e.yAxis.getPaddingTop(),getPaddingBottom:()=>e.yAxis.getPaddingBottom(),getPriceOffset:()=>e.yAxis.getPriceOffset()},priceRange:e.priceRange}}var zi=Symbol(`global-pane`),q={SYSTEM_YAXIS:-20,SYSTEM_XAXIS:-20,BACKGROUND:0,GRID:10,INDICATOR:30,MAIN:50,OVERLAY:80,FOREGROUND:100,SYSTEM_BORDER:120,SYSTEM_CROSSHAIR:150},Bi=class{plugins=new Map;register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);let n={plugin:e,config:{enabled:!0,priority:0,...t},state:`registered`};return this.plugins.set(e.name,n),n}unregister(e){return this.plugins.delete(e)}get(e){return this.plugins.get(e)}getPlugin(e){return this.plugins.get(e)?.plugin}getAll(){return Array.from(this.plugins.values())}getEnabled(){return this.getAll().filter(e=>e.config?.enabled!==!1)}updateState(e,t,n){let r=this.plugins.get(e);r&&(r.state=t,n&&(r.error=n))}has(e){return this.plugins.has(e)}clear(){this.plugins.clear()}},Vi=class{hooks=new Map;tap(e,t,n=0){this.hooks.has(e)||this.hooks.set(e,[]);let r=this.hooks.get(e);r.push({name:e,fn:t,priority:n}),r.sort((e,t)=>e.priority-t.priority)}untap(e,t){let n=this.hooks.get(e);if(n){let e=n.findIndex(e=>e.fn===t);e!==-1&&n.splice(e,1)}}async call(e,t){let n=this.hooks.get(e);if(!n||n.length===0)return[];let r=[];for(let{fn:i}of n)try{let e=await i(t);r.push(e)}catch(t){console.error(`[HookSystem] Error in hook "${e}":`,t)}return r}callSync(e,t){let n=this.hooks.get(e);if(!n||n.length===0)return[];let r=[];for(let{fn:i}of n)try{let e=i(t);r.push(e)}catch(t){console.error(`[HookSystem] Error in hook "${e}":`,t)}return r}clear(){this.hooks.clear()}hookCount(e){return this.hooks.get(e)?.length??0}},Hi=class{configs=new Map;defaults=new Map;registerDefaults(e,t){this.defaults.set(e,{...t}),this.configs.has(e)||this.configs.set(e,new Map);let n=this.configs.get(e);for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r)}get(e,t,n){let r=this.configs.get(e);if(r?.has(t))return r.get(t);let i=this.defaults.get(e);return i&&t in i?i[t]:n}set(e,t,n){this.configs.has(e)||this.configs.set(e,new Map),this.configs.get(e).set(t,n)}setAll(e,t){for(let[n,r]of Object.entries(t))this.set(e,n,r)}getAll(e){let t=this.configs.get(e);return{...this.defaults.get(e)||{},...t?Object.fromEntries(t):{}}}clear(e){e?this.configs.delete(e):this.configs.clear()}},Ui=class{registry;eventBus;hookSystem;configManager;isDestroyed=!1;constructor(){this.registry=new Bi,this.eventBus=new p,this.hookSystem=new Vi,this.configManager=new Hi}events={on:(e,t)=>{this.eventBus.on(e,t)},off:(e,t)=>{this.eventBus.off(e,t)},emit:(e,t)=>{this.eventBus.emit(e,t)},once:(e,t)=>{this.eventBus.once(e,t)}};hooks={tap:(e,t,n=0)=>{this.hookSystem.tap(e,t,n)},untap:(e,t)=>{this.hookSystem.untap(e,t)},call:async(e,t)=>this.hookSystem.call(e,t),callSync:(e,t)=>this.hookSystem.callSync(e,t)};getConfig(e,t,n){return this.configManager.get(e,t,n)}setConfig(e,t,n){this.configManager.set(e,t,n)}getPlugin(e){return this.registry.getPlugin(e)}log(e,t,...n){let r=`[${new Date().toISOString()}] [${e.toUpperCase()}]`;console[e](`${r} ${t}`,...n)}async use(e,t){if(this.ensureNotDestroyed(),this.registry.has(e.name))throw Error(`Plugin "${e.name}" is already installed`);try{let n=this.registry.register(e,t);t&&this.configManager.setAll(e.name,t),await this.hooks.call(`plugin:beforeInstall`,{plugin:e,config:t}),await e.install(this,n.config),this.registry.updateState(e.name,`installed`),await this.hooks.call(`plugin:afterInstall`,{plugin:e,config:t}),this.log(`info`,`Plugin "${e.name}" installed successfully`)}catch(t){throw this.registry.updateState(e.name,`error`,t instanceof Error?t:Error(String(t))),this.log(`error`,`Failed to install plugin "${e.name}":`,t),t}}async remove(e){this.ensureNotDestroyed();let t=this.registry.get(e);if(!t)throw Error(`Plugin "${e}" is not installed`);try{await this.hooks.call(`plugin:beforeUninstall`,{name:e}),t.plugin.uninstall&&await t.plugin.uninstall(),this.registry.unregister(e),this.configManager.clear(e),await this.hooks.call(`plugin:afterUninstall`,{name:e}),this.log(`info`,`Plugin "${e}" removed successfully`)}catch(t){throw this.log(`error`,`Failed to remove plugin "${e}":`,t),t}}getPlugins(){return this.registry.getAll()}getState(e){return this.registry.get(e)?.state}async destroy(){if(!this.isDestroyed){for(let e of this.registry.getAll())try{e.plugin.uninstall&&await e.plugin.uninstall()}catch(t){this.log(`error`,`Error uninstalling "${e.plugin.name}":`,t)}this.registry.clear(),this.eventBus.clear(),this.hookSystem.clear(),this.configManager.clear(),this.isDestroyed=!0,this.log(`info`,`PluginHost destroyed`)}}ensureNotDestroyed(){if(this.isDestroyed)throw Error(`PluginHost has been destroyed`)}};function Wi(){return new Ui}var Gi=Symbol(`renderer:global-cache`),Ki=class{plugins=new Map;pluginHost=null;enabledState=new Map;groupCache=new Map;mergedCache=new Map;knownPaneIds=new Set([`main`]);cacheInvalid=!0;onInvalidate=null;setInvalidateCallback(e){this.onInvalidate=e}setPluginHost(e){this.pluginHost=e}addKnownPaneId(e){this.knownPaneIds.add(e),this.cacheInvalid=!0}removeKnownPaneId(e){this.knownPaneIds.delete(e),this.cacheInvalid=!0}getKnownPaneIds(){return Array.from(this.knownPaneIds)}register(e){if(this.plugins.has(e.name)){console.warn(`Renderer plugin "${e.name}" already registered`);return}this.plugins.set(e.name,e),e.enabled!==void 0&&this.enabledState.set(e.name,e.enabled),this.cacheInvalid=!0;let t=e;if(t.onInstall&&this.pluginHost)try{t.onInstall(this.pluginHost)}catch(t){console.error(`[RendererPlugin] ${e.name} onInstall error:`,t)}this.onInvalidate?.()}unregister(e){let t=this.plugins.get(e);if(t){if(t.onUninstall)try{t.onUninstall()}catch(e){console.error(`[RendererPlugin] ${t.name} onUninstall error:`,e)}this.plugins.delete(e),this.enabledState.delete(e),this.cacheInvalid=!0,this.onInvalidate?.()}}clear(){for(let e of this.plugins.values())if(e.onUninstall)try{e.onUninstall()}catch(t){console.error(`[RendererPlugin] ${e.name} onUninstall error:`,t)}this.plugins.clear(),this.enabledState.clear(),this.groupCache.clear(),this.mergedCache.clear(),this.cacheInvalid=!1}mergeSorted(e,t){let n=[],r=0,i=0;for(;r<e.length&&i<t.length;)e[r].priority<=t[i].priority?n.push(e[r++]):n.push(t[i++]);return[...n,...e.slice(r),...t.slice(i)]}rebuildCache(){if(!this.cacheInvalid)return;this.groupCache.clear(),this.mergedCache.clear();for(let e of this.plugins.values()){let t=typeof e.paneId==`symbol`?Gi:e.paneId;this.groupCache.has(t)||this.groupCache.set(t,[]),this.groupCache.get(t).push(e)}for(let[,e]of this.groupCache)e.sort((e,t)=>e.priority-t.priority);let e=this.groupCache.get(Gi)??[];for(let t of this.knownPaneIds){let n=this.groupCache.get(t)??[],r=this.mergeSorted(n,e);this.mergedCache.set(t,r)}this.mergedCache.set(Gi,[...e]),this.cacheInvalid=!1}getRenderers(e){this.rebuildCache();let t=this.mergedCache.get(e);return t||(t=this.mergedCache.get(Gi)??[],this.mergedCache.set(e,t)),t.filter(e=>{if(e.isSystem)return!1;let t=this.enabledState.get(e.name);return t===void 0?e.enabled!==!1:t})}render(e,t){let n=this.getRenderers(e),r=[];for(let e of n)try{e.draw(t)}catch(n){let i=n instanceof Error?n:Error(String(n));console.error(`[RendererPlugin] ${e.name} draw error:`,i),r.push({name:e.name,error:{message:i.message,stack:i.stack},paneId:t.pane.id,timestamp:Date.now()})}return r}renderPlugin(e,t){let n=this.plugins.get(e);if(!n)return[];let r=this.enabledState.get(e);if(!(r===void 0?n.enabled!==!1:r))return[];let i=[];try{n.draw(t)}catch(n){let r=n instanceof Error?n:Error(String(n));console.error(`[RendererPlugin] ${e} draw error:`,r),i.push({name:e,error:{message:r.message,stack:r.stack},paneId:t.pane.id,timestamp:Date.now()})}return i}setEnabled(e,t){this.plugins.has(e)&&(this.enabledState.set(e,t),this.onInvalidate?.())}updateConfig(e,t){let n=this.plugins.get(e);return n?.setConfig?(n.setConfig(t),this.onInvalidate?.(),!0):!1}getAllPlugins(){return Array.from(this.plugins.values())}getPlugin(e){return this.plugins.get(e)}notifyDataUpdate(e,t){for(let n of this.plugins.values()){if(!n.onDataUpdate)continue;let r=this.enabledState.get(n.name);if(r===void 0?n.enabled!==!1:r)try{n.onDataUpdate(e,t)}catch(e){console.error(`[RendererPlugin] ${n.name} onDataUpdate error:`,e)}}}notifyResize(e,t){let n=this.getRenderers(e);for(let e of n)if(e.onResize)try{e.onResize(t)}catch(t){console.error(`[RendererPlugin] ${e.name} onResize error:`,t)}}},qi=1.2,Ji=24,Yi=6;function Xi(e){switch(e){case`arrow_up`:case`flag`:return!0;default:return!1}}function Zi(){return{name:`customMarkers`,version:`1.0.0`,description:`自定义标记渲染器`,debugName:`自定义标记`,paneId:`main`,priority:q.OVERLAY,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,kLinePositions:s,markerManager:c}=e;if(!c)return;let l=c.getCustomMarkers();if(!l||l.length===0)return;let u=r;if(u.length&&n.id===`main`){t.save(),t.translate(-a,0);for(let e of l){let r=$i(u,e.timestamp);if(r===-1||r<i.start||r>=i.end)continue;let l=r-i.start;if(l<0||l>=s.length)continue;let d=s[l]+o/2,f=u[r],p=e.style?.size,m=Qi(o,p),h=(e.offset?.y??0)<0?!0:(e.offset?.y??0)>0?!1:Xi(e.shape),g;g=h?n.yAxis.priceToY(f.high)-m/2-4+(e.offset?.y??0):n.yAxis.priceToY(f.low)+m/2+4+(e.offset?.y??0);let _=d+(e.offset?.x??0),v=g;Ti(t,e.shape,_,v,m,e.style||{}),e.label&&Oi(t,e.label,_,v,m,e.style||{},h),c.setCustomMarkerPosition(e.id,_-a,v,m,e.shape)}t.restore()}}}}function Qi(e,t){let n=e*qi;return Math.max(Yi,Math.min(n,t??Ji))}function $i(e,t){let n=0,r=e.length-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=e[i]?.timestamp;if(a===void 0)break;if(a===t)return i;a<t?n=i+1:r=i-1}return-1}function ea(e){let t=new Intl.DateTimeFormat(`zh-CN`,{timeZone:`Asia/Shanghai`,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(new Date(e)).reduce((e,t)=>(t.type!==`literal`&&(e[t.type]=t.value),e),{});return`${t.year}-${t.month}-${t.day}`}function ta(e){let t=new Date(e),n=t.getFullYear(),r=t.getMonth()+1;return r===1?{text:String(n),isYear:!0}:{text:`${r}月`,isYear:!1}}function na(e){let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}`}var ra=ea,ia=ea;function aa(e){if(e.length===0)return[];let t=[0],n=na(e[0].timestamp);for(let r=1;r<e.length;r++){let i=e[r];if(!i)continue;let a=na(i.timestamp);a!==n&&(t.push(r),n=a)}return t}var oa={PRIMARY:`hsl(210, 9%, 31%)`,SECONDARY:`hsl(210, 9%, 35%)`,TERTIARY:`hsl(210, 8%, 50%)`,WEAK:`hsl(210, 7%, 65%)`,WHITE:`rgba(255, 255, 255, 0.92)`},J={UP:`rgba(214, 10, 34, 1)`,UP_LIGHT:`rgba(214, 10, 34, 0.92)`,UP_TICK:`hsl(0, 60%, 50%)`,DOWN:`rgba(3, 123, 102, 1)`,DOWN_LIGHT:`rgba(3, 123, 102, 0.92)`,DOWN_TICK:`hsl(150, 30%, 60%)`,NEUTRAL:`rgba(0, 0, 0, 0.78)`,LAST_PRICE:`rgb(183, 22, 22)`},sa={WHITE:`rgb(255, 255, 255)`,LIGHT_GRAY:`rgba(255, 255, 255, 0.92)`,PURE_WHITE:`#ffffff`,TRANSPARENT:`transparent`,ACTIVE:`#1890ff`,ACTIVE_HOVER:`#40a9ff`,HOVER:`#f0f0f0`},ca={DARK:`rgba(0, 0, 0, 0.12)`,MEDIUM:`rgba(0, 0, 0, 0.10)`,LIGHT:`rgba(0, 0, 0, 0.08)`,SEPARATOR:`rgba(0, 0, 0, 0.10)`,BUTTON:`#d0d0d0`},la={HORIZONTAL:`rgba(0, 0, 0, 0.06)`,VERTICAL:`rgba(0, 0, 0, 0.12)`},Y={MA5:`rgba(255, 193, 37, 1)`,MA10:`rgba(190, 131, 12, 1)`,MA20:`rgba(69, 112, 249, 1)`,MA30:`rgba(76, 175, 80, 1)`,MA60:`rgba(156, 39, 176, 1)`},ua={UPPER:`rgba(178, 34, 34, 1)`,MIDDLE:`rgba(69, 112, 249, 1)`,LOWER:`rgba(34, 139, 34, 1)`,BAND_FILL:`rgba(100, 149, 237, 0.1)`},X={DIF:`rgba(69, 112, 249, 1)`,DEA:`rgba(255, 152, 0, 1)`,BAR_UP:`#ff5252`,BAR_UP_LIGHT:`#fccbcd`,BAR_DOWN:`#22ab94`,BAR_DOWN_LIGHT:`#ace5dc`},da={RSI1:`rgba(69, 112, 249, 1)`,RSI2:`rgba(255, 152, 0, 1)`,RSI3:`rgba(156, 39, 176, 1)`},fa={CCI:`rgba(69, 112, 249, 1)`,OVERBOUGHT:`rgba(214, 10, 34, 0.5)`,OVERSOLD:`rgba(3, 123, 102, 0.5)`},pa={K:`rgba(69, 112, 249, 1)`,D:`rgba(255, 152, 0, 1)`,J:`rgba(156, 39, 176, 1)`},ma={MOM:`rgba(69, 112, 249, 1)`,ZERO:`rgba(0, 0, 0, 0.2)`},ha={WMSR:`rgba(69, 112, 249, 1)`,OVERBOUGHT:`rgba(214, 10, 34, 0.5)`,OVERSOLD:`rgba(3, 123, 102, 0.5)`},ga={KST:`rgba(69, 112, 249, 1)`,SIGNAL:`rgba(255, 152, 0, 1)`},_a={FAST:`rgba(255, 152, 0, 1)`,SLOW:`rgba(69, 112, 249, 1)`},va={UPPER:`rgba(214, 10, 34, 1)`,MIDDLE:`rgba(69, 112, 249, 1)`,LOWER:`rgba(3, 123, 102, 1)`,BAND_FILL:`rgba(69, 112, 249, 0.08)`},ya={LINE:`rgba(0, 0, 0, 0.28)`,LABEL_BG:`rgb(0, 0, 0)`,LABEL_TEXT:`rgba(255, 255, 255, 0.92)`},ba=J.UP,xa=J.DOWN,Sa=J.NEUTRAL;function Ca(e){return e>0?ba:e<0?xa:Sa}function wa(e,t=2){let n=Math.abs(e);return n>=1e8?`${(e/1e8).toFixed(t)}亿`:n>=1e4?`${(e/1e4).toFixed(t)}万`:`${Math.round(e)}`}function Ta(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}`}function Ea(e,t=2){return`${e.toFixed(t)}%`}function Da(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}%`}function Oa(e,t){let n=t?.close??e.open;return Ca(e.open-n)}function ka(e){return Ca(e.close-e.open)}function Aa(e){return typeof e.changePercent==`number`?Ca(e.changePercent):typeof e.changeAmount==`number`?Ca(e.changeAmount):Sa}var ja={class:`kline-tooltip__title`},Ma={key:0},Na={class:`kline-tooltip__grid`},Pa={class:`row`},Fa={class:`row`},Ia={class:`row`},La={class:`row`},Ra={key:0,class:`row`},za={key:1,class:`row`},Ba={key:2,class:`row`},Va={key:3,class:`row`},Ha={key:4,class:`row`},Ua={key:5,class:`row`},Wa=(0,f.defineComponent)({__name:`KLineTooltip`,props:{k:{},index:{},data:{},pos:{},setEl:{type:Function}},setup(e){let t=e;function n(e){t.setEl?.(e)}let r=(0,f.computed)(()=>{let e=t.k;if(!e)return Sa;let n=t.index;return Oa(e,typeof n==`number`&&n>0?t.data[n-1]:void 0)}),i=(0,f.computed)(()=>{let e=t.k;return e?ka(e):Sa}),a=(0,f.computed)(()=>{let e=t.k;return e?Aa(e):Sa});return(t,o)=>e.k?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,ref:n,class:`kline-tooltip`,style:(0,f.normalizeStyle)({left:`${e.pos.x}px`,top:`${e.pos.y}px`})},[(0,f.createElementVNode)(`div`,ja,[e.k.stockCode?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Ma,(0,f.toDisplayString)(e.k.stockCode),1)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(ra)(e.k.timestamp)),1)]),(0,f.createElementVNode)(`div`,Na,[(0,f.createElementVNode)(`div`,Pa,[o[0]||=(0,f.createElementVNode)(`span`,null,`开`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:r.value})},(0,f.toDisplayString)(e.k.open.toFixed(2)),5)]),(0,f.createElementVNode)(`div`,Fa,[o[1]||=(0,f.createElementVNode)(`span`,null,`高`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(e.k.high.toFixed(2)),1)]),(0,f.createElementVNode)(`div`,Ia,[o[2]||=(0,f.createElementVNode)(`span`,null,`低`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(e.k.low.toFixed(2)),1)]),(0,f.createElementVNode)(`div`,La,[o[3]||=(0,f.createElementVNode)(`span`,null,`收`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:i.value})},(0,f.toDisplayString)(e.k.close.toFixed(2)),5)]),typeof e.k.volume==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ra,[o[4]||=(0,f.createElementVNode)(`span`,null,`成交量`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(wa)(e.k.volume)),1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.turnover==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,za,[o[5]||=(0,f.createElementVNode)(`span`,null,`成交额`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(wa)(e.k.turnover)),1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.amplitude==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ba,[o[6]||=(0,f.createElementVNode)(`span`,null,`振幅`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(e.k.amplitude)+`%`,1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.changePercent==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Va,[o[7]||=(0,f.createElementVNode)(`span`,null,`涨跌幅`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:a.value})},(0,f.toDisplayString)((0,f.unref)(Da)(e.k.changePercent)),5)])):(0,f.createCommentVNode)(``,!0),typeof e.k.changeAmount==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ha,[o[8]||=(0,f.createElementVNode)(`span`,null,`涨跌额`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:a.value})},(0,f.toDisplayString)((0,f.unref)(Ta)(e.k.changeAmount)),5)])):(0,f.createCommentVNode)(``,!0),typeof e.k.turnoverRate==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ua,[o[9]||=(0,f.createElementVNode)(`span`,null,`换手率`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(Ea)(e.k.turnoverRate)),1)])):(0,f.createCommentVNode)(``,!0)])],4)):(0,f.createCommentVNode)(``,!0)}}),Ga=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ka=Ga(Wa,[[`__scopeId`,`data-v-95daa55c`]]),qa={RISE_WITH_VOLUME:`量价齐升`,RISE_WITHOUT_VOLUME:`量缩价升`,FALL_WITH_VOLUME:`量价齐缩`,FALL_WITHOUT_VOLUME:`量升价缩`},Ja=class{markers=new Map;hoveredMarkerId=null;lastHoveredId=null;customMarkers=new Map;customMarkerPositions=new Map;clear(){this.markers.clear()}register(e){this.markers.set(e.id,e)}getState(e){return this.hoveredMarkerId===e?`hovered`:`normal`}hitTest(e,t,n=3){for(let r of this.markers.values())if(e>=r.x-n&&e<=r.x+r.width+n&&t>=r.y-n&&t<=r.y+r.height+n)return r;return null}setHover(e){this.hoveredMarkerId=e,this.lastHoveredId=e}validateHoverState(){this.hoveredMarkerId!==null&&!this.markers.has(this.hoveredMarkerId)&&(this.hoveredMarkerId=null)}getHoveredMarker(){return this.hoveredMarkerId===null?null:this.markers.get(this.hoveredMarkerId)||null}getLastHoverId(){return this.lastHoveredId}getAllMarkers(){return Array.from(this.markers.values())}registerCustomMarker(e){this.customMarkers.set(e.id,e)}setCustomMarkers(e){this.clearCustomMarkers();for(let t of e)this.customMarkers.set(t.id,t)}clearCustomMarkers(){this.customMarkers.clear(),this.customMarkerPositions.clear()}getCustomMarkers(){return Array.from(this.customMarkers.values())}setCustomMarkerPosition(e,t,n,r,i){this.customMarkerPositions.set(e,{x:t,y:n,size:r,shape:i})}hitTestCustomMarker(e,t){for(let n of this.customMarkers.values()){let r=this.customMarkerPositions.get(n.id);if(r&&Ii(e,t,r.shape,r.x,r.y,r.size))return n}return null}},Ya={class:`marker-tooltip__title`},Xa={key:0,class:`marker-tooltip__content`},Za=Ga((0,f.defineComponent)({__name:`MarkerTooltip`,props:{marker:{},pos:{}},setup(e){let t=e,n=(0,f.computed)(()=>t.marker&&`date`in t.marker),r=(0,f.computed)(()=>{if(!t.marker)return``;if(n.value){let e=t.marker;return e.label?.text||e.shape}let e=t.marker;return qa[e.markerType]||e.markerType}),i=(0,f.computed)(()=>{if(!t.marker)return{};if(n.value){let e=t.marker;return{日期:e.date,...e.metadata}}return t.marker.metadata}),a=(0,f.computed)(()=>Object.keys(i.value).length>0);function o(e){return typeof e==`number`?e.toFixed(2):String(e)}return(t,n)=>e.marker?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:`marker-tooltip`,style:(0,f.normalizeStyle)({left:`${e.pos.x+12}px`,top:`${e.pos.y+12}px`})},[(0,f.createElementVNode)(`div`,Ya,(0,f.toDisplayString)(r.value),1),a.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Xa,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(i.value,(e,t)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:t,class:`row`},[(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(t),1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(o(e)),1)]))),128))])):(0,f.createCommentVNode)(``,!0)],4)):(0,f.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-dd43da4f`]]),Qa={class:`params-header`},$a={class:`header-left`},eo={class:`params-title`},to={class:`header-right`},no={key:0,class:`indicator-description`},ro={class:`params-body`},io={class:`param-header`},ao={class:`param-label`},oo={class:`param-label-text`},so={key:0,class:`param-range`},co={class:`input-wrapper`},lo=[`disabled`,`onClick`],uo=[`value`,`min`,`max`,`step`,`onInput`],fo=[`disabled`,`onClick`],po={key:0,class:`param-description`},mo={class:`params-footer`},ho={class:`footer-right`},go=Ga((0,f.defineComponent)({__name:`IndicatorParams`,props:{visible:{type:Boolean},indicatorId:{},indicatorName:{},indicatorDescription:{},params:{},values:{}},emits:[`close`,`confirm`],setup(e,{emit:t}){let n=e,r=t,i=(0,f.ref)({...n.values}),a=(0,f.ref)(!0);(0,f.watch)(()=>n.values,e=>{i.value={...e}},{deep:!0,immediate:!0}),(0,f.watch)(()=>n.visible,e=>{e&&(i.value={...n.values})});function o(e,t){let n=t.target,r=parseFloat(n.value);isNaN(r)||(i.value[e]=r)}function s(e,t){let n=e.step||1,r=(i.value[e.key]||0)+t*n;e.min!==void 0&&(r=Math.max(e.min,r)),e.max!==void 0&&(r=Math.min(e.max,r)),i.value[e.key]=parseFloat(r.toFixed(10))}function c(){let e={};n.params.forEach(t=>{e[t.key]=t.default??n.values[t.key]??0}),i.value=e}function l(){r(`confirm`,{...i.value})}return(t,n)=>((0,f.openBlock)(),(0,f.createBlock)(f.Teleport,{to:`body`},[(0,f.createVNode)(f.Transition,{name:`overlay`},{default:(0,f.withCtx)(()=>[e.visible?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:`params-overlay`,onClick:n[4]||=e=>t.$emit(`close`)},[(0,f.createVNode)(f.Transition,{name:`modal`},{default:(0,f.withCtx)(()=>[(0,f.createElementVNode)(`div`,{class:`indicator-params`,onClick:n[3]||=(0,f.withModifiers)(()=>{},[`stop`])},[(0,f.createElementVNode)(`div`,Qa,[(0,f.createElementVNode)(`div`,$a,[(0,f.createElementVNode)(`span`,eo,(0,f.toDisplayString)(e.indicatorName),1),n[5]||=(0,f.createElementVNode)(`span`,{class:`params-subtitle`},`参数设置`,-1)]),(0,f.createElementVNode)(`div`,to,[(0,f.createElementVNode)(`button`,{class:(0,f.normalizeClass)([`toggle-desc-btn`,{active:a.value}]),onClick:n[0]||=e=>a.value=!a.value,title:`显示/隐藏说明`},[...n[6]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 1024 1024`},[(0,f.createElementVNode)(`path`,{d:`M512 97.52381c228.912762 0 414.47619 185.563429 414.47619 414.47619s-185.563429 414.47619-414.47619 414.47619S97.52381 740.912762 97.52381 512 283.087238 97.52381 512 97.52381z m0 73.142857C323.486476 170.666667 170.666667 323.486476 170.666667 512s152.81981 341.333333 341.333333 341.333333 341.333333-152.81981 341.333333-341.333333S700.513524 170.666667 512 170.666667z m36.571429 268.190476v292.571428h-73.142858V438.857143h73.142858z m0-121.904762v73.142857h-73.142858v-73.142857h73.142858z`,fill:`currentColor`})],-1)]],2),(0,f.createElementVNode)(`button`,{class:`params-close`,onClick:n[1]||=e=>t.$emit(`close`)},[...n[7]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},[(0,f.createElementVNode)(`path`,{d:`M18 6L6 18M6 6l12 12`})],-1)]])])]),(0,f.createVNode)(f.Transition,{name:`slide`},{default:(0,f.withCtx)(()=>[a.value&&e.indicatorDescription?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,no,[(0,f.createElementVNode)(`p`,null,(0,f.toDisplayString)(e.indicatorDescription),1)])):(0,f.createCommentVNode)(``,!0)]),_:1}),(0,f.createElementVNode)(`div`,ro,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(e.params,e=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:e.key,class:(0,f.normalizeClass)([`param-item`,{"has-desc":a.value&&e.description}])},[(0,f.createElementVNode)(`div`,io,[(0,f.createElementVNode)(`label`,ao,[(0,f.createElementVNode)(`span`,oo,(0,f.toDisplayString)(e.label),1),e.min!==void 0||e.max!==void 0?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,so,(0,f.toDisplayString)(e.min??`-∞`)+` ~ `+(0,f.toDisplayString)(e.max??`+∞`),1)):(0,f.createCommentVNode)(``,!0)]),(0,f.createElementVNode)(`div`,co,[(0,f.createElementVNode)(`button`,{class:`stepper-btn`,disabled:e.min!==void 0&&(i.value[e.key]??0)<=e.min,onClick:t=>s(e,-1)},` − `,8,lo),e.type===`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`input`,{key:0,type:`number`,class:`param-input`,value:i.value[e.key],min:e.min,max:e.max,step:e.step||1,onInput:t=>o(e.key,t)},null,40,uo)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`button`,{class:`stepper-btn`,disabled:e.max!==void 0&&(i.value[e.key]??0)>=e.max,onClick:t=>s(e,1)},` + `,8,fo)])]),(0,f.createVNode)(f.Transition,{name:`slide`},{default:(0,f.withCtx)(()=>[a.value&&e.description?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,po,(0,f.toDisplayString)(e.description),1)):(0,f.createCommentVNode)(``,!0)]),_:2},1024)],2))),128))]),(0,f.createElementVNode)(`div`,mo,[(0,f.createElementVNode)(`button`,{class:`params-btn reset`,onClick:c},[...n[8]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},[(0,f.createElementVNode)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,f.createElementVNode)(`path`,{d:`M3 3v5h5`})],-1),(0,f.createTextVNode)(` 重置 `,-1)]]),(0,f.createElementVNode)(`div`,ho,[(0,f.createElementVNode)(`button`,{class:`params-btn cancel`,onClick:n[2]||=e=>t.$emit(`close`)},`取消`),(0,f.createElementVNode)(`button`,{class:`params-btn confirm`,onClick:l},[...n[9]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`},[(0,f.createElementVNode)(`path`,{d:`M20 6L9 17l-5-5`})],-1),(0,f.createTextVNode)(` 确定 `,-1)]])])])])]),_:1})])):(0,f.createCommentVNode)(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-730f2212`]]),_o={class:`indicator-selector`},vo={class:`indicator-scroll-container`},yo={class:`indicator-list`},bo=[`onMouseenter`],xo={class:`btn-content`},So={key:0,class:`param-hint`},Co={key:0,class:`hover-overlay`},wo=[`onClick`],To={key:1,class:`divider`},Eo=[`onClick`],Do={class:`indicator-item`},Oo={class:`menu-section`},ko={class:`menu-items`},Ao=[`disabled`,`onClick`],jo={key:0,class:`param-hint`},Mo={key:1,class:`active-tag`},No={class:`menu-section`},Po={class:`menu-items`},Fo=[`disabled`,`onClick`],Io={key:0,class:`param-hint`},Lo={key:1,class:`active-tag`},Ro=Ga((0,f.defineComponent)({__name:`IndicatorSelector`,props:{activeIndicators:{},indicatorParams:{}},emits:[`toggle`,`updateParams`],setup(e,{emit:t}){let n=[{id:`MA`,label:`MA`,name:`均线`,pane:`main`},{id:`BOLL`,label:`BOLL`,name:`布林带`,pane:`main`,description:`布林带由三条轨道线组成,用于判断价格的波动范围和趋势强度。价格触及上轨可能超买,触及下轨可能超卖。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:20,description:`计算移动平均线的周期数,周期越长轨道越平滑`},{key:`multiplier`,label:`倍数`,type:`number`,min:.1,max:5,step:.1,default:2,description:`标准差倍数,决定轨道宽度,通常为 2`}]},{id:`EXPMA`,label:`EXPMA`,name:`指数平滑移动平均线`,pane:`main`,description:`EXPMA 对近期价格给予更高权重,比普通 MA 更敏感。快线上穿慢线为金叉看涨,下穿为死叉看跌。`,params:[{key:`fastPeriod`,label:`快线`,type:`number`,min:2,max:100,step:1,default:12,description:`快线周期,对价格变化更敏感`},{key:`slowPeriod`,label:`慢线`,type:`number`,min:2,max:200,step:1,default:50,description:`慢线周期,用于判断趋势方向`}]},{id:`ENE`,label:`ENE`,name:`轨道线`,pane:`main`,description:`ENE 轨道线由三条轨道组成,价格突破上轨可能超买,突破下轨可能超卖,适合判断震荡行情的买卖点。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:10,description:`计算中轨的周期数`},{key:`deviation`,label:`偏离率`,type:`number`,min:1,max:30,step:.5,default:11,description:`轨道偏离率百分比,决定轨道宽度`}]},{id:`MACD`,label:`MACD`,name:`指数平滑异同移动平均线`,pane:`sub`,description:`MACD 通过快慢均线的交叉判断趋势方向和动量。DIF 上穿 DEA 为金叉看涨,下穿为死叉看跌。`,params:[{key:`fastPeriod`,label:`快线`,type:`number`,min:2,max:50,step:1,default:12,description:`快线 EMA 周期,对价格变化更敏感`},{key:`slowPeriod`,label:`慢线`,type:`number`,min:2,max:100,step:1,default:26,description:`慢线 EMA 周期,用于计算 DIF`},{key:`signalPeriod`,label:`信号`,type:`number`,min:2,max:50,step:1,default:9,description:`DEA 的 EMA 周期,用于生成买卖信号`}]},{id:`RSI`,label:`RSI`,name:`相对强弱指标`,pane:`sub`,description:`RSI 衡量价格变动的速度和幅度,判断超买超卖状态。RSI > 70 超买,RSI < 30 超卖。`,params:[{key:`period1`,label:`周期 1`,type:`number`,min:2,max:100,step:1,default:6,description:`第一条 RSI 周期,通常为 6(快线)`},{key:`period2`,label:`周期 2`,type:`number`,min:2,max:100,step:1,default:12,description:`第二条 RSI 周期,通常为 12(中线)`},{key:`period3`,label:`周期 3`,type:`number`,min:2,max:100,step:1,default:24,description:`第三条 RSI 周期,通常为 24(慢线)`}]},{id:`CCI`,label:`CCI`,name:`顺势指标`,pane:`sub`,description:`CCI 衡量价格与统计平均值的偏离程度。CCI > 100 超买,CCI < -100 超卖,适合捕捉趋势反转。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:14,description:`计算周期,周期越短信号越灵敏`}]},{id:`STOCH`,label:`STOCH`,name:`随机指标`,pane:`sub`,description:`KDJ 随机指标通过比较收盘价与价格区间判断超买超卖。K > 80 超买,K < 20 超卖,K 上穿 D 金叉。`,params:[{key:`n`,label:`K 周期`,type:`number`,min:2,max:100,step:1,default:9,description:`计算 K 值的周期,统计 N 日内价格区间`},{key:`m`,label:`D 周期`,type:`number`,min:1,max:50,step:1,default:3,description:`D 值是 K 的 M 日移动平均,使信号更平滑`}]},{id:`MOM`,label:`MOM`,name:`动量指标`,pane:`sub`,description:`动量指标衡量价格变化的速度,MOM > 0 表示上涨动能,MOM < 0 表示下跌动能。适合判断趋势强度。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:10,description:`与多少日前价格比较,周期越短越灵敏`}]},{id:`WMSR`,label:`WMSR`,name:`威廉指标`,pane:`sub`,description:`威廉指标衡量超买超卖程度,范围为 -100 到 0。WMSR > -20 超买,WMSR < -80 超卖。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:14,description:`回溯周期,统计周期内最高最低价`}]},{id:`KST`,label:`KST`,name:`确然指标`,pane:`sub`,description:`KST 综合多个 ROC 判断长期趋势,KST 上穿信号线看涨,下穿看跌。适合捕捉主要趋势转换。`,params:[{key:`roc1`,label:`ROC1`,type:`number`,min:2,max:100,step:1,default:10,description:`短期变化率周期`},{key:`roc2`,label:`ROC2`,type:`number`,min:2,max:100,step:1,default:15,description:`中短期变化率周期`},{key:`roc3`,label:`ROC3`,type:`number`,min:2,max:100,step:1,default:20,description:`中长期变化率周期`},{key:`roc4`,label:`ROC4`,type:`number`,min:2,max:100,step:1,default:30,description:`长期变化率周期`},{key:`signalPeriod`,label:`信号`,type:`number`,min:2,max:50,step:1,default:9,description:`信号线的 SMA 周期`}]},{id:`FASTK`,label:`FASTK`,name:`快速随机指标`,pane:`sub`,description:`FASTK 是未经过平滑处理的随机指标,比普通 KDJ 更敏感,能更快捕捉价格转折点,但假信号也更多。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:9,description:`计算周期,周期越短越敏感`}]}],r=n.filter(e=>e.pane===`main`),i=n.filter(e=>e.pane===`sub`),a=e,o=t,s=(0,f.ref)(null),c=(0,f.ref)(null),l=(0,f.ref)(!1),u=(0,f.ref)(null),d=(0,f.ref)(null),p=(0,f.ref)(!1),m=(0,f.ref)({left:`0`,bottom:`0`}),h=(0,f.computed)(()=>a.activeIndicators?.length?a.activeIndicators.map(e=>n.find(t=>t.id===e)).filter(e=>e!==void 0):[]),g=(0,f.computed)(()=>u.value&&n.find(e=>e.id===u.value)||null);function _(e){return a.activeIndicators?.includes(e)??!1}function v(e){if(_(e))return;let t=n.find(t=>t.id===e);t&&(t.pane===`main`&&n.filter(t=>t.pane===`main`&&t.id!==e&&_(t.id)).forEach(e=>o(`toggle`,e.id,!1)),o(`toggle`,e,!0),p.value=!1)}function y(e){o(`toggle`,e,!1)}function b(e){u.value=e,l.value=!0}function x(e){let t=n.find(t=>t.id===e);if(!t?.params)return{};let r={};for(let e of t.params)r[e.key]=e.default??e.min??1;let i=a.indicatorParams?.[e]||{},o={...r};for(let[e,t]of Object.entries(i))typeof t==`number`&&(o[e]=t);return o}function S(e){let t=x(e.id);return e.params?e.params.map(e=>t[e.key]??``).join(`,`):``}function C(e){u.value&&o(`updateParams`,u.value,e),l.value=!1}function w(){if(!p.value&&s.value){let e=s.value.getBoundingClientRect(),t=window.innerWidth,n=e.left+e.width/2;n+160>t-8&&(n=t-160-8),n-160<8&&(n=168),m.value={left:`${n}px`,bottom:`${window.innerHeight-e.top+8}px`}}p.value=!p.value}function T(e){let t=c.value&&!c.value.contains(e.target),n=s.value&&!s.value.contains(e.target);t&&n&&(p.value=!1)}function E(){p.value&&=!1}return(0,f.onMounted)(()=>{document.addEventListener(`click`,T),window.addEventListener(`resize`,E)}),(0,f.onUnmounted)(()=>{document.removeEventListener(`click`,T),window.removeEventListener(`resize`,E)}),(e,t)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,_o,[(0,f.createElementVNode)(`div`,vo,[(0,f.createElementVNode)(`div`,yo,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(h.value,e=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:e.id,class:`indicator-item`},[(0,f.createElementVNode)(`div`,{class:`indicator-btn-wrapper`,onMouseenter:t=>d.value=e.id,onMouseleave:t[0]||=e=>d.value=null},[(0,f.createElementVNode)(`button`,{class:(0,f.normalizeClass)([`indicator-btn`,{active:!0,hovering:d.value===e.id}])},[(0,f.createElementVNode)(`span`,xo,[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,So,` (`+(0,f.toDisplayString)(S(e))+`) `,1)):(0,f.createCommentVNode)(``,!0)]),(0,f.createVNode)(f.Transition,{name:`fade`},{default:(0,f.withCtx)(()=>[d.value===e.id?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Co,[e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:0,class:`action-btn settings-btn`,onClick:(0,f.withModifiers)(t=>b(e.id),[`stop`]),title:`编辑参数`},[...t[2]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z`})],-1)]],8,wo)):(0,f.createCommentVNode)(``,!0),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,To)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`button`,{class:`action-btn remove-btn`,onClick:(0,f.withModifiers)(t=>y(e.id),[`stop`]),title:`移除指标`},[...t[3]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`})],-1)]],8,Eo)])):(0,f.createCommentVNode)(``,!0)]),_:2},1024)],2)],40,bo)]))),128)),(0,f.createElementVNode)(`div`,Do,[(0,f.createElementVNode)(`button`,{ref_key:`addBtnRef`,ref:s,class:`add-btn`,onClick:w,title:`添加指标`},[...t[4]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z`})],-1)]],512)])])]),((0,f.openBlock)(),(0,f.createBlock)(f.Teleport,{to:`body`},[(0,f.createVNode)(f.Transition,{name:`slide`},{default:(0,f.withCtx)(()=>[p.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:`add-menu`,ref_key:`addMenuRef`,ref:c,style:(0,f.normalizeStyle)(m.value)},[(0,f.createElementVNode)(`div`,Oo,[t[6]||=(0,f.createElementVNode)(`div`,{class:`menu-title`},`主图指标`,-1),(0,f.createElementVNode)(`div`,ko,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)((0,f.unref)(r),e=>((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:e.id,class:(0,f.normalizeClass)([`menu-item`,{disabled:_(e.id)}]),disabled:_(e.id),onClick:t=>v(e.id)},[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,jo,` (`+(0,f.toDisplayString)(e.name)+`) `,1)):(0,f.createCommentVNode)(``,!0),_(e.id)?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Mo,[...t[5]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`})],-1)]])):(0,f.createCommentVNode)(``,!0)],10,Ao))),128))])]),(0,f.createElementVNode)(`div`,No,[t[8]||=(0,f.createElementVNode)(`div`,{class:`menu-title`},`副图指标`,-1),(0,f.createElementVNode)(`div`,Po,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)((0,f.unref)(i),e=>((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:e.id,class:(0,f.normalizeClass)([`menu-item`,{disabled:_(e.id)}]),disabled:_(e.id),onClick:t=>v(e.id)},[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Io,` (`+(0,f.toDisplayString)(e.name)+`) `,1)):(0,f.createCommentVNode)(``,!0),_(e.id)?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Lo,[...t[7]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`})],-1)]])):(0,f.createCommentVNode)(``,!0)],10,Fo))),128))])])],4)):(0,f.createCommentVNode)(``,!0)]),_:1})])),g.value?((0,f.openBlock)(),(0,f.createBlock)(go,{key:0,visible:l.value,"indicator-id":g.value.id,"indicator-name":g.value.name,"indicator-description":g.value.description,params:g.value.params||[],values:x(g.value.id),onClose:t[1]||=e=>l.value=!1,onConfirm:C},null,8,[`visible`,`indicator-id`,`indicator-name`,`indicator-description`,`params`,`values`])):(0,f.createCommentVNode)(``,!0)]))}}),[[`__scopeId`,`data-v-aad3b750`]]);function zo(e,t){let n=Math.round(e*t);return n%2==0&&(n+=1),Math.max(1,n)}function Bo(e,t,n){let r=zo(e,n),i=Math.round(t*n),a=r+i,o=i;return{kWidthPx:r,kGapPx:i,unitPx:a,startXPx:o,kWidthLogical:r/n,kGapLogical:i/n,unitLogical:a/n,startXLogical:o/n}}function Vo(e,t,n,r,i,a=1){let{unitPx:o,startXPx:s}=Bo(n,r,a),c=e*a,l=t*a;return{start:Math.max(0,Math.floor((c-s)/o)-1),end:Math.min(i,Math.ceil((c+l-s)/o)+1)}}function Ho(e,t,n){let r=-1/0,i=1/0;for(let a=t;a<n&&a<e.length;a++){let t=e[a];t&&(t.high>r&&(r=t.high),t.low<i&&(i=t.low))}return!Number.isFinite(r)||!Number.isFinite(i)?{maxPrice:100,minPrice:0}:{maxPrice:r,minPrice:i}}var Uo=class{range={maxPrice:100,minPrice:0};height=1;paddingTop=0;paddingBottom=0;priceOffset=0;setRange(e){this.range=e}setHeight(e){this.height=Math.max(1,e)}setPadding(e,t){this.paddingTop=Math.max(0,e),this.paddingBottom=Math.max(0,t)}getRange(){return this.range}getPaddingTop(){return this.paddingTop}getPaddingBottom(){return this.paddingBottom}setPriceOffset(e){this.priceOffset=e}getPriceOffset(){return this.priceOffset}resetPriceOffset(){this.priceOffset=0}priceToY(e){let{maxPrice:t,minPrice:n}=this.range,r=e-this.priceOffset,i=t-n||1,a=(r-n)/i,o=Math.max(1,this.height-this.paddingTop-this.paddingBottom);return this.paddingTop+o*(1-a)}yToPrice(e){let{maxPrice:t,minPrice:n}=this.range,r=t-n||1,i=Math.max(1,this.height-this.paddingTop-this.paddingBottom);return n+(1-(e-this.paddingTop)/i)*r+this.priceOffset}deltaYToPriceOffset(e){return e*((this.range.maxPrice-this.range.minPrice||1)/Math.max(1,this.height-this.paddingTop-this.paddingBottom))}},Wo=class{id;top=0;height=0;priceRange={maxPrice:100,minPrice:0};yAxis=new Uo;renderers=[];constructor(e){this.id=e}setLayout(e,t){this.top=e,this.height=Math.max(1,t),this.yAxis.setHeight(this.height)}setPadding(e,t){this.yAxis.setPadding(e,t)}addRenderer(e){this.renderers.push(e)}updateRange(e,t){this.priceRange=Ho(e,t.start,t.end),this.yAxis.setRange(this.priceRange)}},Go=class{chart;isDragging=!1;dragStartX=0;scrollStartX=0;dragStartY=0;activePaneIdOnDrag=null;isTouchSession=!1;crosshairPos=null;crosshairIndex=null;crosshairPrice=null;hoveredIndex=null;activePaneId=null;tooltipPos={x:0,y:0};tooltipSize={width:220,height:180};hoveredMarkerId=null;clickedMarkerId=null;hoveredMarkerData=null;clickedMarkerData=null;onMarkerHoverCallback;onMarkerClickCallback;hoveredCustomMarker=null;onCustomMarkerHoverCallback;onCustomMarkerClickCallback;kLinePositions=null;visibleRange=null;kWidthPx=null;constructor(e){this.chart=e}onWheel(e){let t=this.chart.getDom().container,n=t.getBoundingClientRect(),r=e.clientX-n.left,i=t.scrollLeft;this.clearHover(),this.chart.zoomAt(r,i,e.deltaY)}onPointerDown(e){if(e.isPrimary===!1)return;this.isTouchSession=e.pointerType===`touch`;let t=this.chart.getDom().container,n=t.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top,a=t.scrollLeft,o=this.chart.getMarkerManager(),s=a+r,c=o.hitTest(s,i,3);if(c){this.clickedMarkerId=c.id,this.clickedMarkerData=c,this.onMarkerClickCallback&&this.onMarkerClickCallback(c);return}let l=this.chart.getPaneRenderers().find(e=>{let t=e.getPane();return i>=t.top&&i<=t.top+t.height})?.getPane()||null;this.isDragging=!0,this.updateHoverFromPoint(e.clientX,e.clientY),this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.scrollStartX=t.scrollLeft,this.activePaneIdOnDrag=l?.id||null,this.chart.scheduleDraw()}setTooltipSize(e){this.tooltipSize=e}onPointerUp(e){e.isPrimary!==!1&&(this.isDragging=!1)}onPointerLeave(e){e.isPrimary!==!1&&(this.isDragging=!1,this.isTouchSession=!1,this.clearHover(),this.chart.scheduleDraw())}onMouseDown(e){if(this.isTouchSession||e.button!==0)return;let t=this.chart.getDom().container,n=t.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top,a=t.scrollLeft,o=this.chart.getMarkerManager(),s=a+r,c=o.hitTest(s,i,3);if(c){this.clickedMarkerId=c.id,this.onMarkerClickCallback&&this.onMarkerClickCallback(c);return}let l=this.chart.getPaneRenderers().find(e=>{let t=e.getPane();return i>=t.top&&i<=t.top+t.height})?.getPane()||null;this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.scrollStartX=t.scrollLeft,this.activePaneIdOnDrag=l?.id||null,this.updateHoverFromPoint(e.clientX,e.clientY),this.chart.scheduleDraw(),e.preventDefault()}onMouseMove(e){if(this.isTouchSession)return;let t=this.chart.getDom().container;if(this.isDragging){let n=this.dragStartX-e.clientX;t.scrollLeft=this.scrollStartX+n;let r=e.clientY-this.dragStartY;r!==0&&this.activePaneIdOnDrag&&(this.chart.translatePrice(this.activePaneIdOnDrag,r),this.dragStartY=e.clientY);return}this.updateHover(e),this.chart.scheduleDraw()}onMouseUp(){this.isTouchSession||(this.isDragging=!1)}onMouseLeave(){this.isTouchSession||(this.isDragging=!1,this.clearHover(),this.chart.scheduleDraw())}onScroll(){this.kLinePositions=null,this.visibleRange=null,this.clearHover(),this.chart.scheduleDraw()}onPointerMove(e){if(!e.isPrimary)return;e.pointerType===`touch`&&(this.isTouchSession=!0);let t=this.chart.getDom().container;if(this.isDragging){let n=this.dragStartX-e.clientX;t.scrollLeft=this.scrollStartX+n;let r=e.clientY-this.dragStartY;r!==0&&this.activePaneIdOnDrag&&(this.chart.translatePrice(this.activePaneIdOnDrag,r),this.dragStartY=e.clientY);return}this.updateHoverFromPoint(e.clientX,e.clientY),this.chart.scheduleDraw()}setKLinePositions(e,t,n){this.kLinePositions=e,this.visibleRange=t,n!==void 0&&(this.kWidthPx=n)}isDraggingState(){return this.isDragging}setOnMarkerHover(e){this.onMarkerHoverCallback=e}setOnMarkerClick(e){this.onMarkerClickCallback=e}setOnCustomMarkerHover(e){this.onCustomMarkerHoverCallback=e}setOnCustomMarkerClick(e){this.onCustomMarkerClickCallback=e}clearHover(){this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=null,this.hoveredMarkerId!==null&&(this.hoveredMarkerId=null,this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null)),this.hoveredCustomMarker!==null&&(this.hoveredCustomMarker=null,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(null))}updateHover(e){this.updateHoverFromPoint(e.clientX,e.clientY)}updateHoverFromPoint(e,t){let n=this.chart.getDom().container,r=n.getBoundingClientRect(),i=e-r.left,a=t-r.top,o=this.chart.getOption(),s=Math.max(1,Math.round(r.width)),c=Math.max(1,Math.round(r.height)),l=s-o.rightAxisWidth-(o.priceLabelWidth||60),u=c-o.bottomAxisHeight;if(i<0||a<0||i>l||a>u){this.clearHover();return}let d=n.scrollLeft,f=window.devicePixelRatio||1,p=this.chart.getMarkerManager(),m=d+i,h=p.hitTest(m,a,3);if(h){this.hoveredMarkerId!==h.id&&(this.hoveredMarkerId=h.id,this.hoveredMarkerData=h,p.setHover(h.id),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(h)),this.crosshairPos=null,this.crosshairIndex=null,this.hoveredIndex=null;return}else this.hoveredMarkerId!==null&&(this.hoveredMarkerId=null,this.hoveredMarkerData=null,p.setHover(null),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null));let g=p.hitTestCustomMarker(i,a);if(g){this.hoveredCustomMarker?.id!==g.id&&(this.hoveredCustomMarker=g,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(g)),this.crosshairPos=null,this.crosshairIndex=null,this.hoveredIndex=null;return}else this.hoveredCustomMarker!==null&&(this.hoveredCustomMarker=null,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(null));if(!this.kLinePositions||!this.visibleRange||!this.kWidthPx){this.clearHover();return}let _=this.kWidthPx/f,v=0,y=this.kLinePositions.length;for(;v<y;){let e=v+y>>1;this.kLinePositions[e]<m?v=e+1:y=e}let b=v;if(v>0&&v<this.kLinePositions.length){let e=this.kLinePositions[v-1]+_/2,t=this.kLinePositions[v]+_/2;Math.abs(m-e)<Math.abs(m-t)&&(b=v-1)}else v===this.kLinePositions.length&&this.kLinePositions.length>0&&(b=this.kLinePositions.length-1);let x=b+this.visibleRange.start,S=this.chart.getData(),C=this.chart.getPaneRenderers().find(e=>{let t=e.getPane();return a>=t.top&&a<=t.top+t.height})?.getPane()||null;if(this.activePaneId=C?.id||null,x>=0&&x<(S?.length??0)){this.crosshairIndex=x;let e=this.kLinePositions[b]+(this.kWidthPx-1)/2/f-d;if(this.crosshairPos={x:Math.min(Math.max(e,0),l),y:Math.min(Math.max(a,0),u)},C){let e=a-C.top;this.crosshairPrice=C.yAxis.yToPrice(e)}else this.crosshairPrice=null}else this.crosshairIndex=null,this.crosshairPos=null,this.crosshairPrice=null;let w=typeof this.crosshairIndex==`number`?S[this.crosshairIndex]:void 0;if(!w||!C||C.id!==`main`){this.hoveredIndex=null;return}let T=a-C.top,E=C.yAxis.priceToY(w.open),D=C.yAxis.priceToY(w.close),O=C.yAxis.priceToY(w.high),k=C.yAxis.priceToY(w.low),A=Math.min(E,D),j=Math.max(E,D),M=m-this.kLinePositions[b],ee=_/2,N=Math.abs(j-A),P=N<8?(A+j)/2-8/2:A,F=N<8?(A+j)/2+8/2:j,I=T>=P&&T<=F&&M>=0&&M<=_,te=Math.abs(M-ee)<=3&&T>=O&&T<=k;if(!I&&!te){this.hoveredIndex=null;return}this.hoveredIndex=this.crosshairIndex;let L=this.tooltipSize.width,ne=this.tooltipSize.height,re=i+14,ie=i-14-L,ae=re+L+12<=s?re:ie,oe=a+14,se=Math.max(12,s-L-12),ce=Math.max(12,c-ne-12);this.tooltipPos={x:Math.min(Math.max(ae,12),se),y:Math.min(Math.max(oe,12),ce)}}reset(){this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.scrollStartX=0,this.activePaneIdOnDrag=null,this.isTouchSession=!1,this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=null,this.hoveredMarkerId=null,this.clickedMarkerId=null,this.hoveredMarkerData=null,this.clickedMarkerData=null,this.kLinePositions=null,this.visibleRange=null,this.kWidthPx=null}},Ko=class{dom;pane;opt;constructor(e,t,n){this.dom=e,this.pane=t,this.opt={...n,priceLabelWidth:n.priceLabelWidth||60}}getPane(){return this.pane}getDom(){return this.dom}resize(e,t,n){let r=this.dom.plotCanvas,i=this.dom.yAxisCanvas;r.style.width=`${e}px`,r.style.height=`${t}px`,r.width=Math.round(e*n),r.height=Math.round(t*n);let a=this.opt.rightAxisWidth+(this.opt.priceLabelWidth||60);i.style.width=`${a}px`,i.style.height=`${t}px`,i.width=Math.round(a*n),i.height=Math.round(t*n)}destroy(){}};function qo(e={}){let{paneId:t=`sub`}=e;return{name:`volume_${t}`,version:`1.0.0`,description:`成交量渲染器`,debugName:`成交量`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,kGap:s,kLinePositions:c}=e,l=r;if(!l.length)return;t.save(),t.translate(-a,0);let{start:u,end:d}=i,f=l.slice(u,d).reduce((e,t)=>t.volume?Math.max(e,t.volume):e,0);for(let e=u;e<d;e++){let r=l[e];if(!r)continue;let i=r.volume;if(!i)continue;let a=Yo(r),d=c[e-u];d&&Jo(t,d,a,i,f,o,s,n.height)}t.restore()}}}function Jo(e,t,n,r,i,a,o,s){let c=Xo(r,i,s),l=a;e.fillStyle=n,e.fillRect(t,c,l,s-c)}function Yo(e){return e.close>e.open?J.UP:e.close<e.open?J.DOWN:J.NEUTRAL}function Xo(e,t,n){return n-n/t*e}function Z(e,t){return Math.round(e*t)/t}function Q(e,t){return(Math.floor(e*t)+.5)/t}function Zo(e,t,n,r){if(t===n)return null;let i=Math.min(t,n),a=Math.max(t,n),o=Math.round(e*r),s=Math.round(i*r),c=Math.round(a*r);return{x:o/r,y:s/r,width:1/r,height:Math.max(1,c-s)/r}}function Qo(e,t,n,r){if(e===t)return null;let i=Math.min(e,t),a=Math.max(e,t),o=Math.round(i*r),s=Math.round(a*r),c=Math.round(n*r);return{x:o/r,y:c/r,width:Math.max(1,s-o)/r,height:1/r}}function $o(e,t,n,r,i){let a=e+n,o=n,s=Math.round(t*i),c=Math.round((t+r)*i),l=Math.max(1,c-s),u=e+(n-1)/2,d=u,f=o%2==1;return{bodyRect:{x:e/i,y:s/i,width:n/i,height:l/i},physBodyLeft:e,physBodyRight:a,physBodyWidth:o,physBodyCenter:d,physWickX:u,wickRect:{x:u/i,width:1/i},isPerfectlyAligned:f}}function es(e,t){let n=Array(e.length);if(e.length<t)return n;let r=0;for(let i=0;i<t;i++){let t=e[i];if(!t)return n;r+=t.close}n[t-1]=r/t;for(let i=t;i<e.length;i++){let a=e[i-t],o=e[i];!a||!o||(r=r-a.close+o.close,n[i]=r/t)}return n}function ts(e={}){let t={ma5:!0,ma10:!0,ma20:!0,ma30:!0,ma60:!0,...e},n=new Map,r=null;function i(e,t){let i=n.get(t);if(i&&r===e)return i.values;let a=es(e,t);return n.set(t,{period:t,values:a}),r=e,a}function a(e,t,n,r){let{pane:i,range:a,kWidth:o,dpr:s,kLinePositions:c}=n;e.strokeStyle=r,e.lineWidth=1,e.lineJoin=`round`,e.lineCap=`round`,e.beginPath();let l=!0;for(let n=a.start;n<a.end&&n<t.length;n++){let r=t[n];if(r===void 0)continue;let u=c[n-a.start]+o/2,d=i.yAxis.priceToY(r),f=Q(u,s),p=Q(d,s);l?(e.moveTo(f,p),l=!1):e.lineTo(f,p)}e.stroke()}return{name:`ma`,version:`1.0.0`,description:`MA均线渲染器`,debugName:`MA均线`,paneId:`main`,priority:q.INDICATOR,draw(e){let{ctx:n,data:r,scrollLeft:o}=e,s=r;s.length&&(n.save(),n.translate(-o,0),t.ma5&&a(n,i(s,5),e,Y.MA5),t.ma10&&a(n,i(s,10),e,Y.MA10),t.ma20&&a(n,i(s,20),e,Y.MA20),t.ma30&&a(n,i(s,30),e,Y.MA30),t.ma60&&a(n,i(s,60),e,Y.MA60),n.restore())},onDataUpdate(){r=null,n.clear()},getConfig(){return{...t}},setConfig(e){Object.assign(t,e)}}}function ns(e,t,n){let r=Array(e.length);if(e.length<t)return r;let i=0,a=[];for(let n=0;n<t;n++){let t=e[n];if(!t)return r;let o=t.close;a.push(o),i+=o}for(let o=t-1;o<e.length;o++){let s=e[o];if(!s)continue;if(o>=t){let e=a.shift();e!==void 0&&(i-=e);let t=s.close;a.push(t),i+=t}let c=i/t,l=0;for(let e=0;e<t;e++){let t=a[e];t!==void 0&&(l+=(t-c)**2)}let u=Math.sqrt(l/t);r[o]={upper:c+n*u,middle:c,lower:c-n*u}}return r}function rs(e={}){let t={period:20,multiplier:2,showUpper:!0,showMiddle:!0,showLower:!0,showBand:!0,...e},n=null,r=0,i=0,a=[];function o(e){return(n!==e||r!==t.period||i!==t.multiplier)&&(a=ns(e,t.period,t.multiplier),n=e,r=t.period,i=t.multiplier),a}return{name:`boll`,version:`1.0.0`,description:`布林带渲染器`,debugName:`BOLL布林带`,paneId:`main`,priority:q.INDICATOR,draw(e){let{ctx:n,pane:r,data:i,range:a,scrollLeft:s,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<t.period)return;let f=o(d);n.save(),n.translate(-s,0);let p=Math.max(a.start,t.period-1),m=Math.min(a.end,d.length);if(t.showBand){n.fillStyle=ua.BAND_FILL,n.beginPath();let e=!0;for(let t=p;t<m;t++){let i=f[t];if(!i)continue;let o=u[t-a.start]+c/2,s=r.yAxis.priceToY(i.upper),d=Q(o,l),p=Q(s,l);e?(n.moveTo(d,p),e=!1):n.lineTo(d,p)}for(let e=m-1;e>=p;e--){let t=f[e];if(!t)continue;let i=u[e-a.start]+c/2,o=r.yAxis.priceToY(t.lower),s=Q(i,l),d=Q(o,l);n.lineTo(s,d)}n.closePath(),n.fill()}n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`;let h=(e,t)=>{n.strokeStyle=t,n.beginPath();let i=!0;for(let t=p;t<m;t++){let o=f[t];if(!o)continue;let s=u[t-a.start]+c/2,d=r.yAxis.priceToY(o[e]),p=Q(s,l),m=Q(d,l);i?(n.moveTo(p,m),i=!1):n.lineTo(p,m)}n.stroke()};t.showUpper&&h(`upper`,ua.UPPER),t.showMiddle&&h(`middle`,ua.MIDDLE),t.showLower&&h(`lower`,ua.LOWER),n.restore()},onDataUpdate(){n=null},getConfig(){return{...t}},setConfig(e){`period`in e&&e.period!==t.period&&(n=null),`multiplier`in e&&e.multiplier!==t.multiplier&&(n=null),Object.assign(t,e)}}}function is(e,t,n=20,r=2){if(t<n-1||t>=e.length)return null;let i=0;for(let r=0;r<n;r++){let n=e[t-r];if(!n)return null;i+=n.close}let a=i/n,o=0;for(let r=0;r<n;r++){let n=e[t-r];if(!n)return null;o+=(n.close-a)**2}let s=Math.sqrt(o/n);return{upper:a+r*s,middle:a,lower:a-r*s}}function as(e,t,n){let r=Array(e.length);if(e.length===0)return r;let i=2/(t+1),a=2/(n+1),o=e[0].close,s=o,c=o;r[0]={fast:s,slow:c};for(let t=1;t<e.length;t++){let n=e[t].close;s=n*i+s*(1-i),c=n*a+c*(1-a),r[t]={fast:s,slow:c}}return r}function os(e,t,n=12,r=50){if(t<0||t>=e.length)return null;let i=2/(n+1),a=2/(r+1),o=e[0].close,s=o,c=o;for(let n=1;n<=t;n++){let t=e[n].close;s=t*i+s*(1-i),c=t*a+c*(1-a)}return{fast:s,slow:c}}function ss(e={}){let t={fastPeriod:12,slowPeriod:50,...e},n=null,r=0,i=0,a=[];function o(e){return(n!==e||r!==t.fastPeriod||i!==t.slowPeriod)&&(a=as(e,t.fastPeriod,t.slowPeriod),n=e,r=t.fastPeriod,i=t.slowPeriod),a}return{name:`expma`,version:`1.0.0`,description:`EXPMA 指数平滑移动平均线渲染器`,debugName:`EXPMA`,paneId:`main`,priority:q.INDICATOR,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:s,dpr:c,kLinePositions:l}=e,u=r;if(u.length<2)return;let d=o(u);t.save(),t.translate(-a,0);let f=i.start,p=Math.min(i.end,u.length),m=_a.FAST,h=_a.SLOW,g=(e,r)=>{t.strokeStyle=r,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let a=!0;for(let r=f;r<p;r++){let o=d[r];if(!o)continue;let u=l[r-i.start]+s/2,f=n.yAxis.priceToY(o[e]),p=Q(u,c),m=Q(f,c);a?(t.moveTo(p,m),a=!1):t.lineTo(p,m)}t.stroke()};g(`fast`,m),g(`slow`,h),t.restore()},onDataUpdate(){n=null},getConfig(){return{...t}},setConfig(e){`fastPeriod`in e&&e.fastPeriod!==t.fastPeriod&&(n=null),`slowPeriod`in e&&e.slowPeriod!==t.slowPeriod&&(n=null),Object.assign(t,e)}}}function cs(e,t,n){let r=Array(e.length);if(e.length<t)return r;let i=0;for(let n=0;n<t;n++){let t=e[n];if(!t)return r;i+=t.close}let a=i/t,o=n/100;r[t-1]={upper:a*(1+o),middle:a,lower:a*(1-o)};for(let a=t;a<e.length;a++){let o=e[a-t],s=e[a];if(!o||!s)continue;i=i-o.close+s.close;let c=i/t,l=n/100;r[a]={upper:c*(1+l),middle:c,lower:c*(1-l)}}return r}function ls(e,t,n=10,r=11){if(t<n-1||t>=e.length)return null;let i=0;for(let r=0;r<n;r++){let n=e[t-r];if(!n)return null;i+=n.close}let a=i/n,o=r/100;return{upper:a*(1+o),middle:a,lower:a*(1-o)}}function us(e={}){let t={period:10,deviation:11,...e},n=null,r=0,i=0,a=[];function o(e){return(n!==e||r!==t.period||i!==t.deviation)&&(a=cs(e,t.period,t.deviation),n=e,r=t.period,i=t.deviation),a}return{name:`ene`,version:`1.0.0`,description:`ENE 轨道线渲染器`,debugName:`ENE轨道线`,paneId:`main`,priority:q.INDICATOR,draw(e){let{ctx:n,pane:r,data:i,range:a,scrollLeft:s,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<t.period)return;let f=o(d);n.save(),n.translate(-s,0);let p=Math.max(a.start,t.period-1),m=Math.min(a.end,d.length);n.fillStyle=`rgba(69, 112, 249, 0.08)`,n.beginPath();let h=!0;for(let e=p;e<m;e++){let t=f[e];if(!t)continue;let i=u[e-a.start]+c/2,o=r.yAxis.priceToY(t.upper),s=Q(i,l),d=Q(o,l);h?(n.moveTo(s,d),h=!1):n.lineTo(s,d)}for(let e=m-1;e>=p;e--){let t=f[e];if(!t)continue;let i=u[e-a.start]+c/2,o=r.yAxis.priceToY(t.lower),s=Q(i,l),d=Q(o,l);n.lineTo(s,d)}n.closePath(),n.fill(),n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`;let g=(e,t)=>{n.strokeStyle=t,n.beginPath();let i=!0;for(let t=p;t<m;t++){let o=f[t];if(!o)continue;let s=u[t-a.start]+c/2,d=r.yAxis.priceToY(o[e]),p=Q(s,l),m=Q(d,l);i?(n.moveTo(p,m),i=!1):n.lineTo(p,m)}n.stroke()};g(`upper`,`rgba(214, 10, 34, 1)`),g(`middle`,`rgba(69, 112, 249, 1)`),g(`lower`,`rgba(3, 123, 102, 1)`),n.restore()},onDataUpdate(){n=null},getConfig(){return{...t}},setConfig(e){`period`in e&&e.period!==t.period&&(n=null),`deviation`in e&&e.deviation!==t.deviation&&(n=null),Object.assign(t,e)}}}function ds(e,t,n){if(t<n-1)return;let r=0;for(let i=0;i<n;i++){let n=e[t-i];if(!n)return;r+=n.close}return r/n}function fs(e){let t={yPaddingPx:e.yPaddingPx,indicators:{MA:{enabled:!0,params:{}},BOLL:{enabled:!1,params:{period:20,multiplier:2}},EXPMA:{enabled:!1,params:{fastPeriod:12,slowPeriod:50}},ENE:{enabled:!1,params:{period:10,deviation:11}}}};return{name:`mainIndicatorLegend`,version:`1.0.0`,description:`主图指标图例渲染器(统一管理 MA、BOLL 等)`,debugName:`主图指标图例`,paneId:`main`,priority:q.FOREGROUND,enabled:!0,draw(e){let{ctx:n,data:r,range:i}=e,a=r;if(!a.length)return;n.save(),n.font=`12px Arial`,n.textAlign=`left`;let o=Math.min(i.end-1,a.length-1),s=[],c=t.indicators.MA;c?.enabled&&s.push({draw:e=>{let r=[],i=c.params.periods;if(i&&Array.isArray(i)?i.forEach(e=>{let t=`MA${e}`;r.push({label:`MA${e}`,color:Y[t]||Y.MA5,value:ds(a,o,e)})}):r.push({label:`MA5`,color:Y.MA5,value:ds(a,o,5)},{label:`MA10`,color:Y.MA10,value:ds(a,o,10)},{label:`MA20`,color:Y.MA20,value:ds(a,o,20)},{label:`MA30`,color:Y.MA30,value:ds(a,o,30)},{label:`MA60`,color:Y.MA60,value:ds(a,o,60)}),r.length>0){let i=12,a=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`MA`,i,a),i+=n.measureText(`MA`).width+10;for(let e of r){let t=typeof e.value==`number`?` ${e.value.toFixed(2)}`:``,r=`${e.label}${t}`;n.fillStyle=e.color,n.fillText(r,i,a),i+=n.measureText(r).width+10}}}});let l=t.indicators.BOLL;l?.enabled&&s.push({draw:e=>{let r=l.params.period??20,i=l.params.multiplier??2,s=is(a,o,r,i),c=12,u=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`BOLL(${r},${i})`,c,u),c+=n.measureText(`BOLL(${r},${i})`).width+10,s&&(n.fillStyle=ua.UPPER,n.fillText(`上轨:${s.upper.toFixed(2)}`,c,u),c+=n.measureText(`上轨:${s.upper.toFixed(2)}`).width+10,n.fillStyle=ua.MIDDLE,n.fillText(`中轨:${s.middle.toFixed(2)}`,c,u),c+=n.measureText(`中轨:${s.middle.toFixed(2)}`).width+10,n.fillStyle=ua.LOWER,n.fillText(`下轨:${s.lower.toFixed(2)}`,c,u))}});let u=t.indicators.EXPMA;u?.enabled&&s.push({draw:e=>{let r=u.params.fastPeriod??12,i=u.params.slowPeriod??50,s=os(a,o,r,i),c=12,l=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`EXPMA(${r},${i})`,c,l),c+=n.measureText(`EXPMA(${r},${i})`).width+10,s&&(n.fillStyle=_a.FAST,n.fillText(`快:${s.fast.toFixed(2)}`,c,l),c+=n.measureText(`快:${s.fast.toFixed(2)}`).width+10,n.fillStyle=_a.SLOW,n.fillText(`慢:${s.slow.toFixed(2)}`,c,l))}});let d=t.indicators.ENE;d?.enabled&&s.push({draw:e=>{let r=d.params.period??10,i=d.params.deviation??11,s=ls(a,o,r,i),c=12,l=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`ENE(${r},${i})`,c,l),c+=n.measureText(`ENE(${r},${i})`).width+10,s&&(n.fillStyle=va.UPPER,n.fillText(`上轨:${s.upper.toFixed(2)}`,c,l),c+=n.measureText(`上轨:${s.upper.toFixed(2)}`).width+10,n.fillStyle=va.MIDDLE,n.fillText(`中轨:${s.middle.toFixed(2)}`,c,l),c+=n.measureText(`中轨:${s.middle.toFixed(2)}`).width+10,n.fillStyle=va.LOWER,n.fillText(`下轨:${s.lower.toFixed(2)}`,c,l))}}),s.forEach((e,t)=>e.draw(t)),n.restore()},getConfig(){return{yPaddingPx:t.yPaddingPx,indicators:{...t.indicators}}},setConfig(e){if(typeof e.yPaddingPx==`number`&&(t.yPaddingPx=e.yPaddingPx),e.indicators&&typeof e.indicators==`object`)for(let[n,r]of Object.entries(e.indicators))t.indicators[n]||(t.indicators[n]={enabled:!1,params:{}}),r.enabled!==void 0&&(t.indicators[n].enabled=r.enabled),r.params&&(t.indicators[n].params=r.params)}}}function ps(e,t){let n=Array(e.length),r=2/(t+1);if(e.length===0)return n;n[0]=e[0].close;for(let t=1;t<e.length;t++){let i=e[t];i&&(n[t]=i.close*r+n[t-1]*(1-r))}return n}function ms(e,t){let n=Array(e.length),r=2/(t+1),i=e.findIndex(e=>e!==void 0);if(i===-1)return n;n[i]=e[i];for(let t=i+1;t<e.length;t++){let i=e[t],a=n[t-1];i===void 0||a===void 0||(n[t]=i*r+a*(1-r))}return n}function hs(e,t,n,r){let i=Array(e.length);if(e.length<n)return i;let a=ps(e,t),o=ps(e,n),s=Array(e.length);for(let t=0;t<e.length;t++){let e=a[t],n=o[t];e!==void 0&&n!==void 0&&(s[t]=e-n)}let c=ms(s,r);for(let t=0;t<e.length;t++){let e=s[t],n=c[t];e!==void 0&&n!==void 0&&(i[t]={dif:e,dea:n,macd:(e-n)*2})}return i}function gs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={fastPeriod:12,slowPeriod:26,signalPeriod:9,showDIF:!0,showDEA:!0,showBAR:!0,...n},i=null,a=0,o=0,s=0,c=[];function l(e){return(i!==e||a!==r.fastPeriod||o!==r.slowPeriod||s!==r.signalPeriod)&&(c=hs(e,r.fastPeriod,r.slowPeriod,r.signalPeriod),i=e,a=r.fastPeriod,o=r.slowPeriod,s=r.signalPeriod),c}return{name:`macd_${t}`,version:`1.0.0`,description:`MACD 指标渲染器`,debugName:`MACD`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:s,kGap:c,dpr:u,kLinePositions:d}=e,f=i;if(f.length<r.slowPeriod)return;let p=l(f),m=-1/0,h=1/0;for(let e=a.start;e<a.end&&e<p.length;e++){let t=p[e];t&&(m=Math.max(m,t.dif,t.dea,t.macd),h=Math.min(h,t.dif,t.dea,t.macd))}if(!Number.isFinite(m)||!Number.isFinite(h))return;let g=Math.max(.05,(m-h)*.1),_=h-g,v=m+g-_||1,y=n.height-(0-_)/v*n.height;t.save(),t.translate(-o,0);let b=Math.max(a.start,r.slowPeriod-1),x=Math.min(a.end,f.length);if(r.showBAR){let e=s+c-1;for(let r=b;r<x;r++){let i=p[r];if(!i)continue;let o=d[r-a.start];if(o===void 0)continue;let c=o+(s-e)/2,l=n.height-(i.macd-_)/v*n.height,u=i.macd>=0,f=r>0?p[r-1]:null,m;m=f?i.macd>=f.macd:!0;let h;h=u?m?X.BAR_UP:X.BAR_UP_LIGHT:m?X.BAR_DOWN_LIGHT:X.BAR_DOWN,t.fillStyle=h,u?t.fillRect(c,l,e,y-l):t.fillRect(c,y,e,l-y)}}if(r.showDIF){t.strokeStyle=X.DIF,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=p[r];if(!i)continue;let o=d[r-a.start];if(o===void 0)continue;let c=o+s/2,l=n.height-(i.dif-_)/v*n.height,f=Q(c,u),m=Q(l,u);e?(t.moveTo(f,m),e=!1):t.lineTo(f,m)}t.stroke()}if(r.showDEA){t.strokeStyle=X.DEA,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=p[r];if(!i)continue;let o=d[r-a.start];if(o===void 0)continue;let c=o+s/2,l=n.height-(i.dea-_)/v*n.height,f=Q(c,u),m=Q(l,u);e?(t.moveTo(f,m),e=!1):t.lineTo(f,m)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`fastPeriod`in e&&e.fastPeriod!==r.fastPeriod&&(i=null),`slowPeriod`in e&&e.slowPeriod!==r.slowPeriod&&(i=null),`signalPeriod`in e&&e.signalPeriod!==r.signalPeriod&&(i=null),Object.assign(r,e)}}}function _s(e,t,n=12,r=26,i=9){return t<r||t>=e.length?null:hs(e,n,r,i)[t]??null}function vs(e,t,n=12,r=26,i=9){let a=_s(e,t,n,r,i);return a?{name:`MACD`,params:[n,r,i],values:[{label:`DIF`,value:a.dif,color:X.DIF},{label:`DEA`,value:a.dea,color:X.DEA},{label:`MACD`,value:a.macd,color:a.macd>=0?X.BAR_UP:X.BAR_DOWN}]}:null}function ys(e,t){let n=Array(e.length);if(e.length<t+1)return n;let r=[];for(let t=1;t<e.length;t++)r.push(e[t].close-e[t-1].close);let i=0,a=0;for(let e=0;e<t;e++){let t=r[e];t!==void 0&&(t>0?i+=t:a+=Math.abs(t))}let o=i/t,s=a/t;s===0?n[t]=100:n[t]=100-100/(1+o/s);for(let e=t;e<r.length;e++){let i=r[e];if(i!==void 0)if(i>0?(o=(o*(t-1)+i)/t,s=s*(t-1)/t):(o=o*(t-1)/t,s=(s*(t-1)+Math.abs(i))/t),s===0)n[e+1]=100;else{let t=o/s;n[e+1]=100-100/(1+t)}}return n}function bs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period1:6,period2:12,period3:24,showRSI1:!0,showRSI2:!0,showRSI3:!0,...n},i=null,a=0,o=0,s=0,c=[],l=[],u=[];function d(e){return(i!==e||a!==r.period1||o!==r.period2||s!==r.period3)&&(c=ys(e,r.period1),l=ys(e,r.period2),u=ys(e,r.period3),i=e,a=r.period1,o=r.period2,s=r.period3),{rsi1:c,rsi2:l,rsi3:u}}return{name:`rsi_${t}`,version:`1.0.0`,description:`RSI 相对强弱指标渲染器`,debugName:`RSI`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:s,dpr:c,kLinePositions:l}=e,u=i;if(u.length<r.period1+1)return;let{rsi1:f,rsi2:p,rsi3:m}=d(u);t.save(),t.translate(-o,0);let h=n.height-80/100*n.height,g=n.height-50/100*n.height,_=n.height-20/100*n.height,v=o,y=o+e.paneWidth;t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(v,h),t.lineTo(y,h),t.moveTo(v,g),t.lineTo(y,g),t.moveTo(v,_),t.lineTo(y,_),t.stroke(),t.setLineDash([]);let b=Math.max(a.start,r.period1),x=Math.min(a.end,u.length),S=(e,r)=>{t.strokeStyle=r,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let i=!0;for(let r=b;r<x;r++){let o=e[r];if(o===void 0)continue;let u=l[r-a.start];if(u===void 0)continue;let d=u+s/2,f=n.height-(o-0)/100*n.height,p=Q(d,c),m=Q(f,c);i?(t.moveTo(p,m),i=!1):t.lineTo(p,m)}t.stroke()};r.showRSI1&&S(f,da.RSI1),r.showRSI2&&S(p,da.RSI2),r.showRSI3&&S(m,da.RSI3),t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period1`in e&&e.period1!==r.period1&&(i=null),`period2`in e&&e.period2!==r.period2&&(i=null),`period3`in e&&e.period3!==r.period3&&(i=null),Object.assign(r,e)}}}function xs(e,t,n=6,r=12,i=24){if(t<n+1||t>=e.length)return null;let a=ys(e,n)[t],o=ys(e,r)[t],s=ys(e,i)[t],c=[];return a!==void 0&&c.push({label:`RSI${n}`,value:a,color:da.RSI1}),o!==void 0&&c.push({label:`RSI${r}`,value:o,color:da.RSI2}),s!==void 0&&c.push({label:`RSI${i}`,value:s,color:da.RSI3}),c.length===0?null:{name:`RSI`,params:[n,r,i],values:c}}function Ss(e,t){let n=Array(e.length);if(e.length<t)return n;let r=e.map(e=>(e.high+e.low+e.close)/3);for(let i=t-1;i<e.length;i++){let e=0;for(let n=0;n<t;n++)e+=r[i-n];let a=e/t,o=0;for(let e=0;e<t;e++)o+=Math.abs(r[i-e]-a);let s=o/t;s===0?n[i]=0:n[i]=(r[i]-a)/(.015*s)}return n}function Cs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period:14,showCCI:!0,...n},i=null,a=0,o=[];function s(e){return(i!==e||a!==r.period)&&(o=Ss(e,r.period),i=e,a=r.period),o}return{name:`cci_${t}`,version:`1.0.0`,description:`CCI 顺势指标渲染器`,debugName:`CCI`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.period)return;let f=s(d),p=-1/0,m=1/0;for(let e=a.start;e<a.end&&e<f.length;e++){let t=f[e];t!==void 0&&(p=Math.max(p,t),m=Math.min(m,t))}if(!Number.isFinite(p)||!Number.isFinite(m))return;p=Math.max(p,150),m=Math.min(m,-150);let h=p-m||1,g=n.height-(0-m)/h*n.height;t.save(),t.translate(-o,0);let _=n.height-(100-m)/h*n.height,v=n.height-(-100-m)/h*n.height,y=o,b=o+e.paneWidth;t.strokeStyle=fa.OVERBOUGHT,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(y,_),t.lineTo(b,_),t.stroke(),t.strokeStyle=fa.OVERSOLD,t.beginPath(),t.moveTo(y,v),t.lineTo(b,v),t.stroke(),t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.beginPath(),t.moveTo(y,g),t.lineTo(b,g),t.stroke(),t.setLineDash([]);let x=Math.max(a.start,r.period-1),S=Math.min(a.end,d.length);if(r.showCCI){t.strokeStyle=fa.CCI,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=x;r<S;r++){let i=f[r];if(i===void 0)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i-m)/h*n.height,p=Q(s,l),g=Q(d,l);e?(t.moveTo(p,g),e=!1):t.lineTo(p,g)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period`in e&&e.period!==r.period&&(i=null),Object.assign(r,e)}}}function ws(e,t,n){return Ss(e,n)[t]}function Ts(e,t,n=14){if(t<n||t>=e.length)return null;let r=ws(e,t,n);return r===void 0?null:{name:`CCI`,params:[n],values:[{label:`CCI`,value:r,color:fa.CCI}]}}function Es(e,t,n){let r=Array(e.length);if(e.length<t)return r;let i=Array(e.length);for(let n=t-1;n<e.length;n++){let r=-1/0,a=1/0;for(let i=0;i<t;i++){let t=e[n-i];t&&(r=Math.max(r,t.high),a=Math.min(a,t.low))}let o=e[n].close;r===a?i[n]=50:i[n]=(o-a)/(r-a)*100}for(let a=t-1+n-1;a<e.length;a++){let e=i[a];if(e===void 0)continue;let t=0,o=0;for(let e=0;e<n;e++){let n=i[a-e];n!==void 0&&(t+=n,o++)}o===n&&(r[a]={k:e,d:t/n})}return r}function Ds(e={}){let{paneId:t=`sub`,config:n={}}=e,r={n:9,m:3,showK:!0,showD:!0,...n},i=null,a=0,o=0,s=[];function c(e){return(i!==e||a!==r.n||o!==r.m)&&(s=Es(e,r.n,r.m),i=e,a=r.n,o=r.m),s}return{name:`stoch_${t}`,version:`1.0.0`,description:`STOCH 随机指标渲染器`,debugName:`STOCH`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:s,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.n+r.m-1)return;let f=c(d);t.save(),t.translate(-o,0);let p=n.height-80/100*n.height,m=n.height-20/100*n.height,h=o,g=o+e.paneWidth;t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(h,p),t.lineTo(g,p),t.moveTo(h,m),t.lineTo(g,m),t.stroke(),t.setLineDash([]);let _=Math.max(a.start,r.n+r.m-2),v=Math.min(a.end,d.length);if(r.showK){t.strokeStyle=pa.K,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=_;r<v;r++){let i=f[r];if(!i)continue;let o=u[r-a.start];if(o===void 0)continue;let c=o+s/2,d=n.height-(i.k-0)/100*n.height,p=Q(c,l),m=Q(d,l);e?(t.moveTo(p,m),e=!1):t.lineTo(p,m)}t.stroke()}if(r.showD){t.strokeStyle=pa.D,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=_;r<v;r++){let i=f[r];if(!i)continue;let o=u[r-a.start];if(o===void 0)continue;let c=o+s/2,d=n.height-(i.d-0)/100*n.height,p=Q(c,l),m=Q(d,l);e?(t.moveTo(p,m),e=!1):t.lineTo(p,m)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`n`in e&&e.n!==r.n&&(i=null),`m`in e&&e.m!==r.m&&(i=null),Object.assign(r,e)}}}function Os(e,t,n,r){return Es(e,n,r)[t]}function ks(e,t,n=9,r=3){if(t<n+r-1||t>=e.length)return null;let i=Os(e,t,n,r);return i?{name:`STOCH`,params:[n,r],values:[{label:`K`,value:i.k,color:pa.K},{label:`D`,value:i.d,color:pa.D}]}:null}function As(e,t){let n=Array(e.length);if(e.length<t+1)return n;for(let r=t;r<e.length;r++){let i=e[r]?.close,a=e[r-t]?.close;i!==void 0&&a!==void 0&&(n[r]=i-a)}return n}function js(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period:10,showMOM:!0,...n},i=null,a=0,o=[];function s(e){return(i!==e||a!==r.period)&&(o=As(e,r.period),i=e,a=r.period),o}return{name:`mom_${t}`,version:`1.0.0`,description:`MOM 动量指标渲染器`,debugName:`MOM`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.period+1)return;let f=s(d),p=-1/0,m=1/0;for(let e=a.start;e<a.end&&e<f.length;e++){let t=f[e];t!==void 0&&(p=Math.max(p,t),m=Math.min(m,t))}if(!Number.isFinite(p)||!Number.isFinite(m))return;let h=Math.max(Math.abs(p),Math.abs(m))*.1;p+=h,m-=h;let g=p-m||1,_=n.height-(0-m)/g*n.height;t.save(),t.translate(-o,0);let v=o,y=o+e.paneWidth;t.strokeStyle=ma.ZERO,t.lineWidth=1,t.beginPath(),t.moveTo(v,_),t.lineTo(y,_),t.stroke();let b=Math.max(a.start,r.period),x=Math.min(a.end,d.length);if(r.showMOM){t.strokeStyle=ma.MOM,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=f[r];if(i===void 0)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i-m)/g*n.height,p=Q(s,l),h=Q(d,l);e?(t.moveTo(p,h),e=!1):t.lineTo(p,h)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period`in e&&e.period!==r.period&&(i=null),Object.assign(r,e)}}}function Ms(e,t,n){return As(e,n)[t]}function Ns(e,t,n=10){if(t<n||t>=e.length)return null;let r=Ms(e,t,n);return r===void 0?null:{name:`MOM`,params:[n],values:[{label:`MOM`,value:r,color:ma.MOM}]}}function Ps(e,t){let n=Array(e.length);if(e.length<t)return n;for(let r=t-1;r<e.length;r++){let i=-1/0,a=1/0;for(let n=0;n<t;n++){let t=e[r-n];t&&(i=Math.max(i,t.high),a=Math.min(a,t.low))}let o=e[r].close;i===a?n[r]=-50:n[r]=(i-o)/(i-a)*-100}return n}function Fs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period:14,showWMSR:!0,...n},i=null,a=0,o=[];function s(e){return(i!==e||a!==r.period)&&(o=Ps(e,r.period),i=e,a=r.period),o}return{name:`wmsr_${t}`,version:`1.0.0`,description:`WMSR 威廉指标渲染器`,debugName:`WMSR`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.period)return;let f=s(d),p=-100;0-p,t.save(),t.translate(-o,0);let m=n.height-(-20-p)/100*n.height,h=n.height-(-80-p)/100*n.height,g=n.height-(-50-p)/100*n.height,_=o,v=o+e.paneWidth;t.strokeStyle=ha.OVERBOUGHT,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(_,m),t.lineTo(v,m),t.stroke(),t.strokeStyle=ha.OVERSOLD,t.beginPath(),t.moveTo(_,h),t.lineTo(v,h),t.stroke(),t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.beginPath(),t.moveTo(_,g),t.lineTo(v,g),t.stroke(),t.setLineDash([]);let y=Math.max(a.start,r.period-1),b=Math.min(a.end,d.length);if(r.showWMSR){t.strokeStyle=ha.WMSR,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=y;r<b;r++){let i=f[r];if(i===void 0)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i-p)/100*n.height,m=Q(s,l),h=Q(d,l);e?(t.moveTo(m,h),e=!1):t.lineTo(m,h)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period`in e&&e.period!==r.period&&(i=null),Object.assign(r,e)}}}function Is(e,t,n){return Ps(e,n)[t]}function Ls(e,t,n=14){if(t<n||t>=e.length)return null;let r=Is(e,t,n);return r===void 0?null:{name:`WMSR`,params:[n],values:[{label:`WMSR`,value:r,color:ha.WMSR}]}}function Rs(e,t){let n=Array(e.length);if(e.length<t+1)return n;for(let r=t;r<e.length;r++){let i=e[r]?.close,a=e[r-t]?.close;i!==void 0&&a!==void 0&&a!==0&&(n[r]=(i-a)/a*100)}return n}function zs(e,t){let n=Array(e.length),r=0,i=0;for(let a=0;a<e.length;a++){let o=e[a];if(o!==void 0){if(r+=o,i++,i>t){let n=e[a-t];n!==void 0&&(r-=n,i--)}i===t&&(n[a]=r/t)}}return n}function Bs(e,t,n,r,i,a){let o=Array(e.length),s=Rs(e,t),c=Rs(e,n),l=Rs(e,r),u=Rs(e,i),d=zs(s,10),f=zs(c,10),p=zs(l,10),m=zs(u,15),h=Array(e.length);for(let t=0;t<e.length;t++){let e=d[t],n=f[t],r=p[t],i=m[t];e!==void 0&&n!==void 0&&r!==void 0&&i!==void 0&&(h[t]=e*1+n*2+r*3+i*4)}let g=zs(h,a);for(let t=0;t<e.length;t++){let e=h[t],n=g[t];e!==void 0&&n!==void 0&&(o[t]={kst:e,signal:n})}return o}function Vs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={roc1:10,roc2:15,roc3:20,roc4:30,signalPeriod:9,showKST:!0,showSignal:!0,...n},i=null,a=``,o=[];function s(e){let t=`${r.roc1}-${r.roc2}-${r.roc3}-${r.roc4}-${r.signalPeriod}`;return(i!==e||a!==t)&&(o=Bs(e,r.roc1,r.roc2,r.roc3,r.roc4,r.signalPeriod),i=e,a=t),o}return{name:`kst_${t}`,version:`1.0.0`,description:`KST 确知指标渲染器`,debugName:`KST`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.roc4+15+r.signalPeriod)return;let f=s(d),p=-1/0,m=1/0;for(let e=a.start;e<a.end&&e<f.length;e++){let t=f[e];t&&(p=Math.max(p,t.kst,t.signal),m=Math.min(m,t.kst,t.signal))}if(!Number.isFinite(p)||!Number.isFinite(m))return;let h=(p-m)*.1||1;p+=h,m-=h;let g=p-m||1,_=n.height-(0-m)/g*n.height;t.save(),t.translate(-o,0);let v=o,y=o+e.paneWidth;t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.lineWidth=1,t.beginPath(),t.moveTo(v,_),t.lineTo(y,_),t.stroke();let b=Math.max(a.start,r.roc4+15+r.signalPeriod-1),x=Math.min(a.end,d.length);if(r.showKST){t.strokeStyle=ga.KST,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=f[r];if(!i)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i.kst-m)/g*n.height,p=Q(s,l),h=Q(d,l);e?(t.moveTo(p,h),e=!1):t.lineTo(p,h)}t.stroke()}if(r.showSignal){t.strokeStyle=ga.SIGNAL,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=f[r];if(!i)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i.signal-m)/g*n.height,p=Q(s,l),h=Q(d,l);e?(t.moveTo(p,h),e=!1):t.lineTo(p,h)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){i=null,Object.assign(r,e)}}}function Hs(e,t,n,r,i,a,o){return Bs(e,n,r,i,a,o)[t]}function Us(e,t,n=10,r=15,i=20,a=30,o=9){if(t<a+15+o||t>=e.length)return null;let s=Hs(e,t,n,r,i,a,o);return s?{name:`KST`,params:[n,r,i,a,o],values:[{label:`KST`,value:s.kst,color:ga.KST},{label:`Signal`,value:s.signal,color:ga.SIGNAL}]}:null}function Ws(e,t){let n=Array(e.length);if(e.length<t)return n;for(let r=t-1;r<e.length;r++){let i=-1/0,a=1/0;for(let n=0;n<t;n++){let t=e[r-n];t&&(i=Math.max(i,t.high),a=Math.min(a,t.low))}let o=e[r].close;i===a?n[r]=50:n[r]=(o-a)/(i-a)*100}return n}function Gs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period:9,showFASTK:!0,...n},i=null,a=0,o=[];function s(e){return(i!==e||a!==r.period)&&(o=Ws(e,r.period),i=e,a=r.period),o}return{name:`fastk_${t}`,version:`1.0.0`,description:`FASTK 快速随机指标渲染器`,debugName:`FASTK`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.period)return;let f=s(d);t.save(),t.translate(-o,0);let p=n.height-80/100*n.height,m=n.height-20/100*n.height,h=o,g=o+e.paneWidth;t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(h,p),t.lineTo(g,p),t.moveTo(h,m),t.lineTo(g,m),t.stroke(),t.setLineDash([]);let _=Math.max(a.start,r.period-1),v=Math.min(a.end,d.length);if(r.showFASTK){t.strokeStyle=pa.K,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=_;r<v;r++){let i=f[r];if(i===void 0)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i-0)/100*n.height,p=Q(s,l),m=Q(d,l);e?(t.moveTo(p,m),e=!1):t.lineTo(p,m)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period`in e&&e.period!==r.period&&(i=null),Object.assign(r,e)}}}function Ks(e,t,n){return Ws(e,n)[t]}function qs(e,t,n=9){if(t<n||t>=e.length)return null;let r=Ks(e,t,n);return r===void 0?null:{name:`FASTK`,params:[n],values:[{label:`FASTK`,value:r,color:pa.K}]}}function Js(e){let{indicatorId:t,paneId:n}=e;switch(t){case`VOLUME`:return qo({paneId:n});case`MACD`:return gs({paneId:n});case`RSI`:return bs({paneId:n});case`CCI`:return Cs({paneId:n});case`STOCH`:return Ds({paneId:n});case`MOM`:return js({paneId:n});case`WMSR`:return Fs({paneId:n});case`KST`:return Vs({paneId:n});case`FASTK`:return Gs({paneId:n});default:throw Error(`Unknown indicator: ${t}`)}}var Ys=class e{dom;opt;data=[];raf=null;viewport=null;paneRenderers=[];markerManager;interaction;pluginHost;rendererPluginManager;preciseDpr=0;dprObserver;constructor(e,t){if(this.dom=e,this.opt=t,this.interaction=new Go(this),this.markerManager=new Ja,this.pluginHost=Wi(),this.rendererPluginManager=new Ki,this.rendererPluginManager.setPluginHost(this.pluginHost),this.rendererPluginManager.setInvalidateCallback(()=>this.scheduleDraw()),this.initPanes(),typeof ResizeObserver<`u`&&`devicePixelContentBoxSize`in ResizeObserverEntry.prototype){let e=this.dom.canvasLayer;e&&(this.dprObserver=new ResizeObserver(e=>{let t=e[0];if(!t)return;let n=t.devicePixelContentBoxSize?.[0],r=t.contentBoxSize?.[0];if(n&&r){let e=n.inlineSize/r.inlineSize;this.preciseDpr=Math.round(e*64)/64}}),this.dprObserver.observe(e))}}get plugin(){return this.pluginHost}useRenderer(e,t){this.rendererPluginManager.register(e),t&&e.setConfig&&e.setConfig(t)}removeRenderer(e){this.rendererPluginManager.unregister(e)}getRenderer(e){return this.rendererPluginManager.getPlugin(e)}updateRendererConfig(e,t){this.rendererPluginManager.updateConfig(e,t)}setRendererEnabled(e,t){this.rendererPluginManager.setEnabled(e,t)}getAllRenderers(){return this.rendererPluginManager.getAllPlugins()}draw(){this.markerManager.clear();let e=this.computeViewport();if(!e||this.data.length===0)return;let{start:t,end:n}=Vo(e.scrollLeft,e.plotWidth,this.opt.kWidth,this.opt.kGap,this.data.length,e.dpr),r={start:t,end:n},i=this.calcKLinePositions(r),{kWidthPx:a}=Bo(this.opt.kWidth,this.opt.kGap,e.dpr);this.interaction.setKLinePositions(i,r,a);for(let t of this.paneRenderers){let n=t.getPane(),a=t.getDom().plotCanvas.getContext(`2d`),o=t.getDom().yAxisCanvas.getContext(`2d`);n.updateRange(this.data,r),a&&(a.setTransform(1,0,0,1,0,0),a.scale(e.dpr,e.dpr),a.clearRect(0,0,e.plotWidth+1,n.height+2/e.dpr));let s=this.opt.rightAxisWidth+(this.opt.priceLabelWidth||60);o&&(o.setTransform(1,0,0,1,0,0),o.scale(e.dpr,e.dpr),o.clearRect(0,0,s,n.height+2/e.dpr));let c={ctx:a,pane:Ri(n),data:this.data,range:r,scrollLeft:e.scrollLeft,kWidth:this.opt.kWidth,kGap:this.opt.kGap,dpr:e.dpr,paneWidth:e.plotWidth,kLinePositions:i,markerManager:this.markerManager,yAxisCtx:o??void 0};if(a){a.save();let e=this.rendererPluginManager.render(n.id,c);e.length>0&&this.pluginHost.events.emit(`renderer:error`,{paneId:n.id,errors:e}),a.restore()}}let o=this.dom.xAxisCanvas.getContext(`2d`);if(o){let t={ctx:o,pane:{id:`xAxis`,top:0,height:this.opt.bottomAxisHeight,yAxis:{priceToY:()=>0,yToPrice:()=>0,getPaddingTop:()=>0,getPaddingBottom:()=>0,getPriceOffset:()=>0},priceRange:{maxPrice:0,minPrice:0}},data:this.data,range:r,scrollLeft:e.scrollLeft,kWidth:this.opt.kWidth,kGap:this.opt.kGap,dpr:e.dpr,paneWidth:e.plotWidth,kLinePositions:i,xAxisCtx:o},n=this.rendererPluginManager.renderPlugin(`timeAxis`,t);n.length>0&&this.pluginHost.events.emit(`renderer:error`,{paneId:`timeAxis`,errors:n})}}zoomAt(e,t,n){let r=this.opt.kWidth+this.opt.kGap,i=(t+e)/r,a=this.viewport?.dpr||window.devicePixelRatio||1,o=Math.round(this.opt.kWidth*a),s=n>0?-2:2,c=o+s;c%2==0&&(c+=s>0?1:-1);let l=c/a,u=3/a;if(l=Math.max(this.opt.minKWidth,Math.min(this.opt.maxKWidth,l)),Math.abs(l-this.opt.kWidth)<.01)return;let d=i*(l+u)-e;if(this.onZoomChange){this.onZoomChange(l,u,d);return}this.opt={...this.opt,kWidth:l,kGap:u};let f=this.dom.container,p=Math.max(0,f.scrollWidth-f.clientWidth);f.scrollLeft=Math.min(Math.max(0,d),p),this.scheduleDraw()}applyZoom(e,t){this.opt={...this.opt,kWidth:e,kGap:t},this.scheduleDraw()}onZoomChange;setOnZoomChange(e){this.onZoomChange=e}getPaneRenderers(){return this.paneRenderers}getMarkerManager(){return this.markerManager}updateCustomMarkers(e){this.markerManager.setCustomMarkers(e),this.scheduleDraw()}clearCustomMarkers(){this.markerManager.clearCustomMarkers(),this.scheduleDraw()}getDom(){return this.dom}getOption(){return this.opt}calcKLinePositions(e){let{start:t,end:n}=e,r=n-t;if(r<=0)return[];let i=this.viewport?.dpr||window.devicePixelRatio||1,{unitPx:a,startXPx:o}=Bo(this.opt.kWidth,this.opt.kGap,i),s=Array(r);for(let e=0;e<r;e++)s[e]=(o+(t+e)*a)/i;return s}updateOptions(e){this.opt={...this.opt,...e},e.panes&&this.initPanes(),this.resize()}updatePaneLayout(e){this.opt.panes=e,this.layoutPanes(),this.scheduleDraw()}addPane(e){if(this.paneRenderers.some(t=>t.getPane().id===e)){console.warn(`Pane "${e}" already exists`);return}let t=new Wo(e),n=document.createElement(`canvas`),r=document.createElement(`canvas`),i=e===`main`;n.id=`${e}-plot`,n.className=i?`plot-canvas main`:`plot-canvas sub`,n.style.position=`absolute`,n.style.left=`0`,n.style.top=`0`,r.id=`${e}-yAxis`,r.className=`right-axis`,r.style.position=`absolute`,r.style.right=`0`;let a=new Ko({plotCanvas:n,yAxisCanvas:r},t,{rightAxisWidth:this.opt.rightAxisWidth,yPaddingPx:0,priceLabelWidth:this.opt.priceLabelWidth});this.paneRenderers.push(a);let o=this.dom.canvasLayer;o&&(o.appendChild(n),o.appendChild(r)),this.rendererPluginManager.addKnownPaneId(e)}removePane(e){let t=this.paneRenderers.findIndex(t=>t.getPane().id===e);if(t===-1)return;let n=this.paneRenderers[t];if(!n)return;let r=n.getDom();r.plotCanvas.remove(),r.yAxisCanvas.remove(),this.paneRenderers.splice(t,1),this.rendererPluginManager.removeKnownPaneId(e)}hasPane(e){return this.paneRenderers.some(t=>t.getPane().id===e)}static SUB_PANE_PREFIX=`sub_`;createSubPane(t,n){let r=`${e.SUB_PANE_PREFIX}${t}`;if(this.hasPane(r)){let e=`${t.toLowerCase()}_${r}`;return n&&this.updateRendererConfig(e,n),!0}this.addPane(r);let i=Js({indicatorId:t,paneId:r});return this.useRenderer(i,n),this.layoutPanes(),this.scheduleDraw(),!0}removeSubPane(t){let n=`${e.SUB_PANE_PREFIX}${t}`;if(!this.hasPane(n))return;let r=`${t.toLowerCase()}_${n}`;this.removeRenderer(r),this.removePane(n),this.layoutPanes(),this.scheduleDraw()}clearSubPanes(){let t=this.paneRenderers.map(e=>e.getPane().id).filter(t=>t.startsWith(e.SUB_PANE_PREFIX));for(let n of t){let t=n.slice(e.SUB_PANE_PREFIX.length);this.removeSubPane(t)}}getSubPaneIndicators(){return this.paneRenderers.map(e=>e.getPane().id).filter(t=>t.startsWith(e.SUB_PANE_PREFIX)).map(t=>t.slice(e.SUB_PANE_PREFIX.length))}translatePrice(e,t){let n=this.paneRenderers.find(t=>t.getPane().id===e);if(!n)return;let r=n.getPane(),i=r.yAxis.deltaYToPriceOffset(t),a=r.yAxis.getPriceOffset();r.yAxis.setPriceOffset(a+i),this.scheduleDraw()}updateData(e){this.data=e??[];let t=this.dom.container;if(t){let e=this.getContentWidth(),n=Math.max(0,e-t.clientWidth);t.scrollLeft>n&&(t.scrollLeft=n)}this.interaction.reset(),this.scheduleDraw()}getData(){return this.data}getContentWidth(){let e=this.data?.length??0,t=this.viewport?.dpr||window.devicePixelRatio||1,{startXPx:n,unitPx:r}=Bo(this.opt.kWidth,this.opt.kGap,t);return(n+e*r)/t}resize(){let e=this.computeViewport();!e||e.viewWidth<10||e.viewHeight<10||(this.layoutPanes(),this.scheduleDraw())}scheduleDraw(){this.raf!=null&&cancelAnimationFrame(this.raf),this.raf=requestAnimationFrame(()=>{this.raf=null,this.draw()})}async destroy(){this.raf!=null&&cancelAnimationFrame(this.raf),this.raf=null,this.dprObserver?.disconnect(),this.dprObserver=void 0,this.preciseDpr=0,this.viewport=null,this.paneRenderers.forEach(e=>e.destroy()),this.paneRenderers=[],this.rendererPluginManager.clear(),this.onZoomChange=void 0,await this.pluginHost.destroy()}initPanes(){this.paneRenderers=this.opt.panes.map(e=>{let t=new Wo(e.id),n=document.createElement(`canvas`),r=document.createElement(`canvas`),i=e.id===`main`;return n.id=`${e.id}-plot`,n.className=i?`plot-canvas main`:`plot-canvas sub`,n.style.position=`absolute`,n.style.left=`0`,n.style.top=`0`,r.id=`${e.id}-yAxis`,r.className=`right-axis`,r.style.position=`absolute`,r.style.right=`0`,new Ko({plotCanvas:n,yAxisCanvas:r},t,{rightAxisWidth:this.opt.rightAxisWidth,yPaddingPx:this.opt.yPaddingPx,priceLabelWidth:this.opt.priceLabelWidth})});let e=this.dom.canvasLayer;e&&(e.querySelectorAll(`canvas:not(.x-axis-canvas)`).forEach(e=>e.remove()),this.paneRenderers.forEach(t=>{let n=t.getDom();e.appendChild(n.plotCanvas),e.appendChild(n.yAxisCanvas)}))}layoutPanes(){let e=this.viewport;if(!e)return;let t=this.opt.panes.filter(e=>e.visible!==!1),n=Math.max(0,this.opt.paneGap??0),r=0,i=n*Math.max(0,t.length-1),a=Math.max(1,e.plotHeight-i),o=Math.max(0,t.length-1),s=o===0?1:.85**o,c=o>0?(1-s)/o:0,l=t.map((e,t)=>Math.round(a*(t===0?s:c))),u=l.reduce((e,t)=>e+t,0),d=l.length-1;d>=0&&(l[d]+=a-u);for(let i=0;i<t.length;i++){let a=t[i];if(!a)continue;let o=this.paneRenderers.find(e=>e.getPane().id===a.id);if(!o)continue;let s=o.getPane(),c=l[i];s.setLayout(r,c),s.id===`main`?s.setPadding(this.opt.yPaddingPx,this.opt.yPaddingPx):s.setPadding(0,0),o.resize(e.plotWidth,c,e.dpr);let u=o.getDom();u.plotCanvas.style.top=`${r}px`,u.yAxisCanvas.style.top=`${r}px`,r+=c+n}}computeViewport(){let e=this.dom.container;if(!e)return null;let t=Math.max(1,Math.round(e.clientWidth)),n=Math.max(1,Math.round(e.clientHeight)),r=this.opt.rightAxisWidth+(this.opt.priceLabelWidth||60),i=Math.round(t-r),a=Math.round(n-this.opt.bottomAxisHeight),o=this.preciseDpr>0?this.preciseDpr:Math.round((window.devicePixelRatio||1)*64)/64;o<1&&(o=1);let s=16*1024*1024;t*o*(n*o)>s&&(o=Math.sqrt(s/(t*n)));let c=Math.round(e.scrollLeft*o)/o;this.dom.canvasLayer.style.width=`${t}px`,this.dom.canvasLayer.style.height=`${n}px`,this.dom.xAxisCanvas.style.width=`${i}px`,this.dom.xAxisCanvas.style.height=`${this.opt.bottomAxisHeight}px`,this.dom.xAxisCanvas.width=Math.round(i*o),this.dom.xAxisCanvas.height=Math.round(this.opt.bottomAxisHeight*o);let l={viewWidth:t,viewHeight:n,plotWidth:i,plotHeight:a,scrollLeft:c,dpr:o};return this.viewport=l,l}};function Xs(e){return e.open>e.close?`down`:e.open<e.close?`up`:`flat`}var $=function(e){return e.RISE_WITH_VOLUME=`rise_with_volume`,e.RISE_WITHOUT_VOLUME=`rise_without_volume`,e.FALL_WITH_VOLUME=`fall_with_volume`,e.FALL_WITHOUT_VOLUME=`fall_without_volume`,e.OTHERS=`others`,e}({}),Zs={volumeAmplifyThreshold:1.5,volumeShrinkThreshold:.8,avgPeriod:20},Qs=class{prefixSum=[];dataLength=0;build(e){let t=e.length;if(t===0){this.prefixSum=[],this.dataLength=0;return}this.prefixSum=[0];for(let n=0;n<t;n++)this.prefixSum.push(this.prefixSum[n]+(e[n]?.volume??0));this.dataLength=t}query(e,t){return e<0||t>=this.dataLength||e>t?0:this.prefixSum[t+1]-this.prefixSum[e]}getVolumeMA(e,t){if(e<t-1)return 0;let n=e-t+1;return this.query(n,e)/t}get length(){return this.dataLength}};function $s(e,t,n,r=Zs){let i=new Qs;i.build(e);let a=[],{volumeAmplifyThreshold:o,volumeShrinkThreshold:s,avgPeriod:c}=r;for(let r=t;r<n&&r<e.length;r++){let t=e[r]?.volume;if(r<1||!t){a.push($.OTHERS);continue}let n=i.getVolumeMA(r,c),l=e[r];if(!l){a.push($.OTHERS);continue}let u=l.close-l.open,d=u>0,f=u<0,p=t>n*o,m=t<n*s;d&&p?a.push($.RISE_WITH_VOLUME):d&&m?a.push($.RISE_WITHOUT_VOLUME):f&&p?a.push($.FALL_WITH_VOLUME):f&&m?a.push($.FALL_WITHOUT_VOLUME):a.push($.OTHERS)}return a}function ec(){return{name:`candle`,version:`1.0.0`,description:`K线蜡烛图渲染器`,debugName:`K线`,paneId:`main`,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,kGap:s,dpr:c,kLinePositions:l,markerManager:u}=e,d=r;if(!d.length)return;let{kWidthPx:f}=Bo(o,s,c);t.save(),t.translate(-a,0);let p=l||[],m=$s(d,i.start,i.end,Zs);for(let e=i.start;e<i.end&&e<d.length;e++){let r=d[e];if(!r)continue;let a=n.yAxis.priceToY(r.open),s=n.yAxis.priceToY(r.close),l=n.yAxis.priceToY(r.high),h=n.yAxis.priceToY(r.low),g=p[e-i.start];if(!g)continue;let _=e=>Math.round(e*c)/c,v=_(a),y=_(s),b=_(l),x=_(h),S=Math.min(v,y),C=Math.max(Math.abs(v-y),1),w=$o(Math.round(g*c),S,f,C,c);t.fillStyle=Xs(r)===`up`?J.UP:J.DOWN,t.fillRect(w.bodyRect.x,w.bodyRect.y,w.bodyRect.width,w.bodyRect.height);let T=w.wickRect.width,E=w.wickRect.x,D=w.bodyRect.y,O=w.bodyRect.y+w.bodyRect.height,k=Math.max(r.open,r.close),A=Math.min(r.open,r.close);if(r.high>k){let e=Zo(E,b,D,c);e&&t.fillRect(e.x,e.y,T,e.height)}if(r.low<A){let e=Zo(E,O,x,c);e&&t.fillRect(e.x,e.y,T,e.height)}let j=m[e-i.start];if(j!==$.OTHERS&&u){let n=j===$.RISE_WITH_VOLUME||j===$.RISE_WITHOUT_VOLUME?b-15:x+15;tc(t,w.bodyRect.x+w.bodyRect.width/2,n,j,e,o,4,u,c)}}t.restore()}}}function tc(e,t,n,r,i,a,o=4,s,c){let l=e=>Math.round(e*c)/c;t=l(t),n=l(n);let u=Math.min(a,20),d=u*Math.sqrt(3)/2,f,p;switch(r){case $.RISE_WITH_VOLUME:f=`#FF4444`,p=!0;break;case $.RISE_WITHOUT_VOLUME:f=`#00C853`,p=!0;break;case $.FALL_WITH_VOLUME:f=`#FF4444`,p=!1;break;case $.FALL_WITHOUT_VOLUME:f=`#00C853`,p=!1;break;default:return}if(e.save(),e.beginPath(),p){let r=l(n-o),i=l(r-d);e.moveTo(t,i),e.lineTo(l(t-u/2),r),e.lineTo(l(t+u/2),r)}else{let r=l(n+o),i=l(r+d);e.moveTo(t,i),e.lineTo(l(t-u/2),r),e.lineTo(l(t+u/2),r)}e.closePath(),e.fillStyle=f,e.fill(),e.restore();let m,h;if(p){let e=l(l(n-o)-d);m=l(t-u/2),h=e}else{let e=l(n+o);l(e+d),m=l(t-u/2),h=e}let g;switch(r){case $.RISE_WITH_VOLUME:g=`RISE_WITH_VOLUME`;break;case $.RISE_WITHOUT_VOLUME:g=`RISE_WITHOUT_VOLUME`;break;case $.FALL_WITH_VOLUME:g=`FALL_WITH_VOLUME`;break;case $.FALL_WITHOUT_VOLUME:g=`FALL_WITHOUT_VOLUME`;break;default:return}let _=`mk_price-volume_${i}`;s.register({id:_,type:`triangle`,markerType:g,x:m,y:h,width:u,height:d,dataIndex:i,metadata:{relation:r}})}function nc(e,t){return t?Math.max(4,Math.min(8,Math.round(e/80))):2}function rc(){return{name:`gridLines`,version:`1.0.0`,description:`网格线渲染器`,debugName:`网格线`,paneId:zi,priority:q.GRID,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,dpr:s,kLinePositions:c}=e,l=r;if(!l.length)return;let u=nc(n.height,n.id===`main`);t.save(),t.fillStyle=la.HORIZONTAL,t.translate(-a,0);let d=t.canvas.width/s,f=a,p=a+d,m=n.yAxis.getPaddingTop(),h=n.yAxis.getPaddingBottom(),g=m,_=Math.max(m,n.height-h),v=Math.max(0,_-g);for(let e=0;e<u;e++){let n=u<=1?0:e/(u-1),r=Qo(f,p,Math.round(g+n*v),s);r&&t.fillRect(r.x,r.y,r.width,r.height)}let y=aa(l);for(let e of y){if(e<i.start||e>=i.end||e>=l.length)continue;let r=e-i.start;if(r<0||r>=c.length)continue;let a=Zo(c[r]+o/2,0,n.height,s);a&&t.fillRect(a.x,a.y,a.width,a.height)}t.restore()}}}function ic(){return{name:`lastPriceLine`,version:`1.0.0`,description:`最新价虚线渲染器`,debugName:`最新价线`,paneId:`main`,priority:q.FOREGROUND,draw(e){let{ctx:t,pane:n,data:r,scrollLeft:i,kWidth:a,dpr:o,kLinePositions:s}=e,c=r,l=c[c.length-1];if(!l)return;t.save(),t.translate(-i,0);let u=Math.round(n.yAxis.priceToY(l.close)),d=s[0]??0,f=(s[s.length-1]??0)+a;t.strokeStyle=J.LAST_PRICE,t.lineWidth=1,t.setLineDash([4,3]),t.beginPath();let p=(Math.floor(u*o)+.5)/o;t.moveTo(Math.round(d*o)/o,p),t.lineTo(Math.round(f*o)/o,p),t.stroke(),t.setLineDash([]),t.restore()}}}function ac(){return{name:`extremaMarkers`,version:`1.0.0`,description:`可视区最高/最低价标注渲染器`,debugName:`极值标记`,paneId:`main`,priority:q.OVERLAY,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,dpr:s,paneWidth:c,kLinePositions:l}=e,u=r;if(!u.length||n.id!==`main`)return;let d=Math.max(0,i.start),f=Math.min(u.length,i.end);if(f-d<=0)return;let p=-1/0,m=1/0,h=d,g=d;for(let e=d;e<f;e++){let t=u[e];t&&(t.high>=p&&(p=t.high,h=e),t.low<=m&&(m=t.low,g=e))}if(!Number.isFinite(p)||!Number.isFinite(m))return;let _=e=>{let t=e-i.start;return t<0||t>=l.length?0:l[t]+o/2};t.save(),t.translate(-a,0),oc(t,_(h),n.yAxis.priceToY(p),p,s,c,a),oc(t,_(g),n.yAxis.priceToY(m),m,s,c,a),t.restore()}}}function oc(e,t,n,r,i,a,o){let s=r.toFixed(2);e.font=`12px Arial`;let c=e.measureText(s).width,l=t-o+30+4+c>a,u=t,d=l?t-30:t+30;u>d&&([u,d]=[d,u]);let f=Qo(u,d,n,i);f&&(e.fillStyle=oa.WEAK,e.fillRect(f.x,f.y,f.width,f.height));let p=Z(d,i),m=Z(n,i);e.fillStyle=oa.WEAK,e.beginPath(),e.arc(p,m,2,0,Math.PI*2),e.fill(),e.font=`12px Arial`,e.textBaseline=`middle`,e.fillStyle=J.NEUTRAL,l?(e.textAlign=`right`,e.fillText(s,Z(t-30-4,i),Z(n,i))):(e.textAlign=`left`,e.fillText(s,Z(t+30+4,i),Z(n,i)))}function sc(e,t,n,r,i,a){let o=t-n||1,s=(e-n)/o;return i+Math.max(1,r-i-a)*(1-s)}function cc(e,t,n,r,i,a){let o=t-n||1,s=Math.max(1,r-i-a);return n+(1-(Math.min(Math.max(e,i),i+s)-i)/s)*o}function lc(e,t){let{x:n,y:r,width:i,height:a,priceRange:o,yPaddingPx:s=0,dpr:c,ticks:l=10,bgColor:u=sa.TRANSPARENT,textColor:d=oa.SECONDARY,lineColor:f=ca.DARK,fontSize:p=16,drawLeftBorder:m=!0,drawTickLines:h=!0,priceOffset:g=0}=t,_=Math.max(0,Math.min(s,Math.floor(a/2)-1)),{maxPrice:v,minPrice:y}=o,b=v-y,x=b===0?0:b/(Math.max(2,l)-1);e.fillStyle=u,e.fillRect(n,r,i,a),m&&(e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(Q(n,c),r),e.lineTo(Q(n,c),r+a),e.stroke()),e.font=`${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.textBaseline=`middle`,e.textAlign=`center`;let S=n+i/2;for(let t=0;t<Math.max(2,l);t++){let i=b===0?v:v-x*t,o=Math.round(sc(i,v,y,a,_,_)+r);if(h){e.strokeStyle=f,e.beginPath();let t=Q(o,c);e.moveTo(n,t),e.lineTo(n+4,t),e.stroke()}let s=i+g;e.fillStyle=d,e.fillText(s.toFixed(2),Z(S,c),Z(o,c))}}function uc(e,t){let{x:n,y:r,width:i,height:a,crosshairX:o,timestamp:s,dpr:c,fontSize:l=16,paddingX:u=8}=t,d=ia(s);e.save(),e.font=`${l}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.textBaseline=`middle`,e.textAlign=`center`;let f=Math.round(e.measureText(d).width),p=Math.min(i,f+u*2),m=a,h=Math.min(Math.max(o,n+p/2),n+i-p/2),g=r+a/2,_=h-p/2,v=r;e.fillStyle=`rgba(0, 0, 0, 0.8)`,e.fillRect(Z(_,c),Z(v,c),Z(p,c),Z(m,c)),e.fillStyle=`#ffffff`,e.fillText(d,Z(h,c),Z(g,c)),e.restore()}function dc(e,t){let{x:n,y:r,width:i,height:a,crosshairY:o,priceRange:s,yPaddingPx:c=0,dpr:l,fontSize:u=16}=t,d=Math.max(0,Math.min(c,Math.floor(a/2)-1)),{maxPrice:f,minPrice:p}=s,m=cc(o-r,f,p,a,d,d).toFixed(2);e.save(),e.font=`${u}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.textBaseline=`middle`,e.textAlign=`center`;let h=u+4,g=i,_=Math.min(Math.max(o,r+h/2),r+a-h/2),v=_-h/2;e.fillStyle=`rgba(0, 0, 0, 0.8)`;let y=Z(n,l),b=Z(v,l),x=Z(g,l),S=Z(h,l);e.fillRect(y,b,x,S);let C=n+i/2;e.fillStyle=`#ffffff`,e.fillText(m,Z(C,l),Z(_,l)),e.restore()}function fc(e,t){let{x:n,y:r,width:i,height:a,data:o,scrollLeft:s,kWidth:c,kGap:l,startIndex:u,endIndex:d,dpr:f,bgColor:p=sa.TRANSPARENT,textColor:m=oa.SECONDARY,lineColor:h=ca.DARK,fontSize:g=12,paddingX:_=8,drawTopBorder:v=!0,drawBottomBorder:y=!0}=t,b=Math.round(c*f),x=b%2==0?b+1:b,S=Math.round(l*f),C=x+S,w=S,T=C/f,E=w/f,D=x/f;e.fillStyle=p,e.fillRect(n,r,i,a),v&&(e.strokeStyle=h,e.lineWidth=1,e.beginPath(),e.moveTo(n,Q(r,f)),e.lineTo(n+i,Q(r,f)),e.stroke()),y&&(e.strokeStyle=h,e.lineWidth=1,e.beginPath(),e.moveTo(n,Q(r+a,f)),e.lineTo(n+i,Q(r+a,f)),e.stroke()),e.textAlign=`center`,e.textBaseline=`middle`;let O=r+a/2+1,k=aa(o).filter(e=>e>=u&&e<d);for(let t of k){let n=o[t];if(!n)continue;let r=E+t*T+D/2-s,a=_,c=Math.max(_,i-_);if(r>=a&&r<=c){let t=Math.min(Math.max(r,a),c),{text:i,isYear:o}=ta(n.timestamp);e.fillStyle=m,e.font=`${o?`bold `:``}${g}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.fillText(i,Z(t,f),Z(O,f))}}}function pc(e){return{name:`yAxis`,version:`1.0.0`,description:`Y轴价格刻度渲染器`,debugName:`Y轴`,paneId:zi,priority:q.SYSTEM_YAXIS,draw(t){let{ctx:n,pane:r,dpr:i,yAxisCtx:a}=t,o=a||n,s=nc(r.height,r.id===`main`);lc(o,{x:0,y:r.top,width:e.axisWidth,height:r.height,priceRange:r.priceRange,yPaddingPx:e.yPaddingPx,dpr:i,ticks:s,drawLeftBorder:!1,drawTickLines:!1,priceOffset:r.yAxis.getPriceOffset(),fontSize:12});let c=e.getCrosshair?.();c&&c.price!==null&&dc(o,{x:0,y:r.top,width:e.axisWidth,height:r.height,crosshairY:c.y,priceRange:r.priceRange,yPaddingPx:e.yPaddingPx,dpr:i,fontSize:12})}}}var mc=Symbol(`time-axis`);function hc(e){return{name:`timeAxis`,version:`1.0.0`,description:`时间轴渲染器`,debugName:`时间轴`,paneId:mc,priority:q.SYSTEM_XAXIS,isSystem:!0,draw(t){let{ctx:n,data:r,range:i,scrollLeft:a,kWidth:o,kGap:s,dpr:c,paneWidth:l}=t,u=r,d=n,f=l,p=e.height;d.setTransform(1,0,0,1,0,0),d.scale(c,c),d.clearRect(0,0,f,p),fc(d,{x:0,y:0,width:f,height:p,data:u,scrollLeft:a,kWidth:o,kGap:s,startIndex:i.start,endIndex:i.end,dpr:c,drawTopBorder:!1,drawBottomBorder:!1});let m=e.getCrosshair?.();if(m&&typeof m.index==`number`){let e=u[m.index];e&&uc(d,{x:0,y:0,width:f,height:p,crosshairX:m.x,timestamp:e.timestamp,dpr:c,fontSize:12})}}}}function gc(e){return{name:`crosshair`,version:`1.0.0`,description:`十字线渲染器`,debugName:`十字线`,paneId:zi,priority:q.SYSTEM_CROSSHAIR,draw(t){let{ctx:n,pane:r,dpr:i,paneWidth:a}=t,o=e.getCrosshairState();if(o.isDragging||!o.pos)return;let{x:s}=o.pos,c=r.id===o.activePaneId,l=-1;c&&o.price!==null&&(l=r.yAxis.priceToY(o.price)),n.save(),n.beginPath(),n.rect(0,0,a,r.height),n.clip(),n.fillStyle=ya.LINE;let u=Zo(s,0,r.height,i);if(u&&n.fillRect(u.x,u.y,u.width,u.height),c&&l>=0){let e=Qo(0,a,Math.min(l,r.height-1/i),i);e&&n.fillRect(e.x,e.y,e.width,e.height)}n.restore()}}}function _c(e){let t={...e};return{name:`paneTitle_${e.paneId}`,version:`1.0.0`,description:`面板标题渲染器`,debugName:`面板标题`,paneId:e.paneId,priority:q.FOREGROUND,draw(e){let{ctx:n,pane:r}=e;if(r.id!==t.paneId)return;let i=t.yOffset??12;n.save(),n.font=`12px Arial`,n.textAlign=`left`,n.textBaseline=`top`;let a=t.getTitleInfo?.();if(a){let e=12;if(n.fillStyle=oa.PRIMARY,n.fillText(a.name,e,i),e+=n.measureText(a.name).width,a.params&&a.params.length>0){let t=`(${a.params.join(`,`)})`;n.fillStyle=oa.TERTIARY,n.fillText(t,e,i),e+=n.measureText(t).width+8}else e+=8;if(a.values&&a.values.length>0)for(let t of a.values){let r=`${t.label} ${t.value.toFixed(3)}`;n.fillStyle=t.color,n.fillText(r,e,i),e+=n.measureText(r).width+8}}else if(n.fillStyle=oa.PRIMARY,n.fillText(t.title,12,i),t.description){let e=n.measureText(t.title).width;n.fillStyle=oa.WEAK,n.fillText(` - ${t.description}`,12+e,i)}n.restore()},setConfig(e){t={...t,...e}}}}var vc={class:`chart-wrapper`},yc=4,bc=Ga((0,f.defineComponent)({__name:`KLineChart`,props:{semanticConfig:{},kWidth:{default:10},kGap:{default:2},yPaddingPx:{default:0},minKWidth:{default:2},maxKWidth:{default:50},rightAxisWidth:{default:0},bottomAxisHeight:{default:24},priceLabelWidth:{default:60}},setup(e,{expose:t}){let n=e,r=(0,f.ref)(null),i=(0,f.ref)(null),a=(0,f.ref)(null),o=(0,f.ref)(n.kWidth),s=(0,f.ref)(n.kGap),c=(0,f.shallowRef)(null),l=(0,f.shallowRef)(null),u=(0,f.ref)(0);function d(){c.value?.scheduleDraw()}function p(e){if(!e)return;let t=e.getBoundingClientRect();c.value?.interaction.setTooltipSize({width:Math.max(180,Math.round(t.width)),height:Math.max(80,Math.round(t.height))})}let m=(0,f.ref)(null),h=(0,f.ref)(null),g=(0,f.ref)({x:0,y:0}),_=(0,f.ref)(!1),v=(0,f.ref)(null),y=(0,f.ref)(null),b=(0,f.ref)({x:0,y:0}),x=(0,f.ref)(0),S=(0,f.computed)(()=>{let e=v.value;if(typeof e!=`number`)return null;x.value;let t=c.value?.getData();return t&&e>=0&&e<t.length?t[e]:null}),C=(0,f.computed)(()=>v.value),w=(0,f.computed)(()=>b.value),T=(0,f.computed)(()=>(x.value,c.value?.getData()??[]));function E(){x.value++}let D=null;function O(){let e=c.value?.interaction;if(!e){v.value=null,y.value=null,m.value=null,h.value=null;return}v.value=e.hoveredIndex??null,y.value=e.crosshairIndex??null,m.value=e.hoveredMarkerData??null,h.value=e.hoveredCustomMarker??null;let t=e.tooltipPos;t&&(b.value={x:t.x,y:t.y})}function k(){D||=requestAnimationFrame(()=>{O(),D=null})}function A(e){_.value=!0,c.value?.interaction.onPointerDown(e),O()}function j(e){let t=a.value;if(t){let n=t.getBoundingClientRect();g.value={x:e.clientX-n.left,y:e.clientY-n.top}}c.value?.interaction.onPointerMove(e),k()}function M(e){_.value=!1,c.value?.interaction.onPointerUp(e),O()}function ee(e){_.value=!1,c.value?.interaction.onPointerLeave(e),v.value=null}function N(){c.value?.interaction.onScroll(),O()}let P=(0,f.ref)([]),F=(0,f.ref)({}),I=(0,f.ref)([]),te=[`VOLUME`,`MACD`,`RSI`,`CCI`,`STOCH`,`MOM`,`WMSR`,`KST`,`FASTK`];(0,f.watch)((0,f.computed)(()=>I.value.length===0?[{id:`main`,ratio:1,visible:!0}]:[{id:`main`,ratio:1,visible:!0},...I.value.map(e=>({id:e.id,ratio:1,visible:!0}))]),e=>{c.value?.updatePaneLayout(e)},{flush:`post`});function L(e){switch(e){case`MACD`:return{fastPeriod:12,slowPeriod:26,signalPeriod:9};case`RSI`:return{period1:6,period2:12,period3:24};case`CCI`:return{period:14};case`STOCH`:return{n:9,m:3};case`MOM`:return{period:10};case`WMSR`:return{period:14};case`KST`:return{roc1:10,roc2:15,roc3:20,roc4:30,signalPeriod:9};case`FASTK`:return{period:9};default:return{}}}function ne(e=`VOLUME`,t){if(I.value.length>=yc)return!1;let n=`sub_${e}`;if(I.value.some(e=>e.id===n))return!0;if(!c.value?.createSubPane(e,t??L(e)))return!1;let r=_c({paneId:n,title:e,getTitleInfo:()=>ce(n)});return c.value?.useRenderer(r),I.value.push({id:n,indicatorId:e,rendererName:`${e.toLowerCase()}_${n}`,paneTitleRendererName:r.name,params:t??L(e)}),P.value.includes(e)||P.value.push(e),!0}function re(e){let t=I.value.findIndex(t=>t.id===e);if(t===-1)return;let n=I.value[t];n&&(c.value?.removeRenderer(n.paneTitleRendererName),c.value?.removeSubPane(n.indicatorId),I.value.splice(t,1),I.value.some(e=>e.indicatorId===n.indicatorId)||(P.value=P.value.filter(e=>e!==n.indicatorId)))}function ie(){for(let e of I.value)c.value?.removeRenderer(e.paneTitleRendererName);c.value?.clearSubPanes(),I.value=[],P.value=P.value.filter(e=>!te.includes(e))}function ae(){let e=n.semanticConfig.indicators?.main;if(e)for(let t of e)t.enabled&&(P.value.includes(t.type)||P.value.push(t.type),t.params&&(F.value[t.type]=t.params))}(0,f.watch)(P,e=>{let t=c.value;t&&(t.updateRendererConfig(`mainIndicatorLegend`,{indicators:{MA:{enabled:e.includes(`MA`),params:F.value.MA||{}},BOLL:{enabled:e.includes(`BOLL`),params:F.value.BOLL||{}},EXPMA:{enabled:e.includes(`EXPMA`),params:F.value.EXPMA||{}},ENE:{enabled:e.includes(`ENE`),params:F.value.ENE||{}}}}),t.setRendererEnabled(`ma`,e.includes(`MA`)),t.setRendererEnabled(`boll`,e.includes(`BOLL`)),t.setRendererEnabled(`expma`,e.includes(`EXPMA`)),t.setRendererEnabled(`ene`,e.includes(`ENE`)),d())},{deep:!0});function oe(){let e=c.value?.getSubPaneIndicators()??[];I.value=[];for(let t of e){let e=`sub_${t}`,n=_c({paneId:e,title:t,getTitleInfo:()=>ce(e)});c.value?.useRenderer(n),I.value.push({id:e,indicatorId:t,rendererName:`${t.toLowerCase()}_${e}`,paneTitleRendererName:n.name,params:L(t)}),P.value.includes(t)||P.value.push(t)}}function se(e,t){let n=I.value.find(t=>t.id===e);if(!n)return;let r=n.indicatorId;c.value?.removeRenderer(n.paneTitleRendererName),c.value?.removeSubPane(r),c.value?.createSubPane(t,L(t));let i=`sub_${t}`,a=_c({paneId:i,title:t,getTitleInfo:()=>ce(i)});c.value?.useRenderer(a);let o=I.value.findIndex(t=>t.id===e);o!==-1&&(I.value[o]={id:i,indicatorId:t,rendererName:`${t.toLowerCase()}_${i}`,paneTitleRendererName:a.name,params:L(t)}),P.value=P.value.filter(e=>e!==r),P.value.includes(t)||P.value.push(t)}function ce(e){let t=I.value.find(t=>t.id===e);if(!t)return null;let n=c.value?.getData();if(!n||n.length===0)return null;let r=t.params;if(t.indicatorId===`VOLUME`)return{name:`VOL`,params:[],values:[]};let i=y.value;if(i===null)return null;switch(t.indicatorId){case`MACD`:return vs(n,i,r.fastPeriod??12,r.slowPeriod??26,r.signalPeriod??9);case`RSI`:return xs(n,i,r.period1??6,r.period2??12,r.period3??24);case`CCI`:return Ts(n,i,r.period??14);case`STOCH`:return ks(n,i,r.n??9,r.m??3);case`MOM`:return Ns(n,i,r.period??10);case`WMSR`:return Ls(n,i,r.period??14);case`KST`:return Us(n,i,r.roc1??10,r.roc2??15,r.roc3??20,r.roc4??30,r.signalPeriod??9);case`FASTK`:return qs(n,i,r.period??9);default:return null}}function le(e,t){if(e===`MA`||e===`BOLL`||e===`EXPMA`||e===`ENE`){t?P.value.includes(e)||P.value.push(e):P.value=P.value.filter(t=>t!==e);return}if(te.includes(e)){if(t){if(P.value.includes(e)||P.value.push(e),I.value.find(t=>t.indicatorId===e))return;if(!ne(e)){let t=I.value[I.value.length-1];t&&se(t.id,e)}}else P.value=P.value.filter(t=>t!==e),I.value.filter(t=>t.indicatorId===e).forEach(e=>re(e.id));d()}}function ue(e,t){if(F.value[e]=t,e===`MA`||e===`BOLL`||e===`EXPMA`||e===`ENE`){e===`BOLL`&&c.value?.updateRendererConfig(`boll`,t),e===`EXPMA`&&c.value?.updateRendererConfig(`expma`,t),e===`ENE`&&c.value?.updateRendererConfig(`ene`,t),d();return}te.includes(e)&&I.value.filter(t=>t.indicatorId===e).forEach(e=>{e.params={...t},c.value?.updateRendererConfig(e.rendererName,t)}),d()}let de=(0,f.computed)(()=>{let e=u.value,t=window.devicePixelRatio||1,{startXPx:r,unitPx:i}=Bo(o.value,s.value,t);return(r+e*i)/t+(n.rightAxisWidth+n.priceLabelWidth)});function fe(){let e=a.value;e&&(e.scrollLeft=e.scrollWidth,d())}return t({scheduleRender:d,scrollToRight:fe,addSubPane:ne,removeSubPane:re,switchSubIndicator:se,clearAllSubPanes:ie,get plugin(){return c.value?.plugin}}),(0,f.onMounted)(()=>{let e=a.value,t=i.value,p=r.value;if(!e||!t||!p)return;let g=e=>{c.value?.interaction.onWheel(e),O()};e.addEventListener(`wheel`,g,{passive:!1});let _=new Ys({container:e,canvasLayer:t,xAxisCanvas:p},{kWidth:o.value,kGap:s.value,yPaddingPx:n.yPaddingPx,rightAxisWidth:n.rightAxisWidth,bottomAxisHeight:n.bottomAxisHeight,priceLabelWidth:n.priceLabelWidth,minKWidth:n.minKWidth,maxKWidth:n.maxKWidth,panes:[{id:`main`,ratio:1}],paneGap:0});_.setOnZoomChange(async(e,t,n)=>{o.value=e,s.value=t,await(0,f.nextTick)(),await new Promise(e=>requestAnimationFrame(()=>e()));let r=a.value;if(!r)return;let i=Math.max(0,r.scrollWidth-r.clientWidth);r.scrollLeft=Math.min(Math.max(0,n),i),_.applyZoom(e,t)}),_.useRenderer(rc()),_.useRenderer(ac()),_.useRenderer(ts({ma5:!0,ma10:!0,ma20:!0,ma30:!0,ma60:!0})),_.useRenderer(rs()),_.setRendererEnabled(`boll`,!1),_.useRenderer(ss()),_.setRendererEnabled(`expma`,!1),_.useRenderer(us()),_.setRendererEnabled(`ene`,!1),_.useRenderer(ec()),_.useRenderer(ic()),_.useRenderer(Zi()),_.useRenderer(pc({axisWidth:n.rightAxisWidth+n.priceLabelWidth,yPaddingPx:n.yPaddingPx,getCrosshair:()=>{let e=_.interaction.crosshairPos,t=_.interaction.crosshairPrice;return e&&t!==null?{y:e.y,price:t}:null}})),_.useRenderer(fs({yPaddingPx:n.yPaddingPx})),_.useRenderer(gc({getCrosshairState:()=>({pos:_.interaction.crosshairPos,activePaneId:_.interaction.activePaneId,isDragging:_.interaction.isDraggingState(),price:_.interaction.crosshairPrice})})),_.useRenderer(hc({height:n.bottomAxisHeight,getCrosshair:()=>{let e=_.interaction.crosshairPos,t=_.interaction.crosshairIndex;return e&&t!==null?{x:e.x,index:t}:null}})),c.value=_,_.resize(),l.value=new Si(_),l.value.on(`config:error`,e=>{console.error(`Semantic config error:`,e)}),l.value.on(`config:ready`,()=>{u.value=_.getData()?.length??0,E(),ae(),oe(),(0,f.nextTick)(()=>fe())}),l.value.applyConfig(n.semanticConfig).then(e=>{e&&!e.success&&console.error(`Semantic config apply failed:`,e.errors)}),_.interaction.setOnMarkerHover(e=>{m.value=e,d()}),_.interaction.setOnCustomMarkerHover(e=>{h.value=e,d()});let v=null,y=new ResizeObserver(()=>{v&&clearTimeout(v),v=setTimeout(()=>{_.resize(),v=null},50)});y.observe(e),_.__resizeObserver=y,_.__resizeTimeout=v,_.__onWheel=g}),(0,f.onUnmounted)(()=>{let e=c.value;if(e){let t=e.__resizeObserver,n=e.__resizeTimeout;n&&clearTimeout(n),t&&t.disconnect();let r=e.__onWheel,i=a.value;r&&i&&i.removeEventListener(`wheel`,r),e.destroy()}c.value=null}),(0,f.watch)(()=>[n.kWidth,n.kGap],([e,t])=>{typeof e==`number`&&(o.value=e),typeof t==`number`&&(s.value=t),c.value?.updateOptions({kWidth:o.value,kGap:s.value})}),(0,f.watch)(()=>n.yPaddingPx,e=>{c.value?.updateOptions({yPaddingPx:e}),d()}),(0,f.watch)(()=>n.semanticConfig,async(e,t)=>{if(e&&e!==t){let t=await l.value?.applyConfig(e);t&&!t.success&&console.error(`Semantic config apply failed:`,t.errors)}},{deep:!0}),(e,t)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,vc,[(0,f.createElementVNode)(`div`,{class:(0,f.normalizeClass)([`chart-container`,{"is-dragging":_.value}]),ref_key:`containerRef`,ref:a,onScrollPassive:N,onPointerdown:A,onPointermove:j,onPointerup:M,onPointerleave:ee},[(0,f.createElementVNode)(`div`,{class:`scroll-content`,style:(0,f.normalizeStyle)({width:de.value+`px`})},[(0,f.createElementVNode)(`div`,{class:`canvas-layer`,ref_key:`canvasLayerRef`,ref:i},[(0,f.createElementVNode)(`canvas`,{class:`x-axis-canvas`,ref_key:`xAxisCanvasRef`,ref:r},null,512),S.value?((0,f.openBlock)(),(0,f.createBlock)(Ka,{key:0,k:S.value,index:C.value,data:T.value,pos:w.value,"set-el":p},null,8,[`k`,`index`,`data`,`pos`])):(0,f.createCommentVNode)(``,!0),m.value||h.value?((0,f.openBlock)(),(0,f.createBlock)(Za,{key:1,marker:m.value||h.value,pos:g.value},null,8,[`marker`,`pos`])):(0,f.createCommentVNode)(``,!0)],512)],4)],34),(0,f.createVNode)(Ro,{"active-indicators":P.value,"indicator-params":F.value,onToggle:le,onUpdateParams:ue},null,8,[`active-indicators`,`indicator-params`])]))}}),[[`__scopeId`,`data-v-c5290a39`]]),xc={install(e){e.component(`KLineChart`,bc)}};exports.ConfigManager=Hi,exports.EventBus=p,exports.GLOBAL_PANE_ID=zi,exports.HookSystem=Vi,exports.KLineChart=bc,exports.KMapPlugin=xc,exports.PluginHostImpl=Ui,exports.PluginRegistry=Bi,exports.PluginState=Li,exports.RENDERER_PRIORITY=q,exports.RendererPluginManager=Ki,exports.createPluginHost=Wi,exports.wrapPaneInfo=Ri;
16
+ deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Hr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Ur=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=U(),r=G(),i=W();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Wr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=rr(),n=K(),r=W(),i=Ur();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),Gr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=U(),r=W(),i=W();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),Kr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),qr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:K().validateUnion,error:{message:`must match a schema in anyOf`}}})),Jr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Yr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Xr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Zr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Qr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Ir(),n=Rr(),r=Lr(),i=zr(),a=Br(),o=Vr(),s=Hr(),c=Ur(),l=Wr(),u=Gr(),d=Kr(),f=qr(),p=Jr(),m=Yr(),h=Xr(),g=Zr();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),$r=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),ei=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[$r().default]})),ti=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),ni=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Sr(),n=Fr(),r=Qr(),i=ei(),a=ti();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),ri=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),ii=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=ri(),r=or(),i=ar(),a=W();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),ai=c({$id:()=>si,$schema:()=>oi,default:()=>fi,definitions:()=>li,properties:()=>di,title:()=>ci,type:()=>ui}),oi,si,ci,li,ui,di,fi,pi=o((()=>{oi=`http://json-schema.org/draft-07/schema#`,si=`http://json-schema.org/draft-07/schema#`,ci=`Core schema meta-schema`,li={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},ui=[`object`,`boolean`],di={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},fi={$schema:oi,$id:si,title:ci,definitions:li,type:ui,properties:di,default:!0}})),mi=u(s(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=yr(),r=ni(),i=ii(),a=(pi(),d(ai).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=c;var l=rr();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=U();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var f=ir();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return f.default}});var p=ar();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return p.default}})}))(),1),hi={$schema:`http://json-schema.org/draft-07/schema#`,$id:`https://kmap.dev/schemas/semantic-chart-config/1.0.0`,title:`SemanticChartConfig`,description:`Agent 语义化图表配置`,type:`object`,required:[`version`,`data`],additionalProperties:!1,properties:{version:{type:`string`,pattern:`^[0-9]+\\.[0-9]+\\.[0-9]+$`,description:`semver 版本号`},data:{$ref:`#/$defs/DataConfig`},indicators:{$ref:`#/$defs/IndicatorsConfig`},markers:{$ref:`#/$defs/MarkersConfig`},chart:{$ref:`#/$defs/ChartOptions`},theme:{$ref:`#/$defs/ThemeConfig`}},$defs:{DataConfig:{type:`object`,required:[`source`,`symbol`,`startDate`,`endDate`,`period`,`adjust`],additionalProperties:!1,properties:{source:{type:`string`,enum:[`baostock`,`dongcai`]},symbol:{type:`string`,pattern:`^[0-9]{6}$`},exchange:{type:`string`,enum:[`SH`,`SZ`,`BJ`]},startDate:{type:`string`,format:`date`},endDate:{type:`string`,format:`date`},period:{type:`string`,enum:[`daily`,`weekly`,`monthly`,`5min`,`15min`,`30min`,`60min`]},adjust:{type:`string`,enum:[`qfq`,`hfq`,`none`]}}},IndicatorsConfig:{type:`object`,additionalProperties:!1,properties:{main:{type:`array`,items:{$ref:`#/$defs/MainIndicatorConfig`},maxItems:5},sub:{type:`array`,items:{$ref:`#/$defs/SubIndicatorConfig`},maxItems:5}}},MainIndicatorConfig:{type:`object`,required:[`type`,`enabled`],additionalProperties:!1,properties:{type:{type:`string`,enum:[`MA`,`BOLL`]},enabled:{type:`boolean`},params:{type:`object`}},allOf:[{if:{properties:{type:{const:`MA`}},required:[`type`]},then:{properties:{params:{type:`object`,additionalProperties:!1,properties:{periods:{type:`array`,items:{type:`integer`,minimum:1,maximum:250},minItems:1,maxItems:5}}}}},else:{properties:{params:{type:`object`,additionalProperties:!1,properties:{period:{type:`integer`,minimum:1,maximum:100},multiplier:{type:`number`,minimum:.1,maximum:5}}}}}}]},SubIndicatorConfig:{type:`object`,required:[`type`,`enabled`],additionalProperties:!1,properties:{type:{type:`string`,enum:[`VOLUME`,`MACD`,`RSI`,`CCI`,`STOCH`,`MOM`,`WMSR`,`KST`,`FASTK`]},enabled:{type:`boolean`},params:{type:`object`}},allOf:[{if:{properties:{type:{const:`MACD`}}},then:{properties:{params:{type:`object`,additionalProperties:!1,properties:{fast:{type:`integer`,minimum:1,maximum:50},slow:{type:`integer`,minimum:1,maximum:100},signal:{type:`integer`,minimum:1,maximum:50}}}}}},{if:{properties:{type:{const:`RSI`}}},then:{properties:{params:{type:`object`,additionalProperties:!1,properties:{period1:{type:`integer`,minimum:1,maximum:100},period2:{type:`integer`,minimum:1,maximum:100},period3:{type:`integer`,minimum:1,maximum:100}}}}}}]},MarkersConfig:{type:`object`,additionalProperties:!1,properties:{showVolumePriceMarkers:{type:`boolean`},showExtremaMarkers:{type:`boolean`},customMarkers:{type:`array`,items:{$ref:`#/$defs/CustomMarker`},maxItems:100},legend:{$ref:`#/$defs/LegendConfig`}}},CustomMarker:{type:`object`,required:[`id`,`date`,`shape`],additionalProperties:!1,properties:{id:{type:`string`,maxLength:64},date:{type:`string`,description:`日期时间字符串,日K用 YYYY-MM-DD,分钟K用 YYYY-MM-DD HH:mm`,pattern:`^[0-9]{4}-[0-9]{2}-[0-9]{2}( [0-9]{2}:[0-9]{2})?$`},shape:{type:`string`,enum:[`arrow_up`,`arrow_down`,`flag`,`circle`,`rectangle`,`diamond`]},groupKey:{type:`string`,maxLength:32},offset:{type:`object`,additionalProperties:!1,properties:{x:{type:`number`,minimum:-500,maximum:500},y:{type:`number`,minimum:-500,maximum:500}}},style:{$ref:`#/$defs/MarkerStyle`},label:{$ref:`#/$defs/MarkerLabel`},metadata:{type:`object`,maxProperties:20,additionalProperties:{type:[`string`,`number`,`boolean`,`null`],maxLength:200}}}},MarkerStyle:{type:`object`,additionalProperties:!1,properties:{fillColor:{type:`string`,pattern:`^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$`},strokeColor:{type:`string`,pattern:`^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$`},textColor:{type:`string`,pattern:`^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$`},size:{type:`number`,minimum:4,maximum:50},lineWidth:{type:`number`,minimum:.5,maximum:10},opacity:{type:`number`,minimum:0,maximum:1}}},MarkerLabel:{type:`object`,required:[`text`],additionalProperties:!1,properties:{text:{type:`string`,maxLength:50},position:{type:`string`,enum:[`left`,`right`,`top`,`bottom`,`inside`]},align:{type:`string`,enum:[`start`,`center`,`end`]},fontSize:{type:`number`,minimum:8,maximum:24},offset:{type:`object`,additionalProperties:!1,properties:{x:{type:`number`,minimum:-500,maximum:500},y:{type:`number`,minimum:-500,maximum:500}}}}},LegendConfig:{type:`object`,additionalProperties:!1,properties:{enabled:{type:`boolean`},position:{type:`string`,enum:[`bottom-right`,`bottom-left`,`top-right`,`top-left`]},onClick:{type:`string`,enum:[`highlight`,`toggle`,`none`]}}},ChartOptions:{type:`object`,additionalProperties:!1,properties:{kWidth:{type:`number`,minimum:2,maximum:50},kGap:{type:`number`,minimum:0,maximum:20},autoScrollToRight:{type:`boolean`}}},ThemeConfig:{type:`object`,additionalProperties:!1,properties:{priceUpColor:{type:`string`,pattern:`^#[0-9a-fA-F]{6}$`},priceDownColor:{type:`string`,pattern:`^#[0-9a-fA-F]{6}$`}}}}},gi=[`__proto__`,`constructor`,`prototype`],_i=/^(#[0-9a-fA-F]{3,8}|rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)|rgba\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*[\d.]+\s*\))$/,vi={SH:/^(600|601|603|605|688)\d{3}$/,SZ:/^(000|001|002|003|300|301)\d{3}$/,BJ:/^(83|87|43|82)\d{4}$/};function yi(e){return{"5min":30,"15min":60,"30min":90,"60min":180,daily:365*3,weekly:365*5,monthly:365*10}[e]??365}var bi=(typeof document<`u`?document.createElement(`canvas`):null)?.getContext(`2d`)??null,xi=class e{ajv;limits;constructor(){this.ajv=new mi.default({allErrors:!0,allowUnionTypes:!0}),this.ajv.addFormat(`date`,{type:`string`,validate:e=>/^\d{4}-\d{2}-\d{2}$/.test(e)}),this.ajv.addSchema(hi),this.limits={maxJsonSize:64*1024,maxIndicators:10,maxCustomMarkers:100}}validateRawInput(e){return(typeof TextEncoder<`u`?new TextEncoder().encode(e).byteLength:e.length*3)>this.limits.maxJsonSize?{valid:!1,errors:[`JSON payload too large (max 64KB)`]}:{valid:!0}}validate(e){if(!e||typeof e!=`object`)return{valid:!1,errors:[`Config must be an object`]};let t=this.checkPrototypePollution(e);return t.valid?this.ajv.validate(`https://kmap.dev/schemas/semantic-chart-config/1.0.0`,e)?{valid:!0}:{valid:!1,errors:this.ajv.errors?.map(e=>`${e.instancePath} ${e.message}`)||[`Schema validation failed`]}:t}securityCheck(e){let t=[],n=this.checkDateRange(e.data);n.valid||t.push(...n.errors||[]);let r=this.checkSymbol(e.data);if(r.valid||t.push(...r.errors||[]),e.indicators&&(e.indicators.main?.length||0)+(e.indicators.sub?.length||0)>this.limits.maxIndicators&&t.push(`Too many indicators (max ${this.limits.maxIndicators})`),(e.markers?.customMarkers?.length||0)>this.limits.maxCustomMarkers&&t.push(`Too many custom markers (max ${this.limits.maxCustomMarkers})`),e.markers?.customMarkers)for(let n of e.markers.customMarkers){if(n.style){let e=this.checkMarkerStyle(n.style,n.id);t.push(...e)}let e=this.checkMarkerDate(n.date,n.id);t.push(...e)}return{passed:t.length===0,violations:t.length>0?t:void 0}}checkPrototypePollution(e,t=``){if(!e||typeof e!=`object`)return{valid:!0};let n=[];for(let r of Object.keys(e))gi.includes(r)&&n.push(`Forbidden key "${r}" found at ${t}`);return n.length>0?{valid:!1,errors:n}:{valid:!0}}checkDateRange(e){let t=[],n=new Date(e.startDate),r=new Date(e.endDate);if(isNaN(n.getTime())&&t.push(`Invalid startDate: ${e.startDate}`),isNaN(r.getTime())&&t.push(`Invalid endDate: ${e.endDate}`),t.length>0)return{valid:!1,errors:t};let i=yi(e.period),a=Math.ceil((r.getTime()-n.getTime())/(1e3*60*60*24));return a>i&&t.push(`Date range exceeds maximum for period "${e.period}" (max ${i} days, got ${a})`),a<0&&t.push(`endDate must be after startDate`),t.length>0?{valid:!1,errors:t}:{valid:!0}}checkSymbol(e){let{symbol:t,exchange:n}=e;if(n){if(!vi[n].test(t))return{valid:!1,errors:[`Invalid symbol "${t}" for exchange "${n}"`]}}else if(!Object.values(vi).some(e=>e.test(t)))return{valid:!1,errors:[`Invalid symbol format: "${t}"`]};return{valid:!0}}checkMarkerStyle(e,t){let n=[],r=[`fillColor`,`strokeColor`,`textColor`];for(let i of r){let r=e[i];typeof r==`string`&&!_i.test(r)&&n.push(`Invalid ${i} in marker "${t}": ${r}`)}if(bi)for(let i of r){let r=e[i];typeof r==`string`&&(bi.fillStyle=`#000000`,bi.fillStyle=r,bi.fillStyle===`#000000`&&r!==`#000000`&&!r.startsWith(`#000`)&&n.push(`Potentially unsafe ${i} in marker "${t}": ${r}`))}return n}static DATE_PATTERN=/^\d{4}-\d{2}-\d{2}( \d{2}:\d{2})?$/;checkMarkerDate(t,n){let r=[];if(!e.DATE_PATTERN.test(t))return r.push(`Invalid date format in marker "${n}": ${t} (expected YYYY-MM-DD or YYYY-MM-DD HH:mm)`),r;let i=t.includes(` `),a;if(i)a=new Date(t);else{let[e,n,r]=t.split(`-`).map(Number);a=new Date(Date.UTC(e,n-1,r))}return isNaN(a.getTime())&&r.push(`Invalid date value in marker "${n}": ${t}`),r}},Si=class{chart;validator;events;constructor(e){this.chart=e,this.validator=new xi,this.events=new p}async applyConfig(e){let t=this.validator.validate(e);if(!t.valid)return{success:!1,errors:t.errors};let n=this.validator.securityCheck(e);if(!n.passed)return{success:!1,errors:n.violations};this.events.emit(`config:loading`,void 0);try{return await this.doApplyConfig(e),this.events.emit(`config:ready`,void 0),{success:!0}}catch(e){return this.events.emit(`config:error`,e),{success:!1,errors:[e instanceof Error?e.message:String(e)]}}}on(e,t){this.events.on(e,t)}off(e,t){this.events.off(e,t)}async doApplyConfig(e){console.log(`[Semantic] doApplyConfig start, data config:`,e.data);let t=await Un(e.data.source,{symbol:e.data.symbol,startDate:e.data.startDate,endDate:e.data.endDate,period:e.data.period,adjust:e.data.adjust});console.log(`[Semantic] fetched data:`,t.length,`items`),this.chart.updateData(t),e.indicators&&(console.log(`[Semantic] applying indicators:`,e.indicators),this.applyIndicators(e.indicators.main,e.indicators.sub)),e.markers&&(console.log(`[Semantic] applying markers:`,e.markers.customMarkers?.length,`markers`),this.applyMarkers(e.markers.customMarkers,e.data.period)),e.chart&&this.applyChartOptions(e.chart),console.log(`[Semantic] doApplyConfig done`)}applyIndicators(e,t){if(e){for(let t of e)if(t.enabled)switch(t.type){case`MA`:this.applyMAIndicator(t);break;case`BOLL`:this.applyBOLLIndicator(t);break;case`EXPMA`:this.applyEXPMAIndicator(t);break;case`ENE`:this.applyENEIndicator(t);break}}if(this.chart.clearSubPanes(),t)for(let e of t)this.applySubIndicator(e)}applyMAIndicator(e){let t=e.params?.periods||[5,10,20,30,60],n={};for(let e of t)e===5?n.ma5=!0:e===10?n.ma10=!0:e===20?n.ma20=!0:e===30?n.ma30=!0:e===60&&(n.ma60=!0);console.log(`[Semantic] applyMAIndicator, periods:`,t,`maFlags:`,n),this.chart.updateRendererConfig(`ma`,n)}applyBOLLIndicator(e){let t={period:e.params?.period||20,multiplier:e.params?.multiplier||2};this.chart.updateRendererConfig(`boll`,t)}applyEXPMAIndicator(e){let t={fastPeriod:e.params?.fastPeriod||12,slowPeriod:e.params?.slowPeriod||50};this.chart.updateRendererConfig(`expma`,t)}applyENEIndicator(e){let t={period:e.params?.period||10,deviation:e.params?.deviation||11};this.chart.updateRendererConfig(`ene`,t)}applySubIndicator(e){if(!e.enabled)return;let{type:t,params:n}=e;this.chart.createSubPane(t,n)||console.warn(`[Semantic] Failed to create sub pane for ${t}`)}applyMarkers(e,t){if(!e||e.length===0){this.chart.clearCustomMarkers();return}let n=e.map(e=>({id:e.id,date:e.date,timestamp:Ci(e.date,t||`daily`),shape:e.shape,groupKey:e.groupKey,offset:e.offset,style:e.style,label:e.label,metadata:e.metadata}));this.chart.updateCustomMarkers(n)}applyChartOptions(e){e.autoScrollToRight}};function Ci(e,t){if(e.includes(` `)){let[t,n]=e.split(` `),r=t.split(`-`).map(Number),i=r[0],a=r[1],o=r[2],s=n.split(`:`).map(Number),c=s[0],l=s[1];return Date.UTC(i,a-1,o,c-8,l,0,0)}else{let t=e.split(`-`).map(Number),n=t[0],r=t[1],i=t[2];return Date.UTC(n,r-1,i,-8,0,0,0)}}var wi={arrow_up:16,arrow_down:16,flag:14,circle:12,rectangle:14,diamond:12};function Ti(e,t,n,r,i,a){let o=a.fillColor||`#000000`,s=a.strokeColor||o,c=i||wi[t];switch(e.fillStyle=o,e.strokeStyle=s,e.lineWidth=a.lineWidth||1,a.opacity!==void 0&&(e.globalAlpha=a.opacity),t){case`arrow_up`:Ai(e,n,r,c);break;case`arrow_down`:ji(e,n,r,c);break;case`circle`:Mi(e,n,r,c);break;case`rectangle`:Ni(e,n,r,c);break;case`diamond`:Pi(e,n,r,c);break;case`flag`:Fi(e,n,r,c);break}e.globalAlpha=1}var Ei=2.5,Di=4;function Oi(e,t,n,r,i,a,o=!1){let s=t.fontSize||12,c=a.textColor||`#333333`,l=i/2;e.font=`${s}px sans-serif`,e.fillStyle=c,e.textBaseline=`middle`;let u=i*Ei,d=ki(e,t.text,u),f=e.measureText(d).width,p=n,m=r;switch(t.position){case`left`:p=n-l-f/2-Di;break;case`right`:p=n+l+f/2+Di;break;case`top`:m=r-l-s/2-Di;break;case`bottom`:m=r+l+s/2+Di;break;default:m=o?r-l-s/2-Di:r+l+s/2+Di;break}t.offset&&(p+=t.offset.x||0,m+=t.offset.y||0),e.textAlign=t.align||`center`,e.fillText(d,p,m)}function ki(e,t,n){if(e.measureText(t).width<=n)return t;let r=e.measureText(`…`).width,i=0,a=t.length;for(;i<a;){let o=Math.ceil((i+a)/2),s=t.slice(0,o);e.measureText(s).width+r<=n?i=o:a=o-1}return t.slice(0,i)+`…`}function Ai(e,t,n,r){e.beginPath(),e.moveTo(t,n-r/2),e.lineTo(t-r/2,n+r/2),e.lineTo(t+r/2,n+r/2),e.closePath(),e.fill()}function ji(e,t,n,r){e.beginPath(),e.moveTo(t,n+r/2),e.lineTo(t-r/2,n-r/2),e.lineTo(t+r/2,n-r/2),e.closePath(),e.fill()}function Mi(e,t,n,r){e.beginPath(),e.arc(t,n,r/2,0,Math.PI*2),e.fill()}function Ni(e,t,n,r){e.fillRect(t-r/2,n-r/2,r,r)}function Pi(e,t,n,r){e.beginPath(),e.moveTo(t,n-r/2),e.lineTo(t+r/2,n),e.lineTo(t,n+r/2),e.lineTo(t-r/2,n),e.closePath(),e.fill()}function Fi(e,t,n,r){e.beginPath(),e.moveTo(t-r/4,n+r/2),e.lineTo(t-r/4,n-r/2),e.stroke(),e.beginPath(),e.moveTo(t-r/4,n-r/2),e.lineTo(t+r/2,n-r/4),e.lineTo(t-r/4,n),e.closePath(),e.fill()}function Ii(e,t,n,r,i,a){let o=a/2;switch(n){case`circle`:let n=e-r,a=t-i;return n*n+a*a<=o*o;default:return e>=r-o&&e<=r+o&&t>=i-o&&t<=i+o}}var Li=function(e){return e.Registered=`registered`,e.Installed=`installed`,e.Error=`error`,e}({});function Ri(e){return{id:e.id,top:e.top,height:e.height,yAxis:{priceToY:t=>e.yAxis.priceToY(t),yToPrice:t=>e.yAxis.yToPrice(t),getPaddingTop:()=>e.yAxis.getPaddingTop(),getPaddingBottom:()=>e.yAxis.getPaddingBottom(),getPriceOffset:()=>e.yAxis.getPriceOffset()},priceRange:e.priceRange}}var zi=Symbol(`global-pane`),q={SYSTEM_YAXIS:-20,SYSTEM_XAXIS:-20,BACKGROUND:0,GRID:10,INDICATOR:30,MAIN:50,OVERLAY:80,FOREGROUND:100,SYSTEM_BORDER:120,SYSTEM_CROSSHAIR:150},Bi=class{plugins=new Map;register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);let n={plugin:e,config:{enabled:!0,priority:0,...t},state:`registered`};return this.plugins.set(e.name,n),n}unregister(e){return this.plugins.delete(e)}get(e){return this.plugins.get(e)}getPlugin(e){return this.plugins.get(e)?.plugin}getAll(){return Array.from(this.plugins.values())}getEnabled(){return this.getAll().filter(e=>e.config?.enabled!==!1)}updateState(e,t,n){let r=this.plugins.get(e);r&&(r.state=t,n&&(r.error=n))}has(e){return this.plugins.has(e)}clear(){this.plugins.clear()}},Vi=class{hooks=new Map;tap(e,t,n=0){this.hooks.has(e)||this.hooks.set(e,[]);let r=this.hooks.get(e);r.push({name:e,fn:t,priority:n}),r.sort((e,t)=>e.priority-t.priority)}untap(e,t){let n=this.hooks.get(e);if(n){let e=n.findIndex(e=>e.fn===t);e!==-1&&n.splice(e,1)}}async call(e,t){let n=this.hooks.get(e);if(!n||n.length===0)return[];let r=[];for(let{fn:i}of n)try{let e=await i(t);r.push(e)}catch(t){console.error(`[HookSystem] Error in hook "${e}":`,t)}return r}callSync(e,t){let n=this.hooks.get(e);if(!n||n.length===0)return[];let r=[];for(let{fn:i}of n)try{let e=i(t);r.push(e)}catch(t){console.error(`[HookSystem] Error in hook "${e}":`,t)}return r}clear(){this.hooks.clear()}hookCount(e){return this.hooks.get(e)?.length??0}},Hi=class{configs=new Map;defaults=new Map;registerDefaults(e,t){this.defaults.set(e,{...t}),this.configs.has(e)||this.configs.set(e,new Map);let n=this.configs.get(e);for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r)}get(e,t,n){let r=this.configs.get(e);if(r?.has(t))return r.get(t);let i=this.defaults.get(e);return i&&t in i?i[t]:n}set(e,t,n){this.configs.has(e)||this.configs.set(e,new Map),this.configs.get(e).set(t,n)}setAll(e,t){for(let[n,r]of Object.entries(t))this.set(e,n,r)}getAll(e){let t=this.configs.get(e);return{...this.defaults.get(e)||{},...t?Object.fromEntries(t):{}}}clear(e){e?this.configs.delete(e):this.configs.clear()}},Ui=class{registry;eventBus;hookSystem;configManager;isDestroyed=!1;constructor(){this.registry=new Bi,this.eventBus=new p,this.hookSystem=new Vi,this.configManager=new Hi}events={on:(e,t)=>{this.eventBus.on(e,t)},off:(e,t)=>{this.eventBus.off(e,t)},emit:(e,t)=>{this.eventBus.emit(e,t)},once:(e,t)=>{this.eventBus.once(e,t)}};hooks={tap:(e,t,n=0)=>{this.hookSystem.tap(e,t,n)},untap:(e,t)=>{this.hookSystem.untap(e,t)},call:async(e,t)=>this.hookSystem.call(e,t),callSync:(e,t)=>this.hookSystem.callSync(e,t)};getConfig(e,t,n){return this.configManager.get(e,t,n)}setConfig(e,t,n){this.configManager.set(e,t,n)}getPlugin(e){return this.registry.getPlugin(e)}log(e,t,...n){let r=`[${new Date().toISOString()}] [${e.toUpperCase()}]`;console[e](`${r} ${t}`,...n)}async use(e,t){if(this.ensureNotDestroyed(),this.registry.has(e.name))throw Error(`Plugin "${e.name}" is already installed`);try{let n=this.registry.register(e,t);t&&this.configManager.setAll(e.name,t),await this.hooks.call(`plugin:beforeInstall`,{plugin:e,config:t}),await e.install(this,n.config),this.registry.updateState(e.name,`installed`),await this.hooks.call(`plugin:afterInstall`,{plugin:e,config:t}),this.log(`info`,`Plugin "${e.name}" installed successfully`)}catch(t){throw this.registry.updateState(e.name,`error`,t instanceof Error?t:Error(String(t))),this.log(`error`,`Failed to install plugin "${e.name}":`,t),t}}async remove(e){this.ensureNotDestroyed();let t=this.registry.get(e);if(!t)throw Error(`Plugin "${e}" is not installed`);try{await this.hooks.call(`plugin:beforeUninstall`,{name:e}),t.plugin.uninstall&&await t.plugin.uninstall(),this.registry.unregister(e),this.configManager.clear(e),await this.hooks.call(`plugin:afterUninstall`,{name:e}),this.log(`info`,`Plugin "${e}" removed successfully`)}catch(t){throw this.log(`error`,`Failed to remove plugin "${e}":`,t),t}}getPlugins(){return this.registry.getAll()}getState(e){return this.registry.get(e)?.state}async destroy(){if(!this.isDestroyed){for(let e of this.registry.getAll())try{e.plugin.uninstall&&await e.plugin.uninstall()}catch(t){this.log(`error`,`Error uninstalling "${e.plugin.name}":`,t)}this.registry.clear(),this.eventBus.clear(),this.hookSystem.clear(),this.configManager.clear(),this.isDestroyed=!0,this.log(`info`,`PluginHost destroyed`)}}ensureNotDestroyed(){if(this.isDestroyed)throw Error(`PluginHost has been destroyed`)}};function Wi(){return new Ui}var Gi=Symbol(`renderer:global-cache`),Ki=class{plugins=new Map;pluginHost=null;enabledState=new Map;groupCache=new Map;mergedCache=new Map;knownPaneIds=new Set([`main`]);cacheInvalid=!0;onInvalidate=null;setInvalidateCallback(e){this.onInvalidate=e}setPluginHost(e){this.pluginHost=e}addKnownPaneId(e){this.knownPaneIds.add(e),this.cacheInvalid=!0}removeKnownPaneId(e){this.knownPaneIds.delete(e),this.cacheInvalid=!0}getKnownPaneIds(){return Array.from(this.knownPaneIds)}register(e){if(this.plugins.has(e.name)){console.warn(`Renderer plugin "${e.name}" already registered`);return}this.plugins.set(e.name,e),e.enabled!==void 0&&this.enabledState.set(e.name,e.enabled),this.cacheInvalid=!0;let t=e;if(t.onInstall&&this.pluginHost)try{t.onInstall(this.pluginHost)}catch(t){console.error(`[RendererPlugin] ${e.name} onInstall error:`,t)}this.onInvalidate?.()}unregister(e){let t=this.plugins.get(e);if(t){if(t.onUninstall)try{t.onUninstall()}catch(e){console.error(`[RendererPlugin] ${t.name} onUninstall error:`,e)}this.plugins.delete(e),this.enabledState.delete(e),this.cacheInvalid=!0,this.onInvalidate?.()}}clear(){for(let e of this.plugins.values())if(e.onUninstall)try{e.onUninstall()}catch(t){console.error(`[RendererPlugin] ${e.name} onUninstall error:`,t)}this.plugins.clear(),this.enabledState.clear(),this.groupCache.clear(),this.mergedCache.clear(),this.cacheInvalid=!1}mergeSorted(e,t){let n=[],r=0,i=0;for(;r<e.length&&i<t.length;)e[r].priority<=t[i].priority?n.push(e[r++]):n.push(t[i++]);return[...n,...e.slice(r),...t.slice(i)]}rebuildCache(){if(!this.cacheInvalid)return;this.groupCache.clear(),this.mergedCache.clear();for(let e of this.plugins.values()){let t=typeof e.paneId==`symbol`?Gi:e.paneId;this.groupCache.has(t)||this.groupCache.set(t,[]),this.groupCache.get(t).push(e)}for(let[,e]of this.groupCache)e.sort((e,t)=>e.priority-t.priority);let e=this.groupCache.get(Gi)??[];for(let t of this.knownPaneIds){let n=this.groupCache.get(t)??[],r=this.mergeSorted(n,e);this.mergedCache.set(t,r)}this.mergedCache.set(Gi,[...e]),this.cacheInvalid=!1}getRenderers(e){this.rebuildCache();let t=this.mergedCache.get(e);return t||(t=this.mergedCache.get(Gi)??[],this.mergedCache.set(e,t)),t.filter(e=>{if(e.isSystem)return!1;let t=this.enabledState.get(e.name);return t===void 0?e.enabled!==!1:t})}render(e,t){let n=this.getRenderers(e),r=[];for(let e of n)try{e.draw(t)}catch(n){let i=n instanceof Error?n:Error(String(n));console.error(`[RendererPlugin] ${e.name} draw error:`,i),r.push({name:e.name,error:{message:i.message,stack:i.stack},paneId:t.pane.id,timestamp:Date.now()})}return r}renderPlugin(e,t){let n=this.plugins.get(e);if(!n)return[];let r=this.enabledState.get(e);if(!(r===void 0?n.enabled!==!1:r))return[];let i=[];try{n.draw(t)}catch(n){let r=n instanceof Error?n:Error(String(n));console.error(`[RendererPlugin] ${e} draw error:`,r),i.push({name:e,error:{message:r.message,stack:r.stack},paneId:t.pane.id,timestamp:Date.now()})}return i}setEnabled(e,t){this.plugins.has(e)&&(this.enabledState.set(e,t),this.onInvalidate?.())}updateConfig(e,t){let n=this.plugins.get(e);return n?.setConfig?(n.setConfig(t),this.onInvalidate?.(),!0):!1}getAllPlugins(){return Array.from(this.plugins.values())}getPlugin(e){return this.plugins.get(e)}notifyDataUpdate(e,t){for(let n of this.plugins.values()){if(!n.onDataUpdate)continue;let r=this.enabledState.get(n.name);if(r===void 0?n.enabled!==!1:r)try{n.onDataUpdate(e,t)}catch(e){console.error(`[RendererPlugin] ${n.name} onDataUpdate error:`,e)}}}notifyResize(e,t){let n=this.getRenderers(e);for(let e of n)if(e.onResize)try{e.onResize(t)}catch(t){console.error(`[RendererPlugin] ${e.name} onResize error:`,t)}}},qi=1.2,Ji=24,Yi=6;function Xi(e){switch(e){case`arrow_up`:case`flag`:return!0;default:return!1}}function Zi(){return{name:`customMarkers`,version:`1.0.0`,description:`自定义标记渲染器`,debugName:`自定义标记`,paneId:`main`,priority:q.OVERLAY,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,kLinePositions:s,markerManager:c}=e;if(!c)return;let l=c.getCustomMarkers();if(!l||l.length===0)return;let u=r;if(u.length&&n.id===`main`){t.save(),t.translate(-a,0);for(let e of l){let r=$i(u,e.timestamp);if(r===-1||r<i.start||r>=i.end)continue;let l=r-i.start;if(l<0||l>=s.length)continue;let d=s[l]+o/2,f=u[r],p=e.style?.size,m=Qi(o,p),h=(e.offset?.y??0)<0?!0:(e.offset?.y??0)>0?!1:Xi(e.shape),g;g=h?n.yAxis.priceToY(f.high)-m/2-4+(e.offset?.y??0):n.yAxis.priceToY(f.low)+m/2+4+(e.offset?.y??0);let _=d+(e.offset?.x??0),v=g;Ti(t,e.shape,_,v,m,e.style||{}),e.label&&Oi(t,e.label,_,v,m,e.style||{},h),c.setCustomMarkerPosition(e.id,_-a,v,m,e.shape)}t.restore()}}}}function Qi(e,t){let n=e*qi;return Math.max(Yi,Math.min(n,t??Ji))}function $i(e,t){let n=0,r=e.length-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=e[i]?.timestamp;if(a===void 0)break;if(a===t)return i;a<t?n=i+1:r=i-1}return-1}function ea(e){let t=new Intl.DateTimeFormat(`zh-CN`,{timeZone:`Asia/Shanghai`,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(new Date(e)).reduce((e,t)=>(t.type!==`literal`&&(e[t.type]=t.value),e),{});return`${t.year}-${t.month}-${t.day}`}function ta(e){let t=new Date(e),n=t.getFullYear(),r=t.getMonth()+1;return r===1?{text:String(n),isYear:!0}:{text:`${r}月`,isYear:!1}}function na(e){let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}`}var ra=ea,ia=ea;function aa(e){if(e.length===0)return[];let t=[0],n=na(e[0].timestamp);for(let r=1;r<e.length;r++){let i=e[r];if(!i)continue;let a=na(i.timestamp);a!==n&&(t.push(r),n=a)}return t}var oa={PRIMARY:`hsl(210, 9%, 31%)`,SECONDARY:`hsl(210, 9%, 35%)`,TERTIARY:`hsl(210, 8%, 50%)`,WEAK:`hsl(210, 7%, 65%)`,WHITE:`rgba(255, 255, 255, 0.92)`},J={UP:`rgba(214, 10, 34, 1)`,UP_LIGHT:`rgba(214, 10, 34, 0.92)`,UP_TICK:`hsl(0, 60%, 50%)`,DOWN:`rgba(3, 123, 102, 1)`,DOWN_LIGHT:`rgba(3, 123, 102, 0.92)`,DOWN_TICK:`hsl(150, 30%, 60%)`,NEUTRAL:`rgba(0, 0, 0, 0.78)`,LAST_PRICE:`rgb(183, 22, 22)`},sa={WHITE:`rgb(255, 255, 255)`,LIGHT_GRAY:`rgba(255, 255, 255, 0.92)`,PURE_WHITE:`#ffffff`,TRANSPARENT:`transparent`,ACTIVE:`#1890ff`,ACTIVE_HOVER:`#40a9ff`,HOVER:`#f0f0f0`},ca={DARK:`rgba(0, 0, 0, 0.12)`,MEDIUM:`rgba(0, 0, 0, 0.10)`,LIGHT:`rgba(0, 0, 0, 0.08)`,SEPARATOR:`rgba(0, 0, 0, 0.10)`,BUTTON:`#d0d0d0`},la={HORIZONTAL:`rgba(0, 0, 0, 0.06)`,VERTICAL:`rgba(0, 0, 0, 0.12)`},Y={MA5:`rgba(255, 193, 37, 1)`,MA10:`rgba(190, 131, 12, 1)`,MA20:`rgba(69, 112, 249, 1)`,MA30:`rgba(76, 175, 80, 1)`,MA60:`rgba(156, 39, 176, 1)`},ua={UPPER:`rgba(178, 34, 34, 1)`,MIDDLE:`rgba(69, 112, 249, 1)`,LOWER:`rgba(34, 139, 34, 1)`,BAND_FILL:`rgba(100, 149, 237, 0.1)`},X={DIF:`rgba(69, 112, 249, 1)`,DEA:`rgba(255, 152, 0, 1)`,BAR_UP:`#ff5252`,BAR_UP_LIGHT:`#fccbcd`,BAR_DOWN:`#22ab94`,BAR_DOWN_LIGHT:`#ace5dc`},da={RSI1:`rgba(69, 112, 249, 1)`,RSI2:`rgba(255, 152, 0, 1)`,RSI3:`rgba(156, 39, 176, 1)`},fa={CCI:`rgba(69, 112, 249, 1)`,OVERBOUGHT:`rgba(214, 10, 34, 0.5)`,OVERSOLD:`rgba(3, 123, 102, 0.5)`},pa={K:`rgba(69, 112, 249, 1)`,D:`rgba(255, 152, 0, 1)`,J:`rgba(156, 39, 176, 1)`},ma={MOM:`rgba(69, 112, 249, 1)`,ZERO:`rgba(0, 0, 0, 0.2)`},ha={WMSR:`rgba(69, 112, 249, 1)`,OVERBOUGHT:`rgba(214, 10, 34, 0.5)`,OVERSOLD:`rgba(3, 123, 102, 0.5)`},ga={KST:`rgba(69, 112, 249, 1)`,SIGNAL:`rgba(255, 152, 0, 1)`},_a={FAST:`rgba(255, 152, 0, 1)`,SLOW:`rgba(69, 112, 249, 1)`},va={UPPER:`rgba(214, 10, 34, 1)`,MIDDLE:`rgba(69, 112, 249, 1)`,LOWER:`rgba(3, 123, 102, 1)`,BAND_FILL:`rgba(69, 112, 249, 0.08)`},ya={LINE:`rgba(0, 0, 0, 0.28)`,LABEL_BG:`rgb(0, 0, 0)`,LABEL_TEXT:`rgba(255, 255, 255, 0.92)`},ba=J.UP,xa=J.DOWN,Sa=J.NEUTRAL;function Ca(e){return e>0?ba:e<0?xa:Sa}function wa(e,t=2){let n=Math.abs(e);return n>=1e8?`${(e/1e8).toFixed(t)}亿`:n>=1e4?`${(e/1e4).toFixed(t)}万`:`${Math.round(e)}`}function Ta(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}`}function Ea(e,t=2){return`${e.toFixed(t)}%`}function Da(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}%`}function Oa(e,t){let n=t?.close??e.open;return Ca(e.open-n)}function ka(e){return Ca(e.close-e.open)}function Aa(e){return typeof e.changePercent==`number`?Ca(e.changePercent):typeof e.changeAmount==`number`?Ca(e.changeAmount):Sa}var ja={class:`kline-tooltip__title`},Ma={key:0},Na={class:`kline-tooltip__grid`},Pa={class:`row`},Fa={class:`row`},Ia={class:`row`},La={class:`row`},Ra={key:0,class:`row`},za={key:1,class:`row`},Ba={key:2,class:`row`},Va={key:3,class:`row`},Ha={key:4,class:`row`},Ua={key:5,class:`row`},Wa=(0,f.defineComponent)({__name:`KLineTooltip`,props:{k:{},index:{},data:{},pos:{},setEl:{type:Function}},setup(e){let t=e;function n(e){t.setEl?.(e)}let r=(0,f.computed)(()=>{let e=t.k;if(!e)return Sa;let n=t.index;return Oa(e,typeof n==`number`&&n>0?t.data[n-1]:void 0)}),i=(0,f.computed)(()=>{let e=t.k;return e?ka(e):Sa}),a=(0,f.computed)(()=>{let e=t.k;return e?Aa(e):Sa});return(t,o)=>e.k?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,ref:n,class:`kline-tooltip`,style:(0,f.normalizeStyle)({left:`${e.pos.x}px`,top:`${e.pos.y}px`})},[(0,f.createElementVNode)(`div`,ja,[e.k.stockCode?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Ma,(0,f.toDisplayString)(e.k.stockCode),1)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(ra)(e.k.timestamp)),1)]),(0,f.createElementVNode)(`div`,Na,[(0,f.createElementVNode)(`div`,Pa,[o[0]||=(0,f.createElementVNode)(`span`,null,`开`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:r.value})},(0,f.toDisplayString)(e.k.open.toFixed(2)),5)]),(0,f.createElementVNode)(`div`,Fa,[o[1]||=(0,f.createElementVNode)(`span`,null,`高`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(e.k.high.toFixed(2)),1)]),(0,f.createElementVNode)(`div`,Ia,[o[2]||=(0,f.createElementVNode)(`span`,null,`低`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(e.k.low.toFixed(2)),1)]),(0,f.createElementVNode)(`div`,La,[o[3]||=(0,f.createElementVNode)(`span`,null,`收`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:i.value})},(0,f.toDisplayString)(e.k.close.toFixed(2)),5)]),typeof e.k.volume==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ra,[o[4]||=(0,f.createElementVNode)(`span`,null,`成交量`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(wa)(e.k.volume)),1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.turnover==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,za,[o[5]||=(0,f.createElementVNode)(`span`,null,`成交额`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(wa)(e.k.turnover)),1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.amplitude==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ba,[o[6]||=(0,f.createElementVNode)(`span`,null,`振幅`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(e.k.amplitude)+`%`,1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.changePercent==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Va,[o[7]||=(0,f.createElementVNode)(`span`,null,`涨跌幅`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:a.value})},(0,f.toDisplayString)((0,f.unref)(Da)(e.k.changePercent)),5)])):(0,f.createCommentVNode)(``,!0),typeof e.k.changeAmount==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ha,[o[8]||=(0,f.createElementVNode)(`span`,null,`涨跌额`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:a.value})},(0,f.toDisplayString)((0,f.unref)(Ta)(e.k.changeAmount)),5)])):(0,f.createCommentVNode)(``,!0),typeof e.k.turnoverRate==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ua,[o[9]||=(0,f.createElementVNode)(`span`,null,`换手率`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(Ea)(e.k.turnoverRate)),1)])):(0,f.createCommentVNode)(``,!0)])],4)):(0,f.createCommentVNode)(``,!0)}}),Ga=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Ka=Ga(Wa,[[`__scopeId`,`data-v-95daa55c`]]),qa={RISE_WITH_VOLUME:`量价齐升`,RISE_WITHOUT_VOLUME:`量缩价升`,FALL_WITH_VOLUME:`量价齐缩`,FALL_WITHOUT_VOLUME:`量升价缩`},Ja=class{markers=new Map;hoveredMarkerId=null;lastHoveredId=null;customMarkers=new Map;customMarkerPositions=new Map;clear(){this.markers.clear()}register(e){this.markers.set(e.id,e)}getState(e){return this.hoveredMarkerId===e?`hovered`:`normal`}hitTest(e,t,n=3){for(let r of this.markers.values())if(e>=r.x-n&&e<=r.x+r.width+n&&t>=r.y-n&&t<=r.y+r.height+n)return r;return null}setHover(e){this.hoveredMarkerId=e,this.lastHoveredId=e}validateHoverState(){this.hoveredMarkerId!==null&&!this.markers.has(this.hoveredMarkerId)&&(this.hoveredMarkerId=null)}getHoveredMarker(){return this.hoveredMarkerId===null?null:this.markers.get(this.hoveredMarkerId)||null}getLastHoverId(){return this.lastHoveredId}getAllMarkers(){return Array.from(this.markers.values())}registerCustomMarker(e){this.customMarkers.set(e.id,e)}setCustomMarkers(e){this.clearCustomMarkers();for(let t of e)this.customMarkers.set(t.id,t)}clearCustomMarkers(){this.customMarkers.clear(),this.customMarkerPositions.clear()}getCustomMarkers(){return Array.from(this.customMarkers.values())}setCustomMarkerPosition(e,t,n,r,i){this.customMarkerPositions.set(e,{x:t,y:n,size:r,shape:i})}hitTestCustomMarker(e,t){for(let n of this.customMarkers.values()){let r=this.customMarkerPositions.get(n.id);if(r&&Ii(e,t,r.shape,r.x,r.y,r.size))return n}return null}},Ya={class:`marker-tooltip__title`},Xa={key:0,class:`marker-tooltip__content`},Za=Ga((0,f.defineComponent)({__name:`MarkerTooltip`,props:{marker:{},pos:{}},setup(e){let t=e,n=(0,f.computed)(()=>t.marker&&`date`in t.marker),r=(0,f.computed)(()=>{if(!t.marker)return``;if(n.value){let e=t.marker;return e.label?.text||e.shape}let e=t.marker;return qa[e.markerType]||e.markerType}),i=(0,f.computed)(()=>{if(!t.marker)return{};if(n.value){let e=t.marker;return{日期:e.date,...e.metadata}}return t.marker.metadata}),a=(0,f.computed)(()=>Object.keys(i.value).length>0);function o(e){return typeof e==`number`?e.toFixed(2):String(e)}return(t,n)=>e.marker?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:`marker-tooltip`,style:(0,f.normalizeStyle)({left:`${e.pos.x+12}px`,top:`${e.pos.y+12}px`})},[(0,f.createElementVNode)(`div`,Ya,(0,f.toDisplayString)(r.value),1),a.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Xa,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(i.value,(e,t)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:t,class:`row`},[(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(t),1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)(o(e)),1)]))),128))])):(0,f.createCommentVNode)(``,!0)],4)):(0,f.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-dd43da4f`]]),Qa={class:`params-header`},$a={class:`header-left`},eo={class:`params-title`},to={class:`header-right`},no={key:0,class:`indicator-description`},ro={class:`params-body`},io={class:`param-header`},ao={class:`param-label`},oo={class:`param-label-text`},so={key:0,class:`param-range`},co={class:`input-wrapper`},lo=[`disabled`,`onClick`],uo=[`value`,`min`,`max`,`step`,`onInput`],fo=[`disabled`,`onClick`],po={key:0,class:`param-description`},mo={class:`params-footer`},ho={class:`footer-right`},go=Ga((0,f.defineComponent)({__name:`IndicatorParams`,props:{visible:{type:Boolean},indicatorId:{},indicatorName:{},indicatorDescription:{},params:{},values:{}},emits:[`close`,`confirm`],setup(e,{emit:t}){let n=e,r=t,i=(0,f.ref)({...n.values}),a=(0,f.ref)(!0);(0,f.watch)(()=>n.values,e=>{i.value={...e}},{deep:!0,immediate:!0}),(0,f.watch)(()=>n.visible,e=>{e&&(i.value={...n.values})});function o(e,t){let n=t.target,r=parseFloat(n.value);isNaN(r)||(i.value[e]=r)}function s(e,t){let n=e.step||1,r=(i.value[e.key]||0)+t*n;e.min!==void 0&&(r=Math.max(e.min,r)),e.max!==void 0&&(r=Math.min(e.max,r)),i.value[e.key]=parseFloat(r.toFixed(10))}function c(){let e={};n.params.forEach(t=>{e[t.key]=t.default??n.values[t.key]??0}),i.value=e}function l(){r(`confirm`,{...i.value})}return(t,n)=>((0,f.openBlock)(),(0,f.createBlock)(f.Teleport,{to:`body`},[(0,f.createVNode)(f.Transition,{name:`overlay`},{default:(0,f.withCtx)(()=>[e.visible?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:`params-overlay`,onClick:n[4]||=e=>t.$emit(`close`)},[(0,f.createVNode)(f.Transition,{name:`modal`},{default:(0,f.withCtx)(()=>[(0,f.createElementVNode)(`div`,{class:`indicator-params`,onClick:n[3]||=(0,f.withModifiers)(()=>{},[`stop`])},[(0,f.createElementVNode)(`div`,Qa,[(0,f.createElementVNode)(`div`,$a,[(0,f.createElementVNode)(`span`,eo,(0,f.toDisplayString)(e.indicatorName),1),n[5]||=(0,f.createElementVNode)(`span`,{class:`params-subtitle`},`参数设置`,-1)]),(0,f.createElementVNode)(`div`,to,[(0,f.createElementVNode)(`button`,{class:(0,f.normalizeClass)([`toggle-desc-btn`,{active:a.value}]),onClick:n[0]||=e=>a.value=!a.value,title:`显示/隐藏说明`},[...n[6]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 1024 1024`},[(0,f.createElementVNode)(`path`,{d:`M512 97.52381c228.912762 0 414.47619 185.563429 414.47619 414.47619s-185.563429 414.47619-414.47619 414.47619S97.52381 740.912762 97.52381 512 283.087238 97.52381 512 97.52381z m0 73.142857C323.486476 170.666667 170.666667 323.486476 170.666667 512s152.81981 341.333333 341.333333 341.333333 341.333333-152.81981 341.333333-341.333333S700.513524 170.666667 512 170.666667z m36.571429 268.190476v292.571428h-73.142858V438.857143h73.142858z m0-121.904762v73.142857h-73.142858v-73.142857h73.142858z`,fill:`currentColor`})],-1)]],2),(0,f.createElementVNode)(`button`,{class:`params-close`,onClick:n[1]||=e=>t.$emit(`close`)},[...n[7]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},[(0,f.createElementVNode)(`path`,{d:`M18 6L6 18M6 6l12 12`})],-1)]])])]),(0,f.createVNode)(f.Transition,{name:`slide`},{default:(0,f.withCtx)(()=>[a.value&&e.indicatorDescription?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,no,[(0,f.createElementVNode)(`p`,null,(0,f.toDisplayString)(e.indicatorDescription),1)])):(0,f.createCommentVNode)(``,!0)]),_:1}),(0,f.createElementVNode)(`div`,ro,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(e.params,e=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:e.key,class:(0,f.normalizeClass)([`param-item`,{"has-desc":a.value&&e.description}])},[(0,f.createElementVNode)(`div`,io,[(0,f.createElementVNode)(`label`,ao,[(0,f.createElementVNode)(`span`,oo,(0,f.toDisplayString)(e.label),1),e.min!==void 0||e.max!==void 0?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,so,(0,f.toDisplayString)(e.min??`-∞`)+` ~ `+(0,f.toDisplayString)(e.max??`+∞`),1)):(0,f.createCommentVNode)(``,!0)]),(0,f.createElementVNode)(`div`,co,[(0,f.createElementVNode)(`button`,{class:`stepper-btn`,disabled:e.min!==void 0&&(i.value[e.key]??0)<=e.min,onClick:t=>s(e,-1)},` − `,8,lo),e.type===`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`input`,{key:0,type:`number`,class:`param-input`,value:i.value[e.key],min:e.min,max:e.max,step:e.step||1,onInput:t=>o(e.key,t)},null,40,uo)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`button`,{class:`stepper-btn`,disabled:e.max!==void 0&&(i.value[e.key]??0)>=e.max,onClick:t=>s(e,1)},` + `,8,fo)])]),(0,f.createVNode)(f.Transition,{name:`slide`},{default:(0,f.withCtx)(()=>[a.value&&e.description?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,po,(0,f.toDisplayString)(e.description),1)):(0,f.createCommentVNode)(``,!0)]),_:2},1024)],2))),128))]),(0,f.createElementVNode)(`div`,mo,[(0,f.createElementVNode)(`button`,{class:`params-btn reset`,onClick:c},[...n[8]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`},[(0,f.createElementVNode)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,f.createElementVNode)(`path`,{d:`M3 3v5h5`})],-1),(0,f.createTextVNode)(` 重置 `,-1)]]),(0,f.createElementVNode)(`div`,ho,[(0,f.createElementVNode)(`button`,{class:`params-btn cancel`,onClick:n[2]||=e=>t.$emit(`close`)},`取消`),(0,f.createElementVNode)(`button`,{class:`params-btn confirm`,onClick:l},[...n[9]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`},[(0,f.createElementVNode)(`path`,{d:`M20 6L9 17l-5-5`})],-1),(0,f.createTextVNode)(` 确定 `,-1)]])])])])]),_:1})])):(0,f.createCommentVNode)(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-c14eedcc`]]),_o={class:`indicator-selector`},vo={class:`indicator-scroll-container`},yo={class:`indicator-list`},bo=[`onMouseenter`],xo={class:`btn-content`},So={key:0,class:`param-hint`},Co={key:0,class:`hover-overlay`},wo=[`onClick`],To={key:1,class:`divider`},Eo=[`onClick`],Do={class:`indicator-item`},Oo={class:`menu-section`},ko={class:`menu-items`},Ao=[`disabled`,`onClick`],jo={key:0,class:`param-hint`},Mo={key:1,class:`active-tag`},No={class:`menu-section`},Po={class:`menu-items`},Fo=[`disabled`,`onClick`],Io={key:0,class:`param-hint`},Lo={key:1,class:`active-tag`},Ro=Ga((0,f.defineComponent)({__name:`IndicatorSelector`,props:{activeIndicators:{},indicatorParams:{}},emits:[`toggle`,`updateParams`],setup(e,{emit:t}){let n=[{id:`MA`,label:`MA`,name:`均线`,pane:`main`},{id:`BOLL`,label:`BOLL`,name:`布林带`,pane:`main`,description:`布林带由三条轨道线组成,用于判断价格的波动范围和趋势强度。价格触及上轨可能超买,触及下轨可能超卖。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:20,description:`计算移动平均线的周期数,周期越长轨道越平滑`},{key:`multiplier`,label:`倍数`,type:`number`,min:.1,max:5,step:.1,default:2,description:`标准差倍数,决定轨道宽度,通常为 2`}]},{id:`EXPMA`,label:`EXPMA`,name:`指数平滑移动平均线`,pane:`main`,description:`EXPMA 对近期价格给予更高权重,比普通 MA 更敏感。快线上穿慢线为金叉看涨,下穿为死叉看跌。`,params:[{key:`fastPeriod`,label:`快线`,type:`number`,min:2,max:100,step:1,default:12,description:`快线周期,对价格变化更敏感`},{key:`slowPeriod`,label:`慢线`,type:`number`,min:2,max:200,step:1,default:50,description:`慢线周期,用于判断趋势方向`}]},{id:`ENE`,label:`ENE`,name:`轨道线`,pane:`main`,description:`ENE 轨道线由三条轨道组成,价格突破上轨可能超买,突破下轨可能超卖,适合判断震荡行情的买卖点。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:10,description:`计算中轨的周期数`},{key:`deviation`,label:`偏离率`,type:`number`,min:1,max:30,step:.5,default:11,description:`轨道偏离率百分比,决定轨道宽度`}]},{id:`MACD`,label:`MACD`,name:`指数平滑异同移动平均线`,pane:`sub`,description:`MACD 通过快慢均线的交叉判断趋势方向和动量。DIF 上穿 DEA 为金叉看涨,下穿为死叉看跌。`,params:[{key:`fastPeriod`,label:`快线`,type:`number`,min:2,max:50,step:1,default:12,description:`快线 EMA 周期,对价格变化更敏感`},{key:`slowPeriod`,label:`慢线`,type:`number`,min:2,max:100,step:1,default:26,description:`慢线 EMA 周期,用于计算 DIF`},{key:`signalPeriod`,label:`信号`,type:`number`,min:2,max:50,step:1,default:9,description:`DEA 的 EMA 周期,用于生成买卖信号`}]},{id:`RSI`,label:`RSI`,name:`相对强弱指标`,pane:`sub`,description:`RSI 衡量价格变动的速度和幅度,判断超买超卖状态。RSI > 70 超买,RSI < 30 超卖。`,params:[{key:`period1`,label:`周期 1`,type:`number`,min:2,max:100,step:1,default:6,description:`第一条 RSI 周期,通常为 6(快线)`},{key:`period2`,label:`周期 2`,type:`number`,min:2,max:100,step:1,default:12,description:`第二条 RSI 周期,通常为 12(中线)`},{key:`period3`,label:`周期 3`,type:`number`,min:2,max:100,step:1,default:24,description:`第三条 RSI 周期,通常为 24(慢线)`}]},{id:`CCI`,label:`CCI`,name:`顺势指标`,pane:`sub`,description:`CCI 衡量价格与统计平均值的偏离程度。CCI > 100 超买,CCI < -100 超卖,适合捕捉趋势反转。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:14,description:`计算周期,周期越短信号越灵敏`}]},{id:`STOCH`,label:`STOCH`,name:`随机指标`,pane:`sub`,description:`KDJ 随机指标通过比较收盘价与价格区间判断超买超卖。K > 80 超买,K < 20 超卖,K 上穿 D 金叉。`,params:[{key:`n`,label:`K 周期`,type:`number`,min:2,max:100,step:1,default:9,description:`计算 K 值的周期,统计 N 日内价格区间`},{key:`m`,label:`D 周期`,type:`number`,min:1,max:50,step:1,default:3,description:`D 值是 K 的 M 日移动平均,使信号更平滑`}]},{id:`MOM`,label:`MOM`,name:`动量指标`,pane:`sub`,description:`动量指标衡量价格变化的速度,MOM > 0 表示上涨动能,MOM < 0 表示下跌动能。适合判断趋势强度。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:10,description:`与多少日前价格比较,周期越短越灵敏`}]},{id:`WMSR`,label:`WMSR`,name:`威廉指标`,pane:`sub`,description:`威廉指标衡量超买超卖程度,范围为 -100 到 0。WMSR > -20 超买,WMSR < -80 超卖。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:14,description:`回溯周期,统计周期内最高最低价`}]},{id:`KST`,label:`KST`,name:`确然指标`,pane:`sub`,description:`KST 综合多个 ROC 判断长期趋势,KST 上穿信号线看涨,下穿看跌。适合捕捉主要趋势转换。`,params:[{key:`roc1`,label:`ROC1`,type:`number`,min:2,max:100,step:1,default:10,description:`短期变化率周期`},{key:`roc2`,label:`ROC2`,type:`number`,min:2,max:100,step:1,default:15,description:`中短期变化率周期`},{key:`roc3`,label:`ROC3`,type:`number`,min:2,max:100,step:1,default:20,description:`中长期变化率周期`},{key:`roc4`,label:`ROC4`,type:`number`,min:2,max:100,step:1,default:30,description:`长期变化率周期`},{key:`signalPeriod`,label:`信号`,type:`number`,min:2,max:50,step:1,default:9,description:`信号线的 SMA 周期`}]},{id:`FASTK`,label:`FASTK`,name:`快速随机指标`,pane:`sub`,description:`FASTK 是未经过平滑处理的随机指标,比普通 KDJ 更敏感,能更快捕捉价格转折点,但假信号也更多。`,params:[{key:`period`,label:`周期`,type:`number`,min:2,max:100,step:1,default:9,description:`计算周期,周期越短越敏感`}]}],r=n.filter(e=>e.pane===`main`),i=n.filter(e=>e.pane===`sub`),a=e,o=t,s=(0,f.ref)(null),c=(0,f.ref)(null),l=(0,f.ref)(!1),u=(0,f.ref)(null),d=(0,f.ref)(null),p=(0,f.ref)(!1),m=(0,f.ref)({left:`0`,bottom:`0`}),h=(0,f.computed)(()=>a.activeIndicators?.length?a.activeIndicators.map(e=>n.find(t=>t.id===e)).filter(e=>e!==void 0):[]),g=(0,f.computed)(()=>u.value&&n.find(e=>e.id===u.value)||null);function _(e){return a.activeIndicators?.includes(e)??!1}function v(e){if(_(e))return;let t=n.find(t=>t.id===e);t&&(t.pane===`main`&&n.filter(t=>t.pane===`main`&&t.id!==e&&_(t.id)).forEach(e=>o(`toggle`,e.id,!1)),o(`toggle`,e,!0),p.value=!1)}function y(e){o(`toggle`,e,!1)}function b(e){u.value=e,l.value=!0}function x(e){let t=n.find(t=>t.id===e);if(!t?.params)return{};let r={};for(let e of t.params)r[e.key]=e.default??e.min??1;let i=a.indicatorParams?.[e]||{},o={...r};for(let[e,t]of Object.entries(i))typeof t==`number`&&(o[e]=t);return o}function S(e){let t=x(e.id);return e.params?e.params.map(e=>t[e.key]??``).join(`,`):``}function C(e){u.value&&o(`updateParams`,u.value,e),l.value=!1}function w(){if(!p.value&&s.value){let e=s.value.getBoundingClientRect(),t=window.innerWidth,n=e.left+e.width/2;n+160>t-8&&(n=t-160-8),n-160<8&&(n=168),m.value={left:`${n}px`,bottom:`${window.innerHeight-e.top+8}px`}}p.value=!p.value}function T(e){let t=c.value&&!c.value.contains(e.target),n=s.value&&!s.value.contains(e.target);t&&n&&(p.value=!1)}function E(){p.value&&=!1}return(0,f.onMounted)(()=>{document.addEventListener(`click`,T),window.addEventListener(`resize`,E)}),(0,f.onUnmounted)(()=>{document.removeEventListener(`click`,T),window.removeEventListener(`resize`,E)}),(e,t)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,_o,[(0,f.createElementVNode)(`div`,vo,[(0,f.createElementVNode)(`div`,yo,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(h.value,e=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:e.id,class:`indicator-item`},[(0,f.createElementVNode)(`div`,{class:`indicator-btn-wrapper`,onMouseenter:t=>d.value=e.id,onMouseleave:t[0]||=e=>d.value=null},[(0,f.createElementVNode)(`button`,{class:(0,f.normalizeClass)([`indicator-btn`,{active:!0,hovering:d.value===e.id}])},[(0,f.createElementVNode)(`span`,xo,[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,So,` (`+(0,f.toDisplayString)(S(e))+`) `,1)):(0,f.createCommentVNode)(``,!0)]),(0,f.createVNode)(f.Transition,{name:`fade`},{default:(0,f.withCtx)(()=>[d.value===e.id?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Co,[e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:0,class:`action-btn settings-btn`,onClick:(0,f.withModifiers)(t=>b(e.id),[`stop`]),title:`编辑参数`},[...t[2]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z`})],-1)]],8,wo)):(0,f.createCommentVNode)(``,!0),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,To)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`button`,{class:`action-btn remove-btn`,onClick:(0,f.withModifiers)(t=>y(e.id),[`stop`]),title:`移除指标`},[...t[3]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`})],-1)]],8,Eo)])):(0,f.createCommentVNode)(``,!0)]),_:2},1024)],2)],40,bo)]))),128)),(0,f.createElementVNode)(`div`,Do,[(0,f.createElementVNode)(`button`,{ref_key:`addBtnRef`,ref:s,class:`add-btn`,onClick:w,title:`添加指标`},[...t[4]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z`})],-1)]],512)])])]),((0,f.openBlock)(),(0,f.createBlock)(f.Teleport,{to:`body`},[(0,f.createVNode)(f.Transition,{name:`slide`},{default:(0,f.withCtx)(()=>[p.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:`add-menu`,ref_key:`addMenuRef`,ref:c,style:(0,f.normalizeStyle)(m.value)},[(0,f.createElementVNode)(`div`,Oo,[t[6]||=(0,f.createElementVNode)(`div`,{class:`menu-title`},`主图指标`,-1),(0,f.createElementVNode)(`div`,ko,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)((0,f.unref)(r),e=>((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:e.id,class:(0,f.normalizeClass)([`menu-item`,{disabled:_(e.id)}]),disabled:_(e.id),onClick:t=>v(e.id)},[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,jo,` (`+(0,f.toDisplayString)(e.name)+`) `,1)):(0,f.createCommentVNode)(``,!0),_(e.id)?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Mo,[...t[5]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`})],-1)]])):(0,f.createCommentVNode)(``,!0)],10,Ao))),128))])]),(0,f.createElementVNode)(`div`,No,[t[8]||=(0,f.createElementVNode)(`div`,{class:`menu-title`},`副图指标`,-1),(0,f.createElementVNode)(`div`,Po,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)((0,f.unref)(i),e=>((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:e.id,class:(0,f.normalizeClass)([`menu-item`,{disabled:_(e.id)}]),disabled:_(e.id),onClick:t=>v(e.id)},[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Io,` (`+(0,f.toDisplayString)(e.name)+`) `,1)):(0,f.createCommentVNode)(``,!0),_(e.id)?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Lo,[...t[7]||=[(0,f.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`currentColor`},[(0,f.createElementVNode)(`path`,{d:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`})],-1)]])):(0,f.createCommentVNode)(``,!0)],10,Fo))),128))])])],4)):(0,f.createCommentVNode)(``,!0)]),_:1})])),g.value?((0,f.openBlock)(),(0,f.createBlock)(go,{key:0,visible:l.value,"indicator-id":g.value.id,"indicator-name":g.value.name,"indicator-description":g.value.description,params:g.value.params||[],values:x(g.value.id),onClose:t[1]||=e=>l.value=!1,onConfirm:C},null,8,[`visible`,`indicator-id`,`indicator-name`,`indicator-description`,`params`,`values`])):(0,f.createCommentVNode)(``,!0)]))}}),[[`__scopeId`,`data-v-aad3b750`]]);function zo(e,t){let n=Math.round(e*t);return n%2==0&&(n+=1),Math.max(1,n)}function Bo(e,t,n){let r=zo(e,n),i=Math.round(t*n),a=r+i,o=i;return{kWidthPx:r,kGapPx:i,unitPx:a,startXPx:o,kWidthLogical:r/n,kGapLogical:i/n,unitLogical:a/n,startXLogical:o/n}}function Vo(e,t,n,r,i,a=1){let{unitPx:o,startXPx:s}=Bo(n,r,a),c=e*a,l=t*a;return{start:Math.max(0,Math.floor((c-s)/o)-1),end:Math.min(i,Math.ceil((c+l-s)/o)+1)}}function Ho(e,t,n){let r=-1/0,i=1/0;for(let a=t;a<n&&a<e.length;a++){let t=e[a];t&&(t.high>r&&(r=t.high),t.low<i&&(i=t.low))}return!Number.isFinite(r)||!Number.isFinite(i)?{maxPrice:100,minPrice:0}:{maxPrice:r,minPrice:i}}var Uo=class{range={maxPrice:100,minPrice:0};height=1;paddingTop=0;paddingBottom=0;priceOffset=0;setRange(e){this.range=e}setHeight(e){this.height=Math.max(1,e)}setPadding(e,t){this.paddingTop=Math.max(0,e),this.paddingBottom=Math.max(0,t)}getRange(){return this.range}getPaddingTop(){return this.paddingTop}getPaddingBottom(){return this.paddingBottom}setPriceOffset(e){this.priceOffset=e}getPriceOffset(){return this.priceOffset}resetPriceOffset(){this.priceOffset=0}priceToY(e){let{maxPrice:t,minPrice:n}=this.range,r=e-this.priceOffset,i=t-n||1,a=(r-n)/i,o=Math.max(1,this.height-this.paddingTop-this.paddingBottom);return this.paddingTop+o*(1-a)}yToPrice(e){let{maxPrice:t,minPrice:n}=this.range,r=t-n||1,i=Math.max(1,this.height-this.paddingTop-this.paddingBottom);return n+(1-(e-this.paddingTop)/i)*r+this.priceOffset}deltaYToPriceOffset(e){return e*((this.range.maxPrice-this.range.minPrice||1)/Math.max(1,this.height-this.paddingTop-this.paddingBottom))}},Wo=class{id;top=0;height=0;priceRange={maxPrice:100,minPrice:0};yAxis=new Uo;renderers=[];constructor(e){this.id=e}setLayout(e,t){this.top=e,this.height=Math.max(1,t),this.yAxis.setHeight(this.height)}setPadding(e,t){this.yAxis.setPadding(e,t)}addRenderer(e){this.renderers.push(e)}updateRange(e,t){this.priceRange=Ho(e,t.start,t.end),this.yAxis.setRange(this.priceRange)}},Go=class{chart;isDragging=!1;dragStartX=0;scrollStartX=0;dragStartY=0;activePaneIdOnDrag=null;isTouchSession=!1;crosshairPos=null;crosshairIndex=null;crosshairPrice=null;hoveredIndex=null;activePaneId=null;tooltipPos={x:0,y:0};tooltipSize={width:220,height:180};hoveredMarkerId=null;clickedMarkerId=null;hoveredMarkerData=null;clickedMarkerData=null;onMarkerHoverCallback;onMarkerClickCallback;hoveredCustomMarker=null;onCustomMarkerHoverCallback;onCustomMarkerClickCallback;kLinePositions=null;visibleRange=null;kWidthPx=null;constructor(e){this.chart=e}onWheel(e){let t=this.chart.getDom().container,n=t.getBoundingClientRect(),r=e.clientX-n.left,i=t.scrollLeft;this.clearHover(),this.chart.zoomAt(r,i,e.deltaY)}onPointerDown(e){if(e.isPrimary===!1)return;this.isTouchSession=e.pointerType===`touch`;let t=this.chart.getDom().container,n=t.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top,a=t.scrollLeft,o=this.chart.getMarkerManager(),s=a+r,c=o.hitTest(s,i,3);if(c){this.clickedMarkerId=c.id,this.clickedMarkerData=c,this.onMarkerClickCallback&&this.onMarkerClickCallback(c);return}let l=this.chart.getPaneRenderers().find(e=>{let t=e.getPane();return i>=t.top&&i<=t.top+t.height})?.getPane()||null;this.isDragging=!0,this.updateHoverFromPoint(e.clientX,e.clientY),this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.scrollStartX=t.scrollLeft,this.activePaneIdOnDrag=l?.id||null,this.chart.scheduleDraw()}setTooltipSize(e){this.tooltipSize=e}onPointerUp(e){e.isPrimary!==!1&&(this.isDragging=!1)}onPointerLeave(e){e.isPrimary!==!1&&(this.isDragging=!1,this.isTouchSession=!1,this.clearHover(),this.chart.scheduleDraw())}onMouseDown(e){if(this.isTouchSession||e.button!==0)return;let t=this.chart.getDom().container,n=t.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top,a=t.scrollLeft,o=this.chart.getMarkerManager(),s=a+r,c=o.hitTest(s,i,3);if(c){this.clickedMarkerId=c.id,this.onMarkerClickCallback&&this.onMarkerClickCallback(c);return}let l=this.chart.getPaneRenderers().find(e=>{let t=e.getPane();return i>=t.top&&i<=t.top+t.height})?.getPane()||null;this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.scrollStartX=t.scrollLeft,this.activePaneIdOnDrag=l?.id||null,this.updateHoverFromPoint(e.clientX,e.clientY),this.chart.scheduleDraw(),e.preventDefault()}onMouseMove(e){if(this.isTouchSession)return;let t=this.chart.getDom().container;if(this.isDragging){let n=this.dragStartX-e.clientX;t.scrollLeft=this.scrollStartX+n;let r=e.clientY-this.dragStartY;r!==0&&this.activePaneIdOnDrag&&(this.chart.translatePrice(this.activePaneIdOnDrag,r),this.dragStartY=e.clientY);return}this.updateHover(e),this.chart.scheduleDraw()}onMouseUp(){this.isTouchSession||(this.isDragging=!1)}onMouseLeave(){this.isTouchSession||(this.isDragging=!1,this.clearHover(),this.chart.scheduleDraw())}onScroll(){this.kLinePositions=null,this.visibleRange=null,this.clearHover(),this.chart.scheduleDraw()}onPointerMove(e){if(!e.isPrimary)return;e.pointerType===`touch`&&(this.isTouchSession=!0);let t=this.chart.getDom().container;if(this.isDragging){let n=this.dragStartX-e.clientX;t.scrollLeft=this.scrollStartX+n;let r=e.clientY-this.dragStartY;r!==0&&this.activePaneIdOnDrag&&(this.chart.translatePrice(this.activePaneIdOnDrag,r),this.dragStartY=e.clientY);return}this.updateHoverFromPoint(e.clientX,e.clientY),this.chart.scheduleDraw()}setKLinePositions(e,t,n){this.kLinePositions=e,this.visibleRange=t,n!==void 0&&(this.kWidthPx=n)}isDraggingState(){return this.isDragging}setOnMarkerHover(e){this.onMarkerHoverCallback=e}setOnMarkerClick(e){this.onMarkerClickCallback=e}setOnCustomMarkerHover(e){this.onCustomMarkerHoverCallback=e}setOnCustomMarkerClick(e){this.onCustomMarkerClickCallback=e}clearHover(){this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=null,this.hoveredMarkerId!==null&&(this.hoveredMarkerId=null,this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null)),this.hoveredCustomMarker!==null&&(this.hoveredCustomMarker=null,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(null))}updateHover(e){this.updateHoverFromPoint(e.clientX,e.clientY)}updateHoverFromPoint(e,t){let n=this.chart.getDom().container,r=n.getBoundingClientRect(),i=e-r.left,a=t-r.top,o=this.chart.getOption(),s=Math.max(1,Math.round(r.width)),c=Math.max(1,Math.round(r.height)),l=s-o.rightAxisWidth-(o.priceLabelWidth||60),u=c-o.bottomAxisHeight;if(i<0||a<0||i>l||a>u){this.clearHover();return}let d=n.scrollLeft,f=window.devicePixelRatio||1,p=this.chart.getMarkerManager(),m=d+i,h=p.hitTest(m,a,3);if(h){this.hoveredMarkerId!==h.id&&(this.hoveredMarkerId=h.id,this.hoveredMarkerData=h,p.setHover(h.id),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(h)),this.crosshairPos=null,this.crosshairIndex=null,this.hoveredIndex=null;return}else this.hoveredMarkerId!==null&&(this.hoveredMarkerId=null,this.hoveredMarkerData=null,p.setHover(null),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null));let g=p.hitTestCustomMarker(i,a);if(g){this.hoveredCustomMarker?.id!==g.id&&(this.hoveredCustomMarker=g,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(g)),this.crosshairPos=null,this.crosshairIndex=null,this.hoveredIndex=null;return}else this.hoveredCustomMarker!==null&&(this.hoveredCustomMarker=null,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(null));if(!this.kLinePositions||!this.visibleRange||!this.kWidthPx){this.clearHover();return}let _=this.kWidthPx/f,v=0,y=this.kLinePositions.length;for(;v<y;){let e=v+y>>1;this.kLinePositions[e]<m?v=e+1:y=e}let b=v;if(v>0&&v<this.kLinePositions.length){let e=this.kLinePositions[v-1]+_/2,t=this.kLinePositions[v]+_/2;Math.abs(m-e)<Math.abs(m-t)&&(b=v-1)}else v===this.kLinePositions.length&&this.kLinePositions.length>0&&(b=this.kLinePositions.length-1);let x=b+this.visibleRange.start,S=this.chart.getData(),C=this.chart.getPaneRenderers().find(e=>{let t=e.getPane();return a>=t.top&&a<=t.top+t.height})?.getPane()||null;if(this.activePaneId=C?.id||null,x>=0&&x<(S?.length??0)){this.crosshairIndex=x;let e=this.kLinePositions[b]+(this.kWidthPx-1)/2/f-d;if(this.crosshairPos={x:Math.min(Math.max(e,0),l),y:Math.min(Math.max(a,0),u)},C){let e=a-C.top;this.crosshairPrice=C.yAxis.yToPrice(e)}else this.crosshairPrice=null}else this.crosshairIndex=null,this.crosshairPos=null,this.crosshairPrice=null;let w=typeof this.crosshairIndex==`number`?S[this.crosshairIndex]:void 0;if(!w||!C||C.id!==`main`){this.hoveredIndex=null;return}let T=a-C.top,E=C.yAxis.priceToY(w.open),D=C.yAxis.priceToY(w.close),O=C.yAxis.priceToY(w.high),k=C.yAxis.priceToY(w.low),A=Math.min(E,D),j=Math.max(E,D),M=m-this.kLinePositions[b],ee=_/2,te=Math.abs(j-A),N=te<8?(A+j)/2-8/2:A,P=te<8?(A+j)/2+8/2:j,F=T>=N&&T<=P&&M>=0&&M<=_,ne=Math.abs(M-ee)<=3&&T>=O&&T<=k;if(!F&&!ne){this.hoveredIndex=null;return}this.hoveredIndex=this.crosshairIndex;let I=this.tooltipSize.width,re=this.tooltipSize.height,ie=i+14,ae=i-14-I,oe=ie+I+12<=s?ie:ae,se=a+14,ce=Math.max(12,s-I-12),le=Math.max(12,c-re-12);this.tooltipPos={x:Math.min(Math.max(oe,12),ce),y:Math.min(Math.max(se,12),le)}}reset(){this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.scrollStartX=0,this.activePaneIdOnDrag=null,this.isTouchSession=!1,this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=null,this.hoveredMarkerId=null,this.clickedMarkerId=null,this.hoveredMarkerData=null,this.clickedMarkerData=null,this.kLinePositions=null,this.visibleRange=null,this.kWidthPx=null}},Ko=class{dom;pane;opt;constructor(e,t,n){this.dom=e,this.pane=t,this.opt={...n,priceLabelWidth:n.priceLabelWidth||60}}getPane(){return this.pane}getDom(){return this.dom}resize(e,t,n){let r=this.dom.plotCanvas,i=this.dom.yAxisCanvas;r.width=Math.round(e*n),r.height=Math.round(t*n),r.style.width=`${r.width/n}px`,r.style.height=`${r.height/n}px`;let a=this.opt.rightAxisWidth+(this.opt.priceLabelWidth||60);i.width=Math.round(a*n),i.height=Math.round(t*n),i.style.width=`${i.width/n}px`,i.style.height=`${i.height/n}px`}destroy(){}};function qo(e={}){let{paneId:t=`sub`}=e;return{name:`volume_${t}`,version:`1.0.0`,description:`成交量渲染器`,debugName:`成交量`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,kGap:s,kLinePositions:c}=e,l=r;if(!l.length)return;t.save(),t.translate(-a,0);let{start:u,end:d}=i,f=l.slice(u,d).reduce((e,t)=>t.volume?Math.max(e,t.volume):e,0);for(let e=u;e<d;e++){let r=l[e];if(!r)continue;let i=r.volume;if(!i)continue;let a=Yo(r),d=c[e-u];d&&Jo(t,d,a,i,f,o,s,n.height)}t.restore()}}}function Jo(e,t,n,r,i,a,o,s){let c=Xo(r,i,s),l=a;e.fillStyle=n,e.fillRect(t,c,l,s-c)}function Yo(e){return e.close>e.open?J.UP:e.close<e.open?J.DOWN:J.NEUTRAL}function Xo(e,t,n){return n-n/t*e}function Z(e,t){return Math.round(e*t)/t}function Q(e,t){return(Math.floor(e*t)+.5)/t}function Zo(e,t,n,r){if(t===n)return null;let i=Math.min(t,n),a=Math.max(t,n),o=Math.round(e*r),s=Math.round(i*r),c=Math.round(a*r);return{x:o/r,y:s/r,width:1/r,height:Math.max(1,c-s)/r}}function Qo(e,t,n,r){if(e===t)return null;let i=Math.min(e,t),a=Math.max(e,t),o=Math.round(i*r),s=Math.round(a*r),c=Math.round(n*r);return{x:o/r,y:c/r,width:Math.max(1,s-o)/r,height:1/r}}function $o(e,t,n,r,i){let a=e+n,o=n,s=Math.round(t*i),c=Math.round((t+r)*i),l=Math.max(1,c-s),u=e+(n-1)/2,d=u,f=o%2==1;return{bodyRect:{x:e/i,y:s/i,width:n/i,height:l/i},physBodyLeft:e,physBodyRight:a,physBodyWidth:o,physBodyCenter:d,physWickX:u,wickRect:{x:u/i,width:1/i},isPerfectlyAligned:f}}function es(e,t){let n=Array(e.length);if(e.length<t)return n;let r=0;for(let i=0;i<t;i++){let t=e[i];if(!t)return n;r+=t.close}n[t-1]=r/t;for(let i=t;i<e.length;i++){let a=e[i-t],o=e[i];!a||!o||(r=r-a.close+o.close,n[i]=r/t)}return n}function ts(e={}){let t={ma5:!0,ma10:!0,ma20:!0,ma30:!0,ma60:!0,...e},n=new Map,r=null;function i(e,t){let i=n.get(t);if(i&&r===e)return i.values;let a=es(e,t);return n.set(t,{period:t,values:a}),r=e,a}function a(e,t,n,r){let{pane:i,range:a,kWidth:o,dpr:s,kLinePositions:c}=n;e.strokeStyle=r,e.lineWidth=1,e.lineJoin=`round`,e.lineCap=`round`,e.beginPath();let l=!0;for(let n=a.start;n<a.end&&n<t.length;n++){let r=t[n];if(r===void 0)continue;let u=c[n-a.start]+o/2,d=i.yAxis.priceToY(r),f=Q(u,s),p=Q(d,s);l?(e.moveTo(f,p),l=!1):e.lineTo(f,p)}e.stroke()}return{name:`ma`,version:`1.0.0`,description:`MA均线渲染器`,debugName:`MA均线`,paneId:`main`,priority:q.INDICATOR,draw(e){let{ctx:n,data:r,scrollLeft:o}=e,s=r;s.length&&(n.save(),n.translate(-o,0),t.ma5&&a(n,i(s,5),e,Y.MA5),t.ma10&&a(n,i(s,10),e,Y.MA10),t.ma20&&a(n,i(s,20),e,Y.MA20),t.ma30&&a(n,i(s,30),e,Y.MA30),t.ma60&&a(n,i(s,60),e,Y.MA60),n.restore())},onDataUpdate(){r=null,n.clear()},getConfig(){return{...t}},setConfig(e){Object.assign(t,e)}}}function ns(e,t,n){let r=Array(e.length);if(e.length<t)return r;let i=0,a=[];for(let n=0;n<t;n++){let t=e[n];if(!t)return r;let o=t.close;a.push(o),i+=o}for(let o=t-1;o<e.length;o++){let s=e[o];if(!s)continue;if(o>=t){let e=a.shift();e!==void 0&&(i-=e);let t=s.close;a.push(t),i+=t}let c=i/t,l=0;for(let e=0;e<t;e++){let t=a[e];t!==void 0&&(l+=(t-c)**2)}let u=Math.sqrt(l/t);r[o]={upper:c+n*u,middle:c,lower:c-n*u}}return r}function rs(e={}){let t={period:20,multiplier:2,showUpper:!0,showMiddle:!0,showLower:!0,showBand:!0,...e},n=null,r=0,i=0,a=[];function o(e){return(n!==e||r!==t.period||i!==t.multiplier)&&(a=ns(e,t.period,t.multiplier),n=e,r=t.period,i=t.multiplier),a}return{name:`boll`,version:`1.0.0`,description:`布林带渲染器`,debugName:`BOLL布林带`,paneId:`main`,priority:q.INDICATOR,draw(e){let{ctx:n,pane:r,data:i,range:a,scrollLeft:s,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<t.period)return;let f=o(d);n.save(),n.translate(-s,0);let p=Math.max(a.start,t.period-1),m=Math.min(a.end,d.length);if(t.showBand){n.fillStyle=ua.BAND_FILL,n.beginPath();let e=!0;for(let t=p;t<m;t++){let i=f[t];if(!i)continue;let o=u[t-a.start]+c/2,s=r.yAxis.priceToY(i.upper),d=Q(o,l),p=Q(s,l);e?(n.moveTo(d,p),e=!1):n.lineTo(d,p)}for(let e=m-1;e>=p;e--){let t=f[e];if(!t)continue;let i=u[e-a.start]+c/2,o=r.yAxis.priceToY(t.lower),s=Q(i,l),d=Q(o,l);n.lineTo(s,d)}n.closePath(),n.fill()}n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`;let h=(e,t)=>{n.strokeStyle=t,n.beginPath();let i=!0;for(let t=p;t<m;t++){let o=f[t];if(!o)continue;let s=u[t-a.start]+c/2,d=r.yAxis.priceToY(o[e]),p=Q(s,l),m=Q(d,l);i?(n.moveTo(p,m),i=!1):n.lineTo(p,m)}n.stroke()};t.showUpper&&h(`upper`,ua.UPPER),t.showMiddle&&h(`middle`,ua.MIDDLE),t.showLower&&h(`lower`,ua.LOWER),n.restore()},onDataUpdate(){n=null},getConfig(){return{...t}},setConfig(e){`period`in e&&e.period!==t.period&&(n=null),`multiplier`in e&&e.multiplier!==t.multiplier&&(n=null),Object.assign(t,e)}}}function is(e,t,n=20,r=2){if(t<n-1||t>=e.length)return null;let i=0;for(let r=0;r<n;r++){let n=e[t-r];if(!n)return null;i+=n.close}let a=i/n,o=0;for(let r=0;r<n;r++){let n=e[t-r];if(!n)return null;o+=(n.close-a)**2}let s=Math.sqrt(o/n);return{upper:a+r*s,middle:a,lower:a-r*s}}function as(e,t,n){let r=Array(e.length);if(e.length===0)return r;let i=2/(t+1),a=2/(n+1),o=e[0].close,s=o,c=o;r[0]={fast:s,slow:c};for(let t=1;t<e.length;t++){let n=e[t].close;s=n*i+s*(1-i),c=n*a+c*(1-a),r[t]={fast:s,slow:c}}return r}function os(e,t,n=12,r=50){if(t<0||t>=e.length)return null;let i=2/(n+1),a=2/(r+1),o=e[0].close,s=o,c=o;for(let n=1;n<=t;n++){let t=e[n].close;s=t*i+s*(1-i),c=t*a+c*(1-a)}return{fast:s,slow:c}}function ss(e={}){let t={fastPeriod:12,slowPeriod:50,...e},n=null,r=0,i=0,a=[];function o(e){return(n!==e||r!==t.fastPeriod||i!==t.slowPeriod)&&(a=as(e,t.fastPeriod,t.slowPeriod),n=e,r=t.fastPeriod,i=t.slowPeriod),a}return{name:`expma`,version:`1.0.0`,description:`EXPMA 指数平滑移动平均线渲染器`,debugName:`EXPMA`,paneId:`main`,priority:q.INDICATOR,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:s,dpr:c,kLinePositions:l}=e,u=r;if(u.length<2)return;let d=o(u);t.save(),t.translate(-a,0);let f=i.start,p=Math.min(i.end,u.length),m=_a.FAST,h=_a.SLOW,g=(e,r)=>{t.strokeStyle=r,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let a=!0;for(let r=f;r<p;r++){let o=d[r];if(!o)continue;let u=l[r-i.start]+s/2,f=n.yAxis.priceToY(o[e]),p=Q(u,c),m=Q(f,c);a?(t.moveTo(p,m),a=!1):t.lineTo(p,m)}t.stroke()};g(`fast`,m),g(`slow`,h),t.restore()},onDataUpdate(){n=null},getConfig(){return{...t}},setConfig(e){`fastPeriod`in e&&e.fastPeriod!==t.fastPeriod&&(n=null),`slowPeriod`in e&&e.slowPeriod!==t.slowPeriod&&(n=null),Object.assign(t,e)}}}function cs(e,t,n){let r=Array(e.length);if(e.length<t)return r;let i=0;for(let n=0;n<t;n++){let t=e[n];if(!t)return r;i+=t.close}let a=i/t,o=n/100;r[t-1]={upper:a*(1+o),middle:a,lower:a*(1-o)};for(let a=t;a<e.length;a++){let o=e[a-t],s=e[a];if(!o||!s)continue;i=i-o.close+s.close;let c=i/t,l=n/100;r[a]={upper:c*(1+l),middle:c,lower:c*(1-l)}}return r}function ls(e,t,n=10,r=11){if(t<n-1||t>=e.length)return null;let i=0;for(let r=0;r<n;r++){let n=e[t-r];if(!n)return null;i+=n.close}let a=i/n,o=r/100;return{upper:a*(1+o),middle:a,lower:a*(1-o)}}function us(e={}){let t={period:10,deviation:11,...e},n=null,r=0,i=0,a=[];function o(e){return(n!==e||r!==t.period||i!==t.deviation)&&(a=cs(e,t.period,t.deviation),n=e,r=t.period,i=t.deviation),a}return{name:`ene`,version:`1.0.0`,description:`ENE 轨道线渲染器`,debugName:`ENE轨道线`,paneId:`main`,priority:q.INDICATOR,draw(e){let{ctx:n,pane:r,data:i,range:a,scrollLeft:s,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<t.period)return;let f=o(d);n.save(),n.translate(-s,0);let p=Math.max(a.start,t.period-1),m=Math.min(a.end,d.length);n.fillStyle=`rgba(69, 112, 249, 0.08)`,n.beginPath();let h=!0;for(let e=p;e<m;e++){let t=f[e];if(!t)continue;let i=u[e-a.start]+c/2,o=r.yAxis.priceToY(t.upper),s=Q(i,l),d=Q(o,l);h?(n.moveTo(s,d),h=!1):n.lineTo(s,d)}for(let e=m-1;e>=p;e--){let t=f[e];if(!t)continue;let i=u[e-a.start]+c/2,o=r.yAxis.priceToY(t.lower),s=Q(i,l),d=Q(o,l);n.lineTo(s,d)}n.closePath(),n.fill(),n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`;let g=(e,t)=>{n.strokeStyle=t,n.beginPath();let i=!0;for(let t=p;t<m;t++){let o=f[t];if(!o)continue;let s=u[t-a.start]+c/2,d=r.yAxis.priceToY(o[e]),p=Q(s,l),m=Q(d,l);i?(n.moveTo(p,m),i=!1):n.lineTo(p,m)}n.stroke()};g(`upper`,`rgba(214, 10, 34, 1)`),g(`middle`,`rgba(69, 112, 249, 1)`),g(`lower`,`rgba(3, 123, 102, 1)`),n.restore()},onDataUpdate(){n=null},getConfig(){return{...t}},setConfig(e){`period`in e&&e.period!==t.period&&(n=null),`deviation`in e&&e.deviation!==t.deviation&&(n=null),Object.assign(t,e)}}}function ds(e,t,n){if(t<n-1)return;let r=0;for(let i=0;i<n;i++){let n=e[t-i];if(!n)return;r+=n.close}return r/n}function fs(e){let t={yPaddingPx:e.yPaddingPx,indicators:{MA:{enabled:!0,params:{}},BOLL:{enabled:!1,params:{period:20,multiplier:2}},EXPMA:{enabled:!1,params:{fastPeriod:12,slowPeriod:50}},ENE:{enabled:!1,params:{period:10,deviation:11}}}};return{name:`mainIndicatorLegend`,version:`1.0.0`,description:`主图指标图例渲染器(统一管理 MA、BOLL 等)`,debugName:`主图指标图例`,paneId:`main`,priority:q.FOREGROUND,enabled:!0,draw(e){let{ctx:n,data:r,range:i}=e,a=r;if(!a.length)return;n.save(),n.font=`12px Arial`,n.textAlign=`left`;let o=Math.min(i.end-1,a.length-1),s=[],c=t.indicators.MA;c?.enabled&&s.push({draw:e=>{let r=[],i=c.params.periods;if(i&&Array.isArray(i)?i.forEach(e=>{let t=`MA${e}`;r.push({label:`MA${e}`,color:Y[t]||Y.MA5,value:ds(a,o,e)})}):r.push({label:`MA5`,color:Y.MA5,value:ds(a,o,5)},{label:`MA10`,color:Y.MA10,value:ds(a,o,10)},{label:`MA20`,color:Y.MA20,value:ds(a,o,20)},{label:`MA30`,color:Y.MA30,value:ds(a,o,30)},{label:`MA60`,color:Y.MA60,value:ds(a,o,60)}),r.length>0){let i=12,a=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`MA`,i,a),i+=n.measureText(`MA`).width+10;for(let e of r){let t=typeof e.value==`number`?` ${e.value.toFixed(2)}`:``,r=`${e.label}${t}`;n.fillStyle=e.color,n.fillText(r,i,a),i+=n.measureText(r).width+10}}}});let l=t.indicators.BOLL;l?.enabled&&s.push({draw:e=>{let r=l.params.period??20,i=l.params.multiplier??2,s=is(a,o,r,i),c=12,u=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`BOLL(${r},${i})`,c,u),c+=n.measureText(`BOLL(${r},${i})`).width+10,s&&(n.fillStyle=ua.UPPER,n.fillText(`上轨:${s.upper.toFixed(2)}`,c,u),c+=n.measureText(`上轨:${s.upper.toFixed(2)}`).width+10,n.fillStyle=ua.MIDDLE,n.fillText(`中轨:${s.middle.toFixed(2)}`,c,u),c+=n.measureText(`中轨:${s.middle.toFixed(2)}`).width+10,n.fillStyle=ua.LOWER,n.fillText(`下轨:${s.lower.toFixed(2)}`,c,u))}});let u=t.indicators.EXPMA;u?.enabled&&s.push({draw:e=>{let r=u.params.fastPeriod??12,i=u.params.slowPeriod??50,s=os(a,o,r,i),c=12,l=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`EXPMA(${r},${i})`,c,l),c+=n.measureText(`EXPMA(${r},${i})`).width+10,s&&(n.fillStyle=_a.FAST,n.fillText(`快:${s.fast.toFixed(2)}`,c,l),c+=n.measureText(`快:${s.fast.toFixed(2)}`).width+10,n.fillStyle=_a.SLOW,n.fillText(`慢:${s.slow.toFixed(2)}`,c,l))}});let d=t.indicators.ENE;d?.enabled&&s.push({draw:e=>{let r=d.params.period??10,i=d.params.deviation??11,s=ls(a,o,r,i),c=12,l=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`ENE(${r},${i})`,c,l),c+=n.measureText(`ENE(${r},${i})`).width+10,s&&(n.fillStyle=va.UPPER,n.fillText(`上轨:${s.upper.toFixed(2)}`,c,l),c+=n.measureText(`上轨:${s.upper.toFixed(2)}`).width+10,n.fillStyle=va.MIDDLE,n.fillText(`中轨:${s.middle.toFixed(2)}`,c,l),c+=n.measureText(`中轨:${s.middle.toFixed(2)}`).width+10,n.fillStyle=va.LOWER,n.fillText(`下轨:${s.lower.toFixed(2)}`,c,l))}}),s.forEach((e,t)=>e.draw(t)),n.restore()},getConfig(){return{yPaddingPx:t.yPaddingPx,indicators:{...t.indicators}}},setConfig(e){if(typeof e.yPaddingPx==`number`&&(t.yPaddingPx=e.yPaddingPx),e.indicators&&typeof e.indicators==`object`)for(let[n,r]of Object.entries(e.indicators))t.indicators[n]||(t.indicators[n]={enabled:!1,params:{}}),r.enabled!==void 0&&(t.indicators[n].enabled=r.enabled),r.params&&(t.indicators[n].params=r.params)}}}function ps(e,t){let n=Array(e.length),r=2/(t+1);if(e.length===0)return n;n[0]=e[0].close;for(let t=1;t<e.length;t++){let i=e[t];i&&(n[t]=i.close*r+n[t-1]*(1-r))}return n}function ms(e,t){let n=Array(e.length),r=2/(t+1),i=e.findIndex(e=>e!==void 0);if(i===-1)return n;n[i]=e[i];for(let t=i+1;t<e.length;t++){let i=e[t],a=n[t-1];i===void 0||a===void 0||(n[t]=i*r+a*(1-r))}return n}function hs(e,t,n,r){let i=Array(e.length);if(e.length<n)return i;let a=ps(e,t),o=ps(e,n),s=Array(e.length);for(let t=0;t<e.length;t++){let e=a[t],n=o[t];e!==void 0&&n!==void 0&&(s[t]=e-n)}let c=ms(s,r);for(let t=0;t<e.length;t++){let e=s[t],n=c[t];e!==void 0&&n!==void 0&&(i[t]={dif:e,dea:n,macd:(e-n)*2})}return i}function gs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={fastPeriod:12,slowPeriod:26,signalPeriod:9,showDIF:!0,showDEA:!0,showBAR:!0,...n},i=null,a=0,o=0,s=0,c=[];function l(e){return(i!==e||a!==r.fastPeriod||o!==r.slowPeriod||s!==r.signalPeriod)&&(c=hs(e,r.fastPeriod,r.slowPeriod,r.signalPeriod),i=e,a=r.fastPeriod,o=r.slowPeriod,s=r.signalPeriod),c}return{name:`macd_${t}`,version:`1.0.0`,description:`MACD 指标渲染器`,debugName:`MACD`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:s,kGap:c,dpr:u,kLinePositions:d}=e,f=i;if(f.length<r.slowPeriod)return;let p=l(f),m=-1/0,h=1/0;for(let e=a.start;e<a.end&&e<p.length;e++){let t=p[e];t&&(m=Math.max(m,t.dif,t.dea,t.macd),h=Math.min(h,t.dif,t.dea,t.macd))}if(!Number.isFinite(m)||!Number.isFinite(h))return;let g=Math.max(.05,(m-h)*.1),_=h-g,v=m+g-_||1,y=n.height-(0-_)/v*n.height;t.save(),t.translate(-o,0);let b=Math.max(a.start,r.slowPeriod-1),x=Math.min(a.end,f.length);if(r.showBAR){let e=(s+c)*u,r=Math.max(1,Math.round(e-1))/u,i=Math.round(y*u)/u,o=d[b-a.start]??0,l=Math.round((o+(s-r)/2)*u);for(let a=b;a<x;a++){let o=p[a];if(!o)continue;let s=(l+(a-b)*Math.round(e))/u,c=n.height-(o.macd-_)/v*n.height,d=o.macd>=0,f=a>0?p[a-1]:null,m;m=f?o.macd>=f.macd:!0;let h;h=d?m?X.BAR_UP:X.BAR_UP_LIGHT:m?X.BAR_DOWN_LIGHT:X.BAR_DOWN,t.fillStyle=h;let g=Math.round(c*u)/u,y=1/u;if(d){let e=i-g,n=e<=0?y:Math.max(e,y),a=e<=0?i-y:i-n;t.fillRect(s,a,r,n)}else{let e=g-i,n=e<=0?y:Math.max(e,y);t.fillRect(s,i,r,n)}}}if(r.showDIF){t.strokeStyle=X.DIF,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=p[r];if(!i)continue;let o=d[r-a.start];if(o===void 0)continue;let c=o+s/2,l=n.height-(i.dif-_)/v*n.height,f=Q(c,u),m=Q(l,u);e?(t.moveTo(f,m),e=!1):t.lineTo(f,m)}t.stroke()}if(r.showDEA){t.strokeStyle=X.DEA,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=p[r];if(!i)continue;let o=d[r-a.start];if(o===void 0)continue;let c=o+s/2,l=n.height-(i.dea-_)/v*n.height,f=Q(c,u),m=Q(l,u);e?(t.moveTo(f,m),e=!1):t.lineTo(f,m)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`fastPeriod`in e&&e.fastPeriod!==r.fastPeriod&&(i=null),`slowPeriod`in e&&e.slowPeriod!==r.slowPeriod&&(i=null),`signalPeriod`in e&&e.signalPeriod!==r.signalPeriod&&(i=null),Object.assign(r,e)}}}function _s(e,t,n=12,r=26,i=9){return t<r||t>=e.length?null:hs(e,n,r,i)[t]??null}function vs(e,t,n=12,r=26,i=9){let a=_s(e,t,n,r,i);return a?{name:`MACD`,params:[n,r,i],values:[{label:`DIF`,value:a.dif,color:X.DIF},{label:`DEA`,value:a.dea,color:X.DEA},{label:`MACD`,value:a.macd,color:a.macd>=0?X.BAR_UP:X.BAR_DOWN}]}:null}function ys(e,t){let n=Array(e.length);if(e.length<t+1)return n;let r=[];for(let t=1;t<e.length;t++)r.push(e[t].close-e[t-1].close);let i=0,a=0;for(let e=0;e<t;e++){let t=r[e];t!==void 0&&(t>0?i+=t:a+=Math.abs(t))}let o=i/t,s=a/t;s===0?n[t]=100:n[t]=100-100/(1+o/s);for(let e=t;e<r.length;e++){let i=r[e];if(i!==void 0)if(i>0?(o=(o*(t-1)+i)/t,s=s*(t-1)/t):(o=o*(t-1)/t,s=(s*(t-1)+Math.abs(i))/t),s===0)n[e+1]=100;else{let t=o/s;n[e+1]=100-100/(1+t)}}return n}function bs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period1:6,period2:12,period3:24,showRSI1:!0,showRSI2:!0,showRSI3:!0,...n},i=null,a=0,o=0,s=0,c=[],l=[],u=[];function d(e){return(i!==e||a!==r.period1||o!==r.period2||s!==r.period3)&&(c=ys(e,r.period1),l=ys(e,r.period2),u=ys(e,r.period3),i=e,a=r.period1,o=r.period2,s=r.period3),{rsi1:c,rsi2:l,rsi3:u}}return{name:`rsi_${t}`,version:`1.0.0`,description:`RSI 相对强弱指标渲染器`,debugName:`RSI`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:s,dpr:c,kLinePositions:l}=e,u=i;if(u.length<r.period1+1)return;let{rsi1:f,rsi2:p,rsi3:m}=d(u);t.save(),t.translate(-o,0);let h=n.height-80/100*n.height,g=n.height-50/100*n.height,_=n.height-20/100*n.height,v=o,y=o+e.paneWidth;t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(v,h),t.lineTo(y,h),t.moveTo(v,g),t.lineTo(y,g),t.moveTo(v,_),t.lineTo(y,_),t.stroke(),t.setLineDash([]);let b=Math.max(a.start,r.period1),x=Math.min(a.end,u.length),S=(e,r)=>{t.strokeStyle=r,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let i=!0;for(let r=b;r<x;r++){let o=e[r];if(o===void 0)continue;let u=l[r-a.start];if(u===void 0)continue;let d=u+s/2,f=n.height-(o-0)/100*n.height,p=Q(d,c),m=Q(f,c);i?(t.moveTo(p,m),i=!1):t.lineTo(p,m)}t.stroke()};r.showRSI1&&S(f,da.RSI1),r.showRSI2&&S(p,da.RSI2),r.showRSI3&&S(m,da.RSI3),t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period1`in e&&e.period1!==r.period1&&(i=null),`period2`in e&&e.period2!==r.period2&&(i=null),`period3`in e&&e.period3!==r.period3&&(i=null),Object.assign(r,e)}}}function xs(e,t,n=6,r=12,i=24){if(t<n+1||t>=e.length)return null;let a=ys(e,n)[t],o=ys(e,r)[t],s=ys(e,i)[t],c=[];return a!==void 0&&c.push({label:`RSI${n}`,value:a,color:da.RSI1}),o!==void 0&&c.push({label:`RSI${r}`,value:o,color:da.RSI2}),s!==void 0&&c.push({label:`RSI${i}`,value:s,color:da.RSI3}),c.length===0?null:{name:`RSI`,params:[n,r,i],values:c}}function Ss(e,t){let n=Array(e.length);if(e.length<t)return n;let r=e.map(e=>(e.high+e.low+e.close)/3);for(let i=t-1;i<e.length;i++){let e=0;for(let n=0;n<t;n++)e+=r[i-n];let a=e/t,o=0;for(let e=0;e<t;e++)o+=Math.abs(r[i-e]-a);let s=o/t;s===0?n[i]=0:n[i]=(r[i]-a)/(.015*s)}return n}function Cs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period:14,showCCI:!0,...n},i=null,a=0,o=[];function s(e){return(i!==e||a!==r.period)&&(o=Ss(e,r.period),i=e,a=r.period),o}return{name:`cci_${t}`,version:`1.0.0`,description:`CCI 顺势指标渲染器`,debugName:`CCI`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.period)return;let f=s(d),p=-1/0,m=1/0;for(let e=a.start;e<a.end&&e<f.length;e++){let t=f[e];t!==void 0&&(p=Math.max(p,t),m=Math.min(m,t))}if(!Number.isFinite(p)||!Number.isFinite(m))return;p=Math.max(p,150),m=Math.min(m,-150);let h=p-m||1,g=n.height-(0-m)/h*n.height;t.save(),t.translate(-o,0);let _=n.height-(100-m)/h*n.height,v=n.height-(-100-m)/h*n.height,y=o,b=o+e.paneWidth;t.strokeStyle=fa.OVERBOUGHT,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(y,_),t.lineTo(b,_),t.stroke(),t.strokeStyle=fa.OVERSOLD,t.beginPath(),t.moveTo(y,v),t.lineTo(b,v),t.stroke(),t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.beginPath(),t.moveTo(y,g),t.lineTo(b,g),t.stroke(),t.setLineDash([]);let x=Math.max(a.start,r.period-1),S=Math.min(a.end,d.length);if(r.showCCI){t.strokeStyle=fa.CCI,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=x;r<S;r++){let i=f[r];if(i===void 0)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i-m)/h*n.height,p=Q(s,l),g=Q(d,l);e?(t.moveTo(p,g),e=!1):t.lineTo(p,g)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period`in e&&e.period!==r.period&&(i=null),Object.assign(r,e)}}}function ws(e,t,n){return Ss(e,n)[t]}function Ts(e,t,n=14){if(t<n||t>=e.length)return null;let r=ws(e,t,n);return r===void 0?null:{name:`CCI`,params:[n],values:[{label:`CCI`,value:r,color:fa.CCI}]}}function Es(e,t,n){let r=Array(e.length);if(e.length<t)return r;let i=Array(e.length);for(let n=t-1;n<e.length;n++){let r=-1/0,a=1/0;for(let i=0;i<t;i++){let t=e[n-i];t&&(r=Math.max(r,t.high),a=Math.min(a,t.low))}let o=e[n].close;r===a?i[n]=50:i[n]=(o-a)/(r-a)*100}for(let a=t-1+n-1;a<e.length;a++){let e=i[a];if(e===void 0)continue;let t=0,o=0;for(let e=0;e<n;e++){let n=i[a-e];n!==void 0&&(t+=n,o++)}o===n&&(r[a]={k:e,d:t/n})}return r}function Ds(e={}){let{paneId:t=`sub`,config:n={}}=e,r={n:9,m:3,showK:!0,showD:!0,...n},i=null,a=0,o=0,s=[];function c(e){return(i!==e||a!==r.n||o!==r.m)&&(s=Es(e,r.n,r.m),i=e,a=r.n,o=r.m),s}return{name:`stoch_${t}`,version:`1.0.0`,description:`STOCH 随机指标渲染器`,debugName:`STOCH`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:s,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.n+r.m-1)return;let f=c(d);t.save(),t.translate(-o,0);let p=n.height-80/100*n.height,m=n.height-20/100*n.height,h=o,g=o+e.paneWidth;t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(h,p),t.lineTo(g,p),t.moveTo(h,m),t.lineTo(g,m),t.stroke(),t.setLineDash([]);let _=Math.max(a.start,r.n+r.m-2),v=Math.min(a.end,d.length);if(r.showK){t.strokeStyle=pa.K,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=_;r<v;r++){let i=f[r];if(!i)continue;let o=u[r-a.start];if(o===void 0)continue;let c=o+s/2,d=n.height-(i.k-0)/100*n.height,p=Q(c,l),m=Q(d,l);e?(t.moveTo(p,m),e=!1):t.lineTo(p,m)}t.stroke()}if(r.showD){t.strokeStyle=pa.D,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=_;r<v;r++){let i=f[r];if(!i)continue;let o=u[r-a.start];if(o===void 0)continue;let c=o+s/2,d=n.height-(i.d-0)/100*n.height,p=Q(c,l),m=Q(d,l);e?(t.moveTo(p,m),e=!1):t.lineTo(p,m)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`n`in e&&e.n!==r.n&&(i=null),`m`in e&&e.m!==r.m&&(i=null),Object.assign(r,e)}}}function Os(e,t,n,r){return Es(e,n,r)[t]}function ks(e,t,n=9,r=3){if(t<n+r-1||t>=e.length)return null;let i=Os(e,t,n,r);return i?{name:`STOCH`,params:[n,r],values:[{label:`K`,value:i.k,color:pa.K},{label:`D`,value:i.d,color:pa.D}]}:null}function As(e,t){let n=Array(e.length);if(e.length<t+1)return n;for(let r=t;r<e.length;r++){let i=e[r]?.close,a=e[r-t]?.close;i!==void 0&&a!==void 0&&(n[r]=i-a)}return n}function js(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period:10,showMOM:!0,...n},i=null,a=0,o=[];function s(e){return(i!==e||a!==r.period)&&(o=As(e,r.period),i=e,a=r.period),o}return{name:`mom_${t}`,version:`1.0.0`,description:`MOM 动量指标渲染器`,debugName:`MOM`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.period+1)return;let f=s(d),p=-1/0,m=1/0;for(let e=a.start;e<a.end&&e<f.length;e++){let t=f[e];t!==void 0&&(p=Math.max(p,t),m=Math.min(m,t))}if(!Number.isFinite(p)||!Number.isFinite(m))return;let h=Math.max(Math.abs(p),Math.abs(m))*.1;p+=h,m-=h;let g=p-m||1,_=n.height-(0-m)/g*n.height;t.save(),t.translate(-o,0);let v=o,y=o+e.paneWidth;t.strokeStyle=ma.ZERO,t.lineWidth=1,t.beginPath(),t.moveTo(v,_),t.lineTo(y,_),t.stroke();let b=Math.max(a.start,r.period),x=Math.min(a.end,d.length);if(r.showMOM){t.strokeStyle=ma.MOM,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=f[r];if(i===void 0)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i-m)/g*n.height,p=Q(s,l),h=Q(d,l);e?(t.moveTo(p,h),e=!1):t.lineTo(p,h)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period`in e&&e.period!==r.period&&(i=null),Object.assign(r,e)}}}function Ms(e,t,n){return As(e,n)[t]}function Ns(e,t,n=10){if(t<n||t>=e.length)return null;let r=Ms(e,t,n);return r===void 0?null:{name:`MOM`,params:[n],values:[{label:`MOM`,value:r,color:ma.MOM}]}}function Ps(e,t){let n=Array(e.length);if(e.length<t)return n;for(let r=t-1;r<e.length;r++){let i=-1/0,a=1/0;for(let n=0;n<t;n++){let t=e[r-n];t&&(i=Math.max(i,t.high),a=Math.min(a,t.low))}let o=e[r].close;i===a?n[r]=-50:n[r]=(i-o)/(i-a)*-100}return n}function Fs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period:14,showWMSR:!0,...n},i=null,a=0,o=[];function s(e){return(i!==e||a!==r.period)&&(o=Ps(e,r.period),i=e,a=r.period),o}return{name:`wmsr_${t}`,version:`1.0.0`,description:`WMSR 威廉指标渲染器`,debugName:`WMSR`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.period)return;let f=s(d),p=-100;0-p,t.save(),t.translate(-o,0);let m=n.height-(-20-p)/100*n.height,h=n.height-(-80-p)/100*n.height,g=n.height-(-50-p)/100*n.height,_=o,v=o+e.paneWidth;t.strokeStyle=ha.OVERBOUGHT,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(_,m),t.lineTo(v,m),t.stroke(),t.strokeStyle=ha.OVERSOLD,t.beginPath(),t.moveTo(_,h),t.lineTo(v,h),t.stroke(),t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.beginPath(),t.moveTo(_,g),t.lineTo(v,g),t.stroke(),t.setLineDash([]);let y=Math.max(a.start,r.period-1),b=Math.min(a.end,d.length);if(r.showWMSR){t.strokeStyle=ha.WMSR,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=y;r<b;r++){let i=f[r];if(i===void 0)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i-p)/100*n.height,m=Q(s,l),h=Q(d,l);e?(t.moveTo(m,h),e=!1):t.lineTo(m,h)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period`in e&&e.period!==r.period&&(i=null),Object.assign(r,e)}}}function Is(e,t,n){return Ps(e,n)[t]}function Ls(e,t,n=14){if(t<n||t>=e.length)return null;let r=Is(e,t,n);return r===void 0?null:{name:`WMSR`,params:[n],values:[{label:`WMSR`,value:r,color:ha.WMSR}]}}function Rs(e,t){let n=Array(e.length);if(e.length<t+1)return n;for(let r=t;r<e.length;r++){let i=e[r]?.close,a=e[r-t]?.close;i!==void 0&&a!==void 0&&a!==0&&(n[r]=(i-a)/a*100)}return n}function zs(e,t){let n=Array(e.length),r=0,i=0;for(let a=0;a<e.length;a++){let o=e[a];if(o!==void 0){if(r+=o,i++,i>t){let n=e[a-t];n!==void 0&&(r-=n,i--)}i===t&&(n[a]=r/t)}}return n}function Bs(e,t,n,r,i,a){let o=Array(e.length),s=Rs(e,t),c=Rs(e,n),l=Rs(e,r),u=Rs(e,i),d=zs(s,10),f=zs(c,10),p=zs(l,10),m=zs(u,15),h=Array(e.length);for(let t=0;t<e.length;t++){let e=d[t],n=f[t],r=p[t],i=m[t];e!==void 0&&n!==void 0&&r!==void 0&&i!==void 0&&(h[t]=e*1+n*2+r*3+i*4)}let g=zs(h,a);for(let t=0;t<e.length;t++){let e=h[t],n=g[t];e!==void 0&&n!==void 0&&(o[t]={kst:e,signal:n})}return o}function Vs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={roc1:10,roc2:15,roc3:20,roc4:30,signalPeriod:9,showKST:!0,showSignal:!0,...n},i=null,a=``,o=[];function s(e){let t=`${r.roc1}-${r.roc2}-${r.roc3}-${r.roc4}-${r.signalPeriod}`;return(i!==e||a!==t)&&(o=Bs(e,r.roc1,r.roc2,r.roc3,r.roc4,r.signalPeriod),i=e,a=t),o}return{name:`kst_${t}`,version:`1.0.0`,description:`KST 确知指标渲染器`,debugName:`KST`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.roc4+15+r.signalPeriod)return;let f=s(d),p=-1/0,m=1/0;for(let e=a.start;e<a.end&&e<f.length;e++){let t=f[e];t&&(p=Math.max(p,t.kst,t.signal),m=Math.min(m,t.kst,t.signal))}if(!Number.isFinite(p)||!Number.isFinite(m))return;let h=(p-m)*.1||1;p+=h,m-=h;let g=p-m||1,_=n.height-(0-m)/g*n.height;t.save(),t.translate(-o,0);let v=o,y=o+e.paneWidth;t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.lineWidth=1,t.beginPath(),t.moveTo(v,_),t.lineTo(y,_),t.stroke();let b=Math.max(a.start,r.roc4+15+r.signalPeriod-1),x=Math.min(a.end,d.length);if(r.showKST){t.strokeStyle=ga.KST,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=f[r];if(!i)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i.kst-m)/g*n.height,p=Q(s,l),h=Q(d,l);e?(t.moveTo(p,h),e=!1):t.lineTo(p,h)}t.stroke()}if(r.showSignal){t.strokeStyle=ga.SIGNAL,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=b;r<x;r++){let i=f[r];if(!i)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i.signal-m)/g*n.height,p=Q(s,l),h=Q(d,l);e?(t.moveTo(p,h),e=!1):t.lineTo(p,h)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){i=null,Object.assign(r,e)}}}function Hs(e,t,n,r,i,a,o){return Bs(e,n,r,i,a,o)[t]}function Us(e,t,n=10,r=15,i=20,a=30,o=9){if(t<a+15+o||t>=e.length)return null;let s=Hs(e,t,n,r,i,a,o);return s?{name:`KST`,params:[n,r,i,a,o],values:[{label:`KST`,value:s.kst,color:ga.KST},{label:`Signal`,value:s.signal,color:ga.SIGNAL}]}:null}function Ws(e,t){let n=Array(e.length);if(e.length<t)return n;for(let r=t-1;r<e.length;r++){let i=-1/0,a=1/0;for(let n=0;n<t;n++){let t=e[r-n];t&&(i=Math.max(i,t.high),a=Math.min(a,t.low))}let o=e[r].close;i===a?n[r]=50:n[r]=(o-a)/(i-a)*100}return n}function Gs(e={}){let{paneId:t=`sub`,config:n={}}=e,r={period:9,showFASTK:!0,...n},i=null,a=0,o=[];function s(e){return(i!==e||a!==r.period)&&(o=Ws(e,r.period),i=e,a=r.period),o}return{name:`fastk_${t}`,version:`1.0.0`,description:`FASTK 快速随机指标渲染器`,debugName:`FASTK`,paneId:t,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:i,range:a,scrollLeft:o,kWidth:c,dpr:l,kLinePositions:u}=e,d=i;if(d.length<r.period)return;let f=s(d);t.save(),t.translate(-o,0);let p=n.height-80/100*n.height,m=n.height-20/100*n.height,h=o,g=o+e.paneWidth;t.strokeStyle=`rgba(0, 0, 0, 0.1)`,t.lineWidth=1,t.setLineDash([4,4]),t.beginPath(),t.moveTo(h,p),t.lineTo(g,p),t.moveTo(h,m),t.lineTo(g,m),t.stroke(),t.setLineDash([]);let _=Math.max(a.start,r.period-1),v=Math.min(a.end,d.length);if(r.showFASTK){t.strokeStyle=pa.K,t.lineWidth=1,t.lineJoin=`round`,t.lineCap=`round`,t.beginPath();let e=!0;for(let r=_;r<v;r++){let i=f[r];if(i===void 0)continue;let o=u[r-a.start];if(o===void 0)continue;let s=o+c/2,d=n.height-(i-0)/100*n.height,p=Q(s,l),m=Q(d,l);e?(t.moveTo(p,m),e=!1):t.lineTo(p,m)}t.stroke()}t.restore()},onDataUpdate(){i=null},getConfig(){return{...r}},setConfig(e){`period`in e&&e.period!==r.period&&(i=null),Object.assign(r,e)}}}function Ks(e,t,n){return Ws(e,n)[t]}function qs(e,t,n=9){if(t<n||t>=e.length)return null;let r=Ks(e,t,n);return r===void 0?null:{name:`FASTK`,params:[n],values:[{label:`FASTK`,value:r,color:pa.K}]}}function Js(e){let{indicatorId:t,paneId:n}=e;switch(t){case`VOLUME`:return qo({paneId:n});case`MACD`:return gs({paneId:n});case`RSI`:return bs({paneId:n});case`CCI`:return Cs({paneId:n});case`STOCH`:return Ds({paneId:n});case`MOM`:return js({paneId:n});case`WMSR`:return Fs({paneId:n});case`KST`:return Vs({paneId:n});case`FASTK`:return Gs({paneId:n});default:throw Error(`Unknown indicator: ${t}`)}}var Ys=class e{dom;opt;data=[];raf=null;viewport=null;paneRenderers=[];markerManager;interaction;pluginHost;rendererPluginManager;preciseDpr=0;dprObserver;constructor(e,t){if(this.dom=e,this.opt=t,this.interaction=new Go(this),this.markerManager=new Ja,this.pluginHost=Wi(),this.rendererPluginManager=new Ki,this.rendererPluginManager.setPluginHost(this.pluginHost),this.rendererPluginManager.setInvalidateCallback(()=>this.scheduleDraw()),this.initPanes(),typeof ResizeObserver<`u`&&`devicePixelContentBoxSize`in ResizeObserverEntry.prototype){let e=this.dom.canvasLayer;e&&(this.dprObserver=new ResizeObserver(e=>{let t=e[0];if(!t)return;let n=t.devicePixelContentBoxSize?.[0],r=t.contentBoxSize?.[0];if(n&&r){let e=n.inlineSize/r.inlineSize;this.preciseDpr=Math.round(e*64)/64}}),this.dprObserver.observe(e))}}get plugin(){return this.pluginHost}useRenderer(e,t){this.rendererPluginManager.register(e),t&&e.setConfig&&e.setConfig(t)}removeRenderer(e){this.rendererPluginManager.unregister(e)}getRenderer(e){return this.rendererPluginManager.getPlugin(e)}updateRendererConfig(e,t){this.rendererPluginManager.updateConfig(e,t)}setRendererEnabled(e,t){this.rendererPluginManager.setEnabled(e,t)}getAllRenderers(){return this.rendererPluginManager.getAllPlugins()}draw(){this.markerManager.clear();let e=this.computeViewport();if(!e||this.data.length===0)return;let{start:t,end:n}=Vo(e.scrollLeft,e.plotWidth,this.opt.kWidth,this.opt.kGap,this.data.length,e.dpr),r={start:t,end:n},i=this.calcKLinePositions(r),{kWidthPx:a}=Bo(this.opt.kWidth,this.opt.kGap,e.dpr);this.interaction.setKLinePositions(i,r,a);for(let t of this.paneRenderers){let n=t.getPane(),a=t.getDom().plotCanvas.getContext(`2d`),o=t.getDom().yAxisCanvas.getContext(`2d`);n.updateRange(this.data,r),a&&(a.setTransform(1,0,0,1,0,0),a.scale(e.dpr,e.dpr),a.clearRect(0,0,e.plotWidth+1,n.height+2/e.dpr));let s=this.opt.rightAxisWidth+(this.opt.priceLabelWidth||60);o&&(o.setTransform(1,0,0,1,0,0),o.scale(e.dpr,e.dpr),o.clearRect(0,0,s,n.height+2/e.dpr));let c={ctx:a,pane:Ri(n),data:this.data,range:r,scrollLeft:e.scrollLeft,kWidth:this.opt.kWidth,kGap:this.opt.kGap,dpr:e.dpr,paneWidth:e.plotWidth,kLinePositions:i,markerManager:this.markerManager,yAxisCtx:o??void 0};if(a){a.save();let e=this.rendererPluginManager.render(n.id,c);e.length>0&&this.pluginHost.events.emit(`renderer:error`,{paneId:n.id,errors:e}),a.restore()}}let o=this.dom.xAxisCanvas.getContext(`2d`);if(o){let t={ctx:o,pane:{id:`xAxis`,top:0,height:this.opt.bottomAxisHeight,yAxis:{priceToY:()=>0,yToPrice:()=>0,getPaddingTop:()=>0,getPaddingBottom:()=>0,getPriceOffset:()=>0},priceRange:{maxPrice:0,minPrice:0}},data:this.data,range:r,scrollLeft:e.scrollLeft,kWidth:this.opt.kWidth,kGap:this.opt.kGap,dpr:e.dpr,paneWidth:e.plotWidth,kLinePositions:i,xAxisCtx:o},n=this.rendererPluginManager.renderPlugin(`timeAxis`,t);n.length>0&&this.pluginHost.events.emit(`renderer:error`,{paneId:`timeAxis`,errors:n})}}zoomAt(e,t,n){let r=this.opt.kWidth+this.opt.kGap,i=(t+e)/r,a=this.viewport?.dpr||window.devicePixelRatio||1,o=Math.round(this.opt.kWidth*a),s=n>0?-2:2,c=o+s;c%2==0&&(c+=s>0?1:-1);let l=c/a,u=3/a;if(l=Math.max(this.opt.minKWidth,Math.min(this.opt.maxKWidth,l)),Math.abs(l-this.opt.kWidth)<.01)return;let d=i*(l+u)-e;if(this.onZoomChange){this.onZoomChange(l,u,d);return}this.opt={...this.opt,kWidth:l,kGap:u};let f=this.dom.container,p=Math.max(0,f.scrollWidth-f.clientWidth);f.scrollLeft=Math.min(Math.max(0,d),p),this.scheduleDraw()}applyZoom(e,t){this.opt={...this.opt,kWidth:e,kGap:t},this.scheduleDraw()}onZoomChange;setOnZoomChange(e){this.onZoomChange=e}getPaneRenderers(){return this.paneRenderers}getMarkerManager(){return this.markerManager}updateCustomMarkers(e){this.markerManager.setCustomMarkers(e),this.scheduleDraw()}clearCustomMarkers(){this.markerManager.clearCustomMarkers(),this.scheduleDraw()}getDom(){return this.dom}getOption(){return this.opt}calcKLinePositions(e){let{start:t,end:n}=e,r=n-t;if(r<=0)return[];let i=this.viewport?.dpr||window.devicePixelRatio||1,{unitPx:a,startXPx:o}=Bo(this.opt.kWidth,this.opt.kGap,i),s=Array(r);for(let e=0;e<r;e++)s[e]=(o+(t+e)*a)/i;return s}updateOptions(e){this.opt={...this.opt,...e},e.panes&&this.initPanes(),this.resize()}updatePaneLayout(e){this.opt.panes=e,this.layoutPanes(),this.scheduleDraw()}addPane(e){if(this.paneRenderers.some(t=>t.getPane().id===e)){console.warn(`Pane "${e}" already exists`);return}let t=new Wo(e),n=document.createElement(`canvas`),r=document.createElement(`canvas`),i=e===`main`;n.id=`${e}-plot`,n.className=i?`plot-canvas main`:`plot-canvas sub`,n.style.position=`absolute`,n.style.left=`0`,n.style.top=`0`,r.id=`${e}-yAxis`,r.className=`right-axis`,r.style.position=`absolute`,r.style.right=`0`;let a=new Ko({plotCanvas:n,yAxisCanvas:r},t,{rightAxisWidth:this.opt.rightAxisWidth,yPaddingPx:0,priceLabelWidth:this.opt.priceLabelWidth});this.paneRenderers.push(a);let o=this.dom.canvasLayer;o&&(o.appendChild(n),o.appendChild(r)),this.rendererPluginManager.addKnownPaneId(e)}removePane(e){let t=this.paneRenderers.findIndex(t=>t.getPane().id===e);if(t===-1)return;let n=this.paneRenderers[t];if(!n)return;let r=n.getDom();r.plotCanvas.remove(),r.yAxisCanvas.remove(),this.paneRenderers.splice(t,1),this.rendererPluginManager.removeKnownPaneId(e)}hasPane(e){return this.paneRenderers.some(t=>t.getPane().id===e)}static SUB_PANE_PREFIX=`sub_`;createSubPane(t,n){let r=`${e.SUB_PANE_PREFIX}${t}`;if(this.hasPane(r)){let e=`${t.toLowerCase()}_${r}`;return n&&this.updateRendererConfig(e,n),!0}this.addPane(r);let i=Js({indicatorId:t,paneId:r});return this.useRenderer(i,n),this.layoutPanes(),this.scheduleDraw(),!0}removeSubPane(t){let n=`${e.SUB_PANE_PREFIX}${t}`;if(!this.hasPane(n))return;let r=`${t.toLowerCase()}_${n}`;this.removeRenderer(r),this.removePane(n),this.layoutPanes(),this.scheduleDraw()}clearSubPanes(){let t=this.paneRenderers.map(e=>e.getPane().id).filter(t=>t.startsWith(e.SUB_PANE_PREFIX));for(let n of t){let t=n.slice(e.SUB_PANE_PREFIX.length);this.removeSubPane(t)}}getSubPaneIndicators(){return this.paneRenderers.map(e=>e.getPane().id).filter(t=>t.startsWith(e.SUB_PANE_PREFIX)).map(t=>t.slice(e.SUB_PANE_PREFIX.length))}translatePrice(e,t){let n=this.paneRenderers.find(t=>t.getPane().id===e);if(!n)return;let r=n.getPane(),i=r.yAxis.deltaYToPriceOffset(t),a=r.yAxis.getPriceOffset();r.yAxis.setPriceOffset(a+i),this.scheduleDraw()}updateData(e){this.data=e??[];let t=this.dom.container;if(t){let e=this.getContentWidth(),n=Math.max(0,e-t.clientWidth);t.scrollLeft>n&&(t.scrollLeft=n)}this.interaction.reset(),this.scheduleDraw()}getData(){return this.data}getContentWidth(){let e=this.data?.length??0,t=this.viewport?.dpr||window.devicePixelRatio||1,{startXPx:n,unitPx:r}=Bo(this.opt.kWidth,this.opt.kGap,t);return(n+e*r)/t}resize(){let e=this.computeViewport();!e||e.viewWidth<10||e.viewHeight<10||(this.layoutPanes(),this.scheduleDraw())}scheduleDraw(){this.raf!=null&&cancelAnimationFrame(this.raf),this.raf=requestAnimationFrame(()=>{this.raf=null,this.draw()})}async destroy(){this.raf!=null&&cancelAnimationFrame(this.raf),this.raf=null,this.dprObserver?.disconnect(),this.dprObserver=void 0,this.preciseDpr=0,this.viewport=null,this.paneRenderers.forEach(e=>e.destroy()),this.paneRenderers=[],this.rendererPluginManager.clear(),this.onZoomChange=void 0,await this.pluginHost.destroy()}initPanes(){this.paneRenderers=this.opt.panes.map(e=>{let t=new Wo(e.id),n=document.createElement(`canvas`),r=document.createElement(`canvas`),i=e.id===`main`;return n.id=`${e.id}-plot`,n.className=i?`plot-canvas main`:`plot-canvas sub`,n.style.position=`absolute`,n.style.left=`0`,n.style.top=`0`,r.id=`${e.id}-yAxis`,r.className=`right-axis`,r.style.position=`absolute`,r.style.right=`0`,new Ko({plotCanvas:n,yAxisCanvas:r},t,{rightAxisWidth:this.opt.rightAxisWidth,yPaddingPx:this.opt.yPaddingPx,priceLabelWidth:this.opt.priceLabelWidth})});let e=this.dom.canvasLayer;e&&(e.querySelectorAll(`canvas:not(.x-axis-canvas)`).forEach(e=>e.remove()),this.paneRenderers.forEach(t=>{let n=t.getDom();e.appendChild(n.plotCanvas),e.appendChild(n.yAxisCanvas)}))}layoutPanes(){let e=this.viewport;if(!e)return;let t=this.opt.panes.filter(e=>e.visible!==!1),n=Math.max(0,this.opt.paneGap??0),r=0,i=n*Math.max(0,t.length-1),a=Math.max(1,e.plotHeight-i),o=Math.max(0,t.length-1),s=o===0?1:.85**o,c=o>0?(1-s)/o:0,l=t.map((e,t)=>Math.round(a*(t===0?s:c))),u=l.reduce((e,t)=>e+t,0),d=l.length-1;d>=0&&(l[d]+=a-u);for(let i=0;i<t.length;i++){let a=t[i];if(!a)continue;let o=this.paneRenderers.find(e=>e.getPane().id===a.id);if(!o)continue;let s=o.getPane(),c=l[i];s.setLayout(r,c),s.id===`main`?s.setPadding(this.opt.yPaddingPx,this.opt.yPaddingPx):s.setPadding(0,0),o.resize(e.plotWidth,c,e.dpr);let u=o.getDom();u.plotCanvas.style.top=`${r}px`,u.yAxisCanvas.style.top=`${r}px`,r+=c+n}}computeViewport(){let e=this.dom.container;if(!e)return null;let t=Math.max(1,Math.round(e.clientWidth)),n=Math.max(1,Math.round(e.clientHeight)),r=this.opt.rightAxisWidth+(this.opt.priceLabelWidth||60),i=Math.round(t-r),a=Math.round(n-this.opt.bottomAxisHeight),o=this.preciseDpr>0?this.preciseDpr:Math.round((window.devicePixelRatio||1)*64)/64;o<1&&(o=1);let s=16*1024*1024;t*o*(n*o)>s&&(o=Math.sqrt(s/(t*n)));let c=Math.round(e.scrollLeft*o)/o;this.dom.canvasLayer.style.width=`${t}px`,this.dom.canvasLayer.style.height=`${n}px`,this.dom.xAxisCanvas.style.width=`${i}px`,this.dom.xAxisCanvas.style.height=`${this.opt.bottomAxisHeight}px`,this.dom.xAxisCanvas.width=Math.round(i*o),this.dom.xAxisCanvas.height=Math.round(this.opt.bottomAxisHeight*o);let l={viewWidth:t,viewHeight:n,plotWidth:i,plotHeight:a,scrollLeft:c,dpr:o};return this.viewport=l,l}};function Xs(e){return e.open>e.close?`down`:e.open<e.close?`up`:`flat`}var $=function(e){return e.RISE_WITH_VOLUME=`rise_with_volume`,e.RISE_WITHOUT_VOLUME=`rise_without_volume`,e.FALL_WITH_VOLUME=`fall_with_volume`,e.FALL_WITHOUT_VOLUME=`fall_without_volume`,e.OTHERS=`others`,e}({}),Zs={volumeAmplifyThreshold:1.5,volumeShrinkThreshold:.8,avgPeriod:20},Qs=class{prefixSum=[];dataLength=0;build(e){let t=e.length;if(t===0){this.prefixSum=[],this.dataLength=0;return}this.prefixSum=[0];for(let n=0;n<t;n++)this.prefixSum.push(this.prefixSum[n]+(e[n]?.volume??0));this.dataLength=t}query(e,t){return e<0||t>=this.dataLength||e>t?0:this.prefixSum[t+1]-this.prefixSum[e]}getVolumeMA(e,t){if(e<t-1)return 0;let n=e-t+1;return this.query(n,e)/t}get length(){return this.dataLength}};function $s(e,t,n,r=Zs){let i=new Qs;i.build(e);let a=[],{volumeAmplifyThreshold:o,volumeShrinkThreshold:s,avgPeriod:c}=r;for(let r=t;r<n&&r<e.length;r++){let t=e[r]?.volume;if(r<1||!t){a.push($.OTHERS);continue}let n=i.getVolumeMA(r,c),l=e[r];if(!l){a.push($.OTHERS);continue}let u=l.close-l.open,d=u>0,f=u<0,p=t>n*o,m=t<n*s;d&&p?a.push($.RISE_WITH_VOLUME):d&&m?a.push($.RISE_WITHOUT_VOLUME):f&&p?a.push($.FALL_WITH_VOLUME):f&&m?a.push($.FALL_WITHOUT_VOLUME):a.push($.OTHERS)}return a}function ec(){return{name:`candle`,version:`1.0.0`,description:`K线蜡烛图渲染器`,debugName:`K线`,paneId:`main`,priority:q.MAIN,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,kGap:s,dpr:c,kLinePositions:l,markerManager:u}=e,d=r;if(!d.length)return;let{kWidthPx:f}=Bo(o,s,c);t.save(),t.translate(-a,0);let p=l||[],m=$s(d,i.start,i.end,Zs);for(let e=i.start;e<i.end&&e<d.length;e++){let r=d[e];if(!r)continue;let a=n.yAxis.priceToY(r.open),s=n.yAxis.priceToY(r.close),l=n.yAxis.priceToY(r.high),h=n.yAxis.priceToY(r.low),g=p[e-i.start];if(!g)continue;let _=e=>Math.round(e*c)/c,v=_(a),y=_(s),b=_(l),x=_(h),S=Math.min(v,y),C=Math.max(Math.abs(v-y),1),w=$o(Math.round(g*c),S,f,C,c);t.fillStyle=Xs(r)===`up`?J.UP:J.DOWN,t.fillRect(w.bodyRect.x,w.bodyRect.y,w.bodyRect.width,w.bodyRect.height);let T=w.wickRect.width,E=w.wickRect.x,D=w.bodyRect.y,O=w.bodyRect.y+w.bodyRect.height,k=Math.max(r.open,r.close),A=Math.min(r.open,r.close);if(r.high>k){let e=Zo(E,b,D,c);e&&t.fillRect(e.x,e.y,T,e.height)}if(r.low<A){let e=Zo(E,O,x,c);e&&t.fillRect(e.x,e.y,T,e.height)}let j=m[e-i.start];if(j!==$.OTHERS&&u){let n=j===$.RISE_WITH_VOLUME||j===$.RISE_WITHOUT_VOLUME?b-15:x+15;tc(t,w.bodyRect.x+w.bodyRect.width/2,n,j,e,o,4,u,c)}}t.restore()}}}function tc(e,t,n,r,i,a,o=4,s,c){let l=e=>Math.round(e*c)/c;t=l(t),n=l(n);let u=Math.min(a,20),d=u*Math.sqrt(3)/2,f,p;switch(r){case $.RISE_WITH_VOLUME:f=`#FF4444`,p=!0;break;case $.RISE_WITHOUT_VOLUME:f=`#00C853`,p=!0;break;case $.FALL_WITH_VOLUME:f=`#FF4444`,p=!1;break;case $.FALL_WITHOUT_VOLUME:f=`#00C853`,p=!1;break;default:return}if(e.save(),e.beginPath(),p){let r=l(n-o),i=l(r-d);e.moveTo(t,i),e.lineTo(l(t-u/2),r),e.lineTo(l(t+u/2),r)}else{let r=l(n+o),i=l(r+d);e.moveTo(t,i),e.lineTo(l(t-u/2),r),e.lineTo(l(t+u/2),r)}e.closePath(),e.fillStyle=f,e.fill(),e.restore();let m,h;if(p){let e=l(l(n-o)-d);m=l(t-u/2),h=e}else{let e=l(n+o);l(e+d),m=l(t-u/2),h=e}let g;switch(r){case $.RISE_WITH_VOLUME:g=`RISE_WITH_VOLUME`;break;case $.RISE_WITHOUT_VOLUME:g=`RISE_WITHOUT_VOLUME`;break;case $.FALL_WITH_VOLUME:g=`FALL_WITH_VOLUME`;break;case $.FALL_WITHOUT_VOLUME:g=`FALL_WITHOUT_VOLUME`;break;default:return}let _=`mk_price-volume_${i}`;s.register({id:_,type:`triangle`,markerType:g,x:m,y:h,width:u,height:d,dataIndex:i,metadata:{relation:r}})}function nc(e,t){return t?Math.max(4,Math.min(8,Math.round(e/80))):2}function rc(){return{name:`gridLines`,version:`1.0.0`,description:`网格线渲染器`,debugName:`网格线`,paneId:zi,priority:q.GRID,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,dpr:s,kLinePositions:c}=e,l=r;if(!l.length)return;let u=nc(n.height,n.id===`main`);t.save(),t.fillStyle=la.HORIZONTAL,t.translate(-a,0);let d=t.canvas.width/s,f=a,p=a+d,m=n.yAxis.getPaddingTop(),h=n.yAxis.getPaddingBottom(),g=m,_=Math.max(m,n.height-h),v=Math.max(0,_-g);for(let e=0;e<u;e++){let n=u<=1?0:e/(u-1),r=Qo(f,p,Math.round(g+n*v),s);r&&t.fillRect(r.x,r.y,r.width,r.height)}let y=aa(l);for(let e of y){if(e<i.start||e>=i.end||e>=l.length)continue;let r=e-i.start;if(r<0||r>=c.length)continue;let a=Zo(c[r]+o/2,0,n.height,s);a&&t.fillRect(a.x,a.y,a.width,a.height)}t.restore()}}}function ic(){return{name:`lastPriceLine`,version:`1.0.0`,description:`最新价虚线渲染器`,debugName:`最新价线`,paneId:`main`,priority:q.FOREGROUND,draw(e){let{ctx:t,pane:n,data:r,scrollLeft:i,kWidth:a,dpr:o,kLinePositions:s}=e,c=r,l=c[c.length-1];if(!l)return;t.save(),t.translate(-i,0);let u=Math.round(n.yAxis.priceToY(l.close)),d=s[0]??0,f=(s[s.length-1]??0)+a;t.strokeStyle=J.LAST_PRICE,t.lineWidth=1,t.setLineDash([4,3]),t.beginPath();let p=(Math.floor(u*o)+.5)/o;t.moveTo(Math.round(d*o)/o,p),t.lineTo(Math.round(f*o)/o,p),t.stroke(),t.setLineDash([]),t.restore()}}}function ac(){return{name:`extremaMarkers`,version:`1.0.0`,description:`可视区最高/最低价标注渲染器`,debugName:`极值标记`,paneId:`main`,priority:q.OVERLAY,draw(e){let{ctx:t,pane:n,data:r,range:i,scrollLeft:a,kWidth:o,dpr:s,paneWidth:c,kLinePositions:l}=e,u=r;if(!u.length||n.id!==`main`)return;let d=Math.max(0,i.start),f=Math.min(u.length,i.end);if(f-d<=0)return;let p=-1/0,m=1/0,h=d,g=d;for(let e=d;e<f;e++){let t=u[e];t&&(t.high>=p&&(p=t.high,h=e),t.low<=m&&(m=t.low,g=e))}if(!Number.isFinite(p)||!Number.isFinite(m))return;let _=e=>{let t=e-i.start;return t<0||t>=l.length?0:l[t]+o/2};t.save(),t.translate(-a,0),oc(t,_(h),n.yAxis.priceToY(p),p,s,c,a),oc(t,_(g),n.yAxis.priceToY(m),m,s,c,a),t.restore()}}}function oc(e,t,n,r,i,a,o){let s=r.toFixed(2);e.font=`12px Arial`;let c=e.measureText(s).width,l=t-o+30+4+c>a,u=t,d=l?t-30:t+30;u>d&&([u,d]=[d,u]);let f=Qo(u,d,n,i);f&&(e.fillStyle=oa.WEAK,e.fillRect(f.x,f.y,f.width,f.height));let p=Z(d,i),m=Z(n,i);e.fillStyle=oa.WEAK,e.beginPath(),e.arc(p,m,2,0,Math.PI*2),e.fill(),e.font=`12px Arial`,e.textBaseline=`middle`,e.fillStyle=J.NEUTRAL,l?(e.textAlign=`right`,e.fillText(s,Z(t-30-4,i),Z(n,i))):(e.textAlign=`left`,e.fillText(s,Z(t+30+4,i),Z(n,i)))}function sc(e,t,n,r,i,a){let o=t-n||1,s=(e-n)/o;return i+Math.max(1,r-i-a)*(1-s)}function cc(e,t,n,r,i,a){let o=t-n||1,s=Math.max(1,r-i-a);return n+(1-(Math.min(Math.max(e,i),i+s)-i)/s)*o}function lc(e,t){let{x:n,y:r,width:i,height:a,priceRange:o,yPaddingPx:s=0,dpr:c,ticks:l=10,bgColor:u=sa.TRANSPARENT,textColor:d=oa.SECONDARY,lineColor:f=ca.DARK,fontSize:p=16,drawLeftBorder:m=!0,drawTickLines:h=!0,priceOffset:g=0}=t,_=Math.max(0,Math.min(s,Math.floor(a/2)-1)),{maxPrice:v,minPrice:y}=o,b=v-y,x=b===0?0:b/(Math.max(2,l)-1);e.fillStyle=u,e.fillRect(n,r,i,a),m&&(e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(Q(n,c),r),e.lineTo(Q(n,c),r+a),e.stroke()),e.font=`${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.textBaseline=`middle`,e.textAlign=`center`;let S=n+i/2;for(let t=0;t<Math.max(2,l);t++){let i=b===0?v:v-x*t,o=Math.round(sc(i,v,y,a,_,_)+r);if(h){e.strokeStyle=f,e.beginPath();let t=Q(o,c);e.moveTo(n,t),e.lineTo(n+4,t),e.stroke()}let s=i+g;e.fillStyle=d,e.fillText(s.toFixed(2),Z(S,c),Z(o,c))}}function uc(e,t){let{x:n,y:r,width:i,height:a,crosshairX:o,timestamp:s,dpr:c,fontSize:l=16,paddingX:u=8}=t,d=ia(s);e.save(),e.font=`${l}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.textBaseline=`middle`,e.textAlign=`center`;let f=Math.round(e.measureText(d).width),p=Math.min(i,f+u*2),m=a,h=Math.min(Math.max(o,n+p/2),n+i-p/2),g=r+a/2,_=h-p/2,v=r;e.fillStyle=`rgba(0, 0, 0, 0.8)`,e.fillRect(Z(_,c),Z(v,c),Z(p,c),Z(m,c)),e.fillStyle=`#ffffff`,e.fillText(d,Z(h,c),Z(g,c)),e.restore()}function dc(e,t){let{x:n,y:r,width:i,height:a,crosshairY:o,priceRange:s,yPaddingPx:c=0,dpr:l,fontSize:u=16}=t,d=Math.max(0,Math.min(c,Math.floor(a/2)-1)),{maxPrice:f,minPrice:p}=s,m=cc(o-r,f,p,a,d,d).toFixed(2);e.save(),e.font=`${u}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.textBaseline=`middle`,e.textAlign=`center`;let h=u+4,g=i,_=Math.min(Math.max(o,r+h/2),r+a-h/2),v=_-h/2;e.fillStyle=`rgba(0, 0, 0, 0.8)`;let y=Z(n,l),b=Z(v,l),x=Z(g,l),S=Z(h,l);e.fillRect(y,b,x,S);let C=n+i/2;e.fillStyle=`#ffffff`,e.fillText(m,Z(C,l),Z(_,l)),e.restore()}function fc(e,t){let{x:n,y:r,width:i,height:a,data:o,scrollLeft:s,kWidth:c,kGap:l,startIndex:u,endIndex:d,dpr:f,bgColor:p=sa.TRANSPARENT,textColor:m=oa.SECONDARY,lineColor:h=ca.DARK,fontSize:g=12,paddingX:_=8,drawTopBorder:v=!0,drawBottomBorder:y=!0}=t,b=Math.round(c*f),x=b%2==0?b+1:b,S=Math.round(l*f),C=x+S,w=S,T=C/f,E=w/f,D=x/f;e.fillStyle=p,e.fillRect(n,r,i,a),v&&(e.strokeStyle=h,e.lineWidth=1,e.beginPath(),e.moveTo(n,Q(r,f)),e.lineTo(n+i,Q(r,f)),e.stroke()),y&&(e.strokeStyle=h,e.lineWidth=1,e.beginPath(),e.moveTo(n,Q(r+a,f)),e.lineTo(n+i,Q(r+a,f)),e.stroke()),e.textAlign=`center`,e.textBaseline=`middle`;let O=r+a/2+1,k=aa(o).filter(e=>e>=u&&e<d);for(let t of k){let n=o[t];if(!n)continue;let r=E+t*T+D/2-s,a=_,c=Math.max(_,i-_);if(r>=a&&r<=c){let t=Math.min(Math.max(r,a),c),{text:i,isYear:o}=ta(n.timestamp);e.fillStyle=m,e.font=`${o?`bold `:``}${g}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.fillText(i,Z(t,f),Z(O,f))}}}function pc(e){return{name:`yAxis`,version:`1.0.0`,description:`Y轴价格刻度渲染器`,debugName:`Y轴`,paneId:zi,priority:q.SYSTEM_YAXIS,draw(t){let{ctx:n,pane:r,dpr:i,yAxisCtx:a}=t,o=a||n,s=nc(r.height,r.id===`main`);lc(o,{x:0,y:r.top,width:e.axisWidth,height:r.height,priceRange:r.priceRange,yPaddingPx:e.yPaddingPx,dpr:i,ticks:s,drawLeftBorder:!1,drawTickLines:!1,priceOffset:r.yAxis.getPriceOffset(),fontSize:12});let c=e.getCrosshair?.();c&&c.price!==null&&dc(o,{x:0,y:r.top,width:e.axisWidth,height:r.height,crosshairY:c.y,priceRange:r.priceRange,yPaddingPx:e.yPaddingPx,dpr:i,fontSize:12})}}}var mc=Symbol(`time-axis`);function hc(e){return{name:`timeAxis`,version:`1.0.0`,description:`时间轴渲染器`,debugName:`时间轴`,paneId:mc,priority:q.SYSTEM_XAXIS,isSystem:!0,draw(t){let{ctx:n,data:r,range:i,scrollLeft:a,kWidth:o,kGap:s,dpr:c,paneWidth:l}=t,u=r,d=n,f=l,p=e.height;d.setTransform(1,0,0,1,0,0),d.scale(c,c),d.clearRect(0,0,f,p),fc(d,{x:0,y:0,width:f,height:p,data:u,scrollLeft:a,kWidth:o,kGap:s,startIndex:i.start,endIndex:i.end,dpr:c,drawTopBorder:!1,drawBottomBorder:!1});let m=e.getCrosshair?.();if(m&&typeof m.index==`number`){let e=u[m.index];e&&uc(d,{x:0,y:0,width:f,height:p,crosshairX:m.x,timestamp:e.timestamp,dpr:c,fontSize:12})}}}}function gc(e){return{name:`crosshair`,version:`1.0.0`,description:`十字线渲染器`,debugName:`十字线`,paneId:zi,priority:q.SYSTEM_CROSSHAIR,draw(t){let{ctx:n,pane:r,dpr:i,paneWidth:a}=t,o=e.getCrosshairState();if(o.isDragging||!o.pos)return;let{x:s}=o.pos,c=r.id===o.activePaneId,l=-1;c&&o.price!==null&&(l=r.yAxis.priceToY(o.price)),n.save(),n.beginPath(),n.rect(0,0,a,r.height),n.clip(),n.fillStyle=ya.LINE;let u=Zo(s,0,r.height,i);if(u&&n.fillRect(u.x,u.y,u.width,u.height),c&&l>=0){let e=Qo(0,a,Math.min(l,r.height-1/i),i);e&&n.fillRect(e.x,e.y,e.width,e.height)}n.restore()}}}function _c(e){let t={...e};return{name:`paneTitle_${e.paneId}`,version:`1.0.0`,description:`面板标题渲染器`,debugName:`面板标题`,paneId:e.paneId,priority:q.FOREGROUND,draw(e){let{ctx:n,pane:r}=e;if(r.id!==t.paneId)return;let i=t.yOffset??12;n.save(),n.font=`12px Arial`,n.textAlign=`left`,n.textBaseline=`top`;let a=t.getTitleInfo?.();if(a){let e=12;if(n.fillStyle=oa.PRIMARY,n.fillText(a.name,e,i),e+=n.measureText(a.name).width,a.params&&a.params.length>0){let t=`(${a.params.join(`,`)})`;n.fillStyle=oa.TERTIARY,n.fillText(t,e,i),e+=n.measureText(t).width+8}else e+=8;if(a.values&&a.values.length>0)for(let t of a.values){let r=`${t.label} ${t.value.toFixed(3)}`;n.fillStyle=t.color,n.fillText(r,e,i),e+=n.measureText(r).width+8}}else if(n.fillStyle=oa.PRIMARY,n.fillText(t.title,12,i),t.description){let e=n.measureText(t.title).width;n.fillStyle=oa.WEAK,n.fillText(` - ${t.description}`,12+e,i)}n.restore()},setConfig(e){t={...t,...e}}}}var vc={class:`chart-wrapper`},yc=4,bc=Ga((0,f.defineComponent)({__name:`KLineChart`,props:{semanticConfig:{},kWidth:{default:10},kGap:{default:2},yPaddingPx:{default:0},minKWidth:{default:2},maxKWidth:{default:50},rightAxisWidth:{default:0},bottomAxisHeight:{default:24},priceLabelWidth:{default:60}},setup(e,{expose:t}){let n=e,r=(0,f.ref)(null),i=(0,f.ref)(null),a=(0,f.ref)(null),o=(0,f.ref)(n.kWidth),s=(0,f.ref)(n.kGap),c=(0,f.shallowRef)(null),l=(0,f.shallowRef)(null),u=(0,f.ref)(0);function d(){c.value?.scheduleDraw()}function p(e){if(!e)return;let t=e.getBoundingClientRect();c.value?.interaction.setTooltipSize({width:Math.max(180,Math.round(t.width)),height:Math.max(80,Math.round(t.height))})}let m=(0,f.ref)(null),h=(0,f.ref)(null),g=(0,f.ref)({x:0,y:0}),_=(0,f.ref)(!1),v=(0,f.ref)(null),y=(0,f.ref)(null),b=(0,f.ref)({x:0,y:0}),x=(0,f.ref)(0),S=(0,f.computed)(()=>{let e=v.value;if(typeof e!=`number`)return null;x.value;let t=c.value?.getData();return t&&e>=0&&e<t.length?t[e]:null}),C=(0,f.computed)(()=>v.value),w=(0,f.computed)(()=>b.value),T=(0,f.computed)(()=>(x.value,c.value?.getData()??[]));function E(){x.value++}let D=null;function O(){let e=c.value?.interaction;if(!e){v.value=null,y.value=null,m.value=null,h.value=null;return}v.value=e.hoveredIndex??null,y.value=e.crosshairIndex??null,m.value=e.hoveredMarkerData??null,h.value=e.hoveredCustomMarker??null;let t=e.tooltipPos;t&&(b.value={x:t.x,y:t.y})}function k(){D||=requestAnimationFrame(()=>{O(),D=null})}function A(e){_.value=!0,c.value?.interaction.onPointerDown(e),O()}function j(e){let t=a.value;if(t){let n=t.getBoundingClientRect();g.value={x:e.clientX-n.left,y:e.clientY-n.top}}c.value?.interaction.onPointerMove(e),k()}function M(e){_.value=!1,c.value?.interaction.onPointerUp(e),O()}function ee(e){_.value=!1,c.value?.interaction.onPointerLeave(e),v.value=null}function te(){c.value?.interaction.onScroll(),O()}let N=(0,f.ref)([]),P=(0,f.ref)({}),F=(0,f.ref)([]),ne=[`VOLUME`,`MACD`,`RSI`,`CCI`,`STOCH`,`MOM`,`WMSR`,`KST`,`FASTK`];(0,f.watch)((0,f.computed)(()=>F.value.length===0?[{id:`main`,ratio:1,visible:!0}]:[{id:`main`,ratio:1,visible:!0},...F.value.map(e=>({id:e.id,ratio:1,visible:!0}))]),e=>{c.value?.updatePaneLayout(e)},{flush:`post`});function I(e){switch(e){case`MACD`:return{fastPeriod:12,slowPeriod:26,signalPeriod:9};case`RSI`:return{period1:6,period2:12,period3:24};case`CCI`:return{period:14};case`STOCH`:return{n:9,m:3};case`MOM`:return{period:10};case`WMSR`:return{period:14};case`KST`:return{roc1:10,roc2:15,roc3:20,roc4:30,signalPeriod:9};case`FASTK`:return{period:9};default:return{}}}function re(e=`VOLUME`,t){if(F.value.length>=yc)return!1;let n=`sub_${e}`;if(F.value.some(e=>e.id===n))return!0;if(!c.value?.createSubPane(e,t??I(e)))return!1;let r=_c({paneId:n,title:e,getTitleInfo:()=>le(n)});return c.value?.useRenderer(r),F.value.push({id:n,indicatorId:e,rendererName:`${e.toLowerCase()}_${n}`,paneTitleRendererName:r.name,params:t??I(e)}),N.value.includes(e)||N.value.push(e),!0}function ie(e){let t=F.value.findIndex(t=>t.id===e);if(t===-1)return;let n=F.value[t];n&&(c.value?.removeRenderer(n.paneTitleRendererName),c.value?.removeSubPane(n.indicatorId),F.value.splice(t,1),F.value.some(e=>e.indicatorId===n.indicatorId)||(N.value=N.value.filter(e=>e!==n.indicatorId)))}function ae(){for(let e of F.value)c.value?.removeRenderer(e.paneTitleRendererName);c.value?.clearSubPanes(),F.value=[],N.value=N.value.filter(e=>!ne.includes(e))}function oe(){let e=n.semanticConfig.indicators?.main;if(e)for(let t of e)t.enabled&&(N.value.includes(t.type)||N.value.push(t.type),t.params&&(P.value[t.type]=t.params))}(0,f.watch)([N,P],([e])=>{let t=c.value;t&&(t.updateRendererConfig(`mainIndicatorLegend`,{indicators:{MA:{enabled:e.includes(`MA`),params:P.value.MA||{}},BOLL:{enabled:e.includes(`BOLL`),params:P.value.BOLL||{}},EXPMA:{enabled:e.includes(`EXPMA`),params:P.value.EXPMA||{}},ENE:{enabled:e.includes(`ENE`),params:P.value.ENE||{}}}}),t.setRendererEnabled(`ma`,e.includes(`MA`)),t.setRendererEnabled(`boll`,e.includes(`BOLL`)),t.setRendererEnabled(`expma`,e.includes(`EXPMA`)),t.setRendererEnabled(`ene`,e.includes(`ENE`)),d())},{deep:!0});function se(){let e=c.value?.getSubPaneIndicators()??[];F.value=[];for(let t of e){let e=`sub_${t}`,n=_c({paneId:e,title:t,getTitleInfo:()=>le(e)});c.value?.useRenderer(n),F.value.push({id:e,indicatorId:t,rendererName:`${t.toLowerCase()}_${e}`,paneTitleRendererName:n.name,params:I(t)}),N.value.includes(t)||N.value.push(t)}}function ce(e,t){let n=F.value.find(t=>t.id===e);if(!n)return;let r=n.indicatorId;c.value?.removeRenderer(n.paneTitleRendererName),c.value?.removeSubPane(r),c.value?.createSubPane(t,I(t));let i=`sub_${t}`,a=_c({paneId:i,title:t,getTitleInfo:()=>le(i)});c.value?.useRenderer(a);let o=F.value.findIndex(t=>t.id===e);o!==-1&&(F.value[o]={id:i,indicatorId:t,rendererName:`${t.toLowerCase()}_${i}`,paneTitleRendererName:a.name,params:I(t)}),N.value=N.value.filter(e=>e!==r),N.value.includes(t)||N.value.push(t)}function le(e){let t=F.value.find(t=>t.id===e);if(!t)return null;let n=c.value?.getData();if(!n||n.length===0)return null;let r=t.params;if(t.indicatorId===`VOLUME`)return{name:`VOL`,params:[],values:[]};let i=y.value;if(i===null)return null;switch(t.indicatorId){case`MACD`:return vs(n,i,r.fastPeriod??12,r.slowPeriod??26,r.signalPeriod??9);case`RSI`:return xs(n,i,r.period1??6,r.period2??12,r.period3??24);case`CCI`:return Ts(n,i,r.period??14);case`STOCH`:return ks(n,i,r.n??9,r.m??3);case`MOM`:return Ns(n,i,r.period??10);case`WMSR`:return Ls(n,i,r.period??14);case`KST`:return Us(n,i,r.roc1??10,r.roc2??15,r.roc3??20,r.roc4??30,r.signalPeriod??9);case`FASTK`:return qs(n,i,r.period??9);default:return null}}function ue(e,t){if(e===`MA`||e===`BOLL`||e===`EXPMA`||e===`ENE`){t?N.value.includes(e)||N.value.push(e):N.value=N.value.filter(t=>t!==e);return}if(ne.includes(e)){if(t){if(N.value.includes(e)||N.value.push(e),F.value.find(t=>t.indicatorId===e))return;if(!re(e)){let t=F.value[F.value.length-1];t&&ce(t.id,e)}}else N.value=N.value.filter(t=>t!==e),F.value.filter(t=>t.indicatorId===e).forEach(e=>ie(e.id));d()}}function de(){c.value?.updateRendererConfig(`mainIndicatorLegend`,{indicators:{MA:{enabled:N.value.includes(`MA`),params:P.value.MA||{}},BOLL:{enabled:N.value.includes(`BOLL`),params:P.value.BOLL||{}},EXPMA:{enabled:N.value.includes(`EXPMA`),params:P.value.EXPMA||{}},ENE:{enabled:N.value.includes(`ENE`),params:P.value.ENE||{}}}})}function fe(e,t){if(P.value[e]=t,e===`MA`||e===`BOLL`||e===`EXPMA`||e===`ENE`){e===`BOLL`&&c.value?.updateRendererConfig(`boll`,t),e===`EXPMA`&&c.value?.updateRendererConfig(`expma`,t),e===`ENE`&&c.value?.updateRendererConfig(`ene`,t),de(),d();return}ne.includes(e)&&F.value.filter(t=>t.indicatorId===e).forEach(e=>{e.params={...t},c.value?.updateRendererConfig(e.rendererName,t)}),d()}let pe=(0,f.computed)(()=>{let e=u.value,t=window.devicePixelRatio||1,{startXPx:r,unitPx:i}=Bo(o.value,s.value,t);return(r+e*i)/t+(n.rightAxisWidth+n.priceLabelWidth)});function me(){let e=a.value;e&&(e.scrollLeft=e.scrollWidth,d())}return t({scheduleRender:d,scrollToRight:me,addSubPane:re,removeSubPane:ie,switchSubIndicator:ce,clearAllSubPanes:ae,get plugin(){return c.value?.plugin}}),(0,f.onMounted)(()=>{let e=a.value,t=i.value,p=r.value;if(!e||!t||!p)return;let g=e=>{c.value?.interaction.onWheel(e),O()};e.addEventListener(`wheel`,g,{passive:!1});let _=new Ys({container:e,canvasLayer:t,xAxisCanvas:p},{kWidth:o.value,kGap:s.value,yPaddingPx:n.yPaddingPx,rightAxisWidth:n.rightAxisWidth,bottomAxisHeight:n.bottomAxisHeight,priceLabelWidth:n.priceLabelWidth,minKWidth:n.minKWidth,maxKWidth:n.maxKWidth,panes:[{id:`main`,ratio:1}],paneGap:0});_.setOnZoomChange(async(e,t,n)=>{o.value=e,s.value=t,await(0,f.nextTick)(),await new Promise(e=>requestAnimationFrame(()=>e()));let r=a.value;if(!r)return;let i=Math.max(0,r.scrollWidth-r.clientWidth);r.scrollLeft=Math.min(Math.max(0,n),i),_.applyZoom(e,t)}),_.useRenderer(rc()),_.useRenderer(ac()),_.useRenderer(ts({ma5:!0,ma10:!0,ma20:!0,ma30:!0,ma60:!0})),_.useRenderer(rs()),_.setRendererEnabled(`boll`,!1),_.useRenderer(ss()),_.setRendererEnabled(`expma`,!1),_.useRenderer(us()),_.setRendererEnabled(`ene`,!1),_.useRenderer(ec()),_.useRenderer(ic()),_.useRenderer(Zi()),_.useRenderer(pc({axisWidth:n.rightAxisWidth+n.priceLabelWidth,yPaddingPx:n.yPaddingPx,getCrosshair:()=>{let e=_.interaction.crosshairPos,t=_.interaction.crosshairPrice;return e&&t!==null?{y:e.y,price:t}:null}})),_.useRenderer(fs({yPaddingPx:n.yPaddingPx})),_.useRenderer(gc({getCrosshairState:()=>({pos:_.interaction.crosshairPos,activePaneId:_.interaction.activePaneId,isDragging:_.interaction.isDraggingState(),price:_.interaction.crosshairPrice})})),_.useRenderer(hc({height:n.bottomAxisHeight,getCrosshair:()=>{let e=_.interaction.crosshairPos,t=_.interaction.crosshairIndex;return e&&t!==null?{x:e.x,index:t}:null}})),c.value=_,_.resize(),l.value=new Si(_),l.value.on(`config:error`,e=>{console.error(`Semantic config error:`,e)}),l.value.on(`config:ready`,()=>{u.value=_.getData()?.length??0,E(),oe(),se(),(0,f.nextTick)(()=>me())}),l.value.applyConfig(n.semanticConfig).then(e=>{e&&!e.success&&console.error(`Semantic config apply failed:`,e.errors)}),_.interaction.setOnMarkerHover(e=>{m.value=e,d()}),_.interaction.setOnCustomMarkerHover(e=>{h.value=e,d()});let v=null,y=new ResizeObserver(()=>{v&&clearTimeout(v),v=setTimeout(()=>{_.resize(),v=null},50)});y.observe(e),_.__resizeObserver=y,_.__resizeTimeout=v,_.__onWheel=g}),(0,f.onUnmounted)(()=>{let e=c.value;if(e){let t=e.__resizeObserver,n=e.__resizeTimeout;n&&clearTimeout(n),t&&t.disconnect();let r=e.__onWheel,i=a.value;r&&i&&i.removeEventListener(`wheel`,r),e.destroy()}c.value=null}),(0,f.watch)(()=>[n.kWidth,n.kGap],([e,t])=>{typeof e==`number`&&(o.value=e),typeof t==`number`&&(s.value=t),c.value?.updateOptions({kWidth:o.value,kGap:s.value})}),(0,f.watch)(()=>n.yPaddingPx,e=>{c.value?.updateOptions({yPaddingPx:e}),d()}),(0,f.watch)(()=>n.semanticConfig,async(e,t)=>{if(e&&e!==t){let t=await l.value?.applyConfig(e);t&&!t.success&&console.error(`Semantic config apply failed:`,t.errors)}},{deep:!0}),(e,t)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,vc,[(0,f.createElementVNode)(`div`,{class:(0,f.normalizeClass)([`chart-container`,{"is-dragging":_.value}]),ref_key:`containerRef`,ref:a,onScrollPassive:te,onPointerdown:A,onPointermove:j,onPointerup:M,onPointerleave:ee},[(0,f.createElementVNode)(`div`,{class:`scroll-content`,style:(0,f.normalizeStyle)({width:pe.value+`px`})},[(0,f.createElementVNode)(`div`,{class:`canvas-layer`,ref_key:`canvasLayerRef`,ref:i},[(0,f.createElementVNode)(`canvas`,{class:`x-axis-canvas`,ref_key:`xAxisCanvasRef`,ref:r},null,512),S.value?((0,f.openBlock)(),(0,f.createBlock)(Ka,{key:0,k:S.value,index:C.value,data:T.value,pos:w.value,"set-el":p},null,8,[`k`,`index`,`data`,`pos`])):(0,f.createCommentVNode)(``,!0),m.value||h.value?((0,f.openBlock)(),(0,f.createBlock)(Za,{key:1,marker:m.value||h.value,pos:g.value},null,8,[`marker`,`pos`])):(0,f.createCommentVNode)(``,!0)],512)],4)],34),(0,f.createVNode)(Ro,{"active-indicators":N.value,"indicator-params":P.value,onToggle:ue,onUpdateParams:fe},null,8,[`active-indicators`,`indicator-params`])]))}}),[[`__scopeId`,`data-v-d60162bc`]]),xc={install(e){e.component(`KLineChart`,bc)}};exports.ConfigManager=Hi,exports.EventBus=p,exports.GLOBAL_PANE_ID=zi,exports.HookSystem=Vi,exports.KLineChart=bc,exports.KMapPlugin=xc,exports.PluginHostImpl=Ui,exports.PluginRegistry=Bi,exports.PluginState=Li,exports.RENDERER_PRIORITY=q,exports.RendererPluginManager=Ki,exports.createPluginHost=Wi,exports.wrapPaneInfo=Ri;