@gramlot/gramlot 0.3.30 → 0.3.31

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.
Files changed (37) hide show
  1. package/dist/components/charts/__init__.py +1 -1
  2. package/dist/components/charts/assets/collection.js +1 -1
  3. package/dist/components/charts/assets/index.js +1 -1
  4. package/dist/components/grid/__init__.py +2 -2
  5. package/dist/components/grid/assets/collection.js +36 -20
  6. package/dist/components/grid/assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt +21 -0
  7. package/dist/components/grid/assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt +21 -0
  8. package/dist/components/grid/assets/index.js +1 -1
  9. package/dist/components/grid/assets/modules/browser-LVJHKBBV.js +19 -0
  10. package/dist/components/grid/assets/modules/chunk-RMRBEYTI.js +1 -0
  11. package/dist/components/grid/commands.json +42 -1
  12. package/dist/components/grid/grammar.json +384 -2
  13. package/dist/components/vizabi/__init__.py +1 -1
  14. package/dist/components/vizabi/assets/collection.js +1 -1
  15. package/dist/components/vizabi/assets/index.js +1 -1
  16. package/dist/gramlot.js +376 -21
  17. package/dist/gramlot.min.js +46 -46
  18. package/dist/standard-collections.js +1 -1
  19. package/package.json +3 -2
  20. package/src/binding/grid-struct.js +4 -1
  21. package/src/binding/runtime.js +2 -1
  22. package/src/builder/gramlot-builder.js +96 -7
  23. package/src/builder/source.js +18 -0
  24. package/src/components/grid-footer.js +120 -0
  25. package/src/components/grid-formulas.js +403 -0
  26. package/src/components/grid-grammar.json +87 -2
  27. package/src/components/grid-selection.js +118 -0
  28. package/src/components/grid-structure.js +27 -4
  29. package/src/components/grid-styles.js +14 -1
  30. package/src/components/grid-tools.js +229 -0
  31. package/src/components/grid.js +174 -8
  32. package/src/components/licenses/fflate.txt +21 -0
  33. package/src/components/licenses/write-excel-file.txt +21 -0
  34. package/src/editing-session.d.ts +2 -0
  35. package/src/editing-session.js +35 -3
  36. package/src/stores/bag-collection-store.js +14 -5
  37. package/src/stores/bag-collection-view.js +1 -1
@@ -1,28 +1,31 @@
1
- var cl=Object.create;var Yn=Object.defineProperty;var dl=Object.getOwnPropertyDescriptor;var fl=Object.getOwnPropertyNames;var hl=Object.getPrototypeOf,pl=Object.prototype.hasOwnProperty;var Ge=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},ms=(t,e)=>{for(var r in e)Yn(t,r,{get:e[r],enumerable:!0})},Gn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fl(e))!pl.call(t,i)&&i!==r&&Yn(t,i,{get:()=>e[i],enumerable:!(n=dl(e,i))||n.enumerable});return t},Xt=(t,e,r)=>(Gn(t,e,"default"),r&&Gn(r,e,"default")),gs=(t,e,r)=>(r=t!=null?cl(hl(t)):{},Gn(e||!t||!t.__esModule?Yn(r,"default",{value:t,enumerable:!0}):r,t));var ht=Ge(se=>{"use strict";function Fu(t,e,r){if(r===void 0&&(r=Array.prototype),t&&typeof r.find=="function")return r.find.call(t,e);for(var n=0;n<t.length;n++)if(ft(t,n)){var i=t[n];if(e.call(void 0,i,n,t))return i}}function At(t,e){return e===void 0&&(e=Object),e&&typeof e.getOwnPropertyDescriptors=="function"&&(t=e.create(null,e.getOwnPropertyDescriptors(t))),e&&typeof e.freeze=="function"?e.freeze(t):t}function ft(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function $u(t,e){if(t===null||typeof t!="object")throw new TypeError("target is not an object");for(var r in e)ft(e,r)&&(t[r]=e[r]);return t}var Xs=At({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 qu(t){return ft(Xs,t.toLowerCase())}var Zs=At({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 Pu(t){return ft(Zs,t.toLowerCase())}var nr=At({script:!1,style:!1,textarea:!0,title:!0});function Uu(t){var e=t.toLowerCase();return ft(nr,e)&&!nr[e]}function ju(t){var e=t.toLowerCase();return ft(nr,e)&&nr[e]}function Ks(t){return t===ir.HTML}function zu(t){return Ks(t)||t===ir.XML_XHTML_APPLICATION}var ir=At({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Vu=Object.keys(ir).map(function(t){return ir[t]});function Hu(t){return Vu.indexOf(t)>-1}var Wu=At({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/"});se.assign=$u;se.find=Fu;se.freeze=At;se.HTML_BOOLEAN_ATTRIBUTES=Xs;se.HTML_RAW_TEXT_ELEMENTS=nr;se.HTML_VOID_ELEMENTS=Zs;se.hasDefaultHTMLNamespace=zu;se.hasOwn=ft;se.isHTMLBooleanAttribute=qu;se.isHTMLRawTextElement=Uu;se.isHTMLEscapableRawTextElement=ju;se.isHTMLMimeType=Ks;se.isHTMLVoidElement=Pu;se.isValidMimeType=Hu;se.MIME_TYPE=ir;se.NAMESPACE=Wu});var ur=Ge(lr=>{"use strict";var Gu=ht();function Qs(t,e){t.prototype=Object.create(Error.prototype,{constructor:{value:t},name:{value:t.name,enumerable:!0,writable:e}})}var ar=Gu.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"}),ea=Object.keys(ar);function ta(t){return typeof t=="number"&&t>=1&&t<=25}function Yu(t){return typeof t=="string"&&t.substring(t.length-ar.Error.length)===ar.Error}function or(t,e){ta(t)?(this.name=ea[t],this.message=e||""):(this.message=t,this.name=Yu(e)?e:ar.Error),Error.captureStackTrace&&Error.captureStackTrace(this,or)}Qs(or,!0);Object.defineProperties(or.prototype,{code:{enumerable:!0,get:function(){var t=ea.indexOf(this.name);return ta(t)?t:0}}});var ra={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},di=Object.entries(ra);for(sr=0;sr<di.length;sr++)Js=di[sr][0],or[Js]=di[sr][1];var Js,sr;function fi(t,e,r){this.message=t,this.locator=e,this.cause=r,Error.captureStackTrace&&Error.captureStackTrace(this,fi)}Qs(fi);lr.DOMException=or;lr.DOMExceptionName=ar;lr.ExceptionCode=ra;lr.ParseError=fi});var wi=Ge(C=>{"use strict";function la(t){try{typeof t!="function"&&(t=RegExp);var e=new t("\u{1D306}","u").exec("\u{1D306}");return!!e&&e[0].length===2}catch{}return!1}var Ct=la();function Qe(t){if(t.source[0]!=="[")throw new Error(t+" can not be used with chars");return t.source.slice(1,t.source.lastIndexOf("]"))}function Dt(t,e){if(t.source[0]!=="[")throw new Error("/"+t.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(t.source.indexOf(e)===-1)throw new Error('"'+e+'" is not is /'+t.source+"/");if(e==="-"&&t.source.indexOf(e)!==1)throw new Error('"'+e+'" is not at the first postion of /'+t.source+"/");return new RegExp(t.source.replace(e,""),Ct?"u":"")}function B(t){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(r){var n=typeof r=="string";if(n&&e===void 0&&r==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return n?r:r.source}).join(""),Ct?"u":"")}function D(t){if(arguments.length===0)throw new Error("no parameters provided");return B.apply(D,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var Xu="\uFFFD",et=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Ct&&(et=B("[",Qe(et),"\\u{10000}-\\u{10FFFF}","]"));var Zu=new RegExp("[^"+Qe(et)+"]",Ct?"u":""),nn=/[\x20\x09\x0D\x0A]/,Ku=Qe(nn),q=B(nn,"+"),j=B(nn,"*"),cr=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Ct&&(cr=B("[",Qe(cr),"\\u{10000}-\\u{10FFFF}","]"));var Ju=Qe(cr),mi=B("[",Ju,Qe(/[-.0-9\xB7]/),Qe(/[\u0300-\u036F\u203F-\u2040]/),"]"),we=B(cr,mi,"*"),Qu=B("^",we,"$"),na=B(mi,"+"),ec=B("&",we,";"),tc=D(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),dr=D(ec,"|",tc),fr=B("%",we,";"),gi=D(B('"',D(/[^%&"]/,"|",fr,"|",dr),"*",'"'),"|",B("'",D(/[^%&']/,"|",fr,"|",dr),"*","'")),rc=D('"',D(/[^<&"]/,"|",dr),"*",'"',"|","'",D(/[^<&']/,"|",dr),"*","'"),nc=Dt(cr,":"),ic=Dt(mi,":"),hi=B(nc,ic,"*"),sc=B("^",hi,"$"),hr=B(hi,D(":",hi),"?"),ac=B("^",hr,"$"),oc=B("(",hr,")"),Tt=D(/"[^"]*"|'[^']*'/),lc=B(/^<\?/,"(",we,")",D(q,"(?!",nn,")(",et,"*?)"),"?",/\?>/),ia=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,pr=D('"',ia,'*"',"|","'",Dt(ia,"'"),"*'"),ua="<!--",ca="-->",uc=B(ua,D(Dt(et,"-"),"|",B("-",Dt(et,"-"))),"*",ca),sa="#PCDATA",cc=D(B(/\(/,j,sa,D(j,/\|/,j,hr),"*",j,/\)\*/),"|",B(/\(/,j,sa,j,/\)/)),dc=/[?*+]?/,fc=B(/\([^>]+\)/,dc),hc=D("EMPTY","|","ANY","|",cc,"|",fc),pc="<!ELEMENT",mc=B(pc,q,D(hr,"|",fr),q,D(hc,"|",fr),j,">"),gc=B("NOTATION",q,/\(/,j,we,D(j,/\|/,j,we),"*",j,/\)/),bc=B(/\(/,j,na,D(j,/\|/,j,na),"*",j,/\)/),_c=D(gc,"|",bc),wc=D(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",_c),yc=D(/#REQUIRED|#IMPLIED/,"|",D(D("#FIXED",q),"?",rc)),vc=D(q,we,q,wc,q,yc),kc="<!ATTLIST",Ec=B(kc,q,we,vc,"*",j,">"),pi="about:legacy-compat",xc=D('"'+pi+'"',"|","'"+pi+"'"),bi="SYSTEM",sn="PUBLIC",an=D(D(bi,q,Tt),"|",D(sn,q,pr,q,Tt)),Ac=B("^",D(D(bi,q,"(?<SystemLiteralOnly>",Tt,")"),"|",D(sn,q,"(?<PubidLiteral>",pr,")",q,"(?<SystemLiteral>",Tt,")"))),Dc=B("^",pr,"$"),Tc=B("^",Tt,"$"),Cc=D(q,"NDATA",q,we),Nc=D(gi,"|",D(an,Cc,"?")),da="<!ENTITY",Sc=B(da,q,we,q,Nc,j,">"),Oc=D(gi,"|",an),Bc=B(da,q,"%",q,we,q,Oc,j,">"),Ic=D(Sc,"|",Bc),Mc=B(sn,q,pr),Rc=B("<!NOTATION",q,we,q,D(an,"|",Mc),j,">"),_i=B(j,"=",j),aa=/1[.]\d+/,Lc=B(q,"version",_i,D("'",aa,"'","|",'"',aa,'"')),oa=/[A-Za-z][-A-Za-z0-9._]*/,Fc=D(q,"encoding",_i,D('"',oa,'"',"|","'",oa,"'")),$c=D(q,"standalone",_i,D("'",D("yes","|","no"),"'","|",'"',D("yes","|","no"),'"')),qc=B(/^<\?xml/,Lc,Fc,"?",$c,"?",j,/\?>/),Pc="<!DOCTYPE",Uc="<![CDATA[",jc="]]>",zc=/<!\[CDATA\[/,Vc=/\]\]>/,Hc=B(et,"*?",Vc),Wc=B(zc,Hc);C.chars=Qe;C.chars_without=Dt;C.detectUnicodeSupport=la;C.reg=B;C.regg=D;C.ABOUT_LEGACY_COMPAT=pi;C.ABOUT_LEGACY_COMPAT_SystemLiteral=xc;C.AttlistDecl=Ec;C.CDATA_START=Uc;C.CDATA_END=jc;C.CDSect=Wc;C.Char=et;C.Comment=uc;C.COMMENT_START=ua;C.COMMENT_END=ca;C.DOCTYPE_DECL_START=Pc;C.elementdecl=mc;C.EntityDecl=Ic;C.EntityValue=gi;C.ExternalID=an;C.ExternalID_match=Ac;C.Name=we;C.Name_exact=Qu;C.NCName_exact=sc;C.NotationDecl=Rc;C.Reference=dr;C.PEReference=fr;C.PI=lc;C.PUBLIC=sn;C.PubidLiteral=pr;C.PubidLiteral_match=Dc;C.QName=hr;C.QName_exact=ac;C.QName_group=oc;C.S=q;C.SChar_s=Ku;C.S_OPT=j;C.SYSTEM=bi;C.SystemLiteral=Tt;C.SystemLiteral_match=Tc;C.InvalidChar=Zu;C.UNICODE_REPLACEMENT_CHARACTER=Xu;C.UNICODE_SUPPORT=Ct;C.XMLDecl=qc});var Ni=Ge(H=>{"use strict";var Ee=ht(),Ie=Ee.find,Gc=Ee.hasDefaultHTMLNamespace,St=Ee.hasOwn,Yc=Ee.isHTMLMimeType,Xc=Ee.isHTMLRawTextElement,Zc=Ee.isHTMLVoidElement,mr=Ee.MIME_TYPE,Me=Ee.NAMESPACE,fe=Symbol(),_a=ur(),v=_a.DOMException,ce=_a.DOMExceptionName,V=wi();function pe(t){if(t!==fe)throw new TypeError("Illegal constructor")}function Kc(t){return t!==""}function Jc(t){return t?t.split(/[\t\n\f\r ]+/).filter(Kc):[]}function Qc(t,e){return St(t,e)||(t[e]=!0),t}function fa(t){if(!t)return[];var e=Jc(t);return Object.keys(e.reduce(Qc,{}))}function ed(t){return function(e){return t&&t.indexOf(e)!==-1}}function wa(t){if(!V.QName_exact.test(t))throw new v(v.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+t+'"')}function vi(t,e){wa(e),t=t||null;var r=null,n=e;if(e.indexOf(":")>=0){var i=e.split(":");r=i[0],n=i[1]}if(r!==null&&t===null)throw new v(v.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(r==="xml"&&t!==Ee.NAMESPACE.XML)throw new v(v.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((r==="xmlns"||e==="xmlns")&&t!==Ee.NAMESPACE.XMLNS)throw new v(v.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===Ee.NAMESPACE.XMLNS&&r!=="xmlns"&&e!=="xmlns")throw new v(v.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,r,n]}function It(t,e){for(var r in t)St(t,r)&&(e[r]=t[r])}function me(t,e){var r=t.prototype;if(!(r instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,It(r,n),t.prototype=r=n}r.constructor!=t&&(typeof t!="function"&&console.error("unknown Class:"+t),r.constructor=t)}var ge={},ke=ge.ELEMENT_NODE=1,Ot=ge.ATTRIBUTE_NODE=2,gr=ge.TEXT_NODE=3,ya=ge.CDATA_SECTION_NODE=4,va=ge.ENTITY_REFERENCE_NODE=5,td=ge.ENTITY_NODE=6,ki=ge.PROCESSING_INSTRUCTION_NODE=7,Ei=ge.COMMENT_NODE=8,Nt=ge.DOCUMENT_NODE=9,ka=ge.DOCUMENT_TYPE_NODE=10,tt=ge.DOCUMENT_FRAGMENT_NODE=11,rd=ge.NOTATION_NODE=12,z=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 Ea(t,e){if(e.length<t.length)return Ea(e,t);var r=null;for(var n in t){if(t[n]!==e[n])return r;r=t[n]}return r}function ha(t){return t.guid||(t.guid=Math.random()),t.guid}function J(){}J.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t){var e;typeof t=="function"?e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:t}:t?e={requireWellFormed:!!t.requireWellFormed,splitCDATASections:t.splitCDATASections!==!1,nodeFilter:t.nodeFilter||null}:e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var r=[],n=0;n<this.length;n++)Ci(this[n],r,null,e);return r.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}};J.prototype[Symbol.iterator]=function(){var t=this,e=0;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Be(t,e){this._node=t,this._refresh=e,cn(this)}function cn(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var r=t._refresh(t._node);if(Ma(t,"length",r.length),!t.$$length||r.length<t.$$length)for(var n=r.length;n in t;n++)St(t,n)&&delete t[n];It(r,t),t._inc=e}}Be.prototype.item=function(t){return cn(this),this[t]||null};me(Be,J);function Bt(){this._nsIndex=Object.create(null),this._noNsIndex=Object.create(null)}function xa(t,e){for(var r=0;r<t.length;){if(t[r]===e)return r;r++}}function xi(t,e,r){if(!e)return t._noNsIndex;var n=t._nsIndex[e];return!n&&r&&(n=t._nsIndex[e]=Object.create(null)),n}function nd(t,e,r){var n=xi(t,e,!1),i=n&&n[r];return i||null}function id(t,e){xi(t,e.namespaceURI,!0)[e.localName]=e}function sd(t,e){var r=xi(t,e.namespaceURI,!1);r&&delete r[e.localName]}function ad(t,e,r,n){if(n?e[xa(e,n)]=r:(e[e.length]=r,e.length++),id(e,r),t){r.ownerElement=t;var i=t.ownerDocument;i&&(n&&Ta(i,t,n),od(i,t,r))}}function pa(t,e,r){var n=xa(e,r);if(n>=0){for(var i=e.length-1;n<=i;)e[n]=e[++n];if(e.length=i,sd(e,r),t){var s=t.ownerDocument;s&&Ta(s,t,r),r.ownerElement=null}}}Bt.prototype={length:0,item:J.prototype.item,getNamedItem:function(t){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());for(var e=0;e<this.length;){var r=this[e];if(r.nodeName===t)return r;e++}return null},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!==this._ownerElement)throw new v(v.INUSE_ATTRIBUTE_ERR);var r=nd(this,t.namespaceURI,t.localName);return r===t?t:(ad(this._ownerElement,this,t,r),r)},setNamedItemNS:function(t){return this.setNamedItem(t)},removeNamedItem:function(t){var e=this.getNamedItem(t);if(!e)throw new v(v.NOT_FOUND_ERR,t);return pa(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var r=this.getNamedItemNS(t,e);if(!r)throw new v(v.NOT_FOUND_ERR,t?t+" : "+e:e);return pa(this._ownerElement,this,r),r},getNamedItemNS:function(t,e){t||(t=null);for(var r=0;r<this.length;){var n=this[r];if(n.localName===e&&n.namespaceURI===t)return n;r++}return null}};Bt.prototype[Symbol.iterator]=function(){var t=this,e=0;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Aa(){}Aa.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,r){var n=mr.XML_APPLICATION;t===Me.HTML?n=mr.XML_XHTML_APPLICATION:t===Me.SVG&&(n=mr.XML_SVG_IMAGE);var i=new Ue(fe,{contentType:n});if(i.implementation=this,i.childNodes=new J,i.doctype=r||null,r&&i.appendChild(r),e){var s=i.createElementNS(t,e);i.appendChild(s)}return i},createDocumentType:function(t,e,r,n){wa(t);var i=new hn(fe);return i.name=t,i.nodeName=t,i.publicId=e||"",i.systemId=r||"",i.internalSubset=n||"",i.childNodes=new J,i},createHTMLDocument:function(t){var e=new Ue(fe,{contentType:mr.HTML});if(e.implementation=this,e.childNodes=new J,t!==!1){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var r=e.createElement("html");e.appendChild(r);var n=e.createElement("head");if(r.appendChild(n),typeof t=="string"){var i=e.createElement("title");i.appendChild(e.createTextNode(t)),n.appendChild(i)}r.appendChild(e.createElement("body"))}return e}};function I(t){pe(t)}I.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 t=this.getRootNode();return t&&t.nodeType===t.DOCUMENT_NODE},contains:function(t){if(!t)return!1;var e=t;do{if(this===e)return!0;e=e.parentNode}while(e);return!1},getRootNode:function(t){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},isEqualNode:function(t){if(!t)return!1;for(var e=[{node:this,other:t}];e.length>0;){var r=e.pop(),n=r.node,i=r.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 a=n.attributes.item(s),o=i.getAttributeNodeNS(a.namespaceURI,a.localName);if(!o)return!1;e.push({node:a,other:o})}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(t){return this===t},insertBefore:function(t,e){return un(this,t,e)},replaceChild:function(t,e){un(this,t,e,Sa),e&&this.removeChild(e)},removeChild:function(t){return Ca(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(t){return Ia(this.ownerDocument||this,this,t)},normalize:function(){ae(this,null,{enter:function(t){for(var e=t.firstChild;e;){var r=e.nextSibling;if(r!==null&&r.nodeType===gr&&e.nodeType===gr){for(var n=[],i=r;i!==null&&i.nodeType===gr;)n.push(i.data),i=i.nextSibling;for(var s=e.nextSibling;s!==i;){var a=s.nextSibling;s.parentNode=null,s.previousSibling=null,s.nextSibling=null,s=a}e.nextSibling=i,i!==null?i.previousSibling=e:t.lastChild=e,e.appendData(n.join("")),Ai(t.ownerDocument,t),e=i}else e=r}return!0}})},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},lookupPrefix:function(t){for(var e=this;e;){var r=e._nsMap;if(r){for(var n in r)if(St(r,n)&&r[n]===t)return n}e=e.nodeType==Ot?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var r=e._nsMap;if(r&&St(r,t))return r[t];e=e.nodeType==Ot?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null},compareDocumentPosition:function(t){if(this===t)return 0;var e=t,r=this,n=null,i=null;if(e instanceof pt&&(n=e,e=n.ownerElement),r instanceof pt&&(i=r,r=i.ownerElement,n&&e&&r===e))for(var s=0,a;a=r.attributes[s];s++){if(a===n)return z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+z.DOCUMENT_POSITION_PRECEDING;if(a===i)return z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+z.DOCUMENT_POSITION_FOLLOWING}if(!e||!r||r.ownerDocument!==e.ownerDocument)return z.DOCUMENT_POSITION_DISCONNECTED+z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(ha(r.ownerDocument)>ha(e.ownerDocument)?z.DOCUMENT_POSITION_FOLLOWING:z.DOCUMENT_POSITION_PRECEDING);if(i&&e===r)return z.DOCUMENT_POSITION_CONTAINS+z.DOCUMENT_POSITION_PRECEDING;if(n&&e===r)return z.DOCUMENT_POSITION_CONTAINED_BY+z.DOCUMENT_POSITION_FOLLOWING;for(var o=[],u=e.parentNode;u;){if(!i&&u===r)return z.DOCUMENT_POSITION_CONTAINED_BY+z.DOCUMENT_POSITION_FOLLOWING;o.push(u),u=u.parentNode}o.reverse();for(var l=[],c=r.parentNode;c;){if(!n&&c===e)return z.DOCUMENT_POSITION_CONTAINS+z.DOCUMENT_POSITION_PRECEDING;l.push(c),c=c.parentNode}l.reverse();var d=Ea(o,l);for(var f in d.childNodes){var h=d.childNodes[f];if(h===r)return z.DOCUMENT_POSITION_FOLLOWING;if(h===e)return z.DOCUMENT_POSITION_PRECEDING;if(l.indexOf(h)>=0)return z.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(h)>=0)return z.DOCUMENT_POSITION_PRECEDING}return 0}};function Da(t){return t=="<"&&"&lt;"||t==">"&&"&gt;"||t=="&"&&"&amp;"||t=='"'&&"&quot;"||"&#"+t.charCodeAt()+";"}It(ge,I);It(ge,I.prototype);It(z,I);It(z,I.prototype);function ln(t,e){ae(t,null,{enter:function(r){return e(r)?ae.STOP:!0}})}function ae(t,e,r){for(var n=[{node:t,context:e,phase:ae.ENTER}];n.length>0;){var i=n.pop();if(i.phase===ae.ENTER){var s=r.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 a=i.node.lastChild;a;)n.push({node:a,context:s,phase:ae.ENTER}),a=a.previousSibling}else r.exit&&r.exit(i.node,i.context)}}ae.STOP=Symbol("walkDOM.STOP");ae.ENTER=0;ae.EXIT=1;function Ue(t,e){pe(t);var r=e||{};this.ownerDocument=this,this.contentType=r.contentType||mr.XML_APPLICATION,this.type=Yc(this.contentType)?"html":"xml"}function od(t,e,r){t&&t._inc++;var n=r.namespaceURI;n===Me.XMLNS&&(e._nsMap[r.prefix?r.localName:""]=r.value)}function Ta(t,e,r,n){t&&t._inc++;var i=r.namespaceURI;i===Me.XMLNS&&delete e._nsMap[r.prefix?r.localName:""]}function Ai(t,e,r){if(t&&t._inc){t._inc++;var n=e.childNodes;if(r&&!r.nextSibling)n[n.length++]=r;else{for(var i=e.firstChild,s=0;i;)n[s++]=i,i=i.nextSibling;n.length=s,delete n[n.length]}}}function Ca(t,e){if(t!==e.parentNode)throw new v(v.NOT_FOUND_ERR,"child's parent is not parent");var r=e.previousSibling,n=e.nextSibling;return r?r.nextSibling=n:t.firstChild=n,n?n.previousSibling=r:t.lastChild=r,Ai(t.ownerDocument,t),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function ld(t){return t&&(t.nodeType===I.DOCUMENT_NODE||t.nodeType===I.DOCUMENT_FRAGMENT_NODE||t.nodeType===I.ELEMENT_NODE)}function ud(t){return t&&(t.nodeType===I.CDATA_SECTION_NODE||t.nodeType===I.COMMENT_NODE||t.nodeType===I.DOCUMENT_FRAGMENT_NODE||t.nodeType===I.DOCUMENT_TYPE_NODE||t.nodeType===I.ELEMENT_NODE||t.nodeType===I.PROCESSING_INSTRUCTION_NODE||t.nodeType===I.TEXT_NODE)}function rt(t){return t&&t.nodeType===I.DOCUMENT_TYPE_NODE}function Pe(t){return t&&t.nodeType===I.ELEMENT_NODE}function Na(t){return t&&t.nodeType===I.TEXT_NODE}function ma(t,e){var r=t.childNodes||[];if(Ie(r,Pe)||rt(e))return!1;var n=Ie(r,rt);return!(e&&n&&r.indexOf(n)>r.indexOf(e))}function ga(t,e){var r=t.childNodes||[];function n(s){return Pe(s)&&s!==e}if(Ie(r,n))return!1;var i=Ie(r,rt);return!(e&&i&&r.indexOf(i)>r.indexOf(e))}function cd(t,e,r){if(!ld(t))throw new v(v.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+t.nodeType);if(r&&r.parentNode!==t)throw new v(v.NOT_FOUND_ERR,"child not in parent");if(!ud(e)||rt(e)&&t.nodeType!==I.DOCUMENT_NODE)throw new v(v.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function dd(t,e,r){var n=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===I.DOCUMENT_FRAGMENT_NODE){var s=i.filter(Pe);if(s.length>1||Ie(i,Na))throw new v(v.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!ma(t,r))throw new v(v.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Pe(e)&&!ma(t,r))throw new v(v.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(rt(e)){if(Ie(n,rt))throw new v(v.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=Ie(n,Pe);if(r&&n.indexOf(a)<n.indexOf(r))throw new v(v.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!r&&a)throw new v(v.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Sa(t,e,r){var n=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===I.DOCUMENT_FRAGMENT_NODE){var s=i.filter(Pe);if(s.length>1||Ie(i,Na))throw new v(v.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!ga(t,r))throw new v(v.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Pe(e)&&!ga(t,r))throw new v(v.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(rt(e)){if(Ie(n,function(u){return rt(u)&&u!==r}))throw new v(v.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=Ie(n,Pe);if(r&&n.indexOf(a)<n.indexOf(r))throw new v(v.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function un(t,e,r,n){cd(t,e,r),t.nodeType===I.DOCUMENT_NODE&&(n||dd)(t,e,r);var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===tt){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var o=r?r.previousSibling:t.lastChild;s.previousSibling=o,a.nextSibling=r,o?o.nextSibling=s:t.firstChild=s,r==null?t.lastChild=a:r.previousSibling=a;do s.parentNode=t;while(s!==a&&(s=s.nextSibling));return Ai(t.ownerDocument||t,t,e),e.nodeType==tt&&(e.firstChild=e.lastChild=null),e}Ue.prototype={implementation:null,nodeName:"#document",nodeType:Nt,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType===tt){for(var r=t.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,e),r=n}return t}return un(this,t,e),t.ownerDocument=this,this.documentElement===null&&t.nodeType===ke&&(this.documentElement=t),t},removeChild:function(t){var e=Ca(this,t);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(t,e){un(this,t,e,Sa),t.ownerDocument=this,e&&this.removeChild(e),Pe(t)&&(this.documentElement=t)},importNode:function(t,e){return fd(this,t,e)},getElementById:function(t){var e=null;return ln(this.documentElement,function(r){if(r.nodeType==ke&&r.getAttribute("id")==t)return e=r,!0}),e},createElement:function(t){var e=new je(fe);e.ownerDocument=this,this.type==="html"&&(t=t.toLowerCase()),Gc(this.contentType)&&(e.namespaceURI=Me.HTML),e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new J;var r=e.attributes=new Bt;return r._ownerElement=e,e},createDocumentFragment:function(){var t=new Mt(fe);return t.ownerDocument=this,t.childNodes=new J,t},createTextNode:function(t){var e=new br(fe);return e.ownerDocument=this,e.childNodes=new J,e.appendData(t),e},createComment:function(t){var e=new dn(fe);return e.ownerDocument=this,e.childNodes=new J,e.appendData(t),e},createCDATASection:function(t){if(t.indexOf("]]>")!==-1)throw new v(v.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new fn(fe);return e.ownerDocument=this,e.childNodes=new J,e.appendData(t),e},createProcessingInstruction:function(t,e){var r=new mn(fe);return r.ownerDocument=this,r.childNodes=new J,r.nodeName=r.target=t,r.nodeValue=r.data=e,r},createAttribute:function(t){if(!V.QName_exact.test(t))throw new v(v.INVALID_CHARACTER_ERR,'invalid character in name "'+t+'"');return this.type==="html"&&(t=t.toLowerCase()),this._createAttribute(t)},_createAttribute:function(t){var e=new pt(fe);return e.ownerDocument=this,e.childNodes=new J,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){if(!V.Name_exact.test(t))throw new v(v.INVALID_CHARACTER_ERR,'not a valid xml name "'+t+'"');if(this.type==="html")throw new v("document is an html document",ce.NotSupportedError);var e=new pn(fe);return e.ownerDocument=this,e.childNodes=new J,e.nodeName=t,e},createElementNS:function(t,e){var r=vi(t,e),n=new je(fe),i=n.attributes=new Bt;return n.childNodes=new J,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=r[0],n.prefix=r[1],n.localName=r[2],i._ownerElement=n,n},createAttributeNS:function(t,e){var r=vi(t,e),n=new pt(fe);return n.ownerDocument=this,n.childNodes=new J,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=r[0],n.prefix=r[1],n.localName=r[2],n}};me(Ue,I);function je(t){pe(t),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===Me.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(t){return!!this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e?e.value:null},getAttributeNode:function(t){return this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase()),this.attributes.getNamedItem(t)},setAttribute:function(t,e){this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());var r=this.getAttributeNode(t);r?r.value=r.nodeValue=""+e:(r=this.ownerDocument._createAttribute(t),r.value=r.nodeValue=""+e,this.setAttributeNode(r))},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var r=this.getAttributeNodeNS(t,e);r&&this.removeAttributeNode(r)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var r=this.getAttributeNodeNS(t,e);return r?r.value:null},setAttributeNS:function(t,e,r){var n=vi(t,e),i=n[2],s=this.getAttributeNodeNS(t,i);s?s.value=s.nodeValue=""+r:(s=this.ownerDocument.createAttributeNS(t,e),s.value=s.nodeValue=""+r,this.setAttributeNode(s))},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByClassName:function(t){var e=fa(t);return new Be(this,function(r){var n=[];return e.length>0&&ln(r,function(i){if(i!==r&&i.nodeType===ke){var s=i.getAttribute("class");if(s){var a=t===s;if(!a){var o=fa(s);a=e.every(ed(o))}a&&n.push(i)}}}),n})},getElementsByTagName:function(t){var e=(this.nodeType===Nt?this:this.ownerDocument).type==="html",r=t.toLowerCase();return new Be(this,function(n){var i=[];return ln(n,function(s){if(!(s===n||s.nodeType!==ke))if(t==="*")i.push(s);else{var a=s.getQualifiedName(),o=e&&s.namespaceURI===Me.HTML?r:t;a===o&&i.push(s)}}),i})},getElementsByTagNameNS:function(t,e){return new Be(this,function(r){var n=[];return ln(r,function(i){i!==r&&i.nodeType===ke&&(t==="*"||i.namespaceURI===t)&&(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,I);function pt(t){pe(t),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}pt.prototype.nodeType=Ot;me(pt,I);function nt(t){pe(t)}nt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,r){var n=this.data.substring(0,t),i=this.data.substring(t+e);r=n+r+i,this.nodeValue=this.data=r,this.length=r.length}};me(nt,I);function br(t){pe(t)}br.prototype={nodeName:"#text",nodeType:gr,splitText:function(t){var e=this.data,r=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};me(br,nt);function dn(t){pe(t)}dn.prototype={nodeName:"#comment",nodeType:Ei};me(dn,nt);function fn(t){pe(t)}fn.prototype={nodeName:"#cdata-section",nodeType:ya};me(fn,br);function hn(t){pe(t)}hn.prototype.nodeType=ka;me(hn,I);function Di(t){pe(t)}Di.prototype.nodeType=rd;me(Di,I);function Ti(t){pe(t)}Ti.prototype.nodeType=td;me(Ti,I);function pn(t){pe(t)}pn.prototype.nodeType=va;me(pn,I);function Mt(t){pe(t)}Mt.prototype.nodeName="#document-fragment";Mt.prototype.nodeType=tt;me(Mt,I);function mn(t){pe(t)}mn.prototype.nodeType=ki;me(mn,nt);function Oa(){}Oa.prototype.serializeToString=function(t,e){return Ba.call(t,e)};I.prototype.toString=Ba;function Ba(t){var e;typeof t=="function"?e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:t}:t!=null?e={requireWellFormed:!!t.requireWellFormed,splitCDATASections:t.splitCDATASections!==!1,nodeFilter:t.nodeFilter||null}:e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var r=[],n=this.nodeType===Nt&&this.documentElement||this,i=n.prefix,s=n.namespaceURI;if(s&&i==null){var i=n.lookupPrefix(s);if(i==null)var a=[{namespace:s,prefix:null}]}return Ci(this,r,a,e),r.join("")}function ba(t,e,r){var n=t.prefix||"",i=t.namespaceURI;if(!i||n==="xml"&&i===Me.XML||i===Me.XMLNS)return!1;for(var s=r.length;s--;){var a=r[s];if(a.prefix===n)return a.namespace!==i}return!0}function on(t,e,r,n){if(n&&!V.QName_exact.test(e))throw new v('The attribute name "'+e+'" is not a valid XML QName',ce.InvalidStateError);t.push(" ",e,'="',r.replace(/[<>&"\t\n\r]/g,Da),'"')}function Ci(t,e,r,n){r||(r=[]);var i=n.nodeFilter,s=n.requireWellFormed,a=n.splitCDATASections,o=t.nodeType===Nt?t:t.ownerDocument,u=o.type==="html";ae(t,{ns:r},{enter:function(l,c){var d=c.ns;if(i)if(l=i(l),l){if(typeof l=="string")return e.push(l),null}else return null;switch(l.nodeType){case ke:var f=l.attributes,h=f.length,p=l.tagName,m=p;if(!u&&!l.prefix&&l.namespaceURI){for(var g,_=0;_<f.length;_++)if(f.item(_).name==="xmlns"){g=f.item(_).value;break}if(!g)for(var w=d.length-1;w>=0;w--){var y=d[w];if(y.prefix===""&&y.namespace===l.namespaceURI){g=y.namespace;break}}if(g!==l.namespaceURI)for(var w=d.length-1;w>=0;w--){var y=d[w];if(y.namespace===l.namespaceURI){y.prefix&&(m=y.prefix+":"+p);break}}}if(s&&!V.QName_exact.test(m))throw new v('The element name "'+m+'" is not a valid XML QName',ce.InvalidStateError);e.push("<",m);for(var k=d.slice(),S=0;S<h;S++){var R=f.item(S);R.prefix=="xmlns"?k.push({prefix:R.localName,namespace:R.value}):R.nodeName=="xmlns"&&k.push({prefix:"",namespace:R.value})}for(var S=0;S<h;S++){var R=f.item(S);if(ba(R,u,k)){var F=R.prefix||"",re=R.namespaceURI;on(e,F?"xmlns:"+F:"xmlns",re,s),k.push({prefix:F,namespace:re})}var ne=i?i(R):R;ne&&(typeof ne=="string"?e.push(ne):on(e,ne.name,ne.value,s))}if(p===m&&ba(l,u,k)){var $e=l.prefix||"",re=l.namespaceURI;on(e,$e?"xmlns:"+$e:"xmlns",re,s),k.push({prefix:$e,namespace:re})}var Z=!l.firstChild;if(Z&&(u||l.namespaceURI===Me.HTML)&&(Z=Zc(p)),Z)return e.push("/>"),null;if(e.push(">"),u&&Xc(p)){for(var de=l.firstChild;de;)de.data?e.push(de.data):Ci(de,e,k.slice(),n),de=de.nextSibling;return e.push("</",m,">"),null}return{ns:k,tag:m};case Nt:case tt:if(s&&l.nodeType===Nt&&l.documentElement==null)throw new v("The Document has no documentElement",ce.InvalidStateError);return{ns:d};case Ot:return on(e,l.name,l.value,s),null;case gr:if(s&&V.InvalidChar.test(l.data))throw new v("The Text node data contains characters outside the XML Char production",ce.InvalidStateError);return e.push(l.data.replace(/[<&>]/g,Da)),null;case ya:if(s&&l.data.indexOf("]]>")!==-1)throw new v('The CDATASection data contains "]]>"',ce.InvalidStateError);return a?e.push(V.CDATA_START,l.data.replace(/]]>/g,"]]]]><![CDATA[>"),V.CDATA_END):e.push(V.CDATA_START,l.data,V.CDATA_END),null;case Ei:if(s){if(V.InvalidChar.test(l.data))throw new v("The comment node data contains characters outside the XML Char production",ce.InvalidStateError);if(l.data.indexOf("--")!==-1||l.data[l.data.length-1]==="-")throw new v('The comment node data contains "--" or ends with "-"',ce.InvalidStateError)}return e.push(V.COMMENT_START,l.data,V.COMMENT_END),null;case ka:var ye=l.publicId,P=l.systemId;if(s){if(!V.Name_exact.test(l.name))throw new v('The doctype name "'+l.name+'" is not a valid XML Name',ce.InvalidStateError);if(ye&&!V.PubidLiteral_match.test(ye))throw new v("DocumentType publicId is not a valid PubidLiteral",ce.InvalidStateError);if(P&&P!=="."&&!V.SystemLiteral_match.test(P))throw new v("DocumentType systemId is not a valid SystemLiteral",ce.InvalidStateError);if(l.internalSubset&&l.internalSubset.indexOf("]>")!==-1)throw new v('DocumentType internalSubset contains "]>"',ce.InvalidStateError)}return e.push(V.DOCTYPE_DECL_START," ",l.name),ye?(e.push(" ",V.PUBLIC," ",ye),P&&P!=="."&&e.push(" ",P)):P&&P!=="."&&e.push(" ",V.SYSTEM," ",P),l.internalSubset&&e.push(" [",l.internalSubset,"]"),e.push(">"),null;case ki:if(s){if(!V.NCName_exact.test(l.target)||l.target.toLowerCase()==="xml")throw new v('The processing instruction target "'+l.target+'" is not a valid XML NCName or is reserved',ce.InvalidStateError);if(V.InvalidChar.test(l.data))throw new v("The ProcessingInstruction data contains characters outside the XML Char production",ce.InvalidStateError);if(l.data.indexOf("?>")!==-1)throw new v('The ProcessingInstruction data contains "?>"',ce.InvalidStateError)}return e.push("<?",l.target," ",l.data,"?>"),null;case va:if(s&&!V.Name_exact.test(l.nodeName))throw new v('The entity reference name "'+l.nodeName+'" is not a valid XML Name',ce.InvalidStateError);return e.push("&",l.nodeName,";"),null;default:return e.push("??",l.nodeName),null}},exit:function(l,c){c&&c.tag&&e.push("</",c.tag,">")}})}function fd(t,e,r){var n;return ae(e,null,{enter:function(i,s){var a=i.cloneNode(!1);a.ownerDocument=t,a.parentNode=null,s===null?n=a:s.appendChild(a);var o=i.nodeType===Ot||r;return o?a:null}}),n}function Ia(t,e,r){var n;return ae(e,null,{enter:function(i,s){var a=new i.constructor(fe);for(var o in i)if(St(i,o)){var u=i[o];typeof u!="object"&&u!=a[o]&&(a[o]=u)}i.childNodes&&(a.childNodes=new J),a.ownerDocument=t;var l=r;switch(a.nodeType){case ke:var c=i.attributes,d=a.attributes=new Bt,f=c.length;d._ownerElement=a;for(var h=0;h<f;h++)a.setAttributeNode(Ia(t,c.item(h),!0));break;case Ot:l=!0}return s!==null?s.appendChild(a):n=a,l?a:null}}),n}function Ma(t,e,r){t[e]=r}function yi(t){for(var e=[],r=t.firstChild;r;)r.nodeType===ke&&e.push(r),r=r.nextSibling;return e}try{Object.defineProperty&&(Object.defineProperty(Be.prototype,"length",{get:function(){return cn(this),this.$$length}}),Object.defineProperty(I.prototype,"textContent",{get:function(){if(this.nodeType===ke||this.nodeType===tt){var t=[];return ae(this,null,{enter:function(e){if(e.nodeType===ke||e.nodeType===tt)return!0;if(e.nodeType===ki||e.nodeType===Ei)return null;t.push(e.nodeValue)}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case ke:case tt:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Object.defineProperty(nt.prototype,"data",{get:function(){return this._data!=null?this._data:""},set:function(t){this._data=t,this.length=typeof t=="string"?t.length:0}}),Object.defineProperty(nt.prototype,"nodeValue",{get:function(){return this.data},set:function(t){this.data=t},enumerable:!0,configurable:!0}),Object.defineProperty(je.prototype,"children",{get:function(){return new Be(this,yi)}}),Object.defineProperty(Ue.prototype,"children",{get:function(){return new Be(this,yi)}}),Object.defineProperty(Mt.prototype,"children",{get:function(){return new Be(this,yi)}}),Ma=function(t,e,r){t["$$"+e]=r})}catch{}H._updateLiveList=cn;H.Attr=pt;H.CDATASection=fn;H.CharacterData=nt;H.Comment=dn;H.Document=Ue;H.DocumentFragment=Mt;H.DocumentType=hn;H.DOMImplementation=Aa;H.Element=je;H.Entity=Ti;H.EntityReference=pn;H.LiveNodeList=Be;H.NamedNodeMap=Bt;H.Node=I;H.NodeList=J;H.Notation=Di;H.Text=br;H.ProcessingInstruction=mn;H.walkDOM=ae;H.XMLSerializer=Oa});var La=Ge(_r=>{"use strict";var Ra=ht().freeze;_r.XML_ENTITIES=Ra({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});_r.HTML_ENTITIES=Ra({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"});_r.entityMap=_r.HTML_ENTITIES});var Ha=Ge(bn=>{"use strict";var qt=ht(),N=wi(),Pa=ur(),hd=qt.isHTMLEscapableRawTextElement,pd=qt.isHTMLMimeType,md=qt.isHTMLRawTextElement,vr=qt.hasOwn,Fa=qt.NAMESPACE,gd=Pa.ParseError,bd=Pa.DOMException,Rt=0,it=1,Lt=2,wr=3,Ft=4,$t=5,yr=6,gn=7;function Ua(){}Ua.prototype={parse:function(t,e,r){var n=this.domBuilder;n.startDocument(),vd(e,e=Object.create(null)),_d(t,e,r,n,this.errorHandler),n.endDocument()}};var Si=/&#?\w+;?/g;function _d(t,e,r,n,i){var s=pd(n.mimeType);t.indexOf(N.UNICODE_REPLACEMENT_CHARACTER)>=0&&i.warning("Unicode replacement character detected, source encoding issues?");function a(L){if(L>65535){L-=65536;var ve=55296+(L>>10),qr=56320+(L&1023);return String.fromCharCode(ve,qr)}else return String.fromCharCode(L)}function o(L){var ve=L[L.length-1]===";"?L:L+";";if(!s&&ve!==L)return i.error("EntityRef: expecting ;"),L;var qr=N.Reference.exec(ve);if(!qr||qr[0].length!==ve.length)return i.error("entity not matching Reference production: "+L),L;var Pr=ve.slice(1,-1);return vr(r,Pr)?r[Pr]:Pr.charAt(0)==="#"?a(parseInt(Pr.substring(1).replace("x","0x"))):(i.error("entity not found:"+L),L)}function u(L){if(L>g){var ve=t.substring(g,L).replace(Si,o);f&&h(g),n.characters(ve,0,L-g),g=L}}var l=0,c=0,d=/\r\n?|\n|$/g,f=n.locator;function h(L,ve){for(;L>=c&&(ve=d.exec(t));)l=c,c=ve.index+ve[0].length,f.lineNumber++;f.columnNumber=L-l+1}for(var p=[{currentNSMap:e}],m=[],g=0;;){try{var _=t.indexOf("<",g);if(_<0){if(!s&&m.length>0)return i.fatalError("unclosed xml tag(s): "+m.join(", "));if(!t.substring(g).match(/^\s*$/)){var w=n.doc,y=w.createTextNode(t.substring(g));if(w.documentElement)return i.error("Extra content at the end of the document");w.appendChild(y),n.currentElement=y}return}if(_>g){var k=t.substring(g,_);!s&&m.length===0&&(k=k.replace(new RegExp(N.S_OPT.source,"g"),""),k&&i.error("Unexpected content outside root element: '"+k+"'")),u(_)}switch(t.charAt(_+1)){case"/":var O=t.indexOf(">",_+2),S=t.substring(_+2,O>0?O:void 0);if(!S)return i.fatalError("end tag name missing");var R=N.reg("^",N.QName_group,N.S_OPT,"$"),F=O>0&&R.exec(S);if(!F){var re=O>0&&N.reg("^",N.QName_group).exec(S);if(s&&re)i.warning('end tag name contains invalid trailing characters: "'+S+'"'),F=re;else if(re&&new RegExp(R.source,R.flags+"m").test(S))i.error('end tag name is followed by a line break and trailing content: "'+S+'"'),F=re;else return i.fatalError('end tag name contains invalid characters: "'+S+'"')}if(!n.currentElement&&!n.doc.documentElement)return;var ne=m[m.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(ne!==F[1]){var $e=F[1].toLowerCase();if(!s||ne.toLowerCase()!==$e)return i.fatalError('Opening and ending tag mismatch: "'+ne+'" != "'+S+'"')}var Z=p.pop();m.pop();var de=Z.localNSMap;if(n.endElement(Z.uri,Z.localName,ne),de)for(var ye in de)vr(de,ye)&&n.endPrefixMapping(ye);O++;break;case"?":f&&h(_),O=Ed(t,_,n,i);break;case"!":f&&h(_),O=za(t,_,n,i,s);break;default:f&&h(_);var P=new Va,Y=p[p.length-1].currentNSMap,O=wd(t,_,P,Y,o,i,s),hs=P.length;if(P.closed||(s&&qt.isHTMLVoidElement(P.tagName)?P.closed=!0:m.push(P.tagName)),f&&hs){for(var ul=$a(f,{}),Wn=0;Wn<hs;Wn++){var ps=P[Wn];h(ps.offset),ps.locator=$a(f,{})}n.locator=ul,qa(P,n,Y)&&p.push(P),n.locator=f}else qa(P,n,Y)&&p.push(P);s&&!P.closed?O=yd(t,O,P.tagName,o,n):O++}}catch(L){if(L instanceof gd)throw L;if(L instanceof bd)return i.fatalError("Error constructing the DOM: "+L.name+": "+L.message,L);i.error("element parse error: "+L),O=-1}O>g?g=O:u(Math.max(_,g)+1)}}function $a(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function wd(t,e,r,n,i,s,a){function o(h,p,m){if(vr(r.attributeNames,h))return s.fatalError("Attribute "+h+" redefined");if(!a&&p.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");r.addValue(h,p.replace(/[\t\n\r]/g," ").replace(Si,i),m)}for(var u,l,c=++e,d=Rt;;){var f=t.charAt(c);if(d===Rt&&f==="<")throw new Error("unexpected < in tag name: "+t.slice(e,c));switch(f){case"=":if(d===it)u=t.slice(e,c),d=wr;else if(d===Lt)d=wr;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===wr||d===it)if(d===it&&(s.warning('attribute value must after "="'),u=t.slice(e,c)),e=c+1,c=t.indexOf(f,e),c>0)l=t.slice(e,c),o(u,l,e-1),d=$t;else throw new Error("attribute value no end '"+f+"' match");else if(d==Ft)l=t.slice(e,c),o(u,l,e),s.warning('attribute "'+u+'" missed start quot('+f+")!!"),e=c+1,d=$t;else throw new Error('attribute value must after "="');break;case"/":switch(d){case Rt:r.setTagName(t.slice(e,c));case $t:case yr:case gn:d=gn,r.closed=!0;case Ft:case it:break;case Lt:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==Rt&&r.setTagName(t.slice(e,c)),c;case">":switch(d){case Rt:r.setTagName(t.slice(e,c));case $t:case yr:case gn:break;case Ft:case it:l=t.slice(e,c),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case Lt:d===Lt&&(l=u),d==Ft?(s.warning('attribute "'+l+'" missed quot(")!'),o(u,l,e)):(a||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,e));break;case wr:if(!a)return s.fatalError(`AttValue: ' or " expected`)}return c;case"\x80":f=" ";default:if(f<=" ")switch(d){case Rt:r.setTagName(t.slice(e,c)),d=yr;break;case it:u=t.slice(e,c),d=Lt;break;case Ft:var l=t.slice(e,c);s.warning('attribute "'+l+'" missed quot(")!!'),o(u,l,e);case $t:d=yr;break}else switch(d){case Lt:a||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),o(u,u,e),e=c,d=it;break;case $t:s.warning('attribute space is required"'+u+'"!!');case yr:d=it,e=c;break;case wr:d=Ft,e=c;break;case gn:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function qa(t,e,r){for(var n=t.tagName,i=null,d=t.length;d--;){var s=t[d],a=s.qName,o=s.value,f=a.indexOf(":");if(f>0)var u=s.prefix=a.slice(0,f),l=a.slice(f+1),c=u==="xmlns"&&l;else l=a,u=null,c=a==="xmlns"&&"";s.localName=l,c!==!1&&(i==null&&(i=Object.create(null),r=Object.create(r)),r[c]=i[c]=o,s.uri=Fa.XMLNS,e.startPrefixMapping(c,o))}for(var d=t.length;d--;)s=t[d],s.prefix&&(s.prefix==="xml"&&(s.uri=Fa.XML),s.prefix!=="xmlns"&&(s.uri=r[s.prefix]));var f=n.indexOf(":");f>0?(u=t.prefix=n.slice(0,f),l=t.localName=n.slice(f+1)):(u=null,l=t.localName=n);var h=t.uri=r[u||""];if(e.startElement(h,l,n,t),t.closed){if(e.endElement(h,l,n),i)for(u in i)vr(i,u)&&e.endPrefixMapping(u)}else return t.currentNSMap=r,t.localNSMap=i,!0}function yd(t,e,r,n,i){var s=hd(r);if(s||md(r)){var a=new RegExp("</"+r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+">","ig");a.lastIndex=e;var o=a.exec(t),u=o?o.index:-1;if(u<0)return e+1;var l=t.substring(e+1,u);return s&&(l=l.replace(Si,n)),i.characters(l,0,l.length),u}return e+1}function vd(t,e){for(var r in t)vr(t,r)&&(e[r]=t[r])}function ja(t,e){var r=e;function n(c){return c=c||0,t.charAt(r+c)}function i(c){c=c||1,r+=c}function s(){for(var c=0;r<t.length;){var d=n();if(d!==" "&&d!==`
3
- `&&d!==" "&&d!=="\r")return c;c++,i()}return-1}function a(){return t.substring(r)}function o(c){return t.substring(r,r+c.length)===c}function u(c){return t.substring(r,r+c.length).toUpperCase()===c.toUpperCase()}function l(c){var d=N.reg("^",c),f=d.exec(a());return f?(i(f[0].length),f[0]):null}return{char:n,getIndex:function(){return r},getMatch:l,getSource:function(){return t},skip:i,skipBlanks:s,substringFromIndex:a,substringStartsWith:o,substringStartsWithCaseInsensitive:u}}function kd(t,e){function r(o,u){var l=N.PI.exec(o.substringFromIndex());return l?l[1].toLowerCase()==="xml"?u.fatalError("xml declaration is only allowed at the start of the document, but found at position "+o.getIndex()):(o.skip(l[0].length),l[0]):u.fatalError("processing instruction is not well-formed at position "+o.getIndex())}var n=t.getSource();if(t.char()==="["){t.skip(1);for(var i=t.getIndex();t.getIndex()<n.length;){if(t.skipBlanks(),t.char()==="]"){var s=n.substring(i,t.getIndex());return t.skip(1),s}var a=null;if(t.char()==="<"&&t.char(1)==="!")switch(t.char(2)){case"E":t.char(3)==="L"?a=t.getMatch(N.elementdecl):t.char(3)==="N"&&(a=t.getMatch(N.EntityDecl));break;case"A":a=t.getMatch(N.AttlistDecl);break;case"N":a=t.getMatch(N.NotationDecl);break;case"-":a=t.getMatch(N.Comment);break}else if(t.char()==="<"&&t.char(1)==="?")a=r(t,e);else if(t.char()==="%")a=t.getMatch(N.PEReference);else return e.fatalError("Error detected in Markup declaration");if(!a)return e.fatalError("Error in internal subset at position "+t.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}function za(t,e,r,n,i){var s=ja(t,e);switch(i?s.char(2).toUpperCase():s.char(2)){case"-":var a=s.getMatch(N.Comment);return a?(r.comment(a,N.COMMENT_START.length,a.length-N.COMMENT_START.length-N.COMMENT_END.length),s.getIndex()):n.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var o=s.getMatch(N.CDSect);return o?!i&&!r.currentElement?n.fatalError("CDATA outside of element"):(r.startCDATA(),r.characters(o,N.CDATA_START.length,o.length-N.CDATA_START.length-N.CDATA_END.length),r.endCDATA(),s.getIndex()):n.fatalError("Invalid CDATA starting at position "+e);case"D":{if(r.doc&&r.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+s.getIndex());if(i?!s.substringStartsWithCaseInsensitive(N.DOCTYPE_DECL_START):!s.substringStartsWith(N.DOCTYPE_DECL_START))return n.fatalError("Expected "+N.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(N.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+N.DOCTYPE_DECL_START+" at position "+s.getIndex());var u={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(u.name=s.getMatch(N.Name),!u.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+s.getIndex());if(i&&u.name.toLowerCase()!=="html"&&n.warning("Unexpected DOCTYPE in HTML document at position "+s.getIndex()),s.skipBlanks(),s.substringStartsWith(N.PUBLIC)||s.substringStartsWith(N.SYSTEM)){var l=N.ExternalID_match.exec(s.substringFromIndex());if(!l)return n.fatalError("doctype external id is not well-formed at position "+s.getIndex());l.groups.SystemLiteralOnly!==void 0?u.systemId=l.groups.SystemLiteralOnly:(u.systemId=l.groups.SystemLiteral,u.publicId=l.groups.PubidLiteral),s.skip(l[0].length)}else if(i&&s.substringStartsWithCaseInsensitive(N.SYSTEM)){if(s.skip(N.SYSTEM.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+N.SYSTEM+" at position "+s.getIndex());if(u.systemId=s.getMatch(N.ABOUT_LEGACY_COMPAT_SystemLiteral),!u.systemId)return n.fatalError("Expected "+N.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+N.SYSTEM+" at position "+s.getIndex())}return i&&u.systemId&&!N.ABOUT_LEGACY_COMPAT_SystemLiteral.test(u.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),i||(s.skipBlanks(),u.internalSubset=kd(s,n)),s.skipBlanks(),s.char()!==">"?n.fatalError("doctype not terminated with > at position "+s.getIndex()):(s.skip(1),r.startDTD(u.name,u.publicId,u.systemId,u.internalSubset),r.endDTD(),s.getIndex())}default:return n.fatalError('Not well-formed XML starting with "<!" at position '+e)}}function Ed(t,e,r,n){var i=t.substring(e).match(N.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(!N.XMLDecl.test(t.substring(e)))return n.fatalError("xml declaration is not well-formed")}return r.processingInstruction(i[1],i[2]),e+i[0].length}function Va(){this.attributeNames=Object.create(null)}Va.prototype={setTagName:function(t){if(!N.QName_exact.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,r){if(!N.QName_exact.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:r}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};bn.XMLReader=Ua;bn.parseUtils=ja;bn.parseDoctypeCommentOrCData=za});var Ja=Ge(Ut=>{"use strict";var mt=ht(),xd=Ni(),Ad=ur(),Wa=La(),Dd=Ha(),Td=xd.DOMImplementation,Cd=mt.hasDefaultHTMLNamespace,Nd=mt.isHTMLMimeType,Sd=mt.isValidMimeType,Xa=mt.MIME_TYPE,Oi=mt.NAMESPACE,Ga=Ad.ParseError,Od=Dd.XMLReader;function Za(t){return t.replace(/\r[\n\u0085]/g,`
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=="<"&&"&lt;"||r==">"&&"&gt;"||r=="&"&&"&amp;"||r=='"'&&"&quot;"||"&#"+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
4
  `).replace(/[\r\u0085\u2028\u2029]/g,`
5
- `)}function Ka(t){if(t=t||{},t.locator===void 0&&(t.locator=!0),this.assign=t.assign||mt.assign,this.domHandler=t.domHandler||wn,this.onError=t.onError||t.errorHandler,t.errorHandler&&typeof t.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");t.errorHandler&&t.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=t.normalizeLineEndings||Za,this.locator=!!t.locator,this.xmlns=this.assign(Object.create(null),t.xmlns)}Ka.prototype.parseFromString=function(t,e){if(!Sd(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var r=this.assign(Object.create(null),this.xmlns),n=Wa.XML_ENTITIES,i=r[""]||null;Cd(e)?(n=Wa.HTML_ENTITIES,i=Oi.HTML):e===Xa.XML_SVG_IMAGE&&(i=Oi.SVG),r[""]=i,r.xml=r.xml||Oi.XML;var s=new this.domHandler({mimeType:e,defaultNamespace:i,onError:this.onError}),a=this.locator?{}:void 0;this.locator&&s.setDocumentLocator(a);var o=new Od;o.errorHandler=s,o.domBuilder=s;var u=!mt.isHTMLMimeType(e);return u&&typeof t!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(t)),r,n),s.doc.documentElement||o.errorHandler.fatalError("missing root element"),s.doc};function wn(t){var e=t||{};this.mimeType=e.mimeType||Xa.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 Pt(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}wn.prototype={startDocument:function(){var t=new Td;this.doc=Nd(this.mimeType)?t.createHTMLDocument(!1):t.createDocument(this.defaultNamespace,"")},startElement:function(t,e,r,n){var i=this.doc,s=i.createElementNS(t,r||e),a=n.length;_n(this,s),this.currentElement=s,this.locator&&Pt(this.locator,s);for(var o=0;o<a;o++){var t=n.getURI(o),u=n.getValue(o),r=n.getQName(o),l=i.createAttributeNS(t,r);this.locator&&Pt(n.getLocator(o),l),l.value=l.nodeValue=u,s.setAttributeNode(l)}},endElement:function(t,e,r){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var r=this.doc.createProcessingInstruction(t,e);this.locator&&Pt(this.locator,r),_n(this,r)},ignorableWhitespace:function(t,e,r){},characters:function(t,e,r){if(t=Ya.apply(this,arguments),t){if(this.cdata)var n=this.doc.createCDATASection(t);else var n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&Pt(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){t&&(t.lineNumber=0),this.locator=t},comment:function(t,e,r){t=Ya.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&Pt(this.locator,n),_n(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,r,n){var i=this.doc.implementation;if(i&&i.createDocumentType){var s=i.createDocumentType(t,e,r,n);this.locator&&Pt(this.locator,s),_n(this,s),this.doc.doctype=s}},reportError:function(t,e){if(typeof this.onError=="function")try{this.onError(t,e,this)}catch(r){throw new Ga("Reporting "+t+' "'+e+'" caused '+r,this.locator)}else console.error("[xmldom "+t+"] "+e,Bd(this.locator))},warning:function(t){this.reportError("warning",t)},error:function(t){this.reportError("error",t)},fatalError:function(t,e){throw this.reportError("fatalError",t),new Ga(t,this.locator,e)}};function Bd(t){if(t)return`
6
- @#[line:`+t.lineNumber+",col:"+t.columnNumber+"]"}function Ya(t,e,r){return typeof t=="string"?t.substr(e,r):t.length>=e+r||e?new java.lang.String(t,e,r)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){wn.prototype[t]=function(){return null}});function _n(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}function Id(t){if(t==="error")throw"onErrorStopParsing"}function Md(){throw"onWarningStopParsing"}Ut.__DOMHandler=wn;Ut.DOMParser=Ka;Ut.normalizeLineEndings=Za;Ut.onErrorStopParsing=Id;Ut.onWarningStopParsing=Md});var Bi=Ge(M=>{"use strict";var jt=ht();M.assign=jt.assign;M.hasDefaultHTMLNamespace=jt.hasDefaultHTMLNamespace;M.isHTMLMimeType=jt.isHTMLMimeType;M.isValidMimeType=jt.isValidMimeType;M.MIME_TYPE=jt.MIME_TYPE;M.NAMESPACE=jt.NAMESPACE;var yn=ur();M.DOMException=yn.DOMException;M.DOMExceptionName=yn.DOMExceptionName;M.ExceptionCode=yn.ExceptionCode;M.ParseError=yn.ParseError;var Q=Ni();M.Attr=Q.Attr;M.CDATASection=Q.CDATASection;M.CharacterData=Q.CharacterData;M.Comment=Q.Comment;M.Document=Q.Document;M.DocumentFragment=Q.DocumentFragment;M.DocumentType=Q.DocumentType;M.DOMImplementation=Q.DOMImplementation;M.Element=Q.Element;M.Entity=Q.Entity;M.EntityReference=Q.EntityReference;M.LiveNodeList=Q.LiveNodeList;M.NamedNodeMap=Q.NamedNodeMap;M.Node=Q.Node;M.NodeList=Q.NodeList;M.Notation=Q.Notation;M.ProcessingInstruction=Q.ProcessingInstruction;M.Text=Q.Text;M.XMLSerializer=Q.XMLSerializer;var vn=Ja();M.DOMParser=vn.DOMParser;M.normalizeLineEndings=vn.normalizeLineEndings;M.onErrorStopParsing=vn.onErrorStopParsing;M.onWarningStopParsing=vn.onWarningStopParsing});import{Bag as Zo,sourceTarget as Yt}from"@gramlot/gramlot";function Ur(t,e,{align:r="start",matchWidth:n=!1,inset:i=0,placement:s="bottom",point:a=null}={}){let o=e.ownerDocument.defaultView,u=a?{left:a.x,right:a.x,top:a.y,bottom:a.y,width:0}:e.getBoundingClientRect(),l=Math.max(0,o.innerWidth-16);t.style.setProperty("--gramlot-popup-available-width",`${l}px`),n&&(t.style.width=`${Math.min(Math.max(0,u.width-2*i),l)}px`),t.style.removeProperty("--gramlot-popup-available-height");let c=t.getBoundingClientRect();if(s==="side"){let _=Math.max(0,o.innerWidth-8-u.right-3),w=Math.max(0,u.left-8-3),y=c.width>_&&w>_;t.style.setProperty("--gramlot-popup-available-width",`${y?w:_}px`),t.style.setProperty("--gramlot-popup-available-height",`${Math.max(0,o.innerHeight-16)}px`);let k=t.getBoundingClientRect(),S=y?u.left-k.width-3:u.right+3;t.style.left=`${Math.max(8,Math.min(S,o.innerWidth-k.width-8))}px`,t.style.top=`${Math.max(8,Math.min(u.top,o.innerHeight-k.height-8))}px`;return}let d=Math.max(0,o.innerHeight-8-u.bottom-3),f=Math.max(0,u.top-8-3),h=c.height>d&&f>d;t.style.setProperty("--gramlot-popup-available-height",`${h?f:d}px`);let p=t.getBoundingClientRect(),m=r==="end"?u.right-p.width-i:u.left+i,g=h?u.top-p.height-3:u.bottom+3;t.style.left=`${Math.max(8,Math.min(m,o.innerWidth-p.width-8))}px`,t.style.top=`${Math.max(8,Math.min(g,o.innerHeight-p.height-8))}px`}/*!
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
7
  * decimal.js v10.6.0
8
8
  * An arbitrary-precision Decimal type for JavaScript.
9
9
  * https://github.com/MikeMcl/decimal.js
10
10
  * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
11
11
  * MIT Licence
12
- */var kt=9e15,Ke=1e9,Xn="0123456789abcdef",Vr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Hr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Zn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-kt,maxE:kt,crypto:!1},ys,qe,T=!0,Gr="[DecimalError] ",Ze=Gr+"Invalid argument: ",vs=Gr+"Precision limit exceeded",ks=Gr+"crypto unavailable",Es="[object Decimal]",le=Math.floor,K=Math.pow,ml=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,gl=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,bl=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,xs=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ae=1e7,A=7,_l=9007199254740991,wl=Vr.length-1,Kn=Hr.length-1,b={toStringTag:Es};b.absoluteValue=b.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),x(t)};b.ceil=function(){return x(new this.constructor(this),this.e+1,2)};b.clampedTo=b.clamp=function(t,e){var r,n=this,i=n.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(Ze+e);return r=n.cmp(t),r<0?t:n.cmp(e)>0?e:new i(n)};b.comparedTo=b.cmp=function(t){var e,r,n,i,s=this,a=s.d,o=(t=new s.constructor(t)).d,u=s.s,l=t.s;if(!a||!o)return!u||!l?NaN:u!==l?u:a===o?0:!a^u<0?1:-1;if(!a[0]||!o[0])return a[0]?u:o[0]?-l:0;if(u!==l)return u;if(s.e!==t.e)return s.e>t.e^u<0?1:-1;for(n=a.length,i=o.length,e=0,r=n<i?n:i;e<r;++e)if(a[e]!==o[e])return a[e]>o[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1};b.cosine=b.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+A,n.rounding=1,r=yl(n,Ns(n,r)),n.precision=t,n.rounding=e,x(qe==2||qe==3?r.neg():r,t,e,!0)):new n(1):new n(NaN)};b.cubeRoot=b.cbrt=function(){var t,e,r,n,i,s,a,o,u,l,c=this,d=c.constructor;if(!c.isFinite()||c.isZero())return new d(c);for(T=!1,s=c.s*K(c.s*c,1/3),!s||Math.abs(s)==1/0?(r=ie(c.d),t=c.e,(s=(t-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=K(r,1/3),t=le((t+1)/3)-(t%3==(t<0?-1:2)),s==1/0?r="5e"+t:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+t),n=new d(r),n.s=c.s):n=new d(s.toString()),a=(t=d.precision)+3;;)if(o=n,u=o.times(o).times(o),l=u.plus(c),n=U(l.plus(c).times(o),l.plus(u),a+2,1),ie(o.d).slice(0,a)===(r=ie(n.d)).slice(0,a))if(r=r.slice(a-3,a+1),r=="9999"||!i&&r=="4999"){if(!i&&(x(o,t+1,0),o.times(o).times(o).eq(c))){n=o;break}a+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(x(n,t+1,1),e=!n.times(n).times(n).eq(c));break}return T=!0,x(n,t,d.rounding,e)};b.decimalPlaces=b.dp=function(){var t,e=this.d,r=NaN;if(e){if(t=e.length-1,r=(t-le(this.e/A))*A,t=e[t],t)for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r};b.dividedBy=b.div=function(t){return U(this,new this.constructor(t))};b.dividedToIntegerBy=b.divToInt=function(t){var e=this,r=e.constructor;return x(U(e,new r(t),0,1,1),r.precision,r.rounding)};b.equals=b.eq=function(t){return this.cmp(t)===0};b.floor=function(){return x(new this.constructor(this),this.e+1,3)};b.greaterThan=b.gt=function(t){return this.cmp(t)>0};b.greaterThanOrEqualTo=b.gte=function(t){var e=this.cmp(t);return e==1||e===0};b.hyperbolicCosine=b.cosh=function(){var t,e,r,n,i,s=this,a=s.constructor,o=new a(1);if(!s.isFinite())return new a(s.s?1/0:NaN);if(s.isZero())return o;r=a.precision,n=a.rounding,a.precision=r+Math.max(s.e,s.sd())+4,a.rounding=1,i=s.d.length,i<32?(t=Math.ceil(i/3),e=(1/Xr(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),s=Et(a,1,s.times(e),new a(1),!0);for(var u,l=t,c=new a(8);l--;)u=s.times(s),s=o.minus(u.times(c.minus(u.times(c))));return x(s,a.precision=r,a.rounding=n,!0)};b.hyperbolicSine=b.sinh=function(){var t,e,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(e=s.precision,r=s.rounding,s.precision=e+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Et(s,2,i,i,!0);else{t=1.4*Math.sqrt(n),t=t>16?16:t|0,i=i.times(1/Xr(5,t)),i=Et(s,2,i,i,!0);for(var a,o=new s(5),u=new s(16),l=new s(20);t--;)a=i.times(i),i=i.times(o.plus(a.times(u.times(a).plus(l))))}return s.precision=e,s.rounding=r,x(i,e,r,!0)};b.hyperbolicTangent=b.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,U(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)};b.inverseCosine=b.acos=function(){var t=this,e=t.constructor,r=t.abs().cmp(1),n=e.precision,i=e.rounding;return r!==-1?r===0?t.isNeg()?Ne(e,n,i):new e(0):new e(NaN):t.isZero()?Ne(e,n+4,i).times(.5):(e.precision=n+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=n,e.rounding=i,t.times(2))};b.inverseHyperbolicCosine=b.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,T=!1,r=r.times(r).minus(1).sqrt().plus(r),T=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)};b.inverseHyperbolicSine=b.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,T=!1,r=r.times(r).plus(1).sqrt().plus(r),T=!0,n.precision=t,n.rounding=e,r.ln())};b.inverseHyperbolicTangent=b.atanh=function(){var t,e,r,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):(t=s.precision,e=s.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?x(new s(i),t,e,!0):(s.precision=r=n-i.e,i=U(i.plus(1),new s(1).minus(i),r+t,1),s.precision=t+4,s.rounding=1,i=i.ln(),s.precision=t,s.rounding=e,i.times(.5))):new s(NaN)};b.inverseSine=b.asin=function(){var t,e,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(e=i.abs().cmp(1),r=s.precision,n=s.rounding,e!==-1?e===0?(t=Ne(s,r+4,n).times(.5),t.s=i.s,t):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))};b.inverseTangent=b.atan=function(){var t,e,r,n,i,s,a,o,u,l=this,c=l.constructor,d=c.precision,f=c.rounding;if(l.isFinite()){if(l.isZero())return new c(l);if(l.abs().eq(1)&&d+4<=Kn)return a=Ne(c,d+4,f).times(.25),a.s=l.s,a}else{if(!l.s)return new c(NaN);if(d+4<=Kn)return a=Ne(c,d+4,f).times(.5),a.s=l.s,a}for(c.precision=o=d+10,c.rounding=1,r=Math.min(28,o/A+2|0),t=r;t;--t)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(T=!1,e=Math.ceil(o/A),n=1,u=l.times(l),a=new c(l),i=l;t!==-1;)if(i=i.times(u),s=a.minus(i.div(n+=2)),i=i.times(u),a=s.plus(i.div(n+=2)),a.d[e]!==void 0)for(t=e;a.d[t]===s.d[t]&&t--;);return r&&(a=a.times(2<<r-1)),T=!0,x(a,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(t){return this.cmp(t)<0};b.lessThanOrEqualTo=b.lte=function(t){return this.cmp(t)<1};b.logarithm=b.log=function(t){var e,r,n,i,s,a,o,u,l=this,c=l.constructor,d=c.precision,f=c.rounding,h=5;if(t==null)t=new c(10),e=!0;else{if(t=new c(t),r=t.d,t.s<0||!r||!r[0]||t.eq(1))return new c(NaN);e=t.eq(10)}if(r=l.d,l.s<0||!r||!r[0]||l.eq(1))return new c(r&&!r[0]?-1/0:l.s!=1?NaN:r?0:1/0);if(e)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(T=!1,o=d+h,a=Xe(l,o),n=e?Wr(c,o+10):Xe(t,o),u=U(a,n,o,1),Zt(u.d,i=d,f))do if(o+=10,a=Xe(l,o),n=e?Wr(c,o+10):Xe(t,o),u=U(a,n,o,1),!s){+ie(u.d).slice(i+1,i+15)+1==1e14&&(u=x(u,d+1,0));break}while(Zt(u.d,i+=10,f));return T=!0,x(u,d,f)};b.minus=b.sub=function(t){var e,r,n,i,s,a,o,u,l,c,d,f,h=this,p=h.constructor;if(t=new p(t),!h.d||!t.d)return!h.s||!t.s?t=new p(NaN):h.d?t.s=-t.s:t=new p(t.d||h.s!==t.s?h:NaN),t;if(h.s!=t.s)return t.s=-t.s,h.plus(t);if(l=h.d,f=t.d,o=p.precision,u=p.rounding,!l[0]||!f[0]){if(f[0])t.s=-t.s;else if(l[0])t=new p(h);else return new p(u===3?-0:0);return T?x(t,o,u):t}if(r=le(t.e/A),c=le(h.e/A),l=l.slice(),s=c-r,s){for(d=s<0,d?(e=l,s=-s,a=f.length):(e=f,r=c,a=l.length),n=Math.max(Math.ceil(o/A),a)+2,s>n&&(s=n,e.length=1),e.reverse(),n=s;n--;)e.push(0);e.reverse()}else{for(n=l.length,a=f.length,d=n<a,d&&(a=n),n=0;n<a;n++)if(l[n]!=f[n]){d=l[n]<f[n];break}s=0}for(d&&(e=l,l=f,f=e,t.s=-t.s),a=l.length,n=f.length-a;n>0;--n)l[a++]=0;for(n=f.length;n>s;){if(l[--n]<f[n]){for(i=n;i&&l[--i]===0;)l[i]=Ae-1;--l[i],l[n]+=Ae}l[n]-=f[n]}for(;l[--a]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(t.d=l,t.e=Yr(l,r),T?x(t,o,u):t):new p(u===3?-0:0)};b.modulo=b.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?x(new n(r),n.precision,n.rounding):(T=!1,n.modulo==9?(e=U(r,t.abs(),0,3,1),e.s*=t.s):e=U(r,t,0,n.modulo,1),e=e.times(t),T=!0,r.minus(e))};b.naturalExponential=b.exp=function(){return Jn(this)};b.naturalLogarithm=b.ln=function(){return Xe(this)};b.negated=b.neg=function(){var t=new this.constructor(this);return t.s=-t.s,x(t)};b.plus=b.add=function(t){var e,r,n,i,s,a,o,u,l,c,d=this,f=d.constructor;if(t=new f(t),!d.d||!t.d)return!d.s||!t.s?t=new f(NaN):d.d||(t=new f(t.d||d.s===t.s?d:NaN)),t;if(d.s!=t.s)return t.s=-t.s,d.minus(t);if(l=d.d,c=t.d,o=f.precision,u=f.rounding,!l[0]||!c[0])return c[0]||(t=new f(d)),T?x(t,o,u):t;if(s=le(d.e/A),n=le(t.e/A),l=l.slice(),i=s-n,i){for(i<0?(r=l,i=-i,a=c.length):(r=c,n=s,a=l.length),s=Math.ceil(o/A),a=s>a?s+1:a+1,i>a&&(i=a,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(a=l.length,i=c.length,a-i<0&&(i=a,r=c,c=l,l=r),e=0;i;)e=(l[--i]=l[i]+c[i]+e)/Ae|0,l[i]%=Ae;for(e&&(l.unshift(e),++n),a=l.length;l[--a]==0;)l.pop();return t.d=l,t.e=Yr(l,n),T?x(t,o,u):t};b.precision=b.sd=function(t){var e,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Ze+t);return r.d?(e=As(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e};b.round=function(){var t=this,e=t.constructor;return x(new e(t),t.e+1,e.rounding)};b.sine=b.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+A,n.rounding=1,r=kl(n,Ns(n,r)),n.precision=t,n.rounding=e,x(qe>2?r.neg():r,t,e,!0)):new n(NaN)};b.squareRoot=b.sqrt=function(){var t,e,r,n,i,s,a=this,o=a.d,u=a.e,l=a.s,c=a.constructor;if(l!==1||!o||!o[0])return new c(!l||l<0&&(!o||o[0])?NaN:o?a:1/0);for(T=!1,l=Math.sqrt(+a),l==0||l==1/0?(e=ie(o),(e.length+u)%2==0&&(e+="0"),l=Math.sqrt(e),u=le((u+1)/2)-(u<0||u%2),l==1/0?e="5e"+u:(e=l.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),n=new c(e)):n=new c(l.toString()),r=(u=c.precision)+3;;)if(s=n,n=s.plus(U(a,s,r+2,1)).times(.5),ie(s.d).slice(0,r)===(e=ie(n.d)).slice(0,r))if(e=e.slice(r-3,r+1),e=="9999"||!i&&e=="4999"){if(!i&&(x(s,u+1,0),s.times(s).eq(a))){n=s;break}r+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(x(n,u+1,1),t=!n.times(n).eq(a));break}return T=!0,x(n,u,c.rounding,t)};b.tangent=b.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,r=r.sin(),r.s=1,r=U(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,x(qe==2||qe==4?r.neg():r,t,e,!0)):new n(NaN)};b.times=b.mul=function(t){var e,r,n,i,s,a,o,u,l,c=this,d=c.constructor,f=c.d,h=(t=new d(t)).d;if(t.s*=c.s,!f||!f[0]||!h||!h[0])return new d(!t.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?t.s/0:t.s*0);for(r=le(c.e/A)+le(t.e/A),u=f.length,l=h.length,u<l&&(s=f,f=h,h=s,a=u,u=l,l=a),s=[],a=u+l,n=a;n--;)s.push(0);for(n=l;--n>=0;){for(e=0,i=u+n;i>n;)o=s[i]+h[n]*f[i-n-1]+e,s[i--]=o%Ae|0,e=o/Ae|0;s[i]=(s[i]+e)%Ae|0}for(;!s[--a];)s.pop();return e?++r:s.shift(),t.d=s,t.e=Yr(s,r),T?x(t,d.precision,d.rounding):t};b.toBinary=function(t,e){return Qn(this,2,t,e)};b.toDecimalPlaces=b.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(he(t,0,Ke),e===void 0?e=n.rounding:he(e,0,8),x(r,t+r.e+1,e))};b.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=Se(n,!0):(he(t,0,Ke),e===void 0?e=i.rounding:he(e,0,8),n=x(new i(n),t+1,e),r=Se(n,!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r};b.toFixed=function(t,e){var r,n,i=this,s=i.constructor;return t===void 0?r=Se(i):(he(t,0,Ke),e===void 0?e=s.rounding:he(e,0,8),n=x(new s(i),t+i.e+1,e),r=Se(n,!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};b.toFraction=function(t){var e,r,n,i,s,a,o,u,l,c,d,f,h=this,p=h.d,m=h.constructor;if(!p)return new m(h);if(l=r=new m(1),n=u=new m(0),e=new m(n),s=e.e=As(p)-h.e-1,a=s%A,e.d[0]=K(10,a<0?A+a:a),t==null)t=s>0?e:l;else{if(o=new m(t),!o.isInt()||o.lt(l))throw Error(Ze+o);t=o.gt(e)?s>0?e:l:o}for(T=!1,o=new m(ie(p)),c=m.precision,m.precision=s=p.length*A*2;d=U(o,e,0,1,1),i=r.plus(d.times(n)),i.cmp(t)!=1;)r=n,n=i,i=l,l=u.plus(d.times(i)),u=i,i=e,e=o.minus(d.times(i)),o=i;return i=U(t.minus(r),n,0,1,1),u=u.plus(i.times(l)),r=r.plus(i.times(n)),u.s=l.s=h.s,f=U(l,n,s,1).minus(h).abs().cmp(U(u,r,s,1).minus(h).abs())<1?[l,n]:[u,r],m.precision=c,T=!0,f};b.toHexadecimal=b.toHex=function(t,e){return Qn(this,16,t,e)};b.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),t==null){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),e===void 0?e=n.rounding:he(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(T=!1,r=U(r,t,0,e,1).times(t),T=!0,x(r)):(t.s=r.s,r=t),r};b.toNumber=function(){return+this};b.toOctal=function(t,e){return Qn(this,8,t,e)};b.toPower=b.pow=function(t){var e,r,n,i,s,a,o=this,u=o.constructor,l=+(t=new u(t));if(!o.d||!t.d||!o.d[0]||!t.d[0])return new u(K(+o,l));if(o=new u(o),o.eq(1))return o;if(n=u.precision,s=u.rounding,t.eq(1))return x(o,n,s);if(e=le(t.e/A),e>=t.d.length-1&&(r=l<0?-l:l)<=_l)return i=Ds(u,o,r,n),t.s<0?new u(1).div(i):x(i,n,s);if(a=o.s,a<0){if(e<t.d.length-1)return new u(NaN);if((t.d[e]&1)==0&&(a=1),o.e==0&&o.d[0]==1&&o.d.length==1)return o.s=a,o}return r=K(+o,l),e=r==0||!isFinite(r)?le(l*(Math.log("0."+ie(o.d))/Math.LN10+o.e+1)):new u(r+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?a/0:0):(T=!1,u.rounding=o.s=1,r=Math.min(12,(e+"").length),i=Jn(t.times(Xe(o,n+r)),n),i.d&&(i=x(i,n+5,1),Zt(i.d,n,s)&&(e=n+10,i=x(Jn(t.times(Xe(o,e+r)),e),e+5,1),+ie(i.d).slice(n+1,n+15)+1==1e14&&(i=x(i,n+1,0)))),i.s=a,T=!0,u.rounding=s,x(i,n,s))};b.toPrecision=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=Se(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(he(t,1,Ke),e===void 0?e=i.rounding:he(e,0,8),n=x(new i(n),t,e),r=Se(n,t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r};b.toSignificantDigits=b.toSD=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(he(t,1,Ke),e===void 0?e=n.rounding:he(e,0,8)),x(new n(r),t,e)};b.toString=function(){var t=this,e=t.constructor,r=Se(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r};b.truncated=b.trunc=function(){return x(new this.constructor(this),this.e+1,1)};b.valueOf=b.toJSON=function(){var t=this,e=t.constructor,r=Se(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};function ie(t){var e,r,n,i=t.length-1,s="",a=t[0];if(i>0){for(s+=a,e=1;e<i;e++)n=t[e]+"",r=A-n.length,r&&(s+=Ye(r)),s+=n;a=t[e],n=a+"",r=A-n.length,r&&(s+=Ye(r))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}function he(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Ze+t)}function Zt(t,e,r,n){var i,s,a,o;for(s=t[0];s>=10;s/=10)--e;return--e<0?(e+=A,i=0):(i=Math.ceil((e+1)/A),e%=A),s=K(10,A-e),o=t[i]%s|0,n==null?e<3?(e==0?o=o/100|0:e==1&&(o=o/10|0),a=r<4&&o==99999||r>3&&o==49999||o==5e4||o==0):a=(r<4&&o+1==s||r>3&&o+1==s/2)&&(t[i+1]/s/100|0)==K(10,e-2)-1||(o==s/2||o==0)&&(t[i+1]/s/100|0)==0:e<4?(e==0?o=o/1e3|0:e==1?o=o/100|0:e==2&&(o=o/10|0),a=(n||r<4)&&o==9999||!n&&r>3&&o==4999):a=((n||r<4)&&o+1==s||!n&&r>3&&o+1==s/2)&&(t[i+1]/s/1e3|0)==K(10,e-3)-1,a}function jr(t,e,r){for(var n,i=[0],s,a=0,o=t.length;a<o;){for(s=i.length;s--;)i[s]*=e;for(i[0]+=Xn.indexOf(t.charAt(a++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function yl(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?(r=Math.ceil(n/3),i=(1/Xr(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),t.precision+=r,e=Et(t,1,e.times(i),new t(1));for(var s=r;s--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return t.precision-=r,e}var U=(function(){function t(n,i,s){var a,o=0,u=n.length;for(n=n.slice();u--;)a=n[u]*i+o,n[u]=a%s|0,o=a/s|0;return o&&n.unshift(o),n}function e(n,i,s,a){var o,u;if(s!=a)u=s>a?1:-1;else for(o=u=0;o<s;o++)if(n[o]!=i[o]){u=n[o]>i[o]?1:-1;break}return u}function r(n,i,s,a){for(var o=0;s--;)n[s]-=o,o=n[s]<i[s]?1:0,n[s]=o*a+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,a,o,u){var l,c,d,f,h,p,m,g,_,w,y,k,S,R,F,re,ne,$e,Z,de,ye=n.constructor,P=n.s==i.s?1:-1,Y=n.d,O=i.d;if(!Y||!Y[0]||!O||!O[0])return new ye(!n.s||!i.s||(Y?O&&Y[0]==O[0]:!O)?NaN:Y&&Y[0]==0||!O?P*0:P/0);for(u?(h=1,c=n.e-i.e):(u=Ae,h=A,c=le(n.e/h)-le(i.e/h)),Z=O.length,ne=Y.length,_=new ye(P),w=_.d=[],d=0;O[d]==(Y[d]||0);d++);if(O[d]>(Y[d]||0)&&c--,s==null?(R=s=ye.precision,a=ye.rounding):o?R=s+(n.e-i.e)+1:R=s,R<0)w.push(1),p=!0;else{if(R=R/h+2|0,d=0,Z==1){for(f=0,O=O[0],R++;(d<ne||f)&&R--;d++)F=f*u+(Y[d]||0),w[d]=F/O|0,f=F%O|0;p=f||d<ne}else{for(f=u/(O[0]+1)|0,f>1&&(O=t(O,f,u),Y=t(Y,f,u),Z=O.length,ne=Y.length),re=Z,y=Y.slice(0,Z),k=y.length;k<Z;)y[k++]=0;de=O.slice(),de.unshift(0),$e=O[0],O[1]>=u/2&&++$e;do f=0,l=e(O,y,Z,k),l<0?(S=y[0],Z!=k&&(S=S*u+(y[1]||0)),f=S/$e|0,f>1?(f>=u&&(f=u-1),m=t(O,f,u),g=m.length,k=y.length,l=e(m,y,g,k),l==1&&(f--,r(m,Z<g?de:O,g,u))):(f==0&&(l=f=1),m=O.slice()),g=m.length,g<k&&m.unshift(0),r(y,m,k,u),l==-1&&(k=y.length,l=e(O,y,Z,k),l<1&&(f++,r(y,Z<k?de:O,k,u))),k=y.length):l===0&&(f++,y=[0]),w[d++]=f,l&&y[0]?y[k++]=Y[re]||0:(y=[Y[re]],k=1);while((re++<ne||y[0]!==void 0)&&R--);p=y[0]!==void 0}w[0]||w.shift()}if(h==1)_.e=c,ys=p;else{for(d=1,f=w[0];f>=10;f/=10)d++;_.e=d+c*h-1,x(_,o?s+_.e+1:s,a,p)}return _}})();function x(t,e,r,n){var i,s,a,o,u,l,c,d,f,h=t.constructor;e:if(e!=null){if(d=t.d,!d)return t;for(i=1,o=d[0];o>=10;o/=10)i++;if(s=e-i,s<0)s+=A,a=e,c=d[f=0],u=c/K(10,i-a-1)%10|0;else if(f=Math.ceil((s+1)/A),o=d.length,f>=o)if(n){for(;o++<=f;)d.push(0);c=u=0,i=1,s%=A,a=s-A+1}else break e;else{for(c=o=d[f],i=1;o>=10;o/=10)i++;s%=A,a=s-A+i,u=a<0?0:c/K(10,i-a-1)%10|0}if(n=n||e<0||d[f+1]!==void 0||(a<0?c:c%K(10,i-a-1)),l=r<4?(u||n)&&(r==0||r==(t.s<0?3:2)):u>5||u==5&&(r==4||n||r==6&&(s>0?a>0?c/K(10,i-a):0:d[f-1])%10&1||r==(t.s<0?8:7)),e<1||!d[0])return d.length=0,l?(e-=t.e+1,d[0]=K(10,(A-e%A)%A),t.e=-e||0):d[0]=t.e=0,t;if(s==0?(d.length=f,o=1,f--):(d.length=f+1,o=K(10,A-s),d[f]=a>0?(c/K(10,i-a)%K(10,a)|0)*o:0),l)for(;;)if(f==0){for(s=1,a=d[0];a>=10;a/=10)s++;for(a=d[0]+=o,o=1;a>=10;a/=10)o++;s!=o&&(t.e++,d[0]==Ae&&(d[0]=1));break}else{if(d[f]+=o,d[f]!=Ae)break;d[f--]=0,o=1}for(s=d.length;d[--s]===0;)d.pop()}return T&&(t.e>h.maxE?(t.d=null,t.e=NaN):t.e<h.minE&&(t.e=0,t.d=[0])),t}function Se(t,e,r){if(!t.isFinite())return Cs(t);var n,i=t.e,s=ie(t.d),a=s.length;return e?(r&&(n=r-a)>0?s=s.charAt(0)+"."+s.slice(1)+Ye(n):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(t.e<0?"e":"e+")+t.e):i<0?(s="0."+Ye(-i-1)+s,r&&(n=r-a)>0&&(s+=Ye(n))):i>=a?(s+=Ye(i+1-a),r&&(n=r-i-1)>0&&(s=s+"."+Ye(n))):((n=i+1)<a&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-a)>0&&(i+1===a&&(s+="."),s+=Ye(n))),s}function Yr(t,e){var r=t[0];for(e*=A;r>=10;r/=10)e++;return e}function Wr(t,e,r){if(e>wl)throw T=!0,r&&(t.precision=r),Error(vs);return x(new t(Vr),e,1,!0)}function Ne(t,e,r){if(e>Kn)throw Error(vs);return x(new t(Hr),e,r,!0)}function As(t){var e=t.length-1,r=e*A+1;if(e=t[e],e){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function Ye(t){for(var e="";t--;)e+="0";return e}function Ds(t,e,r,n){var i,s=new t(1),a=Math.ceil(n/A+4);for(T=!1;;){if(r%2&&(s=s.times(e),_s(s.d,a)&&(i=!0)),r=le(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}e=e.times(e),_s(e.d,a)}return T=!0,s}function bs(t){return t.d[t.d.length-1]&1}function Ts(t,e,r){for(var n,i,s=new t(e[0]),a=0;++a<e.length;){if(i=new t(e[a]),!i.s){s=i;break}n=s.cmp(i),(n===r||n===0&&s.s===r)&&(s=i)}return s}function Jn(t,e){var r,n,i,s,a,o,u,l=0,c=0,d=0,f=t.constructor,h=f.rounding,p=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(T=!1,u=p):u=e,o=new f(.03125);t.e>-2;)t=t.times(o),d+=5;for(n=Math.log(K(2,d))/Math.LN10*2+5|0,u+=n,r=s=a=new f(1),f.precision=u;;){if(s=x(s.times(t),u,1),r=r.times(++c),o=a.plus(U(s,r,u,1)),ie(o.d).slice(0,u)===ie(a.d).slice(0,u)){for(i=d;i--;)a=x(a.times(a),u,1);if(e==null)if(l<3&&Zt(a.d,u-n,h,l))f.precision=u+=10,r=s=o=new f(1),c=0,l++;else return x(a,f.precision=p,h,T=!0);else return f.precision=p,a}a=o}}function Xe(t,e){var r,n,i,s,a,o,u,l,c,d,f,h=1,p=10,m=t,g=m.d,_=m.constructor,w=_.rounding,y=_.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?(T=!1,c=y):c=e,_.precision=c+=p,r=ie(g),n=r.charAt(0),Math.abs(s=m.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)m=m.times(t),r=ie(m.d),n=r.charAt(0),h++;s=m.e,n>1?(m=new _("0."+r),s++):m=new _(n+"."+r.slice(1))}else return l=Wr(_,c+2,y).times(s+""),m=Xe(new _(n+"."+r.slice(1)),c-p).plus(l),_.precision=y,e==null?x(m,y,w,T=!0):m;for(d=m,u=a=m=U(m.minus(1),m.plus(1),c,1),f=x(m.times(m),c,1),i=3;;){if(a=x(a.times(f),c,1),l=u.plus(U(a,new _(i),c,1)),ie(l.d).slice(0,c)===ie(u.d).slice(0,c))if(u=u.times(2),s!==0&&(u=u.plus(Wr(_,c+2,y).times(s+""))),u=U(u,new _(h),c,1),e==null)if(Zt(u.d,c-p,w,o))_.precision=c+=p,l=a=m=U(d.minus(1),d.plus(1),c,1),f=x(m.times(m),c,1),i=o=1;else return x(u,_.precision=y,w,T=!0);else return _.precision=y,u;u=l,i+=2}}function Cs(t){return String(t.s*t.s/0)}function zr(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=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,t.e=r=r-n-1,t.d=[],n=(r+1)%A,r<0&&(n+=A),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=A;n<i;)t.d.push(+e.slice(n,n+=A));e=e.slice(n),n=A-e.length}else n-=i;for(;n--;)e+="0";t.d.push(+e),T&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function vl(t,e){var r,n,i,s,a,o,u,l,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),xs.test(e))return zr(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(gl.test(e))r=16,e=e.toLowerCase();else if(ml.test(e))r=2;else if(bl.test(e))r=8;else throw Error(Ze+e);for(s=e.search(/p/i),s>0?(u=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),s=e.indexOf("."),a=s>=0,n=t.constructor,a&&(e=e.replace(".",""),o=e.length,s=o-s,i=Ds(n,new n(r),s,s*2)),l=jr(e,r,Ae),c=l.length-1,s=c;l[s]===0;--s)l.pop();return s<0?new n(t.s*0):(t.e=Yr(l,c),t.d=l,T=!1,a&&(t=U(t,i,o*4)),u&&(t=t.times(Math.abs(u)<54?K(2,u):Kt.pow(2,u))),T=!0,t)}function kl(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:Et(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:r|0,e=e.times(1/Xr(5,r)),e=Et(t,2,e,e);for(var i,s=new t(5),a=new t(16),o=new t(20);r--;)i=e.times(e),e=e.times(s.plus(i.times(a.times(i).minus(o))));return e}function Et(t,e,r,n,i){var s,a,o,u,l=1,c=t.precision,d=Math.ceil(c/A);for(T=!1,u=r.times(r),o=new t(n);;){if(a=U(o.times(u),new t(e++*e++),c,1),o=i?n.plus(a):n.minus(a),n=U(a.times(u),new t(e++*e++),c,1),a=o.plus(n),a.d[d]!==void 0){for(s=d;a.d[s]===o.d[s]&&s--;);if(s==-1)break}s=o,o=n,n=a,a=s,l++}return T=!0,a.d.length=d+1,a}function Xr(t,e){for(var r=t;--e;)r*=t;return r}function Ns(t,e){var r,n=e.s<0,i=Ne(t,t.precision,1),s=i.times(.5);if(e=e.abs(),e.lte(s))return qe=n?4:1,e;if(r=e.divToInt(i),r.isZero())qe=n?3:2;else{if(e=e.minus(r.times(i)),e.lte(s))return qe=bs(r)?n?2:3:n?4:1,e;qe=bs(r)?n?1:4:n?3:2}return e.minus(i).abs()}function Qn(t,e,r,n){var i,s,a,o,u,l,c,d,f,h=t.constructor,p=r!==void 0;if(p?(he(r,1,Ke),n===void 0?n=h.rounding:he(n,0,8)):(r=h.precision,n=h.rounding),!t.isFinite())c=Cs(t);else{for(c=Se(t),a=c.indexOf("."),p?(i=2,e==16?r=r*4-3:e==8&&(r=r*3-2)):i=e,a>=0&&(c=c.replace(".",""),f=new h(1),f.e=c.length-a,f.d=jr(Se(f),10,i),f.e=f.d.length),d=jr(c,10,i),s=u=d.length;d[--u]==0;)d.pop();if(!d[0])c=p?"0p+0":"0";else{if(a<0?s--:(t=new h(t),t.d=d,t.e=s,t=U(t,f,r,n,0,i),d=t.d,s=t.e,l=ys),a=d[r],o=i/2,l=l||d[r+1]!==void 0,l=n<4?(a!==void 0||l)&&(n===0||n===(t.s<0?3:2)):a>o||a===o&&(n===4||l||n===6&&d[r-1]&1||n===(t.s<0?8:7)),d.length=r,l)for(;++d[--r]>i-1;)d[r]=0,r||(++s,d.unshift(1));for(u=d.length;!d[u-1];--u);for(a=0,c="";a<u;a++)c+=Xn.charAt(d[a]);if(p){if(u>1)if(e==16||e==8){for(a=e==16?4:3,--u;u%a;u++)c+="0";for(d=jr(c,i,e),u=d.length;!d[u-1];--u);for(a=1,c="1.";a<u;a++)c+=Xn.charAt(d[a])}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>u)for(s-=u;s--;)c+="0";else s<u&&(c=c.slice(0,s)+"."+c.slice(s))}c=(e==16?"0x":e==2?"0b":e==8?"0o":"")+c}return t.s<0?"-"+c:c}function _s(t,e){if(t.length>e)return t.length=e,!0}function El(t){return new this(t).abs()}function xl(t){return new this(t).acos()}function Al(t){return new this(t).acosh()}function Dl(t,e){return new this(t).plus(e)}function Tl(t){return new this(t).asin()}function Cl(t){return new this(t).asinh()}function Nl(t){return new this(t).atan()}function Sl(t){return new this(t).atanh()}function Ol(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,s=n+4;return!t.s||!e.s?r=new this(NaN):!t.d&&!e.d?(r=Ne(this,s,1).times(e.s>0?.25:.75),r.s=t.s):!e.d||t.isZero()?(r=e.s<0?Ne(this,n,i):new this(0),r.s=t.s):!t.d||e.isZero()?(r=Ne(this,s,1).times(.5),r.s=t.s):e.s<0?(this.precision=s,this.rounding=1,r=this.atan(U(t,e,s,1)),e=Ne(this,s,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(U(t,e,s,1)),r}function Bl(t){return new this(t).cbrt()}function Il(t){return x(t=new this(t),t.e+1,2)}function Ml(t,e,r){return new this(t).clamp(e,r)}function Rl(t){if(!t||typeof t!="object")throw Error(Gr+"Object expected");var e,r,n,i=t.defaults===!0,s=["precision",1,Ke,"rounding",0,8,"toExpNeg",-kt,0,"toExpPos",0,kt,"maxE",0,kt,"minE",-kt,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(r=s[e],i&&(this[r]=Zn[r]),(n=t[r])!==void 0)if(le(n)===n&&n>=s[e+1]&&n<=s[e+2])this[r]=n;else throw Error(Ze+r+": "+n);if(r="crypto",i&&(this[r]=Zn[r]),(n=t[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(ks);else this[r]=!1;else throw Error(Ze+r+": "+n);return this}function Ll(t){return new this(t).cos()}function Fl(t){return new this(t).cosh()}function Ss(t){var e,r,n;function i(s){var a,o,u,l=this;if(!(l instanceof i))return new i(s);if(l.constructor=i,ws(s)){l.s=s.s,T?!s.d||s.e>i.maxE?(l.e=NaN,l.d=null):s.e<i.minE?(l.e=0,l.d=[0]):(l.e=s.e,l.d=s.d.slice()):(l.e=s.e,l.d=s.d?s.d.slice():s.d);return}if(u=typeof s,u==="number"){if(s===0){l.s=1/s<0?-1:1,l.e=0,l.d=[0];return}if(s<0?(s=-s,l.s=-1):l.s=1,s===~~s&&s<1e7){for(a=0,o=s;o>=10;o/=10)a++;T?a>i.maxE?(l.e=NaN,l.d=null):a<i.minE?(l.e=0,l.d=[0]):(l.e=a,l.d=[s]):(l.e=a,l.d=[s]);return}if(s*0!==0){s||(l.s=NaN),l.e=NaN,l.d=null;return}return zr(l,s.toString())}if(u==="string")return(o=s.charCodeAt(0))===45?(s=s.slice(1),l.s=-1):(o===43&&(s=s.slice(1)),l.s=1),xs.test(s)?zr(l,s):vl(l,s);if(u==="bigint")return s<0?(s=-s,l.s=-1):l.s=1,zr(l,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=Rl,i.clone=Ss,i.isDecimal=ws,i.abs=El,i.acos=xl,i.acosh=Al,i.add=Dl,i.asin=Tl,i.asinh=Cl,i.atan=Nl,i.atanh=Sl,i.atan2=Ol,i.cbrt=Bl,i.ceil=Il,i.clamp=Ml,i.cos=Ll,i.cosh=Fl,i.div=$l,i.exp=ql,i.floor=Pl,i.hypot=Ul,i.ln=jl,i.log=zl,i.log10=Hl,i.log2=Vl,i.max=Wl,i.min=Gl,i.mod=Yl,i.mul=Xl,i.pow=Zl,i.random=Kl,i.round=Jl,i.sign=Ql,i.sin=eu,i.sinh=tu,i.sqrt=ru,i.sub=nu,i.sum=iu,i.tan=su,i.tanh=au,i.trunc=ou,t===void 0&&(t={}),t&&t.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function $l(t,e){return new this(t).div(e)}function ql(t){return new this(t).exp()}function Pl(t){return x(t=new this(t),t.e+1,3)}function Ul(){var t,e,r=new this(0);for(T=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return T=!0,new this(1/0);r=e}return T=!0,r.sqrt()}function ws(t){return t instanceof Kt||t&&t.toStringTag===Es||!1}function jl(t){return new this(t).ln()}function zl(t,e){return new this(t).log(e)}function Vl(t){return new this(t).log(2)}function Hl(t){return new this(t).log(10)}function Wl(){return Ts(this,arguments,-1)}function Gl(){return Ts(this,arguments,1)}function Yl(t,e){return new this(t).mod(e)}function Xl(t,e){return new this(t).mul(e)}function Zl(t,e){return new this(t).pow(e)}function Kl(t){var e,r,n,i,s=0,a=new this(1),o=[];if(t===void 0?t=this.precision:he(t,1,Ke),n=Math.ceil(t/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]:o[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):(o.push(i%1e7),s+=4);s=n/4}else throw Error(ks);else for(;s<n;)o[s++]=Math.random()*1e7|0;for(n=o[--s],t%=A,n&&t&&(i=K(10,A-t),o[s]=(n/i|0)*i);o[s]===0;s--)o.pop();if(s<0)r=0,o=[0];else{for(r=-1;o[0]===0;r-=A)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<A&&(r-=A-n)}return a.e=r,a.d=o,a}function Jl(t){return x(t=new this(t),t.e+1,this.rounding)}function Ql(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function eu(t){return new this(t).sin()}function tu(t){return new this(t).sinh()}function ru(t){return new this(t).sqrt()}function nu(t,e){return new this(t).sub(e)}function iu(){var t=0,e=arguments,r=new this(e[t]);for(T=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return T=!0,x(r,this.precision,this.rounding)}function su(t){return new this(t).tan()}function au(t){return new this(t).tanh()}function ou(t){return x(t=new this(t),t.e+1,1)}b[Symbol.for("nodejs.util.inspect.custom")]=b.toString;b[Symbol.toStringTag]="Decimal";var Kt=b.constructor=Ss(Zn);Vr=new Kt(Vr);Hr=new Kt(Hr);var Os=Kt;var lu=20,uu=1,lt=1e6,Bs=1e6,cu=-7,du=21,fu=!1,Jt="[big.js] ",ut=Jt+"Invalid ",Zr=ut+"decimal places",hu=ut+"rounding mode",Is=Jt+"Division by zero",$={},Oe=void 0,pu=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function Ms(){function t(e){var r=this;if(!(r instanceof t))return e===Oe?Ms():new t(e);if(e instanceof t)r.s=e.s,r.e=e.e,r.c=e.c.slice();else{if(typeof e!="string"){if(t.strict===!0&&typeof e!="bigint")throw TypeError(ut+"value");e=e===0&&1/e<0?"-0":String(e)}mu(r,e)}r.constructor=t}return t.prototype=$,t.DP=lu,t.RM=uu,t.NE=cu,t.PE=du,t.strict=fu,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}function mu(t,e){var r,n,i;if(!pu.test(e))throw Error(ut+"number");for(t.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),i=e.length,n=0;n<i&&e.charAt(n)=="0";)++n;if(n==i)t.c=[t.e=0];else{for(;i>0&&e.charAt(--i)=="0";);for(t.e=r-n-1,t.c=[],r=0;n<=i;)t.c[r++]=+e.charAt(n++)}return t}function ct(t,e,r,n){var i=t.c;if(r===Oe&&(r=t.constructor.RM),r!==0&&r!==1&&r!==2&&r!==3)throw Error(hu);if(e<1)n=r===3&&(n||!!i[0])||e===0&&(r===1&&i[0]>=5||r===2&&(i[0]>5||i[0]===5&&(n||i[1]!==Oe))),i.length=1,n?(t.e=t.e-e+1,i[0]=1):i[0]=t.e=0;else if(e<i.length){if(n=r===1&&i[e]>=5||r===2&&(i[e]>5||i[e]===5&&(n||i[e+1]!==Oe||i[e-1]&1))||r===3&&(n||!!i[0]),i.length=e,n){for(;++i[--e]>9;)if(i[e]=0,e===0){++t.e,i.unshift(1);break}}for(e=i.length;!i[--e];)i.pop()}return t}function dt(t,e,r){var n=t.e,i=t.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 t.s<0&&r?"-"+i:i}$.abs=function(){var t=new this.constructor(this);return t.s=1,t};$.cmp=function(t){var e,r=this,n=r.c,i=(t=new r.constructor(t)).c,s=r.s,a=t.s,o=r.e,u=t.e;if(!n[0]||!i[0])return n[0]?s:i[0]?-a:0;if(s!=a)return s;if(e=s<0,o!=u)return o>u^e?1:-1;for(a=(o=n.length)<(u=i.length)?o:u,s=-1;++s<a;)if(n[s]!=i[s])return n[s]>i[s]^e?1:-1;return o==u?0:o>u^e?1:-1};$.div=function(t){var e=this,r=e.constructor,n=e.c,i=(t=new r(t)).c,s=e.s==t.s?1:-1,a=r.DP;if(a!==~~a||a<0||a>lt)throw Error(Zr);if(!i[0])throw Error(Is);if(!n[0])return t.s=s,t.c=[t.e=0],t;var o,u,l,c,d,f=i.slice(),h=o=i.length,p=n.length,m=n.slice(0,o),g=m.length,_=t,w=_.c=[],y=0,k=a+(_.e=e.e-t.e)+1;for(_.s=s,s=k<0?0:k,f.unshift(0);g++<o;)m.push(0);do{for(l=0;l<10;l++){if(o!=(g=m.length))c=o>g?1:-1;else for(d=-1,c=0;++d<o;)if(i[d]!=m[d]){c=i[d]>m[d]?1:-1;break}if(c<0){for(u=g==o?i:f;g;){if(m[--g]<u[g]){for(d=g;d&&!m[--d];)m[d]=9;--m[d],m[g]+=10}m[g]-=u[g]}for(;!m[0];)m.shift()}else break}w[y++]=c?l:++l,m[0]&&c?m[g]=n[h]||0:m=[n[h]]}while((h++<p||m[0]!==Oe)&&s--);return!w[0]&&y!=1&&(w.shift(),_.e--,k--),y>k&&ct(_,k,r.RM,m[0]!==Oe),_};$.eq=function(t){return this.cmp(t)===0};$.gt=function(t){return this.cmp(t)>0};$.gte=function(t){return this.cmp(t)>-1};$.lt=function(t){return this.cmp(t)<0};$.lte=function(t){return this.cmp(t)<1};$.minus=$.sub=function(t){var e,r,n,i,s=this,a=s.constructor,o=s.s,u=(t=new a(t)).s;if(o!=u)return t.s=-u,s.plus(t);var l=s.c.slice(),c=s.e,d=t.c,f=t.e;if(!l[0]||!d[0])return d[0]?t.s=-u:l[0]?t=new a(s):t.s=1,t;if(o=c-f){for((i=o<0)?(o=-o,n=l):(f=c,n=d),n.reverse(),u=o;u--;)n.push(0);n.reverse()}else for(r=((i=l.length<d.length)?l:d).length,o=u=0;u<r;u++)if(l[u]!=d[u]){i=l[u]<d[u];break}if(i&&(n=l,l=d,d=n,t.s=-t.s),(u=(r=d.length)-(e=l.length))>0)for(;u--;)l[e++]=0;for(u=e;r>o;){if(l[--r]<d[r]){for(e=r;e&&!l[--e];)l[e]=9;--l[e],l[r]+=10}l[r]-=d[r]}for(;l[--u]===0;)l.pop();for(;l[0]===0;)l.shift(),--f;return l[0]||(t.s=1,l=[f=0]),t.c=l,t.e=f,t};$.mod=function(t){var e,r=this,n=r.constructor,i=r.s,s=(t=new n(t)).s;if(!t.c[0])throw Error(Is);return r.s=t.s=1,e=t.cmp(r)==1,r.s=i,t.s=s,e?new n(r):(i=n.DP,s=n.RM,n.DP=n.RM=0,r=r.div(t),n.DP=i,n.RM=s,this.minus(r.times(t)))};$.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t};$.plus=$.add=function(t){var e,r,n,i=this,s=i.constructor;if(t=new s(t),i.s!=t.s)return t.s=-t.s,i.minus(t);var a=i.e,o=i.c,u=t.e,l=t.c;if(!o[0]||!l[0])return l[0]||(o[0]?t=new s(i):t.s=i.s),t;if(o=o.slice(),e=a-u){for(e>0?(u=a,n=l):(e=-e,n=o),n.reverse();e--;)n.push(0);n.reverse()}for(o.length-l.length<0&&(n=l,l=o,o=n),e=l.length,r=0;e;o[e]%=10)r=(o[--e]=o[e]+l[e]+r)/10|0;for(r&&(o.unshift(r),++u),e=o.length;o[--e]===0;)o.pop();return t.c=o,t.e=u,t};$.pow=function(t){var e=this,r=new e.constructor("1"),n=r,i=t<0;if(t!==~~t||t<-Bs||t>Bs)throw Error(ut+"exponent");for(i&&(t=-t);t&1&&(n=n.times(e)),t>>=1,!!t;)e=e.times(e);return i?r.div(n):n};$.prec=function(t,e){if(t!==~~t||t<1||t>lt)throw Error(ut+"precision");return ct(new this.constructor(this),t,e)};$.round=function(t,e){if(t===Oe)t=0;else if(t!==~~t||t<-lt||t>lt)throw Error(Zr);return ct(new this.constructor(this),t+this.e+1,e)};$.sqrt=function(){var t,e,r,n=this,i=n.constructor,s=n.s,a=n.e,o=new i("0.5");if(!n.c[0])return new i(n);if(s<0)throw Error(Jt+"No square root");s=Math.sqrt(+dt(n,!0,!0)),s===0||s===1/0?(e=n.c.join(""),e.length+a&1||(e+="0"),s=Math.sqrt(e),a=((a+1)/2|0)-(a<0||a&1),t=new i((s==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+a)):t=new i(s+""),a=t.e+(i.DP+=4);do r=t,t=o.times(r.plus(n.div(r)));while(r.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return ct(t,(i.DP-=4)+t.e+1,i.RM)};$.times=$.mul=function(t){var e,r=this,n=r.constructor,i=r.c,s=(t=new n(t)).c,a=i.length,o=s.length,u=r.e,l=t.e;if(t.s=r.s==t.s?1:-1,!i[0]||!s[0])return t.c=[t.e=0],t;for(t.e=u+l,a<o&&(e=i,i=s,s=e,l=a,a=o,o=l),e=new Array(l=a+o);l--;)e[l]=0;for(u=o;u--;){for(o=0,l=a+u;l>u;)o=e[l]+s[u]*i[l-u-1]+o,e[l--]=o%10,o=o/10|0;e[l]=o}for(o?++t.e:e.shift(),u=e.length;!e[--u];)e.pop();return t.c=e,t};$.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==Oe){if(t!==~~t||t<0||t>lt)throw Error(Zr);for(r=ct(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return dt(r,!0,!!n)};$.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==Oe){if(t!==~~t||t<0||t>lt)throw Error(Zr);for(r=ct(new r.constructor(r),t+r.e+1,e),t=t+r.e+1;r.c.length<t;)r.c.push(0)}return dt(r,!1,!!n)};$[Symbol.for("nodejs.util.inspect.custom")]=$.toJSON=$.toString=function(){var t=this,e=t.constructor;return dt(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])};$.toNumber=function(){var t=+dt(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(t.toString()))throw Error(Jt+"Imprecise conversion");return t};$.toPrecision=function(t,e){var r=this,n=r.constructor,i=r.c[0];if(t!==Oe){if(t!==~~t||t<1||t>lt)throw Error(ut+"precision");for(r=ct(new n(r),t,e);r.c.length<t;)r.c.push(0)}return dt(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!i)};$.valueOf=function(){var t=this,e=t.constructor;if(e.strict===!0)throw Error(Jt+"valueOf disallowed");return dt(t,t.e<=e.NE||t.e>=e.PE,!0)};var gu=Ms(),Rs=gu;var ci={};ms(ci,{DecodeError:()=>ue,Decoder:()=>Te,EXT_TIMESTAMP:()=>ti,Encoder:()=>xt,ExtData:()=>De,ExtensionCodec:()=>Je,decode:()=>Vs,decodeArrayStream:()=>Gs,decodeAsync:()=>Ws,decodeMulti:()=>Hs,decodeMultiStream:()=>Ys,decodeTimestampExtension:()=>ai,decodeTimestampToTimeSpec:()=>si,encode:()=>Qr,encodeDateToTimeSpec:()=>ni,encodeTimeSpecToTimestamp:()=>ri,encodeTimestampExtension:()=>ii});function Ls(t){let e=t.length,r=0,n=0;for(;n<e;){let i=t.charCodeAt(n++);if((i&4294967168)===0){r++;continue}else if((i&4294965248)===0)r+=2;else{if(i>=55296&&i<=56319&&n<e){let s=t.charCodeAt(n);(s&64512)===56320&&(++n,i=((i&1023)<<10)+(s&1023)+65536)}(i&4294901760)===0?r+=3:r+=4}}return r}function bu(t,e,r){let n=t.length,i=r,s=0;for(;s<n;){let a=t.charCodeAt(s++);if((a&4294967168)===0){e[i++]=a;continue}else if((a&4294965248)===0)e[i++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&s<n){let o=t.charCodeAt(s);(o&64512)===56320&&(++s,a=((a&1023)<<10)+(o&1023)+65536)}(a&4294901760)===0?(e[i++]=a>>12&15|224,e[i++]=a>>6&63|128):(e[i++]=a>>18&7|240,e[i++]=a>>12&63|128,e[i++]=a>>6&63|128)}e[i++]=a&63|128}}var _u=new TextEncoder,wu=50;function yu(t,e,r){_u.encodeInto(t,e.subarray(r))}function Fs(t,e,r){t.length>wu?yu(t,e,r):bu(t,e,r)}var vu=4096;function ei(t,e,r){let n=e,i=n+r,s=[],a="";for(;n<i;){let o=t[n++];if((o&128)===0)s.push(o);else if((o&224)===192){let u=t[n++]&63;s.push((o&31)<<6|u)}else if((o&240)===224){let u=t[n++]&63,l=t[n++]&63;s.push((o&31)<<12|u<<6|l)}else if((o&248)===240){let u=t[n++]&63,l=t[n++]&63,c=t[n++]&63,d=(o&7)<<18|u<<12|l<<6|c;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(o);s.length>=vu&&(a+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(a+=String.fromCharCode(...s)),a}var ku=new TextDecoder,Eu=200;function xu(t,e,r){let n=t.subarray(e,e+r);return ku.decode(n)}function $s(t,e,r){return r>Eu?xu(t,e,r):ei(t,e,r)}var De=class{type;data;constructor(e,r){this.type=e,this.data=r}};var ue=class t extends Error{constructor(e){super(e);let r=Object.create(t.prototype);Object.setPrototypeOf(this,r),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:t.name})}};function qs(t,e,r){let n=r/4294967296,i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function Kr(t,e,r){let n=Math.floor(r/4294967296),i=r;t.setUint32(e,n),t.setUint32(e+4,i)}function Jr(t,e){let r=t.getInt32(e),n=t.getUint32(e+4);return r*4294967296+n}function Ps(t,e){let r=t.getUint32(e),n=t.getUint32(e+4);return r*4294967296+n}var ti=-1,Au=4294967296-1,Du=17179869184-1;function ri({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=Du)if(e===0&&t<=Au){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}else{let r=t/4294967296,n=t&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,e<<2|r&3),s.setUint32(4,n),i}else{let r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,e),Kr(n,4,t),r}}function ni(t){let e=t.getTime(),r=Math.floor(e/1e3),n=(e-r*1e3)*1e6,i=Math.floor(n/1e9);return{sec:r+i,nsec:n-i*1e9}}function ii(t){if(t instanceof Date){let e=ni(t);return ri(e)}else return null}function si(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{let r=e.getUint32(0),n=e.getUint32(4),i=(r&3)*4294967296+n,s=r>>>2;return{sec:i,nsec:s}}case 12:{let r=Jr(e,4),n=e.getUint32(0);return{sec:r,nsec:n}}default:throw new ue(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function ai(t){let e=si(t);return new Date(e.sec*1e3+e.nsec/1e6)}var Us={type:ti,encode:ii,decode:ai};var Je=class t{static defaultCodec=new t;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(Us)}register({type:e,encode:r,decode:n}){if(e>=0)this.encoders[e]=r,this.decoders[e]=n;else{let i=-1-e;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}}tryToEncode(e,r){for(let n=0;n<this.builtInEncoders.length;n++){let i=this.builtInEncoders[n];if(i!=null){let s=i(e,r);if(s!=null){let a=-1-n;return new De(a,s)}}}for(let n=0;n<this.encoders.length;n++){let i=this.encoders[n];if(i!=null){let s=i(e,r);if(s!=null){let a=n;return new De(a,s)}}}return e instanceof De?e:null}decode(e,r,n){let i=r<0?this.builtInDecoders[-1-r]:this.decoders[r];return i?i(e,r,n):new De(r,e)}};function Tu(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function Qt(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Tu(t)?new Uint8Array(t):Uint8Array.from(t)}var Cu=100,Nu=2048,xt=class t{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??Cu,this.initialBufferSize=e?.initialBufferSize??Nu,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 t({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,r){if(r>this.maxDepth)throw new Error(`Too deep objects in depth ${r}`);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,r)}ensureBufferSizeToWrite(e){let r=this.pos+e;this.view.byteLength<r&&this.resizeBuffer(r*2)}resizeBuffer(e){let r=new ArrayBuffer(e),n=new Uint8Array(r),i=new DataView(r);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=Ls(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),Fs(e,this.bytes,this.pos),this.pos+=n}encodeObject(e,r){let n=this.extensionCodec.tryToEncode(e,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,r);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,r);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let r=e.byteLength;if(r<256)this.writeU8(196),this.writeU8(r);else if(r<65536)this.writeU8(197),this.writeU16(r);else if(r<4294967296)this.writeU8(198),this.writeU32(r);else throw new Error(`Too large binary: ${r}`);let n=Qt(e);this.writeU8a(n)}encodeArray(e,r){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,r+1)}countWithoutUndefined(e,r){let n=0;for(let i of r)e[i]!==void 0&&n++;return n}encodeMap(e,r){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 a=e[s];this.ignoreUndefined&&a===void 0||(this.encodeString(s),this.doEncode(a,r+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 r=e.data.length;if(r===1)this.writeU8(212);else if(r===2)this.writeU8(213);else if(r===4)this.writeU8(214);else if(r===8)this.writeU8(215);else if(r===16)this.writeU8(216);else if(r<256)this.writeU8(199),this.writeU8(r);else if(r<65536)this.writeU8(200),this.writeU16(r);else if(r<4294967296)this.writeU8(201),this.writeU32(r);else throw new Error(`Too large extension object: ${r}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let r=e.length;this.ensureBufferSizeToWrite(r),this.bytes.set(e,this.pos),this.pos+=r}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),qs(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),Kr(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 Qr(t,e){return new xt(e).encodeSharedRef(t)}function en(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}var Su=16,Ou=16,tn=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=Su,r=Ou){this.maxKeyLength=e,this.maxLengthPerKey=r,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,r,n){let i=this.caches[n-1];e:for(let s of i){let a=s.bytes;for(let o=0;o<n;o++)if(a[o]!==e[r+o])continue e;return s.str}return null}store(e,r){let n=this.caches[e.length-1],i={bytes:e,str:r};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=i:n.push(i)}decode(e,r,n){let i=this.find(e,r,n);if(i!=null)return this.hit++,i;this.miss++;let s=ei(e,r,n),a=Uint8Array.prototype.slice.call(e,r,r+n);return this.store(a,s),s}};var oi="array",rr="map_key",zs="map_value",Bu=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new ue("The type of key must be string or number but "+typeof t)},li=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let r=this.getUninitializedStateFromPool();r.type=oi,r.position=0,r.size=e,r.array=new Array(e)}pushMapState(e){let r=this.getUninitializedStateFromPool();r.type=rr,r.readCount=0,r.size=e,r.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===oi){let n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===rr||e.type===zs){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}},tr=-1,ui=new DataView(new ArrayBuffer(0)),Iu=new Uint8Array(ui.buffer);try{ui.getInt8(0)}catch(t){if(!(t 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 js=new RangeError("Insufficient data"),Mu=new tn,Te=class t{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=ui;bytes=Iu;headByte=tr;stack=new li;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:Mu,this.mapKeyConverter=e?.mapKeyConverter??Bu}clone(){return new t({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=tr,this.stack.reset()}setBuffer(e){let r=Qt(e);this.bytes=r,this.view=new DataView(r.buffer,r.byteOffset,r.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===tr&&!this.hasRemaining(1))this.setBuffer(e);else{let r=this.bytes.subarray(this.pos),n=Qt(e),i=new Uint8Array(r.length+n.length);i.set(r),i.set(n,r.length),this.setBuffer(i)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:r,pos:n}=this;return new RangeError(`Extra ${r.byteLength-n} of ${r.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 r=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return r}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 r=!1,n;for await(let o of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(o);try{n=this.doDecodeSync(),r=!0}catch(u){if(!(u instanceof RangeError))throw u}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}let{headByte:i,pos:s,totalPos:a}=this;throw new RangeError(`Insufficient data in parsing ${en(i)} at ${a} (${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,r){if(this.entered){yield*this.clone().decodeMultiAsync(e,r);return}try{this.entered=!0;let n=r,i=-1;for await(let s of e){if(r&&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(a){if(!(a instanceof RangeError))throw a}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let e=this.readHeadByte(),r;if(e>=224)r=e-256;else if(e<192)if(e<128)r=e;else if(e<144){let i=e-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e<160){let i=e-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else{let i=e-160;r=this.decodeString(i,0)}else if(e===192)r=null;else if(e===194)r=!1;else if(e===195)r=!0;else if(e===202)r=this.readF32();else if(e===203)r=this.readF64();else if(e===204)r=this.readU8();else if(e===205)r=this.readU16();else if(e===206)r=this.readU32();else if(e===207)this.useBigInt64?r=this.readU64AsBigInt():r=this.readU64();else if(e===208)r=this.readI8();else if(e===209)r=this.readI16();else if(e===210)r=this.readI32();else if(e===211)this.useBigInt64?r=this.readI64AsBigInt():r=this.readI64();else if(e===217){let i=this.lookU8();r=this.decodeString(i,1)}else if(e===218){let i=this.lookU16();r=this.decodeString(i,2)}else if(e===219){let i=this.lookU32();r=this.decodeString(i,4)}else if(e===220){let i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===221){let i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else r=[]}else if(e===222){let i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===223){let i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else r={}}else if(e===196){let i=this.lookU8();r=this.decodeBinary(i,1)}else if(e===197){let i=this.lookU16();r=this.decodeBinary(i,2)}else if(e===198){let i=this.lookU32();r=this.decodeBinary(i,4)}else if(e===212)r=this.decodeExtension(1,0);else if(e===213)r=this.decodeExtension(2,0);else if(e===214)r=this.decodeExtension(4,0);else if(e===215)r=this.decodeExtension(8,0);else if(e===216)r=this.decodeExtension(16,0);else if(e===199){let i=this.lookU8();r=this.decodeExtension(i,1)}else if(e===200){let i=this.lookU16();r=this.decodeExtension(i,2)}else if(e===201){let i=this.lookU32();r=this.decodeExtension(i,4)}else throw new ue(`Unrecognized type byte: ${en(e)}`);this.complete();let n=this.stack;for(;n.length>0;){let i=n.top();if(i.type===oi)if(i.array[i.position]=r,i.position++,i.position===i.size)r=i.array,n.release(i);else continue e;else if(i.type===rr){if(r==="__proto__")throw new ue("The key __proto__ is not allowed");i.key=this.mapKeyConverter(r),i.type=zs;continue e}else if(i.map[i.key]=r,i.readCount++,i.readCount===i.size)r=i.map,n.release(i);else{i.key=null,i.type=rr;continue e}}return r}}readHeadByte(){return this.headByte===tr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=tr}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: ${en(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,r){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,r):this.decodeBinary(e,r)}decodeUtf8String(e,r){if(e>this.maxStrLength)throw new ue(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+r+e)throw js;let n=this.pos+r,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,n,e):i=$s(this.bytes,n,e),this.pos+=r+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===rr:!1}decodeBinary(e,r){if(e>this.maxBinLength)throw new ue(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+r))throw js;let n=this.pos+r,i=this.bytes.subarray(n,n+e);return this.pos+=r+e,i}decodeExtension(e,r){if(e>this.maxExtLength)throw new ue(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let n=this.view.getInt8(this.pos+r),i=this.decodeBinary(e,r+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=Ps(this.view,this.pos);return this.pos+=8,e}readI64(){let e=Jr(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 Vs(t,e){return new Te(e).decode(t)}function Hs(t,e){return new Te(e).decodeMulti(t)}function Ru(t){return t[Symbol.asyncIterator]!=null}async function*Lu(t){let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)return;yield n}}finally{e.releaseLock()}}function rn(t){return Ru(t)?t:Lu(t)}async function Ws(t,e){let r=rn(t);return new Te(e).decodeAsync(r)}function Gs(t,e){let r=rn(t);return new Te(e).decodeArrayStream(r)}function Ys(t,e){let r=rn(t);return new Te(e).decodeStream(r)}var kn=gs(Bi(),1),Ii=Os,Mi=Rs,Re=ci,Qa=kn.DOMParser,eo=kn.XMLSerializer;var to=Re!==null;function ro(){if(!to)throw new Error("@msgpack/msgpack is required for MessagePack support. Install with: npm install @msgpack/msgpack")}var no=Rd();function Rd(){if(!to)return null;let t=new TextEncoder,e=new TextDecoder,r=new Re.ExtensionCodec;return r.register({type:-1,encode:n=>{if(n instanceof Date){let i=gt(n);if(i==="D"||i==="H")return null}return Re.encodeTimestampExtension(n)},decode:n=>Re.decodeTimestampExtension(n)}),r.register({type:1,encode:n=>oe(n)?t.encode(n.toString()):null,decode:n=>kr(e.decode(n))}),r.register({type:2,encode:n=>{if(n instanceof Date&&gt(n)==="D"){let i=n.getUTCFullYear(),s=String(n.getUTCMonth()+1).padStart(2,"0"),a=String(n.getUTCDate()).padStart(2,"0");return t.encode(`${i}-${s}-${a}`)}return null},decode:n=>new Date(e.decode(n)+"T00:00:00.000Z")}),r.register({type:3,encode:n=>{if(n instanceof Date&&gt(n)==="H"){let i=String(n.getUTCHours()).padStart(2,"0"),s=String(n.getUTCMinutes()).padStart(2,"0"),a=String(n.getUTCSeconds()).padStart(2,"0"),o=String(n.getUTCMilliseconds()).padStart(3,"0");return t.encode(`${i}:${s}:${a}.${o}`)}return null},decode:n=>{let i=e.decode(n),s=i.indexOf("."),a=s>=0?i.substring(0,s):i,o=s>=0?i.substring(s+1):"0",[u,l,c]=a.split(":"),d=Math.round(+o.substring(0,3));return new Date(Date.UTC(1970,0,1,+u,+l,+c,d))}}),r.register({type:4,encode:n=>{let i=Ri(n);if(i!==null){let[s,a]=i;return t.encode(`${s}:${a(n)}`)}return null},decode:n=>{let i=e.decode(n),s=i.indexOf(":"),a=i.slice(0,s),o=i.slice(s+1),u=st[a];if(u!==void 0){let[,l]=u;return l(o)}return`${o}::${a}`}}),r}function io(t){return ro(),Re.encode(t,{extensionCodec:no})}function so(t){return ro(),Re.decode(t,{extensionCodec:no})}function xn(t,e=!1){let r=An(t);if(r===null)return[!1,String(t)];let[n,i,s]=r;return s&&!e?[!1,String(t)]:[!0,`${i(t)}::${n}`]}function Li(t){if(!t.includes("::"))return[!1,t];let e=t.lastIndexOf("::"),r=t.slice(0,e),n=t.slice(e+2),i=st[n];if(i===void 0)return[!1,t];let[,s]=i;return[!0,s(r)]}function En(t,e,r){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){let n={};for(let[i,s]of Object.entries(t))n[i]=En(s,e,r);return n}return Array.isArray(t)?t.map(n=>En(n,e,r)):r(t)?e(t):t}function Fi(t){let e=An(t);if(e!==null){let[r,n,i]=e;return i?[t,!1]:[`${n(t)}::${r}`,!0]}if(Array.isArray(t)){let r=!1;return[t.map(i=>{let[s,a]=Fi(i);return a&&(r=!0),s}),r]}if(t!==null&&typeof t=="object"){let r=!1,n={};for(let[i,s]of Object.entries(t)){let[a,o]=Fi(s);o&&(r=!0),n[i]=a}return[n,r]}return[t,!1]}function Ld(t,e=!1){let[r,n]=xn(t,e);if(r)return n;let[i,s]=Fi(t),a=JSON.stringify(i);return s?`${a}::JS`:a}function Fd(t){return JSON.stringify(t)}function $d(t){if(!Re)throw new Error("@msgpack/msgpack is required for MessagePack support");return Re.encode(t)}function be(t,e=null,{raw:r=!1,qs:n=!1,_forceSuffix:i=!1}={}){if(n)return`${oo(t)}::QS`;if(r){if(e===null||e==="json")return Fd(t);if(e==="msgpack")return $d(t);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=Ld(t,i);return e==="json"?`"${s}"`:s}else{if(e==="xml")return`<?xml version="1.0" ?><tytx_root>${ao(t)}</tytx_root>`;if(e==="msgpack")return io(t);throw new Error(`Unknown transport: ${e}`)}}var zt,$i;typeof window<"u"&&window.DOMParser?(zt=window.DOMParser,$i=window.XMLSerializer):(zt=Qa,$i=eo);function lo(t){if(t===null||typeof t!="object"||Array.isArray(t))return!1;let e=Object.keys(t);if(e.length!==1)return!1;let r=t[e[0]];return r!==null&&typeof r=="object"&&"value"in r}function uo(t,e,r){let n=t.createElement(e),i=r.attrs||{},s=r.value;for(let[a,o]of Object.entries(i))n.setAttribute(a,be(o,null,{_forceSuffix:!0}));if(Array.isArray(s))for(let a of s)if(lo(a)){let[o]=Object.keys(a),u=a[o],l=uo(t,o,u);n.appendChild(l)}else{n.textContent=be(s);break}else n.textContent=be(s);return n}function ao(t){if(!zt)throw new Error("XML support requires @xmldom/xmldom package in Node.js");if(lo(t)){let[e]=Object.keys(t),r=t[e],n=new zt().parseFromString("<root/>","text/xml"),i=uo(n,e,r);return new $i().serializeToString(i)}else return be(t)}function qi(t){let e={};for(let n=0;n<t.attributes.length;n++){let i=t.attributes[n];e[i.name]=X(i.value)}let r=[];for(let n=0;n<t.childNodes.length;n++){let i=t.childNodes[n];i.nodeType===1&&r.push(i)}if(r.length>0)if(r.length===1){let n=r[0],i=qi(n);return{attrs:e,value:{[n.tagName]:i}}}else{let n=[];for(let i of r){let s=qi(i);n.push({[i.tagName]:s})}return{attrs:e,value:n}}return{attrs:e,value:X(t.textContent)}}function co(t){if(!zt)throw new Error("XML support requires @xmldom/xmldom package in Node.js");let n=new zt().parseFromString(t,"text/xml").documentElement;if(n.tagName==="tytx_root"){let s=null;for(let a=0;a<n.childNodes.length;a++)if(n.childNodes[a].nodeType===1){s=n.childNodes[a];break}if(!s)return X(n.textContent);n=s}let i=qi(n);return{[n.tagName]:i}}function qd(t){return typeof t=="string"}function Pd(t){let[e,r]=Li(t);if(e)return r;let n=t;n.endsWith("::JS")&&(n=n.slice(0,-4));let i;try{i=JSON.parse(n)}catch{return t}return En(i,Ud,qd)}function Ud(t){return t.includes("::")?Li(t)[1]:t}function jd(t){let e=co(t);return typeof e=="string"?X(e):e}function zd(t){return so(t)}function X(t,e=null){if(t===null)return null;if(e===null||e==="json"){let r=t;return e==="json"&&t.startsWith('"')&&t.endsWith('"')&&(r=t.slice(1,-1)),Pd(r)}else{if(e==="xml")return jd(t);if(e==="msgpack")return zd(t);throw new Error(`Unknown transport: ${e}`)}}function oo(t){if(Array.isArray(t))return t.map(e=>String(e)).join("&");if(t!==null&&typeof t=="object"){let e=[];for(let[r,n]of Object.entries(t)){let[i,s]=xn(n,!0);i?e.push(`${r}=${s}`):e.push(`${r}=${n}`)}return e.join("&")}throw new TypeError(`toQs expects object or array, got ${typeof t}`)}function fo(t){if(!t)return[];let e=t.split("&"),r=e.map(a=>a.includes("=")),n=r.every(Boolean),i=!r.some(Boolean);if(!n&&!i)throw new Error("QS format error: mixed items with and without '='");if(i)return e.map(a=>X(a));let s={};for(let a of e){let o=a.indexOf("="),u=a.slice(0,o),l=a.slice(o+1);s[u]=X(l)}return s}var po=Ii||Mi||Number,Vd=Ii?"decimal.js":Mi?"big.js":"number";function kr(t){return new po(t)}function oe(t){return Vd==="number"?!1:t instanceof po}function gt(t){let e=t.getUTCFullYear()===1970&&t.getUTCMonth()===0&&t.getUTCDate()===1,r=t.getUTCHours()===0&&t.getUTCMinutes()===0&&t.getUTCSeconds()===0&&t.getUTCMilliseconds()===0;return e&&!r?"H":r&&!e?"D":"DHZ"}function Hd(t){return t.toString()}function Wd(t){let e=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),n=String(t.getUTCDate()).padStart(2,"0");return`${e}-${r}-${n}`}function Gd(t){return t.toISOString()}function Yd(t){let e=String(t.getUTCHours()).padStart(2,"0"),r=String(t.getUTCMinutes()).padStart(2,"0"),n=String(t.getUTCSeconds()).padStart(2,"0"),i=String(t.getUTCMilliseconds()).padStart(3,"0");return`${e}:${r}:${n}.${i}`}function Xd(t){return t?"true":"false"}function Zd(t){return t.toString()}function Kd(t){return t.toString()}function Jd(t){let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode.apply(null,t.subarray(r,r+32768));return btoa(e)}var Dn=[],Pi=new Map;function Ri(t){if(t===null||typeof t!="object")return null;for(let e=Object.getPrototypeOf(t);e!==null;e=Object.getPrototypeOf(e))for(let[r,n,i,s]of Dn)if(r.prototype===e)return[n,i,s];return null}function An(t){if(t===null)return["NN",()=>"",!0];if(oe(t))return["N",Hd,!1];if(t instanceof Uint8Array)return["RAW",Jd,!1];if(t instanceof Date){let e=gt(t);return e==="D"?["D",Wd,!1]:e==="H"?["H",Yd,!1]:["DHZ",Gd,!1]}return typeof t=="boolean"?["B",Xd,!0]:typeof t=="number"?Number.isInteger(t)?["L",Zd,!0]:["R",Kd,!0]:Ri(t)}function Qd(t){return kr(t)}function ef(t){let[e,r,n]=t.split("-").map(Number);return new Date(Date.UTC(e,r-1,n,0,0,0,0))}function ho(t){return new Date(t)}function tf(t){let[e,r,n]=t.split(":"),[i,s]=n.split(".");return new Date(Date.UTC(1970,0,1,Number(e),Number(r),Number(i),Number(s||0)))}function rf(t){return t.toLowerCase()==="true"}function nf(t){return parseInt(t,10)}function sf(t){return parseFloat(t)}function af(t){return t}function of(t){return null}var lf=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;function uf(t){if(!lf.test(t))throw new Error(`RAW payload is not standard padded base64: '${t}'`);let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function cf(t){return fo(t)}var df=/^[A-Z]+$/,st={N:[Object,Qd],D:[Date,ef],DH:[Date,ho],DHZ:[Date,ho],H:[Date,tf],L:[Number,nf],R:[Number,sf],T:[String,af],B:[Boolean,rf],QS:[Object,cf],NN:[null,of],RAW:[Uint8Array,uf]};function Er(t){return Object.hasOwn(st,t)?st[t][0]:null}function Ui(t,e,r,n,i=!1){if(typeof e!="string"||!df.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]!==t){let a=s[0]===null?"null":s[0].name;throw new Error(`TYTX suffix '${e}' is already registered for ${a}`)}Dn=Dn.filter(([a])=>a!==t),Dn.push([t,e,r,i]),st[e]=[t,n]}function xr(t,e){Pi.set(t,e)}function ze(t){return Pi.has(t)?Pi.get(t):{}}var Ar=class{constructor(e,r){this.store=e,this.format=r}read(e,r=this.store.getRows()){return r.map(n=>({node:n,cells:e.map(i=>i.check?"":ji(this.store.value(n,i.field),i,this.format))}))}};function ji(t,e,r){if(t==null)return"";let{dtype:n,format:i}=e;if(n==="T"&&typeof t!="string"||n==="B"&&typeof t!="boolean")throw new TypeError(`grid ${e.field} does not match ${n}`);if(typeof t=="string"||typeof t=="boolean"){if(n&&!["T","B"].includes(n)||i!=null)throw new TypeError(`grid ${e.field} requires a typed numeric or temporal value`);return String(t)}if(t instanceof Date||i!=null)return r(t,{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(t))throw new TypeError("grid L requires an integer");if(typeof t=="number"&&Number.isFinite(t)||oe(t)&&t.isFinite())return String(t);throw new TypeError(`grid ${e.field} requires a scalar value`)}function at(t){if(typeof t!="string"||!["^","="].includes(t[0])||t.startsWith("=="))return null;let e=t.indexOf(":");if(e<0)return null;let r=t[e+1]==="=";return{pointer:t.slice(0,e),expression:r,body:t.slice(e+(r?2:1))}}var mo=/^\{(\??[A-Za-z_][A-Za-z0-9_]*|\?)?\}/;function zi(t,e){let r="",n=!1;for(let i=0;i<t.length;){if(t[i]!=="{"&&t[i]!=="}"){r+=t[i++];continue}let s=t.slice(i).match(mo);if(!s)throw new SyntaxError("Invalid pointer template placeholder");let a=s[1]??"",o=a.startsWith("?"),u=e(o?a.slice(1):a);u==null||u===""&&!o?n=!0:r+=String(u),i+=s[0].length}return n?null:r}function Vi(t){let e=[],r=new Set,n="",i=!0;for(let s=0;s<t.length;){let a=s,o=t[s];if(o==='"'||o==="'"||o==="`"){for(s++;s<t.length;){if(t[s]==="\\"){s+=2;continue}if(t[s++]===o)break}n+=t.slice(a,s),i=!1;continue}if(t.startsWith("//",s)){s=t.indexOf(`
13
- `,s),s<0&&(s=t.length),n+=t.slice(a,s);continue}if(t.startsWith("/*",s)){let c=t.indexOf("*/",s+2);s=c<0?t.length:c+2,n+=t.slice(a,s);continue}if(o==="/"&&i){let c=!1;for(s++;s<t.length;){let d=t[s++];if(d==="\\"){s++;continue}if(d==="[")c=!0;else if(d==="]")c=!1;else if(d==="/"&&!c)break}for(;/[a-z]/i.test(t[s]??"")&&s<t.length;)s++;n+=t.slice(a,s),i=!1;continue}let u=o==="{"?t.slice(s).match(mo):null;if(u){let c=u[1]??"";if(c.startsWith("?"))throw new SyntaxError("Optional slots are supported in pointer templates only");n+=`_pointerValues[${e.length}]`,e.push(c),s+=u[0].length,i=!1;continue}let l=t.slice(s).match(/^[A-Za-z_$][\w$]*/);if(l){r.add(l[0]),n+=l[0],s+=l[0].length,i=["return","typeof","void","delete","new","in","instanceof","yield","await"].includes(l[0]);continue}n+=o,s++,/\s/.test(o)||(i=/[([{,:;=!?&|+*%~<>\/-]/.test(o))}return{text:n,slots:e,identifiers:r}}function go(t,e,r=()=>null){let n=new Map,i=[],s=a=>{if(n.has(a))return n.get(a);if(!t.has(a))throw new Error(`Referenced Source attribute '${a}' does not exist`);if(i.includes(a))throw new Error(`Cyclic attribute dependency: ${[...i,a].join(" -> ")}`);i.push(a);try{let o=t.get(a),u=typeof a=="string"?at(o):null,l=e.get(a);if(u){let c=d=>d?s(d):e.get(a);if(u.expression){let d=Vi(u.body);l=r(a,o,d,d.slots.map(c))}else l=zi(u.body,c),e.get(a)==null&&(l=null)}return n.set(a,l),l}finally{i.pop()}};return new Map([...t.keys()].map(a=>[a,s(a)]))}function Hi(t,e){let r=new Map([...Object.entries(t.getAttr()),...t.fixedAttrItems()]),n=new Set,i=[],s=a=>{let o=at(a);if(!o)return;let u=[];o.expression?u.push(...Vi(o.body).slots):zi(o.body,l=>(u.push(l),""));for(let l of u.filter(Boolean)){if(!r.has(l))throw new Error(`Referenced Source attribute '${l}' does not exist`);if(i.includes(l))throw new Error(`Cyclic attribute dependency: ${[...i,l].join(" -> ")}`);n.has(l)||(i.push(l),s(r.get(l)),i.pop(),n.add(l))}};return s(e),n}var bo={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 hf(t){let e=t._retryPolicy;return e==null?null:typeof e=="string"?bo[e]||null:e}function pf(t,e){return e.some(r=>r==="Error"?!0:t.name===r||t.constructor.name===r)}function mf(t){return new Promise(e=>setTimeout(e,t))}async function gf(t,e){if(!e)return t();let r=e.maxAttempts||3,n=e.delay||1,i=e.backoff||2,s=e.jitter!==!1,a=e.on||["Error"],o=null,u=n*1e3;for(let l=0;l<r;l++)try{let c=t();return c instanceof Promise?await c:c}catch(c){if(o=c,l<r-1&&pf(c,a)){let d=u;s&&(d*=1+Math.random()*.1),await mf(d),u*=i}else throw c}throw o}var ee=class t{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,a]of Object.entries(n))i.has(s)||(this._kw[s]=a);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 r of Object.keys(this._kw))Object.hasOwn(this._node.attr,r)&&(e[r]=this._node.attr[r]);return e}resolve(e={}){let{static:r=!1,...n}=e;if(r)return this._node?this._node._value:this.cachedValue;let i=this._buildEffectiveKw();if(Object.keys(n).length>0)return this._load({...i,...n},a=>this._prepareValue(a));let s=this._computeEffectiveFingerprint(i);return s===this._lastEffectiveFingerprint&&!this.expired?this.cachedValue:(this._lastEffectiveFingerprint=s,this._load(i,a=>this._finalize(a)))}_load(e,r){let n=hf(this),i=()=>this.load(e);if(n)return gf(i,n).then(r);let s=i();return s&&typeof s.then=="function"?s.then(r):r(s)}_finalize(e){return e=this._prepareValue(e),this._lastUpdate=Date.now(),(!this.readOnly||this.cacheTime!==0)&&(this.cachedValue=e),e}_prepareValue(e){let r;return this._asBag===!0?r=!0:this._asBag===!1?r=!1:r=!this._readOnly,r&&e!==null&&e!==void 0&&(e=this._convertToBag(e)),e}_convertToBag(e){let r=t._BagClass;if(!r||e&&typeof e._htraverse=="function")return e;if(typeof e=="string"){if(e=e.trim(),e.startsWith("<")&&r.fromXml)return r.fromXml(e);if((e.startsWith("{")||e.startsWith("["))&&r.fromTytx)return r.fromTytx(e)}return e}static registerBagClass(e){t._BagClass=e}load(e){return null}};ee._BagClass=null;var Dr=class extends ee{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 t{constructor(e,r,n=null,i=null,s=null,a=null,o=null,u=!0){this.label=r,this._value=null,this._attr={},this._parentBag=null,this._resolver=null,this._nodeSubscribers={},this._onChangedValue=null,this.nodeTag=a,this.xmlTag=o,this._compiled=null,this.parentBag=e,i&&this.setAttr(i,!1,!0,u),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,r=null,n={}){if(r!==null){let i=X(`${r}::QS`);if(Array.isArray(i)){let s=i.length?i:Object.keys(this._attr),a=s.map(u=>{let l=this.getAttr(u);return!e&&l instanceof ee?l.resolve():l}),o=u=>i.length===0?Object.fromEntries(s.map((l,c)=>[l,u[c]])):u.length===1?u[0]:u;return a.some(u=>u&&typeof u.then=="function")?Promise.all(a).then(o):o(a)}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,r=!0,n=null,i=null,s=!0,a=null,o=!1){e instanceof ee?(this.resolver=e,e=null):e instanceof t&&(n=n||{},Object.assign(n,e._attr),e.resolver&&(this.resolver=e.resolver),e=e._value);let u=this._value;u!==e&&u?.parentNode===this&&u.setBackref(),this._value=e;let l=u!==this._value,c=r??!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}r=c&&(l||d!==null);let f=d?l?"upd_value_attr":"upd_attrs":"upd_value";if(this._onChangedValue&&this._onChangedValue(this,e,u,c),r){let h=d!==null?{oldvalue:u,attrs_diff:d}:{oldvalue:u};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),r&&this._parentBag._onNodeChanged(this,[this.label],f,u,d,a,o))}replace(e){if(!(e instanceof t))throw new TypeError("BagNode.replace expects a BagNode");if(e===this)return this;let r=e.staticValue;r&&typeof r._htraverse=="function"&&(r=r.createChildBag().replace(r));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},a=this.resolver;a&&a._node===this&&(a._node=null),this.resolver=n,this.setValue(r,!1,{...e.attr},!1,!1,null);let o=this._buildAttrDiff(s,this._attr),u=Object.keys(o).length?o:null,l=i!==r||a!==n;if(l||u){let c=u?l?"upd_value_attr":"upd_attrs":"upd_value",d=u?{oldvalue:i,attrs_diff:u}:{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,u)}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,r=null){return e?e in this._attr?this._attr[e]:r:this._attr}_buildAttrDiff(e,r){let n={},i=new Set([...Object.keys(e),...Object.keys(r)]);for(let s of i){let a=s in e?e[s]:null,o=s in r?r[s]:null;a!==o&&(n[s]={old:a,new:o})}return n}setAttr(e=null,r=!0,n=!0,i=!0){let s=e||{},a=Object.keys(this._nodeSubscribers).length>0,u=r&&(a||this._parentBag!==null&&this._parentBag.backref)?{...this._attr}:null;if(n?Object.assign(this._attr,s):this._attr={...s},i)for(let l of Object.keys(this._attr))this._attr[l]===null&&delete this._attr[l];if(r&&u!==null){let l=this._buildAttrDiff(u,this._attr);if(Object.keys(l).length>0&&a)for(let c of Object.values(this._nodeSubscribers))c({node:this,info:{attrs_diff:l},evt:"upd_attrs"});if(Object.keys(l).length>0&&this._parentBag!==null&&this._parentBag.backref){let c=r===!0?"true":String(r);this._parentBag._onNodeChanged(this,[this.label],"upd_attrs",null,l,c)}}}delAttr(...e){for(let r of e)if(typeof r=="string"&&r.includes(","))for(let n of r.split(","))delete this._attr[n.trim()];else delete this._attr[r]}hasAttr(e,r=null){return e in this._attr?r!==null?this._attr[e]===r:!0:!1}getInheritedAttributes(){let e={};return this._parentBag&&this._parentBag.parentNode&&(e=this._parentBag.parentNode.getInheritedAttributes()),{...e,...this._attr}}subscribe(e,r){this._nodeSubscribers[e]=r}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,r=null){let n=this;if(r===null)for(;n&&!(e in n._attr);)n=n.parentNode;else for(;n&&n._attr[e]!==r;)n=n.parentNode;return n}asTuple(){return[this.label,this.value,this._attr,this._resolver||null]}isEqual(e){if(!(e instanceof t)||this.label!==e.label)return!1;let r=Object.keys(this._attr),n=Object.keys(e._attr);if(r.length!==n.length)return!1;for(let i of r)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 r=Object.keys(this._attr),n=Object.keys(e._attr);return r.length!==n.length||r.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 r=this.value;return r&&typeof r.toJson=="function"&&(r=r.toJson(e,!0)),{label:this.label,value:r,attr:this._attr}}toString(){return`BagNode : ${this.label}`}};var Tr=class t{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 r=e.match(/^#(\d+)$/);if(r){let n=parseInt(r[1],10);return n<this._list.length?n:-1}if(r=e.match(/^#(\w*)=(.*)$/),r){let[,n,i]=r,s=i.includes("::")?X(i):i;return n?this._list.findIndex(a=>a.getAttr(n)===s):this._list.findIndex(a=>a._value===s)}return-1}_parsePosition(e){let r=this._list.length;if(e==null||e===">")return r;if(typeof e=="number")return e<0&&(e=r+e),Math.max(0,Math.min(e,r));if(e==="<")return 0;if(e.startsWith("#")){let n=this._parseSharpIndex(e.slice(1),e);return Math.min(n,r)}if(e.startsWith("<")){let n=e.slice(1);if(n.startsWith("#")){let s=this._parseSharpIndex(n.slice(1),e);return Math.min(s,r)}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,r)}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,r){if(!/^-?\d+$/.test(e))throw new Error(`Invalid node_position '${r}': '${e}' is not an integer`);let n=parseInt(e,10);if(n<0)throw new Error(`Invalid node_position '${r}': 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 r=this.index(e);return r>=0?this._list[r]:null}return this._dict[e]||null}set(e,r,n=">",i=null,s=null,a=null,o=!1,u=!0,l=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]]:r};else{if(!Array.isArray(r)||r.length!==m.length)throw new Error("Wrong attributes assignment");i={};for(let g=0;g<m.length;g++)i[m[g]]=r[g]}r=null}let p=this._dict[e];if(p)f&&(p.nodeTag=f),a!==null&&(a===!1?p.resolver=null:p.resolver=a),h?p.setAttr(i,c,!0,u):p.setValue(r,c,i,o,u,l,d);else{let m=s&&s.nodeClass?s.nodeClass:Ve;p=new m(s,e,h?null:r,i,a,f,null,u);let g=this._parsePosition(n);this._dict[e]=p,this._list.splice(g,0,p),c&&s&&s.backref&&s._onNodeInserted(p,g,null,l,d)}return d&&p.setValue(null,!1),p}pop(e){let r=this.get(e);if(r){delete this._dict[r.label];let n=this._list.indexOf(r);return n>=0&&this._list.splice(n,1),r}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,r,n=!0){if(r<0)return;let i=Array.isArray(e)?e:[e];if(i.length===0||r>=this._list.length)return;let s=this._list[r].label;if(i.length>1){let a=[...i].sort((c,d)=>c-d),o=a[0]<r?1:0,u=[];for(let c=a.length-1;c>=0;c--){let d=a[c];if(d>=0&&d<this._list.length){let f=this._list[d];this._list.splice(d,1),u.push(f),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeDeleted(f,d)}}let l=this.index(s);l<0&&(l=this._list.length),l+=o;for(let c of u)this._list.splice(l,0,c),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeInserted(c,l)}else{let a=i[0];if(a===r||a<0||a>=this._list.length)return;let o=this._list[a];this._list.splice(a,1),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeDeleted(o,a),this._list.splice(r,0,o),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeInserted(o,r)}}isEqual(e){if(!(e instanceof t)||this._list.length!==e._list.length)return!1;for(let r=0;r<this._list.length;r++){let n=this._list[r],i=e._list[r];if(!n.isEqual(i))return!1}return!0}};var vo=gs(Bi(),1);var Wi="::RSLV:",bf=new Map,_f=new Map,Tn=new WeakMap,G=class extends Error{constructor(e){super(e),this.name="BagSerializationError"}},Cr=class extends ee{constructor(e){super({asBag:!1}),Tn.set(this,e)}get payload(){return Tn.get(this)}load(){throw new G("This resolver is opaque; local execution is unavailable")}};function _o(t){if(!t||typeof t!="object"||Array.isArray(t)||typeof t.resolver_module!="string"||typeof t.resolver_class!="string"||!Array.isArray(t.args??[])||!t.kwargs||typeof t.kwargs!="object"||Array.isArray(t.kwargs))throw new G("Invalid resolver description")}function wo(t,e=new Set){if(!(t===null||typeof t=="string"||typeof t=="boolean")&&!(typeof t=="number"&&Number.isFinite(t))){if(typeof t!="object"||e.has(t)||!Array.isArray(t)&&Object.getPrototypeOf(t)!==Object.prototype&&Object.getPrototypeOf(t)!==null)throw new G("Resolver parameters must be JSON data; callbacks cannot travel");e.add(t);for(let r of Object.values(t))wo(r,e);e.delete(t)}}function Nr(t){if(Tn.has(t))return Tn.get(t);let e=_f.get(t.constructor);if(!e)throw new G(`Unregistered resolver: ${t.constructor.name}`);let r=e.encode(t),n={resolver_module:e.module,resolver_class:e.name,args:r.args??[],kwargs:r.kwargs??{}};return _o(n),wo(n),Wi+JSON.stringify(n)}function Cn(t){if(typeof t!="string"||!t.startsWith(Wi))return null;let e=t.slice(Wi.length);if(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+$/.test(e))return new Cr(t);let r;try{r=JSON.parse(e)}catch{throw new G("Invalid resolver JSON or signed token")}_o(r);let n=bf.get(JSON.stringify([r.resolver_module,r.resolver_class]));if(!n)return new Cr(t);let i=n.decode({args:r.args??[],kwargs:r.kwargs});if(!(i instanceof n.cls))throw new G("Resolver decoder returned an incompatible instance");return i}function Nn(t){return Object.fromEntries(Object.entries(t||{}).map(([e,r])=>[e,r instanceof ee?Nr(r):r]))}function Gi(t){return Object.fromEntries(Object.entries(t||{}).map(([e,r])=>[e,Cn(r)??r]))}var Ce="__cls";function Vt(t,e){return t!==null&&t.tytxSuffix===e?t:Er(e)}function wf(t){let e=t.tytxSuffix,r=Object.entries(ze(e)).filter(([,n])=>n===t).map(([n])=>n);if(r.length===0)throw new G(`${t.name} is not in the TYTX subtype dictionary of '${e}'`);if(r.length>1)throw new G(`${t.name} is in the TYTX subtype dictionary of '${e}' under several names: ${r.sort().join(", ")}`);return r[0]}function Yi(t,e){let r=ze(t);if(!Object.hasOwn(r,e))throw new G(`Unknown Bag class '${e}' for TYTX type '${t}'`);return r[e]}function Xi(t,e){return t===e?null:wf(t)}function*ko(t,e=[]){for(let r of t){let n=[...e,r.label];yield[n,r];let i=r.getValue(!0);!r.resolver&&i instanceof te&&(yield*ko(i,n))}}function yf(t){let e=t.toISOString(),r=t.getUTCFullYear()===1970&&t.getUTCMonth()===0&&t.getUTCDate()===1,n=t.getUTCHours()===0&&t.getUTCMinutes()===0&&t.getUTCSeconds()===0&&t.getUTCMilliseconds()===0;if(n&&!r)return e.slice(0,e.indexOf("T"));let i=e.replace(/\.000Z$/,"Z");return r&&!n?i.slice(i.indexOf("T")+1):i}function Ht(t){if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function ot(t){return typeof t=="string"?t.includes("::")?`${t}::T`:t:Array.isArray(t)?t.map(ot):Ht(t)?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,ot(r)])):t}function Zi(t){if(!Ht(t))throw new TypeError("Bag options must be an object");let{recursive:e=!0}=t;if(typeof e!="boolean")throw new TypeError("recursive must be a boolean");return e}var yo=!1,te=class t{static tytxSuffix="X";constructor(e=null,r={}){this._nodes=new Tr,this._backref=!1,this._parent=null,this._parentNode=null,this._rootAttributes=null,this._updSubscribers={},this._insSubscribers={},this._delSubscribers={},Zi(r),e!=null&&this.fillFrom(e,r)}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 r=[],n=e;for(;n!==null;){if(n.parentBag===this)return r.push(n.label),r.reverse(),r.join(".");r.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 r=this,n;for(typeof e=="string"?(e=e.replace(/\.\.\//g,"#parent."),n=e.split(".").filter(i=>i)):n=[...e];n.length&&n[0]==="#parent"&&r!==null;)n.shift(),r=r.parent;return[r,n]}_htraverse(e,r=!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 t;){let a=s[0];if(a==="#parent"){if(i.parent===null||i.parent===void 0)break;s.shift(),i=i.parent;continue}let o=i._nodes.get(a);if(!o)break;let u=o.getValue(n);if(u instanceof t)s.shift(),i=u;else if(r){let l=i.createChildBag();o.setValue(l,!0,null,!0,!0,"autocreate"),s.shift(),i=l}else break}if(!r)return s.length>1?[null,null]:[i,s[0]];for(;s.length>1;){let a=s.shift();if(a.startsWith("#"))throw new Sr("Not existing index in #n syntax");let o=i.createChildBag();i._nodes.set(a,o,">",null,i,null,!1,!0,"autocreate"),i=o}return[i,s[0]]}get(e,r=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 a=this._nodes.get(e);return a?a.getValue(n,s,i):r}getItem(e,r=null,n=!1,i={}){if(!e)return this;let[s,a]=this._htraverse(e,!1,n);return s instanceof t?s.get(a,r,n,i):r}setItem(e,r,n=null,i=">",s=!1,a=!0,o=null,u=!1,l=!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,r,i,n,f,c,s,a,o,l,u,d)}_pop(e,r=null){let n=this._nodes.index(e);if(n>=0){let i=this._nodes.pop(n);return this.backref&&this._onNodeDeleted(i,n,null,r),i}return null}pop(e,r=null,n=null){let i=this.popNode(e,n);return i?i.value:r}delItem(e,r=null,n=null){return this.pop(e,r,n)}popNode(e,r=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,r)}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 r of e)r.parentBag=null}getNode(e,r=!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,a]=this._htraverse(e,n,r);if(s instanceof t&&a){let o=s._nodes.get(a);if(o)return o;if(n)return s._nodes.set(a,i,">",null,s,null,!1,!0,"autocreate"),s._nodes.get(a)}return null}setBackref(e=null,r=null){let n=this._backref;if(this._backref=!0,this._parent=r,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 r=e.getValue(!0);r instanceof t&&r.clearBackref()}}}_onNodeChanged(e,r,n,i=null,s=null,a=null,o=!1){for(let u of Object.values(this._updSubscribers))u({node:e,pathlist:r,oldvalue:i,attrs_diff:s,evt:n,reason:a,fired:o});this._parent&&this._parentNode&&this._parent._onNodeChanged(e,[this._parentNode.label,...r],n,i,s,a,o)}_onNodeInserted(e,r,n=null,i=null,s=!1){let a=e.parentBag,o=e.getValue(!0);a!==null&&a.backref&&o instanceof t&&o.setBackref(e,a),n===null&&(n=[]);for(let u of Object.values(this._insSubscribers))u({node:e,pathlist:n,ind:r,evt:"ins",reason:i,fired:s});this._parent&&this._parentNode&&this._parent._onNodeInserted(e,r,[this._parentNode.label,...n],i,s)}_onNodeDeleted(e,r,n=null,i=null){for(let s of Object.values(this._delSubscribers))s({node:e,pathlist:n,ind:r,evt:"del",reason:i});this._parent&&this._parentNode&&(n===null&&(n=[]),this._parent._onNodeDeleted(e,r,[this._parentNode.label,...n],i))}_subscribe(e,r,n){n!=null&&(r[e]=n)}subscribe(e,r={}){if(Object.hasOwn(r,"timer")||Object.hasOwn(r,"interval"))throw new TypeError("Timer subscriptions were removed. Schedule polling in the application.");let{update:n=null,insert:i=null,delete:s=null,any:a=null}=r;this.backref||this.setBackref(),this._subscribe(e,this._updSubscribers,n||a),this._subscribe(e,this._insSubscribers,i||a),this._subscribe(e,this._delSubscribers,s||a)}unsubscribe(e,r={}){if(Object.hasOwn(r,"timer")||Object.hasOwn(r,"interval"))throw new TypeError("Timer subscriptions were removed. Schedule polling in the application.");let{update:n=!1,insert:i=!1,delete:s=!1,any:a=!1}=r;(n||a)&&delete this._updSubscribers[e],(i||a)&&delete this._insSubscribers[e],(s||a)&&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,r=null,n=!0){let i=t.prototype.getNode.call(this,e,!0,!0);i&&i.setAttr(r,!0,!0,n)}getAttr(e=null,r=null,n=null){let i=this.getNode(e);return i?i.getAttr(r,n):n}delAttr(e=null,...r){let n=this.getNode(e);n&&n.delAttr(...r)}getInheritedAttributes(){return this._parentNode?this._parentNode.getInheritedAttributes():{}}getNodes(e=null){return e?[...this._nodes].filter(r=>e(r)):[...this._nodes]}getNodeByValue(e,r){for(let n of this._nodes){let i=n.value;if(i instanceof t){if(i.getItem(e)===r)return n}else if(i&&i.get&&i.get(e)===r)return n}return null}getNodeByAttr(e,r,n=!1,i=!1){let s=r===void 0,a=n&&typeof r=="string"?r.toLowerCase():r,o=u=>{let l=[];for(let c of u._nodes){if(e in c.attr){let d=n&&typeof c.attr[e]=="string"?c.attr[e].toLowerCase():c.attr[e];if(s||d==a)return c}if(c._value instanceof t)if(i){let d=o(c._value);if(d)return d}else l.push(c._value)}for(let c of l){let d=o(c);if(d)return d}return null};return o(this)}isEmpty(e=!1,r=!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)&&!(r&&i===""))return!1}return!0}query(e=null,r=null,n=!1,i=!1,s=!0,a=!0,o=null,u=!0){e||(e="#k,#v,#a");let l=this,c;if(typeof e=="string"){if(e.includes(":")){let[h,p]=e.split(":");l=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 w=_();return g&&w instanceof t?null:w}else if(p.startsWith("#v.")){let w=p.split(".").slice(1).join("."),y=_();return y&&y.getItem?y.getItem(w):null}else{if(p==="#__v")return h.getValue(!0);if(p.startsWith("#a")){let w=p.includes(".")?p.split(".").slice(1).join("."):null;return h.getAttr(w)}else{let w=_();return w&&w.getItem?w.getItem(p):null}}};function*f(){let h=0;function*p(m,g){for(let _ of m._nodes){let w=g?`${g}.${_.label}`:_.label,y=!1,k,S=()=>(y||(k=_.getValue(u),y=!0),k);if((s&&a||(S()instanceof t?a:s))&&(r===null||r(_))&&(yield c.length===1?d(_,c[0],w,i,S):c.map(F=>d(_,F,w,i,S)),h++,o!==null&&h>=o))return;if(i){let F=S();if(F instanceof t&&(yield*p(F,w),o!==null&&h>=o))return}}}yield*p(l,"")}return n?f():[...f()]}getLeaves(){let e=[],r=(n,i)=>{for(let s of n._nodes){let a=i?`${i}.${s.label}`:s.label,o=s.getValue(!1);o instanceof t?r(o,a):e.push([a,o])}};return r(this,""),e}digest(e=null,r=null,n=!1){typeof r=="boolean"&&(console.warn("Bag.digest(what, asColumns) is deprecated; use digest(what, null, asColumns)."),n=r,r=null);let i=this.query(e,r,!1,!1,!0,!0,null,!1);if(n){if(!i||i.length===0)return(typeof e=="string"?e:"#k,#v,#a").split(",").map(u=>u.trim()).map(()=>[]);let s=[...i];if(s.length&&Array.isArray(s[0])){let a=s[0].length,o=[];for(let u=0;u<a;u++)o.push(s.map(l=>l[u]));return o}return[s]}return[...i]}columns(e,r=!1){typeof e=="string"&&(e=e.split(","));let n=r?"#a.":"",i=e.map(s=>`${n}${s}`).join(",");return this.digest(i,null,!0)}sum(e="#v",r=!1,n=null){if(r!=null&&typeof r!="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 a=0,o=!1;for(let u of this.query(s,n)){if(u==null||u===""){o=!0;continue}if(typeof u!="number"&&typeof u!="boolean"){if(r)throw new TypeError(`sum encountered non-numeric value: ${typeof u}`);continue}a+=u}return r&&o?null:a};return e.includes(",")?e.split(",").map(s=>i(s.trim())):i(e)}sort(e="#k:a"){let r=(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 a=e(i),o=e(s);return a<o?-1:a>o?1:0});else{let i=e.split(",");i.reverse();for(let s of i){let a,o;s.includes(":")?[a,o]=s.split(":",2):(a=s,o="a"),a=a.trim(),o=o.trim();let u=o==="d"||o==="D",l=o==="a"||o==="d",c;if(a.toLowerCase()==="#k")c=d=>r(d.label,l);else if(a.toLowerCase()==="#v")c=d=>r(d.value,l);else if(a.toLowerCase().startsWith("#a.")){let d=a.slice(3);c=f=>r(f.getAttr(d),l)}else c=d=>{let f=d.value,h=f instanceof t?f.getItem(a):f?f[a]:null;return r(h,l)};this._nodes._list.sort((d,f)=>{let h=n(c(d),c(f));return u?-h:h})}}return this}equalTo(e){return e instanceof t?this._nodes.isEqual(e._nodes):!1}has(e){if(typeof e=="string"){let r=null;e.includes("?")&&([e,r]=e.split("?",2));let n=this.getNode(e);return n===null?!1:r===null?!0:r.split("&").every(i=>i in n.attr)}else if(e&&e.label!==void 0)return[...this._nodes].includes(e);return!1}getResolver(e){let r=this.getNode(e);return r?r.resolver:null}setResolver(e,r){let n=this.getNode(e);n||(this.setItem(e,null),n=this.getNode(e)),n.resolver=r}setCallbackItem(e,r,n={}){let i=new Dr({callback:r,...n});this.setResolver(e,i)}move(e,r,n=!0){this._nodes.move(e,r,n)}asDict(e=!1,r=!1,n=!1,i=!1){let s={};for(let a of this._nodes){let o=a.value;if(i&&o==null)continue;let u=a.label;e&&(u=String(u)),r&&(u=u.toLowerCase()),n&&o instanceof t&&(o=t.prototype.asDict.call(o,e,r,n,i)),Object.defineProperty(s,u,{value:o,enumerable:!0,writable:!0,configurable:!0})}return s}setdefault(e,r=null){let n=this.getNode(e);return n?n.value:(this.setItem(e,r),r)}deepcopy(e=!1){let r=this.createChildBag();for(let n of this._nodes){let i=n.getValue(!e);i instanceof t&&(i=i.deepcopy(e));let s=new r.nodeClass(r,n.label,i);s.setAttr({...n.attr},!1,!1,!1),s.nodeTag=n.nodeTag,s.xmlTag=n.xmlTag,r._nodes._list.push(s),r._nodes._dict[s.label]=s}return r}update(e,r=null,n=null,i=!1){if(!(e instanceof t)){for(let s in e){let a=e[s];(!i||a!==null||!this._nodes.has(s))&&this.setItem(s,a,null,">",!1,!1,n,!1,n!==!1)}return}for(let s of[...e]){let a=s.label,o=r==="static"?s.resolver:null,u=o?null:s.getValue(),l=s.attr.__replace;delete s.attr.__replace;let c=this._nodes.get(a);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),o)c.resolver=o,c.setValue(null,n===null?!0:n,null,null,!1,n);else{s.resolver&&(c.resolver=null);let d=c.getValue();u instanceof t&&d instanceof t&&!l?d.update(u,r,n,i):(!i||u!==null)&&c.setValue(u,n===null?!0:n,null,null,!1,n)}else{let d=this.setItem(a,o||u,s.attr,">",!1,!1,n,!1,n!==!1);d.nodeTag=s.nodeTag,d.xmlTag=s.xmlTag}}}_fillFromBag(e){this.clear();for(let r of e){let n=new this.nodeClass(this,r.label);n.replace(r),n.nodeTag=r.nodeTag,n.xmlTag=r.xmlTag,this._nodes._list.push(n),this._nodes._dict[n.label]=n}}_appendLiteral(e,r,n=null,i=null,s=null){if(typeof e!="string")throw new TypeError("Bag labels must be strings");let a=new this.nodeClass(this,e,null,n,i,s,null,!1);return r instanceof ee?a.resolver=r:a._value=r,this._nodes._dict[e]=a,this._nodes._list.push(a),a}fillFrom(e=null,r={}){let n=Zi(r);if(e!=null&&!Ht(e)&&!Array.isArray(e))throw new TypeError("Bag source must be a dictionary, array or null");let i=this.createChildBag(),s=new Set,a=(o,u,l)=>{if(s.has(u))throw new TypeError(`Cyclic Bag source at ${l}`);s.add(u);try{let c=Array.isArray(u)?String(u.length).length+1:0,d=Array.isArray(u)?Array.from(u,(f,h)=>[`r_${String(h).padStart(c,"0")}`,f]):Object.entries(u);if(!Array.isArray(u)&&Object.getOwnPropertySymbols(u).some(f=>Object.prototype.propertyIsEnumerable.call(u,f)))throw new TypeError(`Bag labels must be strings at ${l}`);for(let[f,h]of d){let p=h;n&&(Ht(p)||Array.isArray(p))&&(p=this.createChildBag(),a(p,h,`${l}[${JSON.stringify(f)}]`)),o._appendLiteral(f,p)}}finally{s.delete(u)}};return e!=null&&a(i,e,"$"),this._replacePrepared(i)}_loadSource(e,r={}){return this.fillFrom(e,r)}replace(e){if(!(e instanceof t))throw new TypeError("Bag.replace expects a Bag");if(e===this)return this;let r=this.createChildBag();return r._fillFromBag(e),this._replacePrepared(r)}_replacePrepared(e){for(let n of this._nodes){n.parentBag=null;let i=n.getValue(!0);i instanceof t&&i.clearBackref()}let r=this._nodes;this._nodes=e._nodes,e._nodes=r,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:r=!0,deep:n=!1,kwargs:i={}}={}){if(typeof e!="function")throw new TypeError("forEach requires a callback");let s=(a,o)=>{for(let u=0;u<a._nodes.length;u++){let l=a._nodes._list[u],c={...o};"_pathlist"in o&&(c._pathlist=[...o._pathlist,l.label]),"_indexlist"in o&&(c._indexlist=[...o._indexlist,u]);let d=e(l,c,u);if(d)return d;if(d==null&&n){let f=l.getValue(r);if(f instanceof t){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 r=e.getValue(!0);r instanceof t&&(yield*r.traverse())}}*_iterNodesWithPaths(e=!0,r=""){for(let n of this._nodes){let i=r?`${r}.${n.label}`:n.label;yield[i,n];let s=n.getValue(e);s instanceof t&&(yield*s._iterNodesWithPaths(e,i))}}*_nodeFlattener(e=null){let r=e!==null,n=r?Object.create(null):null,i=0,s=new Map([["[]",this.constructor]]);for(let[a,o]of ko(this)){let u=a.slice(0,-1),l=JSON.stringify(a),c=JSON.stringify(u),d=o.getValue(!0),f,h=null;if(o.resolver)f=Nr(o.resolver);else if(d instanceof t){let g=d.constructor,_=g.tytxSuffix;s.set(l,g),h=Xi(g,Vt(s.get(c),_)),f=`::${_}`}else d===null?f="::NN":f=ot(d);if(o.attr&&Object.hasOwn(o.attr,Ce))throw new G(`node '${a}': the attribute '${Ce}' is reserved for the Bag class name`);let p=Nn(ot(o.attr));h!==null&&(p[Ce]=h);let m=o.nodeTag;r?(yield[u.length?n[c]:null,o.label,m,f,p],d instanceof t&&(n[l]=i,e[i]=a,i++)):yield[u,o.label,m,f,p]}}toTytx(e="json",r=!1){let n=this._toTytxPayload(r),i=this.constructor.tytxSuffix;if(e==="json")return`${n}::${i}`;if(e==="msgpack")return Qr(new De(4,new TextEncoder().encode(`${i}:${n}`)));throw new TypeError(`Unsupported transport: ${e}`)}_toTytxPayload(e=!1){let r;if(e){let s={};r={rows:[...this._nodeFlattener(s)],paths:s}}else r={rows:[...this._nodeFlattener(null)]};let n=this.constructor,i=Xi(n,Vt(null,n.tytxSuffix));return i!==null&&(r[Ce]=i),r.rows=r.rows.map(([s,a,o,u,l])=>[ot(s),ot(a),ot(o),u,l]),r.paths&&(r.paths=ot(r.paths)),be(r)}static fromTytx(e,r="json",n={}){if(Ht(r)&&(n=r,r="json"),Zi(n),typeof e!="string"&&!(e instanceof Uint8Array))throw new TypeError("fromTytx requires serialized text or bytes");if(r!=="json"&&r!=="msgpack")throw new TypeError(`Unsupported transport: ${r}`);r==="json"&&e instanceof Uint8Array&&(e=new TextDecoder().decode(e));let i=X(e,r==="json"?null:r);if(i instanceof t)return i;if(!Ht(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 r=this.tytxSuffix;if(e==="")return new(Vt(null,r));let n=X(e);if(!n||!Array.isArray(n.rows))throw new G("Invalid TYTX Bag: expected rows");let i=n.paths,s=i!=null,a=Object.hasOwn(n,Ce)?Yi(r,n[Ce]):Vt(null,r),o=new a,u=new Map([["[]",o]]);for(let l of n.rows){if(!Array.isArray(l)||l.length!==5)throw new G("Invalid TYTX Bag row");let[c,d,f,h,p]=l,m=c??"";if(s){if(c!==null&&!Object.hasOwn(i,c))throw new G(`Unknown TYTX parent reference: ${c}`);m=c===null?"":i[c]}if(typeof m=="string"&&(m=m?m.split("."):[]),!Array.isArray(m))throw new G("Invalid TYTX parent path");let g=JSON.stringify(m);if(!u.has(g))throw new G(`Missing or undecodable TYTX parent branch: ${m}`);let _=u.get(g),w=JSON.stringify([...m,d]),y=h,k=Cn(y),S=Gi(p),R=Object.hasOwn(S,Ce)?S[Ce]:null;if(delete S[Ce],y instanceof t){let re=y.constructor.tytxSuffix,ne=R!==null?Yi(re,R):Vt(_.constructor,re);y=new ne,u.set(w,y)}else if(R!==null)throw new G(`node '${w}': the attribute '${Ce}' is reserved for the Bag class name of a branch`);let F=_._appendLiteral(d,k?null:y,S,k);F.nodeTag=f??null}return o}toXml(e={}){let{pretty:r=!1,encoding:n="UTF-8",docHeader:i=null,selfClosedTags:s=null}=e,a=this._bagToXml(s,r);return i===!0?a=`<?xml version='1.0' encoding='${n}'?>
14
- ${a}`:typeof i=="string"&&(a=`${i}
15
- ${a}`),a}_bagToXml(e=null,r=!1,n=0){let i=[];for(let s of this._nodes)i.push((r?" ".repeat(n):"")+this._nodeToXml(s,e,r,n));return i.join(r?`
16
- `:"")}_nodeToXml(e,r=null,n=!1,i=0){let s=e.xmlTag||e.nodeTag||e.label,a=this._sanitizeTag(s),o=[];if(a!==s&&o.push(`_tag="${this._escapeAttr(s)}"`),e.resolver&&o.push(`_resolver="${this._escapeAttr(Nr(e.resolver))}"`),e.attr)for(let[f,h]of Object.entries(Nn(e.attr)))h!==null&&h!==!1&&h!==void 0&&o.push(`${f}="${this._escapeAttr(String(h))}"`);let u=o.length?" "+o.join(" "):"",l=e.resolver?null:e.getValue(!0);if(l&&typeof l._bagToXml=="function"){n=n&&e.attr?.["xml:space"]!=="preserve";let f=l._bagToXml(r,n,i+1);return f?n?`<${a}${u}>
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&&gt(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&&gt(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
17
  ${f}
18
- ${" ".repeat(i)}</${a}>`:`<${a}${u}>${f}</${a}>`:r===null||r.includes(a)?`<${a}${u}/>`:`<${a}${u}></${a}>`}if(l==null||l==="")return r===null||r.includes(a)?`<${a}${u}/>`:`<${a}${u}></${a}>`;let c=l instanceof Date&&!Number.isNaN(l.getTime())?yf(l):String(l),d=this._escapeXml(c);return`<${a}${u}>${d}</${a}>`}_sanitizeTag(e){return e?e.replace(/[^a-zA-Z0-9_\-.:]/g,"_"):"_none_"}_escapeXml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}_escapeAttr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}static fromXml(e,r={}){let{tagAttribute:n=null}=r,i;if(typeof DOMParser<"u"){i=new DOMParser().parseFromString(e,"application/xml");let a=i.querySelector("parsererror");if(a)throw new Error(`XML parse error: ${a.textContent}`)}else i=new vo.DOMParser().parseFromString(e,"application/xml");return this._xmlElementToBag(i.documentElement,n)}static _xmlElementToBag(e,r=null){let n=new this,i=Array.from(e.childNodes).filter(s=>s.nodeType===1);for(let s of i){let a=s.tagName,o={};for(let m=0;m<s.attributes.length;m++){let g=s.attributes[m];o[g.name]=g.value}let u=Cn(o._resolver);u&&delete o._resolver;let l=String(o._T||"").toUpperCase()==="BAG";Object.assign(o,Gi(o));let c=a;"_tag"in o&&(c=o._tag,delete o._tag),r&&r in o&&(c=o[r],delete o[r]);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||l){let m=this._xmlElementToBag(s,r);p=n.setItem(c,m,Object.keys(o).length>0?o:null)}else{let m=s.textContent||"";p=n.setItem(c,m,Object.keys(o).length>0?o:null)}u&&(p.resolver=u),p.xmlTag=a}return n}static async fromUrl(e,r={}){let{timeout:n=30}=r,i={};n&&(i.signal=AbortSignal.timeout(n*1e3));let s=await fetch(e,i),a=s.headers.get("content-type")||"",o=await s.text();if(a.includes("json"))return t.fromTytx(o);if(a.includes("xml"))return t.fromXml(o);let u=o.trim();if(u.startsWith("<"))return t.fromXml(o);if(u.startsWith("{")||u.startsWith("["))return t.fromTytx(o);throw new Sr(`Unsupported content-type: ${a}`)}toJson(e=!0){let r=[];for(let n of this._nodes)r.push(this._nodeToJsonDict(n,e));return e?be(r):JSON.stringify(r)}_nodeToJsonDict(e,r){let n=e.resolver?null:e.getValue(!0);if(n&&typeof n._nodeToJsonDict=="function"){let s=[];for(let a of n._nodes)s.push(n._nodeToJsonDict(a,r));n=s}let i={label:e.label,value:n,attr:Nn(e.attr)};return e.nodeTag!==null&&(i.tag=e.nodeTag),e.resolver&&(i.resolver=Nr(e.resolver)),i}static fromJson(e,r={}){return yo||(console.warn("Bag.fromJson is deprecated; use Bag.fromTytx"),yo=!0),this.fromTytx(e,"json",r)}toStringTree(e=!0,r=null,n="",i=!0){r===null&&(r=new Map);let s=[],a=[...this._nodes];for(let o=0;o<a.length;o++){let u=a[o],l=o===a.length-1,c=u.getValue(e),d=u.getAttr(),f="",h=Object.keys(d);h.length>0&&(f=" ["+h.map(_=>`${_}=${JSON.stringify(d[_])}`).join(", ")+"]");let p=l?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",m=n+(l?" ":"\u2502 ");if(c instanceof t){let g=u,_=c.backref?"(*)":"";if(r.has(g))s.push(`${n}${p}${u.label}${_}${f} \u2192 (circular ref)`);else{r.set(g,u.label),s.push(`${n}${p}${u.label}${_}${f}`);let w=c.toStringTree(e,r,m,l);w&&s.push(w)}}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}),w=c instanceof ArrayBuffer?new Uint8Array(c):c;g=_.decode(w)}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}${u.label}: ${g}${f}`)}}return s.join(`
19
- `)}toString(e=!0,r=null,n=""){r||(r=new Set);let i=[],s=[...this._nodes];for(let a=0;a<s.length;a++){let o=s[a],u=a===s.length-1,l=o.getValue(e),c="",d=o.attr;d&&Object.keys(d).length>0&&(c=` [${Object.entries(d).map(([m,g])=>`${m}=${JSON.stringify(g)}`).join(", ")}]`);let f=u?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",h=n+(u?" ":"\u2502 ");if(l&&typeof l._htraverse=="function"){let p=o;if(r.has(p))i.push(`${n}${f}${o.label}${c} \u2192 (circular ref)`);else{r.add(p),i.push(`${n}${f}${o.label}${c}`);let m=l.toString(e,r,h);m&&i.push(m)}}else{let p;l==null?p="null":typeof l=="string"&&l.length>50?p=JSON.stringify(l.slice(0,47)+"..."):typeof l=="string"?p=JSON.stringify(l):p=String(l),i.push(`${n}${f}${o.label}: ${p}${c}`)}}return i.join(`
20
- `)}},Sr=class extends Error{constructor(e){super(e),this.name="BagException"}};ee.registerBagClass(te);Ui(te,"X",t=>t._toTytxPayload(),t=>te._fromTytxPayload(t));xr(te.tytxSuffix,{...ze(te.tytxSuffix),Bag:te});var Eo=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 xo(t){return t.endsWith("_")&&Eo.has(t.slice(0,-1))?t.slice(0,-1):t}function Ao(t){let e=xo(t);return e!==t?e:t.startsWith("_")&&Eo.has(t.slice(1))?t.slice(1):t}function Ki(t,{renderTag:e=null,ns:r=null,dialectName:n=null}={}){let i=e||t;if(!i)return i;if(i=xo(i),r&&!e){let s=`${n}_`;i.startsWith(s)&&(i=i.slice(s.length)),i=`${r}:${i}`}return i}var Gt=Symbol("value"),To=new Set(["_meta","datapath","nodeId","ns","form","formId","_anchor","updateOn"]);function Ji(t){return Object.entries(t||{}).filter(([e])=>!To.has(e)).map(([e,r])=>[Ao(e),r])}var Wt=class extends Ve{constructor(e,r,n=null,i=null,s=null,a=null,o=null){super(e,r,n,i,s,a,o),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 r=this.getAttr("_meta")||{},n=e.split(",").map(i=>i.trim());return n.length===1?r[n[0]]!==void 0?r[n[0]]:null:n.map(i=>r[i]!==void 0?r[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[r,n]of Object.entries(this.getAttr()||{}))this.pointerType(n)==="^"&&e.push([r,n.split(":",1)[0]]);return this.pointerType(this.value)==="^"&&e.push(["",this.value.split(":",1)[0]]),e}fixedAttrItems(){return Ji(this.getAttr())}runtimeToEvaluate(){let e=new Map(this.fixedAttrItems());return e.set(Gt,this.value),e}absDatapath(e){let r=e;this.pointerType(e)&&(e=(at(e)?.pointer??e).slice(1));let n=null;return e.includes("?")&&([e,n]=e.split("?",2)),e.startsWith("#")?this._finalizeAbsPath(this._resolveSymbolicDatapath(e,r),n):(e.startsWith(".")&&(e=this._composeRelativeDatapath(e,r)),this._finalizeAbsPath(e,n))}_finalizeAbsPath(e,r){return e=this._collapseParentDatapath(e,e),r?`${e}?${r}`:e}_composeRelativeDatapath(e,r){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: ${r}`);return e}_collapseParentDatapath(e,r){let n=[];for(let i of e.split("."))if(i==="#parent"){if(n.length===0)throw new Error(`#parent has no segment to cancel: ${r}`);n.pop()}else n.push(i);return n.join(".")}_resolveSymbolicDatapath(e,r){let n=e.slice(1),i=n.indexOf("."),s=i===-1?n:n.slice(0,i),a=i===-1?"":n.slice(i+1),o;if(s==="FORM")o=this._findMarkedDatapathAncestor(!0,!1,r);else if(s==="ANCHOR")o=this._findMarkedDatapathAncestor(!1,!0,r);else{let u=this.rootBuilder;if(!u)throw new Error(`#<id>: cannot resolve ${r} on a node without builder`);if(o=u.source.getNodeByAttr("nodeId",s),o==null)throw new Error(`#<id>: cannot resolve ${r}`)}return o.absDatapath(a?`.${a}`:".")}_findMarkedDatapathAncestor(e,r,n){let i=this;for(;i!=null;){let a=i.getAttr()||{};if(e&&(a.formId!=null||a.form===!0)||r&&"_anchor"in a)return i;i=i.parentNode}let s=e?"FORM":"ANCHOR";throw new Error(`#${s}: no marked ancestor found for ${n}`)}getRelativeData(e,r=null,{autocreate:n=!1}={}){let i=this.data,s=this.absDatapath(e);return n&&i.getItem(s)==null&&i.setItem(s,r),i.getItem(s,r)}setRelativeData(e,r,{attributes:n=null,fired:i=!1,reason:s=null}={}){let a=this.data,o=this.absDatapath(e);a.setItem(o,r,n,">",!1,!0,s===null?!0:s,i)}fireEvent(e,r=!0,{attributes:n=null,reason:i=null}={}){this.setRelativeData(e,r,{attributes:n,fired:!0,reason:i})}SET(e,r){this.setRelativeData(e,r)}GET(e){return this.getRelativeData(e)}PUT(e,r){this.setRelativeData(e,r,{reason:!1})}FIRE(e,r=!0){this.setRelativeData(e,r,{fired:!0})}},W=class t extends te{constructor(e=null,r=null){super(e),this._builder=r,this._insertingBuilder=null}get nodeClass(){return Wt}_setBuilderItem(e,r,n,...i){let s=r?.map(([o])=>[o,o._builder])||null;if(r)for(let[o,u]of r)o._builder=u;let a=this._insertingBuilder;this._insertingBuilder=e;try{return this.setItem(n,...i)}catch(o){if(this.node(n)==null&&s)for(let[u,l]of s)u._builder=l;throw o}finally{this._insertingBuilder=a}}bindBuilder(e){if(!e)throw new Error("SourceBag.bindBuilder requires a builder");let r=this._builderBindingPlan(e);for(let[n,i]of r)n._builder=i;return this.setBackref(),this}_builderBindingPlan(e){let r=[],n=new WeakSet,i=(s,a)=>{if(n.has(s))throw new Error("source contains a cyclic or shared SourceBag branch");n.add(s),r.push([s,a]);for(let o of s.getNodes()){let u=a,l=o._getMeta("subbuilder");l!=null&&(u=a._resolveSubbuilderReference(l,o.getAttr()||{},o.nodeTag)),r.push([o,u]);let c=o.getValue(!0);c instanceof t&&i(c,u)}};return i(this,e),r}};if((ze(W.tytxSuffix).SourceBag??W)!==W)throw new Error("TYTX subtype name 'SourceBag' is already registered for another class");xr(W.tytxSuffix,{...ze(W.tytxSuffix),SourceBag:W});function xf(t){if(t.length===0)return{value:null,attrs:{}};let e=t[0];if(e!==null&&typeof e=="object"){let r=Object.getPrototypeOf(e);if(r===Object.prototype||r===null)return{value:null,attrs:e}}return{value:e,attrs:t[1]||{}}}var Af=new Set(["then","toJSON"]),Co=new WeakMap;function Or(t){return Co.get(t)||t}function Qi(t){if(t==null)return t;t=Or(t);let e=t._builder||t.parentBag&&t.parentBag._builder;return e?e.wrapSource(t):t}function No(t,e){let r=e instanceof te,n=new Proxy(e,{get(i,s){if(typeof s=="symbol"||s.startsWith("_")||Af.has(s))return Reflect.get(i,s,i);let a=t.schemaTag(s);if(r&&a)return Do(t,i,a,r);if(s in i){let u=Reflect.get(i,s,i);return typeof u=="function"?u.bind(i):u}if(a)return Do(t,i,a,r);let o=t.containerMethod(s);if(o)return(...u)=>t[o](t.wrapSource(i),...u)}});return Co.set(n,e),n}function Do(t,e,r,n){return(...i)=>{let{value:s,attrs:a}=xf(i),o=n?t.bagCall(e,r,s,a):t.commandOnNode(e,r,s,a);return o.builder.wrapSource(o)}}var Oo=/^[A-Za-z_][A-Za-z0-9_]*$/,Df=new Set(["positional_only","positional_or_keyword","keyword_only","var_positional","var_keyword"]),Tf=new Set(["framework","value","attribute"]),Cf=new Map([["builtins.str",t=>typeof t=="string"],["builtins.int",t=>Number.isInteger(t)],["builtins.float",t=>typeof t=="number"&&Number.isFinite(t)],["builtins.bool",t=>typeof t=="boolean"],["builtins.list",t=>Array.isArray(t)],["builtins.dict",t=>t!==null&&typeof t=="object"&&!Array.isArray(t)],["builtins.tuple",t=>Array.isArray(t)],["builtins.set",t=>Array.isArray(t)||t instanceof Set],["builtins.NoneType",t=>t===null],["builtins.object",t=>!0]]);function _t(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function E(t,e){throw new TypeError(`${t}: ${e}`)}function Le(t,e,r,n){_t(t)||E(n,"must be an object");for(let i of Object.keys(t))e.includes(i)||E(n,`unknown field '${i}'`);for(let i of r)Object.hasOwn(t,i)||E(n,`missing field '${i}'`)}function wt(t,e){if(!(t===null||typeof t=="string"||typeof t=="boolean")&&!(typeof t=="number"&&Number.isFinite(t))){if(Array.isArray(t))return t.forEach((r,n)=>wt(r,`${e}[${n}]`));if(_t(t))return Object.entries(t).forEach(([r,n])=>wt(n,`${e}.${r}`));E(e,"must be lossless JSON data")}}function Nf(t,e){let r="",n=!1;for(let i=0;i<t.length;i++){let s=t[i];if(s==="\\"){r+=s+(t[++i]??"");continue}s==="["&&(n=!0),!n&&s==="."&&!(e&16)?r+="[^\\n]":!n&&s==="^"&&e&8?r+="(?:^|(?<=\\n))":!n&&s==="$"?r+=e&8?"(?=\\n|(?![\\s\\S]))":"(?=\\n?(?![\\s\\S]))":r+=s,s==="]"&&(n=!1)}return r}function bt(t,e,r=!1,n=null){if(t===null)return null;switch(Le(t,["kind","dtype","module","name","origin","arguments","items","values","base","metadata","pattern","flags","ge","le","gt","lt","value"],["kind"],e),t.kind){case"custom":return Le(t,["kind","name"],["kind","name"],e),n||E(e,"custom references require a catalog; nested catalog references are unsupported"),n.resolve(t.name,e);case"dtype":{Le(t,["kind","dtype"],["kind","dtype"],e);let i=t.dtype;typeof i!="string"&&E(e,"dtype must be a string");let s=Er(i);return!s&&i!=="NN"&&E(e,`unknown dtype '${i}'`),{...t,test:o=>i==="NN"?o===null:i==="N"?oe(o)&&!["NaN","Infinity","-Infinity"].includes(o.toString()):s===Number?typeof o=="number"&&Number.isFinite(o)&&(i!=="L"||Number.isInteger(o)):s===String?typeof o=="string":s===Boolean?typeof o=="boolean":s===Date?o instanceof Date&&Number.isFinite(o.getTime()):s===Object?_t(o)&&[Object.prototype,null].includes(Object.getPrototypeOf(o)):o instanceof s}}case"any":return{...t,test:i=>!0};case"type":{(typeof t.module!="string"||typeof t.name!="string")&&E(e,"type requires string module/name");let i=`${t.module}.${t.name}`;if(i==="collections.abc.Callable")return{...t,test:a=>typeof a=="function",portable:!1};let s=Cf.get(i);return s||E(e,`unsupported type '${i}'`),{...t,test:s}}case"union":{(!Array.isArray(t.items)||!t.items.length)&&E(e,"union items must be non-empty");let i=t.items.map((s,a)=>bt(s,`${e}.items[${a}]`,!0,n));return{...t,items:i,inputConstraint:i.some(s=>s.inputConstraint),test:s=>i.some(a=>a.test&&a.test(s))}}case"literal":return Array.isArray(t.values)||E(e,"literal values must be an array"),t.values.forEach((i,s)=>wt(i,`${e}.values[${s}]`)),{...t,test:i=>t.values.some(s=>Object.is(s,i))};case"annotated":{Array.isArray(t.metadata)||E(e,"annotated metadata must be an array"),t.metadata.some(a=>!["regex","range","value"].includes(a?.kind))&&E(e,"unsupported annotation metadata kind");let i=bt(t.base,`${e}.base`,!0,n),s=t.metadata.map((a,o)=>bt(a,`${e}.metadata[${o}]`,!0,n));return{...t,base:i,metadata:s,inputConstraint:i.inputConstraint,test:a=>i.test(a)&&s.every(o=>!o.test||o.test(a))}}case"range":{for(let i of["ge","le","gt","lt"])Object.hasOwn(t,i)||E(e,`range missing '${i}'`);for(let i of["ge","le","gt","lt"])t[i]!==null&&(typeof t[i]!="number"||!Number.isFinite(t[i]))&&E(e,`${i} must be finite number or null`);return{...t,test:i=>typeof i=="number"&&(t.ge===null||i>=t.ge)&&(t.le===null||i<=t.le)&&(t.gt===null||i>t.gt)&&(t.lt===null||i<t.lt)}}case"regex":{(typeof t.pattern!="string"||!Number.isInteger(t.flags)||t.flags<0)&&E(e,"regex requires pattern and non-negative integer flags");let i=t.flags&-59;i&&E(e,`unsupported Python regex flags ${i}`),t.flags&2&&E(e,"IGNORECASE is not portable across Python and JavaScript Unicode rules"),/\\[AZzUwWdDsSabBN0-9]|\(\?P[<=!]|\(\?\(|\(\?>|\(\?#|\(\?[aiLmsux-]|[+*?}]\+|\{,/.test(t.pattern.replaceAll(String.raw`[\s\S]`,"."))&&E(e,"regex uses a non-portable construct or character class");let s="uy";t.flags&16&&(s+="s");let a;try{a=new RegExp(`(?:${Nf(t.pattern,t.flags)})(?![\\s\\S])`,s)}catch(o){E(e,`invalid portable regex: ${o.message}`)}return{...t,test:o=>typeof o!="string"?!1:(a.lastIndex=0,a.test(o))}}case"value":return wt(t.value,`${e}.value`),{...t};case"generic":{let i=bt(t.origin,`${e}.origin`,!0,n);(t.origin?.kind!=="type"||t.origin.module!=="builtins"||!["list","dict","tuple","set"].includes(t.origin.name))&&E(e,"only list, dict, tuple and set generic origins are supported"),Array.isArray(t.arguments)||E(e,"generic arguments must be an array");let s=t.arguments.map((a,o)=>bt(a,`${e}.arguments[${o}]`,!0,n));return{...t,origin:i,arguments:s,inputConstraint:s.some(a=>a.inputConstraint),test:a=>i.test(a)&&Sf(t.origin,s,a)}}case"arguments":E(e,"Callable argument-list descriptors are not supported by Python validation");case"ellipsis":return r||E(e,"ellipsis is only valid as a nested descriptor"),{...t};default:E(e,`unknown annotation kind '${t.kind}'`)}}function Sf(t,e,r){let n=`${t.module}.${t.name}`;return n==="builtins.tuple"&&e.length&&e[1]?.kind!=="ellipsis"?r.length===e.length&&r.every((i,s)=>e[s].test(i)):n==="builtins.list"||n==="builtins.set"||n==="builtins.tuple"?[...r].every(i=>!e[0]?.test||e[0].test(i)):n==="builtins.dict"?Object.entries(r).every(([i,s])=>(!e[0]?.test||e[0].test(i))&&(!e[1]?.test||e[1].test(s))):!1}function Bo(t,e){if(t===null)return null;if(typeof t!="string"&&E(e,"must be string or null"),t==="")return new Map;let r=new Map;for(let n of t.split(",")){let i=n.trim();/^[A-Za-z_][A-Za-z0-9_]*\[\]$/.test(i)&&E(e,`invalid cardinality item '${n}'`);let s=i.match(/^([A-Za-z_][A-Za-z0-9_]*|\*)(?:\[(?:(\d+)|(?:(\d*):(\d*)))\])?$/);s||E(e,`invalid cardinality item '${n}'`);let[,a,o,u,l]=s;r.has(a)&&E(e,`duplicate tag '${a}'`);let c=0,d=1/0;i.includes("[")&&(i.includes(":")?(c=u?Number(u):0,d=l?Number(l):1/0):c=d=Number(o)),d<c&&E(e,`maximum ${d} is below minimum ${c}`),r.set(a,{min:c,max:d})}return r.has("*")&&r.size>1&&E(e,"wildcard '*' cannot be combined with named tags"),r}function Io(t,e){if(t===null)return null;typeof t!="string"&&E(e,"must be string or null");let r=new Set;for(let n of t.split(",")){let i=n.trim();i&&((!Oo.test(i)||r.has(i))&&E(e,`invalid or duplicate parent '${n}'`),r.add(i))}return r}function Of(t,e,r){if(t===null)return null;Le(t,["parameters","accepts_var_keyword","accepts_var_positional"],[],e);let n=t.parameters??[];Array.isArray(n)||E(e,"parameters must be an array"),t={parameters:n,accepts_var_keyword:n.some(u=>u.kind==="var_keyword"),accepts_var_positional:n.some(u=>u.kind==="var_positional"),...t},(!Array.isArray(t.parameters)||typeof t.accepts_var_keyword!="boolean"||typeof t.accepts_var_positional!="boolean")&&E(e,"invalid signature descriptor");let i=new Set,s=!1,a=!1,o=t.parameters.map((u,l)=>{let c=`${e}.parameters[${l}]`;return Le(u,["name","kind","role","annotation","has_default","default"],["name","kind","role","annotation","has_default"],c),(typeof u.name!="string"||!Oo.test(u.name)||i.has(u.name))&&E(c,"invalid or duplicate parameter name"),i.add(u.name),(!Df.has(u.kind)||!Tf.has(u.role)||typeof u.has_default!="boolean")&&E(c,"invalid kind, role, or has_default"),u.has_default!==Object.hasOwn(u,"default")&&E(c,"default presence must equal has_default"),u.has_default&&wt(u.default,`${c}.default`),s||=u.kind==="var_keyword",a||=u.kind==="var_positional",{...u,annotation:bt(u.annotation,`${c}.annotation`,!1,r)}});return(s!==t.accepts_var_keyword||a!==t.accepts_var_positional)&&E(e,"variadic summary flags do not match parameters"),{...t,parameters:o}}function So(t,e,r,n){let i=["doc","sub_tags","parent_tags","inherits_from","ns","attributes",...r?["node_label","collection_key"]:[],"_meta"];Le(t,i,[],e),t={...Object.fromEntries(i.map(s=>[s,null])),...t};for(let s of["doc","inherits_from","ns",...r?["node_label","collection_key"]:[]])t[s]!==null&&typeof t[s]!="string"&&E(e,`${s} must be string or null`);return t._meta!==null&&(_t(t._meta)||E(e,"_meta must be object or null"),wt(t._meta,`${e}._meta`)),Bo(t.sub_tags,`${e}.sub_tags`),Io(t.parent_tags,`${e}.parent_tags`),{...t,attributes:Of(t.attributes,`${e}.attributes`,n)}}function Mo(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function Ro(t,e){let r={...e};for(let[n,i]of Object.entries(t))n==="inherits_from"||n.startsWith("_")||r[n]||(r[n]=i);return r._meta={...t._meta||{},...e._meta||{}},r}function Lo(t){let e={...t};return e._subSpec=Object.hasOwn(e,"sub_tags")?Bo(e.sub_tags,"resolved.sub_tags"):null,e._parentSpec=Object.hasOwn(e,"parent_tags")?Io(e.parent_tags,"resolved.parent_tags"):null,e}function Fo(t,e,r,n){if(r.get(t)===1&&E(n,`inheritance cycle at '${t}'`),r.get(t)===2)return e[t];let i=e[t];i||E(n,`unknown abstract '${t}'`),r.set(t,1);let s={...i};for(let a of Mo(i.inherits_from))s=Ro(Fo(a,e,r,n),s);return s=Lo(s),r.set(t,2),e[t]=s,s}function es({abstracts:t={},elements:e={}}){let r={...t},n=new Map;for(let s of Object.keys(r))Fo(s,r,n,`abstracts.${s}.inherits_from`);let i={};for(let[s,a]of Object.entries(e)){let o={...a};for(let u of Mo(a.inherits_from)){let l=r[u];l||E(`elements.${s}.inherits_from`,`unknown abstract '${u}'`),o=Ro(l,o)}i[s]=Lo(o)}return{abstracts:r,elements:i}}function ts(t){Le(t,["document_format","grammar","abstracts","elements","custom_types"],["document_format","grammar","abstracts","elements"],"grammar document"),Le(t.document_format,["name","version"],["name","version"],"document_format"),(t.document_format.name!=="builder_grammar"||!["1.1","1.2"].includes(t.document_format.version))&&E("document_format","expected builder_grammar version 1.1 or 1.2"),Le(t.grammar,["name","version","title","description"],["name","version","title","description"],"grammar"),(typeof t.grammar.name!="string"||!t.grammar.name)&&E("grammar.name","must be non-empty string");for(let i of["version","title","description"])t.grammar[i]!==null&&typeof t.grammar[i]!="string"&&E(`grammar.${i}`,"must be string or null");(!_t(t.abstracts)||!_t(t.elements))&&E("grammar document","abstracts/elements must be objects"),Object.hasOwn(t,"custom_types")&&t.document_format.version!=="1.2"&&E("custom_types","requires version 1.2");let e=Sn.fromJSON(t.custom_types??{}),r={};for(let[i,s]of Object.entries(t.abstracts))(!i||i.startsWith("_"))&&E("abstracts",`invalid public name '${i}'`),r[i]=So(s,`abstracts.${i}`,!1,e);let n={};for(let[i,s]of Object.entries(t.elements))(!i||i.startsWith("_"))&&E("elements",`invalid public name '${i}'`),n[i]=So(s,`elements.${i}`,!0,e);return{grammar:structuredClone(t.grammar),abstracts:r,elements:n}}function $o(t,e,r,n){let i=e.attributes;if(!i)return;let s={...n};r!=null&&(s.node_value=r);let a=new Set(i.parameters.filter(l=>l.role==="attribute").map(l=>l.name)),o=new Set(["node_label","node_position","nodeId","target_id","datapath","iterate","store","_tag","_meta","ns"]);if(!i.accepts_var_keyword)for(let l of Object.keys(n))!a.has(l)&&!o.has(l)&&E(t,`unknown attribute '${l}'`);let u=e._meta?.component?i.parameters.find(l=>l.role!=="framework"&&["positional_only","positional_or_keyword"].includes(l.kind))?.name:null;for(let l of i.parameters){if(l.name===u||l.role==="framework"||l.kind.startsWith("var_"))continue;let c=Object.hasOwn(s,l.name);!c&&!l.has_default&&E(t,`missing required ${l.role} '${l.name}'`),c&&l.annotation!==null&&(!l.annotation.test||!l.annotation.test(s[l.name]))&&E(t,`invalid value for ${l.role} '${l.name}'`)}}var Sn=class t{#e=new Map;#s=new Map;register(e,r,n){let i=new Map([[String,"str"],[Number,"float"],["string","str"],["integer","int"],["number","float"]]),s=i.has(r)?{kind:"type",module:"builtins",name:i.get(r)}:r;return this.#o(e,{kind:"annotated",base:s,metadata:[n]})}#o(e,r){(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_]*$/.test(e)||e in this||["to_dict","from_dict"].includes(e)||Bf.has(e))&&E("custom_types",`invalid, reserved or duplicate name '${e}'`),Le(r,["kind","base","metadata"],["kind","base","metadata"],`custom_types.${e}`),(r.kind!=="annotated"||!Array.isArray(r.metadata)||r.metadata.length!==1||!["regex","range"].includes(r.metadata[0]?.kind))&&E(`custom_types.${e}`,"requires an annotated base with one Regex or Range validator");let n=r.metadata[0].kind==="regex"?["str"]:["int","float"];(r.base?.kind!=="type"||r.base.module!=="builtins"||!n.includes(r.base.name))&&E(`custom_types.${e}`,"portable Regex requires str; portable Range requires int or float"),wt(r,`custom_types.${e}`);let i=structuredClone(r),s=bt(i,`custom_types.${e}`),a=Object.freeze({kind:"custom",name:e});return Object.defineProperty(this,e,{value:a,enumerable:!0}),this.#e.set(e,i),this.#s.set(e,{...a,inputConstraint:!0,test:s.test}),a}resolve(e,r="custom_types"){return this.#s.has(e)||E(r,`unknown custom type '${e}'`),{...this.#s.get(e)}}validate(e,r){return this.resolve(e).test(r)||E(`custom_types.${e}`,"invalid input value"),!0}toJSON(){return structuredClone(Object.fromEntries(this.#e))}static fromJSON(e){_t(e)||E("custom_types","must be an object");let r=new t;for(let[n,i]of Object.entries(e))r.#o(n,i);return r}},Bf=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 qo(t,e,r,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 a=s.role==="value"?r:n[s.name];a!==void 0&&(s.annotation.test(a)||E(t,`invalid input for '${s.name}' (custom type)`))}}function Po(t,e,r=[]){if(e===null)return structuredClone(t);if(r.length===2&&r[0]==="custom_types"&&t!==void 0){if(!rs(t,e))throw new TypeError(`conflicting custom type '${r[1]}'`);return structuredClone(t)}if(r.length===2&&["abstracts","elements"].includes(r[0]))return structuredClone(e);if(He(t)&&He(e)){let n=structuredClone(t);for(let[i,s]of Object.entries(e))s!==null&&Object.defineProperty(n,i,{value:Po(n[i],s,[...r,i]),enumerable:!0,writable:!0,configurable:!0});return n}return structuredClone(e)}function rs(t,e){return Object.is(t,e)?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((r,n)=>rs(r,e[n])):He(t)&&He(e)?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).every(r=>Object.hasOwn(e,r)&&rs(t[r],e[r])):!1}function He(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)&&Object.getPrototypeOf(t)===Object.prototype}function ns(t){if(!(t===null||typeof t=="string"||typeof t=="boolean")&&!(typeof t=="number"&&Number.isFinite(t))){if(Array.isArray(t)){t.forEach(ns);return}if(He(t)){Object.values(t).forEach(ns);return}throw new TypeError("collection must contain only finite JSON values")}}var We=class t{#e;constructor(e){ns(e);let r=["document_format","grammar","abstracts","elements"];if(!He(e)||Object.keys(e).some(i=>![...r,"custom_types"].includes(i))||r.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 r=new t(e),n=Po(this.#e,r.#e);return(this.#e.document_format.version==="1.2"||r.#e.document_format.version==="1.2")&&(n.document_format.version="1.2"),this.#e=n,this}toDocument(){return structuredClone(this.#e)}};var yt=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,r){this.renders.set(e,r)}getRender(e){let r=this.renders.get(e);if(r!==void 0)return r;let n=e.getRenderer();return this.renders.set(e,n),n}render(e,r={}){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,r);let a=this.getRender(n),o;return[o,s]=a._handleMeta(e,s),e._getMeta("subbuilder")||(s=a.adaptAttrs(s)),e.value instanceof W&&(i=this.renderChildren(e.value,r)),a.renderedItem(e,i,s,{tag:o,...r})}renderChildren(e,r={}){let n=[];for(let i of e.getNodes()){let s=this.render(i,r);s!==null&&(Array.isArray(s)?n.push(...s):n.push(s))}return n}_renderComponent(e,r,n){let[i,s,a,o]=this._expansionInputs(e,r);if(!Object.hasOwn(e.getAttr(),"iterate"))return this._expandBlock(e,i,a,o,n);if(s==null)return[];if(!(s instanceof te))throw new TypeError(`component '${e.nodeTag}': iterate must resolve to a Bag, got ${s?.constructor?.name||typeof s}`);return s.getNodes().map(u=>this._expandBlock(e,i,a,{node_label:u.label},n))}_expansionInputs(e,r){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 a=r.iterate;delete r.iterate,delete r.store;let o=e.getAttr("iterate")||e.getAttr("store");o!=null?(e.pointerType(o)&&(o=o.slice(1)),o.startsWith(".")&&(o=e._composeRelativeDatapath(o,o))):o=null;for(let u of Object.keys(r)){let l=e.getAttr(u);e.pointerType(l)==="^"&&(r[u]=`^${e.absDatapath(l)}`)}return[s,a,o,r]}_expandBlock(e,r,n,i,s){let a=e.builder._expansionRoot(n);r.call(e.builder,Qi(a),i);let o=a.getNodes();if(o.length!==1)throw new Error(`component '${e.nodeTag}' must build a tree, not a forest: ${o.length} root nodes`);let u={...s,depthOffset:this._nodeDepth(e,s.depthOffset||0)};return this.render(o[0],u)}preprocess(e){return e}renderedItem(e,r,n,i){throw new Error(`${this.constructor.name} does not implement renderedItem`)}_handleMeta(e,r){let[n,i]=e._getMeta("render_tag,render_attributes"),s=Ki(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&&(r={...r,...i}),[s,r]}adaptAttrs(e){return e}adapt(e){let r=`${this.builder.constructor._name}_`;return e.startsWith(r)?e.slice(r.length):e}finalize(e,r=null,n={}){let i=this._composeStringFragments(e);if(r==null)return i;if(typeof r=="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 r.full=="function"&&typeof r.write!="function")return r.full(i),null;if(typeof r.write=="function")return r.write(i),null;if(typeof r=="function")return r(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(r=>typeof r!="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("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}_escapeAttr(e){return this._escapeText(e).replaceAll('"',"&quot;")}_nodeDepth(e,r=0){let i=((e.fullpath||"").match(/\./g)||[]).length;return Math.max(i-1,0)+r}};var vt=class extends yt{static mode="xml";renderedItem(e,r,n,{tag:i,pretty:s=!1,depthOffset:a=0}={}){let o=this._formatAttrs(n),u=s?" ".repeat(this._nodeDepth(e,a)):"",l=s?`
21
- `:"";if(Array.isArray(r)){let c=this._composeStringFragments(r);return`${u}<${i}${o}>${l}${c}${u}</${i}>${l}`}return r==null?`${u}<${i}${o}></${i}>${l}`:`${u}<${i}${o}>${this._escapeText(r)}</${i}>${l}`}finalize(e,r=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,r)}_formatAttrs(e){return Object.entries(e||{}).map(([r,n])=>` ${r.startsWith("xmlns_")?`xmlns:${r.slice(6)}`:r}="${this._escapeAttr(n)}"`).join("")}};var Uo={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 jo(t){let e=[];for(;t&&t!==Function.prototype;)e.push(t),t=Object.getPrototypeOf(t);return e.reverse()}function Mf(t){let e=Object.create(null),r=(n,i)=>{let s=n.toLowerCase(),a=e[s];if(a!==void 0&&a!==i)throw new Error(`container '${n}' is already tied to implementation method '${a}' (cannot rebind to '${i}')`);e[s]=i};for(let n of jo(t))if(Object.hasOwn(n,"containers"))for(let i of n.containers||[])r(i,i);return e}function Br(t){let e=Object.create(null);for(let r of Object.keys(t)){let n=r.toLowerCase();if(Object.hasOwn(e,n))throw new Error(`element declaration '${r}' has a case-insensitive collision with '${e[n]}'`);e[n]=r}return e}var Ir="_root_",is="_root_",zo=new Set(["destination","func","value","_on_start"]),Fe=class t{static _sourceClass=W;static registerBuilder(e){if(typeof e!="function"||!(e.prototype instanceof t))throw new TypeError("registerBuilder requires a BuilderBase subclass");let r=e._name;if(typeof r!="string"||!r)throw new TypeError("registered builders require a non-empty static _name");let n=t._registry.get(r);if(n&&n!==e)throw new Error(`Builder name '${r}' is already registered to ${n.name}; cannot register ${e.name}`);return t._registry.set(r,e),e}static getBuilderClass(e){let r=t._registry.get(e);if(!r)throw new Error(`No builder registered with name '${e}'`);return r}constructor(e=null){this.name=e||this.constructor._name,this._dataroot=new te,this._dataroot.setBackref(),this._dataroot.setItem(is,new te),this.data=this._dataroot.getItem(is),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 r=this.constructor._sourceClass;this._sourceroot=new r(null,this),this._sourceroot.setBackref(),this._sourceroot.setItem(Ir,new r(null,this)),this.source=this._sourceroot.getItem(Ir)}wrapSource(e){if(e=Or(e),!(e instanceof W)&&!(e instanceof Wt))throw new TypeError("wrapSource requires a SourceBag or SourceBagNode");let r=this._sourceHandles.get(e);return r||(r=No(this,e),this._sourceHandles.set(e,r)),r}get root(){return this.wrapSource(this.source)}getSubbuilder(e){if(typeof e!="string"||!e||e.includes(":"))throw new Error(`unsupported subbuilder reference '${e}'`);let r=this._subbuilders.get(e);if(!r){let n=t.getBuilderClass(e);r=new n,this._subbuilders.set(e,r)}return r._dataroot=this._dataroot,r.data=this.data,r}_resolveSubbuilderReference(e,r,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 r=this._classCollection,n=r?new We(r.toDocument()).update(e):new We(e),i=ts(n.toDocument()),s=es(i),a=Br(s.elements);this._classCollection=n,this._classSchema=s.elements,this._abstracts=s.abstracts,this._tagNames=a}static{this.defineGrammar(Uo)}get _containers(){return Mf(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??=Br(this.schema):this.constructor._tagNames??=Br(this.schema)}schemaTag(e){let r=e.toLowerCase(),n=this.schemaTagNames[r];if(n)return n;let i=`${this.constructor._name}_`;return r.startsWith(i)&&this.schemaTagNames[r.slice(i.length)]||null}loadGrammar(e,{replace:r=!1}={}){let n=this._collection||this.constructor._classCollection,i=r?new We(e):new We(n.toDocument()).update(e),s=ts(i.toDocument()),a=es(s),o=Br(a.elements);return this._collection=i,this._schemaOverride=a.elements,this._tagNamesOverride=o,this}validateCustomTypes(e){let r=e.parentBag?.parentNode?.builder||e.parentBag?._builder,n=r&&r!==this&&r.schema[e.nodeTag]?._meta?.subbuilder?r:this;qo(e.nodeTag,n.schema[e.nodeTag],e.value,e.getAttr()||{})}validateNodeValues(e,r,n={}){let i=this.schemaTag(e);if(!i)throw new Error(`unknown element '${e}'`);return $o(i,this.schema[i],r,n),!0}validateNode(e,{value:r,attrs:n,childTags:i}={}){if(!e||typeof e.nodeTag!="string")throw new TypeError("validateNode requires a source node");let s=r!==void 0?r:e.value instanceof W?null:e.value;this.validateNodeValues(e.nodeTag,s,n||e.getAttr?.()||{});let a=this.schema[this.schemaTag(e.nodeTag)],o=i||(e.value instanceof W?e.value.getNodes().map(u=>u.nodeTag):null);return o&&this._validateChildren(e.nodeTag,a,o,!1),!0}validateChildren(e,r,{includeMinimum:n=!1}={}){let i=this.schemaTag(e);if(!i)throw new Error(`unknown element '${e}'`);if(!Array.isArray(r)||r.some(s=>typeof s!="string"))throw new TypeError("childTags must be an array of strings");return this._validateChildren(i,this.schema[i],r,n)}validateParent(e,r=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(r===null)throw new Error(`'${n}' requires a declared parent`);let a=this.schemaTag(r);if(!a)throw new Error(`unknown parent element '${r}'`);return this._validateParent(n,i,a),!0}bagCall(e,r,n,i){return this.setChild(e,r,n,i)}commandOnNode(e,r,n,i){if(e=Or(e),e.value instanceof W)return this.setChild(e.value,r,n,i);let s=e.value,a=new e.parentBag.constructor(null,e.builder||this),o=this.setChild(a,r,n,i,e);return this.promoteNodeValue(e,s,a),o}promoteNodeValue(e,r,n){e.setValue(n)}setChild(e,r,n,i,s=null){let a={...i},o=this.schema[r];if(!o)throw new Error(`unknown element '${r}'`);this.validateNodeValues(r,n,a);let u=o._meta?.subbuilder,c=(u==null?null:this._resolveSubbuilderReference(u,a,r))||this,d=n instanceof W?n._builderBindingPlan(c):null,f=s?.rootBuilder||e.root._builder||this;if(a.nodeId!=null&&f.source.getNodeByAttr("nodeId",a.nodeId))throw new Error(`Duplicate nodeId '${a.nodeId}'`);n instanceof W&&this._validateChildren(r,o,n.getNodes().map(y=>y.nodeTag),!1);let h=s||e.parentNode,p=h?.nodeTag?this.schema[h.nodeTag]:null;if(p&&!h._getMeta("subbuilder")&&this._countsForGrammar(o))this._validateParent(r,o,h.nodeTag),this._validateChildren(h.nodeTag,p,[...e.getNodes().map(y=>y.nodeTag),r],!1);else if(!p&&!h?._getMeta("subbuilder")&&o._parentSpec!=null&&this._countsForGrammar(o))throw new Error(`'${r}' requires a declared parent`);o._meta&&!("_meta"in a)&&(a._meta=o._meta),o.ns&&!("ns"in a)&&(a.ns=o.ns);let m=a.node_position;delete a.node_position;let g=a.node_label;delete a.node_label;let _;if(p?.collection_key){if(g!=null)throw new Error(`'${r}': node_label is not allowed in a collection`);_=this._collectionLabel(p.collection_key,r,a)}else{let y=p?._subSpec?.get(r);if(y&&y.max===1){if(g!=null)throw new Error(`'${r}': node_label is not allowed on a singleton`);_=r}else _=g||o.node_label||this._autoLabel(e,r)}if(e.node(_)!=null)throw new Error(`duplicate node label '${_}'`);return e._setBuilderItem(c,d,_,n,a,m||">",!1,!0,null,!1,!0,null,r)}_countsForGrammar(e){let r=e?._meta||{};return!(r.data_element||r.subbuilder||r.component)}_validateParent(e,r,n){let i=r._parentSpec;if(!(i==null||i.has("*")||!this._countsForGrammar(r))&&!i.has(n))throw new Error(`'${e}' not allowed as child of '${n}'`)}_validateChildren(e,r,n,i){let s=r._subSpec;if(s==null||s.has("*")||r._meta?.subbuilder)return[];let a=new Map;for(let o of n){let u=this.schema[o];if(u&&!this._countsForGrammar(u))continue;let l=s.get(o);if(!l)throw new Error(`'${o}' not allowed as child of '${e}'`);let c=(a.get(o)||0)+1;if(a.set(o,c),c>l.max)throw new Error(`too many '${o}' in '${e}'`)}return i?[...s].filter(([o,u])=>(a.get(o)||0)<u.min).map(([o])=>o):[]}_collectionLabel(e,r,n){let i=s=>{if(n[s]===null||n[s]===void 0)throw new Error(`'${r}': collection key needs attribute '${s}'`);return String(n[s])};return e.includes("${")?e.replace(/\$\{([^}]+)\}/g,(s,a)=>i(a)):i(e)}validateSource(){let e=[],r=(n,i="")=>{for(let s of n.getNodes()){let a=i?`${i}.${s.label}`:s.label,o=s.builder;o.validateCustomTypes(s);let u=o.schema[s.nodeTag];if(u&&!s._getMeta("data_element,subbuilder,component").some(Boolean)){let l=s.value instanceof W?s.value.getNodes().map(d=>d.nodeTag):[],c=o._validateChildren(s.nodeTag,u,l,!0);c.length&&e.push([a,c])}s.value instanceof W&&r(s.value,a)}};return r(this.source),e}_autoLabel(e,r){let n=0;for(;e.node(`${r}_${n}`)!==null&&e.node(`${r}_${n}`)!==void 0;)n+=1;return`${r}_${n}`}nodeById(e){let r=this.source.getNodeByAttr("nodeId",e);if(r==null)throw new Error(`nodeId not found: ${e}`);return r.builder.wrapSource(r)}runtimeValues(e){e.builder.validateCustomTypes(e);let r=new Map,n={},i=e.runtimeToEvaluate(),s=new Set(i.keys()),a=new Map([...Object.entries(e.getAttr()),...e.fixedAttrItems()]);for(let[c,d]of[...i])if(!(typeof c!="string"||!at(d)))for(let f of Hi(e,d))i.has(f)||i.set(f,a.get(f));let o=e._getMeta("data_element");for(let[c,d]of i){if(d instanceof ee){r.set(c,d.resolve());continue}let f=typeof c=="string"?at(d)?.pointer??d:d;if(!e.pointerType(f)){r.set(c,typeof c=="string"&&typeof d=="string"&&d.startsWith("==")?null:d);continue}let h=e.absDatapath(f);if(r.set(c,this.data.getItem(h)),!o&&!h.includes("?")&&c===Gt){let p=this.data.getNode(h);p&&Object.assign(n,p.getAttr("_wdg"))}}let u=go(i,r,(c,d,f,h)=>this.evaluatePointerExpression(e,c,d,f,h)),l=u.get(Gt);u.delete(Gt);for(let c of u.keys())s.has(c)||u.delete(c);return[l,{...Object.fromEntries(u),...n}]}evaluatePointerExpression(e,r,n,i,s){return null}targetId(e){if(e._targetId)return e._targetId;let r=e.rootBuilder;return e.parentBag.root!==r.source.root?null:(r._targetSerial+=1,e._targetId=`n${r._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 r of this.dataLogic){let i=(typeof r=="function"?r:r.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[,r]=this.runtimeValues(e),n={};for(let[i,s]of Object.entries(r))zo.has(i)||(n[i]=s);return n}computeLogic(e){for(let r of e)this._computeNode(r)}_computeNode(e){let r=e.getAttr()||{};if(e.nodeTag==="dataSetter"){let n={};for(let[i,s]of Object.entries(r))i!=="destination"&&i!=="value"&&!i.startsWith("_")&&(n[i]=s);e.setRelativeData(r.destination,r.value,{attributes:Object.keys(n).length?n:null})}else if(e.nodeTag==="dataFormula"){let n=this._resolveLogicFunc(r.func);e.setRelativeData(r.destination,n(this._bindings(e)))}else e.nodeTag==="dataController"&&this._resolveLogicFunc(r.func)(e,this._bindings(e))}_dataElementNodes(){let e=[],r=n=>{for(let i of n.getNodes())i._getMeta("data_element")&&e.push(i),i.value instanceof W&&r(i.value)};return r(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 o of jo(this.constructor))if(Object.hasOwn(o,"components"))for(let u of o.components||[])e[u]=u;if(!Object.keys(e).length)return;let r={...this.schema},n={};for(let[o,u]of Object.entries(e))r[o]={sub_tags:"",_meta:{component:!0}},n[o.toLowerCase()]=u;let i=Br(r),s=this._collection||this.constructor._classCollection,a=s.toDocument();a.abstracts={},a.elements=Object.fromEntries(Object.keys(e).map(o=>[o,r[o]])),this._collection=new We(s.toDocument()).update(a),this._schemaOverride=r,this._componentMap=n,this._tagNamesOverride=i}_expansionRoot(e=null){let r=this.constructor._sourceClass,n=new r(null,this);return n.setBackref(),n.setItem(Ir,new r(null,this),e?{datapath:e}:null),n.getItem(Ir)}create(){this.setup(this.data),this._resolveComponents(),this.main(this.root),this.computeLogic(this._dataElementNodes())}get renderer_xml(){return new vt(this)}getRenderer(e=null){e??=this.constructor._defaultRenderMode;let r=this[`renderer_${e}`];if(!r)throw new Error(`${this.constructor.name} does not expose renderer_${e}`);return r}materialize(e=null,r={}){e??=this.constructor._defaultRenderMode;let n=this.getRenderer(e),i=n.renderChildren(n.preprocess(this.source),r);return this.materialized[e]=i,i}setRenderTarget(e,r=null){r??=this.constructor._defaultRenderMode,this._defaultTargets.set(r,e)}render({mode:e=null,target:r=null,...n}={}){e??=this.constructor._defaultRenderMode;let i=this.getRenderer(e);if(r===!1&&i.renderType!=="string")throw new TypeError("target=false is not valid for an object renderer");let s=r===!1?null:r||this._defaultTargets.get(i.mode)||null,a={...s?.renderOpts,...n};return i.finalize(this.materialize(e,a),s,a)}};Fe._registry=new Map;var Rf=new Set(["short","medium","long","full"]),Lf=/('(?:[^']|'')*'|[a-zA-Z]+|[^a-zA-Z']+)/g;function Ff(t,e){if(!(t instanceof Date))throw new TypeError("Temporal formats require a typed Date value");if(!Number.isFinite(t.getTime()))throw new RangeError("Invalid date");let r=e||be(t).split("::").at(-1);if(!["D","H","DH","DHZ"].includes(r))throw new RangeError(`Unsupported temporal dtype: ${r}`);return r}function $f(t,e,r,n){let i=e.match(Lf)||[];if(i.join("")!==e)throw new RangeError("Unclosed format literal");let s=(c,d=2)=>String(c).padStart(d,"0"),a=c=>new Intl.DateTimeFormat(r,{timeZone:"UTC",...c}).format(t),l={...n==="H"?{}:{y:()=>String(t.getUTCFullYear()),yy:()=>s(t.getUTCFullYear()%100),yyyy:()=>s(t.getUTCFullYear(),4),M:()=>String(t.getUTCMonth()+1),MM:()=>s(t.getUTCMonth()+1),MMM:()=>a({month:"short"}),MMMM:()=>a({month:"long"}),d:()=>String(t.getUTCDate()),dd:()=>s(t.getUTCDate()),EEE:()=>a({weekday:"short"}),EEEE:()=>a({weekday:"long"})},...n==="D"?{}:{H:()=>String(t.getUTCHours()),HH:()=>s(t.getUTCHours()),h:()=>String(t.getUTCHours()%12||12),hh:()=>s(t.getUTCHours()%12||12),m:()=>String(t.getUTCMinutes()),mm:()=>s(t.getUTCMinutes()),s:()=>String(t.getUTCSeconds()),ss:()=>s(t.getUTCSeconds()),a:()=>new Intl.DateTimeFormat(r,{hour:"numeric",hour12:!0,timeZone:"UTC"}).formatToParts(t).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(!l[c])throw new RangeError(`Unsupported date format token: ${c}`);return l[c]()}).join("")}function Vo(t,{format:e,mask:r,locale:n,dtype:i,places:s}={}){let a=t==null?"":String(t);if(t!=null&&t!==""&&(e!=null&&e!==""||s!=null))if(typeof t=="number"||oe(t))a=Pf(t,{format:e,locale:n,places:s});else{let o=Ff(t,i);if(Rf.has(e)){let u={timeZone:"UTC"};o!=="H"&&(u.dateStyle=e),o!=="D"&&(u.timeStyle=e),a=new Intl.DateTimeFormat(n||void 0,u).format(t)}else a=$f(t,String(e),n||void 0,o)}return r==null?a:String(r).replaceAll("%s",()=>a)}function qf({format:t="decimal",places:e}={}){let r={maximumFractionDigits:20};if(!t||t==="decimal")r.style="decimal";else if(t==="percent")r.style="percent";else if(t==="scientific")r.notation="scientific";else{let n=/^(0|#,##0)(?:\.(0*)(#*))?$/.exec(t);if(!n||t.includes(".")&&!n[2]&&!n[3])throw new RangeError(`Unsupported number format: ${t}`);r.useGrouping=n[1].includes(","),r.minimumFractionDigits=(n[2]||"").length,r.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");r.minimumFractionDigits=n,r.maximumFractionDigits=n}return r}function Pf(t,e={}){if(typeof t!="number"&&!oe(t))throw new TypeError("Number formatting requires a Number or Decimal");if(!Number.isFinite(Number(t)))throw new RangeError("Number must be finite");let r=new Intl.NumberFormat(e.locale||void 0,qf(e));if(oe(t)&&new Intl.NumberFormat("en",{useGrouping:!1}).format("9007199254740993")!=="9007199254740993")throw new Error("This browser cannot format Decimal values without precision loss");return r.format(oe(t)?t.toString():t)}var Uf=new Set(["style","script"]),jf=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"]),Ho=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"]),Mr=new Set(["rounded","gradient","shadow","transform","transition","zoom","filter"]),Wo=t=>t===!0?"true":t===!1?"false":String(t),On=t=>typeof t=="number"&&Number.isFinite(t)?`${t}px`:String(t);function zf(t){if(Ho.has(t))return!0;for(let e of Ho)if(t.startsWith(`${e}_`))return!0;return!1}function Vf(t){let e=new Map;if(!t)return e;let r=[],n=0,i=null,s=!1,a=!1,o=0,u=String(t);for(let l=0;l<u.length;l+=1){let c=u[l],d=u[l+1];if(a){c==="*"&&d==="/"&&(a=!1,l+=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==="*"?(a=!0,l+=1):"([{".includes(c)?o+=1:")]}".includes(c)&&o>0?o-=1:c===";"&&o===0&&(r.push(u.slice(n,l)),n=l+1)}r.push(u.slice(n));for(let l of r){let c=l.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 Rr=class extends yt{static mode="html";renderedItem(e,r,n,{tag:i,xml:s=!0,pretty:a=!1,depthOffset:o=0,includeDatapath:u=!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(r)&&(c!=null||d!=null||h!=null)&&(r=Vo(r,{format:c,mask:d,places:h,dtype:p,locale:this._displayLocale(e,f)}));let g=this._formatAttrs(m);if(u){if(!Object.hasOwn(n,"id")){let k=this.builder.targetId(e);k!==null&&(g+=` id="${this._htmlAttrValue(k)}"`)}for(let[k,S]of Object.entries(e.getAttr()))e.pointerType(S)&&(g+=` data-${this.adapt(k)}-pointer="${this._htmlAttrValue(e.absDatapath(S))}"`)}let _=a?" ".repeat(this._nodeDepth(e,o)):"",w=a?`
22
- `:"";if(e._getMeta("void"))return`${_}<${i}${g}${s?"/":""}>${w}`;if(Array.isArray(r)){let k=this._composeStringFragments(r);return`${_}<${i}${g}>${w}${k}${_}</${i}>${w}`}if(r==null)return`${_}<${i}${g}></${i}>${w}`;let y=typeof r=="string"&&r.endsWith("::HTML")?r.slice(0,-6):Uf.has(i)?String(r):this._escapeText(r);return`${_}<${i}${g}>${y}</${i}>${w}`}_displayLocale(e,r){if(r)return r;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 r={},n={};for(let[s,a]of Object.entries(e||{}))if(s.startsWith(`${this.builder.constructor._name}_`))r[this.adapt(s)]=a;else if(s==="dtype")r.dtype=a;else{if(this.builder.constructor.retainedAttrPrefixes.some(o=>s.startsWith(o)))continue;this._isStyleContribution(s)?n[s]=a:r[s]=a}let i=this._adaptStyle(n);return i&&(r.style=i),r}_isStyleContribution(e){if(e==="style"||e.startsWith("style_")||Mr.has(e))return!0;let r=e.includes("_")?e.slice(0,e.indexOf("_")):null;return r!==null&&Mr.has(r)||zf(e)}_adaptStyle(e){let r=Vf(e.style),n=new Map,i=new Map;for(let[s,a]of Object.entries(e))if(s!=="style")if(s.startsWith("style_"))r.set(s.slice(6).replaceAll("_","-"),Wo(a));else if(Mr.has(s))n.set(s,a);else{let o=s.indexOf("_"),u=o<0?s:s.slice(0,o);o>=0&&Mr.has(u)?(i.has(u)||i.set(u,{}),i.get(u)[s.slice(o+1)]=a):r.set(s.replaceAll("_","-"),Wo(a))}for(let s of Mr)(n.has(s)||i.has(s))&&this[`_macro_${s}`](n.get(s),i.get(s)||{},r);return[...r].map(([s,a])=>`${s}: ${a}`).join("; ")}_formatAttrs(e){let r=[];for(let[n,i]of Object.entries(e||{}))jf.has(n)?i&&r.push(` ${n}`):r.push(` ${n}="${this._htmlAttrValue(i)}"`);return r.join("")}_htmlAttrValue(e){return(e===!0?"true":e===!1?"false":String(e)).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}_macro_rounded(e,r,n){let i=e===void 0?{}:{top_left:e,top_right:e,bottom_left:e,bottom_right:e};for(let[s,a]of Object.entries(r))if(s==="top"||s==="bottom")i[`${s}_left`]=a,i[`${s}_right`]=a;else if(s==="left"||s==="right")i[`top_${s}`]=a,i[`bottom_${s}`]=a;else if(["top_left","top_right","bottom_left","bottom_right"].includes(s))i[s]=a;else throw new TypeError(`rounded: unknown sub-kwarg '${s}'`);for(let[s,a]of Object.entries(i))n.set(`border-${s.replaceAll("_","-")}-radius`,On(a))}_macro_transform(e,r,n){let i=e===void 0?[]:[String(e)];for(let[s,a]of Object.entries(r))s==="rotate"?i.push(`rotate(${a}deg)`):s==="scale"||s==="translate"?i.push(`${s}(${a})`):s==="translate_x"?i.push(`translateX(${On(a)})`):s==="translate_y"?i.push(`translateY(${On(a)})`):s==="skew_x"?i.push(`skewX(${a}deg)`):s==="skew_y"?i.push(`skewY(${a}deg)`):i.push(`${s.replaceAll("_","-")}(${a})`);i.length&&n.set("transform",i.join(" "))}_macro_filter(e,r,n){let i=e===void 0?[]:[String(e)];for(let[s,a]of Object.entries(r))s==="rotate"?i.push(`hue-rotate(${a}deg)`):s==="blur"?i.push(`blur(${On(a)})`):s==="drop_shadow"?i.push(`drop-shadow(${a})`):i.push(`${s.replaceAll("_","-")}(${a})`);i.length&&n.set("filter",i.join(" "))}_macro_transition(e,r,n){e!==void 0&&n.set("transition",String(e));for(let[i,s]of Object.entries(r))n.set(`transition-${i.replaceAll("_","-")}`,String(s))}_macro_zoom(e,r,n){e!==void 0&&n.set("zoom",String(e))}_macro_shadow(e,r,n){e!==void 0&&n.set("box-shadow",String(e));for(let[i,s]of Object.entries(r))n.set(`box-shadow-${i.replaceAll("_","-")}`,String(s))}_macro_gradient(e,r,n){e!==void 0&&n.set("background-image",String(e))}};var Hf=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 Go(t){return Object.fromEntries(Object.entries(t||{}).map(([e,r])=>[Hf.has(e)?e.replaceAll("_","-"):e,r]))}var Lr=class extends vt{static mode="svg";adaptAttrs(e){return Go(e)}};var Yo={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 Bn=class extends Fe{static _name="html";static _defaultRenderMode="html";static retainedAttrPrefixes=["validate_","dtype"];static{this.defineGrammar(Yo)}get renderer_html(){return new Rr(this)}};Fe.registerBuilder(Bn);var Xo={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 In=class extends Fe{static _name="svg";static _defaultRenderMode="svg";static{this.defineGrammar(Xo)}get renderer_svg(){return new Lr(this)}};Fe.registerBuilder(In);var xe="http://www.w3.org/2000/svg";function Mn(){return Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)),t=>t.toString(16).padStart(2,"0")).join("")}var Rn=class{#e;#s;#o;#l=[];#u;#d;#a;#r=null;#t=null;#_;#v;#k;#f;#n;#p=!1;#y=[];#b;#g=[];#i=!1;#h=!1;constructor(e,r){this.#e=e,this.#s=r;let n=this.#a=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.#m()}),e.addEventListener("keydown",s=>{this.#r&&s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),this.close())}),e.shadowRoot.append(n)}setSourceContext(e){this.#d=e;let r=e.sourceNode,n=r.rootBuilder;r.staticValue===null&&r.setValue(new n.source.constructor(null,n),!1),e.sourceNode.rootBuilder.binding.bindingFor(e.sourceNode).track(()=>this.dispose())}#E(){if(this.#n)return;let e=this.#d.sourceNode,r=e.rootBuilder;this.#f=`_gramlot.grid.${Mn()}.columnFilter`,this.#n=new Zo({rows:new Zo,checked:"",title:"",summary:"",from:null,to:null,hideRange:!0,rangeError:""}),e.setRelativeData(this.#f,this.#n);let n=r.wrapSource(e).div({node_label:`column_filter_${Mn()}`,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.#_=Yt(n),this.#_.setAttr({datapath:this.#f});let i=new r.source.constructor(null,r),s=r.wrapSource(i);s.div("^.title",{font_weight:"600",padding:"0 2px"});let a=s.div({display:"flex",gap:"8px",hidden:"^.hideRange"});this.#y=[Yt(a.dateTextBox({value:"^.from",period_to:".to",lbl:"From",width:"136px"})),Yt(a.dateTextBox({value:"^.to",lbl:"To",width:"136px"}))],s.div("^.rangeError",{role:"alert",color:"var(--gramlot-error)"});let o=s.frameGrid({storepath:".rows",rowMode:"attributes",height:"270px",width:"100%"});this.#v=Yt(o),this.#k=Yt(o.toolbar.menuline({group:!0,class:"gramlot-grid-search"}).searchBox({searchOn:"Value:caption",searchLiteral:!0}));let u=o.grid;u.setAttr({sortedBy:"caption:a"});let l=u.struct();l.column({field:"selected",name:"\u2713",title:"Selected values",width:"32px",align:"center",check:"multiple",checked:"^.checked",checkedField:"id"}),l.column({field:"caption",name:"Value",width:"170px"}),l.column({field:"count",name:"Rows",dtype:"L",width:"64px",align:"end"});let c=s.menu({presentation:"bar",aria_label:"Column filter actions"});Object.defineProperty(Yt(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=r.binding.gramlot.src.prepareSource(i);r.binding.renderer.validateCandidate(d),this.#_.setValue(d),this.#A()}#A(){if(!this.#n||this.#g.length)return;let e=this.#d.sourceNode.rootBuilder.binding.router;this.#g.push(e.register({path:this.#f+".checked",recipient:{receive:()=>this.#x()}}));for(let r of["from","to"])this.#g.push(e.register({path:this.#f+"."+r,recipient:{receive:()=>this.#w()}}))}#x(){if(this.#h||this.#t===null)return;let e=","+this.#n.getItem("checked")+",",r=this.#n.getItem("rows").getNodes(),n=r.filter(i=>e.includes(","+i.label+",")).map(i=>i.getAttr("value"));this.#o.applyColumnFilter(this.#t,this.#o.columnRange(this.#t)&&n.length===r.length?null:n)}#w(){this.#h||this.#p||this.#t===null||(this.#p=!0,queueMicrotask(()=>{this.#p=!1,this.#t!==null&&this.#i&&this.#O()}))}#O(){let e=this.#l.find(a=>a.field===this.#t);if(!["D","DH","DHZ"].includes(e.dtype))return;let r=this.#n.getItem("from"),n=this.#n.getItem("to"),i=this.#o.columnRange(this.#t);if(i?.from&&!r&&(n=null,this.#h=!0,this.#n.setItem("to",null),this.#h=!1),r&&n&&r>n){this.#n.setItem("rangeError","From must not be after To.");return}if(this.#n.setItem("rangeError",""),+r==+(i?.from??null)&&+n==+(i?.to??null))return;let s=!r&&!n?this.#o.columnFacets(this.#t).filter(a=>a.selected).map(a=>a.value):null;this.#o.applyColumnFilter(this.#t,s,{from:r,to:n,dtype:e.dtype,timeZone:this.#d.timeZone})}selectAll(){this.#o.applyColumnFilter(this.#t,this.#o.columnRange(this.#t)?null:this.#o.columnFacets(this.#t).map(e=>e.value))}selectNone(){this.#o.applyColumnFilter(this.#t,[])}reset(){this.#h=!0;try{this.#n.setItem("from",null),this.#n.setItem("to",null),this.#n.setItem("rangeError","");let e=this.#d.sourceNode.rootBuilder.binding.renderer;for(let r of this.#y)e.getDomNode(r).restoreFormValue(null)}finally{this.#h=!1}this.#o.applyColumnFilter(this.#t,null,null)}button(e){let r=this.#e.ownerDocument,n=r.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=r.createElementNS(xe,"svg");i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("aria-hidden","true");let s=r.createElementNS(xe,"path");return s.setAttribute("d","M3 5h18l-7 8v6l-4 2v-8z"),i.append(s),n.append(i),n}update(e,r,n,i){e!==this.#o&&(this.close(),this.#b?.(),this.#b=null,this.#o=e),this.#l=r,this.#u=i,(!n||this.#r&&!this.#r.isConnected)&&this.close(),this.#i&&!this.#b&&(this.#b=e.subscribe(this.refresh)),this.refresh()}#D=e=>{let r=e.target.closest(".column-filter");if(!r)return;if(e.stopPropagation(),r===this.#r){this.close();return}this.close(),this.#E(),this.#r=r,this.#t=r.dataset.field,this.#h=!0;let n=this.#o.columnRange(this.#t);this.#n.setItem("from",n?.from??null),this.#n.setItem("to",n?.to??null),this.#n.setItem("rangeError","");let i=this.#l.find(a=>a.field===this.#t);this.#n.setItem("hideRange",!["D","DH","DHZ"].includes(i.dtype));let s=this.#d.sourceNode.rootBuilder.binding.renderer;for(let[a,o]of["from","to"].entries())s.getDomNode(this.#y[a]).restoreFormValue(this.#n.getItem(o));this.#n.getItem("rows").clear(),this.#n.setItem("checked",""),s.getDomNode(this.#k).clear(),this.#h=!1,this.refresh(),this.#a.showPopover(),r.setAttribute("aria-expanded","true"),this.#c(),this.#d.sourceNode.rootBuilder.binding.renderer.getDomNode(this.#k).focus()};refresh=()=>{if(!this.#o)return;for(let o of this.#s.querySelectorAll(".column-filter")){let u=this.#o.columnFilter(o.dataset.field)!==null||this.#o.columnRange(o.dataset.field)!==null;o.classList.toggle("active",u),o.closest("th").classList.toggle("column-filtered",u),o.setAttribute("aria-pressed",String(u))}if(this.#t===null)return;let e=this.#l.find(o=>o.field===this.#t);if(!e){this.close();return}let r=e.title??e.name;this.#a.setAttribute("aria-label",`Filter ${r}`);let n=this.#o.columnFacets(this.#t),i=this.#n.getItem("rows");this.#v.setAttr({height:`${76+28*Math.max(1,Math.min(n.length,8))}px`});let s=new Map(i.getNodes().map(o=>[o.getAttr("key"),o])),a=[];this.#h=!0;try{this.#n.setItem("title",r);for(let u of n){let l=u.value===null?"Empty":ji(u.value,e,this.#u),c={key:u.key,value:u.value,caption:l,count:u.count},d=s.get(u.key);if(d)s.delete(u.key),d.setAttr(c);else{let f=`v_${Mn()}`;i.setItem(f,null,{...c,id:f}),d=i.getNode(f)}u.selected&&a.push(d.label)}for(let u of s.values())i.popNode(u.label);let o=a.join(",");this.#n.getItem("checked")!==o&&this.#n.setItem("checked",o),this.#n.setItem("summary",`${a.length} of ${n.length} values selected`)}finally{this.#h=!1}this.#c()};#c=()=>{this.#r&&Ur(this.#a,this.#r,{align:"start"})};#m(){this.#r?.setAttribute("aria-expanded","false"),this.#r=null,this.#t=null}close(){if(!this.#r)return;let e=this.#r;this.#a.hidePopover(),this.#m(),e.isConnected&&e.focus({preventScroll:!0})}connect(){this.#i||(this.#i=!0,this.#A(),this.#s.addEventListener("click",this.#D),this.#e.ownerDocument.defaultView.addEventListener("resize",this.#c),this.#e.ownerDocument.defaultView.addEventListener("scroll",this.#c,!0))}disconnect(){this.close(),this.#i=!1,this.#b?.(),this.#b=null;for(let e of this.#g)e.close();this.#g=[],this.#s.removeEventListener("click",this.#D),this.#e.ownerDocument.defaultView.removeEventListener("resize",this.#c),this.#e.ownerDocument.defaultView.removeEventListener("scroll",this.#c,!0)}dispose(){this.disconnect(),this.#f&&this.#d.sourceNode.data.popNode(this.#f)}};import{Bag as ll}from"@gramlot/gramlot";var _e={};ms(_e,{defineCollection:()=>Xf});Xt(_e,lb);import*as lb from"@gramlot/gramlot/components";import{defineCollection as Yf}from"@gramlot/gramlot/components";function Xf(t){if(t.name!=="grid")throw new Error("Unexpected bundled collection");let e=[],r={};t.css?.forEach((n,i)=>{n.href=e[i].href});for(let[n,i]of Object.entries(t.assets??{}))i.href=r[n].href;return Yf({...t,css:e,assets:r})}function Ko(t,e){return t.parameters=Zf(t.constructor.gramlotComponent,e),Object.fromEntries(Object.entries(e).filter(([r])=>!Object.hasOwn(t.parameters,r)))}function Zf(t,e){return Object.fromEntries(Object.entries(t.parameters).map(([r,n])=>[r,Object.hasOwn(e,r)?e[r]:n.default]))}function Fr(t){return class extends t{constructor(){super();let e=this.attachShadow({mode:"open"}),r=this.ownerDocument.createElement("style");r.textContent=`:host{box-sizing:border-box;display:block;min-width:0;font:inherit;color:var(--gramlot-ink,CanvasText)}
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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}_escapeAttr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}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("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}_escapeAttr(e){return this._escapeText(e).replaceAll('"',"&quot;")}_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("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}_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;#a;#o;#l=null;#s=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.#o=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.#l&&s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),this.close())}),e.shadowRoot.append(n)}setSourceContext(e){this.#a=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.#a.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.#a.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.#s===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.#s,this.#i.columnRange(this.#s)&&n.length===t.length?null:n)}#D(){this.#_||this.#b||this.#s===null||(this.#b=!0,queueMicrotask(()=>{this.#b=!1,this.#s!==null&&this.#k&&this.#B()}))}#B(){let e=this.#n.find(o=>o.field===this.#s);if(!["D","DH","DHZ"].includes(e.dtype))return;let t=this.#d.getItem("from"),n=this.#d.getItem("to"),i=this.#i.columnRange(this.#s);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.#s).filter(o=>o.selected).map(o=>o.value):null;this.#i.applyColumnFilter(this.#s,s,{from:t,to:n,dtype:e.dtype,timeZone:this.#a.timeZone})}selectAll(){this.#i.applyColumnFilter(this.#s,this.#i.columnRange(this.#s)?null:this.#i.columnFacets(this.#s).map(e=>e.value))}selectNone(){this.#i.applyColumnFilter(this.#s,[])}reset(){this.#_=!0;try{this.#d.setItem("from",null),this.#d.setItem("to",null),this.#d.setItem("rangeError","");let e=this.#a.sourceNode.rootBuilder.binding.renderer;for(let t of this.#f)e.getDomNode(t).restoreFormValue(null)}finally{this.#_=!1}this.#i.applyColumnFilter(this.#s,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.#l&&!this.#l.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.#l){this.close();return}this.close(),this.#p(),this.#l=t,this.#s=t.dataset.field,this.#_=!0;let n=this.#i.columnRange(this.#s);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.#s);this.#d.setItem("hideRange",!["D","DH","DHZ"].includes(i.dtype));let s=this.#a.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.#o.showPopover(),t.setAttribute("aria-expanded","true"),this.#u(),this.#a.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.#s===null)return;let e=this.#n.find(a=>a.field===this.#s);if(!e){this.close();return}let t=e.title??e.name;this.#o.setAttribute("aria-label",`Filter ${t}`);let n=this.#i.columnFacets(this.#s),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.#l&&Wr(this.#o,this.#l,{align:"start"})};#S(){this.#l?.setAttribute("aria-expanded","false"),this.#l=null,this.#s=null}close(){if(!this.#l)return;let e=this.#l;this.#o.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.#a.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)}
23
23
  *,*::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")),e.append(r,this.controlBox)}projectAttributes(e){return Ko(this,e)}}}Fr.parameters={};function ss(t,e){return(","+t+",").includes(","+e+",")}function as(t){if(typeof t!="string")throw new TypeError("grid checked must refer to a string (empty string for an empty set)");return t}function Ln(t){if(typeof t!="string"||!t||t.includes(","))throw new TypeError("grid checkedField requires nonempty text IDs without commas");return t}function os(t){if(typeof t!="string")throw new TypeError("collection view sortedBy must be a string");if(t==="")return[];let e=new Set;return t.split(",").map(r=>{let n=/^([^,:]+):([ad])$/.exec(r);if(!n||e.has(n[1]))throw new TypeError(`Invalid collection view sort criterion: ${r}`);return e.add(n[1]),{field:n[1],direction:n[2]}})}import nh from"@gramlot/collections/inputs";import{sourceTarget as Fn,toTytx as Jf}from"@gramlot/gramlot";var $n=class{constructor(e,r,n,i,s,a,o){this.grid=e,this.context=r,this.cellFor=n,this.store=i,this.renderedRows=s,this.navigate=a,this.focusField=o,this.retained=new Map,this.declarations=new Map,this.checking=new Set,this.columns=[],this.layer=e.ownerDocument.createElement("div"),this.layer.className="cell-editor",this.layer.hidden=!0;let u=e.ownerDocument.createElement("slot");u.name="cell-editor",this.layer.append(u),e.control.append(this.layer),this.keydown=l=>{if(!(!this.active||l.isComposing)){if(l.key==="Escape"){l.preventDefault();let c=this.cellFor(this.active.row,this.active.column.field);this.session.clearDraft(this.active.source),this.close(),c?.focus({preventScroll:!0})}else if(l.key==="Enter"||l.key==="Tab"){if(l.key==="Enter"&&this.active.element.control.localName==="textarea"&&!l.ctrlKey&&!l.metaKey)return;l.preventDefault();let c=this.active;this.session.commitField(c.path);let d=this.cellFor(c.row,c.column.field);this.close(),d?.focus({preventScroll:!0}),l.key==="Tab"&&this.navigate(c.row,c.column.field,l.shiftKey?-1:1)}}},this.arrowKeydown=l=>{if(!this.active||l.isComposing||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(l.key)||l.altKey||l.ctrlKey||l.metaKey||l.shiftKey)return;let c=this.active.element.control;if(c.localName==="textarea"||["range","date","time","datetime-local"].includes(c.type)||["gramlot-date-text-box","gramlot-time-text-box","gramlot-date-calendar"].includes(this.active.element.localName)||c.getAttribute("aria-expanded")==="true"||l.key==="ArrowDown"&&c.getAttribute("role")==="combobox")return;let d=l.key==="ArrowLeft"||l.key==="ArrowRight",f=l.key==="ArrowLeft"||l.key==="ArrowUp";if(d&&(typeof c.selectionStart!="number"||c.selectionStart!==c.selectionEnd||c.selectionStart!==(f?0:c.value.length)))return;l.preventDefault(),l.stopPropagation();let h=this.active;if(this.session.commitField(h.path),this.navigate(h.row,h.column.field,d?f?-1:1:{row:f?-1:1}),d&&this.active&&this.active!==h){let p=this.active.element.control;if(typeof p.selectionStart=="number"){let m=f?p.value.length:0;p.setSelectionRange(m,m)}}},this.connect(),r.sourceNode.rootBuilder.binding.bindingFor(r.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(e,r){let{mode:n}=this.store();return this.context.sourceNode.absDatapath(this.context.sourceNode.getAttr("storepath"))+"."+e.label+(n==="attributes"?"?":".")+r}configure(e){let r=e.filter(i=>i.edit);if(r.length){if(this.store().window!==null)throw new Error("Editing requires a fully resident Bag; remote windows are read-only.");let i=this.context.sourceNode;this.session=i.editCollection(i.absDatapath(i.getAttr("storepath")))}let n=Jf(r.map(({field:i,dtype:s,edit:a})=>({field:i,dtype:s,edit:a})));if(n!==this.validationSignature){this.validationSignature=n,this.columns=r;for(let[i,s]of this.declarations){let a=r.find(o=>o.field===s.field);if(!a)this.active?.path===i&&this.close(),this.releaseField(i);else{let{tag:o,options:u}=this.definition(a);o!==s.tag?(this.active?.path===i&&this.close(),this.releaseField(i)):(s.source.setAttr({...Object.fromEntries(Object.keys(s.options).map(l=>[l,null])),...u}),s.options=u)}}if(!r.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(e){let r=e.edit===!0?{}:{...e.edit},n=r.tag??{L:"numberTextBox",R:"numberTextBox",N:"numberTextBox",D:"dateTextBox",H:"timeTextBox",B:"checkBox"}[e.dtype]??"textbox";if(e.dtype==="DHZ"&&!r.tag)throw new Error("A datetime column requires an explicitly declared supported editor.");return delete r.tag,{tag:n,options:{...r,dtype:e.dtype??"T"}}}*validationFields(){let e=this.context.sourceNode;this.session.trackValidationDependency(e.absDatapath(e.getAttr("structpath")));let r=this.store().bag;for(let n of r.getNodes())for(let i of this.columns){if(n.parentBag!==r)continue;let s=this.path(n,i.field);this.checking.add(s);try{yield{node:this.declare(n,i,!1).source,release:()=>{this.checking.delete(s),s!==this.active?.path&&this.releaseCleanField(s)}}}catch(a){throw this.checking.delete(s),this.releaseCleanField(s),a}}}open(e,r,n){if(this.store().window!==null)throw new Error("Editing requires a fully resident Bag; remote windows are read-only.");if(this.active?.row===e&&this.active.column.field===r.field){this.active.element.control.focus();return}this.close();let i=this.path(e,r.field),s=this.declare(e,r,!0),a=this.grid.ownerDocument.getElementById(s.id);this.active={row:e,column:r,path:i,...s,element:a},this.layer.hidden=!1,this.position(n),a.control.focus()}declare(e,r,n){let i=this.context.sourceNode,s=this.path(e,r.field);this.retained.has(s)||(this.session.retainField(s),this.retained.set(s,e));let a=this.declarations.get(s);if(a)n&&i.rootBuilder.binding.renderer.mountView(a.container);else{let{tag:o,options:u}=this.definition(r);if(!i.rootBuilder.schemaTag(o))throw new Error(`Grid editor requires the ${o} input collection.`);let l=i.rootBuilder,c=`grid-cell-${crypto.randomUUID()}`,d=l.wrapSource(i).div({node_label:c,slot:"cell-editor"});n||l.binding.renderer.unmountView(Fn(d));try{let f=d[o]({...u,value:"^"+s,id:c,width:"100%",margin:"0"});a={container:Fn(d),source:Fn(f),id:c,tag:o,options:u,field:r.field};let h=this.grid.ownerDocument.defaultView.customElements.get(a.source._getMeta("render_tag"));this.session.registerField(a.source,h,n),this.declarations.set(s,a)}catch(f){let h=Fn(d);throw h.parentBag.popNode(h.label),this.releaseCleanField(s),f}}return a}close(){let e=this.active;this.active=null,this.layer.hidden=!0,e&&(this.context.sourceNode.rootBuilder.binding.renderer.unmountView(e.container),this.releaseCleanField(e.path))}releaseCleanField(e){if(this.checking.has(e))return;let r=this.session.fieldStatus(e);r.error===null&&r.pending===null&&r.draft===null&&this.retained.has(e)&&this.releaseField(e)}releaseField(e){let r=this.declarations.get(e);this.declarations.delete(e),r?.container.parentBag&&r.container.parentBag.popNode(r.container.label),this.session.releaseField(e),this.retained.delete(e)}position(e=null){if(!this.active)return;if(e??=this.cellFor(this.active.row,this.active.column.field),!e){this.close();return}let r=e.getBoundingClientRect(),n=this.grid.control.getBoundingClientRect(),i=this.grid.shadowRoot.querySelector(".body-viewport").getBoundingClientRect();Object.assign(this.layer.style,{left:`${r.left-n.left-this.grid.control.clientLeft}px`,top:`${r.top-n.top-this.grid.control.clientTop}px`,width:`${r.width}px`}),this.layer.style.setProperty("--grid-editor-height",`${r.height}px`);let s=e.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 a=this.layer.getBoundingClientRect();i.height&&(a.top<i.top||a.bottom>i.bottom||a.right<=i.left||a.left>=i.right)&&this.close()}decorate(e,r){if(this.session)for(let n of e.querySelectorAll("td[data-field]")){let i=this.session.fieldStatus(this.path(r,n.dataset.field));n.classList.toggle("invalid-cell",!!i.error),n.classList.toggle("draft-cell",i.draft!==null),i.error?(n.setAttribute("aria-invalid","true"),n.title=i.error.getNodes().map(s=>s.value).join(`
25
- `)):(n.removeAttribute("aria-invalid"),n.removeAttribute("title"))}}refresh(){let e=this.store().bag;for(let[r,n]of this.retained)n.parentBag!==e&&(this.releaseField(r),this.active?.row===n&&this.close());for(let r of this.retained.keys())r!==this.active?.path&&this.releaseCleanField(r);for(let[r,n]of this.renderedRows())this.decorate(n,r)}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 Jo(t){return typeof t=="number"&&Number.isFinite(t)?t:Ln(t)}var qn=class{#e=[];#s=!1;constructor(e,r,n,i,s,a,o){this.source=e,this.body=r,this.columns=n,this.rowFor=i,this.read=s,this.selection=a,this.view=o}path(e){return this.source.absDatapath(e.checked.slice(1))}value(e){let r=this.source.getRelativeData(e.checked.slice(1));return e.check==="single"?r==null||r===""?r:Jo(r):as(r)}id(e,r){let n=this.read(e,r.checkedField);return r.check==="single"?Jo(n):Ln(n)}contains(e,r,n){return e.check==="single"?r===n:ss(r,n)}filter(){let e=this.selection(),r=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(r)}project(e,r,n){let i=this.id(r,n),s=this.value(n),a=e.querySelector("input.grid-set-check");a||(a=e.ownerDocument.createElement("input"),a.className="grid-set-check",e.replaceChildren(a)),a.type=n.check==="single"?"radio":"checkbox",n.check==="single"?a.name=n.field:a.removeAttribute("name"),a.setAttribute("aria-label",`${n.title??n.name}: ${i}`),a.checked=this.contains(n,s,i)}refresh=()=>{this.filter();for(let e of this.body.querySelectorAll("input.grid-set-check")){let r=e.closest("td[data-field]"),n=this.columns().find(s=>s.field===r.dataset.field),i=this.rowFor(r.parentElement);n?.check&&i&&this.project(e.parentElement,i,n)}};change=e=>{let r=e.target;if(!r.matches("input.grid-set-check"))return;let n=r.closest("td[data-field]"),i=this.columns().find(c=>c.field===n.dataset.field),s=this.rowFor(n.parentElement),a=this.id(s,i),o=this.value(i),u=this.contains(i,o,a);if(r.checked===u)return;if(i.check==="single"){r.checked?this.source.setRelativeData(i.checked.slice(1),a):this.project(r.parentElement,s,i);return}let l=r.checked?o?o+","+a:a:(","+o+",").replace(","+a+",",",").slice(1,-1);this.source.setRelativeData(i.checked.slice(1),l)};configure(){for(let e of this.#e)e.close();if(this.#e=[],!!this.#s){this.filter();for(let e of this.columns().filter(r=>r.check))this.#e.push(this.source.rootBuilder.binding.router.register({path:this.path(e),recipient:{receive:this.refresh}}))}}connect(){this.#s||(this.#s=!0,this.body.addEventListener("change",this.change))}disconnect(){this.body.removeEventListener("change",this.change),this.#s=!1,this.configure()}};import{Bag as el}from"@gramlot/gramlot";var Qf=new Set(["T","B","L","R","N","D","H","DHZ"]),eh=new Set(["tag","field","name","title","dtype","width","align","format","columnset","white_space","max_height","edit","check","checked","checkedField"]),th=new Set(["tag","code","name","background","color"]),Un=class{#e=new Map;constructor(e){if(!(e instanceof el))throw new TypeError("grid structpath must resolve to a Bag");let r=Pn(e,"view_0"),n=Pn(e,"info"),i=Pn(r,"rows_0"),s=Pn(n,"columnsets"),a=new Set,o=new Map;for(let u of s.getNodes()){let l=u.getAttr();if(Qo(l,th),ls(l.code,"colgroup code"),l.tag!=="columnset"||u.resolver||u.staticValue!=null||u.label!==l.code)throw new TypeError("grid columnset requires a scalar definition labelled by code");if(o.has(l.code))throw new TypeError(`Duplicate grid colgroup: ${l.code}`);if(l.name!=null&&typeof l.name!="string")throw new TypeError("grid group name must be text");for(let c of["background","color"])if(l[c]!=null&&typeof l[c]!="string")throw new TypeError(`grid ${c} must be text`);o.set(l.code,{...l,name:l.name??l.code})}this.columns=[],this.groups=[];for(let u of i.getNodes()){let l=u.getAttr();if(Qo(l,eh),l.tag!=="cell"||u.staticValue!=null||u.resolver)throw new TypeError("grid cell must be a scalar declaration");if(ls(l.field,"field"),a.has(l.field))throw new TypeError(`Duplicate grid field: ${l.field}`);if(a.add(l.field),this.#e.set(l.field,u),l.columnset!=null&&!o.has(l.columnset))throw new TypeError(`Unknown grid columnset: ${l.columnset}`);if(l.dtype!=null&&!Qf.has(l.dtype))throw new TypeError(`Unsupported grid dtype: ${l.dtype}`);if(l.align!=null&&!["start","center","end"].includes(l.align))throw new TypeError("grid align requires start, center or end");if(l.width!=null&&(typeof l.width!="string"||!/^(?:\d+(?:\.\d+)?)(?:px|em|rem|ch|%)$/.test(l.width)))throw new TypeError("grid width requires a nonnegative CSS length (px, em, rem, ch or %)");if(l.max_height!=null&&(typeof l.max_height!="string"||!/^(?:\d+(?:\.\d+)?)(?:px|em|rem)$/.test(l.max_height)))throw new TypeError("grid max_height requires a nonnegative CSS length (px, em or rem)");if(l.white_space!=null&&!["normal","nowrap","pre-wrap"].includes(l.white_space))throw new TypeError("grid white_space requires normal, nowrap or pre-wrap");for(let h of["name","title","format"])if(l[h]!=null&&typeof l[h]!="string")throw new TypeError(`grid ${h} must be text`);if(l.edit!=null&&typeof l.edit!="boolean"&&(typeof l.edit!="object"||Array.isArray(l.edit)))throw new TypeError("grid edit requires a boolean or editor options");if(l.check!=null||l.checked!=null||l.checkedField!=null){if(!["multiple","single"].includes(l.check)||typeof l.checked!="string"||!l.checked.startsWith("^")||l.checked.length<2||l.checked.includes("?"))throw new TypeError("grid check requires single or multiple and checked=^DataPath");if(ls(l.checkedField,"checkedField"),l.edit)throw new TypeError("external check sets cannot edit row fields")}let c=Object.freeze({...l,name:l.name??l.field,align:l.align??(["L","R","N"].includes(l.dtype)?"end":"start")});this.columns.push(c);let d=l.columnset??null,f=this.groups.at(-1);(!f||f.code!==d)&&(f={code:d,...d===null?{name:null}:o.get(d),columns:[]},this.groups.push(f)),f.columns.push(c)}if(!this.columns.length)throw new TypeError("grid struct requires at least one column");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,r,n=!1){let i=this.#e.get(e),s=this.#e.get(r);if(!i||!s||i===s)return;let a=i.parentBag,o=a.getNodes(),u=o.indexOf(i),l=o.indexOf(s),c=l+Number(n)-+(u<l);c!==u&&a.move(u,c)}setColumnWidth(e,r){if(!Number.isFinite(r)||r<=0)throw new TypeError("grid resized width must be positive pixels");this.#e.get(e).setAttr({width:`${Math.round(r)}px`})}};function Pn(t,e){let r=t.getNode(e);if(!r||r.resolver||!(r.staticValue instanceof el))throw new TypeError(`grid struct requires Bag ${e}`);return r.staticValue}function Qo(t,e){for(let r of Object.keys(t))if(!e.has(r))throw new TypeError(`Unsupported grid struct attribute: ${r}`)}function ls(t,e){if(typeof t!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/.test(t))throw new TypeError(`grid ${e} requires a simple field identifier`)}var jn=class{#e;#s;#o;#l;#u;#d;#a=!1;#r=null;#t=null;constructor(e,r,n,i,s,a){this.#e=e,this.#s=r,this.#o=n,this.#l=i,this.#u=s,this.#d=a}connect(){this.#e.addEventListener("click",this.#_),this.#e.addEventListener("pointerdown",this.#g),this.#e.addEventListener("pointermove",this.#i),this.#e.addEventListener("pointerup",this.#h),this.#e.addEventListener("pointercancel",this.#x),this.#e.addEventListener("lostpointercapture",this.#x),this.#e.addEventListener("keydown",this.#E),this.#e.addEventListener("dragstart",this.#v),this.#e.addEventListener("dragover",this.#f),this.#e.addEventListener("drop",this.#n),this.#e.addEventListener("dragend",this.#p)}disconnect(){this.cancel(),this.#e.removeEventListener("click",this.#_),this.#e.removeEventListener("pointerdown",this.#g),this.#e.removeEventListener("pointermove",this.#i),this.#e.removeEventListener("pointerup",this.#h),this.#e.removeEventListener("pointercancel",this.#x),this.#e.removeEventListener("lostpointercapture",this.#x),this.#e.removeEventListener("keydown",this.#E),this.#e.removeEventListener("dragstart",this.#v),this.#e.removeEventListener("dragover",this.#f),this.#e.removeEventListener("drop",this.#n),this.#e.removeEventListener("dragend",this.#p)}#_=e=>{if(this.#a){this.#a=!1;return}if(e.target.closest(".column-resize, .column-filter"))return;let r=e.target.closest("th[data-field]");r&&this.#l(r.dataset.field,e.shiftKey)};#v=e=>{if(e.target.closest(".column-filter")){e.preventDefault();return}let r=e.target.closest("th[data-field]");if(!r||this.#r){e.preventDefault();return}this.#a=!0,this.#t={field:r.dataset.field,node:this.#o().columnNode(r.dataset.field)},e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",r.textContent),r.classList.add("column-dragging")};#k(e){let r=e.target.closest("th[data-field]");if(!this.#t||!r)return null;let n=this.#o().columnNode(r.dataset.field);return this.#o().columnNode(this.#t.field)!==this.#t.node||n===this.#t.node||n.parentBag!==this.#t.node.parentBag?null:{header:r,field:r.dataset.field,after:e.clientX>r.getBoundingClientRect().left+r.getBoundingClientRect().width/2}}#f=e=>{let r=this.#k(e);for(let n of this.#e.querySelectorAll("[data-drop]"))n.removeAttribute("data-drop");r&&(e.preventDefault(),e.dataTransfer.dropEffect="move",r.header.dataset.drop=r.after?"after":"before")};#n=e=>{let r=this.#k(e);if(!r)return;e.preventDefault();let n=this.#t.field;this.#p(),this.#o().moveColumn(n,r.field,r.after),this.#e.querySelector(`th[data-field="${n}"]`).focus({preventScroll:!0})};#p=()=>{this.#t=null;for(let e of this.#e.querySelectorAll("th"))e.classList.remove("column-dragging"),e.removeAttribute("data-drop")};#y(e){let r=e.dataset.field;if(r===void 0){let s=this.#u();return{identity:s,width:s.headerWidth,setWidth:a=>{s.setHeaderWidth(a),this.#d()}}}let n=this.#o(),i=n.columnNode(r);return{identity:i,width:i.getAttr("width"),setWidth:s=>n.setColumnWidth(r,s)}}#b(e){return e.classList.contains("row-heading")?Math.max(40,Math.ceil(e.querySelector(".row-number-measure").getBoundingClientRect().width)):Number.parseFloat(this.#s.ownerDocument.defaultView.getComputedStyle(this.#s).getPropertyValue("--gramlot-grid-column-min-width"))||40}#g=e=>{this.#a=!1;let r=e.target.closest(".column-resize");if(!r||e.button!==0||this.#r)return;let n=r.closest("th"),i=n.dataset.field,s=this.#y(n),a=[...this.#s.querySelectorAll("table")],o=[...this.#e.querySelectorAll("th[scope=col]")],u=o.map(l=>l.getBoundingClientRect().width);this.#r={pointerId:e.pointerId,field:i,header:n,identity:s.identity,originalWidth:s.width,x:e.clientX,index:o.indexOf(n),widths:u,width:n.getBoundingClientRect().width,tables:a.map(l=>({table:l,width:l.style.width,columns:[...l.querySelectorAll("col")].map(c=>({col:c,width:c.style.width}))}))},this.#e.setPointerCapture(e.pointerId),this.#s.classList.add("resizing"),e.preventDefault()};#i=e=>{let r=this.#r;if(!r||r.pointerId!==e.pointerId)return;r.width=Math.max(this.#b(r.header),Math.round(r.widths[r.index]+e.clientX-r.x));let n=r.widths.map((i,s)=>s===r.index?r.width:i);for(let{table:i,columns:s}of r.tables)i.style.width=`${n.reduce((a,o)=>a+o,0)}px`,s.forEach(({col:a},o)=>{a.style.width=`${n[o]}px`})};#h=e=>{let r=this.#r;if(!r||r.pointerId!==e.pointerId)return;this.#i(e);let n=this.#y(r.header);this.#a=!0,this.cancel(),!(n.identity!==r.identity||n.width!==r.originalWidth)&&(n.setWidth(r.width),this.#A(r.field))};#E=e=>{if(e.target.closest(".column-filter"))return;if(e.key==="Escape"&&this.#r){this.cancel(),e.preventDefault();return}let r=e.target.closest(".column-resize");if(!r&&["Enter"," "].includes(e.key)){let s=e.target.closest("th[data-field]");s&&(e.preventDefault(),this.#l(s.dataset.field,e.shiftKey));return}if(!["ArrowLeft","ArrowRight"].includes(e.key))return;if(!r){let s=e.target.closest("th[data-field]");if(!s||!e.altKey)return;let a=s.dataset.field,o=this.#o(),u=o.columnNode(a),l=u.parentBag.getNodes(),c=l[l.indexOf(u)+(e.key==="ArrowRight"?1:-1)];c?.getAttr("tag")==="cell"&&(o.moveColumn(a,c.getAttr("field"),e.key==="ArrowRight"),this.#e.querySelector(`th[data-field="${a}"]`).focus({preventScroll:!0})),e.preventDefault();return}let n=r.closest("th"),i=(e.key==="ArrowRight"?1:-1)*(e.shiftKey?1:10);this.#y(n).setWidth(Math.max(this.#b(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})}#x=()=>{this.#r&&this.cancel()};cancel(){this.#p();let e=this.#r;if(e){this.#r=null;for(let{table:r,width:n,columns:i}of e.tables){r.style.width=n;for(let{col:s,width:a}of i)s.style.width=a}this.#s.classList.remove("resizing"),this.#e.hasPointerCapture(e.pointerId)&&this.#e.releasePointerCapture(e.pointerId)}}};var zn=class{#e;#s=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.#s=e,this.#r=!0}#o=null;get headerWidth(){return this.#o}setHeaderWidth(e){if(!Number.isFinite(e)||e<=0)throw new TypeError("Grid row header width must be positive pixels");this.#o=Math.round(e)}#l=new Map;#u=new Map;#d=[];#a=[0];#r=!0;#t=32;bindStore(e){e!==this.#e&&(this.#l.clear(),this.resetMeasurements(),this.#e=e)}retain(e){let r=new Set(e);for(let n of[this.#l,this.#u])for(let i of n.keys())r.has(i)||n.delete(i);this.#r=!0}height(e){return this.#l.get(e)??null}setHeight(e,r){if(e.parentBag===this.#e){if(r===null)this.#l.delete(e);else{if(!Number.isFinite(r)||r<=0)throw new TypeError("Grid row height must be positive pixels");this.#l.set(e,Math.round(r))}this.forget(e)}}setRows(e){this.#d=e,this.#r=!0}resetMeasurements(){this.#u.clear(),this.#r=!0}forget(e){this.#u.delete(e),this.#r=!0}measure(e,r){return r<=0||this.#u.get(e)===r?!1:(this.#u.set(e,r),this.#r=!0,!0)}#_(){if(!this.#r)return;let e=1/0;for(let[r,n]of this.#u)this.#l.has(r)||(e=Math.min(e,n));e!==1/0&&(this.#t=e),this.#a=[0];for(let r of this.#d)this.#a.push(this.#a.at(-1)+(this.#u.get(r)??Math.max(this.#l.get(r)??0,this.#t)));this.#r=!1}offset(e){if(this.#_(),!this.#s)return this.#a[e];let r=e-this.#s.start;return r<=0?e*this.#t:r<=this.#d.length?this.#s.start*this.#t+this.#a[r]:e*this.#t+this.#a.at(-1)-this.#d.length*this.#t}get count(){return this.#s?.total??this.#d.length}get totalHeight(){return this.offset(this.count)}indexAt(e){this.#_();let r=0,n=this.count;for(;r<n;){let i=r+n>>>1;this.offset(i+1)<=e?r=i+1:n=i}return Math.min(r,Math.max(0,this.count-1))}window(e,r){this.#_();let n=Math.max(r,this.#t*8);return{start:this.indexAt(Math.max(0,e-n)),end:Math.min(this.count,this.indexAt(e+r+n)+1)}}};var Vn=class{#e;#s;#o;#l;#u=null;#d=null;#a;#r;#t;constructor(e,r,n,i,s,a,o){this.#e=e,this.#s=r,this.#o=n,this.#l=i,this.#a=s,this.#r=a,this.#t=o}get resizing(){return this.#u!==null}connect(){this.#e.addEventListener("pointerdown",this.#i),this.#e.addEventListener("pointermove",this.#h),this.#e.addEventListener("pointerup",this.#E),this.#e.addEventListener("pointercancel",this.#w),this.#e.addEventListener("lostpointercapture",this.#w),this.#e.addEventListener("keydown",this.#A),this.#e.addEventListener("dblclick",this.#x),this.#e.addEventListener("dragstart",this.#_),this.#e.addEventListener("dragover",this.#f),this.#e.addEventListener("dragleave",this.#n),this.#e.addEventListener("drop",this.#p),this.#e.addEventListener("dragend",this.#y)}disconnect(){this.cancel(),this.cancelDrag(),this.#e.removeEventListener("pointerdown",this.#i),this.#e.removeEventListener("pointermove",this.#h),this.#e.removeEventListener("pointerup",this.#E),this.#e.removeEventListener("pointercancel",this.#w),this.#e.removeEventListener("lostpointercapture",this.#w),this.#e.removeEventListener("keydown",this.#A),this.#e.removeEventListener("dblclick",this.#x),this.#e.removeEventListener("dragstart",this.#_),this.#e.removeEventListener("dragover",this.#f),this.#e.removeEventListener("dragleave",this.#n),this.#e.removeEventListener("drop",this.#p),this.#e.removeEventListener("dragend",this.#y)}#_=e=>{let r=e.target.closest("tr"),n=this.#l(r);if(!this.#r()||!n||this.#u||e.target.closest(".row-height-handle")){e.preventDefault();return}this.#d={node:n,bag:this.#a().bag},e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",n.label),r.classList.add("row-dragging")};#v(e){if(!this.#d||!this.#r())return null;let{node:r,bag:n}=this.#d,i=e.target.closest("tr"),s=this.#l(i);if(!s||s===r||this.#a().bag!==n||r.parentBag!==n||s.parentBag!==n)return null;let a=i.getBoundingClientRect();return{row:i,target:s,after:e.clientY>a.top+a.height/2}}#k(){for(let e of this.#e.querySelectorAll("[data-row-drop]"))e.removeAttribute("data-row-drop")}#f=e=>{this.#k();let r=this.#v(e);r&&(e.preventDefault(),e.dataTransfer.dropEffect="move",r.row.dataset.rowDrop=r.after?"after":"before")};#n=e=>{this.#e.contains(e.relatedTarget)||this.#k()};#p=e=>{let r=this.#v(e);if(!r)return;e.preventDefault(),e.stopPropagation();let{node:n}=this.#d;this.cancelDrag(),this.#a().moveRow(n,r.target,r.after)};#y=()=>{this.cancelDrag()};cancelDrag(){this.#d=null,this.#k();for(let e of this.#e.querySelectorAll(".row-dragging"))e.classList.remove("row-dragging")}#b(e){let r=e.target.closest(".row-height-handle");if(!r)return null;let n=r.closest("tr"),i=this.#l(n);return i?{handle:r,row:n,node:i}:null}project(e,r){let n=this.#o().height(r);e.style.height=n===null?"":`${n}px`}#g(e){let r=e.querySelector(".row-height-handle");r&&r.setAttribute("aria-valuenow",String(Math.round(e.getBoundingClientRect().height))),this.#t()}#i=e=>{let r=this.#b(e);if(!r||e.button!==0||this.#u)return;let{row:n}=r,i=n.getBoundingClientRect().height,s=n.style.height;n.style.height="";let a=n.getBoundingClientRect().height;n.style.height=s,this.#u={...r,pointerId:e.pointerId,y:e.clientY,height:i,minimum:a,preview:i},r.handle.focus({preventScroll:!0}),r.handle.setPointerCapture(e.pointerId),this.#s.classList.add("resizing-row"),e.preventDefault()};#h=e=>{let r=this.#u;!r||r.pointerId!==e.pointerId||(r.preview=Math.max(r.minimum,Math.round(r.height+e.clientY-r.y)),r.row.style.height=`${r.preview}px`,this.#g(r.row))};#E=e=>{let r=this.#u;!r||r.pointerId!==e.pointerId||(this.#h(e),this.cancel(),!(this.#l(r.row)!==r.node||r.preview===r.height)&&(this.#o().setHeight(r.node,r.preview),this.project(r.row,r.node),this.#g(r.row)))};#A=e=>{if(e.key==="Escape"&&(this.#u||this.#d)){this.cancel(),this.cancelDrag(),e.preventDefault();return}let r=this.#b(e);if(!r||!["ArrowUp","ArrowDown","Home"].includes(e.key))return;this.cancel();let n=null;if(e.key!=="Home"){let i=r.row.getBoundingClientRect().height;r.row.style.height="";let s=r.row.getBoundingClientRect().height;n=Math.max(s,i+(e.key==="ArrowDown"?10:-10))}this.#o().setHeight(r.node,n),this.project(r.row,r.node),this.#g(r.row),e.preventDefault()};#x=e=>{let r=this.#b(e);r&&(this.cancel(),this.#o().setHeight(r.node,null),this.project(r.row,r.node),this.#g(r.row),e.preventDefault())};#w=()=>{this.cancel()};cancel(){let e=this.#u;e&&(this.#u=null,this.project(e.row,e.node),this.#s.classList.remove("resizing-row"),e.handle.hasPointerCapture(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId))}};var tl=`
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")),e.append(t,this.controlBox)}projectAttributes(e){return cl(this,e)}}}qr.parameters={};function ms(r,e){return(","+r+",").includes(","+e+",")}function gs(r){if(typeof r!="string")throw new TypeError("grid checked must refer to a string (empty string for an empty set)");return r}function Un(r){if(typeof r!="string"||!r||r.includes(","))throw new TypeError("grid checkedField requires nonempty text IDs without commas");return r}function bs(r){if(typeof r!="string")throw new TypeError("collection view sortedBy must be a string");if(r==="")return[];let e=new Set;return r.split(",").map(t=>{let n=/^([^,:]+):([ad])$/.exec(t);if(!n||e.has(n[1]))throw new TypeError(`Invalid collection view sort criterion: ${t}`);return e.add(n[1]),{field:n[1],direction:n[2]}})}import Nh from"@gramlot/collections/inputs";import{sourceTarget as jn,toTytx as ch}from"@gramlot/gramlot";var zn=class{constructor(e,t,n,i,s,o,a){this.grid=e,this.context=t,this.cellFor=n,this.store=i,this.renderedRows=s,this.navigate=o,this.focusField=a,this.retained=new Map,this.declarations=new Map,this.checking=new Set,this.columns=[],this.layer=e.ownerDocument.createElement("div"),this.layer.className="cell-editor",this.layer.hidden=!0;let l=e.ownerDocument.createElement("slot");l.name="cell-editor",this.layer.append(l),e.control.append(this.layer),this.keydown=u=>{if(!(!this.active||u.isComposing)){if(u.key==="Escape"){u.preventDefault();let c=this.cellFor(this.active.row,this.active.column.field);this.session.clearDraft(this.active.source),this.close(),c?.focus({preventScroll:!0})}else if(u.key==="Enter"||u.key==="Tab"){if(u.key==="Enter"&&this.active.element.control.localName==="textarea"&&!u.ctrlKey&&!u.metaKey)return;u.preventDefault();let c=this.active;this.session.commitField(c.path);let d=this.cellFor(c.row,c.column.field);this.close(),d?.focus({preventScroll:!0}),u.key==="Tab"&&this.navigate(c.row,c.column.field,u.shiftKey?-1:1)}}},this.arrowKeydown=u=>{if(!this.active||u.isComposing||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(u.key)||u.altKey||u.ctrlKey||u.metaKey||u.shiftKey)return;let c=this.active.element.control;if(c.localName==="textarea"||["range","date","time","datetime-local"].includes(c.type)||["gramlot-date-text-box","gramlot-time-text-box","gramlot-date-calendar"].includes(this.active.element.localName)||c.getAttribute("aria-expanded")==="true"||u.key==="ArrowDown"&&c.getAttribute("role")==="combobox")return;let d=u.key==="ArrowLeft"||u.key==="ArrowRight",f=u.key==="ArrowLeft"||u.key==="ArrowUp";if(d&&(typeof c.selectionStart!="number"||c.selectionStart!==c.selectionEnd||c.selectionStart!==(f?0:c.value.length)))return;u.preventDefault(),u.stopPropagation();let h=this.active;if(this.session.commitField(h.path),this.navigate(h.row,h.column.field,d?f?-1:1:{row:f?-1:1}),d&&this.active&&this.active!==h){let p=this.active.element.control;if(typeof p.selectionStart=="number"){let m=f?p.value.length:0;p.setSelectionRange(m,m)}}},this.connect(),t.sourceNode.rootBuilder.binding.bindingFor(t.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(e,t){let{mode:n}=this.store();return this.context.sourceNode.absDatapath(this.context.sourceNode.getAttr("storepath"))+"."+e.label+(n==="attributes"?"?":".")+t}configure(e){let t=e.filter(i=>i.edit);if(t.length){if(this.store().window!==null)throw new Error("Editing requires a fully resident Bag; remote windows are read-only.");let i=this.context.sourceNode;this.session=i.editCollection(i.absDatapath(i.getAttr("storepath")))}let n=ch(t.map(({field:i,dtype:s,edit:o})=>({field:i,dtype:s,edit:o})));if(n!==this.validationSignature){this.validationSignature=n,this.columns=t;for(let[i,s]of this.declarations){let o=t.find(a=>a.field===s.field);if(!o)this.active?.path===i&&this.close(),this.releaseField(i);else{let{tag:a,options:l}=this.definition(o);a!==s.tag?(this.active?.path===i&&this.close(),this.releaseField(i)):(s.source.setAttr({...Object.fromEntries(Object.keys(s.options).map(u=>[u,null])),...l}),s.options=l)}}if(!t.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(e){let t=e.edit===!0?{}:{...e.edit},n=t.tag??{L:"numberTextBox",R:"numberTextBox",N:"numberTextBox",D:"dateTextBox",H:"timeTextBox",B:"checkBox"}[e.dtype]??"textbox";if(e.dtype==="DHZ"&&!t.tag)throw new Error("A datetime column requires an explicitly declared supported editor.");return delete t.tag,{tag:n,options:{...t,dtype:e.dtype??"T"}}}*validationFields(){let e=this.context.sourceNode;this.session.trackValidationDependency(e.absDatapath(e.getAttr("structpath")));let t=this.store().bag;for(let n of t.getNodes())for(let i of this.columns){if(n.parentBag!==t)continue;let s=this.path(n,i.field);this.checking.add(s);try{yield{node:this.declare(n,i,!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(e,t,n){if(this.store().window!==null)throw new Error("Editing requires a fully resident Bag; remote windows are read-only.");if(this.active?.row===e&&this.active.column.field===t.field){this.active.element.control.focus();return}this.close();let i=this.path(e,t.field),s=this.declare(e,t,!0),o=this.grid.ownerDocument.getElementById(s.id);this.active={row:e,column:t,path:i,...s,element:o},this.layer.hidden=!1,this.position(n),o.control.focus()}declare(e,t,n){let i=this.context.sourceNode,s=this.path(e,t.field);this.retained.has(s)||(this.session.retainField(s),this.retained.set(s,e));let o=this.declarations.get(s);if(o)n&&i.rootBuilder.binding.renderer.mountView(o.container);else{let{tag:a,options:l}=this.definition(t);if(!i.rootBuilder.schemaTag(a))throw new Error(`Grid editor requires the ${a} input collection.`);let u=i.rootBuilder,c=`grid-cell-${crypto.randomUUID()}`,d=u.wrapSource(i).div({node_label:c,slot:"cell-editor"});n||u.binding.renderer.unmountView(jn(d));try{let f=d[a]({...l,value:"^"+s,id:c,width:"100%",margin:"0"});o={container:jn(d),source:jn(f),id:c,tag:a,options:l,field:t.field};let h=this.grid.ownerDocument.defaultView.customElements.get(o.source._getMeta("render_tag"));this.session.registerField(o.source,h,n),this.declarations.set(s,o)}catch(f){let h=jn(d);throw h.parentBag.popNode(h.label),this.releaseCleanField(s),f}}return o}close(){let e=this.active;this.active=null,this.layer.hidden=!0,e&&(this.context.sourceNode.rootBuilder.binding.renderer.unmountView(e.container),this.releaseCleanField(e.path))}releaseCleanField(e){if(this.checking.has(e))return;let t=this.session.fieldStatus(e);t.error===null&&t.pending===null&&t.draft===null&&this.retained.has(e)&&this.releaseField(e)}releaseField(e){let t=this.declarations.get(e);this.declarations.delete(e),t?.container.parentBag&&t.container.parentBag.popNode(t.container.label),this.session.releaseField(e),this.retained.delete(e)}position(e=null){if(!this.active)return;if(e??=this.cellFor(this.active.row,this.active.column.field),!e){this.close();return}let t=e.getBoundingClientRect(),n=this.grid.control.getBoundingClientRect(),i=this.grid.shadowRoot.querySelector(".body-viewport").getBoundingClientRect();Object.assign(this.layer.style,{left:`${t.left-n.left-this.grid.control.clientLeft}px`,top:`${t.top-n.top-this.grid.control.clientTop}px`,width:`${t.width}px`}),this.layer.style.setProperty("--grid-editor-height",`${t.height}px`);let s=e.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();i.height&&(o.top<i.top||o.bottom>i.bottom||o.right<=i.left||o.left>=i.right)&&this.close()}decorate(e,t){if(this.session)for(let n of e.querySelectorAll("td[data-field]")){let i=this.session.fieldStatus(this.path(t,n.dataset.field));n.classList.toggle("invalid-cell",!!i.error),n.classList.toggle("draft-cell",i.draft!==null),i.error?(n.setAttribute("aria-invalid","true"),n.title=i.error.getNodes().map(s=>s.value).join(`
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;#a=[];#o=[];#l=!1;#s=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.#s)}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.#a.length)&&(this.disconnect(),this.#t=e.formulas,this.#i=new Set(e.fields),this.#n=n,this.#r=t,this.#s.clear(),!!this.formulas.definitions.size)){this.#a=[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.#o.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.#a)e();for(let e of this.#o)e.close();this.#a=[],this.#o=[],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.#l)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.#l||!e.size||this.#n===null)return;this.#l=!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.#s.set(s,l):this.#s.delete(s)}}finally{this.#l=!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.#s.set(i,a):this.#s.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;#a;#o;#l=[];#s=!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.#a=i.createElement("table"),this.#a.setAttribute("role","presentation");let s=i.createElement("tfoot");s.setAttribute("role","rowgroup"),this.#o=i.createElement("tr"),this.#o.setAttribute("role","row"),s.append(this.#o),this.#a.append(s),this.#r.append(this.#a),this.#n.append(this.#r)}get source(){return this.#e}get frame(){return this.#n}get table(){return this.#a}get viewport(){return this.#r}get errors(){return new Map(this.#c)}cell(e){return this.#o.querySelector(`td[data-field="${e}"]`)}configure(e,t,n){this.#s=e,this.#l=t,e===!1?this.#n.remove():this.#i.after(this.#n);let i=this.#o.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.#o.replaceChildren(...s)}update(e,t){for(let[n,i]of this.#l.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.#s===!0?"Total":this.#s);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.#l.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
27
+ `)+`\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.#a(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.#a(s,s.has(e)?e:this.nodes.find(o=>s.has(o))??null,e)}else this.#a(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.#a(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.#a(t,e.has(this.#n)?this.#n:null,e.has(this.#r)?this.#r:null)}paths(){let e=Object.keys(this.source.getAttr()).filter(t=>_l.includes(t)||t.startsWith("selected_"));return[this.source.absDatapath(".selectionLength"),...e.map(t=>this.source.absDatapath(this.source.getAttr(t)))]}#a(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.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;#a;#o=!1;#l=null;#s=null;constructor(e,t,n,i,s,o){this.#e=e,this.#t=t,this.#i=n,this.#n=i,this.#r=s,this.#a=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.#o){this.#o=!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.#l){e.preventDefault();return}this.#o=!0,this.#s={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.#s||!t)return null;let n=this.#i().columnNode(t.dataset.field);return this.#i().columnNode(this.#s.field)!==this.#s.node||n===this.#s.node||n.parentBag!==this.#s.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.#s.field;this.#b(),this.#i().moveColumn(n,t.field,t.after),this.#e.querySelector(`th[data-field="${n}"]`).focus({preventScroll:!0})};#b=()=>{this.#s=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.#a()}}}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.#o=!1;let t=e.target.closest(".column-resize");if(!t||e.button!==0||this.#l)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.#l={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.#l;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.#l;if(!t||t.pointerId!==e.pointerId)return;this.#k(e);let n=this.#f(t.header);this.#o=!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.#l){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.#l&&this.cancel()};cancel(){this.#b();let e=this.#l;if(e){this.#l=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.#l=!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;#a=[];#o=[0];#l=!0;#s=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.#l=!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.#a=e,this.#l=!0}resetMeasurements(){this.#r.clear(),this.#l=!0}forget(e){this.#r.delete(e),this.#l=!0}measure(e,t){return t<=0||this.#r.get(e)===t?!1:(this.#r.set(e,t),this.#l=!0,!0)}#c(){if(!this.#l)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.#s=e),this.#o=[0];for(let t of this.#a)this.#o.push(this.#o.at(-1)+(this.#r.get(t)??Math.max(this.#n.get(t)??0,this.#s)));this.#l=!1}offset(e){if(this.#c(),!this.#t)return this.#o[e];let t=e-this.#t.start;return t<=0?e*this.#s:t<=this.#a.length?this.#t.start*this.#s+this.#o[t]:e*this.#s+this.#o.at(-1)-this.#a.length*this.#s}get count(){return this.#t?.total??this.#a.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.#s*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;#a=null;#o;#l;#s;constructor(e,t,n,i,s,o,a){this.#e=e,this.#t=t,this.#i=n,this.#n=i,this.#o=s,this.#l=o,this.#s=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.#l()||!n||this.#r||e.target.closest(".row-height-handle")){e.preventDefault();return}this.#a={node:n,bag:this.#o().bag},e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",n.label),t.classList.add("row-dragging")};#x(e){if(!this.#a||!this.#l())return null;let{node:t,bag:n}=this.#a,i=e.target.closest("tr"),s=this.#n(i);if(!s||s===t||this.#o().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.#a;this.cancelDrag(),this.#o().moveRow(n,t.target,t.after)};#f=()=>{this.cancelDrag()};cancelDrag(){this.#a=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.#s()}#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.#a)){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=`
26
29
  .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}
27
30
  th:has(.column-filter){padding-inline-end:28px}
28
31
  .column-filter svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.5}
@@ -75,7 +78,16 @@ th:has(.column-filter){padding-inline-end:28px}
75
78
  background: var(--gramlot-grid-header-background, var(--gramlot-surface-subtle, ButtonFace));
76
79
  border-block-end: 1px solid var(--gramlot-grid-border-color, var(--gramlot-border, ButtonBorder));
77
80
  }
78
- .header-viewport { overflow: hidden; min-inline-size: 0; }
81
+ .header-viewport, .footer-viewport { overflow: hidden; min-inline-size: 0; }
82
+ .footer-frame {
83
+ flex: none;
84
+ min-inline-size: 0;
85
+ padding-inline-end: var(--grid-scrollbar-width, 0px);
86
+ background: var(--gramlot-grid-header-background, var(--gramlot-surface-subtle, ButtonFace));
87
+ border-block-start: 1px solid var(--gramlot-grid-border-color, var(--gramlot-border, ButtonBorder));
88
+ font-weight: var(--gramlot-grid-header-weight, 600);
89
+ }
90
+ .footer-frame td[aria-invalid=true] { color: var(--gramlot-error, #b3261e); }
79
91
  .body-frame {
80
92
  flex: 1 1 auto;
81
93
  min-block-size: 0;
@@ -195,6 +207,7 @@ th:has(.column-filter){padding-inline-end:28px}
195
207
  .cell-scroll:focus-visible { outline: 1px solid var(--gramlot-focus-ring, Highlight); outline-offset: -1px; }
196
208
  tbody tr { background: var(--gramlot-grid-background, var(--gramlot-surface, Canvas)); }
197
209
  tbody tr.alternate { background: var(--gramlot-grid-row-alt-background, var(--gramlot-surface-subtle, Canvas)); }
210
+ tbody tr[aria-selected=true] { background: var(--gramlot-grid-selected-background, var(--gramlot-selected, Highlight)); }
198
211
  tbody tr:hover { background: var(--gramlot-grid-row-hover-background, var(--gramlot-selected, Highlight)); }
199
212
  th[data-field] { padding-inline-end: 14px; cursor: grab; user-select: none; }
200
213
  th[data-field]:hover { background-color: color-mix(in srgb, var(--gramlot-grid-header-background) 92%, var(--gramlot-grid-header-color)); }
@@ -250,8 +263,11 @@ th:has(.column-filter){padding-inline-end:28px}
250
263
  tbody tr[data-row-drop=before] > * { box-shadow: inset 0 2px var(--gramlot-focus-ring, Highlight); }
251
264
  tbody tr[data-row-drop=after] > * { box-shadow: inset 0 -2px var(--gramlot-focus-ring, Highlight); }
252
265
  .numeric { font-variant-numeric: tabular-nums; }
266
+ tbody .filtered-numbering {
267
+ background: var(--gramlot-grid-filtered-numbering-background, var(--gramlot-warning-background, Mark));
268
+ }
253
269
  .empty { text-align: center; color: var(--gramlot-text-secondary, GrayText); }
254
- `;var us=class{#e=new Set;view=null;#s;columns=[];update(e,r){if(!(this.view===e&&this.#s===e.bag&&this.columns===r)){this.view=e,this.#s=e.bag,this.columns=r;for(let n of this.#e)n()}}detach(e){if(this.view===e){this.view=null,this.#s=null,this.columns=[];for(let r of this.#e)r()}}subscribe(e){return this.#e.add(e),()=>this.#e.delete(e)}};function $r(t){return Object.hasOwn(t,"gridSearch")||Object.defineProperty(t,"gridSearch",{value:new us,configurable:!0}),t.gridSearch}function rl(t,e){if(t===!0||typeof t=="string"&&t.startsWith("*")){let r=t===!0?e:e.filter(n=>t.slice(1).includes(n.dtype??"T"));return r.length?[...r.length>1?[{field:r.map(n=>n.field).join("+"),name:"All columns"}]:[],...r.map(n=>({field:n.field,name:n.name}))]:[]}if(typeof t!="string"||!t.trim())throw new TypeError("searchOn requires true or a column list");return t.split(",").map(r=>{let n=r.trim().split(":"),i=n.at(-1),s=n.length===2?n[0]:e.find(a=>a.field===i)?.name;if(n.length>2||!i||i.split("+").some(a=>!e.some(o=>o.field===a)))throw new TypeError(`Unknown searchOn column: ${r}`);return{field:i,name:s??i}})}function cs(t,e=","){if(typeof e!="string"||!e)throw new TypeError("separator must be a nonempty string");if(t==="")return[];let r=new Set;return t.split(e).map(n=>{let i=n.indexOf(":"),s=i<0?n:n.slice(0,i),a=i<0?n:n.slice(i+1);if(!s||r.has(s))throw new Error("Invalid or duplicate choice code");return r.add(s),{id:s,caption:a}})}function ds(t,e,r=""){return t.find(n=>n.id===e)?.caption??r??""}var nl=["TL","TC","TR","L","R","BL","BC","BR"];function Hn(t){return class extends t{setLabelbox(e){let{box:r,labelBox:n,fieldLabel:i}=e;Object.assign(this,{box:r,labelBox:n,fieldLabel:i}),i.addEventListener("click",()=>{this.control.focus(),this.control.localName==="input"&&["checkbox","radio"].includes(this.control.type)&&this.control.click()})}projectAttributes(e,r){let n=super.projectAttributes(e,r),{lbl:i,lbl_value:s,lbl_values:a}=this.parameters,o=a==null?i??"":ds(cs(a),s,i);return o?this.control.setAttribute("aria-label",o):this.control.removeAttribute("aria-label"),n}}}Hn.labelbox=!0;Hn.parameters={lbl:{dtype:"T",qualification:"intl_str",nullable:!0,binding:"read"},lbl_value:{dtype:"T",nullable:!0,binding:"twoWay"},lbl_values:{dtype:"T",nullable:!0,binding:"read"},lbl_position:{dtype:"T",default:"TL",binding:"read",enum:nl}};var il=".gramlot-search-labelbox{inline-size:var(--gramlot-search-width,240px);max-inline-size:100%;font-size:var(--gramlot-search-font-size,12px)}",sl=`
270
+ `;var ys=class{#e=new Set;view=null;#t;columns=[];update(e,t){if(!(this.view===e&&this.#t===e.bag&&this.columns===t)){this.view=e,this.#t=e.bag,this.columns=t;for(let n of this.#e)n()}}detach(e){if(this.view===e){this.view=null,this.#t=null,this.columns=[];for(let t of this.#e)t()}}subscribe(e){return this.#e.add(e),()=>this.#e.delete(e)}};function zr(r){return Object.hasOwn(r,"gridSearch")||Object.defineProperty(r,"gridSearch",{value:new ys,configurable:!0}),r.gridSearch}function vl(r,e){if(r===!0||typeof r=="string"&&r.startsWith("*")){let t=r===!0?e:e.filter(n=>r.slice(1).includes(n.dtype??"T"));return t.length?[...t.length>1?[{field:t.map(n=>n.field).join("+"),name:"All columns"}]:[],...t.map(n=>({field:n.field,name:n.name}))]:[]}if(typeof r!="string"||!r.trim())throw new TypeError("searchOn requires true or a column list");return r.split(",").map(t=>{let n=t.trim().split(":"),i=n.at(-1),s=n.length===2?n[0]:e.find(o=>o.field===i)?.name;if(n.length>2||!i||i.split("+").some(o=>!e.some(a=>a.field===o)))throw new TypeError(`Unknown searchOn column: ${t}`);return{field:i,name:s??i}})}function vs(r,e=","){if(typeof e!="string"||!e)throw new TypeError("separator must be a nonempty string");if(r==="")return[];let t=new Set;return r.split(e).map(n=>{let i=n.indexOf(":"),s=i<0?n:n.slice(0,i),o=i<0?n:n.slice(i+1);if(!s||t.has(s))throw new Error("Invalid or duplicate choice code");return t.add(s),{id:s,caption:o}})}function ks(r,e,t=""){return r.find(n=>n.id===e)?.caption??t??""}var kl=["TL","TC","TR","L","R","BL","BC","BR"];function ni(r){return class extends r{setLabelbox(e){let{box:t,labelBox:n,fieldLabel:i}=e;Object.assign(this,{box:t,labelBox:n,fieldLabel:i}),i.addEventListener("click",()=>{this.control.focus(),this.control.localName==="input"&&["checkbox","radio"].includes(this.control.type)&&this.control.click()})}projectAttributes(e,t){let n=super.projectAttributes(e,t),{lbl:i,lbl_value:s,lbl_values:o}=this.parameters,a=o==null?i??"":ks(vs(o),s,i);return a?this.control.setAttribute("aria-label",a):this.control.removeAttribute("aria-label"),n}}}ni.labelbox=!0;ni.parameters={lbl:{dtype:"T",qualification:"intl_str",nullable:!0,binding:"read"},lbl_value:{dtype:"T",nullable:!0,binding:"twoWay"},lbl_values:{dtype:"T",nullable:!0,binding:"read"},lbl_position:{dtype:"T",default:"TL",binding:"read",enum:kl}};var El=".gramlot-search-labelbox{inline-size:var(--gramlot-search-width,240px);max-inline-size:100%;font-size:var(--gramlot-search-font-size,12px)}",xl=`
255
271
  :host{display:inline-block;inline-size:100%;font-size:var(--gramlot-search-font-size,12px);max-inline-size:100%;min-inline-size:0}
256
272
  .control-box{display:flex;align-items:stretch;position:relative;min-block-size:max(var(--gramlot-search-height,26px),var(--gramlot-touch-target,0px));
257
273
  border:1px solid var(--gramlot-border,GrayText);border-radius:999px;
@@ -289,4 +305,4 @@ svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.7;stroke
289
305
  box-shadow:var(--gramlot-shadow,0 3px 12px #0002);font:inherit;font-size:inherit;line-height:1.5}
290
306
  .search-help p{margin:.6rem 0 0}.search-help p:last-child{color:var(--gramlot-text-secondary,GrayText)}
291
307
  @media(prefers-reduced-motion:reduce){.control-box{transition:none}}
292
- `;var al=(0,_e.defineComponent)({name:"searchBox",tag:"gramlot-search-box",base:Fr,sourceContext:!0,mixins:[Hn],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:t=>class extends t{#e;#s;#o;#l;#u;#d=null;#a;#r;#t;#_;#v;#k;#f;constructor(){super();let e=this.ownerDocument,r=e.createElement("style");r.textContent=sl;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.#a=e.createElement("input"),this.#a.type="text",this.#a.setAttribute("role","searchbox"),this.#a.setAttribute("aria-label","Filter rows"),this.#a.setAttribute("aria-describedby","search-error"),this.#a.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.#r=e.createElement("span"),this.#r.id="search-error",this.#r.className="error",this.#r.setAttribute("role","alert");let s=e.createElement("span");s.className="search-entry";let a=n("M21 21L16 16M18 10A8 8 0 1 1 2 10A8 8 0 0 1 18 10");a.classList.add("search-lens"),i.className="clear";let o=this.#t=e.createElement("button");o.type="button",o.className="info",o.hidden=!0,o.setAttribute("aria-label","Search instructions"),o.title="Search instructions",o.setAttribute("aria-haspopup","dialog"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls","search-help"),o.append(n("M21 12A9 9 0 1 1 3 12A9 9 0 0 1 21 12M12 11V17M12 7V7.1"));let u=this.#_=e.createElement("div");u.id="search-help",u.className="search-help",u.setAttribute("popover","auto"),u.setAttribute("role","dialog"),u.setAttribute("aria-label","Search instructions");let l=e.createElement("strong");l.textContent="Search instructions",this.#v=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.",u.append(l,this.#v,c),this.shadowRoot.append(u),o.addEventListener("click",()=>{u.matches(":popover-open")?u.hidePopover():(u.showPopover(),Ur(u,o,{align:"end"}))}),u.addEventListener("toggle",()=>o.setAttribute("aria-expanded",String(u.matches(":popover-open")))),s.append(a,this.#a,i,o),this.control.replaceChildren(s,this.#r),this.shadowRoot.append(r),this.#a.addEventListener("input",()=>{this.#n(),this.#d=e.defaultView.setTimeout(()=>{this.#d=null,this.#E()},100)}),this.#a.addEventListener("keydown",d=>{d.isComposing||(d.key==="Enter"&&(d.preventDefault(),this.#n(),this.#E()),d.key==="Escape"&&(d.preventDefault(),this.#h()))}),i.addEventListener("click",()=>{this.#h(),this.#a.focus()})}setLabelbox(e){super.setLabelbox(e),e.box.classList.add("gramlot-search-labelbox");let r=this.ownerDocument.createElement("style");r.textContent=il,e.box.prepend(r)}focus(e){this.#a.focus(e)}clear(){this.#h()}setSourceContext(e){this.#e=e;let r=e.frameRecipient();if(r?.nodeTag!=="grid")throw new TypeError("searchBox requires a FrameGrid target");this.#s=$r(r)}projectAttributes(e,r){let n=this.parameters?.lbl_value,i=super.projectAttributes(e,r),s=!this.#t.hidden;return this.#t.hidden=!this.parameters.searchHelp,s&&this.#t.hidden&&this.#_.matches(":popover-open")&&this.#_.hidePopover(),this.isConnected&&(this.#p(),n!=null&&n!==this.parameters.lbl_value&&this.#u?.filter?.columns.join("+")!==this.parameters.lbl_value&&this.#h()),i}connectedCallback(){this.#o=this.#s.subscribe(()=>this.#p()),this.#p()}disconnectedCallback(){this.#n(),this.#o?.(),this.#l?.(),this.#o=this.#l=null}#n(){this.#d!==null&&this.ownerDocument.defaultView.clearTimeout(this.#d),this.#d=null}#p(){try{this.#y()}catch(e){this.#a.disabled=!0,this.#r.textContent=e.message}}#y(){if(!this.#s.view)return;(this.#u!==this.#s.view||this.#f!==this.#s.view.bag||!this.#l)&&(this.#n(),this.#l?.(),this.#u=this.#s.view,this.#f=this.#u.bag,this.#k=void 0,this.#l=this.#u.subscribe(()=>this.#b()));let e=rl(this.parameters.searchOn,this.#s.columns),r=this.#e.sourceNode,n=e.map(({field:s,name:a})=>`${s}:${a}`).join(","),i=e.some(s=>s.field===this.parameters.lbl_value)?this.parameters.lbl_value:e[0]?.field??"";r.getAttr("lbl_values")!==n&&r.setAttr({lbl_values:n}),this.parameters.lbl_value!==i&&this.box.labelbox.choose(i),this.#a.disabled=!e.length,this.#b(),this.#i()}#b(){let e=this.#u.filter,r=JSON.stringify(e);this.#k!==r&&(this.#k=r,this.#n(),this.#a.value=e?.value??"",e&&this.parameters.lbl_value!==e.columns.join("+")&&this.box.labelbox.choose(e.columns.join("+")),this.#r.textContent="",this.#a.removeAttribute("aria-invalid"),this.#i())}#g(){let e=this.#s.columns.find(r=>r.field===this.parameters.lbl_value);return["L","R","N","D"].includes(e?.dtype)?e.dtype:"T"}#i(){let e=this.#g();this.#v.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."}#h(){this.#n(),this.#a.value="",this.#E(),this.#i()}#E(){if(this.#u)try{let e=this.#a.value,r=performance.now();this.#u.applyFilter(e.trim()?{value:e,columns:this.parameters.lbl_value.split("+"),dtype:this.#g(),...this.parameters.searchLiteral?{literal:!0}:{},locale:this.#e.locale,timeZone:this.#e.timeZone}:null),this.#e.writeParameter("searchTime",performance.now()-r),this.#r.textContent="",this.#a.removeAttribute("aria-invalid")}catch(e){this.#r.textContent=e.message,this.#a.setAttribute("aria-invalid","true")}}}});var ol={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}],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0}},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 ih=(0,_e.defineComponent)({name:"grid",tag:"gramlot-grid",base:Fr,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"},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:t=>class extends t{#e;#s;#o;#l;#u=e=>{if(e.type==="keydown"&&!["Enter","F2"].includes(e.key))return;let r=e.target.closest("td[data-field]");if(!r||!this.#t)return;let n=[...this.#f].find(([,s])=>s===r.parentElement)?.[0],i=this.#t.columns.find(s=>s.field===r.dataset.field);if(n&&i.edit){e.preventDefault();try{this.#l.open(n,i,r)}catch(s){this.#r.reportError(s,"Grid editor")}}};#d;#a;#r;#t;#_;#v=!0;#k;#f=new Map;#n;#p;#y;#b;#g;#i;#h;#E;#A=null;#x=1;#w=!1;#O;#D;#c;#m;#V;#H;#B;#I=null;#M=!1;#R=new Set;#L=[];#q=-1;#P=-1;#F;#$;#W;#S=!1;#U=null;#G=e=>{e.target!==this.#i||!["Home","End"].includes(e.key)||!this.#t||(e.preventDefault(),this.#S=e.key==="End",this.#N(this.#S?Math.max(0,this.#c.totalHeight-this.#i.clientHeight):0),this.#C())};#Y=()=>{let e=this.#i;e.scrollTop!==this.#U&&(this.#S=e.scrollTop>0&&e.scrollHeight-e.clientHeight-e.scrollTop<=1),this.#U=null,this.#g.scrollLeft=this.#i.scrollLeft,this.#C()};constructor(){super();let e=this.ownerDocument,r=e.createElement("style");r.textContent=tl,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.#g=e.createElement("div"),this.#g.className="header-viewport",this.#g.setAttribute("part","header-viewport"),this.#i=e.createElement("div"),this.#i.className="body-viewport",this.#i.setAttribute("part","body-viewport"),this.#i.tabIndex=0,this.#i.setAttribute("role","rowgroup"),this.#y=e.createElement("table"),this.#b=e.createElement("table");for(let u of[this.#y,this.#b])u.setAttribute("role","presentation");this.#n=e.createElement("thead"),this.#n.setAttribute("role","rowgroup"),this.#p=e.createElement("tbody"),this.#p.setAttribute("role","presentation"),this.#y.append(this.#n),this.#b.append(this.#p),this.#g.append(this.#y),n.append(this.#g),this.#F=e.createElement("div"),this.#$=e.createElement("div");for(let u of[this.#F,this.#$])u.className="row-space",u.setAttribute("aria-hidden","true");this.#i.append(this.#F,this.#b,this.#$);let i=e.createElement("div");i.className="body-frame",this.#h=e.createElement("div"),this.#h.className="loading-status",this.#h.setAttribute("role","status"),this.#h.setAttribute("aria-label","Loading\u2026"),this.#h.hidden=!0;let s=e.createElementNS(xe,"svg");s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("aria-hidden","true");let a=e.createElementNS(xe,"circle");a.setAttribute("cx","12"),a.setAttribute("cy","12"),a.setAttribute("r","9"),a.setAttribute("opacity",".2");let o=e.createElementNS(xe,"path");o.setAttribute("d","M12 3a9 9 0 0 1 9 9"),s.append(a,o),this.#h.append(s),i.append(this.#i,this.#h),this.control.replaceChildren(n,i),this.shadowRoot.append(r),this.#o=new Rn(this,this.#n),this.#O=new jn(this.#n,this.control,()=>this.#t,(u,l)=>this.#ae(u,l),()=>this.#c,()=>this.#C()),this.#D=new Vn(this.#p,this.control,()=>this.#c,u=>{for(let[l,c]of this.#f)if(c===u)return l;return null},()=>this.#m,()=>this.parameters.selfDragRows,()=>this.#C()),this.#E=new e.defaultView.ResizeObserver(()=>this.#C())}connectedCallback(){this.#p.addEventListener("dblclick",this.#u),this.#p.addEventListener("keydown",this.#u),this.#l?.connect(),this.#s?.connect(),this.#o.connect(),this.#Q(),this.#m&&this.#z({full:!0,rows:[]}),this.#O.connect(),this.#D.connect(),this.#i.addEventListener("scroll",this.#Y,{passive:!0}),this.#i.addEventListener("keydown",this.#G),this.#E.observe(this.#i),this.#E.observe(this.#b),this.#C()}disconnectedCallback(){this.#p.removeEventListener("dblclick",this.#u),this.#p.removeEventListener("keydown",this.#u),this.#l?.disconnect(),this.#s?.disconnect(),this.#o.disconnect(),this.#ee(),$r(this.#r.sourceNode).detach(this.#m),this.#m?.disconnect(),this.#B?.(),this.#B=null,this.#O.disconnect(),this.#D.disconnect(),this.#i.removeEventListener("scroll",this.#Y),this.#i.removeEventListener("keydown",this.#G),this.#E.disconnect(),this.#A!==null&&this.ownerDocument.defaultView.cancelAnimationFrame(this.#A),this.#A=null}#C(){!this.isConnected||this.#A!==null||(this.#A=this.ownerDocument.defaultView.requestAnimationFrame(()=>{this.#A=null;let r=`${this.#i.offsetWidth-this.#i.clientWidth}px`;this.control.style.getPropertyValue("--grid-scrollbar-width")!==r&&this.control.style.setProperty("--grid-scrollbar-width",r),this.#X();for(let n of this.#n.querySelectorAll("th[scope=col]"))n.querySelector(".column-resize").setAttribute("aria-valuenow",String(Math.round(n.getBoundingClientRect().width)));for(let n of this.#f.values()){let i=n.querySelector(".row-height-handle");i&&i.setAttribute("aria-valuenow",String(Math.round(n.getBoundingClientRect().height)))}if(this.#g.scrollLeft=this.#i.scrollLeft,!!this.#t)try{this.#Z(),this.#l.position()}catch(n){this.#r.reportError(n,"Grid viewport")}}))}#X(){if(!this.#w)return;let e=this.#n.querySelector(".row-number-measure");e.textContent=String(Math.max(1,this.#c.count));let r=Math.ceil(e.getBoundingClientRect().width);this.control.style.setProperty("--grid-row-header-min-width",`${r}px`),this.#c.headerWidth===null?this.control.style.removeProperty("--grid-row-header-width"):this.control.style.setProperty("--grid-row-header-width",`${this.#c.headerWidth}px`),this.#n.querySelector(".row-heading .column-resize").setAttribute("aria-valuemin",String(Math.max(40,r)))}#Z(){let e=this.#i,r=this.#c.indexAt(e.scrollTop),n=e.scrollTop-this.#c.offset(r),i=!1,s=this.#f.values().next().value;if(s){let a=this.ownerDocument.defaultView.getComputedStyle(s.querySelector("td")),o=JSON.stringify([this.#b.getBoundingClientRect().width,a.font,a.lineHeight,a.padding,a.getPropertyValue("--gramlot-grid-row-height")]);o!==this.#W&&(this.#c.resetMeasurements(),this.#W=o,i=!0)}for(let[a,o]of this.#f)i=this.#c.measure(a,o.getBoundingClientRect().height)||i;if(i&&this.#L.length){let a=this.#c.offset(r)+n;this.#K(),this.#N(this.#S?Math.max(0,this.#c.totalHeight-e.clientHeight):a)}this.#D.resizing||this.#j()}#K(){let e=Math.max(0,this.#q),r=Math.max(e,this.#P);this.#F.style.height=`${this.#c.offset(e)}px`,this.#$.style.height=`${Math.max(0,this.#c.totalHeight-this.#c.offset(r))}px`}#N(e){this.#i.scrollTop!==e&&(this.#i.scrollTop=e,this.#U=this.#i.scrollTop)}#j(e=!1){let r=this.#i,n=Math.max(0,this.#c.totalHeight-r.clientHeight),i=this.#S?n:Math.min(r.scrollTop,n),{start:s,end:a}=this.#c.window(i,r.clientHeight),o=this.#T();if(o){let l=o.start+this.#L.length;if(s<o.start||a>l){let c=Math.max(200,a-s),d=Math.max(0,Math.min(Math.max(0,o.total-c),s)),f=JSON.stringify([o.revision,d,c]);f!==this.#a&&(this.#a=f,this.#r.writeParameter("viewport",{start:d,count:c}))}else this.#a=null;s=Math.max(s,o.start),a=Math.max(s,Math.min(a,l))}o||(this.#a=null);let u=this.parameters.loading||this.#a!==null;if(this.#h.hidden=!u,u?this.control.setAttribute("aria-busy","true"):this.control.removeAttribute("aria-busy"),e||s!==this.#q||a!==this.#P){let l=new Ar(this.#m,this.#r.format).read(this.#t.columns,this.#L.slice(s-(o?.start??0),a-(o?.start??0)));this.#ue(l,this.#t.columns,s),this.#q=s,this.#P=a,this.#C()}this.#K(),this.#N(i)}#T(){let e=this.parameters.windowInfo;if(e===null)return null;if(!(e instanceof ll))throw new TypeError("Grid windowInfo requires a Bag");return Object.fromEntries(["start","total","revision","sortedBy"].map(r=>[r,e.getItem(r)]))}#re(e,r,n){let i=this.#m.getRows(),s=this.#t.columns.filter(o=>o.edit),a=i.indexOf(e)*s.length+s.findIndex(o=>o.field===r)+(typeof n=="object"?n.row*s.length:n);a<0||a>=i.length*s.length||this.#J(Math.floor(a/s.length),s[a%s.length])}#J(e,r){let n=this.#m.getRows()[e];this.#S=!1;let i=this.#c.offset(e),s=this.#c.offset(e+1);i<this.#i.scrollTop?this.#N(i):s>this.#i.scrollTop+this.#i.clientHeight&&this.#N(Math.max(0,s-this.#i.clientHeight)),this.#j(!0),this.#Z();let a=this.#f.get(n).querySelector(`td[data-field="${r.field}"]`),o=a.getBoundingClientRect(),u=this.#i.getBoundingClientRect();o.top<u.top?this.#N(Math.floor(this.#i.scrollTop+o.top-u.top)):o.bottom>u.bottom&&this.#N(Math.ceil(this.#i.scrollTop+Math.min(o.top-u.top,o.bottom-u.bottom))),o.left<u.left?this.#i.scrollLeft+=o.left-u.left:o.right>u.right&&(this.#i.scrollLeft+=Math.min(o.left-u.left,o.right-u.right)),this.#g.scrollLeft=this.#i.scrollLeft,this.#l.open(n,r,a)}#ne(e){let r=this.#r.sourceNode.absDatapath(this.parameters.storepath)+".";if(!e.startsWith(r))return!1;let n=e.slice(r.length),i=this.parameters.rowMode==="attributes"?"?":".",s=n.indexOf(i);if(s<0)return!1;let a=this.#e.getNode(n.slice(0,s)),o=this.#t.columns.find(l=>l.field===n.slice(s+1)&&l.edit),u=this.#m.getRows().indexOf(a);return!o||u<0?!1:(this.#J(u,o),!0)}setSourceContext(e){this.#r=e,this.#o.setSourceContext(e),this.#s=new qn(e.sourceNode,this.#p,()=>this.#t?.columns??[],n=>[...this.#f].find(([,i])=>i===n)?.[0],(n,i)=>this.#m.value(n,i),()=>this.parameters.setFilter,()=>this.#m),this.isConnected&&this.#s.connect(),this.#l=new $n(this,e,(n,i)=>this.#f.get(n)?.querySelector(`td[data-field="${i}"]`),()=>({bag:this.#e,mode:this.parameters.rowMode,window:this.parameters.windowInfo}),()=>this.#f,(n,i,s)=>this.#re(n,i,s),n=>this.#ne(n));let r=e.sourceNode;Object.hasOwn(r,"gridRowLayout")||Object.defineProperty(r,"gridRowLayout",{value:new zn,configurable:!0}),this.#c=r.gridRowLayout}setStoreBag(e){if(!(e instanceof ll))throw new TypeError("grid storepath must resolve to a Bag");e!==this.#e&&this.#l?.replaceData(),this.#e=e,this.#c.bindStore(e)}setStructBag(e){this.#_=e,this.#v=!0}projectAttributes(e,r){let n=super.projectAttributes(e,r);if(this.#T()&&(this.parameters.columnFilters||this.#m?.filterContributions.some(([o])=>o.startsWith("column:"))))throw new TypeError("grid columnFilters requires a complete resident store");if(this.#T()&&this.parameters.setFilter!=="")throw new TypeError("grid setFilter requires a complete resident store");let i=this.#r.collectionView(this.#e,this.parameters.rowMode);this.#m!==i&&(this.#ee(),this.#B?.(),this.#B=null,this.#m=i,this.#Q()),!this.#T()&&this.#V!==this.parameters.sortedBy&&(this.#m.sort(this.parameters.sortedBy),this.#V=this.parameters.sortedBy);let s=this.parameters.filter,a=JSON.stringify(s);return!this.#T()&&this.#H!==a&&(this.#m.applyFilter(s===null?null:{locale:this.#r.locale,timeZone:this.#r.timeZone,...s},"base"),this.#H=a),this.#z({full:!0,rows:[]}),n}#Q(){this.isConnected&&this.#m&&!this.#B&&(this.#m.connect(),this.#B=this.#m.subscribe(e=>this.#z(e)))}#ee(){this.#I!==null&&this.ownerDocument.defaultView.clearTimeout(this.#I),this.#I=null,this.#M=!1,this.#R.clear()}#z({full:e,rows:r}){if(this.#M||=e,this.#M)this.#R.clear();else for(let n of r)this.#R.add(n);!this.isConnected||this.#I!==null||(this.#I=this.ownerDocument.defaultView.setTimeout(()=>{let n=this.#M,i=[...this.#R];this.#I=null,this.#M=!1,this.#R.clear();try{n?this.#se():this.#ie(i)}catch(s){this.#M=!0,this.#r.reportError(s,"Grid refresh")}},0))}#ie(e){for(let n of e)this.#c.forget(n);let r=new Ar(this.#m,this.#r.format).read(this.#t.columns,e.filter(n=>this.#f.has(n)));this.#D.cancel();for(let{node:n,cells:i}of r)this.#te(this.#f.get(n),i,n);this.#C()}#se(){let e=this.#v?new Un(this.#_):this.#t;this.#l.configure(e.columns),this.#t=e,this.#s.configure();let r=this.#m.getRows();this.#D.cancel(),this.#D.cancelDrag(),this.#c.retain(this.#e.getNodes()),this.#v&&this.#c.resetMeasurements();let n=this.#T();this.#c.setWindow(n),this.#c.setRows(r),this.#L=r,n&&this.#d!==n.revision&&(this.#S=!1,this.#N(0),this.#a=null),this.#d=n?.revision,this.#v=!1,$r(this.#r.sourceNode).update(this.#m,e.columns.filter(a=>!a.check));let i=this.parameters.rowHeaders||this.parameters.rowResize,s=JSON.stringify([e.groups,i,this.parameters.columnFilters]);this.#w=i,s!==this.#k&&(this.#le(e),this.#k=s),this.#o.update(this.#m,e.columns,this.parameters.columnFilters,this.#r.format),this.#oe(),this.#j(!0),this.control.setAttribute("aria-colcount",String(e.columns.length+Number(this.#w))),this.control.setAttribute("aria-rowcount",String(this.#x+Math.max(this.#c.count,1))),this.#C()}#ae(e,r){if(!this.#t.columns.find(n=>n.field===e)?.check)try{let n=this.#T()?os(this.#T().sortedBy):this.#m.criteria,i=n.find(u=>u.field===e),s=i?.direction==="a"?"d":"a",a=r?n.filter(u=>u.field!==e):[];r&&i?a.splice(n.indexOf(i),0,{field:e,direction:s}):a.push({field:e,direction:s});let o=a.map(u=>`${u.field}:${u.direction}`).join(",");this.#T()?this.#r.writeParameter("sortRequest",o):this.#m.sort(o)}catch(n){this.#r.reportError(n,"Grid sort")}}#oe(){let e=this.#T()?os(this.#T().sortedBy):this.#m.criteria;this.#X();for(let r of this.#n.querySelectorAll("th[scope=col]")){let n=e.findIndex(i=>i.field===r.dataset.field);if(r.removeAttribute("aria-sort"),n<0)delete r.dataset.sortDirection,delete r.dataset.sortPriority,r.removeAttribute("aria-label");else{let i=e[n].direction==="a"?"ascending":"descending";r.dataset.sortDirection=i,r.dataset.sortPriority=String(n+1),n===0&&r.setAttribute("aria-sort",i),r.setAttribute("aria-label",`${r.textContent}, sort ${n+1}, ${i}`)}}}#le(e){this.#O.cancel();let r=this.shadowRoot.activeElement,n=r?.closest("th[data-field]")?.dataset.field,i=r?.classList.contains("column-resize"),s=this.ownerDocument,a=e.groups.some(f=>f.name!==null);this.#x=a?2:1;let o=s.createElement("tr"),u=s.createElement("tr");for(let[f,h]of[o,u].entries())h.setAttribute("role","row"),h.setAttribute("aria-rowindex",String(f+1));let l=(f,h,p,m,g,_="start")=>{let w=s.createElement("th");if(w.textContent=f,w.colSpan=h,w.rowSpan=p,w.scope=m,w.setAttribute("role","columnheader"),w.setAttribute("part",m==="colgroup"?"group-header":"column-header"),w.setAttribute("aria-colindex",String(g+1+Number(this.#w))),w.setAttribute("aria-colspan",String(h)),w.setAttribute("aria-rowspan",String(p)),w.style.textAlign=_,m==="col"){let y=s.createElement("span");y.className="column-caption",y.textContent=f,w.replaceChildren(y);let k=e.columns[g];w.dataset.field=k.field,w.draggable=!0,w.tabIndex=0,w.setAttribute("aria-label",k.title??k.name),w.title=k.check?(k.title??k.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 S=s.createElementNS(xe,"svg");S.classList.add("sort-indicator"),S.setAttribute("viewBox","0 0 16 16"),S.setAttribute("aria-hidden","true");let R=s.createElementNS(xe,"path");R.setAttribute("d","M4 10L8 6L12 10"),S.append(R),w.append(S),this.parameters.columnFilters&&!k.check&&w.append(this.#o.button(k));let F=s.createElement("span");F.className="column-resize",F.tabIndex=0,F.setAttribute("role","separator"),F.setAttribute("aria-orientation","vertical"),F.setAttribute("aria-valuemin","40"),F.setAttribute("aria-label",`Resize ${k.name}`),F.title="Drag to resize \xB7 Arrow keys adjust width",w.append(F)}return w};if(this.#w){let f=s.createElement("th");f.textContent="#",f.scope="col",f.className="row-heading",f.rowSpan=this.#x,f.setAttribute("role","columnheader"),f.setAttribute("aria-colindex","1"),f.setAttribute("aria-rowspan",String(this.#x)),f.setAttribute("part","row-header");let h=s.createElement("span");h.className="row-number-measure",h.setAttribute("aria-hidden","true");let p=s.createElement("span");p.className="column-resize",p.tabIndex=0,p.setAttribute("role","separator"),p.setAttribute("aria-orientation","vertical"),p.setAttribute("aria-label","Resize row numbers"),p.title="Drag to resize \xB7 Arrow keys adjust width",f.append(h,p),o.append(f)}let c=0;for(let f of e.groups)if(a&&f.name!==null){let h=l(f.name,f.columns.length,1,"colgroup",c,"center");h.style.background=f.background??"",h.style.color=f.color??"",o.append(h);for(let p of f.columns)u.append(l(p.name,1,1,"col",c++,p.align))}else for(let h of f.columns){if(a){let p=s.createElement("td");p.className="group-spacer",p.setAttribute("aria-hidden","true"),o.append(p)}(a?u:o).append(l(h.name,1,1,"col",c++,h.align))}this.#n.replaceChildren(o,...a?[u]:[]),n&&this.#n.querySelector(`th[data-field="${n}"]${i?" .column-resize":""}`)?.focus({preventScroll:!0});let d=e.columns.map(f=>f.width??"var(--gramlot-grid-column-width, 10rem)");this.#w&&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(" + ")})`);for(let f of[this.#y,this.#b]){for(let h of f.querySelectorAll(":scope > colgroup"))h.remove();if(f.prepend(...e.groups.map(h=>{let p=s.createElement("colgroup");for(let m of h.columns){let g=s.createElement("col");g.style.width=m.width??"var(--gramlot-grid-column-width, 10rem)",p.append(g)}return p})),this.#w){let h=s.createElement("colgroup"),p=s.createElement("col");p.style.width="max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))",h.append(p),f.prepend(h)}}}#ue(e,r,n){this.#D.cancel();let i=new Set,s=null;this.#p.querySelector(".empty")?.parentElement.remove();for(let{node:a,cells:o}of e){let u=this.#f.get(a);u||(u=this.ownerDocument.createElement("tr"),u.setAttribute("part","row"),u.setAttribute("role","row"),u.dataset.row=a.label,this.#f.set(a,u)),u.classList.toggle("alternate",(n+i.size)%2===1),u.draggable=this.parameters.selfDragRows;let l=u.querySelector("th[scope=row]");if(this.#w){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 p=this.ownerDocument.createElement("span");p.className="row-number",l.append(p),u.prepend(l)}l.querySelector(".row-number").textContent=String(n+i.size+1);let h=l.querySelector(".row-height-handle");this.parameters.rowResize?(h||(h=this.ownerDocument.createElement("span"),h.className="row-height-handle",h.tabIndex=0,h.setAttribute("role","separator"),h.setAttribute("aria-orientation","horizontal"),h.title="Drag to resize row \xB7 Double-click or Home resets \xB7 Arrow keys adjust height",l.append(h)),h.setAttribute("aria-label",`Resize row ${n+i.size+1}`)):h?.remove()}else l?.remove();let c=Number(this.#w),d=new Map([...u.querySelectorAll("td[data-field]")].map(h=>[h.dataset.field,h]));for(let[h,p]of r.entries()){let m=d.get(p.field);if(!m){m=this.ownerDocument.createElement("td"),m.setAttribute("part","cell"),m.dataset.field=p.field,m.setAttribute("role","cell");let w=this.ownerDocument.createElement("div");w.className="cell-content",w.setAttribute("part","cell-content"),m.append(w)}p.edit?m.tabIndex=0:m.removeAttribute("tabindex");let g=m.firstElementChild,_=p.max_height!=null;_?m.style.setProperty("--grid-cell-max-height",p.max_height):m.style.removeProperty("--grid-cell-max-height"),g.classList.toggle("cell-scroll",_),_?g.tabIndex=0:g.removeAttribute("tabindex"),m.style.textAlign=p.align,m.style.whiteSpace=p.white_space??"",m.style.overflowWrap=p.white_space==="pre-wrap"||p.white_space==="normal"?"anywhere":"",m.setAttribute("aria-colindex",String(h+1+c)),m.classList.toggle("numeric",["L","R","N"].includes(p.dtype)),u.cells[h+c]!==m&&u.insertBefore(m,u.cells[h+c]??null),d.delete(p.field)}for(let h of d.values())h.remove();u.setAttribute("aria-rowindex",String(this.#x+n+i.size+1)),this.#te(u,o,a),this.#l.decorate(u,a);let f=s?s.nextSibling:this.#p.firstChild;f!==u&&this.#p.insertBefore(u,f),this.#D.project(u,a),s=u,i.add(a)}for(let[a,o]of this.#f)i.has(a)||(o.remove(),this.#f.delete(a));if(!e.length&&this.#c.count===0&&!this.parameters.loading){let a=this.ownerDocument.createElement("tr"),o=this.ownerDocument.createElement("td");a.setAttribute("role","row"),a.setAttribute("aria-rowindex",String(this.#x+1)),o.setAttribute("role","cell"),o.setAttribute("aria-colspan",String(r.length+Number(this.#w))),o.className="empty",o.colSpan=r.length+Number(this.#w),o.textContent="No rows",a.append(o),this.#p.append(a)}}#te(e,r,n){let i=Number(this.#w);r.forEach((s,a)=>{let o=e.cells[a+i].firstElementChild,u=this.#t.columns[a];if(o.parentElement.classList.toggle("check-cell",!!u.check),u.check){this.#s.project(o,n,u);return}if(u.edit?.tag==="colorpicker"){let c=o.querySelector(".cell-color-swatch");c||(c=this.ownerDocument.createElement("span"),c.className="cell-color-swatch",c.setAttribute("role","img"),o.replaceChildren(c)),c.hidden=s==="",c.style.backgroundColor=s,c.title=s,c.setAttribute("aria-label",s)}else(o.firstElementChild||o.textContent!==s)&&(o.textContent=s)})}}}),fs=class extends _e.ComponentCollection{toDocument(){let e=super.toDocument(),r=e.elements.grid.attributes.parameters;for(let n of["storepath","rowMode"]){let i=r.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(ol.elements)),e}},X_=new fs({name:"grid",components:[ih,al],dependencies:[nh]});export{ih as Grid,X_ as default};
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;#a=null;#o;#l;#s;#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.#o=e.createElement("input"),this.#o.type="text",this.#o.setAttribute("role","searchbox"),this.#o.setAttribute("aria-label","Filter rows"),this.#o.setAttribute("aria-describedby","search-error"),this.#o.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.#l=e.createElement("span"),this.#l.id="search-error",this.#l.className="error",this.#l.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.#s=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.#o,i,a),this.control.replaceChildren(s,this.#l),this.shadowRoot.append(t),this.#o.addEventListener("input",()=>{this.#d(),this.#a=e.defaultView.setTimeout(()=>{this.#a=null,this.#p()},100)}),this.#o.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.#o.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.#o.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.#s.hidden;return this.#s.hidden=!this.parameters.searchHelp,s&&this.#s.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.#a!==null&&this.ownerDocument.defaultView.clearTimeout(this.#a),this.#a=null}#b(){try{this.#f()}catch(e){this.#o.disabled=!0,this.#l.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.#o.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.#o.value=e?.value??"",e&&this.parameters.lbl_value!==e.columns.join("+")&&this.box.labelbox.choose(e.columns.join("+")),this.#l.textContent="",this.#o.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.#o.value="",this.#p(),this.#k()}#p(){if(this.#r)try{let e=this.#o.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.#l.textContent="",this.#o.removeAttribute("aria-invalid")}catch(e){this.#l.textContent=e.message,this.#o.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;#a;#o;#l=null;#s=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.#a&&(this.#a.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.#o?.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.#o.disconnect(),this.#s?.(),this.#s=null,this.#l=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.#a.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.#a.errors}setSourceContext(e){this.#f=e,this.#r=new Xn(e.sourceNode),this.#a=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.#o=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.#o.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.#a.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.#o.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.#a.configure(this.parameters.footer,e.columns,o),this.#xe(e),this.#_=a),this.#a.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.#l){e&&t?.updateChanges();return}this.#s?.(),this.#l=t,this.#s=t===null?null:t.registerDerived(n=>this.#_e(n))}#_e(e){let t=this.#l.path,n=a=>a===t?"":a.startsWith(t+".")?a.slice(t.length+1):null;if(this.#a.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.#a.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};