@363045841yyt/klinechart 0.5.0-alpha.2 → 0.5.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)},N=e=>{if(!A(e)||w(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ee=b(`Date`),te=b(`File`),ne=e=>!!(e&&e.uri!==void 0),re=e=>e&&e.getParts!==void 0,ie=b(`Blob`),ae=b(`FileList`),oe=e=>A(e)&&O(e.pipe);function se(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var P=se(),ce=P.FormData===void 0?void 0:P.FormData,le=e=>{if(!e)return!1;if(ce&&e instanceof ce)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]`},ue=b(`URLSearchParams`),[de,fe,pe,me]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(b),he=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function ge(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 _e(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 ve=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,ye=e=>!C(e)&&e!==ve;function be(...e){let{caseless:t,skipUndefined:n}=ye(this)&&this||{},r={},i=(e,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=t&&_e(r,i)||i,o=ke(r,a)?r[a]:void 0;M(o)&&M(e)?r[a]=be(o,e):M(e)?r[a]=be({},e):S(e)?r[a]=e.slice():(!n||!C(e))&&(r[a]=e)};for(let t=0,n=e.length;t<n;t++)e[t]&&ge(e[t],i);return r}var xe=(e,t,n,{allOwnKeys:r}={})=>(ge(t,(t,r)=>{n&&O(t)?Object.defineProperty(e,r,{__proto__:null,value:m(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Se=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ce=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},F=(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},I=(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},L=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={};ge(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`].includes(n))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 ge(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)=>(ve.addEventListener(`message`,({source:n,data:r})=>{n===ve&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),ve.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,O(ve.postMessage)),R={isArray:S,isArrayBuffer:T,isBuffer:w,isFormData:le,isArrayBufferView:E,isString:D,isNumber:k,isBoolean:j,isObject:A,isPlainObject:M,isEmptyObject:N,isReadableStream:de,isRequest:fe,isResponse:pe,isHeaders:me,isUndefined:C,isDate:ee,isFile:te,isReactNativeBlob:ne,isReactNative:re,isBlob:ie,isRegExp:Ae,isFunction:O,isStream:oe,isURLSearchParams:ue,isTypedArray:we,isFileList:ae,forEach:ge,merge:be,extend:xe,trim:he,stripBOM:Se,inherits:Ce,toFlatObject:F,kindOf:y,kindOfTest:b,endsWith:I,toArray:L,forEachEntry:Te,matchAll:Ee,isHTMLForm:De,hasOwnProperty:ke,hasOwnProp:ke,reduceDescriptors:je,freezeMethods:Me,toObjectSet:Ne,toCamelCase:Oe,noop:Pe,toFiniteNumber:Fe,findKey:_e,global:ve,isContextDefined:ye,isSpecCompliantForm:Ie,toJSONObject:Le,isAsyncFn:Re,isThenable:ze,setImmediate:Be,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(ve):typeof process<`u`&&process.nextTick||Be,isIterable:e=>e!=null&&O(e[_])},Ve=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`]),He=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]&&Ve[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},Ue=Symbol(`internals`),We=/[^\x09\x20-\x7E\x80-\xFF]/g;function Ge(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 Ke(e){return e&&String(e).trim().toLowerCase()}function qe(e){return Ge(e.replace(We,``))}function Je(e){return e===!1||e==null?e:R.isArray(e)?e.map(Je):qe(String(e))}function Ye(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 Xe=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ze(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 Qe(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function $e(e,t){let n=R.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var z=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=Ke(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]=Je(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())&&!Xe(e))a(He(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=Ke(e),e){let n=R.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return Ye(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=Ke(e),e){let n=R.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Ze(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=Ke(e),e){let i=R.findKey(n,e);i&&(!t||Ze(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||Ze(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]=Je(r),delete t[i];return}let o=e?Qe(i):String(i).trim();o!==i&&delete t[i],t[o]=Je(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[Ue]=this[Ue]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=Ke(e);t[r]||($e(n,e),t[r]=!0)}return R.isArray(e)?e.forEach(r):r(e),this}};z.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),R.reduceDescriptors(z.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),R.freezeMethods(z);var et=`[REDACTED ****]`;function tt(e){if(R.hasOwnProp(e,`toJSON`))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(R.hasOwnProp(t,`toJSON`))return!0;t=Object.getPrototypeOf(t)}return!1}function nt(e,t){let n=new Set(t.map(e=>String(e).toLowerCase())),r=[],i=e=>{if(typeof e!=`object`||!e||R.isBuffer(e))return e;if(r.indexOf(e)!==-1)return;e instanceof z&&(e=e.toJSON()),r.push(e);let t;if(R.isArray(e))t=[],e.forEach((e,n)=>{let r=i(e);R.isUndefined(r)||(t[n]=r)});else{if(!R.isPlainObject(e)&&tt(e))return r.pop(),e;t=Object.create(null);for(let[r,a]of Object.entries(e)){let e=n.has(r.toLowerCase())?et:i(a);R.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return i(e)}var B=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`,{__proto__:null,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(){let e=this.config,t=e&&R.hasOwnProp(e,`redact`)?e.redact:void 0,n=R.isArray(t)&&t.length>0?nt(e,t):R.toJSONObject(e);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:n,code:this.code,status:this.status}}};B.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,B.ERR_BAD_OPTION=`ERR_BAD_OPTION`,B.ECONNABORTED=`ECONNABORTED`,B.ETIMEDOUT=`ETIMEDOUT`,B.ECONNREFUSED=`ECONNREFUSED`,B.ERR_NETWORK=`ERR_NETWORK`,B.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,B.ERR_DEPRECATED=`ERR_DEPRECATED`,B.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,B.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,B.ERR_CANCELED=`ERR_CANCELED`,B.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,B.ERR_INVALID_URL=`ERR_INVALID_URL`,B.ERR_FORM_DATA_DEPTH_EXCEEDED=`ERR_FORM_DATA_DEPTH_EXCEEDED`;function rt(e){return R.isPlainObject(e)||R.isArray(e)}function it(e){return R.endsWith(e,`[]`)?e.slice(0,-2):e}function at(e,t,n){return e?e.concat(t).map(function(e,t){return e=it(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function ot(e){return R.isArray(e)&&!e.some(rt)}var st=R.toFlatObject(R,{},null,function(e){return/^is[A-Z]/.test(e)});function ct(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 B(`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(at(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)&&ot(e)||(R.isFileList(e)||R.endsWith(n,`[]`))&&(s=R.toArray(e)))return n=it(n),s.forEach(function(e,r){!(R.isUndefined(e)||e===null)&&t.append(o===!0?at([n],r,a):o===null?n:n+`[]`,u(e))}),!1}return rt(e)?!0:(t.append(at(i,n,a),u(e)),!1)}let f=[],p=Object.assign(st,{defaultVisitor:d,convertValue:u,isVisitable:rt});function m(e,n,r=0){if(!R.isUndefined(e)){if(r>c)throw new B(`Object is too deeply nested (`+r+` levels). Max depth: `+c,B.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 lt(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function ut(e,t){this._pairs=[],e&&ct(e,this,t)}var dt=ut.prototype;dt.append=function(e,t){this._pairs.push([e,t])},dt.toString=function(e){let t=e?function(t){return e.call(this,t,lt)}:lt;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function ft(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function pt(e,t,n){if(!t)return e;let r=n&&n.encode||ft,i=R.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):R.isURLSearchParams(t)?t.toString():new ut(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var mt=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)})}},ht={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},gt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:ut,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},_t=c({hasBrowserEnv:()=>vt,hasStandardBrowserEnv:()=>bt,hasStandardBrowserWebWorkerEnv:()=>xt,navigator:()=>yt,origin:()=>St}),vt=typeof window<`u`&&typeof document<`u`,yt=typeof navigator==`object`&&navigator||void 0,bt=vt&&(!yt||[`ReactNative`,`NativeScript`,`NS`].indexOf(yt.product)<0),xt=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,St=vt&&window.location.href||`http://localhost`,V={..._t,...gt};function Ct(e,t){return ct(e,new V.classes.URLSearchParams,{visitor:function(e,t,n,r){return V.isNode&&R.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function wt(e){return R.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function Tt(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 Et(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]=Tt(r[a])),!o)}if(R.isFormData(e)&&R.isFunction(e.entries)){let n={};return R.forEachEntry(e,(e,r)=>{t(wt(e),r,n,0)}),n}return null}var Dt=(e,t)=>e!=null&&R.hasOwnProp(e,t)?e[t]:void 0;function Ot(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 kt={transitional:ht,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(Et(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 Ct(e,t).toString();if((a=R.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=Dt(this,`env`),r=n&&n.FormData;return ct(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),Ot(e)):e}],transformResponse:[function(e){let t=Dt(this,`transitional`)||kt.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`?B.from(e,B.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:V.classes.FormData,Blob:V.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`,`query`],e=>{kt.headers[e]={}});function At(e,t){let n=this||kt,r=t||n,i=z.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 jt(e){return!!(e&&e.__CANCEL__)}var Mt=class extends B{constructor(e,t,n){super(e??`canceled`,B.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function Nt(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new B(`Request failed with status code `+n.status,n.status>=400&&n.status<500?B.ERR_BAD_REQUEST:B.ERR_BAD_RESPONSE,n.config,n.request,n))}function Pt(e){let t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||``}function Ft(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 It(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 Lt=(e,t,n=3)=>{let r=0,i=Ft(50,250);return It(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)},Rt=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zt=e=>(...t)=>R.asap(()=>e(...t)),Bt=V.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,V.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(V.origin),V.navigator&&/(msie|trident)/i.test(V.navigator.userAgent)):()=>!0,Vt=V.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.split(`;`);for(let n=0;n<t.length;n++){let r=t[n].replace(/^\s+/,``),i=r.indexOf(`=`);if(i!==-1&&r.slice(0,i)===e)return decodeURIComponent(r.slice(i+1))}return null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function Ht(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Ut(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Wt(e,t,n){let r=!Ht(t);return e&&(r||n===!1)?Ut(e,t):t}var Gt=e=>e instanceof z?{...e}:e;function Kt(e,t){t||={};let n=Object.create(null);Object.defineProperty(n,`hasOwnProperty`,{__proto__:null,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(Gt(e),Gt(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 qt=[`content-type`,`content-length`];function Jt(e,t,n){if(n!==`content-only`){e.set(t);return}Object.entries(t).forEach(([t,n])=>{qt.includes(t.toLowerCase())&&e.set(t,n)})}var Yt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),Xt=e=>{let t=Kt({},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=z.from(s),t.url=pt(Wt(l,d,u),e.params,e.paramsSerializer),c&&s.set(`Authorization`,`Basic `+btoa((c.username||``)+`:`+(c.password?Yt(c.password):``))),R.isFormData(r)&&(V.hasStandardBrowserEnv||V.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):R.isFunction(r.getHeaders)&&Jt(s,r.getHeaders(),n(`formDataHeaderPolicy`))),V.hasStandardBrowserEnv&&(R.isFunction(i)&&(i=i(t)),i===!0||i==null&&Bt(t.url))){let e=a&&o&&Vt.read(o);e&&s.set(a,e)}return t},Zt=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=Xt(e),i=r.data,a=z.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=z.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());Nt(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.startsWith(`file:`))||setTimeout(g)},h.onabort=function(){h&&=(n(new B(`Request aborted`,B.ECONNABORTED,e,h)),m(),null)},h.onerror=function(t){let r=new B(t&&t.message?t.message:`Network Error`,B.ERR_NETWORK,e,h);r.event=t||null,n(r),m(),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||ht;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new B(t,i.clarifyTimeoutError?B.ETIMEDOUT:B.ECONNABORTED,e,h)),m(),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]=Lt(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=Lt(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new Mt(null,e,h):t),h.abort(),m(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=Pt(r.url);if(_&&!V.protocols.includes(_)){n(new B(`Unsupported protocol `+_+`:`,B.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 B?t:new Mt(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new B(`timeout of ${t}ms exceeded`,B.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}},$t=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},en=async function*(e,t){for await(let n of tn(e))yield*$t(n,t)},tn=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()}},nn=(e,t,n,r)=>{let i=en(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})};function rn(e){if(!e||typeof e!=`string`||!e.startsWith(`data:`))return 0;let t=e.indexOf(`,`);if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length,t=r.length;for(let n=0;n<t;n++)if(r.charCodeAt(n)===37&&n+2<t){let t=r.charCodeAt(n+1),i=r.charCodeAt(n+2);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102)&&(e-=2,n+=2)}let n=0,i=t-1,a=e=>e>=2&&r.charCodeAt(e-2)===37&&r.charCodeAt(e-1)===51&&(r.charCodeAt(e)===68||r.charCodeAt(e)===100);i>=0&&(r.charCodeAt(i)===61?(n++,i--):a(i)&&(n++,i-=3)),n===1&&i>=0&&(r.charCodeAt(i)===61||a(i))&&n++;let o=Math.floor(e/4)*3-(n||0);return o>0?o:0}if(typeof Buffer<`u`&&typeof Buffer.byteLength==`function`)return Buffer.byteLength(r,`utf8`);let i=0;for(let e=0,t=r.length;e<t;e++){let n=r.charCodeAt(e);if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){let t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i}var an=`1.16.0`,on=64*1024,{isFunction:sn}=R,cn=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ln=e=>{let t=R.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=R.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);let{fetch:i,Request:a,Response:o}=e,s=i?sn(i):typeof fetch==`function`,c=sn(a),l=sn(o);if(!s)return!1;let u=s&&sn(n),d=s&&(typeof r==`function`?(e=>t=>e.encode(t))(new r):async e=>new Uint8Array(await new a(e).arrayBuffer())),f=c&&u&&cn(()=>{let e=!1,t=new a(V.origin,{body:new n,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),p=l&&u&&cn(()=>R.isReadableStream(new o(``).body)),m={stream:p&&(e=>e.body)};s&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new B(`Response type '${e}' is not supported`,B.ERR_NOT_SUPPORT,n)})});let h=async e=>{if(e==null)return 0;if(R.isBlob(e))return e.size;if(R.isSpecCompliantForm(e))return(await new a(V.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 d(e)).byteLength},g=async(e,t)=>R.toFiniteNumber(e.getContentLength())??h(t);return async e=>{let{url:t,method:n,data:s,signal:l,cancelToken:u,timeout:d,onDownloadProgress:h,onUploadProgress:_,responseType:v,headers:y,withCredentials:b=`same-origin`,fetchOptions:x,maxContentLength:S,maxBodyLength:C}=Xt(e),w=R.isNumber(S)&&S>-1,T=R.isNumber(C)&&C>-1,E=i||fetch;v=v?(v+``).toLowerCase():`text`;let D=Qt([l,u&&u.toAbortSignal()],d),O=null,k=D&&D.unsubscribe&&(()=>{D.unsubscribe()}),A;try{if(w&&typeof t==`string`&&t.startsWith(`data:`)&&rn(t)>S)throw new B(`maxContentLength size of `+S+` exceeded`,B.ERR_BAD_RESPONSE,e,O);if(T&&n!==`get`&&n!==`head`){let t=await g(y,s);if(typeof t==`number`&&isFinite(t)&&t>C)throw new B(`Request body larger than maxBodyLength limit`,B.ERR_BAD_REQUEST,e,O)}if(_&&f&&n!==`get`&&n!==`head`&&(A=await g(y,s))!==0){let e=new a(t,{method:`POST`,body:s,duplex:`half`}),n;if(R.isFormData(s)&&(n=e.headers.get(`content-type`))&&y.setContentType(n),e.body){let[t,n]=Rt(A,Lt(zt(_)));s=nn(e.body,on,t,n)}}R.isString(b)||(b=b?`include`:`omit`);let i=c&&`credentials`in a.prototype;if(R.isFormData(s)){let e=y.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&y.delete(`content-type`)}y.set(`User-Agent`,`axios/`+an,!1);let l={...x,signal:D,method:n.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:`half`,credentials:i?b:void 0};O=c&&new a(t,l);let u=await(c?E(O,x):E(t,l));if(w){let t=R.toFiniteNumber(u.headers.get(`content-length`));if(t!=null&&t>S)throw new B(`maxContentLength size of `+S+` exceeded`,B.ERR_BAD_RESPONSE,e,O)}let d=p&&(v===`stream`||v===`response`);if(p&&u.body&&(h||w||d&&k)){let t={};[`status`,`statusText`,`headers`].forEach(e=>{t[e]=u[e]});let n=R.toFiniteNumber(u.headers.get(`content-length`)),[r,i]=h&&Rt(n,Lt(zt(h),!0))||[],a=0;u=new o(nn(u.body,on,t=>{if(w&&(a=t,a>S))throw new B(`maxContentLength size of `+S+` exceeded`,B.ERR_BAD_RESPONSE,e,O);r&&r(t)},()=>{i&&i(),k&&k()}),t)}v||=`text`;let j=await m[R.findKey(m,v)||`text`](u,e);if(w&&!p&&!d){let t;if(j!=null&&(typeof j.byteLength==`number`?t=j.byteLength:typeof j.size==`number`?t=j.size:typeof j==`string`&&(t=typeof r==`function`?new r().encode(j).byteLength:j.length)),typeof t==`number`&&t>S)throw new B(`maxContentLength size of `+S+` exceeded`,B.ERR_BAD_RESPONSE,e,O)}return!d&&k&&k(),await new Promise((t,n)=>{Nt(t,n,{data:j,headers:z.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:O})})}catch(t){if(k&&k(),D&&D.aborted&&D.reason instanceof B){let n=D.reason;throw n.config=e,O&&(n.request=O),t!==n&&(n.cause=t),n}throw t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new B(`Network Error`,B.ERR_NETWORK,e,O,t&&t.response),{cause:t.cause||t}):B.from(t,t&&t.code,e,O,t&&t.response)}}},un=new Map,dn=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=un;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:ln(t)),l=c;return c};dn();var fn={http:null,xhr:Zt,fetch:{get:dn}};R.forEach(fn,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{__proto__:null,value:t})}catch{}Object.defineProperty(e,`adapterName`,{__proto__:null,value:t})}});var pn=e=>`- ${e}`,mn=e=>R.isFunction(e)||e===null||e===!1;function hn(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,!mn(r)&&(i=fn[(n=String(r)).toLowerCase()],i===void 0))throw new B(`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 B(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since :
4
- `+e.map(pn).join(`
5
- `):` `+pn(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var gn={getAdapter:hn,adapters:fn};function _n(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Mt(null,e)}function vn(e){return _n(e),e.headers=z.from(e.headers),e.data=At.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),gn.getAdapter(e.adapter||kt.adapter,e)(e).then(function(t){_n(e),e.response=t;try{t.data=At.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=z.from(t.headers),t},function(t){if(!jt(t)&&(_n(e),t&&t.response)){e.response=t.response;try{t.response.data=At.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=z.from(t.response.headers)}return Promise.reject(t)})}var yn={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{yn[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var bn={};yn.transitional=function(e,t,n){function r(e,t){return`[Axios v`+an+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new B(r(i,` has been removed`+(t?` in `+t:``)),B.ERR_DEPRECATED);return t&&!bn[i]&&(bn[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}},yn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function xn(e,t,n){if(typeof e!=`object`)throw new B(`options must be an object`,B.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 B(`option `+a+` must be `+n,B.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new B(`Unknown option `+a,B.ERR_BAD_OPTION)}}var Sn={assertOptions:xn,validators:yn},H=Sn.validators,Cn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new mt,response:new mt}}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)},N=e=>{if(!A(e)||w(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ee=b(`Date`),te=b(`File`),ne=e=>!!(e&&e.uri!==void 0),re=e=>e&&e.getParts!==void 0,ie=b(`Blob`),ae=b(`FileList`),oe=e=>A(e)&&O(e.pipe);function se(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var ce=se(),le=ce.FormData===void 0?void 0:ce.FormData,ue=e=>{if(!e)return!1;if(le&&e instanceof le)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]`},de=b(`URLSearchParams`),[fe,pe,me,he]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(b),ge=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function _e(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 ve(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 ye=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,be=e=>!C(e)&&e!==ye;function xe(...e){let{caseless:t,skipUndefined:n}=be(this)&&this||{},r={},i=(e,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=t&&ve(r,i)||i,o=Ae(r,a)?r[a]:void 0;M(o)&&M(e)?r[a]=xe(o,e):M(e)?r[a]=xe({},e):S(e)?r[a]=e.slice():(!n||!C(e))&&(r[a]=e)};for(let t=0,n=e.length;t<n;t++)e[t]&&_e(e[t],i);return r}var Se=(e,t,n,{allOwnKeys:r}={})=>(_e(t,(t,r)=>{n&&O(t)?Object.defineProperty(e,r,{__proto__:null,value:m(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),P=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),F=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},I=(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={};_e(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`].includes(n))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 _e(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)=>(ye.addEventListener(`message`,({source:n,data:r})=>{n===ye&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),ye.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,O(ye.postMessage)),L={isArray:S,isArrayBuffer:T,isBuffer:w,isFormData:ue,isArrayBufferView:E,isString:D,isNumber:k,isBoolean:j,isObject:A,isPlainObject:M,isEmptyObject:N,isReadableStream:fe,isRequest:pe,isResponse:me,isHeaders:he,isUndefined:C,isDate:ee,isFile:te,isReactNativeBlob:ne,isReactNative:re,isBlob:ie,isRegExp:je,isFunction:O,isStream:oe,isURLSearchParams:de,isTypedArray:Te,isFileList:ae,forEach:_e,merge:xe,extend:Se,trim:ge,stripBOM:P,inherits:F,toFlatObject:I,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:ve,global:ye,isContextDefined:be,isSpecCompliantForm:Le,toJSONObject:Re,isAsyncFn:ze,isThenable:Be,setImmediate:Ve,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(ye):typeof process<`u`&&process.nextTick||Ve,isIterable:e=>e!=null&&O(e[_])},He=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`]),Ue=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]&&He[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},We=Symbol(`internals`),Ge=/[^\x09\x20-\x7E\x80-\xFF]/g;function Ke(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 qe(e){return e&&String(e).trim().toLowerCase()}function Je(e){return Ke(e.replace(Ge,``))}function Ye(e){return e===!1||e==null?e:L.isArray(e)?e.map(Ye):Je(String(e))}function Xe(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 Ze=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Qe(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 $e(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function et(e,t){let n=L.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var R=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=qe(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]=Ye(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())&&!Ze(e))a(Ue(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=qe(e),e){let n=L.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return Xe(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=qe(e),e){let n=L.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Qe(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=qe(e),e){let i=L.findKey(n,e);i&&(!t||Qe(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||Qe(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]=Ye(r),delete t[i];return}let o=e?$e(i):String(i).trim();o!==i&&delete t[i],t[o]=Ye(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[We]=this[We]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=qe(e);t[r]||(et(n,e),t[r]=!0)}return L.isArray(e)?e.forEach(r):r(e),this}};R.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),L.reduceDescriptors(R.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),L.freezeMethods(R);var tt=`[REDACTED ****]`;function nt(e){if(L.hasOwnProp(e,`toJSON`))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(L.hasOwnProp(t,`toJSON`))return!0;t=Object.getPrototypeOf(t)}return!1}function rt(e,t){let n=new Set(t.map(e=>String(e).toLowerCase())),r=[],i=e=>{if(typeof e!=`object`||!e||L.isBuffer(e))return e;if(r.indexOf(e)!==-1)return;e instanceof R&&(e=e.toJSON()),r.push(e);let t;if(L.isArray(e))t=[],e.forEach((e,n)=>{let r=i(e);L.isUndefined(r)||(t[n]=r)});else{if(!L.isPlainObject(e)&&nt(e))return r.pop(),e;t=Object.create(null);for(let[r,a]of Object.entries(e)){let e=n.has(r.toLowerCase())?tt:i(a);L.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return i(e)}var 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`,{__proto__:null,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(){let e=this.config,t=e&&L.hasOwnProp(e,`redact`)?e.redact:void 0,n=L.isArray(t)&&t.length>0?rt(e,t):L.toJSONObject(e);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:n,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.ECONNREFUSED=`ECONNREFUSED`,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 it(e){return L.isPlainObject(e)||L.isArray(e)}function at(e){return L.endsWith(e,`[]`)?e.slice(0,-2):e}function ot(e,t,n){return e?e.concat(t).map(function(e,t){return e=at(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function st(e){return L.isArray(e)&&!e.some(it)}var ct=L.toFlatObject(L,{},null,function(e){return/^is[A-Z]/.test(e)});function lt(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 z(`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(ot(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)&&st(e)||(L.isFileList(e)||L.endsWith(n,`[]`))&&(s=L.toArray(e)))return n=at(n),s.forEach(function(e,r){!(L.isUndefined(e)||e===null)&&t.append(o===!0?ot([n],r,a):o===null?n:n+`[]`,u(e))}),!1}return it(e)?!0:(t.append(ot(i,n,a),u(e)),!1)}let f=[],p=Object.assign(ct,{defaultVisitor:d,convertValue:u,isVisitable:it});function m(e,n,r=0){if(!L.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),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 ut(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function dt(e,t){this._pairs=[],e&&lt(e,this,t)}var ft=dt.prototype;ft.append=function(e,t){this._pairs.push([e,t])},ft.toString=function(e){let t=e?function(t){return e.call(this,t,ut)}:ut;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function pt(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function mt(e,t,n){if(!t)return e;let r=n&&n.encode||pt,i=L.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):L.isURLSearchParams(t)?t.toString():new dt(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var ht=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)})}},gt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},_t={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:dt,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},vt=c({hasBrowserEnv:()=>yt,hasStandardBrowserEnv:()=>xt,hasStandardBrowserWebWorkerEnv:()=>St,navigator:()=>bt,origin:()=>Ct}),yt=typeof window<`u`&&typeof document<`u`,bt=typeof navigator==`object`&&navigator||void 0,xt=yt&&(!bt||[`ReactNative`,`NativeScript`,`NS`].indexOf(bt.product)<0),St=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,Ct=yt&&window.location.href||`http://localhost`,B={...vt,..._t};function wt(e,t){return lt(e,new B.classes.URLSearchParams,{visitor:function(e,t,n,r){return B.isNode&&L.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function Tt(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function Et(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]=Et(r[a])),!o)}if(L.isFormData(e)&&L.isFunction(e.entries)){let n={};return L.forEachEntry(e,(e,r)=>{t(Tt(e),r,n,0)}),n}return null}var Ot=(e,t)=>e!=null&&L.hasOwnProp(e,t)?e[t]:void 0;function kt(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 At={transitional:gt,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=Ot(this,`formSerializer`);if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return wt(e,t).toString();if((a=L.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=Ot(this,`env`),r=n&&n.FormData;return lt(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),kt(e)):e}],transformResponse:[function(e){let t=Ot(this,`transitional`)||At.transitional,n=t&&t.forcedJSONParsing,r=Ot(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,Ot(this,`parseReviver`))}catch(e){if(n)throw e.name===`SyntaxError`?z.from(e,z.ERR_BAD_RESPONSE,this,null,Ot(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}}};L.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`],e=>{At.headers[e]={}});function jt(e,t){let n=this||At,r=t||n,i=R.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 Mt(e){return!!(e&&e.__CANCEL__)}var Nt=class extends z{constructor(e,t,n){super(e??`canceled`,z.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function Pt(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,n.status>=400&&n.status<500?z.ERR_BAD_REQUEST:z.ERR_BAD_RESPONSE,n.config,n.request,n))}function Ft(e){let t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||``}function It(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 Lt(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 Rt=(e,t,n=3)=>{let r=0,i=It(50,250);return Lt(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)},zt=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Bt=e=>(...t)=>L.asap(()=>e(...t)),Vt=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,Ht=B.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.split(`;`);for(let n=0;n<t.length;n++){let r=t[n].replace(/^\s+/,``),i=r.indexOf(`=`);if(i!==-1&&r.slice(0,i)===e)return decodeURIComponent(r.slice(i+1))}return null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function Ut(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Wt(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Gt(e,t,n){let r=!Ut(t);return e&&(r||n===!1)?Wt(e,t):t}var Kt=e=>e instanceof R?{...e}:e;function qt(e,t){t||={};let n=Object.create(null);Object.defineProperty(n,`hasOwnProperty`,{__proto__:null,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(Kt(e),Kt(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 Jt=[`content-type`,`content-length`];function Yt(e,t,n){if(n!==`content-only`){e.set(t);return}Object.entries(t).forEach(([t,n])=>{Jt.includes(t.toLowerCase())&&e.set(t,n)})}var Xt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),Zt=e=>{let t=qt({},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=R.from(s),t.url=mt(Gt(l,d,u),e.params,e.paramsSerializer),c&&s.set(`Authorization`,`Basic `+btoa((c.username||``)+`:`+(c.password?Xt(c.password):``))),L.isFormData(r)&&(B.hasStandardBrowserEnv||B.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):L.isFunction(r.getHeaders)&&Yt(s,r.getHeaders(),n(`formDataHeaderPolicy`))),B.hasStandardBrowserEnv&&(L.isFunction(i)&&(i=i(t)),i===!0||i==null&&Vt(t.url))){let e=a&&o&&Ht.read(o);e&&s.set(a,e)}return t},Qt=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=Zt(e),i=r.data,a=R.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=R.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());Pt(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.startsWith(`file:`))||setTimeout(g)},h.onabort=function(){h&&=(n(new z(`Request aborted`,z.ECONNABORTED,e,h)),m(),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),m(),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||gt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new z(t,i.clarifyTimeoutError?z.ETIMEDOUT:z.ECONNABORTED,e,h)),m(),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]=Rt(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=Rt(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new Nt(null,e,h):t),h.abort(),m(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=Ft(r.url);if(_&&!B.protocols.includes(_)){n(new z(`Unsupported protocol `+_+`:`,z.ERR_BAD_REQUEST,e));return}h.send(i||null)})},$t=(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 Nt(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=()=>L.asap(o),s}},en=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},tn=async function*(e,t){for await(let n of nn(e))yield*en(n,t)},nn=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()}},rn=(e,t,n,r)=>{let i=tn(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})};function an(e){if(!e||typeof e!=`string`||!e.startsWith(`data:`))return 0;let t=e.indexOf(`,`);if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length,t=r.length;for(let n=0;n<t;n++)if(r.charCodeAt(n)===37&&n+2<t){let t=r.charCodeAt(n+1),i=r.charCodeAt(n+2);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102)&&(e-=2,n+=2)}let n=0,i=t-1,a=e=>e>=2&&r.charCodeAt(e-2)===37&&r.charCodeAt(e-1)===51&&(r.charCodeAt(e)===68||r.charCodeAt(e)===100);i>=0&&(r.charCodeAt(i)===61?(n++,i--):a(i)&&(n++,i-=3)),n===1&&i>=0&&(r.charCodeAt(i)===61||a(i))&&n++;let o=Math.floor(e/4)*3-(n||0);return o>0?o:0}if(typeof Buffer<`u`&&typeof Buffer.byteLength==`function`)return Buffer.byteLength(r,`utf8`);let i=0;for(let e=0,t=r.length;e<t;e++){let n=r.charCodeAt(e);if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){let t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i}var on=`1.16.0`,sn=64*1024,{isFunction:cn}=L,ln=(e,...t)=>{try{return!!e(...t)}catch{return!1}},un=e=>{let t=L.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=L.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);let{fetch:i,Request:a,Response:o}=e,s=i?cn(i):typeof fetch==`function`,c=cn(a),l=cn(o);if(!s)return!1;let u=s&&cn(n),d=s&&(typeof r==`function`?(e=>t=>e.encode(t))(new r):async e=>new Uint8Array(await new a(e).arrayBuffer())),f=c&&u&&ln(()=>{let e=!1,t=new a(B.origin,{body:new n,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),p=l&&u&&ln(()=>L.isReadableStream(new o(``).body)),m={stream:p&&(e=>e.body)};s&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!m[e]&&(m[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 h=async e=>{if(e==null)return 0;if(L.isBlob(e))return e.size;if(L.isSpecCompliantForm(e))return(await new a(B.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 d(e)).byteLength},g=async(e,t)=>L.toFiniteNumber(e.getContentLength())??h(t);return async e=>{let{url:t,method:n,data:s,signal:l,cancelToken:u,timeout:d,onDownloadProgress:h,onUploadProgress:_,responseType:v,headers:y,withCredentials:b=`same-origin`,fetchOptions:x,maxContentLength:S,maxBodyLength:C}=Zt(e),w=L.isNumber(S)&&S>-1,T=L.isNumber(C)&&C>-1,E=i||fetch;v=v?(v+``).toLowerCase():`text`;let D=$t([l,u&&u.toAbortSignal()],d),O=null,k=D&&D.unsubscribe&&(()=>{D.unsubscribe()}),A;try{if(w&&typeof t==`string`&&t.startsWith(`data:`)&&an(t)>S)throw new z(`maxContentLength size of `+S+` exceeded`,z.ERR_BAD_RESPONSE,e,O);if(T&&n!==`get`&&n!==`head`){let t=await g(y,s);if(typeof t==`number`&&isFinite(t)&&t>C)throw new z(`Request body larger than maxBodyLength limit`,z.ERR_BAD_REQUEST,e,O)}if(_&&f&&n!==`get`&&n!==`head`&&(A=await g(y,s))!==0){let e=new a(t,{method:`POST`,body:s,duplex:`half`}),n;if(L.isFormData(s)&&(n=e.headers.get(`content-type`))&&y.setContentType(n),e.body){let[t,n]=zt(A,Rt(Bt(_)));s=rn(e.body,sn,t,n)}}L.isString(b)||(b=b?`include`:`omit`);let i=c&&`credentials`in a.prototype;if(L.isFormData(s)){let e=y.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&y.delete(`content-type`)}y.set(`User-Agent`,`axios/`+on,!1);let l={...x,signal:D,method:n.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:`half`,credentials:i?b:void 0};O=c&&new a(t,l);let u=await(c?E(O,x):E(t,l));if(w){let t=L.toFiniteNumber(u.headers.get(`content-length`));if(t!=null&&t>S)throw new z(`maxContentLength size of `+S+` exceeded`,z.ERR_BAD_RESPONSE,e,O)}let d=p&&(v===`stream`||v===`response`);if(p&&u.body&&(h||w||d&&k)){let t={};[`status`,`statusText`,`headers`].forEach(e=>{t[e]=u[e]});let n=L.toFiniteNumber(u.headers.get(`content-length`)),[r,i]=h&&zt(n,Rt(Bt(h),!0))||[],a=0;u=new o(rn(u.body,sn,t=>{if(w&&(a=t,a>S))throw new z(`maxContentLength size of `+S+` exceeded`,z.ERR_BAD_RESPONSE,e,O);r&&r(t)},()=>{i&&i(),k&&k()}),t)}v||=`text`;let j=await m[L.findKey(m,v)||`text`](u,e);if(w&&!p&&!d){let t;if(j!=null&&(typeof j.byteLength==`number`?t=j.byteLength:typeof j.size==`number`?t=j.size:typeof j==`string`&&(t=typeof r==`function`?new r().encode(j).byteLength:j.length)),typeof t==`number`&&t>S)throw new z(`maxContentLength size of `+S+` exceeded`,z.ERR_BAD_RESPONSE,e,O)}return!d&&k&&k(),await new Promise((t,n)=>{Pt(t,n,{data:j,headers:R.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:O})})}catch(t){if(k&&k(),D&&D.aborted&&D.reason instanceof z){let n=D.reason;throw n.config=e,O&&(n.request=O),t!==n&&(n.cause=t),n}throw t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new z(`Network Error`,z.ERR_NETWORK,e,O,t&&t.response),{cause:t.cause||t}):z.from(t,t&&t.code,e,O,t&&t.response)}}},dn=new Map,fn=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=dn;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:un(t)),l=c;return c};fn();var pn={http:null,xhr:Qt,fetch:{get:fn}};L.forEach(pn,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{__proto__:null,value:t})}catch{}Object.defineProperty(e,`adapterName`,{__proto__:null,value:t})}});var mn=e=>`- ${e}`,hn=e=>L.isFunction(e)||e===null||e===!1;function gn(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,!hn(r)&&(i=pn[(n=String(r)).toLowerCase()],i===void 0))throw new z(`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 z(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since :
4
+ `+e.map(mn).join(`
5
+ `):` `+mn(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var _n={getAdapter:gn,adapters:pn};function vn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Nt(null,e)}function yn(e){return vn(e),e.headers=R.from(e.headers),e.data=jt.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),_n.getAdapter(e.adapter||At.adapter,e)(e).then(function(t){vn(e),e.response=t;try{t.data=jt.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=R.from(t.headers),t},function(t){if(!Mt(t)&&(vn(e),t&&t.response)){e.response=t.response;try{t.response.data=jt.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=R.from(t.response.headers)}return Promise.reject(t)})}var bn={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{bn[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var xn={};bn.transitional=function(e,t,n){function r(e,t){return`[Axios v`+on+`] 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&&!xn[i]&&(xn[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}},bn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Sn(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 Cn={assertOptions:Sn,validators:bn},V=Cn.validators,wn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ht,response:new ht}}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=Kt(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&Sn.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}:Sn.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),Sn.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`,`query`,`common`],e=>{delete i[e]}),t.headers=z.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||ht;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=[vn.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=vn.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=Kt(this.defaults,e),pt(Wt(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};R.forEach([`delete`,`get`,`head`,`options`],function(e){Cn.prototype[e]=function(t,n){return this.request(Kt(n||{},{method:e,url:t,data:(n||{}).data}))}}),R.forEach([`post`,`put`,`patch`,`query`],function(e){function t(t){return function(n,r,i){return this.request(Kt(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}Cn.prototype[e]=t(),e!==`query`&&(Cn.prototype[e+`Form`]=t(!0))});var wn=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 Mt(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 Tn(e){return function(t){return e.apply(null,t)}}function En(e){return R.isObject(e)&&e.isAxiosError===!0}var Dn={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(Dn).forEach(([e,t])=>{Dn[t]=e});function On(e){let t=new Cn(e),n=m(Cn.prototype.request,t);return R.extend(n,Cn.prototype,t,{allOwnKeys:!0}),R.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return On(Kt(e,t))},n}var U=On(kt);U.Axios=Cn,U.CanceledError=Mt,U.CancelToken=wn,U.isCancel=jt,U.VERSION=an,U.toFormData=ct,U.AxiosError=B,U.Cancel=U.CanceledError,U.all=function(e){return Promise.all(e)},U.spread=Tn,U.isAxiosError=En,U.mergeConfig=Kt,U.AxiosHeaders=z,U.formToJSON=e=>Et(R.isHTMLForm(e)?new FormData(e):e),U.getAdapter=gn.getAdapter,U.HttpStatusCode=Dn,U.default=U;function kn(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 An(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 jn(e){return e&&{daily:`d`,weekly:`w`,monthly:`m`,5:`5`,15:`15`,30:`30`,60:`60`}[e]||`d`}function Mn(e){return e&&{qfq:`2`,hfq:`1`,none:`3`}[e]||`3`}function Nn(e){let t=kn(e.date),n=e=>{let t=parseFloat(e);return Number.isNaN(t)?0:t};return{timestamp:An(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 Pn=``,Fn=`/api/stock/kdata`;async function In(e){let{timeout:t,...n}=e,r=`${Pn}${Fn}`,i={stock_code:n.symbol,start_date:n.start_date,end_date:n.end_date,frequency:jn(n.period),adjustflag:Mn(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(Nn).sort((e,t)=>e.timestamp-t.timestamp)}catch(e){throw U.isAxiosError(e)?Error(`获取K线数据失败: ${e.message}`):e}}function Ln(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 Rn=`/api/public/stock_zh_a_hist`;function zn(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 Bn(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 Vn(e){return{timestamp:Bn(zn(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 Hn(e){try{let{timeout:t,...n}=e;return(await U.get(Rn,{params:n,timeout:t?t*1e3:void 0})).data.map(Vn)}catch(e){throw U.isAxiosError(e)?Error(`获取K线数据失败: ${e.message}`):e}}var Un=new class{set(e,t){let n={data:t,timestamp:Date.now()};localStorage.setItem(e,JSON.stringify(n))}get(e,t=3600*1e3){let n=localStorage.getItem(e);if(!n)return null;try{let r=JSON.parse(n);return Date.now()-r.timestamp>t?(localStorage.removeItem(e),null):r.data}catch{return localStorage.removeItem(e),null}}remove(e){localStorage.removeItem(e)}clear(){localStorage.clear()}generateKey(e,t){return`${e}:${Object.keys(t).sort().map(e=>`${e}:${t[e]}`).join(`|`)}`}},Wn=class{name=`baostock`;async fetchKLineData(e){return In({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}},Gn=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 Ln(await Hn({symbol:e.symbol,start_date:t,end_date:n,period:r,adjust:e.adjust===`none`?void 0:e.adjust,timeout:e.timeout}))}},Kn=class{static instances=new Map;static create(e){if(!this.instances.has(e))switch(e){case`baostock`:this.instances.set(e,new Wn);break;case`dongcai`:this.instances.set(e,new Gn);break;default:throw Error(`未知的数据源类型: ${e}`)}return this.instances.get(e)}},qn=3600*1e3;function Jn(e,t){return Un.generateKey(`kline:${e}`,{symbol:t.symbol,startDate:t.startDate,endDate:t.endDate,period:t.period,adjust:t.adjust})}async function Yn(e,t,n=!0){let r=Jn(e,t);if(n){let e=Un.get(r,qn);if(e)return console.log(`[KLineCache] 命中缓存: ${r}`),e}let i=await Kn.create(e).fetchKLineData(t);return n&&i.length>0&&(Un.set(r,i),console.log(`[KLineCache] 写入缓存: ${r}, ${i.length} 条数据`)),i}var Xn=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})),Zn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=Xn(),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=Xn(),n=Zn(),r=Xn();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=Zn();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._)`!${re(e)}`}e.not=j;var M=ne(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var ee=ne(e.operators.OR);function te(...e){return e.reduce(ee)}e.or=te;function ne(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${re(n)} ${e} ${re(r)}`}function re(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=Xn();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})),Qn=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`)}})),$n=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=Qn();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])}})),er=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=$n(),n=W(),r=Qn(),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)}})),tr=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})),nr=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})),rr=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=tr(),n=nr(),r=$n(),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=qt(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&Cn.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}:Cn.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),Cn.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`,`query`,`common`],e=>{delete i[e]}),t.headers=R.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||gt;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=[yn.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=yn.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=qt(this.defaults,e),mt(Gt(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};L.forEach([`delete`,`get`,`head`,`options`],function(e){wn.prototype[e]=function(t,n){return this.request(qt(n||{},{method:e,url:t,data:(n||{}).data}))}}),L.forEach([`post`,`put`,`patch`,`query`],function(e){function t(t){return function(n,r,i){return this.request(qt(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}wn.prototype[e]=t(),e!==`query`&&(wn.prototype[e+`Form`]=t(!0))});var Tn=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 Nt(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 En(e){return function(t){return e.apply(null,t)}}function Dn(e){return L.isObject(e)&&e.isAxiosError===!0}var On={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(On).forEach(([e,t])=>{On[t]=e});function kn(e){let t=new wn(e),n=m(wn.prototype.request,t);return L.extend(n,wn.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return kn(qt(e,t))},n}var H=kn(At);H.Axios=wn,H.CanceledError=Nt,H.CancelToken=Tn,H.isCancel=Mt,H.VERSION=on,H.toFormData=lt,H.AxiosError=z,H.Cancel=H.CanceledError,H.all=function(e){return Promise.all(e)},H.spread=En,H.isAxiosError=Dn,H.mergeConfig=qt,H.AxiosHeaders=R,H.formToJSON=e=>Dt(L.isHTMLForm(e)?new FormData(e):e),H.getAdapter=_n.getAdapter,H.HttpStatusCode=On,H.default=H;function An(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 jn(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 Mn(e){return e&&{daily:`d`,weekly:`w`,monthly:`m`,5:`5`,15:`15`,30:`30`,60:`60`}[e]||`d`}function Nn(e){return e&&{qfq:`2`,hfq:`1`,none:`3`}[e]||`3`}function Pn(e){let t=An(e.date),n=e=>{let t=parseFloat(e);return Number.isNaN(t)?0:t};return{timestamp:jn(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 Fn=``,In=`/api/stock/kdata`;async function Ln(e){let{timeout:t,...n}=e,r=`${Fn}${In}`,i={stock_code:n.symbol,start_date:n.start_date,end_date:n.end_date,frequency:Mn(n.period),adjustflag:Nn(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(Pn).sort((e,t)=>e.timestamp-t.timestamp)}catch(e){throw H.isAxiosError(e)?Error(`获取K线数据失败: ${e.message}`):e}}function Rn(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 zn=`/api/public/stock_zh_a_hist`;function Bn(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 Vn(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 Hn(e){return{timestamp:Vn(Bn(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 Un(e){try{let{timeout:t,...n}=e;return(await H.get(zn,{params:n,timeout:t?t*1e3:void 0})).data.map(Hn)}catch(e){throw H.isAxiosError(e)?Error(`获取K线数据失败: ${e.message}`):e}}var Wn=new class{set(e,t){let n={data:t,timestamp:Date.now()};localStorage.setItem(e,JSON.stringify(n))}get(e,t=3600*1e3){let n=localStorage.getItem(e);if(!n)return null;try{let r=JSON.parse(n);return Date.now()-r.timestamp>t?(localStorage.removeItem(e),null):r.data}catch{return localStorage.removeItem(e),null}}remove(e){localStorage.removeItem(e)}clear(){localStorage.clear()}generateKey(e,t){return`${e}:${Object.keys(t).sort().map(e=>`${e}:${t[e]}`).join(`|`)}`}},Gn=class{name=`baostock`;async fetchKLineData(e){return Ln({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}},Kn=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 Rn(await Un({symbol:e.symbol,start_date:t,end_date:n,period:r,adjust:e.adjust===`none`?void 0:e.adjust,timeout:e.timeout}))}},qn=class{static instances=new Map;static create(e){if(!this.instances.has(e))switch(e){case`baostock`:this.instances.set(e,new Gn);break;case`dongcai`:this.instances.set(e,new Kn);break;default:throw Error(`未知的数据源类型: ${e}`)}return this.instances.get(e)}},Jn=3600*1e3;function Yn(e,t){return Wn.generateKey(`kline:${e}`,{symbol:t.symbol,startDate:t.startDate,endDate:t.endDate,period:t.period,adjust:t.adjust})}async function Xn(e,t,n=!0){let r=Yn(e,t);if(n){let e=Wn.get(r,Jn);if(e)return console.log(`[KLineCache] 命中缓存: ${r}`),e}let i=await qn.create(e).fetchKLineData(t);return n&&i.length>0&&(Wn.set(r,i),console.log(`[KLineCache] 写入缓存: ${r}, ${i.length} 条数据`)),i}var Zn=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})),Qn=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=Zn(),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=Zn(),n=Qn(),r=Zn();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=Qn();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._)`!${re(e)}`}e.not=j;var M=ne(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var ee=ne(e.operators.OR);function te(...e){return e.reduce(ee)}e.or=te;function ne(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${re(n)} ${e} ${re(r)}`}function re(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=Zn();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})),$n=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`)}})),er=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=$n();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])}})),tr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=er(),n=U(),r=$n(),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)}})),nr=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})),rr=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})),ir=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=nr(),n=rr(),r=er(),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}}})),ir=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=Qn(),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})),ar=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=W(),n=Qn(),r=K(),i=$n();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})),or=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})),sr=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}})),cr=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`)}})),lr=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=sr(),r=cr(),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})),ur=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=er(),n=rr(),r=nr(),i=rr(),a=ir(),o=ar(),s=or(),c=W(),l=Qn(),u=lr(),d=G(),f=$n();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 N(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);N(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 N(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(()=>le(e,`$ref`,h.all.$ref.definition));return}p.jtd||te(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)),ee(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):ee(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function ee(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)&&le(e,n.keyword,n.definition,t.type)})}function te(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(ne(e,t),e.opts.allowUnionTypes||re(e,t),ie(e,e.dataTypes))}function ne(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{oe(e.dataTypes,t)||P(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),se(e,t)}}function re(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&P(e,`use allowUnionTypes to allow union type keyword`)}function ie(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=>ae(t,e))&&P(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function ae(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function oe(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function se(e,t){let n=[];for(let r of e.dataTypes)oe(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function P(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var ce=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`,fe(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=ce;function le(e,t,n,r){let i=new ce(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 ue=/^\/(?:[^~]|~0|~1)*$/,de=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function fe(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!ue.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=de.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=fe})),dr=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}}})),fr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=lr();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))}}})),pr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=W(),n=dr(),r=Qn(),i=lr(),a=G(),o=ur(),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}})),mr=c({$id:()=>hr,additionalProperties:()=>!1,default:()=>br,description:()=>gr,properties:()=>yr,required:()=>vr,type:()=>_r}),hr,gr,_r,vr,yr,br,xr=o((()=>{hr=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,gr=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,_r=`object`,vr=[`$data`],yr={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},br={$id:hr,description:gr,type:_r,required:vr,properties:yr,additionalProperties:!1}})),Sr=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),i=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function s(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 c=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(e){return e.length=0,!0}function u(e,t,n){if(e.length){let r=s(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function d(e){let t=0,n={error:!1,address:``,zone:``},r=[],i=[],a=!1,o=!1,c=u;for(let s=0;s<e.length;s++){let u=e[s];if(!(u===`[`||u===`]`))if(u===`:`){if(a===!0&&(o=!0),!c(i,r,n))break;if(++t>7){n.error=!0;break}s>0&&e[s-1]===`:`&&(a=!0),r.push(`:`);continue}else if(u===`%`){if(!c(i,r,n))break;c=l}else{i.push(u);continue}}return i.length&&(c===l?n.zone=i.join(``):o?r.push(i.join(``)):r.push(s(i))),n.address=r.join(``),n}function f(e){if(p(e,`:`)<2)return{host:e,isIPV6:!1};let t=d(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 p(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function m(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(``)}var h={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},g=/[@/?#:]/g,_=/[@/?#]/g;function v(e,t){let n=t?_:g;return n.lastIndex=0,e.replace(n,e=>h[e])}function y(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let o=e.slice(r+1,r+3);if(i(o)){let e=o.toUpperCase(),i=String.fromCharCode(parseInt(e,16));t&&a(i)?n+=i:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function b(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&a(i)?t+=i:t+=`%`+e,n+=2;continue}}o(e[n])?t+=e[n]:t+=escape(e[n])}return t}function x(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function S(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 e=f(n);n=e.isIPV6===!0?`[${e.escapedHost}]`:v(n,!1)}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:c,recomposeAuthority:S,reescapeHostDelimiters:v,normalizePercentEncoding:y,normalizePathEncoding:b,escapePreservingEscapes:x,removeDotSegments:m,isIPv4:r,isUUID:n,normalizeIPv6:f,stringArrayToHexStripped:s}})),Cr=s(((e,t)=>{var{isUUID:n}=Sr(),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}})),wr=s(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizePercentEncoding:a,normalizePathEncoding:o,escapePreservingEscapes:s,reescapeHostDelimiters:c,isIPv4:l,nonSimpleDomain:u}=Sr(),{SCHEMES:d,getSchemeHandler:f}=Cr();function p(e,t){return typeof e==`string`?e=S(e,t):typeof e==`object`&&(e=x(_(e,t),t)),e}function m(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=h(x(e,r),x(t,r),r,!0);return r.skipEscape=!0,_(i,r)}function h(e,t,n,i){let a={};return i||(e=x(_(e,n),n),t=x(_(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 g(e,t,n){let r=w(e,n),i=w(t,n);return r!==void 0&&i!==void 0&&r.toLowerCase()===i.toLowerCase()}function _(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:``},o=Object.assign({},t),c=[],l=f(o.scheme||n.scheme);l&&l.serialize&&l.serialize(n,o),n.path!==void 0&&(o.skipEscape?n.path=a(n.path):(n.path=s(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),o.reference!==`suffix`&&n.scheme&&c.push(n.scheme,`:`);let u=i(n);if(u!==void 0&&(o.reference!==`suffix`&&c.push(`//`),c.push(u),n.path&&n.path[0]!==`/`&&c.push(`/`)),n.path!==void 0){let e=n.path;!o.absolutePath&&(!l||!l.absolutePath)&&(e=r(e)),u===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),c.push(e)}return n.query!==void 0&&c.push(`?`,n.query),n.fragment!==void 0&&c.push(`#`,n.fragment),c.join(``)}var v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function b(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,s=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let d=e.match(v);if(d){i.scheme=d[1],i.userinfo=d[3],i.host=d[4],i.port=parseInt(d[5],10),i.path=d[6]||``,i.query=d[7],i.fragment=d[8],isNaN(i.port)&&(i.port=d[5]);let t=y(i,d);if(t!==void 0&&(i.error=i.error||t,a=!0),i.host)if(l(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),s=e.isIPV6}else s=!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 p=f(r.scheme||i.scheme);if(!r.unicodeSupport&&(!p||!p.unicodeSupport)&&i.host&&(r.domainHost||p&&p.domainHost)&&s===!1&&u(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}if((!p||p&&!p.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=c(unescape(i.host),s))),i.path&&=o(i.path),i.fragment))try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||`URI malformed`}p&&p.parse&&p.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:a}}function x(e,t){return b(e,t).parsed}function S(e,t){return C(e,t).normalized}function C(e,t){let{parsed:n,malformedAuthorityOrPort:r}=b(e,t);return{normalized:r?e:_(n,t),malformedAuthorityOrPort:r}}function w(e,t){if(typeof e==`string`){let{normalized:n,malformedAuthorityOrPort:r}=C(e,t);return r?void 0:n}if(typeof e==`object`)return _(e,t)}var T={SCHEMES:d,normalize:p,resolve:m,resolveComponent:h,equal:g,serialize:_,parse:x};t.exports=T,t.exports.default=T,t.exports.fastUri=T})),Tr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=wr();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),Er=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=ur();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=dr(),i=fr(),a=tr(),o=pr(),s=W(),c=lr(),l=rr(),u=G(),f=(xr(),d(mr).default),p=Tr(),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;ee.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]=ne(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?N.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 N(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 ee(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=ne(t)),e.validateSchema=this.compile(t,!0))}var te={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function ne(e){return{anyOf:[e,te]}}})),Dr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),Or=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;var t=fr(),n=K(),r=W(),i=Qn(),a=pr(),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})),kr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Dr(),n=Or();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),Ar=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})`)}}})),jr=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}))`)}}})),Mr=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`})),Nr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r=Mr();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}`)}}})),Pr=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})`)}}}})),Fr=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}`)}}})),Ir=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)}}}})),Lr=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}`)}}})),Rr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=sr();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),zr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=rr(),n=W(),r=G(),i=Rr();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)})))}}}})),Br=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r=Rr();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}`)}}})),Vr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r=Rr();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}`}}}})),Hr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Ar(),n=jr(),r=Nr(),i=Pr(),a=Fr(),o=Ir(),s=Lr(),c=zr(),l=Br(),u=Vr();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]})),Ur=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})),Wr=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})),Gr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Wr();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),Kr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=G(),r=K(),i=Ur();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)))}}})),qr=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)))}}}})),Jr=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}}})),ar=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)}`)}})),G=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=$n(),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})),or=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=U(),n=$n(),r=G(),i=er();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})),sr=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})),cr=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}})),lr=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`)}})),ur=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=cr(),r=lr(),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})),dr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=tr(),n=ir(),r=rr(),i=ir(),a=ar(),o=or(),s=sr(),c=U(),l=$n(),u=ur(),d=W(),f=er();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 N(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);N(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 N(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(()=>ue(e,`$ref`,h.all.$ref.definition));return}p.jtd||te(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)),ee(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):ee(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function ee(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)&&ue(e,n.keyword,n.definition,t.type)})}function te(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(ne(e,t),e.opts.allowUnionTypes||re(e,t),ie(e,e.dataTypes))}function ne(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{oe(e.dataTypes,t)||ce(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),se(e,t)}}function re(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&ce(e,`use allowUnionTypes to allow union type keyword`)}function ie(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=>ae(t,e))&&ce(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function ae(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function oe(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function se(e,t){let n=[];for(let r of e.dataTypes)oe(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function ce(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var le=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`,pe(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=le;function ue(e,t,n,r){let i=new le(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 de=/^\/(?:[^~]|~0|~1)*$/,fe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function pe(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!de.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=fe.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=pe})),fr=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}}})),pr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=ur();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))}}})),mr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=U(),n=fr(),r=$n(),i=ur(),a=W(),o=dr(),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}})),hr=c({$id:()=>gr,additionalProperties:()=>!1,default:()=>xr,description:()=>_r,properties:()=>br,required:()=>yr,type:()=>vr}),gr,_r,vr,yr,br,xr,Sr=o((()=>{gr=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,_r=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,vr=`object`,yr=[`$data`],br={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},xr={$id:gr,description:_r,type:vr,required:yr,properties:br,additionalProperties:!1}})),Cr=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),i=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function s(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 c=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(e){return e.length=0,!0}function u(e,t,n){if(e.length){let r=s(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function d(e){let t=0,n={error:!1,address:``,zone:``},r=[],i=[],a=!1,o=!1,c=u;for(let s=0;s<e.length;s++){let u=e[s];if(!(u===`[`||u===`]`))if(u===`:`){if(a===!0&&(o=!0),!c(i,r,n))break;if(++t>7){n.error=!0;break}s>0&&e[s-1]===`:`&&(a=!0),r.push(`:`);continue}else if(u===`%`){if(!c(i,r,n))break;c=l}else{i.push(u);continue}}return i.length&&(c===l?n.zone=i.join(``):o?r.push(i.join(``)):r.push(s(i))),n.address=r.join(``),n}function f(e){if(p(e,`:`)<2)return{host:e,isIPV6:!1};let t=d(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 p(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function m(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(``)}var h={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},g=/[@/?#:]/g,_=/[@/?#]/g;function v(e,t){let n=t?_:g;return n.lastIndex=0,e.replace(n,e=>h[e])}function y(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let o=e.slice(r+1,r+3);if(i(o)){let e=o.toUpperCase(),i=String.fromCharCode(parseInt(e,16));t&&a(i)?n+=i:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function b(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&a(i)?t+=i:t+=`%`+e,n+=2;continue}}o(e[n])?t+=e[n]:t+=escape(e[n])}return t}function x(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function S(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 e=f(n);n=e.isIPV6===!0?`[${e.escapedHost}]`:v(n,!1)}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:c,recomposeAuthority:S,reescapeHostDelimiters:v,normalizePercentEncoding:y,normalizePathEncoding:b,escapePreservingEscapes:x,removeDotSegments:m,isIPv4:r,isUUID:n,normalizeIPv6:f,stringArrayToHexStripped:s}})),wr=s(((e,t)=>{var{isUUID:n}=Cr(),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}})),Tr=s(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizePercentEncoding:a,normalizePathEncoding:o,escapePreservingEscapes:s,reescapeHostDelimiters:c,isIPv4:l,nonSimpleDomain:u}=Cr(),{SCHEMES:d,getSchemeHandler:f}=wr();function p(e,t){return typeof e==`string`?e=S(e,t):typeof e==`object`&&(e=x(_(e,t),t)),e}function m(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=h(x(e,r),x(t,r),r,!0);return r.skipEscape=!0,_(i,r)}function h(e,t,n,i){let a={};return i||(e=x(_(e,n),n),t=x(_(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 g(e,t,n){let r=w(e,n),i=w(t,n);return r!==void 0&&i!==void 0&&r.toLowerCase()===i.toLowerCase()}function _(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:``},o=Object.assign({},t),c=[],l=f(o.scheme||n.scheme);l&&l.serialize&&l.serialize(n,o),n.path!==void 0&&(o.skipEscape?n.path=a(n.path):(n.path=s(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),o.reference!==`suffix`&&n.scheme&&c.push(n.scheme,`:`);let u=i(n);if(u!==void 0&&(o.reference!==`suffix`&&c.push(`//`),c.push(u),n.path&&n.path[0]!==`/`&&c.push(`/`)),n.path!==void 0){let e=n.path;!o.absolutePath&&(!l||!l.absolutePath)&&(e=r(e)),u===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),c.push(e)}return n.query!==void 0&&c.push(`?`,n.query),n.fragment!==void 0&&c.push(`#`,n.fragment),c.join(``)}var v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function b(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,s=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let d=e.match(v);if(d){i.scheme=d[1],i.userinfo=d[3],i.host=d[4],i.port=parseInt(d[5],10),i.path=d[6]||``,i.query=d[7],i.fragment=d[8],isNaN(i.port)&&(i.port=d[5]);let t=y(i,d);if(t!==void 0&&(i.error=i.error||t,a=!0),i.host)if(l(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),s=e.isIPV6}else s=!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 p=f(r.scheme||i.scheme);if(!r.unicodeSupport&&(!p||!p.unicodeSupport)&&i.host&&(r.domainHost||p&&p.domainHost)&&s===!1&&u(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}if((!p||p&&!p.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=c(unescape(i.host),s))),i.path&&=o(i.path),i.fragment))try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||`URI malformed`}p&&p.parse&&p.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:a}}function x(e,t){return b(e,t).parsed}function S(e,t){return C(e,t).normalized}function C(e,t){let{parsed:n,malformedAuthorityOrPort:r}=b(e,t);return{normalized:r?e:_(n,t),malformedAuthorityOrPort:r}}function w(e,t){if(typeof e==`string`){let{normalized:n,malformedAuthorityOrPort:r}=C(e,t);return r?void 0:n}if(typeof e==`object`)return _(e,t)}var T={SCHEMES:d,normalize:p,resolve:m,resolveComponent:h,equal:g,serialize:_,parse:x};t.exports=T,t.exports.default=T,t.exports.fastUri=T})),Er=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Tr();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),Dr=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=dr();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=fr(),i=pr(),a=nr(),o=mr(),s=U(),c=ur(),l=ir(),u=W(),f=(Sr(),d(hr).default),p=Er(),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;ee.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]=ne(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?N.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 N(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 ee(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=ne(t)),e.validateSchema=this.compile(t,!0))}var te={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function ne(e){return{anyOf:[e,te]}}})),Or=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),kr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;var t=pr(),n=G(),r=U(),i=$n(),a=mr(),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})),Ar=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Or(),n=kr();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),jr=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})`)}}})),Mr=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}))`)}}})),Nr=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`})),Pr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r=Nr();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}`)}}})),Fr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=G(),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})`)}}}})),Ir=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}`)}}})),Lr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=G(),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)}}}})),Rr=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}`)}}})),zr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=cr();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),Br=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=ir(),n=U(),r=W(),i=zr();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)})))}}}})),Vr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r=zr();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}`)}}})),Hr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r=zr();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}`}}}})),Ur=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=jr(),n=Mr(),r=Pr(),i=Fr(),a=Ir(),o=Lr(),s=Rr(),c=Br(),l=Vr(),u=Hr();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]})),Wr=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})),Gr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;var t=U(),n=W(),r=G(),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})),Kr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Gr();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),qr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=W(),r=G(),i=Wr();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)))}}})),Jr=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)))}}}})),Yr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=U(),n=W(),r=G();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})),Yr=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)}}})),Xr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=K(),n=W(),r=Qn(),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)}}}})),Zr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=ur(),n=K(),r=G(),i=Xr();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)}}}})),Qr=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())})})}}}})),$r=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`}}})),ei=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`}}})),ti=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)})})}}}})),ni=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)})}}})),ri=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})),ii=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`)}}})),ai=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Ur(),n=Gr(),r=Wr(),i=Kr(),a=qr(),o=Jr(),s=Yr(),c=Xr(),l=Zr(),u=Qr(),d=$r(),f=ei(),p=ti(),m=ni(),h=ri(),g=ii();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=_})),oi=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})`}}}}})),si=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[oi().default]})),ci=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`]})),li=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=kr(),n=Hr(),r=ai(),i=si(),a=ci();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),ui=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={}))})),di=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=W(),n=ui(),r=pr(),i=fr(),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}}}}})),fi=c({$id:()=>mi,$schema:()=>pi,default:()=>yi,definitions:()=>gi,properties:()=>vi,title:()=>hi,type:()=>_i}),pi,mi,hi,gi,_i,vi,yi,bi=o((()=>{pi=`http://json-schema.org/draft-07/schema#`,mi=`http://json-schema.org/draft-07/schema#`,hi=`Core schema meta-schema`,gi={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:[]}},_i=[`object`,`boolean`],vi={$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:`#`}},yi={$schema:pi,$id:mi,title:hi,definitions:gi,type:_i,properties:vi,default:!0}})),xi=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=Er(),r=li(),i=di(),a=(bi(),d(fi).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=ur();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=dr();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return f.default}});var p=fr();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return p.default}})}))(),1),Si={$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}$`}}}}},Ci=[`__proto__`,`constructor`,`prototype`],wi=/^(#[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*\))$/,Ti={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 Ei(e){return{"5min":30,"15min":60,"30min":90,"60min":180,daily:365*3,weekly:365*5,monthly:365*10}[e]??365}var Di=(typeof document<`u`?document.createElement(`canvas`):null)?.getContext(`2d`)??null,Oi=class e{ajv;limits;constructor(){this.ajv=new xi.default({allErrors:!0,allowUnionTypes:!0}),this.ajv.addFormat(`date`,{type:`string`,validate:e=>/^\d{4}-\d{2}-\d{2}$/.test(e)}),this.ajv.addSchema(Si),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))Ci.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=Ei(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(!Ti[n].test(t))return{valid:!1,errors:[`Invalid symbol "${t}" for exchange "${n}"`]}}else if(!Object.values(Ti).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`&&!wi.test(r)&&n.push(`Invalid ${i} in marker "${t}": ${r}`)}if(Di)for(let i of r){let r=e[i];typeof r==`string`&&(Di.fillStyle=`#000000`,Di.fillStyle=r,Di.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}},ki=class{chart;validator;events;constructor(e){this.chart=e,this.validator=new Oi,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 Yn(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:Ai(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 Ai(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 ji={arrow_up:16,arrow_down:16,flag:14,circle:12,rectangle:14,diamond:12};function Mi(e,t,n,r,i,a){let o=a.fillColor||`#000000`,s=a.strokeColor||o,c=i||ji[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`:Li(e,n,r,c);break;case`arrow_down`:Ri(e,n,r,c);break;case`circle`:zi(e,n,r,c);break;case`rectangle`:Bi(e,n,r,c);break;case`diamond`:Vi(e,n,r,c);break;case`flag`:Hi(e,n,r,c);break}e.globalAlpha=1}var Ni=2.5,Pi=4;function Fi(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*Ni,d=Ii(e,t.text,u),f=e.measureText(d).width,p=n,m=r;switch(t.position){case`left`:p=n-l-f/2-Pi;break;case`right`:p=n+l+f/2+Pi;break;case`top`:m=r-l-s/2-Pi;break;case`bottom`:m=r+l+s/2+Pi;break;default:m=o?r-l-s/2-Pi:r+l+s/2+Pi;break}t.offset&&(p+=t.offset.x||0,m+=t.offset.y||0),e.textAlign=t.align||`center`,e.fillText(d,p,m)}function Ii(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 Li(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 Ri(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 zi(e,t,n,r){e.beginPath(),e.arc(t,n,r/2,0,Math.PI*2),e.fill()}function Bi(e,t,n,r){e.fillRect(t-r/2,n-r/2,r,r)}function Vi(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 Hi(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 Ui(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 Wi=function(e){return e.Registered=`registered`,e.Installed=`installed`,e.Error=`error`,e}({});function Gi(e){return{id:e.id,role:e.role,capabilities:{...e.capabilities},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(),getDisplayRange:t=>e.yAxis.getDisplayRange(t)},priceRange:e.priceRange}}var Ki=Symbol(`global-pane`),q={SYSTEM_YAXIS:-20,SYSTEM_XAXIS:-20,BACKGROUND:0,GRID:10,INDICATOR:30,MAIN:50,INDICATOR_SCALE:55,OVERLAY:80,FOREGROUND:100,SYSTEM_BORDER:120,SYSTEM_CROSSHAIR:150},qi=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()}},Ji=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,n){let r=this.hooks.get(e);if(!r||r.length===0)return[];let i=[];for(let{fn:a}of r)try{let e=await a(t);i.push(e)}catch(t){if(console.error(`[HookSystem] Error in hook "${e}":`,t),n?.throwOnError)throw t}return i}callSync(e,t,n){let r=this.hooks.get(e);if(!r||r.length===0)return[];let i=[];for(let{fn:a}of r)try{let e=a(t);i.push(e)}catch(t){if(console.error(`[HookSystem] Error in hook "${e}":`,t),n?.throwOnError)throw t}return i}clear(){this.hooks.clear()}hookCount(e){return this.hooks.get(e)?.length??0}},Yi=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.defaults.delete(e)):(this.configs.clear(),this.defaults.clear())}},Xi=class{states=new Map;ownerNamespaces=new Map;setState(e,t,n){this.states.set(e,t)}getState(e){return this.states.get(e)}clearState(e){this.states.delete(e)}registerStateOwner(e,t){this.ownerNamespaces.set(e,new Set(t))}clearByOwner(e){let t=this.ownerNamespaces.get(e);t&&(t.forEach(e=>{this.states.delete(e)}),this.ownerNamespaces.delete(e))}clear(){this.states.clear(),this.ownerNamespaces.clear()}},Zi=class{registry;eventBus;hookSystem;configManager;stateStore;isDestroyed=!1;logger;constructor(e){this.registry=new qi,this.eventBus=new p,this.hookSystem=new Ji,this.configManager=new Yi,this.stateStore=new Xi,this.logger=e??console}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,n)=>this.hookSystem.call(e,t,n),callSync:(e,t,n)=>this.hookSystem.callSync(e,t,n)};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()}]`;this.logger[e](`${r} ${t}`,...n)}setSharedState(e,t,n){this.stateStore.setState(e,t,n)}getSharedState(e){return this.stateStore.getState(e)}clearSharedState(e){this.stateStore.clearState(e)}registerStateOwner(e,t){this.stateStore.registerStateOwner(e,t)}clearByOwner(e){this.stateStore.clearByOwner(e)}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},{throwOnError:!0}),await e.install(this,n.config),this.registry.updateState(e.name,`installed`),await this.hooks.call(`plugin:afterInstall`,{plugin:e,config:t},{throwOnError:!0}),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},{throwOnError:!0}),t.plugin.uninstall&&await t.plugin.uninstall(),this.registry.unregister(e),this.configManager.clear(e),await this.hooks.call(`plugin:afterUninstall`,{name:e},{throwOnError:!0}),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.stateStore.clear(),this.isDestroyed=!0,this.log(`info`,`PluginHost destroyed`)}}ensureNotDestroyed(){if(this.isDestroyed)throw Error(`PluginHost has been destroyed`)}};function Qi(e){return new Zi(e)}var $i=Symbol(`renderer:global-cache`),ea=class{plugins=new Map;pluginHost=null;enabledState=new Map;groupCache=new Map;mergedCache=new Map;knownPaneIds=new Set;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}setKnownPaneIds(e){this.knownPaneIds=new Set(e),this.cacheInvalid=!0}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)}let n=t.getDeclaredNamespaces?.();n&&this.pluginHost&&this.pluginHost.registerStateOwner(e.name,n),this.onInvalidate?.()}unregister(e){let t=this.plugins.get(e);if(t){if(this.pluginHost?.clearByOwner(e),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`?$i: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($i)??[];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($i,[...e]),this.cacheInvalid=!1}isRendererEnabled(e){let t=this.enabledState.get(e.name);return t===void 0?e.enabled!==!1:t}getMergedRenderers(e){this.rebuildCache();let t=this.mergedCache.get(e);if(!t){let n=this.groupCache.get(e)??[],r=this.groupCache.get($i)??[];t=this.mergeSorted(n,r),this.mergedCache.set(e,t)}return t}getRenderers(e){return this.getMergedRenderers(e).filter(e=>e.isSystem?!1:this.isRendererEnabled(e))}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||!this.isRendererEnabled(n))return[];let r=[];try{n.draw(t)}catch(n){let i=n instanceof Error?n:Error(String(n));console.error(`[RendererPlugin] ${e} draw error:`,i),r.push({name:e,error:{message:i.message,stack:i.stack},paneId:t.pane.id,timestamp:Date.now()})}return r}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&&this.isRendererEnabled(n))try{n.onDataUpdate(e,t)}catch(e){console.error(`[RendererPlugin] ${n.name} onDataUpdate error:`,e)}}notifyResize(e,t){let n=this.getMergedRenderers(e).filter(e=>this.isRendererEnabled(e));for(let e of n)if(e.onResize)try{e.onResize(t)}catch(t){console.error(`[RendererPlugin] ${e.name} onResize error:`,t)}}},ta=1.2,na=24,ra=6;function ia(e){switch(e){case`arrow_up`:case`flag`:return!0;default:return!1}}function aa(){return{name:`customMarkers`,version:`1.0.0`,description:`自定义标记渲染器`,debugName:`自定义标记`,paneId:Ki,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.role===`price`){t.save(),t.translate(-a,0);for(let e of l){let r=sa(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=oa(o,p),h=(e.offset?.y??0)<0?!0:(e.offset?.y??0)>0?!1:ia(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;Mi(t,e.shape,_,v,m,e.style||{}),e.label&&Fi(t,e.label,_,v,m,e.style||{},h),c.setCustomMarkerPosition(e.id,_-a,v,m,e.shape)}t.restore()}}}}function oa(e,t){let n=e*ta;return Math.max(ra,Math.min(n,t??na))}function sa(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 ca(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 la(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 ua(e){let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}`}var da=ca,fa=ca;function pa(e){if(e.length===0)return[];let t=[0],n=ua(e[0].timestamp);for(let r=1;r<e.length;r++){let i=e[r];if(!i)continue;let a=ua(i.timestamp);a!==n&&(t.push(r),n=a)}return t}var ma={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:`rgba(196, 74, 86, 0.95)`},ha={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`},ga={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`},_a={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)`},va={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`},ya={UP:`#ff5252`,DOWN:`#22ab94`,NEUTRAL:`rgba(0, 0, 0, 0.78)`},ba={RSI1:`rgba(69, 112, 249, 1)`,RSI2:`rgba(255, 152, 0, 1)`,RSI3:`rgba(156, 39, 176, 1)`},xa={CCI:`rgba(69, 112, 249, 1)`,OVERBOUGHT:`rgba(214, 10, 34, 0.5)`,OVERSOLD:`rgba(3, 123, 102, 0.5)`},Sa={K:`rgba(69, 112, 249, 1)`,D:`rgba(255, 152, 0, 1)`,J:`rgba(156, 39, 176, 1)`},Ca={MOM:`rgba(69, 112, 249, 1)`,ZERO:`rgba(0, 0, 0, 0.2)`},wa={WMSR:`rgba(69, 112, 249, 1)`,OVERBOUGHT:`rgba(214, 10, 34, 0.5)`,OVERSOLD:`rgba(3, 123, 102, 0.5)`},Ta={KST:`rgba(69, 112, 249, 1)`,SIGNAL:`rgba(255, 152, 0, 1)`},Ea={FAST:`rgba(255, 152, 0, 1)`,SLOW:`rgba(69, 112, 249, 1)`},Da={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)`},Oa={LINE:`rgba(0, 0, 0, 0.28)`,LABEL_BG:`rgb(0, 0, 0)`,LABEL_TEXT:`rgba(255, 255, 255, 0.92)`},ka=J.UP,Aa=J.DOWN,ja=J.NEUTRAL;function Ma(e){return e>0?ka:e<0?Aa:ja}function Na(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 Pa(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}`}function Fa(e,t=2){return`${e.toFixed(t)}%`}function Ia(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}%`}function La(e,t){let n=t?.close??e.open;return Ma(e.open-n)}function Ra(e){return Ma(e.close-e.open)}function za(e){return typeof e.changePercent==`number`?Ma(e.changePercent):typeof e.changeAmount==`number`?Ma(e.changeAmount):ja}var Ba={class:`kline-tooltip__title`},Va={key:0},Ha={class:`kline-tooltip__grid`},Ua={class:`row`},Wa={class:`row`},Ga={class:`row`},Ka={class:`row`},qa={key:0,class:`row`},Ja={key:1,class:`row`},Ya={key:2,class:`row`},Xa={key:3,class:`row`},Za={key:4,class:`row`},Qa={key:5,class:`row`},$a=(0,f.defineComponent)({__name:`KLineTooltip`,props:{k:{},index:{},data:{},pos:{},useAnchor:{type:Boolean},anchorPlacement:{},setEl:{type:Function}},setup(e){let t=e,n=(0,f.computed)(()=>t.useAnchor===!0),r=(0,f.computed)(()=>t.anchorPlacement===`left-bottom`?`anchor-left-bottom`:`anchor-right-bottom`);function i(e){t.setEl?.(e)}let a=(0,f.computed)(()=>{let e=t.k;if(!e)return ja;let n=t.index;return La(e,typeof n==`number`&&n>0?t.data[n-1]:void 0)}),o=(0,f.computed)(()=>{let e=t.k;return e?Ra(e):ja}),s=(0,f.computed)(()=>{let e=t.k;return e?za(e):ja});return(t,c)=>e.k?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,ref:i,class:(0,f.normalizeClass)([`kline-tooltip`,[{"use-anchor":n.value},r.value]]),style:(0,f.normalizeStyle)(n.value?void 0:{left:`${e.pos.x}px`,top:`${e.pos.y}px`})},[(0,f.createElementVNode)(`div`,Ba,[e.k.stockCode?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Va,(0,f.toDisplayString)(e.k.stockCode),1)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(da)(e.k.timestamp)),1)]),(0,f.createElementVNode)(`div`,Ha,[(0,f.createElementVNode)(`div`,Ua,[c[0]||=(0,f.createElementVNode)(`span`,null,`开`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:a.value})},(0,f.toDisplayString)(e.k.open.toFixed(2)),5)]),(0,f.createElementVNode)(`div`,Wa,[c[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`,Ga,[c[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`,Ka,[c[3]||=(0,f.createElementVNode)(`span`,null,`收`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:o.value})},(0,f.toDisplayString)(e.k.close.toFixed(2)),5)]),typeof e.k.volume==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,qa,[c[4]||=(0,f.createElementVNode)(`span`,null,`成交量`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(Na)(e.k.volume)),1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.turnover==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ja,[c[5]||=(0,f.createElementVNode)(`span`,null,`成交额`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(Na)(e.k.turnover)),1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.amplitude==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ya,[c[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`,Xa,[c[7]||=(0,f.createElementVNode)(`span`,null,`涨跌幅`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:s.value})},(0,f.toDisplayString)((0,f.unref)(Ia)(e.k.changePercent)),5)])):(0,f.createCommentVNode)(``,!0),typeof e.k.changeAmount==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Za,[c[8]||=(0,f.createElementVNode)(`span`,null,`涨跌额`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:s.value})},(0,f.toDisplayString)((0,f.unref)(Pa)(e.k.changeAmount)),5)])):(0,f.createCommentVNode)(``,!0),typeof e.k.turnoverRate==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Qa,[c[9]||=(0,f.createElementVNode)(`span`,null,`换手率`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(Fa)(e.k.turnoverRate)),1)])):(0,f.createCommentVNode)(``,!0)])],6)):(0,f.createCommentVNode)(``,!0)}}),eo=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},to=eo($a,[[`__scopeId`,`data-v-d0fe85e6`]]),no={RISE_WITH_VOLUME:`量价齐升`,RISE_WITHOUT_VOLUME:`量缩价升`,FALL_WITH_VOLUME:`量价齐缩`,FALL_WITHOUT_VOLUME:`量升价缩`},ro=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&&Ui(e,t,r.shape,r.x,r.y,r.size))return n}return null}},io={class:`marker-tooltip__title`},ao={key:0,class:`marker-tooltip__content`},oo=eo((0,f.defineComponent)({__name:`MarkerTooltip`,props:{marker:{},pos:{},useAnchor:{type:Boolean},anchorPlacement:{},setEl:{type:Function}},setup(e){let t=e,n=(0,f.computed)(()=>t.useAnchor===!0),r=(0,f.computed)(()=>t.anchorPlacement===`left-bottom`?`anchor-left-bottom`:`anchor-right-bottom`);function i(e){t.setEl?.(e)}let a=(0,f.computed)(()=>t.marker&&`date`in t.marker),o=(0,f.computed)(()=>{if(!t.marker)return``;if(a.value){let e=t.marker;return e.label?.text||e.shape}let e=t.marker;return no[e.markerType]||e.markerType}),s=(0,f.computed)(()=>{if(!t.marker)return{};if(a.value){let e=t.marker;return{日期:e.date,...e.metadata}}return t.marker.metadata}),c=(0,f.computed)(()=>Object.keys(s.value).length>0);function l(e){return typeof e==`number`?e.toFixed(2):String(e)}return(t,a)=>e.marker?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,ref:i,class:(0,f.normalizeClass)([`marker-tooltip`,[{"use-anchor":n.value},r.value]]),style:(0,f.normalizeStyle)(n.value?void 0:{left:`${e.pos.x+12}px`,top:`${e.pos.y+12}px`})},[(0,f.createElementVNode)(`div`,io,(0,f.toDisplayString)(o.value),1),c.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,ao,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(s.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)(l(e)),1)]))),128))])):(0,f.createCommentVNode)(``,!0)],6)):(0,f.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-5574cc25`]]),so={class:`params-header`},co={class:`header-left`},lo={class:`params-title`},uo={class:`header-right`},fo={key:0,class:`indicator-description`},po={class:`params-body`},mo={class:`param-header`},ho={class:`param-label`},go={class:`param-label-text`},_o={key:0,class:`param-range`},vo={class:`input-wrapper`},yo=[`disabled`,`onClick`],bo=[`value`,`min`,`max`,`step`,`onInput`],xo=[`disabled`,`onClick`],So={key:0,class:`param-description`},Co={class:`params-footer`},wo={class:`footer-right`},To=eo((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`,so,[(0,f.createElementVNode)(`div`,co,[(0,f.createElementVNode)(`span`,lo,(0,f.toDisplayString)(e.indicatorName),1),n[5]||=(0,f.createElementVNode)(`span`,{class:`params-subtitle`},`参数设置`,-1)]),(0,f.createElementVNode)(`div`,uo,[(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`,fo,[(0,f.createElementVNode)(`p`,null,(0,f.toDisplayString)(e.indicatorDescription),1)])):(0,f.createCommentVNode)(``,!0)]),_:1}),(0,f.createElementVNode)(`div`,po,[((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`,mo,[(0,f.createElementVNode)(`label`,ho,[(0,f.createElementVNode)(`span`,go,(0,f.toDisplayString)(e.label),1),e.min!==void 0||e.max!==void 0?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,_o,(0,f.toDisplayString)(e.min??`-∞`)+` ~ `+(0,f.toDisplayString)(e.max??`+∞`),1)):(0,f.createCommentVNode)(``,!0)]),(0,f.createElementVNode)(`div`,vo,[(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,yo),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,bo)):(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,xo)])]),(0,f.createVNode)(f.Transition,{name:`slide`},{default:(0,f.withCtx)(()=>[a.value&&e.description?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,So,(0,f.toDisplayString)(e.description),1)):(0,f.createCommentVNode)(``,!0)]),_:2},1024)],2))),128))]),(0,f.createElementVNode)(`div`,Co,[(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`,wo,[(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`]]),Eo={class:`indicator-selector`},Do={class:`indicator-scroll-container`},Oo={class:`indicator-list`},ko={key:0,class:`indicator-divider`,"aria-hidden":`true`},Ao=[`draggable`,`onDragstart`,`onDragover`,`onDrop`],jo=[`onMouseenter`],Mo={class:`btn-content`},No={key:0,class:`param-hint`},Po={key:0,class:`hover-overlay`},Fo=[`onClick`],Io={key:1,class:`divider`},Lo=[`onClick`],Ro={class:`indicator-item`},zo={class:`menu-section`},Bo={class:`menu-items`},Vo=[`disabled`,`onClick`],Ho={class:`param-hint`},Uo={key:0,class:`active-tag`},Wo={class:`menu-section`},Go={class:`menu-items`},Ko=[`disabled`,`onClick`],qo={class:`param-hint`},Jo={key:0,class:`active-tag`},Yo=eo((0,f.defineComponent)({__name:`IndicatorSelector`,props:{activeIndicators:{},indicatorParams:{}},emits:[`toggle`,`updateParams`,`reorderSubIndicators`],setup(e,{emit:t}){let n=[{id:`MA`,label:`MA`,name:`均线`,pane:`main`},{id:`VOLUME`,label:`VOL`,name:`成交量`,pane:`sub`,description:`成交量反映市场活跃度,柱状图显示每根K线的交易量。上涨时柱子为红色,下跌时为绿色。`},{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.ref)(!1),g=(0,f.ref)(null),_=(0,f.ref)(null),v=(0,f.computed)(()=>a.activeIndicators?.length?a.activeIndicators.map(e=>n.find(t=>t.id===e)).filter(e=>e!==void 0).sort((e,t)=>e.pane===t.pane?0:e.pane===`main`?-1:1):[]),y=(0,f.computed)(()=>v.value.some(e=>e.pane===`main`)?v.value.find(e=>e.pane===`sub`)?.id??null:null),b=(0,f.computed)(()=>u.value&&n.find(e=>e.id===u.value)||null);function x(e){return a.activeIndicators?.includes(e)??!1}function S(e){if(x(e))return;let t=n.find(t=>t.id===e);t&&(t.pane===`main`&&n.filter(t=>t.pane===`main`&&t.id!==e&&x(t.id)).forEach(e=>o(`toggle`,e.id,!1)),o(`toggle`,e,!0),p.value=!1)}function C(e){o(`toggle`,e,!1)}function w(e){u.value=e,l.value=!0}function T(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 E(e){let t=T(e.id);return e.params?e.params.map(e=>t[e.key]??``).join(`,`):``}function D(e){u.value&&o(`updateParams`,u.value,e),l.value=!1}function O(e){return n.find(t=>t.id===e)?.pane===`sub`}function k(e,t){if(!O(t)){e.preventDefault();return}_.value=t,g.value=null,e.dataTransfer?.setData(`text/plain`,t),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`)}function A(e,t){!_.value||!O(t)||_.value===t||(g.value=t,e.dataTransfer&&(e.dataTransfer.dropEffect=`move`))}function j(e,t){let n=_.value||e.dataTransfer?.getData(`text/plain`)||``;if(!n||n===t){M();return}if(!O(n)||!O(t)){M();return}let r=v.value.findIndex(e=>e.id===n),i=v.value.findIndex(e=>e.id===t);if(r<0||i<0){M();return}let a=[...v.value.map(e=>e.id)],[s]=a.splice(r,1);if(!s){M();return}a.splice(i,0,s),o(`reorderSubIndicators`,a.filter(e=>O(e))),M()}function M(){g.value=null,_.value=null}function N(){if(!p.value&&s.value&&!h.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 ee(e){let t=c.value&&!c.value.contains(e.target),n=s.value&&!s.value.contains(e.target);t&&n&&(p.value=!1)}function te(){p.value&&=!1}return(0,f.onMounted)(()=>{h.value=typeof CSS<`u`&&CSS.supports(`anchor-name: --kmap-anchor`)&&CSS.supports(`position-anchor: --kmap-anchor`),document.addEventListener(`click`,ee),window.addEventListener(`resize`,te)}),(0,f.onUnmounted)(()=>{document.removeEventListener(`click`,ee),window.removeEventListener(`resize`,te)}),(e,t)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Eo,[(0,f.createElementVNode)(`div`,Do,[(0,f.createElementVNode)(`div`,Oo,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(v.value,e=>((0,f.openBlock)(),(0,f.createElementBlock)(f.Fragment,{key:e.id},[e.id===y.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,ko)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`div`,{class:(0,f.normalizeClass)([`indicator-item`,{draggable:O(e.id),"drag-over":g.value===e.id,"is-dragging":_.value===e.id}]),draggable:O(e.id),onDragstart:t=>k(t,e.id),onDragover:(0,f.withModifiers)(t=>A(t,e.id),[`prevent`]),onDrop:(0,f.withModifiers)(t=>j(t,e.id),[`prevent`]),onDragend:M},[(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`,Mo,[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,No,` (`+(0,f.toDisplayString)(E(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`,Po,[e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:0,class:`action-btn settings-btn`,onClick:(0,f.withModifiers)(t=>w(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,Fo)):(0,f.createCommentVNode)(``,!0),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Io)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`button`,{class:`action-btn remove-btn`,onClick:(0,f.withModifiers)(t=>C(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,Lo)])):(0,f.createCommentVNode)(``,!0)]),_:2},1024)],2)],40,jo)],42,Ao)],64))),128)),(0,f.createElementVNode)(`div`,Ro,[(0,f.createElementVNode)(`button`,{ref_key:`addBtnRef`,ref:s,class:`add-btn`,onClick:N,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:(0,f.normalizeClass)([`add-menu`,{"use-anchor":h.value}]),ref_key:`addMenuRef`,ref:c,style:(0,f.normalizeStyle)(h.value?void 0:m.value)},[(0,f.createElementVNode)(`div`,zo,[t[6]||=(0,f.createElementVNode)(`div`,{class:`menu-title`},`主图指标`,-1),(0,f.createElementVNode)(`div`,Bo,[((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:x(e.id)}]),disabled:x(e.id),onClick:t=>S(e.id)},[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),(0,f.createElementVNode)(`span`,Ho,` (`+(0,f.toDisplayString)(e.name)+`) `,1),x(e.id)?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Uo,[...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,Vo))),128))])]),(0,f.createElementVNode)(`div`,Wo,[t[8]||=(0,f.createElementVNode)(`div`,{class:`menu-title`},`副图指标`,-1),(0,f.createElementVNode)(`div`,Go,[((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:x(e.id)}]),disabled:x(e.id),onClick:t=>S(e.id)},[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),(0,f.createElementVNode)(`span`,qo,` (`+(0,f.toDisplayString)(e.name)+`) `,1),x(e.id)?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Jo,[...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,Ko))),128))])])],6)):(0,f.createCommentVNode)(``,!0)]),_:1})])),b.value?((0,f.openBlock)(),(0,f.createBlock)(To,{key:0,visible:l.value,"indicator-id":b.value.id,"indicator-name":b.value.name,"indicator-description":b.value.description,params:b.value.params||[],values:T(b.value.id),onClose:t[1]||=e=>l.value=!1,onConfirm:D},null,8,[`visible`,`indicator-id`,`indicator-name`,`indicator-description`,`params`,`values`])):(0,f.createCommentVNode)(``,!0)]))}}),[[`__scopeId`,`data-v-4b90c954`]]),Xo={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Zo(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Xo,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 7h16m-10 4v6m4-6v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`},null,-1)]])}var Qo=(0,f.markRaw)({name:`tabler-trash`,render:Zo}),$o={class:`toolbar-item color-item`,title:`颜色`},es=[`value`],ts=[`value`],ns=[`value`],rs=eo((0,f.defineComponent)({__name:`DrawingStyleToolbar`,props:{drawing:{}},emits:[`updateStyle`,`delete`],setup(e,{emit:t}){let n=t;function r(e){n(`updateStyle`,{stroke:e})}function i(e){n(`updateStyle`,{strokeWidth:e})}function a(e){n(`updateStyle`,{strokeStyle:e})}return(t,n)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{class:`drawing-style-toolbar`,onPointerdown:n[4]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[5]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[6]||=(0,f.withModifiers)(()=>{},[`stop`])},[(0,f.createElementVNode)(`div`,$o,[(0,f.createElementVNode)(`span`,{class:`color-swatch`,style:(0,f.normalizeStyle)({background:e.drawing.style.stroke??`#2962ff`})},null,4),(0,f.createElementVNode)(`input`,{type:`color`,class:`color-input`,value:e.drawing.style.stroke??`#2962ff`,onInput:n[0]||=e=>r(e.target.value)},null,40,es)]),(0,f.createElementVNode)(`select`,{class:`toolbar-select`,value:e.drawing.style.strokeWidth??1,onChange:n[1]||=e=>i(Number(e.target.value)),title:`线宽`},[...n[7]||=[(0,f.createElementVNode)(`option`,{value:1},`1px`,-1),(0,f.createElementVNode)(`option`,{value:2},`2px`,-1),(0,f.createElementVNode)(`option`,{value:3},`3px`,-1),(0,f.createElementVNode)(`option`,{value:4},`4px`,-1)]],40,ts),(0,f.createElementVNode)(`select`,{class:`toolbar-select`,value:e.drawing.style.strokeStyle??`solid`,onChange:n[2]||=e=>a(e.target.value),title:`线型`},[...n[8]||=[(0,f.createElementVNode)(`option`,{value:`solid`},`实线`,-1),(0,f.createElementVNode)(`option`,{value:`dashed`},`虚线`,-1),(0,f.createElementVNode)(`option`,{value:`dotted`},`点线`,-1)]],40,ns),(0,f.createElementVNode)(`button`,{type:`button`,class:`toolbar-btn delete-btn`,title:`删除`,onClick:n[3]||=e=>t.$emit(`delete`)},[(0,f.createVNode)((0,f.unref)(Qo),{class:`delete-icon`,"aria-hidden":`true`})])],32))}}),[[`__scopeId`,`data-v-088ccef5`]]);function is(e,t){let n=Math.round(e*t);return n%2==0&&(n+=1),Math.max(1,n)}function as(e,t,n){let r=is(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 os(e,t,n,r,i,a=1){let{unitPx:o,startXPx:s}=as(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 ss(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 cs=class{range={maxPrice:100,minPrice:0};height=1;paddingTop=0;paddingBottom=0;priceOffset=0;verticalScale=1;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=this.clampOffset(e)}getPriceOffset(){return this.priceOffset}resetPriceOffset(){this.priceOffset=0}clampOffset(e){let t=this.range.maxPrice-this.range.minPrice;if(t<=0)return 0;let n=t*(1+1/this.verticalScale)/2;return Math.max(-n,Math.min(n,e))}scaleByDelta(e){if(!Number.isFinite(e)||e===0)return;let t=Math.exp(-e*.01),n=this.verticalScale*t;this.verticalScale=Math.min(8,Math.max(.2,n)),this.priceOffset=this.clampOffset(this.priceOffset)}getVerticalScale(){return this.verticalScale}getDisplayRange(e){let t=e??this.range,n=t.minPrice,r=t.maxPrice,i=r-n||1,a=(r+n)/2+this.priceOffset,o=i/(2*this.verticalScale);return{maxPrice:a+o,minPrice:a-o}}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),s=this.paddingTop+o*(1-a),c=this.paddingTop+o/2;return c+(s-c)*this.verticalScale}yToPrice(e){let{maxPrice:t,minPrice:n}=this.range,r=t-n||1,i=Math.max(1,this.height-this.paddingTop-this.paddingBottom),a=this.paddingTop+i/2;return n+(1-(a+(e-a)/this.verticalScale-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))}};function ls(e){return e===`price`?{showPriceAxisTicks:!0,showCrosshairPriceLabel:!0,candleHitTest:!0,supportsPriceTranslate:!0}:e===`indicator`?{showPriceAxisTicks:!1,showCrosshairPriceLabel:!0,candleHitTest:!1,supportsPriceTranslate:!0}:{showPriceAxisTicks:!1,showCrosshairPriceLabel:!1,candleHitTest:!1,supportsPriceTranslate:!1}}var us=class{id;role;capabilities;top=0;height=0;priceRange={maxPrice:100,minPrice:0};yAxis=new cs;renderers=[];constructor(e,t={}){this.id=e,this.role=t.role??(e===`main`?`price`:`indicator`),this.capabilities={...ls(this.role),...t.capabilities??{}}}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=ss(e,t.start,t.end),this.yAxis.setRange(this.priceRange)}},ds=class{chart;isDragging=!1;dragMode=`none`;dragStartX=0;scrollStartX=0;applyPanScroll(e,t){let n=Math.max(0,e.scrollWidth-e.clientWidth),r=Math.min(Math.max(0,t),n),i=this.chart.getCurrentDpr();e.scrollLeft=Math.round(r*i)/i}dragStartY=0;activePaneIdOnDrag=null;activeSeparatorUpperPaneId=null;hoveredSeparatorUpperPaneId=null;hoveredRightAxisPaneId=null;isTouchSession=!1;crosshairPos=null;crosshairIndex=null;crosshairPrice=null;hoveredIndex=null;activePaneId=null;tooltipPos={x:0,y:0};tooltipSize={width:220,height:180};tooltipAnchorPlacement=`right-bottom`;useTooltipAnchorPositioning=!1;onInteractionChangeCallback;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}getInteractionSnapshot(){return{crosshairPos:this.crosshairPos?{...this.crosshairPos}:null,crosshairIndex:this.crosshairIndex,crosshairPrice:this.crosshairPrice,hoveredIndex:this.hoveredIndex,activePaneId:this.activePaneId,tooltipPos:{...this.tooltipPos},tooltipAnchorPlacement:this.tooltipAnchorPlacement,hoveredMarkerData:this.hoveredMarkerData,hoveredCustomMarker:this.hoveredCustomMarker,isDragging:this.isDragging,isResizingPaneBoundary:this.dragMode===`resize-separator`,isHoveringPaneBoundary:this.hoveredSeparatorUpperPaneId!==null,hoveredPaneBoundaryId:this.hoveredSeparatorUpperPaneId,isHoveringRightAxis:this.hoveredRightAxisPaneId!==null}}setOnInteractionChange(e){this.onInteractionChangeCallback=e}notifyInteractionChange(){this.onInteractionChangeCallback?.(this.getInteractionSnapshot())}onPointerDown(e){if(e.isPrimary===!1)return;this.isTouchSession=e.pointerType===`touch`;let t=this.getPlotPointerLocation(e.clientX,e.clientY);if(!t)return;let n=this.chart.getDom().container,{mouseX:r,mouseY:i}=t,a=n.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.hitTestPaneSeparator(i);if(l){this.isDragging=!0,this.dragMode=`resize-separator`,this.dragStartY=e.clientY,this.activeSeparatorUpperPaneId=l,this.hoveredSeparatorUpperPaneId=l,this.clearHover(),this.chart.scheduleDraw();return}let u=this.getPaneByY(i);this.isDragging=!0,this.dragMode=`pan`,this.updatePlotHoverFromPoint(e.clientX,e.clientY),this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.scrollStartX=n.scrollLeft,this.activePaneIdOnDrag=u?.id||null,this.chart.scheduleDraw()}setTooltipSize(e){this.tooltipSize=e}setTooltipAnchorPositioning(e){this.useTooltipAnchorPositioning=e}onPointerUp(e){e.isPrimary!==!1&&(this.isDragging=!1,this.dragMode=`none`,this.activePaneIdOnDrag=null,this.activeSeparatorUpperPaneId=null,this.notifyInteractionChange())}onPointerLeave(e){e.isPrimary!==!1&&(this.isDragging=!1,this.dragMode=`none`,this.activePaneIdOnDrag=null,this.clearSeparatorState(),this.isTouchSession=!1,this.clearHover(),this.chart.scheduleDraw(),this.notifyInteractionChange())}onScroll(){this.kLinePositions=null,this.visibleRange=null,this.clearHover(),this.chart.scheduleDraw(),this.notifyInteractionChange()}onPointerMove(e){if(!e.isPrimary)return;e.pointerType===`touch`&&(this.isTouchSession=!0);let t=this.chart.getDom().container;if(this.isDragging){if(this.dragMode===`resize-separator`){let t=e.clientY-this.dragStartY;t!==0&&this.activeSeparatorUpperPaneId&&this.chart.resizePaneBoundary(this.activeSeparatorUpperPaneId,t)&&(this.dragStartY=e.clientY);return}if(this.dragMode===`scale-price`){let t=e.clientY-this.dragStartY;t!==0&&this.activePaneIdOnDrag&&(this.chart.scalePrice(this.activePaneIdOnDrag,t),this.dragStartY=e.clientY);return}if(this.dragMode===`pan`){let n=this.dragStartX-e.clientX;this.applyPanScroll(t,this.scrollStartX+n);let r=e.clientY-this.dragStartY;r!==0&&this.activePaneIdOnDrag===`main`&&(this.chart.translatePrice(this.activePaneIdOnDrag,r),this.dragStartY=e.clientY)}return}let n=this.getPlotPointerLocation(e.clientX,e.clientY);n&&(this.hoveredSeparatorUpperPaneId=this.hitTestPaneSeparator(n.mouseY),this.updatePlotHoverFromPoint(e.clientX,e.clientY),this.chart.scheduleDraw(),this.notifyInteractionChange())}setKLinePositions(e,t,n){this.kLinePositions=e,this.visibleRange=t,n!==void 0&&(this.kWidthPx=n)}onRightAxisPointerDown(e){if(e.isPrimary===!1)return;this.isTouchSession=e.pointerType===`touch`;let t=this.getRightAxisPointerLocation(e.clientX,e.clientY);t&&this.beginScalePriceDrag(e.clientY,t.mouseY)&&(this.chart.scheduleDraw(),this.notifyInteractionChange())}onRightAxisPointerMove(e){if(e.isPrimary){if(e.pointerType===`touch`&&(this.isTouchSession=!0),this.isDragging&&this.dragMode===`scale-price`){let t=e.clientY-this.dragStartY;t!==0&&this.activePaneIdOnDrag&&(this.chart.scalePrice(this.activePaneIdOnDrag,t),this.dragStartY=e.clientY);return}this.updateRightAxisHoverFromPoint(e.clientX,e.clientY),this.chart.scheduleDraw(),this.notifyInteractionChange()}}onRightAxisPointerUp(e){this.onPointerUp(e)}onRightAxisPointerLeave(e){e.isPrimary!==!1&&(this.isDragging&&this.dragMode===`scale-price`||(this.hoveredRightAxisPaneId=null,this.notifyInteractionChange()))}isDraggingState(){return this.isDragging}setOnMarkerHover(e){this.onMarkerHoverCallback=e}setOnMarkerClick(e){this.onMarkerClickCallback=e}setOnCustomMarkerHover(e){this.onCustomMarkerHoverCallback=e}setOnCustomMarkerClick(e){this.onCustomMarkerClickCallback=e}hitTestPaneSeparator(e){let t=this.chart.getPaneRenderers();if(t.length<2)return null;for(let n=0;n<t.length-1;n++){let r=t[n]?.getPane(),i=t[n+1]?.getPane();if(!r||!i)continue;let a=r.top+r.height;if(Math.abs(e-a)<=5)return r.id}return null}getPaneByY(e){return this.chart.getPaneRenderers().find(t=>{let n=t.getPane();return e>=n.top&&e<=n.top+n.height})?.getPane()||null}getPlotPointerLocation(e,t){let n=this.chart.getDom().container.getBoundingClientRect();return{mouseX:e-n.left,mouseY:t-n.top}}getRightAxisPointerLocation(e,t){let n=this.chart.getDom().rightAxisLayer.getBoundingClientRect();return{mouseX:e-n.left,mouseY:t-n.top}}beginScalePriceDrag(e,t){let n=this.getPaneByY(t);return n?(this.isDragging=!0,this.dragMode=`scale-price`,this.dragStartY=e,this.activePaneIdOnDrag=n.id,this.hoveredRightAxisPaneId=n.id,this.hoveredSeparatorUpperPaneId=null,this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=n.id,!0):!1}clearHover(){this.hoveredRightAxisPaneId=null,this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=null,this.hoveredMarkerId===null?this.hoveredMarkerData=null:(this.hoveredMarkerId=null,this.hoveredMarkerData=null,this.chart.getMarkerManager().setHover(null),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null)),this.hoveredCustomMarker!==null&&(this.hoveredCustomMarker=null,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(null))}clearSeparatorState(){this.activeSeparatorUpperPaneId=null,this.hoveredSeparatorUpperPaneId=null,this.hoveredRightAxisPaneId=null}updateRightAxisHoverFromPoint(e,t){let n=this.getRightAxisPointerLocation(e,t);if(!n)return;let{mouseY:r}=n,i=this.chart.getViewport()?.plotHeight??Math.max(1,Math.round(this.chart.getDom().container.clientHeight));if(r<0||r>i){this.hoveredRightAxisPaneId=null;return}let a=this.getPaneByY(r);this.hoveredRightAxisPaneId=a?.id||null,this.hoveredSeparatorUpperPaneId=null,this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=a?.id||null}updatePlotHoverFromPoint(e,t){let n=this.getPlotPointerLocation(e,t);if(!n)return;let{mouseX:r,mouseY:i}=n,a=this.chart.getDom().container,o=this.chart.getViewport(),s=o?.viewWidth??Math.max(1,Math.round(a.clientWidth)),c=o?.viewHeight??Math.max(1,Math.round(a.clientHeight)),l=o?.plotWidth??s,u=o?.plotHeight??c;if(r<0||i<0||r>l||i>u){this.clearHover();return}this.hoveredRightAxisPaneId=null;let d=a.scrollLeft,f=this.chart.getCurrentDpr(),p=this.hitTestPaneSeparator(i);if(this.hoveredSeparatorUpperPaneId=p,p){this.clearHover();return}let m=this.chart.getMarkerManager(),h=d+r,g=m.hitTest(h,i,3);if(g){this.hoveredMarkerId!==g.id&&(this.hoveredMarkerId=g.id,this.hoveredMarkerData=g,m.setHover(g.id),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(g)),this.hoveredCustomMarker!==null&&(this.hoveredCustomMarker=null,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(null)),this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null;return}else this.hoveredMarkerId!==null&&(this.hoveredMarkerId=null,this.hoveredMarkerData=null,m.setHover(null),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null));let _=m.hitTestCustomMarker(r,i);if(_){this.hoveredCustomMarker?.id!==_.id&&(this.hoveredCustomMarker=_,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(_)),this.hoveredMarkerId!==null&&(this.hoveredMarkerId=null,this.hoveredMarkerData=null,m.setHover(null),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null)),this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=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 v=this.kWidthPx/f,y=0,b=this.kLinePositions.length;for(;y<b;){let e=y+b>>1;this.kLinePositions[e]<h?y=e+1:b=e}let x=y;if(y>0&&y<this.kLinePositions.length){let e=this.kLinePositions[y-1]+v/2,t=this.kLinePositions[y]+v/2;Math.abs(h-e)<Math.abs(h-t)&&(x=y-1)}else y===this.kLinePositions.length&&this.kLinePositions.length>0&&(x=this.kLinePositions.length-1);let S=x+this.visibleRange.start,C=this.chart.getData(),w=this.getPaneByY(i);if(this.activePaneId=w?.id||null,S>=0&&S<(C?.length??0)){this.crosshairIndex=S;let e=this.kLinePositions[x]+(this.kWidthPx-1)/2/f-d;if(this.crosshairPos={x:Math.min(Math.max(e,0),l),y:Math.min(Math.max(i,0),u)},w){let e=i-w.top;this.crosshairPrice=w.yAxis.yToPrice(e)}else this.crosshairPrice=null}else this.crosshairIndex=null,this.crosshairPos=null,this.crosshairPrice=null;let T=typeof this.crosshairIndex==`number`?C[this.crosshairIndex]:void 0;if(!T||!w||!w.capabilities.candleHitTest){this.hoveredIndex=null;return}let E=i-w.top,D=w.yAxis.priceToY(T.open),O=w.yAxis.priceToY(T.close),k=w.yAxis.priceToY(T.high),A=w.yAxis.priceToY(T.low),j=Math.min(D,O),M=Math.max(D,O),N=h-this.kLinePositions[x],ee=v/2,te=Math.abs(M-j),ne=te<8?(j+M)/2-8/2:j,re=te<8?(j+M)/2+8/2:M,ie=E>=ne&&E<=re&&N>=0&&N<=v,ae=Math.abs(N-ee)<=3&&E>=Math.min(k,A)&&E<=Math.max(k,A);if(!ie&&!ae){this.hoveredIndex=null;return}if(this.hoveredIndex=this.crosshairIndex,this.useTooltipAnchorPositioning){let e=this.tooltipSize.width,t=r+14+e+12>l;this.tooltipAnchorPlacement=t?`left-bottom`:`right-bottom`,this.tooltipPos={x:Math.min(Math.max(r,12),Math.max(12,l-12)),y:Math.min(Math.max(i,12),Math.max(12,u-12))};return}let oe=this.tooltipSize.width,se=this.tooltipSize.height,P=r+14,ce=r-14-oe,le=P+oe+12<=s?P:ce,ue=i+14,de=Math.max(12,s-oe-12),fe=Math.max(12,c-se-12);this.tooltipPos={x:Math.min(Math.max(le,12),de),y:Math.min(Math.max(ue,12),fe)}}reset(){this.isDragging=!1,this.dragMode=`none`,this.dragStartX=0,this.dragStartY=0,this.scrollStartX=0,this.activePaneIdOnDrag=null,this.clearSeparatorState(),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.hoveredCustomMarker=null,this.kLinePositions=null,this.visibleRange=null,this.kWidthPx=null}getCrosshairIndex(){return this.crosshairIndex}},fs=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(){}},ps=3;function ms(e,t){let n=(e-1)/(t.zoomLevelCount-1);return t.minKWidth+n*(t.maxKWidth-t.minKWidth)}function hs(e){return ps/e}function gs(e,t,n,r,i,a,o){let s=Math.max(1,Math.min(o.zoomLevelCount,r+e));if(s===r)return null;let c=ms(s,o),l=hs(o.dpr),u=i+a;return{targetLevel:s,newKWidth:c,newKGap:l,newScrollLeft:(n+t)/u*(c+l)-t}}function _s(e,t,n,r,i,a,o){let s=Math.max(1,Math.min(o.zoomLevelCount,Math.round(e)))-r;return s===0?null:gs(s,t,n,r,i,a,o)}var vs=(e,t)=>`indicator:${e}:${t}`;function ys(e={}){let{paneId:t=`sub`}=e,n=vs(`volume`,t),r=null;return{name:`volume_${t}`,version:`1.0.0`,description:`成交量渲染器`,debugName:`成交量`,paneId:t,priority:q.MAIN,onInstall(e){r=e},getDeclaredNamespaces(){return[n]},draw(e){let{ctx:i,pane:a,data:o,range:s,scrollLeft:c,kWidth:l,kGap:u,dpr:d,kLinePositions:f}=e,p=o;if(!p.length)return;i.save(),i.translate(-c,0);let{start:m,end:h}=s,g=0,_=1/0;for(let e=m;e<h&&e<p.length;e++){let t=p[e];if(!t)continue;let n=t.volume;n!=null&&(g=Math.max(g,n),_=Math.min(_,n))}if(g===0||!Number.isFinite(_)){i.restore();return}let v=Math.max(.05,(g-_)*.1),y=Math.max(0,_-v),b=g+v,x=a.yAxis.getDisplayRange({minPrice:y,maxPrice:b}),S=x.minPrice,C=x.maxPrice-S||1,w=a.height-(0-S)/C*a.height;r?.setSharedState(n,{valueMin:y,valueMax:b,timestamp:Date.now()},`volume_${t}`);for(let e=m;e<h;e++){let t=p[e];if(!t)continue;let n=t.volume;if(!n)continue;let r=f[e-m];if(r===void 0)continue;let o=f[e-m+1],s=f[e-m-1],c=Math.max(1,Math.round((l+u)*d)),h=o===void 0?s===void 0?c:Math.max(1,Math.round((r-s)*d)):Math.max(1,Math.round((o-r)*d)),g=Math.max(1,h-1)/d;bs(i,Math.round((r+(l-g)/2)*d)/d,xs(t),n,g,S,C,w,a.height,d)}i.restore()}}}function bs(e,t,n,r,i,a,o,s,c,l){let u=c-(r-a)/o*c,d=Math.round(u*l)/l,f=Math.round(s*l)/l,p=1/l,m=f-d,h=m<=0?p:Math.max(m,p),g=m<=0?f-p:f-h;e.fillStyle=n,e.fillRect(t,g,i,h)}function xs(e){return e.close>e.open?ya.UP:e.close<e.open?ya.DOWN:ya.NEUTRAL}function Z(e,t){return Math.round(e*t)/t}function Q(e,t){return(Math.floor(e*t)+.5)/t}function Ss(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 Cs(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 ws(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 Ts(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 Es(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=Ts(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 Ds(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 Os(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=Ds(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=va.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`,va.UPPER),t.showMiddle&&h(`middle`,va.MIDDLE),t.showLower&&h(`lower`,va.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 ks(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 js(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 Ms(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=Ea.FAST,h=Ea.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 Ns(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 Ps(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 Fs(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=Ns(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 Is(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 Ls(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,crosshairIndex:a}=e,o=r;if(!o.length)return;n.save(),n.font=`12px Arial`,n.textAlign=`left`;let s=a??Math.min(i.end-1,o.length-1),c=[],l=t.indicators.MA;l?.enabled&&c.push({draw:e=>{let r=[],i=l.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:Is(o,s,e)})}):r.push({label:`MA5`,color:Y.MA5,value:Is(o,s,5)},{label:`MA10`,color:Y.MA10,value:Is(o,s,10)},{label:`MA20`,color:Y.MA20,value:Is(o,s,20)},{label:`MA30`,color:Y.MA30,value:Is(o,s,30)},{label:`MA60`,color:Y.MA60,value:Is(o,s,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 u=t.indicators.BOLL;u?.enabled&&c.push({draw:e=>{let r=u.params.period??20,i=u.params.multiplier??2,a=ks(o,s,r,i),c=12,l=t.yPaddingPx/2+12+e*18;n.fillStyle=J.NEUTRAL,n.fillText(`BOLL(${r},${i})`,c,l),c+=n.measureText(`BOLL(${r},${i})`).width+10,a&&(n.fillStyle=va.UPPER,n.fillText(`上轨:${a.upper.toFixed(2)}`,c,l),c+=n.measureText(`上轨:${a.upper.toFixed(2)}`).width+10,n.fillStyle=va.MIDDLE,n.fillText(`中轨:${a.middle.toFixed(2)}`,c,l),c+=n.measureText(`中轨:${a.middle.toFixed(2)}`).width+10,n.fillStyle=va.LOWER,n.fillText(`下轨:${a.lower.toFixed(2)}`,c,l))}});let d=t.indicators.EXPMA;d?.enabled&&c.push({draw:e=>{let r=d.params.fastPeriod??12,i=d.params.slowPeriod??50,a=js(o,s,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,a&&(n.fillStyle=Ea.FAST,n.fillText(`快:${a.fast.toFixed(2)}`,c,l),c+=n.measureText(`快:${a.fast.toFixed(2)}`).width+10,n.fillStyle=Ea.SLOW,n.fillText(`慢:${a.slow.toFixed(2)}`,c,l))}});let f=t.indicators.ENE;f?.enabled&&c.push({draw:e=>{let r=f.params.period??10,i=f.params.deviation??11,a=Ps(o,s,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,a&&(n.fillStyle=Da.UPPER,n.fillText(`上轨:${a.upper.toFixed(2)}`,c,l),c+=n.measureText(`上轨:${a.upper.toFixed(2)}`).width+10,n.fillStyle=Da.MIDDLE,n.fillText(`中轨:${a.middle.toFixed(2)}`,c,l),c+=n.measureText(`中轨:${a.middle.toFixed(2)}`).width+10,n.fillStyle=Da.LOWER,n.fillText(`下轨:${a.lower.toFixed(2)}`,c,l))}}),c.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 Rs(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 zs(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 Bs(e,t,n,r){let i=Array(e.length);if(e.length<n)return i;let a=Rs(e,t),o=Rs(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=zs(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 Vs(e={}){let{paneId:t=`sub`,config:n={}}=e,r=vs(`macd`,t),i=null,a={fastPeriod:12,slowPeriod:26,signalPeriod:9,showDIF:!0,showDEA:!0,showBAR:!0,...n},o=null,s=0,c=0,l=0,u=[];function d(e){return(o!==e||s!==a.fastPeriod||c!==a.slowPeriod||l!==a.signalPeriod)&&(u=Bs(e,a.fastPeriod,a.slowPeriod,a.signalPeriod),o=e,s=a.fastPeriod,c=a.slowPeriod,l=a.signalPeriod),u}return{name:`macd_${t}`,version:`1.0.0`,description:`MACD 指标渲染器`,debugName:`MACD`,paneId:t,priority:q.INDICATOR,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:l,kWidth:u,kGap:f,dpr:p,kLinePositions:m}=e,h=s;if(h.length<a.slowPeriod)return;let g=d(h),_=-1/0,v=1/0;for(let e=c.start;e<c.end&&e<g.length;e++){let t=g[e];t&&(_=Math.max(_,t.dif,t.dea,t.macd),v=Math.min(v,t.dif,t.dea,t.macd))}if(!Number.isFinite(_)||!Number.isFinite(v))return;let y=Math.max(.05,(_-v)*.1),b=v-y,x=_+y;x-b;let S=c.end-1,C=S>=0&&S<g.length?g[S]:null,w={valueMin:b,valueMax:x,timestamp:Date.now(),latestValues:C?{dif:C.dif,dea:C.dea,macd:C.macd}:void 0};i?.setSharedState(r,w,`macd_${t}`);let T=o.yAxis.getDisplayRange({minPrice:b,maxPrice:x}),E=T.minPrice,D=T.maxPrice-E||1,O=o.height-(0-E)/D*o.height;n.save(),n.translate(-l,0);let k=Math.max(c.start,a.slowPeriod-1),A=Math.min(c.end,h.length);if(a.showBAR){let e=Math.round(O*p)/p,t=Math.max(1,Math.round((u+f)*p));for(let r=k;r<A;r++){let i=g[r];if(!i)continue;let a=m[r-c.start];if(a===void 0)continue;let s=m[r-c.start+1],l=m[r-c.start-1],d=s===void 0?l===void 0?t:Math.max(1,Math.round((a-l)*p)):Math.max(1,Math.round((s-a)*p)),f=Math.max(1,d-1)/p,h=Math.round((a+(u-f)/2)*p)/p,_=o.height-(i.macd-E)/D*o.height,v=i.macd>=0,y=r>0?g[r-1]:null,b;b=y?i.macd>=y.macd:!0;let x;x=v?b?X.BAR_UP:X.BAR_UP_LIGHT:b?X.BAR_DOWN_LIGHT:X.BAR_DOWN,n.fillStyle=x;let S=Math.round(_*p)/p,C=1/p;if(v){let t=e-S,r=t<=0?C:Math.max(t,C),i=t<=0?e-C:e-r;n.fillRect(h,i,f,r)}else{let t=S-e,r=t<=0?C:Math.max(t,C);n.fillRect(h,e,f,r)}}}if(a.showDIF){n.strokeStyle=X.DIF,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=k;t<A;t++){let r=g[t];if(!r)continue;let i=m[t-c.start];if(i===void 0)continue;let a=i+u/2,s=o.height-(r.dif-E)/D*o.height,l=Q(a,p),d=Q(s,p);e?(n.moveTo(l,d),e=!1):n.lineTo(l,d)}n.stroke()}if(a.showDEA){n.strokeStyle=X.DEA,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=k;t<A;t++){let r=g[t];if(!r)continue;let i=m[t-c.start];if(i===void 0)continue;let a=i+u/2,s=o.height-(r.dea-E)/D*o.height,l=Q(a,p),d=Q(s,p);e?(n.moveTo(l,d),e=!1):n.lineTo(l,d)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`fastPeriod`in e&&e.fastPeriod!==a.fastPeriod&&(o=null),`slowPeriod`in e&&e.slowPeriod!==a.slowPeriod&&(o=null),`signalPeriod`in e&&e.signalPeriod!==a.signalPeriod&&(o=null),Object.assign(a,e)}}}function Hs(e,t,n=12,r=26,i=9){return t<r||t>=e.length?null:Bs(e,n,r,i)[t]??null}function Us(e,t,n=12,r=26,i=9){let a=Hs(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 Ws(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 Gs(e={}){let{paneId:t=`sub`,config:n={}}=e,r=vs(`rsi`,t),i=null,a={period1:6,period2:12,period3:24,showRSI1:!0,showRSI2:!0,showRSI3:!0,...n},o=null,s=0,c=0,l=0,u=[],d=[],f=[];function p(e){return(o!==e||s!==a.period1||c!==a.period2||l!==a.period3)&&(u=Ws(e,a.period1),d=Ws(e,a.period2),f=Ws(e,a.period3),o=e,s=a.period1,c=a.period2,l=a.period3),{rsi1:u,rsi2:d,rsi3:f}}return{name:`rsi_${t}`,version:`1.0.0`,description:`RSI 相对强弱指标渲染器`,debugName:`RSI`,paneId:t,priority:q.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:l,kWidth:u,dpr:d,kLinePositions:f}=e,m=s;if(m.length<a.period1+1)return;let{rsi1:h,rsi2:g,rsi3:_}=p(m),v={valueMin:0,valueMax:100,timestamp:Date.now()};i?.setSharedState(r,v,`rsi_${t}`);let y=o.yAxis.getDisplayRange({minPrice:0,maxPrice:100}),b=y.minPrice,x=y.maxPrice-b||1;n.save(),n.translate(-l,0);let S=o.height-(80-b)/x*o.height,C=o.height-(50-b)/x*o.height,w=o.height-(20-b)/x*o.height,T=l,E=l+e.paneWidth;n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(T,S),n.lineTo(E,S),n.moveTo(T,C),n.lineTo(E,C),n.moveTo(T,w),n.lineTo(E,w),n.stroke(),n.setLineDash([]);let D=Math.max(c.start,a.period1),O=Math.min(c.end,m.length),k=(e,t)=>{n.strokeStyle=t,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let r=!0;for(let t=D;t<O;t++){let i=e[t];if(i===void 0)continue;let a=f[t-c.start];if(a===void 0)continue;let s=a+u/2,l=o.height-(i-b)/x*o.height,p=Q(s,d),m=Q(l,d);r?(n.moveTo(p,m),r=!1):n.lineTo(p,m)}n.stroke()};a.showRSI1&&k(h,ba.RSI1),a.showRSI2&&k(g,ba.RSI2),a.showRSI3&&k(_,ba.RSI3),n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period1`in e&&e.period1!==a.period1&&(o=null),`period2`in e&&e.period2!==a.period2&&(o=null),`period3`in e&&e.period3!==a.period3&&(o=null),Object.assign(a,e)}}}function Ks(e,t,n=6,r=12,i=24){if(t<n+1||t>=e.length)return null;let a=Ws(e,n)[t],o=Ws(e,r)[t],s=Ws(e,i)[t],c=[];return a!==void 0&&c.push({label:`RSI${n}`,value:a,color:ba.RSI1}),o!==void 0&&c.push({label:`RSI${r}`,value:o,color:ba.RSI2}),s!==void 0&&c.push({label:`RSI${i}`,value:s,color:ba.RSI3}),c.length===0?null:{name:`RSI`,params:[n,r,i],values:c}}function qs(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 Js(e={}){let{paneId:t=`sub`,config:n={}}=e,r=vs(`cci`,t),i=null,a={period:14,showCCI:!0,...n},o=null,s=0,c=[];function l(e){return(o!==e||s!==a.period)&&(c=qs(e,a.period),o=e,s=a.period),c}return{name:`cci_${t}`,version:`1.0.0`,description:`CCI 顺势指标渲染器`,debugName:`CCI`,paneId:t,priority:q.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.period)return;let h=l(m),g=-1/0,_=1/0;for(let e=c.start;e<c.end&&e<h.length;e++){let t=h[e];t!==void 0&&(g=Math.max(g,t),_=Math.min(_,t))}if(!Number.isFinite(g)||!Number.isFinite(_))return;g=Math.max(g,150),_=Math.min(_,-150),g-_;let v={valueMin:_,valueMax:g,timestamp:Date.now()};i?.setSharedState(r,v,`cci_${t}`);let y=o.yAxis.getDisplayRange({minPrice:_,maxPrice:g}),b=y.minPrice,x=y.maxPrice-b||1,S=o.height-(0-b)/x*o.height;n.save(),n.translate(-u,0);let C=o.height-(100-b)/x*o.height,w=o.height-(-100-b)/x*o.height,T=u,E=u+e.paneWidth;n.strokeStyle=xa.OVERBOUGHT,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(T,C),n.lineTo(E,C),n.stroke(),n.strokeStyle=xa.OVERSOLD,n.beginPath(),n.moveTo(T,w),n.lineTo(E,w),n.stroke(),n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.beginPath(),n.moveTo(T,S),n.lineTo(E,S),n.stroke(),n.setLineDash([]);let D=Math.max(c.start,a.period-1),O=Math.min(c.end,m.length);if(a.showCCI){n.strokeStyle=xa.CCI,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=D;t<O;t++){let r=h[t];if(r===void 0)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r-b)/x*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period`in e&&e.period!==a.period&&(o=null),Object.assign(a,e)}}}function Ys(e,t,n){return qs(e,n)[t]}function Xs(e,t,n=14){if(t<n||t>=e.length)return null;let r=Ys(e,t,n);return r===void 0?null:{name:`CCI`,params:[n],values:[{label:`CCI`,value:r,color:xa.CCI}]}}function Zs(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 Qs(e={}){let{paneId:t=`sub`,config:n={}}=e,r=vs(`stoch`,t),i=null,a={n:9,m:3,showK:!0,showD:!0,...n},o=null,s=0,c=0,l=[];function u(e){return(o!==e||s!==a.n||c!==a.m)&&(l=Zs(e,a.n,a.m),o=e,s=a.n,c=a.m),l}return{name:`stoch_${t}`,version:`1.0.0`,description:`STOCH 随机指标渲染器`,debugName:`STOCH`,paneId:t,priority:q.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:l,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.n+a.m-1)return;let h=u(m),g={valueMin:0,valueMax:100,timestamp:Date.now()};i?.setSharedState(r,g,`stoch_${t}`);let _=o.yAxis.getDisplayRange({minPrice:0,maxPrice:100}),v=_.minPrice,y=_.maxPrice-v||1;n.save(),n.translate(-l,0);let b=o.height-(80-v)/y*o.height,x=o.height-(20-v)/y*o.height,S=l,C=l+e.paneWidth;n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(S,b),n.lineTo(C,b),n.moveTo(S,x),n.lineTo(C,x),n.stroke(),n.setLineDash([]);let w=Math.max(c.start,a.n+a.m-2),T=Math.min(c.end,m.length);if(a.showK){n.strokeStyle=Sa.K,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=w;t<T;t++){let r=h[t];if(!r)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r.k-v)/y*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}if(a.showD){n.strokeStyle=Sa.D,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=w;t<T;t++){let r=h[t];if(!r)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r.d-v)/y*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`n`in e&&e.n!==a.n&&(o=null),`m`in e&&e.m!==a.m&&(o=null),Object.assign(a,e)}}}function $s(e,t,n,r){return Zs(e,n,r)[t]}function ec(e,t,n=9,r=3){if(t<n+r-1||t>=e.length)return null;let i=$s(e,t,n,r);return i?{name:`STOCH`,params:[n,r],values:[{label:`K`,value:i.k,color:Sa.K},{label:`D`,value:i.d,color:Sa.D}]}:null}function tc(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 nc(e={}){let{paneId:t=`sub`,config:n={}}=e,r=vs(`mom`,t),i=null,a={period:10,showMOM:!0,...n},o=null,s=0,c=[];function l(e){return(o!==e||s!==a.period)&&(c=tc(e,a.period),o=e,s=a.period),c}return{name:`mom_${t}`,version:`1.0.0`,description:`MOM 动量指标渲染器`,debugName:`MOM`,paneId:t,priority:q.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.period+1)return;let h=l(m),g=-1/0,_=1/0;for(let e=c.start;e<c.end&&e<h.length;e++){let t=h[e];t!==void 0&&(g=Math.max(g,t),_=Math.min(_,t))}if(!Number.isFinite(g)||!Number.isFinite(_))return;let v=Math.max(Math.abs(g),Math.abs(_))*.1;g+=v,_-=v,g-_;let y={valueMin:_,valueMax:g,timestamp:Date.now()};i?.setSharedState(r,y,`mom_${t}`);let b=o.yAxis.getDisplayRange({minPrice:_,maxPrice:g}),x=b.minPrice,S=b.maxPrice-x||1,C=o.height-(0-x)/S*o.height;n.save(),n.translate(-u,0);let w=u,T=u+e.paneWidth;n.strokeStyle=Ca.ZERO,n.lineWidth=1,n.beginPath(),n.moveTo(w,C),n.lineTo(T,C),n.stroke();let E=Math.max(c.start,a.period),D=Math.min(c.end,m.length);if(a.showMOM){n.strokeStyle=Ca.MOM,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=E;t<D;t++){let r=h[t];if(r===void 0)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r-x)/S*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period`in e&&e.period!==a.period&&(o=null),Object.assign(a,e)}}}function rc(e,t,n){return tc(e,n)[t]}function ic(e,t,n=10){if(t<n||t>=e.length)return null;let r=rc(e,t,n);return r===void 0?null:{name:`MOM`,params:[n],values:[{label:`MOM`,value:r,color:Ca.MOM}]}}function ac(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 oc(e={}){let{paneId:t=`sub`,config:n={}}=e,r=vs(`wmsr`,t),i=null,a={period:14,showWMSR:!0,...n},o=null,s=0,c=[];function l(e){return(o!==e||s!==a.period)&&(c=ac(e,a.period),o=e,s=a.period),c}return{name:`wmsr_${t}`,version:`1.0.0`,description:`WMSR 威廉指标渲染器`,debugName:`WMSR`,paneId:t,priority:q.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.period)return;let h=l(m),g=-100;0-g;let _={valueMin:g,valueMax:0,timestamp:Date.now()};i?.setSharedState(r,_,`wmsr_${t}`);let v=o.yAxis.getDisplayRange({minPrice:g,maxPrice:0}),y=v.minPrice,b=v.maxPrice-y||1;n.save(),n.translate(-u,0);let x=o.height-(-20-y)/b*o.height,S=o.height-(-80-y)/b*o.height,C=o.height-(-50-y)/b*o.height,w=u,T=u+e.paneWidth;n.strokeStyle=wa.OVERBOUGHT,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(w,x),n.lineTo(T,x),n.stroke(),n.strokeStyle=wa.OVERSOLD,n.beginPath(),n.moveTo(w,S),n.lineTo(T,S),n.stroke(),n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.beginPath(),n.moveTo(w,C),n.lineTo(T,C),n.stroke(),n.setLineDash([]);let E=Math.max(c.start,a.period-1),D=Math.min(c.end,m.length);if(a.showWMSR){n.strokeStyle=wa.WMSR,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=E;t<D;t++){let r=h[t];if(r===void 0)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r-y)/b*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period`in e&&e.period!==a.period&&(o=null),Object.assign(a,e)}}}function sc(e,t,n){return ac(e,n)[t]}function cc(e,t,n=14){if(t<n||t>=e.length)return null;let r=sc(e,t,n);return r===void 0?null:{name:`WMSR`,params:[n],values:[{label:`WMSR`,value:r,color:wa.WMSR}]}}function lc(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 uc(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 dc(e,t,n,r,i,a){let o=Array(e.length),s=lc(e,t),c=lc(e,n),l=lc(e,r),u=lc(e,i),d=uc(s,10),f=uc(c,10),p=uc(l,10),m=uc(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=uc(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 fc(e={}){let{paneId:t=`sub`,config:n={}}=e,r=vs(`kst`,t),i=null,a={roc1:10,roc2:15,roc3:20,roc4:30,signalPeriod:9,showKST:!0,showSignal:!0,...n},o=null,s=``,c=[];function l(e){let t=`${a.roc1}-${a.roc2}-${a.roc3}-${a.roc4}-${a.signalPeriod}`;return(o!==e||s!==t)&&(c=dc(e,a.roc1,a.roc2,a.roc3,a.roc4,a.signalPeriod),o=e,s=t),c}return{name:`kst_${t}`,version:`1.0.0`,description:`KST 确知指标渲染器`,debugName:`KST`,paneId:t,priority:q.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.roc4+15+a.signalPeriod)return;let h=l(m),g=-1/0,_=1/0;for(let e=c.start;e<c.end&&e<h.length;e++){let t=h[e];t&&(g=Math.max(g,t.kst,t.signal),_=Math.min(_,t.kst,t.signal))}if(!Number.isFinite(g)||!Number.isFinite(_))return;let v=(g-_)*.1||1;g+=v,_-=v,g-_;let y={valueMin:_,valueMax:g,timestamp:Date.now()};i?.setSharedState(r,y,`kst_${t}`);let b=o.yAxis.getDisplayRange({minPrice:_,maxPrice:g}),x=b.minPrice,S=b.maxPrice-x||1,C=o.height-(0-x)/S*o.height;n.save(),n.translate(-u,0);let w=u,T=u+e.paneWidth;n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.lineWidth=1,n.beginPath(),n.moveTo(w,C),n.lineTo(T,C),n.stroke();let E=Math.max(c.start,a.roc4+15+a.signalPeriod-1),D=Math.min(c.end,m.length);if(a.showKST){n.strokeStyle=Ta.KST,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=E;t<D;t++){let r=h[t];if(!r)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r.kst-x)/S*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}if(a.showSignal){n.strokeStyle=Ta.SIGNAL,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=E;t<D;t++){let r=h[t];if(!r)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r.signal-x)/S*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){o=null,Object.assign(a,e)}}}function pc(e,t,n,r,i,a,o){return dc(e,n,r,i,a,o)[t]}function mc(e,t,n=10,r=15,i=20,a=30,o=9){if(t<a+15+o||t>=e.length)return null;let s=pc(e,t,n,r,i,a,o);return s?{name:`KST`,params:[n,r,i,a,o],values:[{label:`KST`,value:s.kst,color:Ta.KST},{label:`Signal`,value:s.signal,color:Ta.SIGNAL}]}:null}function hc(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 gc(e={}){let{paneId:t=`sub`,config:n={}}=e,r=vs(`fastk`,t),i=null,a={period:9,showFASTK:!0,...n},o=null,s=0,c=[];function l(e){return(o!==e||s!==a.period)&&(c=hc(e,a.period),o=e,s=a.period),c}return{name:`fastk_${t}`,version:`1.0.0`,description:`FASTK 快速随机指标渲染器`,debugName:`FASTK`,paneId:t,priority:q.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.period)return;let h=l(m),g={valueMin:0,valueMax:100,timestamp:Date.now()};i?.setSharedState(r,g,`fastk_${t}`);let _=o.yAxis.getDisplayRange({minPrice:0,maxPrice:100}),v=_.minPrice,y=_.maxPrice-v||1;n.save(),n.translate(-u,0);let b=o.height-(80-v)/y*o.height,x=o.height-(20-v)/y*o.height,S=u,C=u+e.paneWidth;n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(S,b),n.lineTo(C,b),n.moveTo(S,x),n.lineTo(C,x),n.stroke(),n.setLineDash([]);let w=Math.max(c.start,a.period-1),T=Math.min(c.end,m.length);if(a.showFASTK){n.strokeStyle=Sa.K,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=w;t<T;t++){let r=h[t];if(r===void 0)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r-v)/y*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period`in e&&e.period!==a.period&&(o=null),Object.assign(a,e)}}}function _c(e,t,n){return hc(e,n)[t]}function vc(e,t,n=9){if(t<n||t>=e.length)return null;let r=_c(e,t,n);return r===void 0?null:{name:`FASTK`,params:[n],values:[{label:`FASTK`,value:r,color:Sa.K}]}}function yc(e){let{indicatorId:t,paneId:n}=e;switch(t){case`VOLUME`:return ys({paneId:n});case`MACD`:return Vs({paneId:n});case`RSI`:return Gs({paneId:n});case`CCI`:return Js({paneId:n});case`STOCH`:return Qs({paneId:n});case`MOM`:return nc({paneId:n});case`WMSR`:return oc({paneId:n});case`KST`:return fc({paneId:n});case`FASTK`:return gc({paneId:n});default:throw Error(`Unknown indicator: ${t}`)}}var bc=8,xc=6,Sc=class e{chart;activeTool=`cursor`;pendingAnchor=null;drawings=[];callbacks={};previewDrawingId=`__preview__`;dragState=null;selectedDrawingId=null;static SINGLE_ANCHOR_TOOLS=[`h-line`,`h-ray`,`v-line`,`crosshair-line`];static DOUBLE_ANCHOR_TOOLS=[`trend-line`,`ray`,`info-line`];constructor(e){this.chart=e}setCallbacks(e){this.callbacks=e}getActiveTool(){return this.activeTool}setTool(e){this.activeTool=e,this.pendingAnchor=null,this.removePreview(),this.dragState=null,this.setSelected(null),this.callbacks.onToolChange?.(e)}getDrawings(){return this.drawings}setDrawings(e){this.drawings=e,this.chart.setDrawings(e)}clear(){this.pendingAnchor=null,this.removePreview(),this.dragState=null,this.setSelected(null)}getSelectedDrawing(){return this.selectedDrawingId?this.drawings.find(e=>e.id===this.selectedDrawingId)??null:null}updateDrawingStyle(e,t){this.drawings=this.drawings.map(n=>n.id===e?{...n,style:{...n.style,...t}}:n),this.chart.setDrawings(this.drawings)}removeDrawing(e){this.drawings=this.drawings.filter(t=>t.id!==e),this.selectedDrawingId===e&&this.setSelected(null),this.chart.setDrawings(this.drawings)}onPointerMove(e,t){return this.dragState?this.handleDragMove(e,t):this.activeTool===`cursor`?!1:this.handlePreviewMove(e,t)}onPointerDown(t,n){if(this.activeTool===`cursor`)return this.handleCursorDown(t,n);let r=this.resolveAnchorFromPointer(t,n);return r?e.SINGLE_ANCHOR_TOOLS.includes(this.activeTool)?(this.createSingleAnchorDrawing(r),!0):e.DOUBLE_ANCHOR_TOOLS.includes(this.activeTool)?this.pendingAnchor?(this.createDoubleAnchorDrawing(this.pendingAnchor,r),this.pendingAnchor=null,!0):(this.pendingAnchor=r,!0):!1:!1}onPointerUp(e,t){return this.dragState?(this.dragState=null,!0):!1}handleCursorDown(e,t){let n=t.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top,a=this.hitTest(r,i);return a?(this.setSelected(a.drawing),this.dragState={drawingId:a.drawing.id,anchorIndex:`anchorIndex`in a?a.anchorIndex:void 0,snapshot:a.drawing.anchors.map(e=>({...e})),startMouse:{x:r,y:i}},!0):(this.setSelected(null),!1)}handleDragMove(e,t){if(!this.dragState)return!1;let n=this.drawings.find(e=>e.id===this.dragState.drawingId);if(!n)return this.dragState=null,!1;let r=this.resolveAnchorFromPointer(e,t);if(this.dragState.anchorIndex!==void 0){if(r){let e=this.dragState.anchorIndex;n.anchors[e]={...n.anchors[e],time:r.time,price:r.price}}}else{let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top,o=i-this.dragState.startMouse.x,s=a-this.dragState.startMouse.y;for(let e=0;e<n.anchors.length;e++){let r=this.dragState.snapshot[e],i=this.anchorToScreen(r);if(!i)continue;let a=i.x+o,c=i.y+s,l=this.screenToAnchor(a,c,t);l&&(n.anchors[e]={...n.anchors[e],time:l.time,price:l.price})}}return this.chart.setDrawings([...this.drawings]),!0}handlePreviewMove(t,n){let r=this.resolveAnchorFromPointer(t,n);if(!r)return!1;let i=e.SINGLE_ANCHOR_TOOLS.includes(this.activeTool),a=e.DOUBLE_ANCHOR_TOOLS.includes(this.activeTool);if(!i&&!a)return!1;let o;if(i)o={id:this.previewDrawingId,kind:this.getDrawingKind(this.activeTool),paneId:`main`,visible:!0,anchors:[{id:`${this.previewDrawingId}-a`,time:r.time,price:r.price}],params:{},style:{stroke:`#2962ff`,strokeWidth:1,strokeStyle:`dashed`}};else if(this.pendingAnchor)o={id:this.previewDrawingId,kind:this.activeTool,paneId:`main`,visible:!0,anchors:[{id:`${this.previewDrawingId}-a`,time:this.pendingAnchor.time,price:this.pendingAnchor.price},{id:`${this.previewDrawingId}-b`,time:r.time,price:r.price}],params:{},style:{stroke:`#2962ff`,strokeWidth:1,strokeStyle:`dashed`}};else return!1;return this.drawings=this.drawings.filter(e=>e.id!==this.previewDrawingId),this.drawings=[...this.drawings,o],this.chart.setDrawings(this.drawings),!0}hitTest(e,t){let n=this.drawings.filter(e=>e.id!==this.previewDrawingId&&e.visible);for(let r of n)for(let n=0;n<r.anchors.length;n++){let i=this.anchorToScreen(r.anchors[n]);if(i&&Math.hypot(e-i.x,t-i.y)<=bc)return{drawing:r,anchorIndex:n}}for(let r of n){let n=this.getDrawingLineSegments(r);for(let i of n)if(Cc(e,t,i.a,i.b)<=xc)return{drawing:r}}return null}getDrawingLineSegments(e){let t=this.chart.getViewport();if(!t)return[];if(e.anchors.length===1){let n=this.anchorToScreen(e.anchors[0]);if(!n)return[];let r=this.chart.getPaneRenderers().find(e=>e.getPane().id===`main`)?.getPane();if(!r)return[];let i=t.plotWidth,a=r.height;switch(e.kind){case`horizontal-line`:return[{a:{x:0,y:n.y},b:{x:i,y:n.y}}];case`horizontal-ray`:return[{a:n,b:{x:i,y:n.y}}];case`vertical-line`:return[{a:{x:n.x,y:0},b:{x:n.x,y:a}}];case`cross-line`:return[{a:{x:0,y:n.y},b:{x:i,y:n.y}},{a:{x:n.x,y:0},b:{x:n.x,y:a}}];default:return[]}}let n=e.anchors.map(e=>this.anchorToScreen(e)).filter(Boolean);if(n.length<2)return[];let r=[];if(n.length===2){let i=n[0],a=n[1],o=a.x-i.x,s=a.y-i.y,c=i,l=a,u=this.getExtendMode(e),d=Math.max(t.plotWidth,t.plotHeight)*4;(u===`right`||u===`both`)&&(l={x:a.x+o*d,y:a.y+s*d}),(u===`left`||u===`both`)&&(c={x:i.x-o*d,y:i.y-s*d}),r.push({a:c,b:l})}else for(let e=0;e<n.length-1;e++)r.push({a:n[e],b:n[e+1]});return r}getExtendMode(e){switch(e.kind){case`ray`:return`right`;case`extended-line`:return`both`;default:return`none`}}anchorToScreen(e){let t=this.chart.getData(),n=this.chart.getViewport();if(!n||t.length===0)return null;let r=this.chart.getOption(),i=this.chart.getCurrentDpr(),{startXPx:a,unitPx:o}=as(r.kWidth,r.kGap,i),s=typeof e.time==`string`?Number(e.time):e.time,c=t.findIndex(e=>e.timestamp===s);if(c<0)return null;let l=(a+c*o+(o-1)/2)/i-n.scrollLeft,u=this.chart.getPaneRenderers().find(e=>e.getPane().id===`main`)?.getPane();return u?{x:l,y:u.yAxis.priceToY(e.price)}:null}screenToAnchor(e,t,n){let r=this.chart.getData();if(!this.chart.getViewport()||r.length===0)return null;let i=this.chart.getDataIndexAtX(e);if(i===null)return null;let a=r[i];if(!a)return null;let o=this.chart.getPaneRenderers().find(e=>e.getPane().id===`main`)?.getPane();return o?{time:a.timestamp,price:o.yAxis.yToPrice(t-o.top)}:null}setSelected(e){let t=e?.id??null;this.selectedDrawingId!==t&&(this.selectedDrawingId=t,this.chart.setSelectedDrawingId(t),this.callbacks.onDrawingSelected?.(e))}removePreview(){this.drawings.some(e=>e.id===this.previewDrawingId)&&(this.drawings=this.drawings.filter(e=>e.id!==this.previewDrawingId),this.chart.setDrawings(this.drawings))}resolveAnchorFromPointer(e,t){let n=this.chart.getData(),r=this.chart.getViewport();if(!r||n.length===0)return null;let i=t.getBoundingClientRect(),a=e.clientX-i.left,o=e.clientY-i.top;if(a<0||o<0||a>r.plotWidth||o>r.plotHeight)return null;let s=this.chart.getPaneRenderers().find(e=>{let t=e.getPane();return t.id===`main`&&o>=t.top&&o<=t.top+t.height})?.getPane();if(!s)return null;let c=this.chart.getDataIndexAtX(a);if(c===null)return null;let l=n[c];return l?{time:l.timestamp,price:s.yAxis.yToPrice(o-s.top)}:null}createSingleAnchorDrawing(e){this.drawings=this.drawings.filter(e=>e.id!==this.previewDrawingId);let t={id:`drawing-${Date.now()}`,kind:this.getDrawingKind(this.activeTool),paneId:`main`,visible:!0,anchors:[{id:`${Date.now()}-a`,time:e.time,price:e.price}],params:{},style:{stroke:`#2962ff`,strokeWidth:1,strokeStyle:`solid`}};this.drawings=[...this.drawings,t],this.chart.setDrawings(this.drawings),this.callbacks.onDrawingCreated?.(t),this.activeTool=`cursor`,this.callbacks.onToolChange?.(`cursor`)}createDoubleAnchorDrawing(e,t){this.drawings=this.drawings.filter(e=>e.id!==this.previewDrawingId);let n={id:`drawing-${Date.now()}`,kind:this.activeTool,paneId:`main`,visible:!0,anchors:[{id:`${Date.now()}-a`,time:e.time,price:e.price},{id:`${Date.now()}-b`,time:t.time,price:t.price}],params:{},style:{stroke:`#2962ff`,strokeWidth:1,strokeStyle:`solid`}};this.drawings=[...this.drawings,n],this.chart.setDrawings(this.drawings),this.callbacks.onDrawingCreated?.(n),this.activeTool=`cursor`,this.callbacks.onToolChange?.(`cursor`)}getDrawingKind(e){switch(e){case`cursor`:throw Error(`cursor is not a drawing kind`);case`h-line`:return`horizontal-line`;case`h-ray`:return`horizontal-ray`;case`v-line`:return`vertical-line`;case`crosshair-line`:return`cross-line`;default:return e}}};function Cc(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=i*i+a*a;if(o===0)return Math.hypot(e-n.x,t-n.y);let s=((e-n.x)*i+(t-n.y)*a)/o;return s=Math.max(0,Math.min(1,s)),Math.hypot(e-(n.x+s*i),t-(n.y+s*a))}var wc=class{drawings=[];selectedId=null;getSelectedId(){return this.selectedId}setSelectedId(e){this.selectedId=e}getAll(){return this.drawings}getVisibleByPane(e){return this.drawings.filter(t=>t.visible&&t.paneId===e).sort((e,t)=>(e.zIndex??0)-(t.zIndex??0))}setAll(e){this.drawings=[...e],this.selectedId&&!this.drawings.some(e=>e.id===this.selectedId)&&(this.selectedId=null)}upsert(e){let t=this.drawings.findIndex(t=>t.id===e.id);if(t>=0){this.drawings[t]=e;return}this.drawings.push(e)}remove(e){this.drawings=this.drawings.filter(t=>t.id!==e)}clear(){this.drawings=[],this.selectedId=null}},Tc=class{definitions=new Map;register(e){this.definitions.set(e.kind,e)}get(e){return this.definitions.get(e)}compute(e,t){let n=this.get(e.kind);return n?n.compute(e,t):null}};function Ec(e,t){if(e.strokeStyle=t?.stroke??`#2962ff`,e.lineWidth=t?.strokeWidth??1,t?.strokeStyle===`dashed`){e.setLineDash([6,4]);return}if(t?.strokeStyle===`dotted`){e.setLineDash([2,3]);return}e.setLineDash([])}function Dc(e,t){e.fillStyle=t?.fill??t?.stroke??`#2962ff`,e.globalAlpha=t?.fillOpacity??1}function Oc(e,t,n,r,i){let a=(e,t)=>{let n=0;return e<i.left?n|=1:e>i.right&&(n|=2),t<i.top?n|=8:t>i.bottom&&(n|=4),n},o=e,s=t,c=n,l=r;for(;;){let e=a(o,s),t=a(c,l);if(!(e|t))return{a:{x:o,y:s},b:{x:c,y:l}};if(e&t)return null;let n=e||t,r=0,u=0;n&8?(r=o+(c-o)*(i.top-s)/(l-s),u=i.top):n&4?(r=o+(c-o)*(i.bottom-s)/(l-s),u=i.bottom):n&2?(u=s+(l-s)*(i.right-o)/(c-o),r=i.right):(u=s+(l-s)*(i.left-o)/(c-o),r=i.left),n===e?(o=r,s=u):(c=r,l=u)}}function kc(e,t){let{a:n,b:r,extend:i=`none`}=e;if(i===`none`)return Oc(n.x,n.y,r.x,r.y,t);let a=r.x-n.x,o=r.y-n.y;if(a===0&&o===0)return null;let s=Math.max(t.right-t.left,t.bottom-t.top)*4,c=n,l=r;return(i===`left`||i===`both`)&&(c={x:n.x-a*s,y:n.y-o*s}),(i===`right`||i===`both`)&&(l={x:r.x+a*s,y:r.y+o*s}),Oc(c.x,c.y,l.x,l.y,t)}function Ac(e,t){let n=typeof e.time==`string`?Number(e.time):e.time;return Number.isFinite(n)?t.findIndex(e=>e.timestamp===n):-1}function jc(e,t=2){if(!Number.isFinite(e))return`0`;let n=e.toFixed(t);return e>0?`+${n}`:n}function Mc(e){let t=e.length;if(t<2)return null;let n=0,r=0,i=0,a=0;for(let o=0;o<t;o++){let t=o,s=e[o];n+=t,r+=s,i+=t*s,a+=t*t}let o=t*a-n*n;if(o===0)return null;let s=(t*i-n*r)/o,c=(r-s*n)/t,l=0;for(let n=0;n<t;n++){let t=c+s*n,r=e[n]-t;l+=r*r}return{slope:s,intercept:c,stdDev:Math.sqrt(l/t)}}function Nc(){return{point(e,t,n){let r=t.style?.pointRadius??4;e.save(),e.fillStyle=t.style?.fill??t.style?.stroke??`#2962ff`,e.beginPath(),e.arc(t.point.x,t.point.y,Math.max(r,1/n),0,Math.PI*2),e.fill(),e.restore()},line(e,t,n,r){let i=kc(t,n);if(!i)return;e.save(),Ec(e,t.style);let a=(t.style?.strokeWidth??1)<=1?.5/r:0;if(e.beginPath(),e.moveTo(i.a.x+a,i.a.y+a),e.lineTo(i.b.x+a,i.b.y+a),e.stroke(),t.showEndpoints!==!1){let n=t.style?.pointRadius??4;e.fillStyle=t.style?.stroke??`#2962ff`,e.beginPath(),e.arc(t.a.x,t.a.y,Math.max(n,1/r),0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t.b.x,t.b.y,Math.max(n,1/r),0,Math.PI*2),e.fill()}e.restore()},area(e,t){if(t.points.length!==0){e.save(),Dc(e,t.style),e.beginPath(),e.moveTo(t.points[0].x,t.points[0].y);for(let n=1;n<t.points.length;n++){let r=t.points[n];e.lineTo(r.x,r.y)}t.closed&&e.closePath(),e.fill(),e.restore()}},text(e,t){e.save(),e.fillStyle=t.style?.textColor??t.style?.stroke??`#2962ff`,e.font=`${t.style?.fontSize??12}px sans-serif`,e.textAlign=t.align??`left`,e.textBaseline=t.baseline??`bottom`,e.fillText(t.text,t.point.x,t.point.y),e.restore()}}}function Pc(e,t){return{kind:e,minAnchors:2,maxAnchors:2,compute(e,n){let[r,i]=e.anchors;return!r||!i?{primitives:[]}:{primitives:[{kind:`line`,a:n.toScreen(r),b:n.toScreen(i),extend:t,style:e.style}]}}}}function Fc(e){return{kind:e,minAnchors:1,maxAnchors:1,compute(t,n){let[r]=t.anchors;if(!r)return{primitives:[]};let i=n.toScreen(r),a=n.pane.height,o=n.viewport.plotWidth;return e===`horizontal-line`?{primitives:[{kind:`line`,a:{x:0,y:i.y},b:{x:o,y:i.y},showEndpoints:!1,style:t.style},{kind:`point`,point:i,style:t.style}]}:e===`horizontal-ray`?{primitives:[{kind:`line`,a:i,b:{x:o,y:i.y},showEndpoints:!1,style:t.style},{kind:`point`,point:i,style:t.style}]}:e===`vertical-line`?{primitives:[{kind:`line`,a:{x:i.x,y:0},b:{x:i.x,y:a},showEndpoints:!1,style:t.style},{kind:`point`,point:i,style:t.style}]}:{primitives:[{kind:`line`,a:{x:0,y:i.y},b:{x:o,y:i.y},showEndpoints:!1,style:t.style},{kind:`line`,a:{x:i.x,y:0},b:{x:i.x,y:a},showEndpoints:!1,style:t.style},{kind:`point`,point:i,style:t.style}]}}}}function Ic(){return{kind:`info-line`,minAnchors:2,maxAnchors:2,compute(e,t){let[n,r]=e.anchors;if(!n||!r)return{primitives:[]};let i=t.toScreen(n),a=t.toScreen(r),o=Ac(n,t.seriesData),s=Ac(r,t.seriesData),c=o>=0&&s>=0?s-o:0,l=r.price-n.price,u=n.price===0?0:l/n.price*100,d=Math.atan2(a.y-i.y,a.x-i.x)*(180/Math.PI),f=`${jc(l)} (${jc(u)}%) ${c} bars ${jc(d)}°`;return{primitives:[{kind:`line`,a:i,b:a,style:e.style},{kind:`text`,point:{x:(i.x+a.x)/2+8,y:Math.min(i.y,a.y)-8},text:f,align:`left`,baseline:`bottom`,style:e.style}],meta:{delta:l,percent:u,bars:c,angle:d}}}}}function Lc(){return{kind:`parallel-channel`,minAnchors:3,maxAnchors:3,compute(e,t){let[n,r,i]=e.anchors;if(!n||!r||!i)return{primitives:[]};let a=t.toScreen(n),o=t.toScreen(r),s=t.toScreen(i),c=o.x-a.x,l=o.y-a.y,u={x:s.x+c,y:s.y+l},d=e.params?.extend??`none`;return{primitives:[{kind:`area`,points:[a,o,u,s],closed:!0,style:e.style},{kind:`line`,a,b:o,extend:d,style:e.style},{kind:`line`,a:s,b:u,extend:d,style:e.style},{kind:`line`,a,b:s,style:e.style},{kind:`line`,a:o,b:u,style:e.style}]}}}}function Rc(){return{kind:`regression-channel`,minAnchors:2,maxAnchors:2,compute(e,t){let[n,r]=e.anchors;if(!n||!r)return{primitives:[]};let i=Ac(n,t.seriesData),a=Ac(r,t.seriesData);if(i<0||a<0)return{primitives:[]};let o=Math.min(i,a),s=Math.max(i,a),c=t.seriesData.slice(o,s+1),l=Mc(c.map(e=>e.close));if(!l)return{primitives:[]};let u=e.params?.sigma??2,d=l.stdDev*u,f=l.intercept,p=l.intercept+l.slope*(c.length-1),m={id:`${e.id}-reg-start`,time:t.seriesData[o].timestamp,price:f},h={id:`${e.id}-reg-end`,time:t.seriesData[s].timestamp,price:p},g={...m,id:`${e.id}-reg-upper-start`,price:f+d},_={...h,id:`${e.id}-reg-upper-end`,price:p+d},v={...m,id:`${e.id}-reg-lower-start`,price:f-d},y={...h,id:`${e.id}-reg-lower-end`,price:p-d},b=t.toScreen(m),x=t.toScreen(h),S=t.toScreen(g),C=t.toScreen(_),w=t.toScreen(v),T=t.toScreen(y);return{primitives:[{kind:`area`,points:[S,C,T,w],closed:!0,style:e.style},{kind:`line`,a:b,b:x,style:e.style},{kind:`line`,a:S,b:C,style:e.style},{kind:`line`,a:w,b:T,style:e.style}],meta:{sigma:u,stdDev:l.stdDev,slope:l.slope}}}}}function zc(e){e.register(Pc(`trend-line`,`none`)),e.register(Pc(`ray`,`right`)),e.register(Pc(`extended-line`,`both`)),e.register(Fc(`horizontal-line`)),e.register(Fc(`horizontal-ray`)),e.register(Fc(`vertical-line`)),e.register(Fc(`cross-line`)),e.register(Ic()),e.register(Lc()),e.register(Rc())}function Bc(e,t){let n=typeof e.time==`string`?Number(e.time):e.time;return Number.isFinite(n)?t.findIndex(e=>e.timestamp===n):-1}function Vc(e){let t=e.store,n=e.definitions??new Tc,r=e.renderers??Nc();return zc(n),{name:`drawingRenderer`,version:`0.1.0`,description:`绘图渲染器`,debugName:`绘图层`,paneId:e.paneId??`main`,priority:q.OVERLAY,draw(e){let{ctx:i,pane:a,data:o,range:s,dpr:c,paneWidth:l,kLinePositions:u,kWidth:d,kGap:f}=e,p=e.viewport??{scrollLeft:e.scrollLeft,plotWidth:l,plotHeight:a.height},{startXPx:m,unitPx:h}=as(d,f,c),g=o,_=g.slice(s.start,s.end),v=t.getVisibleByPane(a.id);if(v.length===0)return;let y={left:0,top:0,right:p.plotWidth,bottom:a.height};i.save(),i.beginPath(),i.rect(0,0,p.plotWidth,a.height),i.clip();for(let e of v){let o=n.compute(e,{pane:a,visibleData:_,seriesData:g,range:s,kLinePositions:u,kWidth:d,kGap:f,dpr:c,paneWidth:l,viewport:p,toScreen(e){let t=Bc(e,g);return t<0?{x:-d,y:a.yAxis.priceToY(e.price)}:{x:(m+t*h+(h-1)/2)/c-p.scrollLeft,y:a.yAxis.priceToY(e.price)}}});if(!o)continue;let v=t.getSelectedId()===e.id?o.primitives.map(t=>Hc(t,e.style)):o.primitives;for(let e of v){if(e.kind===`point`){r.point(i,e,c);continue}if(e.kind===`line`){r.line(i,e,y,c);continue}if(e.kind===`area`){r.area(i,e,c);continue}r.text(i,e,c)}}i.restore()}}}function Hc(e,t){let n=t.stroke??`#2962ff`,r=(t.strokeWidth??1)+1,i=(t.pointRadius??4)+2;return e.kind===`point`?{...e,style:{...e.style,stroke:n,pointRadius:i}}:e.kind===`line`?{...e,style:{...e.style,stroke:n,strokeWidth:r}}:e.kind===`area`?{...e,style:{...e.style,stroke:n}}:{...e,style:{...e.style,textColor:n,fontSize:(e.style?.fontSize??12)+1}}}var Uc=class e{dom;opt;data=[];raf=null;viewport=null;paneRenderers=[];markerManager;drawingStore=new wc;interaction;pluginHost;rendererPluginManager;preciseDpr=0;resizeObserver;observedSize={width:0,height:0};paneRatios=new Map;onViewportChange;onPaneLayoutChange;currentZoomLevel=1;zoomLevelCount;constructor(e,t){this.dom=e;let{kWidth:n,kGap:r,...i}=t;this.opt={...i,kWidth:0,kGap:0},this.interaction=new ds(this),this.markerManager=new ro,this.pluginHost=Qi(),this.rendererPluginManager=new ea,this.rendererPluginManager.setPluginHost(this.pluginHost),this.rendererPluginManager.setInvalidateCallback(()=>this.scheduleDraw()),this.syncPaneRatiosFromSpecs(this.opt.panes),this.zoomLevelCount=Math.max(2,Math.round(this.opt.zoomLevels??20)),this.currentZoomLevel=this.opt.initialZoomLevel??1,this.currentZoomLevel=Math.max(1,Math.min(this.zoomLevelCount,this.currentZoomLevel));let a=this.getEffectiveDpr(),o=ms(this.currentZoomLevel,{minKWidth:this.opt.minKWidth,maxKWidth:this.opt.maxKWidth,zoomLevelCount:this.zoomLevelCount,dpr:a}),s=hs(a);this.opt.kWidth=o,this.opt.kGap=s,this.initPanes(),this.useRenderer(Vc({store:this.drawingStore})),this.initResizeObserver()}initResizeObserver(){if(typeof ResizeObserver>`u`)return;let e=this.dom.container;if(e){this.resizeObserver=new ResizeObserver(e=>{let t=e[0];if(!t)return;let n=this.observedSize.width,r=this.observedSize.height,i=this.preciseDpr;this.updateObservedMetrics(t);let a=this.observedSize.width!==n,o=this.observedSize.height!==r,s=this.preciseDpr!==i;(a||o||s)&&this.resize()});try{this.resizeObserver.observe(e,{box:`device-pixel-content-box`})}catch{this.resizeObserver.observe(e)}}}updateObservedMetrics(e){let t=Math.max(1,Math.round(e.contentRect.width)),n=Math.max(1,Math.round(e.contentRect.height));this.observedSize.width=t,this.observedSize.height=n;let r=e.devicePixelContentBoxSize?.[0],i=e.contentBoxSize?.[0];if(!r||!i||i.inlineSize<=0){this.preciseDpr=0;return}let a=r.inlineSize/i.inlineSize;this.preciseDpr=Math.round(a*64)/64}getEffectiveDpr(){let e=this.preciseDpr>0?this.preciseDpr:Math.round((window.devicePixelRatio||1)*64)/64;return e<1&&(e=1),e}getViewport(){return this.viewport}getCurrentDpr(){return this.getEffectiveDpr()}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}=os(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}=as(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`);if(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)),o){let t=o.canvas.width/e.dpr;o.setTransform(1,0,0,1,0,0),o.scale(e.dpr,e.dpr),o.clearRect(0,0,t,n.height+2/e.dpr)}let s={ctx:a,pane:Gi(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,crosshairIndex:this.interaction.getCrosshairIndex(),yAxisCtx:o??void 0,zoomLevel:this.currentZoomLevel,zoomLevelCount:this.zoomLevelCount,viewport:{scrollLeft:e.scrollLeft,plotWidth:e.plotWidth,plotHeight:e.plotHeight}};if(a){a.save();let e=this.rendererPluginManager.render(n.id,s);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`,role:`auxiliary`,capabilities:{showPriceAxisTicks:!1,showCrosshairPriceLabel:!1,candleHitTest:!1,supportsPriceTranslate:!1},top:0,height:this.opt.bottomAxisHeight,yAxis:{priceToY:()=>0,yToPrice:()=>0,getPaddingTop:()=>0,getPaddingBottom:()=>0,getPriceOffset:()=>0,getDisplayRange:e=>e??{maxPrice:0,minPrice: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,viewport:{scrollLeft:e.scrollLeft,plotWidth:e.plotWidth,plotHeight:e.plotHeight}},n=this.rendererPluginManager.renderPlugin(`timeAxis`,t);n.length>0&&this.pluginHost.events.emit(`renderer:error`,{paneId:`timeAxis`,errors:n})}}applyRenderState(e,t,n){this.opt={...this.opt,kWidth:e,kGap:t},n!==void 0&&(this.currentZoomLevel=n),this.scheduleDraw()}getZoomLevelCount(){return this.zoomLevelCount}setOnViewportChange(e){this.onViewportChange=e}setOnPaneLayoutChange(e){this.onPaneLayoutChange=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.getEffectiveDpr(),{unitPx:a,startXPx:o}=as(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){if(e.kWidth!==void 0&&(console.warn(`[Chart] kWidth cannot be set directly. Use applyRenderState() instead.`),delete e.kWidth),e.kGap!==void 0&&delete e.kGap,e.panes){let t=e.panes.map(e=>({...e}));this.opt={...this.opt,...e,panes:t},this.applyPaneLayoutSpecs(t);return}this.opt={...this.opt,...e},this.resize()}updatePaneLayout(e){this.applyPaneLayoutSpecs(e)}setPaneDefinitions(e){this.applyPaneLayoutSpecs(e)}upsertPane(e){let t=this.opt.panes.findIndex(t=>t.id===e.id);if(t===-1){this.applyPaneLayoutSpecs([...this.opt.panes,{...e}]);return}let n=[...this.opt.panes];n[t]={...n[t],...e},this.applyPaneLayoutSpecs(n)}removePaneDefinition(e){this.opt.panes.some(t=>t.id===e)&&(this.paneRatios.delete(e),this.applyPaneLayoutSpecs(this.opt.panes.filter(t=>t.id!==e)))}bindIndicatorToPane(e,t,n){this.opt.panes.some(t=>t.id===e)||this.upsertPane({id:e,ratio:1,visible:!0,role:`indicator`});let r=`${t.toLowerCase()}_${e}`;if(this.getRenderer(r)){n&&this.updateRendererConfig(r,n);return}let i=yc({indicatorId:t,paneId:e});this.useRenderer(i,n)}setDrawings(e){this.drawingStore.setAll(e),this.scheduleDraw()}setSelectedDrawingId(e){this.drawingStore.setSelectedId(e)}getPaneLayoutSpecs(){let e=this.opt.panes.filter(e=>e.visible!==!1).reduce((e,t)=>e+(this.paneRatios.get(t.id)??t.ratio??0),0),t=e>0?e:1;return this.opt.panes.map(e=>{let n=this.paneRatios.get(e.id)??e.ratio??0,r=e.visible===!1?n:n/t,i=this.paneRenderers.find(t=>t.getPane().id===e.id)?.getPane();return{...e,ratio:r,role:i?.role??e.role,capabilities:i?{...i.capabilities}:e.capabilities}})}emitPaneLayoutChange(){this.onPaneLayoutChange?.(this.getPaneLayoutSpecs())}applyPaneLayoutSpecs(e){this.opt.panes=e.map(e=>({...e})),this.syncPaneRatiosFromSpecs(this.opt.panes),this.initPanes(),this.layoutPanes(),this.emitPaneLayoutChange(),this.scheduleDraw()}resizePaneBoundary(e,t){if(!Number.isFinite(t)||t===0)return!1;let n=this.viewport;if(!n)return!1;let r=this.opt.panes.filter(e=>e.visible!==!1),i=r.findIndex(t=>t.id===e);if(i<0||i>=r.length-1)return!1;let a=r[i],o=r[i+1];if(!a||!o)return!1;let s=new Map;for(let e of r){let t=this.paneRenderers.find(t=>t.getPane().id===e.id);t&&s.set(e.id,t.getPane().height)}let c=t>0?i:i+1,l=t>0?i+1:i,u=t>0?1:-1,d=Math.abs(t),f=l;for(;d>0&&f>=0&&f<r.length;){let e=r[f];if(!e)break;let t=s.get(e.id)??0,i=this.getPaneMinHeight(e,n.plotHeight),a=Math.max(0,t-i);if(a>0){let n=Math.min(a,d);s.set(e.id,t-n),d-=n}d>0&&(f+=u)}if(d>0)return!1;let p=r[c];if(!p)return!1;let m=s.get(p.id)??0;s.set(p.id,m+Math.abs(t));let h=Math.max(0,this.opt.paneGap??0)*Math.max(0,r.length-1),g=Math.max(1,n.plotHeight-h);for(let e of r){let t=s.get(e.id)??0;this.paneRatios.set(e.id,t/g)}return this.normalizeVisiblePaneRatios(r),this.syncPaneRatiosToSpecs(),this.layoutPanes(),this.emitPaneLayoutChange(),this.scheduleDraw(),!0}resolvePaneRole(e,t){return e.role?e.role:t===0?`price`:`indicator`}addPane(e){if(this.opt.panes.some(t=>t.id===e)){console.warn(`Pane "${e}" already exists`);return}let t=this.opt.panes.some((e,t)=>this.resolvePaneRole(e,t)===`price`)?`indicator`:`price`;this.applyPaneLayoutSpecs([...this.opt.panes,{id:e,ratio:1,visible:!0,role:t}])}removePane(e){if(!this.opt.panes.some(t=>t.id===e))return;let t=this.opt.panes.filter(t=>t.id!==e);this.paneRatios.delete(e),this.applyPaneLayoutSpecs(t)}hasPane(e){return this.opt.panes.some(t=>t.id===e)}static SUB_PANE_PREFIX=`sub_`;createSubPane(t,n){let r=`${e.SUB_PANE_PREFIX}${t}`,i=`${t.toLowerCase()}_${r}`;if(this.getRenderer(i))return n&&this.updateRendererConfig(i,n),!0;let a=this.opt.panes.filter(e=>e.visible!==!1),o=a.filter((e,t)=>this.resolvePaneRole(e,t)===`price`),s=a.filter((e,t)=>this.resolvePaneRole(e,t)===`indicator`);if(o.length===1){let e=o[0];e&&this.paneRatios.set(e.id,3);for(let e of s)this.paneRatios.set(e.id,1);this.paneRatios.set(r,1)}else this.paneRatios.set(r,1);return this.upsertPane({id:r,ratio:this.paneRatios.get(r)??1,visible:!0,role:`indicator`}),this.bindIndicatorToPane(r,t,n),!0}removeSubPane(t){let n=`${e.SUB_PANE_PREFIX}${t}`;if(!this.hasPane(n))return;let r=`${t.toLowerCase()}_${n}`;this.removeRenderer(r),this.paneRatios.delete(n),this.applyPaneLayoutSpecs(this.opt.panes.filter(e=>e.id!==n))}clearSubPanes(){let t=this.opt.panes.map(e=>e.id).filter(t=>t.startsWith(e.SUB_PANE_PREFIX));if(t.length!==0){for(let n of t){let t=`${n.slice(e.SUB_PANE_PREFIX.length).toLowerCase()}_${n}`;this.removeRenderer(t),this.paneRatios.delete(n)}this.applyPaneLayoutSpecs(this.opt.panes.filter(t=>!t.id.startsWith(e.SUB_PANE_PREFIX)))}}getSubPaneIndicators(){return this.opt.panes.map(e=>e.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();if(!r.capabilities.supportsPriceTranslate)return;let i=r.yAxis.deltaYToPriceOffset(t),a=r.yAxis.getPriceOffset();r.yAxis.setPriceOffset(a+i),this.scheduleDraw()}scalePrice(e,t){let n=this.paneRenderers.find(t=>t.getPane().id===e);if(!n)return;let r=n.getPane();r.capabilities.supportsPriceTranslate&&(r.yAxis.scaleByDelta(t),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}getDataIndexAtX(e){let t=this.viewport;if(!t||this.data.length===0)return null;let n=this.getEffectiveDpr(),{startXPx:r,unitPx:i}=as(this.opt.kWidth,this.opt.kGap,n),a=Math.round((t.scrollLeft+e)*n),o=Math.floor((a-r)/i);return o<0||o>=this.data.length?null:o}getContentWidth(){let e=this.data?.length??0,t=this.getEffectiveDpr(),{startXPx:n,unitPx:r}=as(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.emitPaneLayoutChange(),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.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.preciseDpr=0,this.observedSize={width:0,height:0},this.viewport=null,this.paneRenderers.forEach(e=>e.destroy()),this.paneRenderers=[],this.rendererPluginManager.clear(),this.onViewportChange=void 0,this.onPaneLayoutChange=void 0,await this.pluginHost.destroy()}initPanes(){this.paneRenderers=this.opt.panes.map((e,t)=>{let n=new us(e.id,{role:this.resolvePaneRole(e,t),capabilities:e.capabilities}),r=document.createElement(`canvas`),i=document.createElement(`canvas`),a=n.role===`price`;return r.id=`${e.id}-plot`,r.className=a?`plot-canvas main`:`plot-canvas sub`,r.style.position=`absolute`,r.style.left=`0`,r.style.top=`0`,i.id=`${e.id}-yAxis`,i.className=`right-axis`,i.style.position=`absolute`,i.style.left=`0`,new fs({plotCanvas:r,yAxisCanvas:i},n,{rightAxisWidth:this.opt.rightAxisWidth,yPaddingPx:this.opt.yPaddingPx,priceLabelWidth:this.opt.priceLabelWidth})});let e=this.dom.canvasLayer,t=this.dom.rightAxisLayer;e&&e.querySelectorAll(`canvas:not(.x-axis-canvas)`).forEach(e=>e.remove()),t&&t.querySelectorAll(`canvas.right-axis`).forEach(e=>e.remove()),this.paneRenderers.forEach(n=>{let r=n.getDom();e.appendChild(r.plotCanvas),t.appendChild(r.yAxisCanvas)}),this.rendererPluginManager.setKnownPaneIds(this.paneRenderers.map(e=>e.getPane().id))}syncPaneRatiosFromSpecs(e){let t=new Map;for(let n of e){let e=this.paneRatios.get(n.id),r=Number.isFinite(n.ratio)?n.ratio:0,i=e===void 0?r>0?r:1:e;t.set(n.id,i)}this.paneRatios=t,this.normalizeVisiblePaneRatios(e),this.syncPaneRatiosToSpecs()}syncPaneRatiosToSpecs(){let e=this.opt.panes.filter(e=>e.visible!==!1).reduce((e,t)=>e+(this.paneRatios.get(t.id)??t.ratio??0),0),t=e>0?e:1;this.opt.panes=this.opt.panes.map(e=>{let n=this.paneRatios.get(e.id)??e.ratio??0;return e.visible===!1?{...e,ratio:n}:{...e,ratio:n/t}})}normalizeVisiblePaneRatios(e){let t=e.filter(e=>e.visible!==!1);if(t.length===0)return;let n=0;for(let e of t){let t=this.paneRatios.get(e.id)??e.ratio??0,r=Number.isFinite(t)&&t>0?t:0;this.paneRatios.set(e.id,r),n+=r}if(n<=0){let e=1/t.length;for(let n of t)this.paneRatios.set(n.id,e);return}for(let e of t){let t=this.paneRatios.get(e.id)??0;this.paneRatios.set(e.id,t/n)}}getPaneMinHeight(e,t){let n=this.opt.defaultPaneMinHeightPx??120,r=e.minHeightPx??n;return Math.max(1,Math.min(Math.round(r),Math.max(1,t)))}computePaneHeightsByRatio(e,t){if(e.length===0)return[];let n=e.map(e=>this.paneRatios.get(e.id)??e.ratio??0),r=n.reduce((e,t)=>e+(t>0?t:0),0),i=(r>0?n.map(e=>(e>0?e:0)/r):e.map(()=>1/e.length)).map(e=>Math.max(1,Math.round(t*e))),a=e.map(e=>this.getPaneMinHeight(e,t));for(let e=0;e<i.length;e++)i[e]=Math.max(i[e],Math.min(a[e],t));let o=i.reduce((e,t)=>e+t,0);if(o>t){let e=o-t;for(;e>0;){let n=!1;for(let r=i.length-1;r>=0&&e>0;r--){let o=Math.max(1,Math.min(a[r],t)),s=i[r];s>o&&(i[r]=s-1,e--,n=!0)}if(!n)break}}else o<t&&(i[i.length-1]=(i[i.length-1]??1)+(t-o));return o=i.reduce((e,t)=>e+t,0),o!==t&&i.length>0&&(i[i.length-1]=Math.max(1,(i[i.length-1]??1)+(t-o))),i}layoutPanes(){let e=this.viewport;if(!e)return;let t=this.opt.panes.filter(e=>e.visible!==!1);if(t.length===0)return;let 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);this.normalizeVisiblePaneRatios(t);let o=this.computePaneHeightsByRatio(t,a);for(let i=0;i<t.length;i++){let a=t[i];if(!a)continue;let s=this.paneRenderers.find(e=>e.getPane().id===a.id);if(!s)continue;let c=s.getPane(),l=o[i]??1;c.setLayout(r,l),c.setPadding(this.opt.yPaddingPx,this.opt.yPaddingPx),s.resize(e.plotWidth,l,e.dpr),this.rendererPluginManager.notifyResize(c.id,Gi(c));let u=s.getDom();u.plotCanvas.style.top=`${r}px`,u.yAxisCanvas.style.top=`${r}px`,u.yAxisCanvas.style.left=`0px`,r+=l+n}let s=Math.max(1,a);for(let e of t){let t=this.paneRenderers.find(t=>t.getPane().id===e.id);if(!t)continue;let n=t.getPane().height;this.paneRatios.set(e.id,n/s)}this.normalizeVisiblePaneRatios(t),this.syncPaneRatiosToSpecs()}computeViewport(){let e=this.dom.container;if(!e)return null;let t=this.observedSize.width,n=this.observedSize.height,r=t>0?t:Math.max(1,Math.round(e.clientWidth)),i=n>0?n:Math.max(1,Math.round(e.clientHeight)),a=Math.round(r),o=Math.round(i-this.opt.bottomAxisHeight),s=this.getEffectiveDpr(),c=16*1024*1024;r*s*(i*s)>c&&(s=Math.sqrt(c/(r*i)));let l=Math.round(e.scrollLeft*s)/s;this.dom.canvasLayer.style.width=`${r}px`,this.dom.canvasLayer.style.height=`${i}px`,this.dom.xAxisCanvas.style.width=`${a}px`,this.dom.xAxisCanvas.style.height=`${this.opt.bottomAxisHeight}px`,this.dom.xAxisCanvas.width=Math.round(a*s),this.dom.xAxisCanvas.height=Math.round(this.opt.bottomAxisHeight*s);let u={viewWidth:r,viewHeight:i,plotWidth:a,plotHeight:o,scrollLeft:l,dpr:s};return this.viewport=u,this.onViewportChange?.(u),u}};function Wc(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}({}),Gc={volumeAmplifyThreshold:1.5,volumeShrinkThreshold:.8,avgPeriod:20},Kc=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 qc(e,t,n,r=Gc){let i=new Kc;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 Jc(){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}=as(o,s,c);t.save(),t.translate(-a,0);let p=l||[],m=qc(d,i.start,i.end,Gc);for(let r=i.start;r<i.end&&r<d.length;r++){let a=d[r];if(!a)continue;let s=n.yAxis.priceToY(a.open),l=n.yAxis.priceToY(a.close),h=n.yAxis.priceToY(a.high),g=n.yAxis.priceToY(a.low),_=p[r-i.start];if(!_)continue;let v=e=>Math.round(e*c)/c,y=v(s),b=v(l),x=v(h),S=v(g),C=Math.min(y,b),w=Math.max(Math.abs(y-b),1),T=ws(Math.round(_*c),C,f,w,c);t.fillStyle=Wc(a)===`up`?J.UP:J.DOWN,t.fillRect(T.bodyRect.x,T.bodyRect.y,T.bodyRect.width,T.bodyRect.height);let E=T.wickRect.width,D=T.wickRect.x,O=T.bodyRect.y,k=T.bodyRect.y+T.bodyRect.height,A=Math.max(a.open,a.close),j=Math.min(a.open,a.close);if(a.high>A){let e=Ss(D,x,O,c);e&&t.fillRect(e.x,e.y,E,e.height)}if(a.low<j){let e=Ss(D,k,S,c);e&&t.fillRect(e.x,e.y,E,e.height)}let M=m[r-i.start];if(M!==$.OTHERS&&u&&(e.zoomLevel??1)>=2){let e=M===$.RISE_WITH_VOLUME||M===$.RISE_WITHOUT_VOLUME?x-15:S+15;Yc(t,T.bodyRect.x+T.bodyRect.width/2,e,M,r,o,4,u,c)}}t.restore()}}}function Yc(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 Xc(e,t){return Math.max(3,Math.round(e/60)+1)}function Zc(){return{name:`gridLines`,version:`1.0.0`,description:`网格线渲染器`,debugName:`网格线`,paneId:Ki,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=Xc(n.height);t.save(),t.fillStyle=_a.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=Cs(f,p,Math.round(g+n*v),s);r&&t.fillRect(r.x,r.y,r.width,r.height)}let y=pa(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=Ss(c[r]+o/2,0,n.height,s);a&&t.fillRect(a.x,a.y,a.width,a.height)}t.restore()}}}function Qc(){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,paneWidth:c}=e,l=r,u=l[l.length-1];if(!u)return;t.save(),t.translate(-i,0);let d=Math.round(n.yAxis.priceToY(u.close)),f=s[0]??0,p=c+i;t.strokeStyle=J.LAST_PRICE,t.lineWidth=1,t.setLineDash([4,3]),t.beginPath();let m=(Math.floor(d*o)+.5)/o;t.moveTo(Math.round(f*o)/o,m),t.lineTo(Math.round(p*o)/o,m),t.stroke(),t.setLineDash([]),t.restore()}}}function $c(){return{name:`extremaMarkers`,version:`1.0.0`,description:`可视区最高/最低价标注渲染器`,debugName:`极值标记`,paneId:Ki,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.role!==`price`)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),el(t,_(h),n.yAxis.priceToY(p),p,s,c,a),el(t,_(g),n.yAxis.priceToY(m),m,s,c,a),t.restore()}}}function el(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=Cs(u,d,n,i);f&&(e.fillStyle=ma.WEAK,e.fillRect(f.x,f.y,f.width,f.height));let p=Z(d,i),m=Z(n,i);e.fillStyle=ma.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 tl(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 nl(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=fa(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 rl(e,t){let{x:n,y:r,width:i,height:a,crosshairY:o,priceRange:s,yPaddingPx:c=0,dpr:l,bgColor:u=`rgba(0, 0, 0, 0.8)`,borderColor:d,textColor:f=`#ffffff`,fontSize:p=16,priceOffset:m=0,price:h,formatPrice:g}=t,_=Math.max(0,Math.min(c,Math.floor(a/2)-1)),{maxPrice:v,minPrice:y}=s,b=h??tl(o-r,v,y,a,_,_)+m,x=g?g(b):b.toFixed(2);e.save(),e.font=`${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.textBaseline=`middle`,e.textAlign=`center`;let S=p+4,C=Math.min(Math.max(o,r+S/2),r+a-S/2),w=C-S/2,T=n,E=Z(w,l),D=i,O=Z(S,l);e.fillStyle=u,e.fillRect(T,E,D,O),d&&(e.strokeStyle=d,e.lineWidth=1,e.strokeRect(Q(T,l),Q(E,l),Math.max(0,D-1/l),Math.max(0,O-1/l)));let k=n+i/2;e.fillStyle=f,e.fillText(x,Z(k,l),Z(C,l)),e.restore()}function il(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=ha.TRANSPARENT,textColor:m=ma.SECONDARY,lineColor:h=ga.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=pa(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}=la(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 al(e){let{ctx:t,dpr:n,axisWidth:r,height:i,paddingTop:a,paddingBottom:o,valueMin:s,valueMax:c,isMain:l,decimals:u=2,hideEdgeTicks:d=!0,formatLabel:f}=e,p=c-s||1;t.save(),t.clearRect(0,0,r,i),t.font=`12px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,t.textBaseline=`middle`,t.textAlign=`center`;let m=r/2,h=a,g=Math.max(a,i-o),_=Math.max(0,g-h),v=Xc(i,l),y=p/Math.max(1,v-1);for(let e=0;e<v;e++){if(d&&(e===0||e===v-1))continue;let r=c-y*e,i=h+(v<=1?0:e/(v-1))*_;t.fillStyle=ma.SECONDARY,t.fillText(f?f(r):r.toFixed(u),Z(m,n),Z(i,n))}t.restore()}function ol(e){let{axisWidth:t,paneId:n,indicatorKey:r,label:i,decimals:a=2,yPaddingPx:o=0,getCrosshair:s,formatTickLabel:c,formatCrosshairLabel:l}=e,u=vs(r,n),d=null;return{name:`${r}Scale_${n}`,version:`1.0.0`,description:`${i} 刻度渲染器`,debugName:`${i}刻度`,paneId:n,priority:q.INDICATOR_SCALE,onInstall(e){d=e},draw(e){let{yAxisCtx:n,pane:r,dpr:i}=e;if(!n||!d)return;let f=d.getSharedState(u);if(!f)return;let p=r.yAxis.getDisplayRange({minPrice:f.valueMin,maxPrice:f.valueMax});al({ctx:n,dpr:i,axisWidth:t,height:r.height,paddingTop:r.yAxis.getPaddingTop(),paddingBottom:r.yAxis.getPaddingBottom(),valueMin:p.minPrice,valueMax:p.maxPrice,isMain:!1,decimals:a,hideEdgeTicks:!1,formatLabel:c});let m=s?.();if(!m||m.activePaneId!==r.id)return;let h=m.y-r.top,g=r.yAxis.getPaddingTop(),_=r.yAxis.getPaddingBottom(),v=g,y=Math.max(g,r.height-_),b=Math.max(1,y-v),x=(Math.min(Math.max(h,v),y)-v)/b,S=p.maxPrice-x*(p.maxPrice-p.minPrice);rl(n,{x:0,y:0,width:t,height:r.height,crosshairY:h,priceRange:p,yPaddingPx:o,dpr:i,fontSize:12,priceOffset:0,price:S,formatPrice:l})}}}function sl(e){return{name:`yAxis`,version:`1.0.0`,description:`Y轴价格刻度渲染器`,debugName:`Y轴`,paneId:Ki,priority:q.SYSTEM_YAXIS,draw(t){let{ctx:n,pane:r,dpr:i,yAxisCtx:a,data:o}=t,s=a||n,c=a?.canvas?a.canvas.width/i:e.axisWidth,l=r.yAxis.getDisplayRange(r.priceRange);r.capabilities.showPriceAxisTicks&&al({ctx:s,dpr:i,axisWidth:c,height:r.height,paddingTop:r.yAxis.getPaddingTop(),paddingBottom:r.yAxis.getPaddingBottom(),valueMin:l.minPrice,valueMax:l.maxPrice,isMain:!0,decimals:2,hideEdgeTicks:!1});let u=o,d=r.id===`main`?u[u.length-1]:null;if(d){let t=r.yAxis.priceToY(d.close);rl(s,{x:0,y:r.top,width:c,height:r.height,crosshairY:t+r.top,priceRange:l,yPaddingPx:e.yPaddingPx,dpr:i,bgColor:`rgba(255, 247, 248, 0.98)`,borderColor:J.LAST_PRICE,textColor:J.LAST_PRICE,fontSize:12,priceOffset:0,price:d.close})}let f=e.getCrosshair?.();f&&f.activePaneId===r.id&&f.price!==null&&rl(s,{x:0,y:r.top,width:c,height:r.height,crosshairY:f.y,priceRange:l,yPaddingPx:e.yPaddingPx,dpr:i,fontSize:12,priceOffset:0,price:f.price})}}}function cl(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`macd`,label:`MACD`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}var ll=1e8;function ul(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`volume`,label:`VOL`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair,formatTickLabel:e=>(e/ll).toFixed(2),formatCrosshairLabel:e=>`${(e/ll).toFixed(2)}亿`})}function dl(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`rsi`,label:`RSI`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function fl(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`cci`,label:`CCI`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function pl(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`stoch`,label:`STOCH`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function ml(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`mom`,label:`MOM`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function hl(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`wmsr`,label:`WMSR`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function gl(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`kst`,label:`KST`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function _l(e){return ol({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`fastk`,label:`FASTK`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}var vl=Symbol(`time-axis`);function yl(e){return{name:`timeAxis`,version:`1.0.0`,description:`时间轴渲染器`,debugName:`时间轴`,paneId:vl,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),il(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&&nl(d,{x:0,y:0,width:f,height:p,crosshairX:m.x,timestamp:e.timestamp,dpr:c,fontSize:12})}}}}function bl(e){return{name:`crosshair`,version:`1.0.0`,description:`十字线渲染器`,debugName:`十字线`,paneId:Ki,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=Oa.LINE;let u=Ss(s,0,r.height,i);if(u&&n.fillRect(u.x,u.y,u.width,u.height),c&&l>=0){let e=Cs(0,a,Math.min(l,r.height-1/i),i);e&&n.fillRect(e.x,e.y,e.width,e.height)}n.restore()}}}function xl(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=ma.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=ma.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=ma.PRIMARY,n.fillText(t.title,12,i),t.description){let e=n.measureText(t.title).width;n.fillStyle=ma.WEAK,n.fillText(` - ${t.description}`,12+e,i)}n.restore()},setConfig(e){t={...t,...e}}}}var Sl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Cl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Sl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7.904 17.563a1.2 1.2 0 0 0 2.228.308l2.09-3.093l4.907 4.907a1.067 1.067 0 0 0 1.509 0l1.047-1.047a1.067 1.067 0 0 0 0-1.509l-4.907-4.907l3.113-2.09a1.2 1.2 0 0 0-.309-2.228L4 4z`},null,-1)]])}var wl=(0,f.markRaw)({name:`tabler-pointer`,render:Cl}),Tl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function El(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Tl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 19h16M4 15l4-6l4 2l4-5l4 4`},null,-1)]])}var Dl=(0,f.markRaw)({name:`tabler-chart-line`,render:El}),Ol={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function kl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Ol,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M17 7L7 17M8 7h9v9`},null,-1)]])}var Al=(0,f.markRaw)({name:`tabler-arrow-up-right`,render:kl}),jl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Ml(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,jl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14m-6 6l6-6m-6-6l6 6`},null,-1)]])}var Nl=(0,f.markRaw)({name:`tabler-arrow-right`,render:Ml}),Pl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Fl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Pl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14`},null,-1)]])}var Il=(0,f.markRaw)({name:`tabler-minus`,render:Fl}),Ll={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Rl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Ll,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3 12v.01M7 12h10m4 0v.01`},null,-1)]])}var zl=(0,f.markRaw)({name:`tabler-separator`,render:Rl}),Bl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Vl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Bl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v2m-4 12h2a2 2 0 0 0 2-2v-2M9 12h6m-3-3v6`},null,-1)]])}var Hl=(0,f.markRaw)({name:`tabler-crosshair`,render:Vl}),Ul={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Wl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Ul,[...t[0]||=[(0,f.createElementVNode)(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[(0,f.createElementVNode)(`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0m9-3h.01`}),(0,f.createElementVNode)(`path`,{d:`M11 12h1v4h1`})],-1)]])}var Gl=(0,f.markRaw)({name:`tabler-info-circle`,render:Wl}),Kl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function ql(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Kl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v2m-4 12h2a2 2 0 0 0 2-2v-2`},null,-1)]])}var Jl=(0,f.markRaw)({name:`tabler-maximize`,render:ql}),Yl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Xl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Yl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5`},null,-1)]])}var Zl=(0,f.markRaw)({name:`tabler-minimize`,render:Xl}),Ql={class:`left-toolbar`,"aria-label":`图表工具栏`},$l={class:`left-toolbar__group`},eu=[`title`,`aria-label`,`onClick`],tu=[`onClick`],nu=[`title`,`aria-label`,`onClick`],ru={class:`left-toolbar__group`},iu=[`title`,`aria-label`],au=eo((0,f.defineComponent)({__name:`LeftToolbar`,props:{isFullscreen:{type:Boolean}},emits:[`selectTool`,`toggleFullscreen`],setup(e,{emit:t}){let n=t,r=[{id:`cursor`,title:`光标`,icon:wl},{id:`lines`,title:`线条`,icon:Dl,children:[{id:`trend-line`,title:`线段`,icon:Dl},{id:`ray`,title:`射线`,icon:Al},{id:`h-line`,title:`水平线`,icon:Il},{id:`h-ray`,title:`水平射线`,icon:Nl},{id:`v-line`,title:`垂直线`,icon:zl},{id:`crosshair-line`,title:`十字线`,icon:Hl},{id:`info-line`,title:`信息线`,icon:Gl}]}],i=(0,f.ref)(`cursor`),a=(0,f.ref)(null);function o(e){return i.value===e.id?!0:e.children?e.children.some(e=>e.id===i.value):!1}function s(e){if(e.children?.length){if(!e.children.some(e=>e.id===i.value)){let t=e.children[0];i.value=t.id,n(`selectTool`,t.id)}l(e.id);return}i.value=e.id,n(`selectTool`,e.id),a.value=null}function c(e){i.value=e.id,n(`selectTool`,e.id),a.value=null}function l(e){a.value=a.value===e?null:e}function u(e){e.target.closest(`.tool-item`)||(a.value=null)}return(0,f.onMounted)(()=>{document.addEventListener(`click`,u,!0)}),(0,f.onUnmounted)(()=>{document.removeEventListener(`click`,u,!0)}),(t,n)=>((0,f.openBlock)(),(0,f.createElementBlock)(`nav`,Ql,[(0,f.createElementVNode)(`div`,$l,[((0,f.openBlock)(),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(r,e=>(0,f.createElementVNode)(`div`,{key:e.id,class:`tool-item`},[(0,f.createElementVNode)(`button`,{type:`button`,class:(0,f.normalizeClass)([`left-toolbar__button`,{active:o(e)}]),title:e.title,"aria-label":e.title,onClick:t=>s(e),onPointerdown:n[0]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[1]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[2]||=(0,f.withModifiers)(()=>{},[`stop`])},[((0,f.openBlock)(),(0,f.createBlock)((0,f.resolveDynamicComponent)(e.icon),{class:`tool-icon`,"aria-hidden":`true`})),e.children&&e.children.length?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,{key:0,class:(0,f.normalizeClass)([`corner-indicator`,{open:a.value===e.id}]),onClick:(0,f.withModifiers)(t=>l(e.id),[`stop`]),"aria-label":`展开子菜单`},null,10,tu)):(0,f.createCommentVNode)(``,!0)],42,eu),(0,f.createVNode)(f.Transition,{name:`dropdown`},{default:(0,f.withCtx)(()=>[a.value===e.id&&e.children&&e.children.length?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:`tool-dropdown`,onPointerdown:n[3]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[4]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[5]||=(0,f.withModifiers)(()=>{},[`stop`])},[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(e.children,e=>((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:e.id,type:`button`,class:(0,f.normalizeClass)([`left-toolbar__button`,{active:i.value===e.id}]),title:e.title,"aria-label":e.title,onClick:t=>c(e)},[((0,f.openBlock)(),(0,f.createBlock)((0,f.resolveDynamicComponent)(e.icon),{class:`tool-icon`,"aria-hidden":`true`}))],10,nu))),128))],32)):(0,f.createCommentVNode)(``,!0)]),_:2},1024)])),64))]),n[10]||=(0,f.createElementVNode)(`span`,{class:`left-toolbar__divider`},null,-1),(0,f.createElementVNode)(`div`,ru,[(0,f.createElementVNode)(`button`,{type:`button`,class:`left-toolbar__button`,title:e.isFullscreen?`退出全屏`:`全屏显示`,"aria-label":e.isFullscreen?`退出全屏`:`全屏显示`,onClick:n[6]||=e=>t.$emit(`toggleFullscreen`),onPointerdown:n[7]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[8]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[9]||=(0,f.withModifiers)(()=>{},[`stop`])},[e.isFullscreen?((0,f.openBlock)(),(0,f.createBlock)((0,f.unref)(Zl),{key:0,class:`tool-icon`,"aria-hidden":`true`})):((0,f.openBlock)(),(0,f.createBlock)((0,f.unref)(Jl),{key:1,class:`tool-icon`,"aria-hidden":`true`}))],40,iu)])]))}}),[[`__scopeId`,`data-v-42a7d005`]]),ou={class:`chart-wrapper`},su={class:`chart-main`},cu={class:`pane-separator-layer`,"aria-hidden":`true`},lu=4,uu=eo((0,f.defineComponent)({__name:`KLineChart`,props:{semanticConfig:{},yPaddingPx:{default:0},minKWidth:{default:2},maxKWidth:{default:50},rightAxisWidth:{default:0},bottomAxisHeight:{default:24},priceLabelWidth:{default:60},zoomLevels:{default:20},initialZoomLevel:{default:3},isFullscreen:{type:Boolean,default:!1}},emits:[`zoomLevelChange`,`toggleFullscreen`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=(0,f.ref)(null),o=(0,f.ref)(null),s=(0,f.ref)(null),c=(0,f.ref)(null),l=(0,f.shallowRef)(null),u=(0,f.shallowRef)(null),d=(0,f.ref)(0),p=(0,f.ref)(1),m=(0,f.ref)(r.initialZoomLevel??1),h=(0,f.ref)(ms(m.value,{minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,zoomLevelCount:r.zoomLevels,dpr:p.value})),g=(0,f.ref)(hs(p.value));function _(){l.value?.scheduleDraw()}function v(e){if(!e)return;let t=e.getBoundingClientRect();l.value?.interaction.setTooltipSize({width:Math.max(180,Math.round(t.width)),height:Math.max(80,Math.round(t.height))})}function y(e){if(!e)return;let t=e.getBoundingClientRect();k.value={width:Math.max(120,Math.round(t.width)),height:Math.max(60,Math.round(t.height))}}let b=(0,f.ref)({x:0,y:0}),x=(0,f.ref)(!1),S=(0,f.shallowRef)({crosshairPos:null,crosshairIndex:null,crosshairPrice:null,hoveredIndex:null,activePaneId:null,tooltipPos:{x:0,y:0},tooltipAnchorPlacement:`right-bottom`,hoveredMarkerData:null,hoveredCustomMarker:null,isDragging:!1,isResizingPaneBoundary:!1,isHoveringPaneBoundary:!1,hoveredPaneBoundaryId:null,isHoveringRightAxis:!1}),C=(0,f.ref)([]),w=(0,f.shallowRef)(null),T=(0,f.ref)(0),E=(0,f.computed)(()=>(T.value,w.value?.getSelectedDrawing()??null)),D=(0,f.ref)({main:3}),O=(0,f.ref)([]),k=(0,f.ref)({width:220,height:120}),A=(0,f.ref)(0),j=(0,f.computed)(()=>S.value.hoveredMarkerData),M=(0,f.computed)(()=>S.value.hoveredCustomMarker),N=(0,f.computed)(()=>S.value.isDragging),ee=(0,f.computed)(()=>S.value.isResizingPaneBoundary),te=(0,f.computed)(()=>S.value.isHoveringPaneBoundary),ne=(0,f.computed)(()=>S.value.hoveredPaneBoundaryId),re=(0,f.computed)(()=>S.value.isHoveringRightAxis),ie=(0,f.computed)(()=>S.value.hoveredIndex),ae=(0,f.computed)(()=>S.value.crosshairIndex),oe=(0,f.computed)(()=>{let e=S.value.hoveredIndex;if(typeof e!=`number`)return null;A.value;let t=l.value?.getData();return t&&e>=0&&e<t.length?t[e]:null}),se=(0,f.computed)(()=>S.value.hoveredIndex),P=(0,f.computed)(()=>S.value.tooltipPos),ce=(0,f.computed)(()=>S.value.tooltipAnchorPlacement),le=(0,f.computed)(()=>{let e=l.value?.getViewport(),t=c.value,n=e?.plotWidth??(t?t.clientWidth:0);return b.value.x+12+k.value.width+12>n?`left-bottom`:`right-bottom`}),ue=(0,f.computed)(()=>(A.value,l.value?.getData()??[]));function de(){A.value++}function fe(e){w.value?.setTool(e)}function pe(e){let t=E.value;!t||!w.value||(w.value.updateDrawingStyle(t.id,e),T.value++)}function me(){let e=E.value;!e||!w.value||(w.value.removeDrawing(e.id),T.value++,C.value=w.value.getDrawings())}function he(e){let t=c.value;if(t){if(w.value?.onPointerDown(e,t)){C.value=w.value.getDrawings(),T.value++;return}l.value?.interaction.onPointerDown(e)}}function ge(e){let t=c.value;if(t){let n=t.getBoundingClientRect();if(b.value={x:e.clientX-n.left,y:e.clientY-n.top},w.value?.onPointerMove(e,t)){C.value=w.value.getDrawings();return}}l.value?.interaction.onPointerMove(e)}function _e(e){let t=c.value;if(t&&w.value?.onPointerUp(e,t)){C.value=w.value.getDrawings();return}l.value?.interaction.onPointerUp(e)}function ve(e){l.value?.interaction.onPointerLeave(e)}function ye(e){l.value?.interaction.onRightAxisPointerDown(e)}function be(e){l.value?.interaction.onRightAxisPointerMove(e)}function xe(e){l.value?.interaction.onRightAxisPointerUp(e)}function Se(e){l.value?.interaction.onRightAxisPointerLeave(e)}function Ce(){l.value?.interaction.onScroll()}let F=(0,f.ref)([]),I=(0,f.ref)({}),L=(0,f.ref)([]),we={VOLUME:{defaultParams:{},getTitleInfo:()=>({name:`VOL`,params:[],values:[]})},MACD:{defaultParams:{fastPeriod:12,slowPeriod:26,signalPeriod:9},getTitleInfo:(e,t,n)=>t===null?null:Us(e,t,n.fastPeriod??12,n.slowPeriod??26,n.signalPeriod??9)},RSI:{defaultParams:{period1:6,period2:12,period3:24},getTitleInfo:(e,t,n)=>t===null?null:Ks(e,t,n.period1??6,n.period2??12,n.period3??24)},CCI:{defaultParams:{period:14},getTitleInfo:(e,t,n)=>t===null?null:Xs(e,t,n.period??14)},STOCH:{defaultParams:{n:9,m:3},getTitleInfo:(e,t,n)=>t===null?null:ec(e,t,n.n??9,n.m??3)},MOM:{defaultParams:{period:10},getTitleInfo:(e,t,n)=>t===null?null:ic(e,t,n.period??10)},WMSR:{defaultParams:{period:14},getTitleInfo:(e,t,n)=>t===null?null:cc(e,t,n.period??14)},KST:{defaultParams:{roc1:10,roc2:15,roc3:20,roc4:30,signalPeriod:9},getTitleInfo:(e,t,n)=>t===null?null:mc(e,t,n.roc1??10,n.roc2??15,n.roc3??20,n.roc4??30,n.signalPeriod??9)},FASTK:{defaultParams:{period:9},getTitleInfo:(e,t,n)=>t===null?null:vc(e,t,n.period??9)}},Te=Object.keys(we);function Ee(){let e=D.value.main??3;return L.value.length===0?[{id:`main`,ratio:e,visible:!0,role:`price`}]:[{id:`main`,ratio:e,visible:!0,role:`price`},...L.value.map(e=>({id:e.id,ratio:D.value[e.id]??1,visible:!0,role:`indicator`}))]}function De(e){return{...we[e].defaultParams}}function Oe(e=`VOLUME`,t){if(L.value.length>=lu)return!1;let n=`sub_${e}`;if(L.value.some(e=>e.id===n))return!0;if(!l.value?.createSubPane(e,t??De(e)))return!1;let r=xl({paneId:n,title:e,getTitleInfo:()=>Pe(n)});return l.value?.useRenderer(r),L.value.push({id:n,indicatorId:e,rendererName:`${e.toLowerCase()}_${n}`,paneTitleRendererName:r.name,params:t??De(e)}),F.value.includes(e)||F.value.push(e),_(),!0}function ke(e){let t=L.value.findIndex(t=>t.id===e);if(t===-1)return;let n=L.value[t];n&&(l.value?.removeRenderer(n.paneTitleRendererName),l.value?.removeSubPane(n.indicatorId),L.value.splice(t,1),L.value.some(e=>e.indicatorId===n.indicatorId)||(F.value=F.value.filter(e=>e!==n.indicatorId)))}function Ae(){for(let e of L.value)l.value?.removeRenderer(e.paneTitleRendererName);l.value?.clearSubPanes(),L.value=[],F.value=F.value.filter(e=>!Te.includes(e))}function je(){let e=r.semanticConfig.indicators?.main;if(e)for(let t of e)t.enabled&&(F.value.includes(t.type)||F.value.push(t.type),t.params&&(I.value[t.type]=t.params))}(0,f.watch)([F,I],([e])=>{let t=l.value;t&&(t.updateRendererConfig(`mainIndicatorLegend`,{indicators:{MA:{enabled:e.includes(`MA`),params:I.value.MA||{}},BOLL:{enabled:e.includes(`BOLL`),params:I.value.BOLL||{}},EXPMA:{enabled:e.includes(`EXPMA`),params:I.value.EXPMA||{}},ENE:{enabled:e.includes(`ENE`),params:I.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`)),_())},{deep:!0});function Me(){let e=l.value?.getSubPaneIndicators()??[];L.value=[];for(let t of e){let e=`sub_${t}`,n=xl({paneId:e,title:t,getTitleInfo:()=>Pe(e)});l.value?.useRenderer(n),L.value.push({id:e,indicatorId:t,rendererName:`${t.toLowerCase()}_${e}`,paneTitleRendererName:n.name,params:De(t)}),F.value.includes(t)||F.value.push(t)}_()}function Ne(e,t){let n=L.value.find(t=>t.id===e);if(!n)return;let r=n.indicatorId;l.value?.removeRenderer(n.paneTitleRendererName),l.value?.removeSubPane(r),l.value?.createSubPane(t,De(t));let i=`sub_${t}`,a=xl({paneId:i,title:t,getTitleInfo:()=>Pe(i)});l.value?.useRenderer(a);let o=L.value.findIndex(t=>t.id===e);o!==-1&&(L.value[o]={id:i,indicatorId:t,rendererName:`${t.toLowerCase()}_${i}`,paneTitleRendererName:a.name,params:De(t)}),F.value=F.value.filter(e=>e!==r),F.value.includes(t)||F.value.push(t)}function Pe(e){let t=L.value.find(t=>t.id===e);if(!t)return null;let n=l.value?.getData();if(!n||n.length===0)return null;let r=we[t.indicatorId],i=t.params;return r.getTitleInfo(n,ae.value,i)}function Fe(e,t){if(e===`MA`||e===`BOLL`||e===`EXPMA`||e===`ENE`){t?F.value.includes(e)||F.value.push(e):F.value=F.value.filter(t=>t!==e);return}if(Te.includes(e)){if(t){if(F.value.includes(e)||F.value.push(e),L.value.find(t=>t.indicatorId===e))return;if(!Oe(e)){let t=L.value[L.value.length-1];t&&Ne(t.id,e)}}else F.value=F.value.filter(t=>t!==e),L.value.filter(t=>t.indicatorId===e).forEach(e=>ke(e.id));_()}}function Ie(){l.value?.updateRendererConfig(`mainIndicatorLegend`,{indicators:{MA:{enabled:F.value.includes(`MA`),params:I.value.MA||{}},BOLL:{enabled:F.value.includes(`BOLL`),params:I.value.BOLL||{}},EXPMA:{enabled:F.value.includes(`EXPMA`),params:I.value.EXPMA||{}},ENE:{enabled:F.value.includes(`ENE`),params:I.value.ENE||{}}}})}function Le(e,t){if(I.value[e]=t,e===`MA`||e===`BOLL`||e===`EXPMA`||e===`ENE`){e===`BOLL`&&l.value?.updateRendererConfig(`boll`,t),e===`EXPMA`&&l.value?.updateRendererConfig(`expma`,t),e===`ENE`&&l.value?.updateRendererConfig(`ene`,t),Ie(),_();return}Te.includes(e)&&L.value.filter(t=>t.indicatorId===e).forEach(e=>{e.params={...t},l.value?.updateRendererConfig(e.rendererName,t)}),_()}function Re(e){if(!e.length||L.value.length<=1)return;let t=e.filter(e=>Te.includes(e));if(!t.length)return;let n=new Map(L.value.map(e=>[e.indicatorId,e])),r=[];for(let e of t){let t=n.get(e);t&&(r.push(t),n.delete(e))}if(r.length===0)return;for(let e of L.value)n.has(e.indicatorId)&&(r.push(e),n.delete(e.indicatorId));let i=L.value.map(e=>e.id),a=r.map(e=>e.id);if(i.join(`|`)===a.join(`|`))return;L.value=r;let o=F.value.filter(e=>!Te.includes(e)),s=L.value.map(e=>e.indicatorId);F.value=[...o,...s];let c=l.value;c&&c.updatePaneLayout(Ee())}let ze=(0,f.computed)(()=>r.rightAxisWidth+r.priceLabelWidth),Be=(0,f.computed)(()=>{let e=d.value;if(e===0)return 0;let t=p.value,{startXPx:n,unitPx:r}=as(h.value,g.value,t);return(n+e*r)/t});function R(){let e=c.value;e&&(e.scrollLeft=e.scrollWidth,_())}function Ve(e,t){let n=l.value,a=c.value;if(!n||!a)return;let o=n.getCurrentDpr(),s=_s(e,t??(n.getViewport()?.plotWidth??a.clientWidth)/2,a.scrollLeft,m.value,h.value,g.value,{minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,zoomLevelCount:r.zoomLevels,dpr:o});s&&(m.value=s.targetLevel,h.value=s.newKWidth,g.value=s.newKGap,n.interaction.clearHover(),(0,f.nextTick)(()=>{let e=c.value;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth);e.scrollLeft=Math.min(Math.max(0,s.newScrollLeft),t),n.applyRenderState(s.newKWidth,s.newKGap,s.targetLevel),i(`zoomLevelChange`,s.targetLevel,s.newKWidth)}))}return t({scheduleRender:_,scrollToRight:R,addSubPane:Oe,removeSubPane:ke,switchSubIndicator:Ne,clearAllSubPanes:Ae,get plugin(){return l.value?.plugin},zoomToLevel:Ve,zoomIn:e=>Ve(m.value+1,e),zoomOut:e=>Ve(m.value-1,e),getZoomLevel:()=>m.value,getZoomLevelCount:()=>l.value?.getZoomLevelCount()??10}),(0,f.onMounted)(()=>{x.value=typeof CSS<`u`&&CSS.supports(`anchor-name: --kmap-anchor`)&&CSS.supports(`position-anchor: --kmap-anchor`);let e=c.value,t=o.value,n=s.value,_=a.value;if(!e||!t||!n||!_)return;let v=t=>{t.preventDefault();let n=l.value;if(!n)return;let a=e.getBoundingClientRect(),o=t.clientX-a.left,s=e.scrollLeft,u=n.getCurrentDpr(),d=gs(t.deltaY>0?-1:1,o,s,m.value,h.value,g.value,{minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,zoomLevelCount:r.zoomLevels,dpr:u});d&&(m.value=d.targetLevel,h.value=d.newKWidth,g.value=d.newKGap,n.interaction.clearHover(),(0,f.nextTick)(()=>{let e=c.value;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth);e.scrollLeft=Math.min(Math.max(0,d.newScrollLeft),t),n.applyRenderState(d.newKWidth,d.newKGap,d.targetLevel),i(`zoomLevelChange`,d.targetLevel,d.newKWidth)}))};e.addEventListener(`wheel`,v,{passive:!1});let y=new Uc({container:e,canvasLayer:t,rightAxisLayer:n,xAxisCanvas:_},{yPaddingPx:r.yPaddingPx,rightAxisWidth:r.rightAxisWidth,bottomAxisHeight:r.bottomAxisHeight,priceLabelWidth:r.priceLabelWidth,minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,panes:[{id:`main`,ratio:1}],paneGap:0,zoomLevels:r.zoomLevels,initialZoomLevel:r.initialZoomLevel});y.useRenderer(Zc()),y.useRenderer($c()),y.useRenderer(Es({ma5:!0,ma10:!0,ma20:!0,ma30:!0,ma60:!0})),y.useRenderer(Os()),y.setRendererEnabled(`boll`,!1),y.useRenderer(Ms()),y.setRendererEnabled(`expma`,!1),y.useRenderer(Fs()),y.setRendererEnabled(`ene`,!1),y.useRenderer(Jc()),y.useRenderer(Qc()),y.useRenderer(aa());let b=r.rightAxisWidth+r.priceLabelWidth,E=()=>{let e=y.interaction.crosshairPos,t=y.interaction.crosshairPrice,n=y.interaction.activePaneId;return e&&t!==null?{y:e.y,price:t,activePaneId:n}:null};y.useRenderer(sl({axisWidth:b,yPaddingPx:r.yPaddingPx,getCrosshair:E})),y.useRenderer(Ls({yPaddingPx:r.yPaddingPx}));let k=[{create:ul,paneId:`sub_VOLUME`},{create:cl,paneId:`sub_MACD`},{create:dl,paneId:`sub_RSI`},{create:fl,paneId:`sub_CCI`},{create:pl,paneId:`sub_STOCH`},{create:ml,paneId:`sub_MOM`},{create:hl,paneId:`sub_WMSR`},{create:gl,paneId:`sub_KST`},{create:_l,paneId:`sub_FASTK`}];for(let e of k)y.useRenderer(e.create({axisWidth:b,paneId:e.paneId,yPaddingPx:r.yPaddingPx,getCrosshair:E}));y.useRenderer(bl({getCrosshairState:()=>({pos:y.interaction.crosshairPos,activePaneId:y.interaction.activePaneId,isDragging:y.interaction.isDraggingState(),price:y.interaction.crosshairPrice})})),y.useRenderer(yl({height:r.bottomAxisHeight,getCrosshair:()=>{let e=y.interaction.crosshairPos,t=y.interaction.crosshairIndex;return e&&t!==null?{x:e.x,index:t}:null}})),y.setOnViewportChange(e=>{p.value=e.dpr,g.value=hs(e.dpr)}),y.setOnPaneLayoutChange(e=>{let t={};for(let n of e)t[n.id]=n.ratio;D.value=t,O.value=y.getPaneRenderers().slice(0,-1).map(e=>{let t=e.getPane();return{id:t.id,top:t.top+t.height}})}),l.value=y,w.value=new Sc(y),w.value.setCallbacks({onDrawingCreated:e=>{C.value.push(e)},onToolChange:e=>{},onDrawingSelected:()=>{T.value++}}),y.interaction.setTooltipAnchorPositioning(x.value),y.interaction.setOnInteractionChange(e=>{S.value=e}),S.value=y.interaction.getInteractionSnapshot(),p.value=y.getCurrentDpr(),y.resize(),u.value=new ki(y),u.value.on(`config:error`,e=>{console.error(`Semantic config error:`,e)}),u.value.on(`config:ready`,()=>{d.value=y.getData()?.length??0,de(),je(),Me(),(0,f.nextTick)(()=>R())}),u.value.applyConfig(r.semanticConfig).then(e=>{e&&!e.success&&console.error(`Semantic config apply failed:`,e.errors)}),y.__onWheel=v}),(0,f.onUnmounted)(()=>{let e=l.value;if(e){let t=e.__onWheel,n=c.value;t&&n&&n.removeEventListener(`wheel`,t),e.destroy()}l.value=null,w.value=null}),(0,f.watch)(()=>r.yPaddingPx,e=>{l.value?.updateOptions({yPaddingPx:e}),_()}),(0,f.watch)(()=>r.semanticConfig,async(e,t)=>{if(e&&e!==t){let t=await u.value?.applyConfig(e);t&&!t.success&&console.error(`Semantic config apply failed:`,t.errors)}},{deep:!0}),(t,n)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,ou,[(0,f.createElementVNode)(`div`,{class:(0,f.normalizeClass)([`chart-stage`,{"is-dragging":N.value,"is-resizing-pane":ee.value,"is-hovering-pane-separator":te.value,"is-hovering-right-axis":re.value,"is-hovering-kline":ie.value!==null}])},[(0,f.createVNode)(au,{"is-fullscreen":e.isFullscreen,onSelectTool:fe,onToggleFullscreen:n[0]||=e=>t.$emit(`toggleFullscreen`)},null,8,[`is-fullscreen`]),(0,f.createElementVNode)(`div`,su,[(0,f.createElementVNode)(`div`,cu,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(O.value,e=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:e.id,class:(0,f.normalizeClass)([`pane-separator-line`,{"is-active":ne.value===e.id}]),style:(0,f.normalizeStyle)({top:`${e.top}px`})},null,6))),128))]),(0,f.createElementVNode)(`div`,{class:`chart-container`,ref_key:`containerRef`,ref:c,onScrollPassive:Ce,onPointerdown:he,onPointermove:ge,onPointerup:_e,onPointerleave:ve},[(0,f.createElementVNode)(`div`,{class:`scroll-content`,style:(0,f.normalizeStyle)({width:Be.value+`px`})},[(0,f.createElementVNode)(`div`,{class:`canvas-layer`,ref_key:`canvasLayerRef`,ref:o},[(0,f.createElementVNode)(`canvas`,{class:`x-axis-canvas`,ref_key:`xAxisCanvasRef`,ref:a},null,512),oe.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:(0,f.normalizeClass)([`tooltip-anchor kline-tooltip-anchor`,{"use-anchor":x.value}]),style:(0,f.normalizeStyle)({left:`${P.value.x}px`,top:`${P.value.y}px`})},null,6)):(0,f.createCommentVNode)(``,!0),j.value||M.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:1,class:(0,f.normalizeClass)([`tooltip-anchor marker-tooltip-anchor`,{"use-anchor":x.value}]),style:(0,f.normalizeStyle)({left:`${b.value.x}px`,top:`${b.value.y}px`})},null,6)):(0,f.createCommentVNode)(``,!0),oe.value?((0,f.openBlock)(),(0,f.createBlock)(to,{key:2,k:oe.value,index:se.value,data:ue.value,pos:P.value,"set-el":v,"use-anchor":x.value,"anchor-placement":ce.value},null,8,[`k`,`index`,`data`,`pos`,`use-anchor`,`anchor-placement`])):(0,f.createCommentVNode)(``,!0),j.value||M.value?((0,f.openBlock)(),(0,f.createBlock)(oo,{key:3,marker:j.value||M.value,pos:b.value,"use-anchor":x.value,"anchor-placement":le.value,"set-el":y},null,8,[`marker`,`pos`,`use-anchor`,`anchor-placement`])):(0,f.createCommentVNode)(``,!0),E.value?((0,f.openBlock)(),(0,f.createBlock)(rs,{key:4,drawing:E.value,onUpdateStyle:pe,onDelete:me},null,8,[`drawing`])):(0,f.createCommentVNode)(``,!0)],512)],4)],544),(0,f.createElementVNode)(`div`,{class:`right-axis-host`,ref_key:`rightAxisLayerRef`,ref:s,style:(0,f.normalizeStyle)({width:ze.value+`px`}),onPointerdown:ye,onPointermove:be,onPointerup:xe,onPointerleave:Se},null,36)])],2),(0,f.createVNode)(Yo,{"active-indicators":F.value,"indicator-params":I.value,onToggle:Fe,onUpdateParams:Le,onReorderSubIndicators:Re},null,8,[`active-indicators`,`indicator-params`])]))}}),[[`__scopeId`,`data-v-63f59234`]]),du={install(e){e.component(`KLineChart`,uu)}};exports.ConfigManager=Yi,exports.EventBus=p,exports.GLOBAL_PANE_ID=Ki,exports.HookSystem=Ji,exports.KLineChart=uu,exports.KMapPlugin=du,exports.PluginHostImpl=Zi,exports.PluginRegistry=qi,exports.PluginState=Wi,exports.RENDERER_PRIORITY=q,exports.RendererPluginManager=ea,exports.createPluginHost=Qi,exports.wrapPaneInfo=Gi;
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})),Xr=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)}}})),Zr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=G(),n=U(),r=$n(),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)}}}})),Qr=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=dr(),n=G(),r=W(),i=Zr();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)}}}})),$r=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=G(),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())})})}}}})),ei=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`}}})),ti=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:G().validateUnion,error:{message:`must match a schema in anyOf`}}})),ni=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)})})}}}})),ri=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)})}}})),ii=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})),ai=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`)}}})),oi=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Wr(),n=Kr(),r=Gr(),i=qr(),a=Jr(),o=Yr(),s=Xr(),c=Zr(),l=Qr(),u=$r(),d=ei(),f=ti(),p=ni(),m=ri(),h=ii(),g=ai();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=_})),si=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})`}}}}})),ci=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[si().default]})),li=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`]})),ui=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Ar(),n=Ur(),r=oi(),i=ci(),a=li();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),di=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={}))})),fi=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=U(),n=di(),r=mr(),i=pr(),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}}}}})),pi=c({$id:()=>hi,$schema:()=>mi,default:()=>bi,definitions:()=>_i,properties:()=>yi,title:()=>gi,type:()=>vi}),mi,hi,gi,_i,vi,yi,bi,xi=o((()=>{mi=`http://json-schema.org/draft-07/schema#`,hi=`http://json-schema.org/draft-07/schema#`,gi=`Core schema meta-schema`,_i={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:[]}},vi=[`object`,`boolean`],yi={$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:`#`}},bi={$schema:mi,$id:hi,title:gi,definitions:_i,type:vi,properties:yi,default:!0}})),Si=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=Dr(),r=ui(),i=fi(),a=(xi(),d(pi).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=dr();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=fr();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return f.default}});var p=pr();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return p.default}})}))(),1),Ci={$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}$`}}}}},wi=[`__proto__`,`constructor`,`prototype`],Ti=/^(#[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*\))$/,Ei={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 Di(e){return{"5min":30,"15min":60,"30min":90,"60min":180,daily:365*3,weekly:365*5,monthly:365*10}[e]??365}var Oi=(typeof document<`u`?document.createElement(`canvas`):null)?.getContext(`2d`)??null,ki=class e{ajv;limits;constructor(){this.ajv=new Si.default({allErrors:!0,allowUnionTypes:!0}),this.ajv.addFormat(`date`,{type:`string`,validate:e=>/^\d{4}-\d{2}-\d{2}$/.test(e)}),this.ajv.addSchema(Ci),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))wi.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=Di(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(!Ei[n].test(t))return{valid:!1,errors:[`Invalid symbol "${t}" for exchange "${n}"`]}}else if(!Object.values(Ei).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`&&!Ti.test(r)&&n.push(`Invalid ${i} in marker "${t}": ${r}`)}if(Oi)for(let i of r){let r=e[i];typeof r==`string`&&(Oi.fillStyle=`#000000`,Oi.fillStyle=r,Oi.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}},Ai=class{chart;validator;events;constructor(e){this.chart=e,this.validator=new ki,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 Xn(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:ji(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 ji(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 Mi={arrow_up:16,arrow_down:16,flag:14,circle:12,rectangle:14,diamond:12};function Ni(e,t,n,r,i,a){let o=a.fillColor||`#000000`,s=a.strokeColor||o,c=i||Mi[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`:Ri(e,n,r,c);break;case`arrow_down`:zi(e,n,r,c);break;case`circle`:Bi(e,n,r,c);break;case`rectangle`:Vi(e,n,r,c);break;case`diamond`:Hi(e,n,r,c);break;case`flag`:Ui(e,n,r,c);break}e.globalAlpha=1}var Pi=2.5,Fi=4;function Ii(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*Pi,d=Li(e,t.text,u),f=e.measureText(d).width,p=n,m=r;switch(t.position){case`left`:p=n-l-f/2-Fi;break;case`right`:p=n+l+f/2+Fi;break;case`top`:m=r-l-s/2-Fi;break;case`bottom`:m=r+l+s/2+Fi;break;default:m=o?r-l-s/2-Fi:r+l+s/2+Fi;break}t.offset&&(p+=t.offset.x||0,m+=t.offset.y||0),e.textAlign=t.align||`center`,e.fillText(d,p,m)}function Li(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 Ri(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 zi(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 Bi(e,t,n,r){e.beginPath(),e.arc(t,n,r/2,0,Math.PI*2),e.fill()}function Vi(e,t,n,r){e.fillRect(t-r/2,n-r/2,r,r)}function Hi(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 Ui(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 Wi(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 Gi=function(e){return e.Registered=`registered`,e.Installed=`installed`,e.Error=`error`,e}({});function Ki(e){return{id:e.id,role:e.role,capabilities:{...e.capabilities},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(),getDisplayRange:t=>e.yAxis.getDisplayRange(t)},priceRange:e.priceRange}}var qi=Symbol(`global-pane`),K={SYSTEM_YAXIS:-20,SYSTEM_XAXIS:-20,BACKGROUND:0,GRID:10,INDICATOR:30,MAIN:50,INDICATOR_SCALE:55,OVERLAY:80,FOREGROUND:100,SYSTEM_BORDER:120,SYSTEM_CROSSHAIR:150},Ji=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()}},Yi=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,n){let r=this.hooks.get(e);if(!r||r.length===0)return[];let i=[];for(let{fn:a}of r)try{let e=await a(t);i.push(e)}catch(t){if(console.error(`[HookSystem] Error in hook "${e}":`,t),n?.throwOnError)throw t}return i}callSync(e,t,n){let r=this.hooks.get(e);if(!r||r.length===0)return[];let i=[];for(let{fn:a}of r)try{let e=a(t);i.push(e)}catch(t){if(console.error(`[HookSystem] Error in hook "${e}":`,t),n?.throwOnError)throw t}return i}clear(){this.hooks.clear()}hookCount(e){return this.hooks.get(e)?.length??0}},Xi=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.defaults.delete(e)):(this.configs.clear(),this.defaults.clear())}},Zi=class{states=new Map;ownerNamespaces=new Map;setState(e,t,n){this.states.set(e,t)}getState(e){return this.states.get(e)}clearState(e){this.states.delete(e)}registerStateOwner(e,t){this.ownerNamespaces.set(e,new Set(t))}clearByOwner(e){let t=this.ownerNamespaces.get(e);t&&(t.forEach(e=>{this.states.delete(e)}),this.ownerNamespaces.delete(e))}clear(){this.states.clear(),this.ownerNamespaces.clear()}},Qi=class{registry;eventBus;hookSystem;configManager;stateStore;isDestroyed=!1;logger;constructor(e){this.registry=new Ji,this.eventBus=new p,this.hookSystem=new Yi,this.configManager=new Xi,this.stateStore=new Zi,this.logger=e??console}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,n)=>this.hookSystem.call(e,t,n),callSync:(e,t,n)=>this.hookSystem.callSync(e,t,n)};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()}]`;this.logger[e](`${r} ${t}`,...n)}setSharedState(e,t,n){this.stateStore.setState(e,t,n)}getSharedState(e){return this.stateStore.getState(e)}clearSharedState(e){this.stateStore.clearState(e)}registerStateOwner(e,t){this.stateStore.registerStateOwner(e,t)}clearByOwner(e){this.stateStore.clearByOwner(e)}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},{throwOnError:!0}),await e.install(this,n.config),this.registry.updateState(e.name,`installed`),await this.hooks.call(`plugin:afterInstall`,{plugin:e,config:t},{throwOnError:!0}),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},{throwOnError:!0}),t.plugin.uninstall&&await t.plugin.uninstall(),this.registry.unregister(e),this.configManager.clear(e),await this.hooks.call(`plugin:afterUninstall`,{name:e},{throwOnError:!0}),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.stateStore.clear(),this.isDestroyed=!0,this.log(`info`,`PluginHost destroyed`)}}ensureNotDestroyed(){if(this.isDestroyed)throw Error(`PluginHost has been destroyed`)}};function $i(e){return new Qi(e)}var ea=Symbol(`renderer:global-cache`),ta=class{plugins=new Map;pluginHost=null;enabledState=new Map;groupCache=new Map;mergedCache=new Map;knownPaneIds=new Set;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}setKnownPaneIds(e){this.knownPaneIds=new Set(e),this.cacheInvalid=!0}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)}let n=t.getDeclaredNamespaces?.();n&&this.pluginHost&&this.pluginHost.registerStateOwner(e.name,n),this.onInvalidate?.()}unregister(e){let t=this.plugins.get(e);if(t){if(this.pluginHost?.clearByOwner(e),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`?ea: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(ea)??[];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(ea,[...e]),this.cacheInvalid=!1}isRendererEnabled(e){let t=this.enabledState.get(e.name);return t===void 0?e.enabled!==!1:t}getMergedRenderers(e){this.rebuildCache();let t=this.mergedCache.get(e);if(!t){let n=this.groupCache.get(e)??[],r=this.groupCache.get(ea)??[];t=this.mergeSorted(n,r),this.mergedCache.set(e,t)}return t}getRenderers(e){return this.getMergedRenderers(e).filter(e=>e.isSystem?!1:this.isRendererEnabled(e))}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||!this.isRendererEnabled(n))return[];let r=[];try{n.draw(t)}catch(n){let i=n instanceof Error?n:Error(String(n));console.error(`[RendererPlugin] ${e} draw error:`,i),r.push({name:e,error:{message:i.message,stack:i.stack},paneId:t.pane.id,timestamp:Date.now()})}return r}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&&this.isRendererEnabled(n))try{n.onDataUpdate(e,t)}catch(e){console.error(`[RendererPlugin] ${n.name} onDataUpdate error:`,e)}}notifyResize(e,t){let n=this.getMergedRenderers(e).filter(e=>this.isRendererEnabled(e));for(let e of n)if(e.onResize)try{e.onResize(t)}catch(t){console.error(`[RendererPlugin] ${e.name} onResize error:`,t)}}},na=1.2,ra=24,ia=6;function aa(e){switch(e){case`arrow_up`:case`flag`:return!0;default:return!1}}function oa(){return{name:`customMarkers`,version:`1.0.0`,description:`自定义标记渲染器`,debugName:`自定义标记`,paneId:qi,priority:K.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.role===`price`){t.save(),t.translate(-a,0);for(let e of l){let r=ca(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=sa(o,p),h=(e.offset?.y??0)<0?!0:(e.offset?.y??0)>0?!1:aa(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;Ni(t,e.shape,_,v,m,e.style||{}),e.label&&Ii(t,e.label,_,v,m,e.style||{},h),c.setCustomMarkerPosition(e.id,_-a,v,m,e.shape)}t.restore()}}}}function sa(e,t){let n=e*na;return Math.max(ia,Math.min(n,t??ra))}function ca(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 la(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 ua(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 da(e){let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}`}var fa=la,pa=la;function ma(e){if(e.length===0)return[];let t=[0],n=da(e[0].timestamp);for(let r=1;r<e.length;r++){let i=e[r];if(!i)continue;let a=da(i.timestamp);a!==n&&(t.push(r),n=a)}return t}var ha={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)`},q={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:`rgba(196, 74, 86, 0.95)`},ga={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`},_a={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`},va={HORIZONTAL:`rgba(0, 0, 0, 0.06)`,VERTICAL:`rgba(0, 0, 0, 0.12)`},J={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)`},ya={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)`},Y={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`},ba={UP:`#ff5252`,DOWN:`#22ab94`,NEUTRAL:`rgba(0, 0, 0, 0.78)`},xa={RSI1:`rgba(69, 112, 249, 1)`,RSI2:`rgba(255, 152, 0, 1)`,RSI3:`rgba(156, 39, 176, 1)`},Sa={CCI:`rgba(69, 112, 249, 1)`,OVERBOUGHT:`rgba(214, 10, 34, 0.5)`,OVERSOLD:`rgba(3, 123, 102, 0.5)`},Ca={K:`rgba(69, 112, 249, 1)`,D:`rgba(255, 152, 0, 1)`,J:`rgba(156, 39, 176, 1)`},wa={MOM:`rgba(69, 112, 249, 1)`,ZERO:`rgba(0, 0, 0, 0.2)`},Ta={WMSR:`rgba(69, 112, 249, 1)`,OVERBOUGHT:`rgba(214, 10, 34, 0.5)`,OVERSOLD:`rgba(3, 123, 102, 0.5)`},Ea={KST:`rgba(69, 112, 249, 1)`,SIGNAL:`rgba(255, 152, 0, 1)`},Da={FAST:`rgba(255, 152, 0, 1)`,SLOW:`rgba(69, 112, 249, 1)`},Oa={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)`},ka={LINE:`rgba(0, 0, 0, 0.28)`,LABEL_BG:`rgb(0, 0, 0)`,LABEL_TEXT:`rgba(255, 255, 255, 0.92)`},Aa=q.UP,ja=q.DOWN,Ma=q.NEUTRAL;function Na(e){return e>0?Aa:e<0?ja:Ma}function Pa(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 Fa(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}`}function Ia(e,t=2){return`${e.toFixed(t)}%`}function La(e,t=2){return`${e>0?`+`:``}${e.toFixed(t)}%`}function Ra(e,t){let n=t?.close??e.open;return Na(e.open-n)}function za(e){return Na(e.close-e.open)}function Ba(e){return typeof e.changePercent==`number`?Na(e.changePercent):typeof e.changeAmount==`number`?Na(e.changeAmount):Ma}var Va={class:`kline-tooltip__title`},Ha={key:0},Ua={class:`kline-tooltip__grid`},Wa={class:`row`},Ga={class:`row`},Ka={class:`row`},qa={class:`row`},Ja={key:0,class:`row`},Ya={key:1,class:`row`},Xa={key:2,class:`row`},Za={key:3,class:`row`},Qa={key:4,class:`row`},$a={key:5,class:`row`},eo=(0,f.defineComponent)({__name:`KLineTooltip`,props:{k:{},index:{},data:{},pos:{},useAnchor:{type:Boolean},anchorPlacement:{},setEl:{type:Function}},setup(e){let t=e,n=(0,f.computed)(()=>t.useAnchor===!0),r=(0,f.computed)(()=>t.anchorPlacement===`left-bottom`?`anchor-left-bottom`:`anchor-right-bottom`);function i(e){t.setEl?.(e)}let a=(0,f.computed)(()=>{let e=t.k;if(!e)return Ma;let n=t.index;return Ra(e,typeof n==`number`&&n>0?t.data[n-1]:void 0)}),o=(0,f.computed)(()=>{let e=t.k;return e?za(e):Ma}),s=(0,f.computed)(()=>{let e=t.k;return e?Ba(e):Ma});return(t,c)=>e.k?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,ref:i,class:(0,f.normalizeClass)([`kline-tooltip`,[{"use-anchor":n.value},r.value]]),style:(0,f.normalizeStyle)(n.value?void 0:{left:`${e.pos.x}px`,top:`${e.pos.y}px`})},[(0,f.createElementVNode)(`div`,Va,[e.k.stockCode?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Ha,(0,f.toDisplayString)(e.k.stockCode),1)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(fa)(e.k.timestamp)),1)]),(0,f.createElementVNode)(`div`,Ua,[(0,f.createElementVNode)(`div`,Wa,[c[0]||=(0,f.createElementVNode)(`span`,null,`开`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:a.value})},(0,f.toDisplayString)(e.k.open.toFixed(2)),5)]),(0,f.createElementVNode)(`div`,Ga,[c[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`,Ka,[c[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`,qa,[c[3]||=(0,f.createElementVNode)(`span`,null,`收`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:o.value})},(0,f.toDisplayString)(e.k.close.toFixed(2)),5)]),typeof e.k.volume==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ja,[c[4]||=(0,f.createElementVNode)(`span`,null,`成交量`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(Pa)(e.k.volume)),1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.turnover==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ya,[c[5]||=(0,f.createElementVNode)(`span`,null,`成交额`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(Pa)(e.k.turnover)),1)])):(0,f.createCommentVNode)(``,!0),typeof e.k.amplitude==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Xa,[c[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`,Za,[c[7]||=(0,f.createElementVNode)(`span`,null,`涨跌幅`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:s.value})},(0,f.toDisplayString)((0,f.unref)(La)(e.k.changePercent)),5)])):(0,f.createCommentVNode)(``,!0),typeof e.k.changeAmount==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Qa,[c[8]||=(0,f.createElementVNode)(`span`,null,`涨跌额`,-1),(0,f.createElementVNode)(`span`,{style:(0,f.normalizeStyle)({color:s.value})},(0,f.toDisplayString)((0,f.unref)(Fa)(e.k.changeAmount)),5)])):(0,f.createCommentVNode)(``,!0),typeof e.k.turnoverRate==`number`?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,$a,[c[9]||=(0,f.createElementVNode)(`span`,null,`换手率`,-1),(0,f.createElementVNode)(`span`,null,(0,f.toDisplayString)((0,f.unref)(Ia)(e.k.turnoverRate)),1)])):(0,f.createCommentVNode)(``,!0)])],6)):(0,f.createCommentVNode)(``,!0)}}),to=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},no=to(eo,[[`__scopeId`,`data-v-d0fe85e6`]]),ro={RISE_WITH_VOLUME:`量价齐升`,RISE_WITHOUT_VOLUME:`量缩价升`,FALL_WITH_VOLUME:`量价齐缩`,FALL_WITHOUT_VOLUME:`量升价缩`},io=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&&Wi(e,t,r.shape,r.x,r.y,r.size))return n}return null}},ao={class:`marker-tooltip__title`},oo={key:0,class:`marker-tooltip__content`},so=to((0,f.defineComponent)({__name:`MarkerTooltip`,props:{marker:{},pos:{},useAnchor:{type:Boolean},anchorPlacement:{},setEl:{type:Function}},setup(e){let t=e,n=(0,f.computed)(()=>t.useAnchor===!0),r=(0,f.computed)(()=>t.anchorPlacement===`left-bottom`?`anchor-left-bottom`:`anchor-right-bottom`);function i(e){t.setEl?.(e)}let a=(0,f.computed)(()=>t.marker&&`date`in t.marker),o=(0,f.computed)(()=>{if(!t.marker)return``;if(a.value){let e=t.marker;return e.label?.text||e.shape}let e=t.marker;return ro[e.markerType]||e.markerType}),s=(0,f.computed)(()=>{if(!t.marker)return{};if(a.value){let e=t.marker;return{日期:e.date,...e.metadata}}return t.marker.metadata}),c=(0,f.computed)(()=>Object.keys(s.value).length>0);function l(e){return typeof e==`number`?e.toFixed(2):String(e)}return(t,a)=>e.marker?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,ref:i,class:(0,f.normalizeClass)([`marker-tooltip`,[{"use-anchor":n.value},r.value]]),style:(0,f.normalizeStyle)(n.value?void 0:{left:`${e.pos.x+12}px`,top:`${e.pos.y+12}px`})},[(0,f.createElementVNode)(`div`,ao,(0,f.toDisplayString)(o.value),1),c.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,oo,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(s.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)(l(e)),1)]))),128))])):(0,f.createCommentVNode)(``,!0)],6)):(0,f.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-5574cc25`]]),co={class:`params-header`},lo={class:`header-left`},uo={class:`params-title`},fo={class:`header-right`},po={key:0,class:`indicator-description`},mo={class:`params-body`},ho={class:`param-header`},go={class:`param-label`},_o={class:`param-label-text`},vo={key:0,class:`param-range`},yo={class:`input-wrapper`},bo=[`disabled`,`onClick`],xo=[`value`,`min`,`max`,`step`,`onInput`],So=[`disabled`,`onClick`],Co={key:0,class:`param-description`},wo={class:`params-footer`},To={class:`footer-right`},Eo=to((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`,co,[(0,f.createElementVNode)(`div`,lo,[(0,f.createElementVNode)(`span`,uo,(0,f.toDisplayString)(e.indicatorName),1),n[5]||=(0,f.createElementVNode)(`span`,{class:`params-subtitle`},`参数设置`,-1)]),(0,f.createElementVNode)(`div`,fo,[(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`,po,[(0,f.createElementVNode)(`p`,null,(0,f.toDisplayString)(e.indicatorDescription),1)])):(0,f.createCommentVNode)(``,!0)]),_:1}),(0,f.createElementVNode)(`div`,mo,[((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`,ho,[(0,f.createElementVNode)(`label`,go,[(0,f.createElementVNode)(`span`,_o,(0,f.toDisplayString)(e.label),1),e.min!==void 0||e.max!==void 0?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,vo,(0,f.toDisplayString)(e.min??`-∞`)+` ~ `+(0,f.toDisplayString)(e.max??`+∞`),1)):(0,f.createCommentVNode)(``,!0)]),(0,f.createElementVNode)(`div`,yo,[(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,bo),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,xo)):(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,So)])]),(0,f.createVNode)(f.Transition,{name:`slide`},{default:(0,f.withCtx)(()=>[a.value&&e.description?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Co,(0,f.toDisplayString)(e.description),1)):(0,f.createCommentVNode)(``,!0)]),_:2},1024)],2))),128))]),(0,f.createElementVNode)(`div`,wo,[(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`,To,[(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`]]),Do={class:`indicator-selector`},Oo={class:`indicator-scroll-container`},ko={class:`indicator-list`},Ao={key:0,class:`indicator-divider`,"aria-hidden":`true`},jo=[`draggable`,`onDragstart`,`onDragover`,`onDrop`],Mo=[`onMouseenter`],No={class:`btn-content`},Po={key:0,class:`param-hint`},Fo={key:0,class:`hover-overlay`},Io=[`onClick`],Lo={key:1,class:`divider`},Ro=[`onClick`],zo={class:`indicator-item`},Bo={class:`menu-section`},Vo={class:`menu-items`},Ho=[`disabled`,`onClick`],Uo={class:`param-hint`},Wo={key:0,class:`active-tag`},Go={class:`menu-section`},Ko={class:`menu-items`},qo=[`disabled`,`onClick`],Jo={class:`param-hint`},Yo={key:0,class:`active-tag`},Xo=to((0,f.defineComponent)({__name:`IndicatorSelector`,props:{activeIndicators:{},indicatorParams:{}},emits:[`toggle`,`updateParams`,`reorderSubIndicators`],setup(e,{emit:t}){let n=[{id:`MA`,label:`MA`,name:`均线`,pane:`main`},{id:`VOLUME`,label:`VOL`,name:`成交量`,pane:`sub`,description:`成交量反映市场活跃度,柱状图显示每根K线的交易量。上涨时柱子为红色,下跌时为绿色。`},{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.ref)(!1),g=(0,f.ref)(null),_=(0,f.ref)(null),v=(0,f.computed)(()=>a.activeIndicators?.length?a.activeIndicators.map(e=>n.find(t=>t.id===e)).filter(e=>e!==void 0).sort((e,t)=>e.pane===t.pane?0:e.pane===`main`?-1:1):[]),y=(0,f.computed)(()=>v.value.some(e=>e.pane===`main`)?v.value.find(e=>e.pane===`sub`)?.id??null:null),b=(0,f.computed)(()=>u.value&&n.find(e=>e.id===u.value)||null);function x(e){return a.activeIndicators?.includes(e)??!1}function S(e){if(x(e))return;let t=n.find(t=>t.id===e);t&&(t.pane===`main`&&n.filter(t=>t.pane===`main`&&t.id!==e&&x(t.id)).forEach(e=>o(`toggle`,e.id,!1)),o(`toggle`,e,!0),p.value=!1)}function C(e){o(`toggle`,e,!1)}function w(e){u.value=e,l.value=!0}function T(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 E(e){let t=T(e.id);return e.params?e.params.map(e=>t[e.key]??``).join(`,`):``}function D(e){u.value&&o(`updateParams`,u.value,e),l.value=!1}function O(e){return n.find(t=>t.id===e)?.pane===`sub`}function k(e,t){if(!O(t)){e.preventDefault();return}_.value=t,g.value=null,e.dataTransfer?.setData(`text/plain`,t),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`)}function A(e,t){!_.value||!O(t)||_.value===t||(g.value=t,e.dataTransfer&&(e.dataTransfer.dropEffect=`move`))}function j(e,t){let n=_.value||e.dataTransfer?.getData(`text/plain`)||``;if(!n||n===t){M();return}if(!O(n)||!O(t)){M();return}let r=v.value.findIndex(e=>e.id===n),i=v.value.findIndex(e=>e.id===t);if(r<0||i<0){M();return}let a=[...v.value.map(e=>e.id)],[s]=a.splice(r,1);if(!s){M();return}a.splice(i,0,s),o(`reorderSubIndicators`,a.filter(e=>O(e))),M()}function M(){g.value=null,_.value=null}function N(){if(!p.value&&s.value&&!h.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 ee(e){let t=c.value&&!c.value.contains(e.target),n=s.value&&!s.value.contains(e.target);t&&n&&(p.value=!1)}function te(){p.value&&=!1}return(0,f.onMounted)(()=>{h.value=typeof CSS<`u`&&CSS.supports(`anchor-name: --kmap-anchor`)&&CSS.supports(`position-anchor: --kmap-anchor`),document.addEventListener(`click`,ee),window.addEventListener(`resize`,te)}),(0,f.onUnmounted)(()=>{document.removeEventListener(`click`,ee),window.removeEventListener(`resize`,te)}),(e,t)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Do,[(0,f.createElementVNode)(`div`,Oo,[(0,f.createElementVNode)(`div`,ko,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(v.value,e=>((0,f.openBlock)(),(0,f.createElementBlock)(f.Fragment,{key:e.id},[e.id===y.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,Ao)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`div`,{class:(0,f.normalizeClass)([`indicator-item`,{draggable:O(e.id),"drag-over":g.value===e.id,"is-dragging":_.value===e.id}]),draggable:O(e.id),onDragstart:t=>k(t,e.id),onDragover:(0,f.withModifiers)(t=>A(t,e.id),[`prevent`]),onDrop:(0,f.withModifiers)(t=>j(t,e.id),[`prevent`]),onDragend:M},[(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`,No,[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Po,` (`+(0,f.toDisplayString)(E(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`,Fo,[e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:0,class:`action-btn settings-btn`,onClick:(0,f.withModifiers)(t=>w(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,Io)):(0,f.createCommentVNode)(``,!0),e.params?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Lo)):(0,f.createCommentVNode)(``,!0),(0,f.createElementVNode)(`button`,{class:`action-btn remove-btn`,onClick:(0,f.withModifiers)(t=>C(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,Ro)])):(0,f.createCommentVNode)(``,!0)]),_:2},1024)],2)],40,Mo)],42,jo)],64))),128)),(0,f.createElementVNode)(`div`,zo,[(0,f.createElementVNode)(`button`,{ref_key:`addBtnRef`,ref:s,class:`add-btn`,onClick:N,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:(0,f.normalizeClass)([`add-menu`,{"use-anchor":h.value}]),ref_key:`addMenuRef`,ref:c,style:(0,f.normalizeStyle)(h.value?void 0:m.value)},[(0,f.createElementVNode)(`div`,Bo,[t[6]||=(0,f.createElementVNode)(`div`,{class:`menu-title`},`主图指标`,-1),(0,f.createElementVNode)(`div`,Vo,[((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:x(e.id)}]),disabled:x(e.id),onClick:t=>S(e.id)},[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),(0,f.createElementVNode)(`span`,Uo,` (`+(0,f.toDisplayString)(e.name)+`) `,1),x(e.id)?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Wo,[...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,Ho))),128))])]),(0,f.createElementVNode)(`div`,Go,[t[8]||=(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)(i),e=>((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:e.id,class:(0,f.normalizeClass)([`menu-item`,{disabled:x(e.id)}]),disabled:x(e.id),onClick:t=>S(e.id)},[(0,f.createTextVNode)((0,f.toDisplayString)(e.label)+` `,1),(0,f.createElementVNode)(`span`,Jo,` (`+(0,f.toDisplayString)(e.name)+`) `,1),x(e.id)?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,Yo,[...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,qo))),128))])])],6)):(0,f.createCommentVNode)(``,!0)]),_:1})])),b.value?((0,f.openBlock)(),(0,f.createBlock)(Eo,{key:0,visible:l.value,"indicator-id":b.value.id,"indicator-name":b.value.name,"indicator-description":b.value.description,params:b.value.params||[],values:T(b.value.id),onClose:t[1]||=e=>l.value=!1,onConfirm:D},null,8,[`visible`,`indicator-id`,`indicator-name`,`indicator-description`,`params`,`values`])):(0,f.createCommentVNode)(``,!0)]))}}),[[`__scopeId`,`data-v-4b90c954`]]),Zo={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Qo(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Zo,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 7h16m-10 4v6m4-6v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`},null,-1)]])}var $o=(0,f.markRaw)({name:`tabler-trash`,render:Qo}),es={class:`toolbar-item color-item`,title:`颜色`},ts=[`value`],ns=[`value`],rs=[`value`],is=to((0,f.defineComponent)({__name:`DrawingStyleToolbar`,props:{drawing:{}},emits:[`updateStyle`,`delete`],setup(e,{emit:t}){let n=t;function r(e){n(`updateStyle`,{stroke:e})}function i(e){n(`updateStyle`,{strokeWidth:e})}function a(e){n(`updateStyle`,{strokeStyle:e})}return(t,n)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{class:`drawing-style-toolbar`,onPointerdown:n[4]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[5]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[6]||=(0,f.withModifiers)(()=>{},[`stop`])},[(0,f.createElementVNode)(`div`,es,[(0,f.createElementVNode)(`span`,{class:`color-swatch`,style:(0,f.normalizeStyle)({background:e.drawing.style.stroke??`#2962ff`})},null,4),(0,f.createElementVNode)(`input`,{type:`color`,class:`color-input`,value:e.drawing.style.stroke??`#2962ff`,onInput:n[0]||=e=>r(e.target.value)},null,40,ts)]),(0,f.createElementVNode)(`select`,{class:`toolbar-select`,value:e.drawing.style.strokeWidth??1,onChange:n[1]||=e=>i(Number(e.target.value)),title:`线宽`},[...n[7]||=[(0,f.createElementVNode)(`option`,{value:1},`1px`,-1),(0,f.createElementVNode)(`option`,{value:2},`2px`,-1),(0,f.createElementVNode)(`option`,{value:3},`3px`,-1),(0,f.createElementVNode)(`option`,{value:4},`4px`,-1)]],40,ns),(0,f.createElementVNode)(`select`,{class:`toolbar-select`,value:e.drawing.style.strokeStyle??`solid`,onChange:n[2]||=e=>a(e.target.value),title:`线型`},[...n[8]||=[(0,f.createElementVNode)(`option`,{value:`solid`},`实线`,-1),(0,f.createElementVNode)(`option`,{value:`dashed`},`虚线`,-1),(0,f.createElementVNode)(`option`,{value:`dotted`},`点线`,-1)]],40,rs),(0,f.createElementVNode)(`button`,{type:`button`,class:`toolbar-btn delete-btn`,title:`删除`,onClick:n[3]||=e=>t.$emit(`delete`)},[(0,f.createVNode)((0,f.unref)($o),{class:`delete-icon`,"aria-hidden":`true`})])],32))}}),[[`__scopeId`,`data-v-088ccef5`]]);function as(e,t){let n=Math.round(e*t);return n%2==0&&(n+=1),Math.max(1,n)}function X(e,t,n){let r=as(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 os(e,t,n,r,i,a=1){let{unitPx:o,startXPx:s}=X(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 ss(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 cs=class{range={maxPrice:100,minPrice:0};height=1;paddingTop=0;paddingBottom=0;priceOffset=0;verticalScale=1;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=this.clampOffset(e)}getPriceOffset(){return this.priceOffset}resetPriceOffset(){this.priceOffset=0}clampOffset(e){let t=this.range.maxPrice-this.range.minPrice;if(t<=0)return 0;let n=t*(1+1/this.verticalScale)/2;return Math.max(-n,Math.min(n,e))}scaleByDelta(e){if(!Number.isFinite(e)||e===0)return;let t=Math.exp(-e*.01),n=this.verticalScale*t;this.verticalScale=Math.min(8,Math.max(.2,n)),this.priceOffset=this.clampOffset(this.priceOffset)}getVerticalScale(){return this.verticalScale}getDisplayRange(e){let t=e??this.range,n=t.minPrice,r=t.maxPrice,i=r-n||1,a=(r+n)/2+this.priceOffset,o=i/(2*this.verticalScale);return{maxPrice:a+o,minPrice:a-o}}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),s=this.paddingTop+o*(1-a),c=this.paddingTop+o/2;return c+(s-c)*this.verticalScale}yToPrice(e){let{maxPrice:t,minPrice:n}=this.range,r=t-n||1,i=Math.max(1,this.height-this.paddingTop-this.paddingBottom),a=this.paddingTop+i/2;return n+(1-(a+(e-a)/this.verticalScale-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))}};function ls(e){return e===`price`?{showPriceAxisTicks:!0,showCrosshairPriceLabel:!0,candleHitTest:!0,supportsPriceTranslate:!0}:e===`indicator`?{showPriceAxisTicks:!1,showCrosshairPriceLabel:!0,candleHitTest:!1,supportsPriceTranslate:!0}:{showPriceAxisTicks:!1,showCrosshairPriceLabel:!1,candleHitTest:!1,supportsPriceTranslate:!1}}var us=class{id;role;capabilities;top=0;height=0;priceRange={maxPrice:100,minPrice:0};yAxis=new cs;renderers=[];constructor(e,t={}){this.id=e,this.role=t.role??(e===`main`?`price`:`indicator`),this.capabilities={...ls(this.role),...t.capabilities??{}}}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=ss(e,t.start,t.end),this.yAxis.setRange(this.priceRange)}},ds=class{chart;isDragging=!1;dragMode=`none`;dragStartX=0;scrollStartX=0;applyPanScroll(e,t){let n=Math.max(0,e.scrollWidth-e.clientWidth),r=Math.min(Math.max(0,t),n),i=this.chart.getCurrentDpr();e.scrollLeft=Math.round(r*i)/i}dragStartY=0;activePaneIdOnDrag=null;activeSeparatorUpperPaneId=null;hoveredSeparatorUpperPaneId=null;hoveredRightAxisPaneId=null;isTouchSession=!1;activePointers=new Map;lastPinchDistance=0;pinchCenter={x:0,y:0};isPinching=!1;onPinchZoomCallback;crosshairPos=null;crosshairIndex=null;crosshairPrice=null;hoveredIndex=null;activePaneId=null;tooltipPos={x:0,y:0};tooltipSize={width:220,height:180};tooltipAnchorPlacement=`right-bottom`;useTooltipAnchorPositioning=!1;onInteractionChangeCallback;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}setOnPinchZoom(e){this.onPinchZoomCallback=e}getInteractionSnapshot(){return{crosshairPos:this.crosshairPos?{...this.crosshairPos}:null,crosshairIndex:this.crosshairIndex,crosshairPrice:this.crosshairPrice,hoveredIndex:this.hoveredIndex,activePaneId:this.activePaneId,tooltipPos:{...this.tooltipPos},tooltipAnchorPlacement:this.tooltipAnchorPlacement,hoveredMarkerData:this.hoveredMarkerData,hoveredCustomMarker:this.hoveredCustomMarker,isDragging:this.isDragging,isResizingPaneBoundary:this.dragMode===`resize-separator`,isHoveringPaneBoundary:this.hoveredSeparatorUpperPaneId!==null,hoveredPaneBoundaryId:this.hoveredSeparatorUpperPaneId,isHoveringRightAxis:this.hoveredRightAxisPaneId!==null}}setOnInteractionChange(e){this.onInteractionChangeCallback=e}notifyInteractionChange(){this.onInteractionChangeCallback?.(this.getInteractionSnapshot())}onPointerDown(e){if(this.isTouchSession=e.pointerType===`touch`,this.activePointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.activePointers.size===2&&this.isTouchSession){this.isPinching=!0,this.isDragging=!1,this.dragMode=`none`;let e=Array.from(this.activePointers.values()),t=e[0],n=e[1];this.lastPinchDistance=Math.hypot(n.x-t.x,n.y-t.y),this.pinchCenter={x:(t.x+n.x)/2,y:(t.y+n.y)/2};return}if(e.isPrimary===!1||this.isPinching||this.activePointers.size>1)return;let t=this.getPlotPointerLocation(e.clientX,e.clientY);if(!t)return;let n=this.chart.getDom().container,{mouseX:r,mouseY:i}=t,a=n.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.hitTestPaneSeparator(i);if(l){this.isDragging=!0,this.dragMode=`resize-separator`,this.dragStartY=e.clientY,this.activeSeparatorUpperPaneId=l,this.hoveredSeparatorUpperPaneId=l,this.clearHover(),this.chart.scheduleDraw();return}let u=this.getPaneByY(i);this.isDragging=!0,this.dragMode=`pan`,this.updatePlotHoverFromPoint(e.clientX,e.clientY),this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.scrollStartX=n.scrollLeft,this.activePaneIdOnDrag=u?.id||null,this.chart.scheduleDraw()}setTooltipSize(e){this.tooltipSize=e}setTooltipAnchorPositioning(e){this.useTooltipAnchorPositioning=e}onPointerUp(e){this.activePointers.delete(e.pointerId),this.isPinching&&this.activePointers.size<2&&(this.isPinching=!1,this.lastPinchDistance=0),e.isPrimary!==!1&&(this.isDragging=!1,this.dragMode=`none`,this.activePaneIdOnDrag=null,this.activeSeparatorUpperPaneId=null,this.notifyInteractionChange())}onPointerLeave(e){this.activePointers.delete(e.pointerId),this.activePointers.size<2&&(this.isPinching=!1,this.lastPinchDistance=0),e.isPrimary!==!1&&(this.isDragging=!1,this.dragMode=`none`,this.activePaneIdOnDrag=null,this.clearSeparatorState(),this.isTouchSession=!1,this.clearHover(),this.chart.scheduleDraw(),this.notifyInteractionChange())}onScroll(){this.kLinePositions=null,this.visibleRange=null,this.clearHover(),this.chart.scheduleDraw(),this.notifyInteractionChange()}onPointerMove(e){if(this.activePointers.has(e.pointerId)&&this.activePointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.isPinching&&this.activePointers.size===2){let e=Array.from(this.activePointers.values()),t=e[0],n=e[1],r=Math.hypot(n.x-t.x,n.y-t.y),i=r-this.lastPinchDistance;if(Math.abs(i)>10){let e=i>0?1:-1,a=(t.x+n.x)/2;this.onPinchZoomCallback?.(e,a),this.lastPinchDistance=r}return}if(!e.isPrimary)return;e.pointerType===`touch`&&(this.isTouchSession=!0);let t=this.chart.getDom().container;if(this.isDragging){if(this.dragMode===`resize-separator`){let t=e.clientY-this.dragStartY;t!==0&&this.activeSeparatorUpperPaneId&&this.chart.resizePaneBoundary(this.activeSeparatorUpperPaneId,t)&&(this.dragStartY=e.clientY);return}if(this.dragMode===`scale-price`){let t=e.clientY-this.dragStartY;t!==0&&this.activePaneIdOnDrag&&(this.chart.scalePrice(this.activePaneIdOnDrag,t),this.dragStartY=e.clientY);return}if(this.dragMode===`pan`){let n=this.dragStartX-e.clientX;this.applyPanScroll(t,this.scrollStartX+n);let r=e.clientY-this.dragStartY;r!==0&&this.activePaneIdOnDrag===`main`&&(this.chart.translatePrice(this.activePaneIdOnDrag,r),this.dragStartY=e.clientY)}return}let n=this.getPlotPointerLocation(e.clientX,e.clientY);n&&(this.hoveredSeparatorUpperPaneId=this.hitTestPaneSeparator(n.mouseY),this.updatePlotHoverFromPoint(e.clientX,e.clientY),this.chart.scheduleDraw(),this.notifyInteractionChange())}setKLinePositions(e,t,n){this.kLinePositions=e,this.visibleRange=t,n!==void 0&&(this.kWidthPx=n)}onRightAxisPointerDown(e){if(e.isPrimary===!1)return;this.isTouchSession=e.pointerType===`touch`;let t=this.getRightAxisPointerLocation(e.clientX,e.clientY);t&&this.beginScalePriceDrag(e.clientY,t.mouseY)&&(this.chart.scheduleDraw(),this.notifyInteractionChange())}onRightAxisPointerMove(e){if(e.isPrimary){if(e.pointerType===`touch`&&(this.isTouchSession=!0),this.isDragging&&this.dragMode===`scale-price`){let t=e.clientY-this.dragStartY;t!==0&&this.activePaneIdOnDrag&&(this.chart.scalePrice(this.activePaneIdOnDrag,t),this.dragStartY=e.clientY);return}this.updateRightAxisHoverFromPoint(e.clientX,e.clientY),this.chart.scheduleDraw(),this.notifyInteractionChange()}}onRightAxisPointerUp(e){this.onPointerUp(e)}onRightAxisPointerLeave(e){e.isPrimary!==!1&&(this.isDragging&&this.dragMode===`scale-price`||(this.hoveredRightAxisPaneId=null,this.notifyInteractionChange()))}isDraggingState(){return this.isDragging}setOnMarkerHover(e){this.onMarkerHoverCallback=e}setOnMarkerClick(e){this.onMarkerClickCallback=e}setOnCustomMarkerHover(e){this.onCustomMarkerHoverCallback=e}setOnCustomMarkerClick(e){this.onCustomMarkerClickCallback=e}hitTestPaneSeparator(e){let t=this.chart.getPaneRenderers();if(t.length<2)return null;for(let n=0;n<t.length-1;n++){let r=t[n]?.getPane(),i=t[n+1]?.getPane();if(!r||!i)continue;let a=r.top+r.height;if(Math.abs(e-a)<=5)return r.id}return null}getPaneByY(e){return this.chart.getPaneRenderers().find(t=>{let n=t.getPane();return e>=n.top&&e<=n.top+n.height})?.getPane()||null}getPlotPointerLocation(e,t){let n=this.chart.getDom().container.getBoundingClientRect();return{mouseX:e-n.left,mouseY:t-n.top}}getRightAxisPointerLocation(e,t){let n=this.chart.getDom().rightAxisLayer.getBoundingClientRect();return{mouseX:e-n.left,mouseY:t-n.top}}beginScalePriceDrag(e,t){let n=this.getPaneByY(t);return n?(this.isDragging=!0,this.dragMode=`scale-price`,this.dragStartY=e,this.activePaneIdOnDrag=n.id,this.hoveredRightAxisPaneId=n.id,this.hoveredSeparatorUpperPaneId=null,this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=n.id,!0):!1}clearHover(){this.hoveredRightAxisPaneId=null,this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=null,this.hoveredMarkerId===null?this.hoveredMarkerData=null:(this.hoveredMarkerId=null,this.hoveredMarkerData=null,this.chart.getMarkerManager().setHover(null),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null)),this.hoveredCustomMarker!==null&&(this.hoveredCustomMarker=null,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(null))}clearSeparatorState(){this.activeSeparatorUpperPaneId=null,this.hoveredSeparatorUpperPaneId=null,this.hoveredRightAxisPaneId=null}updateRightAxisHoverFromPoint(e,t){let n=this.getRightAxisPointerLocation(e,t);if(!n)return;let{mouseY:r}=n,i=this.chart.getViewport()?.plotHeight??Math.max(1,Math.round(this.chart.getDom().container.clientHeight));if(r<0||r>i){this.hoveredRightAxisPaneId=null;return}let a=this.getPaneByY(r);this.hoveredRightAxisPaneId=a?.id||null,this.hoveredSeparatorUpperPaneId=null,this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null,this.activePaneId=a?.id||null}updatePlotHoverFromPoint(e,t){let n=this.getPlotPointerLocation(e,t);if(!n)return;let{mouseX:r,mouseY:i}=n,a=this.chart.getDom().container,o=this.chart.getViewport(),s=o?.viewWidth??Math.max(1,Math.round(a.clientWidth)),c=o?.viewHeight??Math.max(1,Math.round(a.clientHeight)),l=o?.plotWidth??s,u=o?.plotHeight??c;if(r<0||i<0||r>l||i>u){this.clearHover();return}this.hoveredRightAxisPaneId=null;let d=a.scrollLeft,f=this.chart.getCurrentDpr(),p=this.hitTestPaneSeparator(i);if(this.hoveredSeparatorUpperPaneId=p,p){this.clearHover();return}let m=this.chart.getMarkerManager(),h=d+r,g=m.hitTest(h,i,3);if(g){this.hoveredMarkerId!==g.id&&(this.hoveredMarkerId=g.id,this.hoveredMarkerData=g,m.setHover(g.id),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(g)),this.hoveredCustomMarker!==null&&(this.hoveredCustomMarker=null,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(null)),this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=null,this.hoveredIndex=null;return}else this.hoveredMarkerId!==null&&(this.hoveredMarkerId=null,this.hoveredMarkerData=null,m.setHover(null),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null));let _=m.hitTestCustomMarker(r,i);if(_){this.hoveredCustomMarker?.id!==_.id&&(this.hoveredCustomMarker=_,this.onCustomMarkerHoverCallback&&this.onCustomMarkerHoverCallback(_)),this.hoveredMarkerId!==null&&(this.hoveredMarkerId=null,this.hoveredMarkerData=null,m.setHover(null),this.onMarkerHoverCallback&&this.onMarkerHoverCallback(null)),this.crosshairPos=null,this.crosshairIndex=null,this.crosshairPrice=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 v=this.kWidthPx/f,y=0,b=this.kLinePositions.length;for(;y<b;){let e=y+b>>1;this.kLinePositions[e]<h?y=e+1:b=e}let x=y;if(y>0&&y<this.kLinePositions.length){let e=this.kLinePositions[y-1]+v/2,t=this.kLinePositions[y]+v/2;Math.abs(h-e)<Math.abs(h-t)&&(x=y-1)}else y===this.kLinePositions.length&&this.kLinePositions.length>0&&(x=this.kLinePositions.length-1);let S=x+this.visibleRange.start,C=this.chart.getData(),w=this.getPaneByY(i);if(this.activePaneId=w?.id||null,S>=0&&S<(C?.length??0)){this.crosshairIndex=S;let e=this.kLinePositions[x]+(this.kWidthPx-1)/2/f-d;if(this.crosshairPos={x:Math.min(Math.max(e,0),l),y:Math.min(Math.max(i,0),u)},w){let e=i-w.top;this.crosshairPrice=w.yAxis.yToPrice(e)}else this.crosshairPrice=null}else this.crosshairIndex=null,this.crosshairPos=null,this.crosshairPrice=null;let T=typeof this.crosshairIndex==`number`?C[this.crosshairIndex]:void 0;if(!T||!w||!w.capabilities.candleHitTest){this.hoveredIndex=null;return}let E=i-w.top,D=w.yAxis.priceToY(T.open),O=w.yAxis.priceToY(T.close),k=w.yAxis.priceToY(T.high),A=w.yAxis.priceToY(T.low),j=Math.min(D,O),M=Math.max(D,O),N=h-this.kLinePositions[x],ee=v/2,te=Math.abs(M-j),ne=te<8?(j+M)/2-8/2:j,re=te<8?(j+M)/2+8/2:M,ie=E>=ne&&E<=re&&N>=0&&N<=v,ae=Math.abs(N-ee)<=3&&E>=Math.min(k,A)&&E<=Math.max(k,A);if(!ie&&!ae){this.hoveredIndex=null;return}if(this.hoveredIndex=this.crosshairIndex,this.useTooltipAnchorPositioning){let e=this.tooltipSize.width,t=r+14+e+12>l;this.tooltipAnchorPlacement=t?`left-bottom`:`right-bottom`,this.tooltipPos={x:Math.min(Math.max(r,12),Math.max(12,l-12)),y:Math.min(Math.max(i,12),Math.max(12,u-12))};return}let oe=this.tooltipSize.width,se=this.tooltipSize.height,ce=r+14,le=r-14-oe,ue=ce+oe+12<=s?ce:le,de=i+14,fe=Math.max(12,s-oe-12),pe=Math.max(12,c-se-12);this.tooltipPos={x:Math.min(Math.max(ue,12),fe),y:Math.min(Math.max(de,12),pe)}}reset(){this.isDragging=!1,this.dragMode=`none`,this.dragStartX=0,this.dragStartY=0,this.scrollStartX=0,this.activePaneIdOnDrag=null,this.clearSeparatorState(),this.isTouchSession=!1,this.activePointers.clear(),this.isPinching=!1,this.lastPinchDistance=0,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.hoveredCustomMarker=null,this.kLinePositions=null,this.visibleRange=null,this.kWidthPx=null}getCrosshairIndex(){return this.crosshairIndex}},fs=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 ps(e){let{dataLength:t,kWidth:n,kGap:r,viewWidth:i,viewportDpr:a}=e;if(t===0)return 0;let{startXPx:o,unitPx:s}=X(n,r,a),c=(o+(t+24)*s)/a;return Math.max(c,i)}function ms(e){let t=(0,f.reactive)({zoomLevel:e.initialZoomLevel,kWidth:0,kGap:1,viewportDpr:1,dataLength:0,dataVersion:0,paneRatios:{},drawings:[],selectedDrawingId:null,drawingVersion:0,viewWidth:0}),n=(0,f.computed)(()=>e.rightAxisWidth+e.priceLabelWidth),r=(0,f.computed)(()=>ps({dataLength:t.dataLength,kWidth:t.kWidth,kGap:t.kGap,viewWidth:t.viewWidth,viewportDpr:t.viewportDpr}));function i(){t.dataVersion++}function a(){t.drawingVersion++}function o(e){t.dataLength=e}function s(e){t.viewportDpr=e}function c(e){t.viewWidth=e}function l(e,n,r){t.zoomLevel=e,t.kWidth=n,t.kGap=r}function u(e){t.paneRatios=e}function d(e){t.drawings=e,t.selectedDrawingId&&!e.some(e=>e.id===t.selectedDrawingId)&&(t.selectedDrawingId=null),t.drawingVersion++}function p(e){t.selectedDrawingId=e}return{state:t,computed:{axisHostWidth:n,totalWidth:r},actions:{bumpDataVersion:i,bumpDrawingVersion:a,setDataLength:o,setViewportDpr:s,setViewWidth:c,setZoomState:l,setPaneRatios:u,setDrawings:d,setSelectedDrawingId:p}}}var hs=(e,t)=>`indicator:${e}:${t}`;function gs(e={}){let{paneId:t=`sub`}=e,n=hs(`volume`,t),r=null;return{name:`volume_${t}`,version:`1.0.0`,description:`成交量渲染器`,debugName:`成交量`,paneId:t,priority:K.MAIN,onInstall(e){r=e},getDeclaredNamespaces(){return[n]},draw(e){let{ctx:i,pane:a,data:o,range:s,scrollLeft:c,kWidth:l,kGap:u,dpr:d,kLinePositions:f}=e,p=o;if(!p.length)return;i.save(),i.translate(-c,0);let{start:m,end:h}=s,g=0,_=1/0;for(let e=m;e<h&&e<p.length;e++){let t=p[e];if(!t)continue;let n=t.volume;n!=null&&(g=Math.max(g,n),_=Math.min(_,n))}if(g===0||!Number.isFinite(_)){i.restore();return}let v=Math.max(.05,(g-_)*.1),y=Math.max(0,_-v),b=g+v,x=a.yAxis.getDisplayRange({minPrice:y,maxPrice:b}),S=x.minPrice,C=x.maxPrice-S||1,w=a.height-(0-S)/C*a.height;r?.setSharedState(n,{valueMin:y,valueMax:b,timestamp:Date.now()},`volume_${t}`);for(let e=m;e<h;e++){let t=p[e];if(!t)continue;let n=t.volume;if(!n)continue;let r=f[e-m];if(r===void 0)continue;let o=f[e-m+1],s=f[e-m-1],c=Math.max(1,Math.round((l+u)*d)),h=o===void 0?s===void 0?c:Math.max(1,Math.round((r-s)*d)):Math.max(1,Math.round((o-r)*d)),g=Math.max(1,h-1)/d;_s(i,Math.round((r+(l-g)/2)*d)/d,vs(t),n,g,S,C,w,a.height,d)}i.restore()}}}function _s(e,t,n,r,i,a,o,s,c,l){let u=c-(r-a)/o*c,d=Math.round(u*l)/l,f=Math.round(s*l)/l,p=1/l,m=f-d,h=m<=0?p:Math.max(m,p),g=m<=0?f-p:f-h;e.fillStyle=n,e.fillRect(t,g,i,h)}function vs(e){return e.close>e.open?ba.UP:e.close<e.open?ba.DOWN:ba.NEUTRAL}function Z(e,t){return Math.round(e*t)/t}function Q(e,t){return(Math.floor(e*t)+.5)/t}function ys(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 bs(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 xs(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 Ss(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 Cs(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=Ss(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:K.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,J.MA5),t.ma10&&a(n,i(s,10),e,J.MA10),t.ma20&&a(n,i(s,20),e,J.MA20),t.ma30&&a(n,i(s,30),e,J.MA30),t.ma60&&a(n,i(s,60),e,J.MA60),n.restore())},onDataUpdate(){r=null,n.clear()},getConfig(){return{...t}},setConfig(e){Object.assign(t,e)}}}function ws(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 Ts(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=ws(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:K.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=ya.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`,ya.UPPER),t.showMiddle&&h(`middle`,ya.MIDDLE),t.showLower&&h(`lower`,ya.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 Es(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 Ds(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 ks(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=Ds(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:K.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=Da.FAST,h=Da.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 As(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 js(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 Ms(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=As(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:K.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 Ns(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 Ps(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:K.FOREGROUND,enabled:!0,draw(e){let{ctx:n,data:r,range:i,crosshairIndex:a}=e,o=r;if(!o.length)return;n.save(),n.font=`12px Arial`,n.textAlign=`left`;let s=a??Math.min(i.end-1,o.length-1),c=[],l=t.indicators.MA;l?.enabled&&c.push({draw:e=>{let r=[],i=l.params.periods;if(i&&Array.isArray(i)?i.forEach(e=>{let t=`MA${e}`;r.push({label:`MA${e}`,color:J[t]||J.MA5,value:Ns(o,s,e)})}):r.push({label:`MA5`,color:J.MA5,value:Ns(o,s,5)},{label:`MA10`,color:J.MA10,value:Ns(o,s,10)},{label:`MA20`,color:J.MA20,value:Ns(o,s,20)},{label:`MA30`,color:J.MA30,value:Ns(o,s,30)},{label:`MA60`,color:J.MA60,value:Ns(o,s,60)}),r.length>0){let i=12,a=t.yPaddingPx/2+12+e*18;n.fillStyle=q.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 u=t.indicators.BOLL;u?.enabled&&c.push({draw:e=>{let r=u.params.period??20,i=u.params.multiplier??2,a=Es(o,s,r,i),c=12,l=t.yPaddingPx/2+12+e*18;n.fillStyle=q.NEUTRAL,n.fillText(`BOLL(${r},${i})`,c,l),c+=n.measureText(`BOLL(${r},${i})`).width+10,a&&(n.fillStyle=ya.UPPER,n.fillText(`上轨:${a.upper.toFixed(2)}`,c,l),c+=n.measureText(`上轨:${a.upper.toFixed(2)}`).width+10,n.fillStyle=ya.MIDDLE,n.fillText(`中轨:${a.middle.toFixed(2)}`,c,l),c+=n.measureText(`中轨:${a.middle.toFixed(2)}`).width+10,n.fillStyle=ya.LOWER,n.fillText(`下轨:${a.lower.toFixed(2)}`,c,l))}});let d=t.indicators.EXPMA;d?.enabled&&c.push({draw:e=>{let r=d.params.fastPeriod??12,i=d.params.slowPeriod??50,a=Os(o,s,r,i),c=12,l=t.yPaddingPx/2+12+e*18;n.fillStyle=q.NEUTRAL,n.fillText(`EXPMA(${r},${i})`,c,l),c+=n.measureText(`EXPMA(${r},${i})`).width+10,a&&(n.fillStyle=Da.FAST,n.fillText(`快:${a.fast.toFixed(2)}`,c,l),c+=n.measureText(`快:${a.fast.toFixed(2)}`).width+10,n.fillStyle=Da.SLOW,n.fillText(`慢:${a.slow.toFixed(2)}`,c,l))}});let f=t.indicators.ENE;f?.enabled&&c.push({draw:e=>{let r=f.params.period??10,i=f.params.deviation??11,a=js(o,s,r,i),c=12,l=t.yPaddingPx/2+12+e*18;n.fillStyle=q.NEUTRAL,n.fillText(`ENE(${r},${i})`,c,l),c+=n.measureText(`ENE(${r},${i})`).width+10,a&&(n.fillStyle=Oa.UPPER,n.fillText(`上轨:${a.upper.toFixed(2)}`,c,l),c+=n.measureText(`上轨:${a.upper.toFixed(2)}`).width+10,n.fillStyle=Oa.MIDDLE,n.fillText(`中轨:${a.middle.toFixed(2)}`,c,l),c+=n.measureText(`中轨:${a.middle.toFixed(2)}`).width+10,n.fillStyle=Oa.LOWER,n.fillText(`下轨:${a.lower.toFixed(2)}`,c,l))}}),c.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 Fs(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 Is(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 Ls(e,t,n,r){let i=Array(e.length);if(e.length<n)return i;let a=Fs(e,t),o=Fs(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=Is(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 Rs(e={}){let{paneId:t=`sub`,config:n={}}=e,r=hs(`macd`,t),i=null,a={fastPeriod:12,slowPeriod:26,signalPeriod:9,showDIF:!0,showDEA:!0,showBAR:!0,...n},o=null,s=0,c=0,l=0,u=[];function d(e){return(o!==e||s!==a.fastPeriod||c!==a.slowPeriod||l!==a.signalPeriod)&&(u=Ls(e,a.fastPeriod,a.slowPeriod,a.signalPeriod),o=e,s=a.fastPeriod,c=a.slowPeriod,l=a.signalPeriod),u}return{name:`macd_${t}`,version:`1.0.0`,description:`MACD 指标渲染器`,debugName:`MACD`,paneId:t,priority:K.INDICATOR,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:l,kWidth:u,kGap:f,dpr:p,kLinePositions:m}=e,h=s;if(h.length<a.slowPeriod)return;let g=d(h),_=-1/0,v=1/0;for(let e=c.start;e<c.end&&e<g.length;e++){let t=g[e];t&&(_=Math.max(_,t.dif,t.dea,t.macd),v=Math.min(v,t.dif,t.dea,t.macd))}if(!Number.isFinite(_)||!Number.isFinite(v))return;let y=Math.max(.05,(_-v)*.1),b=v-y,x=_+y;x-b;let S=c.end-1,C=S>=0&&S<g.length?g[S]:null,w={valueMin:b,valueMax:x,timestamp:Date.now(),latestValues:C?{dif:C.dif,dea:C.dea,macd:C.macd}:void 0};i?.setSharedState(r,w,`macd_${t}`);let T=o.yAxis.getDisplayRange({minPrice:b,maxPrice:x}),E=T.minPrice,D=T.maxPrice-E||1,O=o.height-(0-E)/D*o.height;n.save(),n.translate(-l,0);let k=Math.max(c.start,a.slowPeriod-1),A=Math.min(c.end,h.length);if(a.showBAR){let e=Math.round(O*p)/p,t=Math.max(1,Math.round((u+f)*p));for(let r=k;r<A;r++){let i=g[r];if(!i)continue;let a=m[r-c.start];if(a===void 0)continue;let s=m[r-c.start+1],l=m[r-c.start-1],d=s===void 0?l===void 0?t:Math.max(1,Math.round((a-l)*p)):Math.max(1,Math.round((s-a)*p)),f=Math.max(1,d-1)/p,h=Math.round((a+(u-f)/2)*p)/p,_=o.height-(i.macd-E)/D*o.height,v=i.macd>=0,y=r>0?g[r-1]:null,b;b=y?i.macd>=y.macd:!0;let x;x=v?b?Y.BAR_UP:Y.BAR_UP_LIGHT:b?Y.BAR_DOWN_LIGHT:Y.BAR_DOWN,n.fillStyle=x;let S=Math.round(_*p)/p,C=1/p;if(v){let t=e-S,r=t<=0?C:Math.max(t,C),i=t<=0?e-C:e-r;n.fillRect(h,i,f,r)}else{let t=S-e,r=t<=0?C:Math.max(t,C);n.fillRect(h,e,f,r)}}}if(a.showDIF){n.strokeStyle=Y.DIF,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=k;t<A;t++){let r=g[t];if(!r)continue;let i=m[t-c.start];if(i===void 0)continue;let a=i+u/2,s=o.height-(r.dif-E)/D*o.height,l=Q(a,p),d=Q(s,p);e?(n.moveTo(l,d),e=!1):n.lineTo(l,d)}n.stroke()}if(a.showDEA){n.strokeStyle=Y.DEA,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=k;t<A;t++){let r=g[t];if(!r)continue;let i=m[t-c.start];if(i===void 0)continue;let a=i+u/2,s=o.height-(r.dea-E)/D*o.height,l=Q(a,p),d=Q(s,p);e?(n.moveTo(l,d),e=!1):n.lineTo(l,d)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`fastPeriod`in e&&e.fastPeriod!==a.fastPeriod&&(o=null),`slowPeriod`in e&&e.slowPeriod!==a.slowPeriod&&(o=null),`signalPeriod`in e&&e.signalPeriod!==a.signalPeriod&&(o=null),Object.assign(a,e)}}}function zs(e,t,n=12,r=26,i=9){return t<r||t>=e.length?null:Ls(e,n,r,i)[t]??null}function Bs(e,t,n=12,r=26,i=9){let a=zs(e,t,n,r,i);return a?{name:`MACD`,params:[n,r,i],values:[{label:`DIF`,value:a.dif,color:Y.DIF},{label:`DEA`,value:a.dea,color:Y.DEA},{label:`MACD`,value:a.macd,color:a.macd>=0?Y.BAR_UP:Y.BAR_DOWN}]}:null}function Vs(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 Hs(e={}){let{paneId:t=`sub`,config:n={}}=e,r=hs(`rsi`,t),i=null,a={period1:6,period2:12,period3:24,showRSI1:!0,showRSI2:!0,showRSI3:!0,...n},o=null,s=0,c=0,l=0,u=[],d=[],f=[];function p(e){return(o!==e||s!==a.period1||c!==a.period2||l!==a.period3)&&(u=Vs(e,a.period1),d=Vs(e,a.period2),f=Vs(e,a.period3),o=e,s=a.period1,c=a.period2,l=a.period3),{rsi1:u,rsi2:d,rsi3:f}}return{name:`rsi_${t}`,version:`1.0.0`,description:`RSI 相对强弱指标渲染器`,debugName:`RSI`,paneId:t,priority:K.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:l,kWidth:u,dpr:d,kLinePositions:f}=e,m=s;if(m.length<a.period1+1)return;let{rsi1:h,rsi2:g,rsi3:_}=p(m),v={valueMin:0,valueMax:100,timestamp:Date.now()};i?.setSharedState(r,v,`rsi_${t}`);let y=o.yAxis.getDisplayRange({minPrice:0,maxPrice:100}),b=y.minPrice,x=y.maxPrice-b||1;n.save(),n.translate(-l,0);let S=o.height-(80-b)/x*o.height,C=o.height-(50-b)/x*o.height,w=o.height-(20-b)/x*o.height,T=l,E=l+e.paneWidth;n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(T,S),n.lineTo(E,S),n.moveTo(T,C),n.lineTo(E,C),n.moveTo(T,w),n.lineTo(E,w),n.stroke(),n.setLineDash([]);let D=Math.max(c.start,a.period1),O=Math.min(c.end,m.length),k=(e,t)=>{n.strokeStyle=t,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let r=!0;for(let t=D;t<O;t++){let i=e[t];if(i===void 0)continue;let a=f[t-c.start];if(a===void 0)continue;let s=a+u/2,l=o.height-(i-b)/x*o.height,p=Q(s,d),m=Q(l,d);r?(n.moveTo(p,m),r=!1):n.lineTo(p,m)}n.stroke()};a.showRSI1&&k(h,xa.RSI1),a.showRSI2&&k(g,xa.RSI2),a.showRSI3&&k(_,xa.RSI3),n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period1`in e&&e.period1!==a.period1&&(o=null),`period2`in e&&e.period2!==a.period2&&(o=null),`period3`in e&&e.period3!==a.period3&&(o=null),Object.assign(a,e)}}}function Us(e,t,n=6,r=12,i=24){if(t<n+1||t>=e.length)return null;let a=Vs(e,n)[t],o=Vs(e,r)[t],s=Vs(e,i)[t],c=[];return a!==void 0&&c.push({label:`RSI${n}`,value:a,color:xa.RSI1}),o!==void 0&&c.push({label:`RSI${r}`,value:o,color:xa.RSI2}),s!==void 0&&c.push({label:`RSI${i}`,value:s,color:xa.RSI3}),c.length===0?null:{name:`RSI`,params:[n,r,i],values:c}}function Ws(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 Gs(e={}){let{paneId:t=`sub`,config:n={}}=e,r=hs(`cci`,t),i=null,a={period:14,showCCI:!0,...n},o=null,s=0,c=[];function l(e){return(o!==e||s!==a.period)&&(c=Ws(e,a.period),o=e,s=a.period),c}return{name:`cci_${t}`,version:`1.0.0`,description:`CCI 顺势指标渲染器`,debugName:`CCI`,paneId:t,priority:K.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.period)return;let h=l(m),g=-1/0,_=1/0;for(let e=c.start;e<c.end&&e<h.length;e++){let t=h[e];t!==void 0&&(g=Math.max(g,t),_=Math.min(_,t))}if(!Number.isFinite(g)||!Number.isFinite(_))return;g=Math.max(g,150),_=Math.min(_,-150),g-_;let v={valueMin:_,valueMax:g,timestamp:Date.now()};i?.setSharedState(r,v,`cci_${t}`);let y=o.yAxis.getDisplayRange({minPrice:_,maxPrice:g}),b=y.minPrice,x=y.maxPrice-b||1,S=o.height-(0-b)/x*o.height;n.save(),n.translate(-u,0);let C=o.height-(100-b)/x*o.height,w=o.height-(-100-b)/x*o.height,T=u,E=u+e.paneWidth;n.strokeStyle=Sa.OVERBOUGHT,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(T,C),n.lineTo(E,C),n.stroke(),n.strokeStyle=Sa.OVERSOLD,n.beginPath(),n.moveTo(T,w),n.lineTo(E,w),n.stroke(),n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.beginPath(),n.moveTo(T,S),n.lineTo(E,S),n.stroke(),n.setLineDash([]);let D=Math.max(c.start,a.period-1),O=Math.min(c.end,m.length);if(a.showCCI){n.strokeStyle=Sa.CCI,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=D;t<O;t++){let r=h[t];if(r===void 0)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r-b)/x*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period`in e&&e.period!==a.period&&(o=null),Object.assign(a,e)}}}function Ks(e,t,n){return Ws(e,n)[t]}function qs(e,t,n=14){if(t<n||t>=e.length)return null;let r=Ks(e,t,n);return r===void 0?null:{name:`CCI`,params:[n],values:[{label:`CCI`,value:r,color:Sa.CCI}]}}function Js(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 Ys(e={}){let{paneId:t=`sub`,config:n={}}=e,r=hs(`stoch`,t),i=null,a={n:9,m:3,showK:!0,showD:!0,...n},o=null,s=0,c=0,l=[];function u(e){return(o!==e||s!==a.n||c!==a.m)&&(l=Js(e,a.n,a.m),o=e,s=a.n,c=a.m),l}return{name:`stoch_${t}`,version:`1.0.0`,description:`STOCH 随机指标渲染器`,debugName:`STOCH`,paneId:t,priority:K.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:l,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.n+a.m-1)return;let h=u(m),g={valueMin:0,valueMax:100,timestamp:Date.now()};i?.setSharedState(r,g,`stoch_${t}`);let _=o.yAxis.getDisplayRange({minPrice:0,maxPrice:100}),v=_.minPrice,y=_.maxPrice-v||1;n.save(),n.translate(-l,0);let b=o.height-(80-v)/y*o.height,x=o.height-(20-v)/y*o.height,S=l,C=l+e.paneWidth;n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(S,b),n.lineTo(C,b),n.moveTo(S,x),n.lineTo(C,x),n.stroke(),n.setLineDash([]);let w=Math.max(c.start,a.n+a.m-2),T=Math.min(c.end,m.length);if(a.showK){n.strokeStyle=Ca.K,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=w;t<T;t++){let r=h[t];if(!r)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r.k-v)/y*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}if(a.showD){n.strokeStyle=Ca.D,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=w;t<T;t++){let r=h[t];if(!r)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r.d-v)/y*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`n`in e&&e.n!==a.n&&(o=null),`m`in e&&e.m!==a.m&&(o=null),Object.assign(a,e)}}}function Xs(e,t,n,r){return Js(e,n,r)[t]}function Zs(e,t,n=9,r=3){if(t<n+r-1||t>=e.length)return null;let i=Xs(e,t,n,r);return i?{name:`STOCH`,params:[n,r],values:[{label:`K`,value:i.k,color:Ca.K},{label:`D`,value:i.d,color:Ca.D}]}:null}function Qs(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 $s(e={}){let{paneId:t=`sub`,config:n={}}=e,r=hs(`mom`,t),i=null,a={period:10,showMOM:!0,...n},o=null,s=0,c=[];function l(e){return(o!==e||s!==a.period)&&(c=Qs(e,a.period),o=e,s=a.period),c}return{name:`mom_${t}`,version:`1.0.0`,description:`MOM 动量指标渲染器`,debugName:`MOM`,paneId:t,priority:K.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.period+1)return;let h=l(m),g=-1/0,_=1/0;for(let e=c.start;e<c.end&&e<h.length;e++){let t=h[e];t!==void 0&&(g=Math.max(g,t),_=Math.min(_,t))}if(!Number.isFinite(g)||!Number.isFinite(_))return;let v=Math.max(Math.abs(g),Math.abs(_))*.1;g+=v,_-=v,g-_;let y={valueMin:_,valueMax:g,timestamp:Date.now()};i?.setSharedState(r,y,`mom_${t}`);let b=o.yAxis.getDisplayRange({minPrice:_,maxPrice:g}),x=b.minPrice,S=b.maxPrice-x||1,C=o.height-(0-x)/S*o.height;n.save(),n.translate(-u,0);let w=u,T=u+e.paneWidth;n.strokeStyle=wa.ZERO,n.lineWidth=1,n.beginPath(),n.moveTo(w,C),n.lineTo(T,C),n.stroke();let E=Math.max(c.start,a.period),D=Math.min(c.end,m.length);if(a.showMOM){n.strokeStyle=wa.MOM,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=E;t<D;t++){let r=h[t];if(r===void 0)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r-x)/S*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period`in e&&e.period!==a.period&&(o=null),Object.assign(a,e)}}}function ec(e,t,n){return Qs(e,n)[t]}function tc(e,t,n=10){if(t<n||t>=e.length)return null;let r=ec(e,t,n);return r===void 0?null:{name:`MOM`,params:[n],values:[{label:`MOM`,value:r,color:wa.MOM}]}}function nc(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 rc(e={}){let{paneId:t=`sub`,config:n={}}=e,r=hs(`wmsr`,t),i=null,a={period:14,showWMSR:!0,...n},o=null,s=0,c=[];function l(e){return(o!==e||s!==a.period)&&(c=nc(e,a.period),o=e,s=a.period),c}return{name:`wmsr_${t}`,version:`1.0.0`,description:`WMSR 威廉指标渲染器`,debugName:`WMSR`,paneId:t,priority:K.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.period)return;let h=l(m),g=-100;0-g;let _={valueMin:g,valueMax:0,timestamp:Date.now()};i?.setSharedState(r,_,`wmsr_${t}`);let v=o.yAxis.getDisplayRange({minPrice:g,maxPrice:0}),y=v.minPrice,b=v.maxPrice-y||1;n.save(),n.translate(-u,0);let x=o.height-(-20-y)/b*o.height,S=o.height-(-80-y)/b*o.height,C=o.height-(-50-y)/b*o.height,w=u,T=u+e.paneWidth;n.strokeStyle=Ta.OVERBOUGHT,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(w,x),n.lineTo(T,x),n.stroke(),n.strokeStyle=Ta.OVERSOLD,n.beginPath(),n.moveTo(w,S),n.lineTo(T,S),n.stroke(),n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.beginPath(),n.moveTo(w,C),n.lineTo(T,C),n.stroke(),n.setLineDash([]);let E=Math.max(c.start,a.period-1),D=Math.min(c.end,m.length);if(a.showWMSR){n.strokeStyle=Ta.WMSR,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=E;t<D;t++){let r=h[t];if(r===void 0)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r-y)/b*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period`in e&&e.period!==a.period&&(o=null),Object.assign(a,e)}}}function ic(e,t,n){return nc(e,n)[t]}function ac(e,t,n=14){if(t<n||t>=e.length)return null;let r=ic(e,t,n);return r===void 0?null:{name:`WMSR`,params:[n],values:[{label:`WMSR`,value:r,color:Ta.WMSR}]}}function oc(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 sc(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 cc(e,t,n,r,i,a){let o=Array(e.length),s=oc(e,t),c=oc(e,n),l=oc(e,r),u=oc(e,i),d=sc(s,10),f=sc(c,10),p=sc(l,10),m=sc(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=sc(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 lc(e={}){let{paneId:t=`sub`,config:n={}}=e,r=hs(`kst`,t),i=null,a={roc1:10,roc2:15,roc3:20,roc4:30,signalPeriod:9,showKST:!0,showSignal:!0,...n},o=null,s=``,c=[];function l(e){let t=`${a.roc1}-${a.roc2}-${a.roc3}-${a.roc4}-${a.signalPeriod}`;return(o!==e||s!==t)&&(c=cc(e,a.roc1,a.roc2,a.roc3,a.roc4,a.signalPeriod),o=e,s=t),c}return{name:`kst_${t}`,version:`1.0.0`,description:`KST 确知指标渲染器`,debugName:`KST`,paneId:t,priority:K.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.roc4+15+a.signalPeriod)return;let h=l(m),g=-1/0,_=1/0;for(let e=c.start;e<c.end&&e<h.length;e++){let t=h[e];t&&(g=Math.max(g,t.kst,t.signal),_=Math.min(_,t.kst,t.signal))}if(!Number.isFinite(g)||!Number.isFinite(_))return;let v=(g-_)*.1||1;g+=v,_-=v,g-_;let y={valueMin:_,valueMax:g,timestamp:Date.now()};i?.setSharedState(r,y,`kst_${t}`);let b=o.yAxis.getDisplayRange({minPrice:_,maxPrice:g}),x=b.minPrice,S=b.maxPrice-x||1,C=o.height-(0-x)/S*o.height;n.save(),n.translate(-u,0);let w=u,T=u+e.paneWidth;n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.lineWidth=1,n.beginPath(),n.moveTo(w,C),n.lineTo(T,C),n.stroke();let E=Math.max(c.start,a.roc4+15+a.signalPeriod-1),D=Math.min(c.end,m.length);if(a.showKST){n.strokeStyle=Ea.KST,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=E;t<D;t++){let r=h[t];if(!r)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r.kst-x)/S*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}if(a.showSignal){n.strokeStyle=Ea.SIGNAL,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=E;t<D;t++){let r=h[t];if(!r)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r.signal-x)/S*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){o=null,Object.assign(a,e)}}}function uc(e,t,n,r,i,a,o){return cc(e,n,r,i,a,o)[t]}function dc(e,t,n=10,r=15,i=20,a=30,o=9){if(t<a+15+o||t>=e.length)return null;let s=uc(e,t,n,r,i,a,o);return s?{name:`KST`,params:[n,r,i,a,o],values:[{label:`KST`,value:s.kst,color:Ea.KST},{label:`Signal`,value:s.signal,color:Ea.SIGNAL}]}:null}function fc(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 pc(e={}){let{paneId:t=`sub`,config:n={}}=e,r=hs(`fastk`,t),i=null,a={period:9,showFASTK:!0,...n},o=null,s=0,c=[];function l(e){return(o!==e||s!==a.period)&&(c=fc(e,a.period),o=e,s=a.period),c}return{name:`fastk_${t}`,version:`1.0.0`,description:`FASTK 快速随机指标渲染器`,debugName:`FASTK`,paneId:t,priority:K.MAIN,onInstall(e){i=e},getDeclaredNamespaces(){return[r]},draw(e){let{ctx:n,pane:o,data:s,range:c,scrollLeft:u,kWidth:d,dpr:f,kLinePositions:p}=e,m=s;if(m.length<a.period)return;let h=l(m),g={valueMin:0,valueMax:100,timestamp:Date.now()};i?.setSharedState(r,g,`fastk_${t}`);let _=o.yAxis.getDisplayRange({minPrice:0,maxPrice:100}),v=_.minPrice,y=_.maxPrice-v||1;n.save(),n.translate(-u,0);let b=o.height-(80-v)/y*o.height,x=o.height-(20-v)/y*o.height,S=u,C=u+e.paneWidth;n.strokeStyle=`rgba(0, 0, 0, 0.1)`,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(S,b),n.lineTo(C,b),n.moveTo(S,x),n.lineTo(C,x),n.stroke(),n.setLineDash([]);let w=Math.max(c.start,a.period-1),T=Math.min(c.end,m.length);if(a.showFASTK){n.strokeStyle=Ca.K,n.lineWidth=1,n.lineJoin=`round`,n.lineCap=`round`,n.beginPath();let e=!0;for(let t=w;t<T;t++){let r=h[t];if(r===void 0)continue;let i=p[t-c.start];if(i===void 0)continue;let a=i+d/2,s=o.height-(r-v)/y*o.height,l=Q(a,f),u=Q(s,f);e?(n.moveTo(l,u),e=!1):n.lineTo(l,u)}n.stroke()}n.restore()},onDataUpdate(){o=null},getConfig(){return{...a}},setConfig(e){`period`in e&&e.period!==a.period&&(o=null),Object.assign(a,e)}}}function mc(e,t,n){return fc(e,n)[t]}function hc(e,t,n=9){if(t<n||t>=e.length)return null;let r=mc(e,t,n);return r===void 0?null:{name:`FASTK`,params:[n],values:[{label:`FASTK`,value:r,color:Ca.K}]}}function gc(e){let{indicatorId:t,paneId:n}=e;switch(t){case`VOLUME`:return gs({paneId:n});case`MACD`:return Rs({paneId:n});case`RSI`:return Hs({paneId:n});case`CCI`:return Gs({paneId:n});case`STOCH`:return Ys({paneId:n});case`MOM`:return $s({paneId:n});case`WMSR`:return rc({paneId:n});case`KST`:return lc({paneId:n});case`FASTK`:return pc({paneId:n});default:throw Error(`Unknown indicator: ${t}`)}}var _c=8,vc=6,yc=class e{chart;activeTool=`cursor`;pendingAnchor=null;drawings=[];callbacks={};previewDrawingId=`__preview__`;dragState=null;selectedDrawingId=null;static SINGLE_ANCHOR_TOOLS=[`h-line`,`h-ray`,`v-line`,`crosshair-line`];static DOUBLE_ANCHOR_TOOLS=[`trend-line`,`ray`,`info-line`];constructor(e){this.chart=e}setCallbacks(e){this.callbacks=e}getActiveTool(){return this.activeTool}setTool(e){this.activeTool=e,this.pendingAnchor=null,this.removePreview(),this.dragState=null,this.setSelected(null),this.callbacks.onToolChange?.(e)}getDrawings(){return this.drawings}setDrawings(e){this.drawings=e,this.chart.setDrawings(e)}clear(){this.pendingAnchor=null,this.removePreview(),this.dragState=null,this.setSelected(null)}getSelectedDrawing(){return this.selectedDrawingId?this.drawings.find(e=>e.id===this.selectedDrawingId)??null:null}updateDrawingStyle(e,t){this.drawings=this.drawings.map(n=>n.id===e?{...n,style:{...n.style,...t}}:n),this.chart.setDrawings(this.drawings)}removeDrawing(e){this.drawings=this.drawings.filter(t=>t.id!==e),this.selectedDrawingId===e&&this.setSelected(null),this.chart.setDrawings(this.drawings)}onPointerMove(e,t){return this.dragState?this.handleDragMove(e,t):this.activeTool===`cursor`?!1:this.handlePreviewMove(e,t)}onPointerDown(t,n){if(this.activeTool===`cursor`)return this.handleCursorDown(t,n);let r=this.resolveAnchorFromPointer(t,n);return r?e.SINGLE_ANCHOR_TOOLS.includes(this.activeTool)?(this.createSingleAnchorDrawing(r),!0):e.DOUBLE_ANCHOR_TOOLS.includes(this.activeTool)?this.pendingAnchor?(this.createDoubleAnchorDrawing(this.pendingAnchor,r),this.pendingAnchor=null,!0):(this.pendingAnchor=r,!0):!1:!1}onPointerUp(e,t){return this.dragState?(this.dragState=null,!0):!1}handleCursorDown(e,t){let n=t.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top,a=this.hitTest(r,i);return a?(this.setSelected(a.drawing),this.dragState={drawingId:a.drawing.id,anchorIndex:`anchorIndex`in a?a.anchorIndex:void 0,snapshot:a.drawing.anchors.map(e=>({...e})),startMouse:{x:r,y:i}},!0):(this.setSelected(null),!1)}handleDragMove(e,t){if(!this.dragState)return!1;let n=this.drawings.find(e=>e.id===this.dragState.drawingId);if(!n)return this.dragState=null,!1;let r=this.resolveAnchorFromPointer(e,t);if(this.dragState.anchorIndex!==void 0){if(r){let e=this.dragState.anchorIndex;n.anchors[e]={...n.anchors[e],index:r.index,time:r.time,price:r.price}}}else{let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top,o=i-this.dragState.startMouse.x,s=a-this.dragState.startMouse.y;for(let e=0;e<n.anchors.length;e++){let r=this.dragState.snapshot[e],i=this.anchorToScreen(r);if(!i)continue;let a=i.x+o,c=i.y+s,l=this.screenToAnchor(a,c,t);l&&(n.anchors[e]={...n.anchors[e],index:l.index,time:l.time,price:l.price})}}return this.chart.setDrawings([...this.drawings]),!0}handlePreviewMove(t,n){let r=this.resolveAnchorFromPointer(t,n);if(!r)return this.removePreview(),!1;let i=e.SINGLE_ANCHOR_TOOLS.includes(this.activeTool),a=e.DOUBLE_ANCHOR_TOOLS.includes(this.activeTool);if(!i&&!a)return!1;let o;if(i)o={id:this.previewDrawingId,kind:this.getDrawingKind(this.activeTool),paneId:`main`,visible:!0,anchors:[{id:`${this.previewDrawingId}-a`,index:r.index,time:r.time,price:r.price}],params:{},style:{stroke:`#2962ff`,strokeWidth:1,strokeStyle:`dashed`}};else if(this.pendingAnchor)o={id:this.previewDrawingId,kind:this.activeTool,paneId:`main`,visible:!0,anchors:[{id:`${this.previewDrawingId}-a`,index:this.pendingAnchor.index,time:this.pendingAnchor.time,price:this.pendingAnchor.price},{id:`${this.previewDrawingId}-b`,index:r.index,time:r.time,price:r.price}],params:{},style:{stroke:`#2962ff`,strokeWidth:1,strokeStyle:`dashed`}};else return!1;return this.drawings=this.drawings.filter(e=>e.id!==this.previewDrawingId),this.drawings=[...this.drawings,o],this.chart.setDrawings(this.drawings),!0}hitTest(e,t){let n=this.drawings.filter(e=>e.id!==this.previewDrawingId&&e.visible);for(let r of n)for(let n=0;n<r.anchors.length;n++){let i=this.anchorToScreen(r.anchors[n]);if(i&&Math.hypot(e-i.x,t-i.y)<=_c)return{drawing:r,anchorIndex:n}}for(let r of n){let n=this.getDrawingLineSegments(r);for(let i of n)if(bc(e,t,i.a,i.b)<=vc)return{drawing:r}}return null}getDrawingLineSegments(e){let t=this.chart.getViewport();if(!t)return[];if(e.anchors.length===1){let n=this.anchorToScreen(e.anchors[0]);if(!n)return[];let r=this.chart.getPaneRenderers().find(e=>e.getPane().id===`main`)?.getPane();if(!r)return[];let i=t.plotWidth,a=r.height;switch(e.kind){case`horizontal-line`:return[{a:{x:0,y:n.y},b:{x:i,y:n.y}}];case`horizontal-ray`:return[{a:n,b:{x:i,y:n.y}}];case`vertical-line`:return[{a:{x:n.x,y:0},b:{x:n.x,y:a}}];case`cross-line`:return[{a:{x:0,y:n.y},b:{x:i,y:n.y}},{a:{x:n.x,y:0},b:{x:n.x,y:a}}];default:return[]}}let n=e.anchors.map(e=>this.anchorToScreen(e)).filter(Boolean);if(n.length<2)return[];let r=[];if(n.length===2){let i=n[0],a=n[1],o=a.x-i.x,s=a.y-i.y,c=i,l=a,u=this.getExtendMode(e),d=Math.max(t.plotWidth,t.plotHeight)*4;(u===`right`||u===`both`)&&(l={x:a.x+o*d,y:a.y+s*d}),(u===`left`||u===`both`)&&(c={x:i.x-o*d,y:i.y-s*d}),r.push({a:c,b:l})}else for(let e=0;e<n.length-1;e++)r.push({a:n[e],b:n[e+1]});return r}getExtendMode(e){switch(e.kind){case`ray`:return`right`;case`extended-line`:return`both`;default:return`none`}}anchorToScreen(e){let t=this.chart.getViewport();if(!t)return null;let n=this.chart.getOption(),r=this.chart.getCurrentDpr(),{startXPx:i,unitPx:a}=X(n.kWidth,n.kGap,r);if(!Number.isFinite(e.index)||e.index<0)return null;let o=(i+e.index*a+(a-1)/2)/r-t.scrollLeft,s=this.chart.getPaneRenderers().find(e=>e.getPane().id===`main`)?.getPane();return s?{x:o,y:s.yAxis.priceToY(e.price)}:null}screenToAnchor(e,t){let n=this.chart.getData();if(!this.chart.getViewport()||n.length===0)return null;let r=this.chart.getLogicalIndexAtX(e);if(r===null)return null;let i=this.chart.getPaneRenderers().find(e=>e.getPane().id===`main`)?.getPane();return i?{index:r,time:this.chart.getTimestampAtLogicalIndex(r)??void 0??void 0,price:i.yAxis.yToPrice(t-i.top)}:null}setSelected(e){let t=e?.id??null;this.selectedDrawingId!==t&&(this.selectedDrawingId=t,this.chart.setSelectedDrawingId(t),this.callbacks.onDrawingSelected?.(e))}removePreview(){this.drawings.some(e=>e.id===this.previewDrawingId)&&(this.drawings=this.drawings.filter(e=>e.id!==this.previewDrawingId),this.chart.setDrawings(this.drawings))}resolveAnchorFromPointer(e,t){let n=this.chart.getData(),r=this.chart.getViewport();if(!r||n.length===0)return null;let i=t.getBoundingClientRect(),a=e.clientX-i.left,o=e.clientY-i.top;if(a<0||o<0||a>r.plotWidth||o>r.plotHeight)return null;let s=this.chart.getPaneRenderers().find(e=>{let t=e.getPane();return t.id===`main`&&o>=t.top&&o<=t.top+t.height})?.getPane();if(!s)return null;let c=this.chart.getLogicalIndexAtX(a);return c===null?null:{index:c,time:this.chart.getTimestampAtLogicalIndex(c)??void 0??void 0,price:s.yAxis.yToPrice(o-s.top)}}createSingleAnchorDrawing(e){this.drawings=this.drawings.filter(e=>e.id!==this.previewDrawingId);let t={id:`drawing-${Date.now()}`,kind:this.getDrawingKind(this.activeTool),paneId:`main`,visible:!0,anchors:[{id:`${Date.now()}-a`,index:e.index,time:e.time,price:e.price}],params:{},style:{stroke:`#2962ff`,strokeWidth:1,strokeStyle:`solid`}};this.drawings=[...this.drawings,t],this.chart.setDrawings(this.drawings),this.callbacks.onDrawingCreated?.(t),this.activeTool=`cursor`,this.callbacks.onToolChange?.(`cursor`)}createDoubleAnchorDrawing(e,t){this.drawings=this.drawings.filter(e=>e.id!==this.previewDrawingId);let n={id:`drawing-${Date.now()}`,kind:this.activeTool,paneId:`main`,visible:!0,anchors:[{id:`${Date.now()}-a`,index:e.index,time:e.time,price:e.price},{id:`${Date.now()}-b`,index:t.index,time:t.time,price:t.price}],params:{},style:{stroke:`#2962ff`,strokeWidth:1,strokeStyle:`solid`}};this.drawings=[...this.drawings,n],this.chart.setDrawings(this.drawings),this.callbacks.onDrawingCreated?.(n),this.activeTool=`cursor`,this.callbacks.onToolChange?.(`cursor`)}getDrawingKind(e){switch(e){case`cursor`:throw Error(`cursor is not a drawing kind`);case`h-line`:return`horizontal-line`;case`h-ray`:return`horizontal-ray`;case`v-line`:return`vertical-line`;case`crosshair-line`:return`cross-line`;default:return e}}};function bc(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=i*i+a*a;if(o===0)return Math.hypot(e-n.x,t-n.y);let s=((e-n.x)*i+(t-n.y)*a)/o;return s=Math.max(0,Math.min(1,s)),Math.hypot(e-(n.x+s*i),t-(n.y+s*a))}var xc=class{drawings=[];selectedId=null;getSelectedId(){return this.selectedId}setSelectedId(e){this.selectedId=e}getAll(){return this.drawings}getVisibleByPane(e){return this.drawings.filter(t=>t.visible&&t.paneId===e).sort((e,t)=>(e.zIndex??0)-(t.zIndex??0))}setAll(e){this.drawings=[...e],this.selectedId&&!this.drawings.some(e=>e.id===this.selectedId)&&(this.selectedId=null)}upsert(e){let t=this.drawings.findIndex(t=>t.id===e.id);if(t>=0){this.drawings[t]=e;return}this.drawings.push(e)}remove(e){this.drawings=this.drawings.filter(t=>t.id!==e)}clear(){this.drawings=[],this.selectedId=null}},Sc=class{definitions=new Map;register(e){this.definitions.set(e.kind,e)}get(e){return this.definitions.get(e)}compute(e,t){let n=this.get(e.kind);return n?n.compute(e,t):null}};function Cc(e,t){if(e.strokeStyle=t?.stroke??`#2962ff`,e.lineWidth=t?.strokeWidth??1,t?.strokeStyle===`dashed`){e.setLineDash([6,4]);return}if(t?.strokeStyle===`dotted`){e.setLineDash([2,3]);return}e.setLineDash([])}function wc(e,t){e.fillStyle=t?.fill??t?.stroke??`#2962ff`,e.globalAlpha=t?.fillOpacity??1}function Tc(e,t,n,r,i){let a=(e,t)=>{let n=0;return e<i.left?n|=1:e>i.right&&(n|=2),t<i.top?n|=8:t>i.bottom&&(n|=4),n},o=e,s=t,c=n,l=r;for(;;){let e=a(o,s),t=a(c,l);if(!(e|t))return{a:{x:o,y:s},b:{x:c,y:l}};if(e&t)return null;let n=e||t,r=0,u=0;n&8?(r=o+(c-o)*(i.top-s)/(l-s),u=i.top):n&4?(r=o+(c-o)*(i.bottom-s)/(l-s),u=i.bottom):n&2?(u=s+(l-s)*(i.right-o)/(c-o),r=i.right):(u=s+(l-s)*(i.left-o)/(c-o),r=i.left),n===e?(o=r,s=u):(c=r,l=u)}}function Ec(e,t){let{a:n,b:r,extend:i=`none`}=e;if(i===`none`)return Tc(n.x,n.y,r.x,r.y,t);let a=r.x-n.x,o=r.y-n.y;if(a===0&&o===0)return null;let s=Math.max(t.right-t.left,t.bottom-t.top)*4,c=n,l=r;return(i===`left`||i===`both`)&&(c={x:n.x-a*s,y:n.y-o*s}),(i===`right`||i===`both`)&&(l={x:r.x+a*s,y:r.y+o*s}),Tc(c.x,c.y,l.x,l.y,t)}function Dc(e,t){if(!Number.isFinite(e.index))return-1;let n=Math.round(e.index);return n<0||n>=t.length?-1:n}function Oc(e,t=2){if(!Number.isFinite(e))return`0`;let n=e.toFixed(t);return e>0?`+${n}`:n}function kc(e){let t=e.length;if(t<2)return null;let n=0,r=0,i=0,a=0;for(let o=0;o<t;o++){let t=o,s=e[o];n+=t,r+=s,i+=t*s,a+=t*t}let o=t*a-n*n;if(o===0)return null;let s=(t*i-n*r)/o,c=(r-s*n)/t,l=0;for(let n=0;n<t;n++){let t=c+s*n,r=e[n]-t;l+=r*r}return{slope:s,intercept:c,stdDev:Math.sqrt(l/t)}}function Ac(){return{point(e,t,n){let r=t.style?.pointRadius??4;e.save(),e.fillStyle=t.style?.fill??t.style?.stroke??`#2962ff`,e.beginPath(),e.arc(t.point.x,t.point.y,Math.max(r,1/n),0,Math.PI*2),e.fill(),e.restore()},line(e,t,n,r){let i=Ec(t,n);if(!i)return;e.save(),Cc(e,t.style);let a=(t.style?.strokeWidth??1)<=1?.5/r:0;if(e.beginPath(),e.moveTo(i.a.x+a,i.a.y+a),e.lineTo(i.b.x+a,i.b.y+a),e.stroke(),t.showEndpoints!==!1){let n=t.style?.pointRadius??4;e.fillStyle=t.style?.stroke??`#2962ff`,e.beginPath(),e.arc(t.a.x,t.a.y,Math.max(n,1/r),0,Math.PI*2),e.fill(),e.beginPath(),e.arc(t.b.x,t.b.y,Math.max(n,1/r),0,Math.PI*2),e.fill()}e.restore()},area(e,t){if(t.points.length!==0){e.save(),wc(e,t.style),e.beginPath(),e.moveTo(t.points[0].x,t.points[0].y);for(let n=1;n<t.points.length;n++){let r=t.points[n];e.lineTo(r.x,r.y)}t.closed&&e.closePath(),e.fill(),e.restore()}},text(e,t){e.save(),e.fillStyle=t.style?.textColor??t.style?.stroke??`#2962ff`,e.font=`${t.style?.fontSize??12}px sans-serif`,e.textAlign=t.align??`left`,e.textBaseline=t.baseline??`bottom`,e.fillText(t.text,t.point.x,t.point.y),e.restore()}}}function jc(e,t){return{kind:e,minAnchors:2,maxAnchors:2,compute(e,n){let[r,i]=e.anchors;return!r||!i?{primitives:[]}:{primitives:[{kind:`line`,a:n.toScreen(r),b:n.toScreen(i),extend:t,style:e.style}]}}}}function Mc(e){return{kind:e,minAnchors:1,maxAnchors:1,compute(t,n){let[r]=t.anchors;if(!r)return{primitives:[]};let i=n.toScreen(r),a=n.pane.height,o=n.viewport.plotWidth;return e===`horizontal-line`?{primitives:[{kind:`line`,a:{x:0,y:i.y},b:{x:o,y:i.y},showEndpoints:!1,style:t.style},{kind:`point`,point:i,style:t.style}]}:e===`horizontal-ray`?{primitives:[{kind:`line`,a:i,b:{x:o,y:i.y},showEndpoints:!1,style:t.style},{kind:`point`,point:i,style:t.style}]}:e===`vertical-line`?{primitives:[{kind:`line`,a:{x:i.x,y:0},b:{x:i.x,y:a},showEndpoints:!1,style:t.style},{kind:`point`,point:i,style:t.style}]}:{primitives:[{kind:`line`,a:{x:0,y:i.y},b:{x:o,y:i.y},showEndpoints:!1,style:t.style},{kind:`line`,a:{x:i.x,y:0},b:{x:i.x,y:a},showEndpoints:!1,style:t.style},{kind:`point`,point:i,style:t.style}]}}}}function Nc(){return{kind:`info-line`,minAnchors:2,maxAnchors:2,compute(e,t){let[n,r]=e.anchors;if(!n||!r)return{primitives:[]};let i=t.toScreen(n),a=t.toScreen(r),o=Math.round(n.index),s=Math.round(r.index)-o,c=r.price-n.price,l=n.price===0?0:c/n.price*100,u=Math.atan2(a.y-i.y,a.x-i.x)*(180/Math.PI),d=`${Oc(c)} (${Oc(l)}%) ${s} bars ${Oc(u)}°`;return{primitives:[{kind:`line`,a:i,b:a,style:e.style},{kind:`text`,point:{x:(i.x+a.x)/2+8,y:Math.min(i.y,a.y)-8},text:d,align:`left`,baseline:`bottom`,style:e.style}],meta:{delta:c,percent:l,bars:s,angle:u}}}}}function Pc(){return{kind:`parallel-channel`,minAnchors:3,maxAnchors:3,compute(e,t){let[n,r,i]=e.anchors;if(!n||!r||!i)return{primitives:[]};let a=t.toScreen(n),o=t.toScreen(r),s=t.toScreen(i),c=o.x-a.x,l=o.y-a.y,u={x:s.x+c,y:s.y+l},d=e.params?.extend??`none`;return{primitives:[{kind:`area`,points:[a,o,u,s],closed:!0,style:e.style},{kind:`line`,a,b:o,extend:d,style:e.style},{kind:`line`,a:s,b:u,extend:d,style:e.style},{kind:`line`,a,b:s,style:e.style},{kind:`line`,a:o,b:u,style:e.style}]}}}}function Fc(){return{kind:`regression-channel`,minAnchors:2,maxAnchors:2,compute(e,t){let[n,r]=e.anchors;if(!n||!r)return{primitives:[]};let i=Dc(n,t.seriesData),a=Dc(r,t.seriesData);if(i<0&&a<0)return{primitives:[]};let o=Math.min(Math.max(Math.round(n.index),0),t.seriesData.length-1),s=Math.min(Math.max(Math.round(r.index),0),t.seriesData.length-1),c=Math.min(o,s),l=Math.max(o,s),u=t.seriesData.slice(c,l+1),d=kc(u.map(e=>e.close));if(!d)return{primitives:[]};let f=e.params?.sigma??2,p=d.stdDev*f,m=d.intercept,h=d.intercept+d.slope*(u.length-1),g={id:`${e.id}-reg-start`,index:Math.round(n.index),time:t.seriesData[c].timestamp,price:m},_={id:`${e.id}-reg-end`,index:Math.round(r.index),time:t.seriesData[l].timestamp,price:h},v={...g,id:`${e.id}-reg-upper-start`,price:m+p},y={..._,id:`${e.id}-reg-upper-end`,price:h+p},b={...g,id:`${e.id}-reg-lower-start`,price:m-p},x={..._,id:`${e.id}-reg-lower-end`,price:h-p},S=t.toScreen(g),C=t.toScreen(_),w=t.toScreen(v),T=t.toScreen(y),E=t.toScreen(b),D=t.toScreen(x);return{primitives:[{kind:`area`,points:[w,T,D,E],closed:!0,style:e.style},{kind:`line`,a:S,b:C,style:e.style},{kind:`line`,a:w,b:T,style:e.style},{kind:`line`,a:E,b:D,style:e.style}],meta:{sigma:f,stdDev:d.stdDev,slope:d.slope}}}}}function Ic(e){e.register(jc(`trend-line`,`none`)),e.register(jc(`ray`,`right`)),e.register(jc(`extended-line`,`both`)),e.register(Mc(`horizontal-line`)),e.register(Mc(`horizontal-ray`)),e.register(Mc(`vertical-line`)),e.register(Mc(`cross-line`)),e.register(Nc()),e.register(Pc()),e.register(Fc())}function Lc(e){let t=e.store,n=e.definitions??new Sc,r=e.renderers??Ac();return Ic(n),{name:`drawingRenderer`,version:`0.1.0`,description:`绘图渲染器`,debugName:`绘图层`,paneId:e.paneId??`main`,priority:K.OVERLAY,draw(e){let{ctx:i,pane:a,data:o,range:s,dpr:c,paneWidth:l,kLinePositions:u,kWidth:d,kGap:f}=e,p=e.viewport??{scrollLeft:e.scrollLeft,plotWidth:l,plotHeight:a.height},{startXPx:m,unitPx:h}=X(d,f,c),g=o,_=g.slice(s.start,s.end),v=t.getVisibleByPane(a.id);if(v.length===0)return;let y={left:0,top:0,right:p.plotWidth,bottom:a.height};i.save(),i.beginPath(),i.rect(0,0,p.plotWidth,a.height),i.clip();for(let e of v){let o=n.compute(e,{pane:a,visibleData:_,seriesData:g,range:s,kLinePositions:u,kWidth:d,kGap:f,dpr:c,paneWidth:l,viewport:p,toScreen(e){return!Number.isFinite(e.index)||e.index<0?{x:-d,y:a.yAxis.priceToY(e.price)}:{x:(m+e.index*h+(h-1)/2)/c-p.scrollLeft,y:a.yAxis.priceToY(e.price)}}});if(!o)continue;let v=t.getSelectedId()===e.id?o.primitives.map(t=>Rc(t,e.style)):o.primitives;for(let e of v){if(e.kind===`point`){r.point(i,e,c);continue}if(e.kind===`line`){r.line(i,e,y,c);continue}if(e.kind===`area`){r.area(i,e,c);continue}r.text(i,e,c)}}i.restore()}}}function Rc(e,t){let n=t.stroke??`#2962ff`,r=(t.strokeWidth??1)+1,i=(t.pointRadius??4)+2;return e.kind===`point`?{...e,style:{...e.style,stroke:n,pointRadius:i}}:e.kind===`line`?{...e,style:{...e.style,stroke:n,strokeWidth:r}}:e.kind===`area`?{...e,style:{...e.style,stroke:n}}:{...e,style:{...e.style,textColor:n,fontSize:(e.style?.fontSize??12)+1}}}var zc=class e{dom;opt;data=[];raf=null;viewport=null;paneRenderers=[];markerManager;drawingStore=new xc;interaction;pluginHost;rendererPluginManager;preciseDpr=0;resizeObserver;observedSize={width:0,height:0};paneRatios=new Map;onViewportChange;onPaneLayoutChange;onDataChange;currentZoomLevel=1;zoomLevelCount;constructor(e,t){this.dom=e;let{kWidth:n,kGap:r,...i}=t;this.opt={...i,kWidth:n??0,kGap:r??0},this.interaction=new ds(this),this.markerManager=new io,this.pluginHost=$i(),this.rendererPluginManager=new ta,this.rendererPluginManager.setPluginHost(this.pluginHost),this.rendererPluginManager.setInvalidateCallback(()=>this.scheduleDraw()),this.syncPaneRatiosFromSpecs(this.opt.panes),this.zoomLevelCount=Math.max(2,Math.round(this.opt.zoomLevels??20)),this.currentZoomLevel=this.opt.initialZoomLevel??1,this.currentZoomLevel=Math.max(1,Math.min(this.zoomLevelCount,this.currentZoomLevel)),this.initPanes(),this.useRenderer(Lc({store:this.drawingStore})),this.initResizeObserver()}initResizeObserver(){if(typeof ResizeObserver>`u`)return;let e=this.dom.container;if(e){this.resizeObserver=new ResizeObserver(e=>{let t=e[0];if(!t)return;let n=this.observedSize.width,r=this.observedSize.height,i=this.preciseDpr;this.updateObservedMetrics(t);let a=this.observedSize.width!==n,o=this.observedSize.height!==r,s=this.preciseDpr!==i;(a||o||s)&&this.resize()});try{this.resizeObserver.observe(e,{box:`device-pixel-content-box`})}catch{this.resizeObserver.observe(e)}}}updateObservedMetrics(e){let t=Math.max(1,Math.round(e.contentRect.width)),n=Math.max(1,Math.round(e.contentRect.height));this.observedSize.width=t,this.observedSize.height=n;let r=e.devicePixelContentBoxSize?.[0],i=e.contentBoxSize?.[0];if(!r||!i||i.inlineSize<=0){this.preciseDpr=0;return}let a=r.inlineSize/i.inlineSize;this.preciseDpr=Math.round(a*64)/64}getEffectiveDpr(){let e=this.preciseDpr>0?this.preciseDpr:Math.round((window.devicePixelRatio||1)*64)/64;return e<1&&(e=1),e}getViewport(){return this.viewport}getCurrentDpr(){return this.getEffectiveDpr()}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}=os(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}=X(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`);if(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)),o){let t=o.canvas.width/e.dpr;o.setTransform(1,0,0,1,0,0),o.scale(e.dpr,e.dpr),o.clearRect(0,0,t,n.height+2/e.dpr)}let s={ctx:a,pane:Ki(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,crosshairIndex:this.interaction.getCrosshairIndex(),yAxisCtx:o??void 0,zoomLevel:this.currentZoomLevel,zoomLevelCount:this.zoomLevelCount,viewport:{scrollLeft:e.scrollLeft,plotWidth:e.plotWidth,plotHeight:e.plotHeight}};if(a){a.save();let e=this.rendererPluginManager.render(n.id,s);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`,role:`auxiliary`,capabilities:{showPriceAxisTicks:!1,showCrosshairPriceLabel:!1,candleHitTest:!1,supportsPriceTranslate:!1},top:0,height:this.opt.bottomAxisHeight,yAxis:{priceToY:()=>0,yToPrice:()=>0,getPaddingTop:()=>0,getPaddingBottom:()=>0,getPriceOffset:()=>0,getDisplayRange:e=>e??{maxPrice:0,minPrice: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,viewport:{scrollLeft:e.scrollLeft,plotWidth:e.plotWidth,plotHeight:e.plotHeight}},n=this.rendererPluginManager.renderPlugin(`timeAxis`,t);n.length>0&&this.pluginHost.events.emit(`renderer:error`,{paneId:`timeAxis`,errors:n})}}applyRenderState(e,t,n){this.opt={...this.opt,kWidth:e,kGap:t},n!==void 0&&(this.currentZoomLevel=Math.max(1,Math.min(this.zoomLevelCount,n))),this.scheduleDraw()}getZoomLevelCount(){return this.zoomLevelCount}setOnViewportChange(e){this.onViewportChange=e}setOnPaneLayoutChange(e){this.onPaneLayoutChange=e}setOnDataChange(e){this.onDataChange=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.getEffectiveDpr(),{unitPx:a,startXPx:o}=X(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){if(e.kWidth!==void 0&&(console.warn(`[Chart] kWidth cannot be set directly. Use applyRenderState() instead.`),delete e.kWidth),e.kGap!==void 0&&delete e.kGap,e.panes){let t=e.panes.map(e=>({...e}));this.opt={...this.opt,...e,panes:t},this.applyPaneLayoutSpecs(t);return}this.opt={...this.opt,...e},this.resize()}updatePaneLayout(e){this.applyPaneLayoutSpecs(e)}setPaneDefinitions(e){this.applyPaneLayoutSpecs(e)}upsertPane(e){let t=this.opt.panes.findIndex(t=>t.id===e.id);if(t===-1){this.applyPaneLayoutSpecs([...this.opt.panes,{...e}]);return}let n=[...this.opt.panes];n[t]={...n[t],...e},this.applyPaneLayoutSpecs(n)}removePaneDefinition(e){this.opt.panes.some(t=>t.id===e)&&(this.paneRatios.delete(e),this.applyPaneLayoutSpecs(this.opt.panes.filter(t=>t.id!==e)))}bindIndicatorToPane(e,t,n){this.opt.panes.some(t=>t.id===e)||this.upsertPane({id:e,ratio:1,visible:!0,role:`indicator`});let r=`${t.toLowerCase()}_${e}`;if(this.getRenderer(r)){n&&this.updateRendererConfig(r,n);return}let i=gc({indicatorId:t,paneId:e});this.useRenderer(i,n)}setDrawings(e){this.drawingStore.setAll(e),this.scheduleDraw()}setSelectedDrawingId(e){this.drawingStore.setSelectedId(e)}getPaneLayoutSpecs(){let e=this.opt.panes.filter(e=>e.visible!==!1).reduce((e,t)=>e+(this.paneRatios.get(t.id)??t.ratio??0),0),t=e>0?e:1;return this.opt.panes.map(e=>{let n=this.paneRatios.get(e.id)??e.ratio??0,r=e.visible===!1?n:n/t,i=this.paneRenderers.find(t=>t.getPane().id===e.id)?.getPane();return{...e,ratio:r,role:i?.role??e.role,capabilities:i?{...i.capabilities}:e.capabilities}})}emitPaneLayoutChange(){this.onPaneLayoutChange?.(this.getPaneLayoutSpecs())}applyPaneLayoutSpecs(e){this.opt.panes=e.map(e=>({...e})),this.syncPaneRatiosFromSpecs(this.opt.panes),this.initPanes(),this.layoutPanes(),this.emitPaneLayoutChange(),this.scheduleDraw()}resizePaneBoundary(e,t){if(!Number.isFinite(t)||t===0)return!1;let n=this.viewport;if(!n)return!1;let r=this.opt.panes.filter(e=>e.visible!==!1),i=r.findIndex(t=>t.id===e);if(i<0||i>=r.length-1)return!1;let a=r[i],o=r[i+1];if(!a||!o)return!1;let s=new Map;for(let e of r){let t=this.paneRenderers.find(t=>t.getPane().id===e.id);t&&s.set(e.id,t.getPane().height)}let c=t>0?i:i+1,l=t>0?i+1:i,u=t>0?1:-1,d=Math.abs(t),f=l;for(;d>0&&f>=0&&f<r.length;){let e=r[f];if(!e)break;let t=s.get(e.id)??0,i=this.getPaneMinHeight(e,n.plotHeight),a=Math.max(0,t-i);if(a>0){let n=Math.min(a,d);s.set(e.id,t-n),d-=n}d>0&&(f+=u)}if(d>0)return!1;let p=r[c];if(!p)return!1;let m=s.get(p.id)??0;s.set(p.id,m+Math.abs(t));let h=Math.max(0,this.opt.paneGap??0)*Math.max(0,r.length-1),g=Math.max(1,n.plotHeight-h);for(let e of r){let t=s.get(e.id)??0;this.paneRatios.set(e.id,t/g)}return this.normalizeVisiblePaneRatios(r),this.syncPaneRatiosToSpecs(),this.layoutPanes(),this.emitPaneLayoutChange(),this.scheduleDraw(),!0}resolvePaneRole(e,t){return e.role?e.role:t===0?`price`:`indicator`}addPane(e){if(this.opt.panes.some(t=>t.id===e)){console.warn(`Pane "${e}" already exists`);return}let t=this.opt.panes.some((e,t)=>this.resolvePaneRole(e,t)===`price`)?`indicator`:`price`;this.applyPaneLayoutSpecs([...this.opt.panes,{id:e,ratio:1,visible:!0,role:t}])}removePane(e){if(!this.opt.panes.some(t=>t.id===e))return;let t=this.opt.panes.filter(t=>t.id!==e);this.paneRatios.delete(e),this.applyPaneLayoutSpecs(t)}hasPane(e){return this.opt.panes.some(t=>t.id===e)}static SUB_PANE_PREFIX=`sub_`;createSubPane(t,n){let r=`${e.SUB_PANE_PREFIX}${t}`,i=`${t.toLowerCase()}_${r}`;if(this.getRenderer(i))return n&&this.updateRendererConfig(i,n),!0;let a=this.opt.panes.filter(e=>e.visible!==!1),o=a.filter((e,t)=>this.resolvePaneRole(e,t)===`price`),s=a.filter((e,t)=>this.resolvePaneRole(e,t)===`indicator`);if(o.length===1){let e=o[0];e&&this.paneRatios.set(e.id,3);for(let e of s)this.paneRatios.set(e.id,1);this.paneRatios.set(r,1)}else this.paneRatios.set(r,1);return this.upsertPane({id:r,ratio:this.paneRatios.get(r)??1,visible:!0,role:`indicator`}),this.bindIndicatorToPane(r,t,n),!0}removeSubPane(t){let n=`${e.SUB_PANE_PREFIX}${t}`;if(!this.hasPane(n))return;let r=`${t.toLowerCase()}_${n}`;this.removeRenderer(r),this.paneRatios.delete(n),this.applyPaneLayoutSpecs(this.opt.panes.filter(e=>e.id!==n))}clearSubPanes(){let t=this.opt.panes.map(e=>e.id).filter(t=>t.startsWith(e.SUB_PANE_PREFIX));if(t.length!==0){for(let n of t){let t=`${n.slice(e.SUB_PANE_PREFIX.length).toLowerCase()}_${n}`;this.removeRenderer(t),this.paneRatios.delete(n)}this.applyPaneLayoutSpecs(this.opt.panes.filter(t=>!t.id.startsWith(e.SUB_PANE_PREFIX)))}}getSubPaneIndicators(){return this.opt.panes.map(e=>e.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();if(!r.capabilities.supportsPriceTranslate)return;let i=r.yAxis.deltaYToPriceOffset(t),a=r.yAxis.getPriceOffset();r.yAxis.setPriceOffset(a+i),this.scheduleDraw()}scalePrice(e,t){let n=this.paneRenderers.find(t=>t.getPane().id===e);if(!n)return;let r=n.getPane();r.capabilities.supportsPriceTranslate&&(r.yAxis.scaleByDelta(t),this.scheduleDraw())}updateData(e){this.data=e??[],this.onDataChange?.(this.data);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}getTrailingSlotCount(){return 24}getLogicalSlotCount(){return this.data.length+this.getTrailingSlotCount()}getTimestampAtLogicalIndex(e){return!Number.isInteger(e)||e<0||e>=this.data.length?null:this.data[e]?.timestamp??null}getLogicalIndexAtX(e){let t=this.viewport;if(!t||this.data.length===0)return null;let n=this.getEffectiveDpr(),{startXPx:r,unitPx:i}=X(this.opt.kWidth,this.opt.kGap,n),a=Math.round((t.scrollLeft+e)*n),o=Math.floor((a-r)/i);return o<0?null:o}getDataIndexAtX(e){let t=this.getLogicalIndexAtX(e);return t===null||t>=this.data.length?null:t}getContentWidth(){return ps({dataLength:this.data.length,kWidth:this.opt.kWidth,kGap:this.opt.kGap,viewWidth:this.viewport?.plotWidth??0,viewportDpr:this.getEffectiveDpr()})}resize(){let e=this.computeViewport();!e||e.viewWidth<10||e.viewHeight<10||(this.layoutPanes(),this.emitPaneLayoutChange(),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.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.preciseDpr=0,this.observedSize={width:0,height:0},this.viewport=null,this.paneRenderers.forEach(e=>e.destroy()),this.paneRenderers=[],this.rendererPluginManager.clear(),this.onViewportChange=void 0,this.onPaneLayoutChange=void 0,await this.pluginHost.destroy()}initPanes(){this.paneRenderers=this.opt.panes.map((e,t)=>{let n=new us(e.id,{role:this.resolvePaneRole(e,t),capabilities:e.capabilities}),r=document.createElement(`canvas`),i=document.createElement(`canvas`),a=n.role===`price`;return r.id=`${e.id}-plot`,r.className=a?`plot-canvas main`:`plot-canvas sub`,r.style.position=`absolute`,r.style.left=`0`,r.style.top=`0`,i.id=`${e.id}-yAxis`,i.className=`right-axis`,i.style.position=`absolute`,i.style.left=`0`,new fs({plotCanvas:r,yAxisCanvas:i},n,{rightAxisWidth:this.opt.rightAxisWidth,yPaddingPx:this.opt.yPaddingPx,priceLabelWidth:this.opt.priceLabelWidth})});let e=this.dom.canvasLayer,t=this.dom.rightAxisLayer;e&&e.querySelectorAll(`canvas:not(.x-axis-canvas)`).forEach(e=>e.remove()),t&&t.querySelectorAll(`canvas.right-axis`).forEach(e=>e.remove()),this.paneRenderers.forEach(n=>{let r=n.getDom();e.appendChild(r.plotCanvas),t.appendChild(r.yAxisCanvas)}),this.rendererPluginManager.setKnownPaneIds(this.paneRenderers.map(e=>e.getPane().id))}syncPaneRatiosFromSpecs(e){let t=new Map;for(let n of e){let e=this.paneRatios.get(n.id),r=Number.isFinite(n.ratio)?n.ratio:0,i=e===void 0?r>0?r:1:e;t.set(n.id,i)}this.paneRatios=t,this.normalizeVisiblePaneRatios(e),this.syncPaneRatiosToSpecs()}syncPaneRatiosToSpecs(){let e=this.opt.panes.filter(e=>e.visible!==!1).reduce((e,t)=>e+(this.paneRatios.get(t.id)??t.ratio??0),0),t=e>0?e:1;this.opt.panes=this.opt.panes.map(e=>{let n=this.paneRatios.get(e.id)??e.ratio??0;return e.visible===!1?{...e,ratio:n}:{...e,ratio:n/t}})}normalizeVisiblePaneRatios(e){let t=e.filter(e=>e.visible!==!1);if(t.length===0)return;let n=0;for(let e of t){let t=this.paneRatios.get(e.id)??e.ratio??0,r=Number.isFinite(t)&&t>0?t:0;this.paneRatios.set(e.id,r),n+=r}if(n<=0){let e=1/t.length;for(let n of t)this.paneRatios.set(n.id,e);return}for(let e of t){let t=this.paneRatios.get(e.id)??0;this.paneRatios.set(e.id,t/n)}}getPaneMinHeight(e,t){let n=this.opt.defaultPaneMinHeightPx??120,r=e.minHeightPx??n;return Math.max(1,Math.min(Math.round(r),Math.max(1,t)))}computePaneHeightsByRatio(e,t){if(e.length===0)return[];let n=e.map(e=>this.paneRatios.get(e.id)??e.ratio??0),r=n.reduce((e,t)=>e+(t>0?t:0),0),i=(r>0?n.map(e=>(e>0?e:0)/r):e.map(()=>1/e.length)).map(e=>Math.max(1,Math.round(t*e))),a=e.map(e=>this.getPaneMinHeight(e,t));for(let e=0;e<i.length;e++)i[e]=Math.max(i[e],Math.min(a[e],t));let o=i.reduce((e,t)=>e+t,0);if(o>t){let e=o-t;for(;e>0;){let n=!1;for(let r=i.length-1;r>=0&&e>0;r--){let o=Math.max(1,Math.min(a[r],t)),s=i[r];s>o&&(i[r]=s-1,e--,n=!0)}if(!n)break}}else o<t&&(i[i.length-1]=(i[i.length-1]??1)+(t-o));return o=i.reduce((e,t)=>e+t,0),o!==t&&i.length>0&&(i[i.length-1]=Math.max(1,(i[i.length-1]??1)+(t-o))),i}layoutPanes(){let e=this.viewport;if(!e)return;let t=this.opt.panes.filter(e=>e.visible!==!1);if(t.length===0)return;let 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);this.normalizeVisiblePaneRatios(t);let o=this.computePaneHeightsByRatio(t,a);for(let i=0;i<t.length;i++){let a=t[i];if(!a)continue;let s=this.paneRenderers.find(e=>e.getPane().id===a.id);if(!s)continue;let c=s.getPane(),l=o[i]??1;c.setLayout(r,l),c.setPadding(this.opt.yPaddingPx,this.opt.yPaddingPx),s.resize(e.plotWidth,l,e.dpr),this.rendererPluginManager.notifyResize(c.id,Ki(c));let u=s.getDom();u.plotCanvas.style.top=`${r}px`,u.yAxisCanvas.style.top=`${r}px`,u.yAxisCanvas.style.left=`0px`,r+=l+n}let s=Math.max(1,a);for(let e of t){let t=this.paneRenderers.find(t=>t.getPane().id===e.id);if(!t)continue;let n=t.getPane().height;this.paneRatios.set(e.id,n/s)}this.normalizeVisiblePaneRatios(t),this.syncPaneRatiosToSpecs()}computeViewport(){let e=this.dom.container;if(!e)return null;let t=this.observedSize.width,n=this.observedSize.height,r=t>0?t:Math.max(1,Math.round(e.clientWidth)),i=n>0?n:Math.max(1,Math.round(e.clientHeight)),a=Math.round(r),o=Math.round(i-this.opt.bottomAxisHeight),s=this.getEffectiveDpr(),c=16*1024*1024;r*s*(i*s)>c&&(s=Math.sqrt(c/(r*i)));let l=Math.round(e.scrollLeft*s)/s;this.dom.canvasLayer.style.width=`${r}px`,this.dom.canvasLayer.style.height=`${i}px`,this.dom.xAxisCanvas.style.width=`${a}px`,this.dom.xAxisCanvas.style.height=`${this.opt.bottomAxisHeight}px`,this.dom.xAxisCanvas.width=Math.round(a*s),this.dom.xAxisCanvas.height=Math.round(this.opt.bottomAxisHeight*s);let u={viewWidth:r,viewHeight:i,plotWidth:a,plotHeight:o,scrollLeft:l,dpr:s};return this.viewport=u,this.onViewportChange?.(u),u}},Bc=3;function Vc(e,t){let n=(e-1)/(t.zoomLevelCount-1);return t.minKWidth+n*(t.maxKWidth-t.minKWidth)}function Hc(e){return Bc/e}function Uc(e,t,n,r,i,a,o){let s=Math.max(1,Math.min(o.zoomLevelCount,r+e));if(s===r)return null;let c=Vc(s,o),l=Hc(o.dpr),u=X(i,a,o.dpr),d=X(c,l,o.dpr),f=(Math.round((n+t)*o.dpr)-u.startXPx)/u.unitPx;return{targetLevel:s,newKWidth:c,newKGap:l,newScrollLeft:(d.startXPx+f*d.unitPx)/o.dpr-t}}function Wc(e,t,n,r,i,a,o){let s=Math.max(1,Math.min(o.zoomLevelCount,Math.round(e)))-r;return s===0?null:Uc(s,t,n,r,i,a,o)}function Gc(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}({}),Kc={volumeAmplifyThreshold:1.5,volumeShrinkThreshold:.8,avgPeriod:20},qc=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 Jc(e,t,n,r=Kc){let i=new qc;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 Yc(){return{name:`candle`,version:`1.0.0`,description:`K线蜡烛图渲染器`,debugName:`K线`,paneId:`main`,priority:K.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}=X(o,s,c);t.save(),t.translate(-a,0);let p=l||[],m=Jc(d,i.start,i.end,Kc);for(let r=i.start;r<i.end&&r<d.length;r++){let a=d[r];if(!a)continue;let s=n.yAxis.priceToY(a.open),l=n.yAxis.priceToY(a.close),h=n.yAxis.priceToY(a.high),g=n.yAxis.priceToY(a.low),_=p[r-i.start];if(!_)continue;let v=e=>Math.round(e*c)/c,y=v(s),b=v(l),x=v(h),S=v(g),C=Math.min(y,b),w=Math.max(Math.abs(y-b),1),T=xs(Math.round(_*c),C,f,w,c);t.fillStyle=Gc(a)===`up`?q.UP:q.DOWN,t.fillRect(T.bodyRect.x,T.bodyRect.y,T.bodyRect.width,T.bodyRect.height);let E=T.wickRect.width,D=T.wickRect.x,O=T.bodyRect.y,k=T.bodyRect.y+T.bodyRect.height,A=Math.max(a.open,a.close),j=Math.min(a.open,a.close);if(a.high>A){let e=ys(D,x,O,c);e&&t.fillRect(e.x,e.y,E,e.height)}if(a.low<j){let e=ys(D,k,S,c);e&&t.fillRect(e.x,e.y,E,e.height)}let M=m[r-i.start];if(M!==$.OTHERS&&u&&(e.zoomLevel??1)>=2){let e=M===$.RISE_WITH_VOLUME||M===$.RISE_WITHOUT_VOLUME?x-15:S+15;Xc(t,T.bodyRect.x+T.bodyRect.width/2,e,M,r,o,4,u,c)}}t.restore()}}}function Xc(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 Zc(e,t){return Math.max(3,Math.round(e/60)+1)}function Qc(){return{name:`gridLines`,version:`1.0.0`,description:`网格线渲染器`,debugName:`网格线`,paneId:qi,priority:K.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=Zc(n.height);t.save(),t.fillStyle=va.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=bs(f,p,Math.round(g+n*v),s);r&&t.fillRect(r.x,r.y,r.width,r.height)}let y=ma(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=ys(c[r]+o/2,0,n.height,s);a&&t.fillRect(a.x,a.y,a.width,a.height)}t.restore()}}}function $c(){return{name:`lastPriceLine`,version:`1.0.0`,description:`最新价虚线渲染器`,debugName:`最新价线`,paneId:`main`,priority:K.FOREGROUND,draw(e){let{ctx:t,pane:n,data:r,scrollLeft:i,kWidth:a,dpr:o,kLinePositions:s,paneWidth:c}=e,l=r,u=l[l.length-1];if(!u)return;t.save(),t.translate(-i,0);let d=Math.round(n.yAxis.priceToY(u.close)),f=s[0]??0,p=c+i;t.strokeStyle=q.LAST_PRICE,t.lineWidth=1,t.setLineDash([4,3]),t.beginPath();let m=(Math.floor(d*o)+.5)/o;t.moveTo(Math.round(f*o)/o,m),t.lineTo(Math.round(p*o)/o,m),t.stroke(),t.setLineDash([]),t.restore()}}}function el(){return{name:`extremaMarkers`,version:`1.0.0`,description:`可视区最高/最低价标注渲染器`,debugName:`极值标记`,paneId:qi,priority:K.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.role!==`price`)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),tl(t,_(h),n.yAxis.priceToY(p),p,s,c,a),tl(t,_(g),n.yAxis.priceToY(m),m,s,c,a),t.restore()}}}function tl(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=bs(u,d,n,i);f&&(e.fillStyle=ha.WEAK,e.fillRect(f.x,f.y,f.width,f.height));let p=Z(d,i),m=Z(n,i);e.fillStyle=ha.WEAK,e.beginPath(),e.arc(p,m,2,0,Math.PI*2),e.fill(),e.font=`12px Arial`,e.textBaseline=`middle`,e.fillStyle=q.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 nl(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 rl(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=pa(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 il(e,t){let{x:n,y:r,width:i,height:a,crosshairY:o,priceRange:s,yPaddingPx:c=0,dpr:l,bgColor:u=`rgba(0, 0, 0, 0.8)`,borderColor:d,textColor:f=`#ffffff`,fontSize:p=16,priceOffset:m=0,price:h,formatPrice:g}=t,_=Math.max(0,Math.min(c,Math.floor(a/2)-1)),{maxPrice:v,minPrice:y}=s,b=h??nl(o-r,v,y,a,_,_)+m,x=g?g(b):b.toFixed(2);e.save(),e.font=`${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,e.textBaseline=`middle`,e.textAlign=`center`;let S=p+4,C=Math.min(Math.max(o,r+S/2),r+a-S/2),w=C-S/2,T=n,E=Z(w,l),D=i,O=Z(S,l);e.fillStyle=u,e.fillRect(T,E,D,O),d&&(e.strokeStyle=d,e.lineWidth=1,e.strokeRect(Q(T,l),Q(E,l),Math.max(0,D-1/l),Math.max(0,O-1/l)));let k=n+i/2;e.fillStyle=f,e.fillText(x,Z(k,l),Z(C,l)),e.restore()}function al(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=ga.TRANSPARENT,textColor:m=ha.SECONDARY,lineColor:h=_a.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=ma(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}=ua(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 ol(e){let{ctx:t,dpr:n,axisWidth:r,height:i,paddingTop:a,paddingBottom:o,valueMin:s,valueMax:c,isMain:l,decimals:u=2,hideEdgeTicks:d=!0,formatLabel:f}=e,p=c-s||1;t.save(),t.clearRect(0,0,r,i),t.font=`12px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`,t.textBaseline=`middle`,t.textAlign=`center`;let m=r/2,h=a,g=Math.max(a,i-o),_=Math.max(0,g-h),v=Zc(i,l),y=p/Math.max(1,v-1);for(let e=0;e<v;e++){if(d&&(e===0||e===v-1))continue;let r=c-y*e,i=h+(v<=1?0:e/(v-1))*_;t.fillStyle=ha.SECONDARY,t.fillText(f?f(r):r.toFixed(u),Z(m,n),Z(i,n))}t.restore()}function sl(e){let{axisWidth:t,paneId:n,indicatorKey:r,label:i,decimals:a=2,yPaddingPx:o=0,getCrosshair:s,formatTickLabel:c,formatCrosshairLabel:l}=e,u=hs(r,n),d=null;return{name:`${r}Scale_${n}`,version:`1.0.0`,description:`${i} 刻度渲染器`,debugName:`${i}刻度`,paneId:n,priority:K.INDICATOR_SCALE,onInstall(e){d=e},draw(e){let{yAxisCtx:n,pane:r,dpr:i}=e;if(!n||!d)return;let f=d.getSharedState(u);if(!f)return;let p=r.yAxis.getDisplayRange({minPrice:f.valueMin,maxPrice:f.valueMax});ol({ctx:n,dpr:i,axisWidth:t,height:r.height,paddingTop:r.yAxis.getPaddingTop(),paddingBottom:r.yAxis.getPaddingBottom(),valueMin:p.minPrice,valueMax:p.maxPrice,isMain:!1,decimals:a,hideEdgeTicks:!1,formatLabel:c});let m=s?.();if(!m||m.activePaneId!==r.id)return;let h=m.y-r.top,g=r.yAxis.getPaddingTop(),_=r.yAxis.getPaddingBottom(),v=g,y=Math.max(g,r.height-_),b=Math.max(1,y-v),x=(Math.min(Math.max(h,v),y)-v)/b,S=p.maxPrice-x*(p.maxPrice-p.minPrice);il(n,{x:0,y:0,width:t,height:r.height,crosshairY:h,priceRange:p,yPaddingPx:o,dpr:i,fontSize:12,priceOffset:0,price:S,formatPrice:l})}}}function cl(e){return{name:`yAxis`,version:`1.0.0`,description:`Y轴价格刻度渲染器`,debugName:`Y轴`,paneId:qi,priority:K.SYSTEM_YAXIS,draw(t){let{ctx:n,pane:r,dpr:i,yAxisCtx:a,data:o}=t,s=a||n,c=a?.canvas?a.canvas.width/i:e.axisWidth,l=r.yAxis.getDisplayRange(r.priceRange);r.capabilities.showPriceAxisTicks&&ol({ctx:s,dpr:i,axisWidth:c,height:r.height,paddingTop:r.yAxis.getPaddingTop(),paddingBottom:r.yAxis.getPaddingBottom(),valueMin:l.minPrice,valueMax:l.maxPrice,isMain:!0,decimals:2,hideEdgeTicks:!1});let u=o,d=r.id===`main`?u[u.length-1]:null;if(d){let t=r.yAxis.priceToY(d.close);il(s,{x:0,y:r.top,width:c,height:r.height,crosshairY:t+r.top,priceRange:l,yPaddingPx:e.yPaddingPx,dpr:i,bgColor:`rgba(255, 247, 248, 0.98)`,borderColor:q.LAST_PRICE,textColor:q.LAST_PRICE,fontSize:12,priceOffset:0,price:d.close})}let f=e.getCrosshair?.();f&&f.activePaneId===r.id&&f.price!==null&&il(s,{x:0,y:r.top,width:c,height:r.height,crosshairY:f.y,priceRange:l,yPaddingPx:e.yPaddingPx,dpr:i,fontSize:12,priceOffset:0,price:f.price})}}}function ll(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`macd`,label:`MACD`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}var ul=1e8;function dl(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`volume`,label:`VOL`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair,formatTickLabel:e=>(e/ul).toFixed(2),formatCrosshairLabel:e=>`${(e/ul).toFixed(2)}亿`})}function fl(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`rsi`,label:`RSI`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function pl(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`cci`,label:`CCI`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function ml(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`stoch`,label:`STOCH`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function hl(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`mom`,label:`MOM`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function gl(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`wmsr`,label:`WMSR`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function _l(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`kst`,label:`KST`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}function vl(e){return sl({axisWidth:e.axisWidth,paneId:e.paneId,indicatorKey:`fastk`,label:`FASTK`,decimals:2,yPaddingPx:e.yPaddingPx,getCrosshair:e.getCrosshair})}var yl=Symbol(`time-axis`);function bl(e){return{name:`timeAxis`,version:`1.0.0`,description:`时间轴渲染器`,debugName:`时间轴`,paneId:yl,priority:K.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),al(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&&rl(d,{x:0,y:0,width:f,height:p,crosshairX:m.x,timestamp:e.timestamp,dpr:c,fontSize:12})}}}}function xl(e){return{name:`crosshair`,version:`1.0.0`,description:`十字线渲染器`,debugName:`十字线`,paneId:qi,priority:K.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=ka.LINE;let u=ys(s,0,r.height,i);if(u&&n.fillRect(u.x,u.y,u.width,u.height),c&&l>=0){let e=bs(0,a,Math.min(l,r.height-1/i),i);e&&n.fillRect(e.x,e.y,e.width,e.height)}n.restore()}}}function Sl(e){let t={...e};return{name:`paneTitle_${e.paneId}`,version:`1.0.0`,description:`面板标题渲染器`,debugName:`面板标题`,paneId:e.paneId,priority:K.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=ha.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=ha.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=ha.PRIMARY,n.fillText(t.title,12,i),t.description){let e=n.measureText(t.title).width;n.fillStyle=ha.WEAK,n.fillText(` - ${t.description}`,12+e,i)}n.restore()},setConfig(e){t={...t,...e}}}}var Cl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function wl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Cl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7.904 17.563a1.2 1.2 0 0 0 2.228.308l2.09-3.093l4.907 4.907a1.067 1.067 0 0 0 1.509 0l1.047-1.047a1.067 1.067 0 0 0 0-1.509l-4.907-4.907l3.113-2.09a1.2 1.2 0 0 0-.309-2.228L4 4z`},null,-1)]])}var Tl=(0,f.markRaw)({name:`tabler-pointer`,render:wl}),El={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Dl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,El,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 19h16M4 15l4-6l4 2l4-5l4 4`},null,-1)]])}var Ol=(0,f.markRaw)({name:`tabler-chart-line`,render:Dl}),kl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Al(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,kl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M17 7L7 17M8 7h9v9`},null,-1)]])}var jl=(0,f.markRaw)({name:`tabler-arrow-up-right`,render:Al}),Ml={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Nl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Ml,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14m-6 6l6-6m-6-6l6 6`},null,-1)]])}var Pl=(0,f.markRaw)({name:`tabler-arrow-right`,render:Nl}),Fl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Il(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Fl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14`},null,-1)]])}var Ll=(0,f.markRaw)({name:`tabler-minus`,render:Il}),Rl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function zl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Rl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3 12v.01M7 12h10m4 0v.01`},null,-1)]])}var Bl=(0,f.markRaw)({name:`tabler-separator`,render:zl}),Vl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Hl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Vl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v2m-4 12h2a2 2 0 0 0 2-2v-2M9 12h6m-3-3v6`},null,-1)]])}var Ul=(0,f.markRaw)({name:`tabler-crosshair`,render:Hl}),Wl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Gl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Wl,[...t[0]||=[(0,f.createElementVNode)(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[(0,f.createElementVNode)(`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0m9-3h.01`}),(0,f.createElementVNode)(`path`,{d:`M11 12h1v4h1`})],-1)]])}var Kl=(0,f.markRaw)({name:`tabler-info-circle`,render:Gl}),ql={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Jl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,ql,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v2m-4 12h2a2 2 0 0 0 2-2v-2`},null,-1)]])}var Yl=(0,f.markRaw)({name:`tabler-maximize`,render:Jl}),Xl={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Zl(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,Xl,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5`},null,-1)]])}var Ql=(0,f.markRaw)({name:`tabler-minimize`,render:Zl}),$l={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function eu(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,$l,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0-14 0m4 0h6m-3-3v6m11 8l-6-6`},null,-1)]])}var tu=(0,f.markRaw)({name:`tabler-zoom-in`,render:eu}),nu={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function ru(e,t){return(0,f.openBlock)(),(0,f.createElementBlock)(`svg`,nu,[...t[0]||=[(0,f.createElementVNode)(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0-14 0m4 0h6m8 11l-6-6`},null,-1)]])}var iu=(0,f.markRaw)({name:`tabler-zoom-out`,render:ru}),au={class:`left-toolbar`,"aria-label":`图表工具栏`},ou={class:`left-toolbar__group`},su=[`title`,`aria-label`,`onClick`],cu=[`onClick`],lu=[`title`,`aria-label`,`onClick`],uu={class:`left-toolbar__group`},du={class:`left-toolbar__group`},fu=[`title`,`aria-label`],pu=to((0,f.defineComponent)({__name:`LeftToolbar`,props:{isFullscreen:{type:Boolean}},emits:[`selectTool`,`toggleFullscreen`,`zoomIn`,`zoomOut`],setup(e,{emit:t}){let n=t,r=[{id:`cursor`,title:`光标`,icon:Tl},{id:`lines`,title:`线条`,icon:Ol,children:[{id:`trend-line`,title:`线段`,icon:Ol},{id:`ray`,title:`射线`,icon:jl},{id:`h-line`,title:`水平线`,icon:Ll},{id:`h-ray`,title:`水平射线`,icon:Pl},{id:`v-line`,title:`垂直线`,icon:Bl},{id:`crosshair-line`,title:`十字线`,icon:Ul},{id:`info-line`,title:`信息线`,icon:Kl}]}],i=(0,f.ref)(`cursor`),a=(0,f.ref)(null);function o(e){return i.value===e.id?!0:e.children?e.children.some(e=>e.id===i.value):!1}function s(e){if(e.children?.length){if(!e.children.some(e=>e.id===i.value)){let t=e.children[0];i.value=t.id,n(`selectTool`,t.id)}l(e.id);return}i.value=e.id,n(`selectTool`,e.id),a.value=null}function c(e){i.value=e.id,n(`selectTool`,e.id),a.value=null}function l(e){a.value=a.value===e?null:e}function u(e){e.target.closest(`.tool-item`)||(a.value=null)}return(0,f.onMounted)(()=>{document.addEventListener(`click`,u,!0)}),(0,f.onUnmounted)(()=>{document.removeEventListener(`click`,u,!0)}),(t,n)=>((0,f.openBlock)(),(0,f.createElementBlock)(`nav`,au,[(0,f.createElementVNode)(`div`,ou,[((0,f.openBlock)(),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(r,e=>(0,f.createElementVNode)(`div`,{key:e.id,class:`tool-item`},[(0,f.createElementVNode)(`button`,{type:`button`,class:(0,f.normalizeClass)([`left-toolbar__button`,{active:o(e)}]),title:e.title,"aria-label":e.title,onClick:t=>s(e),onPointerdown:n[0]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[1]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[2]||=(0,f.withModifiers)(()=>{},[`stop`])},[((0,f.openBlock)(),(0,f.createBlock)((0,f.resolveDynamicComponent)(e.icon),{class:`tool-icon`,"aria-hidden":`true`})),e.children&&e.children.length?((0,f.openBlock)(),(0,f.createElementBlock)(`span`,{key:0,class:(0,f.normalizeClass)([`corner-indicator`,{open:a.value===e.id}]),onClick:(0,f.withModifiers)(t=>l(e.id),[`stop`]),"aria-label":`展开子菜单`},null,10,cu)):(0,f.createCommentVNode)(``,!0)],42,su),(0,f.createVNode)(f.Transition,{name:`dropdown`},{default:(0,f.withCtx)(()=>[a.value===e.id&&e.children&&e.children.length?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:`tool-dropdown`,onPointerdown:n[3]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[4]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[5]||=(0,f.withModifiers)(()=>{},[`stop`])},[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(e.children,e=>((0,f.openBlock)(),(0,f.createElementBlock)(`button`,{key:e.id,type:`button`,class:(0,f.normalizeClass)([`left-toolbar__button`,{active:i.value===e.id}]),title:e.title,"aria-label":e.title,onClick:t=>c(e)},[((0,f.openBlock)(),(0,f.createBlock)((0,f.resolveDynamicComponent)(e.icon),{class:`tool-icon`,"aria-hidden":`true`}))],10,lu))),128))],32)):(0,f.createCommentVNode)(``,!0)]),_:2},1024)])),64))]),n[18]||=(0,f.createElementVNode)(`span`,{class:`left-toolbar__divider`},null,-1),(0,f.createElementVNode)(`div`,uu,[(0,f.createElementVNode)(`button`,{type:`button`,class:`left-toolbar__button`,title:`放大`,"aria-label":`放大`,onClick:n[6]||=e=>t.$emit(`zoomIn`),onPointerdown:n[7]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[8]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[9]||=(0,f.withModifiers)(()=>{},[`stop`])},[(0,f.createVNode)((0,f.unref)(tu),{class:`tool-icon`,"aria-hidden":`true`})],32),(0,f.createElementVNode)(`button`,{type:`button`,class:`left-toolbar__button`,title:`缩小`,"aria-label":`缩小`,onClick:n[10]||=e=>t.$emit(`zoomOut`),onPointerdown:n[11]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[12]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[13]||=(0,f.withModifiers)(()=>{},[`stop`])},[(0,f.createVNode)((0,f.unref)(iu),{class:`tool-icon`,"aria-hidden":`true`})],32)]),n[19]||=(0,f.createElementVNode)(`span`,{class:`left-toolbar__divider`},null,-1),(0,f.createElementVNode)(`div`,du,[(0,f.createElementVNode)(`button`,{type:`button`,class:`left-toolbar__button`,title:e.isFullscreen?`退出全屏`:`全屏显示`,"aria-label":e.isFullscreen?`退出全屏`:`全屏显示`,onClick:n[14]||=e=>t.$emit(`toggleFullscreen`),onPointerdown:n[15]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointermove:n[16]||=(0,f.withModifiers)(()=>{},[`stop`]),onPointerup:n[17]||=(0,f.withModifiers)(()=>{},[`stop`])},[e.isFullscreen?((0,f.openBlock)(),(0,f.createBlock)((0,f.unref)(Ql),{key:0,class:`tool-icon`,"aria-hidden":`true`})):((0,f.openBlock)(),(0,f.createBlock)((0,f.unref)(Yl),{key:1,class:`tool-icon`,"aria-hidden":`true`}))],40,fu)])]))}}),[[`__scopeId`,`data-v-b530debe`]]),mu={class:`chart-wrapper`},hu={class:`chart-main`},gu={class:`pane-separator-layer`,"aria-hidden":`true`},_u=4,vu=to((0,f.defineComponent)({__name:`KLineChart`,props:{semanticConfig:{},yPaddingPx:{default:0},minKWidth:{default:2},maxKWidth:{default:50},rightAxisWidth:{default:0},bottomAxisHeight:{default:24},priceLabelWidth:{default:60},zoomLevels:{default:20},initialZoomLevel:{default:3},isFullscreen:{type:Boolean,default:!1}},emits:[`zoomLevelChange`,`toggleFullscreen`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=(0,f.ref)(null),o=(0,f.ref)(null),s=(0,f.ref)(null),c=(0,f.ref)(null),l=(0,f.shallowRef)(null),u=(0,f.shallowRef)(null),d=ms({initialZoomLevel:r.initialZoomLevel??1,minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,zoomLevels:r.zoomLevels,rightAxisWidth:r.rightAxisWidth,priceLabelWidth:r.priceLabelWidth});d.actions.setZoomState(d.state.zoomLevel,Vc(d.state.zoomLevel,{minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,zoomLevelCount:r.zoomLevels,dpr:d.state.viewportDpr}),Hc(d.state.viewportDpr)),(0,f.computed)(()=>d.state.dataLength),(0,f.computed)(()=>d.state.viewportDpr);let p=(0,f.computed)(()=>d.state.zoomLevel),m=(0,f.computed)(()=>d.state.kWidth),h=(0,f.computed)(()=>d.state.kGap),g=(0,f.computed)(()=>d.state.paneRatios),_=(0,f.computed)(()=>d.state.selectedDrawingId),v=(0,f.computed)(()=>d.state.dataVersion);function y(){l.value?.scheduleDraw()}function b(e,t,n){let r=e.getBoundingClientRect();return{width:Math.max(t,Math.round(r.width)),height:Math.max(n,Math.round(r.height))}}function x(e){if(!e)return;let t=b(e,180,80);l.value?.interaction.setTooltipSize(t)}function S(e){e&&(k.value=b(e,120,60))}let C=(0,f.ref)({x:0,y:0}),w=(0,f.ref)(!1),T=(0,f.shallowRef)({crosshairPos:null,crosshairIndex:null,crosshairPrice:null,hoveredIndex:null,activePaneId:null,tooltipPos:{x:0,y:0},tooltipAnchorPlacement:`right-bottom`,hoveredMarkerData:null,hoveredCustomMarker:null,isDragging:!1,isResizingPaneBoundary:!1,isHoveringPaneBoundary:!1,hoveredPaneBoundaryId:null,isHoveringRightAxis:!1}),E=(0,f.shallowRef)(null),D=(0,f.computed)(()=>{let e=_.value;return e?d.state.drawings.find(t=>t.id===e)??null:null}),O=(0,f.ref)([]),k=(0,f.ref)({width:220,height:120}),A=(0,f.computed)(()=>T.value.hoveredMarkerData),j=(0,f.computed)(()=>T.value.hoveredCustomMarker),M=(0,f.computed)(()=>T.value.isDragging),N=(0,f.computed)(()=>T.value.isResizingPaneBoundary),ee=(0,f.computed)(()=>T.value.isHoveringPaneBoundary),te=(0,f.computed)(()=>T.value.hoveredPaneBoundaryId),ne=(0,f.computed)(()=>T.value.isHoveringRightAxis),re=(0,f.computed)(()=>T.value.hoveredIndex),ie=(0,f.computed)(()=>T.value.crosshairIndex),ae=(0,f.computed)(()=>{let e=T.value.hoveredIndex;if(typeof e!=`number`)return null;v.value;let t=l.value?.getData();return t&&e>=0&&e<t.length?t[e]:null}),oe=(0,f.computed)(()=>T.value.hoveredIndex),se=(0,f.computed)(()=>T.value.tooltipPos),ce=(0,f.computed)(()=>T.value.tooltipAnchorPlacement),le=(0,f.computed)(()=>{let e=l.value?.getViewport(),t=c.value,n=e?.plotWidth??(t?t.clientWidth:0);return C.value.x+12+k.value.width+12>n?`left-bottom`:`right-bottom`}),ue=(0,f.computed)(()=>(v.value,l.value?.getData()??[]));function de(e){E.value?.setTool(e)}function fe(e){let t=D.value;!t||!E.value||(E.value.updateDrawingStyle(t.id,e),d.actions.bumpDrawingVersion())}function pe(){let e=D.value;!e||!E.value||(E.value.removeDrawing(e.id),d.actions.setSelectedDrawingId(null),d.actions.bumpDrawingVersion(),d.actions.setDrawings(E.value.getDrawings()))}function me(e){let t=c.value;if(t){if(E.value?.onPointerDown(e,t)){d.actions.setDrawings(E.value.getDrawings()),d.actions.bumpDrawingVersion();return}l.value?.interaction.onPointerDown(e)}}function he(e){let t=c.value;if(t){let n=t.getBoundingClientRect();if(C.value={x:e.clientX-n.left,y:e.clientY-n.top},E.value?.onPointerMove(e,t)){d.actions.setDrawings(E.value.getDrawings());return}}l.value?.interaction.onPointerMove(e)}function ge(e){let t=c.value;if(t&&E.value?.onPointerUp(e,t)){d.actions.setDrawings(E.value.getDrawings());return}l.value?.interaction.onPointerUp(e)}function _e(e){l.value?.interaction.onPointerLeave(e)}function ve(e){l.value?.interaction.onRightAxisPointerDown(e)}function ye(e){l.value?.interaction.onRightAxisPointerMove(e)}function be(e){l.value?.interaction.onRightAxisPointerUp(e)}function xe(e){l.value?.interaction.onRightAxisPointerLeave(e)}function Se(){l.value?.interaction.onScroll()}let P=(0,f.ref)([]),F=(0,f.ref)({}),I=(0,f.ref)([]),Ce={VOLUME:{defaultParams:{},getTitleInfo:()=>({name:`VOL`,params:[],values:[]})},MACD:{defaultParams:{fastPeriod:12,slowPeriod:26,signalPeriod:9},getTitleInfo:(e,t,n)=>t===null?null:Bs(e,t,n.fastPeriod??12,n.slowPeriod??26,n.signalPeriod??9)},RSI:{defaultParams:{period1:6,period2:12,period3:24},getTitleInfo:(e,t,n)=>t===null?null:Us(e,t,n.period1??6,n.period2??12,n.period3??24)},CCI:{defaultParams:{period:14},getTitleInfo:(e,t,n)=>t===null?null:qs(e,t,n.period??14)},STOCH:{defaultParams:{n:9,m:3},getTitleInfo:(e,t,n)=>t===null?null:Zs(e,t,n.n??9,n.m??3)},MOM:{defaultParams:{period:10},getTitleInfo:(e,t,n)=>t===null?null:tc(e,t,n.period??10)},WMSR:{defaultParams:{period:14},getTitleInfo:(e,t,n)=>t===null?null:ac(e,t,n.period??14)},KST:{defaultParams:{roc1:10,roc2:15,roc3:20,roc4:30,signalPeriod:9},getTitleInfo:(e,t,n)=>t===null?null:dc(e,t,n.roc1??10,n.roc2??15,n.roc3??20,n.roc4??30,n.signalPeriod??9)},FASTK:{defaultParams:{period:9},getTitleInfo:(e,t,n)=>t===null?null:hc(e,t,n.period??9)}},we=Object.keys(Ce);function Te(){let e=g.value.main??3;return I.value.length===0?[{id:`main`,ratio:e,visible:!0,role:`price`}]:[{id:`main`,ratio:e,visible:!0,role:`price`},...I.value.map(e=>({id:e.id,ratio:g.value[e.id]??1,visible:!0,role:`indicator`}))]}function Ee(e){return{...Ce[e].defaultParams}}function De(e=`VOLUME`,t){if(I.value.length>=_u)return!1;let n=`sub_${e}`;if(I.value.some(e=>e.id===n))return!0;if(!l.value?.createSubPane(e,t??Ee(e)))return!1;let r=Sl({paneId:n,title:e,getTitleInfo:()=>Ne(n)});return l.value?.useRenderer(r),I.value.push({id:n,indicatorId:e,rendererName:`${e.toLowerCase()}_${n}`,paneTitleRendererName:r.name,params:t??Ee(e)}),P.value.includes(e)||P.value.push(e),y(),!0}function Oe(e){let t=I.value.findIndex(t=>t.id===e);if(t===-1)return;let n=I.value[t];n&&(l.value?.removeRenderer(n.paneTitleRendererName),l.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 ke(){for(let e of I.value)l.value?.removeRenderer(e.paneTitleRendererName);l.value?.clearSubPanes(),I.value=[],P.value=P.value.filter(e=>!we.includes(e))}function Ae(){let e=r.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,F],([e])=>{let t=l.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`)),y())},{deep:!0});function je(){let e=l.value?.getSubPaneIndicators()??[];I.value=[];for(let t of e){let e=`sub_${t}`,n=Sl({paneId:e,title:t,getTitleInfo:()=>Ne(e)});l.value?.useRenderer(n),I.value.push({id:e,indicatorId:t,rendererName:`${t.toLowerCase()}_${e}`,paneTitleRendererName:n.name,params:Ee(t)}),P.value.includes(t)||P.value.push(t)}y()}function Me(e,t){let n=I.value.find(t=>t.id===e);if(!n)return;let r=n.indicatorId;l.value?.removeRenderer(n.paneTitleRendererName),l.value?.removeSubPane(r),l.value?.createSubPane(t,Ee(t));let i=`sub_${t}`,a=Sl({paneId:i,title:t,getTitleInfo:()=>Ne(i)});l.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:Ee(t)}),P.value=P.value.filter(e=>e!==r),P.value.includes(t)||P.value.push(t)}function Ne(e){let t=I.value.find(t=>t.id===e);if(!t)return null;let n=l.value?.getData();if(!n||n.length===0)return null;let r=Ce[t.indicatorId],i=t.params;return r.getTitleInfo(n,ie.value,i)}function Pe(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(we.includes(e)){if(t){if(P.value.includes(e)||P.value.push(e),I.value.find(t=>t.indicatorId===e))return;if(!De(e)){let t=I.value[I.value.length-1];t&&Me(t.id,e)}}else P.value=P.value.filter(t=>t!==e),I.value.filter(t=>t.indicatorId===e).forEach(e=>Oe(e.id));y()}}function Fe(){l.value?.updateRendererConfig(`mainIndicatorLegend`,{indicators:{MA:{enabled:P.value.includes(`MA`),params:F.value.MA||{}},BOLL:{enabled:P.value.includes(`BOLL`),params:F.value.BOLL||{}},EXPMA:{enabled:P.value.includes(`EXPMA`),params:F.value.EXPMA||{}},ENE:{enabled:P.value.includes(`ENE`),params:F.value.ENE||{}}}})}function Ie(e,t){if(F.value[e]=t,e===`MA`||e===`BOLL`||e===`EXPMA`||e===`ENE`){e===`BOLL`&&l.value?.updateRendererConfig(`boll`,t),e===`EXPMA`&&l.value?.updateRendererConfig(`expma`,t),e===`ENE`&&l.value?.updateRendererConfig(`ene`,t),Fe(),y();return}we.includes(e)&&I.value.filter(t=>t.indicatorId===e).forEach(e=>{e.params={...t},l.value?.updateRendererConfig(e.rendererName,t)}),y()}function Le(e){if(!e.length||I.value.length<=1)return;let t=e.filter(e=>we.includes(e));if(!t.length)return;let n=new Map(I.value.map(e=>[e.indicatorId,e])),r=[];for(let e of t){let t=n.get(e);t&&(r.push(t),n.delete(e))}if(r.length===0)return;for(let e of I.value)n.has(e.indicatorId)&&(r.push(e),n.delete(e.indicatorId));let i=I.value.map(e=>e.id),a=r.map(e=>e.id);if(i.join(`|`)===a.join(`|`))return;I.value=r;let o=P.value.filter(e=>!we.includes(e)),s=I.value.map(e=>e.indicatorId);P.value=[...o,...s];let c=l.value;c&&c.updatePaneLayout(Te())}let Re=(0,f.computed)(()=>r.rightAxisWidth+r.priceLabelWidth),ze=d.computed.totalWidth;function Be(){let e=c.value;e&&(e.scrollLeft=e.scrollWidth,y())}function Ve(e,t){let n=l.value,a=c.value;if(!n||!a)return;let o=n.getCurrentDpr(),s=Wc(e,t??(n.getViewport()?.plotWidth??a.clientWidth)/2,a.scrollLeft,p.value,m.value,h.value,{minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,zoomLevelCount:r.zoomLevels,dpr:o});s&&(d.actions.setZoomState(s.targetLevel,s.newKWidth,s.newKGap),n.interaction.clearHover(),(0,f.nextTick)(()=>{let e=c.value;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth),r=Math.min(Math.max(0,s.newScrollLeft),t);e.scrollLeft=Math.round(r*o)/o,n.applyRenderState(s.newKWidth,s.newKGap,s.targetLevel),i(`zoomLevelChange`,s.targetLevel,s.newKWidth)}))}return t({scheduleRender:y,scrollToRight:Be,addSubPane:De,removeSubPane:Oe,switchSubIndicator:Me,clearAllSubPanes:ke,get plugin(){return l.value?.plugin},zoomToLevel:Ve,zoomIn:e=>Ve(p.value+1,e),zoomOut:e=>Ve(p.value-1,e),getZoomLevel:()=>p.value,getZoomLevelCount:()=>l.value?.getZoomLevelCount()??10}),(0,f.onMounted)(()=>{w.value=typeof CSS<`u`&&CSS.supports(`anchor-name: --kmap-anchor`)&&CSS.supports(`position-anchor: --kmap-anchor`);let e=c.value,t=o.value,n=s.value,g=a.value;if(!e||!t||!n||!g)return;let _=t=>{t.preventDefault();let n=l.value;if(!n)return;let a=e.getBoundingClientRect(),o=t.clientX-a.left,s=e.scrollLeft,u=n.getCurrentDpr(),g=Uc(t.deltaY>0?-1:1,o,s,p.value,m.value,h.value,{minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,zoomLevelCount:r.zoomLevels,dpr:u});g&&(d.actions.setZoomState(g.targetLevel,g.newKWidth,g.newKGap),n.interaction.clearHover(),(0,f.nextTick)(()=>{let e=c.value;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth),r=Math.min(Math.max(0,g.newScrollLeft),t);e.scrollLeft=Math.round(r*u)/u,n.applyRenderState(g.newKWidth,g.newKGap,g.targetLevel),i(`zoomLevelChange`,g.targetLevel,g.newKWidth)}))};e.addEventListener(`wheel`,_,{passive:!1});let v=new zc({container:e,canvasLayer:t,rightAxisLayer:n,xAxisCanvas:g},{yPaddingPx:r.yPaddingPx,rightAxisWidth:r.rightAxisWidth,bottomAxisHeight:r.bottomAxisHeight,priceLabelWidth:r.priceLabelWidth,minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,panes:[{id:`main`,ratio:1}],paneGap:0,zoomLevels:r.zoomLevels,initialZoomLevel:r.initialZoomLevel});v.useRenderer(Qc()),v.useRenderer(el()),v.useRenderer(Cs({ma5:!0,ma10:!0,ma20:!0,ma30:!0,ma60:!0})),v.useRenderer(Ts()),v.setRendererEnabled(`boll`,!1),v.useRenderer(ks()),v.setRendererEnabled(`expma`,!1),v.useRenderer(Ms()),v.setRendererEnabled(`ene`,!1),v.useRenderer(Yc()),v.useRenderer($c()),v.useRenderer(oa());let y=r.rightAxisWidth+r.priceLabelWidth,b=()=>{let e=v.interaction.crosshairPos,t=v.interaction.crosshairPrice,n=v.interaction.activePaneId;return e&&t!==null?{y:e.y,price:t,activePaneId:n}:null};v.useRenderer(cl({axisWidth:y,yPaddingPx:r.yPaddingPx,getCrosshair:b})),v.useRenderer(Ps({yPaddingPx:r.yPaddingPx}));let x=[{create:dl,paneId:`sub_VOLUME`},{create:ll,paneId:`sub_MACD`},{create:fl,paneId:`sub_RSI`},{create:pl,paneId:`sub_CCI`},{create:ml,paneId:`sub_STOCH`},{create:hl,paneId:`sub_MOM`},{create:gl,paneId:`sub_WMSR`},{create:_l,paneId:`sub_KST`},{create:vl,paneId:`sub_FASTK`}];for(let e of x)v.useRenderer(e.create({axisWidth:y,paneId:e.paneId,yPaddingPx:r.yPaddingPx,getCrosshair:b}));v.useRenderer(xl({getCrosshairState:()=>({pos:v.interaction.crosshairPos,activePaneId:v.interaction.activePaneId,isDragging:v.interaction.isDraggingState(),price:v.interaction.crosshairPrice})})),v.useRenderer(bl({height:r.bottomAxisHeight,getCrosshair:()=>{let e=v.interaction.crosshairPos,t=v.interaction.crosshairIndex;return e&&t!==null?{x:e.x,index:t}:null}})),v.setOnViewportChange(e=>{d.actions.setViewportDpr(e.dpr),d.actions.setViewWidth(e.plotWidth);let t=Hc(e.dpr);d.actions.setZoomState(d.state.zoomLevel,d.state.kWidth,t),v.applyRenderState(d.state.kWidth,t,d.state.zoomLevel)}),v.setOnPaneLayoutChange(e=>{let t={};for(let n of e)t[n.id]=n.ratio;d.actions.setPaneRatios(t);let n=v.getPaneRenderers(),r=c.value&&parseInt(getComputedStyle(c.value).borderTopWidth)||0;O.value=n.slice(0,-1).map(e=>{let t=e.getPane();return{id:t.id,top:t.top+t.height+r}})}),v.setOnDataChange(e=>{d.actions.setDataLength(e.length),d.actions.bumpDataVersion()}),l.value=v,v.applyRenderState(d.state.kWidth,d.state.kGap,d.state.zoomLevel),E.value=new yc(v),E.value.setCallbacks({onDrawingCreated:e=>{d.actions.setDrawings([...d.state.drawings,e]),d.actions.setSelectedDrawingId(e.id)},onToolChange:e=>{},onDrawingSelected:e=>{d.actions.setSelectedDrawingId(e?.id??null)}}),v.interaction.setTooltipAnchorPositioning(w.value),v.interaction.setOnInteractionChange(e=>{T.value=e}),v.interaction.setOnPinchZoom((e,t)=>{let n=c.value;if(!n||!v)return;let a=t-n.getBoundingClientRect().left,o=n.scrollLeft,s=v.getCurrentDpr(),l=Uc(e,a,o,p.value,m.value,h.value,{minKWidth:r.minKWidth,maxKWidth:r.maxKWidth,zoomLevelCount:r.zoomLevels,dpr:s});l&&(d.actions.setZoomState(l.targetLevel,l.newKWidth,l.newKGap),v.interaction.clearHover(),(0,f.nextTick)(()=>{let e=c.value;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth),n=Math.min(Math.max(0,l.newScrollLeft),t);e.scrollLeft=Math.round(n*s)/s,v.applyRenderState(l.newKWidth,l.newKGap,l.targetLevel),i(`zoomLevelChange`,l.targetLevel,l.newKWidth)}))}),T.value=v.interaction.getInteractionSnapshot(),d.actions.setViewportDpr(v.getCurrentDpr()),v.resize(),u.value=new Ai(v),u.value.on(`config:error`,e=>{console.error(`Semantic config error:`,e)}),u.value.on(`config:ready`,()=>{d.actions.setDataLength(v.getData()?.length??0),d.actions.bumpDataVersion(),Ae(),je(),(0,f.nextTick)(()=>Be())}),u.value.applyConfig(r.semanticConfig).then(e=>{e&&!e.success&&console.error(`Semantic config apply failed:`,e.errors)}),v.__onWheel=_}),(0,f.onUnmounted)(()=>{let e=l.value;if(e){let t=e.__onWheel,n=c.value;t&&n&&n.removeEventListener(`wheel`,t),e.destroy()}l.value=null,E.value=null}),(0,f.watch)(()=>r.yPaddingPx,e=>{l.value?.updateOptions({yPaddingPx:e}),y()}),(0,f.watch)(()=>r.semanticConfig,async(e,t)=>{if(e&&e!==t){let t=await u.value?.applyConfig(e);t&&!t.success&&console.error(`Semantic config apply failed:`,t.errors)}},{deep:!0}),(t,n)=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,mu,[(0,f.createElementVNode)(`div`,{class:(0,f.normalizeClass)([`chart-stage`,{"is-dragging":M.value,"is-resizing-pane":N.value,"is-hovering-pane-separator":ee.value,"is-hovering-right-axis":ne.value,"is-hovering-kline":re.value!==null}])},[(0,f.createVNode)(pu,{"is-fullscreen":e.isFullscreen,onSelectTool:de,onToggleFullscreen:n[0]||=e=>t.$emit(`toggleFullscreen`),onZoomIn:n[1]||=e=>Ve(p.value+1),onZoomOut:n[2]||=e=>Ve(p.value-1)},null,8,[`is-fullscreen`]),(0,f.createElementVNode)(`div`,hu,[(0,f.createElementVNode)(`div`,gu,[((0,f.openBlock)(!0),(0,f.createElementBlock)(f.Fragment,null,(0,f.renderList)(O.value,e=>((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:e.id,class:(0,f.normalizeClass)([`pane-separator-line`,{"is-active":te.value===e.id}]),style:(0,f.normalizeStyle)({top:`${e.top}px`})},null,6))),128))]),(0,f.createElementVNode)(`div`,{class:`chart-container`,ref_key:`containerRef`,ref:c,onScrollPassive:Se,onPointerdown:me,onPointermove:he,onPointerup:ge,onPointerleave:_e},[(0,f.createElementVNode)(`div`,{class:`scroll-content`,style:(0,f.normalizeStyle)({width:(0,f.unref)(ze)+`px`})},[(0,f.createElementVNode)(`div`,{class:`canvas-layer`,ref_key:`canvasLayerRef`,ref:o},[(0,f.createElementVNode)(`canvas`,{class:`x-axis-canvas`,ref_key:`xAxisCanvasRef`,ref:a},null,512),ae.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:0,class:(0,f.normalizeClass)([`tooltip-anchor kline-tooltip-anchor`,{"use-anchor":w.value}]),style:(0,f.normalizeStyle)({left:`${se.value.x}px`,top:`${se.value.y}px`})},null,6)):(0,f.createCommentVNode)(``,!0),A.value||j.value?((0,f.openBlock)(),(0,f.createElementBlock)(`div`,{key:1,class:(0,f.normalizeClass)([`tooltip-anchor marker-tooltip-anchor`,{"use-anchor":w.value}]),style:(0,f.normalizeStyle)({left:`${C.value.x}px`,top:`${C.value.y}px`})},null,6)):(0,f.createCommentVNode)(``,!0),ae.value?((0,f.openBlock)(),(0,f.createBlock)(no,{key:2,k:ae.value,index:oe.value,data:ue.value,pos:se.value,"set-el":x,"use-anchor":w.value,"anchor-placement":ce.value},null,8,[`k`,`index`,`data`,`pos`,`use-anchor`,`anchor-placement`])):(0,f.createCommentVNode)(``,!0),A.value||j.value?((0,f.openBlock)(),(0,f.createBlock)(so,{key:3,marker:A.value||j.value,pos:C.value,"use-anchor":w.value,"anchor-placement":le.value,"set-el":S},null,8,[`marker`,`pos`,`use-anchor`,`anchor-placement`])):(0,f.createCommentVNode)(``,!0),D.value?((0,f.openBlock)(),(0,f.createBlock)(is,{key:4,drawing:D.value,onUpdateStyle:fe,onDelete:pe},null,8,[`drawing`])):(0,f.createCommentVNode)(``,!0)],512)],4)],544),(0,f.createElementVNode)(`div`,{class:`right-axis-host`,ref_key:`rightAxisLayerRef`,ref:s,style:(0,f.normalizeStyle)({width:Re.value+`px`}),onPointerdown:ve,onPointermove:ye,onPointerup:be,onPointerleave:xe},null,36)])],2),(0,f.createVNode)(Xo,{"active-indicators":P.value,"indicator-params":F.value,onToggle:Pe,onUpdateParams:Ie,onReorderSubIndicators:Le},null,8,[`active-indicators`,`indicator-params`])]))}}),[[`__scopeId`,`data-v-3f35943c`]]),yu={install(e){e.component(`KLineChart`,vu)}};exports.ConfigManager=Xi,exports.EventBus=p,exports.GLOBAL_PANE_ID=qi,exports.HookSystem=Yi,exports.KLineChart=vu,exports.KMapPlugin=yu,exports.PluginHostImpl=Qi,exports.PluginRegistry=Ji,exports.PluginState=Gi,exports.RENDERER_PRIORITY=K,exports.RendererPluginManager=ta,exports.createPluginHost=$i,exports.wrapPaneInfo=Ki;