@gramlot/gramlot 0.3.33 → 0.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/audio/__init__.py +1 -1
- package/dist/components/audio/assets/collection.js +2 -2
- package/dist/components/audio/assets/index.js +1 -1
- package/dist/components/charts/__init__.py +2 -2
- package/dist/components/charts/assets/collection.js +10 -44
- package/dist/components/charts/assets/index.js +1 -1
- package/dist/components/charts/assets/modules/chunk-USZCUBTC.js +1 -0
- package/dist/components/charts/assets/modules/echarts-gl.min-N6L67H2M.js +4282 -0
- package/dist/components/charts/assets/modules/echarts.esm.min-VHLRZDVQ.js +61 -0
- package/dist/components/charts/assets/modules/{plotly.min-4LB7HE7P.js → plotly.min-SSDU2DOH.js} +1 -1
- package/dist/components/charts/assets/modules/{uPlot.esm-5JJNHHRF.js → uPlot.esm-Q2UYUQHJ.js} +1 -1
- package/dist/components/charts/assets/modules/{uPlot.min-N3E3FA74.js → uPlot.min-XXHNQFXH.js} +1 -1
- package/dist/components/charts/assets/modules/{vega.module-2QCOVQ3A.js → vega.module-Y5CWNSZO.js} +1 -1
- package/dist/components/chat/__init__.py +1 -1
- package/dist/components/chat/assets/collection.js +3 -3
- package/dist/components/chat/assets/index.js +1 -1
- package/dist/components/drawing/__init__.py +1 -1
- package/dist/components/drawing/assets/collection.js +3 -24
- package/dist/components/drawing/assets/index.js +1 -1
- package/dist/components/editors/__init__.py +2 -2
- package/dist/components/editors/assets/collection.js +2 -47
- package/dist/components/editors/assets/index.js +1 -1
- package/dist/components/editors/assets/modules/{jodit-engine-MTSA4GZ3.js → jodit-engine-CXRSFV47.js} +6 -6
- package/dist/components/grid/__init__.py +2 -2
- package/dist/components/grid/assets/collection.js +6 -28
- package/dist/components/grid/assets/index.js +1 -1
- package/dist/components/grid/assets/modules/{browser-LVJHKBBV.js → browser-Y2BRNI3P.js} +1 -1
- package/dist/components/grid/assets/modules/chunk-BLMUM44K.js +1 -0
- package/dist/components/grouplets/__init__.py +1 -1
- package/dist/components/grouplets/assets/collection.js +3 -3
- package/dist/components/grouplets/assets/index.js +1 -1
- package/dist/components/inputs/__init__.py +1 -1
- package/dist/components/inputs/assets/collection.js +8 -65
- package/dist/components/inputs/assets/index.js +1 -1
- package/dist/components/layout/__init__.py +1 -1
- package/dist/components/layout/assets/collection.js +9 -30
- package/dist/components/layout/assets/index.js +1 -1
- package/dist/components/selection_trial/__init__.py +1 -1
- package/dist/components/selection_trial/assets/collection.js +3 -3
- package/dist/components/selection_trial/assets/index.js +1 -1
- package/dist/components/tree/__init__.py +1 -1
- package/dist/components/tree/assets/collection.js +6 -27
- package/dist/components/tree/assets/index.js +1 -1
- package/dist/components/typst/__init__.py +1 -1
- package/dist/components/typst/assets/collection.js +3 -3
- package/dist/components/typst/assets/index.js +1 -1
- package/dist/components/uploads/__init__.py +1 -1
- package/dist/components/uploads/assets/collection.js +3 -30
- package/dist/components/uploads/assets/index.js +1 -1
- package/dist/components/vizabi/__init__.py +1 -1
- package/dist/components/vizabi/assets/collection.js +3 -21
- package/dist/components/vizabi/assets/index.js +1 -1
- package/dist/gramlot.js +1577 -49
- package/dist/gramlot.min.js +49 -48
- package/dist/libraries.json +126 -0
- package/dist/runtime-notices.json +4 -0
- package/dist/standard-collections.js +1 -1
- package/package.json +2 -2
- package/src/components/chart-engines/echarts.js +10 -4
- package/src/components/chart-engines/plotly.js +3 -2
- package/src/components/chart-engines/uplot.js +5 -3
- package/src/components/chart-engines/vega.js +2 -1
- package/src/components/chart-gauge.js +7 -3
- package/src/components/chart-renderer.js +1 -1
- package/src/components/code-mirror.js +2 -1
- package/src/components/grid-tools.js +2 -1
- package/src/components/html-editor.js +2 -1
- package/src/components/markdown-editor.js +2 -1
- package/src/components/typst-preview.js +2 -1
- package/src/index.d.ts +16 -0
- package/src/index.js +5 -0
- package/src/libraries.js +83 -0
- package/src/server/gramlot-server.d.ts +8 -0
- package/src/server/gramlot-server.js +40 -4
- package/src/shared-modules.js +79 -0
- package/dist/components/charts/assets/modules/chunk-2CCTLZE7.js +0 -76
- package/dist/components/charts/assets/modules/chunk-RMRBEYTI.js +0 -1
- package/dist/components/charts/assets/modules/echarts-gl-CXVTZA6G.js +0 -4409
- package/dist/components/grid/assets/modules/chunk-RMRBEYTI.js +0 -1
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
import{a as Ge,b as Ts,c as Jt,d as Ns}from"./modules/chunk-RMRBEYTI.js";var ht=Ge(oe=>{"use strict";function Zu(r,e,t){if(t===void 0&&(t=Array.prototype),r&&typeof t.find=="function")return t.find.call(r,e);for(var n=0;n<r.length;n++)if(ft(r,n)){var i=r[n];if(e.call(void 0,i,n,r))return i}}function Tt(r,e){return e===void 0&&(e=Object),e&&typeof e.getOwnPropertyDescriptors=="function"&&(r=e.create(null,e.getOwnPropertyDescriptors(r))),e&&typeof e.freeze=="function"?e.freeze(r):r}function ft(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Ku(r,e){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var t in e)ft(e,t)&&(r[t]=e[t]);return r}var ao=Tt({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function Ju(r){return ft(ao,r.toLowerCase())}var lo=Tt({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Qu(r){return ft(lo,r.toLowerCase())}var or=Tt({script:!1,style:!1,textarea:!0,title:!0});function ec(r){var e=r.toLowerCase();return ft(or,e)&&!or[e]}function tc(r){var e=r.toLowerCase();return ft(or,e)&&or[e]}function uo(r){return r===ar.HTML}function rc(r){return uo(r)||r===ar.XML_XHTML_APPLICATION}var ar=Tt({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),nc=Object.keys(ar).map(function(r){return ar[r]});function ic(r){return nc.indexOf(r)>-1}var sc=Tt({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});oe.assign=Ku;oe.find=Zu;oe.freeze=Tt;oe.HTML_BOOLEAN_ATTRIBUTES=ao;oe.HTML_RAW_TEXT_ELEMENTS=or;oe.HTML_VOID_ELEMENTS=lo;oe.hasDefaultHTMLNamespace=rc;oe.hasOwn=ft;oe.isHTMLBooleanAttribute=Ju;oe.isHTMLRawTextElement=ec;oe.isHTMLEscapableRawTextElement=tc;oe.isHTMLMimeType=uo;oe.isHTMLVoidElement=Qu;oe.isValidMimeType=ic;oe.MIME_TYPE=ar;oe.NAMESPACE=sc});var fr=Ge(dr=>{"use strict";var oc=ht();function fo(r,e){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:e}})}var ur=oc.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),ho=Object.keys(ur);function po(r){return typeof r=="number"&&r>=1&&r<=25}function ac(r){return typeof r=="string"&&r.substring(r.length-ur.Error.length)===ur.Error}function cr(r,e){po(r)?(this.name=ho[r],this.message=e||""):(this.message=r,this.name=ac(e)?e:ur.Error),Error.captureStackTrace&&Error.captureStackTrace(this,cr)}fo(cr,!0);Object.defineProperties(cr.prototype,{code:{enumerable:!0,get:function(){var r=ho.indexOf(this.name);return po(r)?r:0}}});var mo={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},vi=Object.entries(mo);for(lr=0;lr<vi.length;lr++)co=vi[lr][0],cr[co]=vi[lr][1];var co,lr;function ki(r,e,t){this.message=r,this.locator=e,this.cause=t,Error.captureStackTrace&&Error.captureStackTrace(this,ki)}fo(ki);dr.DOMException=cr;dr.DOMExceptionName=ur;dr.ExceptionCode=mo;dr.ParseError=ki});var Si=Ge(S=>{"use strict";function vo(r){try{typeof r!="function"&&(r=RegExp);var e=new r("\u{1D306}","u").exec("\u{1D306}");return!!e&&e[0].length===2}catch{}return!1}var Ct=vo();function Qe(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function Nt(r,e){if(r.source[0]!=="[")throw new Error("/"+r.source+"/ can not be used with chars_without");if(!e||typeof e!="string")throw new Error(JSON.stringify(e)+" is not a valid search");if(r.source.indexOf(e)===-1)throw new Error('"'+e+'" is not is /'+r.source+"/");if(e==="-"&&r.source.indexOf(e)!==1)throw new Error('"'+e+'" is not at the first postion of /'+r.source+"/");return new RegExp(r.source.replace(e,""),Ct?"u":"")}function B(r){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var n=typeof t=="string";if(n&&e===void 0&&t==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return n?t:t.source}).join(""),Ct?"u":"")}function D(r){if(arguments.length===0)throw new Error("no parameters provided");return B.apply(D,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var lc="\uFFFD",et=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Ct&&(et=B("[",Qe(et),"\\u{10000}-\\u{10FFFF}","]"));var uc=new RegExp("[^"+Qe(et)+"]",Ct?"u":""),un=/[\x20\x09\x0D\x0A]/,cc=Qe(un),P=B(un,"+"),V=B(un,"*"),hr=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Ct&&(hr=B("[",Qe(hr),"\\u{10000}-\\u{10FFFF}","]"));var dc=Qe(hr),Ai=B("[",dc,Qe(/[-.0-9\xB7]/),Qe(/[\u0300-\u036F\u203F-\u2040]/),"]"),we=B(hr,Ai,"*"),fc=B("^",we,"$"),go=B(Ai,"+"),hc=B("&",we,";"),pc=D(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),pr=D(hc,"|",pc),mr=B("%",we,";"),Di=D(B('"',D(/[^%&"]/,"|",mr,"|",pr),"*",'"'),"|",B("'",D(/[^%&']/,"|",mr,"|",pr),"*","'")),mc=D('"',D(/[^<&"]/,"|",pr),"*",'"',"|","'",D(/[^<&']/,"|",pr),"*","'"),gc=Nt(hr,":"),bc=Nt(Ai,":"),Ei=B(gc,bc,"*"),_c=B("^",Ei,"$"),gr=B(Ei,D(":",Ei),"?"),wc=B("^",gr,"$"),yc=B("(",gr,")"),St=D(/"[^"]*"|'[^']*'/),vc=B(/^<\?/,"(",we,")",D(P,"(?!",un,")(",et,"*?)"),"?",/\?>/),bo=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,br=D('"',bo,'*"',"|","'",Nt(bo,"'"),"*'"),ko="<!--",Eo="-->",kc=B(ko,D(Nt(et,"-"),"|",B("-",Nt(et,"-"))),"*",Eo),_o="#PCDATA",Ec=D(B(/\(/,V,_o,D(V,/\|/,V,gr),"*",V,/\)\*/),"|",B(/\(/,V,_o,V,/\)/)),xc=/[?*+]?/,Ac=B(/\([^>]+\)/,xc),Dc=D("EMPTY","|","ANY","|",Ec,"|",Ac),Tc="<!ELEMENT",Nc=B(Tc,P,D(gr,"|",mr),P,D(Dc,"|",mr),V,">"),Sc=B("NOTATION",P,/\(/,V,we,D(V,/\|/,V,we),"*",V,/\)/),Cc=B(/\(/,V,go,D(V,/\|/,V,go),"*",V,/\)/),Oc=D(Sc,"|",Cc),Bc=D(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",Oc),Ic=D(/#REQUIRED|#IMPLIED/,"|",D(D("#FIXED",P),"?",mc)),Rc=D(P,we,P,Bc,P,Ic),Mc="<!ATTLIST",Lc=B(Mc,P,we,Rc,"*",V,">"),xi="about:legacy-compat",Fc=D('"'+xi+'"',"|","'"+xi+"'"),Ti="SYSTEM",cn="PUBLIC",dn=D(D(Ti,P,St),"|",D(cn,P,br,P,St)),$c=B("^",D(D(Ti,P,"(?<SystemLiteralOnly>",St,")"),"|",D(cn,P,"(?<PubidLiteral>",br,")",P,"(?<SystemLiteral>",St,")"))),Pc=B("^",br,"$"),qc=B("^",St,"$"),Uc=D(P,"NDATA",P,we),jc=D(Di,"|",D(dn,Uc,"?")),xo="<!ENTITY",zc=B(xo,P,we,P,jc,V,">"),Vc=D(Di,"|",dn),Hc=B(xo,P,"%",P,we,P,Vc,V,">"),Wc=D(zc,"|",Hc),Gc=B(cn,P,br),Xc=B("<!NOTATION",P,we,P,D(dn,"|",Gc),V,">"),Ni=B(V,"=",V),wo=/1[.]\d+/,Yc=B(P,"version",Ni,D("'",wo,"'","|",'"',wo,'"')),yo=/[A-Za-z][-A-Za-z0-9._]*/,Zc=D(P,"encoding",Ni,D('"',yo,'"',"|","'",yo,"'")),Kc=D(P,"standalone",Ni,D("'",D("yes","|","no"),"'","|",'"',D("yes","|","no"),'"')),Jc=B(/^<\?xml/,Yc,Zc,"?",Kc,"?",V,/\?>/),Qc="<!DOCTYPE",ed="<![CDATA[",td="]]>",rd=/<!\[CDATA\[/,nd=/\]\]>/,id=B(et,"*?",nd),sd=B(rd,id);S.chars=Qe;S.chars_without=Nt;S.detectUnicodeSupport=vo;S.reg=B;S.regg=D;S.ABOUT_LEGACY_COMPAT=xi;S.ABOUT_LEGACY_COMPAT_SystemLiteral=Fc;S.AttlistDecl=Lc;S.CDATA_START=ed;S.CDATA_END=td;S.CDSect=sd;S.Char=et;S.Comment=kc;S.COMMENT_START=ko;S.COMMENT_END=Eo;S.DOCTYPE_DECL_START=Qc;S.elementdecl=Nc;S.EntityDecl=Wc;S.EntityValue=Di;S.ExternalID=dn;S.ExternalID_match=$c;S.Name=we;S.Name_exact=fc;S.NCName_exact=_c;S.NotationDecl=Xc;S.Reference=pr;S.PEReference=mr;S.PI=vc;S.PUBLIC=cn;S.PubidLiteral=br;S.PubidLiteral_match=Pc;S.QName=gr;S.QName_exact=wc;S.QName_group=yc;S.S=P;S.SChar_s=cc;S.S_OPT=V;S.SYSTEM=Ti;S.SystemLiteral=St;S.SystemLiteral_match=qc;S.InvalidChar=uc;S.UNICODE_REPLACEMENT_CHARACTER=lc;S.UNICODE_SUPPORT=Ct;S.XMLDecl=Jc});var Pi=Ge(G=>{"use strict";var Ee=ht(),Ie=Ee.find,od=Ee.hasDefaultHTMLNamespace,Bt=Ee.hasOwn,ad=Ee.isHTMLMimeType,ld=Ee.isHTMLRawTextElement,ud=Ee.isHTMLVoidElement,_r=Ee.MIME_TYPE,Re=Ee.NAMESPACE,fe=Symbol(),Oo=fr(),y=Oo.DOMException,ce=Oo.DOMExceptionName,W=Si();function pe(r){if(r!==fe)throw new TypeError("Illegal constructor")}function cd(r){return r!==""}function dd(r){return r?r.split(/[\t\n\f\r ]+/).filter(cd):[]}function fd(r,e){return Bt(r,e)||(r[e]=!0),r}function Ao(r){if(!r)return[];var e=dd(r);return Object.keys(e.reduce(fd,{}))}function hd(r){return function(e){return r&&r.indexOf(e)!==-1}}function Bo(r){if(!W.QName_exact.test(r))throw new y(y.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function Oi(r,e){Bo(e),r=r||null;var t=null,n=e;if(e.indexOf(":")>=0){var i=e.split(":");t=i[0],n=i[1]}if(t!==null&&r===null)throw new y(y.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(t==="xml"&&r!==Ee.NAMESPACE.XML)throw new y(y.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((t==="xmlns"||e==="xmlns")&&r!==Ee.NAMESPACE.XMLNS)throw new y(y.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===Ee.NAMESPACE.XMLNS&&t!=="xmlns"&&e!=="xmlns")throw new y(y.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,t,n]}function Mt(r,e){for(var t in r)Bt(r,t)&&(e[t]=r[t])}function me(r,e){var t=r.prototype;if(!(t instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,Mt(t,n),r.prototype=t=n}t.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),t.constructor=r)}var ge={},ke=ge.ELEMENT_NODE=1,It=ge.ATTRIBUTE_NODE=2,wr=ge.TEXT_NODE=3,Io=ge.CDATA_SECTION_NODE=4,Ro=ge.ENTITY_REFERENCE_NODE=5,pd=ge.ENTITY_NODE=6,Bi=ge.PROCESSING_INSTRUCTION_NODE=7,Ii=ge.COMMENT_NODE=8,Ot=ge.DOCUMENT_NODE=9,Mo=ge.DOCUMENT_TYPE_NODE=10,tt=ge.DOCUMENT_FRAGMENT_NODE=11,md=ge.NOTATION_NODE=12,H=Ee.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function Lo(r,e){if(e.length<r.length)return Lo(e,r);var t=null;for(var n in r){if(r[n]!==e[n])return t;t=r[n]}return t}function Do(r){return r.guid||(r.guid=Math.random()),r.guid}function ee(){}ee.prototype={length:0,item:function(r){return r>=0&&r<this.length?this[r]:null},toString:function(r){var e;typeof r=="function"?e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r?e={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var t=[],n=0;n<this.length;n++)$i(this[n],t,null,e);return t.join("")},filter:function(r){return Array.prototype.filter.call(this,r)},indexOf:function(r){return Array.prototype.indexOf.call(this,r)}};ee.prototype[Symbol.iterator]=function(){var r=this,e=0;return{next:function(){return e<r.length?{value:r[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Be(r,e){this._node=r,this._refresh=e,mn(this)}function mn(r){var e=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==e){var t=r._refresh(r._node);if(Go(r,"length",t.length),!r.$$length||t.length<r.$$length)for(var n=t.length;n in r;n++)Bt(r,n)&&delete r[n];Mt(t,r),r._inc=e}}Be.prototype.item=function(r){return mn(this),this[r]||null};me(Be,ee);function Rt(){this._nsIndex=Object.create(null),this._noNsIndex=Object.create(null)}function Fo(r,e){for(var t=0;t<r.length;){if(r[t]===e)return t;t++}}function Ri(r,e,t){if(!e)return r._noNsIndex;var n=r._nsIndex[e];return!n&&t&&(n=r._nsIndex[e]=Object.create(null)),n}function gd(r,e,t){var n=Ri(r,e,!1),i=n&&n[t];return i||null}function bd(r,e){Ri(r,e.namespaceURI,!0)[e.localName]=e}function _d(r,e){var t=Ri(r,e.namespaceURI,!1);t&&delete t[e.localName]}function wd(r,e,t,n){if(n?e[Fo(e,n)]=t:(e[e.length]=t,e.length++),bd(e,t),r){t.ownerElement=r;var i=r.ownerDocument;i&&(n&&qo(i,r,n),yd(i,r,t))}}function To(r,e,t){var n=Fo(e,t);if(n>=0){for(var i=e.length-1;n<=i;)e[n]=e[++n];if(e.length=i,_d(e,t),r){var s=r.ownerDocument;s&&qo(s,r,t),t.ownerElement=null}}}Rt.prototype={length:0,item:ee.prototype.item,getNamedItem:function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var e=0;e<this.length;){var t=this[e];if(t.nodeName===r)return t;e++}return null},setNamedItem:function(r){var e=r.ownerElement;if(e&&e!==this._ownerElement)throw new y(y.INUSE_ATTRIBUTE_ERR);var t=gd(this,r.namespaceURI,r.localName);return t===r?r:(wd(this._ownerElement,this,r,t),t)},setNamedItemNS:function(r){return this.setNamedItem(r)},removeNamedItem:function(r){var e=this.getNamedItem(r);if(!e)throw new y(y.NOT_FOUND_ERR,r);return To(this._ownerElement,this,e),e},removeNamedItemNS:function(r,e){var t=this.getNamedItemNS(r,e);if(!t)throw new y(y.NOT_FOUND_ERR,r?r+" : "+e:e);return To(this._ownerElement,this,t),t},getNamedItemNS:function(r,e){r||(r=null);for(var t=0;t<this.length;){var n=this[t];if(n.localName===e&&n.namespaceURI===r)return n;t++}return null}};Rt.prototype[Symbol.iterator]=function(){var r=this,e=0;return{next:function(){return e<r.length?{value:r[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function $o(){}$o.prototype={hasFeature:function(r,e){return!0},createDocument:function(r,e,t){var n=_r.XML_APPLICATION;r===Re.HTML?n=_r.XML_XHTML_APPLICATION:r===Re.SVG&&(n=_r.XML_SVG_IMAGE);var i=new Ue(fe,{contentType:n});if(i.implementation=this,i.childNodes=new ee,i.doctype=t||null,t&&i.appendChild(t),e){var s=i.createElementNS(r,e);i.appendChild(s)}return i},createDocumentType:function(r,e,t,n){Bo(r);var i=new _n(fe);return i.name=r,i.nodeName=r,i.publicId=e||"",i.systemId=t||"",i.internalSubset=n||"",i.childNodes=new ee,i},createHTMLDocument:function(r){var e=new Ue(fe,{contentType:_r.HTML});if(e.implementation=this,e.childNodes=new ee,r!==!1){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var t=e.createElement("html");e.appendChild(t);var n=e.createElement("head");if(t.appendChild(n),typeof r=="string"){var i=e.createElement("title");i.appendChild(e.createTextNode(r)),n.appendChild(i)}t.appendChild(e.createElement("body"))}return e}};function R(r){pe(r)}R.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var r=this.getRootNode();return r&&r.nodeType===r.DOCUMENT_NODE},contains:function(r){if(!r)return!1;var e=r;do{if(this===e)return!0;e=e.parentNode}while(e);return!1},getRootNode:function(r){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},isEqualNode:function(r){if(!r)return!1;for(var e=[{node:this,other:r}];e.length>0;){var t=e.pop(),n=t.node,i=t.other;if(n.nodeType!==i.nodeType)return!1;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==i.name||n.publicId!==i.publicId||n.systemId!==i.systemId)return!1;break;case n.ELEMENT_NODE:if(n.namespaceURI!==i.namespaceURI||n.prefix!==i.prefix||n.localName!==i.localName||n.attributes.length!==i.attributes.length)return!1;for(var s=0;s<n.attributes.length;s++){var o=n.attributes.item(s),a=i.getAttributeNodeNS(o.namespaceURI,o.localName);if(!a)return!1;e.push({node:o,other:a})}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==i.namespaceURI||n.localName!==i.localName||n.value!==i.value)return!1;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==i.target||n.data!==i.data)return!1;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==i.data)return!1;break}if(n.childNodes.length!==i.childNodes.length)return!1;for(var s=n.childNodes.length-1;s>=0;s--)e.push({node:n.childNodes[s],other:i.childNodes[s]})}return!0},isSameNode:function(r){return this===r},insertBefore:function(r,e){return pn(this,r,e)},replaceChild:function(r,e){pn(this,r,e,zo),e&&this.removeChild(e)},removeChild:function(r){return Uo(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return Wo(this.ownerDocument||this,this,r)},normalize:function(){ae(this,null,{enter:function(r){for(var e=r.firstChild;e;){var t=e.nextSibling;if(t!==null&&t.nodeType===wr&&e.nodeType===wr){for(var n=[],i=t;i!==null&&i.nodeType===wr;)n.push(i.data),i=i.nextSibling;for(var s=e.nextSibling;s!==i;){var o=s.nextSibling;s.parentNode=null,s.previousSibling=null,s.nextSibling=null,s=o}e.nextSibling=i,i!==null?i.previousSibling=e:r.lastChild=e,e.appendData(n.join("")),Mi(r.ownerDocument,r),e=i}else e=t}return!0}})},isSupported:function(r,e){return this.ownerDocument.implementation.hasFeature(r,e)},lookupPrefix:function(r){for(var e=this;e;){var t=e._nsMap;if(t){for(var n in t)if(Bt(t,n)&&t[n]===r)return n}e=e.nodeType==It?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(r){for(var e=this;e;){var t=e._nsMap;if(t&&Bt(t,r))return t[r];e=e.nodeType==It?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(r){var e=this.lookupPrefix(r);return e==null},compareDocumentPosition:function(r){if(this===r)return 0;var e=r,t=this,n=null,i=null;if(e instanceof pt&&(n=e,e=n.ownerElement),t instanceof pt&&(i=t,t=i.ownerElement,n&&e&&t===e))for(var s=0,o;o=t.attributes[s];s++){if(o===n)return H.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+H.DOCUMENT_POSITION_PRECEDING;if(o===i)return H.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+H.DOCUMENT_POSITION_FOLLOWING}if(!e||!t||t.ownerDocument!==e.ownerDocument)return H.DOCUMENT_POSITION_DISCONNECTED+H.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Do(t.ownerDocument)>Do(e.ownerDocument)?H.DOCUMENT_POSITION_FOLLOWING:H.DOCUMENT_POSITION_PRECEDING);if(i&&e===t)return H.DOCUMENT_POSITION_CONTAINS+H.DOCUMENT_POSITION_PRECEDING;if(n&&e===t)return H.DOCUMENT_POSITION_CONTAINED_BY+H.DOCUMENT_POSITION_FOLLOWING;for(var a=[],l=e.parentNode;l;){if(!i&&l===t)return H.DOCUMENT_POSITION_CONTAINED_BY+H.DOCUMENT_POSITION_FOLLOWING;a.push(l),l=l.parentNode}a.reverse();for(var u=[],c=t.parentNode;c;){if(!n&&c===e)return H.DOCUMENT_POSITION_CONTAINS+H.DOCUMENT_POSITION_PRECEDING;u.push(c),c=c.parentNode}u.reverse();var d=Lo(a,u);for(var f in d.childNodes){var h=d.childNodes[f];if(h===t)return H.DOCUMENT_POSITION_FOLLOWING;if(h===e)return H.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(h)>=0)return H.DOCUMENT_POSITION_FOLLOWING;if(a.indexOf(h)>=0)return H.DOCUMENT_POSITION_PRECEDING}return 0}};function Po(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}Mt(ge,R);Mt(ge,R.prototype);Mt(H,R);Mt(H,R.prototype);function hn(r,e){ae(r,null,{enter:function(t){return e(t)?ae.STOP:!0}})}function ae(r,e,t){for(var n=[{node:r,context:e,phase:ae.ENTER}];n.length>0;){var i=n.pop();if(i.phase===ae.ENTER){var s=t.enter(i.node,i.context);if(s===ae.STOP)return ae.STOP;if(n.push({node:i.node,context:s,phase:ae.EXIT}),s==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:s,phase:ae.ENTER}),o=o.previousSibling}else t.exit&&t.exit(i.node,i.context)}}ae.STOP=Symbol("walkDOM.STOP");ae.ENTER=0;ae.EXIT=1;function Ue(r,e){pe(r);var t=e||{};this.ownerDocument=this,this.contentType=t.contentType||_r.XML_APPLICATION,this.type=ad(this.contentType)?"html":"xml"}function yd(r,e,t){r&&r._inc++;var n=t.namespaceURI;n===Re.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function qo(r,e,t,n){r&&r._inc++;var i=t.namespaceURI;i===Re.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Mi(r,e,t){if(r&&r._inc){r._inc++;var n=e.childNodes;if(t&&!t.nextSibling)n[n.length++]=t;else{for(var i=e.firstChild,s=0;i;)n[s++]=i,i=i.nextSibling;n.length=s,delete n[n.length]}}}function Uo(r,e){if(r!==e.parentNode)throw new y(y.NOT_FOUND_ERR,"child's parent is not parent");var t=e.previousSibling,n=e.nextSibling;return t?t.nextSibling=n:r.firstChild=n,n?n.previousSibling=t:r.lastChild=t,Mi(r.ownerDocument,r),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function vd(r){return r&&(r.nodeType===R.DOCUMENT_NODE||r.nodeType===R.DOCUMENT_FRAGMENT_NODE||r.nodeType===R.ELEMENT_NODE)}function kd(r){return r&&(r.nodeType===R.CDATA_SECTION_NODE||r.nodeType===R.COMMENT_NODE||r.nodeType===R.DOCUMENT_FRAGMENT_NODE||r.nodeType===R.DOCUMENT_TYPE_NODE||r.nodeType===R.ELEMENT_NODE||r.nodeType===R.PROCESSING_INSTRUCTION_NODE||r.nodeType===R.TEXT_NODE)}function rt(r){return r&&r.nodeType===R.DOCUMENT_TYPE_NODE}function qe(r){return r&&r.nodeType===R.ELEMENT_NODE}function jo(r){return r&&r.nodeType===R.TEXT_NODE}function No(r,e){var t=r.childNodes||[];if(Ie(t,qe)||rt(e))return!1;var n=Ie(t,rt);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function So(r,e){var t=r.childNodes||[];function n(s){return qe(s)&&s!==e}if(Ie(t,n))return!1;var i=Ie(t,rt);return!(e&&i&&t.indexOf(i)>t.indexOf(e))}function Ed(r,e,t){if(!vd(r))throw new y(y.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(t&&t.parentNode!==r)throw new y(y.NOT_FOUND_ERR,"child not in parent");if(!kd(e)||rt(e)&&r.nodeType!==R.DOCUMENT_NODE)throw new y(y.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+r.nodeType)}function xd(r,e,t){var n=r.childNodes||[],i=e.childNodes||[];if(e.nodeType===R.DOCUMENT_FRAGMENT_NODE){var s=i.filter(qe);if(s.length>1||Ie(i,jo))throw new y(y.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!No(r,t))throw new y(y.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(qe(e)&&!No(r,t))throw new y(y.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(rt(e)){if(Ie(n,rt))throw new y(y.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Ie(n,qe);if(t&&n.indexOf(o)<n.indexOf(t))throw new y(y.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!t&&o)throw new y(y.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function zo(r,e,t){var n=r.childNodes||[],i=e.childNodes||[];if(e.nodeType===R.DOCUMENT_FRAGMENT_NODE){var s=i.filter(qe);if(s.length>1||Ie(i,jo))throw new y(y.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!So(r,t))throw new y(y.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(qe(e)&&!So(r,t))throw new y(y.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(rt(e)){if(Ie(n,function(l){return rt(l)&&l!==t}))throw new y(y.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Ie(n,qe);if(t&&n.indexOf(o)<n.indexOf(t))throw new y(y.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function pn(r,e,t,n){Ed(r,e,t),r.nodeType===R.DOCUMENT_NODE&&(n||xd)(r,e,t);var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===tt){var s=e.firstChild;if(s==null)return e;var o=e.lastChild}else s=o=e;var a=t?t.previousSibling:r.lastChild;s.previousSibling=a,o.nextSibling=t,a?a.nextSibling=s:r.firstChild=s,t==null?r.lastChild=o:t.previousSibling=o;do s.parentNode=r;while(s!==o&&(s=s.nextSibling));return Mi(r.ownerDocument||r,r,e),e.nodeType==tt&&(e.firstChild=e.lastChild=null),e}Ue.prototype={implementation:null,nodeName:"#document",nodeType:Ot,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,e){if(r.nodeType===tt){for(var t=r.firstChild;t;){var n=t.nextSibling;this.insertBefore(t,e),t=n}return r}return pn(this,r,e),r.ownerDocument=this,this.documentElement===null&&r.nodeType===ke&&(this.documentElement=r),r},removeChild:function(r){var e=Uo(this,r);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(r,e){pn(this,r,e,zo),r.ownerDocument=this,e&&this.removeChild(e),qe(r)&&(this.documentElement=r)},importNode:function(r,e){return Ad(this,r,e)},getElementById:function(r){var e=null;return hn(this.documentElement,function(t){if(t.nodeType==ke&&t.getAttribute("id")==r)return e=t,!0}),e},createElement:function(r){var e=new je(fe);e.ownerDocument=this,this.type==="html"&&(r=r.toLowerCase()),od(this.contentType)&&(e.namespaceURI=Re.HTML),e.nodeName=r,e.tagName=r,e.localName=r,e.childNodes=new ee;var t=e.attributes=new Rt;return t._ownerElement=e,e},createDocumentFragment:function(){var r=new Lt(fe);return r.ownerDocument=this,r.childNodes=new ee,r},createTextNode:function(r){var e=new yr(fe);return e.ownerDocument=this,e.childNodes=new ee,e.appendData(r),e},createComment:function(r){var e=new gn(fe);return e.ownerDocument=this,e.childNodes=new ee,e.appendData(r),e},createCDATASection:function(r){if(r.indexOf("]]>")!==-1)throw new y(y.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new bn(fe);return e.ownerDocument=this,e.childNodes=new ee,e.appendData(r),e},createProcessingInstruction:function(r,e){var t=new yn(fe);return t.ownerDocument=this,t.childNodes=new ee,t.nodeName=t.target=r,t.nodeValue=t.data=e,t},createAttribute:function(r){if(!W.QName_exact.test(r))throw new y(y.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var e=new pt(fe);return e.ownerDocument=this,e.childNodes=new ee,e.name=r,e.nodeName=r,e.localName=r,e.specified=!0,e},createEntityReference:function(r){if(!W.Name_exact.test(r))throw new y(y.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new y("document is an html document",ce.NotSupportedError);var e=new wn(fe);return e.ownerDocument=this,e.childNodes=new ee,e.nodeName=r,e},createElementNS:function(r,e){var t=Oi(r,e),n=new je(fe),i=n.attributes=new Rt;return n.childNodes=new ee,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t[0],n.prefix=t[1],n.localName=t[2],i._ownerElement=n,n},createAttributeNS:function(r,e){var t=Oi(r,e),n=new pt(fe);return n.ownerDocument=this,n.childNodes=new ee,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=t[0],n.prefix=t[1],n.localName=t[2],n}};me(Ue,R);function je(r){pe(r),this._nsMap=Object.create(null)}je.prototype={nodeType:ke,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===Re.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(r){return!!this.getAttributeNode(r)},getAttribute:function(r){var e=this.getAttributeNode(r);return e?e.value:null},getAttributeNode:function(r){return this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase()),this.attributes.getNamedItem(r)},setAttribute:function(r,e){this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());var t=this.getAttributeNode(r);t?t.value=t.nodeValue=""+e:(t=this.ownerDocument._createAttribute(r),t.value=t.nodeValue=""+e,this.setAttributeNode(t))},removeAttribute:function(r){var e=this.getAttributeNode(r);e&&this.removeAttributeNode(e)},setAttributeNode:function(r){return this.attributes.setNamedItem(r)},setAttributeNodeNS:function(r){return this.attributes.setNamedItemNS(r)},removeAttributeNode:function(r){return this.attributes.removeNamedItem(r.nodeName)},removeAttributeNS:function(r,e){var t=this.getAttributeNodeNS(r,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(r,e){return this.getAttributeNodeNS(r,e)!=null},getAttributeNS:function(r,e){var t=this.getAttributeNodeNS(r,e);return t?t.value:null},setAttributeNS:function(r,e,t){var n=Oi(r,e),i=n[2],s=this.getAttributeNodeNS(r,i);s?s.value=s.nodeValue=""+t:(s=this.ownerDocument.createAttributeNS(r,e),s.value=s.nodeValue=""+t,this.setAttributeNode(s))},getAttributeNodeNS:function(r,e){return this.attributes.getNamedItemNS(r,e)},getElementsByClassName:function(r){var e=Ao(r);return new Be(this,function(t){var n=[];return e.length>0&&hn(t,function(i){if(i!==t&&i.nodeType===ke){var s=i.getAttribute("class");if(s){var o=r===s;if(!o){var a=Ao(s);o=e.every(hd(a))}o&&n.push(i)}}}),n})},getElementsByTagName:function(r){var e=(this.nodeType===Ot?this:this.ownerDocument).type==="html",t=r.toLowerCase();return new Be(this,function(n){var i=[];return hn(n,function(s){if(!(s===n||s.nodeType!==ke))if(r==="*")i.push(s);else{var o=s.getQualifiedName(),a=e&&s.namespaceURI===Re.HTML?t:r;o===a&&i.push(s)}}),i})},getElementsByTagNameNS:function(r,e){return new Be(this,function(t){var n=[];return hn(t,function(i){i!==t&&i.nodeType===ke&&(r==="*"||i.namespaceURI===r)&&(e==="*"||i.localName==e)&&n.push(i)}),n})}};Ue.prototype.getElementsByClassName=je.prototype.getElementsByClassName;Ue.prototype.getElementsByTagName=je.prototype.getElementsByTagName;Ue.prototype.getElementsByTagNameNS=je.prototype.getElementsByTagNameNS;me(je,R);function pt(r){pe(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}pt.prototype.nodeType=It;me(pt,R);function nt(r){pe(r)}nt.prototype={data:"",substringData:function(r,e){return this.data.substring(r,r+e)},appendData:function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},insertData:function(r,e){this.replaceData(r,0,e)},deleteData:function(r,e){this.replaceData(r,e,"")},replaceData:function(r,e,t){var n=this.data.substring(0,r),i=this.data.substring(r+e);t=n+t+i,this.nodeValue=this.data=t,this.length=t.length}};me(nt,R);function yr(r){pe(r)}yr.prototype={nodeName:"#text",nodeType:wr,splitText:function(r){var e=this.data,t=e.substring(r);e=e.substring(0,r),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};me(yr,nt);function gn(r){pe(r)}gn.prototype={nodeName:"#comment",nodeType:Ii};me(gn,nt);function bn(r){pe(r)}bn.prototype={nodeName:"#cdata-section",nodeType:Io};me(bn,yr);function _n(r){pe(r)}_n.prototype.nodeType=Mo;me(_n,R);function Li(r){pe(r)}Li.prototype.nodeType=md;me(Li,R);function Fi(r){pe(r)}Fi.prototype.nodeType=pd;me(Fi,R);function wn(r){pe(r)}wn.prototype.nodeType=Ro;me(wn,R);function Lt(r){pe(r)}Lt.prototype.nodeName="#document-fragment";Lt.prototype.nodeType=tt;me(Lt,R);function yn(r){pe(r)}yn.prototype.nodeType=Bi;me(yn,nt);function Vo(){}Vo.prototype.serializeToString=function(r,e){return Ho.call(r,e)};R.prototype.toString=Ho;function Ho(r){var e;typeof r=="function"?e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r!=null?e={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var t=[],n=this.nodeType===Ot&&this.documentElement||this,i=n.prefix,s=n.namespaceURI;if(s&&i==null){var i=n.lookupPrefix(s);if(i==null)var o=[{namespace:s,prefix:null}]}return $i(this,t,o,e),t.join("")}function Co(r,e,t){var n=r.prefix||"",i=r.namespaceURI;if(!i||n==="xml"&&i===Re.XML||i===Re.XMLNS)return!1;for(var s=t.length;s--;){var o=t[s];if(o.prefix===n)return o.namespace!==i}return!0}function fn(r,e,t,n){if(n&&!W.QName_exact.test(e))throw new y('The attribute name "'+e+'" is not a valid XML QName',ce.InvalidStateError);r.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Po),'"')}function $i(r,e,t,n){t||(t=[]);var i=n.nodeFilter,s=n.requireWellFormed,o=n.splitCDATASections,a=r.nodeType===Ot?r:r.ownerDocument,l=a.type==="html";ae(r,{ns:t},{enter:function(u,c){var d=c.ns;if(i)if(u=i(u),u){if(typeof u=="string")return e.push(u),null}else return null;switch(u.nodeType){case ke:var f=u.attributes,h=f.length,p=u.tagName,m=p;if(!l&&!u.prefix&&u.namespaceURI){for(var g,_=0;_<f.length;_++)if(f.item(_).name==="xmlns"){g=f.item(_).value;break}if(!g)for(var v=d.length-1;v>=0;v--){var w=d[v];if(w.prefix===""&&w.namespace===u.namespaceURI){g=w.namespace;break}}if(g!==u.namespaceURI)for(var v=d.length-1;v>=0;v--){var w=d[v];if(w.namespace===u.namespaceURI){w.prefix&&(m=w.prefix+":"+p);break}}}if(s&&!W.QName_exact.test(m))throw new y('The element name "'+m+'" is not a valid XML QName',ce.InvalidStateError);e.push("<",m);for(var E=d.slice(),T=0;T<h;T++){var I=f.item(T);I.prefix=="xmlns"?E.push({prefix:I.localName,namespace:I.value}):I.nodeName=="xmlns"&&E.push({prefix:"",namespace:I.value})}for(var T=0;T<h;T++){var I=f.item(T);if(Co(I,l,E)){var z=I.prefix||"",q=I.namespaceURI;fn(e,z?"xmlns:"+z:"xmlns",q,s),E.push({prefix:z,namespace:q})}var ie=i?i(I):I;ie&&(typeof ie=="string"?e.push(ie):fn(e,ie.name,ie.value,s))}if(p===m&&Co(u,l,E)){var $e=u.prefix||"",q=u.namespaceURI;fn(e,$e?"xmlns:"+$e:"xmlns",q,s),E.push({prefix:$e,namespace:q})}var J=!u.firstChild;if(J&&(l||u.namespaceURI===Re.HTML)&&(J=ud(p)),J)return e.push("/>"),null;if(e.push(">"),l&&ld(p)){for(var de=u.firstChild;de;)de.data?e.push(de.data):$i(de,e,E.slice(),n),de=de.nextSibling;return e.push("</",m,">"),null}return{ns:E,tag:m};case Ot:case tt:if(s&&u.nodeType===Ot&&u.documentElement==null)throw new y("The Document has no documentElement",ce.InvalidStateError);return{ns:d};case It:return fn(e,u.name,u.value,s),null;case wr:if(s&&W.InvalidChar.test(u.data))throw new y("The Text node data contains characters outside the XML Char production",ce.InvalidStateError);return e.push(u.data.replace(/[<&>]/g,Po)),null;case Io:if(s&&u.data.indexOf("]]>")!==-1)throw new y('The CDATASection data contains "]]>"',ce.InvalidStateError);return o?e.push(W.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),W.CDATA_END):e.push(W.CDATA_START,u.data,W.CDATA_END),null;case Ii:if(s){if(W.InvalidChar.test(u.data))throw new y("The comment node data contains characters outside the XML Char production",ce.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new y('The comment node data contains "--" or ends with "-"',ce.InvalidStateError)}return e.push(W.COMMENT_START,u.data,W.COMMENT_END),null;case Mo:var ye=u.publicId,U=u.systemId;if(s){if(!W.Name_exact.test(u.name))throw new y('The doctype name "'+u.name+'" is not a valid XML Name',ce.InvalidStateError);if(ye&&!W.PubidLiteral_match.test(ye))throw new y("DocumentType publicId is not a valid PubidLiteral",ce.InvalidStateError);if(U&&U!=="."&&!W.SystemLiteral_match.test(U))throw new y("DocumentType systemId is not a valid SystemLiteral",ce.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new y('DocumentType internalSubset contains "]>"',ce.InvalidStateError)}return e.push(W.DOCTYPE_DECL_START," ",u.name),ye?(e.push(" ",W.PUBLIC," ",ye),U&&U!=="."&&e.push(" ",U)):U&&U!=="."&&e.push(" ",W.SYSTEM," ",U),u.internalSubset&&e.push(" [",u.internalSubset,"]"),e.push(">"),null;case Bi:if(s){if(!W.NCName_exact.test(u.target)||u.target.toLowerCase()==="xml")throw new y('The processing instruction target "'+u.target+'" is not a valid XML NCName or is reserved',ce.InvalidStateError);if(W.InvalidChar.test(u.data))throw new y("The ProcessingInstruction data contains characters outside the XML Char production",ce.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new y('The ProcessingInstruction data contains "?>"',ce.InvalidStateError)}return e.push("<?",u.target," ",u.data,"?>"),null;case Ro:if(s&&!W.Name_exact.test(u.nodeName))throw new y('The entity reference name "'+u.nodeName+'" is not a valid XML Name',ce.InvalidStateError);return e.push("&",u.nodeName,";"),null;default:return e.push("??",u.nodeName),null}},exit:function(u,c){c&&c.tag&&e.push("</",c.tag,">")}})}function Ad(r,e,t){var n;return ae(e,null,{enter:function(i,s){var o=i.cloneNode(!1);o.ownerDocument=r,o.parentNode=null,s===null?n=o:s.appendChild(o);var a=i.nodeType===It||t;return a?o:null}}),n}function Wo(r,e,t){var n;return ae(e,null,{enter:function(i,s){var o=new i.constructor(fe);for(var a in i)if(Bt(i,a)){var l=i[a];typeof l!="object"&&l!=o[a]&&(o[a]=l)}i.childNodes&&(o.childNodes=new ee),o.ownerDocument=r;var u=t;switch(o.nodeType){case ke:var c=i.attributes,d=o.attributes=new Rt,f=c.length;d._ownerElement=o;for(var h=0;h<f;h++)o.setAttributeNode(Wo(r,c.item(h),!0));break;case It:u=!0}return s!==null?s.appendChild(o):n=o,u?o:null}}),n}function Go(r,e,t){r[e]=t}function Ci(r){for(var e=[],t=r.firstChild;t;)t.nodeType===ke&&e.push(t),t=t.nextSibling;return e}try{Object.defineProperty&&(Object.defineProperty(Be.prototype,"length",{get:function(){return mn(this),this.$$length}}),Object.defineProperty(R.prototype,"textContent",{get:function(){if(this.nodeType===ke||this.nodeType===tt){var r=[];return ae(this,null,{enter:function(e){if(e.nodeType===ke||e.nodeType===tt)return!0;if(e.nodeType===Bi||e.nodeType===Ii)return null;r.push(e.nodeValue)}}),r.join("")}return this.nodeValue},set:function(r){switch(this.nodeType){case ke:case tt:for(;this.firstChild;)this.removeChild(this.firstChild);(r||String(r))&&this.appendChild(this.ownerDocument.createTextNode(r));break;default:this.data=r,this.value=r,this.nodeValue=r}}}),Object.defineProperty(nt.prototype,"data",{get:function(){return this._data!=null?this._data:""},set:function(r){this._data=r,this.length=typeof r=="string"?r.length:0}}),Object.defineProperty(nt.prototype,"nodeValue",{get:function(){return this.data},set:function(r){this.data=r},enumerable:!0,configurable:!0}),Object.defineProperty(je.prototype,"children",{get:function(){return new Be(this,Ci)}}),Object.defineProperty(Ue.prototype,"children",{get:function(){return new Be(this,Ci)}}),Object.defineProperty(Lt.prototype,"children",{get:function(){return new Be(this,Ci)}}),Go=function(r,e,t){r["$$"+e]=t})}catch{}G._updateLiveList=mn;G.Attr=pt;G.CDATASection=bn;G.CharacterData=nt;G.Comment=gn;G.Document=Ue;G.DocumentFragment=Lt;G.DocumentType=_n;G.DOMImplementation=$o;G.Element=je;G.Entity=Fi;G.EntityReference=wn;G.LiveNodeList=Be;G.NamedNodeMap=Rt;G.Node=R;G.NodeList=ee;G.Notation=Li;G.Text=yr;G.ProcessingInstruction=yn;G.walkDOM=ae;G.XMLSerializer=Vo});var Yo=Ge(vr=>{"use strict";var Xo=ht().freeze;vr.XML_ENTITIES=Xo({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});vr.HTML_ENTITIES=Xo({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
2
|
-
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});vr.entityMap=vr.HTML_ENTITIES});var ia=Ge(kn=>{"use strict";var Ut=ht(),C=Si(),Qo=fr(),Dd=Ut.isHTMLEscapableRawTextElement,Td=Ut.isHTMLMimeType,Nd=Ut.isHTMLRawTextElement,xr=Ut.hasOwn,Zo=Ut.NAMESPACE,Sd=Qo.ParseError,Cd=Qo.DOMException,Ft=0,it=1,$t=2,kr=3,Pt=4,qt=5,Er=6,vn=7;function ea(){}ea.prototype={parse:function(r,e,t){var n=this.domBuilder;n.startDocument(),Rd(e,e=Object.create(null)),Od(r,e,t,n,this.errorHandler),n.endDocument()}};var qi=/&#?\w+;?/g;function Od(r,e,t,n,i){var s=Td(n.mimeType);r.indexOf(C.UNICODE_REPLACEMENT_CHARACTER)>=0&&i.warning("Unicode replacement character detected, source encoding issues?");function o(L){if(L>65535){L-=65536;var ve=55296+(L>>10),Vr=56320+(L&1023);return String.fromCharCode(ve,Vr)}else return String.fromCharCode(L)}function a(L){var ve=L[L.length-1]===";"?L:L+";";if(!s&&ve!==L)return i.error("EntityRef: expecting ;"),L;var Vr=C.Reference.exec(ve);if(!Vr||Vr[0].length!==ve.length)return i.error("entity not matching Reference production: "+L),L;var Hr=ve.slice(1,-1);return xr(t,Hr)?t[Hr]:Hr.charAt(0)==="#"?o(parseInt(Hr.substring(1).replace("x","0x"))):(i.error("entity not found:"+L),L)}function l(L){if(L>g){var ve=r.substring(g,L).replace(qi,a);f&&h(g),n.characters(ve,0,L-g),g=L}}var u=0,c=0,d=/\r\n?|\n|$/g,f=n.locator;function h(L,ve){for(;L>=c&&(ve=d.exec(r));)u=c,c=ve.index+ve[0].length,f.lineNumber++;f.columnNumber=L-u+1}for(var p=[{currentNSMap:e}],m=[],g=0;;){try{var _=r.indexOf("<",g);if(_<0){if(!s&&m.length>0)return i.fatalError("unclosed xml tag(s): "+m.join(", "));if(!r.substring(g).match(/^\s*$/)){var v=n.doc,w=v.createTextNode(r.substring(g));if(v.documentElement)return i.error("Extra content at the end of the document");v.appendChild(w),n.currentElement=w}return}if(_>g){var E=r.substring(g,_);!s&&m.length===0&&(E=E.replace(new RegExp(C.S_OPT.source,"g"),""),E&&i.error("Unexpected content outside root element: '"+E+"'")),l(_)}switch(r.charAt(_+1)){case"/":var O=r.indexOf(">",_+2),T=r.substring(_+2,O>0?O:void 0);if(!T)return i.fatalError("end tag name missing");var I=C.reg("^",C.QName_group,C.S_OPT,"$"),z=O>0&&I.exec(T);if(!z){var q=O>0&&C.reg("^",C.QName_group).exec(T);if(s&&q)i.warning('end tag name contains invalid trailing characters: "'+T+'"'),z=q;else if(q&&new RegExp(I.source,I.flags+"m").test(T))i.error('end tag name is followed by a line break and trailing content: "'+T+'"'),z=q;else return i.fatalError('end tag name contains invalid characters: "'+T+'"')}if(!n.currentElement&&!n.doc.documentElement)return;var ie=m[m.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(ie!==z[1]){var $e=z[1].toLowerCase();if(!s||ie.toLowerCase()!==$e)return i.fatalError('Opening and ending tag mismatch: "'+ie+'" != "'+T+'"')}var J=p.pop();m.pop();var de=J.localNSMap;if(n.endElement(J.uri,J.localName,ie),de)for(var ye in de)xr(de,ye)&&n.endPrefixMapping(ye);O++;break;case"?":f&&h(_),O=Ld(r,_,n,i);break;case"!":f&&h(_),O=ra(r,_,n,i,s);break;default:f&&h(_);var U=new na,Z=p[p.length-1].currentNSMap,O=Bd(r,_,U,Z,a,i,s),As=U.length;if(U.closed||(s&&Ut.isHTMLVoidElement(U.tagName)?U.closed=!0:m.push(U.tagName)),f&&As){for(var Tl=Ko(f,{}),ii=0;ii<As;ii++){var Ds=U[ii];h(Ds.offset),Ds.locator=Ko(f,{})}n.locator=Tl,Jo(U,n,Z)&&p.push(U),n.locator=f}else Jo(U,n,Z)&&p.push(U);s&&!U.closed?O=Id(r,O,U.tagName,a,n):O++}}catch(L){if(L instanceof Sd)throw L;if(L instanceof Cd)return i.fatalError("Error constructing the DOM: "+L.name+": "+L.message,L);i.error("element parse error: "+L),O=-1}O>g?g=O:l(Math.max(_,g)+1)}}function Ko(r,e){return e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber,e}function Bd(r,e,t,n,i,s,o){function a(h,p,m){if(xr(t.attributeNames,h))return s.fatalError("Attribute "+h+" redefined");if(!o&&p.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");t.addValue(h,p.replace(/[\t\n\r]/g," ").replace(qi,i),m)}for(var l,u,c=++e,d=Ft;;){var f=r.charAt(c);if(d===Ft&&f==="<")throw new Error("unexpected < in tag name: "+r.slice(e,c));switch(f){case"=":if(d===it)l=r.slice(e,c),d=kr;else if(d===$t)d=kr;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===kr||d===it)if(d===it&&(s.warning('attribute value must after "="'),l=r.slice(e,c)),e=c+1,c=r.indexOf(f,e),c>0)u=r.slice(e,c),a(l,u,e-1),d=qt;else throw new Error("attribute value no end '"+f+"' match");else if(d==Pt)u=r.slice(e,c),a(l,u,e),s.warning('attribute "'+l+'" missed start quot('+f+")!!"),e=c+1,d=qt;else throw new Error('attribute value must after "="');break;case"/":switch(d){case Ft:t.setTagName(r.slice(e,c));case qt:case Er:case vn:d=vn,t.closed=!0;case Pt:case it:break;case $t:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==Ft&&t.setTagName(r.slice(e,c)),c;case">":switch(d){case Ft:t.setTagName(r.slice(e,c));case qt:case Er:case vn:break;case Pt:case it:u=r.slice(e,c),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case $t:d===$t&&(u=l),d==Pt?(s.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):(o||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case kr:if(!o)return s.fatalError(`AttValue: ' or " expected`)}return c;case"\x80":f=" ";default:if(f<=" ")switch(d){case Ft:t.setTagName(r.slice(e,c)),d=Er;break;case it:l=r.slice(e,c),d=$t;break;case Pt:var u=r.slice(e,c);s.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case qt:d=Er;break}else switch(d){case $t:o||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=c,d=it;break;case qt:s.warning('attribute space is required"'+l+'"!!');case Er:d=it,e=c;break;case kr:d=Pt,e=c;break;case vn:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function Jo(r,e,t){for(var n=r.tagName,i=null,d=r.length;d--;){var s=r[d],o=s.qName,a=s.value,f=o.indexOf(":");if(f>0)var l=s.prefix=o.slice(0,f),u=o.slice(f+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";s.localName=u,c!==!1&&(i==null&&(i=Object.create(null),t=Object.create(t)),t[c]=i[c]=a,s.uri=Zo.XMLNS,e.startPrefixMapping(c,a))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=Zo.XML),s.prefix!=="xmlns"&&(s.uri=t[s.prefix]));var f=n.indexOf(":");f>0?(l=r.prefix=n.slice(0,f),u=r.localName=n.slice(f+1)):(l=null,u=r.localName=n);var h=r.uri=t[l||""];if(e.startElement(h,u,n,r),r.closed){if(e.endElement(h,u,n),i)for(l in i)xr(i,l)&&e.endPrefixMapping(l)}else return r.currentNSMap=t,r.localNSMap=i,!0}function Id(r,e,t,n,i){var s=Dd(t);if(s||Nd(t)){var o=new RegExp("</"+t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+">","ig");o.lastIndex=e;var a=o.exec(r),l=a?a.index:-1;if(l<0)return e+1;var u=r.substring(e+1,l);return s&&(u=u.replace(qi,n)),i.characters(u,0,u.length),l}return e+1}function Rd(r,e){for(var t in r)xr(r,t)&&(e[t]=r[t])}function ta(r,e){var t=e;function n(c){return c=c||0,r.charAt(t+c)}function i(c){c=c||1,t+=c}function s(){for(var c=0;t<r.length;){var d=n();if(d!==" "&&d!==`
|
|
3
|
-
`&&d!==" "&&d!=="\r")return c;c++,i()}return-1}function o(){return r.substring(t)}function a(c){return r.substring(t,t+c.length)===c}function l(c){return r.substring(t,t+c.length).toUpperCase()===c.toUpperCase()}function u(c){var d=C.reg("^",c),f=d.exec(o());return f?(i(f[0].length),f[0]):null}return{char:n,getIndex:function(){return t},getMatch:u,getSource:function(){return r},skip:i,skipBlanks:s,substringFromIndex:o,substringStartsWith:a,substringStartsWithCaseInsensitive:l}}function Md(r,e){function t(a,l){var u=C.PI.exec(a.substringFromIndex());return u?u[1].toLowerCase()==="xml"?l.fatalError("xml declaration is only allowed at the start of the document, but found at position "+a.getIndex()):(a.skip(u[0].length),u[0]):l.fatalError("processing instruction is not well-formed at position "+a.getIndex())}var n=r.getSource();if(r.char()==="["){r.skip(1);for(var i=r.getIndex();r.getIndex()<n.length;){if(r.skipBlanks(),r.char()==="]"){var s=n.substring(i,r.getIndex());return r.skip(1),s}var o=null;if(r.char()==="<"&&r.char(1)==="!")switch(r.char(2)){case"E":r.char(3)==="L"?o=r.getMatch(C.elementdecl):r.char(3)==="N"&&(o=r.getMatch(C.EntityDecl));break;case"A":o=r.getMatch(C.AttlistDecl);break;case"N":o=r.getMatch(C.NotationDecl);break;case"-":o=r.getMatch(C.Comment);break}else if(r.char()==="<"&&r.char(1)==="?")o=t(r,e);else if(r.char()==="%")o=r.getMatch(C.PEReference);else return e.fatalError("Error detected in Markup declaration");if(!o)return e.fatalError("Error in internal subset at position "+r.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}function ra(r,e,t,n,i){var s=ta(r,e);switch(i?s.char(2).toUpperCase():s.char(2)){case"-":var o=s.getMatch(C.Comment);return o?(t.comment(o,C.COMMENT_START.length,o.length-C.COMMENT_START.length-C.COMMENT_END.length),s.getIndex()):n.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var a=s.getMatch(C.CDSect);return a?!i&&!t.currentElement?n.fatalError("CDATA outside of element"):(t.startCDATA(),t.characters(a,C.CDATA_START.length,a.length-C.CDATA_START.length-C.CDATA_END.length),t.endCDATA(),s.getIndex()):n.fatalError("Invalid CDATA starting at position "+e);case"D":{if(t.doc&&t.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+s.getIndex());if(i?!s.substringStartsWithCaseInsensitive(C.DOCTYPE_DECL_START):!s.substringStartsWith(C.DOCTYPE_DECL_START))return n.fatalError("Expected "+C.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(C.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+C.DOCTYPE_DECL_START+" at position "+s.getIndex());var l={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(l.name=s.getMatch(C.Name),!l.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+s.getIndex());if(i&&l.name.toLowerCase()!=="html"&&n.warning("Unexpected DOCTYPE in HTML document at position "+s.getIndex()),s.skipBlanks(),s.substringStartsWith(C.PUBLIC)||s.substringStartsWith(C.SYSTEM)){var u=C.ExternalID_match.exec(s.substringFromIndex());if(!u)return n.fatalError("doctype external id is not well-formed at position "+s.getIndex());u.groups.SystemLiteralOnly!==void 0?l.systemId=u.groups.SystemLiteralOnly:(l.systemId=u.groups.SystemLiteral,l.publicId=u.groups.PubidLiteral),s.skip(u[0].length)}else if(i&&s.substringStartsWithCaseInsensitive(C.SYSTEM)){if(s.skip(C.SYSTEM.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+C.SYSTEM+" at position "+s.getIndex());if(l.systemId=s.getMatch(C.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return n.fatalError("Expected "+C.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+C.SYSTEM+" at position "+s.getIndex())}return i&&l.systemId&&!C.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),i||(s.skipBlanks(),l.internalSubset=Md(s,n)),s.skipBlanks(),s.char()!==">"?n.fatalError("doctype not terminated with > at position "+s.getIndex()):(s.skip(1),t.startDTD(l.name,l.publicId,l.systemId,l.internalSubset),t.endDTD(),s.getIndex())}default:return n.fatalError('Not well-formed XML starting with "<!" at position '+e)}}function Ld(r,e,t,n){var i=r.substring(e).match(C.PI);if(!i)return n.fatalError("Invalid processing instruction starting at position "+e);if(i[1].toLowerCase()==="xml"){if(e>0)return n.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!C.XMLDecl.test(r.substring(e)))return n.fatalError("xml declaration is not well-formed")}return t.processingInstruction(i[1],i[2]),e+i[0].length}function na(){this.attributeNames=Object.create(null)}na.prototype={setTagName:function(r){if(!C.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,e,t){if(!C.QName_exact.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:e,offset:t}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};kn.XMLReader=ea;kn.parseUtils=ta;kn.parseDoctypeCommentOrCData=ra});var da=Ge(zt=>{"use strict";var mt=ht(),Fd=Pi(),$d=fr(),sa=Yo(),Pd=ia(),qd=Fd.DOMImplementation,Ud=mt.hasDefaultHTMLNamespace,jd=mt.isHTMLMimeType,zd=mt.isValidMimeType,la=mt.MIME_TYPE,Ui=mt.NAMESPACE,oa=$d.ParseError,Vd=Pd.XMLReader;function ua(r){return r.replace(/\r[\n\u0085]/g,`
|
|
4
|
-
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
5
|
-
`)}function ca(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||mt.assign,this.domHandler=r.domHandler||xn,this.onError=r.onError||r.errorHandler,r.errorHandler&&typeof r.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");r.errorHandler&&r.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=r.normalizeLineEndings||ua,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}ca.prototype.parseFromString=function(r,e){if(!zd(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var t=this.assign(Object.create(null),this.xmlns),n=sa.XML_ENTITIES,i=t[""]||null;Ud(e)?(n=sa.HTML_ENTITIES,i=Ui.HTML):e===la.XML_SVG_IMAGE&&(i=Ui.SVG),t[""]=i,t.xml=t.xml||Ui.XML;var s=new this.domHandler({mimeType:e,defaultNamespace:i,onError:this.onError}),o=this.locator?{}:void 0;this.locator&&s.setDocumentLocator(o);var a=new Vd;a.errorHandler=s,a.domBuilder=s;var l=!mt.isHTMLMimeType(e);return l&&typeof r!="string"&&a.errorHandler.fatalError("source is not a string"),a.parse(this.normalizeLineEndings(String(r)),t,n),s.doc.documentElement||a.errorHandler.fatalError("missing root element"),s.doc};function xn(r){var e=r||{};this.mimeType=e.mimeType||la.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}function jt(r,e){e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber}xn.prototype={startDocument:function(){var r=new qd;this.doc=jd(this.mimeType)?r.createHTMLDocument(!1):r.createDocument(this.defaultNamespace,"")},startElement:function(r,e,t,n){var i=this.doc,s=i.createElementNS(r,t||e),o=n.length;En(this,s),this.currentElement=s,this.locator&&jt(this.locator,s);for(var a=0;a<o;a++){var r=n.getURI(a),l=n.getValue(a),t=n.getQName(a),u=i.createAttributeNS(r,t);this.locator&&jt(n.getLocator(a),u),u.value=u.nodeValue=l,s.setAttributeNode(u)}},endElement:function(r,e,t){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(r,e){},endPrefixMapping:function(r){},processingInstruction:function(r,e){var t=this.doc.createProcessingInstruction(r,e);this.locator&&jt(this.locator,t),En(this,t)},ignorableWhitespace:function(r,e,t){},characters:function(r,e,t){if(r=aa.apply(this,arguments),r){if(this.cdata)var n=this.doc.createCDATASection(r);else var n=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(r)&&this.doc.appendChild(n),this.locator&&jt(this.locator,n)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){r&&(r.lineNumber=0),this.locator=r},comment:function(r,e,t){r=aa.apply(this,arguments);var n=this.doc.createComment(r);this.locator&&jt(this.locator,n),En(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,e,t,n){var i=this.doc.implementation;if(i&&i.createDocumentType){var s=i.createDocumentType(r,e,t,n);this.locator&&jt(this.locator,s),En(this,s),this.doc.doctype=s}},reportError:function(r,e){if(typeof this.onError=="function")try{this.onError(r,e,this)}catch(t){throw new oa("Reporting "+r+' "'+e+'" caused '+t,this.locator)}else console.error("[xmldom "+r+"] "+e,Hd(this.locator))},warning:function(r){this.reportError("warning",r)},error:function(r){this.reportError("error",r)},fatalError:function(r,e){throw this.reportError("fatalError",r),new oa(r,this.locator,e)}};function Hd(r){if(r)return`
|
|
6
|
-
@#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}function aa(r,e,t){return typeof r=="string"?r.substr(e,t):r.length>=e+t||e?new java.lang.String(r,e,t)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){xn.prototype[r]=function(){return null}});function En(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}function Wd(r){if(r==="error")throw"onErrorStopParsing"}function Gd(){throw"onWarningStopParsing"}zt.__DOMHandler=xn;zt.DOMParser=ca;zt.normalizeLineEndings=ua;zt.onErrorStopParsing=Wd;zt.onWarningStopParsing=Gd});var ji=Ge(M=>{"use strict";var Vt=ht();M.assign=Vt.assign;M.hasDefaultHTMLNamespace=Vt.hasDefaultHTMLNamespace;M.isHTMLMimeType=Vt.isHTMLMimeType;M.isValidMimeType=Vt.isValidMimeType;M.MIME_TYPE=Vt.MIME_TYPE;M.NAMESPACE=Vt.NAMESPACE;var An=fr();M.DOMException=An.DOMException;M.DOMExceptionName=An.DOMExceptionName;M.ExceptionCode=An.ExceptionCode;M.ParseError=An.ParseError;var te=Pi();M.Attr=te.Attr;M.CDATASection=te.CDATASection;M.CharacterData=te.CharacterData;M.Comment=te.Comment;M.Document=te.Document;M.DocumentFragment=te.DocumentFragment;M.DocumentType=te.DocumentType;M.DOMImplementation=te.DOMImplementation;M.Element=te.Element;M.Entity=te.Entity;M.EntityReference=te.EntityReference;M.LiveNodeList=te.LiveNodeList;M.NamedNodeMap=te.NamedNodeMap;M.Node=te.Node;M.NodeList=te.NodeList;M.Notation=te.Notation;M.ProcessingInstruction=te.ProcessingInstruction;M.Text=te.Text;M.XMLSerializer=te.XMLSerializer;var Dn=da();M.DOMParser=Dn.DOMParser;M.normalizeLineEndings=Dn.normalizeLineEndings;M.onErrorStopParsing=Dn.onErrorStopParsing;M.onWarningStopParsing=Dn.onWarningStopParsing});var Et={"assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt":new URL("./files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt",import.meta.url),"assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt":new URL("./files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt",import.meta.url)};import{Bag as ul,sourceTarget as Zt}from"@gramlot/gramlot";function Wr(r,e,{align:t="start",matchWidth:n=!1,inset:i=0,placement:s="bottom",point:o=null}={}){let a=e.ownerDocument.defaultView,l=o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0}:e.getBoundingClientRect(),u=Math.max(0,a.innerWidth-16);r.style.setProperty("--gramlot-popup-available-width",`${u}px`),n&&(r.style.width=`${Math.min(Math.max(0,l.width-2*i),u)}px`),r.style.removeProperty("--gramlot-popup-available-height");let c=r.getBoundingClientRect();if(s==="side"){let _=Math.max(0,a.innerWidth-8-l.right-3),v=Math.max(0,l.left-8-3),w=c.width>_&&v>_;r.style.setProperty("--gramlot-popup-available-width",`${w?v:_}px`),r.style.setProperty("--gramlot-popup-available-height",`${Math.max(0,a.innerHeight-16)}px`);let E=r.getBoundingClientRect(),T=w?l.left-E.width-3:l.right+3;r.style.left=`${Math.max(8,Math.min(T,a.innerWidth-E.width-8))}px`,r.style.top=`${Math.max(8,Math.min(l.top,a.innerHeight-E.height-8))}px`;return}let d=Math.max(0,a.innerHeight-8-l.bottom-3),f=Math.max(0,l.top-8-3),h=c.height>d&&f>d;r.style.setProperty("--gramlot-popup-available-height",`${h?f:d}px`);let p=r.getBoundingClientRect(),m=t==="end"?l.right-p.width-i:l.left+i,g=h?l.top-p.height-3:l.bottom+3;r.style.left=`${Math.max(8,Math.min(m,a.innerWidth-p.width-8))}px`,r.style.top=`${Math.max(8,Math.min(g,a.innerHeight-p.height-8))}px`}/*!
|
|
7
|
-
* decimal.js v10.6.0
|
|
8
|
-
* An arbitrary-precision Decimal type for JavaScript.
|
|
9
|
-
* https://github.com/MikeMcl/decimal.js
|
|
10
|
-
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
11
|
-
* MIT Licence
|
|
12
|
-
*/var xt=9e15,Ke=1e9,si="0123456789abcdef",Yr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Zr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",oi={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-xt,maxE:xt,crypto:!1},Bs,Pe,N=!0,Jr="[DecimalError] ",Ze=Jr+"Invalid argument: ",Is=Jr+"Precision limit exceeded",Rs=Jr+"crypto unavailable",Ms="[object Decimal]",le=Math.floor,Q=Math.pow,Nl=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Sl=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Cl=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ls=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ae=1e7,A=7,Ol=9007199254740991,Bl=Yr.length-1,ai=Zr.length-1,b={toStringTag:Ms};b.absoluteValue=b.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),x(r)};b.ceil=function(){return x(new this.constructor(this),this.e+1,2)};b.clampedTo=b.clamp=function(r,e){var t,n=this,i=n.constructor;if(r=new i(r),e=new i(e),!r.s||!e.s)return new i(NaN);if(r.gt(e))throw Error(Ze+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};b.comparedTo=b.cmp=function(r){var e,t,n,i,s=this,o=s.d,a=(r=new s.constructor(r)).d,l=s.s,u=r.s;if(!o||!a)return!l||!u?NaN:l!==u?l:o===a?0:!o^l<0?1:-1;if(!o[0]||!a[0])return o[0]?l:a[0]?-u:0;if(l!==u)return l;if(s.e!==r.e)return s.e>r.e^l<0?1:-1;for(n=o.length,i=a.length,e=0,t=n<i?n:i;e<t;++e)if(o[e]!==a[e])return o[e]>a[e]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};b.cosine=b.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+A,n.rounding=1,t=Il(n,Us(n,t)),n.precision=r,n.rounding=e,x(Pe==2||Pe==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};b.cubeRoot=b.cbrt=function(){var r,e,t,n,i,s,o,a,l,u,c=this,d=c.constructor;if(!c.isFinite()||c.isZero())return new d(c);for(N=!1,s=c.s*Q(c.s*c,1/3),!s||Math.abs(s)==1/0?(t=se(c.d),r=c.e,(s=(r-t.length+1)%3)&&(t+=s==1||s==-2?"0":"00"),s=Q(t,1/3),r=le((r+1)/3)-(r%3==(r<0?-1:2)),s==1/0?t="5e"+r:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new d(t),n.s=c.s):n=new d(s.toString()),o=(r=d.precision)+3;;)if(a=n,l=a.times(a).times(a),u=l.plus(c),n=j(u.plus(c).times(a),u.plus(l),o+2,1),se(a.d).slice(0,o)===(t=se(n.d)).slice(0,o))if(t=t.slice(o-3,o+1),t=="9999"||!i&&t=="4999"){if(!i&&(x(a,r+1,0),a.times(a).times(a).eq(c))){n=a;break}o+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(x(n,r+1,1),e=!n.times(n).times(n).eq(c));break}return N=!0,x(n,r,d.rounding,e)};b.decimalPlaces=b.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-le(this.e/A))*A,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};b.dividedBy=b.div=function(r){return j(this,new this.constructor(r))};b.dividedToIntegerBy=b.divToInt=function(r){var e=this,t=e.constructor;return x(j(e,new t(r),0,1,1),t.precision,t.rounding)};b.equals=b.eq=function(r){return this.cmp(r)===0};b.floor=function(){return x(new this.constructor(this),this.e+1,3)};b.greaterThan=b.gt=function(r){return this.cmp(r)>0};b.greaterThanOrEqualTo=b.gte=function(r){var e=this.cmp(r);return e==1||e===0};b.hyperbolicCosine=b.cosh=function(){var r,e,t,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;t=o.precision,n=o.rounding,o.precision=t+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(r=Math.ceil(i/3),e=(1/en(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),s=At(o,1,s.times(e),new o(1),!0);for(var l,u=r,c=new o(8);u--;)l=s.times(s),s=a.minus(l.times(c.minus(l.times(c))));return x(s,o.precision=t,o.rounding=n,!0)};b.hyperbolicSine=b.sinh=function(){var r,e,t,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(e=s.precision,t=s.rounding,s.precision=e+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=At(s,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/en(5,r)),i=At(s,2,i,i,!0);for(var o,a=new s(5),l=new s(16),u=new s(20);r--;)o=i.times(i),i=i.times(a.plus(o.times(l.times(o).plus(u))))}return s.precision=e,s.rounding=t,x(i,e,t,!0)};b.hyperbolicTangent=b.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,j(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};b.inverseCosine=b.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,i=e.rounding;return t!==-1?t===0?r.isNeg()?Se(e,n,i):new e(0):new e(NaN):r.isZero()?Se(e,n+4,i).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=i,r.times(2))};b.inverseHyperbolicCosine=b.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,N=!1,t=t.times(t).minus(1).sqrt().plus(t),N=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};b.inverseHyperbolicSine=b.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,N=!1,t=t.times(t).plus(1).sqrt().plus(t),N=!0,n.precision=r,n.rounding=e,t.ln())};b.inverseHyperbolicTangent=b.atanh=function(){var r,e,t,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=s.precision,e=s.rounding,n=i.sd(),Math.max(n,r)<2*-i.e-1?x(new s(i),r,e,!0):(s.precision=t=n-i.e,i=j(i.plus(1),new s(1).minus(i),t+r,1),s.precision=r+4,s.rounding=1,i=i.ln(),s.precision=r,s.rounding=e,i.times(.5))):new s(NaN)};b.inverseSine=b.asin=function(){var r,e,t,n,i=this,s=i.constructor;return i.isZero()?new s(i):(e=i.abs().cmp(1),t=s.precision,n=s.rounding,e!==-1?e===0?(r=Se(s,t+4,n).times(.5),r.s=i.s,r):new s(NaN):(s.precision=t+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=t,s.rounding=n,i.times(2)))};b.inverseTangent=b.atan=function(){var r,e,t,n,i,s,o,a,l,u=this,c=u.constructor,d=c.precision,f=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&d+4<=ai)return o=Se(c,d+4,f).times(.25),o.s=u.s,o}else{if(!u.s)return new c(NaN);if(d+4<=ai)return o=Se(c,d+4,f).times(.5),o.s=u.s,o}for(c.precision=a=d+10,c.rounding=1,t=Math.min(28,a/A+2|0),r=t;r;--r)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(N=!1,e=Math.ceil(a/A),n=1,l=u.times(u),o=new c(u),i=u;r!==-1;)if(i=i.times(l),s=o.minus(i.div(n+=2)),i=i.times(l),o=s.plus(i.div(n+=2)),o.d[e]!==void 0)for(r=e;o.d[r]===s.d[r]&&r--;);return t&&(o=o.times(2<<t-1)),N=!0,x(o,c.precision=d,c.rounding=f,!0)};b.isFinite=function(){return!!this.d};b.isInteger=b.isInt=function(){return!!this.d&&le(this.e/A)>this.d.length-2};b.isNaN=function(){return!this.s};b.isNegative=b.isNeg=function(){return this.s<0};b.isPositive=b.isPos=function(){return this.s>0};b.isZero=function(){return!!this.d&&this.d[0]===0};b.lessThan=b.lt=function(r){return this.cmp(r)<0};b.lessThanOrEqualTo=b.lte=function(r){return this.cmp(r)<1};b.logarithm=b.log=function(r){var e,t,n,i,s,o,a,l,u=this,c=u.constructor,d=c.precision,f=c.rounding,h=5;if(r==null)r=new c(10),e=!0;else{if(r=new c(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new c(NaN);e=r.eq(10)}if(t=u.d,u.s<0||!t||!t[0]||u.eq(1))return new c(t&&!t[0]?-1/0:u.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)s=!0;else{for(i=t[0];i%10===0;)i/=10;s=i!==1}if(N=!1,a=d+h,o=Ye(u,a),n=e?Kr(c,a+10):Ye(r,a),l=j(o,n,a,1),Qt(l.d,i=d,f))do if(a+=10,o=Ye(u,a),n=e?Kr(c,a+10):Ye(r,a),l=j(o,n,a,1),!s){+se(l.d).slice(i+1,i+15)+1==1e14&&(l=x(l,d+1,0));break}while(Qt(l.d,i+=10,f));return N=!0,x(l,d,f)};b.minus=b.sub=function(r){var e,t,n,i,s,o,a,l,u,c,d,f,h=this,p=h.constructor;if(r=new p(r),!h.d||!r.d)return!h.s||!r.s?r=new p(NaN):h.d?r.s=-r.s:r=new p(r.d||h.s!==r.s?h:NaN),r;if(h.s!=r.s)return r.s=-r.s,h.plus(r);if(u=h.d,f=r.d,a=p.precision,l=p.rounding,!u[0]||!f[0]){if(f[0])r.s=-r.s;else if(u[0])r=new p(h);else return new p(l===3?-0:0);return N?x(r,a,l):r}if(t=le(r.e/A),c=le(h.e/A),u=u.slice(),s=c-t,s){for(d=s<0,d?(e=u,s=-s,o=f.length):(e=f,t=c,o=u.length),n=Math.max(Math.ceil(a/A),o)+2,s>n&&(s=n,e.length=1),e.reverse(),n=s;n--;)e.push(0);e.reverse()}else{for(n=u.length,o=f.length,d=n<o,d&&(o=n),n=0;n<o;n++)if(u[n]!=f[n]){d=u[n]<f[n];break}s=0}for(d&&(e=u,u=f,f=e,r.s=-r.s),o=u.length,n=f.length-o;n>0;--n)u[o++]=0;for(n=f.length;n>s;){if(u[--n]<f[n]){for(i=n;i&&u[--i]===0;)u[i]=Ae-1;--u[i],u[n]+=Ae}u[n]-=f[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--t;return u[0]?(r.d=u,r.e=Qr(u,t),N?x(r,a,l):r):new p(l===3?-0:0)};b.modulo=b.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?x(new n(t),n.precision,n.rounding):(N=!1,n.modulo==9?(e=j(t,r.abs(),0,3,1),e.s*=r.s):e=j(t,r,0,n.modulo,1),e=e.times(r),N=!0,t.minus(e))};b.naturalExponential=b.exp=function(){return li(this)};b.naturalLogarithm=b.ln=function(){return Ye(this)};b.negated=b.neg=function(){var r=new this.constructor(this);return r.s=-r.s,x(r)};b.plus=b.add=function(r){var e,t,n,i,s,o,a,l,u,c,d=this,f=d.constructor;if(r=new f(r),!d.d||!r.d)return!d.s||!r.s?r=new f(NaN):d.d||(r=new f(r.d||d.s===r.s?d:NaN)),r;if(d.s!=r.s)return r.s=-r.s,d.minus(r);if(u=d.d,c=r.d,a=f.precision,l=f.rounding,!u[0]||!c[0])return c[0]||(r=new f(d)),N?x(r,a,l):r;if(s=le(d.e/A),n=le(r.e/A),u=u.slice(),i=s-n,i){for(i<0?(t=u,i=-i,o=c.length):(t=c,n=s,o=u.length),s=Math.ceil(a/A),o=s>o?s+1:o+1,i>o&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(o=u.length,i=c.length,o-i<0&&(i=o,t=c,c=u,u=t),e=0;i;)e=(u[--i]=u[i]+c[i]+e)/Ae|0,u[i]%=Ae;for(e&&(u.unshift(e),++n),o=u.length;u[--o]==0;)u.pop();return r.d=u,r.e=Qr(u,n),N?x(r,a,l):r};b.precision=b.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Ze+r);return t.d?(e=Fs(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};b.round=function(){var r=this,e=r.constructor;return x(new e(r),r.e+1,e.rounding)};b.sine=b.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+A,n.rounding=1,t=Ml(n,Us(n,t)),n.precision=r,n.rounding=e,x(Pe>2?t.neg():t,r,e,!0)):new n(NaN)};b.squareRoot=b.sqrt=function(){var r,e,t,n,i,s,o=this,a=o.d,l=o.e,u=o.s,c=o.constructor;if(u!==1||!a||!a[0])return new c(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(N=!1,u=Math.sqrt(+o),u==0||u==1/0?(e=se(a),(e.length+l)%2==0&&(e+="0"),u=Math.sqrt(e),l=le((l+1)/2)-(l<0||l%2),u==1/0?e="5e"+l:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+l),n=new c(e)):n=new c(u.toString()),t=(l=c.precision)+3;;)if(s=n,n=s.plus(j(o,s,t+2,1)).times(.5),se(s.d).slice(0,t)===(e=se(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(x(s,l+1,0),s.times(s).eq(o))){n=s;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(x(n,l+1,1),r=!n.times(n).eq(o));break}return N=!0,x(n,l,c.rounding,r)};b.tangent=b.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=j(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,x(Pe==2||Pe==4?t.neg():t,r,e,!0)):new n(NaN)};b.times=b.mul=function(r){var e,t,n,i,s,o,a,l,u,c=this,d=c.constructor,f=c.d,h=(r=new d(r)).d;if(r.s*=c.s,!f||!f[0]||!h||!h[0])return new d(!r.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?r.s/0:r.s*0);for(t=le(c.e/A)+le(r.e/A),l=f.length,u=h.length,l<u&&(s=f,f=h,h=s,o=l,l=u,u=o),s=[],o=l+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(e=0,i=l+n;i>n;)a=s[i]+h[n]*f[i-n-1]+e,s[i--]=a%Ae|0,e=a/Ae|0;s[i]=(s[i]+e)%Ae|0}for(;!s[--o];)s.pop();return e?++t:s.shift(),r.d=s,r.e=Qr(s,t),N?x(r,d.precision,d.rounding):r};b.toBinary=function(r,e){return ui(this,2,r,e)};b.toDecimalPlaces=b.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(he(r,0,Ke),e===void 0?e=n.rounding:he(e,0,8),x(t,r+t.e+1,e))};b.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ce(n,!0):(he(r,0,Ke),e===void 0?e=i.rounding:he(e,0,8),n=x(new i(n),r+1,e),t=Ce(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};b.toFixed=function(r,e){var t,n,i=this,s=i.constructor;return r===void 0?t=Ce(i):(he(r,0,Ke),e===void 0?e=s.rounding:he(e,0,8),n=x(new s(i),r+i.e+1,e),t=Ce(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};b.toFraction=function(r){var e,t,n,i,s,o,a,l,u,c,d,f,h=this,p=h.d,m=h.constructor;if(!p)return new m(h);if(u=t=new m(1),n=l=new m(0),e=new m(n),s=e.e=Fs(p)-h.e-1,o=s%A,e.d[0]=Q(10,o<0?A+o:o),r==null)r=s>0?e:u;else{if(a=new m(r),!a.isInt()||a.lt(u))throw Error(Ze+a);r=a.gt(e)?s>0?e:u:a}for(N=!1,a=new m(se(p)),c=m.precision,m.precision=s=p.length*A*2;d=j(a,e,0,1,1),i=t.plus(d.times(n)),i.cmp(r)!=1;)t=n,n=i,i=u,u=l.plus(d.times(i)),l=i,i=e,e=a.minus(d.times(i)),a=i;return i=j(r.minus(t),n,0,1,1),l=l.plus(i.times(u)),t=t.plus(i.times(n)),l.s=u.s=h.s,f=j(u,n,s,1).minus(h).abs().cmp(j(l,t,s,1).minus(h).abs())<1?[u,n]:[l,t],m.precision=c,N=!0,f};b.toHexadecimal=b.toHex=function(r,e){return ui(this,16,r,e)};b.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:he(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(N=!1,t=j(t,r,0,e,1).times(r),N=!0,x(t)):(r.s=t.s,t=r),t};b.toNumber=function(){return+this};b.toOctal=function(r,e){return ui(this,8,r,e)};b.toPower=b.pow=function(r){var e,t,n,i,s,o,a=this,l=a.constructor,u=+(r=new l(r));if(!a.d||!r.d||!a.d[0]||!r.d[0])return new l(Q(+a,u));if(a=new l(a),a.eq(1))return a;if(n=l.precision,s=l.rounding,r.eq(1))return x(a,n,s);if(e=le(r.e/A),e>=r.d.length-1&&(t=u<0?-u:u)<=Ol)return i=$s(l,a,t,n),r.s<0?new l(1).div(i):x(i,n,s);if(o=a.s,o<0){if(e<r.d.length-1)return new l(NaN);if((r.d[e]&1)==0&&(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return t=Q(+a,u),e=t==0||!isFinite(t)?le(u*(Math.log("0."+se(a.d))/Math.LN10+a.e+1)):new l(t+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?o/0:0):(N=!1,l.rounding=a.s=1,t=Math.min(12,(e+"").length),i=li(r.times(Ye(a,n+t)),n),i.d&&(i=x(i,n+5,1),Qt(i.d,n,s)&&(e=n+10,i=x(li(r.times(Ye(a,e+t)),e),e+5,1),+se(i.d).slice(n+1,n+15)+1==1e14&&(i=x(i,n+1,0)))),i.s=o,N=!0,l.rounding=s,x(i,n,s))};b.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ce(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(he(r,1,Ke),e===void 0?e=i.rounding:he(e,0,8),n=x(new i(n),r,e),t=Ce(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};b.toSignificantDigits=b.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(he(r,1,Ke),e===void 0?e=n.rounding:he(e,0,8)),x(new n(t),r,e)};b.toString=function(){var r=this,e=r.constructor,t=Ce(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};b.truncated=b.trunc=function(){return x(new this.constructor(this),this.e+1,1)};b.valueOf=b.toJSON=function(){var r=this,e=r.constructor,t=Ce(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function se(r){var e,t,n,i=r.length-1,s="",o=r[0];if(i>0){for(s+=o,e=1;e<i;e++)n=r[e]+"",t=A-n.length,t&&(s+=Xe(t)),s+=n;o=r[e],n=o+"",t=A-n.length,t&&(s+=Xe(t))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function he(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Ze+r)}function Qt(r,e,t,n){var i,s,o,a;for(s=r[0];s>=10;s/=10)--e;return--e<0?(e+=A,i=0):(i=Math.ceil((e+1)/A),e%=A),s=Q(10,A-e),a=r[i]%s|0,n==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),o=t<4&&a==99999||t>3&&a==49999||a==5e4||a==0):o=(t<4&&a+1==s||t>3&&a+1==s/2)&&(r[i+1]/s/100|0)==Q(10,e-2)-1||(a==s/2||a==0)&&(r[i+1]/s/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),o=(n||t<4)&&a==9999||!n&&t>3&&a==4999):o=((n||t<4)&&a+1==s||!n&&t>3&&a+1==s/2)&&(r[i+1]/s/1e3|0)==Q(10,e-3)-1,o}function Gr(r,e,t){for(var n,i=[0],s,o=0,a=r.length;o<a;){for(s=i.length;s--;)i[s]*=e;for(i[0]+=si.indexOf(r.charAt(o++)),n=0;n<i.length;n++)i[n]>t-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/t|0,i[n]%=t)}return i.reverse()}function Il(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/en(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=At(r,1,e.times(i),new r(1));for(var s=t;s--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return r.precision-=t,e}var j=(function(){function r(n,i,s){var o,a=0,l=n.length;for(n=n.slice();l--;)o=n[l]*i+a,n[l]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function e(n,i,s,o){var a,l;if(s!=o)l=s>o?1:-1;else for(a=l=0;a<s;a++)if(n[a]!=i[a]){l=n[a]>i[a]?1:-1;break}return l}function t(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,l){var u,c,d,f,h,p,m,g,_,v,w,E,T,I,z,q,ie,$e,J,de,ye=n.constructor,U=n.s==i.s?1:-1,Z=n.d,O=i.d;if(!Z||!Z[0]||!O||!O[0])return new ye(!n.s||!i.s||(Z?O&&Z[0]==O[0]:!O)?NaN:Z&&Z[0]==0||!O?U*0:U/0);for(l?(h=1,c=n.e-i.e):(l=Ae,h=A,c=le(n.e/h)-le(i.e/h)),J=O.length,ie=Z.length,_=new ye(U),v=_.d=[],d=0;O[d]==(Z[d]||0);d++);if(O[d]>(Z[d]||0)&&c--,s==null?(I=s=ye.precision,o=ye.rounding):a?I=s+(n.e-i.e)+1:I=s,I<0)v.push(1),p=!0;else{if(I=I/h+2|0,d=0,J==1){for(f=0,O=O[0],I++;(d<ie||f)&&I--;d++)z=f*l+(Z[d]||0),v[d]=z/O|0,f=z%O|0;p=f||d<ie}else{for(f=l/(O[0]+1)|0,f>1&&(O=r(O,f,l),Z=r(Z,f,l),J=O.length,ie=Z.length),q=J,w=Z.slice(0,J),E=w.length;E<J;)w[E++]=0;de=O.slice(),de.unshift(0),$e=O[0],O[1]>=l/2&&++$e;do f=0,u=e(O,w,J,E),u<0?(T=w[0],J!=E&&(T=T*l+(w[1]||0)),f=T/$e|0,f>1?(f>=l&&(f=l-1),m=r(O,f,l),g=m.length,E=w.length,u=e(m,w,g,E),u==1&&(f--,t(m,J<g?de:O,g,l))):(f==0&&(u=f=1),m=O.slice()),g=m.length,g<E&&m.unshift(0),t(w,m,E,l),u==-1&&(E=w.length,u=e(O,w,J,E),u<1&&(f++,t(w,J<E?de:O,E,l))),E=w.length):u===0&&(f++,w=[0]),v[d++]=f,u&&w[0]?w[E++]=Z[q]||0:(w=[Z[q]],E=1);while((q++<ie||w[0]!==void 0)&&I--);p=w[0]!==void 0}v[0]||v.shift()}if(h==1)_.e=c,Bs=p;else{for(d=1,f=v[0];f>=10;f/=10)d++;_.e=d+c*h-1,x(_,a?s+_.e+1:s,o,p)}return _}})();function x(r,e,t,n){var i,s,o,a,l,u,c,d,f,h=r.constructor;e:if(e!=null){if(d=r.d,!d)return r;for(i=1,a=d[0];a>=10;a/=10)i++;if(s=e-i,s<0)s+=A,o=e,c=d[f=0],l=c/Q(10,i-o-1)%10|0;else if(f=Math.ceil((s+1)/A),a=d.length,f>=a)if(n){for(;a++<=f;)d.push(0);c=l=0,i=1,s%=A,o=s-A+1}else break e;else{for(c=a=d[f],i=1;a>=10;a/=10)i++;s%=A,o=s-A+i,l=o<0?0:c/Q(10,i-o-1)%10|0}if(n=n||e<0||d[f+1]!==void 0||(o<0?c:c%Q(10,i-o-1)),u=t<4?(l||n)&&(t==0||t==(r.s<0?3:2)):l>5||l==5&&(t==4||n||t==6&&(s>0?o>0?c/Q(10,i-o):0:d[f-1])%10&1||t==(r.s<0?8:7)),e<1||!d[0])return d.length=0,u?(e-=r.e+1,d[0]=Q(10,(A-e%A)%A),r.e=-e||0):d[0]=r.e=0,r;if(s==0?(d.length=f,a=1,f--):(d.length=f+1,a=Q(10,A-s),d[f]=o>0?(c/Q(10,i-o)%Q(10,o)|0)*a:0),u)for(;;)if(f==0){for(s=1,o=d[0];o>=10;o/=10)s++;for(o=d[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(r.e++,d[0]==Ae&&(d[0]=1));break}else{if(d[f]+=a,d[f]!=Ae)break;d[f--]=0,a=1}for(s=d.length;d[--s]===0;)d.pop()}return N&&(r.e>h.maxE?(r.d=null,r.e=NaN):r.e<h.minE&&(r.e=0,r.d=[0])),r}function Ce(r,e,t){if(!r.isFinite())return qs(r);var n,i=r.e,s=se(r.d),o=s.length;return e?(t&&(n=t-o)>0?s=s.charAt(0)+"."+s.slice(1)+Xe(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(r.e<0?"e":"e+")+r.e):i<0?(s="0."+Xe(-i-1)+s,t&&(n=t-o)>0&&(s+=Xe(n))):i>=o?(s+=Xe(i+1-o),t&&(n=t-i-1)>0&&(s=s+"."+Xe(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),t&&(n=t-o)>0&&(i+1===o&&(s+="."),s+=Xe(n))),s}function Qr(r,e){var t=r[0];for(e*=A;t>=10;t/=10)e++;return e}function Kr(r,e,t){if(e>Bl)throw N=!0,t&&(r.precision=t),Error(Is);return x(new r(Yr),e,1,!0)}function Se(r,e,t){if(e>ai)throw Error(Is);return x(new r(Zr),e,t,!0)}function Fs(r){var e=r.length-1,t=e*A+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function Xe(r){for(var e="";r--;)e+="0";return e}function $s(r,e,t,n){var i,s=new r(1),o=Math.ceil(n/A+4);for(N=!1;;){if(t%2&&(s=s.times(e),Cs(s.d,o)&&(i=!0)),t=le(t/2),t===0){t=s.d.length-1,i&&s.d[t]===0&&++s.d[t];break}e=e.times(e),Cs(e.d,o)}return N=!0,s}function Ss(r){return r.d[r.d.length-1]&1}function Ps(r,e,t){for(var n,i,s=new r(e[0]),o=0;++o<e.length;){if(i=new r(e[o]),!i.s){s=i;break}n=s.cmp(i),(n===t||n===0&&s.s===t)&&(s=i)}return s}function li(r,e){var t,n,i,s,o,a,l,u=0,c=0,d=0,f=r.constructor,h=f.rounding,p=f.precision;if(!r.d||!r.d[0]||r.e>17)return new f(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(N=!1,l=p):l=e,a=new f(.03125);r.e>-2;)r=r.times(a),d+=5;for(n=Math.log(Q(2,d))/Math.LN10*2+5|0,l+=n,t=s=o=new f(1),f.precision=l;;){if(s=x(s.times(r),l,1),t=t.times(++c),a=o.plus(j(s,t,l,1)),se(a.d).slice(0,l)===se(o.d).slice(0,l)){for(i=d;i--;)o=x(o.times(o),l,1);if(e==null)if(u<3&&Qt(o.d,l-n,h,u))f.precision=l+=10,t=s=a=new f(1),c=0,u++;else return x(o,f.precision=p,h,N=!0);else return f.precision=p,o}o=a}}function Ye(r,e){var t,n,i,s,o,a,l,u,c,d,f,h=1,p=10,m=r,g=m.d,_=m.constructor,v=_.rounding,w=_.precision;if(m.s<0||!g||!g[0]||!m.e&&g[0]==1&&g.length==1)return new _(g&&!g[0]?-1/0:m.s!=1?NaN:g?0:m);if(e==null?(N=!1,c=w):c=e,_.precision=c+=p,t=se(g),n=t.charAt(0),Math.abs(s=m.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)m=m.times(r),t=se(m.d),n=t.charAt(0),h++;s=m.e,n>1?(m=new _("0."+t),s++):m=new _(n+"."+t.slice(1))}else return u=Kr(_,c+2,w).times(s+""),m=Ye(new _(n+"."+t.slice(1)),c-p).plus(u),_.precision=w,e==null?x(m,w,v,N=!0):m;for(d=m,l=o=m=j(m.minus(1),m.plus(1),c,1),f=x(m.times(m),c,1),i=3;;){if(o=x(o.times(f),c,1),u=l.plus(j(o,new _(i),c,1)),se(u.d).slice(0,c)===se(l.d).slice(0,c))if(l=l.times(2),s!==0&&(l=l.plus(Kr(_,c+2,w).times(s+""))),l=j(l,new _(h),c,1),e==null)if(Qt(l.d,c-p,v,a))_.precision=c+=p,u=o=m=j(d.minus(1),d.plus(1),c,1),f=x(m.times(m),c,1),i=a=1;else return x(l,_.precision=w,v,N=!0);else return _.precision=w,l;l=u,i+=2}}function qs(r){return String(r.s*r.s/0)}function Xr(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(n,i),e){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%A,t<0&&(n+=A),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=A;n<i;)r.d.push(+e.slice(n,n+=A));e=e.slice(n),n=A-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),N&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function Rl(r,e){var t,n,i,s,o,a,l,u,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Ls.test(e))return Xr(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(Sl.test(e))t=16,e=e.toLowerCase();else if(Nl.test(e))t=2;else if(Cl.test(e))t=8;else throw Error(Ze+e);for(s=e.search(/p/i),s>0?(l=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),s=e.indexOf("."),o=s>=0,n=r.constructor,o&&(e=e.replace(".",""),a=e.length,s=a-s,i=$s(n,new n(t),s,s*2)),u=Gr(e,t,Ae),c=u.length-1,s=c;u[s]===0;--s)u.pop();return s<0?new n(r.s*0):(r.e=Qr(u,c),r.d=u,N=!1,o&&(r=j(r,i,a*4)),l&&(r=r.times(Math.abs(l)<54?Q(2,l):er.pow(2,l))),N=!0,r)}function Ml(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:At(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/en(5,t)),e=At(r,2,e,e);for(var i,s=new r(5),o=new r(16),a=new r(20);t--;)i=e.times(e),e=e.times(s.plus(i.times(o.times(i).minus(a))));return e}function At(r,e,t,n,i){var s,o,a,l,u=1,c=r.precision,d=Math.ceil(c/A);for(N=!1,l=t.times(t),a=new r(n);;){if(o=j(a.times(l),new r(e++*e++),c,1),a=i?n.plus(o):n.minus(o),n=j(o.times(l),new r(e++*e++),c,1),o=a.plus(n),o.d[d]!==void 0){for(s=d;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s,u++}return N=!0,o.d.length=d+1,o}function en(r,e){for(var t=r;--e;)t*=r;return t}function Us(r,e){var t,n=e.s<0,i=Se(r,r.precision,1),s=i.times(.5);if(e=e.abs(),e.lte(s))return Pe=n?4:1,e;if(t=e.divToInt(i),t.isZero())Pe=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(s))return Pe=Ss(t)?n?2:3:n?4:1,e;Pe=Ss(t)?n?1:4:n?3:2}return e.minus(i).abs()}function ui(r,e,t,n){var i,s,o,a,l,u,c,d,f,h=r.constructor,p=t!==void 0;if(p?(he(t,1,Ke),n===void 0?n=h.rounding:he(n,0,8)):(t=h.precision,n=h.rounding),!r.isFinite())c=qs(r);else{for(c=Ce(r),o=c.indexOf("."),p?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,o>=0&&(c=c.replace(".",""),f=new h(1),f.e=c.length-o,f.d=Gr(Ce(f),10,i),f.e=f.d.length),d=Gr(c,10,i),s=l=d.length;d[--l]==0;)d.pop();if(!d[0])c=p?"0p+0":"0";else{if(o<0?s--:(r=new h(r),r.d=d,r.e=s,r=j(r,f,t,n,0,i),d=r.d,s=r.e,u=Bs),o=d[t],a=i/2,u=u||d[t+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(r.s<0?3:2)):o>a||o===a&&(n===4||u||n===6&&d[t-1]&1||n===(r.s<0?8:7)),d.length=t,u)for(;++d[--t]>i-1;)d[t]=0,t||(++s,d.unshift(1));for(l=d.length;!d[l-1];--l);for(o=0,c="";o<l;o++)c+=si.charAt(d[o]);if(p){if(l>1)if(e==16||e==8){for(o=e==16?4:3,--l;l%o;l++)c+="0";for(d=Gr(c,i,e),l=d.length;!d[l-1];--l);for(o=1,c="1.";o<l;o++)c+=si.charAt(d[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)c="0"+c;c="0."+c}else if(++s>l)for(s-=l;s--;)c+="0";else s<l&&(c=c.slice(0,s)+"."+c.slice(s))}c=(e==16?"0x":e==2?"0b":e==8?"0o":"")+c}return r.s<0?"-"+c:c}function Cs(r,e){if(r.length>e)return r.length=e,!0}function Ll(r){return new this(r).abs()}function Fl(r){return new this(r).acos()}function $l(r){return new this(r).acosh()}function Pl(r,e){return new this(r).plus(e)}function ql(r){return new this(r).asin()}function Ul(r){return new this(r).asinh()}function jl(r){return new this(r).atan()}function zl(r){return new this(r).atanh()}function Vl(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,s=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=Se(this,s,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Se(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Se(this,s,1).times(.5),t.s=r.s):e.s<0?(this.precision=s,this.rounding=1,t=this.atan(j(r,e,s,1)),e=Se(this,s,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(j(r,e,s,1)),t}function Hl(r){return new this(r).cbrt()}function Wl(r){return x(r=new this(r),r.e+1,2)}function Gl(r,e,t){return new this(r).clamp(e,t)}function Xl(r){if(!r||typeof r!="object")throw Error(Jr+"Object expected");var e,t,n,i=r.defaults===!0,s=["precision",1,Ke,"rounding",0,8,"toExpNeg",-xt,0,"toExpPos",0,xt,"maxE",0,xt,"minE",-xt,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(t=s[e],i&&(this[t]=oi[t]),(n=r[t])!==void 0)if(le(n)===n&&n>=s[e+1]&&n<=s[e+2])this[t]=n;else throw Error(Ze+t+": "+n);if(t="crypto",i&&(this[t]=oi[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(Rs);else this[t]=!1;else throw Error(Ze+t+": "+n);return this}function Yl(r){return new this(r).cos()}function Zl(r){return new this(r).cosh()}function js(r){var e,t,n;function i(s){var o,a,l,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,Os(s)){u.s=s.s,N?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(l=typeof s,l==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;N?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return Xr(u,s.toString())}if(l==="string")return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),Ls.test(s)?Xr(u,s):Rl(u,s);if(l==="bigint")return s<0?(s=-s,u.s=-1):u.s=1,Xr(u,s.toString());throw Error(Ze+s)}if(i.prototype=b,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=Xl,i.clone=js,i.isDecimal=Os,i.abs=Ll,i.acos=Fl,i.acosh=$l,i.add=Pl,i.asin=ql,i.asinh=Ul,i.atan=jl,i.atanh=zl,i.atan2=Vl,i.cbrt=Hl,i.ceil=Wl,i.clamp=Gl,i.cos=Yl,i.cosh=Zl,i.div=Kl,i.exp=Jl,i.floor=Ql,i.hypot=eu,i.ln=tu,i.log=ru,i.log10=iu,i.log2=nu,i.max=su,i.min=ou,i.mod=au,i.mul=lu,i.pow=uu,i.random=cu,i.round=du,i.sign=fu,i.sin=hu,i.sinh=pu,i.sqrt=mu,i.sub=gu,i.sum=bu,i.tan=_u,i.tanh=wu,i.trunc=yu,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return i.config(r),i}function Kl(r,e){return new this(r).div(e)}function Jl(r){return new this(r).exp()}function Ql(r){return x(r=new this(r),r.e+1,3)}function eu(){var r,e,t=new this(0);for(N=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return N=!0,new this(1/0);t=e}return N=!0,t.sqrt()}function Os(r){return r instanceof er||r&&r.toStringTag===Ms||!1}function tu(r){return new this(r).ln()}function ru(r,e){return new this(r).log(e)}function nu(r){return new this(r).log(2)}function iu(r){return new this(r).log(10)}function su(){return Ps(this,arguments,-1)}function ou(){return Ps(this,arguments,1)}function au(r,e){return new this(r).mod(e)}function lu(r,e){return new this(r).mul(e)}function uu(r,e){return new this(r).pow(e)}function cu(r){var e,t,n,i,s=0,o=new this(1),a=[];if(r===void 0?r=this.precision:he(r,1,Ke),n=Math.ceil(r/A),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));s<n;)i=e[s],i>=429e7?e[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);s<n;)i=e[s]+(e[s+1]<<8)+(e[s+2]<<16)+((e[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(Rs);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],r%=A,n&&r&&(i=Q(10,A-r),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)t=0,a=[0];else{for(t=-1;a[0]===0;t-=A)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<A&&(t-=A-n)}return o.e=t,o.d=a,o}function du(r){return x(r=new this(r),r.e+1,this.rounding)}function fu(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function hu(r){return new this(r).sin()}function pu(r){return new this(r).sinh()}function mu(r){return new this(r).sqrt()}function gu(r,e){return new this(r).sub(e)}function bu(){var r=0,e=arguments,t=new this(e[r]);for(N=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return N=!0,x(t,this.precision,this.rounding)}function _u(r){return new this(r).tan()}function wu(r){return new this(r).tanh()}function yu(r){return x(r=new this(r),r.e+1,1)}b[Symbol.for("nodejs.util.inspect.custom")]=b.toString;b[Symbol.toStringTag]="Decimal";var er=b.constructor=js(oi);Yr=new er(Yr);Zr=new er(Zr);var zs=er;var vu=20,ku=1,lt=1e6,Vs=1e6,Eu=-7,xu=21,Au=!1,tr="[big.js] ",ut=tr+"Invalid ",tn=ut+"decimal places",Du=ut+"rounding mode",Hs=tr+"Division by zero",$={},Oe=void 0,Tu=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function Ws(){function r(e){var t=this;if(!(t instanceof r))return e===Oe?Ws():new r(e);if(e instanceof r)t.s=e.s,t.e=e.e,t.c=e.c.slice();else{if(typeof e!="string"){if(r.strict===!0&&typeof e!="bigint")throw TypeError(ut+"value");e=e===0&&1/e<0?"-0":String(e)}Nu(t,e)}t.constructor=r}return r.prototype=$,r.DP=vu,r.RM=ku,r.NE=Eu,r.PE=xu,r.strict=Au,r.roundDown=0,r.roundHalfUp=1,r.roundHalfEven=2,r.roundUp=3,r}function Nu(r,e){var t,n,i;if(!Tu.test(e))throw Error(ut+"number");for(r.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),i=e.length,n=0;n<i&&e.charAt(n)=="0";)++n;if(n==i)r.c=[r.e=0];else{for(;i>0&&e.charAt(--i)=="0";);for(r.e=t-n-1,r.c=[],t=0;n<=i;)r.c[t++]=+e.charAt(n++)}return r}function ct(r,e,t,n){var i=r.c;if(t===Oe&&(t=r.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(Du);if(e<1)n=t===3&&(n||!!i[0])||e===0&&(t===1&&i[0]>=5||t===2&&(i[0]>5||i[0]===5&&(n||i[1]!==Oe))),i.length=1,n?(r.e=r.e-e+1,i[0]=1):i[0]=r.e=0;else if(e<i.length){if(n=t===1&&i[e]>=5||t===2&&(i[e]>5||i[e]===5&&(n||i[e+1]!==Oe||i[e-1]&1))||t===3&&(n||!!i[0]),i.length=e,n){for(;++i[--e]>9;)if(i[e]=0,e===0){++r.e,i.unshift(1);break}}for(e=i.length;!i[--e];)i.pop()}return r}function dt(r,e,t){var n=r.e,i=r.c.join(""),s=i.length;if(e)i=i.charAt(0)+(s>1?"."+i.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)i="0"+i;i="0."+i}else if(n>0)if(++n>s)for(n-=s;n--;)i+="0";else n<s&&(i=i.slice(0,n)+"."+i.slice(n));else s>1&&(i=i.charAt(0)+"."+i.slice(1));return r.s<0&&t?"-"+i:i}$.abs=function(){var r=new this.constructor(this);return r.s=1,r};$.cmp=function(r){var e,t=this,n=t.c,i=(r=new t.constructor(r)).c,s=t.s,o=r.s,a=t.e,l=r.e;if(!n[0]||!i[0])return n[0]?s:i[0]?-o:0;if(s!=o)return s;if(e=s<0,a!=l)return a>l^e?1:-1;for(o=(a=n.length)<(l=i.length)?a:l,s=-1;++s<o;)if(n[s]!=i[s])return n[s]>i[s]^e?1:-1;return a==l?0:a>l^e?1:-1};$.div=function(r){var e=this,t=e.constructor,n=e.c,i=(r=new t(r)).c,s=e.s==r.s?1:-1,o=t.DP;if(o!==~~o||o<0||o>lt)throw Error(tn);if(!i[0])throw Error(Hs);if(!n[0])return r.s=s,r.c=[r.e=0],r;var a,l,u,c,d,f=i.slice(),h=a=i.length,p=n.length,m=n.slice(0,a),g=m.length,_=r,v=_.c=[],w=0,E=o+(_.e=e.e-r.e)+1;for(_.s=s,s=E<0?0:E,f.unshift(0);g++<a;)m.push(0);do{for(u=0;u<10;u++){if(a!=(g=m.length))c=a>g?1:-1;else for(d=-1,c=0;++d<a;)if(i[d]!=m[d]){c=i[d]>m[d]?1:-1;break}if(c<0){for(l=g==a?i:f;g;){if(m[--g]<l[g]){for(d=g;d&&!m[--d];)m[d]=9;--m[d],m[g]+=10}m[g]-=l[g]}for(;!m[0];)m.shift()}else break}v[w++]=c?u:++u,m[0]&&c?m[g]=n[h]||0:m=[n[h]]}while((h++<p||m[0]!==Oe)&&s--);return!v[0]&&w!=1&&(v.shift(),_.e--,E--),w>E&&ct(_,E,t.RM,m[0]!==Oe),_};$.eq=function(r){return this.cmp(r)===0};$.gt=function(r){return this.cmp(r)>0};$.gte=function(r){return this.cmp(r)>-1};$.lt=function(r){return this.cmp(r)<0};$.lte=function(r){return this.cmp(r)<1};$.minus=$.sub=function(r){var e,t,n,i,s=this,o=s.constructor,a=s.s,l=(r=new o(r)).s;if(a!=l)return r.s=-l,s.plus(r);var u=s.c.slice(),c=s.e,d=r.c,f=r.e;if(!u[0]||!d[0])return d[0]?r.s=-l:u[0]?r=new o(s):r.s=1,r;if(a=c-f){for((i=a<0)?(a=-a,n=u):(f=c,n=d),n.reverse(),l=a;l--;)n.push(0);n.reverse()}else for(t=((i=u.length<d.length)?u:d).length,a=l=0;l<t;l++)if(u[l]!=d[l]){i=u[l]<d[l];break}if(i&&(n=u,u=d,d=n,r.s=-r.s),(l=(t=d.length)-(e=u.length))>0)for(;l--;)u[e++]=0;for(l=e;t>a;){if(u[--t]<d[t]){for(e=t;e&&!u[--e];)u[e]=9;--u[e],u[t]+=10}u[t]-=d[t]}for(;u[--l]===0;)u.pop();for(;u[0]===0;)u.shift(),--f;return u[0]||(r.s=1,u=[f=0]),r.c=u,r.e=f,r};$.mod=function(r){var e,t=this,n=t.constructor,i=t.s,s=(r=new n(r)).s;if(!r.c[0])throw Error(Hs);return t.s=r.s=1,e=r.cmp(t)==1,t.s=i,r.s=s,e?new n(t):(i=n.DP,s=n.RM,n.DP=n.RM=0,t=t.div(r),n.DP=i,n.RM=s,this.minus(t.times(r)))};$.neg=function(){var r=new this.constructor(this);return r.s=-r.s,r};$.plus=$.add=function(r){var e,t,n,i=this,s=i.constructor;if(r=new s(r),i.s!=r.s)return r.s=-r.s,i.minus(r);var o=i.e,a=i.c,l=r.e,u=r.c;if(!a[0]||!u[0])return u[0]||(a[0]?r=new s(i):r.s=i.s),r;if(a=a.slice(),e=o-l){for(e>0?(l=o,n=u):(e=-e,n=a),n.reverse();e--;)n.push(0);n.reverse()}for(a.length-u.length<0&&(n=u,u=a,a=n),e=u.length,t=0;e;a[e]%=10)t=(a[--e]=a[e]+u[e]+t)/10|0;for(t&&(a.unshift(t),++l),e=a.length;a[--e]===0;)a.pop();return r.c=a,r.e=l,r};$.pow=function(r){var e=this,t=new e.constructor("1"),n=t,i=r<0;if(r!==~~r||r<-Vs||r>Vs)throw Error(ut+"exponent");for(i&&(r=-r);r&1&&(n=n.times(e)),r>>=1,!!r;)e=e.times(e);return i?t.div(n):n};$.prec=function(r,e){if(r!==~~r||r<1||r>lt)throw Error(ut+"precision");return ct(new this.constructor(this),r,e)};$.round=function(r,e){if(r===Oe)r=0;else if(r!==~~r||r<-lt||r>lt)throw Error(tn);return ct(new this.constructor(this),r+this.e+1,e)};$.sqrt=function(){var r,e,t,n=this,i=n.constructor,s=n.s,o=n.e,a=new i("0.5");if(!n.c[0])return new i(n);if(s<0)throw Error(tr+"No square root");s=Math.sqrt(+dt(n,!0,!0)),s===0||s===1/0?(e=n.c.join(""),e.length+o&1||(e+="0"),s=Math.sqrt(e),o=((o+1)/2|0)-(o<0||o&1),r=new i((s==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+o)):r=new i(s+""),o=r.e+(i.DP+=4);do t=r,r=a.times(t.plus(n.div(t)));while(t.c.slice(0,o).join("")!==r.c.slice(0,o).join(""));return ct(r,(i.DP-=4)+r.e+1,i.RM)};$.times=$.mul=function(r){var e,t=this,n=t.constructor,i=t.c,s=(r=new n(r)).c,o=i.length,a=s.length,l=t.e,u=r.e;if(r.s=t.s==r.s?1:-1,!i[0]||!s[0])return r.c=[r.e=0],r;for(r.e=l+u,o<a&&(e=i,i=s,s=e,u=o,o=a,a=u),e=new Array(u=o+a);u--;)e[u]=0;for(l=a;l--;){for(a=0,u=o+l;u>l;)a=e[u]+s[l]*i[u-l-1]+a,e[u--]=a%10,a=a/10|0;e[u]=a}for(a?++r.e:e.shift(),l=e.length;!e[--l];)e.pop();return r.c=e,r};$.toExponential=function(r,e){var t=this,n=t.c[0];if(r!==Oe){if(r!==~~r||r<0||r>lt)throw Error(tn);for(t=ct(new t.constructor(t),++r,e);t.c.length<r;)t.c.push(0)}return dt(t,!0,!!n)};$.toFixed=function(r,e){var t=this,n=t.c[0];if(r!==Oe){if(r!==~~r||r<0||r>lt)throw Error(tn);for(t=ct(new t.constructor(t),r+t.e+1,e),r=r+t.e+1;t.c.length<r;)t.c.push(0)}return dt(t,!1,!!n)};$[Symbol.for("nodejs.util.inspect.custom")]=$.toJSON=$.toString=function(){var r=this,e=r.constructor;return dt(r,r.e<=e.NE||r.e>=e.PE,!!r.c[0])};$.toNumber=function(){var r=+dt(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(r.toString()))throw Error(tr+"Imprecise conversion");return r};$.toPrecision=function(r,e){var t=this,n=t.constructor,i=t.c[0];if(r!==Oe){if(r!==~~r||r<1||r>lt)throw Error(ut+"precision");for(t=ct(new n(t),r,e);t.c.length<r;)t.c.push(0)}return dt(t,r<=t.e||t.e<=n.NE||t.e>=n.PE,!!i)};$.valueOf=function(){var r=this,e=r.constructor;if(e.strict===!0)throw Error(tr+"valueOf disallowed");return dt(r,r.e<=e.NE||r.e>=e.PE,!0)};var Su=Ws(),Gs=Su;var yi={};Ts(yi,{DecodeError:()=>ue,Decoder:()=>Te,EXT_TIMESTAMP:()=>di,Encoder:()=>Dt,ExtData:()=>De,ExtensionCodec:()=>Je,decode:()=>ro,decodeArrayStream:()=>so,decodeAsync:()=>io,decodeMulti:()=>no,decodeMultiStream:()=>oo,decodeTimestampExtension:()=>gi,decodeTimestampToTimeSpec:()=>mi,encode:()=>sn,encodeDateToTimeSpec:()=>hi,encodeTimeSpecToTimestamp:()=>fi,encodeTimestampExtension:()=>pi});function Xs(r){let e=r.length,t=0,n=0;for(;n<e;){let i=r.charCodeAt(n++);if((i&4294967168)===0){t++;continue}else if((i&4294965248)===0)t+=2;else{if(i>=55296&&i<=56319&&n<e){let s=r.charCodeAt(n);(s&64512)===56320&&(++n,i=((i&1023)<<10)+(s&1023)+65536)}(i&4294901760)===0?t+=3:t+=4}}return t}function Cu(r,e,t){let n=r.length,i=t,s=0;for(;s<n;){let o=r.charCodeAt(s++);if((o&4294967168)===0){e[i++]=o;continue}else if((o&4294965248)===0)e[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<n){let a=r.charCodeAt(s);(a&64512)===56320&&(++s,o=((o&1023)<<10)+(a&1023)+65536)}(o&4294901760)===0?(e[i++]=o>>12&15|224,e[i++]=o>>6&63|128):(e[i++]=o>>18&7|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128)}e[i++]=o&63|128}}var Ou=new TextEncoder,Bu=50;function Iu(r,e,t){Ou.encodeInto(r,e.subarray(t))}function Ys(r,e,t){r.length>Bu?Iu(r,e,t):Cu(r,e,t)}var Ru=4096;function ci(r,e,t){let n=e,i=n+t,s=[],o="";for(;n<i;){let a=r[n++];if((a&128)===0)s.push(a);else if((a&224)===192){let l=r[n++]&63;s.push((a&31)<<6|l)}else if((a&240)===224){let l=r[n++]&63,u=r[n++]&63;s.push((a&31)<<12|l<<6|u)}else if((a&248)===240){let l=r[n++]&63,u=r[n++]&63,c=r[n++]&63,d=(a&7)<<18|l<<12|u<<6|c;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(a);s.length>=Ru&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}var Mu=new TextDecoder,Lu=200;function Fu(r,e,t){let n=r.subarray(e,e+t);return Mu.decode(n)}function Zs(r,e,t){return t>Lu?Fu(r,e,t):ci(r,e,t)}var De=class{type;data;constructor(e,t){this.type=e,this.data=t}};var ue=class r extends Error{constructor(e){super(e);let t=Object.create(r.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:r.name})}};function Ks(r,e,t){let n=t/4294967296,i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function rn(r,e,t){let n=Math.floor(t/4294967296),i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function nn(r,e){let t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function Js(r,e){let t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}var di=-1,$u=4294967296-1,Pu=17179869184-1;function fi({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=Pu)if(e===0&&r<=$u){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,r),t}else{let t=r/4294967296,n=r&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|t&3),s.setUint32(4,n),i}else{let t=new Uint8Array(12),n=new DataView(t.buffer);return n.setUint32(0,e),rn(n,4,r),t}}function hi(r){let e=r.getTime(),t=Math.floor(e/1e3),n=(e-t*1e3)*1e6,i=Math.floor(n/1e9);return{sec:t+i,nsec:n-i*1e9}}function pi(r){if(r instanceof Date){let e=hi(r);return fi(e)}else return null}function mi(r){let e=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{let t=e.getUint32(0),n=e.getUint32(4),i=(t&3)*4294967296+n,s=t>>>2;return{sec:i,nsec:s}}case 12:{let t=nn(e,4),n=e.getUint32(0);return{sec:t,nsec:n}}default:throw new ue(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function gi(r){let e=mi(r);return new Date(e.sec*1e3+e.nsec/1e6)}var Qs={type:di,encode:pi,decode:gi};var Je=class r{static defaultCodec=new r;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(Qs)}register({type:e,encode:t,decode:n}){if(e>=0)this.encoders[e]=t,this.decoders[e]=n;else{let i=-1-e;this.builtInEncoders[i]=t,this.builtInDecoders[i]=n}}tryToEncode(e,t){for(let n=0;n<this.builtInEncoders.length;n++){let i=this.builtInEncoders[n];if(i!=null){let s=i(e,t);if(s!=null){let o=-1-n;return new De(o,s)}}}for(let n=0;n<this.encoders.length;n++){let i=this.encoders[n];if(i!=null){let s=i(e,t);if(s!=null){let o=n;return new De(o,s)}}}return e instanceof De?e:null}decode(e,t,n){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,n):new De(t,e)}};function qu(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function rr(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):qu(r)?new Uint8Array(r):Uint8Array.from(r)}var Uu=100,ju=2048,Dt=class r{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Je.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??Uu,this.initialBufferSize=e?.initialBufferSize??ju,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new r({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,t){if(t>this.maxDepth)throw new Error(`Too deep objects in depth ${t}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){let t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(e){let t=new ArrayBuffer(e),n=new Uint8Array(t),i=new DataView(t);n.set(this.bytes),this.view=i,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){let n=Xs(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),Ys(e,this.bytes,this.pos),this.pos+=n}encodeObject(e,t){let n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,t);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error(`Too large binary: ${t}`);let n=rr(e);this.writeU8a(n)}encodeArray(e,t){let n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(let i of e)this.doEncode(i,t+1)}countWithoutUndefined(e,t){let n=0;for(let i of t)e[i]!==void 0&&n++;return n}encodeMap(e,t){let n=Object.keys(e);this.sortKeys&&n.sort();let i=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(let s of n){let o=e[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,t+1))}}encodeExtension(e){if(typeof e.data=="function"){let n=e.data(this.pos+6),i=n.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),this.writeI8(e.type),this.writeU8a(n);return}let t=e.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error(`Too large extension object: ${t}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),Ks(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),rn(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};function sn(r,e){return new Dt(e).encodeSharedRef(r)}function on(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}var zu=16,Vu=16,an=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=zu,t=Vu){this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,n){let i=this.caches[n-1];e:for(let s of i){let o=s.bytes;for(let a=0;a<n;a++)if(o[a]!==e[t+a])continue e;return s.str}return null}store(e,t){let n=this.caches[e.length-1],i={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,t,n){let i=this.find(e,t,n);if(i!=null)return this.hit++,i;this.miss++;let s=ci(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,s),s}};var bi="array",sr="map_key",to="map_value",Hu=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new ue("The type of key must be string or number but "+typeof r)},_i=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let t=this.getUninitializedStateFromPool();t.type=bi,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){let t=this.getUninitializedStateFromPool();t.type=sr,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===bi){let n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===sr||e.type===to){let n=e;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},ir=-1,wi=new DataView(new ArrayBuffer(0)),Wu=new Uint8Array(wi.buffer);try{wi.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var eo=new RangeError("Insufficient data"),Gu=new an,Te=class r{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=wi;bytes=Wu;headByte=ir;stack=new _i;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Je.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??4294967295,this.maxBinLength=e?.maxBinLength??4294967295,this.maxArrayLength=e?.maxArrayLength??4294967295,this.maxMapLength=e?.maxMapLength??4294967295,this.maxExtLength=e?.maxExtLength??4294967295,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:Gu,this.mapKeyConverter=e?.mapKeyConverter??Hu}clone(){return new r({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=ir,this.stack.reset()}setBuffer(e){let t=rr(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===ir&&!this.hasRemaining(1))this.setBuffer(e);else{let t=this.bytes.subarray(this.pos),n=rr(e),i=new Uint8Array(t.length+n.length);i.set(t),i.set(n,t.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:t,pos:n}=this;return new RangeError(`Extra ${t.byteLength-n} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let t=!1,n;for await(let a of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{n=this.doDecodeSync(),t=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}let{headByte:i,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${on(i)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,t){if(this.entered){yield*this.clone().decodeMultiAsync(e,t);return}try{this.entered=!0;let n=t,i=-1;for await(let s of e){if(t&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(i=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let e=this.readHeadByte(),t;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){let i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e<160){let i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else{let i=e-160;t=this.decodeString(i,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.readU8();else if(e===205)t=this.readU16();else if(e===206)t=this.readU32();else if(e===207)this.useBigInt64?t=this.readU64AsBigInt():t=this.readU64();else if(e===208)t=this.readI8();else if(e===209)t=this.readI16();else if(e===210)t=this.readI32();else if(e===211)this.useBigInt64?t=this.readI64AsBigInt():t=this.readI64();else if(e===217){let i=this.lookU8();t=this.decodeString(i,1)}else if(e===218){let i=this.lookU16();t=this.decodeString(i,2)}else if(e===219){let i=this.lookU32();t=this.decodeString(i,4)}else if(e===220){let i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else if(e===221){let i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else t=[]}else if(e===222){let i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e===223){let i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else t={}}else if(e===196){let i=this.lookU8();t=this.decodeBinary(i,1)}else if(e===197){let i=this.lookU16();t=this.decodeBinary(i,2)}else if(e===198){let i=this.lookU32();t=this.decodeBinary(i,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){let i=this.lookU8();t=this.decodeExtension(i,1)}else if(e===200){let i=this.lookU16();t=this.decodeExtension(i,2)}else if(e===201){let i=this.lookU32();t=this.decodeExtension(i,4)}else throw new ue(`Unrecognized type byte: ${on(e)}`);this.complete();let n=this.stack;for(;n.length>0;){let i=n.top();if(i.type===bi)if(i.array[i.position]=t,i.position++,i.position===i.size)t=i.array,n.release(i);else continue e;else if(i.type===sr){if(t==="__proto__")throw new ue("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=to;continue e}else if(i.map[i.key]=t,i.readCount++,i.readCount===i.size)t=i.map,n.release(i);else{i.key=null,i.type=sr;continue e}}return t}}readHeadByte(){return this.headByte===ir&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=ir}readArraySize(){let e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new ue(`Unrecognized array type byte: ${on(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new ue(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new ue(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){if(e>this.maxStrLength)throw new ue(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw eo;let n=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,n,e):i=Zs(this.bytes,n,e),this.pos+=t+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===sr:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new ue(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw eo;let n=this.pos+t,i=this.bytes.subarray(n,n+e);return this.pos+=t+e,i}decodeExtension(e,t){if(e>this.maxExtLength)throw new ue(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let n=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){let e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){let e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){let e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){let e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){let e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){let e=Js(this.view,this.pos);return this.pos+=8,e}readI64(){let e=nn(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){let e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){let e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){let e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){let e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function ro(r,e){return new Te(e).decode(r)}function no(r,e){return new Te(e).decodeMulti(r)}function Xu(r){return r[Symbol.asyncIterator]!=null}async function*Yu(r){let e=r.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)return;yield n}}finally{e.releaseLock()}}function ln(r){return Xu(r)?r:Yu(r)}async function io(r,e){let t=ln(r);return new Te(e).decodeAsync(t)}function so(r,e){let t=ln(r);return new Te(e).decodeArrayStream(t)}function oo(r,e){let t=ln(r);return new Te(e).decodeStream(t)}var Tn=Ns(ji(),1),zi=zs,Vi=Gs,Me=yi,fa=Tn.DOMParser,ha=Tn.XMLSerializer;var pa=Me!==null;function ma(){if(!pa)throw new Error("@msgpack/msgpack is required for MessagePack support. Install with: npm install @msgpack/msgpack")}var ga=Xd();function Xd(){if(!pa)return null;let r=new TextEncoder,e=new TextDecoder,t=new Me.ExtensionCodec;return t.register({type:-1,encode:n=>{if(n instanceof Date){let i=gt(n);if(i==="D"||i==="H")return null}return Me.encodeTimestampExtension(n)},decode:n=>Me.decodeTimestampExtension(n)}),t.register({type:1,encode:n=>F(n)?r.encode(n.toString()):null,decode:n=>Ar(e.decode(n))}),t.register({type:2,encode:n=>{if(n instanceof Date&>(n)==="D"){let i=n.getUTCFullYear(),s=String(n.getUTCMonth()+1).padStart(2,"0"),o=String(n.getUTCDate()).padStart(2,"0");return r.encode(`${i}-${s}-${o}`)}return null},decode:n=>new Date(e.decode(n)+"T00:00:00.000Z")}),t.register({type:3,encode:n=>{if(n instanceof Date&>(n)==="H"){let i=String(n.getUTCHours()).padStart(2,"0"),s=String(n.getUTCMinutes()).padStart(2,"0"),o=String(n.getUTCSeconds()).padStart(2,"0"),a=String(n.getUTCMilliseconds()).padStart(3,"0");return r.encode(`${i}:${s}:${o}.${a}`)}return null},decode:n=>{let i=e.decode(n),s=i.indexOf("."),o=s>=0?i.substring(0,s):i,a=s>=0?i.substring(s+1):"0",[l,u,c]=o.split(":"),d=Math.round(+a.substring(0,3));return new Date(Date.UTC(1970,0,1,+l,+u,+c,d))}}),t.register({type:4,encode:n=>{let i=Hi(n);if(i!==null){let[s,o]=i;return r.encode(`${s}:${o(n)}`)}return null},decode:n=>{let i=e.decode(n),s=i.indexOf(":"),o=i.slice(0,s),a=i.slice(s+1),l=st[o];if(l!==void 0){let[,u]=l;return u(a)}return`${a}::${o}`}}),t}function ba(r){return ma(),Me.encode(r,{extensionCodec:ga})}function _a(r){return ma(),Me.decode(r,{extensionCodec:ga})}function Sn(r,e=!1){let t=Cn(r);if(t===null)return[!1,String(r)];let[n,i,s]=t;return s&&!e?[!1,String(r)]:[!0,`${i(r)}::${n}`]}function Wi(r){if(!r.includes("::"))return[!1,r];let e=r.lastIndexOf("::"),t=r.slice(0,e),n=r.slice(e+2),i=st[n];if(i===void 0)return[!1,r];let[,s]=i;return[!0,s(t)]}function Nn(r,e,t){if(r!==null&&typeof r=="object"&&!Array.isArray(r)){let n={};for(let[i,s]of Object.entries(r))n[i]=Nn(s,e,t);return n}return Array.isArray(r)?r.map(n=>Nn(n,e,t)):t(r)?e(r):r}function Gi(r){let e=Cn(r);if(e!==null){let[t,n,i]=e;return i?[r,!1]:[`${n(r)}::${t}`,!0]}if(Array.isArray(r)){let t=!1;return[r.map(i=>{let[s,o]=Gi(i);return o&&(t=!0),s}),t]}if(r!==null&&typeof r=="object"){let t=!1,n={};for(let[i,s]of Object.entries(r)){let[o,a]=Gi(s);a&&(t=!0),n[i]=o}return[n,t]}return[r,!1]}function Yd(r,e=!1){let[t,n]=Sn(r,e);if(t)return n;let[i,s]=Gi(r),o=JSON.stringify(i);return s?`${o}::JS`:o}function Zd(r){return JSON.stringify(r)}function Kd(r){if(!Me)throw new Error("@msgpack/msgpack is required for MessagePack support");return Me.encode(r)}function be(r,e=null,{raw:t=!1,qs:n=!1,_forceSuffix:i=!1}={}){if(n)return`${ya(r)}::QS`;if(t){if(e===null||e==="json")return Zd(r);if(e==="msgpack")return Kd(r);throw e==="xml"?new Error("raw=true is not supported for XML transport"):new Error(`Unknown transport: ${e}`)}if(e===null||e==="json"){let s=Yd(r,i);return e==="json"?`"${s}"`:s}else{if(e==="xml")return`<?xml version="1.0" ?><tytx_root>${wa(r)}</tytx_root>`;if(e==="msgpack")return ba(r);throw new Error(`Unknown transport: ${e}`)}}var Ht,Xi;typeof window<"u"&&window.DOMParser?(Ht=window.DOMParser,Xi=window.XMLSerializer):(Ht=fa,Xi=ha);function va(r){if(r===null||typeof r!="object"||Array.isArray(r))return!1;let e=Object.keys(r);if(e.length!==1)return!1;let t=r[e[0]];return t!==null&&typeof t=="object"&&"value"in t}function ka(r,e,t){let n=r.createElement(e),i=t.attrs||{},s=t.value;for(let[o,a]of Object.entries(i))n.setAttribute(o,be(a,null,{_forceSuffix:!0}));if(Array.isArray(s))for(let o of s)if(va(o)){let[a]=Object.keys(o),l=o[a],u=ka(r,a,l);n.appendChild(u)}else{n.textContent=be(s);break}else n.textContent=be(s);return n}function wa(r){if(!Ht)throw new Error("XML support requires @xmldom/xmldom package in Node.js");if(va(r)){let[e]=Object.keys(r),t=r[e],n=new Ht().parseFromString("<root/>","text/xml"),i=ka(n,e,t);return new Xi().serializeToString(i)}else return be(r)}function Yi(r){let e={};for(let n=0;n<r.attributes.length;n++){let i=r.attributes[n];e[i.name]=K(i.value)}let t=[];for(let n=0;n<r.childNodes.length;n++){let i=r.childNodes[n];i.nodeType===1&&t.push(i)}if(t.length>0)if(t.length===1){let n=t[0],i=Yi(n);return{attrs:e,value:{[n.tagName]:i}}}else{let n=[];for(let i of t){let s=Yi(i);n.push({[i.tagName]:s})}return{attrs:e,value:n}}return{attrs:e,value:K(r.textContent)}}function Ea(r){if(!Ht)throw new Error("XML support requires @xmldom/xmldom package in Node.js");let n=new Ht().parseFromString(r,"text/xml").documentElement;if(n.tagName==="tytx_root"){let s=null;for(let o=0;o<n.childNodes.length;o++)if(n.childNodes[o].nodeType===1){s=n.childNodes[o];break}if(!s)return K(n.textContent);n=s}let i=Yi(n);return{[n.tagName]:i}}function Jd(r){return typeof r=="string"}function Qd(r){let[e,t]=Wi(r);if(e)return t;let n=r;n.endsWith("::JS")&&(n=n.slice(0,-4));let i;try{i=JSON.parse(n)}catch{return r}return Nn(i,ef,Jd)}function ef(r){return r.includes("::")?Wi(r)[1]:r}function tf(r){let e=Ea(r);return typeof e=="string"?K(e):e}function rf(r){return _a(r)}function K(r,e=null){if(r===null)return null;if(e===null||e==="json"){let t=r;return e==="json"&&r.startsWith('"')&&r.endsWith('"')&&(t=r.slice(1,-1)),Qd(t)}else{if(e==="xml")return tf(r);if(e==="msgpack")return rf(r);throw new Error(`Unknown transport: ${e}`)}}function ya(r){if(Array.isArray(r))return r.map(e=>String(e)).join("&");if(r!==null&&typeof r=="object"){let e=[];for(let[t,n]of Object.entries(r)){let[i,s]=Sn(n,!0);i?e.push(`${t}=${s}`):e.push(`${t}=${n}`)}return e.join("&")}throw new TypeError(`toQs expects object or array, got ${typeof r}`)}function xa(r){if(!r)return[];let e=r.split("&"),t=e.map(o=>o.includes("=")),n=t.every(Boolean),i=!t.some(Boolean);if(!n&&!i)throw new Error("QS format error: mixed items with and without '='");if(i)return e.map(o=>K(o));let s={};for(let o of e){let a=o.indexOf("="),l=o.slice(0,a),u=o.slice(a+1);s[l]=K(u)}return s}var Da=zi||Vi||Number,Ta=zi?"decimal.js":Vi?"big.js":"number";function Ki(){return Ta}function Ar(r){return new Da(r)}function F(r){return Ta==="number"?!1:r instanceof Da}function gt(r){let e=r.getUTCFullYear()===1970&&r.getUTCMonth()===0&&r.getUTCDate()===1,t=r.getUTCHours()===0&&r.getUTCMinutes()===0&&r.getUTCSeconds()===0&&r.getUTCMilliseconds()===0;return e&&!t?"H":t&&!e?"D":"DHZ"}function nf(r){return r.toString()}function sf(r){let e=r.getUTCFullYear(),t=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0");return`${e}-${t}-${n}`}function of(r){return r.toISOString()}function af(r){let e=String(r.getUTCHours()).padStart(2,"0"),t=String(r.getUTCMinutes()).padStart(2,"0"),n=String(r.getUTCSeconds()).padStart(2,"0"),i=String(r.getUTCMilliseconds()).padStart(3,"0");return`${e}:${t}:${n}.${i}`}function lf(r){return r?"true":"false"}function uf(r){return r.toString()}function cf(r){return r.toString()}function df(r){let e="";for(let t=0;t<r.length;t+=32768)e+=String.fromCharCode.apply(null,r.subarray(t,t+32768));return btoa(e)}var On=[],Zi=new Map;function Hi(r){if(r===null||typeof r!="object")return null;for(let e=Object.getPrototypeOf(r);e!==null;e=Object.getPrototypeOf(e))for(let[t,n,i,s]of On)if(t.prototype===e)return[n,i,s];return null}function Cn(r){if(r===null)return["NN",()=>"",!0];if(F(r))return["N",nf,!1];if(r instanceof Uint8Array)return["RAW",df,!1];if(r instanceof Date){let e=gt(r);return e==="D"?["D",sf,!1]:e==="H"?["H",af,!1]:["DHZ",of,!1]}return typeof r=="boolean"?["B",lf,!0]:typeof r=="number"?Number.isInteger(r)?["L",uf,!0]:["R",cf,!0]:Hi(r)}function ff(r){return Ar(r)}function hf(r){let[e,t,n]=r.split("-").map(Number);return new Date(Date.UTC(e,t-1,n,0,0,0,0))}function Aa(r){return new Date(r)}function pf(r){let[e,t,n]=r.split(":"),[i,s]=n.split(".");return new Date(Date.UTC(1970,0,1,Number(e),Number(t),Number(i),Number(s||0)))}function mf(r){return r.toLowerCase()==="true"}function gf(r){return parseInt(r,10)}function bf(r){return parseFloat(r)}function _f(r){return r}function wf(r){return null}var yf=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;function vf(r){if(!yf.test(r))throw new Error(`RAW payload is not standard padded base64: '${r}'`);let e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function kf(r){return xa(r)}var Ef=/^[A-Z]+$/,st={N:[Object,ff],D:[Date,hf],DH:[Date,Aa],DHZ:[Date,Aa],H:[Date,pf],L:[Number,gf],R:[Number,bf],T:[String,_f],B:[Boolean,mf],QS:[Object,kf],NN:[null,wf],RAW:[Uint8Array,vf]};function Dr(r){return Object.hasOwn(st,r)?st[r][0]:null}function Ji(r,e,t,n,i=!1){if(typeof e!="string"||!Ef.test(e))throw new Error(`TYTX suffix '${e}' is invalid: expected uppercase ASCII letters only`);let s=st[e];if(s!==void 0&&s[0]!==r){let o=s[0]===null?"null":s[0].name;throw new Error(`TYTX suffix '${e}' is already registered for ${o}`)}On=On.filter(([o])=>o!==r),On.push([r,e,t,i]),st[e]=[r,n]}function Tr(r,e){Zi.set(r,e)}function ze(r){return Zi.has(r)?Zi.get(r):{}}var bt=class{constructor(e,t){this.store=e,this.format=t}read(e,t=this.store.getRows()){return t.map(n=>({node:n,cells:e.map(i=>i.check?"":Nr(this.store.value(n,i.field),i,this.format))}))}};function Nr(r,e,t){if(r==null)return"";let{dtype:n,format:i}=e;if(n==="T"&&typeof r!="string"||n==="B"&&typeof r!="boolean")throw new TypeError(`grid ${e.field} does not match ${n}`);if(typeof r=="string"||typeof r=="boolean"){if(n&&!["T","B"].includes(n)||i!=null)throw new TypeError(`grid ${e.field} requires a typed numeric or temporal value`);return String(r)}if(r instanceof Date||i!=null)return t(r,{dtype:n,pattern:i??"short"});if(n&&!["L","R","N"].includes(n))throw new TypeError(`grid ${e.field} does not match ${n}`);if(n==="L"&&!Number.isInteger(r))throw new TypeError("grid L requires an integer");if(typeof r=="number"&&Number.isFinite(r)||F(r)&&r.isFinite())return String(r);throw new TypeError(`grid ${e.field} requires a scalar value`)}function ot(r){if(typeof r!="string"||!["^","="].includes(r[0])||r.startsWith("=="))return null;let e=r.indexOf(":");if(e<0)return null;let t=r[e+1]==="=";return{pointer:r.slice(0,e),expression:t,body:r.slice(e+(t?2:1))}}var Na=/^\{(\??[A-Za-z_][A-Za-z0-9_]*|\?)?\}/;function Qi(r,e){let t="",n=!1;for(let i=0;i<r.length;){if(r[i]!=="{"&&r[i]!=="}"){t+=r[i++];continue}let s=r.slice(i).match(Na);if(!s)throw new SyntaxError("Invalid pointer template placeholder");let o=s[1]??"",a=o.startsWith("?"),l=e(a?o.slice(1):o);l==null||l===""&&!a?n=!0:t+=String(l),i+=s[0].length}return n?null:t}function es(r){let e=[],t=new Set,n="",i=!0;for(let s=0;s<r.length;){let o=s,a=r[s];if(a==='"'||a==="'"||a==="`"){for(s++;s<r.length;){if(r[s]==="\\"){s+=2;continue}if(r[s++]===a)break}n+=r.slice(o,s),i=!1;continue}if(r.startsWith("//",s)){s=r.indexOf(`
|
|
13
|
-
`,s),s<0&&(s=r.length),n+=r.slice(o,s);continue}if(r.startsWith("/*",s)){let c=r.indexOf("*/",s+2);s=c<0?r.length:c+2,n+=r.slice(o,s);continue}if(a==="/"&&i){let c=!1;for(s++;s<r.length;){let d=r[s++];if(d==="\\"){s++;continue}if(d==="[")c=!0;else if(d==="]")c=!1;else if(d==="/"&&!c)break}for(;/[a-z]/i.test(r[s]??"")&&s<r.length;)s++;n+=r.slice(o,s),i=!1;continue}let l=a==="{"?r.slice(s).match(Na):null;if(l){let c=l[1]??"";if(c.startsWith("?"))throw new SyntaxError("Optional slots are supported in pointer templates only");n+=`_pointerValues[${e.length}]`,e.push(c),s+=l[0].length,i=!1;continue}let u=r.slice(s).match(/^[A-Za-z_$][\w$]*/);if(u){t.add(u[0]),n+=u[0],s+=u[0].length,i=["return","typeof","void","delete","new","in","instanceof","yield","await"].includes(u[0]);continue}n+=a,s++,/\s/.test(a)||(i=/[([{,:;=!?&|+*%~<>\/-]/.test(a))}return{text:n,slots:e,identifiers:t}}function Sa(r,e,t=()=>null){let n=new Map,i=[],s=o=>{if(n.has(o))return n.get(o);if(!r.has(o))throw new Error(`Referenced Source attribute '${o}' does not exist`);if(i.includes(o))throw new Error(`Cyclic attribute dependency: ${[...i,o].join(" -> ")}`);i.push(o);try{let a=r.get(o),l=typeof o=="string"?ot(a):null,u=e.get(o);if(l){let c=d=>d?s(d):e.get(o);if(l.expression){let d=es(l.body);u=t(o,a,d,d.slots.map(c))}else u=Qi(l.body,c),e.get(o)==null&&(u=null)}return n.set(o,u),u}finally{i.pop()}};return new Map([...r.keys()].map(o=>[o,s(o)]))}function ts(r,e){let t=new Map([...Object.entries(r.getAttr()),...r.fixedAttrItems()]),n=new Set,i=[],s=o=>{let a=ot(o);if(!a)return;let l=[];a.expression?l.push(...es(a.body).slots):Qi(a.body,u=>(l.push(u),""));for(let u of l.filter(Boolean)){if(!t.has(u))throw new Error(`Referenced Source attribute '${u}' does not exist`);if(i.includes(u))throw new Error(`Cyclic attribute dependency: ${[...i,u].join(" -> ")}`);n.has(u)||(i.push(u),s(t.get(u)),i.pop(),n.add(u))}};return s(e),n}var Ca={network:{maxAttempts:3,delay:1,backoff:2,jitter:!0,on:["TypeError","NetworkError","AbortError"]},aggressive:{maxAttempts:5,delay:.5,backoff:2,jitter:!0,on:["Error"]},gentle:{maxAttempts:2,delay:2,backoff:1.5,jitter:!1,on:["TypeError","NetworkError"]}};function Af(r){let e=r._retryPolicy;return e==null?null:typeof e=="string"?Ca[e]||null:e}function Df(r,e){return e.some(t=>t==="Error"?!0:r.name===t||r.constructor.name===t)}function Tf(r){return new Promise(e=>setTimeout(e,r))}async function Nf(r,e){if(!e)return r();let t=e.maxAttempts||3,n=e.delay||1,i=e.backoff||2,s=e.jitter!==!1,o=e.on||["Error"],a=null,l=n*1e3;for(let u=0;u<t;u++)try{let c=r();return c instanceof Promise?await c:c}catch(c){if(a=c,u<t-1&&Df(c,o)){let d=l;s&&(d*=1+Math.random()*.1),await Tf(d),l*=i}else throw c}throw a}var re=class r{static classKwargs={cacheTime:0,readOnly:!1,asBag:null,retryPolicy:null};static classArgs=[];static internalParams=new Set(["cacheTime","readOnly","asBag","retryPolicy"]);constructor(e={}){let n={...this.constructor.classKwargs,...e};for(let s of["interval","reactive"])if(Object.hasOwn(n,s))throw new TypeError(`Removed resolver option: ${s}. Schedule updates in the application; use reset() and read explicitly.`);this.cacheTime=n.cacheTime,this._readOnly=n.readOnly,this._asBag=n.asBag,this._retryPolicy=n.retryPolicy,this._kw={};let i=this.constructor.internalParams;for(let[s,o]of Object.entries(n))i.has(s)||(this._kw[s]=o);this._lastUpdate=null,this._node=null,this._lastEffectiveFingerprint=null,this._cachedValue=null,this.init()}init(){}setNode(e){e!==this._node&&!this.readOnly&&this._lastUpdate!==null&&this.reset(),this._node=e,this.onSetResolver(e)}onSetResolver(e){}get node(){return this._node}get cacheTime(){return this._cacheTime}set cacheTime(e){if(typeof e=="boolean")throw new TypeError("cacheTime must be numeric; use a negative value for infinite caching");this._cacheTime=e}get readOnly(){return this._readOnly}get expired(){return this._cacheTime<0?this._lastUpdate===null:this._cacheTime===0||this._lastUpdate===null?!0:(Date.now()-this._lastUpdate)/1e3>this._cacheTime}reset(...e){if(e.length)throw new TypeError("reset() takes no arguments. It invalidates the cache for the next explicit read.");this._lastUpdate=null,this._lastEffectiveFingerprint=null}get cachedValue(){return!this.readOnly&&this._node?this._node._value:this._cachedValue}set cachedValue(e){!this.readOnly&&this._node?this._node.setValue(e,!1):this._cachedValue=e}_computeEffectiveFingerprint(e){return JSON.stringify(Object.entries(e).sort())}_buildEffectiveKw(){let e={...this._kw};if(this._node&&this._node.attr)for(let t of Object.keys(this._kw))Object.hasOwn(this._node.attr,t)&&(e[t]=this._node.attr[t]);return e}resolve(e={}){let{static:t=!1,...n}=e;if(t)return this._node?this._node._value:this.cachedValue;let i=this._buildEffectiveKw();if(Object.keys(n).length>0)return this._load({...i,...n},o=>this._prepareValue(o));let s=this._computeEffectiveFingerprint(i);return s===this._lastEffectiveFingerprint&&!this.expired?this.cachedValue:(this._lastEffectiveFingerprint=s,this._load(i,o=>this._finalize(o)))}_load(e,t){let n=Af(this),i=()=>this.load(e);if(n)return Nf(i,n).then(t);let s=i();return s&&typeof s.then=="function"?s.then(t):t(s)}_finalize(e){return e=this._prepareValue(e),this._lastUpdate=Date.now(),(!this.readOnly||this.cacheTime!==0)&&(this.cachedValue=e),e}_prepareValue(e){let t;return this._asBag===!0?t=!0:this._asBag===!1?t=!1:t=!this._readOnly,t&&e!==null&&e!==void 0&&(e=this._convertToBag(e)),e}_convertToBag(e){let t=r._BagClass;if(!t||e&&typeof e._htraverse=="function")return e;if(typeof e=="string"){if(e=e.trim(),e.startsWith("<")&&t.fromXml)return t.fromXml(e);if((e.startsWith("{")||e.startsWith("["))&&t.fromTytx)return t.fromTytx(e)}return e}static registerBagClass(e){r._BagClass=e}load(e){return null}};re._BagClass=null;var Sr=class extends re{static classKwargs={cacheTime:0,readOnly:!1,asBag:!1,retryPolicy:null,callback:null};static classArgs=["callback"];static internalParams=new Set(["cacheTime","readOnly","asBag","retryPolicy","callback"]);constructor(e={}){typeof e=="function"&&(e={callback:e}),super(e),this._callback=e.callback||null}load(e){return this._callback?this._callback.call(this,e):null}};var Ve=class r{constructor(e,t,n=null,i=null,s=null,o=null,a=null,l=!0){this.label=t,this._value=null,this._attr={},this._parentBag=null,this._resolver=null,this._nodeSubscribers={},this._onChangedValue=null,this.nodeTag=o,this.xmlTag=a,this._compiled=null,this.parentBag=e,i&&this.setAttr(i,!1,!0,l),n!==null&&this.setValue(n,!1),s&&(this.resolver=s)}get parentBag(){return this._parentBag}set parentBag(e){e===null&&this._value?.parentNode===this&&this._value.setBackref(),this._parentBag=e,e?.backref&&this._value&&typeof this._value._htraverse=="function"&&this._value.setBackref(this,e)}get value(){return this.getValue()}set value(e){this.setValue(e)}getValue(e=!1,t=null,n={}){if(t!==null){let i=K(`${t}::QS`);if(Array.isArray(i)){let s=i.length?i:Object.keys(this._attr),o=s.map(l=>{let u=this.getAttr(l);return!e&&u instanceof re?u.resolve():u}),a=l=>i.length===0?Object.fromEntries(s.map((u,c)=>[u,l[c]])):l.length===1?l[0]:l;return o.some(l=>l&&typeof l.then=="function")?Promise.all(o).then(a):a(o)}else{if(!this._resolver)throw new Error("Cannot use kwargs syntax without resolver");n={...n,...i}}}return this._resolver!==null?this._resolver.resolve({static:e,...n}):this._value}setValue(e,t=!0,n=null,i=null,s=!0,o=null,a=!1){e instanceof re?(this.resolver=e,e=null):e instanceof r&&(n=n||{},Object.assign(n,e._attr),e.resolver&&(this.resolver=e.resolver),e=e._value);let l=this._value;l!==e&&l?.parentNode===this&&l.setBackref(),this._value=e;let u=l!==this._value,c=t??!0,d=null;if(n!==null){let h={...this._attr};this.setAttr(n,!1,i,s);let p=this._buildAttrDiff(h,this._attr);d=Object.keys(p).length>0?p:null}t=c&&(u||d!==null);let f=d?u?"upd_value_attr":"upd_attrs":"upd_value";if(this._onChangedValue&&this._onChangedValue(this,e,l,c),t){let h=d!==null?{oldvalue:l,attrs_diff:d}:{oldvalue:l};for(let p of Object.values(this._nodeSubscribers))p({node:this,info:h,evt:f})}this._parentBag!==null&&this._parentBag.backref&&(e&&typeof e._htraverse=="function"&&e.setBackref(this,this._parentBag),t&&this._parentBag._onNodeChanged(this,[this.label],f,l,d,o,a))}replace(e){if(!(e instanceof r))throw new TypeError("BagNode.replace expects a BagNode");if(e===this)return this;let t=e.staticValue;t&&typeof t._htraverse=="function"&&(t=t.createChildBag().replace(t));let n=null;e.resolver&&(n=Object.create(Object.getPrototypeOf(e.resolver),Object.getOwnPropertyDescriptors(e.resolver)),n._node=null,n._kw={...e.resolver._kw});let i=this._value,s={...this._attr},o=this.resolver;o&&o._node===this&&(o._node=null),this.resolver=n,this.setValue(t,!1,{...e.attr},!1,!1,null);let a=this._buildAttrDiff(s,this._attr),l=Object.keys(a).length?a:null,u=i!==t||o!==n;if(u||l){let c=l?u?"upd_value_attr":"upd_attrs":"upd_value",d=l?{oldvalue:i,attrs_diff:l}:{oldvalue:i};for(let f of Object.values(this._nodeSubscribers))f({node:this,info:d,evt:c});this._parentBag!==null&&this._parentBag.backref&&this._parentBag._onNodeChanged(this,[this.label],c,i,l)}return this}get staticValue(){return this._value}set staticValue(e){this._value=e}get resolver(){return this._resolver}set resolver(e){this._resolver=e,e&&e.setNode&&e.setNode(this)}resetResolver(){if(!this._resolver)throw new Error("Cannot reset resolver: node has no resolver");this._resolver.reset(),this.setValue(null)}get attr(){return this._attr}getAttr(e=null,t=null){return e?e in this._attr?this._attr[e]:t:this._attr}_buildAttrDiff(e,t){let n={},i=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of i){let o=s in e?e[s]:null,a=s in t?t[s]:null;o!==a&&(n[s]={old:o,new:a})}return n}setAttr(e=null,t=!0,n=!0,i=!0){let s=e||{},o=Object.keys(this._nodeSubscribers).length>0,l=t&&(o||this._parentBag!==null&&this._parentBag.backref)?{...this._attr}:null;if(n?Object.assign(this._attr,s):this._attr={...s},i)for(let u of Object.keys(this._attr))this._attr[u]===null&&delete this._attr[u];if(t&&l!==null){let u=this._buildAttrDiff(l,this._attr);if(Object.keys(u).length>0&&o)for(let c of Object.values(this._nodeSubscribers))c({node:this,info:{attrs_diff:u},evt:"upd_attrs"});if(Object.keys(u).length>0&&this._parentBag!==null&&this._parentBag.backref){let c=t===!0?"true":String(t);this._parentBag._onNodeChanged(this,[this.label],"upd_attrs",null,u,c)}}}delAttr(...e){for(let t of e)if(typeof t=="string"&&t.includes(","))for(let n of t.split(","))delete this._attr[n.trim()];else delete this._attr[t]}hasAttr(e,t=null){return e in this._attr?t!==null?this._attr[e]===t:!0:!1}getInheritedAttributes(){let e={};return this._parentBag&&this._parentBag.parentNode&&(e=this._parentBag.parentNode.getInheritedAttributes()),{...e,...this._attr}}subscribe(e,t){this._nodeSubscribers[e]=t}unsubscribe(e){delete this._nodeSubscribers[e]}get compiled(){return this._compiled||(this._compiled={}),this._compiled}get isBranch(){return this._value!=null&&typeof this._value._htraverse=="function"}get position(){return this._parentBag===null?null:this._parentBag._nodes.index(this.label)}get fullpath(){if(this._parentBag!==null){let e=this._parentBag.fullpath;return e?`${e}.${this.label}`:this.label}return null}get parentNode(){return this._parentBag?this._parentBag.parentNode:null}attributeOwnerNode(e,t=null){let n=this;if(t===null)for(;n&&!(e in n._attr);)n=n.parentNode;else for(;n&&n._attr[e]!==t;)n=n.parentNode;return n}asTuple(){return[this.label,this.value,this._attr,this._resolver||null]}isEqual(e){if(!(e instanceof r)||this.label!==e.label)return!1;let t=Object.keys(this._attr),n=Object.keys(e._attr);if(t.length!==n.length)return!1;for(let i of t)if(this._attr[i]!==e._attr[i])return!1;return this._resolver!==null?this._resolver===e._resolver:this._value&&typeof this._value.equalTo=="function"?this._value.equalTo(e._value):this._value&&typeof this._value.isEqual=="function"?this._value.isEqual(e._value):this._value===e._value}diff(e){if(this.label!==e.label)return`Other label: ${e.label}`;let t=Object.keys(this._attr),n=Object.keys(e._attr);return t.length!==n.length||t.some(i=>this._attr[i]!==e._attr[i])?`attributes self:${JSON.stringify(this._attr)} --- other:${JSON.stringify(e._attr)}`:this._value!==e._value?`value self:${this._value} --- other:${e._value}`:null}toJson(e=!0){let t=this.value;return t&&typeof t.toJson=="function"&&(t=t.toJson(e,!0)),{label:this.label,value:t,attr:this._attr}}toString(){return`BagNode : ${this.label}`}};var Cr=class r{constructor(){this._dict=Object.create(null),this._list=[],this._parentBag=null}index(e){if(e in this._dict)return this._list.findIndex(n=>n.label===e);let t=e.match(/^#(\d+)$/);if(t){let n=parseInt(t[1],10);return n<this._list.length?n:-1}if(t=e.match(/^#(\w*)=(.*)$/),t){let[,n,i]=t,s=i.includes("::")?K(i):i;return n?this._list.findIndex(o=>o.getAttr(n)===s):this._list.findIndex(o=>o._value===s)}return-1}_parsePosition(e){let t=this._list.length;if(e==null||e===">")return t;if(typeof e=="number")return e<0&&(e=t+e),Math.max(0,Math.min(e,t));if(e==="<")return 0;if(e.startsWith("#")){let n=this._parseSharpIndex(e.slice(1),e);return Math.min(n,t)}if(e.startsWith("<")){let n=e.slice(1);if(n.startsWith("#")){let s=this._parseSharpIndex(n.slice(1),e);return Math.min(s,t)}let i=this.index(n);if(i<0)throw new Error(`Invalid node_position '${e}': label '${n}' not found`);return i}if(e.startsWith(">")){let n=e.slice(1);if(n.startsWith("#")){let s=this._parseSharpIndex(n.slice(1),e);return Math.min(s+1,t)}let i=this.index(n);if(i<0)throw new Error(`Invalid node_position '${e}': label '${n}' not found`);return i+1}throw new Error(`Invalid node_position '${e}': unrecognized syntax`)}_parseSharpIndex(e,t){if(!/^-?\d+$/.test(e))throw new Error(`Invalid node_position '${t}': '${e}' is not an integer`);let n=parseInt(e,10);if(n<0)throw new Error(`Invalid node_position '${t}': negative index not allowed in '#n' syntax`);return n}get(e){if(typeof e=="number")return e>=0&&e<this._list.length?this._list[e]:null;if(e.startsWith("#")){let t=this.index(e);return t>=0?this._list[t]:null}return this._dict[e]||null}set(e,t,n=">",i=null,s=null,o=null,a=!1,l=!0,u=null,c=!0,d=!1,f=null){let h=null;if(e.includes("?")&&([e,h]=e.split("?",2)),e==null||e.startsWith("#"))throw new Error("Cannot create new node with #n syntax");if(h){let m=h.split("&");if(m.length===1)i={[m[0]]:t};else{if(!Array.isArray(t)||t.length!==m.length)throw new Error("Wrong attributes assignment");i={};for(let g=0;g<m.length;g++)i[m[g]]=t[g]}t=null}let p=this._dict[e];if(p)f&&(p.nodeTag=f),o!==null&&(o===!1?p.resolver=null:p.resolver=o),h?p.setAttr(i,c,!0,l):p.setValue(t,c,i,a,l,u,d);else{let m=s&&s.nodeClass?s.nodeClass:Ve;p=new m(s,e,h?null:t,i,o,f,null,l);let g=this._parsePosition(n);this._dict[e]=p,this._list.splice(g,0,p),c&&s&&s.backref&&s._onNodeInserted(p,g,null,u,d)}return d&&p.setValue(null,!1),p}pop(e){let t=this.get(e);if(t){delete this._dict[t.label];let n=this._list.indexOf(t);return n>=0&&this._list.splice(n,1),t}return null}has(e){return e in this._dict}get length(){return this._list.length}clear(){this._dict=Object.create(null),this._list=[]}keys(){return this._list.map(e=>e.label)}values(){return this._list.map(e=>e.getValue())}items(){return this._list.map(e=>[e.label,e.getValue()])}[Symbol.iterator](){return this._list[Symbol.iterator]()}move(e,t,n=!0){if(t<0)return;let i=Array.isArray(e)?e:[e];if(i.length===0||t>=this._list.length)return;let s=this._list[t].label;if(i.length>1){let o=[...i].sort((c,d)=>c-d),a=o[0]<t?1:0,l=[];for(let c=o.length-1;c>=0;c--){let d=o[c];if(d>=0&&d<this._list.length){let f=this._list[d];this._list.splice(d,1),l.push(f),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeDeleted(f,d)}}let u=this.index(s);u<0&&(u=this._list.length),u+=a;for(let c of l)this._list.splice(u,0,c),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeInserted(c,u)}else{let o=i[0];if(o===t||o<0||o>=this._list.length)return;let a=this._list[o];this._list.splice(o,1),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeDeleted(a,o),this._list.splice(t,0,a),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeInserted(a,t)}}isEqual(e){if(!(e instanceof r)||this._list.length!==e._list.length)return!1;for(let t=0;t<this._list.length;t++){let n=this._list[t],i=e._list[t];if(!n.isEqual(i))return!1}return!0}};var Ra=Ns(ji(),1);var rs="::RSLV:",Sf=new Map,Cf=new Map,Bn=new WeakMap,Y=class extends Error{constructor(e){super(e),this.name="BagSerializationError"}},Or=class extends re{constructor(e){super({asBag:!1}),Bn.set(this,e)}get payload(){return Bn.get(this)}load(){throw new Y("This resolver is opaque; local execution is unavailable")}};function Oa(r){if(!r||typeof r!="object"||Array.isArray(r)||typeof r.resolver_module!="string"||typeof r.resolver_class!="string"||!Array.isArray(r.args??[])||!r.kwargs||typeof r.kwargs!="object"||Array.isArray(r.kwargs))throw new Y("Invalid resolver description")}function Ba(r,e=new Set){if(!(r===null||typeof r=="string"||typeof r=="boolean")&&!(typeof r=="number"&&Number.isFinite(r))){if(typeof r!="object"||e.has(r)||!Array.isArray(r)&&Object.getPrototypeOf(r)!==Object.prototype&&Object.getPrototypeOf(r)!==null)throw new Y("Resolver parameters must be JSON data; callbacks cannot travel");e.add(r);for(let t of Object.values(r))Ba(t,e);e.delete(r)}}function Br(r){if(Bn.has(r))return Bn.get(r);let e=Cf.get(r.constructor);if(!e)throw new Y(`Unregistered resolver: ${r.constructor.name}`);let t=e.encode(r),n={resolver_module:e.module,resolver_class:e.name,args:t.args??[],kwargs:t.kwargs??{}};return Oa(n),Ba(n),rs+JSON.stringify(n)}function In(r){if(typeof r!="string"||!r.startsWith(rs))return null;let e=r.slice(rs.length);if(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+$/.test(e))return new Or(r);let t;try{t=JSON.parse(e)}catch{throw new Y("Invalid resolver JSON or signed token")}Oa(t);let n=Sf.get(JSON.stringify([t.resolver_module,t.resolver_class]));if(!n)return new Or(r);let i=n.decode({args:t.args??[],kwargs:t.kwargs});if(!(i instanceof n.cls))throw new Y("Resolver decoder returned an incompatible instance");return i}function Rn(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[e,t instanceof re?Br(t):t]))}function ns(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[e,In(t)??t]))}var Ne="__cls";function Wt(r,e){return r!==null&&r.tytxSuffix===e?r:Dr(e)}function Of(r){let e=r.tytxSuffix,t=Object.entries(ze(e)).filter(([,n])=>n===r).map(([n])=>n);if(t.length===0)throw new Y(`${r.name} is not in the TYTX subtype dictionary of '${e}'`);if(t.length>1)throw new Y(`${r.name} is in the TYTX subtype dictionary of '${e}' under several names: ${t.sort().join(", ")}`);return t[0]}function is(r,e){let t=ze(r);if(!Object.hasOwn(t,e))throw new Y(`Unknown Bag class '${e}' for TYTX type '${r}'`);return t[e]}function ss(r,e){return r===e?null:Of(r)}function*Ma(r,e=[]){for(let t of r){let n=[...e,t.label];yield[n,t];let i=t.getValue(!0);!t.resolver&&i instanceof ne&&(yield*Ma(i,n))}}function Bf(r){let e=r.toISOString(),t=r.getUTCFullYear()===1970&&r.getUTCMonth()===0&&r.getUTCDate()===1,n=r.getUTCHours()===0&&r.getUTCMinutes()===0&&r.getUTCSeconds()===0&&r.getUTCMilliseconds()===0;if(n&&!t)return e.slice(0,e.indexOf("T"));let i=e.replace(/\.000Z$/,"Z");return t&&!n?i.slice(i.indexOf("T")+1):i}function Gt(r){if(r===null||typeof r!="object")return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null}function at(r){return typeof r=="string"?r.includes("::")?`${r}::T`:r:Array.isArray(r)?r.map(at):Gt(r)?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,at(t)])):r}function os(r){if(!Gt(r))throw new TypeError("Bag options must be an object");let{recursive:e=!0}=r;if(typeof e!="boolean")throw new TypeError("recursive must be a boolean");return e}var Ia=!1,ne=class r{static tytxSuffix="X";constructor(e=null,t={}){this._nodes=new Cr,this._backref=!1,this._parent=null,this._parentNode=null,this._rootAttributes=null,this._updSubscribers={},this._insSubscribers={},this._delSubscribers={},os(t),e!=null&&this.fillFrom(e,t)}get parent(){return this._parent}set parent(e){this._parent=e}get parentNode(){return this._parentNode}set parentNode(e){this._parentNode=e}get backref(){return!!this._backref}get nodeClass(){return Ve}createChildBag(){return new this.constructor}get fullpath(){if(this._parent!==null&&this._parentNode!==null){let e=this._parent.fullpath;return e?`${e}.${this._parentNode.label}`:this._parentNode.label}return null}relativePath(e){let t=[],n=e;for(;n!==null;){if(n.parentBag===this)return t.push(n.label),t.reverse(),t.join(".");t.push(n.label),n=n.parentNode}return null}get length(){return this._nodes.length}get root(){let e=this;for(;e.parent!==null;)e=e.parent;return e}get attributes(){return this._parentNode!==null?this._parentNode.getAttr():{}}get rootAttributes(){return this._rootAttributes}set rootAttributes(e){this._rootAttributes=e!==null?{...e}:null}_htraverseBefore(e){let t=this,n;for(typeof e=="string"?(e=e.replace(/\.\.\//g,"#parent."),n=e.split(".").filter(i=>i)):n=[...e];n.length&&n[0]==="#parent"&&t!==null;)n.shift(),t=t.parent;return[t,n]}_htraverse(e,t=!1,n=!0){let[i,s]=this._htraverseBefore(e);if(i===null)return[null,null];if(s.length===0)return[i,""];for(;s.length>1&&i instanceof r;){let o=s[0];if(o==="#parent"){if(i.parent===null||i.parent===void 0)break;s.shift(),i=i.parent;continue}let a=i._nodes.get(o);if(!a)break;let l=a.getValue(n);if(l instanceof r)s.shift(),i=l;else if(t){let u=i.createChildBag();a.setValue(u,!0,null,!0,!0,"autocreate"),s.shift(),i=u}else break}if(!t)return s.length>1?[null,null]:[i,s[0]];for(;s.length>1;){let o=s.shift();if(o.startsWith("#"))throw new Ir("Not existing index in #n syntax");let a=i.createChildBag();i._nodes.set(o,a,">",null,i,null,!1,!0,"autocreate"),i=a}return[i,s[0]]}get(e,t=null,n=!0,i={}){if(!e)return this;if(e==="#parent")return this.parent;let s=null;e.includes("?")&&([e,s]=e.split("?",2));let o=this._nodes.get(e);return o?o.getValue(n,s,i):t}getItem(e,t=null,n=!1,i={}){if(!e)return this;let[s,o]=this._htraverse(e,!1,n);return s instanceof r?s.get(o,t,n,i):t}setItem(e,t,n=null,i=">",s=!1,o=!0,a=null,l=!1,u=!0,c=null,d=null){if(e==="")throw new RangeError("setItem requires a non-empty path");let[f,h]=this._htraverse(e,!0);return f._nodes.set(h,t,i,n,f,c,s,o,a,u,l,d)}_pop(e,t=null){let n=this._nodes.index(e);if(n>=0){let i=this._nodes.pop(n);return this.backref&&this._onNodeDeleted(i,n,null,t),i}return null}pop(e,t=null,n=null){let i=this.popNode(e,n);return i?i.value:t}delItem(e,t=null,n=null){return this.pop(e,t,n)}popNode(e,t=null){let[n,i]=this._htraverse(e,!1,!0);if(!n||!i)return null;let s=n._nodes.get(i);if(!s)return null;try{return n._pop(i,t)}finally{s.parentBag===n&&n._nodes._dict[s.label]!==s&&(s.parentBag=null)}}clear(){let e=[...this._nodes];this._nodes.clear(),this.backref&&this._onNodeDeleted(e,-1);for(let t of e)t.parentBag=null}getNode(e,t=!0,n=!1,i=null){if(e==null||e==="")return this.parentNode;if(typeof e=="number")return this._nodes.get(e);typeof e=="string"&&(e=e.split("?",1)[0]);let[s,o]=this._htraverse(e,n,t);if(s instanceof r&&o){let a=s._nodes.get(o);if(a)return a;if(n)return s._nodes.set(o,i,">",null,s,null,!1,!0,"autocreate"),s._nodes.get(o)}return null}setBackref(e=null,t=null){let n=this._backref;if(this._backref=!0,this._parent=t,this._parentNode=e,!n){this._nodes._parentBag=this;for(let i of this)i.parentBag=this}}delParentRef(){this._parent=null,this._parentNode=null,this._backref=!1}clearBackref(){if(this._backref){this._backref=!1,this._parent=null,this._parentNode=null,this._nodes._parentBag=null;for(let e of this){e.parentBag=null;let t=e.getValue(!0);t instanceof r&&t.clearBackref()}}}_onNodeChanged(e,t,n,i=null,s=null,o=null,a=!1){for(let l of Object.values(this._updSubscribers))l({node:e,pathlist:t,oldvalue:i,attrs_diff:s,evt:n,reason:o,fired:a});this._parent&&this._parentNode&&this._parent._onNodeChanged(e,[this._parentNode.label,...t],n,i,s,o,a)}_onNodeInserted(e,t,n=null,i=null,s=!1){let o=e.parentBag,a=e.getValue(!0);o!==null&&o.backref&&a instanceof r&&a.setBackref(e,o),n===null&&(n=[]);for(let l of Object.values(this._insSubscribers))l({node:e,pathlist:n,ind:t,evt:"ins",reason:i,fired:s});this._parent&&this._parentNode&&this._parent._onNodeInserted(e,t,[this._parentNode.label,...n],i,s)}_onNodeDeleted(e,t,n=null,i=null){for(let s of Object.values(this._delSubscribers))s({node:e,pathlist:n,ind:t,evt:"del",reason:i});this._parent&&this._parentNode&&(n===null&&(n=[]),this._parent._onNodeDeleted(e,t,[this._parentNode.label,...n],i))}_subscribe(e,t,n){n!=null&&(t[e]=n)}subscribe(e,t={}){if(Object.hasOwn(t,"timer")||Object.hasOwn(t,"interval"))throw new TypeError("Timer subscriptions were removed. Schedule polling in the application.");let{update:n=null,insert:i=null,delete:s=null,any:o=null}=t;this.backref||this.setBackref(),this._subscribe(e,this._updSubscribers,n||o),this._subscribe(e,this._insSubscribers,i||o),this._subscribe(e,this._delSubscribers,s||o)}unsubscribe(e,t={}){if(Object.hasOwn(t,"timer")||Object.hasOwn(t,"interval"))throw new TypeError("Timer subscriptions were removed. Schedule polling in the application.");let{update:n=!1,insert:i=!1,delete:s=!1,any:o=!1}=t;(n||o)&&delete this._updSubscribers[e],(i||o)&&delete this._insSubscribers[e],(s||o)&&delete this._delSubscribers[e]}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}keys(){return this._nodes.keys()}values(){return this._nodes.values()}items(){return[...this._nodes].map(e=>({key:e.label,value:e.getValue()}))}get nodes(){return this.getNodes()}node(e){return this._nodes.get(e)}setAttr(e=null,t=null,n=!0){let i=r.prototype.getNode.call(this,e,!0,!0);i&&i.setAttr(t,!0,!0,n)}getAttr(e=null,t=null,n=null){let i=this.getNode(e);return i?i.getAttr(t,n):n}delAttr(e=null,...t){let n=this.getNode(e);n&&n.delAttr(...t)}getInheritedAttributes(){return this._parentNode?this._parentNode.getInheritedAttributes():{}}getNodes(e=null){return e?[...this._nodes].filter(t=>e(t)):[...this._nodes]}getNodeByValue(e,t){for(let n of this._nodes){let i=n.value;if(i instanceof r){if(i.getItem(e)===t)return n}else if(i&&i.get&&i.get(e)===t)return n}return null}getNodeByAttr(e,t,n=!1,i=!1){let s=t===void 0,o=n&&typeof t=="string"?t.toLowerCase():t,a=l=>{let u=[];for(let c of l._nodes){if(e in c.attr){let d=n&&typeof c.attr[e]=="string"?c.attr[e].toLowerCase():c.attr[e];if(s||d==o)return c}if(c._value instanceof r)if(i){let d=a(c._value);if(d)return d}else u.push(c._value)}for(let c of u){let d=a(c);if(d)return d}return null};return a(this)}isEmpty(e=!1,t=!1){if(this._nodes.length===0)return!0;for(let n of this._nodes){if(n._resolver!==null)return!1;let i=n.getValue(!0);if(i!=null&&!(e&&i===0)&&!(t&&i===""))return!1}return!0}query(e=null,t=null,n=!1,i=!1,s=!0,o=!0,a=null,l=!0){e||(e="#k,#v,#a");let u=this,c;if(typeof e=="string"){if(e.includes(":")){let[h,p]=e.split(":");u=this.getItem(h),e=p}c=e.split(",").map(h=>h.trim())}else c=e;let d=(h,p,m,g,_)=>{if(p==="#k")return h.label;if(p==="#p")return m;if(p==="#n")return h;if(typeof p=="function")return p(h);if(p==="#v"){let v=_();return g&&v instanceof r?null:v}else if(p.startsWith("#v.")){let v=p.split(".").slice(1).join("."),w=_();return w&&w.getItem?w.getItem(v):null}else{if(p==="#__v")return h.getValue(!0);if(p.startsWith("#a")){let v=p.includes(".")?p.split(".").slice(1).join("."):null;return h.getAttr(v)}else{let v=_();return v&&v.getItem?v.getItem(p):null}}};function*f(){let h=0;function*p(m,g){for(let _ of m._nodes){let v=g?`${g}.${_.label}`:_.label,w=!1,E,T=()=>(w||(E=_.getValue(l),w=!0),E);if((s&&o||(T()instanceof r?o:s))&&(t===null||t(_))&&(yield c.length===1?d(_,c[0],v,i,T):c.map(z=>d(_,z,v,i,T)),h++,a!==null&&h>=a))return;if(i){let z=T();if(z instanceof r&&(yield*p(z,v),a!==null&&h>=a))return}}}yield*p(u,"")}return n?f():[...f()]}getLeaves(){let e=[],t=(n,i)=>{for(let s of n._nodes){let o=i?`${i}.${s.label}`:s.label,a=s.getValue(!1);a instanceof r?t(a,o):e.push([o,a])}};return t(this,""),e}digest(e=null,t=null,n=!1){typeof t=="boolean"&&(console.warn("Bag.digest(what, asColumns) is deprecated; use digest(what, null, asColumns)."),n=t,t=null);let i=this.query(e,t,!1,!1,!0,!0,null,!1);if(n){if(!i||i.length===0)return(typeof e=="string"?e:"#k,#v,#a").split(",").map(l=>l.trim()).map(()=>[]);let s=[...i];if(s.length&&Array.isArray(s[0])){let o=s[0].length,a=[];for(let l=0;l<o;l++)a.push(s.map(u=>u[l]));return a}return[s]}return[...i]}columns(e,t=!1){typeof e=="string"&&(e=e.split(","));let n=t?"#a.":"",i=e.map(s=>`${n}${s}`).join(",");return this.digest(i,null,!0)}sum(e="#v",t=!1,n=null){if(t!=null&&typeof t!="boolean")throw new TypeError("sum strict must be a boolean; pass condition as the third argument");if(n!=null&&typeof n!="function")throw new TypeError("sum condition must be callable; deep is no longer supported");let i=s=>{let o=0,a=!1;for(let l of this.query(s,n)){if(l==null||l===""){a=!0;continue}if(typeof l!="number"&&typeof l!="boolean"){if(t)throw new TypeError(`sum encountered non-numeric value: ${typeof l}`);continue}o+=l}return t&&a?null:o};return e.includes(",")?e.split(",").map(s=>i(s.trim())):i(e)}sort(e="#k:a"){let t=(i,s)=>i==null?[-1,""]:s&&typeof i=="string"?[0,i.toLowerCase()]:[0,i],n=(i,s)=>i[0]!==s[0]?i[0]-s[0]:i[1]<s[1]?-1:i[1]>s[1]?1:0;if(typeof e=="function")this._nodes._list.sort((i,s)=>{let o=e(i),a=e(s);return o<a?-1:o>a?1:0});else{let i=e.split(",");i.reverse();for(let s of i){let o,a;s.includes(":")?[o,a]=s.split(":",2):(o=s,a="a"),o=o.trim(),a=a.trim();let l=a==="d"||a==="D",u=a==="a"||a==="d",c;if(o.toLowerCase()==="#k")c=d=>t(d.label,u);else if(o.toLowerCase()==="#v")c=d=>t(d.value,u);else if(o.toLowerCase().startsWith("#a.")){let d=o.slice(3);c=f=>t(f.getAttr(d),u)}else c=d=>{let f=d.value,h=f instanceof r?f.getItem(o):f?f[o]:null;return t(h,u)};this._nodes._list.sort((d,f)=>{let h=n(c(d),c(f));return l?-h:h})}}return this}equalTo(e){return e instanceof r?this._nodes.isEqual(e._nodes):!1}has(e){if(typeof e=="string"){let t=null;e.includes("?")&&([e,t]=e.split("?",2));let n=this.getNode(e);return n===null?!1:t===null?!0:t.split("&").every(i=>i in n.attr)}else if(e&&e.label!==void 0)return[...this._nodes].includes(e);return!1}getResolver(e){let t=this.getNode(e);return t?t.resolver:null}setResolver(e,t){let n=this.getNode(e);n||(this.setItem(e,null),n=this.getNode(e)),n.resolver=t}setCallbackItem(e,t,n={}){let i=new Sr({callback:t,...n});this.setResolver(e,i)}move(e,t,n=!0){this._nodes.move(e,t,n)}asDict(e=!1,t=!1,n=!1,i=!1){let s={};for(let o of this._nodes){let a=o.value;if(i&&a==null)continue;let l=o.label;e&&(l=String(l)),t&&(l=l.toLowerCase()),n&&a instanceof r&&(a=r.prototype.asDict.call(a,e,t,n,i)),Object.defineProperty(s,l,{value:a,enumerable:!0,writable:!0,configurable:!0})}return s}setdefault(e,t=null){let n=this.getNode(e);return n?n.value:(this.setItem(e,t),t)}deepcopy(e=!1){let t=this.createChildBag();for(let n of this._nodes){let i=n.getValue(!e);i instanceof r&&(i=i.deepcopy(e));let s=new t.nodeClass(t,n.label,i);s.setAttr({...n.attr},!1,!1,!1),s.nodeTag=n.nodeTag,s.xmlTag=n.xmlTag,t._nodes._list.push(s),t._nodes._dict[s.label]=s}return t}update(e,t=null,n=null,i=!1){if(!(e instanceof r)){for(let s in e){let o=e[s];(!i||o!==null||!this._nodes.has(s))&&this.setItem(s,o,null,">",!1,!1,n,!1,n!==!1)}return}for(let s of[...e]){let o=s.label,a=t==="static"?s.resolver:null,l=a?null:s.getValue(),u=s.attr.__replace;delete s.attr.__replace;let c=this._nodes.get(o);if(c)if(c.setAttr(s.attr,n===null?!0:n,!0,!1),s.nodeTag!=null&&(c.nodeTag=s.nodeTag),s.xmlTag!=null&&(c.xmlTag=s.xmlTag),a)c.resolver=a,c.setValue(null,n===null?!0:n,null,null,!1,n);else{s.resolver&&(c.resolver=null);let d=c.getValue();l instanceof r&&d instanceof r&&!u?d.update(l,t,n,i):(!i||l!==null)&&c.setValue(l,n===null?!0:n,null,null,!1,n)}else{let d=this.setItem(o,a||l,s.attr,">",!1,!1,n,!1,n!==!1);d.nodeTag=s.nodeTag,d.xmlTag=s.xmlTag}}}_fillFromBag(e){this.clear();for(let t of e){let n=new this.nodeClass(this,t.label);n.replace(t),n.nodeTag=t.nodeTag,n.xmlTag=t.xmlTag,this._nodes._list.push(n),this._nodes._dict[n.label]=n}}_appendLiteral(e,t,n=null,i=null,s=null){if(typeof e!="string")throw new TypeError("Bag labels must be strings");let o=new this.nodeClass(this,e,null,n,i,s,null,!1);return t instanceof re?o.resolver=t:o._value=t,this._nodes._dict[e]=o,this._nodes._list.push(o),o}fillFrom(e=null,t={}){let n=os(t);if(e!=null&&!Gt(e)&&!Array.isArray(e))throw new TypeError("Bag source must be a dictionary, array or null");let i=this.createChildBag(),s=new Set,o=(a,l,u)=>{if(s.has(l))throw new TypeError(`Cyclic Bag source at ${u}`);s.add(l);try{let c=Array.isArray(l)?String(l.length).length+1:0,d=Array.isArray(l)?Array.from(l,(f,h)=>[`r_${String(h).padStart(c,"0")}`,f]):Object.entries(l);if(!Array.isArray(l)&&Object.getOwnPropertySymbols(l).some(f=>Object.prototype.propertyIsEnumerable.call(l,f)))throw new TypeError(`Bag labels must be strings at ${u}`);for(let[f,h]of d){let p=h;n&&(Gt(p)||Array.isArray(p))&&(p=this.createChildBag(),o(p,h,`${u}[${JSON.stringify(f)}]`)),a._appendLiteral(f,p)}}finally{s.delete(l)}};return e!=null&&o(i,e,"$"),this._replacePrepared(i)}_loadSource(e,t={}){return this.fillFrom(e,t)}replace(e){if(!(e instanceof r))throw new TypeError("Bag.replace expects a Bag");if(e===this)return this;let t=this.createChildBag();return t._fillFromBag(e),this._replacePrepared(t)}_replacePrepared(e){for(let n of this._nodes){n.parentBag=null;let i=n.getValue(!0);i instanceof r&&i.clearBackref()}let t=this._nodes;this._nodes=e._nodes,e._nodes=t,this._nodes._parentBag=this.backref?this:null,e._nodes._parentBag=null;for(let n of this._nodes)n.parentBag=this;for(let n of e._nodes)n._parentBag=e;return this.backref&&this.parent&&this.parentNode&&this.parent._onNodeChanged(this.parentNode,[this.parentNode.label],"upd_value",e),this}forEach(e,{static:t=!0,deep:n=!1,kwargs:i={}}={}){if(typeof e!="function")throw new TypeError("forEach requires a callback");let s=(o,a)=>{for(let l=0;l<o._nodes.length;l++){let u=o._nodes._list[l],c={...a};"_pathlist"in a&&(c._pathlist=[...a._pathlist,u.label]),"_indexlist"in a&&(c._indexlist=[...a._indexlist,l]);let d=e(u,c,l);if(d)return d;if(d==null&&n){let f=u.getValue(t);if(f instanceof r){let h=s(f,c);if(h)return h}}}return null};return s(this,i)}*traverse(){for(let e of this._nodes){yield e;let t=e.getValue(!0);t instanceof r&&(yield*t.traverse())}}*_iterNodesWithPaths(e=!0,t=""){for(let n of this._nodes){let i=t?`${t}.${n.label}`:n.label;yield[i,n];let s=n.getValue(e);s instanceof r&&(yield*s._iterNodesWithPaths(e,i))}}*_nodeFlattener(e=null){let t=e!==null,n=t?Object.create(null):null,i=0,s=new Map([["[]",this.constructor]]);for(let[o,a]of Ma(this)){let l=o.slice(0,-1),u=JSON.stringify(o),c=JSON.stringify(l),d=a.getValue(!0),f,h=null;if(a.resolver)f=Br(a.resolver);else if(d instanceof r){let g=d.constructor,_=g.tytxSuffix;s.set(u,g),h=ss(g,Wt(s.get(c),_)),f=`::${_}`}else d===null?f="::NN":f=at(d);if(a.attr&&Object.hasOwn(a.attr,Ne))throw new Y(`node '${o}': the attribute '${Ne}' is reserved for the Bag class name`);let p=Rn(at(a.attr));h!==null&&(p[Ne]=h);let m=a.nodeTag;t?(yield[l.length?n[c]:null,a.label,m,f,p],d instanceof r&&(n[u]=i,e[i]=o,i++)):yield[l,a.label,m,f,p]}}toTytx(e="json",t=!1){let n=this._toTytxPayload(t),i=this.constructor.tytxSuffix;if(e==="json")return`${n}::${i}`;if(e==="msgpack")return sn(new De(4,new TextEncoder().encode(`${i}:${n}`)));throw new TypeError(`Unsupported transport: ${e}`)}_toTytxPayload(e=!1){let t;if(e){let s={};t={rows:[...this._nodeFlattener(s)],paths:s}}else t={rows:[...this._nodeFlattener(null)]};let n=this.constructor,i=ss(n,Wt(null,n.tytxSuffix));return i!==null&&(t[Ne]=i),t.rows=t.rows.map(([s,o,a,l,u])=>[at(s),at(o),at(a),l,u]),t.paths&&(t.paths=at(t.paths)),be(t)}static fromTytx(e,t="json",n={}){if(Gt(t)&&(n=t,t="json"),os(n),typeof e!="string"&&!(e instanceof Uint8Array))throw new TypeError("fromTytx requires serialized text or bytes");if(t!=="json"&&t!=="msgpack")throw new TypeError(`Unsupported transport: ${t}`);t==="json"&&e instanceof Uint8Array&&(e=new TextDecoder().decode(e));let i=K(e,t==="json"?null:t);if(i instanceof r)return i;if(!Gt(i)&&!Array.isArray(i))throw new TypeError("fromTytx requires a dictionary, array or typed Bag root");return new this(i,n)}static _fromTytxPayload(e){let t=this.tytxSuffix;if(e==="")return new(Wt(null,t));let n=K(e);if(!n||!Array.isArray(n.rows))throw new Y("Invalid TYTX Bag: expected rows");let i=n.paths,s=i!=null,o=Object.hasOwn(n,Ne)?is(t,n[Ne]):Wt(null,t),a=new o,l=new Map([["[]",a]]);for(let u of n.rows){if(!Array.isArray(u)||u.length!==5)throw new Y("Invalid TYTX Bag row");let[c,d,f,h,p]=u,m=c??"";if(s){if(c!==null&&!Object.hasOwn(i,c))throw new Y(`Unknown TYTX parent reference: ${c}`);m=c===null?"":i[c]}if(typeof m=="string"&&(m=m?m.split("."):[]),!Array.isArray(m))throw new Y("Invalid TYTX parent path");let g=JSON.stringify(m);if(!l.has(g))throw new Y(`Missing or undecodable TYTX parent branch: ${m}`);let _=l.get(g),v=JSON.stringify([...m,d]),w=h,E=In(w),T=ns(p),I=Object.hasOwn(T,Ne)?T[Ne]:null;if(delete T[Ne],w instanceof r){let q=w.constructor.tytxSuffix,ie=I!==null?is(q,I):Wt(_.constructor,q);w=new ie,l.set(v,w)}else if(I!==null)throw new Y(`node '${v}': the attribute '${Ne}' is reserved for the Bag class name of a branch`);let z=_._appendLiteral(d,E?null:w,T,E);z.nodeTag=f??null}return a}toXml(e={}){let{pretty:t=!1,encoding:n="UTF-8",docHeader:i=null,selfClosedTags:s=null}=e,o=this._bagToXml(s,t);return i===!0?o=`<?xml version='1.0' encoding='${n}'?>
|
|
14
|
-
${o}`:typeof i=="string"&&(o=`${i}
|
|
15
|
-
${o}`),o}_bagToXml(e=null,t=!1,n=0){let i=[];for(let s of this._nodes)i.push((t?" ".repeat(n):"")+this._nodeToXml(s,e,t,n));return i.join(t?`
|
|
16
|
-
`:"")}_nodeToXml(e,t=null,n=!1,i=0){let s=e.xmlTag||e.nodeTag||e.label,o=this._sanitizeTag(s),a=[];if(o!==s&&a.push(`_tag="${this._escapeAttr(s)}"`),e.resolver&&a.push(`_resolver="${this._escapeAttr(Br(e.resolver))}"`),e.attr)for(let[f,h]of Object.entries(Rn(e.attr)))h!==null&&h!==!1&&h!==void 0&&a.push(`${f}="${this._escapeAttr(String(h))}"`);let l=a.length?" "+a.join(" "):"",u=e.resolver?null:e.getValue(!0);if(u&&typeof u._bagToXml=="function"){n=n&&e.attr?.["xml:space"]!=="preserve";let f=u._bagToXml(t,n,i+1);return f?n?`<${o}${l}>
|
|
17
|
-
${f}
|
|
18
|
-
${" ".repeat(i)}</${o}>`:`<${o}${l}>${f}</${o}>`:t===null||t.includes(o)?`<${o}${l}/>`:`<${o}${l}></${o}>`}if(u==null||u==="")return t===null||t.includes(o)?`<${o}${l}/>`:`<${o}${l}></${o}>`;let c=u instanceof Date&&!Number.isNaN(u.getTime())?Bf(u):String(u),d=this._escapeXml(c);return`<${o}${l}>${d}</${o}>`}_sanitizeTag(e){return e?e.replace(/[^a-zA-Z0-9_\-.:]/g,"_"):"_none_"}_escapeXml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}_escapeAttr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}static fromXml(e,t={}){let{tagAttribute:n=null}=t,i;if(typeof DOMParser<"u"){i=new DOMParser().parseFromString(e,"application/xml");let o=i.querySelector("parsererror");if(o)throw new Error(`XML parse error: ${o.textContent}`)}else i=new Ra.DOMParser().parseFromString(e,"application/xml");return this._xmlElementToBag(i.documentElement,n)}static _xmlElementToBag(e,t=null){let n=new this,i=Array.from(e.childNodes).filter(s=>s.nodeType===1);for(let s of i){let o=s.tagName,a={};for(let m=0;m<s.attributes.length;m++){let g=s.attributes[m];a[g.name]=g.value}let l=In(a._resolver);l&&delete a._resolver;let u=String(a._T||"").toUpperCase()==="BAG";Object.assign(a,ns(a));let c=o;"_tag"in a&&(c=a._tag,delete a._tag),t&&t in a&&(c=a[t],delete a[t]);let d=c,f=1;for(;n.getNode(c);)c=`${d}_${f++}`;let h=Array.from(s.childNodes).filter(m=>m.nodeType===1),p;if(h.length>0||u){let m=this._xmlElementToBag(s,t);p=n.setItem(c,m,Object.keys(a).length>0?a:null)}else{let m=s.textContent||"";p=n.setItem(c,m,Object.keys(a).length>0?a:null)}l&&(p.resolver=l),p.xmlTag=o}return n}static async fromUrl(e,t={}){let{timeout:n=30}=t,i={};n&&(i.signal=AbortSignal.timeout(n*1e3));let s=await fetch(e,i),o=s.headers.get("content-type")||"",a=await s.text();if(o.includes("json"))return r.fromTytx(a);if(o.includes("xml"))return r.fromXml(a);let l=a.trim();if(l.startsWith("<"))return r.fromXml(a);if(l.startsWith("{")||l.startsWith("["))return r.fromTytx(a);throw new Ir(`Unsupported content-type: ${o}`)}toJson(e=!0){let t=[];for(let n of this._nodes)t.push(this._nodeToJsonDict(n,e));return e?be(t):JSON.stringify(t)}_nodeToJsonDict(e,t){let n=e.resolver?null:e.getValue(!0);if(n&&typeof n._nodeToJsonDict=="function"){let s=[];for(let o of n._nodes)s.push(n._nodeToJsonDict(o,t));n=s}let i={label:e.label,value:n,attr:Rn(e.attr)};return e.nodeTag!==null&&(i.tag=e.nodeTag),e.resolver&&(i.resolver=Br(e.resolver)),i}static fromJson(e,t={}){return Ia||(console.warn("Bag.fromJson is deprecated; use Bag.fromTytx"),Ia=!0),this.fromTytx(e,"json",t)}toStringTree(e=!0,t=null,n="",i=!0){t===null&&(t=new Map);let s=[],o=[...this._nodes];for(let a=0;a<o.length;a++){let l=o[a],u=a===o.length-1,c=l.getValue(e),d=l.getAttr(),f="",h=Object.keys(d);h.length>0&&(f=" ["+h.map(_=>`${_}=${JSON.stringify(d[_])}`).join(", ")+"]");let p=u?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",m=n+(u?" ":"\u2502 ");if(c instanceof r){let g=l,_=c.backref?"(*)":"";if(t.has(g))s.push(`${n}${p}${l.label}${_}${f} \u2192 (circular ref)`);else{t.set(g,l.label),s.push(`${n}${p}${l.label}${_}${f}`);let v=c.toStringTree(e,t,m,u);v&&s.push(v)}}else{let g;if(c===null)g="null";else if(c===void 0)g="undefined";else if(c instanceof ArrayBuffer||c instanceof Uint8Array){let _=new TextDecoder("utf-8",{fatal:!1}),v=c instanceof ArrayBuffer?new Uint8Array(c):c;g=_.decode(v)}else typeof c=="string"?c.length>50?g=JSON.stringify(c.slice(0,47)+"..."):g=JSON.stringify(c):g=String(c);s.push(`${n}${p}${l.label}: ${g}${f}`)}}return s.join(`
|
|
19
|
-
`)}toString(e=!0,t=null,n=""){t||(t=new Set);let i=[],s=[...this._nodes];for(let o=0;o<s.length;o++){let a=s[o],l=o===s.length-1,u=a.getValue(e),c="",d=a.attr;d&&Object.keys(d).length>0&&(c=` [${Object.entries(d).map(([m,g])=>`${m}=${JSON.stringify(g)}`).join(", ")}]`);let f=l?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",h=n+(l?" ":"\u2502 ");if(u&&typeof u._htraverse=="function"){let p=a;if(t.has(p))i.push(`${n}${f}${a.label}${c} \u2192 (circular ref)`);else{t.add(p),i.push(`${n}${f}${a.label}${c}`);let m=u.toString(e,t,h);m&&i.push(m)}}else{let p;u==null?p="null":typeof u=="string"&&u.length>50?p=JSON.stringify(u.slice(0,47)+"..."):typeof u=="string"?p=JSON.stringify(u):p=String(u),i.push(`${n}${f}${a.label}: ${p}${c}`)}}return i.join(`
|
|
20
|
-
`)}},Ir=class extends Error{constructor(e){super(e),this.name="BagException"}};re.registerBagClass(ne);Ji(ne,"X",r=>r._toTytxPayload(),r=>ne._fromTytxPayload(r));Tr(ne.tytxSuffix,{...ze(ne.tytxSuffix),Bag:ne});var La=new Set(["False","None","True","and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"]);function Fa(r){return r.endsWith("_")&&La.has(r.slice(0,-1))?r.slice(0,-1):r}function $a(r){let e=Fa(r);return e!==r?e:r.startsWith("_")&&La.has(r.slice(1))?r.slice(1):r}function as(r,{renderTag:e=null,ns:t=null,dialectName:n=null}={}){let i=e||r;if(!i)return i;if(i=Fa(i),t&&!e){let s=`${n}_`;i.startsWith(s)&&(i=i.slice(s.length)),i=`${t}:${i}`}return i}var Yt=Symbol("value"),qa=new Set(["_meta","datapath","nodeId","ns","form","formId","_anchor","updateOn"]);function ls(r){return Object.entries(r||{}).filter(([e])=>!qa.has(e)).map(([e,t])=>[$a(e),t])}var Xt=class extends Ve{constructor(e,t,n=null,i=null,s=null,o=null,a=null){super(e,t,n,i,s,o,a),this._builder=e?._insertingBuilder??e?._builder??null,this._targetId=null}get builder(){if(this._builder)return this._builder;let e=this.parentBag;return e?e._builder:null}get data(){return this.builder.data}get rootBuilder(){return this.parentBag.root._builder}_getMeta(e){let t=this.getAttr("_meta")||{},n=e.split(",").map(i=>i.trim());return n.length===1?t[n[0]]!==void 0?t[n[0]]:null:n.map(i=>t[i]!==void 0?t[i]:null)}pointerType(e){return typeof e=="string"&&(e[0]==="^"||e[0]==="=")&&!e.startsWith("==")?e[0]:null}pointers(){this.builder.validateCustomTypes(this);let e=[];for(let[t,n]of Object.entries(this.getAttr()||{}))this.pointerType(n)==="^"&&e.push([t,n.split(":",1)[0]]);return this.pointerType(this.value)==="^"&&e.push(["",this.value.split(":",1)[0]]),e}fixedAttrItems(){return ls(this.getAttr())}runtimeToEvaluate(){let e=new Map(this.fixedAttrItems());return e.set(Yt,this.value),e}absDatapath(e){let t=e;this.pointerType(e)&&(e=(ot(e)?.pointer??e).slice(1));let n=null;return e.includes("?")&&([e,n]=e.split("?",2)),e.startsWith("#")?this._finalizeAbsPath(this._resolveSymbolicDatapath(e,t),n):(e.startsWith(".")&&(e=this._composeRelativeDatapath(e,t)),this._finalizeAbsPath(e,n))}_finalizeAbsPath(e,t){return e=this._collapseParentDatapath(e,e),t?`${e}?${t}`:e}_composeRelativeDatapath(e,t){let n=this;for(;n!==null&&e.startsWith(".");){let i=n.getAttr("datapath");i!=null&&(e=e==="."?i:i+e),n=n.parentNode}if(e.startsWith("."))throw new Error(`unresolved relative datapath: ${t}`);return e}_collapseParentDatapath(e,t){let n=[];for(let i of e.split("."))if(i==="#parent"){if(n.length===0)throw new Error(`#parent has no segment to cancel: ${t}`);n.pop()}else n.push(i);return n.join(".")}_resolveSymbolicDatapath(e,t){let n=e.slice(1),i=n.indexOf("."),s=i===-1?n:n.slice(0,i),o=i===-1?"":n.slice(i+1),a;if(s==="FORM")a=this._findMarkedDatapathAncestor(!0,!1,t);else if(s==="ANCHOR")a=this._findMarkedDatapathAncestor(!1,!0,t);else{let l=this.rootBuilder;if(!l)throw new Error(`#<id>: cannot resolve ${t} on a node without builder`);if(a=l.source.getNodeByAttr("nodeId",s),a==null)throw new Error(`#<id>: cannot resolve ${t}`)}return a.absDatapath(o?`.${o}`:".")}_findMarkedDatapathAncestor(e,t,n){let i=this;for(;i!=null;){let o=i.getAttr()||{};if(e&&(o.formId!=null||o.form===!0)||t&&"_anchor"in o)return i;i=i.parentNode}let s=e?"FORM":"ANCHOR";throw new Error(`#${s}: no marked ancestor found for ${n}`)}getRelativeData(e,t=null,{autocreate:n=!1}={}){let i=this.data,s=this.absDatapath(e);return n&&i.getItem(s)==null&&i.setItem(s,t),i.getItem(s,t)}setRelativeData(e,t,{attributes:n=null,fired:i=!1,reason:s=null}={}){let o=this.data,a=this.absDatapath(e);o.setItem(a,t,n,">",!1,!0,s===null?!0:s,i)}fireEvent(e,t=!0,{attributes:n=null,reason:i=null}={}){this.setRelativeData(e,t,{attributes:n,fired:!0,reason:i})}SET(e,t){this.setRelativeData(e,t)}GET(e){return this.getRelativeData(e)}PUT(e,t){this.setRelativeData(e,t,{reason:!1})}FIRE(e,t=!0){this.setRelativeData(e,t,{fired:!0})}},X=class r extends ne{constructor(e=null,t=null){super(e),this._builder=t,this._insertingBuilder=null}get nodeClass(){return Xt}_setBuilderItem(e,t,n,...i){let s=t?.map(([a])=>[a,a._builder])||null;if(t)for(let[a,l]of t)a._builder=l;let o=this._insertingBuilder;this._insertingBuilder=e;try{return this.setItem(n,...i)}catch(a){if(this.node(n)==null&&s)for(let[l,u]of s)l._builder=u;throw a}finally{this._insertingBuilder=o}}bindBuilder(e){if(!e)throw new Error("SourceBag.bindBuilder requires a builder");let t=this._builderBindingPlan(e);for(let[n,i]of t)n._builder=i;return this.setBackref(),this}_builderBindingPlan(e){let t=[],n=new WeakSet,i=(s,o)=>{if(n.has(s))throw new Error("source contains a cyclic or shared SourceBag branch");n.add(s),t.push([s,o]);for(let a of s.getNodes()){let l=o,u=a._getMeta("subbuilder");u!=null&&(l=o._resolveSubbuilderReference(u,a.getAttr()||{},a.nodeTag)),t.push([a,l]);let c=a.getValue(!0);c instanceof r&&i(c,l)}};return i(this,e),t}};if((ze(X.tytxSuffix).SourceBag??X)!==X)throw new Error("TYTX subtype name 'SourceBag' is already registered for another class");Tr(X.tytxSuffix,{...ze(X.tytxSuffix),SourceBag:X});function Lf(r){if(r.length===0)return{value:null,attrs:{}};let e=r[0];if(e!==null&&typeof e=="object"){let t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null)return{value:null,attrs:e}}return{value:e,attrs:r[1]||{}}}var Ff=new Set(["then","toJSON"]),Ua=new WeakMap;function Rr(r){return Ua.get(r)||r}function us(r){if(r==null)return r;r=Rr(r);let e=r._builder||r.parentBag&&r.parentBag._builder;return e?e.wrapSource(r):r}function ja(r,e){let t=e instanceof ne,n=new Proxy(e,{get(i,s){if(typeof s=="symbol"||s.startsWith("_")||Ff.has(s))return Reflect.get(i,s,i);let o=r.schemaTag(s);if(t&&o)return Pa(r,i,o,t);if(s in i){let l=Reflect.get(i,s,i);return typeof l=="function"?l.bind(i):l}if(o)return Pa(r,i,o,t);let a=r.containerMethod(s);if(a)return(...l)=>r[a](r.wrapSource(i),...l)}});return Ua.set(n,e),n}function Pa(r,e,t,n){return(...i)=>{let{value:s,attrs:o}=Lf(i),a=n?r.bagCall(e,t,s,o):r.commandOnNode(e,t,s,o);return a.builder.wrapSource(a)}}var Va=/^[A-Za-z_][A-Za-z0-9_]*$/,$f=new Set(["positional_only","positional_or_keyword","keyword_only","var_positional","var_keyword"]),Pf=new Set(["framework","value","attribute"]),qf=new Map([["builtins.str",r=>typeof r=="string"],["builtins.int",r=>Number.isInteger(r)],["builtins.float",r=>typeof r=="number"&&Number.isFinite(r)],["builtins.bool",r=>typeof r=="boolean"],["builtins.list",r=>Array.isArray(r)],["builtins.dict",r=>r!==null&&typeof r=="object"&&!Array.isArray(r)],["builtins.tuple",r=>Array.isArray(r)],["builtins.set",r=>Array.isArray(r)||r instanceof Set],["builtins.NoneType",r=>r===null],["builtins.object",r=>!0]]);function wt(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function k(r,e){throw new TypeError(`${r}: ${e}`)}function Le(r,e,t,n){wt(r)||k(n,"must be an object");for(let i of Object.keys(r))e.includes(i)||k(n,`unknown field '${i}'`);for(let i of t)Object.hasOwn(r,i)||k(n,`missing field '${i}'`)}function yt(r,e){if(!(r===null||typeof r=="string"||typeof r=="boolean")&&!(typeof r=="number"&&Number.isFinite(r))){if(Array.isArray(r))return r.forEach((t,n)=>yt(t,`${e}[${n}]`));if(wt(r))return Object.entries(r).forEach(([t,n])=>yt(n,`${e}.${t}`));k(e,"must be lossless JSON data")}}function Uf(r,e){let t="",n=!1;for(let i=0;i<r.length;i++){let s=r[i];if(s==="\\"){t+=s+(r[++i]??"");continue}s==="["&&(n=!0),!n&&s==="."&&!(e&16)?t+="[^\\n]":!n&&s==="^"&&e&8?t+="(?:^|(?<=\\n))":!n&&s==="$"?t+=e&8?"(?=\\n|(?![\\s\\S]))":"(?=\\n?(?![\\s\\S]))":t+=s,s==="]"&&(n=!1)}return t}function _t(r,e,t=!1,n=null){if(r===null)return null;switch(Le(r,["kind","dtype","module","name","origin","arguments","items","values","base","metadata","pattern","flags","ge","le","gt","lt","value"],["kind"],e),r.kind){case"custom":return Le(r,["kind","name"],["kind","name"],e),n||k(e,"custom references require a catalog; nested catalog references are unsupported"),n.resolve(r.name,e);case"dtype":{Le(r,["kind","dtype"],["kind","dtype"],e);let i=r.dtype;typeof i!="string"&&k(e,"dtype must be a string");let s=Dr(i);return!s&&i!=="NN"&&k(e,`unknown dtype '${i}'`),{...r,test:a=>i==="NN"?a===null:i==="N"?F(a)&&!["NaN","Infinity","-Infinity"].includes(a.toString()):s===Number?typeof a=="number"&&Number.isFinite(a)&&(i!=="L"||Number.isInteger(a)):s===String?typeof a=="string":s===Boolean?typeof a=="boolean":s===Date?a instanceof Date&&Number.isFinite(a.getTime()):s===Object?wt(a)&&[Object.prototype,null].includes(Object.getPrototypeOf(a)):a instanceof s}}case"any":return{...r,test:i=>!0};case"type":{(typeof r.module!="string"||typeof r.name!="string")&&k(e,"type requires string module/name");let i=`${r.module}.${r.name}`;if(i==="collections.abc.Callable")return{...r,test:o=>typeof o=="function",portable:!1};let s=qf.get(i);return s||k(e,`unsupported type '${i}'`),{...r,test:s}}case"union":{(!Array.isArray(r.items)||!r.items.length)&&k(e,"union items must be non-empty");let i=r.items.map((s,o)=>_t(s,`${e}.items[${o}]`,!0,n));return{...r,items:i,inputConstraint:i.some(s=>s.inputConstraint),test:s=>i.some(o=>o.test&&o.test(s))}}case"literal":return Array.isArray(r.values)||k(e,"literal values must be an array"),r.values.forEach((i,s)=>yt(i,`${e}.values[${s}]`)),{...r,test:i=>r.values.some(s=>Object.is(s,i))};case"annotated":{Array.isArray(r.metadata)||k(e,"annotated metadata must be an array"),r.metadata.some(o=>!["regex","range","value"].includes(o?.kind))&&k(e,"unsupported annotation metadata kind");let i=_t(r.base,`${e}.base`,!0,n),s=r.metadata.map((o,a)=>_t(o,`${e}.metadata[${a}]`,!0,n));return{...r,base:i,metadata:s,inputConstraint:i.inputConstraint,test:o=>i.test(o)&&s.every(a=>!a.test||a.test(o))}}case"range":{for(let i of["ge","le","gt","lt"])Object.hasOwn(r,i)||k(e,`range missing '${i}'`);for(let i of["ge","le","gt","lt"])r[i]!==null&&(typeof r[i]!="number"||!Number.isFinite(r[i]))&&k(e,`${i} must be finite number or null`);return{...r,test:i=>typeof i=="number"&&(r.ge===null||i>=r.ge)&&(r.le===null||i<=r.le)&&(r.gt===null||i>r.gt)&&(r.lt===null||i<r.lt)}}case"regex":{(typeof r.pattern!="string"||!Number.isInteger(r.flags)||r.flags<0)&&k(e,"regex requires pattern and non-negative integer flags");let i=r.flags&-59;i&&k(e,`unsupported Python regex flags ${i}`),r.flags&2&&k(e,"IGNORECASE is not portable across Python and JavaScript Unicode rules"),/\\[AZzUwWdDsSabBN0-9]|\(\?P[<=!]|\(\?\(|\(\?>|\(\?#|\(\?[aiLmsux-]|[+*?}]\+|\{,/.test(r.pattern.replaceAll(String.raw`[\s\S]`,"."))&&k(e,"regex uses a non-portable construct or character class");let s="uy";r.flags&16&&(s+="s");let o;try{o=new RegExp(`(?:${Uf(r.pattern,r.flags)})(?![\\s\\S])`,s)}catch(a){k(e,`invalid portable regex: ${a.message}`)}return{...r,test:a=>typeof a!="string"?!1:(o.lastIndex=0,o.test(a))}}case"value":return yt(r.value,`${e}.value`),{...r};case"generic":{let i=_t(r.origin,`${e}.origin`,!0,n);(r.origin?.kind!=="type"||r.origin.module!=="builtins"||!["list","dict","tuple","set"].includes(r.origin.name))&&k(e,"only list, dict, tuple and set generic origins are supported"),Array.isArray(r.arguments)||k(e,"generic arguments must be an array");let s=r.arguments.map((o,a)=>_t(o,`${e}.arguments[${a}]`,!0,n));return{...r,origin:i,arguments:s,inputConstraint:s.some(o=>o.inputConstraint),test:o=>i.test(o)&&jf(r.origin,s,o)}}case"arguments":k(e,"Callable argument-list descriptors are not supported by Python validation");case"ellipsis":return t||k(e,"ellipsis is only valid as a nested descriptor"),{...r};default:k(e,`unknown annotation kind '${r.kind}'`)}}function jf(r,e,t){let n=`${r.module}.${r.name}`;return n==="builtins.tuple"&&e.length&&e[1]?.kind!=="ellipsis"?t.length===e.length&&t.every((i,s)=>e[s].test(i)):n==="builtins.list"||n==="builtins.set"||n==="builtins.tuple"?[...t].every(i=>!e[0]?.test||e[0].test(i)):n==="builtins.dict"?Object.entries(t).every(([i,s])=>(!e[0]?.test||e[0].test(i))&&(!e[1]?.test||e[1].test(s))):!1}function Ha(r,e){if(r===null)return null;if(typeof r!="string"&&k(e,"must be string or null"),r==="")return new Map;let t=new Map;for(let n of r.split(",")){let i=n.trim();/^[A-Za-z_][A-Za-z0-9_]*\[\]$/.test(i)&&k(e,`invalid cardinality item '${n}'`);let s=i.match(/^([A-Za-z_][A-Za-z0-9_]*|\*)(?:\[(?:(\d+)|(?:(\d*):(\d*)))\])?$/);s||k(e,`invalid cardinality item '${n}'`);let[,o,a,l,u]=s;t.has(o)&&k(e,`duplicate tag '${o}'`);let c=0,d=1/0;i.includes("[")&&(i.includes(":")?(c=l?Number(l):0,d=u?Number(u):1/0):c=d=Number(a)),d<c&&k(e,`maximum ${d} is below minimum ${c}`),t.set(o,{min:c,max:d})}return t.has("*")&&t.size>1&&k(e,"wildcard '*' cannot be combined with named tags"),t}function Wa(r,e){if(r===null)return null;typeof r!="string"&&k(e,"must be string or null");let t=new Set;for(let n of r.split(",")){let i=n.trim();i&&((!Va.test(i)||t.has(i))&&k(e,`invalid or duplicate parent '${n}'`),t.add(i))}return t}function zf(r,e,t){if(r===null)return null;Le(r,["parameters","accepts_var_keyword","accepts_var_positional"],[],e);let n=r.parameters??[];Array.isArray(n)||k(e,"parameters must be an array"),r={parameters:n,accepts_var_keyword:n.some(l=>l.kind==="var_keyword"),accepts_var_positional:n.some(l=>l.kind==="var_positional"),...r},(!Array.isArray(r.parameters)||typeof r.accepts_var_keyword!="boolean"||typeof r.accepts_var_positional!="boolean")&&k(e,"invalid signature descriptor");let i=new Set,s=!1,o=!1,a=r.parameters.map((l,u)=>{let c=`${e}.parameters[${u}]`;return Le(l,["name","kind","role","annotation","has_default","default"],["name","kind","role","annotation","has_default"],c),(typeof l.name!="string"||!Va.test(l.name)||i.has(l.name))&&k(c,"invalid or duplicate parameter name"),i.add(l.name),(!$f.has(l.kind)||!Pf.has(l.role)||typeof l.has_default!="boolean")&&k(c,"invalid kind, role, or has_default"),l.has_default!==Object.hasOwn(l,"default")&&k(c,"default presence must equal has_default"),l.has_default&&yt(l.default,`${c}.default`),s||=l.kind==="var_keyword",o||=l.kind==="var_positional",{...l,annotation:_t(l.annotation,`${c}.annotation`,!1,t)}});return(s!==r.accepts_var_keyword||o!==r.accepts_var_positional)&&k(e,"variadic summary flags do not match parameters"),{...r,parameters:a}}function za(r,e,t,n){let i=["doc","sub_tags","parent_tags","inherits_from","ns","attributes",...t?["node_label","collection_key"]:[],"_meta"];Le(r,i,[],e),r={...Object.fromEntries(i.map(s=>[s,null])),...r};for(let s of["doc","inherits_from","ns",...t?["node_label","collection_key"]:[]])r[s]!==null&&typeof r[s]!="string"&&k(e,`${s} must be string or null`);return r._meta!==null&&(wt(r._meta)||k(e,"_meta must be object or null"),yt(r._meta,`${e}._meta`)),Ha(r.sub_tags,`${e}.sub_tags`),Wa(r.parent_tags,`${e}.parent_tags`),{...r,attributes:zf(r.attributes,`${e}.attributes`,n)}}function Ga(r){return r?r.split(",").map(e=>e.trim()).filter(Boolean):[]}function Xa(r,e){let t={...e};for(let[n,i]of Object.entries(r))n==="inherits_from"||n.startsWith("_")||t[n]||(t[n]=i);return t._meta={...r._meta||{},...e._meta||{}},t}function Ya(r){let e={...r};return e._subSpec=Object.hasOwn(e,"sub_tags")?Ha(e.sub_tags,"resolved.sub_tags"):null,e._parentSpec=Object.hasOwn(e,"parent_tags")?Wa(e.parent_tags,"resolved.parent_tags"):null,e}function Za(r,e,t,n){if(t.get(r)===1&&k(n,`inheritance cycle at '${r}'`),t.get(r)===2)return e[r];let i=e[r];i||k(n,`unknown abstract '${r}'`),t.set(r,1);let s={...i};for(let o of Ga(i.inherits_from))s=Xa(Za(o,e,t,n),s);return s=Ya(s),t.set(r,2),e[r]=s,s}function cs({abstracts:r={},elements:e={}}){let t={...r},n=new Map;for(let s of Object.keys(t))Za(s,t,n,`abstracts.${s}.inherits_from`);let i={};for(let[s,o]of Object.entries(e)){let a={...o};for(let l of Ga(o.inherits_from)){let u=t[l];u||k(`elements.${s}.inherits_from`,`unknown abstract '${l}'`),a=Xa(u,a)}i[s]=Ya(a)}return{abstracts:t,elements:i}}function ds(r){Le(r,["document_format","grammar","abstracts","elements","custom_types"],["document_format","grammar","abstracts","elements"],"grammar document"),Le(r.document_format,["name","version"],["name","version"],"document_format"),(r.document_format.name!=="builder_grammar"||!["1.1","1.2"].includes(r.document_format.version))&&k("document_format","expected builder_grammar version 1.1 or 1.2"),Le(r.grammar,["name","version","title","description"],["name","version","title","description"],"grammar"),(typeof r.grammar.name!="string"||!r.grammar.name)&&k("grammar.name","must be non-empty string");for(let i of["version","title","description"])r.grammar[i]!==null&&typeof r.grammar[i]!="string"&&k(`grammar.${i}`,"must be string or null");(!wt(r.abstracts)||!wt(r.elements))&&k("grammar document","abstracts/elements must be objects"),Object.hasOwn(r,"custom_types")&&r.document_format.version!=="1.2"&&k("custom_types","requires version 1.2");let e=Mn.fromJSON(r.custom_types??{}),t={};for(let[i,s]of Object.entries(r.abstracts))(!i||i.startsWith("_"))&&k("abstracts",`invalid public name '${i}'`),t[i]=za(s,`abstracts.${i}`,!1,e);let n={};for(let[i,s]of Object.entries(r.elements))(!i||i.startsWith("_"))&&k("elements",`invalid public name '${i}'`),n[i]=za(s,`elements.${i}`,!0,e);return{grammar:structuredClone(r.grammar),abstracts:t,elements:n}}function Ka(r,e,t,n){let i=e.attributes;if(!i)return;let s={...n};t!=null&&(s.node_value=t);let o=new Set(i.parameters.filter(u=>u.role==="attribute").map(u=>u.name)),a=new Set(["node_label","node_position","nodeId","target_id","datapath","iterate","store","_tag","_meta","ns"]);if(!i.accepts_var_keyword)for(let u of Object.keys(n))!o.has(u)&&!a.has(u)&&k(r,`unknown attribute '${u}'`);let l=e._meta?.component?i.parameters.find(u=>u.role!=="framework"&&["positional_only","positional_or_keyword"].includes(u.kind))?.name:null;for(let u of i.parameters){if(u.name===l||u.role==="framework"||u.kind.startsWith("var_"))continue;let c=Object.hasOwn(s,u.name);!c&&!u.has_default&&k(r,`missing required ${u.role} '${u.name}'`),c&&u.annotation!==null&&(!u.annotation.test||!u.annotation.test(s[u.name]))&&k(r,`invalid value for ${u.role} '${u.name}'`)}}var Mn=class r{#e=new Map;#t=new Map;register(e,t,n){let i=new Map([[String,"str"],[Number,"float"],["string","str"],["integer","int"],["number","float"]]),s=i.has(t)?{kind:"type",module:"builtins",name:i.get(t)}:t;return this.#i(e,{kind:"annotated",base:s,metadata:[n]})}#i(e,t){(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_]*$/.test(e)||e in this||["to_dict","from_dict"].includes(e)||Vf.has(e))&&k("custom_types",`invalid, reserved or duplicate name '${e}'`),Le(t,["kind","base","metadata"],["kind","base","metadata"],`custom_types.${e}`),(t.kind!=="annotated"||!Array.isArray(t.metadata)||t.metadata.length!==1||!["regex","range"].includes(t.metadata[0]?.kind))&&k(`custom_types.${e}`,"requires an annotated base with one Regex or Range validator");let n=t.metadata[0].kind==="regex"?["str"]:["int","float"];(t.base?.kind!=="type"||t.base.module!=="builtins"||!n.includes(t.base.name))&&k(`custom_types.${e}`,"portable Regex requires str; portable Range requires int or float"),yt(t,`custom_types.${e}`);let i=structuredClone(t),s=_t(i,`custom_types.${e}`),o=Object.freeze({kind:"custom",name:e});return Object.defineProperty(this,e,{value:o,enumerable:!0}),this.#e.set(e,i),this.#t.set(e,{...o,inputConstraint:!0,test:s.test}),o}resolve(e,t="custom_types"){return this.#t.has(e)||k(t,`unknown custom type '${e}'`),{...this.#t.get(e)}}validate(e,t){return this.resolve(e).test(t)||k(`custom_types.${e}`,"invalid input value"),!0}toJSON(){return structuredClone(Object.fromEntries(this.#e))}static fromJSON(e){wt(e)||k("custom_types","must be an object");let t=new r;for(let[n,i]of Object.entries(e))t.#i(n,i);return t}},Vf=new Set("False None True and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield".split(" "));function Ja(r,e,t,n){let i=e?.attributes;if(i)for(let s of i.parameters){if(!s.annotation?.inputConstraint||s.role==="framework"||["var_keyword","var_positional"].includes(s.kind))continue;let o=s.role==="value"?t:n[s.name];o!==void 0&&(s.annotation.test(o)||k(r,`invalid input for '${s.name}' (custom type)`))}}function Qa(r,e,t=[]){if(e===null)return structuredClone(r);if(t.length===2&&t[0]==="custom_types"&&r!==void 0){if(!fs(r,e))throw new TypeError(`conflicting custom type '${t[1]}'`);return structuredClone(r)}if(t.length===2&&["abstracts","elements"].includes(t[0]))return structuredClone(e);if(He(r)&&He(e)){let n=structuredClone(r);for(let[i,s]of Object.entries(e))s!==null&&Object.defineProperty(n,i,{value:Qa(n[i],s,[...t,i]),enumerable:!0,writable:!0,configurable:!0});return n}return structuredClone(e)}function fs(r,e){return Object.is(r,e)?!0:Array.isArray(r)&&Array.isArray(e)?r.length===e.length&&r.every((t,n)=>fs(t,e[n])):He(r)&&He(e)?Object.keys(r).length===Object.keys(e).length&&Object.keys(r).every(t=>Object.hasOwn(e,t)&&fs(r[t],e[t])):!1}function He(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)&&Object.getPrototypeOf(r)===Object.prototype}function hs(r){if(!(r===null||typeof r=="string"||typeof r=="boolean")&&!(typeof r=="number"&&Number.isFinite(r))){if(Array.isArray(r)){r.forEach(hs);return}if(He(r)){Object.values(r).forEach(hs);return}throw new TypeError("collection must contain only finite JSON values")}}var We=class r{#e;constructor(e){hs(e);let t=["document_format","grammar","abstracts","elements"];if(!He(e)||Object.keys(e).some(i=>![...t,"custom_types"].includes(i))||t.some(i=>!Object.hasOwn(e,i)))throw new TypeError("collection requires document_format, grammar, abstracts and elements");let n=e.document_format;if(!He(n)||Object.keys(n).length!==2||n.name!=="builder_grammar"||!["1.1","1.2"].includes(n.version))throw new TypeError("expected builder_grammar version 1.1 or 1.2");for(let i of["grammar","abstracts","elements"])if(!He(e[i]))throw new TypeError(`${i} must be an object`);if(Object.hasOwn(e,"custom_types")&&(n.version!=="1.2"||!He(e.custom_types)))throw new TypeError("custom_types requires an object catalog and version 1.2");this.#e=structuredClone(e)}update(e){let t=new r(e),n=Qa(this.#e,t.#e);return(this.#e.document_format.version==="1.2"||t.#e.document_format.version==="1.2")&&(n.document_format.version="1.2"),this.#e=n,this}toDocument(){return structuredClone(this.#e)}};var vt=class{static renderType="string";static mode=null;constructor(e){this._builder=e,this.renders=new Map([[e,this]])}get builder(){return this._builder}get renderType(){return this.constructor.renderType}get mode(){return this.constructor.mode}addRender(e,t){this.renders.set(e,t)}getRender(e){let t=this.renders.get(e);if(t!==void 0)return t;let n=e.getRenderer();return this.renders.set(e,n),n}render(e,t={}){let n=e.builder,[i,s]=n.runtimeValues(e);if(e._getMeta("data_element"))return null;if(e._getMeta("component"))return this._renderComponent(e,s,t);let o=this.getRender(n),a;return[a,s]=o._handleMeta(e,s),e._getMeta("subbuilder")||(s=o.adaptAttrs(s)),e.value instanceof X&&(i=this.renderChildren(e.value,t)),o.renderedItem(e,i,s,{tag:a,...t})}renderChildren(e,t={}){let n=[];for(let i of e.getNodes()){let s=this.render(i,t);s!==null&&(Array.isArray(s)?n.push(...s):n.push(s))}return n}_renderComponent(e,t,n){let[i,s,o,a]=this._expansionInputs(e,t);if(!Object.hasOwn(e.getAttr(),"iterate"))return this._expandBlock(e,i,o,a,n);if(s==null)return[];if(!(s instanceof ne))throw new TypeError(`component '${e.nodeTag}': iterate must resolve to a Bag, got ${s?.constructor?.name||typeof s}`);return s.getNodes().map(l=>this._expandBlock(e,i,o,{node_label:l.label},n))}_expansionInputs(e,t){let n=e.builder,i=n.componentMethod(e.nodeTag),s=i&&n[i];if(typeof s!="function")throw new Error(`component '${e.nodeTag}' has no implementation`);let o=t.iterate;delete t.iterate,delete t.store;let a=e.getAttr("iterate")||e.getAttr("store");a!=null?(e.pointerType(a)&&(a=a.slice(1)),a.startsWith(".")&&(a=e._composeRelativeDatapath(a,a))):a=null;for(let l of Object.keys(t)){let u=e.getAttr(l);e.pointerType(u)==="^"&&(t[l]=`^${e.absDatapath(u)}`)}return[s,o,a,t]}_expandBlock(e,t,n,i,s){let o=e.builder._expansionRoot(n);t.call(e.builder,us(o),i);let a=o.getNodes();if(a.length!==1)throw new Error(`component '${e.nodeTag}' must build a tree, not a forest: ${a.length} root nodes`);let l={...s,depthOffset:this._nodeDepth(e,s.depthOffset||0)};return this.render(a[0],l)}preprocess(e){return e}renderedItem(e,t,n,i){throw new Error(`${this.constructor.name} does not implement renderedItem`)}_handleMeta(e,t){let[n,i]=e._getMeta("render_tag,render_attributes"),s=as(e.nodeTag,{renderTag:n,ns:e.getAttr("ns"),dialectName:e.builder?.constructor._name});if(!s)throw new Error(`node ${e.label} has no tag to render (no render_tag, no node_tag)`);return i&&(t={...t,...i}),[s,t]}adaptAttrs(e){return e}adapt(e){let t=`${this.builder.constructor._name}_`;return e.startsWith(t)?e.slice(t.length):e}finalize(e,t=null,n={}){let i=this._composeStringFragments(e);if(t==null)return i;if(typeof t=="string")throw new TypeError("string render targets require filesystem support, which is unavailable in the portable renderer; pass a callable or writable target instead");if(typeof t.full=="function"&&typeof t.write!="function")return t.full(i),null;if(typeof t.write=="function")return t.write(i),null;if(typeof t=="function")return t(i),null;throw new TypeError("render target must be writable (.write), callable, or expose .full")}_composeStringFragments(e){if(!Array.isArray(e))return e;if(e.some(t=>typeof t!="string"))throw new TypeError("String composition requires string fragments; object renderers must define their own composition");return e.join("")}_escapeText(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}_escapeAttr(e){return this._escapeText(e).replaceAll('"',""")}_nodeDepth(e,t=0){let i=((e.fullpath||"").match(/\./g)||[]).length;return Math.max(i-1,0)+t}};var kt=class extends vt{static mode="xml";renderedItem(e,t,n,{tag:i,pretty:s=!1,depthOffset:o=0}={}){let a=this._formatAttrs(n),l=s?" ".repeat(this._nodeDepth(e,o)):"",u=s?`
|
|
21
|
-
`:"";if(Array.isArray(t)){let c=this._composeStringFragments(t);return`${l}<${i}${a}>${u}${c}${l}</${i}>${u}`}return t==null?`${l}<${i}${a}></${i}>${u}`:`${l}<${i}${a}>${this._escapeText(t)}</${i}>${u}`}finalize(e,t=null,{docHeader:n=null}={}){let i=this._composeStringFragments(e);return n===!0?i=`<?xml version='1.0' encoding='UTF-8'?>${i}`:typeof n=="string"&&(i=n+i),super.finalize(i,t)}_formatAttrs(e){return Object.entries(e||{}).map(([t,n])=>` ${t.startsWith("xmlns_")?`xmlns:${t.slice(6)}`:t}="${this._escapeAttr(n)}"`).join("")}};var el={document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:"base",version:null,title:null,description:null},abstracts:{},elements:{dataSetter:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"value",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1},{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}},dataFormula:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"collections.abc",name:"Callable"}]},has_default:!1},{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}},dataController:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"collections.abc",name:"Callable"}]},has_default:!1},{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}}}};function tl(r){let e=[];for(;r&&r!==Function.prototype;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function Wf(r){let e=Object.create(null),t=(n,i)=>{let s=n.toLowerCase(),o=e[s];if(o!==void 0&&o!==i)throw new Error(`container '${n}' is already tied to implementation method '${o}' (cannot rebind to '${i}')`);e[s]=i};for(let n of tl(r))if(Object.hasOwn(n,"containers"))for(let i of n.containers||[])t(i,i);return e}function Mr(r){let e=Object.create(null);for(let t of Object.keys(r)){let n=t.toLowerCase();if(Object.hasOwn(e,n))throw new Error(`element declaration '${t}' has a case-insensitive collision with '${e[n]}'`);e[n]=t}return e}var Lr="_root_",ps="_root_",rl=new Set(["destination","func","value","_on_start"]),Fe=class r{static _sourceClass=X;static registerBuilder(e){if(typeof e!="function"||!(e.prototype instanceof r))throw new TypeError("registerBuilder requires a BuilderBase subclass");let t=e._name;if(typeof t!="string"||!t)throw new TypeError("registered builders require a non-empty static _name");let n=r._registry.get(t);if(n&&n!==e)throw new Error(`Builder name '${t}' is already registered to ${n.name}; cannot register ${e.name}`);return r._registry.set(t,e),e}static getBuilderClass(e){let t=r._registry.get(e);if(!t)throw new Error(`No builder registered with name '${e}'`);return t}constructor(e=null){this.name=e||this.constructor._name,this._dataroot=new ne,this._dataroot.setBackref(),this._dataroot.setItem(ps,new ne),this.data=this._dataroot.getItem(ps),this._defaultTargets=new Map,this.materialized=Object.create(null),this._collection=null,this._schemaOverride=null,this._tagNamesOverride=null,this._componentMap=null,this._targetSerial=0,this._subbuilders=new Map,this._sourceHandles=new WeakMap;let t=this.constructor._sourceClass;this._sourceroot=new t(null,this),this._sourceroot.setBackref(),this._sourceroot.setItem(Lr,new t(null,this)),this.source=this._sourceroot.getItem(Lr)}wrapSource(e){if(e=Rr(e),!(e instanceof X)&&!(e instanceof Xt))throw new TypeError("wrapSource requires a SourceBag or SourceBagNode");let t=this._sourceHandles.get(e);return t||(t=ja(this,e),this._sourceHandles.set(e,t)),t}get root(){return this.wrapSource(this.source)}getSubbuilder(e){if(typeof e!="string"||!e||e.includes(":"))throw new Error(`unsupported subbuilder reference '${e}'`);let t=this._subbuilders.get(e);if(!t){let n=r.getBuilderClass(e);t=new n,this._subbuilders.set(e,t)}return t._dataroot=this._dataroot,t.data=this.data,t}_resolveSubbuilderReference(e,t,n){if(typeof e!="string"||!e)throw new Error(`'${n}': subbuilder declaration must be a non-empty string`);if(e.includes(":"))throw new Error(`'${n}': runtime subbuilder reference '${e}' is unsupported`);return this.getSubbuilder(e)}static defineGrammar(e){let t=this._classCollection,n=t?new We(t.toDocument()).update(e):new We(e),i=ds(n.toDocument()),s=cs(i),o=Mr(s.elements);this._classCollection=n,this._classSchema=s.elements,this._abstracts=s.abstracts,this._tagNames=o}static{this.defineGrammar(el)}get _containers(){return Wf(this.constructor)}containerMethod(e){return this._containers[e.toLowerCase()]||null}componentMethod(e){return this._componentMap?.[e.toLowerCase()]||null}get schema(){return this._schemaOverride||this.constructor._classSchema||{}}get schemaTagNames(){return this._schemaOverride?this._tagNamesOverride??=Mr(this.schema):this.constructor._tagNames??=Mr(this.schema)}schemaTag(e){let t=e.toLowerCase(),n=this.schemaTagNames[t];if(n)return n;let i=`${this.constructor._name}_`;return t.startsWith(i)&&this.schemaTagNames[t.slice(i.length)]||null}loadGrammar(e,{replace:t=!1}={}){let n=this._collection||this.constructor._classCollection,i=t?new We(e):new We(n.toDocument()).update(e),s=ds(i.toDocument()),o=cs(s),a=Mr(o.elements);return this._collection=i,this._schemaOverride=o.elements,this._tagNamesOverride=a,this}validateCustomTypes(e){let t=e.parentBag?.parentNode?.builder||e.parentBag?._builder,n=t&&t!==this&&t.schema[e.nodeTag]?._meta?.subbuilder?t:this;Ja(e.nodeTag,n.schema[e.nodeTag],e.value,e.getAttr()||{})}validateNodeValues(e,t,n={}){let i=this.schemaTag(e);if(!i)throw new Error(`unknown element '${e}'`);return Ka(i,this.schema[i],t,n),!0}validateNode(e,{value:t,attrs:n,childTags:i}={}){if(!e||typeof e.nodeTag!="string")throw new TypeError("validateNode requires a source node");let s=t!==void 0?t:e.value instanceof X?null:e.value;this.validateNodeValues(e.nodeTag,s,n||e.getAttr?.()||{});let o=this.schema[this.schemaTag(e.nodeTag)],a=i||(e.value instanceof X?e.value.getNodes().map(l=>l.nodeTag):null);return a&&this._validateChildren(e.nodeTag,o,a,!1),!0}validateChildren(e,t,{includeMinimum:n=!1}={}){let i=this.schemaTag(e);if(!i)throw new Error(`unknown element '${e}'`);if(!Array.isArray(t)||t.some(s=>typeof s!="string"))throw new TypeError("childTags must be an array of strings");return this._validateChildren(i,this.schema[i],t,n)}validateParent(e,t=null){let n=this.schemaTag(e);if(!n)throw new Error(`unknown element '${e}'`);let i=this.schema[n];if(!this._countsForGrammar(i))return!0;let s=i._parentSpec;if(s==null||s.has("*"))return!0;if(t===null)throw new Error(`'${n}' requires a declared parent`);let o=this.schemaTag(t);if(!o)throw new Error(`unknown parent element '${t}'`);return this._validateParent(n,i,o),!0}bagCall(e,t,n,i){return this.setChild(e,t,n,i)}commandOnNode(e,t,n,i){if(e=Rr(e),e.value instanceof X)return this.setChild(e.value,t,n,i);let s=e.value,o=new e.parentBag.constructor(null,e.builder||this),a=this.setChild(o,t,n,i,e);return this.promoteNodeValue(e,s,o),a}promoteNodeValue(e,t,n){e.setValue(n)}setChild(e,t,n,i,s=null){let o={...i},a=this.schema[t];if(!a)throw new Error(`unknown element '${t}'`);this.validateNodeValues(t,n,o);let l=a._meta?.subbuilder,c=(l==null?null:this._resolveSubbuilderReference(l,o,t))||this,d=n instanceof X?n._builderBindingPlan(c):null,f=s?.rootBuilder||e.root._builder||this;if(o.nodeId!=null&&f.source.getNodeByAttr("nodeId",o.nodeId))throw new Error(`Duplicate nodeId '${o.nodeId}'`);n instanceof X&&this._validateChildren(t,a,n.getNodes().map(w=>w.nodeTag),!1);let h=s||e.parentNode,p=h?.nodeTag?this.schema[h.nodeTag]:null;if(p&&!h._getMeta("subbuilder")&&this._countsForGrammar(a))this._validateParent(t,a,h.nodeTag),this._validateChildren(h.nodeTag,p,[...e.getNodes().map(w=>w.nodeTag),t],!1);else if(!p&&!h?._getMeta("subbuilder")&&a._parentSpec!=null&&this._countsForGrammar(a))throw new Error(`'${t}' requires a declared parent`);a._meta&&!("_meta"in o)&&(o._meta=a._meta),a.ns&&!("ns"in o)&&(o.ns=a.ns);let m=o.node_position;delete o.node_position;let g=o.node_label;delete o.node_label;let _;if(p?.collection_key){if(g!=null)throw new Error(`'${t}': node_label is not allowed in a collection`);_=this._collectionLabel(p.collection_key,t,o)}else{let w=p?._subSpec?.get(t);if(w&&w.max===1){if(g!=null)throw new Error(`'${t}': node_label is not allowed on a singleton`);_=t}else _=g||a.node_label||this._autoLabel(e,t)}if(e.node(_)!=null)throw new Error(`duplicate node label '${_}'`);return e._setBuilderItem(c,d,_,n,o,m||">",!1,!0,null,!1,!0,null,t)}_countsForGrammar(e){let t=e?._meta||{};return!(t.data_element||t.subbuilder||t.component)}_validateParent(e,t,n){let i=t._parentSpec;if(!(i==null||i.has("*")||!this._countsForGrammar(t))&&!i.has(n))throw new Error(`'${e}' not allowed as child of '${n}'`)}_validateChildren(e,t,n,i){let s=t._subSpec;if(s==null||s.has("*")||t._meta?.subbuilder)return[];let o=new Map;for(let a of n){let l=this.schema[a];if(l&&!this._countsForGrammar(l))continue;let u=s.get(a);if(!u)throw new Error(`'${a}' not allowed as child of '${e}'`);let c=(o.get(a)||0)+1;if(o.set(a,c),c>u.max)throw new Error(`too many '${a}' in '${e}'`)}return i?[...s].filter(([a,l])=>(o.get(a)||0)<l.min).map(([a])=>a):[]}_collectionLabel(e,t,n){let i=s=>{if(n[s]===null||n[s]===void 0)throw new Error(`'${t}': collection key needs attribute '${s}'`);return String(n[s])};return e.includes("${")?e.replace(/\$\{([^}]+)\}/g,(s,o)=>i(o)):i(e)}validateSource(){let e=[],t=(n,i="")=>{for(let s of n.getNodes()){let o=i?`${i}.${s.label}`:s.label,a=s.builder;a.validateCustomTypes(s);let l=a.schema[s.nodeTag];if(l&&!s._getMeta("data_element,subbuilder,component").some(Boolean)){let u=s.value instanceof X?s.value.getNodes().map(d=>d.nodeTag):[],c=a._validateChildren(s.nodeTag,l,u,!0);c.length&&e.push([o,c])}s.value instanceof X&&t(s.value,o)}};return t(this.source),e}_autoLabel(e,t){let n=0;for(;e.node(`${t}_${n}`)!==null&&e.node(`${t}_${n}`)!==void 0;)n+=1;return`${t}_${n}`}nodeById(e){let t=this.source.getNodeByAttr("nodeId",e);if(t==null)throw new Error(`nodeId not found: ${e}`);return t.builder.wrapSource(t)}runtimeValues(e){e.builder.validateCustomTypes(e);let t=new Map,n={},i=e.runtimeToEvaluate(),s=new Set(i.keys()),o=new Map([...Object.entries(e.getAttr()),...e.fixedAttrItems()]);for(let[c,d]of[...i])if(!(typeof c!="string"||!ot(d)))for(let f of ts(e,d))i.has(f)||i.set(f,o.get(f));let a=e._getMeta("data_element");for(let[c,d]of i){if(d instanceof re){t.set(c,d.resolve());continue}let f=typeof c=="string"?ot(d)?.pointer??d:d;if(!e.pointerType(f)){t.set(c,typeof c=="string"&&typeof d=="string"&&d.startsWith("==")?null:d);continue}let h=e.absDatapath(f);if(t.set(c,this.data.getItem(h)),!a&&!h.includes("?")&&c===Yt){let p=this.data.getNode(h);p&&Object.assign(n,p.getAttr("_wdg"))}}let l=Sa(i,t,(c,d,f,h)=>this.evaluatePointerExpression(e,c,d,f,h)),u=l.get(Yt);l.delete(Yt);for(let c of l.keys())s.has(c)||l.delete(c);return[u,{...Object.fromEntries(l),...n}]}evaluatePointerExpression(e,t,n,i,s){return null}targetId(e){if(e._targetId)return e._targetId;let t=e.rootBuilder;return e.parentBag.root!==t.source.root?null:(t._targetSerial+=1,e._targetId=`n${t._targetSerial}`,e._targetId)}get dataLogic(){if(!this._dataLogic){let e=this._buildDataLogic();this._dataLogic=Array.isArray(e)?e:[e]}return this._dataLogic}_buildDataLogic(){return this}_resolveLogicFunc(e){if(typeof e=="function")return e;if(typeof e!="string")throw new Error("data-element func must be a name or a function");for(let t of this.dataLogic){let i=(typeof t=="function"?t:t.constructor)[e];if(typeof i=="function")return i}throw new Error(`data-element func '${e}' not found on any data_logic source`)}_bindings(e){let[,t]=this.runtimeValues(e),n={};for(let[i,s]of Object.entries(t))rl.has(i)||(n[i]=s);return n}computeLogic(e){for(let t of e)this._computeNode(t)}_computeNode(e){let t=e.getAttr()||{};if(e.nodeTag==="dataSetter"){let n={};for(let[i,s]of Object.entries(t))i!=="destination"&&i!=="value"&&!i.startsWith("_")&&(n[i]=s);e.setRelativeData(t.destination,t.value,{attributes:Object.keys(n).length?n:null})}else if(e.nodeTag==="dataFormula"){let n=this._resolveLogicFunc(t.func);e.setRelativeData(t.destination,n(this._bindings(e)))}else e.nodeTag==="dataController"&&this._resolveLogicFunc(t.func)(e,this._bindings(e))}_dataElementNodes(){let e=[],t=n=>{for(let i of n.getNodes())i._getMeta("data_element")&&e.push(i),i.value instanceof X&&t(i.value)};return t(this.source),e}setup(e){}main(e){throw new Error(`${this.constructor.name}.main() not implemented: a bare builder is grammar, not a renderable page`)}_resolveComponents(){let e={};for(let a of tl(this.constructor))if(Object.hasOwn(a,"components"))for(let l of a.components||[])e[l]=l;if(!Object.keys(e).length)return;let t={...this.schema},n={};for(let[a,l]of Object.entries(e))t[a]={sub_tags:"",_meta:{component:!0}},n[a.toLowerCase()]=l;let i=Mr(t),s=this._collection||this.constructor._classCollection,o=s.toDocument();o.abstracts={},o.elements=Object.fromEntries(Object.keys(e).map(a=>[a,t[a]])),this._collection=new We(s.toDocument()).update(o),this._schemaOverride=t,this._componentMap=n,this._tagNamesOverride=i}_expansionRoot(e=null){let t=this.constructor._sourceClass,n=new t(null,this);return n.setBackref(),n.setItem(Lr,new t(null,this),e?{datapath:e}:null),n.getItem(Lr)}create(){this.setup(this.data),this._resolveComponents(),this.main(this.root),this.computeLogic(this._dataElementNodes())}get renderer_xml(){return new kt(this)}getRenderer(e=null){e??=this.constructor._defaultRenderMode;let t=this[`renderer_${e}`];if(!t)throw new Error(`${this.constructor.name} does not expose renderer_${e}`);return t}materialize(e=null,t={}){e??=this.constructor._defaultRenderMode;let n=this.getRenderer(e),i=n.renderChildren(n.preprocess(this.source),t);return this.materialized[e]=i,i}setRenderTarget(e,t=null){t??=this.constructor._defaultRenderMode,this._defaultTargets.set(t,e)}render({mode:e=null,target:t=null,...n}={}){e??=this.constructor._defaultRenderMode;let i=this.getRenderer(e);if(t===!1&&i.renderType!=="string")throw new TypeError("target=false is not valid for an object renderer");let s=t===!1?null:t||this._defaultTargets.get(i.mode)||null,o={...s?.renderOpts,...n};return i.finalize(this.materialize(e,o),s,o)}};Fe._registry=new Map;var Gf=new Set(["short","medium","long","full"]),Xf=/('(?:[^']|'')*'|[a-zA-Z]+|[^a-zA-Z']+)/g;function Yf(r,e){if(!(r instanceof Date))throw new TypeError("Temporal formats require a typed Date value");if(!Number.isFinite(r.getTime()))throw new RangeError("Invalid date");let t=e||be(r).split("::").at(-1);if(!["D","H","DH","DHZ"].includes(t))throw new RangeError(`Unsupported temporal dtype: ${t}`);return t}function Zf(r,e,t,n){let i=e.match(Xf)||[];if(i.join("")!==e)throw new RangeError("Unclosed format literal");let s=(c,d=2)=>String(c).padStart(d,"0"),o=c=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...c}).format(r),u={...n==="H"?{}:{y:()=>String(r.getUTCFullYear()),yy:()=>s(r.getUTCFullYear()%100),yyyy:()=>s(r.getUTCFullYear(),4),M:()=>String(r.getUTCMonth()+1),MM:()=>s(r.getUTCMonth()+1),MMM:()=>o({month:"short"}),MMMM:()=>o({month:"long"}),d:()=>String(r.getUTCDate()),dd:()=>s(r.getUTCDate()),EEE:()=>o({weekday:"short"}),EEEE:()=>o({weekday:"long"})},...n==="D"?{}:{H:()=>String(r.getUTCHours()),HH:()=>s(r.getUTCHours()),h:()=>String(r.getUTCHours()%12||12),hh:()=>s(r.getUTCHours()%12||12),m:()=>String(r.getUTCMinutes()),mm:()=>s(r.getUTCMinutes()),s:()=>String(r.getUTCSeconds()),ss:()=>s(r.getUTCSeconds()),a:()=>new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(r).find(c=>c.type==="dayPeriod").value}};return i.map(c=>{if(c.startsWith("'"))return c==="''"?"'":c.slice(1,-1).replaceAll("''","'");if(!/^[a-zA-Z]/.test(c))return c;if(!u[c])throw new RangeError(`Unsupported date format token: ${c}`);return u[c]()}).join("")}function nl(r,{format:e,mask:t,locale:n,dtype:i,places:s}={}){let o=r==null?"":String(r);if(r!=null&&r!==""&&(e!=null&&e!==""||s!=null))if(typeof r=="number"||F(r))o=Jf(r,{format:e,locale:n,places:s});else{let a=Yf(r,i);if(Gf.has(e)){let l={timeZone:"UTC"};a!=="H"&&(l.dateStyle=e),a!=="D"&&(l.timeStyle=e),o=new Intl.DateTimeFormat(n||void 0,l).format(r)}else o=Zf(r,String(e),n||void 0,a)}return t==null?o:String(t).replaceAll("%s",()=>o)}function Kf({format:r="decimal",places:e}={}){let t={maximumFractionDigits:20};if(!r||r==="decimal")t.style="decimal";else if(r==="percent")t.style="percent";else if(r==="scientific")t.notation="scientific";else{let n=/^(0|#,##0)(?:\.(0*)(#*))?$/.exec(r);if(!n||r.includes(".")&&!n[2]&&!n[3])throw new RangeError(`Unsupported number format: ${r}`);t.useGrouping=n[1].includes(","),t.minimumFractionDigits=(n[2]||"").length,t.maximumFractionDigits=(n[2]||"").length+(n[3]||"").length}if(e!=null&&e!==""){let n=Number(e);if(!Number.isInteger(n)||n<0||n>20)throw new RangeError("places must be an integer from 0 to 20");t.minimumFractionDigits=n,t.maximumFractionDigits=n}return t}function Jf(r,e={}){if(typeof r!="number"&&!F(r))throw new TypeError("Number formatting requires a Number or Decimal");if(!Number.isFinite(Number(r)))throw new RangeError("Number must be finite");let t=new Intl.NumberFormat(e.locale||void 0,Kf(e));if(F(r)&&new Intl.NumberFormat("en",{useGrouping:!1}).format("9007199254740993")!=="9007199254740993")throw new Error("This browser cannot format Decimal values without precision loss");return t.format(F(r)?r.toString():r)}var Qf=new Set(["style","script"]),eh=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),il=new Set(["width","height","top","left","right","bottom","padding","margin","border","position","display","overflow","float","clear","resize","z_index","min_width","min_height","max_width","max_height","color","background","font","text","line_height","white_space","vertical_align","flex","gap","row_gap","column_gap","grid","align_content","justify_content","align_items","justify_items","visibility","opacity","cursor"]),Fr=new Set(["rounded","gradient","shadow","transform","transition","zoom","filter"]),sl=r=>r===!0?"true":r===!1?"false":String(r),Ln=r=>typeof r=="number"&&Number.isFinite(r)?`${r}px`:String(r);function th(r){if(il.has(r))return!0;for(let e of il)if(r.startsWith(`${e}_`))return!0;return!1}function rh(r){let e=new Map;if(!r)return e;let t=[],n=0,i=null,s=!1,o=!1,a=0,l=String(r);for(let u=0;u<l.length;u+=1){let c=l[u],d=l[u+1];if(o){c==="*"&&d==="/"&&(o=!1,u+=1);continue}if(s){s=!1;continue}if(c==="\\"){s=!0;continue}if(i){c===i&&(i=null);continue}c==='"'||c==="'"?i=c:c==="/"&&d==="*"?(o=!0,u+=1):"([{".includes(c)?a+=1:")]}".includes(c)&&a>0?a-=1:c===";"&&a===0&&(t.push(l.slice(n,u)),n=u+1)}t.push(l.slice(n));for(let u of t){let c=u.trim();if(!c)continue;let d=c.indexOf(":");if(d<0)throw new TypeError(`malformed style declaration '${c}'`);e.set(c.slice(0,d).trim(),c.slice(d+1).trim())}return e}var $r=class extends vt{static mode="html";renderedItem(e,t,n,{tag:i,xml:s=!0,pretty:o=!1,depthOffset:a=0,includeDatapath:l=!1}={}){e.parentNode?._getMeta("subbuilder")==="html"&&(n={xmlns:"http://www.w3.org/1999/xhtml",...n});let{format:c,mask:d,locale:f,places:h,dtype:p,...m}=n;!Array.isArray(t)&&(c!=null||d!=null||h!=null)&&(t=nl(t,{format:c,mask:d,places:h,dtype:p,locale:this._displayLocale(e,f)}));let g=this._formatAttrs(m);if(l){if(!Object.hasOwn(n,"id")){let E=this.builder.targetId(e);E!==null&&(g+=` id="${this._htmlAttrValue(E)}"`)}for(let[E,T]of Object.entries(e.getAttr()))e.pointerType(T)&&(g+=` data-${this.adapt(E)}-pointer="${this._htmlAttrValue(e.absDatapath(T))}"`)}let _=o?" ".repeat(this._nodeDepth(e,a)):"",v=o?`
|
|
22
|
-
`:"";if(e._getMeta("void"))return`${_}<${i}${g}${s?"/":""}>${v}`;if(Array.isArray(t)){let E=this._composeStringFragments(t);return`${_}<${i}${g}>${v}${E}${_}</${i}>${v}`}if(t==null)return`${_}<${i}${g}></${i}>${v}`;let w=typeof t=="string"&&t.endsWith("::HTML")?t.slice(0,-6):Qf.has(i)?String(t):this._escapeText(t);return`${_}<${i}${g}>${w}</${i}>${v}`}_displayLocale(e,t){if(t)return t;for(let n=e.parentNode;n;n=n.parentNode){let i=n.getAttr("locale");if(i==null)continue;let s=n.pointerType(i)?n.data.getItem(n.absDatapath(i)):i;if(s)return s}}adaptAttrs(e){let t={},n={};for(let[s,o]of Object.entries(e||{}))if(s.startsWith(`${this.builder.constructor._name}_`))t[this.adapt(s)]=o;else if(s==="dtype")t.dtype=o;else{if(this.builder.constructor.retainedAttrPrefixes.some(a=>s.startsWith(a)))continue;this._isStyleContribution(s)?n[s]=o:t[s]=o}let i=this._adaptStyle(n);return i&&(t.style=i),t}_isStyleContribution(e){if(e==="style"||e.startsWith("style_")||Fr.has(e))return!0;let t=e.includes("_")?e.slice(0,e.indexOf("_")):null;return t!==null&&Fr.has(t)||th(e)}_adaptStyle(e){let t=rh(e.style),n=new Map,i=new Map;for(let[s,o]of Object.entries(e))if(s!=="style")if(s.startsWith("style_"))t.set(s.slice(6).replaceAll("_","-"),sl(o));else if(Fr.has(s))n.set(s,o);else{let a=s.indexOf("_"),l=a<0?s:s.slice(0,a);a>=0&&Fr.has(l)?(i.has(l)||i.set(l,{}),i.get(l)[s.slice(a+1)]=o):t.set(s.replaceAll("_","-"),sl(o))}for(let s of Fr)(n.has(s)||i.has(s))&&this[`_macro_${s}`](n.get(s),i.get(s)||{},t);return[...t].map(([s,o])=>`${s}: ${o}`).join("; ")}_formatAttrs(e){let t=[];for(let[n,i]of Object.entries(e||{}))eh.has(n)?i&&t.push(` ${n}`):t.push(` ${n}="${this._htmlAttrValue(i)}"`);return t.join("")}_htmlAttrValue(e){return(e===!0?"true":e===!1?"false":String(e)).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}_macro_rounded(e,t,n){let i=e===void 0?{}:{top_left:e,top_right:e,bottom_left:e,bottom_right:e};for(let[s,o]of Object.entries(t))if(s==="top"||s==="bottom")i[`${s}_left`]=o,i[`${s}_right`]=o;else if(s==="left"||s==="right")i[`top_${s}`]=o,i[`bottom_${s}`]=o;else if(["top_left","top_right","bottom_left","bottom_right"].includes(s))i[s]=o;else throw new TypeError(`rounded: unknown sub-kwarg '${s}'`);for(let[s,o]of Object.entries(i))n.set(`border-${s.replaceAll("_","-")}-radius`,Ln(o))}_macro_transform(e,t,n){let i=e===void 0?[]:[String(e)];for(let[s,o]of Object.entries(t))s==="rotate"?i.push(`rotate(${o}deg)`):s==="scale"||s==="translate"?i.push(`${s}(${o})`):s==="translate_x"?i.push(`translateX(${Ln(o)})`):s==="translate_y"?i.push(`translateY(${Ln(o)})`):s==="skew_x"?i.push(`skewX(${o}deg)`):s==="skew_y"?i.push(`skewY(${o}deg)`):i.push(`${s.replaceAll("_","-")}(${o})`);i.length&&n.set("transform",i.join(" "))}_macro_filter(e,t,n){let i=e===void 0?[]:[String(e)];for(let[s,o]of Object.entries(t))s==="rotate"?i.push(`hue-rotate(${o}deg)`):s==="blur"?i.push(`blur(${Ln(o)})`):s==="drop_shadow"?i.push(`drop-shadow(${o})`):i.push(`${s.replaceAll("_","-")}(${o})`);i.length&&n.set("filter",i.join(" "))}_macro_transition(e,t,n){e!==void 0&&n.set("transition",String(e));for(let[i,s]of Object.entries(t))n.set(`transition-${i.replaceAll("_","-")}`,String(s))}_macro_zoom(e,t,n){e!==void 0&&n.set("zoom",String(e))}_macro_shadow(e,t,n){e!==void 0&&n.set("box-shadow",String(e));for(let[i,s]of Object.entries(t))n.set(`box-shadow-${i.replaceAll("_","-")}`,String(s))}_macro_gradient(e,t,n){e!==void 0&&n.set("background-image",String(e))}};var nh=new Set(["alignment_baseline","baseline_shift","clip_path","clip_rule","color_interpolation","color_interpolation_filters","dominant_baseline","fill_opacity","fill_rule","flood_color","flood_opacity","font_family","font_size","font_size_adjust","font_stretch","font_style","font_variant","font_weight","glyph_orientation_horizontal","glyph_orientation_vertical","image_rendering","letter_spacing","lighting_color","marker_end","marker_mid","marker_start","overline_position","overline_thickness","paint_order","pointer_events","shape_rendering","stop_color","stop_opacity","strikethrough_position","strikethrough_thickness","stroke_dasharray","stroke_dashoffset","stroke_linecap","stroke_linejoin","stroke_miterlimit","stroke_opacity","stroke_width","text_anchor","text_decoration","text_rendering","underline_position","underline_thickness","unicode_bidi","word_spacing","writing_mode"]);function ol(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[nh.has(e)?e.replaceAll("_","-"):e,t]))}var Pr=class extends kt{static mode="svg";adaptAttrs(e){return ol(e)}};var al={document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:"html",version:null,title:null,description:null},abstracts:{},elements:{svg:{doc:"Switch to the SVG dialect from this node down (BLD.2).\n\n A sub-builder element: ``_meta['subbuilder']`` switches the active\n dialect to SVG from this node down. No ``render_tag``: ``<svg>`` is\n emitted verbatim (HTML5 has a native ``<svg>`` tag).",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{subbuilder:"svg"}},a:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},abbr:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},address:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},area:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},article:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},aside:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},audio:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},b:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},base:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},bdi:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},bdo:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},blockquote:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},body:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},br:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},button:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},canvas:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},caption:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},cite:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},code:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},col:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},colgroup:{doc:null,sub_tags:"col,script,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},data:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},datalist:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,option,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},dd:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},del_:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},details:{doc:null,sub_tags:"summary[0:1],a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},dfn:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},dialog:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},div:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},dl:{doc:null,sub_tags:"dd,div,dt,script,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},dt:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},em:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},embed:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},fieldset:{doc:null,sub_tags:"legend[0:1],a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},figcaption:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},figure:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figcaption[0:1],figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},footer:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},form:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},h1:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},h2:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},h3:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},h4:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},h5:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},h6:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},head:{doc:null,sub_tags:"base[0:1],link,meta,noscript,script,style,template,title[0:1]",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},header:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},hgroup:{doc:null,sub_tags:"h1,h2,h3,h4,h5,h6,p,script,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},hr:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},html:{doc:null,sub_tags:"head[0:1],body[0:1]",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},i:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},iframe:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},img:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},input:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},ins:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},kbd:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},label:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},legend:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,h1,h2,h3,h4,h5,h6,hgroup,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},li:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},link:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},main:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},map:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},mark:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},menu:{doc:null,sub_tags:"li,script,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},meta:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},meter:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},nav:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},noscript:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},object:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},ol:{doc:null,sub_tags:"li,script,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},optgroup:{doc:null,sub_tags:"div,legend,noscript,option,script,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},option:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,div,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},output:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},p:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},picture:{doc:null,sub_tags:"img[0:1],script,source,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},pre:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},progress:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},q:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},rp:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},rt:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},ruby:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},s:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},samp:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},script:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},search:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},section:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},select:{doc:null,sub_tags:"button,div,hr,noscript,optgroup,option,script,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},slot:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},small:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},source:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},span:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},strong:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},style:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},sub:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},summary:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,h1,h2,h3,h4,h5,h6,hgroup,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},sup:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},table:{doc:null,sub_tags:"caption[0:1],colgroup,script,tbody,template,tfoot[0:1],thead[0:1],tr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},tbody:{doc:null,sub_tags:"script,template,tr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},td:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},template:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,caption,cite,code,col,colgroup,data,datalist,del_,details,dfn,dialog,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,legend,li,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,optgroup,option,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,source,span,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,tr,track,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},textarea:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},tfoot:{doc:null,sub_tags:"script,template,tr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},th:{doc:null,sub_tags:"a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,cite,code,data,datalist,del_,details,dfn,dialog,div,dl,em,embed,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,iframe,img,input,ins,kbd,label,link,main,map,mark,menu,meta,meter,nav,noscript,object,ol,output,p,picture,pre,progress,q,ruby,s,samp,script,search,section,select,selectedcontent,slot,small,span,strong,style,sub,sup,table,template,textarea,time,u,ul,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},thead:{doc:null,sub_tags:"script,template,tr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},time:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},title:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},tr:{doc:null,sub_tags:"script,td,template,th",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},track:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},u:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},ul:{doc:null,sub_tags:"li,script,template",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},var:{doc:null,sub_tags:"a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del_,dfn,em,embed,i,iframe,img,input,ins,kbd,label,link,map,mark,meta,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,selectedcontent,slot,small,span,strong,sub,sup,template,textarea,time,u,var,video,wbr",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},video:{doc:null,sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},wbr:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{void:!0}},selectedcontent:{doc:"Mirror of the selected option for Customizable Select (HTML 2024).",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},dataSetter:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"value",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1},{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}},dataFormula:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"collections.abc",name:"Callable"}]},has_default:!1},{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}},dataController:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"collections.abc",name:"Callable"}]},has_default:!1},{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}}}};var Fn=class extends Fe{static _name="html";static _defaultRenderMode="html";static retainedAttrPrefixes=["validate_","dtype"];static{this.defineGrammar(al)}get renderer_html(){return new $r(this)}};Fe.registerBuilder(Fn);var ll={document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:"svg",version:null,title:null,description:null},abstracts:{graphics:{doc:"SVG graphics content: any graphical element.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},_meta:null},containerElement:{doc:"SVG container content: elements that can hold children.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},_meta:null}},elements:{html:{doc:"Switch to the HTML dialect from this node down (BLD.2).\n\n A sub-builder element: ``_meta['subbuilder']`` switches the active\n dialect to HTML from this node down. The source tag ``html`` is\n rendered as ``_meta['render_tag']`` (``<foreignObject>``) carrying\n ``_meta['render_attributes']`` (the SVG namespace). The immediate\n HTML child declares XHTML so both sides of the XML boundary retain\n their native namespace.\n ",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{subbuilder:"html",render_tag:"foreignObject",render_attributes:{xmlns:"http://www.w3.org/2000/svg"}}},svg:{doc:"Root SVG container or nested SVG viewport.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},g:{doc:"Group container for applying transforms and styles.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},defs:{doc:"Container for referenced elements (gradients, patterns, etc.).",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},symbol:{doc:"Reusable graphical template, rendered only when referenced by <use>.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},use:{doc:"Reference and render a <symbol> or other element.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},rect:{doc:"Rectangle.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},circle:{doc:"Circle.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},ellipse:{doc:"Ellipse.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},line:{doc:"Line segment between two points.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},polyline:{doc:"Open shape of connected line segments.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},polygon:{doc:"Closed shape of connected line segments.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},path:{doc:"Arbitrary shape defined by path commands (d attribute).",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},image:{doc:"Embedded raster image.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},text:{doc:"Text block. Contains text content and optional <tspan>/<textPath>.",sub_tags:"tspan,textPath",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},tspan:{doc:"Inline text span within <text>.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},textPath:{doc:"Text rendered along a path shape.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},linearGradient:{doc:"Linear gradient definition. Place inside <defs>.",sub_tags:"stop",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},radialGradient:{doc:"Radial gradient definition. Place inside <defs>.",sub_tags:"stop",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},stop:{doc:"Gradient stop (color and offset).",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},pattern:{doc:"Tile pattern definition. Place inside <defs>.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},clipPath:{doc:"Clipping path definition.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},mask:{doc:"Alpha mask definition.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},marker:{doc:"Marker symbol for line endpoints or vertices.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},filter:{doc:"Filter effect container. Place inside <defs>.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feGaussianBlur:{doc:"Gaussian blur filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feOffset:{doc:"Offset filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feBlend:{doc:"Blend filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feColorMatrix:{doc:"Color matrix filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feComposite:{doc:"Composite filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feFlood:{doc:"Flood fill filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feMerge:{doc:"Merge filter primitive (container for feMergeNode).",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feMergeNode:{doc:"Single input for feMerge.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feDropShadow:{doc:"Drop shadow filter primitive (SVG 2).",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feDiffuseLighting:{doc:"Diffuse lighting filter primitive.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feSpecularLighting:{doc:"Specular lighting filter primitive.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},fePointLight:{doc:"Point light source for lighting filters.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feDistantLight:{doc:"Distant light source for lighting filters.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feSpotLight:{doc:"Spot light source for lighting filters.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feMorphology:{doc:"Morphology filter primitive (erode/dilate).",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feTurbulence:{doc:"Turbulence noise filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feDisplacementMap:{doc:"Displacement map filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feConvolveMatrix:{doc:"Convolution matrix filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feImage:{doc:"Image filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},feTile:{doc:"Tile filter primitive.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},animate:{doc:"Animate an attribute over time.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},animateTransform:{doc:"Animate a transform attribute.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},animateMotion:{doc:"Animate motion along a path.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},set:{doc:"Set an attribute to a value for a duration.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},title:{doc:"Accessible title (tooltip in browsers).",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},desc:{doc:"Accessible description.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},metadata:{doc:"Metadata container (RDF, Dublin Core, etc.).",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},a:{doc:"Hyperlink wrapper.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},foreignObject:{doc:"Container for non-SVG content (HTML, MathML).",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},switch:{doc:"Conditional processing (renders first matching child).",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:null},dataSetter:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"value",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1},{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}},dataFormula:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"collections.abc",name:"Callable"}]},has_default:!1},{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}},dataController:{doc:null,sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"collections.abc",name:"Callable"}]},has_default:!1},{name:"kwargs",kind:"var_keyword",role:"attribute",annotation:null,has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},node_label:null,collection_key:null,_meta:{data_element:!0}}}};var $n=class extends Fe{static _name="svg";static _defaultRenderMode="svg";static{this.defineGrammar(ll)}get renderer_svg(){return new Pr(this)}};Fe.registerBuilder($n);var xe="http://www.w3.org/2000/svg";function Pn(){return Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)),r=>r.toString(16).padStart(2,"0")).join("")}var qn=class{#e;#t;#i;#n=[];#r;#l;#s;#a=null;#o=null;#c;#x;#v;#y;#d;#b=!1;#f=[];#h;#E=[];#k=!1;#_=!1;constructor(e,t){this.#e=e,this.#t=t;let n=this.#s=e.ownerDocument.createElement("div");n.className="column-filter-panel",n.setAttribute("popover","auto"),n.setAttribute("role","dialog");let i=e.ownerDocument.createElement("slot");i.name="column-filter",n.append(i),n.addEventListener("toggle",s=>{s.newState==="closed"&&!n.matches(":popover-open")&&this.#S()}),e.addEventListener("keydown",s=>{this.#a&&s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),this.close())}),e.shadowRoot.append(n)}setSourceContext(e){this.#l=e;let t=e.sourceNode,n=t.rootBuilder;t.staticValue===null&&t.setValue(new n.source.constructor(null,n),!1),e.sourceNode.rootBuilder.binding.bindingFor(e.sourceNode).track(()=>this.dispose())}#p(){if(this.#d)return;let e=this.#l.sourceNode,t=e.rootBuilder;this.#y=`_gramlot.grid.${Pn()}.columnFilter`,this.#d=new ul({rows:new ul,checked:"",title:"",summary:"",from:null,to:null,hideRange:!0,rangeError:""}),e.setRelativeData(this.#y,this.#d);let n=t.wrapSource(e).div({node_label:`column_filter_${Pn()}`,slot:"column-filter",display:"flex",flex_direction:"column",gap:"8px",padding:"10px",style:"font-size:12px;--gramlot-grid-row-height:28px;--gramlot-grid-font-size:12px;--gramlot-grid-cell-padding:4px 7px;--gramlot-menu-item-padding:4px 7px"});this.#c=Zt(n),this.#c.setAttr({datapath:this.#y});let i=new t.source.constructor(null,t),s=t.wrapSource(i);s.div("^.title",{font_weight:"600",padding:"0 2px"});let o=s.div({display:"flex",gap:"8px",hidden:"^.hideRange"});this.#f=[Zt(o.dateTextBox({value:"^.from",period_to:".to",lbl:"From",width:"136px"})),Zt(o.dateTextBox({value:"^.to",lbl:"To",width:"136px"}))],s.div("^.rangeError",{role:"alert",color:"var(--gramlot-error)"});let a=s.frameGrid({storepath:".rows",rowMode:"attributes",height:"270px",width:"100%"});this.#x=Zt(a),this.#v=Zt(a.toolbar.menuline({group:!0,class:"gramlot-grid-search"}).searchBox({searchOn:"Value:caption",searchLiteral:!0}));let l=a.grid;l.setAttr({sortedBy:"caption:a"});let u=l.struct();u.column({field:"selected",name:"\u2713",title:"Selected values",width:"32px",align:"center",check:"multiple",checked:"^.checked",checkedField:"id"}),u.column({field:"caption",name:"Value",width:"170px"}),u.column({field:"count",name:"Rows",dtype:"L",width:"64px",align:"end"});let c=s.menu({presentation:"bar",aria_label:"Column filter actions"});Object.defineProperty(Zt(c),"gridColumnFilters",{value:this,configurable:!0});for(let[f,h]of[["All","selectAll"],["None","selectNone"],["Reset","reset"]])c.menuline({caption:f,action:`this.parentBag.parentNode.gridColumnFilters.${h}()`});s.div("^.summary",{color:"var(--gramlot-text-secondary)",font_size:"11px",padding:"0 2px"});let d=t.binding.gramlot.src.prepareSource(i);t.binding.renderer.validateCandidate(d),this.#c.setValue(d),this.#A()}#A(){if(!this.#d||this.#E.length)return;let e=this.#l.sourceNode.rootBuilder.binding.router;this.#E.push(e.register({path:this.#y+".checked",recipient:{receive:()=>this.#w()}}));for(let t of["from","to"])this.#E.push(e.register({path:this.#y+"."+t,recipient:{receive:()=>this.#D()}}))}#w(){if(this.#_||this.#o===null)return;let e=","+this.#d.getItem("checked")+",",t=this.#d.getItem("rows").getNodes(),n=t.filter(i=>e.includes(","+i.label+",")).map(i=>i.getAttr("value"));this.#i.applyColumnFilter(this.#o,this.#i.columnRange(this.#o)&&n.length===t.length?null:n)}#D(){this.#_||this.#b||this.#o===null||(this.#b=!0,queueMicrotask(()=>{this.#b=!1,this.#o!==null&&this.#k&&this.#B()}))}#B(){let e=this.#n.find(o=>o.field===this.#o);if(!["D","DH","DHZ"].includes(e.dtype))return;let t=this.#d.getItem("from"),n=this.#d.getItem("to"),i=this.#i.columnRange(this.#o);if(i?.from&&!t&&(n=null,this.#_=!0,this.#d.setItem("to",null),this.#_=!1),t&&n&&t>n){this.#d.setItem("rangeError","From must not be after To.");return}if(this.#d.setItem("rangeError",""),+t==+(i?.from??null)&&+n==+(i?.to??null))return;let s=!t&&!n?this.#i.columnFacets(this.#o).filter(o=>o.selected).map(o=>o.value):null;this.#i.applyColumnFilter(this.#o,s,{from:t,to:n,dtype:e.dtype,timeZone:this.#l.timeZone})}selectAll(){this.#i.applyColumnFilter(this.#o,this.#i.columnRange(this.#o)?null:this.#i.columnFacets(this.#o).map(e=>e.value))}selectNone(){this.#i.applyColumnFilter(this.#o,[])}reset(){this.#_=!0;try{this.#d.setItem("from",null),this.#d.setItem("to",null),this.#d.setItem("rangeError","");let e=this.#l.sourceNode.rootBuilder.binding.renderer;for(let t of this.#f)e.getDomNode(t).restoreFormValue(null)}finally{this.#_=!1}this.#i.applyColumnFilter(this.#o,null,null)}button(e){let t=this.#e.ownerDocument,n=t.createElement("button");n.type="button",n.className="column-filter",n.dataset.field=e.field,n.setAttribute("aria-label",`Filter ${e.title??e.name}`),n.setAttribute("aria-haspopup","dialog"),n.setAttribute("aria-expanded","false"),n.title=`Filter ${e.title??e.name}`;let i=t.createElementNS(xe,"svg");i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("aria-hidden","true");let s=t.createElementNS(xe,"path");return s.setAttribute("d","M3 5h18l-7 8v6l-4 2v-8z"),i.append(s),n.append(i),n}update(e,t,n,i){e!==this.#i&&(this.close(),this.#h?.(),this.#h=null,this.#i=e),this.#n=t,this.#r=i,(!n||this.#a&&!this.#a.isConnected)&&this.close(),this.#k&&!this.#h&&(this.#h=e.subscribe(this.refresh)),this.refresh()}#N=e=>{let t=e.target.closest(".column-filter");if(!t)return;if(e.stopPropagation(),t===this.#a){this.close();return}this.close(),this.#p(),this.#a=t,this.#o=t.dataset.field,this.#_=!0;let n=this.#i.columnRange(this.#o);this.#d.setItem("from",n?.from??null),this.#d.setItem("to",n?.to??null),this.#d.setItem("rangeError","");let i=this.#n.find(o=>o.field===this.#o);this.#d.setItem("hideRange",!["D","DH","DHZ"].includes(i.dtype));let s=this.#l.sourceNode.rootBuilder.binding.renderer;for(let[o,a]of["from","to"].entries())s.getDomNode(this.#f[o]).restoreFormValue(this.#d.getItem(a));this.#d.getItem("rows").clear(),this.#d.setItem("checked",""),s.getDomNode(this.#v).clear(),this.#_=!1,this.refresh(),this.#s.showPopover(),t.setAttribute("aria-expanded","true"),this.#u(),this.#l.sourceNode.rootBuilder.binding.renderer.getDomNode(this.#v).focus()};refresh=()=>{if(!this.#i)return;for(let a of this.#t.querySelectorAll(".column-filter")){let l=this.#i.columnFilter(a.dataset.field)!==null||this.#i.columnRange(a.dataset.field)!==null;a.classList.toggle("active",l),a.closest("th").classList.toggle("column-filtered",l),a.setAttribute("aria-pressed",String(l))}if(this.#o===null)return;let e=this.#n.find(a=>a.field===this.#o);if(!e){this.close();return}let t=e.title??e.name;this.#s.setAttribute("aria-label",`Filter ${t}`);let n=this.#i.columnFacets(this.#o),i=this.#d.getItem("rows");this.#x.setAttr({height:`${76+28*Math.max(1,Math.min(n.length,8))}px`});let s=new Map(i.getNodes().map(a=>[a.getAttr("key"),a])),o=[];this.#_=!0;try{this.#d.setItem("title",t);for(let l of n){let u=l.value===null?"Empty":Nr(l.value,e,this.#r),c={key:l.key,value:l.value,caption:u,count:l.count},d=s.get(l.key);if(d)s.delete(l.key),d.setAttr(c);else{let f=`v_${Pn()}`;i.setItem(f,null,{...c,id:f}),d=i.getNode(f)}l.selected&&o.push(d.label)}for(let l of s.values())i.popNode(l.label);let a=o.join(",");this.#d.getItem("checked")!==a&&this.#d.setItem("checked",a),this.#d.setItem("summary",`${o.length} of ${n.length} values selected`)}finally{this.#_=!1}this.#u()};#u=()=>{this.#a&&Wr(this.#s,this.#a,{align:"start"})};#S(){this.#a?.setAttribute("aria-expanded","false"),this.#a=null,this.#o=null}close(){if(!this.#a)return;let e=this.#a;this.#s.hidePopover(),this.#S(),e.isConnected&&e.focus({preventScroll:!0})}connect(){this.#k||(this.#k=!0,this.#A(),this.#t.addEventListener("click",this.#N),this.#e.ownerDocument.defaultView.addEventListener("resize",this.#u),this.#e.ownerDocument.defaultView.addEventListener("scroll",this.#u,!0))}disconnect(){this.close(),this.#k=!1,this.#h?.(),this.#h=null;for(let e of this.#E)e.close();this.#E=[],this.#t.removeEventListener("click",this.#N),this.#e.ownerDocument.defaultView.removeEventListener("resize",this.#u),this.#e.ownerDocument.defaultView.removeEventListener("scroll",this.#u,!0)}dispose(){this.disconnect(),this.#y&&this.#l.sourceNode.data.popNode(this.#y)}};import{Bag as Es}from"@gramlot/gramlot";var _e={};Ts(_e,{defineCollection:()=>ah});Jt(_e,Cb);import*as Cb from"@gramlot/gramlot/components";import{defineCollection as oh}from"@gramlot/gramlot/components";function ah(r){if(r.name!=="grid")throw new Error("Unexpected bundled collection");let e=[],t={writeExcelFileLicense:Et["assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt"],fflateLicense:Et["assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt"]};r.css?.forEach((n,i)=>{n.href=e[i].href});for(let[n,i]of Object.entries(r.assets??{}))i.href=t[n].href;return oh({...r,css:e,assets:t})}function cl(r,e){return r.parameters=lh(r.constructor.gramlotComponent,e),Object.fromEntries(Object.entries(e).filter(([t])=>!Object.hasOwn(r.parameters,t)))}function lh(r,e){return Object.fromEntries(Object.entries(r.parameters).map(([t,n])=>[t,Object.hasOwn(e,t)?e[t]:n.default]))}function qr(r){return class extends r{constructor(){super();let e=this.attachShadow({mode:"open"}),t=this.ownerDocument.createElement("style");t.textContent=`:host{box-sizing:border-box;display:block;min-width:0;font:inherit;color:var(--gramlot-ink,CanvasText)}
|
|
1
|
+
import{a as Et,b as N}from"./modules/chunk-BLMUM44K.js";var A={"assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt":new URL("./files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt",import.meta.url),"assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt":new URL("./files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt",import.meta.url)};import{Bag as et,sourceTarget as S}from"@gramlot/gramlot";import{sharedModules as At}from"@gramlot/gramlot";var St=c=>At["./components/popup.js"][c],R=St("positionPopup");import{sharedModules as Tt}from"@gramlot/gramlot";var Dt=c=>Tt["@genrojs/tytx"][c];var z=Dt("isDecimal");var E=class{constructor(t,e){this.store=t,this.format=e}read(t,e=this.store.getRows()){return e.map(i=>({node:i,cells:t.map(r=>r.check?"":C(this.store.value(i,r.field),r,this.format))}))}};function C(c,t,e){if(c==null)return"";let{dtype:i,format:r}=t;if(i==="T"&&typeof c!="string"||i==="B"&&typeof c!="boolean")throw new TypeError(`grid ${t.field} does not match ${i}`);if(typeof c=="string"||typeof c=="boolean"){if(i&&!["T","B"].includes(i)||r!=null)throw new TypeError(`grid ${t.field} requires a typed numeric or temporal value`);return String(c)}if(c instanceof Date||r!=null)return e(c,{dtype:i,pattern:r??"short"});if(i&&!["L","R","N"].includes(i))throw new TypeError(`grid ${t.field} does not match ${i}`);if(i==="L"&&!Number.isInteger(c))throw new TypeError("grid L requires an integer");if(typeof c=="number"&&Number.isFinite(c)||z(c)&&c.isFinite())return String(c);throw new TypeError(`grid ${t.field} requires a scalar value`)}import{sharedModules as Lt}from"@gramlot/gramlot";var Nt=c=>Lt["./renderer/attributes.js"][c],y=Nt("SVG_NS");import{sharedModules as Ct}from"@gramlot/gramlot";var _t=c=>Ct["./random-id.js"][c],M=_t("randomId");var F=class{#t;#e;#s;#o=[];#i;#l;#r;#a=null;#n=null;#h;#A;#S;#x;#c;#y=!1;#u=[];#p;#E=[];#v=!1;#b=!1;constructor(t,e){this.#t=t,this.#e=e;let i=this.#r=t.ownerDocument.createElement("div");i.className="column-filter-panel",i.setAttribute("popover","auto"),i.setAttribute("role","dialog");let r=t.ownerDocument.createElement("slot");r.name="column-filter",i.append(r),i.addEventListener("toggle",s=>{s.newState==="closed"&&!i.matches(":popover-open")&&this.#N()}),t.addEventListener("keydown",s=>{this.#a&&s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),this.close())}),t.shadowRoot.append(i)}setSourceContext(t){this.#l=t;let e=t.sourceNode,i=e.rootBuilder;e.staticValue===null&&e.setValue(new i.source.constructor(null,i),!1),t.sourceNode.rootBuilder.binding.bindingFor(t.sourceNode).track(()=>this.dispose())}#f(){if(this.#c)return;let t=this.#l.sourceNode,e=t.rootBuilder;this.#x=`_gramlot.grid.${M()}.columnFilter`,this.#c=new et({rows:new et,checked:"",title:"",summary:"",from:null,to:null,hideRange:!0,rangeError:""}),t.setRelativeData(this.#x,this.#c);let i=e.wrapSource(t).div({node_label:`column_filter_${M()}`,slot:"column-filter",display:"flex",flex_direction:"column",gap:"8px",padding:"10px",style:"font-size:12px;--gramlot-grid-row-height:28px;--gramlot-grid-font-size:12px;--gramlot-grid-cell-padding:4px 7px;--gramlot-menu-item-padding:4px 7px"});this.#h=S(i),this.#h.setAttr({datapath:this.#x});let r=new e.source.constructor(null,e),s=e.wrapSource(r);s.div("^.title",{font_weight:"600",padding:"0 2px"});let o=s.div({display:"flex",gap:"8px",hidden:"^.hideRange"});this.#u=[S(o.dateTextBox({value:"^.from",period_to:".to",lbl:"From",width:"136px"})),S(o.dateTextBox({value:"^.to",lbl:"To",width:"136px"}))],s.div("^.rangeError",{role:"alert",color:"var(--gramlot-error)"});let n=s.frameGrid({storepath:".rows",rowMode:"attributes",height:"270px",width:"100%"});this.#A=S(n),this.#S=S(n.toolbar.menuline({group:!0,class:"gramlot-grid-search"}).searchBox({searchOn:"Value:caption",searchLiteral:!0}));let a=n.grid;a.setAttr({sortedBy:"caption:a"});let d=a.struct();d.column({field:"selected",name:"\u2713",title:"Selected values",width:"32px",align:"center",check:"multiple",checked:"^.checked",checkedField:"id"}),d.column({field:"caption",name:"Value",width:"170px"}),d.column({field:"count",name:"Rows",dtype:"L",width:"64px",align:"end"});let l=s.menu({presentation:"bar",aria_label:"Column filter actions"});Object.defineProperty(S(l),"gridColumnFilters",{value:this,configurable:!0});for(let[m,h]of[["All","selectAll"],["None","selectNone"],["Reset","reset"]])l.menuline({caption:m,action:`this.parentBag.parentNode.gridColumnFilters.${h}()`});s.div("^.summary",{color:"var(--gramlot-text-secondary)",font_size:"11px",padding:"0 2px"});let p=e.binding.gramlot.src.prepareSource(r);e.binding.renderer.validateCandidate(p),this.#h.setValue(p),this.#k()}#k(){if(!this.#c||this.#E.length)return;let t=this.#l.sourceNode.rootBuilder.binding.router;this.#E.push(t.register({path:this.#x+".checked",recipient:{receive:()=>this.#w()}}));for(let e of["from","to"])this.#E.push(t.register({path:this.#x+"."+e,recipient:{receive:()=>this.#T()}}))}#w(){if(this.#b||this.#n===null)return;let t=","+this.#c.getItem("checked")+",",e=this.#c.getItem("rows").getNodes(),i=e.filter(r=>t.includes(","+r.label+",")).map(r=>r.getAttr("value"));this.#s.applyColumnFilter(this.#n,this.#s.columnRange(this.#n)&&i.length===e.length?null:i)}#T(){this.#b||this.#y||this.#n===null||(this.#y=!0,queueMicrotask(()=>{this.#y=!1,this.#n!==null&&this.#v&&this.#B()}))}#B(){let t=this.#o.find(o=>o.field===this.#n);if(!["D","DH","DHZ"].includes(t.dtype))return;let e=this.#c.getItem("from"),i=this.#c.getItem("to"),r=this.#s.columnRange(this.#n);if(r?.from&&!e&&(i=null,this.#b=!0,this.#c.setItem("to",null),this.#b=!1),e&&i&&e>i){this.#c.setItem("rangeError","From must not be after To.");return}if(this.#c.setItem("rangeError",""),+e==+(r?.from??null)&&+i==+(r?.to??null))return;let s=!e&&!i?this.#s.columnFacets(this.#n).filter(o=>o.selected).map(o=>o.value):null;this.#s.applyColumnFilter(this.#n,s,{from:e,to:i,dtype:t.dtype,timeZone:this.#l.timeZone})}selectAll(){this.#s.applyColumnFilter(this.#n,this.#s.columnRange(this.#n)?null:this.#s.columnFacets(this.#n).map(t=>t.value))}selectNone(){this.#s.applyColumnFilter(this.#n,[])}reset(){this.#b=!0;try{this.#c.setItem("from",null),this.#c.setItem("to",null),this.#c.setItem("rangeError","");let t=this.#l.sourceNode.rootBuilder.binding.renderer;for(let e of this.#u)t.getDomNode(e).restoreFormValue(null)}finally{this.#b=!1}this.#s.applyColumnFilter(this.#n,null,null)}button(t){let e=this.#t.ownerDocument,i=e.createElement("button");i.type="button",i.className="column-filter",i.dataset.field=t.field,i.setAttribute("aria-label",`Filter ${t.title??t.name}`),i.setAttribute("aria-haspopup","dialog"),i.setAttribute("aria-expanded","false"),i.title=`Filter ${t.title??t.name}`;let r=e.createElementNS(y,"svg");r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("aria-hidden","true");let s=e.createElementNS(y,"path");return s.setAttribute("d","M3 5h18l-7 8v6l-4 2v-8z"),r.append(s),i.append(r),i}update(t,e,i,r){t!==this.#s&&(this.close(),this.#p?.(),this.#p=null,this.#s=t),this.#o=e,this.#i=r,(!i||this.#a&&!this.#a.isConnected)&&this.close(),this.#v&&!this.#p&&(this.#p=t.subscribe(this.refresh)),this.refresh()}#L=t=>{let e=t.target.closest(".column-filter");if(!e)return;if(t.stopPropagation(),e===this.#a){this.close();return}this.close(),this.#f(),this.#a=e,this.#n=e.dataset.field,this.#b=!0;let i=this.#s.columnRange(this.#n);this.#c.setItem("from",i?.from??null),this.#c.setItem("to",i?.to??null),this.#c.setItem("rangeError","");let r=this.#o.find(o=>o.field===this.#n);this.#c.setItem("hideRange",!["D","DH","DHZ"].includes(r.dtype));let s=this.#l.sourceNode.rootBuilder.binding.renderer;for(let[o,n]of["from","to"].entries())s.getDomNode(this.#u[o]).restoreFormValue(this.#c.getItem(n));this.#c.getItem("rows").clear(),this.#c.setItem("checked",""),s.getDomNode(this.#S).clear(),this.#b=!1,this.refresh(),this.#r.showPopover(),e.setAttribute("aria-expanded","true"),this.#d(),this.#l.sourceNode.rootBuilder.binding.renderer.getDomNode(this.#S).focus()};refresh=()=>{if(!this.#s)return;for(let n of this.#e.querySelectorAll(".column-filter")){let a=this.#s.columnFilter(n.dataset.field)!==null||this.#s.columnRange(n.dataset.field)!==null;n.classList.toggle("active",a),n.closest("th").classList.toggle("column-filtered",a),n.setAttribute("aria-pressed",String(a))}if(this.#n===null)return;let t=this.#o.find(n=>n.field===this.#n);if(!t){this.close();return}let e=t.title??t.name;this.#r.setAttribute("aria-label",`Filter ${e}`);let i=this.#s.columnFacets(this.#n),r=this.#c.getItem("rows");this.#A.setAttr({height:`${76+28*Math.max(1,Math.min(i.length,8))}px`});let s=new Map(r.getNodes().map(n=>[n.getAttr("key"),n])),o=[];this.#b=!0;try{this.#c.setItem("title",e);for(let a of i){let d=a.value===null?"Empty":C(a.value,t,this.#i),l={key:a.key,value:a.value,caption:d,count:a.count},p=s.get(a.key);if(p)s.delete(a.key),p.setAttr(l);else{let m=`v_${M()}`;r.setItem(m,null,{...l,id:m}),p=r.getNode(m)}a.selected&&o.push(p.label)}for(let a of s.values())r.popNode(a.label);let n=o.join(",");this.#c.getItem("checked")!==n&&this.#c.setItem("checked",n),this.#c.setItem("summary",`${o.length} of ${i.length} values selected`)}finally{this.#b=!1}this.#d()};#d=()=>{this.#a&&R(this.#r,this.#a,{align:"start"})};#N(){this.#a?.setAttribute("aria-expanded","false"),this.#a=null,this.#n=null}close(){if(!this.#a)return;let t=this.#a;this.#r.hidePopover(),this.#N(),t.isConnected&&t.focus({preventScroll:!0})}connect(){this.#v||(this.#v=!0,this.#k(),this.#e.addEventListener("click",this.#L),this.#t.ownerDocument.defaultView.addEventListener("resize",this.#d),this.#t.ownerDocument.defaultView.addEventListener("scroll",this.#d,!0))}disconnect(){this.close(),this.#v=!1,this.#p?.(),this.#p=null;for(let t of this.#E)t.close();this.#E=[],this.#e.removeEventListener("click",this.#L),this.#t.ownerDocument.defaultView.removeEventListener("resize",this.#d),this.#t.ownerDocument.defaultView.removeEventListener("scroll",this.#d,!0)}dispose(){this.disconnect(),this.#x&&this.#l.sourceNode.data.popNode(this.#x)}};import{Bag as J}from"@gramlot/gramlot";var w={};Et(w,{defineCollection:()=>Rt});N(w,ve);import*as ve from"@gramlot/gramlot/components";import{defineCollection as Bt}from"@gramlot/gramlot/components";function Rt(c){if(c.name!=="grid")throw new Error("Unexpected bundled collection");let t=[],e={writeExcelFileLicense:A["assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt"],fflateLicense:A["assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt"]};c.css?.forEach((i,r)=>{i.href=t[r].href});for(let[i,r]of Object.entries(c.assets??{}))r.href=e[i].href;return Bt({...c,css:t,assets:e})}import{sharedModules as zt}from"@gramlot/gramlot";var Mt=c=>zt["./components/parameters.js"][c];var it=Mt("projectParameters");function _(c){return class extends c{constructor(){super();let t=this.attachShadow({mode:"open"}),e=this.ownerDocument.createElement("style");e.textContent=`:host{box-sizing:border-box;display:block;min-width:0;font:inherit;color:var(--gramlot-ink,CanvasText)}
|
|
23
2
|
*,*::before,*::after{box-sizing:border-box}.control-box{min-width:0}slot{display:contents}
|
|
24
|
-
::slotted(*){min-width:0;max-width:100%}`,this.controlBox=this.ownerDocument.createElement("div"),this.controlBox.className="control-box",this.control=this.controlBox,this.control.id="control",this.control.append(this.ownerDocument.createElement("slot")),
|
|
25
|
-
`)):(n.removeAttribute("aria-invalid"),n.removeAttribute("title"))}}refresh(){let e=this.store().bag;for(let[t,n]of this.retained)n.parentBag!==e&&(this.releaseField(t),this.active?.row===n&&this.close());for(let t of this.retained.keys())t!==this.active?.path&&this.releaseCleanField(t);for(let[t,n]of this.renderedRows())this.decorate(n,t)}replaceData(){if(this.close(),this.session){for(let e of this.retained.keys())this.releaseField(e);this.retained.clear()}}dispose(){this.releaseValidation?.(),this.releaseValidation=null,this.disconnect(),this.replaceData(),this.releaseStatus?.(),this.layer.remove()}};function dl(r){return typeof r=="number"&&Number.isFinite(r)?r:Un(r)}var Vn=class{#e=[];#t=!1;constructor(e,t,n,i,s,o,a){this.source=e,this.body=t,this.columns=n,this.rowFor=i,this.read=s,this.selection=o,this.view=a}path(e){return this.source.absDatapath(e.checked.slice(1))}value(e){let t=this.source.getRelativeData(e.checked.slice(1));return e.check==="single"?t==null||t===""?t:dl(t):gs(t)}id(e,t){let n=this.read(e,t.checkedField);return t.check==="single"?dl(n):Un(n)}contains(e,t,n){return e.check==="single"?t===n:ms(t,n)}filter(){let e=this.selection(),t=e===""?null:e.split(",").map(n=>{let i=this.columns().find(s=>s.field===n&&s.check==="multiple");if(!i)throw new TypeError(`Unknown external check column: ${n}`);return{field:i.checkedField,value:this.value(i)}});this.view().applySetFilter(t)}project(e,t,n){let i=this.id(t,n),s=this.value(n),o=e.querySelector("input.grid-set-check");o||(o=e.ownerDocument.createElement("input"),o.className="grid-set-check",e.replaceChildren(o)),o.type=n.check==="single"?"radio":"checkbox",n.check==="single"?o.name=n.field:o.removeAttribute("name"),o.setAttribute("aria-label",`${n.title??n.name}: ${i}`),o.checked=this.contains(n,s,i)}refresh=()=>{this.filter();for(let e of this.body.querySelectorAll("input.grid-set-check")){let t=e.closest("td[data-field]"),n=this.columns().find(s=>s.field===t.dataset.field),i=this.rowFor(t.parentElement);n?.check&&i&&this.project(e.parentElement,i,n)}};change=e=>{let t=e.target;if(!t.matches("input.grid-set-check"))return;let n=t.closest("td[data-field]"),i=this.columns().find(c=>c.field===n.dataset.field),s=this.rowFor(n.parentElement),o=this.id(s,i),a=this.value(i),l=this.contains(i,a,o);if(t.checked===l)return;if(i.check==="single"){t.checked?this.source.setRelativeData(i.checked.slice(1),o):this.project(t.parentElement,s,i);return}let u=t.checked?a?a+","+o:o:(","+a+",").replace(","+o+",",",").slice(1,-1);this.source.setRelativeData(i.checked.slice(1),u)};configure(){for(let e of this.#e)e.close();if(this.#e=[],!!this.#t){this.filter();for(let e of this.columns().filter(t=>t.check))this.#e.push(this.source.rootBuilder.binding.router.register({path:this.path(e),recipient:{receive:this.refresh}}))}}connect(){this.#t||(this.#t=!0,this.body.addEventListener("change",this.change))}disconnect(){this.body.removeEventListener("change",this.change),this.#t=!1,this.configure()}};import{Bag as pl}from"@gramlot/gramlot";var dh="#",fh=/[A-Za-z_$][\w$]*/g;function Wn(r){let e=new Map;for(let u of r){if(u.formula==null)continue;let c=u.formula.trim(),d=c===dh?{kind:"index",field:null}:c.startsWith("+=")?{kind:"running",field:c.slice(2).trim()}:c.startsWith("%=")?{kind:"percent",field:c.slice(2).trim()}:null;if(d&&d.kind!=="index"&&!/^[A-Za-z_][A-Za-z0-9_]*$/.test(d.field))throw new TypeError(`grid formula '${c}' requires a field`);let f=new Map;for(let[m,g]of Object.entries(u))m.startsWith("formula_")&&f.set(m.slice(8),g);let h=null;if(!d)try{h=hh(c)}catch{}let p=d?new Set(d.field?[d.field]:[]):new Set(c.match(fh)??[]);e.set(u.field,{field:u.field,formula:u.formula,special:d,arithmetic:h,parameters:f,references:p,calculated:u.calculated===!0,column:u})}let t=new Map;for(let u of e.values())for(let c of u.references)t.has(c)||t.set(c,new Set),t.get(c).add(u.field);let n=new Set,i=new Set,s=[],o=u=>{if(!i.has(u)){if(n.has(u))throw new TypeError(`grid formula dependency cycle at '${u}'`);n.add(u);for(let c of e.get(u).references)e.has(c)&&o(c);n.delete(u),i.add(u),s.push(u)}};for(let u of e.keys())o(u);let a=new Set;for(let u of s){let c=e.get(u);(["index","running"].includes(c.special?.kind)||[...c.references].some(d=>a.has(d)))&&a.add(u)}let l=new Map([...e].map(([u,c])=>[u,Object.freeze({...c,view:a.has(u)})]));return Object.freeze({definitions:l,triggered:t,order:Object.freeze(s),viewFields:a})}function hh(r){let e=ph(r),t=0,n=()=>e[t],i=u=>{if(n().value!==u)throw new SyntaxError(`expected '${u}' in arithmetic formula`);return e[t++]},s={"+":1,"-":1,"*":2,"/":2,"%":2,"**":3},o=()=>{let u=n();if(u.type==="number")return t++,{kind:"number",value:u.value};if(u.type==="name")return t++,{kind:"name",value:u.value};if(u.value==="("){t++;let c=a(0);return i(")"),c}if(u.value==="+"||u.value==="-")return t++,{kind:"unary",operator:u.value,child:o()};throw new SyntaxError(`unexpected '${u.value||"end"}' in arithmetic formula`)},a=u=>{let c=o();for(;s[n().value]>=u;){let d=e[t++].value,f=a(s[d]+(d==="**"?0:1));c={kind:"binary",operator:d,left:c,right:f}}return c},l=a(0);if(n().type!=="eof")throw new SyntaxError(`unexpected '${n().value}' in arithmetic formula`);return l}function ph(r){let e=[],t=0;for(;t<r.length;){let n=r.slice(t),i=/^\s+/.exec(n);if(i){t+=i[0].length;continue}let s=/^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/.exec(n);if(s){e.push({type:"number",value:s[0]}),t+=s[0].length;continue}let o=/^[A-Za-z_$][\w$]*/.exec(n);if(o){e.push({type:"name",value:o[0]}),t+=o[0].length;continue}let a=/^(?:\*\*|[()+\-*/%])/.exec(n);if(a){e.push({type:"operator",value:a[0]}),t+=a[0].length;continue}throw new SyntaxError(`unsupported arithmetic formula token at ${t}`)}return e.push({type:"eof",value:""}),e}function fl(){if(Ki()==="number")throw new Error("A Decimal backend is required for exact grid formulas")}function jr(r,e){if(F(r))return r;if(r==null||r==="")return null;if(typeof r!="number"&&typeof r!="string")throw new TypeError("Decimal arithmetic requires numeric values");return new e(String(r))}var mh={"+":(r,e)=>r+e,"-":(r,e)=>r-e,"*":(r,e)=>r*e,"/":(r,e)=>r/e,"%":(r,e)=>r%e,"**":(r,e)=>r**e};function Ur(r,e){if(r.kind==="number")return Number(r.value);if(r.kind==="name"){if(!Object.hasOwn(e,r.value))throw new ReferenceError(`${r.value} is not defined`);return e[r.value]}return r.kind==="unary"?r.operator==="-"?-Ur(r.child,e):+Ur(r.child,e):mh[r.operator](Ur(r.left,e),Ur(r.right,e))}function Hn(r,e,t){if(r.kind==="number")return new t(r.value);if(r.kind==="name"){if(!Object.hasOwn(e,r.value))throw new ReferenceError(`${r.value} is not defined`);return jr(e[r.value],t)}if(r.kind==="unary"){let o=Hn(r.child,e,t);return o==null?null:r.operator==="-"?o.neg():o}let n=Hn(r.left,e,t),i=Hn(r.right,e,t);if(n==null||i==null)return null;if(r.operator==="**")return n.pow(Number(i.toString()));let s={"+":"plus","-":"minus","*":"times","/":"div","%":"mod"}[r.operator];return n[s](i)}function _s(r,e){return Object.is(r,e)?!0:F(r)&&F(e)&&r.eq(e)}function Gn(r,e){if(e==null||e==="")return r;if(F(r)||F(e)){fl();let t=F(r)?r.constructor:e.constructor;return jr(r,t).plus(jr(e,t))}if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("Grid aggregate formulas require numeric values");return r+e}function gh(r,e){let t=F(e)?e.eq(0):Object.is(e,0);if(r==null||r===""||e==null||t)return null;if(F(r)||F(e)){let n=F(r)?r.constructor:e.constructor;return jr(r,n).div(jr(e,n)).times(new n(100))}if(typeof r!="number"||typeof e!="number")throw new TypeError("Percentage formulas require numeric values");return r/e*100}var Xn=class{#e;#t=Wn([]);#i=new Set;#n=null;#r=null;#l=[];#s=[];#a=!1;#o=new Map;#c=null;constructor(e){this.#e=e}get source(){return this.#e}get runtime(){return this.source.rootBuilder.binding}get errors(){return new Map(this.#o)}get formulas(){return this.#t}get dataFields(){return new Set(this.formulas.order.filter(e=>!this.viewFields.has(e)))}get viewFields(){return this.formulas.viewFields}configure(e,t,n){if(!(e.formulas===this.#t&&n===this.#n&&t===this.#r&&this.#l.length)&&(this.disconnect(),this.#t=e.formulas,this.#i=new Set(e.fields),this.#n=n,this.#r=t,this.#o.clear(),!!this.formulas.definitions.size)){this.#l=[n.subscribe(i=>this.#y(i)),t.subscribe(()=>{this.#c=null})];for(let i of this.formulas.definitions.values())for(let s of i.parameters.values()){if(typeof s!="string"||!s.startsWith("^"))continue;let[o,a=null]=this.source.absDatapath(s).split("?");this.#s.push(this.runtime.router.register({path:o,attr:a,recipient:{receive:()=>{this.#c=null,this.recalculate(this.#v([i.field]))}}}))}this.recalculate(this.#v(this.#x(i=>i.calculated)))}}disconnect(){for(let e of this.#l)e();for(let e of this.#s)e.close();this.#l=[],this.#s=[],this.#n=null,this.#r=null,this.#c=null,this.#t=Wn([])}value(e,t){if(!this.viewFields.has(t))return this.#n.value(e,t);let n=this.#E().get(e);return n===void 0?null:n[t]}#x(e){return[...this.formulas.definitions.values()].filter(e).map(t=>t.field)}#v(e){let t=new Set(e),n=[...e];for(;n.length;)for(let i of this.formulas.triggered.get(n.shift())??[])t.has(i)||(t.add(i),n.push(i));return t}#y({full:e,rows:t,event:n,field:i}){if(this.#c=null,this.#a)return;if(e){this.recalculate(this.#v(this.#x(c=>c.calculated||c.special)));return}let[s]=t,o;i!==null?o=[i]:n.node===s?o=n.evt==="upd_attrs"?Object.keys(n.attrs_diff):[...this.formulas.triggered.keys()]:o=(Array.isArray(n.node)?n.node:[n.node]).map(c=>c.label);let a=new Set;for(let c of o)for(let d of this.formulas.triggered.get(c)??[])a.add(d);let l=this.#v(a),u=[...l].some(c=>this.formulas.definitions.get(c).special?.kind==="percent");this.recalculate(l,u?null:[s])}#d(e){let t={};for(let[n,i]of e.parameters)t[n]=typeof i=="string"&&(i.startsWith("^")||i.startsWith("="))?this.source.getRelativeData(i):i;return t}#b(e,t,n,i,s){if(e.special?.kind==="index")return n;if(e.special?.kind==="running")return Gn(i,s(t,e.special.field));if(e.special?.kind==="percent")return gh(s(t,e.special.field),i);let o=this.#d(e),a={};for(let d of e.references)Object.hasOwn(o,d)?a[d]=o[d]:(this.#i.has(d)||this.#f(t).has(d))&&(a[d]=s(t,d)??null);if(Object.values(a).some(d=>d==null))return null;let l=Object.values(a).find(F);if(e.arithmetic)return l===void 0?Ur(e.arithmetic,a):(fl(),Hn(e.arithmetic,a,l.constructor));if(l!==void 0)throw new Error("Decimal grid formulas support arithmetic expressions only");let u=[...Object.keys(a),"_currcell","_rowNode"];return this.runtime.inlineCompiler.compile(this.source,`struct.${e.field}.formula`,e.formula,u,`return (${e.formula}
|
|
26
|
-
);`)({...a,_currcell:e.column,_rowNode:t})}#f(e){return this.#n.rowMode==="attributes"?new Set(Object.keys(e.getAttr())):new Set(e.staticValue.keys())}#h(e,t,n){_s(this.#n.value(e,t),n)||(this.#n.rowMode==="attributes"?e.setAttr({[t]:n}):e.staticValue.setItem(t,n))}recalculate(e,t=null){if(this.#a||!e.size||this.#n===null)return;this.#a=!0;let n=(i,s)=>this.#n.value(i,s);try{let i=this.#n.getRows();for(let s of this.formulas.order){let o=this.formulas.definitions.get(s);if(!e.has(s)||o.view)continue;let a=null,l=null;if(o.special?.kind==="percent")try{a=0;for(let u of i)a=Gn(a,n(u,o.special.field))}catch(u){a=null,l=u}for(let u of t??i){let c=null;try{c=this.#b(o,u,null,a,n)}catch(d){l=d}this.#h(u,s,c)}l?this.#o.set(s,l):this.#o.delete(s)}}finally{this.#a=!1}}#E(){if(this.#c!==null)return this.#c;let e=this.#r.getRows(),t=new Map(e.map(i=>[i,{}])),n=(i,s)=>this.viewFields.has(s)?t.get(i)[s]:this.#n.value(i,s);for(let i of this.formulas.order){let s=this.formulas.definitions.get(i);if(!s.view)continue;let o=0,a=null;for(let[l,u]of e.entries()){let c=null;try{c=this.#b(s,u,l+1,o,n),s.special?.kind==="running"&&(o=c)}catch(d){a=d}t.get(u)[i]=c}a?this.#o.set(i,a):this.#o.delete(i)}return this.#c=t,t}};var bh=new Set(["T","B","L","R","N","D","H","DHZ"]),_h=new Set(["tag","field","name","title","dtype","width","align","format","columnset","white_space","max_height","edit","check","checked","checkedField","formula","calculated","hidden","totalize","footer_value","footer_format"]),wh=/^formula_[A-Za-z_$][\w$]*$/,yh=new Set(["tag","code","name","background","color"]),Zn=class{#e=new Map;constructor(e){if(!(e instanceof pl))throw new TypeError("grid structpath must resolve to a Bag");let t=Yn(e,"view_0"),n=Yn(e,"info"),i=Yn(t,"rows_0"),s=Yn(n,"columnsets"),o=new Set,a=new Map;for(let u of s.getNodes()){let c=u.getAttr();if(hl(c,yh),ws(c.code,"colgroup code"),c.tag!=="columnset"||u.resolver||u.staticValue!=null||u.label!==c.code)throw new TypeError("grid columnset requires a scalar definition labelled by code");if(a.has(c.code))throw new TypeError(`Duplicate grid colgroup: ${c.code}`);if(c.name!=null&&typeof c.name!="string")throw new TypeError("grid group name must be text");for(let d of["background","color"])if(c[d]!=null&&typeof c[d]!="string")throw new TypeError(`grid ${d} must be text`);a.set(c.code,{...c,name:c.name??c.code})}this.columns=[],this.groups=[];let l=[];for(let u of i.getNodes()){let c=u.getAttr();if(hl(c,_h,wh),c.tag!=="cell"||u.staticValue!=null||u.resolver)throw new TypeError("grid cell must be a scalar declaration");if(ws(c.field,"field"),o.has(c.field))throw new TypeError(`Duplicate grid field: ${c.field}`);if(o.add(c.field),this.#e.set(c.field,u),c.columnset!=null&&!a.has(c.columnset))throw new TypeError(`Unknown grid columnset: ${c.columnset}`);if(c.dtype!=null&&!bh.has(c.dtype))throw new TypeError(`Unsupported grid dtype: ${c.dtype}`);if(c.align!=null&&!["start","center","end"].includes(c.align))throw new TypeError("grid align requires start, center or end");if(c.width!=null&&(typeof c.width!="string"||!/^(?:\d+(?:\.\d+)?)(?:px|em|rem|ch|%)$/.test(c.width)))throw new TypeError("grid width requires a nonnegative CSS length (px, em, rem, ch or %)");if(c.max_height!=null&&(typeof c.max_height!="string"||!/^(?:\d+(?:\.\d+)?)(?:px|em|rem)$/.test(c.max_height)))throw new TypeError("grid max_height requires a nonnegative CSS length (px, em or rem)");if(c.white_space!=null&&!["normal","nowrap","pre-wrap"].includes(c.white_space))throw new TypeError("grid white_space requires normal, nowrap or pre-wrap");for(let p of["name","title","format"])if(c[p]!=null&&typeof c[p]!="string")throw new TypeError(`grid ${p} must be text`);if(c.edit!=null&&typeof c.edit!="boolean"&&(typeof c.edit!="object"||Array.isArray(c.edit)))throw new TypeError("grid edit requires a boolean or editor options");if(c.check!=null||c.checked!=null||c.checkedField!=null){if(!["multiple","single"].includes(c.check)||typeof c.checked!="string"||!c.checked.startsWith("^")||c.checked.length<2||c.checked.includes("?"))throw new TypeError("grid check requires single or multiple and checked=^DataPath");if(ws(c.checkedField,"checkedField"),c.edit)throw new TypeError("external check sets cannot edit row fields")}vh(c);let d=Object.freeze({...c,name:c.name??c.field,align:c.align??(["L","R","N"].includes(c.dtype)?"end":"start")});if(l.push(d),c.hidden)continue;this.columns.push(d);let f=c.columnset??null,h=this.groups.at(-1);(!h||h.code!==f)&&(h={code:f,...f===null?{name:null}:a.get(f),columns:[]},this.groups.push(h)),h.columns.push(d)}if(!this.columns.length)throw new TypeError("grid struct requires at least one column");this.fields=Object.freeze([...o]),this.formulas=Wn(l);for(let u of this.groups)Object.freeze(u.columns),Object.freeze(u);Object.freeze(this.columns),Object.freeze(this.groups),Object.freeze(this)}columnNode(e){return this.#e.get(e)}moveColumn(e,t,n=!1){let i=this.#e.get(e),s=this.#e.get(t);if(!i||!s||i===s)return;let o=i.parentBag,a=o.getNodes(),l=a.indexOf(i),u=a.indexOf(s),c=u+Number(n)-+(l<u);c!==l&&o.move(l,c)}setColumnWidth(e,t){if(!Number.isFinite(t)||t<=0)throw new TypeError("grid resized width must be positive pixels");this.#e.get(e).setAttr({width:`${Math.round(t)}px`})}};function Yn(r,e){let t=r.getNode(e);if(!t||t.resolver||!(t.staticValue instanceof pl))throw new TypeError(`grid struct requires Bag ${e}`);return t.staticValue}function hl(r,e,t=null){for(let n of Object.keys(r))if(!e.has(n)&&!t?.test(n))throw new TypeError(`Unsupported grid struct attribute: ${n}`)}function vh(r){if(r.formula!=null&&(typeof r.formula!="string"||!r.formula.trim()))throw new TypeError("grid formula must be nonempty text");if(r.formula==null&&(r.calculated!=null||Object.keys(r).some(e=>e.startsWith("formula_"))))throw new TypeError(`grid ${r.field}: calculated and formula_<name> require a formula`);for(let e of["calculated","hidden"])if(r[e]!=null&&typeof r[e]!="boolean")throw new TypeError(`grid ${e} must be a boolean`);if(r.totalize!=null&&typeof r.totalize!="boolean"&&(typeof r.totalize!="string"||!r.totalize))throw new TypeError("grid totalize requires a boolean or a Data path");for(let e of["footer_value","footer_format"])if(r[e]!=null&&typeof r[e]!="string")throw new TypeError(`grid ${e} must be text`)}function ws(r,e){if(typeof r!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new TypeError(`grid ${e} requires a simple field identifier`)}var Kn=class{#e;#t;#i;#n;#r;#l;#s;#a=[];#o=!1;#c=new Map;constructor(e,t,n){this.#e=e,this.#t=t,this.#i=n;let i=n.ownerDocument;this.#n=i.createElement("div"),this.#n.className="footer-frame",this.#n.setAttribute("part","footer"),this.#r=i.createElement("div"),this.#r.className="footer-viewport",this.#l=i.createElement("table"),this.#l.setAttribute("role","presentation");let s=i.createElement("tfoot");s.setAttribute("role","rowgroup"),this.#s=i.createElement("tr"),this.#s.setAttribute("role","row"),s.append(this.#s),this.#l.append(s),this.#r.append(this.#l),this.#n.append(this.#r)}get source(){return this.#e}get frame(){return this.#n}get table(){return this.#l}get viewport(){return this.#r}get errors(){return new Map(this.#c)}cell(e){return this.#s.querySelector(`td[data-field="${e}"]`)}configure(e,t,n){this.#o=e,this.#a=t,e===!1?this.#n.remove():this.#i.after(this.#n);let i=this.#s.ownerDocument,s=[];if(n){let o=i.createElement("th");o.className="row-heading",o.setAttribute("role","rowheader"),s.push(o)}for(let[o,a]of t.entries()){let l=i.createElement("td");l.dataset.field=a.field,l.setAttribute("role","cell"),l.setAttribute("part","footer-cell"),l.setAttribute("aria-colindex",String(o+1+Number(n))),l.style.textAlign=a.totalize?"end":a.align,l.classList.toggle("numeric",!!a.totalize),s.push(l)}this.#s.replaceChildren(...s)}update(e,t){for(let[n,i]of this.#a.entries()){let s=this.cell(i.field),o=i.footer_value??"",a=null;if(i.totalize){let l=0;try{for(let u of t){let c=e.value(u,i.field);l=Gn(l,typeof c=="boolean"?Number(c):c)}this.#c.delete(i.field)}catch(u){l=null,this.#c.set(i.field,u)}this.#x(i,l),l===null?(o="\u2014",a=this.#c.get(i.field).message):o=Nr(l,{...i,dtype:i.dtype==="B"?"L":i.dtype,format:i.footer_format??i.format},this.#t)}else n===0&&o===""&&(o=this.#o===!0?"Total":this.#o);s.textContent!==o&&(s.textContent=o),a===null?(s.removeAttribute("title"),s.removeAttribute("aria-invalid")):(s.title=a,s.setAttribute("aria-invalid","true"))}}totalPaths(){return this.#a.filter(e=>e.totalize).map(e=>this.source.absDatapath(e.totalize===!0?`.totalize.${e.field}`:e.totalize))}#x(e,t){let n=e.totalize===!0?`.totalize.${e.field}`:e.totalize;_s(this.source.getRelativeData(n),t)||this.source.setRelativeData(n,t)}};import{Bag as Kt}from"@gramlot/gramlot";var ml=Object.freeze({csv:{caption:"CSV",extension:"csv",type:"text/csv"},json:{caption:"JSON",extension:"json",type:"application/json"},tytx:{caption:"TYTX",extension:"tytx",type:"text/plain"},xml:{caption:"XML",extension:"xml",type:"application/xml"},xlsx:{caption:"Excel",extension:"xlsx",type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}),kh=null,Eh=Object.freeze({export:{label:"Export",publish:"export",icon:"\u21E9",tooltip:"Export the visible rows"},printRows:{label:"Print",publish:"printRows",icon:"\u2399",tooltip:"Print the visible rows"},lineNumbers:{label:"Line numbers",publish:"lineNumbers",tooltip:"Show or hide the row numbers"},addrow:{label:"Add row",publish:"addrow",icon:"+",tooltip:"Add a row"},duprow:{label:"Duplicate",publish:"duprow",icon:"\u29C9",tooltip:"Duplicate the selected rows"},delrow:{label:"Delete",publish:"delrow",icon:"\u2212",tooltip:"Delete the selected rows"}}),xh=new Set(["grid:addrow","grid:duprow","grid:delrow"]),Ah=new Set(["grid:duprow","grid:delrow"]);function gl(r){let e=r.commands.registerGroup("grid",{description:"Grid toolbar tools"});for(let[t,n]of Object.entries(Eh))e.register(t,n)}function Dh(r){return/[",\r\n]/.test(r)?`"${r.replaceAll('"','""')}"`:r}var Jn=class{#e;#t;#i=[];constructor(e,t){this.#e=e,this.#t=t}get source(){return this.#e.sourceNode}get runtime(){return this.source.rootBuilder.binding}connect(){if(this.#i.length)return;let e=this.runtime.subscriptions,t={export:n=>this.exportRows(n.parameters.format),printRows:()=>this.printRows(),lineNumbers:()=>this.toggleLineNumbers(),addrow:n=>this.addRow(n.parameters.defaults??{}),duprow:()=>this.duplicateRows(),delrow:()=>this.deleteRows()};for(let[n,i]of Object.entries(t))this.#i.push(e.subscribe(e.topicFor(this.source,n),async s=>{try{await i(s)}catch(o){this.#e.reportError(o,"Grid tool")}}))}disconnect(){for(let e of this.#i)this.runtime.subscriptions.unsubscribe(e);this.#i=[]}#n(){let e=this.#t.columns().filter(n=>!n.check),t=new bt(this.#t.reader(),this.#e.format).read(e,this.#t.rows());return{captions:e.map(n=>n.name),cells:t.map(n=>n.cells)}}csv(){let{captions:e,cells:t}=this.#n();return[e,...t].map(n=>n.map(Dh).join(",")).join(`\r
|
|
3
|
+
::slotted(*){min-width:0;max-width:100%}`,this.controlBox=this.ownerDocument.createElement("div"),this.controlBox.className="control-box",this.control=this.controlBox,this.control.id="control",this.control.append(this.ownerDocument.createElement("slot")),t.append(e,this.controlBox)}projectAttributes(t){return it(this,t)}}}_.parameters={};import{sharedModules as Ft}from"@gramlot/gramlot";var It=c=>Ft["./stores/bag-collection-view.js"][c];var K=It("parseSort");import Qt from"@gramlot/collections/inputs";import{sourceTarget as I,toTytx as jt}from"@gramlot/gramlot";var j=class{constructor(t,e,i,r,s,o,n){this.grid=t,this.context=e,this.cellFor=i,this.store=r,this.renderedRows=s,this.navigate=o,this.focusField=n,this.retained=new Map,this.declarations=new Map,this.checking=new Set,this.columns=[],this.layer=t.ownerDocument.createElement("div"),this.layer.className="cell-editor",this.layer.hidden=!0;let a=t.ownerDocument.createElement("slot");a.name="cell-editor",this.layer.append(a),t.control.append(this.layer),this.keydown=d=>{if(!(!this.active||d.isComposing)){if(d.key==="Escape"){d.preventDefault();let l=this.cellFor(this.active.row,this.active.column.field);this.session.clearDraft(this.active.source),this.close(),l?.focus({preventScroll:!0})}else if(d.key==="Enter"||d.key==="Tab"){if(d.key==="Enter"&&this.active.element.control.localName==="textarea"&&!d.ctrlKey&&!d.metaKey)return;d.preventDefault();let l=this.active;this.session.commitField(l.path);let p=this.cellFor(l.row,l.column.field);this.close(),p?.focus({preventScroll:!0}),d.key==="Tab"&&this.navigate(l.row,l.column.field,d.shiftKey?-1:1)}}},this.arrowKeydown=d=>{if(!this.active||d.isComposing||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(d.key)||d.altKey||d.ctrlKey||d.metaKey||d.shiftKey)return;let l=this.active.element.control;if(l.localName==="textarea"||["range","date","time","datetime-local"].includes(l.type)||["gramlot-date-text-box","gramlot-time-text-box","gramlot-date-calendar"].includes(this.active.element.localName)||l.getAttribute("aria-expanded")==="true"||d.key==="ArrowDown"&&l.getAttribute("role")==="combobox")return;let p=d.key==="ArrowLeft"||d.key==="ArrowRight",m=d.key==="ArrowLeft"||d.key==="ArrowUp";if(p&&(typeof l.selectionStart!="number"||l.selectionStart!==l.selectionEnd||l.selectionStart!==(m?0:l.value.length)))return;d.preventDefault(),d.stopPropagation();let h=this.active;if(this.session.commitField(h.path),this.navigate(h.row,h.column.field,p?m?-1:1:{row:m?-1:1}),p&&this.active&&this.active!==h){let u=this.active.element.control;if(typeof u.selectionStart=="number"){let f=m?u.value.length:0;u.setSelectionRange(f,f)}}},this.connect(),e.sourceNode.rootBuilder.binding.bindingFor(e.sourceNode).track(()=>this.dispose())}connect(){this.grid.addEventListener("keydown",this.keydown),this.grid.addEventListener("keydown",this.arrowKeydown,!0),this.session&&!this.releaseNavigator&&(this.releaseNavigator=this.session.registerNavigator(this.focusField))}disconnect(){this.close(),this.grid.removeEventListener("keydown",this.keydown),this.grid.removeEventListener("keydown",this.arrowKeydown,!0),this.releaseNavigator?.(),this.releaseNavigator=null}path(t,e){let{mode:i}=this.store();return this.context.sourceNode.absDatapath(this.context.sourceNode.getAttr("storepath"))+"."+t.label+(i==="attributes"?"?":".")+e}configure(t){let e=t.filter(r=>r.edit);if(e.length){if(this.store().window!==null)throw new Error("Editing requires a fully resident Bag; remote windows are read-only.");let r=this.context.sourceNode;this.session=r.editCollection(r.absDatapath(r.getAttr("storepath")))}let i=jt(e.map(({field:r,dtype:s,edit:o})=>({field:r,dtype:s,edit:o})));if(i!==this.validationSignature){this.validationSignature=i,this.columns=e;for(let[r,s]of this.declarations){let o=e.find(n=>n.field===s.field);if(!o)this.active?.path===r&&this.close(),this.releaseField(r);else{let{tag:n,options:a}=this.definition(o);n!==s.tag?(this.active?.path===r&&this.close(),this.releaseField(r)):(s.source.setAttr({...Object.fromEntries(Object.keys(s.options).map(d=>[d,null])),...a}),s.options=a)}}if(!e.length){this.releaseValidation?.(),this.releaseValidation=null;return}this.releaseStatus||(this.releaseStatus=this.session.subscribe(()=>this.refresh())),this.releaseNavigator||(this.releaseNavigator=this.session.registerNavigator(this.focusField)),this.releaseValidation?this.session.invalidateValidation():this.releaseValidation=this.session.registerValidationSource(()=>this.validationFields())}}definition(t){let e=t.edit===!0?{}:{...t.edit},i=e.tag??{L:"numberTextBox",R:"numberTextBox",N:"numberTextBox",D:"dateTextBox",H:"timeTextBox",B:"checkBox"}[t.dtype]??"textbox";if(t.dtype==="DHZ"&&!e.tag)throw new Error("A datetime column requires an explicitly declared supported editor.");return delete e.tag,{tag:i,options:{...e,dtype:t.dtype??"T"}}}*validationFields(){let t=this.context.sourceNode;this.session.trackValidationDependency(t.absDatapath(t.getAttr("structpath")));let e=this.store().bag;for(let i of e.getNodes())for(let r of this.columns){if(i.parentBag!==e)continue;let s=this.path(i,r.field);this.checking.add(s);try{yield{node:this.declare(i,r,!1).source,release:()=>{this.checking.delete(s),s!==this.active?.path&&this.releaseCleanField(s)}}}catch(o){throw this.checking.delete(s),this.releaseCleanField(s),o}}}open(t,e,i){if(this.store().window!==null)throw new Error("Editing requires a fully resident Bag; remote windows are read-only.");if(this.active?.row===t&&this.active.column.field===e.field){this.active.element.control.focus();return}this.close();let r=this.path(t,e.field),s=this.declare(t,e,!0),o=this.grid.ownerDocument.getElementById(s.id);this.active={row:t,column:e,path:r,...s,element:o},this.layer.hidden=!1,this.position(i),o.control.focus()}declare(t,e,i){let r=this.context.sourceNode,s=this.path(t,e.field);this.retained.has(s)||(this.session.retainField(s),this.retained.set(s,t));let o=this.declarations.get(s);if(o)i&&r.rootBuilder.binding.renderer.mountView(o.container);else{let{tag:n,options:a}=this.definition(e);if(!r.rootBuilder.schemaTag(n))throw new Error(`Grid editor requires the ${n} input collection.`);let d=r.rootBuilder,l=`grid-cell-${crypto.randomUUID()}`,p=d.wrapSource(r).div({node_label:l,slot:"cell-editor"});i||d.binding.renderer.unmountView(I(p));try{let m=p[n]({...a,value:"^"+s,id:l,width:"100%",margin:"0"});o={container:I(p),source:I(m),id:l,tag:n,options:a,field:e.field};let h=this.grid.ownerDocument.defaultView.customElements.get(o.source._getMeta("render_tag"));this.session.registerField(o.source,h,i),this.declarations.set(s,o)}catch(m){let h=I(p);throw h.parentBag.popNode(h.label),this.releaseCleanField(s),m}}return o}close(){let t=this.active;this.active=null,this.layer.hidden=!0,t&&(this.context.sourceNode.rootBuilder.binding.renderer.unmountView(t.container),this.releaseCleanField(t.path))}releaseCleanField(t){if(this.checking.has(t))return;let e=this.session.fieldStatus(t);e.error===null&&e.pending===null&&e.draft===null&&this.retained.has(t)&&this.releaseField(t)}releaseField(t){let e=this.declarations.get(t);this.declarations.delete(t),e?.container.parentBag&&e.container.parentBag.popNode(e.container.label),this.session.releaseField(t),this.retained.delete(t)}position(t=null){if(!this.active)return;if(t??=this.cellFor(this.active.row,this.active.column.field),!t){this.close();return}let e=t.getBoundingClientRect(),i=this.grid.control.getBoundingClientRect(),r=this.grid.shadowRoot.querySelector(".body-viewport").getBoundingClientRect();Object.assign(this.layer.style,{left:`${e.left-i.left-this.grid.control.clientLeft}px`,top:`${e.top-i.top-this.grid.control.clientTop}px`,width:`${e.width}px`}),this.layer.style.setProperty("--grid-editor-height",`${e.height}px`);let s=t.style.getPropertyValue("--grid-cell-max-height");s?this.layer.style.setProperty("--grid-cell-max-height",s):this.layer.style.removeProperty("--grid-cell-max-height");let o=this.layer.getBoundingClientRect();r.height&&(o.top<r.top||o.bottom>r.bottom||o.right<=r.left||o.left>=r.right)&&this.close()}decorate(t,e){if(this.session)for(let i of t.querySelectorAll("td[data-field]")){let r=this.session.fieldStatus(this.path(e,i.dataset.field));i.classList.toggle("invalid-cell",!!r.error),i.classList.toggle("draft-cell",r.draft!==null),r.error?(i.setAttribute("aria-invalid","true"),i.title=r.error.getNodes().map(s=>s.value).join(`
|
|
4
|
+
`)):(i.removeAttribute("aria-invalid"),i.removeAttribute("title"))}}refresh(){let t=this.store().bag;for(let[e,i]of this.retained)i.parentBag!==t&&(this.releaseField(e),this.active?.row===i&&this.close());for(let e of this.retained.keys())e!==this.active?.path&&this.releaseCleanField(e);for(let[e,i]of this.renderedRows())this.decorate(i,e)}replaceData(){if(this.close(),this.session){for(let t of this.retained.keys())this.releaseField(t);this.retained.clear()}}dispose(){this.releaseValidation?.(),this.releaseValidation=null,this.disconnect(),this.replaceData(),this.releaseStatus?.(),this.layer.remove()}};import{sharedModules as $t}from"@gramlot/gramlot";var Z=c=>$t["./stores/id-set.js"][c],rt=Z("containsId"),U=Z("requireId"),st=Z("requireIdSet");function ot(c){return typeof c=="number"&&Number.isFinite(c)?c:U(c)}var $=class{#t=[];#e=!1;constructor(t,e,i,r,s,o,n){this.source=t,this.body=e,this.columns=i,this.rowFor=r,this.read=s,this.selection=o,this.view=n}path(t){return this.source.absDatapath(t.checked.slice(1))}value(t){let e=this.source.getRelativeData(t.checked.slice(1));return t.check==="single"?e==null||e===""?e:ot(e):st(e)}id(t,e){let i=this.read(t,e.checkedField);return e.check==="single"?ot(i):U(i)}contains(t,e,i){return t.check==="single"?e===i:rt(e,i)}filter(){let t=this.selection(),e=t===""?null:t.split(",").map(i=>{let r=this.columns().find(s=>s.field===i&&s.check==="multiple");if(!r)throw new TypeError(`Unknown external check column: ${i}`);return{field:r.checkedField,value:this.value(r)}});this.view().applySetFilter(e)}project(t,e,i){let r=this.id(e,i),s=this.value(i),o=t.querySelector("input.grid-set-check");o||(o=t.ownerDocument.createElement("input"),o.className="grid-set-check",t.replaceChildren(o)),o.type=i.check==="single"?"radio":"checkbox",i.check==="single"?o.name=i.field:o.removeAttribute("name"),o.setAttribute("aria-label",`${i.title??i.name}: ${r}`),o.checked=this.contains(i,s,r)}refresh=()=>{this.filter();for(let t of this.body.querySelectorAll("input.grid-set-check")){let e=t.closest("td[data-field]"),i=this.columns().find(s=>s.field===e.dataset.field),r=this.rowFor(e.parentElement);i?.check&&r&&this.project(t.parentElement,r,i)}};change=t=>{let e=t.target;if(!e.matches("input.grid-set-check"))return;let i=e.closest("td[data-field]"),r=this.columns().find(l=>l.field===i.dataset.field),s=this.rowFor(i.parentElement),o=this.id(s,r),n=this.value(r),a=this.contains(r,n,o);if(e.checked===a)return;if(r.check==="single"){e.checked?this.source.setRelativeData(r.checked.slice(1),o):this.project(e.parentElement,s,r);return}let d=e.checked?n?n+","+o:o:(","+n+",").replace(","+o+",",",").slice(1,-1);this.source.setRelativeData(r.checked.slice(1),d)};configure(){for(let t of this.#t)t.close();if(this.#t=[],!!this.#e){this.filter();for(let t of this.columns().filter(e=>e.check))this.#t.push(this.source.rootBuilder.binding.router.register({path:this.path(t),recipient:{receive:this.refresh}}))}}connect(){this.#e||(this.#e=!0,this.body.addEventListener("change",this.change))}disconnect(){this.body.removeEventListener("change",this.change),this.#e=!1,this.configure()}};import{sharedModules as qt}from"@gramlot/gramlot";var Ht=c=>qt["./components/grid-structure.js"][c],nt=Ht("GridStructure");import{sharedModules as Vt}from"@gramlot/gramlot";var X=c=>Vt["./components/grid-formulas.js"][c],at=X("GridFormulas"),lt=X("addNumeric");var dt=X("sameValue");var q=class{#t;#e;#s;#o;#i;#l;#r;#a=[];#n=!1;#h=new Map;constructor(t,e,i){this.#t=t,this.#e=e,this.#s=i;let r=i.ownerDocument;this.#o=r.createElement("div"),this.#o.className="footer-frame",this.#o.setAttribute("part","footer"),this.#i=r.createElement("div"),this.#i.className="footer-viewport",this.#l=r.createElement("table"),this.#l.setAttribute("role","presentation");let s=r.createElement("tfoot");s.setAttribute("role","rowgroup"),this.#r=r.createElement("tr"),this.#r.setAttribute("role","row"),s.append(this.#r),this.#l.append(s),this.#i.append(this.#l),this.#o.append(this.#i)}get source(){return this.#t}get frame(){return this.#o}get table(){return this.#l}get viewport(){return this.#i}get errors(){return new Map(this.#h)}cell(t){return this.#r.querySelector(`td[data-field="${t}"]`)}configure(t,e,i){this.#n=t,this.#a=e,t===!1?this.#o.remove():this.#s.after(this.#o);let r=this.#r.ownerDocument,s=[];if(i){let o=r.createElement("th");o.className="row-heading",o.setAttribute("role","rowheader"),s.push(o)}for(let[o,n]of e.entries()){let a=r.createElement("td");a.dataset.field=n.field,a.setAttribute("role","cell"),a.setAttribute("part","footer-cell"),a.setAttribute("aria-colindex",String(o+1+Number(i))),a.style.textAlign=n.totalize?"end":n.align,a.classList.toggle("numeric",!!n.totalize),s.push(a)}this.#r.replaceChildren(...s)}update(t,e){for(let[i,r]of this.#a.entries()){let s=this.cell(r.field),o=r.footer_value??"",n=null;if(r.totalize){let a=0;try{for(let d of e){let l=t.value(d,r.field);a=lt(a,typeof l=="boolean"?Number(l):l)}this.#h.delete(r.field)}catch(d){a=null,this.#h.set(r.field,d)}this.#A(r,a),a===null?(o="\u2014",n=this.#h.get(r.field).message):o=C(a,{...r,dtype:r.dtype==="B"?"L":r.dtype,format:r.footer_format??r.format},this.#e)}else i===0&&o===""&&(o=this.#n===!0?"Total":this.#n);s.textContent!==o&&(s.textContent=o),n===null?(s.removeAttribute("title"),s.removeAttribute("aria-invalid")):(s.title=n,s.setAttribute("aria-invalid","true"))}}totalPaths(){return this.#a.filter(t=>t.totalize).map(t=>this.source.absDatapath(t.totalize===!0?`.totalize.${t.field}`:t.totalize))}#A(t,e){let i=t.totalize===!0?`.totalize.${t.field}`:t.totalize;dt(this.source.getRelativeData(i),e)||this.source.setRelativeData(i,e)}};import{Bag as T}from"@gramlot/gramlot";import{sharedModules as Pt}from"@gramlot/gramlot";var Ot=c=>Pt["./libraries.js"][c];var ct=Ot("loadLibrary");var ht=Object.freeze({csv:{caption:"CSV",extension:"csv",type:"text/csv"},json:{caption:"JSON",extension:"json",type:"application/json"},tytx:{caption:"TYTX",extension:"tytx",type:"text/plain"},xml:{caption:"XML",extension:"xml",type:"application/xml"},xlsx:{caption:"Excel",extension:"xlsx",type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}),Gt=null,Wt=Object.freeze({export:{label:"Export",publish:"export",icon:"\u21E9",tooltip:"Export the visible rows"},printRows:{label:"Print",publish:"printRows",icon:"\u2399",tooltip:"Print the visible rows"},lineNumbers:{label:"Line numbers",publish:"lineNumbers",tooltip:"Show or hide the row numbers"},addrow:{label:"Add row",publish:"addrow",icon:"+",tooltip:"Add a row"},duprow:{label:"Duplicate",publish:"duprow",icon:"\u29C9",tooltip:"Duplicate the selected rows"},delrow:{label:"Delete",publish:"delrow",icon:"\u2212",tooltip:"Delete the selected rows"}}),Kt=new Set(["grid:addrow","grid:duprow","grid:delrow"]),Zt=new Set(["grid:duprow","grid:delrow"]);function ut(c){let t=c.commands.registerGroup("grid",{description:"Grid toolbar tools"});for(let[e,i]of Object.entries(Wt))t.register(e,i)}function Ut(c){return/[",\r\n]/.test(c)?`"${c.replaceAll('"','""')}"`:c}var H=class{#t;#e;#s=[];constructor(t,e){this.#t=t,this.#e=e}get source(){return this.#t.sourceNode}get runtime(){return this.source.rootBuilder.binding}connect(){if(this.#s.length)return;let t=this.runtime.subscriptions,e={export:i=>this.exportRows(i.parameters.format),printRows:()=>this.printRows(),lineNumbers:()=>this.toggleLineNumbers(),addrow:i=>this.addRow(i.parameters.defaults??{}),duprow:()=>this.duplicateRows(),delrow:()=>this.deleteRows()};for(let[i,r]of Object.entries(e))this.#s.push(t.subscribe(t.topicFor(this.source,i),async s=>{try{await r(s)}catch(o){this.#t.reportError(o,"Grid tool")}}))}disconnect(){for(let t of this.#s)this.runtime.subscriptions.unsubscribe(t);this.#s=[]}#o(){let t=this.#e.columns().filter(i=>!i.check),e=new E(this.#e.reader(),this.#t.format).read(t,this.#e.rows());return{captions:t.map(i=>i.name),cells:e.map(i=>i.cells)}}csv(){let{captions:t,cells:e}=this.#o();return[t,...e].map(i=>i.map(Ut).join(",")).join(`\r
|
|
27
5
|
`)+`\r
|
|
28
|
-
`}#r(){let e=this.#t.columns().filter(n=>!n.check),t=this.#t.reader();return{columns:e,rows:this.#t.rows().map(n=>[n,e.map(i=>t.value(n,i.field)??null)])}}rowsBag(){let{columns:e,rows:t}=this.#r(),n=new Kt,i=this.#t.store().mode==="values";for(let[s,o]of t){let a=Object.fromEntries(e.map((l,u)=>[l.field,o[u]]));i?n.setItem(s.label,new Kt(a)):n.setItem(s.label,null,a)}return n}xml(){let e=new Kt;return e.setItem("GenRoBag",this.rowsBag()),e.toXml({docHeader:!0})}json(){let{columns:e,rows:t}=this.#r();return JSON.stringify(t.map(([,n])=>new Kt(Object.fromEntries(e.map((i,s)=>[i.field,n[s]]))).asDict(!1,!1,!0)),null,2)}async xlsx(){let{columns:e,rows:t}=this.#r(),n=(await(kh??=import("./modules/browser-LVJHKBBV.js"))).default,i=(a,l)=>a===null?null:F(a)?Number(a.toString()):a instanceof Date?{value:a,type:Date,format:["DH","DHZ"].includes(l.dtype)?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd"}:["number","boolean","string"].includes(typeof a)?a:String(a),o=[e.map(a=>({value:a.name,fontWeight:"bold"})),...t.map(([,a])=>a.map((l,u)=>i(l,e[u])))];return n(o,{sheet:this.source.label,stickyRowsCount:1}).toBlob()}async exportRows(e){let t=ml[e];if(!t)throw new TypeError(`grid export format must be one of ${Object.keys(ml).join(", ")}`);let n=e==="csv"?this.csv():e==="json"?this.json():e==="tytx"?this.rowsBag().toTytx():e==="xml"?this.xml():await this.xlsx();this.runtime.gramlot.utl.inout.saveText(n,`${this.source.label}.${t.extension}`,t.type)}printRows(){let e=this.#t.document,{captions:t,cells:n}=this.#n(),i=e.createElement("iframe");i.className="gramlot-grid-print",i.setAttribute("aria-hidden","true"),i.style.cssText="position:fixed;inset-inline-start:-10000px;inline-size:1px;block-size:1px;border:0",e.body.append(i);let s=i.contentDocument,o=s.createElement("table"),a=s.createElement("thead"),l=s.createElement("tbody"),u=(d,f,h)=>{let p=s.createElement("tr");for(let m of f){let g=s.createElement(h);g.textContent=m,p.append(g)}d.append(p)};u(a,t,"th");for(let d of n)u(l,d,"td");o.append(a,l);let c=s.createElement("style");c.textContent="table{border-collapse:collapse;font:12px sans-serif}th,td{border:1px solid #888;padding:2px 6px;text-align:start}",s.head.append(c),s.body.append(o),i.contentWindow.addEventListener("afterprint",()=>i.remove()),i.contentWindow.print()}toggleLineNumbers(){let e=!this.#t.parameters().rowHeaders;this.source.pointerType(this.source.getAttr("rowHeaders"))?this.#e.writeParameter("rowHeaders",e):this.source.setAttr({rowHeaders:e})}addRow(e){let{bag:t,mode:n}=this.#t.store(),i=`r_${crypto.randomUUID().replaceAll("-","")}`;return n==="values"?t.setItem(i,new Kt(e)):t.setItem(i,null,e),t.getNode(i)}duplicateRows(){let{bag:e,mode:t}=this.#t.store();for(let n of this.#t.selected()){let i=`r_${crypto.randomUUID().replaceAll("-","")}`;t==="values"?e.setItem(i,n.staticValue.deepcopy()):e.setItem(i,null,{...n.getAttr()})}}deleteRows(){let{bag:e}=this.#t.store();for(let t of this.#t.selected())e.popNode(t.label)}requireEditableTools(e){let t=e.some(o=>o.edit),n=this.#t.selectionMode()!=="none";if(t&&n)return;let i=this.source.parentNode;for(;i&&i.nodeTag!=="framePane";)i=i.parentNode;if(!i)return;let s=o=>{if(o.nodeTag==="framePane")return;let a=o.nodeTag==="menuline"?o.getAttr("command"):null;if(!t&&xh.has(a))throw new TypeError(`grid tool '${a}' requires an editable column`);if(!n&&Ah.has(a))throw new TypeError(`grid tool '${a}' requires selectionMode single or multi`);if(!t&&o.nodeTag==="editingStatus")throw new TypeError("grid editing status requires an editable column");if(o.value instanceof Kt)for(let l of o.value.getNodes())s(l)};for(let o of i.value.getNodes())s(o)}};import{Bag as bl}from"@gramlot/gramlot";var wl=Object.freeze(["none","single","multi"]),_l=["selectedId","selectedIndex","selectedLabel","selectedPkeys","selectedRowidx","selectedNodes","selectedRowData"],Qn=class{#e;#t;#i=new Set;#n=null;#r=null;constructor(e,t){this.#e=e,this.#t=t}get source(){return this.#e.sourceNode}get mode(){return this.#t.mode()}get current(){return this.#n}isSelected(e){return this.#i.has(e)}get nodes(){return this.#t.view().getRows().filter(e=>this.#i.has(e))}select(e,{toggle:t=!1,range:n=!1}={}){if(this.mode==="none")return;let i=this.#t.view().getRows();if(this.mode==="multi"&&n&&this.#r!==null&&i.includes(this.#r)){let[s,o]=[i.indexOf(this.#r),i.indexOf(e)].sort((a,l)=>a-l);this.#s(new Set(i.slice(s,o+1)),e,this.#r)}else if(this.mode==="multi"&&t){let s=new Set(this.#i);s.has(e)?s.delete(e):s.add(e),this.#s(s,s.has(e)?e:this.nodes.find(o=>s.has(o))??null,e)}else this.#s(new Set([e]),e,e)}move(e,t=!1){if(this.mode==="none")return null;let n=this.#t.view().getRows();if(!n.length)return null;let i=this.#n===null?e>0?-1:n.length:n.indexOf(this.#n),s=n[Math.max(0,Math.min(n.length-1,i+e))];return this.select(s,{range:t}),s}selectAll(){if(this.mode!=="multi")return;let e=this.#t.view().getRows();this.#s(new Set(e),this.#n??e[0]??null,this.#r??e[0]??null)}prune(){let e=new Set(this.mode==="none"?[]:this.#t.view().getRows());if([...this.#i].every(n=>e.has(n))&&(this.#n===null||e.has(this.#n)))return;let t=new Set([...this.#i].filter(n=>e.has(n)));this.#s(t,e.has(this.#n)?this.#n:null,e.has(this.#r)?this.#r:null)}get#l(){return this.source.attributeOwnerNode("datapath")!==null}paths(){let t=Object.keys(this.source.getAttr()).filter(n=>_l.includes(n)||n.startsWith("selected_")).map(n=>this.source.absDatapath(this.source.getAttr(n)));return this.#l?[this.source.absDatapath(".selectionLength"),...t]:t}#s(e,t,n){this.#i=e,this.#n=t,this.#r=n,this.publish()}publish(){let e=this.#t.store(),t=this.#t.view(),n=this.nodes,i=this.#n,s=i===null?-1:t.getRows().indexOf(i),o=i===null?null:i.label,a=n.map(c=>c.label),l=e.getRows(),u={selectedId:o,selectedIndex:s<0?null:s,selectedLabel:o,selectedPkeys:a,selectedRowidx:n.map(c=>l.indexOf(c)).join(","),selectedNodes:()=>{let c=new bl;for(let d of n)c.setItem(d.label,null,this.#t.rowData(d));return c},selectedRowData:()=>i===null?null:new bl(this.#t.rowData(i))};for(let c of _l){if(this.source.getAttr(c)==null)continue;let d=typeof u[c]=="function"?u[c]():u[c];this.#e.writeParameter(c,d),c==="selectedNodes"&&this.source.rootBuilder.binding.data.getNode(this.source.absDatapath(this.source.getAttr(c))).setAttr({count:n.length})}for(let c of Object.keys(this.source.getAttr())){if(!c.startsWith("selected_"))continue;let d=c.slice(9);this.#e.writeParameter(c,[...new Set(n.map(f=>e.value(f,d)))].join(","))}this.#l&&this.source.getRelativeData(".selectionLength")!==n.length&&this.source.setRelativeData(".selectionLength",n.length),this.#e.publish("onSelectedRow",{idx:s,selectedId:o,selectedPkeys:a})}};var ei=class{#e;#t;#i;#n;#r;#l;#s=!1;#a=null;#o=null;constructor(e,t,n,i,s,o){this.#e=e,this.#t=t,this.#i=n,this.#n=i,this.#r=s,this.#l=o}connect(){this.#e.addEventListener("click",this.#c),this.#e.addEventListener("pointerdown",this.#E),this.#e.addEventListener("pointermove",this.#k),this.#e.addEventListener("pointerup",this.#_),this.#e.addEventListener("pointercancel",this.#w),this.#e.addEventListener("lostpointercapture",this.#w),this.#e.addEventListener("keydown",this.#p),this.#e.addEventListener("dragstart",this.#x),this.#e.addEventListener("dragover",this.#y),this.#e.addEventListener("drop",this.#d),this.#e.addEventListener("dragend",this.#b)}disconnect(){this.cancel(),this.#e.removeEventListener("click",this.#c),this.#e.removeEventListener("pointerdown",this.#E),this.#e.removeEventListener("pointermove",this.#k),this.#e.removeEventListener("pointerup",this.#_),this.#e.removeEventListener("pointercancel",this.#w),this.#e.removeEventListener("lostpointercapture",this.#w),this.#e.removeEventListener("keydown",this.#p),this.#e.removeEventListener("dragstart",this.#x),this.#e.removeEventListener("dragover",this.#y),this.#e.removeEventListener("drop",this.#d),this.#e.removeEventListener("dragend",this.#b)}#c=e=>{if(this.#s){this.#s=!1;return}if(e.target.closest(".column-resize, .column-filter"))return;let t=e.target.closest("th[data-field]");t&&this.#n(t.dataset.field,e.shiftKey)};#x=e=>{if(e.target.closest(".column-filter")){e.preventDefault();return}let t=e.target.closest("th[data-field]");if(!t||this.#a){e.preventDefault();return}this.#s=!0,this.#o={field:t.dataset.field,node:this.#i().columnNode(t.dataset.field)},e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.textContent),t.classList.add("column-dragging")};#v(e){let t=e.target.closest("th[data-field]");if(!this.#o||!t)return null;let n=this.#i().columnNode(t.dataset.field);return this.#i().columnNode(this.#o.field)!==this.#o.node||n===this.#o.node||n.parentBag!==this.#o.node.parentBag?null:{header:t,field:t.dataset.field,after:e.clientX>t.getBoundingClientRect().left+t.getBoundingClientRect().width/2}}#y=e=>{let t=this.#v(e);for(let n of this.#e.querySelectorAll("[data-drop]"))n.removeAttribute("data-drop");t&&(e.preventDefault(),e.dataTransfer.dropEffect="move",t.header.dataset.drop=t.after?"after":"before")};#d=e=>{let t=this.#v(e);if(!t)return;e.preventDefault();let n=this.#o.field;this.#b(),this.#i().moveColumn(n,t.field,t.after),this.#e.querySelector(`th[data-field="${n}"]`).focus({preventScroll:!0})};#b=()=>{this.#o=null;for(let e of this.#e.querySelectorAll("th"))e.classList.remove("column-dragging"),e.removeAttribute("data-drop")};#f(e){let t=e.dataset.field;if(t===void 0){let s=this.#r();return{identity:s,width:s.headerWidth,setWidth:o=>{s.setHeaderWidth(o),this.#l()}}}let n=this.#i(),i=n.columnNode(t);return{identity:i,width:i.getAttr("width"),setWidth:s=>n.setColumnWidth(t,s)}}#h(e){return e.classList.contains("row-heading")?Math.max(40,Math.ceil(e.querySelector(".row-number-measure").getBoundingClientRect().width)):Number.parseFloat(this.#t.ownerDocument.defaultView.getComputedStyle(this.#t).getPropertyValue("--gramlot-grid-column-min-width"))||40}#E=e=>{this.#s=!1;let t=e.target.closest(".column-resize");if(!t||e.button!==0||this.#a)return;let n=t.closest("th"),i=n.dataset.field,s=this.#f(n),o=[...this.#t.querySelectorAll("table")],a=[...this.#e.querySelectorAll("th[scope=col]")],l=a.map(u=>u.getBoundingClientRect().width);this.#a={pointerId:e.pointerId,field:i,header:n,identity:s.identity,originalWidth:s.width,x:e.clientX,index:a.indexOf(n),widths:l,width:n.getBoundingClientRect().width,tables:o.map(u=>({table:u,width:u.style.width,columns:[...u.querySelectorAll("col")].map(c=>({col:c,width:c.style.width}))}))},this.#e.setPointerCapture(e.pointerId),this.#t.classList.add("resizing"),e.preventDefault()};#k=e=>{let t=this.#a;if(!t||t.pointerId!==e.pointerId)return;t.width=Math.max(this.#h(t.header),Math.round(t.widths[t.index]+e.clientX-t.x));let n=t.widths.map((i,s)=>s===t.index?t.width:i);for(let{table:i,columns:s}of t.tables)i.style.width=`${n.reduce((o,a)=>o+a,0)}px`,s.forEach(({col:o},a)=>{o.style.width=`${n[a]}px`})};#_=e=>{let t=this.#a;if(!t||t.pointerId!==e.pointerId)return;this.#k(e);let n=this.#f(t.header);this.#s=!0,this.cancel(),!(n.identity!==t.identity||n.width!==t.originalWidth)&&(n.setWidth(t.width),this.#A(t.field))};#p=e=>{if(e.target.closest(".column-filter"))return;if(e.key==="Escape"&&this.#a){this.cancel(),e.preventDefault();return}let t=e.target.closest(".column-resize");if(!t&&["Enter"," "].includes(e.key)){let s=e.target.closest("th[data-field]");s&&(e.preventDefault(),this.#n(s.dataset.field,e.shiftKey));return}if(!["ArrowLeft","ArrowRight"].includes(e.key))return;if(!t){let s=e.target.closest("th[data-field]");if(!s||!e.altKey)return;let o=s.dataset.field,a=this.#i(),l=a.columnNode(o),u=l.parentBag.getNodes(),c=u[u.indexOf(l)+(e.key==="ArrowRight"?1:-1)];c?.getAttr("tag")==="cell"&&(a.moveColumn(o,c.getAttr("field"),e.key==="ArrowRight"),this.#e.querySelector(`th[data-field="${o}"]`).focus({preventScroll:!0})),e.preventDefault();return}let n=t.closest("th"),i=(e.key==="ArrowRight"?1:-1)*(e.shiftKey?1:10);this.#f(n).setWidth(Math.max(this.#h(n),Math.round(n.getBoundingClientRect().width+i))),this.#A(n.dataset.field),e.preventDefault()};#A(e){this.#e.querySelector(e===void 0?".row-heading .column-resize":`th[data-field="${e}"] .column-resize`).focus({preventScroll:!0})}#w=()=>{this.#a&&this.cancel()};cancel(){this.#b();let e=this.#a;if(e){this.#a=null;for(let{table:t,width:n,columns:i}of e.tables){t.style.width=n;for(let{col:s,width:o}of i)s.style.width=o}this.#t.classList.remove("resizing"),this.#e.hasPointerCapture(e.pointerId)&&this.#e.releasePointerCapture(e.pointerId)}}};var ti=class{#e;#t=null;setWindow(e){if(e!==null&&(!Number.isSafeInteger(e.start)||e.start<0||!Number.isSafeInteger(e.total)||e.total<e.start))throw new TypeError("Invalid grid window");this.#t=e,this.#a=!0}#i=null;get headerWidth(){return this.#i}setHeaderWidth(e){if(!Number.isFinite(e)||e<=0)throw new TypeError("Grid row header width must be positive pixels");this.#i=Math.round(e)}#n=new Map;#r=new Map;#l=[];#s=[0];#a=!0;#o=32;bindStore(e){e!==this.#e&&(this.#n.clear(),this.resetMeasurements(),this.#e=e)}retain(e){let t=new Set(e);for(let n of[this.#n,this.#r])for(let i of n.keys())t.has(i)||n.delete(i);this.#a=!0}height(e){return this.#n.get(e)??null}setHeight(e,t){if(e.parentBag===this.#e){if(t===null)this.#n.delete(e);else{if(!Number.isFinite(t)||t<=0)throw new TypeError("Grid row height must be positive pixels");this.#n.set(e,Math.round(t))}this.forget(e)}}setRows(e){this.#l=e,this.#a=!0}resetMeasurements(){this.#r.clear(),this.#a=!0}forget(e){this.#r.delete(e),this.#a=!0}measure(e,t){return t<=0||this.#r.get(e)===t?!1:(this.#r.set(e,t),this.#a=!0,!0)}#c(){if(!this.#a)return;let e=1/0;for(let[t,n]of this.#r)this.#n.has(t)||(e=Math.min(e,n));e!==1/0&&(this.#o=e),this.#s=[0];for(let t of this.#l)this.#s.push(this.#s.at(-1)+(this.#r.get(t)??Math.max(this.#n.get(t)??0,this.#o)));this.#a=!1}offset(e){if(this.#c(),!this.#t)return this.#s[e];let t=e-this.#t.start;return t<=0?e*this.#o:t<=this.#l.length?this.#t.start*this.#o+this.#s[t]:e*this.#o+this.#s.at(-1)-this.#l.length*this.#o}get count(){return this.#t?.total??this.#l.length}get totalHeight(){return this.offset(this.count)}indexAt(e){this.#c();let t=0,n=this.count;for(;t<n;){let i=t+n>>>1;this.offset(i+1)<=e?t=i+1:n=i}return Math.min(t,Math.max(0,this.count-1))}window(e,t){this.#c();let n=Math.max(t,this.#o*8);return{start:this.indexAt(Math.max(0,e-n)),end:Math.min(this.count,this.indexAt(e+t+n)+1)}}};var ri=class{#e;#t;#i;#n;#r=null;#l=null;#s;#a;#o;constructor(e,t,n,i,s,o,a){this.#e=e,this.#t=t,this.#i=n,this.#n=i,this.#s=s,this.#a=o,this.#o=a}get resizing(){return this.#r!==null}connect(){this.#e.addEventListener("pointerdown",this.#k),this.#e.addEventListener("pointermove",this.#_),this.#e.addEventListener("pointerup",this.#p),this.#e.addEventListener("pointercancel",this.#D),this.#e.addEventListener("lostpointercapture",this.#D),this.#e.addEventListener("keydown",this.#A),this.#e.addEventListener("dblclick",this.#w),this.#e.addEventListener("dragstart",this.#c),this.#e.addEventListener("dragover",this.#y),this.#e.addEventListener("dragleave",this.#d),this.#e.addEventListener("drop",this.#b),this.#e.addEventListener("dragend",this.#f)}disconnect(){this.cancel(),this.cancelDrag(),this.#e.removeEventListener("pointerdown",this.#k),this.#e.removeEventListener("pointermove",this.#_),this.#e.removeEventListener("pointerup",this.#p),this.#e.removeEventListener("pointercancel",this.#D),this.#e.removeEventListener("lostpointercapture",this.#D),this.#e.removeEventListener("keydown",this.#A),this.#e.removeEventListener("dblclick",this.#w),this.#e.removeEventListener("dragstart",this.#c),this.#e.removeEventListener("dragover",this.#y),this.#e.removeEventListener("dragleave",this.#d),this.#e.removeEventListener("drop",this.#b),this.#e.removeEventListener("dragend",this.#f)}#c=e=>{let t=e.target.closest("tr"),n=this.#n(t);if(!this.#a()||!n||this.#r||e.target.closest(".row-height-handle")){e.preventDefault();return}this.#l={node:n,bag:this.#s().bag},e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",n.label),t.classList.add("row-dragging")};#x(e){if(!this.#l||!this.#a())return null;let{node:t,bag:n}=this.#l,i=e.target.closest("tr"),s=this.#n(i);if(!s||s===t||this.#s().bag!==n||t.parentBag!==n||s.parentBag!==n)return null;let o=i.getBoundingClientRect();return{row:i,target:s,after:e.clientY>o.top+o.height/2}}#v(){for(let e of this.#e.querySelectorAll("[data-row-drop]"))e.removeAttribute("data-row-drop")}#y=e=>{this.#v();let t=this.#x(e);t&&(e.preventDefault(),e.dataTransfer.dropEffect="move",t.row.dataset.rowDrop=t.after?"after":"before")};#d=e=>{this.#e.contains(e.relatedTarget)||this.#v()};#b=e=>{let t=this.#x(e);if(!t)return;e.preventDefault(),e.stopPropagation();let{node:n}=this.#l;this.cancelDrag(),this.#s().moveRow(n,t.target,t.after)};#f=()=>{this.cancelDrag()};cancelDrag(){this.#l=null,this.#v();for(let e of this.#e.querySelectorAll(".row-dragging"))e.classList.remove("row-dragging")}#h(e){let t=e.target.closest(".row-height-handle");if(!t)return null;let n=t.closest("tr"),i=this.#n(n);return i?{handle:t,row:n,node:i}:null}project(e,t){let n=this.#i().height(t);e.style.height=n===null?"":`${n}px`}#E(e){let t=e.querySelector(".row-height-handle");t&&t.setAttribute("aria-valuenow",String(Math.round(e.getBoundingClientRect().height))),this.#o()}#k=e=>{let t=this.#h(e);if(!t||e.button!==0||this.#r)return;let{row:n}=t,i=n.getBoundingClientRect().height,s=n.style.height;n.style.height="";let o=n.getBoundingClientRect().height;n.style.height=s,this.#r={...t,pointerId:e.pointerId,y:e.clientY,height:i,minimum:o,preview:i},t.handle.focus({preventScroll:!0}),t.handle.setPointerCapture(e.pointerId),this.#t.classList.add("resizing-row"),e.preventDefault()};#_=e=>{let t=this.#r;!t||t.pointerId!==e.pointerId||(t.preview=Math.max(t.minimum,Math.round(t.height+e.clientY-t.y)),t.row.style.height=`${t.preview}px`,this.#E(t.row))};#p=e=>{let t=this.#r;!t||t.pointerId!==e.pointerId||(this.#_(e),this.cancel(),!(this.#n(t.row)!==t.node||t.preview===t.height)&&(this.#i().setHeight(t.node,t.preview),this.project(t.row,t.node),this.#E(t.row)))};#A=e=>{if(e.key==="Escape"&&(this.#r||this.#l)){this.cancel(),this.cancelDrag(),e.preventDefault();return}let t=this.#h(e);if(!t||!["ArrowUp","ArrowDown","Home"].includes(e.key))return;this.cancel();let n=null;if(e.key!=="Home"){let i=t.row.getBoundingClientRect().height;t.row.style.height="";let s=t.row.getBoundingClientRect().height;n=Math.max(s,i+(e.key==="ArrowDown"?10:-10))}this.#i().setHeight(t.node,n),this.project(t.row,t.node),this.#E(t.row),e.preventDefault()};#w=e=>{let t=this.#h(e);t&&(this.cancel(),this.#i().setHeight(t.node,null),this.project(t.row,t.node),this.#E(t.row),e.preventDefault())};#D=()=>{this.cancel()};cancel(){let e=this.#r;e&&(this.#r=null,this.project(e.row,e.node),this.#t.classList.remove("resizing-row"),e.handle.hasPointerCapture(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId))}};var yl=`
|
|
6
|
+
`}#i(){let t=this.#e.columns().filter(i=>!i.check),e=this.#e.reader();return{columns:t,rows:this.#e.rows().map(i=>[i,t.map(r=>e.value(i,r.field)??null)])}}rowsBag(){let{columns:t,rows:e}=this.#i(),i=new T,r=this.#e.store().mode==="values";for(let[s,o]of e){let n=Object.fromEntries(t.map((a,d)=>[a.field,o[d]]));r?i.setItem(s.label,new T(n)):i.setItem(s.label,null,n)}return i}xml(){let t=new T;return t.setItem("GenRoBag",this.rowsBag()),t.toXml({docHeader:!0})}json(){let{columns:t,rows:e}=this.#i();return JSON.stringify(e.map(([,i])=>new T(Object.fromEntries(t.map((r,s)=>[r.field,i[s]]))).asDict(!1,!1,!0)),null,2)}async xlsx(){let{columns:t,rows:e}=this.#i(),i=(await(Gt??=ct("writeExcelFile",this.#e.document,()=>import("./modules/browser-Y2BRNI3P.js")))).default,r=(n,a)=>n===null?null:z(n)?Number(n.toString()):n instanceof Date?{value:n,type:Date,format:["DH","DHZ"].includes(a.dtype)?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd"}:["number","boolean","string"].includes(typeof n)?n:String(n),o=[t.map(n=>({value:n.name,fontWeight:"bold"})),...e.map(([,n])=>n.map((a,d)=>r(a,t[d])))];return i(o,{sheet:this.source.label,stickyRowsCount:1}).toBlob()}async exportRows(t){let e=ht[t];if(!e)throw new TypeError(`grid export format must be one of ${Object.keys(ht).join(", ")}`);let i=t==="csv"?this.csv():t==="json"?this.json():t==="tytx"?this.rowsBag().toTytx():t==="xml"?this.xml():await this.xlsx();this.runtime.gramlot.utl.inout.saveText(i,`${this.source.label}.${e.extension}`,e.type)}printRows(){let t=this.#e.document,{captions:e,cells:i}=this.#o(),r=t.createElement("iframe");r.className="gramlot-grid-print",r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;inset-inline-start:-10000px;inline-size:1px;block-size:1px;border:0",t.body.append(r);let s=r.contentDocument,o=s.createElement("table"),n=s.createElement("thead"),a=s.createElement("tbody"),d=(p,m,h)=>{let u=s.createElement("tr");for(let f of m){let g=s.createElement(h);g.textContent=f,u.append(g)}p.append(u)};d(n,e,"th");for(let p of i)d(a,p,"td");o.append(n,a);let l=s.createElement("style");l.textContent="table{border-collapse:collapse;font:12px sans-serif}th,td{border:1px solid #888;padding:2px 6px;text-align:start}",s.head.append(l),s.body.append(o),r.contentWindow.addEventListener("afterprint",()=>r.remove()),r.contentWindow.print()}toggleLineNumbers(){let t=!this.#e.parameters().rowHeaders;this.source.pointerType(this.source.getAttr("rowHeaders"))?this.#t.writeParameter("rowHeaders",t):this.source.setAttr({rowHeaders:t})}addRow(t){let{bag:e,mode:i}=this.#e.store(),r=`r_${crypto.randomUUID().replaceAll("-","")}`;return i==="values"?e.setItem(r,new T(t)):e.setItem(r,null,t),e.getNode(r)}duplicateRows(){let{bag:t,mode:e}=this.#e.store();for(let i of this.#e.selected()){let r=`r_${crypto.randomUUID().replaceAll("-","")}`;e==="values"?t.setItem(r,i.staticValue.deepcopy()):t.setItem(r,null,{...i.getAttr()})}}deleteRows(){let{bag:t}=this.#e.store();for(let e of this.#e.selected())t.popNode(e.label)}requireEditableTools(t){let e=t.some(o=>o.edit),i=this.#e.selectionMode()!=="none";if(e&&i)return;let r=this.source.parentNode;for(;r&&r.nodeTag!=="framePane";)r=r.parentNode;if(!r)return;let s=o=>{if(o.nodeTag==="framePane")return;let n=o.nodeTag==="menuline"?o.getAttr("command"):null;if(!e&&Kt.has(n))throw new TypeError(`grid tool '${n}' requires an editable column`);if(!i&&Zt.has(n))throw new TypeError(`grid tool '${n}' requires selectionMode single or multi`);if(!e&&o.nodeTag==="editingStatus")throw new TypeError("grid editing status requires an editable column");if(o.value instanceof T)for(let a of o.value.getNodes())s(a)};for(let o of r.value.getNodes())s(o)}};import{Bag as pt}from"@gramlot/gramlot";var mt=Object.freeze(["none","single","multi"]),ft=["selectedId","selectedIndex","selectedLabel","selectedPkeys","selectedRowidx","selectedNodes","selectedRowData"],V=class{#t;#e;#s=new Set;#o=null;#i=null;constructor(t,e){this.#t=t,this.#e=e}get source(){return this.#t.sourceNode}get mode(){return this.#e.mode()}get current(){return this.#o}isSelected(t){return this.#s.has(t)}get nodes(){return this.#e.view().getRows().filter(t=>this.#s.has(t))}select(t,{toggle:e=!1,range:i=!1}={}){if(this.mode==="none")return;let r=this.#e.view().getRows();if(this.mode==="multi"&&i&&this.#i!==null&&r.includes(this.#i)){let[s,o]=[r.indexOf(this.#i),r.indexOf(t)].sort((n,a)=>n-a);this.#r(new Set(r.slice(s,o+1)),t,this.#i)}else if(this.mode==="multi"&&e){let s=new Set(this.#s);s.has(t)?s.delete(t):s.add(t),this.#r(s,s.has(t)?t:this.nodes.find(o=>s.has(o))??null,t)}else this.#r(new Set([t]),t,t)}move(t,e=!1){if(this.mode==="none")return null;let i=this.#e.view().getRows();if(!i.length)return null;let r=this.#o===null?t>0?-1:i.length:i.indexOf(this.#o),s=i[Math.max(0,Math.min(i.length-1,r+t))];return this.select(s,{range:e}),s}selectAll(){if(this.mode!=="multi")return;let t=this.#e.view().getRows();this.#r(new Set(t),this.#o??t[0]??null,this.#i??t[0]??null)}prune(){let t=new Set(this.mode==="none"?[]:this.#e.view().getRows());if([...this.#s].every(i=>t.has(i))&&(this.#o===null||t.has(this.#o)))return;let e=new Set([...this.#s].filter(i=>t.has(i)));this.#r(e,t.has(this.#o)?this.#o:null,t.has(this.#i)?this.#i:null)}get#l(){return this.source.attributeOwnerNode("datapath")!==null}paths(){let e=Object.keys(this.source.getAttr()).filter(i=>ft.includes(i)||i.startsWith("selected_")).map(i=>this.source.absDatapath(this.source.getAttr(i)));return this.#l?[this.source.absDatapath(".selectionLength"),...e]:e}#r(t,e,i){this.#s=t,this.#o=e,this.#i=i,this.publish()}publish(){let t=this.#e.store(),e=this.#e.view(),i=this.nodes,r=this.#o,s=r===null?-1:e.getRows().indexOf(r),o=r===null?null:r.label,n=i.map(l=>l.label),a=t.getRows(),d={selectedId:o,selectedIndex:s<0?null:s,selectedLabel:o,selectedPkeys:n,selectedRowidx:i.map(l=>a.indexOf(l)).join(","),selectedNodes:()=>{let l=new pt;for(let p of i)l.setItem(p.label,null,this.#e.rowData(p));return l},selectedRowData:()=>r===null?null:new pt(this.#e.rowData(r))};for(let l of ft){if(this.source.getAttr(l)==null)continue;let p=typeof d[l]=="function"?d[l]():d[l];this.#t.writeParameter(l,p),l==="selectedNodes"&&this.source.rootBuilder.binding.data.getNode(this.source.absDatapath(this.source.getAttr(l))).setAttr({count:i.length})}for(let l of Object.keys(this.source.getAttr())){if(!l.startsWith("selected_"))continue;let p=l.slice(9);this.#t.writeParameter(l,[...new Set(i.map(m=>t.value(m,p)))].join(","))}this.#l&&this.source.getRelativeData(".selectionLength")!==i.length&&this.source.setRelativeData(".selectionLength",i.length),this.#t.publish("onSelectedRow",{idx:s,selectedId:o,selectedPkeys:n})}};var P=class{#t;#e;#s;#o;#i;#l;#r=!1;#a=null;#n=null;constructor(t,e,i,r,s,o){this.#t=t,this.#e=e,this.#s=i,this.#o=r,this.#i=s,this.#l=o}connect(){this.#t.addEventListener("click",this.#h),this.#t.addEventListener("pointerdown",this.#E),this.#t.addEventListener("pointermove",this.#v),this.#t.addEventListener("pointerup",this.#b),this.#t.addEventListener("pointercancel",this.#w),this.#t.addEventListener("lostpointercapture",this.#w),this.#t.addEventListener("keydown",this.#f),this.#t.addEventListener("dragstart",this.#A),this.#t.addEventListener("dragover",this.#x),this.#t.addEventListener("drop",this.#c),this.#t.addEventListener("dragend",this.#y)}disconnect(){this.cancel(),this.#t.removeEventListener("click",this.#h),this.#t.removeEventListener("pointerdown",this.#E),this.#t.removeEventListener("pointermove",this.#v),this.#t.removeEventListener("pointerup",this.#b),this.#t.removeEventListener("pointercancel",this.#w),this.#t.removeEventListener("lostpointercapture",this.#w),this.#t.removeEventListener("keydown",this.#f),this.#t.removeEventListener("dragstart",this.#A),this.#t.removeEventListener("dragover",this.#x),this.#t.removeEventListener("drop",this.#c),this.#t.removeEventListener("dragend",this.#y)}#h=t=>{if(this.#r){this.#r=!1;return}if(t.target.closest(".column-resize, .column-filter"))return;let e=t.target.closest("th[data-field]");e&&this.#o(e.dataset.field,t.shiftKey)};#A=t=>{if(t.target.closest(".column-filter")){t.preventDefault();return}let e=t.target.closest("th[data-field]");if(!e||this.#a){t.preventDefault();return}this.#r=!0,this.#n={field:e.dataset.field,node:this.#s().columnNode(e.dataset.field)},t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e.textContent),e.classList.add("column-dragging")};#S(t){let e=t.target.closest("th[data-field]");if(!this.#n||!e)return null;let i=this.#s().columnNode(e.dataset.field);return this.#s().columnNode(this.#n.field)!==this.#n.node||i===this.#n.node||i.parentBag!==this.#n.node.parentBag?null:{header:e,field:e.dataset.field,after:t.clientX>e.getBoundingClientRect().left+e.getBoundingClientRect().width/2}}#x=t=>{let e=this.#S(t);for(let i of this.#t.querySelectorAll("[data-drop]"))i.removeAttribute("data-drop");e&&(t.preventDefault(),t.dataTransfer.dropEffect="move",e.header.dataset.drop=e.after?"after":"before")};#c=t=>{let e=this.#S(t);if(!e)return;t.preventDefault();let i=this.#n.field;this.#y(),this.#s().moveColumn(i,e.field,e.after),this.#t.querySelector(`th[data-field="${i}"]`).focus({preventScroll:!0})};#y=()=>{this.#n=null;for(let t of this.#t.querySelectorAll("th"))t.classList.remove("column-dragging"),t.removeAttribute("data-drop")};#u(t){let e=t.dataset.field;if(e===void 0){let s=this.#i();return{identity:s,width:s.headerWidth,setWidth:o=>{s.setHeaderWidth(o),this.#l()}}}let i=this.#s(),r=i.columnNode(e);return{identity:r,width:r.getAttr("width"),setWidth:s=>i.setColumnWidth(e,s)}}#p(t){return t.classList.contains("row-heading")?Math.max(40,Math.ceil(t.querySelector(".row-number-measure").getBoundingClientRect().width)):Number.parseFloat(this.#e.ownerDocument.defaultView.getComputedStyle(this.#e).getPropertyValue("--gramlot-grid-column-min-width"))||40}#E=t=>{this.#r=!1;let e=t.target.closest(".column-resize");if(!e||t.button!==0||this.#a)return;let i=e.closest("th"),r=i.dataset.field,s=this.#u(i),o=[...this.#e.querySelectorAll("table")],n=[...this.#t.querySelectorAll("th[scope=col]")],a=n.map(d=>d.getBoundingClientRect().width);this.#a={pointerId:t.pointerId,field:r,header:i,identity:s.identity,originalWidth:s.width,x:t.clientX,index:n.indexOf(i),widths:a,width:i.getBoundingClientRect().width,tables:o.map(d=>({table:d,width:d.style.width,columns:[...d.querySelectorAll("col")].map(l=>({col:l,width:l.style.width}))}))},this.#t.setPointerCapture(t.pointerId),this.#e.classList.add("resizing"),t.preventDefault()};#v=t=>{let e=this.#a;if(!e||e.pointerId!==t.pointerId)return;e.width=Math.max(this.#p(e.header),Math.round(e.widths[e.index]+t.clientX-e.x));let i=e.widths.map((r,s)=>s===e.index?e.width:r);for(let{table:r,columns:s}of e.tables)r.style.width=`${i.reduce((o,n)=>o+n,0)}px`,s.forEach(({col:o},n)=>{o.style.width=`${i[n]}px`})};#b=t=>{let e=this.#a;if(!e||e.pointerId!==t.pointerId)return;this.#v(t);let i=this.#u(e.header);this.#r=!0,this.cancel(),!(i.identity!==e.identity||i.width!==e.originalWidth)&&(i.setWidth(e.width),this.#k(e.field))};#f=t=>{if(t.target.closest(".column-filter"))return;if(t.key==="Escape"&&this.#a){this.cancel(),t.preventDefault();return}let e=t.target.closest(".column-resize");if(!e&&["Enter"," "].includes(t.key)){let s=t.target.closest("th[data-field]");s&&(t.preventDefault(),this.#o(s.dataset.field,t.shiftKey));return}if(!["ArrowLeft","ArrowRight"].includes(t.key))return;if(!e){let s=t.target.closest("th[data-field]");if(!s||!t.altKey)return;let o=s.dataset.field,n=this.#s(),a=n.columnNode(o),d=a.parentBag.getNodes(),l=d[d.indexOf(a)+(t.key==="ArrowRight"?1:-1)];l?.getAttr("tag")==="cell"&&(n.moveColumn(o,l.getAttr("field"),t.key==="ArrowRight"),this.#t.querySelector(`th[data-field="${o}"]`).focus({preventScroll:!0})),t.preventDefault();return}let i=e.closest("th"),r=(t.key==="ArrowRight"?1:-1)*(t.shiftKey?1:10);this.#u(i).setWidth(Math.max(this.#p(i),Math.round(i.getBoundingClientRect().width+r))),this.#k(i.dataset.field),t.preventDefault()};#k(t){this.#t.querySelector(t===void 0?".row-heading .column-resize":`th[data-field="${t}"] .column-resize`).focus({preventScroll:!0})}#w=()=>{this.#a&&this.cancel()};cancel(){this.#y();let t=this.#a;if(t){this.#a=null;for(let{table:e,width:i,columns:r}of t.tables){e.style.width=i;for(let{col:s,width:o}of r)s.style.width=o}this.#e.classList.remove("resizing"),this.#t.hasPointerCapture(t.pointerId)&&this.#t.releasePointerCapture(t.pointerId)}}};var O=class{#t;#e=null;setWindow(t){if(t!==null&&(!Number.isSafeInteger(t.start)||t.start<0||!Number.isSafeInteger(t.total)||t.total<t.start))throw new TypeError("Invalid grid window");this.#e=t,this.#a=!0}#s=null;get headerWidth(){return this.#s}setHeaderWidth(t){if(!Number.isFinite(t)||t<=0)throw new TypeError("Grid row header width must be positive pixels");this.#s=Math.round(t)}#o=new Map;#i=new Map;#l=[];#r=[0];#a=!0;#n=32;bindStore(t){t!==this.#t&&(this.#o.clear(),this.resetMeasurements(),this.#t=t)}retain(t){let e=new Set(t);for(let i of[this.#o,this.#i])for(let r of i.keys())e.has(r)||i.delete(r);this.#a=!0}height(t){return this.#o.get(t)??null}setHeight(t,e){if(t.parentBag===this.#t){if(e===null)this.#o.delete(t);else{if(!Number.isFinite(e)||e<=0)throw new TypeError("Grid row height must be positive pixels");this.#o.set(t,Math.round(e))}this.forget(t)}}setRows(t){this.#l=t,this.#a=!0}resetMeasurements(){this.#i.clear(),this.#a=!0}forget(t){this.#i.delete(t),this.#a=!0}measure(t,e){return e<=0||this.#i.get(t)===e?!1:(this.#i.set(t,e),this.#a=!0,!0)}#h(){if(!this.#a)return;let t=1/0;for(let[e,i]of this.#i)this.#o.has(e)||(t=Math.min(t,i));t!==1/0&&(this.#n=t),this.#r=[0];for(let e of this.#l)this.#r.push(this.#r.at(-1)+(this.#i.get(e)??Math.max(this.#o.get(e)??0,this.#n)));this.#a=!1}offset(t){if(this.#h(),!this.#e)return this.#r[t];let e=t-this.#e.start;return e<=0?t*this.#n:e<=this.#l.length?this.#e.start*this.#n+this.#r[e]:t*this.#n+this.#r.at(-1)-this.#l.length*this.#n}get count(){return this.#e?.total??this.#l.length}get totalHeight(){return this.offset(this.count)}indexAt(t){this.#h();let e=0,i=this.count;for(;e<i;){let r=e+i>>>1;this.offset(r+1)<=t?e=r+1:i=r}return Math.min(e,Math.max(0,this.count-1))}window(t,e){this.#h();let i=Math.max(e,this.#n*8);return{start:this.indexAt(Math.max(0,t-i)),end:Math.min(this.count,this.indexAt(t+e+i)+1)}}};var G=class{#t;#e;#s;#o;#i=null;#l=null;#r;#a;#n;constructor(t,e,i,r,s,o,n){this.#t=t,this.#e=e,this.#s=i,this.#o=r,this.#r=s,this.#a=o,this.#n=n}get resizing(){return this.#i!==null}connect(){this.#t.addEventListener("pointerdown",this.#v),this.#t.addEventListener("pointermove",this.#b),this.#t.addEventListener("pointerup",this.#f),this.#t.addEventListener("pointercancel",this.#T),this.#t.addEventListener("lostpointercapture",this.#T),this.#t.addEventListener("keydown",this.#k),this.#t.addEventListener("dblclick",this.#w),this.#t.addEventListener("dragstart",this.#h),this.#t.addEventListener("dragover",this.#x),this.#t.addEventListener("dragleave",this.#c),this.#t.addEventListener("drop",this.#y),this.#t.addEventListener("dragend",this.#u)}disconnect(){this.cancel(),this.cancelDrag(),this.#t.removeEventListener("pointerdown",this.#v),this.#t.removeEventListener("pointermove",this.#b),this.#t.removeEventListener("pointerup",this.#f),this.#t.removeEventListener("pointercancel",this.#T),this.#t.removeEventListener("lostpointercapture",this.#T),this.#t.removeEventListener("keydown",this.#k),this.#t.removeEventListener("dblclick",this.#w),this.#t.removeEventListener("dragstart",this.#h),this.#t.removeEventListener("dragover",this.#x),this.#t.removeEventListener("dragleave",this.#c),this.#t.removeEventListener("drop",this.#y),this.#t.removeEventListener("dragend",this.#u)}#h=t=>{let e=t.target.closest("tr"),i=this.#o(e);if(!this.#a()||!i||this.#i||t.target.closest(".row-height-handle")){t.preventDefault();return}this.#l={node:i,bag:this.#r().bag},t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",i.label),e.classList.add("row-dragging")};#A(t){if(!this.#l||!this.#a())return null;let{node:e,bag:i}=this.#l,r=t.target.closest("tr"),s=this.#o(r);if(!s||s===e||this.#r().bag!==i||e.parentBag!==i||s.parentBag!==i)return null;let o=r.getBoundingClientRect();return{row:r,target:s,after:t.clientY>o.top+o.height/2}}#S(){for(let t of this.#t.querySelectorAll("[data-row-drop]"))t.removeAttribute("data-row-drop")}#x=t=>{this.#S();let e=this.#A(t);e&&(t.preventDefault(),t.dataTransfer.dropEffect="move",e.row.dataset.rowDrop=e.after?"after":"before")};#c=t=>{this.#t.contains(t.relatedTarget)||this.#S()};#y=t=>{let e=this.#A(t);if(!e)return;t.preventDefault(),t.stopPropagation();let{node:i}=this.#l;this.cancelDrag(),this.#r().moveRow(i,e.target,e.after)};#u=()=>{this.cancelDrag()};cancelDrag(){this.#l=null,this.#S();for(let t of this.#t.querySelectorAll(".row-dragging"))t.classList.remove("row-dragging")}#p(t){let e=t.target.closest(".row-height-handle");if(!e)return null;let i=e.closest("tr"),r=this.#o(i);return r?{handle:e,row:i,node:r}:null}project(t,e){let i=this.#s().height(e);t.style.height=i===null?"":`${i}px`}#E(t){let e=t.querySelector(".row-height-handle");e&&e.setAttribute("aria-valuenow",String(Math.round(t.getBoundingClientRect().height))),this.#n()}#v=t=>{let e=this.#p(t);if(!e||t.button!==0||this.#i)return;let{row:i}=e,r=i.getBoundingClientRect().height,s=i.style.height;i.style.height="";let o=i.getBoundingClientRect().height;i.style.height=s,this.#i={...e,pointerId:t.pointerId,y:t.clientY,height:r,minimum:o,preview:r},e.handle.focus({preventScroll:!0}),e.handle.setPointerCapture(t.pointerId),this.#e.classList.add("resizing-row"),t.preventDefault()};#b=t=>{let e=this.#i;!e||e.pointerId!==t.pointerId||(e.preview=Math.max(e.minimum,Math.round(e.height+t.clientY-e.y)),e.row.style.height=`${e.preview}px`,this.#E(e.row))};#f=t=>{let e=this.#i;!e||e.pointerId!==t.pointerId||(this.#b(t),this.cancel(),!(this.#o(e.row)!==e.node||e.preview===e.height)&&(this.#s().setHeight(e.node,e.preview),this.project(e.row,e.node),this.#E(e.row)))};#k=t=>{if(t.key==="Escape"&&(this.#i||this.#l)){this.cancel(),this.cancelDrag(),t.preventDefault();return}let e=this.#p(t);if(!e||!["ArrowUp","ArrowDown","Home"].includes(t.key))return;this.cancel();let i=null;if(t.key!=="Home"){let r=e.row.getBoundingClientRect().height;e.row.style.height="";let s=e.row.getBoundingClientRect().height;i=Math.max(s,r+(t.key==="ArrowDown"?10:-10))}this.#s().setHeight(e.node,i),this.project(e.row,e.node),this.#E(e.row),t.preventDefault()};#w=t=>{let e=this.#p(t);e&&(this.cancel(),this.#s().setHeight(e.node,null),this.project(e.row,e.node),this.#E(e.row),t.preventDefault())};#T=()=>{this.cancel()};cancel(){let t=this.#i;t&&(this.#i=null,this.project(t.row,t.node),this.#e.classList.remove("resizing-row"),t.handle.hasPointerCapture(t.pointerId)&&t.handle.releasePointerCapture(t.pointerId))}};var gt=`
|
|
29
7
|
.column-filter{position:absolute;inset-inline-end:8px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:inherit;cursor:pointer;padding:2px;margin-inline-start:4px;vertical-align:middle;line-height:0;opacity:.6}
|
|
30
8
|
th:has(.column-filter){padding-inline-end:28px}
|
|
31
9
|
.column-filter svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.5}
|
|
@@ -267,7 +245,7 @@ th:has(.column-filter){padding-inline-end:28px}
|
|
|
267
245
|
background: var(--gramlot-grid-filtered-numbering-background, var(--gramlot-warning-background, Mark));
|
|
268
246
|
}
|
|
269
247
|
.empty { text-align: center; color: var(--gramlot-text-secondary, GrayText); }
|
|
270
|
-
`;var
|
|
248
|
+
`;var Y=class{#t=new Set;view=null;#e;columns=[];update(t,e){if(!(this.view===t&&this.#e===t.bag&&this.columns===e)){this.view=t,this.#e=t.bag,this.columns=e;for(let i of this.#t)i()}}detach(t){if(this.view===t){this.view=null,this.#e=null,this.columns=[];for(let e of this.#t)e()}}subscribe(t){return this.#t.add(t),()=>this.#t.delete(t)}};function B(c){return Object.hasOwn(c,"gridSearch")||Object.defineProperty(c,"gridSearch",{value:new Y,configurable:!0}),c.gridSearch}function bt(c,t){if(c===!0||typeof c=="string"&&c.startsWith("*")){let e=c===!0?t:t.filter(i=>c.slice(1).includes(i.dtype??"T"));return e.length?[...e.length>1?[{field:e.map(i=>i.field).join("+"),name:"All columns"}]:[],...e.map(i=>({field:i.field,name:i.name}))]:[]}if(typeof c!="string"||!c.trim())throw new TypeError("searchOn requires true or a column list");return c.split(",").map(e=>{let i=e.trim().split(":"),r=i.at(-1),s=i.length===2?i[0]:t.find(o=>o.field===r)?.name;if(i.length>2||!r||r.split("+").some(o=>!t.some(n=>n.field===o)))throw new TypeError(`Unknown searchOn column: ${e}`);return{field:r,name:s??r}})}import{sharedModules as Xt}from"@gramlot/gramlot";var Yt=c=>Xt["./components/labelbox.js"][c],wt=Yt("Labelbox");var yt=".gramlot-search-labelbox{inline-size:var(--gramlot-search-width,240px);max-inline-size:100%;font-size:var(--gramlot-search-font-size,12px)}",vt=`
|
|
271
249
|
:host{display:inline-block;inline-size:100%;font-size:var(--gramlot-search-font-size,12px);max-inline-size:100%;min-inline-size:0}
|
|
272
250
|
.control-box{display:flex;align-items:stretch;position:relative;min-block-size:max(var(--gramlot-search-height,26px),var(--gramlot-touch-target,0px));
|
|
273
251
|
border:1px solid var(--gramlot-border,GrayText);border-radius:999px;
|
|
@@ -305,4 +283,4 @@ svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.7;stroke
|
|
|
305
283
|
box-shadow:var(--gramlot-shadow,0 3px 12px #0002);font:inherit;font-size:inherit;line-height:1.5}
|
|
306
284
|
.search-help p{margin:.6rem 0 0}.search-help p:last-child{color:var(--gramlot-text-secondary,GrayText)}
|
|
307
285
|
@media(prefers-reduced-motion:reduce){.control-box{transition:none}}
|
|
308
|
-
`;var Al=(0,_e.defineComponent)({name:"searchBox",tag:"gramlot-search-box",base:qr,sourceContext:!0,mixins:[ni],parameters:{lbl_position:{dtype:"T",default:"L",binding:"read"},searchLiteral:{dtype:"B",default:!1,binding:"read"},searchHelp:{dtype:"B",default:!1,binding:"read"},searchOn:{dtype:["B","T"],default:!0,binding:"read"},searchTime:{dtype:"R",nullable:!0,default:null,binding:"write"}},implementation:r=>class extends r{#e;#t;#i;#n;#r;#l=null;#s;#a;#o;#c;#x;#v;#y;constructor(){super();let e=this.ownerDocument,t=e.createElement("style");t.textContent=xl;let n=d=>{let f=e.createElementNS(xe,"svg");f.setAttribute("viewBox","0 0 24 24"),f.setAttribute("aria-hidden","true");let h=e.createElementNS(xe,"path");return h.setAttribute("d",d),f.append(h),f};this.#s=e.createElement("input"),this.#s.type="text",this.#s.setAttribute("role","searchbox"),this.#s.setAttribute("aria-label","Filter rows"),this.#s.setAttribute("aria-describedby","search-error"),this.#s.placeholder=" ";let i=e.createElement("button");i.type="button",i.title="Clear filter",i.setAttribute("aria-label","Clear filter"),i.append(n("M6 6L18 18M18 6L6 18")),this.#a=e.createElement("span"),this.#a.id="search-error",this.#a.className="error",this.#a.setAttribute("role","alert");let s=e.createElement("span");s.className="search-entry";let o=n("M21 21L16 16M18 10A8 8 0 1 1 2 10A8 8 0 0 1 18 10");o.classList.add("search-lens"),i.className="clear";let a=this.#o=e.createElement("button");a.type="button",a.className="info",a.hidden=!0,a.setAttribute("aria-label","Search instructions"),a.title="Search instructions",a.setAttribute("aria-haspopup","dialog"),a.setAttribute("aria-expanded","false"),a.setAttribute("aria-controls","search-help"),a.append(n("M21 12A9 9 0 1 1 3 12A9 9 0 0 1 21 12M12 11V17M12 7V7.1"));let l=this.#c=e.createElement("div");l.id="search-help",l.className="search-help",l.setAttribute("popover","auto"),l.setAttribute("role","dialog"),l.setAttribute("aria-label","Search instructions");let u=e.createElement("strong");u.textContent="Search instructions",this.#x=e.createElement("p");let c=e.createElement("p");c.textContent="Clear with \xD7 or Escape. Changing column clears the query. An incomplete expression keeps the last valid result.",l.append(u,this.#x,c),this.shadowRoot.append(l),a.addEventListener("click",()=>{l.matches(":popover-open")?l.hidePopover():(l.showPopover(),Wr(l,a,{align:"end"}))}),l.addEventListener("toggle",()=>a.setAttribute("aria-expanded",String(l.matches(":popover-open")))),s.append(o,this.#s,i,a),this.control.replaceChildren(s,this.#a),this.shadowRoot.append(t),this.#s.addEventListener("input",()=>{this.#d(),this.#l=e.defaultView.setTimeout(()=>{this.#l=null,this.#p()},100)}),this.#s.addEventListener("keydown",d=>{d.isComposing||(d.key==="Enter"&&(d.preventDefault(),this.#d(),this.#p()),d.key==="Escape"&&(d.preventDefault(),this.#_()))}),i.addEventListener("click",()=>{this.#_(),this.#s.focus()})}setLabelbox(e){super.setLabelbox(e),e.box.classList.add("gramlot-search-labelbox");let t=this.ownerDocument.createElement("style");t.textContent=El,e.box.prepend(t)}focus(e){this.#s.focus(e)}clear(){this.#_()}setSourceContext(e){this.#e=e;let t=e.frameRecipient();if(t?.nodeTag!=="grid")throw new TypeError("searchBox requires a FrameGrid target");this.#t=zr(t)}projectAttributes(e,t){let n=this.parameters?.lbl_value,i=super.projectAttributes(e,t),s=!this.#o.hidden;return this.#o.hidden=!this.parameters.searchHelp,s&&this.#o.hidden&&this.#c.matches(":popover-open")&&this.#c.hidePopover(),this.isConnected&&(this.#b(),n!=null&&n!==this.parameters.lbl_value&&this.#r?.filter?.columns.join("+")!==this.parameters.lbl_value&&this.#_()),i}connectedCallback(){this.#i=this.#t.subscribe(()=>this.#b()),this.#b()}disconnectedCallback(){this.#d(),this.#i?.(),this.#n?.(),this.#i=this.#n=null}#d(){this.#l!==null&&this.ownerDocument.defaultView.clearTimeout(this.#l),this.#l=null}#b(){try{this.#f()}catch(e){this.#s.disabled=!0,this.#a.textContent=e.message}}#f(){if(!this.#t.view)return;(this.#r!==this.#t.view||this.#y!==this.#t.view.bag||!this.#n)&&(this.#d(),this.#n?.(),this.#r=this.#t.view,this.#y=this.#r.bag,this.#v=void 0,this.#n=this.#r.subscribe(()=>this.#h()));let e=vl(this.parameters.searchOn,this.#t.columns),t=this.#e.sourceNode,n=e.map(({field:s,name:o})=>`${s}:${o}`).join(","),i=e.some(s=>s.field===this.parameters.lbl_value)?this.parameters.lbl_value:e[0]?.field??"";t.getAttr("lbl_values")!==n&&t.setAttr({lbl_values:n}),this.parameters.lbl_value!==i&&this.box.labelbox.choose(i),this.#s.disabled=!e.length,this.#h(),this.#k()}#h(){let e=this.#r.filter,t=JSON.stringify(e);this.#v!==t&&(this.#v=t,this.#d(),this.#s.value=e?.value??"",e&&this.parameters.lbl_value!==e.columns.join("+")&&this.box.labelbox.choose(e.columns.join("+")),this.#a.textContent="",this.#s.removeAttribute("aria-invalid"),this.#k())}#E(){let e=this.#t.columns.find(t=>t.field===this.parameters.lbl_value);return["L","R","N","D"].includes(e?.dtype)?e.dtype:"T"}#k(){let e=this.#E();this.#x.textContent=e==="T"?this.parameters.searchLiteral?"Type literal text to find it anywhere. Matching is case-insensitive.":"Type a word to find it anywhere. Text is case-insensitive. You can also use expressions: lamp|desk matches either word; ^lamp matches the start.":e==="D"?"Compare dates: = 2026-10-15, >= 2026-10-15 or < 2026-10-15. ISO dates and your browser\u2019s local date notation are accepted.":"Compare numbers: = 12, > 100, <= 50 or ! 0 (not equal). Decimal punctuation follows your browser locale."}#_(){this.#d(),this.#s.value="",this.#p(),this.#k()}#p(){if(this.#r)try{let e=this.#s.value,t=performance.now();this.#r.applyFilter(e.trim()?{value:e,columns:this.parameters.lbl_value.split("+"),dtype:this.#E(),...this.parameters.searchLiteral?{literal:!0}:{},locale:this.#e.locale,timeZone:this.#e.timeZone}:null),this.#e.writeParameter("searchTime",performance.now()-t),this.#a.textContent="",this.#s.removeAttribute("aria-invalid")}catch(e){this.#a.textContent=e.message,this.#s.setAttribute("aria-invalid","true")}}}});var Dl={elements:{struct:{doc:null,sub_tags:"column,colgroup",parent_tags:"grid",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0,gridStruct:!0}},column:{doc:null,sub_tags:"",parent_tags:"struct,colgroup",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[{name:"field",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[A-Za-z_][A-Za-z0-9_]*$",flags:0}]},has_default:!1},{name:"name",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"dtype",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(T|B|L|R|N|D|H|DHZ)$",flags:0}]},has_default:!0,default:null},{name:"width",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[0-9]+([.][0-9]+)?(px|em|rem|ch|%)$",flags:0}]},has_default:!0,default:null},{name:"max_height",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[0-9]+([.][0-9]+)?(px|em|rem)$",flags:0}]},has_default:!0,default:null},{name:"align",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(start|center|end)$",flags:0}]},has_default:!0,default:null},{name:"format",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"white_space",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(normal|nowrap|pre-wrap)$",flags:0}]},has_default:!0,default:null},{name:"edit",kind:"keyword_only",role:"attribute",annotation:{kind:"union",items:[{kind:"dtype",dtype:"B"},{kind:"type",module:"builtins",name:"dict"}]},has_default:!0,default:!1},{name:"check",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"checked",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"checkedField",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"title",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"formula",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"calculated",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"B"},has_default:!0,default:null},{name:"hidden",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"B"},has_default:!0,default:null},{name:"totalize",kind:"keyword_only",role:"attribute",annotation:{kind:"union",items:[{kind:"dtype",dtype:"B"},{kind:"dtype",dtype:"T"}]},has_default:!0,default:null},{name:"footer_value",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"footer_format",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},_meta:{data_element:!0,keywordPattern:"^formula_[A-Za-z_$][A-Za-z0-9_$]*$"}},colgroup:{doc:null,sub_tags:"column",parent_tags:"struct",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[{name:"code",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[A-Za-z_][A-Za-z0-9_]*$",flags:0}]},has_default:!1},{name:"name",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"background",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"color",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null}],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0}}}};var Sh=(0,_e.defineComponent)({name:"grid",tag:"gramlot-grid",base:qr,bagStore:!0,bagStruct:!0,sourceContext:!0,subTags:"struct,div",parameters:{columnFilters:{dtype:"B",default:!1,binding:"read"},setFilter:{dtype:"T",default:"",binding:"read"},windowInfo:{dtype:"X",nullable:!0,default:null,binding:"read"},loading:{dtype:"B",default:!1,binding:"read"},viewport:{dtype:"X",nullable:!0,default:null,binding:"write"},sortRequest:{dtype:"T",default:"",binding:"write"},storepath:{dtype:"T"},structpath:{dtype:"T"},rowMode:{dtype:"T"},rowHeaders:{dtype:"B",default:!1,binding:"read"},footer:{dtype:["B","T"],default:!1,binding:"read"},selectionMode:{dtype:"T",default:"multi",binding:"read"},selectedId:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedIndex:{dtype:"L",nullable:!0,default:null,binding:"write"},selectedLabel:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedPkeys:{dtype:"X",nullable:!0,default:null,binding:"write"},selectedRowidx:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedNodes:{dtype:"X",nullable:!0,default:null,binding:"write"},selectedRowData:{dtype:"X",nullable:!0,default:null,binding:"write"},rowResize:{dtype:"B",default:!1,binding:"read"},selfDragRows:{dtype:"B",default:!1,binding:"read"},sortedBy:{dtype:"T",default:"",binding:"read"},filter:{annotation:{kind:"type",module:"builtins",name:"dict"},nullable:!0,default:null,binding:"read"}},implementation:r=>class extends r{#e;#t;#i;#n;#r;#l;#s;#a=null;#o=null;#c;#x=e=>{let t=e.target.closest("tr[data-row]"),n=t&&[...this.#p].find(([,i])=>i===t)?.[0];if(!(!n||this.#c.mode==="none"))try{this.#c.select(n,{toggle:e.ctrlKey||e.metaKey,range:e.shiftKey}),this.#Q()}catch(i){this.#f.reportError(i,"Grid selection")}};#v=e=>{if(this.#c.mode==="none"||e.altKey)return;let t=(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="a",n={ArrowUp:-1,ArrowDown:1}[e.key];if(!(!t&&(n===void 0||e.ctrlKey||e.metaKey))){e.preventDefault();try{if(t)this.#c.selectAll();else{let i=e.target.closest?.("td[data-field]")?.dataset.field,s=this.#c.move(n,e.shiftKey);s&&this.#ye(s,i)}this.#Q()}catch(i){this.#f.reportError(i,"Grid selection")}}};#y=e=>{if(e.type==="keydown"&&!["Enter","F2"].includes(e.key))return;let t=e.target.closest("td[data-field]");if(!t||!this.#h)return;let n=[...this.#p].find(([,s])=>s===t.parentElement)?.[0],i=this.#h.columns.find(s=>s.field===t.dataset.field);if(n&&i.edit){e.preventDefault();try{this.#n.open(n,i,t)}catch(s){this.#f.reportError(s,"Grid editor")}}};#d;#b;#f;#h;#E;#k=!0;#_;#p=new Map;#A;#w;#D;#B;#N;#u;#S;#j;#L=null;#F=1;#T=!1;#z;#I;#m;#g;#te;#re;#$;#P=null;#q=!1;#U=new Set;#V=[];#X=-1;#Y=-1;#H;#W;#ne;#M=!1;#Z=null;#ie=e=>{e.target!==this.#u||!["Home","End"].includes(e.key)||!this.#h||(e.preventDefault(),this.#M=e.key==="End",this.#O(this.#M?Math.max(0,this.#m.totalHeight-this.#u.clientHeight):0),this.#R())};#se=()=>{let e=this.#u;e.scrollTop!==this.#Z&&(this.#M=e.scrollTop>0&&e.scrollHeight-e.clientHeight-e.scrollTop<=1),this.#Z=null,this.#N.scrollLeft=this.#u.scrollLeft,this.#l&&(this.#l.viewport.scrollLeft=this.#u.scrollLeft),this.#R()};constructor(){super();let e=this.ownerDocument,t=e.createElement("style");t.textContent=yl,this.control.setAttribute("role","table"),this.control.setAttribute("aria-label","Grid"),this.control.setAttribute("part","table");let n=e.createElement("div");n.className="header-frame",n.setAttribute("part","header"),this.#N=e.createElement("div"),this.#N.className="header-viewport",this.#N.setAttribute("part","header-viewport"),this.#u=e.createElement("div"),this.#u.className="body-viewport",this.#u.setAttribute("part","body-viewport"),this.#u.tabIndex=0,this.#u.setAttribute("role","rowgroup"),this.#D=e.createElement("table"),this.#B=e.createElement("table");for(let l of[this.#D,this.#B])l.setAttribute("role","presentation");this.#A=e.createElement("thead"),this.#A.setAttribute("role","rowgroup"),this.#w=e.createElement("tbody"),this.#w.setAttribute("role","presentation"),this.#D.append(this.#A),this.#B.append(this.#w),this.#N.append(this.#D),n.append(this.#N),this.#H=e.createElement("div"),this.#W=e.createElement("div");for(let l of[this.#H,this.#W])l.className="row-space",l.setAttribute("aria-hidden","true");this.#u.append(this.#H,this.#B,this.#W);let i=e.createElement("div");i.className="body-frame",this.#S=e.createElement("div"),this.#S.className="loading-status",this.#S.setAttribute("role","status"),this.#S.setAttribute("aria-label","Loading\u2026"),this.#S.hidden=!0;let s=e.createElementNS(xe,"svg");s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("aria-hidden","true");let o=e.createElementNS(xe,"circle");o.setAttribute("cx","12"),o.setAttribute("cy","12"),o.setAttribute("r","9"),o.setAttribute("opacity",".2");let a=e.createElementNS(xe,"path");a.setAttribute("d","M12 3a9 9 0 0 1 9 9"),s.append(o,a),this.#S.append(s),i.append(this.#u,this.#S),this.control.replaceChildren(n,i),this.shadowRoot.append(t),this.#i=new qn(this,this.#A),this.#z=new ei(this.#A,this.control,()=>this.#h,(l,u)=>this.#ke(l,u),()=>this.#m,()=>this.#R()),this.#I=new ri(this.#w,this.control,()=>this.#m,l=>{for(let[u,c]of this.#p)if(c===l)return u;return null},()=>this.#g,()=>this.parameters.selfDragRows,()=>this.#R()),this.#j=new e.defaultView.ResizeObserver(()=>this.#R())}connectedCallback(){this.#w.addEventListener("dblclick",this.#y),this.#w.addEventListener("keydown",this.#y),this.#w.addEventListener("click",this.#x),this.#u.addEventListener("keydown",this.#v),this.#n?.connect(),this.#t?.connect(),this.#s?.connect(),this.#i.connect(),this.#ce(),this.#g&&this.#K({full:!0,rows:[]}),this.#z.connect(),this.#I.connect(),this.#u.addEventListener("scroll",this.#se,{passive:!0}),this.#u.addEventListener("keydown",this.#ie),this.#j.observe(this.#u),this.#j.observe(this.#B),this.#R()}disconnectedCallback(){this.#w.removeEventListener("dblclick",this.#y),this.#w.removeEventListener("keydown",this.#y),this.#w.removeEventListener("click",this.#x),this.#u.removeEventListener("keydown",this.#v),this.#n?.disconnect(),this.#t?.disconnect(),this.#s.disconnect(),this.#o?.(),this.#o=null,this.#a=null,this.#i.disconnect(),this.#r.disconnect(),this.#de(),zr(this.#f.sourceNode).detach(this.#g),this.#g?.disconnect(),this.#$?.(),this.#$=null,this.#z.disconnect(),this.#I.disconnect(),this.#u.removeEventListener("scroll",this.#se),this.#u.removeEventListener("keydown",this.#ie),this.#j.disconnect(),this.#L!==null&&this.ownerDocument.defaultView.cancelAnimationFrame(this.#L),this.#L=null}#R(){!this.isConnected||this.#L!==null||(this.#L=this.ownerDocument.defaultView.requestAnimationFrame(()=>{this.#L=null;let t=`${this.#u.offsetWidth-this.#u.clientWidth}px`;this.control.style.getPropertyValue("--grid-scrollbar-width")!==t&&this.control.style.setProperty("--grid-scrollbar-width",t),this.#oe();for(let n of this.#A.querySelectorAll("th[scope=col]"))n.querySelector(".column-resize").setAttribute("aria-valuenow",String(Math.round(n.getBoundingClientRect().width)));for(let n of this.#p.values()){let i=n.querySelector(".row-height-handle");i&&i.setAttribute("aria-valuenow",String(Math.round(n.getBoundingClientRect().height)))}if(this.#N.scrollLeft=this.#u.scrollLeft,this.#l.viewport.scrollLeft=this.#u.scrollLeft,!!this.#h)try{this.#ae(),this.#n.position()}catch(n){this.#f.reportError(n,"Grid viewport")}}))}#oe(){if(!this.#T)return;let e=this.#A.querySelector(".row-number-measure");e.textContent=String(Math.max(1,this.#m.count));let t=Math.ceil(e.getBoundingClientRect().width);this.control.style.setProperty("--grid-row-header-min-width",`${t}px`),this.#m.headerWidth===null?this.control.style.removeProperty("--grid-row-header-width"):this.control.style.setProperty("--grid-row-header-width",`${this.#m.headerWidth}px`),this.#A.querySelector(".row-heading .column-resize").setAttribute("aria-valuemin",String(Math.max(40,t)))}#ae(){let e=this.#u,t=this.#m.indexAt(e.scrollTop),n=e.scrollTop-this.#m.offset(t),i=!1,s=this.#p.values().next().value;if(s){let o=this.ownerDocument.defaultView.getComputedStyle(s.querySelector("td")),a=JSON.stringify([this.#B.getBoundingClientRect().width,o.font,o.lineHeight,o.padding,o.getPropertyValue("--gramlot-grid-row-height")]);a!==this.#ne&&(this.#m.resetMeasurements(),this.#ne=a,i=!0)}for(let[o,a]of this.#p)i=this.#m.measure(o,a.getBoundingClientRect().height)||i;if(i&&this.#V.length){let o=this.#m.offset(t)+n;this.#le(),this.#O(this.#M?Math.max(0,this.#m.totalHeight-e.clientHeight):o)}this.#I.resizing||this.#G()}#le(){let e=Math.max(0,this.#X),t=Math.max(e,this.#Y);this.#H.style.height=`${this.#m.offset(e)}px`,this.#W.style.height=`${Math.max(0,this.#m.totalHeight-this.#m.offset(t))}px`}#O(e){this.#u.scrollTop!==e&&(this.#u.scrollTop=e,this.#Z=this.#u.scrollTop)}#G(e=!1){let t=this.#u,n=Math.max(0,this.#m.totalHeight-t.clientHeight),i=this.#M?n:Math.min(t.scrollTop,n),{start:s,end:o}=this.#m.window(i,t.clientHeight),a=this.#C();if(a){let u=a.start+this.#V.length;if(s<a.start||o>u){let c=Math.max(200,o-s),d=Math.max(0,Math.min(Math.max(0,a.total-c),s)),f=JSON.stringify([a.revision,d,c]);f!==this.#b&&(this.#b=f,this.#f.writeParameter("viewport",{start:d,count:c}))}else this.#b=null;s=Math.max(s,a.start),o=Math.max(s,Math.min(o,u))}a||(this.#b=null);let l=this.parameters.loading||this.#b!==null;if(this.#S.hidden=!l,l?this.control.setAttribute("aria-busy","true"):this.control.removeAttribute("aria-busy"),e||s!==this.#X||o!==this.#Y){let u=new bt(this.#r,this.#f.format).read(this.#h.columns,this.#V.slice(s-(a?.start??0),o-(a?.start??0)));this.#Ae(u,this.#h.columns,s),this.#X=s,this.#Y=o,this.#R()}this.#le(),this.#O(i)}#C(){let e=this.parameters.windowInfo;if(e===null)return null;if(!(e instanceof Es))throw new TypeError("Grid windowInfo requires a Bag");return Object.fromEntries(["start","total","revision","sortedBy"].map(t=>[t,e.getItem(t)]))}#he(e,t,n){let i=this.#g.getRows(),s=this.#h.columns.filter(a=>a.edit),o=i.indexOf(e)*s.length+s.findIndex(a=>a.field===t)+(typeof n=="object"?n.row*s.length:n);o<0||o>=i.length*s.length||this.#ue(Math.floor(o/s.length),s[o%s.length])}#ue(e,t){let n=this.#g.getRows()[e];this.#M=!1;let i=this.#m.offset(e),s=this.#m.offset(e+1);i<this.#u.scrollTop?this.#O(i):s>this.#u.scrollTop+this.#u.clientHeight&&this.#O(Math.max(0,s-this.#u.clientHeight)),this.#G(!0),this.#ae();let o=this.#p.get(n).querySelector(`td[data-field="${t.field}"]`),a=o.getBoundingClientRect(),l=this.#u.getBoundingClientRect();a.top<l.top?this.#O(Math.floor(this.#u.scrollTop+a.top-l.top)):a.bottom>l.bottom&&this.#O(Math.ceil(this.#u.scrollTop+Math.min(a.top-l.top,a.bottom-l.bottom))),a.left<l.left?this.#u.scrollLeft+=a.left-l.left:a.right>l.right&&(this.#u.scrollLeft+=Math.min(a.left-l.left,a.right-l.right)),this.#N.scrollLeft=this.#u.scrollLeft,this.#n.open(n,t,o)}#pe(e){let t=this.#f.sourceNode.absDatapath(this.parameters.storepath)+".";if(!e.startsWith(t))return!1;let n=e.slice(t.length),i=this.parameters.rowMode==="attributes"?"?":".",s=n.indexOf(i);if(s<0)return!1;let o=this.#e.getNode(n.slice(0,s)),a=this.#h.columns.find(u=>u.field===n.slice(s+1)&&u.edit),l=this.#g.getRows().indexOf(o);return!a||l<0?!1:(this.#ue(l,a),!0)}get formulaErrors(){return this.#r.errors}get totalErrors(){return this.#l.errors}setSourceContext(e){this.#f=e,this.#r=new Xn(e.sourceNode),this.#l=new Kn(e.sourceNode,e.format,this.#u.parentElement),this.#c=new Qn(e,{view:()=>this.#g,store:()=>this.#ee(),mode:()=>this.#J(),rowData:n=>this.#we(n)}),this.#s=new Jn(e,{columns:()=>this.#h.columns,rows:()=>this.#g.getRows(),selected:()=>this.#c.nodes,selectionMode:()=>this.#J(),reader:()=>this.#r,store:()=>({bag:this.#e,mode:this.parameters.rowMode}),parameters:()=>this.parameters,document:this.ownerDocument}),this.isConnected&&this.#s.connect(),this.#i.setSourceContext(e),this.#t=new Vn(e.sourceNode,this.#w,()=>this.#h?.columns??[],n=>[...this.#p].find(([,i])=>i===n)?.[0],(n,i)=>this.#g.value(n,i),()=>this.parameters.setFilter,()=>this.#g),this.isConnected&&this.#t.connect(),this.#n=new zn(this,e,(n,i)=>this.#p.get(n)?.querySelector(`td[data-field="${i}"]`),()=>({bag:this.#e,mode:this.parameters.rowMode,window:this.parameters.windowInfo}),()=>this.#p,(n,i,s)=>this.#he(n,i,s),n=>this.#pe(n));let t=e.sourceNode;Object.hasOwn(t,"gridRowLayout")||Object.defineProperty(t,"gridRowLayout",{value:new ti,configurable:!0}),this.#m=t.gridRowLayout}setStoreBag(e){if(!(e instanceof Es))throw new TypeError("grid storepath must resolve to a Bag");e!==this.#e&&this.#n?.replaceData(),this.#e=e,this.#m.bindStore(e)}setStructBag(e){this.#E=e,this.#k=!0}projectAttributes(e,t){let n=super.projectAttributes(e,t);if(this.#C()&&(this.parameters.columnFilters||this.#g?.filterContributions.some(([a])=>a.startsWith("column:"))))throw new TypeError("grid columnFilters requires a complete resident store");if(this.#C()&&this.parameters.setFilter!=="")throw new TypeError("grid setFilter requires a complete resident store");let i=this.#f.collectionView(this.#e,this.parameters.rowMode);this.#g!==i&&(this.#de(),this.#$?.(),this.#$=null,this.#g=i,this.#ce()),!this.#C()&&this.#te!==this.parameters.sortedBy&&(this.#g.sort(this.parameters.sortedBy),this.#te=this.parameters.sortedBy);let s=this.parameters.filter,o=JSON.stringify(s);return!this.#C()&&this.#re!==o&&(this.#g.applyFilter(s===null?null:{locale:this.#f.locale,timeZone:this.#f.timeZone,...s},"base"),this.#re=o),this.#K({full:!0,rows:[]}),n}#ce(){this.isConnected&&this.#g&&!this.#$&&(this.#g.connect(),this.#$=this.#g.subscribe(e=>this.#K(e)))}#de(){this.#P!==null&&this.ownerDocument.defaultView.clearTimeout(this.#P),this.#P=null,this.#q=!1,this.#U.clear()}#K({full:e,rows:t}){if(this.#q||=e,this.#q)this.#U.clear();else for(let n of t)this.#U.add(n);!this.isConnected||this.#P!==null||(this.#P=this.ownerDocument.defaultView.setTimeout(()=>{let n=this.#q,i=[...this.#U];this.#P=null,this.#q=!1,this.#U.clear();try{n?this.#ge():this.#me(this.#r.viewFields.size?[...this.#p.keys()]:i)}catch(s){this.#q=!0,this.#f.reportError(s,"Grid refresh")}},0))}#me(e){for(let n of e)this.#m.forget(n);this.#l.update(this.#r,this.#ee().getRows());let t=new bt(this.#r,this.#f.format).read(this.#h.columns,e.filter(n=>this.#p.has(n)));this.#I.cancel();for(let{node:n,cells:i}of t)this.#fe(this.#p.get(n),i,n);this.#R()}#ge(){let e=this.#k?new Zn(this.#E):this.#h,t=this.#ee();this.#r.configure(e,this.#g,t),this.#ve(),this.#s.requireEditableTools(e.columns),this.#c.prune();let n=this.#k;this.#n.configure(e.columns),this.#h=e,this.#t.configure();let i=this.#g.getRows();this.#I.cancel(),this.#I.cancelDrag(),this.#m.retain(this.#e.getNodes()),this.#k&&this.#m.resetMeasurements();let s=this.#C();this.#m.setWindow(s),this.#m.setRows(i),this.#V=i,s&&this.#d!==s.revision&&(this.#M=!1,this.#O(0),this.#b=null),this.#d=s?.revision,this.#k=!1,zr(this.#f.sourceNode).update(this.#g,e.columns.filter(l=>!l.check&&!this.#r.viewFields.has(l.field)));let o=this.parameters.rowHeaders||this.parameters.rowResize,a=JSON.stringify([e.groups,o,this.parameters.columnFilters,this.parameters.footer]);this.#T=o,a!==this.#_&&(this.#l.configure(this.parameters.footer,e.columns,o),this.#xe(e),this.#_=a),this.#l.update(this.#r,t.getRows()),this.#be(n),this.#i.update(this.#g,e.columns,this.parameters.columnFilters,this.#f.format),this.#Ee(),this.#G(!0),this.#Q(),this.control.setAttribute("aria-colcount",String(e.columns.length+Number(this.#T))),this.control.setAttribute("aria-rowcount",String(this.#F+Math.max(this.#m.count,1))),this.#R()}#be(e){let t=this.#f.sourceNode.formState;if(t===this.#a){e&&t?.updateChanges();return}this.#o?.(),this.#a=t,this.#o=t===null?null:t.registerDerived(n=>this.#_e(n))}#_e(e){let t=this.#a.path,n=a=>a===t?"":a.startsWith(t+".")?a.slice(t.length+1):null;if(this.#l.totalPaths().some(a=>n(a)===e)||this.#c.paths().some(a=>{let l=n(a);return l!==null&&(e===l||e.startsWith(l+".")||e.startsWith(l+"?"))}))return!0;let i=n(this.#f.sourceNode.absDatapath(this.parameters.storepath));if(i===null||i!==""&&!e.startsWith(i+"."))return!1;let s=i===""?e:e.slice(i.length+1),o=(this.parameters.rowMode==="attributes"?/^[^.?]+\?([^.?]+)$/:/^[^.?]+\.([^.?]+)$/).exec(s)?.[1];return o!==void 0&&this.#r.dataFields.has(o)}#J(){let e=this.parameters.selectionMode;if(!wl.includes(e))throw new TypeError("grid selectionMode requires none, single or multi");return e}#we(e){return this.parameters.rowMode==="attributes"?{...e.getAttr()}:Object.fromEntries(e.staticValue.getNodes().filter(t=>!(t.staticValue instanceof Es)).map(t=>[t.label,t.staticValue]))}#Q(){let e=this.#J();e==="multi"?this.control.setAttribute("aria-multiselectable","true"):this.control.removeAttribute("aria-multiselectable");for(let[t,n]of this.#p){let i=this.#c.isSelected(t);e==="none"?n.removeAttribute("aria-selected"):n.setAttribute("aria-selected",String(i)),n.setAttribute("part",i?"row selected-row":"row")}}#ye(e,t){let n=this.#g.getRows().indexOf(e);this.#M=!1;let i=this.#m.offset(n),s=this.#m.offset(n+1);i<this.#u.scrollTop?this.#O(i):s>this.#u.scrollTop+this.#u.clientHeight&&this.#O(Math.max(0,s-this.#u.clientHeight)),this.#G(!0),t&&this.#p.get(e)?.querySelector(`td[data-field="${t}"]`)?.focus({preventScroll:!0})}#ee(){return this.#f.sourceNode.rootBuilder.binding.collectionStore(this.#e,this.parameters.rowMode)}#ve(){let e=this.#g,t=this.#r.viewFields,n=[...e.criteria.map(({field:o})=>["sort by",o]),...e.filterContributions.flatMap(([o,{definition:a}])=>o.startsWith("column:")?[["filter",o.slice(7)]]:o==="sets"?[]:a.columns.map(l=>["search",l]))],[i,s]=n.find(([,o])=>t.has(o))??[];if(s!==void 0)throw new TypeError(`grid cannot ${i} the view value '${s}'`)}#ke(e,t){if(!this.#h.columns.find(n=>n.field===e)?.check)try{if(this.#r.viewFields.has(e))throw new TypeError(`grid cannot sort by the view value '${e}'`);let n=this.#C()?bs(this.#C().sortedBy):this.#g.criteria,i=n.find(l=>l.field===e),s=i?.direction==="a"?"d":"a",o=t?n.filter(l=>l.field!==e):[];t&&i?o.splice(n.indexOf(i),0,{field:e,direction:s}):o.push({field:e,direction:s});let a=o.map(l=>`${l.field}:${l.direction}`).join(",");this.#C()?this.#f.writeParameter("sortRequest",a):this.#g.sort(a)}catch(n){this.#f.reportError(n,"Grid sort")}}#Ee(){let e=this.#C()?bs(this.#C().sortedBy):this.#g.criteria;this.#oe();for(let t of this.#A.querySelectorAll("th[scope=col]")){let n=e.findIndex(i=>i.field===t.dataset.field);if(t.removeAttribute("aria-sort"),n<0)delete t.dataset.sortDirection,delete t.dataset.sortPriority,t.removeAttribute("aria-label");else{let i=e[n].direction==="a"?"ascending":"descending";t.dataset.sortDirection=i,t.dataset.sortPriority=String(n+1),n===0&&t.setAttribute("aria-sort",i),t.setAttribute("aria-label",`${t.textContent}, sort ${n+1}, ${i}`)}}}#xe(e){this.#z.cancel();let t=this.shadowRoot.activeElement,n=t?.closest("th[data-field]")?.dataset.field,i=t?.classList.contains("column-resize"),s=this.ownerDocument,o=e.groups.some(h=>h.name!==null);this.#F=o?2:1;let a=s.createElement("tr"),l=s.createElement("tr");for(let[h,p]of[a,l].entries())p.setAttribute("role","row"),p.setAttribute("aria-rowindex",String(h+1));let u=(h,p,m,g,_,v="start")=>{let w=s.createElement("th");if(w.textContent=h,w.colSpan=p,w.rowSpan=m,w.scope=g,w.setAttribute("role","columnheader"),w.setAttribute("part",g==="colgroup"?"group-header":"column-header"),w.setAttribute("aria-colindex",String(_+1+Number(this.#T))),w.setAttribute("aria-colspan",String(p)),w.setAttribute("aria-rowspan",String(m)),w.style.textAlign=v,g==="col"){let E=s.createElement("span");E.className="column-caption",E.textContent=h,w.replaceChildren(E);let T=e.columns[_];w.dataset.field=T.field,w.draggable=!0,w.tabIndex=0,w.setAttribute("aria-label",T.title??T.name),w.title=T.check?(T.title??T.name)+" \xB7 Drag to reorder":"Click: ascending / descending \xB7 Shift-click: add or reverse this column without changing the others \xB7 Numbers show sort priority \xB7 Drag to reorder";let I=s.createElementNS(xe,"svg");I.classList.add("sort-indicator"),I.setAttribute("viewBox","0 0 16 16"),I.setAttribute("aria-hidden","true");let z=s.createElementNS(xe,"path");z.setAttribute("d","M4 10L8 6L12 10"),I.append(z),w.append(I),this.parameters.columnFilters&&!T.check&&!this.#r.viewFields.has(T.field)&&w.append(this.#i.button(T));let q=s.createElement("span");q.className="column-resize",q.tabIndex=0,q.setAttribute("role","separator"),q.setAttribute("aria-orientation","vertical"),q.setAttribute("aria-valuemin","40"),q.setAttribute("aria-label",`Resize ${T.name}`),q.title="Drag to resize \xB7 Arrow keys adjust width",w.append(q)}return w};if(this.#T){let h=s.createElement("th");h.textContent="#",h.scope="col",h.className="row-heading",h.rowSpan=this.#F,h.setAttribute("role","columnheader"),h.setAttribute("aria-colindex","1"),h.setAttribute("aria-rowspan",String(this.#F)),h.setAttribute("part","row-header");let p=s.createElement("span");p.className="row-number-measure",p.setAttribute("aria-hidden","true");let m=s.createElement("span");m.className="column-resize",m.tabIndex=0,m.setAttribute("role","separator"),m.setAttribute("aria-orientation","vertical"),m.setAttribute("aria-label","Resize row numbers"),m.title="Drag to resize \xB7 Arrow keys adjust width",h.append(p,m),a.append(h)}let c=0;for(let h of e.groups)if(o&&h.name!==null){let p=u(h.name,h.columns.length,1,"colgroup",c,"center");p.style.background=h.background??"",p.style.color=h.color??"",a.append(p);for(let m of h.columns)l.append(u(m.name,1,1,"col",c++,m.align))}else for(let p of h.columns){if(o){let m=s.createElement("td");m.className="group-spacer",m.setAttribute("aria-hidden","true"),a.append(m)}(o?l:a).append(u(p.name,1,1,"col",c++,p.align))}this.#A.replaceChildren(a,...o?[l]:[]),n&&this.#A.querySelector(`th[data-field="${n}"]${i?" .column-resize":""}`)?.focus({preventScroll:!0});let d=e.columns.map(h=>h.width??"var(--gramlot-grid-column-width, 10rem)");this.#T&&d.unshift("max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))"),this.control.style.setProperty("--grid-columns-width",`calc(${d.join(" + ")})`);let f=this.parameters.footer===!1?[]:[this.#l.table];for(let h of[this.#D,this.#B,...f]){for(let p of h.querySelectorAll(":scope > colgroup"))p.remove();if(h.prepend(...e.groups.map(p=>{let m=s.createElement("colgroup");for(let g of p.columns){let _=s.createElement("col");_.style.width=g.width??"var(--gramlot-grid-column-width, 10rem)",m.append(_)}return m})),this.#T){let p=s.createElement("colgroup"),m=s.createElement("col");m.style.width="max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))",p.append(m),h.prepend(p)}}}#Ae(e,t,n){this.#I.cancel();let i=new Set,s=null;this.#w.querySelector(".empty")?.parentElement.remove();for(let{node:o,cells:a}of e){let l=this.#p.get(o);l||(l=this.ownerDocument.createElement("tr"),l.setAttribute("part","row"),l.setAttribute("role","row"),l.dataset.row=o.label,this.#p.set(o,l)),l.classList.toggle("alternate",(n+i.size)%2===1),l.setAttribute("part",this.#c.isSelected(o)?"row selected-row":"row"),this.#c.mode==="none"?l.removeAttribute("aria-selected"):l.setAttribute("aria-selected",String(this.#c.isSelected(o)));let u=this.#g.isFiltered();l.draggable=this.parameters.selfDragRows;let c=l.querySelector("th[scope=row]");if(this.#T){if(!c){c=this.ownerDocument.createElement("th"),c.scope="row",c.className="row-heading",c.setAttribute("role","rowheader"),c.setAttribute("part","row-header"),c.setAttribute("aria-colindex","1");let m=this.ownerDocument.createElement("span");m.className="row-number",c.append(m),l.prepend(c)}c.querySelector(".row-number").textContent=String(n+i.size+1),c.classList.toggle("filtered-numbering",u);let p=c.querySelector(".row-height-handle");this.parameters.rowResize?(p||(p=this.ownerDocument.createElement("span"),p.className="row-height-handle",p.tabIndex=0,p.setAttribute("role","separator"),p.setAttribute("aria-orientation","horizontal"),p.title="Drag to resize row \xB7 Double-click or Home resets \xB7 Arrow keys adjust height",c.append(p)),p.setAttribute("aria-label",`Resize row ${n+i.size+1}`)):p?.remove()}else c?.remove();let d=Number(this.#T),f=new Map([...l.querySelectorAll("td[data-field]")].map(p=>[p.dataset.field,p]));for(let[p,m]of t.entries()){let g=f.get(m.field);if(!g){g=this.ownerDocument.createElement("td"),g.setAttribute("part","cell"),g.dataset.field=m.field,g.setAttribute("role","cell");let w=this.ownerDocument.createElement("div");w.className="cell-content",w.setAttribute("part","cell-content"),g.append(w)}m.edit?g.tabIndex=0:g.removeAttribute("tabindex"),g.classList.toggle("filtered-numbering",u&&this.#r.viewFields.has(m.field));let _=g.firstElementChild,v=m.max_height!=null;v?g.style.setProperty("--grid-cell-max-height",m.max_height):g.style.removeProperty("--grid-cell-max-height"),_.classList.toggle("cell-scroll",v),v?_.tabIndex=0:_.removeAttribute("tabindex"),g.style.textAlign=m.align,g.style.whiteSpace=m.white_space??"",g.style.overflowWrap=m.white_space==="pre-wrap"||m.white_space==="normal"?"anywhere":"",g.setAttribute("aria-colindex",String(p+1+d)),g.classList.toggle("numeric",["L","R","N"].includes(m.dtype)),l.cells[p+d]!==g&&l.insertBefore(g,l.cells[p+d]??null),f.delete(m.field)}for(let p of f.values())p.remove();l.setAttribute("aria-rowindex",String(this.#F+n+i.size+1)),this.#fe(l,a,o),this.#n.decorate(l,o);let h=s?s.nextSibling:this.#w.firstChild;h!==l&&this.#w.insertBefore(l,h),this.#I.project(l,o),s=l,i.add(o)}for(let[o,a]of this.#p)i.has(o)||(a.remove(),this.#p.delete(o));if(!e.length&&this.#m.count===0&&!this.parameters.loading){let o=this.ownerDocument.createElement("tr"),a=this.ownerDocument.createElement("td");o.setAttribute("role","row"),o.setAttribute("aria-rowindex",String(this.#F+1)),a.setAttribute("role","cell"),a.setAttribute("aria-colspan",String(t.length+Number(this.#T))),a.className="empty",a.colSpan=t.length+Number(this.#T),a.textContent="No rows",o.append(a),this.#w.append(o)}}#fe(e,t,n){let i=Number(this.#T);t.forEach((s,o)=>{let a=e.cells[o+i].firstElementChild,l=this.#h.columns[o];if(a.parentElement.classList.toggle("check-cell",!!l.check),l.check){this.#t.project(a,n,l);return}if(l.edit?.tag==="colorpicker"){let c=a.querySelector(".cell-color-swatch");c||(c=this.ownerDocument.createElement("span"),c.className="cell-color-swatch",c.setAttribute("role","img"),a.replaceChildren(c)),c.hidden=s==="",c.style.backgroundColor=s,c.title=s,c.setAttribute("aria-label",s)}else(a.firstElementChild||a.textContent!==s)&&(a.textContent=s)})}}}),xs=class extends _e.ComponentCollection{toDocument(){let e=super.toDocument(),t=e.elements.grid.attributes.parameters;for(let n of["storepath","rowMode"]){let i=t.find(s=>s.name===n);i.has_default=!1,delete i.default,n==="rowMode"&&(i.annotation={kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(values|attributes)$",flags:0}]})}return Object.assign(e.elements,structuredClone(Dl.elements)),e.elements.grid._meta.parameterPattern="^selected_[A-Za-z_][A-Za-z0-9_]*$",e}},Rw=new xs({name:"grid",components:[Sh,Al],dependencies:[Nh],registerCommands:gl,assets:{writeExcelFileLicense:Et["assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt"],fflateLicense:Et["assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt"]}});export{Sh as Grid,Rw as default};
|
|
286
|
+
`;var xt=(0,w.defineComponent)({name:"searchBox",tag:"gramlot-search-box",base:_,sourceContext:!0,mixins:[wt],parameters:{lbl_position:{dtype:"T",default:"L",binding:"read"},searchLiteral:{dtype:"B",default:!1,binding:"read"},searchHelp:{dtype:"B",default:!1,binding:"read"},searchOn:{dtype:["B","T"],default:!0,binding:"read"},searchTime:{dtype:"R",nullable:!0,default:null,binding:"write"}},implementation:c=>class extends c{#t;#e;#s;#o;#i;#l=null;#r;#a;#n;#h;#A;#S;#x;constructor(){super();let t=this.ownerDocument,e=t.createElement("style");e.textContent=vt;let i=p=>{let m=t.createElementNS(y,"svg");m.setAttribute("viewBox","0 0 24 24"),m.setAttribute("aria-hidden","true");let h=t.createElementNS(y,"path");return h.setAttribute("d",p),m.append(h),m};this.#r=t.createElement("input"),this.#r.type="text",this.#r.setAttribute("role","searchbox"),this.#r.setAttribute("aria-label","Filter rows"),this.#r.setAttribute("aria-describedby","search-error"),this.#r.placeholder=" ";let r=t.createElement("button");r.type="button",r.title="Clear filter",r.setAttribute("aria-label","Clear filter"),r.append(i("M6 6L18 18M18 6L6 18")),this.#a=t.createElement("span"),this.#a.id="search-error",this.#a.className="error",this.#a.setAttribute("role","alert");let s=t.createElement("span");s.className="search-entry";let o=i("M21 21L16 16M18 10A8 8 0 1 1 2 10A8 8 0 0 1 18 10");o.classList.add("search-lens"),r.className="clear";let n=this.#n=t.createElement("button");n.type="button",n.className="info",n.hidden=!0,n.setAttribute("aria-label","Search instructions"),n.title="Search instructions",n.setAttribute("aria-haspopup","dialog"),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-controls","search-help"),n.append(i("M21 12A9 9 0 1 1 3 12A9 9 0 0 1 21 12M12 11V17M12 7V7.1"));let a=this.#h=t.createElement("div");a.id="search-help",a.className="search-help",a.setAttribute("popover","auto"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","Search instructions");let d=t.createElement("strong");d.textContent="Search instructions",this.#A=t.createElement("p");let l=t.createElement("p");l.textContent="Clear with \xD7 or Escape. Changing column clears the query. An incomplete expression keeps the last valid result.",a.append(d,this.#A,l),this.shadowRoot.append(a),n.addEventListener("click",()=>{a.matches(":popover-open")?a.hidePopover():(a.showPopover(),R(a,n,{align:"end"}))}),a.addEventListener("toggle",()=>n.setAttribute("aria-expanded",String(a.matches(":popover-open")))),s.append(o,this.#r,r,n),this.control.replaceChildren(s,this.#a),this.shadowRoot.append(e),this.#r.addEventListener("input",()=>{this.#c(),this.#l=t.defaultView.setTimeout(()=>{this.#l=null,this.#f()},100)}),this.#r.addEventListener("keydown",p=>{p.isComposing||(p.key==="Enter"&&(p.preventDefault(),this.#c(),this.#f()),p.key==="Escape"&&(p.preventDefault(),this.#b()))}),r.addEventListener("click",()=>{this.#b(),this.#r.focus()})}setLabelbox(t){super.setLabelbox(t),t.box.classList.add("gramlot-search-labelbox");let e=this.ownerDocument.createElement("style");e.textContent=yt,t.box.prepend(e)}focus(t){this.#r.focus(t)}clear(){this.#b()}setSourceContext(t){this.#t=t;let e=t.frameRecipient();if(e?.nodeTag!=="grid")throw new TypeError("searchBox requires a FrameGrid target");this.#e=B(e)}projectAttributes(t,e){let i=this.parameters?.lbl_value,r=super.projectAttributes(t,e),s=!this.#n.hidden;return this.#n.hidden=!this.parameters.searchHelp,s&&this.#n.hidden&&this.#h.matches(":popover-open")&&this.#h.hidePopover(),this.isConnected&&(this.#y(),i!=null&&i!==this.parameters.lbl_value&&this.#i?.filter?.columns.join("+")!==this.parameters.lbl_value&&this.#b()),r}connectedCallback(){this.#s=this.#e.subscribe(()=>this.#y()),this.#y()}disconnectedCallback(){this.#c(),this.#s?.(),this.#o?.(),this.#s=this.#o=null}#c(){this.#l!==null&&this.ownerDocument.defaultView.clearTimeout(this.#l),this.#l=null}#y(){try{this.#u()}catch(t){this.#r.disabled=!0,this.#a.textContent=t.message}}#u(){if(!this.#e.view)return;(this.#i!==this.#e.view||this.#x!==this.#e.view.bag||!this.#o)&&(this.#c(),this.#o?.(),this.#i=this.#e.view,this.#x=this.#i.bag,this.#S=void 0,this.#o=this.#i.subscribe(()=>this.#p()));let t=bt(this.parameters.searchOn,this.#e.columns),e=this.#t.sourceNode,i=t.map(({field:s,name:o})=>`${s}:${o}`).join(","),r=t.some(s=>s.field===this.parameters.lbl_value)?this.parameters.lbl_value:t[0]?.field??"";e.getAttr("lbl_values")!==i&&e.setAttr({lbl_values:i}),this.parameters.lbl_value!==r&&this.box.labelbox.choose(r),this.#r.disabled=!t.length,this.#p(),this.#v()}#p(){let t=this.#i.filter,e=JSON.stringify(t);this.#S!==e&&(this.#S=e,this.#c(),this.#r.value=t?.value??"",t&&this.parameters.lbl_value!==t.columns.join("+")&&this.box.labelbox.choose(t.columns.join("+")),this.#a.textContent="",this.#r.removeAttribute("aria-invalid"),this.#v())}#E(){let t=this.#e.columns.find(e=>e.field===this.parameters.lbl_value);return["L","R","N","D"].includes(t?.dtype)?t.dtype:"T"}#v(){let t=this.#E();this.#A.textContent=t==="T"?this.parameters.searchLiteral?"Type literal text to find it anywhere. Matching is case-insensitive.":"Type a word to find it anywhere. Text is case-insensitive. You can also use expressions: lamp|desk matches either word; ^lamp matches the start.":t==="D"?"Compare dates: = 2026-10-15, >= 2026-10-15 or < 2026-10-15. ISO dates and your browser\u2019s local date notation are accepted.":"Compare numbers: = 12, > 100, <= 50 or ! 0 (not equal). Decimal punctuation follows your browser locale."}#b(){this.#c(),this.#r.value="",this.#f(),this.#v()}#f(){if(this.#i)try{let t=this.#r.value,e=performance.now();this.#i.applyFilter(t.trim()?{value:t,columns:this.parameters.lbl_value.split("+"),dtype:this.#E(),...this.parameters.searchLiteral?{literal:!0}:{},locale:this.#t.locale,timeZone:this.#t.timeZone}:null),this.#t.writeParameter("searchTime",performance.now()-e),this.#a.textContent="",this.#r.removeAttribute("aria-invalid")}catch(t){this.#a.textContent=t.message,this.#r.setAttribute("aria-invalid","true")}}}});var kt={elements:{struct:{doc:null,sub_tags:"column,colgroup",parent_tags:"grid",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0,gridStruct:!0}},column:{doc:null,sub_tags:"",parent_tags:"struct,colgroup",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[{name:"field",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[A-Za-z_][A-Za-z0-9_]*$",flags:0}]},has_default:!1},{name:"name",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"dtype",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(T|B|L|R|N|D|H|DHZ)$",flags:0}]},has_default:!0,default:null},{name:"width",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[0-9]+([.][0-9]+)?(px|em|rem|ch|%)$",flags:0}]},has_default:!0,default:null},{name:"max_height",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[0-9]+([.][0-9]+)?(px|em|rem)$",flags:0}]},has_default:!0,default:null},{name:"align",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(start|center|end)$",flags:0}]},has_default:!0,default:null},{name:"format",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"white_space",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(normal|nowrap|pre-wrap)$",flags:0}]},has_default:!0,default:null},{name:"edit",kind:"keyword_only",role:"attribute",annotation:{kind:"union",items:[{kind:"dtype",dtype:"B"},{kind:"type",module:"builtins",name:"dict"}]},has_default:!0,default:!1},{name:"check",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"checked",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"checkedField",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"title",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"formula",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"calculated",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"B"},has_default:!0,default:null},{name:"hidden",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"B"},has_default:!0,default:null},{name:"totalize",kind:"keyword_only",role:"attribute",annotation:{kind:"union",items:[{kind:"dtype",dtype:"B"},{kind:"dtype",dtype:"T"}]},has_default:!0,default:null},{name:"footer_value",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"footer_format",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},_meta:{data_element:!0,keywordPattern:"^formula_[A-Za-z_$][A-Za-z0-9_$]*$"}},colgroup:{doc:null,sub_tags:"column",parent_tags:"struct",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[{name:"code",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[A-Za-z_][A-Za-z0-9_]*$",flags:0}]},has_default:!1},{name:"name",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"background",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"color",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null}],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0}}}};var te=(0,w.defineComponent)({name:"grid",tag:"gramlot-grid",base:_,bagStore:!0,bagStruct:!0,sourceContext:!0,subTags:"struct,div",parameters:{columnFilters:{dtype:"B",default:!1,binding:"read"},setFilter:{dtype:"T",default:"",binding:"read"},windowInfo:{dtype:"X",nullable:!0,default:null,binding:"read"},loading:{dtype:"B",default:!1,binding:"read"},viewport:{dtype:"X",nullable:!0,default:null,binding:"write"},sortRequest:{dtype:"T",default:"",binding:"write"},storepath:{dtype:"T"},structpath:{dtype:"T"},rowMode:{dtype:"T"},rowHeaders:{dtype:"B",default:!1,binding:"read"},footer:{dtype:["B","T"],default:!1,binding:"read"},selectionMode:{dtype:"T",default:"multi",binding:"read"},selectedId:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedIndex:{dtype:"L",nullable:!0,default:null,binding:"write"},selectedLabel:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedPkeys:{dtype:"X",nullable:!0,default:null,binding:"write"},selectedRowidx:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedNodes:{dtype:"X",nullable:!0,default:null,binding:"write"},selectedRowData:{dtype:"X",nullable:!0,default:null,binding:"write"},rowResize:{dtype:"B",default:!1,binding:"read"},selfDragRows:{dtype:"B",default:!1,binding:"read"},sortedBy:{dtype:"T",default:"",binding:"read"},filter:{annotation:{kind:"type",module:"builtins",name:"dict"},nullable:!0,default:null,binding:"read"}},implementation:c=>class extends c{#t;#e;#s;#o;#i;#l;#r;#a=null;#n=null;#h;#A=t=>{let e=t.target.closest("tr[data-row]"),i=e&&[...this.#f].find(([,r])=>r===e)?.[0];if(!(!i||this.#h.mode==="none"))try{this.#h.select(i,{toggle:t.ctrlKey||t.metaKey,range:t.shiftKey}),this.#Q()}catch(r){this.#u.reportError(r,"Grid selection")}};#S=t=>{if(this.#h.mode==="none"||t.altKey)return;let e=(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a",i={ArrowUp:-1,ArrowDown:1}[t.key];if(!(!e&&(i===void 0||t.ctrlKey||t.metaKey))){t.preventDefault();try{if(e)this.#h.selectAll();else{let r=t.target.closest?.("td[data-field]")?.dataset.field,s=this.#h.move(i,t.shiftKey);s&&this.#vt(s,r)}this.#Q()}catch(r){this.#u.reportError(r,"Grid selection")}}};#x=t=>{if(t.type==="keydown"&&!["Enter","F2"].includes(t.key))return;let e=t.target.closest("td[data-field]");if(!e||!this.#p)return;let i=[...this.#f].find(([,s])=>s===e.parentElement)?.[0],r=this.#p.columns.find(s=>s.field===e.dataset.field);if(i&&r.edit){t.preventDefault();try{this.#o.open(i,r,e)}catch(s){this.#u.reportError(s,"Grid editor")}}};#c;#y;#u;#p;#E;#v=!0;#b;#f=new Map;#k;#w;#T;#B;#L;#d;#N;#V;#F=null;#I=1;#D=!1;#P;#R;#m;#g;#et;#it;#j;#$=null;#q=!1;#H=new Set;#O=[];#Z=-1;#U=-1;#G;#W;#rt;#M=!1;#X=null;#st=t=>{t.target!==this.#d||!["Home","End"].includes(t.key)||!this.#p||(t.preventDefault(),this.#M=t.key==="End",this.#_(this.#M?Math.max(0,this.#m.totalHeight-this.#d.clientHeight):0),this.#z())};#ot=()=>{let t=this.#d;t.scrollTop!==this.#X&&(this.#M=t.scrollTop>0&&t.scrollHeight-t.clientHeight-t.scrollTop<=1),this.#X=null,this.#L.scrollLeft=this.#d.scrollLeft,this.#l&&(this.#l.viewport.scrollLeft=this.#d.scrollLeft),this.#z()};constructor(){super();let t=this.ownerDocument,e=t.createElement("style");e.textContent=gt,this.control.setAttribute("role","table"),this.control.setAttribute("aria-label","Grid"),this.control.setAttribute("part","table");let i=t.createElement("div");i.className="header-frame",i.setAttribute("part","header"),this.#L=t.createElement("div"),this.#L.className="header-viewport",this.#L.setAttribute("part","header-viewport"),this.#d=t.createElement("div"),this.#d.className="body-viewport",this.#d.setAttribute("part","body-viewport"),this.#d.tabIndex=0,this.#d.setAttribute("role","rowgroup"),this.#T=t.createElement("table"),this.#B=t.createElement("table");for(let a of[this.#T,this.#B])a.setAttribute("role","presentation");this.#k=t.createElement("thead"),this.#k.setAttribute("role","rowgroup"),this.#w=t.createElement("tbody"),this.#w.setAttribute("role","presentation"),this.#T.append(this.#k),this.#B.append(this.#w),this.#L.append(this.#T),i.append(this.#L),this.#G=t.createElement("div"),this.#W=t.createElement("div");for(let a of[this.#G,this.#W])a.className="row-space",a.setAttribute("aria-hidden","true");this.#d.append(this.#G,this.#B,this.#W);let r=t.createElement("div");r.className="body-frame",this.#N=t.createElement("div"),this.#N.className="loading-status",this.#N.setAttribute("role","status"),this.#N.setAttribute("aria-label","Loading\u2026"),this.#N.hidden=!0;let s=t.createElementNS(y,"svg");s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("aria-hidden","true");let o=t.createElementNS(y,"circle");o.setAttribute("cx","12"),o.setAttribute("cy","12"),o.setAttribute("r","9"),o.setAttribute("opacity",".2");let n=t.createElementNS(y,"path");n.setAttribute("d","M12 3a9 9 0 0 1 9 9"),s.append(o,n),this.#N.append(s),r.append(this.#d,this.#N),this.control.replaceChildren(i,r),this.shadowRoot.append(e),this.#s=new F(this,this.#k),this.#P=new P(this.#k,this.control,()=>this.#p,(a,d)=>this.#kt(a,d),()=>this.#m,()=>this.#z()),this.#R=new G(this.#w,this.control,()=>this.#m,a=>{for(let[d,l]of this.#f)if(l===a)return d;return null},()=>this.#g,()=>this.parameters.selfDragRows,()=>this.#z()),this.#V=new t.defaultView.ResizeObserver(()=>this.#z())}connectedCallback(){this.#w.addEventListener("dblclick",this.#x),this.#w.addEventListener("keydown",this.#x),this.#w.addEventListener("click",this.#A),this.#d.addEventListener("keydown",this.#S),this.#o?.connect(),this.#e?.connect(),this.#r?.connect(),this.#s.connect(),this.#ct(),this.#g&&this.#Y({full:!0,rows:[]}),this.#P.connect(),this.#R.connect(),this.#d.addEventListener("scroll",this.#ot,{passive:!0}),this.#d.addEventListener("keydown",this.#st),this.#V.observe(this.#d),this.#V.observe(this.#B),this.#z()}disconnectedCallback(){this.#w.removeEventListener("dblclick",this.#x),this.#w.removeEventListener("keydown",this.#x),this.#w.removeEventListener("click",this.#A),this.#d.removeEventListener("keydown",this.#S),this.#o?.disconnect(),this.#e?.disconnect(),this.#r.disconnect(),this.#n?.(),this.#n=null,this.#a=null,this.#s.disconnect(),this.#i.disconnect(),this.#ht(),B(this.#u.sourceNode).detach(this.#g),this.#g?.disconnect(),this.#j?.(),this.#j=null,this.#P.disconnect(),this.#R.disconnect(),this.#d.removeEventListener("scroll",this.#ot),this.#d.removeEventListener("keydown",this.#st),this.#V.disconnect(),this.#F!==null&&this.ownerDocument.defaultView.cancelAnimationFrame(this.#F),this.#F=null}#z(){!this.isConnected||this.#F!==null||(this.#F=this.ownerDocument.defaultView.requestAnimationFrame(()=>{this.#F=null;let e=`${this.#d.offsetWidth-this.#d.clientWidth}px`;this.control.style.getPropertyValue("--grid-scrollbar-width")!==e&&this.control.style.setProperty("--grid-scrollbar-width",e),this.#nt();for(let i of this.#k.querySelectorAll("th[scope=col]"))i.querySelector(".column-resize").setAttribute("aria-valuenow",String(Math.round(i.getBoundingClientRect().width)));for(let i of this.#f.values()){let r=i.querySelector(".row-height-handle");r&&r.setAttribute("aria-valuenow",String(Math.round(i.getBoundingClientRect().height)))}if(this.#L.scrollLeft=this.#d.scrollLeft,this.#l.viewport.scrollLeft=this.#d.scrollLeft,!!this.#p)try{this.#at(),this.#o.position()}catch(i){this.#u.reportError(i,"Grid viewport")}}))}#nt(){if(!this.#D)return;let t=this.#k.querySelector(".row-number-measure");t.textContent=String(Math.max(1,this.#m.count));let e=Math.ceil(t.getBoundingClientRect().width);this.control.style.setProperty("--grid-row-header-min-width",`${e}px`),this.#m.headerWidth===null?this.control.style.removeProperty("--grid-row-header-width"):this.control.style.setProperty("--grid-row-header-width",`${this.#m.headerWidth}px`),this.#k.querySelector(".row-heading .column-resize").setAttribute("aria-valuemin",String(Math.max(40,e)))}#at(){let t=this.#d,e=this.#m.indexAt(t.scrollTop),i=t.scrollTop-this.#m.offset(e),r=!1,s=this.#f.values().next().value;if(s){let o=this.ownerDocument.defaultView.getComputedStyle(s.querySelector("td")),n=JSON.stringify([this.#B.getBoundingClientRect().width,o.font,o.lineHeight,o.padding,o.getPropertyValue("--gramlot-grid-row-height")]);n!==this.#rt&&(this.#m.resetMeasurements(),this.#rt=n,r=!0)}for(let[o,n]of this.#f)r=this.#m.measure(o,n.getBoundingClientRect().height)||r;if(r&&this.#O.length){let o=this.#m.offset(e)+i;this.#lt(),this.#_(this.#M?Math.max(0,this.#m.totalHeight-t.clientHeight):o)}this.#R.resizing||this.#K()}#lt(){let t=Math.max(0,this.#Z),e=Math.max(t,this.#U);this.#G.style.height=`${this.#m.offset(t)}px`,this.#W.style.height=`${Math.max(0,this.#m.totalHeight-this.#m.offset(e))}px`}#_(t){this.#d.scrollTop!==t&&(this.#d.scrollTop=t,this.#X=this.#d.scrollTop)}#K(t=!1){let e=this.#d,i=Math.max(0,this.#m.totalHeight-e.clientHeight),r=this.#M?i:Math.min(e.scrollTop,i),{start:s,end:o}=this.#m.window(r,e.clientHeight),n=this.#C();if(n){let d=n.start+this.#O.length;if(s<n.start||o>d){let l=Math.max(200,o-s),p=Math.max(0,Math.min(Math.max(0,n.total-l),s)),m=JSON.stringify([n.revision,p,l]);m!==this.#y&&(this.#y=m,this.#u.writeParameter("viewport",{start:p,count:l}))}else this.#y=null;s=Math.max(s,n.start),o=Math.max(s,Math.min(o,d))}n||(this.#y=null);let a=this.parameters.loading||this.#y!==null;if(this.#N.hidden=!a,a?this.control.setAttribute("aria-busy","true"):this.control.removeAttribute("aria-busy"),t||s!==this.#Z||o!==this.#U){let d=new E(this.#i,this.#u.format).read(this.#p.columns,this.#O.slice(s-(n?.start??0),o-(n?.start??0)));this.#St(d,this.#p.columns,s),this.#Z=s,this.#U=o,this.#z()}this.#lt(),this.#_(r)}#C(){let t=this.parameters.windowInfo;if(t===null)return null;if(!(t instanceof J))throw new TypeError("Grid windowInfo requires a Bag");return Object.fromEntries(["start","total","revision","sortedBy"].map(e=>[e,t.getItem(e)]))}#pt(t,e,i){let r=this.#g.getRows(),s=this.#p.columns.filter(n=>n.edit),o=r.indexOf(t)*s.length+s.findIndex(n=>n.field===e)+(typeof i=="object"?i.row*s.length:i);o<0||o>=r.length*s.length||this.#dt(Math.floor(o/s.length),s[o%s.length])}#dt(t,e){let i=this.#g.getRows()[t];this.#M=!1;let r=this.#m.offset(t),s=this.#m.offset(t+1);r<this.#d.scrollTop?this.#_(r):s>this.#d.scrollTop+this.#d.clientHeight&&this.#_(Math.max(0,s-this.#d.clientHeight)),this.#K(!0),this.#at();let o=this.#f.get(i).querySelector(`td[data-field="${e.field}"]`),n=o.getBoundingClientRect(),a=this.#d.getBoundingClientRect();n.top<a.top?this.#_(Math.floor(this.#d.scrollTop+n.top-a.top)):n.bottom>a.bottom&&this.#_(Math.ceil(this.#d.scrollTop+Math.min(n.top-a.top,n.bottom-a.bottom))),n.left<a.left?this.#d.scrollLeft+=n.left-a.left:n.right>a.right&&(this.#d.scrollLeft+=Math.min(n.left-a.left,n.right-a.right)),this.#L.scrollLeft=this.#d.scrollLeft,this.#o.open(i,e,o)}#ft(t){let e=this.#u.sourceNode.absDatapath(this.parameters.storepath)+".";if(!t.startsWith(e))return!1;let i=t.slice(e.length),r=this.parameters.rowMode==="attributes"?"?":".",s=i.indexOf(r);if(s<0)return!1;let o=this.#t.getNode(i.slice(0,s)),n=this.#p.columns.find(d=>d.field===i.slice(s+1)&&d.edit),a=this.#g.getRows().indexOf(o);return!n||a<0?!1:(this.#dt(a,n),!0)}get formulaErrors(){return this.#i.errors}get totalErrors(){return this.#l.errors}setSourceContext(t){this.#u=t,this.#i=new at(t.sourceNode),this.#l=new q(t.sourceNode,t.format,this.#d.parentElement),this.#h=new V(t,{view:()=>this.#g,store:()=>this.#tt(),mode:()=>this.#J(),rowData:i=>this.#yt(i)}),this.#r=new H(t,{columns:()=>this.#p.columns,rows:()=>this.#g.getRows(),selected:()=>this.#h.nodes,selectionMode:()=>this.#J(),reader:()=>this.#i,store:()=>({bag:this.#t,mode:this.parameters.rowMode}),parameters:()=>this.parameters,document:this.ownerDocument}),this.isConnected&&this.#r.connect(),this.#s.setSourceContext(t),this.#e=new $(t.sourceNode,this.#w,()=>this.#p?.columns??[],i=>[...this.#f].find(([,r])=>r===i)?.[0],(i,r)=>this.#g.value(i,r),()=>this.parameters.setFilter,()=>this.#g),this.isConnected&&this.#e.connect(),this.#o=new j(this,t,(i,r)=>this.#f.get(i)?.querySelector(`td[data-field="${r}"]`),()=>({bag:this.#t,mode:this.parameters.rowMode,window:this.parameters.windowInfo}),()=>this.#f,(i,r,s)=>this.#pt(i,r,s),i=>this.#ft(i));let e=t.sourceNode;Object.hasOwn(e,"gridRowLayout")||Object.defineProperty(e,"gridRowLayout",{value:new O,configurable:!0}),this.#m=e.gridRowLayout}setStoreBag(t){if(!(t instanceof J))throw new TypeError("grid storepath must resolve to a Bag");t!==this.#t&&this.#o?.replaceData(),this.#t=t,this.#m.bindStore(t)}setStructBag(t){this.#E=t,this.#v=!0}projectAttributes(t,e){let i=super.projectAttributes(t,e);if(this.#C()&&(this.parameters.columnFilters||this.#g?.filterContributions.some(([n])=>n.startsWith("column:"))))throw new TypeError("grid columnFilters requires a complete resident store");if(this.#C()&&this.parameters.setFilter!=="")throw new TypeError("grid setFilter requires a complete resident store");let r=this.#u.collectionView(this.#t,this.parameters.rowMode);this.#g!==r&&(this.#ht(),this.#j?.(),this.#j=null,this.#g=r,this.#ct()),!this.#C()&&this.#et!==this.parameters.sortedBy&&(this.#g.sort(this.parameters.sortedBy),this.#et=this.parameters.sortedBy);let s=this.parameters.filter,o=JSON.stringify(s);return!this.#C()&&this.#it!==o&&(this.#g.applyFilter(s===null?null:{locale:this.#u.locale,timeZone:this.#u.timeZone,...s},"base"),this.#it=o),this.#Y({full:!0,rows:[]}),i}#ct(){this.isConnected&&this.#g&&!this.#j&&(this.#g.connect(),this.#j=this.#g.subscribe(t=>this.#Y(t)))}#ht(){this.#$!==null&&this.ownerDocument.defaultView.clearTimeout(this.#$),this.#$=null,this.#q=!1,this.#H.clear()}#Y({full:t,rows:e}){if(this.#q||=t,this.#q)this.#H.clear();else for(let i of e)this.#H.add(i);!this.isConnected||this.#$!==null||(this.#$=this.ownerDocument.defaultView.setTimeout(()=>{let i=this.#q,r=[...this.#H];this.#$=null,this.#q=!1,this.#H.clear();try{i?this.#gt():this.#mt(this.#i.viewFields.size?[...this.#f.keys()]:r)}catch(s){this.#q=!0,this.#u.reportError(s,"Grid refresh")}},0))}#mt(t){for(let i of t)this.#m.forget(i);this.#l.update(this.#i,this.#tt().getRows());let e=new E(this.#i,this.#u.format).read(this.#p.columns,t.filter(i=>this.#f.has(i)));this.#R.cancel();for(let{node:i,cells:r}of e)this.#ut(this.#f.get(i),r,i);this.#z()}#gt(){let t=this.#v?new nt(this.#E):this.#p,e=this.#tt();this.#i.configure(t,this.#g,e),this.#xt(),this.#r.requireEditableTools(t.columns),this.#h.prune();let i=this.#v;this.#o.configure(t.columns),this.#p=t,this.#e.configure();let r=this.#g.getRows();this.#R.cancel(),this.#R.cancelDrag(),this.#m.retain(this.#t.getNodes()),this.#v&&this.#m.resetMeasurements();let s=this.#C();this.#m.setWindow(s),this.#m.setRows(r),this.#O=r,s&&this.#c!==s.revision&&(this.#M=!1,this.#_(0),this.#y=null),this.#c=s?.revision,this.#v=!1,B(this.#u.sourceNode).update(this.#g,t.columns.filter(a=>!a.check&&!this.#i.viewFields.has(a.field)));let o=this.parameters.rowHeaders||this.parameters.rowResize,n=JSON.stringify([t.groups,o,this.parameters.columnFilters,this.parameters.footer]);this.#D=o,n!==this.#b&&(this.#l.configure(this.parameters.footer,t.columns,o),this.#At(t),this.#b=n),this.#l.update(this.#i,e.getRows()),this.#bt(i),this.#s.update(this.#g,t.columns,this.parameters.columnFilters,this.#u.format),this.#Et(),this.#K(!0),this.#Q(),this.control.setAttribute("aria-colcount",String(t.columns.length+Number(this.#D))),this.control.setAttribute("aria-rowcount",String(this.#I+Math.max(this.#m.count,1))),this.#z()}#bt(t){let e=this.#u.sourceNode.formState;if(e===this.#a){t&&e?.updateChanges();return}this.#n?.(),this.#a=e,this.#n=e===null?null:e.registerDerived(i=>this.#wt(i))}#wt(t){let e=this.#a.path,i=n=>n===e?"":n.startsWith(e+".")?n.slice(e.length+1):null;if(this.#l.totalPaths().some(n=>i(n)===t)||this.#h.paths().some(n=>{let a=i(n);return a!==null&&(t===a||t.startsWith(a+".")||t.startsWith(a+"?"))}))return!0;let r=i(this.#u.sourceNode.absDatapath(this.parameters.storepath));if(r===null||r!==""&&!t.startsWith(r+"."))return!1;let s=r===""?t:t.slice(r.length+1),o=(this.parameters.rowMode==="attributes"?/^[^.?]+\?([^.?]+)$/:/^[^.?]+\.([^.?]+)$/).exec(s)?.[1];return o!==void 0&&this.#i.dataFields.has(o)}#J(){let t=this.parameters.selectionMode;if(!mt.includes(t))throw new TypeError("grid selectionMode requires none, single or multi");return t}#yt(t){return this.parameters.rowMode==="attributes"?{...t.getAttr()}:Object.fromEntries(t.staticValue.getNodes().filter(e=>!(e.staticValue instanceof J)).map(e=>[e.label,e.staticValue]))}#Q(){let t=this.#J();t==="multi"?this.control.setAttribute("aria-multiselectable","true"):this.control.removeAttribute("aria-multiselectable");for(let[e,i]of this.#f){let r=this.#h.isSelected(e);t==="none"?i.removeAttribute("aria-selected"):i.setAttribute("aria-selected",String(r)),i.setAttribute("part",r?"row selected-row":"row")}}#vt(t,e){let i=this.#g.getRows().indexOf(t);this.#M=!1;let r=this.#m.offset(i),s=this.#m.offset(i+1);r<this.#d.scrollTop?this.#_(r):s>this.#d.scrollTop+this.#d.clientHeight&&this.#_(Math.max(0,s-this.#d.clientHeight)),this.#K(!0),e&&this.#f.get(t)?.querySelector(`td[data-field="${e}"]`)?.focus({preventScroll:!0})}#tt(){return this.#u.sourceNode.rootBuilder.binding.collectionStore(this.#t,this.parameters.rowMode)}#xt(){let t=this.#g,e=this.#i.viewFields,i=[...t.criteria.map(({field:o})=>["sort by",o]),...t.filterContributions.flatMap(([o,{definition:n}])=>o.startsWith("column:")?[["filter",o.slice(7)]]:o==="sets"?[]:n.columns.map(a=>["search",a]))],[r,s]=i.find(([,o])=>e.has(o))??[];if(s!==void 0)throw new TypeError(`grid cannot ${r} the view value '${s}'`)}#kt(t,e){if(!this.#p.columns.find(i=>i.field===t)?.check)try{if(this.#i.viewFields.has(t))throw new TypeError(`grid cannot sort by the view value '${t}'`);let i=this.#C()?K(this.#C().sortedBy):this.#g.criteria,r=i.find(a=>a.field===t),s=r?.direction==="a"?"d":"a",o=e?i.filter(a=>a.field!==t):[];e&&r?o.splice(i.indexOf(r),0,{field:t,direction:s}):o.push({field:t,direction:s});let n=o.map(a=>`${a.field}:${a.direction}`).join(",");this.#C()?this.#u.writeParameter("sortRequest",n):this.#g.sort(n)}catch(i){this.#u.reportError(i,"Grid sort")}}#Et(){let t=this.#C()?K(this.#C().sortedBy):this.#g.criteria;this.#nt();for(let e of this.#k.querySelectorAll("th[scope=col]")){let i=t.findIndex(r=>r.field===e.dataset.field);if(e.removeAttribute("aria-sort"),i<0)delete e.dataset.sortDirection,delete e.dataset.sortPriority,e.removeAttribute("aria-label");else{let r=t[i].direction==="a"?"ascending":"descending";e.dataset.sortDirection=r,e.dataset.sortPriority=String(i+1),i===0&&e.setAttribute("aria-sort",r),e.setAttribute("aria-label",`${e.textContent}, sort ${i+1}, ${r}`)}}}#At(t){this.#P.cancel();let e=this.shadowRoot.activeElement,i=e?.closest("th[data-field]")?.dataset.field,r=e?.classList.contains("column-resize"),s=this.ownerDocument,o=t.groups.some(h=>h.name!==null);this.#I=o?2:1;let n=s.createElement("tr"),a=s.createElement("tr");for(let[h,u]of[n,a].entries())u.setAttribute("role","row"),u.setAttribute("aria-rowindex",String(h+1));let d=(h,u,f,g,x,D="start")=>{let b=s.createElement("th");if(b.textContent=h,b.colSpan=u,b.rowSpan=f,b.scope=g,b.setAttribute("role","columnheader"),b.setAttribute("part",g==="colgroup"?"group-header":"column-header"),b.setAttribute("aria-colindex",String(x+1+Number(this.#D))),b.setAttribute("aria-colspan",String(u)),b.setAttribute("aria-rowspan",String(f)),b.style.textAlign=D,g==="col"){let W=s.createElement("span");W.className="column-caption",W.textContent=h,b.replaceChildren(W);let v=t.columns[x];b.dataset.field=v.field,b.draggable=!0,b.tabIndex=0,b.setAttribute("aria-label",v.title??v.name),b.title=v.check?(v.title??v.name)+" \xB7 Drag to reorder":"Click: ascending / descending \xB7 Shift-click: add or reverse this column without changing the others \xB7 Numbers show sort priority \xB7 Drag to reorder";let L=s.createElementNS(y,"svg");L.classList.add("sort-indicator"),L.setAttribute("viewBox","0 0 16 16"),L.setAttribute("aria-hidden","true");let tt=s.createElementNS(y,"path");tt.setAttribute("d","M4 10L8 6L12 10"),L.append(tt),b.append(L),this.parameters.columnFilters&&!v.check&&!this.#i.viewFields.has(v.field)&&b.append(this.#s.button(v));let k=s.createElement("span");k.className="column-resize",k.tabIndex=0,k.setAttribute("role","separator"),k.setAttribute("aria-orientation","vertical"),k.setAttribute("aria-valuemin","40"),k.setAttribute("aria-label",`Resize ${v.name}`),k.title="Drag to resize \xB7 Arrow keys adjust width",b.append(k)}return b};if(this.#D){let h=s.createElement("th");h.textContent="#",h.scope="col",h.className="row-heading",h.rowSpan=this.#I,h.setAttribute("role","columnheader"),h.setAttribute("aria-colindex","1"),h.setAttribute("aria-rowspan",String(this.#I)),h.setAttribute("part","row-header");let u=s.createElement("span");u.className="row-number-measure",u.setAttribute("aria-hidden","true");let f=s.createElement("span");f.className="column-resize",f.tabIndex=0,f.setAttribute("role","separator"),f.setAttribute("aria-orientation","vertical"),f.setAttribute("aria-label","Resize row numbers"),f.title="Drag to resize \xB7 Arrow keys adjust width",h.append(u,f),n.append(h)}let l=0;for(let h of t.groups)if(o&&h.name!==null){let u=d(h.name,h.columns.length,1,"colgroup",l,"center");u.style.background=h.background??"",u.style.color=h.color??"",n.append(u);for(let f of h.columns)a.append(d(f.name,1,1,"col",l++,f.align))}else for(let u of h.columns){if(o){let f=s.createElement("td");f.className="group-spacer",f.setAttribute("aria-hidden","true"),n.append(f)}(o?a:n).append(d(u.name,1,1,"col",l++,u.align))}this.#k.replaceChildren(n,...o?[a]:[]),i&&this.#k.querySelector(`th[data-field="${i}"]${r?" .column-resize":""}`)?.focus({preventScroll:!0});let p=t.columns.map(h=>h.width??"var(--gramlot-grid-column-width, 10rem)");this.#D&&p.unshift("max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))"),this.control.style.setProperty("--grid-columns-width",`calc(${p.join(" + ")})`);let m=this.parameters.footer===!1?[]:[this.#l.table];for(let h of[this.#T,this.#B,...m]){for(let u of h.querySelectorAll(":scope > colgroup"))u.remove();if(h.prepend(...t.groups.map(u=>{let f=s.createElement("colgroup");for(let g of u.columns){let x=s.createElement("col");x.style.width=g.width??"var(--gramlot-grid-column-width, 10rem)",f.append(x)}return f})),this.#D){let u=s.createElement("colgroup"),f=s.createElement("col");f.style.width="max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))",u.append(f),h.prepend(u)}}}#St(t,e,i){this.#R.cancel();let r=new Set,s=null;this.#w.querySelector(".empty")?.parentElement.remove();for(let{node:o,cells:n}of t){let a=this.#f.get(o);a||(a=this.ownerDocument.createElement("tr"),a.setAttribute("part","row"),a.setAttribute("role","row"),a.dataset.row=o.label,this.#f.set(o,a)),a.classList.toggle("alternate",(i+r.size)%2===1),a.setAttribute("part",this.#h.isSelected(o)?"row selected-row":"row"),this.#h.mode==="none"?a.removeAttribute("aria-selected"):a.setAttribute("aria-selected",String(this.#h.isSelected(o)));let d=this.#g.isFiltered();a.draggable=this.parameters.selfDragRows;let l=a.querySelector("th[scope=row]");if(this.#D){if(!l){l=this.ownerDocument.createElement("th"),l.scope="row",l.className="row-heading",l.setAttribute("role","rowheader"),l.setAttribute("part","row-header"),l.setAttribute("aria-colindex","1");let f=this.ownerDocument.createElement("span");f.className="row-number",l.append(f),a.prepend(l)}l.querySelector(".row-number").textContent=String(i+r.size+1),l.classList.toggle("filtered-numbering",d);let u=l.querySelector(".row-height-handle");this.parameters.rowResize?(u||(u=this.ownerDocument.createElement("span"),u.className="row-height-handle",u.tabIndex=0,u.setAttribute("role","separator"),u.setAttribute("aria-orientation","horizontal"),u.title="Drag to resize row \xB7 Double-click or Home resets \xB7 Arrow keys adjust height",l.append(u)),u.setAttribute("aria-label",`Resize row ${i+r.size+1}`)):u?.remove()}else l?.remove();let p=Number(this.#D),m=new Map([...a.querySelectorAll("td[data-field]")].map(u=>[u.dataset.field,u]));for(let[u,f]of e.entries()){let g=m.get(f.field);if(!g){g=this.ownerDocument.createElement("td"),g.setAttribute("part","cell"),g.dataset.field=f.field,g.setAttribute("role","cell");let b=this.ownerDocument.createElement("div");b.className="cell-content",b.setAttribute("part","cell-content"),g.append(b)}f.edit?g.tabIndex=0:g.removeAttribute("tabindex"),g.classList.toggle("filtered-numbering",d&&this.#i.viewFields.has(f.field));let x=g.firstElementChild,D=f.max_height!=null;D?g.style.setProperty("--grid-cell-max-height",f.max_height):g.style.removeProperty("--grid-cell-max-height"),x.classList.toggle("cell-scroll",D),D?x.tabIndex=0:x.removeAttribute("tabindex"),g.style.textAlign=f.align,g.style.whiteSpace=f.white_space??"",g.style.overflowWrap=f.white_space==="pre-wrap"||f.white_space==="normal"?"anywhere":"",g.setAttribute("aria-colindex",String(u+1+p)),g.classList.toggle("numeric",["L","R","N"].includes(f.dtype)),a.cells[u+p]!==g&&a.insertBefore(g,a.cells[u+p]??null),m.delete(f.field)}for(let u of m.values())u.remove();a.setAttribute("aria-rowindex",String(this.#I+i+r.size+1)),this.#ut(a,n,o),this.#o.decorate(a,o);let h=s?s.nextSibling:this.#w.firstChild;h!==a&&this.#w.insertBefore(a,h),this.#R.project(a,o),s=a,r.add(o)}for(let[o,n]of this.#f)r.has(o)||(n.remove(),this.#f.delete(o));if(!t.length&&this.#m.count===0&&!this.parameters.loading){let o=this.ownerDocument.createElement("tr"),n=this.ownerDocument.createElement("td");o.setAttribute("role","row"),o.setAttribute("aria-rowindex",String(this.#I+1)),n.setAttribute("role","cell"),n.setAttribute("aria-colspan",String(e.length+Number(this.#D))),n.className="empty",n.colSpan=e.length+Number(this.#D),n.textContent="No rows",o.append(n),this.#w.append(o)}}#ut(t,e,i){let r=Number(this.#D);e.forEach((s,o)=>{let n=t.cells[o+r].firstElementChild,a=this.#p.columns[o];if(n.parentElement.classList.toggle("check-cell",!!a.check),a.check){this.#e.project(n,i,a);return}if(a.edit?.tag==="colorpicker"){let l=n.querySelector(".cell-color-swatch");l||(l=this.ownerDocument.createElement("span"),l.className="cell-color-swatch",l.setAttribute("role","img"),n.replaceChildren(l)),l.hidden=s==="",l.style.backgroundColor=s,l.title=s,l.setAttribute("aria-label",s)}else(n.firstElementChild||n.textContent!==s)&&(n.textContent=s)})}}}),Q=class extends w.ComponentCollection{toDocument(){let t=super.toDocument(),e=t.elements.grid.attributes.parameters;for(let i of["storepath","rowMode"]){let r=e.find(s=>s.name===i);r.has_default=!1,delete r.default,i==="rowMode"&&(r.annotation={kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(values|attributes)$",flags:0}]})}return Object.assign(t.elements,structuredClone(kt.elements)),t.elements.grid._meta.parameterPattern="^selected_[A-Za-z_][A-Za-z0-9_]*$",t}},Ii=new Q({name:"grid",components:[te,xt],dependencies:[Qt],registerCommands:ut,assets:{writeExcelFileLicense:A["assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt"],fflateLicense:A["assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt"]}});export{te as Grid,Ii as default};
|