@gramlot/gramlot 0.3.0 → 0.3.2

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.
@@ -6,22 +6,22 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- var kc=Object.create;var xs=Object.defineProperty;var Ec=Object.getOwnPropertyDescriptor;var Ac=Object.getOwnPropertyNames;var xc=Object.getPrototypeOf,Tc=Object.prototype.hasOwnProperty;var _t=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Dc=(r,e)=>{for(var t in e)xs(r,t,{get:e[t],enumerable:!0})},Cc=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ac(e))!Tc.call(r,i)&&i!==t&&xs(r,i,{get:()=>e[i],enumerable:!(n=Ec(e,i))||n.enumerable});return r};var no=(r,e,t)=>(t=r!=null?kc(xc(r)):{},Cc(e||!r||!r.__esModule?xs(t,"default",{value:r,enumerable:!0}):t,r));var qt=_t(_e=>{"use strict";function Jd(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(Ut(r,n)){var i=r[n];if(e.call(void 0,i,n,r))return i}}function gr(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 Ut(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Kd(r,e){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var t in e)Ut(e,t)&&(r[t]=e[t]);return r}var Po=gr({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 Qd(r){return Ut(Po,r.toLowerCase())}var jo=gr({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 ef(r){return Ut(jo,r.toLowerCase())}var rn=gr({script:!1,style:!1,textarea:!0,title:!0});function tf(r){var e=r.toLowerCase();return Ut(rn,e)&&!rn[e]}function rf(r){var e=r.toLowerCase();return Ut(rn,e)&&rn[e]}function Uo(r){return r===nn.HTML}function nf(r){return Uo(r)||r===nn.XML_XHTML_APPLICATION}var nn=gr({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),sf=Object.keys(nn).map(function(r){return nn[r]});function af(r){return sf.indexOf(r)>-1}var of=gr({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/"});_e.assign=Kd;_e.find=Jd;_e.freeze=gr;_e.HTML_BOOLEAN_ATTRIBUTES=Po;_e.HTML_RAW_TEXT_ELEMENTS=rn;_e.HTML_VOID_ELEMENTS=jo;_e.hasDefaultHTMLNamespace=nf;_e.hasOwn=Ut;_e.isHTMLBooleanAttribute=Qd;_e.isHTMLRawTextElement=tf;_e.isHTMLEscapableRawTextElement=rf;_e.isHTMLMimeType=Uo;_e.isHTMLVoidElement=ef;_e.isValidMimeType=af;_e.MIME_TYPE=nn;_e.NAMESPACE=of});var un=_t(ln=>{"use strict";var lf=qt();function Vo(r,e){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:e}})}var an=lf.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"}),zo=Object.keys(an);function Ho(r){return typeof r=="number"&&r>=1&&r<=25}function uf(r){return typeof r=="string"&&r.substring(r.length-an.Error.length)===an.Error}function on(r,e){Ho(r)?(this.name=zo[r],this.message=e||""):(this.message=r,this.name=uf(e)?e:an.Error),Error.captureStackTrace&&Error.captureStackTrace(this,on)}Vo(on,!0);Object.defineProperties(on.prototype,{code:{enumerable:!0,get:function(){var r=zo.indexOf(this.name);return Ho(r)?r:0}}});var Wo={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},qs=Object.entries(Wo);for(sn=0;sn<qs.length;sn++)qo=qs[sn][0],on[qo]=qs[sn][1];var qo,sn;function Vs(r,e,t){this.message=r,this.locator=e,this.cause=t,Error.captureStackTrace&&Error.captureStackTrace(this,Vs)}Vo(Vs);ln.DOMException=on;ln.DOMExceptionName=an;ln.ExceptionCode=Wo;ln.ParseError=Vs});var Zs=_t(R=>{"use strict";function Ko(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 wr=Ko();function At(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function br(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,""),wr?"u":"")}function F(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(""),wr?"u":"")}function I(r){if(arguments.length===0)throw new Error("no parameters provided");return F.apply(I,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var cf="\uFFFD",xt=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;wr&&(xt=F("[",At(xt),"\\u{10000}-\\u{10FFFF}","]"));var df=new RegExp("[^"+At(xt)+"]",wr?"u":""),_i=/[\x20\x09\x0D\x0A]/,ff=At(_i),X=F(_i,"+"),re=F(_i,"*"),cn=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;wr&&(cn=F("[",At(cn),"\\u{10000}-\\u{10FFFF}","]"));var pf=At(cn),Ws=F("[",pf,At(/[-.0-9\xB7]/),At(/[\u0300-\u036F\u203F-\u2040]/),"]"),Me=F(cn,Ws,"*"),hf=F("^",Me,"$"),Go=F(Ws,"+"),mf=F("&",Me,";"),gf=I(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),dn=I(mf,"|",gf),fn=F("%",Me,";"),Gs=I(F('"',I(/[^%&"]/,"|",fn,"|",dn),"*",'"'),"|",F("'",I(/[^%&']/,"|",fn,"|",dn),"*","'")),bf=I('"',I(/[^<&"]/,"|",dn),"*",'"',"|","'",I(/[^<&']/,"|",dn),"*","'"),_f=br(cn,":"),wf=br(Ws,":"),zs=F(_f,wf,"*"),yf=F("^",zs,"$"),pn=F(zs,I(":",zs),"?"),vf=F("^",pn,"$"),kf=F("(",pn,")"),_r=I(/"[^"]*"|'[^']*'/),Ef=F(/^<\?/,"(",Me,")",I(X,"(?!",_i,")(",xt,"*?)"),"?",/\?>/),Xo=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,hn=I('"',Xo,'*"',"|","'",br(Xo,"'"),"*'"),Qo="<!--",el="-->",Af=F(Qo,I(br(xt,"-"),"|",F("-",br(xt,"-"))),"*",el),Yo="#PCDATA",xf=I(F(/\(/,re,Yo,I(re,/\|/,re,pn),"*",re,/\)\*/),"|",F(/\(/,re,Yo,re,/\)/)),Tf=/[?*+]?/,Df=F(/\([^>]+\)/,Tf),Cf=I("EMPTY","|","ANY","|",xf,"|",Df),Sf="<!ELEMENT",Nf=F(Sf,X,I(pn,"|",fn),X,I(Cf,"|",fn),re,">"),Of=F("NOTATION",X,/\(/,re,Me,I(re,/\|/,re,Me),"*",re,/\)/),If=F(/\(/,re,Go,I(re,/\|/,re,Go),"*",re,/\)/),Bf=I(Of,"|",If),Rf=I(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",Bf),Mf=I(/#REQUIRED|#IMPLIED/,"|",I(I("#FIXED",X),"?",bf)),$f=I(X,Me,X,Rf,X,Mf),Ff="<!ATTLIST",Lf=F(Ff,X,Me,$f,"*",re,">"),Hs="about:legacy-compat",Pf=I('"'+Hs+'"',"|","'"+Hs+"'"),Xs="SYSTEM",wi="PUBLIC",yi=I(I(Xs,X,_r),"|",I(wi,X,hn,X,_r)),jf=F("^",I(I(Xs,X,"(?<SystemLiteralOnly>",_r,")"),"|",I(wi,X,"(?<PubidLiteral>",hn,")",X,"(?<SystemLiteral>",_r,")"))),Uf=F("^",hn,"$"),qf=F("^",_r,"$"),Vf=I(X,"NDATA",X,Me),zf=I(Gs,"|",I(yi,Vf,"?")),tl="<!ENTITY",Hf=F(tl,X,Me,X,zf,re,">"),Wf=I(Gs,"|",yi),Gf=F(tl,X,"%",X,Me,X,Wf,re,">"),Xf=I(Hf,"|",Gf),Yf=F(wi,X,hn),Zf=F("<!NOTATION",X,Me,X,I(yi,"|",Yf),re,">"),Ys=F(re,"=",re),Zo=/1[.]\d+/,Jf=F(X,"version",Ys,I("'",Zo,"'","|",'"',Zo,'"')),Jo=/[A-Za-z][-A-Za-z0-9._]*/,Kf=I(X,"encoding",Ys,I('"',Jo,'"',"|","'",Jo,"'")),Qf=I(X,"standalone",Ys,I("'",I("yes","|","no"),"'","|",'"',I("yes","|","no"),'"')),ep=F(/^<\?xml/,Jf,Kf,"?",Qf,"?",re,/\?>/),tp="<!DOCTYPE",rp="<![CDATA[",np="]]>",ip=/<!\[CDATA\[/,sp=/\]\]>/,ap=F(xt,"*?",sp),op=F(ip,ap);R.chars=At;R.chars_without=br;R.detectUnicodeSupport=Ko;R.reg=F;R.regg=I;R.ABOUT_LEGACY_COMPAT=Hs;R.ABOUT_LEGACY_COMPAT_SystemLiteral=Pf;R.AttlistDecl=Lf;R.CDATA_START=rp;R.CDATA_END=np;R.CDSect=op;R.Char=xt;R.Comment=Af;R.COMMENT_START=Qo;R.COMMENT_END=el;R.DOCTYPE_DECL_START=tp;R.elementdecl=Nf;R.EntityDecl=Xf;R.EntityValue=Gs;R.ExternalID=yi;R.ExternalID_match=jf;R.Name=Me;R.Name_exact=hf;R.NCName_exact=yf;R.NotationDecl=Zf;R.Reference=dn;R.PEReference=fn;R.PI=Ef;R.PUBLIC=wi;R.PubidLiteral=hn;R.PubidLiteral_match=Uf;R.QName=pn;R.QName_exact=vf;R.QName_group=kf;R.S=X;R.SChar_s=ff;R.S_OPT=re;R.SYSTEM=Xs;R.SystemLiteral=_r;R.SystemLiteral_match=qf;R.InvalidChar=df;R.UNICODE_REPLACEMENT_CHARACTER=cf;R.UNICODE_SUPPORT=wr;R.XMLDecl=ep});var aa=_t(se=>{"use strict";var je=qt(),Qe=je.find,lp=je.hasDefaultHTMLNamespace,vr=je.hasOwn,up=je.isHTMLMimeType,cp=je.isHTMLRawTextElement,dp=je.isHTMLVoidElement,mn=je.MIME_TYPE,et=je.NAMESPACE,Ce=Symbol(),ll=un(),v=ll.DOMException,xe=ll.DOMExceptionName,ie=Zs();function Ie(r){if(r!==Ce)throw new TypeError("Illegal constructor")}function fp(r){return r!==""}function pp(r){return r?r.split(/[\t\n\f\r ]+/).filter(fp):[]}function hp(r,e){return vr(r,e)||(r[e]=!0),r}function rl(r){if(!r)return[];var e=pp(r);return Object.keys(e.reduce(hp,{}))}function mp(r){return function(e){return r&&r.indexOf(e)!==-1}}function ul(r){if(!ie.QName_exact.test(r))throw new v(v.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function Ks(r,e){ul(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 v(v.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(t==="xml"&&r!==je.NAMESPACE.XML)throw new v(v.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((t==="xmlns"||e==="xmlns")&&r!==je.NAMESPACE.XMLNS)throw new v(v.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===je.NAMESPACE.XMLNS&&t!=="xmlns"&&e!=="xmlns")throw new v(v.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,t,n]}function Ar(r,e){for(var t in r)vr(r,t)&&(e[t]=r[t])}function Be(r,e){var t=r.prototype;if(!(t instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,Ar(t,n),r.prototype=t=n}t.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),t.constructor=r)}var Re={},Pe=Re.ELEMENT_NODE=1,kr=Re.ATTRIBUTE_NODE=2,gn=Re.TEXT_NODE=3,cl=Re.CDATA_SECTION_NODE=4,dl=Re.ENTITY_REFERENCE_NODE=5,gp=Re.ENTITY_NODE=6,Qs=Re.PROCESSING_INSTRUCTION_NODE=7,ea=Re.COMMENT_NODE=8,yr=Re.DOCUMENT_NODE=9,fl=Re.DOCUMENT_TYPE_NODE=10,Tt=Re.DOCUMENT_FRAGMENT_NODE=11,bp=Re.NOTATION_NODE=12,ne=je.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 pl(r,e){if(e.length<r.length)return pl(e,r);var t=null;for(var n in r){if(r[n]!==e[n])return t;t=r[n]}return t}function nl(r){return r.guid||(r.guid=Math.random()),r.guid}function ce(){}ce.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++)sa(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)}};ce.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 Ke(r,e){this._node=r,this._refresh=e,Ai(this)}function Ai(r){var e=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==e){var t=r._refresh(r._node);if(Al(r,"length",t.length),!r.$$length||t.length<r.$$length)for(var n=t.length;n in r;n++)vr(r,n)&&delete r[n];Ar(t,r),r._inc=e}}Ke.prototype.item=function(r){return Ai(this),this[r]||null};Be(Ke,ce);function Er(){this._nsIndex=Object.create(null),this._noNsIndex=Object.create(null)}function hl(r,e){for(var t=0;t<r.length;){if(r[t]===e)return t;t++}}function ta(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 _p(r,e,t){var n=ta(r,e,!1),i=n&&n[t];return i||null}function wp(r,e){ta(r,e.namespaceURI,!0)[e.localName]=e}function yp(r,e){var t=ta(r,e.namespaceURI,!1);t&&delete t[e.localName]}function vp(r,e,t,n){if(n?e[hl(e,n)]=t:(e[e.length]=t,e.length++),wp(e,t),r){t.ownerElement=r;var i=r.ownerDocument;i&&(n&&bl(i,r,n),kp(i,r,t))}}function il(r,e,t){var n=hl(e,t);if(n>=0){for(var i=e.length-1;n<=i;)e[n]=e[++n];if(e.length=i,yp(e,t),r){var s=r.ownerDocument;s&&bl(s,r,t),t.ownerElement=null}}}Er.prototype={length:0,item:ce.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 v(v.INUSE_ATTRIBUTE_ERR);var t=_p(this,r.namespaceURI,r.localName);return t===r?r:(vp(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 v(v.NOT_FOUND_ERR,r);return il(this._ownerElement,this,e),e},removeNamedItemNS:function(r,e){var t=this.getNamedItemNS(r,e);if(!t)throw new v(v.NOT_FOUND_ERR,r?r+" : "+e:e);return il(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}};Er.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 ml(){}ml.prototype={hasFeature:function(r,e){return!0},createDocument:function(r,e,t){var n=mn.XML_APPLICATION;r===et.HTML?n=mn.XML_XHTML_APPLICATION:r===et.SVG&&(n=mn.XML_SVG_IMAGE);var i=new dt(Ce,{contentType:n});if(i.implementation=this,i.childNodes=new ce,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){ul(r);var i=new Di(Ce);return i.name=r,i.nodeName=r,i.publicId=e||"",i.systemId=t||"",i.internalSubset=n||"",i.childNodes=new ce,i},createHTMLDocument:function(r){var e=new dt(Ce,{contentType:mn.HTML});if(e.implementation=this,e.childNodes=new ce,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 q(r){Ie(r)}q.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 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(r){return this===r},insertBefore:function(r,e){return Ei(this,r,e)},replaceChild:function(r,e){Ei(this,r,e,yl),e&&this.removeChild(e)},removeChild:function(r){return _l(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return El(this.ownerDocument||this,this,r)},normalize:function(){we(this,null,{enter:function(r){for(var e=r.firstChild;e;){var t=e.nextSibling;if(t!==null&&t.nodeType===gn&&e.nodeType===gn){for(var n=[],i=t;i!==null&&i.nodeType===gn;)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:r.lastChild=e,e.appendData(n.join("")),ra(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(vr(t,n)&&t[n]===r)return n}e=e.nodeType==kr?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(r){for(var e=this;e;){var t=e._nsMap;if(t&&vr(t,r))return t[r];e=e.nodeType==kr?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 Vt&&(n=e,e=n.ownerElement),t instanceof Vt&&(i=t,t=i.ownerElement,n&&e&&t===e))for(var s=0,a;a=t.attributes[s];s++){if(a===n)return ne.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ne.DOCUMENT_POSITION_PRECEDING;if(a===i)return ne.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ne.DOCUMENT_POSITION_FOLLOWING}if(!e||!t||t.ownerDocument!==e.ownerDocument)return ne.DOCUMENT_POSITION_DISCONNECTED+ne.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(nl(t.ownerDocument)>nl(e.ownerDocument)?ne.DOCUMENT_POSITION_FOLLOWING:ne.DOCUMENT_POSITION_PRECEDING);if(i&&e===t)return ne.DOCUMENT_POSITION_CONTAINS+ne.DOCUMENT_POSITION_PRECEDING;if(n&&e===t)return ne.DOCUMENT_POSITION_CONTAINED_BY+ne.DOCUMENT_POSITION_FOLLOWING;for(var o=[],l=e.parentNode;l;){if(!i&&l===t)return ne.DOCUMENT_POSITION_CONTAINED_BY+ne.DOCUMENT_POSITION_FOLLOWING;o.push(l),l=l.parentNode}o.reverse();for(var u=[],c=t.parentNode;c;){if(!n&&c===e)return ne.DOCUMENT_POSITION_CONTAINS+ne.DOCUMENT_POSITION_PRECEDING;u.push(c),c=c.parentNode}u.reverse();var d=pl(o,u);for(var f in d.childNodes){var h=d.childNodes[f];if(h===t)return ne.DOCUMENT_POSITION_FOLLOWING;if(h===e)return ne.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(h)>=0)return ne.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(h)>=0)return ne.DOCUMENT_POSITION_PRECEDING}return 0}};function gl(r){return r=="<"&&"&lt;"||r==">"&&"&gt;"||r=="&"&&"&amp;"||r=='"'&&"&quot;"||"&#"+r.charCodeAt()+";"}Ar(Re,q);Ar(Re,q.prototype);Ar(ne,q);Ar(ne,q.prototype);function ki(r,e){we(r,null,{enter:function(t){return e(t)?we.STOP:!0}})}function we(r,e,t){for(var n=[{node:r,context:e,phase:we.ENTER}];n.length>0;){var i=n.pop();if(i.phase===we.ENTER){var s=t.enter(i.node,i.context);if(s===we.STOP)return we.STOP;if(n.push({node:i.node,context:s,phase:we.EXIT}),s==null)continue;for(var a=i.node.lastChild;a;)n.push({node:a,context:s,phase:we.ENTER}),a=a.previousSibling}else t.exit&&t.exit(i.node,i.context)}}we.STOP=Symbol("walkDOM.STOP");we.ENTER=0;we.EXIT=1;function dt(r,e){Ie(r);var t=e||{};this.ownerDocument=this,this.contentType=t.contentType||mn.XML_APPLICATION,this.type=up(this.contentType)?"html":"xml"}function kp(r,e,t){r&&r._inc++;var n=t.namespaceURI;n===et.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function bl(r,e,t,n){r&&r._inc++;var i=t.namespaceURI;i===et.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function ra(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 _l(r,e){if(r!==e.parentNode)throw new v(v.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,ra(r.ownerDocument,r),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function Ep(r){return r&&(r.nodeType===q.DOCUMENT_NODE||r.nodeType===q.DOCUMENT_FRAGMENT_NODE||r.nodeType===q.ELEMENT_NODE)}function Ap(r){return r&&(r.nodeType===q.CDATA_SECTION_NODE||r.nodeType===q.COMMENT_NODE||r.nodeType===q.DOCUMENT_FRAGMENT_NODE||r.nodeType===q.DOCUMENT_TYPE_NODE||r.nodeType===q.ELEMENT_NODE||r.nodeType===q.PROCESSING_INSTRUCTION_NODE||r.nodeType===q.TEXT_NODE)}function Dt(r){return r&&r.nodeType===q.DOCUMENT_TYPE_NODE}function ct(r){return r&&r.nodeType===q.ELEMENT_NODE}function wl(r){return r&&r.nodeType===q.TEXT_NODE}function sl(r,e){var t=r.childNodes||[];if(Qe(t,ct)||Dt(e))return!1;var n=Qe(t,Dt);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function al(r,e){var t=r.childNodes||[];function n(s){return ct(s)&&s!==e}if(Qe(t,n))return!1;var i=Qe(t,Dt);return!(e&&i&&t.indexOf(i)>t.indexOf(e))}function xp(r,e,t){if(!Ep(r))throw new v(v.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(t&&t.parentNode!==r)throw new v(v.NOT_FOUND_ERR,"child not in parent");if(!Ap(e)||Dt(e)&&r.nodeType!==q.DOCUMENT_NODE)throw new v(v.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+r.nodeType)}function Tp(r,e,t){var n=r.childNodes||[],i=e.childNodes||[];if(e.nodeType===q.DOCUMENT_FRAGMENT_NODE){var s=i.filter(ct);if(s.length>1||Qe(i,wl))throw new v(v.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!sl(r,t))throw new v(v.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ct(e)&&!sl(r,t))throw new v(v.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Dt(e)){if(Qe(n,Dt))throw new v(v.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=Qe(n,ct);if(t&&n.indexOf(a)<n.indexOf(t))throw new v(v.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!t&&a)throw new v(v.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function yl(r,e,t){var n=r.childNodes||[],i=e.childNodes||[];if(e.nodeType===q.DOCUMENT_FRAGMENT_NODE){var s=i.filter(ct);if(s.length>1||Qe(i,wl))throw new v(v.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!al(r,t))throw new v(v.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ct(e)&&!al(r,t))throw new v(v.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Dt(e)){if(Qe(n,function(l){return Dt(l)&&l!==t}))throw new v(v.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=Qe(n,ct);if(t&&n.indexOf(a)<n.indexOf(t))throw new v(v.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function Ei(r,e,t,n){xp(r,e,t),r.nodeType===q.DOCUMENT_NODE&&(n||Tp)(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 a=e.lastChild}else s=a=e;var o=t?t.previousSibling:r.lastChild;s.previousSibling=o,a.nextSibling=t,o?o.nextSibling=s:r.firstChild=s,t==null?r.lastChild=a:t.previousSibling=a;do s.parentNode=r;while(s!==a&&(s=s.nextSibling));return ra(r.ownerDocument||r,r,e),e.nodeType==Tt&&(e.firstChild=e.lastChild=null),e}dt.prototype={implementation:null,nodeName:"#document",nodeType:yr,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 Ei(this,r,e),r.ownerDocument=this,this.documentElement===null&&r.nodeType===Pe&&(this.documentElement=r),r},removeChild:function(r){var e=_l(this,r);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(r,e){Ei(this,r,e,yl),r.ownerDocument=this,e&&this.removeChild(e),ct(r)&&(this.documentElement=r)},importNode:function(r,e){return Dp(this,r,e)},getElementById:function(r){var e=null;return ki(this.documentElement,function(t){if(t.nodeType==Pe&&t.getAttribute("id")==r)return e=t,!0}),e},createElement:function(r){var e=new ft(Ce);e.ownerDocument=this,this.type==="html"&&(r=r.toLowerCase()),lp(this.contentType)&&(e.namespaceURI=et.HTML),e.nodeName=r,e.tagName=r,e.localName=r,e.childNodes=new ce;var t=e.attributes=new Er;return t._ownerElement=e,e},createDocumentFragment:function(){var r=new xr(Ce);return r.ownerDocument=this,r.childNodes=new ce,r},createTextNode:function(r){var e=new bn(Ce);return e.ownerDocument=this,e.childNodes=new ce,e.appendData(r),e},createComment:function(r){var e=new xi(Ce);return e.ownerDocument=this,e.childNodes=new ce,e.appendData(r),e},createCDATASection:function(r){if(r.indexOf("]]>")!==-1)throw new v(v.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new Ti(Ce);return e.ownerDocument=this,e.childNodes=new ce,e.appendData(r),e},createProcessingInstruction:function(r,e){var t=new Si(Ce);return t.ownerDocument=this,t.childNodes=new ce,t.nodeName=t.target=r,t.nodeValue=t.data=e,t},createAttribute:function(r){if(!ie.QName_exact.test(r))throw new v(v.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var e=new Vt(Ce);return e.ownerDocument=this,e.childNodes=new ce,e.name=r,e.nodeName=r,e.localName=r,e.specified=!0,e},createEntityReference:function(r){if(!ie.Name_exact.test(r))throw new v(v.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new v("document is an html document",xe.NotSupportedError);var e=new Ci(Ce);return e.ownerDocument=this,e.childNodes=new ce,e.nodeName=r,e},createElementNS:function(r,e){var t=Ks(r,e),n=new ft(Ce),i=n.attributes=new Er;return n.childNodes=new ce,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=Ks(r,e),n=new Vt(Ce);return n.ownerDocument=this,n.childNodes=new ce,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=t[0],n.prefix=t[1],n.localName=t[2],n}};Be(dt,q);function ft(r){Ie(r),this._nsMap=Object.create(null)}ft.prototype={nodeType:Pe,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===et.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=Ks(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=rl(r);return new Ke(this,function(t){var n=[];return e.length>0&&ki(t,function(i){if(i!==t&&i.nodeType===Pe){var s=i.getAttribute("class");if(s){var a=r===s;if(!a){var o=rl(s);a=e.every(mp(o))}a&&n.push(i)}}}),n})},getElementsByTagName:function(r){var e=(this.nodeType===yr?this:this.ownerDocument).type==="html",t=r.toLowerCase();return new Ke(this,function(n){var i=[];return ki(n,function(s){if(!(s===n||s.nodeType!==Pe))if(r==="*")i.push(s);else{var a=s.getQualifiedName(),o=e&&s.namespaceURI===et.HTML?t:r;a===o&&i.push(s)}}),i})},getElementsByTagNameNS:function(r,e){return new Ke(this,function(t){var n=[];return ki(t,function(i){i!==t&&i.nodeType===Pe&&(r==="*"||i.namespaceURI===r)&&(e==="*"||i.localName==e)&&n.push(i)}),n})}};dt.prototype.getElementsByClassName=ft.prototype.getElementsByClassName;dt.prototype.getElementsByTagName=ft.prototype.getElementsByTagName;dt.prototype.getElementsByTagNameNS=ft.prototype.getElementsByTagNameNS;Be(ft,q);function Vt(r){Ie(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}Vt.prototype.nodeType=kr;Be(Vt,q);function Ct(r){Ie(r)}Ct.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}};Be(Ct,q);function bn(r){Ie(r)}bn.prototype={nodeName:"#text",nodeType:gn,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}};Be(bn,Ct);function xi(r){Ie(r)}xi.prototype={nodeName:"#comment",nodeType:ea};Be(xi,Ct);function Ti(r){Ie(r)}Ti.prototype={nodeName:"#cdata-section",nodeType:cl};Be(Ti,bn);function Di(r){Ie(r)}Di.prototype.nodeType=fl;Be(Di,q);function na(r){Ie(r)}na.prototype.nodeType=bp;Be(na,q);function ia(r){Ie(r)}ia.prototype.nodeType=gp;Be(ia,q);function Ci(r){Ie(r)}Ci.prototype.nodeType=dl;Be(Ci,q);function xr(r){Ie(r)}xr.prototype.nodeName="#document-fragment";xr.prototype.nodeType=Tt;Be(xr,q);function Si(r){Ie(r)}Si.prototype.nodeType=Qs;Be(Si,Ct);function vl(){}vl.prototype.serializeToString=function(r,e){return kl.call(r,e)};q.prototype.toString=kl;function kl(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===yr&&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 sa(this,t,a,e),t.join("")}function ol(r,e,t){var n=r.prefix||"",i=r.namespaceURI;if(!i||n==="xml"&&i===et.XML||i===et.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===n)return a.namespace!==i}return!0}function vi(r,e,t,n){if(n&&!ie.QName_exact.test(e))throw new v('The attribute name "'+e+'" is not a valid XML QName',xe.InvalidStateError);r.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,gl),'"')}function sa(r,e,t,n){t||(t=[]);var i=n.nodeFilter,s=n.requireWellFormed,a=n.splitCDATASections,o=r.nodeType===yr?r:r.ownerDocument,l=o.type==="html";we(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 Pe:var f=u.attributes,h=f.length,p=u.tagName,m=p;if(!l&&!u.prefix&&u.namespaceURI){for(var g,b=0;b<f.length;b++)if(f.item(b).name==="xmlns"){g=f.item(b).value;break}if(!g)for(var y=d.length-1;y>=0;y--){var w=d[y];if(w.prefix===""&&w.namespace===u.namespaceURI){g=w.namespace;break}}if(g!==u.namespaceURI)for(var y=d.length-1;y>=0;y--){var w=d[y];if(w.namespace===u.namespaceURI){w.prefix&&(m=w.prefix+":"+p);break}}}if(s&&!ie.QName_exact.test(m))throw new v('The element name "'+m+'" is not a valid XML QName',xe.InvalidStateError);e.push("<",m);for(var A=d.slice(),C=0;C<h;C++){var j=f.item(C);j.prefix=="xmlns"?A.push({prefix:j.localName,namespace:j.value}):j.nodeName=="xmlns"&&A.push({prefix:"",namespace:j.value})}for(var C=0;C<h;C++){var j=f.item(C);if(ol(j,l,A)){var Y=j.prefix||"",k=j.namespaceURI;vi(e,Y?"xmlns:"+Y:"xmlns",k,s),A.push({prefix:Y,namespace:k})}var te=i?i(j):j;te&&(typeof te=="string"?e.push(te):vi(e,te.name,te.value,s))}if(p===m&&ol(u,l,A)){var ve=u.prefix||"",k=u.namespaceURI;vi(e,ve?"xmlns:"+ve:"xmlns",k,s),A.push({prefix:ve,namespace:k})}var H=!u.firstChild;if(H&&(l||u.namespaceURI===et.HTML)&&(H=dp(p)),H)return e.push("/>"),null;if(e.push(">"),l&&cp(p)){for(var fe=u.firstChild;fe;)fe.data?e.push(fe.data):sa(fe,e,A.slice(),n),fe=fe.nextSibling;return e.push("</",m,">"),null}return{ns:A,tag:m};case yr:case Tt:if(s&&u.nodeType===yr&&u.documentElement==null)throw new v("The Document has no documentElement",xe.InvalidStateError);return{ns:d};case kr:return vi(e,u.name,u.value,s),null;case gn:if(s&&ie.InvalidChar.test(u.data))throw new v("The Text node data contains characters outside the XML Char production",xe.InvalidStateError);return e.push(u.data.replace(/[<&>]/g,gl)),null;case cl:if(s&&u.data.indexOf("]]>")!==-1)throw new v('The CDATASection data contains "]]>"',xe.InvalidStateError);return a?e.push(ie.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),ie.CDATA_END):e.push(ie.CDATA_START,u.data,ie.CDATA_END),null;case ea:if(s){if(ie.InvalidChar.test(u.data))throw new v("The comment node data contains characters outside the XML Char production",xe.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new v('The comment node data contains "--" or ends with "-"',xe.InvalidStateError)}return e.push(ie.COMMENT_START,u.data,ie.COMMENT_END),null;case fl:var me=u.publicId,L=u.systemId;if(s){if(!ie.Name_exact.test(u.name))throw new v('The doctype name "'+u.name+'" is not a valid XML Name',xe.InvalidStateError);if(me&&!ie.PubidLiteral_match.test(me))throw new v("DocumentType publicId is not a valid PubidLiteral",xe.InvalidStateError);if(L&&L!=="."&&!ie.SystemLiteral_match.test(L))throw new v("DocumentType systemId is not a valid SystemLiteral",xe.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new v('DocumentType internalSubset contains "]>"',xe.InvalidStateError)}return e.push(ie.DOCTYPE_DECL_START," ",u.name),me?(e.push(" ",ie.PUBLIC," ",me),L&&L!=="."&&e.push(" ",L)):L&&L!=="."&&e.push(" ",ie.SYSTEM," ",L),u.internalSubset&&e.push(" [",u.internalSubset,"]"),e.push(">"),null;case Qs:if(s){if(!ie.NCName_exact.test(u.target)||u.target.toLowerCase()==="xml")throw new v('The processing instruction target "'+u.target+'" is not a valid XML NCName or is reserved',xe.InvalidStateError);if(ie.InvalidChar.test(u.data))throw new v("The ProcessingInstruction data contains characters outside the XML Char production",xe.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new v('The ProcessingInstruction data contains "?>"',xe.InvalidStateError)}return e.push("<?",u.target," ",u.data,"?>"),null;case dl:if(s&&!ie.Name_exact.test(u.nodeName))throw new v('The entity reference name "'+u.nodeName+'" is not a valid XML Name',xe.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 Dp(r,e,t){var n;return we(e,null,{enter:function(i,s){var a=i.cloneNode(!1);a.ownerDocument=r,a.parentNode=null,s===null?n=a:s.appendChild(a);var o=i.nodeType===kr||t;return o?a:null}}),n}function El(r,e,t){var n;return we(e,null,{enter:function(i,s){var a=new i.constructor(Ce);for(var o in i)if(vr(i,o)){var l=i[o];typeof l!="object"&&l!=a[o]&&(a[o]=l)}i.childNodes&&(a.childNodes=new ce),a.ownerDocument=r;var u=t;switch(a.nodeType){case Pe:var c=i.attributes,d=a.attributes=new Er,f=c.length;d._ownerElement=a;for(var h=0;h<f;h++)a.setAttributeNode(El(r,c.item(h),!0));break;case kr:u=!0}return s!==null?s.appendChild(a):n=a,u?a:null}}),n}function Al(r,e,t){r[e]=t}function Js(r){for(var e=[],t=r.firstChild;t;)t.nodeType===Pe&&e.push(t),t=t.nextSibling;return e}try{Object.defineProperty&&(Object.defineProperty(Ke.prototype,"length",{get:function(){return Ai(this),this.$$length}}),Object.defineProperty(q.prototype,"textContent",{get:function(){if(this.nodeType===Pe||this.nodeType===Tt){var r=[];return we(this,null,{enter:function(e){if(e.nodeType===Pe||e.nodeType===Tt)return!0;if(e.nodeType===Qs||e.nodeType===ea)return null;r.push(e.nodeValue)}}),r.join("")}return this.nodeValue},set:function(r){switch(this.nodeType){case Pe: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(Ct.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(Ct.prototype,"nodeValue",{get:function(){return this.data},set:function(r){this.data=r},enumerable:!0,configurable:!0}),Object.defineProperty(ft.prototype,"children",{get:function(){return new Ke(this,Js)}}),Object.defineProperty(dt.prototype,"children",{get:function(){return new Ke(this,Js)}}),Object.defineProperty(xr.prototype,"children",{get:function(){return new Ke(this,Js)}}),Al=function(r,e,t){r["$$"+e]=t})}catch{}se._updateLiveList=Ai;se.Attr=Vt;se.CDATASection=Ti;se.CharacterData=Ct;se.Comment=xi;se.Document=dt;se.DocumentFragment=xr;se.DocumentType=Di;se.DOMImplementation=ml;se.Element=ft;se.Entity=ia;se.EntityReference=Ci;se.LiveNodeList=Ke;se.NamedNodeMap=Er;se.Node=q;se.NodeList=ce;se.Notation=na;se.Text=bn;se.ProcessingInstruction=Si;se.walkDOM=we;se.XMLSerializer=vl});var Tl=_t(_n=>{"use strict";var xl=qt().freeze;_n.XML_ENTITIES=xl({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});_n.HTML_ENTITIES=xl({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:`
10
- `,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"});_n.entityMap=_n.HTML_ENTITIES});var Ml=_t(Oi=>{"use strict";var Nr=qt(),M=Zs(),Nl=un(),Cp=Nr.isHTMLEscapableRawTextElement,Sp=Nr.isHTMLMimeType,Np=Nr.isHTMLRawTextElement,vn=Nr.hasOwn,Dl=Nr.NAMESPACE,Op=Nl.ParseError,Ip=Nl.DOMException,Tr=0,St=1,Dr=2,wn=3,Cr=4,Sr=5,yn=6,Ni=7;function Ol(){}Ol.prototype={parse:function(r,e,t){var n=this.domBuilder;n.startDocument(),$p(e,e=Object.create(null)),Bp(r,e,t,n,this.errorHandler),n.endDocument()}};var oa=/&#?\w+;?/g;function Bp(r,e,t,n,i){var s=Sp(n.mimeType);r.indexOf(M.UNICODE_REPLACEMENT_CHARACTER)>=0&&i.warning("Unicode replacement character detected, source encoding issues?");function a(U){if(U>65535){U-=65536;var ke=55296+(U>>10),bt=56320+(U&1023);return String.fromCharCode(ke,bt)}else return String.fromCharCode(U)}function o(U){var ke=U[U.length-1]===";"?U:U+";";if(!s&&ke!==U)return i.error("EntityRef: expecting ;"),U;var bt=M.Reference.exec(ke);if(!bt||bt[0].length!==ke.length)return i.error("entity not matching Reference production: "+U),U;var at=ke.slice(1,-1);return vn(t,at)?t[at]:at.charAt(0)==="#"?a(parseInt(at.substring(1).replace("x","0x"))):(i.error("entity not found:"+U),U)}function l(U){if(U>g){var ke=r.substring(g,U).replace(oa,o);f&&h(g),n.characters(ke,0,U-g),g=U}}var u=0,c=0,d=/\r\n?|\n|$/g,f=n.locator;function h(U,ke){for(;U>=c&&(ke=d.exec(r));)u=c,c=ke.index+ke[0].length,f.lineNumber++;f.columnNumber=U-u+1}for(var p=[{currentNSMap:e}],m=[],g=0;;){try{var b=r.indexOf("<",g);if(b<0){if(!s&&m.length>0)return i.fatalError("unclosed xml tag(s): "+m.join(", "));if(!r.substring(g).match(/^\s*$/)){var y=n.doc,w=y.createTextNode(r.substring(g));if(y.documentElement)return i.error("Extra content at the end of the document");y.appendChild(w),n.currentElement=w}return}if(b>g){var A=r.substring(g,b);!s&&m.length===0&&(A=A.replace(new RegExp(M.S_OPT.source,"g"),""),A&&i.error("Unexpected content outside root element: '"+A+"'")),l(b)}switch(r.charAt(b+1)){case"/":var O=r.indexOf(">",b+2),C=r.substring(b+2,O>0?O:void 0);if(!C)return i.fatalError("end tag name missing");var j=M.reg("^",M.QName_group,M.S_OPT,"$"),Y=O>0&&j.exec(C);if(!Y){var k=O>0&&M.reg("^",M.QName_group).exec(C);if(s&&k)i.warning('end tag name contains invalid trailing characters: "'+C+'"'),Y=k;else if(k&&new RegExp(j.source,j.flags+"m").test(C))i.error('end tag name is followed by a line break and trailing content: "'+C+'"'),Y=k;else return i.fatalError('end tag name contains invalid characters: "'+C+'"')}if(!n.currentElement&&!n.doc.documentElement)return;var te=m[m.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(te!==Y[1]){var ve=Y[1].toLowerCase();if(!s||te.toLowerCase()!==ve)return i.fatalError('Opening and ending tag mismatch: "'+te+'" != "'+C+'"')}var H=p.pop();m.pop();var fe=H.localNSMap;if(n.endElement(H.uri,H.localName,te),fe)for(var me in fe)vn(fe,me)&&n.endPrefixMapping(me);O++;break;case"?":f&&h(b),O=Lp(r,b,n,i);break;case"!":f&&h(b),O=Bl(r,b,n,i,s);break;default:f&&h(b);var L=new Rl,Z=p[p.length-1].currentNSMap,O=Rp(r,b,L,Z,o,i,s),Gr=L.length;if(L.closed||(s&&Nr.isHTMLVoidElement(L.tagName)?L.closed=!0:m.push(L.tagName)),f&&Gr){for(var J=Cl(f,{}),st=0;st<Gr;st++){var dr=L[st];h(dr.offset),dr.locator=Cl(f,{})}n.locator=J,Sl(L,n,Z)&&p.push(L),n.locator=f}else Sl(L,n,Z)&&p.push(L);s&&!L.closed?O=Mp(r,O,L.tagName,o,n):O++}}catch(U){if(U instanceof Op)throw U;if(U instanceof Ip)return i.fatalError("Error constructing the DOM: "+U.name+": "+U.message,U);i.error("element parse error: "+U),O=-1}O>g?g=O:l(Math.max(b,g)+1)}}function Cl(r,e){return e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber,e}function Rp(r,e,t,n,i,s,a){function o(h,p,m){if(vn(t.attributeNames,h))return s.fatalError("Attribute "+h+" redefined");if(!a&&p.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");t.addValue(h,p.replace(/[\t\n\r]/g," ").replace(oa,i),m)}for(var l,u,c=++e,d=Tr;;){var f=r.charAt(c);if(d===Tr&&f==="<")throw new Error("unexpected < in tag name: "+r.slice(e,c));switch(f){case"=":if(d===St)l=r.slice(e,c),d=wn;else if(d===Dr)d=wn;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===wn||d===St)if(d===St&&(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),o(l,u,e-1),d=Sr;else throw new Error("attribute value no end '"+f+"' match");else if(d==Cr)u=r.slice(e,c),o(l,u,e),s.warning('attribute "'+l+'" missed start quot('+f+")!!"),e=c+1,d=Sr;else throw new Error('attribute value must after "="');break;case"/":switch(d){case Tr:t.setTagName(r.slice(e,c));case Sr:case yn:case Ni:d=Ni,t.closed=!0;case Cr:case St:break;case Dr:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==Tr&&t.setTagName(r.slice(e,c)),c;case">":switch(d){case Tr:t.setTagName(r.slice(e,c));case Sr:case yn:case Ni:break;case Cr:case St:u=r.slice(e,c),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case Dr:d===Dr&&(u=l),d==Cr?(s.warning('attribute "'+u+'" missed quot(")!'),o(l,u,e)):(a||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),o(u,u,e));break;case wn:if(!a)return s.fatalError(`AttValue: ' or " expected`)}return c;case"\x80":f=" ";default:if(f<=" ")switch(d){case Tr:t.setTagName(r.slice(e,c)),d=yn;break;case St:l=r.slice(e,c),d=Dr;break;case Cr:var u=r.slice(e,c);s.warning('attribute "'+u+'" missed quot(")!!'),o(l,u,e);case Sr:d=yn;break}else switch(d){case Dr:a||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,e),e=c,d=St;break;case Sr:s.warning('attribute space is required"'+l+'"!!');case yn:d=St,e=c;break;case wn:d=Cr,e=c;break;case Ni:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function Sl(r,e,t){for(var n=r.tagName,i=null,d=r.length;d--;){var s=r[d],a=s.qName,o=s.value,f=a.indexOf(":");if(f>0)var l=s.prefix=a.slice(0,f),u=a.slice(f+1),c=l==="xmlns"&&u;else u=a,l=null,c=a==="xmlns"&&"";s.localName=u,c!==!1&&(i==null&&(i=Object.create(null),t=Object.create(t)),t[c]=i[c]=o,s.uri=Dl.XMLNS,e.startPrefixMapping(c,o))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=Dl.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)vn(i,l)&&e.endPrefixMapping(l)}else return r.currentNSMap=t,r.localNSMap=i,!0}function Mp(r,e,t,n,i){var s=Cp(t);if(s||Np(t)){var a=new RegExp("</"+t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+">","ig");a.lastIndex=e;var o=a.exec(r),l=o?o.index:-1;if(l<0)return e+1;var u=r.substring(e+1,l);return s&&(u=u.replace(oa,n)),i.characters(u,0,u.length),l}return e+1}function $p(r,e){for(var t in r)vn(r,t)&&(e[t]=r[t])}function Il(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!==`
11
- `&&d!==" "&&d!=="\r")return c;c++,i()}return-1}function a(){return r.substring(t)}function o(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=M.reg("^",c),f=d.exec(a());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:a,substringStartsWith:o,substringStartsWithCaseInsensitive:l}}function Fp(r,e){function t(o,l){var u=M.PI.exec(o.substringFromIndex());return u?u[1].toLowerCase()==="xml"?l.fatalError("xml declaration is only allowed at the start of the document, but found at position "+o.getIndex()):(o.skip(u[0].length),u[0]):l.fatalError("processing instruction is not well-formed at position "+o.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 a=null;if(r.char()==="<"&&r.char(1)==="!")switch(r.char(2)){case"E":r.char(3)==="L"?a=r.getMatch(M.elementdecl):r.char(3)==="N"&&(a=r.getMatch(M.EntityDecl));break;case"A":a=r.getMatch(M.AttlistDecl);break;case"N":a=r.getMatch(M.NotationDecl);break;case"-":a=r.getMatch(M.Comment);break}else if(r.char()==="<"&&r.char(1)==="?")a=t(r,e);else if(r.char()==="%")a=r.getMatch(M.PEReference);else return e.fatalError("Error detected in Markup declaration");if(!a)return e.fatalError("Error in internal subset at position "+r.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}function Bl(r,e,t,n,i){var s=Il(r,e);switch(i?s.char(2).toUpperCase():s.char(2)){case"-":var a=s.getMatch(M.Comment);return a?(t.comment(a,M.COMMENT_START.length,a.length-M.COMMENT_START.length-M.COMMENT_END.length),s.getIndex()):n.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var o=s.getMatch(M.CDSect);return o?!i&&!t.currentElement?n.fatalError("CDATA outside of element"):(t.startCDATA(),t.characters(o,M.CDATA_START.length,o.length-M.CDATA_START.length-M.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(M.DOCTYPE_DECL_START):!s.substringStartsWith(M.DOCTYPE_DECL_START))return n.fatalError("Expected "+M.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(M.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+M.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(M.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(M.PUBLIC)||s.substringStartsWith(M.SYSTEM)){var u=M.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(M.SYSTEM)){if(s.skip(M.SYSTEM.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+M.SYSTEM+" at position "+s.getIndex());if(l.systemId=s.getMatch(M.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return n.fatalError("Expected "+M.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+M.SYSTEM+" at position "+s.getIndex())}return i&&l.systemId&&!M.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),i||(s.skipBlanks(),l.internalSubset=Fp(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 Lp(r,e,t,n){var i=r.substring(e).match(M.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(!M.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 Rl(){this.attributeNames=Object.create(null)}Rl.prototype={setTagName:function(r){if(!M.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,e,t){if(!M.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}};Oi.XMLReader=Ol;Oi.parseUtils=Il;Oi.parseDoctypeCommentOrCData=Bl});var ql=_t(Ir=>{"use strict";var zt=qt(),Pp=aa(),jp=un(),$l=Tl(),Up=Ml(),qp=Pp.DOMImplementation,Vp=zt.hasDefaultHTMLNamespace,zp=zt.isHTMLMimeType,Hp=zt.isValidMimeType,Pl=zt.MIME_TYPE,la=zt.NAMESPACE,Fl=jp.ParseError,Wp=Up.XMLReader;function jl(r){return r.replace(/\r[\n\u0085]/g,`
9
+ var Tc=Object.create;var Os=Object.defineProperty;var Dc=Object.getOwnPropertyDescriptor;var Cc=Object.getOwnPropertyNames;var Sc=Object.getPrototypeOf,Nc=Object.prototype.hasOwnProperty;var _t=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Oc=(r,e)=>{for(var t in e)Os(r,t,{get:e[t],enumerable:!0})},Ic=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Cc(e))!Nc.call(r,i)&&i!==t&&Os(r,i,{get:()=>e[i],enumerable:!(n=Dc(e,i))||n.enumerable});return r};var uo=(r,e,t)=>(t=r!=null?Tc(Sc(r)):{},Ic(e||!r||!r.__esModule?Os(t,"default",{value:r,enumerable:!0}):t,r));var qt=_t(ye=>{"use strict";function tf(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(Ut(r,n)){var i=r[n];if(e.call(void 0,i,n,r))return i}}function _r(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 Ut(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function rf(r,e){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var t in e)Ut(e,t)&&(r[t]=e[t]);return r}var Wo=_r({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 nf(r){return Ut(Wo,r.toLowerCase())}var Ho=_r({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 sf(r){return Ut(Ho,r.toLowerCase())}var sn=_r({script:!1,style:!1,textarea:!0,title:!0});function af(r){var e=r.toLowerCase();return Ut(sn,e)&&!sn[e]}function of(r){var e=r.toLowerCase();return Ut(sn,e)&&sn[e]}function Go(r){return r===an.HTML}function lf(r){return Go(r)||r===an.XML_XHTML_APPLICATION}var an=_r({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),uf=Object.keys(an).map(function(r){return an[r]});function cf(r){return uf.indexOf(r)>-1}var df=_r({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/"});ye.assign=rf;ye.find=tf;ye.freeze=_r;ye.HTML_BOOLEAN_ATTRIBUTES=Wo;ye.HTML_RAW_TEXT_ELEMENTS=sn;ye.HTML_VOID_ELEMENTS=Ho;ye.hasDefaultHTMLNamespace=lf;ye.hasOwn=Ut;ye.isHTMLBooleanAttribute=nf;ye.isHTMLRawTextElement=af;ye.isHTMLEscapableRawTextElement=of;ye.isHTMLMimeType=Go;ye.isHTMLVoidElement=sf;ye.isValidMimeType=cf;ye.MIME_TYPE=an;ye.NAMESPACE=df});var dn=_t(cn=>{"use strict";var ff=qt();function Yo(r,e){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:e}})}var ln=ff.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"}),Zo=Object.keys(ln);function Jo(r){return typeof r=="number"&&r>=1&&r<=25}function pf(r){return typeof r=="string"&&r.substring(r.length-ln.Error.length)===ln.Error}function un(r,e){Jo(r)?(this.name=Zo[r],this.message=e||""):(this.message=r,this.name=pf(e)?e:ln.Error),Error.captureStackTrace&&Error.captureStackTrace(this,un)}Yo(un,!0);Object.defineProperties(un.prototype,{code:{enumerable:!0,get:function(){var r=Zo.indexOf(this.name);return Jo(r)?r:0}}});var Ko={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},Xs=Object.entries(Ko);for(on=0;on<Xs.length;on++)Xo=Xs[on][0],un[Xo]=Xs[on][1];var Xo,on;function Ys(r,e,t){this.message=r,this.locator=e,this.cause=t,Error.captureStackTrace&&Error.captureStackTrace(this,Ys)}Yo(Ys);cn.DOMException=un;cn.DOMExceptionName=ln;cn.ExceptionCode=Ko;cn.ParseError=Ys});var ra=_t($=>{"use strict";function il(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 vr=il();function At(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function wr(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,""),vr?"u":"")}function L(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(""),vr?"u":"")}function R(r){if(arguments.length===0)throw new Error("no parameters provided");return L.apply(R,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var hf="\uFFFD",xt=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;vr&&(xt=L("[",At(xt),"\\u{10000}-\\u{10FFFF}","]"));var mf=new RegExp("[^"+At(xt)+"]",vr?"u":""),ki=/[\x20\x09\x0D\x0A]/,gf=At(ki),Y=L(ki,"+"),se=L(ki,"*"),fn=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;vr&&(fn=L("[",At(fn),"\\u{10000}-\\u{10FFFF}","]"));var bf=At(fn),Ks=L("[",bf,At(/[-.0-9\xB7]/),At(/[\u0300-\u036F\u203F-\u2040]/),"]"),$e=L(fn,Ks,"*"),_f=L("^",$e,"$"),Qo=L(Ks,"+"),wf=L("&",$e,";"),yf=R(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),pn=R(wf,"|",yf),hn=L("%",$e,";"),Qs=R(L('"',R(/[^%&"]/,"|",hn,"|",pn),"*",'"'),"|",L("'",R(/[^%&']/,"|",hn,"|",pn),"*","'")),vf=R('"',R(/[^<&"]/,"|",pn),"*",'"',"|","'",R(/[^<&']/,"|",pn),"*","'"),kf=wr(fn,":"),Ef=wr(Ks,":"),Zs=L(kf,Ef,"*"),Af=L("^",Zs,"$"),mn=L(Zs,R(":",Zs),"?"),xf=L("^",mn,"$"),Tf=L("(",mn,")"),yr=R(/"[^"]*"|'[^']*'/),Df=L(/^<\?/,"(",$e,")",R(Y,"(?!",ki,")(",xt,"*?)"),"?",/\?>/),el=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,gn=R('"',el,'*"',"|","'",wr(el,"'"),"*'"),sl="<!--",al="-->",Cf=L(sl,R(wr(xt,"-"),"|",L("-",wr(xt,"-"))),"*",al),tl="#PCDATA",Sf=R(L(/\(/,se,tl,R(se,/\|/,se,mn),"*",se,/\)\*/),"|",L(/\(/,se,tl,se,/\)/)),Nf=/[?*+]?/,Of=L(/\([^>]+\)/,Nf),If=R("EMPTY","|","ANY","|",Sf,"|",Of),Bf="<!ELEMENT",Rf=L(Bf,Y,R(mn,"|",hn),Y,R(If,"|",hn),se,">"),Mf=L("NOTATION",Y,/\(/,se,$e,R(se,/\|/,se,$e),"*",se,/\)/),$f=L(/\(/,se,Qo,R(se,/\|/,se,Qo),"*",se,/\)/),Ff=R(Mf,"|",$f),Lf=R(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",Ff),Pf=R(/#REQUIRED|#IMPLIED/,"|",R(R("#FIXED",Y),"?",vf)),jf=R(Y,$e,Y,Lf,Y,Pf),Uf="<!ATTLIST",qf=L(Uf,Y,$e,jf,"*",se,">"),Js="about:legacy-compat",Vf=R('"'+Js+'"',"|","'"+Js+"'"),ea="SYSTEM",Ei="PUBLIC",Ai=R(R(ea,Y,yr),"|",R(Ei,Y,gn,Y,yr)),zf=L("^",R(R(ea,Y,"(?<SystemLiteralOnly>",yr,")"),"|",R(Ei,Y,"(?<PubidLiteral>",gn,")",Y,"(?<SystemLiteral>",yr,")"))),Wf=L("^",gn,"$"),Hf=L("^",yr,"$"),Gf=R(Y,"NDATA",Y,$e),Xf=R(Qs,"|",R(Ai,Gf,"?")),ol="<!ENTITY",Yf=L(ol,Y,$e,Y,Xf,se,">"),Zf=R(Qs,"|",Ai),Jf=L(ol,Y,"%",Y,$e,Y,Zf,se,">"),Kf=R(Yf,"|",Jf),Qf=L(Ei,Y,gn),ep=L("<!NOTATION",Y,$e,Y,R(Ai,"|",Qf),se,">"),ta=L(se,"=",se),rl=/1[.]\d+/,tp=L(Y,"version",ta,R("'",rl,"'","|",'"',rl,'"')),nl=/[A-Za-z][-A-Za-z0-9._]*/,rp=R(Y,"encoding",ta,R('"',nl,'"',"|","'",nl,"'")),np=R(Y,"standalone",ta,R("'",R("yes","|","no"),"'","|",'"',R("yes","|","no"),'"')),ip=L(/^<\?xml/,tp,rp,"?",np,"?",se,/\?>/),sp="<!DOCTYPE",ap="<![CDATA[",op="]]>",lp=/<!\[CDATA\[/,up=/\]\]>/,cp=L(xt,"*?",up),dp=L(lp,cp);$.chars=At;$.chars_without=wr;$.detectUnicodeSupport=il;$.reg=L;$.regg=R;$.ABOUT_LEGACY_COMPAT=Js;$.ABOUT_LEGACY_COMPAT_SystemLiteral=Vf;$.AttlistDecl=qf;$.CDATA_START=ap;$.CDATA_END=op;$.CDSect=dp;$.Char=xt;$.Comment=Cf;$.COMMENT_START=sl;$.COMMENT_END=al;$.DOCTYPE_DECL_START=sp;$.elementdecl=Rf;$.EntityDecl=Kf;$.EntityValue=Qs;$.ExternalID=Ai;$.ExternalID_match=zf;$.Name=$e;$.Name_exact=_f;$.NCName_exact=Af;$.NotationDecl=ep;$.Reference=pn;$.PEReference=hn;$.PI=Df;$.PUBLIC=Ei;$.PubidLiteral=gn;$.PubidLiteral_match=Wf;$.QName=mn;$.QName_exact=xf;$.QName_group=Tf;$.S=Y;$.SChar_s=gf;$.S_OPT=se;$.SYSTEM=ea;$.SystemLiteral=yr;$.SystemLiteral_match=Hf;$.InvalidChar=mf;$.UNICODE_REPLACEMENT_CHARACTER=hf;$.UNICODE_SUPPORT=vr;$.XMLDecl=ip});var fa=_t(le=>{"use strict";var je=qt(),Qe=je.find,fp=je.hasDefaultHTMLNamespace,Er=je.hasOwn,pp=je.isHTMLMimeType,hp=je.isHTMLRawTextElement,mp=je.isHTMLVoidElement,bn=je.MIME_TYPE,et=je.NAMESPACE,Se=Symbol(),hl=dn(),E=hl.DOMException,Te=hl.DOMExceptionName,oe=ra();function Be(r){if(r!==Se)throw new TypeError("Illegal constructor")}function gp(r){return r!==""}function bp(r){return r?r.split(/[\t\n\f\r ]+/).filter(gp):[]}function _p(r,e){return Er(r,e)||(r[e]=!0),r}function ll(r){if(!r)return[];var e=bp(r);return Object.keys(e.reduce(_p,{}))}function wp(r){return function(e){return r&&r.indexOf(e)!==-1}}function ml(r){if(!oe.QName_exact.test(r))throw new E(E.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function ia(r,e){ml(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 E(E.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(t==="xml"&&r!==je.NAMESPACE.XML)throw new E(E.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((t==="xmlns"||e==="xmlns")&&r!==je.NAMESPACE.XMLNS)throw new E(E.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===je.NAMESPACE.XMLNS&&t!=="xmlns"&&e!=="xmlns")throw new E(E.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,t,n]}function Tr(r,e){for(var t in r)Er(r,t)&&(e[t]=r[t])}function Re(r,e){var t=r.prototype;if(!(t instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,Tr(t,n),r.prototype=t=n}t.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),t.constructor=r)}var Me={},Pe=Me.ELEMENT_NODE=1,Ar=Me.ATTRIBUTE_NODE=2,_n=Me.TEXT_NODE=3,gl=Me.CDATA_SECTION_NODE=4,bl=Me.ENTITY_REFERENCE_NODE=5,yp=Me.ENTITY_NODE=6,sa=Me.PROCESSING_INSTRUCTION_NODE=7,aa=Me.COMMENT_NODE=8,kr=Me.DOCUMENT_NODE=9,_l=Me.DOCUMENT_TYPE_NODE=10,Tt=Me.DOCUMENT_FRAGMENT_NODE=11,vp=Me.NOTATION_NODE=12,ae=je.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 wl(r,e){if(e.length<r.length)return wl(e,r);var t=null;for(var n in r){if(r[n]!==e[n])return t;t=r[n]}return t}function ul(r){return r.guid||(r.guid=Math.random()),r.guid}function he(){}he.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++)da(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)}};he.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 Ke(r,e){this._node=r,this._refresh=e,Ci(this)}function Ci(r){var e=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==e){var t=r._refresh(r._node);if(Nl(r,"length",t.length),!r.$$length||t.length<r.$$length)for(var n=t.length;n in r;n++)Er(r,n)&&delete r[n];Tr(t,r),r._inc=e}}Ke.prototype.item=function(r){return Ci(this),this[r]||null};Re(Ke,he);function xr(){this._nsIndex=Object.create(null),this._noNsIndex=Object.create(null)}function yl(r,e){for(var t=0;t<r.length;){if(r[t]===e)return t;t++}}function oa(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 kp(r,e,t){var n=oa(r,e,!1),i=n&&n[t];return i||null}function Ep(r,e){oa(r,e.namespaceURI,!0)[e.localName]=e}function Ap(r,e){var t=oa(r,e.namespaceURI,!1);t&&delete t[e.localName]}function xp(r,e,t,n){if(n?e[yl(e,n)]=t:(e[e.length]=t,e.length++),Ep(e,t),r){t.ownerElement=r;var i=r.ownerDocument;i&&(n&&El(i,r,n),Tp(i,r,t))}}function cl(r,e,t){var n=yl(e,t);if(n>=0){for(var i=e.length-1;n<=i;)e[n]=e[++n];if(e.length=i,Ap(e,t),r){var s=r.ownerDocument;s&&El(s,r,t),t.ownerElement=null}}}xr.prototype={length:0,item:he.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 E(E.INUSE_ATTRIBUTE_ERR);var t=kp(this,r.namespaceURI,r.localName);return t===r?r:(xp(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 E(E.NOT_FOUND_ERR,r);return cl(this._ownerElement,this,e),e},removeNamedItemNS:function(r,e){var t=this.getNamedItemNS(r,e);if(!t)throw new E(E.NOT_FOUND_ERR,r?r+" : "+e:e);return cl(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}};xr.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 vl(){}vl.prototype={hasFeature:function(r,e){return!0},createDocument:function(r,e,t){var n=bn.XML_APPLICATION;r===et.HTML?n=bn.XML_XHTML_APPLICATION:r===et.SVG&&(n=bn.XML_SVG_IMAGE);var i=new ut(Se,{contentType:n});if(i.implementation=this,i.childNodes=new he,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){ml(r);var i=new Oi(Se);return i.name=r,i.nodeName=r,i.publicId=e||"",i.systemId=t||"",i.internalSubset=n||"",i.childNodes=new he,i},createHTMLDocument:function(r){var e=new ut(Se,{contentType:bn.HTML});if(e.implementation=this,e.childNodes=new he,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 U(r){Be(r)}U.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 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(r){return this===r},insertBefore:function(r,e){return Di(this,r,e)},replaceChild:function(r,e){Di(this,r,e,Tl),e&&this.removeChild(e)},removeChild:function(r){return Al(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return Sl(this.ownerDocument||this,this,r)},normalize:function(){ve(this,null,{enter:function(r){for(var e=r.firstChild;e;){var t=e.nextSibling;if(t!==null&&t.nodeType===_n&&e.nodeType===_n){for(var n=[],i=t;i!==null&&i.nodeType===_n;)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:r.lastChild=e,e.appendData(n.join("")),la(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(Er(t,n)&&t[n]===r)return n}e=e.nodeType==Ar?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(r){for(var e=this;e;){var t=e._nsMap;if(t&&Er(t,r))return t[r];e=e.nodeType==Ar?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 Vt&&(n=e,e=n.ownerElement),t instanceof Vt&&(i=t,t=i.ownerElement,n&&e&&t===e))for(var s=0,a;a=t.attributes[s];s++){if(a===n)return ae.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ae.DOCUMENT_POSITION_PRECEDING;if(a===i)return ae.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ae.DOCUMENT_POSITION_FOLLOWING}if(!e||!t||t.ownerDocument!==e.ownerDocument)return ae.DOCUMENT_POSITION_DISCONNECTED+ae.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(ul(t.ownerDocument)>ul(e.ownerDocument)?ae.DOCUMENT_POSITION_FOLLOWING:ae.DOCUMENT_POSITION_PRECEDING);if(i&&e===t)return ae.DOCUMENT_POSITION_CONTAINS+ae.DOCUMENT_POSITION_PRECEDING;if(n&&e===t)return ae.DOCUMENT_POSITION_CONTAINED_BY+ae.DOCUMENT_POSITION_FOLLOWING;for(var o=[],l=e.parentNode;l;){if(!i&&l===t)return ae.DOCUMENT_POSITION_CONTAINED_BY+ae.DOCUMENT_POSITION_FOLLOWING;o.push(l),l=l.parentNode}o.reverse();for(var u=[],c=t.parentNode;c;){if(!n&&c===e)return ae.DOCUMENT_POSITION_CONTAINS+ae.DOCUMENT_POSITION_PRECEDING;u.push(c),c=c.parentNode}u.reverse();var d=wl(o,u);for(var f in d.childNodes){var p=d.childNodes[f];if(p===t)return ae.DOCUMENT_POSITION_FOLLOWING;if(p===e)return ae.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(p)>=0)return ae.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(p)>=0)return ae.DOCUMENT_POSITION_PRECEDING}return 0}};function kl(r){return r=="<"&&"&lt;"||r==">"&&"&gt;"||r=="&"&&"&amp;"||r=='"'&&"&quot;"||"&#"+r.charCodeAt()+";"}Tr(Me,U);Tr(Me,U.prototype);Tr(ae,U);Tr(ae,U.prototype);function Ti(r,e){ve(r,null,{enter:function(t){return e(t)?ve.STOP:!0}})}function ve(r,e,t){for(var n=[{node:r,context:e,phase:ve.ENTER}];n.length>0;){var i=n.pop();if(i.phase===ve.ENTER){var s=t.enter(i.node,i.context);if(s===ve.STOP)return ve.STOP;if(n.push({node:i.node,context:s,phase:ve.EXIT}),s==null)continue;for(var a=i.node.lastChild;a;)n.push({node:a,context:s,phase:ve.ENTER}),a=a.previousSibling}else t.exit&&t.exit(i.node,i.context)}}ve.STOP=Symbol("walkDOM.STOP");ve.ENTER=0;ve.EXIT=1;function ut(r,e){Be(r);var t=e||{};this.ownerDocument=this,this.contentType=t.contentType||bn.XML_APPLICATION,this.type=pp(this.contentType)?"html":"xml"}function Tp(r,e,t){r&&r._inc++;var n=t.namespaceURI;n===et.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function El(r,e,t,n){r&&r._inc++;var i=t.namespaceURI;i===et.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function la(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 Al(r,e){if(r!==e.parentNode)throw new E(E.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,la(r.ownerDocument,r),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function Dp(r){return r&&(r.nodeType===U.DOCUMENT_NODE||r.nodeType===U.DOCUMENT_FRAGMENT_NODE||r.nodeType===U.ELEMENT_NODE)}function Cp(r){return r&&(r.nodeType===U.CDATA_SECTION_NODE||r.nodeType===U.COMMENT_NODE||r.nodeType===U.DOCUMENT_FRAGMENT_NODE||r.nodeType===U.DOCUMENT_TYPE_NODE||r.nodeType===U.ELEMENT_NODE||r.nodeType===U.PROCESSING_INSTRUCTION_NODE||r.nodeType===U.TEXT_NODE)}function Dt(r){return r&&r.nodeType===U.DOCUMENT_TYPE_NODE}function lt(r){return r&&r.nodeType===U.ELEMENT_NODE}function xl(r){return r&&r.nodeType===U.TEXT_NODE}function dl(r,e){var t=r.childNodes||[];if(Qe(t,lt)||Dt(e))return!1;var n=Qe(t,Dt);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function fl(r,e){var t=r.childNodes||[];function n(s){return lt(s)&&s!==e}if(Qe(t,n))return!1;var i=Qe(t,Dt);return!(e&&i&&t.indexOf(i)>t.indexOf(e))}function Sp(r,e,t){if(!Dp(r))throw new E(E.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(t&&t.parentNode!==r)throw new E(E.NOT_FOUND_ERR,"child not in parent");if(!Cp(e)||Dt(e)&&r.nodeType!==U.DOCUMENT_NODE)throw new E(E.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+r.nodeType)}function Np(r,e,t){var n=r.childNodes||[],i=e.childNodes||[];if(e.nodeType===U.DOCUMENT_FRAGMENT_NODE){var s=i.filter(lt);if(s.length>1||Qe(i,xl))throw new E(E.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!dl(r,t))throw new E(E.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(lt(e)&&!dl(r,t))throw new E(E.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Dt(e)){if(Qe(n,Dt))throw new E(E.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=Qe(n,lt);if(t&&n.indexOf(a)<n.indexOf(t))throw new E(E.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!t&&a)throw new E(E.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Tl(r,e,t){var n=r.childNodes||[],i=e.childNodes||[];if(e.nodeType===U.DOCUMENT_FRAGMENT_NODE){var s=i.filter(lt);if(s.length>1||Qe(i,xl))throw new E(E.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!fl(r,t))throw new E(E.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(lt(e)&&!fl(r,t))throw new E(E.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Dt(e)){if(Qe(n,function(l){return Dt(l)&&l!==t}))throw new E(E.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=Qe(n,lt);if(t&&n.indexOf(a)<n.indexOf(t))throw new E(E.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function Di(r,e,t,n){Sp(r,e,t),r.nodeType===U.DOCUMENT_NODE&&(n||Np)(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 a=e.lastChild}else s=a=e;var o=t?t.previousSibling:r.lastChild;s.previousSibling=o,a.nextSibling=t,o?o.nextSibling=s:r.firstChild=s,t==null?r.lastChild=a:t.previousSibling=a;do s.parentNode=r;while(s!==a&&(s=s.nextSibling));return la(r.ownerDocument||r,r,e),e.nodeType==Tt&&(e.firstChild=e.lastChild=null),e}ut.prototype={implementation:null,nodeName:"#document",nodeType:kr,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 Di(this,r,e),r.ownerDocument=this,this.documentElement===null&&r.nodeType===Pe&&(this.documentElement=r),r},removeChild:function(r){var e=Al(this,r);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(r,e){Di(this,r,e,Tl),r.ownerDocument=this,e&&this.removeChild(e),lt(r)&&(this.documentElement=r)},importNode:function(r,e){return Op(this,r,e)},getElementById:function(r){var e=null;return Ti(this.documentElement,function(t){if(t.nodeType==Pe&&t.getAttribute("id")==r)return e=t,!0}),e},createElement:function(r){var e=new ct(Se);e.ownerDocument=this,this.type==="html"&&(r=r.toLowerCase()),fp(this.contentType)&&(e.namespaceURI=et.HTML),e.nodeName=r,e.tagName=r,e.localName=r,e.childNodes=new he;var t=e.attributes=new xr;return t._ownerElement=e,e},createDocumentFragment:function(){var r=new Dr(Se);return r.ownerDocument=this,r.childNodes=new he,r},createTextNode:function(r){var e=new wn(Se);return e.ownerDocument=this,e.childNodes=new he,e.appendData(r),e},createComment:function(r){var e=new Si(Se);return e.ownerDocument=this,e.childNodes=new he,e.appendData(r),e},createCDATASection:function(r){if(r.indexOf("]]>")!==-1)throw new E(E.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new Ni(Se);return e.ownerDocument=this,e.childNodes=new he,e.appendData(r),e},createProcessingInstruction:function(r,e){var t=new Bi(Se);return t.ownerDocument=this,t.childNodes=new he,t.nodeName=t.target=r,t.nodeValue=t.data=e,t},createAttribute:function(r){if(!oe.QName_exact.test(r))throw new E(E.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var e=new Vt(Se);return e.ownerDocument=this,e.childNodes=new he,e.name=r,e.nodeName=r,e.localName=r,e.specified=!0,e},createEntityReference:function(r){if(!oe.Name_exact.test(r))throw new E(E.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new E("document is an html document",Te.NotSupportedError);var e=new Ii(Se);return e.ownerDocument=this,e.childNodes=new he,e.nodeName=r,e},createElementNS:function(r,e){var t=ia(r,e),n=new ct(Se),i=n.attributes=new xr;return n.childNodes=new he,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=ia(r,e),n=new Vt(Se);return n.ownerDocument=this,n.childNodes=new he,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=t[0],n.prefix=t[1],n.localName=t[2],n}};Re(ut,U);function ct(r){Be(r),this._nsMap=Object.create(null)}ct.prototype={nodeType:Pe,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===et.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=ia(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=ll(r);return new Ke(this,function(t){var n=[];return e.length>0&&Ti(t,function(i){if(i!==t&&i.nodeType===Pe){var s=i.getAttribute("class");if(s){var a=r===s;if(!a){var o=ll(s);a=e.every(wp(o))}a&&n.push(i)}}}),n})},getElementsByTagName:function(r){var e=(this.nodeType===kr?this:this.ownerDocument).type==="html",t=r.toLowerCase();return new Ke(this,function(n){var i=[];return Ti(n,function(s){if(!(s===n||s.nodeType!==Pe))if(r==="*")i.push(s);else{var a=s.getQualifiedName(),o=e&&s.namespaceURI===et.HTML?t:r;a===o&&i.push(s)}}),i})},getElementsByTagNameNS:function(r,e){return new Ke(this,function(t){var n=[];return Ti(t,function(i){i!==t&&i.nodeType===Pe&&(r==="*"||i.namespaceURI===r)&&(e==="*"||i.localName==e)&&n.push(i)}),n})}};ut.prototype.getElementsByClassName=ct.prototype.getElementsByClassName;ut.prototype.getElementsByTagName=ct.prototype.getElementsByTagName;ut.prototype.getElementsByTagNameNS=ct.prototype.getElementsByTagNameNS;Re(ct,U);function Vt(r){Be(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}Vt.prototype.nodeType=Ar;Re(Vt,U);function Ct(r){Be(r)}Ct.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}};Re(Ct,U);function wn(r){Be(r)}wn.prototype={nodeName:"#text",nodeType:_n,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}};Re(wn,Ct);function Si(r){Be(r)}Si.prototype={nodeName:"#comment",nodeType:aa};Re(Si,Ct);function Ni(r){Be(r)}Ni.prototype={nodeName:"#cdata-section",nodeType:gl};Re(Ni,wn);function Oi(r){Be(r)}Oi.prototype.nodeType=_l;Re(Oi,U);function ua(r){Be(r)}ua.prototype.nodeType=vp;Re(ua,U);function ca(r){Be(r)}ca.prototype.nodeType=yp;Re(ca,U);function Ii(r){Be(r)}Ii.prototype.nodeType=bl;Re(Ii,U);function Dr(r){Be(r)}Dr.prototype.nodeName="#document-fragment";Dr.prototype.nodeType=Tt;Re(Dr,U);function Bi(r){Be(r)}Bi.prototype.nodeType=sa;Re(Bi,Ct);function Dl(){}Dl.prototype.serializeToString=function(r,e){return Cl.call(r,e)};U.prototype.toString=Cl;function Cl(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===kr&&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 da(this,t,a,e),t.join("")}function pl(r,e,t){var n=r.prefix||"",i=r.namespaceURI;if(!i||n==="xml"&&i===et.XML||i===et.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===n)return a.namespace!==i}return!0}function xi(r,e,t,n){if(n&&!oe.QName_exact.test(e))throw new E('The attribute name "'+e+'" is not a valid XML QName',Te.InvalidStateError);r.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,kl),'"')}function da(r,e,t,n){t||(t=[]);var i=n.nodeFilter,s=n.requireWellFormed,a=n.splitCDATASections,o=r.nodeType===kr?r:r.ownerDocument,l=o.type==="html";ve(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 Pe:var f=u.attributes,p=f.length,h=u.tagName,m=h;if(!l&&!u.prefix&&u.namespaceURI){for(var g,b=0;b<f.length;b++)if(f.item(b).name==="xmlns"){g=f.item(b).value;break}if(!g)for(var y=d.length-1;y>=0;y--){var w=d[y];if(w.prefix===""&&w.namespace===u.namespaceURI){g=w.namespace;break}}if(g!==u.namespaceURI)for(var y=d.length-1;y>=0;y--){var w=d[y];if(w.namespace===u.namespaceURI){w.prefix&&(m=w.prefix+":"+h);break}}}if(s&&!oe.QName_exact.test(m))throw new E('The element name "'+m+'" is not a valid XML QName',Te.InvalidStateError);e.push("<",m);for(var A=d.slice(),S=0;S<p;S++){var B=f.item(S);B.prefix=="xmlns"?A.push({prefix:B.localName,namespace:B.value}):B.nodeName=="xmlns"&&A.push({prefix:"",namespace:B.value})}for(var S=0;S<p;S++){var B=f.item(S);if(pl(B,l,A)){var W=B.prefix||"",re=B.namespaceURI;xi(e,W?"xmlns:"+W:"xmlns",re,s),A.push({prefix:W,namespace:re})}var ue=i?i(B):B;ue&&(typeof ue=="string"?e.push(ue):xi(e,ue.name,ue.value,s))}if(h===m&&pl(u,l,A)){var x=u.prefix||"",re=u.namespaceURI;xi(e,x?"xmlns:"+x:"xmlns",re,s),A.push({prefix:x,namespace:re})}var Q=!u.firstChild;if(Q&&(l||u.namespaceURI===et.HTML)&&(Q=mp(h)),Q)return e.push("/>"),null;if(e.push(">"),l&&hp(h)){for(var ne=u.firstChild;ne;)ne.data?e.push(ne.data):da(ne,e,A.slice(),n),ne=ne.nextSibling;return e.push("</",m,">"),null}return{ns:A,tag:m};case kr:case Tt:if(s&&u.nodeType===kr&&u.documentElement==null)throw new E("The Document has no documentElement",Te.InvalidStateError);return{ns:d};case Ar:return xi(e,u.name,u.value,s),null;case _n:if(s&&oe.InvalidChar.test(u.data))throw new E("The Text node data contains characters outside the XML Char production",Te.InvalidStateError);return e.push(u.data.replace(/[<&>]/g,kl)),null;case gl:if(s&&u.data.indexOf("]]>")!==-1)throw new E('The CDATASection data contains "]]>"',Te.InvalidStateError);return a?e.push(oe.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),oe.CDATA_END):e.push(oe.CDATA_START,u.data,oe.CDATA_END),null;case aa:if(s){if(oe.InvalidChar.test(u.data))throw new E("The comment node data contains characters outside the XML Char production",Te.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new E('The comment node data contains "--" or ends with "-"',Te.InvalidStateError)}return e.push(oe.COMMENT_START,u.data,oe.COMMENT_END),null;case _l:var ie=u.publicId,z=u.systemId;if(s){if(!oe.Name_exact.test(u.name))throw new E('The doctype name "'+u.name+'" is not a valid XML Name',Te.InvalidStateError);if(ie&&!oe.PubidLiteral_match.test(ie))throw new E("DocumentType publicId is not a valid PubidLiteral",Te.InvalidStateError);if(z&&z!=="."&&!oe.SystemLiteral_match.test(z))throw new E("DocumentType systemId is not a valid SystemLiteral",Te.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new E('DocumentType internalSubset contains "]>"',Te.InvalidStateError)}return e.push(oe.DOCTYPE_DECL_START," ",u.name),ie?(e.push(" ",oe.PUBLIC," ",ie),z&&z!=="."&&e.push(" ",z)):z&&z!=="."&&e.push(" ",oe.SYSTEM," ",z),u.internalSubset&&e.push(" [",u.internalSubset,"]"),e.push(">"),null;case sa:if(s){if(!oe.NCName_exact.test(u.target)||u.target.toLowerCase()==="xml")throw new E('The processing instruction target "'+u.target+'" is not a valid XML NCName or is reserved',Te.InvalidStateError);if(oe.InvalidChar.test(u.data))throw new E("The ProcessingInstruction data contains characters outside the XML Char production",Te.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new E('The ProcessingInstruction data contains "?>"',Te.InvalidStateError)}return e.push("<?",u.target," ",u.data,"?>"),null;case bl:if(s&&!oe.Name_exact.test(u.nodeName))throw new E('The entity reference name "'+u.nodeName+'" is not a valid XML Name',Te.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 Op(r,e,t){var n;return ve(e,null,{enter:function(i,s){var a=i.cloneNode(!1);a.ownerDocument=r,a.parentNode=null,s===null?n=a:s.appendChild(a);var o=i.nodeType===Ar||t;return o?a:null}}),n}function Sl(r,e,t){var n;return ve(e,null,{enter:function(i,s){var a=new i.constructor(Se);for(var o in i)if(Er(i,o)){var l=i[o];typeof l!="object"&&l!=a[o]&&(a[o]=l)}i.childNodes&&(a.childNodes=new he),a.ownerDocument=r;var u=t;switch(a.nodeType){case Pe:var c=i.attributes,d=a.attributes=new xr,f=c.length;d._ownerElement=a;for(var p=0;p<f;p++)a.setAttributeNode(Sl(r,c.item(p),!0));break;case Ar:u=!0}return s!==null?s.appendChild(a):n=a,u?a:null}}),n}function Nl(r,e,t){r[e]=t}function na(r){for(var e=[],t=r.firstChild;t;)t.nodeType===Pe&&e.push(t),t=t.nextSibling;return e}try{Object.defineProperty&&(Object.defineProperty(Ke.prototype,"length",{get:function(){return Ci(this),this.$$length}}),Object.defineProperty(U.prototype,"textContent",{get:function(){if(this.nodeType===Pe||this.nodeType===Tt){var r=[];return ve(this,null,{enter:function(e){if(e.nodeType===Pe||e.nodeType===Tt)return!0;if(e.nodeType===sa||e.nodeType===aa)return null;r.push(e.nodeValue)}}),r.join("")}return this.nodeValue},set:function(r){switch(this.nodeType){case Pe: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(Ct.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(Ct.prototype,"nodeValue",{get:function(){return this.data},set:function(r){this.data=r},enumerable:!0,configurable:!0}),Object.defineProperty(ct.prototype,"children",{get:function(){return new Ke(this,na)}}),Object.defineProperty(ut.prototype,"children",{get:function(){return new Ke(this,na)}}),Object.defineProperty(Dr.prototype,"children",{get:function(){return new Ke(this,na)}}),Nl=function(r,e,t){r["$$"+e]=t})}catch{}le._updateLiveList=Ci;le.Attr=Vt;le.CDATASection=Ni;le.CharacterData=Ct;le.Comment=Si;le.Document=ut;le.DocumentFragment=Dr;le.DocumentType=Oi;le.DOMImplementation=vl;le.Element=ct;le.Entity=ca;le.EntityReference=Ii;le.LiveNodeList=Ke;le.NamedNodeMap=xr;le.Node=U;le.NodeList=he;le.Notation=ua;le.Text=wn;le.ProcessingInstruction=Bi;le.walkDOM=ve;le.XMLSerializer=Dl});var Il=_t(yn=>{"use strict";var Ol=qt().freeze;yn.XML_ENTITIES=Ol({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});yn.HTML_ENTITIES=Ol({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:`
10
+ `,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"});yn.entityMap=yn.HTML_ENTITIES});var Ul=_t(Mi=>{"use strict";var Ir=qt(),F=ra(),$l=dn(),Ip=Ir.isHTMLEscapableRawTextElement,Bp=Ir.isHTMLMimeType,Rp=Ir.isHTMLRawTextElement,En=Ir.hasOwn,Bl=Ir.NAMESPACE,Mp=$l.ParseError,$p=$l.DOMException,Cr=0,St=1,Sr=2,vn=3,Nr=4,Or=5,kn=6,Ri=7;function Fl(){}Fl.prototype={parse:function(r,e,t){var n=this.domBuilder;n.startDocument(),jp(e,e=Object.create(null)),Fp(r,e,t,n,this.errorHandler),n.endDocument()}};var pa=/&#?\w+;?/g;function Fp(r,e,t,n,i){var s=Bp(n.mimeType);r.indexOf(F.UNICODE_REPLACEMENT_CHARACTER)>=0&&i.warning("Unicode replacement character detected, source encoding issues?");function a(P){if(P>65535){P-=65536;var Ee=55296+(P>>10),gt=56320+(P&1023);return String.fromCharCode(Ee,gt)}else return String.fromCharCode(P)}function o(P){var Ee=P[P.length-1]===";"?P:P+";";if(!s&&Ee!==P)return i.error("EntityRef: expecting ;"),P;var gt=F.Reference.exec(Ee);if(!gt||gt[0].length!==Ee.length)return i.error("entity not matching Reference production: "+P),P;var bt=Ee.slice(1,-1);return En(t,bt)?t[bt]:bt.charAt(0)==="#"?a(parseInt(bt.substring(1).replace("x","0x"))):(i.error("entity not found:"+P),P)}function l(P){if(P>g){var Ee=r.substring(g,P).replace(pa,o);f&&p(g),n.characters(Ee,0,P-g),g=P}}var u=0,c=0,d=/\r\n?|\n|$/g,f=n.locator;function p(P,Ee){for(;P>=c&&(Ee=d.exec(r));)u=c,c=Ee.index+Ee[0].length,f.lineNumber++;f.columnNumber=P-u+1}for(var h=[{currentNSMap:e}],m=[],g=0;;){try{var b=r.indexOf("<",g);if(b<0){if(!s&&m.length>0)return i.fatalError("unclosed xml tag(s): "+m.join(", "));if(!r.substring(g).match(/^\s*$/)){var y=n.doc,w=y.createTextNode(r.substring(g));if(y.documentElement)return i.error("Extra content at the end of the document");y.appendChild(w),n.currentElement=w}return}if(b>g){var A=r.substring(g,b);!s&&m.length===0&&(A=A.replace(new RegExp(F.S_OPT.source,"g"),""),A&&i.error("Unexpected content outside root element: '"+A+"'")),l(b)}switch(r.charAt(b+1)){case"/":var N=r.indexOf(">",b+2),S=r.substring(b+2,N>0?N:void 0);if(!S)return i.fatalError("end tag name missing");var B=F.reg("^",F.QName_group,F.S_OPT,"$"),W=N>0&&B.exec(S);if(!W){var re=N>0&&F.reg("^",F.QName_group).exec(S);if(s&&re)i.warning('end tag name contains invalid trailing characters: "'+S+'"'),W=re;else if(re&&new RegExp(B.source,B.flags+"m").test(S))i.error('end tag name is followed by a line break and trailing content: "'+S+'"'),W=re;else return i.fatalError('end tag name contains invalid characters: "'+S+'"')}if(!n.currentElement&&!n.doc.documentElement)return;var ue=m[m.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(ue!==W[1]){var x=W[1].toLowerCase();if(!s||ue.toLowerCase()!==x)return i.fatalError('Opening and ending tag mismatch: "'+ue+'" != "'+S+'"')}var Q=h.pop();m.pop();var ne=Q.localNSMap;if(n.endElement(Q.uri,Q.localName,ue),ne)for(var ie in ne)En(ne,ie)&&n.endPrefixMapping(ie);N++;break;case"?":f&&p(b),N=qp(r,b,n,i);break;case"!":f&&p(b),N=Pl(r,b,n,i,s);break;default:f&&p(b);var z=new jl,ee=h[h.length-1].currentNSMap,N=Lp(r,b,z,ee,o,i,s),st=z.length;if(z.closed||(s&&Ir.isHTMLVoidElement(z.tagName)?z.closed=!0:m.push(z.tagName)),f&&st){for(var mt=Rl(f,{}),dr=0;dr<st;dr++){var Z=z[dr];p(Z.offset),Z.locator=Rl(f,{})}n.locator=mt,Ml(z,n,ee)&&h.push(z),n.locator=f}else Ml(z,n,ee)&&h.push(z);s&&!z.closed?N=Pp(r,N,z.tagName,o,n):N++}}catch(P){if(P instanceof Mp)throw P;if(P instanceof $p)return i.fatalError("Error constructing the DOM: "+P.name+": "+P.message,P);i.error("element parse error: "+P),N=-1}N>g?g=N:l(Math.max(b,g)+1)}}function Rl(r,e){return e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber,e}function Lp(r,e,t,n,i,s,a){function o(p,h,m){if(En(t.attributeNames,p))return s.fatalError("Attribute "+p+" redefined");if(!a&&h.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");t.addValue(p,h.replace(/[\t\n\r]/g," ").replace(pa,i),m)}for(var l,u,c=++e,d=Cr;;){var f=r.charAt(c);if(d===Cr&&f==="<")throw new Error("unexpected < in tag name: "+r.slice(e,c));switch(f){case"=":if(d===St)l=r.slice(e,c),d=vn;else if(d===Sr)d=vn;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===vn||d===St)if(d===St&&(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),o(l,u,e-1),d=Or;else throw new Error("attribute value no end '"+f+"' match");else if(d==Nr)u=r.slice(e,c),o(l,u,e),s.warning('attribute "'+l+'" missed start quot('+f+")!!"),e=c+1,d=Or;else throw new Error('attribute value must after "="');break;case"/":switch(d){case Cr:t.setTagName(r.slice(e,c));case Or:case kn:case Ri:d=Ri,t.closed=!0;case Nr:case St:break;case Sr:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==Cr&&t.setTagName(r.slice(e,c)),c;case">":switch(d){case Cr:t.setTagName(r.slice(e,c));case Or:case kn:case Ri:break;case Nr:case St:u=r.slice(e,c),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case Sr:d===Sr&&(u=l),d==Nr?(s.warning('attribute "'+u+'" missed quot(")!'),o(l,u,e)):(a||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),o(u,u,e));break;case vn:if(!a)return s.fatalError(`AttValue: ' or " expected`)}return c;case"\x80":f=" ";default:if(f<=" ")switch(d){case Cr:t.setTagName(r.slice(e,c)),d=kn;break;case St:l=r.slice(e,c),d=Sr;break;case Nr:var u=r.slice(e,c);s.warning('attribute "'+u+'" missed quot(")!!'),o(l,u,e);case Or:d=kn;break}else switch(d){case Sr:a||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,e),e=c,d=St;break;case Or:s.warning('attribute space is required"'+l+'"!!');case kn:d=St,e=c;break;case vn:d=Nr,e=c;break;case Ri:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function Ml(r,e,t){for(var n=r.tagName,i=null,d=r.length;d--;){var s=r[d],a=s.qName,o=s.value,f=a.indexOf(":");if(f>0)var l=s.prefix=a.slice(0,f),u=a.slice(f+1),c=l==="xmlns"&&u;else u=a,l=null,c=a==="xmlns"&&"";s.localName=u,c!==!1&&(i==null&&(i=Object.create(null),t=Object.create(t)),t[c]=i[c]=o,s.uri=Bl.XMLNS,e.startPrefixMapping(c,o))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=Bl.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 p=r.uri=t[l||""];if(e.startElement(p,u,n,r),r.closed){if(e.endElement(p,u,n),i)for(l in i)En(i,l)&&e.endPrefixMapping(l)}else return r.currentNSMap=t,r.localNSMap=i,!0}function Pp(r,e,t,n,i){var s=Ip(t);if(s||Rp(t)){var a=new RegExp("</"+t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+">","ig");a.lastIndex=e;var o=a.exec(r),l=o?o.index:-1;if(l<0)return e+1;var u=r.substring(e+1,l);return s&&(u=u.replace(pa,n)),i.characters(u,0,u.length),l}return e+1}function jp(r,e){for(var t in r)En(r,t)&&(e[t]=r[t])}function Ll(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!==`
11
+ `&&d!==" "&&d!=="\r")return c;c++,i()}return-1}function a(){return r.substring(t)}function o(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=F.reg("^",c),f=d.exec(a());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:a,substringStartsWith:o,substringStartsWithCaseInsensitive:l}}function Up(r,e){function t(o,l){var u=F.PI.exec(o.substringFromIndex());return u?u[1].toLowerCase()==="xml"?l.fatalError("xml declaration is only allowed at the start of the document, but found at position "+o.getIndex()):(o.skip(u[0].length),u[0]):l.fatalError("processing instruction is not well-formed at position "+o.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 a=null;if(r.char()==="<"&&r.char(1)==="!")switch(r.char(2)){case"E":r.char(3)==="L"?a=r.getMatch(F.elementdecl):r.char(3)==="N"&&(a=r.getMatch(F.EntityDecl));break;case"A":a=r.getMatch(F.AttlistDecl);break;case"N":a=r.getMatch(F.NotationDecl);break;case"-":a=r.getMatch(F.Comment);break}else if(r.char()==="<"&&r.char(1)==="?")a=t(r,e);else if(r.char()==="%")a=r.getMatch(F.PEReference);else return e.fatalError("Error detected in Markup declaration");if(!a)return e.fatalError("Error in internal subset at position "+r.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}function Pl(r,e,t,n,i){var s=Ll(r,e);switch(i?s.char(2).toUpperCase():s.char(2)){case"-":var a=s.getMatch(F.Comment);return a?(t.comment(a,F.COMMENT_START.length,a.length-F.COMMENT_START.length-F.COMMENT_END.length),s.getIndex()):n.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var o=s.getMatch(F.CDSect);return o?!i&&!t.currentElement?n.fatalError("CDATA outside of element"):(t.startCDATA(),t.characters(o,F.CDATA_START.length,o.length-F.CDATA_START.length-F.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(F.DOCTYPE_DECL_START):!s.substringStartsWith(F.DOCTYPE_DECL_START))return n.fatalError("Expected "+F.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(F.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+F.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(F.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(F.PUBLIC)||s.substringStartsWith(F.SYSTEM)){var u=F.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(F.SYSTEM)){if(s.skip(F.SYSTEM.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+F.SYSTEM+" at position "+s.getIndex());if(l.systemId=s.getMatch(F.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return n.fatalError("Expected "+F.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+F.SYSTEM+" at position "+s.getIndex())}return i&&l.systemId&&!F.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),i||(s.skipBlanks(),l.internalSubset=Up(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 qp(r,e,t,n){var i=r.substring(e).match(F.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(!F.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 jl(){this.attributeNames=Object.create(null)}jl.prototype={setTagName:function(r){if(!F.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,e,t){if(!F.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}};Mi.XMLReader=Fl;Mi.parseUtils=Ll;Mi.parseDoctypeCommentOrCData=Pl});var Xl=_t(Rr=>{"use strict";var zt=qt(),Vp=fa(),zp=dn(),ql=Il(),Wp=Ul(),Hp=Vp.DOMImplementation,Gp=zt.hasDefaultHTMLNamespace,Xp=zt.isHTMLMimeType,Yp=zt.isValidMimeType,Wl=zt.MIME_TYPE,ha=zt.NAMESPACE,Vl=zp.ParseError,Zp=Wp.XMLReader;function Hl(r){return r.replace(/\r[\n\u0085]/g,`
12
12
  `).replace(/[\r\u0085\u2028\u2029]/g,`
13
- `)}function Ul(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||zt.assign,this.domHandler=r.domHandler||Bi,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||jl,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}Ul.prototype.parseFromString=function(r,e){if(!Hp(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var t=this.assign(Object.create(null),this.xmlns),n=$l.XML_ENTITIES,i=t[""]||null;Vp(e)?(n=$l.HTML_ENTITIES,i=la.HTML):e===Pl.XML_SVG_IMAGE&&(i=la.SVG),t[""]=i,t.xml=t.xml||la.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 Wp;o.errorHandler=s,o.domBuilder=s;var l=!zt.isHTMLMimeType(e);return l&&typeof r!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(r)),t,n),s.doc.documentElement||o.errorHandler.fatalError("missing root element"),s.doc};function Bi(r){var e=r||{};this.mimeType=e.mimeType||Pl.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 Or(r,e){e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber}Bi.prototype={startDocument:function(){var r=new qp;this.doc=zp(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),a=n.length;Ii(this,s),this.currentElement=s,this.locator&&Or(this.locator,s);for(var o=0;o<a;o++){var r=n.getURI(o),l=n.getValue(o),t=n.getQName(o),u=i.createAttributeNS(r,t);this.locator&&Or(n.getLocator(o),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&&Or(this.locator,t),Ii(this,t)},ignorableWhitespace:function(r,e,t){},characters:function(r,e,t){if(r=Ll.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&&Or(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=Ll.apply(this,arguments);var n=this.doc.createComment(r);this.locator&&Or(this.locator,n),Ii(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&&Or(this.locator,s),Ii(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 Fl("Reporting "+r+' "'+e+'" caused '+t,this.locator)}else console.error("[xmldom "+r+"] "+e,Gp(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 Fl(r,this.locator,e)}};function Gp(r){if(r)return`
14
- @#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}function Ll(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){Bi.prototype[r]=function(){return null}});function Ii(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}function Xp(r){if(r==="error")throw"onErrorStopParsing"}function Yp(){throw"onWarningStopParsing"}Ir.__DOMHandler=Bi;Ir.DOMParser=Ul;Ir.normalizeLineEndings=jl;Ir.onErrorStopParsing=Xp;Ir.onWarningStopParsing=Yp});var ua=_t(V=>{"use strict";var Br=qt();V.assign=Br.assign;V.hasDefaultHTMLNamespace=Br.hasDefaultHTMLNamespace;V.isHTMLMimeType=Br.isHTMLMimeType;V.isValidMimeType=Br.isValidMimeType;V.MIME_TYPE=Br.MIME_TYPE;V.NAMESPACE=Br.NAMESPACE;var Ri=un();V.DOMException=Ri.DOMException;V.DOMExceptionName=Ri.DOMExceptionName;V.ExceptionCode=Ri.ExceptionCode;V.ParseError=Ri.ParseError;var de=aa();V.Attr=de.Attr;V.CDATASection=de.CDATASection;V.CharacterData=de.CharacterData;V.Comment=de.Comment;V.Document=de.Document;V.DocumentFragment=de.DocumentFragment;V.DocumentType=de.DocumentType;V.DOMImplementation=de.DOMImplementation;V.Element=de.Element;V.Entity=de.Entity;V.EntityReference=de.EntityReference;V.LiveNodeList=de.LiveNodeList;V.NamedNodeMap=de.NamedNodeMap;V.Node=de.Node;V.NodeList=de.NodeList;V.Notation=de.Notation;V.ProcessingInstruction=de.ProcessingInstruction;V.Text=de.Text;V.XMLSerializer=de.XMLSerializer;var Mi=ql();V.DOMParser=Mi.DOMParser;V.normalizeLineEndings=Mi.normalizeLineEndings;V.onErrorStopParsing=Mi.onErrorStopParsing;V.onWarningStopParsing=Mi.onWarningStopParsing});var Xe=class{constructor(e,{fetcher:t=globalThis.fetch?.bind(globalThis),closeUrl:n="/gramlot/close",navigator:i=globalThis.navigator}={}){this.rpcUrl=e,this.fetcher=t,this.closeUrl=n,this.navigator=i}async call(e,t){let n=await this.fetcher(this.rpcUrl,{method:"POST",credentials:"same-origin",signal:t,headers:{"Content-Type":"application/json"},body:e});if(n.status!==200)throw new Error(`rpc failed: HTTP ${n.status}`);return n.text()}close(e,{beacon:t=!1}={}){let n=JSON.stringify({pageId:e});if(t)try{this.navigator.sendBeacon(this.closeUrl,new Blob([n],{type:"application/json"}))}catch{}else try{Promise.resolve(this.fetcher(this.closeUrl,{method:"POST",credentials:"same-origin",keepalive:!0,headers:{"Content-Type":"application/json"},body:n})).catch(()=>{})}catch{}}};function W(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 io=/^\{(\??[A-Za-z_][A-Za-z0-9_]*|\?)?\}/;function Xr(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(io);if(!s)throw new SyntaxError("Invalid pointer template placeholder");let a=s[1]??"",o=a.startsWith("?"),l=e(o?a.slice(1):a);l==null||l===""&&!o?n=!0:t+=String(l),i+=s[0].length}return n?null:t}function fr(r){let e=[],t=new Set,n="",i=!0;for(let s=0;s<r.length;){let a=s,o=r[s];if(o==='"'||o==="'"||o==="`"){for(s++;s<r.length;){if(r[s]==="\\"){s+=2;continue}if(r[s++]===o)break}n+=r.slice(a,s),i=!1;continue}if(r.startsWith("//",s)){s=r.indexOf(`
15
- `,s),s<0&&(s=r.length),n+=r.slice(a,s);continue}if(r.startsWith("/*",s)){let c=r.indexOf("*/",s+2);s=c<0?r.length:c+2,n+=r.slice(a,s);continue}if(o==="/"&&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(a,s),i=!1;continue}let l=o==="{"?r.slice(s).match(io):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+=o,s++,/\s/.test(o)||(i=/[([{,:;=!?&|+*%~<>\/-]/.test(o))}return{text:n,slots:e,identifiers:t}}function so(r,e,t=()=>null){let n=new Map,i=[],s=a=>{if(n.has(a))return n.get(a);if(!r.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=r.get(a),l=typeof a=="string"?W(o):null,u=e.get(a);if(l){let c=d=>d?s(d):e.get(a);if(l.expression){let d=fr(l.body);u=t(a,o,d,d.slots.map(c))}else u=Xr(l.body,c),e.get(a)==null&&(u=null)}return n.set(a,u),u}finally{i.pop()}};return new Map([...r.keys()].map(a=>[a,s(a)]))}function lt(r,e){let t=new Map([...Object.entries(r.getAttr()),...r.fixedAttrItems()]),n=new Set,i=[],s=a=>{let o=W(a);if(!o)return;let l=[];o.expression?l.push(...fr(o.body).slots):Xr(o.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 pr=9e15,kt=1e9,Ts="0123456789abcdef",si="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",ai="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Ds={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-pr,maxE:pr,crypto:!1},uo,ut,B=!0,li="[DecimalError] ",vt=li+"Invalid argument: ",co=li+"Precision limit exceeded",fo=li+"crypto unavailable",po="[object Decimal]",Ee=Math.floor,ue=Math.pow,Sc=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Nc=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Oc=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,ho=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qe=1e7,N=7,Ic=9007199254740991,Bc=si.length-1,Cs=ai.length-1,_={toStringTag:po};_.absoluteValue=_.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),D(r)};_.ceil=function(){return D(new this.constructor(this),this.e+1,2)};_.clampedTo=_.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(vt+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};_.comparedTo=_.cmp=function(r){var e,t,n,i,s=this,a=s.d,o=(r=new s.constructor(r)).d,l=s.s,u=r.s;if(!a||!o)return!l||!u?NaN:l!==u?l:a===o?0:!a^l<0?1:-1;if(!a[0]||!o[0])return a[0]?l:o[0]?-u:0;if(l!==u)return l;if(s.e!==r.e)return s.e>r.e^l<0?1:-1;for(n=a.length,i=o.length,e=0,t=n<i?n:i;e<t;++e)if(a[e]!==o[e])return a[e]>o[e]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};_.cosine=_.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())+N,n.rounding=1,t=Rc(n,wo(n,t)),n.precision=r,n.rounding=e,D(ut==2||ut==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};_.cubeRoot=_.cbrt=function(){var r,e,t,n,i,s,a,o,l,u,c=this,d=c.constructor;if(!c.isFinite()||c.isZero())return new d(c);for(B=!1,s=c.s*ue(c.s*c,1/3),!s||Math.abs(s)==1/0?(t=be(c.d),r=c.e,(s=(r-t.length+1)%3)&&(t+=s==1||s==-2?"0":"00"),s=ue(t,1/3),r=Ee((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()),a=(r=d.precision)+3;;)if(o=n,l=o.times(o).times(o),u=l.plus(c),n=K(u.plus(c).times(o),u.plus(l),a+2,1),be(o.d).slice(0,a)===(t=be(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!i&&t=="4999"){if(!i&&(D(o,r+1,0),o.times(o).times(o).eq(c))){n=o;break}a+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(D(n,r+1,1),e=!n.times(n).times(n).eq(c));break}return B=!0,D(n,r,d.rounding,e)};_.decimalPlaces=_.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-Ee(this.e/N))*N,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};_.dividedBy=_.div=function(r){return K(this,new this.constructor(r))};_.dividedToIntegerBy=_.divToInt=function(r){var e=this,t=e.constructor;return D(K(e,new t(r),0,1,1),t.precision,t.rounding)};_.equals=_.eq=function(r){return this.cmp(r)===0};_.floor=function(){return D(new this.constructor(this),this.e+1,3)};_.greaterThan=_.gt=function(r){return this.cmp(r)>0};_.greaterThanOrEqualTo=_.gte=function(r){var e=this.cmp(r);return e==1||e===0};_.hyperbolicCosine=_.cosh=function(){var r,e,t,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;t=a.precision,n=a.rounding,a.precision=t+Math.max(s.e,s.sd())+4,a.rounding=1,i=s.d.length,i<32?(r=Math.ceil(i/3),e=(1/ci(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),s=hr(a,1,s.times(e),new a(1),!0);for(var l,u=r,c=new a(8);u--;)l=s.times(s),s=o.minus(l.times(c.minus(l.times(c))));return D(s,a.precision=t,a.rounding=n,!0)};_.hyperbolicSine=_.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=hr(s,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/ci(5,r)),i=hr(s,2,i,i,!0);for(var a,o=new s(5),l=new s(16),u=new s(20);r--;)a=i.times(i),i=i.times(o.plus(a.times(l.times(a).plus(u))))}return s.precision=e,s.rounding=t,D(i,e,t,!0)};_.hyperbolicTangent=_.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,K(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};_.inverseCosine=_.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()?Ye(e,n,i):new e(0):new e(NaN):r.isZero()?Ye(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))};_.inverseHyperbolicCosine=_.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,B=!1,t=t.times(t).minus(1).sqrt().plus(t),B=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};_.inverseHyperbolicSine=_.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,B=!1,t=t.times(t).plus(1).sqrt().plus(t),B=!0,n.precision=r,n.rounding=e,t.ln())};_.inverseHyperbolicTangent=_.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?D(new s(i),r,e,!0):(s.precision=t=n-i.e,i=K(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)};_.inverseSine=_.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=Ye(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)))};_.inverseTangent=_.atan=function(){var r,e,t,n,i,s,a,o,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<=Cs)return a=Ye(c,d+4,f).times(.25),a.s=u.s,a}else{if(!u.s)return new c(NaN);if(d+4<=Cs)return a=Ye(c,d+4,f).times(.5),a.s=u.s,a}for(c.precision=o=d+10,c.rounding=1,t=Math.min(28,o/N+2|0),r=t;r;--r)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(B=!1,e=Math.ceil(o/N),n=1,l=u.times(u),a=new c(u),i=u;r!==-1;)if(i=i.times(l),s=a.minus(i.div(n+=2)),i=i.times(l),a=s.plus(i.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===s.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),B=!0,D(a,c.precision=d,c.rounding=f,!0)};_.isFinite=function(){return!!this.d};_.isInteger=_.isInt=function(){return!!this.d&&Ee(this.e/N)>this.d.length-2};_.isNaN=function(){return!this.s};_.isNegative=_.isNeg=function(){return this.s<0};_.isPositive=_.isPos=function(){return this.s>0};_.isZero=function(){return!!this.d&&this.d[0]===0};_.lessThan=_.lt=function(r){return this.cmp(r)<0};_.lessThanOrEqualTo=_.lte=function(r){return this.cmp(r)<1};_.logarithm=_.log=function(r){var e,t,n,i,s,a,o,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(B=!1,o=d+h,a=yt(u,o),n=e?oi(c,o+10):yt(r,o),l=K(a,n,o,1),Yr(l.d,i=d,f))do if(o+=10,a=yt(u,o),n=e?oi(c,o+10):yt(r,o),l=K(a,n,o,1),!s){+be(l.d).slice(i+1,i+15)+1==1e14&&(l=D(l,d+1,0));break}while(Yr(l.d,i+=10,f));return B=!0,D(l,d,f)};_.minus=_.sub=function(r){var e,t,n,i,s,a,o,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,o=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 B?D(r,o,l):r}if(t=Ee(r.e/N),c=Ee(h.e/N),u=u.slice(),s=c-t,s){for(d=s<0,d?(e=u,s=-s,a=f.length):(e=f,t=c,a=u.length),n=Math.max(Math.ceil(o/N),a)+2,s>n&&(s=n,e.length=1),e.reverse(),n=s;n--;)e.push(0);e.reverse()}else{for(n=u.length,a=f.length,d=n<a,d&&(a=n),n=0;n<a;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),a=u.length,n=f.length-a;n>0;--n)u[a++]=0;for(n=f.length;n>s;){if(u[--n]<f[n]){for(i=n;i&&u[--i]===0;)u[i]=qe-1;--u[i],u[n]+=qe}u[n]-=f[n]}for(;u[--a]===0;)u.pop();for(;u[0]===0;u.shift())--t;return u[0]?(r.d=u,r.e=ui(u,t),B?D(r,o,l):r):new p(l===3?-0:0)};_.modulo=_.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]?D(new n(t),n.precision,n.rounding):(B=!1,n.modulo==9?(e=K(t,r.abs(),0,3,1),e.s*=r.s):e=K(t,r,0,n.modulo,1),e=e.times(r),B=!0,t.minus(e))};_.naturalExponential=_.exp=function(){return Ss(this)};_.naturalLogarithm=_.ln=function(){return yt(this)};_.negated=_.neg=function(){var r=new this.constructor(this);return r.s=-r.s,D(r)};_.plus=_.add=function(r){var e,t,n,i,s,a,o,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,o=f.precision,l=f.rounding,!u[0]||!c[0])return c[0]||(r=new f(d)),B?D(r,o,l):r;if(s=Ee(d.e/N),n=Ee(r.e/N),u=u.slice(),i=s-n,i){for(i<0?(t=u,i=-i,a=c.length):(t=c,n=s,a=u.length),s=Math.ceil(o/N),a=s>a?s+1:a+1,i>a&&(i=a,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(a=u.length,i=c.length,a-i<0&&(i=a,t=c,c=u,u=t),e=0;i;)e=(u[--i]=u[i]+c[i]+e)/qe|0,u[i]%=qe;for(e&&(u.unshift(e),++n),a=u.length;u[--a]==0;)u.pop();return r.d=u,r.e=ui(u,n),B?D(r,o,l):r};_.precision=_.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(vt+r);return t.d?(e=mo(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};_.round=function(){var r=this,e=r.constructor;return D(new e(r),r.e+1,e.rounding)};_.sine=_.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())+N,n.rounding=1,t=$c(n,wo(n,t)),n.precision=r,n.rounding=e,D(ut>2?t.neg():t,r,e,!0)):new n(NaN)};_.squareRoot=_.sqrt=function(){var r,e,t,n,i,s,a=this,o=a.d,l=a.e,u=a.s,c=a.constructor;if(u!==1||!o||!o[0])return new c(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);for(B=!1,u=Math.sqrt(+a),u==0||u==1/0?(e=be(o),(e.length+l)%2==0&&(e+="0"),u=Math.sqrt(e),l=Ee((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(K(a,s,t+2,1)).times(.5),be(s.d).slice(0,t)===(e=be(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(D(s,l+1,0),s.times(s).eq(a))){n=s;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(D(n,l+1,1),r=!n.times(n).eq(a));break}return B=!0,D(n,l,c.rounding,r)};_.tangent=_.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=K(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,D(ut==2||ut==4?t.neg():t,r,e,!0)):new n(NaN)};_.times=_.mul=function(r){var e,t,n,i,s,a,o,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=Ee(c.e/N)+Ee(r.e/N),l=f.length,u=h.length,l<u&&(s=f,f=h,h=s,a=l,l=u,u=a),s=[],a=l+u,n=a;n--;)s.push(0);for(n=u;--n>=0;){for(e=0,i=l+n;i>n;)o=s[i]+h[n]*f[i-n-1]+e,s[i--]=o%qe|0,e=o/qe|0;s[i]=(s[i]+e)%qe|0}for(;!s[--a];)s.pop();return e?++t:s.shift(),r.d=s,r.e=ui(s,t),B?D(r,d.precision,d.rounding):r};_.toBinary=function(r,e){return Ns(this,2,r,e)};_.toDecimalPlaces=_.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Oe(r,0,kt),e===void 0?e=n.rounding:Oe(e,0,8),D(t,r+t.e+1,e))};_.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ze(n,!0):(Oe(r,0,kt),e===void 0?e=i.rounding:Oe(e,0,8),n=D(new i(n),r+1,e),t=Ze(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};_.toFixed=function(r,e){var t,n,i=this,s=i.constructor;return r===void 0?t=Ze(i):(Oe(r,0,kt),e===void 0?e=s.rounding:Oe(e,0,8),n=D(new s(i),r+i.e+1,e),t=Ze(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};_.toFraction=function(r){var e,t,n,i,s,a,o,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=mo(p)-h.e-1,a=s%N,e.d[0]=ue(10,a<0?N+a:a),r==null)r=s>0?e:u;else{if(o=new m(r),!o.isInt()||o.lt(u))throw Error(vt+o);r=o.gt(e)?s>0?e:u:o}for(B=!1,o=new m(be(p)),c=m.precision,m.precision=s=p.length*N*2;d=K(o,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=o.minus(d.times(i)),o=i;return i=K(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=K(u,n,s,1).minus(h).abs().cmp(K(l,t,s,1).minus(h).abs())<1?[u,n]:[l,t],m.precision=c,B=!0,f};_.toHexadecimal=_.toHex=function(r,e){return Ns(this,16,r,e)};_.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:Oe(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]?(B=!1,t=K(t,r,0,e,1).times(r),B=!0,D(t)):(r.s=t.s,t=r),t};_.toNumber=function(){return+this};_.toOctal=function(r,e){return Ns(this,8,r,e)};_.toPower=_.pow=function(r){var e,t,n,i,s,a,o=this,l=o.constructor,u=+(r=new l(r));if(!o.d||!r.d||!o.d[0]||!r.d[0])return new l(ue(+o,u));if(o=new l(o),o.eq(1))return o;if(n=l.precision,s=l.rounding,r.eq(1))return D(o,n,s);if(e=Ee(r.e/N),e>=r.d.length-1&&(t=u<0?-u:u)<=Ic)return i=go(l,o,t,n),r.s<0?new l(1).div(i):D(i,n,s);if(a=o.s,a<0){if(e<r.d.length-1)return new l(NaN);if((r.d[e]&1)==0&&(a=1),o.e==0&&o.d[0]==1&&o.d.length==1)return o.s=a,o}return t=ue(+o,u),e=t==0||!isFinite(t)?Ee(u*(Math.log("0."+be(o.d))/Math.LN10+o.e+1)):new l(t+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?a/0:0):(B=!1,l.rounding=o.s=1,t=Math.min(12,(e+"").length),i=Ss(r.times(yt(o,n+t)),n),i.d&&(i=D(i,n+5,1),Yr(i.d,n,s)&&(e=n+10,i=D(Ss(r.times(yt(o,e+t)),e),e+5,1),+be(i.d).slice(n+1,n+15)+1==1e14&&(i=D(i,n+1,0)))),i.s=a,B=!0,l.rounding=s,D(i,n,s))};_.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ze(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Oe(r,1,kt),e===void 0?e=i.rounding:Oe(e,0,8),n=D(new i(n),r,e),t=Ze(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};_.toSignificantDigits=_.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Oe(r,1,kt),e===void 0?e=n.rounding:Oe(e,0,8)),D(new n(t),r,e)};_.toString=function(){var r=this,e=r.constructor,t=Ze(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};_.truncated=_.trunc=function(){return D(new this.constructor(this),this.e+1,1)};_.valueOf=_.toJSON=function(){var r=this,e=r.constructor,t=Ze(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function be(r){var e,t,n,i=r.length-1,s="",a=r[0];if(i>0){for(s+=a,e=1;e<i;e++)n=r[e]+"",t=N-n.length,t&&(s+=wt(t)),s+=n;a=r[e],n=a+"",t=N-n.length,t&&(s+=wt(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}function Oe(r,e,t){if(r!==~~r||r<e||r>t)throw Error(vt+r)}function Yr(r,e,t,n){var i,s,a,o;for(s=r[0];s>=10;s/=10)--e;return--e<0?(e+=N,i=0):(i=Math.ceil((e+1)/N),e%=N),s=ue(10,N-e),o=r[i]%s|0,n==null?e<3?(e==0?o=o/100|0:e==1&&(o=o/10|0),a=t<4&&o==99999||t>3&&o==49999||o==5e4||o==0):a=(t<4&&o+1==s||t>3&&o+1==s/2)&&(r[i+1]/s/100|0)==ue(10,e-2)-1||(o==s/2||o==0)&&(r[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||t<4)&&o==9999||!n&&t>3&&o==4999):a=((n||t<4)&&o+1==s||!n&&t>3&&o+1==s/2)&&(r[i+1]/s/1e3|0)==ue(10,e-3)-1,a}function ni(r,e,t){for(var n,i=[0],s,a=0,o=r.length;a<o;){for(s=i.length;s--;)i[s]*=e;for(i[0]+=Ts.indexOf(r.charAt(a++)),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 Rc(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/ci(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=hr(r,1,e.times(i),new r(1));for(var s=t;s--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}var K=(function(){function r(n,i,s){var a,o=0,l=n.length;for(n=n.slice();l--;)a=n[l]*i+o,n[l]=a%s|0,o=a/s|0;return o&&n.unshift(o),n}function e(n,i,s,a){var o,l;if(s!=a)l=s>a?1:-1;else for(o=l=0;o<s;o++)if(n[o]!=i[o]){l=n[o]>i[o]?1:-1;break}return l}function t(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,l){var u,c,d,f,h,p,m,g,b,y,w,A,C,j,Y,k,te,ve,H,fe,me=n.constructor,L=n.s==i.s?1:-1,Z=n.d,O=i.d;if(!Z||!Z[0]||!O||!O[0])return new me(!n.s||!i.s||(Z?O&&Z[0]==O[0]:!O)?NaN:Z&&Z[0]==0||!O?L*0:L/0);for(l?(h=1,c=n.e-i.e):(l=qe,h=N,c=Ee(n.e/h)-Ee(i.e/h)),H=O.length,te=Z.length,b=new me(L),y=b.d=[],d=0;O[d]==(Z[d]||0);d++);if(O[d]>(Z[d]||0)&&c--,s==null?(j=s=me.precision,a=me.rounding):o?j=s+(n.e-i.e)+1:j=s,j<0)y.push(1),p=!0;else{if(j=j/h+2|0,d=0,H==1){for(f=0,O=O[0],j++;(d<te||f)&&j--;d++)Y=f*l+(Z[d]||0),y[d]=Y/O|0,f=Y%O|0;p=f||d<te}else{for(f=l/(O[0]+1)|0,f>1&&(O=r(O,f,l),Z=r(Z,f,l),H=O.length,te=Z.length),k=H,w=Z.slice(0,H),A=w.length;A<H;)w[A++]=0;fe=O.slice(),fe.unshift(0),ve=O[0],O[1]>=l/2&&++ve;do f=0,u=e(O,w,H,A),u<0?(C=w[0],H!=A&&(C=C*l+(w[1]||0)),f=C/ve|0,f>1?(f>=l&&(f=l-1),m=r(O,f,l),g=m.length,A=w.length,u=e(m,w,g,A),u==1&&(f--,t(m,H<g?fe:O,g,l))):(f==0&&(u=f=1),m=O.slice()),g=m.length,g<A&&m.unshift(0),t(w,m,A,l),u==-1&&(A=w.length,u=e(O,w,H,A),u<1&&(f++,t(w,H<A?fe:O,A,l))),A=w.length):u===0&&(f++,w=[0]),y[d++]=f,u&&w[0]?w[A++]=Z[k]||0:(w=[Z[k]],A=1);while((k++<te||w[0]!==void 0)&&j--);p=w[0]!==void 0}y[0]||y.shift()}if(h==1)b.e=c,uo=p;else{for(d=1,f=y[0];f>=10;f/=10)d++;b.e=d+c*h-1,D(b,o?s+b.e+1:s,a,p)}return b}})();function D(r,e,t,n){var i,s,a,o,l,u,c,d,f,h=r.constructor;e:if(e!=null){if(d=r.d,!d)return r;for(i=1,o=d[0];o>=10;o/=10)i++;if(s=e-i,s<0)s+=N,a=e,c=d[f=0],l=c/ue(10,i-a-1)%10|0;else if(f=Math.ceil((s+1)/N),o=d.length,f>=o)if(n){for(;o++<=f;)d.push(0);c=l=0,i=1,s%=N,a=s-N+1}else break e;else{for(c=o=d[f],i=1;o>=10;o/=10)i++;s%=N,a=s-N+i,l=a<0?0:c/ue(10,i-a-1)%10|0}if(n=n||e<0||d[f+1]!==void 0||(a<0?c:c%ue(10,i-a-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?a>0?c/ue(10,i-a):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]=ue(10,(N-e%N)%N),r.e=-e||0):d[0]=r.e=0,r;if(s==0?(d.length=f,o=1,f--):(d.length=f+1,o=ue(10,N-s),d[f]=a>0?(c/ue(10,i-a)%ue(10,a)|0)*o:0),u)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&&(r.e++,d[0]==qe&&(d[0]=1));break}else{if(d[f]+=o,d[f]!=qe)break;d[f--]=0,o=1}for(s=d.length;d[--s]===0;)d.pop()}return B&&(r.e>h.maxE?(r.d=null,r.e=NaN):r.e<h.minE&&(r.e=0,r.d=[0])),r}function Ze(r,e,t){if(!r.isFinite())return _o(r);var n,i=r.e,s=be(r.d),a=s.length;return e?(t&&(n=t-a)>0?s=s.charAt(0)+"."+s.slice(1)+wt(n):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(r.e<0?"e":"e+")+r.e):i<0?(s="0."+wt(-i-1)+s,t&&(n=t-a)>0&&(s+=wt(n))):i>=a?(s+=wt(i+1-a),t&&(n=t-i-1)>0&&(s=s+"."+wt(n))):((n=i+1)<a&&(s=s.slice(0,n)+"."+s.slice(n)),t&&(n=t-a)>0&&(i+1===a&&(s+="."),s+=wt(n))),s}function ui(r,e){var t=r[0];for(e*=N;t>=10;t/=10)e++;return e}function oi(r,e,t){if(e>Bc)throw B=!0,t&&(r.precision=t),Error(co);return D(new r(si),e,1,!0)}function Ye(r,e,t){if(e>Cs)throw Error(co);return D(new r(ai),e,t,!0)}function mo(r){var e=r.length-1,t=e*N+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 wt(r){for(var e="";r--;)e+="0";return e}function go(r,e,t,n){var i,s=new r(1),a=Math.ceil(n/N+4);for(B=!1;;){if(t%2&&(s=s.times(e),oo(s.d,a)&&(i=!0)),t=Ee(t/2),t===0){t=s.d.length-1,i&&s.d[t]===0&&++s.d[t];break}e=e.times(e),oo(e.d,a)}return B=!0,s}function ao(r){return r.d[r.d.length-1]&1}function bo(r,e,t){for(var n,i,s=new r(e[0]),a=0;++a<e.length;){if(i=new r(e[a]),!i.s){s=i;break}n=s.cmp(i),(n===t||n===0&&s.s===t)&&(s=i)}return s}function Ss(r,e){var t,n,i,s,a,o,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?(B=!1,l=p):l=e,o=new f(.03125);r.e>-2;)r=r.times(o),d+=5;for(n=Math.log(ue(2,d))/Math.LN10*2+5|0,l+=n,t=s=a=new f(1),f.precision=l;;){if(s=D(s.times(r),l,1),t=t.times(++c),o=a.plus(K(s,t,l,1)),be(o.d).slice(0,l)===be(a.d).slice(0,l)){for(i=d;i--;)a=D(a.times(a),l,1);if(e==null)if(u<3&&Yr(a.d,l-n,h,u))f.precision=l+=10,t=s=o=new f(1),c=0,u++;else return D(a,f.precision=p,h,B=!0);else return f.precision=p,a}a=o}}function yt(r,e){var t,n,i,s,a,o,l,u,c,d,f,h=1,p=10,m=r,g=m.d,b=m.constructor,y=b.rounding,w=b.precision;if(m.s<0||!g||!g[0]||!m.e&&g[0]==1&&g.length==1)return new b(g&&!g[0]?-1/0:m.s!=1?NaN:g?0:m);if(e==null?(B=!1,c=w):c=e,b.precision=c+=p,t=be(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=be(m.d),n=t.charAt(0),h++;s=m.e,n>1?(m=new b("0."+t),s++):m=new b(n+"."+t.slice(1))}else return u=oi(b,c+2,w).times(s+""),m=yt(new b(n+"."+t.slice(1)),c-p).plus(u),b.precision=w,e==null?D(m,w,y,B=!0):m;for(d=m,l=a=m=K(m.minus(1),m.plus(1),c,1),f=D(m.times(m),c,1),i=3;;){if(a=D(a.times(f),c,1),u=l.plus(K(a,new b(i),c,1)),be(u.d).slice(0,c)===be(l.d).slice(0,c))if(l=l.times(2),s!==0&&(l=l.plus(oi(b,c+2,w).times(s+""))),l=K(l,new b(h),c,1),e==null)if(Yr(l.d,c-p,y,o))b.precision=c+=p,u=a=m=K(d.minus(1),d.plus(1),c,1),f=D(m.times(m),c,1),i=o=1;else return D(l,b.precision=w,y,B=!0);else return b.precision=w,l;l=u,i+=2}}function _o(r){return String(r.s*r.s/0)}function ii(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)%N,t<0&&(n+=N),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=N;n<i;)r.d.push(+e.slice(n,n+=N));e=e.slice(n),n=N-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),B&&(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 Mc(r,e){var t,n,i,s,a,o,l,u,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),ho.test(e))return ii(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(Nc.test(e))t=16,e=e.toLowerCase();else if(Sc.test(e))t=2;else if(Oc.test(e))t=8;else throw Error(vt+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("."),a=s>=0,n=r.constructor,a&&(e=e.replace(".",""),o=e.length,s=o-s,i=go(n,new n(t),s,s*2)),u=ni(e,t,qe),c=u.length-1,s=c;u[s]===0;--s)u.pop();return s<0?new n(r.s*0):(r.e=ui(u,c),r.d=u,B=!1,a&&(r=K(r,i,o*4)),l&&(r=r.times(Math.abs(l)<54?ue(2,l):Zr.pow(2,l))),B=!0,r)}function $c(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:hr(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/ci(5,t)),e=hr(r,2,e,e);for(var i,s=new r(5),a=new r(16),o=new r(20);t--;)i=e.times(e),e=e.times(s.plus(i.times(a.times(i).minus(o))));return e}function hr(r,e,t,n,i){var s,a,o,l,u=1,c=r.precision,d=Math.ceil(c/N);for(B=!1,l=t.times(t),o=new r(n);;){if(a=K(o.times(l),new r(e++*e++),c,1),o=i?n.plus(a):n.minus(a),n=K(a.times(l),new r(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,u++}return B=!0,a.d.length=d+1,a}function ci(r,e){for(var t=r;--e;)t*=r;return t}function wo(r,e){var t,n=e.s<0,i=Ye(r,r.precision,1),s=i.times(.5);if(e=e.abs(),e.lte(s))return ut=n?4:1,e;if(t=e.divToInt(i),t.isZero())ut=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(s))return ut=ao(t)?n?2:3:n?4:1,e;ut=ao(t)?n?1:4:n?3:2}return e.minus(i).abs()}function Ns(r,e,t,n){var i,s,a,o,l,u,c,d,f,h=r.constructor,p=t!==void 0;if(p?(Oe(t,1,kt),n===void 0?n=h.rounding:Oe(n,0,8)):(t=h.precision,n=h.rounding),!r.isFinite())c=_o(r);else{for(c=Ze(r),a=c.indexOf("."),p?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,a>=0&&(c=c.replace(".",""),f=new h(1),f.e=c.length-a,f.d=ni(Ze(f),10,i),f.e=f.d.length),d=ni(c,10,i),s=l=d.length;d[--l]==0;)d.pop();if(!d[0])c=p?"0p+0":"0";else{if(a<0?s--:(r=new h(r),r.d=d,r.e=s,r=K(r,f,t,n,0,i),d=r.d,s=r.e,u=uo),a=d[t],o=i/2,u=u||d[t+1]!==void 0,u=n<4?(a!==void 0||u)&&(n===0||n===(r.s<0?3:2)):a>o||a===o&&(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(a=0,c="";a<l;a++)c+=Ts.charAt(d[a]);if(p){if(l>1)if(e==16||e==8){for(a=e==16?4:3,--l;l%a;l++)c+="0";for(d=ni(c,i,e),l=d.length;!d[l-1];--l);for(a=1,c="1.";a<l;a++)c+=Ts.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>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 oo(r,e){if(r.length>e)return r.length=e,!0}function Fc(r){return new this(r).abs()}function Lc(r){return new this(r).acos()}function Pc(r){return new this(r).acosh()}function jc(r,e){return new this(r).plus(e)}function Uc(r){return new this(r).asin()}function qc(r){return new this(r).asinh()}function Vc(r){return new this(r).atan()}function zc(r){return new this(r).atanh()}function Hc(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=Ye(this,s,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Ye(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Ye(this,s,1).times(.5),t.s=r.s):e.s<0?(this.precision=s,this.rounding=1,t=this.atan(K(r,e,s,1)),e=Ye(this,s,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(K(r,e,s,1)),t}function Wc(r){return new this(r).cbrt()}function Gc(r){return D(r=new this(r),r.e+1,2)}function Xc(r,e,t){return new this(r).clamp(e,t)}function Yc(r){if(!r||typeof r!="object")throw Error(li+"Object expected");var e,t,n,i=r.defaults===!0,s=["precision",1,kt,"rounding",0,8,"toExpNeg",-pr,0,"toExpPos",0,pr,"maxE",0,pr,"minE",-pr,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(t=s[e],i&&(this[t]=Ds[t]),(n=r[t])!==void 0)if(Ee(n)===n&&n>=s[e+1]&&n<=s[e+2])this[t]=n;else throw Error(vt+t+": "+n);if(t="crypto",i&&(this[t]=Ds[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(fo);else this[t]=!1;else throw Error(vt+t+": "+n);return this}function Zc(r){return new this(r).cos()}function Jc(r){return new this(r).cosh()}function yo(r){var e,t,n;function i(s){var a,o,l,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,lo(s)){u.s=s.s,B?!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(a=0,o=s;o>=10;o/=10)a++;B?a>i.maxE?(u.e=NaN,u.d=null):a<i.minE?(u.e=0,u.d=[0]):(u.e=a,u.d=[s]):(u.e=a,u.d=[s]);return}if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return ii(u,s.toString())}if(l==="string")return(o=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(o===43&&(s=s.slice(1)),u.s=1),ho.test(s)?ii(u,s):Mc(u,s);if(l==="bigint")return s<0?(s=-s,u.s=-1):u.s=1,ii(u,s.toString());throw Error(vt+s)}if(i.prototype=_,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=Yc,i.clone=yo,i.isDecimal=lo,i.abs=Fc,i.acos=Lc,i.acosh=Pc,i.add=jc,i.asin=Uc,i.asinh=qc,i.atan=Vc,i.atanh=zc,i.atan2=Hc,i.cbrt=Wc,i.ceil=Gc,i.clamp=Xc,i.cos=Zc,i.cosh=Jc,i.div=Kc,i.exp=Qc,i.floor=ed,i.hypot=td,i.ln=rd,i.log=nd,i.log10=sd,i.log2=id,i.max=ad,i.min=od,i.mod=ld,i.mul=ud,i.pow=cd,i.random=dd,i.round=fd,i.sign=pd,i.sin=hd,i.sinh=md,i.sqrt=gd,i.sub=bd,i.sum=_d,i.tan=wd,i.tanh=yd,i.trunc=vd,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 Kc(r,e){return new this(r).div(e)}function Qc(r){return new this(r).exp()}function ed(r){return D(r=new this(r),r.e+1,3)}function td(){var r,e,t=new this(0);for(B=!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 B=!0,new this(1/0);t=e}return B=!0,t.sqrt()}function lo(r){return r instanceof Zr||r&&r.toStringTag===po||!1}function rd(r){return new this(r).ln()}function nd(r,e){return new this(r).log(e)}function id(r){return new this(r).log(2)}function sd(r){return new this(r).log(10)}function ad(){return bo(this,arguments,-1)}function od(){return bo(this,arguments,1)}function ld(r,e){return new this(r).mod(e)}function ud(r,e){return new this(r).mul(e)}function cd(r,e){return new this(r).pow(e)}function dd(r){var e,t,n,i,s=0,a=new this(1),o=[];if(r===void 0?r=this.precision:Oe(r,1,kt),n=Math.ceil(r/N),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(fo);else for(;s<n;)o[s++]=Math.random()*1e7|0;for(n=o[--s],r%=N,n&&r&&(i=ue(10,N-r),o[s]=(n/i|0)*i);o[s]===0;s--)o.pop();if(s<0)t=0,o=[0];else{for(t=-1;o[0]===0;t-=N)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<N&&(t-=N-n)}return a.e=t,a.d=o,a}function fd(r){return D(r=new this(r),r.e+1,this.rounding)}function pd(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function hd(r){return new this(r).sin()}function md(r){return new this(r).sinh()}function gd(r){return new this(r).sqrt()}function bd(r,e){return new this(r).sub(e)}function _d(){var r=0,e=arguments,t=new this(e[r]);for(B=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return B=!0,D(t,this.precision,this.rounding)}function wd(r){return new this(r).tan()}function yd(r){return new this(r).tanh()}function vd(r){return D(r=new this(r),r.e+1,1)}_[Symbol.for("nodejs.util.inspect.custom")]=_.toString;_[Symbol.toStringTag]="Decimal";var Zr=_.constructor=yo(Ds);si=new Zr(si);ai=new Zr(ai);var vo=Zr;var kd=20,Ed=1,Ft=1e6,ko=1e6,Ad=-7,xd=21,Td=!1,Jr="[big.js] ",Lt=Jr+"Invalid ",di=Lt+"decimal places",Dd=Lt+"rounding mode",Eo=Jr+"Division by zero",G={},Je=void 0,Cd=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function Ao(){function r(e){var t=this;if(!(t instanceof r))return e===Je?Ao():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(Lt+"value");e=e===0&&1/e<0?"-0":String(e)}Sd(t,e)}t.constructor=r}return r.prototype=G,r.DP=kd,r.RM=Ed,r.NE=Ad,r.PE=xd,r.strict=Td,r.roundDown=0,r.roundHalfUp=1,r.roundHalfEven=2,r.roundUp=3,r}function Sd(r,e){var t,n,i;if(!Cd.test(e))throw Error(Lt+"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 Pt(r,e,t,n){var i=r.c;if(t===Je&&(t=r.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(Dd);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]!==Je))),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]!==Je||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 jt(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}G.abs=function(){var r=new this.constructor(this);return r.s=1,r};G.cmp=function(r){var e,t=this,n=t.c,i=(r=new t.constructor(r)).c,s=t.s,a=r.s,o=t.e,l=r.e;if(!n[0]||!i[0])return n[0]?s:i[0]?-a:0;if(s!=a)return s;if(e=s<0,o!=l)return o>l^e?1:-1;for(a=(o=n.length)<(l=i.length)?o:l,s=-1;++s<a;)if(n[s]!=i[s])return n[s]>i[s]^e?1:-1;return o==l?0:o>l^e?1:-1};G.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,a=t.DP;if(a!==~~a||a<0||a>Ft)throw Error(di);if(!i[0])throw Error(Eo);if(!n[0])return r.s=s,r.c=[r.e=0],r;var o,l,u,c,d,f=i.slice(),h=o=i.length,p=n.length,m=n.slice(0,o),g=m.length,b=r,y=b.c=[],w=0,A=a+(b.e=e.e-r.e)+1;for(b.s=s,s=A<0?0:A,f.unshift(0);g++<o;)m.push(0);do{for(u=0;u<10;u++){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(l=g==o?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}y[w++]=c?u:++u,m[0]&&c?m[g]=n[h]||0:m=[n[h]]}while((h++<p||m[0]!==Je)&&s--);return!y[0]&&w!=1&&(y.shift(),b.e--,A--),w>A&&Pt(b,A,t.RM,m[0]!==Je),b};G.eq=function(r){return this.cmp(r)===0};G.gt=function(r){return this.cmp(r)>0};G.gte=function(r){return this.cmp(r)>-1};G.lt=function(r){return this.cmp(r)<0};G.lte=function(r){return this.cmp(r)<1};G.minus=G.sub=function(r){var e,t,n,i,s=this,a=s.constructor,o=s.s,l=(r=new a(r)).s;if(o!=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 a(s):r.s=1,r;if(o=c-f){for((i=o<0)?(o=-o,n=u):(f=c,n=d),n.reverse(),l=o;l--;)n.push(0);n.reverse()}else for(t=((i=u.length<d.length)?u:d).length,o=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>o;){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};G.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(Eo);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)))};G.neg=function(){var r=new this.constructor(this);return r.s=-r.s,r};G.plus=G.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 a=i.e,o=i.c,l=r.e,u=r.c;if(!o[0]||!u[0])return u[0]||(o[0]?r=new s(i):r.s=i.s),r;if(o=o.slice(),e=a-l){for(e>0?(l=a,n=u):(e=-e,n=o),n.reverse();e--;)n.push(0);n.reverse()}for(o.length-u.length<0&&(n=u,u=o,o=n),e=u.length,t=0;e;o[e]%=10)t=(o[--e]=o[e]+u[e]+t)/10|0;for(t&&(o.unshift(t),++l),e=o.length;o[--e]===0;)o.pop();return r.c=o,r.e=l,r};G.pow=function(r){var e=this,t=new e.constructor("1"),n=t,i=r<0;if(r!==~~r||r<-ko||r>ko)throw Error(Lt+"exponent");for(i&&(r=-r);r&1&&(n=n.times(e)),r>>=1,!!r;)e=e.times(e);return i?t.div(n):n};G.prec=function(r,e){if(r!==~~r||r<1||r>Ft)throw Error(Lt+"precision");return Pt(new this.constructor(this),r,e)};G.round=function(r,e){if(r===Je)r=0;else if(r!==~~r||r<-Ft||r>Ft)throw Error(di);return Pt(new this.constructor(this),r+this.e+1,e)};G.sqrt=function(){var r,e,t,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(Jr+"No square root");s=Math.sqrt(+jt(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),r=new i((s==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+a)):r=new i(s+""),a=r.e+(i.DP+=4);do t=r,r=o.times(t.plus(n.div(t)));while(t.c.slice(0,a).join("")!==r.c.slice(0,a).join(""));return Pt(r,(i.DP-=4)+r.e+1,i.RM)};G.times=G.mul=function(r){var e,t=this,n=t.constructor,i=t.c,s=(r=new n(r)).c,a=i.length,o=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,a<o&&(e=i,i=s,s=e,u=a,a=o,o=u),e=new Array(u=a+o);u--;)e[u]=0;for(l=o;l--;){for(o=0,u=a+l;u>l;)o=e[u]+s[l]*i[u-l-1]+o,e[u--]=o%10,o=o/10|0;e[u]=o}for(o?++r.e:e.shift(),l=e.length;!e[--l];)e.pop();return r.c=e,r};G.toExponential=function(r,e){var t=this,n=t.c[0];if(r!==Je){if(r!==~~r||r<0||r>Ft)throw Error(di);for(t=Pt(new t.constructor(t),++r,e);t.c.length<r;)t.c.push(0)}return jt(t,!0,!!n)};G.toFixed=function(r,e){var t=this,n=t.c[0];if(r!==Je){if(r!==~~r||r<0||r>Ft)throw Error(di);for(t=Pt(new t.constructor(t),r+t.e+1,e),r=r+t.e+1;t.c.length<r;)t.c.push(0)}return jt(t,!1,!!n)};G[Symbol.for("nodejs.util.inspect.custom")]=G.toJSON=G.toString=function(){var r=this,e=r.constructor;return jt(r,r.e<=e.NE||r.e>=e.PE,!!r.c[0])};G.toNumber=function(){var r=+jt(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(r.toString()))throw Error(Jr+"Imprecise conversion");return r};G.toPrecision=function(r,e){var t=this,n=t.constructor,i=t.c[0];if(r!==Je){if(r!==~~r||r<1||r>Ft)throw Error(Lt+"precision");for(t=Pt(new n(t),r,e);t.c.length<r;)t.c.push(0)}return jt(t,r<=t.e||t.e<=n.NE||t.e>=n.PE,!!i)};G.valueOf=function(){var r=this,e=r.constructor;if(e.strict===!0)throw Error(Jr+"valueOf disallowed");return jt(r,r.e<=e.NE||r.e>=e.PE,!0)};var Nd=Ao(),xo=Nd;var Us={};Dc(Us,{DecodeError:()=>Ae,Decoder:()=>ze,EXT_TIMESTAMP:()=>Is,Encoder:()=>mr,ExtData:()=>Ve,ExtensionCodec:()=>Et,decode:()=>Ro,decodeArrayStream:()=>Fo,decodeAsync:()=>$o,decodeMulti:()=>Mo,decodeMultiStream:()=>Lo,decodeTimestampExtension:()=>Fs,decodeTimestampToTimeSpec:()=>$s,encode:()=>hi,encodeDateToTimeSpec:()=>Rs,encodeTimeSpecToTimestamp:()=>Bs,encodeTimestampExtension:()=>Ms});function To(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 Od(r,e,t){let n=r.length,i=t,s=0;for(;s<n;){let a=r.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=r.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 Id=new TextEncoder,Bd=50;function Rd(r,e,t){Id.encodeInto(r,e.subarray(t))}function Do(r,e,t){r.length>Bd?Rd(r,e,t):Od(r,e,t)}var Md=4096;function Os(r,e,t){let n=e,i=n+t,s=[],a="";for(;n<i;){let o=r[n++];if((o&128)===0)s.push(o);else if((o&224)===192){let l=r[n++]&63;s.push((o&31)<<6|l)}else if((o&240)===224){let l=r[n++]&63,u=r[n++]&63;s.push((o&31)<<12|l<<6|u)}else if((o&248)===240){let l=r[n++]&63,u=r[n++]&63,c=r[n++]&63,d=(o&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(o);s.length>=Md&&(a+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(a+=String.fromCharCode(...s)),a}var $d=new TextDecoder,Fd=200;function Ld(r,e,t){let n=r.subarray(e,e+t);return $d.decode(n)}function Co(r,e,t){return t>Fd?Ld(r,e,t):Os(r,e,t)}var Ve=class{type;data;constructor(e,t){this.type=e,this.data=t}};var Ae=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 So(r,e,t){let n=t/4294967296,i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function fi(r,e,t){let n=Math.floor(t/4294967296),i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function pi(r,e){let t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function No(r,e){let t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}var Is=-1,Pd=4294967296-1,jd=17179869184-1;function Bs({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=jd)if(e===0&&r<=Pd){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),fi(n,4,r),t}}function Rs(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 Ms(r){if(r instanceof Date){let e=Rs(r);return Bs(e)}else return null}function $s(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=pi(e,4),n=e.getUint32(0);return{sec:t,nsec:n}}default:throw new Ae(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Fs(r){let e=$s(r);return new Date(e.sec*1e3+e.nsec/1e6)}var Oo={type:Is,encode:Ms,decode:Fs};var Et=class r{static defaultCodec=new r;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(Oo)}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 a=-1-n;return new Ve(a,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 a=n;return new Ve(a,s)}}}return e instanceof Ve?e:null}decode(e,t,n){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,n):new Ve(t,e)}};function Ud(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function Kr(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Ud(r)?new Uint8Array(r):Uint8Array.from(r)}var qd=100,Vd=2048,mr=class r{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Et.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??qd,this.initialBufferSize=e?.initialBufferSize??Vd,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=To(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),Do(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=Kr(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 a=e[s];this.ignoreUndefined&&a===void 0||(this.encodeString(s),this.doEncode(a,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),So(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),fi(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 hi(r,e){return new mr(e).encodeSharedRef(r)}function mi(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}var zd=16,Hd=16,gi=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=zd,t=Hd){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 a=s.bytes;for(let o=0;o<n;o++)if(a[o]!==e[t+o])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=Os(e,t,n),a=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(a,s),s}};var Ls="array",tn="map_key",Bo="map_value",Wd=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new Ae("The type of key must be string or number but "+typeof r)},Ps=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let t=this.getUninitializedStateFromPool();t.type=Ls,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){let t=this.getUninitializedStateFromPool();t.type=tn,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===Ls){let n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===tn||e.type===Bo){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}},en=-1,js=new DataView(new ArrayBuffer(0)),Gd=new Uint8Array(js.buffer);try{js.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 Io=new RangeError("Insufficient data"),Xd=new gi,ze=class r{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=js;bytes=Gd;headByte=en;stack=new Ps;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Et.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:Xd,this.mapKeyConverter=e?.mapKeyConverter??Wd}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=en,this.stack.reset()}setBuffer(e){let t=Kr(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===en&&!this.hasRemaining(1))this.setBuffer(e);else{let t=this.bytes.subarray(this.pos),n=Kr(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 o of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(o);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:a}=this;throw new RangeError(`Insufficient data in parsing ${mi(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,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(a){if(!(a instanceof RangeError))throw a}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 Ae(`Unrecognized type byte: ${mi(e)}`);this.complete();let n=this.stack;for(;n.length>0;){let i=n.top();if(i.type===Ls)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===tn){if(t==="__proto__")throw new Ae("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=Bo;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=tn;continue e}}return t}}readHeadByte(){return this.headByte===en&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=en}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 Ae(`Unrecognized array type byte: ${mi(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new Ae(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new Ae(`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 Ae(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw Io;let n=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,n,e):i=Co(this.bytes,n,e),this.pos+=t+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===tn:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new Ae(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw Io;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 Ae(`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=No(this.view,this.pos);return this.pos+=8,e}readI64(){let e=pi(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 ze(e).decode(r)}function Mo(r,e){return new ze(e).decodeMulti(r)}function Yd(r){return r[Symbol.asyncIterator]!=null}async function*Zd(r){let e=r.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)return;yield n}}finally{e.releaseLock()}}function bi(r){return Yd(r)?r:Zd(r)}async function $o(r,e){let t=bi(r);return new ze(e).decodeAsync(t)}function Fo(r,e){let t=bi(r);return new ze(e).decodeArrayStream(t)}function Lo(r,e){let t=bi(r);return new ze(e).decodeStream(t)}var $i=no(ua(),1),ca=vo,da=xo,tt=Us,Vl=$i.DOMParser,zl=$i.XMLSerializer;var Hl=tt!==null;function Wl(){if(!Hl)throw new Error("@msgpack/msgpack is required for MessagePack support. Install with: npm install @msgpack/msgpack")}var Gl=Zp();function Zp(){if(!Hl)return null;let r=new TextEncoder,e=new TextDecoder,t=new tt.ExtensionCodec;return t.register({type:-1,encode:n=>{if(n instanceof Date){let i=kn(n);if(i==="D"||i==="H")return null}return tt.encodeTimestampExtension(n)},decode:n=>tt.decodeTimestampExtension(n)}),t.register({type:1,encode:n=>ye(n)?r.encode(n.toString()):null,decode:n=>Rr(e.decode(n))}),t.register({type:2,encode:n=>{if(n instanceof Date&&kn(n)==="D"){let i=n.getUTCFullYear(),s=String(n.getUTCMonth()+1).padStart(2,"0"),a=String(n.getUTCDate()).padStart(2,"0");return r.encode(`${i}-${s}-${a}`)}return null},decode:n=>new Date(e.decode(n)+"T00:00:00.000Z")}),t.register({type:3,encode:n=>{if(n instanceof Date&&kn(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 r.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",[l,u,c]=a.split(":"),d=Math.round(+o.substring(0,3));return new Date(Date.UTC(1970,0,1,+l,+u,+c,d))}}),t.register({type:4,encode:n=>{let i=fa(n);if(i!==null){let[s,a]=i;return r.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),l=Nt[a];if(l!==void 0){let[,u]=l;return u(o)}return`${o}::${a}`}}),t}function Xl(r){return Wl(),tt.encode(r,{extensionCodec:Gl})}function Yl(r){return Wl(),tt.decode(r,{extensionCodec:Gl})}function Li(r,e=!1){let t=Pi(r);if(t===null)return[!1,String(r)];let[n,i,s]=t;return s&&!e?[!1,String(r)]:[!0,`${i(r)}::${n}`]}function pa(r){if(!r.includes("::"))return[!1,r];let e=r.lastIndexOf("::"),t=r.slice(0,e),n=r.slice(e+2),i=Nt[n];if(i===void 0)return[!1,r];let[,s]=i;return[!0,s(t)]}function Fi(r,e,t){if(r!==null&&typeof r=="object"&&!Array.isArray(r)){let n={};for(let[i,s]of Object.entries(r))n[i]=Fi(s,e,t);return n}return Array.isArray(r)?r.map(n=>Fi(n,e,t)):t(r)?e(r):r}function ha(r){let e=Pi(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,a]=ha(i);return a&&(t=!0),s}),t]}if(r!==null&&typeof r=="object"){let t=!1,n={};for(let[i,s]of Object.entries(r)){let[a,o]=ha(s);o&&(t=!0),n[i]=a}return[n,t]}return[r,!1]}function Jp(r,e=!1){let[t,n]=Li(r,e);if(t)return n;let[i,s]=ha(r),a=JSON.stringify(i);return s?`${a}::JS`:a}function Kp(r){return JSON.stringify(r)}function Qp(r){if(!tt)throw new Error("@msgpack/msgpack is required for MessagePack support");return tt.encode(r)}function oe(r,e=null,{raw:t=!1,qs:n=!1,_forceSuffix:i=!1}={}){if(n)return`${Jl(r)}::QS`;if(t){if(e===null||e==="json")return Kp(r);if(e==="msgpack")return Qp(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=Jp(r,i);return e==="json"?`"${s}"`:s}else{if(e==="xml")return`<?xml version="1.0" ?><tytx_root>${Zl(r)}</tytx_root>`;if(e==="msgpack")return Xl(r);throw new Error(`Unknown transport: ${e}`)}}var Mr,ma;typeof window<"u"&&window.DOMParser?(Mr=window.DOMParser,ma=window.XMLSerializer):(Mr=Vl,ma=zl);function Kl(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 Ql(r,e,t){let n=r.createElement(e),i=t.attrs||{},s=t.value;for(let[a,o]of Object.entries(i))n.setAttribute(a,oe(o,null,{_forceSuffix:!0}));if(Array.isArray(s))for(let a of s)if(Kl(a)){let[o]=Object.keys(a),l=a[o],u=Ql(r,o,l);n.appendChild(u)}else{n.textContent=oe(s);break}else n.textContent=oe(s);return n}function Zl(r){if(!Mr)throw new Error("XML support requires @xmldom/xmldom package in Node.js");if(Kl(r)){let[e]=Object.keys(r),t=r[e],n=new Mr().parseFromString("<root/>","text/xml"),i=Ql(n,e,t);return new ma().serializeToString(i)}else return oe(r)}function ga(r){let e={};for(let n=0;n<r.attributes.length;n++){let i=r.attributes[n];e[i.name]=Q(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=ga(n);return{attrs:e,value:{[n.tagName]:i}}}else{let n=[];for(let i of t){let s=ga(i);n.push({[i.tagName]:s})}return{attrs:e,value:n}}return{attrs:e,value:Q(r.textContent)}}function eu(r){if(!Mr)throw new Error("XML support requires @xmldom/xmldom package in Node.js");let n=new Mr().parseFromString(r,"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 Q(n.textContent);n=s}let i=ga(n);return{[n.tagName]:i}}function eh(r){return typeof r=="string"}function th(r){let[e,t]=pa(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 Fi(i,rh,eh)}function rh(r){return r.includes("::")?pa(r)[1]:r}function nh(r){let e=eu(r);return typeof e=="string"?Q(e):e}function ih(r){return Yl(r)}function Q(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)),th(t)}else{if(e==="xml")return nh(r);if(e==="msgpack")return ih(r);throw new Error(`Unknown transport: ${e}`)}}function Jl(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]=Li(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 tu(r){if(!r)return[];let e=r.split("&"),t=e.map(a=>a.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(a=>Q(a));let s={};for(let a of e){let o=a.indexOf("="),l=a.slice(0,o),u=a.slice(o+1);s[l]=Q(u)}return s}var nu=ca||da||Number,iu=ca?"decimal.js":da?"big.js":"number";function _a(){return iu}function Rr(r){return new nu(r)}function ye(r){return iu==="number"?!1:r instanceof nu}function kn(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 sh(r){return r.toString()}function ah(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 oh(r){return r.toISOString()}function lh(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 uh(r){return r?"true":"false"}function ch(r){return r.toString()}function dh(r){return r.toString()}function fh(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 ji=[],ba=new Map;function fa(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 ji)if(t.prototype===e)return[n,i,s];return null}function Pi(r){if(r===null)return["NN",()=>"",!0];if(ye(r))return["N",sh,!1];if(r instanceof Uint8Array)return["RAW",fh,!1];if(r instanceof Date){let e=kn(r);return e==="D"?["D",ah,!1]:e==="H"?["H",lh,!1]:["DHZ",oh,!1]}return typeof r=="boolean"?["B",uh,!0]:typeof r=="number"?Number.isInteger(r)?["L",ch,!0]:["R",dh,!0]:fa(r)}function ph(r){return Rr(r)}function hh(r){let[e,t,n]=r.split("-").map(Number);return new Date(Date.UTC(e,t-1,n,0,0,0,0))}function ru(r){return new Date(r)}function mh(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 gh(r){return r.toLowerCase()==="true"}function bh(r){return parseInt(r,10)}function _h(r){return parseFloat(r)}function wh(r){return r}function yh(r){return null}var vh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;function kh(r){if(!vh.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 Eh(r){return tu(r)}var Ah=/^[A-Z]+$/,Nt={N:[Object,ph],D:[Date,hh],DH:[Date,ru],DHZ:[Date,ru],H:[Date,mh],L:[Number,bh],R:[Number,_h],T:[String,wh],B:[Boolean,gh],QS:[Object,Eh],NN:[null,yh],RAW:[Uint8Array,kh]};function En(r){return Object.hasOwn(Nt,r)?Nt[r][0]:null}function wa(r,e,t,n,i=!1){if(typeof e!="string"||!Ah.test(e))throw new Error(`TYTX suffix '${e}' is invalid: expected uppercase ASCII letters only`);let s=Nt[e];if(s!==void 0&&s[0]!==r){let a=s[0]===null?"null":s[0].name;throw new Error(`TYTX suffix '${e}' is already registered for ${a}`)}ji=ji.filter(([a])=>a!==r),ji.push([r,e,t,i]),Nt[e]=[r,n]}function Ht(r,e){ba.set(r,e)}function Ue(r){return ba.has(r)?ba.get(r):{}}var su={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 Th(r){let e=r._retryPolicy;return e==null?null:typeof e=="string"?su[e]||null:e}function Dh(r,e){return e.some(t=>t==="Error"?!0:r.name===t||r.constructor.name===t)}function Ch(r){return new Promise(e=>setTimeout(e,r))}async function Sh(r,e){if(!e)return r();let t=e.maxAttempts||3,n=e.delay||1,i=e.backoff||2,s=e.jitter!==!1,a=e.on||["Error"],o=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(o=c,u<t-1&&Dh(c,a)){let d=l;s&&(d*=1+Math.random()*.1),await Ch(d),l*=i}else throw c}throw o}var ee=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,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())}resolve(e={}){let{static:t=!1,...n}=e;if(t)return this._node?this._node._value:this.cachedValue;let i={...this._kw};if(this._node&&this._node.attr){let u=this.constructor.internalParams;for(let[c,d]of Object.entries(this._node.attr))u.has(c)||(i[c]=d)}Object.assign(i,n);let s=this._computeEffectiveFingerprint(i);if(s===this._lastEffectiveFingerprint&&!this.expired)return this.cachedValue;this._lastEffectiveFingerprint=s;let a=Th(this),o=()=>this.load(i);if(a)return Sh(o,a).then(u=>this._finalize(u));let l=o();return l&&typeof l.then=="function"?l.then(u=>this._finalize(u)):this._finalize(l)}_finalize(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)),this._lastUpdate=Date.now(),(!this.readOnly||this.cacheTime!==0)&&(this.cachedValue=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}};ee._BagClass=null;var Wt=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 rt=class r{constructor(e,t,n=null,i=null,s=null,a=null,o=null,l=!0){this.label=t,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,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=Q(`${t}::QS`);if(Array.isArray(i)){let s=i.length?i:Object.keys(this._attr),a=s.map(l=>{let u=this.getAttr(l);return!e&&u instanceof ee?u.resolve():u}),o=l=>i.length===0?Object.fromEntries(s.map((u,c)=>[u,l[c]])):l.length===1?l[0]:l;return a.some(l=>l&&typeof l.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,t=!0,n=null,i=null,s=!0,a=null,o=!1){e instanceof ee?(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,a,o))}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},a=this.resolver;a&&a._node===this&&(a._node=null),this.resolver=n,this.setValue(t,!1,{...e.attr},!1,!1,null);let o=this._buildAttrDiff(s,this._attr),l=Object.keys(o).length?o:null,u=i!==t||a!==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 a=s in e?e[s]:null,o=s in t?t[s]:null;a!==o&&(n[s]={old:a,new:o})}return n}setAttr(e=null,t=!0,n=!0,i=!0){let s=e||{},a=Object.keys(this._nodeSubscribers).length>0,l=t&&(a||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&&a)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 An=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("::")?Q(i):i;return n?this._list.findIndex(a=>a.getAttr(n)===s):this._list.findIndex(a=>a._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,a=null,o=!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),a!==null&&(a===!1?p.resolver=null:p.resolver=a),h?p.setAttr(i,c,!0,l):p.setValue(t,c,i,o,l,u,d);else{let m=s&&s.nodeClass?s.nodeClass:rt;p=new m(s,e,h?null:t,i,a,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 a=[...i].sort((c,d)=>c-d),o=a[0]<t?1:0,l=[];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),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+=o;for(let c of l)this._list.splice(u,0,c),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeInserted(c,u)}else{let a=i[0];if(a===t||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(t,0,o),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeInserted(o,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 uu=no(ua(),1);var ya="::RSLV:",Nh=new Map,Oh=new Map,Ui=new WeakMap,le=class extends Error{constructor(e){super(e),this.name="BagSerializationError"}},xn=class extends ee{constructor(e){super({asBag:!1}),Ui.set(this,e)}get payload(){return Ui.get(this)}load(){throw new le("This resolver is opaque; local execution is unavailable")}};function au(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 le("Invalid resolver description")}function ou(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 le("Resolver parameters must be JSON data; callbacks cannot travel");e.add(r);for(let t of Object.values(r))ou(t,e);e.delete(r)}}function Tn(r){if(Ui.has(r))return Ui.get(r);let e=Oh.get(r.constructor);if(!e)throw new le(`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 au(n),ou(n),ya+JSON.stringify(n)}function qi(r){if(typeof r!="string"||!r.startsWith(ya))return null;let e=r.slice(ya.length);if(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+$/.test(e))return new xn(r);let t;try{t=JSON.parse(e)}catch{throw new le("Invalid resolver JSON or signed token")}au(t);let n=Nh.get(JSON.stringify([t.resolver_module,t.resolver_class]));if(!n)return new xn(r);let i=n.decode({args:t.args??[],kwargs:t.kwargs});if(!(i instanceof n.cls))throw new le("Resolver decoder returned an incompatible instance");return i}function Vi(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[e,t instanceof ee?Tn(t):t]))}function va(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[e,qi(t)??t]))}var He="__cls";function $r(r,e){return r!==null&&r.tytxSuffix===e?r:En(e)}function Ih(r){let e=r.tytxSuffix,t=Object.entries(Ue(e)).filter(([,n])=>n===r).map(([n])=>n);if(t.length===0)throw new le(`${r.name} is not in the TYTX subtype dictionary of '${e}'`);if(t.length>1)throw new le(`${r.name} is in the TYTX subtype dictionary of '${e}' under several names: ${t.sort().join(", ")}`);return t[0]}function ka(r,e){let t=Ue(r);if(!Object.hasOwn(t,e))throw new le(`Unknown Bag class '${e}' for TYTX type '${r}'`);return t[e]}function Ea(r,e){return r===e?null:Ih(r)}function*cu(r,e=[]){for(let t of r){let n=[...e,t.label];yield[n,t];let i=t.getValue(!0);!t.resolver&&i instanceof z&&(yield*cu(i,n))}}function Bh(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 Fr(r){if(r===null||typeof r!="object")return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null}function Ot(r){return typeof r=="string"?r.includes("::")?`${r}::T`:r:Array.isArray(r)?r.map(Ot):Fr(r)?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Ot(t)])):r}function Aa(r){if(!Fr(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 lu=!1,z=class r{static tytxSuffix="X";constructor(e=null,t={}){this._nodes=new An,this._backref=!1,this._parent=null,this._parentNode=null,this._rootAttributes=null,this._updSubscribers={},this._insSubscribers={},this._delSubscribers={},Aa(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 rt}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 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 l=o.getValue(n);if(l instanceof r)s.shift(),i=l;else if(t){let u=i.createChildBag();o.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 a=s.shift();if(a.startsWith("#"))throw new Dn("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,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 a=this._nodes.get(e);return a?a.getValue(n,s,i):t}getItem(e,t=null,n=!1,i={}){if(!e)return this;let[s,a]=this._htraverse(e,!1,n);return s instanceof r?s.get(a,t,n,i):t}setItem(e,t,n=null,i=">",s=!1,a=!0,o=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,a,o,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,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,a]=this._htraverse(e,n,t);if(s instanceof r&&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,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,a=null,o=!1){for(let l of Object.values(this._updSubscribers))l({node:e,pathlist:t,oldvalue:i,attrs_diff:s,evt:n,reason:a,fired:o});this._parent&&this._parentNode&&this._parent._onNodeChanged(e,[this._parentNode.label,...t],n,i,s,a,o)}_onNodeInserted(e,t,n=null,i=null,s=!1){let a=e.parentBag,o=e.getValue(!0);a!==null&&a.backref&&o instanceof r&&o.setBackref(e,a),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:a=null}=t;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,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:a=!1}=t;(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,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,a=n&&typeof t=="string"?t.toLowerCase():t,o=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==a)return c}if(c._value instanceof r)if(i){let d=o(c._value);if(d)return d}else u.push(c._value)}for(let c of u){let d=o(c);if(d)return d}return null};return o(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,a=!0,o=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,b)=>{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 y=b();return g&&y instanceof r?null:y}else if(p.startsWith("#v.")){let y=p.split(".").slice(1).join("."),w=b();return w&&w.getItem?w.getItem(y):null}else{if(p==="#__v")return h.getValue(!0);if(p.startsWith("#a")){let y=p.includes(".")?p.split(".").slice(1).join("."):null;return h.getAttr(y)}else{let y=b();return y&&y.getItem?y.getItem(p):null}}};function*f(){let h=0;function*p(m,g){for(let b of m._nodes){let y=g?`${g}.${b.label}`:b.label,w=!1,A,C=()=>(w||(A=b.getValue(l),w=!0),A);if((s&&a||(C()instanceof r?a:s))&&(t===null||t(b))&&(yield c.length===1?d(b,c[0],y,i,C):c.map(Y=>d(b,Y,y,i,C)),h++,o!==null&&h>=o))return;if(i){let Y=C();if(Y instanceof r&&(yield*p(Y,y),o!==null&&h>=o))return}}}yield*p(u,"")}return n?f():[...f()]}getLeaves(){let e=[],t=(n,i)=>{for(let s of n._nodes){let a=i?`${i}.${s.label}`:s.label,o=s.getValue(!1);o instanceof r?t(o,a):e.push([a,o])}};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 a=s[0].length,o=[];for(let l=0;l<a;l++)o.push(s.map(u=>u[l]));return o}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 a=0,o=!1;for(let l of this.query(s,n)){if(l==null||l===""){o=!0;continue}if(typeof l!="number"&&typeof l!="boolean"){if(t)throw new TypeError(`sum encountered non-numeric value: ${typeof l}`);continue}a+=l}return t&&o?null:a};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 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 l=o==="d"||o==="D",u=o==="a"||o==="d",c;if(a.toLowerCase()==="#k")c=d=>t(d.label,u);else if(a.toLowerCase()==="#v")c=d=>t(d.value,u);else if(a.toLowerCase().startsWith("#a.")){let d=a.slice(3);c=f=>t(f.getAttr(d),u)}else c=d=>{let f=d.value,h=f instanceof r?f.getItem(a):f?f[a]: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 Wt({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 a of this._nodes){let o=a.value;if(i&&o==null)continue;let l=a.label;e&&(l=String(l)),t&&(l=l.toLowerCase()),n&&o instanceof r&&(o=r.prototype.asDict.call(o,e,t,n,i)),Object.defineProperty(s,l,{value:o,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 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=t==="static"?s.resolver:null,l=o?null:s.getValue(),u=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();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(a,o||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 a=new this.nodeClass(this,e,null,n,i,s,null,!1);return t instanceof ee?a.resolver=t:a._value=t,this._nodes._dict[e]=a,this._nodes._list.push(a),a}fillFrom(e=null,t={}){let n=Aa(t);if(e!=null&&!Fr(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,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&&(Fr(p)||Array.isArray(p))&&(p=this.createChildBag(),a(p,h,`${u}[${JSON.stringify(f)}]`)),o._appendLiteral(f,p)}}finally{s.delete(l)}};return e!=null&&a(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=(a,o)=>{for(let l=0;l<a._nodes.length;l++){let u=a._nodes._list[l],c={...o};"_pathlist"in o&&(c._pathlist=[...o._pathlist,u.label]),"_indexlist"in o&&(c._indexlist=[...o._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[a,o]of cu(this)){let l=a.slice(0,-1),u=JSON.stringify(a),c=JSON.stringify(l),d=o.getValue(!0),f,h=null;if(o.resolver)f=Tn(o.resolver);else if(d instanceof r){let g=d.constructor,b=g.tytxSuffix;s.set(u,g),h=Ea(g,$r(s.get(c),b)),f=`::${b}`}else d===null?f="::NN":f=Ot(d);if(o.attr&&Object.hasOwn(o.attr,He))throw new le(`node '${a}': the attribute '${He}' is reserved for the Bag class name`);let p=Vi(Ot(o.attr));h!==null&&(p[He]=h);let m=o.nodeTag;t?(yield[l.length?n[c]:null,o.label,m,f,p],d instanceof r&&(n[u]=i,e[i]=a,i++)):yield[l,o.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 hi(new Ve(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=Ea(n,$r(null,n.tytxSuffix));return i!==null&&(t[He]=i),t.rows=t.rows.map(([s,a,o,l,u])=>[Ot(s),Ot(a),Ot(o),l,u]),t.paths&&(t.paths=Ot(t.paths)),oe(t)}static fromTytx(e,t="json",n={}){if(Fr(t)&&(n=t,t="json"),Aa(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=Q(e,t==="json"?null:t);if(i instanceof r)return i;if(!Fr(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($r(null,t));let n=Q(e);if(!n||!Array.isArray(n.rows))throw new le("Invalid TYTX Bag: expected rows");let i=n.paths,s=i!=null,a=Object.hasOwn(n,He)?ka(t,n[He]):$r(null,t),o=new a,l=new Map([["[]",o]]);for(let u of n.rows){if(!Array.isArray(u)||u.length!==5)throw new le("Invalid TYTX Bag row");let[c,d,f,h,p]=u,m=c??"";if(s){if(c!==null&&!Object.hasOwn(i,c))throw new le(`Unknown TYTX parent reference: ${c}`);m=c===null?"":i[c]}if(typeof m=="string"&&(m=m?m.split("."):[]),!Array.isArray(m))throw new le("Invalid TYTX parent path");let g=JSON.stringify(m);if(!l.has(g))throw new le(`Missing or undecodable TYTX parent branch: ${m}`);let b=l.get(g),y=JSON.stringify([...m,d]),w=h,A=qi(w),C=va(p),j=Object.hasOwn(C,He)?C[He]:null;if(delete C[He],w instanceof r){let k=w.constructor.tytxSuffix,te=j!==null?ka(k,j):$r(b.constructor,k);w=new te,l.set(y,w)}else if(j!==null)throw new le(`node '${y}': the attribute '${He}' is reserved for the Bag class name of a branch`);let Y=b._appendLiteral(d,A?null:w,C,A);Y.nodeTag=f??null}return o}toXml(e={}){let{pretty:t=!1,encoding:n="UTF-8",docHeader:i=null,selfClosedTags:s=null}=e,a=this._bagToXml(s,t);return i===!0?a=`<?xml version='1.0' encoding='${n}'?>
13
+ `)}function Gl(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||zt.assign,this.domHandler=r.domHandler||Fi,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||Hl,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}Gl.prototype.parseFromString=function(r,e){if(!Yp(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var t=this.assign(Object.create(null),this.xmlns),n=ql.XML_ENTITIES,i=t[""]||null;Gp(e)?(n=ql.HTML_ENTITIES,i=ha.HTML):e===Wl.XML_SVG_IMAGE&&(i=ha.SVG),t[""]=i,t.xml=t.xml||ha.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 Zp;o.errorHandler=s,o.domBuilder=s;var l=!zt.isHTMLMimeType(e);return l&&typeof r!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(r)),t,n),s.doc.documentElement||o.errorHandler.fatalError("missing root element"),s.doc};function Fi(r){var e=r||{};this.mimeType=e.mimeType||Wl.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 Br(r,e){e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber}Fi.prototype={startDocument:function(){var r=new Hp;this.doc=Xp(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),a=n.length;$i(this,s),this.currentElement=s,this.locator&&Br(this.locator,s);for(var o=0;o<a;o++){var r=n.getURI(o),l=n.getValue(o),t=n.getQName(o),u=i.createAttributeNS(r,t);this.locator&&Br(n.getLocator(o),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&&Br(this.locator,t),$i(this,t)},ignorableWhitespace:function(r,e,t){},characters:function(r,e,t){if(r=zl.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&&Br(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=zl.apply(this,arguments);var n=this.doc.createComment(r);this.locator&&Br(this.locator,n),$i(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&&Br(this.locator,s),$i(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 Vl("Reporting "+r+' "'+e+'" caused '+t,this.locator)}else console.error("[xmldom "+r+"] "+e,Jp(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 Vl(r,this.locator,e)}};function Jp(r){if(r)return`
14
+ @#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}function zl(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){Fi.prototype[r]=function(){return null}});function $i(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}function Kp(r){if(r==="error")throw"onErrorStopParsing"}function Qp(){throw"onWarningStopParsing"}Rr.__DOMHandler=Fi;Rr.DOMParser=Gl;Rr.normalizeLineEndings=Hl;Rr.onErrorStopParsing=Kp;Rr.onWarningStopParsing=Qp});var ma=_t(q=>{"use strict";var Mr=qt();q.assign=Mr.assign;q.hasDefaultHTMLNamespace=Mr.hasDefaultHTMLNamespace;q.isHTMLMimeType=Mr.isHTMLMimeType;q.isValidMimeType=Mr.isValidMimeType;q.MIME_TYPE=Mr.MIME_TYPE;q.NAMESPACE=Mr.NAMESPACE;var Li=dn();q.DOMException=Li.DOMException;q.DOMExceptionName=Li.DOMExceptionName;q.ExceptionCode=Li.ExceptionCode;q.ParseError=Li.ParseError;var me=fa();q.Attr=me.Attr;q.CDATASection=me.CDATASection;q.CharacterData=me.CharacterData;q.Comment=me.Comment;q.Document=me.Document;q.DocumentFragment=me.DocumentFragment;q.DocumentType=me.DocumentType;q.DOMImplementation=me.DOMImplementation;q.Element=me.Element;q.Entity=me.Entity;q.EntityReference=me.EntityReference;q.LiveNodeList=me.LiveNodeList;q.NamedNodeMap=me.NamedNodeMap;q.Node=me.Node;q.NodeList=me.NodeList;q.Notation=me.Notation;q.ProcessingInstruction=me.ProcessingInstruction;q.Text=me.Text;q.XMLSerializer=me.XMLSerializer;var Pi=Xl();q.DOMParser=Pi.DOMParser;q.normalizeLineEndings=Pi.normalizeLineEndings;q.onErrorStopParsing=Pi.onErrorStopParsing;q.onWarningStopParsing=Pi.onWarningStopParsing});var Xe=class{constructor(e,{fetcher:t=globalThis.fetch?.bind(globalThis),closeUrl:n="/gramlot/close",navigator:i=globalThis.navigator}={}){this.rpcUrl=e,this.fetcher=t,this.closeUrl=n,this.navigator=i}async call(e,t){let n=await this.fetcher(this.rpcUrl,{method:"POST",credentials:"same-origin",signal:t,headers:{"Content-Type":"application/json"},body:e});if(n.status!==200)throw new Error(`rpc failed: HTTP ${n.status}`);return n.text()}close(e,{beacon:t=!1}={}){let n=JSON.stringify({pageId:e});if(t)try{this.navigator.sendBeacon(this.closeUrl,new Blob([n],{type:"application/json"}))}catch{}else try{Promise.resolve(this.fetcher(this.closeUrl,{method:"POST",credentials:"same-origin",keepalive:!0,headers:{"Content-Type":"application/json"},body:n})).catch(()=>{})}catch{}}};function G(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 co=/^\{(\??[A-Za-z_][A-Za-z0-9_]*|\?)?\}/;function Zr(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(co);if(!s)throw new SyntaxError("Invalid pointer template placeholder");let a=s[1]??"",o=a.startsWith("?"),l=e(o?a.slice(1):a);l==null||l===""&&!o?n=!0:t+=String(l),i+=s[0].length}return n?null:t}function hr(r){let e=[],t=new Set,n="",i=!0;for(let s=0;s<r.length;){let a=s,o=r[s];if(o==='"'||o==="'"||o==="`"){for(s++;s<r.length;){if(r[s]==="\\"){s+=2;continue}if(r[s++]===o)break}n+=r.slice(a,s),i=!1;continue}if(r.startsWith("//",s)){s=r.indexOf(`
15
+ `,s),s<0&&(s=r.length),n+=r.slice(a,s);continue}if(r.startsWith("/*",s)){let c=r.indexOf("*/",s+2);s=c<0?r.length:c+2,n+=r.slice(a,s);continue}if(o==="/"&&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(a,s),i=!1;continue}let l=o==="{"?r.slice(s).match(co):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+=o,s++,/\s/.test(o)||(i=/[([{,:;=!?&|+*%~<>\/-]/.test(o))}return{text:n,slots:e,identifiers:t}}function fo(r,e,t=()=>null){let n=new Map,i=[],s=a=>{if(n.has(a))return n.get(a);if(!r.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=r.get(a),l=typeof a=="string"?G(o):null,u=e.get(a);if(l){let c=d=>d?s(d):e.get(a);if(l.expression){let d=hr(l.body);u=t(a,o,d,d.slots.map(c))}else u=Zr(l.body,c),e.get(a)==null&&(u=null)}return n.set(a,u),u}finally{i.pop()}};return new Map([...r.keys()].map(a=>[a,s(a)]))}function at(r,e){let t=new Map([...Object.entries(r.getAttr()),...r.fixedAttrItems()]),n=new Set,i=[],s=a=>{let o=G(a);if(!o)return;let l=[];o.expression?l.push(...hr(o.body).slots):Zr(o.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 mr=9e15,kt=1e9,Is="0123456789abcdef",ui="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",ci="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Bs={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-mr,maxE:mr,crypto:!1},go,ot,M=!0,fi="[DecimalError] ",vt=fi+"Invalid argument: ",bo=fi+"Precision limit exceeded",_o=fi+"crypto unavailable",wo="[object Decimal]",Ae=Math.floor,pe=Math.pow,Bc=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Rc=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Mc=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,yo=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,qe=1e7,I=7,$c=9007199254740991,Fc=ui.length-1,Rs=ci.length-1,_={toStringTag:wo};_.absoluteValue=_.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),C(r)};_.ceil=function(){return C(new this.constructor(this),this.e+1,2)};_.clampedTo=_.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(vt+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new i(n)};_.comparedTo=_.cmp=function(r){var e,t,n,i,s=this,a=s.d,o=(r=new s.constructor(r)).d,l=s.s,u=r.s;if(!a||!o)return!l||!u?NaN:l!==u?l:a===o?0:!a^l<0?1:-1;if(!a[0]||!o[0])return a[0]?l:o[0]?-u:0;if(l!==u)return l;if(s.e!==r.e)return s.e>r.e^l<0?1:-1;for(n=a.length,i=o.length,e=0,t=n<i?n:i;e<t;++e)if(a[e]!==o[e])return a[e]>o[e]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};_.cosine=_.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())+I,n.rounding=1,t=Lc(n,xo(n,t)),n.precision=r,n.rounding=e,C(ot==2||ot==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};_.cubeRoot=_.cbrt=function(){var r,e,t,n,i,s,a,o,l,u,c=this,d=c.constructor;if(!c.isFinite()||c.isZero())return new d(c);for(M=!1,s=c.s*pe(c.s*c,1/3),!s||Math.abs(s)==1/0?(t=we(c.d),r=c.e,(s=(r-t.length+1)%3)&&(t+=s==1||s==-2?"0":"00"),s=pe(t,1/3),r=Ae((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()),a=(r=d.precision)+3;;)if(o=n,l=o.times(o).times(o),u=l.plus(c),n=J(u.plus(c).times(o),u.plus(l),a+2,1),we(o.d).slice(0,a)===(t=we(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!i&&t=="4999"){if(!i&&(C(o,r+1,0),o.times(o).times(o).eq(c))){n=o;break}a+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(C(n,r+1,1),e=!n.times(n).times(n).eq(c));break}return M=!0,C(n,r,d.rounding,e)};_.decimalPlaces=_.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-Ae(this.e/I))*I,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};_.dividedBy=_.div=function(r){return J(this,new this.constructor(r))};_.dividedToIntegerBy=_.divToInt=function(r){var e=this,t=e.constructor;return C(J(e,new t(r),0,1,1),t.precision,t.rounding)};_.equals=_.eq=function(r){return this.cmp(r)===0};_.floor=function(){return C(new this.constructor(this),this.e+1,3)};_.greaterThan=_.gt=function(r){return this.cmp(r)>0};_.greaterThanOrEqualTo=_.gte=function(r){var e=this.cmp(r);return e==1||e===0};_.hyperbolicCosine=_.cosh=function(){var r,e,t,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;t=a.precision,n=a.rounding,a.precision=t+Math.max(s.e,s.sd())+4,a.rounding=1,i=s.d.length,i<32?(r=Math.ceil(i/3),e=(1/hi(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),s=gr(a,1,s.times(e),new a(1),!0);for(var l,u=r,c=new a(8);u--;)l=s.times(s),s=o.minus(l.times(c.minus(l.times(c))));return C(s,a.precision=t,a.rounding=n,!0)};_.hyperbolicSine=_.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=gr(s,2,i,i,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/hi(5,r)),i=gr(s,2,i,i,!0);for(var a,o=new s(5),l=new s(16),u=new s(20);r--;)a=i.times(i),i=i.times(o.plus(a.times(l.times(a).plus(u))))}return s.precision=e,s.rounding=t,C(i,e,t,!0)};_.hyperbolicTangent=_.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)};_.inverseCosine=_.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()?Ye(e,n,i):new e(0):new e(NaN):r.isZero()?Ye(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))};_.inverseHyperbolicCosine=_.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,M=!1,t=t.times(t).minus(1).sqrt().plus(t),M=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};_.inverseHyperbolicSine=_.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,M=!1,t=t.times(t).plus(1).sqrt().plus(t),M=!0,n.precision=r,n.rounding=e,t.ln())};_.inverseHyperbolicTangent=_.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?C(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)};_.inverseSine=_.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=Ye(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)))};_.inverseTangent=_.atan=function(){var r,e,t,n,i,s,a,o,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<=Rs)return a=Ye(c,d+4,f).times(.25),a.s=u.s,a}else{if(!u.s)return new c(NaN);if(d+4<=Rs)return a=Ye(c,d+4,f).times(.5),a.s=u.s,a}for(c.precision=o=d+10,c.rounding=1,t=Math.min(28,o/I+2|0),r=t;r;--r)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(M=!1,e=Math.ceil(o/I),n=1,l=u.times(u),a=new c(u),i=u;r!==-1;)if(i=i.times(l),s=a.minus(i.div(n+=2)),i=i.times(l),a=s.plus(i.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===s.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),M=!0,C(a,c.precision=d,c.rounding=f,!0)};_.isFinite=function(){return!!this.d};_.isInteger=_.isInt=function(){return!!this.d&&Ae(this.e/I)>this.d.length-2};_.isNaN=function(){return!this.s};_.isNegative=_.isNeg=function(){return this.s<0};_.isPositive=_.isPos=function(){return this.s>0};_.isZero=function(){return!!this.d&&this.d[0]===0};_.lessThan=_.lt=function(r){return this.cmp(r)<0};_.lessThanOrEqualTo=_.lte=function(r){return this.cmp(r)<1};_.logarithm=_.log=function(r){var e,t,n,i,s,a,o,l,u=this,c=u.constructor,d=c.precision,f=c.rounding,p=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(M=!1,o=d+p,a=yt(u,o),n=e?di(c,o+10):yt(r,o),l=J(a,n,o,1),Jr(l.d,i=d,f))do if(o+=10,a=yt(u,o),n=e?di(c,o+10):yt(r,o),l=J(a,n,o,1),!s){+we(l.d).slice(i+1,i+15)+1==1e14&&(l=C(l,d+1,0));break}while(Jr(l.d,i+=10,f));return M=!0,C(l,d,f)};_.minus=_.sub=function(r){var e,t,n,i,s,a,o,l,u,c,d,f,p=this,h=p.constructor;if(r=new h(r),!p.d||!r.d)return!p.s||!r.s?r=new h(NaN):p.d?r.s=-r.s:r=new h(r.d||p.s!==r.s?p:NaN),r;if(p.s!=r.s)return r.s=-r.s,p.plus(r);if(u=p.d,f=r.d,o=h.precision,l=h.rounding,!u[0]||!f[0]){if(f[0])r.s=-r.s;else if(u[0])r=new h(p);else return new h(l===3?-0:0);return M?C(r,o,l):r}if(t=Ae(r.e/I),c=Ae(p.e/I),u=u.slice(),s=c-t,s){for(d=s<0,d?(e=u,s=-s,a=f.length):(e=f,t=c,a=u.length),n=Math.max(Math.ceil(o/I),a)+2,s>n&&(s=n,e.length=1),e.reverse(),n=s;n--;)e.push(0);e.reverse()}else{for(n=u.length,a=f.length,d=n<a,d&&(a=n),n=0;n<a;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),a=u.length,n=f.length-a;n>0;--n)u[a++]=0;for(n=f.length;n>s;){if(u[--n]<f[n]){for(i=n;i&&u[--i]===0;)u[i]=qe-1;--u[i],u[n]+=qe}u[n]-=f[n]}for(;u[--a]===0;)u.pop();for(;u[0]===0;u.shift())--t;return u[0]?(r.d=u,r.e=pi(u,t),M?C(r,o,l):r):new h(l===3?-0:0)};_.modulo=_.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]?C(new n(t),n.precision,n.rounding):(M=!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),M=!0,t.minus(e))};_.naturalExponential=_.exp=function(){return Ms(this)};_.naturalLogarithm=_.ln=function(){return yt(this)};_.negated=_.neg=function(){var r=new this.constructor(this);return r.s=-r.s,C(r)};_.plus=_.add=function(r){var e,t,n,i,s,a,o,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,o=f.precision,l=f.rounding,!u[0]||!c[0])return c[0]||(r=new f(d)),M?C(r,o,l):r;if(s=Ae(d.e/I),n=Ae(r.e/I),u=u.slice(),i=s-n,i){for(i<0?(t=u,i=-i,a=c.length):(t=c,n=s,a=u.length),s=Math.ceil(o/I),a=s>a?s+1:a+1,i>a&&(i=a,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for(a=u.length,i=c.length,a-i<0&&(i=a,t=c,c=u,u=t),e=0;i;)e=(u[--i]=u[i]+c[i]+e)/qe|0,u[i]%=qe;for(e&&(u.unshift(e),++n),a=u.length;u[--a]==0;)u.pop();return r.d=u,r.e=pi(u,n),M?C(r,o,l):r};_.precision=_.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(vt+r);return t.d?(e=vo(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};_.round=function(){var r=this,e=r.constructor;return C(new e(r),r.e+1,e.rounding)};_.sine=_.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())+I,n.rounding=1,t=jc(n,xo(n,t)),n.precision=r,n.rounding=e,C(ot>2?t.neg():t,r,e,!0)):new n(NaN)};_.squareRoot=_.sqrt=function(){var r,e,t,n,i,s,a=this,o=a.d,l=a.e,u=a.s,c=a.constructor;if(u!==1||!o||!o[0])return new c(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);for(M=!1,u=Math.sqrt(+a),u==0||u==1/0?(e=we(o),(e.length+l)%2==0&&(e+="0"),u=Math.sqrt(e),l=Ae((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(a,s,t+2,1)).times(.5),we(s.d).slice(0,t)===(e=we(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!i&&e=="4999"){if(!i&&(C(s,l+1,0),s.times(s).eq(a))){n=s;break}t+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(C(n,l+1,1),r=!n.times(n).eq(a));break}return M=!0,C(n,l,c.rounding,r)};_.tangent=_.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,C(ot==2||ot==4?t.neg():t,r,e,!0)):new n(NaN)};_.times=_.mul=function(r){var e,t,n,i,s,a,o,l,u,c=this,d=c.constructor,f=c.d,p=(r=new d(r)).d;if(r.s*=c.s,!f||!f[0]||!p||!p[0])return new d(!r.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:!f||!p?r.s/0:r.s*0);for(t=Ae(c.e/I)+Ae(r.e/I),l=f.length,u=p.length,l<u&&(s=f,f=p,p=s,a=l,l=u,u=a),s=[],a=l+u,n=a;n--;)s.push(0);for(n=u;--n>=0;){for(e=0,i=l+n;i>n;)o=s[i]+p[n]*f[i-n-1]+e,s[i--]=o%qe|0,e=o/qe|0;s[i]=(s[i]+e)%qe|0}for(;!s[--a];)s.pop();return e?++t:s.shift(),r.d=s,r.e=pi(s,t),M?C(r,d.precision,d.rounding):r};_.toBinary=function(r,e){return $s(this,2,r,e)};_.toDecimalPlaces=_.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Ie(r,0,kt),e===void 0?e=n.rounding:Ie(e,0,8),C(t,r+t.e+1,e))};_.toExponential=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ze(n,!0):(Ie(r,0,kt),e===void 0?e=i.rounding:Ie(e,0,8),n=C(new i(n),r+1,e),t=Ze(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};_.toFixed=function(r,e){var t,n,i=this,s=i.constructor;return r===void 0?t=Ze(i):(Ie(r,0,kt),e===void 0?e=s.rounding:Ie(e,0,8),n=C(new s(i),r+i.e+1,e),t=Ze(n,!1,r+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t};_.toFraction=function(r){var e,t,n,i,s,a,o,l,u,c,d,f,p=this,h=p.d,m=p.constructor;if(!h)return new m(p);if(u=t=new m(1),n=l=new m(0),e=new m(n),s=e.e=vo(h)-p.e-1,a=s%I,e.d[0]=pe(10,a<0?I+a:a),r==null)r=s>0?e:u;else{if(o=new m(r),!o.isInt()||o.lt(u))throw Error(vt+o);r=o.gt(e)?s>0?e:u:o}for(M=!1,o=new m(we(h)),c=m.precision,m.precision=s=h.length*I*2;d=J(o,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=o.minus(d.times(i)),o=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=p.s,f=J(u,n,s,1).minus(p).abs().cmp(J(l,t,s,1).minus(p).abs())<1?[u,n]:[l,t],m.precision=c,M=!0,f};_.toHexadecimal=_.toHex=function(r,e){return $s(this,16,r,e)};_.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:Ie(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]?(M=!1,t=J(t,r,0,e,1).times(r),M=!0,C(t)):(r.s=t.s,t=r),t};_.toNumber=function(){return+this};_.toOctal=function(r,e){return $s(this,8,r,e)};_.toPower=_.pow=function(r){var e,t,n,i,s,a,o=this,l=o.constructor,u=+(r=new l(r));if(!o.d||!r.d||!o.d[0]||!r.d[0])return new l(pe(+o,u));if(o=new l(o),o.eq(1))return o;if(n=l.precision,s=l.rounding,r.eq(1))return C(o,n,s);if(e=Ae(r.e/I),e>=r.d.length-1&&(t=u<0?-u:u)<=$c)return i=ko(l,o,t,n),r.s<0?new l(1).div(i):C(i,n,s);if(a=o.s,a<0){if(e<r.d.length-1)return new l(NaN);if((r.d[e]&1)==0&&(a=1),o.e==0&&o.d[0]==1&&o.d.length==1)return o.s=a,o}return t=pe(+o,u),e=t==0||!isFinite(t)?Ae(u*(Math.log("0."+we(o.d))/Math.LN10+o.e+1)):new l(t+"").e,e>l.maxE+1||e<l.minE-1?new l(e>0?a/0:0):(M=!1,l.rounding=o.s=1,t=Math.min(12,(e+"").length),i=Ms(r.times(yt(o,n+t)),n),i.d&&(i=C(i,n+5,1),Jr(i.d,n,s)&&(e=n+10,i=C(Ms(r.times(yt(o,e+t)),e),e+5,1),+we(i.d).slice(n+1,n+15)+1==1e14&&(i=C(i,n+1,0)))),i.s=a,M=!0,l.rounding=s,C(i,n,s))};_.toPrecision=function(r,e){var t,n=this,i=n.constructor;return r===void 0?t=Ze(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ie(r,1,kt),e===void 0?e=i.rounding:Ie(e,0,8),n=C(new i(n),r,e),t=Ze(n,r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};_.toSignificantDigits=_.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Ie(r,1,kt),e===void 0?e=n.rounding:Ie(e,0,8)),C(new n(t),r,e)};_.toString=function(){var r=this,e=r.constructor,t=Ze(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};_.truncated=_.trunc=function(){return C(new this.constructor(this),this.e+1,1)};_.valueOf=_.toJSON=function(){var r=this,e=r.constructor,t=Ze(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function we(r){var e,t,n,i=r.length-1,s="",a=r[0];if(i>0){for(s+=a,e=1;e<i;e++)n=r[e]+"",t=I-n.length,t&&(s+=wt(t)),s+=n;a=r[e],n=a+"",t=I-n.length,t&&(s+=wt(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}function Ie(r,e,t){if(r!==~~r||r<e||r>t)throw Error(vt+r)}function Jr(r,e,t,n){var i,s,a,o;for(s=r[0];s>=10;s/=10)--e;return--e<0?(e+=I,i=0):(i=Math.ceil((e+1)/I),e%=I),s=pe(10,I-e),o=r[i]%s|0,n==null?e<3?(e==0?o=o/100|0:e==1&&(o=o/10|0),a=t<4&&o==99999||t>3&&o==49999||o==5e4||o==0):a=(t<4&&o+1==s||t>3&&o+1==s/2)&&(r[i+1]/s/100|0)==pe(10,e-2)-1||(o==s/2||o==0)&&(r[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||t<4)&&o==9999||!n&&t>3&&o==4999):a=((n||t<4)&&o+1==s||!n&&t>3&&o+1==s/2)&&(r[i+1]/s/1e3|0)==pe(10,e-3)-1,a}function oi(r,e,t){for(var n,i=[0],s,a=0,o=r.length;a<o;){for(s=i.length;s--;)i[s]*=e;for(i[0]+=Is.indexOf(r.charAt(a++)),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 Lc(r,e){var t,n,i;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),i=(1/hi(4,t)).toString()):(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=gr(r,1,e.times(i),new r(1));for(var s=t;s--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}var J=(function(){function r(n,i,s){var a,o=0,l=n.length;for(n=n.slice();l--;)a=n[l]*i+o,n[l]=a%s|0,o=a/s|0;return o&&n.unshift(o),n}function e(n,i,s,a){var o,l;if(s!=a)l=s>a?1:-1;else for(o=l=0;o<s;o++)if(n[o]!=i[o]){l=n[o]>i[o]?1:-1;break}return l}function t(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,l){var u,c,d,f,p,h,m,g,b,y,w,A,S,B,W,re,ue,x,Q,ne,ie=n.constructor,z=n.s==i.s?1:-1,ee=n.d,N=i.d;if(!ee||!ee[0]||!N||!N[0])return new ie(!n.s||!i.s||(ee?N&&ee[0]==N[0]:!N)?NaN:ee&&ee[0]==0||!N?z*0:z/0);for(l?(p=1,c=n.e-i.e):(l=qe,p=I,c=Ae(n.e/p)-Ae(i.e/p)),Q=N.length,ue=ee.length,b=new ie(z),y=b.d=[],d=0;N[d]==(ee[d]||0);d++);if(N[d]>(ee[d]||0)&&c--,s==null?(B=s=ie.precision,a=ie.rounding):o?B=s+(n.e-i.e)+1:B=s,B<0)y.push(1),h=!0;else{if(B=B/p+2|0,d=0,Q==1){for(f=0,N=N[0],B++;(d<ue||f)&&B--;d++)W=f*l+(ee[d]||0),y[d]=W/N|0,f=W%N|0;h=f||d<ue}else{for(f=l/(N[0]+1)|0,f>1&&(N=r(N,f,l),ee=r(ee,f,l),Q=N.length,ue=ee.length),re=Q,w=ee.slice(0,Q),A=w.length;A<Q;)w[A++]=0;ne=N.slice(),ne.unshift(0),x=N[0],N[1]>=l/2&&++x;do f=0,u=e(N,w,Q,A),u<0?(S=w[0],Q!=A&&(S=S*l+(w[1]||0)),f=S/x|0,f>1?(f>=l&&(f=l-1),m=r(N,f,l),g=m.length,A=w.length,u=e(m,w,g,A),u==1&&(f--,t(m,Q<g?ne:N,g,l))):(f==0&&(u=f=1),m=N.slice()),g=m.length,g<A&&m.unshift(0),t(w,m,A,l),u==-1&&(A=w.length,u=e(N,w,Q,A),u<1&&(f++,t(w,Q<A?ne:N,A,l))),A=w.length):u===0&&(f++,w=[0]),y[d++]=f,u&&w[0]?w[A++]=ee[re]||0:(w=[ee[re]],A=1);while((re++<ue||w[0]!==void 0)&&B--);h=w[0]!==void 0}y[0]||y.shift()}if(p==1)b.e=c,go=h;else{for(d=1,f=y[0];f>=10;f/=10)d++;b.e=d+c*p-1,C(b,o?s+b.e+1:s,a,h)}return b}})();function C(r,e,t,n){var i,s,a,o,l,u,c,d,f,p=r.constructor;e:if(e!=null){if(d=r.d,!d)return r;for(i=1,o=d[0];o>=10;o/=10)i++;if(s=e-i,s<0)s+=I,a=e,c=d[f=0],l=c/pe(10,i-a-1)%10|0;else if(f=Math.ceil((s+1)/I),o=d.length,f>=o)if(n){for(;o++<=f;)d.push(0);c=l=0,i=1,s%=I,a=s-I+1}else break e;else{for(c=o=d[f],i=1;o>=10;o/=10)i++;s%=I,a=s-I+i,l=a<0?0:c/pe(10,i-a-1)%10|0}if(n=n||e<0||d[f+1]!==void 0||(a<0?c:c%pe(10,i-a-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?a>0?c/pe(10,i-a):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]=pe(10,(I-e%I)%I),r.e=-e||0):d[0]=r.e=0,r;if(s==0?(d.length=f,o=1,f--):(d.length=f+1,o=pe(10,I-s),d[f]=a>0?(c/pe(10,i-a)%pe(10,a)|0)*o:0),u)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&&(r.e++,d[0]==qe&&(d[0]=1));break}else{if(d[f]+=o,d[f]!=qe)break;d[f--]=0,o=1}for(s=d.length;d[--s]===0;)d.pop()}return M&&(r.e>p.maxE?(r.d=null,r.e=NaN):r.e<p.minE&&(r.e=0,r.d=[0])),r}function Ze(r,e,t){if(!r.isFinite())return Ao(r);var n,i=r.e,s=we(r.d),a=s.length;return e?(t&&(n=t-a)>0?s=s.charAt(0)+"."+s.slice(1)+wt(n):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(r.e<0?"e":"e+")+r.e):i<0?(s="0."+wt(-i-1)+s,t&&(n=t-a)>0&&(s+=wt(n))):i>=a?(s+=wt(i+1-a),t&&(n=t-i-1)>0&&(s=s+"."+wt(n))):((n=i+1)<a&&(s=s.slice(0,n)+"."+s.slice(n)),t&&(n=t-a)>0&&(i+1===a&&(s+="."),s+=wt(n))),s}function pi(r,e){var t=r[0];for(e*=I;t>=10;t/=10)e++;return e}function di(r,e,t){if(e>Fc)throw M=!0,t&&(r.precision=t),Error(bo);return C(new r(ui),e,1,!0)}function Ye(r,e,t){if(e>Rs)throw Error(bo);return C(new r(ci),e,t,!0)}function vo(r){var e=r.length-1,t=e*I+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 wt(r){for(var e="";r--;)e+="0";return e}function ko(r,e,t,n){var i,s=new r(1),a=Math.ceil(n/I+4);for(M=!1;;){if(t%2&&(s=s.times(e),ho(s.d,a)&&(i=!0)),t=Ae(t/2),t===0){t=s.d.length-1,i&&s.d[t]===0&&++s.d[t];break}e=e.times(e),ho(e.d,a)}return M=!0,s}function po(r){return r.d[r.d.length-1]&1}function Eo(r,e,t){for(var n,i,s=new r(e[0]),a=0;++a<e.length;){if(i=new r(e[a]),!i.s){s=i;break}n=s.cmp(i),(n===t||n===0&&s.s===t)&&(s=i)}return s}function Ms(r,e){var t,n,i,s,a,o,l,u=0,c=0,d=0,f=r.constructor,p=f.rounding,h=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?(M=!1,l=h):l=e,o=new f(.03125);r.e>-2;)r=r.times(o),d+=5;for(n=Math.log(pe(2,d))/Math.LN10*2+5|0,l+=n,t=s=a=new f(1),f.precision=l;;){if(s=C(s.times(r),l,1),t=t.times(++c),o=a.plus(J(s,t,l,1)),we(o.d).slice(0,l)===we(a.d).slice(0,l)){for(i=d;i--;)a=C(a.times(a),l,1);if(e==null)if(u<3&&Jr(a.d,l-n,p,u))f.precision=l+=10,t=s=o=new f(1),c=0,u++;else return C(a,f.precision=h,p,M=!0);else return f.precision=h,a}a=o}}function yt(r,e){var t,n,i,s,a,o,l,u,c,d,f,p=1,h=10,m=r,g=m.d,b=m.constructor,y=b.rounding,w=b.precision;if(m.s<0||!g||!g[0]||!m.e&&g[0]==1&&g.length==1)return new b(g&&!g[0]?-1/0:m.s!=1?NaN:g?0:m);if(e==null?(M=!1,c=w):c=e,b.precision=c+=h,t=we(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=we(m.d),n=t.charAt(0),p++;s=m.e,n>1?(m=new b("0."+t),s++):m=new b(n+"."+t.slice(1))}else return u=di(b,c+2,w).times(s+""),m=yt(new b(n+"."+t.slice(1)),c-h).plus(u),b.precision=w,e==null?C(m,w,y,M=!0):m;for(d=m,l=a=m=J(m.minus(1),m.plus(1),c,1),f=C(m.times(m),c,1),i=3;;){if(a=C(a.times(f),c,1),u=l.plus(J(a,new b(i),c,1)),we(u.d).slice(0,c)===we(l.d).slice(0,c))if(l=l.times(2),s!==0&&(l=l.plus(di(b,c+2,w).times(s+""))),l=J(l,new b(p),c,1),e==null)if(Jr(l.d,c-h,y,o))b.precision=c+=h,u=a=m=J(d.minus(1),d.plus(1),c,1),f=C(m.times(m),c,1),i=o=1;else return C(l,b.precision=w,y,M=!0);else return b.precision=w,l;l=u,i+=2}}function Ao(r){return String(r.s*r.s/0)}function li(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)%I,t<0&&(n+=I),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=I;n<i;)r.d.push(+e.slice(n,n+=I));e=e.slice(n),n=I-e.length}else n-=i;for(;n--;)e+="0";r.d.push(+e),M&&(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 Pc(r,e){var t,n,i,s,a,o,l,u,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),yo.test(e))return li(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(Rc.test(e))t=16,e=e.toLowerCase();else if(Bc.test(e))t=2;else if(Mc.test(e))t=8;else throw Error(vt+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("."),a=s>=0,n=r.constructor,a&&(e=e.replace(".",""),o=e.length,s=o-s,i=ko(n,new n(t),s,s*2)),u=oi(e,t,qe),c=u.length-1,s=c;u[s]===0;--s)u.pop();return s<0?new n(r.s*0):(r.e=pi(u,c),r.d=u,M=!1,a&&(r=J(r,i,o*4)),l&&(r=r.times(Math.abs(l)<54?pe(2,l):Kr.pow(2,l))),M=!0,r)}function jc(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:gr(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/hi(5,t)),e=gr(r,2,e,e);for(var i,s=new r(5),a=new r(16),o=new r(20);t--;)i=e.times(e),e=e.times(s.plus(i.times(a.times(i).minus(o))));return e}function gr(r,e,t,n,i){var s,a,o,l,u=1,c=r.precision,d=Math.ceil(c/I);for(M=!1,l=t.times(t),o=new r(n);;){if(a=J(o.times(l),new r(e++*e++),c,1),o=i?n.plus(a):n.minus(a),n=J(a.times(l),new r(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,u++}return M=!0,a.d.length=d+1,a}function hi(r,e){for(var t=r;--e;)t*=r;return t}function xo(r,e){var t,n=e.s<0,i=Ye(r,r.precision,1),s=i.times(.5);if(e=e.abs(),e.lte(s))return ot=n?4:1,e;if(t=e.divToInt(i),t.isZero())ot=n?3:2;else{if(e=e.minus(t.times(i)),e.lte(s))return ot=po(t)?n?2:3:n?4:1,e;ot=po(t)?n?1:4:n?3:2}return e.minus(i).abs()}function $s(r,e,t,n){var i,s,a,o,l,u,c,d,f,p=r.constructor,h=t!==void 0;if(h?(Ie(t,1,kt),n===void 0?n=p.rounding:Ie(n,0,8)):(t=p.precision,n=p.rounding),!r.isFinite())c=Ao(r);else{for(c=Ze(r),a=c.indexOf("."),h?(i=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):i=e,a>=0&&(c=c.replace(".",""),f=new p(1),f.e=c.length-a,f.d=oi(Ze(f),10,i),f.e=f.d.length),d=oi(c,10,i),s=l=d.length;d[--l]==0;)d.pop();if(!d[0])c=h?"0p+0":"0";else{if(a<0?s--:(r=new p(r),r.d=d,r.e=s,r=J(r,f,t,n,0,i),d=r.d,s=r.e,u=go),a=d[t],o=i/2,u=u||d[t+1]!==void 0,u=n<4?(a!==void 0||u)&&(n===0||n===(r.s<0?3:2)):a>o||a===o&&(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(a=0,c="";a<l;a++)c+=Is.charAt(d[a]);if(h){if(l>1)if(e==16||e==8){for(a=e==16?4:3,--l;l%a;l++)c+="0";for(d=oi(c,i,e),l=d.length;!d[l-1];--l);for(a=1,c="1.";a<l;a++)c+=Is.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>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 ho(r,e){if(r.length>e)return r.length=e,!0}function Uc(r){return new this(r).abs()}function qc(r){return new this(r).acos()}function Vc(r){return new this(r).acosh()}function zc(r,e){return new this(r).plus(e)}function Wc(r){return new this(r).asin()}function Hc(r){return new this(r).asinh()}function Gc(r){return new this(r).atan()}function Xc(r){return new this(r).atanh()}function Yc(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=Ye(this,s,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Ye(this,n,i):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Ye(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=Ye(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 Zc(r){return new this(r).cbrt()}function Jc(r){return C(r=new this(r),r.e+1,2)}function Kc(r,e,t){return new this(r).clamp(e,t)}function Qc(r){if(!r||typeof r!="object")throw Error(fi+"Object expected");var e,t,n,i=r.defaults===!0,s=["precision",1,kt,"rounding",0,8,"toExpNeg",-mr,0,"toExpPos",0,mr,"maxE",0,mr,"minE",-mr,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(t=s[e],i&&(this[t]=Bs[t]),(n=r[t])!==void 0)if(Ae(n)===n&&n>=s[e+1]&&n<=s[e+2])this[t]=n;else throw Error(vt+t+": "+n);if(t="crypto",i&&(this[t]=Bs[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(_o);else this[t]=!1;else throw Error(vt+t+": "+n);return this}function ed(r){return new this(r).cos()}function td(r){return new this(r).cosh()}function To(r){var e,t,n;function i(s){var a,o,l,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,mo(s)){u.s=s.s,M?!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(a=0,o=s;o>=10;o/=10)a++;M?a>i.maxE?(u.e=NaN,u.d=null):a<i.minE?(u.e=0,u.d=[0]):(u.e=a,u.d=[s]):(u.e=a,u.d=[s]);return}if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return li(u,s.toString())}if(l==="string")return(o=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(o===43&&(s=s.slice(1)),u.s=1),yo.test(s)?li(u,s):Pc(u,s);if(l==="bigint")return s<0?(s=-s,u.s=-1):u.s=1,li(u,s.toString());throw Error(vt+s)}if(i.prototype=_,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=Qc,i.clone=To,i.isDecimal=mo,i.abs=Uc,i.acos=qc,i.acosh=Vc,i.add=zc,i.asin=Wc,i.asinh=Hc,i.atan=Gc,i.atanh=Xc,i.atan2=Yc,i.cbrt=Zc,i.ceil=Jc,i.clamp=Kc,i.cos=ed,i.cosh=td,i.div=rd,i.exp=nd,i.floor=id,i.hypot=sd,i.ln=ad,i.log=od,i.log10=ud,i.log2=ld,i.max=cd,i.min=dd,i.mod=fd,i.mul=pd,i.pow=hd,i.random=md,i.round=gd,i.sign=bd,i.sin=_d,i.sinh=wd,i.sqrt=yd,i.sub=vd,i.sum=kd,i.tan=Ed,i.tanh=Ad,i.trunc=xd,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 rd(r,e){return new this(r).div(e)}function nd(r){return new this(r).exp()}function id(r){return C(r=new this(r),r.e+1,3)}function sd(){var r,e,t=new this(0);for(M=!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 M=!0,new this(1/0);t=e}return M=!0,t.sqrt()}function mo(r){return r instanceof Kr||r&&r.toStringTag===wo||!1}function ad(r){return new this(r).ln()}function od(r,e){return new this(r).log(e)}function ld(r){return new this(r).log(2)}function ud(r){return new this(r).log(10)}function cd(){return Eo(this,arguments,-1)}function dd(){return Eo(this,arguments,1)}function fd(r,e){return new this(r).mod(e)}function pd(r,e){return new this(r).mul(e)}function hd(r,e){return new this(r).pow(e)}function md(r){var e,t,n,i,s=0,a=new this(1),o=[];if(r===void 0?r=this.precision:Ie(r,1,kt),n=Math.ceil(r/I),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(_o);else for(;s<n;)o[s++]=Math.random()*1e7|0;for(n=o[--s],r%=I,n&&r&&(i=pe(10,I-r),o[s]=(n/i|0)*i);o[s]===0;s--)o.pop();if(s<0)t=0,o=[0];else{for(t=-1;o[0]===0;t-=I)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<I&&(t-=I-n)}return a.e=t,a.d=o,a}function gd(r){return C(r=new this(r),r.e+1,this.rounding)}function bd(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}function _d(r){return new this(r).sin()}function wd(r){return new this(r).sinh()}function yd(r){return new this(r).sqrt()}function vd(r,e){return new this(r).sub(e)}function kd(){var r=0,e=arguments,t=new this(e[r]);for(M=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return M=!0,C(t,this.precision,this.rounding)}function Ed(r){return new this(r).tan()}function Ad(r){return new this(r).tanh()}function xd(r){return C(r=new this(r),r.e+1,1)}_[Symbol.for("nodejs.util.inspect.custom")]=_.toString;_[Symbol.toStringTag]="Decimal";var Kr=_.constructor=To(Bs);ui=new Kr(ui);ci=new Kr(ci);var Do=Kr;var Td=20,Dd=1,Ft=1e6,Co=1e6,Cd=-7,Sd=21,Nd=!1,Qr="[big.js] ",Lt=Qr+"Invalid ",mi=Lt+"decimal places",Od=Lt+"rounding mode",So=Qr+"Division by zero",X={},Je=void 0,Id=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function No(){function r(e){var t=this;if(!(t instanceof r))return e===Je?No():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(Lt+"value");e=e===0&&1/e<0?"-0":String(e)}Bd(t,e)}t.constructor=r}return r.prototype=X,r.DP=Td,r.RM=Dd,r.NE=Cd,r.PE=Sd,r.strict=Nd,r.roundDown=0,r.roundHalfUp=1,r.roundHalfEven=2,r.roundUp=3,r}function Bd(r,e){var t,n,i;if(!Id.test(e))throw Error(Lt+"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 Pt(r,e,t,n){var i=r.c;if(t===Je&&(t=r.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(Od);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]!==Je))),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]!==Je||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 jt(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}X.abs=function(){var r=new this.constructor(this);return r.s=1,r};X.cmp=function(r){var e,t=this,n=t.c,i=(r=new t.constructor(r)).c,s=t.s,a=r.s,o=t.e,l=r.e;if(!n[0]||!i[0])return n[0]?s:i[0]?-a:0;if(s!=a)return s;if(e=s<0,o!=l)return o>l^e?1:-1;for(a=(o=n.length)<(l=i.length)?o:l,s=-1;++s<a;)if(n[s]!=i[s])return n[s]>i[s]^e?1:-1;return o==l?0:o>l^e?1:-1};X.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,a=t.DP;if(a!==~~a||a<0||a>Ft)throw Error(mi);if(!i[0])throw Error(So);if(!n[0])return r.s=s,r.c=[r.e=0],r;var o,l,u,c,d,f=i.slice(),p=o=i.length,h=n.length,m=n.slice(0,o),g=m.length,b=r,y=b.c=[],w=0,A=a+(b.e=e.e-r.e)+1;for(b.s=s,s=A<0?0:A,f.unshift(0);g++<o;)m.push(0);do{for(u=0;u<10;u++){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(l=g==o?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}y[w++]=c?u:++u,m[0]&&c?m[g]=n[p]||0:m=[n[p]]}while((p++<h||m[0]!==Je)&&s--);return!y[0]&&w!=1&&(y.shift(),b.e--,A--),w>A&&Pt(b,A,t.RM,m[0]!==Je),b};X.eq=function(r){return this.cmp(r)===0};X.gt=function(r){return this.cmp(r)>0};X.gte=function(r){return this.cmp(r)>-1};X.lt=function(r){return this.cmp(r)<0};X.lte=function(r){return this.cmp(r)<1};X.minus=X.sub=function(r){var e,t,n,i,s=this,a=s.constructor,o=s.s,l=(r=new a(r)).s;if(o!=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 a(s):r.s=1,r;if(o=c-f){for((i=o<0)?(o=-o,n=u):(f=c,n=d),n.reverse(),l=o;l--;)n.push(0);n.reverse()}else for(t=((i=u.length<d.length)?u:d).length,o=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>o;){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};X.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(So);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)))};X.neg=function(){var r=new this.constructor(this);return r.s=-r.s,r};X.plus=X.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 a=i.e,o=i.c,l=r.e,u=r.c;if(!o[0]||!u[0])return u[0]||(o[0]?r=new s(i):r.s=i.s),r;if(o=o.slice(),e=a-l){for(e>0?(l=a,n=u):(e=-e,n=o),n.reverse();e--;)n.push(0);n.reverse()}for(o.length-u.length<0&&(n=u,u=o,o=n),e=u.length,t=0;e;o[e]%=10)t=(o[--e]=o[e]+u[e]+t)/10|0;for(t&&(o.unshift(t),++l),e=o.length;o[--e]===0;)o.pop();return r.c=o,r.e=l,r};X.pow=function(r){var e=this,t=new e.constructor("1"),n=t,i=r<0;if(r!==~~r||r<-Co||r>Co)throw Error(Lt+"exponent");for(i&&(r=-r);r&1&&(n=n.times(e)),r>>=1,!!r;)e=e.times(e);return i?t.div(n):n};X.prec=function(r,e){if(r!==~~r||r<1||r>Ft)throw Error(Lt+"precision");return Pt(new this.constructor(this),r,e)};X.round=function(r,e){if(r===Je)r=0;else if(r!==~~r||r<-Ft||r>Ft)throw Error(mi);return Pt(new this.constructor(this),r+this.e+1,e)};X.sqrt=function(){var r,e,t,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(Qr+"No square root");s=Math.sqrt(+jt(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),r=new i((s==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+a)):r=new i(s+""),a=r.e+(i.DP+=4);do t=r,r=o.times(t.plus(n.div(t)));while(t.c.slice(0,a).join("")!==r.c.slice(0,a).join(""));return Pt(r,(i.DP-=4)+r.e+1,i.RM)};X.times=X.mul=function(r){var e,t=this,n=t.constructor,i=t.c,s=(r=new n(r)).c,a=i.length,o=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,a<o&&(e=i,i=s,s=e,u=a,a=o,o=u),e=new Array(u=a+o);u--;)e[u]=0;for(l=o;l--;){for(o=0,u=a+l;u>l;)o=e[u]+s[l]*i[u-l-1]+o,e[u--]=o%10,o=o/10|0;e[u]=o}for(o?++r.e:e.shift(),l=e.length;!e[--l];)e.pop();return r.c=e,r};X.toExponential=function(r,e){var t=this,n=t.c[0];if(r!==Je){if(r!==~~r||r<0||r>Ft)throw Error(mi);for(t=Pt(new t.constructor(t),++r,e);t.c.length<r;)t.c.push(0)}return jt(t,!0,!!n)};X.toFixed=function(r,e){var t=this,n=t.c[0];if(r!==Je){if(r!==~~r||r<0||r>Ft)throw Error(mi);for(t=Pt(new t.constructor(t),r+t.e+1,e),r=r+t.e+1;t.c.length<r;)t.c.push(0)}return jt(t,!1,!!n)};X[Symbol.for("nodejs.util.inspect.custom")]=X.toJSON=X.toString=function(){var r=this,e=r.constructor;return jt(r,r.e<=e.NE||r.e>=e.PE,!!r.c[0])};X.toNumber=function(){var r=+jt(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(r.toString()))throw Error(Qr+"Imprecise conversion");return r};X.toPrecision=function(r,e){var t=this,n=t.constructor,i=t.c[0];if(r!==Je){if(r!==~~r||r<1||r>Ft)throw Error(Lt+"precision");for(t=Pt(new n(t),r,e);t.c.length<r;)t.c.push(0)}return jt(t,r<=t.e||t.e<=n.NE||t.e>=n.PE,!!i)};X.valueOf=function(){var r=this,e=r.constructor;if(e.strict===!0)throw Error(Qr+"valueOf disallowed");return jt(r,r.e<=e.NE||r.e>=e.PE,!0)};var Rd=No(),Oo=Rd;var Gs={};Oc(Gs,{DecodeError:()=>xe,Decoder:()=>ze,EXT_TIMESTAMP:()=>Ls,Encoder:()=>br,ExtData:()=>Ve,ExtensionCodec:()=>Et,decode:()=>jo,decodeArrayStream:()=>Vo,decodeAsync:()=>qo,decodeMulti:()=>Uo,decodeMultiStream:()=>zo,decodeTimestampExtension:()=>Vs,decodeTimestampToTimeSpec:()=>qs,encode:()=>_i,encodeDateToTimeSpec:()=>js,encodeTimeSpecToTimestamp:()=>Ps,encodeTimestampExtension:()=>Us});function Io(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 Md(r,e,t){let n=r.length,i=t,s=0;for(;s<n;){let a=r.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=r.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 $d=new TextEncoder,Fd=50;function Ld(r,e,t){$d.encodeInto(r,e.subarray(t))}function Bo(r,e,t){r.length>Fd?Ld(r,e,t):Md(r,e,t)}var Pd=4096;function Fs(r,e,t){let n=e,i=n+t,s=[],a="";for(;n<i;){let o=r[n++];if((o&128)===0)s.push(o);else if((o&224)===192){let l=r[n++]&63;s.push((o&31)<<6|l)}else if((o&240)===224){let l=r[n++]&63,u=r[n++]&63;s.push((o&31)<<12|l<<6|u)}else if((o&248)===240){let l=r[n++]&63,u=r[n++]&63,c=r[n++]&63,d=(o&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(o);s.length>=Pd&&(a+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(a+=String.fromCharCode(...s)),a}var jd=new TextDecoder,Ud=200;function qd(r,e,t){let n=r.subarray(e,e+t);return jd.decode(n)}function Ro(r,e,t){return t>Ud?qd(r,e,t):Fs(r,e,t)}var Ve=class{type;data;constructor(e,t){this.type=e,this.data=t}};var xe=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 Mo(r,e,t){let n=t/4294967296,i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function gi(r,e,t){let n=Math.floor(t/4294967296),i=t;r.setUint32(e,n),r.setUint32(e+4,i)}function bi(r,e){let t=r.getInt32(e),n=r.getUint32(e+4);return t*4294967296+n}function $o(r,e){let t=r.getUint32(e),n=r.getUint32(e+4);return t*4294967296+n}var Ls=-1,Vd=4294967296-1,zd=17179869184-1;function Ps({sec:r,nsec:e}){if(r>=0&&e>=0&&r<=zd)if(e===0&&r<=Vd){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),gi(n,4,r),t}}function js(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 Us(r){if(r instanceof Date){let e=js(r);return Ps(e)}else return null}function qs(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=bi(e,4),n=e.getUint32(0);return{sec:t,nsec:n}}default:throw new xe(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Vs(r){let e=qs(r);return new Date(e.sec*1e3+e.nsec/1e6)}var Fo={type:Ls,encode:Us,decode:Vs};var Et=class r{static defaultCodec=new r;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(Fo)}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 a=-1-n;return new Ve(a,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 a=n;return new Ve(a,s)}}}return e instanceof Ve?e:null}decode(e,t,n){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,n):new Ve(t,e)}};function Wd(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function en(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Wd(r)?new Uint8Array(r):Uint8Array.from(r)}var Hd=100,Gd=2048,br=class r{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Et.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??Hd,this.initialBufferSize=e?.initialBufferSize??Gd,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=Io(e);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),Bo(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=en(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 a=e[s];this.ignoreUndefined&&a===void 0||(this.encodeString(s),this.doEncode(a,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),Mo(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),gi(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 _i(r,e){return new br(e).encodeSharedRef(r)}function wi(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}var Xd=16,Yd=16,yi=class{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=Xd,t=Yd){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 a=s.bytes;for(let o=0;o<n;o++)if(a[o]!==e[t+o])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=Fs(e,t,n),a=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(a,s),s}};var zs="array",nn="map_key",Po="map_value",Zd=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new xe("The type of key must be string or number but "+typeof r)},Ws=class{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let t=this.getUninitializedStateFromPool();t.type=zs,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){let t=this.getUninitializedStateFromPool();t.type=nn,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===zs){let n=e;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(e.type===nn||e.type===Po){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}},rn=-1,Hs=new DataView(new ArrayBuffer(0)),Jd=new Uint8Array(Hs.buffer);try{Hs.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 Lo=new RangeError("Insufficient data"),Kd=new yi,ze=class r{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=Hs;bytes=Jd;headByte=rn;stack=new Ws;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Et.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:Kd,this.mapKeyConverter=e?.mapKeyConverter??Zd}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=rn,this.stack.reset()}setBuffer(e){let t=en(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===rn&&!this.hasRemaining(1))this.setBuffer(e);else{let t=this.bytes.subarray(this.pos),n=en(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 o of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(o);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:a}=this;throw new RangeError(`Insufficient data in parsing ${wi(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,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(a){if(!(a instanceof RangeError))throw a}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 xe(`Unrecognized type byte: ${wi(e)}`);this.complete();let n=this.stack;for(;n.length>0;){let i=n.top();if(i.type===zs)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===nn){if(t==="__proto__")throw new xe("The key __proto__ is not allowed");i.key=this.mapKeyConverter(t),i.type=Po;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=nn;continue e}}return t}}readHeadByte(){return this.headByte===rn&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=rn}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 xe(`Unrecognized array type byte: ${wi(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new xe(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new xe(`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 xe(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw Lo;let n=this.pos+t,i;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?i=this.keyDecoder.decode(this.bytes,n,e):i=Ro(this.bytes,n,e),this.pos+=t+e,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===nn:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new xe(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw Lo;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 xe(`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=$o(this.view,this.pos);return this.pos+=8,e}readI64(){let e=bi(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 jo(r,e){return new ze(e).decode(r)}function Uo(r,e){return new ze(e).decodeMulti(r)}function Qd(r){return r[Symbol.asyncIterator]!=null}async function*ef(r){let e=r.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)return;yield n}}finally{e.releaseLock()}}function vi(r){return Qd(r)?r:ef(r)}async function qo(r,e){let t=vi(r);return new ze(e).decodeAsync(t)}function Vo(r,e){let t=vi(r);return new ze(e).decodeArrayStream(t)}function zo(r,e){let t=vi(r);return new ze(e).decodeStream(t)}var ji=uo(ma(),1),ga=Do,ba=Oo,tt=Gs,Yl=ji.DOMParser,Zl=ji.XMLSerializer;var Jl=tt!==null;function Kl(){if(!Jl)throw new Error("@msgpack/msgpack is required for MessagePack support. Install with: npm install @msgpack/msgpack")}var Ql=eh();function eh(){if(!Jl)return null;let r=new TextEncoder,e=new TextDecoder,t=new tt.ExtensionCodec;return t.register({type:-1,encode:n=>{if(n instanceof Date){let i=An(n);if(i==="D"||i==="H")return null}return tt.encodeTimestampExtension(n)},decode:n=>tt.decodeTimestampExtension(n)}),t.register({type:1,encode:n=>ke(n)?r.encode(n.toString()):null,decode:n=>$r(e.decode(n))}),t.register({type:2,encode:n=>{if(n instanceof Date&&An(n)==="D"){let i=n.getUTCFullYear(),s=String(n.getUTCMonth()+1).padStart(2,"0"),a=String(n.getUTCDate()).padStart(2,"0");return r.encode(`${i}-${s}-${a}`)}return null},decode:n=>new Date(e.decode(n)+"T00:00:00.000Z")}),t.register({type:3,encode:n=>{if(n instanceof Date&&An(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 r.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",[l,u,c]=a.split(":"),d=Math.round(+o.substring(0,3));return new Date(Date.UTC(1970,0,1,+l,+u,+c,d))}}),t.register({type:4,encode:n=>{let i=_a(n);if(i!==null){let[s,a]=i;return r.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),l=Nt[a];if(l!==void 0){let[,u]=l;return u(o)}return`${o}::${a}`}}),t}function eu(r){return Kl(),tt.encode(r,{extensionCodec:Ql})}function tu(r){return Kl(),tt.decode(r,{extensionCodec:Ql})}function qi(r,e=!1){let t=Vi(r);if(t===null)return[!1,String(r)];let[n,i,s]=t;return s&&!e?[!1,String(r)]:[!0,`${i(r)}::${n}`]}function wa(r){if(!r.includes("::"))return[!1,r];let e=r.lastIndexOf("::"),t=r.slice(0,e),n=r.slice(e+2),i=Nt[n];if(i===void 0)return[!1,r];let[,s]=i;return[!0,s(t)]}function Ui(r,e,t){if(r!==null&&typeof r=="object"&&!Array.isArray(r)){let n={};for(let[i,s]of Object.entries(r))n[i]=Ui(s,e,t);return n}return Array.isArray(r)?r.map(n=>Ui(n,e,t)):t(r)?e(r):r}function ya(r){let e=Vi(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,a]=ya(i);return a&&(t=!0),s}),t]}if(r!==null&&typeof r=="object"){let t=!1,n={};for(let[i,s]of Object.entries(r)){let[a,o]=ya(s);o&&(t=!0),n[i]=a}return[n,t]}return[r,!1]}function th(r,e=!1){let[t,n]=qi(r,e);if(t)return n;let[i,s]=ya(r),a=JSON.stringify(i);return s?`${a}::JS`:a}function rh(r){return JSON.stringify(r)}function nh(r){if(!tt)throw new Error("@msgpack/msgpack is required for MessagePack support");return tt.encode(r)}function ce(r,e=null,{raw:t=!1,qs:n=!1,_forceSuffix:i=!1}={}){if(n)return`${nu(r)}::QS`;if(t){if(e===null||e==="json")return rh(r);if(e==="msgpack")return nh(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=th(r,i);return e==="json"?`"${s}"`:s}else{if(e==="xml")return`<?xml version="1.0" ?><tytx_root>${ru(r)}</tytx_root>`;if(e==="msgpack")return eu(r);throw new Error(`Unknown transport: ${e}`)}}var Fr,va;typeof window<"u"&&window.DOMParser?(Fr=window.DOMParser,va=window.XMLSerializer):(Fr=Yl,va=Zl);function iu(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 su(r,e,t){let n=r.createElement(e),i=t.attrs||{},s=t.value;for(let[a,o]of Object.entries(i))n.setAttribute(a,ce(o,null,{_forceSuffix:!0}));if(Array.isArray(s))for(let a of s)if(iu(a)){let[o]=Object.keys(a),l=a[o],u=su(r,o,l);n.appendChild(u)}else{n.textContent=ce(s);break}else n.textContent=ce(s);return n}function ru(r){if(!Fr)throw new Error("XML support requires @xmldom/xmldom package in Node.js");if(iu(r)){let[e]=Object.keys(r),t=r[e],n=new Fr().parseFromString("<root/>","text/xml"),i=su(n,e,t);return new va().serializeToString(i)}else return ce(r)}function ka(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=ka(n);return{attrs:e,value:{[n.tagName]:i}}}else{let n=[];for(let i of t){let s=ka(i);n.push({[i.tagName]:s})}return{attrs:e,value:n}}return{attrs:e,value:K(r.textContent)}}function au(r){if(!Fr)throw new Error("XML support requires @xmldom/xmldom package in Node.js");let n=new Fr().parseFromString(r,"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 K(n.textContent);n=s}let i=ka(n);return{[n.tagName]:i}}function ih(r){return typeof r=="string"}function sh(r){let[e,t]=wa(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 Ui(i,ah,ih)}function ah(r){return r.includes("::")?wa(r)[1]:r}function oh(r){let e=au(r);return typeof e=="string"?K(e):e}function lh(r){return tu(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)),sh(t)}else{if(e==="xml")return oh(r);if(e==="msgpack")return lh(r);throw new Error(`Unknown transport: ${e}`)}}function nu(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]=qi(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 ou(r){if(!r)return[];let e=r.split("&"),t=e.map(a=>a.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(a=>K(a));let s={};for(let a of e){let o=a.indexOf("="),l=a.slice(0,o),u=a.slice(o+1);s[l]=K(u)}return s}var uu=ga||ba||Number,cu=ga?"decimal.js":ba?"big.js":"number";function Aa(){return cu}function $r(r){return new uu(r)}function ke(r){return cu==="number"?!1:r instanceof uu}function An(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 uh(r){return r.toString()}function ch(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 dh(r){return r.toISOString()}function fh(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 ph(r){return r?"true":"false"}function hh(r){return r.toString()}function mh(r){return r.toString()}function gh(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 zi=[],Ea=new Map;function _a(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 zi)if(t.prototype===e)return[n,i,s];return null}function Vi(r){if(r===null)return["NN",()=>"",!0];if(ke(r))return["N",uh,!1];if(r instanceof Uint8Array)return["RAW",gh,!1];if(r instanceof Date){let e=An(r);return e==="D"?["D",ch,!1]:e==="H"?["H",fh,!1]:["DHZ",dh,!1]}return typeof r=="boolean"?["B",ph,!0]:typeof r=="number"?Number.isInteger(r)?["L",hh,!0]:["R",mh,!0]:_a(r)}function bh(r){return $r(r)}function _h(r){let[e,t,n]=r.split("-").map(Number);return new Date(Date.UTC(e,t-1,n,0,0,0,0))}function lu(r){return new Date(r)}function wh(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 yh(r){return r.toLowerCase()==="true"}function vh(r){return parseInt(r,10)}function kh(r){return parseFloat(r)}function Eh(r){return r}function Ah(r){return null}var xh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;function Th(r){if(!xh.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 Dh(r){return ou(r)}var Ch=/^[A-Z]+$/,Nt={N:[Object,bh],D:[Date,_h],DH:[Date,lu],DHZ:[Date,lu],H:[Date,wh],L:[Number,vh],R:[Number,kh],T:[String,Eh],B:[Boolean,yh],QS:[Object,Dh],NN:[null,Ah],RAW:[Uint8Array,Th]};function xn(r){return Object.hasOwn(Nt,r)?Nt[r][0]:null}function xa(r,e,t,n,i=!1){if(typeof e!="string"||!Ch.test(e))throw new Error(`TYTX suffix '${e}' is invalid: expected uppercase ASCII letters only`);let s=Nt[e];if(s!==void 0&&s[0]!==r){let a=s[0]===null?"null":s[0].name;throw new Error(`TYTX suffix '${e}' is already registered for ${a}`)}zi=zi.filter(([a])=>a!==r),zi.push([r,e,t,i]),Nt[e]=[r,n]}function Wt(r,e){Ea.set(r,e)}function Ue(r){return Ea.has(r)?Ea.get(r):{}}var du={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 Nh(r){let e=r._retryPolicy;return e==null?null:typeof e=="string"?du[e]||null:e}function Oh(r,e){return e.some(t=>t==="Error"?!0:r.name===t||r.constructor.name===t)}function Ih(r){return new Promise(e=>setTimeout(e,r))}async function Bh(r,e){if(!e)return r();let t=e.maxAttempts||3,n=e.delay||1,i=e.backoff||2,s=e.jitter!==!1,a=e.on||["Error"],o=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(o=c,u<t-1&&Oh(c,a)){let d=l;s&&(d*=1+Math.random()*.1),await Ih(d),l*=i}else throw c}throw o}var te=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,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())}resolve(e={}){let{static:t=!1,...n}=e;if(t)return this._node?this._node._value:this.cachedValue;let i={...this._kw};if(this._node&&this._node.attr){let u=this.constructor.internalParams;for(let[c,d]of Object.entries(this._node.attr))u.has(c)||(i[c]=d)}Object.assign(i,n);let s=this._computeEffectiveFingerprint(i);if(s===this._lastEffectiveFingerprint&&!this.expired)return this.cachedValue;this._lastEffectiveFingerprint=s;let a=Nh(this),o=()=>this.load(i);if(a)return Bh(o,a).then(u=>this._finalize(u));let l=o();return l&&typeof l.then=="function"?l.then(u=>this._finalize(u)):this._finalize(l)}_finalize(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)),this._lastUpdate=Date.now(),(!this.readOnly||this.cacheTime!==0)&&(this.cachedValue=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}};te._BagClass=null;var Ht=class extends te{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 rt=class r{constructor(e,t,n=null,i=null,s=null,a=null,o=null,l=!0){this.label=t,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,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),a=s.map(l=>{let u=this.getAttr(l);return!e&&u instanceof te?u.resolve():u}),o=l=>i.length===0?Object.fromEntries(s.map((u,c)=>[u,l[c]])):l.length===1?l[0]:l;return a.some(l=>l&&typeof l.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,t=!0,n=null,i=null,s=!0,a=null,o=!1){e instanceof te?(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 p={...this._attr};this.setAttr(n,!1,i,s);let h=this._buildAttrDiff(p,this._attr);d=Object.keys(h).length>0?h: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 p=d!==null?{oldvalue:l,attrs_diff:d}:{oldvalue:l};for(let h of Object.values(this._nodeSubscribers))h({node:this,info:p,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,a,o))}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},a=this.resolver;a&&a._node===this&&(a._node=null),this.resolver=n,this.setValue(t,!1,{...e.attr},!1,!1,null);let o=this._buildAttrDiff(s,this._attr),l=Object.keys(o).length?o:null,u=i!==t||a!==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 a=s in e?e[s]:null,o=s in t?t[s]:null;a!==o&&(n[s]={old:a,new:o})}return n}setAttr(e=null,t=!0,n=!0,i=!0){let s=e||{},a=Object.keys(this._nodeSubscribers).length>0,l=t&&(a||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&&a)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 Tn=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(a=>a.getAttr(n)===s):this._list.findIndex(a=>a._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,a=null,o=!1,l=!0,u=null,c=!0,d=!1,f=null){let p=null;if(e.includes("?")&&([e,p]=e.split("?",2)),e==null||e.startsWith("#"))throw new Error("Cannot create new node with #n syntax");if(p){let m=p.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 h=this._dict[e];if(h)f&&(h.nodeTag=f),a!==null&&(a===!1?h.resolver=null:h.resolver=a),p?h.setAttr(i,c,!0,l):h.setValue(t,c,i,o,l,u,d);else{let m=s&&s.nodeClass?s.nodeClass:rt;h=new m(s,e,p?null:t,i,a,f,null,l);let g=this._parsePosition(n);this._dict[e]=h,this._list.splice(g,0,h),c&&s&&s.backref&&s._onNodeInserted(h,g,null,u,d)}return d&&h.setValue(null,!1),h}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 a=[...i].sort((c,d)=>c-d),o=a[0]<t?1:0,l=[];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),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+=o;for(let c of l)this._list.splice(u,0,c),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeInserted(c,u)}else{let a=i[0];if(a===t||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(t,0,o),n&&this._parentBag&&this._parentBag.backref&&this._parentBag._onNodeInserted(o,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 mu=uo(ma(),1);var Ta="::RSLV:",Rh=new Map,Mh=new Map,Wi=new WeakMap,de=class extends Error{constructor(e){super(e),this.name="BagSerializationError"}},Dn=class extends te{constructor(e){super({asBag:!1}),Wi.set(this,e)}get payload(){return Wi.get(this)}load(){throw new de("This resolver is opaque; local execution is unavailable")}};function fu(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 de("Invalid resolver description")}function pu(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 de("Resolver parameters must be JSON data; callbacks cannot travel");e.add(r);for(let t of Object.values(r))pu(t,e);e.delete(r)}}function Cn(r){if(Wi.has(r))return Wi.get(r);let e=Mh.get(r.constructor);if(!e)throw new de(`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 fu(n),pu(n),Ta+JSON.stringify(n)}function Hi(r){if(typeof r!="string"||!r.startsWith(Ta))return null;let e=r.slice(Ta.length);if(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+$/.test(e))return new Dn(r);let t;try{t=JSON.parse(e)}catch{throw new de("Invalid resolver JSON or signed token")}fu(t);let n=Rh.get(JSON.stringify([t.resolver_module,t.resolver_class]));if(!n)return new Dn(r);let i=n.decode({args:t.args??[],kwargs:t.kwargs});if(!(i instanceof n.cls))throw new de("Resolver decoder returned an incompatible instance");return i}function Gi(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[e,t instanceof te?Cn(t):t]))}function Da(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[e,Hi(t)??t]))}var We="__cls";function Lr(r,e){return r!==null&&r.tytxSuffix===e?r:xn(e)}function $h(r){let e=r.tytxSuffix,t=Object.entries(Ue(e)).filter(([,n])=>n===r).map(([n])=>n);if(t.length===0)throw new de(`${r.name} is not in the TYTX subtype dictionary of '${e}'`);if(t.length>1)throw new de(`${r.name} is in the TYTX subtype dictionary of '${e}' under several names: ${t.sort().join(", ")}`);return t[0]}function Ca(r,e){let t=Ue(r);if(!Object.hasOwn(t,e))throw new de(`Unknown Bag class '${e}' for TYTX type '${r}'`);return t[e]}function Sa(r,e){return r===e?null:$h(r)}function*gu(r,e=[]){for(let t of r){let n=[...e,t.label];yield[n,t];let i=t.getValue(!0);!t.resolver&&i instanceof V&&(yield*gu(i,n))}}function Fh(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 Pr(r){if(r===null||typeof r!="object")return!1;let e=Object.getPrototypeOf(r);return e===Object.prototype||e===null}function Ot(r){return typeof r=="string"?r.includes("::")?`${r}::T`:r:Array.isArray(r)?r.map(Ot):Pr(r)?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Ot(t)])):r}function Na(r){if(!Pr(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 hu=!1,V=class r{static tytxSuffix="X";constructor(e=null,t={}){this._nodes=new Tn,this._backref=!1,this._parent=null,this._parentNode=null,this._rootAttributes=null,this._updSubscribers={},this._insSubscribers={},this._delSubscribers={},Na(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 rt}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 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 l=o.getValue(n);if(l instanceof r)s.shift(),i=l;else if(t){let u=i.createChildBag();o.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 a=s.shift();if(a.startsWith("#"))throw new Sn("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,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 a=this._nodes.get(e);return a?a.getValue(n,s,i):t}getItem(e,t=null,n=!1,i={}){if(!e)return this;let[s,a]=this._htraverse(e,!1,n);return s instanceof r?s.get(a,t,n,i):t}setItem(e,t,n=null,i=">",s=!1,a=!0,o=null,l=!1,u=!0,c=null,d=null){if(e==="")throw new RangeError("setItem requires a non-empty path");let[f,p]=this._htraverse(e,!0);return f._nodes.set(p,t,i,n,f,c,s,a,o,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,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,a]=this._htraverse(e,n,t);if(s instanceof r&&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,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,a=null,o=!1){for(let l of Object.values(this._updSubscribers))l({node:e,pathlist:t,oldvalue:i,attrs_diff:s,evt:n,reason:a,fired:o});this._parent&&this._parentNode&&this._parent._onNodeChanged(e,[this._parentNode.label,...t],n,i,s,a,o)}_onNodeInserted(e,t,n=null,i=null,s=!1){let a=e.parentBag,o=e.getValue(!0);a!==null&&a.backref&&o instanceof r&&o.setBackref(e,a),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:a=null}=t;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,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:a=!1}=t;(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,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,a=n&&typeof t=="string"?t.toLowerCase():t,o=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==a)return c}if(c._value instanceof r)if(i){let d=o(c._value);if(d)return d}else u.push(c._value)}for(let c of u){let d=o(c);if(d)return d}return null};return o(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,a=!0,o=null,l=!0){e||(e="#k,#v,#a");let u=this,c;if(typeof e=="string"){if(e.includes(":")){let[p,h]=e.split(":");u=this.getItem(p),e=h}c=e.split(",").map(p=>p.trim())}else c=e;let d=(p,h,m,g,b)=>{if(h==="#k")return p.label;if(h==="#p")return m;if(h==="#n")return p;if(typeof h=="function")return h(p);if(h==="#v"){let y=b();return g&&y instanceof r?null:y}else if(h.startsWith("#v.")){let y=h.split(".").slice(1).join("."),w=b();return w&&w.getItem?w.getItem(y):null}else{if(h==="#__v")return p.getValue(!0);if(h.startsWith("#a")){let y=h.includes(".")?h.split(".").slice(1).join("."):null;return p.getAttr(y)}else{let y=b();return y&&y.getItem?y.getItem(h):null}}};function*f(){let p=0;function*h(m,g){for(let b of m._nodes){let y=g?`${g}.${b.label}`:b.label,w=!1,A,S=()=>(w||(A=b.getValue(l),w=!0),A);if((s&&a||(S()instanceof r?a:s))&&(t===null||t(b))&&(yield c.length===1?d(b,c[0],y,i,S):c.map(W=>d(b,W,y,i,S)),p++,o!==null&&p>=o))return;if(i){let W=S();if(W instanceof r&&(yield*h(W,y),o!==null&&p>=o))return}}}yield*h(u,"")}return n?f():[...f()]}getLeaves(){let e=[],t=(n,i)=>{for(let s of n._nodes){let a=i?`${i}.${s.label}`:s.label,o=s.getValue(!1);o instanceof r?t(o,a):e.push([a,o])}};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 a=s[0].length,o=[];for(let l=0;l<a;l++)o.push(s.map(u=>u[l]));return o}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 a=0,o=!1;for(let l of this.query(s,n)){if(l==null||l===""){o=!0;continue}if(typeof l!="number"&&typeof l!="boolean"){if(t)throw new TypeError(`sum encountered non-numeric value: ${typeof l}`);continue}a+=l}return t&&o?null:a};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 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 l=o==="d"||o==="D",u=o==="a"||o==="d",c;if(a.toLowerCase()==="#k")c=d=>t(d.label,u);else if(a.toLowerCase()==="#v")c=d=>t(d.value,u);else if(a.toLowerCase().startsWith("#a.")){let d=a.slice(3);c=f=>t(f.getAttr(d),u)}else c=d=>{let f=d.value,p=f instanceof r?f.getItem(a):f?f[a]:null;return t(p,u)};this._nodes._list.sort((d,f)=>{let p=n(c(d),c(f));return l?-p:p})}}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 Ht({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 a of this._nodes){let o=a.value;if(i&&o==null)continue;let l=a.label;e&&(l=String(l)),t&&(l=l.toLowerCase()),n&&o instanceof r&&(o=r.prototype.asDict.call(o,e,t,n,i)),Object.defineProperty(s,l,{value:o,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 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=t==="static"?s.resolver:null,l=o?null:s.getValue(),u=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();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(a,o||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 a=new this.nodeClass(this,e,null,n,i,s,null,!1);return t instanceof te?a.resolver=t:a._value=t,this._nodes._dict[e]=a,this._nodes._list.push(a),a}fillFrom(e=null,t={}){let n=Na(t);if(e!=null&&!Pr(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,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,p)=>[`r_${String(p).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,p]of d){let h=p;n&&(Pr(h)||Array.isArray(h))&&(h=this.createChildBag(),a(h,p,`${u}[${JSON.stringify(f)}]`)),o._appendLiteral(f,h)}}finally{s.delete(l)}};return e!=null&&a(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=(a,o)=>{for(let l=0;l<a._nodes.length;l++){let u=a._nodes._list[l],c={...o};"_pathlist"in o&&(c._pathlist=[...o._pathlist,u.label]),"_indexlist"in o&&(c._indexlist=[...o._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 p=s(f,c);if(p)return p}}}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[a,o]of gu(this)){let l=a.slice(0,-1),u=JSON.stringify(a),c=JSON.stringify(l),d=o.getValue(!0),f,p=null;if(o.resolver)f=Cn(o.resolver);else if(d instanceof r){let g=d.constructor,b=g.tytxSuffix;s.set(u,g),p=Sa(g,Lr(s.get(c),b)),f=`::${b}`}else d===null?f="::NN":f=Ot(d);if(o.attr&&Object.hasOwn(o.attr,We))throw new de(`node '${a}': the attribute '${We}' is reserved for the Bag class name`);let h=Gi(Ot(o.attr));p!==null&&(h[We]=p);let m=o.nodeTag;t?(yield[l.length?n[c]:null,o.label,m,f,h],d instanceof r&&(n[u]=i,e[i]=a,i++)):yield[l,o.label,m,f,h]}}toTytx(e="json",t=!1){let n=this._toTytxPayload(t),i=this.constructor.tytxSuffix;if(e==="json")return`${n}::${i}`;if(e==="msgpack")return _i(new Ve(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=Sa(n,Lr(null,n.tytxSuffix));return i!==null&&(t[We]=i),t.rows=t.rows.map(([s,a,o,l,u])=>[Ot(s),Ot(a),Ot(o),l,u]),t.paths&&(t.paths=Ot(t.paths)),ce(t)}static fromTytx(e,t="json",n={}){if(Pr(t)&&(n=t,t="json"),Na(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(!Pr(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(Lr(null,t));let n=K(e);if(!n||!Array.isArray(n.rows))throw new de("Invalid TYTX Bag: expected rows");let i=n.paths,s=i!=null,a=Object.hasOwn(n,We)?Ca(t,n[We]):Lr(null,t),o=new a,l=new Map([["[]",o]]);for(let u of n.rows){if(!Array.isArray(u)||u.length!==5)throw new de("Invalid TYTX Bag row");let[c,d,f,p,h]=u,m=c??"";if(s){if(c!==null&&!Object.hasOwn(i,c))throw new de(`Unknown TYTX parent reference: ${c}`);m=c===null?"":i[c]}if(typeof m=="string"&&(m=m?m.split("."):[]),!Array.isArray(m))throw new de("Invalid TYTX parent path");let g=JSON.stringify(m);if(!l.has(g))throw new de(`Missing or undecodable TYTX parent branch: ${m}`);let b=l.get(g),y=JSON.stringify([...m,d]),w=p,A=Hi(w),S=Da(h),B=Object.hasOwn(S,We)?S[We]:null;if(delete S[We],w instanceof r){let re=w.constructor.tytxSuffix,ue=B!==null?Ca(re,B):Lr(b.constructor,re);w=new ue,l.set(y,w)}else if(B!==null)throw new de(`node '${y}': the attribute '${We}' is reserved for the Bag class name of a branch`);let W=b._appendLiteral(d,A?null:w,S,A);W.nodeTag=f??null}return o}toXml(e={}){let{pretty:t=!1,encoding:n="UTF-8",docHeader:i=null,selfClosedTags:s=null}=e,a=this._bagToXml(s,t);return i===!0?a=`<?xml version='1.0' encoding='${n}'?>
16
16
  ${a}`:typeof i=="string"&&(a=`${i}
17
17
  ${a}`),a}_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?`
18
- `:"")}_nodeToXml(e,t=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(Tn(e.resolver))}"`),e.attr)for(let[f,h]of Object.entries(Vi(e.attr)))h!==null&&h!==!1&&h!==void 0&&o.push(`${f}="${this._escapeAttr(String(h))}"`);let l=o.length?" "+o.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?`<${a}${l}>
18
+ `:"")}_nodeToXml(e,t=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(Cn(e.resolver))}"`),e.attr)for(let[f,p]of Object.entries(Gi(e.attr)))p!==null&&p!==!1&&p!==void 0&&o.push(`${f}="${this._escapeAttr(String(p))}"`);let l=o.length?" "+o.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?`<${a}${l}>
19
19
  ${f}
20
- ${" ".repeat(i)}</${a}>`:`<${a}${l}>${f}</${a}>`:t===null||t.includes(a)?`<${a}${l}/>`:`<${a}${l}></${a}>`}if(u==null||u==="")return t===null||t.includes(a)?`<${a}${l}/>`:`<${a}${l}></${a}>`;let c=u instanceof Date&&!Number.isNaN(u.getTime())?Bh(u):String(u),d=this._escapeXml(c);return`<${a}${l}>${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,t={}){let{tagAttribute:n=null}=t,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 uu.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 a=s.tagName,o={};for(let m=0;m<s.attributes.length;m++){let g=s.attributes[m];o[g.name]=g.value}let l=qi(o._resolver);l&&delete o._resolver;let u=String(o._T||"").toUpperCase()==="BAG";Object.assign(o,va(o));let c=a;"_tag"in o&&(c=o._tag,delete o._tag),t&&t in o&&(c=o[t],delete o[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(o).length>0?o:null)}else{let m=s.textContent||"";p=n.setItem(c,m,Object.keys(o).length>0?o:null)}l&&(p.resolver=l),p.xmlTag=a}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),a=s.headers.get("content-type")||"",o=await s.text();if(a.includes("json"))return r.fromTytx(o);if(a.includes("xml"))return r.fromXml(o);let l=o.trim();if(l.startsWith("<"))return r.fromXml(o);if(l.startsWith("{")||l.startsWith("["))return r.fromTytx(o);throw new Dn(`Unsupported content-type: ${a}`)}toJson(e=!0){let t=[];for(let n of this._nodes)t.push(this._nodeToJsonDict(n,e));return e?oe(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 a of n._nodes)s.push(n._nodeToJsonDict(a,t));n=s}let i={label:e.label,value:n,attr:Vi(e.attr)};return e.nodeTag!==null&&(i.tag=e.nodeTag),e.resolver&&(i.resolver=Tn(e.resolver)),i}static fromJson(e,t={}){return lu||(console.warn("Bag.fromJson is deprecated; use Bag.fromTytx"),lu=!0),this.fromTytx(e,"json",t)}toStringTree(e=!0,t=null,n="",i=!0){t===null&&(t=new Map);let s=[],a=[...this._nodes];for(let o=0;o<a.length;o++){let l=a[o],u=o===a.length-1,c=l.getValue(e),d=l.getAttr(),f="",h=Object.keys(d);h.length>0&&(f=" ["+h.map(b=>`${b}=${JSON.stringify(d[b])}`).join(", ")+"]");let p=u?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",m=n+(u?" ":"\u2502 ");if(c instanceof r){let g=l,b=c.backref?"(*)":"";if(t.has(g))s.push(`${n}${p}${l.label}${b}${f} \u2192 (circular ref)`);else{t.set(g,l.label),s.push(`${n}${p}${l.label}${b}${f}`);let y=c.toStringTree(e,t,m,u);y&&s.push(y)}}else{let g;if(c===null)g="null";else if(c===void 0)g="undefined";else if(c instanceof ArrayBuffer||c instanceof Uint8Array){let b=new TextDecoder("utf-8",{fatal:!1}),y=c instanceof ArrayBuffer?new Uint8Array(c):c;g=b.decode(y)}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(`
21
- `)}toString(e=!0,t=null,n=""){t||(t=new Set);let i=[],s=[...this._nodes];for(let a=0;a<s.length;a++){let o=s[a],l=a===s.length-1,u=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=l?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",h=n+(l?" ":"\u2502 ");if(u&&typeof u._htraverse=="function"){let p=o;if(t.has(p))i.push(`${n}${f}${o.label}${c} \u2192 (circular ref)`);else{t.add(p),i.push(`${n}${f}${o.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}${o.label}: ${p}${c}`)}}return i.join(`
22
- `)}},Dn=class extends Error{constructor(e){super(e),this.name="BagException"}};ee.registerBagClass(z);wa(z,"X",r=>r._toTytxPayload(),r=>z._fromTytxPayload(r));Ht(z.tytxSuffix,{...Ue(z.tytxSuffix),Bag:z});var du=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 fu(r){return r.endsWith("_")&&du.has(r.slice(0,-1))?r.slice(0,-1):r}function pu(r){let e=fu(r);return e!==r?e:r.startsWith("_")&&du.has(r.slice(1))?r.slice(1):r}function Cn(r,{renderTag:e=null,ns:t=null,dialectName:n=null}={}){let i=e||r;if(!i)return i;if(i=fu(i),t&&!e){let s=`${n}_`;i.startsWith(s)&&(i=i.slice(s.length)),i=`${t}:${i}`}return i}var Lr=Symbol("value"),Gt=new Set(["_meta","datapath","node_id","ns","form","formId","_anchor","updateOn"]);function Te(r){return Object.entries(r||{}).filter(([e])=>!Gt.has(e)).map(([e,t])=>[pu(e),t])}var Se=class extends rt{constructor(e,t,n=null,i=null,s=null,a=null,o=null){super(e,t,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 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 Te(this.getAttr())}runtimeToEvaluate(){let e=new Map(this.fixedAttrItems());return e.set(Lr,this.value),e}absDatapath(e){let t=e;this.pointerType(e)&&(e=(W(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),a=i===-1?"":n.slice(i+1),o;if(s==="FORM")o=this._findMarkedDatapathAncestor(!0,!1,t);else if(s==="ANCHOR")o=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(o=l.source.getNodeByAttr("node_id",s),o==null)throw new Error(`#<id>: cannot resolve ${t}`)}return o.absDatapath(a?`.${a}`:".")}_findMarkedDatapathAncestor(e,t,n){let i=this;for(;i!=null;){let a=i.getAttr()||{};if(e&&(a.formId!=null||a.form===!0)||t&&"_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,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 a=this.data,o=this.absDatapath(e);a.setItem(o,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})}},S=class r extends z{constructor(e=null,t=null){super(e),this._builder=t,this._insertingBuilder=null}get nodeClass(){return Se}_setBuilderItem(e,t,n,...i){let s=t?.map(([o])=>[o,o._builder])||null;if(t)for(let[o,l]of t)o._builder=l;let a=this._insertingBuilder;this._insertingBuilder=e;try{return this.setItem(n,...i)}catch(o){if(this.node(n)==null&&s)for(let[l,u]of s)l._builder=u;throw o}finally{this._insertingBuilder=a}}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,a)=>{if(n.has(s))throw new Error("source contains a cyclic or shared SourceBag branch");n.add(s),t.push([s,a]);for(let o of s.getNodes()){let l=a,u=o._getMeta("subbuilder");u!=null&&(l=a._resolveSubbuilderReference(u,o.getAttr()||{},o.nodeTag)),t.push([o,l]);let c=o.getValue(!0);c instanceof r&&i(c,l)}};return i(this,e),t}};if((Ue(S.tytxSuffix).SourceBag??S)!==S)throw new Error("TYTX subtype name 'SourceBag' is already registered for another class");Ht(S.tytxSuffix,{...Ue(S.tytxSuffix),SourceBag:S});function Fh(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 Lh=new Set(["then","toJSON"]),mu=new WeakMap;function pe(r){return mu.get(r)||r}function Sn(r){if(r==null)return r;r=pe(r);let e=r._builder||r.parentBag&&r.parentBag._builder;return e?e.wrapSource(r):r}function gu(r,e){let t=e instanceof z,n=new Proxy(e,{get(i,s){if(typeof s=="symbol"||s.startsWith("_")||Lh.has(s))return Reflect.get(i,s,i);let a=r.schemaTag(s);if(t&&a)return hu(r,i,a,t);if(s in i){let l=Reflect.get(i,s,i);return typeof l=="function"?l.bind(i):l}if(a)return hu(r,i,a,t);let o=r.containerMethod(s);if(o)return(...l)=>r[o](r.wrapSource(i),...l)}});return mu.set(n,e),n}function hu(r,e,t,n){return(...i)=>{let{value:s,attrs:a}=Fh(i),o=n?r.bagCall(e,t,s,a):r.commandOnNode(e,t,s,a);return o.builder.wrapSource(o)}}function xa(r,e,{transport:t="json"}={}){let n=Q(r,t==="json"?null:t);if(!(n instanceof S))throw new TypeError("TYTX payload did not decode to SourceBag");return n.bindBuilder(e)}var _u=/^[A-Za-z_][A-Za-z0-9_]*$/,Ph=new Set(["positional_only","positional_or_keyword","keyword_only","var_positional","var_keyword"]),jh=new Set(["framework","value","attribute"]),Uh=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 Yt(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function T(r,e){throw new TypeError(`${r}: ${e}`)}function nt(r,e,t,n){Yt(r)||T(n,"must be an object");for(let i of Object.keys(r))e.includes(i)||T(n,`unknown field '${i}'`);for(let i of t)Object.hasOwn(r,i)||T(n,`missing field '${i}'`)}function Zt(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)=>Zt(t,`${e}[${n}]`));if(Yt(r))return Object.entries(r).forEach(([t,n])=>Zt(n,`${e}.${t}`));T(e,"must be lossless JSON data")}}function qh(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 Xt(r,e,t=!1,n=null){if(r===null)return null;switch(nt(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 nt(r,["kind","name"],["kind","name"],e),n||T(e,"custom references require a catalog; nested catalog references are unsupported"),n.resolve(r.name,e);case"dtype":{nt(r,["kind","dtype"],["kind","dtype"],e);let i=r.dtype;typeof i!="string"&&T(e,"dtype must be a string");let s=En(i);return!s&&i!=="NN"&&T(e,`unknown dtype '${i}'`),{...r,test:o=>i==="NN"?o===null:i==="N"?ye(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?Yt(o)&&[Object.prototype,null].includes(Object.getPrototypeOf(o)):o instanceof s}}case"any":return{...r,test:i=>!0};case"type":{(typeof r.module!="string"||typeof r.name!="string")&&T(e,"type requires string module/name");let i=`${r.module}.${r.name}`;if(i==="collections.abc.Callable")return{...r,test:a=>typeof a=="function",portable:!1};let s=Uh.get(i);return s||T(e,`unsupported type '${i}'`),{...r,test:s}}case"union":{(!Array.isArray(r.items)||!r.items.length)&&T(e,"union items must be non-empty");let i=r.items.map((s,a)=>Xt(s,`${e}.items[${a}]`,!0,n));return{...r,items:i,inputConstraint:i.some(s=>s.inputConstraint),test:s=>i.some(a=>a.test&&a.test(s))}}case"literal":return Array.isArray(r.values)||T(e,"literal values must be an array"),r.values.forEach((i,s)=>Zt(i,`${e}.values[${s}]`)),{...r,test:i=>r.values.some(s=>Object.is(s,i))};case"annotated":{Array.isArray(r.metadata)||T(e,"annotated metadata must be an array"),r.metadata.some(a=>!["regex","range","value"].includes(a?.kind))&&T(e,"unsupported annotation metadata kind");let i=Xt(r.base,`${e}.base`,!0,n),s=r.metadata.map((a,o)=>Xt(a,`${e}.metadata[${o}]`,!0,n));return{...r,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(r,i)||T(e,`range missing '${i}'`);for(let i of["ge","le","gt","lt"])r[i]!==null&&(typeof r[i]!="number"||!Number.isFinite(r[i]))&&T(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)&&T(e,"regex requires pattern and non-negative integer flags");let i=r.flags&-59;i&&T(e,`unsupported Python regex flags ${i}`),r.flags&2&&T(e,"IGNORECASE is not portable across Python and JavaScript Unicode rules"),/\\[AZzUwWdDsSabBN0-9]|\(\?P[<=!]|\(\?\(|\(\?>|\(\?#|\(\?[aiLmsux-]|[+*?}]\+|\{,/.test(r.pattern.replaceAll(String.raw`[\s\S]`,"."))&&T(e,"regex uses a non-portable construct or character class");let s="uy";r.flags&16&&(s+="s");let a;try{a=new RegExp(`(?:${qh(r.pattern,r.flags)})(?![\\s\\S])`,s)}catch(o){T(e,`invalid portable regex: ${o.message}`)}return{...r,test:o=>typeof o!="string"?!1:(a.lastIndex=0,a.test(o))}}case"value":return Zt(r.value,`${e}.value`),{...r};case"generic":{let i=Xt(r.origin,`${e}.origin`,!0,n);(r.origin?.kind!=="type"||r.origin.module!=="builtins"||!["list","dict","tuple","set"].includes(r.origin.name))&&T(e,"only list, dict, tuple and set generic origins are supported"),Array.isArray(r.arguments)||T(e,"generic arguments must be an array");let s=r.arguments.map((a,o)=>Xt(a,`${e}.arguments[${o}]`,!0,n));return{...r,origin:i,arguments:s,inputConstraint:s.some(a=>a.inputConstraint),test:a=>i.test(a)&&Vh(r.origin,s,a)}}case"arguments":T(e,"Callable argument-list descriptors are not supported by Python validation");case"ellipsis":return t||T(e,"ellipsis is only valid as a nested descriptor"),{...r};default:T(e,`unknown annotation kind '${r.kind}'`)}}function Vh(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 wu(r,e){if(r===null)return null;if(typeof r!="string"&&T(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)&&T(e,`invalid cardinality item '${n}'`);let s=i.match(/^([A-Za-z_][A-Za-z0-9_]*|\*)(?:\[(?:(\d+)|(?:(\d*):(\d*)))\])?$/);s||T(e,`invalid cardinality item '${n}'`);let[,a,o,l,u]=s;t.has(a)&&T(e,`duplicate tag '${a}'`);let c=0,d=1/0;i.includes("[")&&(i.includes(":")?(c=l?Number(l):0,d=u?Number(u):1/0):c=d=Number(o)),d<c&&T(e,`maximum ${d} is below minimum ${c}`),t.set(a,{min:c,max:d})}return t.has("*")&&t.size>1&&T(e,"wildcard '*' cannot be combined with named tags"),t}function yu(r,e){if(r===null)return null;typeof r!="string"&&T(e,"must be string or null");let t=new Set;for(let n of r.split(",")){let i=n.trim();i&&((!_u.test(i)||t.has(i))&&T(e,`invalid or duplicate parent '${n}'`),t.add(i))}return t}function zh(r,e,t){if(r===null)return null;nt(r,["parameters","accepts_var_keyword","accepts_var_positional"],[],e);let n=r.parameters??[];Array.isArray(n)||T(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")&&T(e,"invalid signature descriptor");let i=new Set,s=!1,a=!1,o=r.parameters.map((l,u)=>{let c=`${e}.parameters[${u}]`;return nt(l,["name","kind","role","annotation","has_default","default"],["name","kind","role","annotation","has_default"],c),(typeof l.name!="string"||!_u.test(l.name)||i.has(l.name))&&T(c,"invalid or duplicate parameter name"),i.add(l.name),(!Ph.has(l.kind)||!jh.has(l.role)||typeof l.has_default!="boolean")&&T(c,"invalid kind, role, or has_default"),l.has_default!==Object.hasOwn(l,"default")&&T(c,"default presence must equal has_default"),l.has_default&&Zt(l.default,`${c}.default`),s||=l.kind==="var_keyword",a||=l.kind==="var_positional",{...l,annotation:Xt(l.annotation,`${c}.annotation`,!1,t)}});return(s!==r.accepts_var_keyword||a!==r.accepts_var_positional)&&T(e,"variadic summary flags do not match parameters"),{...r,parameters:o}}function bu(r,e,t,n){let i=["doc","sub_tags","parent_tags","inherits_from","ns","attributes",...t?["node_label","collection_key"]:[],"_meta"];nt(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"&&T(e,`${s} must be string or null`);return r._meta!==null&&(Yt(r._meta)||T(e,"_meta must be object or null"),Zt(r._meta,`${e}._meta`)),wu(r.sub_tags,`${e}.sub_tags`),yu(r.parent_tags,`${e}.parent_tags`),{...r,attributes:zh(r.attributes,`${e}.attributes`,n)}}function vu(r){return r?r.split(",").map(e=>e.trim()).filter(Boolean):[]}function ku(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 Eu(r){let e={...r};return e._subSpec=Object.hasOwn(e,"sub_tags")?wu(e.sub_tags,"resolved.sub_tags"):null,e._parentSpec=Object.hasOwn(e,"parent_tags")?yu(e.parent_tags,"resolved.parent_tags"):null,e}function Au(r,e,t,n){if(t.get(r)===1&&T(n,`inheritance cycle at '${r}'`),t.get(r)===2)return e[r];let i=e[r];i||T(n,`unknown abstract '${r}'`),t.set(r,1);let s={...i};for(let a of vu(i.inherits_from))s=ku(Au(a,e,t,n),s);return s=Eu(s),t.set(r,2),e[r]=s,s}function Ta({abstracts:r={},elements:e={}}){let t={...r},n=new Map;for(let s of Object.keys(t))Au(s,t,n,`abstracts.${s}.inherits_from`);let i={};for(let[s,a]of Object.entries(e)){let o={...a};for(let l of vu(a.inherits_from)){let u=t[l];u||T(`elements.${s}.inherits_from`,`unknown abstract '${l}'`),o=ku(u,o)}i[s]=Eu(o)}return{abstracts:t,elements:i}}function Da(r){nt(r,["document_format","grammar","abstracts","elements","custom_types"],["document_format","grammar","abstracts","elements"],"grammar document"),nt(r.document_format,["name","version"],["name","version"],"document_format"),(r.document_format.name!=="builder_grammar"||!["1.1","1.2"].includes(r.document_format.version))&&T("document_format","expected builder_grammar version 1.1 or 1.2"),nt(r.grammar,["name","version","title","description"],["name","version","title","description"],"grammar"),(typeof r.grammar.name!="string"||!r.grammar.name)&&T("grammar.name","must be non-empty string");for(let i of["version","title","description"])r.grammar[i]!==null&&typeof r.grammar[i]!="string"&&T(`grammar.${i}`,"must be string or null");(!Yt(r.abstracts)||!Yt(r.elements))&&T("grammar document","abstracts/elements must be objects"),Object.hasOwn(r,"custom_types")&&r.document_format.version!=="1.2"&&T("custom_types","requires version 1.2");let e=zi.fromJSON(r.custom_types??{}),t={};for(let[i,s]of Object.entries(r.abstracts))(!i||i.startsWith("_"))&&T("abstracts",`invalid public name '${i}'`),t[i]=bu(s,`abstracts.${i}`,!1,e);let n={};for(let[i,s]of Object.entries(r.elements))(!i||i.startsWith("_"))&&T("elements",`invalid public name '${i}'`),n[i]=bu(s,`elements.${i}`,!0,e);return{grammar:structuredClone(r.grammar),abstracts:t,elements:n}}function xu(r,e,t,n){let i=e.attributes;if(!i)return;let s={...n};t!=null&&(s.node_value=t);let a=new Set(i.parameters.filter(u=>u.role==="attribute").map(u=>u.name)),o=new Set(["node_label","node_position","node_id","target_id","datapath","iterate","store","_tag","_meta","ns"]);if(!i.accepts_var_keyword)for(let u of Object.keys(n))!a.has(u)&&!o.has(u)&&T(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&&T(r,`missing required ${u.role} '${u.name}'`),c&&u.annotation!==null&&(!u.annotation.test||!u.annotation.test(s[u.name]))&&T(r,`invalid value for ${u.role} '${u.name}'`)}}var zi=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.#r(e,{kind:"annotated",base:s,metadata:[n]})}#r(e,t){(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_]*$/.test(e)||e in this||["to_dict","from_dict"].includes(e)||Hh.has(e))&&T("custom_types",`invalid, reserved or duplicate name '${e}'`),nt(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))&&T(`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))&&T(`custom_types.${e}`,"portable Regex requires str; portable Range requires int or float"),Zt(t,`custom_types.${e}`);let i=structuredClone(t),s=Xt(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.#t.set(e,{...a,inputConstraint:!0,test:s.test}),a}resolve(e,t="custom_types"){return this.#t.has(e)||T(t,`unknown custom type '${e}'`),{...this.#t.get(e)}}validate(e,t){return this.resolve(e).test(t)||T(`custom_types.${e}`,"invalid input value"),!0}toJSON(){return structuredClone(Object.fromEntries(this.#e))}static fromJSON(e){Yt(e)||T("custom_types","must be an object");let t=new r;for(let[n,i]of Object.entries(e))t.#r(n,i);return t}},Hh=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 Tu(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 a=s.role==="value"?t:n[s.name];a!==void 0&&(s.annotation.test(a)||T(r,`invalid input for '${s.name}' (custom type)`))}}function Du(r,e,t=[]){if(e===null)return structuredClone(r);if(t.length===2&&t[0]==="custom_types"&&r!==void 0){if(!Ca(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(pt(r)&&pt(e)){let n=structuredClone(r);for(let[i,s]of Object.entries(e))s!==null&&Object.defineProperty(n,i,{value:Du(n[i],s,[...t,i]),enumerable:!0,writable:!0,configurable:!0});return n}return structuredClone(e)}function Ca(r,e){return Object.is(r,e)?!0:Array.isArray(r)&&Array.isArray(e)?r.length===e.length&&r.every((t,n)=>Ca(t,e[n])):pt(r)&&pt(e)?Object.keys(r).length===Object.keys(e).length&&Object.keys(r).every(t=>Object.hasOwn(e,t)&&Ca(r[t],e[t])):!1}function pt(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)&&Object.getPrototypeOf(r)===Object.prototype}function Sa(r){if(!(r===null||typeof r=="string"||typeof r=="boolean")&&!(typeof r=="number"&&Number.isFinite(r))){if(Array.isArray(r)){r.forEach(Sa);return}if(pt(r)){Object.values(r).forEach(Sa);return}throw new TypeError("collection must contain only finite JSON values")}}var ht=class r{#e;constructor(e){Sa(e);let t=["document_format","grammar","abstracts","elements"];if(!pt(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(!pt(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(!pt(e[i]))throw new TypeError(`${i} must be an object`);if(Object.hasOwn(e,"custom_types")&&(n.version!=="1.2"||!pt(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=Du(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 Jt=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 a=this.getRender(n),o;return[o,s]=a._handleMeta(e,s),e._getMeta("subbuilder")||(s=a.adaptAttrs(s)),e.value instanceof S&&(i=this.renderChildren(e.value,t)),a.renderedItem(e,i,s,{tag:o,...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,a,o]=this._expansionInputs(e,t);if(!Object.hasOwn(e.getAttr(),"iterate"))return this._expandBlock(e,i,a,o,n);if(s==null)return[];if(!(s instanceof z))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,a,{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 a=t.iterate;delete t.iterate,delete t.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 l of Object.keys(t)){let u=e.getAttr(l);e.pointerType(u)==="^"&&(t[l]=`^${e.absDatapath(u)}`)}return[s,a,o,t]}_expandBlock(e,t,n,i,s){let a=e.builder._expansionRoot(n);t.call(e.builder,Sn(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 l={...s,depthOffset:this._nodeDepth(e,s.depthOffset||0)};return this.render(o[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=Cn(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 Jt{static mode="xml";renderedItem(e,t,n,{tag:i,pretty:s=!1,depthOffset:a=0}={}){let o=this._formatAttrs(n),l=s?" ".repeat(this._nodeDepth(e,a)):"",u=s?`
23
- `:"";if(Array.isArray(t)){let c=this._composeStringFragments(t);return`${l}<${i}${o}>${u}${c}${l}</${i}>${u}`}return t==null?`${l}<${i}${o}></${i}>${u}`:`${l}<${i}${o}>${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 Cu={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 Su(r){let e=[];for(;r&&r!==Function.prototype;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function Gh(r){let e=Object.create(null),t=(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 Su(r))if(Object.hasOwn(n,"containers"))for(let i of n.containers||[])t(i,i);return e}function Nn(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 On="_root_",Na="_root_",Nu=new Set(["destination","func","value","_on_start"]),Ne=class r{static _sourceClass=S;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 z,this._dataroot.setBackref(),this._dataroot.setItem(Na,new z),this.data=this._dataroot.getItem(Na),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(On,new t(null,this)),this.source=this._sourceroot.getItem(On)}wrapSource(e){if(e=pe(e),!(e instanceof S)&&!(e instanceof Se))throw new TypeError("wrapSource requires a SourceBag or SourceBagNode");let t=this._sourceHandles.get(e);return t||(t=gu(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 ht(t.toDocument()).update(e):new ht(e),i=Da(n.toDocument()),s=Ta(i),a=Nn(s.elements);this._classCollection=n,this._classSchema=s.elements,this._abstracts=s.abstracts,this._tagNames=a}static{this.defineGrammar(Cu)}get _containers(){return Gh(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??=Nn(this.schema):this.constructor._tagNames??=Nn(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 ht(e):new ht(n.toDocument()).update(e),s=Da(i.toDocument()),a=Ta(s),o=Nn(a.elements);return this._collection=i,this._schemaOverride=a.elements,this._tagNamesOverride=o,this}validateCustomTypes(e){let t=e.parentBag?.parentNode?.builder||e.parentBag?._builder,n=t&&t!==this&&t.schema[e.nodeTag]?._meta?.subbuilder?t:this;Tu(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 xu(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 S?null:e.value;this.validateNodeValues(e.nodeTag,s,n||e.getAttr?.()||{});let a=this.schema[this.schemaTag(e.nodeTag)],o=i||(e.value instanceof S?e.value.getNodes().map(l=>l.nodeTag):null);return o&&this._validateChildren(e.nodeTag,a,o,!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 a=this.schemaTag(t);if(!a)throw new Error(`unknown parent element '${t}'`);return this._validateParent(n,i,a),!0}bagCall(e,t,n,i){return this.setChild(e,t,n,i)}commandOnNode(e,t,n,i){if(e=pe(e),e.value instanceof S)return this.setChild(e.value,t,n,i);let s=e.value,a=new e.parentBag.constructor(null,e.builder||this),o=this.setChild(a,t,n,i,e);return this.promoteNodeValue(e,s,a),o}promoteNodeValue(e,t,n){e.setValue(n)}setChild(e,t,n,i,s=null){let a={...i},o=this.schema[t];if(!o)throw new Error(`unknown element '${t}'`);this.validateNodeValues(t,n,a);let l=o._meta?.subbuilder,c=(l==null?null:this._resolveSubbuilderReference(l,a,t))||this,d=n instanceof S?n._builderBindingPlan(c):null,f=s?.rootBuilder||e.root._builder||this;if(a.node_id!=null&&f.source.getNodeByAttr("node_id",a.node_id))throw new Error(`Duplicate node_id '${a.node_id}'`);n instanceof S&&this._validateChildren(t,o,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(o))this._validateParent(t,o,h.nodeTag),this._validateChildren(h.nodeTag,p,[...e.getNodes().map(w=>w.nodeTag),t],!1);else if(!p&&!h?._getMeta("subbuilder")&&o._parentSpec!=null&&this._countsForGrammar(o))throw new Error(`'${t}' 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 b;if(p?.collection_key){if(g!=null)throw new Error(`'${t}': node_label is not allowed in a collection`);b=this._collectionLabel(p.collection_key,t,a)}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`);b=t}else b=g||o.node_label||this._autoLabel(e,t)}if(e.node(b)!=null)throw new Error(`duplicate node label '${b}'`);return e._setBuilderItem(c,d,b,n,a,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 a=new Map;for(let o of n){let l=this.schema[o];if(l&&!this._countsForGrammar(l))continue;let u=s.get(o);if(!u)throw new Error(`'${o}' not allowed as child of '${e}'`);let c=(a.get(o)||0)+1;if(a.set(o,c),c>u.max)throw new Error(`too many '${o}' in '${e}'`)}return i?[...s].filter(([o,l])=>(a.get(o)||0)<l.min).map(([o])=>o):[]}_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,a)=>i(a)):i(e)}validateSource(){let e=[],t=(n,i="")=>{for(let s of n.getNodes()){let a=i?`${i}.${s.label}`:s.label,o=s.builder;o.validateCustomTypes(s);let l=o.schema[s.nodeTag];if(l&&!s._getMeta("data_element,subbuilder,component").some(Boolean)){let u=s.value instanceof S?s.value.getNodes().map(d=>d.nodeTag):[],c=o._validateChildren(s.nodeTag,l,u,!0);c.length&&e.push([a,c])}s.value instanceof S&&t(s.value,a)}};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("node_id",e);if(t==null)throw new Error(`node_id 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()),a=new Map([...Object.entries(e.getAttr()),...e.fixedAttrItems()]);for(let[c,d]of[...i])if(!(typeof c!="string"||!W(d)))for(let f of lt(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){t.set(c,d.resolve());continue}let f=typeof c=="string"?W(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)),!o&&!h.includes("?")&&c===Lr){let p=this.data.getNode(h);p&&Object.assign(n,p.getAttr("_wdg"))}}let l=so(i,t,(c,d,f,h)=>this.evaluatePointerExpression(e,c,d,f,h)),u=l.get(Lr);l.delete(Lr);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))Nu.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 S&&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 o of Su(this.constructor))if(Object.hasOwn(o,"components"))for(let l of o.components||[])e[l]=l;if(!Object.keys(e).length)return;let t={...this.schema},n={};for(let[o,l]of Object.entries(e))t[o]={sub_tags:"",_meta:{component:!0}},n[o.toLowerCase()]=l;let i=Nn(t),s=this._collection||this.constructor._classCollection,a=s.toDocument();a.abstracts={},a.elements=Object.fromEntries(Object.keys(e).map(o=>[o,t[o]])),this._collection=new ht(s.toDocument()).update(a),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(On,new t(null,this),e?{datapath:e}:null),n.getItem(On)}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,a={...s?.renderOpts,...n};return i.finalize(this.materialize(e,a),s,a)}};Ne._registry=new Map;var Xh=new Set(["short","medium","long","full"]),Yh=/('(?:[^']|'')*'|[a-zA-Z]+|[^a-zA-Z']+)/g;function Zh(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||oe(r).split("::").at(-1);if(!["D","H","DH","DHZ"].includes(t))throw new RangeError(`Unsupported temporal dtype: ${t}`);return t}function Jh(r,e,t,n){let i=e.match(Yh)||[];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(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:()=>a({month:"short"}),MMMM:()=>a({month:"long"}),d:()=>String(r.getUTCDate()),dd:()=>s(r.getUTCDate()),EEE:()=>a({weekday:"short"}),EEEE:()=>a({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 Ou(r,{format:e,mask:t,locale:n,dtype:i,places:s}={}){let a=r==null?"":String(r);if(r!=null&&r!==""&&(e!=null&&e!==""||s!=null))if(typeof r=="number"||ye(r))a=Qh(r,{format:e,locale:n,places:s});else{let o=Zh(r,i);if(Xh.has(e)){let l={timeZone:"UTC"};o!=="H"&&(l.dateStyle=e),o!=="D"&&(l.timeStyle=e),a=new Intl.DateTimeFormat(n||void 0,l).format(r)}else a=Jh(r,String(e),n||void 0,o)}return t==null?a:String(t).replaceAll("%s",()=>a)}function Kh({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 Qh(r,e={}){if(typeof r!="number"&&!ye(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,Kh(e));if(ye(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(ye(r)?r.toString():r)}var em=new Set(["style","script"]),tm=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"]),Iu=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"]),In=new Set(["rounded","gradient","shadow","transform","transition","zoom","filter"]),Bu=r=>r===!0?"true":r===!1?"false":String(r),Hi=r=>typeof r=="number"&&Number.isFinite(r)?`${r}px`:String(r);function rm(r){if(Iu.has(r))return!0;for(let e of Iu)if(r.startsWith(`${e}_`))return!0;return!1}function nm(r){let e=new Map;if(!r)return e;let t=[],n=0,i=null,s=!1,a=!1,o=0,l=String(r);for(let u=0;u<l.length;u+=1){let c=l[u],d=l[u+1];if(a){c==="*"&&d==="/"&&(a=!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==="*"?(a=!0,u+=1):"([{".includes(c)?o+=1:")]}".includes(c)&&o>0?o-=1:c===";"&&o===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 Qt=class extends Jt{static mode="html";renderedItem(e,t,n,{tag:i,xml:s=!0,pretty:a=!1,depthOffset:o=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=Ou(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 A=this.builder.targetId(e);A!==null&&(g+=` id="${this._htmlAttrValue(A)}"`)}for(let[A,C]of Object.entries(e.getAttr()))e.pointerType(C)&&(g+=` data-${this.adapt(A)}-pointer="${this._htmlAttrValue(e.absDatapath(C))}"`)}let b=a?" ".repeat(this._nodeDepth(e,o)):"",y=a?`
24
- `:"";if(e._getMeta("void"))return`${b}<${i}${g}${s?"/":""}>${y}`;if(Array.isArray(t)){let A=this._composeStringFragments(t);return`${b}<${i}${g}>${y}${A}${b}</${i}>${y}`}if(t==null)return`${b}<${i}${g}></${i}>${y}`;let w=typeof t=="string"&&t.endsWith("::HTML")?t.slice(0,-6):em.has(i)?String(t):this._escapeText(t);return`${b}<${i}${g}>${w}</${i}>${y}`}_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,a]of Object.entries(e||{}))if(s.startsWith(`${this.builder.constructor._name}_`))t[this.adapt(s)]=a;else if(s==="dtype")t.dtype=a;else{if(this.builder.constructor.retainedAttrPrefixes.some(o=>s.startsWith(o)))continue;this._isStyleContribution(s)?n[s]=a:t[s]=a}let i=this._adaptStyle(n);return i&&(t.style=i),t}_isStyleContribution(e){if(e==="style"||e.startsWith("style_")||In.has(e))return!0;let t=e.includes("_")?e.slice(0,e.indexOf("_")):null;return t!==null&&In.has(t)||rm(e)}_adaptStyle(e){let t=nm(e.style),n=new Map,i=new Map;for(let[s,a]of Object.entries(e))if(s!=="style")if(s.startsWith("style_"))t.set(s.slice(6).replaceAll("_","-"),Bu(a));else if(In.has(s))n.set(s,a);else{let o=s.indexOf("_"),l=o<0?s:s.slice(0,o);o>=0&&In.has(l)?(i.has(l)||i.set(l,{}),i.get(l)[s.slice(o+1)]=a):t.set(s.replaceAll("_","-"),Bu(a))}for(let s of In)(n.has(s)||i.has(s))&&this[`_macro_${s}`](n.get(s),i.get(s)||{},t);return[...t].map(([s,a])=>`${s}: ${a}`).join("; ")}_formatAttrs(e){let t=[];for(let[n,i]of Object.entries(e||{}))tm.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,a]of Object.entries(t))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`,Hi(a))}_macro_transform(e,t,n){let i=e===void 0?[]:[String(e)];for(let[s,a]of Object.entries(t))s==="rotate"?i.push(`rotate(${a}deg)`):s==="scale"||s==="translate"?i.push(`${s}(${a})`):s==="translate_x"?i.push(`translateX(${Hi(a)})`):s==="translate_y"?i.push(`translateY(${Hi(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,t,n){let i=e===void 0?[]:[String(e)];for(let[s,a]of Object.entries(t))s==="rotate"?i.push(`hue-rotate(${a}deg)`):s==="blur"?i.push(`blur(${Hi(a)})`):s==="drop_shadow"?i.push(`drop-shadow(${a})`):i.push(`${s.replaceAll("_","-")}(${a})`);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 im=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 Wi(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[im.has(e)?e.replaceAll("_","-"):e,t]))}var er=class extends Kt{static mode="svg";adaptAttrs(e){return Wi(e)}};var Ru={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 It=class extends Ne{static _name="html";static _defaultRenderMode="html";static retainedAttrPrefixes=["validate_","dtype"];static{this.defineGrammar(Ru)}get renderer_html(){return new Qt(this)}};Ne.registerBuilder(It);var Mu={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 Bt=class extends Ne{static _name="svg";static _defaultRenderMode="svg";static{this.defineGrammar(Mu)}get renderer_svg(){return new er(this)}};Ne.registerBuilder(Bt);var $e=class{constructor(e){this.gramlot=e}};var om=/^[a-z][.0-9_a-z\-\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*$/u,lm=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function mt(r){let e=r.code;if(typeof e!="string"||om.exec(e)?.[0]!==e||!e.includes("-")||lm.has(e))throw new TypeError("webcomponent: code must be a literal custom-element name");return e}function $u(r){for(let e of Object.values(r))e&&typeof e=="object"&&$u(e);return Object.freeze(r)}function Fu(r){if(typeof r.dtype!="string"&&!Array.isArray(r.dtype))throw new TypeError("Component parameter requires dtype");let e=(Array.isArray(r.dtype)?r.dtype:[r.dtype]).map(t=>({kind:"dtype",dtype:t}));return r.nullable&&e.push({kind:"dtype",dtype:"NN"}),r.binding&&r.dtype!=="T"&&e.push({kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[\\^=].+",flags:0}]}),e.length===1?e[0]:{kind:"union",items:e}}function Pr({name:r,tag:e,base:t,mixins:n=[],parameters:i={},subTags:s="",presentationDefaults:a=[],dataScope:o=!1,command:l=!1,implementation:u}){if(mt({code:e}),!/^[a-zA-Z][a-zA-Z0-9]*$/.test(r))throw new TypeError("Invalid component authoring name");let c={...t.parameters};for(let d of n)for(let[f,h]of Object.entries(d.parameters)){if(Object.hasOwn(c,f))throw new Error(`Duplicate mixin parameter: ${f}`);c[f]=h}Object.assign(c,i);for(let d of Object.values(c))Fu(d);return Object.freeze({name:r,tag:e,base:t,subTags:s,presentationDefaults:Object.freeze([...a]),dataScope:o,command:l,mixins:Object.freeze([...n]),parameters:$u(structuredClone(c)),implementation:u})}var tr=class{#e=new WeakMap;constructor({name:e,components:t}){this.name=e,this.components=Object.freeze([...t]);let n=new Set,i=new Set;for(let s of t){if(n.has(s.name.toLowerCase())||i.has(s.tag))throw new Error(`Duplicate component: ${s.name}`);n.add(s.name.toLowerCase()),i.add(s.tag)}}toDocument(){return{document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:this.name,version:null,title:this.name,description:null},abstracts:{},elements:Object.fromEntries(this.components.map(e=>[e.name,{doc:null,sub_tags:e.subTags,parent_tags:null,inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[...Object.entries(e.parameters).map(([t,n])=>({name:t,kind:"keyword_only",role:"attribute",annotation:Fu(n),has_default:!0,default:n.default??null})),{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},_meta:{render_tag:e.tag,gramlot_component:{parameters:structuredClone(e.parameters),presentationDefaults:[...e.presentationDefaults],dataScope:e.dataScope,command:e.command}}}]))}}register(e){if(this.#e.has(e))return;let t=[];for(let n of this.components){if(e.customElements.get(n.tag))throw new Error(`Custom element already registered: ${n.tag}`);let i=n.base(e.HTMLElement);for(let a of n.mixins)i=a(i);let s=n.implementation(i);Object.defineProperty(s,"gramlotComponent",{value:n}),t.push([n.tag,s])}for(let[n,i]of t)e.customElements.define(n,i);this.#e.set(e,t)}};function Lu(r){return new tr(r)}function Gi(r,e){return r.parameters=Object.fromEntries(Object.entries(r.constructor.gramlotComponent.parameters).map(([t,n])=>[t,Object.hasOwn(e,t)?e[t]:n.default])),Object.fromEntries(Object.entries(e).filter(([t])=>!Object.hasOwn(r.parameters,t)))}function Pu(r){if(r==="")return[];let e=new Set;return r.split(",").map(t=>{let n=t.indexOf(":"),i=n<0?t:t.slice(0,n),s=n<0?t:t.slice(n+1);if(!i||e.has(i))throw new Error("Invalid or duplicate choice code");return e.add(i),{id:i,caption:s}})}function Xi(r){return class extends r{constructor(){super();let e=this.attachShadow({mode:"open"}),t=this.ownerDocument.createElement("style");t.textContent=`:host{display:inline-block;font:inherit} *,*::before,*::after{box-sizing:border-box}
20
+ ${" ".repeat(i)}</${a}>`:`<${a}${l}>${f}</${a}>`:t===null||t.includes(a)?`<${a}${l}/>`:`<${a}${l}></${a}>`}if(u==null||u==="")return t===null||t.includes(a)?`<${a}${l}/>`:`<${a}${l}></${a}>`;let c=u instanceof Date&&!Number.isNaN(u.getTime())?Fh(u):String(u),d=this._escapeXml(c);return`<${a}${l}>${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,t={}){let{tagAttribute:n=null}=t,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 mu.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 a=s.tagName,o={};for(let m=0;m<s.attributes.length;m++){let g=s.attributes[m];o[g.name]=g.value}let l=Hi(o._resolver);l&&delete o._resolver;let u=String(o._T||"").toUpperCase()==="BAG";Object.assign(o,Da(o));let c=a;"_tag"in o&&(c=o._tag,delete o._tag),t&&t in o&&(c=o[t],delete o[t]);let d=c,f=1;for(;n.getNode(c);)c=`${d}_${f++}`;let p=Array.from(s.childNodes).filter(m=>m.nodeType===1),h;if(p.length>0||u){let m=this._xmlElementToBag(s,t);h=n.setItem(c,m,Object.keys(o).length>0?o:null)}else{let m=s.textContent||"";h=n.setItem(c,m,Object.keys(o).length>0?o:null)}l&&(h.resolver=l),h.xmlTag=a}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),a=s.headers.get("content-type")||"",o=await s.text();if(a.includes("json"))return r.fromTytx(o);if(a.includes("xml"))return r.fromXml(o);let l=o.trim();if(l.startsWith("<"))return r.fromXml(o);if(l.startsWith("{")||l.startsWith("["))return r.fromTytx(o);throw new Sn(`Unsupported content-type: ${a}`)}toJson(e=!0){let t=[];for(let n of this._nodes)t.push(this._nodeToJsonDict(n,e));return e?ce(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 a of n._nodes)s.push(n._nodeToJsonDict(a,t));n=s}let i={label:e.label,value:n,attr:Gi(e.attr)};return e.nodeTag!==null&&(i.tag=e.nodeTag),e.resolver&&(i.resolver=Cn(e.resolver)),i}static fromJson(e,t={}){return hu||(console.warn("Bag.fromJson is deprecated; use Bag.fromTytx"),hu=!0),this.fromTytx(e,"json",t)}toStringTree(e=!0,t=null,n="",i=!0){t===null&&(t=new Map);let s=[],a=[...this._nodes];for(let o=0;o<a.length;o++){let l=a[o],u=o===a.length-1,c=l.getValue(e),d=l.getAttr(),f="",p=Object.keys(d);p.length>0&&(f=" ["+p.map(b=>`${b}=${JSON.stringify(d[b])}`).join(", ")+"]");let h=u?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",m=n+(u?" ":"\u2502 ");if(c instanceof r){let g=l,b=c.backref?"(*)":"";if(t.has(g))s.push(`${n}${h}${l.label}${b}${f} \u2192 (circular ref)`);else{t.set(g,l.label),s.push(`${n}${h}${l.label}${b}${f}`);let y=c.toStringTree(e,t,m,u);y&&s.push(y)}}else{let g;if(c===null)g="null";else if(c===void 0)g="undefined";else if(c instanceof ArrayBuffer||c instanceof Uint8Array){let b=new TextDecoder("utf-8",{fatal:!1}),y=c instanceof ArrayBuffer?new Uint8Array(c):c;g=b.decode(y)}else typeof c=="string"?c.length>50?g=JSON.stringify(c.slice(0,47)+"..."):g=JSON.stringify(c):g=String(c);s.push(`${n}${h}${l.label}: ${g}${f}`)}}return s.join(`
21
+ `)}toString(e=!0,t=null,n=""){t||(t=new Set);let i=[],s=[...this._nodes];for(let a=0;a<s.length;a++){let o=s[a],l=a===s.length-1,u=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=l?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",p=n+(l?" ":"\u2502 ");if(u&&typeof u._htraverse=="function"){let h=o;if(t.has(h))i.push(`${n}${f}${o.label}${c} \u2192 (circular ref)`);else{t.add(h),i.push(`${n}${f}${o.label}${c}`);let m=u.toString(e,t,p);m&&i.push(m)}}else{let h;u==null?h="null":typeof u=="string"&&u.length>50?h=JSON.stringify(u.slice(0,47)+"..."):typeof u=="string"?h=JSON.stringify(u):h=String(u),i.push(`${n}${f}${o.label}: ${h}${c}`)}}return i.join(`
22
+ `)}},Sn=class extends Error{constructor(e){super(e),this.name="BagException"}};te.registerBagClass(V);xa(V,"X",r=>r._toTytxPayload(),r=>V._fromTytxPayload(r));Wt(V.tytxSuffix,{...Ue(V.tytxSuffix),Bag:V});var bu=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 _u(r){return r.endsWith("_")&&bu.has(r.slice(0,-1))?r.slice(0,-1):r}function wu(r){let e=_u(r);return e!==r?e:r.startsWith("_")&&bu.has(r.slice(1))?r.slice(1):r}function Nn(r,{renderTag:e=null,ns:t=null,dialectName:n=null}={}){let i=e||r;if(!i)return i;if(i=_u(i),t&&!e){let s=`${n}_`;i.startsWith(s)&&(i=i.slice(s.length)),i=`${t}:${i}`}return i}var jr=Symbol("value"),Gt=new Set(["_meta","datapath","node_id","ns","form","formId","_anchor","updateOn"]);function De(r){return Object.entries(r||{}).filter(([e])=>!Gt.has(e)).map(([e,t])=>[wu(e),t])}var Ne=class extends rt{constructor(e,t,n=null,i=null,s=null,a=null,o=null){super(e,t,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 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 De(this.getAttr())}runtimeToEvaluate(){let e=new Map(this.fixedAttrItems());return e.set(jr,this.value),e}absDatapath(e){let t=e;this.pointerType(e)&&(e=(G(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),a=i===-1?"":n.slice(i+1),o;if(s==="FORM")o=this._findMarkedDatapathAncestor(!0,!1,t);else if(s==="ANCHOR")o=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(o=l.source.getNodeByAttr("node_id",s),o==null)throw new Error(`#<id>: cannot resolve ${t}`)}return o.absDatapath(a?`.${a}`:".")}_findMarkedDatapathAncestor(e,t,n){let i=this;for(;i!=null;){let a=i.getAttr()||{};if(e&&(a.formId!=null||a.form===!0)||t&&"_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,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 a=this.data,o=this.absDatapath(e);a.setItem(o,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})}},O=class r extends V{constructor(e=null,t=null){super(e),this._builder=t,this._insertingBuilder=null}get nodeClass(){return Ne}_setBuilderItem(e,t,n,...i){let s=t?.map(([o])=>[o,o._builder])||null;if(t)for(let[o,l]of t)o._builder=l;let a=this._insertingBuilder;this._insertingBuilder=e;try{return this.setItem(n,...i)}catch(o){if(this.node(n)==null&&s)for(let[l,u]of s)l._builder=u;throw o}finally{this._insertingBuilder=a}}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,a)=>{if(n.has(s))throw new Error("source contains a cyclic or shared SourceBag branch");n.add(s),t.push([s,a]);for(let o of s.getNodes()){let l=a,u=o._getMeta("subbuilder");u!=null&&(l=a._resolveSubbuilderReference(u,o.getAttr()||{},o.nodeTag)),t.push([o,l]);let c=o.getValue(!0);c instanceof r&&i(c,l)}};return i(this,e),t}};if((Ue(O.tytxSuffix).SourceBag??O)!==O)throw new Error("TYTX subtype name 'SourceBag' is already registered for another class");Wt(O.tytxSuffix,{...Ue(O.tytxSuffix),SourceBag:O});function Uh(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 qh=new Set(["then","toJSON"]),vu=new WeakMap;function ge(r){return vu.get(r)||r}function On(r){if(r==null)return r;r=ge(r);let e=r._builder||r.parentBag&&r.parentBag._builder;return e?e.wrapSource(r):r}function ku(r,e){let t=e instanceof V,n=new Proxy(e,{get(i,s){if(typeof s=="symbol"||s.startsWith("_")||qh.has(s))return Reflect.get(i,s,i);let a=r.schemaTag(s);if(t&&a)return yu(r,i,a,t);if(s in i){let l=Reflect.get(i,s,i);return typeof l=="function"?l.bind(i):l}if(a)return yu(r,i,a,t);let o=r.containerMethod(s);if(o)return(...l)=>r[o](r.wrapSource(i),...l)}});return vu.set(n,e),n}function yu(r,e,t,n){return(...i)=>{let{value:s,attrs:a}=Uh(i),o=n?r.bagCall(e,t,s,a):r.commandOnNode(e,t,s,a);return o.builder.wrapSource(o)}}function Oa(r,e,{transport:t="json"}={}){let n=K(r,t==="json"?null:t);if(!(n instanceof O))throw new TypeError("TYTX payload did not decode to SourceBag");return n.bindBuilder(e)}var Au=/^[A-Za-z_][A-Za-z0-9_]*$/,Vh=new Set(["positional_only","positional_or_keyword","keyword_only","var_positional","var_keyword"]),zh=new Set(["framework","value","attribute"]),Wh=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 Yt(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function T(r,e){throw new TypeError(`${r}: ${e}`)}function nt(r,e,t,n){Yt(r)||T(n,"must be an object");for(let i of Object.keys(r))e.includes(i)||T(n,`unknown field '${i}'`);for(let i of t)Object.hasOwn(r,i)||T(n,`missing field '${i}'`)}function Zt(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)=>Zt(t,`${e}[${n}]`));if(Yt(r))return Object.entries(r).forEach(([t,n])=>Zt(n,`${e}.${t}`));T(e,"must be lossless JSON data")}}function Hh(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 Xt(r,e,t=!1,n=null){if(r===null)return null;switch(nt(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 nt(r,["kind","name"],["kind","name"],e),n||T(e,"custom references require a catalog; nested catalog references are unsupported"),n.resolve(r.name,e);case"dtype":{nt(r,["kind","dtype"],["kind","dtype"],e);let i=r.dtype;typeof i!="string"&&T(e,"dtype must be a string");let s=xn(i);return!s&&i!=="NN"&&T(e,`unknown dtype '${i}'`),{...r,test:o=>i==="NN"?o===null:i==="N"?ke(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?Yt(o)&&[Object.prototype,null].includes(Object.getPrototypeOf(o)):o instanceof s}}case"any":return{...r,test:i=>!0};case"type":{(typeof r.module!="string"||typeof r.name!="string")&&T(e,"type requires string module/name");let i=`${r.module}.${r.name}`;if(i==="collections.abc.Callable")return{...r,test:a=>typeof a=="function",portable:!1};let s=Wh.get(i);return s||T(e,`unsupported type '${i}'`),{...r,test:s}}case"union":{(!Array.isArray(r.items)||!r.items.length)&&T(e,"union items must be non-empty");let i=r.items.map((s,a)=>Xt(s,`${e}.items[${a}]`,!0,n));return{...r,items:i,inputConstraint:i.some(s=>s.inputConstraint),test:s=>i.some(a=>a.test&&a.test(s))}}case"literal":return Array.isArray(r.values)||T(e,"literal values must be an array"),r.values.forEach((i,s)=>Zt(i,`${e}.values[${s}]`)),{...r,test:i=>r.values.some(s=>Object.is(s,i))};case"annotated":{Array.isArray(r.metadata)||T(e,"annotated metadata must be an array"),r.metadata.some(a=>!["regex","range","value"].includes(a?.kind))&&T(e,"unsupported annotation metadata kind");let i=Xt(r.base,`${e}.base`,!0,n),s=r.metadata.map((a,o)=>Xt(a,`${e}.metadata[${o}]`,!0,n));return{...r,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(r,i)||T(e,`range missing '${i}'`);for(let i of["ge","le","gt","lt"])r[i]!==null&&(typeof r[i]!="number"||!Number.isFinite(r[i]))&&T(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)&&T(e,"regex requires pattern and non-negative integer flags");let i=r.flags&-59;i&&T(e,`unsupported Python regex flags ${i}`),r.flags&2&&T(e,"IGNORECASE is not portable across Python and JavaScript Unicode rules"),/\\[AZzUwWdDsSabBN0-9]|\(\?P[<=!]|\(\?\(|\(\?>|\(\?#|\(\?[aiLmsux-]|[+*?}]\+|\{,/.test(r.pattern.replaceAll(String.raw`[\s\S]`,"."))&&T(e,"regex uses a non-portable construct or character class");let s="uy";r.flags&16&&(s+="s");let a;try{a=new RegExp(`(?:${Hh(r.pattern,r.flags)})(?![\\s\\S])`,s)}catch(o){T(e,`invalid portable regex: ${o.message}`)}return{...r,test:o=>typeof o!="string"?!1:(a.lastIndex=0,a.test(o))}}case"value":return Zt(r.value,`${e}.value`),{...r};case"generic":{let i=Xt(r.origin,`${e}.origin`,!0,n);(r.origin?.kind!=="type"||r.origin.module!=="builtins"||!["list","dict","tuple","set"].includes(r.origin.name))&&T(e,"only list, dict, tuple and set generic origins are supported"),Array.isArray(r.arguments)||T(e,"generic arguments must be an array");let s=r.arguments.map((a,o)=>Xt(a,`${e}.arguments[${o}]`,!0,n));return{...r,origin:i,arguments:s,inputConstraint:s.some(a=>a.inputConstraint),test:a=>i.test(a)&&Gh(r.origin,s,a)}}case"arguments":T(e,"Callable argument-list descriptors are not supported by Python validation");case"ellipsis":return t||T(e,"ellipsis is only valid as a nested descriptor"),{...r};default:T(e,`unknown annotation kind '${r.kind}'`)}}function Gh(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 xu(r,e){if(r===null)return null;if(typeof r!="string"&&T(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)&&T(e,`invalid cardinality item '${n}'`);let s=i.match(/^([A-Za-z_][A-Za-z0-9_]*|\*)(?:\[(?:(\d+)|(?:(\d*):(\d*)))\])?$/);s||T(e,`invalid cardinality item '${n}'`);let[,a,o,l,u]=s;t.has(a)&&T(e,`duplicate tag '${a}'`);let c=0,d=1/0;i.includes("[")&&(i.includes(":")?(c=l?Number(l):0,d=u?Number(u):1/0):c=d=Number(o)),d<c&&T(e,`maximum ${d} is below minimum ${c}`),t.set(a,{min:c,max:d})}return t.has("*")&&t.size>1&&T(e,"wildcard '*' cannot be combined with named tags"),t}function Tu(r,e){if(r===null)return null;typeof r!="string"&&T(e,"must be string or null");let t=new Set;for(let n of r.split(",")){let i=n.trim();i&&((!Au.test(i)||t.has(i))&&T(e,`invalid or duplicate parent '${n}'`),t.add(i))}return t}function Xh(r,e,t){if(r===null)return null;nt(r,["parameters","accepts_var_keyword","accepts_var_positional"],[],e);let n=r.parameters??[];Array.isArray(n)||T(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")&&T(e,"invalid signature descriptor");let i=new Set,s=!1,a=!1,o=r.parameters.map((l,u)=>{let c=`${e}.parameters[${u}]`;return nt(l,["name","kind","role","annotation","has_default","default"],["name","kind","role","annotation","has_default"],c),(typeof l.name!="string"||!Au.test(l.name)||i.has(l.name))&&T(c,"invalid or duplicate parameter name"),i.add(l.name),(!Vh.has(l.kind)||!zh.has(l.role)||typeof l.has_default!="boolean")&&T(c,"invalid kind, role, or has_default"),l.has_default!==Object.hasOwn(l,"default")&&T(c,"default presence must equal has_default"),l.has_default&&Zt(l.default,`${c}.default`),s||=l.kind==="var_keyword",a||=l.kind==="var_positional",{...l,annotation:Xt(l.annotation,`${c}.annotation`,!1,t)}});return(s!==r.accepts_var_keyword||a!==r.accepts_var_positional)&&T(e,"variadic summary flags do not match parameters"),{...r,parameters:o}}function Eu(r,e,t,n){let i=["doc","sub_tags","parent_tags","inherits_from","ns","attributes",...t?["node_label","collection_key"]:[],"_meta"];nt(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"&&T(e,`${s} must be string or null`);return r._meta!==null&&(Yt(r._meta)||T(e,"_meta must be object or null"),Zt(r._meta,`${e}._meta`)),xu(r.sub_tags,`${e}.sub_tags`),Tu(r.parent_tags,`${e}.parent_tags`),{...r,attributes:Xh(r.attributes,`${e}.attributes`,n)}}function Du(r){return r?r.split(",").map(e=>e.trim()).filter(Boolean):[]}function Cu(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 Su(r){let e={...r};return e._subSpec=Object.hasOwn(e,"sub_tags")?xu(e.sub_tags,"resolved.sub_tags"):null,e._parentSpec=Object.hasOwn(e,"parent_tags")?Tu(e.parent_tags,"resolved.parent_tags"):null,e}function Nu(r,e,t,n){if(t.get(r)===1&&T(n,`inheritance cycle at '${r}'`),t.get(r)===2)return e[r];let i=e[r];i||T(n,`unknown abstract '${r}'`),t.set(r,1);let s={...i};for(let a of Du(i.inherits_from))s=Cu(Nu(a,e,t,n),s);return s=Su(s),t.set(r,2),e[r]=s,s}function Ia({abstracts:r={},elements:e={}}){let t={...r},n=new Map;for(let s of Object.keys(t))Nu(s,t,n,`abstracts.${s}.inherits_from`);let i={};for(let[s,a]of Object.entries(e)){let o={...a};for(let l of Du(a.inherits_from)){let u=t[l];u||T(`elements.${s}.inherits_from`,`unknown abstract '${l}'`),o=Cu(u,o)}i[s]=Su(o)}return{abstracts:t,elements:i}}function Ba(r){nt(r,["document_format","grammar","abstracts","elements","custom_types"],["document_format","grammar","abstracts","elements"],"grammar document"),nt(r.document_format,["name","version"],["name","version"],"document_format"),(r.document_format.name!=="builder_grammar"||!["1.1","1.2"].includes(r.document_format.version))&&T("document_format","expected builder_grammar version 1.1 or 1.2"),nt(r.grammar,["name","version","title","description"],["name","version","title","description"],"grammar"),(typeof r.grammar.name!="string"||!r.grammar.name)&&T("grammar.name","must be non-empty string");for(let i of["version","title","description"])r.grammar[i]!==null&&typeof r.grammar[i]!="string"&&T(`grammar.${i}`,"must be string or null");(!Yt(r.abstracts)||!Yt(r.elements))&&T("grammar document","abstracts/elements must be objects"),Object.hasOwn(r,"custom_types")&&r.document_format.version!=="1.2"&&T("custom_types","requires version 1.2");let e=Xi.fromJSON(r.custom_types??{}),t={};for(let[i,s]of Object.entries(r.abstracts))(!i||i.startsWith("_"))&&T("abstracts",`invalid public name '${i}'`),t[i]=Eu(s,`abstracts.${i}`,!1,e);let n={};for(let[i,s]of Object.entries(r.elements))(!i||i.startsWith("_"))&&T("elements",`invalid public name '${i}'`),n[i]=Eu(s,`elements.${i}`,!0,e);return{grammar:structuredClone(r.grammar),abstracts:t,elements:n}}function Ou(r,e,t,n){let i=e.attributes;if(!i)return;let s={...n};t!=null&&(s.node_value=t);let a=new Set(i.parameters.filter(u=>u.role==="attribute").map(u=>u.name)),o=new Set(["node_label","node_position","node_id","target_id","datapath","iterate","store","_tag","_meta","ns"]);if(!i.accepts_var_keyword)for(let u of Object.keys(n))!a.has(u)&&!o.has(u)&&T(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&&T(r,`missing required ${u.role} '${u.name}'`),c&&u.annotation!==null&&(!u.annotation.test||!u.annotation.test(s[u.name]))&&T(r,`invalid value for ${u.role} '${u.name}'`)}}var Xi=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.#r(e,{kind:"annotated",base:s,metadata:[n]})}#r(e,t){(typeof e!="string"||!/^[A-Za-z][A-Za-z0-9_]*$/.test(e)||e in this||["to_dict","from_dict"].includes(e)||Yh.has(e))&&T("custom_types",`invalid, reserved or duplicate name '${e}'`),nt(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))&&T(`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))&&T(`custom_types.${e}`,"portable Regex requires str; portable Range requires int or float"),Zt(t,`custom_types.${e}`);let i=structuredClone(t),s=Xt(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.#t.set(e,{...a,inputConstraint:!0,test:s.test}),a}resolve(e,t="custom_types"){return this.#t.has(e)||T(t,`unknown custom type '${e}'`),{...this.#t.get(e)}}validate(e,t){return this.resolve(e).test(t)||T(`custom_types.${e}`,"invalid input value"),!0}toJSON(){return structuredClone(Object.fromEntries(this.#e))}static fromJSON(e){Yt(e)||T("custom_types","must be an object");let t=new r;for(let[n,i]of Object.entries(e))t.#r(n,i);return t}},Yh=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 Iu(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 a=s.role==="value"?t:n[s.name];a!==void 0&&(s.annotation.test(a)||T(r,`invalid input for '${s.name}' (custom type)`))}}function Bu(r,e,t=[]){if(e===null)return structuredClone(r);if(t.length===2&&t[0]==="custom_types"&&r!==void 0){if(!Ra(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(dt(r)&&dt(e)){let n=structuredClone(r);for(let[i,s]of Object.entries(e))s!==null&&Object.defineProperty(n,i,{value:Bu(n[i],s,[...t,i]),enumerable:!0,writable:!0,configurable:!0});return n}return structuredClone(e)}function Ra(r,e){return Object.is(r,e)?!0:Array.isArray(r)&&Array.isArray(e)?r.length===e.length&&r.every((t,n)=>Ra(t,e[n])):dt(r)&&dt(e)?Object.keys(r).length===Object.keys(e).length&&Object.keys(r).every(t=>Object.hasOwn(e,t)&&Ra(r[t],e[t])):!1}function dt(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)&&Object.getPrototypeOf(r)===Object.prototype}function Ma(r){if(!(r===null||typeof r=="string"||typeof r=="boolean")&&!(typeof r=="number"&&Number.isFinite(r))){if(Array.isArray(r)){r.forEach(Ma);return}if(dt(r)){Object.values(r).forEach(Ma);return}throw new TypeError("collection must contain only finite JSON values")}}var ft=class r{#e;constructor(e){Ma(e);let t=["document_format","grammar","abstracts","elements"];if(!dt(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(!dt(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(!dt(e[i]))throw new TypeError(`${i} must be an object`);if(Object.hasOwn(e,"custom_types")&&(n.version!=="1.2"||!dt(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=Bu(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 Jt=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 a=this.getRender(n),o;return[o,s]=a._handleMeta(e,s),e._getMeta("subbuilder")||(s=a.adaptAttrs(s)),e.value instanceof O&&(i=this.renderChildren(e.value,t)),a.renderedItem(e,i,s,{tag:o,...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,a,o]=this._expansionInputs(e,t);if(!Object.hasOwn(e.getAttr(),"iterate"))return this._expandBlock(e,i,a,o,n);if(s==null)return[];if(!(s instanceof V))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,a,{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 a=t.iterate;delete t.iterate,delete t.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 l of Object.keys(t)){let u=e.getAttr(l);e.pointerType(u)==="^"&&(t[l]=`^${e.absDatapath(u)}`)}return[s,a,o,t]}_expandBlock(e,t,n,i,s){let a=e.builder._expansionRoot(n);t.call(e.builder,On(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 l={...s,depthOffset:this._nodeDepth(e,s.depthOffset||0)};return this.render(o[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=Nn(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 Jt{static mode="xml";renderedItem(e,t,n,{tag:i,pretty:s=!1,depthOffset:a=0}={}){let o=this._formatAttrs(n),l=s?" ".repeat(this._nodeDepth(e,a)):"",u=s?`
23
+ `:"";if(Array.isArray(t)){let c=this._composeStringFragments(t);return`${l}<${i}${o}>${u}${c}${l}</${i}>${u}`}return t==null?`${l}<${i}${o}></${i}>${u}`:`${l}<${i}${o}>${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 Ru={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 Mu(r){let e=[];for(;r&&r!==Function.prototype;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function Jh(r){let e=Object.create(null),t=(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 Mu(r))if(Object.hasOwn(n,"containers"))for(let i of n.containers||[])t(i,i);return e}function In(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 Bn="_root_",$a="_root_",$u=new Set(["destination","func","value","_on_start"]),Oe=class r{static _sourceClass=O;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 V,this._dataroot.setBackref(),this._dataroot.setItem($a,new V),this.data=this._dataroot.getItem($a),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(Bn,new t(null,this)),this.source=this._sourceroot.getItem(Bn)}wrapSource(e){if(e=ge(e),!(e instanceof O)&&!(e instanceof Ne))throw new TypeError("wrapSource requires a SourceBag or SourceBagNode");let t=this._sourceHandles.get(e);return t||(t=ku(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 ft(t.toDocument()).update(e):new ft(e),i=Ba(n.toDocument()),s=Ia(i),a=In(s.elements);this._classCollection=n,this._classSchema=s.elements,this._abstracts=s.abstracts,this._tagNames=a}static{this.defineGrammar(Ru)}get _containers(){return Jh(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??=In(this.schema):this.constructor._tagNames??=In(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 ft(e):new ft(n.toDocument()).update(e),s=Ba(i.toDocument()),a=Ia(s),o=In(a.elements);return this._collection=i,this._schemaOverride=a.elements,this._tagNamesOverride=o,this}validateCustomTypes(e){let t=e.parentBag?.parentNode?.builder||e.parentBag?._builder,n=t&&t!==this&&t.schema[e.nodeTag]?._meta?.subbuilder?t:this;Iu(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 Ou(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 O?null:e.value;this.validateNodeValues(e.nodeTag,s,n||e.getAttr?.()||{});let a=this.schema[this.schemaTag(e.nodeTag)],o=i||(e.value instanceof O?e.value.getNodes().map(l=>l.nodeTag):null);return o&&this._validateChildren(e.nodeTag,a,o,!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 a=this.schemaTag(t);if(!a)throw new Error(`unknown parent element '${t}'`);return this._validateParent(n,i,a),!0}bagCall(e,t,n,i){return this.setChild(e,t,n,i)}commandOnNode(e,t,n,i){if(e=ge(e),e.value instanceof O)return this.setChild(e.value,t,n,i);let s=e.value,a=new e.parentBag.constructor(null,e.builder||this),o=this.setChild(a,t,n,i,e);return this.promoteNodeValue(e,s,a),o}promoteNodeValue(e,t,n){e.setValue(n)}setChild(e,t,n,i,s=null){let a={...i},o=this.schema[t];if(!o)throw new Error(`unknown element '${t}'`);this.validateNodeValues(t,n,a);let l=o._meta?.subbuilder,c=(l==null?null:this._resolveSubbuilderReference(l,a,t))||this,d=n instanceof O?n._builderBindingPlan(c):null,f=s?.rootBuilder||e.root._builder||this;if(a.node_id!=null&&f.source.getNodeByAttr("node_id",a.node_id))throw new Error(`Duplicate node_id '${a.node_id}'`);n instanceof O&&this._validateChildren(t,o,n.getNodes().map(w=>w.nodeTag),!1);let p=s||e.parentNode,h=p?.nodeTag?this.schema[p.nodeTag]:null;if(h&&!p._getMeta("subbuilder")&&this._countsForGrammar(o))this._validateParent(t,o,p.nodeTag),this._validateChildren(p.nodeTag,h,[...e.getNodes().map(w=>w.nodeTag),t],!1);else if(!h&&!p?._getMeta("subbuilder")&&o._parentSpec!=null&&this._countsForGrammar(o))throw new Error(`'${t}' 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 b;if(h?.collection_key){if(g!=null)throw new Error(`'${t}': node_label is not allowed in a collection`);b=this._collectionLabel(h.collection_key,t,a)}else{let w=h?._subSpec?.get(t);if(w&&w.max===1){if(g!=null)throw new Error(`'${t}': node_label is not allowed on a singleton`);b=t}else b=g||o.node_label||this._autoLabel(e,t)}if(e.node(b)!=null)throw new Error(`duplicate node label '${b}'`);return e._setBuilderItem(c,d,b,n,a,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 a=new Map;for(let o of n){let l=this.schema[o];if(l&&!this._countsForGrammar(l))continue;let u=s.get(o);if(!u)throw new Error(`'${o}' not allowed as child of '${e}'`);let c=(a.get(o)||0)+1;if(a.set(o,c),c>u.max)throw new Error(`too many '${o}' in '${e}'`)}return i?[...s].filter(([o,l])=>(a.get(o)||0)<l.min).map(([o])=>o):[]}_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,a)=>i(a)):i(e)}validateSource(){let e=[],t=(n,i="")=>{for(let s of n.getNodes()){let a=i?`${i}.${s.label}`:s.label,o=s.builder;o.validateCustomTypes(s);let l=o.schema[s.nodeTag];if(l&&!s._getMeta("data_element,subbuilder,component").some(Boolean)){let u=s.value instanceof O?s.value.getNodes().map(d=>d.nodeTag):[],c=o._validateChildren(s.nodeTag,l,u,!0);c.length&&e.push([a,c])}s.value instanceof O&&t(s.value,a)}};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("node_id",e);if(t==null)throw new Error(`node_id 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()),a=new Map([...Object.entries(e.getAttr()),...e.fixedAttrItems()]);for(let[c,d]of[...i])if(!(typeof c!="string"||!G(d)))for(let f of at(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 te){t.set(c,d.resolve());continue}let f=typeof c=="string"?G(d)?.pointer??d:d;if(!e.pointerType(f)){t.set(c,typeof c=="string"&&typeof d=="string"&&d.startsWith("==")?null:d);continue}let p=e.absDatapath(f);if(t.set(c,this.data.getItem(p)),!o&&!p.includes("?")&&c===jr){let h=this.data.getNode(p);h&&Object.assign(n,h.getAttr("_wdg"))}}let l=fo(i,t,(c,d,f,p)=>this.evaluatePointerExpression(e,c,d,f,p)),u=l.get(jr);l.delete(jr);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))$u.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 O&&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 o of Mu(this.constructor))if(Object.hasOwn(o,"components"))for(let l of o.components||[])e[l]=l;if(!Object.keys(e).length)return;let t={...this.schema},n={};for(let[o,l]of Object.entries(e))t[o]={sub_tags:"",_meta:{component:!0}},n[o.toLowerCase()]=l;let i=In(t),s=this._collection||this.constructor._classCollection,a=s.toDocument();a.abstracts={},a.elements=Object.fromEntries(Object.keys(e).map(o=>[o,t[o]])),this._collection=new ft(s.toDocument()).update(a),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(Bn,new t(null,this),e?{datapath:e}:null),n.getItem(Bn)}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,a={...s?.renderOpts,...n};return i.finalize(this.materialize(e,a),s,a)}};Oe._registry=new Map;var Kh=new Set(["short","medium","long","full"]),Qh=/('(?:[^']|'')*'|[a-zA-Z]+|[^a-zA-Z']+)/g;function em(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||ce(r).split("::").at(-1);if(!["D","H","DH","DHZ"].includes(t))throw new RangeError(`Unsupported temporal dtype: ${t}`);return t}function tm(r,e,t,n){let i=e.match(Qh)||[];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(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:()=>a({month:"short"}),MMMM:()=>a({month:"long"}),d:()=>String(r.getUTCDate()),dd:()=>s(r.getUTCDate()),EEE:()=>a({weekday:"short"}),EEEE:()=>a({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 Fu(r,{format:e,mask:t,locale:n,dtype:i,places:s}={}){let a=r==null?"":String(r);if(r!=null&&r!==""&&(e!=null&&e!==""||s!=null))if(typeof r=="number"||ke(r))a=nm(r,{format:e,locale:n,places:s});else{let o=em(r,i);if(Kh.has(e)){let l={timeZone:"UTC"};o!=="H"&&(l.dateStyle=e),o!=="D"&&(l.timeStyle=e),a=new Intl.DateTimeFormat(n||void 0,l).format(r)}else a=tm(r,String(e),n||void 0,o)}return t==null?a:String(t).replaceAll("%s",()=>a)}function rm({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 nm(r,e={}){if(typeof r!="number"&&!ke(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,rm(e));if(ke(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(ke(r)?r.toString():r)}var im=new Set(["style","script"]),sm=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"]),Lu=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"]),Rn=new Set(["rounded","gradient","shadow","transform","transition","zoom","filter"]),Pu=r=>r===!0?"true":r===!1?"false":String(r),Yi=r=>typeof r=="number"&&Number.isFinite(r)?`${r}px`:String(r);function am(r){if(Lu.has(r))return!0;for(let e of Lu)if(r.startsWith(`${e}_`))return!0;return!1}function om(r){let e=new Map;if(!r)return e;let t=[],n=0,i=null,s=!1,a=!1,o=0,l=String(r);for(let u=0;u<l.length;u+=1){let c=l[u],d=l[u+1];if(a){c==="*"&&d==="/"&&(a=!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==="*"?(a=!0,u+=1):"([{".includes(c)?o+=1:")]}".includes(c)&&o>0?o-=1:c===";"&&o===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 Qt=class extends Jt{static mode="html";renderedItem(e,t,n,{tag:i,xml:s=!0,pretty:a=!1,depthOffset:o=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:p,dtype:h,...m}=n;!Array.isArray(t)&&(c!=null||d!=null||p!=null)&&(t=Fu(t,{format:c,mask:d,places:p,dtype:h,locale:this._displayLocale(e,f)}));let g=this._formatAttrs(m);if(l){if(!Object.hasOwn(n,"id")){let A=this.builder.targetId(e);A!==null&&(g+=` id="${this._htmlAttrValue(A)}"`)}for(let[A,S]of Object.entries(e.getAttr()))e.pointerType(S)&&(g+=` data-${this.adapt(A)}-pointer="${this._htmlAttrValue(e.absDatapath(S))}"`)}let b=a?" ".repeat(this._nodeDepth(e,o)):"",y=a?`
24
+ `:"";if(e._getMeta("void"))return`${b}<${i}${g}${s?"/":""}>${y}`;if(Array.isArray(t)){let A=this._composeStringFragments(t);return`${b}<${i}${g}>${y}${A}${b}</${i}>${y}`}if(t==null)return`${b}<${i}${g}></${i}>${y}`;let w=typeof t=="string"&&t.endsWith("::HTML")?t.slice(0,-6):im.has(i)?String(t):this._escapeText(t);return`${b}<${i}${g}>${w}</${i}>${y}`}_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,a]of Object.entries(e||{}))if(s.startsWith(`${this.builder.constructor._name}_`))t[this.adapt(s)]=a;else if(s==="dtype")t.dtype=a;else{if(this.builder.constructor.retainedAttrPrefixes.some(o=>s.startsWith(o)))continue;this._isStyleContribution(s)?n[s]=a:t[s]=a}let i=this._adaptStyle(n);return i&&(t.style=i),t}_isStyleContribution(e){if(e==="style"||e.startsWith("style_")||Rn.has(e))return!0;let t=e.includes("_")?e.slice(0,e.indexOf("_")):null;return t!==null&&Rn.has(t)||am(e)}_adaptStyle(e){let t=om(e.style),n=new Map,i=new Map;for(let[s,a]of Object.entries(e))if(s!=="style")if(s.startsWith("style_"))t.set(s.slice(6).replaceAll("_","-"),Pu(a));else if(Rn.has(s))n.set(s,a);else{let o=s.indexOf("_"),l=o<0?s:s.slice(0,o);o>=0&&Rn.has(l)?(i.has(l)||i.set(l,{}),i.get(l)[s.slice(o+1)]=a):t.set(s.replaceAll("_","-"),Pu(a))}for(let s of Rn)(n.has(s)||i.has(s))&&this[`_macro_${s}`](n.get(s),i.get(s)||{},t);return[...t].map(([s,a])=>`${s}: ${a}`).join("; ")}_formatAttrs(e){let t=[];for(let[n,i]of Object.entries(e||{}))sm.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,a]of Object.entries(t))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`,Yi(a))}_macro_transform(e,t,n){let i=e===void 0?[]:[String(e)];for(let[s,a]of Object.entries(t))s==="rotate"?i.push(`rotate(${a}deg)`):s==="scale"||s==="translate"?i.push(`${s}(${a})`):s==="translate_x"?i.push(`translateX(${Yi(a)})`):s==="translate_y"?i.push(`translateY(${Yi(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,t,n){let i=e===void 0?[]:[String(e)];for(let[s,a]of Object.entries(t))s==="rotate"?i.push(`hue-rotate(${a}deg)`):s==="blur"?i.push(`blur(${Yi(a)})`):s==="drop_shadow"?i.push(`drop-shadow(${a})`):i.push(`${s.replaceAll("_","-")}(${a})`);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 lm=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 Zi(r){return Object.fromEntries(Object.entries(r||{}).map(([e,t])=>[lm.has(e)?e.replaceAll("_","-"):e,t]))}var er=class extends Kt{static mode="svg";adaptAttrs(e){return Zi(e)}};var ju={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 It=class extends Oe{static _name="html";static _defaultRenderMode="html";static retainedAttrPrefixes=["validate_","dtype"];static{this.defineGrammar(ju)}get renderer_html(){return new Qt(this)}};Oe.registerBuilder(It);var Uu={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 Bt=class extends Oe{static _name="svg";static _defaultRenderMode="svg";static{this.defineGrammar(Uu)}get renderer_svg(){return new er(this)}};Oe.registerBuilder(Bt);var Fe=class{constructor(e){this.gramlot=e}};var dm=/^[a-z][.0-9_a-z\-\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*$/u,fm=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function pt(r){let e=r.code;if(typeof e!="string"||dm.exec(e)?.[0]!==e||!e.includes("-")||fm.has(e))throw new TypeError("webcomponent: code must be a literal custom-element name");return e}function Fa(r){for(let e of Object.values(r))e&&typeof e=="object"&&Fa(e);return Object.freeze(r)}function qu(r){if(typeof r.dtype!="string"&&!Array.isArray(r.dtype))throw new TypeError("Component parameter requires dtype");let e=(Array.isArray(r.dtype)?r.dtype:[r.dtype]).map(t=>({kind:"dtype",dtype:t}));return r.nullable&&e.push({kind:"dtype",dtype:"NN"}),r.binding&&r.dtype!=="T"&&e.push({kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[\\^=].+",flags:0}]}),e.length===1?e[0]:{kind:"union",items:e}}function Ur({name:r,tag:e,base:t,mixins:n=[],parameters:i={},subTags:s="",presentationDefaults:a=[],dataScope:o=!1,command:l=!1,childParameters:u={},sourceContext:c=!1,implementation:d}){if(pt({code:e}),!/^[a-zA-Z][a-zA-Z0-9]*$/.test(r))throw new TypeError("Invalid component authoring name");let f={...t.parameters};for(let p of n)for(let[h,m]of Object.entries(p.parameters)){if(Object.hasOwn(f,h))throw new Error(`Duplicate mixin parameter: ${h}`);f[h]=m}Object.assign(f,i);for(let p of Object.values(f))qu(p);return Object.freeze({name:r,tag:e,base:t,subTags:s,presentationDefaults:Object.freeze([...a]),dataScope:o,command:l,mixins:Object.freeze([...n]),parameters:Fa(structuredClone(f)),childParameters:Fa(structuredClone(u)),sourceContext:c,implementation:d})}var tr=class{#e=new WeakMap;constructor({name:e,components:t}){this.name=e,this.components=Object.freeze([...t]);let n=new Set,i=new Set;for(let s of t){if(n.has(s.name.toLowerCase())||i.has(s.tag))throw new Error(`Duplicate component: ${s.name}`);n.add(s.name.toLowerCase()),i.add(s.tag)}}toDocument(){return{document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:this.name,version:null,title:this.name,description:null},abstracts:{},elements:Object.fromEntries(this.components.map(e=>[e.name,{doc:null,sub_tags:e.subTags,parent_tags:null,inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[...Object.entries(e.parameters).map(([t,n])=>({name:t,kind:"keyword_only",role:"attribute",annotation:qu(n),has_default:!0,default:n.default??null})),{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},_meta:{render_tag:e.tag,gramlot_component:{parameters:structuredClone(e.parameters),presentationDefaults:[...e.presentationDefaults],dataScope:e.dataScope,command:e.command,...Object.keys(e.childParameters).length?{childParameters:structuredClone(e.childParameters)}:{},...e.sourceContext?{sourceContext:!0}:{}}}}]))}}register(e){if(this.#e.has(e))return;let t=[];for(let n of this.components){if(e.customElements.get(n.tag))throw new Error(`Custom element already registered: ${n.tag}`);let i=n.base(e.HTMLElement);for(let a of n.mixins)i=a(i);let s=n.implementation(i);Object.defineProperty(s,"gramlotComponent",{value:n}),t.push([n.tag,s])}for(let[n,i]of t)e.customElements.define(n,i);this.#e.set(e,t)}};function Vu(r){return new tr(r)}function Ji(r,e){return r.parameters=Object.fromEntries(Object.entries(r.constructor.gramlotComponent.parameters).map(([t,n])=>[t,Object.hasOwn(e,t)?e[t]:n.default])),Object.fromEntries(Object.entries(e).filter(([t])=>!Object.hasOwn(r.parameters,t)))}function zu(r){if(r==="")return[];let e=new Set;return r.split(",").map(t=>{let n=t.indexOf(":"),i=n<0?t:t.slice(0,n),s=n<0?t:t.slice(n+1);if(!i||e.has(i))throw new Error("Invalid or duplicate choice code");return e.add(i),{id:i,caption:s}})}function Ki(r){return class extends r{constructor(){super();let e=this.attachShadow({mode:"open"}),t=this.ownerDocument.createElement("style");t.textContent=`:host{display:inline-block;font:inherit} *,*::before,*::after{box-sizing:border-box}
25
25
  input,textarea{font:inherit;max-width:100%} .control-box{min-width:0;color:var(--gramlot-ink,CanvasText)}
26
26
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),textarea{
27
27
  appearance:none;box-sizing:border-box;border:1px solid var(--gramlot-border-control,#7a8798);
@@ -36,7 +36,7 @@ ${" ".repeat(i)}</${a}>`:`<${a}${l}>${f}</${a}>`:t===null||t.includes(a)?`<${a}
36
36
  input[type=range],input[type=color],button{min-width:var(--gramlot-touch-target,0px);min-height:var(--gramlot-touch-target,0px)}
37
37
  input[type=checkbox],input[type=radio]{min-width:calc(var(--gramlot-touch-target,0px) / 2);min-height:calc(var(--gramlot-touch-target,0px) / 2)}
38
38
  .options{display:grid;gap:.3em .8em} .option{display:flex;align-items:center;gap:.35em;min-width:var(--gramlot-touch-target,0px);min-height:var(--gramlot-touch-target,0px)}
39
- .caption:empty{display:none}`,this.controlBox=this.ownerDocument.createElement("div"),this.controlBox.className="control-box",e.append(t,this.controlBox)}projectAttributes(e){return Gi(this,e)}setPageContext(e){this.pageContext=e}releaseControl(){}validateCandidate(e,t){return t(e),{ok:!0,value:e,isCurrent:()=>this.pageContext.isActive()}}finishValidation(){}validateSelection(){throw new TypeError("validate_select requires a constrained choice editor.")}shouldProjectControlValue(){return!0}acceptControlValue(){let e=this.readControlValue();return this.validateCandidate(e,t=>{if(t==null&&!this.constructor.gramlotComponent.parameters.value.nullable)throw new TypeError("This component requires a non-null value.");if(t!=null&&e!=null&&typeof t!=typeof e)throw new TypeError("Validation must preserve the component value type.");this.sameControlValue(e,t)||this.writeControlValue(t)})}sameControlValue(e,t){return Object.is(e,t)}focus(e){this.control.focus(e)}}}function um(r){return class extends Xi(r){constructor(){super(),this.control=this.createControl(),(this.control.localName==="textarea"||this.control.localName==="input"&&["text","password"].includes(this.control.type))&&(this.control.setAttribute("autocomplete","off"),this.control.setAttribute("autocorrect","off"),this.control.setAttribute("autocapitalize","off"),this.control.setAttribute("spellcheck","false")),this.control.id="control";let e=this.ownerDocument.createElement("label");e.className="option",this.optionCaption=this.ownerDocument.createElement("span"),this.optionCaption.className="caption",e.append(this.control,this.optionCaption),this.controlBox.append(e)}projectAttributes(e,t){let n=super.projectAttributes(e,t),{disabled:i,readonly:s}=this.parameters;this.control.disabled=!!i,this.control.readOnly=!!s;for(let[a,o]of Object.entries(this.constructor.gramlotComponent.parameters)){if(o.target==="control"){let l=this.parameters[a]??"";String(this.control[a])!==String(l)&&(this.control[a]=l)}o.target==="optionCaption"&&(this.optionCaption.textContent=this.parameters[a]??"")}return n}}}um.parameters={disabled:{dtype:"B",default:!1,binding:"read"},readonly:{dtype:"B",default:!1,binding:"read"},live:{dtype:"B",default:!1,binding:"read"}};function cm(r){return class extends Xi(r){#e=new Map;#t;#r=null;constructor(){super(),this.control=this.ownerDocument.createElement("div"),this.control.className="options",this.control.id="control",this.control.setAttribute("role",this.multiple?"group":"radiogroup"),this.controlBox.append(this.control),this.control.addEventListener("keydown",e=>{if(!this.multiple||!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Home","End"].includes(e.key))return;let t=[...this.control.querySelectorAll("input:not(:disabled)")],n=t.indexOf(e.target);if(n<0)return;e.preventDefault();let i=e.key==="Home"?0:e.key==="End"?t.length-1:Math.max(0,Math.min(t.length-1,n+(["ArrowDown","ArrowRight"].includes(e.key)?1:-1)));t[i].focus()})}projectAttributes(e,t){let n=super.projectAttributes(e,t),i=this.parameters.values??"";if(i!==this.#t){let a=Pu(i),o=new Set,l=null;for(let{id:u,caption:c}of a){let d=this.#e.get(u);if(!d){let h=this.ownerDocument.createElement("label");h.className="option";let p=this.ownerDocument.createElement("input");p.type=this.choiceType,p.name="choice",p.value=u;let m=this.ownerDocument.createElement("span");h.append(p,m),d={label:h,input:p,text:m},this.#e.set(u,d)}d.text.textContent=c;let f=l?l.nextSibling:this.control.firstChild;f!==d.label&&this.control.insertBefore(d.label,f),l=d.label,o.add(u)}for(let[u,c]of this.#e)o.has(u)||(c.label.remove(),this.#e.delete(u));this.#t=i}let s=this.parameters.cols;if(!Number.isInteger(s)||s<1)throw new TypeError("cols must be a positive integer");this.control.style.gridTemplateColumns=`repeat(${s}, minmax(0, 1fr))`,this.control.disabled=!!this.parameters.disabled,this.control.readOnly=!!this.parameters.readonly;for(let{input:a}of this.#e.values())a.disabled=this.control.disabled||this.control.readOnly;return n}readControlValue(){if(this.multiple){let t=(this.#r?this.#r.split(","):[]).filter(n=>!this.#e.has(n)||this.#e.get(n).input.checked);for(let[n,{input:i}]of this.#e)i.checked&&!t.includes(n)&&t.push(n);return t.join(",")||null}for(let[e,{input:t}]of this.#e)if(t.checked)return e;return null}writeControlValue(e){this.#r=e;let t=this.multiple?new Set(e?e.split(","):[]):null;for(let[n,{input:i}]of this.#e)i.checked=this.multiple?t.has(n):n===e}acceptControlValue(){let e=this.readControlValue();return this.validateCandidate(e,t=>this.writeControlValue(t))}focus(e){let t=[...this.#e.values()];(t.find(({input:n})=>n.checked&&!n.disabled)??t.find(({input:n})=>!n.disabled))?.input.focus(e)}}}cm.parameters={disabled:{dtype:"B",default:!1,binding:"read"},readonly:{dtype:"B",default:!1,binding:"read"}};function ju(r,e,{align:t="start",matchWidth:n=!1}={}){let i=e.ownerDocument.defaultView,s=e.getBoundingClientRect(),a=Math.max(0,i.innerWidth-16);r.style.setProperty("--gramlot-popup-available-width",`${a}px`),n&&(r.style.width=`${Math.min(s.width,a)}px`),r.style.removeProperty("--gramlot-popup-available-height");let o=r.getBoundingClientRect(),l=Math.max(0,i.innerHeight-8-s.bottom-3),u=Math.max(0,s.top-8-3),c=o.height>l&&u>l;r.style.setProperty("--gramlot-popup-available-height",`${c?u:l}px`);let d=r.getBoundingClientRect(),f=t==="end"?s.right-d.width:s.left,h=c?s.top-d.height-3:s.bottom+3;r.style.left=`${Math.max(8,Math.min(f,i.innerWidth-d.width-8))}px`,r.style.top=`${Math.max(8,Math.min(h,i.innerHeight-d.height-8))}px`}function Bn(r){return class extends Xi(r){constructor(){super();let e=this.ownerDocument;this.control=e.createElement("button"),this.control.type="button",this.control.id="control",this.icon=e.createElement("span"),this.icon.className="icon",this.icon.setAttribute("aria-hidden","true"),this.caption=e.createElement("slot"),this.control.append(this.icon,this.caption),this.controlBox.append(this.control);let t=e.createElement("style");t.textContent=`:host{vertical-align:middle} .control-box{display:flex;align-items:stretch}
39
+ .caption:empty{display:none}`,this.controlBox=this.ownerDocument.createElement("div"),this.controlBox.className="control-box",e.append(t,this.controlBox)}projectAttributes(e){return Ji(this,e)}setPageContext(e){this.pageContext=e}releaseControl(){}validateCandidate(e,t){return t(e),{ok:!0,value:e,isCurrent:()=>this.pageContext.isActive()}}finishValidation(){}validateSelection(){throw new TypeError("validate_select requires a constrained choice editor.")}shouldProjectControlValue(){return!0}acceptControlValue(){let e=this.readControlValue();return this.validateCandidate(e,t=>{if(t==null&&!this.constructor.gramlotComponent.parameters.value.nullable)throw new TypeError("This component requires a non-null value.");if(t!=null&&e!=null&&typeof t!=typeof e)throw new TypeError("Validation must preserve the component value type.");this.sameControlValue(e,t)||this.writeControlValue(t)})}sameControlValue(e,t){return Object.is(e,t)}focus(e){this.control.focus(e)}}}function pm(r){return class extends Ki(r){constructor(){super(),this.control=this.createControl(),(this.control.localName==="textarea"||this.control.localName==="input"&&["text","password"].includes(this.control.type))&&(this.control.setAttribute("autocomplete","off"),this.control.setAttribute("autocorrect","off"),this.control.setAttribute("autocapitalize","off"),this.control.setAttribute("spellcheck","false")),this.control.id="control";let e=this.ownerDocument.createElement("label");e.className="option",this.optionCaption=this.ownerDocument.createElement("span"),this.optionCaption.className="caption",e.append(this.control,this.optionCaption),this.controlBox.append(e)}projectAttributes(e,t){let n=super.projectAttributes(e,t),{disabled:i,readonly:s}=this.parameters;this.control.disabled=!!i,this.control.readOnly=!!s;for(let[a,o]of Object.entries(this.constructor.gramlotComponent.parameters)){if(o.target==="control"){let l=this.parameters[a]??"";String(this.control[a])!==String(l)&&(this.control[a]=l)}o.target==="optionCaption"&&(this.optionCaption.textContent=this.parameters[a]??"")}return n}}}pm.parameters={disabled:{dtype:"B",default:!1,binding:"read"},readonly:{dtype:"B",default:!1,binding:"read"},live:{dtype:"B",default:!1,binding:"read"}};function hm(r){return class extends Ki(r){#e=new Map;#t;#r=null;constructor(){super(),this.control=this.ownerDocument.createElement("div"),this.control.className="options",this.control.id="control",this.control.setAttribute("role",this.multiple?"group":"radiogroup"),this.controlBox.append(this.control),this.control.addEventListener("keydown",e=>{if(!this.multiple||!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Home","End"].includes(e.key))return;let t=[...this.control.querySelectorAll("input:not(:disabled)")],n=t.indexOf(e.target);if(n<0)return;e.preventDefault();let i=e.key==="Home"?0:e.key==="End"?t.length-1:Math.max(0,Math.min(t.length-1,n+(["ArrowDown","ArrowRight"].includes(e.key)?1:-1)));t[i].focus()})}projectAttributes(e,t){let n=super.projectAttributes(e,t),i=this.parameters.values??"";if(i!==this.#t){let a=zu(i),o=new Set,l=null;for(let{id:u,caption:c}of a){let d=this.#e.get(u);if(!d){let p=this.ownerDocument.createElement("label");p.className="option";let h=this.ownerDocument.createElement("input");h.type=this.choiceType,h.name="choice",h.value=u;let m=this.ownerDocument.createElement("span");p.append(h,m),d={label:p,input:h,text:m},this.#e.set(u,d)}d.text.textContent=c;let f=l?l.nextSibling:this.control.firstChild;f!==d.label&&this.control.insertBefore(d.label,f),l=d.label,o.add(u)}for(let[u,c]of this.#e)o.has(u)||(c.label.remove(),this.#e.delete(u));this.#t=i}let s=this.parameters.cols;if(!Number.isInteger(s)||s<1)throw new TypeError("cols must be a positive integer");this.control.style.gridTemplateColumns=`repeat(${s}, minmax(0, 1fr))`,this.control.disabled=!!this.parameters.disabled,this.control.readOnly=!!this.parameters.readonly;for(let{input:a}of this.#e.values())a.disabled=this.control.disabled||this.control.readOnly;return n}readControlValue(){if(this.multiple){let t=(this.#r?this.#r.split(","):[]).filter(n=>!this.#e.has(n)||this.#e.get(n).input.checked);for(let[n,{input:i}]of this.#e)i.checked&&!t.includes(n)&&t.push(n);return t.join(",")||null}for(let[e,{input:t}]of this.#e)if(t.checked)return e;return null}writeControlValue(e){this.#r=e;let t=this.multiple?new Set(e?e.split(","):[]):null;for(let[n,{input:i}]of this.#e)i.checked=this.multiple?t.has(n):n===e}acceptControlValue(){let e=this.readControlValue();return this.validateCandidate(e,t=>this.writeControlValue(t))}focus(e){let t=[...this.#e.values()];(t.find(({input:n})=>n.checked&&!n.disabled)??t.find(({input:n})=>!n.disabled))?.input.focus(e)}}}hm.parameters={disabled:{dtype:"B",default:!1,binding:"read"},readonly:{dtype:"B",default:!1,binding:"read"}};function Wu(r,e,{align:t="start",matchWidth:n=!1,inset:i=0}={}){let s=e.ownerDocument.defaultView,a=e.getBoundingClientRect(),o=Math.max(0,s.innerWidth-16);r.style.setProperty("--gramlot-popup-available-width",`${o}px`),n&&(r.style.width=`${Math.min(Math.max(0,a.width-2*i),o)}px`),r.style.removeProperty("--gramlot-popup-available-height");let l=r.getBoundingClientRect(),u=Math.max(0,s.innerHeight-8-a.bottom-3),c=Math.max(0,a.top-8-3),d=l.height>u&&c>u;r.style.setProperty("--gramlot-popup-available-height",`${d?c:u}px`);let f=r.getBoundingClientRect(),p=t==="end"?a.right-f.width-i:a.left+i,h=d?a.top-f.height-3:a.bottom+3;r.style.left=`${Math.max(8,Math.min(p,s.innerWidth-f.width-8))}px`,r.style.top=`${Math.max(8,Math.min(h,s.innerHeight-f.height-8))}px`}function Mn(r){return class extends Ki(r){constructor(){super();let e=this.ownerDocument;this.control=e.createElement("button"),this.control.type="button",this.control.id="control",this.icon=e.createElement("span"),this.icon.className="icon",this.icon.setAttribute("aria-hidden","true"),this.caption=e.createElement("slot"),this.control.append(this.icon,this.caption),this.controlBox.append(this.control);let t=e.createElement("style");t.textContent=`:host{vertical-align:middle} .control-box{display:flex;align-items:stretch}
40
40
  button{display:inline-flex;align-items:center;justify-content:center;gap:var(--gramlot-button-gap,.35em);font:inherit;
41
41
  color:var(--gramlot-ink,CanvasText);background:var(--gramlot-button-background,var(--gramlot-field-background,Canvas));
42
42
  border:1px solid var(--gramlot-border-control,#888);border-radius:var(--gramlot-radius-sm,4px);
@@ -54,17 +54,17 @@ ${" ".repeat(i)}</${a}>`:`<${a}${l}>${f}</${a}>`:t===null||t.includes(a)?`<${a}
54
54
  color:var(--gramlot-ink,CanvasText);background:var(--gramlot-field-background,Canvas);box-shadow:0 3px 12px #0003}
55
55
  :host([role=menuitem]){display:block} :host([role=menuitem]) button{width:100%;justify-content:start;border:0;background:transparent}
56
56
  :host([role=separator]){display:block;border-top:1px solid var(--gramlot-border-control,#888);margin:.25em}
57
- :host([role=separator]) button{display:none}`,this.shadowRoot.append(t)}get disabled(){return this.control.disabled}set disabled(e){this.control.disabled=!!e}projectAttributes(e,t){let n=super.projectAttributes(e,t);return this.control.disabled=!!this.parameters.disabled,this.control.readOnly=!!this.parameters.readonly,this.icon.textContent=this.parameters.icon??"",e["aria-label"]!=null?this.control.setAttribute("aria-label",e["aria-label"]):this.control.removeAttribute("aria-label"),n}attachCommand(){}releaseCommand(){}commandTarget(){return this}prepareCommand(){return!this.disabled}}}Bn.parameters={disabled:{dtype:"B",default:!1,binding:"read"},icon:{dtype:"T",default:"",binding:"read"}};var dm=Pr({name:"button",tag:"gramlot-button",base:Bn,command:!0,subTags:"*",implementation:r=>class extends r{}}),fm=Pr({name:"toggleButton",tag:"gramlot-toggle-button",base:Bn,command:!0,subTags:"*",parameters:{value:{dtype:"B",default:!1,binding:"twoWay"},readonly:{dtype:"B",default:!1,binding:"read"}},implementation:r=>class extends r{#e=!1;constructor(){super();let e=this.ownerDocument.createElement("span");e.className="led",e.setAttribute("aria-hidden","true"),this.control.prepend(e),this.writeControlValue(!1)}get commitOnChange(){return!0}readControlValue(){return this.#e}writeControlValue(e){this.#e=e,this.control.setAttribute("aria-pressed",String(e))}prepareCommand(e){return!super.prepareCommand(e)||this.control.readOnly?!1:(this.writeControlValue(!this.#e),this.control.dispatchEvent(new this.ownerDocument.defaultView.Event("change")),!0)}}});function pm(r){return class extends r{constructor(){super(),this.attachShadow({mode:"open"}).append(this.ownerDocument.createElement("slot"))}connectedCallback(){this.slot="menu",this.setAttribute("role","menu")}projectAttributes(e){return Gi(this,e)}}}var hm=Pr({name:"menu",tag:"gramlot-menu",base:pm,subTags:"menuline",implementation:r=>class extends r{}}),mm=Pr({name:"menuline",tag:"gramlot-menu-line",base:Bn,command:!0,subTags:"*",parameters:{code:{dtype:"T",nullable:!0}},implementation:r=>class extends r{attachCommand(){let e=this.textContent.trim()==="-";if(!e&&!this.parameters.code)throw new TypeError("menuline requires a stable code");this.setAttribute("role",e?"separator":"menuitem"),this.control.tabIndex=-1,this.disabled||=e}get disabled(){return super.disabled||!!this.closest("gramlot-drop-down-button")?.parameters.disabled}set disabled(e){super.disabled=e}prepareCommand(e){return super.prepareCommand(e)?(this.closest("gramlot-drop-down-button").selectCommand(this,e.shiftKey),!0):!1}}}),gm=Pr({name:"dropDownButton",tag:"gramlot-drop-down-button",base:Bn,command:!0,subTags:"*",parameters:{persist:{dtype:"B",default:!1}},implementation:r=>class extends r{#e=null;#t=null;#r=null;#i=null;#n;#s;#a;constructor(){super();let e=this.ownerDocument;this.control.classList.add("split"),this.#a=e.createElement("span"),this.#a.hidden=!0,this.control.append(this.#a),this.#s=e.createElement("button"),this.#s.type="button",this.#s.className="arrow",this.#s.textContent="\u25BE",this.#s.setAttribute("aria-label","Open menu"),this.#s.setAttribute("aria-haspopup","menu"),this.#s.setAttribute("aria-expanded","false"),this.controlBox.append(this.#s),this.#n=e.createElement("div"),this.#n.className="popup",this.#n.id="menu",this.#n.setAttribute("popover","auto"),this.#s.setAttribute("aria-controls","menu");let t=e.createElement("slot");t.name="menu",this.#n.append(t),this.shadowRoot.append(this.#n),this.#s.addEventListener("click",n=>{n.stopPropagation(),this.#n.matches(":popover-open")?this.closeMenu():this.openMenu()}),this.#s.addEventListener("keydown",n=>{(n.key==="ArrowDown"||n.key==="ArrowUp")&&(n.preventDefault(),this.openMenu(n.key==="ArrowUp"))}),this.addEventListener("keydown",n=>{if(!this.#n.matches(":popover-open"))return;let i=this.menuItems.filter(o=>!o.disabled),s=i.indexOf(n.composedPath().find(o=>i.includes(o))),a;n.key==="ArrowDown"&&(a=(s+1)%i.length),n.key==="ArrowUp"&&(a=(s-1+i.length)%i.length),n.key==="Home"&&(a=0),n.key==="End"&&(a=i.length-1),a!==void 0&&(n.preventDefault(),i[a]?.focus()),(n.key==="Escape"||n.key==="Tab")&&(n.key==="Escape"&&n.preventDefault(),this.closeMenu())}),this.#n.addEventListener("toggle",()=>{let n=this.#n.matches(":popover-open");this.#s.setAttribute("aria-expanded",String(n)),n||(this.#r?.abort(),this.#r=null)})}get menuItems(){return[...this.querySelectorAll(":scope > gramlot-menu > gramlot-menu-line")]}projectAttributes(e,t){let n=super.projectAttributes(e,t);return this.#s.disabled=this.disabled,this.disabled&&this.#n.matches(":popover-open")&&this.closeMenu(),this.#o(),n}attachCommand(){if(this.parameters.persist){if(!this.id)throw new TypeError("dropDownButton persist requires an explicit id");this.#i=`gramlot:command:${this.ownerDocument.location.pathname}${this.ownerDocument.location.search}:${this.id}`;try{this.#e=this.ownerDocument.defaultView.localStorage.getItem(this.#i)}catch{}}this.#o(),this.#t=new this.ownerDocument.defaultView.MutationObserver(()=>this.#o()),this.#t.observe(this,{childList:!0,subtree:!0,characterData:!0})}releaseCommand(){this.#t?.disconnect(),this.#t=null,this.#r?.abort(),this.#r=null,this.#n.matches(":popover-open")&&this.#n.hidePopover()}commandTarget(e){return e?.composedPath().includes(this.#n)?null:this.menuItems.find(t=>t.parameters.code===this.#e)??this}selectCommand(e,t){if(t){if(this.#e=e.parameters.code,this.#i)try{this.ownerDocument.defaultView.localStorage.setItem(this.#i,this.#e)}catch{}this.#o()}this.closeMenu()}#o(){let e=this.menuItems.filter(i=>i.parameters.code).map(i=>i.parameters.code);if(new Set(e).size!==e.length)throw new TypeError("Dropdown menu codes must be unique");let t=this.commandTarget(),n=t!==this;this.caption.hidden=n,this.#a.hidden=!n,this.#a.textContent=n?t.textContent:"",this.icon.textContent=n?t.parameters.icon:this.parameters.icon}openMenu(e=!1){if(this.disabled)return;let t=this.menuItems.filter(s=>!s.disabled);if(!t.length)return;this.#n.showPopover(),this.#s.setAttribute("aria-expanded","true");let n=()=>ju(this.#n,this.controlBox);n(),this.#r?.abort(),this.#r=new this.ownerDocument.defaultView.AbortController;let i={signal:this.#r.signal,capture:!0};this.ownerDocument.defaultView.addEventListener("resize",n,i),this.ownerDocument.addEventListener("scroll",n,i),t[e?t.length-1:0].focus()}closeMenu(){this.#n.matches(":popover-open")&&(this.#n.hidePopover(),this.#s.setAttribute("aria-expanded","false"),this.#r?.abort(),this.#r=null,this.#s.focus())}}}),Yi=Lu({name:"buttons",components:[dm,fm,gm,hm,mm]});function bm(r,e,t=r){let n=new Map,i=new Set,s=r.rootBuilder.binding?.inlineCompiler,a=new Map;for(let[l,u]of e){if(typeof l!="string")continue;let c=W(u)?.pointer??u;a.set(l,c instanceof ee?c.resolve():r.pointerType(c)?t.getRelativeData(c):c)}let o=l=>{if(n.has(l))return n.get(l);if(!e.has(l))throw new Error(`Source attribute '${l}' does not exist`);if(i.has(l))throw new Error(`cyclic attribute dependency: ${[...i,l].join(" -> ")}`);i.add(l);let u=e.get(l),c=W(u),d=c?a.get(l):null,f,h=p=>p?o(p):d;try{if(c)if(c.expression){let p=fr(c.body),m=p.slots.map(h);f=r.rootBuilder.evaluatePointerExpression(r,l,u,p,m)}else f=Xr(c.body,h),d==null&&(f=null);else if(typeof u=="string"&&u.startsWith("==")){let p=fr(u.slice(2)).identifiers,m={};for(let g of p)g!==l&&g!=="_F"&&e.has(g)&&(m[g]=o(g));f=s?s.compile(r,l,u,[...Object.keys(m),"_F"],`return (${u.slice(2)}
58
- )`)({...m,_F:(g,b)=>r.rootBuilder.binding.gramlot.format(g,b)}):null}else f=a.get(l);return n.set(l,f),f}finally{i.delete(l)}};return{resolve:o}}function Rt(r,e,t=r){let n=new Map([...Object.entries(r.getAttr()),...Te(r.getAttr())]);return bm(r,n,t).resolve(e)}var _m={dataFormula:["formula","_if","_else","_ask_if","_ask_onCancel"],dataController:["script","_if","_else","_ask_if","_ask_onCancel"],dataRpc:["_ask_if","_ask_onCancel","_if","_else","_onCalling","_onResult","_onError"],dataRemote:["_if","_else"]},Oa=["_cachedRemote","_if","_else","_onRemote"],wm=["_if","_else","_onRemote"],Uu=/^[A-Za-z]\w*$/;function qu(r){return typeof r=="string"&&r.startsWith("==")}var rr=class extends Se{#e=new Set;#t=null;codeAttributes(){let e=[..._m[this.nodeTag]??[],...this._getMeta("gramlot_component")?.command?["action","_ask_if"]:[],...typeof this.getAttr("remote")=="string"?wm:[]],t=[];for(let[n,i]of Object.entries(this.getAttr()??{}))typeof i=="string"&&(e.includes(n)||n==="validate_call"||n==="validate__onResult"||n==="validate_onAccept"||n==="validate_onReject"||/^validate_\w+_if$/.test(n)||n.startsWith("connect_on")||n.startsWith("subscribe_")||n.startsWith("selfsubscribe_"))&&t.push([n,i]);for(let n of["ask","_ask"]){let i=this.getAttr(n);if(i&&typeof i=="object")for(let s of["_if","askIf"])typeof i[s]=="string"&&t.push([`${n}.${s}`,i[s]])}for(let[n,i]of Te(this.getAttr()))qu(i)&&t.push([n,i]);return qu(this.staticValue)&&t.push(["",this.staticValue]),t}activateCode(){let e=new Map;for(let[t,n]of this.codeAttributes()){if(this.pointerType(n))throw new Error(`${this.nodeTag} '${this.label}': '${t}' is inline code and cannot be the pointer '${n}'; inline code is never read from Data`);e.set(t,n)}for(let[t,n]of[...Te(this.getAttr()),["datapath",this.getAttr("datapath")]])W(n)?.expression&&e.set(t,n);this.#t=e}activatedCode(e){return this.#t?.get(e)??null}remote(e,t={}){if(typeof e!="string"||!Uu.test(e))throw new TypeError(`${this.nodeTag} '${this.label}': remote name must match ${Uu.source}, not ${JSON.stringify(e)}`);let n=Object.keys(t).find(s=>s.startsWith("_")&&!Oa.includes(s));if(n)throw new TypeError(`${this.nodeTag} '${this.label}': remote parameter '${n}' is not accepted; the control attributes are ${Oa.join(", ")}`);let i={remote:e};for(let[s,a]of Object.entries(t))i[Oa.includes(s)?s:`remote_${s}`]=a;return this.setAttr(i),Sn(this)}publish(e,t={}){return this.builder.binding.gramlot._subscriptions.publishNode(this,e,t)}pointers(){let e=this.getAttr("datapath"),t=W(e)?lt(this,e):new Set,n=super.pointers().filter(([i,s])=>!t.has(i)&&!this.#n(i,s)).map(([i,s])=>[i,W(s)?.pointer??s]);for(let i of t){let s=this.getAttr(i);this.pointerType(s)==="^"&&n.push(["datapath",W(s)?.pointer??s])}return n}runtimeToEvaluate(){let e=super.runtimeToEvaluate();for(let[t,n]of e)if(this.pointerType(n)){if(W(n)){if(typeof t!="string")throw new Error(`${this.nodeTag} '${this.label}': pointer suffixes belong to attributes; use format/mask for node text`);this.absDatapath(n)===null&&e.set(t,new Wt(()=>Rt(this,t)));continue}this.#n(t,n)?e.set(t,n.slice(1)):this.absDatapath(n)===null&&e.set(t,null)}return e}pathAttribute(e){let t=this.getAttr(e);return W(t)?Rt(this,e):this.pointerType(t)&&this.#n(e,t)?t.slice(1):t}getRelativeData(e,t=null,n={}){return this.absDatapath(e)===null?null:super.getRelativeData(e,t,n)}setRelativeData(e,t,n={}){this.#s(e),super.setRelativeData(e,t,n)}PUT(e,t){this.#s(e),this.data.setItem(this.absDatapath(e),t,null,">",!1,!0,this,!1,!1)}FIRE(e,t=!0,n=null){t===null&&(t=!0),this.#s(e);let i=this.absDatapath(e);if(i.includes("?")){this.#r(i,t);return}this.data.getNode(i)?.setValue(null,!1);try{this.fireEvent(e,t,{attributes:n})}finally{this.data.getNode(i)?.setValue(null,!1)}}#r(e,t){let[n,i]=e.split("?",2),s=this.data;s.getNode(n)?.setAttr({[i]:null},!1);try{let a=s.getNode(n);a?a.setValue(a.staticValue,!0,{[i]:t},!0,!0,!0,!0):s.setItem(n,null,{[i]:t},">",!0,!0,!0,!0)}finally{s.getNode(n)?.setAttr({[i]:null},!1)}}FIRE_AFTER(e,t=!0,n=10){this.#s(e);let i=this.rootBuilder?.binding?.bindingFor(this)??null,s=null,a=setTimeout(()=>{s?.(),this.FIRE(e,t)},n);return s=i?.track(()=>clearTimeout(a))??null,()=>{clearTimeout(a),s?.()}}absDatapath(e){e=W(e)?.pointer??e;let t=this.pointerType(e)?e.slice(1):e;if(t.startsWith("#")&&t.includes("?")){let[n,i]=t.split("?",2),s=super.absDatapath(n);return s===null?null:`${s}?${i}`}return super.absDatapath(e)}_composeRelativeDatapath(e,t){let n=this;for(;n!==null&&e.startsWith(".");){let i=n.getAttr("datapath");if(this.pointerType(i)&&(i=this.#i(n,i),i===null))return null;if(i!=null&&(e=e==="."?i:i+e),e.startsWith("#"))return n.parentNode._resolveSymbolicDatapath(e,t);n=n.parentNode}if(e.startsWith("."))throw new Error(`unresolved relative datapath: ${t}`);return e}_finalizeAbsPath(e,t){return e===null?null:super._finalizeAbsPath(e,t)}_resolveSymbolicDatapath(e,t){let n=e.slice(1).split(".",1)[0];if(n==="FORM"||n==="ANCHOR")return super._resolveSymbolicDatapath(e,t);let i=this.rootBuilder?.binding;if(!i)return super._resolveSymbolicDatapath(e,t);let s=i.nodeIds.get(n);if(!s)throw new Error(`#<id>: cannot resolve ${t}`);let a=e.slice(n.length+2);return s.absDatapath(a?`.${a}`:".")}#i(e,t){if(W(t)){let s=Rt(e,"datapath",e.parentNode);return s==null||s===""?null:s}let n=e.parentNode.absDatapath(t);if(n===null)return null;let i=this.data.getItem(n);return i==null||i===""?null:i}#n(e,t){return W(t)||typeof e!="string"||!e.endsWith("_path")?!1:(this.#e.has(e)||(this.#e.add(e),console.warn(`${this.nodeTag} '${this.label}': '${e}' holds a bare Data path; the pointer symbol of '${t}' is removed`)),!0)}#s(e){if(this.absDatapath(e)===null)throw new Error(`${this.nodeTag} '${this.label}': write on a null path: '${e}'`)}},he=class r extends S{get nodeClass(){return rr}authorizedCopy(e){let t=new this.constructor;for(let n of this.getNodes()){let i=n.getAttr("auth")??null;if(i!==null){if(typeof i!="string")throw new TypeError(`${n.nodeTag} '${n.label}': 'auth' must be a string rule, not ${typeof i}`);if(e(i)!==null)continue}let s=n.staticValue;s instanceof r&&(s=s.authorizedCopy(e));let{auth:a,...o}=n.getAttr(),l=t.setItem(n.label,s,o,">",!1,!1,null,!1,!0,null,n.nodeTag);l.xmlTag=n.xmlTag}return t}activateCode(){for(let e of this.getNodes())e.activateCode(),e.staticValue instanceof r&&e.staticValue.activateCode();return this}};if((Ue(he.tytxSuffix).GramlotBuilderBag??he)!==he)throw new Error("TYTX subtype name 'GramlotBuilderBag' is already registered for another class");Ht(he.tytxSuffix,{...Ue(he.tytxSuffix),GramlotBuilderBag:he});function Vu(r){if(r!=null&&(typeof r!="string"||/[{}]/.test(r.replaceAll("{}",""))))throw new RangeError("This formatter mask supports only {} placeholders")}function Ji(r,e){return Vu(e),e==null?r:e.replaceAll("{}",()=>r)}function ym(r){if(r instanceof Date){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"}if(ye(r))return"N";if(typeof r=="number")return Number.isInteger(r)?"L":"R";throw new TypeError("Formatting requires finite JavaScript numbers, TYTX Decimal values or valid Date objects")}function vm(r,e,{pattern:t="short",locale:n,timeZone:i}){if(!["short","medium","long","full"].includes(t))throw new RangeError("Temporal formatting currently supports short, medium, long and full only");if(e==="DHZ"&&(typeof i!="string"||!i))throw new TypeError("DHZ formatting currently requires an explicit timeZone");let s={timeZone:e==="DHZ"?i:"UTC"};return e!=="H"&&(s.dateStyle=t),e!=="D"&&(s.timeStyle=t),new Intl.DateTimeFormat(n,s).format(r)}function Zi(r){let e=/^(-|\()?(#,##0|0+)(?:\.(0*#*))?(\))?$/.exec(r);if(!e||e[1]==="("!=(e[4]===")")||r.endsWith("."))throw new RangeError(`Unsupported numeric pattern section: ${r}`);let t=e[3]??"";return{prefix:e[1]??"",suffix:e[4]??"",intl:{useGrouping:e[2].startsWith("#,##")?"always":!1,minimumIntegerDigits:e[2].replace("#,##","").length,minimumFractionDigits:t.replaceAll("#","").length,maximumFractionDigits:t.length}}}function km(r){let e=r.split(";");if(e.length>3)throw new RangeError("Numeric patterns support at most three sections");let t=Zi(e[0]);if(t.prefix||t.suffix)throw new RangeError("Positive-section affixes are not implemented");let n=e.length===3?e[1]:null;n!==null&&n!==""&&n!=="-"&&Zi(n);let i=e.length>1?Zi(e.at(-1)):null;return{positive:t,zero:n,negative:i}}function zu(r,e={},t={}){if(r===null)return"";if(typeof e=="string"&&(e={pattern:e}),!e||typeof e!="object"||Array.isArray(e))throw new TypeError("Format options must be a pattern string or an options object");for(let g of Object.keys(e))if(!["pattern","locale","mask","dtype","timeZone"].includes(g))throw new RangeError(`Unsupported format option: ${g}`);e={...e,locale:e.locale??t.locale,timeZone:e.timeZone??t.timeZone};let n=e.dtype===void 0?ym(r):e.dtype,i=["D","H","DHZ"].includes(n);if(!i&&!["L","R","N"].includes(n))throw new RangeError(`Unsupported format dtype: ${n}`);if(i){if(!(r instanceof Date)||!Number.isFinite(r.getTime()))throw new TypeError(`${n} requires a valid Date object`)}else if(!(typeof r=="number"&&Number.isFinite(r))&&!(ye(r)&&!["NaN","Infinity","-Infinity"].includes(r.toString())))throw new TypeError(`${n} formatting requires finite JavaScript numbers or TYTX Decimal values`);if(n==="L"&&!Number.isInteger(r))throw new TypeError("L formatting requires an integer");let{pattern:s,locale:a,mask:o}=e;if(!i&&typeof s!="string")throw new TypeError("Numeric formatting currently requires an explicit pattern");if(typeof a!="string"||!a)throw new TypeError("Formatting currently requires an explicit locale");if(!(i?Intl.DateTimeFormat:Intl.NumberFormat).supportedLocalesOf([a]).length)throw new RangeError(`Unsupported format locale: ${a}`);if(Vu(o),i){let g=vm(r,n,e);return Ji(g,o)}let{positive:u,zero:c,negative:d}=km(s),f=ye(r),h=f?r.eq(0):r===0,p=f?r.lt(0):r<0;if(f&&new Intl.NumberFormat("en",{useGrouping:!1}).format("9007199254740993")!=="9007199254740993")throw new Error("This browser cannot format Decimal without precision loss");let m;if(h&&c!==null){if(c==="")return"";if(c==="-")m="-";else{let g=Zi(c);m=g.prefix+new Intl.NumberFormat(a,g.intl).format(0)+g.suffix}}else{let g=p&&d?d:u,b=f?(p&&d?r.abs():r).toString():p&&d?-r:r===0?0:r;m=g.prefix+new Intl.NumberFormat(a,u.intl).format(b)+g.suffix}return Ji(m,o)}var We="http://www.w3.org/1999/xhtml",Rn="http://www.w3.org/2000/svg",Em=new Set(["default","default_value","live","group","visible","action","fire","ask","_ask","_ask_if","_ask_title","_ask_onCancel","if","else","_init","_onStart","_onBuilt","_delay","_timing","_userChanges","remote","_cachedRemote","_onRemote"]),Am=["default_","attr_","fire_","connect_on","subscribe_","selfsubscribe_","formsubscribe_","remote_"],xm={table:["width","border"],editor:["height"],embed:["width","height"],img:["width","height"],canvas:["width","height"]},Tm=["format","mask","locale","timeZone","places","dtype"],Dm=new Set(["href","src","formaction","xlink:href","xlink_href"]);function Mt(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>!(t&&typeof t=="object"&&Object.hasOwn(t,"$gramlotRef"))&&!Em.has(e)&&!Am.some(n=>e.startsWith(n))))}function Ur(r,e,t=[]){for(let[n,i]of Object.entries(e)){let s=t.find(o=>n.startsWith(o))??"",a=n.slice(s.length);if(["style","class","_class"].includes(a)&&i!=null&&typeof i!="string")throw new TypeError(`${r.nodeTag} '${r.label}': '${n}' must be a string or null`)}}function qr(r,e,t=[]){for(let[n,i]of Object.entries(Vr(Mt(e)))){let s=t.find(o=>n.startsWith(o)),a=s?n.slice(s.length):n;if(/^on./i.test(a))throw new Error(`${r.nodeTag} '${r.label}': '${n}' has the form of a native event handler, run by the browser outside Gramlot; write connect_${a} for an event, or rename the attribute`);if(Dm.has(a.toLowerCase())&&Cm(i))throw new Error(`${r.nodeTag} '${r.label}': '${n}' holds a javascript: URL, run by the browser as code; write connect_onclick or the action of a button instead`)}}function Cm(r){return typeof r=="string"&&/^javascript:/i.test(r.replace(/[\t\n\r]/g,"").replace(/^[\u0000-\u0020]+/,""))}function Hu(r,e,t=[]){if(r.nodeTag!=="iframe")return e;let n=o=>{let l=t.find(u=>o.startsWith(u))??"";return[l,o.slice(l.length).toLowerCase()]},i=Object.fromEntries(Te(r.getAttr())),s=[...Object.keys(i),...Object.keys(e)].find(o=>n(o)[1]==="srcdoc");if(s===void 0||Object.keys(i).some(o=>n(o)[1]==="sandbox")||r.pointerType(r.value)===null&&!(Object.hasOwn(i,s)&&(r.pointerType(i[s])!==null||gt(i[s]))))return e;let a=Object.fromEntries(Object.entries(e).filter(([o])=>n(o)[1]!=="sandbox"));return{[`${n(s)[0]}sandbox`]:"",...a}}function Vr(r){return Object.fromEntries(Object.entries(r).filter(([,e])=>e!=null))}function Mn(r){return Object.fromEntries(Object.entries(r).map(([e,t])=>e.startsWith("xmlns_")?[`xmlns:${e.slice(6)}`,t]:e.startsWith("data_")||e.startsWith("aria_")?[e.replaceAll("_","-"),t]:[e,t]))}function Ki(r){let{_meta:e,...t}=r;return Mn(Vr(Mt(t)))}function Wu(r,e){let t=xm[String(r).toLowerCase()]??[],n={},i={};for(let[s,a]of Object.entries(e))t.includes(s)?i[s]=a:n[s]=a;return[n,i]}function jr(r){return String(r)}function $n(r,e,t=null){let n={...e},{mask:i,format:s,locale:a,timeZone:o,dtype:l,places:u}=n;for(let d of Tm)delete n[d];let c=d=>{if(t&&s!=null){if(u!=null)throw new RangeError("places is not implemented; specify precision in format");return t(d,{pattern:s,mask:i,...a==null?{}:{locale:a},...o==null?{}:{timeZone:o},...l==null?{}:{dtype:l}})}if(typeof d=="boolean"&&(d=jr(d)),i==null)return d;let f=d==null?"":jr(d);return f===""?f:Ji(f,i)};return Array.isArray(r)?(Object.hasOwn(n,"_text")&&(n._text=c(n._text)),[r,n]):[c(r),n]}function gt(r){return typeof r=="string"&&r.startsWith("==")}var Sm=new Set(["animate","animateMotion","animateTransform","circle","ellipse","feBlend","feColorMatrix","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feGaussianBlur","feImage","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","image","line","metadata","path","polygon","polyline","rect","set","stop","use"]),Fn=class extends er{constructor(e,t){super(e),this._owner=t}get owner(){return this._owner}_handleMeta(e,t){let n=this.owner.evaluateExpressions(e,t);qr(e,n);let[i,s]=super._handleMeta(e,n);return Ur(e,s),e._getMeta("subbuilder")?[i,Wi(Ki(s))]:[i,s]}adaptAttrs(e){let{_meta:t,...n}=e;return Mn(super.adaptAttrs(Vr(Mt(n))))}renderedItem(e,t,n,i={}){if(this.owner.renderType==="object")return this.owner.renderedItem(e,t,n,i);let{_text:s,...a}=n;return t=this.owner.expressionValue(e,t),Array.isArray(t)&&s!=null&&(t=[this._escapeText(jr(s)),...t]),Sm.has(i.tag)?`${i.pretty?" ".repeat(this._nodeDepth(e,i.depthOffset??0)):""}<${i.tag}${this._formatAttrs(a)} />${i.pretty?`
59
- `:""}`:super.renderedItem(e,t,a,i)}};var nr=class extends Qt{#e=new WeakMap;#t=new WeakMap;get inlineCompiler(){return null}getRender(e){return this.renders.has(e)||(e.evaluatePointerExpression=this.builder.evaluatePointerExpression.bind(this.builder),e instanceof It?this.addRender(e,this):e instanceof Bt&&this.addRender(e,new Fn(e,this))),super.getRender(e)}render(e,t={}){return e._getMeta("data_element")?null:super.render(e,t)}_handleMeta(e,t){let n=this.builder.constructor.dialectPrefixes,i=this.evaluateExpressions(e,t);qr(e,i,n);let[s,a]=super._handleMeta(e,Hu(e,i,n));if(Ur(e,a,n),e.nodeTag==="webcomponent"){s=mt(e.getAttr());let{code:u,...c}=a;a=c}if(e._getMeta("subbuilder")){let u=Ki(a);return e._getMeta("subbuilder")==="html"&&(u.xmlns=Rn),[s,u]}let[o,l]=Wu(s,a);return Object.keys(l).length&&this.#e.set(e,l),[s,o]}evaluateExpressions(e,t){let n=this.inlineCompiler,i=(a,o)=>n?n.compileExpression(e,a,o)(t):null,s={...t};for(let[a,o]of Te(e.getAttr()))gt(o)&&Object.hasOwn(s,a)&&(s[a]=i(a,o));return gt(e.value)&&this.#t.set(e,i("",e.value)),s}expressionValue(e,t){return gt(e.value)?this.#t.get(e)??null:t}restoreNativeAttributes(e,t){let n=this.#e.get(e);return n?(this.#e.delete(e),{...t,...Vr(n)}):t}adaptAttrs(e){let{_meta:t,...n}=e,i=`${this.builder.constructor._name}_`,s=this.builder.constructor.dialectPrefixes,a={},o={};for(let[l,u]of Object.entries(Mt(n))){if(u==null)continue;if(l.startsWith(i))throw new Error(`${l}: the attribute prefix '${i}' is not accepted; use the prefix '${s[0]}'`);let c=s.find(d=>l.startsWith(d));c?a[l.slice(c.length)]=u:o[l]=u}return Mn({...super.adaptAttrs(o),...a})}renderedItem(e,t,n,i={}){let s;[t,s]=$n(this.expressionValue(e,t),this.restoreNativeAttributes(e,n));let{_text:a,...o}=s;Array.isArray(t)&&a!=null&&(t=[this._escapeText(jr(a)),...t]);let l=e.parentNode?._getMeta("subbuilder")==="html"?{xmlns:We,...o}:o;return super.renderedItem(e,t,l,i)}finalize(e,t=null,n={}){if(!n.doctype)return super.finalize(e,t,n);let i=this._composeStringFragments(e),s=this.builder.source.getNodes().filter(a=>!a._getMeta("data_element"));return s.length===1&&s[0].nodeTag==="html"||(i=`<html>${i}</html>`),super.finalize(`<!doctype html>${i}`,t,n)}};var Gu={document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:"binding",version:null,title:"Gramlot binding",description:"Gramlot Data declarations and the plain HTML button; loaded after the HTML grammar."},abstracts:{},elements:{dataSetter:{doc:"Initial Data value, written literally at destination_path.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination_path",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:!0,default:null},{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:"Computed Data value written at result_path; formula is inline, func is a name.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"result_path",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"formula",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"params",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}},dataController:{doc:"Side effects on Data; script is inline, func is a name.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"script",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"params",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}},dataRpc:{doc:"Server endpoint called through gramlot.rpc; the value is written at result_path when given.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"method",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"result_path",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"timeout",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"int"},{kind:"type",module:"builtins",name:"float"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"params",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}},dataRemote:{doc:"Data node resolved by a server endpoint through gramlot.rpc, on first read and again when cacheTime expires.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination_path",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"method",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"cacheTime",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"int"},{kind:"type",module:"builtins",name:"float"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"params",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}},html_button:{doc:"Plain native HTML button without Gramlot click mechanisms.",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:{render_tag:"button"}}}};var Xu={document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:"webcomponent",version:null,title:"Gramlot webcomponent",description:"An explicitly loaded autonomous custom element."},abstracts:{},elements:{webcomponent:{doc:"Create the custom-element tag named by literal code.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"code",kind:"keyword_only",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},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:null}}};var Im="data is forbidden: write dataSetter for a Data value or html_data for the HTML5 <data> element",Bm=new Set,Rm=new Set(["serverpath","dbenv","shared_id"]),Mm=["formsubscribe_"],$m={dataSetter:"destination_path",dataFormula:"result_path",dataRpc:"result_path",dataRemote:"destination_path"},Fm={dataFormula:"formula",dataController:"script"};function Yu(r,e){if(["input","textarea","select","webcomponent"].includes(r)&&W(e.value))return"'value' does not accept pointer suffixes; use an ordinary value pointer";if(r==="html_button"&&Object.keys(e).some(i=>["action","ask","_delay","fire"].includes(i)||i.startsWith("fire_")))return"plain HTML button: use button for action, ask, fire or _delay";if(Object.hasOwn(e,"ask")&&!["button","toggleButton","dropDownButton","menuline"].includes(r))return"'ask' is supported on buttons";if(Object.hasOwn(e,"_ask")&&!["dataController","dataFormula","dataRpc"].includes(r))return"'_ask' requires a controller, formula or RPC";if(["dataSetter","dataRemote"].includes(r)&&Object.keys(e).some(i=>i.startsWith("subscribe_")||i.startsWith("selfsubscribe_")))return"topic subscriptions are supported on controllers, formulas, RPCs and rendered elements";let t=$m[r];if(t&&String(e[t]??"").includes("?"))return`'${t}' does not accept '?attr': '${e[t]}'`;let n=Fm[r];return n&&e[n]!=null&&e.func!=null?`'func' and '${n}' cannot be declared on the same node`:n&&e._if!=null&&e.func!=null?"'_if' is inline and cannot be declared with 'func': write the condition in the method":null}function Zu(r){return Object.keys(r).find(e=>Rm.has(e)||Mm.some(t=>e.startsWith(t)))}var Ge=class r extends It{static _name="gramlot";static _sourceClass=he;static{this.defineGrammar(Gu)}static{this.defineGrammar(Xu)}static{this.defineGrammar(Yi.toDocument())}static get dialectPrefixes(){let e=[];for(let t=Object.getPrototypeOf(r);t&&t!==Function.prototype;t=Object.getPrototypeOf(t))Object.hasOwn(t,"_name")&&t._name&&e.push(`${t._name}_`);return e}constructor(e=null,{collections:t=[],auth:n=null}={}){super(e),this._binding=null,this._auth=n;for(let i of t)this.loadCollection(i)}get auth(){return this._auth}get binding(){return this._binding}set binding(e){this._binding=e}evaluatePointerExpression(e,t,n,i,s){return this.binding?this.binding.inlineCompiler.compilePointerExpression(e,t,n,i.text)(s):null}nodeById(e){if(!this.binding)return super.nodeById(e);let t=this.binding.nodeIds.get(e);if(!t)throw new Error(`node_id not found: ${e}`);return t.builder.wrapSource(t)}loadCollection(e){return this.loadGrammar(e instanceof tr?e.toDocument():e),this}schemaTag(e){let t=e.toLowerCase(),n=r.dialectPrefixes;if(t.startsWith(`${r._name}_`))throw new Error(`${e}: the tag prefix '${r._name}_' is not accepted; use the prefix '${n[0]}'`);if(Bm.has(t))throw new Error(`${e}: excluded from Gramlot 0.2.0`);let i=this.schemaTagNames[t];if(i)return i;for(let s of n)if(t.startsWith(s)&&this.schemaTagNames[t.slice(s.length)])return t;return null}bagCall(e,t,n,i){return super.bagCall(e,this.#e(t),n,i)}commandOnNode(e,t,n,i){return super.commandOnNode(e,this.#e(t),n,i)}validateNodeValues(e,t,n={}){if(this.schema[e]?._meta?.gramlot_component&&W(n.value))throw new Error("'value' does not accept pointer suffixes");e==="webcomponent"&&mt(n);let i=Zu(n);if(i)throw new Error(`${e}: attribute '${i}' is excluded from Gramlot 0.2.0`);let s=Yu(e,n);if(s)throw new Error(`${e}: ${s}`);return super.validateNodeValues(e,t,n)}validateNode(e,t={}){if(e._getMeta("gramlot_component")&&W((t.attrs??e.getAttr()).value))throw new Error("'value' does not accept pointer suffixes");e.nodeTag==="webcomponent"&&mt(t.attrs??e.getAttr());let n=Zu(t.attrs??e.getAttr());if(n)throw new Error(`${e.nodeTag} '${e.label}': attribute '${n}' is excluded from Gramlot 0.2.0`);let i=Yu(e.nodeTag,t.attrs??e.getAttr());if(i)throw new Error(`${e.nodeTag} '${e.label}': ${i}`);return super.validateNode(e,t)}_validateChildren(e,t,n,i){return super._validateChildren(e,t,n.map(s=>s==="html_button"?"button":s),i)}_countsForGrammar(e){return e===this.schema.button||!e?._meta?.gramlot_component&&e!==this.schema.webcomponent&&super._countsForGrammar(e)}setChild(e,t,n,i,s=null){i=Object.fromEntries(Object.entries(i??{}).map(([l,u])=>[l,pe(u)instanceof Se?this.reference(u):u]));let o=t==="dataSetter"&&i?.value!==null&&typeof i?.value=="object"&&Object.getPrototypeOf(i.value)===Object.prototype?{...i,value:new z(i.value)}:i;return super.setChild(e,t,n,o,s)}#e(e){if(e==="data")throw new Error(Im);if(this.schemaTagNames[e.toLowerCase()]===e)return e;let t=r.dialectPrefixes.find(n=>e.startsWith(n));return this.schemaTagNames[e.slice(t.length)]}get renderer_html(){return new nr(this)}create(){this.setup(this.data),this.main(this.root)}computeLogic(){}promoteNodeValue(e,t,n){let i=t!=null?{_text:t}:null;e.setValue(n,!0,i,!0)}reference(e,t="node"){if(e=pe(e),!(e instanceof Se)||!["node","dom"].includes(t))throw new TypeError("Reference requires an element and node/dom kind");let n=e.getAttr("__ref");return n==null&&(n=Array.from(crypto.getRandomValues(new Uint8Array(16)),i=>i.toString(16).padStart(2,"0")).join(""),e.setAttr({__ref:n})),{$gramlotRef:n,kind:t}}toTytx(){return oe(this.auth===null?this.source:this.source.authorizedCopy(this.auth))}};var Lm=new Set(["input","select","textarea"]),Pm=["type","multiple","group"];function Ju(r,e){let t=r.getAttr(e);return r.pointerType(t)?r.getRelativeData(t):t}var De=class r{static liveWrites=!1;static writesDefault=!0;static preservesUnchangedValue=!1;#e;#t=!1;#r;#i;#n=!1;#s=!1;#a=!1;static for(e,t){let n=r.classFor(t.element,t.attrs);return n?new n(e,t):null}static classFor(e,t){if(e.namespaceURI!==We)return null;if(e.constructor.gramlotComponent)return e.constructor.gramlotComponent.parameters.value?.binding!=="twoWay"?null:e.control.type==="radio"?$a:Ia;if(e.localName==="textarea")return it;if(e.localName==="select")return Ln;if(e.localName!=="input")return null;let n=t.type==null?"text":String(t.type).toLowerCase();return Object.hasOwn(Ku,n)?Ku[n]:it}static shape(e,t){return e?.constructor.gramlotComponent?.parameters.value?.binding==="twoWay"&&e.control.type==="radio"?JSON.stringify([t.group??null]):e?.namespaceURI!==We||!Lm.has(e.localName)?null:JSON.stringify(Pm.map(n=>t[n]??null))}constructor(e,t){this.#r=e,this.#i=t}get binding(){return this.#r}get element(){return this.#i.element}get node(){return this.binding.node}get eventElement(){return this.element}get resolved(){return this.#i.resolved}get live(){return!!this.resolved.live}get writeEvent(){return this.constructor.liveWrites&&this.live?"input":"change"}project(e,t){if(this.#s){this.#a=!0;return}this.constructor.preservesUnchangedValue&&this.#t&&this.same(this.#e,e)||(this.#e=e,this.#t=!0,!(this.#n&&this.same(this.read(),e))&&(this.constructor.writesDefault&&!this.node.pointerType(this.node.getAttr("value"))&&this.writeDefault(e),this.write(e)))}read(){return this.element.value}write(e){let t=e==null?"":String(e);this.element.value!==t&&(this.element.value=t)}writeDefault(e){let t=e==null?"":String(e);this.element.localName==="textarea"?this.#i.text.data!==t&&(this.#i.text.data=t):this.element.defaultValue!==t&&(this.element.defaultValue=t)}same(e,t){return Object.is(e,t)}commit(e,t=this.read()){if(this.binding.closed)return;let n=this.node.getAttr("value");if(this.node.pointerType(n)==="^"){this.#n=!0;try{this.node.setRelativeData(n.slice(1),t)}finally{this.#n=!1}}}attach(){for(let e of["input","change","compositionstart","compositionend"])this.eventElement.addEventListener(e,this)}detach(){for(let e of["input","change","compositionstart","compositionend"])this.eventElement.removeEventListener(e,this);this.#a=!1}refresh(){}handleEvent(e){if(!this.binding.closed){if(e.type==="compositionstart"){this.#s=!0;return}if(e.type==="compositionend"){this.#s=!1,this.writeEvent==="input"&&this.commit(e),this.#a&&(this.#a=!1,this.binding.runtime.renderer.project(this.node));return}this.#s||e.isComposing||e.type===this.writeEvent&&this.commit(e)}}},Ia=class extends De{static writesDefault=!1;static preservesUnchangedValue=!0;get eventElement(){return this.element.control}attach(){this.element.setPageContext(Qu(this)),super.attach()}project(e,t){this.element.shouldProjectControlValue(e)&&super.project(e,t)}same(e,t){return this.element.sameControlValue(e,t)}detach(){this.element.releaseControl(),super.detach()}commit(e){this.binding.closed||this.element.control.disabled||this.element.control.readOnly||ec(this.element,this.element.acceptControlValue(),t=>super.commit(e,t.value))}get writeEvent(){if(this.element.commitOnChange)return"change";let e=this.element.control;return this.live&&(e.localName==="textarea"||["text","password","range","color"].includes(e.type))?"input":"change"}read(){return this.element.readControlValue()}write(e){this.element.writeControlValue(e)}handleEvent(e){if(super.handleEvent(e),!e.composed&&!this.binding.closed&&["input","change"].includes(e.type)){let t=this.element.ownerDocument.defaultView.Event;this.element.dispatchEvent(new t(e.type,{bubbles:!0,composed:!0}))}}},it=class extends De{static liveWrites=!0},Ba=class extends De{static liveWrites=!0;read(){return this.element.value===""?null:Number(this.element.value)}commit(e){this.element.validity.badInput||super.commit(e)}},Ra=class extends De{static liveWrites=!0;read(){return Number(this.element.value)}},Ln=class extends De{static writesDefault=!1;read(){return this.element.multiple?[...this.element.selectedOptions].map(e=>e.value):this.element.selectedIndex===-1?null:this.element.value}write(e){let t=this.element;if(t.multiple){if(e!=null&&!Array.isArray(e))throw new TypeError(`${this.node.nodeTag} '${this.node.label}': a multiple select requires an array`);let n=new Set((e??[]).map(String));for(let i of t.options){let s=n.has(i.value);i.selected!==s&&(i.selected=s)}}else e==null?t.selectedIndex!==-1&&(t.selectedIndex=-1):(t.selectedIndex===-1||t.value!==String(e))&&(t.value=String(e))}same(e,t){return Array.isArray(e)?Array.isArray(t)&&t.length===e.length&&t.every((n,i)=>Object.is(n,e[i])):super.same(e,t)}},ir=class extends De{read(){return this.element.value===""?null:this.element.value}},Ma=class extends De{},Qi=class extends De{static writesDefault=!1;read(){return this.element.checked}write(e){let t=!!e;this.element.checked!==t&&(this.element.checked=t)}same(e,t){return e===!!t}attach(){let e=this.node;if(e.getAttr("checked")!=null&&e.pointerType(e.getAttr("value"))==="^")throw new TypeError(`${e.nodeTag} '${e.label}': checked and a ^ value are two sources`);super.attach()}},es=class extends Qi{#e=null;#t=!1;get groups(){return this.binding.runtime.renderer.radioGroups}attach(){let e=this.node,t=this.resolved.group??null,n=Fa(e);if(t!=null){if(e.getAttr("name")!=null)throw new TypeError(`${e.nodeTag} '${e.label}': name and group are two names`);this.#r(t,n)}super.attach(),t!=null&&(this.#e=this.groups.join(this,t,n),this.element.setAttribute("name",this.#e))}detach(){this.#e!==null&&(this.groups.leave(this),this.element.removeAttribute("name"),this.#e=null),super.detach()}refresh(){if(this.#e===null)return;let e=this.resolved.group,t=Fa(this.node);this.groups.nameOf(e,t)!==this.#e&&(this.#r(e,t),this.groups.leave(this),this.#e=this.groups.join(this,e,t),this.element.setAttribute("name",this.#e))}#r(e,t){let n=this.node;if(Ju(n,"value")&&this.groups.peersOf(e,t).some(i=>!i.binding.closed&&i.read()))throw new Error(`${n.nodeTag} '${n.label}': several true values in radio group '${e}'`)}project(e,t){let n=!this.#t;this.#t=!0;let i=this.read();super.project(e,t),!n&&!i&&this.read()&&this.turnOffPeers()}commit(e){let t=this.read();super.commit(e),t&&!this.binding.closed&&this.turnOffPeers()}turnOffPeers(){if(this.#e!==null)for(let e of this.groups.peers(this)){if(this.binding.closed)return;e.binding.closed||(e.element.checked&&(e.element.checked=!1),Ju(e.node,"value")&&e.commit(null))}}},$a=class extends es{static writesDefault=!1;get host(){return super.element}get element(){return this.host.control}project(e,t){this.host.shouldProjectControlValue(e)&&super.project(e,t)}commit(e){this.binding.closed||this.element.disabled||this.element.readOnly||ec(this.host,this.host.acceptControlValue(),()=>super.commit(e))}read(){return this.host.readControlValue()}write(e){this.host.writeControlValue(e)}attach(){this.host.setPageContext(Qu(this)),super.attach(),this.element.addEventListener("keydown",this)}detach(){this.host.releaseControl(),this.element.removeEventListener("keydown",this),super.detach()}handleEvent(e){if(!this.binding.closed){if(e.type==="keydown"){if(this.resolved.group==null||!["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(e.key))return;let t=this.groups.peersOf(this.resolved.group,Fa(this.node)).filter(a=>!a.binding.closed&&!a.element.disabled),n=t.indexOf(this);if(n<0)return;e.preventDefault();let i=["ArrowLeft","ArrowUp"].includes(e.key)?-1:1,s=t[(n+i+t.length)%t.length];s.element.focus(),s.element.click();return}if(super.handleEvent(e),!e.composed&&!this.binding.closed&&["input","change"].includes(e.type)){let t=this.host.ownerDocument.defaultView.Event;this.host.dispatchEvent(new t(e.type,{bubbles:!0,composed:!0}))}}}},ts=class{#e;#t=new Map;#r=new Map;#i=new WeakMap;#n=0;constructor(e){this.#e=e}join(e,t,n){let i=this.nameOf(t,n);return this.#t.has(i)||this.#t.set(i,new Set),this.#t.get(i).add(e),this.#r.set(e,i),i}leave(e){let t=this.#r.get(e);this.#r.delete(e);let n=this.#t.get(t);n?.delete(e),n?.size===0&&this.#t.delete(t)}peers(e){let t=this.#r.get(e);return[...this.#t.get(t)??[]].filter(n=>n!==e)}peersOf(e,t){return[...this.#t.get(this.nameOf(e,t))??[]]}nameOf(e,t){t!==null&&!this.#i.has(t)&&this.#i.set(t,this.#n++);let n=t===null?"page":`form${this.#i.get(t)}`;return`gramlot-${this.#e.instanceId}-${n}-${e}`}};function Fa(r){for(let e=r;e;e=e.parentNode){let t=e.getAttr()??{};if(t.formId!=null||t.form===!0)return e}return null}var Ku={text:it,password:it,email:it,url:it,tel:it,search:it,number:Ba,range:Ra,color:Ma,date:ir,time:ir,month:ir,week:ir,"datetime-local":ir,checkbox:Qi,radio:es,hidden:null,file:null,button:null,submit:null,reset:null,image:null};function Qu(r){let{binding:e,node:t}=r,n=e.runtime.gramlot,i=(s,a,o,l=!1)=>{if(!l&&/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(a)){let{group:u,method:c}=n.src.logicRegistry.resolve(a,t);return c.call(u,t,o)}return e.runtime.inlineCompiler.compile(t,s,a,Object.keys(o),l?`return (${a});`:a)(o)};return{locale:n.locale,timeZone:n.timeZone,createDecimal:Rr,isDecimal:ye,getDecimalLibrary:_a,isActive:()=>!e.closed,callLogic:(s,a)=>{let{group:o,method:l}=n.src.logicRegistry.resolve(s,t);return l.call(o,t,a)},format:(s,a)=>n.format(s,a),invoke:i,remote:(s,a,o)=>n.rpc.call("data",s,a,{signal:o}),validationCurrent:()=>{let s=t.getAttr("value"),a=t.pointerType(s)?t.absDatapath(s):null;return()=>!e.closed&&t.getAttr("value")===s&&(a===null||t.absDatapath(s)===a)},finishValidation:({ok:s,result:a,rules:o})=>{if(e.closed)return;if(s)for(let u of a.datachanges)t.getRelativeData(".").update(u);let l=s?"validate_onAccept":"validate_onReject";if(o[l]){let u=c=>console.error("Validation notification failed:",c);try{let c=Object.fromEntries(Object.entries(o).map(([f,h])=>[f.slice(9),h])),d=i(l,o[l],{value:a.value,result:a,validations:c,userChange:!0});d instanceof Promise&&d.catch(u)}catch(c){u(c)}}},checkDataPatch:s=>{if(!(s instanceof z))throw new TypeError("Validation data changes must be a Bag.");if(!(t.getRelativeData(".")instanceof z))throw new TypeError("Validation data changes require a Bag datapath.")}}}function ec(r,e,t){let n=i=>{i.ok&&i.isCurrent()&&(t(i),r.finishValidation(i))};e instanceof Promise?e.then(n).catch(i=>console.error("Validation notification failed:",i)):n(e)}var La=Symbol("source text"),tc={xmlns:"http://www.w3.org/2000/xmlns/",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},jm=new Set(["allowFullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formNoValidate","hidden","inert","isMap","itemscope","loop","multiple","muted","noModule","noValidate","open","playsInline","readOnly","required","reversed","selected"]),Um=new Set(["checked","muted","selected","value"]),qm=new Map([["allowfullscreen","allowFullscreen"],["formnovalidate","formNoValidate"],["ismap","isMap"],["nomodule","noModule"],["novalidate","noValidate"],["playsinline","playsInline"],["readonly","readOnly"]]);function Vm(r){let e=r.replace(/-([a-z])/g,(t,n)=>n.toUpperCase());return qm.get(e.toLowerCase())??e}var rs=class{constructor({metadataAttributes:e=[]}={}){this.metadataAttributes=new Set([...Gt,"_text",...e])}definition(e){let t=e.builder,i={...t.schema[t.schemaTag(e.nodeTag)]._meta,...e.getAttr("_meta")},s=e.nodeTag==="webcomponent"?mt(e.getAttr()):Cn(e.nodeTag,{renderTag:i.render_tag,ns:e.getAttr("ns"),dialectName:t.constructor._name}),a=s==="foreignObject"?Rn:i.render_attributes?.xmlns??e.getAttr("xmlns")??(t instanceof Bt?Rn:We);return{meta:i,namespace:a,tag:s}}validate(e,t=e.builder){let n=e.value instanceof S,i=n?e.getAttr("_text"):e.value;if(i!=null&&!["string","number","boolean"].includes(typeof i))throw new TypeError("HTML text must be scalar");for(let[o,l]of Object.entries(e.attr))if(!(o==="value"&&this.definition(e).meta.gramlot_component)&&!(this.metadataAttributes.has(o)||["ask","_ask"].includes(o)||l&&typeof l=="object"&&Object.hasOwn(l,"$gramlotRef"))&&l!=null&&!["string","number","boolean"].includes(typeof l))throw new TypeError(`HTML attribute ${o} must be scalar`);let s=Object.fromEntries(Object.entries(e.attr).filter(([o])=>!this.metadataAttributes.has(o))),a=n?e.value.getNodes().map(o=>o.nodeTag).filter(Boolean):[];t.validateNode(e,{value:i,attrs:s,childTags:a})}create(e,t,n=null,i=e.attr,s=null){let{tag:a,namespace:o,meta:l}=this.definition(e);n??=a;let u=o===We?t.createElement(n):t.createElementNS(o,n);if(l.gramlot_component&&u.constructor.gramlotComponent?.tag!==n)throw new Error(`Component collection must be activated before rendering ${n}`);l.gramlot_component?.dataScope&&(u.readDataScope=()=>{if(!e.getAttr("datapath"))throw new Error("Data scope requires an explicit datapath");return e.getRelativeData(".")});let c=t.createTextNode(this.text(e));(o!==We||!l.void)&&u.append(c);let d={element:u,text:c,tag:n};return this.update(d,e,i,La,s),d}matches(e,t){let{tag:n,namespace:i}=this.definition(t);return(i===We?e.tag.toLowerCase()===n.toLowerCase():e.tag===n)&&e.element.namespaceURI===i}compose(e,t,n){e.text.data=t??"";for(let i of n)e.element.append(i)}update(e,t,n=t.attr,i=La,s=null){let{element:a,text:o}=e,l=a.namespaceURI===We,u=this.definition(t).meta.render_attributes??{},c=e.attrs??{};this.definition(t).meta.gramlot_component&&(n=a.projectAttributes(n,p=>(qr(t,p,t.builder.constructor.dialectPrefixes),Ur(t,p,t.builder.constructor.dialectPrefixes),t.builder.renderer_html.adaptAttrs(p)))),n=Object.fromEntries(Te({...n,...u}));let d=De.classFor(a,n)!==null;i===La&&(i=this.text(t));let f=i==null?"":String(i);o.data!==f&&(o.data=f);let h=[...new Set([...Object.keys(c),...Object.keys(n)])];h.sort((p,m)=>(m==="sandbox")-(p==="sandbox"));for(let p of h){if(this.metadataAttributes.has(p)||["ask","_ask"].includes(p)||d&&p==="value")continue;let m=n[p],g=p,b=Vm(g),y=l&&jm.has(b)&&typeof a[b]=="boolean",w=g==="xmlns"?"xmlns":g.includes(":")?g.split(":")[0]:"",A=Object.hasOwn(tc,w)?tc[w]:null;if(Object.is(c[p],m)||(m==null||y&&!m?A?a.removeAttributeNS(A,g.split(":").at(-1)):a.removeAttribute(g):A?a.setAttributeNS(A,g,String(m)):a.setAttribute(g,y?"":String(m))),l&&(y||Um.has(b))&&b in a){let C=b==="value"?m==null?"":String(m):!!m;a[b]!==C&&(a[b]=C)}}s===!1?a.style.visibility!=="hidden"&&(a.style.visibility="hidden"):e.visible===!1&&(n.style==null?a.removeAttribute("style"):a.setAttribute("style",String(n.style))),e.visible=s,e.attrs=n}text(e){return e.value instanceof S?e.getAttr("_text")==null?"":String(e.attr._text):e.value==null?"":String(e.value)}};var rc=new WeakMap,zm=new Set(["title","msg","fields","_if","askIf"]),Hm=new Set(["name","lbl","tag","type","default_value","required","min","max","step","placeholder"]),$t=class{static required(e,t,n,i){let s=(a,o)=>typeof o=="boolean"?o:e.runtime.inlineCompiler.compile(e.node,a,o,Object.keys(n),`return (${o});`)(n);if(typeof t=="string"){let a=e.node.getAttr("_ask_if");return!a||!!s("_ask_if",a)}return t?.askIf&&s(`${i}.askIf`,t.askIf),!t?._if||!!s(`${i}._if`,t._if)}static show(e,t,n,i="Parameters"){let s=typeof t=="string"?{msg:t,title:i}:t;if(!s||typeof s!="object"||Array.isArray(s))throw new TypeError("ask requires text or a parameter description");for(let c of Object.keys(s))if(!zm.has(c))throw new Error(`Unsupported ask option: ${c}`);let a=s.fields??[];if(!Array.isArray(a))throw new TypeError("ask fields must be an array");let o=new Set;for(let c of a){if(!c||!/^[A-Za-z_]\w*$/.test(c.name)||o.has(c.name))throw new Error("ask fields require distinct simple names");o.add(c.name);for(let d of Object.keys(c))if(!Hm.has(d))throw new Error(`Unsupported ask field option: ${d}`);if(c.tag&&!["input","textarea"].includes(c.tag))throw new Error(`Unsupported ask widget: ${c.tag}`);if(c.type&&!["text","number","date","checkbox","email","password","url","tel"].includes(c.type))throw new Error(`Unsupported ask input type: ${c.type}`)}let l=e.runtime.gramlot,u=rc.get(l);if(!u){let c=`ask_${Array.from(crypto.getRandomValues(new Uint8Array(16)),h=>h.toString(16).padStart(2,"0")).join("")}`,d=new Map;class f{confirm(p,m){m.preventDefault(),d.get(p.getAttr("request"))?.finish(!0)}cancel(p,m){m.preventDefault(),d.get(p.getAttr("request"))?.finish(!1)}}l.src.logicRegistry.register(f,{group:c,resource:"gramlot:ask"}),u={group:c,requests:d},rc.set(l,u)}return new Promise((c,d)=>{let f=`ask_${Array.from(crypto.getRandomValues(new Uint8Array(16)),g=>g.toString(16).padStart(2,"0")).join("")}`,h=!1,p=()=>{},m=(g,b=null)=>{if(h)return;h=!0;let y=g?Object.fromEntries(a.map(w=>[w.name,l.data.getItem(`${f}.${w.name}`)])):null;u.requests.delete(f),p();try{l.src.source.popNode(f),l.data.getNode(f)&&l.data.popNode(f),b?d(b):c(y)}catch(w){d(w)}};u.requests.set(f,{finish:m}),p=e.track(()=>m(!1));try{let g=new Ge,b=g.root.dialog({node_id:f,datapath:f,request:f,connect_oncancel:`${u.group}.cancel`,connect_onclose:`${u.group}.cancel`,class:"gramlot-ask","aria-labelledby":`${f}_title`,style:"border:1px solid #aab4c2;border-radius:8px;padding:16px;max-width:32rem;width:calc(100% - 48px);font:inherit;"});b.h2(s.title??i,{id:`${f}_title`,style:"font-size:1.1em;margin:0 0 12px;"}),s.msg&&b.p(s.msg);let y=b.form({request:f,connect_onsubmit:`${u.group}.confirm`});for(let C of a){y.dataSetter({destination_path:`.${C.name}`,value:Object.hasOwn(n,C.name)?n[C.name]:C.default_value??(C.type==="checkbox"?!1:"")});let j=y.div({style:"margin:8px 0;"});j.html_label(C.lbl??C.name,{for:`${f}_${C.name}`,style:"display:block;margin-bottom:4px;"});let Y={id:`${f}_${C.name}`,value:`^.${C.name}`,live:!0};for(let k of["required","min","max","step","placeholder"])C[k]!==void 0&&(Y[k]=C[k]);C.tag==="textarea"?j.textarea(Y):j.input({...Y,type:C.type??"text"})}let w=y.div({style:"display:flex;justify-content:flex-end;gap:8px;margin-top:16px;"});w.html_button("Cancel",{type:"button",request:f,connect_onclick:`${u.group}.cancel`}),w.html_button("Confirm",{type:"submit",autofocus:a.length===0}),l.src.source.setItem(f,l.src.prepareSource(g.source));let A=l.src.binding.nodeIds.get(f);l.dom.getDomNode(A).showModal()}catch(g){m(!1,g)}})}};var ns=class r{#e;#t;#r=null;#i=0;static for(e,t){return t.element?.constructor.gramlotComponent?.command?new r(e,t):null}constructor(e,t){this.#e=e,this.#t=t}get binding(){return this.#e}get node(){return this.binding.node}get element(){return this.#t.element}get controllers(){let e=this.node.value;return e?.getNodes?e.getNodes().filter(t=>t.nodeTag==="dataController"||t.nodeTag==="dataRpc"):[]}get mechanism(){let e=this.node,t=this.controllers;if(t.length>1)throw new Error(`${e.nodeTag} '${e.label}': several dataController or dataRpc children; a button has one click mechanism`);let n=e.getAttr()??{},i=[];if(t.length&&i.push("controller"),n.action!=null&&i.push("action"),nc(n).length&&i.push("fire"),i.length>1)throw new Error(`${e.nodeTag} '${e.label}': ${i.join(" and ")} together; a button has one click mechanism`);return i[0]??null}attach(){this.refresh(),this.element.activateCommand=e=>this.onClick(e),this.element.attachCommand(),this.element.addEventListener("click",this)}refresh(){this.mechanism&&this.node.getAttr("type")==null&&this.element.getAttribute("type")!=="button"&&this.element.setAttribute("type","button")}detach(){this.element.removeEventListener("click",this),this.element.releaseCommand(),delete this.element.activateCommand,this.#r?.()}handleEvent(e){this.onClick(e)}onClick(e){if(this.binding.closed||this.element.disabled)return;let t=this.element.commandTarget(e);if(t===null)return;if(t!==this.element)return e.stopPropagation(),t.activateCommand(e);if(!this.element.prepareCommand(e)||!this.mechanism||(e.stopPropagation(),this.element.disabled))return;let i=this.binding.countClick(),s=this.node;for(;s&&s.getAttr("_delay")==null;)s=s.parentNode;let a=s?s.builder.runtimeValues(s)[1]._delay:0;if(a>0){let o=this.#i+1;this.#r?.(),this.#i=o;let l=setTimeout(()=>{u(),this.#r=null,this.#i=0,this.#n(e,o)},a),u=this.binding.track(()=>this.#r?.());this.#r=()=>{clearTimeout(l),u(),this.#r=null,this.#i=0};return}return this.#r?.(),this.#n(e,i)}#n(e,t){if(this.binding.closed||this.element.disabled)return;let n=this.mechanism;if(!n)return;let i=this.node,s=Wm(e);if(n==="controller")this.binding.runtime.bindingFor(this.controllers[0])?.providers[0]?.invoke({kind:"click",event:e,counter:t});else if(n==="action"){let a=()=>{let[,u]=i.builder.runtimeValues(i),c=Object.fromEntries(Object.entries(u).filter(([d])=>d!=="ask"));return{...this.binding.runtime.renderer.references.resolveArguments(c),event:e,_counter:t,modifiers:s}},o=u=>{if(this.binding.closed||this.element.disabled||u===null)return;let c={...a(),...u};u&&(c._askResult=u),this.binding.runtime.inlineCompiler.compile(i,"action",i.getAttr("action"),Object.keys(c))(c)},l=i.getAttr("ask");if(l&&$t.required(this.binding,l,a(),"ask"))return $t.show(this.binding,l,a()).then(o);o(void 0)}else{let a={modifier:s,_counter:t},o=i.getAttr("fire");if(o!=null){i.FIRE(o,s||!0,a);return}for(let[l,u]of nc(i.getAttr())){if(this.binding.closed)return;i.FIRE(u,l.slice(5),a)}}}};function nc(r){return Object.entries(r??{}).filter(([e,t])=>t!=null&&(e==="fire"||e.startsWith("fire_")))}function Wm(r){return["shift","ctrl","alt","meta"].filter(e=>r[`${e}Key`]).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}var is="connect_on",Gm=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/,Pn=class{#e;#t;#r;#i;#n;static declared(e){return Object.entries(e.getAttr()??{}).filter(([t,n])=>t.startsWith(is)&&t.length>is.length&&n!=null).map(([t,n])=>[t,t.slice(is.length).toLowerCase(),n])}constructor(e,t,n,i,s=`${is}${n}`){this.#e=e,this.#t=t,this.#r=n,this.#i=i,this.#n=s}get binding(){return this.#e}get node(){return this.binding.node}get element(){return this.#t.element}get eventName(){return this.#r}get handler(){return this.#i}get attribute(){return this.#n}attach(){this.element.addEventListener(this.eventName,this)}detach(){this.element.removeEventListener(this.eventName,this)}handleEvent(e){if(this.binding.closed)return;let t=this.node,n=this.binding.runtime;if(Gm.test(this.handler)){let{group:i,method:s}=n.logicRegistry.resolve(this.handler,t);s.call(i,t,e);return}n.inlineCompiler.compile(t,this.attribute,this.handler,["event"])({event:e})}};function Un(r,e=new Set){if(!r||typeof r!="object")return;let t=r.ownerDocument?.defaultView?.Node??r.defaultView?.Node;if(pe(r)instanceof Se||t&&r instanceof t)throw new TypeError("Live Source/DOM references cannot cross a transport boundary");if(e.has(r))throw new TypeError("Transport data cannot contain circular references");e.add(r);let n=r instanceof z?r.getNodes().flatMap(i=>[i.staticValue,i.getAttr()]):Object.values(r);for(let i of n)Un(i,e);e.delete(r)}var jn=class{constructor(e=null){this.entries=new Map,this.sourceRoot=e}validate(e,t=new Set){let n=new Map,i=s=>{for(let a of s.getNodes()){let o=a.getAttr("__ref");if(o){if(n.has(o))throw new Error("Duplicate Source reference");let l=this.entries.get(o);if(e!==this.sourceRoot&&l&&l.node!==a&&!t.has(l.node))throw new Error("Duplicate Source reference");n.set(o,a)}a.value instanceof S&&i(a.value)}};i(e)}register(e,t){let n=e.getAttr("__ref");if(n){if(this.entries.has(n))throw new Error(`Duplicate Source reference: ${n}`);this.entries.set(n,{node:e,dom:t})}}remove(e){for(let[t,n]of this.entries)n.node===e&&this.entries.delete(t)}resolveArguments(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n&&typeof n=="object"&&Object.hasOwn(n,"$gramlotRef")?this.resolve(n):n]))}resolve(e){if(!e||!["node","dom"].includes(e.kind))throw new TypeError("Expected a node or DOM reference");let t=this.entries.get(e.$gramlotRef);if(!t)throw new Error("Source reference is not mounted");return t[e.kind]}};var Xm="_root_",ss=class{constructor(e=null,t=null){this.parent=e,this.segment=t,this.children=new Map,this.registrations=new Set}},Pa=class{#e;#t;#r;#i;#n;#s=!0;constructor(e,{path:t,attr:n,recipient:i,order:s}){this.#e=e,this.#t=t,this.#r=n,this.#i=i,this.#n=s}get router(){return this.#e}get path(){return this.#t}get attr(){return this.#r}get recipient(){return this.#i}get active(){return this.#s}get order(){return this.#n}close(){this.active&&(this.#s=!1,this.router.unregister(this))}},ja=class{constructor({evt:e,node:t,path:n,oldvalue:i,attrsDiff:s,reason:a,fired:o,level:l,registration:u}){this.evt=e,this.node=t,this.path=n,this.oldvalue=i,this.attrsDiff=s,this.reason=a,this.fired=o,this.level=l,this.registration=u}},as=class{#e;#t=new ss;#r=new Map;#i=0;#n=0;constructor(e){this.#e=e}get runtime(){return this.#e}get size(){return this.#i}register({path:e,attr:t=null,recipient:n}){if(typeof e!="string"||e==="")throw new TypeError(`A Data registration requires a path: ${e}`);let i=this.#t;for(let a of e.split(".")){let o=i.children.get(a);o||(o=new ss(i,a),i.children.set(a,o)),i=o}this.#n+=1;let s=new Pa(this,{path:e,attr:t,recipient:n,order:this.#n});return i.registrations.add(s),this.#r.set(s,i),this.#i+=1,s}unregister(e){let t=this.#r.get(e);if(t)for(this.#r.delete(e),t.registrations.delete(e),this.#i-=1;t.parent&&!t.children.size&&!t.registrations.size;)t.parent.children.delete(t.segment),t=t.parent}deliver(e){let{pathlist:t}=e;if(!t?.length||t[0]!==Xm||e.reason==="autocreate")return;let n=t.slice(1),i=e.evt==="ins"||e.evt==="del";for(let s of Array.isArray(e.node)?e.node:[e.node]){let a=i?[...n,s.label]:n,o=a.join(".");for(let[l,u]of this.#s(a,e))l.active&&l.recipient.receive(new ja({evt:e.evt,node:s,path:o,oldvalue:e.oldvalue??null,attrsDiff:e.attrs_diff??null,reason:e.reason??null,fired:e.fired??!1,level:u,registration:l}))}}#s(e,t){let n=[],i=this.#t;for(let a of e){for(let o of i.registrations)i!==this.#t&&this.#a(o,"child",t)&&n.push([o,"child"]);if(i=i.children.get(a),!i)return n.sort(([o],[l])=>o.order-l.order)}for(let a of i.registrations)this.#a(a,"node",t)&&n.push([a,"node"]);let s=[...i.children.values()];for(;s.length;){let a=s.pop();for(let o of a.registrations)this.#a(o,"container",t)&&n.push([o,"container"]);s.push(...a.children.values())}return n.sort(([a],[o])=>a.order-o.order)}#a(e,t,n){let{evt:i}=n;return e.attr===null?i==="upd_attrs"?!1:!(t==="child"&&n.fired):t==="child"?!1:t==="container"?i!=="upd_attrs":i==="ins"||i==="del"?!0:Object.hasOwn(n.attrs_diff??{},e.attr)}};var os=class{#e;constructor(e){this.#e=e}get runtime(){return this.#e}install(e){let t=qn(e),n=this.setterNodes(e);qa(e);for(let i of n){let s=this.runtime.openBinding(i);s.hasStamp("installed")||(this.applySetter(i),s.stamp("installed"))}this.applyDefaults(t.filter(i=>i.nodeTag&&!i._getMeta("data_element")))}setterNodes(e){return qn(e).filter(t=>t.nodeTag==="dataSetter")}applySetter(e){let t=e.absDatapath(e.pathAttribute("destination_path"));if(t===null)return;let n=e.getAttr("value")??null,i=Zm(e.getAttr()),s=this.runtime.data;if(n!==null)s.setItem(t,n,i,">",!1,!0,e),n instanceof z&&e.setAttr({value:null},!1);else{let a=s.getNode(t);a?i&&a.setAttr(i,!0):s.setItem(t,null,i,">",!1,!0,e)}}applyDefaults(e){for(let t of e){let n=t.getAttr();for(let[i,s]of Object.entries(n)){if(!Ym(t,i,s))continue;let a=i==="value"?n.default_value??n.default:n[`default_${i}`];a!=null&&this.#t(t,s,a)}this.#r(t,n)}}#t(e,t,n){let i=e.absDatapath(t);if(i===null)return;let[s,a=null]=i.split("?",2),o=this.runtime.data,l=o.getNode(s);if(a===null){if(l&&l.value!==null&&l.value!==void 0)return;o.setItem(s,n,null,">",!1,!0,e)}else if(l){let u=l.getAttr(a);u==null&&l.setAttr({[a]:n},!0)}else o.setItem(s,null,{[a]:n},">",!1,!0,e)}#r(e,t){let n={};for(let[a,o]of Object.entries(t))a.startsWith("attr_")&&(n[a.slice(5)]=W(o)?Rt(e,a):e.pointerType(o)?e.getRelativeData(o):o);if(!Object.keys(n).length)return;let i=[t.value,t.src].find(a=>e.pointerType(a));if(!i)return;let s=e.absDatapath(i);s!==null&&this.runtime.data.getNode(s.split("?",1)[0])?.setAttr(n,!0,!0,!1)}};function Ym(r,e,t){return e==="_meta"||Gt.has(e)||e==="default"||e.startsWith("default_")||e.startsWith("attr_")||e.endsWith("_path")?!1:r.pointerType(t)!==null}function Zm(r){let e={};for(let[t,n]of Object.entries(Mt(r??{})))Gt.has(t)||t.startsWith("_")||t==="destination_path"||t==="value"||n!=null&&(e[t]=n);return Object.keys(e).length?e:null}function Jm(r){let e=r.builder;if(!(e instanceof Ge))throw new Error(`dataSetter '${r.label}': dataSetter is not supported inside ${e.constructor._name}`)}function qa(r){for(let e of qn(r))e.nodeTag==="dataSetter"&&Jm(e),tg(e)}var Km=["_init","_onStart","_onBuilt","_delay","_timing","_userChanges"],Qm=new Set(["dataFormula","dataController","dataRpc","dataRemote"]),eg=["_onCalling","_onResult","_onError"],Ua=["_init","_onBuilt","_onStart"];function tg(r){let e=i=>r.getAttr(i)!==null&&r.getAttr(i)!==void 0;if(r.nodeTag!=="dataRpc"){let i=eg.find(e);if(i)throw new Error(`${r.nodeTag??"fragment"} '${r.label}': '${i}' is allowed only on dataRpc`)}if(Qm.has(r.nodeTag)){let i=Object.entries(r.getAttr()).find(([,a])=>gt(a));if(i)throw new Error(`${r.nodeTag} '${r.label}': '${i[0]}' is a == expression, not accepted on ${r.nodeTag}`);let s=r.nodeTag==="dataRemote"?Ua.find(e):null;if(s)throw new Error(`dataRemote '${r.label}': '${s}' is not accepted on dataRemote, its resolver loads when the Data is read`);for(let a of Ua){let o=r.getAttr(a);if(!(o==null||typeof o=="boolean"||typeof o=="number"))throw new Error(`${r.nodeTag} '${r.label}': '${a}' accepts true, false, null or a number, not ${JSON.stringify(o)}`)}return}let t=Km.find(i=>e(i)&&!(i==="_delay"&&!r._getMeta("data_element")&&r.nodeTag!=="html_button"));if(!t)return;let n=Ua.includes(t)?"dataFormula, dataController and dataRpc":"dataFormula, dataController, dataRpc and dataRemote";throw new Error(`${r.nodeTag??"fragment"} '${r.label}': '${t}' is allowed only on ${n}`)}function qn(r){if(r instanceof S)return r.getNodes().flatMap(t=>qn(t));let e=[r];return r.value instanceof S&&e.push(...qn(r.value)),e}var ls=class extends ee{static classKwargs={...ee.classKwargs,asBag:!1};static internalParams=new Set([...ee.internalParams,"gramlot","method","params","onError"]);constructor({gramlot:e,method:t,params:n,cacheTime:i,onError:s}){super({cacheTime:i??-1}),this.gramlot=e,this.method=t,this.params=n,this.onError=s,this.controller=null,this.loading=null,this.loaded=!1,this.writing=!1}resolve({static:e=!1}={}){return!e&&!this.loading&&!this.writing&&this.expired&&this.refresh(),this.cachedValue}refresh(){let e=()=>{this.loading===i&&(this.controller=null,this.loading=null)},t=this.load(),{signal:n}=this.controller,i=t.then(s=>{if(e(),n.aborted)throw n.reason;this._lastUpdate=Date.now(),this.loaded=!0,this.writing=!0;try{this._node?this._node.setValue(s,this.cacheTime!==0):this.cachedValue=s}finally{this.writing=!1}return s},s=>{throw e(),s});return this.loading=i,i.catch(s=>{s?.name!=="AbortError"&&this.onError(s)}),i}load(){let e=new AbortController,t=new Promise((i,s)=>{e.signal.addEventListener("abort",()=>s(e.signal.reason),{once:!0})}),n=this.gramlot.rpc.call("data",this.method,this.params,{signal:e.signal});return this.controller=e,Promise.race([n,t])}abort(){this.controller?.abort()}};var rg=new Set(["destination_path","result_path","func","formula","script","if","else","_init","_onStart","_onBuilt","_delay","_timing","_userChanges","_ask","_ask_if","_ask_title","_ask_onCancel","method","timeout","_onCalling","_onResult","_onError","cacheTime"]),zr=class{#e;#t=[];#r=new Set;#i=null;#n=null;#s=null;#a=null;#o=!1;constructor(e){this.#e=e,e.track(()=>{this.cancel(),this.#m(),this.#d()})}get binding(){return this.#e}get node(){return this.binding.node}get kind(){throw new Error("Provider.kind is defined by FormulaProvider, ControllerProvider, RpcProvider and RemoteProvider")}register(){let e=this.node,t=e.getAttr("_onStart");if(typeof t=="number"&&!(Number.isFinite(t)&&t>=0))throw new Error(`${e.nodeTag} '${e.label}': _onStart must be true or a delay in ms not below 0: ${t}`);this.#m();let n=this.binding.runtime.router,i=lt(e,e.getAttr("_timing"));for(let[a,o]of e.pointers()){if(a==="datapath")continue;let l=e.absDatapath(o);if(l===null)continue;let[u,c=null]=l.split("?",2),d=n.register({path:u,attr:c,recipient:this});this.#t.push(d),(a==="_timing"||i.has(a))&&this.#r.add(d)}let s=this.binding.runtime.gramlot._subscriptions;for(let a of Object.keys(e.getAttr())){let o=a.startsWith("selfsubscribe_")?"selfsubscribe_":a.startsWith("subscribe_")?"subscribe_":null;if(!o)continue;let l=o==="selfsubscribe_"?s.topicFor(e,a.slice(o.length)):a.slice(o.length),u=s.subscribe(l,c=>{let d={kind:"subscription",topic:l,payload:c};if(this.#l("_userChanges")&&l!=="node")return;let f=this.#l("_delay");f>0?this.#f(d,f):this.invoke(d)});this.#t.push({close:()=>s.unsubscribe(u)})}this.#c(),this.kind==="remote"&&this.invoke({kind:"install",change:null})}receive(e){if(this.#r.has(e.registration)){this.#c();return}if(this.#l("_userChanges")&&e.level!=="node")return;let t={kind:"data",change:e},n=this.#l("_delay");n>0?this.#f(t,n):this.invoke(t)}invoke(e){if(this.binding.closed)return;let t=this.node,n=this.kind==="formula",i=this.kind==="rpc",s=this.kind==="remote",a=this.readArguments(e);e.askResult&&(Object.assign(a,e.askResult),a._askResult=e.askResult);let o=t.getAttr("_ask");if(o&&!e.askDone&&$t.required(this.binding,o,a,"_ask"))return $t.show(this.binding,o,a,t.getAttr("_ask_title")??"Warning").then(h=>{if(!this.binding.closed){if(h===null){let p=t.getAttr("_ask_onCancel");p&&this.#u("_ask_onCancel",p,p,a,!0);return}return this.invoke({...e,askDone:!0,askResult:h})}});let[l,u]=[n?"formula":"script",t.getAttr(n?"formula":"script")],c=t.getAttr("_if");if(c&&!this.#u("_if",c,`return (${c})`,a,!1)){if(s&&this.#d(),[l,u]=["_else",t.getAttr("_else")],!u)return;if(i||s){this.#u(l,u,u,a,!0);return}}if(i)return this.#p(a);if(s)return this.#h(a);let d=t.getAttr("func"),f;if(u)f=this.#u(l,u,n?`return ${u}`:u,a,!0);else if(d==null){if(!n)return;f=new z(us(a))}else{let{group:h,method:p}=this.binding.runtime.logicRegistry.resolve(d,t);f=n?p.call(h,a):p.call(h,t,a)}n&&t.setRelativeData(t.pathAttribute("result_path"),f)}readArguments(e){let t=this.node,[,n]=t.builder.runtimeValues(t),i=Object.fromEntries(Object.entries(n).filter(([l])=>!rg.has(l)&&!l.startsWith("subscribe_")&&!l.startsWith("selfsubscribe_"))),s={...e.kind==="subscription"?e.payload:{},...this.binding.runtime.renderer.references.resolveArguments(i)};e.kind==="subscription"&&(s._subscription_kwargs=e.payload);let a=e.change??null,o=a?a.level:e.kind==="subscription"?e.topic:e.kind;return s._node=a?a.node:null,s._triggerpars={kw:a,trigger_reason:o},s._reason=o,e.kind==="click"&&Object.assign(s,ng(e)),s}cancel(){this.#n?.(),this.#i?.()}#c(){this.#i?.();let e=this.#l("_timing");if(!(e>0))return;let t=setInterval(()=>this.invoke({kind:"timing",change:null}),e*1e3),n=this.binding.track(()=>clearInterval(t));this.#i=()=>{clearInterval(t),n(),this.#i=null}}#f(e,t){this.#n?.();let n=null,i=setTimeout(()=>{n(),this.#n=null,this.invoke(e)},t);n=this.binding.track(()=>clearTimeout(i)),this.#n=()=>{clearTimeout(i),n(),this.#n=null}}#l(e){let t=this.node,n=t.getAttr(e);return W(n)?Rt(t,e):t.pointerType(n)?t.getRelativeData(n):n??null}#u(e,t,n,i,s){let a=[...s?["_kwargs"]:[],...ic,...sc,...Object.keys(us(i))];return this.binding.runtime.inlineCompiler.compile(this.node,e,t,a,n)({...i,_kwargs:i})}async#p(e){let t=this.node,[n,i,s]=["_onCalling","_onResult","_onError"].map(p=>t.getAttr(p));n&&this.#u("_onCalling",n,n,e,!0),this.#s?.abort();let a=new AbortController;this.#s=a;let o=this.binding.track(()=>a.abort()),l=this.#l("timeout"),u=l>0?setTimeout(()=>{let p=new Error(`${t.nodeTag} '${t.label}': no answer within ${l} ms`);p.name="TimeoutError",a.abort(p)},l):null,c=new Promise((p,m)=>{a.signal.addEventListener("abort",()=>m(a.signal.reason),{once:!0})}),d;try{let p=this.binding.runtime.gramlot.rpc.call("data",this.#l("method"),us(e),{signal:a.signal});d={result:await Promise.race([p,c])}}catch(p){d={error:p}}clearTimeout(u),o();let f=this.#s===a&&!this.binding.closed;if(this.#s===a&&(this.#s=null),!f)return;if("error"in d){if(!s)throw d.error;this.#u("_onError",s,s,{...e,error:d.error},!0);return}let{result:h}=d;t.getAttr("result_path")!=null&&t.setRelativeData(t.pathAttribute("result_path"),h),i&&this.#u("_onResult",i,i,{...e,result:h},!0)}#h(e){this.#d();let t=this.#o;this.#o=!1;let n=this.node,i=n.absDatapath(n.pathAttribute("destination_path"));if(i===null)return;let s=new ls({gramlot:this.binding.runtime.gramlot,method:this.#l("method"),params:us(e),cacheTime:this.#l("cacheTime"),onError:a=>{throw new Error(`${n.nodeTag} '${n.label}': dataRemote '${s.method}' failed: ${a.message}`,{cause:a})}});this.binding.runtime.data.setResolver(i,s),this.#a={path:i,resolver:s},t&&s.refresh()}#d(){if(!this.#a)return;let{path:e,resolver:t}=this.#a;this.#a=null,this.#o=t.loaded||t.loading!==null,t.abort();let n=this.binding.runtime.data.getNode(e);n?.resolver===t&&(n.resolver=null)}#m(){for(let e of this.#t.splice(0))e.close();this.#r.clear()}},cs=class extends zr{get kind(){return"formula"}},ds=class extends zr{get kind(){return"controller"}},fs=class extends zr{get kind(){return"rpc"}},ps=class extends zr{get kind(){return"remote"}},ic=["_node","_triggerpars","_reason","_subscription_kwargs","_askResult"],sc=["_evt","button_counter","button_shift","button_ctrl","button_alt","button_meta"];function us(r){let e={...r};for(let t of[...ic,...sc])delete e[t];return e}function ng({event:r,counter:e}){return{_evt:r,button_counter:e,button_shift:!!r.shiftKey,button_ctrl:!!r.ctrlKey,button_alt:!!r.altKey,button_meta:!!r.metaKey}}var ig=[[null,/(\W|^)GET (?:\s*)(\^?[\w.#@$?-]+)/g,"$1this.GET('$2')"],[/;SET/g,/(\W|^)SET (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)=(?:\s*)([^;\r\n]*)(;?)/gm,"$1this.SET('$2', $3)$4 "],[/;PUT/g,/(\W|^)PUT (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)=(?:\s*)([^;\r\n]*)(;?)/gm,"$1this.PUT('$2', $3)$4 "],[/;FIRE_AFTER/g,/(\W|^)FIRE_AFTER (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)=(?:\s*)([^;\r\n]*)(;?)/g,"$1this.FIRE_AFTER('$2', $3)$4 "],[/;FIRE_AFTER/g,/(\W|^)FIRE_AFTER (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)(;?)/g,"$1this.FIRE_AFTER('$2')$3 "],[/;FIRE/g,/(\W|^)FIRE (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)=(?:\s*)([^;\r\n]*)(;?)/g,"$1this.FIRE('$2', $3)$4 "],[/;FIRE/g,/(\W|^)FIRE (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)(;?)/g,"$1this.FIRE('$2')$3 "]],sg=/(\W|^)PUBLISH (?:\s*)(\^?[\w.#@$?-]+)/,ag=new Set(["arguments","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","eval","export","extends","false","finally","for","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","return","static","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"]),hs=class{#e;#t=new Map;constructor(e){this.#e=e}get runtime(){return this.#e}get size(){return[...this.#t.values()].reduce((e,t)=>e+t.size,0)}preprocess(e,t,n){let i=n.trim();if(sg.test(i))throw new Error(`${Vn(e,t)}: the PUBLISH macro is excluded from Gramlot 0.2.0`);let s=i.replace(/\$(\d+)/g,(a,o)=>`arguments[${parseInt(o,10)-1}]`);for(let[a,o,l]of ig)a&&(s=s.replace(a,`; ${a.source.slice(1)}`)),s=s.replace(o,l);return s!==i&&console.warn(`${Vn(e,t)}: legacy macros are deprecated; write this.GET(path), this.SET(path, value), this.PUT(path, value), this.FIRE(path, value), this.FIRE_AFTER(path, value) and arguments[n] in place of GET, SET, PUT, FIRE, FIRE_AFTER and $n`),s}compile(e,t,n,i,s=n){if(e.activatedCode(t)!==n)throw new Error(`${Vn(e,t)}: inline code runs only as received with the Source (main or a remote Source); a text written later is not run: use named logic`);let a=this.#t.get(e);a||(a=new Map,this.#t.set(e,a),this.runtime.bindingFor(e).track(()=>this.release(e)));let o=a.get(t);o?.source!==s&&(o={source:s,text:this.preprocess(e,t,s),key:null,run:null},a.set(t,o));let l=i.filter(og),u=l.join(",");if(o.key!==u){let c=lg(e,t,o.text,l);o.key=u,o.run=d=>c.apply(e,l.map(f=>d[f]))}return o.run}compileExpression(e,t,n){let i=n.slice(2),s=Te(e.getAttr()).filter(([,o])=>!gt(o)),a=this.compile(e,t,n,[...s.map(([o])=>o).filter(o=>o!=="_F"),"_F"],`return ${i}`);return o=>{let l={};for(let[u,c]of s)Object.hasOwn(o,u)?l[u]=o[u]:l[u]=e.pointerType(c)?e.getRelativeData(c):c;return a({...l,_F:(u,c)=>this.runtime.gramlot.format(u,c)})}}compilePointerExpression(e,t,n,i){let s=this.compile(e,t,n,["_pointerValues","_F"],`return (${i}
60
- )`);return a=>s({_pointerValues:a,_F:(o,l)=>this.runtime.gramlot.format(o,l)})}release(e,t=null){if(t===null){this.#t.delete(e);return}let n=this.#t.get(e);if(n)for(let i of t){n.delete(i);for(let[s]of Te({[i]:null}))n.delete(s)}}};function og(r){return/^[A-Za-z_$][\w$]*$/.test(r)&&!ag.has(r)}function Vn(r,e){return`${r.nodeTag} '${r.label}' ${e?`'${e}'`:"node value"}`}function lg(r,e,t,n){try{return t.startsWith("function")?new Function(`return (${t}
57
+ :host([role=separator]) button{display:none}`,this.shadowRoot.append(t)}get disabled(){return this.control.disabled}set disabled(e){this.control.disabled=!!e}projectAttributes(e,t){let n=super.projectAttributes(e,t);return this.control.disabled=!!this.parameters.disabled,this.control.readOnly=!!this.parameters.readonly,this.icon.textContent=this.parameters.icon??"",e["aria-label"]!=null?this.control.setAttribute("aria-label",e["aria-label"]):this.control.removeAttribute("aria-label"),n}attachCommand(){}releaseCommand(){}commandTarget(){return this}prepareCommand(){return!this.disabled}}}Mn.parameters={disabled:{dtype:"B",default:!1,binding:"read"},icon:{dtype:"T",default:"",binding:"read"}};var mm=Ur({name:"button",tag:"gramlot-button",base:Mn,command:!0,subTags:"*",implementation:r=>class extends r{}}),gm=Ur({name:"toggleButton",tag:"gramlot-toggle-button",base:Mn,command:!0,subTags:"*",parameters:{value:{dtype:"B",default:!1,binding:"twoWay"},readonly:{dtype:"B",default:!1,binding:"read"}},implementation:r=>class extends r{#e=!1;constructor(){super();let e=this.ownerDocument.createElement("span");e.className="led",e.setAttribute("aria-hidden","true"),this.control.prepend(e),this.writeControlValue(!1)}get commitOnChange(){return!0}readControlValue(){return this.#e}writeControlValue(e){this.#e=e,this.control.setAttribute("aria-pressed",String(e))}prepareCommand(e){return!super.prepareCommand(e)||this.control.readOnly?!1:(this.writeControlValue(!this.#e),this.control.dispatchEvent(new this.ownerDocument.defaultView.Event("change")),!0)}}});function bm(r){return class extends r{constructor(){super(),this.attachShadow({mode:"open"}).append(this.ownerDocument.createElement("slot"))}connectedCallback(){this.slot="menu",this.setAttribute("role","menu")}projectAttributes(e){return Ji(this,e)}}}var _m=Ur({name:"menu",tag:"gramlot-menu",base:bm,subTags:"menuline",implementation:r=>class extends r{}}),wm=Ur({name:"menuline",tag:"gramlot-menu-line",base:Mn,command:!0,subTags:"*",parameters:{code:{dtype:"T",nullable:!0}},implementation:r=>class extends r{attachCommand(){let e=this.textContent.trim()==="-";if(!e&&!this.parameters.code)throw new TypeError("menuline requires a stable code");this.setAttribute("role",e?"separator":"menuitem"),this.control.tabIndex=-1,this.disabled||=e}get disabled(){return super.disabled||!!this.closest("gramlot-drop-down-button")?.parameters.disabled}set disabled(e){super.disabled=e}prepareCommand(e){return super.prepareCommand(e)?(this.closest("gramlot-drop-down-button").selectCommand(this,e.shiftKey),!0):!1}}}),ym=Ur({name:"dropDownButton",tag:"gramlot-drop-down-button",base:Mn,command:!0,subTags:"*",parameters:{persist:{dtype:"B",default:!1}},implementation:r=>class extends r{#e=null;#t=null;#r=null;#i=null;#n;#s;#a;constructor(){super();let e=this.ownerDocument;this.control.classList.add("split"),this.#a=e.createElement("span"),this.#a.hidden=!0,this.control.append(this.#a),this.#s=e.createElement("button"),this.#s.type="button",this.#s.className="arrow",this.#s.textContent="\u25BE",this.#s.setAttribute("aria-label","Open menu"),this.#s.setAttribute("aria-haspopup","menu"),this.#s.setAttribute("aria-expanded","false"),this.controlBox.append(this.#s),this.#n=e.createElement("div"),this.#n.className="popup",this.#n.id="menu",this.#n.setAttribute("popover","auto"),this.#s.setAttribute("aria-controls","menu");let t=e.createElement("slot");t.name="menu",this.#n.append(t),this.shadowRoot.append(this.#n),this.#s.addEventListener("click",n=>{n.stopPropagation(),this.#n.matches(":popover-open")?this.closeMenu():this.openMenu()}),this.#s.addEventListener("keydown",n=>{(n.key==="ArrowDown"||n.key==="ArrowUp")&&(n.preventDefault(),this.openMenu(n.key==="ArrowUp"))}),this.addEventListener("keydown",n=>{if(!this.#n.matches(":popover-open"))return;let i=this.menuItems.filter(o=>!o.disabled),s=i.indexOf(n.composedPath().find(o=>i.includes(o))),a;n.key==="ArrowDown"&&(a=(s+1)%i.length),n.key==="ArrowUp"&&(a=(s-1+i.length)%i.length),n.key==="Home"&&(a=0),n.key==="End"&&(a=i.length-1),a!==void 0&&(n.preventDefault(),i[a]?.focus()),(n.key==="Escape"||n.key==="Tab")&&(n.key==="Escape"&&n.preventDefault(),this.closeMenu())}),this.#n.addEventListener("toggle",()=>{let n=this.#n.matches(":popover-open");this.#s.setAttribute("aria-expanded",String(n)),n||(this.#r?.abort(),this.#r=null)})}get menuItems(){return[...this.querySelectorAll(":scope > gramlot-menu > gramlot-menu-line")]}projectAttributes(e,t){let n=super.projectAttributes(e,t);return this.#s.disabled=this.disabled,this.disabled&&this.#n.matches(":popover-open")&&this.closeMenu(),this.#o(),n}attachCommand(){if(this.parameters.persist){if(!this.id)throw new TypeError("dropDownButton persist requires an explicit id");this.#i=`gramlot:command:${this.ownerDocument.location.pathname}${this.ownerDocument.location.search}:${this.id}`;try{this.#e=this.ownerDocument.defaultView.localStorage.getItem(this.#i)}catch{}}this.#o(),this.#t=new this.ownerDocument.defaultView.MutationObserver(()=>this.#o()),this.#t.observe(this,{childList:!0,subtree:!0,characterData:!0})}releaseCommand(){this.#t?.disconnect(),this.#t=null,this.#r?.abort(),this.#r=null,this.#n.matches(":popover-open")&&this.#n.hidePopover()}commandTarget(e){return e?.composedPath().includes(this.#n)?null:this.menuItems.find(t=>t.parameters.code===this.#e)??this}selectCommand(e,t){if(t){if(this.#e=e.parameters.code,this.#i)try{this.ownerDocument.defaultView.localStorage.setItem(this.#i,this.#e)}catch{}this.#o()}this.closeMenu()}#o(){let e=this.menuItems.filter(i=>i.parameters.code).map(i=>i.parameters.code);if(new Set(e).size!==e.length)throw new TypeError("Dropdown menu codes must be unique");let t=this.commandTarget(),n=t!==this;this.caption.hidden=n,this.#a.hidden=!n,this.#a.textContent=n?t.textContent:"",this.icon.textContent=n?t.parameters.icon:this.parameters.icon}openMenu(e=!1){if(this.disabled)return;let t=this.menuItems.filter(s=>!s.disabled);if(!t.length)return;this.#n.showPopover(),this.#s.setAttribute("aria-expanded","true");let n=()=>Wu(this.#n,this.controlBox);n(),this.#r?.abort(),this.#r=new this.ownerDocument.defaultView.AbortController;let i={signal:this.#r.signal,capture:!0};this.ownerDocument.defaultView.addEventListener("resize",n,i),this.ownerDocument.addEventListener("scroll",n,i),t[e?t.length-1:0].focus()}closeMenu(){this.#n.matches(":popover-open")&&(this.#n.hidePopover(),this.#s.setAttribute("aria-expanded","false"),this.#r?.abort(),this.#r=null,this.#s.focus())}}}),Qi=Vu({name:"buttons",components:[mm,gm,ym,_m,wm]});function vm(r,e,t=r){let n=new Map,i=new Set,s=r.rootBuilder.binding?.inlineCompiler,a=new Map;for(let[l,u]of e){if(typeof l!="string")continue;let c=G(u)?.pointer??u;a.set(l,c instanceof te?c.resolve():r.pointerType(c)?t.getRelativeData(c):c)}let o=l=>{if(n.has(l))return n.get(l);if(!e.has(l))throw new Error(`Source attribute '${l}' does not exist`);if(i.has(l))throw new Error(`cyclic attribute dependency: ${[...i,l].join(" -> ")}`);i.add(l);let u=e.get(l),c=G(u),d=c?a.get(l):null,f,p=h=>h?o(h):d;try{if(c)if(c.expression){let h=hr(c.body),m=h.slots.map(p);f=r.rootBuilder.evaluatePointerExpression(r,l,u,h,m)}else f=Zr(c.body,p),d==null&&(f=null);else if(typeof u=="string"&&u.startsWith("==")){let h=hr(u.slice(2)).identifiers,m={};for(let g of h)g!==l&&g!=="_F"&&e.has(g)&&(m[g]=o(g));f=s?s.compile(r,l,u,[...Object.keys(m),"_F"],`return (${u.slice(2)}
58
+ )`)({...m,_F:(g,b)=>r.rootBuilder.binding.gramlot.format(g,b)}):null}else f=a.get(l);return n.set(l,f),f}finally{i.delete(l)}};return{resolve:o}}function Rt(r,e,t=r){let n=new Map([...Object.entries(r.getAttr()),...De(r.getAttr())]);return vm(r,n,t).resolve(e)}var km={dataFormula:["formula","_if","_else","_ask_if","_ask_onCancel"],dataController:["script","_if","_else","_ask_if","_ask_onCancel"],dataRpc:["_ask_if","_ask_onCancel","_if","_else","_onCalling","_onResult","_onError"],dataRemote:["_if","_else"]},La=["_cachedRemote","_if","_else","_onRemote"],Em=["_if","_else","_onRemote"],Hu=/^[A-Za-z]\w*$/;function Gu(r){return typeof r=="string"&&r.startsWith("==")}var rr=class extends Ne{#e=new Set;#t=null;codeAttributes(){let e=[...km[this.nodeTag]??[],...Object.entries(this.parentNode?._getMeta("gramlot_component")?.childParameters??{}).filter(([,n])=>n.inline).map(([n])=>n),...this._getMeta("gramlot_component")?.command?["action","_ask_if"]:[],...typeof this.getAttr("remote")=="string"?Em:[]],t=[];for(let[n,i]of Object.entries(this.getAttr()??{}))typeof i=="string"&&(e.includes(n)||n==="validate_call"||n==="validate__onResult"||n==="validate_onAccept"||n==="validate_onReject"||/^validate_\w+_if$/.test(n)||n.startsWith("connect_on")||n.startsWith("subscribe_")||n.startsWith("selfsubscribe_"))&&t.push([n,i]);for(let n of["ask","_ask"]){let i=this.getAttr(n);if(i&&typeof i=="object")for(let s of["_if","askIf"])typeof i[s]=="string"&&t.push([`${n}.${s}`,i[s]])}for(let[n,i]of De(this.getAttr()))Gu(i)&&t.push([n,i]);return Gu(this.staticValue)&&t.push(["",this.staticValue]),t}activateCode(){let e=new Map;for(let[t,n]of this.codeAttributes()){if(this.pointerType(n))throw new Error(`${this.nodeTag} '${this.label}': '${t}' is inline code and cannot be the pointer '${n}'; inline code is never read from Data`);e.set(t,n)}for(let[t,n]of[...De(this.getAttr()),["datapath",this.getAttr("datapath")]])G(n)?.expression&&e.set(t,n);this.#t=e}activatedCode(e){return this.#t?.get(e)??null}remote(e,t={}){if(typeof e!="string"||!Hu.test(e))throw new TypeError(`${this.nodeTag} '${this.label}': remote name must match ${Hu.source}, not ${JSON.stringify(e)}`);let n=Object.keys(t).find(s=>s.startsWith("_")&&!La.includes(s));if(n)throw new TypeError(`${this.nodeTag} '${this.label}': remote parameter '${n}' is not accepted; the control attributes are ${La.join(", ")}`);let i={remote:e};for(let[s,a]of Object.entries(t))i[La.includes(s)?s:`remote_${s}`]=a;return this.setAttr(i),On(this)}publish(e,t={}){return this.builder.binding.gramlot._subscriptions.publishNode(this,e,t)}pointers(){let e=this.getAttr("datapath"),t=G(e)?at(this,e):new Set,n=super.pointers().filter(([i,s])=>!t.has(i)&&!this.#n(i,s)).map(([i,s])=>[i,G(s)?.pointer??s]);for(let i of t){let s=this.getAttr(i);this.pointerType(s)==="^"&&n.push(["datapath",G(s)?.pointer??s])}return n}runtimeToEvaluate(){let e=super.runtimeToEvaluate();for(let[t,n]of e)if(this.pointerType(n)){if(G(n)){if(typeof t!="string")throw new Error(`${this.nodeTag} '${this.label}': pointer suffixes belong to attributes; use format/mask for node text`);this.absDatapath(n)===null&&e.set(t,new Ht(()=>Rt(this,t)));continue}this.#n(t,n)?e.set(t,n.slice(1)):this.absDatapath(n)===null&&e.set(t,null)}return e}pathAttribute(e){let t=this.getAttr(e);return G(t)?Rt(this,e):this.pointerType(t)&&this.#n(e,t)?t.slice(1):t}getRelativeData(e,t=null,n={}){return this.absDatapath(e)===null?null:super.getRelativeData(e,t,n)}setRelativeData(e,t,n={}){this.#s(e),super.setRelativeData(e,t,n)}PUT(e,t){this.#s(e),this.data.setItem(this.absDatapath(e),t,null,">",!1,!0,this,!1,!1)}FIRE(e,t=!0,n=null){t===null&&(t=!0),this.#s(e);let i=this.absDatapath(e);if(i.includes("?")){this.#r(i,t);return}this.data.getNode(i)?.setValue(null,!1);try{this.fireEvent(e,t,{attributes:n})}finally{this.data.getNode(i)?.setValue(null,!1)}}#r(e,t){let[n,i]=e.split("?",2),s=this.data;s.getNode(n)?.setAttr({[i]:null},!1);try{let a=s.getNode(n);a?a.setValue(a.staticValue,!0,{[i]:t},!0,!0,!0,!0):s.setItem(n,null,{[i]:t},">",!0,!0,!0,!0)}finally{s.getNode(n)?.setAttr({[i]:null},!1)}}FIRE_AFTER(e,t=!0,n=10){this.#s(e);let i=this.rootBuilder?.binding?.bindingFor(this)??null,s=null,a=setTimeout(()=>{s?.(),this.FIRE(e,t)},n);return s=i?.track(()=>clearTimeout(a))??null,()=>{clearTimeout(a),s?.()}}absDatapath(e){e=G(e)?.pointer??e;let t=this.pointerType(e)?e.slice(1):e;if(t.startsWith("#")&&t.includes("?")){let[n,i]=t.split("?",2),s=super.absDatapath(n);return s===null?null:`${s}?${i}`}return super.absDatapath(e)}_composeRelativeDatapath(e,t){let n=this;for(;n!==null&&e.startsWith(".");){let i=n.getAttr("datapath");if(this.pointerType(i)&&(i=this.#i(n,i),i===null))return null;if(i!=null&&(e=e==="."?i:i+e),e.startsWith("#"))return n.parentNode._resolveSymbolicDatapath(e,t);n=n.parentNode}if(e.startsWith("."))throw new Error(`unresolved relative datapath: ${t}`);return e}_finalizeAbsPath(e,t){return e===null?null:super._finalizeAbsPath(e,t)}_resolveSymbolicDatapath(e,t){let n=e.slice(1).split(".",1)[0];if(n==="FORM"||n==="ANCHOR")return super._resolveSymbolicDatapath(e,t);let i=this.rootBuilder?.binding;if(!i)return super._resolveSymbolicDatapath(e,t);let s=i.nodeIds.get(n);if(!s)throw new Error(`#<id>: cannot resolve ${t}`);let a=e.slice(n.length+2);return s.absDatapath(a?`.${a}`:".")}#i(e,t){if(G(t)){let s=Rt(e,"datapath",e.parentNode);return s==null||s===""?null:s}let n=e.parentNode.absDatapath(t);if(n===null)return null;let i=this.data.getItem(n);return i==null||i===""?null:i}#n(e,t){return G(t)||typeof e!="string"||!e.endsWith("_path")?!1:(this.#e.has(e)||(this.#e.add(e),console.warn(`${this.nodeTag} '${this.label}': '${e}' holds a bare Data path; the pointer symbol of '${t}' is removed`)),!0)}#s(e){if(this.absDatapath(e)===null)throw new Error(`${this.nodeTag} '${this.label}': write on a null path: '${e}'`)}},be=class r extends O{get nodeClass(){return rr}authorizedCopy(e){let t=new this.constructor;for(let n of this.getNodes()){let i=n.getAttr("auth")??null;if(i!==null){if(typeof i!="string")throw new TypeError(`${n.nodeTag} '${n.label}': 'auth' must be a string rule, not ${typeof i}`);if(e(i)!==null)continue}let s=n.staticValue;s instanceof r&&(s=s.authorizedCopy(e));let{auth:a,...o}=n.getAttr(),l=t.setItem(n.label,s,o,">",!1,!1,null,!1,!0,null,n.nodeTag);l.xmlTag=n.xmlTag}return t}activateCode(){for(let e of this.getNodes())e.activateCode(),e.staticValue instanceof r&&e.staticValue.activateCode();return this}};if((Ue(be.tytxSuffix).GramlotBuilderBag??be)!==be)throw new Error("TYTX subtype name 'GramlotBuilderBag' is already registered for another class");Wt(be.tytxSuffix,{...Ue(be.tytxSuffix),GramlotBuilderBag:be});function Xu(r){if(r!=null&&(typeof r!="string"||/[{}]/.test(r.replaceAll("{}",""))))throw new RangeError("This formatter mask supports only {} placeholders")}function ts(r,e){return Xu(e),e==null?r:e.replaceAll("{}",()=>r)}function Am(r){if(r instanceof Date){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"}if(ke(r))return"N";if(typeof r=="number")return Number.isInteger(r)?"L":"R";throw new TypeError("Formatting requires finite JavaScript numbers, TYTX Decimal values or valid Date objects")}function xm(r,e,{pattern:t="short",locale:n,timeZone:i}){if(!["short","medium","long","full"].includes(t))throw new RangeError("Temporal formatting currently supports short, medium, long and full only");if(e==="DHZ"&&(typeof i!="string"||!i))throw new TypeError("DHZ formatting currently requires an explicit timeZone");let s={timeZone:e==="DHZ"?i:"UTC"};return e!=="H"&&(s.dateStyle=t),e!=="D"&&(s.timeStyle=t),new Intl.DateTimeFormat(n,s).format(r)}function es(r){let e=/^(-|\()?(#,##0|0+)(?:\.(0*#*))?(\))?$/.exec(r);if(!e||e[1]==="("!=(e[4]===")")||r.endsWith("."))throw new RangeError(`Unsupported numeric pattern section: ${r}`);let t=e[3]??"";return{prefix:e[1]??"",suffix:e[4]??"",intl:{useGrouping:e[2].startsWith("#,##")?"always":!1,minimumIntegerDigits:e[2].replace("#,##","").length,minimumFractionDigits:t.replaceAll("#","").length,maximumFractionDigits:t.length}}}function Tm(r){let e=r.split(";");if(e.length>3)throw new RangeError("Numeric patterns support at most three sections");let t=es(e[0]);if(t.prefix||t.suffix)throw new RangeError("Positive-section affixes are not implemented");let n=e.length===3?e[1]:null;n!==null&&n!==""&&n!=="-"&&es(n);let i=e.length>1?es(e.at(-1)):null;return{positive:t,zero:n,negative:i}}function Yu(r,e={},t={}){if(r===null)return"";if(typeof e=="string"&&(e={pattern:e}),!e||typeof e!="object"||Array.isArray(e))throw new TypeError("Format options must be a pattern string or an options object");for(let g of Object.keys(e))if(!["pattern","locale","mask","dtype","timeZone"].includes(g))throw new RangeError(`Unsupported format option: ${g}`);e={...e,locale:e.locale??t.locale,timeZone:e.timeZone??t.timeZone};let n=e.dtype===void 0?Am(r):e.dtype,i=["D","H","DHZ"].includes(n);if(!i&&!["L","R","N"].includes(n))throw new RangeError(`Unsupported format dtype: ${n}`);if(i){if(!(r instanceof Date)||!Number.isFinite(r.getTime()))throw new TypeError(`${n} requires a valid Date object`)}else if(!(typeof r=="number"&&Number.isFinite(r))&&!(ke(r)&&!["NaN","Infinity","-Infinity"].includes(r.toString())))throw new TypeError(`${n} formatting requires finite JavaScript numbers or TYTX Decimal values`);if(n==="L"&&!Number.isInteger(r))throw new TypeError("L formatting requires an integer");let{pattern:s,locale:a,mask:o}=e;if(!i&&typeof s!="string")throw new TypeError("Numeric formatting currently requires an explicit pattern");if(typeof a!="string"||!a)throw new TypeError("Formatting currently requires an explicit locale");if(!(i?Intl.DateTimeFormat:Intl.NumberFormat).supportedLocalesOf([a]).length)throw new RangeError(`Unsupported format locale: ${a}`);if(Xu(o),i){let g=xm(r,n,e);return ts(g,o)}let{positive:u,zero:c,negative:d}=Tm(s),f=ke(r),p=f?r.eq(0):r===0,h=f?r.lt(0):r<0;if(f&&new Intl.NumberFormat("en",{useGrouping:!1}).format("9007199254740993")!=="9007199254740993")throw new Error("This browser cannot format Decimal without precision loss");let m;if(p&&c!==null){if(c==="")return"";if(c==="-")m="-";else{let g=es(c);m=g.prefix+new Intl.NumberFormat(a,g.intl).format(0)+g.suffix}}else{let g=h&&d?d:u,b=f?(h&&d?r.abs():r).toString():h&&d?-r:r===0?0:r;m=g.prefix+new Intl.NumberFormat(a,u.intl).format(b)+g.suffix}return ts(m,o)}var He="http://www.w3.org/1999/xhtml",$n="http://www.w3.org/2000/svg",Dm=new Set(["default","default_value","live","group","visible","action","fire","ask","_ask","_ask_if","_ask_title","_ask_onCancel","if","else","_init","_onStart","_onBuilt","_delay","_timing","_userChanges","remote","_cachedRemote","_onRemote","onClose"]),Cm=["default_","attr_","fire_","connect_on","subscribe_","selfsubscribe_","formsubscribe_","remote_"],Sm={table:["width","border"],editor:["height"],embed:["width","height"],img:["width","height"],canvas:["width","height"]},Nm=["format","mask","locale","timeZone","places","dtype"],Om=new Set(["href","src","formaction","xlink:href","xlink_href"]);function Mt(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>!(t&&typeof t=="object"&&Object.hasOwn(t,"$gramlotRef"))&&!Dm.has(e)&&!Cm.some(n=>e.startsWith(n))))}function Vr(r,e,t=[]){for(let[n,i]of Object.entries(e)){let s=t.find(o=>n.startsWith(o))??"",a=n.slice(s.length);if(["style","class","_class"].includes(a)&&i!=null&&typeof i!="string")throw new TypeError(`${r.nodeTag} '${r.label}': '${n}' must be a string or null`)}}function zr(r,e,t=[]){if(e.onClose!=null&&!r.parentNode?._getMeta("gramlot_component")?.childParameters?.onClose)throw new Error("onClose is only supported on a tab/stack panel");for(let[n,i]of Object.entries(Wr(Mt(e)))){let s=t.find(o=>n.startsWith(o)),a=s?n.slice(s.length):n;if(/^on./i.test(a))throw new Error(`${r.nodeTag} '${r.label}': '${n}' has the form of a native event handler, run by the browser outside Gramlot; write connect_${a} for an event, or rename the attribute`);if(Om.has(a.toLowerCase())&&Im(i))throw new Error(`${r.nodeTag} '${r.label}': '${n}' holds a javascript: URL, run by the browser as code; write connect_onclick or the action of a button instead`)}}function Im(r){return typeof r=="string"&&/^javascript:/i.test(r.replace(/[\t\n\r]/g,"").replace(/^[\u0000-\u0020]+/,""))}function Zu(r,e,t=[]){if(r.nodeTag!=="iframe")return e;let n=o=>{let l=t.find(u=>o.startsWith(u))??"";return[l,o.slice(l.length).toLowerCase()]},i=Object.fromEntries(De(r.getAttr())),s=[...Object.keys(i),...Object.keys(e)].find(o=>n(o)[1]==="srcdoc");if(s===void 0||Object.keys(i).some(o=>n(o)[1]==="sandbox")||r.pointerType(r.value)===null&&!(Object.hasOwn(i,s)&&(r.pointerType(i[s])!==null||ht(i[s]))))return e;let a=Object.fromEntries(Object.entries(e).filter(([o])=>n(o)[1]!=="sandbox"));return{[`${n(s)[0]}sandbox`]:"",...a}}function Wr(r){return Object.fromEntries(Object.entries(r).filter(([,e])=>e!=null))}function Fn(r){return Object.fromEntries(Object.entries(r).map(([e,t])=>e.startsWith("xmlns_")?[`xmlns:${e.slice(6)}`,t]:e.startsWith("data_")||e.startsWith("aria_")?[e.replaceAll("_","-"),t]:[e,t]))}function rs(r){let{_meta:e,...t}=r;return Fn(Wr(Mt(t)))}function Ju(r,e){let t=Sm[String(r).toLowerCase()]??[],n={},i={};for(let[s,a]of Object.entries(e))t.includes(s)?i[s]=a:n[s]=a;return[n,i]}function qr(r){return String(r)}function Ln(r,e,t=null){let n={...e},{mask:i,format:s,locale:a,timeZone:o,dtype:l,places:u}=n;for(let d of Nm)delete n[d];let c=d=>{if(t&&s!=null){if(u!=null)throw new RangeError("places is not implemented; specify precision in format");return t(d,{pattern:s,mask:i,...a==null?{}:{locale:a},...o==null?{}:{timeZone:o},...l==null?{}:{dtype:l}})}if(typeof d=="boolean"&&(d=qr(d)),i==null)return d;let f=d==null?"":qr(d);return f===""?f:ts(f,i)};return Array.isArray(r)?(Object.hasOwn(n,"_text")&&(n._text=c(n._text)),[r,n]):[c(r),n]}function ht(r){return typeof r=="string"&&r.startsWith("==")}var Bm=new Set(["animate","animateMotion","animateTransform","circle","ellipse","feBlend","feColorMatrix","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feGaussianBlur","feImage","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","image","line","metadata","path","polygon","polyline","rect","set","stop","use"]),Pn=class extends er{constructor(e,t){super(e),this._owner=t}get owner(){return this._owner}_handleMeta(e,t){let n=this.owner.evaluateExpressions(e,t);zr(e,n);let[i,s]=super._handleMeta(e,n);return Vr(e,s),e._getMeta("subbuilder")?[i,Zi(rs(s))]:[i,s]}adaptAttrs(e){let{_meta:t,...n}=e;return Fn(super.adaptAttrs(Wr(Mt(n))))}renderedItem(e,t,n,i={}){if(this.owner.renderType==="object")return this.owner.renderedItem(e,t,n,i);let{_text:s,...a}=n;return t=this.owner.expressionValue(e,t),Array.isArray(t)&&s!=null&&(t=[this._escapeText(qr(s)),...t]),Bm.has(i.tag)?`${i.pretty?" ".repeat(this._nodeDepth(e,i.depthOffset??0)):""}<${i.tag}${this._formatAttrs(a)} />${i.pretty?`
59
+ `:""}`:super.renderedItem(e,t,a,i)}};var nr=class extends Qt{#e=new WeakMap;#t=new WeakMap;get inlineCompiler(){return null}getRender(e){return this.renders.has(e)||(e.evaluatePointerExpression=this.builder.evaluatePointerExpression.bind(this.builder),e instanceof It?this.addRender(e,this):e instanceof Bt&&this.addRender(e,new Pn(e,this))),super.getRender(e)}render(e,t={}){return e._getMeta("data_element")?null:super.render(e,t)}_handleMeta(e,t){let n=this.builder.constructor.dialectPrefixes,i=this.evaluateExpressions(e,t);zr(e,i,n);let[s,a]=super._handleMeta(e,Zu(e,i,n));if(Vr(e,a,n),e.nodeTag==="webcomponent"){s=pt(e.getAttr());let{code:u,...c}=a;a=c}if(e._getMeta("subbuilder")){let u=rs(a);return e._getMeta("subbuilder")==="html"&&(u.xmlns=$n),[s,u]}let[o,l]=Ju(s,a);return Object.keys(l).length&&this.#e.set(e,l),[s,o]}evaluateExpressions(e,t){let n=this.inlineCompiler,i=(a,o)=>n?n.compileExpression(e,a,o)(t):null,s={...t};for(let[a,o]of De(e.getAttr()))ht(o)&&Object.hasOwn(s,a)&&(s[a]=i(a,o));return ht(e.value)&&this.#t.set(e,i("",e.value)),s}expressionValue(e,t){return ht(e.value)?this.#t.get(e)??null:t}restoreNativeAttributes(e,t){let n=this.#e.get(e);return n?(this.#e.delete(e),{...t,...Wr(n)}):t}adaptAttrs(e){let{_meta:t,...n}=e,i=`${this.builder.constructor._name}_`,s=this.builder.constructor.dialectPrefixes,a={},o={};for(let[l,u]of Object.entries(Mt(n))){if(u==null)continue;if(l.startsWith(i))throw new Error(`${l}: the attribute prefix '${i}' is not accepted; use the prefix '${s[0]}'`);let c=s.find(d=>l.startsWith(d));c?a[l.slice(c.length)]=u:o[l]=u}return Fn({...super.adaptAttrs(o),...a})}renderedItem(e,t,n,i={}){let s;[t,s]=Ln(this.expressionValue(e,t),this.restoreNativeAttributes(e,n));let{_text:a,...o}=s;Array.isArray(t)&&a!=null&&(t=[this._escapeText(qr(a)),...t]);let l=e.parentNode?._getMeta("subbuilder")==="html"?{xmlns:He,...o}:o;return super.renderedItem(e,t,l,i)}finalize(e,t=null,n={}){if(!n.doctype)return super.finalize(e,t,n);let i=this._composeStringFragments(e),s=this.builder.source.getNodes().filter(a=>!a._getMeta("data_element"));return s.length===1&&s[0].nodeTag==="html"||(i=`<html>${i}</html>`),super.finalize(`<!doctype html>${i}`,t,n)}};var Ku={document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:"binding",version:null,title:"Gramlot binding",description:"Gramlot Data declarations and the plain HTML button; loaded after the HTML grammar."},abstracts:{},elements:{dataSetter:{doc:"Initial Data value, written literally at destination_path.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination_path",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:!0,default:null},{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:"Computed Data value written at result_path; formula is inline, func is a name.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"result_path",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"formula",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"params",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}},dataController:{doc:"Side effects on Data; script is inline, func is a name.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"script",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"func",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"params",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}},dataRpc:{doc:"Server endpoint called through gramlot.rpc; the value is written at result_path when given.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"method",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"result_path",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"str"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"timeout",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"int"},{kind:"type",module:"builtins",name:"float"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"params",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}},dataRemote:{doc:"Data node resolved by a server endpoint through gramlot.rpc, on first read and again when cacheTime expires.",sub_tags:"",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"destination_path",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"method",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},has_default:!1},{name:"cacheTime",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"union",items:[{kind:"type",module:"builtins",name:"int"},{kind:"type",module:"builtins",name:"float"},{kind:"type",module:"builtins",name:"NoneType"}]},has_default:!0,default:null},{name:"params",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}},html_button:{doc:"Plain native HTML button without Gramlot click mechanisms.",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:{render_tag:"button"}}}};var Qu={document_format:{name:"builder_grammar",version:"1.1"},grammar:{name:"webcomponent",version:null,title:"Gramlot webcomponent",description:"An explicitly loaded autonomous custom element."},abstracts:{},elements:{webcomponent:{doc:"Create the custom-element tag named by literal code.",sub_tags:"*",parent_tags:null,inherits_from:null,ns:null,attributes:{parameters:[{name:"code",kind:"keyword_only",role:"attribute",annotation:{kind:"type",module:"builtins",name:"str"},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:null}}};var $m="data is forbidden: write dataSetter for a Data value or html_data for the HTML5 <data> element",Fm=new Set,Lm=new Set(["serverpath","dbenv","shared_id"]),Pm=["formsubscribe_"],jm={dataSetter:"destination_path",dataFormula:"result_path",dataRpc:"result_path",dataRemote:"destination_path"},Um={dataFormula:"formula",dataController:"script"};function ec(r,e){if(["input","textarea","select","webcomponent"].includes(r)&&G(e.value))return"'value' does not accept pointer suffixes; use an ordinary value pointer";if(r==="html_button"&&Object.keys(e).some(i=>["action","ask","_delay","fire"].includes(i)||i.startsWith("fire_")))return"plain HTML button: use button for action, ask, fire or _delay";if(Object.hasOwn(e,"ask")&&!["button","toggleButton","dropDownButton","menuline"].includes(r))return"'ask' is supported on buttons";if(Object.hasOwn(e,"_ask")&&!["dataController","dataFormula","dataRpc"].includes(r))return"'_ask' requires a controller, formula or RPC";if(["dataSetter","dataRemote"].includes(r)&&Object.keys(e).some(i=>i.startsWith("subscribe_")||i.startsWith("selfsubscribe_")))return"topic subscriptions are supported on controllers, formulas, RPCs and rendered elements";let t=jm[r];if(t&&String(e[t]??"").includes("?"))return`'${t}' does not accept '?attr': '${e[t]}'`;let n=Um[r];return n&&e[n]!=null&&e.func!=null?`'func' and '${n}' cannot be declared on the same node`:n&&e._if!=null&&e.func!=null?"'_if' is inline and cannot be declared with 'func': write the condition in the method":null}function tc(r){return Object.keys(r).find(e=>Lm.has(e)||Pm.some(t=>e.startsWith(t)))}var Ge=class r extends It{static _name="gramlot";static _sourceClass=be;static{this.defineGrammar(Ku)}static{this.defineGrammar(Qu)}static{this.defineGrammar(Qi.toDocument())}static get dialectPrefixes(){let e=[];for(let t=Object.getPrototypeOf(r);t&&t!==Function.prototype;t=Object.getPrototypeOf(t))Object.hasOwn(t,"_name")&&t._name&&e.push(`${t._name}_`);return e}constructor(e=null,{collections:t=[],auth:n=null}={}){super(e),this._binding=null,this._auth=n;for(let i of t)this.loadCollection(i)}get auth(){return this._auth}get binding(){return this._binding}set binding(e){this._binding=e}evaluatePointerExpression(e,t,n,i,s){return this.binding?this.binding.inlineCompiler.compilePointerExpression(e,t,n,i.text)(s):null}nodeById(e){if(!this.binding)return super.nodeById(e);let t=this.binding.nodeIds.get(e);if(!t)throw new Error(`node_id not found: ${e}`);return t.builder.wrapSource(t)}loadCollection(e){return this.loadGrammar(e instanceof tr?e.toDocument():e),this}schemaTag(e){let t=e.toLowerCase(),n=r.dialectPrefixes;if(t.startsWith(`${r._name}_`))throw new Error(`${e}: the tag prefix '${r._name}_' is not accepted; use the prefix '${n[0]}'`);if(Fm.has(t))throw new Error(`${e}: excluded from Gramlot 0.2.0`);let i=this.schemaTagNames[t];if(i)return i;for(let s of n)if(t.startsWith(s)&&this.schemaTagNames[t.slice(s.length)])return t;return null}bagCall(e,t,n,i){return super.bagCall(e,this.#e(t),n,i)}commandOnNode(e,t,n,i){return super.commandOnNode(e,this.#e(t),n,i)}validateNodeValues(e,t,n={}){if(this.schema[e]?._meta?.gramlot_component&&G(n.value))throw new Error("'value' does not accept pointer suffixes");e==="webcomponent"&&pt(n);let i=tc(n);if(i)throw new Error(`${e}: attribute '${i}' is excluded from Gramlot 0.2.0`);let s=ec(e,n);if(s)throw new Error(`${e}: ${s}`);return super.validateNodeValues(e,t,n)}validateNode(e,t={}){if(e._getMeta("gramlot_component")&&G((t.attrs??e.getAttr()).value))throw new Error("'value' does not accept pointer suffixes");e.nodeTag==="webcomponent"&&pt(t.attrs??e.getAttr());let n=tc(t.attrs??e.getAttr());if(n)throw new Error(`${e.nodeTag} '${e.label}': attribute '${n}' is excluded from Gramlot 0.2.0`);let i=ec(e.nodeTag,t.attrs??e.getAttr());if(i)throw new Error(`${e.nodeTag} '${e.label}': ${i}`);return super.validateNode(e,t)}_validateChildren(e,t,n,i){return super._validateChildren(e,t,n.map(s=>s==="html_button"?"button":s),i)}_countsForGrammar(e){return e===this.schema.button||!e?._meta?.gramlot_component&&e!==this.schema.webcomponent&&super._countsForGrammar(e)}setChild(e,t,n,i,s=null){i=Object.fromEntries(Object.entries(i??{}).map(([l,u])=>[l,ge(u)instanceof Ne?this.reference(u):u]));let o=t==="dataSetter"&&i?.value!==null&&typeof i?.value=="object"&&Object.getPrototypeOf(i.value)===Object.prototype?{...i,value:new V(i.value)}:i;return super.setChild(e,t,n,o,s)}#e(e){if(e==="data")throw new Error($m);if(this.schemaTagNames[e.toLowerCase()]===e)return e;let t=r.dialectPrefixes.find(n=>e.startsWith(n));return this.schemaTagNames[e.slice(t.length)]}get renderer_html(){return new nr(this)}create(){this.setup(this.data),this.main(this.root)}computeLogic(){}promoteNodeValue(e,t,n){let i=t!=null?{_text:t}:null;e.setValue(n,!0,i,!0)}reference(e,t="node"){if(e=ge(e),!(e instanceof Ne)||!["node","dom"].includes(t))throw new TypeError("Reference requires an element and node/dom kind");let n=e.getAttr("__ref");return n==null&&(n=Array.from(crypto.getRandomValues(new Uint8Array(16)),i=>i.toString(16).padStart(2,"0")).join(""),e.setAttr({__ref:n})),{$gramlotRef:n,kind:t}}toTytx(){return ce(this.auth===null?this.source:this.source.authorizedCopy(this.auth))}};var qm=new Set(["input","select","textarea"]),Vm=["type","multiple","group"];function rc(r,e){let t=r.getAttr(e);return r.pointerType(t)?r.getRelativeData(t):t}var Ce=class r{static liveWrites=!1;static writesDefault=!0;static preservesUnchangedValue=!1;#e;#t=!1;#r;#i;#n=!1;#s=!1;#a=!1;static for(e,t){let n=r.classFor(t.element,t.attrs);return n?new n(e,t):null}static classFor(e,t){if(e.namespaceURI!==He)return null;if(e.constructor.gramlotComponent)return e.constructor.gramlotComponent.parameters.value?.binding!=="twoWay"?null:e.control.type==="radio"?Va:Pa;if(e.localName==="textarea")return it;if(e.localName==="select")return jn;if(e.localName!=="input")return null;let n=t.type==null?"text":String(t.type).toLowerCase();return Object.hasOwn(nc,n)?nc[n]:it}static shape(e,t){return e?.constructor.gramlotComponent?.parameters.value?.binding==="twoWay"&&e.control.type==="radio"?JSON.stringify([t.group??null]):e?.namespaceURI!==He||!qm.has(e.localName)?null:JSON.stringify(Vm.map(n=>t[n]??null))}constructor(e,t){this.#r=e,this.#i=t}get binding(){return this.#r}get element(){return this.#i.element}get node(){return this.binding.node}get eventElement(){return this.element}get resolved(){return this.#i.resolved}get live(){return!!this.resolved.live}get writeEvent(){return this.constructor.liveWrites&&this.live?"input":"change"}project(e,t){if(this.#s){this.#a=!0;return}this.constructor.preservesUnchangedValue&&this.#t&&this.same(this.#e,e)||(this.#e=e,this.#t=!0,!(this.#n&&this.same(this.read(),e))&&(this.constructor.writesDefault&&!this.node.pointerType(this.node.getAttr("value"))&&this.writeDefault(e),this.write(e)))}read(){return this.element.value}write(e){let t=e==null?"":String(e);this.element.value!==t&&(this.element.value=t)}writeDefault(e){let t=e==null?"":String(e);this.element.localName==="textarea"?this.#i.text.data!==t&&(this.#i.text.data=t):this.element.defaultValue!==t&&(this.element.defaultValue=t)}same(e,t){return Object.is(e,t)}commit(e,t=this.read()){if(this.binding.closed)return;let n=this.node.getAttr("value");if(this.node.pointerType(n)==="^"){this.#n=!0;try{this.node.setRelativeData(n.slice(1),t)}finally{this.#n=!1}}}attach(){for(let e of["input","change","compositionstart","compositionend"])this.eventElement.addEventListener(e,this)}detach(){for(let e of["input","change","compositionstart","compositionend"])this.eventElement.removeEventListener(e,this);this.#a=!1}refresh(){}handleEvent(e){if(!this.binding.closed){if(e.type==="compositionstart"){this.#s=!0;return}if(e.type==="compositionend"){this.#s=!1,this.writeEvent==="input"&&this.commit(e),this.#a&&(this.#a=!1,this.binding.runtime.renderer.project(this.node));return}this.#s||e.isComposing||e.type===this.writeEvent&&this.commit(e)}}},Pa=class extends Ce{static writesDefault=!1;static preservesUnchangedValue=!0;get eventElement(){return this.element.control}attach(){this.element.setPageContext(ic(this)),super.attach()}project(e,t){this.element.shouldProjectControlValue(e)&&super.project(e,t)}same(e,t){return this.element.sameControlValue(e,t)}detach(){this.element.releaseControl(),super.detach()}commit(e){this.binding.closed||this.element.control.disabled||this.element.control.readOnly||sc(this.element,this.element.acceptControlValue(),t=>super.commit(e,t.value))}get writeEvent(){if(this.element.commitOnChange)return"change";let e=this.element.control;return this.live&&(e.localName==="textarea"||["text","password","range","color"].includes(e.type))?"input":"change"}read(){return this.element.readControlValue()}write(e){this.element.writeControlValue(e)}handleEvent(e){if(super.handleEvent(e),!e.composed&&!this.binding.closed&&["input","change"].includes(e.type)){let t=this.element.ownerDocument.defaultView.Event;this.element.dispatchEvent(new t(e.type,{bubbles:!0,composed:!0}))}}},it=class extends Ce{static liveWrites=!0},ja=class extends Ce{static liveWrites=!0;read(){return this.element.value===""?null:Number(this.element.value)}commit(e){this.element.validity.badInput||super.commit(e)}},Ua=class extends Ce{static liveWrites=!0;read(){return Number(this.element.value)}},jn=class extends Ce{static writesDefault=!1;read(){return this.element.multiple?[...this.element.selectedOptions].map(e=>e.value):this.element.selectedIndex===-1?null:this.element.value}write(e){let t=this.element;if(t.multiple){if(e!=null&&!Array.isArray(e))throw new TypeError(`${this.node.nodeTag} '${this.node.label}': a multiple select requires an array`);let n=new Set((e??[]).map(String));for(let i of t.options){let s=n.has(i.value);i.selected!==s&&(i.selected=s)}}else e==null?t.selectedIndex!==-1&&(t.selectedIndex=-1):(t.selectedIndex===-1||t.value!==String(e))&&(t.value=String(e))}same(e,t){return Array.isArray(e)?Array.isArray(t)&&t.length===e.length&&t.every((n,i)=>Object.is(n,e[i])):super.same(e,t)}},ir=class extends Ce{read(){return this.element.value===""?null:this.element.value}},qa=class extends Ce{},ns=class extends Ce{static writesDefault=!1;read(){return this.element.checked}write(e){let t=!!e;this.element.checked!==t&&(this.element.checked=t)}same(e,t){return e===!!t}attach(){let e=this.node;if(e.getAttr("checked")!=null&&e.pointerType(e.getAttr("value"))==="^")throw new TypeError(`${e.nodeTag} '${e.label}': checked and a ^ value are two sources`);super.attach()}},is=class extends ns{#e=null;#t=!1;get groups(){return this.binding.runtime.renderer.radioGroups}attach(){let e=this.node,t=this.resolved.group??null,n=za(e);if(t!=null){if(e.getAttr("name")!=null)throw new TypeError(`${e.nodeTag} '${e.label}': name and group are two names`);this.#r(t,n)}super.attach(),t!=null&&(this.#e=this.groups.join(this,t,n),this.element.setAttribute("name",this.#e))}detach(){this.#e!==null&&(this.groups.leave(this),this.element.removeAttribute("name"),this.#e=null),super.detach()}refresh(){if(this.#e===null)return;let e=this.resolved.group,t=za(this.node);this.groups.nameOf(e,t)!==this.#e&&(this.#r(e,t),this.groups.leave(this),this.#e=this.groups.join(this,e,t),this.element.setAttribute("name",this.#e))}#r(e,t){let n=this.node;if(rc(n,"value")&&this.groups.peersOf(e,t).some(i=>!i.binding.closed&&i.read()))throw new Error(`${n.nodeTag} '${n.label}': several true values in radio group '${e}'`)}project(e,t){let n=!this.#t;this.#t=!0;let i=this.read();super.project(e,t),!n&&!i&&this.read()&&this.turnOffPeers()}commit(e){let t=this.read();super.commit(e),t&&!this.binding.closed&&this.turnOffPeers()}turnOffPeers(){if(this.#e!==null)for(let e of this.groups.peers(this)){if(this.binding.closed)return;e.binding.closed||(e.element.checked&&(e.element.checked=!1),rc(e.node,"value")&&e.commit(null))}}},Va=class extends is{static writesDefault=!1;get host(){return super.element}get element(){return this.host.control}project(e,t){this.host.shouldProjectControlValue(e)&&super.project(e,t)}commit(e){this.binding.closed||this.element.disabled||this.element.readOnly||sc(this.host,this.host.acceptControlValue(),()=>super.commit(e))}read(){return this.host.readControlValue()}write(e){this.host.writeControlValue(e)}attach(){this.host.setPageContext(ic(this)),super.attach(),this.element.addEventListener("keydown",this)}detach(){this.host.releaseControl(),this.element.removeEventListener("keydown",this),super.detach()}handleEvent(e){if(!this.binding.closed){if(e.type==="keydown"){if(this.resolved.group==null||!["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(e.key))return;let t=this.groups.peersOf(this.resolved.group,za(this.node)).filter(a=>!a.binding.closed&&!a.element.disabled),n=t.indexOf(this);if(n<0)return;e.preventDefault();let i=["ArrowLeft","ArrowUp"].includes(e.key)?-1:1,s=t[(n+i+t.length)%t.length];s.element.focus(),s.element.click();return}if(super.handleEvent(e),!e.composed&&!this.binding.closed&&["input","change"].includes(e.type)){let t=this.host.ownerDocument.defaultView.Event;this.host.dispatchEvent(new t(e.type,{bubbles:!0,composed:!0}))}}}},ss=class{#e;#t=new Map;#r=new Map;#i=new WeakMap;#n=0;constructor(e){this.#e=e}join(e,t,n){let i=this.nameOf(t,n);return this.#t.has(i)||this.#t.set(i,new Set),this.#t.get(i).add(e),this.#r.set(e,i),i}leave(e){let t=this.#r.get(e);this.#r.delete(e);let n=this.#t.get(t);n?.delete(e),n?.size===0&&this.#t.delete(t)}peers(e){let t=this.#r.get(e);return[...this.#t.get(t)??[]].filter(n=>n!==e)}peersOf(e,t){return[...this.#t.get(this.nameOf(e,t))??[]]}nameOf(e,t){t!==null&&!this.#i.has(t)&&this.#i.set(t,this.#n++);let n=t===null?"page":`form${this.#i.get(t)}`;return`gramlot-${this.#e.instanceId}-${n}-${e}`}};function za(r){for(let e=r;e;e=e.parentNode){let t=e.getAttr()??{};if(t.formId!=null||t.form===!0)return e}return null}var nc={text:it,password:it,email:it,url:it,tel:it,search:it,number:ja,range:Ua,color:qa,date:ir,time:ir,month:ir,week:ir,"datetime-local":ir,checkbox:ns,radio:is,hidden:null,file:null,button:null,submit:null,reset:null,image:null};function ic(r){let{binding:e,node:t}=r,n=e.runtime.gramlot,i=(s,a,o,l=!1)=>{if(!l&&/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(a)){let{group:u,method:c}=n.src.logicRegistry.resolve(a,t);return c.call(u,t,o)}return e.runtime.inlineCompiler.compile(t,s,a,Object.keys(o),l?`return (${a});`:a)(o)};return{locale:n.locale,timeZone:n.timeZone,createDecimal:$r,isDecimal:ke,getDecimalLibrary:Aa,isActive:()=>!e.closed,callLogic:(s,a)=>{let{group:o,method:l}=n.src.logicRegistry.resolve(s,t);return l.call(o,t,a)},format:(s,a)=>n.format(s,a),invoke:i,remote:(s,a,o)=>n.rpc.call("data",s,a,{signal:o}),validationCurrent:()=>{let s=t.getAttr("value"),a=t.pointerType(s)?t.absDatapath(s):null;return()=>!e.closed&&t.getAttr("value")===s&&(a===null||t.absDatapath(s)===a)},finishValidation:({ok:s,result:a,rules:o})=>{if(e.closed)return;if(s)for(let u of a.datachanges)t.getRelativeData(".").update(u);let l=s?"validate_onAccept":"validate_onReject";if(o[l]){let u=c=>console.error("Validation notification failed:",c);try{let c=Object.fromEntries(Object.entries(o).map(([f,p])=>[f.slice(9),p])),d=i(l,o[l],{value:a.value,result:a,validations:c,userChange:!0});d instanceof Promise&&d.catch(u)}catch(c){u(c)}}},checkDataPatch:s=>{if(!(s instanceof V))throw new TypeError("Validation data changes must be a Bag.");if(!(t.getRelativeData(".")instanceof V))throw new TypeError("Validation data changes require a Bag datapath.")}}}function sc(r,e,t){let n=i=>{i.ok&&i.isCurrent()&&(t(i),r.finishValidation(i))};e instanceof Promise?e.then(n).catch(i=>console.error("Validation notification failed:",i)):n(e)}var Wa=Symbol("source text"),ac={xmlns:"http://www.w3.org/2000/xmlns/",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},zm=new Set(["allowFullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formNoValidate","hidden","inert","isMap","itemscope","loop","multiple","muted","noModule","noValidate","open","playsInline","readOnly","required","reversed","selected"]),Wm=new Set(["checked","muted","selected","value"]),Hm=new Map([["allowfullscreen","allowFullscreen"],["formnovalidate","formNoValidate"],["ismap","isMap"],["nomodule","noModule"],["novalidate","noValidate"],["playsinline","playsInline"],["readonly","readOnly"]]);function Gm(r){let e=r.replace(/-([a-z])/g,(t,n)=>n.toUpperCase());return Hm.get(e.toLowerCase())??e}var as=class{constructor({metadataAttributes:e=[],invokeScript:t=null}={}){this.invokeScript=t,this.metadataAttributes=new Set([...Gt,"_text",...e])}definition(e){let t=e.builder,i={...t.schema[t.schemaTag(e.nodeTag)]._meta,...e.getAttr("_meta")},s=e.nodeTag==="webcomponent"?pt(e.getAttr()):Nn(e.nodeTag,{renderTag:i.render_tag,ns:e.getAttr("ns"),dialectName:t.constructor._name}),a=s==="foreignObject"?$n:i.render_attributes?.xmlns??e.getAttr("xmlns")??(t instanceof Bt?$n:He);return{meta:i,namespace:a,tag:s}}validate(e,t=e.builder){let n=e.value instanceof O,i=n?e.getAttr("_text"):e.value;if(i!=null&&!["string","number","boolean"].includes(typeof i))throw new TypeError("HTML text must be scalar");for(let[o,l]of Object.entries(e.attr))if(!(o==="value"&&this.definition(e).meta.gramlot_component)&&!(this.metadataAttributes.has(o)||["ask","_ask"].includes(o)||l&&typeof l=="object"&&Object.hasOwn(l,"$gramlotRef"))&&l!=null&&!["string","number","boolean"].includes(typeof l))throw new TypeError(`HTML attribute ${o} must be scalar`);let s=Object.fromEntries(Object.entries(e.attr).filter(([o])=>!this.metadataAttributes.has(o))),a=n?e.value.getNodes().map(o=>o.nodeTag).filter(Boolean):[];t.validateNode(e,{value:i,attrs:s,childTags:a})}create(e,t,n=null,i=e.attr,s=null){let{tag:a,namespace:o,meta:l}=this.definition(e);n??=a;let u=o===He?t.createElement(n):t.createElementNS(o,n);if(l.gramlot_component&&u.constructor.gramlotComponent?.tag!==n)throw new Error(`Component collection must be activated before rendering ${n}`);l.gramlot_component?.dataScope&&(u.readDataScope=()=>{if(!e.getAttr("datapath"))throw new Error("Data scope requires an explicit datapath");return e.getRelativeData(".")}),l.gramlot_component?.sourceContext&&u.setSourceContext({publish:(f,p)=>e.publish(f,p),writeParameter:(f,p)=>{let h=e.getAttr(f);e.pointerType(h)==="^"&&!Object.is(e.getRelativeData(h.slice(1)),p)&&e.setRelativeData(h.slice(1),p)}});let c=t.createTextNode(this.text(e));(o!==He||!l.void)&&u.append(c);let d={element:u,text:c,tag:n};return this.update(d,e,i,Wa,s),d}matches(e,t){let{tag:n,namespace:i}=this.definition(t);return(i===He?e.tag.toLowerCase()===n.toLowerCase():e.tag===n)&&e.element.namespaceURI===i}compose(e,t,n){e.text.data=t??"";for(let i of n)e.element.append(i)}update(e,t,n=t.attr,i=Wa,s=null){let{element:a,text:o}=e,l=a.namespaceURI===He,u=this.definition(t).meta.render_attributes??{},c=e.attrs??{},d=g=>(zr(t,g,t.builder.constructor.dialectPrefixes),Vr(t,g,t.builder.constructor.dialectPrefixes),t.builder.renderer_html.adaptAttrs(g)),f=t.parentNode;f?._getMeta("gramlot_component")?.childParameters&&(n=a.ownerDocument.defaultView.customElements.get(f._getMeta("render_tag")).projectChild(a,n,{adapt:d,invoke:(b,y,w)=>this.invokeScript(t,b,y,w),publish:(b,y)=>t.publish(b,y),publishParent:(b,y)=>f.publish(b,y),remove:()=>t.parentBag.popNode(t.label)})),this.definition(t).meta.gramlot_component&&(n=a.projectAttributes(n,d)),n=Object.fromEntries(De({...n,...u}));let p=Ce.classFor(a,n)!==null;i===Wa&&(i=this.text(t));let h=i==null?"":String(i);o.data!==h&&(o.data=h);let m=[...new Set([...Object.keys(c),...Object.keys(n)])];m.sort((g,b)=>(b==="sandbox")-(g==="sandbox"));for(let g of m){if(this.metadataAttributes.has(g)||["ask","_ask"].includes(g)||p&&g==="value")continue;let b=n[g],y=g,w=Gm(y),A=l&&zm.has(w)&&typeof a[w]=="boolean",S=y==="xmlns"?"xmlns":y.includes(":")?y.split(":")[0]:"",B=Object.hasOwn(ac,S)?ac[S]:null;if(Object.is(c[g],b)||(b==null||A&&!b?B?a.removeAttributeNS(B,y.split(":").at(-1)):a.removeAttribute(y):B?a.setAttributeNS(B,y,String(b)):a.setAttribute(y,A?"":String(b))),l&&(A||Wm.has(w))&&w in a){let W=w==="value"?b==null?"":String(b):!!b;a[w]!==W&&(a[w]=W)}}s===!1?a.style.visibility!=="hidden"&&(a.style.visibility="hidden"):e.visible===!1&&(n.style==null?a.removeAttribute("style"):a.setAttribute("style",String(n.style))),e.visible=s,e.attrs=n}text(e){return e.value instanceof O?e.getAttr("_text")==null?"":String(e.attr._text):e.value==null?"":String(e.value)}};var oc=new WeakMap,Xm=new Set(["title","msg","fields","_if","askIf"]),Ym=new Set(["name","lbl","tag","type","default_value","required","min","max","step","placeholder"]),$t=class{static required(e,t,n,i){let s=(a,o)=>typeof o=="boolean"?o:e.runtime.inlineCompiler.compile(e.node,a,o,Object.keys(n),`return (${o});`)(n);if(typeof t=="string"){let a=e.node.getAttr("_ask_if");return!a||!!s("_ask_if",a)}return t?.askIf&&s(`${i}.askIf`,t.askIf),!t?._if||!!s(`${i}._if`,t._if)}static show(e,t,n,i="Parameters"){let s=typeof t=="string"?{msg:t,title:i}:t;if(!s||typeof s!="object"||Array.isArray(s))throw new TypeError("ask requires text or a parameter description");for(let c of Object.keys(s))if(!Xm.has(c))throw new Error(`Unsupported ask option: ${c}`);let a=s.fields??[];if(!Array.isArray(a))throw new TypeError("ask fields must be an array");let o=new Set;for(let c of a){if(!c||!/^[A-Za-z_]\w*$/.test(c.name)||o.has(c.name))throw new Error("ask fields require distinct simple names");o.add(c.name);for(let d of Object.keys(c))if(!Ym.has(d))throw new Error(`Unsupported ask field option: ${d}`);if(c.tag&&!["input","textarea"].includes(c.tag))throw new Error(`Unsupported ask widget: ${c.tag}`);if(c.type&&!["text","number","date","checkbox","email","password","url","tel"].includes(c.type))throw new Error(`Unsupported ask input type: ${c.type}`)}let l=e.runtime.gramlot,u=oc.get(l);if(!u){let c=`ask_${Array.from(crypto.getRandomValues(new Uint8Array(16)),p=>p.toString(16).padStart(2,"0")).join("")}`,d=new Map;class f{confirm(h,m){m.preventDefault(),d.get(h.getAttr("request"))?.finish(!0)}cancel(h,m){m.preventDefault(),d.get(h.getAttr("request"))?.finish(!1)}}l.src.logicRegistry.register(f,{group:c,resource:"gramlot:ask"}),u={group:c,requests:d},oc.set(l,u)}return new Promise((c,d)=>{let f=`ask_${Array.from(crypto.getRandomValues(new Uint8Array(16)),g=>g.toString(16).padStart(2,"0")).join("")}`,p=!1,h=()=>{},m=(g,b=null)=>{if(p)return;p=!0;let y=g?Object.fromEntries(a.map(w=>[w.name,l.data.getItem(`${f}.${w.name}`)])):null;u.requests.delete(f),h();try{l.src.source.popNode(f),l.data.getNode(f)&&l.data.popNode(f),b?d(b):c(y)}catch(w){d(w)}};u.requests.set(f,{finish:m}),h=e.track(()=>m(!1));try{let g=new Ge,b=g.root.dialog({node_id:f,datapath:f,request:f,connect_oncancel:`${u.group}.cancel`,connect_onclose:`${u.group}.cancel`,class:"gramlot-ask","aria-labelledby":`${f}_title`,style:"border:1px solid #aab4c2;border-radius:8px;padding:16px;max-width:32rem;width:calc(100% - 48px);font:inherit;"});b.h2(s.title??i,{id:`${f}_title`,style:"font-size:1.1em;margin:0 0 12px;"}),s.msg&&b.p(s.msg);let y=b.form({request:f,connect_onsubmit:`${u.group}.confirm`});for(let S of a){y.dataSetter({destination_path:`.${S.name}`,value:Object.hasOwn(n,S.name)?n[S.name]:S.default_value??(S.type==="checkbox"?!1:"")});let B=y.div({style:"margin:8px 0;"});B.html_label(S.lbl??S.name,{for:`${f}_${S.name}`,style:"display:block;margin-bottom:4px;"});let W={id:`${f}_${S.name}`,value:`^.${S.name}`,live:!0};for(let re of["required","min","max","step","placeholder"])S[re]!==void 0&&(W[re]=S[re]);S.tag==="textarea"?B.textarea(W):B.input({...W,type:S.type??"text"})}let w=y.div({style:"display:flex;justify-content:flex-end;gap:8px;margin-top:16px;"});w.html_button("Cancel",{type:"button",request:f,connect_onclick:`${u.group}.cancel`}),w.html_button("Confirm",{type:"submit",autofocus:a.length===0}),l.src.source.setItem(f,l.src.prepareSource(g.source));let A=l.src.binding.nodeIds.get(f);l.dom.getDomNode(A).showModal()}catch(g){m(!1,g)}})}};var os=class r{#e;#t;#r=null;#i=0;static for(e,t){return t.element?.constructor.gramlotComponent?.command?new r(e,t):null}constructor(e,t){this.#e=e,this.#t=t}get binding(){return this.#e}get node(){return this.binding.node}get element(){return this.#t.element}get controllers(){let e=this.node.value;return e?.getNodes?e.getNodes().filter(t=>t.nodeTag==="dataController"||t.nodeTag==="dataRpc"):[]}get mechanism(){let e=this.node,t=this.controllers;if(t.length>1)throw new Error(`${e.nodeTag} '${e.label}': several dataController or dataRpc children; a button has one click mechanism`);let n=e.getAttr()??{},i=[];if(t.length&&i.push("controller"),n.action!=null&&i.push("action"),lc(n).length&&i.push("fire"),i.length>1)throw new Error(`${e.nodeTag} '${e.label}': ${i.join(" and ")} together; a button has one click mechanism`);return i[0]??null}attach(){this.refresh(),this.element.activateCommand=e=>this.onClick(e),this.element.attachCommand(),this.element.addEventListener("click",this)}refresh(){this.mechanism&&this.node.getAttr("type")==null&&this.element.getAttribute("type")!=="button"&&this.element.setAttribute("type","button")}detach(){this.element.removeEventListener("click",this),this.element.releaseCommand(),delete this.element.activateCommand,this.#r?.()}handleEvent(e){this.onClick(e)}onClick(e){if(this.binding.closed||this.element.disabled)return;let t=this.element.commandTarget(e);if(t===null)return;if(t!==this.element)return e.stopPropagation(),t.activateCommand(e);if(!this.element.prepareCommand(e)||!this.mechanism||(e.stopPropagation(),this.element.disabled))return;let i=this.binding.countClick(),s=this.node;for(;s&&s.getAttr("_delay")==null;)s=s.parentNode;let a=s?s.builder.runtimeValues(s)[1]._delay:0;if(a>0){let o=this.#i+1;this.#r?.(),this.#i=o;let l=setTimeout(()=>{u(),this.#r=null,this.#i=0,this.#n(e,o)},a),u=this.binding.track(()=>this.#r?.());this.#r=()=>{clearTimeout(l),u(),this.#r=null,this.#i=0};return}return this.#r?.(),this.#n(e,i)}#n(e,t){if(this.binding.closed||this.element.disabled)return;let n=this.mechanism;if(!n)return;let i=this.node,s=Zm(e);if(n==="controller")this.binding.runtime.bindingFor(this.controllers[0])?.providers[0]?.invoke({kind:"click",event:e,counter:t});else if(n==="action"){let a=()=>{let[,u]=i.builder.runtimeValues(i),c=Object.fromEntries(Object.entries(u).filter(([d])=>d!=="ask"));return{...this.binding.runtime.renderer.references.resolveArguments(c),event:e,_counter:t,modifiers:s}},o=u=>{if(this.binding.closed||this.element.disabled||u===null)return;let c={...a(),...u};u&&(c._askResult=u),this.binding.runtime.inlineCompiler.compile(i,"action",i.getAttr("action"),Object.keys(c))(c)},l=i.getAttr("ask");if(l&&$t.required(this.binding,l,a(),"ask"))return $t.show(this.binding,l,a()).then(o);o(void 0)}else{let a={modifier:s,_counter:t},o=i.getAttr("fire");if(o!=null){i.FIRE(o,s||!0,a);return}for(let[l,u]of lc(i.getAttr())){if(this.binding.closed)return;i.FIRE(u,l.slice(5),a)}}}};function lc(r){return Object.entries(r??{}).filter(([e,t])=>t!=null&&(e==="fire"||e.startsWith("fire_")))}function Zm(r){return["shift","ctrl","alt","meta"].filter(e=>r[`${e}Key`]).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}var ls="connect_on",Jm=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/,Un=class{#e;#t;#r;#i;#n;static declared(e){return Object.entries(e.getAttr()??{}).filter(([t,n])=>t.startsWith(ls)&&t.length>ls.length&&n!=null).map(([t,n])=>[t,t.slice(ls.length).toLowerCase(),n])}constructor(e,t,n,i,s=`${ls}${n}`){this.#e=e,this.#t=t,this.#r=n,this.#i=i,this.#n=s}get binding(){return this.#e}get node(){return this.binding.node}get element(){return this.#t.element}get eventName(){return this.#r}get handler(){return this.#i}get attribute(){return this.#n}attach(){this.element.addEventListener(this.eventName,this)}detach(){this.element.removeEventListener(this.eventName,this)}handleEvent(e){if(this.binding.closed)return;let t=this.node,n=this.binding.runtime;if(Jm.test(this.handler)){let{group:i,method:s}=n.logicRegistry.resolve(this.handler,t);s.call(i,t,e);return}n.inlineCompiler.compile(t,this.attribute,this.handler,["event"])({event:e})}};function Vn(r,e=new Set){if(!r||typeof r!="object")return;let t=r.ownerDocument?.defaultView?.Node??r.defaultView?.Node;if(ge(r)instanceof Ne||t&&r instanceof t)throw new TypeError("Live Source/DOM references cannot cross a transport boundary");if(e.has(r))throw new TypeError("Transport data cannot contain circular references");e.add(r);let n=r instanceof V?r.getNodes().flatMap(i=>[i.staticValue,i.getAttr()]):Object.values(r);for(let i of n)Vn(i,e);e.delete(r)}var qn=class{constructor(e=null){this.entries=new Map,this.sourceRoot=e}validate(e,t=new Set){let n=new Map,i=s=>{for(let a of s.getNodes()){let o=a.getAttr("__ref");if(o){if(n.has(o))throw new Error("Duplicate Source reference");let l=this.entries.get(o);if(e!==this.sourceRoot&&l&&l.node!==a&&!t.has(l.node))throw new Error("Duplicate Source reference");n.set(o,a)}a.value instanceof O&&i(a.value)}};i(e)}register(e,t){let n=e.getAttr("__ref");if(n){if(this.entries.has(n))throw new Error(`Duplicate Source reference: ${n}`);this.entries.set(n,{node:e,dom:t})}}remove(e){for(let[t,n]of this.entries)n.node===e&&this.entries.delete(t)}resolveArguments(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n&&typeof n=="object"&&Object.hasOwn(n,"$gramlotRef")?this.resolve(n):n]))}resolve(e){if(!e||!["node","dom"].includes(e.kind))throw new TypeError("Expected a node or DOM reference");let t=this.entries.get(e.$gramlotRef);if(!t)throw new Error("Source reference is not mounted");return t[e.kind]}};var Km="_root_",us=class{constructor(e=null,t=null){this.parent=e,this.segment=t,this.children=new Map,this.registrations=new Set}},Ha=class{#e;#t;#r;#i;#n;#s=!0;constructor(e,{path:t,attr:n,recipient:i,order:s}){this.#e=e,this.#t=t,this.#r=n,this.#i=i,this.#n=s}get router(){return this.#e}get path(){return this.#t}get attr(){return this.#r}get recipient(){return this.#i}get active(){return this.#s}get order(){return this.#n}close(){this.active&&(this.#s=!1,this.router.unregister(this))}},Ga=class{constructor({evt:e,node:t,path:n,oldvalue:i,attrsDiff:s,reason:a,fired:o,level:l,registration:u}){this.evt=e,this.node=t,this.path=n,this.oldvalue=i,this.attrsDiff=s,this.reason=a,this.fired=o,this.level=l,this.registration=u}},cs=class{#e;#t=new us;#r=new Map;#i=0;#n=0;constructor(e){this.#e=e}get runtime(){return this.#e}get size(){return this.#i}register({path:e,attr:t=null,recipient:n}){if(typeof e!="string"||e==="")throw new TypeError(`A Data registration requires a path: ${e}`);let i=this.#t;for(let a of e.split(".")){let o=i.children.get(a);o||(o=new us(i,a),i.children.set(a,o)),i=o}this.#n+=1;let s=new Ha(this,{path:e,attr:t,recipient:n,order:this.#n});return i.registrations.add(s),this.#r.set(s,i),this.#i+=1,s}unregister(e){let t=this.#r.get(e);if(t)for(this.#r.delete(e),t.registrations.delete(e),this.#i-=1;t.parent&&!t.children.size&&!t.registrations.size;)t.parent.children.delete(t.segment),t=t.parent}deliver(e){let{pathlist:t}=e;if(!t?.length||t[0]!==Km||e.reason==="autocreate")return;let n=t.slice(1),i=e.evt==="ins"||e.evt==="del";for(let s of Array.isArray(e.node)?e.node:[e.node]){let a=i?[...n,s.label]:n,o=a.join(".");for(let[l,u]of this.#s(a,e))l.active&&l.recipient.receive(new Ga({evt:e.evt,node:s,path:o,oldvalue:e.oldvalue??null,attrsDiff:e.attrs_diff??null,reason:e.reason??null,fired:e.fired??!1,level:u,registration:l}))}}#s(e,t){let n=[],i=this.#t;for(let a of e){for(let o of i.registrations)i!==this.#t&&this.#a(o,"child",t)&&n.push([o,"child"]);if(i=i.children.get(a),!i)return n.sort(([o],[l])=>o.order-l.order)}for(let a of i.registrations)this.#a(a,"node",t)&&n.push([a,"node"]);let s=[...i.children.values()];for(;s.length;){let a=s.pop();for(let o of a.registrations)this.#a(o,"container",t)&&n.push([o,"container"]);s.push(...a.children.values())}return n.sort(([a],[o])=>a.order-o.order)}#a(e,t,n){let{evt:i}=n;return e.attr===null?i==="upd_attrs"?!1:!(t==="child"&&n.fired):t==="child"?!1:t==="container"?i!=="upd_attrs":i==="ins"||i==="del"?!0:Object.hasOwn(n.attrs_diff??{},e.attr)}};var ds=class{#e;constructor(e){this.#e=e}get runtime(){return this.#e}install(e){let t=zn(e),n=this.setterNodes(e);Ya(e);for(let i of n){let s=this.runtime.openBinding(i);s.hasStamp("installed")||(this.applySetter(i),s.stamp("installed"))}this.applyDefaults(t.filter(i=>i.nodeTag&&!i._getMeta("data_element")))}setterNodes(e){return zn(e).filter(t=>t.nodeTag==="dataSetter")}applySetter(e){let t=e.absDatapath(e.pathAttribute("destination_path"));if(t===null)return;let n=e.getAttr("value")??null,i=eg(e.getAttr()),s=this.runtime.data;if(n!==null)s.setItem(t,n,i,">",!1,!0,e),n instanceof V&&e.setAttr({value:null},!1);else{let a=s.getNode(t);a?i&&a.setAttr(i,!0):s.setItem(t,null,i,">",!1,!0,e)}}applyDefaults(e){for(let t of e){let n=t.getAttr();for(let[i,s]of Object.entries(n)){if(!Qm(t,i,s))continue;let a=i==="value"?n.default_value??n.default:n[`default_${i}`];a!=null&&this.#t(t,s,a)}this.#r(t,n)}}#t(e,t,n){let i=e.absDatapath(t);if(i===null)return;let[s,a=null]=i.split("?",2),o=this.runtime.data,l=o.getNode(s);if(a===null){if(l&&l.value!==null&&l.value!==void 0)return;o.setItem(s,n,null,">",!1,!0,e)}else if(l){let u=l.getAttr(a);u==null&&l.setAttr({[a]:n},!0)}else o.setItem(s,null,{[a]:n},">",!1,!0,e)}#r(e,t){let n={};for(let[a,o]of Object.entries(t))a.startsWith("attr_")&&(n[a.slice(5)]=G(o)?Rt(e,a):e.pointerType(o)?e.getRelativeData(o):o);if(!Object.keys(n).length)return;let i=[t.value,t.src].find(a=>e.pointerType(a));if(!i)return;let s=e.absDatapath(i);s!==null&&this.runtime.data.getNode(s.split("?",1)[0])?.setAttr(n,!0,!0,!1)}};function Qm(r,e,t){return e==="_meta"||Gt.has(e)||e==="default"||e.startsWith("default_")||e.startsWith("attr_")||e.endsWith("_path")?!1:r.pointerType(t)!==null}function eg(r){let e={};for(let[t,n]of Object.entries(Mt(r??{})))Gt.has(t)||t.startsWith("_")||t==="destination_path"||t==="value"||n!=null&&(e[t]=n);return Object.keys(e).length?e:null}function tg(r){let e=r.builder;if(!(e instanceof Ge))throw new Error(`dataSetter '${r.label}': dataSetter is not supported inside ${e.constructor._name}`)}function Ya(r){for(let e of zn(r))e.nodeTag==="dataSetter"&&tg(e),sg(e)}var rg=["_init","_onStart","_onBuilt","_delay","_timing","_userChanges"],ng=new Set(["dataFormula","dataController","dataRpc","dataRemote"]),ig=["_onCalling","_onResult","_onError"],Xa=["_init","_onBuilt","_onStart"];function sg(r){let e=i=>r.getAttr(i)!==null&&r.getAttr(i)!==void 0;if(r.nodeTag!=="dataRpc"){let i=ig.find(e);if(i)throw new Error(`${r.nodeTag??"fragment"} '${r.label}': '${i}' is allowed only on dataRpc`)}if(ng.has(r.nodeTag)){let i=Object.entries(r.getAttr()).find(([,a])=>ht(a));if(i)throw new Error(`${r.nodeTag} '${r.label}': '${i[0]}' is a == expression, not accepted on ${r.nodeTag}`);let s=r.nodeTag==="dataRemote"?Xa.find(e):null;if(s)throw new Error(`dataRemote '${r.label}': '${s}' is not accepted on dataRemote, its resolver loads when the Data is read`);for(let a of Xa){let o=r.getAttr(a);if(!(o==null||typeof o=="boolean"||typeof o=="number"))throw new Error(`${r.nodeTag} '${r.label}': '${a}' accepts true, false, null or a number, not ${JSON.stringify(o)}`)}return}let t=rg.find(i=>e(i)&&!(i==="_delay"&&!r._getMeta("data_element")&&r.nodeTag!=="html_button"));if(!t)return;let n=Xa.includes(t)?"dataFormula, dataController and dataRpc":"dataFormula, dataController, dataRpc and dataRemote";throw new Error(`${r.nodeTag??"fragment"} '${r.label}': '${t}' is allowed only on ${n}`)}function zn(r){if(r instanceof O)return r.getNodes().flatMap(t=>zn(t));let e=[r];return r.value instanceof O&&e.push(...zn(r.value)),e}var fs=class extends te{static classKwargs={...te.classKwargs,asBag:!1};static internalParams=new Set([...te.internalParams,"gramlot","method","params","onError"]);constructor({gramlot:e,method:t,params:n,cacheTime:i,onError:s}){super({cacheTime:i??-1}),this.gramlot=e,this.method=t,this.params=n,this.onError=s,this.controller=null,this.loading=null,this.loaded=!1,this.writing=!1}resolve({static:e=!1}={}){return!e&&!this.loading&&!this.writing&&this.expired&&this.refresh(),this.cachedValue}refresh(){let e=()=>{this.loading===i&&(this.controller=null,this.loading=null)},t=this.load(),{signal:n}=this.controller,i=t.then(s=>{if(e(),n.aborted)throw n.reason;this._lastUpdate=Date.now(),this.loaded=!0,this.writing=!0;try{this._node?this._node.setValue(s,this.cacheTime!==0):this.cachedValue=s}finally{this.writing=!1}return s},s=>{throw e(),s});return this.loading=i,i.catch(s=>{s?.name!=="AbortError"&&this.onError(s)}),i}load(){let e=new AbortController,t=new Promise((i,s)=>{e.signal.addEventListener("abort",()=>s(e.signal.reason),{once:!0})}),n=this.gramlot.rpc.call("data",this.method,this.params,{signal:e.signal});return this.controller=e,Promise.race([n,t])}abort(){this.controller?.abort()}};var ag=new Set(["destination_path","result_path","func","formula","script","if","else","_init","_onStart","_onBuilt","_delay","_timing","_userChanges","_ask","_ask_if","_ask_title","_ask_onCancel","method","timeout","_onCalling","_onResult","_onError","cacheTime"]),Hr=class{#e;#t=[];#r=new Set;#i=null;#n=null;#s=null;#a=null;#o=!1;constructor(e){this.#e=e,e.track(()=>{this.cancel(),this.#m(),this.#d()})}get binding(){return this.#e}get node(){return this.binding.node}get kind(){throw new Error("Provider.kind is defined by FormulaProvider, ControllerProvider, RpcProvider and RemoteProvider")}register(){let e=this.node,t=e.getAttr("_onStart");if(typeof t=="number"&&!(Number.isFinite(t)&&t>=0))throw new Error(`${e.nodeTag} '${e.label}': _onStart must be true or a delay in ms not below 0: ${t}`);this.#m();let n=this.binding.runtime.router,i=at(e,e.getAttr("_timing"));for(let[a,o]of e.pointers()){if(a==="datapath")continue;let l=e.absDatapath(o);if(l===null)continue;let[u,c=null]=l.split("?",2),d=n.register({path:u,attr:c,recipient:this});this.#t.push(d),(a==="_timing"||i.has(a))&&this.#r.add(d)}let s=this.binding.runtime.gramlot._subscriptions;for(let a of Object.keys(e.getAttr())){let o=a.startsWith("selfsubscribe_")?"selfsubscribe_":a.startsWith("subscribe_")?"subscribe_":null;if(!o)continue;let l=o==="selfsubscribe_"?s.topicFor(e,a.slice(o.length)):a.slice(o.length),u=s.subscribe(l,c=>{let d={kind:"subscription",topic:l,payload:c};if(this.#l("_userChanges")&&l!=="node")return;let f=this.#l("_delay");f>0?this.#f(d,f):this.invoke(d)});this.#t.push({close:()=>s.unsubscribe(u)})}this.#c(),this.kind==="remote"&&this.invoke({kind:"install",change:null})}receive(e){if(this.#r.has(e.registration)){this.#c();return}if(this.#l("_userChanges")&&e.level!=="node")return;let t={kind:"data",change:e},n=this.#l("_delay");n>0?this.#f(t,n):this.invoke(t)}invoke(e){if(this.binding.closed)return;let t=this.node,n=this.kind==="formula",i=this.kind==="rpc",s=this.kind==="remote",a=this.readArguments(e);e.askResult&&(Object.assign(a,e.askResult),a._askResult=e.askResult);let o=t.getAttr("_ask");if(o&&!e.askDone&&$t.required(this.binding,o,a,"_ask"))return $t.show(this.binding,o,a,t.getAttr("_ask_title")??"Warning").then(p=>{if(!this.binding.closed){if(p===null){let h=t.getAttr("_ask_onCancel");h&&this.#u("_ask_onCancel",h,h,a,!0);return}return this.invoke({...e,askDone:!0,askResult:p})}});let[l,u]=[n?"formula":"script",t.getAttr(n?"formula":"script")],c=t.getAttr("_if");if(c&&!this.#u("_if",c,`return (${c})`,a,!1)){if(s&&this.#d(),[l,u]=["_else",t.getAttr("_else")],!u)return;if(i||s){this.#u(l,u,u,a,!0);return}}if(i)return this.#p(a);if(s)return this.#h(a);let d=t.getAttr("func"),f;if(u)f=this.#u(l,u,n?`return ${u}`:u,a,!0);else if(d==null){if(!n)return;f=new V(ps(a))}else{let{group:p,method:h}=this.binding.runtime.logicRegistry.resolve(d,t);f=n?h.call(p,a):h.call(p,t,a)}n&&t.setRelativeData(t.pathAttribute("result_path"),f)}readArguments(e){let t=this.node,[,n]=t.builder.runtimeValues(t),i=Object.fromEntries(Object.entries(n).filter(([l])=>!ag.has(l)&&!l.startsWith("subscribe_")&&!l.startsWith("selfsubscribe_"))),s={...e.kind==="subscription"?e.payload:{},...this.binding.runtime.renderer.references.resolveArguments(i)};e.kind==="subscription"&&(s._subscription_kwargs=e.payload);let a=e.change??null,o=a?a.level:e.kind==="subscription"?e.topic:e.kind;return s._node=a?a.node:null,s._triggerpars={kw:a,trigger_reason:o},s._reason=o,e.kind==="click"&&Object.assign(s,og(e)),s}cancel(){this.#n?.(),this.#i?.()}#c(){this.#i?.();let e=this.#l("_timing");if(!(e>0))return;let t=setInterval(()=>this.invoke({kind:"timing",change:null}),e*1e3),n=this.binding.track(()=>clearInterval(t));this.#i=()=>{clearInterval(t),n(),this.#i=null}}#f(e,t){this.#n?.();let n=null,i=setTimeout(()=>{n(),this.#n=null,this.invoke(e)},t);n=this.binding.track(()=>clearTimeout(i)),this.#n=()=>{clearTimeout(i),n(),this.#n=null}}#l(e){let t=this.node,n=t.getAttr(e);return G(n)?Rt(t,e):t.pointerType(n)?t.getRelativeData(n):n??null}#u(e,t,n,i,s){let a=[...s?["_kwargs"]:[],...uc,...cc,...Object.keys(ps(i))];return this.binding.runtime.inlineCompiler.compile(this.node,e,t,a,n)({...i,_kwargs:i})}async#p(e){let t=this.node,[n,i,s]=["_onCalling","_onResult","_onError"].map(h=>t.getAttr(h));n&&this.#u("_onCalling",n,n,e,!0),this.#s?.abort();let a=new AbortController;this.#s=a;let o=this.binding.track(()=>a.abort()),l=this.#l("timeout"),u=l>0?setTimeout(()=>{let h=new Error(`${t.nodeTag} '${t.label}': no answer within ${l} ms`);h.name="TimeoutError",a.abort(h)},l):null,c=new Promise((h,m)=>{a.signal.addEventListener("abort",()=>m(a.signal.reason),{once:!0})}),d;try{let h=this.binding.runtime.gramlot.rpc.call("data",this.#l("method"),ps(e),{signal:a.signal});d={result:await Promise.race([h,c])}}catch(h){d={error:h}}clearTimeout(u),o();let f=this.#s===a&&!this.binding.closed;if(this.#s===a&&(this.#s=null),!f)return;if("error"in d){if(!s)throw d.error;this.#u("_onError",s,s,{...e,error:d.error},!0);return}let{result:p}=d;t.getAttr("result_path")!=null&&t.setRelativeData(t.pathAttribute("result_path"),p),i&&this.#u("_onResult",i,i,{...e,result:p},!0)}#h(e){this.#d();let t=this.#o;this.#o=!1;let n=this.node,i=n.absDatapath(n.pathAttribute("destination_path"));if(i===null)return;let s=new fs({gramlot:this.binding.runtime.gramlot,method:this.#l("method"),params:ps(e),cacheTime:this.#l("cacheTime"),onError:a=>{throw new Error(`${n.nodeTag} '${n.label}': dataRemote '${s.method}' failed: ${a.message}`,{cause:a})}});this.binding.runtime.data.setResolver(i,s),this.#a={path:i,resolver:s},t&&s.refresh()}#d(){if(!this.#a)return;let{path:e,resolver:t}=this.#a;this.#a=null,this.#o=t.loaded||t.loading!==null,t.abort();let n=this.binding.runtime.data.getNode(e);n?.resolver===t&&(n.resolver=null)}#m(){for(let e of this.#t.splice(0))e.close();this.#r.clear()}},hs=class extends Hr{get kind(){return"formula"}},ms=class extends Hr{get kind(){return"controller"}},gs=class extends Hr{get kind(){return"rpc"}},bs=class extends Hr{get kind(){return"remote"}},uc=["_node","_triggerpars","_reason","_subscription_kwargs","_askResult"],cc=["_evt","button_counter","button_shift","button_ctrl","button_alt","button_meta"];function ps(r){let e={...r};for(let t of[...uc,...cc])delete e[t];return e}function og({event:r,counter:e}){return{_evt:r,button_counter:e,button_shift:!!r.shiftKey,button_ctrl:!!r.ctrlKey,button_alt:!!r.altKey,button_meta:!!r.metaKey}}var lg=[[null,/(\W|^)GET (?:\s*)(\^?[\w.#@$?-]+)/g,"$1this.GET('$2')"],[/;SET/g,/(\W|^)SET (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)=(?:\s*)([^;\r\n]*)(;?)/gm,"$1this.SET('$2', $3)$4 "],[/;PUT/g,/(\W|^)PUT (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)=(?:\s*)([^;\r\n]*)(;?)/gm,"$1this.PUT('$2', $3)$4 "],[/;FIRE_AFTER/g,/(\W|^)FIRE_AFTER (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)=(?:\s*)([^;\r\n]*)(;?)/g,"$1this.FIRE_AFTER('$2', $3)$4 "],[/;FIRE_AFTER/g,/(\W|^)FIRE_AFTER (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)(;?)/g,"$1this.FIRE_AFTER('$2')$3 "],[/;FIRE/g,/(\W|^)FIRE (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)=(?:\s*)([^;\r\n]*)(;?)/g,"$1this.FIRE('$2', $3)$4 "],[/;FIRE/g,/(\W|^)FIRE (?:\s*)(\^?[\w.#@$?-]+)(?:\s*)(;?)/g,"$1this.FIRE('$2')$3 "]],ug=/(\W|^)PUBLISH (?:\s*)(\^?[\w.#@$?-]+)/,cg=new Set(["arguments","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","eval","export","extends","false","finally","for","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","return","static","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"]),_s=class{#e;#t=new Map;constructor(e){this.#e=e}get runtime(){return this.#e}get size(){return[...this.#t.values()].reduce((e,t)=>e+t.size,0)}preprocess(e,t,n){let i=n.trim();if(ug.test(i))throw new Error(`${Wn(e,t)}: the PUBLISH macro is excluded from Gramlot 0.2.0`);let s=i.replace(/\$(\d+)/g,(a,o)=>`arguments[${parseInt(o,10)-1}]`);for(let[a,o,l]of lg)a&&(s=s.replace(a,`; ${a.source.slice(1)}`)),s=s.replace(o,l);return s!==i&&console.warn(`${Wn(e,t)}: legacy macros are deprecated; write this.GET(path), this.SET(path, value), this.PUT(path, value), this.FIRE(path, value), this.FIRE_AFTER(path, value) and arguments[n] in place of GET, SET, PUT, FIRE, FIRE_AFTER and $n`),s}compile(e,t,n,i,s=n){if(e.activatedCode(t)!==n)throw new Error(`${Wn(e,t)}: inline code runs only as received with the Source (main or a remote Source); a text written later is not run: use named logic`);let a=this.#t.get(e);a||(a=new Map,this.#t.set(e,a),this.runtime.bindingFor(e).track(()=>this.release(e)));let o=a.get(t);o?.source!==s&&(o={source:s,text:this.preprocess(e,t,s),key:null,run:null},a.set(t,o));let l=i.filter(dg),u=l.join(",");if(o.key!==u){let c=fg(e,t,o.text,l);o.key=u,o.run=d=>c.apply(e,l.map(f=>d[f]))}return o.run}compileExpression(e,t,n){let i=n.slice(2),s=De(e.getAttr()).filter(([,o])=>!ht(o)),a=this.compile(e,t,n,[...s.map(([o])=>o).filter(o=>o!=="_F"),"_F"],`return ${i}`);return o=>{let l={};for(let[u,c]of s)Object.hasOwn(o,u)?l[u]=o[u]:l[u]=e.pointerType(c)?e.getRelativeData(c):c;return a({...l,_F:(u,c)=>this.runtime.gramlot.format(u,c)})}}compilePointerExpression(e,t,n,i){let s=this.compile(e,t,n,["_pointerValues","_F"],`return (${i}
60
+ )`);return a=>s({_pointerValues:a,_F:(o,l)=>this.runtime.gramlot.format(o,l)})}release(e,t=null){if(t===null){this.#t.delete(e);return}let n=this.#t.get(e);if(n)for(let i of t){n.delete(i);for(let[s]of De({[i]:null}))n.delete(s)}}};function dg(r){return/^[A-Za-z_$][\w$]*$/.test(r)&&!cg.has(r)}function Wn(r,e){return`${r.nodeTag} '${r.label}' ${e?`'${e}'`:"node value"}`}function fg(r,e,t,n){try{return t.startsWith("function")?new Function(`return (${t}
61
61
  )`)():new Function(...n,`${t}
62
- `)}catch(i){throw i instanceof EvalError?new EvalError(`${Vn(r,e)}: inline code blocked by the Content Security Policy of the page (no 'unsafe-eval'); move the code to named logic (a method of the page's class Logic) or serve the page with the permissive CSP profile, which allows 'unsafe-eval'`,{cause:i}):new SyntaxError(`${Vn(r,e)}: ${i.message} in the inline code:
63
- ${t}`,{cause:i})}}var ms=class{#e;#t=null;#r=null;constructor(e){this.#e=e}get binding(){return this.#e}get node(){return this.binding.node}get closed(){return this.binding.closed}async update(){if(this.closed||!this.binding.hasStamp("start"))return;let e=this.node,[,t]=e.builder.runtimeValues(e),n=t.remote;if(!n)return;let i={};for(let[u,c]of Object.entries(t))u.startsWith("remote_")&&(i[u.slice(7)]=c);let s=e.getAttr("_if");if(s&&!this.#i("_if",s,`return (${s})`,i)){this.binding.runtime.gramlot.rpc.remoteRequests.get(e)?.controller.abort();let u=e.getAttr("_else");u&&this.#i("_else",u,u,i);return}let a,o;try{if(o=oe(i),t._cachedRemote&&n===this.#t&&o===this.#r){this.binding.runtime.gramlot.rpc.remoteRequests.get(e)?.controller.abort();return}a=await this.binding.runtime.gramlot.src.remoteSource(e,n,i)}catch(u){throw new Error(`${e.nodeTag} '${e.label}': remote '${n}' failed: ${u.message}`,{cause:u})}a&&(this.#t=n,this.#r=o);let l=e.getAttr("_onRemote");a&&l&&this.#i("_onRemote",l,l,i)}#i(e,t,n,i){return this.binding.runtime.inlineCompiler.compile(this.node,e,t,Object.keys(i),n)(i)}};var ac={dataFormula:cs,dataController:ds,dataRpc:fs,dataRemote:ps},ug=["datapath","_anchor","node_id","form","formId"],Hr=class{#e;#t=new Map;#r=new Map;#i;#n;#s;#a=`gramlot-data-${Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("")}`;#o=!1;constructor(e){this.#e=e,this.#i=new as(this),this.#n=new os(this),this.#s=new hs(this)}get gramlot(){return this.#e}get builder(){return this.gramlot.src.builder}get renderer(){return this.gramlot.src.renderer}get logicRegistry(){return this.gramlot.src.logicRegistry}get data(){return this.builder.data}get root(){return this.data.parent}get size(){return this.#t.size}get disposed(){return this.#o}get router(){return this.#i}get installer(){return this.#n}get inlineCompiler(){return this.#s}get nodeIds(){return this.#r}attach(){this.root.subscribe(this.#a,{any:e=>this.receiveData(e)})}receiveData(e){this.router.deliver(e)}bindingFor(e){return this.#t.get(e)??null}openBinding(e){if(this.disposed)throw new Error("BindingRuntime is disposed");let t=this.bindingFor(e);return t||(t=new Va(this,e),this.#t.set(e,t)),t}closeBranch(e){let t=[];if(e.value instanceof S)for(let i of e.value.getNodes())try{this.closeBranch(i)}catch(s){t.push(s)}let n=this.bindingFor(e);if(n){this.#t.delete(e);let i=e.getAttr("node_id");this.nodeIds.get(i)===e&&this.nodeIds.delete(i);try{n.close()}catch(s){t.push(s)}}if(t.length)throw new AggregateError(t,"Source branch close failed")}rebindBranch(e){let t=this.#h(e);for(let n of t)this.bindingFor(n)?.rebind();for(let n of t)this.renderer.project(n);for(let n of t)this.bindingFor(n)?.remote?.update()}handleSourceEvent(e){let{evt:t,node:n}=e,i=[],s=a=>{try{this.closeBranch(a)}catch(o){i.push(o)}};try{if(t==="ins")this.#c(n);else if(t==="del")for(let a of Array.isArray(n)?n:[n])s(a);else if(t==="upd_value"||t==="upd_value_attr"){if(e.oldvalue instanceof S)for(let a of e.oldvalue.getNodes())s(a);this.inlineCompiler.release(n,[""]),t==="upd_value_attr"?this.#u(n,e.attrs_diff):this.#p(n).rebind(),n.value instanceof S&&this.#c(n.value)}else if(t==="upd_attrs")this.#u(n,e.attrs_diff);else throw new Error(`Unsupported Source event: ${t}`)}catch(a){throw i.length?new AggregateError([...i,a],"Source event failed"):a}return i}branchBuilt(e){let t=[];for(let n of this.#h(e)){let i=this.bindingFor(n);!i||i.hasStamp("built")||!this.renderer.attached(n)||(i.stamp("built"),t.push(i))}for(let n of t)this.renderer.attached(n.node)&&this.#l(n,"built","_onBuilt");if(this.gramlot.state==="started")for(let n of t)this.renderer.attached(n.node)&&this.#f(n)}pageStarted(){for(let e of[...this.#t.values()])!e.closed&&e.hasStamp("built")&&this.#f(e)}dispose(){if(this.disposed)return;this.#o=!0,this.root.unsubscribe(this.#a,{any:!0}),this.nodeIds.clear();let e=[];for(let[t,n]of[...this.#t.entries()].reverse()){this.#t.delete(t);try{n.close()}catch(i){e.push(i)}}if(e.length)throw new AggregateError(e,"Binding cleanup failed")}#c(e){if(!(e instanceof S)&&this.bindingFor(e))return;let t=e instanceof S?e.getNodes().flatMap(s=>this.#h(s)):this.#h(e),n=new Set(t.filter(s=>this.bindingFor(s))),i=new Map;for(let s of t){let a=s.getAttr("node_id");if(a!=null){if(i.has(a)||this.nodeIds.has(a)&&this.nodeIds.get(a)!==s)throw new Error(`Duplicate node_id '${a}'`);i.set(a,s)}}for(let[s,a]of i)this.nodeIds.set(s,a);try{this.installer.install(e);for(let s of t)this.openBinding(s);for(let s of t)this.bindingFor(s).registerPointers()}catch(s){let a=[s];for(let o of t.filter(l=>!n.has(l)).reverse()){let l=o.getAttr("node_id");i.get(l)===o&&this.nodeIds.get(l)===o&&this.nodeIds.delete(l);let u=this.bindingFor(o);if(u){this.#t.delete(o);try{u.close()}catch(c){a.push(c)}}}throw a.length>1?new AggregateError(a,"Source branch installation failed"):s}for(let s of t){let a=this.bindingFor(s);if(!(!a||a.hasStamp("init")||!this.renderer.attached(s))&&(a.stamp("init"),oc(s.getAttr("_init"))))for(let o of a.providers)o.invoke({kind:"init",change:null})}}#f(e){e.hasStamp("start")||(e.stamp("start"),this.#l(e,"start","_onStart"),e.remote?.update())}#l(e,t,n){let i=e.node.getAttr(n);if(oc(i))for(let s of e.providers){if(typeof i!="number"||i<=0){s.invoke({kind:t,change:null});continue}let a=null,o=setTimeout(()=>{a(),s.invoke({kind:t,change:null})},i);a=e.track(()=>clearTimeout(o))}}#u(e,t){let n=this.#p(e);if(this.inlineCompiler.release(e,Object.keys(t)),Object.hasOwn(t,"node_id")){let{old:i,new:s}=t.node_id;if(s!=null&&this.nodeIds.has(s)&&this.nodeIds.get(s)!==e)throw new Error(`Duplicate node_id '${s}'`);this.nodeIds.get(i)===e&&this.nodeIds.delete(i),s!=null&&this.nodeIds.set(s,e)}ug.some(i=>Object.hasOwn(t,i))?this.rebindBranch(e):n.rebind()}#p(e){let t=this.bindingFor(e);if(!t)throw new Error(`${e.nodeTag??"fragment"} '${e.label}': the node has no NodeBinding (its installation failed); remove it from the Source and insert it again`);return t}#h(e){let t=[e];if(e.value instanceof S)for(let n of e.value.getNodes())t.push(...this.#h(n));return t}};function oc(r){return r===!0||typeof r=="number"}var Va=class{#e;#t;#r=!1;#i=[];#n=[];#s=new Set;#a=null;#o=null;#c=new Set;#f=0;#l=new Set;constructor(e,t){this.#e=e,this.#t=t}get runtime(){return this.#e}get node(){return this.#t}get closed(){return this.#r}get registrations(){return[...this.#n]}get providers(){return this.#a?[this.#a]:[]}get remote(){return this.#o}get clickCount(){return this.#f}countClick(){return++this.#f}hasStamp(e){return this.#s.has(e)}stamp(e){this.#s.add(e)}registerPointers(){this.node._getMeta("data_element")&&(this.runtime.renderer.references.remove(this.node),this.runtime.renderer.references.register(this.node,null));let e=this.node,t=e._getMeta("data_element");if(t&&!ac[e.nodeTag])return;!t&&typeof e.getAttr("remote")=="string"&&(this.#o??=new ms(this));let n=new Set;if(this.remote){for(let[i,s]of Object.entries(e.getAttr()))if(i.startsWith("remote_"))for(let a of lt(e,s))n.add(a)}for(let[i,s]of e.pointers()){if(t&&i!=="datapath")continue;let o=(i==="datapath"?e.parentNode:e).absDatapath(s);if(o===null)continue;let[l,u=null]=o.split("?",2),c=this.runtime.router.register({path:l,attr:u,recipient:this});this.#n.push(c),i==="datapath"&&this.#l.add(c),this.remote&&(i==="remote"||i.startsWith("remote_")||n.has(i))&&this.#c.add(c)}if(!t){this.#u();return}this.#a??=new ac[e.nodeTag](this),this.#a.register()}#u(){let e=this.node,t=this.runtime.gramlot._subscriptions;for(let[n,i]of Object.entries(e.getAttr())){let s=n.startsWith("selfsubscribe_")?"selfsubscribe_":n.startsWith("subscribe_")?"subscribe_":null;if(!s)continue;if(typeof i!="string"||!i)throw new TypeError(`${n} requires a handler`);let a=s==="selfsubscribe_"?t.topicFor(e,n.slice(s.length)):n.slice(s.length),o=t.subscribe(a,l=>{if(this.closed)return;if(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(i)){let{group:f,method:h}=this.runtime.logicRegistry.resolve(i,e);return h.call(f,e,l)}let[,u]=e.builder.runtimeValues(e),c=Object.fromEntries(Object.entries(u).filter(([f])=>!f.startsWith("subscribe_")&&!f.startsWith("selfsubscribe_"))),d={...this.runtime.renderer.references.resolveArguments(c),p_0:l};return this.runtime.inlineCompiler.compile(e,n,i,Object.keys(d))(d)});this.#n.push({close:()=>t.unsubscribe(o)})}}rebind(){this.#p(),this.registerPointers()}receive(e){if(this.#l.has(e.registration)){this.runtime.rebindBranch(this.node);return}this.#c.has(e.registration)&&this.remote.update(),this.runtime.renderer.project(this.node,e)}track(e){if(this.closed)throw new Error(`NodeBinding of '${this.node.label}' is closed`);return this.#i.push(e),()=>{let t=this.#i.indexOf(e);t!==-1&&this.#i.splice(t,1)}}close(){if(this.closed)return;this.#r=!0,this.node._getMeta("data_element")&&this.runtime.renderer.references.remove(this.node),this.#p();let e=[];for(let t of this.#i.splice(0).reverse())try{t()}catch(n){e.push(n)}if(e.length)throw new AggregateError(e,`NodeBinding of '${this.node.label}' cleanup failed`)}#p(){for(let e of this.#n.splice(0))e.close();this.#l.clear(),this.#c.clear()}};var zn=class extends nr{static renderType="object";#e=new Set;#t=new WeakMap;#r=new WeakMap;#i=new WeakMap;constructor(e,t,n,{binding:i}={}){if(super(e),!(e instanceof Ne)||!(t instanceof he)||n?.nodeType!==1)throw new TypeError("GramlotRenderer requires a BuilderBase, GramlotBuilderBag and HTML destination");if(!(i instanceof Hr))throw new TypeError("GramlotRenderer requires a BindingRuntime");if(!(t._builder instanceof Ne))throw new TypeError("SourceBag requires builder ownership");this._binding=i,this.source=t,this.destination=n,this.html=new rs({metadataAttributes:["__ref"]}),this.records=new Map,this.references=new jn(t),this.pending=[],this.building=!1,this.disposed=!1,this.elements=new WeakMap,this.instanceId=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,"0")).join(""),this.radioGroups=new ts(this),this.subscription=`html-source-renderer-${this.instanceId}`,t.subscribe(this.subscription,{any:s=>this.receive(s)})}get binding(){return this._binding}get inlineCompiler(){return this.binding.inlineCompiler}evaluateExpressions(e,t){let n=this.#r.get(e)??super.evaluateExpressions(e,t),i=e._getMeta("gramlot_component");if(i?.presentationDefaults.length){let s=e.getAttr();this.#i.set(e,Object.fromEntries(Object.entries(n).filter(([a])=>Object.hasOwn(s,a)&&i.presentationDefaults.some(o=>a.startsWith(o)))))}if(i&&(i.parameters.value?.binding==="twoWay"||i.presentationDefaults.length)){let s=[];for(let a=e.parentNode;a;a=a.parentNode)this.#i.has(a)&&s.unshift(this.#i.get(a));n=Object.assign({},...s,n)}return this.#r.delete(e),this.#t.set(e,n),n}render(e,t={}){if(!(e instanceof rr))throw new TypeError("Source children must be GramlotBuilderBagNodes");if(e._getMeta("data_element")||!this.binding.bindingFor(e)&&this.#o(e))return null;if(e.nodeTag)this.html.validate(e,e._getMeta("subbuilder")?e.parentBag._builder:e.builder);else if(!(e.value instanceof S))throw new TypeError("Source fragments must contain child SourceBags");return e.nodeTag?super.render(e,t):this.renderFragment(e,t)}renderFragment(e,{document:t=this.destination.ownerDocument,...n}={}){let i=t.createDocumentFragment(),s={node:e,binding:this.#d(e),container:null,parent:null,children:new Set,cleanup:[],start:t.createComment("source-fragment"),end:t.createComment("/source-fragment")};this.records.set(e,s),this.elements.set(i,s),i.append(s.start);for(let a of e.value.getNodes()){let o=this.render(a,{document:t,...n});if(o===null)continue;i.append(o);let l=this.elements.get(o);l&&(l.parent=s,s.children.add(a))}return i.append(s.end),i}renderedItem(e,t,n,{tag:i,document:s=this.destination.ownerDocument}={}){let a=n;t=this.expressionValue(e,t),this.getRender(e.builder)===this&&(a=this.restoreNativeAttributes(e,n),e._getMeta("gramlot_component")||([t,a]=$n(t,a,(h,p)=>this._binding.gramlot.format(h,p)))),a=this.componentAttributes(e,a);let o=Array.isArray(t)?t:[],l=Array.isArray(t)?a._text:t,u=this.#t.get(e),c={node:e,binding:this.#d(e),container:null,parent:null,children:new Set,cleanup:[],resolved:u,...this.html.create(e,s,i,a,u.visible??null)};this.html.compose(c,l,o),c.shape=De.shape(c.element,u),this.records.set(e,c),this.elements.set(c.element,c);let d=De.for(c.binding,c);d&&(c.control=d,d.attach(),c.cleanup.push(()=>d.detach()),this.#u(c,e,a,null));let f=ns.for(c.binding,c);f&&(c.button=f,f.attach(),c.cleanup.push(()=>f.detach())),this.#p(c),this.references?.register(e,c.element);for(let h of o){let p=this.elements.get(h);p&&(p.parent=c,p.container=c.element,c.children.add(p.node))}return c.element}validateCandidate(e,{replacingNode:t=null}={}){if(!(e instanceof he))throw new TypeError("Source values must be GramlotBuilderBags");let n=new Set,i=s=>{if(!n.has(s)){n.add(s);for(let a of this.records.get(s)?.children??[])i(a);if(s.value instanceof S)for(let a of s.value.getNodes())i(a)}};for(let s of this.records.get(t)?.children??[])i(s);if(t?.value instanceof S)for(let s of t.value.getNodes())i(s);return this.#n(e,t?t.nodeTag:null),qa(e),this.references?.validate(e,n),e}#n(e,t=null){let n=new Set,i=(s,a=null)=>{if(!(s instanceof he)||n.has(s))throw new TypeError("Source values must be unshared, acyclic GramlotBuilderBags");if(!(s._builder instanceof Ne))throw new TypeError("SourceBag requires builder ownership");n.add(s);for(let o of s.getNodes()){if(!(o instanceof rr))throw new TypeError("Source children must be GramlotBuilderBagNodes");if(!(o.builder instanceof Ne))throw new TypeError("SourceBagNode requires builder ownership");if(o.resolver)throw new TypeError("Source resolvers are outside this port");if(o._getMeta("data_element"))o.builder.validateNode(o);else if(o.nodeTag){let l=o._getMeta("subbuilder")?s._builder:o.builder;this.html.validate(o,l),o._getMeta("subbuilder")||o.builder.validateParent(o.nodeTag,a)}else{if(!(o.value instanceof S))throw new TypeError("Source fragments must contain child SourceBags");if(Object.keys(o.attr).some(l=>l!=="_meta"))throw new TypeError("Fragment attributes are unsupported")}o.value instanceof S&&i(o.value,o._getMeta("subbuilder")?null:o.nodeTag??a)}};i(e,t)}freeze(e){e=pe(e);let t=this.records.get(e);if(!t||this.disposed)throw new Error("Freeze requires a mounted Source node");t.frozen=!0}unfreeze(e){e=pe(e);let t=this.records.get(e);if(!t||this.disposed)throw new Error("Unfreeze requires a mounted Source node");let n=i=>{delete i.frozen;for(let s of i.children)n(this.records.get(s))};n(t),!this.#s(e)&&(this.attached(e)?this.#m(e):this.remove(e))}#s(e){for(;e;){let t=this.records.get(e);if(t?.frozen)return!0;e=e.parentBag?.parentNode??t?.parent?.node}return!1}receive(e){if(!this.disposed){if(Array.isArray(e.node)){let t=e.node.filter(n=>!this.#e.has(n));if(!t.length)return;e={...e,node:t}}else if(this.#e.has(e.node))return;if(this.pending.push(e),!this.building){this.building=!0;try{for(;this.pending.length;){let t=this.pending.shift();if(t.evt!=="del"&&!this.attached(t.node))continue;t.evt!=="del"&&t.evt!=="upd_attrs"&&this.#c(t);let n=this.binding.handleSourceEvent(t);try{this.#a(t,n)}catch(i){if(!n.length)throw i;n.push(i)}if(n.length)throw n.length===1?n[0]:new AggregateError(n,"Source cleanup failed")}}catch(t){throw this.pending.length=0,t}finally{this.building=!1}}}}#a(e,t){if(e.evt==="del"){for(let n of Array.isArray(e.node)?e.node:[e.node]){if(this.#s(n))continue;let i=this.records.get(n)?.parent??null;try{this.remove(n)}catch(s){t.push(s)}this.#h(i)}return}if(!this.#s(e.node))if(e.evt==="ins")this.insert(e.node);else if(e.evt.startsWith("upd_"))this.update(e.node,e.evt);else throw new Error(`Unsupported Source event: ${e.evt}`)}attached(e){let t=e.parentBag;for(;t&&t!==this.source;)t=t.parentNode?.parentBag;return t===this.source}#o(e){let t=new Set(this.pending.flatMap(n=>Array.isArray(n.node)?n.node:[n.node]));for(let n=e;n;n=n.parentBag?.parentNode)if(t.has(n))return!0;return!1}#c(e){let t=n=>{if(!(n instanceof rr))throw new TypeError("Source children must be GramlotBuilderBagNodes");if(n.value instanceof S){if(!(n.value instanceof he))throw new TypeError("Source values must be GramlotBuilderBags");for(let i of n.value.getNodes())t(i)}};t(e.node)}insert(e){if(!this.attached(e)||this.records.has(e))return;if(e._getMeta("data_element")){this.records.get(e.parentBag?.parentNode)?.button?.refresh(),this.binding.branchBuilt(e);return}let t=this.records.get(e.parentBag?.parentNode),n=t?.element??t?.container??this.destination,i=e.parentBag.getNodes(),s=t?.end??null;for(let a=i.indexOf(e)+1;a<i.length;a++){let o=this.records.get(i[a]);if(o){s=o.element??o.start;break}}this.buildNode(e,n,s,t)}buildNode(e,t,n=null,i=null){this.#e.add(e);let s;try{s=this.render(e,{document:t.ownerDocument})}catch(o){this.#f(e,o)}finally{this.#e.delete(e)}let a=this.records.get(e);return t.insertBefore(s,n),a.parent=i,this.assignContainer(a,t),i?.children.add(e),this.#h(i),this.binding.branchBuilt(e),a}#f(e,t){let n=[t],i=[],s=a=>{if(i.push(a),a.value instanceof S)for(let o of a.value.getNodes())s(o)};s(e);for(let a of i.reverse())try{this.remove(a)}catch(o){n.push(o)}throw n.length===1?t:new AggregateError(n,"Source build and cleanup failed")}assignContainer(e,t){e.container=t;let n=e.element??t;for(let i of e.children){let s=this.records.get(i);s&&this.assignContainer(s,n)}}update(e,t){let n=this.records.get(e);if(!n){this.insert(e);return}let i=e.value==null||["string","number","boolean"].includes(typeof e.value),s=t==="upd_value"&&i&&n.element&&n.children.size===0&&this.html.matches(n,e);(t==="upd_attrs"||s)&&n.element&&this.html.matches(n,e)?(e.nodeTag&&this.html.validate(e,e._getMeta("subbuilder")?e.parentBag._builder:e.builder),this.project(e),t==="upd_attrs"&&this.records.get(e)===n&&(this.references?.remove(e),this.references?.register(e,n.element))):this.#m(e)}project(e,t=null){let n=this.records.get(e);if(!n?.element)return;let i=this.getRender(e.builder),s=this.#i.get(e),[a,o]=e.builder.runtimeValues(e),[,l]=i._handleMeta(e,o),u=this.#t.get(e);if(n.shape!==De.shape(n.element,u)){if(this.#s(e))return;this.#r.set(e,u);try{this.#m(e)}finally{this.#r.delete(e)}return}n.resolved=u;let c=e._getMeta("subbuilder")?l:i.adaptAttrs(l),d=e.value instanceof S,f=d?[]:this.expressionValue(e,a);i===this&&(c=this.restoreNativeAttributes(e,c),e._getMeta("gramlot_component")||([f,c]=$n(f,c,(p,m)=>this._binding.gramlot.format(p,m)))),c=this.componentAttributes(e,c),this.html.update(n,e,c,d?c._text:f,u.visible??null),this.#u(n,e,c,t),n.control?.refresh(),n.button?.refresh(),this.#p(n);let h=this.#i.get(e);if(h){let p=new Set([...Object.keys(s??{}),...Object.keys(h)].filter(m=>!Object.is(s?.[m],h[m])));p.size&&this.#l(e,p)}(n.element.localName==="option"||n.element.localName==="optgroup")&&this.#h(n.parent)}#l(e,t){if(e.value instanceof S)for(let n of e.value.getNodes()){let i=n._getMeta("gramlot_component"),s=n.getAttr(),a=t;i?.presentationDefaults.length?a=new Set([...t].filter(o=>!Object.hasOwn(s,o))):i?.parameters.value?.binding==="twoWay"&&[...t].some(o=>!Object.hasOwn(s,o))&&this.project(n),a.size&&this.#l(n,a)}}componentAttributes(e,t){let n=e._getMeta("gramlot_component");if(!n)return t;let i=this.#t.get(e),s=Object.fromEntries([...new Set([...Object.keys(n.parameters),...Object.keys(i).filter(a=>a.startsWith("validate_"))])].filter(a=>Object.hasOwn(i,a)).map(a=>[a,i[a]]));return{...t,...s}}#u(e,t,n,i){if(!e.control)return;let s=t.getAttr("value")!=null;(s||e.valueDeclared)&&e.control.project(n.value??null,i),e.valueDeclared=s}#p(e){let t=new Map(Pn.declared(e.node).map(n=>[n[0],n]));if(!e.events){if(!t.size)return;e.events=new Map,e.cleanup.push(()=>{for(let n of e.events.values())n.detach();e.events.clear()})}for(let[n,i]of[...e.events])t.get(n)?.[2]!==i.handler&&(i.detach(),e.events.delete(n));for(let[n,[,i,s]]of t){if(e.events.has(n))continue;let a=new Pn(e.binding,e,i,s,n);a.attach(),e.events.set(n,a)}}#h(e){for(let t=e;t;t=t.parent){if(t.control instanceof Ln){this.project(t.node);return}if(t.element&&t.element.localName!=="optgroup")return}}getDomNode(e){let t=pe(e),n=this.records.get(t);return n&&this.attached(t)?n.element??null:null}getBaseSourceNode(e){for(let t=e;t;t=t.parentNode){let n=t.nodeType===1?this.elements.get(t):null;if(n)return this.attached(n.node)?n.node:null}return null}#d(e){let t=this.binding.bindingFor(e);if(!t)throw new Error(`${e.nodeTag??"fragment"} '${e.label}': rendered without an open NodeBinding`);return t}#m(e){let t=this.records.get(e),n=t.element?.nextSibling??t.end?.nextSibling??null,i=t.container,s=t.parent,a=null;try{this.remove(e)}catch(o){a=o}try{this.buildNode(e,i,n,s)}catch(o){throw a?new AggregateError([a,o],"Source replacement cleanup and commit failed"):o}if(a)throw a}onDispose(e,t){let n=this.records.get(e);if(!n)throw new Error("Source node is not mounted");return n.cleanup.push(t),()=>{let i=n.cleanup.indexOf(t);i!==-1&&n.cleanup.splice(i,1)}}remove(e){let t=this.records.get(e);if(!t)return;let n=[];for(let i of[...t.children])try{this.remove(i)}catch(s){n.push(s)}for(let i of t.cleanup.splice(0).reverse())try{i()}catch(s){n.push(s)}if(this.references?.remove(e),t.element&&this.elements.delete(t.element),t.element?.remove(),t.start?.remove(),t.end?.remove(),t.parent?.children.delete(e),this.records.delete(e),this.#t.delete(e),this.#i.delete(e),n.length)throw new AggregateError(n,"Source cleanup failed")}dispose(){if(this.disposed)return;this.disposed=!0,this.source.unsubscribe(this.subscription,{any:!0}),this.pending.length=0;let e=[],t=[...this.records.entries()].filter(([,n])=>!n.parent).map(([n])=>n);for(let n of t)try{this.remove(n)}catch(i){e.push(i)}if(e.length)throw new AggregateError(e,"Renderer cleanup failed")}};var cg=new Set(["page","constructor"]);function lc(r,e){if(r===null)return[];let t=r.split("/");for(let n of t)if(cg.has(n))throw new Error(`${e}: a logic group cannot be named '${n}' (group '${r}')`);return t}var dg=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function fg(r){return/^[\w$]/.test(r)?dg.has(r):r!==")"&&r!=="]"}function pg(r,e){let t=!1;for(let n=e+1;n<r.length;n++){let i=r[n];if(i===`
64
- `)return-1;if(i==="\\"){n++;continue}if(i==="[")t=!0;else if(i==="]")t=!1;else if(i==="/"&&!t)return n}return-1}function hg(r){let e=0,t="",n="";for(let i=r.indexOf("{");i<r.length;i++){let s=r[i];if(s==="/"&&r[i+1]==="/"){if(i=r.indexOf(`
65
- `,i),i<0)break;continue}if(s==="/"&&r[i+1]==="*"){let a=r.indexOf("*/",i+2);if(a>=0){i=a+1;continue}}if(s==="/"&&fg(n)){let a=pg(r,i);if(a>=0){i=a,n=")";continue}}if(s==='"'||s==="'"||s==="`"){let a=i+1;for(;a<r.length&&r[a]!==s;)a+=r[a]==="\\"?2:1;e===1&&(t+=r.slice(i+1,a)==="constructor"?" constructor":' ""'),i=a,n=")";continue}if(/[\w$]/.test(s)){let a=i+1;for(;a<r.length&&/[\w$]/.test(r[a]);)a++;e===1&&(t+=r.slice(i,a)),n=r.slice(i,a),i=a-1;continue}if(/\s/.test(s)||(n=s),s==="{"){++e===2&&(t+=" {}");continue}if(s==="}"){e--;continue}e===1&&(t+=s)}return/(?<![\w$.#])(?<!\bstatic\s+)constructor\s*\(/.test(t)}function uc(r,e){if(typeof r!="function"||!/^class\b/.test(Function.prototype.toString.call(r)))throw new Error(`${e}: the module exports no class Logic`);if(Object.getPrototypeOf(r)!==Function.prototype||Object.getPrototypeOf(r.prototype)!==Object.prototype)throw new Error(`${e}: class Logic cannot extend another class`);if(hg(Function.prototype.toString.call(r)))throw new Error(`${e}: class Logic cannot declare a constructor; state lives on the group or the page`);let t=[];for(let n of Reflect.ownKeys(r.prototype)){if(n==="constructor")continue;if(typeof n=="symbol")throw new Error(`${e}: class Logic cannot declare symbol keys (${String(n)})`);let i=Object.getOwnPropertyDescriptor(r.prototype,n);if(i.get||i.set)throw new Error(`${e}: class Logic cannot declare the accessor '${n}'`);if(typeof i.value!="function")throw new Error(`${e}: Logic.prototype.${n} is not a method`);if(n==="page")throw new Error(`${e}: a logic method cannot be named 'page'`);t.push([n,i.value])}return t}function cc(r,e,t){Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}var sr=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get page(){return this.#t}},Wr=class{#e;#t=new Map;constructor(e){this.#e=e,e.logic=new sr(this,e)}get gramlot(){return this.#e}static check(e){let t=new Map;for(let{group:n,resource:i}of e){let s=lc(n,i);for(let a=0;a<s.length;a++){let o=s.slice(0,a).join("/");t.has(o)||t.set(o,new Set),t.get(o).add(s[a])}}for(let{logicClass:n,group:i,resource:s}of e){let a=t.get(i??"")??new Set;for(let[o]of uc(n,s))if(a.has(o))throw new Error(`${s}: the logic method '${o}' has the name of a child group`)}}register(e,{group:t=null,resource:n}){let i=lc(t,n),s=uc(e,n),a=this.#e.logic;for(let o of i){let l=Object.getOwnPropertyDescriptor(a,o)?.value;if(l===void 0){let u=new sr(this,this.#e);cc(a,o,u),a=u}else if(l instanceof sr)a=l;else throw new Error(`${n}: the group '${o}' has the name of a logic method`)}for(let[o,l]of s){if(Object.getOwnPropertyDescriptor(a,o)?.value instanceof sr)throw new Error(`${n}: the logic method '${o}' has the name of a child group`);cc(a,o,l)}this.#t.has(a)||this.#t.set(a,[]),this.#t.get(a).push(n)}resolve(e,t){let n=e.split("."),i=n.pop(),s=this.#e.logic;for(let o=0;o<n.length;o++)if(s=Object.getOwnPropertyDescriptor(s,n[o])?.value,!(s instanceof sr))throw new Error(`${t.nodeTag} '${t.label}': named logic '${e}' not found: no resource was registered for the group '${n.slice(0,o+1).join("/")}'`);let a=Object.getOwnPropertyDescriptor(s,i)?.value;if(typeof a!="function"){let o=this.#t.get(s)??[],l=n.length?`the group '${n.join("/")}'`:"the page logic";throw new Error(`${t.nodeTag} '${t.label}': named logic '${e}' not found: ${l} has no method '${i}' (resources: ${o.join(", ")||"none"})`)}return{group:s,method:a}}};var Hn=class extends $e{constructor(e,{collections:t,destination:n}){super(e),e.src=this,this.logicRegistry=new Wr(e),this.builder=new Ge(null,{collections:t}),this.binding=new Hr(e),this.builder.binding=this.binding,this.binding.attach(),this.source=this.builder.source,this.renderer=new zn(this.builder,this.source,n,{binding:this.binding})}startSource(e){if(!["ready","failed"].includes(this.gramlot.state))throw new Error(`Cannot start embedded Source while Gramlot is ${this.gramlot.state}`);try{return this.mountMainSource(e)}catch(t){throw this.gramlot.state="failed",t}}mountMainSource(e){let t=this.prepareSource(e);this.renderer.validateCandidate(t);try{this.source.setItem("main",t)}catch(n){throw this.binding.bindingFor(this.source.getNode("main"))||this.source.popNode("main"),n}return this.gramlot.state="started",this.binding.pageStarted(),this.gramlot._subscriptions.ready(),this.gramlot}prepareSource(e,t=this.builder){if(e instanceof S){if(!(e instanceof he))throw new TypeError("Source values must be GramlotBuilderBags");return e.bindBuilder(t).activateCode()}if(typeof e!="string")throw new TypeError("Source value did not decode to SourceBag");let n=xa(e,t);if(!(n instanceof he))throw new TypeError("Source values must be GramlotBuilderBags");return n.activateCode()}async remoteSource(e,t,n={}){let i=this.gramlot.rpc;if(!i.transport?.call)throw new Error("Remote Source is unavailable without a server transport");let s=this.binding.bindingFor(e);if(this.gramlot.state!=="started"||!s)throw new Error("Remote Source target is not mounted");i.remoteRequests.get(e)?.controller.abort();let a={controller:new AbortController};i.remoteRequests.set(e,a);let o=s.track(()=>a.controller.abort()),l=!1,u=()=>this.gramlot.state!=="disposed"&&!a.controller.signal.aborted&&i.remoteRequests.get(e)===a&&!s.closed;try{let c=await i.call("source",t,n,{signal:a.controller.signal});if(!u())return!1;let d=this.prepareSource(c,e.builder);return u()?(this.renderer.validateCandidate(d,{replacingNode:e}),l=!0,o(),e.setValue(d,!0,{_text:null},!0),!0):!1}catch(c){if(!l&&!u())return!1;throw c}finally{o(),i.remoteRequests.get(e)===a&&i.remoteRequests.delete(e)}}};var mg=()=>Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)),r=>r.toString(16).padStart(2,"0")).join(""),gs=class extends Error{name="RpcError";constructor({code:e,name:t,message:n,details:i}){super(n),this.code=e,this.remoteName=t,i!==void 0&&(this.details=i)}},Wn=class extends $e{constructor(e,{rpcUrl:t,closeUrl:n,document:i,transport:s}){super(e),this.transport=s===!1?null:s??new Xe(t,{closeUrl:n,navigator:i.defaultView.navigator}),this.remoteRequests=new Map}async call(e,t,n={},{signal:i}={}){if(!this.transport?.call)throw new Error(`rpc '${t}' is unavailable without a server transport`);Un(n);let s=mg(),a=oe({id:s,pageId:this.gramlot.pageId,contentType:e,name:t,params:n}),o=Q(await this.transport.call(a,i));if(o.id!==s)throw new Error("rpc response id mismatch");if(o.error)throw new gs(o.error);return o.value}};var Gn=class extends $e{setTouchMode(e="auto"){if(!["auto","on","off"].includes(e))throw new TypeError(`Invalid touch mode: ${e}`);let t=this.gramlot.src.renderer.destination.ownerDocument.documentElement;e==="auto"?t.removeAttribute("data-gramlot-touch"):t.setAttribute("data-gramlot-touch",e)}reference(e){return this.gramlot.src.renderer.references.resolve(e)}getBaseSourceNode(e){return this.gramlot.src.renderer.getBaseSourceNode(e)}getDomNode(e){return this.gramlot.src.renderer.getDomNode(e)}};var dc="gramlot:publish",bs=class{#e;#t;#r;#i=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");#n=new Map;#s=!1;#a;#o;#c;#f;constructor(e,t){this.#e=e,this.#r=t,this.#t=t.defaultView,this.#a=i=>this.#h(i),this.#o=i=>{if(i.target?.localName!=="iframe")return;let s=this.#g(i.target);s&&(this.#u(s.window),this.#d(s,{kind:"hello"}))},this.#t.addEventListener("message",this.#a),this.#c=()=>this.#l(),this.#f=()=>this.ready(),this.#t.addEventListener("pagehide",this.#c),this.#t.addEventListener("pageshow",this.#f),t.addEventListener("load",this.#o,!0);let n=this.#m();n&&this.#d(n,{kind:"hello"})}ready(){if(this.#s||this.#e.state!=="started")return;let e=this.#m();e&&this.#d(e,{kind:"ready"});for(let t of this.#r.getElementsByTagName("iframe")){let n=this.#g(t);n&&this.#d(n,{kind:"hello"})}}prepare(e,t){let n=[];if(e.parent){let a=this.#m();if(!a)throw new Error("This page has no parent frame");n.push(a)}if(e.iframe!==void 0){let a=e.iframe,o=pe(a),l=typeof a=="string"?this.#r.getElementById(a):o instanceof Se?this.#e.dom.getDomNode(o):null,u=this.#g(l);if(!u)throw new Error("iframe destination must be an active Gramlot iframe ID or Source reference");n.push(u)}let i=n.map(a=>{let o=this.#n.get(a.window);if(!o||o.origin!==a.origin)throw new Error("Destination page is not ready");return{...a,session:o.session}});Un(t);let s=oe(t);return()=>{if(!this.#s)for(let a of i){let o=this.#_(a.window);if(!o||o.origin!==a.origin||this.#n.get(a.window)?.session!==a.session)throw new Error("Destination page disconnected before publication");this.#d(a,{kind:"publish",recipient:a.session,topic:e.topic,wire:s})}}}dispose(){this.#s||(this.#l(),this.#s=!0,this.#t.removeEventListener("message",this.#a),this.#t.removeEventListener("pagehide",this.#c),this.#t.removeEventListener("pageshow",this.#f),this.#r.removeEventListener("load",this.#o,!0))}#l(){for(let[e,t]of this.#n)this.#d({window:e,origin:t.origin},{kind:"close"});for(let e of this.#n.keys())this.#u(e)}#u(e){this.#n.get(e)?.release?.(),this.#n.delete(e)}#p(e,t){this.#u(e.window);let n={session:t,origin:e.origin};e.node&&(n.release=this.#e.src.binding.bindingFor(e.node).track(()=>{this.#d(e,{kind:"close"}),this.#u(e.window)})),this.#n.set(e.window,n)}#h(e){if(this.#s||e.data?.type!==dc)return;let t=this.#_(e.source);if(!t||e.origin!==t.origin)return;let n=e.data;if(!(typeof n.session!="string"||!n.session)){if(n.kind==="hello")this.#u(t.window),n.ready===!0&&this.#p(t,n.session),this.#e.state==="started"&&this.#d(t,{kind:"ready"});else if(n.kind==="ready"){let i=this.#n.get(t.window)?.session!==n.session;this.#p(t,n.session),i&&this.#e.state==="started"&&this.#d(t,{kind:"ready"})}else if(n.kind==="close")this.#n.get(t.window)?.session===n.session&&this.#u(t.window);else if(n.kind==="publish"){if(this.#e.state!=="started"||n.recipient!==this.#i||this.#n.get(t.window)?.session!==n.session||typeof n.topic!="string"||!n.topic||typeof n.wire!="string")return;this.#e.publish(n.topic,Q(n.wire))}}}#d(e,t){e.window.postMessage({type:dc,session:this.#i,ready:this.#e.state==="started",...t},e.origin==="null"?"*":e.origin)}#m(){let e=this.#t.parent;return e===this.#t?null:{window:e,origin:this.#b(this.#r.referrer||this.#r.baseURI)}}#g(e){if(e?.localName!=="iframe"||!e.isConnected||!e.contentWindow)return null;let t=this.#e.dom.getBaseSourceNode(e);if(!t||!this.#e.src.binding.bindingFor(t)||this.#e.dom.getDomNode(t)!==e)return null;let n=e.getAttribute("sandbox"),s=n!==null&&!n.split(/\s+/).includes("allow-same-origin")?"null":this.#b(e.hasAttribute("srcdoc")?this.#r.baseURI:e.getAttribute("src")||this.#r.baseURI);return{window:e.contentWindow,origin:s,node:t}}#b(e){let t=new URL(e,this.#r.baseURI);return t.protocol==="file:"?"null":t.origin}#_(e){let t=this.#m();if(t?.window===e)return t;for(let n of this.#r.getElementsByTagName("iframe")){let i=this.#g(n);if(i?.window===e)return i}return null}};var _s=class extends $e{#e=new Map;#t=new WeakSet;#r=new WeakMap;#i=0;#n=!1;#s;attach(e){this.#s=new bs(this.gramlot,e)}ready(){this.#s.ready()}subscribe(e,t){if(this.#c(),this.#o(e),typeof t!="function")throw new TypeError("subscribe requires a callback");let n=Object.freeze({});return this.#t.add(n),this.#e.has(e)||this.#e.set(e,new Map),this.#e.get(e).set(n,t),n}unsubscribe(e){if(!this.#t.has(e))throw new TypeError("Unknown subscription registration");for(let[t,n]of this.#e)n.delete(e)&&!n.size&&this.#e.delete(t)}publish(e,t={}){if(this.#c(),!t||typeof t!="object"||Array.isArray(t))throw new TypeError("publish requires one object of named data");if(typeof e=="string")return this.#a(e,t);if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError("publish requires a topic string or descriptor");if(Object.keys(e).some(s=>!["topic","nodeId","parent","iframe"].includes(s)))throw new Error("This publication route is not implemented yet");if(this.#o(e.topic),e.parent!==void 0&&typeof e.parent!="boolean")throw new TypeError("parent must be boolean");if(e.iframe==="*")throw new Error("Recursive iframe broadcast is not implemented yet");if((e.parent||e.iframe!==void 0)&&Object.hasOwn(e,"nodeId"))throw new Error("Interframe node addressing is not implemented yet");let i=e.parent||e.iframe!==void 0?this.#s.prepare(e,t):null;if(Object.hasOwn(e,"nodeId")){let s=this.gramlot.src.binding.nodeIds.get(e.nodeId);if(!s)throw new Error(`node_id not found: ${e.nodeId}`);return this.publishNode(s,e.topic,t)}this.#a(e.topic,t),i?.()}topicFor(e,t){this.#o(t),e=pe(e);let n=this.gramlot.src.binding.bindingFor(e);if(!n||n.closed)throw new Error("Topic target is not an active Source node of this page");let i=e.getAttr("node_id");return i==null&&(this.#r.has(e)||this.#r.set(e,`gramlot-self-${++this.#i}`),i=this.#r.get(e)),`${i}_${t}`}publishNode(e,t,n={}){return this.publish(this.topicFor(e,t),n)}dispose(){this.#n=!0,this.#s.dispose(),this.#e.clear()}#a(e,t){this.#o(e);let n=this.#e.get(e);if(n)for(let[i,s]of[...n]){if(this.#n)break;n.has(i)&&s(t)}}#o(e){if(typeof e!="string"||!e)throw new TypeError("A topic must be a nonempty string")}#c(){if(this.#n)throw new Error("Gramlot subscriptions are disposed")}};var fc=2e3;function gg(r){if(!(r instanceof Date))return String(r??"");let e=r.toISOString();return e.endsWith("T00:00:00.000Z")?e.slice(0,10):e}var Xn=class{constructor(e,t){this.gramlot=e,this.document=t}branch(e){let t=this.gramlot.data.getItem(e);if(!(t instanceof z))throw new Error(`gramlot.utl.inout: no data Bag at '${e}'`);return t}mailText(e){let t=[],n=(i,s)=>{for(let a of i.getNodes()){let o=s+a.label;a.value instanceof z?n(a.value,`${o}.`):t.push(`${o}: ${gg(a.value)}`)}};return n(this.branch(e),""),t.join(`
66
- `)}mailtoUrl(e,t){let n=`mailto:${encodeURIComponent(t)}?subject=${encodeURIComponent(this.document.title)}&body=${encodeURIComponent(this.mailText(e))}`;if(n.length>fc)throw new Error(`gramlot.utl.inout.sendMail: the email of '${e}' is ${n.length} characters long, over the mailto: limit of ${fc}; send it with sendHttp or save it as a file`);return n}sendMail(e,t){this.open(this.mailtoUrl(e,t))}async sendHttp(e,t){let n=JSON.stringify(this.branch(e).asDict(!1,!1,!0)),i=await this.document.defaultView.fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:n});if(!i.ok)throw new Error(`gramlot.utl.inout.sendHttp: ${t} answered ${i.status}`);return i}save(e,t){this.saveText(this.branch(e).toTytx(),t,"application/json")}restore(e){let t=this.document.createElement("input");return t.type="file",t.accept=".json,application/json",new Promise((n,i)=>{t.addEventListener("change",async()=>{try{let s=Q(await t.files[0].text());if(!(s instanceof z))throw new TypeError("the file must contain a typed Bag");this.gramlot.data.setItem(e,s),n(s)}catch(s){i(new Error(`gramlot.utl.inout.restore: the file is not a saved Gramlot branch: ${s.message}`,{cause:s}))}},{once:!0}),t.click()})}download(e,t,n){if(!["json","xml"].includes(n))throw new Error(`gramlot.utl.inout.download: format '${n}' is not 'json' or 'xml'`);let i=this.branch(e);if(n==="json")this.saveText(i.toJson(!1),t,"application/json");else{let s=e.split(".").at(-1);this.saveText(`<?xml version='1.0' encoding='UTF-8'?>
67
- <${s}>${i.toXml()}</${s}>`,t,"application/xml")}}saveText(e,t,n){let i=this.document.defaultView,s=i.URL.createObjectURL(new i.Blob([e],{type:n}));this.open(s,t),i.setTimeout(()=>i.URL.revokeObjectURL(s),1e3)}open(e,t=null){let n=this.document.createElement("a");n.href=e,t!==null&&(n.download=t),n.click()}};var Yn=class extends $e{constructor(e,t){super(e),this.inout=new Xn(e,t)}};var Zn=class{constructor({pageId:e,rpcUrl:t="/gramlot/rpc",closeUrl:n="/gramlot/close",rootId:i="gramlot-root",capabilities:s=[],element:a=null,document:o=a?.ownerDocument??globalThis.document,transport:l=null,collections:u=[],locale:c=null,timeZone:d=null,devices:f=[]}={}){Yi.register(o.defaultView);for(let p of u)p instanceof tr&&p.register(o.defaultView);this.pageId=e;let h=c==null||d==null?o.defaultView.Intl.DateTimeFormat().resolvedOptions():null;this.devices=Object.freeze([...f]),this.locale=c??h.locale,this.timeZone=d??h.timeZone,Object.defineProperty(this,"_subscriptions",{value:new _s(this)}),this.capabilities=Object.freeze([...s]),this.src=new Hn(this,{collections:u,destination:a??o.getElementById(i)}),this.data=this.src.builder.data,this.rpc=new Wn(this,{rpcUrl:t,closeUrl:n,document:o,transport:l}),this.dom=new Gn(this),this.utl=new Yn(this,o),this.state="ready",this._subscriptions.attach(o),this.abort=new AbortController,this.rpc.transport instanceof Xe&&(this.pagehide=p=>{p.persisted||this.dispose({beacon:!0})},o.defaultView.addEventListener("pagehide",this.pagehide),this.window=o.defaultView)}publish(e,t={}){return this._subscriptions.publish(e,t)}subscribe(e,t){return this._subscriptions.subscribe(e,t)}unsubscribe(e){this._subscriptions.unsubscribe(e)}format(e,t){return zu(e,t,{locale:this.locale,timeZone:this.timeZone})}start(){return this.state==="disposed"?Promise.reject(new Error("Gramlot is disposed")):this.rpc.transport?this.loading?this.loading:this.state==="started"?Promise.resolve(this):(this.state="loading",this.loading=this.loadMain().finally(()=>{this.loading=null}),this.loading):Promise.reject(new Error("This Gramlot instance has no server transport"))}async loadMain(){try{let e=await this.rpc.call("source","main",{},{signal:this.abort.signal});if(this.state==="disposed")throw new Error("Gramlot was disposed during main");return this.src.mountMainSource(e)}catch(e){throw this.state!=="disposed"&&(this.state="failed"),e}}dispose({beacon:e=!1}={}){if(this.state!=="disposed"){this.state="disposed",this._subscriptions.dispose(),this.pagehide&&this.window.removeEventListener("pagehide",this.pagehide),this.abort.abort();for(let t of this.rpc.remoteRequests.values())t.controller.abort();this.rpc.remoteRequests.clear();try{try{this.src.binding.dispose()}finally{this.src.renderer.dispose()}}finally{this.rpc.transport instanceof Xe&&this.rpc.transport.close(this.pageId,{beacon:e}),this.rpc.transport?.dispose?.()}}}};var za=class{constructor({config:e,resources:t,document:n=globalThis.document}){this.config=e,this.resources=t,this.document=n}async run(){let{config:e,resources:t,document:n}=this,i=n.defaultView;for(let c of t.css){let d=n.createElement("link");d.rel="stylesheet",d.href=c,n.head.append(d)}let s=!1,a=c=>{c.persisted||s||(s=!0,this.closePage())};i.addEventListener("pagehide",a);let o,l;try{let c=await Promise.allSettled(t.js.map(({url:d})=>import(new URL(d,n.baseURI).href)));if(s||(o=t.js.map(({url:d,group:f},h)=>{let p=c[h];if(p.status==="rejected")throw new Error(`${d}: import failed: ${p.reason?.message??p.reason}`,{cause:p.reason});return{logicClass:p.value.Logic,group:f,resource:d}}),Wr.check(o),l=await Promise.all((t.collections??[]).map(async d=>{try{return(await import(new URL(d,n.baseURI).href)).default}catch(f){throw new Error(`${d}: collection import failed: ${f.message}`,{cause:f})}})),s))return null;for(let d of l)d.register(i)}catch(c){throw this.closePage(),c}finally{i.removeEventListener("pagehide",a)}let u=new Zn({...e,document:n,collections:[...e.collections??[],...l.map(c=>c.toDocument())]});for(let{logicClass:c,group:d,resource:f}of o)u.src.logicRegistry.register(c,{group:d,resource:f});return i.gramlot=u,await u.start(),u}closePage(){let{rpcUrl:e,closeUrl:t,pageId:n}=this.config;new Xe(e,{closeUrl:t,navigator:this.document.defaultView.navigator}).close(n,{beacon:!0})}};var ws=Symbol("gramlot.source"),Ha=Symbol("gramlot.endpoint"),bg=new Map([[ws,"registerSource"],[Ha,"registerEndpoint"]]);function pc(r,e,t,n){let i=bg.get(t);if(e==="main")throw new TypeError(`${i} cannot declare main`);let s=Object.getOwnPropertyDescriptor(r.prototype,e)?.value;if(typeof s!="function")throw new TypeError(`${i} requires an own method of ${r.name}: ${String(e)}`);if(s[t])throw new TypeError(`${t===ws?"Source method":"Endpoint"} already registered: ${e}`);if(s[ws]||s[Ha])throw new TypeError(`${e} is declared both as Source method and endpoint`);s[t]={auth:n}}var Jn=class{static title="Gramlot";static devices=[];static locale=null;static timeZone=null;static installable=!1;static appIcon=null;manifest({baseUrl:e="./"}={}){let{title:t,appIcon:n}=this.constructor;if(typeof n!="string"||!n)throw new TypeError("An installable Page needs appIcon");return{id:e,name:t,short_name:t,start_url:e,scope:e,display:"standalone",icons:[{src:e+n.replace(/^\/+/,""),sizes:"512x512",type:"image/png"}]}}static css=[];static css_requires="";static js_requires="";static sourceBuilder=Ge;main(e){throw new Error("Page.main(root) must be implemented")}static registerSource(e,{auth:t=null}={}){pc(this,e,ws,t)}static registerEndpoint(e,{auth:t=null}={}){pc(this,e,Ha,t)}};var ys=class extends Jn{static title="Application";static logoUrl="";static shellId="index";static navigation=[];static css=["/themes/gramlot-base/theme.css","/themes/gramlot-index/theme.css"];main(e){let t=this.constructor.navigation,n=e.div({class:"index-shell",id:this.constructor.shellId});this.header(n);let i=n.aside({class:"index-sidebar",id:"index-sidebar"}),s=i.header();this.constructor.logoUrl&&s.img({src:this.constructor.logoUrl,alt:this.constructor.title,class:"index-logo"}),s.h1(this.constructor.title);let a=i.nav({"aria-label":"Pages"}).ul({class:"index-list"});for(let f of t){let h=a.li().details({open:f===t[0]});h.summary({tabindex:-1}).a(f.title,{id:`open-${f.key}`,href:`#panel-${f.key}`,class:"index-family",aria_current:null,tabindex:-1});let p=h.ul({class:"index-list"});for(let m of f.children)p.li().a(m.title,{id:`open-${m.key}`,href:m.url,aria_current:null,tabindex:-1})}n.div({class:"index-divider",id:"index-sidebar-divider",role:"separator",aria_orientation:"vertical",tabindex:0,aria_label:"Resize sidebar",aria_controls:"index-sidebar",aria_valuemin:120,aria_valuemax:460,aria_valuenow:240});let o=n.main({class:"index-main"}),l=o.div({class:"index-tabs",role:"tablist",aria_label:"Open pages"});l.html_button("Introduction",{type:"button",role:"tab",id:"tab-intro",aria_controls:"panel-intro",aria_selected:"true",tabindex:-1,hidden:!1});for(let f of t)for(let{key:h,title:p}of[f,...f.children])l.html_button(p,{type:"button",role:"tab",id:`tab-${h}`,aria_controls:`panel-${h}`,aria_selected:"false",tabindex:-1,hidden:!0});let u=o.div({class:"index-panels"}),c=u.section({id:"panel-intro",class:"index-intro",role:"tabpanel",aria_labelledby:"tab-intro",hidden:!1});this.introduction(c);for(let f of t){let h=u.section({id:`panel-${f.key}`,class:"index-category",role:"tabpanel",aria_labelledby:`tab-${f.key}`,hidden:!0});this.groupPanel(h,f);for(let p of f.children)this.panel(u,p)}let d=n.footer({class:"index-footer"});this.footer(d),this.behavior(n)}header(e){}behavior(e){e.dataController({func:"indexMount",_onStart:!0,shell_id:this.constructor.shellId})}introduction(e){e.h2(this.constructor.title),e.p("Choose a page from the navigation. Open pages remain available in tabs.")}groupPanel(e,t){e.h2(t.title)}footer(e){let t=e.div({class:"index-theme"});t.html_label("Theme",{for:"index-appearance"});let n=t.select({id:"index-appearance",value:"compact"});n.option("Base",{value:"base",selected:!1}),n.option("Compact",{value:"compact",selected:!0}),n.option("mimi",{value:"mimi"}),n.option("joanna",{value:"joanna"});let i=e.div({class:"index-theme"});i.html_label("Color mode",{for:"index-theme"});let s=i.select({id:"index-theme",value:"light"});s.option("Light",{value:"light",selected:!0}),s.option("Dark",{value:"dark",selected:!1});let o=e.div({class:"index-keyboard"}).html_label({for:"keyboard-navigation"});if(o.input({type:"checkbox",id:"keyboard-navigation",checked:!1}),o.span("Keyboard navigation"),this.constructor.installable){let l=e.details({class:"index-install"});l.summary("Install app"),l.html_button("Install",{type:"button",id:"index-install-button",hidden:!0}),l.p("",{id:"index-install-status",role:"status"}),l.p("Chrome: use Install page as app in the browser menu. Safari on macOS Sonoma or later: File > Add to Dock."),l.p("Use HTTPS or localhost. For a static export, serve the directory; direct file opening is not installable. Keep the server running for hosted pages.")}}panel(e,t){e.section({id:`panel-${t.key}`,class:"index-panel",role:"tabpanel",aria_labelledby:`tab-${t.key}`,hidden:!0}).iframe({id:`frame-${t.key}`,title:t.title,name:`page-${t.key}`})}};var Wa={base:"",compact:`/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */
62
+ `)}catch(i){throw i instanceof EvalError?new EvalError(`${Wn(r,e)}: inline code blocked by the Content Security Policy of the page (no 'unsafe-eval'); move the code to named logic (a method of the page's class Logic) or serve the page with the permissive CSP profile, which allows 'unsafe-eval'`,{cause:i}):new SyntaxError(`${Wn(r,e)}: ${i.message} in the inline code:
63
+ ${t}`,{cause:i})}}var ws=class{#e;#t=null;#r=null;constructor(e){this.#e=e}get binding(){return this.#e}get node(){return this.binding.node}get closed(){return this.binding.closed}async update(){if(this.closed||!this.binding.hasStamp("start"))return;let e=this.node,[,t]=e.builder.runtimeValues(e),n=t.remote;if(!n)return;let i={};for(let[u,c]of Object.entries(t))u.startsWith("remote_")&&(i[u.slice(7)]=c);let s=e.getAttr("_if");if(s&&!this.#i("_if",s,`return (${s})`,i)){this.binding.runtime.gramlot.rpc.remoteRequests.get(e)?.controller.abort();let u=e.getAttr("_else");u&&this.#i("_else",u,u,i);return}let a,o;try{if(o=ce(i),t._cachedRemote&&n===this.#t&&o===this.#r){this.binding.runtime.gramlot.rpc.remoteRequests.get(e)?.controller.abort();return}a=await this.binding.runtime.gramlot.src.remoteSource(e,n,i)}catch(u){throw new Error(`${e.nodeTag} '${e.label}': remote '${n}' failed: ${u.message}`,{cause:u})}a&&(this.#t=n,this.#r=o);let l=e.getAttr("_onRemote");a&&l&&this.#i("_onRemote",l,l,i)}#i(e,t,n,i){return this.binding.runtime.inlineCompiler.compile(this.node,e,t,Object.keys(i),n)(i)}};var dc={dataFormula:hs,dataController:ms,dataRpc:gs,dataRemote:bs},pg=["datapath","_anchor","node_id","form","formId"],Gr=class{#e;#t=new Map;#r=new Map;#i;#n;#s;#a=`gramlot-data-${Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("")}`;#o=!1;constructor(e){this.#e=e,this.#i=new cs(this),this.#n=new ds(this),this.#s=new _s(this)}get gramlot(){return this.#e}get builder(){return this.gramlot.src.builder}get renderer(){return this.gramlot.src.renderer}get logicRegistry(){return this.gramlot.src.logicRegistry}get data(){return this.builder.data}get root(){return this.data.parent}get size(){return this.#t.size}get disposed(){return this.#o}get router(){return this.#i}get installer(){return this.#n}get inlineCompiler(){return this.#s}get nodeIds(){return this.#r}attach(){this.root.subscribe(this.#a,{any:e=>this.receiveData(e)})}receiveData(e){this.router.deliver(e)}bindingFor(e){return this.#t.get(e)??null}openBinding(e){if(this.disposed)throw new Error("BindingRuntime is disposed");let t=this.bindingFor(e);return t||(t=new Za(this,e),this.#t.set(e,t)),t}closeBranch(e){let t=[];if(e.value instanceof O)for(let i of e.value.getNodes())try{this.closeBranch(i)}catch(s){t.push(s)}let n=this.bindingFor(e);if(n){this.#t.delete(e);let i=e.getAttr("node_id");this.nodeIds.get(i)===e&&this.nodeIds.delete(i);try{n.close()}catch(s){t.push(s)}}if(t.length)throw new AggregateError(t,"Source branch close failed")}rebindBranch(e){let t=this.#h(e);for(let n of t)this.bindingFor(n)?.rebind();for(let n of t)this.renderer.project(n);for(let n of t)this.bindingFor(n)?.remote?.update()}handleSourceEvent(e){let{evt:t,node:n}=e,i=[],s=a=>{try{this.closeBranch(a)}catch(o){i.push(o)}};try{if(t==="ins")this.#c(n);else if(t==="del")for(let a of Array.isArray(n)?n:[n])s(a);else if(t==="upd_value"||t==="upd_value_attr"){if(e.oldvalue instanceof O)for(let a of e.oldvalue.getNodes())s(a);this.inlineCompiler.release(n,[""]),t==="upd_value_attr"?this.#u(n,e.attrs_diff):this.#p(n).rebind(),n.value instanceof O&&this.#c(n.value)}else if(t==="upd_attrs")this.#u(n,e.attrs_diff);else throw new Error(`Unsupported Source event: ${t}`)}catch(a){throw i.length?new AggregateError([...i,a],"Source event failed"):a}return i}branchBuilt(e){let t=[];for(let n of this.#h(e)){let i=this.bindingFor(n);!i||i.hasStamp("built")||!this.renderer.attached(n)||(i.stamp("built"),t.push(i))}for(let n of t)this.renderer.attached(n.node)&&this.#l(n,"built","_onBuilt");if(this.gramlot.state==="started")for(let n of t)this.renderer.attached(n.node)&&this.#f(n)}pageStarted(){for(let e of[...this.#t.values()])!e.closed&&e.hasStamp("built")&&this.#f(e)}dispose(){if(this.disposed)return;this.#o=!0,this.root.unsubscribe(this.#a,{any:!0}),this.nodeIds.clear();let e=[];for(let[t,n]of[...this.#t.entries()].reverse()){this.#t.delete(t);try{n.close()}catch(i){e.push(i)}}if(e.length)throw new AggregateError(e,"Binding cleanup failed")}#c(e){if(!(e instanceof O)&&this.bindingFor(e))return;let t=e instanceof O?e.getNodes().flatMap(s=>this.#h(s)):this.#h(e),n=new Set(t.filter(s=>this.bindingFor(s))),i=new Map;for(let s of t){let a=s.getAttr("node_id");if(a!=null){if(i.has(a)||this.nodeIds.has(a)&&this.nodeIds.get(a)!==s)throw new Error(`Duplicate node_id '${a}'`);i.set(a,s)}}for(let[s,a]of i)this.nodeIds.set(s,a);try{this.installer.install(e);for(let s of t)this.openBinding(s);for(let s of t)this.bindingFor(s).registerPointers()}catch(s){let a=[s];for(let o of t.filter(l=>!n.has(l)).reverse()){let l=o.getAttr("node_id");i.get(l)===o&&this.nodeIds.get(l)===o&&this.nodeIds.delete(l);let u=this.bindingFor(o);if(u){this.#t.delete(o);try{u.close()}catch(c){a.push(c)}}}throw a.length>1?new AggregateError(a,"Source branch installation failed"):s}for(let s of t){let a=this.bindingFor(s);if(!(!a||a.hasStamp("init")||!this.renderer.attached(s))&&(a.stamp("init"),fc(s.getAttr("_init"))))for(let o of a.providers)o.invoke({kind:"init",change:null})}}#f(e){e.hasStamp("start")||(e.stamp("start"),this.#l(e,"start","_onStart"),e.remote?.update())}#l(e,t,n){let i=e.node.getAttr(n);if(fc(i))for(let s of e.providers){if(typeof i!="number"||i<=0){s.invoke({kind:t,change:null});continue}let a=null,o=setTimeout(()=>{a(),s.invoke({kind:t,change:null})},i);a=e.track(()=>clearTimeout(o))}}#u(e,t){let n=this.#p(e);if(this.inlineCompiler.release(e,Object.keys(t)),Object.hasOwn(t,"node_id")){let{old:i,new:s}=t.node_id;if(s!=null&&this.nodeIds.has(s)&&this.nodeIds.get(s)!==e)throw new Error(`Duplicate node_id '${s}'`);this.nodeIds.get(i)===e&&this.nodeIds.delete(i),s!=null&&this.nodeIds.set(s,e)}pg.some(i=>Object.hasOwn(t,i))?this.rebindBranch(e):n.rebind()}#p(e){let t=this.bindingFor(e);if(!t)throw new Error(`${e.nodeTag??"fragment"} '${e.label}': the node has no NodeBinding (its installation failed); remove it from the Source and insert it again`);return t}#h(e){let t=[e];if(e.value instanceof O)for(let n of e.value.getNodes())t.push(...this.#h(n));return t}};function fc(r){return r===!0||typeof r=="number"}var Za=class{#e;#t;#r=!1;#i=[];#n=[];#s=new Set;#a=null;#o=null;#c=new Set;#f=0;#l=new Set;constructor(e,t){this.#e=e,this.#t=t}get runtime(){return this.#e}get node(){return this.#t}get closed(){return this.#r}get registrations(){return[...this.#n]}get providers(){return this.#a?[this.#a]:[]}get remote(){return this.#o}get clickCount(){return this.#f}countClick(){return++this.#f}hasStamp(e){return this.#s.has(e)}stamp(e){this.#s.add(e)}registerPointers(){this.node._getMeta("data_element")&&(this.runtime.renderer.references.remove(this.node),this.runtime.renderer.references.register(this.node,null));let e=this.node,t=e._getMeta("data_element");if(t&&!dc[e.nodeTag])return;!t&&typeof e.getAttr("remote")=="string"&&(this.#o??=new ws(this));let n=new Set;if(this.remote){for(let[i,s]of Object.entries(e.getAttr()))if(i.startsWith("remote_"))for(let a of at(e,s))n.add(a)}for(let[i,s]of e.pointers()){if(t&&i!=="datapath")continue;let o=(i==="datapath"?e.parentNode:e).absDatapath(s);if(o===null)continue;let[l,u=null]=o.split("?",2),c=this.runtime.router.register({path:l,attr:u,recipient:this});this.#n.push(c),i==="datapath"&&this.#l.add(c),this.remote&&(i==="remote"||i.startsWith("remote_")||n.has(i))&&this.#c.add(c)}if(!t){this.#u();return}this.#a??=new dc[e.nodeTag](this),this.#a.register()}#u(){let e=this.node,t=this.runtime.gramlot._subscriptions;for(let[n,i]of Object.entries(e.getAttr())){let s=n.startsWith("selfsubscribe_")?"selfsubscribe_":n.startsWith("subscribe_")?"subscribe_":null;if(!s)continue;if(typeof i!="string"||!i)throw new TypeError(`${n} requires a handler`);let a=s==="selfsubscribe_"?t.topicFor(e,n.slice(s.length)):n.slice(s.length),o=t.subscribe(a,l=>{if(this.closed)return;if(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(i)){let{group:f,method:p}=this.runtime.logicRegistry.resolve(i,e);return p.call(f,e,l)}let[,u]=e.builder.runtimeValues(e),c=Object.fromEntries(Object.entries(u).filter(([f])=>!f.startsWith("subscribe_")&&!f.startsWith("selfsubscribe_"))),d={...this.runtime.renderer.references.resolveArguments(c),p_0:l};return this.runtime.inlineCompiler.compile(e,n,i,Object.keys(d))(d)});this.#n.push({close:()=>t.unsubscribe(o)})}}rebind(){this.#p(),this.registerPointers()}receive(e){if(this.#l.has(e.registration)){this.runtime.rebindBranch(this.node);return}this.#c.has(e.registration)&&this.remote.update(),this.runtime.renderer.project(this.node,e)}track(e){if(this.closed)throw new Error(`NodeBinding of '${this.node.label}' is closed`);return this.#i.push(e),()=>{let t=this.#i.indexOf(e);t!==-1&&this.#i.splice(t,1)}}close(){if(this.closed)return;this.#r=!0,this.node._getMeta("data_element")&&this.runtime.renderer.references.remove(this.node),this.#p();let e=[];for(let t of this.#i.splice(0).reverse())try{t()}catch(n){e.push(n)}if(e.length)throw new AggregateError(e,`NodeBinding of '${this.node.label}' cleanup failed`)}#p(){for(let e of this.#n.splice(0))e.close();this.#l.clear(),this.#c.clear()}};var Hn=class extends nr{static renderType="object";#e=new Set;#t=new WeakMap;#r=new WeakMap;#i=new WeakMap;constructor(e,t,n,{binding:i}={}){if(super(e),!(e instanceof Oe)||!(t instanceof be)||n?.nodeType!==1)throw new TypeError("GramlotRenderer requires a BuilderBase, GramlotBuilderBag and HTML destination");if(!(i instanceof Gr))throw new TypeError("GramlotRenderer requires a BindingRuntime");if(!(t._builder instanceof Oe))throw new TypeError("SourceBag requires builder ownership");this._binding=i,this.source=t,this.destination=n,this.html=new as({metadataAttributes:["__ref"],invokeScript:(s,a,o,l)=>this.inlineCompiler.compile(s,a,o,s.parentNode._getMeta("gramlot_component").childParameters[a].inline)(l)}),this.records=new Map,this.references=new qn(t),this.pending=[],this.building=!1,this.disposed=!1,this.elements=new WeakMap,this.instanceId=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,"0")).join(""),this.radioGroups=new ss(this),this.subscription=`html-source-renderer-${this.instanceId}`,t.subscribe(this.subscription,{any:s=>this.receive(s)})}get binding(){return this._binding}get inlineCompiler(){return this.binding.inlineCompiler}evaluateExpressions(e,t){let n=this.#r.get(e)??super.evaluateExpressions(e,t),i=e._getMeta("gramlot_component");if(i?.presentationDefaults.length){let s=e.getAttr();this.#i.set(e,Object.fromEntries(Object.entries(n).filter(([a])=>Object.hasOwn(s,a)&&i.presentationDefaults.some(o=>a.startsWith(o)))))}if(i&&(i.parameters.value?.binding==="twoWay"||i.presentationDefaults.length)){let s=[];for(let a=e.parentNode;a;a=a.parentNode)this.#i.has(a)&&s.unshift(this.#i.get(a));n=Object.assign({},...s,n)}return this.#r.delete(e),this.#t.set(e,n),n}render(e,t={}){if(!(e instanceof rr))throw new TypeError("Source children must be GramlotBuilderBagNodes");if(e._getMeta("data_element")||!this.binding.bindingFor(e)&&this.#o(e))return null;if(e.nodeTag)this.html.validate(e,e._getMeta("subbuilder")?e.parentBag._builder:e.builder);else if(!(e.value instanceof O))throw new TypeError("Source fragments must contain child SourceBags");return e.nodeTag?super.render(e,t):this.renderFragment(e,t)}renderFragment(e,{document:t=this.destination.ownerDocument,...n}={}){let i=t.createDocumentFragment(),s={node:e,binding:this.#d(e),container:null,parent:null,children:new Set,cleanup:[],start:t.createComment("source-fragment"),end:t.createComment("/source-fragment")};this.records.set(e,s),this.elements.set(i,s),i.append(s.start);for(let a of e.value.getNodes()){let o=this.render(a,{document:t,...n});if(o===null)continue;i.append(o);let l=this.elements.get(o);l&&(l.parent=s,s.children.add(a))}return i.append(s.end),i}renderedItem(e,t,n,{tag:i,document:s=this.destination.ownerDocument}={}){let a=n;t=this.expressionValue(e,t),this.getRender(e.builder)===this&&(a=this.restoreNativeAttributes(e,n),e._getMeta("gramlot_component")||([t,a]=Ln(t,a,(p,h)=>this._binding.gramlot.format(p,h)))),a=this.componentAttributes(e,a);let o=Array.isArray(t)?t:[],l=Array.isArray(t)?a._text:t,u=this.#t.get(e),c={node:e,binding:this.#d(e),container:null,parent:null,children:new Set,cleanup:[],resolved:u,...this.html.create(e,s,i,a,u.visible??null)};this.html.compose(c,l,o),c.shape=Ce.shape(c.element,u),this.records.set(e,c),this.elements.set(c.element,c);let d=Ce.for(c.binding,c);d&&(c.control=d,d.attach(),c.cleanup.push(()=>d.detach()),this.#u(c,e,a,null));let f=os.for(c.binding,c);f&&(c.button=f,f.attach(),c.cleanup.push(()=>f.detach())),this.#p(c),this.references?.register(e,c.element);for(let p of o){let h=this.elements.get(p);h&&(h.parent=c,h.container=c.element,c.children.add(h.node))}return c.element}validateCandidate(e,{replacingNode:t=null}={}){if(!(e instanceof be))throw new TypeError("Source values must be GramlotBuilderBags");let n=new Set,i=s=>{if(!n.has(s)){n.add(s);for(let a of this.records.get(s)?.children??[])i(a);if(s.value instanceof O)for(let a of s.value.getNodes())i(a)}};for(let s of this.records.get(t)?.children??[])i(s);if(t?.value instanceof O)for(let s of t.value.getNodes())i(s);return this.#n(e,t?t.nodeTag:null),Ya(e),this.references?.validate(e,n),e}#n(e,t=null){let n=new Set,i=(s,a=null)=>{if(!(s instanceof be)||n.has(s))throw new TypeError("Source values must be unshared, acyclic GramlotBuilderBags");if(!(s._builder instanceof Oe))throw new TypeError("SourceBag requires builder ownership");n.add(s);for(let o of s.getNodes()){if(!(o instanceof rr))throw new TypeError("Source children must be GramlotBuilderBagNodes");if(!(o.builder instanceof Oe))throw new TypeError("SourceBagNode requires builder ownership");if(o.resolver)throw new TypeError("Source resolvers are outside this port");if(o._getMeta("data_element"))o.builder.validateNode(o);else if(o.nodeTag){let l=o._getMeta("subbuilder")?s._builder:o.builder;this.html.validate(o,l),o._getMeta("subbuilder")||o.builder.validateParent(o.nodeTag,a)}else{if(!(o.value instanceof O))throw new TypeError("Source fragments must contain child SourceBags");if(Object.keys(o.attr).some(l=>l!=="_meta"))throw new TypeError("Fragment attributes are unsupported")}o.value instanceof O&&i(o.value,o._getMeta("subbuilder")?null:o.nodeTag??a)}};i(e,t)}freeze(e){e=ge(e);let t=this.records.get(e);if(!t||this.disposed)throw new Error("Freeze requires a mounted Source node");t.frozen=!0}unfreeze(e){e=ge(e);let t=this.records.get(e);if(!t||this.disposed)throw new Error("Unfreeze requires a mounted Source node");let n=i=>{delete i.frozen;for(let s of i.children)n(this.records.get(s))};n(t),!this.#s(e)&&(this.attached(e)?this.#m(e):this.remove(e))}#s(e){for(;e;){let t=this.records.get(e);if(t?.frozen)return!0;e=e.parentBag?.parentNode??t?.parent?.node}return!1}receive(e){if(!this.disposed){if(Array.isArray(e.node)){let t=e.node.filter(n=>!this.#e.has(n));if(!t.length)return;e={...e,node:t}}else if(this.#e.has(e.node))return;if(this.pending.push(e),!this.building){this.building=!0;try{for(;this.pending.length;){let t=this.pending.shift();if(t.evt!=="del"&&!this.attached(t.node))continue;t.evt!=="del"&&t.evt!=="upd_attrs"&&this.#c(t);let n=this.binding.handleSourceEvent(t);try{this.#a(t,n)}catch(i){if(!n.length)throw i;n.push(i)}if(n.length)throw n.length===1?n[0]:new AggregateError(n,"Source cleanup failed")}}catch(t){throw this.pending.length=0,t}finally{this.building=!1}}}}#a(e,t){if(e.evt==="del"){for(let n of Array.isArray(e.node)?e.node:[e.node]){if(this.#s(n))continue;let i=this.records.get(n)?.parent??null;try{this.remove(n)}catch(s){t.push(s)}this.#h(i)}return}if(!this.#s(e.node))if(e.evt==="ins")this.insert(e.node);else if(e.evt.startsWith("upd_"))this.update(e.node,e.evt);else throw new Error(`Unsupported Source event: ${e.evt}`)}attached(e){let t=e.parentBag;for(;t&&t!==this.source;)t=t.parentNode?.parentBag;return t===this.source}#o(e){let t=new Set(this.pending.flatMap(n=>Array.isArray(n.node)?n.node:[n.node]));for(let n=e;n;n=n.parentBag?.parentNode)if(t.has(n))return!0;return!1}#c(e){let t=n=>{if(!(n instanceof rr))throw new TypeError("Source children must be GramlotBuilderBagNodes");if(n.value instanceof O){if(!(n.value instanceof be))throw new TypeError("Source values must be GramlotBuilderBags");for(let i of n.value.getNodes())t(i)}};t(e.node)}insert(e){if(!this.attached(e)||this.records.has(e))return;if(e._getMeta("data_element")){this.records.get(e.parentBag?.parentNode)?.button?.refresh(),this.binding.branchBuilt(e);return}let t=this.records.get(e.parentBag?.parentNode),n=t?.element??t?.container??this.destination,i=e.parentBag.getNodes(),s=t?.end??null;for(let a=i.indexOf(e)+1;a<i.length;a++){let o=this.records.get(i[a]);if(o){s=o.element??o.start;break}}this.buildNode(e,n,s,t)}buildNode(e,t,n=null,i=null){this.#e.add(e);let s;try{s=this.render(e,{document:t.ownerDocument})}catch(o){this.#f(e,o)}finally{this.#e.delete(e)}let a=this.records.get(e);return t.insertBefore(s,n),a.parent=i,this.assignContainer(a,t),i?.children.add(e),this.#h(i),this.binding.branchBuilt(e),a}#f(e,t){let n=[t],i=[],s=a=>{if(i.push(a),a.value instanceof O)for(let o of a.value.getNodes())s(o)};s(e);for(let a of i.reverse())try{this.remove(a)}catch(o){n.push(o)}throw n.length===1?t:new AggregateError(n,"Source build and cleanup failed")}assignContainer(e,t){e.container=t;let n=e.element??t;for(let i of e.children){let s=this.records.get(i);s&&this.assignContainer(s,n)}}update(e,t){let n=this.records.get(e);if(!n){this.insert(e);return}let i=e.value==null||["string","number","boolean"].includes(typeof e.value),s=t==="upd_value"&&i&&n.element&&n.children.size===0&&this.html.matches(n,e);(t==="upd_attrs"||s)&&n.element&&this.html.matches(n,e)?(e.nodeTag&&this.html.validate(e,e._getMeta("subbuilder")?e.parentBag._builder:e.builder),this.project(e),t==="upd_attrs"&&this.records.get(e)===n&&(this.references?.remove(e),this.references?.register(e,n.element))):this.#m(e)}project(e,t=null){let n=this.records.get(e);if(!n?.element)return;let i=this.getRender(e.builder),s=this.#i.get(e),[a,o]=e.builder.runtimeValues(e),[,l]=i._handleMeta(e,o),u=this.#t.get(e);if(n.shape!==Ce.shape(n.element,u)){if(this.#s(e))return;this.#r.set(e,u);try{this.#m(e)}finally{this.#r.delete(e)}return}n.resolved=u;let c=e._getMeta("subbuilder")?l:i.adaptAttrs(l),d=e.value instanceof O,f=d?[]:this.expressionValue(e,a);i===this&&(c=this.restoreNativeAttributes(e,c),e._getMeta("gramlot_component")||([f,c]=Ln(f,c,(h,m)=>this._binding.gramlot.format(h,m)))),c=this.componentAttributes(e,c),this.html.update(n,e,c,d?c._text:f,u.visible??null),this.#u(n,e,c,t),n.control?.refresh(),n.button?.refresh(),this.#p(n);let p=this.#i.get(e);if(p){let h=new Set([...Object.keys(s??{}),...Object.keys(p)].filter(m=>!Object.is(s?.[m],p[m])));h.size&&this.#l(e,h)}(n.element.localName==="option"||n.element.localName==="optgroup")&&this.#h(n.parent)}#l(e,t){if(e.value instanceof O)for(let n of e.value.getNodes()){let i=n._getMeta("gramlot_component"),s=n.getAttr(),a=t;i?.presentationDefaults.length?a=new Set([...t].filter(o=>!Object.hasOwn(s,o))):i?.parameters.value?.binding==="twoWay"&&[...t].some(o=>!Object.hasOwn(s,o))&&this.project(n),a.size&&this.#l(n,a)}}componentAttributes(e,t){let n=e._getMeta("gramlot_component"),i=e.parentNode?._getMeta("gramlot_component")?.childParameters;if(!n&&!i)return t;let s=this.#t.get(e),a=Object.fromEntries([...new Set([...Object.keys(n?.parameters??{}),...Object.keys(i??{}),...Object.keys(s).filter(o=>o.startsWith("validate_"))])].filter(o=>Object.hasOwn(s,o)).map(o=>[o,s[o]]));return{...t,...a}}#u(e,t,n,i){if(!e.control)return;let s=t.getAttr("value")!=null;(s||e.valueDeclared)&&e.control.project(n.value??null,i),e.valueDeclared=s}#p(e){let t=new Map(Un.declared(e.node).map(n=>[n[0],n]));if(!e.events){if(!t.size)return;e.events=new Map,e.cleanup.push(()=>{for(let n of e.events.values())n.detach();e.events.clear()})}for(let[n,i]of[...e.events])t.get(n)?.[2]!==i.handler&&(i.detach(),e.events.delete(n));for(let[n,[,i,s]]of t){if(e.events.has(n))continue;let a=new Un(e.binding,e,i,s,n);a.attach(),e.events.set(n,a)}}#h(e){for(let t=e;t;t=t.parent){if(t.control instanceof jn){this.project(t.node);return}if(t.element&&t.element.localName!=="optgroup")return}}getDomNode(e){let t=ge(e),n=this.records.get(t);return n&&this.attached(t)?n.element??null:null}getBaseSourceNode(e){for(let t=e;t;t=t.parentNode){let n=t.nodeType===1?this.elements.get(t):null;if(n)return this.attached(n.node)?n.node:null}return null}#d(e){let t=this.binding.bindingFor(e);if(!t)throw new Error(`${e.nodeTag??"fragment"} '${e.label}': rendered without an open NodeBinding`);return t}#m(e){let t=this.records.get(e),n=t.element?.nextSibling??t.end?.nextSibling??null,i=t.container,s=t.parent,a=null;try{this.remove(e)}catch(o){a=o}try{this.buildNode(e,i,n,s)}catch(o){throw a?new AggregateError([a,o],"Source replacement cleanup and commit failed"):o}if(a)throw a}onDispose(e,t){let n=this.records.get(e);if(!n)throw new Error("Source node is not mounted");return n.cleanup.push(t),()=>{let i=n.cleanup.indexOf(t);i!==-1&&n.cleanup.splice(i,1)}}remove(e){let t=this.records.get(e);if(!t)return;let n=[];for(let i of[...t.children])try{this.remove(i)}catch(s){n.push(s)}for(let i of t.cleanup.splice(0).reverse())try{i()}catch(s){n.push(s)}if(this.references?.remove(e),t.element&&this.elements.delete(t.element),t.element?.remove(),t.start?.remove(),t.end?.remove(),t.parent?.children.delete(e),this.records.delete(e),this.#t.delete(e),this.#i.delete(e),n.length)throw new AggregateError(n,"Source cleanup failed")}dispose(){if(this.disposed)return;this.disposed=!0,this.source.unsubscribe(this.subscription,{any:!0}),this.pending.length=0;let e=[],t=[...this.records.entries()].filter(([,n])=>!n.parent).map(([n])=>n);for(let n of t)try{this.remove(n)}catch(i){e.push(i)}if(e.length)throw new AggregateError(e,"Renderer cleanup failed")}};var hg=new Set(["page","constructor"]);function pc(r,e){if(r===null)return[];let t=r.split("/");for(let n of t)if(hg.has(n))throw new Error(`${e}: a logic group cannot be named '${n}' (group '${r}')`);return t}var mg=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function gg(r){return/^[\w$]/.test(r)?mg.has(r):r!==")"&&r!=="]"}function bg(r,e){let t=!1;for(let n=e+1;n<r.length;n++){let i=r[n];if(i===`
64
+ `)return-1;if(i==="\\"){n++;continue}if(i==="[")t=!0;else if(i==="]")t=!1;else if(i==="/"&&!t)return n}return-1}function _g(r){let e=0,t="",n="";for(let i=r.indexOf("{");i<r.length;i++){let s=r[i];if(s==="/"&&r[i+1]==="/"){if(i=r.indexOf(`
65
+ `,i),i<0)break;continue}if(s==="/"&&r[i+1]==="*"){let a=r.indexOf("*/",i+2);if(a>=0){i=a+1;continue}}if(s==="/"&&gg(n)){let a=bg(r,i);if(a>=0){i=a,n=")";continue}}if(s==='"'||s==="'"||s==="`"){let a=i+1;for(;a<r.length&&r[a]!==s;)a+=r[a]==="\\"?2:1;e===1&&(t+=r.slice(i+1,a)==="constructor"?" constructor":' ""'),i=a,n=")";continue}if(/[\w$]/.test(s)){let a=i+1;for(;a<r.length&&/[\w$]/.test(r[a]);)a++;e===1&&(t+=r.slice(i,a)),n=r.slice(i,a),i=a-1;continue}if(/\s/.test(s)||(n=s),s==="{"){++e===2&&(t+=" {}");continue}if(s==="}"){e--;continue}e===1&&(t+=s)}return/(?<![\w$.#])(?<!\bstatic\s+)constructor\s*\(/.test(t)}function hc(r,e){if(typeof r!="function"||!/^class\b/.test(Function.prototype.toString.call(r)))throw new Error(`${e}: the module exports no class Logic`);if(Object.getPrototypeOf(r)!==Function.prototype||Object.getPrototypeOf(r.prototype)!==Object.prototype)throw new Error(`${e}: class Logic cannot extend another class`);if(_g(Function.prototype.toString.call(r)))throw new Error(`${e}: class Logic cannot declare a constructor; state lives on the group or the page`);let t=[];for(let n of Reflect.ownKeys(r.prototype)){if(n==="constructor")continue;if(typeof n=="symbol")throw new Error(`${e}: class Logic cannot declare symbol keys (${String(n)})`);let i=Object.getOwnPropertyDescriptor(r.prototype,n);if(i.get||i.set)throw new Error(`${e}: class Logic cannot declare the accessor '${n}'`);if(typeof i.value!="function")throw new Error(`${e}: Logic.prototype.${n} is not a method`);if(n==="page")throw new Error(`${e}: a logic method cannot be named 'page'`);t.push([n,i.value])}return t}function mc(r,e,t){Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}var sr=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get page(){return this.#t}},Xr=class{#e;#t=new Map;constructor(e){this.#e=e,e.logic=new sr(this,e)}get gramlot(){return this.#e}static check(e){let t=new Map;for(let{group:n,resource:i}of e){let s=pc(n,i);for(let a=0;a<s.length;a++){let o=s.slice(0,a).join("/");t.has(o)||t.set(o,new Set),t.get(o).add(s[a])}}for(let{logicClass:n,group:i,resource:s}of e){let a=t.get(i??"")??new Set;for(let[o]of hc(n,s))if(a.has(o))throw new Error(`${s}: the logic method '${o}' has the name of a child group`)}}register(e,{group:t=null,resource:n}){let i=pc(t,n),s=hc(e,n),a=this.#e.logic;for(let o of i){let l=Object.getOwnPropertyDescriptor(a,o)?.value;if(l===void 0){let u=new sr(this,this.#e);mc(a,o,u),a=u}else if(l instanceof sr)a=l;else throw new Error(`${n}: the group '${o}' has the name of a logic method`)}for(let[o,l]of s){if(Object.getOwnPropertyDescriptor(a,o)?.value instanceof sr)throw new Error(`${n}: the logic method '${o}' has the name of a child group`);mc(a,o,l)}this.#t.has(a)||this.#t.set(a,[]),this.#t.get(a).push(n)}resolve(e,t){let n=e.split("."),i=n.pop(),s=this.#e.logic;for(let o=0;o<n.length;o++)if(s=Object.getOwnPropertyDescriptor(s,n[o])?.value,!(s instanceof sr))throw new Error(`${t.nodeTag} '${t.label}': named logic '${e}' not found: no resource was registered for the group '${n.slice(0,o+1).join("/")}'`);let a=Object.getOwnPropertyDescriptor(s,i)?.value;if(typeof a!="function"){let o=this.#t.get(s)??[],l=n.length?`the group '${n.join("/")}'`:"the page logic";throw new Error(`${t.nodeTag} '${t.label}': named logic '${e}' not found: ${l} has no method '${i}' (resources: ${o.join(", ")||"none"})`)}return{group:s,method:a}}};var Gn=class extends Fe{constructor(e,{collections:t,destination:n}){super(e),e.src=this,this.logicRegistry=new Xr(e),this.builder=new Ge(null,{collections:t}),this.binding=new Gr(e),this.builder.binding=this.binding,this.binding.attach(),this.source=this.builder.source,this.renderer=new Hn(this.builder,this.source,n,{binding:this.binding})}startSource(e){if(!["ready","failed"].includes(this.gramlot.state))throw new Error(`Cannot start embedded Source while Gramlot is ${this.gramlot.state}`);try{return this.mountMainSource(e)}catch(t){throw this.gramlot.state="failed",t}}mountMainSource(e){let t=this.prepareSource(e);this.renderer.validateCandidate(t);try{this.source.setItem("main",t)}catch(n){throw this.binding.bindingFor(this.source.getNode("main"))||this.source.popNode("main"),n}return this.gramlot.state="started",this.binding.pageStarted(),this.gramlot._subscriptions.ready(),this.gramlot}prepareSource(e,t=this.builder){if(e instanceof O){if(!(e instanceof be))throw new TypeError("Source values must be GramlotBuilderBags");return e.bindBuilder(t).activateCode()}if(typeof e!="string")throw new TypeError("Source value did not decode to SourceBag");let n=Oa(e,t);if(!(n instanceof be))throw new TypeError("Source values must be GramlotBuilderBags");return n.activateCode()}async remoteSource(e,t,n={}){let i=this.gramlot.rpc;if(!i.transport?.call)throw new Error("Remote Source is unavailable without a server transport");let s=this.binding.bindingFor(e);if(this.gramlot.state!=="started"||!s)throw new Error("Remote Source target is not mounted");i.remoteRequests.get(e)?.controller.abort();let a={controller:new AbortController};i.remoteRequests.set(e,a);let o=s.track(()=>a.controller.abort()),l=!1,u=()=>this.gramlot.state!=="disposed"&&!a.controller.signal.aborted&&i.remoteRequests.get(e)===a&&!s.closed;try{let c=await i.call("source",t,n,{signal:a.controller.signal});if(!u())return!1;let d=this.prepareSource(c,e.builder);return u()?(this.renderer.validateCandidate(d,{replacingNode:e}),l=!0,o(),e.setValue(d,!0,{_text:null},!0),!0):!1}catch(c){if(!l&&!u())return!1;throw c}finally{o(),i.remoteRequests.get(e)===a&&i.remoteRequests.delete(e)}}};var wg=()=>Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)),r=>r.toString(16).padStart(2,"0")).join(""),ys=class extends Error{name="RpcError";constructor({code:e,name:t,message:n,details:i}){super(n),this.code=e,this.remoteName=t,i!==void 0&&(this.details=i)}},Xn=class extends Fe{constructor(e,{rpcUrl:t,closeUrl:n,document:i,transport:s}){super(e),this.transport=s===!1?null:s??new Xe(t,{closeUrl:n,navigator:i.defaultView.navigator}),this.remoteRequests=new Map}async call(e,t,n={},{signal:i}={}){if(!this.transport?.call)throw new Error(`rpc '${t}' is unavailable without a server transport`);Vn(n);let s=wg(),a=ce({id:s,pageId:this.gramlot.pageId,contentType:e,name:t,params:n}),o=K(await this.transport.call(a,i));if(o.id!==s)throw new Error("rpc response id mismatch");if(o.error)throw new ys(o.error);return o.value}};var Yn=class extends Fe{setTouchMode(e="auto"){if(!["auto","on","off"].includes(e))throw new TypeError(`Invalid touch mode: ${e}`);let t=this.gramlot.src.renderer.destination.ownerDocument.documentElement;e==="auto"?t.removeAttribute("data-gramlot-touch"):t.setAttribute("data-gramlot-touch",e)}reference(e){return this.gramlot.src.renderer.references.resolve(e)}getBaseSourceNode(e){return this.gramlot.src.renderer.getBaseSourceNode(e)}getDomNode(e){return this.gramlot.src.renderer.getDomNode(e)}};var gc="gramlot:publish",vs=class{#e;#t;#r;#i=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");#n=new Map;#s=!1;#a;#o;#c;#f;constructor(e,t){this.#e=e,this.#r=t,this.#t=t.defaultView,this.#a=i=>this.#h(i),this.#o=i=>{if(i.target?.localName!=="iframe")return;let s=this.#g(i.target);s&&(this.#u(s.window),this.#d(s,{kind:"hello"}))},this.#t.addEventListener("message",this.#a),this.#c=()=>this.#l(),this.#f=()=>this.ready(),this.#t.addEventListener("pagehide",this.#c),this.#t.addEventListener("pageshow",this.#f),t.addEventListener("load",this.#o,!0);let n=this.#m();n&&this.#d(n,{kind:"hello"})}ready(){if(this.#s||this.#e.state!=="started")return;let e=this.#m();e&&this.#d(e,{kind:"ready"});for(let t of this.#r.getElementsByTagName("iframe")){let n=this.#g(t);n&&this.#d(n,{kind:"hello"})}}prepare(e,t){let n=[];if(e.parent){let a=this.#m();if(!a)throw new Error("This page has no parent frame");n.push(a)}if(e.iframe!==void 0){let a=e.iframe,o=ge(a),l=typeof a=="string"?this.#r.getElementById(a):o instanceof Ne?this.#e.dom.getDomNode(o):null,u=this.#g(l);if(!u)throw new Error("iframe destination must be an active Gramlot iframe ID or Source reference");n.push(u)}let i=n.map(a=>{let o=this.#n.get(a.window);if(!o||o.origin!==a.origin)throw new Error("Destination page is not ready");return{...a,session:o.session}});Vn(t);let s=ce(t);return()=>{if(!this.#s)for(let a of i){let o=this.#_(a.window);if(!o||o.origin!==a.origin||this.#n.get(a.window)?.session!==a.session)throw new Error("Destination page disconnected before publication");this.#d(a,{kind:"publish",recipient:a.session,topic:e.topic,wire:s})}}}dispose(){this.#s||(this.#l(),this.#s=!0,this.#t.removeEventListener("message",this.#a),this.#t.removeEventListener("pagehide",this.#c),this.#t.removeEventListener("pageshow",this.#f),this.#r.removeEventListener("load",this.#o,!0))}#l(){for(let[e,t]of this.#n)this.#d({window:e,origin:t.origin},{kind:"close"});for(let e of this.#n.keys())this.#u(e)}#u(e){this.#n.get(e)?.release?.(),this.#n.delete(e)}#p(e,t){this.#u(e.window);let n={session:t,origin:e.origin};e.node&&(n.release=this.#e.src.binding.bindingFor(e.node).track(()=>{this.#d(e,{kind:"close"}),this.#u(e.window)})),this.#n.set(e.window,n)}#h(e){if(this.#s||e.data?.type!==gc)return;let t=this.#_(e.source);if(!t||e.origin!==t.origin)return;let n=e.data;if(!(typeof n.session!="string"||!n.session)){if(n.kind==="hello")this.#u(t.window),n.ready===!0&&this.#p(t,n.session),this.#e.state==="started"&&this.#d(t,{kind:"ready"});else if(n.kind==="ready"){let i=this.#n.get(t.window)?.session!==n.session;this.#p(t,n.session),i&&this.#e.state==="started"&&this.#d(t,{kind:"ready"})}else if(n.kind==="close")this.#n.get(t.window)?.session===n.session&&this.#u(t.window);else if(n.kind==="publish"){if(this.#e.state!=="started"||n.recipient!==this.#i||this.#n.get(t.window)?.session!==n.session||typeof n.topic!="string"||!n.topic||typeof n.wire!="string")return;this.#e.publish(n.topic,K(n.wire))}}}#d(e,t){e.window.postMessage({type:gc,session:this.#i,ready:this.#e.state==="started",...t},e.origin==="null"?"*":e.origin)}#m(){let e=this.#t.parent;return e===this.#t?null:{window:e,origin:this.#b(this.#r.referrer||this.#r.baseURI)}}#g(e){if(e?.localName!=="iframe"||!e.isConnected||!e.contentWindow)return null;let t=this.#e.dom.getBaseSourceNode(e);if(!t||!this.#e.src.binding.bindingFor(t)||this.#e.dom.getDomNode(t)!==e)return null;let n=e.getAttribute("sandbox"),s=n!==null&&!n.split(/\s+/).includes("allow-same-origin")?"null":this.#b(e.hasAttribute("srcdoc")?this.#r.baseURI:e.getAttribute("src")||this.#r.baseURI);return{window:e.contentWindow,origin:s,node:t}}#b(e){let t=new URL(e,this.#r.baseURI);return t.protocol==="file:"?"null":t.origin}#_(e){let t=this.#m();if(t?.window===e)return t;for(let n of this.#r.getElementsByTagName("iframe")){let i=this.#g(n);if(i?.window===e)return i}return null}};var ks=class extends Fe{#e=new Map;#t=new WeakSet;#r=new WeakMap;#i=0;#n=!1;#s;attach(e){this.#s=new vs(this.gramlot,e)}ready(){this.#s.ready()}subscribe(e,t){if(this.#c(),this.#o(e),typeof t!="function")throw new TypeError("subscribe requires a callback");let n=Object.freeze({});return this.#t.add(n),this.#e.has(e)||this.#e.set(e,new Map),this.#e.get(e).set(n,t),n}unsubscribe(e){if(!this.#t.has(e))throw new TypeError("Unknown subscription registration");for(let[t,n]of this.#e)n.delete(e)&&!n.size&&this.#e.delete(t)}publish(e,t={}){if(this.#c(),!t||typeof t!="object"||Array.isArray(t))throw new TypeError("publish requires one object of named data");if(typeof e=="string")return this.#a(e,t);if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError("publish requires a topic string or descriptor");if(Object.keys(e).some(s=>!["topic","nodeId","parent","iframe"].includes(s)))throw new Error("This publication route is not implemented yet");if(this.#o(e.topic),e.parent!==void 0&&typeof e.parent!="boolean")throw new TypeError("parent must be boolean");if(e.iframe==="*")throw new Error("Recursive iframe broadcast is not implemented yet");if((e.parent||e.iframe!==void 0)&&Object.hasOwn(e,"nodeId"))throw new Error("Interframe node addressing is not implemented yet");let i=e.parent||e.iframe!==void 0?this.#s.prepare(e,t):null;if(Object.hasOwn(e,"nodeId")){let s=this.gramlot.src.binding.nodeIds.get(e.nodeId);if(!s)throw new Error(`node_id not found: ${e.nodeId}`);return this.publishNode(s,e.topic,t)}this.#a(e.topic,t),i?.()}topicFor(e,t){this.#o(t),e=ge(e);let n=this.gramlot.src.binding.bindingFor(e);if(!n||n.closed)throw new Error("Topic target is not an active Source node of this page");let i=e.getAttr("node_id");return i==null&&(this.#r.has(e)||this.#r.set(e,`gramlot-self-${++this.#i}`),i=this.#r.get(e)),`${i}_${t}`}publishNode(e,t,n={}){return this.publish(this.topicFor(e,t),n)}dispose(){this.#n=!0,this.#s.dispose(),this.#e.clear()}#a(e,t){this.#o(e);let n=this.#e.get(e);if(n)for(let[i,s]of[...n]){if(this.#n)break;n.has(i)&&s(t)}}#o(e){if(typeof e!="string"||!e)throw new TypeError("A topic must be a nonempty string")}#c(){if(this.#n)throw new Error("Gramlot subscriptions are disposed")}};var bc=2e3;function yg(r){if(!(r instanceof Date))return String(r??"");let e=r.toISOString();return e.endsWith("T00:00:00.000Z")?e.slice(0,10):e}var Zn=class{constructor(e,t){this.gramlot=e,this.document=t}branch(e){let t=this.gramlot.data.getItem(e);if(!(t instanceof V))throw new Error(`gramlot.utl.inout: no data Bag at '${e}'`);return t}mailText(e){let t=[],n=(i,s)=>{for(let a of i.getNodes()){let o=s+a.label;a.value instanceof V?n(a.value,`${o}.`):t.push(`${o}: ${yg(a.value)}`)}};return n(this.branch(e),""),t.join(`
66
+ `)}mailtoUrl(e,t){let n=`mailto:${encodeURIComponent(t)}?subject=${encodeURIComponent(this.document.title)}&body=${encodeURIComponent(this.mailText(e))}`;if(n.length>bc)throw new Error(`gramlot.utl.inout.sendMail: the email of '${e}' is ${n.length} characters long, over the mailto: limit of ${bc}; send it with sendHttp or save it as a file`);return n}sendMail(e,t){this.open(this.mailtoUrl(e,t))}async sendHttp(e,t){let n=JSON.stringify(this.branch(e).asDict(!1,!1,!0)),i=await this.document.defaultView.fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:n});if(!i.ok)throw new Error(`gramlot.utl.inout.sendHttp: ${t} answered ${i.status}`);return i}save(e,t){this.saveText(this.branch(e).toTytx(),t,"application/json")}restore(e){let t=this.document.createElement("input");return t.type="file",t.accept=".json,application/json",new Promise((n,i)=>{t.addEventListener("change",async()=>{try{let s=K(await t.files[0].text());if(!(s instanceof V))throw new TypeError("the file must contain a typed Bag");this.gramlot.data.setItem(e,s),n(s)}catch(s){i(new Error(`gramlot.utl.inout.restore: the file is not a saved Gramlot branch: ${s.message}`,{cause:s}))}},{once:!0}),t.click()})}download(e,t,n){if(!["json","xml"].includes(n))throw new Error(`gramlot.utl.inout.download: format '${n}' is not 'json' or 'xml'`);let i=this.branch(e);if(n==="json")this.saveText(i.toJson(!1),t,"application/json");else{let s=e.split(".").at(-1);this.saveText(`<?xml version='1.0' encoding='UTF-8'?>
67
+ <${s}>${i.toXml()}</${s}>`,t,"application/xml")}}saveText(e,t,n){let i=this.document.defaultView,s=i.URL.createObjectURL(new i.Blob([e],{type:n}));this.open(s,t),i.setTimeout(()=>i.URL.revokeObjectURL(s),1e3)}open(e,t=null){let n=this.document.createElement("a");n.href=e,t!==null&&(n.download=t),n.click()}};var Jn=class extends Fe{constructor(e,t){super(e),this.inout=new Zn(e,t)}};var Kn=class{constructor({pageId:e,rpcUrl:t="/gramlot/rpc",closeUrl:n="/gramlot/close",rootId:i="gramlot-root",capabilities:s=[],element:a=null,document:o=a?.ownerDocument??globalThis.document,transport:l=null,collections:u=[],locale:c=null,timeZone:d=null,devices:f=[]}={}){Qi.register(o.defaultView);for(let h of u)h instanceof tr&&h.register(o.defaultView);this.pageId=e;let p=c==null||d==null?o.defaultView.Intl.DateTimeFormat().resolvedOptions():null;this.devices=Object.freeze([...f]),this.locale=c??p.locale,this.timeZone=d??p.timeZone,Object.defineProperty(this,"_subscriptions",{value:new ks(this)}),this.capabilities=Object.freeze([...s]),this.src=new Gn(this,{collections:u,destination:a??o.getElementById(i)}),this.data=this.src.builder.data,this.rpc=new Xn(this,{rpcUrl:t,closeUrl:n,document:o,transport:l}),this.dom=new Yn(this),this.utl=new Jn(this,o),this.state="ready",this._subscriptions.attach(o),this.abort=new AbortController,this.rpc.transport instanceof Xe&&(this.pagehide=h=>{h.persisted||this.dispose({beacon:!0})},o.defaultView.addEventListener("pagehide",this.pagehide),this.window=o.defaultView)}publish(e,t={}){return this._subscriptions.publish(e,t)}subscribe(e,t){return this._subscriptions.subscribe(e,t)}unsubscribe(e){this._subscriptions.unsubscribe(e)}format(e,t){return Yu(e,t,{locale:this.locale,timeZone:this.timeZone})}start(){return this.state==="disposed"?Promise.reject(new Error("Gramlot is disposed")):this.rpc.transport?this.loading?this.loading:this.state==="started"?Promise.resolve(this):(this.state="loading",this.loading=this.loadMain().finally(()=>{this.loading=null}),this.loading):Promise.reject(new Error("This Gramlot instance has no server transport"))}async loadMain(){try{let e=await this.rpc.call("source","main",{},{signal:this.abort.signal});if(this.state==="disposed")throw new Error("Gramlot was disposed during main");return this.src.mountMainSource(e)}catch(e){throw this.state!=="disposed"&&(this.state="failed"),e}}dispose({beacon:e=!1}={}){if(this.state!=="disposed"){this.state="disposed",this._subscriptions.dispose(),this.pagehide&&this.window.removeEventListener("pagehide",this.pagehide),this.abort.abort();for(let t of this.rpc.remoteRequests.values())t.controller.abort();this.rpc.remoteRequests.clear();try{try{this.src.binding.dispose()}finally{this.src.renderer.dispose()}}finally{this.rpc.transport instanceof Xe&&this.rpc.transport.close(this.pageId,{beacon:e}),this.rpc.transport?.dispose?.()}}}};var Ja=class{constructor({config:e,resources:t,document:n=globalThis.document}){this.config=e,this.resources=t,this.document=n}async run(){let{config:e,resources:t,document:n}=this,i=n.defaultView;for(let c of t.css){let d=n.createElement("link");d.rel="stylesheet",d.href=c,n.head.append(d)}let s=!1,a=c=>{c.persisted||s||(s=!0,this.closePage())};i.addEventListener("pagehide",a);let o,l;try{let c=await Promise.allSettled(t.js.map(({url:d})=>import(new URL(d,n.baseURI).href)));if(s||(o=t.js.map(({url:d,group:f},p)=>{let h=c[p];if(h.status==="rejected")throw new Error(`${d}: import failed: ${h.reason?.message??h.reason}`,{cause:h.reason});return{logicClass:h.value.Logic,group:f,resource:d}}),Xr.check(o),l=await Promise.all((t.collections??[]).map(async d=>{try{return(await import(new URL(d,n.baseURI).href)).default}catch(f){throw new Error(`${d}: collection import failed: ${f.message}`,{cause:f})}})),s))return null;for(let d of l)d.register(i)}catch(c){throw this.closePage(),c}finally{i.removeEventListener("pagehide",a)}let u=new Kn({...e,document:n,collections:[...e.collections??[],...l.map(c=>c.toDocument())]});for(let{logicClass:c,group:d,resource:f}of o)u.src.logicRegistry.register(c,{group:d,resource:f});return i.gramlot=u,await u.start(),u}closePage(){let{rpcUrl:e,closeUrl:t,pageId:n}=this.config;new Xe(e,{closeUrl:t,navigator:this.document.defaultView.navigator}).close(n,{beacon:!0})}};var Es=Symbol("gramlot.source"),Ka=Symbol("gramlot.endpoint"),vg=new Map([[Es,"registerSource"],[Ka,"registerEndpoint"]]);function _c(r,e,t,n){let i=vg.get(t);if(e==="main")throw new TypeError(`${i} cannot declare main`);let s=Object.getOwnPropertyDescriptor(r.prototype,e)?.value;if(typeof s!="function")throw new TypeError(`${i} requires an own method of ${r.name}: ${String(e)}`);if(s[t])throw new TypeError(`${t===Es?"Source method":"Endpoint"} already registered: ${e}`);if(s[Es]||s[Ka])throw new TypeError(`${e} is declared both as Source method and endpoint`);s[t]={auth:n}}var Qn=class{static title="Gramlot";static devices=[];static locale=null;static timeZone=null;static installable=!1;static appIcon=null;manifest({baseUrl:e="./"}={}){let{title:t,appIcon:n}=this.constructor;if(typeof n!="string"||!n)throw new TypeError("An installable Page needs appIcon");return{id:e,name:t,short_name:t,start_url:e,scope:e,display:"standalone",icons:[{src:e+n.replace(/^\/+/,""),sizes:"512x512",type:"image/png"}]}}static css=[];static css_requires="";static js_requires="";static sourceBuilder=Ge;main(e){throw new Error("Page.main(root) must be implemented")}static registerSource(e,{auth:t=null}={}){_c(this,e,Es,t)}static registerEndpoint(e,{auth:t=null}={}){_c(this,e,Ka,t)}};var As=class extends Qn{static title="Application";static logoUrl="";static shellId="index";static navigation=[];static css=["/themes/gramlot-base/theme.css","/themes/gramlot-index/theme.css"];main(e){let t=this.constructor.navigation,n=e.div({class:"index-shell",id:this.constructor.shellId});this.header(n);let i=n.aside({class:"index-sidebar",id:"index-sidebar"}),s=i.header();this.constructor.logoUrl&&s.img({src:this.constructor.logoUrl,alt:this.constructor.title,class:"index-logo"}),s.h1(this.constructor.title);let a=i.nav({"aria-label":"Pages"}).ul({class:"index-list"});for(let f of t){let p=a.li().details({open:f===t[0]});p.summary({tabindex:-1}).a(f.title,{id:`open-${f.key}`,href:`#panel-${f.key}`,class:"index-family",aria_current:null,tabindex:-1});let h=p.ul({class:"index-list"});for(let m of f.children)h.li().a(m.title,{id:`open-${m.key}`,href:m.url,aria_current:null,tabindex:-1})}n.div({class:"index-divider",id:"index-sidebar-divider",role:"separator",aria_orientation:"vertical",tabindex:0,aria_label:"Resize sidebar",aria_controls:"index-sidebar",aria_valuemin:120,aria_valuemax:460,aria_valuenow:240});let o=n.main({class:"index-main"}),l=o.div({class:"index-tabs",role:"tablist",aria_label:"Open pages"});l.html_button("Introduction",{type:"button",role:"tab",id:"tab-intro",aria_controls:"panel-intro",aria_selected:"true",tabindex:-1,hidden:!1});for(let f of t)for(let{key:p,title:h}of[f,...f.children])l.html_button(h,{type:"button",role:"tab",id:`tab-${p}`,aria_controls:`panel-${p}`,aria_selected:"false",tabindex:-1,hidden:!0});let u=o.div({class:"index-panels"}),c=u.section({id:"panel-intro",class:"index-intro",role:"tabpanel",aria_labelledby:"tab-intro",hidden:!1});this.introduction(c);for(let f of t){let p=u.section({id:`panel-${f.key}`,class:"index-category",role:"tabpanel",aria_labelledby:`tab-${f.key}`,hidden:!0});this.groupPanel(p,f);for(let h of f.children)this.panel(u,h)}let d=n.footer({class:"index-footer"});this.footer(d),this.behavior(n)}header(e){}behavior(e){e.dataController({func:"indexMount",_onStart:!0,shell_id:this.constructor.shellId})}introduction(e){e.h2(this.constructor.title),e.p("Choose a page from the navigation. Open pages remain available in tabs.")}groupPanel(e,t){e.h2(t.title)}footer(e){let t=e.div({class:"index-theme"});t.html_label("Theme",{for:"index-appearance"});let n=t.select({id:"index-appearance",value:"compact"});n.option("Base",{value:"base",selected:!1}),n.option("Compact",{value:"compact",selected:!0}),n.option("mimi",{value:"mimi"}),n.option("joanna",{value:"joanna"});let i=e.div({class:"index-theme"});i.html_label("Color mode",{for:"index-theme"});let s=i.select({id:"index-theme",value:"light"});s.option("Light",{value:"light",selected:!0}),s.option("Dark",{value:"dark",selected:!1});let o=e.div({class:"index-keyboard"}).html_label({for:"keyboard-navigation"});if(o.input({type:"checkbox",id:"keyboard-navigation",checked:!1}),o.span("Keyboard navigation"),this.constructor.installable){let l=e.details({class:"index-install"});l.summary("Install app"),l.html_button("Install",{type:"button",id:"index-install-button",hidden:!0}),l.p("",{id:"index-install-status",role:"status"}),l.p("Chrome: use Install page as app in the browser menu. Safari on macOS Sonoma or later: File > Add to Dock."),l.p("Use HTTPS or localhost. For a static export, serve the directory; direct file opening is not installable. Keep the server running for hosted pages.")}}panel(e,t){e.section({id:`panel-${t.key}`,class:"index-panel",role:"tabpanel",aria_labelledby:`tab-${t.key}`,hidden:!0}).iframe({id:`frame-${t.key}`,title:t.title,name:`page-${t.key}`})}};var Qa={base:"",compact:`/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */
68
68
  @layer gramlot.tokens {
69
69
  :root {
70
70
  --gramlot-field-height: 28px;
@@ -190,6 +190,15 @@ ${t}`,{cause:i})}}var ms=class{#e;#t=null;#r=null;constructor(e){this.#e=e}get b
190
190
  /* Gramlot adaptation of legacy mimi; load after Base and Compact. */
191
191
  @layer gramlot.tokens {
192
192
  :root {
193
+ --gramlot-tab-height: 24px;
194
+ --gramlot-tab-padding: 3px 10px;
195
+ --gramlot-tab-radius: 3px;
196
+ --gramlot-tab-gap: 2px;
197
+ --gramlot-tab-strip-padding: 3px;
198
+ --gramlot-tab-background: var(--gramlot-background);
199
+ --gramlot-tab-selected-background: var(--gramlot-surface);
200
+ --gramlot-tab-selected-color: var(--gramlot-ink);
201
+ --gramlot-tab-border: var(--gramlot-border);
193
202
  --gramlot-background: #EDEEF0;
194
203
  --gramlot-surface: #F5F5F6;
195
204
  --gramlot-surface-subtle: #E0E1E3;
@@ -341,6 +350,15 @@ ${t}`,{cause:i})}}var ms=class{#e;#t=null;#r=null;constructor(e){this.#e=e}get b
341
350
  /* Gramlot adaptation of legacy joanna; load after Base and Compact. */
342
351
  @layer gramlot.tokens {
343
352
  :root {
353
+ --gramlot-tab-height: 26px;
354
+ --gramlot-tab-padding: 3px 10px;
355
+ --gramlot-tab-radius: 6px;
356
+ --gramlot-tab-gap: 2px;
357
+ --gramlot-tab-strip-padding: 3px;
358
+ --gramlot-tab-background: var(--gramlot-background);
359
+ --gramlot-tab-selected-background: var(--gramlot-surface);
360
+ --gramlot-tab-selected-color: var(--gramlot-ink);
361
+ --gramlot-tab-border: var(--gramlot-border);
344
362
  --gramlot-background: #F2F2F7;
345
363
  --gramlot-surface: #FFFFFF;
346
364
  --gramlot-surface-subtle: #F2F2F7;
@@ -427,7 +445,7 @@ ${t}`,{cause:i})}}var ms=class{#e;#t=null;#r=null;constructor(e){this.#e=e}get b
427
445
  @layer gramlot.utilities {
428
446
  .card { box-shadow: var(--gramlot-shadow); }
429
447
  }
430
- `};var Ga="index:theme-ready",Xa="index:theme-set",vs=new Set(["light","dark"]),ks=new Set(["base","compact","mimi","joanna"]);function Ya(r,e,t=()=>{},n=()=>{}){let i=r.records.get(e).element,s=i.ownerDocument,a=s.defaultView,o=E=>s.getElementById(E),l=E=>r.elements.get(E).node,u=(E,P)=>l(E).setAttr(P),c=o("keyboard-navigation"),d=o("index-theme"),f=o("index-appearance"),h=o("index-sidebar"),p=o("index-sidebar-divider"),m=o("index-navigation-toggle"),g=o("index-code-toggle"),b=o("index-code"),y=o("index-code-divider"),w=`gramlot.${i.id}.preferences:${a.location.pathname}`,A={};try{let E=JSON.parse(a.localStorage.getItem(w));E!==null&&typeof E=="object"&&!Array.isArray(E)&&(A=E)}catch(E){if(E.name!=="SyntaxError"&&E.name!=="SecurityError")throw E}let C=(E,P,ge)=>{if(!(!E||!ge.has(P))){u(E,{value:P});for(let x of E.options)u(x,{selected:x.value===P})}};C(d,A.theme,vs),C(f,A.appearance,ks);let j=[...i.querySelectorAll(".index-sidebar details")],Y=e.builder.data.constructor,k=new Y,te=new Y;k.setItem("opened",te),k.setItem("keyboard",c?.checked??!1),k.setItem("theme",d?.value??"light"),k.setItem("appearance",f?.value??"compact"),k.setItem("navigationVisible",A.navigationVisible!==!1),k.setItem("codeVisible",A.codeVisible!==!1);let ve=()=>{try{a.localStorage.setItem(w,JSON.stringify({theme:k.getItem("theme"),appearance:k.getItem("appearance"),sidebarWidth:k.getItem("preferredSidebarWidth"),codeWidth:k.getItem("preferredCodeWidth"),navigationVisible:k.getItem("navigationVisible"),codeVisible:k.getItem("codeVisible")}))}catch(E){if(E.name!=="SecurityError"&&E.name!=="QuotaExceededError")throw E}},H=new Map,fe=[],me=e.builder.wrapSource(e.value).style(Wa[f?.value??"compact"]),L=null,Z=!1,O=null,Gr=s.documentElement.getAttribute("data-theme"),J=(E,P,ge)=>{E&&(E.addEventListener(P,ge),fe.push(()=>E.removeEventListener(P,ge)))},st=()=>{if(!L)return;let{handle:E,pointerId:P}=L;L=null,Z||u(i,{data_resizing:null}),E.hasPointerCapture(P)&&E.releasePointerCapture(P)},dr=()=>{if(!Z){Z=!0,O=null,st();for(let E of fe.reverse())E();me.parentBag&&me.parentBag.popNode(me.label),Gr==null?s.documentElement.removeAttribute("data-theme"):s.documentElement.setAttribute("data-theme",Gr)}},U=E=>E.contentWindow.postMessage({type:Xa,theme:k.getItem("theme"),appearance:k.getItem("appearance")},"*"),ke=()=>{s.documentElement.setAttribute("data-theme",k.getItem("theme")),me.setValue(Wa[k.getItem("appearance")]);for(let{frame:E}of H.values())E&&U(E)},bt=()=>t(H,k.getItem("active")),at=()=>{if(m){let E=k.getItem("navigationVisible");u(h,{hidden:!E}),u(p,{hidden:!E}),u(m,{aria_expanded:String(E)}),u(i,{data_navigation_hidden:String(!E)})}if(b){let E=!!H.get(k.getItem("active"))?.code,P=E&&k.getItem("codeVisible");u(b,{hidden:!P}),u(y,{hidden:!P}),u(g,{disabled:!E,aria_expanded:String(P)}),u(i,{data_code_visible:String(P)})}};function As(E){let P=H.get(E);te.getItem(E)||(te.setItem(E,!0),u(P.tab,{hidden:!1}),P.frame&&u(P.frame,{src:P.open.getAttribute("href")})),P.family&&u(P.family,{open:!0});for(let[ge,x]of H){let $=ge===E;u(x.tab,{aria_selected:String($),tabindex:$&&k.getItem("keyboard")?0:-1}),u(x.panel,{hidden:!$}),x.code&&u(x.code,{hidden:!$}),x.open&&u(x.open,{aria_current:$?"page":null})}k.setItem("active",E),at(),bt()}let Ka=()=>Math.max(120,Math.min(460,Math.floor(a.innerWidth*.6))),Qa=()=>u(i,{style:`--sidebar-width: ${k.getItem("sidebarWidth")}px; --code-width: ${k.getItem("codeWidth")??420}px`}),ti=(E,P=!1)=>{let ge=Ka(),x=Math.max(120,Math.min(ge,E));k.setItem("sidebarWidth",x),Qa(),u(p,{aria_valuenow:x,aria_valuemax:ge}),P&&(k.setItem("preferredSidebarWidth",x),ve())},eo=()=>Math.max(200,Math.floor(a.innerWidth*.6)),ri=(E,P=!1)=>{let ge=eo(),x=Math.max(200,Math.min(ge,E));k.setItem("codeWidth",x),Qa(),u(y,{aria_valuenow:x,aria_valuemax:ge}),P&&(k.setItem("preferredCodeWidth",x),ve())},to=(E,P,ge)=>{P.button===0&&(st(),E.setPointerCapture(P.pointerId),L={handle:E,pointerId:P.pointerId,move:ge},u(i,{data_resizing:"true"}),P.preventDefault())};try{let E=o("index-install-button");E&&(J(a,"beforeinstallprompt",x=>{x.preventDefault(),O=x,u(E,{hidden:!1,disabled:!1})}),J(a,"appinstalled",()=>{O=null,u(E,{hidden:!0}),l(o("index-install-status")).setValue("App installed.")}),J(E,"click",async()=>{if(!O)return;let x=O;O=null,u(E,{disabled:!0});try{await x.prompt();let{outcome:$}=await x.userChoice;Z||l(o("index-install-status")).setValue($==="accepted"?"Installation accepted.":"Installation cancelled. You can also use the browser menu.")}catch($){Z||l(o("index-install-status")).setValue(`Installation failed: ${$.message}`)}finally{Z||u(E,{hidden:!0})}})),u(i,{data_resizing:null});let P=A.sidebarWidth,ge=typeof P=="number"&&Number.isFinite(P)&&P>=120&&P<=460?P:h.getBoundingClientRect().width||Number(p.getAttribute("aria-valuenow"));if(k.setItem("preferredSidebarWidth",ge),ti(ge),J(m,"click",()=>{k.setItem("navigationVisible",!k.getItem("navigationVisible")),at(),ve()}),J(g,"click",()=>{k.setItem("codeVisible",!k.getItem("codeVisible")),at(),ve()}),y){let x=A.codeWidth,$=typeof x=="number"&&Number.isFinite(x)&&x>=200?x:420;k.setItem("preferredCodeWidth",$),ri($),J(y,"keydown",ae=>{let Le=k.getItem("codeWidth"),ot=ae.key==="ArrowLeft"?Le+10:ae.key==="ArrowRight"?Le-10:ae.key==="Home"?200:ae.key==="End"?eo():null;ot!=null&&(ae.preventDefault(),ri(ot,!0))}),J(y,"pointerdown",ae=>to(y,ae,Le=>ri(Math.round(i.getBoundingClientRect().right-Le),!0))),J(y,"lostpointercapture",()=>{L?.handle===y&&st()}),J(a,"resize",()=>ri(k.getItem("preferredCodeWidth")))}J(p,"keydown",x=>{let $=k.getItem("sidebarWidth"),ae=x.key==="ArrowLeft"?$-10:x.key==="ArrowRight"?$+10:x.key==="Home"?120:x.key==="End"?Ka():null;ae!=null&&(x.preventDefault(),ti(ae,!0))}),J(p,"pointerdown",x=>to(p,x,$=>ti(Math.round($-i.getBoundingClientRect().left),!0))),J(p,"lostpointercapture",()=>{L?.handle===p&&st()}),J(a,"resize",()=>ti(k.getItem("preferredSidebarWidth")));for(let x of i.querySelectorAll(".index-tabs button")){let $=x.id.slice(4),ae={key:$,tab:x,panel:o(`panel-${$}`),code:o(`codepane-${$}`),open:$==="intro"?null:o(`open-${$}`)};H.set($,ae),x.hidden||te.setItem($,!0),x.getAttribute("aria-selected")==="true"&&k.setItem("active",$),J(x,"click",()=>As($)),ae.open&&J(ae.open,"click",Le=>{Le.preventDefault(),As($)}),J(x,"keydown",Le=>{if(!k.getItem("keyboard")||!["ArrowLeft","ArrowRight","Home","End"].includes(Le.key))return;let ot=[...H.keys()].filter(vc=>te.getItem(vc)),yc=ot.indexOf($),ro=Le.key==="Home"?0:Le.key==="End"?ot.length-1:(yc+(Le.key==="ArrowRight"?1:-1)+ot.length)%ot.length;Le.preventDefault(),As(ot[ro]),H.get(ot[ro]).tab.focus()}),$!=="intro"&&(ae.family=ae.open.closest("details"),n(ae,{byId:o,node:l,set:u,listen:J}),!ae.panel.classList.contains("index-category")&&(ae.frame=o(`frame-${$}`),J(ae.frame,"load",()=>U(ae.frame))))}J(s,"pointermove",x=>{!L||x.pointerId!==L.pointerId||L.move(x.clientX)});for(let x of["pointerup","pointercancel"])J(s,x,$=>{L&&$.pointerId===L.pointerId&&st()});for(let x of j)J(x,"toggle",()=>u(x,{open:x.open}));J(c,"change",()=>{k.setItem("keyboard",c?.checked??!1),u(c,{checked:c?.checked??!1});for(let[x,$]of H)$.open&&u($.open,{tabindex:c?.checked??!1?0:-1}),u($.tab,{tabindex:(c?.checked??!1)&&x===k.getItem("active")?0:-1})}),J(f,"change",()=>{if(!ks.has(f?.value??"compact"))throw new Error("Unknown index appearance");k.setItem("appearance",f?.value??"compact"),u(f,{value:f?.value??"compact"});for(let x of f.options)u(x,{selected:x.value===(f?.value??"compact")});ke(),ve()}),J(d,"change",()=>{if(!vs.has(d?.value??"light"))throw new Error("Index theme must be light or dark");k.setItem("theme",d?.value??"light"),u(d,{value:d?.value??"light"});for(let x of d.options)u(x,{selected:x.value===(d?.value??"light")});ke(),ve()}),J(a,"message",x=>{if(x.data?.type===Ga){for(let{frame:$}of H.values())if($&&$.contentWindow===x.source){U($),bt();break}}}),ke(),at(),bt(),r.onDispose(e,dr)}catch(E){throw dr(),E}return{dispose:dr}}var Es=class{indexMount(e,{shell_id:t}){let n=this.page.src.renderer,i=n.destination.ownerDocument.getElementById(t);this.index=Ya(n,n.elements.get(i).node)}};function ar(r,e){return e===2?r%4===0&&(r%100!==0||r%400===0)?29:28:[4,6,9,11].includes(e)?30:31}function Fe(r,e,t){if(![r,e,t].every(Number.isInteger)||r<1||r>9999||e<1||e>12||t<1||t>ar(r,e))throw new RangeError("Date must exist in Gregorian years 0001\u20139999.");return`${String(r).padStart(4,"0")}-${String(e).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function or(r){if(typeof r!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(r))throw new RangeError("Expected a civil date in YYYY-MM-DD format.");let e=r.split("-").map(Number);return Fe(...e),e}function Kn(r,e,t){let n=r-1,i=365*n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400)+t-1;for(let s=1;s<e;s++)i+=ar(r,s);return i}function Qn(r,e){let t=Kn(...or(r))+e;if(!Number.isSafeInteger(t)||t<0||t>Kn(9999,12,31))throw new RangeError("Date offset exceeds Gregorian years 0001\u20139999.");let n=1,i=1e4;for(;i-n>1;){let a=Math.floor((n+i)/2);Kn(a,1,1)<=t?n=a:i=a}t-=Kn(n,1,1);let s=1;for(;t>=ar(n,s);)t-=ar(n,s++);return Fe(n,s,t+1)}function Za(r){return Qn(r,-(Kn(...or(r))%7))}function hc(r,e,t=0,n=1){let i=r*12+e-1+t,s=Math.floor(i/12),a=(i%12+12)%12+1,o=i+n-1,l=Math.floor(o/12),u=(o%12+12)%12+1;return{start:Fe(s,a,1),end:Fe(l,u,ar(l,u))}}var Ja={it:{months:{gennaio:1,febbraio:2,marzo:3,aprile:4,maggio:5,giugno:6,luglio:7,agosto:8,settembre:9,ottobre:10,novembre:11,dicembre:12,gen:1,feb:2,mar:3,apr:4,mag:5,giu:6,lug:7,ago:8,set:9,ott:10,nov:11,dic:12},weekdays:{luned\u00EC:0,marted\u00EC:1,mercoled\u00EC:2,gioved\u00EC:3,venerd\u00EC:4,sabato:5,domenica:6,lun:0,mar:1,mer:2,gio:3,ven:4,sab:5,dom:6},quarters:{"1\xBA trimestre":1,"2\xBA trimestre":2,"3\xBA trimestre":3,"4\xBA trimestre":4,"1\xB0 trimestre":1,"2\xB0 trimestre":2,"3\xB0 trimestre":3,"4\xB0 trimestre":4,t1:1,t2:2,t3:3,t4:4,q1:1,q2:2,q3:3,q4:4},keywords:{today:["oggi"],yesterday:["ieri"],tomorrow:["domani"],this_week:["questa settimana","settimana"],last_week:["settimana scorsa"],next_week:["settimana prossima"],this_month:["questo mese","mese"],last_month:["mese scorso"],next_month:["mese prossimo"],last:["scorso","scorsa"],next:["prossimo","prossima"],articles:["il","lo","la"],from:["da","dal","dalla","tra","fra"],to:["a","al","alla","e"],no_period:["-","senza periodo","sempre"]},date_order:{default:"DMY"}},en:{months:{january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12,jan:1,feb:2,mar:3,apr:4,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},weekdays:{monday:0,tuesday:1,wednesday:2,thursday:3,friday:4,saturday:5,sunday:6,mon:0,tue:1,wed:2,thu:3,fri:4,sat:5,sun:6},quarters:{"1st quarter":1,"2nd quarter":2,"3rd quarter":3,"4th quarter":4,q1:1,q2:2,q3:3,q4:4},keywords:{today:["today"],yesterday:["yesterday"],tomorrow:["tomorrow"],this_week:["this week","week"],last_week:["last week"],next_week:["next week"],this_month:["this month","month"],last_month:["last month"],next_month:["next month"],last:["last"],next:["next"],articles:["the"],from:["from","between"],to:["to","and"],no_period:["no period","always"]},date_order:{default:"MDY",GB:"DMY",AU:"DMY",IE:"DMY",NZ:"DMY",IN:"DMY"}}};function mc(r){if(typeof r!="string")throw new RangeError("A supported locale is required.");let e=r.replaceAll("-","_"),t=e.indexOf("_"),n=(t<0?e:e.slice(0,t)).toLowerCase(),i=(t<0?"":e.slice(t+1)).toUpperCase();if(!Object.hasOwn(Ja,n))throw new RangeError(`Unsupported locale: ${r}`);let s=Ja[n];return{dictionary:s,phrases:o=>[...new Set([...s.keywords[o],...Ja.en.keywords[o]])],order:s.date_order[i]??s.date_order.default}}var lr=/^(?:\d{4}|\d{2})$/,gc=/^\d{1,2}$/,ei=(r,e)=>({ok:!1,error:{code:r,message:e}}),cr=(r="UNRECOGNIZED_EXPRESSION",e="Text is not a supported date expression.")=>{throw Object.assign(new SyntaxError(e),{code:r})},wc=(r,e)=>Object.hasOwn(r,e);function ur(r,e){if(r.length===4)return Number(r);let t=e.year+e.twoDigitYearAhead-100;return t+((Number(r)-t)%100+100)%100}function _g(r,e){if(r.includes(";")){let i=r.split(";").map(s=>s.trim());return i.length!==2?cr("INVALID_RANGE","A range must have exactly two endpoints."):{bounds:i,range:!0}}if(e.phrases("no_period").includes(r))return{bounds:["",""],range:!0};let t=e.phrases("to"),n=e.phrases("from");for(let i of t)if(r.startsWith(`${i} `))return{bounds:["",r.slice(i.length+1).trim()],range:!0};for(let i of t){let s=` ${i} `;if(!r.includes(s))continue;for(let o of n)if(r.startsWith(`${o} `)){r=r.slice(o.length+1);break}let a=r.split(s).map(o=>o.trim());return a.length!==2?cr("INVALID_RANGE","A range must have exactly two endpoints."):{bounds:a,range:!0}}for(let i of n)if(r.startsWith(`${i} `))return{bounds:[r.slice(i.length+1).trim(),""],range:!0};return{bounds:[r,r],range:!1}}function wg(r,e,t){let n=[[r,0]],i=/^(.+?)\s*([+-])\s*(\d+)$/.exec(r);i&&n.push([i[1],Number(i[2]+i[3])]);let s={today:0,yesterday:-1,tomorrow:1,this_week:0,last_week:-1,next_week:1,this_month:0,last_month:-1,next_month:1};for(let[a,o]of n)for(let[l,u]of Object.entries(s))if(e.phrases(l).includes(a)){if(l.endsWith("_week"))return Qn(Za(e.workdate),(u+o)*7+(t?6:0));if(l.endsWith("_month")){let c=hc(e.year,e.month,u+o);return t?c.end:c.start}return Qn(e.workdate,u+o)}return null}function yg(r,e,t){let n=Object.entries(e.dictionary.quarters).sort((i,s)=>s[0].length-i[0].length);for(let[i,s]of n){let a;if(r===i)a=null;else if(r.startsWith(i)&&lr.test(r.slice(i.length).trim()))a=ur(r.slice(i.length).trim(),e);else if(r.endsWith(i)&&lr.test(r.slice(0,-i.length).trim()))a=ur(r.slice(0,-i.length).trim(),e);else continue;return{year:a,month:t?s*3:s*3-2}}return null}function bc(r,e){if(wc(e.months,r))return e.months[r];let t=/^m(\d{1,2})$/.exec(r);return t&&Number(t[1])>=1&&Number(t[1])<=12?Number(t[1]):null}function vg(r,e){let t=r.split(/\s+/),n=t.map((u,c)=>bc(u,e.dictionary)?c:-1).filter(u=>u>=0);if(!n.length)return null;if(n.length!==1)return cr();let i=n[0],s=bc(t[i],e.dictionary),a=t.slice(0,i),o=t.slice(i+1),l=[...a,...o];if(l.length===1&&e.phrases("last").includes(l[0]))return{year:e.year-(s>e.month?1:0),month:s};if(l.length===1&&e.phrases("next").includes(l[0]))return{year:e.year+(s<e.month?1:0),month:s};if(!l.length)return{year:null,month:s};if(!a.length&&o.length===1&&lr.test(o[0]))return{year:ur(o[0],e),month:s};if(a.length===1&&gc.test(a[0])){if(!o.length)return Fe(e.year,s,Number(a[0]));if(o.length===1&&lr.test(o[0]))return Fe(ur(o[0],e),s,Number(a[0]))}return!a.length&&o.length===2&&gc.test(o[0])&&lr.test(o[1])?Fe(ur(o[1],e),s,Number(o[0])):cr()}function kg(r,e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(r);if(t)return Fe(...t.slice(1).map(Number));let n=/^(\d{1,4})[/\-. ]+(\d{1,4})[/\-. ]+(\d{1,4})$/.exec(r),i={};if(n)e.order.split("").forEach((o,l)=>{i[o]=n[l+1]});else if(/^(?:\d{6}|\d{8})$/.test(r)){let o=r.length===8?4:2;for(let l of e.order){let u=l==="Y"?o:2;i[l]=r.slice(0,u),r=r.slice(u)}}else return null;if(!lr.test(i.Y)||i.D.length>2||i.M.length>2)return cr();let s=Number(i.D),a=Number(i.M);return n&&a>12&&s<=12&&([s,a]=[a,s]),Fe(ur(i.Y,e),a,s)}function _c(r,e,t){if(!r)return null;let n=e.phrases("articles");if(r=r.split(/\s+/).filter(s=>!n.includes(s)).join(" "),!r)return cr();if(lr.test(r))return Fe(ur(r,e),t?12:1,t?31:1);let i=wg(r,e,t)??yg(r,e,t)??vg(r,e);return i!==null?i:wc(e.dictionary.weekdays,r)?Qn(Za(e.workdate),e.dictionary.weekdays[r]):kg(r,e)??cr()}function Eg(r,e,t){if(r===null||typeof r=="string")return r;let n=r.year??t.year,i=typeof e=="string"?or(e)[0]:e?.year,s=typeof e=="string"?or(e)[1]:e?.month;return i&&(n>i&&(n=i),n===i&&r.month>s&&n--),Fe(n,r.month,1)}function Ag(r,e,t){if(r===null||typeof r=="string")return r;let n=r.year??t.year;if(e!==null){let[i,s]=or(e);n<i&&(n=i),n===i&&s>r.month&&n++}return Fe(n,r.month,ar(n,r.month))}function xg(r,e={}){if(!e||typeof e!="object"||Array.isArray(e))return ei("INVALID_CONTEXT","Options must provide a civil workdate and supported locale.");let t;try{let{locale:n="it-IT",workdate:i,twoDigitYearAhead:s=20}=e,[a,o]=or(i);if(!Number.isInteger(s)||s<0||s>99)throw new RangeError("twoDigitYearAhead must be an integer from 0 to 99.");t={...mc(n),workdate:i,year:a,month:o,twoDigitYearAhead:s}}catch(n){return ei("INVALID_CONTEXT",n.message)}if(typeof r!="string")return ei("INVALID_INPUT","Expression must be a string.");try{let n=r.toLowerCase().trim().replaceAll(",",""),{bounds:i,range:s}=_g(n,t),a=_c(i[1],t,!0),o=_c(i[0],t,!1),l=Eg(o,a,t),u=Ag(a,l,t);return!s&&typeof o=="string"&&l===u?{ok:!0,kind:"date",date:l}:{ok:!0,kind:"period",start:l,end:u}}catch(n){if(n instanceof RangeError)return ei("INVALID_DATE",n.message);if(n instanceof SyntaxError)return ei(n.code,n.message);throw n}}export{z as Bag,rt as BagNode,Gn as DomHandler,Zn as Gramlot,Ge as GramlotBuilder,nr as GramlotHtmlRenderer,zn as GramlotRenderer,Fn as GramlotSvgRenderer,$e as Handler,Xe as HttpTransport,Xn as InOut,Es as IndexLogic,ys as IndexPage,Jn as Page,za as PageBootstrap,jn as References,gs as RpcError,Wn as RpcHandler,Hn as SourceHandler,Yn as UtilitiesHandler,Ya as mountIndexPage,xg as parseDateExpression};
448
+ `};var eo="index:theme-ready",to="index:theme-set",xs=new Set(["light","dark"]),Ts=new Set(["base","compact","mimi","joanna"]);function ro(r,e,t=()=>{},n=()=>{},{containerLayout:i=!1,state:s=null}={}){let a=r.records.get(e).element,o=a.ownerDocument,l=o.defaultView,u=k=>o.getElementById(k),c=k=>r.elements.get(k).node,d=(k,j)=>c(k).setAttr(j),f=u("keyboard-navigation"),p=u("index-theme"),h=u("index-appearance"),m=u("index-sidebar"),g=u("index-sidebar-divider"),b=u("index-navigation-toggle"),y=u("index-code-toggle"),w=u("index-code"),A=u("index-code-divider"),S=`gramlot.${a.id}.preferences:${l.location.pathname}`,B={};try{let k=JSON.parse(l.localStorage.getItem(S));k!==null&&typeof k=="object"&&!Array.isArray(k)&&(B=k)}catch(k){if(k.name!=="SyntaxError"&&k.name!=="SecurityError")throw k}let W=(k,j,v)=>{if(!(!k||!v.has(j))){d(k,{value:j});for(let D of k.options)d(D,{selected:D.value===j})}};W(p,B.theme,xs),W(h,B.appearance,Ts);let re=[...a.querySelectorAll(".index-sidebar details")],ue=e.builder.data.constructor,x=s??new ue,Q=new ue;x.setItem("opened",Q),x.setItem("keyboard",f?.checked??!1),x.setItem("theme",p?.value??"light"),x.setItem("appearance",h?.value??"compact"),x.setItem("navigationVisible",B.navigationVisible!==!1),x.setItem("codeVisible",B.codeVisible!==!1);let ne=()=>{try{l.localStorage.setItem(S,JSON.stringify({theme:x.getItem("theme"),appearance:x.getItem("appearance"),sidebarWidth:x.getItem("preferredSidebarWidth"),codeWidth:x.getItem("preferredCodeWidth"),navigationVisible:x.getItem("navigationVisible"),codeVisible:x.getItem("codeVisible")}))}catch(k){if(k.name!=="SecurityError"&&k.name!=="QuotaExceededError")throw k}},ie=new Map,z=[],ee=e.builder.wrapSource(e.value).style(Qa[h?.value??"compact"]),N=null,st=!1,mt=null,dr=o.documentElement.getAttribute("data-theme"),Z=(k,j,v)=>{k&&(k.addEventListener(j,v),z.push(()=>k.removeEventListener(j,v)))},P=()=>{if(!N)return;let{handle:k,pointerId:j}=N;N=null,st||d(a,{data_resizing:null}),k.hasPointerCapture(j)&&k.releasePointerCapture(j)},Ee=()=>{if(!st){st=!0,mt=null,P();for(let k of z.reverse())k();ee.parentBag&&ee.parentBag.popNode(ee.label),dr==null?o.documentElement.removeAttribute("data-theme"):o.documentElement.setAttribute("data-theme",dr)}},gt=k=>k.contentWindow.postMessage({type:to,theme:x.getItem("theme"),appearance:x.getItem("appearance")},"*"),bt=()=>{o.documentElement.setAttribute("data-theme",x.getItem("theme")),ee.setValue(Qa[x.getItem("appearance")]);for(let{frame:k}of ie.values())k&&gt(k)},Cs=()=>t(ie,x.getItem("active")),ni=()=>{if(b){let k=x.getItem("navigationVisible");d(m,i?{drawer:k?!0:"close"}:{hidden:!k}),i||d(g,{hidden:!k}),d(b,{aria_expanded:String(k)}),d(a,{data_navigation_hidden:String(!k)})}if(w){let k=!!ie.get(x.getItem("active"))?.code,j=k&&x.getItem("codeVisible");d(w,i?{hidden:!k,drawer:j?!0:"close"}:{hidden:!j}),i||d(A,{hidden:!j}),d(y,{disabled:!k,aria_expanded:String(j)}),d(a,{data_code_visible:String(j)})}},Ss=!1;function ii(k){if(!Ss){Ss=!0;try{let j=ie.get(k);Q.getItem(k)||(Q.setItem(k,!0),d(i?j.panel:j.tab,{hidden:!1}),j.frame&&d(j.frame,{src:j.open.getAttribute("href")})),j.family&&d(j.family,{open:!0});for(let[v,D]of ie){let H=v===k;i||(d(D.tab,{aria_selected:String(H),tabindex:H&&x.getItem("keyboard")?0:-1}),d(D.panel,{hidden:!H})),D.code&&d(D.code,{hidden:!H}),D.open&&d(D.open,{aria_current:H?"page":null})}x.getItem("active")!==k&&x.setItem("active",k),ni(),Cs()}finally{Ss=!1}}}let so=()=>Math.max(120,Math.min(460,Math.floor(l.innerWidth*.6))),ao=()=>d(a,{style:`--sidebar-width: ${x.getItem("sidebarWidth")}px; --code-width: ${x.getItem("codeWidth")??420}px`}),si=(k,j=!1)=>{let v=so(),D=Math.max(120,Math.min(v,k));x.setItem("sidebarWidth",D),ao(),d(g,{aria_valuenow:D,aria_valuemax:v}),j&&(x.setItem("preferredSidebarWidth",D),ne())},oo=()=>Math.max(200,Math.floor(l.innerWidth*.6)),ai=(k,j=!1)=>{let v=oo(),D=Math.max(200,Math.min(v,k));x.setItem("codeWidth",D),ao(),d(A,{aria_valuenow:D,aria_valuemax:v}),j&&(x.setItem("preferredCodeWidth",D),ne())},lo=(k,j,v)=>{j.button===0&&(P(),k.setPointerCapture(j.pointerId),N={handle:k,pointerId:j.pointerId,move:v},d(a,{data_resizing:"true"}),j.preventDefault())};try{let k=u("index-install-button");if(k&&(Z(l,"beforeinstallprompt",v=>{v.preventDefault(),mt=v,d(k,{hidden:!1,disabled:!1})}),Z(l,"appinstalled",()=>{mt=null,d(k,{hidden:!0}),c(u("index-install-status")).setValue("App installed.")}),Z(k,"click",async()=>{if(!mt)return;let v=mt;mt=null,d(k,{disabled:!0});try{await v.prompt();let{outcome:D}=await v.userChoice;st||c(u("index-install-status")).setValue(D==="accepted"?"Installation accepted.":"Installation cancelled. You can also use the browser menu.")}catch(D){st||c(u("index-install-status")).setValue(`Installation failed: ${D.message}`)}finally{st||d(k,{hidden:!0})}})),d(a,{data_resizing:null}),i){let v=r.binding.gramlot;for(let[fe,_e,Ns]of[[m,"navigationVisible","sidebarWidth"],[w,"codeVisible","codeWidth"]]){let fr=c(fe),pr=B[Ns];typeof pr=="number"&&Number.isFinite(pr)&&pr>0&&d(fe,{width:`${pr}px`});let xc=v.subscribe(`${fr.getAttr("node_id")}_closable_change`,({open:Yr})=>{fr.getAttr("hidden")===!0||fr.getAttr("drawer")===!1||(x.setItem(_e,Yr),d(fe,{drawer:Yr?!0:"close"}),d(_e==="navigationVisible"?b:y,{aria_expanded:String(Yr)}),d(a,{[_e==="navigationVisible"?"data_navigation_hidden":"data_code_visible"]:String(_e==="navigationVisible"?!Yr:Yr)}),ne())});z.push(()=>v.unsubscribe(xc))}let D=a.querySelector("[data-index-regions]"),H=v.subscribe(`${c(D).getAttr("node_id")}_splitter_resize`,({region:fe,size:_e})=>{d(fe==="left"?m:w,{width:_e}),x.setItem(fe==="left"?"preferredSidebarWidth":"preferredCodeWidth",Number.parseFloat(_e)),ne()});z.push(()=>v.unsubscribe(H)),x.setItem("preferredSidebarWidth",B.sidebarWidth),x.setItem("preferredCodeWidth",B.codeWidth)}else{let v=B.sidebarWidth,D=typeof v=="number"&&Number.isFinite(v)&&v>=120&&v<=460?v:m.getBoundingClientRect().width||Number(g.getAttribute("aria-valuenow"));x.setItem("preferredSidebarWidth",D),si(D)}if(Z(b,"click",()=>{x.setItem("navigationVisible",!x.getItem("navigationVisible")),ni(),ne()}),Z(y,"click",()=>{x.setItem("codeVisible",!x.getItem("codeVisible")),ni(),ne()}),!i&&A){let v=B.codeWidth,D=typeof v=="number"&&Number.isFinite(v)&&v>=200?v:420;x.setItem("preferredCodeWidth",D),ai(D),Z(A,"keydown",H=>{let fe=x.getItem("codeWidth"),_e=H.key==="ArrowLeft"?fe+10:H.key==="ArrowRight"?fe-10:H.key==="Home"?200:H.key==="End"?oo():null;_e!=null&&(H.preventDefault(),ai(_e,!0))}),Z(A,"pointerdown",H=>lo(A,H,fe=>ai(Math.round(a.getBoundingClientRect().right-fe),!0))),Z(A,"lostpointercapture",()=>{N?.handle===A&&P()}),Z(l,"resize",()=>ai(x.getItem("preferredCodeWidth")))}i||(Z(g,"keydown",v=>{let D=x.getItem("sidebarWidth"),H=v.key==="ArrowLeft"?D-10:v.key==="ArrowRight"?D+10:v.key==="Home"?120:v.key==="End"?so():null;H!=null&&(v.preventDefault(),si(H,!0))}),Z(g,"pointerdown",v=>lo(g,v,D=>si(Math.round(D-a.getBoundingClientRect().left),!0))),Z(g,"lostpointercapture",()=>{N?.handle===g&&P()}),Z(l,"resize",()=>si(x.getItem("preferredSidebarWidth"))));let j=i?u("index-pages").children:a.querySelectorAll(".index-tabs button");for(let v of j){let D=v.id.slice(i?6:4),H={key:D,tab:v,panel:u(`panel-${D}`),code:u(`codepane-${D}`),open:D==="intro"?null:u(`open-${D}`)};ie.set(D,H),(i?c(v).getAttr("hidden")!==!0:!v.hidden)&&Q.setItem(D,!0),!i&&v.getAttribute("aria-selected")==="true"&&x.setItem("active",D),i||Z(v,"click",()=>ii(D)),H.open&&Z(H.open,"click",fe=>{fe.preventDefault(),ii(D)}),i||Z(v,"keydown",fe=>{if(!x.getItem("keyboard")||!["ArrowLeft","ArrowRight","Home","End"].includes(fe.key))return;let _e=[...ie.keys()].filter(pr=>Q.getItem(pr)),Ns=_e.indexOf(D),fr=fe.key==="Home"?0:fe.key==="End"?_e.length-1:(Ns+(fe.key==="ArrowRight"?1:-1)+_e.length)%_e.length;fe.preventDefault(),ii(_e[fr]),ie.get(_e[fr]).tab.focus()}),D!=="intro"&&(H.family=H.open.closest("details"),n(H,{byId:u,node:c,set:d,listen:Z}),!H.panel.classList.contains("index-category")&&(H.frame=u(`frame-${D}`),Z(H.frame,"load",()=>gt(H.frame))))}if(i){let v=`${a.id}-selection`;x.subscribe(v,{any:D=>{D.node===x.getNode("active")&&ii(x.getItem("active"))}}),z.push(()=>x.unsubscribe(v,{any:!0}))}Z(o,"pointermove",v=>{!N||v.pointerId!==N.pointerId||N.move(v.clientX)});for(let v of["pointerup","pointercancel"])Z(o,v,D=>{N&&D.pointerId===N.pointerId&&P()});for(let v of re)Z(v,"toggle",()=>d(v,{open:v.open}));Z(f,"change",()=>{x.setItem("keyboard",f?.checked??!1),d(f,{checked:f?.checked??!1});for(let[v,D]of ie)D.open&&d(D.open,{tabindex:f?.checked??!1?0:-1}),i||d(D.tab,{tabindex:(f?.checked??!1)&&v===x.getItem("active")?0:-1})}),Z(h,"change",()=>{if(!Ts.has(h?.value??"compact"))throw new Error("Unknown index appearance");x.setItem("appearance",h?.value??"compact"),d(h,{value:h?.value??"compact"});for(let v of h.options)d(v,{selected:v.value===(h?.value??"compact")});bt(),ne()}),Z(p,"change",()=>{if(!xs.has(p?.value??"light"))throw new Error("Index theme must be light or dark");x.setItem("theme",p?.value??"light"),d(p,{value:p?.value??"light"});for(let v of p.options)d(v,{selected:v.value===(p?.value??"light")});bt(),ne()}),Z(l,"message",v=>{if(v.data?.type===eo){for(let{frame:D}of ie.values())if(D&&D.contentWindow===v.source){gt(D),Cs();break}}}),bt(),ni(),Cs(),r.onDispose(e,Ee)}catch(k){throw Ee(),k}return{dispose:Ee}}var Ds=class{indexMount(e,{shell_id:t}){let n=this.page.src.renderer,i=n.destination.ownerDocument.getElementById(t);this.index=ro(n,n.elements.get(i).node)}};function ar(r,e){return e===2?r%4===0&&(r%100!==0||r%400===0)?29:28:[4,6,9,11].includes(e)?30:31}function Le(r,e,t){if(![r,e,t].every(Number.isInteger)||r<1||r>9999||e<1||e>12||t<1||t>ar(r,e))throw new RangeError("Date must exist in Gregorian years 0001\u20139999.");return`${String(r).padStart(4,"0")}-${String(e).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function or(r){if(typeof r!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(r))throw new RangeError("Expected a civil date in YYYY-MM-DD format.");let e=r.split("-").map(Number);return Le(...e),e}function ei(r,e,t){let n=r-1,i=365*n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400)+t-1;for(let s=1;s<e;s++)i+=ar(r,s);return i}function ti(r,e){let t=ei(...or(r))+e;if(!Number.isSafeInteger(t)||t<0||t>ei(9999,12,31))throw new RangeError("Date offset exceeds Gregorian years 0001\u20139999.");let n=1,i=1e4;for(;i-n>1;){let a=Math.floor((n+i)/2);ei(a,1,1)<=t?n=a:i=a}t-=ei(n,1,1);let s=1;for(;t>=ar(n,s);)t-=ar(n,s++);return Le(n,s,t+1)}function no(r){return ti(r,-(ei(...or(r))%7))}function wc(r,e,t=0,n=1){let i=r*12+e-1+t,s=Math.floor(i/12),a=(i%12+12)%12+1,o=i+n-1,l=Math.floor(o/12),u=(o%12+12)%12+1;return{start:Le(s,a,1),end:Le(l,u,ar(l,u))}}var io={it:{months:{gennaio:1,febbraio:2,marzo:3,aprile:4,maggio:5,giugno:6,luglio:7,agosto:8,settembre:9,ottobre:10,novembre:11,dicembre:12,gen:1,feb:2,mar:3,apr:4,mag:5,giu:6,lug:7,ago:8,set:9,ott:10,nov:11,dic:12},weekdays:{luned\u00EC:0,marted\u00EC:1,mercoled\u00EC:2,gioved\u00EC:3,venerd\u00EC:4,sabato:5,domenica:6,lun:0,mar:1,mer:2,gio:3,ven:4,sab:5,dom:6},quarters:{"1\xBA trimestre":1,"2\xBA trimestre":2,"3\xBA trimestre":3,"4\xBA trimestre":4,"1\xB0 trimestre":1,"2\xB0 trimestre":2,"3\xB0 trimestre":3,"4\xB0 trimestre":4,t1:1,t2:2,t3:3,t4:4,q1:1,q2:2,q3:3,q4:4},keywords:{today:["oggi"],yesterday:["ieri"],tomorrow:["domani"],this_week:["questa settimana","settimana"],last_week:["settimana scorsa"],next_week:["settimana prossima"],this_month:["questo mese","mese"],last_month:["mese scorso"],next_month:["mese prossimo"],last:["scorso","scorsa"],next:["prossimo","prossima"],articles:["il","lo","la"],from:["da","dal","dalla","tra","fra"],to:["a","al","alla","e"],no_period:["-","senza periodo","sempre"]},date_order:{default:"DMY"}},en:{months:{january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12,jan:1,feb:2,mar:3,apr:4,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},weekdays:{monday:0,tuesday:1,wednesday:2,thursday:3,friday:4,saturday:5,sunday:6,mon:0,tue:1,wed:2,thu:3,fri:4,sat:5,sun:6},quarters:{"1st quarter":1,"2nd quarter":2,"3rd quarter":3,"4th quarter":4,q1:1,q2:2,q3:3,q4:4},keywords:{today:["today"],yesterday:["yesterday"],tomorrow:["tomorrow"],this_week:["this week","week"],last_week:["last week"],next_week:["next week"],this_month:["this month","month"],last_month:["last month"],next_month:["next month"],last:["last"],next:["next"],articles:["the"],from:["from","between"],to:["to","and"],no_period:["no period","always"]},date_order:{default:"MDY",GB:"DMY",AU:"DMY",IE:"DMY",NZ:"DMY",IN:"DMY"}}};function yc(r){if(typeof r!="string")throw new RangeError("A supported locale is required.");let e=r.replaceAll("-","_"),t=e.indexOf("_"),n=(t<0?e:e.slice(0,t)).toLowerCase(),i=(t<0?"":e.slice(t+1)).toUpperCase();if(!Object.hasOwn(io,n))throw new RangeError(`Unsupported locale: ${r}`);let s=io[n];return{dictionary:s,phrases:o=>[...new Set([...s.keywords[o],...io.en.keywords[o]])],order:s.date_order[i]??s.date_order.default}}var lr=/^(?:\d{4}|\d{2})$/,vc=/^\d{1,2}$/,ri=(r,e)=>({ok:!1,error:{code:r,message:e}}),cr=(r="UNRECOGNIZED_EXPRESSION",e="Text is not a supported date expression.")=>{throw Object.assign(new SyntaxError(e),{code:r})},Ac=(r,e)=>Object.hasOwn(r,e);function ur(r,e){if(r.length===4)return Number(r);let t=e.year+e.twoDigitYearAhead-100;return t+((Number(r)-t)%100+100)%100}function kg(r,e){if(r.includes(";")){let i=r.split(";").map(s=>s.trim());return i.length!==2?cr("INVALID_RANGE","A range must have exactly two endpoints."):{bounds:i,range:!0}}if(e.phrases("no_period").includes(r))return{bounds:["",""],range:!0};let t=e.phrases("to"),n=e.phrases("from");for(let i of t)if(r.startsWith(`${i} `))return{bounds:["",r.slice(i.length+1).trim()],range:!0};for(let i of t){let s=` ${i} `;if(!r.includes(s))continue;for(let o of n)if(r.startsWith(`${o} `)){r=r.slice(o.length+1);break}let a=r.split(s).map(o=>o.trim());return a.length!==2?cr("INVALID_RANGE","A range must have exactly two endpoints."):{bounds:a,range:!0}}for(let i of n)if(r.startsWith(`${i} `))return{bounds:[r.slice(i.length+1).trim(),""],range:!0};return{bounds:[r,r],range:!1}}function Eg(r,e,t){let n=[[r,0]],i=/^(.+?)\s*([+-])\s*(\d+)$/.exec(r);i&&n.push([i[1],Number(i[2]+i[3])]);let s={today:0,yesterday:-1,tomorrow:1,this_week:0,last_week:-1,next_week:1,this_month:0,last_month:-1,next_month:1};for(let[a,o]of n)for(let[l,u]of Object.entries(s))if(e.phrases(l).includes(a)){if(l.endsWith("_week"))return ti(no(e.workdate),(u+o)*7+(t?6:0));if(l.endsWith("_month")){let c=wc(e.year,e.month,u+o);return t?c.end:c.start}return ti(e.workdate,u+o)}return null}function Ag(r,e,t){let n=Object.entries(e.dictionary.quarters).sort((i,s)=>s[0].length-i[0].length);for(let[i,s]of n){let a;if(r===i)a=null;else if(r.startsWith(i)&&lr.test(r.slice(i.length).trim()))a=ur(r.slice(i.length).trim(),e);else if(r.endsWith(i)&&lr.test(r.slice(0,-i.length).trim()))a=ur(r.slice(0,-i.length).trim(),e);else continue;return{year:a,month:t?s*3:s*3-2}}return null}function kc(r,e){if(Ac(e.months,r))return e.months[r];let t=/^m(\d{1,2})$/.exec(r);return t&&Number(t[1])>=1&&Number(t[1])<=12?Number(t[1]):null}function xg(r,e){let t=r.split(/\s+/),n=t.map((u,c)=>kc(u,e.dictionary)?c:-1).filter(u=>u>=0);if(!n.length)return null;if(n.length!==1)return cr();let i=n[0],s=kc(t[i],e.dictionary),a=t.slice(0,i),o=t.slice(i+1),l=[...a,...o];if(l.length===1&&e.phrases("last").includes(l[0]))return{year:e.year-(s>e.month?1:0),month:s};if(l.length===1&&e.phrases("next").includes(l[0]))return{year:e.year+(s<e.month?1:0),month:s};if(!l.length)return{year:null,month:s};if(!a.length&&o.length===1&&lr.test(o[0]))return{year:ur(o[0],e),month:s};if(a.length===1&&vc.test(a[0])){if(!o.length)return Le(e.year,s,Number(a[0]));if(o.length===1&&lr.test(o[0]))return Le(ur(o[0],e),s,Number(a[0]))}return!a.length&&o.length===2&&vc.test(o[0])&&lr.test(o[1])?Le(ur(o[1],e),s,Number(o[0])):cr()}function Tg(r,e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(r);if(t)return Le(...t.slice(1).map(Number));let n=/^(\d{1,4})[/\-. ]+(\d{1,4})[/\-. ]+(\d{1,4})$/.exec(r),i={};if(n)e.order.split("").forEach((o,l)=>{i[o]=n[l+1]});else if(/^(?:\d{6}|\d{8})$/.test(r)){let o=r.length===8?4:2;for(let l of e.order){let u=l==="Y"?o:2;i[l]=r.slice(0,u),r=r.slice(u)}}else return null;if(!lr.test(i.Y)||i.D.length>2||i.M.length>2)return cr();let s=Number(i.D),a=Number(i.M);return n&&a>12&&s<=12&&([s,a]=[a,s]),Le(ur(i.Y,e),a,s)}function Ec(r,e,t){if(!r)return null;let n=e.phrases("articles");if(r=r.split(/\s+/).filter(s=>!n.includes(s)).join(" "),!r)return cr();if(lr.test(r))return Le(ur(r,e),t?12:1,t?31:1);let i=Eg(r,e,t)??Ag(r,e,t)??xg(r,e);return i!==null?i:Ac(e.dictionary.weekdays,r)?ti(no(e.workdate),e.dictionary.weekdays[r]):Tg(r,e)??cr()}function Dg(r,e,t){if(r===null||typeof r=="string")return r;let n=r.year??t.year,i=typeof e=="string"?or(e)[0]:e?.year,s=typeof e=="string"?or(e)[1]:e?.month;return i&&(n>i&&(n=i),n===i&&r.month>s&&n--),Le(n,r.month,1)}function Cg(r,e,t){if(r===null||typeof r=="string")return r;let n=r.year??t.year;if(e!==null){let[i,s]=or(e);n<i&&(n=i),n===i&&s>r.month&&n++}return Le(n,r.month,ar(n,r.month))}function Sg(r,e={}){if(!e||typeof e!="object"||Array.isArray(e))return ri("INVALID_CONTEXT","Options must provide a civil workdate and supported locale.");let t;try{let{locale:n="it-IT",workdate:i,twoDigitYearAhead:s=20}=e,[a,o]=or(i);if(!Number.isInteger(s)||s<0||s>99)throw new RangeError("twoDigitYearAhead must be an integer from 0 to 99.");t={...yc(n),workdate:i,year:a,month:o,twoDigitYearAhead:s}}catch(n){return ri("INVALID_CONTEXT",n.message)}if(typeof r!="string")return ri("INVALID_INPUT","Expression must be a string.");try{let n=r.toLowerCase().trim().replaceAll(",",""),{bounds:i,range:s}=kg(n,t),a=Ec(i[1],t,!0),o=Ec(i[0],t,!1),l=Dg(o,a,t),u=Cg(a,l,t);return!s&&typeof o=="string"&&l===u?{ok:!0,kind:"date",date:l}:{ok:!0,kind:"period",start:l,end:u}}catch(n){if(n instanceof RangeError)return ri("INVALID_DATE",n.message);if(n instanceof SyntaxError)return ri(n.code,n.message);throw n}}export{V as Bag,rt as BagNode,Yn as DomHandler,Kn as Gramlot,Ge as GramlotBuilder,nr as GramlotHtmlRenderer,Hn as GramlotRenderer,Pn as GramlotSvgRenderer,Fe as Handler,Xe as HttpTransport,Zn as InOut,Ds as IndexLogic,As as IndexPage,Qn as Page,Ja as PageBootstrap,qn as References,ys as RpcError,Xn as RpcHandler,Gn as SourceHandler,Jn as UtilitiesHandler,ro as mountIndexPage,Sg as parseDateExpression};
431
449
  /*! Bundled license information:
432
450
 
433
451
  decimal.js/decimal.mjs: