@svgsketch/cli 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env node
2
+ var $$=Object.create;var Rc=Object.defineProperty;var N$=Object.getOwnPropertyDescriptor;var M$=Object.getOwnPropertyNames;var A$=Object.getPrototypeOf,C$=Object.prototype.hasOwnProperty;var Ll=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},O$=(e,t)=>{for(var r in t)Rc(e,r,{get:t[r],enumerable:!0})},T$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of M$(t))!C$.call(e,i)&&i!==r&&Rc(e,i,{get:()=>t[i],enumerable:!(n=N$(t,i))||n.enumerable});return e};var P$=(e,t,r)=>(r=e!=null?$$(A$(e)):{},T$(t||!e||!e.__esModule?Rc(r,"default",{value:e,enumerable:!0}):r,e));var Hm=Ll(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.CHAR=`
3
+ \r -\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}`;wt.S=` \r
4
+ `;wt.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";wt.NAME_CHAR="-"+wt.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";wt.CHAR_RE=new RegExp("^["+wt.CHAR+"]$","u");wt.S_RE=new RegExp("^["+wt.S+"]+$","u");wt.NAME_START_CHAR_RE=new RegExp("^["+wt.NAME_START_CHAR+"]$","u");wt.NAME_CHAR_RE=new RegExp("^["+wt.NAME_CHAR+"]$","u");wt.NAME_RE=new RegExp("^["+wt.NAME_START_CHAR+"]["+wt.NAME_CHAR+"]*$","u");wt.NMTOKEN_RE=new RegExp("^["+wt.NAME_CHAR+"]+$","u");var Fc=9,Lc=10,Bc=13,Vc=32;wt.S_LIST=[Vc,Lc,Bc,Fc];function D$(e){return e>=Vc&&e<=55295||e===Lc||e===Bc||e===Fc||e>=57344&&e<=65533||e>=65536&&e<=1114111}wt.isChar=D$;function j$(e){return e===Vc||e===Lc||e===Bc||e===Fc}wt.isS=j$;function Wm(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}wt.isNameStartChar=Wm;function E$(e){return Wm(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}wt.isNameChar=E$});var Qm=Ll(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.CHAR="-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}";rt.RESTRICTED_CHAR="-\b\v\f-\x7F-\x84\x86-\x9F";rt.S=` \r
5
+ `;rt.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";rt.NAME_CHAR="-"+rt.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";rt.CHAR_RE=new RegExp("^["+rt.CHAR+"]$","u");rt.RESTRICTED_CHAR_RE=new RegExp("^["+rt.RESTRICTED_CHAR+"]$","u");rt.S_RE=new RegExp("^["+rt.S+"]+$","u");rt.NAME_START_CHAR_RE=new RegExp("^["+rt.NAME_START_CHAR+"]$","u");rt.NAME_CHAR_RE=new RegExp("^["+rt.NAME_CHAR+"]$","u");rt.NAME_RE=new RegExp("^["+rt.NAME_START_CHAR+"]["+rt.NAME_CHAR+"]*$","u");rt.NMTOKEN_RE=new RegExp("^["+rt.NAME_CHAR+"]+$","u");var qm=9,Ym=10,Km=13,Zm=32;rt.S_LIST=[Zm,Ym,Km,qm];function z$(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}rt.isChar=z$;function _$(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}rt.isRestrictedChar=_$;function R$(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}rt.isCharAndNotRestricted=R$;function F$(e){return e===Zm||e===Ym||e===Km||e===qm}rt.isS=F$;function Jm(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}rt.isNameStartChar=Jm;function L$(e){return Jm(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}rt.isNameChar=L$});var tg=Ll(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.NC_NAME_START_CHAR="A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";Rr.NC_NAME_CHAR="-"+Rr.NC_NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";Rr.NC_NAME_START_CHAR_RE=new RegExp("^["+Rr.NC_NAME_START_CHAR+"]$","u");Rr.NC_NAME_CHAR_RE=new RegExp("^["+Rr.NC_NAME_CHAR+"]$","u");Rr.NC_NAME_RE=new RegExp("^["+Rr.NC_NAME_START_CHAR+"]["+Rr.NC_NAME_CHAR+"]*$","u");function eg(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}Rr.isNCNameStartChar=eg;function B$(e){return eg(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}Rr.isNCNameChar=B$});var wg=Ll(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.SaxesParser=Ba.EVENTS=void 0;var Va=Hm(),V$=Qm(),rf=tg(),Fr=Va.isS,U$=Va.isChar,ls=Va.isNameStartChar,rg=Va.isNameChar,gg=Va.S_LIST,G$=Va.NAME_RE,X$=V$.isChar,W$=rf.isNCNameStartChar,H$=rf.isNCNameChar,q$=rf.NC_NAME_RE,Wl="http://www.w3.org/XML/1998/namespace",La="http://www.w3.org/2000/xmlns/",Y$={__proto__:null,xml:Wl,xmlns:La},K$={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},$t=-1,jn=-2,ng=0,Z$=1,Uc=2,J$=3,_a=4,Q$=5,eN=6,tN=7,Gc=8,rN=9,nN=10,iN=11,aN=12,Cr=13,Bl=14,Xc=15,oN=16,Wc=17,sN=18,lN=19,Hc=20,uN=21,dN=22,cN=23,ig=24,qc=25,Vl=26,ag=27,fN=28,pN=29,og=30,hN=31,mN=32,Yi=33,gN=34,Yc=35,us=36,Kc=37,yN=38,sg=39,lg=40,vN=41,ug=42,bN=43,xN=44,Zc=9,vn=10,Jc=13,dg=32,cg=33,yg=34,ds=38,vg=39,Ul=45,Gl=47,wN=59,bi=60,Ra=61,er=62,fr=63,bg=91,Fa=93,fg=133,pg=8232,Xl=e=>e===yg||e===vg,xg=[yg,vg],IN=[...xg,bg,er],kN=[...xg,bi,Fa],SN=[Ra,fr,...gg],$N=[...gg,er,ds,bi];function ef(e,t,r){switch(t){case"xml":r!==Wl&&e.fail(`xml prefix must be bound to ${Wl}.`);break;case"xmlns":r!==La&&e.fail(`xmlns prefix must be bound to ${La}.`);break;default:}switch(r){case La:e.fail(t===""?`the default namespace may not be set to ${r}.`:`may not assign a prefix (even "xmlns") to the URI ${La}.`);break;case Wl:switch(t){case"xml":break;case"":e.fail(`the default namespace may not be set to ${r}.`);break;default:e.fail("may not assign the xml namespace to another prefix.")}break;default:}}function NN(e,t){for(let r of Object.keys(t))ef(e,r,t[r])}var MN=e=>q$.test(e),AN=e=>G$.test(e),Ki=0,hg=1,Qc=2;Ba.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var mg={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"},tf=class{constructor(t){this.opt=t??{},this.fragmentOpt=!!this.opt.fragment;let r=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,r){this.nameStartCheck=W$,this.nameCheck=H$,this.isName=MN,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},Y$);let n=this.opt.additionalNamespaces;n!=null&&(NN(this,n),Object.assign(this.ns,n))}else this.nameStartCheck=ls,this.nameCheck=rg,this.isName=AN,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Ki,this.attribList=[];let{fragmentOpt:r}=this;this.state=r?Cr:ng,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=r,this.xmlDeclPossible=!r,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");n="1.0"}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(K$),(t=this.readyHandler)===null||t===void 0||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,r){this[mg[t]]=r}off(t){this[mg[t]]=void 0}makeError(t){var r;let n=(r=this.fileName)!==null&&r!==void 0?r:"";return this.trackPosition&&(n.length>0&&(n+=":"),n+=`${this.line}:${this.column}`),n.length>0&&(n+=": "),new Error(n+t)}fail(t){let r=this.makeError(t),n=this.errorHandler;if(n===void 0)throw r;return n(r),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let r=!1;t===null?(r=!0,t=""):typeof t=="object"&&(t=t.toString()),this.carriedFromPrevious!==void 0&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let n=t.length,i=t.charCodeAt(n-1);!r&&(i===Jc||i>=55296&&i<=56319)&&(this.carriedFromPrevious=t[n-1],n--,t=t.slice(0,n));let{stateTable:a}=this;for(this.chunk=t,this.i=0;this.i<n;)a[this.state].call(this);return this.chunkPosition+=n,r?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:t,i:r}=this;if(this.prevI=r,this.i=r+1,r>=t.length)return $t;let n=t.charCodeAt(r);if(this.column++,n<55296){if(n>=dg||n===Zc)return n;switch(n){case vn:return this.line++,this.column=0,this.positionAtNewLine=this.position,vn;case Jc:return t.charCodeAt(r+1)===vn&&(this.i=r+2),this.line++,this.column=0,this.positionAtNewLine=this.position,jn;default:return this.fail("disallowed character."),n}}if(n>56319)return n>=57344&&n<=65533||this.fail("disallowed character."),n;let i=65536+(n-55296)*1024+(t.charCodeAt(r+1)-56320);return this.i=r+2,i>1114111&&this.fail("disallowed character."),i}getCode11(){let{chunk:t,i:r}=this;if(this.prevI=r,this.i=r+1,r>=t.length)return $t;let n=t.charCodeAt(r);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==pg||n===Zc)return n;switch(n){case vn:return this.line++,this.column=0,this.positionAtNewLine=this.position,vn;case Jc:{let a=t.charCodeAt(r+1);(a===vn||a===fg)&&(this.i=r+2)}case fg:case pg:return this.line++,this.column=0,this.positionAtNewLine=this.position,jn;default:return this.fail("disallowed character."),n}}if(n>56319)return n>=57344&&n<=65533||this.fail("disallowed character."),n;let i=65536+(n-55296)*1024+(t.charCodeAt(r+1)-56320);return this.i=r+2,i>1114111&&this.fail("disallowed character."),i}getCodeNorm(){let t=this.getCode();return t===jn?vn:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:r}=this,{chunk:n}=this;for(;;){let i=this.getCode(),a=i===jn,o=a?vn:i;if(o===$t||t.includes(o))return this.text+=n.slice(r,this.prevI),o;a&&(this.text+=`${n.slice(r,this.prevI)}
6
+ `,r=this.i)}}captureToChar(t){let{i:r}=this,{chunk:n}=this;for(;;){let i=this.getCode();switch(i){case jn:this.text+=`${n.slice(r,this.prevI)}
7
+ `,r=this.i,i=vn;break;case $t:return this.text+=n.slice(r),!1;default:}if(i===t)return this.text+=n.slice(r,this.prevI),!0}}captureNameChars(){let{chunk:t,i:r}=this;for(;;){let n=this.getCode();if(n===$t)return this.name+=t.slice(r),$t;if(!rg(n))return this.name+=t.slice(r,this.prevI),n===jn?vn:n}}skipSpaces(){for(;;){let t=this.getCodeNorm();if(t===$t||!Fr(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,t==="1.0"?(this.isChar=U$,this.getCode=this.getCode10):(this.isChar=X$,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=Z$}sBeginWhitespace(){let t=this.i,r=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),r){case bi:if(this.state=Xc,this.text.length!==0)throw new Error("no-empty text at start");break;case $t:break;default:this.unget(),this.state=Cr,this.xmlDeclPossible=!1}}sDoctype(){var t;let r=this.captureTo(IN);switch(r){case er:{(t=this.doctypeHandler)===null||t===void 0||t.call(this,this.text),this.text="",this.state=Cr,this.doctype=!0;break}case $t:break;default:this.text+=String.fromCodePoint(r),r===bg?this.state=_a:Xl(r)&&(this.state=J$,this.q=r)}}sDoctypeQuote(){let t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=Uc)}sDTD(){let t=this.captureTo(kN);t!==$t&&(this.text+=String.fromCodePoint(t),t===Fa?this.state=Uc:t===bi?this.state=eN:Xl(t)&&(this.state=Q$,this.q=t))}sDTDQuoted(){let t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=_a,this.q=null)}sDTDOpenWaka(){let t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case cg:this.state=tN,this.openWakaBang="";break;case fr:this.state=iN;break;default:this.state=_a}}sDTDOpenWakaBang(){let t=String.fromCodePoint(this.getCodeNorm()),r=this.openWakaBang+=t;this.text+=t,r!=="-"&&(this.state=r==="--"?Gc:_a,this.openWakaBang="")}sDTDComment(){this.captureToChar(Ul)&&(this.text+="-",this.state=rN)}sDTDCommentEnding(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=t===Ul?nN:Gc}sDTDCommentEnded(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===er?this.state=_a:(this.fail("malformed comment."),this.state=Gc)}sDTDPI(){this.captureToChar(fr)&&(this.text+="?",this.state=aN)}sDTDPIEnding(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===er&&(this.state=_a)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this,{chunk:r}=this;e:for(;;)switch(this.getCode()){case jn:this.entity+=`${r.slice(t,this.prevI)}
8
+ `,t=this.i;break;case wN:{let{entityReturnState:n}=this,i=this.entity+r.slice(t,this.prevI);this.state=n;let a;i===""?(this.fail("empty entity name."),a="&;"):(a=this.parseEntity(i),this.entity=""),(n!==Cr||this.textHandler!==void 0)&&(this.text+=a);break e}case $t:this.entity+=r.slice(t);break e;default:}}sOpenWaka(){let t=this.getCode();if(ls(t))this.state=gN,this.unget(),this.xmlDeclPossible=!1;else switch(t){case Gl:this.state=bN,this.xmlDeclPossible=!1;break;case cg:this.state=oN,this.openWakaBang="",this.xmlDeclPossible=!1;break;case fr:this.state=cN;break;default:this.fail("disallowed character in tag name"),this.state=Cr,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=Hc,this.openWakaBang="";break;case"--":this.state=Wc,this.openWakaBang="";break;case"DOCTYPE":this.state=Uc,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(Ul)&&(this.state=sN)}sCommentEnding(){var t;let r=this.getCodeNorm();r===Ul?(this.state=lN,(t=this.commentHandler)===null||t===void 0||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(r)}`,this.state=Wc)}sCommentEnded(){let t=this.getCodeNorm();t!==er?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=Wc):this.state=Cr}sCData(){this.captureToChar(Fa)&&(this.state=uN)}sCDataEnding(){let t=this.getCodeNorm();t===Fa?this.state=dN:(this.text+=`]${String.fromCodePoint(t)}`,this.state=Hc)}sCDataEnding2(){var t;let r=this.getCodeNorm();switch(r){case er:{(t=this.cdataHandler)===null||t===void 0||t.call(this,this.text),this.text="",this.state=Cr;break}case Fa:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(r)}`,this.state=Hc}}sPIFirstChar(){let t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=ig):t===fr||Fr(t)?(this.fail("processing instruction without a target."),this.state=t===fr?Vl:qc):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=ig)}sPIRest(){let{chunk:t,i:r}=this;for(;;){let n=this.getCodeNorm();if(n===$t){this.piTarget+=t.slice(r);return}if(!this.nameCheck(n)){this.piTarget+=t.slice(r,this.prevI);let i=n===fr;i||Fr(n)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=i?Yi:ag):this.state=i?Vl:qc:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let t=this.getCodeNorm();t===fr?this.state=Vl:Fr(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(fr)&&(this.state=Vl)}sPIEnding(){var t;let r=this.getCodeNorm();if(r===er){let{piTarget:n}=this;n.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(t=this.piHandler)===null||t===void 0||t.call(this,{target:n,body:this.text}),this.piTarget=this.text="",this.state=Cr}else r===fr?this.text+="?":(this.text+=`?${String.fromCodePoint(r)}`,this.state=qc);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let t=this.skipSpaces();if(t===fr){this.state=Yi;return}t!==$t&&(this.state=fN,this.name=String.fromCodePoint(t))}sXMLDeclName(){let t=this.captureTo(SN);if(t===fr){this.state=Yi,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(Fr(t)||t===Ra){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=t===Ra?og:pN}}sXMLDeclEq(){let t=this.getCodeNorm();if(t===fr){this.state=Yi,this.fail("XML declaration is incomplete.");return}Fr(t)||(t!==Ra&&this.fail("value required."),this.state=og)}sXMLDeclValueStart(){let t=this.getCodeNorm();if(t===fr){this.state=Yi,this.fail("XML declaration is incomplete.");return}Fr(t)||(Xl(t)?this.q=t:(this.fail("value must be quoted."),this.q=dg),this.state=hN)}sXMLDeclValue(){let t=this.captureTo([this.q,fr]);if(t===fr){this.state=Yi,this.text="",this.fail("XML declaration is incomplete.");return}if(t===$t)return;let r=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let n=r;this.xmlDecl.version=n,/^1\.[0-9]+$/.test(n)?this.opt.forceXMLVersion||this.setXMLVersion(n):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(r)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=r;break;case"standalone":r!=="yes"&&r!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=r;break;default:}this.name="",this.state=mN}sXMLDeclSeparator(){let t=this.getCodeNorm();if(t===fr){this.state=Yi;return}Fr(t)||(this.fail("whitespace required."),this.unget()),this.state=ag}sXMLDeclEnding(){var t;this.getCodeNorm()===er?(this.piTarget!=="xml"?this.fail("processing instructions are not allowed before root."):this.name!=="version"&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),(t=this.xmldeclHandler)===null||t===void 0||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=Cr):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;let r=this.captureNameChars();if(r===$t)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(t=this.openTagStartHandler)===null||t===void 0||t.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),r){case er:this.openTag();break;case Gl:this.state=Yc;break;default:Fr(r)||this.fail("disallowed character in tag name."),this.state=us}}sOpenTagSlash(){this.getCode()===er?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=us)}sAttrib(){let t=this.skipSpaces();t!==$t&&(ls(t)?(this.unget(),this.state=Kc):t===er?this.openTag():t===Gl?this.state=Yc:this.fail("disallowed character in attribute name."))}sAttribName(){let t=this.captureNameChars();t===Ra?this.state=sg:Fr(t)?this.state=yN:t===er?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==$t&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){let t=this.skipSpaces();switch(t){case $t:return;case Ra:this.state=sg;break;default:this.fail("attribute without value."),this.text="",this.name="",t===er?this.openTag():ls(t)?(this.unget(),this.state=Kc):(this.fail("disallowed character in attribute name."),this.state=us)}}sAttribValue(){let t=this.getCodeNorm();Xl(t)?(this.q=t,this.state=lg):Fr(t)||(this.fail("unquoted attribute value."),this.state=ug,this.unget())}sAttribValueQuoted(){let{q:t,chunk:r}=this,{i:n}=this;for(;;)switch(this.getCode()){case t:this.pushAttrib(this.name,this.text+r.slice(n,this.prevI)),this.name=this.text="",this.q=null,this.state=vN;return;case ds:this.text+=r.slice(n,this.prevI),this.state=Bl,this.entityReturnState=lg;return;case vn:case jn:case Zc:this.text+=`${r.slice(n,this.prevI)} `,n=this.i;break;case bi:this.text+=r.slice(n,this.prevI),this.fail("disallowed character.");return;case $t:this.text+=r.slice(n);return;default:}}sAttribValueClosed(){let t=this.getCodeNorm();Fr(t)?this.state=us:t===er?this.openTag():t===Gl?this.state=Yc:ls(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=Kc):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){let t=this.captureTo($N);switch(t){case ds:this.state=Bl,this.entityReturnState=ug;break;case bi:this.fail("disallowed character.");break;case $t:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===er?this.openTag():this.state=us}}sCloseTag(){let t=this.captureNameChars();t===er?this.closeTag():Fr(t)?this.state=xN:t!==$t&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case er:this.closeTag();break;case $t:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:r}=this,{chunk:n,textHandler:i}=this;e:for(;;)switch(this.getCode()){case bi:{if(this.state=Xc,i!==void 0){let{text:a}=this,o=n.slice(t,this.prevI);a.length!==0?(i(a+o),this.text=""):o.length!==0&&i(o)}r=Ki;break e}case ds:this.state=Bl,this.entityReturnState=Cr,i!==void 0&&(this.text+=n.slice(t,this.prevI)),r=Ki;break e;case Fa:switch(r){case Ki:r=hg;break;case hg:r=Qc;break;case Qc:break;default:throw new Error("impossible state")}break;case er:r===Qc&&this.fail('the string "]]>" is disallowed in char data.'),r=Ki;break;case jn:i!==void 0&&(this.text+=`${n.slice(t,this.prevI)}
9
+ `),t=this.i,r=Ki;break;case $t:i!==void 0&&(this.text+=n.slice(t));break e;default:r=Ki}this.forbiddenState=r}handleTextOutsideRoot(){let{i:t}=this,{chunk:r,textHandler:n}=this,i=!1;e:for(;;){let a=this.getCode();switch(a){case bi:{if(this.state=Xc,n!==void 0){let{text:o}=this,s=r.slice(t,this.prevI);o.length!==0?(n(o+s),this.text=""):s.length!==0&&n(s)}break e}case ds:this.state=Bl,this.entityReturnState=Cr,n!==void 0&&(this.text+=r.slice(t,this.prevI)),i=!0;break e;case jn:n!==void 0&&(this.text+=`${r.slice(t,this.prevI)}
10
+ `),t=this.i;break;case $t:n!==void 0&&(this.text+=r.slice(t));break e;default:Fr(a)||(i=!0)}}i&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(t,r){var n;let{prefix:i,local:a}=this.qname(t),o={name:t,prefix:i,local:a,value:r};if(this.attribList.push(o),(n=this.attributeHandler)===null||n===void 0||n.call(this,o),i==="xmlns"){let s=r.trim();this.currentXMLVersion==="1.0"&&s===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[a]=s,ef(this,a,s)}else if(t==="xmlns"){let s=r.trim();this.topNS[""]=s,ef(this,"",s)}}pushAttribPlain(t,r){var n;let i={name:t,value:r};this.attribList.push(i),(n=this.attributeHandler)===null||n===void 0||n.call(this,i)}end(){var t,r;this.sawRoot||this.fail("document must contain a root element.");let{tags:n}=this;for(;n.length>0;){let a=n.pop();this.fail(`unclosed tag: ${a.name}`)}this.state!==ng&&this.state!==Cr&&this.fail("unexpected end.");let{text:i}=this;return i.length!==0&&((t=this.textHandler)===null||t===void 0||t.call(this,i),this.text=""),this._closed=!0,(r=this.endHandler)===null||r===void 0||r.call(this),this._init(),this}resolve(t){var r,n;let i=this.topNS[t];if(i!==void 0)return i;let{tags:a}=this;for(let o=a.length-1;o>=0;o--)if(i=a[o].ns[t],i!==void 0)return i;return i=this.ns[t],i!==void 0?i:(n=(r=this.opt).resolvePrefix)===null||n===void 0?void 0:n.call(r,t)}qname(t){let r=t.indexOf(":");if(r===-1)return{prefix:"",local:t};let n=t.slice(r+1),i=t.slice(0,r);return(i===""||n===""||n.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:i,local:n}}processAttribsNS(){var t;let{attribList:r}=this,n=this.tag;{let{prefix:o,local:s}=this.qname(n.name);n.prefix=o,n.local=s;let l=n.uri=(t=this.resolve(o))!==null&&t!==void 0?t:"";o!==""&&(o==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),l===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(o)}.`),n.uri=o))}if(r.length===0)return;let{attributes:i}=n,a=new Set;for(let o of r){let{name:s,prefix:l,local:u}=o,d,c;l===""?(d=s==="xmlns"?La:"",c=s):(d=this.resolve(l),d===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(l)}.`),d=l),c=`{${d}}${u}`),a.has(c)&&this.fail(`duplicate attribute: ${c}.`),a.add(c),o.uri=d,i[s]=o}this.attribList=[]}processAttribsPlain(){let{attribList:t}=this,r=this.tag.attributes;for(let{name:n,value:i}of t)r[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),r[n]=i;this.attribList=[]}openTag(){var t;this.processAttribs();let{tags:r}=this,n=this.tag;n.isSelfClosing=!1,(t=this.openTagHandler)===null||t===void 0||t.call(this,n),r.push(n),this.state=Cr,this.name=""}openSelfClosingTag(){var t,r,n;this.processAttribs();let{tags:i}=this,a=this.tag;a.isSelfClosing=!0,(t=this.openTagHandler)===null||t===void 0||t.call(this,a),(r=this.closeTagHandler)===null||r===void 0||r.call(this,a),(this.tag=(n=i[i.length-1])!==null&&n!==void 0?n:null)===null&&(this.closedRoot=!0),this.state=Cr,this.name=""}closeTag(){let{tags:t,name:r}=this;if(this.state=Cr,this.name="",r===""){this.fail("weird empty close tag."),this.text+="</>";return}let n=this.closeTagHandler,i=t.length;for(;i-- >0;){let a=this.tag=t.pop();if(this.topNS=a.ns,n?.(a),a.name===r)break;this.fail("unexpected close tag.")}i===0?this.closedRoot=!0:i<0&&(this.fail(`unmatched closing tag: ${r}.`),this.text+=`</${r}>`)}parseEntity(t){if(t[0]!=="#"){let n=this.ENTITIES[t];return n!==void 0?n:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let r=NaN;return t[1]==="x"&&/^#x[0-9a-f]+$/i.test(t)?r=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(r=parseInt(t.slice(1),10)),this.isChar(r)?String.fromCodePoint(r):(this.fail("malformed character entity."),`&${t};`)}};Ba.SaxesParser=tf});import{Command as oX,InvalidArgumentError as Cc}from"commander";import{readFile as e$,writeFile as El,access as t$}from"fs/promises";import{createRequire as sX}from"module";import{basename as jl,resolve as Ea,extname as r$}from"path";var px=P$(wg(),1);function bn(){return!0}function lt(){return!1}var he;(function(e){e.Attribute="attribute",e.Pseudo="pseudo",e.PseudoElement="pseudo-element",e.Tag="tag",e.Universal="universal",e.Adjacent="adjacent",e.Child="child",e.Descendant="descendant",e.Parent="parent",e.Sibling="sibling",e.ColumnCombinator="column-combinator"})(he||(he={}));var It;(function(e){e.Any="any",e.Element="element",e.End="end",e.Equals="equals",e.Exists="exists",e.Hyphen="hyphen",e.Not="not",e.Start="start"})(It||(It={}));var Ig=/^[^#\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\u00B0-\uFFFF-])+/,CN=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,Ie;(function(e){e[e.LeftParenthesis=40]="LeftParenthesis",e[e.RightParenthesis=41]="RightParenthesis",e[e.LeftSquareBracket=91]="LeftSquareBracket",e[e.RightSquareBracket=93]="RightSquareBracket",e[e.Comma=44]="Comma",e[e.Period=46]="Period",e[e.Colon=58]="Colon",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Plus=43]="Plus",e[e.Tilde=126]="Tilde",e[e.QuestionMark=63]="QuestionMark",e[e.ExclamationMark=33]="ExclamationMark",e[e.Slash=47]="Slash",e[e.Equal=61]="Equal",e[e.Dollar=36]="Dollar",e[e.Pipe=124]="Pipe",e[e.Circumflex=94]="Circumflex",e[e.Asterisk=42]="Asterisk",e[e.GreaterThan=62]="GreaterThan",e[e.LessThan=60]="LessThan",e[e.Hash=35]="Hash",e[e.LowerI=105]="LowerI",e[e.LowerS=115]="LowerS",e[e.BackSlash=92]="BackSlash",e[e.Space=32]="Space",e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn"})(Ie||(Ie={}));var ON=new Map([[Ie.Tilde,It.Element],[Ie.Circumflex,It.Start],[Ie.Dollar,It.End],[Ie.Asterisk,It.Any],[Ie.ExclamationMark,It.Not],[Ie.Pipe,It.Hyphen]]),TN=new Set(["has","not","matches","is","where","host","host-context"]),PN=new Set(["before","after","first-line","first-letter"]);function Hl(e){switch(e.type){case he.Adjacent:case he.Child:case he.Descendant:case he.Parent:case he.Sibling:case he.ColumnCombinator:return!0;case he.Attribute:case he.Pseudo:case he.PseudoElement:case he.Tag:case he.Universal:return!1}}var DN=new Set(["contains","icontains"]);function jN(e,t,r){let n=Number.parseInt(t,16)-65536;return Number.isNaN(n)||r?t:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,n&1023|56320)}function cs(e){return e.replace(CN,jN)}function nf(e){return e===Ie.SingleQuote||e===Ie.DoubleQuote}function kg(e){return e===Ie.Space||e===Ie.Tab||e===Ie.NewLine||e===Ie.FormFeed||e===Ie.CarriageReturn}function En(e){let t=[],r=Sg(t,`${e}`,0);if(r<e.length)throw new Error(`Unmatched selector: ${e.slice(r)}`);return t}function Sg(e,t,r){let n=[];function i(c){let f=t.slice(r+c).match(Ig);if(!f)throw new Error(`Expected name, found ${t.slice(r)}`);let[p]=f;return r+=c+p.length,cs(p)}function a(c){for(r+=c;r<t.length&&kg(t.charCodeAt(r));)r++}function o(){r+=1;let c=r;for(let f=1;r<t.length;r++)switch(t.charCodeAt(r)){case Ie.BackSlash:{r+=1;break}case Ie.LeftParenthesis:{f+=1;break}case Ie.RightParenthesis:{if(f-=1,f===0)return cs(t.slice(c,r++));break}}throw new Error("Parenthesis not matched")}function s(){if(n.length>0&&Hl(n[n.length-1]))throw new Error("Did not expect successive traversals.")}function l(c){if(n.length>0&&n[n.length-1].type===he.Descendant){n[n.length-1].type=c;return}s(),n.push({type:c})}function u(c,f){n.push({type:he.Attribute,name:c,action:f,value:i(1),namespace:null,ignoreCase:"quirks"})}function d(){if(n.length>0&&n[n.length-1].type===he.Descendant&&n.pop(),n.length===0)throw new Error("Empty sub-selector");e.push(n)}if(a(0),t.length===r)return r;e:for(;r<t.length;){let c=t.charCodeAt(r);switch(c){case Ie.Space:case Ie.Tab:case Ie.NewLine:case Ie.FormFeed:case Ie.CarriageReturn:{(n.length===0||n[0].type!==he.Descendant)&&(s(),n.push({type:he.Descendant})),a(1);break}case Ie.GreaterThan:{l(he.Child),a(1);break}case Ie.LessThan:{l(he.Parent),a(1);break}case Ie.Tilde:{l(he.Sibling),a(1);break}case Ie.Plus:{l(he.Adjacent),a(1);break}case Ie.Period:{u("class",It.Element);break}case Ie.Hash:{u("id",It.Equals);break}case Ie.LeftSquareBracket:{a(1);let f,p=null;t.charCodeAt(r)===Ie.Pipe?f=i(1):t.startsWith("*|",r)?(p="*",f=i(2)):(f=i(0),t.charCodeAt(r)===Ie.Pipe&&t.charCodeAt(r+1)!==Ie.Equal&&(p=f,f=i(1))),a(0);let h=It.Exists,m=ON.get(t.charCodeAt(r));if(m){if(h=m,t.charCodeAt(r+1)!==Ie.Equal)throw new Error("Expected `=`");a(2)}else t.charCodeAt(r)===Ie.Equal&&(h=It.Equals,a(1));let g="",v=null;if(h!=="exists"){if(nf(t.charCodeAt(r))){let b=t.charCodeAt(r);r+=1;let I=r;for(;r<t.length&&t.charCodeAt(r)!==b;)r+=t.charCodeAt(r)===Ie.BackSlash?2:1;if(t.charCodeAt(r)!==b)throw new Error("Attribute value didn't end");g=cs(t.slice(I,r)),r+=1}else{let b=r;for(;r<t.length&&!kg(t.charCodeAt(r))&&t.charCodeAt(r)!==Ie.RightSquareBracket;)r+=t.charCodeAt(r)===Ie.BackSlash?2:1;g=cs(t.slice(b,r))}switch(a(0),t.charCodeAt(r)|32){case Ie.LowerI:{v=!0,a(1);break}case Ie.LowerS:{v=!1,a(1);break}}}if(t.charCodeAt(r)!==Ie.RightSquareBracket)throw new Error("Attribute selector didn't terminate");r+=1;let y={type:he.Attribute,name:f,action:h,value:g,namespace:p,ignoreCase:v};n.push(y);break}case Ie.Colon:{if(t.charCodeAt(r+1)===Ie.Colon){n.push({type:he.PseudoElement,name:i(2).toLowerCase(),data:t.charCodeAt(r)===Ie.LeftParenthesis?o():null});break}let f=i(1).toLowerCase();if(PN.has(f)){n.push({type:he.PseudoElement,name:f,data:null});break}let p=null;if(t.charCodeAt(r)===Ie.LeftParenthesis)if(TN.has(f)){if(nf(t.charCodeAt(r+1)))throw new Error(`Pseudo-selector ${f} cannot be quoted`);if(p=[],r=Sg(p,t,r+1),t.charCodeAt(r)!==Ie.RightParenthesis)throw new Error(`Missing closing parenthesis in :${f} (${t})`);r+=1}else{if(p=o(),DN.has(f)){let h=p.charCodeAt(0);h===p.charCodeAt(p.length-1)&&nf(h)&&(p=p.slice(1,-1))}p=cs(p)}n.push({type:he.Pseudo,name:f,data:p});break}case Ie.Comma:{d(),n=[],a(1);break}default:{if(t.startsWith("/*",r)){let h=t.indexOf("*/",r+2);if(h===-1)throw new Error("Comment was not terminated");r=h+2,n.length===0&&a(0);break}let f=null,p;if(c===Ie.Asterisk)r+=1,p="*";else if(c===Ie.Pipe){if(p="",t.charCodeAt(r+1)===Ie.Pipe){l(he.ColumnCombinator),a(2);break}}else if(Ig.test(t.slice(r)))p=i(0);else break e;t.charCodeAt(r)===Ie.Pipe&&t.charCodeAt(r+1)!==Ie.Pipe&&(f=p,t.charCodeAt(r+1)===Ie.Asterisk?(p="*",r+=2):p=i(1)),n.push(p==="*"?{type:he.Universal,namespace:f}:{type:he.Tag,name:p,namespace:f})}}}return d(),r}var Vt;(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(Vt||(Vt={}));function $g(e){return e.type===Vt.Tag||e.type===Vt.Script||e.type===Vt.Style}var Ng=Vt.Root,Mg=Vt.Text,Ag=Vt.Directive,Cg=Vt.Comment,Og=Vt.Script,Tg=Vt.Style,Pg=Vt.Tag,Dg=Vt.CDATA,$X=Vt.Doctype;function pr(e){return $g(e)}function af(e){return e.type===Vt.CDATA}function Zi(e){return e.type===Vt.Text}function jg(e){return e.type===Vt.Comment}function Lr(e){return Object.hasOwn(e,"children")}var df={};O$(df,{DocumentPosition:()=>rn,append:()=>cM,appendChild:()=>dM,compareDocumentPosition:()=>qg,existsOne:()=>zg,filter:()=>Ga,find:()=>Eg,findAll:()=>zN,findOne:()=>ql,getAttributeValue:()=>mM,getChildren:()=>Yg,getElementById:()=>LN,getElements:()=>FN,getElementsByClassName:()=>BN,getElementsByTagName:()=>Ji,getElementsByTagType:()=>VN,getFeed:()=>tM,getInnerHTML:()=>eM,getName:()=>yM,getOuterHTML:()=>Wg,getParent:()=>Kg,getSiblings:()=>hM,getText:()=>Zl,hasAttrib:()=>gM,innerText:()=>uf,nextElementSibling:()=>vM,prepend:()=>pM,prependChild:()=>fM,prevElementSibling:()=>bM,removeElement:()=>ps,removeSubsets:()=>sM,replaceElement:()=>uM,testElement:()=>RN,textContent:()=>fs,uniqueSort:()=>lM});function Ga(e,t,r=!0,n=Number.POSITIVE_INFINITY){return Eg(e,Array.isArray(t)?t:[t],r,n)}function Eg(e,t,r,n){let i=[],a=[Array.isArray(t)?t:[t]],o=[0];for(;;){if(o[0]>=a[0].length){if(o.length===1)return i;a.shift(),o.shift();continue}let s=a[0][o[0]++];if(e(s)&&(i.push(s),--n<=0))return i;r&&Lr(s)&&s.children.length>0&&(o.unshift(0),a.unshift(s.children))}}function ql(e,t,r=!0){let n=Array.isArray(t)?t:[t];for(let i of n){if(pr(i)&&e(i))return i;if(r&&Lr(i)&&i.children.length>0){let a=ql(e,i.children,!0);if(a)return a}}return null}function zg(e,t){return(Array.isArray(t)?t:[t]).some(r=>pr(r)&&e(r)||Lr(r)&&zg(e,r.children))}function zN(e,t){let r=[],n=[Array.isArray(t)?t:[t]],i=[0];for(;;){if(i[0]>=n[0].length){if(n.length===1)return r;n.shift(),i.shift();continue}let a=n[0][i[0]++];pr(a)&&e(a)&&r.push(a),Lr(a)&&a.children.length>0&&(i.unshift(0),n.unshift(a.children))}}var Yl={tag_name(e){return typeof e=="function"?t=>pr(t)&&e(t.name):e==="*"?pr:t=>pr(t)&&t.name===e},tag_type(e){return typeof e=="function"?t=>e(t.type):t=>t.type===e},tag_contains(e){return typeof e=="function"?t=>Zi(t)&&e(t.data):t=>Zi(t)&&t.data===e}};function of(e,t){return typeof t=="function"?r=>pr(r)&&t(r.attribs[e]):r=>pr(r)&&r.attribs[e]===t}function _N(e,t){return r=>e(r)||t(r)}function _g(e){let t=Object.keys(e).map(r=>{let n=e[r];return Object.hasOwn(Yl,r)?Yl[r](n):of(r,n)});return t.length===0?null:t.reduce(_N)}function RN(e,t){let r=_g(e);return r?r(t):!0}function FN(e,t,r,n=Number.POSITIVE_INFINITY){let i=_g(e);return i?Ga(i,t,r,n):[]}function LN(e,t,r=!0){return Array.isArray(t)||(t=[t]),ql(of("id",e),t,r)}function Ji(e,t,r=!0,n=Number.POSITIVE_INFINITY){return Ga(Yl.tag_name(e),t,r,n)}function BN(e,t,r=!0,n=Number.POSITIVE_INFINITY){return Ga(of("class",e),t,r,n)}function VN(e,t,r=!0,n=Number.POSITIVE_INFINITY){return Ga(Yl.tag_type(e),t,r,n)}var UN=new Map([[34,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),GN=typeof String.prototype.codePointAt=="function"?(e,t)=>e.codePointAt(t):(e,t)=>(e.charCodeAt(t)&64512)===55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t),XN=1342177476;function Kl(e){let t,r=0,{length:n}=e;for(let i=0;i<n;i++){let a=e.charCodeAt(i);if(a<128&&((XN>>>a&1)===0||a>=64||a<32))continue;if(t===void 0?t=e.substring(0,i):r!==i&&(t+=e.substring(r,i)),a<64){t+=UN.get(a),r=i+1;continue}let o=GN(e,i);t+=`&#x${o.toString(16)};`,o!==a&&i++,r=i+1}return t===void 0?e:(r<n&&(t+=e.substr(r)),t)}function Rg(e,t){return function(n){let i,a=0,o="";for(;i=e.exec(n);)a!==i.index&&(o+=n.substring(a,i.index)),o+=t.get(i[0].charCodeAt(0)),a=i.index+1;return o+n.substring(a)}}var sf=Rg(/["&\u00A0]/g,new Map([[34,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),lf=Rg(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]]));var Fg;(function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"})(Fg||(Fg={}));var Lg;(function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"})(Lg||(Lg={}));var Bg=new Map("altGlyph altGlyphDef altGlyphItem animateColor animateMotion animateTransform clipPath feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence foreignObject glyphRef linearGradient radialGradient textPath".split(" ").map(e=>[e.toLowerCase(),e])),Vg=new Map("definitionURL attributeName attributeType baseFrequency baseProfile calcMode clipPathUnits diffuseConstant edgeMode filterUnits glyphRef gradientTransform gradientUnits kernelMatrix kernelUnitLength keyPoints keySplines keyTimes lengthAdjust limitingConeAngle markerHeight markerUnits markerWidth maskContentUnits maskUnits numOctaves pathLength patternContentUnits patternTransform patternUnits pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits refX refY repeatCount repeatDur requiredExtensions requiredFeatures specularConstant specularExponent spreadMethod startOffset stdDeviation stitchTiles surfaceScale systemLanguage tableValues targetX targetY textLength viewBox viewTarget xChannelSelector yChannelSelector zoomAndPan".split(" ").map(e=>[e.toLowerCase(),e]));var WN=new Set("style script xmp iframe noembed noframes plaintext noscript".split(" ")),HN=new Set("area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr".split(" ")),qN=new Set(["svg","math"]),YN=new Set("mi mo mn ms mtext annotation-xml foreignObject desc title".split(" "));function KN(e,t={}){let r="length"in e?e:[e],n=t.xmlMode??!1,i="";for(let a=0;a<r.length;a++)i+=Xg(r[a],t,n);return i}var Ug=KN;function Gg(e,t,r){let n="";for(let i=0;i<e.length;i++)n+=Xg(e[i],t,r);return n}function Xg(e,t,r){switch(e.type){case Ng:return Gg(e.children,t,r);case Ag:return`<${e.data}>`;case Cg:return`<!--${e.data}-->`;case Dg:return`<![CDATA[${e.children[0].data}]]>`;case Og:case Tg:case Pg:return ZN(e,t,r);case Mg:{let n=e,i=n.data||"";return(t.encodeEntities??t.decodeEntities)!==!1&&!(!r&&n.parent&&WN.has(n.parent.name))?r||t.encodeEntities!=="utf8"?Kl(i):lf(i):i}}}function ZN(e,t,r){r==="foreign"&&(e.name=Bg.get(e.name)??e.name,e.parent&&YN.has(e.parent.name)&&(r=!1)),!r&&qN.has(e.name)&&(r="foreign");let{name:n,children:i}=e,a=!r&&HN.has(n),o=`<${n}${QN(e.attribs,t,r)}`;return i.length===0&&(r?t.selfClosingTags!==!1:t.selfClosingTags&&a)?o+=r?"/>":" />":(o+=">",i.length>0&&(o+=Gg(i,t,r)),a||(o+=`</${n}>`)),o}function JN(e){return e.replaceAll('"',"&quot;")}function QN(e,t,r){if(!e)return"";let n=(t.encodeEntities??t.decodeEntities)===!1?JN:r||t.encodeEntities!=="utf8"?Kl:sf,i=r==="foreign",a=!!(t.emptyAttrs??r),o="";for(let s in e){if(!Object.hasOwn(e,s))continue;let l=e[s],u=i?Vg.get(s)??s:s;o+=!a&&(l==null||l==="")?` ${u}`:` ${u}="${n(l==null?"":String(l))}"`}return o}function Wg(e,t){return Ug(e,t)}function eM(e,t){return Lr(e)?e.children.map(r=>Wg(r,t)).join(""):""}function Zl(e){return Array.isArray(e)?e.map(Zl).join(""):pr(e)?e.name==="br"?`
11
+ `:Zl(e.children):af(e)?Zl(e.children):Zi(e)?e.data:""}function fs(e){return Array.isArray(e)?e.map(fs).join(""):Lr(e)&&!jg(e)?fs(e.children):Zi(e)?e.data:""}function uf(e){return Array.isArray(e)?e.map(uf).join(""):Lr(e)&&(e.type===Vt.Tag||af(e))?uf(e.children):Zi(e)?e.data:""}function tM(e){let t=Jl(oM,e);return t?t.name==="feed"?rM(t):nM(t):null}function rM(e){let t=e.children,r={type:"atom",items:Ji("entry",t).map(a=>{let{children:o}=a,s={media:Hg(o)};Br(s,"id","id",o),Br(s,"title","title",o);let l=Jl("link",o)?.attribs.href;l&&(s.link=l);let u=xi("summary",o)||xi("content",o);u&&(s.description=u);let d=xi("updated",o);return d&&(s.pubDate=new Date(d)),s})};Br(r,"id","id",t),Br(r,"title","title",t);let n=Jl("link",t)?.attribs.href;n&&(r.link=n),Br(r,"description","subtitle",t);let i=xi("updated",t);return i&&(r.updated=new Date(i)),Br(r,"author","email",t,!0),r}function nM(e){let t=Jl("channel",e.children)?.children??[],r={type:e.name.substr(0,3),id:"",items:Ji("item",e.children).map(i=>{let{children:a}=i,o={media:Hg(a)};Br(o,"id","guid",a),Br(o,"title","title",a),Br(o,"link","link",a),Br(o,"description","description",a);let s=xi("pubDate",a)||xi("dc:date",a);return s&&(o.pubDate=new Date(s)),o})};Br(r,"title","title",t),Br(r,"link","link",t),Br(r,"description","description",t);let n=xi("lastBuildDate",t);return n&&(r.updated=new Date(n)),Br(r,"author","managingEditor",t,!0),r}var iM=["url","type","lang"],aM=["fileSize","bitrate","framerate","samplingrate","channels","duration","height","width"];function Hg(e){return Ji("media:content",e).map(t=>{let{attribs:r}=t,n={medium:r.medium,isDefault:!!r.isDefault};for(let i of iM)r[i]&&(n[i]=r[i]);for(let i of aM)r[i]&&(n[i]=Number.parseInt(r[i],10));return r.expression&&(n.expression=r.expression),n})}function Jl(e,t){return Ji(e,t,!0,1)[0]}function xi(e,t,r=!1){return fs(Ji(e,t,r,1)).trim()}function Br(e,t,r,n,i=!1){let a=xi(r,n,i);a&&(e[t]=a)}function oM(e){return e==="rss"||e==="feed"||e==="rdf:RDF"}function sM(e){let t=e.length;for(;--t>=0;){let r=e[t];if(t>0&&e.lastIndexOf(r,t-1)>=0){e.splice(t,1);continue}for(let n=r.parent;n;n=n.parent)if(e.includes(n)){e.splice(t,1);break}}return e}var rn;(function(e){e[e.DISCONNECTED=1]="DISCONNECTED",e[e.PRECEDING=2]="PRECEDING",e[e.FOLLOWING=4]="FOLLOWING",e[e.CONTAINS=8]="CONTAINS",e[e.CONTAINED_BY=16]="CONTAINED_BY"})(rn||(rn={}));function qg(e,t){let r=[],n=[];if(e===t)return 0;let i=Lr(e)?e:e.parent;for(;i;)r.unshift(i),i=i.parent;for(i=Lr(t)?t:t.parent;i;)n.unshift(i),i=i.parent;let a=Math.min(r.length,n.length),o=0;for(;o<a&&r[o]===n[o];)o++;if(o===0)return rn.DISCONNECTED;let s=r[o-1],l=s.children,u=r[o],d=n[o];return l.indexOf(u)>l.indexOf(d)?s===t?rn.FOLLOWING|rn.CONTAINED_BY:rn.FOLLOWING:s===e?rn.PRECEDING|rn.CONTAINS:rn.PRECEDING}function lM(e){return e=e.filter((t,r,n)=>!n.includes(t,r+1)),e.sort((t,r)=>{let n=qg(t,r);return n&rn.PRECEDING?-1:n&rn.FOLLOWING?1:0}),e}function ps(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){let t=e.parent.children,r=t.lastIndexOf(e);r!==-1&&t.splice(r,1)}e.next=null,e.prev=null,e.parent=null}function uM(e,t){if(t.prev=e.prev,t.prev&&(t.prev.next=t),t.next=e.next,t.next&&(t.next.prev=t),t.parent=e.parent,t.parent){let{children:r}=t.parent,n=r.lastIndexOf(e);if(n===-1)return;r[n]=t,e.parent=null}}function dM(e,t){if(ps(t),t.next=null,t.parent=e,e.children.push(t)>1){let r=e.children[e.children.length-2];r.next=t,t.prev=r}else t.prev=null}function cM(e,t){ps(t);let{parent:r}=e,n=e.next;if(t.next=n,t.prev=e,e.next=t,t.parent=r,n){if(n.prev=t,r){let i=r.children;i.splice(i.lastIndexOf(n),0,t)}}else r&&r.children.push(t)}function fM(e,t){if(ps(t),t.parent=e,t.prev=null,e.children.unshift(t)===1)t.next=null;else{let r=e.children[1];r.prev=t,t.next=r}}function pM(e,t){ps(t);let{parent:r}=e;if(r){let n=r.children;n.splice(n.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=r,t.prev=e.prev,t.next=e,e.prev=t}function Yg(e){return Lr(e)?e.children:[]}function Kg(e){return e.parent||null}function hM(e){let t=Kg(e);if(t!=null)return Yg(t);let r=[e],{prev:n,next:i}=e;for(;n!=null;)r.unshift(n),{prev:n}=n;for(;i!=null;)r.push(i),{next:i}=i;return r}function mM(e,t){let{attribs:r}=e;return r?.[t]}function gM(e,t){let{attribs:r}=e;return r!=null&&Object.hasOwn(r,t)&&r[t]!=null}function yM(e){return e.name}function vM(e){let{next:t}=e;for(;t!==null&&!pr(t);)({next:t}=t);return t}function bM(e){let{prev:t}=e;for(;t!==null&&!pr(t);)({prev:t}=t);return t}var xM=/[-[\]{}()*+?.,\\^$|#\s]/g,wM=/\s/;function Zg(e){return e.replace(xM,"\\$&")}var IM=new Set(["accept","accept-charset","align","alink","axis","bgcolor","charset","checked","clear","codetype","color","compact","declare","defer","dir","direction","disabled","enctype","face","frame","hreflang","http-equiv","lang","language","link","media","method","multiple","nohref","noresize","noshade","nowrap","readonly","rel","rev","rules","scope","scrolling","selected","shape","target","text","type","valign","valuetype","vlink"]);function Qi(e,t){return typeof e.ignoreCase=="boolean"?e.ignoreCase:e.ignoreCase==="quirks"?!!t.quirksMode:!t.xmlMode&&IM.has(e.name)}var Jg={equals(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t;return Qi(t,r)?(a=a.toLowerCase(),o=>{let s=n.getAttributeValue(o,i);return s!=null&&s.length===a.length&&s.toLowerCase()===a&&e(o)}):o=>n.getAttributeValue(o,i)===a&&e(o)},hyphen(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t,{length:o}=a;return Qi(t,r)?(a=a.toLowerCase(),function(l){let u=n.getAttributeValue(l,i);return u!=null&&(u.length===o||u.charAt(o)==="-")&&u.substr(0,o).toLowerCase()===a&&e(l)}):function(l){let u=n.getAttributeValue(l,i);return u!=null&&(u.length===o||u.charAt(o)==="-")&&u.substr(0,o)===a&&e(l)}},element(e,t,r){let{adapter:n}=r,{name:i,value:a}=t;if(wM.test(a))return lt;let o=new RegExp(`(?:^|\\s)${Zg(a)}(?:$|\\s)`,Qi(t,r)?"i":"");return function(l){let u=n.getAttributeValue(l,i);return u!=null&&u.length>=a.length&&o.test(u)&&e(l)}},exists(e,{name:t},{adapter:r}){return n=>r.hasAttrib(n,t)&&e(n)},start(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t,{length:o}=a;return o===0?lt:Qi(t,r)?(a=a.toLowerCase(),s=>{let l=n.getAttributeValue(s,i);return l!=null&&l.length>=o&&l.substr(0,o).toLowerCase()===a&&e(s)}):s=>!!n.getAttributeValue(s,i)?.startsWith(a)&&e(s)},end(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t,o=-a.length;return o===0?lt:Qi(t,r)?(a=a.toLowerCase(),s=>n.getAttributeValue(s,i)?.substr(o).toLowerCase()===a&&e(s)):s=>!!n.getAttributeValue(s,i)?.endsWith(a)&&e(s)},any(e,t,r){let{adapter:n}=r,{name:i,value:a}=t;if(a==="")return lt;if(Qi(t,r)){let o=new RegExp(Zg(a),"i");return function(l){let u=n.getAttributeValue(l,i);return u!=null&&u.length>=a.length&&o.test(u)&&e(l)}}return o=>!!n.getAttributeValue(o,i)?.includes(a)&&e(o)},not(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t;return a===""?o=>!!n.getAttributeValue(o,i)&&e(o):Qi(t,r)?(a=a.toLowerCase(),o=>{let s=n.getAttributeValue(o,i);return(s==null||s.length!==a.length||s.toLowerCase()!==a)&&e(o)}):o=>n.getAttributeValue(o,i)!==a&&e(o)}};function Qg(e,t,r){let{adapter:n,xmlMode:i=!1}=r,a=[],o=[t],s=[0];for(;;){if(s[0]>=o[0].length){if(o.length===1)return a;o.shift(),s.shift();continue}let l=o[0][s[0]++];if(n.isTag(l)&&(e(l)&&a.push(l),i||n.getName(l)!=="template")){let u=n.getChildren(l);u.length>0&&(o.unshift(u),s.unshift(0))}}}function Xa(e,t,r){let{adapter:n,xmlMode:i=!1}=r,a=[t],o=[0];for(;;){if(o[0]>=a[0].length){if(a.length===1)return null;a.shift(),o.shift();continue}let s=a[0][o[0]++];if(n.isTag(s)){if(e(s))return s;if(i||n.getName(s)!=="template"){let l=n.getChildren(s);l.length>0&&(a.unshift(l),o.unshift(0))}}}}function Ql(e,t){let r=t.getSiblings(e);if(r.length<=1)return[];let n=r.indexOf(e);return n===-1||n===r.length-1?[]:r.slice(n+1).filter(t.isTag)}function nn(e,t){let r=t.getParent(e);return r!=null&&t.isTag(r)?r:null}var ey="input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i])",ty={"any-link":":is(a, area, link)[href]",link:":any-link:not(:visited)",disabled:`:is(
12
+ :is(button, input, select, textarea, optgroup, option)[disabled],
13
+ optgroup[disabled] > option,
14
+ fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
15
+ )`,enabled:":is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], :selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])","read-only":`[readonly]:is(textarea, ${ey})`,"read-write":`:not([readonly]):is(textarea, ${ey})`,selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"};function ry(e){let t=e[0],r=e[1]-1;if(r<0&&t<=0)return lt;if(t===-1)return a=>a<=r;if(t===0)return a=>a===r;if(t===1)return r<0?bn:a=>a>=r;let n=Math.abs(t),i=(r%n+n)%n;return t>1?a=>a>=r&&a%n===i:a=>a<=r&&a%n===i}var kM=new Set([9,10,12,13,32]),ny=48,SM=57;function iy(e){switch(e=e.trim().toLowerCase(),e){case"even":return[2,0];case"odd":return[2,1]}let t=0,r=0,n=a(),i=o();if(t<e.length&&e.charAt(t)==="n"&&(t++,r=n*(i??1),s(),t<e.length?(n=a(),s(),i=o()):n=i=0),i===null||t<e.length)throw new Error(`n-th rule couldn't be parsed ('${e}')`);return[r,n*i];function a(){switch(e.charAt(t)){case"-":return t++,-1;case"+":{t++;break}}return 1}function o(){let l=t,u=0;for(;t<e.length&&e.charCodeAt(t)>=ny&&e.charCodeAt(t)<=SM;)u=u*10+(e.charCodeAt(t)-ny),t++;return t===l?null:u}function s(){for(;t<e.length&&kM.has(e.charCodeAt(t));)t++}}function cf(e){return ry(iy(e))}function Wa(e,{adapter:t,cacheResults:r},n){if(r===!1||typeof WeakMap>"u")return o=>e(o)&&n(o);let i=new WeakMap;function a(o){let s=n(o);return i.set(o,s),s}return function(s){if(!e(s))return!1;if(i.has(s))return i.get(s)??!1;let l=s;do{let u=nn(l,t);if(u===null)return a(s);l=u}while(!i.has(l));return i.get(l)?a(s):!1}}function Ha(e){let{context:t,rootFunc:r,...n}=e;return n}function $M(e,t){if(t[0]!=="*"&&t[0]!==e[0])return!1;let r=1;for(let n=1;n<t.length;n++)if(t[n]!=="*"){for(;r<e.length&&e[r]!==t[n];)if(e[r++].length<=1)return!1;if(r>=e.length)return!1;r++}return!0}var NM=/^(.+?)\s+of\s+(.+)$/is;function eu(e,t){return function(n,i,a,o,s){let{adapter:l,equals:u}=a,d=t?null:i.match(NM),c=cf(d?d[1].trim():i);if(c===lt)return lt;let f=d&&s?s(En(d[2].trim()),Ha(a),o):void 0;if(f===lt)return lt;if(c===bn&&!f)return h=>nn(h,l)!==null&&n(h);let p=f?(h,m)=>f(m):t?(h,m)=>l.getName(m)===l.getName(h):bn;return e?function(m){if(f&&!f(m))return!1;let g=l.getSiblings(m),v=0;for(let y=g.length-1;y>=0;y--){let b=g[y];if(u(m,b))break;l.isTag(b)&&p(m,b)&&v++}return c(v)&&n(m)}:function(m){if(f&&!f(m))return!1;let g=l.getSiblings(m),v=0;for(let y of g){if(u(m,y))break;l.isTag(y)&&p(m,y)&&v++}return c(v)&&n(m)}}}var tu={contains(e,t,r){let{getText:n}=r.adapter;return Wa(e,r,i=>n(i).includes(t))},icontains(e,t,r){let n=t.toLowerCase(),{getText:i}=r.adapter;return Wa(e,r,a=>i(a).toLowerCase().includes(n))},"nth-child":eu(!1,!1),"nth-last-child":eu(!0,!1),"nth-of-type":eu(!1,!0),"nth-last-of-type":eu(!0,!0),root(e,t,{adapter:r}){return n=>nn(n,r)===null&&e(n)},scope(e,t,r,n){let{equals:i}=r;return!n||n.length===0?tu.root(e,t,r):n.length===1?a=>i(n[0],a)&&e(a):a=>n.includes(a)&&e(a)},lang(e,t,{adapter:r}){let n=t.split(",").map(i=>i.trim()).filter(i=>i.length>0).map(i=>i.replace(/^['"]|['"]$/g,"").toLowerCase().split("-"));return function(a){let o=a;for(;o!=null;){let s=r.getAttributeValue(o,"xml:lang")??r.getAttributeValue(o,"lang");if(s!=null){if(!s)return n.some(d=>d[0]==="")&&e(a);let u=s.toLowerCase().split("-");return n.some(d=>$M(u,d))&&e(a)}let l=r.getParent(o);o=l!=null&&r.isTag(l)?l:null}return n.some(s=>s[0]==="")&&e(a)}},hover:ff("isHovered"),visited:ff("isVisited"),active:ff("isActive")};function ff(e){return function(r,n,{adapter:i}){let a=i[e];return typeof a!="function"?lt:function(s){return a(s)&&r(s)}}}var MM=/^[ \t\r\n]*$/,pf={empty(e,{adapter:t}){let r=t.getChildren(e);return r.every(n=>!t.isTag(n))&&r.every(n=>MM.test(t.getText(n)))},"first-child"(e,{adapter:t,equals:r}){if(t.prevElementSibling)return t.prevElementSibling(e)==null;let n=t.getSiblings(e).find(i=>t.isTag(i));return n!=null&&r(e,n)},"last-child"(e,{adapter:t,equals:r}){let n=t.getSiblings(e);for(let i=n.length-1;i>=0;i--){if(r(e,n[i]))return!0;if(t.isTag(n[i]))break}return!1},"first-of-type"(e,{adapter:t,equals:r}){let n=t.getSiblings(e),i=t.getName(e);for(let a of n){if(r(e,a))return!0;if(t.isTag(a)&&t.getName(a)===i)break}return!1},"last-of-type"(e,{adapter:t,equals:r}){let n=t.getSiblings(e),i=t.getName(e);for(let a=n.length-1;a>=0;a--){let o=n[a];if(r(e,o))return!0;if(t.isTag(o)&&t.getName(o)===i)break}return!1},"only-of-type"(e,{adapter:t,equals:r}){let n=t.getName(e);return t.getSiblings(e).every(i=>r(e,i)||!t.isTag(i)||t.getName(i)!==n)},"only-child"(e,{adapter:t,equals:r}){return t.getSiblings(e).every(n=>r(e,n)||!t.isTag(n))}};function hf(e,t,r,n){if(r===null){if(e.length>n)throw new Error(`Pseudo-class :${t} requires an argument`)}else if(e.length===n)throw new Error(`Pseudo-class :${t} doesn't have any arguments`)}function qa(e){return e.type==="_flexibleDescendant"||Hl(e)}function ay(e){let t=e.map(ru);for(let r=1;r<e.length;r++){let n=t[r];if(!(n<0))for(let i=r;i>0&&n<t[i-1];i--){let a=e[i];e[i]=e[i-1],e[i-1]=a,t[i]=t[i-1],t[i-1]=n}}}function AM(e){switch(e.action){case It.Exists:return 10;case It.Equals:return e.name==="id"?9:8;case It.Not:return 7;case It.Start:return 6;case It.End:return 6;case It.Any:return 5;case It.Hyphen:return 4;case It.Element:return 3}}function ru(e){switch(e.type){case he.Universal:return 50;case he.Tag:return 30;case he.Attribute:return Math.floor(AM(e)/(e.ignoreCase?2:1));case he.Pseudo:return e.data?e.name==="has"||e.name==="contains"||e.name==="icontains"?0:Array.isArray(e.data)?Math.max(0,Math.min(...e.data.map(t=>Math.min(...t.map(ru))))):2:3;default:return-1}}function hs(e){return e.type===he.Pseudo&&(e.name==="scope"||Array.isArray(e.data)&&e.data.some(t=>t.some(hs)))}var gf={};function CM(e){return e.some(t=>t.length>0&&(qa(t[0])||t.some(hs)))}var mf=(e,t,r,n,i)=>{let a=i(t,Ha(r),n);return a===bn?e:a===lt?lt:o=>a(o)&&e(o)},nu={is:mf,matches:mf,where:mf,not(e,t,r,n,i){let a=i(t,Ha(r),n);return a===lt?e:a===bn?lt:o=>!a(o)&&e(o)},has(e,t,r,n,i){let{adapter:a}=r,o=Ha(r);o.relativeSelector=!0;let s=t.some(c=>c.some(qa))?[gf]:void 0,l=CM(t),u=i(t,o,s);if(u===lt)return lt;if(s&&u!==bn)return l?c=>{if(!e(c))return!1;s[0]=c;let f=a.getChildren(c);return Xa(u,u.shouldTestNextSiblings?[...f,...Ql(c,a)]:f,r)!==null}:Wa(e,r,c=>(s[0]=c,Xa(u,a.getChildren(c),r)!==null));let d=c=>Xa(u,a.getChildren(c),r)!==null;return l?c=>e(c)&&d(c):Wa(e,r,d)}};function oy(e,t,r,n,i){let{name:a,data:o}=t;if(Array.isArray(o)){if(!(a in nu))throw new Error(`Unknown pseudo-class :${a}(${o})`);return nu[a](e,o,r,n,i)}let s=r.pseudos?.[a],l=typeof s=="string"?s:ty[a];if(typeof l=="string"){if(o!=null)throw new Error(`Pseudo ${a} doesn't have any arguments`);let u=En(l);return nu.is(e,u,r,n,i)}if(typeof s=="function")return hf(s,a,o,1),u=>s(u,o)&&e(u);if(a in tu)return tu[a](e,o,r,n,i);if(a in pf){let u=pf[a];return hf(u,a,o,2),d=>u(d,r,o)&&e(d)}throw new Error(`Unknown pseudo-class :${a}`)}function sy(e,t,r,n,i,a){let{adapter:o,equals:s,cacheResults:l}=r;switch(t.type){case he.PseudoElement:throw new Error("Pseudo-elements are not supported by css-select");case he.ColumnCombinator:throw new Error("Column combinators are not yet supported by css-select");case he.Attribute:{if(t.namespace!=null)throw new Error("Namespaced attributes are not yet supported by css-select");return(!r.xmlMode||r.lowerCaseAttributeNames)&&(t.name=t.name.toLowerCase()),Jg[t.action](e,t,r)}case he.Pseudo:return oy(e,t,r,n,i);case he.Tag:{if(t.namespace!=null)throw new Error("Namespaced tag names are not yet supported by css-select");let{name:u}=t;return(!r.xmlMode||r.lowerCaseTags)&&(u=u.toLowerCase()),function(c){return o.getName(c)===u&&e(c)}}case he.Descendant:{if(!a||l===!1||typeof WeakMap>"u")return function(c){let f=c;for(;f=nn(f,o);)if(e(f))return!0;return!1};let u=new WeakMap;return function(c){let f=c,p;for(;f=nn(f,o);){let h=u.get(f);if(h===void 0){if(p??={matches:!1},p.matches=e(f),u.set(f,p),p.matches)return!0}else return p&&(p.matches=h.matches),h.matches}return!1}}case"_flexibleDescendant":return function(d){let c=d;do{if(e(c))return!0;c=nn(c,o)}while(c);return!1};case he.Parent:return function(d){return o.getChildren(d).some(c=>o.isTag(c)&&e(c))};case he.Child:return function(d){let c=nn(d,o);return c!==null&&e(c)};case he.Sibling:return function(d){let c=o.getSiblings(d);for(let f of c){if(s(d,f))break;if(o.isTag(f)&&e(f))return!0}return!1};case he.Adjacent:return o.prevElementSibling?function(d){let c=o.prevElementSibling(d);return c!=null&&e(c)}:function(d){let c=o.getSiblings(d),f;for(let p of c){if(s(d,p))break;o.isTag(p)&&(f=p)}return!!f&&e(f)};case he.Universal:{if(t.namespace!=null&&t.namespace!=="*")throw new Error("Namespaced universal selectors are not yet supported by css-select");return e}}}var OM={type:he.Descendant},TM={type:"_flexibleDescendant"},PM={type:he.Pseudo,name:"scope",data:null};function DM(e,{adapter:t},r){let n=!!r?.every(i=>i===gf||t.isTag(i)&&nn(i,t)!==null);for(let i of e){if(!(i.length>0&&qa(i[0])&&i[0].type!==he.Descendant))if(n&&!i.some(hs))i.unshift(OM);else continue;i.unshift(PM)}}function yf(e,t,r){for(let u of e)ay(u);let{context:n=r,rootFunc:i=bn}=t,a=Array.isArray(n),o=n&&(Array.isArray(n)?n:[n]);if(t.relativeSelector!==!1)DM(e,t,o);else if(e.some(u=>u.length>0&&qa(u[0])))throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let s=!1,l=lt;e:for(let u of e){if(u.length>=2){let[f,p]=u;f.type!==he.Pseudo||f.name!=="scope"||(a&&p.type===he.Descendant?u[1]=TM:(p.type===he.Adjacent||p.type===he.Sibling)&&(s=!0))}let d=i,c=!1;for(let f of u)if(d=sy(d,f,t,o,yf,c),ru(f)===0&&(c=!0),d===lt)continue e;if(d===i)return i;l=l===lt?d:jM(l,d)}return l.shouldTestNextSiblings=s,l}function jM(e,t){return r=>e(r)||t(r)}var uy=(e,t)=>e===t,ly={adapter:{...df,isTag:pr},equals:uy};function vf(e){let t=e??ly;return t.adapter??=ly.adapter,t.equals??=t.adapter?.equals??uy,t}function dy(e,t,r){let n=vf(t),i=cy(e,n,r);return i===lt?lt:a=>n.adapter.isTag(a)&&i(a)}function cy(e,t,r){return yf(typeof e=="string"?En(e):e,vf(t),r)}function fy(e){return function(r,n,i){let a=vf(i);typeof r!="function"&&(r=cy(r,a,n));let o=EM(n,a.adapter,r.shouldTestNextSiblings);return e(r,o,a)}}function EM(e,t,r=!1){return r&&(e=zM(e,t)),Array.isArray(e)?t.removeSubsets(e):t.getChildren(e)}function zM(e,t){let r=Array.isArray(e)?[...e]:[e],n=r.length;for(let i=0;i<n;i++){let a=Ql(r[i],t);r.push(...a)}return r}var e7=fy((e,t,r)=>e===lt||!t||t.length===0?[]:Qg(e,t,r)),t7=fy((e,t,r)=>e===lt||!t||t.length===0?null:Xa(e,t,r));import{generate as C2,lexer as O2,parse as Dx}from"css-tree";var _M=(e=>(e.LINEAR="linear",e.EASE="ease",e.EASE_IN="ease-in",e.EASE_OUT="ease-out",e.EASE_IN_OUT="ease-in-out",e.EASE_IN_QUAD="ease-in-quad",e.EASE_OUT_QUAD="ease-out-quad",e.EASE_IN_OUT_QUAD="ease-in-out-quad",e.EASE_IN_CUBIC="ease-in-cubic",e.EASE_OUT_CUBIC="ease-out-cubic",e.EASE_IN_OUT_CUBIC="ease-in-out-cubic",e.EASE_IN_QUART="ease-in-quart",e.EASE_OUT_QUART="ease-out-quart",e.EASE_IN_OUT_QUART="ease-in-out-quart",e.EASE_IN_SINE="ease-in-sine",e.EASE_OUT_SINE="ease-out-sine",e.EASE_IN_OUT_SINE="ease-in-out-sine",e.EASE_IN_QUINT="ease-in-quint",e.EASE_OUT_QUINT="ease-out-quint",e.EASE_IN_OUT_QUINT="ease-in-out-quint",e.EASE_IN_EXPO="ease-in-expo",e.EASE_OUT_EXPO="ease-out-expo",e.EASE_IN_OUT_EXPO="ease-in-out-expo",e.EASE_IN_CIRC="ease-in-circ",e.EASE_OUT_CIRC="ease-out-circ",e.EASE_IN_OUT_CIRC="ease-in-out-circ",e.EASE_IN_BACK="ease-in-back",e.EASE_OUT_BACK="ease-out-back",e.EASE_IN_OUT_BACK="ease-in-out-back",e.CUSTOM_BEZIER="custom-bezier",e.LINEAR_FUNCTION="linear-function",e.STEPS="steps",e))(_M||{}),wd={linear:null,ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-quad":[.55,.085,.68,.53],"ease-out-quad":[.25,.46,.45,.94],"ease-in-out-quad":[.455,.03,.515,.955],"ease-in-cubic":[.55,.055,.675,.19],"ease-out-cubic":[.215,.61,.355,1],"ease-in-out-cubic":[.645,.045,.355,1],"ease-in-quart":[.895,.03,.685,.22],"ease-out-quart":[.165,.84,.44,1],"ease-in-out-quart":[.77,0,.175,1],"ease-in-sine":[.47,0,.745,.715],"ease-out-sine":[.39,.575,.565,1],"ease-in-out-sine":[.445,.05,.55,.95],"ease-in-quint":[.755,.05,.855,.06],"ease-out-quint":[.23,1,.32,1],"ease-in-out-quint":[.86,0,.07,1],"ease-in-expo":[.95,.05,.795,.035],"ease-out-expo":[.19,1,.22,1],"ease-in-out-expo":[1,0,0,1],"ease-in-circ":[.6,.04,.98,.335],"ease-out-circ":[.075,.82,.165,1],"ease-in-out-circ":[.785,.135,.15,.86],"ease-in-back":[.6,-.28,.735,.045],"ease-out-back":[.175,.885,.32,1.275],"ease-in-out-back":[.68,-.55,.265,1.55],"custom-bezier":null,"linear-function":null,steps:null};function Id(e){return`definition:${e.definitionId}${e.nodeId?`/${e.nodeId}`:""}`}var RM=(e=>(e.LINEAR="linear",e.QUADRATIC="quadratic",e.CUBIC="cubic",e.CATMULL_ROM="catmull-rom",e.ARC="arc",e.BASIS="basis",e.MIXED="mixed",e))(RM||{}),FM=(e=>(e.SMOOTH="smooth",e.CORNER="corner",e.SYMMETRIC="symmetric",e))(FM||{});var LM={symbol:!0,marker:!0,"linear-gradient":!0,"radial-gradient":!0,pattern:!0,filter:!0,"appearance-style":!0},n7=Object.keys(LM),BM=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform","layerName","leadingComments","fillColor","borderColor","borderWidth","opacity","fillOpacity","strokeOpacity","locked","visible","fillType","fillGradient","strokeType","strokeGradient","fillRule","strokeLinejoin","strokeLinecap","strokeMiterlimit","lineStyle","dashLength","gapLength","dashOffset","strokeDasharray","colorInterpolation","filters","filterColorInterpolation","filterUnits","primitiveUnits","filterX","filterY","filterWidth","filterHeight","metadata","cssClipPath","cssMaskProperties","structural","displayMode","definitionOrder","definitionContainerId","display","visibility","inheritFill","inheritStroke","preserveOpacity","preserveFillOpacity","preserveStrokeOpacity","fillLibraryId","strokeLibraryId","authoredFillPaint","authoredStrokePaint","filterLibraryIds","appearance","graphicStyleId","fillRuleExplicit","paintOrder","vectorEffect","transformBox","pathLength","markerStart","markerMid","markerEnd","blendMode","shapeRendering","textRendering","imageRendering","colorRendering","systemLanguage","requiredExtensions","presentationChannels","inlineStyle","authoredAttributes","bindings","scripts","lastSolidFillColor","lastSolidStrokeColor","connectionPoints","isRootSvg","x","y","width","height","rx","ry","cornerRadius","cornerShape","cornerMode","cornerRadiusTL","cornerRadiusTR","cornerRadiusBL","cornerRadiusBR","cornerShapeTL","cornerShapeTR","cornerShapeBL","cornerShapeBR","size","radius","cx","cy","shiftAngle","x1","y1","x2","y2","startEndpoint","endEndpoint","routingMode","sourceRef","targetRef","sourcePoint","targetPoint","waypoints","label","labelPosition","labelOffset","mermaidEdgeStyle","textX","textY","authoredTextPosition","textSpanTree","fontSize","text","fontFamily","fontWeight","fontStyle","fontStretch","fontSizeAdjust","fontVariant","fontVariantLigatures","fontVariantPosition","fontVariantCaps","fontVariantNumeric","fontVariantEastAsian","textDecoration","textTransform","baselineShift","dominantBaseline","alignmentBaseline","writingMode","textAnchor","letterSpacing","wordSpacing","lineHeight","inlineSize","overflowWrap","whiteSpace","textDirection","unicodeBidi","useRichText","richTextRuns","charOffsets","fontVariationSettings","linePositions","textLength","lengthAdjust","shapeInsideRef","shapeInsideImportRefId","shapePadding","isTextPath","textPathPoints","textPathStartOffset","textPathStartOffsetUnit","textPathSide","textPathMethod","textPathSpacing","textPathLengthAdjust","textPathLength","textPathLengthUnit","textPathPathLength","textPathCurveType","textPathInlineFormat","textPathReference","textPathImportReference","href","originalWidth","originalHeight","preserveAspectRatio","specPreserveAspectRatio","imageOpacity","pathPoints","pathArcParams","pathControlBounds","pathCurveType","pathClosed","pathTension","polylinePoints","polylineClosed","sides","arms","innerRadiusPercent","armWidthPercent","turns","thicknessPercent","spiralDirection","teeth","toothDepthPercent","holeRadiusPercent","headWidthPercent","headLengthPercent","shaftWidthPercent","tailAngleDeg","tailLengthPercent","tailWidthPercent","lobeRadiusPercent","cleftDepthPercent","boltSegments","boltJaggednessPercent","boltWidthPercent","cloudBumps","cloudPuffinessPercent","slantPercent","topWidthPercent","capHeightPercent","waveAmplitudePercent","symbolId","authoredUseGeometry","symbolOverrides","variantKey","instancePresentation","scaleContentToViewport","groupData","mediaKind","mediaMimeType","naturalDuration","begin","trimStart","trimEnd","volume","muted","loop","playbackRate","mediaOpacity","fadeInDuration","fadeOutDuration","posterHref","sourceRect","foreignContent","hrefXlink","linkTarget","linkRel","linkDownload","linkPing","linkHreflang","linkType","linkReferrerPolicy","containerPresentation","targetShapeId","offsetX","offsetY","targetWidth","targetHeight","broken","switchSystemLanguage","switchRequiredExtensions","svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","authoredRootDimensions","svgPreserveAspectRatio","viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight","viewName","viewPreserveAspectRatio","viewZoomAndPan","viewTarget","children"],In=29,VM=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform"],vb=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY"],UM={transformMatrix:null,translateX:0,translateY:0,rotation:0,skewX:0,skewY:0,customPivot:null,rawTransform:null},ai="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",kd=ai.length,oi=ai[0],py=ai[kd-1],bb=ai[Math.floor(kd/2)],np=97,GM=122;function ko(e){let t=ai.indexOf(e);if(t===-1)throw new Error(`order-key: invalid digit '${e}'`);return t}function XM(e){let t=e.charCodeAt(0);if(t<np||t>GM)throw new Error(`order-key: invalid head '${e}'`);return t-np+1}function Ti(e){if(e<1||e>26)throw new Error(`order-key: integer length ${e} out of range`);return String.fromCharCode(np+e-1)}function Vs(e){let t=XM(e[0]);if(e.length<1+t)throw new Error(`order-key: '${e}' shorter than its integer part`);let r=e.slice(1,1+t),n=e.slice(1+t);for(let i of r)ko(i);for(let i of n)ko(i);return{integer:r,fraction:n}}function Xu(e){for(let t of e)if(t!==oi)return!1;return!0}function WM(e){if(e.length===0)return!1;try{let{integer:t,fraction:r}=Vs(e);return!(r.endsWith(oi)||Xu(t)&&r.length===0||t.length>1&&t[0]===oi)}catch{return!1}}function hy(e,t){if(!WM(e))throw new Error(`order-key: invalid ${t} '${e}'`)}function xb(e,t){return e<t?-1:e>t?1:0}function HM(e){let t=e.split("");for(let r=t.length-1;r>=0;r--){let n=ko(t[r]);if(n<kd-1){t[r]=ai[n+1];for(let i=r+1;i<t.length;i++)t[i]=oi;return t.join("")}}return null}function ip(e){let{integer:t}=Vs(e),r=HM(t);if(r!==null)return Ti(t.length)+r;let n="1"+oi.repeat(t.length);return Ti(n.length)+n}function qM(e){let t=e.split("");for(let r=t.length-1;r>=0;r--){let n=ko(t[r]);if(n>0){t[r]=ai[n-1];for(let i=r+1;i<t.length;i++)t[i]=py;return t.join("")}t[r]=py}throw new Error(`order-key: cannot decrement zero integer '${e}'`)}function YM(e){let t=0;for(;t<e.length-1&&e[t]===oi;)t++;return e.slice(t)}function KM(e){let{integer:t,fraction:r}=Vs(e);if(!Xu(t)){let n=qM(t);if(!Xu(n)){let i=YM(n);return Ti(i.length)+i}return Ti(1)+oi+bb}return Ti(1)+oi+Us("",r)}function Us(e,t){if(t!==null){if(t.length===0||e>=t)throw new Error(`order-key: fraction bounds out of order ('${e}' >= '${t}')`);let i=0;for(;i<t.length&&(e[i]??oi)===t[i];)i++;if(i>0)return t.slice(0,i)+Us(e.slice(i),t.slice(i))}let r=e.length>0?ko(e[0]):0,n=t!==null?ko(t[0]):kd;return n-r>1?ai[Math.floor((r+n)/2)]:ai[r]+Us(e.slice(1),null)}function ZM(e,t){if(e!==null&&hy(e,"lower bound"),t!==null&&hy(t,"upper bound"),e!==null&&t!==null&&e>=t)throw new Error(`order-key: bounds out of order ('${e}' >= '${t}')`);if(e===null&&t===null)return Ti(1)+"1";if(e===null)return KM(t);if(t===null)return ip(e);let r=Vs(e),n=Vs(t),i=Ti(r.integer.length)+r.integer,a=Ti(n.integer.length)+n.integer;if(i===a)return i+Us(r.fraction,n.fraction);let o=ip(i+(Xu(r.integer)?bb:""));return xb(o,t)<0?o:i+Us(r.fraction,null)}function JM(e){if(e<=0)return[];let t=[],r=ZM(null,null);t.push(r);for(let n=1;n<e;n++)r=ip(r),t.push(r);return t}var QM="fill-0",eA="stroke-0";function tA(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string")return;let t=e.trim();if(!/^[+-]?(\d+\.?\d*|\.\d+)$/.test(t))return;let r=Number.parseFloat(t);return Number.isFinite(r)?r:void 0}function my(e){let t={id:QM,kind:"fill"};return e.fillColor!==void 0&&(t.color=e.fillColor),e.fillType!==void 0&&(t.paintType=e.fillType),e.fillGradient!==void 0&&(t.gradient=e.fillGradient),e.fillLibraryId!==void 0&&(t.libraryId=e.fillLibraryId),e.fillOpacity!==void 0&&(t.opacity=e.fillOpacity),e.authoredFillPaint!==void 0&&(t.authoredPaint=e.authoredFillPaint),t}function gy(e){let t={id:eA,kind:"stroke"};e.borderColor!==void 0&&(t.color=e.borderColor),e.strokeType!==void 0&&(t.paintType=e.strokeType),e.strokeGradient!==void 0&&(t.gradient=e.strokeGradient),e.strokeLibraryId!==void 0&&(t.libraryId=e.strokeLibraryId),e.strokeOpacity!==void 0&&(t.opacity=e.strokeOpacity);let r=tA(e.borderWidth);return r!==void 0&&(t.width=r),e.strokeLinejoin!==void 0&&(t.linejoin=e.strokeLinejoin),e.strokeLinecap!==void 0&&(t.linecap=e.strokeLinecap),e.strokeMiterlimit!==void 0&&(t.miterlimit=e.strokeMiterlimit),e.strokeDasharray!==void 0&&(t.dasharray=e.strokeDasharray),e.dashOffset!==void 0&&(t.dashoffset=e.dashOffset),e.authoredStrokePaint!==void 0&&(t.authoredPaint=e.authoredStrokePaint),t}function rA(e,t){if(!t||!e)return;let r;if(typeof e=="function")r=e(t);else if(e instanceof Map)r=e.get(t);else for(let n of e)if(n.id===t){r=n;break}return r?.kind==="appearance-style"?r:void 0}function wb(e,t){return rA(t,e.graphicStyleId)}function Ib(e,t){let r=wb(e,t)?.layers??e.appearance;if(!Array.isArray(r)||r.length===0)return[my(e),gy(e)];let n=!1,i=!1;return r.map(a=>a.kind==="fill"&&!n?(n=!0,{...my(e),...yy(a)}):a.kind==="stroke"&&!i?(i=!0,{...gy(e),...yy(a)}):a)}function yy(e){let t={id:e.id};return e.enabled!==void 0&&(t.enabled=e.enabled),e.filterLibraryIds!==void 0&&(t.filterLibraryIds=e.filterLibraryIds),t}function nA(e){return e.enabled===!1?!1:e.paintType!=="none"}function iA(e,t){return Ib(e,t).filter(nA)}function aA(e){if(e.length!==2)return!0;let[t,r]=e;return t.kind!=="fill"||r.kind!=="stroke"?!0:e.some(n=>n.enabled===!1||(n.filterLibraryIds?.length??0)>0)}function kb(e,t){let r=e?.appearance;if(!Array.isArray(r))return;let n=i=>{typeof i=="string"&&i&&t(i)};for(let i of r){if(!i||typeof i!="object")continue;let a=i;n(a.libraryId),n(a.gradient?.id);let o=a.filterLibraryIds;if(Array.isArray(o))for(let s of o)n(s)}}function oA(e,t){kb({appearance:e.layers},t)}var vy=Object.freeze({linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"});function sA(e,t,r,n,i=1e-4){if(Math.abs(e)<i&&Math.abs(t)<i&&Math.abs(r-1)<i&&Math.abs(n-1)<i)return"linear";for(let[a,o]of Object.entries(wd))if(o&&Math.abs(e-o[0])<i&&Math.abs(t-o[1])<i&&Math.abs(r-o[2])<i&&Math.abs(n-o[3])<i)return a;return null}function Sb(e,t,r,n){let i=sA(e,t,r,n);return i===null?{easing:"custom-bezier",customBezier:[e,t,r,n]}:{easing:i}}function lA(e){let t=[],r=0,n="";for(let i of e)i==="("?r++:i===")"&&r--,i===","&&r===0?(t.push(n.trim()),n=""):n+=i;return(n.trim()!==""||t.length>0)&&t.push(n.trim()),t}function uA(e){switch(e){case"jump-start":case"start":return"jump-start";case"jump-end":case"end":return"jump-end";case"jump-none":return"jump-none";case"jump-both":return"jump-both";default:return null}}function dA(e){let t=[];for(let i of e)i.positions.length===0?t.push({value:i.value,position:null}):(t.push({value:i.value,position:i.positions[0]}),i.positions.length===2&&t.push({value:i.value,position:i.positions[1]}));if(t.length<2)return null;t[0].position===null&&(t[0].position=0),t[t.length-1].position===null&&(t[t.length-1].position=1);let r=0;for(;r<t.length;){if(t[r].position!==null){r++;continue}let i=r;for(;i<t.length&&t[i].position===null;)i++;let a=t[r-1].position,o=t[i]?.position??1,s=i-r+1;for(let l=0;l<i-r;l++)t[r+l].position=a+(o-a)*(l+1)/s;r=i}let n=t[0].position;return t.map(i=>{let a=Math.max(n,i.position);return n=a,{value:i.value,position:a}})}function Sd(e){let t=e.trim().toLowerCase();if(!t)return null;if(t==="step-start")return{kind:"steps",count:1,position:"jump-start"};if(t==="step-end")return{kind:"steps",count:1,position:"jump-end"};if(t in vy)return{kind:"keyword",easing:vy[t]};let r=/^cubic-bezier\s*\(([^)]*)\)$/u.exec(t);if(r){let l=r[1].split(",").map(p=>Number(p.trim()));if(l.length!==4||l.some(p=>!Number.isFinite(p)))return null;let[u,d,c,f]=l;return u<0||u>1||c<0||c>1?null:{kind:"cubic-bezier",points:[u,d,c,f]}}let n=/^steps\s*\(([^)]*)\)$/u.exec(t);if(n){let l=n[1].split(",").map(c=>c.trim());if(l.length<1||l.length>2||!/^\d+$/u.test(l[0]))return null;let u=Number(l[0]);if(!Number.isInteger(u)||u<1)return null;let d=uA(l[1]??"jump-end");return!d||d==="jump-none"&&u<2?null:{kind:"steps",count:u,position:d}}let i=/^linear\s*\(([\s\S]*)\)$/u.exec(t);if(!i)return null;let a=lA(i[1]);if(a.length===0)return null;let o=[];for(let l of a){let u=l.split(/\s+/u).filter(Boolean);if(u.length===0)return null;let d=Number(u[0]);if(!Number.isFinite(d))return null;let c=[];for(let f of u.slice(1)){if(!f.endsWith("%"))return null;let p=Number(f.slice(0,-1));if(!Number.isFinite(p))return null;c.push(p/100)}if(c.length>2)return null;o.push({value:d,positions:c})}let s=dA(o);return s&&s.length>=2?{kind:"linear",points:s}:null}function cA(e,t){switch(delete e.customBezier,delete e.linearPoints,delete e.stepsParams,t.kind){case"keyword":e.easing=t.easing;return;case"cubic-bezier":{let r=Sb(...t.points);e.easing=r.easing,r.customBezier&&(e.customBezier=r.customBezier);return}case"steps":e.easing="steps",e.stepsParams={count:t.count,position:t.position};return;case"linear":e.easing="linear-function",e.linearPoints=[...t.points]}}function by(e,t,r){let n=1-e;return 3*n*n*e*t+3*n*e*e*r+e*e*e}function xy(e,t){let r=Math.max(0,Math.min(1,e)),n=0,i=1,a=r;for(let o=0;o<24;o++){let s=by(a,t[0],t[2]);if(Math.abs(s-r)<=1e-8)break;s<r?n=a:i=a,a=(n+i)/2}return by(a,t[1],t[3])}function fA(e,t){let r=Math.max(0,Math.min(1,t));if(!e)return r;switch(e.kind){case"keyword":{let n=wd[e.easing];return n?xy(r,n):r}case"cubic-bezier":return xy(r,e.points);case"steps":{let{count:n,position:i}=e,a=Math.floor(r*n);(i==="jump-start"||i==="jump-both")&&a++;let o=i==="jump-none"?n-1:i==="jump-both"?n+1:n;return Math.max(0,Math.min(1,(a+(i==="jump-none"?-1:0))/o))}case"linear":{let n=e.points;if(r<=n[0].position)return n[0].value;for(let i=1;i<n.length;i++){if(r>n[i].position)continue;let a=n[i-1],o=n[i],s=o.position-a.position;return s<=0?o.value:a.value+(o.value-a.value)*(r-a.position)/s}return n.at(-1).value}}}function ti(e){let t=e.trim(),r=/^(\d+):(\d{2}):(\d{2}(?:\.\d+)?)$/u.exec(t);if(r)return Number(r[1])*3600+Number(r[2])*60+Number(r[3]);let n=/^(\d{2}):(\d{2}(?:\.\d+)?)$/u.exec(t);if(n)return Number(n[1])*60+Number(n[2]);let i=/^([+-]?\d+(?:\.\d+)?)\s*(h|min|ms|s)?$/u.exec(t);if(i){let o=Number(i[1]);switch(i[2]??"s"){case"h":return o*3600;case"min":return o*60;case"ms":return o/1e3;default:return o}}let a=Number.parseFloat(t);return Number.isNaN(a)?0:a}function ap(e,t,r,n,i){if(e===t&&r===n)return i;let a=1e-6,o=8,s=p=>(((1-3*r+3*e)*p+(3*r-6*e))*p+3*e)*p,l=p=>(((1-3*n+3*t)*p+(3*n-6*t))*p+3*t)*p,u=p=>(3*(1-3*r+3*e)*p+2*(3*r-6*e))*p+3*e,d=i;for(let p=0;p<o;p++){let h=s(d)-i;if(Math.abs(h)<a)return l(d);let m=u(d);if(Math.abs(m)<a)break;d-=h/m}let c=0,f=1;for(d=i;c<f;){let p=s(d);if(Math.abs(p-i)<a)return l(d);i>p?c=d:f=d;let h=(f-c)*.5+c;if(h===d)break;d=h}return l(d)}function pA(e,t){let{count:r,position:n}=t;if(r<1)return e;let i=Math.floor(e*r);(n==="jump-start"||n==="jump-both")&&(i+=1),e>=0&&i<0&&(i=0);let a;switch(n){case"jump-start":case"jump-end":a=r;break;case"jump-none":a=r-1;break;case"jump-both":a=r+1;break}return i>a&&(i=a),i/a}function hA(e,t){if(!e||e.length===0)return t;if(e.length===1||t<=e[0].position)return e[0].value;if(t>=e[e.length-1].position)return e[e.length-1].value;let r=0;for(let o=1;o<e.length&&e[o].position<=t;o++)r=o;let n=r+1;if(n>=e.length)return e[r].value;let i=e[n].position-e[r].position;if(i===0)return e[n].value;let a=(t-e[r].position)/i;return e[r].value+a*(e[n].value-e[r].value)}function mA(e,t,r,n,i){let a=Math.max(0,Math.min(1,e));if(t==="linear")return a;if(t==="linear-function"&&n)return hA(n,a);if(t==="steps"&&i)return pA(a,i);if(t==="custom-bezier"&&r)return ap(r[0],r[1],r[2],r[3],a);let o=wd[t];return o?ap(o[0],o[1],o[2],o[3],a):a}function gA(e,t){return mA(t,e.easing,e.customBezier,e.linearPoints,e.stepsParams)}var yA={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function $b(e){let t=yA[e.trim().toLowerCase()];return t===void 0?null:{r:t>>16&255,g:t>>8&255,b:t&255}}var vA={color:"css-rgba",angle:"linear"};function bA(e){let t=e.trim().toLowerCase();if(t==="transparent"||t==="none")return{r:0,g:0,b:0,a:0};if(e.startsWith("#")){let i=e.slice(1);if(i.length===3)return{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:1};if(i.length===6)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:1};if(i.length===8)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:parseInt(i.slice(6,8),16)/255}}let r=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?/);if(r)return{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10),a:r[4]!==void 0?parseFloat(r[4]):1};let n=$b(t);return n?{...n,a:1}:null}function xA(e){if(!e)return null;let t=e.trim();if(t.startsWith("#")){if(t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1};if(t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}}let r=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10),a:1}:null}function wA(e,t=vA.color){return t==="css-rgba"?bA(e):xA(e)}var op="[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?",i7=new RegExp(`^\\s*${op}(?:[\\s,]+${op})*\\s*$`,"u"),a7=new RegExp(op,"gu");function IA(e,t){switch(e){case"reverse":return!0;case"alternate":return t%2===1;case"alternate-reverse":return t%2===0;default:return!1}}function kA(e){if(e.cycleDuration!==void 0)return Math.max(0,e.cycleDuration);if(e.keyframes.length<2)return 0;let t=e.keyframes[0]?.time??0,r=e.keyframes[e.keyframes.length-1]?.time??t;return Math.max(0,r-t)}function SA(e){let t=e.keyframes[0]?.time??0;if(!e.beginTrigger)return t;if(e.beginTrigger.type!=="time")return null;let r=Number.parseFloat(e.beginTrigger.value);return Number.isFinite(r)?r:null}function $A(e){if(e.cycleInfinite||e.simpleDuration==="indefinite")return null;let t=SA(e);return t===null?null:t+kA(e)*Math.max(0,e.cycleRepeats??1)}function NA(e){if(!e.fillBackwards||e.keyframes.length===0)return null;let t=e.keyframes[0].time,r=e.beginTrigger?.type==="time"?Number.parseFloat(e.beginTrigger.value):Number.NaN,n=Number.isFinite(r)?Math.max(0,r):t;if(!(n>0))return null;let i=IA(e.cycleBehavior??"restart",0)?e.keyframes.at(-1):e.keyframes[0],a=Array.isArray(i.value)?[...i.value]:i.value;return{...e,id:`${e.id}:backwards-fill`,keyframes:[{time:0,value:a,easing:"linear"},{time:n,value:a,easing:"linear"}],beginTrigger:void 0,endTrigger:void 0,cycleDuration:n,simpleDuration:void 0,cycleRepeats:void 0,cycleInfinite:!1,cycleBehavior:"restart",fill:"remove",fillBackwards:!1,sourceSmilId:void 0,template:void 0,sourceCssAnimationId:void 0}}function sp(e){if(Array.isArray(e))return e.map(sp);if(e===null||typeof e!="object")return e;let t={};for(let r of Object.keys(e).sort()){let n=e[r];n!==void 0&&(t[r]=sp(n))}return t}function Xp(e){let t=JSON.stringify(sp(e)),r=2166136261;for(let n=0;n<t.length;n++)r^=t.charCodeAt(n),r=Math.imul(r,16777619);return`fnv1a32:${(r>>>0).toString(16).padStart(8,"0")}:${t.length}`}var MA=/^(?:-(?:webkit|moz|o|ms)-)?animation(?:-[a-z-]+)?$/i;function Wp(e){return MA.test(e.trim())}function Nb(e){if(!e)return;let t=Object.fromEntries(Object.entries(e).filter(([r])=>!Wp(r)));return Object.keys(t).length>0?t:void 0}function AA(e){if(!e)return;let t=Object.fromEntries(Object.entries(e).filter(([r])=>Wp(r)).sort(([r],[n])=>r.localeCompare(n)));return Object.keys(t).length>0?t:void 0}function Mb(e){let t=new Map,r=n=>{let i=AA(n.state.inlineStyle);i&&t.set(n.id,i);let a=n.state.children;for(let o of a??[])r(o)};for(let n of e??[])r(n);return Xp([...t].sort(([n],[i])=>n.localeCompare(i)).map(([n,i])=>({shapeId:n,declarations:i})))}function Ab(e){return Xp(e??[])}function Cb(e){let{id:t,locked:r,sourceCssAnimationId:n,keyframes:i,...a}=e;return Xp({...a,keyframes:i.map(({id:o,...s})=>s)})}var CA=new Set(["ease","ease-in","ease-out","ease-in-out","linear","step-start","step-end"]),OA=new Set(["normal","reverse","alternate","alternate-reverse"]),TA=new Set(["none","forwards","backwards","both"]),PA=new Set(["running","paused"]),Hp="(?:\\d+(?:\\.\\d+)?|\\.\\d+)",Ob=`[+-]?${Hp}`,DA=new RegExp(`^${Hp}(?:s|ms)$`,"u"),jA=new RegExp(`^${Ob}(?:s|ms)$`,"u"),EA=new RegExp(`^${Hp}$`,"u");function Tb(e){switch(e.kind){case"keyword":return e.easing;case"cubic-bezier":return"custom-bezier";case"steps":return"steps";case"linear":return"linear-function"}}function qp(e){if(!e)return[];let t=[],r=0,n=null,i=!1,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(i){i=!1;continue}if(s==="\\"){i=!0;continue}if(n){s===n&&(n=null);continue}if(s==='"'||s==="'"){n=s;continue}s==="("?r++:s===")"?r=Math.max(0,r-1):s===","&&r===0&&(t.push(e.slice(a,o).trim()),a=o+1)}return t.push(e.slice(a).trim()),t}function Yp(e,t){let r=qp(e);return r.length===0?"":r[t%r.length]}function wy(e){let t=e.trim().replace(/\w+\([^)]*\)/gu,f=>f.replace(/\s+/gu,"")).split(/\s+/u).filter(Boolean);if(t.length===0)return null;let r=0,n=0,i="ease",a={kind:"keyword",easing:"ease"},o="normal",s="1",l="none",u="",d=!1,c=!1;for(let f of t){if(!d&&DA.test(f)){r=f.endsWith("ms")?Number(f.slice(0,-2))/1e3:Number(f.slice(0,-1)),d=!0;continue}if(d&&!c&&jA.test(f)){n=f.endsWith("ms")?Number(f.slice(0,-2))/1e3:Number(f.slice(0,-1)),c=!0;continue}if(/^(?:cubic-bezier|steps|linear)\(/u.test(f)||CA.has(f)){let p=Sd(f);p&&(a=p,i=Tb(p));continue}if(OA.has(f)){o=f;continue}if(f==="infinite"){s=f;continue}if(EA.test(f)){s=f;continue}if(TA.has(f)){l=f;continue}PA.has(f)||u||(u=f)}return!u||r<=0?null:{name:u,duration:r,delay:n,easing:i,parsedEasing:a,direction:o,iterationCount:s,fillMode:l}}function Iy(e){let t=new RegExp(`^(${Ob})\\s*(s|ms)$`,"iu").exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2].toLowerCase()==="ms"?r/1e3:r}function zA(e,t,r){let n=c=>Yp(t[c],r),i=Iy(n("animation-delay"));i!==null&&(e.delay=i);let a=Iy(n("animation-duration"));a!==null&&a>0&&(e.duration=a);let o=Sd(n("animation-timing-function"));o&&(e.parsedEasing=o,e.easing=Tb(o));let s=n("animation-direction");s&&(e.direction=s);let l=n("animation-iteration-count");l&&(e.iterationCount=l);let u=n("animation-fill-mode");u&&(e.fillMode=u);let d=n("animation-name");d&&d!=="none"&&(e.name=d)}function _A(e){let t=qp(e["animation-name"]);if(t.length===0||t.every(n=>!n||n==="none"))return"";let r=["animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state"];return t.map((n,i)=>{let a=r.map(o=>Yp(e[o],i)).filter(Boolean);return a.push(n),a.join(" ")}).join(", ")}function RA(e){let t=e.fillMode==="forwards"||e.fillMode==="both",r=e.fillMode==="backwards"||e.fillMode==="both";return{...t?{}:{fill:"remove"},...r?{fillBackwards:!0}:{}}}function $d(e){return/[\t\n\f\r ]/u.test(e??"")}function Gs(e,t){if(e[t]!=="/"||e[t+1]!=="*")return t;let r=e.indexOf("*/",t+2);return r<0?e.length:r+2}function iu(e,t){let r=t;for(;r<e.length;){if($d(e[r])){r++;continue}let n=Gs(e,r);if(n===r)break;r=n}return r}function Wu(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n!=="\\"){t+=n;continue}r++;let i=e[r];if(i===void 0)return null;if(i===`
16
+ `||i==="\r"||i==="\f"){i==="\r"&&e[r+1]===`
17
+ `&&r++;continue}if(/[0-9a-f]/iu.test(i)){let a=i;for(;a.length<6&&/[0-9a-f]/iu.test(e[r+1]??"");)a+=e[++r];$d(e[r+1])&&r++;let o=Number.parseInt(a,16);t+=o===0||o>1114111||o>=55296&&o<=57343?"\uFFFD":String.fromCodePoint(o);continue}t+=i}return t}function Xs(e,t,r=!1){let n=[],i=0,a=null,o=!1,s=0;for(let l=0;l<e.length;l++){let u=e[l];if(a){o?o=!1:u==="\\"?o=!0:u===a&&(a=null);continue}if(u==="/"&&e[l+1]==="*"){l=Math.max(l,Gs(e,l)-1);continue}if(u==='"'||u==="'"){a=u;continue}if(u==="("||u==="["||u==="{")s++;else if(u===")"||u==="]"||u==="}")s=Math.max(0,s-1);else if(u===t&&s===0&&(n.push(Object.freeze({start:i,end:l})),i=l+1,r))break}return n.push(Object.freeze({start:i,end:e.length})),n}function da(e,t){return Xs(e,t,t===":").map(r=>e.slice(r.start,r.end))}function FA(e){return!!(e&&(/[-_a-z]/iu.test(e)||e==="\\"))}function LA(e){return!!(e&&(/[-_a-z0-9]/iu.test(e)||e==="\\"))}function BA(e,t){let r=t;for(;r<e.length;){let n=e[r];if(n!=="\\"){if(!LA(n))break;r++;continue}r++;let i=e[r];if(i===void 0||i===`
18
+ `||i==="\r"||i==="\f")break;if(!/[0-9a-f]/iu.test(i)){r++;continue}let a=0;for(;a<6&&/[0-9a-f]/iu.test(e[r]??"");)a++,r++;$d(e[r])&&r++}return r}function Po(e){let t=[],r=null,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(r){n?n=!1:a==="\\"?n=!0:a===r&&(r=null);continue}if(a==="/"&&e[i+1]==="*"){i=Math.max(i,Gs(e,i)-1);continue}if(a==='"'||a==="'"){r=a;continue}if(!FA(a))continue;let o=i,s=BA(e,i);if(e[s]!=="("){i=s-1;continue}let l=s+1,u=1,d=null,c=!1,f=l;for(;f<e.length;f++){let p=e[f];if(d){c?c=!1:p==="\\"?c=!0:p===d&&(d=null);continue}if(p==="/"&&e[f+1]==="*"){f=Math.max(f,Gs(e,f)-1);continue}if(p==='"'||p==="'"){d=p;continue}if(p==="(")u++;else if(p===")"&&--u===0)break}if(u!==0){i=s;continue}t.push(Object.freeze({name:Wu(e.slice(o,s))?.toLowerCase()??e.slice(o,s).toLowerCase(),tokenStart:o,tokenEnd:f+1,argumentsStart:l,argumentsEnd:f})),i=f}return Object.freeze(t)}function VA(e,t){if(e.slice(t,t+3).toLowerCase()!=="url"||e[t+3]!=="(")return!1;let r=e[t-1];return!r||!/[-_a-z0-9]/iu.test(r)}function el(e){let t=[],r=null,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(r){n?n=!1:a==="\\"?n=!0:a===r&&(r=null);continue}if(a==="/"&&e[i+1]==="*"){i=Math.max(i,Gs(e,i)-1);continue}if(a==='"'||a==="'"){r=a;continue}if(!VA(e,i))continue;let o=i,s=iu(e,i+4),l=e[s]==='"'||e[s]==="'"?e[s++]:null;if(s=iu(e,s),e[s]!=="#")continue;s++;let u=s,d=s,c=!1,f=!1;for(;s<e.length;s++){let h=e[s];if(f){f=!1,d=s+1;continue}if(h==="\\"){f=!0,d=s+1;continue}if(l){if(h===l){s=iu(e,s+1),c=e[s]===")";break}d=s+1;continue}if(h===")"){c=!0;break}if($d(h)||h==="/"&&e[s+1]==="*"){s=iu(e,s),c=e[s]===")";break}d=s+1}if(!c||d<=u)continue;let p=Wu(e.slice(u,d));p&&(t.push(Object.freeze({targetAuthoredId:p,tokenStart:o,tokenEnd:s+1,targetStart:u,targetEnd:d})),i=s)}return Object.freeze(t)}var Pb=String.raw`[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?`,Db="px|pt|pc|in|cm|mm|q|em|rem|%|ex|ch|vw|vh|vmin|vmax",UA=new RegExp(String.raw`^(${Pb})\s*(${Db})?$`,"i"),ky=new RegExp(`(${Pb})(${Db})?`,"gi");function Dr(e){if(e===null||e.trim().length===0)return null;let t=UA.exec(e.trim());if(!t)return null;let r=Number(t[1]);return Number.isFinite(r)?Object.freeze({value:r,unit:(t[2]??"").toLowerCase()}):null}function Nd(e){if(!e)return Object.freeze([]);ky.lastIndex=0;let t=[],r;for(;(r=ky.exec(e))!==null;){let n=Number(r[1]);Number.isFinite(n)&&t.push(Object.freeze({value:n,unit:(r[2]??"").toLowerCase()}))}return Object.freeze(t)}function xa(e,t){let r=e.value;if(Number.isFinite(r))switch(e.unit.toLowerCase()){case"%":return t.percentBasis===void 0?void 0:r*t.percentBasis/100;case"vw":return t.viewportWidth===void 0?void 0:r*t.viewportWidth/100;case"vh":return t.viewportHeight===void 0?void 0:r*t.viewportHeight/100;case"vmin":return t.viewportWidth===void 0||t.viewportHeight===void 0?void 0:r*Math.min(t.viewportWidth,t.viewportHeight)/100;case"vmax":return t.viewportWidth===void 0||t.viewportHeight===void 0?void 0:r*Math.max(t.viewportWidth,t.viewportHeight)/100;case"em":return t.fontSize===void 0?void 0:r*t.fontSize;case"rem":return t.rootFontSize===void 0?void 0:r*t.rootFontSize;case"ex":return t.xHeight!==void 0?r*t.xHeight:t.fontSize===void 0?void 0:r*.5*t.fontSize;case"ch":return t.chWidth!==void 0?r*t.chWidth:t.fontSize===void 0?void 0:r*.5*t.fontSize;case"":case"px":return r;case"pt":return r*(4/3);case"pc":return r*16;case"in":return r*96;case"cm":return r*(96/2.54);case"mm":return r*(96/25.4);case"q":return r*(96/101.6);default:return}}function it(e,t){let r=Dr(e);return r?xa(r,t):void 0}function si(e){let t=Dr(e);if(!(!t||["em","rem","%","ex","ch","vw","vh","vmin","vmax"].includes(t.unit)))return xa(t,{})}var Ot=Object.freeze([1,0,0,1,0,0]);function Qr(e,t,r,n,i,a){return[e,t,r,n,i,a]}function Hu(e){return Qr(e[0]??1,e[1]??0,e[2]??0,e[3]??1,e[4]??0,e[5]??0)}function cn(e){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function So(e){return Array.isArray(e)&&e.length>=6&&e.slice(0,6).every(Number.isFinite)}function fn(e,t=1e-9){return Math.abs((e[0]??1)-1)<=t&&Math.abs(e[1]??0)<=t&&Math.abs(e[2]??0)<=t&&Math.abs((e[3]??1)-1)<=t&&Math.abs(e[4]??0)<=t&&Math.abs(e[5]??0)<=t}function je(e,t){return Qr(e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5])}function zt(e,t){return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}function Sy(e,t){return{x:e[0]*t.x+e[2]*t.y,y:e[1]*t.x+e[3]*t.y}}function Wt(e,t=0){return Qr(1,0,0,1,e,t)}function Md(e,t=e){return Qr(e,0,0,t,0,0)}function qu(e){let t=e*Math.PI/180,r=Math.cos(t),n=Math.sin(t);return Qr(r,n,-n,r,0,0)}function Kp(e){return Qr(1,0,Math.tan(e*Math.PI/180),1,0,0)}function Zp(e){return Qr(1,Math.tan(e*Math.PI/180),0,1,0,0)}function Jp(e,t){return je(je(Wt(e.x,e.y),t),Wt(-e.x,-e.y))}var GA=9,XA=10,WA=12,HA=13,qA=32,$y=43,YA=44,Ny=45,KA=46,ZA=48,JA=57,QA=40,eC=41,tC=69,rC=101,nC=0,iC=1,jb=2,aC=new Map([["matrix",[6]],["translate",[1,2]],["scale",[1,2]],["rotate",[1,3]],["skewX",[1]],["skewY",[1]]]);function oC(e){return e===qA||e===GA||e===XA||e===HA||e===WA}function Eu(e){return e>=ZA&&e<=JA}function sC(e){let t=e>=65&&e<=90,r=e>=97&&e<=122;return t||r||Eu(e)}function yo(e){for(;e.pos<e.src.length&&oC(e.src.charCodeAt(e.pos));)e.pos++}function Eb(e){let t=e.pos;return yo(e),e.src.charCodeAt(e.pos)===YA?(e.pos++,yo(e),jb):e.pos>t?iC:nC}function My(e){let t=e.src,r=e.pos,n=r,i=t.charCodeAt(n);(i===$y||i===Ny)&&n++;let a=!1;for(;n<t.length&&Eu(t.charCodeAt(n));)n++,a=!0;if(t.charCodeAt(n)===KA){let l=n+1;for(;l<t.length&&Eu(t.charCodeAt(l));)l++;l>n+1&&(n=l,a=!0)}if(!a)return null;let o=t.charCodeAt(n);if(o===rC||o===tC){let l=n+1,u=t.charCodeAt(l);(u===$y||u===Ny)&&l++;let d=l;for(;d<t.length&&Eu(t.charCodeAt(d));)d++;d>l&&(n=d)}let s=Number(t.slice(r,n));return Number.isFinite(s)?(e.pos=n,s):null}function lC(e,t){switch(e){case"matrix":return Hu(t);case"translate":return Wt(t[0],t[1]??0);case"scale":return Md(t[0],t[1]??t[0]);case"rotate":return t.length===3?Jp({x:t[1],y:t[2]},qu(t[0])):qu(t[0]);case"skewX":return Kp(t[0]);case"skewY":return Zp(t[0]);default:return null}}function uC(e){let t=e.src,r=e.pos;for(;e.pos<t.length&&sC(t.charCodeAt(e.pos));)e.pos++;if(e.pos===r)return null;let n=t.slice(r,e.pos),i=aC.get(n);if(!i||(yo(e),t.charCodeAt(e.pos)!==QA))return null;e.pos++,yo(e);let a=i[i.length-1],o=My(e);if(o===null)return null;let s=[o];for(;;){let l=e.pos;Eb(e);let u=My(e);if(u===null){e.pos=l;break}if(s.push(u),s.length>a)return null}return yo(e),t.charCodeAt(e.pos)!==eC||(e.pos++,!i.includes(s.length))?null:lC(n,s)}function dC(e){let t={src:e,pos:0};if(yo(t),t.pos>=e.length)return Ot;let r=Ot;for(;;){let n=uC(t);if(n===null)return null;r=je(r,n);let i=Eb(t);if(t.pos>=e.length)return i===jb?null:r}}var cC=2048,ms=new Map;function Ei(e){if(!e)return Ot;let t=ms.get(e);if(t!==void 0)return t;let r=dC(e),n=r===null?null:Object.freeze(r);if(ms.size>=cC){let i=ms.keys().next().value;i!==void 0&&ms.delete(i)}return ms.set(e,n),n}function wa(e){return Ei(e)??Ot}function lp(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=Math.sqrt(t*t+r*r);if(a<1e-12)return{rotation:0,scaleX:0,scaleY:Math.sqrt(n*n+i*i),skewX:0};let o=Math.atan2(r,t),s=(t*i-r*n)/a,l=s!==0?(t*n+r*i)/(a*a):0,u=Math.atan(l),d=180/Math.PI;return{rotation:o*d,scaleX:a,scaleY:s,skewX:u*d}}function Qp(e){return!So(e)||fn(e)?null:`matrix(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]})`}function zb(e,t){let r=e.translateX??0,n=e.translateY??0,i=typeof e.rawTransform=="string"?e.rawTransform:"",a=e.rotation??0,o=e.skewX??0,s=e.skewY??0,l=e.scaleX??1,u=e.scaleY??1,d=Wt(r,n);if(i)return je(d,wa(i));if(a===0&&o===0&&s===0&&l===1&&u===1)return d;let c=e.customPivot??t;if(!c)return d;let f=je(je(je(qu(a),Md(l,u)),Kp(o)),Zp(s));return je(d,Jp(c,f))}function un(e,t){return Qp(ri(e,t))}function ri(e,t){let r=e.transformMatrix;return So(r)&&!fn(r)?Hu(r):zb(e,t)}function fC(e,t){let r=e.ancestorTransform;if(!So(r)){delete e.ancestorTransform;return}if(fn(r)){delete e.ancestorTransform;return}let n=So(e.transformMatrix)?Hu(e.transformMatrix):zb(e,t);e.transformMatrix=cn(je(Hu(r),n)),delete e.ancestorTransform}function pC(e,t,r){let n=un(e,{x:t,y:r});return n?`${n} translate(${t}, ${r})`:`translate(${t}, ${r})`}var hC=Object.freeze({left:0,center:50,right:100}),mC=Object.freeze({top:0,center:50,bottom:100});function Si(e,t,r){let n=Dr(e);return!n||n.unit===""&&n.value!==0?null:xa(n,{...r,percentBasis:t==="x"?r.boxWidth:t==="y"?r.boxHeight:void 0})??null}function Ay(e,t,r){let n=e.trim().toLowerCase(),i=t==="horizontal"?hC:mC;if(Object.hasOwn(i,n))return{kind:"percentage",value:i[n]};let a=Dr(n);if(!a||a.unit===""&&a.value!==0)return null;if(a.unit==="%")return{kind:"percentage",value:a.value};let o=xa(a,r);return o===void 0?null:{kind:"length",value:o}}function Cy(e,t,r){return e.kind==="length"?t+e.value:r===void 0?null:t+e.value*r/100}function _b(e,t={}){let r=e.trim().split(/\s+/u).filter(Boolean);if(r.length===0||r.length>3)return null;let n=0;if(r.length===3){let d=Si(r[2],"z",t);if(d===null||r[2].includes("%"))return null;n=d}let i,a;if(r.length===1){let d=r[0].toLowerCase();d==="top"||d==="bottom"?(i="center",a=r[0]):(i=r[0],a="center")}else{i=r[0],a=r[1];let d=i.toLowerCase(),c=a.toLowerCase(),f=d==="top"||d==="bottom",p=c==="left"||c==="right";f&&(p||c==="center")?[i,a]=[a,i]:d==="center"&&p&&([i,a]=[a,i])}let o=Ay(i,"horizontal",t),s=Ay(a,"vertical",t);if(!o||!s)return null;let l=Cy(o,t.boxX??0,t.boxWidth),u=Cy(s,t.boxY??0,t.boxHeight);return l===null||u===null?null:Object.freeze(n===0?{x:l,y:u}:{x:l,y:u,z:n})}var Ad=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),gC=new Set(["matrix3d","perspective","rotate3d","rotatex","rotatey","rotatez","scale3d","scalez","translate3d","translatez"]),yC=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(deg|grad|rad|turn)?$/iu;function Oy(e){return e.replace(/\/\*[\s\S]*?\*\//gu,"").trim()===""}function vC(e){let t=[],r="",n=0,i=null,a=!1,o=!1,s=()=>{let l=r.trim();return r="",l?(t.push(l),!0):!1};for(let l=0;l<e.length;l++){let u=e[l];if(i){r+=u,a?a=!1:u==="\\"?a=!0:u===i&&(i=null);continue}if(u==='"'||u==="'"){i=u,r+=u;continue}if(u==="/"&&e[l+1]==="*"){let d=e.indexOf("*/",l+2);if(d<0)return null;r+=" ",l=d+1;continue}if(u==="("){n++,r+=u;continue}if(u===")"){if(n===0)return null;n--,r+=u;continue}if(n===0&&u===","){if(!s())return null;o=!0;continue}if(n===0&&/\s/u.test(u)&&!o){r.trim()&&s();continue}r+=u}return n!==0||i||r.trim()===""&&o||r.trim()&&!s()?null:Object.freeze(t)}function Rb(e){if(e.trim().toLowerCase()==="none")return Object.freeze([]);let t=Po(e);if(t.length===0)return null;let r=[],n=0;for(let i of t){if(!Oy(e.slice(n,i.tokenStart)))return null;let a=vC(e.slice(i.argumentsStart,i.argumentsEnd));if(!a)return null;r.push(Object.freeze({name:i.name,args:a})),n=i.tokenEnd}return Oy(e.slice(n))?Object.freeze(r):null}function wn(e){if(e===void 0||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function sn(e){if(e===void 0)return null;let t=yC.exec(e.trim());if(!t)return null;let r=Number(t[1]);if(!Number.isFinite(r)||!t[2]&&r!==0)return null;switch(t[2]?.toLowerCase()){case"grad":return r*Math.PI/200;case"rad":return r;case"turn":return r*2*Math.PI;default:return r*Math.PI/180}}function ca(e,t){let r=new Array(16).fill(0);for(let n=0;n<4;n++)for(let i=0;i<4;i++)for(let a=0;a<4;a++)r[n*4+i]+=e[n*4+a]*t[a*4+i];return r}function fa(e,t,r){return[1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1]}function Ns(e,t,r){return[e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1]}function Ai(e,t,r,n){let i=Math.hypot(e,t,r);if(i===0)return n===0?Ad:null;e/=i,t/=i,r/=i;let a=Math.cos(n),o=Math.sin(n),s=1-a;return[e*e*s+a,e*t*s-r*o,e*r*s+t*o,0,t*e*s+r*o,t*t*s+a,t*r*s-e*o,0,r*e*s-t*o,r*t*s+e*o,r*r*s+a,0,0,0,0,1]}function Hr(e,...t){return t.includes(e.length)}function Cd(e,t){let r=e.args;switch(e.name){case"translate":{if(!Hr(r,1,2))return null;let n=Si(r[0],"x",t),i=Si(r[1]??"0","y",t);return n===null||i===null?null:fa(n,i,0)}case"translatex":case"translatey":case"translatez":{if(!Hr(r,1))return null;let n=e.name.at(-1),i=Si(r[0],n,t);return i===null?null:fa(n==="x"?i:0,n==="y"?i:0,n==="z"?i:0)}case"translate3d":{if(!Hr(r,3))return null;let n=Si(r[0],"x",t),i=Si(r[1],"y",t),a=Si(r[2],"z",t);return n===null||i===null||a===null?null:fa(n,i,a)}case"scale":{if(!Hr(r,1,2))return null;let n=wn(r[0]),i=r.length===1?n:wn(r[1]);return n===null||i===null?null:Ns(n,i,1)}case"scalex":case"scaley":case"scalez":{if(!Hr(r,1))return null;let n=wn(r[0]);return n===null?null:Ns(e.name==="scalex"?n:1,e.name==="scaley"?n:1,e.name==="scalez"?n:1)}case"scale3d":{if(!Hr(r,3))return null;let n=r.map(wn);return n.some(i=>i===null)?null:Ns(n[0],n[1],n[2])}case"rotate":case"rotatex":case"rotatey":case"rotatez":{if(!Hr(r,1))return null;let n=sn(r[0]);return n===null?null:e.name==="rotatex"?Ai(1,0,0,n):e.name==="rotatey"?Ai(0,1,0,n):Ai(0,0,1,n)}case"rotate3d":{if(!Hr(r,4))return null;let n=wn(r[0]),i=wn(r[1]),a=wn(r[2]),o=sn(r[3]);return n===null||i===null||a===null||o===null?null:Ai(n,i,a,o)}case"skew":{if(!Hr(r,1,2))return null;let n=sn(r[0]),i=sn(r[1]??"0deg");return n===null||i===null?null:[1,Math.tan(n),0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1]}case"skewx":case"skewy":{if(!Hr(r,1))return null;let n=sn(r[0]);return n===null?null:e.name==="skewx"?[1,Math.tan(n),0,0,0,1,0,0,0,0,1,0,0,0,0,1]:[1,0,0,0,Math.tan(n),1,0,0,0,0,1,0,0,0,0,1]}case"matrix":{if(!Hr(r,6))return null;let n=r.map(wn);return n.some(i=>i===null)?null:[n[0],n[2],0,n[4],n[1],n[3],0,n[5],0,0,1,0,0,0,0,1]}case"matrix3d":{if(!Hr(r,16))return null;let n=r.map(wn);if(n.some(a=>a===null))return null;let i=[n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15]];return i[12]===0&&i[13]===0&&i[14]===0&&i[15]===1?i:"perspective"}case"perspective":return Hr(r,1)&&Si(r[0],"z",t)!==null?"perspective":null;default:return null}}function Fb(e,t){let r=Ad;for(let n of e){let i=Cd(n,t);if(!i||i==="perspective")return i;r=ca(r,i)}return r}function bC(e){let t=Rb(e);if(!t)return"invalid";let r=Fb(t,{boxWidth:100,boxHeight:100,viewportWidth:100,viewportHeight:100,fontSize:16,rootFontSize:16,xHeight:8,chWidth:8});return r==="perspective"?"unsupported-perspective":r===null?"invalid":null}function Yu(e){return e.startsWith("translate")?"translate":e.startsWith("scale")?"scale":e.startsWith("rotate")?"rotate":e.startsWith("skew")?"skew":"matrix"}function Ty(e){let t=e.name;return t==="perspective"?null:t.startsWith("translate")?Object.freeze({name:t,args:Object.freeze(e.args.map(()=>"0px"))}):t.startsWith("scale")?Object.freeze({name:t,args:Object.freeze(e.args.map(()=>"1"))}):t==="rotate3d"?Object.freeze({name:t,args:Object.freeze(["0","0","1","0deg"])}):t.startsWith("rotate")||t.startsWith("skew")?Object.freeze({name:t,args:Object.freeze(e.args.map(()=>"0deg"))}):t==="matrix"?Object.freeze({name:t,args:Object.freeze(["1","0","0","1","0","0"])}):t==="matrix3d"?Object.freeze({name:t,args:Object.freeze(Ad.map(String))}):null}function xC(e,t){let r=[...e],n=[...t],i=Math.max(r.length,n.length);for(let a=0;a<i;a++){if(!r[a]&&n[a]){let o=Ty(n[a]);if(!o)return null;r[a]=o}if(!n[a]&&r[a]){let o=Ty(r[a]);if(!o)return null;n[a]=o}}return[r,n]}function Py(e,t){let r=Cd(e,t);return!r||r==="perspective"?null:[r[3],r[7],r[11]]}function Dy(e){let t=Cd(e,{});return!t||t==="perspective"?null:[t[0],t[5],t[10]]}function Xt(e,t,r){return e+(t-e)*r}function wC(e,t,r,n){let i=Yu(e.name);if(i!==Yu(t.name))return null;if(i==="translate"){let a=Py(e,n),o=Py(t,n);return a&&o?fa(Xt(a[0],o[0],r),Xt(a[1],o[1],r),Xt(a[2],o[2],r)):null}if(i==="scale"){let a=Dy(e),o=Dy(t);return a&&o?Ns(Xt(a[0],o[0],r),Xt(a[1],o[1],r),Xt(a[2],o[2],r)):null}if(i==="rotate"&&e.name===t.name){if(e.name==="rotate3d"){let l=e.args.slice(0,3).map(wn),u=t.args.slice(0,3).map(wn),d=sn(e.args[3]),c=sn(t.args[3]);if(l.some(v=>v===null)||u.some(v=>v===null)||d===null||c===null)return null;let f=Math.hypot(l[0],l[1],l[2]),p=Math.hypot(u[0],u[1],u[2]);if(f===0||p===0)return null;let h=[l[0]/f,l[1]/f,l[2]/f],m=[u[0]/p,u[1]/p,u[2]/p],g=h[0]*m[0]+h[1]*m[1]+h[2]*m[2];return Math.abs(Math.abs(g)-1)>1e-10?null:Ai(h[0],h[1],h[2],Xt(d,g<0?-c:c,r))}let a=sn(e.args[0]),o=sn(t.args[0]);if(a===null||o===null)return null;let s=Xt(a,o,r);return e.name==="rotatex"?Ai(1,0,0,s):e.name==="rotatey"?Ai(0,1,0,s):Ai(0,0,1,s)}if(i==="skew"&&e.name===t.name&&e.args.length===t.args.length){let a=e.args.map(sn),o=t.args.map(sn);return a.some(s=>s===null)||o.some(s=>s===null)?null:Cd({name:e.name,args:a.map((s,l)=>`${Xt(s,o[l],r)}rad`)},n)}return null}function IC(e,t,r,n){let i=xC(e,t);if(!i)return null;let a=Ad;for(let o=0;o<i[0].length;o++){let s=wC(i[0][o],i[1][o],r,n);if(!s)return null;a=ca(a,s)}return a}function Ku(e){return Math.abs(e[12])>1e-10||Math.abs(e[13])>1e-10||Math.abs(e[14])>1e-10||Math.abs(e[15]-1)>1e-10?null:Qr(e[0],e[4],e[1],e[5],e[3],e[7])}function kC(e){return[e[0],e[2],0,e[4],e[1],e[3],0,e[5],0,0,1,0,0,0,0,1]}function au(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function bf(e){return Math.hypot(e[0],e[1],e[2])}function ea(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function xf(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function SC(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function $C(e,t,r){let n=e[0],i=t[0],a=r[0],o=e[1],s=t[1],l=r[1],u=e[2],d=t[2],c=r[2],f=n+s+c,p,h,m,g;if(f>0){let y=Math.sqrt(f+1)*2;g=y/4,p=(d-l)/y,h=(a-u)/y,m=(o-i)/y}else if(n>s&&n>c){let y=Math.sqrt(1+n-s-c)*2;g=(d-l)/y,p=y/4,h=(i+o)/y,m=(a+u)/y}else if(s>c){let y=Math.sqrt(1+s-n-c)*2;g=(a-u)/y,p=(i+o)/y,h=y/4,m=(l+d)/y}else{let y=Math.sqrt(1+c-n-s)*2;g=(o-i)/y,p=(a+u)/y,h=(l+d)/y,m=y/4}let v=Math.hypot(p,h,m,g);return[p/v,h/v,m/v,g/v]}function jy(e){if(Math.abs(e[12])>1e-10||Math.abs(e[13])>1e-10||Math.abs(e[14])>1e-10||Math.abs(e[15]-1)>1e-10)return null;let t=[e[0],e[4],e[8]],r=[e[1],e[5],e[9]],n=[e[2],e[6],e[10]],i=bf(t);if(i<1e-12)return null;t=ea(t,1/i);let a=au(t,r);r=xf(r,ea(t,a));let o=bf(r);if(o<1e-12)return null;r=ea(r,1/o),a/=o;let s=au(t,n);n=xf(n,ea(t,s));let l=au(r,n);n=xf(n,ea(r,l));let u=bf(n);return u<1e-12?null:(n=ea(n,1/u),s/=u,l/=u,au(t,SC(r,n))<0&&(i=-i,t=ea(t,-1)),{translate:[e[3],e[7],e[11]],scale:[i,o,u],skew:[a,s,l],quaternion:$C(t,r,n)})}function NC(e,t,r){let n=[...t],i=e.reduce((u,d,c)=>u+d*n[c],0);if(i<0&&(n=n.map(u=>-u),i=-i),i>.9995){let u=e.map((c,f)=>Xt(c,n[f],r)),d=Math.hypot(...u);return u.map(c=>c/d)}let a=Math.acos(Math.max(-1,Math.min(1,i))),o=Math.sin(a),s=Math.sin((1-r)*a)/o,l=Math.sin(r*a)/o;return e.map((u,d)=>u*s+n[d]*l)}function MC(e){let[t,r,n,i]=e;return[1-2*(r*r+n*n),2*(t*r-n*i),2*(t*n+r*i),0,2*(t*r+n*i),1-2*(t*t+n*n),2*(r*n-t*i),0,2*(t*n-r*i),2*(r*n+t*i),1-2*(t*t+r*r),0,0,0,0,1]}function AC(e,t,r){let n=jy(e),i=jy(t);if(!n||!i)return null;let a=n.translate.map((d,c)=>Xt(d,i.translate[c],r)),o=n.scale.map((d,c)=>Xt(d,i.scale[c],r)),s=n.skew.map((d,c)=>Xt(d,i.skew[c],r)),l=MC(NC(n.quaternion,i.quaternion,r)),u=[1,s[0],s[1],0,0,1,s[2],0,0,0,1,0,0,0,0,1];return ca(ca(fa(a[0],a[1],a[2]),ca(l,u)),Ns(o[0],o[1],o[2]))}function Ey(e){return Math.abs(e[2])<1e-10&&Math.abs(e[6])<1e-10&&Math.abs(e[8])<1e-10&&Math.abs(e[9])<1e-10&&Math.abs(e[10]-1)<1e-10&&Math.abs(e[11])<1e-10}function CC(e,t,r){let n=Ku(e),i=Ku(t);if(!n||!i)return null;let a=lp(n),o=lp(i),s=o.rotation;for(;s-a.rotation>180;)s-=360;for(;s-a.rotation<-180;)s+=360;let l=Xt(a.rotation,s,r)*Math.PI/180,u=Xt(a.skewX,o.skewX,r)*Math.PI/180,d=Xt(a.scaleX,o.scaleX,r),c=Xt(a.scaleY,o.scaleY,r),f=Math.cos(l),p=Math.sin(l),h=Math.tan(u);return kC(Qr(f*d,p*d,f*d*h-p*c,p*d*h+f*c,Xt(n[4],i[4],r),Xt(n[5],i[5],r)))}function OC(e,t,r,n,i,a){return IC(e,t,i,a)||(Ey(r)&&Ey(n)?CC(r,n,i):AC(r,n,i))}function zy(e,t){return ca(ca(fa(t.x,t.y,t.z??0),e),fa(-t.x,-t.y,-(t.z??0)))}function wi(e){return!Number.isFinite(e)||Math.abs(e)<1e-9?0:Number(e.toFixed(10))}function TC(e){return e.every(t=>t.length===1&&(t[0].name==="rotate"||t[0].name==="rotatez"))}function PC(e,t,r){let n=new Set;for(let i of e)for(let a of i)a.name.startsWith("translate")?(a.name!=="translatey"&&a.name!=="translatez"&&n.add("translateX"),a.name!=="translatex"&&a.name!=="translatez"&&n.add("translateY")):a.name.startsWith("scale")?(a.name!=="scaley"&&a.name!=="scalez"&&n.add("scaleX"),a.name!=="scalex"&&a.name!=="scalez"&&n.add("scaleY")):a.name.startsWith("rotate")?n.add("rotation"):a.name==="skew"||a.name==="skewx"?n.add("skewX"):a.name==="skewy"?n.add("skewY"):(a.name==="matrix"||a.name==="matrix3d")&&(n.add("translateX"),n.add("translateY"),n.add("scaleX"),n.add("scaleY"),n.add("rotation"),n.add("skewX"));return t&&(n.add("translateX"),n.add("translateY"),n.add("scaleX"),n.add("scaleY"),n.add("rotation")),r.some(i=>i.skewX!==0)&&n.add("skewX"),Object.freeze([...n])}function Lb(e,t={},r=16){if(e.length===0||!Number.isInteger(r)||r<1)return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let n=e.map(m=>Rb(m.transform));if(n.some(m=>m===null))return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let i=n.map(m=>Fb(m,t));if(i.some(m=>m==="perspective"))return Object.freeze({status:"unsupported-perspective",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});if(i.some(m=>m===null))return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let a=n,o=i,s=t.transformOrigin,l=TC(a),u=t.retainPureRotationOrigin===!0&&l,d=l?a.map(m=>sn(m[0].args[0])*180/Math.PI):null,c=a.some(m=>m.some(g=>gC.has(g.name)))||s!==void 0&&!u&&l||a.some((m,g)=>g>0&&m.length!==a[g-1].length)||a.some((m,g)=>g>0&&m.some((v,y)=>Yu(v.name)!==Yu(a[g-1][y]?.name??"matrix"))),f=[];for(let m=0;m<e.length;m++){let g=s&&!u?zy(o[m],s):o[m],v=Ku(g);if(!v)return Object.freeze({status:"unsupported-perspective",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});f.push({offset:e[m].offset,matrix:v,...d?{rotation:d[m]}:{}});let y=e[m+1];if(!(!y||!c))for(let b=1;b<r;b++){let I=b/r,x=Math.max(0,Math.min(1,t.progressForInterval?.(m,I)??I)),k=OC(a[m],a[m+1],o[m],o[m+1],x,t);if(!k)return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let $=s&&!u?zy(k,s):k,A=Ku($);if(!A)return Object.freeze({status:"unsupported-perspective",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});f.push({offset:e[m].offset+(y.offset-e[m].offset)*I,matrix:A,...d?{rotation:Xt(d[m],d[m+1],x)}:{}})}}let p=null,h=f.sort((m,g)=>m.offset-g.offset).map(({offset:m,matrix:g,rotation:v})=>{let y=lp(g),b=v??y.rotation;if(v===void 0&&p!==null){for(;b-p>180;)b-=360;for(;b-p<-180;)b+=360}p=b;let I=Qr(...g.map(wi));return Object.freeze({offset:wi(m),matrix:I,translateX:wi(I[4]),translateY:wi(I[5]),rotation:wi(b),scaleX:wi(y.scaleX),scaleY:wi(y.scaleY),skewX:wi(y.skewX),skewY:0})});return Object.freeze({status:"projected",stops:Object.freeze(h),sampled:c,pureRotation:u,channels:PC(a,c,h)})}var mr=Object.freeze({cx:0,cy:0,radius:50,cornerRadius:0,shiftAngle:-90}),Rn=Object.freeze({x:0,y:0,width:100,height:60}),ht=Object.freeze({triangle:Object.freeze({...mr}),ngon:Object.freeze({...mr,sides:6}),star:Object.freeze({...mr,arms:5,innerRadiusPercent:50}),cross:Object.freeze({...mr,armWidthPercent:40}),ring:Object.freeze({...mr,innerRadiusPercent:50}),spiral:Object.freeze({...mr,turns:3,thicknessPercent:15,spiralDirection:1}),gear:Object.freeze({...mr,teeth:8,toothDepthPercent:25,holeRadiusPercent:25}),arrow:Object.freeze({...mr,headWidthPercent:100,headLengthPercent:40,shaftWidthPercent:40}),speechBubble:Object.freeze({...mr,tailAngleDeg:45,tailLengthPercent:40,tailWidthPercent:25}),heart:Object.freeze({...mr,lobeRadiusPercent:50,cleftDepthPercent:25}),lightning:Object.freeze({...mr,boltSegments:3,boltJaggednessPercent:40,boltWidthPercent:30}),cloud:Object.freeze({...mr,cloudBumps:5,cloudPuffinessPercent:60}),diamond:Object.freeze({...Rn}),parallelogram:Object.freeze({...Rn,slantPercent:20}),trapezoid:Object.freeze({...Rn,topWidthPercent:70}),terminator:Object.freeze({...Rn}),cylinder:Object.freeze({...Rn,capHeightPercent:15}),"document-shape":Object.freeze({...Rn,waveAmplitudePercent:15})});function _y(e,t,r=-90){let n=[],i=r*Math.PI/180;for(let a=0;a<e;a++){let o=i+a*2*Math.PI/e;n.push({x:t*Math.cos(o),y:t*Math.sin(o)})}return n}function DC(e,t,r,n=-90){let i=[],a=t*(r/100),o=n*Math.PI/180;for(let s=0;s<e*2;s++){let l=o+s*Math.PI/e,u=s%2===0?t:a;i.push({x:u*Math.cos(l),y:u*Math.sin(l)})}return i}function jC(e,t,r=0){let n=e*(t/100)/2,i=[{x:-n,y:-e},{x:n,y:-e},{x:n,y:-n},{x:e,y:-n},{x:e,y:n},{x:n,y:n},{x:n,y:e},{x:-n,y:e},{x:-n,y:n},{x:-e,y:n},{x:-e,y:-n},{x:-n,y:-n}];if(r===0)return i;let a=Math.cos(r*Math.PI/180),o=Math.sin(r*Math.PI/180);return i.map(s=>({x:s.x*a-s.y*o,y:s.x*o+s.y*a}))}function EC(e,t,r,n,i=-90){let a=e*2*(r/100),o=e*(t/100),s=o*(n/100),l=[{x:e,y:0},{x:e-a,y:-o/2},{x:e-a,y:-s/2},{x:-e,y:-s/2},{x:-e,y:s/2},{x:e-a,y:s/2},{x:e-a,y:o/2}];if(i===0)return l;let u=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180);return l.map(c=>({x:c.x*u-c.y*d,y:c.x*d+c.y*u}))}function zC(e,t,r,n,i=0){let a=e,o=a*(r/100),s=a*(n/100),l=s/2,u=t*Math.PI/180,d=Math.cos(u),c=Math.sin(u),f=Math.abs(d),p=Math.abs(c),h=Math.max(f,p)||1,m={x:d*(a/h),y:c*(a/h)},g={x:m.x+d*o,y:m.y+c*o},v=Math.min(s,a-l),y=-a+l+v,b=a-l-v,I={x:-a,y:-a},x={x:a,y:-a},k={x:a,y:a},$={x:-a,y:a},A;if(f>=p&&d>0){let T=Math.max(y,Math.min(b,m.y)),z={x:a,y:T-l},C={x:a,y:T+l};A=[I,x,z,g,C,k,$]}else if(f>=p&&d<=0){let T=Math.max(y,Math.min(b,m.y)),z={x:-a,y:T+l},C={x:-a,y:T-l};A=[I,x,k,$,z,g,C]}else if(c<0){let T=Math.max(y,Math.min(b,m.x)),z={x:T-l,y:-a},C={x:T+l,y:-a};A=[I,z,g,C,x,k,$]}else{let T=Math.max(y,Math.min(b,m.x)),z={x:T+l,y:a},C={x:T-l,y:a};A=[I,x,k,z,g,C,$]}if(i===0)return A;let S=Math.cos(i*Math.PI/180),N=Math.sin(i*Math.PI/180);return A.map(T=>({x:T.x*S-T.y*N,y:T.x*N+T.y*S}))}function _C(e,t,r,n,i=0){let a=Math.max(2,Math.round(t)),o=e*(r/100),s=e*(n/100)/2,l=a+1,u=[];for(let m=0;m<l;m++){let g=m/(l-1),v=-e+g*2*e,y=0;m>0&&m<l-1&&(y=m%2===1?o:-o),u.push({x:y,y:v})}let d=[],c=[];for(let m=0;m<l;m++){if(m===0||m===l-1){d.push({...u[m]}),c.push({...u[m]});continue}let g=u[m-1],v=u[m],y=u[m+1],b=v.x-g.x,I=v.y-g.y,x=Math.hypot(b,I)||1,k=b/x,$=I/x,A=y.x-v.x,S=y.y-v.y,N=Math.hypot(A,S)||1,T=A/N,z=S/N,C=(k+T)/2,O=($+z)/2,E=Math.hypot(C,O),_,U;E<1e-6?(_=-$,U=k):(_=-O/E,U=C/E),d.push({x:v.x-_*s,y:v.y-U*s}),c.push({x:v.x+_*s,y:v.y+U*s})}let f=[];f.push(d[0]);for(let m=1;m<l-1;m++)f.push(c[m]);f.push(d[l-1]);for(let m=l-2;m>=1;m--)f.push(d[m]);if(i===0)return f;let p=Math.cos(i*Math.PI/180),h=Math.sin(i*Math.PI/180);return f.map(m=>({x:m.x*p-m.y*h,y:m.x*h+m.y*p}))}function RC(e,t,r,n=0){let i=e,a=Math.max(.3,Math.min(.9,t/100)),o=-i*(r/100),s={x:0,y:i},l={x:0,y:o},u={x:-i*a,y:i*.4},d={x:-i*a,y:-i},c={x:i*a,y:-i},f={x:i*a,y:i*.4},p=[s,u,d,l,c,f,s],h=n===0?p:(()=>{let x=Math.cos(n*Math.PI/180),k=Math.sin(n*Math.PI/180);return p.map($=>({x:$.x*x-$.y*k,y:$.x*k+$.y*x}))})(),[m,g,v,y,b,I]=h;return`M ${m.x} ${m.y} C ${g.x} ${g.y} ${v.x} ${v.y} ${y.x} ${y.y} C ${b.x} ${b.y} ${I.x} ${I.y} ${m.x} ${m.y} Z`}function FC(e,t,r,n=0){let i=Math.max(3,Math.round(t)),a=Math.max(.3,Math.min(1,r/100)),o=e,s=o*1.7,l=o*1.15,u=[];for(let $=0;$<i;$++){let A=(90+$/i*360)*Math.PI/180;u.push({x:s/2*Math.cos(A),y:-(l/2)*Math.sin(A)})}let d=.15,c=0;for(let $=0;$<i;$++){let A=u[$],S=u[($+1)%i];c=Math.max(c,Math.hypot(S.x-A.x,S.y-A.y))}let f=c/(2*(1-d))+.001,p=Math.max(f,c*(.68+a*.35)),h=u.map($=>{let A=$.y/(l/2);return p*(1-d*A)});function m($){let A=u[$],S=u[($+1)%i],N=h[$],T=h[($+1)%i],z=S.x-A.x,C=S.y-A.y,O=Math.hypot(z,C)||1,E=(N*N-T*T+O*O)/(2*O),_=Math.sqrt(Math.max(0,N*N-E*E)),U=A.x+E/O*z,V=A.y+E/O*C,q=-C/O,G=z/O,H={x:U+q*_,y:V+G*_},W={x:U-q*_,y:V-G*_};return H.x*H.x+H.y*H.y>W.x*W.x+W.y*W.y?H:W}let g=[];for(let $=0;$<i;$++)g.push(m($));let v=14,y=[];for(let $=0;$<i;$++){let A=u[$],S=h[$],N=g[($-1+i)%i],T=g[$],z=Math.atan2(N.y-A.y,N.x-A.x),C=Math.atan2(T.y-A.y,T.x-A.x)-z;C<=0&&(C+=2*Math.PI);let O=2*Math.PI-C,E=z+C/2,_=z-O/2,U={x:A.x+S*Math.cos(E),y:A.y+S*Math.sin(E)},V={x:A.x+S*Math.cos(_),y:A.y+S*Math.sin(_)},q=U.x*U.x+U.y*U.y>V.x*V.x+V.y*V.y?C:-O;for(let G=0;G<v;G++){let H=G/v,W=z+H*q;y.push({x:A.x+S*Math.cos(W),y:A.y+S*Math.sin(W)})}}let b=0;for(let $ of y){let A=Math.max(Math.abs($.x),Math.abs($.y));A>b&&(b=A)}if(b>0&&b!==o){let $=o/b;for(let A of y)A.x*=$,A.y*=$}let I=$=>{if(n===0)return $;let A=Math.cos(n*Math.PI/180),S=Math.sin(n*Math.PI/180);return{x:$.x*A-$.y*S,y:$.x*S+$.y*A}},x=y.map(I),k=`M ${x[0].x} ${x[0].y}`;for(let $=1;$<x.length;$++)k+=` L ${x[$].x} ${x[$].y}`;return k+=" Z",k}function $i(e,t=0,r=0){if(e.length<3)return"";if(t<=0)return e.map((a,o)=>(o===0?"M":"L")+`${a.x},${a.y}`).join(" ")+" Z";let n=Math.min(t,r*.4),i="";for(let a=0;a<e.length;a++){let o=e[(a-1+e.length)%e.length],s=e[a],l=e[(a+1)%e.length],u={x:o.x-s.x,y:o.y-s.y},d=Math.hypot(u.x,u.y);u.x/=d,u.y/=d;let c={x:l.x-s.x,y:l.y-s.y},f=Math.hypot(c.x,c.y);c.x/=f,c.y/=f;let p=Math.min(n,d/2),h=Math.min(n,f/2),m={x:s.x+u.x*p,y:s.y+u.y*p},g={x:s.x+c.x*h,y:s.y+c.y*h};i+=a===0?`M${m.x},${m.y}`:` L${m.x},${m.y}`,i+=` Q${s.x},${s.y} ${g.x},${g.y}`}return i+" Z"}function LC(e,t,r="evenodd"){let n=e*(t/100),i=r==="nonzero"?1:0;return`M ${e} 0 A ${e} ${e} 0 1 1 ${-e} 0 A ${e} ${e} 0 1 1 ${e} 0 Z M ${n} 0 A ${n} ${n} 0 1 ${i} ${-n} 0 A ${n} ${n} 0 1 ${i} ${n} 0 Z`}function BC(e,t,r,n=1,i=0){let a=e*(r/100),o=Math.round(t*36),s=t*2*Math.PI,l=(e-a/2)/s,u=i*Math.PI/180,d=[],c=[];for(let h=0;h<=o;h++){let m=h/o,g=m*s*n+u,v=l*(m*s)+a/2,y=a/2;d.push({x:(v+y*.3)*Math.cos(g),y:(v+y*.3)*Math.sin(g)}),c.push({x:Math.max(0,v-y*.3)*Math.cos(g),y:Math.max(0,v-y*.3)*Math.sin(g)})}let f=`M ${d[0].x} ${d[0].y}`;for(let h=1;h<d.length;h++)f+=` L ${d[h].x} ${d[h].y}`;let p=c[c.length-1];f+=` L ${p.x} ${p.y}`;for(let h=c.length-2;h>=0;h--)f+=` L ${c[h].x} ${c[h].y}`;return f+=" Z",f}var VC=.2;function UC(e,t,r,n=0){let i=t*(r/100),a=t,o=t-i,s=2*Math.PI/e,l=s*VC/2,u=s/4,d=n*Math.PI/180,c=[];for(let f=0;f<e;f++){let p=d+f*s;c.push({x:o*Math.cos(p),y:o*Math.sin(p)}),c.push({x:a*Math.cos(p+u-l),y:a*Math.sin(p+u-l)}),c.push({x:a*Math.cos(p+u+l),y:a*Math.sin(p+u+l)}),c.push({x:o*Math.cos(p+s/2),y:o*Math.sin(p+s/2)})}return c}function GC(e,t,r,n=0,i=0,a="evenodd",o=0){let s=UC(e,t,r,o),l=Math.min(n,t*.1),u=$i(s,l,t);if(i>0){let d=t*(i/100),c=a==="nonzero"?1:0;u+=` M ${d} 0 A ${d} ${d} 0 1 ${c} ${-d} 0 A ${d} ${d} 0 1 ${c} ${d} 0 Z`}return u}function XC(e,t,r,n,i,a="round",o="uniform",s){let l=Math.min(r,n)/2,u,d,c,f,p,h,m,g;if(o==="non-uniform"&&s?(u=Math.min(s.radiusTL??i,l),d=Math.min(s.radiusTR??i,l),c=Math.min(s.radiusBR??i,l),f=Math.min(s.radiusBL??i,l),p=s.shapeTL??a,h=s.shapeTR??a,m=s.shapeBR??a,g=s.shapeBL??a):(u=d=c=f=Math.min(i,l),p=h=m=g=a),!(a!=="round"||o==="non-uniform"||u>0&&p!=="round"||d>0&&h!=="round"||c>0&&m!=="round"||f>0&&g!=="round")&&u===d&&d===c&&c===f)return null;let v=`M${e+u},${t}`;return v+=` L${e+r-d},${t}`,v+=ou(h,d,e+r,t,"tr"),v+=` L${e+r},${t+n-c}`,v+=ou(m,c,e+r,t+n,"br"),v+=` L${e+f},${t+n}`,v+=ou(g,f,e,t+n,"bl"),v+=` L${e},${t+u}`,v+=ou(p,u,e,t,"tl"),v+=" Z",v}function ou(e,t,r,n,i){if(t<=0)return"";switch(e){case"round":switch(i){case"tr":return` A${t},${t} 0 0 1 ${r},${n+t}`;case"br":return` A${t},${t} 0 0 1 ${r-t},${n}`;case"bl":return` A${t},${t} 0 0 1 ${r},${n-t}`;case"tl":return` A${t},${t} 0 0 1 ${r+t},${n}`}break;case"scoop":switch(i){case"tr":return` A${t},${t} 0 0 0 ${r},${n+t}`;case"br":return` A${t},${t} 0 0 0 ${r-t},${n}`;case"bl":return` A${t},${t} 0 0 0 ${r},${n-t}`;case"tl":return` A${t},${t} 0 0 0 ${r+t},${n}`}break;case"bevel":switch(i){case"tr":return` L${r},${n+t}`;case"br":return` L${r-t},${n}`;case"bl":return` L${r},${n-t}`;case"tl":return` L${r+t},${n}`}break;case"notch":switch(i){case"tr":return` L${r-t},${n+t} L${r},${n+t}`;case"br":return` L${r-t},${n-t} L${r-t},${n}`;case"bl":return` L${r+t},${n-t} L${r},${n-t}`;case"tl":return` L${r+t},${n+t} L${r+t},${n}`}break}return""}function WC(e,t,r,n,i,a={}){let o=t+n/2,s=r+i/2;switch(e){case"diamond":return`M${o},${r} L${t+n},${s} L${o},${r+i} L${t},${s} Z`;case"parallelogram":{let l=(a.slantPercent??ht.parallelogram.slantPercent)/100*n;return`M${t+l},${r} L${t+n},${r} L${t+n-l},${r+i} L${t},${r+i} Z`}case"trapezoid":{let l=(a.topWidthPercent??ht.trapezoid.topWidthPercent)/100*n,u=(n-l)/2;return`M${t+u},${r} L${t+u+l},${r} L${t+n},${r+i} L${t},${r+i} Z`}case"terminator":{let l=i/2;return`M${t+l},${r} L${t+n-l},${r} A${l},${l} 0 0 1 ${t+n-l},${r+i} L${t+l},${r+i} A${l},${l} 0 0 1 ${t+l},${r} Z`}case"cylinder":{let l=n/2,u=Math.min((a.capHeightPercent??ht.cylinder.capHeightPercent)/100*i,i/2);return`M${t},${r+u} A${l},${u} 0 0 1 ${t+n},${r+u} A${l},${u} 0 0 1 ${t},${r+u} L${t},${r+i-u} A${l},${u} 0 0 0 ${t+n},${r+i-u} L${t+n},${r+u} M${o-l},${r+u} A${l},${u} 0 0 0 ${o+l},${r+u}`}case"document-shape":{let l=(a.waveAmplitudePercent??ht["document-shape"].waveAmplitudePercent)/100*i;return`M${t},${r} L${t+n},${r} L${t+n},${r+i} C${t+n*.75},${r+i-l*2} ${o+n*.25},${r+i+l} ${o},${r+i} C${o-n*.25},${r+i-l} ${t+n*.25},${r+i+l*.5} ${t},${r+i} Z`}}}function Bb(e,t,r=!1,n=.5,i,a="preserve"){if(e.length<2)return e.length===1?`M ${e[0].x} ${e[0].y}`:"";switch(t){case"CATMULL_ROM":case"catmull-rom":return KC(e,r,n);case"BASIS":case"basis":return ZC(e,r);case"ARC":case"arc":return i&&i.length>0?HC(e,r,i):gs(e,r,"CUBIC",a);case"LINEAR":case"linear":return gs(e,r,"LINEAR",a);case"QUADRATIC":case"quadratic":return gs(e,r,"QUADRATIC",a);case"CUBIC":case"cubic":return gs(e,r,"CUBIC",a);default:return gs(e,r,void 0,a)}}function HC(e,t,r){let n=`M ${e[0].x} ${e[0].y}`,i=0,a={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let o=0;o<e.length-1;o++){let s=e[o+1];if(s.isSubpathStart){if(t&&o-i>=1){let u=e[i],d=r?.[o]??a;n+=` A ${d.rx} ${d.ry} ${d.rotation} ${d.largeArc?1:0} ${d.sweep?1:0} ${u.x} ${u.y} Z`}n+=` M ${s.x} ${s.y}`,i=o+1;continue}let l=r?.[o]??a;n+=` A ${l.rx} ${l.ry} ${l.rotation} ${l.largeArc?1:0} ${l.sweep?1:0} ${s.x} ${s.y}`}if(t&&e.length-i>1){let o=e[i],s=r?.[e.length-1]??a;n+=` A ${s.rx} ${s.ry} ${s.rotation} ${s.largeArc?1:0} ${s.sweep?1:0} ${o.x} ${o.y} Z`}return n}function gs(e,t,r,n="preserve"){let i=Fy(e[0],{x:0,y:0}),a=0,o=null,s=null,l=u=>e[u].subpathClosed??t;for(let u=0;u<e.length-1;u++){let d=e[u],c=e[u+1];if(c.isSubpathStart){if(l(a)&&u-a>=1){let h=e[a];i+=Ry(d,h,o,s,r),i+=" Z"}let p=l(a)?e[a]:d;i+=` ${Fy(c,p)}`,a=u+1,o=null,s=null;continue}i+=Vb(d,c,c.segmentType,o,s,r,n);let f=YC(c.segmentType??r,d,c);o=f,f==="quad"?s=d.handleOut??null:s=null}if(l(a)&&e.length-a>1){let u=e[e.length-1],d=e[a];i+=Ry(u,d,o,s,r,n),i+=" Z"}return i}function Ry(e,t,r,n,i,a="preserve"){let o=(t.segmentType??(e.handleOut||t.handleIn?i??"CUBIC":"LINEAR")).toUpperCase();return o==="LINEAR"||o==="HORIZONTAL"||o==="VERTICAL"?"":Vb(e,t,t.segmentType,r,n,i,a)}var qC=.001;function Ya(e,t){return Math.abs(e-t)<qC}function Fy(e,t){return e.moveRelative?`m ${e.x-t.x} ${e.y-t.y}`:`M ${e.x} ${e.y}`}function YC(e,t,r){let n=(e??(t.handleOut||r.handleIn?"CUBIC":"LINEAR")).toUpperCase();return n==="CUBIC"||n==="SMOOTH_CUBIC"?"cubic":n==="QUADRATIC"||n==="SMOOTH_QUADRATIC"?"quad":null}function Vb(e,t,r,n,i,a,o="preserve"){let s=(r??a??(e.handleOut||t.handleIn?"CUBIC":"LINEAR")).toUpperCase(),l=t.segmentRelative===!0,u=h=>l?h.toLowerCase():h,d=h=>l?h-e.x:h,c=h=>l?h-e.y:h;if(s==="LINEAR"||s==="HORIZONTAL"||s==="VERTICAL"){if(o==="preserve"){if((s==="HORIZONTAL"||s==="LINEAR")&&Ya(e.y,t.y))return` ${u("H")} ${d(t.x)}`;if((s==="VERTICAL"||s==="LINEAR")&&Ya(e.x,t.x))return` ${u("V")} ${c(t.y)}`}return` ${u("L")} ${d(t.x)} ${c(t.y)}`}if(s==="ARC"){let h=t.arcParams;return h?` ${u("A")} ${h.rx} ${h.ry} ${h.rotation} ${h.largeArc?1:0} ${h.sweep?1:0} ${d(t.x)} ${c(t.y)}`:` ${u("L")} ${d(t.x)} ${c(t.y)}`}if(s==="QUADRATIC"||s==="SMOOTH_QUADRATIC"){let h=e.handleOut??{x:(e.x+t.x)/2,y:(e.y+t.y)/2};return o==="preserve"&&s==="SMOOTH_QUADRATIC"&&n==="quad"&&i&&Ya(h.x,2*e.x-i.x)&&Ya(h.y,2*e.y-i.y)?` ${u("T")} ${d(t.x)} ${c(t.y)}`:` ${u("Q")} ${d(h.x)} ${c(h.y)} ${d(t.x)} ${c(t.y)}`}let f=e.handleOut??{x:e.x,y:e.y},p=t.handleIn??{x:t.x,y:t.y};return o==="preserve"&&s==="SMOOTH_CUBIC"&&n==="cubic"&&e.handleIn&&e.handleOut&&Ya(e.handleOut.x,2*e.x-e.handleIn.x)&&Ya(e.handleOut.y,2*e.y-e.handleIn.y)?` ${u("S")} ${d(p.x)} ${c(p.y)} ${d(t.x)} ${c(t.y)}`:` ${u("C")} ${d(f.x)} ${c(f.y)} ${d(p.x)} ${c(p.y)} ${d(t.x)} ${c(t.y)}`}function KC(e,t,r){if(e.length<2)return e.length===1?`M ${e[0].x} ${e[0].y}`:"";let n=r,i=t?[e[e.length-1],...e,e[0],e[1]]:[e[0],...e,e[e.length-1]],a=`M ${e[0].x} ${e[0].y}`,o=t?e.length:e.length-1;for(let s=0;s<o;s++){let l=i[s],u=i[s+1],d=i[s+2],c=i[s+3],f=Math.hypot(d.x-u.x,d.y-u.y),p=Math.hypot(u.x-l.x,u.y-l.y),h=Math.hypot(c.x-d.x,c.y-d.y),m=Math.pow(p,n),g=Math.pow(f,n),v=Math.pow(h,n),y=Math.pow(p,2*n),b=Math.pow(f,2*n),I=Math.pow(h,2*n),x,k,$,A;p<1e-8?(x=u.x,k=u.y):(x=(y*d.x-b*l.x+(2*y+3*m*g+b)*u.x)/(3*m*(m+g)),k=(y*d.y-b*l.y+(2*y+3*m*g+b)*u.y)/(3*m*(m+g))),h<1e-8?($=d.x,A=d.y):($=(I*u.x-b*c.x+(2*I+3*v*g+b)*d.x)/(3*v*(v+g)),A=(I*u.y-b*c.y+(2*I+3*v*g+b)*d.y)/(3*v*(v+g))),a+=` C ${x} ${k} ${$} ${A} ${d.x} ${d.y}`}return t&&(a+=" Z"),a}function ZC(e,t){let r=e.length;if(r<2)return r===1?`M ${e[0].x} ${e[0].y}`:"";if(r===2)return`M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;if(t){let a=(e[0].x+4*e[1].x+e[2].x)/6,o=(e[0].y+4*e[1].y+e[2].y)/6,s=`M ${a} ${o}`;for(let l=0;l<r;l++){let u=e[(l+1)%r],d=e[(l+2)%r],c=e[(l+3)%r];s+=wf(u,d,c)}return s+=" Z",s}let n=e,i=`M ${n[0].x} ${n[0].y}`;i+=` L ${(5*n[0].x+n[1].x)/6} ${(5*n[0].y+n[1].y)/6}`;for(let a=0;a<=r-3;a++)i+=wf(n[a],n[a+1],n[a+2]);return i+=wf(n[r-2],n[r-1],n[r-1]),i+=` L ${n[r-1].x} ${n[r-1].y}`,i}function wf(e,t,r){return` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3} ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3} ${(e.x+4*t.x+r.x)/6} ${(e.y+4*t.y+r.y)/6}`}function JC(e,t,r){let n=Number.isFinite(t)?Math.max(1,t):8,i=Number.isFinite(r)?Math.max(1,r):4;switch(e){case"dashed":case"dotted":case"custom":return`${n} ${i}`;default:return null}}var Ub={M:["number","number"],m:["number","number"],L:["number","number"],l:["number","number"],H:["number"],h:["number"],V:["number"],v:["number"],C:["number","number","number","number","number","number"],c:["number","number","number","number","number","number"],S:["number","number","number","number"],s:["number","number","number","number"],Q:["number","number","number","number"],q:["number","number","number","number"],T:["number","number"],t:["number","number"],A:["number","number","number","flag","flag","number","number"],a:["number","number","number","flag","flag","number","number"],Z:[],z:[]},QC=new Set(Object.keys(Ub));function eO(e){return e===32||e===9||e===10||e===12||e===13}function zu(e){return e>=48&&e<=57}function Gb(e){return e>=65&&e<=90||e>=97&&e<=122}var tO=class{constructor(e){this.source=e}source;position=0;get length(){return this.source.length}skipWhitespace(){for(;this.position<this.length&&eO(this.source.charCodeAt(this.position));)this.position++}skipOptionalCommaWhitespace(){this.skipWhitespace(),this.source.charCodeAt(this.position)===44&&(this.position++,this.skipWhitespace())}readNumber(){let e=this.position,t=e,r=this.source.charCodeAt(t);(r===43||r===45)&&t++;let n=0;for(;t<this.length&&zu(this.source.charCodeAt(t));)t++,n++;if(this.source.charCodeAt(t)===46){let o=t;t++;let s=0;for(;t<this.length&&zu(this.source.charCodeAt(t));)t++,s++;if(s===0){if(n===0)return null;t=o}}else if(n===0)return null;let i=this.source.charCodeAt(t);if(i===101||i===69){let o=t;t++;let s=this.source.charCodeAt(t);(s===43||s===45)&&t++;let l=0;for(;t<this.length&&zu(this.source.charCodeAt(t));)t++,l++;l===0&&(t=o)}let a=Number(this.source.slice(e,t));return Number.isFinite(a)?(this.position=t,a):null}readFlag(){let e=this.source[this.position];return e!=="0"&&e!=="1"?null:(this.position++,e==="1"?1:0)}};function Xb(e,t){return QC.has(e)||(e==="B"||e==="b")&&t.bearing?!0:(e==="R"||e==="r")&&t.catmullRom===!0}function rO(e){if(!e)return!1;let t=e.charCodeAt(0);return zu(t)||e==="+"||e==="-"||e==="."||e===","}function nO(e,t,r,n){return{code:e,offset:t.position,command:r,message:n}}function If(e,t,r){let n=[];for(let i=0;i<t.length;i++){i>0||r?e.skipOptionalCommaWhitespace():e.skipWhitespace();let a=t[i]==="flag"?e.readFlag():e.readNumber();if(a===null)return null;n.push(a)}return n}function su(e,t){if(e.skipWhitespace(),e.position>=e.length)return"end";let r=e.source[e.position];return Xb(r,t)?"command":rO(r)?"parameter":Gb(r.charCodeAt(0))?"unsupported-command":"unexpected"}function Od(e,t={}){let r=new tO(e),n=t.extensions??{},i=[],a=!0,o=(s,l,u)=>({commands:i,error:nO(s,r,l,u)});for(;;){if(r.skipWhitespace(),r.position>=r.length)return{commands:i,error:null};let s=r.position,l=r.source[r.position];if(!Xb(l,n)){let f=Gb(l.charCodeAt(0))?"unsupported-command":"unexpected-content";return o(f,null,`Unexpected path content '${l}'`)}r.position++;let u=l;if(a&&u!=="M"&&u!=="m")return o("initial-moveto-required",u,"Path data must begin with moveto");if(a=!1,u==="Z"||u==="z"){i.push({type:u,params:[],offset:s});let f=su(r,n);if(f==="end"||f==="command")continue;return o(f==="unsupported-command"?"unsupported-command":"unexpected-content",u,"Closepath cannot be implicitly repeated")}if(u==="B"||u==="b"){let f=[];for(;;){let p=If(r,["number"],f.length>0);if(!p){if(f.length===0)return o("missing-parameter",u,"Bearing requires at least one angle");break}f.push(p[0]);let h=su(r,n);if(h!=="parameter"){if(h==="end"||h==="command")break;return i.push({type:u,params:f,offset:s}),o(h==="unsupported-command"?"unsupported-command":"unexpected-content",u,"Invalid bearing command content")}}i.push({type:u,params:f,offset:s});continue}if(u==="R"||u==="r"){let f=[];for(;;){let p=If(r,["number","number"],f.length>0);if(!p)return o("missing-parameter",u,"Catmull-Rom requires complete coordinate pairs");f.push(...p);let h=su(r,n);if(h!=="parameter"){if(h==="end"||h==="command")break;return o(h==="unsupported-command"?"unsupported-command":"unexpected-content",u,"Invalid Catmull-Rom command content")}}if(f.length<6)return o("missing-parameter",u,`R/r: needs at least 3 coordinate pairs, got ${f.length/2}`);i.push({type:u,params:f,offset:s});continue}let d=Ub[u],c=0;for(;;){let f=If(r,d,c>0);if(!f)return o("missing-parameter",u,`Incomplete ${u} command parameters`);let p=c>0&&(u==="M"||u==="m")?u==="M"?"L":"l":u;i.push({type:p,params:f,offset:s}),c++;let h=su(r,n);if(h==="end"||h==="command")break;if(h!=="parameter")return o(h==="unsupported-command"?"unsupported-command":"unexpected-content",u,`Unexpected content in ${u} command`)}}}var uo=Math.PI*2;function iO(e,t,r,n){let i=t*t-4*e*r;if(!(i>=0))return;let a=Math.sqrt(i),o=-.5*(t+(t>=0?a:-a));if(e!==0){let s=o/e;s>0&&s<1&&n.push(s)}if(o!==0){let s=r/o;s>0&&s<1&&n.push(s)}}function aO(e,t,r,n,i){let a=1-i;return a*a*a*e+3*a*a*i*t+3*a*i*i*r+i*i*i*n}function oO(e,t,r,n){let i=1-n;return i*i*e+2*i*n*t+n*n*r}function Ly(e,t,r,n){let i=e<n?e:n,a=e>n?e:n,o=-e+3*t-3*r+n,s=2*(e-2*t+r),l=t-e,u=[];iO(o,s,l,u);for(let d of u){let c=aO(e,t,r,n,d);c<i&&(i=c),c>a&&(a=c)}return{min:i,max:a}}function By(e,t,r){let n=e<r?e:r,i=e>r?e:r,a=e-2*t+r;if(a!==0){let o=(e-t)/a;if(o>0&&o<1){let s=oO(e,t,r,o);s<n&&(n=s),s>i&&(i=s)}}return{min:n,max:i}}function Vy(e,t,r,n){let i=e*n-t*r>=0?1:-1,a=Math.sqrt((e*e+t*t)*(r*r+n*n));if(a===0)return 0;let o=(e*r+t*n)/a;return o<-1?o=-1:o>1&&(o=1),i*Math.acos(o)}function Wb(e,t,r,n,i,a,o,s,l){if(e===s&&t===l||r===0||n===0)return null;let u=Math.abs(r),d=Math.abs(n),c=i%360*Math.PI/180,f=Math.cos(c),p=Math.sin(c),h=(e-s)/2,m=(t-l)/2,g=f*h+p*m,v=-p*h+f*m,y=g*g,b=v*v,I=u*u,x=d*d,k=y/I+b/x;if(k>1){let G=Math.sqrt(k);u*=G,d*=G,I=u*u,x=d*d}let $=I*b+x*y;if($===0)return null;let A=(I*x-$)/$;A<0&&(A=0);let S=Math.sqrt(A);a===o&&(S=-S);let N=S*(u*v/d),T=S*(-(d*g)/u),z=f*N-p*T+(e+s)/2,C=p*N+f*T+(t+l)/2,O=(g-N)/u,E=(v-T)/d,_=(-g-N)/u,U=(-v-T)/d,V=Vy(1,0,O,E),q=Vy(O,E,_,U);return!o&&q>0?q-=uo:o&&q<0&&(q+=uo),{cx:z,cy:C,rx:u,ry:d,phi:c,theta1:V,deltaTheta:q}}function sO(e,t){let r=Math.cos(e.phi),n=Math.sin(e.phi),i=t?zt(t,{x:e.cx,y:e.cy}):{x:e.cx,y:e.cy},a=t?Sy(t,{x:e.rx*r,y:e.rx*n}):{x:e.rx*r,y:e.rx*n},o=t?Sy(t,{x:-e.ry*n,y:e.ry*r}):{x:-e.ry*n,y:e.ry*r};return{cx:i.x,cy:i.y,ux:a.x,uy:a.y,vx:o.x,vy:o.y}}function lO(e,t){let r=Math.cos(t),n=Math.sin(t);return{x:e.cx+e.ux*r+e.vx*n,y:e.cy+e.uy*r+e.vy*n}}function uO(e,t,r){if(r>=0){let i=(e-t)%uo;return i<0&&(i+=uo),i<=r}let n=(t-e)%uo;return n<0&&(n+=uo),n<=-r}function dO(e,t,r,n,i,a,o,s,l,u){let d=u?zt(u,{x:e,y:t}):{x:e,y:t},c=u?zt(u,{x:s,y:l}):{x:s,y:l},f={minX:Math.min(d.x,c.x),minY:Math.min(d.y,c.y),maxX:Math.max(d.x,c.x),maxY:Math.max(d.y,c.y)},p=Wb(e,t,r,n,i,a,o,s,l);if(!p)return f;let h=sO(p,u),m=Math.atan2(h.vx,h.ux),g=Math.atan2(h.vy,h.uy),v=[m,m+Math.PI,g,g+Math.PI];for(let y of v){if(!uO(y,p.theta1,p.deltaTheta))continue;let b=lO(h,y);b.x<f.minX&&(f.minX=b.x),b.x>f.maxX&&(f.maxX=b.x),b.y<f.minY&&(f.minY=b.y),b.y>f.maxY&&(f.maxY=b.y)}return f}var cO=class{constructor(e){this.params=e}params;index=0;readNumber(){return this.params[this.index++]??null}readFlag(){let e=this.readNumber();return e===null?null:e===1}};function lu(e,t,r,n){let i=n?zt(n,{x:t,y:r}):{x:t,y:r};i.x<e.minX&&(e.minX=i.x),i.x>e.maxX&&(e.maxX=i.x),i.y<e.minY&&(e.minY=i.y),i.y>e.maxY&&(e.maxY=i.y),e.any=!0}function eh(e,t){t.minX<e.minX&&(e.minX=t.minX),t.maxX>e.maxX&&(e.maxX=t.maxX),t.minY<e.minY&&(e.minY=t.minY),t.maxY>e.maxY&&(e.maxY=t.maxY),e.any=!0}function Uy(e,t,r,n,i,a,o,s,l,u){let d=u?zt(u,{x:t,y:r}):{x:t,y:r},c=u?zt(u,{x:n,y:i}):{x:n,y:i},f=u?zt(u,{x:a,y:o}):{x:a,y:o},p=u?zt(u,{x:s,y:l}):{x:s,y:l},h=Ly(d.x,c.x,f.x,p.x),m=Ly(d.y,c.y,f.y,p.y);eh(e,{minX:h.min,maxX:h.max,minY:m.min,maxY:m.max})}function Gy(e,t,r,n,i,a,o,s){let l=s?zt(s,{x:t,y:r}):{x:t,y:r},u=s?zt(s,{x:n,y:i}):{x:n,y:i},d=s?zt(s,{x:a,y:o}):{x:a,y:o},c=By(l.x,u.x,d.x),f=By(l.y,u.y,d.y);eh(e,{minX:c.min,maxX:c.max,minY:f.min,maxY:f.max})}function vo(e,t){if(!e)return null;let r=Od(e),n={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,any:!1},i=0,a=0,o=0,s=0,l=0,u=0,d=null,c="",f=()=>n.any?{minX:n.minX,minY:n.minY,maxX:n.maxX,maxY:n.maxY}:null;for(let p of r.commands){c=p.type;let h=new cO(p.params),m=c>="a"&&c<="z";switch(c){case"M":case"m":{let g=h.readNumber(),v=h.readNumber();if(g===null||v===null)return f();i=m?i+g:g,a=m?a+v:v,o=i,s=a,lu(n,i,a,t),d=null,c=m?"l":"L";break}case"L":case"l":{let g=h.readNumber(),v=h.readNumber();if(g===null||v===null)return f();i=m?i+g:g,a=m?a+v:v,lu(n,i,a,t),d=null;break}case"H":case"h":{let g=h.readNumber();if(g===null)return f();i=m?i+g:g,lu(n,i,a,t),d=null;break}case"V":case"v":{let g=h.readNumber();if(g===null)return f();a=m?a+g:g,lu(n,i,a,t),d=null;break}case"C":case"c":{let g=h.readNumber(),v=h.readNumber(),y=h.readNumber(),b=h.readNumber(),I=h.readNumber(),x=h.readNumber();if(g===null||v===null||y===null||b===null||I===null||x===null)return f();let k=m?i+g:g,$=m?a+v:v,A=m?i+y:y,S=m?a+b:b,N=m?i+I:I,T=m?a+x:x;Uy(n,i,a,k,$,A,S,N,T,t),l=A,u=S,d="cubic",i=N,a=T;break}case"S":case"s":{let g=h.readNumber(),v=h.readNumber(),y=h.readNumber(),b=h.readNumber();if(g===null||v===null||y===null||b===null)return f();let I=d==="cubic"?2*i-l:i,x=d==="cubic"?2*a-u:a,k=m?i+g:g,$=m?a+v:v,A=m?i+y:y,S=m?a+b:b;Uy(n,i,a,I,x,k,$,A,S,t),l=k,u=$,d="cubic",i=A,a=S;break}case"Q":case"q":{let g=h.readNumber(),v=h.readNumber(),y=h.readNumber(),b=h.readNumber();if(g===null||v===null||y===null||b===null)return f();let I=m?i+g:g,x=m?a+v:v,k=m?i+y:y,$=m?a+b:b;Gy(n,i,a,I,x,k,$,t),l=I,u=x,d="quad",i=k,a=$;break}case"T":case"t":{let g=h.readNumber(),v=h.readNumber();if(g===null||v===null)return f();let y=d==="quad"?2*i-l:i,b=d==="quad"?2*a-u:a,I=m?i+g:g,x=m?a+v:v;Gy(n,i,a,y,b,I,x,t),l=y,u=b,d="quad",i=I,a=x;break}case"A":case"a":{let g=h.readNumber(),v=h.readNumber(),y=h.readNumber(),b=h.readFlag(),I=h.readFlag(),x=h.readNumber(),k=h.readNumber();if(g===null||v===null||y===null||b===null||I===null||x===null||k===null)return f();let $=m?i+x:x,A=m?a+k:k;eh(n,dO(i,a,g,v,y,b,I,$,A,t)),i=$,a=A,d=null;break}case"Z":case"z":{i=o,a=s,d=null;break}default:return f()}}return f()}function Hb(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")}function fO(e){let t=e.state.symbolOverrides;return!!t&&Object.keys(t).length>0}function up(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(up).join(",")}]`:`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${up(r)}`).join(",")}}`}function pO(e){let t=new Map,r=n=>{for(let i of n)t.set(i.id,(t.get(i.id)??0)+1),Array.isArray(i.state.children)&&r(i.state.children)};return r(e),t}function qb(e,t,r){return e.map(n=>{let i=r.has(n.id)?t[n.id]:void 0,a=i?{...n.state,...i}:{...n.state},o=a.children;return Array.isArray(o)&&(a.children=qb(o,t,r)),i!==void 0||a.children!==n.state.children?{...n,state:a}:n})}function Yb(e,t){let r=String(t.state.variantKey??""),n=r?e.variants?.[r]:void 0,i=n?r:"",a=n??e.shapes,o=[];r&&!n&&o.push({code:"unknown-symbol-variant",shapeId:t.id,message:`Symbol instance ${t.id} requests unknown variant ${r} from ${e.id}; the base definition is used.`});let s=t.state.symbolOverrides??{},l=Object.entries(s),u=a;if(l.length>0){let p=pO(a),h=new Set;for(let[m]of l){let g=p.get(m)??0;g===1?h.add(m):o.push({code:g>1?"ambiguous-symbol-override-target":"unresolved-symbol-override-target",shapeId:t.id,message:g>1?`Symbol instance ${t.id} override target ${m} is ambiguous in ${e.id}.`:`Symbol instance ${t.id} override target ${m} is absent from ${e.id}.`})}u=qb(a,s,h)}let d=i!==""||l.length>0,c=l.length>0?`${e.id}--ovr-${t.id}`:i?`${e.id}--${Hb(i)}`:e.id,f=`${e.id}\0${i}\0${up(s)}`;return{shapes:u,requestedVariantKey:r,effectiveVariantKey:i,candidateTargetId:c,materializationKey:f,materialized:d,diagnostics:o}}function Kb(e,t=!1){let r=e.state.symbolId??"",n=e.state.variantKey??"";return t||fO(e)?`${r}--ovr-${e.id}`:n?`${r}--${Hb(n)}`:r}function hO(e,t,r,n,i=0){let a=r!==void 0&&r>=0?r:void 0,o=n!==void 0&&n>=0?n:void 0,s=Math.max(0,i),l=a??o??s,u=a??l,d=o??l,c=a===0&&o===void 0?void 0:a,f=o===0&&a===void 0?void 0:o;return{rx:Math.min(Math.max(0,u),Math.max(0,e)/2),ry:Math.min(Math.max(0,d),Math.max(0,t)/2),authoredRx:c??(a===void 0&&o===void 0&&s>0?s:void 0),authoredRy:f??(a===void 0&&o===void 0&&s>0?s:void 0)}}function Ve(e,t,r){return Object.freeze({type:e,renderer:t,resolve:r})}function mO(e){let t=e.state,r=t.x??0,n=t.y??0;return{kind:"circle",shapeType:"circle",cx:r,cy:n,r:t.radius??50,defaultPivot:{x:r,y:n}}}function gO(e){let t=e.state,r=t.x??t.cx??0,n=t.y??t.cy??0;return{kind:"ellipse",shapeType:"ellipse",cx:r,cy:n,rx:t.rx??50,ry:t.ry??30,pathLength:t.pathLength,defaultPivot:{x:r,y:n}}}function Xy(e){let t=e.state,r=t,n=t.x??0,i=t.y??0,a=e.type==="square"?t.size:void 0,o=a??t.width??100,s=a??t.height??100,l=t.cornerRadius??0,u=hO(o,s,t.rx,t.ry,l),d=r.cornerShape??"round",c=r.cornerMode??"uniform",f=null;return(d!=="round"||c==="non-uniform")&&(f=XC(n,i,o,s,l,d,c,c==="non-uniform"?{radiusTL:r.cornerRadiusTL,radiusTR:r.cornerRadiusTR,radiusBR:r.cornerRadiusBR,radiusBL:r.cornerRadiusBL,shapeTL:r.cornerShapeTL,shapeTR:r.cornerShapeTR,shapeBR:r.cornerShapeBR,shapeBL:r.cornerShapeBL}:void 0)||null),{kind:"rectangle",shapeType:e.type,x:n,y:i,width:o,height:s,rx:u.rx,ry:u.ry,authoredRx:u.authoredRx,authoredRy:u.authoredRy,pathData:f,defaultPivot:{x:n+o/2,y:i+s/2}}}function yO(e){let t=e.state,r=t.x1??0,n=t.y1??0,i=t.x2??0,a=t.y2??0;return{kind:"line",shapeType:"line",x1:r,y1:n,x2:i,y2:a,boundsPolicy:t.sourceRef||t.targetRef||t.routingMode?"linked-line":"analytic",defaultPivot:{x:(r+i)/2,y:(n+a)/2}}}function vO(e){let t=e.state.textX??e.state.x??0,r=e.state.textY??e.state.y??0;return{kind:"text",shapeType:"text",x:t,y:r,boundsPolicy:"measure-text",defaultPivot:{x:t,y:r}}}function bO(e){let t=e.state,r=t.pathPoints??[],n=Bb(r,t.pathCurveType??"CUBIC",t.pathClosed??!1,t.pathTension??.5,t.pathArcParams),i=r.length>0?t.customPivot??{x:r[0].x,y:r[0].y}:null;return{kind:"path",shapeType:"path",role:"spline",boundsPolicy:r.length<2?"empty":"analytic",d:n,placement:null,fillRule:null,defaultPivot:i}}function xO(e){let t=e.state,r=t.polylinePoints??[];return{kind:"polyline",shapeType:"polyline",points:r,closed:t.polylineClosed??!1,defaultPivot:r.length>0?t.customPivot??{x:r[0].x,y:r[0].y}:null}}function uu(e,t,r,n){let i=e.state,a=i.x??0,o=i.y??0,s=i.width??r,l=i.height??n;return{kind:"positioning-rect",shapeType:e.type,role:t,x:a,y:o,width:s,height:l,defaultPivot:{x:a+s/2,y:o+l/2}}}function an(e,t,r=!1){let n=e.state,i=n.cx??mr.cx,a=n.cy??mr.cy,o={radius:n.radius??mr.radius,cornerRadius:n.cornerRadius??mr.cornerRadius,shiftAngle:n.shiftAngle??mr.shiftAngle,fillRule:n.fillRule??"nonzero"};return{kind:"path",shapeType:e.type,role:"polygon",boundsPolicy:"analytic",d:t(n,o),placement:{x:i,y:a},fillRule:r?o.fillRule:null,defaultPivot:{x:i,y:a}}}function Ka(e,t){let r=e.state,n=r.x??Rn.x,i=r.y??Rn.y,a=r.width??Rn.width,o=r.height??Rn.height;return{kind:"path",shapeType:t,role:"flowchart",boundsPolicy:"analytic",d:WC(t,n,i,a,o,{slantPercent:r.slantPercent,topWidthPercent:r.topWidthPercent,capHeightPercent:r.capHeightPercent,waveAmplitudePercent:r.waveAmplitudePercent}),placement:null,fillRule:null,defaultPivot:{x:n+a/2,y:i+o/2}}}function du(e,t){return{kind:"container",shapeType:e.type,role:t,boundsPolicy:"children",defaultPivot:null}}function wO(e){let t=e.state;return{kind:"embedded-svg",shapeType:"svg",x:t.svgX,y:t.svgY,width:t.svgWidth,height:t.svgHeight,viewBoxX:t.svgViewBoxX,viewBoxY:t.svgViewBoxY,viewBoxWidth:t.svgViewBoxWidth,viewBoxHeight:t.svgViewBoxHeight,preserveAspectRatio:t.svgPreserveAspectRatio,boundsPolicy:"children",defaultPivot:null}}function IO(e){let t=e.state;return{kind:"view",shapeType:"view",viewBoxX:t.viewBoxX,viewBoxY:t.viewBoxY,viewBoxWidth:t.viewBoxWidth,viewBoxHeight:t.viewBoxHeight,preserveAspectRatio:t.viewPreserveAspectRatio,boundsPolicy:"none",defaultPivot:null}}function kO(e){let t=e.state;return{kind:"shape-reference",shapeType:"shape-reference",targetShapeId:t.targetShapeId,offsetX:t.offsetX??0,offsetY:t.offsetY??0,width:t.width,height:t.height,boundsPolicy:"reference",defaultPivot:null}}function SO(e){let t=e.state;return{kind:"symbol-instance",shapeType:"symbol-instance",symbolId:t.symbolId??"",targetId:Kb(e),x:t.x??0,y:t.y??0,width:t.width??100,height:t.height??100,boundsPolicy:"symbol",defaultPivot:null}}var Zb=Object.freeze({rectangle:Ve("rectangle","rectangle",Xy),square:Ve("square","rectangle",Xy),circle:Ve("circle","circle",mO),ellipse:Ve("ellipse","ellipse",gO),line:Ve("line","line",yO),text:Ve("text","text",vO),image:Ve("image","image",e=>uu(e,"image",100,100)),path:Ve("path","path",bO),polyline:Ve("polyline","polyline",xO),triangle:Ve("triangle","polygon",e=>an(e,(t,r)=>$i(_y(3,r.radius,r.shiftAngle),r.cornerRadius,r.radius))),ngon:Ve("ngon","polygon",e=>an(e,(t,r)=>$i(_y(t.sides??ht.ngon.sides,r.radius,r.shiftAngle),r.cornerRadius,r.radius))),star:Ve("star","polygon",e=>an(e,(t,r)=>$i(DC(t.arms??ht.star.arms,r.radius,t.innerRadiusPercent??ht.star.innerRadiusPercent,r.shiftAngle),r.cornerRadius,r.radius))),cross:Ve("cross","polygon",e=>an(e,(t,r)=>$i(jC(r.radius,t.armWidthPercent??ht.cross.armWidthPercent,r.shiftAngle),r.cornerRadius,r.radius))),ring:Ve("ring","polygon",e=>an(e,(t,r)=>LC(r.radius,t.innerRadiusPercent??ht.ring.innerRadiusPercent,r.fillRule),!0)),spiral:Ve("spiral","polygon",e=>an(e,(t,r)=>BC(r.radius,t.turns??ht.spiral.turns,t.thicknessPercent??ht.spiral.thicknessPercent,t.spiralDirection??ht.spiral.spiralDirection,r.shiftAngle))),gear:Ve("gear","polygon",e=>an(e,(t,r)=>GC(t.teeth??ht.gear.teeth,r.radius,t.toothDepthPercent??ht.gear.toothDepthPercent,r.cornerRadius,t.holeRadiusPercent??ht.gear.holeRadiusPercent,r.fillRule,r.shiftAngle),!0)),arrow:Ve("arrow","polygon",e=>an(e,(t,r)=>$i(EC(r.radius,t.headWidthPercent??ht.arrow.headWidthPercent,t.headLengthPercent??ht.arrow.headLengthPercent,t.shaftWidthPercent??ht.arrow.shaftWidthPercent,r.shiftAngle),r.cornerRadius,r.radius))),"symbol-instance":Ve("symbol-instance","symbol-instance",SO),group:Ve("group","container",e=>du(e,"group")),container:Ve("container","container",e=>du(e,"group")),cloud:Ve("cloud","polygon",e=>an(e,(t,r)=>FC(r.radius,t.cloudBumps??ht.cloud.cloudBumps,t.cloudPuffinessPercent??ht.cloud.cloudPuffinessPercent,r.shiftAngle))),heart:Ve("heart","polygon",e=>an(e,(t,r)=>RC(r.radius,t.lobeRadiusPercent??ht.heart.lobeRadiusPercent,t.cleftDepthPercent??ht.heart.cleftDepthPercent,r.shiftAngle))),lightning:Ve("lightning","polygon",e=>an(e,(t,r)=>$i(_C(r.radius,t.boltSegments??ht.lightning.boltSegments,t.boltJaggednessPercent??ht.lightning.boltJaggednessPercent,t.boltWidthPercent??ht.lightning.boltWidthPercent,r.shiftAngle),r.cornerRadius,r.radius))),speechBubble:Ve("speechBubble","polygon",e=>an(e,(t,r)=>$i(zC(r.radius,t.tailAngleDeg??ht.speechBubble.tailAngleDeg,t.tailLengthPercent??ht.speechBubble.tailLengthPercent,t.tailWidthPercent??ht.speechBubble.tailWidthPercent,r.shiftAngle),r.cornerRadius,r.radius))),diamond:Ve("diamond","flowchart",e=>Ka(e,"diamond")),parallelogram:Ve("parallelogram","flowchart",e=>Ka(e,"parallelogram")),trapezoid:Ve("trapezoid","flowchart",e=>Ka(e,"trapezoid")),terminator:Ve("terminator","flowchart",e=>Ka(e,"terminator")),cylinder:Ve("cylinder","flowchart",e=>Ka(e,"cylinder")),"document-shape":Ve("document-shape","flowchart",e=>Ka(e,"document-shape")),hyperlink:Ve("hyperlink","hyperlink",e=>du(e,"hyperlink")),switch:Ve("switch","switch",e=>du(e,"switch")),svg:Ve("svg","svg",wO),view:Ve("view","view",IO),"shape-reference":Ve("shape-reference","shape-reference",kO),video:Ve("video","media",e=>uu(e,"video",320,180)),audio:Ve("audio","media",e=>uu(e,"audio",320,180)),"foreign-object":Ve("foreign-object","foreign-object",e=>uu(e,"foreign-object",100,100))}),o7=Object.freeze(Object.keys(Zb));function th(e){return Zb[e]}function Ia(e){return th(e.type)?.resolve(e)??null}function Wy(e,t,r,n){return r<0||n<0?null:{minX:e,minY:t,maxX:e+r,maxY:t+n}}function $O(e){if(e.length===0)return{minX:0,minY:0,maxX:0,maxY:0};let t=e[0].x,r=e[0].y,n=e[0].x,i=e[0].y;for(let a=1;a<e.length;a++){let o=e[a];o.x<t&&(t=o.x),o.x>n&&(n=o.x),o.y<r&&(r=o.y),o.y>i&&(i=o.y)}return{minX:t,minY:r,maxX:n,maxY:i}}function NO(e,t){let r=Ia(e);if(!r)return null;switch(r.kind){case"circle":return r.r<0?null:{minX:r.cx-r.r,minY:r.cy-r.r,maxX:r.cx+r.r,maxY:r.cy+r.r};case"ellipse":return r.rx<0||r.ry<0?null:{minX:r.cx-r.rx,minY:r.cy-r.ry,maxX:r.cx+r.rx,maxY:r.cy+r.ry};case"rectangle":return r.pathData?vo(r.pathData):Wy(r.x,r.y,r.width,r.height);case"line":return r.boundsPolicy==="linked-line"?null:{minX:Math.min(r.x1,r.x2),minY:Math.min(r.y1,r.y2),maxX:Math.max(r.x1,r.x2),maxY:Math.max(r.y1,r.y2)};case"text":return t?.measureText?.(e,r)??null;case"path":return r.boundsPolicy==="empty"?null:vo(r.d,r.placement?Wt(r.placement.x,r.placement.y):void 0);case"polyline":return $O(r.points);case"positioning-rect":return Wy(r.x,r.y,r.width,r.height);case"container":case"embedded-svg":case"view":case"shape-reference":case"symbol-instance":return null}}var Jb=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/u,MO=/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/gu;function Zu(e){return(e.match(MO)??[]).map(Number).filter(Number.isFinite)}function AO(e){let t=Zu(e),r=t.length-t.length%2,n=[];for(let i=0;i<r;i+=2)n.push(`${t[i]},${t[i+1]}`);return n.join(" ")}function cu(e,t){let r=Zu(e),n=Zu(t),i=r.length-r.length%2,a=n.length-n.length%2;if(i!==a)return null;if(i===0)return"";let o=[];for(let s=0;s<i;s+=2)o.push(`${r[s]+n[s]},${r[s+1]+n[s+1]}`);return o.join(" ")}function Qb(e){return e.additive==="sum"||e.values==null&&e.from==null&&e.to==null&&e.by!=null?"sum":"replace"}function tl(e,t,r="number"){if(r==="points"){let n=s=>AO(s.trim()),i=Qb(e)==="sum",a=t===void 0?void 0:n(t),o=s=>{if(!i||a===void 0)return[...s];let l=s.map(u=>cu(a,u));return l.every(u=>u!==null)?l:null};if(e.values){let s=e.values.split(";").map(l=>l.trim()).filter(Boolean).map(n);return s.length===0?null:o(s)}if(e.from!=null&&e.to!=null)return o([n(e.from),n(e.to)]);if(e.from!=null&&e.by!=null){let s=n(e.from),l=cu(s,n(e.by));return l===null?null:o([s,l])}if(e.to!=null&&a!==void 0){let s=n(e.to);if(!i)return[a,s];let l=cu(a,s);return l===null?null:[a,l]}if(e.by!=null&&a!==void 0){let s=cu(a,n(e.by));return s===null?null:[a,s]}return null}if(e.values){let n=e.values.split(";").map(i=>i.trim()).filter(Boolean);return n.length===0?null:n}if(e.from!=null&&e.to!=null)return[e.from.trim(),e.to.trim()];if(e.from!=null&&e.by!=null){let n=Number(e.from),i=Number(e.by);return Number.isFinite(n)&&Number.isFinite(i)?[String(n),String(n+i)]:null}if(e.to!=null&&t!==void 0)return[t.trim(),e.to.trim()];if(e.by!=null){let n=Number(e.by);return Number.isFinite(n)?["0",String(n)]:null}return null}function ex(e){let t=e.dur?.trim();return!t||t==="indefinite"||t==="media"?0:ti(t)}function Do(e,t,r=e.calcMode??"linear"){if(e.keyTimes){let n=e.keyTimes.split(";").map(i=>i.trim());if(n.length===t&&n.every(i=>Jb.test(i)))return n.map(Number)}return t<=1?t===1?[0]:[]:r==="discrete"?Array.from({length:t},(n,i)=>i/t):Array.from({length:t},(n,i)=>i/(t-1))}function jo(e){return e.keySplines?e.keySplines.split(";").map(t=>t.trim()).filter(Boolean).map(t=>{let r=Zu(t);return[r[0]??0,r[1]??0,r[2]??0,r[3]??0]}):[]}function CO(e){if(e.repeatCount==="indefinite")return{cycleInfinite:!0};if(e.repeatCount&&Jb.test(e.repeatCount.trim())){let t=Number(e.repeatCount);if(t>1)return{cycleRepeats:Math.round(t)}}if(e.repeatDur==="indefinite")return{cycleInfinite:!0};if(e.repeatDur){let t=ti(e.repeatDur),r=ex(e);if(t>0&&r>0){let n=Math.max(1,Math.ceil(t/r));if(n>1)return{cycleRepeats:n}}}return{}}function OO(e){return e.fill==="freeze"?{}:{fill:"remove"}}function Fn(e,t,r,n,i,a){let o=[];for(let s=0;s<e.length&&s<t.length;s++){let l=e[s].trim(),u=a==="color"||a==="path"||a==="points"||a==="numberList"||a==="discrete",d=Number(l),c={time:t[s]*n,value:u||!Number.isFinite(d)?l:d,easing:"linear"};if(s>0&&i==="spline"&&r[s-1]){let f=Sb(...r[s-1]);c.easing=f.easing,f.customBezier&&(c.customBezier=f.customBezier)}else s>0&&i==="discrete"&&(c.easing="steps",c.stepsParams={count:1,position:"jump-end"});o.push(c)}return o}var fe="all-svg-elements",tx=[["alignment-baseline",!1,"auto",fe],["baseline-shift",!1,"0",fe],["clip",!1,"auto",fe],["clip-path",!1,"none",fe],["clip-rule",!0,"nonzero",fe],["color",!0,"black",fe],["color-interpolation",!0,"sRGB",fe],["color-interpolation-filters",!0,"linearRGB",fe],["color-rendering",!0,"auto",fe],["cursor",!0,"auto",fe],["direction",!0,"ltr",fe],["display",!1,"inline",fe],["dominant-baseline",!0,"auto",fe],["fill",!0,"black",fe],["fill-opacity",!0,"1",fe],["fill-rule",!0,"nonzero",fe],["filter",!1,"none",fe],["flood-color",!1,"black",fe],["flood-opacity",!1,"1",fe],["font-family",!0,"serif",fe],["font-feature-settings",!0,"normal",fe],["font-kerning",!0,"auto",fe],["font-size",!0,"medium",fe],["font-size-adjust",!0,"none",fe],["font-stretch",!0,"normal",fe],["font-style",!0,"normal",fe],["font-variant",!0,"normal",fe],["font-variant-caps",!0,"normal",fe],["font-variant-east-asian",!0,"normal",fe],["font-variant-ligatures",!0,"normal",fe],["font-variant-numeric",!0,"normal",fe],["font-variant-position",!0,"normal",fe],["font-weight",!0,"normal",fe],["image-rendering",!0,"auto",fe],["letter-spacing",!0,"normal",fe],["lighting-color",!1,"white",fe],["line-height",!0,"normal",fe],["marker-end",!0,"none",fe],["marker-mid",!0,"none",fe],["marker-start",!0,"none",fe],["mask",!1,"none",fe],["mask-image",!1,"none",fe],["opacity",!1,"1",fe],["overflow",!1,"visible",fe],["paint-order",!0,"normal",fe],["pointer-events",!0,"auto",fe],["shape-rendering",!0,"auto",fe],["stop-color",!1,"black",fe],["stop-opacity",!1,"1",fe],["stroke",!0,"none",fe],["stroke-dasharray",!0,"none",fe],["stroke-dashoffset",!0,"0",fe],["stroke-linecap",!0,"butt",fe],["stroke-linejoin",!0,"miter",fe],["stroke-miterlimit",!0,"4",fe],["stroke-opacity",!0,"1",fe],["stroke-width",!0,"1px",fe],["text-anchor",!0,"start",fe],["text-decoration",!1,"none",fe],["text-rendering",!0,"auto",fe],["text-transform",!0,"none","none"],["transform",!1,"none",fe],["transform-box",!1,"view-box","none"],["transform-origin",!1,"50% 50%",fe],["unicode-bidi",!1,"normal",fe],["vector-effect",!1,"none",fe],["visibility",!0,"visible",fe],["word-spacing",!0,"normal",fe],["writing-mode",!0,"horizontal-tb",fe]],TO=new Map(tx.map(([e,t,r,n="none"])=>[e,Object.freeze({name:e,inherited:t,initialValue:r,presentationAttribute:n})])),rx=Object.freeze(tx.filter(e=>(e[3]??"none")!=="none").map(e=>e[0]));function Ws(e){return TO.get(e.toLowerCase())??null}function rl(e){return(Ws(e)?.presentationAttribute??"none")!=="none"}var nx=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:h|min|s|ms)?$/iu,ix=/^([A-Za-z_][\w.-]*)\.repeat\((\d+)\)\s*([+-]\s*\S+)?$/u,ax=/^([A-Za-z_][\w.-]*)\.(begin|end)\s*([+-]\s*\S+)?$/u,PO=class{bySourceId=new Map;beginCache=new Map;resolving=new Set;constructor(e){for(let t of e)t.sourceAnimationId&&!this.bySourceId.has(t.sourceAnimationId)&&this.bySourceId.set(t.sourceAnimationId,t)}activations(e){let t=(e.attributes.begin??"0s").split(";").map(a=>a.trim()).filter(Boolean),r=t.flatMap(a=>{let o=this.resolveEntry(a);return o!==null&&Number.isFinite(o)?[{entry:a,time:o}]:[]}),n=new Map;for(let a of r){let o=n.get(a.time)??[];o.push(a.entry),n.set(a.time,o)}let i=t.length>1&&e.kind!=="discard"&&e.additive!=="sum"&&n.size>1?[...n.entries()].map(([a,o])=>({entries:o,time:a})).sort((a,o)=>a.time-o.time):r.length>0?[{entries:n.get(r[0].time)??[r[0].entry],time:r[0].time}]:[null];return Object.freeze(i.map(a=>{let o=Object.freeze({...e.attributes,...a!==null?{begin:a.entries.join(";")}:{}}),s=a?.time??null,l=e.attributes.end?.split(";")[0]?.trim(),u=l?this.resolveEntry(l):null,d=e.duration;if(e.attributes.values?.split(";").map(c=>c.trim()).filter(Boolean)?.length===1&&s!==null&&e.attributes.end){let c=this.resolveEntry(e.attributes.end.split(";")[0].trim());c!==null&&Number.isFinite(c)&&c>=s&&(d=c-s)}return Object.freeze({...e,attributes:o,duration:d,...s!==null?{resolvedBeginOffset:s}:{},...u!==null&&Number.isFinite(u)?{resolvedEndOffset:u}:{}})}))}resolveCandidateBegin(e){let t=this.beginCache.get(e.animationId);if(t!==void 0)return t;if(this.resolving.has(e.animationId))return null;this.resolving.add(e.animationId);let r=e.attributes.begin?.split(";")[0]?.trim()||"0s",n=this.resolveEntry(r);return this.resolving.delete(e.animationId),n!==null&&this.beginCache.set(e.animationId,n),n}resolveEntry(e){if(!e||e==="0")return 0;if(e==="indefinite")return Number.POSITIVE_INFINITY;if(nx.test(e))return ti(e);let t=e.match(ix);if(t){let n=this.bySourceId.get(t[1]);if(!n)return null;let i=this.resolveCandidateBegin(n);if(i===null||!Number.isFinite(i))return i;let a=Number(t[2]),o=this.repeatEventTime(n,i,a);return o===null||!Number.isFinite(o)?o:o+this.offset(t[3])}let r=e.match(ax);if(r){let n=this.bySourceId.get(r[1]);if(!n)return null;let i=this.resolveCandidateBegin(n);if(i===null||!Number.isFinite(i))return i;let a=this.activeDuration(n),o=r[2]==="end"?a!==null?i+a:null:i;return o===null?null:o+this.offset(r[3])}return null}offset(e){return e?ti(e.replace(/\s+/gu,"")):0}repeatEventTime(e,t,r){if(r<1||e.duration<=0)return Number.POSITIVE_INFINITY;let n=this.activeDuration(e);return n===null||r*e.duration>=n?Number.POSITIVE_INFINITY:t+r*e.duration}activeDuration(e){if(e.duration<=0)return null;let t=e.attributes.repeatCount,r=e.attributes.repeatDur,n=e.duration,i=!1;if(t==="indefinite"&&(n=Number.POSITIVE_INFINITY,i=!0),t&&t!=="indefinite"){let a=Number(t);Number.isFinite(a)&&a>0&&(n=a*e.duration,i=!0)}if(r==="indefinite")i||(n=Number.POSITIVE_INFINITY);else if(r){let a=ti(r);Number.isFinite(a)&&a>=0&&(n=i?Math.min(n,a):a)}return n}},DO=Object.freeze({property:"referenceTargetShapeId",valueType:"discrete",stateKey:"targetShapeId"}),Ju=Object.freeze({cx:{property:"x",valueType:"number",stateKey:"x",cssLengthAxis:"x"},cy:{property:"y",valueType:"number",stateKey:"y",cssLengthAxis:"y"},d:{property:"pathMorph",valueType:"path",stateKey:"d"},display:{property:"display",valueType:"discrete",stateKey:"display"},fill:{property:"fillColor",valueType:"color",stateKey:"fillColor"},"fill-opacity":{property:"fillOpacity",valueType:"number",stateKey:"fillOpacity"},height:{property:"height",valueType:"number",stateKey:"height",cssLengthAxis:"y"},opacity:{property:"opacity",valueType:"number",stateKey:"opacity"},points:{property:"polylinePoints",valueType:"points",stateKey:"points"},r:{property:"radius",valueType:"number",stateKey:"radius",cssLengthAxis:"radius"},rx:{property:"rx",valueType:"number",stateKey:"rx",cssLengthAxis:"x"},ry:{property:"ry",valueType:"number",stateKey:"ry",cssLengthAxis:"y"},stroke:{property:"strokeColor",valueType:"color",stateKey:"borderColor"},target:{property:"linkTarget",valueType:"discrete",stateKey:"linkTarget"},href:{property:"href",valueType:"discrete",stateKey:"href"},"xlink:href":{property:"hrefXlink",valueType:"discrete",stateKey:"hrefXlink"},preserveaspectratio:{property:"svgPreserveAspectRatio",valueType:"discrete",stateKey:"svgPreserveAspectRatio"},clippathunits:{property:"clipPathUnits",valueType:"discrete",stateKey:"clipPathUnits"},spreadmethod:{property:"spreadMethod",valueType:"discrete",stateKey:"spreadMethod"},"stroke-dasharray":{property:"strokeDasharray",valueType:"numberList",stateKey:"strokeDasharray"},"stroke-dashoffset":{property:"strokeDashoffset",valueType:"number",stateKey:"strokeDashoffset"},"stroke-linecap":{property:"strokeLinecap",valueType:"discrete",stateKey:"strokeLinecap"},"stroke-linejoin":{property:"strokeLinejoin",valueType:"discrete",stateKey:"strokeLinejoin"},"stroke-miterlimit":{property:"strokeMiterlimit",valueType:"number",stateKey:"strokeMiterlimit"},"stroke-opacity":{property:"strokeOpacity",valueType:"number",stateKey:"strokeOpacity"},"stroke-width":{property:"strokeWidth",valueType:"number",stateKey:"borderWidth"},startoffset:{property:"textPathStartOffset",valueType:"number",stateKey:"textPathStartOffset"},visibility:{property:"visibility",valueType:"discrete",stateKey:"visibility"},width:{property:"width",valueType:"number",stateKey:"width",cssLengthAxis:"x"},x:{property:"x",valueType:"number",stateKey:"x",cssLengthAxis:"x"},x1:{property:"x1",valueType:"number",stateKey:"x1"},x2:{property:"x2",valueType:"number",stateKey:"x2"},y:{property:"y",valueType:"number",stateKey:"y",cssLengthAxis:"y"},y1:{property:"y1",valueType:"number",stateKey:"y1"},y2:{property:"y2",valueType:"number",stateKey:"y2"}}),jO=Object.freeze({...Ju,"font-size":{property:"fontSize",valueType:"number",stateKey:"fontSize"}}),EO=/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/gu;function ox(e){return(e.match(EO)??[]).map(Number).filter(Number.isFinite)}function sx(e,t){let r=e?.[t];if(r!=null)return Array.isArray(r)?r.join(" "):String(r)}function zO(e){switch(e.property){case"visibility":return"visible";case"display":return"inline";case"opacity":case"fillOpacity":case"strokeOpacity":return"1";default:return}}function lx(e){let t=e.match(ix);if(t)return{kind:"repeat",sourceAnimationId:t[1],iteration:Number(t[2]),offset:t[3]?ti(t[3].replace(/\s+/gu,"")):0};let r=e.match(ax);return r?{kind:"syncbase",sourceAnimationId:r[1],event:r[2],offset:r[3]?ti(r[3].replace(/\s+/gu,"")):0}:null}function Nn(e){let t=e.attributes.begin?.split(";").map(i=>i.trim()).filter(Boolean),r=t?.[0];if(!r||r==="0"||r==="0s")return{offset:0};if(/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:h|min|s|ms)?$/iu.test(r))return{offset:ti(r)};let n=t?.map(lx)??[];return n.length>0&&n.every(i=>i!==null)&&Number.isFinite(e.resolvedBeginOffset)?{offset:0,beginTrigger:{type:"time",value:String(e.resolvedBeginOffset),smilRelations:Object.freeze(n)}}:/^[A-Za-z_][\w.-]*(?:\.[A-Za-z_][\w.-]*)?(?:[+-].+)?$/u.test(r)?{offset:0,beginTrigger:{type:"event",value:r}}:{offset:0,beginTrigger:{type:"expression",value:r}}}function rh(e){let t=e.attributes.end?.split(";").map(i=>i.trim()).filter(Boolean),r=t?.[0];if(!r)return;if(nx.test(r))return{type:"time",value:String(ti(r))};let n=t?.map(lx)??[];return n.length>0&&n.every(i=>i!==null)&&Number.isFinite(e.resolvedEndOffset)?{type:"time",value:String(e.resolvedEndOffset),smilRelations:Object.freeze(n)}:/^[A-Za-z_][\w.-]*(?:\.[A-Za-z_][\w.-]*)?(?:[+-].+)?$/u.test(r)?{type:"event",value:r}:{type:"expression",value:r}}function Eo(e){let t=CO(e.attributes),r=Nn(e),n=rh(e);return{enabled:!0,cycleBehavior:"restart",...e.duration>0?{cycleDuration:e.duration}:{},...nl(e)?{simpleDuration:"indefinite"}:{},...e.additive==="sum"?{additive:"sum"}:{},...e.attributes.accumulate?.trim().toLowerCase()==="sum"?{accumulate:"sum"}:{},...t,...OO(e.attributes),...r.beginTrigger?{beginTrigger:r.beginTrigger}:{},...n?{endTrigger:n}:{}}}function nl(e){if(e.kind==="set"||e.kind==="discard")return!1;let t=e.attributes.dur?.trim().toLowerCase();return t===void 0||t===""||t==="indefinite"}function il(e,t){return e.map(r=>({...r,time:r.time+t}))}function Hs(e,t,r,n,i){let a=e.attributeName?.toLowerCase();if(!a)return null;let o=i?.projection??Ju[a]??{property:a,valueType:"discrete",stateKey:a},s=e.attributes,l=i?.underlying??sx(r,o.stateKey)??zO(o),u=e.kind==="set"?"discrete":s.calcMode??"linear",d=e.duration,c=Nn(e),f=rh(e);if(e.kind==="set"){let v=s.to?.trim();if(!v)return null;let y=Fn([v],[0],[],0,"discrete",o.valueType)[0]?.value;if(y===void 0)return null;let b=[{time:c.offset,value:y,easing:"linear"}];if(d>0&&e.fill==="remove"&&l!==void 0){let I=Fn([l],[0],[],0,"discrete",o.valueType)[0]?.value;if(I===void 0)return null;b.push({time:c.offset+d,value:I,easing:"linear"})}return{id:`svg-animation-${n}`,shapeId:t,property:o.property,enabled:!0,...d>0?{cycleDuration:d}:{},cycleBehavior:"restart",fill:e.fill,calcMode:"discrete",sourceSmilElement:"set",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},...c.beginTrigger?{beginTrigger:c.beginTrigger}:{},...f?{endTrigger:f}:{},keyframes:b}}let p=tl(s,l,o.valueType);if(!p||p.length===0)return null;if(p.length===1){let v=Fn(p,[0],[],d,"discrete",o.valueType)[0]?.value;if(v===void 0)return null;let y=[{time:c.offset,value:v,easing:"linear"}];if(d>0&&e.fill==="remove"&&l!==void 0){let b=Fn([l],[0],[],d,"discrete",o.valueType)[0]?.value;b!==void 0&&y.push({time:c.offset+d,value:b,easing:"linear"})}return{id:`svg-animation-${n}`,shapeId:t,property:o.property,enabled:!0,...d>0?{cycleDuration:d}:{},cycleBehavior:"restart",calcMode:"discrete",sourceSmilElement:"animate",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},...c.beginTrigger?{beginTrigger:c.beginTrigger}:{},...f?{endTrigger:f}:{},keyframes:y}}let h=Do(s,p.length,u),m=jo(s),g=il(Fn(p,h,m,d,u,o.valueType),c.offset);return g.length<2?null:{id:`svg-animation-${n}`,shapeId:t,property:o.property,...Eo(e),...u!=="linear"?{calcMode:u}:{},sourceSmilElement:"animate",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},keyframes:g}}var _O=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(%)?$/u;function RO(e){let t={...e.attributes},r=[],n=a=>{let o=_O.exec(a.trim());return o?(r.push(o[2]?"%":"user"),o[1]):null};if(t.values!==void 0){let a=t.values.split(";").map(n);if(a.some(o=>o===null))return null;t.values=a.join(";")}for(let a of["from","to","by"]){let o=t[a];if(o===void 0)continue;let s=n(o);if(s===null)return null;t[a]=s}if(r.length===0)return null;let i=r[0];return r.some(a=>a!==i)?null:{candidate:{...e,attributes:Object.freeze(t)},unit:i}}var FO=Object.freeze({"stop-color":{suffix:"Color",valueType:"color"},"stop-opacity":{suffix:"Opacity",valueType:"number"},offset:{suffix:"Offset",valueType:"number"}});function LO(e,t){return t==="stop-color"?e.color:String(t==="stop-opacity"?e.opacity:e.offset)}function BO(e,t,r,n){let i=e.attributeName?.toLowerCase(),a=e.targetSourceNodeId;if(!t||!i||!a)return[];let o=FO[i];if(!o||e.kind!=="animate"&&e.kind!=="set")return[];let s=[],l=new Set;for(let u of t.candidates)u.stops.forEach((d,c)=>{if(!(d.sourceNodeId!==a&&d.correspondingSourceNodeId!==a)){for(let f of t.bindings)if(!(f.gradientSourceNodeId!==u.sourceNodeId||f.propertyName!=="fill"&&f.propertyName!=="stroke"))for(let p of nh(f.occurrenceId,r)){let h=`${f.propertyName}GradientStop${c}${o.suffix}`,m=`${p.shapeId}|${h}`;if(l.has(m))continue;l.add(m);let g=Hs(e,p.shapeId,p.state,n+s.length,{projection:{property:h,valueType:o.valueType,stateKey:h},underlying:LO(d,i)});g&&s.push(g)}}});return s}function nh(e,t){let r=t.textSpanBindingForOccurrence?.(e);if(r)return[r];let n=t.shapeBindingsForOccurrence?.(e);if(n&&n.length>0)return n;let i=t.shapeIdForOccurrence(e);return i?[{shapeId:i,shapeType:"unknown",state:t.shapeStateForOccurrence(e)}]:[]}function dp(e,t,r){return t.textSpanId&&r?{...e,textSpanTarget:{spanIds:[t.textSpanId],attributeName:r}}:e}function VO(e,t){if(e.targetStatus!=="resolved"||!e.targetOccurrenceId)return[];let r=nh(e.targetOccurrenceId,t);if(!r.some(i=>i.shapeType==="group")||e.kind==="animateTransform"||e.kind==="animateMotion"||e.kind==="discard"||rl(e.attributeName?.toLowerCase()??""))return r;let n=t.descendantShapeBindingsForOccurrence?.(e.targetOccurrenceId);return n&&n.length>0?n:r}function kf(e,t){if(e!==void 0)return t.shapeIdForLocalReference?.(e.trim())??e.trim()}function UO(e,t,r,n){let i=e.attributeName?.toLowerCase();if(t.shapeType!=="shape-reference"||i!=="href"&&i!=="xlink:href")return null;let a={...e.attributes,...e.attributes.from!==void 0?{from:kf(e.attributes.from,r)}:{},...e.attributes.to!==void 0?{to:kf(e.attributes.to,r)}:{},...e.attributes.values!==void 0?{values:e.attributes.values.split(";").map(o=>kf(o,r)??"").join(";")}:{}};return Hs({...e,attributes:a},t.shapeId,t.state,n,{projection:DO,underlying:String(t.state?.targetShapeId??"")})}function GO(e,t,r){if(e.kind!=="animate"||e.attributeName?.toLowerCase()!=="viewbox")return[];let n=t.shapeType==="svg"?"svgViewBox":t.shapeType==="view"?"viewBox":null;if(!n||e.duration<=0&&!nl(e))return[];let i=tl(e.attributes,void 0,"numberList");if(!i||i.length<2)return[];let a=i.map(ox);if(a.some(d=>d.length<4))return[];let o=e.attributes.calcMode??"linear",s=Do(e.attributes,a.length,o),l=jo(e.attributes),u=Nn(e);return["X","Y","Width","Height"].map((d,c)=>({id:`svg-animation-${r+c}`,shapeId:t.shapeId,property:`${n}${d}`,...Eo(e),...o!=="linear"?{calcMode:o}:{},sourceSmilElement:"animate",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},keyframes:il(Fn(a.map(f=>String(f[c])),s,l,e.duration,o,"number"),u.offset)}))}var XO=Object.freeze({property:"className",valueType:"discrete",stateKey:"metadata"});function co(e){return e.trim().split(/[\t\n\f\r ]+/u).filter(Boolean).join(" ")}function WO(e){if(e.className!==void 0)return co(e.className);let t=e.state?.metadata;return t?.classes?co(t.classes.join(" ")):""}function HO(e,t,r){if(!e.targetOccurrenceId||e.attributeName?.toLowerCase()!=="class")return[];let n=WO(t);if(e.kind==="set"){let o=e.attributes.to;if(o===void 0)return[];let s=Nn(e),l=rh(e),u=[{time:s.offset,value:co(o),easing:"linear"}];return e.duration>0&&e.fill==="remove"&&u.push({time:s.offset+e.duration,value:n,easing:"linear"}),[dp({id:`svg-animation-${r}`,shapeId:t.shapeId,property:"className",enabled:!0,...e.duration>0?{cycleDuration:e.duration}:{},cycleBehavior:"restart",fill:e.fill,calcMode:"discrete",sourceSmilElement:"set",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},...s.beginTrigger?{beginTrigger:s.beginTrigger}:{},...l?{endTrigger:l}:{},keyframes:u},t,"class")]}let i={...e.attributes,...e.attributes.values!==void 0?{values:e.attributes.values.split(";").map(co).filter(Boolean).join(";")}:{},...e.attributes.from!==void 0?{from:co(e.attributes.from)}:{},...e.attributes.to!==void 0?{to:co(e.attributes.to)}:{},calcMode:"discrete"},a=Hs({...e,attributes:i},t.shapeId,t.state,r,{projection:XO,underlying:n});return a?[dp(a,t,"class")]:[]}function qO(e,t,r,n){let i=t.shapeId,a=e.attributes.type?.trim().toLowerCase();if(!a)return[];let o=e.attributes,s=tl(o,void 0,"numberList");if(!s||s.length<2)return[];let l=o.calcMode??"linear",u=Do(o,s.length,l),d=jo(o),c=Nn(e),f=Eo(e),p=s.map(ox),h=(m,g,v,y,b)=>{let I=Fn(s.map((x,k)=>{let $=g(p[k]);return Array.isArray($)?$.join(" "):String($)}),u,d,e.duration,l,m==="transformMatrix"?"numberList":"number").map((x,k)=>({...x,time:x.time+c.offset,value:m==="transformMatrix"?p[k].slice(0,6):x.value}));return{id:`svg-animation-${n+v}`,shapeId:i,property:m,...f,additive:e.additive,...e.additive==="replace"&&e.replacesCarrierBase?{replacesCarrierBase:!0}:{},...y?{transformOrigin:y}:{},...b?{targetTransformOrigin:b}:{},...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},keyframes:I}};if(a==="translate")return[h("translateX",m=>m[0]??0,0),h("translateY",m=>m[1]??0,1)];if(a==="scale")return[h("scaleX",m=>m[0]??1,0),h("scaleY",m=>m[1]??m[0]??1,1)];if(a==="rotate"){let m=p.find(b=>b.length>=3),g=t.state?.customPivot,v=e.targetOccurrenceId?r.style(e.targetOccurrenceId)?.cascadedValues["transform-origin"]!==void 0:!1,y=m?{x:m[1]+(g?.x??0),y:m[2]+(g?.y??0)}:g??{x:0,y:0};return[h("rotation",b=>b[0]??0,0,y,v&&g?g:void 0)]}return a==="skewx"||a==="skewy"?[h(a==="skewx"?"skewX":"skewY",m=>m[0]??0,0)]:a==="matrix"&&p.every(m=>m.length>=6)?[h("transformMatrix",m=>m.slice(0,6),0)]:[]}function ux(e,t,r,n){if(!e.motionPathData||e.duration<=0&&!nl(e))return null;let i=e.attributes.keyPoints?.split(";").map(Number).filter(Number.isFinite),a=i&&i.length>=2?i:[0,1],o=e.attributes.calcMode??"paced",s=Do(e.attributes,a.length,o),l=jo(e.attributes),u=Nn(e),d=e.attributes.rotate?.trim(),c=d===void 0?Number.NaN:Number(d),f=e.motionPathSourceNodeId?r.shapeIdForSourceNode(e.motionPathSourceNodeId):null,p=e.motionPathElementSourceNodeId?r.elementIdForSourceNode?.(e.motionPathElementSourceNodeId)??e.sourceMpathId:null;return{id:`svg-animation-${n}`,shapeId:t,property:"pathMotion",...Eo(e),motionPath:e.motionPathData,...f?{motionPathRef:{shapeId:f,mode:"curveTemplate"}}:{},...p?{sourceMpathId:p}:{},...d==="auto"||d==="auto-reverse"?{motionRotate:d}:Number.isFinite(c)?{motionRotate:c}:{},...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},...o!=="linear"?{calcMode:o}:{},keyframes:il(Fn(a.map(String),s,l,e.duration,o,"number"),u.offset)}}var YO=new Set(["cx","cy","r","rx","ry","x","y","x1","y1","x2","y2","width","height","opacity","fill-opacity","stroke-opacity","stop-opacity","stroke-width","stroke-dashoffset","stroke-miterlimit","offset","pathlength","startoffset","fr"]),KO=new Set(["fill","stroke","stop-color","flood-color","lighting-color"]);function Un(e){let t={definitionId:e.definitionId,...e.nodeId?{nodeId:e.nodeId}:{}};return{shapeId:Id(t),definitionTarget:t}}function ZO(e,t,r,n){let i=ux(e,Un(t).shapeId,r,n);return i?{...i,property:"targetTransformStack",additive:e.additive,...Un(t),transformFunction:"translate",transformStackIndex:0,transformBaseValue:t.baseTransform}:null}function JO(e,t,r,n){let i=e.attributes.type?.trim();if(i!=="translate"&&i!=="scale"&&i!=="rotate"&&i!=="skewX"&&i!=="skewY"&&i!=="matrix")return null;let a=tl(e.attributes,void 0,"discrete");if(!a||a.length<2||e.duration<=0&&!nl(e))return null;let o=e.attributes.calcMode??"linear",s=Do(e.attributes,a.length,o),l=jo(e.attributes),u=Nn(e);return{id:`svg-animation-${r}`,...Un(t),property:"targetTransformStack",...Eo(e),additive:e.additive,...o!=="linear"?{calcMode:o}:{},sourceSmilElement:"animateTransform",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},transformFunction:i,transformStackIndex:n,transformBaseValue:t.baseTransform,keyframes:il(Fn(a,s,l,e.duration,o,"discrete"),u.offset)}}function QO(e,t,r){let n=e.attributeName;if(!n||e.kind!=="animate"&&e.kind!=="set")return null;let i=n.toLowerCase(),a=t.baseAttributes[n]??t.baseAttributes[i]??"",o=e.kind==="animate"&&(i==="display"||i==="visibility"),s=e.kind==="set"?"string":YO.has(i)?"number":KO.has(i)?"color":"string";if(e.kind==="set"){let m=e.attributes.to?.trim();if(m===void 0)return null;let g=Nn(e),v=[{time:g.offset,value:m,easing:"linear"}];return e.duration>0&&e.fill==="remove"&&v.push({time:g.offset+e.duration,value:a,easing:"linear"}),{id:`svg-animation-${r}`,...Un(t),property:Ju[i]?.property??i,enabled:!0,...e.duration>0?{cycleDuration:e.duration}:{},cycleBehavior:"restart",calcMode:"discrete",sourceSmilElement:"set",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},targetAttribute:n,targetAttributeValueType:"string",transformBaseValue:a,keyframes:v}}let l=o||s==="string"?"discrete":s,u=tl(e.attributes,a,l);if(!u||u.length===0||e.duration<=0&&!nl(e))return null;let d=o?"discrete":e.attributes.calcMode??"linear",c=Do(e.attributes,u.length,d),f=jo(e.attributes),p=Nn(e),h=o?i==="display"?"targetDisplay":"targetVisibility":Ju[i]?.property??i;return{id:`svg-animation-${r}`,...Un(t),property:h,...Eo(e),calcMode:d,sourceSmilElement:"animate",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},targetAttribute:n,targetAttributeValueType:s,transformBaseValue:a,keyframes:il(Fn(u,c,f,e.duration,d,l),p.offset)}}function eT(e,t,r,n,i){if(e.kind==="animateMotion")return ZO(e,t,r,n);if(e.kind==="animateTransform")return JO(e,t,n,i);if(e.kind==="discard"){let a=Nn(e);return{id:`svg-animation-${n}`,...Un(t),property:"discard",enabled:!0,sourceSmilElement:"discard",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},transformBaseValue:t.baseAttributes.display??"",keyframes:[{time:a.offset,value:1,easing:"linear"}]}}return QO(e,t,n)}function tT(e,t,r,n,i){let a=VO(e,r);if(a.length===0&&e.targetOccurrenceId){let l=r.definitionTargetForOccurrence?.(e.targetOccurrenceId),u=l?eT(e,l,r,n,i):null;return u?[u]:[]}let o=[];for(let l of a){if(e.kind==="animateTransform"){o.push(...qO(e,l,t,n+o.length));continue}if(e.kind==="animateMotion"){let p=ux(e,l.shapeId,r,n+o.length);p&&o.push(p);continue}if(e.kind==="discard"){let p=Nn(e);o.push({id:`svg-animation-${n+o.length}`,shapeId:l.shapeId,property:"discard",enabled:!0,sourceSmilElement:"discard",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},keyframes:[{time:p.offset,value:1,easing:"linear"}]});continue}let u=GO(e,l,n+o.length);if(u.length>0){o.push(...u);continue}let d=HO(e,l,n+o.length);if(d.length>0){o.push(...d);continue}let c=UO(e,l,r,n+o.length);if(c){o.push(c);continue}if(e.attributeName?.toLowerCase()==="startoffset"&&l.shapeType==="text"){let p=RO(e);if(!p)continue;let h=Hs(p.candidate,l.shapeId,l.state,n+o.length);h&&o.push({...h,textPathStartOffsetUnit:p.unit});continue}let f=Hs(e,l.shapeId,l.state,n+o.length);f&&o.push(dp(f,l,e.attributeName))}let s=e.targetOccurrenceId?nh(e.targetOccurrenceId,r):[];return e.sourceSmilPlacement==="document"&&s.length===1&&o.every(l=>l.shapeId===s[0].shapeId&&!l.property.startsWith("textPath"))?o.map(l=>({...l,sourceSmilPlacement:"document",...e.sourceSmilParentTarget?{sourceSmilParentTarget:!0}:{}})):o}function Ms(e){let t=e.animation,r=Number(t.iterationCount);return{enabled:!0,sourceCssAnimationId:e.animationId,cycleDuration:t.duration,cycleBehavior:t.direction==="reverse"||t.direction==="alternate"||t.direction==="alternate-reverse"?t.direction:"restart",...t.iterationCount==="infinite"?{cycleInfinite:!0}:Number.isFinite(r)&&r>=0&&r!==1?{cycleRepeats:r}:{},...RA(t)}}var rT=Object.freeze([["translateX",0],["translateY",0],["scaleX",1],["scaleY",1],["rotation",0],["skewX",0],["skewY",0]]);function nT(e,t,r,n){let i=r.shapeIdForOccurrence(e.occurrenceId),a=i?null:r.definitionTargetForOccurrence?.(e.occurrenceId),o=i??(a?Un(a).shapeId:null);if(!o)return[];let s=t.value(e.occurrenceId,"transform-box")??"view-box",l=r.cssTransformContextForOccurrence?.(e.occurrenceId,s),u=r.shapeBindingsForOccurrence?.(e.occurrenceId)[0],d=(s==="fill-box"||s==="content-box")&&u?.state?NO({id:u.shapeId,type:u.shapeType,state:u.state}):null,c={...d?{boxX:d.minX,boxY:d.minY,boxWidth:d.maxX-d.minX,boxHeight:d.maxY-d.minY}:{},...l??{}},f=e.keyframes.stops.flatMap(b=>{let I=b.properties.transform??b.properties["-webkit-transform"]??b.properties["-moz-transform"];return I===void 0?[]:[{offset:b.offset,raw:I,timing:b.properties["animation-timing-function"]}]});if(f.length===0)return[];let p=t.value(e.occurrenceId,"transform")??"none";f[0].offset>0&&f.unshift({offset:0,raw:p,timing:void 0}),f.at(-1).offset<1&&f.push({offset:1,raw:p,timing:void 0});let h=t.style(e.occurrenceId)?.cascadedValues["transform-origin"]?_b(t.value(e.occurrenceId,"transform-origin")??"0 0",c):{x:0,y:0},m=Lb(f.map(({offset:b,raw:I})=>({offset:b,transform:I})),{...c,...h?{transformOrigin:h}:{},retainPureRotationOrigin:!a,progressForInterval:(b,I)=>{let x=f[b]?.timing;return fA(x?Sd(x):e.animation.parsedEasing,I)}});if(m.status!=="projected")return[];if(a)return[{id:`svg-animation-${n}`,...Un(a),property:"targetTransformStack",...Ms(e),additive:"replace",replacesCarrierBase:!0,transformFunction:"matrix",transformStackIndex:0,transformBaseValue:a.baseTransform,template:{name:e.animation.name},keyframes:m.stops.map(b=>As(b.offset,b.matrix.join(" "),e.animation,m.sampled?"linear":f.findLast(I=>I.offset<b.offset)?.timing))}];if(!m.pureRotation)return[{id:`svg-animation-${n}`,shapeId:o,property:"transformMatrix",...Ms(e),additive:"replace",replacesCarrierBase:!0,template:{name:e.animation.name},keyframes:m.stops.map(b=>As(b.offset,b.matrix.join(" "),e.animation,m.sampled?"linear":f.findLast(I=>I.offset<b.offset)?.timing))}];let g=m.stops.map(b=>({offset:b.offset,channels:b})),v=new Set(m.channels),y=[];for(let[b,I]of rT){if(!v.has(b))continue;let x=g.flatMap(({offset:k,channels:$})=>{if(!$)return[];let A=$[b]??I,S=f.findLastIndex(N=>N.offset<k);return[As(k,A,e.animation,m.sampled?"linear":f[Math.max(0,S)]?.timing)]});x.length<2||y.push({id:`svg-animation-${n+y.length}`,shapeId:o,property:b,...Ms(e),additive:b==="translateX"||b==="translateY"?"sum":"replace",replacesCarrierBase:!0,...b==="rotation"&&h&&(m.pureRotation||h.x===0&&h.y===0&&(h.z??0)===0)?{transformOrigin:{x:h.x,y:h.y}}:{},template:{name:e.animation.name},keyframes:x})}return y}function iT(e,t,r){let n=Dr(e);if(!n)return null;if(n.unit==="")return n.value;let i=r?.viewportWidth,a=r?.viewportHeight,o=t==="x"?i:t==="y"?a:i!==void 0&&a!==void 0?Math.hypot(i,a)/Math.SQRT2:void 0;return xa(n,{...r??{},percentBasis:o})??null}function Hy(e,t,r,n=null){let i=e.trim();if(t!=="number")return i;if(r)return iT(i,r,n);let a=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(?:px)?$/iu.exec(i);if(!a)return null;let o=Number(a[1]);return Number.isFinite(o)?o:null}function As(e,t,r,n){let i={time:e*r.duration+r.delay,value:t,easing:r.easing},a=n?Sd(n):r.parsedEasing;return a&&cA(i,a),i}function aT(e,t){if(e.length!==0){if(e[0].offset>0){let r=t();r&&e.unshift({...r,offset:0})}if(e.at(-1).offset<1){let r=t();r&&e.push({...r,offset:1})}}}function oT(e,t,r,n){let i=r.shapeIdForOccurrence(e.occurrenceId),a=i?null:r.definitionTargetForOccurrence?.(e.occurrenceId),o=i??(a?Un(a).shapeId:null);if(!o)return[];let s=r.shapeStateForOccurrence(e.occurrenceId),l=r.cssTransformContextForOccurrence?.(e.occurrenceId,"view-box")??null,u=new Set(e.keyframes.stops.flatMap(c=>Object.keys(c.properties)));u.delete("animation-timing-function"),u.delete("transform"),u.delete("-webkit-transform"),u.delete("-moz-transform");let d=[];for(let c of u){let f=jO[c];if(!f)continue;let p=e.keyframes.stops.flatMap(m=>{let g=m.properties[c];if(g===void 0)return[];let v=Hy(g,f.valueType,f.cssLengthAxis,l);return v===null?[]:[{offset:m.offset,value:v,timing:m.properties["animation-timing-function"]}]}),h=t.value(e.occurrenceId,c)??sx(s,f.stateKey)??a?.baseAttributes[c];if(aT(p,()=>{if(h==null)return null;let m=Hy(h,f.valueType,f.cssLengthAxis,l);return m===null?null:{offset:0,value:m,timing:void 0}}),!(p.length<2)){if(a){d.push({id:`svg-animation-${n+d.length}`,...Un(a),property:f.property,targetAttribute:c,targetAttributeValueType:f.valueType==="number"?"number":f.valueType==="color"?"color":"string",...Ms(e),template:{name:e.animation.name},keyframes:p.map((m,g)=>As(m.offset,m.value,e.animation,g===0?void 0:p[g-1].timing))});continue}d.push({id:`svg-animation-${n+d.length}`,shapeId:o,property:f.property,...Ms(e),template:{name:e.animation.name},keyframes:p.map((m,g)=>As(m.offset,m.value,e.animation,g===0?void 0:p[g-1].timing))})}}return d}function sT(e){let t=Math.max(0,...e.keyframes.map(r=>r.time));return $A(e)??t}function cp(e,t,r,n,i={}){let a=new PO(e.smil),o=i.smil??e.smil,s=i.css??e.css,l=[],u=[],d=[],c=[],f=[],p=new Map,h=new Map;for(let b of o){let I=0;if(b.kind==="animateTransform"&&b.targetOccurrenceId){let x=`${b.targetOccurrenceId}|${b.sourceNodeId}`,k=p.get(x);k!==void 0?I=k:(I=h.get(b.targetOccurrenceId)??0,p.set(x,I),h.set(b.targetOccurrenceId,I+1))}for(let x of a.activations(b)){let k=BO(x,n,r,1),$=(k.length>0?k:tT(x,t,r,1,I)).map(A=>({...A,sourceSmilOrder:b.sourceElementOrder,...b.sourceSmilPlacement==="defs"?{sourceSmilPlacement:"defs",sourceSmilDefinitionOrder:r.definitionOrderForSourceNode?.(b.sourceNodeId),sourceSmilDefinitionContainerId:r.definitionContainerIdForSourceNode?.(b.sourceNodeId)}:{}}));b.kind==="animateTransform"?l.push(...$):b.kind==="animateMotion"?u.push(...$):b.kind==="set"?c.push(...$):b.kind==="discard"?f.push(...$):d.push(...$)}}let m=[],g=[];for(let b of s)m.push(...nT(b,t,r,1)),g.push(...oT(b,t,r,1));let v=[...l,...u,...d,...c,...f,...m,...g].map((b,I)=>{let x=`svg-animation-${I+1}`;return{...b,id:x,keyframes:b.keyframes.map((k,$)=>({...k,id:k.id??`${x}-kf-${$+1}`}))}});if(v.length===0)return null;let y=s.flatMap(b=>{let I=v.filter(k=>k.sourceCssAnimationId===b.animationId)[0]?.id;if(!I)return[];v=v.map(k=>k.sourceCssAnimationId===b.animationId?{...k,sourceCssAnimationId:I}:k);let x=v.filter(k=>k.sourceCssAnimationId===I);return[{id:I,trackIds:x.map(k=>k.id),trackFingerprints:x.map(Cb)}]});return{duration:Math.max(...v.map(sT)),loop:v.some(b=>b.cycleInfinite===!0),playbackSpeed:1,tracks:v,...y.length>0?{cssAnimationSources:y}:{}}}function lT(e,t){return cp(e.animations,e.styles,t,e.gradients)}var Ln=e=>({status:"supported",by:e}),qs=(e,t)=>({status:"diagnosed-unsupported",by:e,reason:t}),Za=(e,t)=>({status:"diagnosed-lossy",by:e,reason:t}),vt=e=>({status:"exempt",reason:e}),uT="plugin SVG result diagnostic collector",ih="pattern fragment diagnostic collector",ah="vectorized SVG result diagnostic collector",Sf="foreign document transcoder diagnostic collector",qy="ingest node decoration keyed by authored id (ingest/plan-decoration.ts)";function pt(e,t={}){let r=t.authored??Ln(e);return{"native-document-open":Ln("native snapshot parse and canonical restore"),"full-snapshot-restore":Ln("canonical full-snapshot restore"),"svg-document-import":r,"external-svg-paste":r,"internal-clipboard-paste":Ln("closed clipboard subgraph materializer"),"plugin-svg-fragment":t.plugin??Ln("plugin fragment plan materializer"),"pattern-fragment":t.pattern??qs(ih,"Pattern fragments retain only capabilities enrolled by the pattern tile contract."),"vectorized-svg-fragment":t.vectorized??qs(ah,"Vectorized ingestion intentionally accepts path-oriented geometry only."),"illustrator-document-import":t.foreign??r,"pdf-document-import":t.foreign??r}}var fu=e=>qs(uT,e),Ii=e=>qs(ih,e),Yy=e=>qs(ah,e),qr=e=>Ln(e),$f=e=>Ln(e),dT={geometry:pt("SVG shape element parser",{pattern:qr("fragment-scoped pattern shape parser"),vectorized:$f("vectorized path geometry parser")}),containers:pt("SVG structural container planner",{pattern:qr("fragment-scoped pattern hierarchy parser")}),"source-order":pt("source document order index and SceneGraph placement",{pattern:qr("pattern source-order materializer"),vectorized:$f("vectorized path document-order traversal")}),hierarchy:pt("source DOM hierarchy planner and SceneGraph placement",{pattern:qr("fragment-scoped pattern hierarchy materializer")}),"root-viewport-frame":pt("root SVG frame parser and application policy",{plugin:vt("Plugin fragment framing is consumed only for bounds scaling."),pattern:vt("Pattern fragments use the explicit tile width and height as their local frame."),vectorized:Za(ah,"Vectorized source framing is consumed only to scale path geometry into target bounds.")}),"common-presentation":pt("shared SVG presentation parser",{pattern:qr("pattern shape presentation parser"),vectorized:$f("vectorized path presentation parser")}),"conditional-processing":pt("SVG switch and conditional-processing attribute parser",{pattern:qr("pattern shape conditional-processing parser"),vectorized:Yy("Vectorized ingestion does not preserve SVG conditional-processing branches."),foreign:vt("Transcoded SVG has no switch or conditional-processing attributes.")}),"authored-attributes":pt("authored-attribute preservation parser",{pattern:qr("pattern authored-attribute preservation parser")}),gradients:pt("gradient parser and library reference materializer",{pattern:qr("fragment-scoped pattern gradient resolver"),foreign:Za(Sf,"Axial and radial shadings import as gradients; mesh shadings are rasterized into embedded images.")}),patterns:pt("pattern parser and library reference materializer",{pattern:qr("fragment-scoped nested-pattern resolver"),foreign:Za(Sf,"Tiling patterns import in a fixed pattern space; cells larger than their step are clipped.")}),filters:pt("filter parser and reference materializer",{foreign:vt("PDF content has no filter primitives; effects arrive flattened.")}),"paint-server-definitions":pt("paint-server definition collector and materializer",{pattern:qr("fragment-scoped pattern paint-server collector")}),markers:pt("marker definition parser and reference materializer",{foreign:vt("PDF content has no marker vocabulary; arrowheads arrive as geometry.")}),symbols:pt("symbol definition and instance materializer"),"use-and-linked-references":pt("use resolver and stable reference-edge materializer",{pattern:qr("fragment-scoped linked-reference resolver")}),"clip-definitions":pt("clip definition parser and materializer",{pattern:Ii("Pattern editing omits document clip definitions.")}),"mask-definitions":pt("mask definition parser and materializer",{pattern:Ii("Pattern editing omits document mask definitions.")}),"clip-mask-membership":pt("clip and mask membership materializer",{pattern:Ii("Pattern editing omits document clip and mask membership.")}),"smil-animation":pt("SMIL parser and animation-track materializer",{pattern:Ii("Pattern editing materializes a static tile without SMIL tracks."),foreign:vt("Transcoded documents are static; PDF carries no SMIL animation.")}),"css-animation":pt("CSS keyframe parser and animation-track materializer",{pattern:Ii("Pattern editing materializes a static tile without CSS animation tracks."),foreign:vt("Transcoded documents are static; PDF carries no CSS animation.")}),metadata:pt("document metadata parser and field policy",{plugin:fu("Plugin fragments preserve host document metadata."),pattern:vt("Pattern fragments have no document metadata scope."),vectorized:vt("Vectorized fragments have no document metadata scope.")}),scripts:pt("inert script partitioner and document script materializer",{authored:Za("inert script partitioner and document script materializer","Script content is preserved verbatim and re-emitted on export, but never executed, so script-driven animation and interactivity are inert inside the editor."),plugin:Ln("inert plugin fragment script data materializer"),pattern:Ii("Pattern fragments do not execute or adopt scripts."),vectorized:Yy("Vectorized fragments do not execute or adopt scripts."),foreign:vt("Transcoded SVG carries no scripts; PDF scripting is never imported.")}),styles:pt("preserved CSS style collector and materializer",{pattern:qr("fragment-scoped pattern style resolver"),foreign:vt("Transcoded SVG uses presentation attributes and no author stylesheet.")}),"custom-properties":pt("CSS custom-property collector and materializer",{pattern:qr("fragment-scoped pattern variable resolver"),foreign:vt("Transcoded SVG declares no CSS custom properties.")}),views:pt("SVG view parser and SceneGraph materializer",{plugin:fu("Plugin fragments do not alter document navigation views."),pattern:vt("Pattern fragments have no document navigation view scope."),vectorized:vt("Vectorized fragments have no document navigation view scope.")}),"embedded-svg":pt("embedded SVG container parser and materializer",{pattern:Za(ih,"Pattern editing flattens nested SVG content into the local tile frame."),foreign:vt("Transcoded documents place pages as views, never as nested SVG.")}),fonts:pt("declared font-consent effect and approved loader",{plugin:fu("Plugin fragments do not start an implicit external font consent flow."),pattern:Ii("Pattern fragments do not start an implicit font consent flow."),vectorized:vt("Path-only vectorized fragments do not consume font resources."),foreign:Za(Sf,"PDF font programs are subsets keyed by private-use code points, so text keeps its mapped family name and resolves through the font consent flow, local fonts or outlines.")}),"external-assets":pt("declared external-asset resolver with proxy policy",{plugin:fu("Plugin fragments diagnose assets outside the enrolled security policy."),pattern:Ii("Pattern fragments diagnose external assets instead of fetching them."),vectorized:vt("Path-only vectorized fragments do not consume external assets."),foreign:vt("Transcoded documents embed every image as a data URL and fetch nothing.")}),"foreign-structure":{"native-document-open":vt("Native documents restore layer names, lock and visibility canonically."),"full-snapshot-restore":vt("Snapshot restore carries layer names, lock and visibility as fields."),"svg-document-import":vt("Authored SVG has no vocabulary for editor lock state or panel names."),"external-svg-paste":vt("Authored SVG has no vocabulary for editor lock state or panel names."),"internal-clipboard-paste":vt("Internal clipboard subgraphs carry layer names and lock as serialized state."),"plugin-svg-fragment":vt("Plugin fragments name their groups through descriptors."),"pattern-fragment":vt("Pattern tiles carry no editor structure sidecar."),"vectorized-svg-fragment":vt("Vectorized fragments carry no editor structure sidecar."),"illustrator-document-import":Ln(qy),"pdf-document-import":Ln(qy)}};function cT(e,t){return dT[e][t]}var pa={schemaVersion:{serialization:{kind:"verbatim"},precision:"opaque",required:!1,collab:{exempt:"Format version of the document envelope, not content. The reducer never rewrites it; it is stamped by the serializer and consumed by migrateSnapshot."},rendered:{renderToSvg:{exempt:"Format-envelope version consumed by migrateSnapshot before renderToSvg sees the snapshot; it has no output representation."},codegen:{exempt:"Format-envelope version consumed while normalizing codegen input; it is not content in an embeddable component."},dxf:{exempt:"Format-envelope version is consumed before the editor constructs DXF shape inputs and has no DXF entity representation."},mermaid:{exempt:"Format-envelope version is consumed before Mermaid receives shapes and has no graph-syntax representation."},pdf:{exempt:"Format-envelope version is consumed during document migration before the PDF export surface receives its SVG page input."},"editor-dom":{exempt:"Format-envelope version is consumed during document migration before the live editor DOM is projected."}}},shapes:{serialization:{kind:"shape-array"},precision:"shape-trees",required:!0,collab:{ops:["shape:add","shape:update","shape:remove","text:format"]},rendered:{renderToSvg:{by:"svg-renderer main loop via renderShape; motionOnly shapes become origin-normalized <path> defs for <mpath>"},codegen:{by:"buildRenderPlan supplies the normalized visible-shape entries and defs consumed by every component backend"},dxf:{by:"apps/editor/src/export/dxf-exporter.ts converts supported geometry and accounts for unsupported shape inputs"},mermaid:{by:"apps/editor/src/export/mermaid-exporter.ts maps flowchart nodes and connectors into graph syntax with skip accounting"},pdf:{by:"ExportPanel.generatePdfBlob converts rendered SVG shape markup through svg2pdf and warns before unsupported textPath expansion"},"editor-dom":{by:"SceneGraph and scene-graph-dom-projector drive registered Shape renderers for the live canvas projection"}}},viewboxes:{serialization:{kind:"id-sorted-array"},precision:"numeric-leaves",required:!0,collab:{exempt:"DERIVED, not stored. `DocumentRootManager.getViewboxes()` projects it from the `<view>` shapes on every read, and the editor host installs no-op setters after View unification. Editing a view is a `shape:update`, which is on the wire; the array regenerates from the shapes on the next serialize."},rendered:{renderToSvg:{by:"viewboxes[0] drives the root width, height, and viewBox in svg-renderer sizing"},codegen:{by:"buildRenderPlan.frame supplies the shared width, height, and viewBox used by every component backend"},dxf:{exempt:"DXF writes model-space geometry and unit metadata, not an SVG viewport or page framing rectangle."},mermaid:{exempt:"Mermaid computes graph layout from topology and has no authored viewport or viewBox capability."},pdf:{by:"ExportPanel PDF page generation uses the selected source bounds and page settings to establish the PDF frame and placement"},"editor-dom":{by:"DocumentRootManager projects view shapes and the active view onto the live root SVG viewport"}}},guides:{serialization:{kind:"id-sorted-array"},precision:"numeric-leaves",required:!1,collab:{ops:["guides:set","guide:upsert","guide:remove","guide:move"]},rendered:{renderToSvg:{exempt:"Editor-only authoring aids (alignment guides); SVG document output has no representation for them by design."},codegen:{exempt:"Alignment guides are editor-only authoring aids and do not belong in an embeddable generated component."},dxf:{exempt:"Alignment guides are editor-only authoring aids rather than drawing geometry and do not become DXF entities."},mermaid:{exempt:"Alignment guides are editor-only authoring aids rather than graph nodes or edges and do not enter Mermaid syntax."},pdf:{exempt:"Alignment guides are editor-only authoring aids and are excluded from the rendered SVG page supplied to PDF conversion."},"editor-dom":{by:"GuideManager projects persisted guides into the editor authoring overlay"}}},measurements:{serialization:{kind:"id-sorted-array"},precision:"numeric-leaves",required:!1,collab:{ops:["measurements:set","measurement:upsert","measurement:remove","measurement:move"]},rendered:{renderToSvg:{exempt:"Editor measurement aids have no SVG document representation; the editor SVG export omits it by design."},codegen:{exempt:"Measurements are editor-only authoring aids and do not belong in an embeddable generated component."},dxf:{exempt:"Editor measurement annotations are not drawing geometry and do not become DXF entities in this exporter."},mermaid:{exempt:"Editor measurement annotations are not graph nodes or edges and do not enter Mermaid syntax."},pdf:{exempt:"Editor measurement annotations are authoring aids and are excluded from the rendered SVG page supplied to PDF conversion."},"editor-dom":{by:"MeasureManager projects persisted measurements into the editor authoring overlay"}}},sceneTree:{serialization:{kind:"id-sorted-array"},precision:"opaque",required:!1,collab:{ops:["scene:move","scene:place"]},rendered:{renderToSvg:{exempt:"Structure authority whose render projection is inline state.children; renderToSvg consumes that projection instead of the tree."},codegen:{exempt:"Component backends consume buildRenderPlan over inline state.children, the canonical render projection of sceneTree."},dxf:{exempt:"DXF receives shape trees whose inline children are the render projection; it does not replay sceneTree independently."},mermaid:{exempt:"Mermaid receives serialized shapes and connector references rather than replaying the editor sceneTree."},pdf:{exempt:"PDF receives the rendered SVG hierarchy produced from inline children and does not independently replay sceneTree placements."},"editor-dom":{by:"SceneGraph structure and scene-graph-dom-projector reconcile sceneTree placements into the live DOM hierarchy"}}},clipMaskGroups:{serialization:{kind:"id-sorted-array"},precision:"opaque",required:!1,collab:{ops:["clipMask:upsert","clipMask:remove"]},rendered:{renderToSvg:{by:"renderer/clip-mask-defs.ts emits clipPath and mask defs plus content wrapping while suppressing clip shapes from the visible tree"},codegen:{by:"buildRenderPlan clip-mask runs and defs are consumed by every component backend without re-deriving membership"},dxf:{exempt:"DXF is a geometry exchange target with no SVG clipPath or mask model; shape conversion operates on authored geometry."},mermaid:{exempt:"Mermaid graph syntax has no clipping or masking vocabulary; export is defined over flowchart topology and labels."},pdf:{by:"The rendered SVG page carries reachable clipPath and mask definitions into the svg2pdf conversion boundary"},"editor-dom":{by:"ClipMaskManager and ClipMaskHandler project definitions and content wrappers into the live canvas DOM"}}},documentMetadata:{serialization:{kind:"deep-sorted-object"},precision:"opaque",required:!1,collab:{ops:["metadata:set","metadata:patch"]},rendered:{renderToSvg:{by:"renderer/document-metadata.ts emits xml:lang on the root plus title, description, metadata, and raw HTML metadata as first children"},codegen:{exempt:"Embeddable component backends omit document-artifact identity because the host application owns title, description, and RDF metadata."},dxf:{exempt:"The DXF exporter writes drawing entities and units only; SVG document identity metadata is outside its interchange contract."},mermaid:{exempt:"Mermaid export represents graph topology and labels; SVG document identity metadata has no graph-syntax equivalent."},pdf:{exempt:"SVG title, description, and RDF blocks are not mapped to PDF document information by the current export workflow."},"editor-dom":{by:"DocumentMetadataManager owns metadata and projects language and descriptive elements onto the live document DOM"}}},documentExtensions:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["documentExtensions:set","documentExtension:upsert","documentExtension:remove"]},rendered:{renderToSvg:{by:"renderer/document-extensions.ts serializes namespace-aware extension value trees into their canonical root or defs placement"},codegen:{exempt:"Embeddable component backends represent painted editor shapes and deliberately omit non-rendering application-specific document extension elements."},dxf:{exempt:"DXF has no XML namespace or application-extension element vocabulary and consumes only canonical drawing geometry."},mermaid:{exempt:"Mermaid graph syntax has no XML namespace or application-extension element vocabulary and consumes only canonical graph topology."},pdf:{by:"The rendered SVG page carries structured extension elements through the SVG-to-PDF conversion boundary without treating them as painting geometry"},"editor-dom":{exempt:"These foreign application elements are inert document state; like document scripts, they remain outside the interactive canvas DOM and render from the canonical model."}}},definitionContainers:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["definitionContainers:set"]},rendered:{renderToSvg:{by:"renderer/svg-renderer.ts emits each authored definition container with its canonical identity and ordered definition entries"},codegen:{exempt:"Component backends consume canonical definition entries but do not reproduce authored outer defs container identities."},dxf:{exempt:"DXF has no definition-container element and consumes referenced canonical geometry rather than SVG document structure."},mermaid:{exempt:"Mermaid has no SVG definition-container vocabulary and consumes graph topology rather than SVG document structure."},pdf:{by:"The rendered SVG page carries authored definition containers through the SVG-to-PDF conversion boundary"},"editor-dom":{exempt:"The editor uses one interaction-oriented resource projection while the canonical aggregate retains authored defs container identity for export."}}},documentScripts:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["documentScripts:set","documentScript:upsert","documentScript:remove"]},rendered:{renderToSvg:{by:"renderer/document-scripts.ts emits script elements at the end of the SVG when RenderOptions.includeScripts is enabled"},codegen:{exempt:"Embeddable component backends never inject authored executable scripts; behavior in the host application belongs to consumer code."},dxf:{exempt:"DXF drawing output cannot carry executable SVG document scripts and the exporter never evaluates them."},mermaid:{exempt:"Mermaid graph output cannot carry executable SVG document scripts and the exporter never evaluates them."},pdf:{exempt:"PDF conversion never executes or embeds authored SVG scripts; executable document behavior is outside the static export contract."},"editor-dom":{exempt:"DocumentScriptManager keeps scripts inert and never inserts them into the live SVG because dynamically appended script elements execute."}}},documentStyles:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["documentStyles:set","documentStyle:upsert","documentStyle:remove"]},rendered:{renderToSvg:{by:"renderer/document-styles.ts emits style elements as last children with animation declarations stripped because SMIL owns playback"},codegen:{by:"buildRenderPlan.documentStyles supplies normalized style markup to every component backend"},dxf:{exempt:"CSS rules style SVG presentation rather than DXF geometry entities and are outside the DXF export contract."},mermaid:{exempt:"Authored SVG CSS cannot be represented in Mermaid graph syntax; Mermaid styling is generated from its own vocabulary."},pdf:{by:"The rendered SVG page carries authored style elements and computed presentation into the svg2pdf conversion boundary"},"editor-dom":{by:"DocumentStylesManager projects ordered authored styles into the live SVG and keeps the cascade synchronized"}}},templateVariables:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["templateVariables:set","templateVariable:upsert","templateVariable:remove"]},rendered:{renderToSvg:{exempt:"Template variables are substituted upstream by CLI, Action, and SDK entry points; in-renderer substitution would double-apply them."},codegen:{exempt:"Template variables are substituted while normalizing the codegen document input, before any component backend receives a plan."},dxf:{exempt:"Template variables are document-input preprocessing; the DXF exporter receives already-materialized live shape values."},mermaid:{exempt:"Template variables are document-input preprocessing; the Mermaid exporter receives already-materialized labels and references."},pdf:{exempt:"Template variables are resolved before the editor renders the SVG page that is supplied to PDF conversion."},"editor-dom":{by:"VariableManager resolves template variables and maintains their safe live style projection for shape renderers"}}},animationTimeline:{serialization:{kind:"deep-sorted-object"},precision:"animation-timeline",required:!1,collab:{ops:["animation:set","animation:config","animation:clear","animationTrack:upsert","animationTrack:remove","animationKeyframe:upsert","animationKeyframe:remove"]},rendered:{renderToSvg:{by:"renderAnimationElements projects target-owned SMIL children and document-owned SMIL references through smil-kernel"},codegen:{by:"buildRenderPlan attaches the same SMIL output to shape and document-root markup consumed by every component backend"},dxf:{exempt:"DXF output is a static geometry snapshot and has no SVG SMIL timeline representation in the supported file version."},mermaid:{exempt:"Mermaid export is a static graph description and has no SVG SMIL timeline representation."},pdf:{exempt:"PDF output is a static page snapshot and has no time-based SMIL timeline representation in the export contract."},"editor-dom":{by:"AnimationManager composes ephemeral overlays and the SMIL export kernel projects authored timelines for document output"}}},library:{serialization:{kind:"id-sorted-array"},precision:"shape-trees",required:!1,collab:{ops:["library:set","library:upsert","library:remove"]},rendered:{renderToSvg:{by:"renderLibraryDefs emits reference-filtered gradients, patterns, filters, markers, and symbols into defs"},codegen:{by:"buildRenderPlan library-def channels are emitted by every component backend with shared reference reachability"},dxf:{exempt:"The DXF exporter converts flattened shape geometry and text; SVG visual library definitions have no entity equivalent."},mermaid:{exempt:"Mermaid represents graph nodes and connectors, not reusable SVG paint, filter, marker, or symbol definitions."},pdf:{by:"The rendered SVG page carries reachable library definitions and their references into the svg2pdf conversion boundary"},"editor-dom":{by:"LibraryRegistry plus gradient, filter, marker, pattern, and symbol managers project reachable definitions into live defs"}}},paintServerDefs:{serialization:{kind:"id-sorted-array"},precision:"opaque",required:!1,collab:{ops:["paintServerDefs:set","paintServerDef:upsert","paintServerDef:remove"]},rendered:{renderToSvg:{by:"renderer/paint-server-defs.ts emits verbatim markup in defs when transitively referenced or marked passthrough"},codegen:{by:"buildRenderPlan paint-server channels carry reachable typed definitions to every component backend"},dxf:{exempt:"Typed SVG paint-server definitions have no DXF entity representation; the exporter operates on shape geometry."},mermaid:{exempt:"Typed SVG paint-server definitions have no Mermaid syntax representation; export operates on graph topology and labels."},pdf:{by:"The rendered SVG page carries reachable typed paint-server definitions into the svg2pdf conversion boundary"},"editor-dom":{by:"PaintServerDef state and definition managers project reachable typed definition markup into live defs"}}},colorGlyphLibrary:{serialization:{kind:"deep-sorted-object"},precision:"opaque",required:!1,collab:{ops:["colorGlyphLibrary:set"]},rendered:{renderToSvg:{exempt:"Font-foundry assets are consumed when emitting an OpenType font binary and have no SVG document representation."},codegen:{exempt:"Font-foundry assets do not belong in embeddable SVG components; generated code references ordinary text and font resources."},dxf:{exempt:"Font-foundry color-glyph assets have no DXF entity representation in the geometry and MTEXT exporter."},mermaid:{exempt:"Font-foundry color-glyph assets have no Mermaid graph-syntax representation and are not graph content."},pdf:{exempt:"Color-glyph source assets back font generation rather than PDF page conversion; rendered text uses the resolved font face."},"editor-dom":{exempt:"Color glyph assets back font-binary generation rather than the editor DOM; text rendering uses the resolved font face."}}},exportItems:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["exportItems:set","exportItem:upsert","exportItem:remove"]},rendered:{renderToSvg:{exempt:"Export profiles are instructions about filenames, formats, and settings, not renderable SVG document content."},codegen:{exempt:"Export profiles configure how code generation is invoked and are not content emitted into a generated component."},dxf:{exempt:"Export profiles configure the editor export workflow; the selected DXF profile is input to invocation, not a DXF entity."},mermaid:{exempt:"Export profiles configure the editor export workflow and are not nodes, connectors, or directives in Mermaid output."},pdf:{exempt:"The selected export profile configures PDF invocation and page settings; it is not content embedded in the PDF page."},"editor-dom":{exempt:"Export profiles configure the export workflow and are intentionally not projected into the live canvas SVG."}}},unknownFields:{serialization:{kind:"unknown-bag"},precision:"opaque",required:!1,collab:{exempt:"Forward-compat quarantine from newer writers; has no ops by definition \u2014 a current client cannot edit a field it does not understand, the DocumentRoom stores raw JSON so the bag rides the seed snapshot, and future clients (the only writers of these fields) carry real ops for them."},rendered:{renderToSvg:{exempt:"Contents are by definition not understood by this build; preservation is pass-through only and rendering them would be a guess."},codegen:{exempt:"Contents are by definition not understood by this build; component generation preserves rather than interprets unknown fields."},dxf:{exempt:"Contents are by definition not understood by this build; DXF conversion cannot safely infer geometry from unknown fields."},mermaid:{exempt:"Contents are by definition not understood by this build; Mermaid export cannot safely infer graph semantics from them."},pdf:{exempt:"Contents are by definition not understood by this build; PDF conversion cannot safely invent a page representation for them."},"editor-dom":{exempt:"Contents are by definition not understood by this build; the editor preserves them without inventing a DOM projection."}}}},fT=["schemaVersion","documentMetadata","documentExtensions","definitionContainers","documentScripts","documentStyles","templateVariables","exportItems","viewboxes","guides","measurements","sceneTree","clipMaskGroups","library","colorGlyphLibrary","paintServerDefs","animationTimeline","unknownFields","shapes"];function oh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pT(e){let t=e,r=t.unknownFields;if(!oh(r))return delete t.unknownFields,e;for(let[n,i]of Object.entries(r))n!=="unknownFields"&&(n in t||(t[n]=i));return delete t.unknownFields,e}function hT(e){let t=e,r=oh(t.unknownFields)?t.unknownFields:void 0;for(let n of Object.keys(t)){if(n==="unknownFields"||n in pa)continue;let i=t[n];delete t[n],i!==void 0&&((r??={})[n]=i)}return r&&Object.keys(r).length>0?t.unknownFields=r:delete t.unknownFields,e}function mT(e){let t=e,r,n=t.unknownFields;if(oh(n))for(let[i,a]of Object.entries(n))i==="unknownFields"||i in pa||a===void 0||((r??={})[i]=a);for(let i of Object.keys(t)){if(i==="unknownFields"||i in pa)continue;let a=t[i];a!==void 0&&((r??={})[i]=a)}return r}var R=(e,t)=>({action:e,by:t}),tr=e=>e,nt="DocumentSerializer canonical snapshot restore",ue="policy-driven SVG plan materializer",hr="policy-driven clipboard plan materializer",Re="policy-driven fragment plan materializer",Ut="SceneGraph hierarchy and source-order projection",s7={schemaVersion:tr({"native-document-open":R("derived","parseDocument migration and schema stamping"),"full-snapshot-restore":R("derived","snapshot migration and schema stamping"),"svg-document-import":R("preserve-host",ue),"illustrator-document-import":R("preserve-host",ue),"pdf-document-import":R("preserve-host",ue),"external-svg-paste":R("preserve-host",ue),"internal-clipboard-paste":R("preserve-host",hr),"plugin-svg-fragment":R("preserve-host",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),shapes:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("append",ue),"illustrator-document-import":R("append",ue),"pdf-document-import":R("append",ue),"external-svg-paste":R("append",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("append","fragment-scoped pattern materializer"),"vectorized-svg-fragment":R("append","path-only vectorized materializer")}),viewboxes:tr({"native-document-open":R("derived",Ut),"full-snapshot-restore":R("derived",Ut),"svg-document-import":R("derived",Ut),"illustrator-document-import":R("derived",Ut),"pdf-document-import":R("derived",Ut),"external-svg-paste":R("derived",Ut),"internal-clipboard-paste":R("derived",Ut),"plugin-svg-fragment":R("derived",Ut),"pattern-fragment":R("derived",Ut),"vectorized-svg-fragment":R("derived",Ut)}),guides:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("preserve-host",ue),"illustrator-document-import":R("preserve-host",ue),"pdf-document-import":R("preserve-host",ue),"external-svg-paste":R("preserve-host",ue),"internal-clipboard-paste":R("preserve-host",hr),"plugin-svg-fragment":R("preserve-host",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),measurements:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("preserve-host",ue),"illustrator-document-import":R("preserve-host",ue),"pdf-document-import":R("preserve-host",ue),"external-svg-paste":R("preserve-host",ue),"internal-clipboard-paste":R("preserve-host",hr),"plugin-svg-fragment":R("preserve-host",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),sceneTree:tr({"native-document-open":R("derived",Ut),"full-snapshot-restore":R("derived",Ut),"svg-document-import":R("derived",Ut),"illustrator-document-import":R("derived",Ut),"pdf-document-import":R("derived",Ut),"external-svg-paste":R("derived",Ut),"internal-clipboard-paste":R("derived",Ut),"plugin-svg-fragment":R("derived",Ut),"pattern-fragment":R("derived",Ut),"vectorized-svg-fragment":R("derived",Ut)}),clipMaskGroups:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("append",ue),"illustrator-document-import":R("append",ue),"pdf-document-import":R("append",ue),"external-svg-paste":R("append",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":R("preserve-host","path-only vectorized materializer")}),documentMetadata:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("replace",ue),"illustrator-document-import":R("replace",ue),"pdf-document-import":R("replace",ue),"external-svg-paste":R("merge",ue),"internal-clipboard-paste":R("preserve-host",hr),"plugin-svg-fragment":R("preserve-host",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),documentExtensions:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("replace",ue),"illustrator-document-import":R("replace",ue),"pdf-document-import":R("replace",ue),"external-svg-paste":R("append",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),definitionContainers:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("append",ue),"illustrator-document-import":R("append",ue),"pdf-document-import":R("append",ue),"external-svg-paste":R("append",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),documentScripts:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("replace",ue),"illustrator-document-import":R("replace",ue),"pdf-document-import":R("replace",ue),"external-svg-paste":R("append",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),documentStyles:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("replace",ue),"illustrator-document-import":R("replace",ue),"pdf-document-import":R("replace",ue),"external-svg-paste":R("merge",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),templateVariables:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("replace",ue),"illustrator-document-import":R("replace",ue),"pdf-document-import":R("replace",ue),"external-svg-paste":R("merge",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),animationTimeline:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("append",ue),"illustrator-document-import":R("append",ue),"pdf-document-import":R("append",ue),"external-svg-paste":R("append",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),library:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("append",ue),"illustrator-document-import":R("append",ue),"pdf-document-import":R("append",ue),"external-svg-paste":R("append",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":R("preserve-host","path-only vectorized materializer")}),paintServerDefs:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("append",ue),"illustrator-document-import":R("append",ue),"pdf-document-import":R("append",ue),"external-svg-paste":R("append",ue),"internal-clipboard-paste":R("append",hr),"plugin-svg-fragment":R("append",Re),"pattern-fragment":R("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":R("preserve-host","path-only vectorized materializer")}),colorGlyphLibrary:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("preserve-host",ue),"illustrator-document-import":R("preserve-host",ue),"pdf-document-import":R("preserve-host",ue),"external-svg-paste":R("preserve-host",ue),"internal-clipboard-paste":R("preserve-host",hr),"plugin-svg-fragment":R("preserve-host",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),exportItems:tr({"native-document-open":R("replace",nt),"full-snapshot-restore":R("replace",nt),"svg-document-import":R("preserve-host",ue),"illustrator-document-import":R("preserve-host",ue),"pdf-document-import":R("preserve-host",ue),"external-svg-paste":R("preserve-host",ue),"internal-clipboard-paste":R("preserve-host",hr),"plugin-svg-fragment":R("preserve-host",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)}),unknownFields:tr({"native-document-open":R("replace","forward-compatible quarantine restore"),"full-snapshot-restore":R("replace","forward-compatible quarantine restore"),"svg-document-import":R("preserve-host",ue),"illustrator-document-import":R("preserve-host",ue),"pdf-document-import":R("preserve-host",ue),"external-svg-paste":R("preserve-host",ue),"internal-clipboard-paste":R("preserve-host",hr),"plugin-svg-fragment":R("preserve-host",Re),"pattern-fragment":R("preserve-host",Re),"vectorized-svg-fragment":R("preserve-host",Re)})};function gT(e){if(e instanceof Map)return e;let t=new Map;for(let r of e)t.set(r.id,r);return t}function yT(e){if(e.kind==="marker")return e.shapes;if(e.kind!=="symbol")return[];if(!e.variants)return e.shapes;let t=[...e.shapes];for(let r of Object.values(e.variants))t.push(...r);return t}function dx(e,t,r,n){let i=gT(r),a=new Set,o=[],s=[],l=c=>{if(typeof c!="string"||!c||a.has(c))return;let f=i.get(c);f&&(f.kind!=="symbol"&&f.kind!=="marker"||(a.add(c),o.push(f)))},u=c=>{s.push(c)},d=c=>{let f=c.state;if(!f)return;l(f.symbolId),l(f.markerStart),l(f.markerMid),l(f.markerEnd);let p=f.textPathReference;p&&typeof p=="object"&&!Array.isArray(p)&&p.kind==="definition"&&l(p.targetId);let h=f.children;if(Array.isArray(h))for(let g of h)u(g);let m=f.symbolOverrides;if(m&&typeof m=="object"&&!Array.isArray(m))for(let[g,v]of Object.entries(m))!v||typeof v!="object"||Array.isArray(v)||u({id:g,type:"symbol-override",state:v})};for(let c of e)u(c);for(let c of t)l(c);for(;;){let c=s.shift();if(c){n(c),d(c);continue}let f=o.shift();if(!f)break;if(f.kind==="symbol")for(let p of f.definitionContentOrder??[])p.kind==="definition"&&l(p.id);for(let p of yT(f))u(p)}}var vT=[],bT=[];function cx(e,t,r){dx(e,bT,t,r)}function xT(e,t,r){dx(vT,e,t,r)}function fx(e,t=[]){let r=new Set,n=new Set;return cx(e,t,i=>{let a=i.state;if(!a)return;typeof a.markerStart=="string"&&a.markerStart&&r.add(a.markerStart),typeof a.markerMid=="string"&&a.markerMid&&r.add(a.markerMid),typeof a.markerEnd=="string"&&a.markerEnd&&r.add(a.markerEnd);let o=a.startEndpoint,s=a.endEndpoint;typeof o=="string"&&o&&o!=="none"&&!a.markerStart&&n.add(o),typeof s=="string"&&s&&s!=="none"&&!a.markerEnd&&n.add(s)}),{ids:r,legacyEndpoints:n}}var ye="http://www.w3.org/2000/svg",Ky=class extends Error{constructor(e,t,r){super(t),this.hostId=e,this.name="SvgXmlParserHostError",this.cause=r}hostId;cause};function Nf(e,t){let r=null;for(let n=t;n<e.length;n++){let i=e[n];if(r){i===r&&(r=null);continue}if(i==='"'||i==="'")r=i;else if(i===">")return n+1}return e.length}function wT(e){let t=0,r=e.toLowerCase(),n=[];for(;t<e.length;){let o=e.indexOf("<",t);if(o<0)break;if(e.startsWith("<!--",o)){let p=e.indexOf("-->",o+4);if(p<0)break;t=p+3;continue}if(e.startsWith("<![CDATA[",o)){let p=e.indexOf("]]>",o+9);if(p<0)break;t=p+3;continue}if(e.startsWith("<?",o)){let p=e.indexOf("?>",o+2);if(p<0)break;t=p+2;continue}let s=Nf(e,o+1),l=/^<\s*([^\s/>]+)/.exec(e.slice(o,s))?.[1]??"";if(l.split(":").at(-1)?.toLowerCase()!=="style"||e.slice(o,s).startsWith("</")){t=s;continue}let u=`</${l.toLowerCase()}`,d=r.indexOf(u,s);if(d<0)break;let c=e.slice(s,d);if(!c.includes("<")||c.includes("<![CDATA[")){t=Nf(e,d+2);continue}let f=`<![CDATA[${c.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;n.push({start:s,end:d,value:f}),t=Nf(e,d+2)}if(n.length===0)return e;let i="",a=0;for(let o of n)i+=e.slice(a,o.start),i+=o.value,a=o.end;return i+e.slice(a)}var IT=256,kT=64*1024,ST=32*1024*1024,sh=String.raw`[\p{L}_:][\p{L}\p{N}\p{M}_.:\-]*`,$T=new RegExp(`^${sh}$`,"u"),NT="http://www.w3.org/1999/xlink",MT=/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu,AT=/(?:^|;)\s*([^\s;]+?)\.(?:begin|end|repeat\(\d+\))/gu,CT=new Set(["aria-labelledby","aria-describedby"]),OT=new RegExp(String.raw`<!ENTITY\s+(?!%)(${sh})\s+(?:"([^"]*)"|'([^']*)')\s*>`,"gu"),Zy=new RegExp(String.raw`&(#x[0-9A-Fa-f]+|#[0-9]+|${sh});`,"gu"),TT=Object.freeze({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});function PT(e){let t=e.startsWith("#x")?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===13||t>=32&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111?String.fromCodePoint(t):null}function DT(e,t,r){let n=new Map;for(let s of t.matchAll(OT)){if(n.size>=IT)return;n.set(s[1],s[2]??s[3]??"")}let i=new Map,a=(s,l)=>{let u=TT[s];if(u!==void 0)return u;let d=i.get(s);if(d!==void 0)return d;let c=n.get(s);if(c===void 0||l.has(s))return null;let f=new Set(l);f.add(s);let p=!0,h=c.replace(Zy,(m,g)=>{let v=g.startsWith("#")?PT(g):a(g,f);return v===null?(p=!1,""):v});return!p||h.length>kT?null:(i.set(s,h),h)};for(let s of n.keys())a(s,new Set);let o=0;for(let s of r.matchAll(Zy)){let l=i.get(s[1]);if(l!==void 0&&(o+=l.length,o>ST))return}for(let[s,l]of i)e.ENTITIES[s]=l}function hx(e){return e&&e.length>0?e:null}function jT(e,t){return{name:e.name,localName:e.local,prefix:e.prefix.length>0?e.prefix:null,namespaceUri:hx(e.uri),value:e.value,span:t}}var mx={id:"saxes",parse(e){let t=[],r=[],n=[],i=0,a=[],o=0,s=0,l=new px.SaxesParser({xmlns:!0,position:!0}),u=c=>{let f=r.at(-1);f?f.children.push(c):t.push(c)};l.on("error",c=>{n.push(c.message)}),l.on("opentagstart",()=>{i=e.lastIndexOf("<",Math.max(0,l.position-1)),a=[],o=l.position;let c=r.at(-1);c?c.contentOffset=i:s=i}),l.on("attribute",c=>{let f=e.indexOf(c.name,o),p=f>=0&&f<l.position?f:o;a.push({start:p,end:l.position}),o=l.position}),l.on("opentag",c=>{let f=Object.values(c.attributes).map((h,m)=>jT(h,a[m]??{start:i,end:l.position})),p={kind:"element",name:c.name,localName:c.local,prefix:c.prefix.length>0?c.prefix:null,namespaceUri:hx(c.uri),attributes:f,children:[],span:{start:i,end:l.position},startOffset:i,contentOffset:l.position};u(p),r.push(p)}),l.on("closetag",()=>{let c=r.pop();if(!c)return;c.rawXml=e.slice(c.startOffset,l.position),c.span.end=l.position;let f=r.at(-1);f?f.contentOffset=l.position:s=l.position});let d=(c,f,p,h)=>{u({kind:c,value:f,span:{start:p,end:h}});let m=r.at(-1);m?m.contentOffset=h:s=h};l.on("text",c=>{let f=r.at(-1)?.contentOffset??s,p=e.lastIndexOf("<",Math.max(0,l.position-1)),h=p>=f?p:l.position;d("text",c,f,h)}),l.on("comment",c=>{let f=e.lastIndexOf("<!--",l.position),p=e.indexOf("-->",Math.max(0,f));d("comment",c,Math.max(0,f),p>=0?p+3:l.position)}),l.on("cdata",c=>{let f=e.lastIndexOf("<![CDATA[",l.position),p=e.indexOf("]]>",Math.max(0,f));d("cdata",c,Math.max(0,f),p>=0?p+3:l.position)}),l.on("processinginstruction",({target:c,body:f})=>{let p=e.lastIndexOf("<?",l.position),h=e.indexOf("?>",Math.max(0,p));d("processing-instruction",f.length>0?`${c} ${f}`:c,Math.max(0,p),h>=0?h+2:l.position)}),l.on("doctype",c=>{DT(l,c,e);let f=e.lastIndexOf("<!DOCTYPE",l.position),p=e.indexOf(">",Math.max(0,f));d("doctype",c,Math.max(0,f),p>=0?p+1:l.position)});try{l.write(e).close()}catch(c){n.push(c instanceof Error?c.message:String(c))}return n.length>0?{error:n[0]}:{nodes:t}}};function Jy(e,t,r){return{severity:"error",code:t,source:e.source,entrypoint:e.entrypoint,message:r,documentPath:"/",elementName:"svg"}}function Mf(e,t,r,n){return{severity:"warning",code:t,source:e.source,entrypoint:e.entrypoint,message:r,capability:"source-envelope",...n}}function fp(e,t,r){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===r)??null}function yr(e){let t=fp(e,"href",null);if(t)return{value:t.value,namespace:"svg2"};let r=fp(e,"href",NT);return r?{value:r.value,namespace:"xlink"}:null}var ET="http://www.w3.org/XML/1998/namespace";function zT(e,t,r){let n=r.indexOf(":");if(n<0)return{namespaceUri:null,localName:r};let i=r.slice(0,n),a=r.slice(n+1);if(i.length===0||a.length===0)return null;if(i==="xml")return{namespaceUri:ET,localName:a};let o=t;for(;o;){let s=o.attributes.find(l=>l.prefix==="xmlns"&&l.localName===i);if(s)return s.value.length>0?{namespaceUri:s.value,localName:a}:null;o=e.index.parent(o.sourceNodeId)}return null}function gx(e,t){let r=e.index.parent(t.sourceNodeId);for(;r;){if(r.namespaceUri!==ye||r.localName.toLowerCase()==="foreignobject")return!0;r=e.index.parent(r.sourceNodeId)}return!1}function _T(e){let t=[...e.children].reverse(),r="";for(;t.length>0;){let n=t.pop();n.kind==="text"||n.kind==="cdata"?r+=n.value:n.kind==="element"&&t.push(...[...n.children].reverse())}return r}function RT(e,t){let r=t.filter(h=>h.kind==="element"),n=new Map(r.map(h=>[h.sourceNodeId,h])),i=new Map,a=new Map,o=new Map,s=(h,m)=>{o.set(h.sourceNodeId,m);let g=h.children.filter(y=>y.kind==="element");a.set(h.sourceNodeId,Object.freeze(g));let v=new Map;for(let y of g){i.set(y.sourceNodeId,h);let b=(v.get(y.name)??0)+1;v.set(y.name,b),s(y,`${m}/${y.name}[${b}]`)}};s(e,`/${e.name}[1]`);let l=new Map,u=[];for(let h of r){let m=fp(h,"id",null)?.value;if(m===void 0)continue;let g=l.get(m)??[],v=Object.freeze({authoredId:m,sourceNodeId:h.sourceNodeId,elementOrder:h.elementOrder,occurrenceIndex:g.length,primary:g.length===0,validXmlId:m.length>0&&!/\s/u.test(m)&&$T.test(m)});g.push(v),l.set(m,g),u.push(v)}let d=[],c=new Map,f=(h,m,g,v,y)=>{let b=l.get(v)??[],I=Object.freeze({sourceReferenceId:`reference:${d.length}`,fromSourceNodeId:h.sourceNodeId,channel:m,...y!==void 0?{attributeName:y}:{},authoredValue:g,targetAuthoredId:v,targetSourceNodeId:b[0]?.sourceNodeId??null,resolution:b.length===0?"missing":b.length===1?"resolved":"ambiguous-first"});d.push(I);let x=c.get(h.sourceNodeId)??[];x.push(I),c.set(h.sourceNodeId,x)},p=(h,m,g,v)=>{for(let y of g.matchAll(MT))f(h,m,g,y[2],v)};for(let h of r){let m=yr(h);m?.value.startsWith("#")&&m.value.length>1&&f(h,m.namespace==="svg2"?"href":"xlink-href",m.value,m.value.slice(1),m.namespace==="svg2"?"href":"xlink:href"),h.localName.toLowerCase()==="style"&&p(h,"stylesheet-url",_T(h));for(let g of h.attributes)if(g.namespaceUri===null){if(g.localName==="style"?p(h,"inline-style-url",g.value,g.name):g.value.includes("url(")&&p(h,"presentation-url",g.value,g.name),g.localName==="begin"||g.localName==="end")for(let v of g.value.matchAll(AT))f(h,"smil-syncbase",g.value,v[1],g.name);if(CT.has(g.localName))for(let v of g.value.trim().split(/\s+/u).filter(Boolean))f(h,"idref-list",g.value,v,g.name)}}for(let h of l.values())Object.freeze(h);for(let h of c.values())Object.freeze(h);return Object.freeze(r),Object.freeze(u),Object.freeze(d),Object.freeze({elements:r,idOccurrences:u,localReferences:d,element(h){return n.get(h)??null},parent(h){return i.get(h)??null},children(h){return a.get(h)??Object.freeze([])},sourcePath(h){return o.get(h)??"/"},occurrences(h){return l.get(h)??Object.freeze([])},resolveAuthoredId(h){return l.get(h)?.[0]??null},referencesFrom(h){return c.get(h)??Object.freeze([])}})}function FT(e){let t=r=>{if(!(r===null||typeof r!="object"||Object.isFrozen(r))){for(let n of Object.values(r))t(n);Object.freeze(r)}};return t(e),e}function Td(e,t,r=mx){let n=wT(e),i;try{i=r.parse(n)}catch(y){throw new Ky(r.id,`SVG XML parser host ${r.id} failed.`,y)}if(i===null||typeof i!="object"||!("error"in i)&&!("nodes"in i))throw new Ky(r.id,`SVG XML parser host ${r.id} returned no result.`);if("error"in i)return{value:null,diagnostics:[Jy(t,"malformed-source",`SVG XML parsing failed: ${i.error}`)]};let a=i.nodes.find(y=>y.kind==="element"),o=a?.namespaceUri===ye||a?.namespaceUri===null;if(!a||a.localName!=="svg"||!o)return{value:null,diagnostics:[Jy(t,"missing-svg-root","The XML document element is not an SVG root in the SVG namespace.")]};let s=a.namespaceUri===null,l=[],u=0,d=0,c=y=>{let b=u++,I=`source:${b}`;if(y.kind!=="element"){let A={kind:y.kind,sourceNodeId:I,documentOrder:b,value:y.value,span:y.span};return l.push(A),A}let x=d++,k=[],$={kind:"element",sourceNodeId:I,documentOrder:b,elementOrder:x,name:y.name,localName:y.localName,prefix:y.prefix,namespaceUri:s&&y.namespaceUri===null?ye:y.namespaceUri,attributes:y.attributes.map(A=>({...A})),children:k,span:y.span,...y.rawXml!==void 0?{rawXml:y.rawXml}:{}};return l.push($),k.push(...y.children.map(c)),$},f=null,p=i.nodes.map(y=>{let b=c(y);return y===a&&(f=b),b});if(!f)throw new Error("The validated SVG document element was not projected.");let h=RT(f,l),m=new Map;for(let y of h.idOccurrences){let b=m.get(y.authoredId)??[];b.push(y.sourceNodeId),m.set(y.authoredId,b)}let g=Object.freeze(Object.fromEntries([...m].map(([y,b])=>[y,Object.freeze(b)]))),v=[];s&&v.push(Mf(t,"missing-svg-namespace","The namespace-less SVG root and its unnamespaced descendants were adopted into the SVG namespace as compatibility input; authored SVG should declare the SVG namespace.",{documentPath:"/svg[1]",elementName:"svg"}));for(let[y,b]of m){let I=h.occurrences(y);if(I.length>1&&v.push(Mf(t,"duplicate-svg-id",`SVG id ${JSON.stringify(y)} occurs ${b.length} times; references resolve to the first element-order occurrence.`,{documentPath:I.map(x=>h.sourcePath(x.sourceNodeId)).join(", "),elementName:h.element(I[0].sourceNodeId)?.name??"svg",sourceId:y})),I.some(x=>!x.validXmlId)){let x=I.find(k=>!k.validXmlId);v.push(Mf(t,"invalid-svg-attribute",`SVG id ${JSON.stringify(y)} is not a non-empty XML Name without whitespace; it remains available for exact first-element reference processing.`,{documentPath:h.sourcePath(x.sourceNodeId),elementName:h.element(x.sourceNodeId)?.name??"svg",sourceId:y}))}}return{value:FT({root:f,documentNodes:p,nodes:l,idIndex:g,index:h,rawSource:e,parserSource:n}),diagnostics:v}}function j(e,t){return e.attributes.find(r=>r.namespaceUri===null&&r.localName===t)?.value??null}function ji(e,t){return e.attributes.some(r=>r.namespaceUri===null&&r.localName===t)}var _u=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="SvgSourceDecodingError"}cause},yx=/^<\?xml\s+[\s\S]*?\?>/i,vx=/\sencoding\s*=\s*(['"])([^'"]+)\1/i;function LT(){let e=globalThis.TextDecoder;if(!e)throw new _u("The current platform does not provide the Encoding Standard TextDecoder API.");return e}function BT(e){return e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191?"utf-8":e.length>=2&&e[0]===255&&e[1]===254?"utf-16le":e.length>=2&&e[0]===254&&e[1]===255?"utf-16be":e.length>=4&&e[0]===60&&e[1]===0&&e[2]===63&&e[3]===0?"utf-16le":e.length>=4&&e[0]===0&&e[1]===60&&e[2]===0&&e[3]===63?"utf-16be":null}function VT(e){let t="",r=Math.min(e.length,512);for(let n=0;n<r;n++){let i=e[n];if(i>127)break;t+=String.fromCharCode(i)}return t.match(yx)?.[0]?.match(vx)?.[2].trim().toLowerCase()??null}function UT(e){return e.match(yx)?.[0]?.match(vx)?.[2].trim().toLowerCase()??null}function GT(e,t){let r=e.toLowerCase(),n=t.toLowerCase();return r===n||n==="utf-16"&&(r==="utf-16le"||r==="utf-16be")}function XT(e){let t=BT(e)??VT(e)??"utf-8",r=LT(),n;try{n=new r(t,{fatal:!0,ignoreBOM:!1})}catch(o){throw new _u(`Unsupported SVG XML encoding "${t}".`,o)}let i;try{i=n.decode(e)}catch(o){throw new _u(`The SVG byte stream is not valid ${n.encoding} text.`,o)}i.charCodeAt(0)===65279&&(i=i.slice(1));let a=UT(i);if(a&&!GT(n.encoding,a))throw new _u(`The SVG XML declaration specifies "${a}" but the byte stream is ${n.encoding}.`);return{text:i,encoding:n.encoding}}var pu="[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?",WT=new RegExp(`^\\s*(${pu})(?:\\s*,\\s*|\\s+)(${pu})(?:\\s*,\\s*|\\s+)(${pu})(?:\\s*,\\s*|\\s+)(${pu})\\s*$`);function Mn(e){let t=WT.exec(e);if(!t)return null;let[r,n,i,a]=t.slice(1).map(Number);return[r,n,i,a].every(Number.isFinite)?{x:r,y:n,width:i,height:a}:null}function HT(e){return e==="none"||/^x(Min|Mid|Max)Y(Min|Mid|Max)$/.test(e)}function lh(e){if(e==null)return{align:"xMidYMid",meetOrSlice:"meet"};let t=e.trim().split(/\s+/).filter(Boolean);return t.length<1||t.length>2||!HT(t[0])||t.length===2&&t[1]!=="meet"&&t[1]!=="slice"?{align:"xMidYMid",meetOrSlice:"meet"}:{align:t[0],meetOrSlice:t[1]==="slice"?"slice":"meet"}}function Qy(e,t){return e==="none"?0:t==="x"?e.includes("xMax")?1:e.includes("xMid")?.5:0:e.includes("YMax")?1:e.includes("YMid")?.5:0}function e0(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function t0(e,t,r,n){return e==null?t??null:!Number.isFinite(e)||e<0?(n.push({code:"invalid-viewport-length",message:`Nested SVG ${r} ${String(e)} is invalid and falls back to auto (100%).`}),t??null):e}function qT(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0}function YT(e){let t=["viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight"],r=t.filter(n=>qT(e,n));return r.length===0?"absent":r.length!==t.length||!t.map(n=>e[n]).every(n=>typeof n=="number"&&Number.isFinite(n))?"partial":e.viewBoxWidth<0||e.viewBoxHeight<0?"negative-invalid":e.viewBoxWidth===0||e.viewBoxHeight===0?"zero-disabled":"valid"}function KT(e,t,r){let{align:n,meetOrSlice:i}=lh(r),a=e.width/t.viewBoxWidth,o=e.height/t.viewBoxHeight,s=e.x-t.viewBoxX*a,l=e.y-t.viewBoxY*o;if(n!=="none"){let u=i==="slice"?Math.max(a,o):Math.min(a,o),d=t.viewBoxWidth*u,c=t.viewBoxHeight*u;a=u,o=u,s=e.x+(e.width-d)*Qy(n,"x")-t.viewBoxX*u,l=e.y+(e.height-c)*Qy(n,"y")-t.viewBoxY*u}return Qr(a,0,0,o,s,l)}function pp(e,t){let r=[],n=e0(e.x,0),i=e0(e.y,0),a=t0(e.width,t?.width,"width",r),o=t0(e.height,t?.height,"height",r),s=a===null||o===null?null:{x:n,y:i,width:a,height:o},l=YT(e);if((a===0||o===0)&&(l="zero-disabled"),l==="zero-disabled")return{status:l,renders:!1,frame:s,contentMatrix:null,childPercentBasis:null,diagnostics:r};if(l==="partial"?r.push({code:"invalid-viewbox",message:"Nested SVG viewBox is partial or non-finite and is ignored."}):l==="negative-invalid"&&r.push({code:"invalid-viewbox",message:"Nested SVG viewBox has a negative dimension and is ignored."}),l!=="valid")return{status:l,renders:!0,frame:s,contentMatrix:Qr(1,0,0,1,n,i),childPercentBasis:s?{width:s.width,height:s.height}:null,diagnostics:r};if(!s)return r.push({code:"unresolved-viewport-size",message:"Nested SVG with a valid viewBox needs a parent viewport to resolve auto dimensions."}),{status:l,renders:!1,frame:null,contentMatrix:null,childPercentBasis:null,diagnostics:r};let u={viewBoxX:e.viewBoxX,viewBoxY:e.viewBoxY,viewBoxWidth:e.viewBoxWidth,viewBoxHeight:e.viewBoxHeight};return{status:l,renders:!0,frame:s,contentMatrix:KT(s,u,e.preserveAspectRatio),childPercentBasis:{width:u.viewBoxWidth,height:u.viewBoxHeight},diagnostics:r}}var ZT=new Set(["animate","animatetransform","animatemotion","set"]),JT="http://www.w3.org/1999/xlink";function r0(e,t){let r=j(e,"style");if(r){let n=r.replace(/\/\*[\s\S]*?\*\//g,""),i=new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]*)`,"gi"),a=null,o;for(;(o=i.exec(n))!==null;)a=o[1];if(a!==null){let s=a.replace(/\s*!\s*important\s*$/i,"").trim(),l=Dr(s);if(l&&l.value>=0&&(l.unit!==""||l.value===0))return s}}return j(e,t)}function QT(e,t){return{severity:"warning",code:"invalid-svg-attribute",source:e.source,entrypoint:e.entrypoint,message:t,documentPath:"/svg[1]/@viewBox",elementName:"svg",capability:"root-viewport-frame"}}function bx(e){for(let t of e.children)if(t.kind==="element"&&(t.localName.toLowerCase()==="view"||bx(t)))return!0;return!1}function eP(e,t){let r=e.attributes.find(i=>i.localName==="href"&&(i.namespaceUri===null||i.namespaceUri===JT))?.value;if(r===void 0)return!0;let n=j(t,"id");return n!==null&&r===`#${n}`}function tP(e,t){let r=[],n=r0(e,"width"),i=r0(e,"height"),a=n===null?null:Dr(n),o=i===null?null:Dr(i),s=a&&a.value>=0?n.trim():void 0,l=o&&o.value>=0?i.trim():void 0,u=si(n),d=si(i),c=u!==void 0&&u>=0?u:void 0,f=d!==void 0&&d>=0?d:void 0,p=j(e,"preserveAspectRatio"),h=p&&p.trim().length>0?p.trim():void 0,m=ji(e,"viewBox"),g=j(e,"viewBox"),v=g!==null?Mn(g):null,y=v!==null&&v.width>=0&&v.height>=0?v:null;m&&!y&&r.push(QT(t,`Root SVG viewBox ${JSON.stringify(g)} is invalid per SVG 2 section 8.6 and was ignored.`));let b=e.children.some(S=>S.kind==="element"&&ZT.has(S.localName.toLowerCase())&&eP(S,e)),I=y!==null||b||bx(e);if(y)return{value:{viewBoxX:y.x,viewBoxY:y.y,viewBoxWidth:y.width,viewBoxHeight:y.height,...c!==void 0?{width:c}:{},...f!==void 0?{height:f}:{},...s!==void 0?{authoredWidth:s}:{},...l!==void 0?{authoredHeight:l}:{},...h!==void 0?{preserveAspectRatio:h}:{},sizingMode:"explicit",targetedPasteWrapper:I},diagnostics:r};let x=c!==void 0,k=f!==void 0,$=x?c:300,A=k?f:150;return{value:{viewBoxX:0,viewBoxY:0,viewBoxWidth:$,viewBoxHeight:A,...x||k?{width:$,height:A}:{},...s!==void 0?{authoredWidth:s}:{},...l!==void 0?{authoredHeight:l}:{},...h!==void 0?{preserveAspectRatio:h}:{},sizingMode:x||k?"sized":"implicit",targetedPasteWrapper:I},diagnostics:r}}function rP(e){let t=e.viewBoxWidth??300,r=e.viewBoxHeight??150,n=e.width??(e.height!==void 0&&r>0?e.height*t/r:t),i=e.height??(e.width!==void 0&&t>0?e.width*r/t:r);return{width:n,height:i}}function nP(e){return e.localName.toLowerCase()==="view"&&e.namespaceUri===ye}function iP(e,t,r,n){let i=j(t,"id");return{severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,message:`SVG viewBox ${JSON.stringify(n)} is invalid per SVG 2 section 8.6 and the view was ignored.`,documentPath:`${e.index.sourcePath(t.sourceNodeId)}/@viewBox`,elementName:"view",...i?{sourceId:i}:{},sourceNodeId:t.sourceNodeId,capability:"views"}}function aP(e){return Object.freeze(e.state),Object.freeze(e)}function oP(e,t){let r=[],n=[];for(let i of e.index.elements){if(!nP(i))continue;let a=j(i,"viewBox");if(a===null||a.trim().length===0)continue;let o=Mn(a);if(!o||o.width<0||o.height<0){n.push(iP(e,i,t,a));continue}let s={viewName:j(i,"id")??"",viewBoxX:o.x,viewBoxY:o.y,viewBoxWidth:o.width,viewBoxHeight:o.height},l=j(i,"preserveAspectRatio");l&&(s.viewPreserveAspectRatio=l);let u=j(i,"zoomAndPan");(u==="disable"||u==="magnify")&&(s.viewZoomAndPan=u);let d=j(i,"viewTarget");d&&(s.viewTarget=d),r.push(aP({sourceNodeId:i.sourceNodeId,elementOrder:i.elementOrder,parentSourceNodeId:e.index.parent(i.sourceNodeId)?.sourceNodeId??null,state:s}))}return{value:Object.freeze(r),diagnostics:Object.freeze(n.map(i=>Object.freeze(i)))}}function sP(e){return e.localName.toLowerCase()==="svg"&&e.namespaceUri===ye}function lP(e,t){let r=j(e,"style");if(!r)return null;let n=null;for(let i of da(r,";")){let[a,...o]=da(i,":");if(a?.trim().toLowerCase()!==t.toLowerCase())continue;let s=o.join(":").trim(),l=/\s*!\s*important\s*$/iu.test(s),u=s.replace(/\s*!\s*important\s*$/iu,"").trim();(!n||l||!n.important)&&(n={value:u,important:l})}return n}function uP(e,t){let r=e.index.parent(t.sourceNodeId);for(;r;){let n=si(lP(r,"font-size")?.value??null);if(n!==void 0)return n;let i=si(j(r,"font-size"));if(i!==void 0)return i;r=e.index.parent(r.sourceNodeId)}return 16}function xx(e,t,r,n,i){let a=j(t,"id");return{severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,message:`Embedded SVG ${n} ${JSON.stringify(i)} is invalid and was ignored.`,documentPath:`${e.index.sourcePath(t.sourceNodeId)}/@${n}`,elementName:"svg",...a?{sourceId:a}:{},sourceNodeId:t.sourceNodeId,capability:"embedded-svg"}}function hu(e,t,r,n,i,a){if(!ji(t,r))return;let o=j(t,r)??"",s={percentBasis:r==="x"||r==="width"?n.width:n.height,viewportWidth:n.width,viewportHeight:n.height,fontSize:uP(e,t),rootFontSize:16},l=it(o,s),u=(r==="width"||r==="height")&&(l??0)<0;if(l===void 0||u){a.push(xx(e,t,i,r,o));return}return l}function dP(e,t,r,n){let i=[],a=[];for(let o of e.index.elements){if(!sP(o)||o.sourceNodeId===e.root.sourceNodeId)continue;let s=t.direct(o.sourceNodeId);if(!s)throw new Error(`Embedded SVG ${o.sourceNodeId} has no occurrence.`);let l=r.viewport(s.occurrenceId);if(!l)throw new Error(`Embedded SVG ${o.sourceNodeId} has no viewport context.`);let u={},d=hu(e,o,"x",l,n,a),c=hu(e,o,"y",l,n,a),f=hu(e,o,"width",l,n,a),p=hu(e,o,"height",l,n,a);d!==void 0&&(u.svgX=d),c!==void 0&&(u.svgY=c),f!==void 0&&(u.svgWidth=f),p!==void 0&&(u.svgHeight=p);let h=j(o,"viewBox"),m=h===null?null:Mn(h),g=m&&m.width>=0&&m.height>=0?m:null;h!==null&&!g&&a.push(xx(e,o,n,"viewBox",h)),g&&(u.svgViewBoxX=g.x,u.svgViewBoxY=g.y,u.svgViewBoxWidth=g.width,u.svgViewBoxHeight=g.height),ji(o,"preserveAspectRatio")&&(u.svgPreserveAspectRatio=j(o,"preserveAspectRatio")??""),Object.freeze(u),i.push(Object.freeze({sourceNodeId:o.sourceNodeId,elementOrder:o.elementOrder,parentSourceNodeId:e.index.parent(o.sourceNodeId)?.sourceNodeId??null,state:u}))}return{value:Object.freeze(i),diagnostics:Object.freeze(a.map(o=>Object.freeze(o)))}}function cP(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=e[n]-t[n];if(i!==0)return i}return e.length-t.length}function Af(e,t){return cP(e.orderKey,t.orderKey)||e.productIndex-t.productIndex||e.occurrenceId.localeCompare(t.occurrenceId)}function fP(e,t,r){if(r.namespaceUri!==ye||gx(e,r))return null;let n=r.localName.toLowerCase();return n==="g"?"group":n==="a"?"hyperlink":n==="switch"?"switch":n!=="svg"||t.usePath.length===0&&r.sourceNodeId===e.root.sourceNodeId?null:"embedded-svg"}function n0(e,t,r,n,i,a){return Object.freeze({severity:"warning",code:i,source:n.source,entrypoint:n.entrypoint,capability:i==="empty-hyperlink-dropped"?"containers":"hierarchy",sourceId:j(r,"id")??void 0,sourceNodeId:r.sourceNodeId,occurrenceId:t.occurrenceId,elementName:r.name,documentPath:e.index.sourcePath(r.sourceNodeId),message:a})}function pP(e,t,r){let n=new Map(t.occurrences.map(g=>[g.occurrenceId,g])),i=new Map,a=new Map;for(let g of t.occurrences){let v=e.index.element(g.correspondingSourceNodeId);if(!v)throw new Error(`SVG occurrence ${g.occurrenceId} has no source element.`);i.set(g.occurrenceId,v);let y=fP(e,g,v);y&&a.set(g.occurrenceId,y)}let o=[],s=new Set;for(let g of r.materializedOccurrenceIds){if(s.has(g))continue;s.add(g);let v=n.get(g);if(!v)throw new Error(`Unknown materialized SVG occurrence ${g}.`);if(v.role==="definition")throw new Error(`Definition occurrence ${g} cannot be materialized in the scene.`);o.push(v)}o.sort(Af);for(let g of o){let v=g.parentOccurrenceId,y=new Set;for(;v;){if(y.has(v))throw new Error(`SVG occurrence ancestry contains a cycle at ${v}.`);y.add(v);let b=n.get(v);if(!b)throw new Error(`SVG occurrence ${g.occurrenceId} has unknown parent ${v}.`);b.role==="use-carrier"&&a.set(v,"group"),v=b.parentOccurrenceId}}let l=new Set;for(let g of t.occurrences)a.get(g.occurrenceId)==="group"&&l.add(g.occurrenceId);for(let g of o){let v=g.parentOccurrenceId,y=new Set;for(;v;){if(y.has(v))throw new Error(`SVG occurrence ancestry contains a cycle at ${v}.`);y.add(v);let b=n.get(v);if(!b)throw new Error(`SVG occurrence ${g.occurrenceId} has unknown parent ${v}.`);a.has(v)&&l.add(v),v=b.parentOccurrenceId}}let u=[],d=new Set,c=[...l].map(g=>n.get(g)).sort(Af),f=g=>{let v=g.parentOccurrenceId,y=new Set;for(;v;){if(y.has(v))return!1;y.add(v);let b=n.get(v);if(!b)return!1;if(a.get(v)==="hyperlink")return!0;v=b.parentOccurrenceId}return!1};for(let g of c){if(a.get(g.occurrenceId)==="hyperlink"&&f(g)){let v=i.get(g.occurrenceId);u.push(n0(e,g,v,r,"nested-hyperlink-flattened","Nested SVG hyperlinks are invalid; the inner hyperlink was flattened."));continue}d.add(g.occurrenceId)}for(let g of t.occurrences){if(a.get(g.occurrenceId)!=="hyperlink"||l.has(g.occurrenceId)||f(g))continue;let v=i.get(g.occurrenceId);u.push(n0(e,g,v,r,"empty-hyperlink-dropped","The SVG hyperlink has no materializable content and was dropped."))}let p=g=>{let v=g.parentOccurrenceId,y=new Set;for(;v;){if(y.has(v))throw new Error(`SVG occurrence ancestry contains a cycle at ${v}.`);if(y.add(v),d.has(v))return v;let b=n.get(v);if(!b)throw new Error(`SVG occurrence ${g.occurrenceId} has unknown parent ${v}.`);v=b.parentOccurrenceId}return null},h=c.filter(g=>d.has(g.occurrenceId)).map(g=>Object.freeze({occurrenceId:g.occurrenceId,sourceNodeId:g.correspondingSourceNodeId,kind:a.get(g.occurrenceId),parentContainerOccurrenceId:p(g),orderKey:Object.freeze([...g.orderKey])})),m=o.map(g=>Object.freeze({occurrenceId:g.occurrenceId,sourceNodeId:g.correspondingSourceNodeId,parentContainerOccurrenceId:p(g),orderKey:Object.freeze([...g.orderKey])}));return u.sort((g,v)=>{let y=g.occurrenceId?n.get(g.occurrenceId):void 0,b=v.occurrenceId?n.get(v.occurrenceId):void 0;return!y||!b?0:Af(y,b)}),Object.freeze({value:Object.freeze({containers:Object.freeze(h),placements:Object.freeze(m)}),diagnostics:Object.freeze(u)})}var hP="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",mP="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd",gP="http://www.inkscape.org/namespaces/inkscape",yP="https://boxy-svg.com";function mu(e){if(e===void 0)return null;let t=Number(e);return Number.isFinite(t)?t:null}var vP=["cx","cy","rx","ry"];function bP(e){if(e.get("type")!=="arc"||e.has("start")||e.has("end"))return null;let t=mu(e.get("cx")),r=mu(e.get("cy")),n=mu(e.get("rx")),i=mu(e.get("ry"));return t===null||r===null||n===null||i===null||n<=0||i<=0?null:{x:t,y:r,rx:n,ry:i}}function xP(e){let t=bP(e);return t?{type:"ellipse",state:{...t},consumes:vP}:null}function wP(e,t){if(e.get("type")!=="arc")return[];let r=s=>{let l=t(s);return typeof l=="number"&&Number.isFinite(l)?l:null},n=r("x"),i=r("y"),a=r("rx"),o=r("ry");return n===null||i===null||a===null||o===null?[]:[{name:"sodipodi:cx",value:String(n)},{name:"sodipodi:cy",value:String(i)},{name:"sodipodi:rx",value:String(a)},{name:"sodipodi:ry",value:String(o)}]}function i0(e,t,...r){return Object.freeze({id:e,prefix:t,namespaceUris:r,extensionUris:Object.freeze([]),project:()=>null,emit:()=>[]})}var a0=Object.freeze([Object.freeze({id:"sodipodi",prefix:"sodipodi",namespaceUris:[hP,mP],extensionUris:Object.freeze([]),project:xP,emit:wP}),i0("inkscape","inkscape",gP),i0("boxy","bx",yP)]),o0=[];function uh(){return o0.length===0?a0:[...o0,...a0]}function IP(){return uh()}function hp(e){if(e===null)return null;for(let t of uh())if(t.namespaceUris.includes(e))return t;return null}function wx(e){let t=new Set;for(let r of e){let n=hp(r.namespaceUri);if(!n||t.has(n))continue;let i=new Map;for(let o of e)hp(o.namespaceUri)===n&&i.set(o.localName,o.value);let a=n.project(i);if(!a){t.add(n);continue}if(a.consumes.length===0)throw new Error(`Namespace vocabulary ${n.id} projected canonical state without consuming any attribute, so nothing would regenerate it on export.`);return{vocabulary:n,projection:a}}return null}function kP(){return Object.freeze(uh().flatMap(e=>[...e.extensionUris]))}var SP="http://www.w3.org/1999/xhtml",$P="http://www.w3.org/1998/Math/MathML",l7=Object.freeze([SP,$P,...kP()]),NP=Object.freeze(["systemLanguage","requiredExtensions","requiredFeatures"]);function Cf(e,t){return j(e,t)}function MP(e){if(e.namespaceUri!==ye)return null;let t=Cf(e,"systemLanguage"),r=Cf(e,"requiredExtensions"),n=Cf(e,"requiredFeatures");return t===null&&r===null&&n===null?null:Object.freeze({sourceNodeId:e.sourceNodeId,elementName:e.localName,systemLanguage:t,requiredExtensions:r,requiredFeatures:n})}function AP(e,t,r){return Object.freeze({severity:"warning",code:"required-features-dropped",source:r.source,entrypoint:r.entrypoint,capability:"conditional-processing",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:"Dropped requiredFeatures because SVG 2 removed the feature test."})}function CP(e,t){let r=[],n=[];for(let s of e.index.elements){let l=MP(s);l&&(r.push(l),l.requiredFeatures!==null&&n.push(AP(e,s,t)))}let i=Object.freeze(r),a=new Map(i.map(s=>[s.sourceNodeId,s])),o=Object.freeze({candidates:i,condition:s=>a.get(s)??null});return Object.freeze({value:o,diagnostics:Object.freeze(n)})}var OP=new Set(["clippath","mask","lineargradient","radialgradient","pattern","filter","marker","symbol","view"]),TP=new Set(["clippath","mask","lineargradient","radialgradient","pattern","filter","marker","symbol"]),PP=/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu;function s0(e){let t=e.trim();return/^-?[_A-Za-z][\w:.-]*$/u.test(t)?t:t.replace(/[^\w:.-]+/gu,"_").replace(/^[^_A-Za-z]+/u,"")||"svg-resource"}function DP(e,t){let r=1;for(;t.has(`${e}-${r}`);)r++;let n=`${e}-${r}`;return t.add(n),n}function Of(e,t,r){let n=e.trim(),i=n.length>0?s0(n):s0(t);return e===i&&!r.has(i)||!r.has(i)?(r.add(i),i):DP(i,r)}function l0(e,t){return e.replace(PP,(r,n,i)=>{let a=t.get(i);return!a||a===i?r:`url(${n}#${a}${n})`})}function jP(e){let t=[...e.children].reverse(),r="";for(;t.length>0;){let n=t.pop();n.kind==="text"||n.kind==="cdata"?r+=n.value:n.kind==="element"&&t.push(...[...n.children].reverse())}return r}function u0(e,t){switch(e.localName.toLowerCase()){case"clippath":return"clipPath";case"mask":return"mask";case"lineargradient":return"linearGradient";case"radialgradient":return"radialGradient";case"pattern":return"pattern";case"filter":return"filter";case"marker":return"marker";case"symbol":return"symbol";case"view":return"view";default:return t?"hrefTarget":"other"}}function EP(e){for(let t of e.elementIds)Object.freeze(t);for(let t of e.resourceIds)Object.freeze(t);for(let t of e.generatedIds)Object.freeze(t);for(let t of e.rewrites)Object.freeze(t);return Object.freeze(e.elementOrder),Object.freeze(e.elementIds),Object.freeze(e.resourceIds),Object.freeze(e.generatedIds),Object.freeze(e.rewrites),Object.freeze(e)}function zP(e,t={}){let r=e.index.elements,n=g=>{let v=e.index.parent(g.sourceNodeId);for(;v;){if(v.localName.toLowerCase()==="defs")return!0;v=e.index.parent(v.sourceNodeId)}return!1},i=new Set;for(let g of r)j(g,"id")!==null&&(OP.has(g.localName.toLowerCase())||n(g))&&i.add(g.sourceNodeId);for(let g of e.index.localReferences)g.channel!=="href"&&g.channel!=="xlink-href"||g.targetSourceNodeId&&i.add(g.targetSourceNodeId);let a=new Set(t.claimedIds??[]),o=new Map,s=new Map,l=[];for(let g of r){let v=j(g,"id");if(v===null)continue;let y=u0(g,n(g)),b=Of(v,y,a);o.has(v)||o.set(v,b),s.set(g.sourceNodeId,b),l.push({sourceNodeId:g.sourceNodeId,authoredId:v,liveId:b})}let u=[];for(let g of r){if(!i.has(g.sourceNodeId))continue;let v=j(g,"id");if(v===null)continue;let y=u0(g,n(g)),b=s.get(g.sourceNodeId);b&&u.push({sourceNodeId:g.sourceNodeId,authoredId:v,sourceId:v.length>0?v:b,liveId:b,kind:y,restoreSourceId:b!==v&&TP.has(g.localName.toLowerCase())})}let d=[],c=new Set,f=0;for(let g of r){if(g.namespaceUri!=="http://www.w3.org/2000/svg")continue;let v=g.localName.toLowerCase();if(!["animate","animatemotion","animatetransform","discard","set"].includes(v)||yr(g))continue;let y=e.index.parent(g.sourceNodeId);if(!y||c.has(y.sourceNodeId))continue;let b=y,I=!1;for(;b;){if(b.namespaceUri==="http://www.w3.org/2000/svg"&&["clippath","mask"].includes(b.localName.toLowerCase())){I=!0;break}b=e.index.parent(b.sourceNodeId)}if(!I||j(y,"id"))continue;let x=`svgsketch-smil-target-${f++}`,k=Of(x,"other",a);c.add(y.sourceNodeId),d.push({sourceNodeId:y.sourceNodeId,liveId:k,reason:"clip-mask-animation-target"})}let p=0,h=new Set(t.cssAnimationTargetSourceNodeIds??[]);for(let g of r){if(!h.has(g.sourceNodeId)||c.has(g.sourceNodeId)||j(g,"id"))continue;let v=`svgsketch-css-animation-target-${p++}`,y=Of(v,"other",a);c.add(g.sourceNodeId),d.push({sourceNodeId:g.sourceNodeId,liveId:y,reason:"clip-mask-css-animation-target"})}let m=[];for(let g of r){if(g.localName.toLowerCase()==="style"){let y=jP(g),b=l0(y,o);b!==y&&m.push({sourceNodeId:g.sourceNodeId,target:"text-content",value:b})}let v=yr(g);for(let y of g.attributes){if(y.localName==="id"&&y.namespaceUri===null||y.name==="data-source-id")continue;let b=y.value;if((v?.namespace==="svg2"?y.localName==="href"&&y.namespaceUri===null:v?.namespace==="xlink"&&y.localName==="href"&&y.namespaceUri!==null)&&b.startsWith("#")){let I=o.get(b.slice(1));I&&I!==b.slice(1)&&(b=`#${I}`)}else y.namespaceUri===null&&b.includes("url(")&&(b=l0(b,o));b!==y.value&&m.push({sourceNodeId:g.sourceNodeId,target:"attribute",name:y.name,value:b})}}return EP({elementOrder:r.map(g=>g.sourceNodeId),elementIds:l,resourceIds:u,generatedIds:d,rewrites:m,liveIdForSourceId(g){return o.get(g)},liveIdForSourceNodeId(g){return s.get(g)}})}var ut=e=>({authority:"core",by:e}),u7={geometry:ut("ingest/svg-leaf-geometry.ts"),containers:ut("ingest/svg-container-hierarchy.ts"),"source-order":ut("ingest/svg-source.ts and ingest/svg-use-occurrences.ts"),hierarchy:ut("ingest/svg-container-hierarchy.ts"),"root-viewport-frame":ut("ingest/root-frame.ts"),"common-presentation":ut("ingest/svg-style-cascade.ts and svg-property-semantics.ts"),"conditional-processing":ut("ingest/svg-conditional-processing.ts"),"authored-attributes":ut("ingest/svg-authored-attributes.ts"),gradients:ut("ingest/svg-gradients.ts"),patterns:ut("ingest/svg-patterns.ts"),filters:ut("ingest/svg-filters.ts"),"paint-server-definitions":ut("ingest/svg-paint-server-definitions.ts"),markers:ut("ingest/svg-markers.ts"),symbols:ut("ingest/svg-symbol-uses.ts"),"use-and-linked-references":ut("ingest/svg-use-occurrences.ts and ingest/svg-symbol-uses.ts"),"clip-definitions":ut("ingest/svg-clip-masks.ts"),"mask-definitions":ut("ingest/svg-clip-masks.ts"),"clip-mask-membership":ut("ingest/svg-clip-masks.ts"),"smil-animation":ut("ingest/svg-animations.ts and smil-value-syntax.ts"),"css-animation":ut("ingest/svg-animations.ts and css-animation-syntax.ts"),metadata:ut("ingest/svg-metadata.ts"),scripts:ut("ingest/svg-scripts.ts"),styles:ut("ingest/svg-style-cascade.ts"),"custom-properties":ut("ingest/svg-style-cascade.ts custom-property environments"),views:ut("ingest/svg-views.ts"),"embedded-svg":ut("ingest/svg-embedded-frames.ts"),fonts:ut("ingest/svg-external-effects.ts"),"external-assets":ut("ingest/svg-external-effects.ts"),"foreign-structure":ut("ingest/plan-decoration.ts")};var _P=64,RP=1e5,Pd="http://www.w3.org/2000/svg",FP=new Set(["circle","ellipse","line","path","polygon","polyline","rect","text"]);function d0(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(1,Math.floor(e))}var mp=new Set(["defs","clippath","mask","marker","pattern","lineargradient","radialgradient","filter","symbol"]);function LP(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=e[n]-t[n];if(i!==0)return i}return e.length-t.length}function BP(e,t){return LP(e.orderKey,t.orderKey)||e.productIndex-t.productIndex||e.occurrenceId.localeCompare(t.occurrenceId)}function c0(e,t,r){let n=t.map(i=>i.sourceReferenceId).join("/");return`occurrence:${n?`${n}/`:""}${e}:${r}`}function VP(e,t){let r=yr(t);if(!r?.value.startsWith("#")||r.value.length<=1)return null;let n=r.namespace==="svg2"?"href":"xlink-href";return e.index.referencesFrom(t.sourceNodeId).find(i=>i.channel===n&&i.authoredValue===r.value)??null}function UP(e,t){let r=yr(t);if(!r||r.value.length===0||r.value==="#")return Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:null,targetSourceNodeId:null,status:"empty"});if(!r.value.startsWith("#"))return Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:null,targetSourceNodeId:null,status:"external"});let n=VP(e,t),i=n?.targetSourceNodeId?e.index.element(n.targetSourceNodeId):null;return!n||!i?Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:n?.sourceReferenceId??null,targetSourceNodeId:null,status:"missing"}):i.namespaceUri!==Pd?Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:n.sourceReferenceId,targetSourceNodeId:i.sourceNodeId,status:"invalid"}):Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:n.sourceReferenceId,targetSourceNodeId:i.sourceNodeId,status:"resolved"})}function GP(e,t){let r=t;for(;r&&r!==e.root;){if(mp.has(r.localName.toLowerCase()))return!0;r=e.index.parent(r.sourceNodeId)}return!1}function Ja(e){return e.namespaceUri===Pd&&e.localName.toLowerCase()==="use"}function XP(e,t){let r=new Map;for(let b of e.index.idOccurrences){let I=e.index.element(b.sourceNodeId);I&&r.set(I.sourceNodeId,I)}let n=new Map;for(let b of r.keys())n.set(b,new Set);for(let b of e.index.elements){if(b.namespaceUri!==Pd||b.localName.toLowerCase()!=="use")continue;let I=t.get(b.sourceNodeId);if(I?.status!=="resolved"||!I.targetSourceNodeId||!r.has(I.targetSourceNodeId))continue;let x=b;for(;x;)r.has(x.sourceNodeId)&&n.get(x.sourceNodeId)?.add(I.targetSourceNodeId),x=e.index.parent(x.sourceNodeId)}let i=(b,I)=>(r.get(b)?.elementOrder??0)-(r.get(I)?.elementOrder??0),a=[...r.keys()].sort(i),o=new Map(a.map(b=>[b,[...n.get(b)??[]].sort(i)])),s=new Map(a.map(b=>[b,[]]));for(let[b,I]of o)for(let x of I)s.get(x)?.push(b);for(let b of s.values())b.sort(i);let l=[],u=new Set;for(let b of a){if(u.has(b))continue;u.add(b);let I=[{sourceNodeId:b,targetIndex:0}];for(;I.length>0;){let x=I[I.length-1],k=(o.get(x.sourceNodeId)??[])[x.targetIndex];if(k!==void 0){x.targetIndex++,u.has(k)||(u.add(k),I.push({sourceNodeId:k,targetIndex:0}));continue}l.push(x.sourceNodeId),I.pop()}}let d=[],c=new Set;for(let b=l.length-1;b>=0;b--){let I=l[b];if(c.has(I))continue;let x=[],k=[I];for(c.add(I);k.length>0;){let $=k.pop();x.push($);let A=s.get($)??[];for(let S=A.length-1;S>=0;S--){let N=A[S];c.has(N)||(c.add(N),k.push(N))}}x.sort(i),d.push(x)}let f=new Map;d.forEach((b,I)=>{b.forEach(x=>f.set(x,I))});let p=d.map(()=>new Set);for(let[b,I]of n){let x=f.get(b);for(let k of I){let $=f.get(k);x!==$&&p[x].add($)}}let h=d.map(b=>r.get(b[0])?.elementOrder??Number.MAX_SAFE_INTEGER),m=(b,I)=>h[b]-h[I],g=d.map((b,I)=>I).sort(m),v=[],y=new Set;for(let b of g){if(y.has(b))continue;y.add(b);let I=[{componentIndex:b,dependencyIndex:0,dependencies:[...p[b]].sort(m)}];for(;I.length>0;){let x=I[I.length-1],k=x.dependencies[x.dependencyIndex];if(k!==void 0){x.dependencyIndex++,y.has(k)||(y.add(k),I.push({componentIndex:k,dependencyIndex:0,dependencies:[...p[k]].sort(m)}));continue}v.push(x.componentIndex),I.pop()}}return v.map(b=>{let I=d[b],x=I.length>1||(n.get(I[0])?.has(I[0])??!1);return Object.freeze({componentId:`definition-component:${I[0]}`,memberSourceNodeIds:Object.freeze([...I]),circular:x})})}function Qa(e,t,r,n,i){return Object.freeze({severity:"warning",code:t,source:e.source,entrypoint:e.entrypoint,capability:"use-and-linked-references",sourceId:j(n,"id")??void 0,sourceNodeId:n.sourceNodeId,occurrenceId:i,elementName:n.name,message:r})}function WP(e,t){let r=d0(t.maxDepth,_P),n=d0(t.maxOccurrences,RP),i=e.index.elements.filter(S=>S.namespaceUri===Pd&&S.localName.toLowerCase()==="use").map(S=>UP(e,S)),a=new Map(i.map(S=>[S.useSourceNodeId,S])),o=[],s=new Map,l=new Map,u=[],d=[],c=[],f=new Map,p=new Set;for(let S of t.resourceRoots??[]){let N=`${S.capability}\0${S.sourceNodeId}`;if(p.has(N))continue;p.add(N);let T=e.index.element(S.sourceNodeId),z=[];if(T&&S.capability==="clip-path")for(let O of e.index.children(T.sourceNodeId)){if(!Ja(O))continue;let E=a.get(O.sourceNodeId),_=E?.targetSourceNodeId?e.index.element(E.targetSourceNodeId):null;(E?.status!=="resolved"||!_||!FP.has(_.localName.toLowerCase()))&&(z.push(O.sourceNodeId),d.push(Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:t.source,entrypoint:t.entrypoint,capability:"clip-definitions",sourceId:j(T,"id")??void 0,sourceNodeId:O.sourceNodeId,elementName:O.name,documentPath:e.index.sourcePath(O.sourceNodeId),message:"A clipPath child use must directly reference a path, text, or basic shape. The clipPath is ignored."})))}let C=Object.freeze({resourceRootSourceNodeId:S.sourceNodeId,capability:S.capability,status:z.length===0?"valid":"invalid",invalidUseSourceNodeIds:Object.freeze(z)});c.push(C),f.has(S.sourceNodeId)||f.set(S.sourceNodeId,C)}let h=new Set,m=0,g=!1,v=(S,N,T,z,C)=>{let O=c0(S.sourceNodeId,N,0),E=s.get(O);if(E)return E;let _=Object.freeze({occurrenceId:O,correspondingSourceNodeId:S.sourceNodeId,usePath:Object.freeze(N.map(U=>Object.freeze({...U}))),role:C,parentOccurrenceId:T,orderKey:Object.freeze([...z]),productIndex:0});return o.push(_),s.set(O,_),N.length===0?l.set(S.sourceNodeId,_):m++,_};for(let S of e.index.elements){let N=e.index.parent(S.sourceNodeId),T=N?c0(N.sourceNodeId,[],0):null,z=Ja(S)?"use-carrier":GP(e,S)?"definition":"source";v(S,[],T,[S.elementOrder],z)}let y=(S,N)=>{g||(g=!0,d.push(Qa(t,"use-expansion-limit-exceeded",`SVG use expansion exceeded depth ${r} or ${n} shadow occurrences.`,S,N.occurrenceId)))},b=(S,N,T)=>{if(h.has(N.occurrenceId))return;h.add(N.occurrenceId);let z=yr(S),C=a.get(S.sourceNodeId);if(!C||C.status==="empty"){u.push({useOccurrenceId:N.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:null,status:"empty"}),d.push(Qa(t,"unresolved-reference","The SVG use element has no local target.",S,N.occurrenceId));return}if(C.status==="external"){u.push({useOccurrenceId:N.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:null,status:"external"}),d.push(Qa(t,"unresolved-reference",`External SVG use target "${z?.value??""}" is not materialized by local import.`,S,N.occurrenceId));return}if(C.status==="missing"){u.push({useOccurrenceId:N.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:null,status:"missing"}),d.push(Qa(t,"unresolved-reference",`SVG use target "${z?.value??""}" does not exist.`,S,N.occurrenceId));return}if(C.status==="invalid"){u.push({useOccurrenceId:N.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:C.targetSourceNodeId,status:"invalid"}),d.push(Qa(t,"unresolved-reference",`SVG use target "${z?.value??""}" is outside the SVG namespace.`,S,N.occurrenceId));return}let O=C.targetSourceNodeId?e.index.element(C.targetSourceNodeId):null;if(!O||!C.sourceReferenceId)return;let E={sourceReferenceId:C.sourceReferenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:O.sourceNodeId},_=[...N.usePath,E];if(T.has(O.sourceNodeId)){u.push({useOccurrenceId:N.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:O.sourceNodeId,status:"circular"}),d.push(Qa(t,"circular-use-reference",`SVG use target "${z?.value??""}" closes a circular shadow-tree reference.`,S,N.occurrenceId));return}if(_.length>r||m>=n){u.push({useOccurrenceId:N.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:O.sourceNodeId,status:"limit"}),y(S,N);return}let U={useOccurrenceId:N.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:O.sourceNodeId,status:"resolved"};u.push(U);let V=()=>{U.status="limit",y(S,N)},q=new Set(T),G=(H,W,B)=>{if(m>=n){V();return}q.add(H.sourceNodeId);let ie=Ja(H)?"use-carrier":"shadow-instance",Y=v(H,_,W,B,ie);if(Ja(H))b(H,Y,q);else if(!mp.has(H.localName.toLowerCase())||H.localName.toLowerCase()==="symbol"){for(let X of e.index.children(H.sourceNodeId))if(G(X,Y.occurrenceId,[...B,X.elementOrder]),m>=n){V();break}}q.delete(H.sourceNodeId)};G(O,N.occurrenceId,[...N.orderKey,O.elementOrder])},I=(S,N)=>{if(mp.has(S.localName.toLowerCase()))return;let T=new Set(N);T.add(S.sourceNodeId);let z=l.get(S.sourceNodeId);if(Ja(S)){b(S,z,N);return}for(let C of e.index.children(S.sourceNodeId))I(C,T)};I(e.root,new Set);let x=(S,N)=>{let T=new Set(N);T.add(S.sourceNodeId);let z=l.get(S.sourceNodeId);if(Ja(S)){b(S,z,N);return}for(let C of e.index.children(S.sourceNodeId))x(C,T)};for(let S of t.resourceRoots??[]){if(f.get(S.sourceNodeId)?.status==="invalid")continue;let N=e.index.element(S.sourceNodeId);if(!N)continue;let T=new Set,z=e.index.parent(N.sourceNodeId);for(;z;)T.add(z.sourceNodeId),z=e.index.parent(z.sourceNodeId);x(N,T)}let k=new Set(i.flatMap(S=>S.status==="resolved"&&S.targetSourceNodeId?[S.targetSourceNodeId]:[]));for(let S of i){if(S.status==="resolved")continue;let N=e.index.element(S.useSourceNodeId);if(!N)continue;let T=e.index.parent(N.sourceNodeId);for(;T&&T.localName.toLowerCase()!=="symbol";)T=e.index.parent(T.sourceNodeId);if(!T||k.has(T.sourceNodeId))continue;let z=new Set,C=e.index.parent(N.sourceNodeId);for(;C;)z.add(C.sourceNodeId),C=e.index.parent(C.sourceNodeId);let O=l.get(N.sourceNodeId);O&&b(N,O,z)}o.sort(BP);let $=u.map(S=>Object.freeze({...S})),A=XP(e,a);return Object.freeze(i),Object.freeze(o),Object.freeze($),Object.freeze(A),Object.freeze(c),Object.freeze(d),Object.freeze({occurrences:o,sourceResolutions:i,resolutions:$,definitionComponents:A,resourcePolicies:c,diagnostics:d,occurrence(S){return s.get(S)??null},direct(S){return l.get(S)??null},sourceResolution(S){return a.get(S)??null},resourcePolicy(S){return f.get(S)??null}})}function Ix(e,t){return e.index.parent(t.sourceNodeId)===e.root?"document":"defs"}var Dd=new Set(["circle","ellipse","foreignobject","image","line","path","polygon","polyline","rect","text"]),HP=new Set([...Dd,"a","g","use"]),qP=new Set(["clippath","defs","filter","lineargradient","marker","mask","pattern","radialgradient","symbol"]),YP=new Set(["clippath","filter","marker","mask","pattern"]),KP=new Set(["defs"]),f0=new Set([...qP,"flowregion"]),ZP=new Set(["data-shape-id","height","href","id","style","transform","width","x","xlink:href","xmlns","xmlns:xlink","y"]),JP=["animation","transition","-moz-animation","-moz-transition","-o-animation","-o-transition","-webkit-animation","-webkit-transition"],QP=new Set(["height","id","preserveaspectratio","refx","refy","viewbox","width","x","y"]);function Zr(e){return e.localName.toLowerCase()}function kx(e,t){let r=[],n=new Set,i=e.index.parent(t.sourceNodeId);for(;i&&!n.has(i.sourceNodeId);)n.add(i.sourceNodeId),r.push(i),i=e.index.parent(i.sourceNodeId);return r}function Qu(e,t,r){return kx(e,t).some(n=>r.has(Zr(n)))}function p0(e,t){let r=Zr(t);return r==="symbol"?!0:Qu(e,t,KP)?r==="g"||r==="use"||Dd.has(r):!1}function h0(e){let t=e.toLowerCase();return JP.some(r=>t===r||t.startsWith(`${r}-`))}function e2(e){let t={};for(let r of["x","y","width","height"])ji(e,r)&&(t[r]=j(e,r)??"");return Object.keys(t).length===0?null:Object.freeze(t)}function t2(e,t,r,n){let i=t;for(;i&&Zr(i)!=="svg";)i=e.index.parent(i.sourceNodeId);let a=i?Mn(j(i,"viewBox")??""):null,o=i?it(j(i,"width"),{}):void 0,s=i?it(j(i,"height"),{}):void 0,l=a?.width??o,u=a?.height??s,d=it(r.value(n,"font-size"),{viewportWidth:l,viewportHeight:u,percentBasis:16,fontSize:16,rootFontSize:16});return{viewportWidth:l,viewportHeight:u,fontSize:d??16,rootFontSize:16}}function r2(e,t){for(let r of kx(e,t))switch(Zr(r)){case"pattern":return j(r,"patternContentUnits")==="objectBoundingBox";case"clippath":return j(r,"clipPathUnits")==="objectBoundingBox";case"mask":return j(r,"maskContentUnits")==="objectBoundingBox";default:break}return!1}function gu(e,t){if(e===null||e.trim()===""||e.trim().toLowerCase()==="auto")return t;let r=Dr(e);return r?r.unit==="%"?r.value/100:r.unit===""?r.value:t:t}function n2(e,t,r,n){let i=r2(e,t),a=t2(e,t,n,r),o=j(t,"x"),s=j(t,"y"),l=i?gu(o,0):it(o,{...a,percentBasis:a.viewportWidth})??0,u=i?gu(s,0):it(s,{...a,percentBasis:a.viewportHeight})??0,d=j(t,"width"),c=j(t,"height"),f=d===null||d.trim()===""||d.trim().toLowerCase()==="auto"?null:i?gu(d,0):it(d,{...a,percentBasis:a.viewportWidth})??null,p=c===null||c.trim()===""||c.trim().toLowerCase()==="auto"?null:i?gu(c,0):it(c,{...a,percentBasis:a.viewportHeight})??null;return Object.freeze({authored:e2(t),x:l,y:u,width:f,height:p})}function i2(e,t,r){let n=j(e,"transform"),i=r.style(t)?.cascadedValues.transform?.value??null,a=n??i;if(a===null||a.trim()===""||a.trim().toLowerCase()==="none")return Object.freeze({authored:a,matrix:Qr(1,0,0,1,0,0),valid:!0,pureTranslation:!0});let o=Ei(a),s=o!==null&&Math.abs(o[0]-1)<1e-6&&Math.abs(o[1])<1e-6&&Math.abs(o[2])<1e-6&&Math.abs(o[3]-1)<1e-6;return Object.freeze({authored:a,matrix:o,valid:o!==null,pureTranslation:s})}function a2(e,t,r){let n={};for(let o of e.attributes){let s=o.name;ZP.has(s)||o.value===""||h0(s)||(n[s]=o.value)}let i=r.style(t.occurrenceId);for(let[o,s]of Object.entries(i?.cascadedValues??{}))o==="transform"||h0(o)||(n[o]=s.value);let a=t.parentOccurrenceId?r.style(t.parentOccurrenceId):null;for(let[o,s]of Object.entries(i?.resolvedValues??{}))n[o]!==void 0||!Ws(o)?.inherited||a?.resolvedValues[o]!==s||a.cascadedValues[o]&&(n[o]=s);return Object.freeze(n)}function o2(e){let t={};for(let r of e.attributes)r.name==="xmlns"||r.prefix==="xmlns"||r.namespaceUri===null&&QP.has(r.localName.toLowerCase())||(t[r.name]=r.value);return Object.freeze(t)}function Sx(e){let t=o2(e),r=Zr(e);return r==="g"||r==="symbol"?t:t.transform===void 0?Object.freeze({}):Object.freeze({transform:t.transform})}function $x(e,t){return e.find(r=>r.memberSourceNodeIds.includes(t))??null}function s2(e,t,r,n,i,a){let o=i.get(`${r.occurrenceId}\0${n.sourceNodeId}`);if(!o)return null;let s=$x(t.definitionComponents,n.sourceNodeId),l=a(o.occurrenceId),u=j(n,"viewBox");return Object.freeze({sourceNodeId:n.sourceNodeId,sourceId:j(n,"id"),defKind:Zr(n)==="symbol"?"symbol":Zr(n)==="use"||Dd.has(Zr(n))?"shape":"group",definitionPlacement:Ix(e,n),productKey:`symbol-product:${n.sourceNodeId}:${r.occurrenceId}`,productUseOccurrenceId:r.occurrenceId,productRootOccurrenceId:o.occurrenceId,contentOccurrenceIds:Object.freeze(l),componentId:s?.componentId??null,circular:s?.circular??!1,viewBox:u,parsedViewBox:u===null?null:Mn(u),preserveAspectRatio:j(n,"preserveAspectRatio"),x:j(n,"x"),y:j(n,"y"),width:j(n,"width"),height:j(n,"height"),refX:j(n,"refX"),refY:j(n,"refY"),rootAttributes:Sx(n)})}function l2(e,t,r,n,i){let a=$x(t.definitionComponents,r.sourceNodeId),o=j(r,"viewBox");return Object.freeze({sourceNodeId:r.sourceNodeId,sourceId:j(r,"id"),defKind:Zr(r)==="symbol"?"symbol":Zr(r)==="use"||Dd.has(Zr(r))?"shape":"group",definitionPlacement:Ix(e,r),productKey:`symbol-definition:${r.sourceNodeId}`,productUseOccurrenceId:n.occurrenceId,productRootOccurrenceId:n.occurrenceId,contentOccurrenceIds:Object.freeze(i(n.occurrenceId)),componentId:a?.componentId??null,circular:a?.circular??!1,viewBox:o,parsedViewBox:o===null?null:Mn(o),preserveAspectRatio:j(r,"preserveAspectRatio"),x:j(r,"x"),y:j(r,"y"),width:j(r,"width"),height:j(r,"height"),refX:j(r,"refX"),refY:j(r,"refY"),rootAttributes:Sx(r)})}function m0(e,t,r,n,i,a){return!(n.usePath.length!==0||!i.valid||!HP.has(Zr(r))||Qu(e,t,f0)||Qu(e,r,f0)&&!a.has(r.sourceNodeId))}function u2(e,t,r,n){let i=n.nativeDefinitionSourceNodeIds??new Set,a=new Map,o=new Map;for(let y of t.occurrences){if(!y.parentOccurrenceId)continue;let b=`${y.parentOccurrenceId}\0${y.correspondingSourceNodeId}`;a.has(b)||a.set(b,y);let I=o.get(y.parentOccurrenceId)??[];I.push(y),o.set(y.parentOccurrenceId,I)}let s=new Map,l=y=>{let b=s.get(y);if(b)return b;let I=[],x=[...o.get(y)??[]].reverse(),k=new Set;for(;x.length>0;){let A=x.pop();if(k.has(A.occurrenceId))continue;k.add(A.occurrenceId),I.push(A.occurrenceId);let S=o.get(A.occurrenceId)??[];for(let N=S.length-1;N>=0;N--)x.push(S[N])}let $=Object.freeze(I);return s.set(y,$),$},u=[],d=[],c=new Map,f=new Map;for(let y of t.resolutions){let b=t.occurrence(y.useOccurrenceId),I=e.index.element(y.useSourceNodeId);if(!b||!I||I.namespaceUri!==ye)continue;let x=y.targetSourceNodeId?e.index.element(y.targetSourceNodeId):null,k=n2(e,I,b.occurrenceId,r),$=i2(I,b.occurrenceId,r),A=a2(I,b,r),S=y.status==="resolved"?"flattened":y.status,N=null;if(y.status==="resolved"&&x){let z=Qu(e,I,YP);if(i.has(x.sourceNodeId)&&m0(e,I,x,b,$,i))S="linked-reference";else if(p0(e,x)){let C=s2(e,t,b,x,a,l);C&&(u.push(C),c.set(C.productKey,C),z||(N=C.productKey,S="symbol-instance"))}else!z&&m0(e,I,x,b,$,i)&&(S="linked-reference")}let T=Object.freeze({useOccurrenceId:b.occurrenceId,useSourceNodeId:I.sourceNodeId,targetSourceNodeId:x?.sourceNodeId??null,targetElementName:x?.name??null,status:S,definitionProductKey:N,geometry:k,presentation:A,transform:$,orderKey:Object.freeze([...b.orderKey])});d.push(T),f.set(T.useOccurrenceId,T)}let p=new Set(u.map(y=>y.sourceNodeId));for(let y of e.index.elements){let b=e.index.parent(y.sourceNodeId),I=j(y,"id"),x=Zr(y),k=b?.localName.toLowerCase()==="defs",$=x==="symbol";if(!I||i.has(y.sourceNodeId)||!k&&!$||!p0(e,y)||p.has(y.sourceNodeId)&&!$)continue;let A=t.direct(y.sourceNodeId);if(!A)continue;let S=l2(e,t,y,A,l),N=u.findIndex(T=>T.sourceNodeId===y.sourceNodeId);N===-1?u.push(S):u.splice(N,0,S),c.set(S.productKey,S),p.add(S.sourceNodeId)}let h=new Map;for(let y of u){let b=h.get(y.sourceNodeId)??[];b.push(y),h.set(y.sourceNodeId,b)}let m=new Map;for(let[y,b]of h){let I=b.find(x=>x.productKey.startsWith("symbol-definition:"));m.set(y,I??b[0])}let g=u.map(y=>{let b=o.get(y.productRootOccurrenceId)??[],I=[],x=new Set;for(let k of b){let $=m.get(k.correspondingSourceNodeId),A=e.index.parent(k.correspondingSourceNodeId)?.sourceNodeId===y.sourceNodeId;if($&&$.productKey!==y.productKey&&A){I.push({kind:"definition",productKey:$.productKey}),x.add(k.occurrenceId);for(let S of l(k.occurrenceId))x.add(S)}else I.push({kind:"occurrence",occurrenceId:k.occurrenceId})}return I.some(k=>k.kind==="definition")?Object.freeze({...y,contentOccurrenceIds:Object.freeze(y.contentOccurrenceIds.filter(k=>!x.has(k))),definitionContentOrder:Object.freeze(I.map(k=>Object.freeze(k)))}):y});c.clear();for(let y of g)c.set(y.productKey,y);Object.freeze(g),Object.freeze(d);let v=Object.freeze([]);return Object.freeze({definitions:g,uses:d,diagnostics:v,definition(y){return c.get(y)??null},use(y){return f.get(y)??null}})}var d2=new Map([["lineargradient","gradient"],["radialgradient","gradient"],["pattern","pattern"],["filter","filter"],["marker","marker"],["clippath","clip-path"],["mask","mask"]]),Nx=new Map([["clip-path","clip-path"],["mask","mask-image"],["mask-image","mask-image"],["filter","filter"],["fill","paint"],["stroke","paint"],["marker","marker"],["marker-start","marker"],["marker-mid","marker"],["marker-end","marker"]]),c2=new Set(["animate","set"]),f2=new Set(["clippath","defs","desc","lineargradient","marker","mask","metadata","pattern","radialgradient","script","style","symbol","title"]);function Mx(e){return!e||e.namespaceUri!==ye?null:d2.get(e.localName.toLowerCase())??null}function Ax(e,t,r){if(!r||r.namespaceUri!==ye)return!1;let n=r.localName.toLowerCase();return e==="paint"||e==="smil-animated-resource"&&["fill","stroke"].includes(t??"")?n==="lineargradient"||n==="radialgradient"||n==="pattern":e==="filter"||e==="smil-animated-resource"&&t==="filter"?n==="filter":e==="marker"||e==="smil-animated-resource"&&t?.startsWith("marker")?n==="marker":e==="clip-path"||e==="smil-animated-resource"&&t==="clip-path"?n==="clippath":e==="mask-image"||e==="smil-animated-resource"&&(t==="mask"||t==="mask-image")?n==="mask":e==="gradient-template"?n==="lineargradient"||n==="radialgradient":e==="pattern-template"?n==="pattern":e==="filter-image"}function p2(e){let t=[...e.children].reverse(),r="";for(;t.length>0;){let n=t.pop();n.kind==="text"||n.kind==="cdata"?r+=n.value:n.kind==="element"&&t.push(...[...n.children].reverse())}return r}function Cx(e,t){let r=t;for(;r;){if(Mx(r))return r;r=e.index.parent(r.sourceNodeId)}return null}function Ox(e,t,r){if(!r)return"consumer";if(t.sourceNodeId===r.sourceNodeId)return"resource-product";let n=t;for(;n&&n.sourceNodeId!==r.sourceNodeId;){if(f2.has(n.localName.toLowerCase()))return"parked";n=e.index.parent(n.sourceNodeId)}return n?"resource-product":"parked"}function h2(e){let t=[];for(let r of Xs(e,";")){let n=e.slice(r.start,r.end),i=Xs(n,":",!0);if(i.length<2)continue;let a=n.slice(i[0].start,i[0].end).trim().toLowerCase();if(!a)continue;let o=r.start+i[1].start,s=r.end;for(;o<s&&/\s/u.test(e[o]);)o++;for(;s>o&&/\s/u.test(e[s-1]);)s--;o!==s&&t.push({propertyName:a,valueStart:o,valueEnd:s})}return t}function Tx(e,t,r,n,i,a){let o=e.index.referencesFrom(t.sourceNodeId).find(s=>a.has(s.sourceReferenceId)||s.targetAuthoredId!==r||s.authoredValue!==n?!1:i===null||s.attributeName===i);return o&&a.add(o.sourceReferenceId),o??null}function m2(e,t,r){return(e.get(t)?.elementOrder??Number.MAX_SAFE_INTEGER)-(e.get(r)?.elementOrder??Number.MAX_SAFE_INTEGER)}function g2(e,t,r){let n=(y,b)=>m2(r,y,b),i=[...e].sort(n),a=new Map(i.map(y=>[y,[...t.get(y)??[]].sort(n)])),o=new Map(i.map(y=>[y,[]]));for(let[y,b]of a)for(let I of b)o.get(I)?.push(y);for(let y of o.values())y.sort(n);let s=[],l=new Set;for(let y of i){if(l.has(y))continue;l.add(y);let b=[{nodeId:y,targetIndex:0}];for(;b.length>0;){let I=b[b.length-1],x=a.get(I.nodeId)?.[I.targetIndex];x!==void 0?(I.targetIndex++,l.has(x)||(l.add(x),b.push({nodeId:x,targetIndex:0}))):(s.push(I.nodeId),b.pop())}}let u=[],d=new Set;for(let y=s.length-1;y>=0;y--){let b=s[y];if(d.has(b))continue;let I=[],x=[b];for(d.add(b);x.length>0;){let k=x.pop();I.push(k);let $=o.get(k)??[];for(let A=$.length-1;A>=0;A--){let S=$[A];d.has(S)||(d.add(S),x.push(S))}}I.sort(n),u.push(I)}let c=new Map;u.forEach((y,b)=>{y.forEach(I=>c.set(I,b))});let f=u.map(()=>new Set);for(let[y,b]of t){let I=c.get(y);if(I!==void 0)for(let x of b){let k=c.get(x);k!==void 0&&I!==k&&f[I].add(k)}}let p=u.map(y=>r.get(y[0])?.elementOrder??Number.MAX_SAFE_INTEGER),h=(y,b)=>p[y]-p[b],m=u.map((y,b)=>b).sort(h),g=[],v=new Set;for(let y of m){if(v.has(y))continue;v.add(y);let b=[{component:y,dependencyIndex:0,dependencies:[...f[y]].sort(h)}];for(;b.length>0;){let I=b[b.length-1],x=I.dependencies[I.dependencyIndex];x!==void 0?(I.dependencyIndex++,v.has(x)||(v.add(x),b.push({component:x,dependencyIndex:0,dependencies:[...f[x]].sort(h)}))):(g.push(I.component),b.pop())}}return g.map(y=>{let b=u[y];return Object.freeze({componentId:`resource-component:${b[0]}`,memberSourceNodeIds:Object.freeze([...b]),circular:b.length>1||(t.get(b[0])?.has(b[0])??!1)})})}function Px(e,t){let r=e.index.occurrences(t),n=r[0]?.sourceNodeId??null;return{targetSourceNodeId:n,target:n?e.index.element(n):null,resolution:r.length===0?"missing":r.length===1?"resolved":"ambiguous-first"}}function Ru(e,t,r,n,i,a,o,s,l,u=r.length,d=null){let c=l??Nx.get(n);if(!c)return[];let f=Cx(e,t);return el(r.slice(o,u)).map((p,h)=>{let m=Px(e,p.targetAuthoredId);return{sourceReferenceId:(i==="authored-direct"?Tx(e,t,p.targetAuthoredId,r,a,s):null)?.sourceReferenceId??null,fromSourceNodeId:t.sourceNodeId,occurrenceId:d,containingResourceSourceNodeId:f?.sourceNodeId??null,participation:Ox(e,t,f),binding:i,kind:c,propertyName:n,attributeName:a,authoredValue:r,propertyValue:r.slice(o,u),tokenIndex:h,tokenStart:o+p.targetStart,tokenEnd:o+p.targetEnd,targetAuthoredId:p.targetAuthoredId,targetSourceNodeId:m.targetSourceNodeId,targetElementName:m.target?.localName??null,resolution:m.resolution,validity:m.resolution==="missing"?"missing":Ax(c,n,m.target)?"valid":"invalid-target",componentId:null}})}function Tf(e,t,r,n){let i=yr(t);if(!i||!i.value.startsWith("#")||i.value.length<=1)return null;let a=i.value.slice(1),o=Px(e,a),s=i.namespace==="svg2"?"href":"xlink:href",l=Tx(e,t,a,i.value,s,n),u=Cx(e,t);return{sourceReferenceId:l?.sourceReferenceId??null,fromSourceNodeId:t.sourceNodeId,occurrenceId:null,containingResourceSourceNodeId:u?.sourceNodeId??null,participation:Ox(e,t,u),binding:"authored-direct",kind:r,propertyName:null,attributeName:s,authoredValue:i.value,propertyValue:i.value,tokenIndex:0,tokenStart:1,tokenEnd:i.value.length,targetAuthoredId:a,targetSourceNodeId:o.targetSourceNodeId,targetElementName:o.target?.localName??null,resolution:o.resolution,validity:o.resolution==="missing"?"missing":Ax(r,null,o.target)?"valid":"invalid-target",componentId:null}}function Pf(e){let t=e.trim().toLowerCase();return Nx.has(t)?t:null}function y2(e,t){let r=[];for(let n of e.index.elements){if(n.namespaceUri!==ye)continue;let i=n.localName.toLowerCase();if(i==="lineargradient"||i==="radialgradient"){let a=Tf(e,n,"gradient-template",t);a&&r.push(a)}else if(i==="pattern"){let a=Tf(e,n,"pattern-template",t);a&&r.push(a)}else if(i==="feimage"){let a=Tf(e,n,"filter-image",t);a&&r.push(a)}if(c2.has(i)){let a=Pf(j(n,"attributeName")??"");if(a)for(let o of["values","from","to","by"]){let s=n.attributes.find(l=>l.namespaceUri===null&&l.localName===o);s&&r.push(...Ru(e,n,s.value,a,"authored-direct",s.name,0,t,"smil-animated-resource"))}continue}for(let a of n.attributes){if(a.namespaceUri!==null)continue;if(a.localName==="style"){for(let s of h2(a.value)){let l=Pf(s.propertyName);l&&r.push(...Ru(e,n,a.value,l,"authored-direct",a.name,s.valueStart,t,void 0,s.valueEnd))}continue}let o=Pf(a.localName);o&&r.push(...Ru(e,n,a.value,o,"authored-direct",a.name,0,t))}}return r}function v2(e,t,r){return t.flatMap(n=>{let i=e.index.element(n.fromSourceNodeId);if(!i)throw new Error(`Applied SVG resource declaration references unknown source node ${n.fromSourceNodeId}.`);return Ru(e,i,n.value,n.propertyName,"applied-css",null,0,r,void 0,n.value.length,n.occurrenceId??null)})}function b2(e){let t=[];for(let r of e.index.elements){if(r.namespaceUri!==ye||r.localName.toLowerCase()!=="style")continue;let n=p2(r);el(n).forEach((i,a)=>{t.push(Object.freeze({styleSourceNodeId:r.sourceNodeId,authoredValue:n,tokenIndex:a,tokenStart:i.targetStart,tokenEnd:i.targetEnd,targetAuthoredId:i.targetAuthoredId}))})}return t}function x2(e,t,r){if(e.validity==="valid")return null;let n=e.validity==="circular",i=e.validity==="missing";return Object.freeze({severity:"warning",code:n?"circular-resource-reference":"unresolved-reference",source:t.source,entrypoint:t.entrypoint,capability:e.kind,sourceNodeId:e.fromSourceNodeId,sourceId:r?j(r,"id")??void 0:void 0,elementName:r?.name,message:n?`Circular ${e.kind} reference to #${e.targetAuthoredId} is invalid.`:i?`${e.kind} reference #${e.targetAuthoredId} is unresolved.`:`${e.kind} reference #${e.targetAuthoredId} targets an invalid ${e.targetElementName??"element"}.`})}function w2(e,t){let r=new Map(e.index.elements.map(I=>[I.sourceNodeId,I])),n=e.index.elements.flatMap(I=>{let x=Mx(I);return x?[Object.freeze({sourceNodeId:I.sourceNodeId,kind:x,authoredId:j(I,"id")})]:[]}),i=new Set(n.map(I=>I.sourceNodeId)),a=new Set,o=[...y2(e,a),...v2(e,t.appliedDeclarations??[],a)],s=new Map(n.map(I=>[I.sourceNodeId,new Set]));for(let I of o)I.validity==="valid"&&I.participation==="resource-product"&&I.containingResourceSourceNodeId&&I.targetSourceNodeId&&i.has(I.targetSourceNodeId)&&s.get(I.containingResourceSourceNodeId)?.add(I.targetSourceNodeId);let l=g2(n.map(I=>I.sourceNodeId),s,r),u=new Map;for(let I of l)for(let x of I.memberSourceNodeIds)u.set(x,I);let d=o.map((I,x)=>{let k=I.containingResourceSourceNodeId?u.get(I.containingResourceSourceNodeId):void 0,$=I.targetSourceNodeId?u.get(I.targetSourceNodeId):void 0,A=!!(I.validity==="valid"&&k?.circular&&k===$);return Object.freeze({resourceReferenceId:`resource-reference:${x}`,...I,validity:A?"circular":I.validity,componentId:k?.componentId??null})}),c=new Map;for(let I of d){let x=c.get(I.fromSourceNodeId)??[];x.push(I),c.set(I.fromSourceNodeId,x)}let f=d.flatMap(I=>{let x=x2(I,t,r.get(I.fromSourceNodeId)??null);return x?[x]:[]}),p=new Map;for(let I of f){if(!I.sourceNodeId)continue;let x=p.get(I.sourceNodeId)??[];x.push(I),p.set(I.sourceNodeId,x)}let h=new Map(d.map(I=>[I.resourceReferenceId,I])),m=new Map;for(let I of d){if(!I.containingResourceSourceNodeId||I.participation!=="resource-product")continue;let x=m.get(I.containingResourceSourceNodeId)??[];x.push(I),m.set(I.containingResourceSourceNodeId,x)}let g=I=>I.validity==="valid"||I.validity==="circular",v=I=>Object.freeze([...new Set(I.flatMap(x=>p.get(x.fromSourceNodeId)??[]))]),y=I=>{let x=I.map(B=>{let ie=h.get(B.resourceReferenceId);if(!ie)throw new Error(`SVG resource edge ${B.resourceReferenceId} does not belong to this dependency plan.`);return ie}),k=new Set,$=new Set,A=new Set,S=new Map,N=[],T=[],z=new Map,C=B=>{if(k.add(B.resourceReferenceId),!(!g(B)||!B.targetSourceNodeId)){if(i.has(B.targetSourceNodeId)){if($.has(B.targetSourceNodeId))return;$.add(B.targetSourceNodeId),S.set(B.targetSourceNodeId,B.resourceReferenceId),N.push(B.targetSourceNodeId);return}B.kind!=="filter-image"||A.has(B.targetSourceNodeId)||(A.add(B.targetSourceNodeId),S.set(B.targetSourceNodeId,B.resourceReferenceId),T.push(B.targetSourceNodeId))}};for(x.forEach(C);N.length>0||T.length>0;){for(;N.length>0;){let B=N.shift();for(let ie of m.get(B)??[])C(ie)}for(;T.length>0;){let B=T.shift(),ie=[],Y=[B],X=new Set;for(;Y.length>0;){let Z=Y.pop();if(!X.has(Z)){X.add(Z);for(let J of c.get(Z)??[])J.containingResourceSourceNodeId===null&&(ie.push(J),C(J));Y.push(...e.index.children(Z).map(J=>J.sourceNodeId))}}z.set(B,ie)}}let O=[],E=new Set,_=new Set,U=B=>{!g(B)||!B.targetSourceNodeId||($.has(B.targetSourceNodeId)?V(B.targetSourceNodeId):A.has(B.targetSourceNodeId)&&q(B.targetSourceNodeId))},V=B=>{let ie=`resource:${B}`;if(!(E.has(ie)||_.has(ie))){_.add(ie);for(let Y of m.get(B)??[])U(Y);_.delete(ie),E.add(ie),O.push(Object.freeze({sourceNodeId:B,role:"resource",viaResourceReferenceId:S.get(B)??null}))}},q=B=>{let ie=`fragment:${B}`;if(!(E.has(ie)||_.has(ie))){_.add(ie);for(let Y of z.get(B)??[])U(Y);_.delete(ie),E.add(ie),O.push(Object.freeze({sourceNodeId:B,role:"referenced-fragment",viaResourceReferenceId:S.get(B)??null}))}};for(let B of x)U(B);let G=d.filter(B=>k.has(B.resourceReferenceId)),H=O.flatMap(B=>B.role==="resource"?[B.sourceNodeId]:[]),W=l.filter(B=>B.memberSourceNodeIds.some(ie=>$.has(ie)));return Object.freeze({edges:Object.freeze(G),components:Object.freeze(W),resourceSourceNodeIds:Object.freeze(H),materializations:Object.freeze(O),diagnostics:v(G)})};for(let I of c.values())Object.freeze(I);Object.freeze(n),Object.freeze(d),Object.freeze(l),Object.freeze(f);let b=Object.freeze(b2(e));return Object.freeze({resources:n,edges:d,unboundStylesheetReferences:b,components:l,diagnostics:f,direct(I){return c.get(I)??Object.freeze([])},closureFromEdges(I){return y(I)},resolvePropertyValue(I,x,k){return Object.freeze((c.get(I)??[]).filter($=>$.propertyName===x&&$.propertyValue===k))},templateChain(I){let x=[],k=new Set,$=I;for(;$&&!k.has($);){k.add($);let A=(c.get($)??[]).find(S=>S.fromSourceNodeId===$&&(S.kind==="gradient-template"||S.kind==="pattern-template"));if(!A||(x.push(A),!A.targetSourceNodeId||!i.has(A.targetSourceNodeId)||A.validity==="missing"||A.validity==="invalid-target"))break;$=A.targetSourceNodeId}return Object.freeze(x)},closure(I){let x=I.map(E=>r.get(E)).filter(E=>!!E),k=new Set(x.filter(E=>i.has(E.sourceNodeId)).map(E=>E.sourceNodeId)),$=new Set;for(let E of x){let _=[E];for(;_.length>0;){let U=_.pop();$.has(U.sourceNodeId)||($.add(U.sourceNodeId),_.push(...e.index.children(U.sourceNodeId)))}}let A=new Set;for(let E of $){i.has(E)&&!k.has(E)&&A.add(E);for(let _ of c.get(E)??[])_.validity==="valid"&&_.targetSourceNodeId&&i.has(_.targetSourceNodeId)&&!k.has(_.targetSourceNodeId)&&A.add(_.targetSourceNodeId)}let S=[...k,...A];for(;S.length>0;){let E=S.pop();for(let _ of s.get(E)??[])k.has(_)||A.has(_)||(A.add(_),S.push(_))}let N=l.filter(E=>E.memberSourceNodeIds.some(_=>A.has(_))),T=N.flatMap(E=>E.memberSourceNodeIds.filter(_=>A.has(_))),z=new Set([...k,...A]),C=d.filter(E=>$.has(E.fromSourceNodeId)||E.containingResourceSourceNodeId!==null&&z.has(E.containingResourceSourceNodeId)),O=[...new Set(C.flatMap(E=>p.get(E.fromSourceNodeId)??[]))];return Object.freeze({edges:Object.freeze(C),components:Object.freeze(N),resourceSourceNodeIds:Object.freeze(T),materializations:Object.freeze(T.map(E=>Object.freeze({sourceNodeId:E,role:"resource",viaResourceReferenceId:null}))),diagnostics:Object.freeze(O)})}})}var I2="http://www.w3.org/2000/xmlns/",k2="http://www.w3.org/XML/1998/namespace",g0="http://www.w3.org/1999/xlink",S2=new Set(["class","id","lang","role","tabindex","xml:base","xml:lang","xml:space"]),$2=new Set(["cx","cy","d","dx","dy","height","inline-size","pathlength","points","r","rx","ry","shape-inside","textlength","width","x","x1","x2","y","y1","y2"]),N2=new Set(["crossorigin","decoding","href","preserveaspectratio","refx","refy","requiredextensions","requiredfeatures","systemlanguage","target","type","viewbox","zoomandpan"]);function M2(e,t,r,n){let i=t.toLowerCase(),a=r.toLowerCase();return n===I2||i==="xmlns"||i.startsWith("xmlns:")?"namespace":n!==null&&n!==k2&&n!==g0||e!==ye&&e!==null?"foreign":S2.has(i)?"metadata":i.startsWith("aria-")?"aria":i.startsWith("data-")?"data":/^on[a-z]/u.test(i)?"event-handler":NP.some(o=>o.toLowerCase()===i)?"conditional":i==="style"?"style":n===null&&rl(i)?"presentation":n===null&&$2.has(a)?"geometry":n===g0||n===null&&N2.has(a)?"element-specific":"passthrough"}function A2(e){let t=e.index.elements.flatMap(i=>i.attributes.map((a,o)=>Object.freeze({sourceNodeId:i.sourceNodeId,attributeOrder:o,name:a.name,localName:a.localName,prefix:a.prefix,namespaceUri:a.namespaceUri,value:a.value,span:a.span,classification:M2(i.namespaceUri,a.name,a.localName,a.namespaceUri)}))),r=Object.freeze(t),n=new Map;for(let i of r){let a=n.get(i.sourceNodeId)??[];a.push(i),n.set(i.sourceNodeId,a)}for(let[i,a]of n)n.set(i,Object.freeze(a));return Object.freeze({attributes:r,forElement:i=>n.get(i)??Object.freeze([])})}var jx="\0svgsketch-element-namespace",gp="\0svgsketch-attribute-namespace\0",T2=new Set(["clip-path","mask","mask-image","filter","fill","stroke","marker","marker-start","marker-mid","marker-end"]),yp=new Set(["inherit","initial","unset","revert","revert-layer"]),bo=Object.freeze({a:0,b:0,c:0});function Bn(e){return e?.children?.toArray()??[]}function Ci(e){return typeof e=="string"?e:e?C2(e):""}function vp(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let i=(e[n]??-1)-(t[n]??-1);if(i!==0)return i}return 0}function Ex(e,t){return e.a-t.a||e.b-t.b||e.c-t.c}function eo(e,t){return{a:e.a+t.a,b:e.b+t.b,c:e.c+t.c}}function Cs(e){return e.reduce((t,r)=>Ex(r,t)>0?r:t,bo)}function bp(e){let t=bo;for(let r of e){if(r.type===he.Tag||r.type===he.PseudoElement){t=eo(t,{a:0,b:0,c:1});continue}if(r.type===he.Attribute){let i=r.name==="id"&&r.action===It.Equals&&r.ignoreCase==="quirks";t=eo(t,i?{a:1,b:0,c:0}:{a:0,b:1,c:0});continue}if(r.type!==he.Pseudo)continue;let n=r.name.toLowerCase();if(n!=="where"){if((n==="is"||n==="not"||n==="has")&&Array.isArray(r.data)){t=eo(t,Cs(r.data.map(i=>bp(i))));continue}if((n==="nth-child"||n==="nth-last-child")&&typeof r.data=="string"){let i=bo,a=/\bof\s+(.+)$/iu.exec(r.data);if(a)try{i=Cs(En(a[1]).map(bp))}catch{i=bo}t=eo(eo(t,{a:0,b:1,c:0}),i);continue}t=eo(t,{a:0,b:1,c:0})}}return t}function P2(e){return{type:he.Attribute,name:jx,action:It.Equals,value:e,namespace:null,ignoreCase:!1}}function y0(e,t){if(e==="")return"";let r=t.get(e);if(r===void 0)throw new Error(`Unknown CSS namespace prefix ${e}.`);return r}function zx(e,t){let r=[];for(let n of e){if(n.type===he.Tag||n.type===he.Universal){let i={...n,namespace:null};r.push(i);let a=n.namespace??(t.has("")?"":null);a!==null&&a!=="*"&&r.push(P2(y0(a,t)));continue}if(n.type===he.Attribute&&n.namespace!==null){if(n.namespace==="*")throw new Error("Wildcard attribute namespaces require an explicit namespace prefix.");let i=y0(n.namespace,t);r.push({...n,name:`${gp}${i}\0${n.name}`,namespace:null});continue}if(n.type===he.Pseudo&&Array.isArray(n.data)&&["is","where","not","has"].includes(n.name.toLowerCase())){r.push({...n,data:n.data.map(i=>zx(i,t))});continue}r.push({...n})}return r}function D2(e){return e.children.filter(t=>t.kind!=="element").map(t=>t.value).join("")}function j2(e,t){let r=new Map;for(let a of t.occurrences){let o=e.index.element(a.correspondingSourceNodeId);o&&r.set(a.occurrenceId,{kind:"element",occurrence:a,element:o,parent:null,children:[]})}let n=[];for(let a of r.values()){let o=a.occurrence.parentOccurrenceId?r.get(a.occurrence.parentOccurrenceId)??null:null;a.parent=o,o?o.children.push(a):n.push(a);for(let s of a.element.children)s.kind!=="element"&&a.children.push({kind:"text",value:s.value,parent:a})}let i=(a,o)=>a.kind==="text"||o.kind==="text"?a.kind===o.kind?0:a.kind==="text"?1:-1:vp(a.occurrence.orderKey,o.occurrence.orderKey);for(let a of r.values())a.children.sort(i);return n.sort((a,o)=>vp(a.occurrence.orderKey,o.occurrence.orderKey)),{roots:Object.freeze(n),byOccurrenceId:r}}function _x(e){return e.kind==="text"?e.value:e.children.map(_x).join("")}function E2(e){let t=new Set(e);return e.filter(r=>{let n=r.parent;for(;n;){if(t.has(n))return!1;n=n.parent}return!0})}function v0(e,t){if(t===jx)return e.element.namespaceUri??"";if(t.startsWith(gp)){let[r,n]=t.slice(gp.length).split("\0");return e.element.attributes.find(i=>(i.namespaceUri??"")===r&&i.localName===n)?.value}return e.attributeOverrides&&Object.prototype.hasOwnProperty.call(e.attributeOverrides,t)?e.attributeOverrides?.[t]??void 0:e.element.attributes.find(r=>r.namespaceUri===null&&r.localName===t)?.value}function z2(e){return{adapter:{isTag:t=>t.kind==="element",getAttributeValue:v0,getChildren:t=>t.kind==="element"?t.children:[],getName:t=>t.element.localName,getParent:t=>t.parent,getSiblings:t=>t.parent?.children??[t],prevElementSibling:t=>{let r=t.parent?.children??[],n=r.indexOf(t);for(let i=n-1;i>=0;i--)if(r[i].kind==="element")return r[i];return null},getText:_x,hasAttrib:(t,r)=>v0(t,r)!==void 0,removeSubsets:E2,equals:(t,r)=>t===r,isHovered:t=>e.evaluateStatefulPseudo?.(t.occurrence.occurrenceId,"hover")===!0,isVisited:t=>e.evaluateStatefulPseudo?.(t.occurrence.occurrenceId,"visited")===!0,isActive:t=>e.evaluateStatefulPseudo?.(t.occurrence.occurrenceId,"active")===!0},xmlMode:!0,lowerCaseAttributeNames:!1,lowerCaseTags:!1,cacheResults:!0}}function _2(e,t,r){try{let n=En(e).map(i=>{let a=zx(i,t),o=dy([a],r);return Object.freeze({matches:s=>o(s),specificity:Object.freeze(bp(i))})});return Object.freeze(n)}catch{return null}}function R2(e){let t=[],r=0,n=null,i=!1,a=0,o=s=>{let l=e.slice(r,s).trim();l&&t.push(l)};for(let s=0;s<e.length;s++){let l=e[s];if(n){i?i=!1:l==="\\"?i=!0:l===n&&(n=null);continue}if(l==='"'||l==="'"){n=l;continue}l==="("?a++:l===")"?a=Math.max(0,a-1):a===0&&(/[\t\n\f\r ]/u.test(l)||l==="/")&&(o(s),l==="/"&&t.push("/"),r=s+1)}return o(e.length),t}function F2(e){let t=R2(e),r=/^(?:xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|larger|smaller|(?:\d*\.)?\d+(?:%|[a-z]+))$/iu,n=t.findIndex(c=>r.test(c));if(n<0)return null;let i="normal",a="normal",o="normal",s="normal";for(let c of t.slice(0,n)){let f=c.toLowerCase();f==="italic"||f==="oblique"?i=c:f==="small-caps"?a=c:f==="bold"||f==="bolder"||f==="lighter"||/^\d{1,4}$/u.test(f)?o=c:/^(?:ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded)$/u.test(f)&&(s=c)}let l=n+1,u="normal";t[l]==="/"&&(u=t[l+1]??"normal",l+=2);let d=t.slice(l).join(" ").trim();return d?Object.freeze({"font-style":i,"font-variant":a,"font-weight":o,"font-stretch":s,"font-size":t[n],"line-height":u,"font-family":d}):null}function L2(e){let t=e.propertyName;if(t==="marker")return["marker-start","marker-mid","marker-end"].map(r=>({...e,propertyName:r}));if(t==="font"){let r=F2(e.value);return r?Object.entries(r).map(([n,i])=>({...e,propertyName:n,value:i,authoredValue:i})):[]}return t==="all"&&yp.has(e.value.toLowerCase())?rx.map(r=>({...e,propertyName:r})):[e]}var B2=new Set(["cx","cy","r","rx","ry","x","y","width","height"]);function V2(e,t){let r=t.trim().toLowerCase();if(B2.has(e))return yp.has(r)||(e==="rx"||e==="ry"||e==="width"||e==="height")&&r==="auto"?!0:Dr(t)!==null;if(e==="color-rendering")return r==="auto"||r==="optimizespeed"||r==="optimizequality";if(e==="color-interpolation")return r==="auto"||r==="srgb"||r==="linearrgb";if(e!=="clip-path")return!1;if(yp.has(r)||r==="none")return!0;let n="(?:fill-box|stroke-box|view-box|content-box|border-box|margin-box|padding-box)",i="(?:inset|circle|ellipse|polygon|path|shape|rect|xywh)\\([\\s\\S]*\\)";return new RegExp(`^(?:url\\([\\s\\S]*\\)|${i}(?:\\s+${n})?|${n}(?:\\s+${i})?)$`,"iu").test(t.trim())}function Rx(e){let t;try{t=Dx(e,{context:"declarationList",positions:!0})}catch{return{declarations:Object.freeze([]),raw:Object.freeze({})}}let r=[],n={};for(let[i,a]of Bn(t).entries()){if(a.type!=="Declaration"||typeof a.property!="string"||!a.value)continue;let o=a.property,s=o.startsWith("--")?o:o.toLowerCase(),l=typeof a.value!="string"&&a.value.loc?e.slice(a.value.loc.start.offset,a.value.loc.end.offset).trim():Ci(a.value).trim();n[s]=l;let u=s.startsWith("--"),d=/(?:^|[^-_a-z0-9])var\(/iu.test(l);if(!(u||d||O2.matchProperty(s,a.value).matched||V2(s,l)))continue;let c={propertyName:s,authoredPropertyName:o,value:l,authoredValue:l,important:!!a.important,order:i};r.push(...L2(c))}return{declarations:Object.freeze(r),raw:Object.freeze(n)}}function ys(e,t){let r=Rx(e),n=r.declarations.map((i,a)=>Object.freeze({...i,declarationId:`${t.ruleId??t.sourceNodeId}:${t.origin}:${i.order}:${a}`,sourceNodeId:t.sourceNodeId,origin:t.origin,sourceOrder:Object.freeze([...t.sourceOrder,i.order,a]),ruleId:t.ruleId,layerRank:t.layerRank}));return{templates:Object.freeze(n),raw:r.raw}}function U2(e){let t=e.trim().split(/\s+/u).filter(Boolean);if(t.length===0||t.length>3)return null;let r=!1,n=t.map(i=>{let a=Dr(i);return!a||a.unit!==""||a.value===0?i:(r=!0,`${a.value}px`)});return r?n.join(" "):null}function Df(e,t,r){return Object.freeze({declarationId:e.declarationId,sourceNodeId:e.sourceNodeId,occurrenceId:t,propertyName:e.propertyName,authoredPropertyName:e.authoredPropertyName,value:e.value,authoredValue:e.authoredValue,important:e.important,origin:e.origin,specificity:Object.freeze({...r}),sourceOrder:e.sourceOrder,ruleId:e.ruleId})}function G2(e){let t=Bn(e.prelude);if(t.length===0)return null;let r=t[t.length-1],n=(r.type==="Url"||r.type==="String")&&typeof r.value=="string"?r.value:null;if(n===null)return null;let i=t[0];return{prefix:t.length>1&&i.type==="Identifier"&&typeof i.name=="string"?i.name:"",uri:n}}function X2(e){return Ci(e.prelude).split(",").map(t=>t.trim()).filter(Boolean)}var W2=new Set(["default","inherit","initial","none","revert","revert-layer","unset"]);function H2(e){let t=Bn(e.prelude);if(t.length!==1)return null;let r=t[0];return r.type==="String"&&typeof r.value=="string"?r.value===""?null:r.value:r.type!=="Identifier"||typeof r.name!="string"||W2.has(r.name.toLowerCase())?null:r.name}function q2(e){let t=e.trim().toLowerCase();if(t==="from")return 0;if(t==="to")return 1;let r=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/iu.exec(t);if(!r)return null;let n=Number(r[1]);return Number.isFinite(n)&&n>=0&&n<=100?n/100:null}function Y2(e){return e.important?!1:e.propertyName==="animation-timing-function"||e.propertyName!=="animation"&&!e.propertyName.startsWith("animation-")}function K2(e,t,r){let n=H2(e);if(!n||!e.block)return null;let i=`${t.sourceNodeId}:keyframes:${r}`,a=new Map;for(let[s,l]of Bn(e.block).entries()){if(l.type!=="Rule"||!l.prelude||!l.block)continue;let u=Ci(l.prelude).split(",").map(q2).filter(f=>f!==null);if(u.length===0)continue;let d=Bn(l.block).filter(f=>f.type==="Declaration").map(f=>Ci(f)).join(";"),c=Rx(d).declarations.filter(Y2);for(let f of u){let p=a.get(f)??new Map;for(let[h,m]of c.entries())p.set(m.propertyName,Object.freeze({declarationId:`${i}:${s}:${m.order}:${h}`,propertyName:m.propertyName,authoredPropertyName:m.authoredPropertyName,value:m.value,authoredValue:m.authoredValue,sourceOrder:Object.freeze([r,s,m.order,h])}));a.set(f,p)}}let o=[...a.entries()].sort(([s],[l])=>s-l).map(([s,l])=>Object.freeze({offset:s,declarations:Object.freeze([...l.values()]),properties:xp([...l].map(([u,d])=>[u,d.value]))}));return Object.freeze({keyframesId:i,stylesheetSourceNodeId:t.sourceNodeId,name:n,sourceOrder:r,stops:Object.freeze(o)})}function Z2(e,t,r,n){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:e.source,entrypoint:e.entrypoint,capability:"styles",sourceNodeId:t.sourceNodeId,sourceId:j(t,"id")??void 0,elementName:t.name,documentPath:r.index.sourcePath(t.sourceNodeId),message:n})}function b0(e,t){return e.matchesMedia(t)===!0}function J2(e,t){return e.supportsCondition(t)===!0}function x0(e,t,r){let n=Number(e.declaration.important)-Number(t.declaration.important);if(n!==0)return n;let i=s=>s.declaration.important?s.layerRank===null?-1:r-s.layerRank:s.layerRank===null?r+1:s.layerRank,a=i(e)-i(t);if(a!==0)return a;let o=e.originRank-t.originRank;return o!==0?o:Ex(e.declaration.specificity,t.declaration.specificity)||vp(e.declaration.sourceOrder,t.declaration.sourceOrder)}function Q2(e){let t=null,r=!1,n=0;for(let i=0;i<e.length;i++){let a=e[i];if(t){r?r=!1:a==="\\"?r=!0:a===t&&(t=null);continue}if(a==='"'||a==="'")t=a;else if(a==="(")n++;else if(a===")")n=Math.max(0,n-1);else if(a===","&&n===0)return i}return-1}function Mi(e,t,r=new Set){let n=Po(e);if(n.length===0)return e.trim();let i=e;for(let a of[...n].reverse()){let o=e.slice(a.argumentsStart,a.argumentsEnd),s;if(a.name==="var"){let l=Q2(o),u=(l<0?o:o.slice(0,l)).trim(),d=l<0?null:o.slice(l+1).trim();if(!u.startsWith("--")||r.has(u))s=d?Mi(d,t,r):null;else{let c=t[u];if(c===void 0)s=d?Mi(d,t,r):null;else{let f=new Set(r);f.add(u),s=Mi(c,t,f),s===null&&d&&(s=Mi(d,t,r))}}}else{let l=Mi(o,t,r);s=l===null?null:`${e.slice(a.tokenStart,a.argumentsStart)}${l})`}if(s===null)return null;i=`${i.slice(0,a.tokenStart)}${s}${i.slice(a.tokenEnd)}`}return i.trim()}function xp(e){return Object.freeze(Object.fromEntries(e))}function eD(e,t,r){let n=[],i=j2(e,t),a=z2(r.environment),o=[],s=[],l=[],u=[],d=new Map,c=0,f=0,p=0,h=S=>{let N=d.get(S);if(N!==void 0)return N;let T=d.size;return d.set(S,T),T},m=(S,N,T,z)=>{for(let C of S){if(C.type==="Atrule"){let W=C.name?.toLowerCase();if(W==="keyframes"){let B=K2(C,N,p++);B&&(l.push(B),N.keyframesIds.push(B.keyframesId));continue}if(W==="namespace"){let B=G2(C);B&&T.set(B.prefix,B.uri);continue}if(W==="layer"){let B=X2(C);if(!C.block){for(let X of B)h(X);continue}let ie=B[0]??`__anonymous_${c++}`,Y=z?`${z}.${ie}`:ie;h(Y),m(Bn(C.block),N,new Map(T),Y);continue}if(W==="media"){let B=Ci(C.prelude).trim();C.block&&b0(r.environment,B)&&m(Bn(C.block),N,new Map(T),z);continue}if(W==="supports"){let B=Ci(C.prelude).trim();C.block&&J2(r.environment,B)&&m(Bn(C.block),N,new Map(T),z);continue}continue}if(C.type!=="Rule"||!C.prelude||!C.block)continue;let O=Ci(C.prelude).trim(),E=_2(O,T,a);if(!E)continue;let _=`${N.sourceNodeId}:rule:${f}`,U=Bn(C.block).filter(W=>W.type==="Declaration").map(W=>Ci(W)).join(";"),V=z===null?null:h(z),q=ys(U,{sourceNodeId:N.sourceNodeId,origin:"stylesheet",ruleId:_,sourceOrder:[N.sourceNodeId===e.root.sourceNodeId?-1:f,f],layerRank:V}),G=q.templates.map(W=>Df(W,"",Cs(E.map(B=>B.specificity)))),H=Object.freeze({ruleId:_,stylesheetSourceNodeId:N.sourceNodeId,selectorText:O,specificities:Object.freeze(E.map(W=>W.specificity)),layer:z,declarations:Object.freeze(G)});s.push(H),u.push(Object.freeze({plan:H,selectors:E,templates:q.templates})),N.ruleIds.push(_),f++}};for(let S of e.index.elements){if(S.namespaceUri!==ye||S.localName.toLowerCase()!=="style")continue;let N=D2(S),T=j(S,"type"),z=j(S,"media"),C=T===null||T.trim()===""||T.trim().toLowerCase()==="text/css",O=z===null||z.trim()===""||b0(r.environment,z),E=[],_=[],U=e.index.parent(S.sourceNodeId),V="root";for(;U;){if(U.localName.toLowerCase()==="defs"){V="defs";break}U=e.index.parent(U.sourceNodeId)}let q={sourceNodeId:S.sourceNodeId,placement:V,authoredText:N,id:j(S,"id"),type:T,media:z,title:j(S,"title"),applicable:C&&O,ruleIds:E,keyframesIds:_};if(o.push(q),!q.applicable){Object.freeze(E),Object.freeze(_),Object.freeze(q);continue}try{let G=Dx(N,{positions:!0});m(Bn(G),q,new Map,null)}catch{n.push(Z2(r,S,e,"The SVG style element contains malformed CSS."))}Object.freeze(E),Object.freeze(_),Object.freeze(q)}let g=new Map;for(let S of l)g.set(S.name,S);let v=new Map,y=new Map,b=S=>{let N=v.get(S.occurrence.occurrenceId);if(N)return N;let T=S.parent?b(S.parent):null,z=new Map,C=[],O=[],E=(Y,X,Z)=>{let J=Df(Y,S.occurrence.occurrenceId,X);C.push(J);let Q=z.get(J.propertyName)??[];Q.push({declaration:J,layerRank:Y.layerRank,originRank:Z}),z.set(J.propertyName,Q)},_=S.element.namespaceUri===ye;for(let[Y,X]of S.element.attributes.entries()){if(!_)break;if(X.namespaceUri!==null||!Ws(X.localName))continue;let Z={sourceNodeId:S.element.sourceNodeId,origin:"presentation",ruleId:null,sourceOrder:[S.element.elementOrder,-2,Y],layerRank:null},J=ys(`${X.localName}:${X.value}`,Z).templates,Q=X.localName==="font-size"?Dr(X.value):null;J.length===0&&Q?.unit===""&&Q.value>=0&&(J=ys(`font-size:${Q.value}px`,Z).templates.map(we=>Object.freeze({...we,value:X.value,authoredValue:X.value})));let Ee=X.localName==="transform-origin"?U2(X.value):null;J.length===0&&Ee&&(J=ys(`transform-origin:${Ee}`,Z).templates.map(we=>Object.freeze({...we,authoredValue:X.value})));for(let we of J)we.important||E(we,bo,0)}for(let Y of u){let X=Y.selectors.filter(J=>J.matches(S));if(X.length===0)continue;O.push(Y.plan.ruleId);let Z=Cs(X.map(J=>J.specificity));for(let J of Y.templates)E(J,Z,1)}let U=j(S.element,"style");if(U!==null){let Y=ys(U,{sourceNodeId:S.element.sourceNodeId,origin:"style-attribute",ruleId:null,sourceOrder:[S.element.elementOrder,Number.MAX_SAFE_INTEGER],layerRank:null});y.set(S.occurrence.occurrenceId,Y.raw);for(let X of Y.templates)E(X,bo,2)}let V=new Map,q=new Map;for(let[Y,X]of z){X.sort((J,Q)=>x0(J,Q,d.size)),V.set(Y,X[X.length-1].declaration);let Z=X.filter(J=>J.declaration.origin==="stylesheet");Z.length>0&&q.set(Y,Z[Z.length-1].declaration)}let G={...T?.customProperties??{}};for(let[Y,X]of V){if(!Y.startsWith("--"))continue;let Z=X.value.trim().toLowerCase();Z==="inherit"||Z==="unset"?T?.customProperties[Y]===void 0?delete G[Y]:G[Y]=T.customProperties[Y]:Z==="initial"||Z==="revert"||Z==="revert-layer"?delete G[Y]:G[Y]=X.value}let H={},W={},B=new Set([...rx,...[...V.keys()].filter(Y=>!Y.startsWith("--"))]);for(let Y of B){let X=Ws(Y),Z=V.get(Y),J=T?.resolvedValues[Y],Q=X?.initialValue,Ee;if(Z){let Xe=Z.value.trim().toLowerCase();Xe==="inherit"?Ee=J??Q:Xe==="initial"||Xe==="revert"||Xe==="revert-layer"?Ee=Q:Xe==="unset"?Ee=X?.inherited?J??Q:Q:Ee=Z.value}else X?.inherited?Ee=J??Q:Ee=Q;if(Ee===void 0)continue;H[Y]=Ee;let we=Mi(Ee,G);we===null&&(we=X?.inherited?J??Q??null:Q??null),we!==null&&(we.trim().toLowerCase()==="currentcolor"&&(we=Y==="color"?T?.resolvedValues.color??"black":W.color??T?.resolvedValues.color??"black"),W[Y]=we)}let ie=Object.freeze({occurrenceId:S.occurrence.occurrenceId,correspondingSourceNodeId:S.occurrence.correspondingSourceNodeId,matchedRuleIds:Object.freeze(O),declarations:Object.freeze(C),cascadedValues:xp(V),stylesheetCascadedValues:xp(q),specifiedValues:Object.freeze(H),resolvedValues:Object.freeze(W),customProperties:Object.freeze(G),inlineDeclarations:y.get(S.occurrence.occurrenceId)??Object.freeze({})});return v.set(S.occurrence.occurrenceId,ie),ie};for(let S of i.byOccurrenceId.values())b(S);let I=Object.freeze(t.occurrences.map(S=>v.get(S.occurrenceId)).filter(S=>S!==void 0)),x=new Map;for(let S of t.occurrences){if(S.usePath.length!==0)continue;let N=v.get(S.occurrenceId);N&&x.set(S.correspondingSourceNodeId,N)}let k=[];for(let S of I)for(let[N,T]of Object.entries(S.resolvedValues)){if(!T2.has(N)||!T.toLowerCase().includes("url("))continue;let z=S.cascadedValues[N];k.push(Object.freeze({fromSourceNodeId:S.correspondingSourceNodeId,occurrenceId:S.occurrenceId,propertyName:N,value:T,origin:z?z.origin==="style-attribute"?"inline-style":"matched-stylesheet":"inherited-stylesheet"}))}let $=(S,N)=>{let T=i.byOccurrenceId.get(S);if(!T)return Object.freeze({});let z={...T,attributeOverrides:Object.freeze({class:N})},C=new Map;for(let G of u){let H=G.selectors.filter(B=>B.matches(z));if(H.length===0)continue;let W=Cs(H.map(B=>B.specificity));for(let B of G.templates){let ie=Df(B,S,W),Y=C.get(ie.propertyName)??[];Y.push({declaration:ie,layerRank:B.layerRank,originRank:1}),C.set(ie.propertyName,Y)}}let O=new Map;for(let[G,H]of C)H.sort((W,B)=>x0(W,B,d.size)),O.set(G,H[H.length-1].declaration);let E=T.parent?v.get(T.parent.occurrence.occurrenceId):null,_={...E?.customProperties??{}};for(let[G,H]of O){if(!G.startsWith("--"))continue;let W=H.value.trim().toLowerCase();if(W==="inherit"||W==="unset"){let B=E?.customProperties[G];B===void 0?delete _[G]:_[G]=B}else W==="initial"||W==="revert"||W==="revert-layer"?delete _[G]:_[G]=H.value}let U={},V=O.get("color"),q=V?Mi(V.value,_):E?.resolvedValues.color??"black";for(let[G,H]of O){if(G.startsWith("--"))continue;let W=Mi(H.value,_);W!==null&&(W.trim().toLowerCase()==="currentcolor"&&(W=q??"black"),U[G]=W)}return Object.freeze(U)},A=Object.freeze({stylesheets:Object.freeze(o),rules:Object.freeze(s),keyframes:Object.freeze(l),elements:I,appliedResourceDeclarations:Object.freeze(k),keyframesRule:S=>g.get(S)??null,ownStyle:S=>x.get(S)??null,style:S=>v.get(S)??null,value:(S,N)=>v.get(S)?.resolvedValues[N.toLowerCase()]??null,stylesheetValuesWithClass:$});return Object.freeze({value:A,diagnostics:Object.freeze(n)})}function Fx(e,t,r,n,i,a){if(r<=0||n<=0)return null;if(i<=0||a<=0)return`M${e},${t}h${r}v${n}h${-r}Z`;let o=e+r,s=t+n;return`M${e+i},${t}H${o-i}A${i},${a} 0 0 1 ${o},${t+a}V${s-a}A${i},${a} 0 0 1 ${o-i},${s}H${e+i}A${i},${a} 0 0 1 ${e},${s-a}V${t+a}A${i},${a} 0 0 1 ${e+i},${t}Z`}function w0(e,t,r,n){return r<=0||n<=0?null:`M${e+r},${t}A${r},${n} 0 0 1 ${e},${t+n}A${r},${n} 0 0 1 ${e-r},${t}A${r},${n} 0 0 1 ${e},${t-n}A${r},${n} 0 0 1 ${e+r},${t}Z`}function Lx(e){let t=e.state;if(typeof t.d=="string")return t.d;let r=Ia(e);if(!r)return null;switch(r.kind){case"path":return r.d||null;case"rectangle":return r.pathData??Fx(r.x,r.y,r.width,r.height,r.rx,r.ry);case"circle":return w0(r.cx,r.cy,r.r,r.r);case"ellipse":return w0(r.cx,r.cy,r.rx,r.ry);case"line":return`M${r.x1},${r.y1}L${r.x2},${r.y2}`;case"polyline":{if(r.points.length<2||r.points.some(i=>!Number.isFinite(i.x)||!Number.isFinite(i.y)))return null;let n=r.points.map((i,a)=>`${a===0?"M":"L"}${i.x},${i.y}`).join("");return r.closed?`${n}Z`:n}default:return null}}var tD="http://www.w3.org/1999/xlink";function rD(e,t){let r=j(t,"attributeName");if(r===null)return null;let n=zT(e,t,r);return n?n.namespaceUri===null||n.namespaceUri===ye?n.localName:n.namespaceUri===tD&&n.localName==="href"?"href":null:null}var nD=new Map([["animate","animate"],["animatetransform","animateTransform"],["animatemotion","animateMotion"],["set","set"],["discard","discard"]]);function iD(e){return Object.freeze(Object.fromEntries(e.attributes.map(t=>[t.name,t.value])))}function aD(e,t){return e.usePath.length!==t.usePath.length?!1:e.usePath.every((r,n)=>r.sourceReferenceId===t.usePath[n]?.sourceReferenceId)}function oD(e,t,r){return e.occurrences.find(n=>n.correspondingSourceNodeId===r&&aD(n,t))??e.direct(r)}function sD(e,t,r,n){let i=yr(r);if(!i)return null;if(i.value===""||i.value==="#")return{status:"empty",sourceNodeId:null,occurrenceId:null};if(!i.value.startsWith("#"))return{status:"external",sourceNodeId:null,occurrenceId:null};let a=i.value.slice(1),o=e.index.resolveAuthoredId(a);if(!o)return{status:"missing",sourceNodeId:null,occurrenceId:null};let s=e.index.element(o.sourceNodeId);if(!s||s.namespaceUri!==ye)return{status:"invalid",sourceNodeId:o.sourceNodeId,occurrenceId:null};let l=oD(t,n,s.sourceNodeId);return{status:l?"resolved":"missing",sourceNodeId:s.sourceNodeId,occurrenceId:l?.occurrenceId??null}}function lD(e,t,r){let n=r.parentOccurrenceId?t.occurrence(r.parentOccurrenceId):null,i=n?e.index.element(n.correspondingSourceNodeId):null;return i?.localName.toLowerCase()==="textpath"&&n?.parentOccurrenceId&&(n=t.occurrence(n.parentOccurrenceId),i=n?e.index.element(n.correspondingSourceNodeId):null),i&&n?{status:"resolved",sourceNodeId:i.sourceNodeId,occurrenceId:n.occurrenceId}:{status:"missing",sourceNodeId:null,occurrenceId:null}}function uD(e,t,r,n){let i=e.index.children(r.sourceNodeId).find(f=>f.namespaceUri===ye&&f.localName.toLowerCase()==="mpath");if(!i)return{sourceNodeId:null,elementSourceNodeId:null,elementId:null,data:j(r,"path")};let a=j(i,"id"),o=yr(i);if(!o?.value.startsWith("#")||o.value.length<=1)return{sourceNodeId:null,elementSourceNodeId:i.sourceNodeId,elementId:a,data:null};let s=e.index.resolveAuthoredId(o.value.slice(1)),l=s?e.index.element(s.sourceNodeId):null;if(!l)return{sourceNodeId:s?.sourceNodeId??null,elementSourceNodeId:i.sourceNodeId,elementId:a,data:null};if(l.localName.toLowerCase()==="path")return{sourceNodeId:l.sourceNodeId,elementSourceNodeId:i.sourceNodeId,elementId:a,data:j(l,"d")};let u=t.direct(l.sourceNodeId),d=u?n?.candidate(u.occurrenceId):null;if(!d||d.status!=="materialized"||!d.canonicalType)return{sourceNodeId:l.sourceNodeId,elementSourceNodeId:i.sourceNodeId,elementId:a,data:null};let c={id:d.occurrenceId,type:d.canonicalType,state:d.state};return{sourceNodeId:l.sourceNodeId,elementSourceNodeId:i.sourceNodeId,elementId:a,data:Lx(c)}}function dD(e,t,r,n){let i=[];for(let a of t.occurrences){let o=e.index.element(a.correspondingSourceNodeId);if(!o||o.namespaceUri!==ye)continue;let s=nD.get(o.localName.toLowerCase());if(!s)continue;let l=yr(o),u=a.usePath.length===0?e.index.parent(o.sourceNodeId):null,d=sD(e,t,o,a)??lD(e,t,a),c=iD(o),f={values:c.values,from:c.from,to:c.to,by:c.by,additive:c.additive,accumulate:c.accumulate,dur:c.dur,keyTimes:c.keyTimes,calcMode:c.calcMode,keySplines:c.keySplines,repeatCount:c.repeatCount,repeatDur:c.repeatDur,fill:c.fill},p=s==="animateMotion"?uD(e,t,o,n):null,h=d.sourceNodeId?e.index.element(d.sourceNodeId):null,m=(d.occurrenceId?r.style(d.occurrenceId)?.cascadedValues.transform?.value:void 0)??(h?j(h,"transform"):null),g=Qb(f);i.push(Object.freeze({animationId:`smil:${a.occurrenceId}`,sourceNodeId:o.sourceNodeId,sourceElementOrder:o.elementOrder,occurrenceId:a.occurrenceId,kind:s,sourceAnimationId:j(o,"id"),sourceSmilPlacement:u?.sourceNodeId===e.root.sourceNodeId?"document":l&&u?.localName.toLowerCase()==="defs"?"defs":"target",sourceSmilParentTarget:!l,targetStatus:d.status,targetSourceNodeId:d.sourceNodeId,targetOccurrenceId:d.occurrenceId,attributeName:rD(e,o),attributes:c,duration:ex(f),additive:g,...s==="animateTransform"&&g==="replace"&&m!==null&&m.trim().toLowerCase()!=="none"?{replacesCarrierBase:!0}:{},fill:c.fill==="freeze"?"freeze":"remove",motionPathSourceNodeId:p?.sourceNodeId??null,motionPathElementSourceNodeId:p?.elementSourceNodeId??null,sourceMpathId:p?.elementId??null,motionPathData:p?.data??null}))}return Object.freeze(i)}function cD(e){let t=e.parsedEasing?Object.freeze({...e.parsedEasing,..."points"in e.parsedEasing?{points:Object.freeze([...e.parsedEasing.points])}:{}}):null;return Object.freeze({...e,parsedEasing:t})}function fD(e){let t=[];for(let r of e.elements){let n=r.resolvedValues,i=n.animation||_A(n);if(i)for(let[a,o]of qp(i).entries()){let s=wy(o);if(!s){let u=Yp(n["animation-name"],a);u&&u!=="none"&&(s=wy(`${o} ${u}`))}if(!s)continue;zA(s,n,a);let l=e.keyframesRule(s.name);!l||l.stops.length===0||t.push(Object.freeze({animationId:`css:${r.occurrenceId}:${a}`,sourceNodeId:r.correspondingSourceNodeId,occurrenceId:r.occurrenceId,animationIndex:a,animation:cD(s),keyframes:l}))}}return Object.freeze(t)}function I0(e){let t=new Map;for(let r of e){let n=t.get(r.occurrenceId)??[];n.push(r),t.set(r.occurrenceId,n)}for(let r of t.values())Object.freeze(r);return t}function pD(e,t,r,n){let i=dD(e,t,r,n.leafGeometry),a=fD(r),o=i.filter(d=>d.targetStatus!=="resolved").map(d=>{let c=e.index.element(d.sourceNodeId);return Object.freeze({severity:"warning",code:"unresolved-reference",source:n.source,entrypoint:n.entrypoint,capability:"smil-animation",sourceId:d.sourceAnimationId??void 0,sourceNodeId:d.sourceNodeId,occurrenceId:d.occurrenceId,elementName:c?.name,documentPath:e.index.sourcePath(d.sourceNodeId),message:`The SVG animation target is ${d.targetStatus} and cannot be materialized.`})});for(let d of i){if(d.attributeName!==null)continue;let c=e.index.element(d.sourceNodeId);!c||j(c,"attributeName")===null||o.push(Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"smil-animation",sourceId:d.sourceAnimationId??void 0,sourceNodeId:d.sourceNodeId,occurrenceId:d.occurrenceId,elementName:c.name,documentPath:e.index.sourcePath(d.sourceNodeId),message:`The animation target attribute ${j(c,"attributeName")} has no namespace binding in scope or names a foreign attribute, so it animates nothing.`}))}for(let d of a)for(let c of d.keyframes.stops){let f=c.properties.transform??c.properties["-webkit-transform"]??c.properties["-moz-transform"];if(f===void 0)continue;let p=bC(f);p&&o.push(Object.freeze({severity:"warning",code:p==="unsupported-perspective"?"unsupported-ingest-capability":"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"css-animation",sourceNodeId:d.sourceNodeId,occurrenceId:d.occurrenceId,documentPath:e.index.sourcePath(d.sourceNodeId),message:p==="unsupported-perspective"?"A projective CSS transform cannot be represented by the native affine timeline.":"A CSS transform keyframe has invalid function syntax and was not materialized."}))}let s=I0(i),l=I0(a),u=Object.freeze({smil:i,css:a,smilForOccurrence:d=>s.get(d)??Object.freeze([]),cssForOccurrence:d=>l.get(d)??Object.freeze([])});return Object.freeze({value:u,diagnostics:Object.freeze(o)})}var jd=Object.freeze({fontFamily:"Arial",fontSize:16,fontWeight:"normal",fontStyle:"normal",fontStretch:"normal",fontSizeAdjust:"none",fontVariant:"",fontVariantLigatures:"",fontVariantPosition:"",fontVariantCaps:"",fontVariantNumeric:"",fontVariantEastAsian:"",textDecoration:Object.freeze({underline:!1,strikethrough:!1,overline:!1}),textTransform:"none",baselineShift:"baseline",dominantBaseline:"auto",alignmentBaseline:"auto",writingMode:"horizontal-tb",whiteSpace:"pre-wrap",direction:"ltr",unicodeBidi:"normal",textAnchor:"start",letterSpacing:0,wordSpacing:0,lineHeight:1.2,fontVariationSettings:Object.freeze({}),fill:"#000000",fillOpacity:1,stroke:"none",strokeWidth:0,strokeOpacity:1}),Ed=Object.keys(jd);function ka(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function xn(e){return typeof e=="string"?e:void 0}function Tr(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string"&&e.trim()!==""){let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}}function Kn(e){return t=>typeof t=="string"&&e.includes(t)?t:void 0}function hD(e){if(e==="normal"||e==="bold"||e==="bolder"||e==="lighter")return e;let t=Tr(e);return t===400?"normal":t===700?"bold":t}function mD(e){return e==="baseline"||e==="super"||e==="sub"?e:Tr(e)}function Bx(e){if(typeof e=="string"){let r=e.toLowerCase();return{underline:r.includes("underline"),strikethrough:r.includes("line-through")||r.includes("strikethrough"),overline:r.includes("overline")}}if(!ka(e))return;let t={};return typeof e.underline=="boolean"&&(t.underline=e.underline),typeof e.strikethrough=="boolean"&&(t.strikethrough=e.strikethrough),typeof e.overline=="boolean"&&(t.overline=e.overline),t}function Vx(e){if(!ka(e))return;let t={};for(let[r,n]of Object.entries(e)){let i=Tr(n);i!==void 0&&(t[r]=i)}return t}var Ux={fontFamily:xn,fontSize:Tr,fontWeight:hD,fontStyle:Kn(["normal","italic","oblique"]),fontStretch:xn,fontSizeAdjust:xn,fontVariant:xn,fontVariantLigatures:xn,fontVariantPosition:xn,fontVariantCaps:xn,fontVariantNumeric:xn,fontVariantEastAsian:xn,textTransform:Kn(["none","capitalize","uppercase","lowercase"]),baselineShift:mD,dominantBaseline:Kn(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),alignmentBaseline:Kn(["auto","baseline","text-bottom","alphabetic","ideographic","middle","central","mathematical","hanging","text-top"]),writingMode:Kn(["horizontal-tb","vertical-rl","vertical-lr"]),whiteSpace:Kn(["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"]),direction:Kn(["ltr","rtl"]),unicodeBidi:Kn(["normal","embed","bidi-override","isolate","isolate-override","plaintext"]),textAnchor:Kn(["start","middle","end"]),letterSpacing:Tr,wordSpacing:Tr,lineHeight:Tr,fill:xn,fillOpacity:Tr,stroke:xn,strokeWidth:Tr,strokeOpacity:Tr};function ed(e,t){return{...e,...t,textDecoration:{...e.textDecoration,...t.textDecoration??{}},fontVariationSettings:{...t.fontVariationSettings??e.fontVariationSettings}}}function dh(e,t){let r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&e[n]===t[n])}function ya(e,t){for(let r of Ed)if(r==="textDecoration"){if(e.textDecoration.underline!==t.textDecoration.underline||e.textDecoration.strikethrough!==t.textDecoration.strikethrough||e.textDecoration.overline!==t.textDecoration.overline)return!1}else if(r==="fontVariationSettings"){if(!dh(e.fontVariationSettings,t.fontVariationSettings))return!1}else if(e[r]!==t[r])return!1;return!0}function gD(e,t){let r=Object.keys(e).sort(),n=Object.keys(t).sort();if(r.length!==n.length||r.some((i,a)=>i!==n[a]))return!1;for(let i of r)if(i==="textDecoration"){let a=e.textDecoration??{},o=t.textDecoration??{},s=new Set([...Object.keys(a),...Object.keys(o)]);for(let l of s){let u=l;if(a[u]!==o[u])return!1}}else if(i==="fontVariationSettings"){if(!dh(e.fontVariationSettings??{},t.fontVariationSettings??{}))return!1}else{let a=i;if(e[a]!==t[a])return!1}return!0}function k0(e,t){let r={};for(let i of Ed)i==="textDecoration"||i==="fontVariationSettings"||e[i]!==t[i]&&(r[i]=e[i]);let n={};return e.textDecoration.underline!==t.textDecoration.underline&&(n.underline=e.textDecoration.underline),e.textDecoration.strikethrough!==t.textDecoration.strikethrough&&(n.strikethrough=e.textDecoration.strikethrough),e.textDecoration.overline!==t.textDecoration.overline&&(n.overline=e.textDecoration.overline),Object.keys(n).length>0&&(r.textDecoration=n),dh(e.fontVariationSettings,t.fontVariationSettings)||(r.fontVariationSettings={...e.fontVariationSettings}),r}function Os(e,t=jd){let r=ka(e)?e:{},n={...t};for(let i of Ed){if(i==="textDecoration"||i==="fontVariationSettings")continue;let a=Ux[i](r[i]);a!==void 0&&(n[i]=a)}return n.textDecoration={...t.textDecoration,...Bx(r.textDecoration)??{}},n.fontVariationSettings={...Vx(r.fontVariationSettings)??t.fontVariationSettings},n}function yD(e){let t=ka(e)?e:{},r={};for(let n of Ed){if(n==="textDecoration"||n==="fontVariationSettings"||t[n]===void 0)continue;let i=Ux[n](t[n]);i!==void 0&&(r[n]=i)}if(t.textDecoration!==void 0){let n=Bx(t.textDecoration);n&&Object.keys(n).length>0&&(r.textDecoration=n)}if(t.fontVariationSettings!==void 0){let n=Vx(t.fontVariationSettings);n&&(r.fontVariationSettings=n)}return r}function vD(e){let t=[],r=0;for(;;){let n=e.indexOf(`
19
+ `,r);if(n===-1)return t.push({text:e.slice(r),start:r,end:e.length}),t;t.push({text:e.slice(r,n),start:r,end:n}),r=n+1}}function bD(e,t,r){return e.start===e.end?r&&e.start===t:e.start<=t&&t<e.end}function S0(e,t,r,n){let i=e;for(let a of t)bD(a,r,n)&&(i=ed(i,a.style));return i===e?ed(e,{}):i}function xD(e,t=jd){let r=ka(e)?e:{},n=Os(r.baseStyle,t),i=typeof r.text=="string"?r.text:"";return{text:i,runs:Gx(r.runs,i.length),baseStyle:n,lineHeight:Tr(r.lineHeight)??n.lineHeight}}function Gx(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!ka(n))continue;let i=Tr(n.start),a=Tr(n.end);if(i===void 0||a===void 0)continue;let o=Math.min(Math.max(Math.trunc(i),0),t),s=Math.min(Math.max(Math.trunc(a),0),t);o>s||r.push({start:o,end:s,style:yD(n.style)})}return r}function Xx(e){let t=typeof e.text=="string"?e.text:"",r=Os(e.baseStyle),n=Gx(e.runs,t.length),i=Tr(e.lineHeight)??r.lineHeight;return{lines:vD(t).map(a=>{if(a.text.length===0)return{segments:[{text:"",style:S0(r,n,a.start,!0)}]};let o=new Set([a.start,a.end]);for(let u of n)u.start!==u.end&&(u.start>a.start&&u.start<a.end&&o.add(u.start),u.end>a.start&&u.end<a.end&&o.add(u.end));let s=[...o].sort((u,d)=>u-d),l=[];for(let u=0;u<s.length-1;u++){let d=s[u],c=s[u+1],f=S0(r,n,d,!1),p=l[l.length-1];p&&ya(p.style,f)?p.text+=t.slice(d,c):l.push({text:t.slice(d,c),style:f})}return{segments:l}}),baseStyle:r,lineHeight:i}}function ch(e){let t=Os(e?.baseStyle),r=Tr(e?.lineHeight)??t.lineHeight,n=Array.isArray(e?.lines)?e.lines:[],i=n.length>0?n:[{segments:[]}],a=[],o=[],s=0;for(let d=0;d<i.length;d++){d>0&&(a.push(`
20
+ `),s+=1);let c=i[d]?.segments,f=Array.isArray(c)?c:[],p=s;for(let h of f){let m=typeof h?.text=="string"?h.text:"";if(m.length===0)continue;let g=Os(h?.style,t),v=k0(g,t);Object.keys(v).length>0&&o.push({start:s,end:s+m.length,style:v}),a.push(m),s+=m.length}if(s===p){let h=Os(f[0]?.style,t),m=k0(h,t);Object.keys(m).length>0&&o.push({start:p,end:p,style:m})}}let l=a.join(""),u=[];for(let d of o){let c=u[u.length-1];c!==void 0&&c.start!==c.end&&d.start!==d.end&&(c.end===d.start||c.end+1===d.start&&l.charAt(c.end)===`
21
+ `)&&gD(c.style,d.style)&&c?c.end=d.end:u.push({start:d.start,end:d.end,style:d.style})}return{text:l,runs:u,baseStyle:t,lineHeight:r}}function Wx(e){let t=e.richTextRuns;return ka(t)?xD(t):null}function wD(e){let t=[],r=0,n=0;for(let i of e)t.push({textOffset:r,glyphIndex:n,character:i}),r+=i.length,n+=1;return t}function Hx(e){let t=wD(e.text),r=new Array(t.length).fill(0),n=(a,o,s)=>{if(!s||s.length===0)return;let l=0;for(let u of t)u.textOffset<a||u.textOffset>=o||u.character===`
22
+ `||(r[u.glyphIndex]=s[Math.min(l,s.length-1)],l+=1)},i=a=>{for(let o of a)n(o.start,o.end,o.rotate),i(o.children)};return n(0,e.text.length,e.rotate),i(e.spans),r}function ID(e){let t=new Map,r=n=>{for(let i of n)i.rotate&&i.rotate.length>0&&t.set(i.spanId,i.rotate),r(i.children)};return r(e.spans),t}function kD(e,t){let r=[],n=0;for(let o of e){let s=t[n]?.rotate??0;n+=1,o!==`
23
+ `&&r.push(s)}if(r.length===0)return r;let i=r.length-1,a=r[i];for(;i>0&&r[i-1]===a;)i-=1;return i===0&&a===0?[]:r.slice(0,i+1)}function SD(e,t){let r=ID(e),n=(e.rotate?.length??0)>0||r.size>0;if(!t)return{mode:"authored-scopes",root:e.rotate??[],spans:r};let i=Hx(e),a=i.length===t.length&&i.every((o,s)=>o===t[s].rotate);return n&&a?{mode:"authored-scopes",root:e.rotate??[],spans:r}:{mode:"flattened-glyphs",root:kD(e.text,t),spans:new Map}}function $D(e,t){let r=e.index.element(t.correspondingSourceNodeId);if(!r||r.namespaceUri!==ye)return!1;let n=r.localName.toLowerCase();return n==="svg"||n==="symbol"}function jf(e,t){return Object.freeze({width:e,height:t})}function qx(e,t,r,n){let i=jf(n.viewport.width,n.viewport.height),a=new Map(t.occurrences.map(g=>[g.occurrenceId,g])),o=new Map,s=new Map,l=new Map,u=new Set,d=g=>{let v=o.get(g.occurrenceId);if(v)return v;let y=g.parentOccurrenceId?a.get(g.parentOccurrenceId):void 0,b=y?p(y):i;return o.set(g.occurrenceId,b),b},c=g=>{let v=l.get(g.occurrenceId);if(v!==void 0)return v;let y=g.parentOccurrenceId?a.get(g.parentOccurrenceId):void 0,b=y?c(y):n.rootFontSize,I=r.value(g.occurrenceId,"font-size"),x=d(g),k=!I||I==="medium"?b:it(I,{percentBasis:b,viewportWidth:x.width,viewportHeight:x.height,fontSize:b,rootFontSize:n.rootFontSize}),$=k!==void 0&&k>=0?k:b;return l.set(g.occurrenceId,$),$},f=(g,v,y)=>{let b=e.index.element(g.correspondingSourceNodeId);if(!b)return v==="width"?y.width:y.height;let I=j(b,v),x=g.usePath.at(-1);if(x?.targetSourceNodeId===g.correspondingSourceNodeId){let A=e.index.element(x.useSourceNodeId),S=A?j(A,v):null;S!==null&&(I=S)}if(I===null||I.trim().toLowerCase()==="auto")return v==="width"?y.width:y.height;let k=c(g),$=it(I,{percentBasis:v==="width"?y.width:y.height,viewportWidth:y.width,viewportHeight:y.height,fontSize:k,rootFontSize:n.rootFontSize});return $!==void 0&&$>=0?$:v==="width"?y.width:y.height},p=g=>{let v=s.get(g.occurrenceId);if(v)return v;let y=d(g);if(!$D(e,g))return s.set(g.occurrenceId,y),y;if(u.has(g.occurrenceId))throw new Error(`Circular SVG viewport context at ${g.occurrenceId}.`);u.add(g.occurrenceId);let b=e.index.element(g.correspondingSourceNodeId);if(g.usePath.length===0&&g.correspondingSourceNodeId===e.root.sourceNodeId)return u.delete(g.occurrenceId),s.set(g.occurrenceId,i),i;let I=j(b,"viewBox"),x=I===null?null:Mn(I),k=x&&x.width>=0&&x.height>=0?jf(x.width,x.height):jf(f(g,"width",y),f(g,"height",y));return u.delete(g.occurrenceId),s.set(g.occurrenceId,k),k},h=t.occurrences.map(g=>Object.freeze({occurrenceId:g.occurrenceId,sourceNodeId:g.correspondingSourceNodeId,viewport:d(g),childViewport:p(g)})),m=new Map(h.map(g=>[g.occurrenceId,g]));return Object.freeze({contexts:Object.freeze(h),viewport(g){return m.get(g)?.viewport??null},childViewport(g){return m.get(g)?.childViewport??null},fontSize(g){let v=a.get(g);return v?c(v):null}})}function Yx(e,t){for(let r of e){if(r.sourceNodeId===t)return r.sourceNodeId;let n=Yx(r.children,t);if(n)return n}return null}function ND(e,t,r){let n=e.occurrence(r);for(;n;){if(n.occurrenceId===t)return!0;n=n.parentOccurrenceId?e.occurrence(n.parentOccurrenceId):null}return!1}function $0(e,t,r){let n=t.occurrence(r);if(!n)return null;for(let i of e.candidates){if(i.canonicalType!=="text"||!i.textSpanTree||!ND(t,i.occurrenceId,r))continue;let a=Yx(i.textSpanTree.spans,n.correspondingSourceNodeId);if(a)return Object.freeze({textOccurrenceId:i.occurrenceId,spanId:a})}return null}var MD=new Set(["circle","ellipse","flowroot","foreignobject","image","line","path","polygon","polyline","rect","text"]),AD=Object.freeze({});function td(e){if(Array.isArray(e))return Object.freeze(e.map(td));if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=td(n);return Object.freeze(t)}return e}function Kx(e){return td(e)}function CD(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=e[n]-t[n];if(i!==0)return i}return e.length-t.length}function OD(e,t){return CD(e.orderKey,t.orderKey)||e.productIndex-t.productIndex||e.occurrenceId.localeCompare(t.occurrenceId)}function TD(e,t,r,n,i){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"geometry",sourceId:j(r,"id")??void 0,sourceNodeId:r.sourceNodeId,occurrenceId:t.occurrenceId,elementName:r.name,documentPath:e.index.sourcePath(r.sourceNodeId),message:i})}function Mt(e,t,r,n,i={},a){return Object.freeze({occurrenceId:e.occurrenceId,sourceNodeId:t.sourceNodeId,sourceId:j(t,"id"),elementName:t.localName,canonicalType:r,status:n,state:Object.keys(i).length===0?AD:Kx(i),...a?{textSpanTree:td(a)}:{}})}function ws(e,t,r,n){let i=e.style(t.occurrenceId);return i?.cascadedValues[n]?i.resolvedValues[n]??i.specifiedValues[n]??null:j(r,n)}function PD(e,t,r){let n=e.value(t.occurrenceId,"font-size");if(!n||n==="medium")return r.rootFontSize;let i=it(n,{percentBasis:r.rootFontSize,viewportWidth:r.viewport.width,viewportHeight:r.viewport.height,fontSize:r.rootFontSize,rootFontSize:r.rootFontSize});return i!==void 0&&i>=0?i:r.rootFontSize}function wp(e,t,r){return{percentBasis:e==="x"?r.viewport.width:e==="y"?r.viewport.height:Math.hypot(r.viewport.width,r.viewport.height)/Math.SQRT2,viewportWidth:r.viewport.width,viewportHeight:r.viewport.height,fontSize:t,rootFontSize:r.rootFontSize}}function Ip(e){if(e===null)return null;let t=/\S+/.exec(e.trim());return t?t[0].replace(/,$/,""):null}function N0(e,t,r,n,i,a,o){return it(Ip(ws(e,t,r,n)),wp(i,a,o))}function Is(e){if(e===null||e.trim()==="")return;let t=Number(e.trim());return Number.isFinite(t)?t:void 0}function DD(e){if(!e)return{points:[],odd:!1};let t=(e.match(/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/g)??[]).map(Number).filter(Number.isFinite),r=t.length%2!==0,n=[];for(let i=0;i+1<t.length;i+=2)n.push({x:t[i],y:t[i+1]});return{points:n,odd:r}}function jD(e){let t=j(e,"transform");if(!t||t.trim()==="")return{rotation:0};let r=wa(t);return fn(r)?{rotation:0}:{transformMatrix:cn(r)}}function zn(e,t,r,n){let i=e.type===e.type.toLowerCase();return[e.params[t]+(i?r:0),e.params[t+1]+(i?n:0)]}function Zx(e){let t=[],r=0,n=0,i=0,a=0,o=0,s=0,l="",u=!1,d=0,c=new Set;for(let m of e){let g=m.type.toUpperCase(),v=m.type===m.type.toLowerCase(),y=l.toUpperCase()==="Z",b=t.length;if(!(g==="B"||g==="R")){if(g==="Z"){r=i,n=a,u=!0,c.add(d),l=m.type;continue}if(g==="M"){let[I,x]=zn(m,0,r,n),k={x:I,y:x,pointType:"corner",...v?{moveRelative:!0}:{}};t.length>0&&(k.isSubpathStart=!0),t.push(k),d=t.length-1,r=i=I,n=a=x,l=m.type;continue}if(g==="H")r=m.params[0]+(v?r:0),t.push({x:r,y:n,pointType:"corner",segmentType:"HORIZONTAL"});else if(g==="V")n=m.params[0]+(v?n:0),t.push({x:r,y:n,pointType:"corner",segmentType:"VERTICAL"});else if(g==="L")[r,n]=zn(m,0,r,n),t.push({x:r,y:n,pointType:"corner",segmentType:"LINEAR"});else if(g==="C"){let I=r,x=n,[k,$]=zn(m,0,I,x),[A,S]=zn(m,2,I,x),[N,T]=zn(m,4,I,x),z=t.at(-1);z&&(z.pointType="smooth",z.handleOut={x:k,y:$}),t.push({x:N,y:T,handleIn:{x:A,y:S},pointType:"smooth",segmentType:"CUBIC"}),r=N,n=T,o=A,s=S}else if(g==="S"){let I=r,x=n,[k,$]=zn(m,0,I,x),[A,S]=zn(m,2,I,x),N=t.at(-1);N&&(N.pointType="smooth",N.handleOut=/^[CcSs]$/.test(l)?{x:2*I-o,y:2*x-s}:{x:I,y:x}),t.push({x:A,y:S,handleIn:{x:k,y:$},pointType:"smooth",segmentType:"SMOOTH_CUBIC"}),r=A,n=S,o=k,s=$}else if(g==="Q"||g==="T"){let I=r,x=n,k=g==="T",[$,A]=k?/^[QqTt]$/.test(l)?[2*I-o,2*x-s]:[I,x]:zn(m,0,I,x),[S,N]=zn(m,k?0:2,I,x),T=t.at(-1);T&&(T.pointType="smooth",T.handleOut={x:$,y:A});let z={x:S,y:N,pointType:"smooth",segmentType:k?"SMOOTH_QUADRATIC":"QUADRATIC"};t.push(z),r=S,n=N,o=$,s=A}else if(g==="A"){let I=r,x=n,[k,$]=zn(m,5,I,x),A=Math.abs(m.params[0]),S=Math.abs(m.params[1]),N={x:k,y:$,pointType:"corner"};A!==0&&S!==0&&(k!==r||$!==n)&&(N.segmentType="ARC",N.arcParams={rx:A,ry:S,rotation:m.params[2],largeArc:m.params[3]===1,sweep:m.params[4]===1}),(k!==r||$!==n)&&t.push(N),r=k,n=$}v&&t.length>b&&(t[t.length-1].segmentRelative=!0),y&&t.length>b&&(t[b].isSubpathStart=!0,d=b),l=m.type}}let f=t.map((m,g)=>g===0||m.isSubpathStart?g:-1).filter(m=>m>=0),p=f.some(m=>c.has(m)),h=f.some(m=>!c.has(m));if(p&&h)for(let m of f)t[m].subpathClosed=c.has(m);return{points:t,closed:u}}function ED(e){return e.replace(/[\t\n\r ]+/g," ").trim()}function Jx(e){let t=[];for(let r of e.children)if(r.kind==="text"||r.kind==="cdata"){let n=ED(r.value);n&&t.push(n)}else if(r.kind==="element"){let n=Jx(r);n&&t.push(n)}return t.join(" ")}function zD(e,t){return e.usePath.length!==t.usePath.length?!1:e.usePath.every((r,n)=>r.sourceReferenceId===t.usePath[n]?.sourceReferenceId)}function Qx(e,t,r){return e.occurrences.find(n=>n.correspondingSourceNodeId===r&&zD(n,t))??e.direct(r)}function _D(e,t){let r=t;for(;r;){let n=r.attributes.find(i=>i.prefix==="xml"&&i.localName==="space")?.value;if(n)return n;r=e.index.parent(r.sourceNodeId)}return null}function RD(e,t,r,n){let i=n.style(r.occurrenceId)?.cascadedValues["white-space"]?n.value(r.occurrenceId,"white-space"):null;return i==="pre"||i==="pre-wrap"||i==="break-spaces"?{mode:"preserve-xml-space",authored:i}:i==="pre-line"?{mode:"preserve-newlines",authored:i}:_D(e,t)==="preserve"?{mode:"preserve-xml-space",authored:"pre"}:{mode:"collapse",authored:i==="normal"?"normal":null}}function zo(e,t){return t==="preserve-newlines"||t==="preserve-xml-space"?e.replace(/\r\n?/g,`
24
+ `):t==="preserve-spaces"?e.replace(/\r?\n[ \t\r]*/g,""):e.replace(/[ \t\r\n]+/g," ")}function $o(e,t){return e.children.map(r=>r.kind==="text"||r.kind==="cdata"?zo(r.value,t):r.kind==="element"?$o(r,t):"").join("")}function FD(e,t,r,n){if(n==="preserve-newlines")return;let i="",a=h=>{let m=[];for(let g of h.children){if(g.kind==="text"||g.kind==="cdata"){i+=zo(g.value,n);continue}if(g.kind!=="element"||g.localName.toLowerCase()!=="tspan")continue;let v=i.length,y=a(g);m.push({start:v,end:i.length,sourceNodeId:g.sourceNodeId,...ks(j(g,"rotate")).length>0?{rotate:ks(j(g,"rotate"))}:{},children:y})}return m},o=a(t);if(o.length===0)return;let s=new Map;if(r.lines.forEach((h,m)=>{if(!h.sourceNodeId)return;let g=e.index.element(h.sourceNodeId),v=h.sourceNodeId;for(;g&&g.sourceNodeId!==t.sourceNodeId;)zd(g,"sodipodi","role")==="line"&&(v=g.sourceNodeId),g=e.index.parent(g.sourceNodeId);s.set(v,m)}),n==="preserve-xml-space"){let h=g=>{let v=s.get(g.sourceNodeId);return{start:g.start,end:g.end,sourceNodeId:g.sourceNodeId,...v===void 0?{}:{lineIndex:v},...g.rotate?{rotate:g.rotate}:{},children:g.children.map(h)}},m=ks(j(t,"rotate"));return{text:i,...m.length>0?{rotate:m}:{},spans:o.map(h)}}let l=r.text.replaceAll(`
25
+ `,""),u=new Array(i.length+1).fill(0),d=0;for(let h=0;h<i.length;h++){let m=i[h];if(m===" "&&n==="collapse")l[d]===" "&&(d+=1);else{if(m!==l[d])return;d+=1}u[h+1]=d}if(d!==l.length)return;let c=(h,m)=>{let g=0;for(let v=0;v<r.text.length;v++){if(g===h){if(m==="end")return v;for(;r.text[v]===`
26
+ `;)v+=1;return v}r.text[v]!==`
27
+ `&&(g+=1)}return r.text.length},f=h=>{let m=s.get(h.sourceNodeId);return{start:c(u[h.start]??0,"start"),end:c(u[h.end]??l.length,"end"),sourceNodeId:h.sourceNodeId,...m===void 0?{}:{lineIndex:m},...h.rotate?{rotate:h.rotate}:{},children:h.children.map(f)}},p=ks(j(t,"rotate"));return{text:r.text,...p.length>0?{rotate:p}:{},spans:o.map(f)}}function zd(e,t,r){return e.attributes.find(n=>n.prefix===t&&n.localName===r)?.value??null}function Ct(e,t,r,n,i,a=n*.5){let o=Nd(e).at(0);if(o)return xa(o,{percentBasis:t==="x"?r.width:r.height,viewportWidth:r.width,viewportHeight:r.height,fontSize:n,rootFontSize:i,xHeight:a})}function LD(e,t,r,n,i,a){let o=e.children.filter(y=>y.kind==="element"&&y.localName.toLowerCase()==="tspan"),s=y=>zo(y,t);if(o.length===0){let y=s($o(e,t));t==="collapse"&&(y=y.replace(/ {2,}/g," ").replace(/^ +| +$/g,""));let b=y.split(`
28
+ `).map(I=>({text:I,x:0,dy:0,y:null,sourceNodeId:null}));return{text:y,lines:b,linePositions:null}}let l=.001,u=Ct(j(e,"x"),"x",r,n,i,a)??0,d=Ct(j(e,"y"),"y",r,n,i,a)??null,c=[],f=!1,p=(y,b,I)=>{if(t!=="collapse")return y;let x=y.replace(/ {2,}/g," ");return b&&(x=x.replace(/^ +/,"")),I?x.replace(/ +$/,""):x},h=(y,b,I,x,k,$,A,S,N)=>{if(!y)return;let T=x===null?0:(Ct(x,"x",r,n,i,a)??u)-u,z=t==="preserve-newlines"?y.split(`
29
+ `):[y];for(let C=0;C<z.length;C++){let O=z[C],E=C>0,_=C===0&&b||E;if(!(!O&&!E)){if(_&&f){if(I){let ie=c.at(-1);ie&&(ie.trimEnd=!0)}let U=C===0?T:0,V=C===0?k:0,q=C===0?A:null,G=C===0&&x!==null?Ct(x,"x",r,n,i,a):void 0,H=C===0&&$!==null?Ct($,"y",r,n,i,a):void 0,W=C===0&&S!==null?Ct(S,"y",r,n,i,a):void 0,B={...G!==void 0&&U===G-u?{x:{raw:x,resolved:G}}:{},...H!==void 0&&V===H?{dy:{raw:$,resolved:H}}:{},...W!==void 0&&q===W?{y:{raw:S,resolved:W}}:{}};c.push({text:O,x:U,dy:V,y:q,...Object.keys(B).length>0?{authored:B}:{},sourceNodeId:C===0?N:null})}else if(f)c[c.length-1].text+=O;else{let U=C===0?T:0,V=C===0?A:null,q=C===0&&x!==null?Ct(x,"x",r,n,i,a):void 0,G=C===0&&S!==null?Ct(S,"y",r,n,i,a):void 0,H={...q!==void 0&&U===q-u?{x:{raw:x,resolved:q}}:{},...G!==void 0&&V===G?{y:{raw:S,resolved:G}}:{}};c.push({text:O,x:U,dy:0,y:V,...Object.keys(H).length>0?{authored:H}:{},sourceNodeId:C===0?N:null})}O&&(f=!0)}}},m=y=>{let b=j(y,"x");if(zd(y,"sodipodi","role")==="line"){let k=Ct(j(y,"y"),"y",r,n,i,a),$=k!==void 0&&d!==null&&Math.abs(k-d)>.5?k-d:0;return{brk:!0,x:b,dy:$,dyRaw:null,y:k??null,yRaw:j(y,"y"),trimPreviousLine:!0}}let I=j(y,"dy");if(I!==null){let k=Ct(I,"y",r,n,i,a)??0;if(k>l||k<-l&&b!==null)return{brk:!0,x:b,dy:k,dyRaw:I,y:null,yRaw:null,trimPreviousLine:!1}}let x=Ct(j(y,"y"),"y",r,n,i,a);if(x!==void 0&&!f)return{brk:!0,x:b,dy:0,dyRaw:null,y:x,yRaw:j(y,"y"),trimPreviousLine:!1};if(x!==void 0&&d!==null&&Math.abs(x-d)>.5)return{brk:!0,x:b,dy:x-d,dyRaw:null,y:x,yRaw:j(y,"y"),trimPreviousLine:!1};if(b!==null&&f){let k=Ct(b,"x",r,n,i,a);if(k!==void 0&&k<=u+.5)return{brk:!0,x:b,dy:0,dyRaw:null,y:null,yRaw:null,trimPreviousLine:!1}}return{brk:!1,x:null,dy:0,dyRaw:null,y:null,yRaw:null,trimPreviousLine:!1}},g=(y,b)=>{let I=!1;for(let x of y.children){if(x.kind==="text"||x.kind==="cdata"){let N=s(x.value);if(!N)continue;if(t!=="preserve-newlines"&&/^ +$/.test(N)){if(f&&c.length>0){let z=c[c.length-1].text;t==="collapse"?z.endsWith(" ")||(c[c.length-1].text+=" "):c[c.length-1].text+=N}continue}let T=b.active&&!I;h(N,T,T?b.trimPreviousLine:!1,T?b.x:null,T?b.dy:0,T?b.dyRaw:null,T?b.y:null,T?b.yRaw:null,T?b.sourceNodeId:null),I=!0;continue}if(x.kind!=="element"||x.localName.toLowerCase()!=="tspan")continue;let k=m(x),$=Ct(j(x,"y"),"y",r,n,i,a);$!==void 0&&(d=$);let A=k.brk&&!(b.active&&!I),S={active:b.active&&!I||A,trimPreviousLine:A?k.trimPreviousLine:b.active&&!I?b.trimPreviousLine:!1,x:A?k.x:b.active&&!I?b.x:null,dy:A?k.dy:b.active&&!I?b.dy:0,dyRaw:A?k.dyRaw:b.active&&!I?b.dyRaw:null,y:A?k.y:b.active&&!I?b.y:null,yRaw:A?k.yRaw:b.active&&!I?b.yRaw:null,sourceNodeId:A?x.sourceNodeId:f?b.active&&!I?b.sourceNodeId:null:b.sourceNodeId??x.sourceNodeId};x.children.some(N=>N.kind==="element"&&N.localName.toLowerCase()==="tspan")?g(x,S):h(s($o(x,t)),S.active,S.trimPreviousLine,S.x,S.dy,S.dyRaw,S.y,S.yRaw,S.sourceNodeId),I=!0}};g(e,{active:!1,trimPreviousLine:!1,x:null,dy:0,dyRaw:null,y:null,yRaw:null,sourceNodeId:null});for(let y=0;y<c.length;y++)c[y].text=p(c[y].text,y===0,y===c.length-1||c[y].trimEnd===!0);let v=c.some((y,b)=>y.sourceNodeId!==null||b>0&&Math.abs(y.dy)>l||Math.abs(y.x)>l)?c.map(y=>({x:y.x,dy:y.dy,...y.y===null?{}:{y:y.y},...y.authored?{authored:y.authored}:{},sourceNodeId:y.sourceNodeId})):null;return{text:c.map(y=>y.text).join(`
30
+ `),lines:c,linePositions:v}}function ew(e){return e&&e.split(",").map(t=>t.trim().replace(/^['"]|['"]$/g,"").trim()).filter(Boolean).join(", ")||null}function BD(e,t,r,n,i,a){let o=fo(e,t,r,"font-size"),s=si(o);return s!==void 0&&s>=0?s:n}function M0(e,t,r,n){let i=r;for(;i;){if(e.style(i.occurrenceId)?.cascadedValues[n])return!0;i=i.parentOccurrenceId?t.occurrence(i.parentOccurrenceId)??void 0:void 0}return!1}function fo(e,t,r,n){let i=j(r,n),a=e.style(t.occurrenceId),o=a?.cascadedValues[n];return o?a?.specifiedValues[n]??o.value:i!==null?i:a?.resolvedValues[n]??null}function tw(e){if(!e)return 400;if(e==="normal"||e==="bold"||e==="bolder"||e==="lighter")return e;let t=Number(e);return Number.isFinite(t)?t:400}function VD(e){let t=tw(e);return t===400||t==="normal"?"normal":t===700||t==="bold"?"bold":t}function rd(e,t,r){let n=N=>t?e.value(t.occurrenceId,N):null,i=n("text-decoration")?.toLowerCase()??"",a=ew(n("font-family"))??"Arial",o=n("font-style"),s=o==="italic"||o==="oblique"?o:"normal",l=n("line-height"),u=l?Number(l):NaN,d=n("fill"),c=(N,T)=>si(n(N))??T,f=n("font-variant")??"",p=n("baseline-shift"),h=p?si(p):void 0,m=p==="baseline"||p==="super"||p==="sub"?p:h??"baseline",g=n("dominant-baseline"),v=new Set(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),y=n("writing-mode"),b=y==="tb"||y==="tb-rl"?"vertical-rl":y==="lr"||y==="lr-tb"||y==="rl"||y==="rl-tb"?"horizontal-tb":y,I=n("direction"),x=n("unicode-bidi"),k=n("text-anchor"),$=n("text-transform"),A=n("alignment-baseline"),S=new Set(["auto","baseline","text-bottom","alphabetic","ideographic","middle","central","mathematical","hanging","text-top"]);return{...jd,textDecoration:{underline:i.includes("underline"),strikethrough:i.includes("line-through"),overline:i.includes("overline")},fontVariationSettings:{},fontFamily:a,fontSize:r,fontWeight:VD(n("font-weight")),fontStyle:s,fontStretch:n("font-stretch")??"normal",fontSizeAdjust:n("font-size-adjust")??"none",fontVariant:f,fontVariantLigatures:n("font-variant-ligatures")??"",fontVariantPosition:n("font-variant-position")??"",fontVariantCaps:n("font-variant-caps")??"",fontVariantNumeric:n("font-variant-numeric")??"",fontVariantEastAsian:n("font-variant-east-asian")??"",fill:!d||d.toLowerCase()==="black"?"#000000":d,stroke:n("stroke")??"none",lineHeight:Number.isFinite(u)?u:1.2,textTransform:$==="capitalize"||$==="uppercase"||$==="lowercase"?$:"none",baselineShift:m,dominantBaseline:v.has(g)?g:"auto",alignmentBaseline:S.has(A)?A:"auto",writingMode:b==="vertical-rl"||b==="vertical-lr"?b:"horizontal-tb",whiteSpace:n("white-space")==="pre"||n("white-space")==="pre-wrap"||n("white-space")==="pre-line"||n("white-space")==="nowrap"||n("white-space")==="break-spaces"?n("white-space"):"normal",direction:I==="rtl"?"rtl":"ltr",unicodeBidi:x==="embed"||x==="bidi-override"||x==="isolate"||x==="isolate-override"||x==="plaintext"?x:"normal",textAnchor:k==="middle"||k==="end"?k:"start",letterSpacing:c("letter-spacing",0),wordSpacing:c("word-spacing",0),fillOpacity:Number(n("fill-opacity")??1),strokeWidth:c("stroke-width",0),strokeOpacity:Number(n("stroke-opacity")??1)}}function rw(e,t,r,n,i,a){let o=e.style(t.occurrenceId)?.cascadedValues["font-size"];if(!o)return r;let s=o.value.trim().toLowerCase();if(s==="inherit"||s==="unset")return r;if(s==="initial"||s==="revert"||s==="revert-layer"||s==="medium")return a;let l=e.value(t.occurrenceId,"font-size"),u=it(l,{percentBasis:r,viewportWidth:i.width,viewportHeight:i.height,fontSize:r,rootFontSize:a,xHeight:n});return u!==void 0&&u>=0?u:r}function nw(e,t,r,n,i){let a=i?.measureXHeight(e.fontFamily,t);return a!==void 0&&Number.isFinite(a)&&a>=0?a:r>0?n*(t/r):t*.5}function UD(e){return kp(e).filter(t=>t.localName.toLowerCase()==="tspan"&&!t.children.some(r=>r.kind==="element"&&r.localName.toLowerCase()==="tspan"))}function yu(e,t,r,n,i,a){return e?Nd(e).map(o=>({value:xa(o,{percentBasis:t==="x"?r.width:r.height,viewportWidth:r.width,viewportHeight:r.height,fontSize:n,rootFontSize:i,xHeight:a})??null,raw:o.unit===""||o.unit==="px"?null:`${o.value}${o.unit}`})):[]}function ks(e){if(!e)return[];let t=e.trim().split(/[\s,]+/).filter(Boolean),r=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;return t.every(n=>r.test(n))?t.map(Number):[]}function GD(e,t,r,n,i,a,o,s){let l=UD(e),u=l.length>0?l:[e],d=Array.from(t,()=>({x:null,y:null,dx:0,dy:0,rotate:0})),c=0,f=!1;for(let p of u){let h=zo($o(p,r),r),m=l.length>0?Math.max(c,t.indexOf(h,c)):0,g=yu(j(p,"dx"),"x",n,i,a,o),v=yu(j(p,"dy"),"y",n,i,a,o),y=yu(j(p,"x"),"x",n,i,a,o),b=yu(j(p,"y"),"y",n,i,a,o),I=ks(j(p,"rotate")),x=I.at(-1)??0,k=g.length>1||v.length>1||y.length>1||b.length>1||I.length>1,$=zd(p,"sodipodi","role")==="line",A=v[0]?.value,S=l.length>0&&!k&&($||A!=null&&(A>.001||A<-.001&&j(p,"x")!==null));for(let N=0;N<h.length&&m+N<d.length;N++){let T=d[m+N],z=l.length===0,C=S?null:z?N>0?y[N]?.value??null:null:k?y[N]?.value??null:N===0?y[0]?.value??null:null,O=S?null:z?N>0?b[N]?.value??null:null:k?b[N]?.value??null:N===0?b[0]?.value??null:null,E=S?0:k?g[N]?.value??0:N===0?g[0]?.value??0:0,_=S?0:k?v[N]?.value??0:N===0?v[0]?.value??0:0,U=I[N]??x;Object.assign(T,{x:C,y:O,dx:E,dy:_,rotate:U});let V={},q=!S&&!(z&&N===0)&&(k?N<y.length:N===0&&y.length>0),G=!S&&!(z&&N===0)&&(k?N<b.length:N===0&&b.length>0),H=!S&&(k?N<g.length:N===0&&g.length>0),W=!S&&(k?N<v.length:N===0&&v.length>0);q&&(V.x=!0),G&&(V.y=!0),H&&(V.dx=!0),W&&(V.dy=!0),!S&&N<I.length&&(V.rotate=!0),Object.keys(V).length>0&&(T.authored=V);let B={},ie=z&&N===0?null:k?y[N]?.raw:N===0?y[0]?.raw:null,Y=z&&N===0?null:k?b[N]?.raw:N===0?b[0]?.raw:null,X=k?g[N]?.raw:N===0?g[0]?.raw:null,Z=k?v[N]?.raw:N===0?v[0]?.raw:null;!S&&ie&&(B.x=ie),!S&&Y&&(B.y=Y),!S&&X&&(B.dx=X),!S&&Z&&(B.dy=Z),Object.keys(B).length>0&&(T.raw=B),(C!==null||O!==null||E!==0||_!==0||U!==0||Object.keys(V).length>0)&&(f=!0)}c=Math.max(c,m+h.length)}if(s){let p=x=>({spanId:x.sourceNodeId,start:x.start,end:x.end,...x.rotate?{rotate:[...x.rotate]}:{},children:x.children.map(p)}),h={text:s.text,...s.rotate?{rotate:[...s.rotate]}:{},spans:s.spans.map(p)},m=Hx(h);d.forEach((x,k)=>{x.rotate=m[k]??0;let $=x.authored;$&&(delete $.rotate,Object.keys($).length===0&&delete x.authored)});let g=[],v=0,y=0;for(let x of h.text)g.push({textOffset:v,glyphIndex:y,character:x}),v+=x.length,y+=1;let b=(x,k,$)=>{if(!$||$.length===0)return;let A=0;for(let S of g){if(S.textOffset<x||S.textOffset>=k||S.character===`
31
+ `)continue;if(A>=$.length)break;let N=d[S.glyphIndex];N.authored={...N.authored??{},rotate:!0},A+=1}f=!0},I=x=>{for(let k of x)b(k.start,k.end,k.rotate),I(k.children)};b(0,h.text.length,h.rotate),I(h.spans)}return f?d:null}function XD(e,t,r){let n=t.children.find(m=>m.kind==="element"&&m.localName.toLowerCase()==="textpath");if(!n)return{isTextPath:!1};let i={isTextPath:!1},a=j(n,"side");a==="right"&&(i.textPathSide=a);let o=j(n,"method");(o==="align"||o==="stretch")&&(i.textPathMethod=o);let s=j(n,"spacing");(s==="auto"||s==="exact")&&(i.textPathSpacing=s);let l=j(n,"startOffset");if(l){let m=Number.parseFloat(l);Number.isFinite(m)&&(i.textPathStartOffset=m,i.textPathStartOffsetUnit=l.trim().endsWith("%")?"%":"user")}let u=j(n,"lengthAdjust");(u==="spacing"||u==="spacingAndGlyphs")&&(i.textPathLengthAdjust=u);let d=j(n,"textLength");if(d){let m=Number.parseFloat(d);Number.isFinite(m)&&m>=0&&(i.textPathLength=m,i.textPathLengthUnit=d.trim().endsWith("%")?"%":"user")}let c=j(n,"path");c&&(i.textPathInlineFormat="path-attr");let f=null;if(!c){let m=yr(n),g=m?.value,v="href";if(m===null){let y=n.children.find(b=>b.kind==="element"&&b.localName.toLowerCase()==="mpath");g=y?yr(y)?.value:void 0,y&&(v="mpath")}if(g?.startsWith("#")){let y=e.index.resolveAuthoredId(g.slice(1));f=y?e.index.element(y.sourceNodeId):null,y&&(i.textPathImportReference={targetSourceNodeId:y.sourceNodeId,element:v}),c=f?j(f,"d"):null}}if(!c)return i;let p=Zx(Od(c).commands);if(p.points.length<2)return i;i.isTextPath=!0,i.textPathPoints=p.points;let h=Is(f?j(f,"pathLength"):null);return h!==void 0&&h>=0&&(i.textPathPathLength=h),i.x=-r/2,i.y=-r/2,i}function WD(e,t,r,n,i,a,o,s,l,u,d){let c=y=>({...y,whiteSpace:"pre"}),f=c(rd(n,t,a)),p=[{segments:[]}],h=!1,m=(y,b)=>{zo(y,"preserve-xml-space").split(`
32
+ `).forEach((I,x)=>{x>0&&p.push({segments:[]}),I.length>0&&p[p.length-1].segments.push({text:I,style:b})})},g=(y,b,I,x)=>{for(let k of y.children){if(k.kind==="text"||k.kind==="cdata"){m(k.value,b);continue}if(k.kind!=="element"||k.localName.toLowerCase()!=="tspan")continue;let $=Qx(r,t,k.sourceNodeId),A=$?rw(n,$,I,x,s,l):I,S=c($?rd(n,$,A):b),N=nw(S,A,I,x,d);ya(S,f)||(h=!0),g(k,S,A,N)}};g(e,f,a,u);let v=p.map(y=>y.segments.map(b=>b.text).join("")).join(`
33
+ `);return!h||v!==i?null:{lines:p,baseStyle:f,lineHeight:o}}function HD(e,t,r,n,i,a,o,s,l,u,d,c){if(!e.children.some(k=>k.kind==="element"&&k.localName.toLowerCase()==="tspan"))return null;if(a==="preserve-xml-space")return WD(e,t,r,n,i,o,s,l,u,d,c);let f=rd(n,t,o),p=[{segments:[]}],h=!1,m=!1,g=Ct(j(e,"y"),"y",l,o,u,d)??null,v=Ct(j(e,"x"),"x",l,o,u,d)??0,y=k=>zo(k,a),b=(k,$,A,S)=>{if(!k)return;let N=a==="preserve-newlines"?k.split(`
34
+ `):[k];for(let T=0;T<N.length;T++){let z=N[T],C=T>0;if(!z&&!C)continue;let O={text:z,style:ed(f,$)};(T===0&&A||C)&&h?(S&&(p[p.length-1].trimEnd=!0),p.push({segments:[O]})):p[p.length-1].segments.push(O),z&&(h=!0),ya($,f)||(m=!0)}},I=(k,$,A)=>{if(zd(k,"sodipodi","role")==="line")return{starts:!0,trimPrevious:!0};let S=j(k,"x"),N=j(k,"dy");if(N!==null){let z=Ct(N,"y",l,$,u,A)??0;if(z>.001||z<-.001&&S!==null)return{starts:!0,trimPrevious:!1}}let T=Ct(j(k,"y"),"y",l,$,u,A);if(T!==void 0&&g!==null&&Math.abs(T-g)>.5)return{starts:!0,trimPrevious:!1};if(S!==null&&h){let z=Ct(S,"x",l,$,u,A);if(z!==void 0&&z<=v+.5)return{starts:!0,trimPrevious:!1}}return{starts:!1,trimPrevious:!1}},x=(k,$,A,S,N,T)=>{let z=!1;for(let C of k.children){if(C.kind==="text"||C.kind==="cdata"){let W=y(C.value);if(!W)continue;if(a!=="preserve-newlines"&&/^ +$/.test(W)){if(h){let B=p.at(-1)?.segments.at(-1),ie=a==="collapse"?B?.text.endsWith(" ")?"":" ":W;if(ie){let Y=ed(f,$);B&&ya(B.style,Y)?B.text+=ie:p[p.length-1].segments.push({text:ie,style:Y})}}continue}b(W,$,A&&!z,A&&!z&&S),z=!0;continue}if(C.kind!=="element"||C.localName.toLowerCase()!=="tspan")continue;let O=Qx(r,t,C.sourceNodeId),E=O?rw(n,O,N,T,l,u):N,_=O?rd(n,O,E):$,U=nw(_,E,N,T,c),V=I(C,E,U),q=Ct(j(C,"y"),"y",l,E,u,U);q!==void 0&&(g=q);let G=A&&!z||V.starts,H=V.starts?V.trimPrevious:A&&!z?S:!1;C.children.some(W=>W.kind==="element"&&W.localName.toLowerCase()==="tspan")?x(C,_,G,H,E,U):b(y($o(C,a)),_,G,H),z=!0}};if(x(e,f,!1,!1,o,d),a==="collapse")for(let k=0;k<p.length;k++){let $=p[k],A=!1;for(let N of $.segments)N.text=N.text.replace(/ {2,}/g," "),A&&N.text.startsWith(" ")&&(N.text=N.text.slice(1)),A=N.text.endsWith(" ");if(k===0){let N=$.segments.find(T=>T.text.length>0);N&&(N.text=N.text.replace(/^ +/,""))}let S=[...$.segments].reverse().find(N=>N.text.length>0);(k===p.length-1||$.trimEnd===!0)&&S&&(S.text=S.text.replace(/ +$/,"")),$.segments=$.segments.filter(N=>N.text.length>0)}return!m||p.map(k=>k.segments.map($=>$.text).join("")).join(`
35
+ `)!==i?null:{lines:p,baseStyle:f,lineHeight:s}}function kp(e){let t=[],r=n=>{for(let i of n)i.kind==="element"&&(t.push(i),r(i.children))};return r(e.children),t}function qD(e,t){let r=wx(e.attributes);return r?Object.freeze({...t,canonicalType:r.projection.type,state:Kx({...t.state,...r.projection.state})}):t}function YD(e,t){let r=e.index.parent(t.sourceNodeId);for(;r;){if(r.localName.toLowerCase()==="flowroot")return!0;r=e.index.parent(r.sourceNodeId)}return!1}var KD=[["fontVariant","font-variant"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantPosition","font-variant-position"],["fontVariantCaps","font-variant-caps"],["fontVariantNumeric","font-variant-numeric"],["fontVariantEastAsian","font-variant-east-asian"]];function ZD(e,t,r){let n={},i=S=>fo(e,t,r,S);for(let[S,N]of KD){let T=i(N);T&&T.trim()&&(n[S]=T.trim())}let a=i("text-decoration")??i("text-decoration-line");if(a&&a!=="none"){let S=a.toLowerCase();n.textDecoration={underline:S.includes("underline"),strikethrough:S.includes("line-through"),overline:S.includes("overline")}}let o=i("text-anchor"),s=i("text-align");o==="middle"||o==="end"?n.textAnchor=o:s==="center"?n.textAnchor="middle":s==="end"||s==="right"?n.textAnchor="end":(s==="justify"||o==="start")&&(n.textAnchor="start");let l=S=>{let N=i(S);if(N!=="normal")return si(N)},u=l("letter-spacing");u!==void 0&&(n.letterSpacing=u);let d=l("word-spacing");d!==void 0&&(n.wordSpacing=d);let c=i("text-transform");c&&(n.textTransform=c.trim());let f=i("baseline-shift");f&&(n.baselineShift=f.trim());let p=i("dominant-baseline");p&&(n.dominantBaseline=p.trim());let h=i("alignment-baseline");h&&(n.alignmentBaseline=h.trim());let m=i("font-stretch");m&&(n.fontStretch=m.trim());let g=i("font-size-adjust");g&&(n.fontSizeAdjust=g.trim());let v=i("writing-mode");v&&(n.writingMode=v==="tb"||v==="tb-rl"?"vertical-rl":v==="vertical-lr"?"vertical-lr":"horizontal-tb");let y=Number.parseFloat(i("inline-size")??"");Number.isFinite(y)&&y>0&&(n.inlineSize=y);let b=i("shape-inside")?.match(/url\(\s*#([^)]+)\s*\)/)?.[1];b&&(n.shapeInsideImportRefId=b);let I=Number.parseFloat(i("shape-padding")??"");Number.isFinite(I)&&I>0&&(n.shapePadding=I);let x=i("overflow-wrap");(x==="break-word"||x==="anywhere")&&(n.overflowWrap=x);let k=i("direction");(k==="ltr"||k==="rtl")&&(n.textDirection=k);let $=i("unicode-bidi");($==="normal"||$==="embed"||$==="bidi-override"||$==="isolate"||$==="isolate-override"||$==="plaintext")&&(n.unicodeBidi=$);let A=i("font-variation-settings");if(A&&A!=="normal"){let S={};for(let N of A.split(",")){let T=N.trim().match(/^['"](\w{4})['"]\s+([\d.eE+-]+)$/);if(!T)continue;let z=Number(T[2]);Number.isFinite(z)&&(S[T[1]]=z)}Object.keys(S).length>0&&(n.fontVariationSettings=S)}return n}function JD(e,t,r,n,i,a,o){let s={...a,viewport:a.viewportPlan?.viewport(t.occurrenceId)??a.viewport},l=r.localName.toLowerCase(),u=PD(i,t,s),d=(m,g)=>N0(i,t,r,m,g,u,s),c=m=>{o.push(TD(e,t,r,s,m))},f=jD(r),p=Is(j(r,"pathLength")),h=m=>(p===void 0||(p<0?c("Path length must not be negative."):m.pathLength=p),m);if(l==="rect"){let m=d("x","x")??0,g=d("y","y")??0,v=d("width","x")??0,y=d("height","y")??0;if(v<0||y<0)return c("Rectangle width and height must not be negative."),Mt(t,r,null,"invalid");let b=d("rx","x"),I=d("ry","y");(b!==void 0&&b<0||I!==void 0&&I<0)&&c("Rectangle corner radii must not be negative.");let x=b!==void 0&&b>=0,k=I!==void 0&&I>=0,$=Math.min(x?b:k?I:0,v/2),A=Math.min(k?I:x?b:0,y/2),S=h({x:m,y:g,width:v,height:y,...x?{rx:b}:{},...k?{ry:I}:{},cornerRadius:0});Object.assign(S,f);let N=r.children.some(z=>z.kind==="element"&&["animate","set"].includes(z.localName.toLowerCase())&&["x","y","width","height","rx","ry"].includes(j(z,"attributeName")??"")),T=Math.abs(v-y)<=1e-6&&Math.abs($-A)<=1e-6&&!N?"square":"rectangle";return Mt(t,r,T,"materialized",S)}if(l==="circle"){let m=d("cx","x")??0,g=d("cy","y")??0,v=d("r","radius")??0;return v<0?(c("Circle radius must not be negative."),Mt(t,r,null,"invalid")):Mt(t,r,"circle","materialized",h({x:m,y:g,radius:v,...f}))}if(l==="ellipse"){let m=d("cx","x")??0,g=d("cy","y")??0,v=d("rx","x"),y=d("ry","y");(v!==void 0&&v<0||y!==void 0&&y<0)&&c("Ellipse radii must not be negative.");let b=v!==void 0&&v>=0,I=y!==void 0&&y>=0,x=b?v:I?y:0,k=I?y:b?v:0;return x===0||k===0?Mt(t,r,"ellipse","materialized",h({x:m,y:g,rx:x,ry:k,...f})):Math.abs(x-k)<=1e-6?Mt(t,r,"circle","materialized",h({x:m,y:g,radius:x,...f})):Mt(t,r,"ellipse","materialized",h({x:m,y:g,rx:x,ry:k,...f}))}if(l==="line"){let m={x1:d("x1","x")??0,y1:d("y1","y")??0,x2:d("x2","x")??0,y2:d("y2","y")??0};return h(m),Object.assign(m,f),Mt(t,r,"line","materialized",m)}if(l==="polyline"||l==="polygon"){let m=DD(j(r,"points"));if(m.odd&&c("The final unpaired polygon coordinate was ignored."),m.points.length===0)return Mt(t,r,"polyline","materialized",h({x:0,y:0,width:0,height:0,polylinePoints:[],polylineClosed:l==="polygon",...f}));let g=m.points.map(I=>I.x),v=m.points.map(I=>I.y),y=Math.min(...g),b=Math.min(...v);return Mt(t,r,"polyline","materialized",h({x:y,y:b,width:Math.max(...g)-y,height:Math.max(...v)-b,polylinePoints:m.points,polylineClosed:l==="polygon",...f}))}if(l==="path"){let m=ws(i,t,r,"d")??"",g=/^path\(\s*(["'])([\s\S]*)\1\s*\)$/i.exec(m.trim()),v=g?g[2]:m;if(!v||v.trim().toLowerCase()==="none"){let N=r.children.find(T=>T.kind==="element"&&["animate","set"].includes(T.localName.toLowerCase())&&j(T,"attributeName")==="d");N&&(v=j(N,"from")??j(N,"to")??"")}let y=Od(v);y.error&&c(`Invalid path data: ${y.error.message}.`);let b=Zx(y.commands),I=vo(v),x=b.points.map(N=>N.x),k=b.points.map(N=>N.y),$=I?.minX??(x.length>0?Math.min(...x):0),A=I?.minY??(k.length>0?Math.min(...k):0),S={x:$,y:A,width:I?I.maxX-I.minX:0,height:I?I.maxY-I.minY:0};return h(S),S.pathPoints=b.points,S.pathClosed=b.closed,S.pathCurveType=b.points.some(N=>N.segmentType)?"mixed":b.points.some(N=>N.handleIn||N.handleOut)?"cubic":"linear",S.pathTension=.5,Object.assign(S,f),Mt(t,r,"path","materialized",S)}if(l==="text"){let m=s.viewport,g=RD(e,r,t,i),v=BD(i,t,r,u,m,s.rootFontSize),y=M0(i,n,t,"font-family")?ew(fo(i,t,r,"font-family"))??"Inter, sans-serif":"Inter, sans-serif",b=s.textMetricsHost?.measureXHeight(y,v),I=b!==void 0&&Number.isFinite(b)&&b>=0?b:v*.5,x=LD(r,g.mode==="preserve-xml-space"?"preserve-spaces":g.mode,m,v,s.rootFontSize,I),k=g.mode==="preserve-xml-space"?$o(r,"preserve-xml-space"):x.text,$=M0(i,n,t,"font-weight")?tw(fo(i,t,r,"font-weight")):400,A=fo(i,t,r,"font-style")??"normal",S=fo(i,t,r,"line-height"),N=S?si(S)??Number(S):NaN,T=Number.isFinite(N)?N:1.2,z=Ct(Ip(ws(i,t,r,"x")),"x",m,v,s.rootFontSize,I)??0,C=Ct(Ip(ws(i,t,r,"y")),"y",m,v,s.rootFontSize,I)??0,O={};for(let[H,W]of[["x",z],["y",C]]){let B=j(r,H),ie=ws(i,t,r,H),Y=Nd(B);B===null||ie?.trim()!==B.trim()||Y.length!==1||Ct(B,H,m,v,s.rootFontSize,I)===W&&(O[H]={raw:B,resolved:W})}let E={x:z,y:C,textX:z,textY:C,text:k,fontSize:v,fontFamily:y,fontWeight:$,fontStyle:A,lineHeight:T,useRichText:!1,isTextPath:!1};Object.keys(O).length>0&&(E.authoredTextPosition=O),Object.assign(E,ZD(i,t,r)),x.linePositions&&(E.linePositions=x.linePositions),E.whiteSpace=g.authored??"normal";let _=FD(e,r,x,g.mode),U=GD(r,k,g.mode,m,v,s.rootFontSize,I,_);U&&(E.charOffsets=U);let V=HD(r,t,n,i,k,g.mode,v,T,m,s.rootFontSize,I,s.textMetricsHost);V&&(E.useRichText=!0,E.richTextRuns=ch(V));let q=N0(i,t,r,"textLength","x",u,s);q!==void 0&&q>=0&&(E.textLength=q);let G=j(r,"lengthAdjust");return(G==="spacing"||G==="spacingAndGlyphs")&&(E.lengthAdjust=G),Object.assign(E,XD(e,r,v)),Object.assign(E,f),Mt(t,r,"text","materialized",E,_)}if(l==="flowroot"){let m=kp(r).filter(b=>b.localName.toLowerCase()==="flowpara").map(Jx);if(m.every(b=>b.length===0))return Mt(t,r,null,"empty");let g=kp(r).find(b=>["rect","circle","ellipse","path"].includes(b.localName.toLowerCase())),v=0,y=0;return g?.localName.toLowerCase()==="rect"&&(v=it(j(g,"x"),wp("x",u,s))??0,y=it(j(g,"y"),wp("y",u,s))??0),Mt(t,r,"text","materialized",{x:v,y:y+u,text:m.join(`
36
+ `),fontSize:u,fontFamily:"Inter, sans-serif",fontWeight:400,fontStyle:"normal",lineHeight:1.2,useRichText:!1,isTextPath:!1,...f})}if(l==="image"){let m=d("x","x")??0,g=d("y","y")??0,v=d("width","x"),y=d("height","y"),b=yr(r)?.value??"";if(!b||v===void 0||y===void 0)return Mt(t,r,null,"empty");if(v<0||y<0)return c("Image width and height must not be negative."),Mt(t,r,null,"invalid");if(v===0||y===0)return Mt(t,r,null,"empty");let I={x:m,y:g,width:v,height:y,...f};I.preserveAspectRatio=j(r,"data-preserve-aspect-ratio")!=="false";let x=j(r,"preserveAspectRatio")?.trim();return x&&x!=="none"&&(I.specPreserveAspectRatio=x),I.href=b,Mt(t,r,"image","materialized",I)}if(l==="foreignobject"){let m=d("x","x")??0,g=d("y","y")??0,v=d("width","x")??0,y=d("height","y")??0;if(v<0||y<0)return c("Foreign-object width and height must not be negative."),Mt(t,r,null,"invalid");if(v===0||y===0)return Mt(t,r,null,"empty");let b=j(r,"data-shape-type")??j(r,"data-media-kind"),I=b==="audio"||b==="video"?b:null;if(I){let x=r.children.find(T=>T.kind==="element"&&T.localName.toLowerCase()===I),k={x:m,y:g,width:v,height:y,mediaKind:I,href:x?j(x,"src")??"":"",...f},$=[["begin","data-begin"],["trimStart","data-trim-start"],["trimEnd","data-trim-end"],["volume","data-volume"],["playbackRate","data-playback-rate"],["naturalDuration","data-natural-duration"],["originalWidth","data-media-original-width"],["originalHeight","data-media-original-height"],["fadeInDuration","data-fade-in"],["fadeOutDuration","data-fade-out"]];for(let[T,z]of $){let C=Is(j(r,z));C!==void 0&&(k[T]=C)}if(k.originalWidth===void 0){let T=Is(j(r,"data-original-width"));T!==void 0&&(k.originalWidth=T)}if(k.originalHeight===void 0){let T=Is(j(r,"data-original-height"));T!==void 0&&(k.originalHeight=T)}let A=x?j(x,"type"):null;A&&(k.mediaMimeType=A);let S=j(r,"data-poster")??(I==="video"&&x?j(x,"poster"):null);S&&(k.posterHref=S);let N=(j(r,"data-source-rect")??"").trim().split(/[\s,]+/u).map(Number);return N.length===4&&N.every(Number.isFinite)&&(k.sourceRect={x:N[0],y:N[1],width:N[2],height:N[3]}),j(r,"data-loop")==="true"&&(k.loop=!0),j(r,"data-muted")==="true"&&(k.muted=!0),Mt(t,r,I,"materialized",k)}return Mt(t,r,"foreign-object","materialized",{x:m,y:g,width:v,height:y,...f})}return Mt(t,r,null,"deferred")}function QD(e,t,r,n){let i=n.viewportPlan??qx(e,t,r,{viewport:n.viewport,rootFontSize:n.rootFontSize}),a={...n,viewportPlan:i},o=[],s=[],l=new Set,u=[...t.occurrences].sort(OD);for(let f of u){if(l.has(f.occurrenceId))throw new Error(`Duplicate SVG geometry occurrence ${f.occurrenceId}.`);l.add(f.occurrenceId);let p=e.index.element(f.correspondingSourceNodeId);if(!p)throw new Error(`SVG occurrence ${f.occurrenceId} has no source element.`);if(p.namespaceUri!==ye||gx(e,p))continue;let h=p.localName.toLowerCase();MD.has(h)&&(h!=="flowroot"&&YD(e,p)||s.push(qD(p,JD(e,f,p,t,r,a,o))))}let d=new Map(s.map(f=>[f.occurrenceId,f])),c=Object.freeze({candidates:Object.freeze(s),candidate(f){return d.get(f)??null}});return Object.freeze({value:c,diagnostics:Object.freeze(o)})}function ej(e,t,r,n,i,a,o,s){if(e!=="mask"||t||r!=="userSpaceOnUse"||n.length!==1||!fn(o))return!1;let l=n[0],u=i.candidate(l.occurrenceId);if(!u||u.status!=="materialized"||u.canonicalType!=="rectangle"&&u.canonicalType!=="square")return!1;let d=u.state;if(d.transformMatrix!==void 0||d.rawTransform!==void 0)return!1;let c=wA(a.value(l.occurrenceId,"fill")??"black");if(!c||c.r!==255||c.g!==255||c.b!==255||c.a!==1)return!1;let f=Number(a.value(l.occurrenceId,"fill-opacity")??1),p=Number(a.value(l.occurrenceId,"opacity")??1);if(f!==1||p!==1)return!1;let h=Number(d.x??0),m=Number(d.y??0),g=Number(d.width??d.size),v=Number(d.height??d.size),y=(b,I)=>Math.abs(b-I)<=1e-9;return y(h,0)&&y(m,0)&&y(g,s.viewport.width)&&y(v,s.viewport.height)}var fh=new Set(["animate","animatemotion","animatetransform","discard","set"]),tj=new Set(["mpath"]),_d=new Set(["clippath","defs","filter","lineargradient","marker","mask","pattern","radialgradient","symbol"]),iw=new Set(["a","g","switch","use"]),ph=new Set(["desc","metadata","title"]),rj=new Set([...fh,...ph,"circle","ellipse","line","path","polygon","polyline","rect","text","use"]);function Ts(e){if(!e||typeof e!="object"&&typeof e!="function"||Object.isFrozen(e))return e;for(let t of Object.values(e))Ts(t);return Object.freeze(e)}function aw(e){if(e.namespaceUri!==ye)return null;let t=e.localName.toLowerCase();return t==="clippath"?"clip":t==="mask"?"mask":null}function al(e,t,r,n,i){let a=aw(t)??"clip";return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:a==="clip"?"clip-definitions":"mask-definitions",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:`${t.name} ${n} value ${i} is invalid and uses its initial value.`})}function Ef(e,t,r,n,i,a){let o=j(t,i);return o===null||o===""?a:o==="userSpaceOnUse"||o==="objectBoundingBox"?o:(n.push(al(e,t,r,i,o)),a)}function zf(e,t,r,n,i,a,o,s,l){let u=n.value(r.occurrenceId,o)??j(t,o);if(u===null||u.trim()==="")return l;let d=u.trim();return s.includes(d)?d:(a.push(al(e,t,i,o,u)),l)}function nj(e,t,r,n){let i={x:j(t,"x"),y:j(t,"y"),width:j(t,"width"),height:j(t,"height")},{x:a,y:o,width:s,height:l}=i;if([a,o,s,l].every(c=>c===null))return null;let u={x:"-10%",y:"-10%",width:"120%",height:"120%"},d=Object.fromEntries(Object.entries(i).map(([c,f])=>f===null?[c,u[c]]:Dr(f)?[c,f]:(n.push(al(e,t,r,c,f)),[c,u[c]])));return Object.freeze({x:d.x,y:d.y,width:d.width,height:d.height})}function A0(e){let t=Dr(e);return!!(t&&t.value<=0)}function ow(e,t,r){let n=e.parentOccurrenceId,i=new Set;for(;n;){if(n===t.occurrenceId)return!0;if(i.has(n))return!1;i.add(n),n=r.get(n)?.parentOccurrenceId??null}return!1}function sw(e,t,r){let n=e.index.parent(t);for(;n&&n.sourceNodeId!==r;){if(_d.has(n.localName.toLowerCase()))return!0;n=e.index.parent(n.sourceNodeId)}return n===null}function hh(e,t,r){let n=new Map(r.map(i=>[i.occurrenceId,i]));return r.filter(i=>ow(i,t,n)?!(i.usePath.length===0&&sw(e,i.correspondingSourceNodeId,t.correspondingSourceNodeId)):!1)}function mh(e,t,r,n){let i=e,a=new Set;for(;i&&i.occurrenceId!==t.occurrenceId;){if(a.has(i.occurrenceId)||(a.add(i.occurrenceId),n.value(i.occurrenceId,"display")==="none"))return!1;let o=n.value(i.occurrenceId,"visibility");if(o==="hidden"||o==="collapse")return!1;i=i.parentOccurrenceId?r.get(i.parentOccurrenceId):void 0}return i?.occurrenceId===t.occurrenceId}function ij(e,t,r,n,i){let a=r.occurrences,o=new Map(n.candidates.map(u=>[u.occurrenceId,u])),s=new Set(r.resolutions.map(u=>u.useOccurrenceId)),l=new Map(a.map(u=>[u.occurrenceId,u]));for(let u of hh(e,t,a)){if(!mh(u,t,l,i)){if(u.occurrenceId!==t.occurrenceId)return!0;continue}let d=e.index.element(u.correspondingSourceNodeId);if(!d)return!0;let c=d.localName.toLowerCase();if(fh.has(c)||tj.has(c))continue;if(c==="style"||c==="script"||["clip-path","mask","filter"].some(p=>(i.value(u.occurrenceId,p)??"").includes("url(")))return!0;if(ph.has(c))continue;if(iw.has(c)){if(c!=="use")continue;return s.has(u.occurrenceId),!0}if(_d.has(c)){if(u.usePath.length>0)return!0;continue}let f=o.get(u.occurrenceId);if(!f||f.status==="deferred")return!0}return!1}function aj(e,t,r,n,i){let a=new Map(n.candidates.map(u=>[u.occurrenceId,u])),o=new Set(r.resolutions.map(u=>u.useOccurrenceId)),s=new Map(r.occurrences.map(u=>[u.occurrenceId,u])),l=!1;for(let u of hh(e,t,r.occurrences)){if(!mh(u,t,s,i))continue;let d=e.index.element(u.correspondingSourceNodeId);if(!d)return!1;let c=d.localName.toLowerCase();if(ph.has(c))continue;if(fh.has(c)||c==="style"||c==="script"||["clip-path","mask","filter"].some(p=>(i.value(u.occurrenceId,p)??"").includes("url(")))return!1;if(c==="use"){if(u.parentOccurrenceId!==t.occurrenceId||u.usePath.length>0||j(d,"id")!==null||!o.has(u.occurrenceId))return!1;l=!0;continue}if(iw.has(c)||_d.has(c))return!1;let f=a.get(u.occurrenceId);if(!f||f.status!=="materialized")return!1}return l}function oj(e,t,r,n){let i=j(t,"transform");return i?Ei(i)||(n.push(al(e,t,r,"transform",i)),Ot):Ot}function sj(e,t,r,n,i,a,o){let s=aw(t);if(!s)return null;let l=r.direct(t.sourceNodeId);if(!l)throw new Error(`SVG ${t.name} ${t.sourceNodeId} has no occurrence.`);let u=new Map(r.occurrences.map(z=>[z.occurrenceId,z])),d=i.candidates.flatMap(z=>{let C=u.get(z.occurrenceId);return!C||!ow(C,l,u)||C.usePath.length===0&&sw(e,z.sourceNodeId,t.sourceNodeId)||!mh(C,l,u,n)?[]:z.status==="materialized"?[C]:[]}),c=s==="clip"&&r.resourcePolicy(t.sourceNodeId)?.status==="invalid",f=s==="clip"&&e.index.children(t.sourceNodeId).some(z=>!rj.has(z.localName.toLowerCase()));if(f&&o.push(Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:a.source,entrypoint:a.entrypoint,capability:"clip-definitions",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:"A clipPath may directly contain only paths, text, basic shapes, use, animation, and descriptive elements."})),e.index.elements.some(z=>{if(z.namespaceUri!==ye||z.localName.toLowerCase()!=="use")return!1;let C=e.index.parent(z.sourceNodeId);for(;C&&C.sourceNodeId!==t.sourceNodeId;){if(_d.has(C.localName.toLowerCase()))return!1;C=e.index.parent(C.sourceNodeId)}return C?.sourceNodeId===t.sourceNodeId})&&r.resourcePolicy(t.sourceNodeId)===null)throw new Error(`SVG ${t.name} ${t.sourceNodeId} requires a matching use resource-root plan.`);let p=s==="mask"?nj(e,t,a,o):null,h=!!(p&&(A0(p.width)||A0(p.height))),m=ij(e,l,r,i,n),g=m&&!aj(e,l,r,i,n)?[]:d,v=c||f?"invalid":h||!m&&d.length===0?"empty":"materialized",y=s==="clip"?Ef(e,t,a,o,"clipPathUnits","userSpaceOnUse"):null,b=s==="clip"?zf(e,t,l,n,a,o,"clip-rule",["nonzero","evenodd"],"nonzero"):null,I=b==="evenodd"||n.style(l.occurrenceId)?.cascadedValues["clip-rule"]!==void 0?b:null,x=s==="mask"?Ef(e,t,a,o,"maskUnits","objectBoundingBox"):null,k=s==="mask"?Ef(e,t,a,o,"maskContentUnits","userSpaceOnUse"):null,$=s==="mask"?zf(e,t,l,n,a,o,"mask-type",["luminance","alpha"],"luminance"):null,A=oj(e,t,a,o),S=Ts({sourceNodeId:t.sourceNodeId,sourceId:j(t,"id"),type:s,definitionPlacement:e.index.parent(t.sourceNodeId)===e.root?"document":"defs",status:v,representation:m?"raw":"decomposed",identity:ej(s,m,k,d,i,n,A,a),clipPathUnits:y,clipRule:I,maskUnits:x,maskContentUnits:k,maskType:$,region:p,geometrySourceNodeIds:Object.freeze(m?[]:d.map(z=>z.correspondingSourceNodeId)),rawDefinition:m?t.rawXml??"":null}),N=new Map,T=new Map;for(let z of hh(e,l,r.occurrences)){let C=e.index.element(z.correspondingSourceNodeId);if(C){if(!N.has(C.sourceNodeId)){let O=j(C,"transform");if(!O)N.set(C.sourceNodeId,Ot);else{let E=Ei(O);E?N.set(C.sourceNodeId,E):(o.push(al(e,C,a,"transform",O)),N.set(C.sourceNodeId,Ot))}}s==="clip"&&T.set(z.occurrenceId,zf(e,C,z,n,a,o,"clip-rule",["nonzero","evenodd"],S.clipRule??"nonzero"))}}return Object.freeze({definition:S,element:t,occurrence:l,rootTransform:A,transformBySourceNodeId:N,clipRuleByOccurrenceId:T,geometryOccurrences:Object.freeze(g)})}function lj(e){return e.edges.filter(t=>t.binding==="applied-css"&&t.participation==="consumer"&&(t.kind==="clip-path"&&t.propertyName==="clip-path"||t.kind==="mask-image"&&(t.propertyName==="mask"||t.propertyName==="mask-image")))}function uj(e,t,r){let n=e.occurrenceId??t.direct(e.fromSourceNodeId)?.occurrenceId;if(!n)return null;let i=e.propertyName==="clip-path"?"clip":"mask",a=e.targetSourceNodeId?r.get(e.targetSourceNodeId):void 0,o=e.validity==="valid"&&a?.definition.type===i&&a.definition.status!=="invalid";return Object.freeze({bindingId:`clip-mask-binding:${e.resourceReferenceId}:${n}`,resourceReferenceId:e.resourceReferenceId,consumerOccurrenceId:n,consumerSourceNodeId:e.fromSourceNodeId,propertyName:e.propertyName==="clip-path"?"clip-path":"mask",authoredValue:e.propertyValue,targetAuthoredId:e.targetAuthoredId,targetSourceNodeId:e.targetSourceNodeId,definitionSourceNodeId:o?e.targetSourceNodeId??null:null,status:o?"materialized":"invalid-reference"})}function dj(e){return je(Wt(e.x,e.y),Md(e.width,e.height))}function cj(e,t){let r=(e.definition.type==="clip"?e.definition.clipPathUnits:e.definition.maskContentUnits)==="objectBoundingBox"?dj(t):Ot;return je(r,e.rootTransform)}function vu(e,t,r,n,i){let a=r==="x"||r==="width",o=a?n.width:n.height,s=r==="x"?n.x:r==="y"?n.y:0;if(!Dr(e))return null;if(t==="objectBoundingBox"){let u=it(e,{percentBasis:1,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize,fontSize:i.rootFontSize});return u===void 0?null:s+u*o}let l=it(e,{percentBasis:a?i.viewport.width:i.viewport.height,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize,fontSize:i.rootFontSize});return l===void 0?null:l}function fj(e,t,r){if(!e.region||!e.maskUnits)return null;let n=vu(e.region.x,e.maskUnits,"x",t,r),i=vu(e.region.y,e.maskUnits,"y",t,r),a=vu(e.region.width,e.maskUnits,"width",t,r),o=vu(e.region.height,e.maskUnits,"height",t,r);return n===null||i===null||a===null||o===null?null:Object.freeze({x:n,y:i,width:a,height:o})}function pj(e,t,r,n,i){let a=new Map(n.occurrences.map(c=>[c.occurrenceId,c])),o=[],s=r.parentOccurrenceId,l=new Set;for(;s&&s!==t.occurrence.occurrenceId&&!l.has(s);){l.add(s);let c=a.get(s);if(!c)break;o.push(c),s=c.parentOccurrenceId}let u=Ot,d=t.definition.type==="clip"?t.definition.clipPathUnits:t.definition.maskContentUnits;for(let c of o.reverse()){let f=e.index.element(c.correspondingSourceNodeId);if(f&&(u=je(u,t.transformBySourceNodeId.get(f.sourceNodeId)??Ot),f.localName.toLowerCase()==="use")){let p=d==="objectBoundingBox"?1:i.viewport.width,h=d==="objectBoundingBox"?1:i.viewport.height,m=it(j(f,"x"),{percentBasis:p,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize})??0,g=it(j(f,"y"),{percentBasis:h,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize})??0;u=je(u,Wt(m,g))}}return u}function hj(e,t,r,n,i,a){let o=[],s=e.index.elements.flatMap(m=>{let g=sj(e,m,t,r,i,a,o);return g?[g]:[]}),l=new Map(s.map(m=>[m.definition.sourceNodeId,m])),u=lj(n).flatMap(m=>{let g=uj(m,t,l);return g?[g]:[]}),d=new Map;for(let m of u){let g=`${m.consumerOccurrenceId}\0${m.propertyName}`,v=d.get(g)??[];v.push(m),d.set(g,v)}let c=new Map([...d].map(([m,g])=>[m,Object.freeze(g)])),f=Object.freeze(s.map(m=>m.definition)),p=Object.freeze(u),h=Ts({definitions:f,bindings:p,definition(m){return l.get(m)?.definition??null},bindingsFor(m,g){return c.get(`${m}\0${g}`)??[]},binding(m,g,v){let y=c.get(`${m}\0${g}`)??[];return v===void 0?y[0]??null:y.find(b=>b.resourceReferenceId===v)??null},resolve(m,g){let v=m.definitionSourceNodeId?l.get(m.definitionSourceNodeId):void 0;if(!v||m.status!=="materialized")return Ts({status:"invalid-reference",contentMatrix:null,region:null,geometrySourceNodeIds:[],geometryPlacements:[],rawDefinition:null});let y=cj(v,g.consumerObjectBounds),b=(v.definition.clipPathUnits==="objectBoundingBox"||v.definition.maskContentUnits==="objectBoundingBox"||v.definition.maskUnits==="objectBoundingBox")&&(g.consumerObjectBounds.width===0||g.consumerObjectBounds.height===0),I=v.definition.status==="empty"||b,x=(I?[]:v.geometryOccurrences).map(k=>{let $=pj(e,v,k,t,a),A=je(v.rootTransform,$);return Object.freeze({occurrenceId:k.occurrenceId,sourceNodeId:k.correspondingSourceNodeId,definitionMatrix:A,matrix:je(y,$),clipRule:v.definition.type==="clip"?v.clipRuleByOccurrenceId.get(k.occurrenceId)??v.definition.clipRule??"nonzero":null})});return Ts({status:I?"empty":m.status,contentMatrix:y,region:fj(v.definition,g.consumerObjectBounds,a),geometrySourceNodeIds:I?[]:v.definition.geometrySourceNodeIds,geometryPlacements:x,rawDefinition:v.definition.rawDefinition})}});return Object.freeze({value:h,diagnostics:Object.freeze(o)})}var mj=new Set(["id","viewbox","preserveaspectratio","refx","refy","markerwidth","markerheight","markerunits","orient"]),gj=new Set(["a","circle","ellipse","foreignobject","g","image","line","path","polygon","polyline","rect","svg","switch","text","use"]),yj=new Set(["animate","animatemotion","animatetransform","set"]),vj="[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?",bj=new RegExp(`^(${vj})(deg|grad|rad|turn)?$`,"i");function xj(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=e[n]-t[n];if(i!==0)return i}return e.length-t.length}function wj(e,t){return xj(e.orderKey,t.orderKey)||e.productIndex-t.productIndex||e.occurrenceId.localeCompare(t.occurrenceId)}function to(e,t,r,n,i,a){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"markers",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:`Marker ${n} value ${i} ${a}.`})}function Ij(e){let t=bj.exec(e.trim());if(!t)return null;let r=Number(t[1]);if(!Number.isFinite(r))return null;switch((t[2]??"deg").toLowerCase()){case"deg":return r;case"grad":return r*.9;case"rad":return r*180/Math.PI;case"turn":return r*360;default:return null}}function kj(e){let t=e.trim().split(/\s+/).filter(Boolean);if(t.length<1||t.length>2)return!1;let r=lh(e);return t[0]!==r.align?!1:t.length===1||t[1]==="meet"||t[1]==="slice"}function Sj(e,t){let r=j(t,"data-ssk-marker-name");if(r!==null)return r;let n=e??"marker";return n.replace(/^marker[-_]?/i,"").replace(/[-_]/g," ")||n}function $j(e){let t={};for(let r of e.attributes)r.name==="xmlns"||r.prefix==="xmlns"||r.namespaceUri===null&&mj.has(r.localName.toLowerCase())||(t[r.name]=r.value);return Object.freeze(t)}function Nj(e,t,r){let n=e.parentOccurrenceId,i=new Set;for(;n;){if(n===t)return!0;if(i.has(n))return!1;i.add(n),n=r.get(n)?.parentOccurrenceId??null}return!1}function Mj(e,t,r){let n=new Map(t.occurrences.map(d=>[d.occurrenceId,d])),i=t.occurrences.filter(d=>Nj(d,r.occurrenceId,n)).sort(wj),a=new Set,o=[],s=[],l=d=>{let c=d.parentOccurrenceId;for(;c&&c!==r.occurrenceId&&!a.has(c);)c=n.get(c)?.parentOccurrenceId??null;return c===r.occurrenceId?null:c},u=d=>{if(d.usePath.length>0)return!1;let c=d.parentOccurrenceId;for(;c&&c!==r.occurrenceId;){let f=n.get(c);if(!f)return!1;if(e.index.element(f.correspondingSourceNodeId)?.localName.toLowerCase()==="defs")return!0;c=f.parentOccurrenceId}return!1};for(let d of i){let c=e.index.element(d.correspondingSourceNodeId);if(!c||c.namespaceUri!==ye)continue;let f=c.localName.toLowerCase();if(yj.has(f)){s.push(Object.freeze({occurrenceId:d.occurrenceId,sourceNodeId:d.correspondingSourceNodeId,parentOccurrenceId:l(d),elementName:c.name,orderKey:Object.freeze([...d.orderKey])}));continue}if(!gj.has(f)||u(d))continue;let p=l(d);a.add(d.occurrenceId),o.push(Object.freeze({occurrenceId:d.occurrenceId,sourceNodeId:d.correspondingSourceNodeId,parentOccurrenceId:p,elementName:c.name,orderKey:Object.freeze([...d.orderKey])}))}return{content:Object.freeze(o),animations:Object.freeze(s)}}function Aj(e,t,r,n,i){let a=[],o=new Map,s=[],l=n.resources.filter(d=>d.kind==="marker").sort((d,c)=>{let f=e.index.element(d.sourceNodeId)?.elementOrder??0,p=e.index.element(c.sourceNodeId)?.elementOrder??0;return f-p});for(let d of l){let c=e.index.element(d.sourceNodeId);if(!c||c.namespaceUri!==ye)continue;let f=t.occurrences.find(X=>X.correspondingSourceNodeId===d.sourceNodeId&&X.usePath.length===0);if(!f)continue;let p=j(c,"id"),h=r.style(f.occurrenceId),m=it(h?.resolvedValues["font-size"]??null,{fontSize:i.rootFontSize,rootFontSize:i.rootFontSize,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height}),g=m&&m>0?m:i.rootFontSize,v=j(c,"viewBox"),y=v===null?null:Mn(v),b=!1,I=!1;v!==null&&(!y||y.width<0||y.height<0?(b=!0,a.push(to(e,c,i,"viewBox",v,"is not a valid four-number viewBox with non-negative dimensions"))):(y.width===0||y.height===0)&&(I=!0));let x=j(c,"preserveAspectRatio");x!==null&&!kj(x)&&(b=!0,a.push(to(e,c,i,"preserveAspectRatio",x,"does not match the SVG preserveAspectRatio grammar")));let k={},$=X=>{let Z=j(c,X);return Z!==null&&(k[X]=Z),Z},A=$("markerWidth"),S=$("markerHeight"),N=X=>({percentBasis:X==="width"?i.viewport.width:i.viewport.height,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,fontSize:g,rootFontSize:i.rootFontSize}),T=(X,Z,J)=>{if(Z===null)return 3;let Q=it(Z,N(J));return Q===void 0||Q<0?(b=!0,a.push(to(e,c,i,X,Z,Q===void 0?"is not a resolvable length":"must not be negative")),3):(Q===0&&(I=!0),Q)},z=T("markerWidth",A,"width"),C=T("markerHeight",S,"height"),O={width:y?.width??z,height:y?.height??C},E=X=>{let Z=$(X);if(Z===null)return 0;let J=Z.trim(),Q=X==="refX"?O.width:O.height;if(X==="refX"){if(J==="left")return 0;if(J==="center")return Q/2;if(J==="right")return Q}else{if(J==="top")return 0;if(J==="center")return Q/2;if(J==="bottom")return Q}let Ee=it(Z,{...N(X==="refX"?"width":"height"),percentBasis:Q});return Ee!==void 0?Ee:(b=!0,a.push(to(e,c,i,X,Z,"is not a valid marker reference length or keyword")),0)},_=E("refX"),U=E("refY"),V=$("markerUnits"),q="strokeWidth";V==="userSpaceOnUse"?q="userSpaceOnUse":V!==null&&V!=="strokeWidth"&&(b=!0,a.push(to(e,c,i,"markerUnits",V,"must be strokeWidth or userSpaceOnUse")));let G=$("orient"),H=0;if(G==="auto"||G==="auto-start-reverse")H=G;else if(G!==null){let X=Ij(G);X===null?(b=!0,a.push(to(e,c,i,"orient",G,"is not an orientation keyword, number, or angle"))):H=X}let W=j(c,"overflow"),B=W==="visible"||W==="hidden"?W:void 0,ie=Mj(e,t,f),Y=Object.freeze({sourceNodeId:c.sourceNodeId,sourceId:p,name:Sj(p,c),status:b?"invalid":I?"empty":"materialized",...v!==null?{viewBox:v}:{},...x!==null?{preserveAspectRatio:x}:{},refX:_,refY:U,markerWidth:z,markerHeight:C,markerUnits:q,orient:H,...B?{overflow:B}:{},authoredGeometry:Object.freeze(k),rootAttributes:$j(c),content:ie.content,animations:ie.animations});o.set(Y.sourceNodeId,Y),s.push(Y)}let u=Object.freeze({candidates:Object.freeze(s),candidate:d=>o.get(d)??null});return Object.freeze({value:u,diagnostics:Object.freeze(a)})}var lw=["x1","y1","x2","y2"],Cj=["cx","cy","r","fx","fy","fr"],C0=Object.freeze({x1:0,y1:0,x2:1,y2:0});function ol(e){return e.namespaceUri!==ye?null:e.localName.toLowerCase()==="lineargradient"?"linear-gradient":e.localName.toLowerCase()==="radialgradient"?"radial-gradient":null}function Ni(e,t,r,n,i,a){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"gradients",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:`Gradient ${n} value ${i} ${a}.`})}function Oj(e,t,r){let n=[r],i=new Set([r.sourceNodeId]);for(let a of t.templateChain(r.sourceNodeId)){if(a.validity!=="valid"||!a.targetSourceNodeId||i.has(a.targetSourceNodeId))break;let o=e.index.element(a.targetSourceNodeId);if(!o||!ol(o))break;i.add(o.sourceNodeId),n.push(o)}return n}function O0(e,t,r){for(let n of e){if(r&&ol(n)!==r)continue;let i=j(n,t);if(i!==null)return i}return null}function T0(e,t,r){for(let n of e){if(r&&ol(n)!==r)continue;let i=j(n,t);if(i!==null)return Object.freeze({raw:i,ownerSourceNodeId:n.sourceNodeId})}return null}function Tj(e,t,r,n){let i=e.direct(r.sourceNodeId);return i?t.value(i.occurrenceId,n):null}function uw(e,t,r,n){let i=e.direct(r.sourceNodeId),a=i?t.style(i.occurrenceId):null;return a?.cascadedValues[n]?a.resolvedValues[n]??a.specifiedValues[n]??null:j(r,n)}function Sp(e){let t=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(%)?$/u.exec(e.trim());if(!t)return null;let r=Number(t[1]);return Number.isFinite(r)?t[2]?r/100:r:null}function P0(e,t,r,n){let i=Tj(e,t,r,"font-size"),a=it(i,{percentBasis:n.rootFontSize,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.rootFontSize,rootFontSize:n.rootFontSize});return a!==void 0&&a>0?a:n.rootFontSize}function Ps(e,t,r,n){if(t==="objectBoundingBox")return Sp(e);let i=r==="x"?n.viewport.width:r==="y"?n.viewport.height:Math.hypot(n.viewport.width,n.viewport.height)/Math.SQRT2;return it(e,{percentBasis:i,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.fontSize,rootFontSize:n.rootFontSize})??null}function Ds(e){return e==="r"||e==="fr"?"radius":e.endsWith("x")||e==="x1"||e==="x2"||e==="cx"||e==="fx"?"x":"y"}function dw(e,t){let r={};if(e.type==="linear-gradient"){for(let i of lw){let a=e.authoredGeometry[i];r[i]=a===void 0?C0[i]:Ps(a,e.gradientUnits,Ds(i),t)??C0[i]}return Object.freeze(r)}let n=Object.freeze({cx:.5,cy:.5,r:.5,fr:0});for(let i of["cx","cy","r","fr"]){let a=e.authoredGeometry[i];r[i]=a===void 0?n[i]:Ps(a,e.gradientUnits,Ds(i),t)??n[i]}for(let i of["fx","fy"]){let a=e.authoredGeometry[i],o=i==="fx"?r.cx:r.cy;r[i]=a===void 0?o:Ps(a,e.gradientUnits,Ds(i),t)??o}return Object.freeze(r)}function D0(e){return e.children.filter(t=>t.kind==="element"&&t.namespaceUri===ye&&t.localName.toLowerCase()==="stop")}function Pj(e,t,r,n,i,a){let o=t.find(p=>D0(p).length>0)??null,s=o?D0(o):[],l=[],u=0,d=t[0],c=r.direct(d.sourceNodeId),f=c?n.value(c.occurrenceId,"color"):null;for(let p of s){let h=j(p,"offset")??"0",m=Sp(h);m===null&&a.push(Ni(e,p,i,"offset",h,"is not a number or percentage"));let g=Math.min(1,Math.max(0,m??0)),v=Math.max(u,g);u=v;let y=r.direct(p.sourceNodeId),b=y?n.style(y.occurrenceId):null,I=(b?.cascadedValues["stop-color"]?b.specifiedValues["stop-color"]??b.resolvedValues["stop-color"]:j(p,"stop-color"))??"black",x=I.trim().toLowerCase(),k=/(?:^|[^-_a-z0-9])var\(/iu.test(I),$=x==="currentcolor"?f??"black":k?I:b?.resolvedValues["stop-color"]??I,A=uw(r,n,p,"stop-opacity")??"1",S=Sp(A);S===null&&a.push(Ni(e,p,i,"stop-opacity",A,"is not a number or percentage"));let N=Math.min(1,Math.max(0,S??1));$.trim().toLowerCase()==="transparent"&&($="black",N=0),l.push(Object.freeze({occurrenceId:o?.sourceNodeId===d.sourceNodeId&&y?y.occurrenceId:`gradient-stop:${c?.occurrenceId??d.sourceNodeId}:${p.sourceNodeId}`,sourceNodeId:p.sourceNodeId,correspondingSourceNodeId:p.sourceNodeId,hostGradientSourceNodeId:d.sourceNodeId,offsetAuthored:j(p,"offset"),offset:v,color:$,opacity:N}))}return Object.freeze(l)}function Dj(e,t,r,n,i,a,o){let s=ol(t),l=Oj(e,i,t),u=j(t,"id"),d=r.direct(t.sourceNodeId)?.occurrenceId??t.sourceNodeId,c=e.index.parent(t.sourceNodeId)===e.root?"document":"defs",f=O0(l,"gradientUnits"),p=!1,h="objectBoundingBox";f==="userSpaceOnUse"?h="userSpaceOnUse":f!==null&&f!=="objectBoundingBox"&&o.push(Ni(e,t,a,"gradientUnits",f,"must be objectBoundingBox or userSpaceOnUse"));let m=O0(l,"spreadMethod"),g="pad";m==="reflect"||m==="repeat"?g=m:m!==null&&m!=="pad"&&o.push(Ni(e,t,a,"spreadMethod",m,"must be pad, reflect, or repeat"));let v=uw(r,n,t,"color-interpolation"),y="sRGB";v==="auto"||v==="linearRGB"?y=v:v!==null&&v!=="sRGB"&&o.push(Ni(e,t,a,"color-interpolation",v,"must be auto, sRGB, or linearRGB"));let b={},I={},x=s==="linear-gradient"?lw:Cj;for(let z of x){let C=T0(l,z,s);if(!C)continue;b[z]=C.raw;let O=Ps(C.raw,h,Ds(z),{viewport:a.viewport,fontSize:P0(r,n,t,a),rootFontSize:a.rootFontSize});I[z]=Object.freeze({...C,validity:O===null?"invalid":"valid"})}let k=T0(l,"gradientTransform"),$=k?.raw??null,A=Ei($??"");k&&(b.gradientTransform=k.raw,I.gradientTransform=Object.freeze({...k,validity:A===null?"invalid":"valid"}),A===null&&o.push(Ni(e,t,a,"gradientTransform",k.raw,"does not match the SVG transform-list grammar")));for(let[z,C]of Object.entries(I))z==="gradientTransform"||C.validity==="valid"||o.push(Ni(e,t,a,z,C.raw,"is not a valid gradient coordinate"));if(s==="radial-gradient")for(let z of["r","fr"]){let C=I[z];if(!C||C.validity!=="valid")continue;let O=Ps(C.raw,h,Ds(z),{viewport:a.viewport,fontSize:P0(r,n,t,a),rootFontSize:a.rootFontSize});O!==null&&O<0&&(p=!0,o.push(Ni(e,t,a,z,C.raw,"must not be negative")))}let S=Pj(e,l,r,n,a,o),N=Object.freeze(cn(A??[1,0,0,1,0,0])),T=I.gradientTransform??null;return Object.freeze({occurrenceId:d,sourceNodeId:t.sourceNodeId,sourceId:u,definitionPlacement:c,type:s,status:p?"invalid":S.length===0?"empty":"materialized",gradientUnits:h,spreadMethod:g,colorInterpolation:y,authoredGeometry:Object.freeze(b),geometryValues:Object.freeze(I),transform:Object.freeze({authored:T,matrix:N}),stops:S,templateSourceNodeIds:Object.freeze(l.map(z=>z.sourceNodeId))})}function jj(e,t){let r=e.edges.flatMap(n=>{if(n.binding!=="applied-css"||!n.occurrenceId||n.propertyName!=="fill"&&n.propertyName!=="stroke")return[];let i=n.targetSourceNodeId?t.get(n.targetSourceNodeId):void 0,a=el(n.propertyValue)[n.tokenIndex],o=a?n.propertyValue.slice(a.tokenEnd).trim():"",s=a?!o||o.toLowerCase()==="none"?Object.freeze({kind:"none"}):Object.freeze({kind:"color",value:o}):Object.freeze({kind:"unresolved",authoredValue:n.propertyValue}),l=i?i.status:n.validity==="missing"||n.validity==="invalid-target"?"invalid-reference":"other-paint-server";return[Object.freeze({resourceReferenceId:n.resourceReferenceId,occurrenceId:n.occurrenceId,sourceNodeId:n.fromSourceNodeId,correspondingSourceNodeId:n.fromSourceNodeId,propertyName:n.propertyName,authoredValue:n.propertyValue,gradientSourceNodeId:i?.sourceNodeId??null,status:l,fallback:s})]});return Object.freeze(r)}function Ej(e,t,r,n,i){let a=[],o=n.resources.filter(c=>c.kind==="gradient").map(c=>e.index.element(c.sourceNodeId)).filter(c=>!!(c&&ol(c))).sort((c,f)=>c.elementOrder-f.elementOrder).map(c=>Dj(e,c,t,r,n,i,a)),s=new Map(o.map(c=>[c.sourceNodeId,c])),l=jj(n,s),u=new Map;for(let c of l){let f=u.get(c.occurrenceId)??[];f.push(c),u.set(c.occurrenceId,f)}for(let c of u.values())Object.freeze(c);let d=Object.freeze({candidates:Object.freeze(o),bindings:l,candidate:c=>s.get(c)??null,bindingsFor:c=>u.get(c)??Object.freeze([]),binding:(c,f,p)=>(u.get(c)??[]).find(h=>h.propertyName===f&&(p===void 0||h.resourceReferenceId===p))??null,resolveGeometry:(c,f)=>{let p=c.gradientSourceNodeId?s.get(c.gradientSourceNodeId):null;return p?dw(p,f):null}});return Object.freeze({value:d,diagnostics:Object.freeze(a)})}var zj=["x","y","width","height"],_j=new Set(["desc","metadata","title"]),Rj=new Set(["defs","lineargradient","marker","mask","metadata","pattern","radialgradient","script","style","symbol","title"]),Fj=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(%)?$/u,Lj=/^(?:none|x(?:Min|Mid|Max)Y(?:Min|Mid|Max))(?:\s+(?:meet|slice))?$/u;function cw(e){return!!(e&&e.namespaceUri===ye&&e.localName.toLowerCase()==="pattern")}function fw(e){let t=Fj.exec(e.trim());if(!t)return null;let r=Number(t[1]);return Number.isFinite(r)?t[2]?r/100:r:null}function Bj(e){if(e===null)return Object.freeze({value:"xMidYMid meet",valid:!0});let t=e.trim().replace(/\s+/gu," "),r=Lj.test(t),n=lh(r?t:null);return Object.freeze({value:`${n.align}${n.align==="none"&&!t.includes(" ")?"":` ${n.meetOrSlice}`}`,valid:r})}function ta(e,t,r,n,i,a){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"patterns",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:`Pattern ${n} value ${i} ${a}.`})}function Vj(e,t,r){let n=[r],i=new Set([r.sourceNodeId]);for(let a of t.templateChain(r.sourceNodeId)){if(a.validity!=="valid"||!a.targetSourceNodeId||i.has(a.targetSourceNodeId))break;let o=e.index.element(a.targetSourceNodeId);if(!cw(o))break;i.add(o.sourceNodeId),n.push(o)}return Object.freeze(n)}function ro(e,t){for(let r of e){let n=j(r,t);if(n!==null)return Object.freeze({raw:n,ownerSourceNodeId:r.sourceNodeId})}return null}function Uj(e){return e.children.filter(t=>t.kind==="element"&&!_j.has(t.localName.toLowerCase()))}function Gj(e){return e.find(t=>Uj(t).length>0)??null}function Xj(e,t,r){let n=e;for(;n;){if(n.occurrenceId===t)return!0;n=n.parentOccurrenceId?r.get(n.parentOccurrenceId):void 0}return!1}function Wj(e,t,r,n){let i=t;for(;i&&i.correspondingSourceNodeId!==r;){let a=e.index.element(i.correspondingSourceNodeId);if(a&&Rj.has(a.localName.toLowerCase())&&!(a.localName.toLowerCase()==="symbol"&&i.usePath.length>0))return!1;i=i.parentOccurrenceId?n.get(i.parentOccurrenceId):void 0}return!!i}function Hj(e,t,r,n){if(!n)return Object.freeze([]);let i=t.direct(n.sourceNodeId);if(!i)return Object.freeze([]);let a=new Map(t.occurrences.map(u=>[u.occurrenceId,u])),o=t.occurrences.filter(u=>u.occurrenceId!==i.occurrenceId&&Xj(u,i.occurrenceId,a)&&Wj(e,u,n.sourceNodeId,a)),s=new Set(o.map(u=>u.occurrenceId)),l=new Map(o.map(u=>[u.occurrenceId,`pattern-content:${r.sourceNodeId}:${u.occurrenceId}`]));return Object.freeze(o.map(u=>Object.freeze({occurrenceId:l.get(u.occurrenceId),sourceOccurrenceId:u.occurrenceId,sourceNodeId:u.correspondingSourceNodeId,correspondingSourceNodeId:u.correspondingSourceNodeId,hostPatternSourceNodeId:r.sourceNodeId,parentOccurrenceId:u.parentOccurrenceId&&s.has(u.parentOccurrenceId)?l.get(u.parentOccurrenceId)??null:null,role:u.role,shadow:u.usePath.length>0,orderKey:Object.freeze([...u.orderKey])})))}function qj(e,t,r){if(!t)return Object.freeze([]);let n=new Set(r.map(a=>a.sourceOccurrenceId)),i=new Set(r.map(a=>a.correspondingSourceNodeId));return Object.freeze(e.edges.filter(a=>a.participation==="resource-product"&&a.containingResourceSourceNodeId===t.sourceNodeId&&(a.occurrenceId!==null&&n.has(a.occurrenceId)||i.has(a.fromSourceNodeId))&&a.kind!=="pattern-template"))}function Yj(e,t){if(t.length===0)return Object.freeze([]);let r=new Map(e.resources.map(n=>[n.sourceNodeId,n]));return Object.freeze(e.closureFromEdges(t).materializations.map(n=>{let i=r.get(n.sourceNodeId);return Object.freeze({sourceNodeId:n.sourceNodeId,sourceId:i?.authoredId??null,kind:i?.kind??"referenced-fragment",viaResourceReferenceId:n.viaResourceReferenceId})}))}function Kj(e,t,r,n){return t==="objectBoundingBox"?fw(e)===null?"invalid":"valid":it(e,{percentBasis:r==="x"?n.viewport.width:n.viewport.height,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.rootFontSize,rootFontSize:n.rootFontSize})===void 0?"invalid":"valid"}function po(e,t,r,n,i){return e===void 0?i:t==="objectBoundingBox"?fw(e)??i:it(e,{percentBasis:r==="x"?n.viewport.width:n.viewport.height,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.fontSize,rootFontSize:n.rootFontSize})??i}function Zj(e,t){if(e.status!=="materialized")return null;let r=po(e.values.x?.raw,e.patternUnits,"x",t,0),n=po(e.values.y?.raw,e.patternUnits,"y",t,0),i=po(e.values.width?.raw,e.patternUnits,"x",t,0),a=po(e.values.height?.raw,e.patternUnits,"y",t,0);return e.patternUnits==="userSpaceOnUse"?Object.freeze({x:r,y:n,width:i,height:a}):Object.freeze({x:t.objectBounds.x+r*t.objectBounds.width,y:t.objectBounds.y+n*t.objectBounds.height,width:i*t.objectBounds.width,height:a*t.objectBounds.height})}function Jj(e,t,r,n,i,a){let o=Vj(e,n,t),s=j(t,"id"),l=r.direct(t.sourceNodeId)?.occurrenceId??t.sourceNodeId,u=ro(o,"patternUnits"),d="objectBoundingBox";u?.raw==="userSpaceOnUse"?d="userSpaceOnUse":u&&u.raw!=="objectBoundingBox"&&a.push(ta(e,t,i,"patternUnits",u.raw,"must be objectBoundingBox or userSpaceOnUse"));let c=ro(o,"patternContentUnits"),f="userSpaceOnUse";c?.raw==="objectBoundingBox"?f="objectBoundingBox":c&&c.raw!=="userSpaceOnUse"&&a.push(ta(e,t,i,"patternContentUnits",c.raw,"must be objectBoundingBox or userSpaceOnUse"));let p=!1,h={};for(let G of zj){let H=ro(o,G);if(!H)continue;let W=Kj(H.raw,d,G==="x"||G==="width"?"x":"y",i);h[G]=Object.freeze({...H,validity:W}),W==="invalid"&&a.push(ta(e,t,i,G,H.raw,"is not a valid pattern coordinate"))}let m={viewport:i.viewport,objectBounds:{x:0,y:0,width:1,height:1},fontSize:i.rootFontSize,rootFontSize:i.rootFontSize},g=po(h.width?.raw,d,"x",m,0),v=po(h.height?.raw,d,"y",m,0);for(let[G,H]of[["width",g],["height",v]])h[G]?.validity==="valid"&&H<0&&(p=!0,a.push(ta(e,t,i,G,h[G].raw,"must not be negative")));let y=ro(o,"patternTransform"),b=y?Ei(y.raw):[1,0,0,1,0,0],I=b===null?"invalid":"valid";y&&I==="invalid"&&a.push(ta(e,t,i,"patternTransform",y.raw,"does not match the SVG transform-list grammar"));let x=Object.freeze({raw:y?.raw??null,ownerSourceNodeId:y?.ownerSourceNodeId??null,matrix:Object.freeze(cn(b??[1,0,0,1,0,0])),validity:I}),k=ro(o,"viewBox"),$=k?Mn(k.raw):null,A="valid";k&&(!$||$.width<0||$.height<0)&&(A="invalid",a.push(ta(e,t,i,"viewBox",k.raw,"must be four numbers with non-negative width and height")));let S=k?Object.freeze({...k,validity:A}):null,N=$&&A==="valid"?Object.freeze([$.x,$.y,$.width,$.height]):null,T=ro(o,"preserveAspectRatio"),z=Bj(T?.raw??null);T&&!z.valid&&a.push(ta(e,t,i,"preserveAspectRatio",T.raw,"does not match the preserveAspectRatio grammar"));let C=T?Object.freeze({...T,validity:z.valid?"valid":"invalid"}):null,O=Gj(o),E=Hj(e,r,t,O),_=qj(n,O,E),U=Yj(n,_),V=!!(N&&(N[2]===0||N[3]===0)),q=p?"invalid":!O||g===0||v===0||V?"empty":"materialized";return Object.freeze({occurrenceId:l,sourceNodeId:t.sourceNodeId,sourceId:s,status:q,patternUnits:d,patternContentUnits:f,values:Object.freeze(h),transform:x,viewBox:N,viewBoxAuthored:S,preserveAspectRatio:z.value,preserveAspectRatioAuthored:C,templateSourceNodeIds:Object.freeze(o.map(G=>G.sourceNodeId)),contentProviderSourceNodeId:O?.sourceNodeId??null,contentOccurrences:E,contentOccurrenceIds:Object.freeze(E.map(G=>G.occurrenceId)),resources:U})}function Qj(e,t){return Object.freeze(e.edges.flatMap(r=>{if(r.binding!=="applied-css"||!r.occurrenceId||r.propertyName!=="fill"&&r.propertyName!=="stroke")return[];let n=r.targetSourceNodeId?t.get(r.targetSourceNodeId):void 0,i=el(r.propertyValue)[r.tokenIndex],a=i?r.propertyValue.slice(i.tokenEnd).trim():"",o=i?!a||a.toLowerCase()==="none"?Object.freeze({kind:"none"}):Object.freeze({kind:"color",value:a}):Object.freeze({kind:"unresolved",authoredValue:r.propertyValue}),s=r.validity==="missing"||r.validity==="invalid-target"?"invalid-reference":n?n.status:"other-paint-server";return[Object.freeze({resourceReferenceId:r.resourceReferenceId,consumerOccurrenceId:r.occurrenceId,occurrenceId:r.occurrenceId,sourceNodeId:r.fromSourceNodeId,correspondingSourceNodeId:r.fromSourceNodeId,propertyName:r.propertyName,authoredValue:r.propertyValue,patternSourceNodeId:n?.sourceNodeId??null,status:s,fallback:o})]}))}function eE(e,t,r,n,i){let a=[],o=n.resources.filter(c=>c.kind==="pattern").map(c=>e.index.element(c.sourceNodeId)).filter(cw).sort((c,f)=>c.elementOrder-f.elementOrder).map(c=>Jj(e,c,t,n,i,a)),s=new Map(o.map(c=>[c.sourceNodeId,c])),l=Qj(n,s),u=new Map;for(let c of l){let f=u.get(c.occurrenceId)??[];f.push(c),u.set(c.occurrenceId,f)}for(let c of u.values())Object.freeze(c);let d=Object.freeze({candidates:Object.freeze(o),bindings:l,candidate:c=>s.get(c)??null,bindingsFor:c=>u.get(c)??Object.freeze([]),binding:(c,f,p)=>(u.get(c)??[]).find(h=>h.propertyName===f&&(p===void 0||h.resourceReferenceId===p))??null,resolveTile:(c,f)=>{let p=c.patternSourceNodeId?s.get(c.patternSourceNodeId):null;return p?Zj(p,f):null}});return Object.freeze({value:d,diagnostics:Object.freeze(a)})}var pw=new Map([["clippath","clipPath"],["filter","filter"],["lineargradient","linearGradient"],["mask","mask"],["pattern","pattern"],["radialgradient","radialGradient"],["symbol","symbol"]]),tE=new Set(["clipPathUnits","filterUnits","gradientUnits","maskContentUnits","maskUnits","patternContentUnits","patternUnits","primitiveUnits","spreadMethod"]);function j0(e,t){let r=e.index.parent(t.sourceNodeId);if(!r)return;let n=0;for(let i of r.children)if(i.kind==="element"){if(i.sourceNodeId===t.sourceNodeId)return n;n++}}function E0(e,t){let r=t;for(;r;){let n=e.index.parent(r.sourceNodeId);if(n?.sourceNodeId===e.root.sourceNodeId){if(r.namespaceUri!==ye||r.localName.toLowerCase()!=="defs")return;let i=0;for(let a of e.root.children)if(!(a.kind!=="element"||a.namespaceUri!==ye||a.localName.toLowerCase()!=="defs")&&(i++,a.sourceNodeId===r.sourceNodeId))return`svg-definition-container-${i}`;return}r=n}}function z0(e,t){let r=new Set(t.attributes.filter(a=>a.prefix==="xmlns").map(a=>a.name)),n=new Map,i=e.index.parent(t.sourceNodeId);for(;i;){for(let a of i.attributes)a.prefix==="xmlns"&&(r.has(a.name)||n.has(a.name)||n.set(a.name,a));i=e.index.parent(i.sourceNodeId)}return Object.freeze([...n.values()])}function gh(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function bu(e){return gh(e).replaceAll('"',"&quot;")}function rE(e){switch(e.kind){case"text":return gh(e.value);case"comment":return`<!--${e.value}-->`;case"cdata":return`<![CDATA[${e.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${e.value}?>`;case"doctype":return`<!DOCTYPE ${e.value}>`}}function $p(e,t,r=[],n=!1){if(e.namespaceUri===ye&&e.localName.toLowerCase()==="script"||n&&e.namespaceUri===ye&&["animate","animatemotion","animatetransform","discard","set"].includes(e.localName.toLowerCase())&&!yr(e))return"";let i=t.identifierBySourceNodeId.get(e.sourceNodeId),a=t.generatedIdBySourceNodeId.get(e.sourceNodeId),o=t.attributeRewrites.get(e.sourceNodeId),s=[],l=!1,u=!1;for(let h of r)s.push(`${h.name}="${bu(h.value)}"`);for(let h of e.attributes){if(/^on/iu.test(h.name))continue;h.name==="data-source-id"&&(l=!0),h.localName==="id"&&h.namespaceUri===null&&(u=!0);let m=h.localName==="id"&&h.namespaceUri===null&&i?i.liveId:h.localName==="id"&&h.namespaceUri===null&&a?a:o?.get(h.name)??h.value;m===""&&tE.has(h.name)||s.push(`${h.name}="${bu(m)}"`)}i?.restoreSourceId&&!l&&s.push(`data-source-id="${bu(i.sourceId)}"`),a&&!u&&s.push(`id="${bu(a)}"`);let d=`<${e.name}${s.length>0?` ${s.join(" ")}`:""}`,c=t.textRewrites.get(e.sourceNodeId),f=c!==void 0?gh(c):e.children.map(h=>h.kind==="element"?$p(h,t,[],n):rE(h)).join(""),p=/\/\s*>\s*$/u.test(e.rawXml??"");return f.length===0&&p?`${d}/>`:`${d}>${f}</${e.name}>`}function nE(e){let t=new Map(e.resourceIds.map(i=>[i.sourceNodeId,i])),r=new Map,n=new Map;for(let i of e.rewrites){if(i.target==="text-content"){n.set(i.sourceNodeId,i.value);continue}if(!i.name)continue;let a=r.get(i.sourceNodeId)??new Map;a.set(i.name,i.value),r.set(i.sourceNodeId,a)}return{identifierBySourceNodeId:t,attributeRewrites:new Map([...r].map(([i,a])=>[i,a])),textRewrites:n,generatedIdBySourceNodeId:new Map(e.generatedIds.map(({sourceNodeId:i,liveId:a})=>[i,a]))}}function hw(e,t){let r=e.index.parent(t);for(;r;){if(r.namespaceUri===ye&&r.localName.toLowerCase()==="defs")return!0;r=e.index.parent(r.sourceNodeId)}return!1}function iE(e){return e.definition.definitionChildIds&&Object.freeze(e.definition.definitionChildIds),e.definition.sourceDefinitionChildIds&&Object.freeze(e.definition.sourceDefinitionChildIds),Object.freeze(e.definition),Object.freeze(e)}function mw(e,t,r){if(t.namespaceUri!==ye||t.localName.toLowerCase()!=="g"||!hw(e,t.sourceNodeId))return null;let n=t.children.filter(a=>a.kind==="element");if(n.length===0)return null;let i=[];for(let a of n){if(a.namespaceUri!==ye)return null;let o=pw.get(a.localName.toLowerCase()),s=mw(e,a,r);if(!o&&!s)return null;let l=r.identifierBySourceNodeId.get(a.sourceNodeId);if(!l)return null;i.push({sourceId:l.liveId,destinationId:l.liveId})}return i}function aE(e,t,r){let n=[],i=nE(t),a=[];for(let u of e.index.elements){if(u.namespaceUri!==ye)continue;let d=pw.get(u.localName.toLowerCase()),c=mw(e,u,i);if(!d&&!c)continue;let f=j(u,"id");if(!f)continue;let p=i.identifierBySourceNodeId.get(u.sourceNodeId);if(!p){n.push({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,message:`Definition ${f} has no destination identifier assignment.`,documentPath:e.index.sourcePath(u.sourceNodeId),elementName:u.name,sourceId:f,sourceNodeId:u.sourceNodeId,capability:"paint-server-definitions"});continue}let h={id:p.liveId,sourceId:p.liveId,type:d??u.localName,...j0(e,u)!==void 0?{definitionOrder:j0(e,u)}:{},...E0(e,u)?{definitionContainerId:E0(e,u)}:{},...c?{role:"referenced-fragment",definitionChildIds:c.map(m=>m.destinationId),sourceDefinitionChildIds:c.map(m=>m.sourceId)}:{},markup:$p(u,i,z0(e,u),d==="clipPath"||d==="mask"),passthrough:!0};a.push(iE({sourceNodeId:u.sourceNodeId,sourceId:f,destinationId:p.liveId,type:d??u.localName,insideDefs:hw(e,u.sourceNodeId),definition:h}))}let o=Object.freeze(a),s=new Map(o.map(u=>[u.sourceNodeId,u])),l=Object.freeze({candidates:o,candidate:u=>s.get(u)??null,definitionForSourceNode(u,d="referenced-fragment"){let c=s.get(u);if(c)return c.definition;let f=e.index.element(u);if(!f||f.namespaceUri!==ye)return null;let p=i.identifierBySourceNodeId.get(u),h=j(f,"id"),m=p?.liveId??h;return m?Object.freeze({id:m,sourceId:m,type:f.localName,role:d,markup:$p(f,i,z0(e,f)),passthrough:!0}):null},definitions:(u=new Set)=>Object.freeze(o.filter(d=>!u.has(d.sourceNodeId)).map(d=>d.definition))});return Object.freeze({value:l,diagnostics:Object.freeze(n)})}var xu=Object.freeze({x:"-10%",y:"-10%",width:"120%",height:"120%"}),oE=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,sE=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(%)?$/u,lE=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(deg|grad|rad|turn)?$/iu,uE=new Set(["animate","animatemotion","animatetransform","set"]),dE=new Set(["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]);function ha(e){if(!e||typeof e!="object"&&typeof e!="function"||Object.isFrozen(e))return e;for(let t of Object.values(e))ha(t);return Object.freeze(e)}function Pi(e){return e.children.filter(t=>t.kind==="element")}function _0(e){let t="",r=[...e.children].reverse();for(;r.length>0;){let n=r.pop();n.kind==="text"||n.kind==="cdata"?t+=n.value:n.kind==="element"&&r.push(...[...n.children].reverse())}return t}function cE(e){return(e.rawXml??"").replace(/\s+xmlns="http:\/\/www\.w3\.org\/2000\/svg"/gu,"").replace(/\s+xmlns=""/gu,"")}function Jn(e){if(e===null||!oE.test(e.trim()))return;let t=Number(e.trim());return Number.isFinite(t)?t:void 0}function ra(e,t){let r=j(e,t);return r===null?void 0:r}function Rd(e,t,r=""){return`${e}:${t}${r}`}function Fu(e,t,r,n){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:e.source,entrypoint:e.entrypoint,capability:"filters",sourceNodeId:r.sourceNodeId,sourceId:j(r,"id")??void 0,occurrenceId:n,elementName:r.name,message:t})}function fE(e){let t=[...Pi(e)];for(;t.length>0;){let r=t.pop();if(r.namespaceUri===ye&&r.localName.toLowerCase()==="script")return!0;t.push(...Pi(r))}return!1}function R0(e,t,r){let n=t.direct(e.sourceNodeId);return n?r.value(n.occurrenceId,"display"):j(e,"display")}function pE(e,t,r,n){if(R0(t,r,n)?.trim().toLowerCase()==="none")return!0;let i=e.index.parent(t.sourceNodeId);for(;i;){if(i.namespaceUri===ye&&i.localName.toLowerCase()==="defs"&&R0(i,r,n)?.trim().toLowerCase()==="none")return!0;i=e.index.parent(i.sourceNodeId)}return!1}function hE(e,t,r){let n=t.direct(e.sourceNodeId),i=n?r.value(n.occurrenceId,"color-interpolation-filters"):j(e,"color-interpolation-filters"),a=j(e,"filterUnits"),o=j(e,"primitiveUnits");return{colorInterpolation:i==="auto"||i==="sRGB"||i==="linearRGB"?i:"linearRGB",filterUnits:a==="userSpaceOnUse"||a==="objectBoundingBox"?a:"objectBoundingBox",primitiveUnits:o==="userSpaceOnUse"||o==="objectBoundingBox"?o:"userSpaceOnUse",region:Object.freeze({x:j(e,"x")??xu.x,y:j(e,"y")??xu.y,width:j(e,"width")??xu.width,height:j(e,"height")??xu.height})}}function gw(e,t){let r=ra(t,"x"),n=ra(t,"y"),i=ra(t,"width"),a=ra(t,"height");r!==void 0&&(e.x=r),n!==void 0&&(e.y=n),i!==void 0&&(e.width=i),a!==void 0&&(e.height=a);let o=j(t,"filterUnits");(o==="userSpaceOnUse"||o==="objectBoundingBox")&&(e.filterUnits=o);let s=j(t,"primitiveUnits");(s==="userSpaceOnUse"||s==="objectBoundingBox")&&(e.primitiveUnits=s);let l=j(t,"color-interpolation-filters");(l==="auto"||l==="sRGB"||l==="linearRGB")&&(e.type==="raw-svg"?e.colorInterpolationFilters=l:e.filterColorInterpolation=l);let u=ra(t,"flood-color"),d=ra(t,"flood-opacity"),c=ra(t,"lighting-color");u!==void 0&&(e.floodColor=u),d!==void 0&&(e.floodOpacity=d),c!==void 0&&(e.lightingColor=c)}function Ir(e,t,r){let n={id:Rd(t,e.sourceNodeId),type:t};for(let s of["in","result","x","y","width","height"]){let l=j(e,s);l!==null&&(n[s]=l)}let i=j(e,"color-interpolation-filters");(i==="auto"||i==="sRGB"||i==="linearRGB")&&(n.colorInterpolationFilters=i);let a=new Set(["in","result","x","y","width","height","color-interpolation-filters"]),o={};for(let s of e.attributes)a.has(s.name)||r.has(s.name)||(o[s.name]=s.value);return Object.keys(o).length>0&&(n.unknownAttrs=o),n}function mE(e){let t=j(e,"type");if(t==="identity")return{type:t};if(t==="table"||t==="discrete"){let r=(j(e,"tableValues")??"").trim().split(/[\s,]+/u).filter(Boolean).map(n=>Jn(n));return r.some(n=>n===void 0)?void 0:{type:t,tableValues:r}}if(t==="linear"){let r={type:t},n=Jn(j(e,"slope")),i=Jn(j(e,"intercept"));return n!==void 0&&(r.slope=n),i!==void 0&&(r.intercept=i),r}if(t==="gamma"){let r={type:t},n=Jn(j(e,"amplitude")),i=Jn(j(e,"exponent")),a=Jn(j(e,"offset"));return n!==void 0&&(r.amplitude=n),i!==void 0&&(r.exponent=i),a!==void 0&&(r.offset=a),r}}function gE(e){let t={},r=e.localName.toLowerCase(),n=r==="fedistantlight"?["azimuth","elevation"]:r==="fepointlight"?["x","y","z"]:r==="fespotlight"?["x","y","z","pointsAtX","pointsAtY","pointsAtZ","specularExponent","limitingConeAngle"]:null;if(n){for(let i of n){let a=Jn(j(e,i));a!==void 0&&(t[i]=a)}return r==="fedistantlight"?{kind:"feDistantLight",...t}:r==="fepointlight"?{kind:"fePointLight",...t}:{kind:"feSpotLight",...t}}}function Yr(e,t,r,n=r){let i=Jn(j(t,r));i!==void 0&&(e[n]=i)}function ur(e,t,r,n=r){let i=j(t,r);i!==null&&(e[n]=i)}function yw(e){let t=e.localName.toLowerCase();switch(t){case"feblend":{let r=Ir(e,"feBlend",new Set(["in2","mode","no-composite"]));ur(r,e,"in2");let n=j(e,"mode");return n&&dE.has(n)&&(r.mode=n),ji(e,"no-composite")&&(r.noComposite=!0),r}case"fecolormatrix":{let r=Ir(e,"feColorMatrix",new Set(["type","values"])),n=j(e,"type");return(n==="matrix"||n==="saturate"||n==="hueRotate"||n==="luminanceToAlpha")&&(r.matrixType=n),ur(r,e,"values"),r}case"fecomponenttransfer":{let r=Ir(e,"feComponentTransfer",new Set);for(let n of Pi(e)){let i=mE(n),a=n.localName.toLowerCase();a==="fefuncr"&&i?r.funcR=i:a==="fefuncg"&&i?r.funcG=i:a==="fefuncb"&&i?r.funcB=i:a==="fefunca"&&i&&(r.funcA=i)}return r}case"fecomposite":{let r=Ir(e,"feComposite",new Set(["in2","operator","k1","k2","k3","k4"]));ur(r,e,"in2");let n=j(e,"operator");(n==="over"||n==="in"||n==="out"||n==="atop"||n==="xor"||n==="lighter"||n==="arithmetic")&&(r.operator=n);for(let i of["k1","k2","k3","k4"])Yr(r,e,i);return r}case"feconvolvematrix":{let r=Ir(e,"feConvolveMatrix",new Set(["order","kernelMatrix","divisor","bias","targetX","targetY","edgeMode","kernelUnitLength","preserveAlpha"]));ur(r,e,"order"),ur(r,e,"kernelMatrix");for(let a of["divisor","bias","targetX","targetY"])Yr(r,e,a);let n=j(e,"edgeMode");(n==="duplicate"||n==="wrap"||n==="none")&&(r.edgeMode=n),ur(r,e,"kernelUnitLength");let i=j(e,"preserveAlpha");return i!==null&&(r.preserveAlpha=i==="true"),r}case"fediffuselighting":case"fespecularlighting":{let r=t==="fediffuselighting",n=Ir(e,r?"feDiffuseLighting":"feSpecularLighting",new Set(["surfaceScale","diffuseConstant","specularConstant","specularExponent","kernelUnitLength","lighting-color"]));Yr(n,e,"surfaceScale"),r?Yr(n,e,"diffuseConstant"):(Yr(n,e,"specularConstant"),Yr(n,e,"specularExponent")),ur(n,e,"kernelUnitLength"),ur(n,e,"lighting-color","lightingColor");for(let i of Pi(e)){let a=gE(i);if(a){n.lightSource=a;break}}return n}case"fedisplacementmap":{let r=Ir(e,"feDisplacementMap",new Set(["in2","scale","xChannelSelector","yChannelSelector"]));ur(r,e,"in2"),Yr(r,e,"scale");for(let n of["xChannelSelector","yChannelSelector"]){let i=j(e,n);(i==="R"||i==="G"||i==="B"||i==="A")&&(r[n]=i)}return r}case"fedropshadow":{let r=Ir(e,"feDropShadow",new Set(["dx","dy","stdDeviation","flood-color","flood-opacity"]));return Yr(r,e,"dx"),Yr(r,e,"dy"),ur(r,e,"stdDeviation"),ur(r,e,"flood-color","floodColor"),ur(r,e,"flood-opacity","floodOpacity"),r}case"feflood":{let r=Ir(e,"feFlood",new Set(["flood-color","flood-opacity"]));return ur(r,e,"flood-color","floodColor"),ur(r,e,"flood-opacity","floodOpacity"),r}case"fegaussianblur":{let r=Ir(e,"feGaussianBlur",new Set(["stdDeviation","edgeMode"]));ur(r,e,"stdDeviation");let n=j(e,"edgeMode");return(n==="duplicate"||n==="wrap"||n==="none")&&(r.edgeMode=n),r}case"feimage":{let r=Ir(e,"feImage",new Set(["href","xlink:href","preserveAspectRatio","crossorigin"])),n=yr(e);n?.namespace==="svg2"?r.href=n.value:n?.namespace==="xlink"&&(r.xlinkHref=n.value),ur(r,e,"preserveAspectRatio");let i=j(e,"crossorigin");return(i==="anonymous"||i==="use-credentials")&&(r.crossorigin=i),r}case"femerge":{let r=Ir(e,"feMerge",new Set);return r.nodes=Pi(e).filter(n=>n.localName.toLowerCase()==="femergenode").map(n=>{let i=j(n,"in");return i===null?{}:{in:i}}),r}case"femorphology":{let r=Ir(e,"feMorphology",new Set(["operator","radius"])),n=j(e,"operator");return(n==="erode"||n==="dilate")&&(r.operator=n),ur(r,e,"radius"),r}case"feoffset":{let r=Ir(e,"feOffset",new Set(["dx","dy"]));return Yr(r,e,"dx"),Yr(r,e,"dy"),r}case"fetile":return Ir(e,"feTile",new Set);case"feturbulence":{let r=Ir(e,"feTurbulence",new Set(["baseFrequency","numOctaves","seed","stitchTiles","type"]));ur(r,e,"baseFrequency"),Yr(r,e,"numOctaves"),Yr(r,e,"seed");let n=j(e,"stitchTiles");(n==="stitch"||n==="noStitch")&&(r.stitchTiles=n);let i=j(e,"type");return(i==="fractalNoise"||i==="turbulence")&&(r.turbulenceType=i),r}default:return null}}function yE(e){let t=[],r="",n=0;for(let i of e)i==="("?n++:i===")"&&n--,/\s/u.test(i)&&n===0?(r&&t.push(r),r=""):r+=i;return r&&t.push(r),t}function on(e,t){return(e===void 0?void 0:Jn(e))??t}function vE(e,t){let r=yE(e);if(r.length<2)return null;let n=r[0],i=r[1]==="1",a={id:Rd(n,t,":preset"),enabled:i};switch(n){case"hue-rotate":return{...a,type:n,angle:on(r[2],0)};case"sepia":case"grayscale":case"saturate":case"invert":case"brightness":case"contrast":return{...a,type:n,amount:on(r[2],1)};case"duotone":return{...a,type:n,shadowColor:r[2]??"#000000",highlightColor:r[3]??"#ffffff"};case"inner-shadow":return{...a,type:n,offsetX:on(r[2],0),offsetY:on(r[3],0),blurRadius:on(r[4],0),choke:on(r[5],0),color:r[6]??"rgba(0,0,0,0.5)",opacity:1};case"drop-shadow":return{...a,type:n,offsetX:on(r[2],0),offsetY:on(r[3],0),blurRadius:on(r[4],0),spread:on(r[5],0),color:r[6]??"rgba(0,0,0,0.5)",opacity:1};case"gaussian-blur":{let o=on(r[2],0);return{...a,type:n,blurX:o,blurY:on(r[3],o),linked:r[3]===void 0,quality:"normal"}}default:return null}}function bE(e,t){let r={id:Rd("raw-svg",e.sourceNodeId),type:"raw-svg",enabled:!0,svgContent:Pi(e).map(cE).filter(Boolean).join(`
37
+ `)};return gw(r,e),t&&(r.display="none"),r}function xE(e){let t={id:Rd("svg-primitive-chain",e.sourceNodeId),type:"svg-primitive-chain",enabled:!0,primitives:[]};gw(t,e);for(let r of Pi(e)){let n=r.localName.toLowerCase();if(n==="title")t.filterTitle=_0(r);else if(n==="desc")t.filterDescription=_0(r);else{if(uE.has(n))continue;{let i=yw(r);i&&t.primitives.push(i)}}}return t}function wE(e,t,r,n,i,a){let o=hE(t,r,n),s=t.attributes.find(m=>m.localName==="preset"&&m.prefix==="bx")?.value,l=pE(e,t,r,n),u=j(t,"filterUnits"),d=j(t,"primitiveUnits"),c=j(t,"color-interpolation-filters");u!==null&&u!=="userSpaceOnUse"&&u!=="objectBoundingBox"&&a.push(Fu(i,`Invalid filterUnits value "${u}" uses its initial value.`,t)),d!==null&&d!=="userSpaceOnUse"&&d!=="objectBoundingBox"&&a.push(Fu(i,`Invalid primitiveUnits value "${d}" uses its initial value.`,t)),c!==null&&c!=="auto"&&c!=="sRGB"&&c!=="linearRGB"&&a.push(Fu(i,`Invalid color-interpolation-filters value "${c}" uses its initial value.`,t));let f=s?vE(s,t.sourceNodeId):l||fE(t)?bE(t,l):xE(t),p=Object.freeze(f?[f]:[]),h=f?.type==="svg-primitive-chain"&&f.primitives.length===0;return ha({sourceNodeId:t.sourceNodeId,sourceId:j(t,"id"),definitionPlacement:e.index.parent(t.sourceNodeId)===e.root?"document":"defs",status:f?h?"empty":"materialized":"invalid",filters:p,...o})}function IE(e,t){let r=sE.exec(e.trim());if(!r)return null;let n=Number(r[1]);return!Number.isFinite(n)||n<0?null:r[2]?n/100:n}function kE(e){let t=lE.exec(e.trim());if(!t)return null;let r=Number(t[1]);if(!Number.isFinite(r))return null;switch((t[2]??"deg").toLowerCase()){case"turn":return r*360;case"rad":return r*180/Math.PI;case"grad":return r*.9;default:return r}}function SE(e){let t=[],r="",n=null,i=!1,a=0;for(let o of e){if(n){r+=o,i?i=!1:o==="\\"?i=!0:o===n&&(n=null);continue}o==='"'||o==="'"?(n=o,r+=o):o==="("?(a++,r+=o):o===")"?(a--,r+=o):/\s/u.test(o)&&a===0?(r&&t.push(r),r=""):r+=o}return r&&t.push(r),t}function $E(e,t){if(e.toLowerCase()==="currentcolor")return t??"#000000";if(/^#[\da-f]{3,8}$/iu.test(e)||/^rgba?\(/iu.test(e))return e;let r=$b(e);return r?`rgb(${r.r}, ${r.g}, ${r.b})`:null}function NE(e,t,r,n,i,a){if(e==="brightness"||e==="contrast"||e==="grayscale"||e==="invert"||e==="opacity"||e==="saturate"||e==="sepia"){let l=IE(t,1);return l===null?null:{id:r,type:e,enabled:!0,amount:l}}if(e==="hue-rotate"){let l=kE(t);return l===null?null:{id:r,type:e,enabled:!0,angle:l}}if(e==="blur"){let l=it(t.trim(),{fontSize:i,rootFontSize:a.rootFontSize??16,viewportWidth:a.viewport?.width,viewportHeight:a.viewport?.height});return l===void 0||l<0||t.trim().endsWith("%")?null:{id:r,type:"gaussian-blur",enabled:!0,blurX:l,blurY:l,linked:!0,quality:"normal"}}if(e!=="drop-shadow")return null;let o=[],s=null;for(let l of SE(t.trim())){let u=it(l,{fontSize:i,rootFontSize:a.rootFontSize??16,viewportWidth:a.viewport?.width,viewportHeight:a.viewport?.height});if(u!==void 0&&!l.endsWith("%"))o.push(u);else{let d=$E(l,n);if(!d||s!==null)return null;s=d}}return o.length<2||o.length>3||(o[2]??0)<0?null:{id:r,type:"drop-shadow",enabled:!0,offsetX:o[0],offsetY:o[1],blurRadius:o[2]??0,spread:0,color:s??n??"#000000",opacity:1}}function ME(e,t,r){let n=e.resolvePropertyValue(t.correspondingSourceNodeId,"filter",r),i=n.filter(a=>a.occurrenceId===t.occurrenceId);return i.length>0?i:n.filter(a=>a.occurrenceId===null)}function AE(e){let t=e.trim();return t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),t.startsWith("#")&&t.length>1?t.slice(1):null}function CE(e,t){let r=0;for(let n of t){if(e.slice(r,n.tokenStart).replace(/\/\*[\s\S]*?\*\//gu,"").trim())return!1;r=n.tokenEnd}return e.slice(r).replace(/\/\*[\s\S]*?\*\//gu,"").trim().length===0}function OE(e,t,r,n,i,a,o,s){let l=[],u=ME(n,e,t),d=0,c=!1,f=it(r.value(e.occurrenceId,"font-size"),{fontSize:a.rootFontSize??16,rootFontSize:a.rootFontSize??16,viewportWidth:a.viewport?.width,viewportHeight:a.viewport?.height})??a.rootFontSize??16,p=r.value(e.occurrenceId,"color"),h=Po(t);CE(t,h)||(c=!0);for(let[g,v]of h.entries()){let y=`filter-operation:${e.occurrenceId}:${g}`,b=t.slice(v.tokenStart,v.tokenEnd);if(v.name!=="url"){let $=NE(v.name,t.slice(v.argumentsStart,v.argumentsEnd),y,p,f,a),A=$?"materialized":"invalid-reference";$||(c=!0,o.push(Fu(a,`Invalid or unsupported CSS filter function "${b}".`,s,e.occurrenceId))),l.push(Object.freeze({operationId:y,kind:"function",authoredValue:b,filter:$,filterSourceNodeId:null,status:A}));continue}let I=AE(t.slice(v.argumentsStart,v.argumentsEnd))===null?void 0:u[d++],x=I?.targetSourceNodeId?i.get(I.targetSourceNodeId):null,k=I?.validity==="valid"&&x?x.status==="empty"?"empty":x.status==="materialized"?"materialized":"invalid-reference":"invalid-reference";k==="invalid-reference"&&(c=!0),l.push(ha({operationId:y,kind:"reference",authoredValue:b,filter:k==="materialized"?x?.filters[0]??null:null,filterSourceNodeId:I?.targetSourceNodeId??null,status:k}))}let m=t.trim().toLowerCase()==="none"?"none":c||l.length===0?"invalid-reference":"materialized";return ha({consumerOccurrenceId:e.occurrenceId,consumerSourceNodeId:e.correspondingSourceNodeId,authoredValue:t,status:m,operations:Object.freeze(l)})}function TE(e,t,r,n,i){let a=[],o=n.resources.filter(f=>f.kind==="filter").map(f=>e.index.element(f.sourceNodeId)).filter(f=>!!f).map(f=>wE(e,f,t,r,i,a)),s=new Map(o.map(f=>[f.sourceNodeId,f])),l=new Map;for(let f of o){let p=e.index.element(f.sourceNodeId);if(p)for(let h of Pi(p)){let m=yw(h);m&&l.set(h.sourceNodeId,m.id)}}let u=[];for(let f of t.occurrences){let p=e.index.element(f.correspondingSourceNodeId);if(!p)continue;let h=r.value(f.occurrenceId,"filter");h&&u.push(OE(f,h,r,n,s,i,a,p))}let d=new Map(u.map(f=>[f.consumerOccurrenceId,f]));ha(o),ha(u),ha(a);let c=Object.freeze({candidates:o,bindings:u,diagnostics:a,candidate(f){return s.get(f)??null},primitiveId(f){return l.get(f)??null},binding(f){return d.get(f)??null}});return Object.freeze({value:c,diagnostics:a})}var PE=[{generator:"svgator",tokens:["__SVGATOR_PLAYER__","cdn.svgator.com","svgator.com/ply"]},{generator:"lottie",tokens:["bodymovin","lottie.loadAnimation"]},{generator:"vivus",tokens:["new Vivus(","Vivus("]},{generator:"gsap",tokens:["gsap.","TweenMax","TweenLite","TimelineMax","TimelineLite"]},{generator:"anime",tokens:["anime.timeline","anime({"]},{generator:"snap",tokens:["Snap("]}],DE=["requestAnimationFrame","setInterval(","setTimeout("],jE=["setAttribute",".style.","setAttributeNS","classList"];function _f(e,t){return t.some(r=>e.includes(r))}function EE(e){return`${e.content}
38
+ ${e.href??""}`}function zE(e){return e?"project-id"in e&&"export-id"in e:!1}function _E(e,t){for(let n of PE){let i=e.findIndex(o=>_f(EE(o),n.tokens));if(i<0)continue;if(n.generator!=="svgator")return{generator:n.generator,scriptIndex:i,convertible:!1};let a=RE(e[i].content);return{generator:"svgator",scriptIndex:i,convertible:a!==null,...a?.version?{version:a.version}:{}}}let r=e.findIndex(n=>{let i=n.content;return _f(i,DE)&&_f(i,jE)});return r>=0?{generator:"unknown",scriptIndex:r,convertible:!1}:zE(t)?{generator:"svgator",scriptIndex:-1,convertible:!1}:null}function RE(e){let t=FE(e);if(t===null)return null;try{let r=JSON.parse(t);if(!r||typeof r!="object")return null;let n=r;return typeof n.root!="string"||!Array.isArray(n.animations)?null:typeof n.version=="string"?{version:n.version}:{}}catch{return null}}function FE(e){let t=e.search(/\}\)\(\s*'[^']*'\s*,\s*\{/);if(t<0)return null;let r=e.indexOf("{",e.indexOf(",",t));if(r<0)return null;let n=0,i=!1,a=!1;for(let o=r;o<e.length;o+=1){let s=e[o];if(a){a=!1;continue}if(i){s==="\\"?a=!0:s==='"'&&(i=!1);continue}if(s==='"')i=!0;else if(s==="{")n+=1;else if(s==="}"&&(n-=1,n===0))return e.slice(r,o+1)}return null}var LE="application/ecmascript",BE="http://www.w3.org/1999/xlink",VE=Object.freeze([]);function UE(e){let t="",r=[...e.children].reverse();for(;r.length>0;){let n=r.pop();n.kind==="text"||n.kind==="cdata"?t+=n.value:n.kind==="element"&&r.push(...[...n.children].reverse())}return t}function GE(e,t){let r=e.attributes[t];return r.namespaceUri===BE&&r.localName==="href"?!0:r.namespaceUri!==null?!1:["id","type","href","crossorigin","async","defer"].includes(r.localName)}function XE(e){let t=e.attributes.filter((r,n)=>!GE(e,n)).map(r=>[r.name,r.value]);return t.length>0?Object.freeze(Object.fromEntries(t)):void 0}function WE(e,t){return!t||t.sourceNodeId===e.root.sourceNodeId||t.namespaceUri===ye&&["defs","metadata"].includes(t.localName.toLowerCase())?"document":"element"}function HE(e){let t=yr(e)?.value,r=t!==void 0&&t.length>0,n=j(e,"type")||LE,i=j(e,"crossorigin"),a=j(e,"id")||void 0,o=XE(e);return Object.freeze({id:`script:${e.sourceNodeId}`,...a?{svgId:a}:{},source:r?"external":"inline",content:r?"":UE(e),...r?{href:t}:{},type:n,...i==="anonymous"||i==="use-credentials"?{crossorigin:i}:{},...ji(e,"async")?{async:!0}:{},...ji(e,"defer")?{defer:!0}:{},...o?{customAttrs:o}:{}})}function qE(e){return Object.freeze(Object.fromEntries(e.root.attributes.map(t=>[t.name,t.value])))}function YE(e,t,r){return Object.freeze({severity:"warning",code:"script-behavior-inert",source:t.source,entrypoint:t.entrypoint,capability:"scripts",sourceNodeId:e.root.sourceNodeId,elementName:"script",message:r?`Preserved script content drives this document's animation (${r.generator}); the editor never executes scripts, so the animation is inert here.`:"Preserved script content is never executed by the editor, so any script-driven behavior is inert here."})}function KE(e,t){let r=[],n=e.index.elements.filter(d=>d.namespaceUri===ye&&d.localName.toLowerCase()==="script").map(d=>{let c=e.index.parent(d.sourceNodeId);return Object.freeze({sourceNodeId:d.sourceNodeId,parentSourceNodeId:c?.sourceNodeId??null,scope:WE(e,c),script:HE(d)})}),i=Object.freeze(n.filter(d=>d.scope==="document")),a=Object.freeze(n.filter(d=>d.scope==="element")),o=new Map(n.map(d=>[d.sourceNodeId,d])),s=new Map;for(let d of a){if(!d.parentSourceNodeId)continue;let c=s.get(d.parentSourceNodeId)??[];s.set(d.parentSourceNodeId,Object.freeze([...c,d]))}let l=_E(n.map(d=>({content:d.script.content,...d.script.href?{href:d.script.href}:{}})),qE(e));n.length>0&&cT("scripts",t.entrypoint).status==="diagnosed-lossy"&&r.push(YE(e,t,l)),Object.freeze(n),Object.freeze(r);let u=Object.freeze({candidates:n,documentScripts:i,elementScripts:a,animationSource:l,candidate(d){return o.get(d)??null},forParent(d){return s.get(d)??VE}});return Object.freeze({value:u,diagnostics:r})}var ZE=new Set(["id","href","x1","y1","x2","y2","cx","cy","fx","fy","r","fr","gradientunits","gradienttransform","spreadmethod","color-interpolation"]);function Fd(e){let t=e.toLowerCase();return/^[A-Za-z_][\w:.-]*$/u.test(e)&&!/^on/iu.test(e)&&t!=="xmlns"&&!t.startsWith("xmlns:")&&t!=="data-source-id"&&!ZE.has(t)}var JE=new Set(["id","href","xlink:href","x","y","width","height","patternunits","patterncontentunits","patterntransform","viewbox","preserveaspectratio"]);function Ld(e){let t=e.toLowerCase();return/^[A-Za-z_][\w:.-]*$/u.test(e)&&!/^on/iu.test(e)&&t!=="xmlns"&&!t.startsWith("xmlns:")&&t!=="data-source-id"&&!JE.has(t)}function QE(e,t,r,n){let i=n?.strokeWidth!=null?Math.max(.5,t*n.strokeWidth):Math.max(1,t/10);switch(e){case"stripes":return[{tag:"rect",attrs:{width:n?.strokeWidth!=null?Math.max(.01,Math.min(1,n.strokeWidth))*t:t/2,height:t,fill:r}}];case"dots":{let a=n?.dotRadius!=null?Math.max(.05,Math.min(.45,n.dotRadius)):.25;return[{tag:"circle",attrs:{cx:t/2,cy:t/2,r:t*a,fill:r}}]}case"grid":return[{tag:"path",attrs:{d:`M ${t} 0 L 0 0 0 ${t}`,fill:"none",stroke:r,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:t/2,height:t/2,fill:r}},{tag:"rect",attrs:{x:t/2,y:t/2,width:t/2,height:t/2,fill:r}}];case"diagonal":{let a=n?.strokeWidth!=null?Math.max(.5,t*n.strokeWidth):Math.max(1,t/5);return[{tag:"path",attrs:{d:`M 0 ${t} L ${t} 0`,stroke:r,"stroke-width":a}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${t} L ${t} 0 M 0 0 L ${t} ${t}`,stroke:r,"stroke-width":i}}];case"zigzag":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=t*a;return[{tag:"path",attrs:{d:`M 0 ${o} L ${t/4} 0 L ${t/2} ${o} L ${t*3/4} 0 L ${t} ${o}`,fill:"none",stroke:r,"stroke-width":i}}]}case"waves":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=t*a,s=t/2;return[{tag:"path",attrs:{d:`M 0 ${s} Q ${t/4} ${s-o} ${t/2} ${s} T ${t} ${s}`,fill:"none",stroke:r,"stroke-width":i}}]}case"triangles":{let a=t*.866;return[{tag:"path",attrs:{d:`M ${t/2} 0 L ${t} ${a} L 0 ${a} Z`,fill:"none",stroke:r,"stroke-width":i}}]}case"hexagons":{let a=t*.866;return[{tag:"path",attrs:{d:`M ${t*.25} 0 L ${t*.75} 0 L ${t} ${a*.5} L ${t*.75} ${a} L ${t*.25} ${a} L 0 ${a*.5} Z`,fill:"none",stroke:r,"stroke-width":i}}]}case"diamonds":return[{tag:"path",attrs:{d:`M ${t/2} 0 L ${t} ${t/2} L ${t/2} ${t} L 0 ${t/2} Z`,fill:"none",stroke:r,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:t/2,cy:t/2,r:t/3,fill:"none",stroke:r,"stroke-width":i}}];case"bricks":{let a=n?.strokeWidth!=null?Math.max(.5,t*n.strokeWidth):Math.max(1,t/15);return[{tag:"rect",attrs:{x:0,y:0,width:t,height:t/2,fill:"none",stroke:r,"stroke-width":a}},{tag:"rect",attrs:{x:-t/2,y:t/2,width:t,height:t/2,fill:"none",stroke:r,"stroke-width":a}},{tag:"rect",attrs:{x:t/2,y:t/2,width:t,height:t/2,fill:"none",stroke:r,"stroke-width":a}}]}case"herringbone":return[{tag:"path",attrs:{d:`M 0 0 L ${t/2} ${t/2} L 0 ${t} M ${t/2} ${t/2} L ${t} 0 M ${t/2} ${t/2} L ${t} ${t}`,fill:"none",stroke:r,"stroke-width":i}}];default:return[]}}function Ae(e,t,r){r==null||r===""||e.push([t,r])}function vw(e){return(e.stops??[]).map(t=>{let r=[...t.id?[["id",t.id]]:[],["offset",`${t.offset*100}%`],["stop-color",t.color]];return t.opacity!==void 0&&t.opacity<1&&r.push(["stop-opacity",t.opacity]),{attributes:r}})}function bw(e,t){for(let[r,n]of Object.entries(t.rootAttributes??{}))Fd(r)&&e.push([r,n])}function ez(e,t){let r=t.gradientUnits==="userSpaceOnUse",n=o=>r?String(o):`${o*100}%`,i=t.authoredGeometry??{},a=[["id",e]];return bw(a,t),t.templateId&&Ae(a,"href",`#${t.templateId}`),t.gradientUnits!==void 0&&Ae(a,"gradientUnits",t.gradientUnits),(i.x1!==void 0||t.x1!==void 0)&&Ae(a,"x1",i.x1??n(t.x1)),(i.y1!==void 0||t.y1!==void 0)&&Ae(a,"y1",i.y1??n(t.y1)),(i.x2!==void 0||t.x2!==void 0)&&Ae(a,"x2",i.x2??n(t.x2)),(i.y2!==void 0||t.y2!==void 0)&&Ae(a,"y2",i.y2??n(t.y2)),Ae(a,"spreadMethod",t.spreadMethod),t.colorInterpolation&&t.colorInterpolation!=="sRGB"&&Ae(a,"color-interpolation",t.colorInterpolation),Ae(a,"gradientTransform",i.gradientTransform??Qp(t.gradientTransform)),{element:"linearGradient",attributes:a,stops:vw(t)}}function tz(e,t){let r=t.gradientUnits==="userSpaceOnUse",n=o=>r?String(o):`${o*100}%`,i=t.authoredGeometry??{},a=[["id",e]];bw(a,t),t.templateId&&Ae(a,"href",`#${t.templateId}`),t.gradientUnits!==void 0&&Ae(a,"gradientUnits",t.gradientUnits);for(let o of["cx","cy","fx","fy","r"]){let s=t[o];(i[o]!==void 0||s!==void 0)&&Ae(a,o,i[o]??n(s))}if((i.fr!==void 0||t.fr!==void 0)&&Ae(a,"fr",i.fr??n(t.fr)),Ae(a,"spreadMethod",t.spreadMethod),t.colorInterpolation&&t.colorInterpolation!=="sRGB"&&Ae(a,"color-interpolation",t.colorInterpolation),i.gradientTransform!==void 0||t.gradientTransform!==void 0)Ae(a,"gradientTransform",i.gradientTransform??Qp(t.gradientTransform));else if(t.r!==void 0){let o=t.ry??t.r,s=t.rotation??0;if(o!==t.r||s!==0){let l=t.cx??(r?0:.5),u=t.cy??(r?0:.5),d=[`translate(${l}, ${u})`];s&&d.push(`rotate(${s})`),o!==0&&d.push(`scale(1, ${o/t.r})`),d.push(`translate(${-l}, ${-u})`),Ae(a,"gradientTransform",d.join(" "))}}return{element:"radialGradient",attributes:a,stops:vw(t)}}function rz(e){let t=Object.entries(e.attrs).map(([r,n])=>` ${r}="${Me(String(n))}"`).join("");return`<${e.tag}${t}/>`}function nz(e,t){let r=[["id",e]];for(let[l,u]of Object.entries(t.rootAttributes??{}))Ld(l)&&r.push([l,u]);if(t.templateId&&Ae(r,"href",`#${t.templateId}`),t.svgContent!=null||t.patternType==="custom"||t.templateId){let l=t.authoredGeometry??{};return Ae(r,"patternUnits",t.patternUnits),Ae(r,"patternContentUnits",t.patternContentUnits),Ae(r,"x",l.x??t.x),Ae(r,"y",l.y??t.y),Ae(r,"width",l.width??t.width),Ae(r,"height",l.height??t.height),Ae(r,"viewBox",t.viewBox),Ae(r,"preserveAspectRatio",t.preserveAspectRatio),Ae(r,"patternTransform",t.patternTransform),{attributes:r,content:t.svgContent??""}}let n=10*(t.scale??1),i=t.color||"#000000",a=t.backgroundColor||"#ffffff";Ae(r,"patternUnits","userSpaceOnUse"),Ae(r,"width",n),Ae(r,"height",n),t.rotation&&Ae(r,"patternTransform",`rotate(${t.rotation})`);let o=`<rect width="${Me(String(n))}" height="${Me(String(n))}" fill="${Me(a)}"/>`,s=QE(t.patternType,n,i).map(rz).join("");return{attributes:r,content:`${o}${s}`}}function iz(e){return e.some(t=>t.type==="gaussian-blur"||t.type==="motion-blur"||t.type==="drop-shadow"||t.type==="inner-shadow"||t.type==="glow"||t.type==="inner-glow"||t.type==="outline"||t.type==="morphology"||t.type==="warp"||t.type==="svg-primitive-chain"&&t.primitives.some(r=>r.type==="feGaussianBlur"||r.type==="feDropShadow"||r.type==="feOffset"||r.type==="feMorphology"||r.type==="feDisplacementMap"||r.type==="feTurbulence"))}function az(e,t,r={}){let n=t.filter(f=>f.enabled);if(n.length===0)return null;let i=n.find(f=>f.type==="raw-svg");if(i){let f=[["id",e]];return Ae(f,"x",r.x??i.x),Ae(f,"y",r.y??i.y),Ae(f,"width",r.width??i.width),Ae(f,"height",r.height??i.height),Ae(f,"filterUnits",r.filterUnits??i.filterUnits),Ae(f,"primitiveUnits",r.primitiveUnits??i.primitiveUnits),Ae(f,"color-interpolation-filters",r.colorInterpolation&&r.colorInterpolation!=="auto"?r.colorInterpolation:i.colorInterpolationFilters),Ae(f,"flood-color",i.floodColor),Ae(f,"flood-opacity",i.floodOpacity),Ae(f,"lighting-color",i.lightingColor),Ae(f,"display",i.display),{kind:"raw",attributes:f,content:i.svgContent}}let a=n.find(f=>f.type==="svg-primitive-chain");if(a)return{kind:"primitive-chain",attributes:[],chain:{...a,x:r.x??a.x,y:r.y??a.y,width:r.width??a.width,height:r.height??a.height,filterUnits:r.filterUnits??a.filterUnits,primitiveUnits:r.primitiveUnits??a.primitiveUnits,filterColorInterpolation:r.colorInterpolation&&r.colorInterpolation!=="auto"?r.colorInterpolation:a.filterColorInterpolation}};let o=n.some(f=>f.type==="gaussian-blur"&&f.quality==="high"||f.type==="motion-blur"&&f.quality==="high"),s=iz(n),l=s?o?"-200%":"-100%":"-10%",u=s?o?"500%":"300%":"120%",d=r.primitiveUnits??"userSpaceOnUse",c=[["id",e]];return Ae(c,"x",r.x??l),Ae(c,"y",r.y??l),Ae(c,"width",r.width??u),Ae(c,"height",r.height??u),Ae(c,"filterUnits",r.filterUnits??"objectBoundingBox"),Ae(c,"primitiveUnits",d),r.colorInterpolation&&r.colorInterpolation!=="auto"&&Ae(c,"color-interpolation-filters",r.colorInterpolation),{kind:"generated",attributes:c,filters:n,primitiveUnits:d}}function w(e,t){return t==null||t===""?"":` ${e}="${Me(String(t))}"`}function nd(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16)/255,g:parseInt(t[2],16)/255,b:parseInt(t[3],16)/255}:{r:0,g:0,b:0}}function oz(e,t,r){let{offsetX:n,offsetY:i,blurRadius:a,spread:o,color:s,opacity:l}=e,u="";if(o===0)u+=`<feDropShadow${w("in",t)}${w("dx",n)}${w("dy",i)}${w("stdDeviation",a/2)}${w("flood-color",s)}${w("flood-opacity",l)}${w("result",`${r}_shadow`)}/>`,u+=`<feMerge${w("result",r)}><feMergeNode${w("in",`${r}_shadow`)}/><feMergeNode${w("in",t)}/></feMerge>`;else{u+=`<feColorMatrix${w("in",t)}${w("type","matrix")}${w("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${w("result",`${r}_alpha`)}/>`;let d=o>0?"dilate":"erode",c=Math.abs(o);u+=`<feMorphology${w("in",`${r}_alpha`)}${w("operator",d)}${w("radius",c)}${w("result",`${r}_spread`)}/>`,u+=`<feGaussianBlur${w("in",`${r}_spread`)}${w("stdDeviation",a/2)}${w("result",`${r}_blur`)}/>`,u+=`<feOffset${w("in",`${r}_blur`)}${w("dx",n)}${w("dy",i)}${w("result",`${r}_offset`)}/>`,u+=`<feFlood${w("flood-color",s)}${w("flood-opacity",l)}${w("result",`${r}_color`)}/>`,u+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_offset`)}${w("operator","in")}${w("result",`${r}_shadow`)}/>`,u+=`<feMerge${w("result",r)}><feMergeNode${w("in",`${r}_shadow`)}/><feMergeNode${w("in",t)}/></feMerge>`}return u}function sz(e,t,r){let{offsetX:n,offsetY:i,blurRadius:a,choke:o,color:s,opacity:l}=e,u=a*(1-o/100),d="";return d+=`<feColorMatrix${w("in",t)}${w("type","matrix")}${w("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${w("result",`${r}_alpha`)}/>`,d+=`<feComponentTransfer${w("in",`${r}_alpha`)}${w("result",`${r}_inverted`)}><feFuncA${w("type","table")}${w("tableValues","1 0")}/></feComponentTransfer>`,d+=`<feGaussianBlur${w("in",`${r}_inverted`)}${w("stdDeviation",u/2)}${w("result",`${r}_blur`)}/>`,d+=`<feOffset${w("in",`${r}_blur`)}${w("dx",n)}${w("dy",i)}${w("result",`${r}_offset`)}/>`,d+=`<feFlood${w("flood-color",s)}${w("flood-opacity",l)}${w("result",`${r}_color`)}/>`,d+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_offset`)}${w("operator","in")}${w("result",`${r}_coloredShadow`)}/>`,d+=`<feComposite${w("in",`${r}_coloredShadow`)}${w("in2",`${r}_alpha`)}${w("operator","in")}${w("result",`${r}_innerShadow`)}/>`,d+=`<feComposite${w("in",`${r}_innerShadow`)}${w("in2",t)}${w("operator","over")}${w("result",r)}/>`,d}function lz(e,t,r){let{blurX:n,blurY:i}=e;return n===0&&i===0?at(t,r):`<feGaussianBlur${w("in",t)}${w("stdDeviation",`${n/2} ${i/2}`)}${w("result",r)}/>`}function uz(e,t,r){let{distance:n,angle:i}=e;if(n===0)return at(t,r);let a=i*Math.PI/180,o=Math.abs(Math.cos(a)*n),s=Math.abs(Math.sin(a)*n);return`<feGaussianBlur${w("in",t)}${w("stdDeviation",`${o/2} ${s/2}`)}${w("result",r)}/>`}function dz(e,t,r){let{x:n,y:i,z:a,color:o,surfaceScale:s,diffuseConstant:l,specularConstant:u,specularExponent:d}=e,c="";return c+=`<feDiffuseLighting${w("in","SourceAlpha")}${w("surfaceScale",s)}${w("diffuseConstant",l)}${w("lighting-color",o)}${w("result",`${r}_diffuse`)}>`,c+=`<fePointLight${w("x",n)}${w("y",i)}${w("z",a)}/>`,c+="</feDiffuseLighting>",c+=`<feSpecularLighting${w("in","SourceAlpha")}${w("surfaceScale",s)}${w("specularConstant",u)}${w("specularExponent",d)}${w("lighting-color",o)}${w("result",`${r}_specular`)}>`,c+=`<fePointLight${w("x",n)}${w("y",i)}${w("z",a)}/>`,c+="</feSpecularLighting>",c+=`<feComposite${w("in",t)}${w("in2",`${r}_diffuse`)}${w("operator","arithmetic")}${w("k1",1)}${w("k2",0)}${w("k3",0)}${w("k4",0)}${w("result",`${r}_lit`)}/>`,c+=`<feComposite${w("in",`${r}_specular`)}${w("in2",`${r}_lit`)}${w("operator","arithmetic")}${w("k1",0)}${w("k2",1)}${w("k3",1)}${w("k4",0)}${w("result",r)}/>`,c}function cz(e,t,r){let{x:n,y:i,z:a,pointsAtX:o,pointsAtY:s,pointsAtZ:l,coneAngle:u,color:d,surfaceScale:c,specularConstant:f,specularExponent:p}=e,h="";return h+=`<feSpecularLighting${w("in","SourceAlpha")}${w("surfaceScale",c)}${w("specularConstant",f)}${w("specularExponent",p)}${w("lighting-color",d)}${w("result",`${r}_specular`)}>`,h+=`<feSpotLight${w("x",n)}${w("y",i)}${w("z",a)}${w("pointsAtX",o)}${w("pointsAtY",s)}${w("pointsAtZ",l)}${w("limitingConeAngle",u)}/>`,h+="</feSpecularLighting>",h+=`<feComposite${w("in",`${r}_specular`)}${w("in2","SourceAlpha")}${w("operator","in")}${w("result",`${r}_clipped`)}/>`,h+=`<feComposite${w("in",`${r}_clipped`)}${w("in2",t)}${w("operator","arithmetic")}${w("k1",0)}${w("k2",1)}${w("k3",1)}${w("k4",0)}${w("result",r)}/>`,h}function xw(e){switch(e.kind){case"point":return`<fePointLight${w("x",e.x)}${w("y",e.y)}${w("z",e.z)}/>`;case"spot":{let t=`<feSpotLight${w("x",e.x)}${w("y",e.y)}${w("z",e.z)}${w("pointsAtX",e.pointsAtX)}${w("pointsAtY",e.pointsAtY)}${w("pointsAtZ",e.pointsAtZ)}`;return e.limitingConeAngle!==void 0&&(t+=w("limitingConeAngle",e.limitingConeAngle)),e.specularExponent!==void 0&&(t+=w("specularExponent",e.specularExponent)),t+"/>"}case"distant":return`<feDistantLight${w("azimuth",e.azimuth)}${w("elevation",e.elevation)}/>`}}function fz(e,t,r){return`<feDiffuseLighting${w("in",t)}${w("surfaceScale",e.surfaceScale)}${w("diffuseConstant",e.diffuseConstant)}${w("lighting-color",e.color)}${w("result",r)}>`+xw(e.lightSource)+"</feDiffuseLighting>"}function pz(e,t,r){return`<feSpecularLighting${w("in",t)}${w("surfaceScale",e.surfaceScale)}${w("specularConstant",e.specularConstant)}${w("specularExponent",e.specularExponent)}${w("lighting-color",e.color)}${w("result",r)}>`+xw(e.lightSource)+"</feSpecularLighting>"}function hz(e,t,r){let{width:n,color:i,opacity:a,position:o}=e,s="";if(o==="inside")s+=`<feMorphology${w("in","SourceAlpha")}${w("operator","erode")}${w("radius",n)}${w("result",`${r}_eroded`)}/>`,s+=`<feComposite${w("in","SourceAlpha")}${w("in2",`${r}_eroded`)}${w("operator","out")}${w("result",`${r}_outlineAlpha`)}/>`,s+=`<feFlood${w("flood-color",i)}${w("flood-opacity",a)}${w("result",`${r}_color`)}/>`,s+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_outlineAlpha`)}${w("operator","in")}${w("result",`${r}_outline`)}/>`,s+=`<feComposite${w("in",`${r}_outline`)}${w("in2",t)}${w("operator","over")}${w("result",r)}/>`;else{let l=o==="outside"?n:n/2;s+=`<feMorphology${w("in","SourceAlpha")}${w("operator","dilate")}${w("radius",l)}${w("result",`${r}_dilated`)}/>`,s+=`<feComposite${w("in",`${r}_dilated`)}${w("in2","SourceAlpha")}${w("operator","out")}${w("result",`${r}_outlineAlpha`)}/>`,s+=`<feFlood${w("flood-color",i)}${w("flood-opacity",a)}${w("result",`${r}_color`)}/>`,s+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_outlineAlpha`)}${w("operator","in")}${w("result",`${r}_outline`)}/>`,s+=`<feMerge${w("result",r)}><feMergeNode${w("in",`${r}_outline`)}/><feMergeNode${w("in",t)}/></feMerge>`}return s}function mz(e,t,r){let{amount:n}=e;if(n===0)return at(t,r);let i=1+4*n,a=-n,o=[0,a,0,a,i,a,0,a,0].join(" ");return`<feConvolveMatrix${w("in",t)}${w("order","3")}${w("kernelMatrix",o)}${w("divisor","1")}${w("bias","0")}${w("preserveAlpha","true")}${w("edgeMode","duplicate")}${w("result",r)}/>`}function gz(e,t,r){let{blockSize:n}=e;if(n<=1)return at(t,r);let i=n/2,a="";return a+=`<feMorphology${w("in",t)}${w("operator","erode")}${w("radius",i)}${w("result",`${r}_eroded`)}/>`,a+=`<feMorphology${w("in",`${r}_eroded`)}${w("operator","dilate")}${w("radius",i)}${w("result",r)}/>`,a}function yz(e,t,r){let{scale:n,frequency:i,octaves:a,warpType:o}=e;if(n===0)return at(t,r);let s="";return s+=`<feTurbulence${w("type",o)}${w("baseFrequency",i)}${w("numOctaves",a)}${w("seed",0)}${w("result",`${r}_turbulence`)}/>`,s+=`<feDisplacementMap${w("in",t)}${w("in2",`${r}_turbulence`)}${w("scale",n)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",r)}/>`,s}function vz(e,t,r){let{operator:n,radiusX:i,radiusY:a}=e;return i===0&&a===0?at(t,r):`<feMorphology${w("in",t)}${w("operator",n)}${w("radius",`${i} ${a}`)}${w("result",r)}/>`}function bz(e,t,r){let{levels:n}=e;if(n<2)return at(t,r);let i=[];for(let s=0;s<n;s++)i.push(s/(n-1));let a=i.join(" "),o=`<feComponentTransfer${w("in",t)}${w("result",r)}>`;return o+=`<feFuncR${w("type","discrete")}${w("tableValues",a)}/>`,o+=`<feFuncG${w("type","discrete")}${w("tableValues",a)}/>`,o+=`<feFuncB${w("type","discrete")}${w("tableValues",a)}/>`,o+="</feComponentTransfer>",o}function xz(e,t,r){let{levels:n,contrast:i}=e;if(n<2)return at(t,r);let a=[];for(let l=0;l<n;l++){let u=l/(n-1),d=u;i!==1&&(d=.5+(u-.5)*i,d=Math.max(0,Math.min(1,d))),a.push(d)}let o=a.join(" "),s=`<feComponentTransfer${w("in",t)}${w("result",r)}>`;return s+=`<feFuncR${w("type","table")}${w("tableValues",o)}/>`,s+=`<feFuncG${w("type","table")}${w("tableValues",o)}/>`,s+=`<feFuncB${w("type","table")}${w("tableValues",o)}/>`,s+="</feComponentTransfer>",s}function wz(e,t,r){let{radius:n}=e;if(n===0)return at(t,r);let i="";return i+=`<feGaussianBlur${w("in","SourceAlpha")}${w("stdDeviation",n)}${w("result",`${r}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${w("in",`${r}_blurredAlpha`)}${w("result",`${r}_thresholdAlpha`)}><feFuncA${w("type","linear")}${w("slope",20)}${w("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${w("in",t)}${w("in2",`${r}_thresholdAlpha`)}${w("operator","in")}${w("result",r)}/>`,i}function Iz(e,t,r){let{amount:n}=e;if(n===0)return at(t,r);let i=1-n;return`<feColorMatrix${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("type","saturate")}${w("values",i)}${w("result",r)}/>`}function kz(e,t,r){let{red:n,green:i,blue:a}=e;if(n===1&&i===1&&a===1)return at(t,r);let o=`<feComponentTransfer${w("in",t)}${w("result",r)}>`;return o+=`<feFuncR${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,o+=`<feFuncG${w("type","linear")}${w("slope",i)}${w("intercept",0)}/>`,o+=`<feFuncB${w("type","linear")}${w("slope",a)}${w("intercept",0)}/>`,o+="</feComponentTransfer>",o}function Sz(e,t,r){let{amount:n}=e;if(n===1)return at(t,r);let i=`<feComponentTransfer${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("result",r)}>`;return i+=`<feFuncR${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,i+=`<feFuncG${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,i+=`<feFuncB${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,i+="</feComponentTransfer>",i}function $z(e,t,r){let{amount:n}=e;if(n===1)return at(t,r);let i=.5*(1-n),a=`<feComponentTransfer${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("result",r)}>`;return a+=`<feFuncR${w("type","linear")}${w("slope",n)}${w("intercept",i)}/>`,a+=`<feFuncG${w("type","linear")}${w("slope",n)}${w("intercept",i)}/>`,a+=`<feFuncB${w("type","linear")}${w("slope",n)}${w("intercept",i)}/>`,a+="</feComponentTransfer>",a}function Nz(e,t,r){let{amount:n}=e;if(n===1)return at(t,r);let i=`<feComponentTransfer${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("result",r)}>`;return i+=`<feFuncA${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,i+="</feComponentTransfer>",i}function Mz(e,t,r){let{amount:n}=e;if(n===0)return at(t,r);let i=n,a=1-n,o=`${i} ${a}`,s=`<feComponentTransfer${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("result",r)}>`;return s+=`<feFuncR${w("type","table")}${w("tableValues",o)}/>`,s+=`<feFuncG${w("type","table")}${w("tableValues",o)}/>`,s+=`<feFuncB${w("type","table")}${w("tableValues",o)}/>`,s+="</feComponentTransfer>",s}function Az(e,t,r){let{angle:n}=e;return n===0||n===360?at(t,r):`<feColorMatrix${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("type","hueRotate")}${w("values",n)}${w("result",r)}/>`}function Cz(e,t,r){let{amount:n}=e;return n===1?at(t,r):`<feColorMatrix${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("type","saturate")}${w("values",n)}${w("result",r)}/>`}function Oz(e,t,r){let{threshold:n}=e,i="";if(i+=`<feColorMatrix${w("in",t)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_gray`)}/>`,n===.5)i+=`<feComponentTransfer${w("in",`${r}_gray`)}${w("result",r)}>`,i+=`<feFuncR${w("type","discrete")}${w("tableValues","0 1")}/>`,i+=`<feFuncG${w("type","discrete")}${w("tableValues","0 1")}/>`,i+=`<feFuncB${w("type","discrete")}${w("tableValues","0 1")}/>`,i+="</feComponentTransfer>";else{let a=[];for(let s=0;s<256;s++)a.push(s/255<n?0:1);let o=a.join(" ");i+=`<feComponentTransfer${w("in",`${r}_gray`)}${w("result",r)}>`,i+=`<feFuncR${w("type","table")}${w("tableValues",o)}/>`,i+=`<feFuncG${w("type","table")}${w("tableValues",o)}/>`,i+=`<feFuncB${w("type","table")}${w("tableValues",o)}/>`,i+="</feComponentTransfer>"}return i}function Tz(e,t,r){let{amount:n}=e;if(n===0)return at(t,r);let i=[.393,.769,.189,0,0],a=[.349,.686,.168,0,0],o=[.272,.534,.131,0,0],s=[1,0,0,0,0],l=[0,1,0,0,0],u=[0,0,1,0,0],d=(m,g)=>m.map((v,y)=>v*(1-n)+g[y]*n),c=d(s,i),f=d(l,a),p=d(u,o),h=[...c,...f,...p,0,0,0,1,0].join(" ");return`<feColorMatrix${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("type","matrix")}${w("values",h)}${w("result",r)}/>`}function Pz(e,t,r){let{shadowColor:n,highlightColor:i}=e,a=nd(n),o=nd(i),s="";return s+=`<feColorMatrix${w("in",t)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_gray`)}/>`,s+=`<feComponentTransfer${w("in",`${r}_gray`)}${w("result",r)}>`,s+=`<feFuncR${w("type","table")}${w("tableValues",`${a.r} ${o.r}`)}/>`,s+=`<feFuncG${w("type","table")}${w("tableValues",`${a.g} ${o.g}`)}/>`,s+=`<feFuncB${w("type","table")}${w("tableValues",`${a.b} ${o.b}`)}/>`,s+="</feComponentTransfer>",s}function Dz(e,t,r){let{intensity:n}=e;if(n===0)return at(t,r);let i="";i+=`<feComponentTransfer${w("in",t)}${w("result",`${r}_invert`)}>`,i+=`<feFuncR${w("type","table")}${w("tableValues","1 0")}/>`,i+=`<feFuncG${w("type","table")}${w("tableValues","1 0")}/>`,i+=`<feFuncB${w("type","table")}${w("tableValues","1 0")}/>`,i+="</feComponentTransfer>",i+=`<feColorMatrix${w("in",`${r}_invert`)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_gray`)}/>`;let a=[.1,.1,.1,0,0],o=[.3,.4,.3,0,0],s=[.5,.5,.8,0,0],l=[1,0,0,0,0],u=[0,1,0,0,0],d=[0,0,1,0,0],c=(g,v)=>g.map((y,b)=>y*(1-n)+v[b]*n),f=c(l,a),p=c(u,o),h=c(d,s),m=[...f,...p,...h,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${w("in",`${r}_gray`)}${w("type","matrix")}${w("values",m)}${w("result",r)}/>`,i}function jz(e,t,r){let{amount:n,scale:i}=e;if(n===0)return at(t,r);let a=1/i,o="";return o+=`<feTurbulence${w("type","fractalNoise")}${w("baseFrequency",a)}${w("numOctaves",3)}${w("seed",0)}${w("result",`${r}_noise`)}/>`,o+=`<feColorMatrix${w("in",`${r}_noise`)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_noiseGray`)}/>`,o+=`<feBlend${w("in",t)}${w("in2",`${r}_noiseGray`)}${w("mode","overlay")}${w("result",`${r}_blended`)}/>`,o+=`<feComposite${w("in",`${r}_blended`)}${w("in2",t)}${w("operator","arithmetic")}${w("k1",0)}${w("k2",n)}${w("k3",1-n)}${w("k4",0)}${w("result",`${r}_amt`)}/>`,o+=`<feComposite${w("in",`${r}_amt`)}${w("in2",t)}${w("operator","in")}${w("result",r)}/>`,o}function Ez(e,t,r){let{strength:n,angle:i}=e;if(n===0)return at(t,r);let a=i*Math.PI/180,o=Math.cos(a),s=Math.sin(a),l=n,u=[-(l*(o+s)),-(l*s),l*(-o+s),-(l*o),1,l*o,l*(o-s),l*s,l*(o+s)].join(" ");return`<feConvolveMatrix${w("in",t)}${w("order","3 3")}${w("kernelMatrix",u)}${w("divisor",1)}${w("bias",.5)}${w("preserveAlpha","true")}${w("result",r)}/>`}function zz(e,t,r){let{amount:n,size:i}=e;if(n===0)return at(t,r);let a=.5/i,o="";return o+=`<feTurbulence${w("type","fractalNoise")}${w("baseFrequency",`${a} ${a}`)}${w("numOctaves",5)}${w("seed",0)}${w("stitchTiles","stitch")}${w("result",`${r}_grain`)}/>`,o+=`<feColorMatrix${w("in",`${r}_grain`)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_grainGray`)}/>`,o+=`<feBlend${w("in",t)}${w("in2",`${r}_grainGray`)}${w("mode","soft-light")}${w("result",`${r}_blended`)}/>`,o+=`<feComposite${w("in",`${r}_blended`)}${w("in2",t)}${w("operator","arithmetic")}${w("k1",0)}${w("k2",n)}${w("k3",1-n)}${w("k4",0)}${w("result",`${r}_amt`)}/>`,o+=`<feComposite${w("in",`${r}_amt`)}${w("in2",t)}${w("operator","in")}${w("result",r)}/>`,o}function _z(e,t,r){let{wetness:n,turbulence:i}=e;if(n===0&&i===0)return at(t,r);let a="";return a+=`<feTurbulence${w("type","fractalNoise")}${w("baseFrequency",.02+i*.03)}${w("numOctaves",4)}${w("seed",42)}${w("result",`${r}_turb`)}/>`,a+=`<feDisplacementMap${w("in",t)}${w("in2",`${r}_turb`)}${w("scale",n*15)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",`${r}_disp`)}/>`,a+=`<feGaussianBlur${w("in",`${r}_disp`)}${w("stdDeviation",n*2)}${w("result",`${r}_blur`)}/>`,a+=`<feBlend${w("in",`${r}_blur`)}${w("in2",t)}${w("mode","multiply")}${w("result",r)}/>`,a}function Rz(e,t,r){let{thickness:n,texture:i}=e;if(n===0&&i===0)return at(t,r);let a="";a+=`<feTurbulence${w("type","turbulence")}${w("baseFrequency",.03+i*.02)}${w("numOctaves",3)}${w("seed",1e3)}${w("result",`${r}_brush`)}/>`;let o=Math.max(3,8-Math.floor(n*5)),s=Array.from({length:o+1},(l,u)=>u/o).join(" ");a+=`<feComponentTransfer${w("in",t)}${w("result",`${r}_poster`)}>`;for(let l of["R","G","B"])a+=`<feFunc${l}${w("type","discrete")}${w("tableValues",s)}/>`;return a+="</feComponentTransfer>",a+=`<feDisplacementMap${w("in",`${r}_poster`)}${w("in2",`${r}_brush`)}${w("scale",i*4)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",`${r}_disp`)}/>`,a+=`<feMorphology${w("in",`${r}_disp`)}${w("operator","dilate")}${w("radius",n*.5)}${w("result",`${r}_thick`)}/>`,a+=`<feComposite${w("in",`${r}_thick`)}${w("in2",t)}${w("operator","in")}${w("result",r)}/>`,a}function Fz(e,t,r){let{spread:n,edges:i}=e;if(n===0&&i===0)return at(t,r);let a="";return a+=`<feTurbulence${w("type","fractalNoise")}${w("baseFrequency",.01+i*.02)}${w("numOctaves",5)}${w("seed",1100)}${w("result",`${r}_ink`)}/>`,a+=`<feMorphology${w("in",t)}${w("operator","dilate")}${w("radius",n*3)}${w("result",`${r}_dilate`)}/>`,a+=`<feDisplacementMap${w("in",`${r}_dilate`)}${w("in2",`${r}_ink`)}${w("scale",i*10)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",`${r}_disp`)}/>`,a+=`<feGaussianBlur${w("in",`${r}_disp`)}${w("stdDeviation",n*.5)}${w("result",r)}/>`,a}function Lz(e,t,r){let{wrinkles:n,shine:i}=e;if(n===0&&i===0)return at(t,r);let a="";return a+=`<feTurbulence${w("type","turbulence")}${w("baseFrequency",.02)}${w("numOctaves",4)}${w("seed",1200)}${w("result",`${r}_wrinkle`)}/>`,a+=`<feDisplacementMap${w("in",t)}${w("in2",`${r}_wrinkle`)}${w("scale",n*15)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",`${r}_disp`)}/>`,a+=`<feSpecularLighting${w("in",`${r}_wrinkle`)}${w("surfaceScale",n*2)}${w("specularConstant",i*1.5)}${w("specularExponent",20)}${w("result",`${r}_sheen`)}>`,a+=`<feDistantLight${w("azimuth",45)}${w("elevation",60)}/>`,a+="</feSpecularLighting>",a+=`<feBlend${w("in",`${r}_disp`)}${w("in2",`${r}_sheen`)}${w("mode","screen")}${w("result",`${r}_blend`)}/>`,a+=`<feComposite${w("in",`${r}_blend`)}${w("in2",t)}${w("operator","in")}${w("result",r)}/>`,a}function Bz(e,t,r){let{density:n,size:i}=e;if(n===0)return at(t,r);let a="",o=1-n;a+=`<feTurbulence${w("type","turbulence")}${w("baseFrequency",.1/i)}${w("numOctaves",1)}${w("seed",1400)}${w("result",`${r}_hole`)}/>`,a+=`<feComponentTransfer${w("in",`${r}_hole`)}${w("result",`${r}_thresh`)}>`;for(let s of["R","G","B","A"])a+=`<feFunc${s}${w("type","linear")}${w("slope",10)}${w("intercept",-o*10+5)}/>`;a+="</feComponentTransfer>",a+=`<feComponentTransfer${w("in",`${r}_thresh`)}${w("result",`${r}_clamp`)}>`;for(let s of["R","G","B","A"])a+=`<feFunc${s}${w("type","table")}${w("tableValues","0 0 1 1")}/>`;return a+="</feComponentTransfer>",a+=`<feComposite${w("in",t)}${w("in2",`${r}_clamp`)}${w("operator","in")}${w("result",r)}/>`,a}function Vz(e,t,r){let{color:n,radius:i,intensity:a}=e;if(a===0||i===0)return at(t,r);let{r:o,g:s,b:l}=nd(n),u="";return u+=`<feColorMatrix${w("in",t)}${w("type","matrix")}${w("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${w("result",`${r}_alpha`)}/>`,u+=`<feGaussianBlur${w("in",`${r}_alpha`)}${w("stdDeviation",i/2)}${w("result",`${r}_blur`)}/>`,u+=`<feColorMatrix${w("in",`${r}_blur`)}${w("type","matrix")}${w("values",`0 0 0 0 ${o} 0 0 0 0 ${s} 0 0 0 0 ${l} 0 0 0 ${a} 0`)}${w("result",`${r}_color`)}/>`,u+=`<feMerge${w("result",r)}><feMergeNode${w("in",`${r}_color`)}/><feMergeNode${w("in",t)}/></feMerge>`,u}function Uz(e,t,r){let{color:n,radius:i,intensity:a}=e;if(a===0||i===0)return at(t,r);let{r:o,g:s,b:l}=nd(n),u="";return u+=`<feColorMatrix${w("in",t)}${w("type","matrix")}${w("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${w("result",`${r}_alpha`)}/>`,u+=`<feMorphology${w("in",`${r}_alpha`)}${w("operator","erode")}${w("radius",i/4)}${w("result",`${r}_erode`)}/>`,u+=`<feComposite${w("in",`${r}_alpha`)}${w("in2",`${r}_erode`)}${w("operator","out")}${w("result",`${r}_edge`)}/>`,u+=`<feGaussianBlur${w("in",`${r}_edge`)}${w("stdDeviation",i/3)}${w("result",`${r}_blur`)}/>`,u+=`<feColorMatrix${w("in",`${r}_blur`)}${w("type","matrix")}${w("values",`0 0 0 0 ${o} 0 0 0 0 ${s} 0 0 0 0 ${l} 0 0 0 ${a*2} 0`)}${w("result",`${r}_color`)}/>`,u+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_alpha`)}${w("operator","in")}${w("result",`${r}_clipped`)}/>`,u+=`<feComposite${w("in",`${r}_clipped`)}${w("in2",t)}${w("operator","over")}${w("result",r)}/>`,u}function at(e,t){return`<feMerge${w("result",t)}><feMergeNode${w("in",e)}/></feMerge>`}function ww(e,t=[]){switch(e.type){case"feBlend":return Gz(e,t);case"feColorMatrix":return Xz(e,t);case"feComponentTransfer":return Wz(e,t);case"feComposite":return Hz(e,t);case"feConvolveMatrix":return qz(e,t);case"feDiffuseLighting":return Yz(e,t);case"feSpecularLighting":return Kz(e,t);case"feDisplacementMap":return Zz(e,t);case"feDropShadow":return Jz(e,t);case"feFlood":return Qz(e,t);case"feGaussianBlur":return e_(e,t);case"feImage":return t_(e,t);case"feMerge":return r_(e,t);case"feMorphology":return n_(e,t);case"feOffset":return i_(e,t);case"feTile":return a_(e,t);case"feTurbulence":return o_(e,t)}}function vr(e){let t="";if(t+=w("in",e.in),t+=w("x",e.x),t+=w("y",e.y),t+=w("width",e.width),t+=w("height",e.height),t+=w("color-interpolation-filters",e.colorInterpolationFilters),t+=w("result",e.result),e.unknownAttrs){let r=Object.keys(e.unknownAttrs).sort();for(let n of r)t+=w(n,e.unknownAttrs[n])}return t}function br(e){return e.join("")}function Gz(e,t){let r=`<feBlend${vr(e)}${w("in2",e.in2)}${w("mode",e.mode)}`;e.noComposite&&(r+=' no-composite="no-composite"');let n=br(t);return n?`${r}>${n}</feBlend>`:`${r}/>`}function Xz(e,t){let r=`<feColorMatrix${vr(e)}${w("type",e.matrixType)}${w("values",e.values)}`,n=br(t);return n?`${r}>${n}</feColorMatrix>`:`${r}/>`}function wu(e,t){if(!t)return"";let r=`feFunc${e}`;switch(t.type){case"identity":return`<${r} type="identity"/>`;case"table":case"discrete":return`<${r} type="${t.type}"${w("tableValues",t.tableValues.join(" "))}/>`;case"linear":return`<${r} type="linear"${w("slope",t.slope)}${w("intercept",t.intercept)}/>`;case"gamma":return`<${r} type="gamma"${w("amplitude",t.amplitude)}${w("exponent",t.exponent)}${w("offset",t.offset)}/>`}}function Wz(e,t){let r="";return r+=wu("R",e.funcR),r+=wu("G",e.funcG),r+=wu("B",e.funcB),r+=wu("A",e.funcA),r+=br(t),`<feComponentTransfer${vr(e)}>${r}</feComponentTransfer>`}function Hz(e,t){let r=`<feComposite${vr(e)}${w("in2",e.in2)}${w("operator",e.operator)}`;e.operator==="arithmetic"&&(r+=w("k1",e.k1),r+=w("k2",e.k2),r+=w("k3",e.k3),r+=w("k4",e.k4));let n=br(t);return n?`${r}>${n}</feComposite>`:`${r}/>`}function qz(e,t){let r=`<feConvolveMatrix${vr(e)}`;r+=w("order",e.order),r+=w("kernelMatrix",e.kernelMatrix),r+=w("divisor",e.divisor),r+=w("bias",e.bias),r+=w("targetX",e.targetX),r+=w("targetY",e.targetY),r+=w("edgeMode",e.edgeMode),r+=w("kernelUnitLength",e.kernelUnitLength),e.preserveAlpha!==void 0&&(r+=w("preserveAlpha",e.preserveAlpha?"true":"false"));let n=br(t);return n?`${r}>${n}</feConvolveMatrix>`:`${r}/>`}function Iw(e){switch(e.kind){case"feDistantLight":return`<feDistantLight${w("azimuth",e.azimuth)}${w("elevation",e.elevation)}/>`;case"fePointLight":return`<fePointLight${w("x",e.x)}${w("y",e.y)}${w("z",e.z)}/>`;case"feSpotLight":{let t=`<feSpotLight${w("x",e.x)}${w("y",e.y)}${w("z",e.z)}${w("pointsAtX",e.pointsAtX)}${w("pointsAtY",e.pointsAtY)}${w("pointsAtZ",e.pointsAtZ)}`;return t+=w("specularExponent",e.specularExponent),t+=w("limitingConeAngle",e.limitingConeAngle),t+"/>"}}}function Yz(e,t){let r=`<feDiffuseLighting${vr(e)}`;r+=w("surfaceScale",e.surfaceScale),r+=w("diffuseConstant",e.diffuseConstant),r+=w("kernelUnitLength",e.kernelUnitLength),r+=w("lighting-color",e.lightingColor);let n="";return e.lightSource&&(n+=Iw(e.lightSource)),n+=br(t),`${r}>${n}</feDiffuseLighting>`}function Kz(e,t){let r=`<feSpecularLighting${vr(e)}`;r+=w("surfaceScale",e.surfaceScale),r+=w("specularConstant",e.specularConstant),r+=w("specularExponent",e.specularExponent),r+=w("kernelUnitLength",e.kernelUnitLength),r+=w("lighting-color",e.lightingColor);let n="";return e.lightSource&&(n+=Iw(e.lightSource)),n+=br(t),`${r}>${n}</feSpecularLighting>`}function Zz(e,t){let r=`<feDisplacementMap${vr(e)}`;r+=w("in2",e.in2),r+=w("scale",e.scale),r+=w("xChannelSelector",e.xChannelSelector),r+=w("yChannelSelector",e.yChannelSelector);let n=br(t);return n?`${r}>${n}</feDisplacementMap>`:`${r}/>`}function Jz(e,t){let r=`<feDropShadow${vr(e)}`;r+=w("dx",e.dx),r+=w("dy",e.dy),r+=w("stdDeviation",e.stdDeviation),r+=w("flood-color",e.floodColor),r+=w("flood-opacity",e.floodOpacity);let n=br(t);return n?`${r}>${n}</feDropShadow>`:`${r}/>`}function Qz(e,t){let r=`<feFlood${vr(e)}${w("flood-color",e.floodColor)}${w("flood-opacity",e.floodOpacity)}`,n=br(t);return n?`${r}>${n}</feFlood>`:`${r}/>`}function e_(e,t){let r=`<feGaussianBlur${vr(e)}${w("stdDeviation",e.stdDeviation)}${w("edgeMode",e.edgeMode)}`,n=br(t);return n?`${r}>${n}</feGaussianBlur>`:`${r}/>`}function t_(e,t){let r=`<feImage${vr(e)}`;e.href!==void 0?r+=w("href",e.href):e.xlinkHref!==void 0&&(r+=w("xlink:href",e.xlinkHref)),r+=w("preserveAspectRatio",e.preserveAspectRatio),r+=w("crossorigin",e.crossorigin);let n=br(t);return n?`${r}>${n}</feImage>`:`${r}/>`}function r_(e,t){let r="";for(let n of e.nodes)r+=`<feMergeNode${w("in",n.in)}/>`;return r+=br(t),`<feMerge${vr(e)}>${r}</feMerge>`}function n_(e,t){let r=`<feMorphology${vr(e)}${w("operator",e.operator)}${w("radius",e.radius)}`,n=br(t);return n?`${r}>${n}</feMorphology>`:`${r}/>`}function i_(e,t){let r=`<feOffset${vr(e)}${w("dx",e.dx)}${w("dy",e.dy)}`,n=br(t);return n?`${r}>${n}</feOffset>`:`${r}/>`}function a_(e,t){let r=`<feTile${vr(e)}`,n=br(t);return n?`${r}>${n}</feTile>`:`${r}/>`}function o_(e,t){let r=`<feTurbulence${vr(e)}`;r+=w("baseFrequency",e.baseFrequency),r+=w("numOctaves",e.numOctaves),r+=w("seed",e.seed),r+=w("stitchTiles",e.stitchTiles),r+=w("type",e.turbulenceType);let n=br(t);return n?`${r}>${n}</feTurbulence>`:`${r}/>`}function s_(e,t,r={}){let n=`<filter${w("id",e)}`;n+=w("x",t.x),n+=w("y",t.y),n+=w("width",t.width),n+=w("height",t.height),n+=w("filterUnits",t.filterUnits),n+=w("primitiveUnits",t.primitiveUnits),t.filterColorInterpolation&&t.filterColorInterpolation!=="auto"&&(n+=w("color-interpolation-filters",t.filterColorInterpolation)),n+=w("flood-color",t.floodColor),n+=w("flood-opacity",t.floodOpacity),n+=w("lighting-color",t.lightingColor),n+=">",t.filterTitle&&(n+=`<title>${Me(t.filterTitle)}</title>`),t.filterDescription&&(n+=`<desc>${Me(t.filterDescription)}</desc>`);for(let i of r.root??[])n+=i;for(let i of t.primitives)n+=ww(i,r.primitive?.(i.id)??[]);return n+="</filter>",n}function l_(e,t,r,n){switch(e.type){case"drop-shadow":return oz(e,t,r);case"inner-shadow":return sz(e,t,r);case"gaussian-blur":return lz(e,t,r);case"motion-blur":return uz(e,t,r);case"point-light":{let i=e;return dz(n?{...i,x:i.x+n.x,y:i.y+n.y}:i,t,r)}case"spot-light":{let i=e;return cz(n?{...i,x:i.x+n.x,y:i.y+n.y,pointsAtX:i.pointsAtX+n.x,pointsAtY:i.pointsAtY+n.y}:i,t,r)}case"diffuse-lighting":return fz(e,t,r);case"specular-lighting":return pz(e,t,r);case"outline":return hz(e,t,r);case"sharpen":return mz(e,t,r);case"pixelate":return gz(e,t,r);case"warp":return yz(e,t,r);case"morphology":return vz(e,t,r);case"contouring-discrete":return bz(e,t,r);case"contouring-table":return xz(e,t,r);case"round-edges":return wz(e,t,r);case"grayscale":return Iz(e,t,r);case"channel-painter":return kz(e,t,r);case"brightness":return Sz(e,t,r);case"contrast":return $z(e,t,r);case"opacity":return Nz(e,t,r);case"invert":return Mz(e,t,r);case"hue-rotate":return Az(e,t,r);case"saturate":return Cz(e,t,r);case"black-and-white":return Oz(e,t,r);case"sepia":return Tz(e,t,r);case"duotone":return Pz(e,t,r);case"xray":return Dz(e,t,r);case"noise":return jz(e,t,r);case"emboss":return Ez(e,t,r);case"film-grain":return zz(e,t,r);case"watercolor":return _z(e,t,r);case"gouache":return Rz(e,t,r);case"ink-blot":return Fz(e,t,r);case"crumpled-plastic":return Lz(e,t,r);case"riddled":return Bz(e,t,r);case"glow":return Vz(e,t,r);case"inner-glow":return Uz(e,t,r);case"raw-svg":return e.svgContent;case"svg-primitive-chain":return e.primitives.map(i=>ww(i)).join("");default:return at(t,r)}}function u_(e,t,r={},n={}){let i=az(e,t,r);if(!i)return"";if(i.kind==="primitive-chain")return s_(e,i.chain,n);let a=i.attributes.map(([u,d])=>w(u,d)).join("");if(i.kind==="raw")return`<filter${a}>${(n.root??[]).join("")}${i.content}</filter>`;let o=(n.root??[]).join(""),s="SourceGraphic",l=0;for(let u of i.filters){let d=`result${l++}`;o+=l_(u,s,d),s=d}return`<filter${a}>${o}</filter>`}function d_(e,t,r){return!t||t.length===0||t.filter(n=>n.enabled).length===0?null:Array.isArray(r)&&r.length>0?r.map(n=>`url(#${Me(n)})`).join(" "):`url(#filter-${Me(e)})`}var Oe=(e,t,r={})=>({channel:"attribute",name:e,value:t,...r}),Iu=/^[A-Za-z_][\w:.-]*$/,ku=(e,t)=>({channel:"style",name:e,value:t});function gt(e){return typeof e=="string"?e:null}function Oi(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function kw(e){return gt(e("fillType"))??"solid"}function yh(e){return e("fillGradient")}function Sw(e){if(!e||typeof e!="object")return;let t=e.id;return typeof t=="string"&&t.length>0?t:void 0}function c_(e){let t=gt(e("fillLibraryId"))??Sw(yh(e));return t?`url(#${t})`:"none"}function f_(e){let t=gt(e("strokeLibraryId"))??Sw(e("strokeGradient"));return t?`url(#${t})`:"none"}function F0(e,t){let r=gt(e(`${t}Type`))??(t==="fill"?kw(e):"solid"),n=t==="fill"?yh(e):e("strokeGradient"),i=Oi(e(`${t}Opacity`)),a=e(t==="fill"?"preserveFillOpacity":"preserveStrokeOpacity")===!0;if(e(t==="fill"?"inheritFill":"inheritStroke")===!0&&r==="solid"&&!n&&i===null&&!a||r==="none")return null;let o=i??1,s=n&&typeof n=="object"?Oi(n.opacity)??1:1,l=o*s;return l<1?l:a?1:null}function p_(e){return gt(e("strokeDasharray"))||JC(gt(e("lineStyle"))??"solid",Oi(e("dashLength"))??8,Oi(e("gapLength"))??4)}function L0(e){if(!gt(e("strokeDasharray"))&&gt(e("lineStyle"))==="dotted")return"round";let t=gt(e("strokeLinecap"));return t&&t!=="butt"?t:null}function B0(e,t){let r=e(t);return!r||typeof r!="object"||Array.isArray(r)?null:gt(r.value)}function Su(e,t,r={}){if(!e||typeof e!="object"||Array.isArray(e))return[];let n=[];for(let[i,a]of Object.entries(e))typeof a=="string"&&(t==="attribute"&&!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(i)||n.push({channel:t,name:i,value:a,...r}));return n}var _o=[{id:"fill",keys:["fillColor","fillType","fillGradient","fillLibraryId","inheritFill","authoredFillPaint"],project:(e,t)=>{let r=B0(e,"authoredFillPaint");if(r)return[Oe("fill",r)];let n=kw(e);return e("inheritFill")===!0&&n==="solid"&&!yh(e)?[Oe("fill",null)]:n==="none"?[Oe("fill","none")]:n==="linear-gradient"||n==="radial-gradient"||n==="pattern"?[Oe("fill",c_(e))]:[Oe("fill",gt(e("fillColor"))??"#000000")]}},{id:"element-opacity",keys:["opacity","preserveOpacity"],project:e=>{let t=Oi(e("opacity")),r=e("preserveOpacity")===!0;return[Oe("opacity",t!==null&&(t<1||r)?t:null)]}},{id:"fill-opacity",keys:["fillOpacity","preserveFillOpacity","fillType","fillGradient","inheritFill"],project:e=>[Oe("fill-opacity",F0(e,"fill"))]},{id:"fill-rule",keys:["fillRule"],project:e=>{let t=gt(e("fillRule"));return[Oe("fill-rule",t&&t!=="nonzero"?t:null)]}},{id:"stroke",keys:["borderColor","strokeType","strokeGradient","strokeLibraryId","inheritStroke","authoredStrokePaint"],project:(e,t)=>{let r=B0(e,"authoredStrokePaint");if(r)return[Oe("stroke",r)];let n=gt(e("strokeType"))??"solid";return e("inheritStroke")===!0&&n==="solid"&&!e("strokeGradient")?[Oe("stroke",null)]:n==="none"?[Oe("stroke","none")]:n==="linear-gradient"||n==="radial-gradient"||n==="pattern"?[Oe("stroke",f_(e))]:[Oe("stroke",gt(e("borderColor"))??"none")]}},{id:"stroke-width",keys:["borderWidth"],project:e=>{let t=e("borderWidth");return[Oe("stroke-width",typeof t=="number"||typeof t=="string"?t:null)]}},{id:"stroke-opacity",keys:["strokeOpacity","preserveStrokeOpacity","strokeType","strokeGradient","inheritStroke"],project:e=>[Oe("stroke-opacity",F0(e,"stroke"))]},{id:"blend-mode",keys:["blendMode"],project:e=>{let t=gt(e("blendMode"));return[ku("mix-blend-mode",t&&t!=="normal"?t:null)]}},{id:"paint-order",keys:["paintOrder"],project:e=>{let t=gt(e("paintOrder"));return[Oe("paint-order",t&&t!=="normal"?t:null)]}},{id:"inline-style",keys:["inlineStyle"],project:(e,t)=>Su(t.retainCssAnimationDeclarations===!1?Nb(e("inlineStyle")):e("inlineStyle"),"style")},{id:"markers",keys:["markerStart","markerMid","markerEnd"],project:e=>[["marker-start",e("markerStart")],["marker-mid",e("markerMid")],["marker-end",e("markerEnd")]].map(([t,r])=>Oe(String(t),typeof r=="string"&&r?`url(#${r})`:null))},{id:"stroke-linejoin",keys:["strokeLinejoin"],project:e=>{let t=gt(e("strokeLinejoin"));return[Oe("stroke-linejoin",t&&t!=="miter"?t:null)]}},{id:"stroke-linecap",keys:["strokeLinecap"],project:e=>[Oe("stroke-linecap",L0(e))]},{id:"stroke-miterlimit",keys:["strokeMiterlimit"],project:e=>{let t=Oi(e("strokeMiterlimit"));return[Oe("stroke-miterlimit",t!==null&&t!==4?t:null)]}},{id:"stroke-dasharray",keys:["lineStyle","dashLength","gapLength","strokeDasharray","strokeLinecap"],project:e=>[Oe("stroke-dasharray",p_(e)),Oe("stroke-linecap",L0(e))]},{id:"stroke-dashoffset",keys:["dashOffset"],project:e=>{let t=Oi(e("dashOffset"));return[Oe("stroke-dashoffset",t!==null&&t!==0?t:null)]}},{id:"shape-rendering",keys:["shapeRendering"],project:e=>{let t=gt(e("shapeRendering"));return[Oe("shape-rendering",t&&t!=="auto"?t:null)]}},{id:"text-rendering",keys:["textRendering"],project:e=>{let t=gt(e("textRendering"));return[Oe("text-rendering",t&&t!=="auto"?t:null)]}},{id:"image-rendering",keys:["imageRendering"],project:e=>{let t=gt(e("imageRendering"));return[Oe("image-rendering",t&&t!=="auto"?t:null)]}},{id:"color-rendering",keys:["colorRendering"],project:e=>{let t=gt(e("colorRendering"));return[Oe("color-rendering",t&&t!=="auto"?t:null)]}},{id:"color-interpolation",keys:["colorInterpolation"],project:e=>{let t=gt(e("colorInterpolation"));return[Oe("color-interpolation",t&&t!=="sRGB"?t:null)]}},{id:"filter",keys:["filters","filterLibraryIds"],project:(e,t)=>[Oe("filter",d_(t.shapeId,e("filters"),e("filterLibraryIds")))]},{id:"system-language",keys:["systemLanguage"],project:e=>{let t=e("systemLanguage");return[Oe("systemLanguage",typeof t=="string"?t:null,{allowEmpty:!0})]}},{id:"required-extensions",keys:["requiredExtensions"],project:e=>{let t=e("requiredExtensions");return[Oe("requiredExtensions",typeof t=="string"?t:null,{allowEmpty:!0})]}},{id:"vector-effect",keys:["vectorEffect"],project:e=>{let t=gt(e("vectorEffect"));return[Oe("vector-effect",t&&t!=="none"?t:null)]}},{id:"visibility",keys:["visibility"],project:e=>{let t=gt(e("visibility"));return[Oe("visibility",t&&t!=="visible"?t:null)]}},{id:"display",keys:["displayAttr"],project:e=>{let t=gt(e("displayAttr"));return[Oe("display",t&&t!=="inline"?t:null)]}},{id:"visible",keys:["visible"],project:e=>[ku("display",e("visible")===!1?"none":null)]},{id:"path-length",keys:["pathLength"],project:e=>{let t=Oi(e("pathLength"));return[Oe("pathLength",t!==null&&t>=0?t:null)]}},{id:"transform-box",keys:["transformBox"],project:e=>{let t=gt(e("transformBox"));return[ku("transform-box",t&&t!=="view-box"?t:null)]}},{id:"transform",keys:["rotation","transformMatrix","translateX","translateY","skewX","skewY","scaleX","scaleY","customPivot","rawTransform"],project:()=>[]},{id:"locked",keys:["locked"],project:()=>[]},{id:"metadata",keys:["metadata"],project:e=>{let t=e("metadata"),r=[],n=t?.name?ga(t.name):"";if(r.push(Oe("id",n||null)),r.push(Oe("class",t?.classes&&t.classes.length>0?t.classes.join(" "):null)),r.push(Oe("role",t?.role??null)),r.push(Oe("aria-label",t?.ariaLabel??null)),t?.aria)for(let[i,a]of Object.entries(t.aria))i!=="aria-label"&&Iu.test(i)&&r.push(Oe(i,a));if(r.push(Oe("xml:lang",t?.lang??null)),typeof t?.tabindex=="number"&&Number.isFinite(t.tabindex)&&r.push(Oe("tabindex",String(Math.trunc(t.tabindex)))),t?.autofocus&&r.push(Oe("autofocus","",{allowEmpty:!0})),r.push(Oe("xml:space",t?.xmlSpace??null)),t?.customData)for(let[i,a]of Object.entries(t.customData)){let o=`data-${i}`;Iu.test(o)&&r.push(Oe(o,a))}if(t?.foreignAttrs){for(let i of t.foreignAttrs)Iu.test(i.name)&&r.push(Oe(i.name,i.value));for(let i of IP()){let a=new Map;for(let o of t.foreignAttrs)hp(o.namespaceURI??null)===i&&a.set(o.name.split(":").at(-1)??o.name,o.value);if(a.size!==0)for(let o of i.emit(a,e))Iu.test(o.name)&&r.push(Oe(o.name,o.value))}}return r}},{id:"css-clip-path",keys:["cssClipPath"],project:e=>[ku("clip-path",gt(e("cssClipPath")))]},{id:"css-mask-properties",keys:["cssMaskProperties"],project:e=>Su(e("cssMaskProperties"),"style")},{id:"container-presentation",keys:["containerPresentation"],project:(e,t)=>t.includeContainerPresentation?Su(e("containerPresentation"),"attribute",{ifAbsent:!0}):[]},{id:"authored-attributes",keys:["authoredAttributes"],project:(e,t)=>t.includeAuthoredAttributes?Su(e("authoredAttributes"),"attribute",{ifAbsent:!0}):[]}];function sl(e,t,r){let n=t("presentationChannels"),i=n&&typeof n=="object"&&!Array.isArray(n)?n:null;return e.project(t,r).flatMap(a=>{let o=i?.[a.name];return o==="stylesheet-dynamic"?[]:o==="stylesheet-static"?r.projectStaticStylesheetValues?[{...a,channel:"style",ifAbsent:void 0}]:[]:a.channel==="attribute"&&o==="style"?[{...a,channel:"style",ifAbsent:void 0}]:[a]})}function $w(e,t){return _o.flatMap(r=>sl(r,e,t))}function Ro(e){let t=e;return r=>r==="displayAttr"?e.display:t[r]}var h_=[["fontVariant","font-variant"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantPosition","font-variant-position"],["fontVariantCaps","font-variant-caps"],["fontVariantNumeric","font-variant-numeric"],["fontVariantEastAsian","font-variant-east-asian"]];function Me(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Nw(e){let t=new Map,r=new Map,n=e.state,i=n;switch(e.type){case"circle":t.set("cx",String(n.x??0)),t.set("cy",String(n.y??0)),t.set("r",String(n.radius??50));break;case"ellipse":t.set("cx",String(n.cx??0)),t.set("cy",String(n.cy??0)),t.set("rx",String(n.rx??50)),t.set("ry",String(n.ry??30));break;case"rectangle":case"square":t.set("x",String(n.x??0)),t.set("y",String(n.y??0)),t.set("width",String(n.width??100)),t.set("height",String(n.height??100));{let l=n.rx??n.cornerRadius??0,u=n.ry??n.cornerRadius??0;(l>0||u>0)&&(t.set("rx",String(l)),t.set("ry",String(u)))}break;case"line":t.set("x1",String(n.x1??0)),t.set("y1",String(n.y1??0)),t.set("x2",String(n.x2??0)),t.set("y2",String(n.y2??0));break;case"text":t.set("x",String(n.x??0)),t.set("y",String(n.y??0)),n.fontSize&&t.set("font-size",String(n.fontSize)),n.fontFamily&&t.set("font-family",n.fontFamily),n.fontWeight&&t.set("font-weight",String(n.fontWeight)),n.fontStyle&&t.set("font-style",n.fontStyle),n.textAnchor&&t.set("text-anchor",n.textAnchor),n.letterSpacing&&t.set("letter-spacing",String(n.letterSpacing));for(let[l,u]of h_){let d=typeof n[l]=="string"?String(n[l]).trim():"";d&&r.set(u,d)}break;case"image":t.set("x",String(n.x??0)),t.set("y",String(n.y??0)),t.set("width",String(n.width??100)),t.set("height",String(n.height??100)),i.href&&t.set("href",String(i.href));break}for(let l of $w(Ro(n),{shapeId:e.id,includeAuthoredAttributes:!0})){if(l.channel==="style"){r.delete(l.name),l.value!==null&&l.value!==""&&r.set(l.name,String(l.value));continue}l.ifAbsent&&t.has(l.name)||(t.delete(l.name),!(l.value===null||l.value===""&&!l.allowEmpty)&&t.set(l.name,String(l.value)))}r.size>0&&t.set("style",[...r].map(([l,u])=>`${l}: ${u}`).join("; "));let a=g_(i);a&&t.set("transform",a);let o=i.startEndpoint,s=i.endEndpoint;return o&&o!=="none"&&t.set("marker-start",`url(#line-marker-${o})`),s&&s!=="none"&&t.set("marker-end",`url(#line-marker-${s})`),t}function m_(e){switch(e.type){case"circle":return"circle";case"ellipse":return"ellipse";case"rectangle":case"square":return"rect";case"line":return"line";case"text":return"text";case"image":return"image";case"path":case"polyline":case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":return"path";default:return"g"}}function g_(e){return un(e)}function y_(e,t){let r=e.viewboxes?.[0];return{width:t.width??r?.width??800,height:t.height??r?.height??600}}var Ys="https://svgsketch.com/ns/metadata",id="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Sn="http://purl.org/dc/elements/1.1/",ll="http://creativecommons.org/ns#";var Mw={rdf:id,rdfs:"http://www.w3.org/2000/01/rdf-schema#",owl:"http://www.w3.org/2002/07/owl#",xsd:"http://www.w3.org/2001/XMLSchema#",dc:Sn,dcterms:"http://purl.org/dc/terms/",cc:ll,xmp:"http://ns.adobe.com/xap/1.0/",xmpRights:"http://ns.adobe.com/xap/1.0/rights/",xmpMM:"http://ns.adobe.com/xap/1.0/mm/",photoshop:"http://ns.adobe.com/photoshop/1.0/",illustrator:"http://ns.adobe.com/AdobeIllustrator/10.0/",exif:"http://ns.adobe.com/exif/1.0/",tiff:"http://ns.adobe.com/tiff/1.0/",foaf:"http://xmlns.com/foaf/0.1/",schema:"http://schema.org/",og:"https://ogp.me/ns#",inkscape:"http://www.inkscape.org/namespaces/inkscape",sodipodi:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd",prism:"http://prismstandard.org/namespaces/basic/3.0/",svgsketch:Ys},Aw=new Set([`${Sn}|creator`,`${Sn}|subject`,`${Sn}|rights`,`${Sn}|description`,`${ll}|license`]);function Cw(e){let t=e.indexOf(":");if(t<=0||t===e.length-1)return null;let r=e.slice(0,t),n=e.slice(t+1);if(!/^[A-Za-z_][\w.-]*$/.test(n))return null;let i=Mw[r];return i?{ns:i,local:n,prefix:r}:null}var v_={cc0:"https://creativecommons.org/publicdomain/zero/1.0/","cc-by":"https://creativecommons.org/licenses/by/4.0/","cc-by-sa":"https://creativecommons.org/licenses/by-sa/4.0/","cc-by-nc":"https://creativecommons.org/licenses/by-nc/4.0/","cc-by-nc-sa":"https://creativecommons.org/licenses/by-nc-sa/4.0/","cc-by-nd":"https://creativecommons.org/licenses/by-nd/4.0/","cc-by-nc-nd":"https://creativecommons.org/licenses/by-nc-nd/4.0/",mit:"https://opensource.org/licenses/MIT","apache-2.0":"https://www.apache.org/licenses/LICENSE-2.0"},b_={cc0:"CC0 1.0 Universal (Public Domain)","cc-by":"Creative Commons Attribution 4.0","cc-by-sa":"Creative Commons Attribution-ShareAlike 4.0","cc-by-nc":"Creative Commons Attribution-NonCommercial 4.0","cc-by-nc-sa":"Creative Commons Attribution-NonCommercial-ShareAlike 4.0","cc-by-nd":"Creative Commons Attribution-NoDerivatives 4.0","cc-by-nc-nd":"Creative Commons Attribution-NonCommercial-NoDerivatives 4.0",mit:"MIT License","apache-2.0":"Apache License 2.0",custom:"Custom License"};function x_(e,t){return e==="custom"?t||"":v_[e]||""}function w_(e){return b_[e]||e}function V0(e){return!!(e.author||e.keywords&&e.keywords.length>0||e.license||e.customMetadata&&Object.keys(e.customMetadata).length>0)}function Ow(e){let t=[];if(e.author&&t.push(`<dc:creator>${Me(e.author)}</dc:creator>`),e.keywords&&e.keywords.length>0&&t.push(`<dc:subject>${Me(e.keywords.join(", "))}</dc:subject>`),e.license){let r=x_(e.license,e.licenseUrl);r&&t.push(`<cc:license rdf:resource="${Me(r)}"/>`),t.push(`<dc:rights>${Me(w_(e.license))}</dc:rights>`)}if(e.customMetadata)for(let[r,n]of Object.entries(e.customMetadata)){let i=Cw(r);if(i){if(Aw.has(`${i.ns}|${i.local}`))continue;t.push(`<${i.prefix}:${i.local}>${Me(n??"")}</${i.prefix}:${i.local}>`)}else t.push(`<svgsketch:custom key="${Me(r)}" value="${Me(n??"")}"/>`)}return t.join(`
39
+ `)}function I_(e){let t=Ow(e);return t.length>0?`<rdf:Description svgsketch:managed="true">
40
+ ${t}
41
+ </rdf:Description>`:`<rdf:Description svgsketch:managed="true">
42
+ </rdf:Description>`}function U0(e){let t={rdf:id,dc:Sn,cc:ll,svgsketch:Ys};if(e.customMetadata)for(let r of Object.keys(e.customMetadata)){let n=Cw(r);n&&!(n.prefix in t)&&(t[n.prefix]=n.ns)}return`<metadata>
43
+ <rdf:RDF ${Object.entries(t).map(([r,n])=>`xmlns:${r}="${n}"`).join(" ")}>
44
+ `+I_(e)+`
45
+ </rdf:RDF>
46
+ </metadata>`}var k_=["dc:creator","dc:subject","dc:rights","dc:description","cc:license","svgsketch:custom"];function S_(e){let t=e;for(let r of k_)t=t.replace(new RegExp(`<${r}\\b[^>]*/>\\s*`,"g"),""),t=t.replace(new RegExp(`<${r}\\b[^>]*>[\\s\\S]*?</${r}>\\s*`,"g"),"");return t}function $_(e,t){let r=e.match(/<rdf:Description\b/g);if(!r||r.length!==1||!/<rdf:RDF\b/.test(e))return null;let n=/<rdf:Description\b((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(e);if(!n)return null;let[i,a,o]=[n[0],n[1],n[2]],s=n.index,l=Ow(t),u=`<rdf:Description svgsketch:managed="true"${a}>`,d;if(o==="/")d=e.slice(0,s)+`${u}
47
+ ${l}
48
+ </rdf:Description>`+e.slice(s+i.length);else{let f=e.lastIndexOf("</rdf:Description>");if(f<=s)return null;let p=S_(e.slice(s+i.length,f));d=e.slice(0,s)+u+p+`${l}
49
+ `+e.slice(f)}let c=[["svgsketch",Ys],["dc",Sn],["cc",ll]];return d=d.replace(/<rdf:RDF\b((?:[^>"']|"[^"]*"|'[^']*')*?)>/,(f,p)=>{let h="";for(let[m,g]of c)d.includes(`xmlns:${m}=`)||(h+=` xmlns:${m}="${g}"`);return h?`<rdf:RDF${p}${h}>`:f}),d}function Tw(e){return e.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g,"$1").replace(/<[^>]*>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&").trim()}function N_(e){if(!e)return"";let t="";if(e.language&&(t+=` xml:lang="${Me(e.language)}"`),e.role&&(t+=` role="${Me(e.role)}"`),e.ariaLabel&&(t+=` aria-label="${Me(e.ariaLabel)}"`),e.aria)for(let[r,n]of Object.entries(e.aria))r==="aria-label"||!/^aria-[A-Za-z0-9_.:-]+$/u.test(r)||(t+=` ${r}="${Me(n)}"`);return t}function Rf(e,t,r){let n=r?` xml:lang="${Me(r)}"`:"";return`<${e}${n}>${Me(t)}</${e}>`}function Pw(e){let t=e.descriptiveElements;if(!t)return null;let r={title:!1,desc:!1},n=[];for(let i of t){let a=!r[i.kind];if(r[i.kind]=!0,!a){n.push(i.rawXml);continue}let o=i.kind==="title"?e.title:e.description;(o??"").trim()===i.text.trim()?n.push(i.rawXml):o&&n.push(Rf(i.kind,o,i.language))}return!r.title&&e.title&&n.unshift(Rf("title",e.title,null)),!r.desc&&e.description&&n.push(Rf("desc",e.description,null)),n.join("")}function Bd(e){if(!e)return"";let t="",r=Pw(e);if(r!==null)t+=r;else if(e.title&&(t+=`<title>${Me(e.title)}</title>`),e.description||e.rawDescription){let n=Tw(e.rawDescription??""),i=(e.description??"").trim();t+=e.rawDescription&&n===i?`<desc>${e.rawDescription}</desc>`:`<desc>${Me(e.description??"")}</desc>`}return e.rawMetadata&&(t+=e.rawMetadata),t}function M_(e,t){if(!e)return"";let r="",n=Pw(e);if(n!==null)r+=n;else if(e.title&&(r+=`<title>${Me(e.title)}</title>`),e.description||e.rawDescription){let i=Tw(e.rawDescription??""),a=(e.description??"").trim();e.rawDescription&&i===a?r+=`<desc>${e.rawDescription}</desc>`:r+=`<desc>${Me(e.description)}</desc>`}if(t?.includeMetadata===!1)return r;if(e.rawMetadata)if(!e.rawMetadataAuthoritative&&V0(e)&&!e.rawMetadata.includes("svgsketch:managed")){let i=$_(e.rawMetadata,e);r+=i??U0(e)+e.rawMetadata}else r+=e.rawMetadata;else V0(e)&&(r+=U0(e));return e.rawHtmlMetadata&&(r+=e.rawHtmlMetadata),r}var Np="http://www.w3.org/1999/xhtml",vh="http://www.w3.org/XML/1998/namespace",A_="http://www.w3.org/1999/xlink",Lu="http://www.w3.org/2000/xmlns/",C_=new Set([ye,vh,A_,Np,Lu]),O_=new Set(["data-shape-id","data-locked","data-hidden","data-cx","data-cy","data-radius","data-corner-radius","data-shift-angle","data-sides","data-arms","data-inner-radius-percent","data-arm-width-percent","data-turns","data-thickness-percent","data-direction","data-teeth","data-tooth-depth-percent","data-hole-radius-percent","data-head-width-percent","data-head-length-percent","data-shaft-width-percent","data-line-style","data-dash-length","data-gap-length","data-start-endpoint","data-end-endpoint","data-original-width","data-original-height","data-preserve-aspect-ratio"]),T_=Object.freeze(Object.fromEntries(Object.entries(Mw).map(([e,t])=>[t,e])));function bh(e,t,r){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===r)??null}function xh(e){let t=bh(e,"lang",vh);return t?t.value:j(e,"lang")}function na(e){let t="",r=[...e.children].reverse();for(;r.length>0;){let n=r.pop();n.kind==="text"||n.kind==="cdata"?t+=n.value:n.kind==="element"&&r.push(...[...n.children].reverse())}return t}function Dw(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function P_(e){return Dw(e).replaceAll('"',"&quot;")}function D_(e){switch(e.kind){case"text":return Dw(e.value);case"comment":return`<!--${e.value}-->`;case"cdata":return`<![CDATA[${e.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${e.value}?>`;case"doctype":return`<!DOCTYPE ${e.value}>`}}function j_(e){let t=new Set,r=!1,n=[e];for(;n.length>0;){let i=n.pop();i.prefix&&i.prefix!=="xml"?t.add(i.prefix):!i.prefix&&i.namespaceUri&&(r=!0);for(let a of i.attributes)a.prefix&&a.prefix!=="xmlns"&&a.prefix!=="xml"&&t.add(a.prefix);for(let a of i.children)a.kind==="element"&&n.push(a)}return{prefixes:t,defaultNamespace:r}}function E_(e){let t=[e];for(;t.length>0;){let r=t.pop();if(!r.prefix&&r.namespaceUri)return r.namespaceUri;for(let n of r.children)n.kind==="element"&&t.push(n)}return null}function z_(e,t){let r=j_(t),n=new Map;for(let a of t.attributes)(a.namespaceUri===Lu||a.name==="xmlns")&&n.set(a.name,a);let i=e.index.parent(t.sourceNodeId);for(;i;){for(let a of i.attributes)!(a.namespaceUri===Lu||a.name==="xmlns")||n.has(a.name)||(a.name==="xmlns"&&r.defaultNamespace||a.prefix==="xmlns"&&r.prefixes.has(a.localName))&&n.set(a.name,a);i=e.index.parent(i.sourceNodeId)}if(r.defaultNamespace&&!n.has("xmlns")){let a=E_(t);a&&n.set("xmlns",{name:"xmlns",localName:"xmlns",prefix:null,namespaceUri:Lu,value:a,span:t.span})}return Object.freeze([...n.values()].filter(a=>!t.attributes.some(o=>o.name===a.name)))}function jw(e,t=[]){let r=[...t,...e.attributes].map(o=>`${o.name}="${P_(o.value)}"`),n=`<${e.name}${r.length>0?` ${r.join(" ")}`:""}`,i=e.children.map(Ew).join(""),a=/\/\s*>\s*$/u.test(e.rawXml??"");return i.length===0&&a?`${n}/>`:`${n}>${i}</${e.name}>`}function Ew(e){return e.kind==="element"?jw(e):D_(e)}function Ks(e,t){return jw(t,z_(e,t))}function wh(e,t){return e.children.map(r=>r.kind!=="element"||!t?Ew(r):Ks(t,r)).join("")}function zw(e,t){return e.children.filter(r=>r.kind==="element"&&r.namespaceUri===ye&&r.localName.toLowerCase()===t)}function _w(e,t){return Object.freeze(t.children.filter(r=>r.kind==="element"&&r.namespaceUri===ye&&(r.localName.toLowerCase()==="title"||r.localName.toLowerCase()==="desc")).map(r=>Object.freeze({kind:r.localName.toLowerCase(),sourceNodeId:r.sourceNodeId,language:xh(r),text:na(r).trim(),rawInnerXml:wh(r),rawXml:Ks(e,r)})))}function Rw(e){return e.map(({kind:t,language:r,text:n,rawXml:i})=>({kind:t,language:r,text:n,rawXml:i}))}function Fw(e){return e.children.some(t=>t.kind==="element")}function __(e){if(e.classes&&Object.freeze(e.classes),e.aria&&Object.freeze(e.aria),e.customData&&Object.freeze(e.customData),e.foreignAttrs){for(let t of e.foreignAttrs)Object.freeze(t);Object.freeze(e.foreignAttrs)}if(e.descriptiveElements){for(let t of e.descriptiveElements)Object.freeze(t);Object.freeze(e.descriptiveElements)}return Object.freeze(e)}function R_(e,t,r,n,i){let a={};r.length>0&&(a.descriptiveElements=Rw(r));let o=j(t,"id");o&&(a.name=o);let s=(j(t,"class")??"").split(/\s+/u).filter(Boolean);s.length>0&&(a.classes=s);let l=r.find(b=>b.kind==="title"),u=r.find(b=>b.kind==="desc");if(l?.text&&(a.title=l.text),u?.text&&(a.description=u.text),u){let b=e.index.element(u.sourceNodeId);b&&Fw(b)&&(a.rawDescription=wh(b,e))}let d=j(t,"role");d&&(a.role=d);let c=j(t,"aria-label");c&&(a.ariaLabel=c);let f={},p={};for(let b of t.attributes)b.namespaceUri===null&&(b.name.startsWith("aria-")&&b.name!=="aria-label"&&b.value&&(f[b.name]=b.value),b.name.startsWith("data-")&&!O_.has(b.name)&&(p[b.name.slice(5)]=b.value));Object.keys(f).length>0&&(a.aria=f),Object.keys(p).length>0&&(a.customData=p);let h=xh(t);h!==null&&(a.lang=h);let m=j(t,"tabindex");if(m!==null){if(/^[+-]?\d+$/u.test(m.trim())){let b=Number(m);Number.isSafeInteger(b)&&(a.tabindex=b)}a.tabindex===void 0&&i.push({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"metadata",documentPath:e.index.sourcePath(t.sourceNodeId),elementName:t.name,...o?{sourceId:o}:{},sourceNodeId:t.sourceNodeId,message:`Invalid tabindex value "${m}" was ignored.`})}if(ji(t,"autofocus")&&(a.autofocus=!0),!["text","tspan","flowroot"].includes(t.localName.toLowerCase())){let b=bh(t,"space",vh)?.value;(b==="default"||b==="preserve")&&(a.xmlSpace=b)}let g=wx(t.attributes),v=t.attributes.filter(b=>b.namespaceUri!==null&&!C_.has(b.namespaceUri)).filter(b=>!(g&&b.namespaceUri!==null&&g.vocabulary.namespaceUris.includes(b.namespaceUri)&&g.projection.consumes.includes(b.localName))).map(b=>({name:b.name,namespaceURI:b.namespaceUri,value:b.value}));v.length>0&&(a.foreignAttrs=v);let y=zw(t,"metadata").map(b=>Ks(e,b)).join(`
50
+ `);return y&&(a.rawMetadata=y),__(a)}function G0(e){let t=[],r=[...e.children].reverse();for(;r.length>0;){let n=r.pop();n.kind==="element"&&(t.push(n),r.push(...[...n.children].reverse()))}return t}function X0(e,t,r){return bh(e,t,r)?.value??null}function F_(e){let t=e.toLowerCase();return t.includes("publicdomain")||t.includes("cc0")?"cc0":t.includes("by-nc-nd")?"cc-by-nc-nd":t.includes("by-nc-sa")?"cc-by-nc-sa":t.includes("by-nc")?"cc-by-nc":t.includes("by-nd")?"cc-by-nd":t.includes("by-sa")?"cc-by-sa":t.includes("/by/")||t.includes("attribution")?"cc-by":t.includes("mit")?"mit":t.includes("apache")?"apache-2.0":"custom"}function L_(e){let t=e.flatMap(f=>G0(f).filter(p=>p.namespaceUri===id&&p.localName==="Description")),r=t.find(f=>X0(f,"managed",Ys)==="true")??t[0];if(!r)return{};let n={},i=G0(r),a=i.find(f=>f.namespaceUri===Sn&&f.localName==="creator");a?.children.length&&(n.author=na(a).trim());let o=i.find(f=>f.namespaceUri===Sn&&f.localName==="subject");if(o){let f=na(o).split(",").map(p=>p.trim()).filter(Boolean);f.length>0&&(n.keywords=f)}let s=i.find(f=>f.namespaceUri===ll&&f.localName==="license"),l=i.find(f=>f.namespaceUri===Sn&&f.localName==="rights"),u=s?X0(s,"resource",id)??na(s).trim():l?na(l).trim():"";u&&(n.license=F_(u),n.license==="custom"&&(n.licenseUrl=u));let d={},c=r.children.filter(f=>f.kind==="element");for(let f of c){if(f.namespaceUri===Ys&&f.localName==="custom"){let g=j(f,"key");g!==null&&(d[g]=j(f,"value")??"");continue}let p=f.namespaceUri??"";if(Aw.has(`${p}|${f.localName}`))continue;let h=T_[p];if(!h)continue;let m=`${h}:${f.localName}`;m in d||(d[m]=na(f).trim())}if(Object.keys(d).length===0)for(let f of c){if(f.namespaceUri!==Sn||f.localName!=="description")continue;let p=na(f),h=p.indexOf(":");if(h<=0)continue;let m=p.slice(0,h).trim();m&&(d[m]=p.slice(h+1).trim())}return Object.keys(d).length>0&&(n.customMetadata=d),n}function B_(e){let t=e.root,r=_w(e,t),n=zw(t,"metadata"),i=L_(n);r.length>0&&(i.descriptiveElements=Rw(r));let a=xh(t);a!==null&&(i.language=a);let o=j(t,"role");o&&(i.role=o);let s=j(t,"aria-label");s&&(i.ariaLabel=s);let l={};for(let h of t.attributes)h.namespaceUri===null&&h.name.startsWith("aria-")&&h.name!=="aria-label"&&h.value&&(l[h.name]=h.value);Object.keys(l).length>0&&(i.aria=l);let u=r.find(h=>h.kind==="title"),d=r.find(h=>h.kind==="desc");if(u?.text&&(i.title=u.text),d?.text&&(i.description=d.text),d){let h=e.index.element(d.sourceNodeId);h&&Fw(h)&&(i.rawDescription=wh(h,e))}let c=n.map(h=>Ks(e,h)).join(`
51
+ `);c&&(i.rawMetadata=c,i.rawMetadataAuthoritative=!0);let f=Object.freeze(t.children.filter(h=>h.kind==="element"&&h.namespaceUri===Np&&["base","link","meta"].includes(h.localName.toLowerCase())).map(h=>Object.freeze({sourceNodeId:h.sourceNodeId,localName:h.localName.toLowerCase(),namespaceUri:Np,rawXml:Ks(e,h)})));f.length>0&&(i.rawHtmlMetadata=f.map(h=>h.rawXml).join(`
52
+ `));let p=[];for(let h=t.children.length-1;h>=0;h--){let m=t.children[h];if(m.kind==="comment"){p.unshift(m.value);continue}if(!(m.kind==="text"&&!m.value.trim()))break}if(p.length>0&&(i.trailingComments=p),i.keywords&&Object.freeze(i.keywords),i.customMetadata&&Object.freeze(i.customMetadata),i.aria&&Object.freeze(i.aria),i.trailingComments&&Object.freeze(i.trailingComments),i.descriptiveElements){for(let h of i.descriptiveElements)Object.freeze(h);Object.freeze(i.descriptiveElements)}return Object.freeze({sourceNodeId:t.sourceNodeId,metadata:Object.freeze(i),descriptiveElements:r,htmlMetadata:f})}function V_(e,t){let r=e.index.parent(t.sourceNodeId);if(!r)return Object.freeze([]);let n=r.children.findIndex(a=>a.kind==="element"&&a.sourceNodeId===t.sourceNodeId);if(n<0)return Object.freeze([]);let i=[];for(let a=n-1;a>=0;a--){let o=r.children[a];if(o.kind==="comment"){i.unshift(o.value);continue}if(!(o.kind==="text"&&o.value.trim().length===0))break}return Object.freeze(i)}function U_(e,t){let r=[],n=[];for(let o of e.index.elements){if(o===e.root||o.namespaceUri!==ye)continue;let s=_w(e,o),l=R_(e,o,s,t,r),u=V_(e,o);Object.keys(l).length===0&&s.length===0&&u.length===0||n.push(Object.freeze({sourceNodeId:o.sourceNodeId,metadata:l,descriptiveElements:s,leadingComments:u}))}let i=Object.freeze(n),a=new Map(i.map(o=>[o.sourceNodeId,o]));return{value:Object.freeze({document:B_(e),candidates:i,candidate(o){return a.get(o)??null}}),diagnostics:Object.freeze(r)}}var G_="http://www.w3.org/1999/xhtml",Lw="http://www.w3.org/2000/xmlns/",X_=new Set(["font-face","hatch","solidcolor"]),W_=new Set(["title","desc"]);function Bw(e,t){return{name:e.name,localName:e.localName,prefix:e.prefix,namespaceUri:e.namespaceUri,value:t}}function Ih(e,t){if(e.kind==="doctype")return null;if(e.kind!=="element")return{kind:e.kind,value:e.value};let r=t.attributeRewrites.get(e.sourceNodeId),n=t.textRewrites.get(e.sourceNodeId);return{kind:"element",name:e.name,localName:e.localName,prefix:e.prefix,namespaceUri:e.namespaceUri,attributes:e.attributes.filter(i=>i.namespaceUri!==Lw).map(i=>{let a=i.localName==="id"&&i.namespaceUri===null?t.identifiers?.liveIdForSourceNodeId(e.sourceNodeId):void 0;return Bw(i,a??r?.get(i.name)??i.value)}),children:n===void 0?e.children.flatMap(i=>{let a=Ih(i,t);return a?[a]:[]}):[{kind:"text",value:n}]}}function kh(e){let t=new Map,r=new Map;for(let n of e?.rewrites??[]){if(n.target==="text-content"){r.set(n.sourceNodeId,n.value);continue}if(!n.name)continue;let i=t.get(n.sourceNodeId);i||(i=new Map,t.set(n.sourceNodeId,i)),i.set(n.name,n.value)}return{identifiers:e,attributeRewrites:t,textRewrites:r}}function H_(e,t){let r=kh(t),n=r.attributeRewrites.get(e.sourceNodeId);return Object.freeze(e.attributes.filter(i=>i.namespaceUri!==Lw).map(i=>{let a=i.localName==="id"&&i.namespaceUri===null?r.identifiers?.liveIdForSourceNodeId(e.sourceNodeId):void 0;return Bw(i,a??n?.get(i.name)??i.value)}))}function Vw(e,t){let r=kh(t);return Object.freeze(e.flatMap(n=>{let i=Ih(n,r);return i?[i]:[]}))}function q_(e){return e.namespaceUri!==null&&(e.namespaceUri!==ye&&e.namespaceUri!==G_||e.namespaceUri===ye&&X_.has(e.localName.toLowerCase()))}function Y_(e,t){return e.kind!=="element"?!1:q_(e)?!0:t==="defs"&&e.namespaceUri===ye&&W_.has(e.localName.toLowerCase())}function K_(e,t){let r=[],n=kh(t),i=1,a=(s,l,u)=>{let d=0,c=0;for(let f of s){if(f.kind!=="element")continue;let p=c++;if(!Y_(f,l))continue;let h=d++,m=Ih(f,n);!m||m.kind!=="element"||r.push({id:`document-extension-${i++}`,placement:l,order:h,...l==="defs"?{definitionOrder:p,definitionContainerId:u}:{},element:m})}};a(e.root.children,"root");let o=0;for(let s of e.root.children)s.kind==="element"&&s.namespaceUri===ye&&s.localName.toLowerCase()==="defs"&&a(s.children,"defs",`svg-definition-container-${++o}`);return Object.freeze(r.map(s=>Object.freeze(s)))}function sa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zi(e,t,r=""){if(!sa(e))return;t.onShape?.(e,r);let n=e.state;if(!sa(n))return;let i=n.children;if(Array.isArray(i)&&i.forEach((a,o)=>{zi(a,t,`${r}.state.children[${o}]`)}),t.onState){let a=n.symbolOverrides;if(sa(a))for(let[o,s]of Object.entries(a))sa(s)&&t.onState(s,`${r}.state.symbolOverrides[${o}]`);t.onState(n,`${r}.state`)}}function $u(e,t,r){Array.isArray(e)&&e.forEach((n,i)=>zi(n,t,`${r}[${i}]`))}function ir(e,t){sa(e)&&($u(e.shapes,t,"shapes"),Array.isArray(e.library)&&e.library.forEach((r,n)=>{if(sa(r))if(r.kind==="symbol"){if($u(r.shapes,t,`library[${n}].shapes`),sa(r.variants))for(let[i,a]of Object.entries(r.variants))$u(a,t,`library[${n}].variants[${i}]`)}else r.kind==="marker"&&$u(r.shapes,t,`library[${n}].shapes`)}))}var Uw=new Set(["cursive","emoji","fangsong","fantasy","math","monospace","sans-serif","serif","system-ui","ui-monospace","ui-rounded","ui-sans-serif","ui-serif"]),Z_=new Set(["inherit","initial","unset","revert","revert-layer"]);function Gw(e){return e.trim().replace(/^["']|["']$/g,"").trim()}function Sh(e){return Uw.has(Gw(e).toLowerCase())}function J_(e){let t=Gw(e).toLowerCase();return t.length===0?!0:Uw.has(t)||Z_.has(t)}function Q_(e){let t=[],r="",n=null;for(let a=0;a<e.length;a++){let o=e[a];if(n){o==="\\"&&a+1<e.length?r+=e[++a]:o===n?n=null:r+=o;continue}if(o==='"'||o==="'"){n=o;continue}if(o===","){let s=r.trim();s&&t.push(s),r="";continue}r+=o}let i=r.trim();return i&&t.push(i),t}function eR(e){let t=Q_(e);return t.length===0?!0:t.every(J_)}var Mp=400;function Xw(e,t=Mp){if(e===void 0)return t;let r=e.trim().toLowerCase();if(r===""||r==="normal")return 400;if(r==="bold")return 700;if(r==="bolder")return t<100||t<350?400:t<550?700:t<900?900:t;if(r==="lighter")return t<100?t:t<550?100:t<750?400:700;let n=Number.parseFloat(r);return Number.isFinite(n)?Math.min(1e3,Math.max(1,n)):t}function Ww(e){if(e===void 0)return"normal";let t=e.trim().toLowerCase();return t==="italic"||t.startsWith("oblique")?"italic":"normal"}function tR(e){return`${e.family}\0${e.weight}\0${e.style}`}function rR(e){let t=new Set,r=[];for(let n of e){let i=tR(n);t.has(i)||(t.add(i),r.push(n))}return r}var nR="https://boxy-svg.com";function W0(e){return/[\t\n\f\r ]/u.test(e??"")}function ad(e,t){if(e[t]!=="/"||e[t+1]!=="*")return t;let r=e.indexOf("*/",t+2);return r<0?e.length:r+2}function iR(e,t){let r=1,n=null,i=!1;for(let a=t+1;a<e.length;a++){let o=e[a];if(n){i?i=!1:o==="\\"?i=!0:o===n&&(n=null);continue}if(o==="/"&&e[a+1]==="*"){a=Math.max(a,ad(e,a)-1);continue}if(o==='"'||o==="'"){n=o;continue}if(o==="{")r++;else if(o==="}"&&--r===0)return a}return e.length-1}function $h(e){let t=[],r=null,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(r){n?n=!1:a==="\\"?n=!0:a===r&&(r=null);continue}if(a==="/"&&e[i+1]==="*"){i=Math.max(i,ad(e,i)-1);continue}if(a==='"'||a==="'"){r=a;continue}if(a!=="@")continue;let o=i,s=i+1;for(;/[-_a-z0-9]/iu.test(e[s]??"");)s++;let l=e.slice(i+1,s).toLowerCase(),u=s,d=null,c=!1,f=0;for(;u<e.length;u++){let h=e[u];if(d){c?c=!1:h==="\\"?c=!0:h===d&&(d=null);continue}if(h==="/"&&e[u+1]==="*"){u=Math.max(u,ad(e,u)-1);continue}if(h==='"'||h==="'"){d=h;continue}if(h==="(")f++;else if(h===")")f=Math.max(0,f-1);else if(f===0&&(h===";"||h==="{"))break}if(u>=e.length)continue;if(e[u]===";"){t.push(Object.freeze({name:l,start:o,end:u+1,preludeStart:s,preludeEnd:u,blockStart:null,blockEnd:null})),i=u;continue}let p=iR(e,u);t.push(Object.freeze({name:l,start:o,end:Math.min(e.length,p+1),preludeStart:s,preludeEnd:u,blockStart:u+1,blockEnd:p}))}return Object.freeze(t)}function Vd(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))){let r=t.slice(1,-1);return Wu(r)??r}return Wu(t)??t}function Nh(e){let t=Po(e).find(n=>n.name==="url");if(t)return Vd(e.slice(t.argumentsStart,t.argumentsEnd));let r=e.trim();if(r.startsWith('"')||r.startsWith("'")){let n=r[0],i=r.indexOf(n,1);return i>0?r.slice(1,i):null}return null}function Hw(e,t=0){let r=[];for(let n of Po(e)){if(n.name==="url"){r.push(Object.freeze({rawUrl:Vd(e.slice(n.argumentsStart,n.argumentsEnd)),tokenStart:t+n.tokenStart,tokenEnd:t+n.tokenEnd}));continue}r.push(...Hw(e.slice(n.argumentsStart,n.argumentsEnd),t+n.argumentsStart))}return Object.freeze(r)}function aR(e){let t=$h(e),r=t.filter(a=>a.name==="font-face"||a.name==="import"),n=[],i=0;for(let a of t){if(a.name!=="import")continue;let o=Nh(e.slice(a.preludeStart,a.preludeEnd));o!==null&&n.push(Object.freeze({url:o,channel:"css-import",tokenIndex:i})),i++}for(let a of Hw(e))r.some(o=>a.tokenStart>=o.start&&a.tokenEnd<=o.end)||(n.push(Object.freeze({url:a.rawUrl,channel:"css-url",tokenIndex:i})),i++);return Object.freeze(n)}function Mh(e){let t=e.trim();if(!t)return Object.freeze({status:"empty",requestUrl:null});if(/^data:/iu.test(t))return Object.freeze({status:"data",requestUrl:null});let r=Ah(t);return Object.freeze(r?{status:"external",requestUrl:r.href}:{status:"blocked",requestUrl:null})}function Ah(e){let t=/^(https?):\/\/([^/?#\s\\]+)([^\s\\]*)$/iu.exec(e);if(!t)return null;let r=t[1].toLowerCase(),n=t[2],i=n.lastIndexOf("@"),a=i>=0?n.slice(0,i+1):"",o=n.slice(i+1);if(!o)return null;let s=o.startsWith("[")?o.slice(0,Math.max(0,o.indexOf("]")+1)).toLowerCase():o.split(":")[0].toLowerCase();if(!s)return null;let l=t[3]||"/",u=l.indexOf("?"),d=l.indexOf("#",Math.max(0,u)),c=u<0?"":l.slice(u+1,d<0?void 0:d);return Object.freeze({href:`${r}://${a}${o.toLowerCase()}${l}`,hostname:s,query:c})}function H0(e){try{return decodeURIComponent(e.replace(/\+/gu," "))}catch{return e.replace(/\+/gu," ")}}function qw(e){let t=[],r=0,n=null,i=!1,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(n){i?i=!1:s==="\\"?i=!0:s===n&&(n=null);continue}if(s==="/"&&e[o+1]==="*"){o=Math.max(o,ad(e,o)-1);continue}s==='"'||s==="'"?n=s:s==="("||s==="["?a++:s===")"||s==="]"?a=Math.max(0,a-1):s===","&&a===0&&(t.push(e.slice(r,o).trim()),r=o+1)}return t.push(e.slice(r).trim()),Object.freeze(t.filter(Boolean))}function oR(e){let t=[],r=0;for(;r<e.length;){for(;r<e.length&&(W0(e[r])||e[r]===",");)r++;if(r>=e.length)break;let n=r;for(;r<e.length&&!W0(e[r]);)r++;let i=e.slice(n,r);if(i.endsWith(",")){i=i.replace(/,+$/u,""),i&&t.push(i);continue}i&&t.push(i);let a=0;for(;r<e.length;){let o=e[r++];if(o==="(")a++;else if(o===")")a=Math.max(0,a-1);else if(o===","&&a===0)break}}return Object.freeze(t)}function Yw(e){if(typeof e!="string")return null;let t=Vd(qw(e)[0]??"").trim();return!t||Sh(t)?null:t}function sR(e){let t=[];for(let r of Xs(e,";")){let n=e.slice(r.start,r.end),i=Xs(n,":",!0)[0]?.end??n.length;if(i>=n.length)continue;let a=n.slice(0,i).trim().toLowerCase(),o=n.slice(i+1).trim();a&&t.push(Object.freeze({property:a,value:o}))}return Object.freeze(t)}function lR(e){let t=Po(e).find(r=>r.name==="format");return t&&Vd(e.slice(t.argumentsStart,t.argumentsEnd))||null}var uR=Object.freeze({"font-style":"style","font-weight":"weight","font-stretch":"stretch","font-display":"display","unicode-range":"unicodeRange","font-feature-settings":"featureSettings","font-variation-settings":"variationSettings","ascent-override":"ascentOverride","descent-override":"descentOverride","line-gap-override":"lineGapOverride","size-adjust":"sizeAdjust"});function dR(e){let t={};for(let r of e){let n=uR[r.property];n&&r.value&&(t[n]=r.value)}return Object.keys(t).length>0?Object.freeze(t):void 0}function cR(e){let t=[];for(let r of $h(e)){if(r.name!=="font-face"||r.blockStart===null||r.blockEnd===null)continue;let n=sR(e.slice(r.blockStart,r.blockEnd)),i=Yw(n.find(s=>s.property==="font-family")?.value),a=n.find(s=>s.property==="src")?.value;if(!i||!a)continue;let o=dR(n);for(let s of qw(a)){let l=Nh(s);if(l===null)continue;let u=Mh(l);u.status!=="external"||!u.requestUrl||t.push(Object.freeze({family:i,url:u.requestUrl,format:lR(s),...o?{descriptors:o}:{}}))}}return Object.freeze(t)}function fR(e){let t=[];for(let r of $h(e)){if(r.name!=="import")continue;let n=Nh(e.slice(r.preludeStart,r.preludeEnd));if(n===null)continue;let i=Mh(n);if(i.status!=="external"||!i.requestUrl)continue;let a=Ah(i.requestUrl);if(!a||a.hostname!=="fonts.googleapis.com")continue;let o=a.query.split("&").map(s=>s.split("=",2)).filter(([s])=>H0(s).toLowerCase()==="family").map(([,s])=>H0(s??""));for(let s of o)for(let l of s.split("|")){let u=l.split(":")[0].trim();u&&!Sh(u)&&t.push(u)}}return Object.freeze(t)}function pR(e,t,r){let n=[];for(let i of t.stylesheets)if(i.applicable){for(let a of fR(i.authoredText))n.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"google-font-import",family:a}));for(let a of cR(i.authoredText))n.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"external-font-face",family:a.family,url:a.url,format:a.format,...a.descriptors?{descriptors:a.descriptors}:{}}))}for(let i of e.index.elements)for(let a of i.attributes)if(!(a.namespaceUri!==nR||a.localName!=="fonts"))for(let o of a.value.split(",")){let s=o.replace(/\+/gu," ").trim();!s||s.includes("/")||Sh(s)||n.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"boxy-fonts",family:s}))}for(let i of r.candidates){if(i.canonicalType!=="text"||i.status!=="materialized")continue;let a=s=>{let l=Yw(s);l&&n.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:i.occurrenceId,origin:"text-font-family",family:l}))};a(i.state.fontFamily);let o=Wx(i.state);if(o){a(o.baseStyle.fontFamily);for(let s of o.runs)a(s.style.fontFamily)}}return Object.freeze(n)}function ln(e,t){return e.attributes.find(r=>r.namespaceUri===null&&r.localName.toLowerCase()===t.toLowerCase())?.value??null}function hR(e){return e.children.map(t=>t.kind==="text"||t.kind==="cdata"?t.value:"").join("")}function Kw(e,t){let r=[],n=[...e.index.children(t)].reverse();for(;n.length>0;){let i=n.pop();r.push(i),n.push(...[...e.index.children(i.sourceNodeId)].reverse())}return Object.freeze(r)}function No(e,t){let r=Mh(t.href);e.push(Object.freeze({...t,...r}))}function od(e,t,r,n=new Set(["css-import","css-url"]),i=()=>!0){for(let a of aR(t))!n.has(a.channel)||!i(a)||a.url.trim().startsWith("#")||No(e,{...r,occurrenceId:`${r.occurrenceId}:css:${a.tokenIndex}`,channel:a.channel,href:a.url,hrefNamespace:null})}function mR(e,t,r,n){for(let i of Kw(t,r.sourceNodeId)){let a=i.localName.toLowerCase(),o=ln(i,"id"),s={sourceNodeId:i.sourceNodeId,occurrenceId:`${n}:foreign:${i.sourceNodeId}`,sourceId:o,elementName:i.localName},l=[{attributeName:"src",channel:"html-src",applies:["img","video","audio","source","track","iframe","embed"].includes(a)||a==="input"&&ln(i,"type")?.toLowerCase()==="image"},{attributeName:"poster",channel:"html-poster",applies:a==="video"},{attributeName:"data",channel:"html-data",applies:a==="object"},{attributeName:"href",channel:"html-src",applies:a==="link"&&(ln(i,"rel")??"").split(/\s+/u).some(c=>c.toLowerCase()==="stylesheet")}];for(let c of l){if(!c.applies)continue;let f=ln(i,c.attributeName);f!==null&&No(e,{...s,occurrenceId:`${s.occurrenceId}:${c.attributeName}`,attributeName:c.attributeName,channel:c.channel,href:f,hrefNamespace:null})}let u=ln(i,"srcset");if(u!==null&&(a==="img"||a==="source"))for(let[c,f]of oR(u).entries())No(e,{...s,occurrenceId:`${s.occurrenceId}:srcset:${c}`,attributeName:"srcset",channel:"html-srcset",href:f,hrefNamespace:null});let d=ln(i,"style");d!==null&&od(e,d,{...s,attributeName:"style"}),a==="style"&&od(e,hR(i),{...s,attributeName:"textContent"})}}function gR(e,t,r,n){let i=ln(r,"data-shape-type")?.toLowerCase();if(i==="video"||i==="audio"){let a=Kw(t,r.sourceNodeId).find(o=>o.localName.toLowerCase()===i);if(a){let o=ln(a,"src")??"";if(No(e,{sourceNodeId:a.sourceNodeId,occurrenceId:`${n}:media:src`,sourceId:ln(a,"id"),elementName:i,attributeName:"src",channel:"html-src",href:o,hrefNamespace:null}),i==="video"){let s=ln(r,"data-poster")??ln(a,"poster");s!==null&&No(e,{sourceNodeId:r.sourceNodeId,occurrenceId:`${n}:media:poster`,sourceId:ln(r,"id"),elementName:"video",attributeName:"poster",channel:"html-poster",href:s,hrefNamespace:null})}}return}mR(e,t,r,n)}function yR(e,t,r){let n=[];for(let i of t.occurrences){let a=e.index.element(i.correspondingSourceNodeId);if(!a||a.namespaceUri!==ye)continue;let o=a.localName.toLowerCase();if(o==="image"||o==="feimage"){let s=yr(a)??{value:"",namespace:"svg2"};No(n,{sourceNodeId:a.sourceNodeId,occurrenceId:i.occurrenceId,sourceId:j(a,"id"),elementName:o==="feimage"?"feImage":"image",attributeName:"href",channel:"svg-href",href:s.value,hrefNamespace:s.namespace})}else o==="foreignobject"&&gR(n,e,a,i.occurrenceId)}for(let i of r.stylesheets)i.applicable&&od(n,i.authoredText,{sourceNodeId:i.sourceNodeId,occurrenceId:`style:${i.sourceNodeId}`,sourceId:i.id,elementName:"style",attributeName:"textContent"},new Set(["css-import"]),a=>Ah(a.url)?.hostname!=="fonts.googleapis.com");for(let i of r.elements){let a=e.index.element(i.correspondingSourceNodeId);if(!(!a||a.namespaceUri!==ye))for(let o of Object.values(i.cascadedValues))od(n,o.value,{sourceNodeId:o.sourceNodeId,occurrenceId:`style:${i.occurrenceId}:${o.propertyName}`,sourceId:null,elementName:"style-declaration",attributeName:o.propertyName})}return Object.freeze(n)}function vR(e,t,r){let n=[...new Set(e.filter(d=>d.origin==="google-font-import"||d.origin==="boxy-fonts").map(d=>d.family))].sort(),i=[],a=new Set;for(let d of e){if(d.origin!=="external-font-face"||!d.url)continue;let c=`${d.family}\0${d.url}\0${d.format??""}\0${JSON.stringify(d.descriptors??{})}`;a.has(c)||(a.add(c),i.push(Object.freeze({family:d.family,url:d.url,format:d.format??null,...d.descriptors?{descriptors:d.descriptors}:{}})))}i.sort((d,c)=>d.family.localeCompare(c.family)||d.url.localeCompare(c.url)||(d.format??"").localeCompare(c.format??""));let o=[...new Set([...n,...i.map(d=>d.family)])].sort(),s=[...new Set(t.filter(d=>d.status==="external"&&d.requestUrl).map(d=>d.requestUrl))].sort(),l=[];o.length>0&&l.push(Object.freeze({kind:"font-consent",families:o,googleFamilies:n,...i.length>0?{externalSources:i}:{}})),s.length>0&&l.push(Object.freeze({kind:"external-asset-resolution",urls:s})),Object.freeze(o),Object.freeze(n),Object.freeze(i),Object.freeze(s),Object.freeze(l);let u=Object.freeze({fontCandidates:e,assetCandidates:t,effects:l});return Object.freeze({value:u,diagnostics:r})}function bR(e,t,r,n,i){return vR(pR(e,r,n),yR(e,t,r),Object.freeze([]))}function xR(e,t,r){let n=new Set,i=a=>{let o=a;for(;o;){let s=o.localName.toLowerCase();if(s==="clippath"||s==="mask")return!0;o=e.index.parent(o.sourceNodeId)}return!1};for(let a of r.css){let o=t.occurrence(a.occurrenceId);if(!o)continue;let s=e.index.element(o.correspondingSourceNodeId);s&&i(s)&&n.add(s.sourceNodeId)}return e.index.elements.filter(a=>n.has(a.sourceNodeId)).map(a=>a.sourceNodeId)}var wR=Object.freeze({matchesMedia(e){let t=e.trim().toLowerCase();return t===""||t==="all"||t==="screen"},supportsCondition(){return!1}}),IR=new Map([["clippath","clip-path"],["marker","marker"],["mask","mask"],["pattern","pattern"]]);function kR(e){return Object.freeze(e.index.elements.flatMap(t=>{let r=IR.get(t.localName.toLowerCase());return r?[Object.freeze({sourceNodeId:t.sourceNodeId,capability:r})]:[]}))}function SR(e,t,r){let n=new Map(e.occurrences.map(i=>[i.occurrenceId,i]));return Object.freeze([...t.candidates.filter(i=>i.status==="materialized").map(i=>i.occurrenceId),...r.uses.filter(i=>["symbol-instance","linked-reference"].includes(i.status)).map(i=>i.useOccurrenceId)].filter(i=>n.get(i)?.role!=="definition"))}function $R(e,t={}){let r={source:t.source??"svg",entrypoint:t.entrypoint??"svg-document-import"},n=Td(e,r,t.xmlHost);if(!n.value)return Object.freeze({value:null,diagnostics:n.diagnostics});let i=n.value,a=tP(i.root,r),o=Object.freeze({width:a.value.viewBoxWidth??300,height:a.value.viewBoxHeight??150}),s=t.rootFontSize??16,l=Object.freeze({viewport:Object.freeze({x:a.value.viewBoxX??0,y:a.value.viewBoxY??0,...o}),rootFontSize:s}),u=CP(i,r),d=u.value.condition(i.root.sourceNodeId),c=KE(i,r),f=U_(i,r),p=WP(i,{...r,resourceRoots:kR(i),...t.maxUseDepth!==void 0?{maxDepth:t.maxUseDepth}:{},...t.maxUseOccurrences!==void 0?{maxOccurrences:t.maxUseOccurrences}:{}}),h=eD(i,p,{...r,environment:t.styleEnvironment??wR}),m=qx(i,p,h.value,{viewport:o,rootFontSize:s}),g=QD(i,p,h.value,{...r,viewport:o,rootFontSize:s,viewportPlan:m,...t.textMetricsHost?{textMetricsHost:t.textMetricsHost}:{}}),v=pD(i,p,h.value,{...r,leafGeometry:g.value}),y=zP(i,{...t.claimedIds?{claimedIds:t.claimedIds}:{},cssAnimationTargetSourceNodeIds:xR(i,p,v.value)}),b=y.liveIdForSourceNodeId(i.root.sourceNodeId),I=Object.freeze({...a.value,...b?{svgId:b}:{},...d?.systemLanguage!==null&&d?.systemLanguage!==void 0?{systemLanguage:d.systemLanguage}:{},...d?.requiredExtensions!==null&&d?.requiredExtensions!==void 0?{requiredExtensions:d.requiredExtensions}:{}}),x=K_(i,y),k=w2(i,{...r,appliedDeclarations:h.value.appliedResourceDeclarations}),$=hj(i,p,h.value,k,g.value,{...r,viewport:o,rootFontSize:s}),A=new Set;for(let W of $.value.definitions)if(W.representation==="decomposed")for(let B of W.geometrySourceNodeIds)A.add(B);for(let W of v.value.smil)W.motionPathSourceNodeId&&A.add(W.motionPathSourceNodeId);let S=u2(i,p,h.value,{...r,nativeDefinitionSourceNodeIds:A}),N=TE(i,p,h.value,k,{...r,viewport:o,rootFontSize:s}),T=Aj(i,p,h.value,k,{...r,viewport:o,rootFontSize:s}),z=Ej(i,p,h.value,k,{...r,viewport:o,rootFontSize:s}),C=eE(i,p,h.value,k,{...r,viewport:o,rootFontSize:s}),O=aE(i,y,r),E=oP(i,r),_=dP(i,p,m,r),U=A2(i),V=bR(i,p,h.value,g.value,r),q=pP(i,p,{...r,materializedOccurrenceIds:SR(p,g.value,S)}),G=[...n.diagnostics,...a.diagnostics,...u.diagnostics,...c.diagnostics,...f.diagnostics,...p.diagnostics,...h.diagnostics,...v.diagnostics,...S.diagnostics,...g.diagnostics,...k.diagnostics,...$.diagnostics,...N.diagnostics,...T.diagnostics,...z.diagnostics,...C.diagnostics,...O.diagnostics,...E.diagnostics,..._.diagnostics,...V.diagnostics,...q.diagnostics],H=Object.freeze({projectionContext:l,sourceDocument:i,rootFrame:I,identifiers:y,conditionalProcessing:u.value,scripts:c.value,metadata:f.value,documentExtensions:x,useOccurrences:p,styles:h.value,viewportContexts:m,animations:v.value,symbolUses:S,leafGeometry:g.value,resourceDependencies:k,clipMasks:$.value,filters:N.value,markers:T.value,gradients:z.value,patterns:C.value,paintServerDefinitions:O.value,views:E.value,embeddedFrames:_.value,authoredAttributes:U,externalEffects:V.value,hierarchy:q.value});return Object.freeze({value:H,diagnostics:Object.freeze(G)})}function NR(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function MR(e={}){let t={schemaVersion:In,shapes:e.shapes?e.shapes.map(r=>({...r})):[],viewboxes:e.viewboxes?e.viewboxes.map(r=>({...r})):[]};return e.metadata&&(t.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...e.metadata}),t}function AR(e,t,r,n,i){return{id:i??NR(),x:e,y:t,width:r,height:n}}var CR=class{schemas=new Map;register(e,t){this.schemas.set(e,t)}get(e){return this.schemas.get(e)}typeIds(){return[...this.schemas.keys()]}getDefaults(e){let t=this.schemas.get(e);if(!t)return{};let r={};for(let n of Object.keys(t))r[n]=t[n].default;return r}validate(e,t,r){let n=this.schemas.get(e);if(!n)return r;let i=n[t];return i?.validate?i.validate(r):r}},Pe=e=>Math.max(0,e),xo=e=>Math.max(0,Math.min(1,e)),Ht=e=>Math.max(0,Math.min(100,e)),OR=e=>Math.max(1,e),TR=e=>Math.max(3,Math.min(100,Math.floor(e))),PR=e=>Math.max(3,Math.min(50,Math.floor(e))),DR=e=>Math.max(3,Math.min(30,Math.floor(e))),jR=e=>Math.max(1,Math.min(10,e)),ER=e=>!e||typeof e!="object"||Array.isArray(e)||e.kind!=="shape"&&e.kind!=="definition"||typeof e.targetId!="string"||e.targetId.length===0||e.element!=="href"&&e.element!=="mpath"?null:{kind:e.kind,targetId:e.targetId,element:e.element};function zR(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{default:r}]))}var _R=zR(UM),_t={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:xo},fillOpacity:{default:1,validate:xo},strokeOpacity:{default:1,validate:xo},..._R,locked:{default:!1},visible:{default:!0},fillType:{default:"solid"},fillGradient:{default:null},strokeType:{default:"solid"},strokeGradient:{default:null},fillRule:{default:"nonzero"},strokeLinejoin:{default:"miter"},strokeLinecap:{default:"butt"},strokeMiterlimit:{default:4,validate:OR},lineStyle:{default:"solid"},dashLength:{default:8},gapLength:{default:4},dashOffset:{default:0},strokeDasharray:{default:null},colorInterpolation:{default:null},filters:{default:[]},filterColorInterpolation:{default:null},filterUnits:{default:null},primitiveUnits:{default:null},filterX:{default:null},filterY:{default:null},filterWidth:{default:null},filterHeight:{default:null},metadata:{default:null},cssClipPath:{default:null},cssMaskProperties:{default:null}},pn={..._t,cx:{default:0},cy:{default:0},radius:{default:50,validate:Pe},cornerRadius:{default:0,validate:Pe},shiftAngle:{default:0}},Fo={..._t,x:{default:0},y:{default:0},width:{default:100,validate:Pe},height:{default:60,validate:Pe}},Zw={..._t,x:{default:0},y:{default:0},width:{default:0,validate:Pe},height:{default:0,validate:Pe},href:{default:""},mediaMimeType:{default:""},originalWidth:{default:0},originalHeight:{default:0},naturalDuration:{default:0},preserveAspectRatio:{default:!0},begin:{default:0},trimStart:{default:0},volume:{default:1,validate:xo},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:xo},fadeInDuration:{default:0,validate:Pe},fadeOutDuration:{default:0,validate:Pe},posterHref:{default:""},sourceRect:{default:null}},Le=new CR;Le.register("rectangle",{..._t,x:{default:0},y:{default:0},width:{default:100,validate:Pe},height:{default:100,validate:Pe},rx:{default:0,validate:Pe},ry:{default:0,validate:Pe},cornerRadius:{default:0,validate:Pe},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:Pe},cornerRadiusTR:{default:0,validate:Pe},cornerRadiusBL:{default:0,validate:Pe},cornerRadiusBR:{default:0,validate:Pe},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});Le.register("square",{..._t,x:{default:0},y:{default:0},size:{default:100,validate:Pe},width:{default:100,validate:Pe},height:{default:100,validate:Pe},rx:{default:0,validate:Pe},ry:{default:0,validate:Pe},cornerRadius:{default:0,validate:Pe},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:Pe},cornerRadiusTR:{default:0,validate:Pe},cornerRadiusBL:{default:0,validate:Pe},cornerRadiusBR:{default:0,validate:Pe},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});Le.register("circle",{..._t,x:{default:0},y:{default:0},radius:{default:50,validate:Pe}});Le.register("ellipse",{..._t,x:{default:0},y:{default:0},rx:{default:50,validate:Pe},ry:{default:30,validate:Pe}});Le.register("line",{..._t,x1:{default:0},y1:{default:0},x2:{default:100},y2:{default:0},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});Le.register("text",{..._t,x:{default:0},y:{default:0},width:{default:0,validate:Pe},height:{default:0,validate:Pe},textX:{default:0},textY:{default:0},fontSize:{default:24},text:{default:""},fontFamily:{default:"Arial"},fontWeight:{default:"normal"},fontStyle:{default:"normal"},fontStretch:{default:"normal"},fontSizeAdjust:{default:"none"},fontVariant:{default:""},fontVariantLigatures:{default:""},fontVariantPosition:{default:""},fontVariantCaps:{default:""},fontVariantNumeric:{default:""},fontVariantEastAsian:{default:""},textDecoration:{default:{}},textTransform:{default:"none"},baselineShift:{default:"baseline"},dominantBaseline:{default:"auto"},alignmentBaseline:{default:"auto"},writingMode:{default:"horizontal-tb"},textAnchor:{default:"start"},letterSpacing:{default:0},wordSpacing:{default:0},lineHeight:{default:1.2},inlineSize:{default:0},overflowWrap:{default:"normal"},whiteSpace:{default:"pre-wrap"},textDirection:{default:"ltr"},unicodeBidi:{default:"normal"},scaleX:{default:1},scaleY:{default:1},scaleAnchor:{default:null},useRichText:{default:!1},richTextRuns:{default:null},charOffsets:{default:null},fontVariationSettings:{default:{}},isTextPath:{default:!1},textPathPoints:{default:null},textPathStartOffset:{default:0},textPathSide:{default:"left"},textPathReference:{default:null,validate:ER},shapeInsideRef:{default:null},shapePadding:{default:0}});Le.register("image",{..._t,x:{default:0},y:{default:0},width:{default:100,validate:Pe},height:{default:100,validate:Pe},href:{default:""},originalWidth:{default:0},originalHeight:{default:0},preserveAspectRatio:{default:!0},imageOpacity:{default:1,validate:xo}});Le.register("path",{..._t,x:{default:0},y:{default:0},width:{default:0,validate:Pe},height:{default:0,validate:Pe},pathPoints:{default:[]},pathArcParams:{default:[]},pathControlBounds:{default:null},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});Le.register("polyline",{..._t,x:{default:0},y:{default:0},width:{default:0,validate:Pe},height:{default:0,validate:Pe},polylinePoints:{default:[]},polylineClosed:{default:!1}});Le.register("triangle",{...pn,sides:{default:3}});Le.register("ngon",{...pn,sides:{default:6,validate:TR}});Le.register("star",{...pn,arms:{default:5,validate:PR},innerRadiusPercent:{default:40,validate:Ht}});Le.register("cross",{...pn,armWidthPercent:{default:30,validate:Ht}});Le.register("ring",{...pn,innerRadiusPercent:{default:50,validate:Ht}});Le.register("spiral",{...pn,turns:{default:3,validate:jR},thicknessPercent:{default:15,validate:Ht},spiralDirection:{default:1}});Le.register("gear",{...pn,teeth:{default:8,validate:DR},toothDepthPercent:{default:25,validate:Ht},holeRadiusPercent:{default:20,validate:Ht}});Le.register("arrow",{...pn,headWidthPercent:{default:100,validate:Ht},headLengthPercent:{default:40,validate:Ht},shaftWidthPercent:{default:40,validate:Ht}});Le.register("symbol-instance",{..._t,x:{default:0},y:{default:0},width:{default:100,validate:Pe},height:{default:100,validate:Pe},symbolId:{default:""}});Le.register("group",{..._t});Le.register("container",{..._t});Le.register("cloud",{...pn,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:Ht}});Le.register("heart",{...pn,lobeRadiusPercent:{default:50,validate:Ht},cleftDepthPercent:{default:25,validate:Ht}});Le.register("lightning",{...pn,boltSegments:{default:3},boltWidthPercent:{default:30,validate:Ht},boltJaggednessPercent:{default:40,validate:Ht}});Le.register("speechBubble",{...pn,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:Ht},tailWidthPercent:{default:25,validate:Ht}});Le.register("diamond",{...Fo});Le.register("parallelogram",{...Fo,slantPercent:{default:20,validate:Ht}});Le.register("trapezoid",{...Fo,topWidthPercent:{default:70,validate:Ht}});Le.register("terminator",{...Fo});Le.register("cylinder",{...Fo,capHeightPercent:{default:15,validate:Ht}});Le.register("document-shape",{...Fo,waveAmplitudePercent:{default:15,validate:Ht}});Le.register("hyperlink",{..._t,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});Le.register("switch",{..._t,switchSystemLanguage:{default:null},switchRequiredExtensions:{default:null}});Le.register("svg",{..._t});Le.register("view",{..._t,viewBoxX:{default:0},viewBoxY:{default:0},viewBoxWidth:{default:0,validate:Pe},viewBoxHeight:{default:0,validate:Pe},viewName:{default:""},viewPreserveAspectRatio:{default:""},viewTarget:{default:""}});Le.register("shape-reference",{..._t,targetShapeId:{default:""},offsetX:{default:0},offsetY:{default:0},targetWidth:{default:0,validate:Pe},targetHeight:{default:0,validate:Pe},broken:{default:!1}});Le.register("foreign-object",{..._t,x:{default:0},y:{default:0},width:{default:0,validate:Pe},height:{default:0,validate:Pe},foreignContent:{default:[]}});Le.register("video",{...Zw,mediaKind:{default:"video"}});Le.register("audio",{...Zw,mediaKind:{default:"audio"}});Le.register("document",{});function Ff(e){let t=new Set;for(let r of e??[])zi(r,{onShape:n=>{n.id&&t.add(n.id)}});return t}function oa(e){let t=Ff(e.shapes),r=new Map;for(let i of e.library??[]){let a=new Set([i.id]);if(i.kind==="symbol"||i.kind==="marker")for(let o of Ff(i.shapes))a.add(o);if(i.kind==="symbol")for(let o of Object.values(i.variants??{}))for(let s of Ff(o))a.add(s);for(let o of a){let s=r.get(o)??new Set;s.add(i.id),r.set(o,s)}}let n=new Map;for(let[i,a]of r)n.set(i,Object.freeze([...a].sort()));return{documentParentIds:t,definitionIdsByParentId:n,resolve(i){if(i.parentDefinitionId!==void 0)return(n.get(i.parentId)??[]).includes(i.parentDefinitionId)?{kind:"library",definitionId:i.parentDefinitionId}:{kind:"missing"};if(t.has(i.parentId))return{kind:"document"};let a=n.get(i.parentId)??[];return a.length===1?{kind:"library",definitionId:a[0]}:a.length>1?{kind:"ambiguous",definitionIds:a}:{kind:"missing"}}}}var RR;function FR(){return RR??=new Set([...Le.typeIds().filter(e=>e!=="document"),"spline"])}function ul(e){let t=[],r=[];if(e==null||typeof e!="object")return t.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:t,warnings:r};let n=e;for(let a of Object.keys(n))a in pa||r.push({path:a,message:`Unknown top-level field "${a}" (likely written by a newer version); it is preserved in the unknownFields quarantine on save`,severity:"warning"});let i={doc:n,errors:t,warnings:r};for(let a of Object.keys(pa)){let o=n[a];o===void 0&&!pa[a].required||KR[a](o,i)}return VR(n,t),{valid:t.length===0,errors:t,warnings:r}}function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function LR(e){let t=new Map,r=n=>{if(Array.isArray(n)){for(let i of n)if(!(!de(i)||!de(i.state))){if(typeof i.id=="string"&&i.type==="text"){let a=new Map,o=i.state.textSpanTree,s=l=>{if(Array.isArray(l))for(let u of l)de(u)&&(typeof u.spanId=="string"&&u.spanId.length>0&&a.set(u.spanId,{start:u.start,end:u.end}),s(u.children))};de(o)&&s(o.spans),t.set(i.id,a)}r(i.state.children)}}};return r(e),t}function rr(e,t,r){return Array.isArray(e)?!0:(r.push({path:t,message:`${t} must be an array`,severity:"error"}),!1)}function Mo(e,t,r){e!==void 0&&(typeof e!="number"||!Number.isInteger(e)||e<0)&&r.push({path:t,message:"Definition order must be a non-negative integer",severity:"error"})}function Ao(e,t,r){e!==void 0&&(typeof e!="string"||e.length===0)&&r.push({path:t,message:"Definition container id must be a non-empty string",severity:"error"})}function BR(e,t,r,n){if(e===void 0||!rr(e,t,n))return;let i=new Set;e.forEach((a,o)=>{let s=`${t}[${o}]`;if(!de(a)){n.push({path:s,message:"Animation track must be an object",severity:"error"});return}if(typeof a.id!="string"||a.id.length===0?n.push({path:`${s}.id`,message:"Animation track id must be a non-empty string",severity:"error"}):i.has(a.id)?n.push({path:`${s}.id`,message:`Duplicate animation track id: "${a.id}"`,severity:"error"}):i.add(a.id),(typeof a.shapeId!="string"||!r.has(a.shapeId))&&n.push({path:`${s}.shapeId`,message:"Definition animation must target a shape owned by the definition",severity:"error"}),!Array.isArray(a.keyframes)){n.push({path:`${s}.keyframes`,message:"Animation track keyframes must be an array",severity:"error"});return}let l=new Set;a.keyframes.forEach((u,d)=>{let c=`${s}.keyframes[${d}].id`;!de(u)||typeof u.id!="string"||!u.id?n.push({path:c,message:"Animation keyframe id must be a non-empty string",severity:"error"}):l.has(u.id)?n.push({path:c,message:`Duplicate animation keyframe id: "${u.id}"`,severity:"error"}):l.add(u.id)})})}function VR(e,t){let r=new Set(Array.isArray(e.definitionContainers)?e.definitionContainers.flatMap(o=>de(o)&&typeof o.id=="string"?[o.id]:[]):[]),n=(o,s)=>{!de(o)||o.definitionContainerId===void 0||typeof o.definitionContainerId!="string"||o.definitionContainerId.length===0||r.has(o.definitionContainerId)||t.push({path:`${s}.definitionContainerId`,message:`Definition container "${o.definitionContainerId}" does not exist`,severity:"error"})};for(let[o,s]of[["documentExtensions",e.documentExtensions],["documentStyles",e.documentStyles],["library",e.library],["paintServerDefs",e.paintServerDefs],["clipMaskGroups",e.clipMaskGroups]])Array.isArray(s)&&s.forEach((l,u)=>n(l,`${o}[${u}]`));de(e.animationTimeline)&&Array.isArray(e.animationTimeline.tracks)&&e.animationTimeline.tracks.forEach((o,s)=>{if(!de(o)||o.sourceSmilDefinitionContainerId===void 0)return;let l=o.sourceSmilDefinitionContainerId;typeof l!="string"||l.length===0||r.has(l)||t.push({path:`animationTimeline.tracks[${s}].sourceSmilDefinitionContainerId`,message:`Definition container "${l}" does not exist`,severity:"error"})});let i=new Set(Array.isArray(e.library)?e.library.flatMap(o=>de(o)&&typeof o.id=="string"?[o.id]:[]):[]);Array.isArray(e.documentStyles)&&e.documentStyles.forEach((o,s)=>{!de(o)||o.scopeDefinitionId===void 0||typeof o.scopeDefinitionId!="string"||o.scopeDefinitionId.length===0||i.has(o.scopeDefinitionId)||t.push({path:`documentStyles[${s}].scopeDefinitionId`,message:`Scoped definition "${o.scopeDefinitionId}" does not exist`,severity:"error"})});let a=(o,s)=>{Array.isArray(o)&&o.forEach((l,u)=>{let d=`${s}[${u}]`;!de(l)||!de(l.state)||(n(l.state,`${d}.state`),a(l.state.children,`${d}.state.children`))})};a(e.shapes,"shapes"),Array.isArray(e.library)&&e.library.forEach((o,s)=>{de(o)&&a(o.shapes,`library[${s}].shapes`)})}var UR=new Set(["text","comment","cdata","processing-instruction"]);function Jw(e,t,r){if(!de(e)){r.push({path:t,message:"Document extension attribute must be a plain object",severity:"error"});return}for(let n of["name","localName","value"])typeof e[n]!="string"&&r.push({path:`${t}.${n}`,message:`${n} must be a string`,severity:"error"});for(let n of["prefix","namespaceUri"])e[n]!==null&&typeof e[n]!="string"&&r.push({path:`${t}.${n}`,message:`${n} must be a string or null`,severity:"error"})}function Qw(e,t,r){let n=[{node:e,path:t,depth:0}];for(;n.length>0;){let i=n.pop();if(i.depth>64){r.push({path:i.path,message:"Document extension nesting exceeds 64 levels",severity:"error"});continue}if(!de(i.node)){r.push({path:i.path,message:"Document extension node must be a plain object",severity:"error"});continue}let a=i.node;if(a.kind==="element"){for(let o of["name","localName"])(typeof a[o]!="string"||a[o].length===0)&&r.push({path:`${i.path}.${o}`,message:`${o} must be a non-empty string`,severity:"error"});for(let o of["prefix","namespaceUri"])a[o]!==null&&typeof a[o]!="string"&&r.push({path:`${i.path}.${o}`,message:`${o} must be a string or null`,severity:"error"});rr(a.attributes,`${i.path}.attributes`,r)&&a.attributes.forEach((o,s)=>Jw(o,`${i.path}.attributes[${s}]`,r)),rr(a.children,`${i.path}.children`,r)&&a.children.forEach((o,s)=>n.push({node:o,path:`${i.path}.children[${s}]`,depth:i.depth+1}));continue}UR.has(String(a.kind))||r.push({path:`${i.path}.kind`,message:"Unsupported document extension node kind",severity:"error"}),typeof a.value!="string"&&r.push({path:`${i.path}.value`,message:"Document extension character value must be a string",severity:"error"})}}function GR(e,t,r,n){if(!de(e)){r.push({path:t,message:"Document extension must be a plain object",severity:"error"});return}typeof e.id!="string"||e.id.length===0?r.push({path:`${t}.id`,message:"Document extension id must be a non-empty string",severity:"error"}):n.has(e.id)?r.push({path:`${t}.id`,message:`Duplicate document extension id: "${e.id}"`,severity:"error"}):n.add(e.id),e.placement!=="root"&&e.placement!=="defs"&&r.push({path:`${t}.placement`,message:"Document extension placement must be root or defs",severity:"error"}),(typeof e.order!="number"||!Number.isInteger(e.order)||e.order<0)&&r.push({path:`${t}.order`,message:"Document extension order must be a non-negative integer",severity:"error"}),Mo(e.definitionOrder,`${t}.definitionOrder`,r),Ao(e.definitionContainerId,`${t}.definitionContainerId`,r),Qw(e.element,`${t}.element`,r)}var XR=new Set(["x1","y1","x2","y2","gradientTransform"]),WR=new Set(["cx","cy","fx","fy","r","fr","gradientTransform"]),HR=new Set(["x","y","width","height"]);function Or(e,t,r){e.push({path:t,message:r,severity:"error"})}function qR(e,t,r,n){if(!de(e)){Or(n,t,"Gradient must be a plain object");return}if(e.templateId!==void 0&&typeof e.templateId!="string"&&Or(n,`${t}.templateId`,"templateId must be a string"),e.rootAttributes!==void 0)if(!de(e.rootAttributes))Or(n,`${t}.rootAttributes`,"Gradient rootAttributes must be a plain object");else for(let[a,o]of Object.entries(e.rootAttributes))Fd(a)||Or(n,`${t}.rootAttributes.${a}`,"Gradient root attributes must be safe non-typed attributes"),typeof o!="string"&&Or(n,`${t}.rootAttributes.${a}`,"Gradient root attribute values must be strings");let i=r==="linear-gradient"?["x1","y1","x2","y2","opacity"]:["cx","cy","fx","fy","r","ry","rotation","opacity"];for(let a of i)e[a]!==void 0&&(typeof e[a]!="number"||!Number.isFinite(e[a]))&&Or(n,`${t}.${a}`,`${a} must be a finite number`);if(e.fr!==void 0&&(typeof e.fr!="number"||!Number.isFinite(e.fr))&&Or(n,`${t}.fr`,"fr must be a finite number"),e.authoredGeometry!==void 0)if(!de(e.authoredGeometry))Or(n,`${t}.authoredGeometry`,"Gradient authoredGeometry must be a plain object");else{let a=r==="linear-gradient"?XR:WR;for(let[o,s]of Object.entries(e.authoredGeometry))a.has(o)?typeof s!="string"&&Or(n,`${t}.authoredGeometry.${o}`,"Authored gradient geometry declarations must be strings"):Or(n,`${t}.authoredGeometry.${o}`,"is not a supported authored gradient geometry field")}e.gradientTransform!==void 0&&(!Array.isArray(e.gradientTransform)||e.gradientTransform.length!==6||!e.gradientTransform.every(a=>typeof a=="number"&&Number.isFinite(a)))&&Or(n,`${t}.gradientTransform`,"gradientTransform must be a 6-element finite affine matrix"),Array.isArray(e.stops)?e.stops.forEach((a,o)=>{if(!de(a)){Or(n,`${t}.stops[${o}]`,"Gradient stop must be an object");return}a.id!==void 0&&(typeof a.id!="string"||a.id.length===0)&&Or(n,`${t}.stops[${o}].id`,"id must be a nonempty string");for(let s of["offset","opacity"])a[s]!==void 0&&(typeof a[s]!="number"||!Number.isFinite(a[s]))&&Or(n,`${t}.stops[${o}].${s}`,`${s} must be a finite number`)}):Or(n,`${t}.stops`,"Gradient stops must be an array")}function YR(e,t,r){if(!de(e)){r.push({path:t,message:"Pattern must be a plain object",severity:"error"});return}if(e.templateId!==void 0&&typeof e.templateId!="string"&&r.push({path:`${t}.templateId`,message:"templateId must be a string",severity:"error"}),e.rootAttributes!==void 0)if(!de(e.rootAttributes))r.push({path:`${t}.rootAttributes`,message:"Pattern rootAttributes must be a plain object",severity:"error"});else for(let[n,i]of Object.entries(e.rootAttributes))Ld(n)||r.push({path:`${t}.rootAttributes.${n}`,message:"Pattern root attributes must be safe non-typed attributes",severity:"error"}),typeof i!="string"&&r.push({path:`${t}.rootAttributes.${n}`,message:"Pattern root attribute values must be strings",severity:"error"});for(let n of["x","y","width","height","scale","rotation","opacity"])e[n]!==void 0&&(typeof e[n]!="number"||!Number.isFinite(e[n]))&&r.push({path:`${t}.${n}`,message:`${n} must be a finite number`,severity:"error"});e.patternUnits!==void 0&&e.patternUnits!=="userSpaceOnUse"&&e.patternUnits!=="objectBoundingBox"&&r.push({path:`${t}.patternUnits`,message:"patternUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"}),e.patternContentUnits!==void 0&&e.patternContentUnits!=="userSpaceOnUse"&&e.patternContentUnits!=="objectBoundingBox"&&r.push({path:`${t}.patternContentUnits`,message:"patternContentUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"});for(let n of["svgContent","patternTransform","viewBox","preserveAspectRatio"])e[n]!==void 0&&typeof e[n]!="string"&&r.push({path:`${t}.${n}`,message:`${n} must be a string`,severity:"error"});if(e.authoredGeometry!==void 0)if(!de(e.authoredGeometry))r.push({path:`${t}.authoredGeometry`,message:"Pattern authoredGeometry must be a plain object",severity:"error"});else for(let[n,i]of Object.entries(e.authoredGeometry))HR.has(n)?typeof i!="string"&&r.push({path:`${t}.authoredGeometry.${n}`,message:"Authored pattern geometry declarations must be strings",severity:"error"}):r.push({path:`${t}.authoredGeometry.${n}`,message:"is not a supported authored pattern geometry field",severity:"error"})}var KR={schemaVersion:(e,{errors:t,warnings:r})=>{typeof e!="number"||!Number.isInteger(e)?t.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):e>In&&r.push({path:"schemaVersion",message:`schemaVersion ${e} is newer than supported (${In})`,severity:"warning"})},shapes:(e,{errors:t,warnings:r})=>{if(!rr(e,"shapes",t))return;let n=new Set;e.forEach((i,a)=>{Bf(i,`shapes[${a}]`,t,r,n)})},viewboxes:(e,{errors:t})=>{if(!rr(e,"viewboxes",t))return;let r=new Set;e.forEach((n,i)=>{iF(n,`viewboxes[${i}]`,t,r)})},guides:(e,{errors:t})=>{rr(e,"guides",t)&&e.forEach((r,n)=>{aF(r,`guides[${n}]`,t)})},measurements:(e,{errors:t})=>{rr(e,"measurements",t)&&e.forEach((r,n)=>{let i=`measurements[${n}]`;if(!de(r)){t.push({path:i,message:"Measurement must be a non-null object",severity:"error"});return}(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${i}.id`,message:"Measurement id must be a non-empty string",severity:"error"})})},sceneTree:(e,{doc:t,errors:r,warnings:n})=>{if(!rr(e,"sceneTree",r))return;let i=Lf(t.shapes),a=new Set;e.forEach((o,s)=>{ZR(o,`sceneTree[${s}]`,r,n,i,a)})},clipMaskGroups:(e,{doc:t,errors:r,warnings:n})=>{if(!rr(e,"clipMaskGroups",r))return;let i=Lf(t.shapes),a=oa(t);e.forEach((o,s)=>{oF(o,`clipMaskGroups[${s}]`,r,n,i,a)})},documentMetadata:(e,{errors:t})=>{de(e)||t.push({path:"documentMetadata",message:"documentMetadata must be a plain object",severity:"error"})},documentExtensions:(e,{errors:t})=>{if(!rr(e,"documentExtensions",t))return;let r=new Set;e.forEach((n,i)=>GR(n,`documentExtensions[${i}]`,t,r))},definitionContainers:(e,{doc:t,errors:r})=>{if(!rr(e,"definitionContainers",r))return;let n=new Set,i=new Set,a=oa(t);e.forEach((o,s)=>{let l=`definitionContainers[${s}]`;if(!de(o)){r.push({path:l,message:"Definition container must be a plain object",severity:"error"});return}typeof o.id!="string"||o.id.length===0?r.push({path:`${l}.id`,message:"Definition container id must be a non-empty string",severity:"error"}):n.has(o.id)?r.push({path:`${l}.id`,message:`Duplicate definition container id: "${o.id}"`,severity:"error"}):n.add(o.id),o.svgId!==void 0&&(typeof o.svgId!="string"||o.svgId.length===0)&&r.push({path:`${l}.svgId`,message:"Definition container svgId must be a non-empty string",severity:"error"}),typeof o.order!="number"||!Number.isInteger(o.order)||o.order<0?r.push({path:`${l}.order`,message:"Definition container order must be a non-negative integer",severity:"error"}):i.has(o.order)?r.push({path:`${l}.order`,message:`Duplicate definition container order: ${o.order}`,severity:"error"}):i.add(o.order),js(o.authoredPlacement,`${l}.authoredPlacement`,r,a,"Definition container"),o.attributes!==void 0&&rr(o.attributes,`${l}.attributes`,r)&&o.attributes.forEach((u,d)=>{let c=`${l}.attributes[${d}]`;Jw(u,c,r),de(u)&&u.localName==="id"&&u.namespaceUri===null&&r.push({path:c,message:"Definition container attributes must not duplicate svgId authority",severity:"error"})})})},documentScripts:(e,{errors:t})=>{rr(e,"documentScripts",t)&&e.forEach((r,n)=>{let i=`documentScripts[${n}]`;if(!de(r)){t.push({path:i,message:"Document script must be a non-null object",severity:"error"});return}(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${i}.id`,message:"Document script id must be a non-empty string",severity:"error"})})},documentStyles:(e,{doc:t,errors:r})=>{if(!rr(e,"documentStyles",r))return;let n=oa(t);e.forEach((i,a)=>{let o=`documentStyles[${a}]`;if(!de(i)){r.push({path:o,message:"Document style must be a non-null object",severity:"error"});return}(typeof i.id!="string"||i.id.length===0)&&r.push({path:`${o}.id`,message:"Document style id must be a non-empty string",severity:"error"}),typeof i.css!="string"&&r.push({path:`${o}.css`,message:"Document style css must be a string",severity:"error"}),i.placement!=="root"&&i.placement!=="defs"&&r.push({path:`${o}.placement`,message:'Document style placement must be "root" or "defs"',severity:"error"}),Mo(i.definitionOrder,`${o}.definitionOrder`,r),Ao(i.definitionContainerId,`${o}.definitionContainerId`,r),js(i.authoredPlacement,`${o}.authoredPlacement`,r,n,"Document style"),i.scopeDefinitionId!==void 0&&(typeof i.scopeDefinitionId!="string"||i.scopeDefinitionId.length===0)&&r.push({path:`${o}.scopeDefinitionId`,message:"Document style scopeDefinitionId must be a non-empty string",severity:"error"}),i.scopeDefinitionId!==void 0&&i.placement!=="defs"&&r.push({path:`${o}.scopeDefinitionId`,message:"A definition-scoped document style must use defs placement",severity:"error"})})},templateVariables:(e,{errors:t})=>{rr(e,"templateVariables",t)&&e.forEach((r,n)=>{let i=`templateVariables[${n}]`;if(!de(r)){t.push({path:i,message:"Template variable must be a non-null object",severity:"error"});return}(typeof r.name!="string"||r.name.length===0)&&t.push({path:`${i}.name`,message:"Template variable name must be a non-empty string",severity:"error"})})},animationTimeline:(e,{doc:t,errors:r})=>{if(!de(e)){r.push({path:"animationTimeline",message:"animationTimeline must be a plain object",severity:"error"});return}if(e.tracks!==void 0&&!Array.isArray(e.tracks)){r.push({path:"animationTimeline.tracks",message:"animationTimeline.tracks must be an array",severity:"error"});return}if(e.cssAnimationDocumentStylesFingerprint!==void 0&&(typeof e.cssAnimationDocumentStylesFingerprint!="string"||e.cssAnimationDocumentStylesFingerprint.length===0)&&r.push({path:"animationTimeline.cssAnimationDocumentStylesFingerprint",message:"CSS animation document-style fingerprint must be a non-empty string",severity:"error"}),e.cssAnimationInlineStylesFingerprint!==void 0&&(typeof e.cssAnimationInlineStylesFingerprint!="string"||e.cssAnimationInlineStylesFingerprint.length===0)&&r.push({path:"animationTimeline.cssAnimationInlineStylesFingerprint",message:"CSS animation inline-style fingerprint must be a non-empty string",severity:"error"}),e.cssAnimationSources!==void 0)if(!Array.isArray(e.cssAnimationSources))r.push({path:"animationTimeline.cssAnimationSources",message:"CSS animation sources must be an array",severity:"error"});else{let n=new Set,i=new Set;e.cssAnimationSources.forEach((a,o)=>{let s=`animationTimeline.cssAnimationSources[${o}]`;if(!de(a)){r.push({path:s,message:"CSS animation source must be an object",severity:"error"});return}if(typeof a.id!="string"||a.id.length===0?r.push({path:`${s}.id`,message:"CSS animation source id must be a non-empty string",severity:"error"}):n.has(a.id)?r.push({path:`${s}.id`,message:`Duplicate CSS animation source id: "${a.id}"`,severity:"error"}):n.add(a.id),!Array.isArray(a.trackIds)||!Array.isArray(a.trackFingerprints)){r.push({path:s,message:"CSS animation source track ids and fingerprints must be arrays",severity:"error"});return}a.trackIds.length!==a.trackFingerprints.length&&r.push({path:s,message:"CSS animation source track ids and fingerprints must have equal lengths",severity:"error"}),a.trackIds.forEach((l,u)=>{typeof l!="string"||l.length===0?r.push({path:`${s}.trackIds[${u}]`,message:"CSS animation source track id must be a non-empty string",severity:"error"}):i.has(l)?r.push({path:`${s}.trackIds[${u}]`,message:`Duplicate CSS animation source track id: "${l}"`,severity:"error"}):i.add(l)}),a.trackFingerprints.forEach((l,u)=>{(typeof l!="string"||l.length===0)&&r.push({path:`${s}.trackFingerprints[${u}]`,message:"CSS animation track fingerprint must be a non-empty string",severity:"error"})})})}if(Array.isArray(e.tracks)&&Number(t.schemaVersion)>=11){let n=LR(t.shapes);e.tracks.forEach((i,a)=>{if(!de(i)||!Array.isArray(i.keyframes))return;if(i.sourceCssAnimationId!==void 0&&(typeof i.sourceCssAnimationId!="string"||!i.sourceCssAnimationId)&&r.push({path:`animationTimeline.tracks[${a}].sourceCssAnimationId`,message:"CSS animation source id must be a non-empty string",severity:"error"}),i.definitionTarget!==void 0){let s=`animationTimeline.tracks[${a}].definitionTarget`;if(!de(i.definitionTarget))r.push({path:s,message:"must be an object",severity:"error"});else{let l=i.definitionTarget.definitionId,u=i.definitionTarget.nodeId;if((typeof l!="string"||l.length===0)&&r.push({path:`${s}.definitionId`,message:"must be a non-empty string",severity:"error"}),u!==void 0&&(typeof u!="string"||u.length===0)&&r.push({path:`${s}.nodeId`,message:"must be a non-empty string when present",severity:"error"}),typeof l=="string"&&l.length>0){let d=`definition:${l}${typeof u=="string"&&u.length>0?`/${u}`:""}`;i.shapeId!==d&&r.push({path:`animationTimeline.tracks[${a}].shapeId`,message:`definition target tracks must use ${d}`,severity:"error"})}}}if(i.simpleDuration!==void 0&&i.simpleDuration!=="indefinite"&&r.push({path:`animationTimeline.tracks[${a}].simpleDuration`,message:'SMIL simple duration must be "indefinite" when present',severity:"error"}),i.simpleDuration==="indefinite"&&i.cycleDuration!==void 0&&r.push({path:`animationTimeline.tracks[${a}].cycleDuration`,message:"Finite and indefinite SMIL simple durations are mutually exclusive",severity:"error"}),i.sourceSmilPlacement!==void 0&&i.sourceSmilPlacement!=="document"&&i.sourceSmilPlacement!=="defs"&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilPlacement`,message:'SMIL source placement must be "document" or "defs" when present',severity:"error"}),i.sourceSmilParentTarget!==void 0&&i.sourceSmilParentTarget!==!0&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilParentTarget`,message:"SMIL implicit parent target must be true when present",severity:"error"}),i.sourceSmilParentTarget===!0&&i.sourceSmilPlacement!=="document"&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilPlacement`,message:"SMIL implicit parent target requires document placement",severity:"error"}),i.sourceSmilOrder!==void 0&&(!Number.isInteger(i.sourceSmilOrder)||Number(i.sourceSmilOrder)<0)&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilOrder`,message:"SMIL source order must be a non-negative integer when present",severity:"error"}),i.sourceSmilDefinitionOrder!==void 0&&(!Number.isInteger(i.sourceSmilDefinitionOrder)||Number(i.sourceSmilDefinitionOrder)<0)&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilDefinitionOrder`,message:"SMIL definition order must be a non-negative integer when present",severity:"error"}),i.sourceSmilDefinitionContainerId!==void 0&&(typeof i.sourceSmilDefinitionContainerId!="string"||i.sourceSmilDefinitionContainerId.length===0)&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilDefinitionContainerId`,message:"SMIL definition container id must be a non-empty string when present",severity:"error"}),(i.sourceSmilDefinitionOrder!==void 0||i.sourceSmilDefinitionContainerId!==void 0)&&i.sourceSmilPlacement!=="defs"&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilPlacement`,message:'SMIL definition placement fields require sourceSmilPlacement "defs"',severity:"error"}),i.textPathStartOffsetUnit!==void 0&&i.textPathStartOffsetUnit!=="%"&&i.textPathStartOffsetUnit!=="user"&&r.push({path:`animationTimeline.tracks[${a}].textPathStartOffsetUnit`,message:'Text path start-offset unit must be "%" or "user" when present',severity:"error"}),i.textSpanTarget!==void 0){let s=`animationTimeline.tracks[${a}].textSpanTarget`;if(!de(i.textSpanTarget))r.push({path:s,message:"Text span target must be a plain object",severity:"error"});else{let l=i.textSpanTarget;if((typeof l.attributeName!="string"||l.attributeName.length===0)&&r.push({path:`${s}.attributeName`,message:"Text span target attribute name must be a non-empty string",severity:"error"}),!Array.isArray(l.spanIds)||l.spanIds.length===0||l.spanIds.some(u=>typeof u!="string"||u.length===0)||new Set(l.spanIds).size!==l.spanIds.length)r.push({path:`${s}.spanIds`,message:"Text span target ids must be unique non-empty strings",severity:"error"});else{let u=typeof i.shapeId=="string"?n.get(i.shapeId):void 0;if(!u)r.push({path:s,message:"Text span animation must target a canonical text shape",severity:"error"});else{l.spanIds.forEach((c,f)=>{u.has(c)||r.push({path:`${s}.spanIds[${f}]`,message:`Text span animation target "${c}" does not exist on shape "${i.shapeId}"`,severity:"error"})});let d=l.spanIds.map(c=>u.get(c));if(d.every(c=>c&&typeof c.start=="number"&&Number.isInteger(c.start)&&typeof c.end=="number"&&Number.isInteger(c.end))){let c=d[0].end;d.slice(1).every(f=>{let p=f;return p.start!==c?!1:(c=p.end,!0)})||r.push({path:`${s}.spanIds`,message:"Text span animation target ids must describe one ordered contiguous range",severity:"error"})}}}}}let o=new Set;i.keyframes.forEach((s,l)=>{let u=`animationTimeline.tracks[${a}].keyframes[${l}].id`;if(!de(s)||typeof s.id!="string"||!s.id){r.push({path:u,message:"Animation keyframe id must be a non-empty string",severity:"error"});return}if(o.has(s.id)){r.push({path:u,message:`Duplicate animation keyframe id: "${s.id}"`,severity:"error"});return}o.add(s.id)})})}},library:(e,{doc:t,errors:r,warnings:n})=>{if(!rr(e,"library",r))return;let i=new Set,a=oa(t);e.forEach((l,u)=>{let d=`library[${u}]`;if(!de(l)){r.push({path:d,message:"Library def must be a non-null object",severity:"error"});return}if(typeof l.id!="string"||l.id.length===0?r.push({path:`${d}.id`,message:"Library def id must be a non-empty string",severity:"error"}):i.has(l.id)?r.push({path:`${d}.id`,message:`Duplicate library def id: "${l.id}"`,severity:"error"}):i.add(l.id),(typeof l.kind!="string"||l.kind.length===0)&&r.push({path:`${d}.kind`,message:"Library def kind must be a non-empty string",severity:"error"}),l.definitionPlacement!==void 0&&!["defs","document"].includes(String(l.definitionPlacement))&&r.push({path:`${d}.definitionPlacement`,message:"Library definitionPlacement must be defs or document",severity:"error"}),Mo(l.definitionOrder,`${d}.definitionOrder`,r),Ao(l.definitionContainerId,`${d}.definitionContainerId`,r),js(l.authoredPlacement,`${d}.authoredPlacement`,r,a,"Library"),l.kind==="symbol"||l.kind==="marker"){let c=Lf(l.shapes);if(typeof l.id=="string"&&l.id.length>0&&c.add(l.id),BR(l.animations,`${d}.animations`,c,r),l.kind==="symbol"){let f=typeof t.schemaVersion=="number"&&t.schemaVersion>=8;if(l.defKind!==void 0&&!["symbol","group","shape"].includes(String(l.defKind))&&r.push({path:`${d}.defKind`,message:"Symbol defKind must be symbol, group, or shape",severity:"error"}),l.definitionPlacement==="document"&&(l.defKind??"symbol")!=="symbol"&&r.push({path:`${d}.definitionPlacement`,message:"Only symbol roots may use document definition placement",severity:"error"}),l.defKind==="shape"&&(!Array.isArray(l.shapes)||l.shapes.length!==1)&&r.push({path:`${d}.shapes`,message:"Native shape definitions must contain exactly one root shape",severity:"error"}),f)for(let p of["wrapperAttrs","groups","overflow"])l[p]!==void 0&&r.push({path:`${d}.${p}`,message:`Symbol ${p} is schema-v7 migration input only`,severity:"error"});for(let p of["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"])l[p]!==void 0&&typeof l[p]!="string"&&r.push({path:`${d}.${p}`,message:`Symbol ${p} must be a string when present`,severity:"error"});if(l.rootAttributes!==void 0)if(!de(l.rootAttributes))r.push({path:`${d}.rootAttributes`,message:"Symbol rootAttributes must be a plain object",severity:"error"});else for(let[p,h]of Object.entries(l.rootAttributes))f&&["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(p)&&r.push({path:`${d}.rootAttributes.${p}`,message:`Symbol ${p} must use its typed root field`,severity:"error"}),typeof h!="string"&&r.push({path:`${d}.rootAttributes.${p}`,message:"Symbol root attribute values must be strings",severity:"error"});if(l.definitionContentOrder!==void 0)if(!Array.isArray(l.definitionContentOrder))r.push({path:`${d}.definitionContentOrder`,message:"Symbol definitionContentOrder must be an array",severity:"error"});else{let p=new Set(Array.isArray(l.shapes)?l.shapes.filter(m=>de(m)).map(m=>m.id).filter(m=>typeof m=="string"&&m.length>0):[]),h=new Set;l.definitionContentOrder.forEach((m,g)=>{let v=`${d}.definitionContentOrder[${g}]`;if(!de(m)){r.push({path:v,message:"Definition content entry must be a plain object",severity:"error"});return}if(m.kind!=="shape"&&m.kind!=="definition"&&r.push({path:`${v}.kind`,message:"Definition content kind must be shape or definition",severity:"error"}),typeof m.id!="string"||m.id.length===0){r.push({path:`${v}.id`,message:"Definition content id must be a non-empty string",severity:"error"});return}let y=`${String(m.kind)}\0${m.id}`;h.has(y)&&r.push({path:v,message:`Duplicate definition content entry: ${String(m.kind)} "${m.id}"`,severity:"error"}),h.add(y),m.kind==="shape"&&!p.has(m.id)&&r.push({path:`${v}.id`,message:`Definition content shape "${m.id}" is not a root shape of this definition`,severity:"error"})})}}if(l.kind==="marker"){for(let f of["viewBox","preserveAspectRatio"])l[f]!==void 0&&typeof l[f]!="string"&&r.push({path:`${d}.${f}`,message:`Marker ${f} must be a string when present`,severity:"error"});if(l.authoredGeometry!==void 0)if(!de(l.authoredGeometry))r.push({path:`${d}.authoredGeometry`,message:"Marker authoredGeometry must be a plain object",severity:"error"});else for(let[f,p]of Object.entries(l.authoredGeometry))typeof p!="string"&&r.push({path:`${d}.authoredGeometry.${f}`,message:"Marker authored geometry declarations must be strings",severity:"error"});if(l.rootAttributes!==void 0)if(!de(l.rootAttributes))r.push({path:`${d}.rootAttributes`,message:"Marker rootAttributes must be a plain object",severity:"error"});else for(let[f,p]of Object.entries(l.rootAttributes))["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"].includes(f)&&r.push({path:`${d}.rootAttributes.${f}`,message:`Marker ${f} must use its typed root field`,severity:"error"}),typeof p!="string"&&r.push({path:`${d}.rootAttributes.${f}`,message:"Marker root attribute values must be strings",severity:"error"})}if(Array.isArray(l.shapes)){let f=new Set;l.shapes.forEach((p,h)=>{Bf(p,`${d}.shapes[${h}]`,r,n,f)})}if(l.kind==="symbol"&&de(l.variants))for(let[f,p]of Object.entries(l.variants)){if(!Array.isArray(p))continue;let h=new Set;p.forEach((m,g)=>{Bf(m,`${d}.variants[${f}][${g}]`,r,n,h)})}}(l.kind==="linear-gradient"||l.kind==="radial-gradient")&&qR(l.gradient,`${d}.gradient`,l.kind,r),l.kind==="pattern"&&YR(l.pattern,`${d}.pattern`,r),l.kind==="appearance-style"&&QR(l.layers,`${d}.layers`,r)});let o=new Map;e.forEach((l,u)=>{de(l)&&l.kind==="symbol"&&typeof l.id=="string"&&l.id.length>0&&o.set(l.id,{def:l,index:u})});let s=new Map;for(let[l,{def:u,index:d}]of o)Array.isArray(u.definitionContentOrder)&&u.definitionContentOrder.forEach((c,f)=>{if(!de(c)||c.kind!=="definition"||typeof c.id!="string")return;let p=`library[${d}].definitionContentOrder[${f}].id`;if(c.id===l){r.push({path:p,message:`Symbol definition "${l}" cannot contain itself`,severity:"error"});return}if(!o.has(c.id)){r.push({path:p,message:`Nested symbol definition "${c.id}" does not exist`,severity:"error"});return}let h=s.get(c.id);if(h&&h!==l){r.push({path:p,message:`Nested symbol definition "${c.id}" already belongs to "${h}"`,severity:"error"});return}s.set(c.id,l)});for(let l of o.keys()){let u=new Set,d=l;for(;d!==void 0;){if(u.has(d)){let c=o.get(l);r.push({path:`library[${c?.index??0}].definitionContentOrder`,message:`Symbol definition forest contains a cycle through "${d}"`,severity:"error"});break}u.add(d),d=s.get(d)}}},paintServerDefs:(e,{doc:t,errors:r})=>{if(!rr(e,"paintServerDefs",r))return;let n=new Set,i=oa(t);e.forEach((a,o)=>{eF(a,`paintServerDefs[${o}]`,r,n,i)})},colorGlyphLibrary:(e,{errors:t})=>{if(!de(e)){t.push({path:"colorGlyphLibrary",message:"colorGlyphLibrary must be a plain object",severity:"error"});return}e.version!==void 0&&!Number.isInteger(e.version)&&t.push({path:"colorGlyphLibrary.version",message:"colorGlyphLibrary.version must be an integer",severity:"error"}),e.entries!==void 0&&!Array.isArray(e.entries)&&t.push({path:"colorGlyphLibrary.entries",message:"colorGlyphLibrary.entries must be an array",severity:"error"})},exportItems:(e,{errors:t})=>{rr(e,"exportItems",t)&&e.forEach((r,n)=>{let i=`exportItems[${n}]`;if(!de(r)){t.push({path:i,message:"Export item must be a non-null object",severity:"error"});return}(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${i}.id`,message:"Export item id must be a non-empty string",severity:"error"}),typeof r.filename!="string"&&t.push({path:`${i}.filename`,message:"Export item filename must be a string",severity:"error"}),typeof r.format!="string"&&t.push({path:`${i}.format`,message:"Export item format must be a string",severity:"error"})})},unknownFields:(e,{errors:t})=>{de(e)||t.push({path:"unknownFields",message:"unknownFields must be a plain object (forward-compat quarantine bag)",severity:"error"})}};function Lf(e){let t=new Set;if(!Array.isArray(e))return t;for(let r of e)zi(r,{onShape:n=>{typeof n.id=="string"&&n.id.length>0&&t.add(n.id)}});return t}function q0(e){return e.startsWith("structural:")}function ZR(e,t,r,n,i,a){if(e===null||typeof e!="object"){r.push({path:t,message:"Scene tree entry must be a non-null object",severity:"error"});return}let o=e;typeof o.id!="string"||o.id.length===0?r.push({path:`${t}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(a.has(o.id)&&r.push({path:`${t}.id`,message:`Duplicate scene tree id: "${o.id}"`,severity:"error"}),a.add(o.id),!i.has(o.id)&&!q0(o.id)&&n.push({path:`${t}.id`,message:`Scene tree id "${o.id}" is not present in shapes`,severity:"warning"})),o.parentId!==null&&typeof o.parentId!="string"?r.push({path:`${t}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof o.parentId=="string"&&!i.has(o.parentId)&&!q0(o.parentId)&&n.push({path:`${t}.parentId`,message:`Scene tree parentId "${o.parentId}" is not present in shapes`,severity:"warning"}),(typeof o.index!="number"||!Number.isInteger(o.index)||o.index<0)&&r.push({path:`${t}.index`,message:"Scene tree index must be a non-negative integer",severity:"error"}),o.updatedAt!==void 0&&(typeof o.updatedAt!="number"||!Number.isFinite(o.updatedAt)||o.updatedAt<0)&&r.push({path:`${t}.updatedAt`,message:"Scene tree updatedAt must be a non-negative finite number",severity:"error"}),o.clientId!==void 0&&typeof o.clientId!="string"&&r.push({path:`${t}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var JR=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function js(e,t,r,n,i){if(e===void 0)return;if(!de(e)){r.push({path:t,message:`${i} authoredPlacement must be an object`,severity:"error"});return}let a=e.parentId,o=e.parentDefinitionId,s=e.siblingIndex,l=!0;if((typeof a!="string"||a.length===0)&&(r.push({path:`${t}.parentId`,message:"Definition placement parentId must be a non-empty string",severity:"error"}),l=!1),o!==void 0&&(typeof o!="string"||o.length===0)&&(r.push({path:`${t}.parentDefinitionId`,message:"Definition placement parentDefinitionId must be a non-empty string when present",severity:"error"}),l=!1),l){let u=n.resolve(e);u.kind==="missing"?r.push({path:o===void 0?`${t}.parentId`:`${t}.parentDefinitionId`,message:o===void 0?`Definition placement parentId "${String(a)}" does not exist`:`Definition placement parent "${String(a)}" does not exist in library definition "${String(o)}"`,severity:"error"}):u.kind==="ambiguous"&&r.push({path:`${t}.parentId`,message:`Definition placement parentId "${String(a)}" is ambiguous across library definitions: ${u.definitionIds.join(", ")}`,severity:"error"})}(typeof s!="number"||!Number.isInteger(s)||s<0)&&r.push({path:`${t}.siblingIndex`,message:"Definition placement siblingIndex must be a non-negative integer",severity:"error"})}function QR(e,t,r){if(!Array.isArray(e)){r.push({path:t,message:"Appearance style layers must be an array",severity:"error"});return}let n=new Set;e.forEach((i,a)=>{let o=`${t}[${a}]`;if(!de(i)){r.push({path:o,message:"Appearance style layer must be an object",severity:"error"});return}if(i.kind!=="fill"&&i.kind!=="stroke"&&r.push({path:`${o}.kind`,message:"Appearance style layer kind must be fill or stroke",severity:"error"}),typeof i.id!="string"||i.id.length===0){r.push({path:`${o}.id`,message:"Appearance style layer id must be a non-empty string",severity:"error"});return}n.has(i.id)?r.push({path:`${o}.id`,message:`Duplicate appearance style layer id: "${i.id}"`,severity:"error"}):n.add(i.id)})}function eF(e,t,r,n,i){if(e===null||typeof e!="object"){r.push({path:t,message:"Paint server def must be a non-null object",severity:"error"});return}let a=e;typeof a.id!="string"||a.id.length===0?r.push({path:`${t}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):n.has(a.id)?r.push({path:`${t}.id`,message:`Duplicate paint server def id: "${a.id}"`,severity:"error"}):n.add(a.id),a.sourceId!==void 0&&(typeof a.sourceId!="string"||a.sourceId.length===0)&&r.push({path:`${t}.sourceId`,message:"Paint server def sourceId must be a non-empty string when present",severity:"error"});let o=a.role===void 0?"resource":a.role;o!=="resource"&&o!=="referenced-fragment"&&r.push({path:`${t}.role`,message:"Paint server def role must be resource or referenced-fragment",severity:"error"}),typeof a.type=="string"&&(o==="resource"&&JR.has(a.type)||o==="referenced-fragment"&&/^[A-Za-z][\w.-]*$/u.test(a.type))||r.push({path:`${t}.type`,message:"Paint server def type must be a supported SVG defs element type",severity:"error"}),(typeof a.markup!="string"||a.markup.length===0)&&r.push({path:`${t}.markup`,message:"Paint server def markup must be a non-empty string",severity:"error"}),a.passthrough!==void 0&&typeof a.passthrough!="boolean"&&r.push({path:`${t}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"});for(let s of["definitionChildIds","sourceDefinitionChildIds"]){let l=a[s];l!==void 0&&(!Array.isArray(l)||l.some(u=>typeof u!="string"||u.length===0))&&r.push({path:`${t}.${s}`,message:"Definition child ids must be non-empty strings",severity:"error"})}Array.isArray(a.definitionChildIds)&&Array.isArray(a.sourceDefinitionChildIds)&&a.definitionChildIds.length!==a.sourceDefinitionChildIds.length&&r.push({path:t,message:"Definition child id arrays must have equal lengths",severity:"error"}),js(a.authoredPlacement,`${t}.authoredPlacement`,r,i,"Paint server def"),Mo(a.definitionOrder,`${t}.definitionOrder`,r),Ao(a.definitionContainerId,`${t}.definitionContainerId`,r)}function Bf(e,t,r,n,i){if(e===null||typeof e!="object"||Array.isArray(e)){r.push({path:t,message:"Shape must be a non-null object",severity:"error"});return}zi(e,{onShape:(a,o)=>{tF(a,`${t}${o}`,r,n,i)}})}function tF(e,t,r,n,i){if(typeof e.id!="string"||e.id.length===0?r.push({path:`${t}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(e.id)?r.push({path:`${t}.id`,message:`Duplicate shape id: "${e.id}"`,severity:"error"}):i.add(e.id),typeof e.type!="string"?r.push({path:`${t}.type`,message:"Shape type must be a string",severity:"error"}):FR().has(e.type)||n.push({path:`${t}.type`,message:`Unknown shape type: "${e.type}"`,severity:"warning"}),e.state===void 0||e.state===null||typeof e.state!="object")r.push({path:`${t}.state`,message:"Shape state must be a non-null object",severity:"error"});else{let a=e.state;nF(a,`${t}.state`,r,n),e.type==="foreign-object"&&(Object.hasOwn(a,"rawContent")&&r.push({path:`${t}.state.rawContent`,message:"rawContent is noncanonical; use structured foreignContent nodes",severity:"error"}),a.foreignContent!==void 0&&rr(a.foreignContent,`${t}.state.foreignContent`,r)&&a.foreignContent.forEach((o,s)=>Qw(o,`${t}.state.foreignContent[${s}]`,r))),a.children!==void 0&&!Array.isArray(a.children)?r.push({path:`${t}.state.children`,message:"children must be an array",severity:"error"}):Array.isArray(a.children)&&a.children.forEach((o,s)=>{(o===null||typeof o!="object"||Array.isArray(o))&&r.push({path:`${t}.state.children[${s}]`,message:"Shape must be a non-null object",severity:"error"})})}}var rF=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function Y0(e){return typeof e=="number"?isFinite(e):typeof e=="string"?rF.test(e):!1}function nF(e,t,r,n){if(Mo(e.definitionOrder,`${t}.definitionOrder`,r),Ao(e.definitionContainerId,`${t}.definitionContainerId`,r),de(e.metadata))for(let o of["linkUrl","linkTarget"])Object.hasOwn(e.metadata,o)&&r.push({path:`${t}.metadata.${o}`,message:`${o} is noncanonical; use a Hyperlink container shape`,severity:"error"});if((e.fillType==="linear-gradient"||e.fillType==="radial-gradient"||e.fillType==="pattern")&&e.fillColor==="none"&&e.fillOpacity===0&&r.push({path:`${t}.fillOpacity`,message:"Painted shapes cannot carry the noncanonical no-fill opacity encoding",severity:"error"}),e.charOffsets!==void 0&&e.charOffsets!==null&&(Array.isArray(e.charOffsets)?e.charOffsets.forEach((o,s)=>{let l=`${t}.charOffsets[${s}]`;if(!de(o)){r.push({path:l,message:"Each charOffsets entry must be a plain object",severity:"error"});return}for(let u of["x","y"]){let d=o[u];d!==null&&(typeof d!="number"||!Number.isFinite(d))&&r.push({path:`${l}.${u}`,message:`${u} must be null or a finite number`,severity:"error"})}for(let u of["dx","dy","rotate"]){let d=o[u];(typeof d!="number"||!Number.isFinite(d))&&r.push({path:`${l}.${u}`,message:`${u} must be a finite number`,severity:"error"})}if(o.raw!==void 0)if(!de(o.raw))r.push({path:`${l}.raw`,message:"raw must be a plain object",severity:"error"});else for(let[u,d]of Object.entries(o.raw))(!["x","y","dx","dy"].includes(u)||typeof d!="string")&&r.push({path:`${l}.raw.${u}`,message:"raw accepts only string x/y/dx/dy members",severity:"error"})}):r.push({path:`${t}.charOffsets`,message:"charOffsets must be an array",severity:"error"})),e.textPathReference!==void 0&&e.textPathReference!==null){let o=e.textPathReference;(!de(o)||o.kind!=="shape"&&o.kind!=="definition"||typeof o.targetId!="string"||o.targetId.length===0||o.element!=="href"&&o.element!=="mpath"||Object.keys(o).some(s=>!["kind","targetId","element"].includes(s)))&&r.push({path:`${t}.textPathReference`,message:"textPathReference requires an exact shape/definition target and href/mpath element",severity:"error"})}for(let o of["textPathRefShapeId","textPathImportRefId"])e[o]!==void 0&&r.push({path:`${t}.${o}`,message:`${o} is noncanonical; use textPathReference`,severity:"error"});if(e.authoredTextPosition!==void 0)if(!de(e.authoredTextPosition))r.push({path:`${t}.authoredTextPosition`,message:"authoredTextPosition must be a plain object",severity:"error"});else for(let[o,s]of Object.entries(e.authoredTextPosition)){let l=`${t}.authoredTextPosition.${o}`;if(!["x","y"].includes(o)||!de(s)){r.push({path:l,message:"Authored text position accepts only x/y coordinate objects",severity:"error"});continue}(typeof s.raw!="string"||s.raw.length===0||typeof s.resolved!="number"||!Number.isFinite(s.resolved))&&r.push({path:l,message:"Authored text coordinates require non-empty raw and finite resolved values",severity:"error"});for(let u of Object.keys(s))["raw","resolved"].includes(u)||r.push({path:`${l}.${u}`,message:"Authored text coordinates accept only raw/resolved members",severity:"error"})}if(e.textSpanTree!==void 0){let o=`${t}.textSpanTree`;if(!de(e.textSpanTree))r.push({path:o,message:"textSpanTree must be a plain object",severity:"error"});else{let s=e.textSpanTree,l=s.text,u=s.spans;if(typeof l!="string"||!Array.isArray(u))r.push({path:o,message:"Text span trees require text and spans",severity:"error"});else{let d=new Set,c=(f,p,h,m)=>{let g=p;f.forEach((v,y)=>{let b=`${m}[${y}]`,I=de(v)?v.start:void 0,x=de(v)?v.end:void 0,k=de(v)?v.children:void 0,$=de(v)?v.spanId:void 0,A=de(v)?v.id:void 0,S=de(v)?v.lineIndex:void 0,N=de(v)?v.rotate:void 0;!de(v)||typeof I!="number"||typeof x!="number"||!Number.isInteger(I)||!Number.isInteger(x)||I<g||x<I||I<p||x>h||!Array.isArray(k)||typeof $!="string"||$.length===0||d.has($)||A!==void 0&&(typeof A!="string"||A.length===0)||S!==void 0&&(typeof S!="number"||!Number.isInteger(S)||S<0)||N!==void 0&&(!Array.isArray(N)||N.length===0||N.some(T=>typeof T!="number"||!Number.isFinite(T)))||Object.keys(v).some(T=>!["spanId","start","end","id","lineIndex","rotate","children"].includes(T))?r.push({path:b,message:"Text span nodes require nested ordered ranges, child arrays, and valid optional identity/line fields",severity:"error"}):(d.add($),c(k,I,x,`${b}.children`),g=x)})};c(u,0,l.length,`${o}.spans`),s.rotate!==void 0&&(!Array.isArray(s.rotate)||s.rotate.length===0||s.rotate.some(f=>typeof f!="number"||!Number.isFinite(f)))&&r.push({path:`${o}.rotate`,message:"Text span root rotate must be a non-empty finite number list",severity:"error"});for(let f of Object.keys(s))["text","rotate","spans"].includes(f)||r.push({path:`${o}.${f}`,message:"Text span trees accept only text/spans members",severity:"error"})}}}if(e.authoredUseGeometry!==void 0)if(!de(e.authoredUseGeometry))r.push({path:`${t}.authoredUseGeometry`,message:"authoredUseGeometry must be a plain object",severity:"error"});else for(let[o,s]of Object.entries(e.authoredUseGeometry))(!["x","y","width","height"].includes(o)||typeof s!="string")&&r.push({path:`${t}.authoredUseGeometry.${o}`,message:"Authored use geometry accepts only string x/y/width/height members",severity:"error"});let i=["x","y","width","height","radius","rx","ry","fontSize"];for(let o of i)e[o]!==void 0&&!Y0(e[o])&&r.push({path:`${t}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"});for(let o of vb){let s=e[o];if(s!=null){if(o==="transformMatrix"){(!Array.isArray(s)||s.length<6||!s.slice(0,6).every(l=>typeof l=="number"&&Number.isFinite(l)))&&r.push({path:`${t}.${o}`,message:`${o} must be a 6-element finite affine matrix`,severity:"error"});continue}Y0(s)||r.push({path:`${t}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"})}}let a=["width","height","radius","fontSize"];for(let o of a){let s=e[o];typeof s=="number"&&s<=0&&n.push({path:`${t}.${o}`,message:`${o} should be positive (got ${s})`,severity:"warning"})}}function iF(e,t,r,n){if(e===null||typeof e!="object"){r.push({path:t,message:"Viewbox must be a non-null object",severity:"error"});return}let i=e;typeof i.id!="string"||i.id.length===0?r.push({path:`${t}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):n.has(i.id)?r.push({path:`${t}.id`,message:`Duplicate viewbox id: "${i.id}"`,severity:"error"}):n.add(i.id);for(let a of["x","y","width","height"])(typeof i[a]!="number"||!isFinite(i[a]))&&r.push({path:`${t}.${a}`,message:`${a} must be a finite number`,severity:"error"});typeof i.width=="number"&&i.width<=0&&r.push({path:`${t}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof i.height=="number"&&i.height<=0&&r.push({path:`${t}.height`,message:"Viewbox height must be positive",severity:"error"})}function aF(e,t,r){if(e===null||typeof e!="object"){r.push({path:t,message:"Guide must be a non-null object",severity:"error"});return}let n=e;(typeof n.id!="string"||n.id.length===0)&&r.push({path:`${t}.id`,message:"Guide id must be a non-empty string",severity:"error"}),n.orientation!=="horizontal"&&n.orientation!=="vertical"&&r.push({path:`${t}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof n.position!="number"||!isFinite(n.position))&&r.push({path:`${t}.position`,message:"Guide position must be a finite number",severity:"error"})}function oF(e,t,r,n,i,a){if(e===null||typeof e!="object"){r.push({path:t,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let o=e;(typeof o.id!="string"||o.id.length===0)&&r.push({path:`${t}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),o.type!=="clip"&&o.type!=="mask"&&r.push({path:`${t}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),o.definitionPlacement!==void 0&&o.definitionPlacement!=="defs"&&o.definitionPlacement!=="document"&&r.push({path:`${t}.definitionPlacement`,message:'definitionPlacement must be "defs" or "document"',severity:"error"}),o.referenceChannel!==void 0&&o.referenceChannel!=="attribute"&&o.referenceChannel!=="style"&&o.referenceChannel!=="stylesheet"&&r.push({path:`${t}.referenceChannel`,message:'referenceChannel must be "attribute", "style", or "stylesheet"',severity:"error"}),o.referenceStyleOrder!==void 0&&(typeof o.referenceStyleOrder!="number"||!Number.isInteger(o.referenceStyleOrder)||o.referenceStyleOrder<0)&&r.push({path:`${t}.referenceStyleOrder`,message:"referenceStyleOrder must be a non-negative integer",severity:"error"}),Mo(o.definitionOrder,`${t}.definitionOrder`,r),Ao(o.definitionContainerId,`${t}.definitionContainerId`,r),js(o.authoredPlacement,`${t}.authoredPlacement`,r,a,"Clip/mask");let s=o.clipShapeIds,l=typeof o.rawDefinition=="string"&&o.rawDefinition.length>0;s!==void 0&&!Array.isArray(s)?r.push({path:`${t}.clipShapeIds`,message:"clipShapeIds must be an array",severity:"error"}):s===void 0?r.push({path:`${t}.clipShapeIds`,message:"ClipMaskGroup must carry clipShapeIds",severity:"error"}):Array.isArray(s)&&s.length===0&&!l&&n.push({path:`${t}.clipShapeIds`,message:"ClipMaskGroup has no clip shapes and no rawDefinition; it will clip nothing",severity:"warning"}),Array.isArray(o.contentShapeIds)||r.push({path:`${t}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function Ch(e){let t=[...e].sort((i,a)=>i.index-a.index);if(!t.some(i=>i.orderKey))return t;let r=JM(t.length),n=new Map;return t.forEach((i,a)=>{n.set(i.id,i.orderKey??r[a])}),t.sort((i,a)=>{let o=xb(n.get(i.id)??"",n.get(a.id)??"");return o!==0?o:i.id<a.id?-1:i.id>a.id?1:0})}function Co(e){return e.definitionId??`${e.type}-${e.id}`}function eI(e){return e.rawDefinition!==void 0?!0:e.clipShapeIds.length===0}function tI(e){let t=eI(e);return e.type==="clip"?{type:"clip",...e.definitionPlacement!==void 0?{definitionPlacement:e.definitionPlacement}:{},...e.definitionOrder!==void 0?{definitionOrder:e.definitionOrder}:{},...e.definitionContainerId!==void 0?{definitionContainerId:e.definitionContainerId}:{},...e.authoredPlacement!==void 0?{authoredPlacement:structuredClone(e.authoredPlacement)}:{},...e.clipPathUnits!==void 0?{clipPathUnits:e.clipPathUnits}:{},...!t&&e.clipRule!==void 0?{clipRule:e.clipRule}:{},...t&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}:{type:"mask",...e.definitionPlacement!==void 0?{definitionPlacement:e.definitionPlacement}:{},...e.definitionOrder!==void 0?{definitionOrder:e.definitionOrder}:{},...e.definitionContainerId!==void 0?{definitionContainerId:e.definitionContainerId}:{},...e.authoredPlacement!==void 0?{authoredPlacement:structuredClone(e.authoredPlacement)}:{},...e.maskUnits!==void 0?{maskUnits:e.maskUnits}:{},...e.maskContentUnits!==void 0?{maskContentUnits:e.maskContentUnits}:{},...e.maskType!==void 0?{maskType:e.maskType}:{},...e.maskBounds!==void 0?{maskBounds:structuredClone(e.maskBounds)}:{},...t&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}}function sF(e,t,r){let{clipPathUnits:n,clipRule:i,maskUnits:a,maskContentUnits:o,maskType:s,maskBounds:l,definitionPlacement:u,definitionOrder:d,definitionContainerId:c,authoredPlacement:f,rawDefinition:p,...h}=structuredClone(e),m=t.rawDefinition!==void 0||eI(e);return e.type==="clip"?{...h,type:"clip",...t.definitionPlacement!==void 0?{definitionPlacement:t.definitionPlacement}:{},...t.definitionOrder!==void 0?{definitionOrder:t.definitionOrder}:{},...t.definitionContainerId!==void 0?{definitionContainerId:t.definitionContainerId}:{},...t.authoredPlacement!==void 0?{authoredPlacement:structuredClone(t.authoredPlacement)}:{},...t.clipPathUnits!==void 0?{clipPathUnits:t.clipPathUnits}:{},...!m&&t.clipRule!==void 0?{clipRule:t.clipRule}:{},...m&&r&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}:{...h,type:"mask",...t.definitionPlacement!==void 0?{definitionPlacement:t.definitionPlacement}:{},...t.definitionOrder!==void 0?{definitionOrder:t.definitionOrder}:{},...t.definitionContainerId!==void 0?{definitionContainerId:t.definitionContainerId}:{},...t.authoredPlacement!==void 0?{authoredPlacement:structuredClone(t.authoredPlacement)}:{},...t.maskUnits!==void 0?{maskUnits:t.maskUnits}:{},...t.maskContentUnits!==void 0?{maskContentUnits:t.maskContentUnits}:{},...t.maskType!==void 0?{maskType:t.maskType}:{},...t.maskBounds!==void 0?{maskBounds:structuredClone(t.maskBounds)}:{},...m&&r&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}}function rI(e){let t=new Map;for(let r of e??[]){let n=Co(r),i=tI(r),a=t.get(n);t.set(n,a?.type===i.type?{...a,...i}:i)}return t}function lF(e){let t=structuredClone(e??[]),r=rI(t),n=new Set;return t.map(i=>{let a=Co(i),o=r.get(a)??tI(i),s=o.rawDefinition!==void 0&&!n.has(a);return s&&n.add(a),sF(i,o,s)})}var uF=/^structural:(clip|mask):(.+):(group|path|content)$/;function K0(e,t){let r=`structural:${e}:${t}`;return{group:`${r}:group`,path:`${r}:path`,content:`${r}:content`}}function nI(e,t){for(let r of e){t.add(r.id);let n=r.state.children;Array.isArray(n)&&nI(n,t)}}function iI(e,t=null){let r=[];return e.forEach((n,i)=>{r.push({id:n.id,parentId:t,index:i});let a=n.state.children;Array.isArray(a)&&r.push(...iI(a,n.id))}),r}function aI(e){let t=e.sceneTree&&e.sceneTree.length>0?e.sceneTree:iI(e.shapes),r=new Map(t.map(x=>[x.id,x])),n=new Map;for(let x of t){let k=n.get(x.parentId)??[];k.push(x),n.set(x.parentId,k)}for(let[x,k]of n)n.set(x,Ch(k));let i=x=>uF.test(x),a=new Set(t.filter(x=>!i(x.id)).map(x=>x.id)),o=new Set;nI(e.shapes,o);let s=new Map,l=new Set,u=(x,k)=>{let $=[];for(let A of n.get(x)??[]){if(!i(A.id)){l.has(A.id)||(l.add(A.id),$.push(A.id));continue}if(k.has(A.id))continue;let S=new Set(k);S.add(A.id),$.push(...u(A.id,S))}return $},d=[null,...a];for(let x of d){let k=u(x,new Set);k.length>0&&s.set(x,k)}for(let x of a){if(l.has(x))continue;let k=r.get(x)?.parentId??null,$=k!==null&&a.has(k)?k:null,A=s.get($)??[];A.push(x),s.set($,A),l.add(x)}let c=x=>{for(let[k,$]of s){let A=$.indexOf(x);if(A>=0)return{parentId:k,index:A}}return null},f=x=>{for(let k of s.values()){let $=k.indexOf(x);$>=0&&k.splice($,1)}},p=e.clipMaskGroups??[],h=rI(p),m=new Set(p.filter(x=>x.clipShapeIds.some(k=>o.has(k))).map(x=>`${x.type}\0${Co(x)}`)),g=new Map(p.map(x=>[K0(x.type,x.id).content,x])),v=(x,k=new Set)=>{if(k.has(x.id))return Number.MAX_SAFE_INTEGER;let $=x.parentId?g.get(x.parentId):void 0;if(!$)return 0;let A=new Set(k);return A.add(x.id),1+v($,A)},y=[...p].sort((x,k)=>v(x)-v(k)||(x.siblingIndex??0)-(k.siblingIndex??0)),b=new Map;for(let x of y){let k=x.clipShapeIds.filter(V=>o.has(V)),$=x.contentShapeIds.filter(V=>o.has(V)),A=Co(x),S=h.get(A)?.rawDefinition!==void 0||m.has(`${x.type}\0${A}`);if($.length===0||!S)continue;let N=[...$,...k].map(c).filter(V=>V!==null),T=N[0]?.parentId??null,z=N.length>0?Math.min(...N.map(V=>V.index)):void 0,C=x.parentId===null||a.has(x.parentId)||g.has(x.parentId)?x.parentId:T;for(let V of[...k,...$])f(V);let O=K0(x.type,x.id),E=s.get(C)??[],_=x.siblingIndex??z??E.length,U=Math.min(Math.max(0,_),E.length);E.splice(U,0,O.group),s.set(C,E),s.set(O.group,[O.path,O.content]),s.set(O.path,[...k]),s.set(O.content,[...$]),b.set(O.group,{id:O.group,parentId:C,index:0}),b.set(O.path,{id:O.path,parentId:O.group,index:0}),b.set(O.content,{id:O.content,parentId:O.group,index:1})}let I=[];for(let[x,k]of s)k.forEach(($,A)=>{let S=b.get($);if(S){I.push({...S,parentId:x,index:A});return}let N=r.get($);N&&N.parentId===x?I.push({...N,index:A}):I.push({id:$,parentId:x,index:A})});e.sceneTree=I}function Zn(e){let t=[],r=new Map,n=new Set,i=new WeakSet,a=[...e].reverse();for(;a.length>0;){let s=a.pop();if(!s||typeof s!="object"||i.has(s))continue;i.add(s),t.push(s);let l=r.get(s.id);l&&l!==s?n.add(s.id):l||r.set(s.id,s);let u=s.state.children;if(Array.isArray(u))for(let d=u.length-1;d>=0;d--){let c=u[d];c&&typeof c=="object"&&typeof c.id=="string"&&a.push(c)}}let o=new Map(r);for(let s of n)o.delete(s);return{ordered:t,uniqueById:o,duplicateIds:n}}function oI(e){let t=[...e??[]],r=new Map;for(let a of t)r.set(a.id,(r.get(a.id)??0)+1);let n=new Set([...r].filter(([,a])=>a>1).map(([a])=>a)),i=new Map;for(let a of t)n.has(a.id)||i.set(a.id,a);return{ordered:t,uniqueById:i,duplicateIds:n,definition:a=>i.get(a),symbol:a=>{let o=i.get(a);return o?.kind==="symbol"?o:void 0}}}function dF(e){let t=e.groupData;if(!t||typeof t!="object"||Array.isArray(t))return null;let r=t.transform;return typeof r=="string"&&r.trim()?r:null}function Oh(e,t){let r=un(e,t);if(r)return{matrix:ri(e,t),attribute:r,owner:"canonical"};let n=dF(e);if(n){let i=wa(n),a=e.customPivot;return{matrix:a?Jp(a,i):i,attribute:n,owner:"group-data"}}return{matrix:Ot,attribute:null,owner:"none"}}function $n(e){let t=e.transformMatrix;return So(t)&&!fn(t)||e.customPivot||typeof e.rawTransform=="string"&&e.rawTransform?!1:(e.rotation??0)!==0||(e.skewX??0)!==0||(e.skewY??0)!==0||(e.scaleX??1)!==1||(e.scaleY??1)!==1}function sI(e,t){let r=t?{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}:void 0;return Oh(e,r)}var cF=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,fF=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)px$/i,pF=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)%$/;function Zs(e,t,r,n){let i=e.trim();if(cF.test(i))return Number(i);let a=fF.exec(i);if(a)return Number(a[1]);let o=pF.exec(i);if(o)return t.percentBasis===void 0?(n.push({code:"unresolved-symbol-viewport",message:`Symbol ${t.axis} percentage ${e} needs a containing viewport basis.`}),null):Number(o[1])/100*t.percentBasis;let s=r.resolveLength?.(e,t)??null;return s!==null&&Number.isFinite(s)?s:(n.push({code:"invalid-symbol-length",message:`Symbol ${t.axis} length ${e} is invalid or requires an unavailable length host.`}),null)}function hF(e){let t=e.state.authoredUseGeometry;return t&&typeof t=="object"?t:{}}function ia(e,t){let r=e[t];if(typeof r=="string")return r;if(["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(t))return;let n=e.rootAttributes?.[t];return typeof n=="string"?n:void 0}function mF(e,t){if(e===void 0)return;let r=Mn(e);return r?r.width<0||r.height<0?(t.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${e} has a non-finite or negative dimension and is ignored.`}),null):r:(t.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${e} is not four finite SVG numbers and is ignored.`}),null)}function Z0(e,t,r,n,i,a){return t===void 0?0:Zs(t,{axis:r,percentBasis:r==="x"?n?.width:n?.height},i,a)??0}function J0(e,t,r,n,i,a,o){let s=r==="width"?i?.width:i?.height,l=[n,ia(t,r)];for(let u of l){if(u===void 0||u.trim().toLowerCase()==="auto")continue;let d=Zs(u,{axis:r,percentBasis:s},a,o);if(d!==null){if(d<0){o.push({code:"invalid-symbol-length",message:`Negative symbol ${r} ${u} is invalid and falls back to auto.`});continue}return d}}return s!==void 0?s:(o.push({code:"unresolved-symbol-viewport",message:`Symbol ${r} is auto and needs a containing viewport basis.`}),null)}function Q0(e,t,r,n,i){if(e===void 0)return;let a=e.trim();if(t==="refX"){if(a==="left")return 0;if(a==="center")return(r?.width??0)/2;if(a==="right")return r?.width??0}else{if(a==="top")return 0;if(a==="center")return(r?.height??0)/2;if(a==="bottom")return r?.height??0}return Zs(e,{axis:t,percentBasis:t==="refX"?r?.width:r?.height},n,i)??void 0}function lI(e,t,r,n={}){let i=[],a=hF(e),o=Z0(e,a.x,"x",r,n,i),s=Z0(e,a.y,"y",r,n,i),l=Wt(o,s),u=ia(t,"transform"),d=u?wa(u):Ot;if((t.defKind??"symbol")!=="symbol")return{kind:"group",renders:!0,useX:o,useY:s,useAttributes:a,contentMatrix:je(l,d),childPercentBasis:r??null,viewport:null,diagnostics:i};let c=J0(e,t,"width",a.width,r,n,i),f=J0(e,t,"height",a.height,r,n,i),p=ia(t,"x"),h=ia(t,"y"),m=p!==void 0?Zs(p,{axis:"x",percentBasis:r?.width},n,i)??0:0,g=h!==void 0?Zs(h,{axis:"y",percentBasis:r?.height},n,i)??0:0,v=mF(t.viewBox,i),y=pp({width:c,height:f,...v?{viewBoxX:v.x,viewBoxY:v.y,viewBoxWidth:v.width,viewBoxHeight:v.height}:{},preserveAspectRatio:ia(t,"preserveAspectRatio")},r);for(let A of y.diagnostics)i.push({code:A.code==="unresolved-viewport-size"?"unresolved-symbol-viewport":"invalid-symbol-viewbox",message:A.message.replace("Nested SVG","Symbol")});if(c===null||f===null||!y.renders||!y.contentMatrix)return{kind:"symbol",renders:!1,useX:o,useY:s,useAttributes:a,contentMatrix:je(l,d),childPercentBasis:y.childPercentBasis,viewport:y,diagnostics:i};let b=Q0(ia(t,"refX"),"refX",y.childPercentBasis,n,i),I=Q0(ia(t,"refY"),"refY",y.childPercentBasis,n,i),x=zt(y.contentMatrix,{x:b??0,y:I??0}),k=Wt(m-(b===void 0?0:x.x),g-(I===void 0?0:x.y)),$=je(je(je(l,d),k),y.contentMatrix);return{kind:"symbol",renders:!0,useX:o,useY:s,useAttributes:a,contentMatrix:$,childPercentBasis:y.childPercentBasis,viewport:y,diagnostics:i}}function sd(){return{bounds:null,status:"empty",diagnostics:[]}}function Js(e,t,r){return r.resolveOwnTransform?.(e,t)??t}function ui(e,t){return{bounds:null,status:e,diagnostics:[t]}}function ld(e,t){return e?t?{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}:e:t}function ni(e,t,r="empty"){return e?{bounds:e,status:"resolved",diagnostics:t}:t.some(n=>n.code==="container-cycle"||n.code==="reference-cycle"||n.code==="symbol-cycle")?{bounds:null,status:"cycle",diagnostics:t}:t.some(n=>n.code==="unsupported-shape"||n.code==="deferred-tree-kind")?{bounds:null,status:"unsupported",diagnostics:t}:t.some(n=>n.code==="unresolved-shape"||n.code==="unresolved-reference-target"||n.code==="unresolved-reference-pivot"||n.code==="duplicate-shape-id"||n.code==="unresolved-svg-viewport"||n.code==="unresolved-symbol-definition"||n.code==="duplicate-library-id"||n.code==="unresolved-symbol-viewport"||n.code==="unresolved-symbol-pivot")?{bounds:null,status:"unresolved",diagnostics:t}:{bounds:null,status:r,diagnostics:t}}function Ap(e){if(e.length===0)return null;let t=e[0].x,r=e[0].y,n=e[0].x,i=e[0].y;for(let a=1;a<e.length;a++){let o=e[a];t=Math.min(t,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y)}return{minX:t,minY:r,maxX:n,maxY:i}}function uI(e,t){return Ap([zt(t,{x:e.minX,y:e.minY}),zt(t,{x:e.maxX,y:e.minY}),zt(t,{x:e.maxX,y:e.maxY}),zt(t,{x:e.minX,y:e.maxY})])}function ev(e,t,r,n,i){return r<0||n<0?null:uI({minX:e,minY:t,maxX:e+r,maxY:t+n},i)}function tv(e,t,r,n,i){if(r<0||n<0)return null;let a=zt(i,{x:e,y:t}),o=Math.hypot(i[0]*r,i[2]*n),s=Math.hypot(i[1]*r,i[3]*n);return{minX:a.x-o,minY:a.y-s,maxX:a.x+o,maxY:a.y+s}}function gF(e,t){let r=Array.isArray(e)?e:[e],n=null;for(let i of r)n=ld(n,uI(i,t));return n}function Vf(e,t,r){return ui("unsupported",{code:t,shapeId:e.id,message:`Object bounds for ${r} require a document resolver policy.`,path:[e.id]})}function rv(e,t,r={}){let n=Ia(e);if(!n)return ui("unsupported",{code:"unsupported-shape",shapeId:e.id,message:`No geometry kernel is registered for shape type ${e.type}.`,path:[e.id]});let i;switch(n.kind){case"circle":i=tv(n.cx,n.cy,n.r,n.r,t);break;case"ellipse":i=tv(n.cx,n.cy,n.rx,n.ry,t);break;case"rectangle":if(n.width<0||n.height<0)i=null;else if(n.pathData)i=vo(n.pathData,t);else if(n.rx>0&&n.ry>0){let a=Fx(n.x,n.y,n.width,n.height,n.rx,n.ry);i=a?vo(a,t):null}else i=ev(n.x,n.y,n.width,n.height,t);break;case"line":if(n.boundsPolicy==="linked-line")return Vf(e,"deferred-tree-kind","linked line");i=Ap([zt(t,{x:n.x1,y:n.y1}),zt(t,{x:n.x2,y:n.y2})]);break;case"text":{let a=r.measureText?.(e,n)??null;if(!a)return Vf(e,"deferred-tree-kind","text");i=gF(a,t);break}case"path":{if(n.boundsPolicy==="empty")return sd();let a=n.placement?je(t,Wt(n.placement.x,n.placement.y)):t;i=vo(n.d,a);break}case"polyline":{let a=n.points.length>0?n.points:[{x:0,y:0}];i=Ap(a.map(o=>zt(t,o)));break}case"positioning-rect":i=ev(n.x,n.y,n.width,n.height,t);break;case"view":return sd();case"container":case"embedded-svg":case"shape-reference":case"symbol-instance":return Vf(e,"deferred-tree-kind",n.kind)}return i?{bounds:i,status:"resolved",diagnostics:[]}:{bounds:null,status:"empty",diagnostics:[]}}function Cp(e){let t=e.state.children;return Array.isArray(t)?t.filter(r=>!!r&&typeof r=="object"&&typeof r.id=="string"):[]}function ma(e){let t=Zn(e.shapes),r=oI(e.library),n=e.sceneTree??[];if(n.length===0)return{roots:()=>e.shapes,shape:s=>t.uniqueById.get(s),duplicateShapeIds:()=>t.duplicateIds,libraryDefinition:s=>r.definition(s),duplicateLibraryIds:()=>r.duplicateIds,children:Cp};let i=new Map,a=new Set;for(let s of n){let l=i.get(s.parentId)??[];i.set(s.parentId,[...l,s]),t.uniqueById.has(s.id)&&a.add(s.id)}let o=s=>{let l=[],u=new Set,d=c=>{for(let f of Ch([...i.get(c)??[]])){let p=t.uniqueById.get(f.id);if(p){l.push(p);continue}u.has(f.id)||(u.add(f.id),d(f.id),u.delete(f.id))}};return d(s),l};return{roots:()=>[...o(null),...e.shapes.filter(s=>!a.has(s.id))],shape:s=>t.uniqueById.get(s),duplicateShapeIds:()=>t.duplicateIds,libraryDefinition:s=>r.definition(s),duplicateLibraryIds:()=>r.duplicateIds,children:s=>[...o(s.id),...Cp(s).filter(l=>!a.has(l.id))]}}function dI(e,t){return`${t.identityPrefixes.at(-1)??"document"}\0${e.id}`}var yF=new Set(["block","contents","flex","flow","flow-root","grid","inherit","initial","inline","inline-block","inline-flex","inline-grid","inline-table","list-item","none","revert","revert-layer","ruby","ruby-base","ruby-base-container","ruby-text","ruby-text-container","run-in","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","unset"]),Uf=new Set(["block","inline","run-in"]),vF=new Set(["flow","flow-root","table","flex","grid","ruby"]);function bF(e){let t=e.trim().toLowerCase();if(yF.has(t)||/^(?:var|env)\(/.test(t)&&t.endsWith(")"))return!0;let r=t.split(/\s+/);if(r.length<2||r.length>3||new Set(r).size!==r.length)return!1;if(r.includes("list-item")){let n=r.filter(i=>i!=="list-item");return n.filter(i=>Uf.has(i)).length<=1&&n.filter(i=>i==="flow"||i==="flow-root").length<=1&&n.every(i=>Uf.has(i)||i==="flow"||i==="flow-root")}return r.length===2&&r.some(n=>Uf.has(n))&&r.some(n=>vF.has(n))}function xF(e){if(!e)return null;let t=null;for(let r of da(e,";")){let n=da(r,":");if(n.length<2||n[0].trim().toLowerCase()!=="display")continue;let i=n.slice(1).join(":").trim(),a=/\s*!important\s*$/i.test(i),o=i.replace(/\s*!important\s*$/i,"").trim().toLowerCase();bF(o)&&(!t||a||!t.important)&&(t={value:o,important:a})}return t}function cI(e,t){let r=xF(typeof t=="string"?t:void 0);return r?r.value!=="none":typeof e!="string"||e.trim().toLowerCase()!=="none"}function Ud(e,t){if(e.state.visible===!1)return!1;let r=e.type==="symbol-instance"||e.type==="shape-reference"?e.state.instancePresentation:void 0,n=r?.display??e.state.display;return cI(n,r?.style)?t.participatesInRendering?.(e)??!0:!1}function fI(e,t,r){let n=e.rootAttributes;return cI(n?.display,n?.style)?r.participatesSymbolDefinition?.(e,t)??!0:!1}function wF(e,t={}){return{x:e.x,y:e.y,width:t.width!==void 0?t.width:e.width,height:t.height!==void 0?t.height:e.height,viewBoxX:e.viewBoxX,viewBoxY:e.viewBoxY,viewBoxWidth:e.viewBoxWidth,viewBoxHeight:e.viewBoxHeight,preserveAspectRatio:e.preserveAspectRatio}}function Th(e,t,r={}){let n=Ia(e);if(!n||n.kind!=="embedded-svg")return{matrix:Ot,attribute:null,pivotRequired:!1,pivotResolved:!1,viewport:pp({})};let i=pp(wF(n,r),t),a=$n(e.state),o=i.frame?{x:i.frame.x+i.frame.width/2,y:i.frame.y+i.frame.height/2}:void 0;return{matrix:ri(e.state,o),attribute:un(e.state,o),pivotRequired:a,pivotResolved:!a||o!==void 0,viewport:i}}function IF(e,t,r){return t.diagnostics.map(n=>({code:n.code==="unresolved-viewport-size"?"unresolved-svg-viewport":"invalid-svg-viewport",shapeId:e.id,message:n.message,path:[...r,e.id]}))}function ud(e,t,r,n){let i=null,a=[],o=r.forceInlineChildren>0?Cp(e):r.view.children(e);for(let s of o){if(!Ud(s,r.host))continue;let l=dl(s,t,r,n);i=ld(i,l.bounds),a.push(...l.diagnostics)}return ni(i,a)}function pI(e,t){return{...e,diagnostics:e.diagnostics.map(r=>r.path.includes(t)?r:{...r,path:[t,...r.path]})}}function kF(e,t,r,n,i={}){let a=Th(e,n,i),o=IF(e,a.viewport,r.path);if(a.pivotRequired&&!a.pivotResolved)return o.push({code:"unresolved-svg-viewport",shapeId:e.id,message:`Embedded SVG ${e.id} has decomposed rotation/scale/skew channels, but its auto viewport frame cannot be resolved without a parent viewport.`,path:[...r.path,e.id]}),ni(null,o,"unresolved");if(!a.viewport.renders)return ni(null,o,a.viewport.status==="zero-disabled"?"empty":"unresolved");let s=dI(e,r);r.active.add(s),r.path.push(e.id);let l=e.state.isRootSvg===!0?t:je(je(t,Js(e,a.matrix,r.host)),a.viewport.contentMatrix??Ot),u=ud(e,l,r,a.viewport.childPercentBasis??n);return r.path.pop(),r.active.delete(s),ni(u.bounds,[...o,...u.diagnostics],u.status)}function hI(e,t,r){let n=r.view.duplicateShapeIds?.().has(t)??!1;return ui("unresolved",{code:n?"duplicate-shape-id":"unresolved-reference-target",shapeId:e.id,message:n?`Shape reference ${e.id} targets ambiguous duplicate id ${t}.`:t?`Shape reference ${e.id} targets ${t}, which is not present in the document.`:`Shape reference ${e.id} has no targetShapeId.`,path:t?[...r.path,t]:[...r.path]})}function SF(e,t){let r=[...t.path,e.id];return ui("cycle",{code:"reference-cycle",shapeId:e.id,message:`Shape reference cycle detected: ${r.join(" -> ")}.`,path:r})}function mI(e,t,r,n,i){if(!$n(e.state))return{matrix:ri(e.state),attribute:un(e.state),pivotRequired:!1,pivotResolved:!0,diagnostics:[],contentBounds:null};let a=Wt(t.offsetX,t.offsetY),o={width:t.width,height:t.height},s=pI(dl(r,a,n,i,o),e.id),l=s.diagnostics.some(d=>d.code==="unsupported-shape"||d.code==="deferred-tree-kind"||d.code==="unresolved-reference-pivot"),u=s.bounds&&!l?{x:(s.bounds.minX+s.bounds.maxX)/2,y:(s.bounds.minY+s.bounds.maxY)/2}:null;if(!u){let d=s.bounds===null&&(s.status==="empty"||s.status==="cycle"||s.status==="unresolved"),c={code:"unresolved-reference-pivot",shapeId:e.id,message:`Shape reference ${e.id} has decomposed rotation/scale/skew channels, but its translated target bounds require unavailable contextual geometry or measurement.`,path:[...n.path]};return{matrix:ri(e.state),attribute:un(e.state),pivotRequired:!0,pivotResolved:d,diagnostics:d?s.diagnostics:[...s.diagnostics,c],contentBounds:s}}return{matrix:ri(e.state,u),attribute:un(e.state,u),pivotRequired:!0,pivotResolved:!0,diagnostics:[],contentBounds:s}}function $F(e,t,r,n,i){if(n.activeReferences.has(e.id))return SF(e,n);n.activeReferences.add(e.id),n.path.push(e.id);let a=c=>(n.path.pop(),n.activeReferences.delete(e.id),c),o=t.targetShapeId?.trim()??"",s=o?n.view.shape(o):void 0;if(!s)return a(hI(e,o,n));if(!Ud(s,n.host))return a(sd());let l=mI(e,t,s,n,i);if(l.pivotRequired&&!l.pivotResolved)return a(ni(null,[...l.diagnostics],"unresolved"));if(l.contentBounds?.bounds===null&&l.pivotResolved)return a(l.contentBounds);let u=je(je(r,Js(e,l.matrix,n.host)),Wt(t.offsetX,t.offsetY)),d=pI(dl(s,u,n,i,{width:t.width,height:t.height}),e.id);return a({...d,diagnostics:[...l.diagnostics,...d.diagnostics]})}function lo(e,t){let r=e.state.instancePresentation?.transform,n=typeof r=="string"&&r.trim()?r.trim():null,i=ri(e.state,t),a=un(e.state,t);return n?{matrix:je(wa(n),i),attribute:a?`${n} ${a}`:n}:{matrix:i,attribute:a}}function la(e,t,r,n){return{code:r,shapeId:e.id,message:n,path:[...t.path,e.id]}}function gI(e,t,r,n,i,a){let o=null,s=[];for(let l of r){if(!Ud(l,i.host))continue;let u=dl(l,n,i,a);o=ld(o,u.bounds),s.push(...u.diagnostics)}for(let l of t.definitionContentOrder??[]){if(l.kind!=="definition")continue;let u=i.view.libraryDefinition?.(l.id);if(!u||u.kind!=="symbol"){s.push(la(e,i,"unresolved-symbol-definition",`Nested definition ${l.id} is missing from ${t.id}.`));continue}if((u.defKind??"symbol")==="symbol"||!fI(u,e,i.host))continue;let d=`definition-forest\0${u.id}`;if(i.activeSymbols.has(d)){s.push(la(e,i,"symbol-cycle",`Nested definition forest cycle detected through ${u.id}.`));continue}i.activeSymbols.add(d),i.path.push(u.id);let c=u.rootAttributes?.transform,f=c?je(n,wa(c)):n,p=gI(e,u,u.shapes,f,i,a);i.path.pop(),i.activeSymbols.delete(d),o=ld(o,p.bounds),s.push(...p.diagnostics)}return ni(o,s)}function yI(e,t,r,n,i,a=!1){let o=Yb(t,e),s=lI(e,t,i,{resolveLength:n.host.resolveSymbolLength}),l=[...o.diagnostics.map(m=>la(e,n,m.code,m.message)),...s.diagnostics.map(m=>la(e,n,m.code==="invalid-symbol-length"||m.code==="invalid-symbol-viewbox"?"invalid-symbol-viewport":"unresolved-symbol-viewport",m.message))];if(!s.renders){let m=s.viewport?.status==="zero-disabled";return{...ni(null,l,m?"empty":"unresolved"),transform:{...lo(e),pivotRequired:$n(e.state),pivotResolved:!0,diagnostics:l}}}if(!fI(t,e,n.host))return{...sd(),transform:{...lo(e),pivotRequired:$n(e.state),pivotResolved:!0,diagnostics:l}};if(n.activeSymbols.has(o.materializationKey)){let m=la(e,n,"symbol-cycle",`Symbol instance cycle detected through ${t.id}.`);return{...ui("cycle",m),transform:{...lo(e),pivotRequired:$n(e.state),pivotResolved:!0,diagnostics:[m]}}}n.activeSymbols.add(o.materializationKey),n.identityPrefixes.push(o.materializationKey),n.forceInlineChildren++,n.path.push(e.id);let u=m=>gI(e,t,o.shapes,m,n,s.childPercentBasis??i),d=$n(e.state),c=lo(e),f=!d,p=[];if(d){let m=u(s.contentMatrix),g=m.diagnostics.some(y=>y.code==="unsupported-shape"||y.code==="deferred-tree-kind"||y.code==="unresolved-symbol-viewport"),v=m.bounds&&!g?{x:(m.bounds.minX+m.bounds.maxX)/2,y:(m.bounds.minY+m.bounds.maxY)/2}:void 0;if(v)c=lo(e,v),f=!0;else{let y=m.bounds===null&&(m.status==="empty"||m.status==="cycle"||m.status==="unresolved");f=y,y||(p=[la(e,n,"unresolved-symbol-pivot",`Symbol instance ${e.id} needs unavailable contextual geometry or measurement for its decomposed transform pivot.`)]),y&&!a&&(p=[...m.diagnostics])}}let h;if(d&&!f)h=ni(null,[...l,...p],"unresolved");else{let m=je(je(r,Js(e,c.matrix,n.host)),s.contentMatrix),g=u(m);h=ni(g.bounds,[...l,...p,...g.diagnostics],g.status)}return n.path.pop(),n.forceInlineChildren--,n.identityPrefixes.pop(),n.activeSymbols.delete(o.materializationKey),{...h,transform:{...c,pivotRequired:d,pivotResolved:f,diagnostics:[...l,...p]}}}function NF(e,t,r,n){let i=String(e.state.symbolId??"").trim(),a=i?r.view.duplicateLibraryIds?.().has(i)??!1:!1,o=i?r.view.libraryDefinition?.(i):void 0;if(a||!o||o.kind!=="symbol")return ui("unresolved",la(e,r,a?"duplicate-library-id":"unresolved-symbol-definition",a?`Symbol instance ${e.id} targets duplicate library id ${i}.`:`Symbol instance ${e.id} targets missing symbol definition ${i||"(blank)"}.`));let s=yI(e,o,t,r,n),{transform:l,...u}=s;return u}function dl(e,t,r,n,i={}){let a=dI(e,r);if(r.active.has(a)){if(!r.collectDiagnostics)return{bounds:null,status:"cycle",diagnostics:[]};let u=[...r.path,e.id];return ui("cycle",{code:"container-cycle",shapeId:e.id,message:`Container cycle detected: ${u.join(" -> ")}.`,path:u})}let o=Ia(e);if(!o)return rv(e,t,r.host);if(o.kind==="shape-reference")return $F(e,o,t,r,n);if(o.kind==="embedded-svg")return kF(e,t,r,n,i);if(o.kind==="symbol-instance")return NF(e,t,r,n);if(o.kind!=="container"){let u=ri(e.state,o.defaultPivot??void 0);return rv(e,je(t,Js(e,u,r.host)),r.host)}r.active.add(a),r.path.push(e.id);let s=Oh(e.state).matrix;if($n(e.state)){let u=r.collectDiagnostics;r.collectDiagnostics=!1;let d=ud(e,Ot,r,n);r.collectDiagnostics=u;let c=d.diagnostics.some(f=>f.code==="unsupported-shape"||f.code==="deferred-tree-kind");s=sI(e.state,c?null:d.bounds).matrix}let l=ud(e,je(t,Js(e,s,r.host)),r,n);return r.path.pop(),r.active.delete(a),l}function Ph(e,t,r={},n={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let a=typeof t=="string"?t:t.id;return ui("unresolved",{code:"unresolved-shape",shapeId:a,message:`Shape ${a} is not present in the document bounds view.`,path:[a]})}return dl(i,r.toTarget??Ot,{view:e,host:n,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},r.parentViewport)}function Dh(e,t,r={},n={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let o=typeof t=="string"?t:t.id;return ui("unresolved",{code:"unresolved-shape",shapeId:o,message:`Shape ${o} is not present in the document bounds view.`,path:[o]})}let a={...n,resolveOwnTransform:(o,s)=>o===i?Ot:n.resolveOwnTransform?.(o,s)??s};return Ph(e,i,{parentViewport:r.parentViewport},a)}function MF(e,t,r={},n){let i=Ia(t);if(!i||i.kind!=="shape-reference")return{matrix:Ot,attribute:null,pivotRequired:!1,pivotResolved:!1,diagnostics:[]};let a={view:e,host:r,active:new Set,activeReferences:new Set([t.id]),activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[t.id],collectDiagnostics:!0},o=i.targetShapeId?.trim()??"",s=o?e.shape(o):void 0;if(!s||!Ud(s,r)){let u=$n(t.state);return{matrix:ri(t.state),attribute:un(t.state),pivotRequired:u,pivotResolved:!0,diagnostics:s?[]:hI(t,o,a).diagnostics}}let l=mI(t,i,s,a,n);return{matrix:l.matrix,attribute:l.attribute,pivotRequired:l.pivotRequired,pivotResolved:l.pivotResolved,diagnostics:l.diagnostics}}function AF(e,t,r={},n){let i=$n(t.state),a=String(t.state.symbolId??"").trim(),o=a?e.duplicateLibraryIds?.().has(a)??!1:!1,s=a?e.libraryDefinition?.(a):void 0;return o||!s||s.kind!=="symbol"?{...lo(t),pivotRequired:i,pivotResolved:!0,diagnostics:[]}:yI(t,s,Ot,{view:e,host:r,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},n,!0).transform}function CF(e,t={}){if(!$n(e.state))return{transform:Oh(e.state),contentBounds:null,pivotRequired:!1,pivotResolved:!0};let r={view:ma({shapes:[e],viewboxes:[]}),host:t,active:new Set([`document\0${e.id}`]),activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[e.id],collectDiagnostics:!0},n=ud(e,Ot,r),i=n.diagnostics.some(a=>a.code==="unsupported-shape"||a.code==="deferred-tree-kind")?null:n.bounds;return{transform:sI(e.state,i),contentBounds:n,pivotRequired:!0,pivotResolved:i!==null||n.status==="empty"}}function OF(e,t=e.id){return{kind:"pattern",id:t,name:e.name??t,pattern:{type:"pattern",svgContent:e.svgContent,width:e.width,height:e.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function TF(){let e=new Set(BM);for(let t of VM)e.add(t);for(let t of Le.typeIds())for(let r of Object.keys(Le.getDefaults(t)))e.add(r);return e.delete("scaleAnchor"),e.delete("extra"),e}var PF=TF();function vI(e){let t=e.extra&&typeof e.extra=="object"&&!Array.isArray(e.extra)?e.extra:void 0;for(let r of Object.keys(e)){if(r==="extra"||PF.has(r))continue;let n=e[r];delete e[r],n!==void 0&&((t??={})[r]=n)}return t&&Object.keys(t).length>0?e.extra=t:delete e.extra,e}function DF(e){return zi(e,{onState:t=>{vI(t)}}),e}function Op(e){return typeof e=="string"&&e.length>0?e:null}function jF(e){let t=Op(e.groupId);if(t)return t;let r=e.extra;return!r||typeof r!="object"||Array.isArray(r)?null:Op(r.groupId)}function bI(e){delete e.groupId;let t=e.extra;if(!t||typeof t!="object"||Array.isArray(t))return;let r=t;delete r.groupId,Object.keys(r).length===0&&delete e.extra}function EF(e){let t={};return e.transformOrigin&&(t.transformOrigin=e.transformOrigin),e.pluginId&&(t.pluginId=e.pluginId),e.pluginData&&(t.pluginData=e.pluginData),e.attributes&&Object.keys(e.attributes).length>0&&(t.attributes=e.attributes),e.fill&&(t.fill=e.fill),e.fillOpacity&&(t.fillOpacity=e.fillOpacity),e.strokeOpacity&&(t.strokeOpacity=e.strokeOpacity),e.opacity&&(t.opacity=e.opacity),e.filter&&(t.filter=e.filter),e.cssFilter&&(t.cssFilter=e.cssFilter),e.mixBlendMode&&(t.mixBlendMode=e.mixBlendMode),e.isolation&&(t.isolation=e.isolation),e.clipPath&&(t.clipPath=e.clipPath),e.mask&&(t.mask=e.mask),e.rawMetadata&&(t.rawMetadata=e.rawMetadata),e.transform&&(t.transform=e.transform),t}function zF(e){let t=EF(e),r={fillColor:null,borderColor:null,rotation:0,skewX:0,skewY:0,customPivot:null};return Object.keys(t).length>0&&(r.groupData=t),{id:e.id,type:"group",state:r}}function xI(e,t){let r=e.state.children;if(Array.isArray(r))for(let n of r)t.add(n.id),xI(n,t)}function wI(e,t=!1){let r=e.state,n=r.children;return t&&bI(r),Array.isArray(n)&&(r.children=n.map(i=>wI(i,!0))),e}function _F(e){if(e.length<2)return e.map(o=>o.shape);let t=e.filter(o=>o.shape.type==="group"&&o.siblingIndex!==void 0&&Number.isFinite(o.siblingIndex)).sort((o,s)=>(o.siblingIndex??0)-(s.siblingIndex??0));if(t.length===0)return[...e].sort((o,s)=>o.flatOrder-s.flatOrder).map(o=>o.shape);let r=Array(e.length).fill(null),n=new Set(t);for(let o of t){let s=Math.max(0,Math.min(e.length-1,o.siblingIndex??0));for(;s<r.length&&r[s]!==null;)s++;if(s>=r.length)for(s=r.length-1;s>=0&&r[s]!==null;)s--;s>=0&&(r[s]=o)}let i=e.filter(o=>!n.has(o)).sort((o,s)=>o.flatOrder-s.flatOrder),a=0;for(let o of i){for(;a<r.length&&r[a]!==null;)a++;a<r.length&&(r[a]=o)}return r.filter(o=>o!==null).map(o=>o.shape)}function dd(e,t=[]){let r=structuredClone(e),n=structuredClone(t),i=new Map;for(let g of n)i.set(g.id,g);let a=r.map(g=>wI(g)),o=new Set;for(let g of a)xI(g,o);let s=new Map,l=new Map;a.forEach((g,v)=>{o.has(g.id)||l.has(g.id)||(s.set(g.id,v),l.set(g.id,g))});for(let g of n){if(o.has(g.id)||l.has(g.id))continue;let v=zF(g);s.set(v.id,Number.POSITIVE_INFINITY),l.set(v.id,v)}let u=new Map,d=new Map;for(let g of l.values()){let v=g.state,y=i.get(g.id),b=jF(v)??(g.type==="group"?Op(y?.parentId):null),I=u.get(b)??[];d.set(g.id,b),I.push({shape:g,flatOrder:s.get(g.id)??Number.POSITIVE_INFINITY,siblingIndex:g.type==="group"?y?.siblingIndex:void 0}),u.set(b,I)}let c=new Set,f=g=>{if(c.has(g.id))return null;c.add(g.id);let v=g.state,y=Array.isArray(v.children)?v.children:[],b=p(g.id),I=new Set(y.map(k=>k.id)),x=[...y,...b.filter(k=>!I.has(k.id))];return x.length>0?v.children=x:delete v.children,bI(v),g},p=g=>{let v=[];for(let y of _F(u.get(g)??[])){let b=f(y);b&&v.push(b)}return v},h=p(null),m=g=>{if(!g)return;let v=f(g);v&&h.push(v)};for(let g of l.values()){let v=d.get(g.id);v&&!l.has(v)&&m(g)}for(let g of n)m(l.get(g.id));for(let g of l.values())m(g);return h}var II="data-svgsketch-passthrough",RF=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]),FF=/^<([A-Za-z][\w:-]*)\b[^>]*>/;function kI(e){return FF.exec(e.trimStart())}function SI(e){let t=kI(e);if(!t)return null;let r=/\bid\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(t[0]);return r?r[1]??r[2]:null}function LF(e){let t=kI(e);if(!t)return null;let r=t[1],n=r.lastIndexOf(":");return n>=0?r.slice(n+1):r}var BF=new RegExp(`\\s+${II}\\s*=\\s*(?:"[^"]*"|'[^']*')`);function VF(e){let t=e.markup.indexOf(">");if(t<0)return e;let r=e.markup.slice(0,t+1),n=BF.exec(r);if(!n)return e;let i=r.slice(0,n.index)+r.slice(n.index+n[0].length);return{...e,markup:i+e.markup.slice(t+1),passthrough:!0}}function UF(e){let t=[];for(let r of e){if(typeof r!="string")continue;let n=SI(r);if(!n)continue;let i=LF(r),a=i&&RF.has(i)?i:"mask";t.push(VF({id:n,type:a,markup:r}))}return t}var GF=[["splinePoints","pathPoints"],["splineClosed","pathClosed"],["splineCurveType","pathCurveType"],["splineTension","pathTension"],["splineArcParams","pathArcParams"],["splineControlBounds","pathControlBounds"]];function XF(e){let t=!1;if(e.type==="spline"&&(e.type="path",t=!0),e.state&&typeof e.state=="object"){let r=e.state,n=r.extra&&typeof r.extra=="object"&&!Array.isArray(r.extra)?r.extra:null;for(let[i,a]of GF)Object.prototype.hasOwnProperty.call(r,i)&&(Object.prototype.hasOwnProperty.call(r,a)||(r[a]=r[i]),Reflect.deleteProperty(r,i),t=!0),n&&Object.prototype.hasOwnProperty.call(n,i)&&(Object.prototype.hasOwnProperty.call(r,a)||(r[a]=n[i]),delete n[i],t=!0);n&&Object.keys(n).length===0&&delete r.extra}return t}function WF(e){return ir(e,{onShape:t=>{XF(t)}}),e}function HF(e){if(e.type!=="connector")return;let t=e.state,r=Es(t.sourcePoint),n=Es(t.targetPoint);e.type="line",e.state={...e.state,x1:typeof t.x1=="number"?t.x1:r?.x??0,y1:typeof t.y1=="number"?t.y1:r?.y??0,x2:typeof t.x2=="number"?t.x2:n?.x??0,y2:typeof t.y2=="number"?t.y2:n?.y??0,routingMode:t.routingMode??"orthogonal"}}function $I(e){let t=e.customPivot;if(t)return t;let r=e.x,n=e.y,i=e.width,a=e.height;if(typeof r=="number"&&typeof n=="number"&&typeof i=="number"&&typeof a=="number")return{x:r+i/2,y:n+a/2};let o=e.radius;if(typeof r=="number"&&typeof n=="number"&&typeof o=="number")return{x:r,y:n};let s=e.cx,l=e.cy;if(typeof s=="number"&&typeof l=="number")return{x:s,y:l};let u=e.x1,d=e.y1,c=e.x2,f=e.y2;if(typeof u=="number"&&typeof d=="number"&&typeof c=="number"&&typeof f=="number")return{x:(u+c)/2,y:(d+f)/2};let p=e.pathPoints;if(p?.[0])return{x:p[0].x,y:p[0].y};let h=e.polylinePoints;if(h?.[0])return{x:h[0].x,y:h[0].y}}function qF(e){return ir(e,{onShape:t=>{let r=t.state;!r||typeof r!="object"||fC(r,$I(r))}}),e.schemaVersion=3,e}function Es(e){let t=e;return t&&typeof t.x=="number"&&Number.isFinite(t.x)&&typeof t.y=="number"&&Number.isFinite(t.y)?{x:t.x,y:t.y}:null}function YF(e,t){let r=e.translateX??0,n=e.translateY??0,i=typeof e.rawTransform=="string"?e.rawTransform:"",a=Wt(r,n);if(i)return cn(je(a,wa(i)));let o=e.rotation??0,s=e.skewX??0,l=e.skewY??0;if(o!==0||s!==0||l!==0){let c=Es(e.customPivot)??t??Es(e.scaleAnchor);c&&(a=je(a,Wt(c.x,c.y)),o!==0&&(a=je(a,qu(o))),s!==0&&(a=je(a,Kp(s))),l!==0&&(a=je(a,Zp(l))),a=je(a,Wt(-c.x,-c.y)))}let u=e.scaleX??1,d=e.scaleY??1;if(u!==1||d!==1){let c=Es(e.scaleAnchor)??t;c&&(a=je(a,Wt(c.x,c.y)),a=je(a,Md(u,d)),a=je(a,Wt(-c.x,-c.y)))}return cn(a)}function KF(e){return ir(e,{onShape:t=>{let r=t.state;!r||typeof r!="object"||!("scaleAnchor"in r)||(t.type==="text"&&!So(r.transformMatrix)&&(r.transformMatrix=YF(r,$I(r))),delete r.scaleAnchor)}}),e.schemaVersion=4,e}function ZF(e){let t=e,r=Array.isArray(e.library)?[...e.library]:[],n=new Set(r.map(u=>u.id));if(Array.isArray(t.symbols))for(let u of t.symbols)!u||n.has(u.id)||(r.push({...u,kind:"symbol"}),n.add(u.id));if(Array.isArray(t.markers))for(let u of t.markers)!u||n.has(u.id)||(r.push({...u,kind:"marker"}),n.add(u.id));let i=new Map,a=(u,d)=>{let{id:c,sourceId:f,...p}=u,h=JSON.stringify({kind:d,...p}),m=i.get(h);if(m)return m;let g=n.has(u.id)?`grd-${Nu()}`:u.id;n.add(g),i.set(h,g);let v=d==="linear-gradient"?{kind:"linear-gradient",id:g,name:u.sourceId??g,sourceId:u.sourceId,gradient:nv(u)}:{kind:"radial-gradient",id:g,name:u.sourceId??g,sourceId:u.sourceId,gradient:nv(u)};return r.push(v),g},o=new Map;if(Array.isArray(t.customPatterns))for(let u of t.customPatterns){if(!u)continue;let d=n.has(u.id)?`pat-${Nu()}`:u.id;n.add(d),o.set(u.id,d),r.push(OF(u,d))}let s=u=>{if(u.customPatternId){let y=o.get(u.customPatternId);if(y)return y}let{id:d,sourceId:c,customPatternId:f,...p}=u,h=JSON.stringify({kind:"pattern",...p}),m=i.get(h);if(m)return m;let g=n.has(u.id)?`pat-${Nu()}`:u.id;n.add(g),i.set(h,g);let v={kind:"pattern",id:g,name:u.sourceId??g,sourceId:u.sourceId,pattern:p};return r.push(v),g};for(let u of e.shapes??[]){let d=u.state;if(!d)continue;let c=d.fillGradient;c&&(typeof d.fillType!="string"&&(d.fillType=c.type),c.type==="linear-gradient"||c.type==="radial-gradient"?d.fillLibraryId=a(c,c.type):c.type==="pattern"&&(d.fillLibraryId=s(c)));let f=d.strokeGradient;f&&(typeof d.strokeType!="string"&&(d.strokeType=f.type),f.type==="linear-gradient"||f.type==="radial-gradient"?d.strokeLibraryId=a(f,f.type):f.type==="pattern"&&(d.strokeLibraryId=s(f)));let p=d.filters;if(Array.isArray(p)&&p.length>0){let h=l(p,d,u.id);d.filterLibraryIds=[h]}}return e.library=r,ir(e,{onShape:HF}),delete t.customPatterns,delete t.symbols,delete t.markers,e;function l(u,d,c){let f={filters:u,colorInterpolation:d.filterColorInterpolation,filterUnits:d.filterUnits,primitiveUnits:d.primitiveUnits,x:d.filterX,y:d.filterY,width:d.filterWidth,height:d.filterHeight},p=JSON.stringify({kind:"filter",...f}),h=i.get(p);if(h)return h;let m=`filter-${c}`,g=n.has(m)?`flt-${Nu()}`:m;n.add(g),i.set(p,g);let v={kind:"filter",id:g,name:g,filters:f.filters,...f.colorInterpolation?{colorInterpolation:f.colorInterpolation}:{},...f.filterUnits?{filterUnits:f.filterUnits}:{},...f.primitiveUnits?{primitiveUnits:f.primitiveUnits}:{},...f.x!==void 0?{x:f.x}:{},...f.y!==void 0?{y:f.y}:{},...f.width!==void 0?{width:f.width}:{},...f.height!==void 0?{height:f.height}:{}};return r.push(v),g}}function nv(e){let{id:t,sourceId:r,...n}=e;return n}var Gf=0;function Nu(){return Gf=Gf+1&65535,`${Date.now().toString(36)}-${Gf.toString(36)}`}function JF(e){return ir(e,{onState:t=>{let r=t,n=Object.prototype.hasOwnProperty.call(r,"richTextData"),i=r.richTextData;if(vI(t),!n)return;r.richTextData=i;let a=t.extra;a&&(delete a.richTextData,Object.keys(a).length===0&&delete t.extra)}}),e.schemaVersion=5,e}function QF(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.richTextRuns!==void 0&&t.richTextRuns!==null)return;let r=t.richTextData;!r||typeof r!="object"||Array.isArray(r)||Array.isArray(r.lines)&&(t.richTextRuns=ch(r))}function eL(e){return ir(e,{onState:t=>QF(t)}),e.schemaVersion=6,e}function Tp(e,t){if(!t.has(e))return e;let r=2;for(;t.has(`${e}-${r}`);)r++;return`${e}-${r}`}function NI(e){let t=new Set,r=new Set,n=new Map;ir(e,{onShape:a=>{if(r.add(a.id),a.type!=="view")return;n.has(a.id)||n.set(a.id,a);let o=a.state.viewName;typeof o=="string"&&o&&t.add(o)}});let i=[];return(e.viewboxes??[]).filter(a=>{let o=n.get(a.id);return!(o&&o.state.viewBoxX===a.x&&o.state.viewBoxY===a.y&&o.state.viewBoxWidth===Math.max(1,a.width)&&o.state.viewBoxHeight===Math.max(1,a.height))}).forEach((a,o)=>{let s=Tp(`view-${o+1}`,t);t.add(s);let l=Tp(a.id||`legacy-view-${o+1}`,r);r.add(l),i.push({id:l,type:"view",state:{viewBoxX:a.x,viewBoxY:a.y,viewBoxWidth:Math.max(1,a.width),viewBoxHeight:Math.max(1,a.height),viewName:s}})}),i.length>0&&e.shapes.unshift(...i),e.viewboxes=[],e}var tL=["svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","svgPreserveAspectRatio"];function rL(e){if(e.type!=="svg"||e.state.isRootSvg===!0)return;let t=e.state;if([t.svgViewBoxX,t.svgViewBoxY,t.svgViewBoxWidth,t.svgViewBoxHeight].every(r=>r===0)){if(t.svgX===0&&t.svgY===0&&t.svgWidth===0&&t.svgHeight===0&&t.svgPreserveAspectRatio===""){for(let r of tL)delete t[r];return}delete t.svgViewBoxX,delete t.svgViewBoxY,delete t.svgViewBoxWidth,delete t.svgViewBoxHeight}}function nL(e){return ir(e,{onShape:rL}),NI(e),e.schemaVersion=7,e}var iL=["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"];function aL(e,t){if(e.type!=="symbol-instance"||e.state.authoredUseGeometry!==void 0)return;let r={};for(let n of["x","y","width","height"]){if((n==="width"||n==="height")&&t.has(String(e.state.symbolId??"")))continue;let i=e.state[n];typeof i=="number"&&Number.isFinite(i)&&(r[n]=String(i))}Object.keys(r).length>0&&(e.state.authoredUseGeometry=r)}function oL(e){let t=new Set((e.library??[]).filter(r=>r.kind==="symbol"&&r.defKind==="group").map(r=>r.id));for(let r of e.library??[]){if(r.kind!=="symbol")continue;let n=r,i={...n.wrapperAttrs??{},...n.rootAttributes??{}};for(let o of iL){let s=i[o];n[o]===void 0&&s!==void 0&&(n[o]=s),delete i[o]}if(n.overflow!==void 0&&i.overflow===void 0&&(i.overflow=n.overflow),Object.keys(i).length>0?n.rootAttributes=i:delete n.rootAttributes,n.shapes=dd(n.shapes,n.groups),n.variants)for(let[o,s]of Object.entries(n.variants))n.variants[o]=dd(s,n.groups);let a=n;delete a.wrapperAttrs,delete a.groups,delete a.overflow}return ir(e,{onShape:r=>aL(r,t)}),e.schemaVersion=8,e}function sL(e){let t=e;Array.isArray(e.shapes)&&(e.shapes=dd(e.shapes,t.groups)),delete t.groups,Array.isArray(t.rawPaintServerDefs)&&!Array.isArray(e.paintServerDefs)&&(e.paintServerDefs=UF(t.rawPaintServerDefs)),delete t.rawPaintServerDefs;for(let r of e.library??[]){if(r.kind!=="marker")continue;let n=r;n.shapes=dd(n.shapes,n.groups),delete n.groups}return Array.isArray(t.clipMaskGroups)&&(e.clipMaskGroups=t.clipMaskGroups.map(r=>{let n=r,i=Array.isArray(n.clipShapeIds)?n.clipShapeIds:typeof n.clipShapeId=="string"&&n.clipShapeId.length>0?[n.clipShapeId]:[],a={...n,clipShapeIds:i};return delete a.clipShapeId,a})),e.schemaVersion=9,e}function lL(e){return ir(e,{onState:t=>{let r=t;r.richTextRuns===void 0&&r.richTextData!==null&&typeof r.richTextData=="object"&&Array.isArray(r.richTextData.lines)&&(r.richTextRuns=ch(r.richTextData)),delete r.richTextData}}),e.schemaVersion=10,e}function uL(e){let t=(Array.isArray(e)?e.slice(0,6).join(" "):String(e)).trim().toLowerCase();return t==="none"||t==="hidden"||t==="collapse"?"none":"inline"}function iv(e){let t=new Set(e.keyframes.flatMap(r=>r.id?[r.id]:[]));if(e.keyframes.forEach((r,n)=>{if(r.id)return;let i=`kf${n}`;for(;t.has(i);)i=`${i}x`;r.id=i,t.add(i)}),e.property==="visibility"&&e.sourceSmilAttribute==="display"){e.property="display";for(let r of e.keyframes)r.value=uL(r.value)}delete e.sourceSmilAttribute}function dL(e){if(!Array.isArray(e.shapes))return;let t=new Map,r=new Map,n=new Map,i=(o,s)=>{let l=s?r:t,u=l.get(o.id)??[];u.push(o),l.set(o.id,u),n.set(o.id,(n.get(o.id)??0)+1);let d=o.state.children;Array.isArray(d)&&d.forEach(c=>i(c,!0))};e.shapes.forEach(o=>i(o,!1));let a=new Set;for(let[o,s]of t)s.length!==1||n.get(o)!==2||(r.get(o)??[]).length===1&&a.add(o);e.shapes=e.shapes.filter(o=>!a.has(o.id))}function cL(e){if(!Array.isArray(e.shapes))return;ir(e,{onShape:s=>{if(s.type!=="view")return;let l=s.state;Reflect.deleteProperty(l,"viewLinkedSvgId"),typeof l.extra=="object"&&l.extra!==null&&!Array.isArray(l.extra)&&Reflect.deleteProperty(l.extra,"viewLinkedSvgId")}});let t=e.shapes.filter(s=>{if(s.type!=="view")return!1;let l=s.state;return l.isHomeView===!0||typeof l.extra=="object"&&l.extra!==null&&!Array.isArray(l.extra)&&l.extra.isHomeView===!0});if(t.length===0)return;let r=t[0].state,n=Number(r.viewBoxWidth??0),i=Number(r.viewBoxHeight??0),a=e.shapes.find(s=>s.type==="svg"&&s.state.isRootSvg===!0);if(a&&n>0&&i>0){let s=Number(a.state.svgViewBoxWidth??0),l=Number(a.state.svgViewBoxHeight??0);s>0&&l>0||(a.state.svgViewBoxX=Number(r.viewBoxX??0),a.state.svgViewBoxY=Number(r.viewBoxY??0),a.state.svgViewBoxWidth=n,a.state.svgViewBoxHeight=i,Number(a.state.svgWidth??0)>0||(a.state.svgWidth=n),Number(a.state.svgHeight??0)>0||(a.state.svgHeight=i))}let o=new Set(t.map(s=>s.id));e.shapes=e.shapes.filter(s=>!o.has(s.id)),e.sceneTree=e.sceneTree?.filter(s=>!o.has(s.id))}function fL(e){if(!Array.isArray(e.shapes))return;let t=new Set;ir(e,{onShape:i=>{typeof i.id=="string"&&t.add(i.id)}});let r=new Map,n=i=>i.map(a=>{let o=a.state.children;Array.isArray(o)&&(a.state.children=n(o));let s=a.state.metadata;if(!s||typeof s!="object"||Array.isArray(s))return a;let l=typeof s.linkUrl=="string"?s.linkUrl:"",u=typeof s.linkTarget=="string"?s.linkTarget:"";if(!Object.hasOwn(s,"linkUrl")&&!Object.hasOwn(s,"linkTarget"))return a;let{linkUrl:d,linkTarget:c,...f}=s;if(a.state.metadata=f,!l||a.type==="hyperlink")return a;let p=Tp(`${a.id}-link`,t);return t.add(p),r.set(a.id,p),{id:p,type:"hyperlink",state:{href:l,...u?{linkTarget:u}:{},children:[a]}}});e.shapes=n(e.shapes);for(let i of e.library??[])if(!(i.kind!=="symbol"&&i.kind!=="marker")&&(i.shapes=n(i.shapes),i.kind==="symbol"&&i.variants))for(let[a,o]of Object.entries(i.variants))i.variants[a]=n(o);if(e.sceneTree&&r.size>0){let i=[];for(let a of e.sceneTree){let o=r.get(a.id);if(!o){i.push(a);continue}i.push({...a,id:o}),i.push({id:a.id,parentId:o,index:0})}e.sceneTree=i}}function pL(e){ir(e,{onState:t=>{(t.fillType==="linear-gradient"||t.fillType==="radial-gradient"||t.fillType==="pattern")&&t.fillColor==="none"&&t.fillOpacity===0&&(t.fillOpacity=1)}})}function hL(e){ir(e,{onState:t=>{Array.isArray(t.charOffsets)&&(t.charOffsets=t.charOffsets.map(r=>{if(!r||typeof r!="object"||"dx"in r||typeof r.x!="number")return r;let n=r;return{x:null,y:null,dx:n.x,dy:typeof n.y=="number"&&Number.isFinite(n.y)?n.y:0,rotate:typeof n.rotate=="number"&&Number.isFinite(n.rotate)?n.rotate:0}}))}})}function mL(e){ir(e,{onShape:t=>{if(t.type!=="group")return;let r=t.state,n=r.groupData;if(!n||typeof n!="object"||Array.isArray(n))return;let i=n,a=i.attributes;if(a&&typeof a=="object"&&!Array.isArray(a)){let o={...a};r.locked===void 0&&o["data-locked"]==="true"&&(r.locked=!0),r.visible===void 0&&o["data-hidden"]==="true"&&(r.visible=!1),delete o["data-locked"],delete o["data-hidden"],Object.keys(o).length>0?i.attributes=o:delete i.attributes}Array.isArray(i.classes)&&(i.classes=i.classes.map(o=>{let s=String(o);return s.startsWith("usr-")?s.slice(4):s}))}})}function gL(e){let t=WF(e);NI(t),cL(t),dL(t),fL(t),pL(t),hL(t),mL(t);for(let r of t.animationTimeline?.tracks??[])iv(r);for(let r of t.library??[])if(!(r.kind!=="marker"&&r.kind!=="symbol"))for(let n of r.animations??[])iv(n);return t.schemaVersion=11,t}function yL(e){return e.schemaVersion=12,e}function vL(e){return e.schemaVersion=13,e}function bL(e){return e.schemaVersion=14,e}function xL(e){return ir(e,{onState:t=>{let r=t,n=r.authoredTextStructure;if(r.textSpanTree===void 0&&n&&typeof n.text=="string"&&Array.isArray(n.spans)){let i=n.spans.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];let o=a;return typeof o.start=="number"&&typeof o.end=="number"&&typeof o.id=="string"?[{start:o.start,end:o.end,id:o.id,children:[]}]:[]});i.length===n.spans.length&&(r.textSpanTree={text:n.text,spans:i})}delete r.authoredTextStructure}}),e.schemaVersion=15,e}function wL(e){return e.schemaVersion=16,e}function IL(e){for(let t of e.documentStyles??[]){let r=t;r.placement??="root"}return e.schemaVersion=17,e}function kL(e){return e.schemaVersion=18,e}function SL(e){return ir(e,{onState:t=>{let r=t;r.textPathReference===void 0&&typeof r.textPathRefShapeId=="string"&&r.textPathRefShapeId.length>0&&(r.textPathReference={kind:"shape",targetId:r.textPathRefShapeId,element:"href"}),delete r.textPathRefShapeId,delete r.textPathImportRefId}}),e.schemaVersion=19,e}function $L(e){return e.schemaVersion=20,e}function NL(e){return e.schemaVersion=21,e}function ML(e){let t=new Map,r=(n,i,a)=>{let o=n.textSpanTree;if(!o||typeof o!="object"||Array.isArray(o))return;let s=o.spans;if(!Array.isArray(s))return;let l=new Map,u=(d,c=[])=>{d.forEach((f,p)=>{if(!f||typeof f!="object"||Array.isArray(f))return;let h=f,m=[...c,p],g=typeof h.spanId=="string"&&h.spanId.length>0?h.spanId:`text-span:${i}:${m.join(".")}`;h.spanId=g,l.set(m.join("."),g),Array.isArray(h.children)&&u(h.children,m)})};u(s),a&&t.set(a,l)};return ir(e,{onShape:(n,i)=>r(n.state,n.id||i,n.id),onState:(n,i)=>r(n,i)}),e.animationTimeline&&(e.animationTimeline.tracks=e.animationTimeline.tracks.filter(n=>{let i=n.textSpanTarget;if(!i||Array.isArray(i.spanIds))return!0;let a=Array.isArray(i.path)?i.path:[],o=a.every(l=>Number.isInteger(l)&&Number(l)>=0)?a.join("."):"",s=o?t.get(n.shapeId)?.get(o):void 0;return s?(i.spanIds=[s],delete i.path,!0):!1})),e.schemaVersion=22,e}function AL(e){let t=oa(e),r=n=>{let i=n.authoredPlacement;if(!i||i.parentDefinitionId!==void 0)return;let a=t.resolve(i);a.kind==="library"&&(i.parentDefinitionId=a.definitionId)};for(let n of e.library??[])r(n);for(let n of e.paintServerDefs??[])r(n);for(let n of e.clipMaskGroups??[])r(n);return e.schemaVersion=23,e}function CL(e){return e.schemaVersion=24,e}function OL(e){return e.schemaVersion=25,e}function TL(e){return ir(e,{onShape(t){if(t.type!=="foreign-object")return;let r=t.state,n=r.rawContent;if(typeof n!="string")return;let i=Td(`<svg xmlns="${ye}"><foreignObject>${n}</foreignObject></svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value,a=i?.index.children(i.root.sourceNodeId).find(o=>o.localName.toLowerCase()==="foreignobject");r.foreignContent=a?structuredClone(Vw(a.children)):n.length===0?[]:[{kind:"text",value:n}],delete r.rawContent}}),e.schemaVersion=26,e}function PL(e){let t=typeof e.shapeId=="string"?e.shapeId:"";if(t.startsWith("__dom__")&&t.length>7)return t.slice(7);let r=typeof e.domTargetSelector=="string"?e.domTargetSelector:"",n=/\[id\s*=\s*(["'])(.*?)\1\]/u.exec(r);return n?.[2]?n[2]:/^#([A-Za-z_][\w:.-]*)$/u.exec(r.trim())?.[1]??null}function av(e,t){return e?Td(`<svg xmlns="${ye}">${e}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value?.nodes.some(r=>r.kind==="element"&&r.attributes.some(n=>n.namespaceUri===null&&n.localName==="id"&&n.value===t))??!1:!1}function DL(e,t){for(let r of e.clipMaskGroups??[]){let n=r.definitionId??`${r.type}-${r.id}`;if(n===t)return{definitionId:n};if(av(r.rawDefinition,t))return{definitionId:n,nodeId:t}}for(let r of e.paintServerDefs??[]){if(r.id===t)return{definitionId:r.id};if(av(r.markup,t))return{definitionId:r.id,nodeId:t}}for(let r of e.library??[]){if(r.id===t||r.sourceId===t)return{definitionId:r.id};if(r.kind==="filter")for(let n of r.filters){if(n.type!=="svg-primitive-chain")continue;let i=n.primitives.find(a=>a.id===t);if(i)return{definitionId:r.id,nodeId:i.id}}}return{definitionId:t}}function jL(e){let t=typeof e.property=="string"?e.property:"";if(t==="domTransformStack")return"targetTransformStack";if(t==="domDisplay")return"targetDisplay";if(t==="domVisibility")return"targetVisibility";if(t!=="domAttribute")return t;let r=typeof e.domAttribute=="string"?e.domAttribute:"",n=r.toLowerCase();return new Map([["class","className"],["fill","fillColor"],["stroke","strokeColor"],["preserveaspectratio","svgPreserveAspectRatio"],["xlink:href","referenceTargetShapeId"],["href","referenceTargetShapeId"],["clippathunits","clipPathUnits"],["spreadmethod","spreadMethod"]]).get(n)??r}function EL(e){let t=e.animationTimeline;for(let r of t?.tracks??[]){let n=r,i=PL(n);if(!i)continue;let a=DL(e,i);n.definitionTarget=a,n.shapeId=Id(a),n.property=jL(n),typeof n.domAttribute=="string"&&(n.targetAttribute=n.domAttribute),typeof n.domAttributeValueType=="string"&&(n.targetAttributeValueType=n.domAttributeValueType),delete n.domTargetSelector,delete n.domTargetIdGenerated,delete n.domAttribute,delete n.domAttributeValueType}return e.schemaVersion=27,e}function zL(e){return e.schemaVersion=28,e}function _L(e){let t=e.clipMaskGroups;if(!Array.isArray(t)||t.length===0)return e.schemaVersion=29,e;let r=new Set;for(let a of e.shapes)zi(a,{onShape:o=>r.add(o.id)});let n=new Set;for(let a of t){let o=typeof a.rawDefinition=="string"&&a.rawDefinition.length>0,s=a.clipShapeIds.some(l=>r.has(l));(o||s)&&n.add(`${a.type}\0${Co(a)}`)}let i=t.filter(a=>n.has(`${a.type}\0${Co(a)}`));return i.length!==t.length&&(e.clipMaskGroups=lF(i),aI(e)),e.schemaVersion=29,e}var RL=Object.freeze({1:ZF,2:qF,3:KF,4:JF,5:eL,6:nL,7:oL,8:sL,9:lL,10:gL,11:yL,12:vL,13:bL,14:xL,15:wL,16:IL,17:kL,18:SL,19:$L,20:NL,21:ML,22:AL,23:CL,24:OL,25:TL,26:EL,27:zL,28:_L});function FL(e){let t=e.schemaVersion;return typeof t!="number"||!Number.isFinite(t)||t<1?1:Math.floor(t)}function LL(e,t=RL){let r=JSON.parse(JSON.stringify(e)),n=FL(r);if(n>In)return r;if(n===In)return r.schemaVersion=In,r;for(;n<In;){let i=t[n];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${n} \u2192 ${n+1}. Cannot safely upgrade this document to version ${In}.`);r=i(r),n+=1}return r.schemaVersion=In,r}var ge=e=>({mode:"supported",by:e}),ki=e=>({mode:"diagnostic",signal:"warning",by:e}),Te=e=>({mode:"outside-contract",reason:e}),Gt=e=>e,ov=Te("DXF is a static CAD geometry contract and has no representation for this SVG behavior."),sv=Te("Mermaid is a static graph-structure contract and has no representation for this SVG behavior."),lv=Te("PDF export produces a static page from the current editor SVG projection and does not promise animation playback."),p7={"unknown-shape-diagnostic":Gt({renderToSvg:ki("renderShape reports UNSUPPORTED_SHAPE_TYPE through renderToSvgWithDiagnostics"),codegen:ki("buildRenderPlan carries UNSUPPORTED_SHAPE_TYPE into generateCodeWithDiagnostics"),dxf:ki("DxfExportStats records unsupported types and the DXF export UI reports them"),mermaid:ki("exportMermaidWithDiagnostics records unsupported nodes and both Mermaid UIs report them"),pdf:Te("PDF conversion consumes an already-projected editor SVG; unknown model nodes never enter its input."),"editor-dom":Te("Unknown nodes are preserved for round-trip but require a registered shape implementation for projection.")}),"symbol-variants-overrides":Gt({renderToSvg:ge("buildRenderPlan materializes symbol variants and per-instance overrides before emission"),codegen:ge("every component backend consumes buildRenderPlan symbol materialization"),dxf:ki("DXF unsupported-shape accounting reports symbol instances without a lowering"),mermaid:ki("Mermaid node-skip diagnostics report symbol instances without a lowering"),pdf:ge("the editor projects SymbolInstance content into the SVG consumed by svg2pdf"),"editor-dom":ge("SymbolInstance projects resolved library variants and overrides")}),"smil-timeline":Gt({renderToSvg:ge("buildRenderPlan injects renderAnimationElements output into target and document-root markup"),codegen:ge("component backends preserve SMIL elements in planned target and document-root markup"),dxf:ov,mermaid:sv,pdf:lv,"editor-dom":ge("AnimationManager and the shared SMIL kernel project live playback")}),"motion-only-partition":Gt({renderToSvg:ge("buildRenderPlan diverts motionOnly templates into defs outside visible paint"),codegen:ge("component backends consume the render plan visible and motion-def partitions"),dxf:ov,mermaid:sv,pdf:lv,"editor-dom":Te("The authoring DOM retains motion templates for editing instead of applying export partitioning.")}),"paint-server-references":Gt({renderToSvg:ge("plan defs and shapes use one library-first paint-server reference resolver"),codegen:ge("buildShapeAttrs and plan defs use the library-first reference resolver"),dxf:Te("DXF promises geometry and basic entity colors, not SVG paint-server definition graphs."),mermaid:Te("Mermaid graph syntax has no SVG gradient or pattern paint-server model."),pdf:ge("the cloned SVG carries paint-server definitions and references into svg2pdf"),"editor-dom":ge("GradientManager maintains live defs matching shape paint references")}),"filter-references":Gt({renderToSvg:ge("renderFilterDefs and filterReferenceValue emit matching identifiers"),codegen:ge("planned filter defs and buildShapeAttrs share filter reference resolution"),dxf:Te("DXF entity geometry has no SVG filter graph or filter-reference representation."),mermaid:Te("Mermaid graph syntax has no SVG filter graph or filter-reference representation."),pdf:ge("the cloned SVG carries filter definitions and references into svg2pdf"),"editor-dom":ge("FilterManager maintains live filter definitions and shape references")}),"document-definition-context":Gt({renderToSvg:ge("buildRenderPlan consumes the full snapshot definition and style context"),codegen:ge("component codegen accepts snapshot context and clipboard supplies its definitions"),dxf:Te("DXF consumes resolved shapes and does not serialize SVG document definition sections."),mermaid:Te("Mermaid consumes graph nodes and does not serialize SVG definition sections."),pdf:ge("PDF receives a cloned SVG document with its referenced definition context"),"editor-dom":ge("the document aggregate and managers project referenced resources into defs")}),"inline-child-containers":Gt({renderToSvg:ge("renderShape recursively renders INLINE_CHILD_CONTAINER_TYPES children"),codegen:ge("component backends preserve recursively rendered plan container markup"),dxf:ge("DXF walks INLINE_CHILD_CONTAINER_TYPES with transforms and cycle guards"),mermaid:ki("unsupported container nodes are counted by exportMermaidWithDiagnostics"),pdf:ge("the cloned editor SVG preserves nested containers for svg2pdf"),"editor-dom":ge("registered containers project managed children into nested SVG elements")}),"isolated-flowchart-nodes":Gt({renderToSvg:Te("Isolated-node declarations are a Mermaid graph concern, not an SVG branch."),codegen:Te("Isolated-node declarations are a Mermaid graph concern, not component SVG output."),dxf:Te("DXF emits geometry independently and has no connector-enrolment requirement."),mermaid:ge("exportMermaid declares mapped nodes before emitting connector edges"),pdf:Te("PDF paints SVG geometry independently and has no graph-node declaration requirement."),"editor-dom":Te("The live SVG projects shapes independently and has no graph-node declaration requirement.")}),"text-path":Gt({renderToSvg:ge("renderText emits textPath markup and its referenced path definition"),codegen:ge("component backends preserve planned textPath markup and definitions"),dxf:Te("DXF text entities do not reproduce SVG textPath layout along arbitrary paths."),mermaid:Te("Mermaid labels do not reproduce SVG textPath layout along arbitrary paths."),pdf:ki("ExportPanel.generatePdfBlob detects textPath content and shows its localized warning"),"editor-dom":ge("Text projects textPath attributes and maintains its referenced path")}),"common-presentation":Gt({renderToSvg:ge("commonAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),codegen:ge("buildShapeAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),dxf:Te("DXF is not an SVG presentation-attribute serialization contract."),mermaid:Te("Mermaid is not an SVG presentation-attribute serialization contract."),pdf:ge("svg2pdf consumes common presentation attributes from the cloned SVG"),"editor-dom":ge("COMMON_PROP_RENDERERS derives its dispatch from PRESENTATION_SEMANTICS")}),"gradient-definition-envelope":Gt({renderToSvg:ge("gradient renderers serialize the shared typed definition envelopes"),codegen:ge("render plan defs contain gradients serialized from shared typed envelopes"),dxf:Te("DXF has no SVG linearGradient or radialGradient definition envelope."),mermaid:Te("Mermaid has no SVG linearGradient or radialGradient definition envelope."),pdf:ge("the cloned SVG supplies shared-envelope gradient definitions to svg2pdf"),"editor-dom":ge("GradientManager projects shared gradient envelopes into live defs")}),"filter-definition-envelope":Gt({renderToSvg:ge("renderFilterElement serializes filterDefinitionEnvelope for each wrapper kind"),codegen:ge("render plan defs contain filters serialized from shared typed envelopes"),dxf:Te("DXF has no SVG filter element or primitive graph envelope representation."),mermaid:Te("Mermaid has no SVG filter element or primitive graph envelope representation."),pdf:ge("the cloned SVG supplies shared-envelope filter definitions to svg2pdf"),"editor-dom":ge("FilterManager projects filterDefinitionEnvelope before primitive emission")}),"export-precision-rounding":Gt({renderToSvg:ge("finalizeRenderPlan rounds markup coordinates at the effective documentMetadata.coordinatePrecision"),codegen:Te("Codegen backends consume the un-finalized render plan; component output precision is a code-style concern, not an export boundary."),dxf:Te("DXF numeric precision is owned by the DXF writer, not the SVG export boundary."),mermaid:Te("Mermaid emits graph syntax rather than SVG coordinate attribute streams."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core rounding); selection pages pass through SvgExportFinalizer.roundSvgAttributes"),"editor-dom":ge("static string exports round through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks round through SvgExportFinalizer.roundSvgAttributes; the raster clone sink skips rounding by design (spelling-only, pixel-irrelevant)")}),"defs-deduplication":Gt({renderToSvg:ge("finalizeRenderPlan collapses content-identical gradient/pattern/marker defs and rewrites references"),codegen:Te("Codegen backends consume the un-finalized render plan; def duplication in generated components is a code-size concern outside the export contract."),dxf:Te("DXF output has no shared-definition graph in which duplicates could exist."),mermaid:Te("Mermaid output has no shared-definition graph in which duplicates could exist."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core dedup); selection pages pass through SvgExportFinalizer.deduplicateDefsForExport"),"editor-dom":ge("static string exports dedup through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.deduplicateDefsForExport; the raster clone sink skips dedup by design (spelling-only, pixel-irrelevant)")}),"source-id-restoration":Gt({renderToSvg:ge("finalizeRenderPlan restores uncontested library sourceIds and rewrites references"),codegen:Te("Generated components keep collision-safe runtime ids; source ids are a document round-trip concern."),dxf:Te("DXF entities carry no SVG id namespace for source ids to be restored into."),mermaid:Te("Mermaid nodes carry no SVG id namespace for source ids to be restored into."),pdf:Te("PDF output has no id namespace to restore; the intermediate SVG string restores ids for fidelity but the PDF consumer never observes them."),"editor-dom":ge("static string exports restore source ids through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.restoreSourceIds; the raster clone sink skips restoration by design (ids are spelling, not pixels)")}),"orphan-def-exclusion":Gt({renderToSvg:ge("def emission is demand-driven (collectReferencedLibraryDefs, the referenced-marker gate, the paint-server reachability fixed point) \u2014 unreferenced defs are never emitted, so no pruning pass exists or is needed"),codegen:ge("component backends consume the same demand-driven plan def channels"),dxf:Te("DXF output has no defs graph from which orphans could need excluding."),mermaid:Te("Mermaid output has no defs graph from which orphans could need excluding."),pdf:ge("the editor SVG consumed by svg2pdf passes through pruneOrphanedDefs"),"editor-dom":ge("static string exports are demand-driven via the core plan (no orphans emitted); the raster/selection clone sinks sweep accumulated live defs with SvgExportFinalizer.pruneOrphanedDefs")}),"font-embedding":Gt({renderToSvg:ge("finalizeRenderPlan ships @font-face CSS from the injected resolveFontEmbedCss hook (core is platform-free; binary resolution is the caller environment responsibility)"),codegen:Te("Generated components inherit the host page font pipeline; embedding binaries in component source is out of contract."),dxf:Te("DXF text styling is font-name based; the format has no font binary embedding."),mermaid:Te("Mermaid delegates font resolution entirely to the rendering host page."),pdf:ge("svg2pdf consumes the editor SVG after the async export inlined @font-face CSS"),"editor-dom":ge("every sink that leaves the live document embeds: static and animated string exports resolve plan-collected FACES (family + weight + style) through fontManager into the core resolveFontEmbedCss hook, and the embedded-SVG subtree and selection exports run SvgExportFinalizer.embedFontsInOutput over the projected tree. Raster sinks embed too, subset to the characters they render - an SVG handed to an <img> is processed in secure static/animated mode (SVG 2 2.2.4/2.2.6), so it resolves no external references and inherits none of the session live font faces. Only the internal clipboard payload skips embedding, because the session that wrote it is the session that reads it")}),"initial-value-elision":Gt({renderToSvg:ge("finalizeRenderPlan drops redundant spec initials and product defaults under an initial-valued cascade (elideInitialValuesInPlan)"),codegen:Te("Codegen backends consume the un-finalized plan; explicit values in component source are a readability choice, not an export-boundary concern."),dxf:Te("DXF entities carry explicit CAD attributes with no SVG initial-value cascade."),mermaid:Te("Mermaid emits graph syntax; SVG presentation initial values never appear in its output."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core elision); selection pages pass through SvgExportFinalizer.stripDefaultPaintAttributes"),"editor-dom":ge("static string exports elide through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.stripDefaultPaintAttributes and the output-artifact rules; the raster clone sink keeps default attributes by design (elision is spelling-only)")}),"namespace-declaration-completion":Gt({renderToSvg:ge("finalizeRenderPlan declares used prefixes on the root via a well-known URI table (declareUsedNamespacePrefixes); unresolvable prefixes warn undeclarable-namespace-prefix"),codegen:Te("Generated components render into a host document whose framework owns namespace handling; JSX/Vue templates have no xmlns declaration surface to complete."),dxf:Te("DXF is not XML and has no namespace prefixes to declare or complete."),mermaid:Te("Mermaid graph syntax is not XML; no namespace declarations exist."),pdf:ge("svg2pdf consumes the editor SVG string whose serializer declared every namespace it uses"),"editor-dom":ge("static string exports complete declarations through core declareUsedNamespacePrefixes; the raster/selection clone sinks rely on XMLSerializer plus hoistForeignNamespaceDecls")})};function BL(e,t,r={}){let n=ul(e),i=n.errors.filter(a=>!r.ignoreError?.(a));if(i.length>0){let a=i.map(o=>` ${o.path}: ${o.message}`).join(`
53
+ `);throw new Error(`Invalid .svgs document:
54
+ ${a}`)}return r.includeWarnings===!1?[]:n.warnings.map(a=>({severity:"warning",code:/\.type$/.test(a.path)&&/Unknown shape type/.test(a.message)?"unavailable-shape-descriptor":"native-validation-warning",source:"native-document",entrypoint:t,message:a.message,documentPath:a.path}))}function MI(e,t={}){let{indent:r=2,trailingNewline:n=!0,validate:i=!1}=t;if(i){let s=ul(e);if(!s.valid){let l=s.errors.map(u=>` ${u.path}: ${u.message}`).join(`
55
+ `);throw new Error(`Invalid document:
56
+ ${l}`)}}let a={};for(let s of fT){let l=s==="unknownFields"?mT(e):e[s];l!==void 0&&(a[s]=VL(pa[s].serialization,l))}let o=JSON.stringify(a,null,r);return n?o+`
57
+ `:o}function VL(e,t){switch(e.kind){case"verbatim":return t;case"shape-array":return t.map(r=>WL(DF(structuredClone(r))));case"id-sorted-array":return XL(t).map(wo);case"ordered-array":return t.map(wo);case"deep-sorted-object":case"unknown-bag":return wo(t);default:return UL(e)}}function UL(e){throw new Error(`Unhandled serialization kind: ${JSON.stringify(e)}`)}function Sa(e,t={}){return GL(e,t).value}function GL(e,t={}){let{validate:r=!0,migrate:n=!0}=t,i;try{i=JSON.parse(e)}catch(s){throw new Error(`Failed to parse .svgs document: ${s.message}`)}if(i===null||typeof i!="object"||Array.isArray(i))throw new Error("Invalid .svgs document: root must be a JSON object");let a=i;a=pT(a),n&&(a=LL(a)),a=hT(a);let o=[];return r&&o.push(...BL(a,"native-document-open")),{value:a,diagnostics:o}}function XL(e){return[...e].sort((t,r)=>t.id.localeCompare(r.id))}function wo(e){if(e==null)return e;if(Array.isArray(e))return e.map(wo);if(typeof e!="object")return e;let t={},r=Object.keys(e).sort();for(let n of r)t[n]=wo(e[n]);return t}function WL(e){let t={id:e.id,type:e.type},r=Object.keys(e).filter(n=>n!=="id"&&n!=="type").sort();for(let n of r)t[n]=wo(e[n]);return t}var kn=/\{\{\s*([\w.\-]+)\s*\}\}/g;function uv(e,t){return e.replace(kn,(r,n)=>{let i=t[n];return i!==void 0?String(i):r})}function Lo(e,t={}){let r={};if(e.templateVariables)for(let i of e.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(r[i.name]=i.defaultValue);if(Object.assign(r,t),Object.keys(r).length===0)return JSON.parse(JSON.stringify(e));let n=JSON.parse(JSON.stringify(e));if(n.templateVariables)for(let i of n.templateVariables)Object.prototype.hasOwnProperty.call(t,i.name)&&(i.defaultValue=String(t[i.name]));return Pp(n,r),n}function Pp(e,t){for(let r of Object.keys(e)){let n=e[r];if(typeof n=="string"){if(kn.lastIndex=0,kn.test(n)){kn.lastIndex=0;let i=uv(n,t);if(HL(n)){let a=Number(i);if(!isNaN(a)&&YL(r)){e[r]=a;continue}}e[r]=i}}else if(Array.isArray(n))for(let i=0;i<n.length;i++)typeof n[i]=="string"?(kn.lastIndex=0,kn.test(n[i])&&(kn.lastIndex=0,n[i]=uv(n[i],t))):n[i]!==null&&typeof n[i]=="object"&&Pp(n[i],t);else n!==null&&typeof n=="object"&&Pp(n,t)}}function HL(e){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(e)}var qL=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity",...vb,"letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function YL(e){return qL.has(e)}function AI(e){let t=e.templateVariables??[],r=new Set(t.map(a=>a.name)),n=new Set;Dp(e,n);let i=[...n].filter(a=>!r.has(a)).sort();return{defined:[...t],undeclared:i}}function Dp(e,t){for(let r of Object.values(e))if(typeof r=="string"){let n;for(kn.lastIndex=0;(n=kn.exec(r))!==null;)t.add(n[1])}else if(Array.isArray(r))for(let n of r)if(typeof n=="string"){let i;for(kn.lastIndex=0;(i=kn.exec(n))!==null;)t.add(i[1])}else n!==null&&typeof n=="object"&&Dp(n,t);else r!==null&&typeof r=="object"&&Dp(r,t)}function jh(e){let t={};for(let r of e){let n=r.indexOf("=");if(n===-1)throw new Error(`Invalid variable format: "${r}". Expected "name=value".`);let i=r.slice(0,n).trim(),a=r.slice(n+1);if(!i)throw new Error(`Invalid variable format: "${r}". Variable name cannot be empty.`);t[i]=a}return t}var Eh=3,Io=12;function KL(e){return e==null||!Number.isFinite(e)?Eh:e<0?0:e>Io?Io:Math.floor(e)}function CI(e,t){if(!Number.isFinite(e))return e;let r=Math.pow(10,t);return Math.round(e*r)/r}var zh=/[+-]?(?:(?:\d+\.\d*)|(?:\.\d+)|(?:\d+))(?:[eE][+-]?\d+)?/g,ZL=new Set(["amplitude","azimuth","baseFrequency","bias","clip","cx","cy","d","diffuseConstant","divisor","dx","dy","elevation","enable-background","exponent","fill-opacity","filterRes","flood-opacity","font-size","font-size-adjust","fr","fx","fy","height","intercept","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","letter-spacing","limitingConeAngle","markerHeight","markerWidth","numOctaves","offset","opacity","order","orient","path","pathLength","patternTransform","points","pointsAtX","pointsAtY","pointsAtZ","r","radius","refX","refY","rotate","rx","ry","scale","seed","slope","specularConstant","specularExponent","startOffset","stdDeviation","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","surfaceScale","tableValues","targetX","targetY","textLength","transform","transform-origin","viewBox","width","word-spacing","x","x1","x2","y","y1","y2","z"]),JL=new Set(["by","from","to","values"]),QL=12;function dv(e){for(let t of e)if(t!==","&&t!==";"&&!/\s/u.test(t))return!1;return!0}function eB(e){let t=0,r=!1;for(let n of e.matchAll(zh)){let i=n.index??0;if(!dv(e.slice(t,i)))return!1;r=!0,t=i+n[0].length}return r&&dv(e.slice(t))}function tB(e){let t=e.trim();return/^[Mm][\s,]*[-+.\d]/u.test(t)?/^[MmZzLlHhVvCcSsQqTtAa\s,.\-+0-9eE]+$/u.test(t):!1}function OI(e,t){return/\d/.test(t)?ZL.has(e)?!0:JL.has(e)?eB(t)||tB(t):!1:!1}function rB(e,t,r){return e.toLowerCase()==="transform"&&/(?:^|\s)matrix\s*\(/iu.test(t)?Math.max(r,QL):r}function nB(e){let t=0;for(let r of e.matchAll(zh)){let n=Number(r[0]);if(!Number.isFinite(n))continue;let i=Io;for(let a=0;a<=Io;a++)if(CI(n,a)===n){i=a;break}if(t=Math.max(t,i),t===Io)break}return t}function iB(e,t){return e.replace(zh,r=>{let n=parseFloat(r);return Number.isFinite(n)?String(CI(n,t)):r})}var aB=["unsupported-shape-type","unsupported-polygon-type","unresolved-reference","undeclarable-namespace-prefix","unresolved-container-pivot","unresolved-reference-pivot","duplicate-shape-id","reference-cycle","unresolved-svg-viewport","symbol-cycle","unresolved-symbol-definition","duplicate-library-id","invalid-symbol-viewport","unresolved-symbol-viewport","unresolved-symbol-pivot","unknown-symbol-variant","ambiguous-symbol-override-target","unresolved-symbol-override-target","unexpandable-appearance-stack"],TI=class{collected=[];seen=new Set;report(e){let t=`${e.severity}|${e.code}|${e.shapeId??""}|${e.message}`;this.seen.has(t)||(this.seen.add(t),this.collected.push(e))}get diagnostics(){return[...this.collected]}},jp=[];function PI(e,t){jp.push(e);try{return t()}finally{jp.pop()}}function Kr(e){for(let t of jp)t.report(e)}var oB="0 0 10 10";function DI(){return[{id:"line-marker-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-open-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10",fill:"none",stroke:"context-stroke","stroke-width":1.5,"stroke-linejoin":"round","stroke-linecap":"round"}}},{id:"line-marker-circle",refX:5,refY:5,element:{tag:"circle",attrs:{cx:5,cy:5,r:3.2,fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-diamond",refX:5,refY:5,element:{tag:"path",attrs:{d:"M 5 0 L 10 5 L 5 10 L 0 5 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-square",refX:5,refY:5,element:{tag:"rect",attrs:{x:1.5,y:1.5,width:7,height:7,fill:"context-stroke",stroke:"context-stroke"}}}]}var jI={"line-marker-arrow":"mkr-builtin-arrow","line-marker-open-arrow":"mkr-builtin-open-arrow","line-marker-circle":"mkr-builtin-circle","line-marker-diamond":"mkr-builtin-diamond","line-marker-square":"mkr-builtin-square"};function Mu(e,t){let r=t+e.x,n=e.authored?.x,i=e.authored?.y,a=e.authored?.dy;return{x:n?.resolved===r?n.raw:r,...e.y===void 0?{}:{y:i?.resolved===e.y?i.raw:e.y},dy:a?.resolved===e.dy?a.raw:e.dy}}var sB="http://www.w3.org/2000/svg",EI="http://www.w3.org/XML/1998/namespace";function zI(e){return e.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;")}function ho(e){return zI(e).replace(/"/gu,"&quot;")}function _I(e){let t=new Map([["xml",EI],["xmlns","http://www.w3.org/2000/xmlns/"]]),r=[];for(let n of e??[]){if(!n.prefix||n.prefix==="xml"||n.prefix==="xmlns")continue;let i=n.namespaceUri??"";t.get(n.prefix)!==i&&(t.set(n.prefix,i),r.push(`xmlns:${n.prefix}="${ho(i)}"`))}return[...r,...(e??[]).map(n=>`${n.name}="${ho(n.value)}"`)].join(" ")}function lB(e,t){let r=t.defaultNamespace,n=new Map(t.prefixes),i=[];if(e.prefix){let l=e.namespaceUri??"";n.get(e.prefix)!==l&&(n.set(e.prefix,l),i.push(`xmlns:${e.prefix}="${ho(l)}"`))}else r!==e.namespaceUri&&(r=e.namespaceUri,i.push(`xmlns="${ho(e.namespaceUri??"")}"`));for(let l of e.attributes){if(!l.prefix||l.prefix==="xml"||l.prefix==="xmlns")continue;let u=l.namespaceUri??"";n.get(l.prefix)!==u&&(n.set(l.prefix,u),i.push(`xmlns:${l.prefix}="${ho(u)}"`))}let a=[...i,...e.attributes.map(l=>`${l.name}="${ho(l.value)}"`)],o=a.length>0?`<${e.name} ${a.join(" ")}>`:`<${e.name}>`;if(e.children.length===0)return`${o.slice(0,-1)}/>`;let s={defaultNamespace:r,prefixes:n};return`${o}${e.children.map(l=>RI(l,s)).join("")}</${e.name}>`}function RI(e,t){return e.kind==="element"?lB(e,t):e.kind==="text"?zI(e.value):e.kind==="comment"?`<!--${e.value.replace(/--/gu,"- -").replace(/-$/u,"- ")}-->`:e.kind==="cdata"?`<![CDATA[${e.value.replace(/\]\]>/gu,"]]]]><![CDATA[>")}]]>`:`<?${e.value.replace(/\?>/gu,"? >")}?>`}function FI(e,t=sB){let r={defaultNamespace:t,prefixes:new Map([["xml",EI],["xmlns","http://www.w3.org/2000/xmlns/"]])};return(e??[]).map(n=>RI(n,r)).join("")}function cv(e,t){return(e??[]).map((r,n)=>({extension:r,index:n})).filter(({extension:r})=>r.placement===t).sort((r,n)=>r.extension.order-n.extension.order||r.index-n.index).map(({extension:r})=>FI([r.element])).join("")}function Xf(e,t){switch(t){case"uppercase":return e.toLocaleUpperCase();case"lowercase":return e.toLocaleLowerCase();case"capitalize":return e.replace(/\b\p{L}/gu,r=>r.toLocaleUpperCase());default:return e}}var LI=[["fontVariant","font-variant"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantPosition","font-variant-position"],["fontVariantCaps","font-variant-caps"],["fontVariantNumeric","font-variant-numeric"],["fontVariantEastAsian","font-variant-east-asian"]];function uB(e){return LI.map(([t,r])=>{let n=e[t],i=typeof n=="string"?n.trim():"";return i?`${r}: ${i}`:""}).filter(Boolean).join("; ")}function Wf(e,t){let r=[],n=(s,l)=>{l!==""&&r.push({name:s,value:l})};e.fontFamily!==t.fontFamily&&n("font-family",String(e.fontFamily)),e.fontSize!==t.fontSize&&n("font-size",String(e.fontSize)),e.fontWeight!==t.fontWeight&&n("font-weight",String(e.fontWeight)),e.fontStyle!==t.fontStyle&&n("font-style",String(e.fontStyle)),e.fontStretch!==t.fontStretch&&n("font-stretch",e.fontStretch),e.fontSizeAdjust!==t.fontSizeAdjust&&n("font-size-adjust",e.fontSizeAdjust);let i=LI.flatMap(([s,l])=>{let u=e[s];return u!==t[s]&&u.trim()?[`${l}: ${u.trim()}`]:[]}).join("; ");i&&n("style",i);let a=e.textDecoration,o=t.textDecoration;if(a.underline!==o.underline||a.strikethrough!==o.strikethrough||a.overline!==o.overline){let s=[];a.underline&&s.push("underline"),a.strikethrough&&s.push("line-through"),a.overline&&s.push("overline"),n("text-decoration",s.join(" "))}if(e.baselineShift!==t.baselineShift){let s=e.baselineShift;s==="super"||s==="sub"?n("baseline-shift",s):typeof s=="number"&&n("baseline-shift",`${s}px`)}return e.dominantBaseline!==t.dominantBaseline&&n("dominant-baseline",e.dominantBaseline),e.alignmentBaseline!==t.alignmentBaseline&&n("alignment-baseline",e.alignmentBaseline),e.letterSpacing!==t.letterSpacing&&n("letter-spacing",String(e.letterSpacing)),e.fill!==t.fill&&n("fill",String(e.fill)),e.fillOpacity!==t.fillOpacity&&n("fill-opacity",String(e.fillOpacity)),e.direction!==t.direction&&n("direction",String(e.direction)),e.unicodeBidi!==t.unicodeBidi&&n("unicode-bidi",String(e.unicodeBidi)),r}function dB(e,t){if(e.text!==t?.text&&t!==null)return null;let r=t?Xx(t):null,n=[];if(r){let d=0;r.lines.forEach((c,f)=>{f>0&&(d+=1);for(let p of c.segments)n.push({start:d,end:d+p.text.length,style:p.style}),d+=p.text.length})}let i=d=>r?n.find(c=>c.start<=d&&d<c.end)?.style??r.baseStyle:null,a=(d,c,f)=>{let p=[],h=d;for(let m of f)h<m.start&&p.push({start:h,end:m.start}),h=m.end;return h<c&&p.push({start:h,end:c}),p},o=(d,c,f,p)=>{let h=a(d,c,f);for(let g of h)for(let v=g.start;v<g.end;v++)if(!/\s/u.test(e.text[v]??""))return i(v);let m=h.find(g=>g.start<g.end);return m?i(m.start):p},s=(d,c)=>{if(d>=c)return[];let f=new Set([d,c]);for(let h of n)h.start>d&&h.start<c&&f.add(h.start),h.end>d&&h.end<c&&f.add(h.end);let p=[...f].sort((h,m)=>h-m);return p.slice(0,-1).map((h,m)=>({kind:"text",start:h,end:p[m+1],style:i(h)}))},l=(d,c,f,p)=>{let h=d,m=[];for(let g of f){if(!Number.isInteger(g.start)||!Number.isInteger(g.end)||g.start<h||g.end<g.start||g.end>c||!Array.isArray(g.children))return null;m.push(...s(h,g.start));let v=o(g.start,g.end,g.children,p),y=l(g.start,g.end,g.children,v);if(!y)return null;m.push({kind:"span",spanId:g.spanId,start:g.start,end:g.end,...g.id?{id:g.id}:{},...g.lineIndex===void 0?{}:{lineIndex:g.lineIndex},style:v,children:y}),h=g.end}return m.push(...s(h,c)),m},u=l(0,e.text.length,e.spans,r?.baseStyle??null);return u?{text:e.text,baseStyle:r?.baseStyle??null,children:u}:null}function cB(e){return{text:e.text,style:{...e.style}}}function Au(e){return{segments:[{text:"",style:e}]}}function fB(e){let t=[];for(let r of e.segments){let n=r.text.match(/\S+|\s+/g);if(n)for(let i of n)t.push({text:i,style:r.style})}return t}function pB(e,t){if(t<=0)return e;let r=e.width-t*2;return r>0?{x:e.x+t,width:r}:null}function fv(e,t,r){let n=e.measureText(t,r);if(!Number.isFinite(n)||n<0)throw new TypeError(`TextMeasurementHost returned invalid width ${String(n)}`);return n}function pv(e,t,r,n){if(e.length===0)return;let i=e[e.length-1],a=i.text.replace(/\s+$/,""),o=i.text.length-a.length;if(o!==0){r.length=n-o;for(let s=0;s<o;s++)t[t.length-o+s]=-1;e[e.length-1]={...i,text:a}}}function hB(e,t){let r=e.whiteSpace==="normal"||e.whiteSpace==="nowrap"||e.whiteSpace==="pre-line",n=e.whiteSpace==="normal"||e.whiteSpace==="nowrap",i=e.whiteSpace!=="pre"&&e.whiteSpace!=="nowrap",a=e.whiteSpace!=="break-spaces",o=e.shapeInsideGeometry??null,s=Math.max(0,e.shapePadding??0),l=[],u=[],d=new Map,c=x=>{if(!o)return e.inlineSize;let k=e.baseStyle.fontSize*e.lineHeight,$=o.bounds.minY+e.baseStyle.fontSize+x*k;if($>o.bounds.maxY)return u.push(o.bounds.minX),0;let A=Math.round($*256),S=d.get(A);if(S===void 0){let N=o.getSpanAtY($);S=N?pB(N,s):null,d.set(A,S)}return S?(u.push(S.x),S.width):(u.push(o.bounds.minX),0)},f=[];for(let x=0;x<e.lines.length;x++){x>0&&f.push(n?{text:" ",style:e.baseStyle,modelLen:1,isHardBreak:!1,isWhitespace:!0}:{text:"",style:e.baseStyle,modelLen:1,isHardBreak:!0,isWhitespace:!1});for(let k of fB(e.lines[x])){let $=/^\s+$/.test(k.text);f.push({text:r&&$?" ":k.text,style:k.style,modelLen:k.text.length,isHardBreak:!1,isWhitespace:$})}}if(r)for(let x=f.length-1;x>0;x--){let k=f[x],$=f[x-1];k.isWhitespace&&!k.isHardBreak&&$.isWhitespace&&!$.isHardBreak&&($.modelLen+=k.modelLen,f.splice(x,1))}let p=[],h=[],m=0,g=0,v=[],y=0,b=c(0),I=!0;for(let x of f){if(x.isHardBreak){v.length===0&&(h.push(m),g++,o&&u.length<=l.length&&c(l.length)),p.push(g),m++,l.push(v.length>0?{segments:v}:Au(e.baseStyle)),v=[],y=0,b=c(l.length),I=!0;continue}if(r&&x.isWhitespace&&I){for(let A=0;A<x.modelLen;A++)p.push(-1),m++;continue}let k=fv(t,x.text,x.style);if(i&&b>0&&y+k>b&&y>0&&(a&&(pv(v,p,h,g),g=h.length),l.push(v.length>0?{segments:v}:Au(e.baseStyle)),v=[],y=0,b=c(l.length),I=!0,x.isWhitespace)){for(let A=0;A<x.modelLen;A++)p.push(-1),m++;continue}if(i&&b>0&&k>b&&e.overflowWrap!=="normal"){for(let S of x.text){let N=fv(t,S,x.style);y+N>b&&y>0&&(l.push(v.length>0?{segments:v}:Au(e.baseStyle)),v=[],y=0,b=c(l.length)),p.push(g),h.push(m),m++,g++;let T=v[v.length-1];T&&ya(T.style,x.style)?v[v.length-1]={...T,text:T.text+S}:v.push({text:S,style:{...x.style}}),y+=N}let A=x.modelLen-x.text.length;for(let S=0;S<A;S++)p.push(-1),m++;I=!1;continue}for(let A of x.text)p.push(g),h.push(m),m++,g++;for(let A=x.text.length;A<x.modelLen;A++)p.push(-1),m++;let $=v[v.length-1];$&&ya($.style,x.style)?v[v.length-1]={...$,text:$.text+x.text}:x.text&&v.push(cB(x)),y+=k,I=!1}return r&&v.length>0&&pv(v,p,h,g),v.length===0&&f.length===0&&h.push(m),l.push(v.length>0?{segments:v}:Au(e.baseStyle)),{lines:l,modelToSvgMap:p,svgToModelMap:h,shapeInsideLineXOffsets:u}}var mB=class{constructor(e){this.measurementHost=e}measurementHost;layout(e){return hB(e,this.measurementHost)}};function Gd(e){let t=0;for(;t<e.length;){let n=e.slice(t);if(!/^<defs[\s>]/.test(n))break;let i=e.indexOf("</defs>",t);if(i===-1)break;t=i+7}let r=/^<([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/.exec(e.slice(t));return r?{prefixEnd:t,openStart:t,openEnd:t+r[0].length,tagName:r[1],attributes:r[2],selfClosing:r[3]==="/"}:null}var gB=.25,yB=20;function Ep(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function hv(e,t,r){let n=r.x-t.x,i=r.y-t.y,a=n*n+i*i;if(a===0)return Ep(e,t);let o=Math.max(0,Math.min(1,((e.x-t.x)*n+(e.y-t.y)*i)/a));return Math.hypot(e.x-(t.x+o*n),e.y-(t.y+o*i))}function no(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function zs(e,t,r,n,i,a,o=0){if(o>=yB||hv(t,e,n)<=i&&hv(r,e,n)<=i){a.push(n);return}let s=no(e,t),l=no(t,r),u=no(r,n),d=no(s,l),c=no(l,u),f=no(d,c);zs(e,s,d,f,i,a,o+1),zs(f,c,u,n,i,a,o+1)}function mv(e,t){return e?{x:t.x*2-e.x,y:t.y*2-e.y}:{...t}}function vB(e){return Object.freeze({x:e.x,y:e.y})}function bB(e,t={}){let r=Od(e);if(r.error||r.commands.length===0)return null;let n=t.transform??Ot,i=Number.isFinite(t.tolerance)&&(t.tolerance??0)>0?t.tolerance:gB,a=I=>zt(n,I),o=[],s=null,l={x:0,y:0},u={x:0,y:0},d=null,c=null,f="",p=(I,x,k)=>({x:I.params[x]+(I.type===I.type.toLowerCase()?k.x:0),y:I.params[x+1]+(I.type===I.type.toLowerCase()?k.y:0)}),h=I=>{s||(s=[a(l)],o.push(s)),s.push(a(I)),l=I};for(let I of r.commands){let x=I.type.toUpperCase(),k=I.type===I.type.toLowerCase(),$={...l},A=f==="C"||f==="S",S=f==="Q"||f==="T";switch(x){case"M":{l=p(I,0,$),u={...l},s=[a(l)],o.push(s);break}case"L":h(p(I,0,$));break;case"H":h({x:I.params[0]+(k?$.x:0),y:l.y});break;case"V":h({x:l.x,y:I.params[0]+(k?$.y:0)});break;case"C":{let N=p(I,0,$),T=p(I,2,$),z=p(I,4,$);s||(s=[a(l)],o.push(s)),zs(a(l),a(N),a(T),a(z),i,s),l=z,d=T;break}case"S":{let N=mv(A?d:null,l),T=p(I,0,$),z=p(I,2,$);s||(s=[a(l)],o.push(s)),zs(a(l),a(N),a(T),a(z),i,s),l=z,d=T;break}case"Q":case"T":{let N=x==="Q"?p(I,0,$):mv(S?c:null,l),T=p(I,x==="Q"?2:0,$),z={x:l.x+2/3*(N.x-l.x),y:l.y+2/3*(N.y-l.y)},C={x:T.x+2/3*(N.x-T.x),y:T.y+2/3*(N.y-T.y)};s||(s=[a(l)],o.push(s)),zs(a(l),a(z),a(C),a(T),i,s),l=T,c=N;break}case"A":{let N=p(I,5,$),T=Wb(l.x,l.y,I.params[0],I.params[1],I.params[2],I.params[3]===1,I.params[4]===1,N.x,N.y);if(!T){h(N);break}s||(s=[a(l)],o.push(s));let z=Math.cos(T.phi),C=Math.sin(T.phi),O=Math.max(T.rx,T.ry),E=O<=i?Math.PI/4:Math.max(.01,2*Math.acos(Math.max(-1,1-i/O))),_=Math.max(1,Math.ceil(Math.abs(T.deltaTheta)/E));for(let U=1;U<=_;U++){let V=T.theta1+T.deltaTheta*U/_,q=Math.cos(V),G=Math.sin(V);s.push(a({x:T.cx+T.rx*z*q-T.ry*C*G,y:T.cy+T.rx*C*q+T.ry*z*G}))}l=N;break}case"Z":s&&Ep(s[s.length-1],a(u))>0&&s.push(a(u)),l={...u};break;default:return null}x!=="C"&&x!=="S"&&(d=null),x!=="Q"&&x!=="T"&&(c=null),f=x}let m=[],g=0;for(let I of o)for(let x=1;x<I.length;x++){let k=Ep(I[x-1],I[x]);k!==0&&(m.push({start:I[x-1],end:I[x],offset:g,length:k}),g+=k)}let v=Object.freeze(o.map(I=>Object.freeze(I.map(vB)))),y=v[0]?.[0]??Object.freeze({x:0,y:0}),b=v[v.length-1]?.at(-1)??y;return Object.freeze({length:g,subpaths:v,pointAtLength(I){if(m.length===0||!Number.isFinite(I)||I<=0)return y;if(I>=g)return b;let x=m.find($=>I<=$.offset+$.length);if(!x)return b;let k=(I-x.offset)/x.length;return Object.freeze({x:x.start.x+(x.end.x-x.start.x)*k,y:x.start.y+(x.end.y-x.start.y)*k})}})}var BI=8,xB=12,wB="sans-serif",IB=-4;function kB(e){let t=e;if(t.sourceRef||t.targetRef)return!0;let r=t.routingMode;return typeof r=="string"&&r!=="straight"}function SB(e){let t=(e.minX+e.maxX)/2,r=(e.minY+e.maxY)/2;return[{id:"n",point:{x:t,y:e.minY},direction:"n",kind:"derived"},{id:"s",point:{x:t,y:e.maxY},direction:"s",kind:"derived"},{id:"w",point:{x:e.minX,y:r},direction:"w",kind:"derived"},{id:"e",point:{x:e.maxX,y:r},direction:"e",kind:"derived"},{id:"center",point:{x:t,y:r},direction:"any",kind:"derived"}]}function $B(e,t){let r=e,n={x:r.x1??0,y:r.y1??0},i="any",a={x:r.x2??0,y:r.y2??0},o="any";if(t){let s=r.sourceRef,l=r.targetRef;if(s){let u=t(s);u&&(n=u.point,i=u.direction)}if(l){let u=t(l);u&&(a=u.point,o=u.direction)}}return{a:n,dirA:i,b:a,dirB:o}}function NB(e,t,r,n,i,a=BI){switch(i){case"straight":return{d:`M${e.x},${e.y} L${r.x},${r.y}`,waypoints:[]};case"orthogonal":return gv(e,t,r,n);case"rounded-ortho":{let o=gv(e,t,r,n);return{d:MB(e,o.waypoints,r,a),waypoints:o.waypoints}}case"curved":return{d:AB(e,t,r,n),waypoints:[]}}}function gv(e,t,r,n){let i=t==="e"||t==="w",a=t==="n"||t==="s",o=n==="e"||n==="w",s=n==="n"||n==="s";if(i&&o){let c=(e.x+r.x)/2,f=[{x:c,y:e.y},{x:c,y:r.y}];return{d:`M${e.x},${e.y} L${c},${e.y} L${c},${r.y} L${r.x},${r.y}`,waypoints:f}}if(a&&s){let c=(e.y+r.y)/2,f=[{x:e.x,y:c},{x:r.x,y:c}];return{d:`M${e.x},${e.y} L${e.x},${c} L${r.x},${c} L${r.x},${r.y}`,waypoints:f}}if(i){let c=[{x:r.x,y:e.y}];return{d:`M${e.x},${e.y} L${r.x},${e.y} L${r.x},${r.y}`,waypoints:c}}if(a){let c=[{x:e.x,y:r.y}];return{d:`M${e.x},${e.y} L${e.x},${r.y} L${r.x},${r.y}`,waypoints:c}}let l=Math.abs(r.x-e.x),u=Math.abs(r.y-e.y);if(l>u){let c=(e.x+r.x)/2;return{d:`M${e.x},${e.y} L${c},${e.y} L${c},${r.y} L${r.x},${r.y}`,waypoints:[{x:c,y:e.y},{x:c,y:r.y}]}}let d=(e.y+r.y)/2;return{d:`M${e.x},${e.y} L${e.x},${d} L${r.x},${d} L${r.x},${r.y}`,waypoints:[{x:e.x,y:d},{x:r.x,y:d}]}}function MB(e,t,r,n){let i=[e,...t,r];if(i.length<3)return`M${e.x},${e.y} L${r.x},${r.y}`;let a=`M${i[0].x},${i[0].y}`;for(let o=1;o<i.length-1;o++){let s=i[o-1],l=i[o],u=i[o+1],d=zp(s,l),c=zp(l,u),f=Math.min(n,d/2,c/2),p={x:Cu(l.x,s.x,f/d),y:Cu(l.y,s.y,f/d)},h={x:Cu(l.x,u.x,f/c),y:Cu(l.y,u.y,f/c)};a+=` L${p.x},${p.y}`,a+=` Q${l.x},${l.y} ${h.x},${h.y}`}return a+=` L${i[i.length-1].x},${i[i.length-1].y}`,a}function Cu(e,t,r){return e+(t-e)*r}function zp(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function AB(e,t,r,n){let i=zp(e,r),a=Math.max(30,i*.4),o=yv(t,r.x-e.x,r.y-e.y),s=yv(n,e.x-r.x,e.y-r.y),l={x:e.x+o.x*a,y:e.y+o.y*a},u={x:r.x+s.x*a,y:r.y+s.y*a};return`M${e.x},${e.y} C${l.x},${l.y} ${u.x},${u.y} ${r.x},${r.y}`}function yv(e,t,r){switch(e){case"n":return{x:0,y:-1};case"s":return{x:0,y:1};case"e":return{x:1,y:0};case"w":return{x:-1,y:0};default:{let n=Math.hypot(t,r)||1;return{x:t/n,y:r/n}}}}function CB(e,t){let r=e.shape(t.shapeId);if(!r)return null;let n=r.state?.connectionPoints?.find(o=>o.id===t.anchorId);if(n)return{point:n.point,direction:n.direction};let i=Ph(e,r);if(!i.bounds)return null;let a=SB(i.bounds).find(o=>o.id===t.anchorId);return a?{point:a.point,direction:a.direction}:null}var OB=.5,TB=0;function PB(e,t,r){let n=bB(e);if(!n||n.length===0)return null;let i=Math.min(1,Math.max(0,t??OB)),a=r??TB,o=n.pointAtLength(i*n.length);if(a===0)return{x:o.x,y:o.y};let s=Math.min(1,n.length/2),l=n.pointAtLength(Math.max(0,i*n.length-s)),u=n.pointAtLength(Math.min(n.length,i*n.length+s)),d=u.x-l.x,c=u.y-l.y,f=Math.hypot(d,c)||1;return{x:o.x+-c/f*a,y:o.y+d/f*a}}function F(e,t){return t==null||t===""?"":` ${e}="${Me(String(t))}"`}function VI(e,t){if(!e||typeof e!="object")return"";let r=t&&typeof t=="object"&&!Array.isArray(t)?t:null,n="",i=[];for(let[a,o]of Object.entries(e))a!=="transform"&&(typeof o!="string"||o===""||/^[A-Za-z_][\w:.-]*$/.test(a)&&(r?.[a]==="stylesheet-static"||r?.[a]==="stylesheet-dynamic"||(r?.[a]==="style"?i.push(`${a}: ${o}`):n+=F(a,o))));return n+GI(i)}function UI(e){let t=CF(e);return t.pivotRequired&&!t.pivotResolved&&Kr({severity:"warning",code:"unresolved-container-pivot",shapeId:e.id,message:`Container ${e.id} has decomposed rotation/scale/skew channels, but its local content bounds include contextual geometry unavailable without its document resolver or measurement host; the transform was emitted without a derived pivot.`}),t.transform.attribute}function $r(e,t){let r=Ia(e);if(!r||r.kind!==t)throw new Error(`Shape geometry registry mismatch for ${e.type}: expected ${t}`);return r}function Oo(e,t){return t==null?"":` ${e}="${Me(t)}"`}function GI(e){let t=e.map(r=>(r??"").trim().replace(/;$/,"")).filter(Boolean).join("; ");return t?F("style",t):""}function DB(e,t){return typeof t=="number"&&t>0?`${e}: ${t}px`:""}function Hf(e){if(e&&typeof e=="object"){let t=e;if("dx"in t){let r=t.raw&&typeof t.raw=="object"?t.raw:void 0;return{x:typeof t.x=="number"?t.x:null,y:typeof t.y=="number"?t.y:null,dx:typeof t.dx=="number"?t.dx:0,dy:typeof t.dy=="number"?t.dy:0,rotate:typeof t.rotate=="number"?t.rotate:0,...r?{raw:r}:{},...t.authored&&typeof t.authored=="object"?{authored:t.authored}:{}}}return{x:null,y:null,dx:typeof t.x=="number"?t.x:0,dy:typeof t.y=="number"?t.y:0,rotate:typeof t.rotate=="number"?t.rotate:0}}return{x:null,y:null,dx:0,dy:0,rotate:0}}function io(e,t){let r=-1;for(let i=e.length-1;i>=0;i--)if(e[i][t]!==null){r=i;break}if(r<0)return[];let n=new Array(r+1);for(let i=0;i<=r;i++)n[i]=e[i].raw?.[t]??String(e[i][t]??0);return n}function ao(e,t){let r=-1;for(let i=e.length-1;i>=0;i--)if(e[i][t]!==0||e[i].authored?.[t]===!0){r=i;break}if(r<0)return[];let n=new Array(r+1);for(let i=0;i<=r;i++)n[i]=e[i].raw?.[t]??String(e[i][t]);return n}function vv(e){if(e.length===0)return[];let t=e.length-1,r=e[t].rotate;for(;t>0&&e[t-1].rotate===r;)t--;if(t===0&&r===0)return[];let n=new Array(t+1);for(let i=0;i<=t;i++)n[i]=e[i].rotate;return n}function An(e,t){return un(e,t)}function jB(e,t,r){return pC(e,t,r)}function EB(e){if(typeof e=="string"){let n=e.trim();return n.length>0?n:void 0}if(!e||typeof e!="object")return;let t=e,r=[];return t.underline&&r.push("underline"),t.strikethrough&&r.push("line-through"),t.overline&&r.push("overline"),r.length>0?r.join(" "):void 0}function zB(e,t){let r=e.split(`
58
+ `);return r.length<=1?Me(e):r.map((n,i)=>i===0?`<tspan xml:space="preserve">${Me(n)}</tspan>`:`<tspan x="0%" dy="${t}px" xml:space="preserve">${Me(n)}</tspan>`).join("")}function Jr(e,t,r=[],n){return F("data-shape-id",t)+cl($w(Ro(e),{shapeId:t,retainCssAnimationDeclarations:n?.retainCssAnimationDeclarations,projectStaticStylesheetValues:n?.projectStaticStylesheetValues}),r)}function cl(e,t=[]){let r="",n=new Map,i=new Map;for(let a of e){if(a.channel==="style"){i.delete(a.name),a.value!==null&&a.value!==""&&i.set(a.name,a.value);continue}a.ifAbsent&&n.has(a.name)||(n.delete(a.name),!(a.value===null||a.value===""&&!a.allowEmpty)&&n.set(a.name,a))}for(let a of n.values())r+=a.allowEmpty?Oo(a.name,String(a.value)):F(a.name,a.value);return(t.length>0||i.size>0)&&(r+=GI([...t,...[...i].map(([a,o])=>`${a}: ${o}`)])),r}var _B=new Set(["element-opacity","system-language","required-extensions","visibility","display","metadata","inline-style","container-presentation","authored-attributes"]);function Xd(e){let t=e.metadata;return Bd(t)}function RB(e,t){let r=Xd(t);if(!r)return e;let n=Gd(e);if(!n)return e;let i=e.slice(0,n.openStart),a=e.slice(n.openStart),o=n.openEnd-n.openStart;return n.selfClosing?i+`<${n.tagName}${n.attributes}>`+r+`</${n.tagName}>`+a.slice(o):i+a.slice(0,o)+r+a.slice(o)}function FB(e,t){if(t.length===0)return e;let r=t.join(""),n=Gd(e);if(!n)return e;let i=e.slice(0,n.openStart),a=e.slice(n.openStart),o=n.openEnd-n.openStart;if(n.selfClosing)return i+`<${n.tagName}${n.attributes}>`+r+`</${n.tagName}>`+a.slice(o);let s=a.match(/<\/([\w:-]+)>$/);if(!s)return i+a+r;let l=a.lastIndexOf(`</${s[1]}>`);return i+a.slice(0,l)+r+a.slice(l)}function Wd(e){let t="",r=e.startEndpoint,n=e.endEndpoint;return r&&r!=="none"&&!e.markerStart&&(t+=F("marker-start",`url(#line-marker-${r})`)),n&&n!=="none"&&!e.markerEnd&&(t+=F("marker-end",`url(#line-marker-${n})`)),t}function LB(e,t){let r=e.state,{cx:n,cy:i,r:a,defaultPivot:o}=$r(e,"circle"),s=An(r,o??void 0);return`<circle${F("cx",n)}${F("cy",i)}${F("r",a)}${Jr(r,e.id,[],t)}${s?F("transform",s):""}/>`}function BB(e,t){let r=e.state,{cx:n,cy:i,rx:a,ry:o,pathLength:s,defaultPivot:l}=$r(e,"ellipse"),u=An(r,l??void 0);return`<ellipse${F("cx",n)}${F("cy",i)}${F("rx",a)}${F("ry",o)}${s!==void 0?F("pathLength",s):""}${Jr(r,e.id,[],t)}${u?F("transform",u):""}/>`}function VB(e,t){let r=e.state,{x:n,y:i,width:a,height:o,authoredRx:s,authoredRy:l,pathData:u,defaultPivot:d}=$r(e,"rectangle"),c=An(r,d??void 0);if(u)return`<path${F("d",u)}${Jr(r,e.id,[],t)}${c?F("transform",c):""}/>`;let f=`${s===void 0?"":F("rx",s)}${l===void 0?"":F("ry",l)}`;return`<rect${F("x",n)}${F("y",i)}${F("width",a)}${F("height",o)}${f}${Jr(r,e.id,[],t)}${c?F("transform",c):""}/>`}function UB(e,t){let r=e.state;if(kB(r))return GB(e,t);let{x1:n,y1:i,x2:a,y2:o,defaultPivot:s}=$r(e,"line"),l=An(r,s??void 0),u={...r,fillType:"none"};return`<line${F("x1",n)}${F("y1",i)}${F("x2",a)}${F("y2",o)}${Jr(u,e.id,[],t)}${Wd(r)}${l?F("transform",l):""}/>`.replace(' fill="none"',"")}function GB(e,t){let r=e.state,{a:n,dirA:i,b:a,dirB:o}=$B(r,t?.connectorAnchorPoint),s=r.routingMode??"straight",l=NB(n,i,a,o,s,r.cornerRadius??BI),u=An(r,{x:(n.x+a.x)/2,y:(n.y+a.y)/2}),d={...r,fillColor:"none",fillType:"none"},c=`<path${F("d",l.d)}${Jr(d,e.id,[],t)}${Wd(r)}${u?F("transform",u):""}/>`,f=typeof r.label=="string"?r.label.trim():"";if(!f)return c;let p=PB(l.d,r.labelPosition,r.labelOffset);if(!p)return c;let h=r.borderColor||"#333333",m=`<text${F("x",p.x)}${F("y",p.y)}${F("dy",IB)}${F("text-anchor","middle")}${F("font-family",wB)}${F("font-size",xB)}${F("fill",h)}>${Me(f)}</text>`;return`<g>${c}${m}</g>`}function XB(e,t){let r=e.state,{x:n,y:i,defaultPivot:a}=$r(e,"text"),o=r.text??"",s=Xf(o,r.textTransform),l=r.textSpanTree,u=l?.text===o&&l.spans.length>0,d=Array.isArray(r.charOffsets)?r.charOffsets.map(Hf):void 0,c=u&&l?SD(l,d):null,f=r.whiteSpace==="pre"||r.whiteSpace==="pre-wrap"||r.whiteSpace==="break-spaces",p=Wx(r),h=r.fontSize??16,m=r.fontFamily??"sans-serif",g=r.fontWeight??"normal",v=r.fontStyle??"normal",y=r.fontStretch??"normal",b=r.fontSizeAdjust??"none",I=r.textAnchor??"start",x=EB(r.textDecoration),k=r.letterSpacing,$=r.wordSpacing,A=r.lineHeight??1.2,S=An(r,a??void 0),N=r.isTextPath&&r.textPathPoints,T=r.authoredTextPosition,z=T?.x?.resolved===n?T.x.raw:n,C=T?.y?.resolved===i?T.y.raw:i,O=!u&&!o.includes(`
59
+ `)&&Array.isArray(r.charOffsets)&&r.charOffsets.length>0?r.charOffsets.map(Hf):null,E=z,_=C,U="";if(O){if(!N){let We=io(O,"x");We.length>0&&(We[0]=String(z),E=We.join(" "));let ct=io(O,"y");ct.length>0&&(ct[0]=String(C),_=ct.join(" "))}let De=ao(O,"dx");De.length>0&&(U+=F("dx",De.join(" ")));let st=ao(O,"dy");st.length>0&&(U+=F("dy",st.join(" ")));let Qe=vv(O);Qe.length>0&&(U+=F("rotate",Qe.join(" ")))}c&&c.root.length>0&&(U+=F("rotate",c.root.join(" ")));let V=N?U:F("x",E)+F("y",_)+U,q=[],G=(De,st,Qe=st)=>{let We=r.presentationChannels?.[De];We==="stylesheet-static"||We==="stylesheet-dynamic"||(We==="style"?q.push(`${De}: ${Qe}`):V+=F(De,st))};G("font-size",h,`${h}px`),G("font-family",m),g!=="normal"&&g!=="400"&&G("font-weight",g),v!=="normal"&&G("font-style",v),y!=="normal"&&G("font-stretch",y),b!=="none"&&G("font-size-adjust",b),I!=="start"&&G("text-anchor",I),x&&G("text-decoration",x),k&&G("letter-spacing",k,`${k}px`),$&&G("word-spacing",$,`${$}px`);let H=r.baselineShift;H&&H!=="baseline"&&G("baseline-shift",H);let W=r.dominantBaseline;W&&W!=="auto"&&G("dominant-baseline",W);let B=r.alignmentBaseline;B&&B!=="auto"&&G("alignment-baseline",B);let ie=r.writingMode;ie&&ie!=="horizontal-tb"&&G("writing-mode",ie);let Y=r.textLength;Y!==void 0&&Y>0&&(V+=F("textLength",Y),r.lengthAdjust==="spacingAndGlyphs"&&(V+=F("lengthAdjust","spacingAndGlyphs")));let X=r.textDirection;X&&X!=="ltr"&&G("direction",X);let Z=r.unicodeBidi;Z&&Z!=="normal"&&G("unicode-bidi",Z);let J=r.shapeInsideRef,Q="",Ee="";if(J){Q=`shape-inside: url(#${t?.shapeInsideTargetElementId?.(J)??J})`;let De=r.shapePadding;De!==void 0&&De>0&&(Ee=`shape-padding: ${De}`)}let we=uB(r),Xe=r.fontVariationSettings,jt="";Xe&&Object.keys(Xe).length>0&&(jt=`font-variation-settings: ${Object.entries(Xe).map(([De,st])=>`'${De}' ${st}`).join(", ")}`);let Gi=r.inlineSize!==void 0||J!==void 0||typeof r.overflowWrap=="string",dr=typeof r.lineHeight=="number"&&r.lineHeight!==1.2,mn=[...q,we,jt,DB("inline-size",r.inlineSize),Q,Ee,typeof r.overflowWrap=="string"?`overflow-wrap: ${r.overflowWrap}`:"",typeof r.whiteSpace=="string"?`white-space: ${r.whiteSpace}`:"",Gi&&dr?`line-height: ${r.lineHeight}`:""];if(V+=Jr(r,e.id,mn,t),S&&(V+=F("transform",S)),r.isTextPath&&r.textPathPoints){let De=r.textPathPoints,st=r.textPathStartOffset??0,Qe=r.textPathSide,We=`text-path-${e.id}`,ct=r.textPathMethod,Et=r.textPathSpacing,xr=r.textPathLengthAdjust,cr=r.textPathLength,bt=r.textPathReference,Ye=bt?.kind==="shape"?t?.textPathTargetElementId?.(bt.targetId)??bt.targetId:bt?.kind==="definition"?bt.targetId:void 0,xt="";if(De.length>=2)if(Qe==="right"){let Zt=De[De.length-1];xt=`M ${Zt.x} ${Zt.y}`;for(let P=De.length-1;P>0;P--){let D=De[P],L=De[P-1],te=D.handleIn??D,le=L.handleOut??L;xt+=` C ${te.x} ${te.y} ${le.x} ${le.y} ${L.x} ${L.y}`}}else{xt=`M ${De[0].x} ${De[0].y}`;for(let Zt=0;Zt<De.length-1;Zt++){let P=De[Zt],D=De[Zt+1],L=P.handleOut??P,te=D.handleIn??D;xt+=` C ${L.x} ${L.y} ${te.x} ${te.y} ${D.x} ${D.y}`}}let $e=r.textPathStartOffsetUnit==="user"?st:`${st}%`,ar=t?.textPathAnimationElementsForShape?.(e)?.join("")??"",yt=Ye?bt?.element==="mpath"?"":F("href",`#${Ye}`):r.textPathInlineFormat==="path-attr"?F("path",xt):F("href",`#${We}`),mt=Ye&&bt?.element==="mpath"?`<mpath href="#${Me(Ye)}"/>`:"",Kt=`<textPath${yt}${F("startOffset",$e)}${F("method",ct)}${F("spacing",Et)}${F("side",Qe)}${F("lengthAdjust",xr)}${F("textLength",cr)}>${mt}${zB(s,h*A)}${ar}</textPath>`;if(Ye||r.textPathInlineFormat==="path-attr")return`<text${V}>${Kt}</text>`;let or=`<path id="${Me(We)}"${F("d",xt)} fill="none"/>`;return t?.registerGeneratedDefinition?(t.registerGeneratedDefinition({id:We,markup:or}),`<text${V}>${Kt}</text>`):`<defs>${or}</defs><text${V}>${Kt}</text>`}if(O)return`<text${V}>${Me(s)}</text>`;if(r.charOffsets&&Array.isArray(r.charOffsets)&&r.charOffsets.length>0&&!u){let De=r.charOffsets.map(Hf),st=s.split(`
60
+ `),Qe=r.linePositions??[],We=h*A,ct="",Et=0;return st.forEach((xr,cr)=>{let bt=Array.from(xr).length,Ye=De.slice(Et,Et+bt),xt=Qe[cr],$e=xt?Mu(xt,n):null,ar=$e?$e.x:cr>0?n:NaN,yt=xt?.y===void 0?$e?$e.dy:cr>0?We:NaN:NaN,mt=F("id",xt?.id),Kt=io(Ye,"x");if($e||Number.isFinite(ar)||Kt.length>0){let le=Kt.length>0?Kt.slice():[];($e||Number.isFinite(ar))&&(le[0]=le[0]??String(ar)),mt+=F("x",le.join(" "))}let or=io(Ye,"y");if(xt?.y!==void 0||or.length>0){let le=or.length>0?or.slice():[];xt?.y!==void 0&&(le[0]=le[0]??String($e?.y??xt.y)),mt+=F("y",le.join(" "))}let Zt=ao(Ye,"dx");Zt.length>0&&(mt+=F("dx",Zt.join(" ")));let P=ao(Ye,"dy"),D=xt?.y===void 0&&$e!==null||Number.isFinite(yt),L=P.length>0||D?P.slice():[];for(D&&(L[0]=P.length===0&&typeof yt=="string"?yt:String(Number(L[0]??0)+(xt?.dy??Number(yt))));L.length>0&&Number(L[L.length-1])===0;)L.pop();L.length>0&&(mt+=F("dy",L.join(" ")));let te=vv(Ye);te.length>0&&(mt+=F("rotate",te.join(" "))),ct+=`<tspan${mt}>${Me(xr)}</tspan>`,Et+=bt+1}),`<text${V}>${ct}</text>`}if(l&&u){let De=dB(l,p),st=r.linePositions,Qe=d,We=xr=>Array.from(o.slice(0,xr)).length,ct=(xr,cr,bt=[])=>{let Ye="",xt=0;for(let $e of xr){if($e.kind==="text"){let be=f?o.slice($e.start,$e.end):o.slice($e.start,$e.end).replaceAll(`
61
+ `,"");if(!be)continue;let Ue=Xf(be,$e.style?.textTransform??r.textTransform);if(!$e.style||!cr||ya($e.style,cr)){Ye+=Me(Ue);continue}let ze="";for(let{name:St,value:At}of Wf($e.style,cr))ze+=F(St,At);Ye+=`<tspan${ze} xml:space="preserve">${Me(Ue)}</tspan>`;continue}let ar=[...bt,xt++],yt=F("id",$e.id);if($e.style&&cr)for(let{name:be,value:Ue}of Wf($e.style,cr))yt+=F(be,Ue);let mt=$e.children.every(be=>be.kind==="text")&&Qe?Qe.slice(We($e.start),We($e.end)):[],Kt=io(mt,"x"),or=io(mt,"y"),Zt=ao(mt,"dx"),P=ao(mt,"dy"),D=c?.spans.get($e.spanId)??[],L=null;if($e.lineIndex!==void 0){let be=st?.[$e.lineIndex];if(!be)return null;let Ue=Mu(be,n);Kt.length===0&&(f||Math.abs(be.x)>.001||$e.lineIndex>0)&&(yt+=F("x",Ue.x)),or.length===0&&be.y!==void 0&&(yt+=F("y",Ue.y)),be.y===void 0&&(Math.abs(be.dy)>.001||$e.lineIndex>0)&&(L=Ue.dy)}Kt.length>0&&(yt+=F("x",Kt.join(" "))),or.length>0&&(yt+=F("y",or.join(" "))),Zt.length>0&&(yt+=F("dx",Zt.join(" ")));let te=L===null?P:P.length>0?P.slice():[];for(L!==null&&(te[0]=P.length===0&&typeof L=="string"?L:String(Number(te[0]??0)+Number(L)));te.length>0&&Number(te[te.length-1])===0;)te.pop();te.length>0&&(yt+=F("dy",te.join(" "))),D.length>0&&(yt+=F("rotate",D.join(" ")));let le=ct($e.children,$e.style,ar);if(le===null)return null;let Fe=t?.textSpanAnimationElementsForShape?.(e,$e.spanId)?.join("")??"";Ye+=`<tspan${yt}>${le}${Fe}</tspan>`}return Ye},Et=De?ct(De.children,De.baseStyle):null;if(Et!==null)return`<text${V}>${Et}</text>`}let Pn=r.linePositions;if(Pn&&Pn.length>0&&!p){let De=s.split(`
62
+ `);if(De.length===Pn.length){let st="";for(let Qe=0;Qe<De.length;Qe++){let We=Pn[Qe],ct=Mu(We,n),Et=F("id",We.id);(Math.abs(We.x)>.001||Qe>0)&&(Et+=F("x",ct.x)),We.y!==void 0?Et+=F("y",ct.y):(Math.abs(We.dy)>.001||Qe>0)&&(Et+=F("dy",ct.dy)),st+=`<tspan${Et}>${Me(De[Qe])}</tspan>`}return`<text${V}>${st}</text>`}}let yi=p;if(yi){let De=Xx(yi),st=t?.textShapeInsideGeometry?.(e)??null,Qe=t?.textMeasurementHost&&(typeof r.inlineSize=="number"||st!==null||r.whiteSpace==="normal"||r.whiteSpace==="nowrap"||r.whiteSpace==="pre-line")?new mB(t.textMeasurementHost).layout({lines:De.lines,baseStyle:De.baseStyle,lineHeight:De.lineHeight,inlineSize:typeof r.inlineSize=="number"?r.inlineSize:0,overflowWrap:r.overflowWrap==="break-word"||r.overflowWrap==="anywhere"?r.overflowWrap:"normal",whiteSpace:r.whiteSpace==="normal"||r.whiteSpace==="nowrap"||r.whiteSpace==="pre"||r.whiteSpace==="pre-line"||r.whiteSpace==="break-spaces"?r.whiteSpace:"pre-wrap",shapeInsideGeometry:st,shapePadding:typeof r.shapePadding=="number"?r.shapePadding:0}):null,We=Qe?.lines??De.lines,ct=r.linePositions,Et=h*De.lineHeight,xr="";return We.forEach((cr,bt)=>{cr.segments.forEach((Ye,xt)=>{let $e="";if(xt===0){let ar=ct?.[bt];ar?.id&&($e+=F("id",ar.id));let yt=Qe?.shapeInsideLineXOffsets[bt];if(st&&yt!==void 0)$e+=F("x",yt),$e+=F("y",st.bounds.minY+h+bt*Et);else if(ar){let mt=ar,Kt=Mu(mt,n);(Math.abs(mt.x)>.001||bt>0)&&($e+=F("x",Kt.x)),(Math.abs(mt.dy)>.001||bt>0)&&($e+=F("dy",Kt.dy))}else bt>0&&($e+=F("x",n),$e+=F("dy",`${Et}px`))}for(let{name:ar,value:yt}of Wf(Ye.style,De.baseStyle))$e+=F(ar,yt);$e+=' xml:space="preserve"',xr+=`<tspan${$e}>${Me(Xf(Ye.text||(Qe?"\u200B":""),Ye.style.textTransform))}</tspan>`})}),`<text${V}>${xr}</text>`}return`<text${V}>${Me(s)}</text>`}function WB(e,t){let r=e.state,n=$r(e,"path"),i=n.defaultPivot?An(r,n.defaultPivot):null;return`<path${F("d",n.d)}${Jr(r,e.id,[],t)}${Wd(r)}${i?F("transform",i):""}/>`}function HB(e,t){let r=e.state,{points:n,closed:i,defaultPivot:a}=$r(e,"polyline"),o=n.map(l=>`${l.x},${l.y}`).join(" "),s=a?An(r,a):null;return`<${i?"polygon":"polyline"}${F("points",o)}${Jr(r,e.id,[],t)}${Wd(r)}${s?F("transform",s):""}/>`}function qB(e,t){let r=e.state,{x:n,y:i,width:a,height:o,defaultPivot:s}=$r(e,"positioning-rect"),l=r.href??"",u=r.imageOpacity,d=r.specPreserveAspectRatio||(r.preserveAspectRatio?"xMidYMid meet":"none"),c=An(r,s??void 0);return`<image${F("x",n)}${F("y",i)}${F("width",a)}${F("height",o)}${F("href",l)}${F("preserveAspectRatio",d)}${u!==void 0&&u<1?F("opacity",u):""}${Jr(r,e.id,[],t)}${c?F("transform",c):""}/>`}function YB(e,t){let r=e.state,{x:n,y:i,width:a,height:o,defaultPivot:s}=$r(e,"positioning-rect"),l=Array.isArray(r.foreignContent)?r.foreignContent:[],u=FI(l),d=An(r,s??void 0);return`<foreignObject${F("x",n)}${F("y",i)}${F("width",a)}${F("height",o)}${Jr(r,e.id,[],t)}${d?F("transform",d):""}>${u}</foreignObject>`}function Hd(e,t,r){let n=(t??[]).map(l=>va(l,r)),i=r?.definitionChildrenForShape?.(e);if(!i||i.length===0)return n.join("");let a=i.map((l,u)=>({...l,order:u})).sort((l,u)=>l.siblingIndex-u.siblingIndex||l.order-u.order),o=-1,s=0;for(let l of a)l.siblingIndex===o?s++:(o=l.siblingIndex,s=0),n.splice(Math.min(l.siblingIndex+s,n.length),0,l.markup);return n.join("")}function XI(e,t){let r=e.state,n="",i=Ro(r),a=_o.filter(o=>_B.has(o.id)).flatMap(o=>sl(o,i,{shapeId:e.id,includeAuthoredAttributes:!0,includeContainerPresentation:!0,retainCssAnimationDeclarations:t?.retainCssAnimationDeclarations}));return n+=cl(a),n}var KB=new Set(["system-language","required-extensions","visibility","display","visible","inline-style","container-presentation"]);function ZB(e,t){if(!e)return"";let r=Ro(e.state),n=_o.filter(i=>KB.has(i.id)).flatMap(i=>sl(i,r,{shapeId:e.id,includeContainerPresentation:!0,retainCssAnimationDeclarations:t?.retainCssAnimationDeclarations}));return cl(n)}function WI(e,t){let r=UI(e);return(r?F("transform",r):"")+XI(e,t)}function JB(e,t){let r=e.state,n=r.href,i=r.hrefXlink,a="<a";return n!==void 0&&(a+=F("href",n)),i!==void 0&&(a+=F("xlink:href",i)),a+=F("target",r.linkTarget),a+=F("rel",r.linkRel),r.linkDownload===""?a+=' download=""':a+=F("download",r.linkDownload),a+=F("ping",r.linkPing),a+=F("hreflang",r.linkHreflang),a+=F("type",r.linkType),a+=F("referrerpolicy",r.linkReferrerPolicy),a+=WI(e,t),a+=F("data-shape-id",e.id),a+=">",a+=Xd(r),a+=Hd(e,r.children,t),a+="</a>",a}function QB(e,t){let r=e.state,n="<switch";return n+=Oo("systemLanguage",r.switchSystemLanguage),n+=Oo("requiredExtensions",r.switchRequiredExtensions),n+=WI(e,t),n+=F("data-shape-id",e.id),n+=">",n+=Xd(r),n+=Hd(e,r.children,t),n+="</switch>",n}function e3(e,t){let r=e.state,n=UI(e),i="<g",a=[],o=r.presentationChannels,s=(d,c)=>{c===void 0||c===""||o?.[d]==="stylesheet-static"||o?.[d]==="stylesheet-dynamic"||(o?.[d]==="style"?a.push(`${d}: ${c}`):i+=F(d,c))};i+=F("data-shape-id",e.id),n&&(i+=F("transform",n)),i+=cl(_o.filter(d=>["metadata","system-language","required-extensions"].includes(d.id)).flatMap(d=>sl(d,Ro(r),{shapeId:e.id}))),r.opacity!==void 0&&r.opacity<1&&s("opacity",r.opacity),r.visibility&&s("visibility",r.visibility);let l=r.groupData;r.blendMode&&a.push(`mix-blend-mode:${r.blendMode}`);let u=t?.retainCssAnimationDeclarations===!1?Nb(r.inlineStyle):r.inlineStyle;for(let[d,c]of Object.entries(u??{}))a.push(`${d}: ${c}`);if(l){let d=l;if(s("clip-path",d.clipPath),s("mask",d.mask),s("filter",d.filter),s("fill",d.fill),s("fill-opacity",d.fillOpacity),s("stroke-opacity",d.strokeOpacity),d.opacity&&r.opacity===void 0&&s("opacity",d.opacity),Array.isArray(d.classes)&&d.classes.length>0&&!/\sclass\s*=/.test(i)&&(i+=F("class",d.classes.join(" "))),d.attributes)for(let[c,f]of Object.entries(d.attributes))/^[A-Za-z_][\w:.-]*$/.test(c)&&(new RegExp(`\\s${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*=`).test(i)||s(c,f));d.cssFilter&&a.push(`filter:${d.cssFilter}`),d.mixBlendMode&&!r.blendMode&&a.push(`mix-blend-mode:${d.mixBlendMode}`),d.isolation&&a.push(`isolation:${d.isolation}`),d.transformOrigin&&a.push(`transform-origin:${d.transformOrigin}`)}return a.length>0&&(i+=F("style",a.join(";"))),i+=">",i+=Hd(e,r.children,t),i+="</g>",i}function t3(e){let t=e.state,r=$r(e,"view"),n=r.viewBoxX,i=r.viewBoxY,a=r.viewBoxWidth,o=r.viewBoxHeight,s=n!==void 0&&i!==void 0&&a!==void 0&&o!==void 0?`${n} ${i} ${a} ${o}`:void 0,l=typeof t.viewName=="string"&&t.viewName.trim()?ga(t.viewName.trim()):void 0,u="<view";return u+=F("id",l),u+=F("viewBox",s),u+=F("preserveAspectRatio",r.preserveAspectRatio),u+=F("zoomAndPan",t.viewZoomAndPan),u+=F("viewTarget",t.viewTarget),u+="/>",u}function r3(e,t){let r=e.state,n=$r(e,"embedded-svg"),i=Th(e);i.pivotRequired&&!i.pivotResolved&&Kr({severity:"warning",code:"unresolved-svg-viewport",shapeId:e.id,message:`Embedded SVG ${e.id} has decomposed rotation/scale/skew channels, but its auto viewport frame cannot be resolved without a parent viewport.`});let a=n.x,o=n.y,s=n.width,l=n.height,u=n.viewBoxX,d=n.viewBoxY,c=n.viewBoxWidth,f=n.viewBoxHeight,p=u!==void 0&&d!==void 0&&c!==void 0&&f!==void 0?`${u} ${d} ${c} ${f}`:void 0,h="<svg";return h+=F("xmlns","http://www.w3.org/2000/svg"),h+=F("x",a),h+=F("y",o),h+=F("width",s),h+=F("height",l),h+=F("viewBox",p),n.preserveAspectRatio!==void 0&&(h+=Oo("preserveAspectRatio",n.preserveAspectRatio)),i.attribute&&(h+=F("transform",i.attribute)),h+=XI(e,t),h+=F("data-shape-id",e.id),h+=">",h+=Xd(r),h+=Hd(e,r.children,t),h+="</svg>",h}function n3(e,t){let r=e.state,n=$r(e,"shape-reference"),i=n.targetShapeId;if(!i?.trim())return Kr({severity:"warning",code:"unresolved-reference",shapeId:e.id,message:`Shape reference ${e.id} has no targetShapeId and was not rendered.`}),`<!-- shape-reference ${Me(e.id)} has no targetShapeId -->`;let a=n.offsetX,o=n.offsetY,s=t?.shapeReferenceTargetElementId?.(i);if(s===null)return Kr({severity:"error",code:"duplicate-shape-id",shapeId:e.id,message:`Shape reference ${e.id} targets ambiguous duplicate id ${i}.`}),`<!-- shape-reference ${Me(e.id)} has ambiguous target ${Me(i)} -->`;let l=s??i,u=t?.shapeReferenceBounds?.(e),d=u?.diagnostics.find(y=>y.code==="reference-cycle");if(d&&Kr({severity:"warning",code:"reference-cycle",shapeId:e.id,message:d.message}),u?.status==="cycle"&&u.bounds===null)return`<!-- cyclic shape-reference ${Me(e.id)} was not rendered -->`;let c=t?.shapeReferenceTransform?.(e),f=c?.pivotRequired??$n(e.state),p=c?.pivotResolved??!f;f&&!p&&Kr({severity:"warning",code:"unresolved-reference-pivot",shapeId:e.id,message:`Shape reference ${e.id} has decomposed rotation/scale/skew channels, but its translated target bounds require unavailable contextual geometry or measurement.`});let h=c?.attribute??un(e.state),m="<use",g=t?.elementIdForShape?.(e);g&&(m+=F("id",g)),m+=F("href",`#${l}`),m+=F("x",a),m+=F("y",o),n.width!==void 0&&(m+=F("width",n.width)),n.height!==void 0&&(m+=F("height",n.height)),m+=F("data-shape-id",e.id);let v=r.instancePresentation;return m+=VI(v,r.presentationChannels),h&&(m+=F("transform",h)),v?.opacity===void 0&&r.opacity!==void 0&&r.opacity<1&&(m+=F("opacity",r.opacity)),m+="/>",m}function i3(e,t){let r=e.state,n=$r(e,"symbol-instance"),i=t?.symbolInstanceTargetElementId?.(e),a=i===void 0?n.targetId:i;if(a===null)return`<!-- Invalid symbol instance: ${Me(e.id)} -->`;let o=t?.symbolDefKind?.(n.symbolId),s=`<use href="#${Me(a)}"`,l=r.authoredUseGeometry;l&&typeof l=="object"&&(l.x!==void 0&&(s+=F("x",l.x)),l.y!==void 0&&(s+=F("y",l.y)),(o===void 0||o==="symbol")&&(l.width!==void 0&&(s+=F("width",l.width)),l.height!==void 0&&(s+=F("height",l.height)))),s+=F("data-shape-id",e.id);let u=r.instancePresentation;s+=VI(u,r.presentationChannels);let d=t?.symbolInstanceTransform?.(e),c=un(r),f=u?.transform?.trim(),p=f?c?`${f} ${c}`:f:c,h=d?.attribute??p;return h&&(s+=F("transform",h)),`${s}/>`}function a3(e,t){let r=e.state,n=$r(e,"positioning-rect"),i=r.mediaKind??e.type,a=r.href??"",o=r.mediaMimeType,s=r.posterHref,l=r.mediaOpacity,u=`<${i} xmlns="http://www.w3.org/1999/xhtml"`;u+=F("src",a),o&&(u+=F("type",o)),s&&i==="video"&&(u+=F("poster",s)),r.muted&&(u+=' muted=""'),r.loop&&(u+=' loop=""'),r.playbackRate!==void 0&&(u+=F("data-playback-rate",r.playbackRate)),r.volume!==void 0&&(u+=F("data-volume",r.volume)),u+=' preload="auto" playsinline=""',u+=i==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let d="<foreignObject";return d+=F("x",n.x),d+=F("y",n.y),d+=F("width",n.width),d+=F("height",n.height),d+=F("data-shape-id",e.id),d+=F("data-media-kind",i),r.naturalDuration!==void 0&&(d+=F("data-natural-duration",r.naturalDuration)),r.begin!==void 0&&(d+=F("data-begin",r.begin)),r.trimStart!==void 0&&(d+=F("data-trim-start",r.trimStart)),r.trimEnd!==void 0&&(d+=F("data-trim-end",r.trimEnd)),r.fadeInDuration!==void 0&&(d+=F("data-fade-in",r.fadeInDuration)),r.fadeOutDuration!==void 0&&(d+=F("data-fade-out",r.fadeOutDuration)),d+=Oo("systemLanguage",r.systemLanguage),d+=Oo("requiredExtensions",r.requiredExtensions),l!==void 0&&l<1&&(d+=F("opacity",l)),d+=">",d+=u,d+="</foreignObject>",d}function o3(e,t){let r=e.state,n=$r(e,"path"),i=n.defaultPivot?An(r,n.defaultPivot):null;return`<path${F("d",n.d)}${Jr(r,e.id,[],t)}${i?F("transform",i):""}/>`}function s3(e,t){let r=e.state;if(th(e.type)?.renderer!=="polygon")return Kr({severity:"warning",code:"unsupported-polygon-type",message:`Unsupported polygon shape type "${e.type}" on shape "${e.id}"; the shape was dropped from the rendered output`,shapeId:e.id}),`<!-- unsupported polygon shape: ${Me(e.type)} -->`;let n=$r(e,"path"),i=n.placement??{x:0,y:0},a=jB(r,i.x,i.y),o=n.fillRule?F("fill-rule",n.fillRule):"";return`<path${F("d",n.d)}${o}${Jr(r,e.id,[],t)}${F("transform",a)}/>`}var l3={circle:LB,ellipse:BB,rectangle:VB,line:UB,text:XB,path:WB,polyline:HB,image:qB,polygon:s3,flowchart:o3,hyperlink:JB,switch:QB,container:e3,view:t3,svg:r3,"shape-reference":n3,"symbol-instance":i3,media:a3,"foreign-object":YB};function va(e,t){let r=th(e.type);if(!r)return Kr({severity:"warning",code:"unsupported-shape-type",message:`Unsupported shape type "${e.type}" on shape "${e.id}"; the shape was dropped from the rendered output`,shapeId:e.id}),`<!-- unsupported shape type: ${Me(e.type)} -->`;let n=l3[r.renderer](e,t);n=d3(n,e),n=RB(n,e.state),t?.forcedElementIds?.has(e.id)&&(n=HI(n,e.id));let i=t?.elementIdForShape?.(e);i&&(n=u3(n,i));let a=t?.animationElementsForShape?.(e);a&&a.length>0&&(n=FB(n,a));let o=e.state?.leadingComments;return Array.isArray(o)&&o.length>0&&(n=o.map(s=>`<!--${s.replace(/--/g,"- -").replace(/-$/,"- ")}-->`).join("")+n),n}function HI(e,t){let r=Gd(e);if(!r)return e;let n=e.slice(r.openStart,r.openEnd);if(/\sid=/.test(n))return e;let i=r.openStart+1+r.tagName.length;return`${e.slice(0,i)}${F("id",t)}${e.slice(i)}`}function u3(e,t){let r=Gd(e);if(!r)return e;let n=e.slice(r.openStart,r.openEnd),i=/\sid=("[^"]*"|'[^']*')/.exec(n);if(!i)return HI(e,t);let a=r.openStart+i.index;return`${e.slice(0,a)}${F("id",t)}${e.slice(a+i[0].length)}`}function d3(e,t){let r=t.state?.authoredAttributes;if(!r)return e;let n=/^<([A-Za-z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(e);if(!n)return e;let[i,a,o,s]=n,l="";for(let[u,d]of Object.entries(r))d===null||!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(u)||new RegExp(`\\s${u}\\s*=`).test(o)||(l+=` ${u}="${Me(d)}"`);return l?`<${a}${o}${l}${s}>`+e.slice(i.length):e}function qI(e,t){let r=e.attributes.map(([o,s])=>F(o,s)).join(""),n=String(e.attributes.find(([o])=>o==="id")?.[1]??""),i=e.stops.map((o,s)=>{let l=o.attributes.map(([d,c])=>F(d,c)).join(""),u=t?.gradientStopAnimationElements?.(n,s)??[];return u.length>0?`<stop${l}>${u.join("")}</stop>`:`<stop${l}/>`}).join(""),a=t?.definitionAnimationElements?.(n)??[];return`<${e.element}${r}>${a.join("")}${i}</${e.element}>`}function c3(e,t){let r=nz(e,t);return`<pattern${r.attributes.map(([n,i])=>F(n,i)).join("")}>${r.content}</pattern>`}function f3(e,t=[]){let r=Array.isArray(e)?fx(e,t):e;if(r.ids.size===0&&r.legacyEndpoints.size===0)return"";let n="",i=DI();for(let a of i){let o=a.id,s=o.replace("line-marker-",""),l=`mkr-builtin-${s}`,u=r.legacyEndpoints.has(s)||r.ids.has(o),d=r.ids.has(l);if(!u&&!d)continue;let c=a.element,f=Object.entries(c.attrs).map(([m,g])=>F(m,g)).join(""),p=`<${c.tag}${f}/>`,h=m=>{n+=`<marker${F("id",m)}${F("viewBox",oB)}${F("refX",a.refX)}${F("refY",a.refY)}${F("markerWidth",6)}${F("markerHeight",6)}${F("orient","auto-start-reverse")}>${p}</marker>`};u&&h(o),d&&h(l)}return n}var YI=/^node\[(\d+)\]\.(x|y)$/;function p3(e){let t=YI.exec(e);return t?{index:Number.parseInt(t[1],10),coord:t[2]}:null}function KI(e){return YI.test(e.property)}function h3(e,t){return e.some(r=>r.shapeId===t&&r.enabled&&r.property==="pathMorph"&&r.keyframes.length>0)}function _p(e){let t=e.keyframes;if(e.calcMode!=="paced"||t.length<2)return t.map(l=>l.time);let r=[],n=0;for(let l=1;l<t.length;l++){let u=t[l-1].value,d=t[l].value;if(typeof u!="number"||typeof d!="number")return t.map(f=>f.time);let c=Math.abs(d-u);r.push(c),n+=c}let i=t[0].time,a=t[t.length-1].time-i;if(a<=0)return t.map(l=>l.time);if(n<=0)return t.map((l,u)=>i+a*u/(t.length-1));let o=[i],s=0;for(let l of r)s+=l,o.push(i+a*s/n);return o}function m3(e,t){let r=e.keyframes;if(r.length===0)return null;let n=r[0].value;if(r.length===1)return typeof n=="number"?n:null;let i=_p(e),a=-1,o=-1;for(let p=0;p<r.length;p++)i[p]<=t&&(a=p),i[p]>=t&&o===-1&&(o=p);let s=p=>typeof p.value=="number"?p.value:null;if(a===-1)return s(r[0]);if(o===-1)return s(r[r.length-1]);let l=r[a],u=r[o];if(a===o||i[a]===i[o]||e.calcMode==="discrete")return s(l);let d=s(l),c=s(u);if(d===null||c===null)return d??c;let f=(t-i[a])/(i[o]-i[a]);return d+(c-d)*gA(u,f)}var bv=8;function g3(e){return e.easing!=="linear"}function y3(e){let t=new Set;for(let a of e)for(let o of _p(a))t.add(o);let r=[...t].sort((a,o)=>a-o);if(r.length<2)return r;let n=(a,o)=>e.some(s=>{let l=_p(s);for(let u=1;u<s.keyframes.length;u++)if(l[u-1]<o&&l[u]>a&&g3(s.keyframes[u]))return!0;return!1}),i=[r[0]];for(let a=1;a<r.length;a++){let o=r[a-1],s=r[a];if(s>o&&n(o,s))for(let l=1;l<bv;l++)i.push(o+(s-o)*l/bv);i.push(s)}return i}function v3(e,t,r){let n=p3(t);return!n||n.index<0||n.index>=e.length||!Number.isFinite(r)?!1:(e[n.index][n.coord]=r,!0)}function b3(e,t,r){let n=e.points.map(i=>({...i}));for(let i of t){let a=m3(i,r);a!==null&&v3(n,i.property,a)}return Bb(n,e.curveType,e.closed,e.tension,e.arcParams,"expand")}function x3(e,t,r){let n=e.filter(d=>d.shapeId===t&&d.enabled&&KI(d)&&d.keyframes.length>0);if(n.length===0||r.points.length===0||h3(e,t))return null;let i=y3(n);if(i.length<2)return null;let a=i.map((d,c)=>({id:`${t}-node-lowered-${c}`,time:d,value:b3(r,n,d),easing:"linear"})),o=n[0],s=d=>n.every(c=>c[d]===o[d])?o[d]:void 0,l=i[i.length-1]-i[0],u=n.reduce((d,c)=>Math.max(d,c.cycleDuration??0),l);return{track:{id:`${t}-node-lowered`,shapeId:t,property:"pathMorph",keyframes:a,enabled:!0,locked:!1,cycleDuration:u,calcMode:"linear",beginTrigger:s("beginTrigger"),cycleRepeats:s("cycleRepeats"),cycleInfinite:s("cycleInfinite"),cycleBehavior:s("cycleBehavior"),fill:s("fill"),pasteOffset:o.pasteOffset,ancestorMatrix:o.ancestorMatrix},consumedTrackIds:n.map(d=>d.id)}}function w3(e){let t=e?.state;if(!t)return null;let r=t.pathPoints;return!Array.isArray(r)||r.length===0?null:{points:r,curveType:t.pathCurveType??"CUBIC",closed:t.pathClosed??!1,tension:t.pathTension??.5,arcParams:t.pathArcParams}}function I3(e){return e.easing==="custom-bezier"&&e.customBezier?e.customBezier:wd[e.easing]??null}function Rp(e){let t=e.split(/\s+/).map(parseFloat);if(t.length!==4||t.some(o=>!Number.isFinite(o)))return e;let[r,n,i,a]=t;return`${1-i} ${1-a} ${1-r} ${1-n}`}function kr(e){return!Number.isFinite(e)||Math.abs(e)<1e-9?"0":Math.abs(e-1)<1e-9?"1":parseFloat(e.toFixed(6)).toString()}function xv([e,t,r,n]){let i=a=>Number.isFinite(a)?parseFloat(a.toFixed(6)).toString():"0";return`${i(e)} ${i(t)} ${i(r)} ${i(n)}`}function ZI(e){return e.length>0&&e.every(t=>t==="0 0 1 1")}function JI(e){if(e.length<2)return!1;let t=e.length-1,r=1e-4;for(let n=0;n<e.length;n++){let i=n/t,a=parseFloat(e[n]);if(!Number.isFinite(a)||Math.abs(a-i)>r)return!1}return!0}function k3(e){if(e.length<2)return!1;let t=e.length-1,r=1e-4;for(let n=0;n<e.length;n++)if(Math.abs(e[n]-n/t)>r)return!1;return!0}function _i(e){let t=e.cycleDuration??(e.keyframes.length>0?e.keyframes[e.keyframes.length-1].time:0);return e.cycleBehavior==="alternate"||e.cycleBehavior==="alternate-reverse"?t*2:t}function cd(e){return e.simpleDuration==="indefinite"}function Bo(e){return cd(e)||_i(e)>0}function QI(e){if(e){let t=e.smilRelations;if(t?.length)return t.map(r=>{let n=r.kind==="syncbase"?`${r.sourceAnimationId}.${r.event}`:`${r.sourceAnimationId}.repeat(${r.iteration})`;if(Math.abs(r.offset)<1e-9)return n;let i=r.offset<0?"-":"+";return`${n}${i}${kr(Math.abs(r.offset))}s`}).join(";");switch(e.type){case"time":{let r=parseFloat(e.value);return Number.isNaN(r)?"":Number.isFinite(r)?r!==0?`${r}s`:"":"indefinite"}case"event":return e.value;case"expression":return"";default:break}}return""}function S3(e){return QI(e.endTrigger)}function fd(e){let t=QI(e.beginTrigger);if(t)return t;let r=e.keyframes[0]?.time??0;return r!==0?`${r}s`:""}function e1(e){return e.keyframes.length===1&&e.cycleDuration===void 0}function t1(e){return e.calcMode!=="discrete"?!1:e.sourceSmilElement==="set"?!0:!e.sourceSmilElement&&!e.cycleInfinite&&e.keyframes.every(t=>t.easing!=="steps")}function $3(e,t){if(t<=0)return fd(e);if(fd(e)==="indefinite")return"indefinite";let r=e.keyframes[t]?.time??0;return r!==0?`${r}s`:""}function N3(e){if(e.cycleInfinite)return"indefinite";let t=e.cycleRepeats??1,r=e.cycleBehavior==="alternate"||e.cycleBehavior==="alternate-reverse"?t/2:t;return r===1?null:String(r)}function $a(e){return e.cycleInfinite||e.fill==="remove"?null:"freeze"}function qd(e){return e.additive==="sum"?"sum":null}function Vo(e){return e.accumulate==="sum"?"sum":null}function M3(e){return e.values.map(t=>{let r=typeof t=="number"?t:parseFloat(String(t));return Number.isFinite(r)?Math.max(0,Math.min(1,r)):0})}function A3(e){let t=r=>Math.max(0,Math.min(1,r));return[e[0],t(e[1]),e[2],t(e[3])]}function C3(e){let[t,r,n,i]=e,a=new Set,o=8;for(let c=1;c<=o;c++)a.add(c/o);let s=r-2*i+1,l=2*(i-2*r),u=r,d=c=>{if(!Number.isFinite(c)||c<=0||c>=1)return;let f=3*(1-c)**2*c*t+3*(1-c)*c**2*n+c**3;f>0&&f<1&&a.add(Number(f.toFixed(6)))};if(Math.abs(s)<1e-9)Math.abs(l)>=1e-9&&d(-u/l);else{let c=l*l-4*s*u;if(c>=0){let f=Math.sqrt(c);d((-l+f)/(2*s)),d((-l-f)/(2*s))}}return[...a].sort((c,f)=>c-f)}function O3(e,t,r,n,i,a){let o=typeof e.value=="number"&&typeof t.value=="number",s=Di(t.value);if(t.easing==="linear-function"&&t.linearPoints&&t.linearPoints.length>=2){if(o){let m=t.linearPoints;for(let g=1;g<m.length;g++){let v=m[g],y=e.time+(t.time-e.time)*v.position,b=e.value+(t.value-e.value)*v.value;n.push(b),i.push(kr(r(y))),a.push("0 0 1 1")}return}n.push(s),i.push(kr(r(t.time))),a.push("0 0 1 1");return}if(t.easing==="steps"){n.push(s),i.push(kr(r(t.time))),a.push("0 0 1 1");return}let l=I3(t);if(!l){n.push(s),i.push(kr(r(t.time))),a.push("0 0 1 1");return}let[,u,,d]=l;if(!(u<0||u>1||d<0||d>1)){n.push(s),i.push(kr(r(t.time))),a.push(xv(l));return}if(!o){n.push(s),i.push(kr(r(t.time))),a.push(xv(A3(l)));return}let c=C3(l),f=e.value,p=t.value,h=t.time-e.time;for(let m of c){let g=ap(l[0],l[1],l[2],l[3],m),v=e.time+h*m,y=f+(p-f)*g;n.push(y),i.push(kr(r(v))),a.push("0 0 1 1")}}function Di(e){return Array.isArray(e)?e.join(" "):e}function T3(e,t,r){let n=[],{count:i,position:a}=r,o=t.time-e.time,s=Di(e.value),l=Di(t.value),u=typeof s=="number"&&typeof l=="number",d=typeof s=="string"&&typeof l=="string",c=h=>d?h<.5?s:l:u?s+(l-s)*h:h>=1?l:s,f=h=>{let m=Math.floor(h*i);(a==="jump-start"||a==="jump-both")&&(m+=1);let g;switch(a){case"jump-start":case"jump-end":g=i;break;case"jump-none":g=i-1;break;case"jump-both":g=i+1;break}return m>g&&(m=g),m<0&&(m=0),m/g},p=f(0);for(let h=1;h<=i;h++){let m=h/i,g=f(m);if(g===p)continue;let v=e.time+m*o;n.push({value:c(g),time:v}),p=g}return n.length===0||n[n.length-1].time<t.time?n.push({value:l,time:t.time}):n[n.length-1]={value:l,time:t.time},n}function P3(e,t){let r=[],n=[],i=(a,o)=>{r.push(a),n.push(kr(t(o)))};i(Di(e[0].value),e[0].time);for(let a=1;a<e.length;a++){let o=e[a-1],s=e[a];if(s.easing==="steps"&&s.stepsParams){let l=T3(o,s,s.stepsParams);for(let u of l)i(u.value,u.time)}else i(Di(s.value),s.time)}return{values:r,keyTimes:n}}function D3(e,t,r){return{values:e.slice().reverse(),keyTimes:t.slice().reverse().map(n=>kr(1-parseFloat(n))),keySplines:r.slice().reverse().map(Rp)}}function Ou(e,t,r,n,i){let a=i.cycleBehavior??"restart";if(a==="restart"||e.length<2)return{values:e,keyTimes:t,keySplines:r,calcMode:n};if(a==="reverse")return{...D3(e,t,r),calcMode:n};if(a==="alternate-reverse"){let u=e.slice().reverse(),d=t.slice().reverse().map(f=>kr(.5-parseFloat(f))),c=r.slice().reverse().map(Rp);return{values:[...u,...e.slice(1)],keyTimes:[...d,...t.slice(1).map(f=>kr(.5+parseFloat(f)))],keySplines:[...c,...r],calcMode:n}}let o=e.slice(0,-1).reverse(),s=t.slice(0,-1).reverse().map(u=>kr(1-parseFloat(u))),l=r.slice().reverse().map(Rp);return{values:[...e,...o],keyTimes:[...t,...s],keySplines:[...r,...l],calcMode:n}}function Vn(e){let t=e.keyframes,r=cd(e)?t.map((u,d)=>({...u,time:(t[0]?.time??0)+(t.length>1?d/(t.length-1):0)})):t;if(r.length===0)return{values:[],keyTimes:[],keySplines:[],calcMode:"spline"};let n=cd(e)?1:_i(e),i=r[0]?.time??0,a=u=>n>0?(u-i)/n:0;if(r.some(u=>u.easing==="steps")){let{values:u,keyTimes:d}=P3(r,a);return Ou(u,d,[],"discrete",e)}if(e.calcMode==="discrete"){let u=r.map(c=>Di(c.value)),d=r.map(c=>kr(a(c.time)));return Ou(u,d,[],"discrete",e)}if(e.calcMode==="paced"){let u=r.map(c=>Di(c.value)),d=r.map(c=>kr(a(c.time)));return Ou(u,d,[],"paced",e)}let o=[Di(r[0].value)],s=[kr(a(r[0].time))],l=[];for(let u=1;u<r.length;u++)O3(r[u-1],r[u],a,o,s,l);return Ou(o,s,l,"spline",e)}function r1(e,t={}){let r=t.defaultCalcMode??"linear",n={};if(e.calcMode==="paced")return r!=="paced"&&(n.calcMode="paced"),n;if(e.calcMode==="discrete")return n.keyTimes=e.keyTimes.join(";"),n.calcMode="discrete",n;let i=e.keySplines.length>0&&!ZI(e.keySplines);return JI(e.keyTimes)||(n.keyTimes=e.keyTimes.join(";")),i&&(n.calcMode="spline",n.keySplines=e.keySplines.join(";")),n}function Bu(e,t){if(e.shapeId!==t.shapeId||e.keyframes.length!==t.keyframes.length||(e.cycleDuration??-1)!==(t.cycleDuration??-1)||e.simpleDuration!==t.simpleDuration||(e.cycleRepeats??1)!==(t.cycleRepeats??1)||!!e.cycleInfinite!=!!t.cycleInfinite||(e.cycleBehavior??"restart")!==(t.cycleBehavior??"restart")||(e.additive??"replace")!==(t.additive??"replace")||(e.calcMode??"linear")!==(t.calcMode??"linear")||!!e.locked!=!!t.locked)return!1;let r=(n,i)=>{if(!n||!i)return!n&&!i;if(n.type!==i.type||n.value!==i.value)return!1;let a=n.smilRelations,o=i.smilRelations;return!a||!o?!a&&!o:a.length!==o.length?!1:a.every((s,l)=>{let u=o[l];return!u||s.kind!==u.kind||s.sourceAnimationId!==u.sourceAnimationId||s.offset!==u.offset?!1:s.kind==="syncbase"?u.kind==="syncbase"&&s.event===u.event:u.kind==="repeat"&&s.iteration===u.iteration})};if(!r(e.beginTrigger,t.beginTrigger)||!r(e.endTrigger,t.endTrigger))return!1;for(let n=0;n<e.keyframes.length;n++){let i=e.keyframes[n],a=t.keyframes[n];if(i.time!==a.time||i.easing!==a.easing)return!1;let o=i.customBezier,s=a.customBezier;if(!!o!=!!s)return!1;if(o&&s){for(let l=0;l<4;l++)if(o[l]!==s[l])return!1}if(JSON.stringify(i.linearPoints??null)!==JSON.stringify(a.linearPoints??null)||JSON.stringify(i.stepsParams??null)!==JSON.stringify(a.stepsParams??null))return!1}return!0}function j3(e){let t=new Map,r=new Set,n=new Map;for(let i of e){if(!i.enabled||i.keyframes.length<2||i.property!=="translateX"&&i.property!=="translateY"&&i.property!=="scaleX"&&i.property!=="scaleY")continue;let a=n.get(i.shapeId)??[];a.push(i),n.set(i.shapeId,a)}for(let i of n.values()){let a=new Set;for(let o=0;o<i.length;o++){let s=i[o];if(a.has(s.id))continue;let l=s.property==="translateX"||s.property==="translateY",u=l?"translateX":"scaleX",d=l?"translateY":"scaleY";if(!(s.property!==u&&s.property!==d))for(let c=o+1;c<i.length;c++){let f=i[c];if(a.has(f.id)||!(s.property===u&&f.property===d||s.property===d&&f.property===u)||!Bu(s,f))continue;let p=s.property===u?s:f,h=s.property===d?s:f;t.set(p.id,h),r.add(h.id),a.add(p.id),a.add(h.id);break}}}return{partner:t,skip:r}}function E3(e,t,r,n){if(n){let a=t?n.values:e.values,o=t?e.values:n.values,s=Math.min(a.length,o.length),l=[];for(let u=0;u<s;u++)l.push(`${a[u]} ${o[u]}`);return l}let i=r?"1":"0";return e.values.map(a=>t?`${i} ${a}`:`${a} ${i}`)}function z3(e){let t=e.startsWith("svgViewBox")?`viewBox${e.slice(10)}`:e;return t==="viewBoxX"||t==="viewBoxY"||t==="viewBoxWidth"||t==="viewBoxHeight"?t:null}function _3(e){return e.sourceSmilElement&&e.sourceSmilOrder!==void 0?`${e.sourceSmilElement}|${e.sourceSmilOrder}|${e.sourceSmilPlacement??"target"}|${e.sourceSmilParentTarget===!0}`:e.sourceSmilId?`id|${e.sourceSmilId}`:"editor"}function R3(e){let t=new Map;for(let i of e){if(!i.enabled||i.keyframes.length<2)continue;let a=z3(i.property);if(!a)continue;let o=`${i.shapeId}\0${_3(i)}`,s=t.get(o)??{};s[a]||(s[a]=i,t.set(o,s))}let r=new Map,n=new Set;for(let i of t.values()){let{viewBoxX:a,viewBoxY:o,viewBoxWidth:s,viewBoxHeight:l}=i;!a||!o||!s||!l||!Bu(a,o)||!Bu(a,s)||!Bu(a,l)||(r.set(a.id,{viewBoxX:a,viewBoxY:o,viewBoxWidth:s,viewBoxHeight:l}),n.add(o.id),n.add(s.id),n.add(l.id))}return{quartet:r,skip:n}}function F3(e){let t=[Vn(e.viewBoxX),Vn(e.viewBoxY),Vn(e.viewBoxWidth),Vn(e.viewBoxHeight)],r=t[0],n=i=>JSON.stringify([i.keyTimes,i.keySplines,i.calcMode,i.values.length]);return t.some(i=>n(i)!==n(r))?null:{...r,values:r.values.map((i,a)=>t.map(o=>o.values[a]).join(" "))}}function L3(e,t,r){let n=e?.cssAnimationSources;if(!e||!n||n.length===0||e.cssAnimationDocumentStylesFingerprint!==Ab(t)||e.cssAnimationInlineStylesFingerprint!==Mb(r))return null;let i=new Map,a=new Set;for(let s of n){if(!s.id||i.has(s.id)||s.trackFingerprints.length!==s.trackIds.length)return null;i.set(s.id,s);for(let l of s.trackIds){if(!l||a.has(l))return null;a.add(l)}}let o=new Set;for(let s of e.tracks){let l=s.sourceCssAnimationId;if(!l)continue;let u=i.get(l),d=u?.trackIds.indexOf(s.id)??-1;if(!u||d<0||!s.enabled||!s.template||u.trackFingerprints[d]!==Cb(s))return null;o.add(s.id)}if(o.size!==a.size)return null;for(let s of a)if(!o.has(s))return null;return a}var fl={x:"x",y:"y",cx:"cx",cy:"cy",x1:"x1",y1:"y1",x2:"x2",y2:"y2",posX:"x",posY:"y",radius:"r",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",pathLength:"pathLength",svgX:"x",svgY:"y",svgWidth:"width",svgHeight:"height",svgPreserveAspectRatio:"preserveAspectRatio",referenceTargetShapeId:"href",clipPathUnits:"clipPathUnits",spreadMethod:"spreadMethod",in:"in",opacity:"opacity",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",mask:"mask",display:"display",visibility:"visibility",className:"class",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size",letterSpacing:"letter-spacing",wordSpacing:"word-spacing",textLength:"textLength",textPathStartOffset:"startOffset",d:"d",pathMorph:"d",polylinePoints:"points"};function B3(e,t){return t&&(t.type==="circle"||t.type==="ellipse")&&(e.property==="x"||e.property==="y")?e.property==="x"?"cx":"cy":e.targetAttribute??fl[e.property]}var n1=new Set(["transformMatrix","rotation","skewX","skewY"]),i1=new Set(["translateX","translateY","scaleX","scaleY"]);function Qs(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ce(e,t){return t==null?"":` ${e}="${Qs(t)}"`}function pl(e,t){let r=r1(e,t);return Ce("keyTimes",r.keyTimes)+Ce("calcMode",r.calcMode)+Ce("keySplines",r.keySplines)}function Ri(e,t){return Ce("dur",cd(e)?null:`${t}s`)+Ce("begin",fd(e)||null)+Ce("end",S3(e)||null)+Ce("repeatCount",N3(e))}function Ss(e,t){let r=t??fl[e.property];if(!r)return"";let n=_i(e);if(!Bo(e))return"";let i=Vn(e);return i.values.length<2?"":"<animate"+Ce("attributeName",r)+Ce("values",i.values.map(a=>e.property==="textPathStartOffset"&&e.textPathStartOffsetUnit==="%"?`${a}%`:a).join(";"))+pl(i)+Ri(e,n)+Ce("additive",qd(e))+Ce("accumulate",Vo(e))+Ce("fill",$a(e))+"/>"}function V3(e,t){let r=_i(e);if(!Bo(e))return"";let n=F3(t);return!n||n.values.length<2?"":'<animate attributeName="viewBox"'+Ce("values",n.values.join(";"))+pl(n)+Ri(e,r)+Ce("additive",qd(e))+Ce("accumulate",Vo(e))+Ce("fill",$a(e))+"/>"}function U3(e,t){let r;switch(e.property){case"transformMatrix":r="matrix";break;case"rotation":r="rotate";break;case"skewX":r="skewX";break;case"skewY":r="skewY";break;default:return""}let n=_i(e);if(!Bo(e))return"";let i=Vn(e),a=r==="matrix"?i.values.map(u=>X3(u)):i.values.map(u=>String(u));if(a.length<2||a.some(u=>u.length===0))return"";let o=e.transformOrigin?{x:e.transformOrigin.x-(e.targetTransformOrigin?.x??0),y:e.transformOrigin.y-(e.targetTransformOrigin?.y??0)}:null,s=r==="rotate"&&o?a.map(u=>`${u} ${o.x} ${o.y}`):a,l=e.replacesCarrierBase&&t?"sum":qd(e);return'<animateTransform attributeName="transform"'+Ce("type",r)+Ce("values",s.join(";"))+pl(i)+Ri(e,n)+Ce("additive",l)+Ce("accumulate",Vo(e))+Ce("fill",$a(e))+"/>"}function G3(e,t,r){let n=e.property==="scaleX"||e.property==="scaleY",i=e.property==="translateY"||e.property==="scaleY",a=n?"scale":"translate",o=_i(e);if(!Bo(e))return"";let s=Vn(e);if(s.values.length<2)return"";let l=t?Vn(t):void 0,u=E3(s,i,n,l);if(u.length<2)return"";let d=!e.replacesCarrierBase||r?"sum":null;return'<animateTransform attributeName="transform"'+Ce("type",a)+Ce("values",u.join(";"))+pl(s)+Ri(e,o)+Ce("additive",d)+Ce("accumulate",Vo(e))+Ce("fill",$a(e))+"/>"}function X3(e){if(Array.isArray(e)&&e.length>=6){let t=e.slice(0,6);if(t.every(r=>typeof r=="number"&&Number.isFinite(r)))return t.join(" ")}if(typeof e=="string"){let t=e.trim(),r=/^matrix\(([^)]+)\)$/i.exec(t),n=(r?r[1]:t).split(/[\s,]+/).filter(Boolean).map(Number);if(n.length>=6&&n.slice(0,6).every(Number.isFinite))return n.slice(0,6).join(" ")}return""}function W3(e,t){if(!e.motionPath)return"";let r=_i(e);if(!Bo(e))return"";let n=Vn(e),i=M3(n),a=!!e.motionPathRef&&(e.motionPathRef.mode??"trackShape")==="curveTemplate",o=r1(n,{defaultCalcMode:"paced"});n.calcMode!=="paced"&&o.calcMode===void 0&&(o.calcMode="linear");let s=k3(i)&&JI(n.keyTimes)&&n.calcMode!=="discrete"&&(o.calcMode===void 0||o.calcMode==="linear"),l=n.calcMode==="spline"&&n.keySplines.length>0&&!ZI(n.keySplines)&&o.keyTimes===void 0||!s&&o.keyTimes===void 0?n.keyTimes.join(";"):o.keyTimes,u="<animateMotion";if(a||(u+=Ce("path",e.motionPath)),u+=Ce("keyTimes",l),s||(u+=Ce("keyPoints",i.join(";"))),u+=Ce("calcMode",o.calcMode)+Ce("keySplines",o.keySplines),u+=Ri(e,r),u+=Ce("accumulate",Vo(e)),u+=Ce("fill",$a(e)),e.motionRotate!==void 0&&(u+=Ce("rotate",typeof e.motionRotate=="number"?String(e.motionRotate):e.motionRotate)),a){let d=t?.(e.motionPathRef.shapeId)??e.motionPathRef.shapeId;u+=`><mpath${Ce("id",e.sourceMpathId)} href="#${Qs(d)}"/></animateMotion>`}else u+="/>";return u}function pd(e,t,r){if(n1.has(e.property)||i1.has(e.property)||e.property==="pathMotion")return"";let n=r??e.targetAttribute??fl[e.property];if(!n)return"";let i=e.keyframes[t];return i?"<set"+Ce("attributeName",n)+Ce("to",e.property==="textPathStartOffset"&&e.textPathStartOffsetUnit==="%"?`${String(i.value)}%`:Array.isArray(i.value)?i.value.join(" "):String(i.value))+Ce("begin",$3(e,t)||null)+"/>":""}function a1(e){if(e.sourceSmilElement!=="set"||e.fill!=="remove"||e.cycleDuration===void 0||e.cycleDuration<=0||e.cycleInfinite||e.cycleRepeats!==void 0||e.keyframes.length!==2)return!1;let t=e.keyframes[0],r=e.keyframes[1];return Math.abs(r.time-t.time-e.cycleDuration)<=1e-9}function o1(e){return e.sourceSmilElement==="animate"&&e.cycleDuration!==void 0&&e.cycleDuration>0&&e.keyframes.length===1}function s1(e,t){let r=t??e.targetAttribute??fl[e.property],n=e.keyframes[0];if(!r||!n||e.cycleDuration===void 0)return"";let i=Array.isArray(n.value)?n.value.join(" "):String(n.value);return"<animate"+Ce("attributeName",r)+Ce("values",i)+Ri(e,e.cycleDuration)+Ce("fill",$a(e))+"/>"}function l1(e,t){let r=t??e.targetAttribute??fl[e.property],n=e.keyframes[0];return!r||!n||e.cycleDuration===void 0?"":"<set"+Ce("attributeName",r)+Ce("to",e.property==="textPathStartOffset"&&e.textPathStartOffsetUnit==="%"?`${String(n.value)}%`:Array.isArray(n.value)?n.value.join(" "):String(n.value))+Ri(e,e.cycleDuration)+"/>"}function H3(e,t){let r={...e,locked:e.locked??!1,keyframes:[...e.keyframes].sort((n,i)=>n.time-i.time).map(n=>({...n,easing:n.easing}))};return!r.enabled||r.keyframes.length===0?"":e1(r)?pd(r,0,t):a1(r)?l1(r,t):o1(r)?s1(r,t):t1(r)?r.keyframes.map((n,i)=>pd(r,i,t)).join(""):r.keyframes.length<2?"":Ss(r,t)}function q3(e){let t=fd(e);return t?`<discard begin="${Qs(t)}"/>`:"<discard/>"}function Y3(e){if(!e.transformFunction)return"";let t=_i(e);if(!Bo(e))return"";let r=Vn(e);return r.values.length<2?"":'<animateTransform attributeName="transform"'+Ce("type",e.transformFunction)+Ce("values",r.values.join(";"))+pl(r)+Ri(e,t)+Ce("additive",qd(e))+Ce("accumulate",Vo(e))+Ce("fill",$a(e))+"/>"}function Yd(e,t={}){let r=[],n=t.placement??"target",i=e.tracks.filter(p=>n==="target"?p.sourceSmilPlacement===void 0:p.sourceSmilPlacement===n).map(p=>{let h=m=>{if(p.property!=="referenceTargetShapeId"||typeof m!="string")return m;let g=t.referenceTargetElementId?.(m);return g?`#${g}`:m};return{...p,locked:p.locked??!1,...p.property==="referenceTargetShapeId"&&p.transformBaseValue!==void 0?{transformBaseValue:h(p.transformBaseValue)}:{},keyframes:[...p.keyframes].sort((m,g)=>m.time-g.time).map(m=>({...m,time:m.time,value:h(m.value),easing:m.easing}))}}),a=[...i.flatMap(p=>{let h=NA(p);return h?[h]:[]}),...i],o=J3(a,t.targetShape),s=j3(o),l=R3(o),u=new Set,d=new Set,c=new Set,f=(p,h,m)=>{if(!h)return;let g=h;if(m.sourceSmilId&&!u.has(m.sourceSmilId)&&(u.add(m.sourceSmilId),g=h.replace(/^(<[a-zA-Z]+)/,`$1 id="${Qs(m.sourceSmilId)}"`)),n!=="target"&&!(n==="document"&&m.sourceSmilParentTarget===!0)){let v=t.targetElementId?.(p);if(!v)return;g=g.replace(/^(<[a-zA-Z]+)/,`$1 href="#${Qs(v)}"`)}r.push({shapeId:p,textSpanIds:m.textSpanTarget?.spanIds??null,markup:g,sourceOrder:m.sourceSmilOrder??null,definitionOrder:m.sourceSmilDefinitionOrder??null,definitionContainerId:m.sourceSmilDefinitionContainerId??null,sequence:r.length})};for(let p of o){if(!p.enabled||s.skip.has(p.id)||l.skip.has(p.id)||p.keyframes.length<1)continue;let h=B3(p,t.targetShape?.(p.shapeId));if(p.property==="discard"){f(p.shapeId,q3(p),p);continue}if(e1(p)){f(p.shapeId,pd(p,0,h),p);continue}if(a1(p)){f(p.shapeId,l1(p,h),p);continue}if(o1(p)){f(p.shapeId,s1(p,h),p);continue}if(t1(p)){for(let y=0;y<p.keyframes.length;y++)f(p.shapeId,pd(p,y,h),p);continue}if(p.keyframes.length<2)continue;let m=p.id.endsWith(":backwards-fill")?d:c,g="",v=l.quartet.get(p.id);v?g=V3(p,v):p.property==="targetTransformStack"?g=Y3(p):p.targetAttribute?g=Ss(p,p.targetAttribute):p.property==="targetDisplay"?g=Ss(p,"display"):p.property==="targetVisibility"?g=Ss(p,"visibility"):p.property==="pathMotion"&&p.motionPath?g=W3(p,t.motionPathTargetElementId):n1.has(p.property)?(g=U3(p,m.has(p.shapeId)),g&&m.add(p.shapeId)):i1.has(p.property)?(g=G3(p,s.partner.get(p.id),m.has(p.shapeId)),g&&m.add(p.shapeId)):g=Ss(p,h),f(p.shapeId,g,p)}return r}function _s(e,t={}){let r=new Map;for(let n of Yd(e,t)){let i=r.get(n.shapeId)??[];i.push(n.markup),r.set(n.shapeId,i)}return r}function u1(e,t={}){let r=new Map;for(let n of Yd(e,t)){if(!n.textSpanIds)continue;let i=r.get(n.shapeId)??new Map;for(let a of n.textSpanIds){let o=i.get(a)??[];o.push(n.markup),i.set(a,o)}r.set(n.shapeId,i)}return r}function K3(e,t={}){return Yd(e,{...t,placement:"document"}).sort((r,n)=>(r.sourceOrder??Number.POSITIVE_INFINITY)-(n.sourceOrder??Number.POSITIVE_INFINITY)||r.sequence-n.sequence).map(r=>r.markup)}function Z3(e,t={}){return Yd(e,{...t,placement:"defs"}).sort((r,n)=>(r.definitionOrder??Number.POSITIVE_INFINITY)-(n.definitionOrder??Number.POSITIVE_INFINITY)||r.sequence-n.sequence).map(r=>({markup:r.markup,...r.definitionOrder!==null?{definitionOrder:r.definitionOrder}:{},...r.definitionContainerId!==null?{definitionContainerId:r.definitionContainerId}:{}}))}function J3(e,t){let r=new Set(e.filter(a=>a.enabled&&KI(a)).map(a=>a.shapeId));if(r.size===0)return e;let n=new Set,i=[];for(let a of r){let o=w3(t?.(a));if(!o)continue;let s=x3(e,a,o);if(s){i.push(s.track);for(let l of s.consumedTrackIds)n.add(l)}}return i.length===0?e:[...e.filter(a=>!n.has(a.id)),...i]}var gr=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function wv(e){let t=Td(`<svg xmlns="${ye}" xmlns:xlink="http://www.w3.org/1999/xlink">${e}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value;return t?new Set(t.index.localReferences.map(r=>r.targetAuthoredId)):new Set}function Q3(e){let t=new Set,r=n=>{for(let i of el(n))t.add(i.targetAuthoredId)};for(let n of e.documentStyles??[])r(n.css);for(let n of e.animationTimeline?.tracks??[])for(let i of n.keyframes)typeof i.value=="string"&&r(i.value);for(let n of e.clipMaskGroups??[])if(n.rawDefinition)for(let i of wv(n.rawDefinition))t.add(i);for(let n of e.paintServerDefs??[])for(let i of wv(n.markup))t.add(i);return t}var Iv=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function _h(e){let t=new Map;for(let r of e)r.kind==="symbol"&&t.set(r.id,r.defKind??"symbol");return{symbolDefKind:r=>t.get(r)}}function qf(e,t){switch(e.kind){case"symbol":return e5(e,t);case"marker":return r5(e,t);case"linear-gradient":return n5(e,t);case"radial-gradient":return i5(e,t);case"pattern":return a5(e);case"filter":return o5(e,t);case"appearance-style":return""}}function e5(e,t){return hd(e,e.id,e.shapes,t)}function d1(e,t){if(!t||t.length===0)return;let r=t.map((a,o)=>({...a,order:o})).sort((a,o)=>a.siblingIndex-o.siblingIndex||a.order-o.order),n=-1,i=0;for(let a of r)a.siblingIndex===n?i++:(n=a.siblingIndex,i=0),e.splice(Math.min(a.siblingIndex+i,e.length),0,a.markup)}function c1(e,t){let r=new Map(e.map(o=>[o.definition.id,o])),n=new Map;for(let o of e)for(let s of o.definition.definitionContentOrder??[])s.kind==="definition"&&s.id!==o.definition.id&&r.has(s.id)&&!n.has(s.id)&&n.set(s.id,o.definition.id);let i=[],a=new Set;for(let o of t){if(!r.has(o))continue;let s=o,l=new Set;for(;n.has(s)&&!l.has(s);)l.add(s),s=n.get(s);a.has(s)||(a.add(s),i.push(s))}return i}var kv=["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"];function Sv(e,t){let r=e.rootAttributes??{},n="";if(t)for(let i of kv){let a=e[i];a!==void 0&&(n+=` ${i}="${gr(a)}"`)}for(let[i,a]of Object.entries(r))i==="id"||kv.includes(i)||/^[A-Za-z_][\w:.-]*$/.test(i)&&(n+=` ${i}="${gr(a)}"`);return n}function f1(e){if(!e.animations||e.animations.length===0)return null;let t={duration:Math.max(0,...e.animations.flatMap(n=>n.keyframes.map(i=>i.time))),loop:e.animations.some(n=>n.cycleInfinite===!0),playbackSpeed:1,tracks:e.animations},r=new Map(Zn(e.kind==="symbol"?[...e.shapes,...Object.values(e.variants??{}).flat()]:e.shapes).ordered.map(n=>[n.id,n]));return{shape:_s({...t,tracks:t.tracks.filter(n=>n.textSpanTarget===void 0)},{placement:"target",targetShape:n=>r.get(n)}),textSpan:u1({...t,tracks:t.tracks.filter(n=>n.textSpanTarget!==void 0)},{placement:"target",targetShape:n=>r.get(n)})}}function Fp(e,t,r,n){return!t&&!r?.definitionChildrenForShape?r:{...r,...r?.definitionChildrenForShape?{definitionChildrenForShape:i=>r.definitionChildrenForShape?.(i,e.id)}:{},...t?{animationElementsForShape:i=>{let a=r?.animationElementsForShape?.(i)??[],o=[...t.shape.get(i.id)??[],...i.id===n?t.shape.get(e.id)??[]:[]];return a.length===0?o.length>0?o:void 0:o.length===0?a:[...a,...o]},textSpanAnimationElementsForShape:(i,a)=>{let o=r?.textSpanAnimationElementsForShape?.(i,a)??[],s=t.textSpan.get(i.id)?.get(a)??[];return o.length===0?s.length>0?s:void 0:s.length===0?o:[...o,...s]}}:{}}}function hd(e,t,r,n,i=new Map){let a=f1(e);if((e.defKind??"symbol")==="shape"){let[p]=r;if(!p||r.length!==1)return`<!-- invalid native-shape definition: ${gr(t)} -->`;let h={...p,state:{...p.state,authoredAttributes:{...p.state.authoredAttributes??{},...e.rootAttributes??{}},...e.metadata?{metadata:{...p.state.metadata??{},...e.metadata}}:{}}};return va(h,{...Fp(e,a,n,h.id),elementIdForShape:m=>m.id===h.id?t:n?.elementIdForShape?.(m)})}let o=Fp(e,a,n),s=new Map(r.map(p=>[p.id,va(p,o)])),l=new Set,u=new Set,d=[];for(let p of e.definitionContentOrder??[]){if(p.kind==="shape"){let m=s.get(p.id);if(!m||l.has(p.id))continue;l.add(p.id),d.push(m);continue}let h=i.get(p.id);!h||u.has(p.id)||(u.add(p.id),d.push(h))}for(let p of r)l.has(p.id)||d.push(s.get(p.id)??"");for(let[p,h]of i)u.has(p)||d.push(h);d1(d,n?.definitionChildrenForLibraryDefinition?.(e.id));let c=a?.shape.get(e.id)?.join("")??"",f=Bd(e.metadata)+c+d.join("");return(e.defKind??"symbol")==="group"?`<g id="${gr(t)}"${Sv(e,!1)}>${f}</g>`:`<symbol id="${gr(t)}"${Sv(e,!0)}>${f}</symbol>`}function p1(e,t){let r=new Map(e.map(o=>[o.definition.id,o])),n=new Set,i=new Set,a=o=>{if(n.has(o.definition.id)||i.has(o.definition.id))return"";i.add(o.definition.id);let s=new Map;for(let l of o.definition.definitionContentOrder??[]){if(l.kind!=="definition")continue;let u=r.get(l.id);if(!u)continue;let d=a(u);d&&s.set(l.id,d)}return i.delete(o.definition.id),n.add(o.definition.id),hd(o.definition,o.emittedId,o.shapes,t,s)};return{render(o){let s=r.get(o);return s?a(s):""},emitted:n}}function t5(e,t,r){return p1(t,r).render(e)}function $v(e,t,r){let n=p1(e,t),i=c1(e,r??e.map(o=>o.definition.id)),a="";for(let o of i)a+=n.render(o);if(r===void 0)for(let o of e)a+=n.render(o.definition.id);return a}function r5(e,t){let r=f1(e),n=Fp(e,r,t),i;if(e.builtIn){let u=DI().find(d=>{let c=jI[d.id]??d.id;return e.id===c||e.id===d.id});if(u){let d=Object.entries(u.element.attrs).map(([c,f])=>` ${c}="${gr(String(f))}"`).join("");i=`<${u.element.tag}${d}/>`}else i=""}else{let u=e.shapes.map(d=>va(d,n));d1(u,t?.definitionChildrenForLibraryDefinition?.(e.id)),i=u.join("")}let a=e.authoredGeometry??{},o={refX:a.refX??String(e.refX),refY:a.refY??String(e.refY),markerWidth:a.markerWidth??String(e.markerWidth),markerHeight:a.markerHeight??String(e.markerHeight),markerUnits:a.markerUnits??e.markerUnits,orient:a.orient??(typeof e.orient=="number"?String(e.orient):e.orient)},s="";e.viewBox!==void 0&&(s+=` viewBox="${gr(e.viewBox)}"`),e.preserveAspectRatio!==void 0&&(s+=` preserveAspectRatio="${gr(e.preserveAspectRatio)}"`);let l=new Set(["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"]);for(let[u,d]of Object.entries(e.rootAttributes??{}))l.has(u)||!/^[A-Za-z_][\w:.-]*$/.test(u)||(s+=` ${u}="${gr(d)}"`);return e.overflow!==void 0&&e.rootAttributes?.overflow===void 0&&(s+=` overflow="${gr(e.overflow)}"`),i=Bd(e.metadata)+(r?.shape.get(e.id)?.join("")??"")+i,`<marker id="${gr(e.id)}"${s} refX="${gr(o.refX)}" refY="${gr(o.refY)}" markerWidth="${gr(o.markerWidth)}" markerHeight="${gr(o.markerHeight)}" markerUnits="${gr(o.markerUnits)}" orient="${gr(o.orient)}">${i}</marker>`}function n5(e,t){return Kd(qI(ez(e.id,e.gradient),t),e.metadata)}function i5(e,t){return Kd(qI(tz(e.id,e.gradient),t),e.metadata)}function a5(e){let t={...e.pattern,type:"pattern",id:e.id};return Kd(c3(e.id,t),e.metadata)}function o5(e,t){return Kd(u_(e.id,e.filters,{colorInterpolation:e.colorInterpolation,filterUnits:e.filterUnits,primitiveUnits:e.primitiveUnits,x:e.x,y:e.y,width:e.width,height:e.height},{root:t?.definitionAnimationElements?.(e.id),primitive:r=>t?.definitionAnimationElements?.(e.id,r)}),e.metadata)}function Kd(e,t){let r=Bd(t);if(!r)return e;let n=e.match(/^<([\w:-]+)([^>]*)\/>$/u);if(n)return`<${n[1]}${n[2]}>${r}</${n[1]}>`;let i=e.indexOf(">");return i<0?e:e.slice(0,i+1)+r+e.slice(i+1)}function s5(e,t,r=[]){let n=new Map;for(let f of t)n.set(f.id,f);let i=new Map,a=new Set,o=f=>{if(!f)return;let p=n.get(f);if(!(!p||a.has(f))){if(a.add(f),(p.kind==="linear-gradient"||p.kind==="radial-gradient")&&p.gradient.templateId&&o(p.gradient.templateId),p.kind==="pattern"&&p.pattern.templateId&&o(p.pattern.templateId),p.kind==="appearance-style"){oA(p,o),a.delete(f);return}if(i.set(f,p),p.kind==="symbol")for(let h of p.definitionContentOrder??[])h.kind==="definition"&&o(h.id);a.delete(f)}},s=(f,p)=>{if(!f||typeof f!="object")return;let h=f;if(!h.id||i.has(h.id))return;let m=p==="linear-gradient"?"linear-gradient":p==="radial-gradient"?"radial-gradient":p==="pattern"?"pattern":null;if(!m)return;let{id:g,sourceId:v,...y}=f,b;if(m==="linear-gradient")b={kind:"linear-gradient",id:h.id,name:v??h.id,sourceId:v,gradient:y};else if(m==="radial-gradient")b={kind:"radial-gradient",id:h.id,name:v??h.id,sourceId:v,gradient:y};else{let{customPatternId:I,...x}=y;b={kind:"pattern",id:h.id,name:v??h.id,sourceId:v,pattern:x}}i.set(h.id,b)},l=(f,p)=>{let h=f.filters;if(!(!Array.isArray(h)||h.length===0))for(let m of cV(h,p))u(f,m)},u=(f,p)=>{let h=p.id;i.has(h)||i.set(h,{kind:"filter",id:h,name:h,filters:p.filters,...f.filterColorInterpolation&&f.filterColorInterpolation!=="auto"?{colorInterpolation:f.filterColorInterpolation}:{},...f.filterUnits?{filterUnits:f.filterUnits}:{},...f.primitiveUnits?{primitiveUnits:f.primitiveUnits}:{},...typeof f.filterX=="string"?{x:f.filterX}:{},...typeof f.filterY=="string"?{y:f.filterY}:{},...typeof f.filterWidth=="string"?{width:f.filterWidth}:{},...typeof f.filterHeight=="string"?{height:f.filterHeight}:{}})},d=f=>{let p=f.state;if(!p)return;o(p.fillLibraryId),o(p.strokeLibraryId),o(p.markerStart),o(p.markerMid),o(p.markerEnd);let h=p.textPathReference;if(h?.kind==="definition"&&typeof h.targetId=="string"&&o(h.targetId),f.type==="symbol-instance"){let v=p.symbolId;v&&Kb(f)===v&&o(v)}else o(p.symbolId);let m=p.filterLibraryIds;if(Array.isArray(m))for(let v of m)typeof v=="string"&&o(v);p.fillLibraryId||s(p.fillGradient,p.fillType),p.strokeLibraryId||s(p.strokeGradient,p.strokeType),(!Array.isArray(m)||m.length===0)&&l(p,f.id),kb(p,o);let g=p.appearance;if(Array.isArray(g))for(let v of g){if(!v||typeof v!="object")continue;let y=v;y.libraryId||s(y.gradient,y.paintType)}o(p.graphicStyleId)};for(let f of e)d(f);let c=Array.from(r);for(let f of c)o(f);return cx(e,t,d),xT(c,t,d),Array.from(i.values())}function l5(e){let t=new Map,r=(o,s)=>{let l=o.type??s;return l==="linear-gradient"||l==="radial-gradient"||l==="pattern"?l:null},n=(o,s,l)=>{if(typeof o!="string"||o.length===0||!s||typeof s!="object"||t.has(o))return;let u=s,d=r(u,l);if(!d)return;let{id:c,sourceId:f,type:p,...h}=u,m=typeof f=="string"?f:o;if(d==="linear-gradient")t.set(o,{kind:d,id:o,name:m,...typeof f=="string"?{sourceId:f}:{},gradient:{type:"linear-gradient",...h}});else if(d==="radial-gradient")t.set(o,{kind:d,id:o,name:m,...typeof f=="string"?{sourceId:f}:{},gradient:{type:"radial-gradient",...h}});else{let{customPatternId:g,...v}=h;t.set(o,{kind:"pattern",id:o,name:m,...typeof f=="string"?{sourceId:f}:{},pattern:v})}},i=o=>{let s=o.filterLibraryIds;if(!Array.isArray(s)||s.length!==1||typeof s[0]!="string")return;let l=s[0],u=o.filters;!Array.isArray(u)||u.length===0||t.has(l)||t.set(l,{kind:"filter",id:l,name:l,filters:u,...o.filterColorInterpolation&&o.filterColorInterpolation!=="auto"?{colorInterpolation:o.filterColorInterpolation}:{},...o.filterUnits?{filterUnits:o.filterUnits}:{},...o.primitiveUnits?{primitiveUnits:o.primitiveUnits}:{},...typeof o.filterX=="string"?{x:o.filterX}:{},...typeof o.filterY=="string"?{y:o.filterY}:{},...typeof o.filterWidth=="string"?{width:o.filterWidth}:{},...typeof o.filterHeight=="string"?{height:o.filterHeight}:{}})},a=o=>{let s=o.state;if(!s)return;n(s.fillLibraryId,s.fillGradient,s.fillType),n(s.strokeLibraryId,s.strokeGradient,s.strokeType),i(s);let l=s.children;if(Array.isArray(l))for(let u of l)a(u)};for(let o of e)a(o);return Array.from(t.values())}var u5=new Map([["xlink","http://www.w3.org/1999/xlink"],["dc","http://purl.org/dc/elements/1.1/"],["cc","http://creativecommons.org/ns#"],["rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"],["inkscape","http://www.inkscape.org/namespaces/inkscape"],["sodipodi","http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"]]),Rh=/([A-Za-z_][\w:.-]*)\s*=\s*"([^"]*)"/g;function d5(e,t){return e.length===0?e:e.replace(Rh,(r,n,i)=>{if(!OI(n,i))return r;let a=rB(n,i,t),o=iB(i,a);return o===i?r:`${n}="${o}"`})}var oo=/<\/?([A-Za-z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g;function md(e){let t=[],r=0,n=0,i="";oo.lastIndex=0;let a;for(;(a=oo.exec(e))!==null;){let o=a[0].startsWith("</"),s=a[3]==="/";if(o){if(r=Math.max(0,r-1),r===0){let l=e.slice(n,oo.lastIndex);t.push({markup:l,tag:i,id:Nv(l)}),n=oo.lastIndex,i=""}continue}if(r===0&&(i=a[1].toLowerCase()),!s)r++;else if(r===0){let l=e.slice(n,oo.lastIndex);t.push({markup:l,tag:i,id:Nv(l)}),n=oo.lastIndex,i=""}}if(n<e.length){let o=e.slice(n);o.trim().length>0&&t.push({markup:o,tag:"",id:null})}return t}function c5(e,t){let r=(t.paintServerDefs??[]).filter(c=>Array.isArray(c.definitionChildIds)&&c.definitionChildIds.length>0);if(r.length===0)return e;let n=new Map,i=new Map;e.defs.entries.forEach((c,f)=>{let p=md(c.markup);n.set(f,p),p.forEach((h,m)=>{!h.id||i.has(h.id)||i.set(h.id,{entryIndex:f,index:m,segment:h,key:`${f}:${m}`})})});let a=new Map(r.map(c=>[c.id,c])),o=new Set,s=new Map,l=new Map,u=(c,f)=>{let p=l.get(c);if(p)return p;if(f.has(c))return null;let h=a.get(c),m=i.get(c);if(!h||!m)return null;let g=m.segment.markup,v=g.indexOf(">"),y=g.lastIndexOf("</");if(v<0||y<=v)return g;let b=g.slice(v+1,y),I=h.sourceDefinitionChildIds??h.definitionChildIds,x=h.definitionChildIds,k=new Map(I.map((N,T)=>[N,T])),$=new Set(f);$.add(c);let A=md(b).map(N=>{if(!N.id)return N.markup;let T=k.get(N.id);if(T===void 0)return N.markup;let z=x[T],C=i.get(z);if(!C||C.key===m.key)return N.markup;let O=a.has(z)?u(z,$):C.segment.markup;return O?(o.add(C.key),N.markup.slice(0,N.markup.indexOf("<"))+O.trimStart()):N.markup}).join(""),S=g.slice(0,v+1)+A+g.slice(y);return l.set(c,S),S};for(let c of r){let f=i.get(c.id);if(!f)continue;let p=u(c.id,new Set);p&&s.set(f.key,p)}let d={...e.defs,entries:e.defs.entries.map((c,f)=>({...c,markup:(n.get(f)??[]).map((p,h)=>{let m=`${f}:${h}`;return o.has(m)?"":s.get(m)??p.markup}).join("")}))};return{...e,defs:d}}function Nv(e){let t=/^[^>]*>/.exec(e.trimStart()),r=t?t[0]:e,n=/\sid\s*=\s*"([^"]*)"/.exec(r);return n?n[1]:null}function gd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fh(e,t){if(t.size===0||e.length===0)return e;let r=e;for(let[n,i]of t){let a=gd(n);r=r.replace(new RegExp(`url\\(\\s*(['"]?)#${a}\\1\\s*\\)`,"g"),(o,s)=>`url(${s}#${i}${s})`),r=r.replace(new RegExp(`((?:xlink:)?href\\s*=\\s*)(["'])#${a}\\2`,"g"),(o,s,l)=>`${s}${l}#${i}${l}`)}return r}function f5(e,t,r){return e.replace(new RegExp(`(\\sid\\s*=\\s*")${gd(t)}(")`),`$1${r}$2`)}function Rs(e,t){let r={...e.defs,entries:e.defs.entries.map(n=>({...n,markup:t(n.markup)}))};return{...e,defs:r,backgroundRect:t(e.backgroundRect),body:e.body.map(n=>n.kind==="shape"?{...n,markup:t(n.markup)}:{...n,open:t(n.open),close:t(n.close),members:n.members.map(i=>({...i,markup:t(i.markup)}))}),envelope:{...e.envelope,extensions:t(e.envelope.extensions),rootDefinitions:t(e.envelope.rootDefinitions),rootAnimations:t(e.envelope.rootAnimations)}}}function h1(e,t){let r=Rs(e,t);return{...r,envelope:{...r.envelope,styles:t(r.envelope.styles)}}}function p5(e){let t=new Set,r=/\sid\s*=\s*"([^"]*)"/g,n=i=>{r.lastIndex=0;let a;for(;(a=r.exec(i))!==null;)t.add(a[1])};for(let i of e.defs.containers)i.svgId&&t.add(i.svgId);for(let i of e.defs.entries)n(i.markup);for(let i of e.body)if(i.kind==="shape")n(i.markup);else{n(i.open);for(let a of i.members)n(a.markup)}return n(e.envelope.descriptive),n(e.envelope.rootAttributes),n(e.envelope.extensions),n(e.envelope.rootDefinitions),n(e.envelope.rootAnimations),t}function h5(e,t){let r=[...t.library??[],...t.paintServerDefs??[]];if(r.length===0)return e;let n=p5(e),i=new Map,a=new Set;for(let s of r){let l=s.sourceId,u=s.id;!l||!u||l===u||a.has(l)||n.has(l)||n.has(u)&&(i.set(u,l),a.add(l))}if(i.size===0)return e;let o=h1(e,s=>Fh(s,i));return Rs(o,s=>{let l=s;for(let[u,d]of i)l=f5(l,u,d);return l})}var m1=new Set(["circle","ellipse","g","image","line","lineargradient","path","polygon","polyline","radialgradient","rect","pattern","marker","symbol","text","use"]),m5=new Set(["circle","ellipse","image","line","path","polygon","polyline","rect","text","use"]),g5=new Set(["defs","g"]);function g1(e,t,r){let n=t;r&&(n=n.replace(new RegExp(`\\sid\\s*=\\s*"${gd(r)}"`),""));let i=[];if(m1.has(e)&&!["lineargradient","radialgradient","pattern","marker"].includes(e)){n=n.replace(/\sxmlns:svg="http:\/\/www\.w3\.org\/2000\/svg"/g,"").replace(/\sxmlns:xlink="http:\/\/www\.w3\.org\/1999\/xlink"/g,"");let a=/\sid\s*=\s*"([^"]*)"/g,o;for(;(o=a.exec(n))!==null;)o[1]!==""&&i.push(o[1]);let s=new Map;i.forEach((u,d)=>s.set(u,`__local_${d}`)),n=Fh(n,s);for(let[u,d]of s)n=n.replace(new RegExp(`(\\sid\\s*=\\s*")${gd(u)}(")`,"g"),`$1${d}$2`);let l=0;n=n.replace(/\s(data-shape-id|data-svgsketch-inner-id)\s*=\s*"[^"]*"/g,(u,d)=>` ${d}="__shape_${l++}"`),n=aa(n,[{}])}return{hash:n.replace(/\s+/g," ").trim(),localIds:i}}function y5(e,t=[e]){let r=t.includes(e)?t:[...t,e],n=t5(e.id,r.filter(o=>o.kind==="symbol").map(o=>({definition:o,emittedId:o.id,shapes:o.shapes})),_h(r)),i=md(n).find(o=>o.id===e.id);if(!i)return`invalid|${n}`;let a=g1(i.tag,i.markup,i.id);return`${i.tag}|${a.hash}`}function y1(e){let t=new Map,r=new Map,n=!1,i=(u,d)=>{u.forEach((c,f)=>{let p=d[f];p!==void 0&&c!==p&&r.set(c,p)})},a=(u,d)=>{let c=[],f=md(u);for(let p of f){let h=p;if(g5.has(h.tag)){let y=h.markup.indexOf(">"),b=h.markup.toLowerCase().lastIndexOf(`</${h.tag}>`);if(y>=0&&b>y){let I=h.markup.slice(y+1,b),x=a(I,h.tag==="defs");if(x!==I&&(n=!0),h={...h,markup:h.markup.slice(0,y+1)+x+h.markup.slice(b)},h.tag==="defs"||!h.id){c.push(h.markup);continue}}}if(!m1.has(h.tag)||!h.id||!d&&m5.has(h.tag)){c.push(h.markup);continue}let m=g1(h.tag,h.markup,h.id),g=`${h.tag}|${m.hash}`,v=t.get(g);if(v===void 0){t.set(g,{id:h.id,localIds:m.localIds}),c.push(h.markup);continue}if(i(m.localIds,v.localIds),v.id===h.id){n=!0;continue}r.set(h.id,v.id),n=!0}return c.join("")},o={...e.defs,entries:e.defs.entries.map(u=>({...u,markup:a(u.markup,!0)}))};if(!n&&r.size===0)return e;let s={...e,defs:o},l=r.size===0?s:h1(s,u=>Fh(u,r));return y1(l)}function Mv(e){return e.replace(/&apos;/g,"'").replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function v5(e){return!e.includes("&")&&!e.includes("<")?e:e.replace(/&/g,"\\26 ").replace(/</g,"\\3c ")}var yd=/(font-family|font-weight|font-style)\s*:\s*([^;"}<]+)/g;function b5(e,t){let r,n,i,a="";if(e.replace(Rh,(o,s,l)=>{switch(s){case"font-family":r=Mv(l);break;case"font-weight":n=l;break;case"font-style":i=l;break;case"style":a=Mv(l);break}return o}),a.includes("font-")){yd.lastIndex=0;let o;for(;(o=yd.exec(a))!==null;){let s=o[2].trim();o[1]==="font-family"?r=s:o[1]==="font-weight"?n=s:i=s}}return{family:r??t.family,weight:Xw(n,t.weight),style:i===void 0?t.style:Ww(i)}}function Yf(e,t,r){if(e.length===0)return;let n=/<(\/?)([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g,i;for(;(i=n.exec(e))!==null;){let[,a,o,s,l]=i;if(a==="/"){t.length>1&&t.pop();continue}let u=b5(s,t[t.length-1]),d=o.toLowerCase();(d==="text"||d==="tspan"||d==="textpath")&&u.family&&r.push({family:u.family,weight:u.weight,style:u.style}),l!=="/"&&t.push(u)}}function x5(e,t){if(!e.includes("font-"))return;let r=e.replace(/@font-face\s*\{[^}]*\}/g,"");for(let n of r.split("}")){let i=n.indexOf("{");if(i<0)continue;let a=n.slice(i+1);if(!a.includes("font-"))continue;let o,s,l;yd.lastIndex=0;let u;for(;(u=yd.exec(a))!==null;){let d=u[2].trim();u[1]==="font-family"?o=d:u[1]==="font-weight"?s=d:l=d}o&&t.push({family:o,weight:Xw(s),style:Ww(l)})}}function w5(e){let t=[],r=i=>{Yf(i,[{weight:Mp,style:"normal"}],t)};for(let i of e.defs.entries)r(i.markup);r(e.envelope.rootDefinitions),r(e.envelope.rootAnimations);let n=[{weight:Mp,style:"normal"}];for(let i of e.body)if(i.kind==="shape")Yf(i.markup,n,t);else for(let a of i.members)Yf(a.markup,n,t);return x5(e.envelope.styles,t),rR(t.filter(i=>!eR(i.family)))}function I5(e,t){let r=w5(e);if(r.length===0)return e;let n=t(r);if(!n||n.trim().length===0)return e;let i=`<style type="text/css">
63
+ ${v5(n.trim())}
64
+ </style>`;return{...e,envelope:{...e.envelope,styles:e.envelope.styles.length>0?`${i}
65
+ ${e.envelope.styles}`:i}}}var k5=new Set(["rect","image","svg","use","text"]),Av="Inter, sans-serif",S5=new Map([["stroke","stroke"],["stroke-width","strokeWidth"],["stroke-opacity","strokeOpacity"],["fill-opacity","fillOpacity"],["font-weight","fontWeight"],["font-style","fontStyle"],["text-anchor","textAnchor"],["font-family","fontFamily"]]);function Cv(e){let t=parseFloat(e);return Number.isFinite(t)&&Math.abs(t-1)<1e-6}function Ov(e){let t=parseFloat(e);return Number.isFinite(t)&&t===0}function Tv(e){return e===void 0||e==="normal"||e==="400"}var $5=/\s+([A-Za-z_][\w:.-]*)\s*=\s*"([^"]*)"/g;function N5(e,t,r,n){let i=e.toLowerCase();if(i==="g")return t;let a=i==="image"||i==="foreignobject";return t.replace($5,(o,s,l)=>{switch(s){case"stroke":return a?"":n?o:l==="none"&&(r.stroke===void 0||r.stroke==="none")?"":o;case"fill":return a?"":o;case"stroke-width":return a?"":n?o:Cv(l)&&(r.strokeWidth===void 0||Cv(r.strokeWidth))?"":o;case"stroke-opacity":case"fill-opacity":return o;case"x":case"y":return k5.has(i)&&Ov(l)?"":o;case"font-weight":return n?o:Tv(l)&&Tv(r.fontWeight)?"":o;case"font-style":return n?o:l==="normal"&&(r.fontStyle===void 0||r.fontStyle==="normal")?"":o;case"text-anchor":return n?o:l==="start"&&(r.textAnchor===void 0||r.textAnchor==="start")?"":o;case"font-family":return n?o:l===Av&&(r.fontFamily===void 0||r.fontFamily===Av)?"":o;case"orient":return i==="marker"&&Ov(l)?"":o;case"markerUnits":return i==="marker"&&l==="strokeWidth"?"":o;default:return o}})}function aa(e,t,r=!1){if(e.length===0)return e;let n=/<(\/?)([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g,i="",a=0,o;for(;(o=n.exec(e))!==null;){let[s,l,u,d,c]=o;if(i+=e.slice(a,o.index),a=o.index+s.length,l==="/"){t.length>1&&t.pop(),i+=s;continue}let f=t[t.length-1],p=N5(u,d,f,r);if(i+=`<${u}${p}${c}>`,c!=="/"){let h={...f};d.replace(Rh,(m,g,v)=>{let y=S5.get(g);return y&&(h[y]=v),m}),t.push(h)}}return i+=e.slice(a),i}function M5(e){let t={...e.defs,entries:e.defs.entries.map(a=>({...a,markup:aa(a.markup,[{}],!0)}))},r=aa(e.envelope.rootDefinitions,[{}],!0),n=[{}],i=e.body.map(a=>{if(a.kind==="shape")return{...a,markup:aa(a.markup,n)};let o=aa(a.open,n),s=a.members.map(u=>({...u,markup:aa(u.markup,n)})),l=aa(a.close,n);return{...a,open:o,members:s,close:l}});return{...e,defs:t,body:i,envelope:{...e.envelope,rootDefinitions:r}}}var A5=new Set(["xml","xmlns"]);function C5(e){let t=new Set,r=new Map,n=/<(\/)?([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g,i=/(?:^|\s)([A-Za-z_][\w.-]*):([A-Za-z_][\w.-]*)\s*=/g,a=/(?:^|\s)xmlns:([A-Za-z_][\w.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,o=(c,f)=>{a.lastIndex=0;let p;for(;(p=a.exec(c))!==null;){let h=p[1],m=p[2]??p[3]??"";f.add(h);let g=r.get(h);g||(g=new Set,r.set(h,g)),g.add(m)}},s=(c,f)=>{i.lastIndex=0;let p;for(;(p=i.exec(c))!==null;)p[1]!=="xmlns"&&!f.has(p[1])&&t.add(p[1])},l=new Set(A5);o(e.envelope.rootAttributes,l),s(e.envelope.rootAttributes,l);let u=c=>{if(c.length===0)return;let f=[new Set(l)];n.lastIndex=0;let p;for(;(p=n.exec(c))!==null;){if(p[1]){f.length>1&&f.pop();continue}let h=new Set(f[f.length-1]);o(p[3],h);let m=p[2].indexOf(":");if(m>0){let g=p[2].slice(0,m);h.has(g)||t.add(g)}s(p[3],h),p[4]||f.push(h)}};for(let c of e.defs.entries)u(c.markup);for(let c of e.body)c.kind==="shape"?u(c.markup):u(`${c.open}${c.members.map(f=>f.markup).join("")}</g>`);u(e.backgroundRect),u(e.envelope.descriptive),u(e.envelope.extensions),u(e.envelope.rootDefinitions),u(e.envelope.rootAnimations),u(e.envelope.scripts),u(e.envelope.styles);let d=[];for(let c of t){let f=r.get(c),p=(f?.size===1?[...f][0]:void 0)??u5.get(c);if(!p){Kr({severity:"warning",code:"undeclarable-namespace-prefix",message:`namespace prefix "${c}:" is used by emitted markup but is neither bound to one unambiguous preserved URI nor a well-known prefix; the output is not namespace-well-formed for this prefix`});continue}d.push(` xmlns:${c}="${p}"`)}return d.length===0?e:(d.sort(),{...e,envelope:{...e.envelope,rootAttributes:e.envelope.rootAttributes+d.join("")}})}function v1(e){return e.replace(/\sdata-shape-id="[^"]*"/g,"")}function O5(e,t,r={}){let n=c5(e,t);if((r.restoreSourceIds??!0)&&(n=h5(n,t)),r.deduplicateDefs===!0&&(n=y1(n)),r.shapeIdAttributes===!1&&(n=Rs(n,v1)),n=Rs(n,i=>i.replace(/\sdata-source-id="[^"]*"/g,"")),r.resolveFontEmbedCss&&(n=I5(n,r.resolveFontEmbedCss)),r.precision!==null){let i=KL(r.precision??t.documentMetadata?.coordinatePrecision??Eh);n=Rs(n,a=>d5(a,i))}return(r.elideInitialValues??!0)&&(n=M5(n)),n=C5(n),n}function T5(e,t){let r=new Set(Object.keys(t)),n=new Map(e.map(s=>[s.id,s])),i=s=>s.authoredId!==void 0?t[s.authoredId]:void 0,a=s=>{let l=new Set,u=s.parentId;for(;u!==null&&!l.has(u);){l.add(u);let d=n.get(u);if(!d)return!1;let c=i(d);if(c?.locked===!0&&c.inherit===!0)return!0;u=d.parentId}return!1},o=0;for(let s of e){let l=i(s),u=a(s);if(!l&&!u)continue;let d=s.state;l?.layerName!==void 0&&(d.layerName=l.layerName),(l?.locked!==void 0||u)&&(d.locked=l?.locked??u),l?.hidden!==void 0&&(d.visible=!l.hidden,l.hidden&&delete d.display),l&&(r.delete(s.authoredId),o++)}return{applied:o,unmatched:[...r]}}function P5(e,t){let r=new Map;for(let a of e.sceneTree??[])r.set(a.id,a.parentId);let n=[],i=(a,o)=>{for(let s of a??[]){let l=s.state;n.push({id:s.id,parentId:r.get(s.id)??o,authoredId:l.metadata?.name,state:l}),i(l.children,s.id)}};return i(e.shapes,null),T5(n,t)}function D5(e,t,r){return e.unmatched.map(n=>({severity:"warning",code:"foreign-structure-unmatched",source:t,entrypoint:r,message:`No imported element carries the id "${n}", so its layer name, lock or visibility was not applied.`,sourceId:n}))}function j5(e){let t=Eh;for(let r of e.index.elements)for(let n of r.attributes)if(OI(n.name,n.value)&&(t=Math.max(t,nB(n.value)),t===Io))return t;return t}function E5(e){let t={};for(let r of e.attributes)Fd(r.name)&&(r.namespaceUri!==null&&r.localName.toLowerCase()==="href"||(t[r.name]=r.value));return t}function z5(e){let t={};for(let r of e.attributes)Ld(r.name)&&(t[r.name]=r.value);return t}var Pv=new WeakMap,Dv=new WeakMap,jv=new WeakMap,_5=new Set(["clippath","defs","filter","lineargradient","marker","mask","pattern","radialgradient","symbol","view"]);function Ev(e,t){let r=e.useOccurrences.occurrence(t);if(!r)return"";let n=e.sourceDocument.index.element(r.correspondingSourceNodeId);return n?j(n,"class")??"":""}function R5(e,t){let r=jv.get(e);if(!r){let n=new Map;for(let i of e.animations.smil){let a=i.targetOccurrenceId;if(!a||i.attributeName?.trim().toLowerCase()!=="class")continue;let o=[i.attributes.from,i.attributes.to,...i.attributes.values?.split(";")??[]].filter(l=>l!==void 0).map(l=>l.trim()).filter(Boolean);if(o.length===0)continue;let s=e.styles.style(a)?.stylesheetCascadedValues??{};for(let l of o){let u=e.styles.stylesheetValuesWithClass(a,l);for(let d of new Set([...Object.keys(s),...Object.keys(u)])){if(!rl(d)||s[d]?.value===u[d])continue;let c=n.get(a)??new Set;c.add(d),n.set(a,c)}}}r=new Map([...n].map(([i,a])=>[i,new Set(a)])),jv.set(e,r)}return r.get(t)??new Set}function F5(e){let t=Pv.get(e);if(t)return t;let r=new Set(e.hierarchy.containers.map(n=>n.occurrenceId));return Pv.set(e,r),r}function zv(e){let t=Dv.get(e);if(t)return t;let r=new Set(F5(e));for(let n of e.symbolUses.definitions)r.add(n.productRootOccurrenceId);for(let n of e.symbolUses.uses)n.status==="symbol-instance"&&r.add(n.useOccurrenceId);return Dv.set(e,r),r}function Vu(e,t){for(let r of e){let n=r.state;typeof n.symbolId=="string"&&(n.symbolId=t.get(n.symbolId)??n.symbolId);let i=n.children;Array.isArray(i)&&Vu(i,t)}}function L5(e,t){let r=[...e];for(;;){let n=new Map,i=new Map;for(let a of r){if(a.kind!=="symbol")continue;let o=y5(a,r),s=`${a.sourceId??a.id}\0${o}`,l=n.get(s);l?i.set(a.id,l):n.set(s,a.id)}if(i.size===0)return r;Vu(t,i),r=r.map(a=>{if(a.kind!=="symbol")return a;Vu(a.shapes,i);for(let o of Object.values(a.variants??{}))Vu(o,i);return a.definitionContentOrder===void 0?a:{...a,definitionContentOrder:a.definitionContentOrder.map(o=>o.kind==="definition"?{...o,id:i.get(o.id)??o.id}:o)}}).filter(a=>a.kind!=="symbol"||!i.has(a.id))}}var B5=new Set(["height","href","id","download","dx","dy","hreflang","ping","preserveaspectratio","referrerpolicy","rel","rotate","requiredextensions","systemlanguage","target","transform","type","viewbox","width","x","xlink:href","y"]),b1=new Set(["color","color-interpolation","color-rendering","display","fill","fill-opacity","fill-rule","filter","marker","marker-end","marker-mid","marker-start","mask","mix-blend-mode","opacity","paint-order","pointer-events","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","image-rendering","transform-origin","isolation","vector-effect","visibility"]),V5=new Set([...b1,"mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","mix-blend-mode"]);function Uu(e){if(e===null)return;let t=e.trim();if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:px)?$/u.test(t))return;let r=Number(t.replace(/px$/iu,""));return Number.isFinite(r)?r:void 0}function vs(e){if(e===null)return;let t=e.trim(),r=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+))%$/u.exec(t),n=r?Number(r[1])/100:Uu(t);return n===void 0?void 0:Math.min(1,Math.max(0,n))}function bs(e,t,r="auto"){if(e===null)return;let n=t.find(i=>i.toLowerCase()===e.trim().toLowerCase());return!n||n===r?void 0:n}function U5(e){if(e===null)return;let t=e.trim();if(!t||t.toLowerCase()==="none")return;if(/(?:^|[^-_a-z0-9])var\(/iu.test(t))return t;let r=Nd(t),n=t.replace(/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:px|pt|pc|in|cm|mm|q|em|rem|%|ex|ch|vw|vh|vmin|vmax)?/giu,"").replace(/[\s,]+/gu,"");if(!(r.length===0||n||r.some(i=>i.value<0))&&!r.every(i=>i.value===0))return t}function x1(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let i=(e[n]??-1)-(t[n]??-1);if(i!==0)return i}return 0}function w1(e){let t=new Map(e.useOccurrences.occurrences.map(r=>[r.occurrenceId,r]));return[...new Set([...e.hierarchy.containers.map(r=>r.occurrenceId),...e.hierarchy.placements.map(r=>r.occurrenceId)])].map(r=>t.get(r)).filter(r=>r!==void 0).sort((r,n)=>x1(r.orderKey,n.orderKey)||r.productIndex-n.productIndex||r.occurrenceId.localeCompare(n.occurrenceId))}function G5(e){let t=new Set;for(let r of e.symbolUses.definitions){t.add(r.productRootOccurrenceId);for(let n of r.contentOccurrenceIds)t.add(n)}return t}function X5(e){let t=G5(e),r=new Map(e.useOccurrences.occurrences.map(d=>[d.occurrenceId,d])),n=d=>{if(d.usePath.length>0)return!1;let c=new Set,f=d.parentOccurrenceId;for(;f&&!c.has(f);){c.add(f);let p=r.get(f);if(!p)return!1;if(p.role==="definition")return!0;f=p.parentOccurrenceId}return!1},i=new Set;for(let d of e.clipMasks.definitions)if(d.representation==="decomposed")for(let c of d.geometrySourceNodeIds)i.add(c);let a=new Set(["clippath","filter","lineargradient","marker","mask","pattern","radialgradient"]),o=new Map,s=new Map(e.useOccurrences.occurrences.map(d=>[d.occurrenceId,d]));for(let d of e.useOccurrences.occurrences){if(!d.parentOccurrenceId)continue;let c=o.get(d.parentOccurrenceId)??[];c.push(d),o.set(d.parentOccurrenceId,c)}let l=new Set;for(let d of e.symbolUses.uses){if(!["symbol-instance","linked-reference"].includes(d.status))continue;let c=[...o.get(d.useOccurrenceId)??[]];for(;c.length>0;){let f=c.pop();l.has(f.occurrenceId)||(l.add(f.occurrenceId),c.push(...o.get(f.occurrenceId)??[]))}}let u=new Set;for(let d of e.useOccurrences.occurrences){let c=d,f=new Set;for(;c&&!f.has(c.occurrenceId);){f.add(c.occurrenceId);let p=e.sourceDocument.index.element(c.correspondingSourceNodeId);if(p&&a.has(p.localName.toLowerCase())){u.add(d.occurrenceId);break}c=c.parentOccurrenceId?s.get(c.parentOccurrenceId):void 0}}return w1(e).filter(d=>!t.has(d.occurrenceId)&&!n(d)&&!(d.usePath.length===0&&i.has(d.correspondingSourceNodeId))&&!l.has(d.occurrenceId)&&!u.has(d.occurrenceId))}function dn(e,t){return t.replace(/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu,(r,n,i)=>{let a=e.identifiers.liveIdForSourceId(i);return a?`url(${n}#${a}${n})`:r})}function W5(e,t,r,n=!1){let i=e.metadata.candidate(t.correspondingSourceNodeId)?.metadata;if(!i||Object.keys(i).length===0)return;let a=structuredClone(i),o=e.identifiers.liveIdForSourceNodeId(t.correspondingSourceNodeId);if(o&&typeof a.name=="string"&&(a.name=o),typeof a.name=="string"&&t.usePath.length>0&&!n){let s=(r.get(a.name)??0)+1;r.set(a.name,s),a.name=`${a.name}-use-${s}`}return a}function H5(e,t){let r=e.scripts.forParent(t).map(n=>({...n.script,customAttrs:n.script.customAttrs?{...n.script.customAttrs}:void 0}));return r.length>0?r:void 0}function q5(e,t,r=!1){let n={};for(let i of e.authoredAttributes.forElement(t)){let a=i.name.toLowerCase();if(i.classification==="style"){r&&(n[i.name]=dn(e,i.value));continue}["namespace","metadata","aria","data","conditional","geometry","element-specific","foreign"].includes(i.classification)||i.classification==="presentation"&&V5.has(a)&&a!=="color"||B5.has(a)||(n[i.name]=dn(e,i.value))}return n}function I1(e,t){let r=e.styles.style(t),n=x=>{let k=x.toLowerCase();return r?.specifiedValues[k]??r?.resolvedValues[k]??null},i={},a=n("fill"),o=n("stroke"),s=e.useOccurrences.occurrence(t),l=s?.parentOccurrenceId?e.styles.style(s.parentOccurrenceId):null,u=r?.cascadedValues.fill!==void 0,d=r?.cascadedValues.stroke!==void 0;a!==null&&(i.fillColor=a==="black"&&r?.cascadedValues.fill===void 0?"#000000":dn(e,a),a.trim().toLowerCase()==="none"&&(i.fillType="none")),o!==null&&o.trim().toLowerCase()!=="none"?i.borderColor=dn(e,o):(i.borderColor="none",i.strokeType="none"),!u&&l&&l.resolvedValues.fill!==void 0&&l.resolvedValues.fill===r?.resolvedValues.fill&&(delete i.fillColor,delete i.fillType,i.inheritFill=!0),!d&&l&&l.resolvedValues.stroke!==void 0&&l.resolvedValues.stroke===r?.resolvedValues.stroke&&(i.borderColor="none",delete i.strokeType,i.inheritStroke=!0);let c=[["fillOpacity","fill-opacity",vs],["strokeOpacity","stroke-opacity",vs],["opacity","opacity",vs],["borderWidth","stroke-width",Uu],["strokeMiterlimit","stroke-miterlimit",Uu],["dashOffset","stroke-dashoffset",Uu],["fillRule","fill-rule",x=>x??void 0],["strokeLinecap","stroke-linecap",x=>x??void 0],["strokeLinejoin","stroke-linejoin",x=>x??void 0],["strokeDasharray","stroke-dasharray",U5],["paintOrder","paint-order",x=>x??void 0],["vectorEffect","vector-effect",x=>x??void 0],["blendMode","mix-blend-mode",x=>x??void 0],["shapeRendering","shape-rendering",x=>bs(x,["auto","optimizeSpeed","crispEdges","geometricPrecision"])],["textRendering","text-rendering",x=>bs(x,["auto","optimizeSpeed","optimizeLegibility","geometricPrecision"])],["imageRendering","image-rendering",x=>bs(x,["auto","optimizeSpeed","optimizeQuality","crisp-edges","pixelated","smooth","high-quality"])],["colorRendering","color-rendering",x=>bs(x,["auto","optimizeSpeed","optimizeQuality"])],["colorInterpolation","color-interpolation",x=>bs(x,["auto","sRGB","linearRGB"],"sRGB")]];for(let[x,k,$]of c){let A=r?.cascadedValues[k];if(!A&&Ws(k)?.inherited===!0&&l!==null&&s?.parentOccurrenceId!==null&&s?.parentOccurrenceId!==void 0&&zv(e).has(s.parentOccurrenceId)&&l.resolvedValues[k]===r?.resolvedValues[k]||!A&&["fill-opacity","stroke-opacity","stroke-width","opacity","stroke-miterlimit","stroke-dashoffset","fill-rule","stroke-linecap","stroke-linejoin","stroke-dasharray","paint-order","vector-effect","mix-blend-mode"].includes(k))continue;let S=$(n(k));S!==void 0&&(x==="paintOrder"&&S==="normal"||(i[x]=S))}i.opacity===1&&r?.cascadedValues.opacity!==void 0&&(i.preserveOpacity=!0);let f=vs(l?.resolvedValues["fill-opacity"]??null);i.fillOpacity===1&&r?.cascadedValues["fill-opacity"]!==void 0&&f!==void 0&&f!==1&&(i.preserveFillOpacity=!0);let p=vs(l?.resolvedValues["stroke-opacity"]??null);if(i.strokeOpacity===1&&r?.cascadedValues["stroke-opacity"]!==void 0&&p!==void 0&&p!==1&&(i.preserveStrokeOpacity=!0),i.inheritFill===!0&&r?.cascadedValues["fill-opacity"]===void 0&&delete i.fillOpacity,i.inheritStroke===!0)for(let[x,k]of[["stroke-opacity","strokeOpacity"],["stroke-width","borderWidth"],["stroke-miterlimit","strokeMiterlimit"],["stroke-dashoffset","dashOffset"],["stroke-linecap","strokeLinecap"],["stroke-linejoin","strokeLinejoin"],["stroke-dasharray","strokeDasharray"]])r?.cascadedValues[x]===void 0&&delete i[k];n("display")?.trim().toLowerCase()==="none"&&(i.display="none");let h=n("visibility")?.trim(),m=r?.cascadedValues.visibility?.value?.trim().toLowerCase();!(l!==null&&s?.parentOccurrenceId!==null&&s?.parentOccurrenceId!==void 0&&zv(e).has(s.parentOccurrenceId)&&l.resolvedValues.visibility===r?.resolvedValues.visibility&&(m===void 0||m==="inherit"||m==="unset"))&&(h==="hidden"||h==="collapse")&&(i.visibility=h);let g=r?.cascadedValues["clip-path"]?.value??null;g&&!/^url\(/iu.test(g.trim())&&(i.cssClipPath=g);let v={};for(let x of["mask","mask-image","mask-mode","mask-repeat","mask-position","mask-clip","mask-origin","mask-size","mask-composite","mask-type"]){let k=r?.cascadedValues[x]?.value??null;k!==null&&(v[x]=dn(e,k))}Object.keys(v).length>0&&(i.cssMaskProperties=v);let y=Object.fromEntries(Object.entries(r?.inlineDeclarations??{}).filter(([x])=>x.startsWith("--")||x.startsWith("-")||Wp(x)).map(([x,k])=>[x,k]));Object.keys(y).length>0&&(i.inlineStyle=y);let b={},I=R5(e,t);for(let[x,k]of Object.entries(r?.cascadedValues??{}))rl(x)&&(I.has(x)?b[x]="stylesheet-dynamic":k.origin==="presentation"?b[x]="attribute":k.origin==="style-attribute"?b[x]="style":k.origin==="stylesheet"&&(b[x]="stylesheet-static"));Object.keys(b).length>0&&(i.presentationChannels=b);for(let[x,k]of[["marker-start","markerStart"],["marker-mid","markerMid"],["marker-end","markerEnd"]]){let $=n(x);if(!$)continue;let A=e.resourceDependencies.edges.filter(N=>N.kind==="marker"&&N.propertyName===x&&N.propertyValue===$&&(N.occurrenceId!==null&&N.occurrenceId===t||N.occurrenceId===null&&N.fromSourceNodeId===r?.correspondingSourceNodeId));if(A.length>0){let N=A[0];if(N.validity!=="valid"||!N.targetSourceNodeId)continue;let T=e.markers.candidate(N.targetSourceNodeId);if(!T||T.status!=="materialized")continue;i[k]=Pr(e,T.sourceNodeId,T.sourceId)??void 0;continue}let S=/url\(\s*(['"]?)#([^'"\s)]+)\1\s*\)/u.exec($)?.[2];S&&(i[k]=e.identifiers.liveIdForSourceId(S)??S)}return i}function Lp(e,t){let r={},n=e.styles.style(t);if(!n)return r;for(let[i,a]of Object.entries(n.cascadedValues))b1.has(i)&&(r[i]=dn(e,a.value));return r}function Y5(e,t){let r=e.symbolUses.use(t.occurrenceId);if(t.role==="use-carrier"&&r){let s=r.transform.matrix??[1,0,0,1,0,0],l=je(s,Wt(r.geometry.x,r.geometry.y));return fn(l)?void 0:cn(l)}let n=e.sourceDocument.index.element(t.correspondingSourceNodeId);if(!n)return;let i=e.styles.style(t.occurrenceId)?.cascadedValues.transform,a=i?.value??j(n,"transform");if(!a||a.trim().toLowerCase()==="none"||i&&i.origin!=="presentation")return;let o=Ei(a);return o&&!fn(o)?cn(o):void 0}function k1(e,t,r,n){let i=r.get(t)?.parentOccurrenceId??null;for(;i;){let o=n.get(i);if(o?.type==="svg"){let s=o.state;if(typeof s.svgViewBoxWidth=="number"&&typeof s.svgViewBoxHeight=="number"&&s.svgViewBoxWidth>0&&s.svgViewBoxHeight>0)return{x:typeof s.svgViewBoxX=="number"?s.svgViewBoxX:0,y:typeof s.svgViewBoxY=="number"?s.svgViewBoxY:0,width:s.svgViewBoxWidth,height:s.svgViewBoxHeight};if(typeof s.svgWidth=="number"&&typeof s.svgHeight=="number"&&s.svgWidth>=0&&s.svgHeight>=0)return{x:0,y:0,width:s.svgWidth,height:s.svgHeight}}i=r.get(i)?.parentOccurrenceId??null}let a=e.rootFrame;return{x:a.viewBoxX??0,y:a.viewBoxY??0,width:a.viewBoxWidth??a.width??300,height:a.viewBoxHeight??a.height??150}}function S1(e,t,r,n){if(t==="view-box")return{boxX:r.x,boxY:r.y,boxWidth:r.width,boxHeight:r.height};if(t!=="fill-box"&&t!=="content-box"&&t!=="stroke-box"&&t!=="border-box")return null;let i=Dh(n,e).bounds;if(!i)return null;let a=t==="stroke-box"||t==="border-box",o=Number(e.state.borderWidth??0),s=a&&Number.isFinite(o)&&o>0?o/2:0;return{boxX:i.minX-s,boxY:i.minY-s,boxWidth:i.maxX-i.minX+s*2,boxHeight:i.maxY-i.minY+s*2}}function K5(e,t,r,n,i){for(let a of[...t].reverse()){let o=n.get(a.occurrenceId);if(!o)continue;let s=e.styles.style(a.occurrenceId);if(!s)continue;let l=s?.cascadedValues.transform,u=s.cascadedValues["transform-origin"];if((!l||l.origin==="presentation")&&!u)continue;let d=e.sourceDocument.index.element(a.correspondingSourceNodeId),c=(l?.value??(d?j(d,"transform"):null))?.trim(),f=k1(e,a.occurrenceId,r,n),p=e.styles.value(a.occurrenceId,"transform-box")??"view-box",h=S1(o,p,f,i);if(!h)continue;let m=e.projectionContext.rootFontSize,g=it(e.styles.value(a.occurrenceId,"font-size"),{percentBasis:m,viewportWidth:f.width,viewportHeight:f.height,fontSize:m,rootFontSize:m})??m,v=u?_b(e.styles.value(a.occurrenceId,"transform-origin")??"0 0",{...h,viewportWidth:f.width,viewportHeight:f.height,fontSize:g,rootFontSize:m}):{x:0,y:0};if(!v)continue;if(u&&(o.state.customPivot=v),!c||c.toLowerCase()==="none"){delete o.state.transformMatrix;continue}let y;if(!l||l.origin==="presentation"){let x=Ei(c);if(!x)continue;if(o.type==="group"){let k=o.state.groupData??={};k.transform=c,o.state.customPivot=v,delete o.state.transformMatrix;continue}y=je(Wt(v.x,v.y),je(x,Wt(-v.x,-v.y)))}else{let x=Lb([{offset:0,transform:c}],{...h,viewportWidth:f.width,viewportHeight:f.height,fontSize:g,rootFontSize:m,transformOrigin:v,retainPureRotationOrigin:!1});if(x.status!=="projected"||x.stops.length!==1)continue;y=x.stops[0].matrix}fn(y)?delete o.state.transformMatrix:o.state.transformMatrix=cn(y);let b=o.state.groupData;b&&"transformOrigin"in b&&(delete b.transformOrigin,Object.keys(b).length===0&&delete o.state.groupData);let I=o.state.containerPresentation;I&&"transform-origin"in I&&(delete I["transform-origin"],Object.keys(I).length===0&&delete o.state.containerPresentation)}}function _n(e,t,r,n=!1,i=!1){let a=I1(e,t.occurrenceId),o=W5(e,t,r,i),s=t.usePath.length===0?e.metadata.candidate(t.correspondingSourceNodeId)?.leadingComments:void 0,l=H5(e,t.correspondingSourceNodeId),u=q5(e,t.correspondingSourceNodeId,n),d=e.conditionalProcessing.condition(t.correspondingSourceNodeId),c=Y5(e,t);return o&&(a.metadata=o),s&&s.length>0&&(a.leadingComments=[...s]),l&&(a.scripts=l),Object.keys(u).length>0&&(a.authoredAttributes=u),d&&d.systemLanguage!==null&&(a.systemLanguage=d.systemLanguage),d&&d.requiredExtensions!==null&&(a.requiredExtensions=d.requiredExtensions),c&&(a.transformMatrix=c),a}function Tu(e,t,r,n,i=!1){let a=_n(e,t,n,!1,i),o=Lp(e,t.occurrenceId);if(Object.keys(o).length>0)if(r==="group"){let l={},u={};for(let[d,c]of Object.entries(o))d==="fill"?l.fill=c:d==="fill-opacity"?l.fillOpacity=c:d==="stroke-opacity"?l.strokeOpacity=c:d==="opacity"?l.opacity=c:d==="mix-blend-mode"?l.mixBlendMode=c:d==="transform-origin"?l.transformOrigin=c:d==="isolation"?l.isolation=c:d==="filter"?l.filter=c:d==="clip-path"?l.clipPath=c:d==="mask"?l.mask=c:u[d]=c;Object.keys(u).length>0&&(l.attributes=u),a.groupData=l}else a.containerPresentation=o;let s=e.sourceDocument.index.element(t.correspondingSourceNodeId);if(!s)return a;if(r==="hyperlink"){let l=j(s,"href"),u=s.attributes.find(c=>c.name==="xlink:href")?.value,d=c=>{if(!c.startsWith("#"))return c;let f=e.identifiers.liveIdForSourceId(c.slice(1));return f?`#${f}`:c};l!==null?a.href=d(l):u!==void 0&&(a.href=d(u)),u!==void 0&&(a.hrefXlink=d(u));for(let[c,f]of[["target","linkTarget"],["download","linkDownload"],["ping","linkPing"],["rel","linkRel"],["hreflang","linkHreflang"],["type","linkType"],["referrerpolicy","linkReferrerPolicy"]]){let p=j(s,c);p!==null&&(a[f]=p)}}else if(r==="switch"){let l=e.conditionalProcessing.condition(s.sourceNodeId);l&&(a.switchSystemLanguage=l.systemLanguage,a.switchRequiredExtensions=l.requiredExtensions)}else if(r==="embedded-svg"){let l=e.embeddedFrames.find(u=>u.sourceNodeId===s.sourceNodeId);l&&Object.assign(a,l.state)}return a}function Kf(e){return e==="embedded-svg"?"svg":e}function Qn(e,t){let r=e.sourceDocument.index.parent(t);if(!r)return;let n=0;for(let i of r.children)if(i.kind==="element"){if(i.sourceNodeId===t)return n;n++}}function $1(e){return e.sourceDocument.index.elements.filter(t=>t.namespaceUri===ye&&t.localName.toLowerCase()==="defs")}function ei(e,t){let r=e.sourceDocument.index.parent(t);for(;r;){if(r.namespaceUri===ye&&r.localName.toLowerCase()==="defs"){let n=$1(e).findIndex(i=>i.sourceNodeId===r.sourceNodeId);return n>=0?`svg-definition-container-${n+1}`:void 0}if(e.symbolUses.definitions.some(n=>n.sourceNodeId===r.sourceNodeId)||e.markers.candidates.some(n=>n.sourceNodeId===r.sourceNodeId))return;r=e.sourceDocument.index.parent(r.sourceNodeId)}}function Z5(e,t,r,n,i){return $1(e).map((a,o)=>{let s=ii(e,a.sourceNodeId),l=H_(a,e.identifiers).filter(d=>!(d.localName==="id"&&d.namespaceUri===null)),u=Lh(e,a.sourceNodeId,t,r,n,i);return{id:`svg-definition-container-${o+1}`,...s?{svgId:s}:{},order:o,...l.length>0?{attributes:[...l]}:{},...u?{authoredPlacement:u}:{}}})}function Lh(e,t,r,n,i,a){let o=e.sourceDocument.index.parent(t);if(!o||o.sourceNodeId===e.sourceDocument.root.sourceNodeId||o.namespaceUri===ye&&o.localName.toLowerCase()==="defs")return null;let s=a?.get(o.sourceNodeId),l=s??r.get(o.sourceNodeId);if(!l)return null;let u=0;for(let d of o.children)if(d.kind==="element"){if(d.sourceNodeId===t){let c=s??i?.get(l);return{parentId:l,...c?{parentDefinitionId:c}:{},siblingIndex:u}}(r.has(d.sourceNodeId)||n.has(d.sourceNodeId))&&u++}return null}function J5(e,t,r){let n=e.sourceDocument.index.parent(t);for(;n&&n.sourceNodeId!==e.sourceDocument.root.sourceNodeId;){let i=r.get(n.sourceNodeId);if(i)return i;if(n.localName.toLowerCase()==="defs")return;n=e.sourceDocument.index.parent(n.sourceNodeId)}}function Q5(e,t,r,n,i){let a=e.styles.stylesheets.map((o,s)=>{let l=e.sourceDocument.index.element(o.sourceNodeId),u=J5(e,o.sourceNodeId,t),d=u?null:Lh(e,o.sourceNodeId,r,n,i,t);return{id:`svg-style-${s+1}`,placement:o.placement,...o.placement==="defs"&&l?{definitionOrder:Qn(e,l.sourceNodeId),definitionContainerId:ei(e,l.sourceNodeId)}:{},...u?{scopeDefinitionId:u}:{},...d?{authoredPlacement:d}:{},...o.id?{svgId:o.id}:{},css:o.authoredText,...o.type?{type:o.type}:{},...o.media?{media:o.media}:{},preserved:!0}});return a.length>0?a:void 0}function eV(e){return{severity:"error",code:"application-rolled-back",source:"svg",entrypoint:"svg-document-import",capability:"geometry",message:e}}function Pr(e,t,r){return e.identifiers.resourceIds.find(n=>n.sourceNodeId===t)?.liveId??r}function ii(e,t){return e.identifiers.liveIdForSourceNodeId(t)??e.identifiers.generatedIds.find(r=>r.sourceNodeId===t)?.liveId??null}function _v(e,t){let r=e.resourceDependencies.templateChain(t)[0];if(r)return r.targetSourceNodeId?ii(e,r.targetSourceNodeId)??r.targetAuthoredId:r.targetAuthoredId}function tV(e,t,r){let n=e.sourceDocument.index.parent(t);for(;n;){if(n.sourceNodeId===r)return!0;n=e.sourceDocument.index.parent(n.sourceNodeId)}return!1}function Rv(e,t){let r=ii(e,t.sourceNodeId);return{...r?{id:r}:{},offset:t.offset,color:t.color,opacity:t.opacity}}function $s(e,t){let r=structuredClone(t.state);if(t.canonicalType==="foreign-object"){let a=e.sourceDocument.index.element(t.sourceNodeId);r.foreignContent=structuredClone(Vw(a?.children??[],e.identifiers))}Array.isArray(r.linePositions)&&(r.linePositions=r.linePositions.map(a=>{let o=a,s=typeof o.sourceNodeId=="string"?o.sourceNodeId:null,l=s?ii(e,s):null;return{x:typeof o.x=="number"?o.x:0,dy:typeof o.dy=="number"?o.dy:0,...typeof o.y=="number"?{y:o.y}:{},...o.authored&&typeof o.authored=="object"?{authored:structuredClone(o.authored)}:{},...l?{id:l}:{}}}));let n=t.textSpanTree;if(!n)return r;let i=a=>{let o=ii(e,a.sourceNodeId);return{spanId:a.sourceNodeId,start:a.start,end:a.end,...o?{id:o}:{},...a.lineIndex===void 0?{}:{lineIndex:a.lineIndex},...a.rotate===void 0?{}:{rotate:[...a.rotate]},children:a.children.map(i)}};return r.textSpanTree={text:n.text,...n.rotate===void 0?{}:{rotate:[...n.rotate]},spans:n.spans.map(i)},r}function Fv(e,t){if(!t||t.status!=="missing")return null;let r=e.useOccurrences.sourceResolution(t.useSourceNodeId);return r?.sourceReferenceId?e.sourceDocument.index.localReferences.find(n=>n.sourceReferenceId===r.sourceReferenceId)?.targetAuthoredId??null:null}function Lv(e,t,r,n,i,a=!1){let o=_n(e,t,i,!1,a);return o.targetShapeId=n,o.broken=!0,o.offsetX=r.geometry.x,o.offsetY=r.geometry.y,r.geometry.width!==null&&(o.width=r.geometry.width),r.geometry.height!==null&&(o.height=r.geometry.height),Object.keys(r.presentation).length>0&&(o.instancePresentation={...r.presentation}),r.transform.matrix&&!fn(r.transform.matrix)?o.transformMatrix=cn(r.transform.matrix):delete o.transformMatrix,o}function Bv(e){let t=e?.rawXml??"",r=t.indexOf(">"),n=t.lastIndexOf("</");return r>=0&&n>r?t.slice(r+1,n):""}function N1(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Vv(e){return N1(e).replaceAll('"',"&quot;")}function Uv(e,t){let r=new Map(t.map(s=>[s.occurrenceId,s])),n=new Map;for(let s of t){if(!s.parentOccurrenceId||!r.has(s.parentOccurrenceId))continue;let l=n.get(s.parentOccurrenceId)??[];l.push(s),n.set(s.parentOccurrenceId,l)}let i=(s,l,u=new Set)=>{let d=[];for(let c of s.attributes){let f=c.name.toLowerCase();if(f.startsWith("xmlns")||/^on[a-z]/u.test(f)||u.has(f)||f==="id"&&l.shadow)continue;let p=f==="id"?Pr(e,s.sourceNodeId,c.value)??c.value:dn(e,c.value);d.push(`${c.name}="${Vv(p)}"`)}return d.length>0?` ${d.join(" ")}`:""},a=s=>s.children.filter(l=>l.kind!=="element").map(l=>l.kind==="comment"?`<!--${l.value}-->`:l.kind==="cdata"?`<![CDATA[${l.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`:l.kind==="processing-instruction"?`<?${l.value}?>`:l.kind==="doctype"?`<!DOCTYPE ${l.value}>`:N1(l.value)).join(""),o=s=>{let l=e.sourceDocument.index.element(s.correspondingSourceNodeId);if(!l)return"";let u=(n.get(s.occurrenceId)??[]).map(o).join("");if(l.localName.toLowerCase()==="use"){let c=new Set(["href","xlink:href","x","y","width","height","transform","id"]),f=e.symbolUses.use(s.sourceOccurrenceId),p=[];f?.transform.authored&&p.push(f.transform.authored);let h=f?.geometry.x??0,m=f?.geometry.y??0;(h!==0||m!==0)&&p.push(`translate(${h} ${m})`);let g=p.length>0?` transform="${Vv(p.join(" "))}"`:"";return`<g${i(l,s,c)}${g}>${u}</g>`}let d=u||a(l);return`<${l.name}${i(l,s)}>${d}</${l.name}>`};return t.filter(s=>s.parentOccurrenceId===null||!r.has(s.parentOccurrenceId)).map(o).join("")}function mo(e,t){let r=a=>{let o=e.useOccurrences.direct(a.sourceNodeId);return o?e.styles.value(o.occurrenceId,"display"):j(a,"display")},n=e.sourceDocument.index.element(t);if(!n)return!1;if(r(n)?.trim().toLowerCase()==="none")return!0;let i=e.sourceDocument.index.parent(t);for(;i;){if(i.localName.toLowerCase()==="defs"&&r(i)?.trim().toLowerCase()==="none")return!0;i=e.sourceDocument.index.parent(i.sourceNodeId)}return!1}function rV(e){let t=e.indexOf(">");if(t<0)return e;let r=e.slice(0,t);return/\bdisplay\s*=/iu.test(r)?e:e.replace(/^(\s*<[\w:.-]+)/u,'$1 display="none"')}function Zf(e,t,r){let n=r.kind==="color"?r.value??"none":"none";t==="fill"?(e.fillType=r.kind==="color"?"solid":"none",e.fillColor=n):(e.strokeType=r.kind==="color"?"solid":"none",e.borderColor=n)}function Jf(e,t){t==="fill"?(e.fillType="none",e.fillColor="none",delete e.fillGradient,delete e.fillLibraryId):(e.strokeType="none",e.borderColor="none",delete e.strokeGradient,delete e.strokeLibraryId)}function Gv(e,t,r,n,i){let a=r==="fill"?"authoredFillPaint":"authoredStrokePaint";t[a]={value:dn(e,n),resolution:i?"invalid-target":"missing"}}function Xv(e,t){return e.resourceDependencies.edges.find(r=>r.resourceReferenceId===t)?.targetSourceNodeId??null}function Wv(e,t,r){return e.styles.style(t)?.cascadedValues[r]?.origin==="presentation"}function Hv(e,t){delete e[t==="fill"?"authoredFillPaint":"authoredStrokePaint"]}function nV(e,t,r){let n=[...t.library??[]],i=new Set,a=new Map,o=new Map,s={width:e.rootFrame.viewBoxWidth??e.rootFrame.width??300,height:e.rootFrame.viewBoxHeight??e.rootFrame.height??150},l=ma(t),u=new Map;for(let f of e.gradients.candidates){let p=Pr(e,f.sourceNodeId,f.sourceId);p&&u.set(f.sourceNodeId,p)}for(let f of e.gradients.candidates){let p=u.get(f.sourceNodeId);if(!p)continue;let h=e.sourceDocument.index.element(f.sourceNodeId);if(!h)continue;let m=dw(f,{viewport:s,fontSize:16,rootFontSize:16}),g=Object.fromEntries(Object.entries(f.geometryValues).filter(([,N])=>N.ownerSourceNodeId===f.sourceNodeId&&N.validity==="valid").map(([N,T])=>[N,T.raw])),v=f.stops.filter(N=>e.sourceDocument.index.parent(N.sourceNodeId)?.sourceNodeId===f.sourceNodeId).map(N=>Rv(e,N)),y=_v(e,f.sourceNodeId),b=j(h,"gradientUnits"),I=j(h,"spreadMethod"),x=e.styles.style(f.occurrenceId)?.cascadedValues["color-interpolation"],k=E5(h),$={...y?{templateId:y}:{},stops:v,...Object.keys(k).length>0?{rootAttributes:k}:{},...b==="userSpaceOnUse"||b==="objectBoundingBox"?{gradientUnits:f.gradientUnits}:{},...I==="pad"||I==="reflect"||I==="repeat"?{spreadMethod:f.spreadMethod}:{},...x&&["auto","sRGB","linearRGB"].includes(f.colorInterpolation)?{colorInterpolation:f.colorInterpolation}:{},...Object.keys(g).length>0?{authoredGeometry:g}:{},...f.transform.authored?.ownerSourceNodeId===f.sourceNodeId&&f.transform.authored.validity==="valid"?{gradientTransform:[...f.transform.matrix]}:{}},A;if(f.type==="linear-gradient")A={type:"linear-gradient",...$,...Object.fromEntries(["x1","y1","x2","y2"].flatMap(N=>f.geometryValues[N]?.ownerSourceNodeId===f.sourceNodeId?[[N,m[N]]]:[]))};else{let N=Object.fromEntries(["cx","cy","fx","fy","r","fr"].flatMap(T=>f.geometryValues[T]?.ownerSourceNodeId===f.sourceNodeId?[[T,m[T]]]:[]));A={type:"radial-gradient",...$,...N,...N.r!==void 0?{ry:N.r,rotation:0}:{}}}let S=e.metadata.candidate(f.sourceNodeId)?.metadata;a.set(p,{kind:f.type,id:p,name:f.sourceId??p,...f.sourceId?{sourceId:f.sourceId}:{},...f.definitionPlacement==="document"?{definitionPlacement:"document"}:{},definitionOrder:Qn(e,f.sourceNodeId),definitionContainerId:ei(e,f.sourceNodeId),...S&&Object.keys(S).length>0?{metadata:structuredClone(S)}:{},gradient:A}),i.add(p)}for(let f of e.gradients.bindings){let p=r.get(f.occurrenceId);if(!p)continue;let h=p.state,m=f.propertyName==="fill"?"fill":"stroke";if(m==="fill"&&h.inheritFill===!0||m==="stroke"&&h.inheritStroke===!0)continue;if(f.status!=="materialized"||!f.gradientSourceNodeId||mo(e,f.gradientSourceNodeId)){let $=Xv(e,f.resourceReferenceId),A=$?e.patterns.candidate($)?.status==="materialized":!1;Wv(e,f.occurrenceId,f.propertyName)&&(f.status==="invalid-reference"||f.status==="other-paint-server"&&!A)&&Gv(e,h,f.propertyName,f.authoredValue,$),f.status==="empty"?Jf(h,f.propertyName):(f.status==="invalid"||f.status==="invalid-reference"||f.status==="other-paint-server"&&!A||f.gradientSourceNodeId&&mo(e,f.gradientSourceNodeId))&&Zf(h,f.propertyName,f.fallback);continue}Hv(h,f.propertyName);let g=e.gradients.candidate(f.gradientSourceNodeId),v=g?Pr(e,g.sourceNodeId,g.sourceId):null;if(!g||g.status!=="materialized"||!v)continue;let y=e.gradients.resolveGeometry(f,{viewport:s,fontSize:16,rootFontSize:16});if(!y)continue;let b=Object.fromEntries(Object.entries(g.geometryValues).filter(([,$])=>$.validity==="valid").map(([$,A])=>[$,A.raw])),I={id:v,stops:g.stops.map($=>Rv(e,$)),spreadMethod:g.spreadMethod,opacity:1,...g.gradientUnits==="userSpaceOnUse"?{gradientUnits:"userSpaceOnUse"}:{},...g.colorInterpolation!=="sRGB"?{colorInterpolation:g.colorInterpolation}:{},...Object.keys(b).length>0?{authoredGeometry:b}:{},...g.transform.authored?.validity==="valid"?{gradientTransform:[...g.transform.matrix]}:{},...g.sourceId?{sourceId:g.sourceId}:{}},x=g.type==="linear-gradient"?{type:"linear-gradient",x1:y.x1,y1:y.y1,x2:y.x2,y2:y.y2,...I}:{type:"radial-gradient",cx:y.cx,cy:y.cy,fx:y.fx,fy:y.fy,r:y.r,ry:y.r,rotation:0,...y.fr!==0||g.authoredGeometry.fr!==void 0?{fr:y.fr}:{},...I},k=x.stops[0]?.color??"#000000";m==="fill"?(h.fillType=x.type,h.fillGradient=x,h.fillLibraryId=v,h.fillColor=k):(h.strokeType=x.type,h.strokeGradient=x,h.strokeLibraryId=v,h.borderColor=k)}let d=new Map;for(let f of e.patterns.candidates){let p=Pr(e,f.sourceNodeId,f.sourceId);p&&d.set(f.sourceNodeId,p)}for(let f of e.patterns.candidates){let p=d.get(f.sourceNodeId);if(!p)continue;let h=e.sourceDocument.index.element(f.sourceNodeId);if(!h)continue;let m=_v(e,f.sourceNodeId),g=Object.fromEntries(Object.entries(f.values).filter(([,S])=>S.ownerSourceNodeId===f.sourceNodeId&&S.validity==="valid").map(([S,N])=>[S,N.raw])),v=f.contentProviderSourceNodeId===f.sourceNodeId,y=v?f.contentOccurrences.length>0?Uv(e,f.contentOccurrences):Bv(h):"",b=j(h,"patternUnits"),I=j(h,"patternContentUnits"),x=b==="userSpaceOnUse"||b==="objectBoundingBox"?b:void 0,k=I==="userSpaceOnUse"||I==="objectBoundingBox"?I:void 0,$=z5(h),A={type:"pattern",patternType:"custom",color:"#000000",backgroundColor:"#ffffff",scale:1,rotation:0,opacity:1,...m?{templateId:m}:{},...Object.keys($).length>0?{rootAttributes:$}:{},...v&&y?{svgContent:dn(e,y)}:{},...x?{patternUnits:x}:{},...k?{patternContentUnits:k}:{},...Object.keys(g).length>0?{authoredGeometry:g}:{},...f.transform.ownerSourceNodeId===f.sourceNodeId&&f.transform.raw&&f.transform.validity==="valid"?{patternTransform:f.transform.raw}:{},...f.viewBoxAuthored?.ownerSourceNodeId===f.sourceNodeId&&f.viewBoxAuthored.validity==="valid"?{viewBox:f.viewBoxAuthored.raw}:{},...f.preserveAspectRatioAuthored?.ownerSourceNodeId===f.sourceNodeId&&f.preserveAspectRatioAuthored.validity==="valid"?{preserveAspectRatio:f.preserveAspectRatioAuthored.raw}:{}};o.set(p,{kind:"pattern",id:p,name:f.sourceId??p,...f.sourceId?{sourceId:f.sourceId}:{},definitionOrder:Qn(e,f.sourceNodeId),definitionContainerId:ei(e,f.sourceNodeId),pattern:A}),i.add(p)}for(let f of e.patterns.bindings){let p=r.get(f.occurrenceId);if(!p)continue;let h=p.state,m=f.propertyName==="fill"?"fill":"stroke";if(m==="fill"&&h.inheritFill===!0||m==="stroke"&&h.inheritStroke===!0)continue;if(f.status!=="materialized"||!f.patternSourceNodeId||mo(e,f.patternSourceNodeId)){let A=Xv(e,f.resourceReferenceId),S=A?e.gradients.candidate(A)!==void 0:!1;Wv(e,f.occurrenceId,f.propertyName)&&(f.status==="invalid-reference"||f.status==="other-paint-server"&&!S)&&Gv(e,h,f.propertyName,f.authoredValue,A),f.status==="empty"?Jf(h,f.propertyName):(f.status==="invalid"||f.status==="invalid-reference"||f.status==="other-paint-server"&&!S||f.patternSourceNodeId&&mo(e,f.patternSourceNodeId))&&Zf(h,f.propertyName,f.fallback);continue}Hv(h,f.propertyName);let g=e.patterns.candidate(f.patternSourceNodeId),v=g?Pr(e,g.sourceNodeId,g.sourceId):null;if(!g||g.status!=="materialized"||!v){Zf(h,f.propertyName,f.fallback);continue}let y=Dh(l,p).bounds,b=e.patterns.resolveTile(f,{viewport:s,objectBounds:y?{x:y.minX,y:y.minY,width:y.maxX-y.minX,height:y.maxY-y.minY}:{x:0,y:0,width:0,height:0},fontSize:16,rootFontSize:16});if(!b){Jf(h,f.propertyName);continue}let I=g.contentProviderSourceNodeId?e.sourceDocument.index.element(g.contentProviderSourceNodeId):null,x=g.contentOccurrences.length>0?Uv(e,g.contentOccurrences):Bv(I);if(!x)continue;let k=Object.fromEntries(Object.entries(g.values).filter(([,A])=>A.validity==="valid").map(([A,S])=>[A,S.raw])),$={type:"pattern",id:v,patternType:"custom",color:"#000000",backgroundColor:"#ffffff",scale:1,rotation:0,opacity:1,svgContent:dn(e,x),width:b.width,height:b.height,patternUnits:g.patternUnits,patternContentUnits:g.patternContentUnits,...g.values.x?{x:b.x}:{},...g.values.y?{y:b.y}:{},...Object.keys(k).length>0?{authoredGeometry:k}:{},...g.transform.raw&&g.transform.validity==="valid"?{patternTransform:g.transform.raw}:{},...g.viewBoxAuthored?.validity==="valid"?{viewBox:g.viewBoxAuthored.raw}:{},...g.preserveAspectRatioAuthored?.validity==="valid"?{preserveAspectRatio:g.preserveAspectRatioAuthored.raw}:{},...g.sourceId?{sourceId:g.sourceId}:{}};m==="fill"?(h.fillType="pattern",h.fillGradient=$,h.fillLibraryId=v,h.fillColor=$.color):(h.strokeType="pattern",h.strokeGradient=$,h.strokeLibraryId=v,h.borderColor=$.color)}let c=[...a.values(),...o.values()];return c.length>0&&(t.library=[...n,...c]),i}function iV(e,t,r){let n=[...t.library??[]],i=new Map,a=new Set;for(let o of e.filters.bindings){let s=r.get(o.consumerOccurrenceId);if(!s)continue;let l=s.state;if(o.status!=="materialized"){delete l.filterLibraryIds,delete l.filters;continue}let u=[],d=[],c=[],f=!1;for(let p of o.operations){if(p.status!=="materialized")continue;if(p.kind==="function"){f=!0,p.filter&&d.push(structuredClone(p.filter));continue}if(!p.filterSourceNodeId)continue;let h=e.filters.candidate(p.filterSourceNodeId),m=h?Pr(e,h.sourceNodeId,h.sourceId):null;!h||h.status!=="materialized"||!m||(u.push(m),a.add(m),c.push({id:m,candidate:h}),d.push(...structuredClone(h.filters)))}if(f&&u.length>0){let p=`filter-${s.id}`,h=1,m=new Set([...n.map(v=>v.id),...i.keys()]);for(;m.has(p);)p=`filter-${s.id}-${h++}`;let g=c[0]?.candidate;i.set(p,{kind:"filter",id:p,name:p,filters:structuredClone(d),...g?{colorInterpolation:g.colorInterpolation,filterUnits:g.filterUnits,primitiveUnits:g.primitiveUnits,x:g.region.x,y:g.region.y,width:g.region.width,height:g.region.height}:{}}),l.filterLibraryIds=[p]}else if(u.length>0){l.filterLibraryIds=u;for(let{id:p,candidate:h}of c)i.has(p)||i.set(p,{kind:"filter",id:p,name:h.sourceId??p,...h.sourceId?{sourceId:h.sourceId}:{},...h.definitionPlacement==="document"?{definitionPlacement:"document"}:{},definitionOrder:Qn(e,h.sourceNodeId),definitionContainerId:ei(e,h.sourceNodeId),filters:[...structuredClone(h.filters)],colorInterpolation:h.colorInterpolation,filterUnits:h.filterUnits,primitiveUnits:h.primitiveUnits,x:h.region.x,y:h.region.y,width:h.region.width,height:h.region.height})}d.length>0&&(l.filters=d)}return i.size>0&&(t.library=[...n,...i.values()]),a}function aV(e,t,r,n,i,a,o,s,l){let u=[],d=new Set,c=new Map,f=new Map(t.sceneTree?.map(g=>[g.id,{parentId:g.parentId,index:g.index}])??[]),p=new Set([...e.clipMasks.definitions.flatMap(g=>{let v=e.sourceDocument.index.parent(g.sourceNodeId);return v&&v.sourceNodeId!==e.sourceDocument.root.sourceNodeId?[g.sourceNodeId]:[]}),...e.paintServerDefinitions.candidates.flatMap(g=>g.insideDefs?[]:[g.sourceNodeId])]),h=g=>{let v=e.sourceDocument.index.parent(g);if(!v||v.sourceNodeId===e.sourceDocument.root.sourceNodeId)return null;let y=s.get(v.sourceNodeId),b=y??a.get(v.sourceNodeId);if(!b)return null;let I=0;for(let x of v.children)if(x.kind==="element"){if(x.sourceNodeId===g){let k=y??o.get(b);return{parentId:b,...k?{parentDefinitionId:k}:{},siblingIndex:I}}(a.has(x.sourceNodeId)||p.has(x.sourceNodeId))&&I++}return null},m=0;for(let g of e.clipMasks.bindings){let v=r.get(g.consumerOccurrenceId);if(!v||!n.has(v.id))continue;let y=v.state,b=g.definitionSourceNodeId?e.clipMasks.definition(g.definitionSourceNodeId):null,I=dn(e,g.authoredValue);if(g.status!=="materialized"||!b||b.status!=="materialized"||mo(e,b.sourceNodeId)){g.propertyName==="clip-path"?y.cssClipPath=I:y.cssMaskProperties={...y.cssMaskProperties??{},[g.propertyName]:I};continue}let x=Pr(e,b.sourceNodeId,b.sourceId)??`${b.type}-definition-${m+1}`,k=e.sourceDocument.index.element(b.sourceNodeId),$=h(b.sourceNodeId),A=!d.has(x);d.add(x);let S=A?e.paintServerDefinitions.candidate(b.sourceNodeId)?.definition.markup??dn(e,k?.rawXml??b.rawDefinition??""):"",N=A&&b.representation==="raw"?S:"",T=t.sceneTree?.find(G=>G.id===v.id),z=f.get(v.id);if(delete y.cssClipPath,y.cssMaskProperties&&typeof y.cssMaskProperties=="object"){let G={...y.cssMaskProperties};delete G[g.propertyName],y.cssMaskProperties=Object.keys(G).length>0?G:void 0}let C=y.authoredAttributes;if(C&&typeof C=="object"){let G={...C};delete G[g.propertyName],y.authoredAttributes=Object.keys(G).length>0?G:void 0}for(let G of["containerPresentation","instancePresentation","inlineStyle"]){let H=y[G];if(!H||typeof H!="object")continue;let W={...H};delete W[g.propertyName],y[G]=Object.keys(W).length>0?W:void 0}let O=e.styles.style(g.consumerOccurrenceId)?.cascadedValues[g.propertyName],E=O?.origin==="stylesheet"?"stylesheet":O?.origin==="style-attribute"?"style":"attribute",_=E==="style"?Object.keys(e.styles.style(g.consumerOccurrenceId)?.inlineDeclarations??{}).map(G=>G.toLowerCase()).filter(G=>rl(G)).indexOf(g.propertyName):-1,U=A?[]:[...c.get(x)??[]],V=Dh(ma(t),v).bounds,q=b.clipPathUnits==="objectBoundingBox"||b.maskUnits==="objectBoundingBox"||b.maskContentUnits==="objectBoundingBox";if(A&&(V||!q)){let G=e.clipMasks.resolve(g,{consumerObjectBounds:V?{x:V.minX,y:V.minY,width:V.maxX-V.minX,height:V.maxY-V.minY}:{x:0,y:0,width:0,height:0}}),H=[];for(let W of G.geometryPlacements){let B=i.get(W.occurrenceId),ie=e.leafGeometry.candidate(W.occurrenceId);if(!B||!ie?.canonicalType||ie.status!=="materialized")continue;let Y=`clip-mask-${m+1}-shape-${U.length+H.length+1}`,X={...$s(e,ie),..._n(e,B,l)},Z=X.transformMatrix,J=Z?je(W.definitionMatrix,Z):W.definitionMatrix;fn(J)?delete X.transformMatrix:X.transformMatrix=cn(J),b.type==="clip"&&(W.clipRule==="evenodd"?X.fillRule="evenodd":ie.canonicalType==="path"?X.fillRule="nonzero":delete X.fillRule);let Q={id:b.representation==="decomposed"?ii(e,W.sourceNodeId)??Y:Y,type:ie.canonicalType,state:X};H.push({occurrenceId:W.occurrenceId,shape:Q})}if(G.status==="materialized"&&H.length>0&&H.length===G.geometryPlacements.length)for(let W of H)t.shapes.push(W.shape),U.push(W.shape.id),r.has(W.occurrenceId)||r.set(W.occurrenceId,W.shape);else N||(N=S)}else A&&!N&&(N=S);A&&c.set(x,U),u.push({id:`clip-mask-${++m}`,type:b.type,definitionId:x,...b.definitionPlacement==="document"?{definitionPlacement:"document"}:{},...k?{definitionOrder:Qn(e,k.sourceNodeId),definitionContainerId:ei(e,k.sourceNodeId)}:{},...$?{authoredPlacement:$}:{},clipShapeIds:U,contentShapeIds:[v.id],parentId:z?.parentId??T?.parentId??null,referenceChannel:E,..._>=0?{referenceStyleOrder:_}:{},...z?{siblingIndex:z.index}:{},...b.type==="clip"?{...b.clipPathUnits?{clipPathUnits:b.clipPathUnits}:{},...b.clipRule?{clipRule:b.clipRule}:{}}:{...b.maskUnits?{maskUnits:b.maskUnits}:{},...b.maskContentUnits?{maskContentUnits:b.maskContentUnits}:{},...b.maskType?{maskType:b.maskType}:{},...b.region?{maskBounds:{...b.region}}:{}},...N?{rawDefinition:N}:{}})}return u.length>0&&(t.clipMaskGroups=u,aI(t)),d}function oV(e,t={}){let r=new Map(e.useOccurrences.occurrences.map(P=>[P.occurrenceId,P])),n=new Map(e.hierarchy.containers.map(P=>[P.occurrenceId,P])),i=new Map(e.leafGeometry.candidates.filter(P=>P.status==="materialized").map(P=>[P.occurrenceId,P])),a=w1(e),o=X5(e),s=new Set(e.symbolUses.definitions.flatMap(P=>{let D=r.get(P.productRootOccurrenceId);return D&&D.usePath.length>0?[P.sourceNodeId]:[]})),l=e.symbolUses.definitions.filter(P=>{let D=r.get(P.productRootOccurrenceId);return!D||D.usePath.length>0||!s.has(P.sourceNodeId)}),u=new Map,d=new Map;for(let P of l){let D=Pr(e,P.sourceNodeId,P.sourceId)??`symbol-${u.size+1}`,L=(d.get(D)??0)+1;d.set(D,L),u.set(P.productKey,L===1?D:`${D}-use-${L}`)}let c=new Map,f=new Set;for(let P of l){let D=u.get(P.productKey);D&&!c.has(P.sourceNodeId)&&(c.set(P.sourceNodeId,D),f.add(P.productKey))}for(let P of e.symbolUses.definitions){if(u.has(P.productKey))continue;let D=c.get(P.sourceNodeId);D&&u.set(P.productKey,D)}let p=new Map;o.forEach((P,D)=>{p.set(P.occurrenceId,`svg-node-${D+1}`)});let h=new Map,m=[],g=new Map,v=new Map;for(let P of o){let D=p.get(P.occurrenceId),L=e.symbolUses.use(P.occurrenceId);if(L?.status==="symbol-instance"&&L.definitionProductKey){let be=e.symbolUses.definition(L.definitionProductKey),Ue=u.get(L.definitionProductKey);if(!be||!Ue)continue;let ze=_n(e,P,h);delete ze.transformMatrix,ze.symbolId=Ue,ze.x=L.geometry.x,ze.y=L.geometry.y,ze.width=L.geometry.width??be.parsedViewBox?.width??100,ze.height=L.geometry.height??be.parsedViewBox?.height??100,L.geometry.authored&&(ze.authoredUseGeometry={...L.geometry.authored});let St={...L.presentation};L.transform.authored&&L.transform.authored.trim()&&(St.transform=L.transform.authored),Object.keys(St).length>0&&(ze.instancePresentation=St),be.parsedViewBox?(ze.viewBoxWidth=be.parsedViewBox.width,ze.viewBoxHeight=be.parsedViewBox.height,ze.scaleContentToViewport=!0):ze.scaleContentToViewport=!1,m.push({id:D,type:"symbol-instance",state:ze});continue}if(L?.status==="linked-reference"&&L.targetSourceNodeId){let be=e.useOccurrences.direct(L.targetSourceNodeId),Ue=be?p.get(be.occurrenceId):void 0,ze=_n(e,P,h),St=L.transform.matrix;Ue?ze.targetShapeId=Ue:g.set(D,L.targetSourceNodeId),ze.offsetX=L.geometry.x,ze.offsetY=L.geometry.y,Object.keys(L.presentation).length>0&&(ze.instancePresentation={...L.presentation}),St&&!fn(St)?ze.transformMatrix=cn(St):delete ze.transformMatrix,m.push({id:D,type:"shape-reference",state:ze});continue}let te=Fv(e,L);if(L&&te){m.push({id:D,type:"shape-reference",state:Lv(e,P,L,te,h)});continue}let le=n.get(P.occurrenceId);if(le){m.push({id:D,type:Kf(le.kind),state:Tu(e,P,le.kind,h)});continue}let Fe=i.get(P.occurrenceId);Fe?.canonicalType&&m.push({id:D,type:Fe.canonicalType,state:{...$s(e,Fe),..._n(e,P,h)}})}let y=new Set(e.animations.smil.flatMap(P=>P.motionPathSourceNodeId?[P.motionPathSourceNodeId]:[]));for(let P of y){let D=e.useOccurrences.direct(P);if(!D||p.has(D.occurrenceId))continue;let L=i.get(D.occurrenceId);if(!L?.canonicalType)continue;let te=ii(e,P)??`svg-motion-path-${m.length+1}`,le={...$s(e,L),..._n(e,D,h),displayMode:"motionOnly",definitionOrder:Qn(e,P),definitionContainerId:ei(e,P)},Fe={id:te,type:L.canonicalType,state:le};m.push(Fe),v.set(P,Fe),p.set(D.occurrenceId,te)}let b=P=>{if(typeof P!="string"||P.length===0)return;let D=e.sourceDocument.index.resolveAuthoredId(P);if(!D)return;let L=e.useOccurrences.direct(D.sourceNodeId);return L?p.get(L.occurrenceId):void 0};for(let P of m){if(P.type!=="text")continue;let D=P.state,L=D.textPathImportReference;if(L&&typeof L.targetSourceNodeId=="string"&&(L.element==="href"||L.element==="mpath")){let le=e.useOccurrences.direct(L.targetSourceNodeId),Fe=le?p.get(le.occurrenceId):void 0,be=c.get(L.targetSourceNodeId);Fe?D.textPathReference={kind:"shape",targetId:Fe,element:L.element}:be&&(D.textPathReference={kind:"definition",targetId:be,element:L.element})}delete D.textPathImportReference;let te=b(D.shapeInsideImportRefId);te&&(D.shapeInsideRef=te),delete D.shapeInsideImportRefId}let I=new Map,x=[],k=new Map,$=new Map,A=new Map,S=new Set,N=new Set,T=(P,D)=>{let L=new Set,te=P;for(;te&&te.occurrenceId!==D;){if(L.has(te.occurrenceId))return!0;L.add(te.occurrenceId);let le=e.sourceDocument.index.element(te.correspondingSourceNodeId);if(le?.namespaceUri===ye&&_5.has(le.localName.toLowerCase()))return!0;te=te.parentOccurrenceId?r.get(te.parentOccurrenceId):void 0}return!1};for(let[P,D]of l.entries()){let L=u.get(D.productKey);if(!L)continue;k.set(L,D.sourceNodeId);let te=f.has(D.productKey),le=new Set;for(let ae of D.contentOccurrenceIds){let Ne=e.symbolUses.use(ae);if(Ne?.status!=="symbol-instance"||!Ne.definitionProductKey)continue;let Ge=e.symbolUses.definition(Ne.definitionProductKey);if(Ge){le.add(Ge.productRootOccurrenceId);for(let Lt of Ge.contentOccurrenceIds)le.add(Lt)}}let Fe=e.sourceDocument.index.element(D.sourceNodeId),be=Fe?.localName.toLowerCase(),Ue=new Set(be==="use"?[]:D.contentOccurrenceIds);Fe&&!["g","symbol"].includes(be??"")&&Ue.add(D.productRootOccurrenceId);let ze=[...Ue].map(ae=>r.get(ae)).filter(ae=>ae!==void 0&&!le.has(ae.occurrenceId)&&!T(ae,D.productRootOccurrenceId)).sort((ae,Ne)=>x1(ae.orderKey,Ne.orderKey)||ae.productIndex-Ne.productIndex||ae.occurrenceId.localeCompare(Ne.occurrenceId)),St=new Map;ze.forEach((ae,Ne)=>{St.set(ae.occurrenceId,`symbol-node-${P+1}-${Ne+1}`)});let At=new Map;for(let ae of ze){let Ne=St.get(ae.occurrenceId),Ge=e.symbolUses.use(ae.occurrenceId),Lt=null;if(Ge?.status==="symbol-instance"&&Ge.definitionProductKey){let Bt=e.symbolUses.definition(Ge.definitionProductKey),Wr=u.get(Ge.definitionProductKey);if(Bt&&Wr){let Jt=_n(e,ae,h,!1,te);delete Jt.transformMatrix,Jt.symbolId=Wr,Jt.x=Ge.geometry.x,Jt.y=Ge.geometry.y,Jt.width=Ge.geometry.width??Bt.parsedViewBox?.width??100,Jt.height=Ge.geometry.height??Bt.parsedViewBox?.height??100,Ge.geometry.authored&&(Jt.authoredUseGeometry={...Ge.geometry.authored});let os={...Ge.presentation};Ge.transform.authored&&Ge.transform.authored.trim()&&(os.transform=Ge.transform.authored),Object.keys(os).length>0&&(Jt.instancePresentation=os),Bt.parsedViewBox?(Jt.viewBoxWidth=Bt.parsedViewBox.width,Jt.viewBoxHeight=Bt.parsedViewBox.height,Jt.scaleContentToViewport=!0):Jt.scaleContentToViewport=!1,Lt={id:Ne,type:"symbol-instance",state:Jt}}}else if(Ge){let Bt=Fv(e,Ge);Bt&&(Lt={id:Ne,type:"shape-reference",state:Lv(e,ae,Ge,Bt,h,te)})}else{let Bt=n.get(ae.occurrenceId);if(Bt)Lt={id:Ne,type:Kf(Bt.kind),state:Tu(e,ae,Bt.kind,h,te)};else{let Wr=i.get(ae.occurrenceId);Wr?.canonicalType&&(Lt={id:Ne,type:Wr.canonicalType,state:{...$s(e,Wr),..._n(e,ae,h,!1,te)}})}}if(!Lt)continue;ae.occurrenceId===D.productRootOccurrenceId&&Fe&&!["g","symbol"].includes(be??"")&&delete Lt.state.transformMatrix;let tn=e.useOccurrences.direct(ae.correspondingSourceNodeId),Wi=tn?e.styles.style(tn.occurrenceId):null,sr=Lt.state;Wi?.cascadedValues.fill||(delete sr.fillColor,delete sr.fillType,delete sr.fillGradient,delete sr.fillLibraryId,sr.inheritFill=!0),Wi?.cascadedValues.stroke||(delete sr.borderColor,delete sr.strokeType,delete sr.strokeGradient,delete sr.strokeLibraryId,sr.inheritStroke=!0),At.set(ae.occurrenceId,Lt),I.set(ae.occurrenceId,Lt),A.set(Lt.id,L),$.has(ae.correspondingSourceNodeId)||$.set(ae.correspondingSourceNodeId,Lt)}let Ar=[],qn=new Map,_e=ae=>{let Ne=ae.parentOccurrenceId,Ge=new Set;for(;Ne;){if(Ge.has(Ne))throw new Error(`SVG occurrence ancestry contains a cycle at ${Ne}.`);if(Ge.add(Ne),n.has(Ne)&&At.has(Ne))return Ne;Ne=r.get(Ne)?.parentOccurrenceId??null}return null};for(let ae of ze){let Ne=At.get(ae.occurrenceId);if(!Ne)continue;let Ge=n.get(ae.occurrenceId),Lt=e.hierarchy.placements.find(sr=>sr.occurrenceId===ae.occurrenceId),tn=Ge?.parentContainerOccurrenceId??Lt?.parentContainerOccurrenceId??_e(ae),Wi=tn?At.get(tn):void 0;if(Wi){let sr=Wi.state,Bt=sr.children??[];sr.children=[...Bt,Ne]}else Ar.push(Ne),qn.set(ae.occurrenceId,Ne.id)}let ft=[];for(let ae of D.definitionContentOrder??[])if(ae.kind==="definition"){let Ne=u.get(ae.productKey);Ne&&ft.push({kind:"definition",id:Ne})}else{let Ne=qn.get(ae.occurrenceId);Ne&&ft.push({kind:"shape",id:Ne})}let Er=e.metadata.candidate(D.sourceNodeId)?.metadata,en=Fe!==null&&["g","symbol"].includes(Fe.localName.toLowerCase()),gn={...D.rootAttributes,...en?Lp(e,D.productRootOccurrenceId):{}},zr=["g","symbol"].includes(be??""),Dn=r.get(D.productRootOccurrenceId),vi=zr&&Dn?Tu(e,Dn,"group",h,te):{},jc={shapeId:L,shapeType:"group",state:vi},Xi=e.animations.smil.filter(ae=>ae.targetOccurrenceId!==null&&(zr&&ae.targetOccurrenceId===D.productRootOccurrenceId||At.has(ae.targetOccurrenceId))&&tV(e,ae.sourceNodeId,D.sourceNodeId));for(let ae of Xi)S.add(ae.animationId),N.add(ae.sourceNodeId);let is=new Map;for(let[ae,Ne]of At){let Ge=r.get(ae);Ge&&!is.has(Ge.correspondingSourceNodeId)&&is.set(Ge.correspondingSourceNodeId,Ne)}let za=ae=>({shapeId:ae.id,shapeType:ae.type,state:ae.state}),_l=ae=>{let Ne=[];for(let[Ge,Lt]of At){let tn=r.get(Ge)?.parentOccurrenceId??null;for(;tn;){if(tn===ae){Ne.push(Lt);break}tn=r.get(tn)?.parentOccurrenceId??null}}return Ne},as=cp(e.animations,e.styles,{shapeIdForOccurrence:ae=>zr&&ae===D.productRootOccurrenceId?L:At.get(ae)?.id??null,shapeStateForOccurrence:ae=>zr&&ae===D.productRootOccurrenceId?vi:At.get(ae)?.state??null,shapeIdForSourceNode:ae=>zr&&ae===D.sourceNodeId?L:is.get(ae)?.id??null,shapeBindingsForOccurrence:ae=>{if(zr&&ae===D.productRootOccurrenceId)return[jc];let Ne=At.get(ae);return Ne?[za(Ne)]:[]},textSpanBindingForOccurrence:ae=>{let Ne=$0(e.leafGeometry,e.useOccurrences,ae);if(!Ne)return null;let Ge=At.get(Ne.textOccurrenceId);return Ge?{...za(Ge),className:Ev(e,ae),textSpanId:Ne.spanId}:null},descendantShapeBindingsForOccurrence:ae=>_l(ae).map(za),cssTransformContextForOccurrence:ae=>({viewportWidth:D.parsedViewBox?.width??300,viewportHeight:D.parsedViewBox?.height??150,fontSize:e.viewportContexts.fontSize(ae)??e.projectionContext.rootFontSize,rootFontSize:e.projectionContext.rootFontSize,boxX:D.parsedViewBox?.x??0,boxY:D.parsedViewBox?.y??0,boxWidth:D.parsedViewBox?.width??300,boxHeight:D.parsedViewBox?.height??150})},e.gradients,{smil:Xi,css:[]});for(let ae of as?.tracks??[])S.add(ae.id);x.push({kind:"symbol",id:L,name:D.sourceId??L,...D.sourceId?{sourceId:D.sourceId}:{},defKind:D.defKind,...D.definitionPlacement==="document"?{definitionPlacement:"document"}:{},...Fe?{definitionOrder:Qn(e,Fe.sourceNodeId),definitionContainerId:ei(e,Fe.sourceNodeId)}:{},...D.viewBox!==null?{viewBox:D.viewBox}:{},...D.preserveAspectRatio!==null?{preserveAspectRatio:D.preserveAspectRatio}:{},...D.x!==null?{x:D.x}:{},...D.y!==null?{y:D.y}:{},...D.width!==null?{width:D.width}:{},...D.height!==null?{height:D.height}:{},...D.refX!==null?{refX:D.refX}:{},...D.refY!==null?{refY:D.refY}:{},...Object.keys(gn).length>0?{rootAttributes:gn}:{},...Er&&Object.keys(Er).length>0?{metadata:structuredClone(Er)}:{},...ft.some(ae=>ae.kind==="definition")?{definitionContentOrder:ft}:{},shapes:Ar,...as?{animations:as.tracks}:{}})}for(let[P,D]of e.markers.candidates.entries()){if(D.status!=="materialized")continue;let L=Pr(e,D.sourceNodeId,D.sourceId);if(!L)continue;k.set(L,D.sourceNodeId);let te=new Map;for(let _e of D.content){let ft=r.get(_e.occurrenceId);if(!ft)continue;let Er=`marker-node-${P+1}-${te.size+1}`,en=n.get(ft.occurrenceId),gn=_e.elementName==="g"?"group":_e.elementName==="a"?"hyperlink":_e.elementName==="switch"?"switch":_e.elementName==="svg"?"embedded-svg":null,zr=en?.kind??gn,Dn=null;if(zr)Dn={id:Er,type:Kf(zr),state:Tu(e,ft,zr,h)};else{let vi=i.get(ft.occurrenceId);vi?.canonicalType&&(Dn={id:Er,type:vi.canonicalType,state:{...$s(e,vi),..._n(e,ft,h)}})}Dn&&te.set(ft.occurrenceId,Dn)}let le=[];for(let _e of D.content){let ft=te.get(_e.occurrenceId);if(!ft)continue;let Er=_e.parentOccurrenceId?te.get(_e.parentOccurrenceId):void 0;if(Er){let en=Er.state;en.children=[...en.children??[],ft]}else le.push(ft)}let Fe=new Map(D.content.map(_e=>[_e.occurrenceId,_e])),be=new Map;for(let _e of D.content){let ft=te.get(_e.occurrenceId);ft&&!be.has(_e.sourceNodeId)&&be.set(_e.sourceNodeId,ft)}for(let _e of te.values())A.set(_e.id,L);for(let[_e,ft]of be)$.has(_e)||$.set(_e,ft);let Ue=_e=>({shapeId:_e.id,shapeType:_e.type,state:_e.state}),ze=_e=>{let ft=[];for(let[Er,en]of te){let gn=Fe.get(Er)?.parentOccurrenceId??null;for(;gn;){if(gn===_e){ft.push(en);break}gn=Fe.get(gn)?.parentOccurrenceId??null}}return ft},St=D.viewBox?.trim().split(/[\s,]+/u).map(Number),At=St?.length===4&&St.every(Number.isFinite)?{x:St[0],y:St[1],width:St[2],height:St[3]}:{x:0,y:0,width:D.markerWidth,height:D.markerHeight},Ar=lT(e,{shapeIdForOccurrence:_e=>te.get(_e)?.id??null,shapeStateForOccurrence:_e=>te.get(_e)?.state??null,shapeIdForSourceNode:_e=>be.get(_e)?.id??null,shapeBindingsForOccurrence:_e=>{let ft=te.get(_e);return ft?[Ue(ft)]:[]},descendantShapeBindingsForOccurrence:_e=>ze(_e).map(Ue),cssTransformContextForOccurrence:_e=>({viewportWidth:At.width,viewportHeight:At.height,fontSize:e.viewportContexts.fontSize(_e)??e.projectionContext.rootFontSize,rootFontSize:e.projectionContext.rootFontSize,boxX:At.x,boxY:At.y,boxWidth:At.width,boxHeight:At.height})}),qn=e.metadata.candidate(D.sourceNodeId)?.metadata;x.push({kind:"marker",id:L,name:D.name,...D.sourceId?{sourceId:D.sourceId}:{},definitionOrder:Qn(e,D.sourceNodeId),definitionContainerId:ei(e,D.sourceNodeId),...qn&&Object.keys(qn).length>0?{metadata:structuredClone(qn)}:{},...D.viewBox?{viewBox:D.viewBox}:{},...D.preserveAspectRatio?{preserveAspectRatio:D.preserveAspectRatio}:{},...Object.keys(D.authoredGeometry).length>0?{authoredGeometry:{...D.authoredGeometry}}:{},...Object.keys(D.rootAttributes).length>0?{rootAttributes:{...D.rootAttributes}}:{},refX:D.refX,refY:D.refY,markerWidth:D.markerWidth,markerHeight:D.markerHeight,markerUnits:D.markerUnits,orient:D.orient,...D.overflow?{overflow:D.overflow}:{},shapes:le,...Ar?{animations:Ar.tracks}:{}})}for(let[P,D]of e.views.entries()){let L=e.sourceDocument.index.element(D.sourceNodeId),te=L?j(L,"id"):null,le=Pr(e,D.sourceNodeId,te);m.push({id:`svg-view-${P+1}`,type:"view",state:{...D.state,...le?{viewName:le}:{}}})}let z=new Map,C=[];for(let P of o){let D=p.get(P.occurrenceId);if(!D||!m.some(Ue=>Ue.id===D))continue;let L=n.get(P.occurrenceId),te=e.hierarchy.placements.find(Ue=>Ue.occurrenceId===P.occurrenceId),le=L?.parentContainerOccurrenceId??te?.parentContainerOccurrenceId??null,Fe=le?p.get(le)??null:null,be=z.get(Fe)??0;z.set(Fe,be+1),C.push({id:D,parentId:Fe,index:be})}for(let P of m.filter(D=>D.type==="view")){let D=z.get(null)??0;z.set(null,D+1),C.push({id:P.id,parentId:null,index:D})}let O=e.rootFrame,E=t.entrypoint==="external-svg-paste",_=O.systemLanguage!==void 0||O.requiredExtensions!==void 0,U=E&&(O.targetedPasteWrapper||_)?"svg-import-root-wrapper":null;if(U){let P={...O.systemLanguage!==void 0?{systemLanguage:O.systemLanguage}:{},...O.requiredExtensions!==void 0?{requiredExtensions:O.requiredExtensions}:{}},D=O.targetedPasteWrapper?"svg":"group";if(D==="svg"){let L=rP(O);P.svgWidth=L.width,P.svgHeight=L.height,O.sizingMode==="explicit"&&(P.svgViewBoxX=O.viewBoxX,P.svgViewBoxY=O.viewBoxY,P.svgViewBoxWidth=O.viewBoxWidth,P.svgViewBoxHeight=O.viewBoxHeight),O.preserveAspectRatio!==void 0&&(P.svgPreserveAspectRatio=O.preserveAspectRatio)}m.unshift({id:U,type:D,state:P});for(let L of C)L.parentId===null&&(L.parentId=U);C.unshift({id:U,parentId:null,index:0})}let V=O.viewBoxWidth??O.width??300,q=O.viewBoxHeight??O.height??150,G=ii(e,e.sourceDocument.root.sourceNodeId),H=e.useOccurrences.direct(e.sourceDocument.root.sourceNodeId),W=H?Lp(e,H.occurrenceId):{},B=H?I1(e,H.occurrenceId):{};m.unshift({id:"svg-document-root",type:"svg",state:{isRootSvg:!0,svgWidth:O.width??V,svgHeight:O.height??q,svgViewBoxX:O.viewBoxX??0,svgViewBoxY:O.viewBoxY??0,svgViewBoxWidth:V,svgViewBoxHeight:q,...O.authoredWidth!==void 0||O.authoredHeight!==void 0?{authoredRootDimensions:{...O.authoredWidth!==void 0?{width:{raw:O.authoredWidth,resolved:O.width??V}}:{},...O.authoredHeight!==void 0?{height:{raw:O.authoredHeight,resolved:O.height??q}}:{}}}:{},...O.preserveAspectRatio!==void 0?{svgPreserveAspectRatio:O.preserveAspectRatio}:{},...O.systemLanguage!==void 0?{systemLanguage:O.systemLanguage}:{},...O.requiredExtensions!==void 0?{requiredExtensions:O.requiredExtensions}:{},...Object.keys(W).length>0?{containerPresentation:W}:{},...B.presentationChannels?{presentationChannels:B.presentationChannels}:{},...B.inlineStyle?{inlineStyle:B.inlineStyle}:{},...G?{metadata:{name:G}}:{}}});let ie=L5(x,m),Y={language:"",...e.metadata.document.metadata};Y.coordinatePrecision===void 0&&(Y.coordinatePrecision=j5(e.sourceDocument));let X=MR({shapes:m,viewboxes:[AR(O.viewBoxX??0,O.viewBoxY??0,Math.max(V,1),Math.max(q,1),"svg-viewbox-1")],metadata:Y});e.documentExtensions.length>0&&(X.documentExtensions=e.documentExtensions.map(P=>structuredClone(P))),X.sceneTree=[{id:"svg-document-root",parentId:null,index:0},...C.map(P=>P.parentId===null?{...P,index:P.index+1}:P)],ie.length>0&&(X.library=ie);let Z=ma(X),J=new Map,Q=new Map;for(let P of a){let D=p.get(P.occurrenceId),L=D?m.find(te=>te.id===D):void 0;L&&(J.set(P.occurrenceId,L),Q.has(P.correspondingSourceNodeId)||Q.set(P.correspondingSourceNodeId,L.id))}for(let[P,D]of v){let L=e.useOccurrences.direct(P);L&&J.set(L.occurrenceId,D),Q.set(P,D.id)}let Ee=e.useOccurrences.direct(e.sourceDocument.root.sourceNodeId),we=m.find(P=>P.id==="svg-document-root");Ee&&we&&(J.set(Ee.occurrenceId,we),Q.set(e.sourceDocument.root.sourceNodeId,we.id)),K5(e,o,r,J,Z);let Xe=new Map(J),jt=new Map;for(let P of e.symbolUses.uses){if(P.status!=="symbol-instance"||!P.definitionProductKey)continue;let D=Xe.get(P.useOccurrenceId),L=e.symbolUses.definition(P.definitionProductKey);if(!D||!L)continue;let te=jt.get(L.productRootOccurrenceId)??[];te.push(D),jt.set(L.productRootOccurrenceId,te),Q.has(L.sourceNodeId)||Q.set(L.sourceNodeId,D.id)}for(let[P,D]of I){J.set(P,D);let L=r.get(P);L&&!Q.has(L.correspondingSourceNodeId)&&Q.set(L.correspondingSourceNodeId,D.id)}for(let[P,D]of $)Q.has(P)||Q.set(P,D.id);if(U){let P=m.find(L=>L.id===U),D=e.useOccurrences.direct(e.sourceDocument.root.sourceNodeId);P&&(Q.set(e.sourceDocument.root.sourceNodeId,P.id),D&&(J.set(D.occurrenceId,P),Xe.set(D.occurrenceId,P)))}let Gi=new Set(X.shapes.map(P=>P.id)),dr=new Map;for(let[P,D]of k)dr.has(D)||dr.set(D,P);for(let P of e.clipMasks.definitions){let D=Pr(e,P.sourceNodeId,P.sourceId);D&&!dr.has(P.sourceNodeId)&&dr.set(P.sourceNodeId,D)}aV(e,X,J,Gi,r,Q,A,dr,h);for(let[P,D]of g){let L=X.shapes.find(Fe=>Fe.id===P),te=e.useOccurrences.direct(D),le=te?J.get(te.occurrenceId):null;L&&le&&(L.state.targetShapeId=le.id)}for(let[P,D]of J){let L=r.get(P);L&&!Q.has(L.correspondingSourceNodeId)&&Q.set(L.correspondingSourceNodeId,D.id)}nV(e,X,J),iV(e,X,J);for(let P of[...e.gradients.candidates,...e.patterns.candidates]){let D=Pr(e,P.sourceNodeId,P.sourceId);D&&X.library?.some(L=>L.id===D)&&k.set(D,P.sourceNodeId)}for(let P of e.filters.candidates){let D=Pr(e,P.sourceNodeId,P.sourceId);D&&X.library?.some(L=>L.id===D)&&k.set(D,P.sourceNodeId)}for(let[P,D]of k)dr.has(D)||dr.set(D,P);let mn=new Set(k.values());for(let P of e.paintServerDefinitions.candidates)X.paintServerDefs?.some(D=>D.id===P.destinationId)&&mn.add(P.sourceNodeId);for(let P of e.clipMasks.definitions){let D=Pr(e,P.sourceNodeId,P.sourceId);D&&X.clipMaskGroups?.some(L=>L.definitionId===D)&&mn.add(P.sourceNodeId)}for(let P of e.styles.stylesheets)mn.add(P.sourceNodeId);let Pn=Z5(e,Q,mn,A,dr);Pn.length>0&&(X.definitionContainers=Pn);for(let P of X.library??[]){let D=k.get(P.id);if(!D)continue;let L=Lh(e,D,Q,mn,A,dr);L&&(P.authoredPlacement=L)}let yi=P=>{let D=[];for(let[L,te]of J){let le=r.get(L)?.parentOccurrenceId??null;for(;le;){if(le===P){D.push(te);break}le=r.get(le)?.parentOccurrenceId??null}}return D},De=P=>k1(e,P,r,J),st=P=>({shapeId:P.id,shapeType:P.type,state:P.state}),Qe=P=>{let D=Xe.get(P);if(D)return[D];let L=J.get(P);return L&&!I.has(P)?[L]:jt.get(P)??[]},We=Q5(e,c,Q,mn,A),ct=cp(e.animations,e.styles,{shapeIdForOccurrence:P=>Qe(P)[0]?.id??null,shapeStateForOccurrence:P=>Qe(P)[0]?.state??null,shapeIdForSourceNode:P=>Q.get(P)??null,elementIdForSourceNode:P=>e.identifiers.liveIdForSourceNodeId(P)??null,shapeBindingsForOccurrence:P=>Qe(P).map(st),textSpanBindingForOccurrence:P=>{let D=$0(e.leafGeometry,e.useOccurrences,P);if(!D)return null;let L=Qe(D.textOccurrenceId)[0];return L?{...st(L),className:Ev(e,P),textSpanId:D.spanId}:null},descendantShapeBindingsForOccurrence:P=>yi(P).filter(D=>Gi.has(D.id)).map(st),definitionTargetForOccurrence:P=>{let D=r.get(P);if(!D||D.usePath.length>0)return null;let L=e.sourceDocument.index.element(D.correspondingSourceNodeId);if(!L)return null;let te=L;for(;!dr.has(te.sourceNodeId)&&te.sourceNodeId!==e.sourceDocument.root.sourceNodeId;){let ze=e.sourceDocument.index.parent(te.sourceNodeId);if(!ze)return null;te=ze}let le=dr.get(te.sourceNodeId);if(!le)return null;let Fe=e.filters.primitiveId(L.sourceNodeId),be=L.sourceNodeId===te.sourceNodeId?void 0:Fe??ii(e,L.sourceNodeId)??void 0,Ue=Object.fromEntries(L.attributes.map(ze=>[ze.name,ze.value]));return{definitionId:le,...be?{nodeId:be}:{},baseTransform:e.styles.value(P,"transform")??Ue.transform??"",baseAttributes:Object.freeze(Ue)}},shapeIdForLocalReference:P=>{let D=P.trim();if(!D.startsWith("#")||D.length===1)return null;let L=e.sourceDocument.index.resolveAuthoredId(D.slice(1));return L?Q.get(L.sourceNodeId)??null:null},definitionOrderForSourceNode:P=>Qn(e,P),definitionContainerIdForSourceNode:P=>ei(e,P),cssTransformContextForOccurrence:(P,D)=>{let L=Qe(P)[0],te=De(P),le=L?S1(L,D,te,Z):null;return{viewportWidth:te.width,viewportHeight:te.height,fontSize:e.viewportContexts.fontSize(P)??e.projectionContext.rootFontSize,rootFontSize:e.projectionContext.rootFontSize,...le??{}}}},e.gradients,{smil:e.animations.smil.filter(P=>!S.has(P.animationId)&&!N.has(P.sourceNodeId))});ct&&(X.animationTimeline=ct.cssAnimationSources?.length?{...ct,cssAnimationDocumentStylesFingerprint:Ab(We),cssAnimationInlineStylesFingerprint:Mb(X.shapes)}:ct),We&&(X.documentStyles=We);let Et=new Set([...J.keys()].map(P=>e.useOccurrences.occurrence(P)?.correspondingSourceNodeId).filter(P=>P!==void 0)),xr=[...e.scripts.documentScripts,...e.scripts.elementScripts.filter(P=>P.parentSourceNodeId!==null&&!Et.has(P.parentSourceNodeId))].map(P=>({...P.script,customAttrs:P.script.customAttrs?{...P.script.customAttrs}:void 0}));xr.length>0&&(X.documentScripts=xr);let cr=new Set((X.library??[]).map(P=>P.id)),bt=new Set((X.clipMaskGroups??[]).map(P=>P.definitionId)),Ye=new Set;for(let P of e.paintServerDefinitions.candidates)(cr.has(P.destinationId)||bt.has(P.destinationId))&&Ye.add(P.sourceNodeId);for(let P of e.gradients.candidates)if(Ye.has(P.sourceNodeId))for(let D of P.templateSourceNodeIds)Ye.add(D);for(let P of e.patterns.candidates)if(Ye.has(P.sourceNodeId))for(let D of P.templateSourceNodeIds)Ye.add(D);let xt=new Set(e.symbolUses.definitions.map(P=>P.sourceNodeId));for(let P of xt)Ye.add(P);for(let P of e.markers.candidates)P.status==="materialized"&&Ye.add(P.sourceNodeId);let $e=[...e.paintServerDefinitions.definitions(Ye)],ar=new Set(e.paintServerDefinitions.candidates.filter(P=>!Ye.has(P.sourceNodeId)).map(P=>P.sourceNodeId)),yt=new Map,mt=P=>{if(Ye.has(P)||xt.has(P))return;let D=e.paintServerDefinitions.definitionForSourceNode(P);D&&!$e.some(L=>L.id===D.id)&&yt.set(D.id,D)};for(let P of e.filters.bindings){if(P.status!=="materialized")continue;let D=e.resourceDependencies.edges.filter(L=>L.kind==="filter"&&L.propertyName==="filter"&&L.propertyValue===P.authoredValue&&(L.occurrenceId!==null&&L.occurrenceId===P.consumerOccurrenceId||L.occurrenceId===null&&L.fromSourceNodeId===P.consumerSourceNodeId));for(let L of e.resourceDependencies.closureFromEdges(D).materializations)L.role==="referenced-fragment"&&mt(L.sourceNodeId)}let Kt=(P,D)=>{let L=e.sourceDocument.index.parent(P);for(;L;){if(L.sourceNodeId===D)return!0;L=e.sourceDocument.index.parent(L.sourceNodeId)}return!1};for(let P of e.useOccurrences.sourceResolutions)P.status!=="resolved"||!P.targetSourceNodeId||[...ar].some(D=>Kt(P.useSourceNodeId,D))&&mt(P.targetSourceNodeId);let or=[...$e,...yt.values()];if(or.length>0){let P=new Map(e.paintServerDefinitions.candidates.map(te=>[te.definition.id,te])),D=new Set(or.flatMap(te=>{let le=P.get(te.id);return le&&!le.insideDefs?[le.sourceNodeId]:[]})),L=te=>{let le=e.sourceDocument.index.parent(te);if(!le||le.sourceNodeId===e.sourceDocument.root.sourceNodeId)return null;let Fe=dr.get(le.sourceNodeId),be=Fe??Q.get(le.sourceNodeId);if(!be)return null;let Ue=0;for(let ze of le.children)if(ze.kind==="element"){if(ze.sourceNodeId===te){let St=Fe??A.get(be);return{parentId:be,...St?{parentDefinitionId:St}:{},siblingIndex:Ue}}(Q.has(ze.sourceNodeId)||D.has(ze.sourceNodeId))&&Ue++}return null};X.paintServerDefs=or.map(te=>{let le=P.get(te.id),Fe=le?.sourceNodeId,be=structuredClone(te);if(Fe&&le&&!le.insideDefs){let Ue=L(Fe);Ue&&(be.authoredPlacement=Ue)}return Fe&&mo(e,Fe)&&(be.markup=rV(be.markup)),be})}let Zt=ul(X);return Zt.errors.length>0?{value:null,diagnostics:Zt.errors.map(P=>eV(`${P.path}: ${P.message}`))}:{value:X,diagnostics:[]}}function Bh(e,t={}){let r=$R(e,t);if(!r.value)return{value:null,diagnostics:r.diagnostics};let n=oV(r.value,t),i=[];if(n.value&&t.nodeDecorations){let a=P5(n.value,t.nodeDecorations);i.push(...D5(a,t.source??"svg",t.entrypoint??"svg-document-import"))}return{value:n.value,diagnostics:Object.freeze([...r.diagnostics,...n.diagnostics,...i])}}var sV=1024,lV=64*1024;function so(e,t,r=0){if(e.length<r+t.length)return!1;for(let n=0;n<t.length;n++)if(e[r+n]!==t[n])return!1;return!0}function qv(e,t,r){let n=t.charCodeAt(0),i=Math.min(e.length,r)-t.length;e:for(let a=0;a<=i;a++)if(e[a]===n){for(let o=1;o<t.length;o++)if(e[a+o]!==t.charCodeAt(o))continue e;return a}return-1}function M1(e){if(e.length<4)return"unknown";if(so(e,[137,80,78,71,13,10,26,10]))return"png";if(so(e,[255,216,255]))return"jpeg";if(so(e,[71,73,70,56]))return"gif";if(so(e,[82,73,70,70])&&so(e,[87,69,66,80],8))return"webp";if(qv(e,"%PDF-",sV)>=0)return"pdf";if(so(e,[197,208,211,198])||qv(e,"%!PS",32)>=0)return"postscript";let t=XT(e.subarray(0,Math.min(e.length,lV))).text.replace(/^/,"").trimStart();if(t.startsWith("{")){let r=t.slice(0,4096);if(r.includes('"schemaVersion"')||r.includes('"shapes"'))return"svgs"}return/<svg[\s>/]/.test(t)||/^<\?xml[\s\S]{0,4096}?<svg[\s>/]/.test(t)?"svg":"unknown"}var Yv={dropped:0,rasterized:1,approximated:2,preserved:3};function uV(e){switch(e){case"no-materializable-content":case"unsupported-svg-element":case"unsupported-ingest-capability":case"unresolved-reference":case"circular-use-reference":case"circular-resource-reference":case"use-expansion-limit-exceeded":case"required-features-dropped":case"empty-hyperlink-dropped":case"foreign-structure-unmatched":case"application-rolled-back":return"dropped";default:return"approximated"}}function A1(e){let t=new Map,r=a=>{let o=`${a.vocabulary}|${a.code}|${a.subject??""}`,s=t.get(o);s?t.set(o,{...s,count:s.count+a.count}):t.set(o,a)};for(let a of e.items)r(a);let n=new Set;for(let a of e.ingestDiagnostics){let o=`${a.code}|${a.documentPath??""}|${a.message}`;n.has(o)||(n.add(o),r({bucket:uV(a.code),vocabulary:"ingest",code:a.code,subject:a.sourceId??a.elementName,count:1,message:a.message}))}let i=[...t.values()].sort((a,o)=>Yv[a.bucket]-Yv[o.bucket]||a.code.localeCompare(o.code));return{version:1,source:e.source,artboards:e.artboards,colorMode:e.colorMode,textMode:e.textMode,counts:e.counts,items:i,fonts:e.fonts,ingestDiagnostics:e.ingestDiagnostics,timings:e.timings,details:e.details}}function ga(e){if(!e)return"";let t=e.replace(/[^A-Za-z0-9_.-]/g,"_");return t&&!/^[A-Za-z_]/.test(t)&&(t=`_${t}`),t}function dV(e,t){return t?ga(`filter-${e}--${t}`):`filter-${e}`}function cV(e,t){if(!Array.isArray(e)||e.length===0)return[];let r=new Map,n=[];for(let i of e){if(!i||typeof i!="object")continue;let a=typeof i.target=="string"&&i.target?i.target:null,o=r.get(a);o||(o={id:dV(t,a),targetLayerId:a,filters:[]},r.set(a,o),n.push(o)),o.filters.push(i)}return n}var He=["updatedAt","clientId"],vd=64,Kv=25e4;function re(e,t,r){e.push({path:t,message:r})}function C1(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ke(e,t,r){return C1(e)?e:(re(r,t,"must be an object"),null)}function pe(e,t,r,n=[],i,a=!0){let o=new Set([...a?["type"]:[],...r,...n]);for(let s of r)Object.hasOwn(e,s)||re(i,`${t}.${s}`,"is required");for(let s of Object.keys(e))o.has(s)||re(i,`${t}.${s}`,"is not allowed")}function oe(e,t,r,n=!1){return typeof e!="string"||!n&&e.length===0?(re(r,t,n?"must be a string":"must be a non-empty string"),!1):!0}function Sr(e,t,r,n){return typeof e!="number"||!Number.isFinite(e)?(re(r,t,"must be a finite number"),!1):n!==void 0&&e<n?(re(r,t,`must be at least ${n}`),!1):!0}function qt(e,t,r,n=0){return Sr(e,t,r,n)?Number.isInteger(e)?!0:(re(r,t,"must be an integer"),!1):!1}function Uo(e,t,r){return typeof e!="boolean"?(re(r,t,"must be a boolean"),!1):!0}function Se(e,t,r,n,i=!1){e[t]!==void 0&&oe(e[t],`${r}.${t}`,n,i)}function ua(e,t,r,n,i){e[t]!==void 0&&Sr(e[t],`${r}.${t}`,n,i)}function kt(e,t,r,n,i=0){e[t]!==void 0&&qt(e[t],`${r}.${t}`,n,i)}function To(e,t,r,n){e[t]!==void 0&&Uo(e[t],`${r}.${t}`,n)}function li(e,t,r){return Array.isArray(e)?(e.forEach((n,i)=>oe(n,`${t}[${i}]`,r)),!0):(re(r,t,"must be an array"),!1)}function dt(e,t,r,n){return Array.isArray(e)?(e.forEach((i,a)=>n(i,`${t}[${a}]`,r)),!0):(re(r,t,"must be an array"),!1)}function nr(e,t,r){let n=[{value:e,path:t,depth:0}],i=0;for(;n.length>0;){let a=n.pop();if(i++,i>Kv){re(r,t,`exceeds the ${Kv}-node validation limit`);return}if(a.depth>vd){re(r,a.path,`exceeds the ${vd}-level nesting limit`);continue}let o=a.value;if(!(o===null||typeof o=="string"||typeof o=="boolean")){if(typeof o=="number"){Number.isFinite(o)||re(r,a.path,"must be a finite JSON number");continue}if(Array.isArray(o)){o.forEach((s,l)=>n.push({value:s,path:`${a.path}[${l}]`,depth:a.depth+1}));continue}if(C1(o)){for(let[s,l]of Object.entries(o))n.push({value:l,path:`${a.path}.${s}`,depth:a.depth+1});continue}re(r,a.path,"must be JSON-serializable")}}}function qe(e,t,r){ua(e,"updatedAt",t,r,0),Se(e,"clientId",t,r)}function bd(e,t,r){let n=ke(e,t,r);if(n)for(let[i,a]of Object.entries(n))oe(a,`${t}.${i}`,r,!0)}function Zd(e,t,r,n=0){if(n>vd){re(r,t,`exceeds the ${vd}-level shape nesting limit`);return}let i=ke(e,t,r);if(!i)return;pe(i,t,["id","type","state"],[],r),oe(i.id,`${t}.id`,r),oe(i.type,`${t}.type`,r);let a=ke(i.state,`${t}.state`,r);a&&(Object.hasOwn(a,"extra")&&re(r,`${t}.state.extra`,"is an at-rest field and is not allowed in operations"),T1(a,`${t}.state`,r),nr(a,`${t}.state`,r),a.children!==void 0&&dt(a.children,`${t}.state.children`,r,(o,s,l)=>Zd(o,s,l,n+1)),a.definitionOrder!==void 0&&(qt(a.definitionOrder,`${t}.state.definitionOrder`,r),typeof a.definitionOrder=="number"&&a.definitionOrder<0&&re(r,`${t}.state.definitionOrder`,"must be non-negative")),Se(a,"definitionContainerId",`${t}.state`,r))}function fV(e,t,r){let n=ke(e,t,r);n&&(Object.hasOwn(n,"extra")&&re(r,`${t}.extra`,"is an at-rest field and is not allowed in operations"),T1(n,t,r),nr(n,t,r),n.children!==void 0&&dt(n.children,`${t}.children`,r,(i,a,o)=>Zd(i,a,o)),n.definitionOrder!==void 0&&(qt(n.definitionOrder,`${t}.definitionOrder`,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&re(r,`${t}.definitionOrder`,"must be non-negative")),Se(n,"definitionContainerId",t,r))}function pV(e,t,r){let n=ke(e,t,r);if(n){if(oe(n.id,`${t}.id`,r),n.type!=="clip"&&n.type!=="mask"&&re(r,`${t}.type`,'must be "clip" or "mask"'),n.definitionPlacement!==void 0&&n.definitionPlacement!=="defs"&&n.definitionPlacement!=="document"&&re(r,`${t}.definitionPlacement`,'must be "defs" or "document"'),n.referenceChannel!==void 0&&n.referenceChannel!=="attribute"&&n.referenceChannel!=="style"&&n.referenceChannel!=="stylesheet"&&re(r,`${t}.referenceChannel`,'must be "attribute", "style", or "stylesheet"'),kt(n,"referenceStyleOrder",t,r),typeof n.referenceStyleOrder=="number"&&n.referenceStyleOrder<0&&re(r,`${t}.referenceStyleOrder`,"must be non-negative"),kt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&re(r,`${t}.definitionOrder`,"must be non-negative"),Se(n,"definitionContainerId",t,r),n.authoredPlacement!==void 0){let i=ke(n.authoredPlacement,`${t}.authoredPlacement`,r);i&&(pe(i,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),oe(i.parentId,`${t}.authoredPlacement.parentId`,r),Se(i,"parentDefinitionId",`${t}.authoredPlacement`,r),qt(i.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof i.siblingIndex=="number"&&i.siblingIndex<0&&re(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}li(n.clipShapeIds,`${t}.clipShapeIds`,r),li(n.contentShapeIds,`${t}.contentShapeIds`,r),n.parentId!==null&&oe(n.parentId,`${t}.parentId`,r),kt(n,"siblingIndex",t,r),nr(n,t,r)}}function Zv(e,t,r){let n=ke(e,t,r);n&&(oe(n.id,`${t}.id`,r),n.orientation!=="horizontal"&&n.orientation!=="vertical"&&re(r,`${t}.orientation`,'must be "horizontal" or "vertical"'),Sr(n.position,`${t}.position`,r),Sr(n.controlPointOffset,`${t}.controlPointOffset`,r),Se(n,"color",t,r,!0),ua(n,"opacity",t,r),nr(n,t,r))}function Jv(e,t,r){let n=ke(e,t,r);n&&(oe(n.id,`${t}.id`,r),n.type!=="distance"&&n.type!=="angle"&&re(r,`${t}.type`,'must be "distance" or "angle"'),dt(n.points,`${t}.points`,r,(i,a,o)=>{let s=ke(i,a,o);s&&(Sr(s.x,`${a}.x`,o),Sr(s.y,`${a}.y`,o))}),Uo(n.visible,`${t}.visible`,r),qt(n.snapDivisions,`${t}.snapDivisions`,r,1),Se(n,"color",t,r,!0),ua(n,"opacity",t,r),nr(n,t,r))}var Qv=["title","description","author","keywords","license","licenseUrl","language","customMetadata","role","ariaLabel","aria","rawMetadata","rawMetadataAuthoritative","rawDescription","rawHtmlMetadata","descriptiveElements","coordinatePrecision"];function eb(e,t,r,n){let i=ke(e,t,r);if(i){pe(i,t,n?[]:["title","description","author","keywords","license","licenseUrl","language","customMetadata"],n?Qv:Qv.slice(8),r,!1);for(let a of["title","description","author","license","licenseUrl","language"])(!n||i[a]!==void 0)&&oe(i[a],`${t}.${a}`,r,!0);(!n||i.keywords!==void 0)&&li(i.keywords,`${t}.keywords`,r),(!n||i.customMetadata!==void 0)&&bd(i.customMetadata,`${t}.customMetadata`,r),Se(i,"role",t,r,!0),Se(i,"ariaLabel",t,r,!0),i.aria!==void 0&&bd(i.aria,`${t}.aria`,r),Se(i,"rawMetadata",t,r,!0),To(i,"rawMetadataAuthoritative",t,r),Se(i,"rawDescription",t,r,!0),Se(i,"rawHtmlMetadata",t,r,!0),i.descriptiveElements!==void 0&&dt(i.descriptiveElements,`${t}.descriptiveElements`,r,(a,o,s)=>{let l=ke(a,o,s);l&&(pe(l,o,["kind","language","text","rawXml"],[],s,!1),l.kind!=="title"&&l.kind!=="desc"&&re(s,`${o}.kind`,'must be "title" or "desc"'),l.language!==null&&oe(l.language,`${o}.language`,s,!0),oe(l.text,`${o}.text`,s,!0),oe(l.rawXml,`${o}.rawXml`,s,!0))}),kt(i,"coordinatePrecision",t,r)}}function tb(e,t,r){let n=ke(e,t,r);n&&(oe(n.id,`${t}.id`,r),n.source!=="inline"&&n.source!=="external"&&re(r,`${t}.source`,'must be "inline" or "external"'),oe(n.content,`${t}.content`,r,!0),oe(n.type,`${t}.type`,r,!0),Se(n,"svgId",t,r,!0),Se(n,"href",t,r,!0),To(n,"async",t,r),To(n,"defer",t,r),n.customAttrs!==void 0&&bd(n.customAttrs,`${t}.customAttrs`,r),nr(n,t,r))}function xd(e,t,r){e!==null&&oe(e,t,r,!0)}function O1(e,t,r){let n=ke(e,t,r);n&&(pe(n,t,["name","localName","prefix","namespaceUri","value"],[],r,!1),oe(n.name,`${t}.name`,r),oe(n.localName,`${t}.localName`,r),xd(n.prefix,`${t}.prefix`,r),xd(n.namespaceUri,`${t}.namespaceUri`,r),oe(n.value,`${t}.value`,r,!0))}function hV(e,t,r){O1(e,t,r);let n=ke(e,t,[]);n?.localName==="id"&&n.namespaceUri===null&&re(r,t,"must not duplicate the definition container svgId authority")}function Vh(e,t,r){let n=ke(e,t,r);if(n){if(n.kind==="element"){pe(n,t,["kind","name","localName","prefix","namespaceUri","attributes","children"],[],r,!1),oe(n.name,`${t}.name`,r),oe(n.localName,`${t}.localName`,r),xd(n.prefix,`${t}.prefix`,r),xd(n.namespaceUri,`${t}.namespaceUri`,r),dt(n.attributes,`${t}.attributes`,r,O1),dt(n.children,`${t}.children`,r,Vh);return}["text","comment","cdata","processing-instruction"].includes(String(n.kind))||re(r,`${t}.kind`,"must be a supported document extension node kind"),pe(n,t,["kind","value"],[],r,!1),oe(n.value,`${t}.value`,r,!0)}}function T1(e,t,r){Object.hasOwn(e,"rawContent")&&re(r,`${t}.rawContent`,"is noncanonical; use structured foreignContent nodes"),e.foreignContent!==void 0&&dt(e.foreignContent,`${t}.foreignContent`,r,Vh)}function rb(e,t,r){let n=ke(e,t,r);n&&(pe(n,t,["id","placement","order","element"],["definitionOrder","definitionContainerId"],r,!1),oe(n.id,`${t}.id`,r),n.placement!=="root"&&n.placement!=="defs"&&re(r,`${t}.placement`,'must be "root" or "defs"'),qt(n.order,`${t}.order`,r),kt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&re(r,`${t}.definitionOrder`,"must be non-negative"),Se(n,"definitionContainerId",t,r),Vh(n.element,`${t}.element`,r),nr(n,t,r))}function mV(e,t,r){let n=ke(e,t,r);if(n){if(pe(n,t,["id","order"],["svgId","attributes","authoredPlacement"],r,!1),oe(n.id,`${t}.id`,r),qt(n.order,`${t}.order`,r),typeof n.order=="number"&&n.order<0&&re(r,`${t}.order`,"must be non-negative"),Se(n,"svgId",t,r),n.attributes!==void 0&&dt(n.attributes,`${t}.attributes`,r,hV),n.authoredPlacement!==void 0){let i=ke(n.authoredPlacement,`${t}.authoredPlacement`,r);i&&(pe(i,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),oe(i.parentId,`${t}.authoredPlacement.parentId`,r),Se(i,"parentDefinitionId",`${t}.authoredPlacement`,r),qt(i.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof i.siblingIndex=="number"&&i.siblingIndex<0&&re(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}nr(n,t,r)}}function nb(e,t,r){let n=ke(e,t,r);if(n){if(oe(n.id,`${t}.id`,r),oe(n.css,`${t}.css`,r,!0),Uo(n.preserved,`${t}.preserved`,r),n.placement!=="root"&&n.placement!=="defs"&&re(r,`${t}.placement`,'must be "root" or "defs"'),kt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&re(r,`${t}.definitionOrder`,"must be non-negative"),Se(n,"definitionContainerId",t,r),n.authoredPlacement!==void 0){let i=ke(n.authoredPlacement,`${t}.authoredPlacement`,r);i&&(pe(i,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),oe(i.parentId,`${t}.authoredPlacement.parentId`,r),Se(i,"parentDefinitionId",`${t}.authoredPlacement`,r),qt(i.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof i.siblingIndex=="number"&&i.siblingIndex<0&&re(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}Se(n,"scopeDefinitionId",t,r),n.scopeDefinitionId!==void 0&&n.placement!=="defs"&&re(r,`${t}.scopeDefinitionId`,"requires defs placement"),Se(n,"svgId",t,r,!0),Se(n,"type",t,r,!0),Se(n,"media",t,r,!0),n.customAttrs!==void 0&&bd(n.customAttrs,`${t}.customAttrs`,r),nr(n,t,r)}}function ib(e,t,r){let n=ke(e,t,r);if(n){if(oe(n.name,`${t}.name`,r),["string","color","number"].includes(String(n.type))||re(r,`${t}.type`,'must be "string", "color", or "number"'),oe(n.defaultValue,`${t}.defaultValue`,r,!0),Se(n,"label",t,r,!0),Se(n,"description",t,r,!0),n.mode!==void 0&&n.mode!=="live"&&n.mode!=="stamped"&&re(r,`${t}.mode`,'must be "live" or "stamped"'),n.source!==void 0){let i=ke(n.source,`${t}.source`,r);i&&i.kind!=="user"&&re(r,`${t}.source.kind`,'must be "user"')}nr(n,t,r)}}function ab(e,t,r){let n=ke(e,t,r);n&&(oe(n.id,`${t}.id`,r),oe(n.filename,`${t}.filename`,r,!0),oe(n.format,`${t}.format`,r),nr(n,t,r))}function gV(e,t,r){let n=ke(e,t,r);n&&(qt(n.glyphId,`${t}.glyphId`,r),Array.isArray(n.codepoints)?n.codepoints.forEach((i,a)=>qt(i,`${t}.codepoints[${a}]`,r)):re(r,`${t}.codepoints`,"must be an array"),oe(n.svgDocument,`${t}.svgDocument`,r,!0),Se(n,"glyphName",t,r,!0),kt(n,"advanceWidth",t,r),Se(n,"sourceFamily",t,r,!0),kt(n,"sourceGlyphId",t,r),Se(n,"label",t,r,!0),nr(n,t,r))}function ob(e,t,r){let n=ke(e,t,r);if(!n)return;oe(n.id,`${t}.id`,r),Se(n,"sourceId",t,r);let i=["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"],a=n.role===void 0?"resource":String(n.role);a!=="resource"&&a!=="referenced-fragment"&&re(r,`${t}.role`,"is not a supported raw SVG definition role");let o=String(n.type);if((a==="resource"&&!i.includes(o)||a==="referenced-fragment"&&!/^[A-Za-z][\w.-]*$/u.test(o))&&re(r,`${t}.type`,"is not a supported paint-server type"),oe(n.markup,`${t}.markup`,r),n.definitionChildIds!==void 0&&li(n.definitionChildIds,`${t}.definitionChildIds`,r),n.sourceDefinitionChildIds!==void 0&&li(n.sourceDefinitionChildIds,`${t}.sourceDefinitionChildIds`,r),Array.isArray(n.definitionChildIds)&&Array.isArray(n.sourceDefinitionChildIds)&&n.definitionChildIds.length!==n.sourceDefinitionChildIds.length&&re(r,t,"definition child id arrays must have equal lengths"),n.authoredPlacement!==void 0){let s=ke(n.authoredPlacement,`${t}.authoredPlacement`,r);s&&(pe(s,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),oe(s.parentId,`${t}.authoredPlacement.parentId`,r),Se(s,"parentDefinitionId",`${t}.authoredPlacement`,r),qt(s.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof s.siblingIndex=="number"&&s.siblingIndex<0&&re(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}To(n,"passthrough",t,r),kt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&re(r,`${t}.definitionOrder`,"must be non-negative"),Se(n,"definitionContainerId",t,r),nr(n,t,r)}function sb(e,t,r){let n=ke(e,t,r);if(!n)return;oe(n.id,`${t}.id`,r),oe(n.name,`${t}.name`,r,!0),n.metadata!==void 0&&nr(n.metadata,`${t}.metadata`,r);let i=n.kind;if(["symbol","marker","linear-gradient","radial-gradient","pattern","filter"].includes(String(i))||re(r,`${t}.kind`,"is not a supported library kind"),kt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&re(r,`${t}.definitionOrder`,"must be non-negative"),Se(n,"definitionContainerId",t,r),n.authoredPlacement!==void 0){let a=ke(n.authoredPlacement,`${t}.authoredPlacement`,r);a&&(pe(a,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),oe(a.parentId,`${t}.authoredPlacement.parentId`,r),Se(a,"parentDefinitionId",`${t}.authoredPlacement`,r),qt(a.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof a.siblingIndex=="number"&&a.siblingIndex<0&&re(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}if(n.definitionPlacement!==void 0&&!["defs","document"].includes(String(n.definitionPlacement))&&re(r,`${t}.definitionPlacement`,'must be "defs" or "document"'),(i==="symbol"||i==="marker")&&(dt(n.shapes,`${t}.shapes`,r,Zd),n.animations!==void 0&&dt(n.animations,`${t}.animations`,r,Uh)),i==="symbol"){n.defKind!==void 0&&!["symbol","group","shape"].includes(String(n.defKind))&&re(r,`${t}.defKind`,'must be "symbol", "group", or "shape"'),n.definitionPlacement==="document"&&(n.defKind??"symbol")!=="symbol"&&re(r,`${t}.definitionPlacement`,'may be "document" only for symbol roots'),n.defKind==="shape"&&(!Array.isArray(n.shapes)||n.shapes.length!==1)&&re(r,`${t}.shapes`,"must contain exactly one native root shape");for(let a of["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"])Se(n,a,t,r,!0);if(n.rootAttributes!==void 0){let a=ke(n.rootAttributes,`${t}.rootAttributes`,r);if(a)for(let[o,s]of Object.entries(a))["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(o)&&re(r,`${t}.rootAttributes.${o}`,"must use its typed symbol field"),oe(s,`${t}.rootAttributes.${o}`,r,!0)}if(n.definitionContentOrder!==void 0){let a=Array.isArray(n.definitionContentOrder)?n.definitionContentOrder:null;if(!a)re(r,`${t}.definitionContentOrder`,"must be an array");else{let o=new Set(Array.isArray(n.shapes)?n.shapes.map(l=>l&&typeof l=="object"&&!Array.isArray(l)?l.id:void 0).filter(l=>typeof l=="string"&&l.length>0):[]),s=new Set;a.forEach((l,u)=>{let d=`${t}.definitionContentOrder[${u}]`,c=ke(l,d,r);if(!c||(c.kind!=="shape"&&c.kind!=="definition"&&re(r,`${d}.kind`,'must be "shape" or "definition"'),oe(c.id,`${d}.id`,r),typeof c.id!="string"||c.id.length===0))return;let f=`${String(c.kind)}\0${c.id}`;s.has(f)&&re(r,d,"must not duplicate another content entry"),s.add(f),c.kind==="shape"&&!o.has(c.id)&&re(r,`${d}.id`,"must name a root shape of this definition"),c.kind==="definition"&&c.id===n.id&&re(r,`${d}.id`,"must not name the containing definition")})}}for(let a of["wrapperAttrs","groups","overflow"])n[a]!==void 0&&re(r,`${t}.${a}`,"is schema-v7 migration input only")}if(i==="marker"){Se(n,"viewBox",t,r,!0),Se(n,"preserveAspectRatio",t,r,!0);for(let a of["refX","refY","markerWidth","markerHeight"])Sr(n[a],`${t}.${a}`,r);if(n.markerUnits!=="strokeWidth"&&n.markerUnits!=="userSpaceOnUse"&&re(r,`${t}.markerUnits`,'must be "strokeWidth" or "userSpaceOnUse"'),n.orient!=="auto"&&n.orient!=="auto-start-reverse"&&!(typeof n.orient=="number"&&Number.isFinite(n.orient))&&re(r,`${t}.orient`,"must be an orientation keyword or finite number"),n.authoredGeometry!==void 0){let a=ke(n.authoredGeometry,`${t}.authoredGeometry`,r);if(a)for(let o of["refX","refY","markerWidth","markerHeight","markerUnits","orient"])Se(a,o,`${t}.authoredGeometry`,r,!0)}if(n.rootAttributes!==void 0){let a=ke(n.rootAttributes,`${t}.rootAttributes`,r);if(a)for(let[o,s]of Object.entries(a))["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"].includes(o)&&re(r,`${t}.rootAttributes.${o}`,"must use its typed marker field"),oe(s,`${t}.rootAttributes.${o}`,r,!0)}}if(i==="linear-gradient"||i==="radial-gradient"){let a=`${t}.gradient`,o=ke(n.gradient,a,r);if(o){if(o.rootAttributes!==void 0){let l=ke(o.rootAttributes,`${a}.rootAttributes`,r);if(l)for(let[u,d]of Object.entries(l))Fd(u)||re(r,`${a}.rootAttributes.${u}`,"must be a safe non-typed gradient attribute"),oe(d,`${a}.rootAttributes.${u}`,r,!0)}Se(o,"templateId",a,r,!0);let s=i==="linear-gradient"?["x1","y1","x2","y2","opacity"]:["cx","cy","fx","fy","r","ry","rotation","opacity"];for(let l of s)ua(o,l,a,r);if(ua(o,"fr",a,r),o.authoredGeometry!==void 0){let l=`${a}.authoredGeometry`,u=ke(o.authoredGeometry,l,r);if(u){let d=new Set(i==="linear-gradient"?["x1","y1","x2","y2","gradientTransform"]:["cx","cy","fx","fy","r","fr","gradientTransform"]);for(let[c,f]of Object.entries(u))d.has(c)?oe(f,`${l}.${c}`,r,!0):re(r,`${l}.${c}`,"is not allowed")}}if(o.gradientTransform!==void 0){let l=o.gradientTransform;(!Array.isArray(l)||l.length!==6||!l.every(u=>typeof u=="number"&&Number.isFinite(u)))&&re(r,`${a}.gradientTransform`,"must be a 6-element finite affine matrix")}dt(o.stops,`${a}.stops`,r,(l,u,d)=>{let c=ke(l,u,d);c&&(Se(c,"id",u,d),Sr(c.offset,`${u}.offset`,d),oe(c.color,`${u}.color`,d,!0),ua(c,"opacity",u,d))})}}if(i==="pattern"){let a=`${t}.pattern`,o=ke(n.pattern,a,r);if(o){if(o.rootAttributes!==void 0){let s=ke(o.rootAttributes,`${a}.rootAttributes`,r);if(s)for(let[l,u]of Object.entries(s))Ld(l)||re(r,`${a}.rootAttributes.${l}`,"must be a safe non-typed pattern attribute"),oe(u,`${a}.rootAttributes.${l}`,r,!0)}Se(o,"templateId",a,r,!0);for(let s of["x","y","width","height","scale","rotation","opacity"])ua(o,s,a,r);o.patternUnits!==void 0&&o.patternUnits!=="userSpaceOnUse"&&o.patternUnits!=="objectBoundingBox"&&re(r,`${a}.patternUnits`,'must be "userSpaceOnUse" or "objectBoundingBox"'),o.patternContentUnits!==void 0&&o.patternContentUnits!=="userSpaceOnUse"&&o.patternContentUnits!=="objectBoundingBox"&&re(r,`${a}.patternContentUnits`,'must be "userSpaceOnUse" or "objectBoundingBox"');for(let s of["svgContent","patternTransform","viewBox","preserveAspectRatio"])Se(o,s,a,r,!0);if(o.authoredGeometry!==void 0){let s=`${a}.authoredGeometry`,l=ke(o.authoredGeometry,s,r);if(l)for(let[u,d]of Object.entries(l))["x","y","width","height"].includes(u)?oe(d,`${s}.${u}`,r,!0):re(r,`${s}.${u}`,"is not a supported authored pattern field")}}}i==="filter"&&dt(n.filters,`${t}.filters`,r,(a,o,s)=>{ke(a,o,s)}),nr(n,t,r)}function P1(e,t,r,n){let i=ke(e,t,r);i&&((n||i.id!==void 0)&&oe(i.id,`${t}.id`,r),Sr(i.time,`${t}.time`,r,0),typeof i.value!="string"&&!(typeof i.value=="number"&&Number.isFinite(i.value))&&!(Array.isArray(i.value)&&i.value.every(a=>typeof a=="number"&&Number.isFinite(a)))&&re(r,`${t}.value`,"must be a string, finite number, or finite number array"),oe(i.easing,`${t}.easing`,r),nr(i,t,r))}function Uh(e,t,r){let n=ke(e,t,r);if(n){if(oe(n.id,`${t}.id`,r),oe(n.shapeId,`${t}.shapeId`,r),oe(n.property,`${t}.property`,r),n.textSpanTarget!==void 0){let i=ke(n.textSpanTarget,`${t}.textSpanTarget`,r);i&&(oe(i.attributeName,`${t}.textSpanTarget.attributeName`,r),Array.isArray(i.spanIds)&&i.spanIds.length===0&&re(r,`${t}.textSpanTarget.spanIds`,"must contain at least one id"),dt(i.spanIds,`${t}.textSpanTarget.spanIds`,r,(a,o,s)=>{(typeof a!="string"||a.length===0)&&re(s,o,"must be a non-empty string")}),Array.isArray(i.spanIds)&&i.spanIds.every(a=>typeof a=="string")&&new Set(i.spanIds).size!==i.spanIds.length&&re(r,`${t}.textSpanTarget.spanIds`,"must contain unique ids"))}if(Uo(n.enabled,`${t}.enabled`,r),To(n,"locked",t,r),Se(n,"sourceCssAnimationId",t,r),Se(n,"sourceMpathId",t,r),Se(n,"targetAttribute",t,r),n.targetAttributeValueType!==void 0&&n.targetAttributeValueType!=="number"&&n.targetAttributeValueType!=="color"&&n.targetAttributeValueType!=="string"&&re(r,`${t}.targetAttributeValueType`,'must be "number", "color", or "string"'),n.definitionTarget!==void 0){let i=ke(n.definitionTarget,`${t}.definitionTarget`,r);if(i&&(oe(i.definitionId,`${t}.definitionTarget.definitionId`,r),Se(i,"nodeId",`${t}.definitionTarget`,r),typeof i.definitionId=="string"&&i.definitionId.length>0)){let a=`definition:${i.definitionId}${typeof i.nodeId=="string"&&i.nodeId.length>0?`/${i.nodeId}`:""}`;n.shapeId!==a&&re(r,`${t}.shapeId`,`must equal ${a}`)}}n.simpleDuration!==void 0&&n.simpleDuration!=="indefinite"&&re(r,`${t}.simpleDuration`,'must be "indefinite" when present'),n.simpleDuration==="indefinite"&&n.cycleDuration!==void 0&&re(r,`${t}.cycleDuration`,"must be absent for an indefinite simple duration"),n.sourceSmilPlacement!==void 0&&n.sourceSmilPlacement!=="document"&&n.sourceSmilPlacement!=="defs"&&re(r,`${t}.sourceSmilPlacement`,'must be "document" or "defs" when present'),To(n,"sourceSmilParentTarget",t,r),n.sourceSmilParentTarget!==void 0&&n.sourceSmilParentTarget!==!0&&re(r,`${t}.sourceSmilParentTarget`,"must be true when present"),n.sourceSmilParentTarget===!0&&n.sourceSmilPlacement!=="document"&&re(r,`${t}.sourceSmilPlacement`,'must be "document" for an implicit parent target'),kt(n,"sourceSmilOrder",t,r),kt(n,"sourceSmilDefinitionOrder",t,r),typeof n.sourceSmilDefinitionOrder=="number"&&n.sourceSmilDefinitionOrder<0&&re(r,`${t}.sourceSmilDefinitionOrder`,"must be non-negative"),Se(n,"sourceSmilDefinitionContainerId",t,r),(n.sourceSmilDefinitionOrder!==void 0||n.sourceSmilDefinitionContainerId!==void 0)&&n.sourceSmilPlacement!=="defs"&&re(r,`${t}.sourceSmilPlacement`,'must be "defs" when definition placement fields are present'),n.textPathStartOffsetUnit!==void 0&&n.textPathStartOffsetUnit!=="%"&&n.textPathStartOffsetUnit!=="user"&&re(r,`${t}.textPathStartOffsetUnit`,'must be "%" or "user" when present'),dt(n.keyframes,`${t}.keyframes`,r,(i,a,o)=>P1(i,a,o,!0)),nr(n,t,r)}}function D1(e,t,r){let n=new Set,i=new Set;dt(e,t,r,(a,o,s)=>{let l=ke(a,o,s);if(!l)return;pe(l,o,["id","trackIds","trackFingerprints"],[],s,!1),oe(l.id,`${o}.id`,s)&&(n.has(l.id)&&re(s,`${o}.id`,"must be unique"),n.add(l.id));let u=li(l.trackIds,`${o}.trackIds`,s)?l.trackIds:[],d=li(l.trackFingerprints,`${o}.trackFingerprints`,s)?l.trackFingerprints:[];u.length!==d.length&&re(s,o,"track ids and fingerprints must have equal lengths");for(let c of u)i.has(c)&&re(s,`${o}.trackIds`,"must be unique"),i.add(c)})}function yV(e,t,r){let n=ke(e,t,r);n&&(Sr(n.duration,`${t}.duration`,r,0),Uo(n.loop,`${t}.loop`,r),Sr(n.playbackSpeed,`${t}.playbackSpeed`,r,0),n.cssAnimationSources!==void 0&&D1(n.cssAnimationSources,`${t}.cssAnimationSources`,r),Se(n,"cssAnimationDocumentStylesFingerprint",t,r),Se(n,"cssAnimationInlineStylesFingerprint",t,r),dt(n.tracks,`${t}.tracks`,r,Uh))}function vV(e,t,r){let n=ke(e,t,r);if(!n)return;qt(n.start,`${t}.start`,r),qt(n.end,`${t}.end`,r),typeof n.start=="number"&&typeof n.end=="number"&&n.end<=n.start&&re(r,`${t}.end`,"must be greater than start");let i=ke(n.style,`${t}.style`,r);i&&Object.keys(i).length===0&&re(r,`${t}.style`,"must not be empty"),nr(n,t,r)}function bV(e,t,r){let n=ke(e,t,r);n&&(pe(n,t,["start","deleteCount","insert"],[],r,!1),qt(n.start,`${t}.start`,r),qt(n.deleteCount,`${t}.deleteCount`,r),oe(n.insert,`${t}.insert`,r,!0))}var xV={"shape:add":(e,t,r)=>{pe(e,t,["shape"],[],r),Zd(e.shape,`${t}.shape`,r)},"shape:update":(e,t,r)=>{if(pe(e,t,["id","state"],["propTimestamps","clientId","textSplices","baseSeq"],r),oe(e.id,`${t}.id`,r),fV(e.state,`${t}.state`,r),e.propTimestamps!==void 0){let n=ke(e.propTimestamps,`${t}.propTimestamps`,r);if(n)for(let[i,a]of Object.entries(n))Sr(a,`${t}.propTimestamps.${i}`,r,0)}Se(e,"clientId",t,r),e.textSplices!==void 0&&dt(e.textSplices,`${t}.textSplices`,r,bV),kt(e,"baseSeq",t,r)},"shape:remove":(e,t,r)=>{pe(e,t,["id"],[],r),oe(e.id,`${t}.id`,r)},"text:format":(e,t,r)=>{pe(e,t,["id","ranges"],["baseSeq",...He],r),oe(e.id,`${t}.id`,r),dt(e.ranges,`${t}.ranges`,r,vV),kt(e,"baseSeq",t,r),qe(e,t,r)},"scene:move":(e,t,r)=>{pe(e,t,["id","parentId","index"],He,r),oe(e.id,`${t}.id`,r),e.parentId!==null&&oe(e.parentId,`${t}.parentId`,r),qt(e.index,`${t}.index`,r),qe(e,t,r)},"scene:place":(e,t,r)=>{pe(e,t,["id","parentId","orderKey"],He,r),oe(e.id,`${t}.id`,r),e.parentId!==null&&oe(e.parentId,`${t}.parentId`,r),oe(e.orderKey,`${t}.orderKey`,r),qe(e,t,r)},"clipMask:upsert":(e,t,r)=>{pe(e,t,["clipMaskGroup"],["index",...He],r),pV(e.clipMaskGroup,`${t}.clipMaskGroup`,r),kt(e,"index",t,r),qe(e,t,r)},"clipMask:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"guides:set":(e,t,r)=>{pe(e,t,["guides"],[],r),dt(e.guides,`${t}.guides`,r,Zv)},"guide:upsert":(e,t,r)=>{pe(e,t,["guide"],["index",...He],r),Zv(e.guide,`${t}.guide`,r),kt(e,"index",t,r),qe(e,t,r)},"guide:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"guide:move":(e,t,r)=>{pe(e,t,["id","index"],He,r),oe(e.id,`${t}.id`,r),qt(e.index,`${t}.index`,r),qe(e,t,r)},"measurements:set":(e,t,r)=>{pe(e,t,["measurements"],[],r),dt(e.measurements,`${t}.measurements`,r,Jv)},"measurement:upsert":(e,t,r)=>{pe(e,t,["measurement"],["index",...He],r),Jv(e.measurement,`${t}.measurement`,r),kt(e,"index",t,r),qe(e,t,r)},"measurement:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"measurement:move":(e,t,r)=>{pe(e,t,["id","index"],He,r),oe(e.id,`${t}.id`,r),qt(e.index,`${t}.index`,r),qe(e,t,r)},"metadata:set":(e,t,r)=>{pe(e,t,["metadata"],[],r),eb(e.metadata,`${t}.metadata`,r,!1)},"metadata:patch":(e,t,r)=>{pe(e,t,["patch"],["removeKeys",...He],r),eb(e.patch,`${t}.patch`,r,!0),e.removeKeys!==void 0&&li(e.removeKeys,`${t}.removeKeys`,r),qe(e,t,r)},"documentScripts:set":(e,t,r)=>{pe(e,t,["documentScripts"],[],r),dt(e.documentScripts,`${t}.documentScripts`,r,tb)},"documentExtensions:set":(e,t,r)=>{pe(e,t,["documentExtensions"],[],r),dt(e.documentExtensions,`${t}.documentExtensions`,r,rb)},"definitionContainers:set":(e,t,r)=>{pe(e,t,["definitionContainers"],[],r),dt(e.definitionContainers,`${t}.definitionContainers`,r,mV)},"documentExtension:upsert":(e,t,r)=>{pe(e,t,["documentExtension"],["index",...He],r),rb(e.documentExtension,`${t}.documentExtension`,r),kt(e,"index",t,r),qe(e,t,r)},"documentExtension:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"documentScript:upsert":(e,t,r)=>{pe(e,t,["documentScript"],["index",...He],r),tb(e.documentScript,`${t}.documentScript`,r),kt(e,"index",t,r),qe(e,t,r)},"documentScript:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"documentStyles:set":(e,t,r)=>{pe(e,t,["documentStyles"],[],r),dt(e.documentStyles,`${t}.documentStyles`,r,nb)},"documentStyle:upsert":(e,t,r)=>{pe(e,t,["documentStyle"],["index",...He],r),nb(e.documentStyle,`${t}.documentStyle`,r),kt(e,"index",t,r),qe(e,t,r)},"documentStyle:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"templateVariables:set":(e,t,r)=>{pe(e,t,["templateVariables"],He,r),dt(e.templateVariables,`${t}.templateVariables`,r,ib),qe(e,t,r)},"templateVariable:upsert":(e,t,r)=>{pe(e,t,["templateVariable"],["index",...He],r),ib(e.templateVariable,`${t}.templateVariable`,r),kt(e,"index",t,r),qe(e,t,r)},"templateVariable:remove":(e,t,r)=>{pe(e,t,["name"],He,r),oe(e.name,`${t}.name`,r),qe(e,t,r)},"exportItems:set":(e,t,r)=>{pe(e,t,["exportItems"],He,r),dt(e.exportItems,`${t}.exportItems`,r,ab),qe(e,t,r)},"exportItem:upsert":(e,t,r)=>{pe(e,t,["exportItem"],["index",...He],r),ab(e.exportItem,`${t}.exportItem`,r),kt(e,"index",t,r),qe(e,t,r)},"exportItem:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"colorGlyphLibrary:set":(e,t,r)=>{if(pe(e,t,["colorGlyphLibrary"],He,r),e.colorGlyphLibrary!==null){let n=ke(e.colorGlyphLibrary,`${t}.colorGlyphLibrary`,r);n&&(n.version!==1&&re(r,`${t}.colorGlyphLibrary.version`,"must be 1"),dt(n.entries,`${t}.colorGlyphLibrary.entries`,r,gV),nr(n,`${t}.colorGlyphLibrary`,r))}qe(e,t,r)},"animation:set":(e,t,r)=>{pe(e,t,["animationTimeline"],[],r),e.animationTimeline!==void 0&&yV(e.animationTimeline,`${t}.animationTimeline`,r)},"animation:config":(e,t,r)=>{pe(e,t,["config"],He,r);let n=ke(e.config,`${t}.config`,r);n&&(pe(n,`${t}.config`,["duration","loop","playbackSpeed"],["cssAnimationSources","cssAnimationDocumentStylesFingerprint","cssAnimationInlineStylesFingerprint"],r,!1),Sr(n.duration,`${t}.config.duration`,r,0),Uo(n.loop,`${t}.config.loop`,r),Sr(n.playbackSpeed,`${t}.config.playbackSpeed`,r,0),n.cssAnimationSources!==void 0&&D1(n.cssAnimationSources,`${t}.config.cssAnimationSources`,r),Se(n,"cssAnimationDocumentStylesFingerprint",`${t}.config`,r),Se(n,"cssAnimationInlineStylesFingerprint",`${t}.config`,r)),qe(e,t,r)},"animation:clear":(e,t,r)=>{pe(e,t,[],He,r),qe(e,t,r)},"animationTrack:upsert":(e,t,r)=>{pe(e,t,["track"],["index",...He],r),Uh(e.track,`${t}.track`,r),kt(e,"index",t,r),qe(e,t,r)},"animationTrack:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"animationKeyframe:upsert":(e,t,r)=>{pe(e,t,["trackId","keyframe"],He,r),oe(e.trackId,`${t}.trackId`,r),P1(e.keyframe,`${t}.keyframe`,r,!0),qe(e,t,r)},"animationKeyframe:remove":(e,t,r)=>{pe(e,t,["trackId","keyframeId"],He,r),oe(e.trackId,`${t}.trackId`,r),oe(e.keyframeId,`${t}.keyframeId`,r),qe(e,t,r)},"library:set":(e,t,r)=>{pe(e,t,["library"],[],r),dt(e.library,`${t}.library`,r,sb)},"library:upsert":(e,t,r)=>{pe(e,t,["def"],["index",...He],r),sb(e.def,`${t}.def`,r),kt(e,"index",t,r),qe(e,t,r)},"library:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"paintServerDefs:set":(e,t,r)=>{pe(e,t,["paintServerDefs"],[],r),dt(e.paintServerDefs,`${t}.paintServerDefs`,r,ob)},"paintServerDef:upsert":(e,t,r)=>{pe(e,t,["paintServerDef"],["index",...He],r),ob(e.paintServerDef,`${t}.paintServerDef`,r),kt(e,"index",t,r),qe(e,t,r)},"paintServerDef:remove":(e,t,r)=>{pe(e,t,["id"],He,r),oe(e.id,`${t}.id`,r),qe(e,t,r)},"presence:cursor":(e,t,r)=>{pe(e,t,["position"],[],r);let n=ke(e.position,`${t}.position`,r);n&&(pe(n,`${t}.position`,["x","y"],[],r,!1),Sr(n.x,`${t}.position.x`,r),Sr(n.y,`${t}.position.y`,r))},"presence:selection":(e,t,r)=>{pe(e,t,["shapeIds"],[],r),li(e.shapeIds,`${t}.shapeIds`,r)}},h7=new Set(Object.keys(xV));function wV(e){let t=e.state.children;return Array.isArray(t)?t:void 0}var Qf=new Set(["group","hyperlink","switch","container","svg"]);function j1(e,t,r,n){for(let i of e){r.set(i.id,t),n.set(i.id,i);let a=wV(i);a&&j1(a,i.id,r,n)}}function IV(e){let t=e.sceneTree;if(!t||t.length===0)return;let r=new Map,n=new Map;if(j1(e.shapes,null,r,n),n.size===0)return;let i=new Map;for(let c of t){let f=i.get(c.parentId)??[];f.push(c),i.set(c.parentId,f)}let a=new Map,o=(c,f)=>{let p=a.get(c);p?p.push(f):a.set(c,[f])},s=new Set,l=new Set,u=(c,f)=>{for(let p of Ch(i.get(c)??[])){if(l.has(p.id))continue;l.add(p.id);let h=n.get(p.id);if(!h){u(p.id,f);continue}o(f,h),s.add(h.id),Qf.has(h.type)&&u(p.id,h.id)}};if(u(null,null),s.size===0)return;let d=c=>{let f=r.get(c)??null,p=new Set;for(;f!==null&&!p.has(f);){p.add(f);let h=n.get(f);if(h&&Qf.has(h.type))return f;f=r.get(f)??null}return null};for(let[c,f]of n)s.has(c)||o(d(c),f);for(let[c,f]of n){if(!Qf.has(f.type))continue;let p=f.state,h=a.get(c);h&&h.length>0?p.children=h:"children"in p&&delete p.children}e.shapes=a.get(null)??[]}var lb={schemaVersion:{kind:"stamped",note:"Serializer stamps CURRENT_SCHEMA_VERSION; no live state."},shapes:{kind:"graph",note:"SceneNode props on graph-owned nodes; the editor Shape registry is the interaction adapter."},viewboxes:{kind:"shape-derived",note:"Projected from `view` shapes on every read (DocumentRootManager.getViewboxes)."},guides:{kind:"aggregate"},measurements:{kind:"aggregate"},sceneTree:{kind:"graph",note:"Serialized by walking the SceneGraph; inline state.children is its projection."},clipMaskGroups:{kind:"aggregate"},documentMetadata:{kind:"aggregate"},documentExtensions:{kind:"aggregate"},definitionContainers:{kind:"aggregate"},documentScripts:{kind:"aggregate"},documentStyles:{kind:"aggregate"},templateVariables:{kind:"aggregate"},animationTimeline:{kind:"aggregate"},library:{kind:"aggregate"},paintServerDefs:{kind:"aggregate"},colorGlyphLibrary:{kind:"aggregate"},exportItems:{kind:"aggregate"},unknownFields:{kind:"aggregate"}},m7=Object.keys(lb).filter(e=>lb[e].kind==="aggregate");var E1=new Set(["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-linejoin","stroke-linecap","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","markers"]),z1=new Set(["element-opacity","blend-mode","filter","visibility","display","visible","css-clip-path","css-mask-properties","metadata","system-language","required-extensions","inline-style","authored-attributes","container-presentation"]),kV=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-opacity","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","marker","marker-start","marker-mid","marker-end","paint-order","color"]);function SV(e){let t=new Set,r=n=>{if(!(!n||typeof n!="object"||Array.isArray(n)))for(let i of Object.keys(n))kV.has(i)&&t.add(i)};return r(e.inlineStyle),r(e.authoredAttributes),[...t].sort()}function _1(e){let t=new Set;for(let r of _o)if(e.has(r.id))for(let n of r.keys)t.add(n);return t}var $V=_1(E1),NV=_1(z1);function MV(e){return ga(`${e.id}-geometry`)}function R1(e,t){let r=e.state.appearance;return Array.isArray(r)&&r.length>0?!0:wb(e.state,t)?aA(Ib(e.state,t)):!1}function AV(e){let t={...e};for(let r of $V)delete t[r];for(let r of NV)delete t[r];return delete t.appearance,delete t.graphicStyleId,t.inheritFill=!0,t.inheritStroke=!0,t.fillType="solid",t.strokeType="solid",t}function CV(e,t={}){let r={};if(e.kind==="fill")r.fillType=e.paintType??"solid",e.color!==void 0&&(r.fillColor=e.color),e.gradient!==void 0&&(r.fillGradient=e.gradient),e.libraryId!==void 0&&(r.fillLibraryId=e.libraryId),e.opacity!==void 0&&(r.fillOpacity=e.opacity),e.authoredPaint!==void 0&&(r.authoredFillPaint=e.authoredPaint),r.strokeType="none";else{r.strokeType=e.paintType??"solid",e.color!==void 0&&(r.borderColor=e.color),e.gradient!==void 0&&(r.strokeGradient=e.gradient),e.libraryId!==void 0&&(r.strokeLibraryId=e.libraryId),e.opacity!==void 0&&(r.strokeOpacity=e.opacity),e.width!==void 0&&(r.borderWidth=e.width),e.linejoin!==void 0&&(r.strokeLinejoin=e.linejoin),e.linecap!==void 0&&(r.strokeLinecap=e.linecap),e.miterlimit!==void 0&&(r.strokeMiterlimit=e.miterlimit),e.dasharray!==void 0&&(r.strokeDasharray=e.dasharray),e.dashoffset!==void 0&&(r.dashOffset=e.dashoffset),e.authoredPaint!==void 0&&(r.authoredStrokePaint=e.authoredPaint),r.fillType="none";let n=t.withMarkers;n&&(n.markerStart!==void 0&&(r.markerStart=n.markerStart),n.markerMid!==void 0&&(r.markerMid=n.markerMid),n.markerEnd!==void 0&&(r.markerEnd=n.markerEnd))}return r}function ub(e,t,r,n){let i=Ro(e),a=_o.filter(o=>t.has(o.id)).flatMap(o=>sl(o,i,{shapeId:r,includeAuthoredAttributes:!0}));return n(a)}function OV(e,t){if(!R1(e,t.styles))return null;let r=SV(e.state);if(r.length>0)return t.reportUnexpandable?.(e,r),null;let n=iA(e.state,t.styles);return n.length===0?db(e,[],t):db(e,n,t)}function db(e,t,r){let n=MV(e),i={...e,state:AV(e.state)},a=r.renderShape(i),o=PV(a,n,r.escapeAttributeValue),s=t.findIndex(c=>c.kind==="stroke"),l=t.map((c,f)=>{let p=CV(c,{withMarkers:f===s?e.state:void 0}),h=ub(p,E1,e.id,r.serializePresentationWrites),m=TV(c,r.escapeAttributeValue);return`<use href="#${r.escapeAttributeValue(n)}"${h}${m}/>`}),u=ub(e.state,z1,e.id,r.serializePresentationWrites),d=`<g data-shape-id="${r.escapeAttributeValue(e.id)}"${u}>`;return{geometryId:n,geometryMarkup:o,open:d,close:"</g>",members:l}}function TV(e,t){let r=e.filterLibraryIds;return!Array.isArray(r)||r.length===0?"":` filter="${r.map(n=>`url(#${t(n)})`).join(" ")}"`}function PV(e,t,r){let n=/^<([A-Za-z][\w:.-]*)/.exec(e);if(!n)return e;let i=n[0].length;return`${e.slice(0,i)} id="${r(t)}"${e.slice(i)}`}function Fs(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(Fs).join(",")}]`:`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${Fs(r)}`).join(",")}}`}function Ls(e,t,r){for(let n of e){n.type==="symbol-instance"&&r(n,t);let i=n.state.children;if(!Array.isArray(i))continue;let a=t;n.type==="svg"&&(a=Th(n,t).viewport.childPercentBasis??t),Ls(i,a,r)}}function Bp(e,t,r,n,i=new Set){if(!i.has(e.id)){i.add(e.id);for(let a of e.definitionContentOrder??[]){if(a.kind!=="definition")continue;let o=t.symbol(a.id);!o||(o.defKind??"symbol")==="symbol"||(Ls(o.shapes,r,n),Bp(o,t,r,n,i))}i.delete(e.id)}}function Gu(e,t){for(let r of e){if(r.type==="symbol-instance"){let i=String(r.state.symbolId??"").trim();i&&t.add(i)}let n=r.state.children;Array.isArray(n)&&Gu(n,t)}}function DV(e,t){let r=new Map;for(let a of e){if(a.kind!=="symbol")continue;let o=new Set;Gu(a.shapes,o);for(let u of Object.values(a.variants??{}))Gu(u,o);let s=new Set,l=u=>{if(!s.has(u.id)){s.add(u.id);for(let d of u.definitionContentOrder??[]){if(d.kind!=="definition")continue;let c=t.symbol(d.id);!c||(c.defKind??"symbol")==="symbol"||(Gu(c.shapes,o),l(c))}s.delete(u.id)}};l(a),r.set(a.id,o)}let n=new Map,i=a=>{let o=n.get(a);if(o==="visiting"||o==="cycle-reachable")return!0;if(o==="acyclic")return!1;n.set(a,"visiting");let s=!1;for(let l of r.get(a)??[])t.symbol(l)&&i(l)&&(s=!0);return n.set(a,s?"cycle-reachable":"acyclic"),s};for(let a of r.keys())i(a);return new Set([...n].flatMap(([a,o])=>o==="cycle-reachable"?[a]:[]))}function jV(e,t,r={}){let n=r.reservedIds??new Set,i=oI(e),a=DV(e,i),o=new Map,s=[],l=new WeakMap,u=new Map,d=[],c=(C,O)=>{l.set(C,O);let E=u.get(C.id);E?E.push(O):u.set(C.id,[O]),d.push(...O.diagnostics)},f=(C,O,E)=>{if(l.has(C))return;let _=String(C.state.symbolId??"").trim(),U=_!==""&&i.duplicateIds.has(_),V=_?i.symbol(_):void 0;if(U||!V){c(C,{targetId:null,definition:null,materializationKey:null,materialization:null,parentViewport:E,viewport:null,diagnostics:[{code:U?"duplicate-library-id":"unresolved-symbol-definition",shapeId:C.id,message:U?`Symbol instance ${C.id} targets duplicate library id ${_}.`:`Symbol instance ${C.id} targets missing symbol definition ${_||"(blank)"}.`}]});return}let q=r.instancePolicy?.(C),G=q?.initialVariantKey===void 0?C:{...C,state:{...C.state,variantKey:q.initialVariantKey}},H=Yb(V,G),W=q?.dedicated===!0,B=lI(C,V,E,r.viewportHost);if(O.includes(H.materializationKey)){c(C,{targetId:null,definition:V,materializationKey:H.materializationKey,materialization:null,parentViewport:E,viewport:B,diagnostics:[...H.diagnostics,{code:"symbol-cycle",shapeId:C.id,message:`Symbol instance cycle detected through ${V.id}.`}]});return}let ie=E?`${E.width},${E.height}`:"none",Y=!H.materialized&&!W&&!a.has(V.id),X=Y?`${H.materializationKey}\0native-base\0viewport=${ie}`:`${H.materializationKey}\0path=${O.join("")}\0viewport=${ie}`+(W?`\0dedicated=${C.id}`:""),Z=o.get(X),J=Z===void 0;if(!Z){let we=structuredClone(H.shapes);Z={occurrenceKey:X,materializationKey:H.materializationKey,candidateTargetId:W?`${V.id}--ovr-${C.id}`:H.candidateTargetId,targetId:W?`${V.id}--ovr-${C.id}`:H.candidateTargetId,definition:V,shapes:we,materialized:H.materialized||W,forcedDedicated:W,activeDepth:O.length,parentViewport:E,viewport:B},o.set(X,Z),s.push(Z)}let Q={targetId:Z.targetId,definition:V,materializationKey:H.materializationKey,materialization:null,diagnostics:H.diagnostics,parentViewport:E,viewport:B,pending:Z};if(c(C,Q),Y&&!J)return;let Ee=[...O,H.materializationKey];Ls(Z.shapes,Z.viewport.childPercentBasis??E,(we,Xe)=>f(we,Ee,Xe)),Bp(Z.definition,i,Z.viewport.childPercentBasis??E,(we,Xe)=>f(we,Ee,Xe))};Ls(t,r.parentViewport,(C,O)=>{f(C,[],O)});let p=new Map,h=new Map,m=new Set,g=C=>{let O=p.get(C);if(O)return O;if(m.has(C))throw new Error(`Materialization occurrence graph retained a cycle at ${C.occurrenceKey}.`);m.add(C);let E=[];Ls(C.shapes,C.viewport.childPercentBasis??C.parentViewport,V=>{let q=l.get(V);if(q?.pending){E.push(`resolved:${g(q.pending)}`);return}E.push(Fs({materializationKey:q?.materializationKey??null,diagnostics:q?.diagnostics.map(G=>G.code)??["missing-resolution"]}))}),Bp(C.definition,i,C.viewport.childPercentBasis??C.parentViewport,V=>{let q=l.get(V);if(q?.pending){E.push(`resolved:${g(q.pending)}`);return}E.push(Fs({materializationKey:q?.materializationKey??null,diagnostics:q?.diagnostics.map(G=>G.code)??["missing-resolution"]}))}),m.delete(C);let _=Fs({materializationKey:C.materializationKey,nested:E,forcedOccurrence:C.forcedDedicated?C.occurrenceKey:null}),U=h.get(_);return U||(U=`materialization-signature:${h.size+1}`,h.set(_,U)),p.set(C,U),U},v=(C,O)=>C.activeDepth-O.activeDepth||C.candidateTargetId.localeCompare(O.candidateTargetId)||C.occurrenceKey.localeCompare(O.occurrenceKey),y=new Map;for(let C of s){let O=g(C),E=y.get(O);(!E||v(C,E)<0)&&y.set(O,C)}let b=new Map;for(let C of s)b.set(C,y.get(g(C)));let I=s.filter(C=>b.get(C)===C),x=new Map;for(let C of I){let O=x.get(C.materializationKey);(!O||O.forcedDedicated&&!C.forcedDedicated||O.forcedDedicated===C.forcedDedicated&&v(C,O)<0)&&x.set(C.materializationKey,C)}let k=C=>C.forcedDedicated||C.materialized||x.get(C.materializationKey)!==C,$=new Set(I.filter(C=>!k(C)).map(C=>C.definition.id)),A=new Set([...n,...$,...I.filter(k).map(C=>C.candidateTargetId)]),S=new Set([...n,...$]);for(let C of I){if(!k(C)){C.targetId=C.definition.id;continue}let O=C.candidateTargetId,E=O;if(S.has(E)){let _=2;do E=`${O}-${_++}`;while(A.has(E)||S.has(E))}C.targetId=E,S.add(E)}let N=new Map,T=I.map(C=>{let O={materializationKey:C.materializationKey,targetId:C.targetId,candidateTargetId:C.candidateTargetId,definition:C.definition,shapes:C.shapes,parentViewport:C.parentViewport,viewport:C.viewport};return N.set(C,O),O});for(let C of s){let O=b.get(C),E=N.get(O);C.targetId=E.targetId,C!==O&&N.set(C,{materializationKey:C.materializationKey,targetId:E.targetId,candidateTargetId:C.candidateTargetId,definition:C.definition,shapes:C.shapes,parentViewport:C.parentViewport,viewport:C.viewport})}let z=new Set;for(let C of u.values())for(let O of C){if(!O.pending)continue;O.targetId=O.pending.targetId;let E=N.get(O.pending)??null;E&&z.has(O.pending)?O.materialization={...E,parentViewport:O.parentViewport,viewport:O.viewport??E.viewport}:(O.materialization=E,z.add(O.pending)),delete O.pending}return{materializations:T,diagnostics:d,resolve(C){let O=l.get(C);if(O)return O;let E=u.get(C.id);return E?.length===1?E[0]:void 0}}}var EV="text/css";function Vp(e){return e.includes("{")?e.replace(/([^{}]*)\{([^{}]*)\}/g,(t,r,n)=>{let i=cb(n);if(i===n)return t;let a=String(r).trim();return!/^(?:from|to|[\d.]+%)(?:\s*,\s*(?:from|to|[\d.]+%))*$/i.test(a)&&!/[^\s;]/.test(i)?"":`${r}{${i}}`}):cb(e)}var zV=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?animation(?:-[a-z-]+)?\s*:[^;]*(?:;|$)/gi,_V=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?transition(?:-[a-z-]+)?\s*:[^;]*(?:;|$)/gi,RV=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?(?:transform-origin|transform-box)\s*:[^;]*(?:;|$)/gi;function cb(e){let t=!1,r=e.replace(zV,n=>(t=!0,ep(n)));return r=r.replace(_V,n=>ep(n)),t&&(r=r.replace(RV,n=>ep(n))),r}function ep(e){return e.startsWith(";")?";":""}function FV(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function F1(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;")}function L1(e){let t=e.map(({name:r,defaultValue:n})=>` --${r}: ${n};`);return t.length?`:root, svg {
66
+ ${t.join(`
67
+ `)}
68
+ }
69
+ `:""}function LV(e){if(!e||e.length===0)return"";let t=L1(e);return t?`<style id="svgsketch-variables">${F1(t)}</style>`:""}function Pu(e,t={}){if(!e||e.length===0)return"";let r=[];for(let n of e){if(t.placement&&n.placement!==t.placement)continue;let i=new Map;if(n.svgId&&i.set("id",n.svgId),n.type&&n.type!==EV&&i.set("type",n.type),n.media&&i.set("media",n.media),n.customAttrs)for(let[s,l]of Object.entries(n.customAttrs))i.has(s)||i.set(s,l);let a="<style";for(let[s,l]of i)a+=` ${s}="${FV(l)}"`;let o=t.retainAnimationDeclarations?n.css:Vp(n.css);a+=`>${F1(o)}</style>`,r.push(a)}return r.join("")}function BV(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function VV(e){return e?e.includes("]]>")?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):/[<&>]/.test(e)?`<![CDATA[${e}]]>`:e:""}function UV(e){if(!e||e.length===0)return"";let t=[];for(let r of e){let n=new Map;if(r.svgId&&n.set("id",r.svgId),r.type&&n.set("type",r.type),r.source==="external"&&r.href&&n.set("href",r.href),r.crossorigin&&n.set("crossorigin",r.crossorigin),r.async&&n.set("async",""),r.defer&&n.set("defer",""),r.customAttrs)for(let[a,o]of Object.entries(r.customAttrs))n.has(a)||n.set(a,o);let i="<script";for(let[a,o]of n)i+=` ${a}="${BV(o)}"`;r.source==="inline"&&r.content?i+=`>${VV(r.content)}</script>`:i+="/>",t.push(i)}return t.join("")}var GV={defs:[],root:[],suppressedShapeIds:new Set,memberToDirective:new Map};function Vr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function Up(e){return e.definitionId??`${e.type}-${e.id}`}function Jd(e,t){let r=0;for(;r<e.length;){let u=/^\s+/.exec(e.slice(r));if(u){r+=u[0].length;continue}if(!e.startsWith("<!--",r))break;let d=e.indexOf("-->",r+4);if(d<0)return e;r=d+3}let n=e.slice(r),i=/^<([A-Za-z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(n);if(!i)return e;let[a,o,s,l]=i;return e.slice(0,r)+`<${o}${t(s)}${l}>`+n.slice(a.length)}function XV(e,t){return Jd(e,r=>{let n=r.replace(/\s+id\s*=\s*(?:"[^"]*"|'[^']*')/,"");return` id="${Vr(t)}"${n}`})}function B1(e,t,r){if(!r)return e;let n=`<svg xmlns="${ye}">`,i=`${n}${e}</svg>`,a=mx.parse(i);if("error"in a)return e;let o=a.nodes.find(d=>d.kind==="element")?.children.find(d=>d.kind==="element");if(!o)return e;let s=[],l=(d,c)=>{if(d.kind!=="element")return;let f=c?void 0:d.attributes.find(h=>h.namespaceUri===null&&h.localName==="id")?.value,p=c?r(t):f?r(t,f):void 0;if(p?.length){let h=p.join(""),m=i.slice(d.span.start,d.span.end),g=/<\/[^>]+>\s*$/u.exec(m);if(g?.index!==void 0){let v=d.span.start+g.index;s.push({start:v,end:v,value:h})}else{let v=/\/\s*>\s*$/u.exec(m);if(v?.index!==void 0){let y=d.span.start+v.index;s.push({start:y,end:d.span.end,value:`>${h}</${d.name}>`})}}}for(let h of d.children)l(h,!1)};l(o,!0);let u=i;for(let d of s.sort((c,f)=>f.start-c.start))u=u.slice(0,d.start)+d.value+u.slice(d.end);return u.slice(n.length,u.length-6)}function WV(e,t,r){if(!e)return[];let n={...e,tracks:e.tracks.filter(i=>i.definitionTarget?.definitionId===t&&i.definitionTarget.nodeId===r)};return n.tracks.length===0?[]:_s(n,{placement:"target"}).get(Id({definitionId:t,...r?{nodeId:r}:{}}))??[]}function HV(e,t,r){return r?B1(e,t,(n,i)=>WV(r,n,i)):e}function Bs(e,t){return e.replace(new RegExp(`\\s+${t}\\s*=\\s*(?:"[^"]*"|'[^']*')`,"g"),"")}function qV(e,t,r){return Jd(e,n=>{let i=Bs(n,"data-shape-id");if(t==="clip"){let a=/\bfill-rule\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(i);i=Bs(i,"fill-rule"),i=Bs(i,"clip-rule");let o=r??a?.[1]??a?.[2];o&&(i+=` clip-rule="${Vr(o)}"`)}return i})}function YV(e,t,r,n,i){let a=qV(va(e,n),t,r);return i===void 0?a:Jd(a,o=>{let s=Bs(o,"transform");return i?`${s} transform="${Vr(i)}"`:s})}function KV(e,t,r,n){let i=e.clipMaskGroups;if(!Array.isArray(i)||i.length===0)return GV;let a=new Map;for(let p of e.shapes??[])zi(p,{onShape:h=>a.set(h.id,h)});let o=_h(Array.isArray(e.library)?e.library:[]);o.animationElementsForShape=p=>t?.get(p.id),o.textPathAnimationElementsForShape=p=>r?.get(p.id);let s=new Set,l=new Map,u=new Set,d=[],c=[],f=(p,h)=>{(p.definitionPlacement==="document"?c:d).push({definitionId:Up(p),...p.definitionOrder!==void 0?{definitionOrder:p.definitionOrder}:{},...p.definitionContainerId?{definitionContainerId:p.definitionContainerId}:{},...p.authoredPlacement?{authoredPlacement:structuredClone(p.authoredPlacement)}:{},markup:h})};for(let p of i){if(!p||p.type!=="clip"&&p.type!=="mask")continue;let h=Up(p),m=Array.isArray(p.clipShapeIds)?p.clipShapeIds:[];for(let v of m)s.add(v);if(!u.has(h)){if(typeof p.rawDefinition=="string"&&p.rawDefinition.length>0)u.add(h),f(p,B1(XV(p.rawDefinition,h),h,n));else if(m.length>0){u.add(h);let v=p.type==="clip"?"clipPath":"mask",y=`<${v} id="${Vr(h)}"`;p.type==="clip"?(p.clipPathUnits&&(y+=` clipPathUnits="${Vr(p.clipPathUnits)}"`),p.clipRule&&(y+=` clip-rule="${Vr(p.clipRule)}"`)):(p.maskUnits&&(y+=` maskUnits="${Vr(p.maskUnits)}"`),p.maskContentUnits&&(y+=` maskContentUnits="${Vr(p.maskContentUnits)}"`),p.maskBounds&&(y+=` x="${Vr(p.maskBounds.x)}" y="${Vr(p.maskBounds.y)}"`,y+=` width="${Vr(p.maskBounds.width)}"`,y+=` height="${Vr(p.maskBounds.height)}"`),p.maskType&&(y+=` mask-type="${Vr(p.maskType)}"`)),y+=">",y+=(n?.(h)??[]).join("");for(let b of m){let I=a.get(b);I&&(y+=YV(I,p.type,p.clipRule,o))}y+=`</${v}>`,f(p,y)}}let g=Array.isArray(p.contentShapeIds)?p.contentShapeIds:[];if(g.length>0){let v={attr:p.type==="clip"?"clip-path":"mask",defId:h,memberIds:g,...p.referenceChannel?{referenceChannel:p.referenceChannel}:{},...p.referenceStyleOrder!==void 0?{referenceStyleOrder:p.referenceStyleOrder}:{}};for(let y of g)l.has(y)||l.set(y,v)}}return{defs:d,root:c,suppressedShapeIds:s,memberToDirective:l}}function ZV(e,t,r="attribute"){return Jd(e,n=>{let i=Bs(n,t.attr),a=/\s+style\s*=\s*(["'])(.*?)\1/u.exec(i);if(a){let d=da(a[2],";").map(c=>c.trim()).filter(c=>{if(c.length===0)return!1;let[f]=da(c,":");return f?.trim().toLowerCase()!==t.attr});i=d.length?i.replace(a[0],` style=${a[1]}${d.join("; ")}${a[1]}`):i.replace(a[0],"")}if(r==="stylesheet")return i;let o=`url(#${Vr(t.defId)})`;if(r!=="style")return`${i} ${t.attr}="${o}"`;let s=/\s+style\s*=\s*(["'])(.*?)\1/u.exec(i);if(!s)return`${i} style="${t.attr}: ${o}"`;let l=da(s[2],";").map(d=>d.trim()).filter(Boolean);l.splice(Math.min(t.referenceStyleOrder??l.length,l.length),0,`${t.attr}: ${o}`);let u=l.join("; ");return i.replace(s[0],` style=${s[1]}${u}${s[1]}`)})}function V1(e,t){let r=e.state?.children;return!Array.isArray(r)||r.length===0?e:{...e,state:{...e.state,children:JV(r,t)}}}function JV(e,t){let r=e.filter(i=>!t.suppressedShapeIds.has(i?.id)).map(i=>V1(i,t)),n=[];for(let i=0;i<r.length;){let a=r[i],o=t.memberToDirective.get(a.id);if(!o){n.push(a),i++;continue}let s=[a],l=i+1;for(;l<r.length&&t.memberToDirective.get(r[l].id)===o;)s.push(r[l]),l++;s.length===1?n.push(QV(a,o)):o.referenceChannel==="stylesheet"?n.push(...s):n.push(eU(s,o)),i=l}return n}function QV(e,t){if(t.referenceChannel==="stylesheet")return e;let r=e.state,n=r.presentationChannels;if(t.referenceChannel==="style"||n?.[t.attr]==="style"){let a=e.type==="symbol-instance"||e.type==="shape-reference"?"instancePresentation":"inlineStyle",o=Object.entries(r[a]??{}).filter(([l])=>l!==t.attr);o.splice(Math.min(t.referenceStyleOrder??o.length,o.length),0,[t.attr,`url(#${t.defId})`]);let s=Object.fromEntries(o);return{...e,state:{...r,[a]:s}}}let i={...r.authoredAttributes??{},[t.attr]:`url(#${t.defId})`};return{...e,state:{...r,authoredAttributes:i}}}function eU(e,t){return{id:`clipmask-wrapper:${t.defId}:${e[0].id}`,type:"group",state:{children:e,groupData:{[t.attr==="clip-path"?"clipPath":"mask"]:`url(#${t.defId})`}}}}function tU(e){return e.replace(new RegExp(`\\s+${II}\\s*=\\s*(?:"[^"]*"|'[^']*')`,"g"),"")}function tp(e,t){let r=/url\(\s*['"]?#([^'")\s]+)['"]?\s*\)/g,n;for(;(n=r.exec(e))!==null;)t.add(n[1]);let i=/\b(?:xlink:)?href\s*=\s*(?:"#([^"]+)"|'#([^']+)')/g;for(;(n=i.exec(e))!==null;)t.add(n[1]??n[2])}function fb(e,t,r=[],n=new Set,i=e.animationTimeline){let a=new Map;for(let d of e.paintServerDefs??[]){if(!d||typeof d.markup!="string")continue;let c=d.id??SI(d.markup);!c||n.has(c)||a.set(c,{id:c,markup:HV(tU(d.markup),c,i),passthrough:d.passthrough===!0,...d.authoredPlacement?{authoredPlacement:d.authoredPlacement}:{},...d.definitionOrder!==void 0?{definitionOrder:d.definitionOrder}:{},...d.definitionContainerId?{definitionContainerId:d.definitionContainerId}:{}})}if(a.size===0)return[];let o=new Set;tp(t,o);for(let d of r)tp(d,o);let s=new Map;for(let d of a.values())(d.passthrough||d.authoredPlacement)&&s.set(d.id,d);let l=!0;for(;l;){l=!1;for(let d of a.values())s.has(d.id)||!o.has(d.id)||(s.set(d.id,d),l=!0);for(let d of s.values()){let c=o.size;tp(d.markup,o),o.size>c&&(l=!0)}}if(s.size===0)return[];let u=[];for(let d of a.values())s.has(d.id)&&u.push({id:d.id,markup:d.markup,...d.authoredPlacement?{authoredPlacement:d.authoredPlacement}:{},...d.definitionOrder!==void 0?{definitionOrder:d.definitionOrder}:{},...d.definitionContainerId?{definitionContainerId:d.definitionContainerId}:{}});return u}function pb(e){let t=new Set;for(let r of e??[])t.add(r.definitionId??`${r.type}-${r.id}`);return t}function rU(e){return e==="stylesheet-static"||e==="stylesheet-dynamic"?"stylesheet":e}function ba(e){return e.entries.map(t=>t.markup).join("")}function rp(e){return e.map((t,r)=>({entry:t,index:r})).sort((t,r)=>{let n=t.entry.definitionOrder,i=r.entry.definitionOrder;return n!==void 0&&i!==void 0?n-i:n!==void 0?-1:i!==void 0?1:t.index-r.index}).map(({entry:t})=>t)}function nU(e){return aB.some(t=>t===e)}function iU(e,t){let r=Mn(e);return r&&r.width>0&&r.height>0?{width:r.width,height:r.height}:t}function hl(e,t={}){let{backgroundColor:r,includeScripts:n=!0,includeMetadata:i=!0}=t;if(e.sceneTree&&e.sceneTree.length>0){let M={...e,shapes:structuredClone(e.shapes??[])};IV(M),e=M}let a=e.shapes??[],o=a.find(M=>M.type==="svg"&&M.state?.isRootSvg===!0),s=o?.state,l=Number(s?.svgViewBoxWidth??0),u=Number(s?.svgViewBoxHeight??0),d=l>0&&u>0?{x:Number(s?.svgViewBoxX??0),y:Number(s?.svgViewBoxY??0),width:l,height:u,intrinsicWidth:Number(s?.svgWidth??0)>0?Number(s?.svgWidth):l,intrinsicHeight:Number(s?.svgHeight??0)>0?Number(s?.svgHeight):u,preserveAspectRatio:typeof s?.svgPreserveAspectRatio=="string"?s.svgPreserveAspectRatio.trim():""}:null,c=e.viewboxes?.[0],f=t.width??d?.intrinsicWidth??c?.width??800,p=t.height??d?.intrinsicHeight??c?.height??600,h=s?.authoredRootDimensions,m=(M,K,se)=>{if(se!==void 0)return se;if(t[M]!==void 0)return K;let Be=h?.[M];return typeof Be?.raw=="string"&&Be.resolved===K?Be.raw:K},g=m("width",f,t.widthAttribute),v=m("height",p,t.heightAttribute),y=t.viewBox??(d?`${d.x} ${d.y} ${d.width} ${d.height}`:`0 0 ${f} ${p}`),b=t.preserveAspectRatio??d?.preserveAspectRatio??"",I=iU(y,d?{width:d.width,height:d.height}:{width:f,height:p}),x=new Set,k=M=>{for(let K of M??[])x.add(K.id),k(K.state?.children)};for(let M of a)k(M.state?.children);let $=a.filter(M=>M.state?.displayMode==="motionOnly"),A=a.filter(M=>M.state?.displayMode!=="motionOnly"&&M!==o&&!x.has(M.id)),S=Zn(a).ordered,N=new Map(S.map(M=>[M.id,M])),T=new Set([...$.filter(M=>Gp(M)!==null).map(M=>M.id),...S.filter(M=>M.type==="path"&&M.state?.displayMode!=="motionOnly").map(M=>M.id)]),z=e.animationTimeline?{...e.animationTimeline,tracks:e.animationTimeline.tracks.map(M=>{let K=M.motionPathRef;if(M.property!=="pathMotion"||!M.motionPath||!K||(K.mode??"trackShape")!=="curveTemplate"||T.has(K.shapeId))return M;let{motionPathRef:se,...Be}=M;return Be})}:null,C=L3(z,e.documentStyles,e.shapes),O=C??new Set,E=C!==null,_=z?{...z,tracks:z.tracks.filter(M=>!O.has(M.id))}:null,U="",V=[],q=new Map,G=sU(e),H=lU(e),W=Array.isArray(e.library)?e.library:[],B=oa(e),ie=[];for(let M of W){if(M.kind==="marker"){ie.push(...M.shapes);continue}if(M.kind==="symbol"){ie.push(...M.shapes);for(let K of Object.values(M.variants??{}))ie.push(...K)}}let Y=Q3({documentStyles:e.documentStyles,animationTimeline:z,clipMaskGroups:e.clipMaskGroups,paintServerDefs:e.paintServerDefs});for(let M of W)(M.kind==="linear-gradient"||M.kind==="radial-gradient"||M.kind==="pattern"||M.kind==="symbol"&&M.sourceId)&&Y.add(M.id),M.authoredPlacement&&(Y.add(M.id),M.authoredPlacement.parentDefinitionId&&Y.add(M.authoredPlacement.parentDefinitionId));for(let M of e.paintServerDefs??[])M.authoredPlacement?.parentDefinitionId&&Y.add(M.authoredPlacement.parentDefinitionId);for(let M of e.clipMaskGroups??[])M.authoredPlacement?.parentDefinitionId&&Y.add(M.authoredPlacement.parentDefinitionId);for(let M of e.definitionContainers??[])M.authoredPlacement?.parentDefinitionId&&Y.add(M.authoredPlacement.parentDefinitionId);let X=s5(A,W,Y),Z=X.filter(M=>M.kind!=="symbol"),J=fx(A,W);for(let M of Y)J.ids.add(M);let Q=_h(W),Ee=new Map;if(Q.registerGeneratedDefinition=({id:M,markup:K})=>{let se=Ee.get(M);if(se===void 0)Ee.set(M,K);else if(se!==K)throw new Error(`Generated SVG definition ${M} was registered with conflicting markup.`)},Q.textMeasurementHost=t.textMeasurementHost,Q.retainCssAnimationDeclarations=E,S.some(M=>M.type==="line"&&!!(M.state?.sourceRef||M.state?.targetRef))){let M=ma(e),K=new Map;Q.connectorAnchorPoint=se=>{let Be=`${se.shapeId}\0${se.anchorId}`,tt=K.get(Be);if(tt!==void 0)return tt;let lr=CB(M,se);return K.set(Be,lr),lr}}let we=new Map,Xe=new Map;for(let M of e.documentStyles??[]){if(!M.scopeDefinitionId)continue;let K=we.get(M.scopeDefinitionId)??[];K.push({siblingIndex:M.definitionOrder??Number.MAX_SAFE_INTEGER,markup:Pu([M],{retainAnimationDeclarations:E})}),we.set(M.scopeDefinitionId,K)}Q.definitionChildrenForLibraryDefinition=M=>{let K=we.get(M)??[],se=Xe.get(M)??[];return K.length>0||se.length>0?[...K,...se]:void 0};let jt;{let M=Zn(a),K=Zn([...a,...ie]),se=new Map,Be=new Set,tt=new Set,lr=new Set,_r=new Set((e.animationTimeline?.tracks??[]).flatMap(ee=>{let xe=ee.motionPathRef;return ee.property==="pathMotion"&&xe&&(xe.mode??"trackShape")==="curveTemplate"?[xe.shapeId]:[]})),Hi=new Set((_?.tracks??[]).filter(ee=>ee.sourceSmilPlacement==="document").map(ee=>ee.shapeId)),ss=new Set((_?.tracks??[]).filter(ee=>ee.sourceSmilPlacement==="defs").map(ee=>ee.shapeId)),qi=(ee,xe)=>{ee&&xe.add(ee)};for(let ee of M.ordered){if(ee.type==="text"){qi(ee.state?.shapeInsideRef,Be);let xe=ee.state?.textPathReference;xe?.kind==="shape"&&qi(xe.targetId,tt)}ee.type==="shape-reference"&&qi(ee.state?.targetShapeId,lr)}let Yn=new Map;for(let ee of K.ordered){let xe=ee.state?.metadata?.name,Qt=ee.type==="view"?ee.state?.viewName:void 0,Je=Qt?ga(Qt):xe?ga(xe):"",wr=Be.has(ee.id)||tt.has(ee.id)||lr.has(ee.id)||_r.has(ee.id)||Hi.has(ee.id)||ss.has(ee.id);Je?Yn.set(ee,Je):wr&&!M.duplicateIds.has(ee.id)&&Yn.set(ee,ee.id)}let yn=new Set([...Z.map(ee=>ee.id),...$.filter(ee=>Gp(ee)&&!Yn.has(ee)).map(ee=>ee.id),...(e.clipMaskGroups??[]).map(Up)]);for(let[ee,xe]of Object.entries(jI)){let Qt=ee.replace("line-marker-","");(J.legacyEndpoints.has(Qt)||J.ids.has(ee))&&yn.add(ee),J.ids.has(xe)&&yn.add(xe)}for(let ee of M.ordered)ee.type==="text"&&ee.state.isTextPath&&ee.state.textPathPoints&&!ee.state.textPathReference&&ee.state.textPathInlineFormat!=="path-attr"&&yn.add(`text-path-${ee.id}`);jt=jV(W,A,{reservedIds:new Set([...yn,...Yn.values()]),parentViewport:I,instancePolicy:(()=>{let ee=t.symbolInstanceInitialVariants;if(!ee||ee.size===0)return;let xe=new WeakMap;for(let[Qt,Je]of ee){let wr=M.uniqueById.get(Qt);wr?.type==="symbol-instance"&&xe.set(wr,Je)}return Qt=>{let Je=xe.get(Qt);return Je===void 0?void 0:{initialVariantKey:Je,dedicated:!0}}})()});for(let ee of jt.materializations)yn.add(ee.targetId);for(let ee of jt.diagnostics)Kr({severity:"warning",code:ee.code,shapeId:ee.shapeId,message:ee.message});Q.symbolInstanceTargetElementId=ee=>jt.resolve(ee)?.targetId;let Rl=ma(e),Um=new WeakMap;Q.symbolInstanceTransform=ee=>{let xe=Um.get(ee);if(!xe){let Qt=jt.resolve(ee);xe=AF(Rl,ee,{},Qt?.parentViewport??I),Um.set(ee,xe);for(let Je of xe.diagnostics)!["invalid-symbol-viewport","unresolved-symbol-viewport","unresolved-symbol-pivot"].includes(Je.code)||!nU(Je.code)||Kr({severity:"warning",code:Je.code,shapeId:Je.shapeId,message:Je.message})}return xe};let S$=new Set([...Yn.values(),...yn]),_c=new Set(yn),Gm=new Map,Fl=new Map,Xm=new Map;for(let[ee,xe]of Yn){let Qt=(Gm.get(xe)??0)+1;Gm.set(xe,Qt);let Je=xe;if(Qt>1||_c.has(Je)){let wr=2;do Je=`${xe}-${wr++}`;while(S$.has(Je)||_c.has(Je))}Fl.set(ee,Je),K.duplicateIds.has(ee.id)||Xm.set(ee.id,Je),_c.add(Je)}for(let[ee,xe]of M.uniqueById){let Qt=Fl.get(xe);Qt&&se.set(ee,Qt)}for(let ee of _r){let xe=se.get(ee);xe&&q.set(ee,xe)}if(_&&Hi.size>0&&(U=K3(_,{targetElementId:ee=>se.get(ee),targetShape:ee=>N.get(ee),motionPathTargetElementId:ee=>q.get(ee)}).join("")),_&&ss.size>0){let ee=new Map(_.tracks.flatMap(xe=>xe.definitionTarget?[[xe.shapeId,xe.definitionTarget.nodeId??xe.definitionTarget.definitionId]]:[]));V=Z3(_,{targetElementId:xe=>ee.get(xe)??se.get(xe),targetShape:xe=>N.get(xe),motionPathTargetElementId:xe=>q.get(xe)}).map(xe=>({kind:"animation",markup:xe.markup,...xe.definitionOrder!==void 0?{definitionOrder:xe.definitionOrder}:{},...xe.definitionContainerId?{definitionContainerId:xe.definitionContainerId}:{}}))}if(Fl.size>0&&(Q.elementIdForShape=ee=>Xm.get(ee.id)??Fl.get(ee)),Be.size>0&&(Q.shapeInsideTargetElementId=ee=>se.get(ee)),tt.size>0&&(Q.textPathTargetElementId=ee=>se.get(ee)),lr.size>0){Q.shapeReferenceTargetElementId=Je=>M.duplicateIds.has(Je)?null:se.get(Je);let ee=ma(e),xe=new WeakMap,Qt=new WeakMap;Q.shapeReferenceBounds=Je=>{let wr=xe.get(Je);return wr||(wr=Ph(ee,Je),xe.set(Je,wr)),wr},Q.shapeReferenceTransform=Je=>{let wr=Qt.get(Je);return wr||(wr=MF(ee,Je),Qt.set(Je,wr)),wr}}}let Gi=_?{..._,tracks:_.tracks.filter(M=>M.property==="textPathStartOffset")}:null,dr=_?{..._,tracks:_.tracks.filter(M=>M.textSpanTarget!==void 0)}:null,mn=_?{..._,tracks:_.tracks.filter(M=>M.definitionTarget!==void 0)}:null,Pn=_?{..._,tracks:_.tracks.filter(M=>M.property!=="textPathStartOffset"&&M.textSpanTarget===void 0&&M.definitionTarget===void 0)}:null,yi=Pn?_s(Pn,{placement:"target",targetShape:M=>N.get(M),motionPathTargetElementId:M=>q.get(M),referenceTargetElementId:M=>Q.shapeReferenceTargetElementId?.(M)}):null,De=mn?_s(mn,{placement:"target",referenceTargetElementId:M=>Q.shapeReferenceTargetElementId?.(M)}):null;Q.definitionAnimationElements=(M,K)=>De?.get(Id({definitionId:M,...K?{nodeId:K}:{}}));let st=Gi?_s(Gi,{placement:"target",targetShape:M=>N.get(M)}):null,Qe=dr?u1(dr,{placement:"target",targetShape:M=>N.get(M)}):null,We=KV(e,yi??void 0,st??void 0,Q.definitionAnimationElements),ct=We.defs,Et=We.root,xr=ct.map(M=>M.markup).join(""),cr=Et.map(M=>M.markup).join(""),bt=new Map,Ye=new Set;for(let M of _?.tracks??[]){let K=/^(fill|stroke)GradientStop(\d+)(Color|Opacity|Offset)$/.exec(M.property);if(!K)continue;let se=N.get(M.shapeId);if(!se)continue;let Be=K[1],tt=Number(K[2]),lr=K[3],_r=se.state?.[Be==="fill"?"fillGradient":"strokeGradient"],Hi=se.state?.[Be==="fill"?"fillLibraryId":"strokeLibraryId"]??_r?.id;if(!Hi)continue;let ss=lr==="Color"?"stop-color":lr==="Opacity"?"stop-opacity":"offset",qi=H3(M,ss);if(!qi)continue;let Yn=`${Hi}|${tt}|${ss}|${qi}`;if(Ye.has(Yn))continue;Ye.add(Yn);let yn=bt.get(Hi)??new Map,Rl=yn.get(tt)??[];Rl.push(qi),yn.set(tt,Rl),bt.set(Hi,yn)}Q.gradientStopAnimationElements=(M,K)=>bt.get(M)?.get(K);let xt=Z.filter(M=>M.definitionPlacement!=="document"),$e=Z.filter(M=>M.definitionPlacement==="document"),ar=Iv.flatMap(M=>xt.filter(K=>K.kind===M)),yt=Iv.flatMap(M=>$e.filter(K=>K.kind===M)),mt=ar.map(M=>({kind:"library",definitionId:M.id,markup:qf(M,Q),...M.definitionOrder!==void 0?{definitionOrder:M.definitionOrder}:{},...M.definitionContainerId?{definitionContainerId:M.definitionContainerId}:{},...M.authoredPlacement?{authoredPlacement:M.authoredPlacement}:{}})),Kt=(e.documentStyles??[]).filter(M=>M.authoredPlacement&&!M.scopeDefinitionId).map(M=>({id:M.id,placement:M.authoredPlacement,markup:Pu([M],{retainAnimationDeclarations:E})})),or=new Map,Zt=(M,K)=>K===void 0?`document\0${M}`:`library\0${K}\0${M}`,P=(M,K)=>{let se=B.resolve(M);if(se.kind!=="document"&&se.kind!=="library")return null;if(se.kind==="library"&&M.parentId===se.definitionId){let lr=Xe.get(se.definitionId)??[];return lr.push({siblingIndex:M.siblingIndex,markup:K}),Xe.set(se.definitionId,lr),"library"}let Be=Zt(M.parentId,se.kind==="library"?se.definitionId:void 0),tt=or.get(Be)??[];return tt.push({siblingIndex:M.siblingIndex,markup:K}),or.set(Be,tt),se.kind},D=new Set,L=new Set,te=new Set,le=new Set;for(let M of mt)!M.definitionId||!M.authoredPlacement||M.definitionContainerId||B.resolve(M.authoredPlacement).kind==="library"&&P(M.authoredPlacement,M.markup)==="library"&&D.add(M.definitionId);let Fe=fb(e,"",[],pb(e.clipMaskGroups),_);for(let M of Fe)M.authoredPlacement&&(M.definitionContainerId||B.resolve(M.authoredPlacement).kind==="library"&&P(M.authoredPlacement,M.markup)==="library"&&L.add(M.id));for(let M of ct)M.authoredPlacement&&(M.definitionContainerId||B.resolve(M.authoredPlacement).kind==="library"&&P(M.authoredPlacement,M.markup)==="library"&&te.add(M.definitionId));for(let M of Kt)B.resolve(M.placement).kind==="library"&&P(M.placement,M.markup)==="library"&&le.add(M.id);let be=[...mt,...Fe.map(M=>({kind:"paint-server",definitionId:M.id,markup:M.markup,definitionOrder:M.definitionOrder,definitionContainerId:M.definitionContainerId})),...ct.map(M=>({kind:"clip-mask",definitionId:M.definitionId,markup:M.markup,definitionOrder:M.definitionOrder,definitionContainerId:M.definitionContainerId}))];Q.definitionChildrenForShape=(M,K)=>or.get(Zt(M.id,K));let Ue=yt.map(M=>({kind:"library",definitionId:M.id,markup:qf(M,Q),...M.definitionOrder!==void 0?{definitionOrder:M.definitionOrder}:{},...M.definitionContainerId?{definitionContainerId:M.definitionContainerId}:{},...M.authoredPlacement?{authoredPlacement:M.authoredPlacement}:{}})),ze=jt.materializations.filter(M=>M.targetId===M.definition.id).map(M=>({definition:M.definition,emittedId:M.targetId,shapes:M.shapes})),St=new Set(jt.materializations.filter(M=>M.targetId===M.definition.id).map(M=>M.definition.id)),At=X.filter(M=>M.kind==="symbol"&&!St.has(M.id)).map(M=>({definition:M,emittedId:M.id,shapes:M.shapes})),Ar=[...ze,...At];for(let M of Ar)M.definition.definitionContainerId&&be.push({kind:"library",definitionId:M.definition.id,markup:hd(M.definition,M.emittedId,M.shapes,Q),...M.definition.definitionOrder!==void 0?{definitionOrder:M.definition.definitionOrder}:{},definitionContainerId:M.definition.definitionContainerId});for(let M of e.definitionContainers??[]){if(!M.authoredPlacement)continue;let K=rp(be.filter(tt=>tt.definitionContainerId===M.id)),se=[...M.svgId?[`id="${go(M.svgId)}"`]:[],_I(M.attributes)].filter(Boolean),Be=`<defs${se.length>0?` ${se.join(" ")}`:""}>${K.map(tt=>tt.markup).join("")}</defs>`;if(P(M.authoredPlacement,Be))for(let tt of K)tt.definitionId&&(tt.kind==="library"?D.add(tt.definitionId):tt.kind==="paint-server"?L.add(tt.definitionId):tt.kind==="clip-mask"&&te.add(tt.definitionId))}let qn=M=>{for(let K of M){if(!K.definitionId)continue;let se=W.find(Be=>Be.id===K.definitionId);se?.kind==="marker"&&(K.markup=qf(se,Q))}};qn(mt),qn(Ue);let _e=mt.map(M=>M.markup).join(""),ft=Ue.map(M=>M.markup).join(""),Er=c1(Ar,Ar.map(M=>M.definition.id)),en=Er.filter(M=>Ar.find(K=>K.definition.id===M)?.definition.definitionPlacement==="document"),gn=new Set(en),zr=Er.filter(M=>!gn.has(M)&&!D.has(M)).map(M=>{let K=Ar.find(se=>se.definition.id===M).definition;return{kind:"library",definitionId:K.id,markup:$v(Ar,Q,[M]),...K.definitionOrder!==void 0?{definitionOrder:K.definitionOrder}:{},...K.definitionContainerId?{definitionContainerId:K.definitionContainerId}:{},...K.authoredPlacement?{authoredPlacement:K.authoredPlacement}:{}}}),Dn=en.map(M=>{let K=Ar.find(se=>se.definition.id===M).definition;return{kind:"library",definitionId:K.id,markup:$v(Ar,Q,[M]),...K.definitionOrder!==void 0?{definitionOrder:K.definitionOrder}:{},...K.definitionContainerId?{definitionContainerId:K.definitionContainerId}:{},...K.authoredPlacement?{authoredPlacement:K.authoredPlacement}:{}}}),vi=zr.map(M=>M.markup).join(""),jc=Dn.map(M=>M.markup).join(""),Xi=new Set,is=new Map(Ar.map(M=>[M.definition.id,M])),za=new Set,_l=M=>{if(za.has(M))return;za.add(M);let K=is.get(M);if(K){for(let se of Zn(K.shapes).ordered)Xi.add(se.id);for(let se of K.definition.definitionContentOrder??[])se.kind==="definition"&&_l(se.id)}};for(let M of en)_l(M);let as=_e+vi,ae=f3(J,W),Ne=jt.materializations.filter(M=>M.targetId!==M.definition.id).map(M=>({kind:"symbol-materialization",markup:hd(M.definition,M.targetId,M.shapes,Q)})),Ge=Ne.map(M=>M.markup).join(""),Lt=$.flatMap(M=>{let K=uU([M],se=>q.get(se.id)??se.id);return K?[{kind:"motion-path",markup:K,...M.state.definitionOrder!==void 0?{definitionOrder:M.state.definitionOrder}:{},...typeof M.state.definitionContainerId=="string"?{definitionContainerId:M.state.definitionContainerId}:{}}]:[]}),tn=Lt.map(M=>M.markup).join(""),Wi=r?`<rect width="${f}" height="${p}" fill="${r}"/>`:"",sr={...Q,animationElementsForShape:M=>yi?.get(M.id),textPathAnimationElementsForShape:M=>st?.get(M.id),textSpanAnimationElementsForShape:(M,K)=>Qe?.get(M.id)?.get(K)},Bt=M=>{let K=va(M,sr),se=yi?.get(M.id),Be=se&&se.length>0?se:[];return{shape:M,markup:K,smil:Be}},Wr=A.filter(M=>!We.suppressedShapeIds.has(M.id)).map(M=>V1(M,We)),Jt=Zn(Wr);for(let M of Jt.ordered)Xi.add(M.id);let os=Zn(a);for(let M of e.clipMaskGroups??[])if(M.definitionPlacement==="document")for(let K of M.clipShapeIds){let se=os.uniqueById.get(K);if(se)for(let Be of Zn([se]).ordered)Xi.add(Be.id)}let Ec=[],d$=M=>{if(!R1(M,W))return null;let K=OV(M,{styles:W,renderShape:se=>va(se,sr),serializePresentationWrites:cl,escapeAttributeValue:go,reportUnexpandable:(se,Be)=>{Kr({severity:"warning",code:"unexpandable-appearance-stack",shapeId:se.id,message:`Shape ${se.id} has an appearance stack but authors ${Be.join(", ")} through its style or attributes. A CSS declaration outranks the paint on the element it sits on, so the same declaration cannot say which layer it overrides once the shape paints in several passes. Only the base fill and stroke are rendered.`})}});return K?(Ec.push({kind:"generated",markup:K.geometryMarkup,definitionId:K.geometryId}),K):null},c$=(M,K)=>K.members.map(se=>({shape:M,markup:se,smil:[]})),Fm=()=>{Ec.length=0;let M=[];for(let K=0;K<Wr.length;){let se=Wr[K],Be=We.memberToDirective.get(se.id);if(!Be){let _r=d$(se);if(_r){M.push({kind:"appearance-stack",shape:se,open:_r.open,close:_r.close,members:c$(se,_r)}),K++;continue}M.push({kind:"shape",...Bt(se)}),K++;continue}let tt=[se],lr=K+1;for(;lr<Wr.length&&We.memberToDirective.get(Wr[lr].id)===Be;)tt.push(Wr[lr]),lr++;if(tt.length===1){let _r=Bt(se);M.push({kind:"shape",..._r,markup:ZV(_r.markup,Be,rU(Be.referenceChannel??se.state.presentationChannels?.[Be.attr]))})}else Be.referenceChannel==="stylesheet"?M.push(...tt.map(_r=>({kind:"shape",...Bt(_r)}))):M.push({kind:"clip-mask-run",directive:Be,open:`<g ${Be.attr}="url(#${go(Be.defId)})">`,close:"</g>",members:tt.map(Bt)});K=lr}return M};for(let M of[...mt,...zr])!M.definitionId||!M.authoredPlacement||!Jt.uniqueById.has(M.authoredPlacement.parentId)||P(M.authoredPlacement,M.markup)==="document"&&D.add(M.definitionId);for(let M of Kt)Jt.uniqueById.has(M.placement.parentId)&&P(M.placement,M.markup)==="document"&&le.add(M.id);let zc=Fm(),f$=U1(zc),p$=(e.documentStyles??[]).map(M=>E?M.css:Vp(M.css)),Lm=(e.documentStyles??[]).filter(M=>!M.scopeDefinitionId).map(M=>E?M.css:Vp(M.css)),h$=L1(e.templateVariables??[]),Bm=fb(e,f$,[...p$,h$,xr,cr,as,ft,jc,Ge,ae,tn],pb(e.clipMaskGroups),_);for(let M of Bm)!M.authoredPlacement||!Jt.uniqueById.has(M.authoredPlacement.parentId)||P(M.authoredPlacement,M.markup)==="document"&&L.add(M.id);for(let M of ct)!M.authoredPlacement||!Jt.uniqueById.has(M.authoredPlacement.parentId)||P(M.authoredPlacement,M.markup)==="document"&&te.add(M.definitionId);zc=Fm();let m$=(e.documentExtensions??[]).filter(M=>M.placement==="defs").map(M=>({kind:"extension",markup:cv([M],"defs"),...M.definitionOrder!==void 0?{definitionOrder:M.definitionOrder}:{},...M.definitionContainerId?{definitionContainerId:M.definitionContainerId}:{}})),g$=(e.documentStyles??[]).filter(M=>M.placement==="defs"&&!M.scopeDefinitionId&&!le.has(M.id)).map(M=>({kind:"document-style",markup:Pu([M],{placement:"defs",retainAnimationDeclarations:E}),...M.definitionOrder!==void 0?{definitionOrder:M.definitionOrder}:{},...M.definitionContainerId?{definitionContainerId:M.definitionContainerId}:{}})),y$=Bm.filter(M=>!L.has(M.id)).map(M=>({kind:"paint-server",markup:M.markup,...M.definitionOrder!==void 0?{definitionOrder:M.definitionOrder}:{},...M.definitionContainerId?{definitionContainerId:M.definitionContainerId}:{}})),v$=ct.filter(M=>!te.has(M.definitionId)).map(M=>({kind:"clip-mask",markup:M.markup,...M.definitionOrder!==void 0?{definitionOrder:M.definitionOrder}:{},...M.definitionContainerId?{definitionContainerId:M.definitionContainerId}:{}})),b$=ae?[{kind:"builtin-marker",markup:ae}]:[],x$=[...Ee].map(([M,K])=>({kind:"generated",definitionId:M,markup:K})),w$=rp([...m$,...g$,...mt.filter(M=>!M.definitionId||!D.has(M.definitionId)),...zr.filter(M=>!M.definitionId||!D.has(M.definitionId)),...b$,...Ne,...Lt,...V,...y$,...v$,...x$,...Ec]),I$=rp([...Ue,...Dn,...Et.map(M=>({kind:"clip-mask",markup:M.markup,...M.definitionOrder!==void 0?{definitionOrder:M.definitionOrder}:{}}))]),k$={rootAttributes:ZB(o,{retainCssAnimationDeclarations:E})+(typeof s?.metadata=="object"&&s.metadata!==null&&typeof s.metadata.name=="string"?` id="${go(ga(s.metadata.name))}"`:"")+N_(e.documentMetadata),descriptive:M_(e.documentMetadata,{includeMetadata:i}),extensions:cv(e.documentExtensions,"root"),rootDefinitions:I$.map(M=>M.markup).join(""),rootAnimations:U,scripts:n?UV(e.documentScripts):"",styles:LV(e.templateVariables)+Pu((e.documentStyles??[]).filter(M=>!le.has(M.id)),{placement:"root",retainAnimationDeclarations:E}),trailingComments:(e.documentMetadata?.trailingComments??[]).map(M=>`<!--${M.replace(/--/g,"- -").replace(/-$/,"- ")}-->`).join("")},Vm={frame:{width:f,height:p,widthAttribute:g,heightAttribute:v,viewBox:y,preserveAspectRatio:b,...t.omitFrameAttributes?{omit:t.omitFrameAttributes}:{}},defs:{entries:w$,containers:[...e.definitionContainers??[]].filter(M=>!M.authoredPlacement).sort((M,K)=>M.order-K.order).map(M=>({...M}))},body:zc,motionOnlyShapes:$,animationSurfaceShapeIds:Xi,backgroundRect:Wi,envelope:k$,documentCssTexts:Lm,documentCss:Lm.join(`
70
+ `).trim(),nativeCssAnimationTrackIds:O,symbols:jt};return oU(Vm),Vm}function U1(e){let t="";for(let r of e)if(r.kind==="shape")t+=r.markup;else{t+=r.open;for(let n of r.members)t+=n.markup;t+=r.close}return t}var hb=/url\(\s*['"]?#([^'")\s]+)['"]?\s*\)/g,mb=/<(?:use|mpath|textPath)\b[^>]*?\s(?:xlink:)?href\s*=\s*"#([^"]+)"/g,aU=/\sid\s*=\s*"([^"]+)"/g;function xs(e,t,r){for(let n of t.matchAll(e))r.add(n[1])}function oU(e){let t=new Set,r=[ba(e.defs),U1(e.body),e.envelope.descriptive,e.envelope.rootDefinitions,e.envelope.rootAnimations,e.envelope.styles];for(let s of r)xs(aU,s,t);let n=(s,l)=>{for(let u of s)t.has(u)||Kr({severity:"warning",code:"unresolved-reference",message:l?`Unresolved reference "#${u}" on shape "${l}"; no definition with that id is emitted`:`Unresolved reference "#${u}"; no definition with that id is emitted`,...l?{shapeId:l}:{}})},i=s=>{let l=new Set;xs(hb,s.markup,l),xs(mb,s.markup,l),n(l,s.shape.id)};for(let s of e.body)if(s.kind==="shape")i(s);else for(let l of s.members)i(l);let a=new Set,o=ba(e.defs)+e.envelope.rootDefinitions;xs(hb,o,a),xs(mb,o,a),n(a)}function sU(e){return(Array.isArray(e.library)?e.library:[]).filter(t=>t.kind==="symbol")}function lU(e){let t=(Array.isArray(e.library)?e.library:[]).filter(r=>r.kind==="marker");return t.length>0?t:void 0}function uU(e,t){if(e.length===0)return"";let r=[];for(let n of e){let i=Gp(n);i&&r.push(`<path id="${go(t(n))}" d="${go(i)}"/>`)}return r.join("")}function go(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Gp(e){return Lx(e)}function dU(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function cU(e,t={}){return Qd(e,t).svg}function Qd(e,t={}){let r=new TI;return{svg:PI(r,()=>fU(O5(hl(e,t),e,t),t)),diagnostics:r.diagnostics}}function fU(e,t={}){let{xmlDeclaration:r=!0,indent:n=!0,className:i}=t,a=n?`
71
+ `:"",o=n?" ":"",s=[];for(let g of e.body){if(g.kind==="shape"){s.push(`${o}${g.markup}`);continue}s.push(`${o}${g.open}`);for(let v of g.members)s.push(`${o}${o}${v.markup}`);s.push(`${o}${g.close}`)}let l=s.join(a),u=e.defs,d="",c=[...u.containers].sort((g,v)=>g.order-v.order),f=c.length>0?c.map((g,v)=>({...g,entries:u.entries.filter(y=>y.definitionContainerId===g.id||v===0&&y.definitionContainerId===void 0)})):ba(u).length>0?[{id:"",svgId:void 0,attributes:void 0,order:0,entries:u.entries}]:[];for(let g of f){let v=[...g.svgId?[`id="${dU(g.svgId)}"`]:[],_I(g.attributes)].filter(Boolean);d+=`${a}${o}<defs${v.length>0?` ${v.join(" ")}`:""}>${a}`;let y=null,b="",I=()=>{b.length>0&&(d+=`${o}${o}${b}${a}`),b=""};for(let x of g.entries)x.markup.length!==0&&(y!==null&&x.kind!==y&&I(),y=x.kind,b+=x.markup);I(),d+=`${o}</defs>`}let p=e.backgroundRect.length>0?`${a}${o}${e.backgroundRect}`:"",h="";r&&(h+=`<?xml version="1.0" encoding="UTF-8"?>${a}`);let m=e.frame.omit;return h+='<svg xmlns="http://www.w3.org/2000/svg"',m?.width||(h+=` width="${e.frame.widthAttribute}"`),m?.height||(h+=` height="${e.frame.heightAttribute}"`),m?.viewBox||(h+=` viewBox="${e.frame.viewBox}"`),e.frame.preserveAspectRatio&&(h+=` preserveAspectRatio="${e.frame.preserveAspectRatio}"`),i&&(h+=` class="${i}"`),h+=e.envelope.rootAttributes,h+=">",e.envelope.descriptive.length>0&&(h+=`${a}${o}${e.envelope.descriptive}`),h+=d,e.envelope.extensions.length>0&&(h+=`${a}${o}${e.envelope.extensions}`),e.envelope.rootDefinitions.length>0&&(h+=`${a}${o}${e.envelope.rootDefinitions}`),h+=p,l.length>0&&(h+=`${a}${l}`),e.envelope.rootAnimations.length>0&&(h+=`${a}${o}${e.envelope.rootAnimations}`),e.envelope.scripts.length>0&&(h+=`${a}${o}${e.envelope.scripts}`),e.envelope.styles.length>0&&(h+=`${a}${o}${e.envelope.styles}`),e.envelope.trailingComments.length>0&&(h+=`${a}${o}${e.envelope.trailingComments}`),h+=`${a}</svg>${a}`,h}function pU(e,t){let r=y_(e,t);return cU(e,{width:r.width,height:r.height,xmlDeclaration:t.xmlDeclaration??!1,indent:!0})}function hU(e){return e==="class"?"className":e==="for"?"htmlFor":e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}function Du(e){return e.replace(/\s([a-z][a-z-]*?)=/g,(t,r)=>r.startsWith("data-")||r.startsWith("aria-")?t:` ${hU(r)}=`)}function mU(e,t){let r=t.componentName??"SvgComponent",n=t.indent??" ",i=t.typescript??!1,a=hl(e,{width:t.width,height:t.height}),o=[];for(let c of a.body){if(c.kind==="shape"){o.push(`${n}${n}${n}${Du(c.markup)}`);continue}o.push(`${n}${n}${n}${Du(c.open)}`);for(let f of c.members)o.push(`${n}${n}${n}${n}${Du(f.markup)}`);o.push(`${n}${n}${n}${c.close}`)}let s=ba(a.defs),l=s.length>0,u=a.documentCss,d=[];d.push("import React from 'react';"),d.push(""),i?(d.push(`interface ${r}Props {`),d.push(`${n}className?: string;`),d.push(`${n}style?: React.CSSProperties;`),d.push("}"),d.push(""),d.push(`const ${r}: React.FC<${r}Props> = ({ className, style }) => {`)):d.push(`const ${r} = ({ className, style }) => {`),d.push(`${n}return (`),d.push(`${n}${n}<svg xmlns="http://www.w3.org/2000/svg" width="${a.frame.width}" height="${a.frame.height}" viewBox="${a.frame.viewBox}" className={className} style={style}>`),l&&(d.push(`${n}${n}${n}<defs>`),d.push(`${n}${n}${n}${n}${Du(s)}`),d.push(`${n}${n}${n}</defs>`));for(let c of o)d.push(c);return u.length>0&&d.push(`${n}${n}${n}<style>{${JSON.stringify(u)}}</style>`),d.push(`${n}${n}</svg>`),d.push(`${n});`),d.push("};"),d.push(""),d.push(`export default ${r};`),d.push(""),d.join(`
72
+ `)}function gU(e,t){let r=t.componentName??"SvgComponent",n=t.indent??" ",i=t.typescript??!1,a=hl(e,{width:t.width,height:t.height}),o=[];for(let c of a.body){if(c.kind==="shape"){o.push(`${n}${n}${c.markup}`);continue}o.push(`${n}${n}${c.open}`);for(let f of c.members)o.push(`${n}${n}${n}${f.markup}`);o.push(`${n}${n}${c.close}`)}let s=ba(a.defs),l=s.length>0,u=a.documentCss,d=[];d.push("<template>"),d.push(`${n}<svg xmlns="http://www.w3.org/2000/svg" width="${a.frame.width}" height="${a.frame.height}" viewBox="${a.frame.viewBox}" :class="className" :style="style">`),l&&(d.push(`${n}${n}<defs>`),d.push(`${n}${n}${n}${s}`),d.push(`${n}${n}</defs>`));for(let c of o)d.push(c);return u.length>0&&d.push(`${n}${n}<component :is="'style'">${u}</component>`),d.push(`${n}</svg>`),d.push("</template>"),d.push(""),i?d.push('<script setup lang="ts">'):d.push("<script setup>"),d.push(`// ${r}`),i?(d.push("defineProps<{"),d.push(`${n}className?: string;`),d.push(`${n}style?: Record<string, string>;`),d.push("}>();")):(d.push("defineProps({"),d.push(`${n}className: { type: String, default: '' },`),d.push(`${n}style: { type: Object, default: () => ({}) },`),d.push("});")),d.push("</script>"),d.push(""),d.join(`
73
+ `)}var yU=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function gb(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function ju(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function vU(e){let t=e.shape;if(!yU.has(t.type)||e.smil.length>0)return!0;let r=t.state.metadata;return!!(r?.title||r?.description||t.type==="text"&&t.state.isTextPath||/\s(?:clip-path|mask)="url\(#/u.test(e.markup))}function bU(e,t){let r=t.componentName??"createSvg",n=t.indent??" ",i=t.typescript??!1,a=hl(e,{width:t.width,height:t.height}),o=[];o.push("import * as d3 from 'd3';"),o.push(""),i?o.push(`export function ${r}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):o.push(`export function ${r}(container) {`),o.push(`${n}const svg = d3.select(container)`),o.push(`${n}${n}.append('svg')`),o.push(`${n}${n}.attr('xmlns', 'http://www.w3.org/2000/svg')`),o.push(`${n}${n}.attr('width', ${a.frame.width})`),o.push(`${n}${n}.attr('height', ${a.frame.height})`),o.push(`${n}${n}.attr('viewBox', '${a.frame.viewBox}');`),o.push("");let s=ba(a.defs);s.length>0&&(o.push(`${n}svg.append('defs').html(\`${ju(s)}\`);`),o.push(""));let l=a.documentCss;l.length>0&&(o.push(`${n}svg.append('style').text(\`${ju(l)}\`);`),o.push(""));let u=0;for(let d of a.body){if(u++,d.kind!=="shape"){o.push(`${n}// group`);let m=d.open+d.members.map(g=>g.markup).join("")+d.close;o.push(`${n}svg.append('g').html(\`${ju(m)}\`);`),o.push("");continue}let c=d.shape;if(o.push(`${n}// ${c.type}${c.state.metadata?.name?` \u2014 ${c.state.metadata.name}`:""}`),vU(d)){o.push(`${n}svg.append('g').html(\`${ju(d.markup)}\`);`),o.push("");continue}let f=m_(c),p=Nw(c),h=`shape${u}`;o.push(`${n}const ${h} = svg.append('${f}')`);for(let[m,g]of p)o.push(`${n}${n}.attr('${m}', '${gb(g)}')`);c.type==="text"&&c.state.text&&o.push(`${n}${n}.text('${gb(c.state.text)}')`),o[o.length-1]=o[o.length-1]+";",o.push("")}return o.push(`${n}return svg;`),o.push("}"),o.push(""),o.join(`
74
+ `)}function xU(e,t){let r=e.state.metadata?.name;return r?r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${e.type}-${t+1}`}var wU=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function yb(e,t){let r=e.indexOf(" ");return r===-1?e:e.slice(0,r)+` class="${t}"`+e.slice(r)}function IU(e,t){let r=t.indent??" ",n=hl(e,{width:t.width,height:t.height}),i=0,a=new Map,o=[],s=p=>{a.set(p,xU(p.shape,i)),o.push(p),i++};for(let p of n.body)p.kind==="shape"?s(p):p.members.forEach(s);let l=[];for(let p of o){let h=Nw(p.shape),m=[];for(let[g,v]of h)wU.has(g)&&m.push(`${r}${g}: ${v};`);m.length>0&&l.push(`.${a.get(p)} {
75
+ ${m.join(`
76
+ `)}
77
+ }`)}let u=[];for(let p of n.body){if(p.kind==="shape"){u.push(`${r}${yb(p.markup,a.get(p))}`);continue}u.push(`${r}${p.open}`);for(let h of p.members)u.push(`${r}${r}${yb(h.markup,a.get(h))}`);u.push(`${r}${p.close}`)}let d=ba(n.defs),c=n.documentCss,f=[];f.push("<style>");for(let p of l)f.push(p);c.length>0&&f.push(c),f.push("</style>"),f.push(""),f.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${n.frame.width}" height="${n.frame.height}" viewBox="${n.frame.viewBox}">`),d.length>0&&f.push(`${r}<defs>${d}</defs>`);for(let p of u)f.push(p);return f.push("</svg>"),f.push(""),f.join(`
78
+ `)}function G1(e,t){let r=new TI;return{code:PI(r,()=>kU(e,t)),diagnostics:r.diagnostics}}function kU(e,t){let r=$U(e,t),n={...t};return v1(SU(r,n))}function SU(e,t){switch(t.format){case"svg":return pU(e,t);case"react":return mU(e,t);case"vue":return gU(e,t);case"d3":return bU(e,t);case"css":return IU(e,t);default:throw new Error(`Unsupported code format: ${t.format}`)}}function $U(e,t){if(Array.isArray(e)){let r=l5(e);return{shapes:e,viewboxes:[{id:"default",x:0,y:0,width:t.width??800,height:t.height??600}],...r.length>0?{library:r}:{}}}return e}var g7=Math.pow(6/29,3),y7=1/(3*Math.pow(6/29,2));var v7=Math.PI/180,b7=Math.pow(25,7);var x7=(.03*255)**2;import{createRequire as NU}from"module";var MU=NU("/"),Xo,AU,CU;try{Xo=MU("worker_threads"),AU=Xo.Worker,CU=Xo.isMarkedAsUntransferable}catch{}var jr=Uint8Array,Go=Uint16Array,OU=Int32Array,X1=new jr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),W1=new jr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),TU=new jr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),H1=function(e,t){for(var r=new Go(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new OU(r[30]),n=1;n<30;++n)for(var a=r[n];a<r[n+1];++a)i[a]=a-r[n]<<5|n;return{b:r,r:i}},Xo=H1(X1,2),q1=Xo.b,PU=Xo.r;q1[28]=258,PU[258]=28;var Y1=H1(W1,0),DU=Y1.b,T7=Y1.r,Wh=new Go(32768);for(et=0;et<32768;++et)di=(et&43690)>>1|(et&21845)<<1,di=(di&52428)>>2|(di&13107)<<2,di=(di&61680)>>4|(di&3855)<<4,Wh[et]=((di&65280)>>8|(di&255)<<8)>>1;var di,et,ml=(function(e,t,r){for(var n=e.length,i=0,a=new Go(t);i<n;++i)e[i]&&++a[e[i]-1];var o=new Go(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(r){s=new Go(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],d=t-e[i],c=o[e[i]-1]++<<d,f=c|(1<<d)-1;c<=f;++c)s[Wh[c]>>l]=u}else for(s=new Go(n),i=0;i<n;++i)e[i]&&(s[i]=Wh[o[e[i]-1]++]>>15-e[i]);return s}),yl=new jr(288);for(et=0;et<144;++et)yl[et]=8;var et;for(et=144;et<256;++et)yl[et]=9;var et;for(et=256;et<280;++et)yl[et]=7;var et;for(et=280;et<288;++et)yl[et]=8;var et,K1=new jr(32);for(et=0;et<32;++et)K1[et]=5;var et;var jU=ml(yl,9,1);var EU=ml(K1,5,1),Gh=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Cn=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},Xh=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},zU=function(e){return(e+7)/8|0},ec=function(e,t,r){return(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new jr(e.subarray(t,r))};var _U=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ur=function(e,t,r){var n=new Error(t||_U[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,Ur),!r)throw n;return n},Hh=function(e,t,r,n){var i=e.length,a=n?n.length:0;if(!i||t.f&&!t.l)return r||new jr(0);var o=!r,s=o||t.i!=2,l=t.i;o&&(r=new jr(i*3));var u=function(we){var Xe=r.length;if(we>Xe){var jt=new jr(Math.max(Xe*2,we));jt.set(r),r=jt}},d=t.f||0,c=t.p||0,f=t.b||0,p=t.l,h=t.d,m=t.m,g=t.n,v=i*8;do{if(!p){d=Cn(e,c,1);var y=Cn(e,c+1,3);if(c+=3,y)if(y==1)p=jU,h=EU,m=9,g=5;else if(y==2){var k=Cn(e,c,31)+257,$=Cn(e,c+10,15)+4,A=k+Cn(e,c+5,31)+1;c+=14;for(var S=new jr(A),N=new jr(19),T=0;T<$;++T)N[TU[T]]=Cn(e,c+T*3,7);c+=$*3;for(var z=Gh(N),C=(1<<z)-1,O=ml(N,z,1),T=0;T<A;){var E=O[Cn(e,c,C)];c+=E&15;var b=E>>4;if(b<16)S[T++]=b;else{var _=0,U=0;for(b==16?(U=3+Cn(e,c,3),c+=2,_=S[T-1]):b==17?(U=3+Cn(e,c,7),c+=3):b==18&&(U=11+Cn(e,c,127),c+=7);U--;)S[T++]=_}}var V=S.subarray(0,k),q=S.subarray(k);m=Gh(V),g=Gh(q),p=ml(V,m,1),h=ml(q,g,1)}else Ur(1);else{var b=zU(c)+4,I=e[b-4]|e[b-3]<<8,x=b+I;if(x>i){l&&Ur(0);break}s&&u(f+I),r.set(e.subarray(b,x),f),t.b=f+=I,t.p=c=x*8,t.f=d;continue}if(c>v){l&&Ur(0);break}}s&&u(f+131072);for(var G=(1<<m)-1,H=(1<<g)-1,W=c;;W=c){var _=p[Xh(e,c)&G],B=_>>4;if(c+=_&15,c>v){l&&Ur(0);break}if(_||Ur(2),B<256)r[f++]=B;else if(B==256){W=c,p=null;break}else{var ie=B-254;if(B>264){var T=B-257,Y=X1[T];ie=Cn(e,c,(1<<Y)-1)+q1[T],c+=Y}var X=h[Xh(e,c)&H],Z=X>>4;X||Ur(3),c+=X&15;var q=DU[Z];if(Z>3){var Y=W1[Z];q+=Xh(e,c)&(1<<Y)-1,c+=Y}if(c>v){l&&Ur(0);break}s&&u(f+131072);var J=f+ie;if(f<q){var Q=a-q,Ee=Math.min(q,J);for(Q+f<0&&Ur(3);f<Ee;++f)r[f]=n[Q+f]}for(;f<J;++f)r[f]=r[f-q]}}t.l=p,t.p=W,t.b=f,t.f=d,p&&(d=1,t.m=m,t.d=h,t.n=g)}while(!d);return f!=r.length&&o?ec(r,0,f):r.subarray(0,f)};var RU=new jr(0);var Z1=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Ur(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&Ur(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};var gl=(function(){function e(t,r){typeof t=="function"&&(r=t,t={}),this.ondata=r;var n=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new jr(32768),this.p=new jr(0),n&&this.o.set(n)}return e.prototype.e=function(t){if(this.ondata||Ur(5),this.d&&Ur(4),!this.p.length)this.p=t;else if(t.length){var r=new jr(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length),this.p=r}},e.prototype.c=function(t){this.s.i=+(this.d=t||!1);var r=this.s.b,n=Hh(this.p,this.s,this.o);this.ondata(ec(n,r,this.s.b),this.d),this.o=ec(n,this.s.b-32768),this.s.b=this.o.length,this.p=ec(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(t,r){this.e(t),this.c(r)},e})();function qh(e,t){return Hh(e,{i:2},t&&t.out,t&&t.dictionary)}var J1=(function(){function e(t,r){gl.call(this,t,r),this.v=t&&t.dictionary?2:1}return e.prototype.push=function(t,r){if(gl.prototype.e.call(this,t),this.v){if(this.p.length<6&&!r)return;this.p=this.p.subarray(Z1(this.p,this.v-1)),this.v=0}r&&(this.p.length<4&&Ur(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),gl.prototype.c.call(this,r)},e})();function Yh(e,t){return Hh(e.subarray(Z1(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var FU=typeof TextDecoder<"u"&&new TextDecoder,LU=0;try{FU.decode(RU,{stream:!0}),LU=1}catch{}var BU=ArrayBuffer,Tt=Uint8Array,tc=Uint16Array,VU=Int16Array;var rc=Int32Array,Kh=function(e,t,r){if(Tt.prototype.slice)return Tt.prototype.slice.call(e,t,r);(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new Tt(r-t);return n.set(e.subarray(t,r)),n},bl=function(e,t,r,n){if(Tt.prototype.fill)return Tt.prototype.fill.call(e,t,r,n);for((r==null||r<0)&&(r=0),(n==null||n>e.length)&&(n=e.length);r<n;++r)e[r]=t;return e},UU=function(e,t,r,n){if(Tt.prototype.copyWithin)return Tt.prototype.copyWithin.call(e,t,r,n);for((r==null||r<0)&&(r=0),(n==null||n>e.length)&&(n=e.length);r<n;)e[t++]=e[r++]};var GU=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],Nt=function(e,t,r){var n=new Error(t||GU[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,Nt),!r)throw n;return n},Q1=function(e,t,r){for(var n=0,i=0;n<r;++n)i|=e[t++]<<(n<<3);return i},XU=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},WU=function(e,t){var r=e[0]|e[1]<<8|e[2]<<16;if(r==3126568&&e[3]==253){var n=e[4],i=n>>5&1,a=n>>2&1,o=n&3,s=n>>6;n&8&&Nt(0);var l=6-i,u=o==3?4:o,d=Q1(e,l,u);l+=u;var c=s?1<<s:i,f=Q1(e,l,c)+(s==1&&256),p=f;if(!i){var h=1<<10+(e[5]>>3);p=h+(h>>3)*(e[5]&7)}p>2145386496&&Nt(1);var m=new Tt((t==1?f||p:t?0:p)+12);return m[0]=1,m[4]=4,m[8]=8,{b:l+c,y:0,l:0,d,w:t&&t!=1?t:m.subarray(12),e:p,o:new rc(m.buffer,0,3),u:f,c:a,m:Math.min(131072,p)}}else if((r>>4|e[3]<<20)==25481893)return XU(e,4)+8;Nt(0)},Na=function(e){for(var t=0;1<<t<=e;++t);return t-1},xl=function(e,t,r){var n=(t<<3)+4,i=(e[t]&15)+5;i>r&&Nt(3);for(var a=1<<i,o=a,s=-1,l=-1,u=-1,d=a,c=new BU(512+(a<<2)),f=new VU(c,0,256),p=new tc(c,0,256),h=new tc(c,512,a),m=512+(a<<1),g=new Tt(c,m,a),v=new Tt(c,m+a);s<255&&o>0;){var y=Na(o+1),b=n>>3,I=(1<<y+1)-1,x=(e[b]|e[b+1]<<8|e[b+2]<<16)>>(n&7)&I,k=(1<<y)-1,$=I-o-1,A=x&k;if(A<$?(n+=y,x=A):(n+=y+1,x>k&&(x-=$)),f[++s]=--x,x==-1?(o+=x,g[--d]=s):o-=x,!x)do{var S=n>>3;l=(e[S]|e[S+1]<<8)>>(n&7)&3,n+=2,s+=l}while(l==3)}(s>255||o)&&Nt(0);for(var N=0,T=(a>>1)+(a>>3)+3,z=a-1,C=0;C<=s;++C){var O=f[C];if(O<1){p[C]=-O;continue}for(u=0;u<O;++u){g[N]=C;do N=N+T&z;while(N>=d)}}for(N&&Nt(0),u=0;u<a;++u){var E=p[g[u]]++,_=v[u]=i-Na(E);h[u]=(E<<_)-a}return[n+7>>3,{b:i,s:g,n:v,t:h}]},HU=function(e,t){var r=0,n=-1,i=new Tt(292),a=e[t],o=i.subarray(0,256),s=i.subarray(256,268),l=new tc(i.buffer,268);if(a<128){var u=xl(e,t+1,6),d=u[0],c=u[1];t+=a;var f=d<<3,p=e[t];p||Nt(0);for(var h=0,m=0,g=c.b,v=g,y=(++t<<3)-8+Na(p);y-=g,!(y<f);){var b=y>>3;if(h+=(e[b]|e[b+1]<<8)>>(y&7)&(1<<g)-1,o[++n]=c.s[h],y-=v,y<f)break;b=y>>3,m+=(e[b]|e[b+1]<<8)>>(y&7)&(1<<v)-1,o[++n]=c.s[m],g=c.n[h],h=c.t[h],v=c.n[m],m=c.t[m]}++n>255&&Nt(0)}else{for(n=a-127;r<n;r+=2){var I=e[++t];o[r]=I>>4,o[r+1]=I&15}++t}var x=0;for(r=0;r<n;++r){var k=o[r];k>11&&Nt(0),x+=k&&1<<k-1}var $=Na(x)+1,A=1<<$,S=A-x;for(S&S-1&&Nt(0),o[n++]=Na(S)+1,r=0;r<n;++r){var k=o[r];++s[o[r]=k&&$+1-k]}var N=new Tt(A<<1),T=N.subarray(0,A),z=N.subarray(A);for(l[$]=0,r=$;r>0;--r){var C=l[r];bl(z,r,C,l[r-1]=C+s[r]*(1<<$-r))}for(l[0]!=A&&Nt(0),r=0;r<n;++r){var O=o[r];if(O){var E=l[O];bl(T,r,E,l[O]=E+(1<<$-O))}}return[t,{n:z,b:$,s:T}]},qU=xl(new Tt([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],YU=xl(new Tt([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],KU=xl(new Tt([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],tk=function(e,t){for(var r=e.length,n=new rc(r),i=0;i<r;++i)n[i]=t,t+=1<<e[i];return n},Zh=new Tt(new rc([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),ZU=tk(Zh,0),Jh=new Tt(new rc([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),JU=tk(Jh,3),vl=function(e,t,r){var n=e.length,i=t.length,a=e[n-1],o=(1<<r.b)-1,s=-r.b;a||Nt(0);for(var l=0,u=r.b,d=(n<<3)-8+Na(a)-u,c=-1;d>s&&c<i;){var f=d>>3,p=(e[f]|e[f+1]<<8|e[f+2]<<16)>>(d&7);l=(l<<u|p)&o,t[++c]=r.s[l],d-=u=r.n[l]}(d!=s||c+1!=i)&&Nt(0)},QU=function(e,t,r){var n=6,i=t.length,a=i+3>>2,o=a<<1,s=a+o;vl(e.subarray(n,n+=e[0]|e[1]<<8),t.subarray(0,a),r),vl(e.subarray(n,n+=e[2]|e[3]<<8),t.subarray(a,o),r),vl(e.subarray(n,n+=e[4]|e[5]<<8),t.subarray(o,s),r),vl(e.subarray(n),t.subarray(s),r)},eG=function(e,t,r){var n,i=t.b,a=e[i],o=a>>1&3;t.l=a&1;var s=a>>3|e[i+1]<<5|e[i+2]<<13,l=(i+=3)+s;if(o==1)return i>=e.length?void 0:(t.b=i+1,r?(bl(r,e[i],t.y,t.y+=s),r):bl(new Tt(s),e[i]));if(!(l>e.length)){if(o==0)return t.b=l,r?(r.set(e.subarray(i,l),t.y),t.y+=s,r):Kh(e,i,l);if(o==2){var u=e[i],d=u&3,c=u>>2&3,f=u>>4,p=0,h=0;d<2?c&1?f|=e[++i]<<4|(c&2&&e[++i]<<12):f=u>>3:(h=c,c<2?(f|=(e[++i]&63)<<4,p=e[i]>>6|e[++i]<<2):c==2?(f|=e[++i]<<4|(e[++i]&3)<<12,p=e[i]>>2|e[++i]<<6):(f|=e[++i]<<4|(e[++i]&63)<<12,p=e[i]>>6|e[++i]<<2|e[++i]<<10)),++i;var m=r?r.subarray(t.y,t.y+t.m):new Tt(t.m),g=m.length-f;if(d==0)m.set(e.subarray(i,i+=f),g);else if(d==1)bl(m,e[i++],g);else{var v=t.h;if(d==2){var y=HU(e,i);p+=i-(i=y[0]),t.h=v=y[1]}else v||Nt(0);(h?QU:vl)(e.subarray(i,i+=p),m.subarray(g),v)}var b=e[i++];if(b){b==255?b=(e[i++]|e[i++]<<8)+32512:b>127&&(b=b-128<<8|e[i++]);var I=e[i++];I&3&&Nt(0);for(var x=[YU,KU,qU],k=2;k>-1;--k){var $=I>>(k<<1)+2&3;if($==1){var A=new Tt([0,0,e[i++]]);x[k]={s:A.subarray(2,3),n:A.subarray(0,1),t:new tc(A.buffer,0,1),b:0}}else $==2?(n=xl(e,i,9-(k&1)),i=n[0],x[k]=n[1]):$==3&&(t.t||Nt(0),x[k]=t.t[k])}var S=t.t=x,N=S[0],T=S[1],z=S[2],C=e[l-1];C||Nt(0);var O=(l<<3)-8+Na(C)-z.b,E=O>>3,_=0,U=(e[E]|e[E+1]<<8)>>(O&7)&(1<<z.b)-1;E=(O-=T.b)>>3;var V=(e[E]|e[E+1]<<8)>>(O&7)&(1<<T.b)-1;E=(O-=N.b)>>3;var q=(e[E]|e[E+1]<<8)>>(O&7)&(1<<N.b)-1;for(++b;--b;){var G=z.s[U],H=z.n[U],W=N.s[q],B=N.n[q],ie=T.s[V],Y=T.n[V];E=(O-=ie)>>3;var X=1<<ie,Z=X+((e[E]|e[E+1]<<8|e[E+2]<<16|e[E+3]<<24)>>>(O&7)&X-1);E=(O-=Jh[W])>>3;var J=JU[W]+((e[E]|e[E+1]<<8|e[E+2]<<16)>>(O&7)&(1<<Jh[W])-1);E=(O-=Zh[G])>>3;var Q=ZU[G]+((e[E]|e[E+1]<<8|e[E+2]<<16)>>(O&7)&(1<<Zh[G])-1);if(E=(O-=H)>>3,U=z.t[U]+((e[E]|e[E+1]<<8)>>(O&7)&(1<<H)-1),E=(O-=B)>>3,q=N.t[q]+((e[E]|e[E+1]<<8)>>(O&7)&(1<<B)-1),E=(O-=Y)>>3,V=T.t[V]+((e[E]|e[E+1]<<8)>>(O&7)&(1<<Y)-1),Z>3)t.o[2]=t.o[1],t.o[1]=t.o[0],t.o[0]=Z-=3;else{var Ee=Z-(Q!=0);Ee?(Z=Ee==3?t.o[0]-1:t.o[Ee],Ee>1&&(t.o[2]=t.o[1]),t.o[1]=t.o[0],t.o[0]=Z):Z=t.o[0]}for(var k=0;k<Q;++k)m[_+k]=m[g+k];_+=Q,g+=Q;var we=_-Z;if(we<0){var Xe=-we,jt=t.e+we;Xe>J&&(Xe=J);for(var k=0;k<Xe;++k)m[_+k]=t.w[jt+k];_+=Xe,J-=Xe,we=0}for(var k=0;k<J;++k)m[_+k]=m[we+k];_+=J}if(_!=g)for(;g<m.length;)m[_++]=m[g++];else _=m.length;r?t.y+=_:m=Kh(m,0,_)}else if(r){if(t.y+=f,g)for(var k=0;k<f;++k)m[k]=m[g+k]}else g&&(m=Kh(m,g));return t.b=l,m}Nt(2)}},ek=function(e,t){if(e.length==1)return e[0];for(var r=new Tt(t),n=0,i=0;n<e.length;++n){var a=e[n];r.set(a,i),i+=a.length}return r};var rk=(function(){function e(t){this.ondata=t,this.c=[],this.l=0,this.z=0}return e.prototype.push=function(t,r){if(typeof this.s=="number"){var n=Math.min(t.length,this.s);t=t.subarray(n),this.s-=n}var i=t.length,a=i+this.l;if(!this.s){if(r){if(!a){this.ondata(new Tt(0),!0);return}a<5&&Nt(5)}else if(a<18){this.c.push(t),this.l=a;return}if(this.l&&(this.c.push(t),t=ek(this.c,a),this.c=[],this.l=0),typeof(this.s=WU(t))=="number")return this.push(t,r)}if(typeof this.s!="number"){if(a<(this.z||3)){r&&Nt(5),this.c.push(t),this.l=a;return}if(this.l&&(this.c.push(t),t=ek(this.c,a),this.c=[],this.l=0),!this.z&&a<(this.z=t[this.s.b]&2?4:3+(t[this.s.b]>>3|t[this.s.b+1]<<5|t[this.s.b+2]<<13))){r&&Nt(5),this.c.push(t),this.l=a;return}else this.z=0;for(;;){var o=eG(t,this.s);if(o)this.ondata(o,!1),UU(this.s.w,0,o.length),this.s.w.set(o,this.s.w.length-o.length);else{r&&Nt(5);var s=t.subarray(this.s.b);this.s.b=0,this.c.push(s),this.l+=s.length;return}if(this.s.l){var l=t.subarray(this.s.b);this.s=this.s.c*4,this.push(l,r);return}}}else r&&Nt(5)},e})();function ne(e,t=3){if(!Number.isFinite(e))return"0";let r=Math.pow(10,-t);if(Math.abs(e)<r)return"0";let n=e.toFixed(t);return n.includes(".")&&(n=n.replace(/0+$/,"").replace(/\.$/,"")),n==="-0"?"0":n}function Fi(e,t=3){let r=t+1;return`matrix(${ne(e[0],r)} ${ne(e[1],r)} ${ne(e[2],r)} ${ne(e[3],r)} ${ne(e[4],t)} ${ne(e[5],t)})`}var ci=[1,0,0,1,0,0];function Pt(e,t){return[e[0]*t[0]+e[1]*t[2],e[0]*t[1]+e[1]*t[3],e[2]*t[0]+e[3]*t[2],e[2]*t[1]+e[3]*t[3],e[4]*t[0]+e[5]*t[2]+t[4],e[4]*t[1]+e[5]*t[3]+t[5]]}function Qh(e){let t=e[0]*e[3]-e[1]*e[2];return!Number.isFinite(t)||Math.abs(t)<1e-12?null:[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]}function Gn(e,t,r){return[e[0]*t+e[2]*r+e[4],e[1]*t+e[3]*r+e[5]]}function tG(e){return e[0]*e[3]-e[1]*e[2]}function om(e){return Math.sqrt(Math.abs(tG(e)))}function yk(e,t=1e-6){let[r,n,i,a]=e,o=r*r+n*n+i*i+a*a;if(o===0)return!1;let s=Math.abs(r*i+n*a),l=Math.abs(r*r+n*n-(i*i+a*a));return s<=t*o&&l<=t*o}function rG(e){return Math.atan2(e[1],e[0])*180/Math.PI}function On(e){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function vk(e){return[Math.min(e[0],e[2]),Math.min(e[1],e[3]),Math.max(e[0],e[2]),Math.max(e[1],e[3])]}function bk(e){return!e||!(e[2]>e[0])||!(e[3]>e[1])}function Oa(e,t){return e?t?[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])]:e:t}function nG(e,t){let r=[Math.max(e[0],t[0]),Math.max(e[1],t[1]),Math.min(e[2],t[2]),Math.min(e[3],t[3])];return bk(r)?null:r}function iG(e,t,r=1e-6){for(let n=0;n<4;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0}function nc(e,t){let r=[Gn(t,e[0],e[1]),Gn(t,e[2],e[1]),Gn(t,e[2],e[3]),Gn(t,e[0],e[3])];return{quad:r,bounds:xk(r)}}function xk(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let[a,o]of e)a<t&&(t=a),a>n&&(n=a),o<r&&(r=o),o>i&&(i=o);return[t,r,n,i]}function ic(e,t,r,n=.01){let i=0;for(let a=0;a<4;a++){let[o,s]=e[a],[l,u]=e[(a+1)%4],d=(l-o)*(r-s)-(u-s)*(t-o),c=Math.hypot(l-o,u-s)||1,f=d/c;if(Math.abs(f)<=n)continue;let p=f>0?1:-1;if(i===0)i=p;else if(p!==i)return!1}return!0}function aG(e,t,r=.01){return ic(e,t[0],t[1],r)&&ic(e,t[2],t[1],r)&&ic(e,t[2],t[3],r)&&ic(e,t[0],t[3],r)}function oG(e){if(e.length<2)return null;let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let a=0;a+1<e.length;a+=2){let o=e[a],s=e[a+1];o<t&&(t=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)}return Number.isFinite(t)?[t,r,n,i]:null}function Ke(e){return"text"in e}function me(e,t={},r=[]){return{tag:e,attrs:t,children:r}}function sc(e){return{text:e}}function hn(e){let t=e.trim().replace(/[^\p{L}\p{N}_.\-]+/gu,"_");return t===""&&(t="_"),/^[^\p{L}_]/u.test(t)&&(t=`_${t}`),t}var sG=class{constructor(e){this.prefix=e}prefix;counters=new Map;used=new Set;next(e){let t=(this.counters.get(e)??0)+1;this.counters.set(e,t);let r=`${this.prefix}-${e}-${t}`;return this.used.add(r),r}unique(e){let t=hn(e);if(!this.used.has(t))return this.used.add(t),t;for(let r=2;;r++){let n=`${t}-${r}`;if(!this.used.has(n))return this.used.add(n),n}}reserve(e){this.used.add(e)}},lG=class{constructor(e){this.ids=e}ids;byHash=new Map;byId=new Map;order=[];intern(e,t,r){let n=`${e}:${t}`,i=this.byHash.get(n);if(i)return i.id;let a=this.ids.next(e),o=r(a);o.attrs.id=a;let s={id:a,node:o,references:0};return this.byHash.set(n,s),this.byId.set(a,s),this.order.push(s),a}add(e,t){let r=this.ids.next(e),n=t(r);n.attrs.id=r;let i={id:r,node:n,references:0};return this.byId.set(r,i),this.order.push(i),r}node(e){return this.byId.get(e)?.node??null}has(e){return this.byId.has(e)}build(e){let t=new Set,r=a=>{for(let o of Object.values(a.attrs))uG(o,t);for(let o of a.children)Ke(o)||r(o)};r(e);let n=!0;for(;n;){n=!1;for(let a of this.order){if(!t.has(a.id))continue;let o=t.size;r(a.node),t.size!==o&&(n=!0)}}let i=this.order.filter(a=>t.has(a.id)).map(a=>a.node);return i.length===0?null:me("defs",{},i)}},nk=/url\(#([^)]+)\)|^#([^\s]+)$/g;function uG(e,t){if(!e.includes("#"))return;nk.lastIndex=0;let r;for(;r=nk.exec(e);)t.add(r[1]??r[2])}function Ma(e){let t=2166136261,r=16777619;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);t=Math.imul(t^i,16777619),r=Math.imul(r^i,2166136261)+(r<<5)}return`${(t>>>0).toString(36)}${(r>>>0).toString(36)}`}function dG(e,t,r){let n=null;for(let f of e)n=Oa(n,f.page.box.canvas);let i=n??[0,0,1,1],a=me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:`${ne(i[0],r.precision)} ${ne(i[1],r.precision)} ${ne(i[2]-i[0],r.precision)} ${ne(i[3]-i[1],r.precision)}`,width:ne(i[2]-i[0],r.precision),height:ne(i[3]-i[1],r.precision)});r.title&&a.children.push(me("title",{},[sc(r.title)]));let o=[];if(e.length>1)for(let f of e){if(!f.page.viewId)continue;let p=f.page.box.canvas,h=me("view",{id:f.page.viewId,viewBox:`${ne(p[0],r.precision)} ${ne(p[1],r.precision)} ${ne(p[2]-p[0],r.precision)} ${ne(p[3]-p[1],r.precision)}`});f.page.label&&h.children.push(me("title",{},[sc(f.page.label)])),o.push(h)}let s=[],l=new Map,u=new Map,d=!1;for(let f of e)if(r.mergePages||e.length===1){for(let p of f.group.children){if(!("tag"in p))continue;let h=p.attrs.id&&r.layerOf?r.layerOf(p.attrs.id):null,m=h?u.get(h):void 0;if(h&&m){m.children.push(...p.children.filter(g=>!("tag"in g)||g.tag!=="title")),m.bbox=Oa(m.bbox??null,p.bbox??null)??void 0,l.set(p.attrs.id,m.attrs.id);continue}h&&u.set(h,p),s.push(p)}d||=f.isolate}else f.isolate&&(f.group.attrs.style="isolation:isolate"),o.push(f.group);s.length>0&&(d?o.push(me("g",{style:"isolation:isolate"},s)):o.push(...s));let c=t.build({tag:"svg",attrs:{},children:o});return c&&a.children.push(c),a.children.push(...o),{root:a,mergedLayerIds:l}}var wk=64*1024*1024;function cG(e){let t=sm(e,0,Math.min(e.length,1024)),r=/%PDF-(\d\.\d)/.exec(t),n=sm(e,0,Math.min(e.length,wk));return{pdfVersion:r?r[1]:null,encrypted:/\/Encrypt\b/.test(n),hasIllustratorMarkers:/\/AIPrivateData|\/AIPDFPrivateData|\/AIMetaData|\/Illustrator\b/.test(n),hasCmyk:/\/DeviceCMYK\b/.test(n)||/\/ICCBased\b[\s\S]{0,200}?\/N\s*4\b/.test(n),hasSeparation:/\/Separation\b|\/DeviceN\b/.test(n),hasIcc:/\/ICCBased\b/.test(n)}}function fG(e,t,r){let n=sm(e,0,Math.min(e.length,wk)),i=new RegExp(`(?:^|[^0-9])${t}\\s+${r}\\s+obj\\b`,"g"),a,o=null;for(;a=i.exec(n);)o=a.index+a[0].length;if(o===null)return null;let s=n.indexOf("endobj",o),l=n.slice(o,s<0?Math.min(n.length,o+65536):s);return!/\/Type\s*\/Page\b/.test(l)&&!/\/Contents\b/.test(l)?null:{mediaBox:wl(l,"MediaBox"),cropBox:wl(l,"CropBox"),artBox:wl(l,"ArtBox"),trimBox:wl(l,"TrimBox"),bleedBox:wl(l,"BleedBox")}}function wl(e,t){let r=new RegExp(`\\/${t}\\s*\\[\\s*([-+.\\deE]+)\\s+([-+.\\deE]+)\\s+([-+.\\deE]+)\\s+([-+.\\deE]+)\\s*\\]`).exec(e);if(!r)return null;let n=[Number(r[1]),Number(r[2]),Number(r[3]),Number(r[4])];return n.every(i=>Number.isFinite(i))?vk(n):null}function sm(e,t,r){let n=[];for(let i=t;i<r;i+=32768)n.push(String.fromCharCode.apply(null,Array.from(e.subarray(i,Math.min(r,i+32768)))));return n.join("")}function pG(e,t,r){let n=vk(e.view),i=hG(e.rotate),a=e.userUnit??1,o=r.pageBox==="auto"?"crop":r.pageBox,s=n,l="crop",u=!1;if(o!=="crop"){let p=e.ref,h=p?fG(t,p.num,p.gen):null,m=h?o==="media"?h.mediaBox:o==="art"?h.artBox:o==="trim"?h.trimBox:h.bleedBox:null,g=h?.mediaBox??n,v=m?nG(m,g):null;v&&!bk(v)?(s=v,l=o):u=!0}let d=e.getViewport({scale:1/(a||1),rotation:i,offsetX:0,offsetY:0}),c=On(d.transform);if(s!==n){let p=ik(c,s[0],s[3]),h=ik(c,s[2],s[1]),m=Math.min(p[0],h[0]),g=Math.min(p[1],h[1]);c=Pt(c,[1,0,0,1,-m,-g])}let f=i===90||i===270?[s[3]-s[1],s[2]-s[0]]:[s[2]-s[0],s[3]-s[1]];return{kind:l,pdfBox:s,viewportTransform:c,width:f[0],height:f[1],rotate:i,userUnit:a,fallback:u}}function ik(e,t,r){return[e[0]*t+e[2]*r+e[4],e[1]*t+e[3]*r+e[5]]}function hG(e){let t=(Math.round(e/90)*90%360+360)%360;return t===90?90:t===180?180:t===270?270:0}function mG(e,t,r){let n=[];if(t==="source"){for(let l of e){let u=l.pdfBox[0],d=-l.pdfBox[3];n.push({translation:[1,0,0,1,u,d],canvasBox:[u,d,u+l.width,d+l.height]})}return n}let i=t==="row"?e.length:t==="column"?1:Math.max(1,Math.ceil(Math.sqrt(e.length))),a=0,o=0,s=0;for(let l=0;l<e.length;l++){let u=e[l];l>0&&l%i===0&&(a=0,o+=s+r,s=0),n.push({translation:[1,0,0,1,a,o],canvasBox:[a,o,a+u.width,o+u.height]}),a+=u.width+r,s=Math.max(s,u.height)}return n}var gG={"password-required":"error","encrypted-opened":"info","no-pages":"error","page-skipped":"warning","page-empty":"info","page-box-fallback":"warning","page-rotated":"info","user-unit-ignored":"info","page-clip-dropped":"info","page-placement-mismatch":"warning","layer-imported-hidden":"info","layer-skipped-hidden":"info","layer-fragmented":"info","ocmd-hidden":"info","marked-content-unbalanced":"warning","annotations-skipped":"info","annotation-imported":"info","font-substituted":"warning","type3-outlined":"info","text-outlined-unmappable":"info","text-outlined-render-mode":"info","text-outlined-vertical":"info","text-outlined-mirrored":"info","invisible-text-dropped":"info","text-clip-converted":"info","glyph-outline-missing":"warning","cmyk-converted":"info","spot-color-flattened":"info","icc-profile-ignored":"info","blend-mode-unsupported":"warning","knockout-group-ignored":"warning","soft-mask-converted":"info","soft-mask-transfer-ignored":"warning","transfer-function-ignored":"warning","radial-gradient-rasterized":"warning","radial-gradient-approximated":"warning","shading-unsupported":"warning","shading-fill-unclipped":"info","mesh-rasterized":"info","mesh-triangulated":"warning","pattern-tile-overlap-clipped":"warning","image-downsampled":"info","image-skipped":"warning","image-decode-failed":"warning","image-mask-tinted":"info","image-reused":"info","hairline-stroke-widened":"info","form-reused":"info","artwork-deduped":"info","xobject-depth-limited":"warning","operator-ignored":"info","operator-unknown":"warning"},yG=class{items=[];index=new Map;add(e){let t=e.detail?JSON.stringify(e.detail):"",r=`${e.code}|${e.page??""}|${t}|${e.elementId??""}|${e.message}`,n=this.index.get(r),i=e.count??1;if(n===void 0){this.index.set(r,this.items.length),this.items.push({code:e.code,severity:e.severity??gG[e.code],message:e.message,page:e.page,count:i,detail:e.detail,elementId:e.elementId});return}let a=this.items[n];this.items[n]={...a,count:a.count+i}}has(e){return this.items.some(t=>t.code===e)}list(){return this.items.slice()}},ak=class extends Error{constructor(e,t){super(e),this.diagnostics=t,this.name="PdfTranscodeError"}diagnostics},dm=class extends Error{constructor(){super("PDF transcoding was aborted."),this.name="PdfTranscodeAbortError"}};async function vG(e,t,r){let n=await t.runtime.load();Ho(t.signal);let i=cG(e),a={...t.runtime.documentParams(),data:e.slice(),password:t.password,disableFontFace:!0,fontExtraProperties:!0,useSystemFonts:!1,isOffscreenCanvasSupported:!1,isImageDecoderSupported:!1,stopAtErrors:!1,maxImageSize:t.images.maxPixels,verbosity:0,useWasm:!0};(t.colorManagement!=="icc"||!t.runtime.supportsIcc())&&delete a.iccUrl;let o=n.getDocument(a),s;try{s=await o.promise}catch(p){throw p?.name==="PasswordException"?(r.add({code:"password-required",message:"The PDF is password protected and no valid password was supplied."}),new ak("The PDF is password protected.",r.list())):p}Ho(t.signal),i.encrypted&&r.add({code:"encrypted-opened",message:"The PDF is encrypted and was opened with the user password."}),i.hasCmyk&&r.add({code:"cmyk-converted",message:"CMYK colors were converted to sRGB with the U.S. Web Coated (SWOP) approximation."}),i.hasSeparation&&r.add({code:"spot-color-flattened",message:"Spot (Separation or DeviceN) colors were flattened through their alternate color spaces."}),i.hasIcc&&!(t.colorManagement==="icc"&&t.runtime.supportsIcc())&&r.add({code:"icc-profile-ignored",message:"ICC-based color spaces were converted through their alternate device spaces."});let l=null,u=null,d=null,c=i.pdfVersion;try{let p=(await s.getMetadata()).info;l=ac(p.Producer),u=ac(p.Creator),d=ac(p.Title),c=ac(p.PDFFormatVersion)??c}catch{}let f=i.hasIllustratorMarkers||/Adobe Illustrator/i.test(u??"")||/Adobe Illustrator/i.test(l??"");if(s.numPages===0)throw r.add({code:"no-pages",message:"The PDF has no pages."}),await o.destroy(),new ak("The PDF has no pages.",r.list());return{pdfjs:n,document:s,task:o,bytes:e,info:{pageCount:s.numPages,producer:l,creator:u,title:d,isIllustrator:f,encrypted:i.encrypted,pdfVersion:c},close:()=>o.destroy()}}function ac(e){return typeof e=="string"&&e.length>0?e:null}function Ho(e){if(e?.aborted)throw new dm}async function bG(e,t,r){let n=[];for(let i=0;i<t.fnArray.length;i++){if(t.fnArray[i]!==r)continue;let a=t.argsArray[i];for(let o of a){let s=o.startsWith("g_")?e.commonObjs:e.objs;n.push(new Promise(l=>s.get(o,l)))}}await Promise.all(n)}var Aa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function xG(e){let t=[],r=0,n=e.length,i="";for(;r+2<n;r+=3){let a=e[r]<<16|e[r+1]<<8|e[r+2];i+=Aa[a>>18&63]+Aa[a>>12&63]+Aa[a>>6&63]+Aa[a&63],i.length>=32768&&(t.push(i),i="")}if(r<n){let a=n-r,o=e[r]<<16|(a>1?e[r+1]:0)<<8;i+=Aa[o>>18&63]+Aa[o>>12&63],i+=a>1?Aa[o>>6&63]:"=",i+="="}return t.push(i),t.join("")}var em={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};function wG(e){let t=e.data;if(!t)return null;switch(e.kind){case em.GRAYSCALE_1BPP:return{width:e.width,height:e.height,colorType:0,bitDepth:1,data:t};case em.RGB_24BPP:return{width:e.width,height:e.height,colorType:2,bitDepth:8,data:t};case em.RGBA_32BPP:return{width:e.width,height:e.height,colorType:6,bitDepth:8,data:t};default:return null}}function IG(e){let{width:t,height:r}=e,n=new Uint8ClampedArray(t*r*4);if(e.bitDepth===1){let i=Math.ceil(t/8);for(let a=0;a<r;a++)for(let o=0;o<t;o++){let s=e.data[a*i+(o>>3)]>>7-(o&7)&1?255:0,l=(a*t+o)*4;n[l]=s,n[l+1]=s,n[l+2]=s,n[l+3]=255}return n}if(e.colorType===2){for(let i=0,a=0;i<e.data.length;i+=3,a+=4)n[a]=e.data[i],n[a+1]=e.data[i+1],n[a+2]=e.data[i+2],n[a+3]=255;return n}if(e.colorType===6)return n.set(e.data.subarray(0,n.length)),n;for(let i=0,a=0;i<e.data.length;i++,a+=4)n[a]=e.data[i],n[a+1]=e.data[i],n[a+2]=e.data[i],n[a+3]=255;return n}function kG(e,t,r,n){let i=parseInt(n.slice(1,3),16),a=parseInt(n.slice(3,5),16),o=parseInt(n.slice(5,7),16),s=t+7>>3,l=new Uint8ClampedArray(t*r*4);for(let u=0;u<r;u++)for(let d=0;d<t;d++){let c=e[u*s+(d>>3)]>>7-(d&7)&1,f=(u*t+d)*4;l[f]=i,l[f+1]=a,l[f+2]=o,l[f+3]=c===0?255:0}return{width:t,height:r,colorType:6,bitDepth:8,data:l}}function SG(e,t){let r=Math.min(1,t/Math.max(e.width,e.height));if(r>=1)return e;let n=IG(e),i=Math.max(1,Math.round(e.width*r)),a=Math.max(1,Math.round(e.height*r)),o=new Uint8ClampedArray(i*a*4);for(let s=0;s<a;s++){let l=Math.floor(s*e.height/a),u=Math.max(l+1,Math.floor((s+1)*e.height/a));for(let d=0;d<i;d++){let c=Math.floor(d*e.width/i),f=Math.max(c+1,Math.floor((d+1)*e.width/i)),p=0,h=0,m=0,g=0,v=0;for(let b=l;b<u;b++)for(let I=c;I<f;I++){let x=(b*e.width+I)*4,k=n[x+3];p+=n[x]*k,h+=n[x+1]*k,m+=n[x+2]*k,g+=k,v++}let y=(s*i+d)*4;g>0&&(o[y]=p/g,o[y+1]=h/g,o[y+2]=m/g),o[y+3]=g/v}}return{width:i,height:a,colorType:6,bitDepth:8,data:o}}var ok=Uint8Array.from([137,80,78,71,13,10,26,10]),oc=null;function $G(e,t,r){if(!oc){oc=new Uint32Array(256);for(let i=0;i<256;i++){let a=i;for(let o=0;o<8;o++)a=a&1?3988292384^a>>>1:a>>>1;oc[i]=a>>>0}}let n=4294967295;for(let i=t;i<r;i++)n=oc[(n^e[i])&255]^n>>>8;return(n^4294967295)>>>0}function NG(e){let t=1,r=0;for(let n=0;n<e.length;n++)t=(t+e[n])%65521,r=(r+t)%65521;return(r<<16|t)>>>0}function tm(e,t){let r=new Uint8Array(12+t.length),n=new DataView(r.buffer);n.setUint32(0,t.length);for(let i=0;i<4;i++)r[4+i]=e.charCodeAt(i);return r.set(t,8),n.setUint32(8+t.length,$G(r,4,8+t.length)),r}async function MG(e){let t=globalThis.CompressionStream;if(t){let r=new Blob([e]).stream().pipeThrough(new t("deflate")),n=await new Response(r).arrayBuffer();return new Uint8Array(n)}return AG(e)}function AG(e){let t=Math.max(1,Math.ceil(e.length/65535)),r=new Uint8Array(2+e.length+t*5+4),n=0;r[n++]=120,r[n++]=1;for(let i=0;i<t;i++){let a=i*65535,o=Math.min(e.length,a+65535),s=o-a;r[n++]=i===t-1?1:0,r[n++]=s&255,r[n++]=s>>8&255,r[n++]=~s&255,r[n++]=~s>>8&255,r.set(e.subarray(a,o),n),n+=s}return new DataView(r.buffer).setUint32(n,NG(e)),r}async function cm(e){let{width:t,height:r,colorType:n,bitDepth:i}=e,a=i===1?Math.ceil(t/8):t*(n===6?4:n===2?3:1),o=new Uint8Array((a+1)*r);for(let m=0;m<r;m++)o[m*(a+1)]=0,o.set(e.data.subarray(m*a,(m+1)*a),m*(a+1)+1);let s=await MG(o),l=new Uint8Array(13),u=new DataView(l.buffer);u.setUint32(0,t),u.setUint32(4,r),l[8]=i,l[9]=n,l[10]=0,l[11]=0,l[12]=0;let d=tm("IHDR",l),c=tm("IDAT",s),f=tm("IEND",new Uint8Array(0)),p=new Uint8Array(ok.length+d.length+c.length+f.length),h=0;for(let m of[ok,d,c,f])p.set(m,h),h+=m.length;return p}function CG(e,t,r,n,i,a,o,s=3){let l=n[2]-n[0],u=n[3]-n[1];if(!(l>0)||!(u>0)||r<3)return null;let d=Math.min(i,a/l,a/u),c=Math.max(1,Math.ceil(l*d)),f=Math.max(1,Math.ceil(u*d)),p=new Uint8ClampedArray(c*f*4);if(o&&o.length>=3)for(let m=0;m<p.length;m+=4)p[m]=o[0],p[m+1]=o[1],p[m+2]=o[2],p[m+3]=255;let h=m=>[(e[m*2]-n[0])*d,(n[3]-e[m*2+1])*d];for(let m=0;m+2<r;m+=3)OG(p,c,f,h(m),h(m+1),h(m+2),t,m,s);return{png:{width:c,height:f,colorType:6,bitDepth:8,data:p},bounds:n}}function OG(e,t,r,n,i,a,o,s,l){let u=s*l,d=(s+1)*l,c=(s+2)*l,f=Math.max(0,Math.floor(Math.min(n[1],i[1],a[1]))),p=Math.min(r-1,Math.ceil(Math.max(n[1],i[1],a[1]))),h=Math.max(0,Math.floor(Math.min(n[0],i[0],a[0]))),m=Math.min(t-1,Math.ceil(Math.max(n[0],i[0],a[0]))),g=(i[0]-n[0])*(a[1]-n[1])-(a[0]-n[0])*(i[1]-n[1]);if(Math.abs(g)<1e-12)return;let v=1/g;for(let y=f;y<=p;y++){let b=y+.5;for(let I=h;I<=m;I++){let x=I+.5,k=((i[0]-x)*(a[1]-b)-(a[0]-x)*(i[1]-b))*v,$=((a[0]-x)*(n[1]-b)-(n[0]-x)*(a[1]-b))*v,A=1-k-$;if(k<-.002||$<-.002||A<-.002)continue;k=Math.max(0,k),$=Math.max(0,$),A=Math.max(0,A);let S=k+$+A||1,N=(y*t+I)*4;e[N]=(o[u]*k+o[d]*$+o[c]*A)/S,e[N+1]=(o[u+1]*k+o[d+1]*$+o[c+1]*A)/S,e[N+2]=(o[u+2]*k+o[d+2]*$+o[c+2]*A)/S,e[N+3]=255}}}function TG(e,t,r=3){let n=t*r,i=n+r,a=i+r,o=Math.round((e[n]+e[i]+e[a])/3),s=Math.round((e[n+1]+e[i+1]+e[a+1])/3),l=Math.round((e[n+2]+e[i+2]+e[a+2])/3);return`#${o.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}`}var Ik=["xmlns","id","class","viewBox","width","height","transform","d","x","y","x1","y1","x2","y2","cx","cy","r","fx","fy","fr","rx","ry","points","href","offset","stop-color","stop-opacity","fill","fill-rule","fill-opacity","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","stroke-opacity","clip-path","clip-rule","clipPathUnits","mask","mask-type","maskUnits","maskContentUnits","opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternContentUnits","patternTransform","preserveAspectRatio","image-rendering","shape-rendering","overflow","font-family","font-size","font-weight","font-style","font-stretch","letter-spacing","word-spacing","text-anchor","writing-mode","style"],PG=new Map(Ik.map((e,t)=>[e,t]));function lc(e){let t=PG.get(e);return t!==void 0?t:Ik.length+(e.startsWith("data-")?1:0)}function kk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/[- -]/g,"")}function Sk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/[- -]/g,"")}function qo(e,t=""){let r=[];return $k(e,t,r),r.join("")}var DG=new Set(["text","tspan","title","desc","textPath","style"]);function $k(e,t,r){let n=Object.keys(e.attrs).sort((i,a)=>lc(i)-lc(a)||(i<a?-1:i>a?1:0));r.push(t,"<",e.tag);for(let i of n)r.push(" ",i,'="',kk(e.attrs[i]),'"');if(e.children.length===0){r.push(`/>
79
+ `);return}if(DG.has(e.tag)){r.push(">");for(let i of e.children)Nk(i,r);r.push("</",e.tag,`>
80
+ `);return}r.push(`>
81
+ `);for(let i of e.children)Ke(i)?r.push(t," ",Sk(i.text),`
82
+ `):$k(i,`${t} `,r);r.push(t,"</",e.tag,`>
83
+ `)}function Nk(e,t){if(Ke(e)){t.push(Sk(e.text));return}let r=Object.keys(e.attrs).sort((n,i)=>lc(n)-lc(i)||(n<i?-1:n>i?1:0));t.push("<",e.tag);for(let n of r)t.push(" ",n,'="',kk(e.attrs[n]),'"');if(e.children.length===0){t.push("/>");return}t.push(">");for(let n of e.children)Nk(n,t);t.push("</",e.tag,">")}function $l(e){if(typeof e=="string"){if(/^#[0-9a-fA-F]{6}$/.test(e))return e.toLowerCase();if(/^#[0-9a-fA-F]{3}$/.test(e))return`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`.toLowerCase();let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/.exec(e);return t?rm(Number(t[1]),Number(t[2]),Number(t[3])):"#000000"}if(EG(e)){let t=e instanceof Uint8Array||e instanceof Uint8ClampedArray||!jG(e),r=n=>t?Math.max(0,Math.min(255,Math.round(n))):Math.round(n*255);if(e.length>=3)return rm(r(e[0]),r(e[1]),r(e[2]));if(e.length===1){let n=r(e[0]);return rm(n,n,n)}}return"#000000"}function jG(e){for(let t=0;t<e.length;t++)if(e[t]>1||e[t]<0)return!1;return!0}function EG(e){return Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array}function rm(e,t,r){return`#${nm(e)}${nm(t)}${nm(r)}`}function nm(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function Nl(e,t,r,n){let i=255+e*(-4.387332384609988*e+54.48615194189176*t+18.82290502165302*r+212.25662451639585*n-285.2331026137004)+t*(1.7149763477362134*t-5.6096736904047315*r+-17.873870861415444*n-5.497006427196366)+r*(-2.5217340131683033*r-21.248923337353073*n+17.5119270841813)+n*(-21.86122147463605*n-189.48180835922747),a=255+e*(8.841041422036149*e+60.118027045597366*t+6.871425592049007*r+31.159100130055922*n-79.2970844816548)+t*(-15.310361306967817*t+17.575251261109482*r+131.35250912493976*n-190.9453302588951)+r*(4.444339102852739*r+9.8632861493405*n-24.86741582555878)+n*(-20.737325471181034*n-187.80453709719578),o=255+e*(.8842522430003296*e+8.078677503112928*t+30.89978309703729*r-.23883238689178934*n-14.183576799673286)+t*(10.49593273432072*t+63.02378494754052*r+50.606957656360734*n-112.23884253719248)+r*(.03296041114873217*r+115.60384449646641*n-193.58209356861505)+n*(-22.33816807309886*n-180.12613974708367);return[im(i),im(a),im(o)]}function im(e){return Math.max(0,Math.min(255,Math.round(e)))}function zG(e){if(typeof e!="string")return{css:null,supported:!0};switch(e){case"source-over":case"normal":case"compatible":return{css:null,supported:!0};case"multiply":case"screen":case"overlay":case"darken":case"lighten":case"color-dodge":case"color-burn":case"hard-light":case"soft-light":case"difference":case"exclusion":case"hue":case"saturation":case"color":case"luminosity":return{css:e,supported:!0};default:return{css:null,supported:!1}}}function Il(e,t){let r=[];for(let n of e)switch(n.op){case"M":case"L":{let[i,a]=Gn(t,n.x,n.y);r.push({op:n.op,x:i,y:a});break}case"C":{let[i,a]=Gn(t,n.x1,n.y1),[o,s]=Gn(t,n.x2,n.y2),[l,u]=Gn(t,n.x,n.y);r.push({op:"C",x1:i,y1:a,x2:o,y2:s,x:l,y:u});break}case"Q":{let[i,a]=Gn(t,n.x1,n.y1),[o,s]=Gn(t,n.x,n.y);r.push({op:"Q",x1:i,y1:a,x:o,y:s});break}case"Z":r.push(n);break}return r}function Wo(e){let t=1/0,r=1/0,n=-1/0,i=-1/0,a=(o,s)=>{o<t&&(t=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)};for(let o of e)switch(o.op){case"M":case"L":a(o.x,o.y);break;case"C":a(o.x1,o.y1),a(o.x2,o.y2),a(o.x,o.y);break;case"Q":a(o.x1,o.y1),a(o.x,o.y);break;default:break}return Number.isFinite(t)?[t,r,n,i]:null}function am(e){let t=0,r=0;for(let n of e)n.op==="M"&&t++,n.op!=="Z"&&r++;return{subpaths:t,anchors:r}}function _G(e){let t=[],r=0;for(let d of e)if(d.op==="M"){if(r++,r>1)return null;t.push([d.x,d.y])}else if(d.op==="L")t.push([d.x,d.y]);else{if(d.op==="Z")continue;return null}if(t.length===5){let[d,c]=[t[0],t[4]];if(Math.abs(d[0]-c[0])>1e-6||Math.abs(d[1]-c[1])>1e-6)return null;t.pop()}if(t.length!==4)return null;let[n,i,a,o]=t,s=[i[0]-n[0],i[1]-n[1]],l=[a[0]-o[0],a[1]-o[1]],u=1e-4*(Math.hypot(s[0],s[1])+Math.hypot(l[0],l[1])+1);return Math.abs(s[0]-l[0])>u||Math.abs(s[1]-l[1])>u?null:[n,i,a,o]}function Ca(e,t=3){let r=[];for(let n of e)switch(n.op){case"M":case"L":r.push(`${n.op}${ne(n.x,t)} ${ne(n.y,t)}`);break;case"C":r.push(`C${ne(n.x1,t)} ${ne(n.y1,t)} ${ne(n.x2,t)} ${ne(n.y2,t)} ${ne(n.x,t)} ${ne(n.y,t)}`);break;case"Q":r.push(`Q${ne(n.x1,t)} ${ne(n.y1,t)} ${ne(n.x,t)} ${ne(n.y,t)}`);break;case"Z":r.push("Z");break}return r.join("")}function kl(e){return[{op:"M",x:e[0],y:e[1]},{op:"L",x:e[2],y:e[1]},{op:"L",x:e[2],y:e[3]},{op:"L",x:e[0],y:e[3]},{op:"Z"}]}var RG=[[/^Arial(MT)?$/i,"Arial","sans-serif"],[/^ArialNarrow/i,"Arial Narrow","sans-serif"],[/^ArialBlack/i,"Arial Black","sans-serif"],[/^Helvetica(Neue)?(LT|LTStd)?$/i,"Helvetica","sans-serif"],[/^HelveticaNeue/i,"Helvetica Neue","sans-serif"],[/^Times(NewRoman)?(PS)?(MT)?$/i,"Times New Roman","serif"],[/^Courier(New)?(PS)?(MT)?$/i,"Courier New","monospace"],[/^Symbol$/i,"Symbol","serif"],[/^ZapfDingbats$/i,"Zapf Dingbats","serif"],[/^MyriadPro$/i,"Myriad Pro","sans-serif"],[/^Myriad$/i,"Myriad","sans-serif"],[/^MinionPro$/i,"Minion Pro","serif"],[/^Minion$/i,"Minion","serif"],[/^SourceSansPro$/i,"Source Sans Pro","sans-serif"],[/^SourceSans3$/i,"Source Sans 3","sans-serif"],[/^SourceSerifPro$/i,"Source Serif Pro","serif"],[/^SourceCodePro$/i,"Source Code Pro","monospace"],[/^OpenSans$/i,"Open Sans","sans-serif"],[/^TrebuchetMS$/i,"Trebuchet MS","sans-serif"],[/^Calibri$/i,"Calibri","sans-serif"],[/^Cambria$/i,"Cambria","serif"],[/^Georgia$/i,"Georgia","serif"],[/^Verdana$/i,"Verdana","sans-serif"],[/^Tahoma$/i,"Tahoma","sans-serif"],[/^Garamond/i,"Garamond","serif"],[/^Futura/i,"Futura","sans-serif"],[/^Gotham/i,"Gotham","sans-serif"],[/^Montserrat$/i,"Montserrat","sans-serif"],[/^Roboto$/i,"Roboto","sans-serif"],[/^RobotoMono$/i,"Roboto Mono","monospace"],[/^RobotoSlab$/i,"Roboto Slab","serif"],[/^Lato$/i,"Lato","sans-serif"],[/^Avenir(Next)?$/i,"Avenir","sans-serif"],[/^GillSans/i,"Gill Sans","sans-serif"],[/^FranklinGothic/i,"Franklin Gothic","sans-serif"],[/^CenturyGothic/i,"Century Gothic","sans-serif"],[/^Palatino/i,"Palatino","serif"],[/^BookAntiqua/i,"Book Antiqua","serif"],[/^SegoeUI/i,"Segoe UI","sans-serif"],[/^NotoSans$/i,"Noto Sans","sans-serif"],[/^NotoSerif$/i,"Noto Serif","serif"],[/^NotoSansMono$/i,"Noto Sans Mono","monospace"],[/^DejaVuSans$/i,"DejaVu Sans","sans-serif"],[/^DejaVuSerif$/i,"DejaVu Serif","serif"],[/^DejaVuSansMono$/i,"DejaVu Sans Mono","monospace"],[/^LiberationSans$/i,"Liberation Sans","sans-serif"],[/^LiberationSerif$/i,"Liberation Serif","serif"],[/^LiberationMono$/i,"Liberation Mono","monospace"],[/^Inter$/i,"Inter","sans-serif"],[/^Poppins$/i,"Poppins","sans-serif"],[/^Raleway$/i,"Raleway","sans-serif"],[/^Oswald$/i,"Oswald","sans-serif"],[/^Merriweather$/i,"Merriweather","serif"],[/^PlayfairDisplay$/i,"Playfair Display","serif"],[/^Consolas$/i,"Consolas","monospace"],[/^Menlo$/i,"Menlo","monospace"],[/^Monaco$/i,"Monaco","monospace"],[/^LucidaConsole$/i,"Lucida Console","monospace"],[/^ComicSansMS$/i,"Comic Sans MS","cursive"],[/^Impact$/i,"Impact","sans-serif"],[/^Optima/i,"Optima","sans-serif"],[/^Baskerville/i,"Baskerville","serif"],[/^Didot/i,"Didot","serif"],[/^Bodoni/i,"Bodoni","serif"],[/^Rockwell/i,"Rockwell","serif"],[/^TrajanPro$/i,"Trajan Pro","serif"],[/^AdobeGaramondPro$/i,"Adobe Garamond Pro","serif"]],Mk=[[/^(Thin|Hairline)$/i,100],[/^(ExtraLight|UltraLight|ExtLight)$/i,200],[/^Light$/i,300],[/^(Regular|Book|Roman|Normal|Plain|Text)$/i,400],[/^Medium$/i,500],[/^(SemiBold|DemiBold|Semibold|Demibold|Demi)$/i,600],[/^Bold$/i,700],[/^(ExtraBold|UltraBold|Extrabold|Ultrabold|Heavy)$/i,800],[/^(Black|Ultra|ExtraBlack|UltraBlack|Fat)$/i,900]],FG=/^(Italic|It|Oblique|Obl|Slanted|Ital)$/i,Ak=[[/^(UltraCondensed|ExtraCondensed)$/i,"extra-condensed"],[/^(Condensed|Cond|Cn|Narrow|Compressed|Compact)$/i,"condensed"],[/^(SemiCondensed|SemiCond)$/i,"semi-condensed"],[/^(Extended|Expanded|Wide|Ext)$/i,"expanded"],[/^(SemiExtended|SemiExpanded)$/i,"semi-expanded"]],LG=/^(MT|PS|PSMT|LT|LTStd|Com|Std|Pro|W1G|OTF)$/i;function Ck(e){return e.replace(/^[A-Z]{6}\+/,"")}function BG(e){return e.replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/[_.]+/g," ").trim()}var VG=new RegExp(`^(?:${[...Mk.map(([e])=>e),...Ak.map(([e])=>e)].map(e=>e.source.replace(/^\^|\$$/g,"")).join("|")})$`,"i");function sk(e){let t=[];for(let r of e.split(/[-_,\s]+/)){let n=r.replace(/([a-z])([A-Z])/g,"$1 $2").split(" ").filter(Boolean);for(let i=0;i<n.length;i++){let a=i+1<n.length?`${n[i]}${n[i+1]}`:null;a&&VG.test(a)?(t.push(a),i++):t.push(n[i])}}return t}function uc(e){let t=Ck(e.name),r=t.search(/[-,]/),n=r>=0?t.slice(0,r):t,i=r>=0?t.slice(r+1):"",a=sk(i),o=/^(.*?)(Bold|Italic|Oblique|Light|Black|Medium|Regular|Heavy|SemiBold|Condensed|Narrow)((?:Bold|Italic|Oblique|Light|Black|Medium|Regular|Heavy|SemiBold|Condensed|Narrow)*)$/.exec(n);o&&o[1].length>2&&(n=o[1],a.push(...sk(`${o[2]}${o[3]??""}`.replace(/([a-z])([A-Z])/g,"$1 $2"))));let s=null,l=null;for(let[f,p,h]of RG)if(f.test(n)){s=p,l=h;break}s||(s=BG(n).split(" ").filter(f=>!LG.test(f)).join(" ").trim()||n||"sans-serif");let u=null,d="normal",c=null;for(let f of a){for(let[p,h]of Mk)p.test(f)&&(u=h);FG.test(f)&&(d="italic");for(let[p,h]of Ak)p.test(f)&&(c=h)}return u===null&&(u=e.black?900:e.bold?700:400),e.italic&&(d="italic"),l||(e.monospace||/Mono|Courier|Code/i.test(n)?l="monospace":e.serif?l="serif":l="sans-serif"),{family:s,generic:l,weight:u,style:d,stretch:c}}function dc(e){let t=/[\s,'"]/.test(e.family)?`'${e.family.replace(/'/g,"")}'`:e.family;return e.family===e.generic?e.generic:`${t}, ${e.generic}`}var UG=new Set(["Helvetica","Arial","Arial Narrow","Arial Black","Arial Unicode MS","Courier","Courier New","Times","Times New Roman","Symbol","Zapf Dingbats","Liberation Sans","Liberation Serif","Calibri","Century Gothic","Comic Sans MS","Gill Sans","Gill Sans MT","Impact","Lucida Console","Lucida Sans","Trebuchet MS","Wingdings","MS Gothic","MS Mincho","MS PGothic","MS PMincho","Itc Symbol","Book Antiqua","Century Schoolbook","Hoefler Text"]);function GG(e){return UG.has(e)}function XG(e){return/^[A-Z]{6}\+/.test(e)}var WG=1e-4;function Ok(e,t){let r=Math.abs(e[0])+Math.abs(e[1])+Math.abs(e[2])+Math.abs(e[3])+1e-9;for(let n=0;n<4;n++)if(Math.abs(e[n]-t[n])>WG*r)return!1;return!0}function HG(e,t){return e.frames.length===t.frames.length&&e.frames.every((r,n)=>r.key===t.frames[n].key)}function Tk(e,t){return e.fontKey===t.fontKey&&e.size===t.size&&e.renderMode===t.renderMode&&e.fill===t.fill&&e.stroke===t.stroke&&e.strokeWidth===t.strokeWidth&&e.fillOpacity===t.fillOpacity&&e.strokeOpacity===t.strokeOpacity&&e.blend===t.blend&&e.textObject===t.textObject&&e.rise===t.rise&&HG(e,t)}function Li(e){let t=e.basis,r=e.penY+e.rise;return[t[0]*e.pen+t[2]*r+t[4],t[1]*e.pen+t[3]*r+t[5]]}function qG(e){return Pt([e.hs,0,0,-1,0,0],e.basis)}function Ta(e,t){let r=e[0]*e[3]-e[1]*e[2];if(Math.abs(r)<1e-12)return[0,0];let n=t[0]-e[4],i=t[1]-e[5];return[(n*e[3]-i*e[2])/r,(i*e[0]-n*e[1])/r]}function YG(e,t=()=>.25){let r=[],n=null;for(let i of e){let a=qG(i);if(n&&Tk(n.first,i)&&Ok(n.m,a)&&ZG(n,i)&&!KG(n,i,t(i))){n.glyphs.push(i);continue}n={glyphs:[i],m:a,first:i},r.push(n)}return r}function KG(e,t,r){let n=e.glyphs[e.glyphs.length-1],i=Ta(e.m,Li(n))[0]+n.advance/n.hs,a=Ta(e.m,Li(t))[0]-i,o=Math.max(r*t.size,.25*t.size);return a>2*o||a<-.5*t.size}function ZG(e,t){let r=e.glyphs[e.glyphs.length-1],n=Ta(e.m,Li(t)),i=Ta(e.m,Li(r));return Math.abs(n[1]-i[1])<=.1*Math.max(t.size,1e-6)}function JG(e,t){let r=[],n=[],i=()=>{n.length>0&&r.push(e6(n,t)),n=[]};for(let a of e)n.length>0&&(!Ok(n[0].m,a.m)||!Tk(n[0].first,a.first))&&i(),n.push(a);return i(),r}function QG(e,t){let r=[e[0],e[1],e[2],e[3],0,0],n=r[0]*r[3]-r[1]*r[2];if(yk(r)&&n>0){let i=om(r),a=rG(r);return Math.abs(a)<=.01?{sigma:i,transform:null,offset:[e[4],e[5]]}:{sigma:i,transform:`translate(${ne(e[4],t)} ${ne(e[5],t)}) rotate(${ne(a,t+1)})`,offset:[0,0]}}return{sigma:1,transform:Fi(e,t),offset:[0,0]}}function e6(e,t){let r=e[0].first,n=e[0].m,i=r.size,a=QG(n,t.precision),o={};o["font-family"]=dc(r.mapping),r.mapping.weight!==400&&(o["font-weight"]=String(r.mapping.weight)),r.mapping.style==="italic"&&(o["font-style"]="italic"),r.mapping.stretch&&(o["font-stretch"]=r.mapping.stretch),o["font-size"]=ne(i*a.sigma,t.precision),t6(o,r,t.precision),a.transform&&(o.transform=a.transform),r.blend&&(o.style=`mix-blend-mode:${r.blend}`);let s=me("text",o),l=[],u=null,d=0,c=null;for(let p of e){let h=Li(p.first);c??=h;let m=Ta(n,h),g=m[0]*a.sigma+a.offset[0],v=m[1]*a.sigma+a.offset[1],y=r6(p,t,a.sigma),b=me("tspan",{});b.attrs.x=t.positioning==="exact"?y.xs.map(I=>ne(g+I,t.precision)).join(" "):ne(g,t.precision),b.attrs.y=ne(v,t.precision),t.positioning==="natural"&&(y.letterSpacing!==0&&(b.attrs["letter-spacing"]=ne(y.letterSpacing,t.precision)),y.wordSpacing!==0&&(b.attrs["word-spacing"]=ne(y.wordSpacing,t.precision))),b.children.push(sc(y.text)),s.children.push(b),l.push(y.text),d+=p.glyphs.length,u=i6(u,n6(p))}let f=c??[n[4],n[5]];return{node:s,bbox:u??[f[0],f[1]-i,f[0]+i,f[1]],unicode:l.join(`
84
+ `),frames:r.frames,glyphCount:d,baseline:{x:f[0],y:f[1]},fontName:r.fontName,size:i,blend:r.blend}}function t6(e,t,r){let n=t.renderMode&3,i=n===0||n===2?t.fill:null,a=n===1||n===2?t.stroke:null;e.fill=i??"none",i&&t.fillOpacity<1&&(e["fill-opacity"]=ne(t.fillOpacity,3)),a&&(e.stroke=a,e["stroke-width"]=ne(t.strokeWidth,r),t.strokeOpacity<1&&(e["stroke-opacity"]=ne(t.strokeOpacity,3)))}function r6(e,t,r){let n="",i=[],a=Ta(e.m,Li(e.first)),o=e.first.charSpacing,s=e.first.wordSpacing,l=e.glyphs.every(c=>c.charSpacing===o)?o*r:0,u=e.glyphs.every(c=>c.wordSpacing===s)?s*r:0,d=0;for(let c=0;c<e.glyphs.length;c++){let f=e.glyphs[c],p=(Ta(e.m,Li(f))[0]-a[0])*r;if(c>0){let h=p-d,m=f.size*r,g=Math.max(t.spaceAdvance(f)*f.size,.25*f.size)*r,v=e.glyphs[c-1];h>.08*m&&h<=2*g&&!v.isSpace&&!f.isSpace&&f.unicode!==" "&&v.unicode!==" "&&(n+=" ",i.push(d))}i.push(p),n+=f.unicode||"\uFFFD",d=p+f.advance/f.hs*r}return{text:n,xs:i,letterSpacing:l,wordSpacing:u}}function n6(e){let t=[],r=e.m;for(let n of e.glyphs){let i=Li(n),a=n.advance/n.hs;t.push(i[0],i[1]),t.push(r[0]*a+i[0],r[1]*a+i[1]),t.push(r[2]*-n.size*.8+i[0],r[3]*-n.size*.8+i[1]),t.push(r[0]*a+r[2]*-n.size*.8+i[0],r[1]*a+r[3]*-n.size*.8+i[1])}return oG(t)}function i6(e,t){return e?t?[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])]:e:t}var Sl={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},ve={status:"handled"},lk=e=>({status:"ignored",reason:e}),Ze=e=>({status:"unreachable",reason:e}),Nr="folded into constructPath by the evaluator",uk="consumed by the evaluator before the operator list is built",j7={dependency:ve,setLineWidth:ve,setLineCap:ve,setLineJoin:ve,setMiterLimit:ve,setDash:ve,setRenderingIntent:lk("rendering intents have no SVG equivalent"),setFlatness:lk("flatness tolerance has no SVG equivalent"),setGState:ve,save:ve,restore:ve,transform:ve,moveTo:Ze(Nr),lineTo:Ze(Nr),curveTo:Ze(Nr),curveTo2:Ze(Nr),curveTo3:Ze(Nr),closePath:Ze(Nr),rectangle:Ze(Nr),stroke:Ze(Nr),closeStroke:Ze(Nr),fill:Ze(Nr),eoFill:Ze(Nr),fillStroke:Ze(Nr),eoFillStroke:Ze(Nr),closeFillStroke:Ze(Nr),closeEOFillStroke:Ze(Nr),endPath:Ze(Nr),clip:ve,eoClip:ve,beginText:ve,endText:ve,setCharSpacing:ve,setWordSpacing:ve,setHScale:ve,setLeading:ve,setFont:ve,setTextRenderingMode:ve,setTextRise:ve,moveText:ve,setLeadingMoveText:ve,setTextMatrix:ve,nextLine:ve,showText:ve,showSpacedText:Ze("converted to showText by the evaluator"),nextLineShowText:ve,nextLineSetSpacingShowText:ve,setCharWidth:ve,setCharWidthAndBounds:ve,setStrokeColorSpace:Ze(uk),setFillColorSpace:Ze(uk),setStrokeColor:Ze("converted to setStrokeRGBColor by the evaluator"),setStrokeColorN:ve,setFillColor:Ze("converted to setFillRGBColor by the evaluator"),setFillColorN:ve,setStrokeGray:Ze("converted to setStrokeRGBColor by the evaluator"),setFillGray:Ze("converted to setFillRGBColor by the evaluator"),setStrokeRGBColor:ve,setFillRGBColor:ve,setStrokeCMYKColor:Ze("converted to setStrokeRGBColor by the evaluator"),setFillCMYKColor:Ze("converted to setFillRGBColor by the evaluator"),shadingFill:ve,beginInlineImage:Ze("parser-level operator"),beginImageData:Ze("parser-level operator"),endInlineImage:Ze("parser-level operator"),paintXObject:Ze("resolved by the evaluator"),markPoint:Ze("skipped by the evaluator"),markPointProps:Ze("skipped by the evaluator"),beginMarkedContent:ve,beginMarkedContentProps:ve,endMarkedContent:ve,beginCompat:Ze("skipped by the evaluator"),endCompat:Ze("skipped by the evaluator"),paintFormXObjectBegin:ve,paintFormXObjectEnd:ve,beginGroup:ve,endGroup:ve,beginAnnotation:ve,endAnnotation:ve,paintImageMaskXObject:ve,paintImageMaskXObjectGroup:ve,paintImageXObject:ve,paintInlineImageXObject:ve,paintInlineImageXObjectGroup:ve,paintImageXObjectRepeat:ve,paintImageMaskXObjectRepeat:ve,paintSolidColorImageMask:ve,constructPath:ve,setStrokeTransparent:ve,setFillTransparent:ve,rawFillPath:ve};function lm(e){let t=[];if(!e)return t;let r=e.length,n=0;for(;n<r;)switch(e[n++]){case Sl.moveTo:t.push({op:"M",x:e[n],y:e[n+1]}),n+=2;break;case Sl.lineTo:t.push({op:"L",x:e[n],y:e[n+1]}),n+=2;break;case Sl.curveTo:t.push({op:"C",x1:e[n],y1:e[n+1],x2:e[n+2],y2:e[n+3],x:e[n+4],y:e[n+5]}),n+=6;break;case Sl.quadraticCurveTo:t.push({op:"Q",x1:e[n],y1:e[n+1],x:e[n+2],y:e[n+3]}),n+=4;break;case Sl.closePath:t.length>0&&t[t.length-1].op!=="Z"&&t.push({op:"Z"});break;default:return t}return t}function Pk(){return{font:null,size:0,charSpacing:0,wordSpacing:0,hscale:1,leading:0,rise:0,renderMode:0,tm:ci,tlm:ci,penX:0,penY:0,lineX:0,lineY:0}}function a6(e){return{ctm:e,baseCtm:e,clip:[],fill:{kind:"color",hex:"#000000"},stroke:{kind:"color",hex:"#000000"},fillAlpha:1,strokeAlpha:1,blend:null,softMask:null,lineWidth:1,lineCap:0,lineJoin:0,miterLimit:10,dash:null,transferActive:!1,text:Pk(),pendingClip:null}}function dk(e){return{...e,text:{...e.text}}}var o6=2048,ck=6,fk=32,s6=4,l6=class um{constructor(t,r,n,i){this.doc=t,this.pageCtx=r,this.emitter=n,this.state=a6(i)}doc;pageCtx;emitter;state;stack=[];frames=[];blendModeUsed=!1;markedStack=[];groupStack=[];captureStack=[];suppress=0;textRecords=[];textObject=0;textClipPaths=[];textClipActive=!1;lastMask=null;emittedOnPage=!1;markedIndex=0;frameSerial=0;formDepth=0;patternDepth=0;opCount=0;pageDiagnosed=new Set;get objs(){return this.pageCtx.page.objs}get commonObjs(){return this.pageCtx.page.commonObjs}async run(t){let{fnArray:r,argsArray:n}=t;for(let i=0;i<r.length;i++)if(this.execute(r[i],n[i]),++this.opCount%o6===0){if(this.doc.options.signal?.aborted)throw new dm;await u6()}this.flushText(),this.emitter.closeAll(),this.doc.stats.operators+=r.length}runNested(t){let{fnArray:r,argsArray:n}=t;for(let i=0;i<r.length;i++)this.execute(r[i],n[i]);this.flushText(),this.doc.stats.operators+=r.length}diagnoseOnce(t,r,n){this.pageDiagnosed.has(t)||(this.pageDiagnosed.add(t),this.doc.sink.add({code:t,message:r,page:this.pageCtx.pageNumber,detail:n}))}diagnose(t,r,n){this.doc.sink.add({code:t,message:r,page:this.pageCtx.pageNumber,detail:n})}execute(t,r){let n=this.doc.opName[t]??"",i=r??[];switch(n){case"dependency":return;case"setLineWidth":this.state.lineWidth=Number(i[0]);return;case"setLineCap":this.state.lineCap=Number(i[0]);return;case"setLineJoin":this.state.lineJoin=Number(i[0]);return;case"setMiterLimit":this.state.miterLimit=Number(i[0]);return;case"setDash":this.setDash(i[0],i[1]);return;case"setRenderingIntent":case"setFlatness":return;case"setGState":this.setGState(i[0]);return;case"save":this.save();return;case"restore":this.restore();return;case"transform":this.state.ctm=Pt(pk(i),this.state.ctm);return;case"clip":this.state.pendingClip="nonzero";return;case"eoClip":this.state.pendingClip="evenodd";return;case"constructPath":this.constructPath(i);return;case"rawFillPath":this.rawFillPath(i[0]);return;case"beginText":this.beginText();return;case"endText":this.endText();return;case"setCharSpacing":this.state.text.charSpacing=Number(i[0]);return;case"setWordSpacing":this.state.text.wordSpacing=Number(i[0]);return;case"setHScale":this.state.text.hscale=Number(i[0])/100;return;case"setLeading":this.state.text.leading=Number(i[0]);return;case"setFont":this.setFont(String(i[0]),Number(i[1]));return;case"setTextRenderingMode":this.state.text.renderMode=Number(i[0]);return;case"setTextRise":this.state.text.rise=Number(i[0]);return;case"moveText":this.moveText(Number(i[0]),Number(i[1]));return;case"setLeadingMoveText":this.state.text.leading=-Number(i[1]),this.moveText(Number(i[0]),Number(i[1]));return;case"setTextMatrix":{let a=pk(i);this.state.text.tm=a,this.state.text.tlm=a,this.state.text.penX=0,this.state.text.penY=0,this.state.text.lineX=0,this.state.text.lineY=0;return}case"nextLine":this.moveText(0,-this.state.text.leading);return;case"showText":this.showText(i[0]);return;case"nextLineShowText":this.moveText(0,-this.state.text.leading),this.showText(i[0]);return;case"nextLineSetSpacingShowText":this.state.text.wordSpacing=Number(i[0]),this.state.text.charSpacing=Number(i[1]),this.moveText(0,-this.state.text.leading),this.showText(i[2]);return;case"setCharWidth":case"setCharWidthAndBounds":return;case"setStrokeRGBColor":this.uncolored||(this.state.stroke={kind:"color",hex:$l(i[0])});return;case"setFillRGBColor":this.uncolored||(this.state.fill={kind:"color",hex:$l(i[0])});return;case"setStrokeColorN":this.uncolored||(this.state.stroke=this.patternPaint(i));return;case"setFillColorN":this.uncolored||(this.state.fill=this.patternPaint(i));return;case"setStrokeTransparent":this.uncolored||(this.state.stroke={kind:"none"});return;case"setFillTransparent":this.uncolored||(this.state.fill={kind:"none"});return;case"shadingFill":this.shadingFill(String(i[0]));return;case"beginMarkedContent":this.markedStack.push(null);return;case"beginMarkedContentProps":this.beginMarkedContentProps(String(i[0]),i[1]);return;case"endMarkedContent":this.endMarkedContent();return;case"paintFormXObjectBegin":this.formBegin(i[0],i[1]);return;case"paintFormXObjectEnd":this.formEnd();return;case"beginGroup":this.beginGroup(i[0]);return;case"endGroup":this.endGroup();return;case"beginAnnotation":this.beginAnnotation(i);return;case"endAnnotation":this.endAnnotation();return;case"paintImageMaskXObject":this.paintImageMask(i[0],this.state.ctm);return;case"paintImageMaskXObjectGroup":for(let a of i[0])this.paintImageMask(a,Pt(On(a.transform),this.state.ctm));return;case"paintImageMaskXObjectRepeat":{let[a,o,s,l,u,d]=i;for(let c=0;c+1<d.length;c+=2)this.paintImageMask(a,Pt([o,s,l,u,d[c],d[c+1]],this.state.ctm));return}case"paintImageXObject":this.paintImage(this.imageObject(String(i[0])),this.state.ctm,String(i[0]));return;case"paintInlineImageXObject":this.paintImage(i[0],this.state.ctm,null);return;case"paintInlineImageXObjectGroup":{let a=i[0];for(let o of i[1])this.paintImage(a,Pt(On(o.transform),this.state.ctm),null);return}case"paintImageXObjectRepeat":{let[a,o,s,l]=i,u=this.imageObject(a);for(let d=0;d+1<l.length;d+=2)this.paintImage(u,Pt([o,0,0,s,l[d],l[d+1]],this.state.ctm),a);return}case"paintSolidColorImageMask":this.fillCanvasPath(Il(kl([0,0,1,1]),this.state.ctm),"nonzero",!0,!1);return;default:n===""?this.diagnose("operator-unknown",`Operator ${t} is not known to this transcoder.`,{operator:t}):this.diagnoseOnce("operator-ignored",`Operator ${n} has no effect in SVG output.`,{operator:n})}}save(){this.stack.push(dk(this.state))}restore(){let t=this.stack.pop();t&&(this.state=t,this.frames=this.frames.filter(r=>this.frameStillActive(r)))}frameStillActive(t){return t.kind==="clip"?this.state.clip.some(r=>r.frame===t):t.kind==="mask"?this.state.softMask===t:!0}setDash(t,r){let n=Array.isArray(t)?t.filter(i=>Number.isFinite(i)):[];if(n.length===0||n.every(i=>i===0)){this.state.dash=null;return}this.state.dash={array:n,phase:Number(r)||0}}setGState(t){if(Array.isArray(t))for(let[r,n]of t)switch(r){case"LW":this.state.lineWidth=Number(n);break;case"LC":this.state.lineCap=Number(n);break;case"LJ":this.state.lineJoin=Number(n);break;case"ML":this.state.miterLimit=Number(n);break;case"D":Array.isArray(n)&&this.setDash(n[0],n[1]);break;case"CA":this.state.strokeAlpha=hk(Number(n));break;case"ca":this.state.fillAlpha=hk(Number(n));break;case"BM":{let i=zG(n);i.supported||this.diagnose("blend-mode-unsupported",`Blend mode ${String(n)} has no CSS equivalent; normal blending is used.`,{mode:String(n)}),this.state.blend=i.css;break}case"Font":Array.isArray(n)&&this.setFont(String(n[0]),Number(n[1]));break;case"SMask":n?this.activateMask():this.deactivateMask();break;case"TR":n!=null&&n!==!1&&(this.state.transferActive=!0,this.diagnoseOnce("transfer-function-ignored","A transfer function in the graphics state was ignored."));break;default:break}}newFrameKey(t){return`${t}:${++this.frameSerial}`}place(t,r=this.frames){this.suppress>0||(this.emittedOnPage=!0,this.emitter.place(t,r))}constructPath(t){let r=this.doc.opName[Number(t[0])]??"endPath",n=t[1],i=Array.isArray(n)?n[0]:n,a=i?lm(i):[];if(this.state.pendingClip&&(this.applyClip(a,this.state.pendingClip),this.state.pendingClip=null),a.length!==0)switch(r){case"fill":this.paintPath(a,"nonzero",!0,!1,!1);break;case"eoFill":this.paintPath(a,"evenodd",!0,!1,!1);break;case"stroke":this.paintPath(a,"nonzero",!1,!0,!1);break;case"closeStroke":this.paintPath(a,"nonzero",!1,!0,!0);break;case"fillStroke":this.paintPath(a,"nonzero",!0,!0,!1);break;case"eoFillStroke":this.paintPath(a,"evenodd",!0,!0,!1);break;case"closeFillStroke":this.paintPath(a,"nonzero",!0,!0,!0);break;case"closeEOFillStroke":this.paintPath(a,"evenodd",!0,!0,!0);break;default:break}}rawFillPath(t){let r=lm(t);r.length>0&&this.paintPath(r,"nonzero",!0,!1,!1)}applyClip(t,r){if(t.length===0)return;let n=Il(t,this.state.ctm),i=_G(n),a=Wo(n);if(!a)return;if(this.pageCtx.dropPageClip&&!this.emittedOnPage&&i&&iG(xk(i),this.pageCtx.pageBox,.5)&&this.formDepth===0){this.diagnoseOnce("page-clip-dropped","A clip equal to the page box was dropped.");return}let o=Ca(n,this.doc.options.precision),s=this.doc.defs.intern("clip",Ma(`${r}|${o}`),u=>me("clipPath",{id:u,clipPathUnits:"userSpaceOnUse"},[me("path",r==="evenodd"?{d:o,"clip-rule":"evenodd"}:{d:o})]));this.doc.clips.has(s)||this.doc.clips.set(s,{quad:i,bounds:a,path:n});let l={key:this.newFrameKey("clip"),kind:"clip",attrs:{"clip-path":`url(#${s})`},clipId:s,clipQuad:i,clipBounds:a};this.state.clip=[...this.state.clip,{frame:l}],this.frames.push(l)}paintPath(t,r,n,i,a){let o=a&&t[t.length-1]?.op!=="Z"?[...t,{op:"Z"}]:t,s=n&&this.state.fill.kind!=="none",l=i&&this.state.stroke.kind!=="none";if(!s&&!l)return;let u=Il(o,this.state.ctm);this.emitPath(o,u,r,s,l)}fillCanvasPath(t,r,n,i){this.emitPath(t,t,r,n,i,!0)}emitPath(t,r,n,i,a,o=!1){let s=Wo(r);if(!s)return;let l=this.doc.options.precision,u=this.state.ctm,d=o||!a||yk(u),c=om(u),f={};d?f.d=Ca(r,l):(f.d=Ca(t,l),f.transform=Fi(u,l));let p=i?this.paintValue(this.state.fill,d?null:u):"none";f.fill=p,n==="evenodd"&&i&&(f["fill-rule"]="evenodd"),i&&this.state.fillAlpha<1&&(f["fill-opacity"]=ne(this.state.fillAlpha,3));let h=0;if(a){f.stroke=this.paintValue(this.state.stroke,d?null:u);let y=this.state.lineWidth;if(y<=0?(y=d?this.doc.options.hairlineWidth:this.doc.options.hairlineWidth/(c||1),this.diagnoseOnce("hairline-stroke-widened",`Zero-width strokes are drawn ${this.doc.options.hairlineWidth} units wide.`)):d&&(y*=c),h=d?y:y*c,f["stroke-width"]=ne(y,l),this.state.lineCap===1?f["stroke-linecap"]="round":this.state.lineCap===2&&(f["stroke-linecap"]="square"),this.state.lineJoin===1?f["stroke-linejoin"]="round":this.state.lineJoin===2&&(f["stroke-linejoin"]="bevel"),this.state.miterLimit!==10&&this.state.lineJoin===0&&(f["stroke-miterlimit"]=ne(this.state.miterLimit,3)),this.state.dash){let b=d?c:1;f["stroke-dasharray"]=this.state.dash.array.map(I=>ne(I*b,l)).join(" "),this.state.dash.phase&&(f["stroke-dashoffset"]=ne(this.state.dash.phase*b,l))}this.state.strokeAlpha<1&&(f["stroke-opacity"]=ne(this.state.strokeAlpha,3))}if(this.applyBlend(f),this.isDuplicate(`path|${JSON.stringify(f)}`))return;let m=me("path",f),g=h/2;m.bbox=[s[0]-g,s[1]-g,s[2]+g,s[3]+g],this.place(m),this.doc.stats.paths++;let v=am(r);this.recordAtom({node:m,kind:"path",bbox:m.bbox,fill:i?mk(this.state.fill):"none",stroke:a?mk(this.state.stroke):"none",fillRgb:i&&this.state.fill.kind==="color"?this.state.fill.hex:void 0,strokeRgb:a&&this.state.stroke.kind==="color"?this.state.stroke.hex:void 0,strokeWidth:a?h:void 0,subpathCount:v.subpaths,anchorCount:v.anchors,pathHash:Ma(Ca(r,3))})}applyBlend(t){if(!this.state.blend)return;let r=`mix-blend-mode:${this.state.blend}`;t.style=t.style?`${t.style};${r}`:r,this.blendModeUsed=!0}isDuplicate(t){if(!this.doc.dedupe||this.suppress>0)return!1;let r=this.doc.seenLeaves.get(t);return r===void 0?(this.doc.seenLeaves.set(t,this.pageCtx.pageNumber),!1):r===this.pageCtx.pageNumber?!1:(this.diagnoseOnce("artwork-deduped","Artwork repeated identically on an earlier page was imported once."),!0)}recordAtom(t){if(this.suppress>0||!this.recordAtoms)return;let r=null,n=null,i=!1,a=null;for(let o of this.frames)o.kind==="layer"&&o.ocgId&&(r=o.ocgId),o.kind==="marked"&&o.markedIndex!==void 0&&(n=o.markedIndex),o.kind==="clip"&&(i=!0,o.clipBounds&&(a=a?[Math.max(a[0],o.clipBounds[0]),Math.max(a[1],o.clipBounds[1]),Math.min(a[2],o.clipBounds[2]),Math.min(a[3],o.clipBounds[3])]:o.clipBounds));this.doc.atoms.push({id:this.doc.ids.next("a"),page:this.pageCtx.pageNumber,ocg:r,markedContentIndex:n,order:this.doc.atoms.length,opacity:this.state.fillAlpha<1?this.state.fillAlpha:void 0,blend:this.state.blend??void 0,clipped:i,clipBounds:a,...t,kind:this.atomKind??t.kind}),this.state.blend&&(this.blendModeUsed=!0)}patternPaint(t){if(Array.isArray(t)){if(t[0]==="TilingPattern"){let[,r,n,i,a,o,s,l,u]=t;return{kind:"tiling",ir:{color:r,operatorList:n,matrix:i,bbox:a,xstep:o,ystep:s,paintType:l,tilingType:u}}}if(t[0]==="Shading")return{kind:"shading",objId:String(t[1]),matrix:t[2]?On(t[2]):null}}return this.diagnose("shading-unsupported","A pattern color could not be interpreted; the paint was dropped."),{kind:"none"}}paintValue(t,r){switch(t.kind){case"color":return t.hex;case"none":return"none";case"shading":{let n=Pt(t.matrix??ci,this.state.baseCtm),i=r?Pt(n,Qh(r)??ci):n,a=this.gradientDef(t.objId,i,null);return a?`url(#${a})`:"none"}case"tiling":{let n=this.tilingDef(t.ir,r);return n?`url(#${n})`:"none"}}}shadingObject(t){try{let r=this.objs.get(t);return Array.isArray(r)?r:null}catch{return null}}gradientDef(t,r,n){let i=this.shadingObject(t);if(!i)return this.diagnose("shading-unsupported","A shading could not be read; its paint was dropped.",{objId:t}),null;if(i[0]==="Dummy")return this.diagnose("shading-unsupported","An unsupported shading type was dropped.",{objId:t}),null;if(i[0]==="Mesh")return this.meshDef(i,r,n);let[,a,,o,s,l,u,d]=i,c=this.doc.options.precision,f=gk(o).map(([x,k,$])=>{let A={offset:ne(x,ck),"stop-color":k};return $<1&&(A["stop-opacity"]=ne($,3)),me("stop",A)}),p=Fi(r,c);if(a==="axial"){let x=Ma(`axial|${JSON.stringify(o)}|${s}|${l}|${p}`);return this.doc.defs.intern("grad",x,k=>me("linearGradient",{id:k,gradientUnits:"userSpaceOnUse",x1:ne(s[0],c),y1:ne(s[1],c),x2:ne(l[0],c),y2:ne(l[1],c),gradientTransform:p},f))}let h=s,m=u??0,g=l,v=d??0,y=f,b=Math.hypot(g[0]-h[0],g[1]-h[1]);if(b+m>v+1e-6)if(Math.hypot(s[0]-l[0],s[1]-l[1])+v<=m+1e-6)h=l,m=d??0,g=s,v=u??0,y=gk(o).map(([x,k,$])=>{let A={offset:ne(1-x,ck),"stop-color":k};return $<1&&(A["stop-opacity"]=ne($,3)),me("stop",A)}).reverse();else{let x=Math.max(0,v-m-.001)/(b||1);h=[g[0]+(h[0]-g[0])*x,g[1]+(h[1]-g[1])*x],this.diagnose("radial-gradient-approximated","A radial shading whose circles are not nested was approximated with a nested focal circle.",{objId:t})}let I=Ma(`radial|${JSON.stringify(o)}|${h}|${m}|${g}|${v}|${p}`);return this.doc.defs.intern("grad",I,x=>me("radialGradient",{id:x,gradientUnits:"userSpaceOnUse",cx:ne(g[0],c),cy:ne(g[1],c),r:ne(v,c),fx:ne(h[0],c),fy:ne(h[1],c),...m>0?{fr:ne(m,c)}:{},gradientTransform:p},y))}meshDef(t,r,n){let[,,i,a,o,s]=t,l=t[7];if(!s||s.length<4)return this.diagnose("shading-unsupported","A mesh shading without bounds was dropped."),null;let u=[s[0],s[1],s[2],s[3]],d=o>0?Math.max(3,Math.floor(a.length/o)):3,c=this.doc.options.precision,f=Qh(r),p=f?nc(this.pageCtx.pageBox,f).bounds:null,h=Oa(u,p)??u,m={patternUnits:"userSpaceOnUse",x:ne(h[0],c),y:ne(h[1],c),width:ne(h[2]-h[0],c),height:ne(h[3]-h[1],c),patternTransform:Fi(r,c)};if(this.doc.options.mesh.strategy==="triangles"){let y=[];for(let b=0;b+2<o;b+=3){let I=`M${ne(i[b*2],c)} ${ne(i[b*2+1],c)}L${ne(i[(b+1)*2],c)} ${ne(i[(b+1)*2+1],c)}L${ne(i[(b+2)*2],c)} ${ne(i[(b+2)*2+1],c)}Z`;y.push(me("path",{d:I,fill:TG(a,b,d),"shape-rendering":"crispEdges"}))}return this.diagnose("mesh-triangulated","A mesh shading was flattened into flat-shaded triangles.",{triangles:Math.floor(o/3)}),this.doc.defs.add("mesh",b=>me("pattern",{id:b,...m},y))}let g=CG(i,a,o,u,this.doc.options.mesh.pixelsPerUnit,this.doc.options.mesh.maxSize,l,d);if(!g)return this.diagnose("shading-unsupported","A mesh shading could not be rasterized."),null;let v=me("image",{x:ne(u[0],c),y:ne(u[1],c),width:ne(u[2]-u[0],c),height:ne(u[3]-u[1],c),preserveAspectRatio:"none",transform:`matrix(1 0 0 -1 0 ${ne(u[1]+u[3],c)})`});return this.queueImage(v,g.png),this.diagnose("mesh-rasterized","A mesh shading was rasterized into an embedded image.",{width:g.png.width,height:g.png.height}),this.doc.defs.add("mesh",y=>me("pattern",{id:y,...m},[v]))}tilingDef(t,r){if(this.patternDepth>=s6)return this.diagnose("shading-unsupported","Nested tiling patterns beyond four levels were dropped."),null;let n=this.doc.options.precision,i=Pt(On(t.matrix),this.state.baseCtm),a=r?Pt(i,Qh(r)??ci):i,o=t.bbox,s=Math.abs(t.xstep)||o[2]-o[0],l=Math.abs(t.ystep)||o[3]-o[1],u=Ma(`tile|${JSON.stringify([t.color,t.paintType,t.xstep,t.ystep,Array.from(o)])}|${Fi(a,n)}|${t.operatorList.fnArray.length}`);return this.doc.defs.intern("pat",u,d=>{let c=me("pattern",{id:d,patternUnits:"userSpaceOnUse",x:ne(o[0],n),y:ne(o[1],n),width:ne(s,n),height:ne(l,n),patternTransform:Fi(a,n)});(o[2]-o[0]>s+1e-6||o[3]-o[1]>l+1e-6)&&this.diagnose("pattern-tile-overlap-clipped","A tiling pattern whose cell exceeds its step is clipped to the step in SVG.");let f=new um(this.doc,this.pageCtx,this.emitterFor(c),ci);if(f.patternDepth=this.patternDepth+1,f.recordAtoms=!1,t.paintType===2){let p=$l(t.color);f.state.fill={kind:"color",hex:p},f.state.stroke={kind:"color",hex:p},f.uncolored=!0}return f.runNested(t.operatorList),f.emitter.closeAll(),c})}uncolored=!1;recordAtoms=!0;atomKind=null;emitterFor(t){let r=this.emitter.constructor;return new r(t)}shadingFill(t){let r=this.state.clip.length>0?this.state.clip[this.state.clip.length-1]:null,n,i=this.frames;if(r){let d=this.doc.clips.get(r.frame.clipId??"");n=d?[...d.path]:kl(r.frame.clipBounds??this.pageCtx.pageBox),i=this.frames.filter(c=>c!==r.frame)}else n=kl(this.pageCtx.pageBox),this.diagnoseOnce("shading-fill-unclipped","A shading fill without a clip was painted over the whole page.");let a=this.gradientDef(t,this.state.ctm,Wo(n));if(!a)return;let o=Wo(n);if(!o)return;let s={d:Ca(n,this.doc.options.precision),fill:`url(#${a})`};if(this.state.fillAlpha<1&&(s["fill-opacity"]=ne(this.state.fillAlpha,3)),this.applyBlend(s),this.isDuplicate(`shading|${JSON.stringify(s)}`))return;let l=me("path",s);l.bbox=o,this.place(l,i),this.doc.stats.paths++;let u=am(n);this.recordAtom({node:l,kind:"shading",bbox:o,fill:"shading",stroke:"none",subpathCount:u.subpaths,anchorCount:u.anchors,pathHash:Ma(s.d)})}imageObject(t){try{let r=this.objs.get(t);return r&&typeof r=="object"?r:null}catch{return null}}queueImage(t,r){let n=this.doc.options.images.maxDimension,i=r;(r.width>n||r.height>n)&&(i=SG(r,n),this.diagnose("image-downsampled","An image larger than the configured maximum was downsampled.",{from:`${r.width}x${r.height}`,to:`${i.width}x${i.height}`})),this.doc.imageJobs.push(cm(i).then(a=>{t.attrs.href=`data:image/png;base64,${xG(a)}`}))}paintImage(t,r,n){if(!t||!t.data&&!t.bitmap){this.diagnose("image-skipped","An image could not be decoded and was skipped.",n?{objId:n}:void 0);return}let i=wG(t);if(!i){this.diagnose("image-decode-failed","An image in an unexpected pixel format was skipped.",{kind:t.kind});return}let a=this.doc.options.precision,o=Pt([1/t.width,0,0,-1/t.height,0,1],r),s=me("image",{width:String(t.width),height:String(t.height),preserveAspectRatio:"none",transform:Fi(o,a)});this.state.fillAlpha<1&&(s.attrs.opacity=ne(this.state.fillAlpha,3)),this.applyBlend(s.attrs);let l=nc([0,0,1,1],r).bounds;t.interpolate!==!0&&(l[2]-l[0]>t.width||l[3]-l[1]>t.height)&&(s.attrs["image-rendering"]="optimizeSpeed"),!this.isDuplicate(`image|${n??`inline:${i.width}x${i.height}:${i.data.length}`}|${JSON.stringify(s.attrs)}`)&&(s.bbox=l,this.queueImage(s,i),this.place(s),this.doc.stats.images++,this.recordAtom({node:s,kind:"image",bbox:l,fill:"none",stroke:"none"}))}paintImageMask(t,r){let n=null;if(typeof t.data=="string")try{let f=this.objs.get(t.data);n=f instanceof Uint8Array||f instanceof Uint8ClampedArray?f:f?.data??null}catch{n=null}else n=t.data;if(!n){this.diagnose("image-skipped","A stencil mask could not be decoded and was skipped.");return}let i=this.state.fill,a=i.kind==="color"?i.hex:"#000000";i.kind!=="color"&&this.diagnose("image-mask-tinted","A stencil mask painted with a pattern was tinted with black instead.");let o=kG(n,t.width,t.height,a),s=this.doc.options.precision,l=Pt([1/t.width,0,0,-1/t.height,0,1],r),u=me("image",{width:String(t.width),height:String(t.height),preserveAspectRatio:"none",transform:Fi(l,s)});this.state.fillAlpha<1&&(u.attrs.opacity=ne(this.state.fillAlpha,3)),this.applyBlend(u.attrs);let d=nc([0,0,1,1],r).bounds;if(t.interpolate!==!0&&(d[2]-d[0]>t.width||d[3]-d[1]>t.height)&&(u.attrs["image-rendering"]="optimizeSpeed"),this.isDuplicate(`mask|${typeof t.data=="string"?t.data:`inline:${t.width}x${t.height}:${n.length}`}|${a}|${JSON.stringify(u.attrs)}`))return;let c=nc([0,0,1,1],r).bounds;u.bbox=c,this.queueImage(u,o),this.place(u),this.doc.stats.images++,this.recordAtom({node:u,kind:"image",bbox:c,fill:i.kind==="color"?"flat":"none",stroke:"none",fillRgb:a})}formBegin(t,r){if(this.save(),this.formDepth++,this.formDepth>fk){this.diagnoseOnce("xobject-depth-limited","Form XObjects nested deeper than 32 levels were suppressed."),this.suppress++;return}if(t&&(this.state.ctm=Pt(On(t),this.state.ctm)),this.state.baseCtm=this.state.ctm,r&&r.length>=4){let n=[Math.min(r[0],r[2]),Math.min(r[1],r[3]),Math.max(r[0],r[2]),Math.max(r[1],r[3])];this.applyClip(kl(n),"nonzero")}}formEnd(){this.formDepth>fk&&(this.suppress=Math.max(0,this.suppress-1)),this.formDepth=Math.max(0,this.formDepth-1),this.flushText(),this.restore()}beginGroup(t){if(this.flushText(),t.smask){let a=t.smask.subtype==="Alpha"?"alpha":"luminance",o=me("mask",{maskUnits:"userSpaceOnUse","mask-type":a,style:`mask-type:${a}`}),s=this.doc.defs.add("mask",()=>o),l={savedFrames:this.frames,maskId:s,maskNode:o,smask:t.smask};this.save(),this.state.fillAlpha=1,this.state.strokeAlpha=1,this.state.blend=null,this.state.softMask=null,this.state.clip=[],this.frames=[],this.emitter.pushTarget(o),this.captureStack.push(l),this.groupStack.push({frame:null,capture:l});return}let r={},n=[];this.state.fillAlpha<1&&(r.opacity=ne(this.state.fillAlpha,3)),this.state.blend&&(n.push(`mix-blend-mode:${this.state.blend}`),this.blendModeUsed=!0),n.push("isolation:isolate"),n.length>0&&(r.style=n.join(";")),t.knockout&&this.diagnoseOnce("knockout-group-ignored","Knockout transparency groups are composited as ordinary groups."),this.save(),this.state.fillAlpha=1,this.state.strokeAlpha=1,this.state.blend=null;let i=null;Object.keys(r).length>0&&(i={key:this.newFrameKey("group"),kind:"group",attrs:r},this.frames.push(i)),this.groupStack.push({frame:i,capture:null})}endGroup(){this.flushText();let t=this.groupStack.pop();if(t){if(t.capture){this.captureStack.pop(),this.emitter.closeAll();let r=this.emitter.popTarget();this.restore(),this.frames=t.capture.savedFrames,this.finishMask(t.capture,r),this.lastMask={id:t.capture.maskId};return}this.restore(),t.frame&&(this.frames=this.frames.filter(r=>r!==t.frame))}}finishMask(t,r){let n=this.doc.options.precision,i=Oa(r.bbox??null,this.pageCtx.pageBox)??this.pageCtx.pageBox;r.attrs.x=ne(i[0],n),r.attrs.y=ne(i[1],n),r.attrs.width=ne(i[2]-i[0],n),r.attrs.height=ne(i[3]-i[1],n);let a=t.smask.backdrop;if(t.smask.subtype==="Luminosity"&&a&&a.length>0){let o=a.length>=3?.299*a[0]+.587*a[1]+.114*a[2]:a[0],s=o<=1?Math.round(o*255):Math.round(o);if(s>0){let l=`#${s.toString(16).padStart(2,"0").repeat(3)}`;r.children.unshift(me("rect",{x:r.attrs.x,y:r.attrs.y,width:r.attrs.width,height:r.attrs.height,fill:l}))}}t.smask.transferMap&&this.diagnose("soft-mask-transfer-ignored","A soft mask transfer function was ignored."),this.diagnose("soft-mask-converted","A soft mask was converted to an SVG mask.",{type:t.smask.subtype})}activateMask(){if(!this.lastMask)return;this.deactivateMask();let t={key:this.newFrameKey("mask"),kind:"mask",attrs:{mask:`url(#${this.lastMask.id})`}};this.state.softMask=t,this.frames.push(t)}deactivateMask(){if(!this.state.softMask)return;let t=this.state.softMask;this.state.softMask=null,this.frames=this.frames.filter(r=>r!==t)}beginAnnotation(t){let[r,n,i,a]=t;this.flushText(),this.save(),i&&(this.state.ctm=Pt(On(i),this.state.ctm)),a&&(this.state.ctm=Pt(On(a),this.state.ctm)),this.state.baseCtm=this.state.ctm,n&&n.length>=4&&this.applyClip(kl([Math.min(n[0],n[2]),Math.min(n[1],n[3]),Math.max(n[0],n[2]),Math.max(n[1],n[3])]),"nonzero");let o={key:this.newFrameKey("annotation"),kind:"annotation",attrs:{id:this.doc.ids.unique(`annotation-${String(r)}`)}};this.frames.push(o),this.groupStack.push({frame:o,capture:null}),this.diagnose("annotation-imported","An annotation appearance was imported as a group.",{id:String(r)})}endAnnotation(){this.flushText();let t=this.groupStack.pop();this.restore(),t?.frame&&(this.frames=this.frames.filter(r=>r!==t.frame))}beginMarkedContentProps(t,r){if(t==="OC"){this.markedStack.push(this.layerFrame(r));return}if(t==="Layer"){let n=this.markedIndex++,i={key:this.newFrameKey("marked"),kind:"marked",attrs:{"data-pdf-layer":String(n)},markedIndex:n};this.frames.push(i),this.markedStack.push(i);return}this.markedStack.push(null)}layerFrame(t){if(!t)return null;let r=this.doc.ocConfig,n=r?r.isVisible(t):!0;if(t.type==="OCG"){let i=(r?.getGroup(t.id)??null)?.name??null;if(!n&&this.doc.options.hiddenLayers==="skip")return this.diagnose("layer-skipped-hidden","A hidden layer was left out.",{layer:i??t.id}),this.suppress++,{key:this.newFrameKey("skip"),kind:"layer",attrs:{},ocgId:t.id};if(this.doc.options.layers==="flatten"){n||this.diagnose("layer-imported-hidden","A hidden layer was imported hidden.",{layer:i??t.id});let u={key:this.newFrameKey("layer"),kind:"layer",attrs:n?{}:{style:"display:none"},ocgId:t.id};return n||this.frames.push(u),n?null:u}let a=this.doc.layers.get(t.id);a||(a={id:this.doc.ids.unique(i??`layer-${hn(t.id)}`),name:i,visible:n,svgIds:[]},this.doc.layers.set(t.id,a));let o=a.svgIds.length===0?a.id:this.doc.ids.unique(a.id);a.svgIds.push(o),n||this.diagnose("layer-imported-hidden","A hidden layer was imported hidden.",{layer:i??t.id});let s={id:o};n||(s.style="display:none");let l={key:this.newFrameKey("layer"),kind:"layer",attrs:s,title:this.doc.options.layerTitles?i??void 0:void 0,ocgId:t.id};return this.frames.push(l),l}if(!n){if(this.doc.options.hiddenLayers==="skip")return this.diagnose("ocmd-hidden","Content in a hidden optional-content membership was left out."),this.suppress++,{key:this.newFrameKey("skip"),kind:"layer",attrs:{}};this.diagnose("ocmd-hidden","Content in a hidden optional-content membership was imported hidden.");let i={key:this.newFrameKey("layer"),kind:"layer",attrs:{style:"display:none"}};return this.frames.push(i),i}return null}endMarkedContent(){if(this.markedStack.length===0){this.diagnoseOnce("marked-content-unbalanced","An EMC without a matching BDC was ignored.");return}let t=this.markedStack.pop()??null;if(t){if(this.flushText(),t.key.startsWith("skip:")){this.suppress=Math.max(0,this.suppress-1);return}this.frames=this.frames.filter(r=>r!==t)}}beginText(){let t=this.state.text;t.tm=ci,t.tlm=ci,t.penX=0,t.penY=0,t.lineX=0,t.lineY=0,this.textObject++}endText(){this.flushText(),this.textClipActive&&this.applyTextClip()}moveText(t,r){let n=this.state.text;n.lineX+=t,n.lineY+=r,n.penX=n.lineX,n.penY=n.lineY}setFont(t,r){this.state.text.size=r,this.state.text.font=this.loadFont(t)}loadFont(t){let r=this.doc.fonts.get(t);if(r)return r;let n=null;try{n=this.commonObjs.get(t)}catch{n=null}if(!n)return null;let i=Ck(n.name??t),a={name:i,type:n.type??"",subtype:n.subtype??"",bold:!!n.bold,italic:!!n.italic,black:!!n.black,serif:!!n.isSerifFont,monospace:!!n.isMonospace,symbolic:!!n.isSymbolicFont,missingFile:!!n.missingFile,isType3:!!n.isType3Font,vertical:!!n.vertical,composite:!!n.composite},o=uc(a),s=this.doc.options.fontMap?.(a);s&&(o={...o,...s});let l=n.fontMatrix&&n.fontMatrix.length>=6?On(n.fontMatrix):[.001,0,0,.001,0,0],u=n.widths,d=u?(Array.isArray(u),u[32]):void 0,c={loadedName:t,font:n,mapping:o,fontMatrix:l,isType3:!!n.isType3Font,vertical:!!n.vertical,embedded:XG(n.name??"")||!!n.data&&!n.missingFile&&!GG(o.family),name:i,type:n.type??"",subtype:n.subtype??"",spaceAdvance:typeof d=="number"&&d>0?d*l[0]:.25,glyphsShown:0,outlinedGlyphs:0,unmappableGlyphs:0};return this.doc.fonts.set(t,c),c.isType3||this.doc.sink.add({code:"font-substituted",message:`Font ${i} is not embedded as a web font; text uses the mapped family.`,detail:{font:i,family:o.family,embedded:c.embedded}}),c}showText(t){let r=this.state.text,n=r.font;if(!n||!Array.isArray(t))return;let i=r.size,a=r.hscale,o=i*n.fontMatrix[0],s=Pt(r.tm,this.state.ctm),l=this.state.fill.kind==="color"?this.state.fill.hex:this.state.fill.kind==="none"?null:"#000000",u=this.state.stroke.kind==="color"?this.state.stroke.hex:this.state.stroke.kind==="none"?null:"#000000",d=(this.state.lineWidth>0?this.state.lineWidth:this.doc.options.hairlineWidth)*om(this.state.ctm);for(let c of t){if(typeof c=="number"){r.penX+=-c*i*.001*a;continue}let f=c;if(!f||typeof f!="object")continue;let p=r.charSpacing+(f.isSpace?r.wordSpacing:0),h=(f.width*o+p)*a;n.glyphsShown++,this.doc.stats.glyphs++,r.renderMode===3?this.diagnoseOnce("invisible-text-dropped","Invisible text (render mode 3) was dropped."):(r.renderMode&3)!==3&&this.textRecords.push({unicode:f.unicode??"",fontChar:f.fontChar??"",...f.operatorListId!==void 0?{operatorListId:String(f.operatorListId)}:{},isSpace:!!f.isSpace,fontKey:n.loadedName,mapping:n.mapping,fontName:n.name,size:i,hs:a,rise:r.rise,penY:r.penY,renderMode:r.renderMode,pen:r.penX,advance:h,basis:s,fill:l,stroke:u,strokeWidth:d,fillOpacity:this.state.fillAlpha,strokeOpacity:this.state.strokeAlpha,blend:this.state.blend,frames:this.frames.slice(),textObject:this.textObject,charSpacing:r.charSpacing,wordSpacing:r.wordSpacing}),r.renderMode>=4&&(this.textClipActive=!0,this.accumulateTextClip(n,f,i,a,r.penX,r.penY+r.rise,s)),r.penX+=h}}accumulateTextClip(t,r,n,i,a,o,s){let l=this.doc.glyphCache.get(this.commonObjs,t.loadedName,r.fontChar);if(!l||l.length===0)return;let u=Pt([n*i,0,0,n,a,o],s);this.textClipPaths.push(...Il(l,u))}applyTextClip(){this.textClipActive=!1;let t=this.textClipPaths;if(this.textClipPaths=[],t.length===0)return;let r=Ca(t,this.doc.options.precision),n=Wo(t);if(!n)return;let i=this.doc.defs.intern("clip",Ma(`text|${r}`),o=>me("clipPath",{id:o,clipPathUnits:"userSpaceOnUse"},[me("path",{d:r})]));this.doc.clips.set(i,{quad:null,bounds:n,path:t});let a={key:this.newFrameKey("clip"),kind:"clip",attrs:{"clip-path":`url(#${i})`},clipId:i,clipQuad:null,clipBounds:n};this.state.clip=[...this.state.clip,{frame:a}],this.frames.push(a),this.diagnose("text-clip-converted","Text used as a clipping path was converted to a clip path of glyph outlines.")}flushText(){if(this.textRecords.length===0)return;let t=this.textRecords;this.textRecords=[];let r=YG(t,o=>this.doc.fonts.get(o.fontKey)?.spaceAdvance??.25),n=this.doc.options.textMode==="outline",i=[];for(let o of r){let s=this.doc.fonts.get(o.first.fontKey);if(s?.isType3){this.diagnose("type3-outlined",`Text set in the Type3 font ${o.first.fontName} was drawn from its glyph procedures.`,{font:o.first.fontName}),this.emitType3Run(o,s);continue}let l=s?this.outlineReason(o,s):"missing";if(n||l){!n&&l&&this.diagnose(l==="vertical"?"text-outlined-vertical":l==="mirrored"?"text-outlined-mirrored":l==="render-mode"?"text-outlined-render-mode":"text-outlined-unmappable",`Text set in ${o.first.fontName} was converted to outlines.`,{font:o.first.fontName}),this.emitOutlinedRun(o,s);continue}i.push(o)}if(i.length===0)return;let a=JG(i,{precision:this.doc.options.precision,positioning:this.doc.options.textPositioning,spaceAdvance:o=>this.doc.fonts.get(o.fontKey)?.spaceAdvance??.25});for(let o of a)o.blend&&(this.blendModeUsed=!0),!this.isDuplicate(`text|${qo(o.node)}`)&&(o.node.bbox=o.bbox,this.place(o.node,o.frames),this.doc.stats.texts++,this.recordAtom({node:o.node,kind:"text",bbox:o.bbox,fill:o.node.attrs.fill==="none"?"none":"flat",stroke:o.node.attrs.stroke?"flat":"none",fillRgb:o.node.attrs.fill!=="none"?o.node.attrs.fill:void 0,text:{unicode:o.unicode,font:o.fontName,size:o.size,baseline:o.baseline}}))}outlineReason(t,r){if(r.vertical)return"vertical";if(t.first.size<0)return"mirrored";let n=t.first.renderMode&3;if((n===1||n===2)&&(this.state.stroke.kind==="shading"||this.state.stroke.kind==="tiling")||n===0&&(this.state.fill.kind==="shading"||this.state.fill.kind==="tiling"))return"render-mode";let i=0;for(let a of t.glyphs){let o=a.unicode.codePointAt(0)??0;a.unicode.length>0&&o!==65533&&!(o>=57344&&o<=63743)&&!(o>=983040)&&i++}return i<t.glyphs.length*.6?"unmappable":null}emitOutlinedRun(t,r){let n=this.doc.options.precision,i=[],a=0;for(let h of t.glyphs){let m=r?this.glyphOutline(r,h.fontChar):null;if(!m){a++;continue}let g=Pt([h.size*h.hs,0,0,h.size,h.pen,h.penY+h.rise],h.basis);i.push(...Il(m,g)),r&&r.outlinedGlyphs++}if(a>0&&this.diagnose("glyph-outline-missing",`${a} glyph outlines of ${t.first.fontName} were unavailable and skipped.`,{font:t.first.fontName,count:a}),i.length===0)return;let o=Wo(i);if(!o)return;let s=t.first,l=s.renderMode&3,u={d:Ca(i,n)},d=(l===0||l===2)&&s.fill,c=(l===1||l===2)&&s.stroke;if(u.fill=d?this.paintValue(this.state.fill,null):"none",d&&s.fillOpacity<1&&(u["fill-opacity"]=ne(s.fillOpacity,3)),c&&(u.stroke=this.paintValue(this.state.stroke,null),u["stroke-width"]=ne(s.strokeWidth,n),s.strokeOpacity<1&&(u["stroke-opacity"]=ne(s.strokeOpacity,3))),!d&&!c||(s.blend&&(u.style=`mix-blend-mode:${s.blend}`),this.isDuplicate(`outline|${JSON.stringify(u)}`)))return;let f=me("path",u);f.bbox=o,this.place(f,s.frames),this.doc.stats.texts++,this.doc.stats.textsOutlined++;let p=am(i);this.recordAtom({node:f,kind:"text",bbox:o,fill:d?"flat":"none",stroke:c?"flat":"none",fillRgb:d?s.fill??void 0:void 0,subpathCount:p.subpaths,anchorCount:p.anchors,text:{unicode:t.glyphs.map(h=>h.unicode).join(""),font:s.fontName,size:s.size,baseline:{x:s.basis[4],y:s.basis[5]}}})}glyphOutline(t,r){return this.doc.glyphCache.get(this.commonObjs,t.loadedName,r)}emitType3Run(t,r){let n=r.font.charProcOperatorList,i=o=>{if(n)return n instanceof Map?n.get(o):n[o]},a=0;for(let o of t.glyphs){let s=o.operatorListId??o.fontChar,l=i(s);if(!l||l.fnArray.length===0){a++;continue}let u=Pt(r.fontMatrix,Pt([o.size*o.hs,0,0,o.size,o.pen,o.penY+o.rise],o.basis)),d=new um(this.doc,this.pageCtx,this.emitter,u);d.state=dk(this.state),d.state.ctm=u,d.state.baseCtm=u,d.state.text=Pk(),d.state.pendingClip=null,d.state.fillAlpha=o.fillOpacity,d.state.strokeAlpha=o.strokeOpacity,this.doc.opName[l.fnArray[0]]==="setCharWidth"&&(d.state.fillAlpha=1,d.state.strokeAlpha=1),d.frames=o.frames.slice(),d.formDepth=this.formDepth+1,d.emittedOnPage=!0,d.suppress=this.suppress,d.atomKind="text",d.runNested(l),d.blendModeUsed&&(this.blendModeUsed=!0),r.outlinedGlyphs++}a>0&&this.diagnose("glyph-outline-missing",`${a} glyph procedures of ${t.first.fontName} were unavailable and skipped.`,{font:t.first.fontName,count:a}),this.doc.stats.texts++,this.doc.stats.textsOutlined++}};function pk(e){if(e.length>=6&&typeof e[0]=="number")return On(e);let t=e[0];return t&&typeof t=="object"&&t.length>=6?On(t):ci}function hk(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function mk(e){switch(e.kind){case"color":return"flat";case"none":return"none";case"shading":return"shading";case"tiling":return"pattern"}}function gk(e){let t=e.map((n,i)=>({offset:Math.max(0,Math.min(1,n[0])),color:n[1],index:i})).sort((n,i)=>n.offset-i.offset||n.index-i.index),r=n=>n==="transparent";return t.map((n,i)=>{if(!r(n.color))return[n.offset,$l(n.color),1];let a=[t[i+1],t[i-1]].find(o=>o&&!r(o.color));return[n.offset,a?$l(a.color):"#000000",0]})}async function u6(){let e=globalThis.scheduler;if(e?.yield){await e.yield();return}await new Promise(t=>setTimeout(t,0))}var d6=class{targets=[];constructor(e){this.targets.push({root:e,open:[]})}pushTarget(e){this.targets.push({root:e,open:[]})}popTarget(){if(this.targets.length===1)throw new Error("Emitter target stack underflow");return this.targets.pop().root}get root(){return this.targets[0].root}get currentRoot(){return this.targets[this.targets.length-1].root}get depth(){return this.targets.length}place(e,t){let r=this.targets[this.targets.length-1],n=0;for(;n<r.open.length&&n<t.length&&r.open[n].frame.key===t[n].key;)n++;r.open.length=n;for(let a=n;a<t.length;a++){let o=t[a],s=a===0?r.root:r.open[a-1].node,l=me("g",{...o.attrs});o.title&&l.children.push(me("title",{},[sc(o.title)])),s.children.push(l),r.open.push({frame:o,node:l})}let i=t.length===0?r.root:r.open[t.length-1].node;if(i.children.push(e),e.bbox){for(let a of r.open)a.node.bbox=Oa(a.node.bbox??null,e.bbox);r.root.bbox=Oa(r.root.bbox??null,e.bbox)}return i}closeAll(){this.targets[this.targets.length-1].open.length=0}},c6=new Set(["opacity","clip-path","mask","style","transform","id","class"]),f6=new Set(["opacity","clip-path","mask","style","id"]),p6=new Set(["clip-path","mask"]);function h6(e,t){Dk(e),jk(e,t),Ek(e)}function m6(e){return e.tag!=="g"&&e.tag!=="title"}function Dk(e){let t=!1;return e.children=e.children.filter(r=>{if(Ke(r))return t=!0,!0;if(r.tag==="title"||r.tag==="desc")return!0;if(r.tag==="g"||r.tag==="svg"){let n=Dk(r);return n&&(t=!0),n}return t=!0,!0}),t||m6(e)||e.tag==="svg"}function g6(e){let t=e.attrs["clip-path"],r=t?/^url\(#([^)]+)\)$/.exec(t):null;return r?r[1]:null}function jk(e,t){for(let i of e.children)Ke(i)||jk(i,t);let r=g6(e);if(!r||!e.bbox)return;let n=t.get(r);n?.quad&&aG(n.quad,e.bbox,.01)&&delete e.attrs["clip-path"]}function Ek(e){for(let r of e.children)Ke(r)||Ek(r);let t=[];for(let r of e.children){if(Ke(r)||r.tag!=="g"){t.push(r);continue}if(Object.keys(r.attrs).length===0&&r.children.every(a=>Ke(a)||a.tag!=="title")){t.push(...r.children);continue}let n=r.children.filter(a=>!Ke(a)&&a.tag!=="title"),i=r.children.filter(a=>!Ke(a)&&a.tag==="title");if(n.length===1&&n[0].tag==="g"&&i.length===0){let a=n[0],o=Object.keys(a.attrs);if(!(o.some(s=>f6.has(s)&&s in r.attrs)||!o.every(s=>c6.has(s)||!(s in r.attrs))||"transform"in a.attrs&&Object.keys(r.attrs).some(s=>p6.has(s)))&&!("id"in r.attrs&&"id"in a.attrs)){let s={tag:"g",attrs:{...r.attrs,...a.attrs},children:a.children,bbox:r.bbox};r.attrs.transform&&a.attrs.transform&&(s.attrs.transform=`${r.attrs.transform} ${a.attrs.transform}`),t.push(s);continue}}t.push(r)}e.children=t}var y6=class{cache=new Map;get(e,t,r){let n=`${t}_path_${r}`,i=this.cache.get(n);if(i!==void 0)return i;let a=null;if(e.has(n)){let o=e.get(n),s=o&&typeof o=="object"&&"path"in o?o.path:null;a=s?lm(s):[]}return this.cache.set(n,a),a}clear(){this.cache.clear()}};function v6(e){return{runtime:e.runtime,pages:e.pages??"all",textMode:e.textMode??"editable",textPositioning:e.textPositioning??"natural",layers:e.layers??"groups",hiddenLayers:e.hiddenLayers??"import-hidden",layerTitles:e.layerTitles??!0,pageBox:e.pageBox??"auto",pageLayout:e.pageLayout??"auto",pageGap:e.pageGap??24,pagePlacements:e.pagePlacements??[],pageClip:e.pageClip??"auto",dedupeAcrossPages:e.dedupeAcrossPages??"auto",annotations:e.annotations??"skip",colorManagement:e.colorManagement??"device",images:{maxPixels:e.images?.maxPixels??16e6,maxDimension:e.images?.maxDimension??4096},mesh:{strategy:e.mesh?.strategy??"raster",pixelsPerUnit:e.mesh?.pixelsPerUnit??2,maxSize:e.mesh?.maxSize??2048},hairlineWidth:e.hairlineWidth??.25,precision:e.precision??3,idPrefix:e.idPrefix??"pdf",password:e.password,fontMap:e.fontMap,signal:e.signal,onProgress:e.onProgress}}function b6(e,t){if(e==="all")return Array.from({length:t},(n,i)=>i+1);let r=new Set;if(Array.isArray(e))for(let n of e)Number.isInteger(n)&&n>=1&&n<=t&&r.add(n);else{let n=e,i=Math.max(1,Math.floor(n.from)),a=Math.min(t,Math.floor(n.to));for(let o=i;o<=a;o++)r.add(o)}return[...r].sort((n,i)=>n-i)}async function zk(e,t){let r=Date.now(),n=v6(t),i=new yG,a=(s,l,u,d=0)=>{n.onProgress?.({phase:s,fraction:l,page:u,pageCount:d})};a("load",0);let o=await vG(e,n,i);try{let{pdfjs:s,document:l}=o,u=b6(n.pages,l.numPages),d=[];for(let[_,U]of Object.entries(s.OPS))d[U]=_;let c=null;try{c=await l.getOptionalContentConfig()}catch{c=null}a("scan",.05,void 0,u.length);let f=[],p=[];for(let _ of u){Ho(n.signal);let U=await l.getPage(_);f.push(U);let V=pG(U,e,n);V.fallback&&i.add({code:"page-box-fallback",message:`The requested ${n.pageBox} box was not found; the crop box was used.`,page:_}),V.rotate!==0&&i.add({code:"page-rotated",message:`The page declares a rotation of ${V.rotate} degrees, which was applied.`,page:_}),V.userUnit!==1&&i.add({code:"user-unit-ignored",message:"The page declares a UserUnit, which SVG output ignores.",page:_,detail:{userUnit:V.userUnit}}),p.push(V)}let h=n.pageLayout==="auto"?o.info.isIllustrator||k6(p)?"source":"row":n.pageLayout,m=mG(p,h,n.pageGap);w6(m,p,u,n,i),I6(m);let g=n.pageClip==="drop"||n.pageClip==="auto"&&o.info.isIllustrator,v=n.dedupeAcrossPages===!0||n.dedupeAcrossPages==="auto"&&o.info.isIllustrator&&h==="source",y=null;try{y=await l.getPageLabels()}catch{y=null}let b=new sG(n.idPrefix),I=new lG(b),x={pdfjs:s,opName:d,options:n,sink:i,ids:b,defs:I,fonts:new Map,glyphCache:new y6,ocConfig:c,layers:new Map,clips:new Map,atoms:[],imageJobs:[],stats:{operators:0,paths:0,images:0,texts:0,textsOutlined:0,glyphs:0},isIllustrator:o.info.isIllustrator,dedupe:v,seenLeaves:new Map},k=[];for(let _=0;_<f.length;_++){Ho(n.signal);let U=f[_],V=u[_],q=p[_],G=m[_];a("page-operators",.1+.8*_/f.length,V,f.length);let H=me("g",f.length>1&&!o.info.isIllustrator?{id:b.unique(`page-${V}`)}:{}),W={index:V,label:y?.[V-1]??null,viewId:f.length>1?b.unique(`Page_${V}`):null,box:{kind:q.kind,pdf:q.pdfBox,canvas:G.canvasBox},rotate:q.rotate,userUnit:q.userUnit,groupId:H.attrs.id??null},B=!1,ie=!1;try{n.annotations==="skip"&&await x6(U,V,i);let Y=await U.getOperatorList({intent:"display",annotationMode:n.annotations==="appearance"?s.AnnotationMode.ENABLE:s.AnnotationMode.DISABLE});await bG(U,Y,s.OPS.dependency),Ho(n.signal),a("page-transcode",.1+.8*(_+.5)/f.length,V,f.length);let X=Pt(q.viewportTransform,G.translation),Z=new d6(H),J=new l6(x,{page:U,pageNumber:V,pageBox:G.canvasBox,dropPageClip:g},Z,X);await J.run(Y),B=J.blendModeUsed,h6(H,x.clips),H.children.length===0&&i.add({code:"page-empty",message:"The page has no visible content.",page:V})}catch(Y){if(Y instanceof dm)throw Y;let X=Y instanceof Error?Y.message:String(Y);H.children.length=0,ie={reason:X},i.add({code:"page-skipped",message:`The page could not be interpreted and was left out: ${X}`,page:V})}k.push({page:{...W,skipped:ie},group:H,isolate:B}),U.cleanup()}a("images",.92,void 0,f.length),await Promise.all(x.imageJobs),Ho(n.signal),a("assemble",.97,void 0,f.length);let $=new Map;for(let[_,U]of x.layers)for(let V of U.svgIds)$.set(V,_);let{root:A,mergedLayerIds:S}=dG(k,I,{precision:n.precision,title:o.info.title,mergePages:o.info.isIllustrator&&h==="source",layerOf:_=>$.get(_)??null}),N=new Set,T=_=>{_.attrs.id&&N.add(_.attrs.id);for(let U of _.children)Ke(U)||T(U)};T(A);for(let[_,U]of x.layers){let V=U.svgIds.filter(q=>!S.has(q)&&N.has(q));U.svgIds.splice(0,U.svgIds.length,...V),V.length>1&&i.add({code:"layer-fragmented",message:"A layer painted in several separate ranges was imported as several groups.",detail:{layer:U.name??_,groups:V.length}})}let z=qo(A),C=S6(x,c),O=[...x.fonts.values()].map(_=>({loadedName:_.loadedName,name:_.name,type:_.type,subtype:_.subtype,embedded:_.embedded,isType3:_.isType3,vertical:_.vertical,mapping:_.mapping,glyphsShown:_.glyphsShown,outlined:_.outlinedGlyphs>0&&_.outlinedGlyphs>=_.glyphsShown,unmappableGlyphs:_.unmappableGlyphs})),E=x.atoms;return{svg:z,tree:A,pages:k.map(_=>_.page),layers:C,atoms:E,fonts:O,diagnostics:i.list(),info:o.info,stats:{...x.stats,bytes:z.length,durationMs:Date.now()-r}}}finally{await o.close().catch(()=>{})}}async function x6(e,t,r){let n=0;try{n=(await e.getAnnotations()).length}catch{n=0}n>0&&r.add({code:"annotations-skipped",message:'Annotations were left out; pass annotations: "appearance" to import their appearance streams.',page:t,detail:{count:n}})}function w6(e,t,r,n,i){for(let a of n.pagePlacements){let o=r.indexOf(a.page);if(o<0)continue;let s=t[o],[l,u,d,c]=a.canvas,f=d-l,p=c-u;(Math.abs(f-s.width)>.5||Math.abs(p-s.height)>.5)&&i.add({code:"page-placement-mismatch",message:"The requested placement rectangle differs in size from the page box; the page was aligned to the rectangle's top-left corner.",page:a.page,detail:{requested:`${f}x${p}`,page:`${s.width}x${s.height}`}}),e[o]={translation:[1,0,0,1,l,u],canvasBox:[l,u,l+s.width,u+s.height]}}}function I6(e){if(e.length===0)return;let t=1/0,r=1/0;for(let n of e)t=Math.min(t,n.canvasBox[0]),r=Math.min(r,n.canvasBox[1]);if(!(t===0&&r===0))for(let n=0;n<e.length;n++){let i=e[n];e[n]={translation:[1,0,0,1,i.translation[4]-t,i.translation[5]-r],canvasBox:[i.canvasBox[0]-t,i.canvasBox[1]-r,i.canvasBox[2]-t,i.canvasBox[3]-r]}}}function k6(e){let t=e.map(n=>[n.pdfBox[0],-n.pdfBox[3],n.pdfBox[2],-n.pdfBox[1]]);for(let n=0;n<t.length;n++)for(let i=n+1;i<t.length;i++){let a=t[n],o=t[i];if(a[0]<o[2]&&o[0]<a[2]&&a[1]<o[3]&&o[1]<a[3])return!1}let r=t.reduce((n,i)=>Oa(n,i),null);return t.length>1&&r!==null}function S6(e,t){let r=t?.getOrder(),n=new Set,i=s=>{n.add(s);let l=e.layers.get(s),u=t?.getGroup(s)??null;return{id:s,name:l?.name??u?.name??null,svgIds:l?.svgIds??[],visible:l?.visible??u?.visible??!0,children:[]}},a=s=>{if(Array.isArray(s))return s.flatMap(l=>a(l));if(typeof s=="string")return[i(s)];if(s&&typeof s=="object"&&"order"in s){let l=s;return[{id:`label:${l.name??""}`,name:l.name??null,svgIds:[],visible:!0,children:a(l.order)}]}return[]},o=r?a(r):[];for(let s of e.layers.keys())n.has(s)||o.push(i(s));return o}function gi(e,t=0,r=e.length){if(r<=t)return"";if(r-t<=32768)return String.fromCharCode.apply(null,Array.from(e.subarray(t,r)));let n=[];for(let i=t;i<r;i+=32768){let a=Math.min(i+32768,r);n.push(String.fromCharCode.apply(null,Array.from(e.subarray(i,a))))}return n.join("")}function dS(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)&255;return t}function Ft(e){return dS(e)}function Mr(e,t,r=0,n=e.length){let i=t.length;if(i===0)return r;let a=t[0],o=Math.min(n,e.length)-i;e:for(let s=Math.max(0,r);s<=o;s++)if(e[s]===a){for(let l=1;l<i;l++)if(e[s+l]!==t[l])continue e;return s}return-1}function $6(e,t,r=e.length){let n=t.length;if(n===0)return-1;let i=t[0];e:for(let a=Math.min(r,e.length-n);a>=0;a--)if(e[a]===i){for(let o=1;o<n;o++)if(e[a+o]!==t[o])continue e;return a}return-1}function Ko(e,t,r=0){if(r+t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(e[r+n]!==t[n])return!1;return!0}function N6(e){let t=0;for(let i of e)t+=i.length;let r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function Gr(e){return e===32||e===10||e===13||e===9||e===12||e===0}function M6(e){return e===40||e===41||e===60||e===62||e===91||e===93||e===123||e===125||e===47||e===37}function _k(e){return!Gr(e)&&!M6(e)}function xc(e){return e>=48&&e<=57}function A6(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:-1}function cS(e){let t=new Uint8Array(Math.ceil(e.length/2)),r=0,n=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a===62)break;let o=A6(a);o<0||(n<0?n=o:(t[r++]=n<<4|o,n=-1))}return n>=0&&(t[r++]=n<<4),t.subarray(0,r)}function Tm(e){let t=new Uint8Array(Math.ceil(e.length*4/5)+4),r=0,n=0,i=0,a=0;for(e.length>=2&&e[0]===60&&e[1]===126&&(a=2);a<e.length;a++){let o=e[a];if(o===126)break;if(!Gr(o)){if(o===122&&i===0){t[r++]=0,t[r++]=0,t[r++]=0,t[r++]=0;continue}o<33||o>117||(n=n*85+(o-33),i++,i===5&&(t[r++]=n>>>24&255,t[r++]=n>>>16&255,t[r++]=n>>>8&255,t[r++]=n&255,n=0,i=0))}}if(i>0){for(let s=i;s<5;s++)n=n*85+84;let o=[n>>>24&255,n>>>16&255,n>>>8&255,n&255];for(let s=0;s<i-1;s++)t[r++]=o[s]}return t.subarray(0,r)}function fm(e,t,r){let n=0;for(let i=0;i<r;i++)n=n*256+e[t+i];return n}function Rk(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}var Ui=class{items=[];index=new Map;add(e){let t=`${e.code}|${e.name??""}|${e.construct??""}|${e.elementId??""}|${e.message}`,r=this.index.get(t);if(r===void 0){this.index.set(t,this.items.length),this.items.push({...e,count:e.count??1});return}let n=this.items[r];this.items[r]={...n,count:(n.count??1)+(e.count??1)}}info(e,t,r={}){this.add({code:e,severity:"info",message:t,...r})}warning(e,t,r={}){this.add({code:e,severity:"warning",message:t,...r})}error(e,t,r={}){this.add({code:e,severity:"error",message:t,...r})}addAll(e){for(let t of e)this.add(t)}has(e){return this.items.some(t=>t.code===e)}list(){return this.items.slice()}},Rt=class extends Error{constructor(e,t){super(t),this.code=e,this.name="IllustratorContainerError"}code},Dt={maxInputBytes:268435456,maxStreamBytes:67108864,maxPrivateSourceBytes:268435456,bombCheckBytes:67108864,bombRatio:200,maxXrefEntries:1e7,maxXrefChain:64,maxPageTreeDepth:64,maxPages:1e4,maxPlaceholderProbeBytes:2097152,maxTokens:5e7,maxNesting:512,maxNodes:5e6,maxTextDocumentBytes:67108864},fS=class{constructor(e){this.name=e}name},pS=class{constructor(e){this.bytes=e}bytes},Sc=class{constructor(e,t){this.num=e,this.gen=t}num;gen;key(){return`${this.num}R${this.gen}`}},hS=class{constructor(e,t){this.dict=e,this.raw=t}dict;raw};function Tn(e){return e instanceof Map}function Wn(e,t){return e instanceof fS&&(t===void 0||e.name===t)}function cc(e){return e instanceof Sc}function mi(e){return e instanceof hS}function Xr(e){return typeof e=="number"&&Number.isFinite(e)}function Da(e){return Array.isArray(e)}function mS(e){return e instanceof pS}function gS(e){let t=e.bytes;if(t.length>=2&&t[0]===254&&t[1]===255){let n="";for(let i=2;i+1<t.length;i+=2)n+=String.fromCharCode(t[i]<<8|t[i+1]);return n}let r="";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r}function C6(e,t){let r=t(e.get("Filter")??e.get("F")),n=t(e.get("DecodeParms")??e.get("DP")),i=[];if(Wn(r))i.push(r.name);else if(Da(r))for(let o of r){let s=t(o);Wn(s)&&i.push(s.name)}let a=[];if(Tn(n))a.push(n);else if(Da(n))for(let o of n){let s=t(o);a.push(Tn(s)?s:null)}return i.map((o,s)=>({name:o,parms:a[s]??(i.length===1?a[0]??null:null)}))}function O6(e,t=Dt.maxStreamBytes){let r=[()=>Yh(e),()=>qh(e),()=>Yh(T6(e)),()=>qh(e.subarray(1))],n=null;for(let i of r)try{let a=i();if(a.length>t)throw new Rt("container-limit",`Decoded stream exceeds ${t} bytes.`);return a}catch(a){if(a instanceof Rt)throw a;n=a}throw new Rt("private-source-corrupt",`FlateDecode failed: ${n instanceof Error?n.message:String(n)}`)}function T6(e){let t=0;for(;t<e.length&&(e[t]===10||e[t]===13||e[t]===32||e[t]===9);)t++;return e.subarray(t)}function P6(e,t,r){if(!t)return e;let n=fc(r(t.get("Predictor")),1);if(n<=1)return e;let i=fc(r(t.get("Colors")),1),a=fc(r(t.get("BitsPerComponent")),8),o=fc(r(t.get("Columns")),1),s=Math.max(1,Math.ceil(i*a/8)),l=Math.ceil(i*a*o/8);if(n===2){if(a!==8)throw new Rt("container-unsupported-filter",`TIFF predictor with ${a} bits per component is not supported.`);let f=new Uint8Array(e),p=Math.floor(f.length/l);for(let h=0;h<p;h++){let m=h*l;for(let g=s;g<l;g++)f[m+g]=f[m+g]+f[m+g-s]&255}return f}let u=Math.floor(e.length/(l+1)),d=new Uint8Array(u*l),c=new Uint8Array(l);for(let f=0;f<u;f++){let p=f*(l+1),h=e[p],m=f*l;for(let g=0;g<l;g++){let v=e[p+1+g],y=g>=s?d[m+g-s]:0,b=c[g],I=g>=s?c[g-s]:0,x;switch(h){case 0:x=v;break;case 1:x=v+y;break;case 2:x=v+b;break;case 3:x=v+(y+b>>1);break;case 4:{let k=y+b-I,$=Math.abs(k-y),A=Math.abs(k-b),S=Math.abs(k-I);x=v+($<=A&&$<=S?y:A<=S?b:I);break}default:x=v}d[m+g]=x&255}c.set(d.subarray(m,m+l))}return d}function fc(e,t){return Xr(e)?e:t}function yS(e,t,r,n=Dt.maxStreamBytes){let i=e;for(let a of C6(t,r)){switch(a.name){case"FlateDecode":case"Fl":i=P6(O6(i,n),a.parms,r);break;case"ASCIIHexDecode":case"AHx":i=cS(i);break;case"ASCII85Decode":case"A85":i=Tm(i);break;case"Crypt":break;default:throw new Rt("container-unsupported-filter",`Stream filter /${a.name} is not supported.`)}if(i.length>n)throw new Rt("container-limit",`Decoded stream exceeds ${n} bytes.`)}return i}var es=class{constructor(e,t=0,r=e.length){this.bytes=e,this.end=r,this.pos=t}bytes;end;pos;skipWhitespaceAndComments(){let e=this.bytes;for(;this.pos<this.end;){let t=e[this.pos];if(Gr(t))this.pos++;else if(t===37)for(;this.pos<this.end&&e[this.pos]!==10&&e[this.pos]!==13;)this.pos++;else break}}next(){this.skipWhitespaceAndComments();let e=this.bytes,t=this.pos;if(t>=this.end)return{kind:"eof",start:t,end:t};let r=e[t];if(xc(r)||r===43||r===45||r===46){let i=t+1;for(;i<this.end&&(xc(e[i])||e[i]===46||e[i]===45||e[i]===43||e[i]===69||e[i]===101);)i++;let a=gi(e,t,i),o=D6(a);return this.pos=i,o!==null?{kind:"number",value:o,start:t,end:i}:{kind:"keyword",value:a,start:t,end:i}}if(r===47){let i=t+1,a="";for(;i<this.end&&_k(e[i]);){if(e[i]===35&&i+2<this.end){let o=parseInt(gi(e,i+1,i+3),16);if(!Number.isNaN(o)){a+=String.fromCharCode(o),i+=3;continue}}a+=String.fromCharCode(e[i]),i++}return this.pos=i,{kind:"name",value:a,start:t,end:i}}if(r===40)return this.literalString(t);if(r===60)return e[t+1]===60?(this.pos=t+2,{kind:"delimiter",value:"<<",start:t,end:this.pos}):this.hexString(t);if(r===62)return e[t+1]===62?(this.pos=t+2,{kind:"delimiter",value:">>",start:t,end:this.pos}):(this.pos=t+1,this.next());if(r===91||r===93||r===123||r===125)return this.pos=t+1,{kind:"delimiter",value:String.fromCharCode(r),start:t,end:this.pos};if(r===41)return this.pos=t+1,this.next();let n=t;for(;n<this.end&&_k(e[n]);)n++;return n===t&&(n=t+1),this.pos=n,{kind:"keyword",value:gi(e,t,n),start:t,end:n}}literalString(e){let t=this.bytes,r=[],n=0,i=e;for(;i<this.end;){let a=t[i];if(a===92){let o=t[i+1];switch(i+=2,o){case 110:r.push(10);break;case 114:r.push(13);break;case 116:r.push(9);break;case 98:r.push(8);break;case 102:r.push(12);break;case 10:break;case 13:t[i]===10&&i++;break;default:if(o>=48&&o<=55){let s=o-48;for(let l=0;l<2&&t[i]>=48&&t[i]<=55;l++)s=s*8+(t[i]-48),i++;r.push(s&255)}else o!==void 0&&r.push(o)}continue}if(a===40){n++,n>1&&r.push(a),i++;continue}if(a===41){if(n--,i++,n===0)break;r.push(a);continue}r.push(a),i++}return this.pos=i,{kind:"string",value:Uint8Array.from(r),start:e,end:i}}hexString(e){let t=this.bytes,r=[],n=-1,i=e+1;for(;i<this.end&&t[i]!==62;){let a=t[i++],o=-1;a>=48&&a<=57?o=a-48:a>=65&&a<=70?o=a-65+10:a>=97&&a<=102&&(o=a-97+10),!(o<0)&&(n<0?n=o:(r.push(n<<4|o),n=-1))}return n>=0&&r.push(n<<4),this.pos=Math.min(i+1,this.end),{kind:"string",value:Uint8Array.from(r),start:e,end:this.pos}}};function D6(e){if(!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(e)){let r=/^[+-]?\d*\.?\d*/.exec(e);if(!r||r[0]===""||r[0]==="-"||r[0]==="+"||r[0]===".")return null;let n=Number(r[0]);return Number.isFinite(n)?n:null}let t=Number(e);return Number.isFinite(t)?t:null}function ja(e,t,r,n=e.length){let i=new es(e,t,n);return{value:vS(i,r,0),end:i.pos}}var j6=256;function vS(e,t,r){let n=e.next();return km(e,n,t,r)}function km(e,t,r,n){if(n>j6)return null;switch(t.kind){case"eof":return null;case"number":{let i=e.pos;if(Number.isInteger(t.value)&&t.value>=0){let a=e.next();if(a.kind==="number"&&Number.isInteger(a.value)&&a.value>=0){let o=e.next();if(o.kind==="keyword"&&o.value==="R")return new Sc(t.value,a.value)}}return e.pos=i,t.value}case"name":return new fS(t.value);case"string":return new pS(t.value);case"keyword":return t.value==="true"?!0:t.value==="false"?!1:(t.value,null);case"delimiter":switch(t.value){case"[":{let i=[];for(;;){let a=e.next();if(a.kind==="eof"||a.kind==="delimiter"&&a.value==="]")break;if(!(a.kind==="delimiter"&&(a.value===">>"||a.value==="}"))){if(a.kind==="keyword"&&(a.value==="endobj"||a.value==="stream"||a.value==="endstream")){e.pos=a.start;break}i.push(km(e,a,r,n+1))}}return i}case"<<":{let i=new Map;for(;;){let a=e.next();if(a.kind==="eof"||a.kind==="delimiter"&&a.value===">>")break;if(a.kind==="keyword"&&(a.value==="endobj"||a.value==="stream")){e.pos=a.start;break}if(a.kind!=="name"){km(e,a,r,n+1);continue}let o=vS(e,r,n+1);i.set(a.value,o)}return z6(e,i,r)}case"{":{let i=1;for(;i>0;){let a=e.next();if(a.kind==="eof")break;a.kind==="delimiter"&&a.value==="{"?i++:a.kind==="delimiter"&&a.value==="}"&&i--}return null}default:return null}}}var E6=6;function z6(e,t,r){let n=e.pos,i=e.next();if(i.kind!=="keyword"||i.value!=="stream")return e.pos=n,t;let a=e.bytes,o=i.start+E6;a[o]===13&&o++,a[o]===10&&o++;let s=t.get("Length"),l;typeof s=="number"&&s>=0?l=s:s!=null&&r&&(l=r(s));let u=-1;if(l!==void 0&&o+l<=e.end){let d=new es(a,o+l,e.end).next();d.kind==="keyword"&&d.value==="endstream"&&(u=o+l,e.pos=d.end)}if(u<0){let d=_6(a,o,e.end);d<0?(u=e.end,e.pos=e.end):(u=d,a[u-1]===10&&u--,a[u-1]===13&&u--,e.pos=d+9)}return new hS(t,a.subarray(o,u))}var pm=[101,110,100,115,116,114,101,97,109];function _6(e,t,r){e:for(let n=t;n<=r-pm.length;n++)if(e[n]===101){for(let i=1;i<pm.length;i++)if(e[n+i]!==pm[i])continue e;return n}return-1}function Sm(e,t,r=e.length){let n=new es(e,t,r),i=n.next();if(i.kind!=="number"||!Number.isInteger(i.value))return null;let a=n.next();if(a.kind!=="number"||!Number.isInteger(a.value))return null;let o=n.next();return o.kind!=="keyword"||o.value!=="obj"?null:{num:i.value,gen:a.value,bodyStart:n.pos}}function R6(e,t,r){let n=r(t.get("N")),i=r(t.get("First")),a=new Map;if(!Xr(n)||!Xr(i))return{offsets:a,body:e};let o=new es(e,0,Math.min(e.length,i));for(let s=0;s<n;s++){let l=o.next(),u=o.next();if(l.kind!=="number"||u.kind!=="number")break;let d=i+u.value;d<0||d>=e.length||a.set(l.value,d)}return{offsets:a,body:e}}function F6(e,t){let r=e.offsets.get(t);if(r!==void 0)return ja(e.body,r).value}var hm=Ft("obj"),mm=Ft("trailer");function L6(e){let t=new Map,r=[],n=e.length;for(let o=0;o+3<=n;o++){if(e[o]!==hm[0]||e[o+1]!==hm[1]||e[o+2]!==hm[2])continue;let s=e[o+3];if(s!==void 0&&!Gr(s)&&s!==60&&s!==91&&s!==47&&s!==40&&s!==37)continue;let l=o-1;for(;l>=0&&Gr(e[l]);)l--;let u=l+1;for(;l>=0&&xc(e[l]);)l--;let d=l+1;if(d===u||l<0||!Gr(e[l]))continue;for(;l>=0&&Gr(e[l]);)l--;let c=l+1;for(;l>=0&&xc(e[l]);)l--;let f=l+1;if(f===c||l>=0&&!Gr(e[l])&&e[l]!==62&&e[l]!==93&&e[l]!==41)continue;let p=parseInt(Fk(e,f,c),10),h=parseInt(Fk(e,d,u),10);!Number.isFinite(p)||!Number.isFinite(h)||(t.set(p,{kind:"offset",offset:f,gen:h}),o+=2)}for(let[o,s]of t){if(s.kind!=="offset")continue;let l=Lk(e,s.offset);l<0||V6(e,l)&&r.push(o)}let i=new Map,a=0;for(;;){let o=bS(e,mm,a);if(o<0)break;let s=ja(e,o+mm.length);if(Tn(s.value))for(let[l,u]of s.value)i.set(l,u);a=o+mm.length}if(!i.has("Root"))for(let[o,s]of t){if(s.kind!=="offset")continue;let l=Lk(e,s.offset);if(l<0)continue;let u=ja(e,l,void 0,Math.min(e.length,l+4096)).value,d=Tn(u)?u:null;if(d&&Wn(d.get("Type"),"Catalog")){i.set("Root",new Sc(o,s.gen));break}if(d&&Wn(d.get("Type"),"XRef")&&!i.has("Root"))for(let[c,f]of d)(c==="Root"||c==="Info"||c==="Encrypt"||c==="ID")&&i.set(c,f)}return{entries:t,trailer:i,objectStreams:r}}function Fk(e,t,r){let n="";for(let i=t;i<r;i++)n+=String.fromCharCode(e[i]);return n}function Lk(e,t){let r=t,n=()=>{for(;r<e.length&&Gr(e[r]);)r++;let i=r;for(;r<e.length&&!Gr(e[r]);)r++;return r>i};return!n()||!n()||!n()?-1:r}var B6=Ft("/ObjStm");function V6(e,t){let r=Math.min(e.length,t+512);return bS(e,B6,t,r)>=0}function bS(e,t,r,n=e.length){e:for(let i=r;i<=n-t.length;i++){for(let a=0;a<t.length;a++)if(e[i+a]!==t[a])continue e;return i}return-1}var Bk=Ft("startxref"),U6=64*1024;function G6(e,t){let r=X6(e);if(r===null)return null;let n=new Map,i=new Map,a=new Set,o=[r],s=0;for(;o.length>0&&s<Dt.maxXrefChain;){let l=o.shift();if(!Number.isInteger(l)||l<0||l>=e.length||a.has(l))continue;a.add(l);let u=W6(e,l);if(!u){if(s===0)return null;t.info("container-xref-reconstructed",`Cross-reference section at byte ${l} is unreadable; earlier sections were kept.`);continue}s++;for(let[f,p]of u.entries)if(n.has(f)||n.set(f,p),n.size>Dt.maxXrefEntries)return null;for(let[f,p]of u.trailer)i.has(f)||i.set(f,p);let d=u.trailer.get("XRefStm");Xr(d)&&o.unshift(d);let c=u.trailer.get("Prev");Xr(c)&&o.push(c)}return s===0?null:{entries:n,trailer:i,sections:s}}function X6(e){let t=Math.max(0,e.length-U6),r=$6(e,Bk,e.length);if(r<t||r<0)return null;let n=new es(e,r+Bk.length).next();return n.kind==="number"&&Number.isInteger(n.value)?n.value:null}function W6(e,t){let r=t;for(;r<e.length&&Gr(e[r]);)r++;let n=new es(e,r),i=n.next();return i.kind==="keyword"&&i.value==="xref"?H6(e,n):i.kind==="number"?q6(e,r):null}function H6(e,t){let r=new Map;for(;;){let n=t.pos,i=t.next();if(i.kind==="keyword"&&i.value==="trailer"){let l=ja(e,t.pos);return{entries:r,trailer:Tn(l.value)?l.value:new Map}}if(i.kind!=="number")return t.pos=n,{entries:r,trailer:new Map};let a=t.next();if(a.kind!=="number")return{entries:r,trailer:new Map};let o=i.value,s=a.value;if(!Number.isInteger(o)||!Number.isInteger(s)||s<0)return null;for(let l=0;l<s;l++){let u=t.next(),d=t.next(),c=t.next();if(u.kind!=="number"||d.kind!=="number"||c.kind!=="keyword")return{entries:r,trailer:new Map};let f=o+l;if(c.value==="n")r.has(f)||r.set(f,{kind:"offset",offset:u.value,gen:d.value});else if(c.value==="f")r.has(f)||r.set(f,{kind:"free"});else return{entries:r,trailer:new Map};if(r.size>Dt.maxXrefEntries)return null}}}function q6(e,t){let r=Sm(e,t);if(!r)return null;let n=ja(e,r.bodyStart).value;if(!mi(n)||!Wn(n.dict.get("Type"),"XRef"))return null;let i=g=>g,a;try{a=yS(n.raw,n.dict,i)}catch{return null}let o=n.dict.get("W");if(!Da(o)||o.length<3||!o.every(g=>Xr(g)&&g>=0))return null;let[s,l,u]=o,d=n.dict.get("Size"),c=n.dict.get("Index"),f=[];Da(c)&&c.every(g=>Xr(g))?f.push(...c):f.push(0,Xr(d)?d:0);let p=s+l+u;if(p===0)return null;let h=new Map,m=0;for(let g=0;g+1<f.length;g+=2){let v=f[g],y=f[g+1];for(let b=0;b<y&&!(m+p>a.length);b++){let I=s===0?1:fm(a,m,s),x=fm(a,m+s,l),k=u===0?0:fm(a,m+s+l,u);m+=p;let $=v+b;if(!h.has($)&&(I===1?h.set($,{kind:"offset",offset:x,gen:k}):I===2?h.set($,{kind:"compressed",streamNum:x,index:k}):I===0&&h.set($,{kind:"free"}),h.size>Dt.maxXrefEntries))return null}}return{entries:h,trailer:n.dict}}var Y6=32,Pm=class{constructor(e){if(this.bytes=e,e.length>Dt.maxInputBytes)throw new Rt("container-limit",`Input exceeds ${Dt.maxInputBytes} bytes.`);let t=G6(e,this.diagnostics);t&&t.trailer.has("Root")?(this.entries=t.entries,this.trailerDict=t.trailer,this.reconstructed=!1):(this.reconstruct("The cross-reference table is missing or unreadable."),this.reconstructed=!0),this.encrypted=this.trailerDict.has("Encrypt")}bytes;diagnostics=new Ui;encrypted;reconstructed;entries=new Map;trailerDict=new Map;cache=new Map;objectStreams=new Map;didReconstruct=!1;resolving=new Set;get trailer(){return this.trailerDict}reconstruct(e){if(this.didReconstruct)return;this.didReconstruct=!0;let t=L6(this.bytes),r=new Map(t.entries);for(let i of t.objectStreams){let a=this.objectStreamIndex(i,r);if(a)for(let o of a.offsets.keys())r.has(o)||r.set(o,{kind:"compressed",streamNum:i,index:0})}this.entries=r;let n=new Map(t.trailer);if(this.trailerDict)for(let[i,a]of this.trailerDict)n.has(i)||n.set(i,a);this.trailerDict=n,this.cache.clear(),this.diagnostics.info("container-xref-reconstructed",`Cross-reference data was rebuilt by scanning the file: ${e}`)}fetch(e,t=0){let r=this.cache.get(e);if(r!==void 0)return r;if(this.resolving.has(e))return null;this.resolving.add(e);try{let n=this.fetchUncached(e,t);n===void 0&&!this.didReconstruct&&(this.reconstruct(`object ${e} was not where the cross-reference table said.`),n=this.fetchUncached(e,t));let i=n===void 0?null:n;return this.cache.set(e,i),i}finally{this.resolving.delete(e)}}fetchUncached(e,t){let r=this.entries.get(e);if(!r||r.kind==="free")return;if(r.kind==="compressed"){let i=this.objectStreamIndex(r.streamNum,this.entries);return i?F6(i,e):void 0}let n=Sm(this.bytes,r.offset);return!n||n.num!==e?void 0:(n.gen!==t&&t!==0&&n.gen!==0&&this.diagnostics.info("container-xref-reconstructed",`Object ${e} has generation ${n.gen}, expected ${t}.`),ja(this.bytes,n.bodyStart,i=>{let a=this.resolve(i);return Xr(a)?a:void 0}).value)}objectStreamIndex(e,t){let r=this.objectStreams.get(e);if(r!==void 0)return r;this.objectStreams.set(e,null);let n=t.get(e);if(!n||n.kind!=="offset")return null;let i=Sm(this.bytes,n.offset);if(!i)return null;let a=ja(this.bytes,i.bodyStart,l=>{let u=this.resolve(l);return Xr(u)?u:void 0});if(!mi(a.value)||!Wn(a.value.dict.get("Type"),"ObjStm"))return null;let o;try{o=this.decodeStream(a.value)}catch{return null}let s=R6(o,a.value.dict,l=>this.resolve(l));return this.objectStreams.set(e,s),s}resolve(e){let t=e;for(let r=0;r<Y6&&cc(t);r++)t=this.fetch(t.num,t.gen);return cc(t)?null:t}get(e,t){if(e)return this.resolve(e.get(t))}getDict(e,t){let r=this.get(e,t);return Tn(r)?r:mi(r)?r.dict:null}catalog(){let e=this.resolve(this.trailerDict.get("Root"));if(Tn(e))return e;if(!this.didReconstruct){this.reconstruct("the trailer has no usable /Root.");let t=this.resolve(this.trailerDict.get("Root"));if(Tn(t))return t}return null}decodeStream(e,t=Dt.maxStreamBytes){return yS(e.raw,e.dict,r=>this.resolve(r),t)}pages(){let e=this.catalog(),t=[],r=e?.get("Pages"),n=this.resolve(r);if(!Tn(n))return this.pagesByScan();let i=new Set,a=(o,s,l,u)=>{if(u>Dt.maxPageTreeDepth||t.length>=Dt.maxPages)return;if(s){let p=s.key();if(i.has(p))return;i.add(p)}let d={resources:this.getDict(o,"Resources")??l.resources,mediaBox:this.numberArray(o.get("MediaBox"))??l.mediaBox,cropBox:this.numberArray(o.get("CropBox"))??l.cropBox,rotate:(()=>{let p=this.get(o,"Rotate");return Xr(p)?p:l.rotate})()},c=this.get(o,"Kids"),f=this.get(o,"Type");if(Da(c)&&!Wn(f,"Page")){for(let p of c){let h=cc(p)?p:null,m=this.resolve(p);Tn(m)&&a(m,h,d,u+1)}return}(Wn(f,"Page")||o.has("Contents")||o.has("MediaBox"))&&t.push({index:t.length,ref:s,dict:o,resources:d.resources,mediaBox:d.mediaBox,cropBox:d.cropBox,rotate:d.rotate})};return a(n,cc(r)?r:null,{resources:null,mediaBox:null,cropBox:null,rotate:0},0),t.length>0?t:this.pagesByScan()}pagesByScan(){this.didReconstruct||this.reconstruct("the page tree is unusable.");let e=[],t=[...this.entries.keys()].sort((r,n)=>r-n);for(let r of t){let n=this.fetch(r);if(!(!Tn(n)||!Wn(n.get("Type"),"Page"))&&(e.push({index:e.length,ref:new Sc(r,0),dict:n,resources:this.getDict(n,"Resources"),mediaBox:this.numberArray(n.get("MediaBox")),cropBox:this.numberArray(n.get("CropBox")),rotate:0}),e.length>=Dt.maxPages))break}return e}numberArray(e){let t=this.resolve(e);if(!Da(t))return null;let r=[];for(let n of t){let i=this.resolve(n);if(!Xr(i))return null;r.push(i)}return r}pageContent(e,t=Dt.maxPlaceholderProbeBytes){let r=this.get(e.dict,"Contents"),n=[];if(mi(r))n.push(r);else if(Da(r))for(let l of r){let u=this.resolve(l);mi(u)&&n.push(u)}let i=[],a=0;for(let l of n){let u=this.decodeStream(l,t);if(i.push(u,new Uint8Array([10])),a+=u.length+1,a>t)break}let o=new Uint8Array(Math.min(a,t)),s=0;for(let l of i){let u=Math.min(l.length,o.length-s);if(o.set(l.subarray(0,u),s),s+=u,s>=o.length)break}return o}objectNumbers(){return[...this.entries.keys()]}};function pc(e){if(e!=null){if(Xr(e))return String(e);if(mS(e))return gS(e)}}function xS(e,t){let r=[],n=(i,a)=>{let o=e.getDict(i,"PieceInfo"),s=e.getDict(o,"Illustrator"),l=e.getDict(s,"Private");if(!l)return;let u=e.get(l,"NumBlock"),d=Xr(u)?Math.max(0,Math.floor(u)):0,c=l.has("AIPDFPrivateData1")&&!l.has("AIPrivateData1")?"AIPDFPrivateData":"AIPrivateData";r.push({pageIndex:a,privateDict:l,numBlock:d,keyPrefix:c,hasMetaData:l.has("AIMetaData"),creatorVersion:pc(e.get(l,"CreatorVersion")),containerVersion:pc(e.get(l,"ContainerVersion")),roundtripVersion:pc(e.get(l,"RoundtripVersion")),roundtripStreamType:pc(e.get(l,"RoundtripStreamType"))})};for(let i of t)n(i.dict,i.index);if(r.length===0){let i=e.catalog();i&&n(i,-1)}return r}function K6(e,t){let r=e.get(t.privateDict,"AIMetaData"),n=mi(r)?e.decodeStream(r):null,i=[],a=0,o=t.numBlock>0?t.numBlock:Z6(t.privateDict,t.keyPrefix);for(let s=1;s<=o;s++){let l=`${t.keyPrefix}${s}`,u=e.get(t.privateDict,l);if(mi(u))i.push(e.decodeStream(u,Dt.maxPrivateSourceBytes));else{let d=e.get(t.privateDict,`${t.keyPrefix==="AIPrivateData"?"AIPDFPrivateData":"AIPrivateData"}${s}`);if(!mi(d))throw new Rt("private-source-corrupt",`Private data block ${s} of ${o} (/${l}) is missing.`);i.push(e.decodeStream(d,Dt.maxPrivateSourceBytes))}if(a+=i[i.length-1].length,a>Dt.maxPrivateSourceBytes)throw new Rt("private-source-limit",`Private data exceeds ${Dt.maxPrivateSourceBytes} bytes.`)}return{metadata:n,payload:N6(i),compressedBytes:a}}function Z6(e,t){let r=0;for(;e.has(`${t}${r+1}`);)r++;return r}function Vk(e){let t=gi(e),r="",n=0,i=t.length,a=[];for(;n<i;){let o=t[n];if(o==="("){let s=J6(t,n);a.push(s.value),n=s.end;continue}if(o==="<"&&t[n+1]!=="<"){let s=t.indexOf(">",n+1),l=t.slice(n+1,s<0?i:s).replace(/\s+/g,""),u="";for(let d=0;d+1<l.length;d+=2)u+=String.fromCharCode(parseInt(l.slice(d,d+2),16));a.push(u),n=s<0?i:s+1;continue}if(o==="%"){for(;n<i&&t[n]!==`
85
+ `&&t[n]!=="\r";)n++;continue}if(/[A-Za-z'"]/.test(o)){let s=n;for(;s<i&&/[A-Za-z'"*]/.test(t[s]);)s++;let l=t.slice(n,s);l==="Tj"||l==="TJ"||l==="'"||l==='"'?(r+=a.join(""),a=[]):l!=="T"&&l.length<=3&&(a=[]),n=s;continue}if(o==="]"||o==="["){n++;continue}n++}return r}function J6(e,t){let r=0,n="",i=t;for(;i<e.length;){let a=e[i];if(a==="\\"){let o=e[i+1];if(o>="0"&&o<="7"){let s=0,l=i+1;for(;l<i+4&&e[l]>="0"&&e[l]<="7";)s=s*8+(e.charCodeAt(l)-48),l++;n+=String.fromCharCode(s&255),i=l;continue}switch(o){case"n":n+=`
86
+ `;break;case"r":n+="\r";break;case"t":n+=" ";break;case`
87
+ `:case"\r":break;default:o!==void 0&&(n+=o)}i+=2;continue}if(a==="("){r++,r>1&&(n+=a),i++;continue}if(a===")"){if(r--,i++,r===0)break;n+=a;continue}n+=a,i++}return{value:n,end:i}}var Q6=/savedwithoutpdfcontent/i;function e4(e,t,r){let n=[Vk(r)],i=e.getDict(t.resources,"XObject");if(i){let a=0;for(let o of i.values()){let s=e.resolve(o);if(!(!mi(s)||!Wn(e.get(s.dict,"Subtype"),"Form"))){if(++a>16)break;try{n.push(Vk(e.decodeStream(s,2*1024*1024)))}catch{}}}}return n.some(a=>Q6.test(a.replace(/\s+/g,"")))}var $m=Ft("%AI24_ZStandard_Data"),Nm=Ft("%AI12_CompressedData"),hc=Ft("%!PS-Adobe"),mc=[40,181,47,253],t4=8;function r4(e,t={}){let r=new Pm(e);if(r.encrypted)throw new Rt("container-encrypted","The PDF container is encrypted; the private Illustrator source cannot be read.");let n=r.pages(),i=xS(r,n);if(i.length===0)throw new Rt("private-source-missing","The PDF carries no Illustrator private data (/PieceInfo /Illustrator /Private).");let a=n4(i,t.page),o=K6(r,a),s=new Ui;for(let u of r.diagnostics.list())s.add(u);let l=wS(o.payload,o.metadata,t.maxOutputBytes??Dt.maxPrivateSourceBytes);return{metadataHeader:o.metadata?gi(o.metadata):"",source:gi(l.bytes),sourceBytes:l.bytes,compression:l.compression,blockCount:a.numBlock,compressedBytes:o.compressedBytes,page:a.pageIndex,containerVersion:a.containerVersion,creatorVersion:a.creatorVersion,roundtripVersion:a.roundtripVersion,roundtripStreamType:a.roundtripStreamType,diagnostics:s.list()}}function n4(e,t){if(t!==void 0){let r=e.find(n=>n.pageIndex===t);if(r)return r}return e.filter(r=>r.numBlock>0||r.privateDict.has(`${r.keyPrefix}1`))[0]??e[0]}function wS(e,t,r){let n=0;for(;n<e.length&&Gr(e[n]);)n++;let i="none",a;if(Ko(e,$m,n))i="zstd",a=Uk(e.subarray(gm(e,n+$m.length,"zstd")),r);else if(Ko(e,Nm,n))i="deflate",a=ym(e.subarray(gm(e,n+Nm.length,"deflate")),r);else if(o4(e,n))i="deflate",a=ym(e.subarray(n),r);else{a=e.subarray(n);let s=i4(a);if(s){i=s.kind;let l=gm(a,s.markerEnd,s.kind),u=s.kind==="zstd"?Uk(a.subarray(l),r):ym(a.subarray(l),r),d=new Uint8Array(s.markerStart+u.length);d.set(a.subarray(0,s.markerStart),0),d.set(u,s.markerStart),a=d}}let o=0;for(;o<a.length&&Gr(a[o]);)o++;if(Ko(a,hc,o))return{bytes:o===0?a:a.subarray(o),compression:i};if(t&&Ko(t,hc,a4(t))){let s=new Uint8Array(t.length+1+a.length);return s.set(t,0),s[t.length]=10,s.set(a,t.length+1),{bytes:s,compression:i}}if(Mr(a,hc,0,Math.min(a.length,4096))>=0)return{bytes:a.subarray(Mr(a,hc,0)),compression:i};throw new Rt("private-source-corrupt",`Decoded private data does not start with %!PS-Adobe (compression: ${i}, ${a.length} bytes).`)}function i4(e){for(let[t,r]of[["deflate",Nm],["zstd",$m]]){let n=0;for(;n<e.length;){let i=Mr(e,r,n);if(i<0)break;if(i===0||e[i-1]===10||e[i-1]===13)return{kind:t,markerStart:i,markerEnd:i+r.length};n=i+r.length}}return null}function a4(e){let t=0;for(;t<e.length&&Gr(e[t]);)t++;return t}function o4(e,t){if(t+1>=e.length)return!1;let r=e[t],n=e[t+1];return(r&15)===8&&r>>4<=7&&(r<<8|n)%31===0}function gm(e,t,r){let n=Math.min(e.length,t+t4);for(let i=t;i<n;i++)if(r==="zstd"){if(e[i]===mc[0]&&e[i+1]===mc[1]&&e[i+2]===mc[2]&&e[i+3]===mc[3])return i}else{let a=e[i],o=e[i+1];if((a&15)===8&&(a<<8|o)%31===0)return i}return t}var IS=class{constructor(e,t){this.inputBytes=e,this.maxOutputBytes=t}inputBytes;maxOutputBytes;chunks=[];total=0;push(e){if(e.length!==0){if(this.chunks.push(e),this.total+=e.length,this.total>this.maxOutputBytes)throw new Rt("private-source-limit",`Decompressed private data exceeds ${this.maxOutputBytes} bytes.`);if(this.total>Dt.bombCheckBytes&&this.total>this.inputBytes*Dt.bombRatio)throw new Rt("private-source-limit","Decompressed private data grows far beyond its compressed size; refusing to continue.")}}bytes(){if(this.chunks.length===1)return this.chunks[0];let e=new Uint8Array(this.total),t=0;for(let r of this.chunks)e.set(r,t),t+=r.length;return e}};function Uk(e,t){let r=new IS(e.length,t);try{new rk(n=>r.push(n)).push(e,!0)}catch(n){throw n instanceof Rt?n:new Rt("private-source-corrupt",`zstd decompression failed: ${kS(n)}`)}return r.bytes()}function ym(e,t){let r=[()=>Gk(new J1,e,t),()=>Gk(new gl,e,t)],n;for(let i of r)try{return i()}catch(a){if(a instanceof Rt&&a.code==="private-source-limit")throw a;n=a}throw new Rt("private-source-corrupt",`zlib decompression failed: ${kS(n)}`)}function Gk(e,t,r){let n=new IS(t.length,r);e.ondata=a=>n.push(a),e.push(t,!0);let i=n.bytes();if(i.length===0)throw new Error("empty output");return i}function kS(e){return e instanceof Error?e.message:String(e)}var s4=[197,208,211,198],l4=Ft("%AI9_PrivateDataBegin"),u4=Ft("%AI9_PrivateDataEnd"),d4=Ft("%AI9_DataStream");function SS(e){if(e.length<30)return null;for(let n=0;n<4;n++)if(e[n]!==s4[n])return null;let t=Rk(e,4),r=Rk(e,8);return t<=0||t>=e.length?null:{psOffset:t,psLength:Math.min(r,e.length-t)}}function $S(e){let t=SS(e);return t?e.subarray(t.psOffset,t.psOffset+t.psLength):e}function c4(e,t=Dt.maxPrivateSourceBytes){let r=Mr(e,l4);if(r<0)return null;let n=Mr(e,u4,r),i=Xk(e,r),a=n<0?e.length:n,o=null,s=Mr(e,d4,i,a);s>=0&&(o=e.subarray(i,s),i=Xk(e,s));let l=[],u=i;for(;u<a;){let p=u;for(;p<a&&e[p]!==10&&e[p]!==13;)p++;let h=u;e[h]===37&&h++;for(let m=h;m<p;m++)l.push(e[m]);for(u=p;u<a&&(e[u]===10||e[u]===13);)u++}let d=Uint8Array.from(l),c=[{encoding:"ascii85",decode:()=>Tm(d)},{encoding:"hex",decode:()=>cS(d)},{encoding:"raw",decode:()=>d}],f;for(let p of c)try{let h=p.decode();if(h.length===0)continue;return{...wS(h,o,t),encoding:p.encoding}}catch(h){f=h}throw new Rt("private-source-corrupt",`The %AI9_PrivateDataBegin block could not be decoded: ${f instanceof Error?f.message:String(f)}`)}function Xk(e,t){let r=t;for(;r<e.length&&e[r]!==10&&e[r]!==13;)r++;for(;r<e.length&&(e[r]===10||e[r]===13);)r++;return r}var f4=Ft("%!PS-Adobe"),Wk=Ft("%!PS");function p4(e){return Ko(e,f4)||Ko(e,Wk)?!0:Mr(e,Wk,0,Math.min(e.length,32))>=0}var Mm=Ft("%PDF-"),h4=Ft("/AIPrivateData"),m4=Ft("/AIPDFPrivateData"),g4=Ft("/AIMetaData"),y4=Ft("/Illustrator"),v4=Ft("Adobe Illustrator"),b4=Ft("%%Creator: Adobe Illustrator"),x4=Ft("%AI"),w4=Ft("EPSF-"),I4=1024;function k4(e){let t=new Ui;if(e.length<8)return Am(t);let r=SS(e),n=r?$S(e):e,i=Mr(n,Mm,0,Math.min(n.length,I4));return i>=0?S4(n,i,t):p4(n)?N4(n,r,t):Am(t)}function Am(e){return{kind:"not-illustrator",hasPrivateSource:!1,pdfCompatible:"unknown",encrypted:!1,diagnostics:e.list()}}function S4(e,t,r){let n=gi(e,t+Mm.length,Math.min(e.length,t+Mm.length+8)),i=/^(\d\.\d)/.exec(n),a=i?i[1]:void 0,o=Mr(e,h4)>=0||Mr(e,m4)>=0||Mr(e,g4)>=0,s=o||Mr(e,y4)>=0,l=Mr(e,v4)>=0,u;try{u=new Pm(e)}catch(b){if(b instanceof Rt)return r.error(b.code,b.message),{kind:s||l?"pdf-compatible":"pdf-foreign",hasPrivateSource:o,pdfCompatible:"unknown",pdfVersion:a,encrypted:!1,diagnostics:r.list()};throw b}for(let b of u.diagnostics.list())r.add(b);let d=u.getDict(u.trailer,"Info"),c=Hk(u.get(d,"Producer")),f=Hk(u.get(d,"Creator")),p=u.encrypted;p&&r.warning("container-encrypted","The PDF is encrypted; only its rendition can be read, not the Illustrator source.");let h=[];try{h=u.pages()}catch{h=[]}let m=p?[]:xS(u,h);if(!(m.length>0||s||l||(f?.includes("Adobe Illustrator")??!1)))return{kind:"pdf-foreign",hasPrivateSource:!1,pdfCompatible:"yes",pdfVersion:a,pdfPageCount:h.length,producer:c,creator:f,encrypted:p,diagnostics:r.list()};let g=m[0],v=m.some(b=>b.numBlock>0||b.privateDict.has(`${b.keyPrefix}1`)),y="yes";return v&&!p&&(y=$4(u,h)),{kind:y==="no"?"pdf-private-only":"pdf-compatible",hasPrivateSource:v,pdfCompatible:y,pdfVersion:a,pdfPageCount:h.length,creatorVersion:g?.creatorVersion,containerVersion:g?.containerVersion,producer:c,creator:f,pieceInfoPages:m.map(b=>b.pageIndex),privateDataKeyPrefix:g?.keyPrefix,encrypted:p,diagnostics:r.list()}}function $4(e,t){if(t.length!==1)return"yes";let r;try{r=e.pageContent(t[0],Dt.maxPlaceholderProbeBytes)}catch{return"unknown"}return e4(e,t[0],r)?"no":"yes"}function Hk(e){return mS(e)?gS(e):void 0}function N4(e,t,r){let n=Math.min(e.length,65536),i=Mr(e,b4,0,n)>=0,a=Mr(e,x4,0,n)>=0;if(!i&&!a)return Am(r);let o=(()=>{let u=0;for(;u<e.length&&e[u]!==10&&e[u]!==13;)u++;return u})(),s=Mr(e,w4,0,o)>=0,l=M4(e,n);return{kind:s?"postscript-eps":"postscript-legacy",hasPrivateSource:!0,pdfCompatible:"unknown",creatorVersion:l,creator:i?"Adobe Illustrator":void 0,dosEpsHeader:t??void 0,encrypted:!1,diagnostics:r.list()}}function M4(e,t){let r=gi(e,0,t),n=/%%AI8_CreatorVersion:\s*([^\r\n]+)/.exec(r)??/%%Creator: Adobe Illustrator\(R\)\s*([^\r\n]+)/.exec(r);return n?n[1].trim():void 0}function Tl(e,t,r=e.length){for(let n=t;n<r;n++){let i=e.charCodeAt(n);if(i===10||i===13)return n}return r}var A4=class{starts=[0];constructor(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);r===10?this.starts.push(t+1):r===13&&(e.charCodeAt(t+1)===10&&t++,this.starts.push(t+1))}}lineOf(e){let t=0,r=this.starts.length-1;for(;t<r;){let n=t+r+1>>1;this.starts[n]<=e?t=n:r=n-1}return t+1}};function Pl(e,t,r=e.length){return t>=r?r:e.charCodeAt(t)===13&&t+1<r&&e.charCodeAt(t+1)===10?t+2:t+1}function NS(e){let t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n!==92){t.push(n&255);continue}let i=e[r+1];if(i===void 0)break;switch(i){case"n":t.push(10),r++;break;case"r":t.push(13),r++;break;case"t":t.push(9),r++;break;case"b":t.push(8),r++;break;case"f":t.push(12),r++;break;case`
88
+ `:r++;break;case"\r":r++,e[r+1]===`
89
+ `&&r++;break;default:if(i>="0"&&i<="7"){let a=0,o=0;for(;o<3;){let s=e[r+1+o];if(s===void 0||s<"0"||s>"7")break;a=a*8+(s.charCodeAt(0)-48),o++}t.push(a&255),r+=o}else t.push(i.charCodeAt(0)&255),r++}}return Uint8Array.from(t)}function C4(e){let t="",r=0;for(;r<e.length;){let n=e[r];if(n<128){t+=String.fromCharCode(n),r++;continue}let i,a;if(n>=194&&n<=223)i=1,a=n&31;else if(n>=224&&n<=239)i=2,a=n&15;else if(n>=240&&n<=244)i=3,a=n&7;else return null;if(r+i>=e.length)return null;for(let o=1;o<=i;o++){let s=e[r+o];if(s===void 0||(s&192)!==128)return null;a=a<<6|s&63}if(i===2&&(a<2048||a>=55296&&a<=57343)||i===3&&(a<65536||a>1114111))return null;t+=String.fromCodePoint(a),r+=i+1}return t}function MS(e){let t="";for(let r=0;r+1<e.length;r+=2)t+=String.fromCharCode(e[r]<<8|e[r+1]);return t}function qk(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}function $c(e){let t=NS(e);if(t.length>=2&&t[0]===254&&t[1]===255)return MS(t.subarray(2));let r=!0;for(let n=0;n<t.length;n++)if(t[n]>=128){r=!1;break}return r?qk(t):C4(t)??qk(t)}function Dm(e,t){let r=0;for(let n=t;n<e.length;n++){let i=e[n];if(i==="\\"){n++;continue}if(i==="(")r++;else if(i===")"&&(r--,r===0))return n}return-1}var O4=/^%(%[A-Za-z0-9_]+|AI\d+_[A-Za-z0-9_]+)(?::\s?(.*))?$/;function vc(e,t){if(e===void 0)return null;let r=e.trim().split(/\s+/).map(Number);return r.length<t||r.slice(0,t).some(n=>!Number.isFinite(n))?null:r.slice(0,t)}function vm(e){let t=vc(e,4);return t?[t[0],t[1],t[2],t[3]]:null}function T4(e){switch(e?.trim()){case"1":return"cmyk";case"2":return"rgb";case"3":return"grayscale";default:return"unknown"}}function P4(e){if(e===void 0)return null;let t=e.trim();return t.startsWith("(")&&t.endsWith(")")?$c(t.slice(1,-1)):t||null}function D4(e,t=400){let r=new Map,n=0,i=0;for(;n<e.length&&i<t;){let l=Tl(e,n),u=e.slice(n,l);if(n=Pl(e,l),i++,u.length===0)continue;if(u[0]!=="%"){if(r.size>0)break;continue}let d=O4.exec(u);if(!d)continue;let c=d[1].startsWith("%")?d[1].slice(1):d[1];r.has(c)||r.set(c,d[2]??"")}let a=r.get("Creator")??"",o=/Adobe Illustrator(?:\(R\)|\(TM\))?\s*([0-9.]+)/.exec(a),s=vc(r.get("AI5_ArtSize"),2);return{formatVersion:o?o[1]:null,creatorVersion:r.get("AI8_CreatorVersion")?.trim()||null,title:P4(r.get("Title")),creationDate:r.get("CreationDate")?.trim()||null,boundingBox:vm(r.get("BoundingBox")),hiResBoundingBox:vm(r.get("HiResBoundingBox")),cropmarks:vm(r.get("AI3_Cropmarks")),artSize:s?[s[0],s[1]]:null,rulerUnits:vc(r.get("AI5_RulerUnits"),1)?.[0]??null,colorModel:T4(r.get("AI9_ColorModel")),numLayers:vc(r.get("AI5_NumLayers"),1)?.[0]??null,keys:r}}var j4=/^%%BeginData:\s*(\d+)(?:\s+(Hex|Binary|ASCII))?\s*(Bytes|Lines)?/i;function*AS(e,t=0){let r=t,n=0,i=e.length;for(;r<i;){let a=Tl(e,r),o=Pl(e,a),s=e.slice(r,a);yield{text:s,start:r,next:o,index:n},n++,r=o;let l=j4.exec(s);if(l&&l[3]?.toLowerCase()!=="lines"){let u=Number(l[1]);Number.isFinite(u)&&u>0&&(r=Math.min(i,r+u),r<i&&Tl(e,r,r+1)===r&&(r=Pl(e,r)))}}}function bm(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function Yk(e,t){let r=e.operands,n=r.length>=13,i=n?8:6,a=r.length>=i+3?`#${bm(r[i])}${bm(r[i+1])}${bm(r[i+2])}`:null;return{name:e.name,visible:(r[0]??1)!==0&&(!n||(r[6]??1)!==0),locked:(r[2]??1)===0,preview:(r[1]??1)!==0,printing:(r[3]??1)!==0,dimmed:(r[4]??0)!==0,template:n?(r[11]??0)!==0:(r[10]??0)!==0,color:a,operands:r,children:e.children,beginLine:e.beginLine,artStart:e.artStart,artEnd:t,depth:e.depth}}function E4(e){let t=[],r=[],n=0,i=!1,a=null;for(let o of AS(e)){let s=o.text;if(s==="%AI5_BeginLayer"){a={line:o.index};continue}if(a&&s.endsWith(" Lb")){let u=s.slice(0,-3).trim().split(/\s+/).map(Number).filter(d=>Number.isFinite(d));r.push({operands:u,name:"",children:[],beginLine:a.line,artStart:o.next,depth:r.length}),a=null,n++;continue}let l=r[r.length-1];if(l){if(s.endsWith(" Ln")&&s.startsWith("(")){let u=Dm(s,0);l.name=$c(s.slice(1,u<0?s.length-3:u)),l.artStart=o.next;continue}if(s==="LB"){r.pop();let u=Yk(l,o.start),d=r[r.length-1];d?d.children.push(u):t.push(u)}}}for(;r.length>0;){i=!0;let o=r.pop(),s=Yk(o,e.length),l=r[r.length-1];l?l.children.push(s):t.push(s)}return{layers:t,unbalanced:i,count:n}}var z4=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function _4(e){let t=[],r=0,n=e.length;for(;r<n;){let i=e[r];if(i===" "||i===" "||i===`
90
+ `||i==="\r"||i==="\f"){r++;continue}if(i==="("){let s=Dm(e,r),l=s<0?n:s,u=e.slice(r+1,l);t.push({kind:"string",text:$c(u),raw:u}),r=l+1;continue}if(i===":"){t.push({kind:"colon"}),r++;continue}if(i===","){t.push({kind:"comma"}),r++;continue}if(i===";"){t.push({kind:"semicolon"}),r++;continue}let a=r;for(;a<n;){let s=e[a];if(s===" "||s===" "||s===`
91
+ `||s==="\r"||s==="\f"||s==="("||s===")"||a>r&&(s===":"||s===","||s===";"||s==="/"))break;a++}if(a===r){r++;continue}let o=e.slice(r,a);r=a,o.startsWith("/")?t.push({kind:"name",name:o.slice(1)}):z4.test(o)?t.push({kind:"number",value:Number(o)}):t.push({kind:"word",text:o})}return t}function gc(e){let t=e.pending;if(e.pending=[],t.length===0)return;let r=t[t.length-1];if(r.kind==="string"||r.kind==="name"){let n=r.kind==="string"?r.text:r.name,i=t[t.length-2],a=i!==void 0&&i.kind==="name"&&t.length>=2,o=t.slice(0,a?t.length-2:t.length-1);e.entries.push({key:n,type:a?i.name:null,values:o});return}e.entries.push({key:null,type:null,values:t})}function R4(e){return F4(_4(e))}function F4(e){let t=[{type:null,entries:[],pending:[]}];for(let r of e){let n=t[t.length-1];switch(r.kind){case"colon":{let i=n.pending.pop(),a=i&&i.kind==="name"?i.name:null;i&&i.kind!=="name"&&n.pending.push(i),t.push({type:a,entries:[],pending:[]});break}case"comma":gc(n);break;case"semicolon":{if(t.length===1)break;gc(n),t.pop();let i={kind:"record",type:n.type,entries:n.entries};t[t.length-1].pending.push(i);break}default:n.pending.push(r)}}for(;t.length>1;){let r=t.pop();gc(r),t[t.length-1].pending.push({kind:"record",type:r.type,entries:r.entries})}return gc(t[0]),{kind:"record",type:null,entries:t[0].entries}}function pi(e,t){if(e.kind==="record"){for(let r of e.entries)if(r.key===t)return r;for(let r of e.entries)for(let n of r.values){let i=pi(n,t);if(i)return i}}}function Kk(e){let t=e?.values[0];return t&&t.kind==="string"?t.text:null}function Al(e){return(e?.values??[]).flatMap(t=>t.kind==="number"?[t.value]:[])}var L4="(ArtboardArray) ,";function B4(e){let t=[],r=-1;for(let n of AS(e)){if(!n.text.startsWith("%_")){if(r>=0)break;t.length=0;continue}t.push({text:n.text}),r<0&&n.text.endsWith(L4)&&(r=t.length-1)}return r<0?null:t.map(n=>n.text.slice(2)).join(`
92
+ `)}function V4(e,t){if(e.kind!=="record")return null;let r=Al(pi(e,"PositionPoint1")),n=Al(pi(e,"PositionPoint2"));if(r.length<2||n.length<2)return null;let i=Kk(pi(e,"Name"))??`Artboard ${t+1}`,a=Al(pi(e,"IsArtboardDefaultName")),o=Al(pi(e,"RulerOrigin"));return{index:t,name:i,defaultName:a.length>0?a[0]!==0:!1,rect:[Math.min(r[0],n[0]),Math.min(r[1],n[1]),Math.max(r[0],n[0]),Math.max(r[1],n[1])],uuid:Kk(pi(e,"ArtboardUUID")),rulerOrigin:o.length>=2?[o[0],o[1]]:null}}function jm(e){let t=B4(e);if(t===null)return null;let r=R4(t),n=[],i=pi(r,"ArtboardArray")?.values[0];if(i&&i.kind==="record")for(let o of i.entries)for(let s of o.values){let l=V4(s,n.length);l&&n.push(l)}let a=Al(pi(r,"AIDocumentCanvasSize"));return{record:r,artboards:n,canvasSize:a.length>0?a[0]:null}}function Zo(e){return e===0?0:e}function Cm(e){return[Zo(e[0]),Zo(-e[3]),Zo(e[2]),Zo(-e[1])]}function U4(e,t,r){let n=new Ui,i;try{if(t==="pdf-compatible"||t==="pdf-private-only"){let u=r4(e);n.addAll(u.diagnostics),i=u.source}else if(t==="postscript-legacy"||t==="postscript-eps"){let u=$S(e),d=c4(u);i=gi(d?d.bytes:u)}else return null}catch(u){if(u instanceof Rt)return n.add({code:u.code,severity:"warning",message:u.message}),null;throw u}let a=D4(i),o=E4(i);o.unbalanced&&n.add({code:"source-unbalanced-container",severity:"warning",message:"A layer block was not closed; its contents were attached to the enclosing layer."});let s=jm(i),l=[];if(s&&s.artboards.length>0)s.artboards.forEach((u,d)=>{let c=Cm(u.rect);l.push({index:d+1,name:u.name,defaultName:u.defaultName,canvas:c,width:c[2]-c[0],height:c[3]-c[1],origin:"artboard-record",page:d<r?d+1:null})});else if(a.cropmarks){let u=Cm(a.cropmarks);l.push({index:1,name:"Artboard 1",defaultName:!0,canvas:u,width:u[2]-u[0],height:u[3]-u[1],origin:"cropmarks",page:r>0?1:null})}return{source:i,header:a,layers:o.layers,layerCount:o.count,artboards:l,diagnostics:n.list()}}function CS(e){return{name:e.name,visible:e.visible,locked:e.locked,color:e.color,children:e.children.map(CS),origin:"source",svgIds:[]}}function G4(e){return new Pm(e).pages().map((t,r)=>{let n=t.cropBox??t.mediaBox??[0,0,612,792],i=[0,0,Zo(n[2]-n[0]),Zo(n[3]-n[1])];return{index:r+1,name:`Page ${r+1}`,defaultName:!0,canvas:i,width:i[2]-i[0],height:i[3]-i[1],origin:"page-box",page:r+1}})}function X4(e){let t=k4(e),r=new Ui;r.addAll(t.diagnostics);let n=t.pdfPageCount??0,i=t.kind,a=i==="not-illustrator"||i==="pdf-foreign"?null:U4(e,i,n);a&&r.addAll(a.diagnostics);let o=a?.artboards??[];if(o.length===0&&(i==="pdf-compatible"||i==="pdf-foreign")&&!t.encrypted)try{o=G4(e)}catch{o=[]}return o.length===0&&i!=="not-illustrator"&&r.add({code:"artboards-missing",severity:"warning",message:"No artboard rectangle was found; the artwork bounds are used."}),{inspection:{container:t,kind:i,title:a?.header.title??null,formatVersion:a?.header.formatVersion??null,creatorVersion:a?.header.creatorVersion??t.creatorVersion??null,colorModel:a?.header.colorModel??"unknown",pageCount:n,artboards:o,layers:(a?.layers??[]).map(CS),hasPrivateSource:a!==null,placeholderPage:i==="pdf-private-only",encrypted:t.encrypted,diagnostics:r.list()},parsed:a}}var W4={"password-required":"dropped","encrypted-opened":"preserved","no-pages":"dropped","page-skipped":"dropped","page-empty":"preserved","page-box-fallback":"approximated","page-rotated":"preserved","page-placement-mismatch":"approximated","user-unit-ignored":"approximated","page-clip-dropped":"preserved","layer-imported-hidden":"preserved","layer-skipped-hidden":"dropped","layer-fragmented":"preserved","ocmd-hidden":"approximated","marked-content-unbalanced":"approximated","annotations-skipped":"dropped","annotation-imported":"preserved","font-substituted":"approximated","type3-outlined":"approximated","text-outlined-unmappable":"approximated","text-outlined-render-mode":"approximated","text-outlined-vertical":"approximated","text-outlined-mirrored":"approximated","invisible-text-dropped":"dropped","text-clip-converted":"approximated","glyph-outline-missing":"dropped","cmyk-converted":"approximated","spot-color-flattened":"approximated","icc-profile-ignored":"approximated","blend-mode-unsupported":"approximated","knockout-group-ignored":"approximated","soft-mask-converted":"approximated","soft-mask-transfer-ignored":"approximated","transfer-function-ignored":"approximated","radial-gradient-rasterized":"rasterized","radial-gradient-approximated":"approximated","shading-unsupported":"dropped","shading-fill-unclipped":"approximated","mesh-rasterized":"rasterized","mesh-triangulated":"preserved","pattern-tile-overlap-clipped":"approximated","image-downsampled":"approximated","image-skipped":"dropped","image-decode-failed":"dropped","image-mask-tinted":"approximated","image-reused":"preserved","hairline-stroke-widened":"approximated","form-reused":"preserved","artwork-deduped":"preserved","xobject-depth-limited":"dropped","operator-ignored":"dropped","operator-unknown":"dropped"},H4={"container-not-illustrator":"dropped","container-encrypted":"dropped","container-xref-reconstructed":"preserved","container-unsupported-filter":"dropped","container-limit":"dropped","private-source-missing":"approximated","private-source-corrupt":"approximated","private-source-limit":"approximated","source-header-missing":"approximated","source-unbalanced-container":"approximated","source-operand-mismatch":"approximated","source-limit":"dropped","text-document-undecodable":"approximated","text-story-unbound":"approximated","text-position-unknown":"approximated","artboards-missing":"approximated","color-converted":"approximated","spot-color-converted":"approximated","font-required":"approximated","construct-approximated":"approximated","construct-dropped":"dropped","construct-rasterized":"rasterized","structure-degraded":"approximated","layer-unmatched":"approximated","layer-source-rendered":"approximated","object-unmatched":"approximated","pdf-compatibility-undetermined":"approximated"};function q4(e){if(e)for(let t of["layer","font","name","color","page","construct"]){let r=e[t];if(r!==void 0)return String(r)}}function Y4(e){return e.map(t=>({bucket:W4[t.code],vocabulary:"pdf",code:t.code,subject:q4(t.detail),count:t.count,message:t.message}))}function OS(e){return e.map(t=>({bucket:H4[t.code],vocabulary:"illustrator",code:t.code,subject:t.name,count:t.count??1,message:t.message}))}function K4(e){let t=new Map;for(let r of e){if(r.glyphsShown===0)continue;let n=`${r.mapping.family}|${r.mapping.style}|${r.mapping.weight}`,i=t.get(n),a=r.outlined;i?t.set(n,{...i,embedded:i.embedded||r.embedded,glyphs:(i.glyphs??0)+r.glyphsShown,status:i.status==="outlined"&&a?"outlined":"unresolved"}):t.set(n,{family:r.mapping.family,style:r.mapping.style,weight:r.mapping.weight,embedded:r.embedded,status:a?"outlined":"unresolved",glyphs:r.glyphsShown})}return[...t.values()]}var Z4=new Set(["path","rect","circle","ellipse","line","polyline","polygon","use"]);function J4(e){let t=0,r=0,n=0,i=0,a=o=>{for(let s of o.children)Ke(s)||s.tag!=="defs"&&(Z4.has(s.tag)?t++:s.tag==="g"?r++:s.tag==="text"?n++:s.tag==="image"&&i++,a(s))};return a(e),{shapes:t,groups:r,texts:n,images:i}}var Q4=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,Zk=new Set([" "," ","\r",`
93
+ `,"\f","\0","(",")","<",">","[","]","{","}","/","%"]),e8=/^%%BeginData:\s*(\d+)(?:\s+(Hex|Binary|ASCII))?\s*(Bytes|Lines)?/i;function t8(e){return e===" "||e===" "||e==="\r"||e===`
94
+ `||e==="\f"||e==="\0"}function*Em(e,t=0,r=e.length,n={}){let i=n.hiddenCode??!0,a=t;for(;a<r;){let o=e[a];if(t8(o)){a++;continue}if(o==="%"){let u=Tl(e,a,r),d=Pl(e,u,r),c=e.slice(a,u),f=e[a+1];if(f==="_"&&i){yield*Em(e,a+2,u,n),a=d;continue}if(f==="%"||f==="A"||f==="!"){yield{kind:"marker",text:c,offset:a};let p=e8.exec(c);if(p&&p[3]?.toLowerCase()!=="lines"){let h=Number(p[1]),m=d,g=Math.min(r,m+(Number.isFinite(h)?h:0));if(!e.startsWith("%%EndData",r8(e,g,r))){let v=e.indexOf("%%EndData",m);v>=0&&v<=r&&(g=v)}yield{kind:"data",start:m,end:g,offset:m},a=g;continue}}a=d;continue}if(o==="("){let u=Dm(e,a),d=u<0||u>r?r:u,c=e.slice(a+1,d);yield{kind:"string",text:$c(c),raw:c,offset:a},a=d+1;continue}if(o==="<"){if(e[a+1]==="<"){yield{kind:"dict-open",offset:a},a+=2;continue}let u=e.indexOf(">",a);(u<0||u>r)&&(u=r);let d=e.slice(a+1,u).replace(/[^0-9a-fA-F]/g,""),c=new Uint8Array(Math.floor(d.length/2));for(let f=0;f<c.length;f++)c[f]=Number.parseInt(d.slice(f*2,f*2+2),16);yield{kind:"hexstring",bytes:c,offset:a},a=u+1;continue}if(o===">"){if(e[a+1]===">"){yield{kind:"dict-close",offset:a},a+=2;continue}a++;continue}if(o==="["){yield{kind:"array-open",offset:a},a++;continue}if(o==="]"){yield{kind:"array-close",offset:a},a++;continue}if(o==="{"){yield{kind:"proc-open",offset:a},a++;continue}if(o==="}"){yield{kind:"proc-close",offset:a},a++;continue}if(o===")"){a++;continue}if(o==="/"){let u=a+1;for(;u<r&&!Zk.has(e[u]);)u++;yield{kind:"name",name:e.slice(a+1,u),offset:a},a=u;continue}let s=a;for(;s<r&&!Zk.has(e[s]);)s++;if(s===a){a++;continue}let l=e.slice(a,s);Q4.test(l)?yield{kind:"number",value:Number(l),offset:a}:yield{kind:"operator",op:l,offset:a},a=s}}function r8(e,t,r){let n=t;for(;n<r&&(e[n]===`
95
+ `||e[n]==="\r");)n++;return n}function Pa(e){return e<0?0:e>1?1:e}function xm(e){return Math.round(Pa(e)*255).toString(16).padStart(2,"0")}function Nc(e,t,r){return`#${xm(e)}${xm(t)}${xm(r)}`}function Ol(e,t,r,n,i,a){let[o,s,l]=Nl(Pa(e),Pa(t),Pa(r),Pa(n));return{kind:"flat",rgb:Nc(o/255,s/255,l/255),space:i?"spot":"cmyk",...i?{name:i}:{},...a!==void 0?{tint:a}:{}}}function Bi(e,t,r,n,i){return{kind:"flat",rgb:Nc(e,t,r),space:n?"spot":"rgb",...n?{name:n}:{},...i!==void 0?{tint:i}:{}}}function wc(e){let[t,r,n]=Nl(0,0,0,Pa(1-e));return{kind:"flat",rgb:Nc(t/255,r/255,n/255),space:"gray"}}function n8(e,t){if(t>=1)return e;let r=Number.parseInt(e.rgb.slice(1,3),16)/255,n=Number.parseInt(e.rgb.slice(3,5),16)/255,i=Number.parseInt(e.rgb.slice(5,7),16)/255,a=o=>1-(1-o)*Pa(t);return{...e,rgb:Nc(a(r),a(n),a(i)),tint:t}}var Jk=[1,0,0,1,0,0],i8={width:1,cap:0,join:0,miterLimit:10,dash:[],dashOffset:0},a8=new Set(["O","R","Xw","Ap","Ae","As","AE","Xd","XW","XL","Xz","Xk","XK","XP","Xt","Xf","Xg","XT","XE","X1","X2","XS","XM","XQ","XV","Np","Nb","Ba","Bd","Bs","BS","BD","Br","Bn","Bm","Pb","PB","Pn","Pc","TP","Tk","Tt","Ta","TV","Tv","Tb","TW","Td","Tw","TY","Xh","XH","XF","D","Xe","Xs","XU","Xn","XN","Xi","XI","XG","Ah","XR","Xv","Xl","XB","XC","XD","Xj","Xo","XJ","Xp","XX","Xx","x","X","X=","X+"]);function wm(e,t=0){return e&&e.kind==="number"?e.value:t}function hi(e){return e.flatMap(t=>t.kind==="number"?[t.value]:[])}function Cl(e){return e?e.kind==="string"?e.text:e.kind==="name"?e.name:null:null}function Yo(e){return e.length>=6?[e[0],e[1],e[2],e[3],e[4],e[5]]:null}function Qk(e){return e===1?1:e===2?2:0}function TS(e){switch(e.kind){case"number":return{kind:"number",value:e.value};case"name":return{kind:"name",name:e.name};case"string":return{kind:"string",text:e.text,raw:e.raw};case"hexstring":return{kind:"hexstring",bytes:e.bytes};default:return null}}function o8(e){let t=e.length>=13,r=t?8:6,n=a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0"),i=e.length>=r+3?`#${n(e[r])}${n(e[r+1])}${n(e[r+2])}`:null;return{layerName:"",visible:(e[0]??1)!==0&&(!t||(e[6]??1)!==0),locked:(e[2]??1)===0,color:i,template:t?(e[11]??0)!==0:(e[10]??0)!==0,printing:(e[3]??1)!==0}}function yc(e,t){let r=e.find(u=>u.kind==="string"),n=r&&r.kind==="string"?r.text:void 0,i=r?e.indexOf(r):e.length,a=hi(e.slice(0,i)),o=hi(e.slice(i+1)),s=o.length>0?o[0]:1,l;return t==="rgb"&&a.length>=7?l=Bi(a[4],a[5],a[6],n):t==="rgb"&&a.length>=3?l=Bi(a[0],a[1],a[2],n):a.length>=4?l=Ol(a[0],a[1],a[2],a[3],n):l=wc(a[0]??0),l.kind==="flat"?n8(l,s):l}function s8(e){let t=[...e];return t.length>=3&&t[t.length-1]===6&&t.splice(t.length-2,2),t.pop(),t.length>=7?Bi(t[4],t[5],t[6]).rgb:t.length>=4?Ol(t[0],t[1],t[2],t[3]).rgb:t.length===3?Bi(t[0],t[1],t[2]).rgb:wc(t[0]??0).rgb}function l8(e){let t=[];for(let r of e){let n=t[t.length-1];n&&n.offset===r.offset&&n.rgb===r.rgb||t.push(r)}return t}function u8(e){let t=new Map,r=0;for(;;){let n=e.indexOf("%AI5_BeginGradient",r);if(n<0)break;let i=e.indexOf("%AI5_EndGradient",n),a=i<0?e.length:i,o=null,s="linear",l=[],u=[];for(let d of Em(e,n,a)){if(d.kind==="operator"){if(d.op==="Bd"){let f=hi(u);o=Cl(u.find(p=>p.kind==="string"))??o,s=(f[0]??0)===1?"radial":"linear"}else if(d.op==="Bs"||d.op==="BS"){let f=hi(u);if(f.length>=4){let p=f[f.length-1],h=f[f.length-2];l.push({offset:p/100,midpoint:h/100,opacity:1,rgb:s8(f.slice(0,-2))})}}u=[];continue}if(d.kind==="marker"||d.kind==="data"||d.kind==="array-open"||d.kind==="array-close")continue;let c=TS(d);c&&u.push(c)}o&&(l.sort((d,c)=>d.offset-c.offset),t.set(o,{name:o,type:s,stops:l8(l)})),r=a+1}return t}var d8=class{diagnostics;source;gradients;patterns=new Set;unknown=new Map;stack=[];containers=[];roots=[];state;subpaths=[];current=null;text=null;gradient=null;nextId=1;objectCount=0;lastClosedGroup=null;lastNode=null;image=null;collectDepth=0;collected=[];recordDepth=0;recordKeys=[];textRecord=null;inArt=!1;lastRecordString=null;pendingHighlight=null;finished=!1;constructor(e,t={}){this.source=e,this.diagnostics=t.diagnostics??new Ui,this.gradients=u8(e),this.state={fill:Ol(0,0,0,1),stroke:null,strokeStyle:i8,fillRule:0,locked:!1,transparency:null,pendingClip:!1}}run(e,t){let r=e??this.artStart(),n=t??this.source.length;for(let i of Em(this.source,r,n))if(this.consume(i),this.finished)break;for(this.text&&this.endText(n);this.containers.length>0;)this.diagnostics.add({code:"source-unbalanced-container",severity:"warning",message:"A container was not closed before the end of the source."}),this.closeContainer();return{roots:this.roots,gradients:this.gradients,patterns:this.patterns,unknownOperators:this.unknown,objectCount:this.objectCount}}lineIndex=null;lineOf(e){return this.lineIndex||(this.lineIndex=new A4(this.source)),this.lineIndex.lineOf(e)}artStart(){let e=this.source.indexOf("%%EndSetup");if(e>=0)return e;let t=this.source.indexOf("%AI5_BeginLayer");if(t>=0)return t;let r=this.source.indexOf("%%EndProlog");return r>=0?r:0}consume(e){switch(e.kind){case"marker":this.marker(e.text,e.offset);return;case"data":{if(!this.image)return;let t=e.start,r=Tl(this.source,t,e.end);(r<e.end?this.source.slice(t,r):"")==="XI"&&(this.operator("XI",t),t=Pl(this.source,r,e.end)),this.image.payload=this.source.slice(t,e.end);return}case"array-open":case"dict-open":this.collectDepth++,this.collected.push([]);return;case"array-close":case"dict-close":{if(this.collectDepth===0)return;this.collectDepth--;let t=this.collected.pop()??[];this.push({kind:e.kind==="array-close"?"array":"dict",items:t});return}case"proc-open":case"proc-close":return;case"operator":if(this.collectDepth>0){(e.op==="true"||e.op==="false")&&this.push({kind:"number",value:e.op==="true"?1:0});return}this.operator(e.op,e.offset);return;default:{let t=TS(e);t&&this.push(t)}}}push(e){this.collectDepth>0?this.collected[this.collected.length-1].push(e):this.stack.push(e)}take(){let e=this.stack;return this.stack=[],e}marker(e,t){if(e.startsWith("%%PageTrailer")||e.startsWith("%%Trailer")){this.finished=!0;return}if(e.startsWith("%AI5_BeginRaster")||e.startsWith("%AI5_File")){this.image={};return}e.startsWith("%AI5_EndRaster")&&this.finishImage(t)}operator(e,t){if(e===":"){this.openRecord();return}if(e===","){this.recordEntry(this.take());return}if(e===";"){this.closeRecord(t);return}if(this.recordDepth>0&&!this.inArt)return;let r=this.take();e!=="Xy"&&(this.lastClosedGroup=null),this.dispatch(e,r,t)||a8.has(e)||this.unknown.set(e,(this.unknown.get(e)??0)+1)}openRecord(){let e=this.stack.pop(),t=e&&e.kind==="name"?e.name:"";this.recordDepth++,this.recordKeys.push(t),t==="AI11Text"?this.textRecord={storyIndex:-1,frameIndex:-1,frame:null,depth:this.recordDepth}:t==="Art"&&this.textRecord&&this.recordDepth===this.textRecord.depth+1&&(this.inArt=!0),this.stack=[]}recordEntry(e){if(this.recordDepth===0)return;let t=Cl(e[e.length-1]);if(this.textRecord&&this.recordDepth===this.textRecord.depth){let n=wm(e[0],-1);t==="StoryIndex"?this.textRecord.storyIndex=n:t==="FrameIndex"&&(this.textRecord.frameIndex=n);return}t==="AI10_ArtUID"&&this.lastRecordString!==null&&this.lastNode&&(this.lastNode.name=this.lastRecordString);let r=e[0];r&&r.kind==="string"&&(this.lastRecordString=r.text)}closeRecord(e){if(this.recordDepth===0)return;let t=this.recordKeys.pop()??"",r=this.stack.find(n=>n.kind==="string");r&&r.kind==="string"&&(this.lastRecordString=r.text),this.inArt&&t==="Art"&&(this.inArt=!1),this.textRecord&&this.recordDepth===this.textRecord.depth&&(this.emitModernText(e),this.textRecord=null),this.recordDepth--,this.stack=[]}openContainer(e,t){let r={id:this.nextId++,kind:e,children:[],locked:this.state.locked,transparency:null,name:null,line:this.lineOf(t)};return this.attach(r),this.containers.push(r),this.lastClosedGroup=null,r}closeContainer(){let e=this.containers.pop()??null;e&&(this.lastClosedGroup=e.kind==="group"||e.kind==="compound"||e.kind==="clipgroup"?e:null,this.lastNode=e)}closeCompound(){let e=this.containers[this.containers.length-1];if(e&&e.kind==="compound"){let t=e.children.filter(r=>r.kind==="path");if(t.length>1&&e.children.length===t.length){let r={...t[0],subpaths:t.flatMap(n=>n.subpaths),fill:t.find(n=>n.fill)?.fill??null,stroke:t.find(n=>n.stroke)?.stroke??null,fillRule:t[t.length-1].fillRule,painted:t.some(n=>n.painted),clip:t.some(n=>n.clip)};e.children.splice(0,e.children.length,r)}}this.closeContainer()}attach(e){let t=this.containers[this.containers.length-1];t?t.children.push(e):this.roots.push(e),this.lastNode=e,this.lastRecordString=null}beginLayer(e,t){let r=hi(e),n=this.openContainer("layer",t);n.layer=o8(r)}nameLayer(e){let t=this.containers[this.containers.length-1],r=Cl(e[0])??"";t&&t.kind==="layer"&&t.layer&&(t.layer={...t.layer,layerName:r})}endLayer(){for(;this.containers.length>0&&this.containers[this.containers.length-1].kind!=="layer";)this.closeContainer();this.containers.length>0&&this.closeContainer(),this.lastClosedGroup=null}moveTo(e,t){this.current={start:[e,t],segments:[],closed:!1},this.subpaths.push(this.current)}lineTo(e,t){this.current?this.current.segments.push({to:[e,t]}):this.moveTo(e,t)}curveTo(e,t,r){if(!this.current){this.moveTo(r[0],r[1]);return}let n=this.current.segments,i=n.length>0?n[n.length-1].to:this.current.start;n.push({c1:e??i,c2:t??r,to:r})}closePath(){this.current&&(this.current.closed=!0)}emitPath(e,t,r,n,i){if(r)for(let o of this.subpaths)o.closed=!0;let a={id:this.nextId++,kind:"path",subpaths:this.subpaths,fill:e?this.gradient?this.gradientPaint():this.state.fill:null,stroke:t?this.gradient&&!e?this.gradientPaint():this.state.stroke:null,strokeStyle:this.state.strokeStyle,fillRule:this.state.fillRule,clip:this.state.pendingClip,painted:n,locked:this.state.locked,transparency:this.state.transparency,name:null,line:this.lineOf(i)};if(this.subpaths=[],this.current=null,this.state.pendingClip=!1,this.objectCount++,this.textRecord&&this.inArt){this.textRecord.frame=a;return}this.attach(a)}gradientPaint(){let e=this.gradient;return{kind:"gradient",name:e.name,definition:this.gradients.get(e.name)??null,origin:e.origin,angle:e.angle,length:e.length,matrix:e.matrix,xm:e.xm,bm:e.bm,highlight:e.highlight,hilightMatrix:e.hilightMatrix}}beginText(e){let t=this.textState;this.text={type:e,matrix:Jk,font:t.font,size:t.size,render:t.render,tracking:t.tracking,leading:t.leading,horizontalScale:t.horizontalScale,runs:[]}}textState={font:null,size:12,render:0,tracking:0,leading:0,horizontalScale:100};showText(e){this.text&&this.text.runs.push({text:e,font:this.text.font,size:this.text.size,matrix:this.text.matrix,fill:this.state.fill,stroke:this.state.stroke,render:this.text.render,tracking:this.text.tracking,leading:this.text.leading,horizontalScale:this.text.horizontalScale})}endText(e){let t=this.text;if(this.text=null,!t)return;this.textState={font:t.font,size:t.size,render:t.render,tracking:t.tracking,leading:t.leading,horizontalScale:t.horizontalScale};let r={id:this.nextId++,kind:"text",textType:t.type,runs:t.runs,story:null,frame:null,locked:this.state.locked,transparency:this.state.transparency,name:null,line:this.lineOf(e)};this.objectCount++,this.attach(r)}emitModernText(e){let t=this.textRecord;if(!t)return;let r={id:this.nextId++,kind:"text",textType:1,runs:[],story:{storyIndex:t.storyIndex,frameIndex:t.frameIndex},frame:t.frame,locked:this.state.locked,transparency:this.state.transparency,name:null,line:this.lineOf(e)};this.objectCount++,this.attach(r)}finishImage(e){let t=this.image;if(this.image=null,!t||t.width===void 0||t.height===void 0||!t.matrix)return;let r={id:this.nextId++,kind:"image",matrix:t.matrix,width:t.width,height:t.height,bits:t.bits??8,channels:t.channels??3,alphaChannels:t.alphaChannels??0,binary:t.binary??!0,mask:t.mask??!1,payload:t.payload??"",colorSpace:t.colorSpace??null,bounds:t.bounds??[0,0,t.width,t.height],linked:t.linked??null,locked:this.state.locked,transparency:this.state.transparency,name:null,line:this.lineOf(e)};this.objectCount++,this.attach(r)}dispatch(e,t,r){let n=hi(t);switch(e){case"Lb":return this.beginLayer(t,r),!0;case"Ln":return this.nameLayer(t),!0;case"LB":return this.endLayer(),!0;case"u":return this.openContainer("group",r),!0;case"U":return this.closeContainer(),!0;case"*u":return this.openContainer("compound",r),!0;case"*U":return this.closeCompound(),!0;case"q":return this.openContainer("clipgroup",r),!0;case"Q":return this.closeContainer(),!0;case"A":return this.state.locked=wm(t[0])!==0,!0;case"Xy":{let i=n.length>=2?{blendMode:n[0],opacity:n[1],isolated:(n[2]??0)!==0,knockout:n[3]??0,alphaIsShape:(n[4]??0)!==0}:null;return this.lastClosedGroup&&this.subpaths.length===0&&!this.text&&i?(this.lastClosedGroup.transparency=i,this.lastClosedGroup=null,this.state.transparency=null,!0):(this.state.transparency=i,!0)}case"XR":return this.state.fillRule=wm(t[0])===1?1:0,!0;case"W":return this.state.pendingClip=!0,!0;case"k":return this.state.fill=Ol(n[0]??0,n[1]??0,n[2]??0,n[3]??0),!0;case"K":return this.state.stroke=Ol(n[0]??0,n[1]??0,n[2]??0,n[3]??0),!0;case"g":return this.state.fill=wc(n[0]??0),!0;case"G":return this.state.stroke=wc(n[0]??0),!0;case"Xa":return this.state.fill=n.length>=7?Bi(n[4],n[5],n[6]):Bi(n[0]??0,n[1]??0,n[2]??0),!0;case"XA":return this.state.stroke=n.length>=7?Bi(n[4],n[5],n[6]):Bi(n[0]??0,n[1]??0,n[2]??0),!0;case"x":return this.state.fill=yc(t,"cmyk"),!0;case"X":return this.state.stroke=yc(t,"cmyk"),!0;case"Xx":return this.state.fill=yc(t,"rgb"),!0;case"XX":return this.state.stroke=yc(t,"rgb"),!0;case"p":case"P":{let i=t.find(s=>s.kind==="string"),a=i&&i.kind==="string"?i.text:"pattern";this.patterns.add(a);let o={kind:"pattern",name:a};return e==="p"?this.state.fill=o:this.state.stroke=o,!0}case"w":return this.state.strokeStyle={...this.state.strokeStyle,width:n[0]??1},!0;case"J":return this.state.strokeStyle={...this.state.strokeStyle,cap:Qk(n[0]??0)},!0;case"j":return this.state.strokeStyle={...this.state.strokeStyle,join:Qk(n[0]??0)},!0;case"M":return this.text||(this.state.strokeStyle={...this.state.strokeStyle,miterLimit:n[0]??10}),!0;case"d":{let i=t.find(o=>o.kind==="array"),a=i&&i.kind==="array"?hi(i.items).filter(o=>o>=0):[];return this.state.strokeStyle={...this.state.strokeStyle,dash:a,dashOffset:n[n.length-1]??0},!0}case"m":return this.moveTo(n[0]??0,n[1]??0),!0;case"l":case"L":return this.lineTo(n[0]??0,n[1]??0),!0;case"c":case"C":return this.curveTo([n[0]??0,n[1]??0],[n[2]??0,n[3]??0],[n[4]??0,n[5]??0]),!0;case"v":case"V":return this.curveTo(null,[n[0]??0,n[1]??0],[n[2]??0,n[3]??0]),!0;case"y":case"Y":return this.curveTo([n[0]??0,n[1]??0],null,[n[2]??0,n[3]??0]),!0;case"h":case"H":return this.closePath(),!0;case"N":return this.emitPath(!1,!1,!1,!1,r),!0;case"n":return this.emitPath(!1,!1,!0,!1,r),!0;case"F":return this.emitPath(!0,!1,!1,!0,r),!0;case"f":return this.emitPath(!0,!1,!0,!0,r),!0;case"S":return this.emitPath(!1,!0,!1,!0,r),!0;case"s":return this.emitPath(!1,!0,!0,!0,r),!0;case"B":return this.emitPath(!0,!0,!1,!0,r),!0;case"b":return this.emitPath(!0,!0,!0,!0,r),!0;case"Bb":return this.gradient=null,this.pendingHighlight=null,!0;case"Bg":{let i=t.find(o=>o.kind==="string"),a=n.slice(1);return this.gradient={name:i&&i.kind==="string"?i.text:"",origin:[a[0]??0,a[1]??0],angle:a[2]??0,length:a[3]??0,matrix:Yo(a.slice(4,10)),xm:null,bm:null,highlight:this.pendingHighlight,hilightMatrix:null},!0}case"Xm":return this.gradient&&(this.gradient.xm=Yo(n)),!0;case"Bm":return this.gradient&&(this.gradient.bm=Yo(n)),!0;case"Bh":{let i=n.length>=4?{origin:[n[0],n[1]],angle:n[2],length:n[3]}:null;return this.gradient?this.gradient.highlight=i:this.pendingHighlight=i,!0}case"Bc":return this.gradient&&!this.gradient.hilightMatrix&&(this.gradient.hilightMatrix=Yo(n)),!0;case"BB":return this.gradient=null,!0;case"To":return this.beginText(n[0]??0),!0;case"TO":return this.endText(r),!0;case"Tp":case"Tm":{let i=Yo(n);return this.text&&i&&(this.text.matrix=i),!0}case"Tf":{if(!this.text)return!0;let i=t.find(a=>a.kind==="name");return i&&i.kind==="name"&&(this.text.font=i.name.replace(/^_/,"")),n.length>0&&(this.text.size=n[0]),!0}case"Tz":return this.text&&(this.text.horizontalScale=n[0]??100),!0;case"Tl":return this.text&&(this.text.leading=n[0]??0),!0;case"Tc":return this.text&&(this.text.tracking=n[0]??0),!0;case"Tr":return this.text&&(this.text.render=n[0]??0),!0;case"Tx":case"TX":case"Tj":return this.showText(Cl(t[0])??""),!0;case"XG":{let i=Cl(t[0]);return this.image&&i&&(this.image.linked=i),!0}case"XN":{let i=t.find(a=>a.kind==="name");return this.image&&i&&i.kind==="name"&&(this.image.colorSpace=i.name),!0}case"XI":{this.image||(this.image={});let i=t.find(s=>s.kind==="array"),a=hi(t.filter(s=>s.kind!=="array")),o=i&&i.kind==="array"?Yo(hi(i.items)):null;return this.image.matrix=o??Jk,this.image.bounds=[a[0]??0,a[1]??0,a[2]??0,a[3]??0],this.image.width=a[4]??0,this.image.height=a[5]??0,this.image.bits=a[6]??8,this.image.channels=a[7]??3,this.image.alphaChannels=a[8]??0,this.image.binary=(a[10]??1)!==0,this.image.mask=(a[11]??0)!==0,!0}default:return!1}}};function PS(e,t={}){return new d8(e,t).run(t.from,t.to)}function c8(e){if(e.binary){let n=new Uint8Array(e.payload.length);for(let i=0;i<e.payload.length;i++)n[i]=e.payload.charCodeAt(i)&255;return n}let t=e.payload.replace(/[^0-9a-fA-F]/g,""),r=new Uint8Array(Math.floor(t.length/2));for(let n=0;n<r.length;n++)r[n]=Number.parseInt(t.slice(n*2,n*2+2),16);return r}function f8(e){if(e.bits!==8||e.width<=0||e.height<=0)return null;let t=c8(e),r=e.channels,n=r+e.alphaChannels,i=e.width*e.height;if(t.length<i*n||t.length>i*n+64)return null;let a=new Uint8ClampedArray(i*4);for(let o=0;o<i;o++){let s=o*n,l=0,u=0,d=0;if(r===4){let[f,p,h]=Nl(t[s]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255);l=f,u=p,d=h}else r===3?(l=t[s],u=t[s+1],d=t[s+2]):l=u=d=t[s];let c=e.alphaChannels>0?t[s+r]:255;a[o*4]=l,a[o*4+1]=u,a[o*4+2]=d,a[o*4+3]=c}return a}async function p8(e){let t=f8(e);if(!t)return null;let r=await cm({width:e.width,height:e.height,colorType:6,bitDepth:8,data:t}),n="";for(let i=0;i<r.length;i+=32768)n+=String.fromCharCode(...r.subarray(i,i+32768));return`data:image/png;base64,${btoa(n)}`}var h8=[null,"multiply","screen","overlay","soft-light","hard-light","color-dodge","color-burn","darken","lighten","difference","exclusion","hue","saturation","color","luminosity"];function ce(e,t){let r=10**t,n=Math.round(e*r)/r,i=(Object.is(n,-0)?0:n).toString();return i.includes("e")?n.toFixed(t).replace(/\.?0+$/,""):i}function fi(e){return{text:e}}function Im(e,t){let[r,n,i,a,o,s]=e,[l,u,d,c,f,p]=t;return[r*l+n*d,r*u+n*c,i*l+a*d,i*u+a*c,o*l+s*d+f,o*u+s*c+p]}function Yt(e,t){return[e[0]*t[0]+e[2]*t[1]+e[4],e[1]*t[0]+e[3]*t[1]+e[5]]}var m8=class{taken=new Set;unique(e){let t=hn(e)||"object",r=t,n=2;for(;this.taken.has(r);)r=`${t}_${n++}`;return this.taken.add(r),r}};function g8(e,t){let r=new DS(e,t);return{renderNode:n=>r.renderStandalone(n),textBounds:n=>r.textBounds(n),decorations:()=>r.decorationMap(),toCanvas:r.canvasMatrix()}}async function y8(e,t){return new DS(e,t).render()}var DS=class{constructor(e,t){this.document=e,this.options=t;let r=t.artboards,n=null;for(let a of r)n=n?[Math.min(n[0],a.canvas[0]),Math.min(n[1],a.canvas[1]),Math.max(n[2],a.canvas[2]),Math.max(n[3],a.canvas[3])]:a.canvas;let i=n??[0,0,100,100];this.toCanvas=[1,0,0,-1,-i[0],-i[1]],this.viewBox=[0,0,i[2]-i[0],i[3]-i[1]]}document;options;ids=new m8;defs=[];decorations={};constructs=new Map;layers=[];counts={shapes:0,groups:0,texts:0,images:0,textOutlined:0};toCanvas;viewBox;gradientCount=0;clipCount=0;pending=[];renderStandalone(e){return this.renderNode(e,null)}decorationMap(){return this.decorations}canvasMatrix(){return this.toCanvas}async render(){let e=this.options.precision,t=me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${ce(this.viewBox[2],e)} ${ce(this.viewBox[3],e)}`,width:ce(this.viewBox[2],e),height:ce(this.viewBox[3],e)});this.options.title&&t.children.push(me("title",{},[fi(this.options.title)]));let r=[];if(this.options.artboards.length>1)for(let i of this.options.artboards){let a=i.canvas,o=me("view",{id:this.ids.unique(i.name||`Artboard_${i.index}`),viewBox:`${ce(a[0]-this.frameLeft(),e)} ${ce(a[1]-this.frameTop(),e)} ${ce(a[2]-a[0],e)} ${ce(a[3]-a[1],e)}`});o.children.push(me("title",{},[fi(i.name)])),r.push(o)}let n=this.document.roots;if(n.some(i=>i.kind==="layer"))for(let i of n){let a=this.renderNode(i,null);a&&r.push(a)}else{let i={id:0,kind:"layer",children:[...n],locked:!1,transparency:null,name:null,line:1,layer:{layerName:"Layer 1",visible:!0,locked:!1,color:null,template:!1,printing:!0}},a=this.renderLayer(i);a&&r.push(a)}return await Promise.all(this.pending),this.defs.length>0&&t.children.push(me("defs",{},this.defs)),t.children.push(...r),{tree:t,svg:qo(t),decorations:this.decorations,layers:this.layers,counts:this.counts,constructs:this.constructs,artboards:this.options.artboards.map(i=>({...i,imported:!0}))}}frameLeft(){return-this.toCanvas[4]}frameTop(){return-this.toCanvas[5]}renderNode(e,t){switch(e.kind){case"layer":return this.renderLayer(e);case"group":case"compound":case"clipgroup":return this.renderContainer(e,t);case"path":return this.renderPath(e);case"text":return this.renderText(e);case"image":return this.renderImage(e);case"placeholder":return this.count(e.construct),null}}count(e){this.constructs.set(e,(this.constructs.get(e)??0)+1)}renderLayer(e){let t=e.layer??{layerName:"",visible:!0,locked:!1,color:null,template:!1,printing:!0};if(!t.visible&&this.options.hiddenLayers==="skip")return null;let r=this.ids.unique(t.layerName||"Layer"),n=me("g",{id:r});this.options.layerTitles!==!1&&n.children.push(me("title",{},[fi(t.layerName||r)]));let i={name:t.layerName||r,visible:t.visible,locked:t.locked,color:t.color,children:[],origin:"source",svgIds:[r]};this.decorations[r]={layerName:i.name,hidden:!t.visible,locked:t.locked,inherit:t.locked},this.applyTransparency(n,e),this.counts.groups++;for(let a of rS(e.children)){if(a.kind==="layer"){let s=this.renderLayer(a);if(s){n.children.push(s);let l=this.layers.pop();l&&i.children.push(l)}continue}let o=this.renderNode(a,i);o&&n.children.push(o)}return this.layers.push(i),n}renderContainer(e,t){let r=[],n=e.kind==="clipgroup"?e.children.filter(o=>o.kind==="path"&&o.clip):[];for(let o of rS(e.children)){if(n.includes(o))continue;let s=this.renderNode(o,t);s&&r.push(s)}if(r.length===0&&n.length===0)return null;if(e.kind==="compound"&&r.length===1&&n.length===0&&!e.transparency){let o=r[0];return e.name&&!o.attrs.id&&(o.attrs.id=this.ids.unique(e.name)),e.locked&&o.attrs.id&&(this.decorations[o.attrs.id]={locked:!0}),o}let i={};e.name&&(i.id=this.ids.unique(e.name));let a=me("g",i,r);if(n.length>0){let o=`clip-${++this.clipCount}`,s=me("clipPath",{id:o});for(let l of n)s.children.push(me("path",{d:this.pathData(l.subpaths),...l.fillRule===1?{"clip-rule":"evenodd"}:{}}));this.defs.push(s),a.attrs["clip-path"]=`url(#${o})`}return this.applyTransparency(a,e),e.locked&&i.id&&(this.decorations[i.id]={locked:!0,inherit:!0}),this.counts.groups++,a}applyTransparency(e,t){let r=t.transparency;if(!r)return;r.opacity<1&&(e.attrs.opacity=ce(r.opacity,3));let n=h8[r.blendMode]??null;n&&(e.attrs.style=`mix-blend-mode:${n}`),r.blendMode!==0&&!n&&this.count("blend-mode-unsupported")}pathData(e){let t=this.options.precision,r=[];for(let n of e){let i=Yt(this.toCanvas,n.start);r.push(`M${ce(i[0],t)} ${ce(i[1],t)}`);for(let a of n.segments){let o=Yt(this.toCanvas,a.to);if(a.c1&&a.c2){let s=Yt(this.toCanvas,a.c1),l=Yt(this.toCanvas,a.c2);r.push(`C${ce(s[0],t)} ${ce(s[1],t)} ${ce(l[0],t)} ${ce(l[1],t)} ${ce(o[0],t)} ${ce(o[1],t)}`)}else r.push(`L${ce(o[0],t)} ${ce(o[1],t)}`)}n.closed&&r.push("Z")}return r.join("")}renderPath(e){if(!e.painted||e.subpaths.length===0||e.clip&&!e.fill&&!e.stroke)return null;let t={d:this.pathData(e.subpaths)};e.name&&(t.id=this.ids.unique(e.name));let r=e.fill?this.paintValue(e.fill,e,"fill"):"none";if(t.fill=r,e.fillRule===1&&e.fill&&(t["fill-rule"]="evenodd"),e.stroke){t.stroke=this.paintValue(e.stroke,e,"stroke");let i=e.strokeStyle;t["stroke-width"]=ce(i.width,this.options.precision),i.cap===1?t["stroke-linecap"]="round":i.cap===2&&(t["stroke-linecap"]="square"),i.join===1?t["stroke-linejoin"]="round":i.join===2&&(t["stroke-linejoin"]="bevel"),i.miterLimit!==4&&i.join===0&&(t["stroke-miterlimit"]=ce(i.miterLimit,3)),i.dash.length>0&&(t["stroke-dasharray"]=i.dash.map(a=>ce(a,this.options.precision)).join(" "),i.dashOffset&&(t["stroke-dashoffset"]=ce(i.dashOffset,this.options.precision)))}let n=me("path",t);return this.applyTransparency(n,e),e.locked&&t.id&&(this.decorations[t.id]={locked:!0}),this.counts.shapes++,n}paintValue(e,t,r){switch(e.kind){case"flat":return e.rgb;case"gradient":return this.gradientValue(e,t);case"pattern":return this.count("pattern"),"#808080"}}gradientValue(e,t){let r=e.definition;if(!r||r.stops.length===0)return this.count("gradient-missing"),"#808080";let n=`gradient-${++this.gradientCount}`,i=this.options.precision,a=r.stops.map(u=>me("stop",{offset:ce(Math.max(0,Math.min(1,u.offset)),4),"stop-color":u.rgb,...u.opacity<1?{"stop-opacity":ce(u.opacity,3)}:{}})),o=e.xm??e.bm;if(r.type==="radial"){if(o){let u=Im(o,this.toCanvas),d={id:n,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:`matrix(${u.map(c=>ce(c,6)).join(" ")})`};if(e.highlight){let c=v8(o,e.highlight.origin);c&&(d.fx=ce(c[0],4),d.fy=ce(c[1],4))}this.defs.push(me("radialGradient",d,a))}else{let u=Yt(this.toCanvas,Yt(e.matrix??eS,e.origin)),d={id:n,cx:ce(u[0],i),cy:ce(u[1],i),r:ce(Math.abs(e.length)||1,i),gradientUnits:"userSpaceOnUse"};this.defs.push(me("radialGradient",d,a))}return`url(#${n})`}let s,l;if(o)s=Yt(this.toCanvas,Yt(o,[0,0])),l=Yt(this.toCanvas,Yt(o,[1,0]));else{let u=e.angle*Math.PI/180,d=e.matrix??eS;s=Yt(this.toCanvas,Yt(d,e.origin)),l=Yt(this.toCanvas,Yt(d,[e.origin[0]+Math.cos(u)*e.length,e.origin[1]+Math.sin(u)*e.length]))}return this.defs.push(me("linearGradient",{id:n,x1:ce(s[0],i),y1:ce(s[1],i),x2:ce(l[0],i),y2:ce(l[1],i),gradientUnits:"userSpaceOnUse"},a)),`url(#${n})`}renderText(e){if(e.story)return this.renderStoryText(e);if(e.runs.length===0)return null;let t=this.options.precision,r=this.mergeRuns(e.runs),n=r[0],i=n.font?uc(tS(n.font)):null,a=Yt(this.toCanvas,[n.matrix[4],n.matrix[5]]),o=n.matrix,s=[o[0],-o[1],-o[2],o[3],0,0],l={"font-size":ce(n.size,t),fill:n.fill&&n.fill.kind==="flat"?n.fill.rgb:n.fill?"#000000":"none"};i&&(l["font-family"]=dc(i),i.weight!==400&&(l["font-weight"]=String(i.weight)),i.style==="italic"&&(l["font-style"]="italic")),n.stroke&&n.stroke.kind==="flat"&&n.render>=1&&n.render<=2&&(l.stroke=n.stroke.rgb),n.horizontalScale!==100&&n.horizontalScale>0?(l.transform=`matrix(${ce(s[0]*(n.horizontalScale/100),4)} ${ce(s[1],4)} ${ce(s[2],4)} ${ce(s[3],4)} ${ce(a[0],t)} ${ce(a[1],t)})`,l.x="0",l.y="0"):Math.abs(s[0]-1)>1e-6||Math.abs(s[1])>1e-6||Math.abs(s[2])>1e-6||Math.abs(s[3]-1)>1e-6?(l.transform=`matrix(${ce(s[0],4)} ${ce(s[1],4)} ${ce(s[2],4)} ${ce(s[3],4)} ${ce(a[0],t)} ${ce(a[1],t)})`,l.x="0",l.y="0"):(l.x=ce(a[0],t),l.y=ce(a[1],t)),e.name&&(l.id=this.ids.unique(e.name));let u=me("text",l);if(r.length===1)u.children.push(fi(n.text));else for(let d of r){let c=Yt(this.toCanvas,[d.matrix[4],d.matrix[5]]),f=c[0]-a[0],p=c[1]-a[1];u.children.push(me("tspan",{x:ce(l.x==="0"?f:c[0],t),y:ce(l.x==="0"?p:c[1],t)},[fi(d.text)]))}return this.applyTransparency(u,e),e.locked&&l.id&&(this.decorations[l.id]={locked:!0}),this.counts.texts++,u}mergeRuns(e){let t=[];for(let r of e){let n=t[t.length-1];if(n&&Math.abs(n.matrix[5]-r.matrix[5])<1e-6&&n.font===r.font&&Math.abs(n.size-r.size)<1e-6&&n.matrix[0]===r.matrix[0]&&n.matrix[1]===r.matrix[1]){let i=n.text.length*n.size*.5,a=r.matrix[4]-(n.matrix[4]+i)>n.size*.35&&!n.text.endsWith(" ")&&!r.text.startsWith(" ")?" ":"";t[t.length-1]={...n,text:n.text+a+r.text};continue}t.push(r)}return t}storyGeometry(e){let t=e.story,r=this.options.textDocument,n=r?.stories??[],i=t?n[t.storyIndex]:void 0;if(!t||!r||!i||i.text.length===0)return null;let a=this.options.rulerOrigin??[0,0],o=i.frameResources[t.frameIndex]??i.frameResources[0],s=(o!==void 0?r.frames[o]:void 0)??null,l=i.layouts.find(u=>u.frameIndex===t.frameIndex)??i.layouts[t.frameIndex]??i.layouts[0]??null;return{storyData:i,frame:s,layout:l,toPath:(u,d)=>{let c=s?.matrix??[1,0,0,1,0,0],f=c[0]*u+c[2]*d+c[4],p=c[1]*u+c[3]*d+c[5];return[f-a[0],-(p-a[1])]}}}textBounds(e){let t=this.storyGeometry(e);if(!t)return null;let{frame:r,layout:n,toPath:i}=t,a=[];for(let u of n?.rows??[])a.push(i(u.bbox[0],u.bbox[1]),i(u.bbox[2],u.bbox[3])),a.push(i(u.bbox[0],u.bbox[3]),i(u.bbox[2],u.bbox[1]));if(a.length===0&&r&&n?.extent){let[u,d,c,f]=n.extent;a.push(i(u,d),i(c,f),i(u,f),i(c,d))}if(a.length===0)return null;let o=a.map(u=>Yt(this.toCanvas,u)),s=o.map(u=>u[0]),l=o.map(u=>u[1]);return[Math.min(...s),Math.min(...l),Math.max(...s),Math.max(...l)]}renderStoryText(e){let t=this.storyGeometry(e),r=this.options.textDocument;if(!t||!r)return this.count("text-story-unbound"),null;let{storyData:n,frame:i,layout:a,toPath:o}=t,s=this.options.precision,l=this.options.rulerOrigin??[0,0],u=n.runs[0],d=u?.size??(u?.leading?u.leading/1.2:12),c=u&&u.fontIndex!==null?r.fontNames[u.fontIndex]:void 0,f=c?uc(tS(c)):null,p={"font-size":ce(d,s),fill:"#000000"};f&&(p["font-family"]=dc(f),f.weight!==400&&(p["font-weight"]=String(f.weight)),f.style==="italic"&&(p["font-style"]="italic")),e.name&&(p.id=this.ids.unique(e.name));let h=[],m=a?.rows??[];if(m.length>0){let I=0,x=n.text;for(let k of m){let $=I+k.glyphCount,A=x.slice(I,$),S=A.indexOf("\r");S>=0?(A=A.slice(0,S),$=I+S+1):x[$]==="\r"&&$++,I=Math.min(x.length,$);let N=k.bbox[1]-k.ascent;h.push({text:A.replace(/\s+$/,""),at:o(k.bbox[0],N),local:[k.bbox[0],N]})}}else{let I=u?.leading??d*1.2,x=i?i.position:[0,0];n.paragraphs.forEach((k,$)=>{h.push({text:k,at:o(x[0],x[1]+d+I*$),local:[x[0],x[1]+d+I*$]})})}if(h.length===0)return this.count("text-story-unbound"),null;let g=i?.matrix??[1,0,0,1,0,0],v=Math.abs(g[0]-1)>1e-6||Math.abs(g[1])>1e-6||Math.abs(g[2])>1e-6||Math.abs(g[3]-1)>1e-6,y=me("text",p),b=h.map(I=>({text:I.text,at:I.local}));if(v){let I=[g[4]-l[0]-this.frameLeft(),g[5]-l[1]-this.frameTop()];if(p.transform=`matrix(${ce(g[0],6)} ${ce(g[1],6)} ${ce(g[2],6)} ${ce(g[3],6)} ${ce(I[0],s)} ${ce(I[1],s)})`,p.x=ce(b[0].at[0],s),p.y=ce(b[0].at[1],s),b.length===1)y.children.push(fi(b[0].text));else for(let x of b)y.children.push(me("tspan",{x:ce(x.at[0],s),y:ce(x.at[1],s)},[fi(x.text)]))}else{let I=Yt(this.toCanvas,h[0].at);if(p.x=ce(I[0],s),p.y=ce(I[1],s),h.length===1)y.children.push(fi(h[0].text));else for(let x of h){let k=Yt(this.toCanvas,x.at);y.children.push(me("tspan",{x:ce(k[0],s),y:ce(k[1],s)},[fi(x.text)]))}}return this.applyTransparency(y,e),e.locked&&p.id&&(this.decorations[p.id]={locked:!0}),this.counts.texts++,y}boundsOf(e){let t=1/0,r=1/0,n=-1/0,i=-1/0,a=o=>{let s=Yt(this.toCanvas,o);t=Math.min(t,s[0]),r=Math.min(r,s[1]),n=Math.max(n,s[0]),i=Math.max(i,s[1])};for(let o of e){a(o.start);for(let s of o.segments)s.c1&&a(s.c1),s.c2&&a(s.c2),a(s.to)}return[t,r,n,i]}renderImage(e){if(e.width<=0||e.height<=0)return null;if(!e.payload)return this.count(e.linked?"image-linked":"image-missing"),null;let t=this.options.precision,r=e.matrix,n=Im([r[0],r[1],r[2],r[3],r[4],r[5]],this.toCanvas),i=Im([1,0,0,-1,0,0],n),a={width:String(e.width),height:String(e.height),transform:`matrix(${i.map(s=>ce(s,6)).join(" ")})`,preserveAspectRatio:"none",href:""};e.name&&(a.id=this.ids.unique(e.name));let o=me("image",a);return this.applyTransparency(o,e),this.counts.images++,this.pending.push(p8(e).then(s=>{s?o.attrs.href=s:(this.count("image-undecodable"),o.attrs.href="")})),o}},eS=[1,0,0,1,0,0];function tS(e){let t=e.toLowerCase();return{name:e,type:"Type1",subtype:"Type1",bold:/bold|black|heavy|semibold|demibold/.test(t),italic:/italic|oblique/.test(t),black:/black|heavy/.test(t),serif:!1,monospace:/mono|courier/.test(t),symbolic:!1,missingFile:!0,isType3:!1,vertical:!1,composite:!1}}function v8(e,t){let r=e[0]*e[3]-e[1]*e[2];return Math.abs(r)<1e-12?null:[(e[3]*t[0]-e[2]*t[1])/r,(-e[1]*t[0]+e[0]*t[1])/r]}function rS(e){let t=[];for(let r of e){let n=t[t.length-1];if(r.kind==="text"&&!r.story&&n&&n.kind==="text"&&!n.story&&r.runs.length>0&&n.runs.length>0&&Math.abs(n.runs[n.runs.length-1].matrix[5]-r.runs[0].matrix[5])<1e-6&&n.runs[n.runs.length-1].font===r.runs[0].font&&Math.abs(n.runs[n.runs.length-1].size-r.runs[0].size)<1e-6){t[t.length-1]={...n,runs:[...n.runs,...r.runs]};continue}t.push(r)}return t}function b8(e){let t=e.indexOf("%AI11_BeginTextDocument");if(t<0)return null;let r=e.indexOf("%AI11_EndTextDocument",t),n=e.slice(t,r<0?e.length:r).split(/\r\n|\r|\n/),i=[];for(let s of n)!s.startsWith("%")||s.startsWith("%AI11")||s.startsWith("%_")||i.push(s.slice(1));if(i.length===0)return null;let a=Tm(dS(i.join(""))),o="";for(let s=0;s<a.length;s+=32768)o+=String.fromCharCode(...a.subarray(s,s+32768));return o}function x8(e){let t=NS(e);if(t.length>=2&&t[0]===254&&t[1]===255)return MS(t.subarray(2));let r="";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r}function jS(e){let t=0,r=e.length,n=()=>{for(;t<r&&/\s/.test(e[t]);)t++};if(n(),e[t]==="/")return jS(`<< ${e.slice(t)} >>`);let i=()=>{if(n(),t>=r)return null;let a=e[t];if(a==="<"&&e[t+1]==="<"){t+=2;let u=new Map;for(;n(),!(t>=r);){if(e[t]===">"&&e[t+1]===">"){t+=2;break}if(e[t]!=="/"){if(!i())break;continue}t++;let d=t;for(;d<r&&!/[\s/(<>[\]]/.test(e[d]);)d++;let c=e.slice(t,d);t=d;let f=i();if(!f)break;u.set(c,f)}return{kind:"dict",entries:u}}if(a==="["){t++;let u=[];for(;n(),!(t>=r);){if(e[t]==="]"){t++;break}let d=i();if(!d)break;u.push(d)}return{kind:"array",items:u}}if(a==="("){let u=0,d=t;for(;d<r;d++){let f=e[d];if(f==="\\"){d++;continue}if(f==="(")u++;else if(f===")"&&(u--,u===0))break}let c=e.slice(t+1,d);return t=d+1,{kind:"string",text:x8(c)}}if(a==="/"){t++;let u=t;for(;u<r&&!/[\s/(<>[\]]/.test(e[u]);)u++;let d=e.slice(t,u);return t=u,{kind:"name",name:d}}if(a===">"||a==="]")return t++,i();let o=t;for(;o<r&&!/[\s/(<>[\]]/.test(e[o]);)o++;let s=e.slice(t,o);if(t=o,s==="true"||s==="false")return{kind:"bool",value:s==="true"};let l=Number(s);return s.length>0&&Number.isFinite(l)?{kind:"number",value:l}:s.length>0?{kind:"name",name:s}:null};return i()}function w8(e){return e&&e.kind==="dict"?e:void 0}function ot(e,...t){let r=w8(e);if(r)for(let n of t){let i=r.entries.get(n);if(i!==void 0)return i}}function Xn(e,...t){let r=ot(e,...t);return r&&r.kind==="number"?r.value:null}function Dl(e){return!e||e.kind!=="array"?[]:e.items.flatMap(t=>t.kind==="number"?[t.value]:[])}function ES(e,...t){let r=ot(e,...t);return r&&r.kind==="string"?r.text:null}function zm(e){return e&&e.kind==="array"?e.items:[]}function Ic(e){let t=ot(e,"99","StreamTag");return t&&t.kind==="name"?t.name:null}function Vi(e,t){if(e&&t(e)!==!0){if(e.kind==="dict")for(let r of e.entries.values())Vi(r,t);else if(e.kind==="array")for(let r of e.items)Vi(r,t)}}function I8(e){return zm(ot(e,"0","RunArray")).flatMap(t=>{let r=Xn(t,"1","Length");if(r===null)return[];let n=ot(t,"0","RunData"),i=ot(n,"0","StyleSheet"),a=ot(i,"Features");if(!a){let o=ot(i,"6"),s=ot(i,"5");a=o&&o.kind==="dict"?o:s&&s.kind==="dict"?s:void 0}return[{length:r,fontIndex:Xn(a,"0","Font")??0,size:Xn(a,"1","FontSize"),leading:Xn(a,"5","Leading"),horizontalScale:Xn(a,"6","HorizontalScale"),tracking:Xn(a,"8","Tracking")}]})}function k8(e,t,r){let n=ES(t,"0","Text");if(n===null)return null;let i=I8(ot(t,"StyleRun")??ot(t,"6")??ot(t,"5")),a=i.map(c=>c.length),o=a.reduce((c,f)=>c+f,0);if(a.length===0||Math.abs(o-n.length)>1)return null;let s=n.replace(/\r\n|\r|\n/g,"\r").replace(/\r$/,""),l=ot(e,"1","View"),u=zm(ot(l,"0","Frames")).flatMap(c=>{let f=Xn(c,"0","Resource");return f===null?[]:[f]}),d=ot(l,"2","Strikes");return{index:r,text:s,paragraphs:s.split("\r"),runLengths:a,runs:i,frameResources:u,layouts:d?zS(d):[]}}function S8(e){let t=[];return Vi(e,r=>{if(r.kind!=="dict")return;let n=ot(r,"0"),i=ot(r,"Model")??(n&&n.kind==="dict"?n:r),a=k8(r,i,t.length);if(a)return t.push(a),!0}),t}function $8(e){let t=[];return Vi(e,r=>{if(r.kind!=="dict"||Ic(r)!=="CoolTypeFont")return;let n=ot(r,"0","Identifier"),i=ES(n,"0","Name");return i!==null&&t.push(i),!0}),t}function N8(e){let t=[];return Vi(e,r=>{if(r.kind!=="dict")return;let n=ot(r,"97","UUID"),i=ot(r,"0","Bezier"),a=ot(ot(r,"1"),"0"),o=Dl(i&&i.kind==="dict"?ot(i,"Points"):i??a),s=ot(r,"2","Data");if(!n||n.kind!=="string"||o.length<2||!s||s.kind!=="dict")return;let l=Dl(ot(s,"2","FrameMatrix"));return t.push({index:t.length,position:[o[0],o[1]],matrix:l.length===6?[l[0],l[1],l[2],l[3],l[4],l[5]]:[1,0,0,1,0,0]}),!0}),t}function M8(e){let t=[];return Vi(e,r=>{if(r.kind!=="dict")return;let n=Ic(r);if(n!=="LineStrike"&&n!=="L")return;let i=Xn(r,"14","SelectionAscent")??0,a=Xn(r,"15","SelectionDescent")??0,o=0,s=null;return Vi(r,l=>{if(l.kind!=="dict")return;let u=Ic(l);if(u!=="GlyphStrike"&&u!=="G")return;o+=zm(ot(l,"5","Glyphs")).length;let d=Dl(ot(l,"8","VisualBounds"));return d.length===4&&(s=s?[Math.min(s[0],d[0]),Math.min(s[1],d[1]),Math.max(s[2],d[2]),Math.max(s[3],d[3])]:[d[0],d[1],d[2],d[3]]),!0}),s&&t.push({bbox:s,ascent:i,descent:a,glyphCount:o}),!0}),t}function zS(e){let t=[];return Vi(e,r=>{if(r.kind!=="dict")return;let n=Ic(r);if(n!=="FrameStrike"&&n!=="F")return;let i=ot(r,"0","Transform"),a=Dl(ot(i,"0","Origin")),o=Dl(ot(r,"1","Bounds"));return t.push({frameIndex:Xn(r,"10","Frame")??t.length,position:a.length===2?[a[0],a[1]]:[0,0],extent:o.length===4?[o[0],o[1],o[2],o[3]]:null,rows:M8(r)}),!0}),t}function _S(e){let t=b8(e);if(t===null)return null;let r=jS(t);return{root:r,stories:S8(r),fontNames:$8(r),frames:N8(r),layouts:zS(r)}}var A8={pattern:{code:"construct-approximated",message:"A pattern fill was painted as a flat gray; patterns have no PDF rendition to copy in this file."},"gradient-missing":{code:"construct-approximated",message:"A gradient referenced a definition the file does not carry; a flat gray was used."},"blend-mode-unsupported":{code:"construct-approximated",message:"A blend mode has no CSS equivalent; normal blending is used."},"text-story-unbound":{code:"construct-dropped",message:"A text object could not be matched to its story in the text document."},"image-linked":{code:"construct-dropped",message:"A linked image is not embedded in the file and was left out."},"image-missing":{code:"construct-dropped",message:"An image carried no pixel data and was left out."},"image-undecodable":{code:"construct-dropped",message:"An image payload could not be decoded and was left out."}};function C8(e,t){if(t.artboards.length>0)return[...t.artboards];if(e.artboards.length>0)return[...e.artboards];let r=e.header.hiResBoundingBox??e.header.boundingBox;if(!r)return[];let n=Cm(r);return[{index:1,name:"Artwork",defaultName:!0,canvas:n,width:n[2]-n[0],height:n[3]-n[1],origin:"cropmarks",page:null}]}async function O8(e,t,r,n,i){let a=Date.now(),o=new Ui;o.addAll(t.diagnostics);let s=PS(r.source,{diagnostics:o}),l=_S(r.source),u=jm(r.source),d=((u?.canvasSize??16383)+.5)/2-.25,c=t.artboards[0],f=u?.artboards[0]?.rulerOrigin??(c?[Math.floor(d-c.width/2),Math.floor(d-c.height/2)]:null),p=C8(r,t),h=new Set(n.artboards&&n.artboards!=="all"?n.artboards:p.map(x=>x.index)),m=await y8(s,{artboards:p.filter(x=>h.has(x.index)),textMode:n.textMode??"editable",hiddenLayers:n.hiddenLayers??"import-hidden",precision:n.precision??3,title:r.header.title,layerTitles:n.layerTitles??!0,textDocument:l,rulerOrigin:f});for(let[x,k]of m.constructs){let $=A8[x];o.add({code:$?.code??"construct-dropped",severity:"warning",message:$?.message??`An Illustrator construct (${x}) was dropped.`,name:x,count:k})}for(let[x,k]of s.unknownOperators)o.add({code:"source-operand-mismatch",severity:"info",message:`The source uses the ${x} operator, which the importer does not model.`,name:x,count:k});s.patterns.size>0&&o.add({code:"construct-approximated",severity:"warning",message:"Pattern swatches are painted flat; the file has no PDF rendition to copy them from.",name:[...s.patterns].join(", "),count:s.patterns.size});let g=x=>x.flatMap(k=>[k,...g(k.children)]),v=g(m.layers),y=o.list(),b=OS(y),I=Date.now()-a;return{svg:m.svg,tree:m.tree,decorations:m.decorations,inspection:t,source:{kind:"illustrator",container:t.kind==="not-illustrator"?"pdf-foreign":t.kind,fileName:n.fileName,byteLength:e.length,creatorVersion:t.creatorVersion??void 0},artboards:p.map(x=>({...x,imported:h.has(x.index)})),layers:m.layers,fonts:[],items:b,counts:{shapes:m.counts.shapes,groups:m.counts.groups,layers:v.length,hiddenLayers:v.filter(x=>!x.visible).length,lockedLayers:v.filter(x=>x.locked).length,textEditable:m.counts.texts,textOutlined:m.counts.textOutlined,imagesEmbedded:m.counts.images,rasterizedRegions:0},colorMode:{source:r.header.colorModel==="cmyk"?"CMYK":r.header.colorModel==="rgb"?"RGB":r.header.colorModel==="grayscale"?"Grayscale":"unknown",converted:r.header.colorModel==="cmyk",method:"device"},textMode:(n.textMode??"editable")==="outline"?"outlines":"editable",timings:{parseMs:i,transcodeMs:I},diagnostics:{illustrator:y,pdf:[]},pdf:null,reconciliation:null}}var T8=64,P8=4e6,D8=.9,nS=.9,j8=.5,E8=2,z8=.6,_8=4;function kc(e,t){return[e[0]*t[0]+e[2]*t[1]+e[4],e[1]*t[0]+e[3]*t[1]+e[5]]}function bc(e,t){let r=1/0,n=1/0,i=-1/0,a=-1/0,o=s=>{let l=kc(t,s);r=Math.min(r,l[0]),n=Math.min(n,l[1]),i=Math.max(i,l[0]),a=Math.max(a,l[1])};for(let s of e){o(s.start);for(let l of s.segments)l.c1&&o(l.c1),l.c2&&o(l.c2),o(l.to)}return Number.isFinite(r)?[r,n,i,a]:null}function R8(e,t){let r=e.matrix,n=[[0,0],[e.width,0],[0,-e.height],[e.width,-e.height]].map(o=>kc(t,kc(r,o))),i=n.map(o=>o[0]),a=n.map(o=>o[1]);return[Math.min(...i),Math.min(...a),Math.max(...i),Math.max(...a)]}function F8(e,t,r){switch(e.kind){case"path":return bc(e.subpaths,t);case"image":return R8(e,t);case"text":if(e.story)return r?.(e)??(e.frame?bc(e.frame.subpaths,t):null);if(e.frame)return bc(e.frame.subpaths,t);if(e.runs.length>0){let n=e.runs[0],i=kc(t,[n.matrix[4],n.matrix[5]]),a=e.runs.reduce((o,s)=>o+s.text.length*s.size*.55,0);return[i[0],i[1]-n.size,i[0]+a,i[1]+n.size*.3]}return null;default:return null}}function RS(e){return Math.max(0,e[2]-e[0])*Math.max(0,e[3]-e[1])}function L8(e,t){let r=e[2]-e[0],n=e[3]-e[1],i=t[2]-t[0],a=t[3]-t[1],o=Math.max(r,n,i,a,1),s=Math.hypot((e[0]+e[2])/2-(t[0]+t[2])/2,(e[1]+e[3])/2-(t[1]+t[3])/2),l=Math.abs(r-i)+Math.abs(n-a);return 1-Math.min(1,(s+l/2)/o)}function Jo(e,t){let r=Math.max(0,Math.min(e[2],t[2])-Math.max(e[0],t[0])),n=Math.max(0,Math.min(e[3],t[3])-Math.max(e[1],t[1]));return r*n/Math.max(1e-6,RS(t))}function B8(e,t,r){let n=(t[0]+t[2])/2,i=(t[1]+t[3])/2;return n>=e[0]-r&&n<=e[2]+r&&i>=e[1]-r&&i<=e[3]+r}function V8(e){return Math.max(2,(e[3]-e[1])*.25)}function _m(e){return[Math.min(...e.map(t=>t[0])),Math.min(...e.map(t=>t[1])),Math.max(...e.map(t=>t[2])),Math.max(...e.map(t=>t[3]))]}function U8(e,t){return e.node.kind==="path"||e.node.kind==="compound"?t.kinds.has("path")||t.kinds.has("shading"):e.node.kind==="image"?t.kinds.has("image"):!1}function G8(e){let t=e.clipBounds;if(!t)return e.bbox;let r=[Math.max(e.bbox[0],t[0]),Math.max(e.bbox[1],t[1]),Math.min(e.bbox[2],t[2]),Math.min(e.bbox[3],t[3])];return r[2]>r[0]&&r[3]>r[1]?r:null}function iS(e){return e.node.kind==="text"?e.node.story?.storyIndex??null:null}function FS(e,t){let r=[],n=(a,o,s)=>{r.push({node:a,containers:o,bbox:s,order:r.length,aligned:!1,replaced:!1,failed:!1})},i=(a,o)=>{if(a.kind==="compound"){let s=[],l=!1,u=d=>{if(d.kind==="path"){if(!d.painted||d.clip)return;l=!0;let c=bc(d.subpaths,t.toCanvas);c&&s.push(c)}else if("children"in d)for(let c of d.children)u(c)};u(a),l&&n(a,o,s.length>0?_m(s):null);return}if(a.kind==="layer"||a.kind==="group"||a.kind==="clipgroup"){let s=a===e?o:[...o,a];for(let l of a.children)i(l,s);return}a.kind!=="placeholder"&&(a.kind==="path"&&(!a.painted||a.clip)||n(a,o,F8(a,t.toCanvas,t.textBounds)))};return i(e,[]),r}function LS(e,t){if(e.attrs.id===t)return e;for(let r of e.children){if(Ke(r))continue;let n=LS(r,t);if(n)return n}return null}function BS(e,t){let r=[];for(let n of e.children){if(Ke(n)||n.tag==="title")continue;let i=t.get(n)??null,a=new Set,o=[],s=l=>{let u=t.get(l);if(u){a.add(u.kind);let d=G8(u);d&&o.push(d)}for(let d of l.children)Ke(d)||s(d)};s(n),r.push({node:n,atom:i,bbox:o.length>0?_m(o):null,kinds:a,anchor:null,owners:[]})}return r}function VS(e,t){let r=e.filter(i=>i.node.kind==="text"&&i.bbox!==null);if(r.length===0)return;for(let i of t){if(!i.atom||i.atom.kind!=="text"||!i.bbox)continue;let a=i.bbox,o=null,s=1/0;for(let u of r){let d=u.bbox;if(!B8(d,a,V8(d)))continue;let c=RS(d);c<s&&(o=u,s=c)}if(!o)continue;i.anchor=o,o.aligned=!0;let l=[o];if(Jo(o.bbox,a)<nS){let u=iS(o),d=u===null?[]:r.filter(c=>c!==o&&iS(c)===u&&Jo(c.bbox,a)>0);l=[o,...d].sort((c,f)=>c.order-f.order),Jo(_m(l.map(c=>c.bbox)),a)<nS&&(l=Jo(o.bbox,a)>=j8?[o]:[])}i.owners=l;for(let u of l)u.aligned=!0}let n=new Map;for(let i of t)if(i.atom?.text)for(let a of i.owners){let o=n.get(a)??[];o.push(i.atom.text.unicode.replace(/\s+/g,"").length),n.set(a,o)}for(let[i,a]of n)a.length<_8||a.filter(o=>o<=E8).length/a.length>=z8&&(i.failed=!0)}function US(e,t){let r=e.length*t.length<=P8,n=0;for(let i of e){if(i.node.kind==="text"||!i.bbox)continue;let a=i.bbox,o=-1,s=D8,l=c=>{let f=t[c];if(f.anchor||!f.bbox||!U8(i,f))return!1;let p=L8(a,f.bbox);return p>s?(o=c,s=p,p>.995):!1},u=Math.min(t.length,n+T8),d=!1;for(let c=n;c<u&&!d;c++)d=l(c);if(o<0&&r){for(let c=u;c<t.length&&!d;c++)d=l(c);for(let c=n-1;c>=0&&!d;c--)d=l(c)}o<0||(t[o].anchor=i,i.aligned=!0,n=o+1)}}function X8(e,t){let r=e[t].anchor;if(r)return r.containers;let n=t-1;for(;n>=0&&!e[n].anchor;)n--;let i=t+1;for(;i<e.length&&!e[i].anchor;)i++;let a=n>=0?e[n].anchor:null,o=i<e.length?e[i].anchor:null;if(a&&o&&W8(a.containers,o.containers))return a.containers;let s=e[t].bbox;if(s){let l=a?.bbox?Jo(a.bbox,s):0,u=o?.bbox?Jo(o.bbox,s):0;if(l>=.5&&l>=u)return a.containers;if(u>=.5)return o.containers}return a&&o?a.containers.slice(0,GS(a.containers,o.containers)):[]}function W8(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function GS(e,t){let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)r++;return r}function H8(e,t,r){let n=[];for(let i of e){let a=r(i.node);if(!a||a.tag!=="text")return null;t&&(a.attrs.fill=t),n.push(a)}return n}function q8(e,t,r,n){let i={},a=[],o=[],s=new Map(e.atoms.map(A=>[A.node,A])),l=new Set,u=A=>{A.attrs.id&&l.add(A.attrs.id);for(let S of A.children)Ke(S)||u(S)};u(e.tree);let d=A=>{let S=hn(A)||"group",N=S,T=2;for(;l.has(N);)N=`${S}_${T++}`;return l.add(N),N},c=n.minimumMatchRatio??.5,f=0,p=0,h=0,m=0,g=t.roots.filter(A=>A.kind==="layer"),v=(A,S)=>({name:A.layer?.layerName??"",visible:A.layer?.visible??!0,locked:A.layer?.locked??!1,color:A.layer?.color??null,children:A.children.filter(N=>N.kind==="layer").map(N=>v(N,[])),origin:"source",svgIds:S}),y=r.matches.filter(A=>A.native),b=new Set,I=A=>{let S=A.layer?.layerName??"",N=y.find(T=>!b.has(T)&&T.native?.name===S)??null;return N&&b.add(N),N},x=[],k=[],$=r.structure==="flat"&&g.length>1?Y8(e,g,s,n,d):null;for(let A of g){let S=I(A),N=$?.get(A)??null,T=N?[N]:(S?.svgIds??[]).map(U=>LS(e.tree,U)).filter(U=>U!==null);if(T.length===0){x.push(null),a.push(v(A,[]));continue}x.push(T[0]);let z=FS(A,n);f+=z.length;let C=v(A,N?[N.attrs.id]:S?.svgIds??[]);N&&(i[N.attrs.id]={layerName:A.layer?.layerName||N.attrs.id,hidden:!(A.layer?.visible??!0),locked:A.layer?.locked??!1,inherit:A.layer?.locked??!1});let O=new Map,E=T.map(U=>BS(U,s));for(let U of E)VS(z,U),US(z,U);let _=z.filter(U=>U.aligned).length;if(p+=_,z.length>0&&_/z.length<c){o.push(A.layer?.layerName??""),a.push(C);continue}T.forEach((U,V)=>{let q=E[V],G=[],H=[],W=U.children.filter(X=>!Ke(X)&&X.tag==="title"),B=X=>{(H.length>0?H[H.length-1].node.children:G).push(X)},ie=X=>{let Z=X.kind==="layer",J=O.get(X);if(J)J=d(Z?X.layer?.layerName||"Sublayer":X.name||"group"),Z&&(i[J]=i[O.get(X)]);else if(J=d(Z?X.layer?.layerName||"Sublayer":X.name||"group"),O.set(X,J),Z){m++,i[J]={layerName:X.layer?.layerName||J,hidden:!(X.layer?.visible??!0),locked:X.layer?.locked??!1,inherit:X.layer?.locked??!1};let Ee=Z8(C,X);Ee&&(Ee.svgIds=[...Ee.svgIds,J])}else X.locked&&(i[J]={locked:!0,inherit:!0});let Q=me("g",{id:J});Z&&n.layerTitles!==!1&&Q.children.push(me("title",{},[{text:X.layer?.layerName??J}])),B(Q),H.push({container:X,node:Q})},Y=[];for(let X=0;X<q.length;X++){let Z=q[X];if(Z.owners.length>0&&Z.owners.every(we=>we.replaced))continue;let J=X8(q,X),Q=GS(Y,J);for(;H.length>Q;)H.pop();for(let we=Q;we<J.length;we++)ie(J[we]);if(Y=J,Z.owners.length>0&&Z.owners.every(we=>!we.replaced&&!we.failed)){let we=H8(Z.owners,Z.node.attrs.fill,n.renderNode);if(we){for(let Xe of we)B(Xe);for(let Xe of Z.owners)Xe.replaced=!0;h+=Z.owners.length;continue}for(let Xe of Z.owners)Xe.failed=!0}B(Z.node);let Ee=Z.anchor?.node.name;if(Ee&&Z.atom&&!Z.node.attrs.id){let we=d(Ee);Z.node.attrs.id=we,i[we]={layerName:Ee}}}U.children=[...W,...G]}),a.push(C)}return K8(e.tree,g,x,a,i,d,v,n,k),{decorations:i,layers:a,stats:{leaves:f,matched:p,textReplaced:h,degradedLayers:o,sublayers:m,sourceRenderedLayers:k}}}var aS=new Set(["defs","title","desc","metadata","view","style"]);function Y8(e,t,r,n,i){let a=e.tree,o=a.children.filter(v=>!Ke(v)&&!aS.has(v.tag)),s=o.length===1&&o[0].tag==="g"&&!o[0].attrs.id?o[0]:a,l=BS(s,r).filter(v=>!aS.has(v.node.tag)),u=new Map;t.forEach((v,y)=>{let b=FS(v,n);for(let I of b)u.set(I,y);VS(b,l),US(b,l)});let d=l.map(v=>v.anchor?u.get(v.anchor)??-1:-1);for(let v=0;v<l.length;v++){if(d[v]>=0)continue;let y=v-1;for(;y>=0&&d[y]<0;)y--;let b=v+1;for(;b<l.length&&d[b]<0;)b++;d[v]=y>=0?d[y]:b<l.length?d[b]:0}let c=new Map,f=[];t.forEach((v,y)=>{let b=l.filter((k,$)=>d[$]===y);if(b.length===0)return;let I=v.layer?.layerName||"Layer",x=me("g",{id:i(I)},n.layerTitles!==!1?[me("title",{},[{text:I}])]:[]);x.children.push(...b.map(k=>k.node)),c.set(v,x),f.push(x)});let p=new Set(l.map(v=>v.node)),h=s.children.filter(v=>Ke(v)||!p.has(v)),m=s.children.findIndex(v=>!Ke(v)&&p.has(v)),g=m<0?h.length:h.findIndex(v=>v===s.children[m-1])+1;return h.splice(Math.max(0,Math.min(h.length,m<0?h.length:g)),0,...f),s.children=h,c}function K8(e,t,r,n,i,a,o,s,l){let u=new Map,d=p=>{for(let h of p.children)Ke(h)||(u.set(h,p),d(h))};d(e);let c=r.find(p=>p!==null)??null,f=c?u.get(c)??e:e;t.forEach((p,h)=>{if(r[h])return;let m=!(p.layer?.visible??!0);if(m&&s.hiddenLayers==="skip")return;let g=p.layer?.layerName||"Layer",v=a(g),y=me("g",{id:v},s.layerTitles!==!1?[me("title",{},[{text:g}])]:[]),b=p.children.map(k=>s.renderNode(k)).filter(k=>k!==null);y.children.push(...b),b.some(XS)&&l.push(g);let I=null;for(let k=h-1;k>=0&&!I;k--)I=r[k];let x=null;for(let k=h+1;k<r.length&&!x;k++)x=r[k];if(I){let k=u.get(I)??f;k.children.splice(k.children.indexOf(I)+1,0,y),u.set(y,k)}else if(x){let k=u.get(x)??f;k.children.splice(k.children.indexOf(x),0,y),u.set(y,k)}else f.children.push(y),u.set(y,f);r[h]=y,i[v]={layerName:g,hidden:m,locked:p.layer?.locked??!1,inherit:p.layer?.locked??!1},n[h]=o(p,[v])})}function XS(e){return e.tag==="path"||e.tag==="text"||e.tag==="image"||e.tag==="use"?!0:e.children.some(t=>!Ke(t)&&XS(t))}function Z8(e,t){let r=t.layer?.layerName??"",n=i=>{for(let a of i.children){if(a.name===r&&a.svgIds.length===0)return a;let o=n(a);if(o)return o}return null};return n(e)}var oS=new Set(["defs","title","desc","metadata","view","style"]);function WS(e,t){e.attrs.id&&t.add(e.attrs.id);for(let r of e.children)Ke(r)||WS(r,t)}function sS(e,t){let r=hn(e)||"Layer",n=2;for(;t.has(r);)r=`${hn(e)||"Layer"}_${n++}`;return t.add(r),r}function HS(e){let t=[];for(let r of e)r.id.startsWith("label:")?t.push(...HS(r.children)):t.push(r);return t}function qS(e,t){for(let r of e.children)Ke(r)||(r.tag==="g"&&r.attrs["data-pdf-layer"]!==void 0&&t.push(r),qS(r,t))}function J8(e,t){return e?{layerName:e.name,hidden:!e.visible,locked:e.locked,inherit:e.locked}:{...t?.name?{layerName:t.name}:{},hidden:t?!t.visible:!1}}function Q8(e,t){let r=e.children.find(n=>!Ke(n)&&n.tag==="title");r?r.children=[Om(t)]:e.children.unshift(me("title",{},[Om(t)]))}function lS(e){return new Set(e).size===e.length}function eX(e,t,r,n={}){let i=n.layerTitles??!0,a=new Set;WS(r,a);let o=HS(t).filter(p=>p.svgIds.length>0),s=[],l="flat",u=[];if(o.length>0){l="optional-content";let p=[...o].reverse(),h=e.map(y=>y.name),m=p.map(y=>y.name??""),g=e.length>0&&lS(h)&&lS(m)&&h.every(y=>m.includes(y)),v=new Set;if(g)for(let y of e){let b=p.find(I=>I.name===y.name);v.add(b),s.push({native:y,pdf:b,svgIds:b.svgIds})}else if(e.length===p.length)e.forEach((y,b)=>{v.add(p[b]),s.push({native:y,pdf:p[b],svgIds:p[b].svgIds})});else for(let y of e){let b=p.find(I=>!v.has(I)&&I.name===y.name);b?(v.add(b),s.push({native:y,pdf:b,svgIds:b.svgIds})):u.push(y)}for(let y of p)v.has(y)||s.push({native:null,pdf:y,svgIds:y.svgIds})}else{let p=[];if(qS(r,p),p.sort((h,m)=>Number(h.attrs["data-pdf-layer"])-Number(m.attrs["data-pdf-layer"])),p.length>0)l="marked-content",p.forEach((h,m)=>{let g=e.length===p.length?e[m]:e[m]??null;delete h.attrs["data-pdf-layer"];let v=g?.name??`Layer ${m+1}`;h.attrs.id||(h.attrs.id=sS(v,a)),i&&Q8(h,v),s.push({native:g,pdf:null,svgIds:[h.attrs.id]})}),e.length>p.length&&u.push(...e.slice(p.length));else if(e.length===1){l="single-layer";let h=r.children.filter(y=>!Ke(y)&&!oS.has(y.tag)),m=e[0],g=sS(m.name,a),v=me("g",{id:g},[...i?[me("title",{},[Om(m.name)])]:[],...h]);r.children=[...r.children.filter(y=>Ke(y)||oS.has(y.tag)),v],s.push({native:m,pdf:null,svgIds:[g]})}else u.push(...e)}let d={};for(let p of s){let h=J8(p.native,p.pdf);for(let m of p.svgIds)d[m]=h}let c=(p,h)=>({name:p.name,visible:p.visible,locked:p.locked,color:p.color,children:p.children.map(m=>c(m,[])),origin:"source",svgIds:h}),f=[];for(let p of e){let h=s.find(m=>m.native===p);f.push(c(p,h?.svgIds??[]))}for(let p of s)p.native===null&&p.pdf&&f.push({name:p.pdf.name??"",visible:p.pdf.visible,locked:!1,color:null,children:[],origin:"pdf",svgIds:p.svgIds});return{structure:l,matches:s,decorations:d,layers:f,unmatchedNative:u}}function Om(e){return{text:e}}var Qo=class extends Error{code;container;constructor(e,t,r){super(r),this.name="IllustratorImportError",this.code=e,this.container=t}};function tX(e,t){if(!t||t==="all")return new Set(e.map(n=>n.index));let r=new Set;for(let n of t)e.some(i=>i.index===n)&&r.add(n);return r}function rX(e,t,r,n){return{source:e.colorModel==="cmyk"?"CMYK":e.colorModel==="rgb"?"RGB":e.colorModel==="grayscale"?"Grayscale":t?.diagnostics.some(i=>i.code==="cmyk-converted")?"CMYK":"unknown",converted:r,method:n}}function nX(e,t,r){let n=new Set,i=a=>{a.attrs.id&&n.add(a.attrs.id);for(let o of a.children)Ke(o)||i(o)};i(e);for(let a of t.pages){if(!a.viewId)continue;let o=r.find(c=>c.page===a.index);if(!o)continue;let s=e.children.find(c=>!Ke(c)&&c.tag==="view"&&c.attrs.id===a.viewId);if(!s)continue;n.delete(s.attrs.id);let l=hn(o.name)||`Artboard_${o.index}`,u=2;for(;n.has(l);)l=`${hn(o.name)||"Artboard"}_${u++}`;n.add(l),s.attrs.id=l;let d=s.children.find(c=>!Ke(c)&&c.tag==="title");d?d.children=[uS(o.name)]:s.children.unshift(me("title",{},[uS(o.name)]))}}function Ml(){return Date.now()}function YS(e){return e.reduce((t,r)=>t+(r.svgIds.length>0?1:0)+YS(r.children),0)}async function KS(e,t){let r=Ml(),{inspection:n,parsed:i}=X4(e),a=n.kind,o=a==="not-illustrator"?"not-illustrator":a;if(a==="not-illustrator")throw new Qo("not-illustrator",o,"The file is neither an Illustrator document nor a PDF.");if(n.encrypted)throw new Qo("encrypted",o,"The document is encrypted.");if(a==="pdf-private-only"||a==="postscript-legacy"||a==="postscript-eps"){if(!i)throw new Qo("native-source-required",o,"The file has no PDF rendition and its Illustrator source could not be read.");return O8(e,n,i,t,Ml()-r)}let s=new Ui;s.addAll(n.diagnostics);let l=Ml()-r,u=tX(n.artboards,t.artboards);if(u.size===0)throw new Qo("no-artboards-selected",o,"No artboard was selected for import.");let d=n.artboards.filter(O=>u.has(O.index)&&O.page!==null).map(O=>O.page),c=n.artboards.filter(O=>O.origin==="artboard-record"&&O.page!==null).map(O=>({page:O.page,canvas:O.canvas})),f=Ml(),p=await zk(e,{runtime:t.runtime,pages:d.length>0?d:"all",textMode:t.textMode??"editable",hiddenLayers:t.hiddenLayers??"import-hidden",layerTitles:t.layerTitles??!0,pagePlacements:c,colorManagement:t.colorManagement??"device",precision:t.precision,idPrefix:a==="pdf-foreign"?"pdf":"ai",fontMap:t.fontMap,signal:t.signal,onProgress:t.onProgress}),h=Ml()-f,m=i?.layers??[],g=t.layerTitles??!0,v=eX(m,p.layers,p.tree,{layerTitles:g}),y=v.decorations,b=v.layers,I=null;if(i&&a==="pdf-compatible"){let O=PS(i.source,{diagnostics:s}),E=_S(i.source),_=jm(i.source),U=n.artboards[0],V=((_?.canvasSize??16383)+.5)/2-.25,q=_?.artboards[0]?.rulerOrigin??(U?[Math.floor(V-U.width/2),Math.floor(V-U.height/2)]:null),G=n.artboards.map(B=>{let ie=p.pages.find(Y=>Y.index===B.page);return ie?{...B,canvas:ie.box.canvas}:B}),H=g8(O,{artboards:G,textMode:t.textMode??"editable",hiddenLayers:t.hiddenLayers??"import-hidden",precision:t.precision??3,title:null,layerTitles:g,textDocument:E,rulerOrigin:q});I=q8(p,O,v,{renderNode:H.renderNode,textBounds:H.textBounds,toCanvas:H.toCanvas,hiddenLayers:t.hiddenLayers??"import-hidden",layerTitles:g}),y={...v.decorations,...I.decorations};let W=new Set(I.layers.map(B=>B.name));b=[...I.layers,...v.layers.filter(B=>!W.has(B.name))];for(let B of I.stats.degradedLayers)s.add({code:"structure-degraded",severity:"warning",message:"Fewer than half of a layer's objects aligned with the PDF rendition, so the layer keeps the PDF structure.",name:B});for(let B of I.stats.sourceRenderedLayers)s.add({code:"layer-source-rendered",severity:"info",message:"The PDF rendition has nothing for this layer, so its art was drawn from the Illustrator source; live effects on it are not shown.",name:B})}if(!I)for(let O of v.unmatchedNative)s.add({code:"layer-unmatched",severity:"warning",message:"A layer of the Illustrator document has no matching group in its PDF rendition; its objects keep the PDF structure.",name:O.name});nX(p.tree,p,n.artboards);let x=qo(p.tree),k=J4(p.tree),$=O=>O.flatMap(E=>[E,...$(E.children)]),A=$(m),S=p.diagnostics.filter(O=>O.code==="mesh-rasterized"||O.code==="radial-gradient-rasterized").reduce((O,E)=>O+E.count,0),N=[...Y4(p.diagnostics),...OS(s.list())],T=p.diagnostics.some(O=>O.code==="cmyk-converted"||O.code==="spot-color-flattened"),z=p.diagnostics,C=s.list();return{svg:x,tree:p.tree,decorations:y,inspection:n,source:{kind:a==="pdf-foreign"?"pdf":"illustrator",container:a,fileName:t.fileName,byteLength:e.length,producer:p.info.producer??void 0,creatorVersion:n.creatorVersion??void 0},artboards:n.artboards.map(O=>{let E=p.pages.find(U=>U.index===O.page),_=E?E.box.canvas:O.canvas;return{...O,canvas:_,width:_[2]-_[0],height:_[3]-_[1],imported:u.has(O.index)}}),layers:b,fonts:K4(p.fonts),items:N,counts:{shapes:k.shapes,groups:k.groups,layers:YS(b),hiddenLayers:A.filter(O=>!O.visible).length,lockedLayers:A.filter(O=>O.locked).length,textEditable:k.texts,textOutlined:p.stats.textsOutlined,imagesEmbedded:k.images,rasterizedRegions:S},colorMode:rX(n,p,T,t.colorManagement??"device"),textMode:(t.textMode??"editable")==="outline"?"outlines":"editable",timings:{parseMs:l,transcodeMs:h},diagnostics:{illustrator:C,pdf:z},pdf:p,reconciliation:I?I.stats:null}}function uS(e){return{text:e}}function Mc(e){return e.endsWith("/")?e:`${e}/`}import{createRequire as iX}from"module";import*as ts from"path";import{pathToFileURL as aX}from"url";function ZS(){let e=iX(import.meta.url);return ts.dirname(e.resolve("pdfjs-dist/package.json"))}function JS(e={}){let t=null,r=()=>(e.assetDir??ZS()).split(ts.sep).join("/");return{env:"node",load(){return t||(t=e.loadModule?e.loadModule():import(aX(ts.join(ZS(),"legacy/build/pdf.mjs")).href)),t},documentParams(){let n=r();return{cMapUrl:Mc(`${n}/cmaps`),cMapPacked:!0,standardFontDataUrl:Mc(`${n}/standard_fonts`),wasmUrl:Mc(`${n}/wasm`)}},supportsIcc(){return!1}}}var Hn=new oX,lX=sX(import.meta.url)("../package.json").version;Hn.name("svgsketch").description("CLI for importing SVG, Illustrator and PDF files and working with SVGSketch .svgs documents").version(lX);async function zl(e,t=".svgs"){let r=Ea(e),n=r$(r).toLowerCase();n!==t&&console.error(`\u26A0 Warning: expected a ${t} file but got "${n||"(no extension)"}"`);try{await t$(r)}catch{return console.error(`\u2717 File not found: ${r}`),process.exitCode=1,null}try{let i=await e$(r,"utf-8");return{filePath:r,content:i}}catch(i){return console.error(`\u2717 Failed to read file: ${i.message}`),process.exitCode=1,null}}function n$(e){for(let t of e)console.error(`${t.severity}: ${t.code}: ${t.message}`)}async function i$(e){let t=Ea(e);try{await t$(t)}catch{return console.error(`\u2717 File not found: ${t}`),process.exitCode=1,null}try{let r=new Uint8Array(await e$(t));return{filePath:t,bytes:r}}catch(r){return console.error(`\u2717 Failed to read file: ${r.message}`),process.exitCode=1,null}}var uX={svg:[".svg"],svgs:[".svgs"],pdf:[".pdf",".ai"],postscript:[".ai",".eps",".ps"],png:[".png"],jpeg:[".jpg",".jpeg"],gif:[".gif"],webp:[".webp"]};function a$(e){switch(e){case"svg":return"an SVG document";case"svgs":return"an SVGSketch .svgs document";case"pdf":return"a PDF (or PDF-compatible Illustrator) document";case"postscript":return"a PostScript document";case"png":return"a PNG image";case"jpeg":return"a JPEG image";case"gif":return"a GIF image";case"webp":return"a WebP image";default:return"an unrecognized file"}}function dX(e,t){let r=uX[t];if(!r)return;let n=r$(e).toLowerCase();r.includes(n)||console.error(`\u26A0 Note: "${jl(e)}" has extension "${n||"(none)"}" but contains ${a$(t)}; the bytes decide`)}function o$(e){let t=e.trim();if(t.toLowerCase()==="all")return"all";let r=t.split(",").map(n=>n.trim());if(r.length===0||r.some(n=>!/^[1-9]\d*$/.test(n)))throw new Cc('must be "all" or comma-separated 1-based indices such as 1,3');return[...new Set(r.map(Number))]}function Oc(e){return t=>{let r=t.trim().toLowerCase();if(!e.includes(r))throw new Cc(`must be one of: ${e.join(", ")}`);return r}}var Tc=["editable","outline"],Pc=["import","skip"];function cX(e,t,r){return A1({source:e.source,artboards:e.artboards.map(n=>({index:n.index,name:n.name,width:n.width,height:n.height,imported:n.imported})),colorMode:e.colorMode,textMode:e.textMode,counts:e.counts,items:e.items,fonts:e.fonts,ingestDiagnostics:t,timings:{...e.timings,ingestMs:r},details:{layers:e.layers,illustratorDiagnostics:e.diagnostics.illustrator,pdfDiagnostics:e.diagnostics.pdf}})}async function fX(e,t,r){let n;try{n=await KS(t,{runtime:JS(),artboards:r.artboards??"all",textMode:r.text??"editable",hiddenLayers:r.hiddenLayers==="skip"?"skip":"import-hidden",fileName:jl(e)})}catch(d){return d instanceof Qo?(console.error(`\u2717 ${d.message}`),d.code==="native-source-required"&&console.error(' Save the file again from Illustrator with "Create PDF Compatible File" enabled.')):console.error(`\u2717 Failed to convert ${jl(e)}: ${d.message}`),process.exitCode=1,null}let i=0;for(let d of n.diagnostics.pdf)console.error(`${d.severity}: pdf:${d.code}: ${d.message}`),d.severity!=="info"&&i++;for(let d of n.diagnostics.illustrator)console.error(`${d.severity}: illustrator:${d.code}: ${d.message}`),d.severity!=="info"&&i++;let a=performance.now(),o=Bh(n.svg,{source:n.source.kind==="pdf"?"pdf":"illustrator",entrypoint:n.source.kind==="pdf"?"pdf-document-import":"illustrator-document-import",nodeDecorations:n.decorations}),s=Math.round(performance.now()-a);n$(o.diagnostics);let l=o.diagnostics.filter(d=>d.severity==="error");if(!o.value||l.length>0)return process.exitCode=1,null;let u=o.diagnostics.filter(d=>d.severity==="warning");return{snapshot:o.value,diagnostics:o.diagnostics,warningCount:u.length+i,report:cX(n,o.diagnostics,s)}}function pX(e){let t=Bh(Buffer.from(e).toString("utf-8"),{source:"svg",entrypoint:"svg-document-import"});n$(t.diagnostics);let r=t.diagnostics.filter(n=>n.severity==="error");return!t.value||r.length>0?(process.exitCode=1,null):{snapshot:t.value,diagnostics:t.diagnostics,warningCount:t.diagnostics.filter(n=>n.severity==="warning").length,report:null}}async function s$(e,t){let r=Ea(t);try{await El(r,JSON.stringify(e,null,2)+`
96
+ `,"utf-8")}catch(n){return console.error(`\u2717 Failed to write report: ${n.message}`),process.exitCode=1,!1}return console.log(`\u2713 Import report \u2192 ${r}`),!0}function l$(e,t){t&&e>0&&(console.error(`\u2717 ${e} import warning${e!==1?"s":""} treated as failure (--fail-on-warnings)`),process.exitCode=1)}function rs(e){let t=e.trim();if(!/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(t))throw new Cc("must be a valid number");let r=Number(t);if(!Number.isFinite(r))throw new Cc("must be a finite number");return r}function Dc(e,t){for(let r of e)console.error(`${r.severity}: ${r.message}`);t&&e.length>0&&(console.error(`\u2717 ${e.length} render diagnostic${e.length!==1?"s":""} treated as failure (--fail-on-warnings)`),process.exitCode=1)}function ns(e,t){return e===void 0?!0:isNaN(e)||e<=0||!isFinite(e)?(console.error(`\u2717 Invalid ${t}: must be a positive number`),process.exitCode=1,!1):!0}async function u$(e,t,r){let n=M1(t);switch(dX(e,n),n){case"svg":return pX(t);case"pdf":case"postscript":return fX(e,t,r);case"svgs":{if(!r.acceptSvgs)return console.error(`\u2717 "${jl(e)}" is already an SVGSketch .svgs document; use validate, render or convert`),process.exitCode=1,null;let i;try{i=Sa(Buffer.from(t).toString("utf-8"))}catch(a){return console.error(`Error parsing document: ${a.message}`),process.exitCode=1,null}return{snapshot:Lo(i),diagnostics:[],warningCount:0,report:null}}default:return console.error(`\u2717 "${jl(e)}" is ${a$(n)}; accepted inputs are SVG, Illustrator (.ai), PDF and EPS files${r.acceptSvgs?" and .svgs documents":""}`),process.exitCode=1,null}}Hn.command("import").description("Import an SVG, Illustrator (.ai), PDF or EPS document into the native .svgs format").argument("<input>","Path to the source file (.svg, .ai, .pdf or .eps)").requiredOption("-o, --output <path>","Output file path (.svgs)").option("--artboards <list>",'Artboards or pages to import from .ai and .pdf input: comma-separated 1-based indices, or "all" (default)',o$).option("--text <mode>",`Text handling for .ai and .pdf input: ${Tc.join(" | ")} (default: editable)`,Oc(Tc)).option("--hidden-layers <mode>",`Hidden layers in .ai and .pdf input: ${Pc.join(" | ")} (default: import)`,Oc(Pc)).option("--report <path>","Write the import report as JSON (.ai and .pdf input)").option("--fail-on-warnings","Exit with a nonzero status when import warnings are reported").action(async(e,t)=>{let r=await i$(e);if(!r)return;let n=await u$(r.filePath,r.bytes,{...t,acceptSvgs:!1});if(!n)return;let i=Ea(t.output);try{await El(i,MI(n.snapshot),"utf-8")}catch(o){console.error(`\u2717 Failed to write output: ${o.message}`),process.exitCode=1;return}if(t.report){if(!n.report)console.error("\u26A0 Note: --report applies to Illustrator and PDF input only; no report written");else if(!await s$(n.report,t.report))return}l$(n.warningCount,t.failOnWarnings);let a=n.snapshot.shapes.length;console.log(`\u2713 Imported ${a} shape${a!==1?"s":""} \u2192 ${i}`)});Hn.command("convert").description("Convert an SVG, Illustrator (.ai), PDF, EPS or .svgs document to a plain SVG file").argument("<input>","Path to the source file (.svg, .ai, .pdf, .eps or .svgs)").requiredOption("-o, --output <path>","Output file path (.svg)").option("-w, --width <n>","Override canvas width",rs).option("-H, --height <n>","Override canvas height",rs).option("--background <color>","Background color (e.g. #ffffff)").option("--no-xml-declaration","Omit the XML declaration").option("--artboards <list>",'Artboards or pages to convert from .ai and .pdf input: comma-separated 1-based indices, or "all" (default)',o$).option("--text <mode>",`Text handling for .ai and .pdf input: ${Tc.join(" | ")} (default: editable)`,Oc(Tc)).option("--hidden-layers <mode>",`Hidden layers in .ai and .pdf input: ${Pc.join(" | ")} (default: import)`,Oc(Pc)).option("--report <path>","Write the import report as JSON (.ai and .pdf input)").option("--fail-on-warnings","Exit with a nonzero status when import or render diagnostics are reported (output is still written)").action(async(e,t)=>{if(!ns(t.width,"width")||!ns(t.height,"height"))return;let r=await i$(e);if(!r)return;let n=await u$(r.filePath,r.bytes,{...t,acceptSvgs:!0});if(!n)return;let i={width:t.width,height:t.height,backgroundColor:t.background,xmlDeclaration:t.xmlDeclaration},{svg:a,diagnostics:o}=Qd(n.snapshot,i),s=Ea(t.output);try{await El(s,a,"utf-8")}catch(u){console.error(`\u2717 Failed to write output: ${u.message}`),process.exitCode=1;return}if(t.report){if(!n.report)console.error("\u26A0 Note: --report applies to Illustrator and PDF input only; no report written");else if(!await s$(n.report,t.report))return}Dc(o,t.failOnWarnings??!1),l$(n.warningCount,t.failOnWarnings);let l=n.snapshot.shapes?.length??0;console.log(`\u2713 Converted ${l} shape${l!==1?"s":""} \u2192 ${s}`)});Hn.command("validate").description("Validate a .svgs document").argument("<input>","Path to the .svgs file").option("--json","Output result as JSON").action(async(e,t)=>{let r=await zl(e);if(!r)return;let{filePath:n,content:i}=r,a;try{a=Sa(i)}catch(s){t.json?console.log(JSON.stringify({valid:!1,file:n,error:s.message},null,2)):console.error(`\u2717 Parse error: ${s.message}`),process.exitCode=1;return}let o=ul(a);if(t.json)console.log(JSON.stringify({valid:o.valid,file:n,version:a.schemaVersion??"unknown",shapes:a.shapes?.length??0,warnings:o.warnings.map(s=>s.message),errors:o.errors.map(s=>s.message)},null,2));else if(o.valid){let s=a.shapes?.length??0;if(console.log(`\u2713 Valid .svgs document (v${a.schemaVersion??"?"}, ${s} shape${s!==1?"s":""})`),o.warnings.length>0)for(let l of o.warnings)console.log(` \u26A0 ${l.message}`)}else{console.error("\u2717 Invalid document:");for(let s of o.errors)console.error(` \u2022 ${s.message}`);process.exitCode=1}});Hn.command("render").description("Render a .svgs document to SVG").argument("<input>","Path to the .svgs file").requiredOption("-o, --output <path>","Output file path (.svg)").option("-w, --width <n>","Override canvas width",rs).option("-H, --height <n>","Override canvas height",rs).option("--background <color>","Background color (e.g. #ffffff)").option("--no-xml-declaration","Omit the XML declaration").option("--fail-on-warnings","Exit with a nonzero status when render diagnostics are reported (output is still written)").option("--var <key=value...>","Set template variable (repeatable)",(e,t)=>[...t,e],[]).action(async(e,t)=>{if(!ns(t.width,"width")||!ns(t.height,"height"))return;let r=await zl(e);if(!r)return;let{content:n}=r,i;try{i=Sa(n)}catch(u){console.error(`Error parsing document: ${u.message}`),process.exitCode=1;return}if(t.var&&t.var.length>0)try{let u=jh(t.var);i=Lo(i,u)}catch(u){console.error(`Error parsing variables: ${u.message}`),process.exitCode=1;return}else i=Lo(i);let a={width:t.width,height:t.height,backgroundColor:t.background,xmlDeclaration:t.xmlDeclaration},{svg:o,diagnostics:s}=Qd(i,a),l=Ea(t.output);try{await El(l,o,"utf-8")}catch(u){console.error(`\u2717 Failed to write output: ${u.message}`),process.exitCode=1;return}Dc(s,t.failOnWarnings??!1),console.log(`\u2713 Rendered ${i.shapes?.length??0} shapes \u2192 ${l}`)});Hn.command("info").description("Display document metadata").argument("<input>","Path to the .svgs file").option("--json","Output result as JSON").action(async(e,t)=>{let r=await zl(e);if(!r)return;let{filePath:n,content:i}=r,a;try{a=Sa(i)}catch(f){console.error(`Error parsing document: ${f.message}`),process.exitCode=1;return}let o=a.shapes??[],s={};for(let f of o)s[f.type]=(s[f.type]??0)+1;let l=a.viewboxes?.[0],u=a.documentMetadata,d=a.templateVariables??[],c={file:n,schemaVersion:a.schemaVersion??"unknown",currentVersion:In,canvas:{width:l?.width??"?",height:l?.height??"?"},metadata:u?{title:u.title||void 0,description:u.description||void 0,author:u.author||void 0,keywords:u.keywords&&u.keywords.length>0?u.keywords:void 0,language:u.language||void 0,license:u.license||void 0}:void 0,templateVariables:d.length>0?d.length:void 0,shapes:{total:o.length,byType:s}};if(t.json)console.log(JSON.stringify(c,null,2));else if(console.log(`File: ${c.file}`),console.log(`Version: ${c.schemaVersion} (current: ${c.currentVersion})`),console.log(`Canvas: ${c.canvas.width}\xD7${c.canvas.height}`),u&&(u.title&&console.log(`Title: ${u.title}`),u.author&&console.log(`Author: ${u.author}`),u.description&&console.log(`Description: ${u.description}`),u.language&&console.log(`Language: ${u.language}`),u.license&&console.log(`License: ${u.license}`),u.keywords&&u.keywords.length>0&&console.log(`Keywords: ${u.keywords.join(", ")}`)),d.length>0&&console.log(`Variables: ${d.length}`),console.log(`Shapes: ${c.shapes.total}`),Object.keys(s).length>0)for(let[f,p]of Object.entries(s).sort())console.log(` ${f}: ${p}`)});Hn.command("vars").description("List template variables defined in a .svgs document").argument("<input>","Path to the .svgs file").option("--json","Output result as JSON").action(async(e,t)=>{let r=await zl(e);if(!r)return;let{content:n}=r,i;try{i=Sa(n)}catch(s){console.error(`Error parsing document: ${s.message}`),process.exitCode=1;return}let{defined:a,undeclared:o}=AI(i);if(t.json)console.log(JSON.stringify({defined:a,undeclared:o},null,2));else{if(a.length===0&&o.length===0){console.log("No template variables found.");return}if(a.length>0){console.log("Defined variables:");for(let s of a){let l=s.label?` (${s.label})`:"";console.log(` {{${s.name}}}${l} [${s.type}] default: ${s.defaultValue||"(empty)"}`)}}if(o.length>0){console.log("Undeclared references (used but not defined):");for(let s of o)console.log(` \u26A0 {{${s}}}`)}}});var Rm=["svg","react","vue","d3","css"];Hn.command("codegen").description("Generate code from a .svgs document (React, Vue, D3, CSS, or raw SVG)").argument("<input>","Path to the .svgs file").requiredOption("-f, --format <format>",`Output format: ${Rm.join(", ")}`).option("-o, --output <path>","Output file path (prints to stdout if omitted)").option("--name <name>","Component/function name (default: SvgComponent)").option("-w, --width <n>","Override canvas width",rs).option("-H, --height <n>","Override canvas height",rs).option("--typescript","Use TypeScript syntax (React, Vue, D3)").option("--fail-on-warnings","Exit with a nonzero status when render diagnostics are reported (output is still written)").option("--var <key=value...>","Set template variable (repeatable)",(e,t)=>[...t,e],[]).action(async(e,t)=>{if(!ns(t.width,"width")||!ns(t.height,"height"))return;let r=t.format;if(!Rm.includes(r)){console.error(`\u2717 Invalid format "${t.format}". Valid formats: ${Rm.join(", ")}`),process.exitCode=1;return}let n=await zl(e);if(!n)return;let{content:i}=n,a;try{a=Sa(i)}catch(l){console.error(`Error parsing document: ${l.message}`),process.exitCode=1;return}if(t.var&&t.var.length>0)try{let l=jh(t.var);a=Lo(a,l)}catch(l){console.error(`Error parsing variables: ${l.message}`),process.exitCode=1;return}else a=Lo(a);let{code:o,diagnostics:s}=G1(a,{format:r,componentName:t.name,width:t.width,height:t.height,typescript:t.typescript??!1});if(t.output){let l=Ea(t.output);try{await El(l,o,"utf-8")}catch(u){console.error(`\u2717 Failed to write output: ${u.message}`),process.exitCode=1;return}Dc(s,t.failOnWarnings??!1),console.log(`\u2713 Generated ${r} code \u2192 ${l}`)}else Dc(s,t.failOnWarnings??!1),process.stdout.write(o)});var QS="https://docs.svgsketch.com",Ac={document:{url:"/sdk/document/",description:"DocumentBuilder class API"},shapes:{url:"/sdk/shapes/",description:"Shape builders (Circle, Rectangle, Text, ...)"},styles:{url:"/sdk/styles/",description:"Gradients & patterns"},filters:{url:"/sdk/filters/",description:"Filter effects (shadow, blur, artistic, ...)"},animation:{url:"/sdk/animation/",description:"Timeline & Track animation builders"},types:{url:"/sdk/types/",description:"TypeScript types & interfaces"},cli:{url:"/cli/",description:"CLI command reference"},format:{url:"/format/",description:".svgs file format specification"}};Hn.command("docs").description("Open SDK documentation or show a quick reference").argument("[section]","Section to open: "+Object.keys(Ac).join(", ")).option("--url","Print the URL instead of opening the browser").option("--list","List all available documentation sections").action(async(e,t)=>{if(t.list){console.log(`Available documentation sections:
97
+ `);for(let[o,{description:s}]of Object.entries(Ac))console.log(` ${o.padEnd(12)} ${s}`);console.log(`
98
+ Usage: svgsketch docs [section]`),console.log(" svgsketch docs --url [section]");return}let r=QS+"/sdk/";if(e){let o=Ac[e.toLowerCase()];if(!o){console.error(`\u2717 Unknown section "${e}". Available: ${Object.keys(Ac).join(", ")}`),process.exitCode=1;return}r=QS+o.url}if(t.url){console.log(r);return}let{exec:n}=await import("child_process"),{platform:i}=await import("os"),a=i()==="win32"?`start "" "${r}"`:i()==="darwin"?`open "${r}"`:`xdg-open "${r}"`;n(a,o=>{o&&console.log(r)})});Hn.parseAsync().catch(e=>{console.error(`\u2717 ${e instanceof Error?e.message:String(e)}`),process.exitCode=1});
99
+ /*! Bundled license information:
100
+
101
+ xmlchars/xml/1.0/ed5.js:
102
+ (**
103
+ * Character classes and associated utilities for the 5th edition of XML 1.0.
104
+ *
105
+ * @author Louis-Dominique Dubeau
106
+ * @license MIT
107
+ * @copyright Louis-Dominique Dubeau
108
+ *)
109
+
110
+ xmlchars/xml/1.1/ed2.js:
111
+ (**
112
+ * Character classes and associated utilities for the 2nd edition of XML 1.1.
113
+ *
114
+ * @author Louis-Dominique Dubeau
115
+ * @license MIT
116
+ * @copyright Louis-Dominique Dubeau
117
+ *)
118
+
119
+ xmlchars/xmlns/1.0/ed3.js:
120
+ (**
121
+ * Character class utilities for XML NS 1.0 edition 3.
122
+ *
123
+ * @author Louis-Dominique Dubeau
124
+ * @license MIT
125
+ * @copyright Louis-Dominique Dubeau
126
+ *)
127
+ */