jqx-es 1.1.5 → 1.1.6
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/Bundle/jqx.browser.min.js +1 -1
- package/Bundle/jqx.min.js +1 -1
- package/package.json +1 -1
- package/src/HandlerFactory.js +3 -1
- package/src/JQxExtensionHelpers.js +37 -36
- package/src/Utilities.js +1 -1
|
@@ -11,5 +11,5 @@ ${r}`),g}}return{sheet:e,removeRules:S,tryParseAtOrNestedRules:v,ruleExists:d,ch
|
|
|
11
11
|
`)}function Pt(e){return e.replace(/([*\[\]()-+{}.$?\\])/g,t=>`\\${t}`)}function It(e,...t){let r=t.length&&Array.isArray(t.slice(-1))?t.pop().join(""):"";return new RegExp((t.length&&e.raw.reduce((o,i,l)=>o.concat(t[l-1]||"").concat(i),"")||e.raw.join("")).split(`
|
|
12
12
|
`).map(o=>o.replace(/\s|\/\/.*$/g,"").trim().replace(/(@s!)/g," ")).join(""),r)}function Ne(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`).replace(/[^--]^-|-$/,"")}function Me(e,t){try{return e()}catch(r){console.error(`${t||"an error occured"}: ${r.message}`)}}function Rt(e){return e.replace(/\/\*.+?\*\//gm,"").replace(/[}{\r\n]/g,"").replace(/(data:.+?);/g,(t,r)=>`${r}\\3b`).split(";").map(t=>t.trim()).join(`;
|
|
13
13
|
`).replaceAll("\\3b",";").split(`
|
|
14
|
-
`)}function kt(e){return e.reduce((t,r)=>{let[o,i]=[r.slice(0,r.indexOf(":")).trim(),r.slice(r.indexOf(":")+1).trim().replace(/;$|;.+(?=\/*).+\/$/,"")];return o&&i?{...t,[o]:i}:t},{})}function Bt(e){return kt(Rt(e))}function Oe(e,t){return e?.replace("::",":")===t?.replace("::",":")}var Jt=[...Array(26)].map((e,t)=>String.fromCharCode(t+65)).concat([...Array(26)].map((e,t)=>String.fromCharCode(t+97))).concat([...Array(10)].map((e,t)=>`${t}`)),ie=(e,t=2)=>`${e}`.padStart(t,"0"),Qt=(e,t=0)=>([e,t]=[Math.floor(e),Math.ceil(t)],Math.floor([...crypto.getRandomValues(new Uint32Array(1))].shift()/2**32*(e-t+1)+t)),P=function(e,t=1){return t=a(t,Number)&&t||1,a(e,String)&&e.length>=t},Pe=function(e){return e=a(e,String)&&/,/.test(e)?e.split(","):e,a(e,Array)?e.filter(t=>P(t)).map(t=>t.trim().toLowerCase()):e?.trim().toLowerCase()||""},Wt=e=>{let t=e.length;for(;t--;){let r=Qt(t);[e[t],e[r]]=[e[r],e[t]]}return e};var j=(e,t=120)=>`${e}`.trim().slice(0,t).replace(/>\s+</g,"><").replace(/</g,"<").replace(/\s{2,}/g," ").replace(/\n/g,"\\n")+(e.length>t?" …":"").trim(),N=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`).replace(/^-|-$/,""),qt=([e,...t])=>`${e.toUpperCase()}${t.join("")}`,ee=e=>a(e,String)?e.toLowerCase().split("-").map((t,r)=>r&&`${qt(t)}`||t).join(""):e,z=()=>`_${Wt(Jt).slice(0,8).join("")}`,le=(e,t=120)=>j(e,t).replace(/</g,"<"),q=()=>(e=>`[${ie(e.getHours())}:${ie(e.getMinutes())}:${ie(e.getSeconds())}.${ie(e.getMilliseconds(),3)}]`)(new Date);var _=e=>e.replace(/</g,"<");function Ie(){let e=function(l){if(!l)return;let d=l.style,v=getComputedStyle(l),S=[d.visibility,v.visibility].includes("hidden"),h=[d.display,v.display].includes("none"),w=l.offsetTop<0||l.offsetLeft+l.offsetWidth<0||l.offsetLeft>document.body.offsetWidth,C=+v.opacity==0||+(d.opacity||1)==0;return!(w||C||h||S)},r=function(l){return l.parentNode?!!y.nodes(":is(:read-write)",l?.parentNode)?.find(d=>d===l):!1},o=function(l){return l.parentNode?!!y.nodes(":is(:modal)",l?.parentNode)?.find(d=>d===l):!1},i={notInDOM:!0,writable:"n/a",modal:"n/a",empty:!0,open:"n/a",visible:"n/a"};return l=>{let d=l.node;return a(d,Node)?{get writable(){return r(d)},get modal(){return o(d)},get inDOM(){return d.isConnected},get open(){return d.open??!1},get visible(){return e(d)},get disabled(){return d.hasAttribute("readonly")||d.hasAttribute("disabled")},get empty(){return l.collection.length<1},get virtual(){return l.isVirtual}}:i}}var zt=!0,se={data:/data-[\-\w.\p{L}]/ui,validURL:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,whiteSpace:/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,notAllowedValues:/javascript|injected|noreferrer|alert|DataURL/gi},_t=e=>{if(zt&&Object.keys(e.removed).length){let t=Object.entries(e.removed).reduce((r,[o,i])=>[...r,`${_(o)} => ${i}`],[]).join("\\000A");F.log(`JQx HTML creation errors: ${F.isConsole?t:_(t)}`)}},Vt=function(e){let t=e.nodeName.toLowerCase(),r=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return/-/.test(t)&&!r.find(o=>o===t)||M.isAllowed(t)},te=e=>{let t={rawHTML:e?.parentElement?.getHTML()??"no html",removed:{}};return a(e,HTMLElement)&&[...e.childNodes].forEach(r=>{if(r?.children?.length&&te(r),r?.attributes){let i=a(r,SVGElement)?J.svg:J.html;[...(r??{attributes:[]}).attributes].forEach(l=>{let d=l.name.trim().toLowerCase(),v=l.value.trim().toLowerCase().replace(se.whiteSpace,""),S=d==="href"?!se.validURL.test(v):se.notAllowedValues.test(v),h=d.startsWith("data")?!se.data.test(d):!!i[d];if(S||h){let w=le(l.value||"none",60);w+=w.length===60?"...":"",t.removed[`${l.name}`]=`attribute/property (-value) not allowed, removed. Value: ${w}`,r.removeAttribute(l.name)}})}if(!(Vt(r)||r.constructor===CharacterData||r.constructor===Comment)){let i=(r?.outerHTML||r?.textContent).trim(),l=le(i,60)??"EMPTY";l+=l.length===60?"...":"",t.removed[`<${r.nodeName?.toLowerCase()}>`]=`not allowed, not rendered. Value: ${l}`,r.remove()}}),_t(t),e};var T=new Proxy({start:"afterbegin",afterbegin:"afterbegin",end:"beforeend",beforeend:"beforeend",before:"beforebegin",beforebegin:"beforebegin",after:"afterend",afterend:"afterend"},{get(e,t){return e[String(t).toLowerCase()]??e[t]}}),Ut=e=>{let t=document.createElement("div");return t.insertAdjacentHTML(T.end,e),t.childNodes.length?te(t):void 0},Gt=(e,t,r)=>a(e,Comment)?t.insertAdjacentHTML(r,`<!--${e.data}-->`):t.insertAdjacentText(r,e.data),V=(e=[],t=document.body,r=T.BeforeEnd)=>e.reduce((o,i)=>{let l=re(i)&&pe(i,t,r);return l?[...o,l]:o},[]),pe=(e,t=document.body,r=T.BeforeEnd)=>(t=t?.isJQx?t?.[0]:t,a(e,Comment,Text)?Gt(e,t,r):t.insertAdjacentElement(r,e)),H=e=>{if(a(e,Text,Comment))return e;let t=e?.trim(),r=t?.split(/<text>|<\/text>/i)??[];if(r?.length&&(r=r.length>1?r.filter(i=>i.length).shift():void 0),t.startsWith("<!--")&&t.endsWith("-->"))return document.createComment(e.replace(/<!--|-->$/g,""));if(r||!/^<(.+)[^>]+>/m.test(t))return document.createTextNode(r);let o=Ut(e);return o.childNodes.length<1?H(`<span data-jqxcreationerror="1">${j(e,60)}</span>`):o.children[0]};var L=(e,t)=>{let r=e.collection.filter(o=>!We(o));for(let o=0;o<r.length;o+=1)t(r[o],o);return e},Zt=Ie(),Re=e=>e&&(e.textContent="");var U=e=>{let t=e.cloneNode(!0);return t.removeAttribute&&t.removeAttribute("id"),e.isConnected?e.remove():e=null,t},Je=(e,t)=>{if(e&&a(t,Object))for(let[r,o]of Object.entries(t))e.setAttribute(`data-${N(r)}`,o)},ke=(e,t)=>e.andThen(t,!0),Be=(e,t)=>e.andThen(t),Qe=e=>e.startsWith("data")||J.html.find(t=>e.toLowerCase()===t),Yt=(e,t,r)=>{r&&a(t,String)&&(t={[t]:r==="-"?"":r});let o;t.className&&(o=t.className,delete t.className),o=[...e.classList].find(l=>l.startsWith("JQxClass-")||o&&l===o)||o||`JQxClass-${z().slice(1)}`,y.editCssRule(`.${o}`,t),e.classList.add(o)},Xt=(e,t)=>{if(e)for(let[r,o]of Object.entries(t)){if(r=N(r),r.startsWith("data"))return Je(e,o);a(o,String)&&Qe(r)&&e.setAttribute(r,o.split(/[, ]/)?.join(" "))}},Se=(e,t)=>{if(a(t,Object))for(let[r,o]of Object.entries(t)){let i;/!important/i.test(o)&&(o=o.slice(0,o.indexOf("!")).trim(),i="important"),e.style.setProperty(N(r),o,i)}},Kt={get(e,t){return e[ee(t)]||e[t]},enumerable:!1,configurable:!1},er=(...e)=>{F.log("\u2757"+e.map(t=>String(t)).join(", "))},ve=(e,t=0,r=!0)=>(e=e?.parentElement,t+=e?e[r?"scrollTop":"scrollLeft"]:0,e?ve(e,t,r):t),we={factoryExtensions:{data:e=>({get all(){return new Proxy(e[0]?.dataset??{},Kt)},set:(t={})=>{if(!e.is.empty&&a(t,Object))for(let[r,o]of Object.entries(t))e.setData({[r]:o});return e},get:(t,r)=>e.data.all[t]??r,add:(t={})=>{if(!e.is.empty&&a(t,Object))for(let[r,o]of Object.entries(t))e.setData({[r]:o});return e},remove:t=>(e[0]?.removeAttribute(`data-${N(t)}`),e)}),dimensions:e=>{if(e.is.empty)return{error:"[instance].dimensions: NO ELEMENTS"};let t=e[0],r=e.first()?.getBoundingClientRect().toJSON();return r.scrollTopDistance=ve(t,0),r.scrollLeftDistance=ve(t,0,!1),r},node:e=>e[0],HTML:e=>({get:(t,r)=>{if(e.is.empty)return"NO ELEMENTS IN COLLECTION";let o=t?e.outerHtml:e.html();return r?_(o):o},set:(t,r=!1,o=!1)=>{t=t.isJQx?t.HTML.get(1):t;let i=a(t,String);return t=i&&o?_(t):t,i&&(t||"").trim().length&&e.html(t,r),e},replace:(t,r=!1)=>e.HTML.set(t,!1,r),append:(t,r=!1)=>(t=a(t,HTMLElement)?y(t).HTML.get(1):t.isJQx?t.HTML.get(1):t,e.HTML.set(t,!0,r)),insert:(t,r=!1)=>(t=a(t,HTMLElement)?y(t).HTML.get(1):t.isJQx?t.HTML.get(1):t,e.HTML.set(t+e.HTML.get(),!1,r))}),is:e=>Zt(e),length:e=>e.collection.length,outerHtml:e=>(e.first()||{outerHTML:void 0}).outerHTML,parent:e=>{let t=y(e[0]?.parentNode);return t.is.empty?e:t},render:e=>(!e.is.empty&&e.toDOM()||y.log("[JQx.render]: empty collection"),e),Style:e=>({get computed(){return e.is.empty?{}:getComputedStyle(e[0])},inline:t=>e.style(t),inSheet:t=>e.css(t),valueOf:t=>e.is.empty?void 0:getComputedStyle(e[0])[N(t)],nwRule:t=>e.Style.byRule({rules:t}),byRule:({classes2Apply:t=[],rules:r=[]}={})=>{let i=a(r,String)&&!t.length?r.split("{")[0].trim():"";if(r=r&&a(r,String)?[r]:r,t=t&&a(t,String)?[t]:t,(r?.length||t?.length)&&(r?.length&&y.editCssRules(...r),t))for(let l of t)e.addClass(l);return i?.startsWith(".")&&e.addClass(i.slice(1)),i?.startsWith("#")&&!e.attr("id")&&e.prop({id:i.slice(1)}),e}})},instanceExtensions:{addClass:(e,...t)=>L(e,r=>r&&t.forEach(o=>r.classList.add(o))),after:Be,afterMe:Be,andThen:(e,t,r=!1)=>{if(!t||!a(t,String,Node,Proxy))return er(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${t}]`),e;t=t?.isJQx?t.collection:a(t,Node)?y.virtual(t).collection:y.virtual(H(t)).collection;let[o,i,l]=r?[0,"before",t.concat(e.collection)]:[e.collection.length-1,"after",e.collection.concat(t)];return e[o][i](...t),e.collection=l,e},append:(e,...t)=>{if(!e.is.empty&&t.length){let r=e.length===1;for(let o of t){if(!o.isJQx&&P(o)){let i=o.trim(),d=!/^<(.+)[^>]+>$/m.test(i)?y.text(o):H(o);L(e,v=>v.append(r?d:U(d)))}re(o)&&L(e,i=>i.append(r?o:U(o))),o.isJQx&&!o.is.empty&&L(e,i=>o.collection.forEach(l=>i.append(r?l:U(l))))}}return e},appendTo:(e,t)=>(t.isJQx||(t=y(t)),t.append(e),e),attr:(e,t,r)=>{let o=e[0];if(!o)return e;if(!r&&P(t))return t=N(t),t==="class"?[...o?.classList].join(" "):o?.getAttribute(t);if(P(t)&&r)switch(t=N(t),!0){case t.startsWith("data-"):t={data:{[t.replace("data-","")]:r}};break;default:t={[t]:r}}return a(t,Object)&&!e.is.empty&&Xt(o,t),e},before:ke,beforeMe:ke,clear:e=>L(e,Re),closest:(e,t)=>{let r=P(t)?e[0].closest(t):null;return r?y(r):e},computedStyle:(e,t)=>e.first()&&getComputedStyle(e.first())[t],css:(e,t,r)=>L(e,o=>Yt(o,t,r)),duplicate:(e,t=!1,r=document.body)=>{let o=e.toNodeList().map(l=>l.removeAttribute&&l.removeAttribute("id")||l),i=y.virtual(o);return t?i.toDOM(r):i},each:(e,t)=>L(e,t),empty:e=>L(e,Re),find:(e,t)=>e.collection.length>0?[...e.first()?.querySelectorAll(t)]:[],find$:(e,t)=>e.collection.length>0?y(t,e):e,first:(e,t=!1)=>{if(e.collection.length>0)return t?e.single():e.collection[0]},first$:(e,t)=>e.single(t),getData:(e,t,r)=>e.first()&&e.first().dataset?.[t]||r,hasClass:(e,...t)=>{let r=e[0];return!r||!r.classList.length?!1:t.find(o=>r.classList.contains(o))&&!0||!1},hide:e=>L(e,t=>Se(t,{display:"none !important"})),html:(e,t,r)=>{if(t===void 0){let o=e.node;return o?.getHTML&&o.getHTML()||""}if(!e.isEmpty()){let o=H(`<div>${t.isJQx?t.HTML.get(!0):t}</div>`);if(!a(o,Comment))return L(e,l=>(r||(l.textContent=""),l.insertAdjacentHTML(y.at.end,o.getHTML())))}return e},htmlFor:(e,t,r="",o=!1)=>{if(t&&e.collection.length){if(!t||!P(r))return e;let i=e.find$(t);if(i.length<1)return e;let l=H(`<span>${r}</span>`);i.each(d=>{o||(d.textContent=""),d.insertAdjacentHTML(y.at.end,l?.getHTML())})}return e},isEmpty:e=>e.collection.length<1,nth$:(e,t)=>e.single(t),on:(e,t,...r)=>{if(e.collection.length&&a(t,String,Array)){if(t?.length<1||r.length<1)return e;let o=qe(e);y.handle({type:t,selector:o,handlers:r})}return e},prepend:(e,...t)=>{if(!e.is.empty&&t){let r=e.length===1;for(let o of t){if(P(o)){o=o.trim();let l=!/^<(.+)[^>]+>$/m.test(o)?y.text(o):H(o);l=r?l:U(l),L(e,d=>d.prepend(l.cloneNode(!0)))}re(o)&&L(e,i=>i.prepend(r?o:U(o))),o.isJQx&&!o.is.empty&&(o.collection.length>1&&o.collection.reverse(),L(e,i=>L(o,l=>i.prepend(r?l:U(l)))),o.collection.reverse())}}return e},prependTo:(e,t)=>(t.isJQx||(t=y.virtual(t)),t.prepend(e),e),prop:(e,t,r)=>{if(a(t,String)&&!r)return t.startsWith("data")?e[0]?.dataset[t.slice(t.indexOf("-")+1)]:e[0]?.[t];let o=a(t,Object)?t:{[t]:r};for(let[i,l]of Object.entries(o)){if(i=i.trim(),l&&!Qe(i)||!l)return!1;if(i.toLowerCase()==="id")return e[0].id=l;L(e,v=>{if(i.startsWith("data"))return v.dataset[i.slice(i.indexOf("-")+1)]=l;v[i]=l})}return e},remove:(e,t)=>{O(`remove ${j(e.HTML.get(1),40)}${t?` /w selector ${t}`:""}`);let r=i=>i.remove(),o=()=>e.collection=e.collection.filter(i=>document.documentElement.contains(i));if(t){let i=e.find$(t);return i.is.empty||(L(i,r),o()),e}return L(e,r),o(),e},rmAttr:(e,...t)=>{for(let r of t)e.node.removeAttribute(r);return e},removeClass:(e,...t)=>L(e,r=>{if(r)for(let o of t)r.classList.remove(o)}),renderTo:(e,t=document.body,r=y.insertPositions.end)=>(e.toDOM(t,r),e),replace:(e,t,r)=>{let o=e[0];return!t||!r||!a(r,HTMLElement)&&!r.isJQx?(console.error("JQx replace: invalid replacement value"),e):(r.isJQx&&(r=r[0]),a(r,NodeList)&&(r=r[0]),o&&t&&(t=a(t,String)?o.querySelectorAll(t):t.isJQx?t.collection:t,a(t,HTMLElement,NodeList,Array)&&a(r,HTMLElement)&&(a(t,HTMLElement)?[t]:[...t]).forEach(i=>i.replaceWith(r.cloneNode(!0)))),e)},replaceClass:(e,t,...r)=>L(e,o=>{o.classList.remove(t);for(let i of r)o.classList.add(i)}),replaceMe:(e,t)=>e.replaceWith(t),replaceWith:(e,t)=>(t=a(t,Element)?t:t.isJQx?t[0]:void 0,t&&(e[0].replaceWith(t),e=y.virtual(t)),e),setData:(e,t)=>L(e,r=>Je(r,t)),show:e=>L(e,t=>Se(t,{display:"revert-layer !important"})),single:(e,t)=>e.collection.length>0?a(t,String)?e.find$(t):a(t,Number)?y(e.collection[t]):y(e.collection[0]):e,style:(e,t,r)=>L(e,i=>{r&&a(t,String)&&(t={[t]:r||"none"}),Se(i,t)}),text:(e,t,r=!1)=>e.isEmpty()?e:a(t,String)?L(e,i=>i.textContent=r?i.textContent+t:t):e.first().textContent,toDOM:(e,t=document.body,r=T.BeforeEnd)=>(e.isVirtual&&(e.isVirtual=!1),e.collection=V(e.collection,t,r),e),toggleClass:(e,t)=>L(e,r=>r.classList.toggle(t)),toNodeList:e=>[...e.collection].map(t=>document.importNode(t,!0)),trigger:(e,t,r=Event,o={})=>{if(e.collection.length){let i=new r(t,{...o,bubbles:o.bubbles??!0});for(let l of e.collection)l.dispatchEvent(i)}return e},val:(e,t)=>{let r=e[0];return!r||!a(r,HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement)?e:t===void 0?r.value:(r.value=a(t,String)?t:"",e)}}};function ze(e){if(!e("#jqxPopup").isEmpty())return;e.dialog({id:"jqxPopup"},e.div({id:"jqxPopupContent"})).render,e.editCssRules(...Ce);let[t,r]=[e("#jqxPopupContent"),e.node("#jqxPopup")],o={};return e.handle({type:"click, cancel",handlers:h,capture:!0}),Object.freeze({show:i,removeModal:S});function i(m){if(r.open)return;o={...m};let{content:p}=o;return e.IS(p,String,HTMLElement)||p?.isJQx?d():!0}function l(){return o.modal?C(o.warnMessage):v()}function d(){t.clear();let{content:m,modal:p,closeAfter:g}=o;p=e.IS(p,Boolean)?p:!1;let b=p?"":e.div({id:"closeHandleIcon"});t.append(b,e.IS(m,String)?e.div(m):m),r.showModal(),!p&&e.IS(g,Number)&&w(l,g)}function v(){if(r.close(o.returnValue),e.IS(o.callback,Function))return o.callback(o.returnValue);o={}}function S({callback:m,value:p}={}){o.returnValue=p,o.modal=!1,o.callback=m||o.callback,l()}function h(m){if(Object.keys(o).length<1||!r.open)return;o.activeTimer&&clearTimeout(o.activeTimer);let p=m.type==="cancel";return(p||m.target.closest("#closeHandleIcon")||!m.target.closest("#jqxPopupContent"))&&l(),p&&m.preventDefault(),document.activeElement.blur()}function w(m,p){e.IS(m,Function)&&e.IS(p,Number)&&p>0&&(o.activeTimer=setTimeout(m,p*1e3))}function C(m){if(!e.IS(m,String,HTMLElement,Proxy))return;let p=t.find$(".warn");switch(!0){case p.is.empty:p=e.div({class:"warn"},m);default:t.append(p.addClass("active")),w(()=>t.find$(".warn").removeClass("active"),2)}}}var oe={},tr=["load","unload","scroll","focus","blur","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","loadstart","progress","error","abort","load","loadend","pointerenter","pointerleave","readystatechange"],_e=e=>!!tr.find(t=>t===e);function Ve(){let e=(r,o)=>i=>{let l=i.target?.closest?.(r);return l&&o(i,y(l))},t=(r,o,i,l,d)=>{if(oe[r]||(oe[r]=new Map),!(oe[r].has(o)||[...oe[r].values()].find(S=>S.name&&S.name===d))){addEventListener(r,o,{capture:i||_e(r),once:l});let S={name:d||o.name,capture:i||_e(r)};oe[r].set(o,S)}};return function(r){let{eventType:o,selector:i,callback:l,name:d,capture:v,once:S}=r;if(!(y.IS(o,String)||o?.length<1)||!y.IS(l,Function))return;v=y.IS(v,Boolean)?v:!1;let h=y.IS(i,String)?e(i,l):w=>l(w,w.target);t(o,h,v,S,d)}}var rr={},{instanceMethods:Ue,instanceGetters:Ge,isCommentOrTextNode:We,isNode:re,isHtmlString:Ye,isArrayOfHtmlElements:Xe,isArrayOfHtmlStrings:Ke,ElemArray2HtmlString:et,input2Collection:tt,setCollectionFromCssSelector:rt,addHandlerId:qe,cssRuleEdit:Ee,addFn:or,elems4Docs:Co}=nr();function nr(){let e=K({createWithId:"JQxStylesheet"}),t=(f,x)=>r[f]=($,...n)=>x($,...n),r=we.instanceExtensions,o=we.factoryExtensions,i=f=>a(f,Comment,Text),l=f=>a(f,Text,HTMLElement,Comment),d=f=>a(f,Comment),v=f=>a(f,Text),S=f=>a(f,String)&&/^<|>$/.test(`${f}`.trim()),h=f=>a(f,Array)&&!f?.find(x=>!S(x)),w=f=>a(f,Array)&&!f?.find(x=>!l(x)),C=f=>f?.filter(x=>x).reduce((x,$)=>x.concat(d($)?`<!--${$.data}-->`:i($)?$.textContent:$.outerHTML),""),m=f=>f?a(f,Proxy)?[f.EL]:a(f,NodeList)?[...f]:l(f)?[f]:w(f)?f:f.isJQx?f.collection:void 0:[],p=(f,x,$)=>{let n=x!==document.body&&a(f,String)&&f.toLowerCase()!=="body"?x:document,s;try{$.collection=[...n.querySelectorAll(f)]}catch{s=`Invalid CSS querySelector. [${a(f,String)?f:"Nothing valid given!"}]`}return s??`CSS querySelector "${f}", output ${$.collection.length} element(s)`},g=f=>{let x=f.data.get("hid")||`HID${z()}`;return f.data.add({hid:x}),`[data-hid="${x}"]`},b=Object.entries(M.tagsRaw).filter(([,f])=>f).map(([f])=>f).sort((f,x)=>f.localeCompare(x));return{instanceMethods:r,instanceGetters:o,isCommentOrTextNode:i,isNode:l,isComment:d,isText:v,isHtmlString:S,isArrayOfHtmlElements:w,isArrayOfHtmlStrings:h,ElemArray2HtmlString:C,input2Collection:m,setCollectionFromCssSelector:p,addHandlerId:g,cssRuleEdit:e,addFn:t,elems4Docs:b}}function G(e){return new Proxy(e,{get:(t,r)=>sr(t,r,e)})}function ir(e,t){return(...r)=>a(e,Function)&&e(G(t),...r)}function lr(e,t){return(...r)=>a(e,Function)&&e(G(t),...r)}function sr(e,t,r){switch(!0){case a(t,Symbol):return e;case a(+t,Number):return e.collection?.[t]||void 0;case t in Ge:return lr(Ge[t],r)();case t in Ue:return ir(Ue[t],r);default:return e[t]}}function ot(e){let t=pr(e);for(let[r,o]of Object.entries(Object.getOwnPropertyDescriptors(t)))Object.defineProperty(e,r,o),Object.defineProperty(rr,r,o);return e}function ar(e){return{allow:t=>{let r=/-/.test(t),o=r&&t;t=r?ee(t):t.toLowerCase(),M.allowTag(t),a(e[t],Function)||Object.defineProperties(e,Le(t,!0,e,o))},prohibit:t=>{t=t.toLowerCase(),M.prohibitTag(t),a(e[t],Function)&&Object.defineProperties(e,Le(t,!1,e))}}}function Ze(...e){if(e.length===1){let t=String(e.shift().trim());e=t.startsWith("!")?[t.slice(1,-1)]:t.split(",").map(r=>r.trim())}for(let t of e.map(r=>r.startsWith("!")?r.slice(1,-1):r))Ee(t,{removeRule:1})}function cr(e){return function(t,r,...o){return a(r,Function)&&(o.push(r),r=void 0),e({eventType:t,selector:r,callback:o})}}function ur(e){return function(t){let{type:r,origin:o,selector:i,handlers:l,name:d,capture:v}=t,S=Pe(r);if(!a(l,Function,Array))return;l=a(l,Function)?[l]:l;let h={eventType:S,selector:i||o,capture:v,name:d},w=C=>a(C,Function)&&e({...h,callback:C});switch(!0){case(a(S,Array)&&S.length>0):for(let C of S){h.eventType=C;for(let m of l)w(m)}return;default:for(let C of l)w(C)}}}function fr(e){return function(t,r,o){r=r?.isJQx?r?.[0]:r,o=o&&Object.values(T).find(l=>o===l)?o:void 0;let i=e(t,document.createElement("br"));if(r&&!a(r,HTMLBRElement))for(let l of i.collection)o?r.insertAdjacentElement(o,l):r.append(l);return i}}function dr(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);for(let[i,l]of Object.entries(o))!(i in t)&&Object.defineProperty(t,i,l)}return t}function mr(e){console.error(`JQx: "${e}" not allowed, not rendered`)}function gr(e,t,r,o){return e=N(o||e.toLowerCase()),{get(){return(...i)=>t?r.virtual(te(ye[e](...i))):mr(e)},enumerable:!1,configurable:!0}}function Le(e,t,r,o){e=e.toLowerCase();let i=gr(e,t,r,o);return o?{[o]:i,[ee(o)]:i}:{[e]:i,[e.toUpperCase()]:i}}function pr(e){return dr(Object.entries(M.tagsRaw).reduce(yr(e),{}),br(e))}function yr(e){return function(t,[r,o]){return o&&Object.defineProperties(t,Le(r,o,e)),t}}function br(e){let t=(l,d)=>Ee(l,d),r=ar(e),o=Ve(),i=ur(o);return{debugLog:F,log:(...l)=>D("fromStatic",...l),insertPositions:T,get at(){return T},editCssRules:(...l)=>{for(let d of l)Ee(d)},editCssRule:t,get setStyle(){return t},delegate:cr(o),delegateCaptured:i,handle:i,virtual:fr(e),get fn(){return or},allowTag:r.allow,prohibitTag:r.prohibit,get lenient(){return M.allowUnknownHtmlTags},get IS(){return a},get Popup(){return e.activePopup||Object.defineProperty(e,"activePopup",{value:ze(e),enumerable:!1}),e.activePopup},popup:()=>e.Popup,createStyle:l=>K({createWithId:l||`jqx${z()}`}),editStylesheet:l=>K({createWithId:l||`jqx${z()}`}),removeCssRule:Ze,removeCssRules:Ze,text:(l,d=!1)=>d?e.comment(l):document.createTextNode(l),node:(l,d=document)=>d.querySelector(l,d),nodes:(l,d=document)=>[...d.querySelectorAll(l,d)]}}var y=ot(hr());function hr(){return function(r,o,i=T.BeforeEnd){if(r?.isJQx)return r;let l=a(o,HTMLBRElement);o=(!l&&o&&o.isJQx?o[0]:o)||document.body,i=i&&Object.values(T).find(p=>i===p)?i:void 0;let d=Ye(r),v=!d&&Ke(r),S=v||d,h={collection:tt(r)??[],isVirtual:l,isJQx:!0},w=Xe(h.collection),C=`input => ${v?`"${j(r.join(", "),70)}"`:!S&&w?`element collection [${j(h.collection.map(p=>`${a(p,Comment,Text)?"Comment|Text @":""} ${p?.outerHTML||p?.textContent}`).join(", "),70)}]`:`"${j(r,70)}"`}`;if(h.collection.length&&w)return O(C),l||h.collection.forEach(p=>{o.contains(p)||V([p],o,i)}),G(h);if(S){if([r].flat().forEach(p=>h.collection.push(H(p))),h.collection.length>0){let p=h.collection.filter(g=>g?.dataset?.jqxcreationerror);h.collection=h.collection.filter(g=>!g?.dataset?.jqxcreationerror),O(`${C}`),O(`*Created ${h.isVirtual?"VIRTUAL ":""}[${j(et(h.collection)||"sanitized: no elements remaining",70)}]`),p.length&&console.error(`JQx: illegal html, not rendered: "${p.reduce((g,b)=>g.concat(`${b.textContent}
|
|
14
|
+
`)}function kt(e){return e.reduce((t,r)=>{let[o,i]=[r.slice(0,r.indexOf(":")).trim(),r.slice(r.indexOf(":")+1).trim().replace(/;$|;.+(?=\/*).+\/$/,"")];return o&&i?{...t,[o]:i}:t},{})}function Bt(e){return kt(Rt(e))}function Oe(e,t){return e?.replace("::",":")===t?.replace("::",":")}var Jt=[...Array(26)].map((e,t)=>String.fromCharCode(t+65)).concat([...Array(26)].map((e,t)=>String.fromCharCode(t+97))).concat([...Array(10)].map((e,t)=>`${t}`)),ie=(e,t=2)=>`${e}`.padStart(t,"0"),Qt=(e,t=0)=>([e,t]=[Math.floor(e),Math.ceil(t)],Math.floor([...crypto.getRandomValues(new Uint32Array(1))].shift()/2**32*(e-t+1)+t)),P=function(e,t=1){return t=a(t,Number)&&t||1,a(e,String)&&e.length>=t},Pe=function(e){return e=a(e,String)&&/,/.test(e)?e.split(","):e,a(e,Array)?e.filter(t=>P(t)).map(t=>t.trim().toLowerCase()):a(e,String)&&e?.trim().toLowerCase()||""},Wt=e=>{let t=e.length;for(;t--;){let r=Qt(t);[e[t],e[r]]=[e[r],e[t]]}return e};var j=(e,t=120)=>`${e}`.trim().slice(0,t).replace(/>\s+</g,"><").replace(/</g,"<").replace(/\s{2,}/g," ").replace(/\n/g,"\\n")+(e.length>t?" …":"").trim(),N=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`).replace(/^-|-$/,""),qt=([e,...t])=>`${e.toUpperCase()}${t.join("")}`,ee=e=>a(e,String)?e.toLowerCase().split("-").map((t,r)=>r&&`${qt(t)}`||t).join(""):e,z=()=>`_${Wt(Jt).slice(0,8).join("")}`,le=(e,t=120)=>j(e,t).replace(/</g,"<"),q=()=>(e=>`[${ie(e.getHours())}:${ie(e.getMinutes())}:${ie(e.getSeconds())}.${ie(e.getMilliseconds(),3)}]`)(new Date);var _=e=>e.replace(/</g,"<");function Ie(){let e=function(l){if(!l)return;let d=l.style,v=getComputedStyle(l),S=[d.visibility,v.visibility].includes("hidden"),h=[d.display,v.display].includes("none"),w=l.offsetTop<0||l.offsetLeft+l.offsetWidth<0||l.offsetLeft>document.body.offsetWidth,C=+v.opacity==0||+(d.opacity||1)==0;return!(w||C||h||S)},r=function(l){return l.parentNode?!!y.nodes(":is(:read-write)",l?.parentNode)?.find(d=>d===l):!1},o=function(l){return l.parentNode?!!y.nodes(":is(:modal)",l?.parentNode)?.find(d=>d===l):!1},i={notInDOM:!0,writable:"n/a",modal:"n/a",empty:!0,open:"n/a",visible:"n/a"};return l=>{let d=l.node;return a(d,Node)?{get writable(){return r(d)},get modal(){return o(d)},get inDOM(){return d.isConnected},get open(){return d.open??!1},get visible(){return e(d)},get disabled(){return d.hasAttribute("readonly")||d.hasAttribute("disabled")},get empty(){return l.collection.length<1},get virtual(){return l.isVirtual}}:i}}var zt=!0,se={data:/data-[\-\w.\p{L}]/ui,validURL:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,whiteSpace:/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,notAllowedValues:/javascript|injected|noreferrer|alert|DataURL/gi},_t=e=>{if(zt&&Object.keys(e.removed).length){let t=Object.entries(e.removed).reduce((r,[o,i])=>[...r,`${_(o)} => ${i}`],[]).join("\\000A");F.log(`JQx HTML creation errors: ${F.isConsole?t:_(t)}`)}},Vt=function(e){let t=e.nodeName.toLowerCase(),r=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return/-/.test(t)&&!r.find(o=>o===t)||M.isAllowed(t)},te=e=>{let t={rawHTML:e?.parentElement?.getHTML()??"no html",removed:{}};return a(e,HTMLElement)&&[...e.childNodes].forEach(r=>{if(r?.children?.length&&te(r),r?.attributes){let i=a(r,SVGElement)?J.svg:J.html;[...(r??{attributes:[]}).attributes].forEach(l=>{let d=l.name.trim().toLowerCase(),v=l.value.trim().toLowerCase().replace(se.whiteSpace,""),S=d==="href"?!se.validURL.test(v):se.notAllowedValues.test(v),h=d.startsWith("data")?!se.data.test(d):!!i[d];if(S||h){let w=le(l.value||"none",60);w+=w.length===60?"...":"",t.removed[`${l.name}`]=`attribute/property (-value) not allowed, removed. Value: ${w}`,r.removeAttribute(l.name)}})}if(!(Vt(r)||r.constructor===CharacterData||r.constructor===Comment)){let i=(r?.outerHTML||r?.textContent).trim(),l=le(i,60)??"EMPTY";l+=l.length===60?"...":"",t.removed[`<${r.nodeName?.toLowerCase()}>`]=`not allowed, not rendered. Value: ${l}`,r.remove()}}),_t(t),e};var T=new Proxy({start:"afterbegin",afterbegin:"afterbegin",end:"beforeend",beforeend:"beforeend",before:"beforebegin",beforebegin:"beforebegin",after:"afterend",afterend:"afterend"},{get(e,t){return e[String(t).toLowerCase()]??e[t]}}),Ut=e=>{let t=document.createElement("div");return t.insertAdjacentHTML(T.end,e),t.childNodes.length?te(t):void 0},Gt=(e,t,r)=>a(e,Comment)?t.insertAdjacentHTML(r,`<!--${e.data}-->`):t.insertAdjacentText(r,e.data),V=(e=[],t=document.body,r=T.BeforeEnd)=>e.reduce((o,i)=>{let l=re(i)&&pe(i,t,r);return l?[...o,l]:o},[]),pe=(e,t=document.body,r=T.BeforeEnd)=>(t=t?.isJQx?t?.[0]:t,a(e,Comment,Text)?Gt(e,t,r):t.insertAdjacentElement(r,e)),H=e=>{if(a(e,Text,Comment))return e;let t=e?.trim(),r=t?.split(/<text>|<\/text>/i)??[];if(r?.length&&(r=r.length>1?r.filter(i=>i.length).shift():void 0),t.startsWith("<!--")&&t.endsWith("-->"))return document.createComment(e.replace(/<!--|-->$/g,""));if(r||!/^<(.+)[^>]+>/m.test(t))return document.createTextNode(r);let o=Ut(e);return o.childNodes.length<1?H(`<span data-jqxcreationerror="1">${j(e,60)}</span>`):o.children[0]};var L=(e,t)=>{let r=e.collection.filter(o=>!We(o));for(let o=0;o<r.length;o+=1)t(r[o],o);return e},Zt=Ie(),Re=e=>e&&(e.textContent="");var U=e=>{let t=e.cloneNode(!0);return t.removeAttribute&&t.removeAttribute("id"),e.isConnected?e.remove():e=null,t},Je=(e,t)=>{if(e&&a(t,Object))for(let[r,o]of Object.entries(t))e.setAttribute(`data-${N(r)}`,o)},ke=(e,t)=>e.andThen(t,!0),Be=(e,t)=>e.andThen(t),Qe=e=>e.startsWith("data")||J.html.find(t=>e.toLowerCase()===t),Yt=(e,t,r)=>{r&&a(t,String)&&(t={[t]:r==="-"?"":r});let o;t.className&&(o=t.className,delete t.className),o=[...e.classList].find(l=>l.startsWith("JQxClass-")||o&&l===o)||o||`JQxClass-${z().slice(1)}`,y.editCssRule(`.${o}`,t),e.classList.add(o)},Xt=(e,t)=>{if(e)for(let[r,o]of Object.entries(t)){if(r=N(r),r.startsWith("data"))return Je(e,o);a(o,String)&&Qe(r)&&e.setAttribute(r,o.split(/[, ]/)?.join(" "))}},Se=(e,t)=>{if(a(t,Object))for(let[r,o]of Object.entries(t)){let i;/!important/i.test(o)&&(o=o.slice(0,o.indexOf("!")).trim(),i="important"),e.style.setProperty(N(r),o,i)}},Kt={get(e,t){return e[ee(t)]||e[t]},enumerable:!1,configurable:!1},er=(...e)=>{F.log("\u2757"+e.map(t=>String(t)).join(", "))},ve=(e,t=0,r=!0)=>(e=e?.parentElement,t+=e?e[r?"scrollTop":"scrollLeft"]:0,e?ve(e,t,r):t),we={factoryExtensions:{data:e=>({get all(){return new Proxy(e[0]?.dataset??{},Kt)},set:(t={})=>{if(!e.is.empty&&a(t,Object))for(let[r,o]of Object.entries(t))e.setData({[r]:o});return e},get:(t,r)=>e.data.all[t]??r,add:(t={})=>{if(!e.is.empty&&a(t,Object))for(let[r,o]of Object.entries(t))e.setData({[r]:o});return e},remove:t=>(e[0]?.removeAttribute(`data-${N(t)}`),e)}),dimensions:e=>{if(e.is.empty)return{error:"[instance].dimensions: NO ELEMENTS"};let t=e[0],r=e.first()?.getBoundingClientRect().toJSON();return r.scrollTopDistance=ve(t,0),r.scrollLeftDistance=ve(t,0,!1),r},node:e=>e[0],HTML:e=>({get:(t,r)=>{if(e.is.empty)return"NO ELEMENTS IN COLLECTION";let o=t?e.outerHtml:e.html();return r?_(o):o},set:(t,r=!1,o=!1)=>{t=t.isJQx?t.HTML.get(1):t;let i=a(t,String);return t=i&&o?_(t):t,i&&(t||"").trim().length&&e.html(t,r),e},replace:(t,r=!1)=>e.HTML.set(t,!1,r),append:(t,r=!1)=>(t=a(t,HTMLElement)?y(t).HTML.get(1):t.isJQx?t.HTML.get(1):t,e.HTML.set(t,!0,r)),insert:(t,r=!1)=>(t=a(t,HTMLElement)?y(t).HTML.get(1):t.isJQx?t.HTML.get(1):t,e.HTML.set(t+e.HTML.get(),!1,r))}),is:e=>Zt(e),length:e=>e.collection.length,outerHtml:e=>(e.first()||{outerHTML:void 0}).outerHTML,parent:e=>{let t=y(e[0]?.parentNode);return t.is.empty?e:t},render:e=>(!e.is.empty&&e.toDOM()||y.log("[JQx.render]: empty collection"),e),Style:e=>({get computed(){return e.is.empty?{}:getComputedStyle(e[0])},inline:t=>e.style(t),inSheet:t=>e.css(t),valueOf:t=>e.is.empty?void 0:getComputedStyle(e[0])[N(t)],nwRule:t=>e.Style.byRule({rules:t}),byRule:({classes2Apply:t=[],rules:r=[]}={})=>{let i=a(r,String)&&!t.length?r.split("{")[0].trim():"";if(r=r&&a(r,String)?[r]:r,t=t&&a(t,String)?[t]:t,(r?.length||t?.length)&&(r?.length&&y.editCssRules(...r),t))for(let l of t)e.addClass(l);return i?.startsWith(".")&&e.addClass(i.slice(1)),i?.startsWith("#")&&!e.attr("id")&&e.prop({id:i.slice(1)}),e}})},instanceExtensions:{addClass:(e,...t)=>L(e,r=>r&&t.forEach(o=>r.classList.add(o))),after:Be,afterMe:Be,andThen:(e,t,r=!1)=>{if(!t||!a(t,String,Node,Proxy))return er(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${t}]`),e;t=t?.isJQx?t.collection:a(t,Node)?y.virtual(t).collection:y.virtual(H(t)).collection;let[o,i,l]=r?[0,"before",t.concat(e.collection)]:[e.collection.length-1,"after",e.collection.concat(t)];return e[o][i](...t),e.collection=l,e},append:(e,...t)=>{if(!e.is.empty&&t.length){let r=e.length===1;for(let o of t){if(!o.isJQx&&P(o)){let i=o.trim(),d=!/^<(.+)[^>]+>$/m.test(i)?y.text(o):H(o);L(e,v=>v.append(r?d:U(d)))}re(o)&&L(e,i=>i.append(r?o:U(o))),o.isJQx&&!o.is.empty&&L(e,i=>o.collection.forEach(l=>i.append(r?l:U(l))))}}return e},appendTo:(e,t)=>(t.isJQx||(t=y(t)),t.append(e),e),attr:(e,t,r)=>{let o=e[0];if(!o)return e;if(!r&&P(t))return t=N(t),t==="class"?[...o?.classList].join(" "):o?.getAttribute(t);if(P(t)&&r)switch(t=N(t),!0){case t.startsWith("data-"):t={data:{[t.replace("data-","")]:r}};break;default:t={[t]:r}}return a(t,Object)&&!e.is.empty&&Xt(o,t),e},before:ke,beforeMe:ke,clear:e=>L(e,Re),closest:(e,t)=>{let r=P(t)?e[0].closest(t):null;return r?y(r):e},computedStyle:(e,t)=>e.first()&&getComputedStyle(e.first())[t],css:(e,t,r)=>L(e,o=>Yt(o,t,r)),duplicate:(e,t=!1,r=document.body)=>{let o=e.toNodeList().map(l=>l.removeAttribute&&l.removeAttribute("id")||l),i=y.virtual(o);return t?i.toDOM(r):i},each:(e,t)=>L(e,t),empty:e=>L(e,Re),find:(e,t)=>e.collection.length>0?[...e.first()?.querySelectorAll(t)]:[],find$:(e,t)=>e.collection.length>0?y(t,e):e,first:(e,t=!1)=>{if(e.collection.length>0)return t?e.single():e.collection[0]},first$:(e,t)=>e.single(t),getData:(e,t,r)=>e.first()&&e.first().dataset?.[t]||r,hasClass:(e,...t)=>{let r=e[0];return!r||!r.classList.length?!1:t.find(o=>r.classList.contains(o))&&!0||!1},hide:e=>L(e,t=>Se(t,{display:"none !important"})),html:(e,t,r)=>{if(t===void 0){let o=e.node;return o?.getHTML&&o.getHTML()||""}if(!e.isEmpty()){let o=H(`<div>${t.isJQx?t.HTML.get(!0):t}</div>`);if(!a(o,Comment))return L(e,l=>(r||(l.textContent=""),l.insertAdjacentHTML(y.at.end,o.getHTML())))}return e},htmlFor:(e,t,r="",o=!1)=>{if(t&&e.collection.length){if(!t||!P(r))return e;let i=e.find$(t);if(i.length<1)return e;let l=H(`<span>${r}</span>`);i.each(d=>{o||(d.textContent=""),d.insertAdjacentHTML(y.at.end,l?.getHTML())})}return e},isEmpty:e=>e.collection.length<1,nth$:(e,t)=>e.single(t),on:(e,t,...r)=>{if(e.collection.length&&a(t,String,Array)){if(t?.length<1||r.length<1)return e;let o=qe(e);y.handle({type:t,selector:o,handlers:r})}return e},prepend:(e,...t)=>{if(!e.is.empty&&t){let r=e.length===1;for(let o of t){if(P(o)){o=o.trim();let l=!/^<(.+)[^>]+>$/m.test(o)?y.text(o):H(o);l=r?l:U(l),L(e,d=>d.prepend(l.cloneNode(!0)))}re(o)&&L(e,i=>i.prepend(r?o:U(o))),o.isJQx&&!o.is.empty&&(o.collection.length>1&&o.collection.reverse(),L(e,i=>L(o,l=>i.prepend(r?l:U(l)))),o.collection.reverse())}}return e},prependTo:(e,t)=>(t.isJQx||(t=y.virtual(t)),t.prepend(e),e),prop:(e,t,r)=>{if(a(t,String)&&!r)return t.startsWith("data")?e[0]?.dataset[t.slice(t.indexOf("-")+1)]:e[0]?.[t];let o=a(t,Object)?t:{[t]:r};for(let[i,l]of Object.entries(o)){if(i=i.trim(),l&&!Qe(i)||!l)return!1;if(i.toLowerCase()==="id")return e[0].id=l;L(e,v=>{if(i.startsWith("data"))return v.dataset[i.slice(i.indexOf("-")+1)]=l;v[i]=l})}return e},remove:(e,t)=>{O(`remove ${j(e.HTML.get(1),40)}${t?` /w selector ${t}`:""}`);let r=i=>i.remove(),o=()=>e.collection=e.collection.filter(i=>document.documentElement.contains(i));if(t){let i=e.find$(t);return i.is.empty||(L(i,r),o()),e}return L(e,r),o(),e},rmAttr:(e,...t)=>{for(let r of t)e.node.removeAttribute(r);return e},removeClass:(e,...t)=>L(e,r=>{if(r)for(let o of t)r.classList.remove(o)}),renderTo:(e,t=document.body,r=y.insertPositions.end)=>(e.toDOM(t,r),e),replace:(e,t,r)=>{let o=e[0];return!t||!r||!a(r,HTMLElement)&&!r.isJQx?(console.error("JQx replace: invalid replacement value"),e):(r.isJQx&&(r=r[0]),a(r,NodeList)&&(r=r[0]),o&&t&&(t=a(t,String)?o.querySelectorAll(t):t.isJQx?t.collection:t,a(t,HTMLElement,NodeList,Array)&&a(r,HTMLElement)&&(a(t,HTMLElement)?[t]:[...t]).forEach(i=>i.replaceWith(r.cloneNode(!0)))),e)},replaceClass:(e,t,...r)=>L(e,o=>{o.classList.remove(t);for(let i of r)o.classList.add(i)}),replaceMe:(e,t)=>e.replaceWith(t),replaceWith:(e,t)=>(t=a(t,Element)?t:t.isJQx?t[0]:void 0,t&&(e[0].replaceWith(t),e=y.virtual(t)),e),setData:(e,t)=>L(e,r=>Je(r,t)),show:e=>L(e,t=>Se(t,{display:"revert-layer !important"})),single:(e,t)=>e.collection.length>0?a(t,String)?e.find$(t):a(t,Number)?y(e.collection[t]):y(e.collection[0]):e,style:(e,t,r)=>L(e,i=>{r&&a(t,String)&&(t={[t]:r||"none"}),Se(i,t)}),text:(e,t,r=!1)=>e.isEmpty()?e:a(t,String)?L(e,i=>i.textContent=r?i.textContent+t:t):e.first().textContent,toDOM:(e,t=document.body,r=T.BeforeEnd)=>(e.isVirtual&&(e.isVirtual=!1),e.collection=V(e.collection,t,r),e),toggleClass:(e,t)=>L(e,r=>r.classList.toggle(t)),toNodeList:e=>[...e.collection].map(t=>document.importNode(t,!0)),trigger:(e,t,r=Event,o={})=>{if(e.collection.length){let i=new r(t,{...o,bubbles:o.bubbles??!0});for(let l of e.collection)l.dispatchEvent(i)}return e},val:(e,t)=>{let r=e[0];return!r||!a(r,HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement)?e:t===void 0?r.value:(r.value=a(t,String)?t:"",e)}}};function ze(e){if(!e("#jqxPopup").isEmpty())return;e.dialog({id:"jqxPopup"},e.div({id:"jqxPopupContent"})).render,e.editCssRules(...Ce);let[t,r]=[e("#jqxPopupContent"),e.node("#jqxPopup")],o={};return e.handle({type:"click, cancel",handlers:h,capture:!0}),Object.freeze({show:i,removeModal:S});function i(m){if(r.open)return;o={...m};let{content:p}=o;return e.IS(p,String,HTMLElement)||p?.isJQx?d():!0}function l(){return o.modal?C(o.warnMessage):v()}function d(){t.clear();let{content:m,modal:p,closeAfter:g}=o;p=e.IS(p,Boolean)?p:!1;let b=p?"":e.div({id:"closeHandleIcon"});t.append(b,e.IS(m,String)?e.div(m):m),r.showModal(),!p&&e.IS(g,Number)&&w(l,g)}function v(){if(r.close(o.returnValue),e.IS(o.callback,Function))return o.callback(o.returnValue);o={}}function S({callback:m,value:p}={}){o.returnValue=p,o.modal=!1,o.callback=m||o.callback,l()}function h(m){if(Object.keys(o).length<1||!r.open)return;o.activeTimer&&clearTimeout(o.activeTimer);let p=m.type==="cancel";return(p||m.target.closest("#closeHandleIcon")||!m.target.closest("#jqxPopupContent"))&&l(),p&&m.preventDefault(),document.activeElement.blur()}function w(m,p){e.IS(m,Function)&&e.IS(p,Number)&&p>0&&(o.activeTimer=setTimeout(m,p*1e3))}function C(m){if(!e.IS(m,String,HTMLElement,Proxy))return;let p=t.find$(".warn");switch(!0){case p.is.empty:p=e.div({class:"warn"},m);default:t.append(p.addClass("active")),w(()=>t.find$(".warn").removeClass("active"),2)}}}var oe={},tr=["load","unload","scroll","focus","blur","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","loadstart","progress","error","abort","load","loadend","pointerenter","pointerleave","readystatechange"],_e=e=>!!tr.find(t=>t===e);function Ve(){let e=(r,o)=>i=>{let l=i.target?.closest?.(r);return l&&o(i,y(l))},t=(r,o,i,l,d)=>{if(oe[r]||(oe[r]=new Map),!(oe[r].has(o)||[...oe[r].values()].find(S=>S.name&&S.name===d))){addEventListener(r,o,{capture:i||_e(r),once:l});let S={name:d||o.name,capture:i||_e(r)};oe[r].set(o,S)}};return function(r){let{eventType:o,selector:i,callback:l,name:d,capture:v,once:S}=r;if(!(y.IS(o,String)||o?.length<1)||!y.IS(l,Function))return;v=y.IS(v,Boolean)?v:!1;let h=y.IS(i,String)?e(i,l):w=>l(w,w.target);t(o,h,v,S,d)}}var rr={},{instanceMethods:Ue,instanceGetters:Ge,isCommentOrTextNode:We,isNode:re,isHtmlString:Ye,isArrayOfHtmlElements:Xe,isArrayOfHtmlStrings:Ke,ElemArray2HtmlString:et,input2Collection:tt,setCollectionFromCssSelector:rt,addHandlerId:qe,cssRuleEdit:Ee,addFn:or,elems4Docs:Co}=nr();function nr(){let e=K({createWithId:"JQxStylesheet"}),t=(f,x)=>r[f]=($,...n)=>x($,...n),r=we.instanceExtensions,o=we.factoryExtensions,i=f=>a(f,Comment,Text),l=f=>a(f,Text,HTMLElement,Comment),d=f=>a(f,Comment),v=f=>a(f,Text),S=f=>a(f,String)&&/^<|>$/.test(`${f}`.trim()),h=f=>a(f,Array)&&!f?.find(x=>!S(x)),w=f=>a(f,Array)&&!f?.find(x=>!l(x)),C=f=>f?.filter(x=>x).reduce((x,$)=>x.concat(d($)?`<!--${$.data}-->`:i($)?$.textContent:$.outerHTML),""),m=f=>f?a(f,Proxy)?[f.EL]:a(f,NodeList)?[...f]:l(f)?[f]:w(f)?f:f.isJQx?f.collection:void 0:[],p=(f,x,$)=>{let n=x!==document.body&&a(f,String)&&f.toLowerCase()!=="body"?x:document,s;try{$.collection=[...n.querySelectorAll(f)]}catch{s=`Invalid CSS querySelector. [${a(f,String)?f:"Nothing valid given!"}]`}return s??`CSS querySelector "${f}", output ${$.collection.length} element(s)`},g=f=>{let x=f.data.get("hid")||`HID${z()}`;return f.data.add({hid:x}),`[data-hid="${x}"]`},b=Object.entries(M.tagsRaw).filter(([,f])=>f).map(([f])=>f).sort((f,x)=>f.localeCompare(x));return{instanceMethods:r,instanceGetters:o,isCommentOrTextNode:i,isNode:l,isComment:d,isText:v,isHtmlString:S,isArrayOfHtmlElements:w,isArrayOfHtmlStrings:h,ElemArray2HtmlString:C,input2Collection:m,setCollectionFromCssSelector:p,addHandlerId:g,cssRuleEdit:e,addFn:t,elems4Docs:b}}function G(e){return new Proxy(e,{get:(t,r)=>sr(t,r,e)})}function ir(e,t){return(...r)=>a(e,Function)&&e(G(t),...r)}function lr(e,t){return(...r)=>a(e,Function)&&e(G(t),...r)}function sr(e,t,r){switch(!0){case a(t,Symbol):return e;case a(+t,Number):return e.collection?.[t]||void 0;case t in Ge:return lr(Ge[t],r)();case t in Ue:return ir(Ue[t],r);default:return e[t]}}function ot(e){let t=mr(e);for(let[r,o]of Object.entries(Object.getOwnPropertyDescriptors(t)))Object.defineProperty(e,r,o),Object.defineProperty(rr,r,o);return e}function ar(e){return{allow:t=>{let r=/-/.test(t),o=r&&t;t=r?ee(t):t.toLowerCase(),M.allowTag(t),a(e[t],Function)||Object.defineProperties(e,Le(t,!0,e,o))},prohibit:t=>{t=t.toLowerCase(),M.prohibitTag(t),a(e[t],Function)&&Object.defineProperties(e,Le(t,!1,e))}}}function Ze(...e){if(e.length===1){let t=String(e.shift().trim());e=t.startsWith("!")?[t.slice(1,-1)]:t.split(",").map(r=>r.trim())}for(let t of e.map(r=>r.startsWith("!")?r.slice(1,-1):r))Ee(t,{removeRule:1})}function cr(e){return function(t,r,o){r=r?.isJQx?r?.[0]:r,o=o&&Object.values(T).find(l=>o===l)?o:void 0;let i=e(t,document.createElement("br"));if(r&&!a(r,HTMLBRElement))for(let l of i.collection)o?r.insertAdjacentElement(o,l):r.append(l);return i}}function ur(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);for(let[i,l]of Object.entries(o))!(i in t)&&Object.defineProperty(t,i,l)}return t}function fr(e){console.error(`JQx: "${e}" not allowed, not rendered`)}function dr(e,t,r,o){return e=N(o||e.toLowerCase()),{get(){return(...i)=>t?r.virtual(te(ye[e](...i))):fr(e)},enumerable:!1,configurable:!0}}function Le(e,t,r,o){e=e.toLowerCase();let i=dr(e,t,r,o);return o?{[o]:i,[ee(o)]:i}:{[e]:i,[e.toUpperCase()]:i}}function mr(e){return ur(Object.entries(M.tagsRaw).reduce(gr(e),{}),br(e))}function gr(e){return function(t,[r,o]){return o&&Object.defineProperties(t,Le(r,o,e)),t}}function pr(e){return function(t,r,...o){a(r,Function)&&(o.push(r),r=void 0),e({type:t,selector:r,handlers:o})}}function yr(e){return function(t){let{type:r,origin:o,selector:i,handlers:l,name:d,capture:v}=t,S=Pe(r);if(!a(l,Function,Array))return;l=a(l,Function)?[l]:l;let h={eventType:S,selector:i||o,capture:v,name:d},w=C=>a(C,Function)&&e({...h,callback:C});switch(!0){case(a(S,Array)&&S.length>0):for(let C of S){h.eventType=C;for(let m of l)w(m)}return;default:for(let C of l)w(C)}}}function br(e){let t=(l,d)=>Ee(l,d),r=ar(e),o=Ve(),i=yr(o);return{debugLog:F,log:(...l)=>D("fromStatic",...l),insertPositions:T,get at(){return T},editCssRules:(...l)=>{for(let d of l)Ee(d)},editCssRule:t,get setStyle(){return t},delegate:pr(i),delegateCaptured:i,handle:i,virtual:cr(e),get fn(){return or},allowTag:r.allow,prohibitTag:r.prohibit,get lenient(){return M.allowUnknownHtmlTags},get IS(){return a},get Popup(){return e.activePopup||Object.defineProperty(e,"activePopup",{value:ze(e),enumerable:!1}),e.activePopup},popup:()=>e.Popup,createStyle:l=>K({createWithId:l||`jqx${z()}`}),editStylesheet:l=>K({createWithId:l||`jqx${z()}`}),removeCssRule:Ze,removeCssRules:Ze,text:(l,d=!1)=>d?e.comment(l):document.createTextNode(l),node:(l,d=document)=>d.querySelector(l,d),nodes:(l,d=document)=>[...d.querySelectorAll(l,d)]}}var y=ot(hr());function hr(){return function(r,o,i=T.BeforeEnd){if(r?.isJQx)return r;let l=a(o,HTMLBRElement);o=(!l&&o&&o.isJQx?o[0]:o)||document.body,i=i&&Object.values(T).find(p=>i===p)?i:void 0;let d=Ye(r),v=!d&&Ke(r),S=v||d,h={collection:tt(r)??[],isVirtual:l,isJQx:!0},w=Xe(h.collection),C=`input => ${v?`"${j(r.join(", "),70)}"`:!S&&w?`element collection [${j(h.collection.map(p=>`${a(p,Comment,Text)?"Comment|Text @":""} ${p?.outerHTML||p?.textContent}`).join(", "),70)}]`:`"${j(r,70)}"`}`;if(h.collection.length&&w)return O(C),l||h.collection.forEach(p=>{o.contains(p)||V([p],o,i)}),G(h);if(S){if([r].flat().forEach(p=>h.collection.push(H(p))),h.collection.length>0){let p=h.collection.filter(g=>g?.dataset?.jqxcreationerror);h.collection=h.collection.filter(g=>!g?.dataset?.jqxcreationerror),O(`${C}`),O(`*Created ${h.isVirtual?"VIRTUAL ":""}[${j(et(h.collection)||"sanitized: no elements remaining",70)}]`),p.length&&console.error(`JQx: illegal html, not rendered: "${p.reduce((g,b)=>g.concat(`${b.textContent}
|
|
15
15
|
`),"").trim()}"`),h.isVirtual||V(h.collection,o,i)}return G(h)}let m=rt(r,o,h);return O(`input => ${m}`),G(h)}}return ct(xr);})();
|
package/Bundle/jqx.min.js
CHANGED
|
@@ -11,5 +11,5 @@ ${r}`),g}}return{sheet:e,removeRules:S,tryParseAtOrNestedRules:v,ruleExists:d,ch
|
|
|
11
11
|
`)}function At(e){return e.replace(/([*\[\]()-+{}.$?\\])/g,t=>`\\${t}`)}function Dt(e,...t){let r=t.length&&Array.isArray(t.slice(-1))?t.pop().join(""):"";return new RegExp((t.length&&e.raw.reduce((o,i,l)=>o.concat(t[l-1]||"").concat(i),"")||e.raw.join("")).split(`
|
|
12
12
|
`).map(o=>o.replace(/\s|\/\/.*$/g,"").trim().replace(/(@s!)/g," ")).join(""),r)}function je(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`).replace(/[^--]^-|-$/,"")}function Ne(e,t){try{return e()}catch(r){console.error(`${t||"an error occured"}: ${r.message}`)}}function Ht(e){return e.replace(/\/\*.+?\*\//gm,"").replace(/[}{\r\n]/g,"").replace(/(data:.+?);/g,(t,r)=>`${r}\\3b`).split(";").map(t=>t.trim()).join(`;
|
|
13
13
|
`).replaceAll("\\3b",";").split(`
|
|
14
|
-
`)}function jt(e){return e.reduce((t,r)=>{let[o,i]=[r.slice(0,r.indexOf(":")).trim(),r.slice(r.indexOf(":")+1).trim().replace(/;$|;.+(?=\/*).+\/$/,"")];return o&&i?{...t,[o]:i}:t},{})}function Nt(e){return jt(Ht(e))}function Me(e,t){return e?.replace("::",":")===t?.replace("::",":")}var Mt=[...Array(26)].map((e,t)=>String.fromCharCode(t+65)).concat([...Array(26)].map((e,t)=>String.fromCharCode(t+97))).concat([...Array(10)].map((e,t)=>`${t}`)),ie=(e,t=2)=>`${e}`.padStart(t,"0"),Ot=(e,t=0)=>([e,t]=[Math.floor(e),Math.ceil(t)],Math.floor([...crypto.getRandomValues(new Uint32Array(1))].shift()/2**32*(e-t+1)+t)),P=function(e,t=1){return t=a(t,Number)&&t||1,a(e,String)&&e.length>=t},Oe=function(e){return e=a(e,String)&&/,/.test(e)?e.split(","):e,a(e,Array)?e.filter(t=>P(t)).map(t=>t.trim().toLowerCase()):e?.trim().toLowerCase()||""},Pt=e=>{let t=e.length;for(;t--;){let r=Ot(t);[e[t],e[r]]=[e[r],e[t]]}return e};var j=(e,t=120)=>`${e}`.trim().slice(0,t).replace(/>\s+</g,"><").replace(/</g,"<").replace(/\s{2,}/g," ").replace(/\n/g,"\\n")+(e.length>t?" …":"").trim(),N=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`).replace(/^-|-$/,""),It=([e,...t])=>`${e.toUpperCase()}${t.join("")}`,ee=e=>a(e,String)?e.toLowerCase().split("-").map((t,r)=>r&&`${It(t)}`||t).join(""):e,z=()=>`_${Pt(Mt).slice(0,8).join("")}`,le=(e,t=120)=>j(e,t).replace(/</g,"<"),q=()=>(e=>`[${ie(e.getHours())}:${ie(e.getMinutes())}:${ie(e.getSeconds())}.${ie(e.getMilliseconds(),3)}]`)(new Date);var _=e=>e.replace(/</g,"<");function Pe(){let e=function(l){if(!l)return;let d=l.style,v=getComputedStyle(l),S=[d.visibility,v.visibility].includes("hidden"),h=[d.display,v.display].includes("none"),w=l.offsetTop<0||l.offsetLeft+l.offsetWidth<0||l.offsetLeft>document.body.offsetWidth,C=+v.opacity==0||+(d.opacity||1)==0;return!(w||C||h||S)},r=function(l){return l.parentNode?!!y.nodes(":is(:read-write)",l?.parentNode)?.find(d=>d===l):!1},o=function(l){return l.parentNode?!!y.nodes(":is(:modal)",l?.parentNode)?.find(d=>d===l):!1},i={notInDOM:!0,writable:"n/a",modal:"n/a",empty:!0,open:"n/a",visible:"n/a"};return l=>{let d=l.node;return a(d,Node)?{get writable(){return r(d)},get modal(){return o(d)},get inDOM(){return d.isConnected},get open(){return d.open??!1},get visible(){return e(d)},get disabled(){return d.hasAttribute("readonly")||d.hasAttribute("disabled")},get empty(){return l.collection.length<1},get virtual(){return l.isVirtual}}:i}}var Rt=!0,se={data:/data-[\-\w.\p{L}]/ui,validURL:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,whiteSpace:/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,notAllowedValues:/javascript|injected|noreferrer|alert|DataURL/gi},kt=e=>{if(Rt&&Object.keys(e.removed).length){let t=Object.entries(e.removed).reduce((r,[o,i])=>[...r,`${_(o)} => ${i}`],[]).join("\\000A");F.log(`JQx HTML creation errors: ${F.isConsole?t:_(t)}`)}},Bt=function(e){let t=e.nodeName.toLowerCase(),r=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return/-/.test(t)&&!r.find(o=>o===t)||M.isAllowed(t)},te=e=>{let t={rawHTML:e?.parentElement?.getHTML()??"no html",removed:{}};return a(e,HTMLElement)&&[...e.childNodes].forEach(r=>{if(r?.children?.length&&te(r),r?.attributes){let i=a(r,SVGElement)?J.svg:J.html;[...(r??{attributes:[]}).attributes].forEach(l=>{let d=l.name.trim().toLowerCase(),v=l.value.trim().toLowerCase().replace(se.whiteSpace,""),S=d==="href"?!se.validURL.test(v):se.notAllowedValues.test(v),h=d.startsWith("data")?!se.data.test(d):!!i[d];if(S||h){let w=le(l.value||"none",60);w+=w.length===60?"...":"",t.removed[`${l.name}`]=`attribute/property (-value) not allowed, removed. Value: ${w}`,r.removeAttribute(l.name)}})}if(!(Bt(r)||r.constructor===CharacterData||r.constructor===Comment)){let i=(r?.outerHTML||r?.textContent).trim(),l=le(i,60)??"EMPTY";l+=l.length===60?"...":"",t.removed[`<${r.nodeName?.toLowerCase()}>`]=`not allowed, not rendered. Value: ${l}`,r.remove()}}),kt(t),e};var T=new Proxy({start:"afterbegin",afterbegin:"afterbegin",end:"beforeend",beforeend:"beforeend",before:"beforebegin",beforebegin:"beforebegin",after:"afterend",afterend:"afterend"},{get(e,t){return e[String(t).toLowerCase()]??e[t]}}),Jt=e=>{let t=document.createElement("div");return t.insertAdjacentHTML(T.end,e),t.childNodes.length?te(t):void 0},Qt=(e,t,r)=>a(e,Comment)?t.insertAdjacentHTML(r,`<!--${e.data}-->`):t.insertAdjacentText(r,e.data),V=(e=[],t=document.body,r=T.BeforeEnd)=>e.reduce((o,i)=>{let l=re(i)&&ge(i,t,r);return l?[...o,l]:o},[]),ge=(e,t=document.body,r=T.BeforeEnd)=>(t=t?.isJQx?t?.[0]:t,a(e,Comment,Text)?Qt(e,t,r):t.insertAdjacentElement(r,e)),H=e=>{if(a(e,Text,Comment))return e;let t=e?.trim(),r=t?.split(/<text>|<\/text>/i)??[];if(r?.length&&(r=r.length>1?r.filter(i=>i.length).shift():void 0),t.startsWith("<!--")&&t.endsWith("-->"))return document.createComment(e.replace(/<!--|-->$/g,""));if(r||!/^<(.+)[^>]+>/m.test(t))return document.createTextNode(r);let o=Jt(e);return o.childNodes.length<1?H(`<span data-jqxcreationerror="1">${j(e,60)}</span>`):o.children[0]};var L=(e,t)=>{let r=e.collection.filter(o=>!Qe(o));for(let o=0;o<r.length;o+=1)t(r[o],o);return e},Wt=Pe(),Ie=e=>e&&(e.textContent="");var U=e=>{let t=e.cloneNode(!0);return t.removeAttribute&&t.removeAttribute("id"),e.isConnected?e.remove():e=null,t},Be=(e,t)=>{if(e&&a(t,Object))for(let[r,o]of Object.entries(t))e.setAttribute(`data-${N(r)}`,o)},Re=(e,t)=>e.andThen(t,!0),ke=(e,t)=>e.andThen(t),Je=e=>e.startsWith("data")||J.html.find(t=>e.toLowerCase()===t),qt=(e,t,r)=>{r&&a(t,String)&&(t={[t]:r==="-"?"":r});let o;t.className&&(o=t.className,delete t.className),o=[...e.classList].find(l=>l.startsWith("JQxClass-")||o&&l===o)||o||`JQxClass-${z().slice(1)}`,y.editCssRule(`.${o}`,t),e.classList.add(o)},zt=(e,t)=>{if(e)for(let[r,o]of Object.entries(t)){if(r=N(r),r.startsWith("data"))return Be(e,o);a(o,String)&&Je(r)&&e.setAttribute(r,o.split(/[, ]/)?.join(" "))}},xe=(e,t)=>{if(a(t,Object))for(let[r,o]of Object.entries(t)){let i;/!important/i.test(o)&&(o=o.slice(0,o.indexOf("!")).trim(),i="important"),e.style.setProperty(N(r),o,i)}},_t={get(e,t){return e[ee(t)]||e[t]},enumerable:!1,configurable:!1},Vt=(...e)=>{F.log("\u2757"+e.map(t=>String(t)).join(", "))},Se=(e,t=0,r=!0)=>(e=e?.parentElement,t+=e?e[r?"scrollTop":"scrollLeft"]:0,e?Se(e,t,r):t),ve={factoryExtensions:{data:e=>({get all(){return new Proxy(e[0]?.dataset??{},_t)},set:(t={})=>{if(!e.is.empty&&a(t,Object))for(let[r,o]of Object.entries(t))e.setData({[r]:o});return e},get:(t,r)=>e.data.all[t]??r,add:(t={})=>{if(!e.is.empty&&a(t,Object))for(let[r,o]of Object.entries(t))e.setData({[r]:o});return e},remove:t=>(e[0]?.removeAttribute(`data-${N(t)}`),e)}),dimensions:e=>{if(e.is.empty)return{error:"[instance].dimensions: NO ELEMENTS"};let t=e[0],r=e.first()?.getBoundingClientRect().toJSON();return r.scrollTopDistance=Se(t,0),r.scrollLeftDistance=Se(t,0,!1),r},node:e=>e[0],HTML:e=>({get:(t,r)=>{if(e.is.empty)return"NO ELEMENTS IN COLLECTION";let o=t?e.outerHtml:e.html();return r?_(o):o},set:(t,r=!1,o=!1)=>{t=t.isJQx?t.HTML.get(1):t;let i=a(t,String);return t=i&&o?_(t):t,i&&(t||"").trim().length&&e.html(t,r),e},replace:(t,r=!1)=>e.HTML.set(t,!1,r),append:(t,r=!1)=>(t=a(t,HTMLElement)?y(t).HTML.get(1):t.isJQx?t.HTML.get(1):t,e.HTML.set(t,!0,r)),insert:(t,r=!1)=>(t=a(t,HTMLElement)?y(t).HTML.get(1):t.isJQx?t.HTML.get(1):t,e.HTML.set(t+e.HTML.get(),!1,r))}),is:e=>Wt(e),length:e=>e.collection.length,outerHtml:e=>(e.first()||{outerHTML:void 0}).outerHTML,parent:e=>{let t=y(e[0]?.parentNode);return t.is.empty?e:t},render:e=>(!e.is.empty&&e.toDOM()||y.log("[JQx.render]: empty collection"),e),Style:e=>({get computed(){return e.is.empty?{}:getComputedStyle(e[0])},inline:t=>e.style(t),inSheet:t=>e.css(t),valueOf:t=>e.is.empty?void 0:getComputedStyle(e[0])[N(t)],nwRule:t=>e.Style.byRule({rules:t}),byRule:({classes2Apply:t=[],rules:r=[]}={})=>{let i=a(r,String)&&!t.length?r.split("{")[0].trim():"";if(r=r&&a(r,String)?[r]:r,t=t&&a(t,String)?[t]:t,(r?.length||t?.length)&&(r?.length&&y.editCssRules(...r),t))for(let l of t)e.addClass(l);return i?.startsWith(".")&&e.addClass(i.slice(1)),i?.startsWith("#")&&!e.attr("id")&&e.prop({id:i.slice(1)}),e}})},instanceExtensions:{addClass:(e,...t)=>L(e,r=>r&&t.forEach(o=>r.classList.add(o))),after:ke,afterMe:ke,andThen:(e,t,r=!1)=>{if(!t||!a(t,String,Node,Proxy))return Vt(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${t}]`),e;t=t?.isJQx?t.collection:a(t,Node)?y.virtual(t).collection:y.virtual(H(t)).collection;let[o,i,l]=r?[0,"before",t.concat(e.collection)]:[e.collection.length-1,"after",e.collection.concat(t)];return e[o][i](...t),e.collection=l,e},append:(e,...t)=>{if(!e.is.empty&&t.length){let r=e.length===1;for(let o of t){if(!o.isJQx&&P(o)){let i=o.trim(),d=!/^<(.+)[^>]+>$/m.test(i)?y.text(o):H(o);L(e,v=>v.append(r?d:U(d)))}re(o)&&L(e,i=>i.append(r?o:U(o))),o.isJQx&&!o.is.empty&&L(e,i=>o.collection.forEach(l=>i.append(r?l:U(l))))}}return e},appendTo:(e,t)=>(t.isJQx||(t=y(t)),t.append(e),e),attr:(e,t,r)=>{let o=e[0];if(!o)return e;if(!r&&P(t))return t=N(t),t==="class"?[...o?.classList].join(" "):o?.getAttribute(t);if(P(t)&&r)switch(t=N(t),!0){case t.startsWith("data-"):t={data:{[t.replace("data-","")]:r}};break;default:t={[t]:r}}return a(t,Object)&&!e.is.empty&&zt(o,t),e},before:Re,beforeMe:Re,clear:e=>L(e,Ie),closest:(e,t)=>{let r=P(t)?e[0].closest(t):null;return r?y(r):e},computedStyle:(e,t)=>e.first()&&getComputedStyle(e.first())[t],css:(e,t,r)=>L(e,o=>qt(o,t,r)),duplicate:(e,t=!1,r=document.body)=>{let o=e.toNodeList().map(l=>l.removeAttribute&&l.removeAttribute("id")||l),i=y.virtual(o);return t?i.toDOM(r):i},each:(e,t)=>L(e,t),empty:e=>L(e,Ie),find:(e,t)=>e.collection.length>0?[...e.first()?.querySelectorAll(t)]:[],find$:(e,t)=>e.collection.length>0?y(t,e):e,first:(e,t=!1)=>{if(e.collection.length>0)return t?e.single():e.collection[0]},first$:(e,t)=>e.single(t),getData:(e,t,r)=>e.first()&&e.first().dataset?.[t]||r,hasClass:(e,...t)=>{let r=e[0];return!r||!r.classList.length?!1:t.find(o=>r.classList.contains(o))&&!0||!1},hide:e=>L(e,t=>xe(t,{display:"none !important"})),html:(e,t,r)=>{if(t===void 0){let o=e.node;return o?.getHTML&&o.getHTML()||""}if(!e.isEmpty()){let o=H(`<div>${t.isJQx?t.HTML.get(!0):t}</div>`);if(!a(o,Comment))return L(e,l=>(r||(l.textContent=""),l.insertAdjacentHTML(y.at.end,o.getHTML())))}return e},htmlFor:(e,t,r="",o=!1)=>{if(t&&e.collection.length){if(!t||!P(r))return e;let i=e.find$(t);if(i.length<1)return e;let l=H(`<span>${r}</span>`);i.each(d=>{o||(d.textContent=""),d.insertAdjacentHTML(y.at.end,l?.getHTML())})}return e},isEmpty:e=>e.collection.length<1,nth$:(e,t)=>e.single(t),on:(e,t,...r)=>{if(e.collection.length&&a(t,String,Array)){if(t?.length<1||r.length<1)return e;let o=We(e);y.handle({type:t,selector:o,handlers:r})}return e},prepend:(e,...t)=>{if(!e.is.empty&&t){let r=e.length===1;for(let o of t){if(P(o)){o=o.trim();let l=!/^<(.+)[^>]+>$/m.test(o)?y.text(o):H(o);l=r?l:U(l),L(e,d=>d.prepend(l.cloneNode(!0)))}re(o)&&L(e,i=>i.prepend(r?o:U(o))),o.isJQx&&!o.is.empty&&(o.collection.length>1&&o.collection.reverse(),L(e,i=>L(o,l=>i.prepend(r?l:U(l)))),o.collection.reverse())}}return e},prependTo:(e,t)=>(t.isJQx||(t=y.virtual(t)),t.prepend(e),e),prop:(e,t,r)=>{if(a(t,String)&&!r)return t.startsWith("data")?e[0]?.dataset[t.slice(t.indexOf("-")+1)]:e[0]?.[t];let o=a(t,Object)?t:{[t]:r};for(let[i,l]of Object.entries(o)){if(i=i.trim(),l&&!Je(i)||!l)return!1;if(i.toLowerCase()==="id")return e[0].id=l;L(e,v=>{if(i.startsWith("data"))return v.dataset[i.slice(i.indexOf("-")+1)]=l;v[i]=l})}return e},remove:(e,t)=>{O(`remove ${j(e.HTML.get(1),40)}${t?` /w selector ${t}`:""}`);let r=i=>i.remove(),o=()=>e.collection=e.collection.filter(i=>document.documentElement.contains(i));if(t){let i=e.find$(t);return i.is.empty||(L(i,r),o()),e}return L(e,r),o(),e},rmAttr:(e,...t)=>{for(let r of t)e.node.removeAttribute(r);return e},removeClass:(e,...t)=>L(e,r=>{if(r)for(let o of t)r.classList.remove(o)}),renderTo:(e,t=document.body,r=y.insertPositions.end)=>(e.toDOM(t,r),e),replace:(e,t,r)=>{let o=e[0];return!t||!r||!a(r,HTMLElement)&&!r.isJQx?(console.error("JQx replace: invalid replacement value"),e):(r.isJQx&&(r=r[0]),a(r,NodeList)&&(r=r[0]),o&&t&&(t=a(t,String)?o.querySelectorAll(t):t.isJQx?t.collection:t,a(t,HTMLElement,NodeList,Array)&&a(r,HTMLElement)&&(a(t,HTMLElement)?[t]:[...t]).forEach(i=>i.replaceWith(r.cloneNode(!0)))),e)},replaceClass:(e,t,...r)=>L(e,o=>{o.classList.remove(t);for(let i of r)o.classList.add(i)}),replaceMe:(e,t)=>e.replaceWith(t),replaceWith:(e,t)=>(t=a(t,Element)?t:t.isJQx?t[0]:void 0,t&&(e[0].replaceWith(t),e=y.virtual(t)),e),setData:(e,t)=>L(e,r=>Be(r,t)),show:e=>L(e,t=>xe(t,{display:"revert-layer !important"})),single:(e,t)=>e.collection.length>0?a(t,String)?e.find$(t):a(t,Number)?y(e.collection[t]):y(e.collection[0]):e,style:(e,t,r)=>L(e,i=>{r&&a(t,String)&&(t={[t]:r||"none"}),xe(i,t)}),text:(e,t,r=!1)=>e.isEmpty()?e:a(t,String)?L(e,i=>i.textContent=r?i.textContent+t:t):e.first().textContent,toDOM:(e,t=document.body,r=T.BeforeEnd)=>(e.isVirtual&&(e.isVirtual=!1),e.collection=V(e.collection,t,r),e),toggleClass:(e,t)=>L(e,r=>r.classList.toggle(t)),toNodeList:e=>[...e.collection].map(t=>document.importNode(t,!0)),trigger:(e,t,r=Event,o={})=>{if(e.collection.length){let i=new r(t,{...o,bubbles:o.bubbles??!0});for(let l of e.collection)l.dispatchEvent(i)}return e},val:(e,t)=>{let r=e[0];return!r||!a(r,HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement)?e:t===void 0?r.value:(r.value=a(t,String)?t:"",e)}}};function qe(e){if(!e("#jqxPopup").isEmpty())return;e.dialog({id:"jqxPopup"},e.div({id:"jqxPopupContent"})).render,e.editCssRules(...Le);let[t,r]=[e("#jqxPopupContent"),e.node("#jqxPopup")],o={};return e.handle({type:"click, cancel",handlers:h,capture:!0}),Object.freeze({show:i,removeModal:S});function i(m){if(r.open)return;o={...m};let{content:p}=o;return e.IS(p,String,HTMLElement)||p?.isJQx?d():!0}function l(){return o.modal?C(o.warnMessage):v()}function d(){t.clear();let{content:m,modal:p,closeAfter:g}=o;p=e.IS(p,Boolean)?p:!1;let b=p?"":e.div({id:"closeHandleIcon"});t.append(b,e.IS(m,String)?e.div(m):m),r.showModal(),!p&&e.IS(g,Number)&&w(l,g)}function v(){if(r.close(o.returnValue),e.IS(o.callback,Function))return o.callback(o.returnValue);o={}}function S({callback:m,value:p}={}){o.returnValue=p,o.modal=!1,o.callback=m||o.callback,l()}function h(m){if(Object.keys(o).length<1||!r.open)return;o.activeTimer&&clearTimeout(o.activeTimer);let p=m.type==="cancel";return(p||m.target.closest("#closeHandleIcon")||!m.target.closest("#jqxPopupContent"))&&l(),p&&m.preventDefault(),document.activeElement.blur()}function w(m,p){e.IS(m,Function)&&e.IS(p,Number)&&p>0&&(o.activeTimer=setTimeout(m,p*1e3))}function C(m){if(!e.IS(m,String,HTMLElement,Proxy))return;let p=t.find$(".warn");switch(!0){case p.is.empty:p=e.div({class:"warn"},m);default:t.append(p.addClass("active")),w(()=>t.find$(".warn").removeClass("active"),2)}}}var oe={},Ut=["load","unload","scroll","focus","blur","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","loadstart","progress","error","abort","load","loadend","pointerenter","pointerleave","readystatechange"],ze=e=>!!Ut.find(t=>t===e);function _e(){let e=(r,o)=>i=>{let l=i.target?.closest?.(r);return l&&o(i,y(l))},t=(r,o,i,l,d)=>{if(oe[r]||(oe[r]=new Map),!(oe[r].has(o)||[...oe[r].values()].find(S=>S.name&&S.name===d))){addEventListener(r,o,{capture:i||ze(r),once:l});let S={name:d||o.name,capture:i||ze(r)};oe[r].set(o,S)}};return function(r){let{eventType:o,selector:i,callback:l,name:d,capture:v,once:S}=r;if(!(y.IS(o,String)||o?.length<1)||!y.IS(l,Function))return;v=y.IS(v,Boolean)?v:!1;let h=y.IS(i,String)?e(i,l):w=>l(w,w.target);t(o,h,v,S,d)}}var Gt={},{instanceMethods:Ve,instanceGetters:Ue,isCommentOrTextNode:Qe,isNode:re,isHtmlString:Ze,isArrayOfHtmlElements:Ye,isArrayOfHtmlStrings:Xe,ElemArray2HtmlString:Ke,input2Collection:et,setCollectionFromCssSelector:tt,addHandlerId:We,cssRuleEdit:we,addFn:Zt,elems4Docs:yo}=Yt();function Yt(){let e=K({createWithId:"JQxStylesheet"}),t=(f,x)=>r[f]=($,...n)=>x($,...n),r=ve.instanceExtensions,o=ve.factoryExtensions,i=f=>a(f,Comment,Text),l=f=>a(f,Text,HTMLElement,Comment),d=f=>a(f,Comment),v=f=>a(f,Text),S=f=>a(f,String)&&/^<|>$/.test(`${f}`.trim()),h=f=>a(f,Array)&&!f?.find(x=>!S(x)),w=f=>a(f,Array)&&!f?.find(x=>!l(x)),C=f=>f?.filter(x=>x).reduce((x,$)=>x.concat(d($)?`<!--${$.data}-->`:i($)?$.textContent:$.outerHTML),""),m=f=>f?a(f,Proxy)?[f.EL]:a(f,NodeList)?[...f]:l(f)?[f]:w(f)?f:f.isJQx?f.collection:void 0:[],p=(f,x,$)=>{let n=x!==document.body&&a(f,String)&&f.toLowerCase()!=="body"?x:document,s;try{$.collection=[...n.querySelectorAll(f)]}catch{s=`Invalid CSS querySelector. [${a(f,String)?f:"Nothing valid given!"}]`}return s??`CSS querySelector "${f}", output ${$.collection.length} element(s)`},g=f=>{let x=f.data.get("hid")||`HID${z()}`;return f.data.add({hid:x}),`[data-hid="${x}"]`},b=Object.entries(M.tagsRaw).filter(([,f])=>f).map(([f])=>f).sort((f,x)=>f.localeCompare(x));return{instanceMethods:r,instanceGetters:o,isCommentOrTextNode:i,isNode:l,isComment:d,isText:v,isHtmlString:S,isArrayOfHtmlElements:w,isArrayOfHtmlStrings:h,ElemArray2HtmlString:C,input2Collection:m,setCollectionFromCssSelector:p,addHandlerId:g,cssRuleEdit:e,addFn:t,elems4Docs:b}}function G(e){return new Proxy(e,{get:(t,r)=>er(t,r,e)})}function Xt(e,t){return(...r)=>a(e,Function)&&e(G(t),...r)}function Kt(e,t){return(...r)=>a(e,Function)&&e(G(t),...r)}function er(e,t,r){switch(!0){case a(t,Symbol):return e;case a(+t,Number):return e.collection?.[t]||void 0;case t in Ue:return Kt(Ue[t],r)();case t in Ve:return Xt(Ve[t],r);default:return e[t]}}function rt(e){let t=ar(e);for(let[r,o]of Object.entries(Object.getOwnPropertyDescriptors(t)))Object.defineProperty(e,r,o),Object.defineProperty(Gt,r,o);return e}function tr(e){return{allow:t=>{let r=/-/.test(t),o=r&&t;t=r?ee(t):t.toLowerCase(),M.allowTag(t),a(e[t],Function)||Object.defineProperties(e,Ee(t,!0,e,o))},prohibit:t=>{t=t.toLowerCase(),M.prohibitTag(t),a(e[t],Function)&&Object.defineProperties(e,Ee(t,!1,e))}}}function Ge(...e){if(e.length===1){let t=String(e.shift().trim());e=t.startsWith("!")?[t.slice(1,-1)]:t.split(",").map(r=>r.trim())}for(let t of e.map(r=>r.startsWith("!")?r.slice(1,-1):r))we(t,{removeRule:1})}function rr(e){return function(t,r,...o){return a(r,Function)&&(o.push(r),r=void 0),e({eventType:t,selector:r,callback:o})}}function or(e){return function(t){let{type:r,origin:o,selector:i,handlers:l,name:d,capture:v}=t,S=Oe(r);if(!a(l,Function,Array))return;l=a(l,Function)?[l]:l;let h={eventType:S,selector:i||o,capture:v,name:d},w=C=>a(C,Function)&&e({...h,callback:C});switch(!0){case(a(S,Array)&&S.length>0):for(let C of S){h.eventType=C;for(let m of l)w(m)}return;default:for(let C of l)w(C)}}}function nr(e){return function(t,r,o){r=r?.isJQx?r?.[0]:r,o=o&&Object.values(T).find(l=>o===l)?o:void 0;let i=e(t,document.createElement("br"));if(r&&!a(r,HTMLBRElement))for(let l of i.collection)o?r.insertAdjacentElement(o,l):r.append(l);return i}}function ir(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);for(let[i,l]of Object.entries(o))!(i in t)&&Object.defineProperty(t,i,l)}return t}function lr(e){console.error(`JQx: "${e}" not allowed, not rendered`)}function sr(e,t,r,o){return e=N(o||e.toLowerCase()),{get(){return(...i)=>t?r.virtual(te(pe[e](...i))):lr(e)},enumerable:!1,configurable:!0}}function Ee(e,t,r,o){e=e.toLowerCase();let i=sr(e,t,r,o);return o?{[o]:i,[ee(o)]:i}:{[e]:i,[e.toUpperCase()]:i}}function ar(e){return ir(Object.entries(M.tagsRaw).reduce(cr(e),{}),ur(e))}function cr(e){return function(t,[r,o]){return o&&Object.defineProperties(t,Ee(r,o,e)),t}}function ur(e){let t=(l,d)=>we(l,d),r=tr(e),o=_e(),i=or(o);return{debugLog:F,log:(...l)=>D("fromStatic",...l),insertPositions:T,get at(){return T},editCssRules:(...l)=>{for(let d of l)we(d)},editCssRule:t,get setStyle(){return t},delegate:rr(o),delegateCaptured:i,handle:i,virtual:nr(e),get fn(){return Zt},allowTag:r.allow,prohibitTag:r.prohibit,get lenient(){return M.allowUnknownHtmlTags},get IS(){return a},get Popup(){return e.activePopup||Object.defineProperty(e,"activePopup",{value:qe(e),enumerable:!1}),e.activePopup},popup:()=>e.Popup,createStyle:l=>K({createWithId:l||`jqx${z()}`}),editStylesheet:l=>K({createWithId:l||`jqx${z()}`}),removeCssRule:Ge,removeCssRules:Ge,text:(l,d=!1)=>d?e.comment(l):document.createTextNode(l),node:(l,d=document)=>d.querySelector(l,d),nodes:(l,d=document)=>[...d.querySelectorAll(l,d)]}}var y=rt(fr());function fr(){return function(r,o,i=T.BeforeEnd){if(r?.isJQx)return r;let l=a(o,HTMLBRElement);o=(!l&&o&&o.isJQx?o[0]:o)||document.body,i=i&&Object.values(T).find(p=>i===p)?i:void 0;let d=Ze(r),v=!d&&Xe(r),S=v||d,h={collection:et(r)??[],isVirtual:l,isJQx:!0},w=Ye(h.collection),C=`input => ${v?`"${j(r.join(", "),70)}"`:!S&&w?`element collection [${j(h.collection.map(p=>`${a(p,Comment,Text)?"Comment|Text @":""} ${p?.outerHTML||p?.textContent}`).join(", "),70)}]`:`"${j(r,70)}"`}`;if(h.collection.length&&w)return O(C),l||h.collection.forEach(p=>{o.contains(p)||V([p],o,i)}),G(h);if(S){if([r].flat().forEach(p=>h.collection.push(H(p))),h.collection.length>0){let p=h.collection.filter(g=>g?.dataset?.jqxcreationerror);h.collection=h.collection.filter(g=>!g?.dataset?.jqxcreationerror),O(`${C}`),O(`*Created ${h.isVirtual?"VIRTUAL ":""}[${j(Ke(h.collection)||"sanitized: no elements remaining",70)}]`),p.length&&console.error(`JQx: illegal html, not rendered: "${p.reduce((g,b)=>g.concat(`${b.textContent}
|
|
14
|
+
`)}function jt(e){return e.reduce((t,r)=>{let[o,i]=[r.slice(0,r.indexOf(":")).trim(),r.slice(r.indexOf(":")+1).trim().replace(/;$|;.+(?=\/*).+\/$/,"")];return o&&i?{...t,[o]:i}:t},{})}function Nt(e){return jt(Ht(e))}function Me(e,t){return e?.replace("::",":")===t?.replace("::",":")}var Mt=[...Array(26)].map((e,t)=>String.fromCharCode(t+65)).concat([...Array(26)].map((e,t)=>String.fromCharCode(t+97))).concat([...Array(10)].map((e,t)=>`${t}`)),ie=(e,t=2)=>`${e}`.padStart(t,"0"),Ot=(e,t=0)=>([e,t]=[Math.floor(e),Math.ceil(t)],Math.floor([...crypto.getRandomValues(new Uint32Array(1))].shift()/2**32*(e-t+1)+t)),P=function(e,t=1){return t=a(t,Number)&&t||1,a(e,String)&&e.length>=t},Oe=function(e){return e=a(e,String)&&/,/.test(e)?e.split(","):e,a(e,Array)?e.filter(t=>P(t)).map(t=>t.trim().toLowerCase()):a(e,String)&&e?.trim().toLowerCase()||""},Pt=e=>{let t=e.length;for(;t--;){let r=Ot(t);[e[t],e[r]]=[e[r],e[t]]}return e};var j=(e,t=120)=>`${e}`.trim().slice(0,t).replace(/>\s+</g,"><").replace(/</g,"<").replace(/\s{2,}/g," ").replace(/\n/g,"\\n")+(e.length>t?" …":"").trim(),N=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`).replace(/^-|-$/,""),It=([e,...t])=>`${e.toUpperCase()}${t.join("")}`,ee=e=>a(e,String)?e.toLowerCase().split("-").map((t,r)=>r&&`${It(t)}`||t).join(""):e,z=()=>`_${Pt(Mt).slice(0,8).join("")}`,le=(e,t=120)=>j(e,t).replace(/</g,"<"),q=()=>(e=>`[${ie(e.getHours())}:${ie(e.getMinutes())}:${ie(e.getSeconds())}.${ie(e.getMilliseconds(),3)}]`)(new Date);var _=e=>e.replace(/</g,"<");function Pe(){let e=function(l){if(!l)return;let d=l.style,v=getComputedStyle(l),S=[d.visibility,v.visibility].includes("hidden"),h=[d.display,v.display].includes("none"),w=l.offsetTop<0||l.offsetLeft+l.offsetWidth<0||l.offsetLeft>document.body.offsetWidth,C=+v.opacity==0||+(d.opacity||1)==0;return!(w||C||h||S)},r=function(l){return l.parentNode?!!y.nodes(":is(:read-write)",l?.parentNode)?.find(d=>d===l):!1},o=function(l){return l.parentNode?!!y.nodes(":is(:modal)",l?.parentNode)?.find(d=>d===l):!1},i={notInDOM:!0,writable:"n/a",modal:"n/a",empty:!0,open:"n/a",visible:"n/a"};return l=>{let d=l.node;return a(d,Node)?{get writable(){return r(d)},get modal(){return o(d)},get inDOM(){return d.isConnected},get open(){return d.open??!1},get visible(){return e(d)},get disabled(){return d.hasAttribute("readonly")||d.hasAttribute("disabled")},get empty(){return l.collection.length<1},get virtual(){return l.isVirtual}}:i}}var Rt=!0,se={data:/data-[\-\w.\p{L}]/ui,validURL:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,whiteSpace:/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,notAllowedValues:/javascript|injected|noreferrer|alert|DataURL/gi},kt=e=>{if(Rt&&Object.keys(e.removed).length){let t=Object.entries(e.removed).reduce((r,[o,i])=>[...r,`${_(o)} => ${i}`],[]).join("\\000A");F.log(`JQx HTML creation errors: ${F.isConsole?t:_(t)}`)}},Bt=function(e){let t=e.nodeName.toLowerCase(),r=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return/-/.test(t)&&!r.find(o=>o===t)||M.isAllowed(t)},te=e=>{let t={rawHTML:e?.parentElement?.getHTML()??"no html",removed:{}};return a(e,HTMLElement)&&[...e.childNodes].forEach(r=>{if(r?.children?.length&&te(r),r?.attributes){let i=a(r,SVGElement)?J.svg:J.html;[...(r??{attributes:[]}).attributes].forEach(l=>{let d=l.name.trim().toLowerCase(),v=l.value.trim().toLowerCase().replace(se.whiteSpace,""),S=d==="href"?!se.validURL.test(v):se.notAllowedValues.test(v),h=d.startsWith("data")?!se.data.test(d):!!i[d];if(S||h){let w=le(l.value||"none",60);w+=w.length===60?"...":"",t.removed[`${l.name}`]=`attribute/property (-value) not allowed, removed. Value: ${w}`,r.removeAttribute(l.name)}})}if(!(Bt(r)||r.constructor===CharacterData||r.constructor===Comment)){let i=(r?.outerHTML||r?.textContent).trim(),l=le(i,60)??"EMPTY";l+=l.length===60?"...":"",t.removed[`<${r.nodeName?.toLowerCase()}>`]=`not allowed, not rendered. Value: ${l}`,r.remove()}}),kt(t),e};var T=new Proxy({start:"afterbegin",afterbegin:"afterbegin",end:"beforeend",beforeend:"beforeend",before:"beforebegin",beforebegin:"beforebegin",after:"afterend",afterend:"afterend"},{get(e,t){return e[String(t).toLowerCase()]??e[t]}}),Jt=e=>{let t=document.createElement("div");return t.insertAdjacentHTML(T.end,e),t.childNodes.length?te(t):void 0},Qt=(e,t,r)=>a(e,Comment)?t.insertAdjacentHTML(r,`<!--${e.data}-->`):t.insertAdjacentText(r,e.data),V=(e=[],t=document.body,r=T.BeforeEnd)=>e.reduce((o,i)=>{let l=re(i)&&ge(i,t,r);return l?[...o,l]:o},[]),ge=(e,t=document.body,r=T.BeforeEnd)=>(t=t?.isJQx?t?.[0]:t,a(e,Comment,Text)?Qt(e,t,r):t.insertAdjacentElement(r,e)),H=e=>{if(a(e,Text,Comment))return e;let t=e?.trim(),r=t?.split(/<text>|<\/text>/i)??[];if(r?.length&&(r=r.length>1?r.filter(i=>i.length).shift():void 0),t.startsWith("<!--")&&t.endsWith("-->"))return document.createComment(e.replace(/<!--|-->$/g,""));if(r||!/^<(.+)[^>]+>/m.test(t))return document.createTextNode(r);let o=Jt(e);return o.childNodes.length<1?H(`<span data-jqxcreationerror="1">${j(e,60)}</span>`):o.children[0]};var L=(e,t)=>{let r=e.collection.filter(o=>!Qe(o));for(let o=0;o<r.length;o+=1)t(r[o],o);return e},Wt=Pe(),Ie=e=>e&&(e.textContent="");var U=e=>{let t=e.cloneNode(!0);return t.removeAttribute&&t.removeAttribute("id"),e.isConnected?e.remove():e=null,t},Be=(e,t)=>{if(e&&a(t,Object))for(let[r,o]of Object.entries(t))e.setAttribute(`data-${N(r)}`,o)},Re=(e,t)=>e.andThen(t,!0),ke=(e,t)=>e.andThen(t),Je=e=>e.startsWith("data")||J.html.find(t=>e.toLowerCase()===t),qt=(e,t,r)=>{r&&a(t,String)&&(t={[t]:r==="-"?"":r});let o;t.className&&(o=t.className,delete t.className),o=[...e.classList].find(l=>l.startsWith("JQxClass-")||o&&l===o)||o||`JQxClass-${z().slice(1)}`,y.editCssRule(`.${o}`,t),e.classList.add(o)},zt=(e,t)=>{if(e)for(let[r,o]of Object.entries(t)){if(r=N(r),r.startsWith("data"))return Be(e,o);a(o,String)&&Je(r)&&e.setAttribute(r,o.split(/[, ]/)?.join(" "))}},xe=(e,t)=>{if(a(t,Object))for(let[r,o]of Object.entries(t)){let i;/!important/i.test(o)&&(o=o.slice(0,o.indexOf("!")).trim(),i="important"),e.style.setProperty(N(r),o,i)}},_t={get(e,t){return e[ee(t)]||e[t]},enumerable:!1,configurable:!1},Vt=(...e)=>{F.log("\u2757"+e.map(t=>String(t)).join(", "))},Se=(e,t=0,r=!0)=>(e=e?.parentElement,t+=e?e[r?"scrollTop":"scrollLeft"]:0,e?Se(e,t,r):t),ve={factoryExtensions:{data:e=>({get all(){return new Proxy(e[0]?.dataset??{},_t)},set:(t={})=>{if(!e.is.empty&&a(t,Object))for(let[r,o]of Object.entries(t))e.setData({[r]:o});return e},get:(t,r)=>e.data.all[t]??r,add:(t={})=>{if(!e.is.empty&&a(t,Object))for(let[r,o]of Object.entries(t))e.setData({[r]:o});return e},remove:t=>(e[0]?.removeAttribute(`data-${N(t)}`),e)}),dimensions:e=>{if(e.is.empty)return{error:"[instance].dimensions: NO ELEMENTS"};let t=e[0],r=e.first()?.getBoundingClientRect().toJSON();return r.scrollTopDistance=Se(t,0),r.scrollLeftDistance=Se(t,0,!1),r},node:e=>e[0],HTML:e=>({get:(t,r)=>{if(e.is.empty)return"NO ELEMENTS IN COLLECTION";let o=t?e.outerHtml:e.html();return r?_(o):o},set:(t,r=!1,o=!1)=>{t=t.isJQx?t.HTML.get(1):t;let i=a(t,String);return t=i&&o?_(t):t,i&&(t||"").trim().length&&e.html(t,r),e},replace:(t,r=!1)=>e.HTML.set(t,!1,r),append:(t,r=!1)=>(t=a(t,HTMLElement)?y(t).HTML.get(1):t.isJQx?t.HTML.get(1):t,e.HTML.set(t,!0,r)),insert:(t,r=!1)=>(t=a(t,HTMLElement)?y(t).HTML.get(1):t.isJQx?t.HTML.get(1):t,e.HTML.set(t+e.HTML.get(),!1,r))}),is:e=>Wt(e),length:e=>e.collection.length,outerHtml:e=>(e.first()||{outerHTML:void 0}).outerHTML,parent:e=>{let t=y(e[0]?.parentNode);return t.is.empty?e:t},render:e=>(!e.is.empty&&e.toDOM()||y.log("[JQx.render]: empty collection"),e),Style:e=>({get computed(){return e.is.empty?{}:getComputedStyle(e[0])},inline:t=>e.style(t),inSheet:t=>e.css(t),valueOf:t=>e.is.empty?void 0:getComputedStyle(e[0])[N(t)],nwRule:t=>e.Style.byRule({rules:t}),byRule:({classes2Apply:t=[],rules:r=[]}={})=>{let i=a(r,String)&&!t.length?r.split("{")[0].trim():"";if(r=r&&a(r,String)?[r]:r,t=t&&a(t,String)?[t]:t,(r?.length||t?.length)&&(r?.length&&y.editCssRules(...r),t))for(let l of t)e.addClass(l);return i?.startsWith(".")&&e.addClass(i.slice(1)),i?.startsWith("#")&&!e.attr("id")&&e.prop({id:i.slice(1)}),e}})},instanceExtensions:{addClass:(e,...t)=>L(e,r=>r&&t.forEach(o=>r.classList.add(o))),after:ke,afterMe:ke,andThen:(e,t,r=!1)=>{if(!t||!a(t,String,Node,Proxy))return Vt(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${t}]`),e;t=t?.isJQx?t.collection:a(t,Node)?y.virtual(t).collection:y.virtual(H(t)).collection;let[o,i,l]=r?[0,"before",t.concat(e.collection)]:[e.collection.length-1,"after",e.collection.concat(t)];return e[o][i](...t),e.collection=l,e},append:(e,...t)=>{if(!e.is.empty&&t.length){let r=e.length===1;for(let o of t){if(!o.isJQx&&P(o)){let i=o.trim(),d=!/^<(.+)[^>]+>$/m.test(i)?y.text(o):H(o);L(e,v=>v.append(r?d:U(d)))}re(o)&&L(e,i=>i.append(r?o:U(o))),o.isJQx&&!o.is.empty&&L(e,i=>o.collection.forEach(l=>i.append(r?l:U(l))))}}return e},appendTo:(e,t)=>(t.isJQx||(t=y(t)),t.append(e),e),attr:(e,t,r)=>{let o=e[0];if(!o)return e;if(!r&&P(t))return t=N(t),t==="class"?[...o?.classList].join(" "):o?.getAttribute(t);if(P(t)&&r)switch(t=N(t),!0){case t.startsWith("data-"):t={data:{[t.replace("data-","")]:r}};break;default:t={[t]:r}}return a(t,Object)&&!e.is.empty&&zt(o,t),e},before:Re,beforeMe:Re,clear:e=>L(e,Ie),closest:(e,t)=>{let r=P(t)?e[0].closest(t):null;return r?y(r):e},computedStyle:(e,t)=>e.first()&&getComputedStyle(e.first())[t],css:(e,t,r)=>L(e,o=>qt(o,t,r)),duplicate:(e,t=!1,r=document.body)=>{let o=e.toNodeList().map(l=>l.removeAttribute&&l.removeAttribute("id")||l),i=y.virtual(o);return t?i.toDOM(r):i},each:(e,t)=>L(e,t),empty:e=>L(e,Ie),find:(e,t)=>e.collection.length>0?[...e.first()?.querySelectorAll(t)]:[],find$:(e,t)=>e.collection.length>0?y(t,e):e,first:(e,t=!1)=>{if(e.collection.length>0)return t?e.single():e.collection[0]},first$:(e,t)=>e.single(t),getData:(e,t,r)=>e.first()&&e.first().dataset?.[t]||r,hasClass:(e,...t)=>{let r=e[0];return!r||!r.classList.length?!1:t.find(o=>r.classList.contains(o))&&!0||!1},hide:e=>L(e,t=>xe(t,{display:"none !important"})),html:(e,t,r)=>{if(t===void 0){let o=e.node;return o?.getHTML&&o.getHTML()||""}if(!e.isEmpty()){let o=H(`<div>${t.isJQx?t.HTML.get(!0):t}</div>`);if(!a(o,Comment))return L(e,l=>(r||(l.textContent=""),l.insertAdjacentHTML(y.at.end,o.getHTML())))}return e},htmlFor:(e,t,r="",o=!1)=>{if(t&&e.collection.length){if(!t||!P(r))return e;let i=e.find$(t);if(i.length<1)return e;let l=H(`<span>${r}</span>`);i.each(d=>{o||(d.textContent=""),d.insertAdjacentHTML(y.at.end,l?.getHTML())})}return e},isEmpty:e=>e.collection.length<1,nth$:(e,t)=>e.single(t),on:(e,t,...r)=>{if(e.collection.length&&a(t,String,Array)){if(t?.length<1||r.length<1)return e;let o=We(e);y.handle({type:t,selector:o,handlers:r})}return e},prepend:(e,...t)=>{if(!e.is.empty&&t){let r=e.length===1;for(let o of t){if(P(o)){o=o.trim();let l=!/^<(.+)[^>]+>$/m.test(o)?y.text(o):H(o);l=r?l:U(l),L(e,d=>d.prepend(l.cloneNode(!0)))}re(o)&&L(e,i=>i.prepend(r?o:U(o))),o.isJQx&&!o.is.empty&&(o.collection.length>1&&o.collection.reverse(),L(e,i=>L(o,l=>i.prepend(r?l:U(l)))),o.collection.reverse())}}return e},prependTo:(e,t)=>(t.isJQx||(t=y.virtual(t)),t.prepend(e),e),prop:(e,t,r)=>{if(a(t,String)&&!r)return t.startsWith("data")?e[0]?.dataset[t.slice(t.indexOf("-")+1)]:e[0]?.[t];let o=a(t,Object)?t:{[t]:r};for(let[i,l]of Object.entries(o)){if(i=i.trim(),l&&!Je(i)||!l)return!1;if(i.toLowerCase()==="id")return e[0].id=l;L(e,v=>{if(i.startsWith("data"))return v.dataset[i.slice(i.indexOf("-")+1)]=l;v[i]=l})}return e},remove:(e,t)=>{O(`remove ${j(e.HTML.get(1),40)}${t?` /w selector ${t}`:""}`);let r=i=>i.remove(),o=()=>e.collection=e.collection.filter(i=>document.documentElement.contains(i));if(t){let i=e.find$(t);return i.is.empty||(L(i,r),o()),e}return L(e,r),o(),e},rmAttr:(e,...t)=>{for(let r of t)e.node.removeAttribute(r);return e},removeClass:(e,...t)=>L(e,r=>{if(r)for(let o of t)r.classList.remove(o)}),renderTo:(e,t=document.body,r=y.insertPositions.end)=>(e.toDOM(t,r),e),replace:(e,t,r)=>{let o=e[0];return!t||!r||!a(r,HTMLElement)&&!r.isJQx?(console.error("JQx replace: invalid replacement value"),e):(r.isJQx&&(r=r[0]),a(r,NodeList)&&(r=r[0]),o&&t&&(t=a(t,String)?o.querySelectorAll(t):t.isJQx?t.collection:t,a(t,HTMLElement,NodeList,Array)&&a(r,HTMLElement)&&(a(t,HTMLElement)?[t]:[...t]).forEach(i=>i.replaceWith(r.cloneNode(!0)))),e)},replaceClass:(e,t,...r)=>L(e,o=>{o.classList.remove(t);for(let i of r)o.classList.add(i)}),replaceMe:(e,t)=>e.replaceWith(t),replaceWith:(e,t)=>(t=a(t,Element)?t:t.isJQx?t[0]:void 0,t&&(e[0].replaceWith(t),e=y.virtual(t)),e),setData:(e,t)=>L(e,r=>Be(r,t)),show:e=>L(e,t=>xe(t,{display:"revert-layer !important"})),single:(e,t)=>e.collection.length>0?a(t,String)?e.find$(t):a(t,Number)?y(e.collection[t]):y(e.collection[0]):e,style:(e,t,r)=>L(e,i=>{r&&a(t,String)&&(t={[t]:r||"none"}),xe(i,t)}),text:(e,t,r=!1)=>e.isEmpty()?e:a(t,String)?L(e,i=>i.textContent=r?i.textContent+t:t):e.first().textContent,toDOM:(e,t=document.body,r=T.BeforeEnd)=>(e.isVirtual&&(e.isVirtual=!1),e.collection=V(e.collection,t,r),e),toggleClass:(e,t)=>L(e,r=>r.classList.toggle(t)),toNodeList:e=>[...e.collection].map(t=>document.importNode(t,!0)),trigger:(e,t,r=Event,o={})=>{if(e.collection.length){let i=new r(t,{...o,bubbles:o.bubbles??!0});for(let l of e.collection)l.dispatchEvent(i)}return e},val:(e,t)=>{let r=e[0];return!r||!a(r,HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement)?e:t===void 0?r.value:(r.value=a(t,String)?t:"",e)}}};function qe(e){if(!e("#jqxPopup").isEmpty())return;e.dialog({id:"jqxPopup"},e.div({id:"jqxPopupContent"})).render,e.editCssRules(...Le);let[t,r]=[e("#jqxPopupContent"),e.node("#jqxPopup")],o={};return e.handle({type:"click, cancel",handlers:h,capture:!0}),Object.freeze({show:i,removeModal:S});function i(m){if(r.open)return;o={...m};let{content:p}=o;return e.IS(p,String,HTMLElement)||p?.isJQx?d():!0}function l(){return o.modal?C(o.warnMessage):v()}function d(){t.clear();let{content:m,modal:p,closeAfter:g}=o;p=e.IS(p,Boolean)?p:!1;let b=p?"":e.div({id:"closeHandleIcon"});t.append(b,e.IS(m,String)?e.div(m):m),r.showModal(),!p&&e.IS(g,Number)&&w(l,g)}function v(){if(r.close(o.returnValue),e.IS(o.callback,Function))return o.callback(o.returnValue);o={}}function S({callback:m,value:p}={}){o.returnValue=p,o.modal=!1,o.callback=m||o.callback,l()}function h(m){if(Object.keys(o).length<1||!r.open)return;o.activeTimer&&clearTimeout(o.activeTimer);let p=m.type==="cancel";return(p||m.target.closest("#closeHandleIcon")||!m.target.closest("#jqxPopupContent"))&&l(),p&&m.preventDefault(),document.activeElement.blur()}function w(m,p){e.IS(m,Function)&&e.IS(p,Number)&&p>0&&(o.activeTimer=setTimeout(m,p*1e3))}function C(m){if(!e.IS(m,String,HTMLElement,Proxy))return;let p=t.find$(".warn");switch(!0){case p.is.empty:p=e.div({class:"warn"},m);default:t.append(p.addClass("active")),w(()=>t.find$(".warn").removeClass("active"),2)}}}var oe={},Ut=["load","unload","scroll","focus","blur","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","loadstart","progress","error","abort","load","loadend","pointerenter","pointerleave","readystatechange"],ze=e=>!!Ut.find(t=>t===e);function _e(){let e=(r,o)=>i=>{let l=i.target?.closest?.(r);return l&&o(i,y(l))},t=(r,o,i,l,d)=>{if(oe[r]||(oe[r]=new Map),!(oe[r].has(o)||[...oe[r].values()].find(S=>S.name&&S.name===d))){addEventListener(r,o,{capture:i||ze(r),once:l});let S={name:d||o.name,capture:i||ze(r)};oe[r].set(o,S)}};return function(r){let{eventType:o,selector:i,callback:l,name:d,capture:v,once:S}=r;if(!(y.IS(o,String)||o?.length<1)||!y.IS(l,Function))return;v=y.IS(v,Boolean)?v:!1;let h=y.IS(i,String)?e(i,l):w=>l(w,w.target);t(o,h,v,S,d)}}var Gt={},{instanceMethods:Ve,instanceGetters:Ue,isCommentOrTextNode:Qe,isNode:re,isHtmlString:Ze,isArrayOfHtmlElements:Ye,isArrayOfHtmlStrings:Xe,ElemArray2HtmlString:Ke,input2Collection:et,setCollectionFromCssSelector:tt,addHandlerId:We,cssRuleEdit:we,addFn:Zt,elems4Docs:yo}=Yt();function Yt(){let e=K({createWithId:"JQxStylesheet"}),t=(f,x)=>r[f]=($,...n)=>x($,...n),r=ve.instanceExtensions,o=ve.factoryExtensions,i=f=>a(f,Comment,Text),l=f=>a(f,Text,HTMLElement,Comment),d=f=>a(f,Comment),v=f=>a(f,Text),S=f=>a(f,String)&&/^<|>$/.test(`${f}`.trim()),h=f=>a(f,Array)&&!f?.find(x=>!S(x)),w=f=>a(f,Array)&&!f?.find(x=>!l(x)),C=f=>f?.filter(x=>x).reduce((x,$)=>x.concat(d($)?`<!--${$.data}-->`:i($)?$.textContent:$.outerHTML),""),m=f=>f?a(f,Proxy)?[f.EL]:a(f,NodeList)?[...f]:l(f)?[f]:w(f)?f:f.isJQx?f.collection:void 0:[],p=(f,x,$)=>{let n=x!==document.body&&a(f,String)&&f.toLowerCase()!=="body"?x:document,s;try{$.collection=[...n.querySelectorAll(f)]}catch{s=`Invalid CSS querySelector. [${a(f,String)?f:"Nothing valid given!"}]`}return s??`CSS querySelector "${f}", output ${$.collection.length} element(s)`},g=f=>{let x=f.data.get("hid")||`HID${z()}`;return f.data.add({hid:x}),`[data-hid="${x}"]`},b=Object.entries(M.tagsRaw).filter(([,f])=>f).map(([f])=>f).sort((f,x)=>f.localeCompare(x));return{instanceMethods:r,instanceGetters:o,isCommentOrTextNode:i,isNode:l,isComment:d,isText:v,isHtmlString:S,isArrayOfHtmlElements:w,isArrayOfHtmlStrings:h,ElemArray2HtmlString:C,input2Collection:m,setCollectionFromCssSelector:p,addHandlerId:g,cssRuleEdit:e,addFn:t,elems4Docs:b}}function G(e){return new Proxy(e,{get:(t,r)=>er(t,r,e)})}function Xt(e,t){return(...r)=>a(e,Function)&&e(G(t),...r)}function Kt(e,t){return(...r)=>a(e,Function)&&e(G(t),...r)}function er(e,t,r){switch(!0){case a(t,Symbol):return e;case a(+t,Number):return e.collection?.[t]||void 0;case t in Ue:return Kt(Ue[t],r)();case t in Ve:return Xt(Ve[t],r);default:return e[t]}}function rt(e){let t=lr(e);for(let[r,o]of Object.entries(Object.getOwnPropertyDescriptors(t)))Object.defineProperty(e,r,o),Object.defineProperty(Gt,r,o);return e}function tr(e){return{allow:t=>{let r=/-/.test(t),o=r&&t;t=r?ee(t):t.toLowerCase(),M.allowTag(t),a(e[t],Function)||Object.defineProperties(e,Ee(t,!0,e,o))},prohibit:t=>{t=t.toLowerCase(),M.prohibitTag(t),a(e[t],Function)&&Object.defineProperties(e,Ee(t,!1,e))}}}function Ge(...e){if(e.length===1){let t=String(e.shift().trim());e=t.startsWith("!")?[t.slice(1,-1)]:t.split(",").map(r=>r.trim())}for(let t of e.map(r=>r.startsWith("!")?r.slice(1,-1):r))we(t,{removeRule:1})}function rr(e){return function(t,r,o){r=r?.isJQx?r?.[0]:r,o=o&&Object.values(T).find(l=>o===l)?o:void 0;let i=e(t,document.createElement("br"));if(r&&!a(r,HTMLBRElement))for(let l of i.collection)o?r.insertAdjacentElement(o,l):r.append(l);return i}}function or(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);for(let[i,l]of Object.entries(o))!(i in t)&&Object.defineProperty(t,i,l)}return t}function nr(e){console.error(`JQx: "${e}" not allowed, not rendered`)}function ir(e,t,r,o){return e=N(o||e.toLowerCase()),{get(){return(...i)=>t?r.virtual(te(pe[e](...i))):nr(e)},enumerable:!1,configurable:!0}}function Ee(e,t,r,o){e=e.toLowerCase();let i=ir(e,t,r,o);return o?{[o]:i,[ee(o)]:i}:{[e]:i,[e.toUpperCase()]:i}}function lr(e){return or(Object.entries(M.tagsRaw).reduce(sr(e),{}),ur(e))}function sr(e){return function(t,[r,o]){return o&&Object.defineProperties(t,Ee(r,o,e)),t}}function ar(e){return function(t,r,...o){a(r,Function)&&(o.push(r),r=void 0),e({type:t,selector:r,handlers:o})}}function cr(e){return function(t){let{type:r,origin:o,selector:i,handlers:l,name:d,capture:v}=t,S=Oe(r);if(!a(l,Function,Array))return;l=a(l,Function)?[l]:l;let h={eventType:S,selector:i||o,capture:v,name:d},w=C=>a(C,Function)&&e({...h,callback:C});switch(!0){case(a(S,Array)&&S.length>0):for(let C of S){h.eventType=C;for(let m of l)w(m)}return;default:for(let C of l)w(C)}}}function ur(e){let t=(l,d)=>we(l,d),r=tr(e),o=_e(),i=cr(o);return{debugLog:F,log:(...l)=>D("fromStatic",...l),insertPositions:T,get at(){return T},editCssRules:(...l)=>{for(let d of l)we(d)},editCssRule:t,get setStyle(){return t},delegate:ar(i),delegateCaptured:i,handle:i,virtual:rr(e),get fn(){return Zt},allowTag:r.allow,prohibitTag:r.prohibit,get lenient(){return M.allowUnknownHtmlTags},get IS(){return a},get Popup(){return e.activePopup||Object.defineProperty(e,"activePopup",{value:qe(e),enumerable:!1}),e.activePopup},popup:()=>e.Popup,createStyle:l=>K({createWithId:l||`jqx${z()}`}),editStylesheet:l=>K({createWithId:l||`jqx${z()}`}),removeCssRule:Ge,removeCssRules:Ge,text:(l,d=!1)=>d?e.comment(l):document.createTextNode(l),node:(l,d=document)=>d.querySelector(l,d),nodes:(l,d=document)=>[...d.querySelectorAll(l,d)]}}var y=rt(fr());function fr(){return function(r,o,i=T.BeforeEnd){if(r?.isJQx)return r;let l=a(o,HTMLBRElement);o=(!l&&o&&o.isJQx?o[0]:o)||document.body,i=i&&Object.values(T).find(p=>i===p)?i:void 0;let d=Ze(r),v=!d&&Xe(r),S=v||d,h={collection:et(r)??[],isVirtual:l,isJQx:!0},w=Ye(h.collection),C=`input => ${v?`"${j(r.join(", "),70)}"`:!S&&w?`element collection [${j(h.collection.map(p=>`${a(p,Comment,Text)?"Comment|Text @":""} ${p?.outerHTML||p?.textContent}`).join(", "),70)}]`:`"${j(r,70)}"`}`;if(h.collection.length&&w)return O(C),l||h.collection.forEach(p=>{o.contains(p)||V([p],o,i)}),G(h);if(S){if([r].flat().forEach(p=>h.collection.push(H(p))),h.collection.length>0){let p=h.collection.filter(g=>g?.dataset?.jqxcreationerror);h.collection=h.collection.filter(g=>!g?.dataset?.jqxcreationerror),O(`${C}`),O(`*Created ${h.isVirtual?"VIRTUAL ":""}[${j(Ke(h.collection)||"sanitized: no elements remaining",70)}]`),p.length&&console.error(`JQx: illegal html, not rendered: "${p.reduce((g,b)=>g.concat(`${b.textContent}
|
|
15
15
|
`),"").trim()}"`),h.isVirtual||V(h.collection,o,i)}return G(h)}let m=tt(r,o,h);return O(`input => ${m}`),G(h)}}export{y as default};
|
package/package.json
CHANGED
package/src/HandlerFactory.js
CHANGED
|
@@ -29,7 +29,9 @@ export default function() {
|
|
|
29
29
|
let {eventType, selector, callback, name, capture, once} = spec;
|
|
30
30
|
if (!(jqx.IS(eventType, String) || eventType?.length < 1) || !jqx.IS(callback, Function)) { return; }
|
|
31
31
|
capture = jqx.IS(capture, Boolean) ? capture : false;
|
|
32
|
-
const handler = !jqx.IS(selector, String)
|
|
32
|
+
const handler = !jqx.IS(selector, String)
|
|
33
|
+
? evt => callback(evt, evt.target)
|
|
34
|
+
: wrapHandlerFunction(selector, callback);
|
|
33
35
|
addAndStoreListener(eventType, handler, capture, once, name);
|
|
34
36
|
};
|
|
35
37
|
};
|
|
@@ -132,41 +132,6 @@ function cssRemove(...rules) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
function delegateFactory(handle) {
|
|
136
|
-
return function(type, origin, ...eventHandlers) {
|
|
137
|
-
if (IS(origin, Function)) {
|
|
138
|
-
eventHandlers.push(origin);
|
|
139
|
-
origin = undefined;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return handle({eventType: type, selector: origin, callback: eventHandlers})
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function delegateCaptureFactory(handle) {
|
|
147
|
-
return function(spec) {
|
|
148
|
-
let {type, origin, selector, handlers, name, capture} = spec;
|
|
149
|
-
const typesResolved = resolveEventTypeParameter(type);
|
|
150
|
-
|
|
151
|
-
if (!IS(handlers, Function, Array)) { return; }
|
|
152
|
-
|
|
153
|
-
handlers = IS(handlers, Function) ? [handlers] : handlers;
|
|
154
|
-
const params = {eventType: typesResolved, selector: selector || origin, capture, name};
|
|
155
|
-
const doHandle = handler => IS(handler, Function) && handle({...params, callback: handler});
|
|
156
|
-
|
|
157
|
-
switch(true) {
|
|
158
|
-
case IS(typesResolved, Array) && typesResolved.length > 0:
|
|
159
|
-
for (const type of typesResolved) {
|
|
160
|
-
params.eventType = type;
|
|
161
|
-
for (const handler of handlers) { doHandle(handler); }
|
|
162
|
-
}
|
|
163
|
-
return;
|
|
164
|
-
default:
|
|
165
|
-
for (const handler of handlers) { doHandle(handler); }
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
135
|
function virtualFactory(jqx) {
|
|
171
136
|
return function(html, root, position) {
|
|
172
137
|
root = root?.isJQx ? root?.[0] : root;
|
|
@@ -236,6 +201,42 @@ function staticTagsLambda(jqx) {
|
|
|
236
201
|
}
|
|
237
202
|
}
|
|
238
203
|
|
|
204
|
+
function delegateFactory(listen) {
|
|
205
|
+
return function(type, origin, ...eventHandlers) {
|
|
206
|
+
|
|
207
|
+
if (IS(origin, Function)) {
|
|
208
|
+
eventHandlers.push(origin);
|
|
209
|
+
origin = undefined;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
listen({type, selector: origin, handlers: eventHandlers});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function delegateCaptureFactory(listen) {
|
|
217
|
+
return function(spec) {
|
|
218
|
+
let {type, origin, selector, handlers, name, capture} = spec;
|
|
219
|
+
const typesResolved = resolveEventTypeParameter(type);
|
|
220
|
+
|
|
221
|
+
if (!IS(handlers, Function, Array)) { return; }
|
|
222
|
+
|
|
223
|
+
handlers = IS(handlers, Function) ? [handlers] : handlers;
|
|
224
|
+
const params = {eventType: typesResolved, selector: selector || origin, capture, name};
|
|
225
|
+
const doHandle = handler => IS(handler, Function) && listen({...params, callback: handler});
|
|
226
|
+
|
|
227
|
+
switch(true) {
|
|
228
|
+
case IS(typesResolved, Array) && typesResolved.length > 0:
|
|
229
|
+
for (const type of typesResolved) {
|
|
230
|
+
params.eventType = type;
|
|
231
|
+
for (const handler of handlers) { doHandle(handler); }
|
|
232
|
+
}
|
|
233
|
+
return;
|
|
234
|
+
default:
|
|
235
|
+
for (const handler of handlers) { doHandle(handler); }
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
239
240
|
function staticMethodsFactory(jqx) {
|
|
240
241
|
const editCssRule = (ruleOrSelector, ruleObject) => cssRuleEdit(ruleOrSelector, ruleObject);
|
|
241
242
|
const allowProhibit = allowances(jqx);
|
|
@@ -249,7 +250,7 @@ function staticMethodsFactory(jqx) {
|
|
|
249
250
|
editCssRules: (...rules) => { for (const rule of rules) { cssRuleEdit(rule); } },
|
|
250
251
|
editCssRule,
|
|
251
252
|
get setStyle() { /*deprecated*/return editCssRule; },
|
|
252
|
-
delegate: delegateFactory(
|
|
253
|
+
delegate: delegateFactory(capturedHandling),
|
|
253
254
|
delegateCaptured: capturedHandling,
|
|
254
255
|
handle: capturedHandling,
|
|
255
256
|
virtual: virtualFactory(jqx),
|
package/src/Utilities.js
CHANGED
|
@@ -19,7 +19,7 @@ const resolveEventTypeParameter = function(maybeTypes) {
|
|
|
19
19
|
maybeTypes = IS(maybeTypes, String) && /,/.test(maybeTypes) ? maybeTypes.split(`,`) : maybeTypes;
|
|
20
20
|
return IS(maybeTypes, Array)
|
|
21
21
|
? maybeTypes.filter(t => isNonEmptyString(t)).map(t => t.trim().toLowerCase())
|
|
22
|
-
: maybeTypes?.trim().toLowerCase() || ``;
|
|
22
|
+
: IS(maybeTypes, String) && maybeTypes?.trim().toLowerCase() || ``;
|
|
23
23
|
};
|
|
24
24
|
const shuffle = array => {
|
|
25
25
|
let i = array.length;
|