UNPKG

tradex-chart

Version:

TradeX-chart is a highly customizable stock trade chart with **one** dependency written in plain JavaScript; use it with any framework or backend.

11 lines 850 kB
(function(oA,ti){typeof exports=="object"&&typeof module<"u"?ti(exports):typeof define=="function"&&define.amd?define(["exports"],ti):(oA=typeof globalThis<"u"?globalThis:oA||self,ti(oA["TradeX-chart"]={}))})(this,function(oA){"use strict";function ti(n,A){for(var e=0;e<A.length;e++){const i=A[e];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in n)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const ii="TradeX-Chart",xe="TX",JC="tradeXutils",Ag="tradeXmenus",HC="tradeXmenu",eg="tradeXdividers",tg="tradeXwindows",_C="tradeXwindow",ig="tradeXprogress",WC=500,sg="stream_None",si="stream_Listening",Us="stream_Started",ng="stream_Stopped",YC="stream_Error",Ti="stream_candleFirst",Qe="stream_candleUpdate",vi="stream_candleNew",ZC=250,VC=8,og=2,XC=2,rg=18,tt=100,ni=/^(\d*\.?\d+)\s?(px|em|ex|%|in|cn|mm|pt|pc+)$/igm;let jC=Object.prototype.hasOwnProperty;function $C(n,A,e=void 0){const i=o=>String.prototype.split.call(A,o).filter(Boolean).reduce((r,a)=>r!=null?r[a]:r,n),s=i(/[,[\]]+?/)||i(/[,[\].]+?/);return s===void 0||s===n?e:s}function zC(n,A,e){if(A.length===0)return;let i=n,s=A[A.length-1];if(A.length===1)return Q(i)?i[s]=e:void 0;for(let o=0;o<A.length-1;o++){let r=A[o];(!jC.call(i,r)||!Q(i[r]))&&(i[r]={}),i=i[r]}return i[s]=e}function ag(n,A){let e=Object.getPrototypeOf(A);for(;n--;)e=Object.getPrototypeOf(e);return e}function Ig(n,A,e=3){(!K(e)||e<1)&&(e=3);for(let i=e;i>=0;i--)if(ag(i,A)[n])return!0;return!1}function ie(n,A){return!Q(n)||!Q(A)?A:(Object.keys(A).forEach(e=>{const i=n[e],s=A[e];N(i)&&N(s)?n[e]=ie(i.concat([]),s):Q(i)&&Q(s)?n[e]=ie(Object.assign({},i),s):n[e]=s}),n)}function Ui(n){if(n===null||typeof n!="object")return n;let A;n instanceof Date?A=new n.constructor:A=N(n)?[]:{};for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(typeof n[e]!="object"||n[e]===n?A[e]=n[e]:A[e]=Ui(n[e]));return A}function iA(n){try{return structuredClone(n)}catch{return Ui(n)}}function gg(n,A){if(n==null)return String(n);switch(typeof n){case"string":return'"'+n+'"';case"function":return n.toString();case"object":let e=Array(A||1).join(" "),i=Array.isArray(n);return"{["[+i]+Object.keys(n).map(function(s){return` `+e+s+": "+gg(n[s],(A||1)+1)}).join(",")+` `+e+"}]"[+i];default:return n.toString()}}function hg(n,A){if(Q(n))for(let e in n)typeof n[e]=="object"&&n[e]!==null?hg(n[e],A):n.hasOwnProperty(e)&&A(e,n[e])}const lg=(n,A,e)=>{if(n.Id===A)return e(n);for(let i in n)n[i]!==null&&typeof n[i]=="object"&&(n[i]=lg(n[i],A,e));return n};function AE(n,A){n.split(".")}function Ps(n,A,e){const[i,...s]=A.split(".");return{...n,[i]:s.length?Ps(n[i],s.join("."),e):e}}function Os(n,A){return A.split(".").reduce((i,s)=>i&&i[s]!=="undefined"?i[s]:void 0,n)}class eE{constructor(){this.nodes=[]}get size(){return this.nodes.length}get head(){return this.size?this.nodes[0]:null}get tail(){return this.size?this.nodes[this.size-1]:null}insertAt(A,e){const i=this.nodes[A-1]||null,s=this.nodes[A]||null,o={value:e,next:s,previous:i};i&&(i.next=o),s&&(s.previous=o),this.nodes.splice(A,0,o)}insertFirst(A){this.insertAt(0,A)}insertLast(A){this.insertAt(this.size,A)}getAt(A){return this.nodes[A]}removeAt(A){const e=this.nodes[A-1]||null,i=this.nodes[A+1]||null;return e&&(e.next=i),i&&(i.previous=e),this.nodes.splice(A,1)}clear(){this.nodes=[]}reverse(){this.nodes=this.nodes.reduce((A,{value:e})=>{const i=A[0]||null,s={value:e,next:i,previous:null};return i&&(i.previous=s),[s,...A]},[])}*[Symbol.iterator](){yield*this.nodes}}function Pi(n,A){if(!N(n)||!N(A)||n.length!==A.length)return!1;let e=n.length;for(;e--;){if(N(n[e])||N(A[e])){if(!Pi(n[e],A[e]))return!1;continue}if(Q(n[e])||Q(n[e])){if(!it(n[e],A[e]))return!1;continue}if(n[e]!==A[e])return!1}return!0}function tE(n,A){let e=1/0,i=-1,s=null,o=0;for(;o++<A.length;){let r=A[o],a=Math.abs(r-n);a<e&&(e=a,i=o,s=r)}return[i,s]}function Cg(n,A,e){let i=n[A];n.splice(A,1),n.splice(e,0,i)}function Eg(n,A,e){[n[A],n[e]]=[n[e],n[A]]}function Oi(n,A){return N(A)?N(n)?n.every(e=>A.includes(e)):A.includes(n):!1}const iE=n=>[...new Set(n)],sE=(n,A)=>Object.values(n.reduce((e,i)=>(e[A(i)]=i,e),{})),nE=(n,A)=>n.filter(e=>A.includes(e)),oi=(n,A)=>n.filter(e=>!A.includes(e)),oE=(n,A)=>oi(n,A).concat(oi(A,n)),rE=(n,A)=>oi(n,A).concat(A);function aE(n){return!(!Q(n)||Object.keys.length)}function ug(n){return Q(n)?!!Object.keys(n).length:!1}function it(n,A){if(!Q(n)||!Q(A))return!1;const e=Object.keys(n).sort(),i=Object.keys(A).sort();return e.length!==i.length?!1:e.every((o,r)=>{const a=n[o],I=A[i[r]];return N(a)||N(I)?Pi(a,I):Q(a)||Q(I)?it(a,I):a===I})}function uA(n="ID"){K(n)?n=n.toString():R(n)||(n="ID"),n=de(n);const A=Date.now().toString(36),e=Math.random().toString(36).substring(2,5);return`${n}_${A}_${e}`}function de(n){return String(n).replace(/ |,|;|:|\.|#/g,"_")}function IE(n,A,e){A=A||"",e=e||512;let i=atob(n),s=[];for(let r=0;r<i.length;r+=e){let a=i.slice(r,r+e),I=new Array(a.length);for(let E=0;E<a.length;E++)I[E]=a.charCodeAt(E);let l=new Uint8Array(I);s.push(l)}return new Blob(s,{type:A})}function gE(n,A){return A instanceof Map?{dataType:"Map",value:[...A.entries()]}:A}function hE(n,A){return typeof A=="object"&&A!==null&&A.dataType==="Map"?new Map(A.value):A}const cg=n=>n.entries().next().value,Bg=n=>n.entries().next().value[0],Qg=n=>n.entries().next().value[1],dg=n=>[...n].pop(),mg=n=>[...n.keys()].pop(),Dg=n=>[...n.values()].pop();class BA extends Map{constructor(A){super(A)}indexOfKey(A){return[...this.keys()].indexOf(A)}indexOfValue(A){return[...this.values()].indexOf(A)}entryAtIndex(A){return[...this.entries()][A]}keyAtIndex(A){return[...this.keys()][A]}valueAtIndex(A){return[...this.values()][A]}insert(A,e,i){return this.insertIndex(i,A,e)}remove(A){return this.removeIndex(A)}firstEntry(){return cg(this)}firstKey(){return Bg(this)}firstValue(){return Qg(this)}lastEntry(){return dg(this)}lastKey(){return mg(this)}lastValue(){return Dg(this)}prevCurrNext(A){let e=curr=next=null;for(let i of this)if(e=curr,curr=i,i.key==A)break;return{prev:e,curr,next}}union(...A){if(typeof super.prototype.union=="function")super.union(...A);else for(const e of A)for(const i of e)this.set(...i)}setMultiple(A){return N(A)?(A.forEach(([e,i])=>this.set(e,i)),!0):!1}populate(A){return N(A)?(this.clear(),A.forEach(([e,i])=>this.set(e,i)),!0):!1}insertIndex(A,e,i){if(!K(A))return!1;const s=[...this];return s.splice(A,0,[e,i]),this.populate(s),!0}removeIndex(A){if(!K(A))return!1;const e=[...this];return e.splice(A,1),this.populate(e),!0}swapIndices(A,e){if(!K(A)||!K(e))return!1;const i=[...this];return Eg(i,A,e),this.populate(i),!0}swapKeys(A,e){const i=[...this],s=i.findIndex(([r])=>r===A),o=i.findIndex(([r])=>r===e);return[i[s],i[o]]=[i[o],i[s]],this.clear(),i.forEach(([r,a])=>this.set(r,a)),!0}}function JA(n,A=100,e,i=!1){let s;return function(){let o=e||this,r=arguments,a=function(){s=null,i||n.apply(o,r)},I=i&&!s;clearTimeout(s),s=setTimeout(a,A),I&&n.apply(o,r)}}function pg(n,A=250,e){let i,s,o=function(){let a=e||this,I=new Date,l=arguments;i&&I<i+A?(clearTimeout(s),s=setTimeout(function(){i=I,n.apply(a,l)},A)):(i=I,n.apply(a,l))};function r(){timeout&&(clearTimeout(s),timeout=void 0)}return o.reset=function(){r(),i=0},o}const lE=(n,...A)=>{class e extends n{constructor(...o){super(...o),A.forEach(r=>{i(this,new r)})}}let i=(s,o)=>{Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o)).forEach(r=>{r.match(/^(?:constructor|prototype|arguments|caller|name|bind|call|apply|toString|length)$/)||Object.defineProperty(s,r,Object.getOwnPropertyDescriptor(o,r))})};return A.forEach(s=>{i(e.prototype,s.prototype),i(e,s)}),e};function CE(n){const A={};return Promise.race([n,A]).then(e=>e===A?"pending":"fulfilled",()=>"rejected")}class EE{constructor(){this.promise=new Promise((A,e)=>{this.resolve=A,this.reject=e})}}function yg(n){return String.fromCharCode.apply(null,new Uint16Array(n))}function wg(n){let A=new ArrayBuffer(n.length*2),e=new Uint16Array(A);for(let i=0,s=n.length;i<s;i++)e[i]=n.charCodeAt(i);return A}function uE(n){const A=document.createElement("canvas"),e=A.getContext("2d");let i;n.isView(n)?i=n:typeof n=="string"&&(i=wg(n));const s=new Uint8ClampedArray.from(i),o=s.length;A.height=1,A.width=o,e.putImageData(s);const r=e.toDataURL(),a=getBase64StringFromDataURL(r);return{dataURL:r,base64:a}}function cE(n,A,e="string"){const i=new Image,s=document.createElement("canvas").getContext("2d");return i.src=n,i.decode().then(()=>{s.width=i.width,s.height=i.height,s.drawImage(i,0,0);const o=s.getImageData(0,0,i.width,i.height).data,r=e==="string"?yg(o):o;A(r)})}class DA{static#A=new BA;static get entries(){return DA.#A}static isValid(A,e,i,s){return!Q(A)||!QA(e)||!R(i)||!U(s)}static add(A,e,i,s){if(!this.isValid(A,e,i,s))return!1;e.addEventListener(i,s),DA.#A.has(A)||DA.#A.set(A,new BA);const o=DA.#A.get(A);o.has(e)||o.set(e,{});const r=o.get(e);return N(r[i])||(r[i]=[]),r[i].push(s),!0}static remove(A,e,i,s){if(!DA.isValid(A,e,i,s)||!DA.#A.has(A))return!1;const o=DA.#A.get(A);if(!o.has(e))return!1;const r=o.get(e);if(!(i in r))return!1;const a=r[i].indexOf(s);return a<0?!1:(r[i].splice(a,1),r[i].length==0&&delete r[i],Object.keys(r).length==0&&o.delete(e),o.size==0&&DA.#A.delete(A),!0)}static expungeEvent(A,e,i){if(!Q(A)||!QA(e)||!R(i))return!1;const s=DA.#A.get(A);if(!s.has(e))return!1;const o=s.get(e);if(i in o){for(let r of o[i])e.removeEventListener(i,r);delete o[i]}return!0}static expungeElement(A,e){if(!Q(A)||!QA(e))return!1;const i=DA.#A.get(A);if(i.has(e)){let s=i.get(e);for(let o in s)DA.expungeEvent(A,e,o);i.delete(e)}return!0}static expungeContext(A){if(!Q(A))return!1;if(DA.#A.has(A)){const e=DA.#A.get(A);for(let i of e)DA.expungeElement(A,i);DA.#A.delete(A)}return!0}static expungeAll(){}static destroy(){for(let A of DA.#A)DA.expungeContext(A);return DA.#A=void 0,!0}}async function BE(n,A){const e=a=>new Uint8Array([...decodeURIComponent(encodeURIComponent(a))].map(I=>I.charCodeAt(0))),i=e(n),s=e(A),o=await crypto.subtle.importKey("raw",i,{name:"HMAC",hash:"SHA-256"},!0,["sign"]),r=await crypto.subtle.sign("HMAC",o,s);return btoa(String.fromCharCode(...new Uint8Array(r)))}async function QE(n){const A=new TextEncoder().encode(n),e=await crypto.subtle.digest("SHA-256",A);return Array.from(new Uint8Array(e)).map(o=>o.toString(16).padStart(2,"0")).join("")}function xs(n,A=0){let e=3735928559^A,i=1103547991^A;for(let s=0,o;s<n.length;s++)o=n.charCodeAt(s),e=Math.imul(e^o,2654435761),i=Math.imul(i^o,1597334677);return e=Math.imul(e^e>>>16,2246822507),e^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(e^e>>>13,3266489909),(i>>>0).toString(16).padStart(8,0)+(e>>>0).toString(16).padStart(8,0)}const dE=Object.freeze(Object.defineProperty({__proto__:null,Deferred:EE,DoubleLinkedList:eE,EventHandlers:DA,H:QE,HMAC:BE,_get:$C,_set:zC,ab2str:yg,arrayMove:Cg,b64toBlob:IE,copyDeep:Ui,cyrb53:xs,debounce:JA,decodePNGDataStore:cE,diff:oi,doStructuredClone:iA,encodePNGDataStore:uE,extender:lE,findInObjectById:lg,firstEntryInMap:cg,firstKeyInMap:Bg,firstValueInMap:Qg,getProperty:Os,getPrototypeAt:ag,idSanitize:de,intersection:nE,isArrayEqual:Pi,isObjectAndEmpty:aE,isObjectEqual:it,isObjectNotEmpty:ug,lastEntryInMap:dg,lastKeyInMap:mg,lastValueInMap:Dg,mergeDeep:ie,nearestArrayValue:tE,objRecurse:hg,objRecurseUpdate:AE,objToString:gg,promiseState:CE,prototypeHas:Ig,replacer:gE,reviver:hE,setProperty:Ps,str2ab:wg,swapArrayElements:Eg,symDiff:oE,throttle:pg,uid:uA,union:rE,unique:iE,uniqueBy:sE,valuesInArray:Oi,xMap:BA},Symbol.toStringTag,{value:"Module"}));function N(n){return Array.isArray(n)}function qe(n,A){return N(n)?n.every(e=>ai(A,e)):!1}function U(n){return n&&typeof n=="function"}function fg(n){return U(n)&&Object.prototype.toString.call(n)==="[object AsyncFunction]"}function Q(n){return typeof n=="object"&&!Array.isArray(n)&&n!==null}function qs(n,A,e){if(!Q(n)||!Q(A))return!1;const i=Object.keys(n),s=Object.keys(A);if(e&&!Pi(i,s))return!1;for(let o of s)if(!ai(A[o],n[o]))return!1;return!0}function K(n){return typeof n=="number"&&!isNaN(n)}function _(n){return typeof n=="number"&&Math.abs(n%1)===0}function Mg(n){return n!=null}function aA(n){return typeof n=="boolean"}function R(n){return typeof n=="string"}function Sg(n){return n instanceof Map}function ri(n){return!!n&&(Q(n)||U(n))&&U(n.then)&&n[Symbol.toStringTag]==="Promise"}function Rg(n){return n instanceof Error}function Je(n){return!(n&&n.constructor===Function)||n.prototype===void 0||Object.getOwnPropertyNames(n).includes("arguments")?!1:Function.prototype!==Object.getPrototypeOf(n)?!0:Object.getOwnPropertyNames(n.prototype).length>1}const Lg=["array","error","class","function","asyncfunction","map","promise","object","integer","number","boolean","string"];function ai(n,A){const e=[...Lg,"valid"];if(A==null||!e.includes(n))return!1;switch(n){case"array":return N(A);case"asyncfunction":return fg(A);case"function":return U(A);case"object":return Q(A);case"integer":return _(A);case"number":return K(A);case"valid":return Mg(A);case"boolean":return aA(A);case"string":return R(A);case"map":return Sg(A);case"promise":return ri(A);case"error":return Rg(A);case"class":return Je(A);default:throw new Error(`No known test for type: ${n}`)}}function mE(n){for(let A of Lg)try{if(ai(A,n))return A}catch{return typeof n}}const DE=Object.freeze(Object.defineProperty({__proto__:null,checkType:ai,isArray:N,isArrayOfType:qe,isAsyncFunction:fg,isBoolean:aA,isClass:Je,isError:Rg,isFunction:U,isInteger:_,isMap:Sg,isNumber:K,isObject:Q,isObjectOfTypes:qs,isPromise:ri,isString:R,isValid:Mg,typeOf:mE},Symbol.toStringTag,{value:"Module"})),Gg=["id","class","style","alt","width","height","title"],Ng=[...Gg,"name","type","value","default","placeholder","max","min","maxlenght","src","checked","disabled","pattern","readonly","required","size","step","multiple","autofocus","list","autocomplete"],pE=["button","color","date","datetime-local","email","file","hidden","image","month","number","password","radio","range","reset","search","submit","tel","text","time","url","week"];function yE(n,A=document){return A.getElementById(n)}function wE(n,A=document){return A.getElementsByClassName(n)}function fE(n,A=document){return A.getElementsByName(n)}function ME(n,A=document){return A.getElementsByTagName(n)}function Kg(n,A=document){return A.querySelector(n)}function Fg(n,A=document){return A.querySelectorAll(n)}function SE(n){return typeof Node=="object"?n instanceof Node:n&&typeof n=="object"&&typeof n.nodeType=="number"&&typeof n.nodeName=="string"}function QA(n){return typeof HTMLElement=="object"?n instanceof HTMLElement:n&&typeof n=="object"&&n!==null&&n.nodeType===1&&typeof n.nodeName=="string"}function st(n){return QA(n)?!!n&&!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length):!1}function Js(n){if(!QA(n))return!1;const A=n.getBoundingClientRect();return A.top>=0&&A.left>=0&&A.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&A.right<=(window.innerWidth||document.documentElement.clientWidth)}function RE(n){if(!QA(n))return!1;const A=getComputedStyle(n);if(A.display==="none"||A.visibility!=="visible"||parseFloat(A.opacity)<.1||n.offsetWidth+n.offsetHeight+n.getBoundingClientRect().height+n.getBoundingClientRect().width===0)return!1;const e={x:n.getBoundingClientRect().left+n.offsetWidth/2,y:n.getBoundingClientRect().top+n.offsetHeight/2};if(e.x<0||e.x>(document.documentElement.clientWidth||window.innerWidth)||e.y<0||e.y>(document.documentElement.clientHeight||window.innerHeight))return!1;let i=document.elementFromPoint(e.x,e.y);do if(i===elem)return!0;while(i=i.parentNode);return!1}function Hs(n,A){if(_s(n)){var e=window.URL||window.webkitURL||window;n=new Blob([n],{type:"image/svg+xml"}),n=e.createObjectURL(n)}const i=new Image;if(i.src=n,U(A))i.complete?A(i):(i.onload=()=>A(i),i.onerror=()=>A(!1));else return new Promise(function(s,o){i.complete?s(i):(i.onload=()=>s(i),i.onerror=()=>o(!1))})}function _s(n){return R(n)?/<\s*svg[^>]*>(.*?)<\s*\/\s*svg>/.test(n):!1}function LE(n){return new Promise(A=>{if(document.querySelector(n))return A(document.querySelector(n));const e=new MutationObserver(i=>{document.querySelector(n)&&(e.disconnect(),A(document.querySelector(n)))});e.observe(document.body,{childList:!0,subtree:!0})})}function HA(n){if(!QA(n))return!1;let A=0,e=0,i=n;for(;i&&i.tagName.toLowerCase()!="body"&&!isNaN(i.offsetLeft)&&!isNaN(i.offsetTop);)A+=i.offsetLeft-i.scrollLeft,e+=i.offsetTop-i.scrollTop,i=i.offsetParent;const s=n.getBoundingClientRect();let o=s.right-s.left,r=s.bottom-s.top,a=st(n),I=Js(n);return{top:e,bottom:e+r,left:A,right:A+o,width:o,height:r,visible:a,viewport:I}}function GE(n,A){if(!QA(n)||!QA(n))return!1;const e=HA(n),i=HA(A);return{x:e.top-i.top,y:e.left-i.left,el1Location:e,el2Location:i}}function bg(n){if(!R(n))return!1;const A=document.createElement("template");return n=n.trim(),A.innerHTML=n,A.content.firstChild}function NE(n){if(!R(n))return!1;const A=document.createElement("template");return A.innerHTML=n,A.content.childNodes}function xi(n,A,e){if(!_s(n)||!K(e?.w)||!K(e?.h))return!1;let i=e.w,s=e.h,o=document.createElement("canvas");o.width=i,o.height=s;let r=bg(n);r.style.fill=A,r.setAttribute("width",i),r.setAttribute("height",s),r.xmlns="http://www.w3.org/2000/svg";let a=new XMLSerializer().serializeToString(r),E="data:image/svg+xml;base64,"+btoa(a),f=new Image;return f.setAttribute("width",i),f.setAttribute("height",s),f.onload=()=>{o.getContext("2d").drawImage(f,0,0,i,s)},f.src=E,f}function KE(n){if(!QA(n))return!1;const A=i=>{!n.contains(i.target)&&st(n)&&(n.style.display="none",e())},e=()=>{document.removeEventListener("click",A)};document.addEventListener("click",A)}function FE(n,A){if(!QA(n))return!1;const e=s=>{!n.contains(s.target)&&st(n)&&(A(),i())},i=()=>{document.removeEventListener("click",e)};document.addEventListener("click",e)}function kg(n,A){let e,i;if(R(n))e=document.getElementById(n);else if(QA(n))e=n;else return!1;const s=(e.ownerDocument||document).defaultView;return R(A)?(s&&s.getComputedStyle?(A=A.replace(/([A-Z])/g,"-$1").toLowerCase(),i=document.defaultView.getComputedStyle(e,null).getPropertyValue(A)):e.currentStyle&&(i=e.currentStyle[A]),i):!1}function bE(n,A,e,i){let s=Ws(n,A,e,i);if(s)s.i>=0?s.rules[s.i].style[s.property]=s.value:vg(s.styleSheet,s.selector,s.rules,s.index);else return}function kE(n,A,e){let i=Ws(n,A,e,"");(i.styleSheet.deleteRule||i.styleSheet.removeRule)(i.i)}function Ws(n,A,e,i){if(!n||!Q(n))return null;if(n.constructor.name=="HTMLStyleElement")n=n.sheet;else if(n.constructor.name!="CSSStyleSheet")return null;let s=Tg(A,e,i);A=s[0],e=s[1],i=s[2];const o=n.cssRules||n.rules;for(var r=o.length-1;r>0&&o[r].selectorText!==A;--r);return{styleSheet:n,rules:o,selector:A,property:e,value:i,i:r}}function Tg(n,A,e){return[n=n.toLowerCase().replace(/\s+/g," "),A=A.toLowerCase(),e=e.toLowerCase()]}function vg(n,A,e,i){n.insertRule?n.insertRule(A+"{"+e+"}",i):n.addRule(A,e,i)}function Ys(n,A){return!QA(n)||!R(A)?null:n.classList.contains(A)?n:Ys(n.parentElement,A)}function Ug(n,A){let e=R(A?.entry)?A?.entry:"",s=`${R(n)?`<label for="${e}">${n}</label>`:""}<input id="${e}" class="subject" `;for(let o in A)(Ng.includes(o)||/^(data-[^\t\n\f \/>"'=]+)/g.test(o))&&(s+=`${o}="${A[o]}" `);return s+=`> `}function TE(n,A){let e=R(A?.entry)?A?.entry:"",i=R(n)?`<label for="${e}">${n}</label>`:"",s="";for(let r in A?.options)s+=`<option value="${A.options[r]}">${r}</option>`;return`${i}<select id="${e}" class="subject">${s}</select> `}function Pg(n){return new Promise(A=>{let e=new FileReader;e.onload=()=>A(e.result),e.readAsDataURL(n)})}const vE={addCSSRule:vg,addStyleRule:bE,blobToDataURL:Pg,deleteStyleRule:kE,elementDimPos:HA,elementsDistance:GE,findByClass:wE,findByID:yE,findByName:fE,findBySelector:Kg,findBySelectorAll:Fg,findStyleRule:Ws,findTargetParentWithClass:Ys,fndByTag:ME,getStyle:kg,hideOnClickOutside:KE,htmlAttr:Gg,htmlInput:Ug,htmlToElement:bg,htmlToElements:NE,inputAttr:Ng,inputTypes:pE,isHTMLElement:QA,isImage:Hs,isInViewport:Js,isNode:SE,isSVG:_s,isVisible:st,isVisibleToUser:RE,onClickOutside:FE,styleRuleSanitize:Tg,svgToImage:xi,waitForElm:LE},UE=typeof window<"u"&&typeof window.document<"u";typeof process<"u"&&process.versions!=null&&process.versions.node!=null,typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));const PE=(n=>typeof n<"u"&&("onorientationchange"in n||typeof n.matchMedia=="function"&&n.matchMedia("(any-pointer:coarse)").matches||typeof navigator<"u"&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0||"ontouchstart"in n||n.DocumentTouch&&document instanceof n.DocumentTouch)))(typeof window<"u"?window:{}),OE={idle:0};class nt{#A=0;#e=0;constructor(){if(arguments.length===1){const{x:A,y:e}=arguments[0];this.x=A||0,this.y=e||0}else if(arguments.length>1){const[A,e]=arguments;this.x=A||0,this.y=e||0}}set x(A){K(A)&&(this.#A=A)}get x(){return this.#A}set y(A){K(A)&&(this.#e=A)}get y(){return this.#e}clone(){return new nt(this.x,this.y)}}function xE(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Zs={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22 * http://hammerjs.github.io/ * * Copyright (c) 2016 Jorik Tangelder; * Licensed under the MIT license */var Og;function qE(){return Og||(Og=1,function(n){(function(A,e,i,s){var o=["","webkit","Moz","MS","ms","o"],r=e.createElement("div"),a="function",I=Math.round,l=Math.abs,E=Date.now;function f(g,C,u){return setTimeout(sA(g,u),C)}function L(g,C,u){return Array.isArray(g)?(M(g,u[C],u),!0):!1}function M(g,C,u){var p;if(g)if(g.forEach)g.forEach(C,u);else if(g.length!==s)for(p=0;p<g.length;)C.call(u,g[p],p,g),p++;else for(p in g)g.hasOwnProperty(p)&&C.call(u,g[p],p,g)}function T(g,C,u){var p="DEPRECATED METHOD: "+C+` `+u+` AT `;return function(){var G=new Error("get-stack-trace"),k=G&&G.stack?G.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Z=A.console&&(A.console.warn||A.console.log);return Z&&Z.call(A.console,p,k),g.apply(this,arguments)}}var P;typeof Object.assign!="function"?P=function(C){if(C===s||C===null)throw new TypeError("Cannot convert undefined or null to object");for(var u=Object(C),p=1;p<arguments.length;p++){var G=arguments[p];if(G!==s&&G!==null)for(var k in G)G.hasOwnProperty(k)&&(u[k]=G[k])}return u}:P=Object.assign;var V=T(function(C,u,p){for(var G=Object.keys(u),k=0;k<G.length;)(!p||p&&C[G[k]]===s)&&(C[G[k]]=u[G[k]]),k++;return C},"extend","Use `assign`."),X=T(function(C,u){return V(C,u,!0)},"merge","Use `assign`.");function H(g,C,u){var p=C.prototype,G;G=g.prototype=Object.create(p),G.constructor=g,G._super=p,u&&P(G,u)}function sA(g,C){return function(){return g.apply(C,arguments)}}function z(g,C){return typeof g==a?g.apply(C&&C[0]||s,C):g}function dA(g,C){return g===s?C:g}function AA(g,C,u){M(YA(C),function(p){g.addEventListener(p,u,!1)})}function SA(g,C,u){M(YA(C),function(p){g.removeEventListener(p,u,!1)})}function mA(g,C){for(;g;){if(g==C)return!0;g=g.parentNode}return!1}function NA(g,C){return g.indexOf(C)>-1}function YA(g){return g.trim().split(/\s+/g)}function KA(g,C,u){if(g.indexOf&&!u)return g.indexOf(C);for(var p=0;p<g.length;){if(u&&g[p][u]==C||!u&&g[p]===C)return p;p++}return-1}function j(g){return Array.prototype.slice.call(g,0)}function eA(g,C,u){for(var p=[],G=[],k=0;k<g.length;){var Z=g[k][C];KA(G,Z)<0&&p.push(g[k]),G[k]=Z,k++}return p=p.sort(function(EA,FA){return EA[C]>FA[C]}),p}function ZA(g,C){for(var u,p,G=C[0].toUpperCase()+C.slice(1),k=0;k<o.length;){if(u=o[k],p=u?u+G:C,p in g)return p;k++}return s}var ws=1;function Ht(){return ws++}function ue(g){var C=g.ownerDocument||g;return C.defaultView||C.parentWindow||A}var UI=/mobile|tablet|ip(ad|hone|od)|android/i,fs="ontouchstart"in A,PI=ZA(A,"PointerEvent")!==s,OI=fs&&UI.test(navigator.userAgent),je="touch",Ms="pen",Si="mouse",Ss="kinect",xI=25,kA=1,Se=2,cA=4,RA=8,$e=1,ge=2,Re=4,Qt=8,Pe=16,yA=ge|Re,Le=Qt|Pe,_t=yA|Le,Rs=["x","y"],dt=["clientX","clientY"];function PA(g,C){var u=this;this.manager=g,this.callback=C,this.element=g.element,this.target=g.options.inputTarget,this.domHandler=function(p){z(g.options.enable,[g])&&u.handler(p)},this.init()}PA.prototype={handler:function(){},init:function(){this.evEl&&AA(this.element,this.evEl,this.domHandler),this.evTarget&&AA(this.target,this.evTarget,this.domHandler),this.evWin&&AA(ue(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&SA(this.element,this.evEl,this.domHandler),this.evTarget&&SA(this.target,this.evTarget,this.domHandler),this.evWin&&SA(ue(this.element),this.evWin,this.domHandler)}};function qI(g){var C,u=g.options.inputClass;return u?C=u:PI?C=At:OI?C=Vt:fs?C=Gi:C=pt,new C(g,JI)}function JI(g,C,u){var p=u.pointers.length,G=u.changedPointers.length,k=C&kA&&p-G===0,Z=C&(cA|RA)&&p-G===0;u.isFirst=!!k,u.isFinal=!!Z,k&&(g.session={}),u.eventType=C,HI(g,u),g.emit("hammer.input",u),g.recognize(u),g.session.prevInput=u}function HI(g,C){var u=g.session,p=C.pointers,G=p.length;u.firstInput||(u.firstInput=Ls(C)),G>1&&!u.firstMultiple?u.firstMultiple=Ls(C):G===1&&(u.firstMultiple=!1);var k=u.firstInput,Z=u.firstMultiple,wA=Z?Z.center:k.center,EA=C.center=Gs(p);C.timeStamp=E(),C.deltaTime=C.timeStamp-k.timeStamp,C.angle=Wt(wA,EA),C.distance=mt(wA,EA),_I(u,C),C.offsetDirection=ze(C.deltaX,C.deltaY);var FA=ce(C.deltaTime,C.deltaX,C.deltaY);C.overallVelocityX=FA.x,C.overallVelocityY=FA.y,C.overallVelocity=l(FA.x)>l(FA.y)?FA.x:FA.y,C.scale=Z?YI(Z.pointers,p):1,C.rotation=Z?Dt(Z.pointers,p):0,C.maxPointers=u.prevInput?C.pointers.length>u.prevInput.maxPointers?C.pointers.length:u.prevInput.maxPointers:C.pointers.length,WI(u,C);var te=g.element;mA(C.srcEvent.target,te)&&(te=C.srcEvent.target),C.target=te}function _I(g,C){var u=C.center,p=g.offsetDelta||{},G=g.prevDelta||{},k=g.prevInput||{};(C.eventType===kA||k.eventType===cA)&&(G=g.prevDelta={x:k.deltaX||0,y:k.deltaY||0},p=g.offsetDelta={x:u.x,y:u.y}),C.deltaX=G.x+(u.x-p.x),C.deltaY=G.y+(u.y-p.y)}function WI(g,C){var u=g.lastInterval||C,p=C.timeStamp-u.timeStamp,G,k,Z,wA;if(C.eventType!=RA&&(p>xI||u.velocity===s)){var EA=C.deltaX-u.deltaX,FA=C.deltaY-u.deltaY,te=ce(p,EA,FA);k=te.x,Z=te.y,G=l(te.x)>l(te.y)?te.x:te.y,wA=ze(EA,FA),g.lastInterval=C}else G=u.velocity,k=u.velocityX,Z=u.velocityY,wA=u.direction;C.velocity=G,C.velocityX=k,C.velocityY=Z,C.direction=wA}function Ls(g){for(var C=[],u=0;u<g.pointers.length;)C[u]={clientX:I(g.pointers[u].clientX),clientY:I(g.pointers[u].clientY)},u++;return{timeStamp:E(),pointers:C,center:Gs(C),deltaX:g.deltaX,deltaY:g.deltaY}}function Gs(g){var C=g.length;if(C===1)return{x:I(g[0].clientX),y:I(g[0].clientY)};for(var u=0,p=0,G=0;G<C;)u+=g[G].clientX,p+=g[G].clientY,G++;return{x:I(u/C),y:I(p/C)}}function ce(g,C,u){return{x:C/g||0,y:u/g||0}}function ze(g,C){return g===C?$e:l(g)>=l(C)?g<0?ge:Re:C<0?Qt:Pe}function mt(g,C,u){u||(u=Rs);var p=C[u[0]]-g[u[0]],G=C[u[1]]-g[u[1]];return Math.sqrt(p*p+G*G)}function Wt(g,C,u){u||(u=Rs);var p=C[u[0]]-g[u[0]],G=C[u[1]]-g[u[1]];return Math.atan2(G,p)*180/Math.PI}function Dt(g,C){return Wt(C[1],C[0],dt)+Wt(g[1],g[0],dt)}function YI(g,C){return mt(C[0],C[1],dt)/mt(g[0],g[1],dt)}var Ns={mousedown:kA,mousemove:Se,mouseup:cA},Ks="mousedown",OA="mousemove mouseup";function pt(){this.evEl=Ks,this.evWin=OA,this.pressed=!1,PA.apply(this,arguments)}H(pt,PA,{handler:function(C){var u=Ns[C.type];u&kA&&C.button===0&&(this.pressed=!0),u&Se&&C.which!==1&&(u=cA),this.pressed&&(u&cA&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[C],changedPointers:[C],pointerType:Si,srcEvent:C}))}});var ZI={pointerdown:kA,pointermove:Se,pointerup:cA,pointercancel:RA,pointerout:RA},VI={2:je,3:Ms,4:Si,5:Ss},TA="pointerdown",yt="pointermove pointerup pointercancel";A.MSPointerEvent&&!A.PointerEvent&&(TA="MSPointerDown",yt="MSPointerMove MSPointerUp MSPointerCancel");function At(){this.evEl=TA,this.evWin=yt,PA.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}H(At,PA,{handler:function(C){var u=this.store,p=!1,G=C.type.toLowerCase().replace("ms",""),k=ZI[G],Z=VI[C.pointerType]||C.pointerType,wA=Z==je,EA=KA(u,C.pointerId,"pointerId");k&kA&&(C.button===0||wA)?EA<0&&(u.push(C),EA=u.length-1):k&(cA|RA)&&(p=!0),!(EA<0)&&(u[EA]=C,this.callback(this.manager,k,{pointers:u,changedPointers:[C],pointerType:Z,srcEvent:C}),p&&u.splice(EA,1))}});var Fs={touchstart:kA,touchmove:Se,touchend:cA,touchcancel:RA},Yt="touchstart",XI="touchstart touchmove touchend touchcancel";function Ri(){this.evTarget=Yt,this.evWin=XI,this.started=!1,PA.apply(this,arguments)}H(Ri,PA,{handler:function(C){var u=Fs[C.type];if(u===kA&&(this.started=!0),!!this.started){var p=Li.call(this,C,u);u&(cA|RA)&&p[0].length-p[1].length===0&&(this.started=!1),this.callback(this.manager,u,{pointers:p[0],changedPointers:p[1],pointerType:je,srcEvent:C})}}});function Li(g,C){var u=j(g.touches),p=j(g.changedTouches);return C&(cA|RA)&&(u=eA(u.concat(p),"identifier")),[u,p]}var Zt={touchstart:kA,touchmove:Se,touchend:cA,touchcancel:RA},jI="touchstart touchmove touchend touchcancel";function Vt(){this.evTarget=jI,this.targetIds={},PA.apply(this,arguments)}H(Vt,PA,{handler:function(C){var u=Zt[C.type],p=$I.call(this,C,u);p&&this.callback(this.manager,u,{pointers:p[0],changedPointers:p[1],pointerType:je,srcEvent:C})}});function $I(g,C){var u=j(g.touches),p=this.targetIds;if(C&(kA|Se)&&u.length===1)return p[u[0].identifier]=!0,[u,u];var G,k,Z=j(g.changedTouches),wA=[],EA=this.target;if(k=u.filter(function(FA){return mA(FA.target,EA)}),C===kA)for(G=0;G<k.length;)p[k[G].identifier]=!0,G++;for(G=0;G<Z.length;)p[Z[G].identifier]&&wA.push(Z[G]),C&(cA|RA)&&delete p[Z[G].identifier],G++;if(wA.length)return[eA(k.concat(wA),"identifier"),wA]}var Xt=2500,bs=25;function Gi(){PA.apply(this,arguments);var g=sA(this.handler,this);this.touch=new Vt(this.manager,g),this.mouse=new pt(this.manager,g),this.primaryTouch=null,this.lastTouches=[]}H(Gi,PA,{handler:function(C,u,p){var G=p.pointerType==je,k=p.pointerType==Si;if(!(k&&p.sourceCapabilities&&p.sourceCapabilities.firesTouchEvents)){if(G)zI.call(this,u,p);else if(k&&ks.call(this,p))return;this.callback(C,u,p)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function zI(g,C){g&kA?(this.primaryTouch=C.changedPointers[0].identifier,Ni.call(this,C)):g&(cA|RA)&&Ni.call(this,C)}function Ni(g){var C=g.changedPointers[0];if(C.identifier===this.primaryTouch){var u={x:C.clientX,y:C.clientY};this.lastTouches.push(u);var p=this.lastTouches,G=function(){var k=p.indexOf(u);k>-1&&p.splice(k,1)};setTimeout(G,Xt)}}function ks(g){for(var C=g.srcEvent.clientX,u=g.srcEvent.clientY,p=0;p<this.lastTouches.length;p++){var G=this.lastTouches[p],k=Math.abs(C-G.x),Z=Math.abs(u-G.y);if(k<=bs&&Z<=bs)return!0}return!1}var Ts=ZA(r.style,"touchAction"),Ki=Ts!==s,jt="compute",$t="auto",Fi="manipulation",Ge="none",wt="pan-x",ft="pan-y",zt=ki();function bi(g,C){this.manager=g,this.set(C)}bi.prototype={set:function(g){g==jt&&(g=this.compute()),Ki&&this.manager.element.style&&zt[g]&&(this.manager.element.style[Ts]=g),this.actions=g.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var g=[];return M(this.manager.recognizers,function(C){z(C.options.enable,[C])&&(g=g.concat(C.getTouchAction()))}),he(g.join(" "))},preventDefaults:function(g){var C=g.srcEvent,u=g.offsetDirection;if(this.manager.session.prevented){C.preventDefault();return}var p=this.actions,G=NA(p,Ge)&&!zt[Ge],k=NA(p,ft)&&!zt[ft],Z=NA(p,wt)&&!zt[wt];if(G){var wA=g.pointers.length===1,EA=g.distance<2,FA=g.deltaTime<250;if(wA&&EA&&FA)return}if(!(Z&&k)&&(G||k&&u&yA||Z&&u&Le))return this.preventSrc(C)},preventSrc:function(g){this.manager.session.prevented=!0,g.preventDefault()}};function he(g){if(NA(g,Ge))return Ge;var C=NA(g,wt),u=NA(g,ft);return C&&u?Ge:C||u?C?wt:ft:NA(g,Fi)?Fi:$t}function ki(){if(!Ki)return!1;var g={},C=A.CSS&&A.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(u){g[u]=C?A.CSS.supports("touch-action",u):!0}),g}var et=1,xA=2,ee=4,Be=8,VA=Be,Oe=16,le=32;function Ce(g){this.options=P({},this.defaults,g||{}),this.id=Ht(),this.manager=null,this.options.enable=dA(this.options.enable,!0),this.state=et,this.simultaneous={},this.requireFail=[]}Ce.prototype={defaults:{},set:function(g){return P(this.options,g),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(g){if(L(g,"recognizeWith",this))return this;var C=this.simultaneous;return g=ei(g,this),C[g.id]||(C[g.id]=g,g.recognizeWith(this)),this},dropRecognizeWith:function(g){return L(g,"dropRecognizeWith",this)?this:(g=ei(g,this),delete this.simultaneous[g.id],this)},requireFailure:function(g){if(L(g,"requireFailure",this))return this;var C=this.requireFail;return g=ei(g,this),KA(C,g)===-1&&(C.push(g),g.requireFailure(this)),this},dropRequireFailure:function(g){if(L(g,"dropRequireFailure",this))return this;g=ei(g,this);var C=KA(this.requireFail,g);return C>-1&&this.requireFail.splice(C,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(g){return!!this.simultaneous[g.id]},emit:function(g){var C=this,u=this.state;function p(G){C.manager.emit(G,g)}u<Be&&p(C.options.event+Ai(u)),p(C.options.event),g.additionalEvent&&p(g.additionalEvent),u>=Be&&p(C.options.event+Ai(u))},tryEmit:function(g){if(this.canEmit())return this.emit(g);this.state=le},canEmit:function(){for(var g=0;g<this.requireFail.length;){if(!(this.requireFail[g].state&(le|et)))return!1;g++}return!0},recognize:function(g){var C=P({},g);if(!z(this.options.enable,[this,C])){this.reset(),this.state=le;return}this.state&(VA|Oe|le)&&(this.state=et),this.state=this.process(C),this.state&(xA|ee|Be|Oe)&&this.tryEmit(C)},process:function(g){},getTouchAction:function(){},reset:function(){}};function Ai(g){return g&Oe?"cancel":g&Be?"end":g&ee?"move":g&xA?"start":""}function vs(g){return g==Pe?"down":g==Qt?"up":g==ge?"left":g==Re?"right":""}function ei(g,C){var u=C.manager;return u?u.get(g):g}function XA(){Ce.apply(this,arguments)}H(XA,Ce,{defaults:{pointers:1},attrTest:function(g){var C=this.options.pointers;return C===0||g.pointers.length===C},process:function(g){var C=this.state,u=g.eventType,p=C&(xA|ee),G=this.attrTest(g);return p&&(u&RA||!G)?C|Oe:p||G?u&cA?C|Be:C&xA?C|ee:xA:le}});function c(){XA.apply(this,arguments),this.pX=null,this.pY=null}H(c,XA,{defaults:{event:"pan",threshold:10,pointers:1,direction:_t},getTouchAction:function(){var g=this.options.direction,C=[];return g&yA&&C.push(ft),g&Le&&C.push(wt),C},directionTest:function(g){var C=this.options,u=!0,p=g.distance,G=g.direction,k=g.deltaX,Z=g.deltaY;return G&C.direction||(C.direction&yA?(G=k===0?$e:k<0?ge:Re,u=k!=this.pX,p=Math.abs(g.deltaX)):(G=Z===0?$e:Z<0?Qt:Pe,u=Z!=this.pY,p=Math.abs(g.deltaY))),g.direction=G,u&&p>C.threshold&&G&C.direction},attrTest:function(g){return XA.prototype.attrTest.call(this,g)&&(this.state&xA||!(this.state&xA)&&this.directionTest(g))},emit:function(g){this.pX=g.deltaX,this.pY=g.deltaY;var C=vs(g.direction);C&&(g.additionalEvent=this.options.event+C),this._super.emit.call(this,g)}});function B(){XA.apply(this,arguments)}H(B,XA,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ge]},attrTest:function(g){return this._super.attrTest.call(this,g)&&(Math.abs(g.scale-1)>this.options.threshold||this.state&xA)},emit:function(g){if(g.scale!==1){var C=g.scale<1?"in":"out";g.additionalEvent=this.options.event+C}this._super.emit.call(this,g)}});function S(){Ce.apply(this,arguments),this._timer=null,this._input=null}H(S,Ce,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[$t]},process:function(g){var C=this.options,u=g.pointers.length===C.pointers,p=g.distance<C.threshold,G=g.deltaTime>C.time;if(this._input=g,!p||!u||g.eventType&(cA|RA)&&!G)this.reset();else if(g.eventType&kA)this.reset(),this._timer=f(function(){this.state=VA,this.tryEmit()},C.time,this);else if(g.eventType&cA)return VA;return le},reset:function(){clearTimeout(this._timer)},emit:function(g){this.state===VA&&(g&&g.eventType&cA?this.manager.emit(this.options.event+"up",g):(this._input.timeStamp=E(),this.manager.emit(this.options.event,this._input)))}});function F(){XA.apply(this,arguments)}H(F,XA,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ge]},attrTest:function(g){return this._super.attrTest.call(this,g)&&(Math.abs(g.rotation)>this.options.threshold||this.state&xA)}});function q(){XA.apply(this,arguments)}H(q,XA,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:yA|Le,pointers:1},getTouchAction:function(){return c.prototype.getTouchAction.call(this)},attrTest:function(g){var C=this.options.direction,u;return C&(yA|Le)?u=g.overallVelocity:C&yA?u=g.overallVelocityX:C&Le&&(u=g.overallVelocityY),this._super.attrTest.call(this,g)&&C&g.offsetDirection&&g.distance>this.options.threshold&&g.maxPointers==this.options.pointers&&l(u)>this.options.velocity&&g.eventType&cA},emit:function(g){var C=vs(g.offsetDirection);C&&this.manager.emit(this.options.event+C,g),this.manager.emit(this.options.event,g)}});function J(){Ce.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}H(J,Ce,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Fi]},process:function(g){var C=this.options,u=g.pointers.length===C.pointers,p=g.distance<C.threshold,G=g.deltaTime<C.time;if(this.reset(),g.eventType&kA&&this.count===0)return this.failTimeout();if(p&&G&&u){if(g.eventType!=cA)return this.failTimeout();var k=this.pTime?g.timeStamp-this.pTime<C.interval:!0,Z=!this.pCenter||mt(this.pCenter,g.center)<C.posThreshold;this.pTime=g.timeStamp,this.pCenter=g.center,!Z||!k?this.count=1:this.count+=1,this._input=g;var wA=this.count%C.taps;if(wA===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=VA,this.tryEmit()},C.interval,this),xA):VA}return le},failTimeout:function(){return this._timer=f(function(){this.state=le},this.options.interval,this),le},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==VA&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function v(g,C){return C=C||{},C.recognizers=dA(C.recognizers,v.defaults.preset),new lA(g,C)}v.VERSION="2.0.7",v.defaults={domEvents:!1,touchAction:jt,enable:!0,inputTarget:null,inputClass:null,preset:[[F,{enable:!1}],[B,{enable:!1},["rotate"]],[q,{direction:yA}],[c,{direction:yA},["swipe"]],[J],[J,{event:"doubletap",taps:2},["tap"]],[S]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var O=1,tA=2;function lA(g,C){this.options=P({},v.defaults,C||{}),this.options.inputTarget=this.options.inputTarget||g,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=g,this.input=qI(this),this.touchAction=new bi(this,this.options.touchAction),rA(this,!0),M(this.options.recognizers,function(u){var p=this.add(new u[0](u[1]));u[2]&&p.recognizeWith(u[2]),u[3]&&p.requireFailure(u[3])},this)}lA.prototype={set:function(g){return P(this.options,g),g.touchAction&&this.touchAction.update(),g.inputTarget&&(this.input.destroy(),this.input.target=g.inputTarget,this.input.init()),this},stop:function(g){this.session.stopped=g?tA:O},recognize:function(g){var C=this.session;if(!C.stopped){this.touchAction.preventDefaults(g);var u,p=this.recognizers,G=C.curRecognizer;(!G||G&&G.state&VA)&&(G=C.curRecognizer=null);for(var k=0;k<p.length;)u=p[k],C.stopped!==tA&&(!G||u==G||u.canRecognizeWith(G))?u.recognize(g):u.reset(),!G&&u.state&(xA|ee|Be)&&(G=C.curRecognizer=u),k++}},get:function(g){if(g instanceof Ce)return g;for(var C=this.recognizers,u=0;u<C.length;u++)if(C[u].options.event==g)return C[u];return null},add:function(g){if(L(g,"add",this))return this;var C=this.get(g.options.event);return C&&this.remove(C),this.recognizers.push(g),g.manager=this,this.touchAction.update(),g},remove:function(g){if(L(g,"remove",this))return this;if(g=this.get(g),g){var C=this.recognizers,u=KA(C,g);u!==-1&&(C.splice(u,1),this.touchAction.update())}return this},on:function(g,C){if(g!==s&&C!==s){var u=this.handlers;return M(YA(g),function(p){u[p]=u[p]||[],u[p].push(C)}),this}},off:function(g,C){if(g!==s){var u=this.handlers;return M(YA(g),function(p){C?u[p]&&u[p].splice(KA(u[p],C),1):delete u[p]}),this}},emit:function(g,C){this.options.domEvents&&jA(g,C);var u=this.handlers[g]&&this.handlers[g].slice();if(!(!u||!u.length)){C.type=g,C.preventDefault=function(){C.srcEvent.preventDefault()};for(var p=0;p<u.length;)u[p](C),p++}},destroy:function(){this.element&&rA(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function rA(g,C){var u=g.element;if(u.style){var p;M(g.options.cssProps,function(G,k){p=ZA(u.style,k),C?(g.oldCssProps[p]=u.style[p],u.style[p]=G):u.style[p]=g.oldCssProps[p]||""}),C||(g.oldCssProps={})}}function jA(g,C){var u=e.createEvent("Event");u.initEvent(g,!0,!0),u.gesture=C,C.target.dispatchEvent(u)}P(v,{INPUT_START:kA,INPUT_MOVE:Se,INPUT_END:cA,INPUT_CANCEL:RA,STATE_POSSIBLE:et,STATE_BEGAN:xA,STATE_CHANGED:ee,STATE_ENDED:Be,STATE_RECOGNIZED:VA,STATE_CANCELLED:Oe,STATE_FAILED:le,DIRECTION_NONE:$e,DIRECTION_LEFT:ge,DIRECTION_RIGHT:Re,DIRECTION_UP:Qt,DIRECTION_DOWN:Pe,DIRECTION_HORIZONTAL:yA,DIRECTION_VERTICAL:Le,DIRECTION_ALL:_t,Manager:lA,Input:PA,TouchAction:bi,TouchInput:Vt,MouseInput:pt,PointerEventInput:At,TouchMouseInput:Gi,SingleTouchInput:Ri,Recognizer:Ce,AttrRecognizer:XA,Tap:J,Pan:c,Swipe:q,Pinch:B,Rotate:F,Press:S,on:AA,off:SA,each:M,merge:X,extend:V,assign:P,inherit:H,bindFn:sA,prefixed:ZA});var qA=typeof A<"u"?A:typeof self<"u"?self:{};qA.Hammer=v,n.exports?n.exports=v:A[i]=v})(window,document,"Hammer")}(Zs)),Zs.exports}var Ii=qE();const me=ti({__proto__:null,default:xE(Ii)},[Ii]),xg=1,qg=2,Vs=4,JE={mousedown:xg,mousemove:qg,mouseup:Vs};function HE(n,A){for(let e=0;e<n.length;e++)if(A(n[e]))return!0;return!1}function _E(n){const A=n.prototype.handler;n.prototype.handler=function(i){const s=this.store;i.button>0&&i.type==="pointerdown"&&(HE(s,o=>o.pointerId===i.pointerId)||s.push(i)),A.call(this,i)}}function WE(n){n.prototype.handler=function(e){let i=JE[e.type];i&xg&&e.button>=0&&(this.pressed=!0),i&qg&&e.buttons===0&&(i=Vs),this.pressed&&(i&Vs&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}}_E(Ii.PointerEventInput),WE(Ii.MouseInput);const YE=Ii.Manager;let qi=class{constructor(A,e,i){this.element=A,this.callback=e,this.options={enable:!0,...i}}};const ZE=me?[[me.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[me.Rotate,{enable:!1}],[me.Pinch,{enable:!1}],[me.Swipe,{enable:!1}],[me.Pan,{threshold:0,enable:!1}],[me.Press,{enable:!1}],[me.Tap,{event:"doubletap",taps:2,enable:!1}],[me.Tap,{event:"anytap",enable:!1}],[me.Tap,{enable:!1}]]:null,Jg={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},VE={doubletap:["tap"]},XE={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},Xs={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},jE={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},Hg={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},$E=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",Mt=typeof window<"u"?window:global;let js=!1;try{const n={get passive(){return js=!0,!0}};Mt.addEventListener("test",null,n),Mt.removeEventListener("test",null)}catch{js=!1}const zE=$E.indexOf("firefox")!==-1,{WHEEL_EVENTS:Au}=Xs,_g="wheel",Wg=4.000244140625,eu=40,tu=.25;class iu extends qi{constructor(A,e,i){super(A,e,i),this.handleEvent=s=>{if(!this.options.enable)return;let o=s.deltaY;Mt.WheelEvent&&(zE&&s.deltaMode===Mt.WheelEvent.DOM_DELTA_PIXEL&&(o/=Mt.devicePixelRatio),s.deltaMode===Mt.WheelEvent.DOM_DELTA_LINE&&(o*=eu)),o!==0&&o%Wg===0&&(o=Math.floor(o/Wg)),s.shiftKey&&o&&(o=o*tu),this.callback({type:_g,center:{x:s.clientX,y:s.clientY},delta:-o,srcEvent:s,pointerType:"mouse",target:s.target})},this.events=(this.options.events||[]).concat(Au),this.events.forEach(s=>A.addEventListener(s,this.handleEvent,js?{passive:!1}:!1))}destroy(){this.events.forEach(A=>this.element.removeEventListener(A,this.handleEvent))}enableEventType(A,e){A===_g&&(this.options.enable=e)}}const{MOUSE_EVENTS:su}=Xs,Yg="pointermove",Zg="pointerover",Vg="pointerout",Xg="pointerenter",jg="pointerleave";class nu extends qi{constructor(A,e,i){super(A,e,i),this.handleEvent=o=>{this.handleOverEvent(o),this.handleOutEvent(o),this.handleEnterEvent(o),this.handleLeaveEvent(o),this.handleMoveEvent(o)},this.pressed=!1;const{enable:s}=this.options;this.enableMoveEvent=s,this.enableLeaveEvent=s,this.enableEnterEvent=s,this.enableOutEvent=s,this.enableOverEvent=s,this.events=(this.options.events||[]).concat(su),this.events.forEach(o=>A.addEventListener(o,this.handleEvent))}destroy(){this.events.forEach(A=>this.element.removeEventListener(A,this.handleEvent))}enableEventType(A,e){A===Yg&&(this.enableMoveEvent=e),A===Zg&&(this.enableOverEvent=e),A===Vg&&(this.enableOutEvent=e),A===Xg&&(this.enableEnterEvent=e),A===jg&&(this.enableLeaveEvent=e)}handleOverEvent(A){this.enableOverEvent&&A.type==="mouseover"&&this._emit(Zg,A)}handleOutEvent(A){this.enableOutEvent&&A.type==="mouseout"&&this._emit(Vg,A)}handleEnterEvent(A){this.enableEnterEvent&&A.type==="mouseenter"&&this._emit(Xg,A)}handleLeaveEvent(A){this.enableLeaveEvent&&A.type==="mouseleave"&&this._emit(jg,A)}handleMoveEvent(A){if(this.enableMoveEvent)switch(A.type){case"mousedown":A.button>=0&&(this.pressed=!0);break;case"mousemove":A.buttons===0&&(this.pressed=!1),this.pressed||this._emit(Yg,A);break;case"mouseup":this.pressed=!1;break}}_emit(A,e){this.callback({type:A,center:{x:e.clientX,y:e.clientY},srcEvent:e,pointerType:"mouse",target:e.target})}}const{KEY_EVENTS:ou}=Xs,$g="keydown",zg="keyup";class ru extends qi{constructor(A,e,i){super(A,e,i),this.handleEvent=s=>{const o=s.target||s.srcElement;o.tagName==="INPUT"&&o.type==="text"||o.tagName==="TEXTAREA"||(this.enableDownEvent&&s.type==="keydown"&&this.callback({type:$g,srcEvent:s,key:s.key,target:s.target}),this.enableUpEvent&&s.type==="keyup"&&this.callback({type:zg,srcEvent:s,key:s.key,target:s.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(ou),A.tabIndex=this.options.tabIndex||0,A.style.outline="none",this.events.forEach(s=>A.addEventListener(s,this.handleEvent))}destroy(){this.events.forEach(A=>this.element.removeEventListener(A,this.handleEvent))}enableEventType(A,e){A===$g&&(this.enableDownEvent=e),A===zg&&(this.enableUpEvent=e)}}const Ah="contextmenu";class au extends qi{constructor(A,e,i){super(A,e,i),this.handleEvent=s=>{this.options.enable&&this.callback({type:Ah,center:{x:s.clientX,y:s.clientY},srcEvent:s,pointerType:"mouse",target:s.target})},A.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(A,e){A===Ah&&(this.options.enable=e)}}const eh=1,$s=2,th=4,Iu={pointerdown:eh,pointermove:$s,pointerup:th,mousedown:eh,mousemove:$s,mouseup:th},gu=0,hu=1,lu=2,Cu=1,Eu=2,uu=4;function cu(n){const A=Iu[n.srcEvent.type];if(!A)return null;const{buttons:e,button:i}=n.srcEvent;let s=!1,o=!1,r=!1;return A===$s?(s=!!(e&Cu),o=!!(e&uu),r=!!(e&Eu)):(s=i===gu,o=i===hu,r=i===lu),{leftButton:s,middleButton:o,rightButton:r}}function Bu(n,A){const e=n.center;if(!e)return null;const i=A.getBoundingClientRect(),s=i.width/A.offsetWidth||1,o=i.height/A.offsetHeight||1,r={x:(e.x-i.left-A.clientLeft)/s,y:(e.y-i.top-A.clientTop)/o};return{center:e,offsetCenter:r}}const zs={srcElement:"root",priority:0};class Qu{constructor(A){this.handleEvent=e=>{if(this.isEmpty())return;const i=this._normalizeEvent(e);let s=e.srcEvent.target;for(;s&&s!==i.rootElement;){if(this._emit(i,s),i.handled)return;s=s.parentNode}this._emit(i,"root")},this.eventManager=A,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(A,e,i,s=!1,o=!1){const{handlers:r,handlersByElement:a}=this;let I=zs;typeof i=="string"||i&&i.addEventListener?I={...zs,srcElement:i}:i&&(I={...zs,...i});let l=a.get(I.srcElement);l||(l=[],a.set(I.srcElement,l));const E={type:A,handler:e,srcElement:I.srcElement,priority:I.priority};s&&(E.once=!0),o&&(E.passive=!0),r.push(E),this._active=this._active||!E.passive;let f=l.length-1;for(;f>=0&&!(l[f].priority>=E.priority);)f--;l.splice(f+1,0,E)}remove(A,e){const{handlers:i,handlersByElement:s}=this;for(let o=i.len